prima: WLAN Driver Release 3.1.7.9

This is the initial release of the Prima WLAN Driver
diff --git a/CORE/BAP/inc/bapApi.h b/CORE/BAP/inc/bapApi.h
new file mode 100644
index 0000000..7de6ca2
--- /dev/null
+++ b/CORE/BAP/inc/bapApi.h
@@ -0,0 +1,2946 @@
+/*
+ * 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 WLAN_QCT_WLANBAP_H
+#define WLAN_QCT_WLANBAP_H
+
+/*===========================================================================
+
+               W L A N   B T - A M P  P A L   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan BT-AMP PAL layer 
+  module.
+  
+      
+  Copyright (c) 2008 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: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/inc/bapApi.h,v 1.21 2009/03/09 08:58:26 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $
+
+
+when        who    what, where, why
+--------    ---    ----------------------------------------------------------
+07/01/08    jez     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_api.h" 
+#include "vos_packet.h" 
+//I need the TL types and API
+#include "wlan_qct_tl.h"
+
+/* BT-AMP PAL API structure types  - FramesC generated */ 
+#include "btampHCI.h" 
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+/*----------------------------------------------------------------------------
+ *  HCI Interface supported
+ * 
+ *   Here we list the HCI Commands and Events which our 802.11 BT-AMP PAL
+ *   supports.
+ * 
+ * -------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  Supported HCI Commands 
+---------------------------------------------------------------------------*/      
+#if 0
+/** BT v3.0 Link Control commands */
+    BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD,
+    BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD,
+    BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD,
+    BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD,
+    BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD,
+    BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD,
+    BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD,
+    BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD,
+/*
+Host Controller and Baseband Commands
+*/
+    BTAMP_TLV_HCI_RESET_CMD,
+    BTAMP_TLV_HCI_SET_EVENT_MASK_CMD,
+    BTAMP_TLV_HCI_FLUSH_CMD,
+    BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD,
+    BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD,
+    BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD,
+    BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD,
+/* v3.0 Host Controller and Baseband Commands */
+    BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD,
+    BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD,
+    BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD,
+    BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD,
+    BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD,
+    BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD,
+    BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD,
+    BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TO_CMD,
+    BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TO_CMD,
+/** opcode definition for this command from AMP HCI CR D9r4 markup */
+    BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD,
+/* End of v3.0 Host Controller and Baseband Commands */
+/*
+Informational Parameters
+*/
+    BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFORMATION_CMD,
+    BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_COMMANDS_CMD,
+    BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD,
+/* v3.0 Informational commands */
+    BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD,
+/*
+Status Parameters
+*/
+    BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD,
+    BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD,
+    BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD,
+    BTAMP_TLV_HCI_READ_RSSI_CMD,
+    BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD,
+    BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD,
+    BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD,
+/*
+Debug Commands
+*/
+    BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD,
+    BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD,
+#endif
+
+/*---------------------------------------------------------------------------
+  Supported HCI Events
+---------------------------------------------------------------------------*/      
+#if 0
+/** BT events */
+    BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT,
+    BTAMP_TLV_HCI_COMMAND_STATUS_EVENT,
+    BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT,
+    BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT,
+    BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT,
+    BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT,
+    BTAMP_TLV_HCI_QOS_VIOLATION_EVENT,
+/** BT v3.0 events */
+    BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT,
+    BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT ,
+    BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT ,
+    BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT ,
+    BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT ,
+    BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT ,
+    BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT ,
+    BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT ,
+    BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT ,
+    BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT ,
+#endif
+
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+  Packet type defines for the AMP to PAL packet encapsulation.
+---------------------------------------------------------------------------*/      
+#define WLANBAP_HCI_COMMAND_PACKET      0x01     /**< HCI command packet type, characterizing packet types over the
+                                              UART and RS232 transports */
+#define WLANBAP_HCI_ACL_DATA_PACKET     0x02     /**< HCI ACL data packet type, characterizing packet types over the
+                                              UART and RS232 transports */
+#define WLANBAP_HCI_SCO_DATA_PACKET     0x03     /**< HCI SCO data packet type, characterizing packet types over the
+                                              UART and RS232 transports */
+#define WLANBAP_HCI_EVENT_PACKET        0x04     /**< HCI event packet type, characterizing packet types over the
+                                              UART and RS232 transports */
+/*---------------------------------------------------------------------------
+  HCI Data packet size limitation.
+---------------------------------------------------------------------------*/      
+#define WLANBAP_MAX_80211_PAL_PDU_SIZE                1492
+
+/*---------------------------------------------------------------------------
+  HCI Flow Control Modes.
+---------------------------------------------------------------------------*/      
+#define WLANBAP_FLOW_CONTROL_MODE_PACKET_BASED        0x00
+#define WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED         0x01
+
+/*---------------------------------------------------------------------------
+  BT "assigned numbers"
+---------------------------------------------------------------------------*/      
+// Qualcomm Company ID
+#define WLANBAP_QUALCOMM_COMPANY_ID                     29
+
+// HCI Interface version 
+// Parameter Name               Assigned Values 
+// HCI_Version                  0  => Bluetooth HCI Specification 1.0B 
+//                              1  => Bluetooth HCI Specification 1.1 
+//                              2  => Bluetooth HCI Specification 1.2 
+//                              3  => Bluetooth HCI Specification 2.0 
+//                              4  => Bluetooth HCI Specification 2.1 
+//                              5  => Bluetooth HCI Specification 3.0 
+#define WLANBAP_HCI_VERSION                              5
+#define WLANBAP_HCI_REVISION                             0 
+#define WLANBAP_PAL_VERSION                              0x01
+#define WLANBAP_PAL_SUBVERSION                           0x00
+
+// AMP device status 
+#define WLANBAP_HCI_AMP_STATUS_POWERED_DOWN              0x00
+#define WLANBAP_HCI_AMP_STATUS_NOT_SHARED                0x01
+#define WLANBAP_HCI_AMP_STATUS_SHARED                    0x02
+#define WLANBAP_HCI_AMP_STATUS_RESERVED                  0x03
+
+// ACL Packet types (AMP only uses 0x03) 
+#define WLANBAP_HCI_PKT_START_NON_FLUSH                  0x00
+#define WLANBAP_HCI_PKT_CONT                             0x01
+#define WLANBAP_HCI_PKT_START_FLUSH                      0x02
+#define WLANBAP_HCI_PKT_AMP                              0x03
+
+/*---------------------------------------------------------------------------
+  BT-AMP PAL supported commands defines 
+
+  The Supported Commands configuration parameter lists which HCI commands the 
+local controller supports. It is implied that if a command is listed as 
+supported, the feature underlying that command is also supported.
+  The Supported Commands is a 64 octet bit field. If a bit is set to 1, then 
+this command is supported.
+
+---------------------------------------------------------------------------*/      
+//    0     1     2     3     4     5     6     7
+
+#define WLANBAP_PAL_SUPPORTED_HCI_CMDS {  \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x0c, \
+    0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x88, 0x3c, \
+    0x00, 0x00, 0x00, 0x40, 0x00, 0xff, 0xff, 0x07, \
+    0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  \
+}
+
+/*---------------------------------------------------------------------------
+  BT-AMP PAL "status" and "reason" error code defines 
+---------------------------------------------------------------------------*/      
+#define WLANBAP_STATUS_SUCCESS                        (0x00) /* Success. Section 3.1.7 */
+
+#define WLANBAP_ERROR_UNKNOWN_HCI_CMND                (0x01)  
+#define WLANBAP_ERROR_NO_CNCT                         (0x02)  /* AMP HCI Section 7.1.39 */
+#define WLANBAP_ERROR_HARDWARE_FAILURE                (0x03) 
+#define WLANBAP_ERROR_PAGE_TIMEOUT                    (0x04)  
+/* Section 3.1.10 has this mis-identified as 0x08  */ 
+#define WLANBAP_ERROR_AUTHENT_FAILURE                 (0x05)  
+#define WLANBAP_ERROR_KEY_MISSING                     (0x06) 
+#define WLANBAP_ERROR_MEMORY_FULL                     (0x07) 
+#define WLANBAP_ERROR_CNCT_TIMEOUT                    (0x08)  /* Section 3.1.8 */
+#define WLANBAP_ERROR_MAX_NUM_CNCTS                   (0x09)  /* Section 3.1.8 */   
+#define WLANBAP_ERROR_MAX_NUM_SCO_CNCTS               (0x0a)      
+#define WLANBAP_ERROR_MAX_NUM_ACL_CNCTS               (0x0b)      
+#define WLANBAP_ERROR_CMND_DISALLOWED                 (0x0c)  /* Section 4.1 */    
+#define WLANBAP_ERROR_HOST_REJ_RESOURCES              (0x0d)  /* Section 3.1.7 */ 
+#define WLANBAP_ERROR_HOST_REJ_SECURITY               (0x0e)      
+#define WLANBAP_ERROR_HOST_REJ_PERSONAL_DEV           (0x0f)      
+#define WLANBAP_ERROR_HOST_TIMEOUT                    (0x10)      
+#define WLANBAP_ERROR_UNSUPPORT_FEAT_PARAM            (0x11)      
+#define WLANBAP_ERROR_INVALID_HCI_CMND_PARAM          (0x12)     
+#define WLANBAP_ERROR_TERM_CNCT_USER_ENDED            (0x13)      
+#define WLANBAP_ERROR_TERM_CNCT_LOW_RESOURCE          (0x14)      
+#define WLANBAP_ERROR_TERM_CNCT_POWER_OFF             (0x15)      
+/* Section 3.1.9 has a contradictory semantics of "failed connection" */    
+#define WLANBAP_ERROR_TERM_BY_LOCAL_HOST              (0x16) /* Section 3.1.8 */  
+#define WLANBAP_ERROR_REPEATED_ATTEMPTS               (0x17)      
+#define WLANBAP_ERROR_PAIRING_NOT_ALLOWED             (0x18)      
+#define WLANBAP_ERROR_UNKNOWN_LMP_PDU                 (0x19)      
+#define WLANBAP_ERROR_UNSUPPORTED_REMOTE_FEAT         (0x1a)      
+#define WLANBAP_ERROR_SCO_REJ                         (0x1b)      
+#define WLANBAP_ERROR_SCO_INTERVAL_REJ                (0x1c)      
+#define WLANBAP_ERROR_SCO_AIR_MODE_REJ                (0x1d)      
+#define WLANBAP_ERROR_INVALID_LMP_PARAMETER           (0x1e)      
+#define WLANBAP_ERROR_UNSPECIFIED_ERROR               (0x1f)      
+#define WLANBAP_ERROR_UNSUPPORTED_LMP_PARAM           (0x20)      
+#define WLANBAP_ERROR_ROLE_CHANGE_NOT_ALLOWED         (0x21)      
+#define WLANBAP_ERROR_LMP_RESPONSE_TIMEOUT            (0x22)      
+#define WLANBAP_ERROR_LMP_ERROR_TRANS_COLLISION       (0x23)      
+#define WLANBAP_ERROR_LMP_PDU_NOT_ALLOWED             (0x24)      
+#define WLANBAP_ERROR_ENCRYPTION_MODE_NOT_ACCEPTABLE  (0x25)      
+#define WLANBAP_ERROR_UNIT_KEY_USED                   (0x26)      
+#define WLANBAP_ERROR_QOS_IS_NOT_SUPPORTED            (0x27)      
+#define WLANBAP_ERROR_INSTANT_PASSED                  (0x28)      
+#define WLANBAP_ERROR_UNIT_KEY_PAIRING_UNSUPPORTED    (0x29)      
+
+#define WLANBAP_ERROR_DIFFERENT_TRANS_COLLISION       (0x2A)      
+
+/* reserved                                           (0x2B) */
+
+#define WLANBAP_ERROR_QOS_UNACCEPTABLE_PARAMETER      (0x2C)      
+#define WLANBAP_ERROR_QOS_REJECTED                    (0x2D)      
+#define WLANBAP_ERROR_CHANNEL_CLASSIFICATION_NS       (0x2E)      
+#define WLANBAP_ERROR_INSUFFICIENT_SECURITY           (0x2F)      
+#define WLANBAP_ERROR_PARM_OUT_OF_MANDATORY_RANGE     (0x30)      
+                                        
+/* reserved                                           (0x31) */
+
+#define WLANBAP_ERROR_ROLE_SWITCH_PENDING             (0x32)      
+
+/* reserved                                           (0x33) */
+
+#define WLANBAP_ERROR_RESERVED_SLOT_VIOLATION         (0x34)      
+#define WLANBAP_ERROR_ROLE_SWITCH_FAILED              (0x35)      
+#define WLANBAP_ERROR_EIR_TOO_LARGE                   (0x36)      
+#define WLANBAP_ERROR_SSP_NOT_SUPPORTED_BY_HOST       (0x37)      
+#define WLANBAP_ERROR_HOST_BUSY_PAIRING               (0x38)      
+#define WLANBAP_ERROR_NO_SUITABLE_CHANNEL             (0x39)
+#define WLANBAP_ERROR_CONTROLLER_BUSY                 (0x3A)      
+
+/*----------------------------------------------------------------------------
+ *   Event_Mask_Page_2 defines for events
+ * -------------------------------------------------------------------------*/
+#define WLANBAP_EVENT_MASK_NONE                    0x0000000000000000 //No events specified (default)
+#define WLANBAP_EVENT_MASK_PHY_LINK_COMPLETE_EVENT 0x0000000000000001 //Physical Link Complete Event
+#define WLANBAP_EVENT_MASK_CHANNEL_SELECTED_EVENT  0x0000000000000002 //Channel Selected Event
+#define WLANBAP_EVENT_MASK_DISC_PHY_LINK_EVENT     0x0000000000000004 //Disconnection Physical Link Event
+#define WLANBAP_EVENT_MASK_PHY_LINK_LOSS_EARLY_WARNING_EVENT 0x0000000000000008 //Physical Link Loss Early Warning Event
+#define WLANBAP_EVENT_MASK_PHY_LINK_RECOVERY_EVENT 0x0000000000000010 //Physical Link Recovery Event
+#define WLANBAP_EVENT_MASK_LOG_LINK_COMPLETE_EVENT 0x0000000000000020 //Logical Link Complete Event
+#define WLANBAP_EVENT_MASK_DISC_LOG_LINK_COMPLETE_EVENT 0x0000000000000040 //Disconnection Logical Link Complete Event
+#define WLANBAP_EVENT_MASK_FLOW_SPEC_MOD_COMPLETE_EVENT 0x0000000000000080 //Flow Spec Modify Complete Event
+#define WLANBAP_EVENT_MASK_NUM_COMPLETED_DATA_BLOCKS_EVENT 0x0000000000000100 //Number of Completed Data Blocks Event
+#define WLANBAP_EVENT_MASK_AMP_START_TEST_EVENT    0x0000000000000200 //AMP Start Test Event
+#define WLANBAP_EVENT_MASK_AMP_TEST_END_EVENT      0x0000000000000400 //AMP Test End Event
+#define WLANBAP_EVENT_MASK_AMP_RCVR_REPORT_EVENT   0x0000000000000800 //AMP Receiver Report Event
+#define WLANBAP_EVENT_MASK_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT 0x0000000000001000 //Short Range Mode Change Complete Event
+#define WLANBAP_EVENT_MASK_AMP_STATUS_CHANGE_EVENT 0x0000000000002000 //AMP Status Change Event
+#define WLANBAP_EVENT_MASK_RESERVED                0xFFFFFFFFFFFFC000 //Reserved for future use
+
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  Opaque BAP handle Type Declaration 
+ * -------------------------------------------------------------------------*/
+typedef v_PVOID_t tBtampHandle, *ptBtampHandle;
+
+/*----------------------------------------------------------------------------
+ *  BAP per-session Context Data Type Declaration
+ * -------------------------------------------------------------------------*/
+// Move this to bapInternal.h, where it belongs.
+// For now, it is just the same thing as the per application context.
+//typedef struct sBtampContext tBtampSessCtx;
+
+
+/*---------------------------------------------------------------------------
+  HCI Event union
+---------------------------------------------------------------------------*/      
+typedef struct sBtampHCI_Event {
+    v_U8_t  bapHCIEventCode;  /* The event code.  To dis-ambiguate. */
+    union { 
+        tBtampTLVHCI_Channel_Selected_Event  btampChannelSelectedEvent;
+        tBtampTLVHCI_Command_Complete_Event btampCommandCompleteEvent ;
+        tBtampTLVHCI_Command_Status_Event btampCommandStatusEvent ;
+        tBtampTLVHCI_Data_Buffer_Overflow_Event btampDataBufferOverflowEvent ;
+        tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event btampDisconnectLogicalLinkCompleteEvent ;
+        tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event btampDisconnectPhysicalLinkCompleteEvent ;
+        /* Flow_Spec_Modify_Complete_Event is generated after the flow spec modify cmd completes */
+        tBtampTLVHCI_Flow_Spec_Modify_Complete_Event btampFlowSpecModifyCompleteEvent ;
+        /* Asynchronous Flush_Occurred Event CAN ALSO BE generated after the flush cmd completes */
+        tBtampTLVHCI_Flush_Occurred_Event btampFlushOccurredEvent ;
+        tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event btampGenericAMPLinkKeyNotificationEvent ;
+        tBtampTLVHCI_Hardware_Error_Event btampHardwareErrorEvent ;
+        tBtampTLVHCI_Logical_Link_Complete_Event btampLogicalLinkCompleteEvent ;
+        tBtampTLVHCI_Loopback_Command_Event btampLoopbackCommandEvent ;
+        tBtampTLVHCI_Physical_Link_Complete_Event btampPhysicalLinkCompleteEvent ;
+        tBtampTLVHCI_Physical_Link_Loss_Warning_Event btampPhysicalLinkLossWarningEvent ;
+        tBtampTLVHCI_Physical_Link_Recovery_Event btampPhysicalLinkRecoveryEvent ;
+        tBtampTLVHCI_Qos_Violation_Event btampQosViolationEvent ;
+        tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event btampShortRangeModeChangeCompleteEvent ;
+        tBtampTLVHCI_Num_Completed_Pkts_Event btampNumOfCompletedPktsEvent;
+        tBtampTLVHCI_Num_Completed_Data_Blocks_Event btampNumOfCompletedDataBlocksEvent;
+        tBtampTLVHCI_Enhanced_Flush_Complete_Event btampEnhancedFlushCompleteEvent ;
+    } u;
+} tBtampHCI_Event, *tpBtampHCI_Event;
+
+/* 802.3 header */
+typedef struct 
+{
+ /* Destination address field */
+ v_U8_t   vDA[VOS_MAC_ADDR_SIZE];
+
+ /* Source address field */
+ v_U8_t   vSA[VOS_MAC_ADDR_SIZE];
+
+ /* Length field */
+ v_U16_t  usLenType;  /* Num bytes in info field (i.e., exclude 802.3 hdr) */
+                      /* Max length 1500 (0x5dc) (What about 0x5ee? That
+                       * includes 802.3 Header and FCS.) */
+}WLANBAP_8023HeaderType;
+
+
+/* 
+ * A list of Command Complete event msgs which will be 
+ * signalled by the Event Callback 
+ */ 
+#if 0
+/* The tBtampTLVHCI_Command_Complete_Event structure includes each of these*/
+/* HCI Reset: status */
+/* HCI Flush: status, log_link_handle */
+
+#endif
+
+/* 
+ * Command Complete event msgs which will be formed by the caller 
+ * Now an invocation of btampPackTlvHCI_Command_Complete_Event()
+ * supports generating command complete event messages for all commands...  
+ */
+/* The tBtampTLVHCI_Command_Complete_Event structure includes each of these*/
+#if 0
+/* HCI Cancel Logical Link: status, phy_link_handle, tx_flow_spec_id */
+/* HCI Set Event Mask: status */
+/* HCI Read Connection Accept Timeout: status, connection_accept_timeout */
+/* HCI Write Connection Accept Timeout:  status */
+/* HCI Read Link Supervision Timeout: status, log_link_handle (8 sig bits only), link_supervision_timeout */
+/* HCI Write Link Supervision Timeout: status, log_link_handle (8 bits sig only) */
+/* HCI Read Logical Link Accept Timeout: status, logical_link_accept_timeout */
+/* HCI Write Logical Link Accept Timeout:  status */
+/* HCI Set Event Mask Page 2: status */
+/* HCI Read Location Data: status, loc_domain_aware, loc_domain, loc_options */
+/* HCI Write Location Data:  status */
+/* HCI Read Flow Control Mode: status, flow_control_mode */
+/* HCI Write Flow Control Mode:  status */
+/* HCI Read Best Effort Flush Timeout: status, (logical_link_handle ? No!), best_effort_flush_timeout */
+/* HCI Write Best Effort Flush Timeout:  status */
+/* HCI Set Short Range Mode:  status */
+/* HCI Read Local Version Info: status, HC_HCI_Version, HC_HCI_Revision, HC_PAL_Version, HC_Manufac_Name, HC_PAL_Sub_Version */
+/* HCI Read Local supported commands: status, HC_Support_Cmds */
+/* HCI Read Buffer Size:    status, HC_ACL_Data_Packet_Length,  HC_SCO_Packet_Length,  HC_Total_Num_ACL_Packets, HC_Total_Num_SCO_Packets */
+/* HCI Read Data Block Size:   status, HC_Max_ACL_Data_Packet_Length,  HC_Data_Block_Length, HC_Total_Num_Data_Blocks */
+/* HCI Read Failed Contact Counter: status, log_link_handle, *pFailedContactCounter */
+/* HCI Reset Failed Contact Counter: status, log_link_handle */
+/* HCI Read Link Quality: status, log_link_handle(?Yes!?), link_quality */
+/* HCI Read RSSI: status, phy_link_handle, rssi */
+/* HCI Read Local AMP Info: status, HC_AMP_Status, HC_Total_BW, HC_Max_Guaranteed_BW, HC_Min_Latency, HC_Max_PDU_Size, HC_Controller_Type, HC_PAL_Capabilities,  HC_AMP_Assoc_Length,  HC_Max_Flush_Timeout, HC_BE_Flush_Timeout */
+/* HCI Read Local AMP Assoc:  status, phy_link_handle, AMP ASSOC remaining length (just actual length, in practice), AMP ASSOC fragment (byte string) */ 
+/*  where AMP Assoc consists of:   HC_mac_addr,  pref channel (HC_pref_country, HC_pref_triplets), Cnct channel (HC_cnct_country,  HC_cnct_triplets), HC_pal_capabilities, HC_pal_version */ 
+/* HCI Write Remote AMP Assoc:  status, phy_link_handle */
+/* HCI Read Loopback Mode: status, loopback_mode */
+/* HCI Write Loopback Mode:  status */
+
+#endif
+
+/* BT AMP configuration items */
+typedef struct 
+{
+ /* user preferred channel on which we start the link */
+ v_U8_t   ucPreferredChannel;
+
+}WLANBAP_ConfigType;
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+    VOSS interfaces - Device initialization 
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Open
+
+  DESCRIPTION 
+    Called at driver initialization (vos_open). BAP will initialize 
+    all its internal resources and will wait for the call to start to 
+    register with the other modules. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Open
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Start
+
+  DESCRIPTION 
+    Called as part of the overall start procedure (vos_start). BAP will 
+    use this call to register with TL as the BAP entity for 
+    BT-AMP RSN frames. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other codes can be returned as a result of a BAL failure;
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Start
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Stop
+
+  DESCRIPTION 
+    Called by vos_stop to stop operation in BAP, before close. BAP will suspend all 
+    BT-AMP Protocol Adaption Layer operation and will wait for the close 
+    request to clean up its resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Stop
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Close
+
+  DESCRIPTION 
+    Called by vos_close during general driver close procedure. BAP will clean up 
+    all the internal resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Close
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*----------------------------------------------------------------------------
+    HDD interfaces - Per instance initialization 
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetNewHndl
+
+  DESCRIPTION 
+    Called by HDD at driver open (BSL_Open). BAP will initialize 
+    allocate a per-instance "file handle" equivalent for this specific
+    open call. 
+    
+    There should only ever be one call to BSL_Open.  Since 
+    the open app user is the BT stack.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    hBtampHandle:   Handle to return btampHandle value in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetNewHndl
+( 
+  ptBtampHandle *hBtampHandle  /* Handle to return btampHandle value in  */ 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_ReleaseHndl
+
+  DESCRIPTION 
+    Called by HDD at driver close (BSL_Close). BAP will reclaim (invalidate) 
+    the "file handle" passed into this call.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle:   btampHandle value to invalidate.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to btampHandle is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_ReleaseHndl
+( 
+  ptBtampHandle btampHandle  /* btamp handle value to release  */ 
+);
+
+/*----------------------------------------------------------------------------
+    HDD interfaces - Data plane
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+    HDD Data callbacks 
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    (*WLANBAP_STAFetchPktCBType)() 
+
+  DESCRIPTION   
+    Type of the fetch packet callback registered with BAP by HDD. 
+    
+    It is called by the BAP immediately upon the underlying 
+    WLANTL_STAFetchPktCBType routine being called.  Which is called by
+    TL when the scheduling algorithms allows for transmission of another 
+    packet to the module. 
+    
+    This function is here to "wrap" or abstract WLANTL_STAFetchPktCBType.
+    Because the BAP-specific HDD "shim" layer (BSL) doesn't know anything 
+    about STAIds, or other parameters required by TL.  
+
+
+  PARAMETERS 
+
+    IN
+    pHddHdl:        The HDD(BSL) specific context for this association.
+                    Use the STAId passed to me by TL in WLANTL_STAFetchCBType
+                    to retreive this value.
+
+    IN/OUT
+    pucAC:          access category requested by TL, if HDD does not have 
+                    packets on this AC it can choose to service another AC 
+                    queue in the order of priority
+
+    OUT
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    tlMetaInfo:    meta info related to the data frame
+
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+
+typedef VOS_STATUS (*WLANBAP_STAFetchPktCBType)( 
+                                            v_PVOID_t             pHddHdl,
+                                            WLANTL_ACEnumType     ucAC,
+                                            vos_pkt_t**           vosDataBuff,
+                                            WLANTL_MetaInfoType*  tlMetaInfo);
+
+ 
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    (*WLANBAP_STARxCBType)( )
+
+  DESCRIPTION   
+    Type of the receive callback registered with BAP by HDD. 
+    
+    It is called by the BAP immediately upon the underlying 
+    WLANTL_STARxCBType routine being called.  Which is called by
+    TL to notify when a packet was received for a registered STA.
+
+  PARAMETERS 
+
+    IN
+    pHddHdl:        The HDD(BSL) specific context for this association.
+                    Use the STAId passed to me by TL in WLANTL_STARxCBType
+                    to retrieve this value.
+
+    vosDataBuff:    pointer to the VOSS data buffer that was received
+                    (it may be a linked list) 
+    pRxMetaInfo:    Rx meta info related to the data frame
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANBAP_STARxCBType)( v_PVOID_t      pHddHdl,
+                                          vos_pkt_t*         vosDataBuff,
+                                          WLANTL_RxMetaInfoType* pRxMetaInfo);
+
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    (*WLANBAP_TxCompCBType)()
+
+  DESCRIPTION   
+    Type of the tx complete callback registered with BAP by HDD. 
+    
+    It is called by the BAP immediately upon the underlying 
+    WLANTL_TxCompCBType routine being called.  Which is called by
+    TL to notify when a transmission for a packet has ended.
+
+  PARAMETERS 
+
+    IN
+    pHddHdl:        The HDD(BSL) specific context for this association.
+                    <<How do I retrieve this from pvosGCtx? Which is all 
+                    the TL WLANTL_TxCompCBType routine provides me.>>
+    vosDataBuff:    pointer to the VOSS data buffer that was transmitted 
+    wTxSTAtus:      status of the transmission 
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANBAP_TxCompCBType)( v_PVOID_t      pHddHdl,
+                                           vos_pkt_t*     vosDataBuff,
+                                           VOS_STATUS     wTxSTAtus );
+
+/*----------------------------------------------------------------------------
+    HDD Data plane API  
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_RegisterDataPlane
+
+  DESCRIPTION 
+    The HDD calls this routine to register the "data plane" routines
+    for Tx, Rx, and Tx complete with BT-AMP.  For now, with only one
+    physical association supported at a time, this COULD be called 
+    by HDD at the same time as WLANBAP_GetNewHndl.  But, in general
+    it needs to be called upon each new physical link establishment.
+    
+    This registration is really two part.  The routines themselves are
+    registered here.  But, the mapping between the BSL context and the
+    actual physical link takes place during WLANBAP_PhysicalLinkCreate. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_RegisterDataPlane
+( 
+  ptBtampHandle btampHandle,  /* BTAMP context */ 
+  WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB, 
+  WLANBAP_STARxCBType pfnBtamp_STARxCB,
+  WLANBAP_TxCompCBType pfnBtampTxCompCB,
+  // phy_link_handle, of course, doesn't come until much later.  At Physical Link create.
+  v_PVOID_t      pHddHdl   /* BSL specific context */
+);
+//#endif
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_XlateTxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has a HCI Data Packet and it wants 
+    to translate it into a 802.3 LLC frame - ready to send using TL.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) 
+
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the BT-AMP packet to be 
+                 translated to an 802.3 LLC frame
+    tlMetaInfo:  return meta info gleaned from the outgoing frame, here.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_XlateTxDataPkt
+( 
+  ptBtampHandle     btampHandle,  /* Used by BAP to identify the actual session
+                                    and therefore addresses */ 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  WLANTL_ACEnumType           *pucAC,        /* Return the AC here */
+  WLANTL_MetaInfoType  *tlMetaInfo, /* Return the MetaInfo here. An assist to WLANBAP_STAFetchPktCBType */
+  vos_pkt_t        *vosDataBuff
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_XlateRxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has received a 802.3 (TL/UMA has 
+    Xlated from 802.11) frame from TL and it wants to form a 
+    BT HCI Data Packet - ready to signal up to the BT stack application.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the 802.3 frame to be 
+                 translated to BT HCI Data Packet
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_XlateRxDataPkt
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  WLANTL_ACEnumType           *pucAC,        /* Return the AC here. I don't think this is needed */
+  vos_pkt_t        *vosDataBuff
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_STAPktPending
+
+  DESCRIPTION 
+
+    HDD will call this API when a packet is pending transmission in its 
+    queues. HDD uses this instead of WLANTL_STAPktPending because he is
+    not aware of the mapping from session to STA ID.
+
+  DEPENDENCIES 
+
+    HDD must have called WLANBAP_GetNewHndl before calling this API.
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+                 BSL can obtain this from the physical handle value in the
+                 downgoing HCI Data Packet. He, after all, was there
+                 when the PhysicalLink was created. He knew the btampHandle 
+                 value returned by WLANBAP_GetNewHndl. He knows as well, his
+                 own pHddHdl (see next).
+    phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId)
+    ucAc:        The access category for the pending frame
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_STAPktPending 
+( 
+  ptBtampHandle  btampHandle,  /* Used by BAP to identify the app context and VOSS ctx (!?) */ 
+  v_U8_t         phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  WLANTL_ACEnumType ucAc   /* This is the first instance of a TL type in bapApi.h */
+);
+
+/*----------------------------------------------------------------------------
+ *   BT-AMP PAL HCI Event callback types
+ *--------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    (*tpWLAN_BAPEventCB)() 
+
+  DESCRIPTION 
+    Implements the callback for ALL asynchronous events. 
+    Including Events resulting from:
+     * HCI Create Physical Link, 
+     * Disconnect Physical Link, 
+     * Create Logical Link,
+     * Flow Spec Modify, 
+     * HCI Reset,
+     * HCI Flush,...
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    pHddHdl:     The HDD(BSL) specific context for this association.
+                 BSL gets this from the downgoing packets Physical handle
+                 value. 
+    pBapHCIEvent:  pointer to the union of "HCI Event" structures.  Contains all info 
+                   needed for HCI event.
+    assoc_specific_event:  flag indicates assoc-specific (1) or global (0) event
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*tpWLAN_BAPEventCB)
+(
+  v_PVOID_t      pHddHdl,   /* this could refer to either the BSL per 
+                               association context which got passed in during 
+                               register data plane OR the BSL per application 
+                               context passed in during register BAP callbacks 
+                               based on setting of the Boolean flag below */ 
+                            /* It's like each of us is using the other */
+                            /* guys reference when invoking him. */
+  tpBtampHCI_Event pBapHCIEvent, /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+  v_BOOL_t assoc_specific_event /* Flag to indicate global or assoc-specific event */
+);   
+
+
+/*----------------------------------------------------------------------------
+    HCI Event Callback Registration routine
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPRegisterBAPCallbacks() 
+
+  DESCRIPTION 
+    Register the BAP "Event" callbacks.
+    Return the per instance handle.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pBapHCIEventCB:  pointer to the Event callback
+    pAppHdl:  The context passed in by caller. (I.E., BSL app specific context.)
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEventCB is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPRegisterBAPCallbacks 
+( 
+  ptBtampHandle           btampHandle, /* BSL uses my handle to talk to me */
+                            /* Returned from WLANBAP_GetNewHndl() */
+                            /* It's like each of us is using the other */
+                            /* guys reference when invoking him. */
+  tpWLAN_BAPEventCB       pBapHCIEventCB, /*Implements the callback for ALL asynchronous events. */ 
+  v_PVOID_t               pAppHdl  // Per-app BSL context
+);
+
+
+
+/*----------------------------------------------------------------------------
+    Host Controller Interface Procedural API
+ ---------------------------------------------------------------------------*/
+
+/** BT v3.0 Link Control commands */
+
+/*----------------------------------------------------------------------------
+    Each of the next eight command result in asynchronous events (e.g.,  
+    HCI_PHYSICAL_LINK_COMPLETE_EVENT, HCI_LOGICAL_LINK_COMPLETE_EVENT, etc...)
+    These are signalled thru the event callback. (I.E., (*tpWLAN_BAPEventCB).)
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkCreate()
+
+  DESCRIPTION 
+    Implements the actual HCI Create Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+                 WLANBAP_GetNewHndl has to be called before every call to 
+                 WLAN_BAPPhysicalLinkCreate. Since the context is per 
+                 physical link.
+    pBapHCIPhysLinkCreate:  pointer to the "HCI Create Physical Link" Structure.
+    pHddHdl:  The context passed in by the caller. (e.g., BSL specific context)
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkCreate is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkCreate 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Create_Physical_Link_Cmd   *pBapHCIPhysLinkCreate,
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+                            /* And I get phy_link_handle from the Command */
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkAccept()
+
+  DESCRIPTION 
+    Implements the actual HCI Accept Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIPhysLinkAccept:  pointer to the "HCI Accept Physical Link" Structure.
+    pHddHdl:  The context passed in by the caller. (e.g., BSL specific context)
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkAccept is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkAccept 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Accept_Physical_Link_Cmd   *pBapHCIPhysLinkAccept,
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+                            /* And I get phy_link_handle from the Command */
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkDisconnect()
+
+  DESCRIPTION 
+    Implements the actual HCI Disconnect Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIPhysLinkDisconnect:  pointer to the "HCI Disconnect Physical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkDisconnect is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkDisconnect 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Disconnect_Physical_Link_Cmd   *pBapHCIPhysLinkDisconnect,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkCreate()
+
+  DESCRIPTION 
+    Implements the actual HCI Create Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkCreate:  pointer to the "HCI Create Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkCreate is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkCreate
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Create_Logical_Link_Cmd   *pBapHCILogLinkCreate,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkAccept()
+
+  DESCRIPTION 
+    Implements the actual HCI Accept Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkAccept:  pointer to the "HCI Accept Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkAccept is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkAccept
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Accept_Logical_Link_Cmd   *pBapHCILogLinkAccept,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkDisconnect()
+
+  DESCRIPTION 
+    Implements the actual HCI Disconnect Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkDisconnect:  pointer to the "HCI Disconnect Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkDisconnect is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkDisconnect
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Disconnect_Logical_Link_Cmd   *pBapHCILogLinkDisconnect,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkCancel()
+
+  DESCRIPTION 
+    Implements the actual HCI Cancel Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkCancel:  pointer to the "HCI Cancel Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+                (BTW, the required "HCI Logical Link Complete Event" 
+                will be generated by the BAP state machine and sent up 
+                via the (*tpWLAN_BAPEventCB).)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkCancel is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkCancel
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Logical_Link_Cancel_Cmd   *pBapHCILogLinkCancel,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPFlowSpecModify()
+
+  DESCRIPTION 
+    Implements the actual HCI Modify Logical Link command
+    Produces an asynchronous flow spec modify complete event. Through the 
+    event callback.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlowSpecModify:  pointer to the "HCI Flow Spec Modify" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlowSpecModify is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPFlowSpecModify
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Flow_Spec_Modify_Cmd   *pBapHCIFlowSpecModify,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/* Host Controller and Baseband Commands */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReset()
+
+  DESCRIPTION 
+    Implements the actual HCI Reset command.
+    Produces an asynchronous command complete event. Through the 
+    command complete callback.  (I.E., (*tpWLAN_BAPEventCB).)
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReset
+( 
+  ptBtampHandle btampHandle
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetEventMask()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Event Mask command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCISetEventMask:  pointer to the "HCI Set Event Mask" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCISetEventMask is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetEventMask
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Event_Mask_Cmd   *pBapHCISetEventMask,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPFlush()
+
+  DESCRIPTION 
+    Implements the actual HCI Flush command
+    Produces an asynchronous command complete event. Through the 
+    event callback. And an asynchronous Flush occurred event. Also through the 
+    event callback.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlush:  pointer to the "HCI Flush" Structure.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlush is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPFlush
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Flush_Cmd     *pBapHCIFlush
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_EnhancedBAPFlush()
+
+  DESCRIPTION 
+    Implements the actual HCI Enhanced Flush command
+    Produces an asynchronous command complete event. Through the command status 
+    event callback. And an asynchronous Enhanced Flush Complete event. 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlush:  pointer to the "HCI Enhanced Flush" Structure.
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlush is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_EnhancedBAPFlush
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Enhanced_Flush_Cmd     *pBapHCIFlush,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadConnectionAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Connection Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadConnectionAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadConnectionAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete */
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteConnectionAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Connection Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteConnectionAcceptTimeout:  pointer to the "HCI Connection Accept Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteConnectionAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteConnectionAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd   *pBapHCIWriteConnectionAcceptTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLinkSupervisionTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Link Supervision Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLinkSupervisionTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLinkSupervisionTimeout
+( 
+  ptBtampHandle btampHandle,
+  /* Only 8 bits (phy_link_handle) of this log_link_handle are valid. */
+  tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pBapHCIReadLinkSupervisionTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLinkSupervisionTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Link Supervision Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLinkSupervisionTimeout:  pointer to the "HCI Link Supervision Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLinkSupervisionTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLinkSupervisionTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd   *pBapHCIWriteLinkSupervisionTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/* v3.0 Host Controller and Baseband Commands */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLogicalLinkAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Logical Link Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLogicalLinkAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLogicalLinkAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLogicalLinkAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Logical Link Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLogicalLinkAcceptTimeout:  pointer to the "HCI Logical Link Accept Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLogicalLinkAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLogicalLinkAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd   *pBapHCIWriteLogicalLinkAcceptTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetEventMaskPage2()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Event Mask Page 2 command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCISetEventMaskPage2:  pointer to the "HCI Set Event Mask Page 2" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCISetEventMaskPage2 is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetEventMaskPage2
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd   *pBapHCISetEventMaskPage2,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocationData()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Location Data command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocationData is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocationData
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLocationData()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Location Data command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLocationData:  pointer to the "HCI Write Location Data" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLocationData is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLocationData
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Location_Data_Cmd   *pBapHCIWriteLocationData,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadFlowControlMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Flow Control Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadFlowControlMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadFlowControlMode
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteFlowControlMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Flow Control Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteFlowControlMode:  pointer to the "HCI Write Flow Control Mode" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteFlowControlMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteFlowControlMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Flow_Control_Mode_Cmd   *pBapHCIWriteFlowControlMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadBestEffortFlushTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Best Effort Flush Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadBEFlushTO is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadBestEffortFlushTimeout
+( 
+  ptBtampHandle btampHandle,
+  /* The log_link_hanlde identifies which logical link's BE TO*/
+  tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd   *pBapHCIReadBEFlushTO,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteBestEffortFlushTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Best Effort Flush TO command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteBEFlushTO:  pointer to the "HCI Write BE Flush TO" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteBEFlushTO is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteBestEffortFlushTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd   *pBapHCIWriteBEFlushTO,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetShortRangeMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Short Range Mode command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIShortRangeMode:  pointer to the "HCI Set Short Range Mode" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIShortRangeMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetShortRangeMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Short_Range_Mode_Cmd   *pBapHCIShortRangeMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPVendorSpecificCmd0()
+
+  DESCRIPTION
+    Implements the actual HCI Vendor Specific Command 0 (OGF 0x3f, OCF 0x0000).
+    There is no need for a callback because when this call returns the action has
+    been completed.
+
+  DEPENDENCIES
+    NA.
+
+  PARAMETERS
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event.
+                (The caller of this routine is responsible for sending
+                the Command Complete event up the HCI interface.)
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS
+
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPVendorSpecificCmd0
+(
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPVendorSpecificCmd1()
+
+  DESCRIPTION
+    Implements the actual HCI Vendor Specific Command 1 (OGF 0x3f, OCF 0x0001).
+    There is no need for a callback because when this call returns the action has
+    been completed.
+
+  DEPENDENCIES
+    NA.
+
+  PARAMETERS
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event.
+                (The caller of this routine is responsible for sending
+                the Command Complete event up the HCI interface.)
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS
+
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPVendorSpecificCmd1
+(
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/* End of v3.0 Host Controller and Baseband Commands */
+
+
+/* Informational Parameters */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalVersionInfo()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local Version Info command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    // There are really no input parameters in this command.  
+    // Just the command opcode itself is sufficient.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalVersionInfo is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalVersionInfo
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalSupportedCmds()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local Supported Commands.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    // There are really no input parameters in this command.  
+    // Just the command opcode itself is sufficient.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalSupportedCmds is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalSupportedCmds
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadBufferSize()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Buffer Size command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadBufferSize is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadBufferSize
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadDataBlockSize()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Data Block Size command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadDataBlockSize is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadDataBlockSize
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*
+Status Parameters
+*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadFailedContactCounter()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Failed Contact Counter command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadFailedContactCounter:  pointer to the "HCI Read Failed Contact Counter" structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadFailedContactCounter or
+                         pFailedContactCounter is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadFailedContactCounter
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd  *pBapHCIReadFailedContactCounter,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPResetFailedContactCounter()
+
+  DESCRIPTION 
+    Implements the actual HCI Reset Failed Contact Counter command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIResetFailedContactCounter:  pointer to the "HCI Reset Failed Contact Counter" structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIResetFailedContactCounter is NULL
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPResetFailedContactCounter
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pBapHCIResetFailedContactCounter,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLinkQuality()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Link Quality command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLinkQuality:  pointer to the "HCI Read Link Quality" structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLinkQuality or 
+                         pBapHCILinkQuality is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLinkQuality
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Link_Quality_Cmd *pBapHCIReadLinkQuality,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadRSSI()
+
+  DESCRIPTION 
+    Implements the actual HCI Read RSSI command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadRSSI:  pointer to the "HCI Read RSSI" structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadRSSI or
+                         pBapHCIRSSI is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadRSSI
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_RSSI_Cmd *pBapHCIReadRSSI,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalAMPInfo()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local AMP Information command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLocalAMPInfo:  pointer to the "HCI Read Local AMP Info" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalAMPInfo or 
+                         pBapHCILocalAMPInfo is NULL
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalAMPInfo
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pBapHCIReadLocalAMPInfo,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalAMPAssoc()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local AMP Assoc command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLocalAMPAssoc:  pointer to the "HCI Read Local AMP Assoc" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalAMPAssoc 
+                        (or pBapHCILocalAMPAssoc) is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalAMPAssoc
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd   *pBapHCIReadLocalAMPAssoc,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteRemoteAMPAssoc()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Remote AMP Assoc command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteRemoteAMPAssoc:  pointer to the "HCI Write Remote AMP Assoc" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteRemoteAMPAssoc is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteRemoteAMPAssoc
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd   *pBapHCIWriteRemoteAMPAssoc,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*
+Debug Commands
+*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLoopbackMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Loopback Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLoopbackMode:  pointer to the "HCI Read Loopback Mode".
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLoopbackMode or 
+                         pBapHCILoopbackMode is NULL.
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLoopbackMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Loopback_Mode_Cmd  *pBapHCIReadLoopbackMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLoopbackMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Loopback Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLoopbackMode:  pointer to the "HCI Write Loopback Mode" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLoopbackMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLoopbackMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Loopback_Mode_Cmd   *pBapHCIWriteLoopbackMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+);
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetConfig()
+
+  DESCRIPTION 
+     The function updates some configuration for BAP module in SME during SMEs
+     close -> open sequence.
+   
+     BAP applies the new configuration at the next transaction.
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadRSSI:  pointer to the "HCI Read RSSI" structure.
+   
+    IN
+    pConfig: a pointer to a caller allocated object of typedef struct WLANBAP_ConfigType.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pConfig or btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetConfig
+( 
+  ptBtampHandle btampHandle,
+  WLANBAP_ConfigType *pConfig
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_GetAcFromTxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has a HCI Data Packet (SKB) and it wants 
+    to find AC type of the data frame from the HCI header on the data pkt
+    - to be send using TL.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+ 
+    pHciData: Pointer to the HCI data frame
+ 
+    pucAC:       Pointer to return the access category 
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_GetAcFromTxDataPkt
+( 
+  ptBtampHandle     btampHandle,  /* Used by BAP to identify the actual session
+                                    and therefore addresses */
+  void              *pHciData,     /* Pointer to the HCI data frame */
+  WLANTL_ACEnumType *pucAC        /* Return the AC here */
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPGetMask()
+
+  DESCRIPTION 
+     The function gets the updated event mask from BAP core.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    
+   
+    IN
+    pEvent_mask_page_2: a pointer to a caller allocated object of 8 bytes.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pEvent_mask_page_2 or btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPGetMask( ptBtampHandle btampHandle, 
+                 v_U8_t       *pEvent_mask_page_2);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPDisconnect()
+
+  DESCRIPTION 
+     The function to request to BAP core to disconnect currecnt AMP connection.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPDisconnect
+( 
+  ptBtampHandle btampHandle
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSessionOn()
+
+  DESCRIPTION 
+     The function to check from BAP core if AMP connection is up right now.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_TRUE:  AMP connection is on 
+    VOS_FALSE: AMP connection is not on
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+v_BOOL_t WLAN_BAPSessionOn
+( 
+  ptBtampHandle btampHandle
+);
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WLANBAP_H */
+
diff --git a/CORE/BAP/inc/btampHCI.h b/CORE/BAP/inc/btampHCI.h
new file mode 100644
index 0000000..c7d3e97
--- /dev/null
+++ b/CORE/BAP/inc/btampHCI.h
@@ -0,0 +1,2123 @@
+/*
+ * 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 BTAMPHCI_H
+#define BTAMPHCI_H
+
+/**
+  * \file btampHCI.h
+  *
+  * \brief Structures, function prototypes & definitions
+  * for working with 802.11 Frames
+  *
+  *
+  * Copyright (C) 2009 Airgo Networks, Incorporated.
+  *
+  *
+  * This file was automatically generated by 'framesc'
+  * Mon Mar 02 14:06:14 2009 from the following file(s):
+  *
+  * btampHCI.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'.
+  *
+  *
+  */
+
+
+#define WLANBAP_MAX_LOG_LINKS 16  /* Logical links are assigned by BAP */
+
+
+#if 0
+
+/*  Calling conventions: The General format of the Unpack and Pack routines */
+
+/*==========================================================================
+
+  FUNCTION    Unpack_XxxMessage
+
+  DESCRIPTION 
+    Unpack from a Message buffer into a structured type. 
+
+
+  DEPENDENCIES 
+
+
+  PARAMETERS 
+ 
+
+    IN
+    void * :       halHandle (passed down to the MAC layer and below)
+    v_U8_t* :      Pointer to the source message buffer
+    v_U16_t :      Length in bytes of the contents of the message buffer.
+    tXxxMessage* : Pointer to the structure in which to return the unpacked values.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+ 
+
+  SIDE EFFECTS 
+
+============================================================================*/
+v_U32_t Unpack_XxxMessage(void *, v_U8_t*,v_U16_t, tXxxMessage*);
+
+
+/*==========================================================================
+
+  FUNCTION    Pack_XxxMessage
+
+  DESCRIPTION 
+    Pack the data from a structure into a Message buffer. 
+
+
+  DEPENDENCIES 
+
+
+  PARAMETERS 
+
+
+    IN
+    void * :       halHandle (passed down to the MAC layer and below)
+    tXxxMessage* : Pointer to the structure from which to obtain values.
+    v_U8_t* :      Pointer to the destination message buffer.
+    v_U32_t :      Length in bytes of the destination message buffer.
+    v_U32_t* :     Pointer to return the actual length of the encoded message buffer in.
+
+
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+  SIDE EFFECTS 
+
+
+============================================================================*/
+v_U32_t Pack_XxxMessage(void *, tXxxMessage*, v_U8_t*, v_U32_t, v_U32_t*);
+
+#endif
+ 
+
+typedef v_U32_t tBTAMP_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 BTAMP_PARSE_SUCCESS         ( 0x00000000 )
+#define BTAMP_UNKNOWN_IES           ( 0x00000001 )
+#define BTAMP_MANDATORY_IE_MISSING  ( 0x00000002 )
+#define BTAMP_INCOMPLETE_IE         ( 0x00000004 )
+#define BTAMP_SKIPPED_BAD_IE        ( 0x00000008 )
+#define BTAMP_LAST_IE_TOO_LONG      ( 0x00000010 )
+#define BTAMP_DUPLICATE_IE          ( 0x00000020 )
+#define BTAMP_BAD_FIXED_VALUE       ( 0x00000040 )
+#define BTAMP_INCOMPLETE_TLV        ( 0x00000080 )
+#define BTAMP_INVALID_TLV_LENGTH    ( 0x00000100 )
+#define BTAMP_SKIPPED_BAD_TLV       ( 0x00000200 )
+#define BTAMP_UNKNOWN_TLVS          ( 0x00000400 )
+#define BTAMP_LAST_TLV_TOO_LONG     ( 0x00000800 )
+#define BTAMP_INTERNAL_ERROR        ( 0x10000001 )
+#define BTAMP_MISSING_FIXED_FIELD   ( 0x10000002 )
+#define BTAMP_BAD_INPUT_BUFFER      ( 0x10000003 )
+#define BTAMP_BAD_OUTPUT_BUFFER     ( 0x10000004 )
+#define BTAMP_BUFFER_OVERFLOW       ( 0x10000005 )
+#define BTAMP_MANDATORY_TLV_MISSING ( 0x00001000 )
+#define BTAMP_FAILED(code)          ( (code) & 0x10000000 )
+#define BTAMP_WARNED(code)          ( ( ( 0 == (code) ) & 0x10000000 ) && code)
+#define BTAMP_SUCCEEDED(code)       ( (code) == 0 )
+
+/*********************************************************************
+ * Fixed Fields                                                      *
+ ********************************************************************/
+
+/*********************************************************************
+ * TLVs                                                              *
+ ********************************************************************/
+
+// ID 3 (0x0003)
+typedef struct sBtampTLVAMP_Assoc_Connected_Channel {
+    v_U8_t       present;
+    v_U8_t       country[3];
+    v_U8_t       num_triplets;
+    v_U8_t       triplets[2][3];
+} tBtampTLVAMP_Assoc_Connected_Channel;
+
+#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL ( 3 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL_MAX_LEN ( 11 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvAMP_Assoc_Connected_Channel(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_Connected_Channel*);
+
+v_U32_t btampPackTlvAMP_Assoc_Connected_Channel(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvAMP_Assoc_Connected_Channel(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1 (0x0001)
+typedef struct sBtampTLVAMP_Assoc_MAC_Addr {
+    v_U8_t       present;
+    v_U8_t       mac_addr[6];
+} tBtampTLVAMP_Assoc_MAC_Addr;
+
+#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR ( 1 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR_MIN_LEN ( 8 )
+
+#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvAMP_Assoc_MAC_Addr(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_MAC_Addr*);
+
+v_U32_t btampPackTlvAMP_Assoc_MAC_Addr(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvAMP_Assoc_MAC_Addr(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4 (0x0004)
+typedef struct sBtampTLVAMP_Assoc_PAL_Capabilities {
+    v_U8_t       present;
+    v_U32_t      pal_capabilities;
+} tBtampTLVAMP_Assoc_PAL_Capabilities;
+
+#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES ( 4 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES_MIN_LEN ( 6 )
+
+#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvAMP_Assoc_PAL_Capabilities(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_PAL_Capabilities*);
+
+v_U32_t btampPackTlvAMP_Assoc_PAL_Capabilities(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Capabilities(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5 (0x0005)
+typedef struct sBtampTLVAMP_Assoc_PAL_Version {
+    v_U8_t       present;
+    v_U8_t       pal_version;
+    v_U16_t      pal_CompanyID;
+    v_U16_t      pal_subversion;
+} tBtampTLVAMP_Assoc_PAL_Version;
+
+#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION ( 5 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION_MIN_LEN ( 7 )
+
+#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvAMP_Assoc_PAL_Version(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_PAL_Version*);
+
+v_U32_t btampPackTlvAMP_Assoc_PAL_Version(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Version(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 2 (0x0002)
+typedef struct sBtampTLVAMP_Assoc_Preferred_Channel_List {
+    v_U8_t       present;
+    v_U8_t       country[3];
+    v_U8_t       num_triplets;
+    v_U8_t       triplets[5][3];
+} tBtampTLVAMP_Assoc_Preferred_Channel_List;
+
+#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST ( 2 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST_MAX_LEN ( 20 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvAMP_Assoc_Preferred_Channel_List(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_Preferred_Channel_List*);
+
+v_U32_t btampPackTlvAMP_Assoc_Preferred_Channel_List(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 6 (0x0006)
+typedef struct sBtampTLVFlow_Spec {
+    v_U8_t       present;
+    v_U8_t       flow_spec_id;
+    v_U8_t       service_type;
+    v_U16_t      max_sdu;
+    v_U32_t      sdu_inter_arrival;
+    v_U32_t      access_latency;
+    v_U32_t      flush_timeout;
+} tBtampTLVFlow_Spec;
+
+#define BTAMP_TLV_FLOW_SPEC ( 6 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_FLOW_SPEC_MIN_LEN ( 18 )
+
+#define BTAMP_TLV_FLOW_SPEC_MAX_LEN ( 18 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvFlow_Spec(void *, v_U8_t*,v_U16_t, tBtampTLVFlow_Spec*);
+
+v_U32_t btampPackTlvFlow_Spec(void *, tBtampTLVFlow_Spec*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvFlow_Spec(void *, tBtampTLVFlow_Spec*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1081 (0x0439)
+typedef struct sBtampTLVHCI_Accept_Logical_Link_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       tx_flow_spec[18];
+    v_U8_t       rx_flow_spec[18];
+} tBtampTLVHCI_Accept_Logical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD ( 1081 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD_MIN_LEN ( 39 )
+
+#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD_MAX_LEN ( 39 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Accept_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Accept_Logical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Accept_Logical_Link_Cmd(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1078 (0x0436)
+typedef struct sBtampTLVHCI_Accept_Physical_Link_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       key_length;
+    v_U8_t       key_type;
+    v_U8_t       key_material[32];
+} tBtampTLVHCI_Accept_Physical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD ( 1078 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD_MAX_LEN ( 37 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Accept_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Accept_Physical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Accept_Physical_Link_Cmd(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 65 (0x0041)
+typedef struct sBtampTLVHCI_Channel_Selected_Event {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+} tBtampTLVHCI_Channel_Selected_Event;
+
+#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT ( 65 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Channel_Selected_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Channel_Selected_Event*);
+
+v_U32_t btampPackTlvHCI_Channel_Selected_Event(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Channel_Selected_Event(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 14 (0x000e)
+typedef struct sBtampTLVHCI_Command_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       num_hci_command_packets;
+    v_U16_t      command_opcode;
+    union
+    {
+        struct
+        {
+            v_U8_t status;
+        } Reset; /* command_opcode = c03 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+        } Flush; /* command_opcode = c08 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t phy_link_handle;
+            v_U8_t tx_flow_spec_id;
+        } Logical_Link_Cancel; /* command_opcode = 43b */
+        struct
+        {
+            v_U8_t status;
+        } Set_Event_Mask; /* command_opcode = c05 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t connection_accept_timeout;
+        } Read_Connection_Accept_TO; /* command_opcode = c15 */
+        struct
+        {
+            v_U8_t status;
+        } Write_Connection_Accept_TO; /* command_opcode = c16 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+            v_U16_t link_supervision_timeout;
+        } Read_Link_Supervision_TO; /* command_opcode = c36 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+        } Write_Link_Supervision_TO; /* command_opcode = c37 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t logical_link_accept_timeout;
+        } Read_Logical_Link_Accept_TO; /* command_opcode = c61 */
+        struct
+        {
+            v_U8_t status;
+        } Write_Logical_Link_Accept_TO; /* command_opcode = c62 */
+        struct
+        {
+            v_U8_t status;
+        } Set_Event_Mask_Page_2; /* command_opcode = c63 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t loc_domain_aware;
+            v_U8_t loc_domain[3];
+            v_U8_t loc_options;
+        } Read_Location_Data; /* command_opcode = 3172 */
+        struct
+        {
+            v_U8_t status;
+        } Write_Location_Data; /* command_opcode = 3173 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t flow_control_mode;
+        } Read_Flow_Control_Mode; /* command_opcode = 3174 */
+        struct
+        {
+            v_U8_t status;
+        } Write_Flow_Control_Mode; /* command_opcode = 3175 */
+        struct
+        {
+            v_U8_t status;
+            v_U32_t best_effort_flush_timeout;
+        } Read_BE_Flush_TO; /* command_opcode = 3177 */
+        struct
+        {
+            v_U8_t status;
+        } Write_BE_Flush_TO; /* command_opcode = 3178 */
+        struct
+        {
+            v_U8_t status;
+        } Set_Short_Range_Mode; /* command_opcode = 3179 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t HC_HCI_Version;
+            v_U16_t HC_HCI_Revision;
+            v_U8_t HC_PAL_Version;
+            v_U16_t HC_Manufac_Name;
+            v_U16_t HC_PAL_Sub_Version;
+        } Read_Local_Version_Info; /* command_opcode = 4097 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t HC_Support_Cmds[64];
+        } Read_Local_Supported_Cmds; /* command_opcode = 4098 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t HC_ACL_Data_Packet_Length;
+            v_U8_t HC_SCO_Packet_Length;
+            v_U16_t HC_Total_Num_ACL_Packets;
+            v_U16_t HC_Total_Num_SCO_Packets;
+        } Read_Buffer_Size; /* command_opcode = 4101 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t HC_Max_ACL_Data_Packet_Length;
+            v_U16_t HC_Data_Block_Length;
+            v_U16_t HC_Total_Num_Data_Blocks;
+        } Read_Data_Block_Size; /* command_opcode = 4106 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+            v_U16_t failed_contact_counter;
+        } Read_Failed_Contact_Counter; /* command_opcode = 5121 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+        } Reset_Failed_Contact_Counter; /* command_opcode = 5122 */
+        struct
+        {
+            v_U8_t status;
+            v_U16_t log_link_handle;
+            v_U8_t link_quality;
+        } Read_Link_Quality; /* command_opcode = 5123 */
+        struct
+        {
+            v_U8_t status;
+            /* 2 bytes handle to comply with spec, (lower byte valid) */
+            v_U16_t phy_link_handle;
+            v_S7_t rssi;
+        } Read_RSSI; /* command_opcode = 5125 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t HC_AMP_Status;
+            v_U32_t HC_Total_BW;
+            v_U32_t HC_Max_Guaranteed_BW;
+            v_U32_t HC_Min_Latency;
+            v_U32_t HC_Max_PDU_Size;
+            v_U8_t HC_Controller_Type;
+            v_U16_t HC_PAL_Capabilities;
+            v_U16_t HC_AMP_Assoc_Length;
+            v_U32_t HC_Max_Flush_Timeout;
+            v_U32_t HC_BE_Flush_Timeout;
+        } Read_Local_AMP_Info; /* command_opcode = 5129 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t phy_link_handle;
+            v_U16_t remaining_length;
+            v_U8_t AMP_assoc_fragment[248];
+        } Read_Read_Local_AMP_Assoc; /* command_opcode = 5130 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t phy_link_handle;
+        } Write_Remote_AMP_Assoc; /* command_opcode = 5131 */
+        struct
+        {
+            v_U8_t status;
+            v_U8_t loopback_mode;
+        } Read_Loopback_Mode; /* command_opcode = 6145 */
+        struct
+        {
+            v_U8_t status;
+        } Write_Loopback_Mode; /* command_opcode = 6146 */
+        struct
+        {
+            v_U8_t status;
+        } Vendor_Specific_Cmd_0; /* command_opcode = fc00 */
+        struct
+        {
+            v_U8_t status;
+        } Vendor_Specific_Cmd_1; /* command_opcode = fc01 */
+    } cc_event;
+} tBtampTLVHCI_Command_Complete_Event;
+
+#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT ( 14 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT_MIN_LEN ( 6 )
+
+#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT_MAX_LEN ( 257 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Command_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Command_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Command_Complete_Event(void *, tBtampTLVHCI_Command_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Command_Complete_Event(void *, tBtampTLVHCI_Command_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 15 (0x000f)
+typedef struct sBtampTLVHCI_Command_Status_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U8_t       num_hci_command_packets;
+    v_U16_t      command_opcode;
+} tBtampTLVHCI_Command_Status_Event;
+
+#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT ( 15 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT_MIN_LEN ( 6 )
+
+#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Command_Status_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Command_Status_Event*);
+
+v_U32_t btampPackTlvHCI_Command_Status_Event(void *, tBtampTLVHCI_Command_Status_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Command_Status_Event(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1080 (0x0438)
+typedef struct sBtampTLVHCI_Create_Logical_Link_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       tx_flow_spec[18];
+    v_U8_t       rx_flow_spec[18];
+} tBtampTLVHCI_Create_Logical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD ( 1080 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD_MIN_LEN ( 39 )
+
+#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD_MAX_LEN ( 39 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Create_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Create_Logical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Create_Logical_Link_Cmd(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Create_Logical_Link_Cmd(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1077 (0x0435)
+typedef struct sBtampTLVHCI_Create_Physical_Link_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       key_length;
+    v_U8_t       key_type;
+    v_U8_t       key_material[32];
+} tBtampTLVHCI_Create_Physical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD ( 1077 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD_MAX_LEN ( 37 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Create_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Create_Physical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Create_Physical_Link_Cmd(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Create_Physical_Link_Cmd(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 26 (0x001a)
+typedef struct sBtampTLVHCI_Data_Buffer_Overflow_Event {
+    v_U8_t       present;
+    v_U8_t       link_type;
+} tBtampTLVHCI_Data_Buffer_Overflow_Event;
+
+#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT ( 26 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Data_Buffer_Overflow_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Data_Buffer_Overflow_Event*);
+
+v_U32_t btampPackTlvHCI_Data_Buffer_Overflow_Event(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1082 (0x043a)
+typedef struct sBtampTLVHCI_Disconnect_Logical_Link_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Disconnect_Logical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD ( 1082 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 70 (0x0046)
+typedef struct sBtampTLVHCI_Disconnect_Logical_Link_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U16_t      log_link_handle;
+    v_U8_t       reason;
+} tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event;
+
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT ( 70 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 6 )
+
+#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1079 (0x0437)
+typedef struct sBtampTLVHCI_Disconnect_Physical_Link_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       reason;
+} tBtampTLVHCI_Disconnect_Physical_Link_Cmd;
+
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD ( 1079 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*);
+
+v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 66 (0x0042)
+typedef struct sBtampTLVHCI_Disconnect_Physical_Link_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U8_t       phy_link_handle;
+    v_U8_t       reason;
+} tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event;
+
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT ( 66 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1084 (0x043c)
+typedef struct sBtampTLVHCI_Flow_Spec_Modify_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+    v_U8_t       be_aggr_counter;
+    v_U8_t       tx_flow_spec[18];
+    v_U8_t       rx_flow_spec[18];
+} tBtampTLVHCI_Flow_Spec_Modify_Cmd;
+
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD ( 1084 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD_MIN_LEN ( 41 )
+
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD_MAX_LEN ( 41 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Cmd*);
+
+v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Cmd(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 71 (0x0047)
+typedef struct sBtampTLVHCI_Flow_Spec_Modify_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Flow_Spec_Modify_Complete_Event;
+
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT ( 71 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Complete_Event(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3080 (0x0c08)
+typedef struct sBtampTLVHCI_Flush_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Flush_Cmd;
+
+#define BTAMP_TLV_HCI_FLUSH_CMD ( 3080 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_FLUSH_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_FLUSH_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Flush_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flush_Cmd*);
+
+v_U32_t btampPackTlvHCI_Flush_Cmd(void *, tBtampTLVHCI_Flush_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Flush_Cmd(void *, tBtampTLVHCI_Flush_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 17 (0x0011)
+typedef struct sBtampTLVHCI_Flush_Occurred_Event {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Flush_Occurred_Event;
+
+#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT ( 17 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Flush_Occurred_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flush_Occurred_Event*);
+
+v_U32_t btampPackTlvHCI_Flush_Occurred_Event(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Flush_Occurred_Event(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3167 (0x0C5F)
+typedef struct sBtampTLVHCI_Enhanced_Flush_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+    v_U8_t       packet_type;
+} tBtampTLVHCI_Enhanced_Flush_Cmd;
+
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD ( 3167 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Enhanced_Flush_Cmd*);
+
+v_U32_t btampPackTlvHCI_Enhanced_Flush_Cmd(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Cmd(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 57 (0x0039)
+typedef struct sBtampTLVHCI_Enhanced_Flush_Complete_Event {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Enhanced_Flush_Complete_Event;
+
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT ( 57 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Enhanced_Flush_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Enhanced_Flush_Complete_Event(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+
+// ID 62 (0x003e)
+typedef struct sBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event {
+    v_U8_t       present;
+    v_U8_t       bd_addr[6];
+    v_U8_t       generic_amp_link_key[32];
+    v_U8_t       key_type;
+} tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event;
+
+#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT ( 62 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT_MIN_LEN ( 41 )
+
+#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT_MAX_LEN ( 41 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*);
+
+v_U32_t btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 16 (0x0010)
+typedef struct sBtampTLVHCI_Hardware_Error_Event {
+    v_U8_t       present;
+    v_U8_t       hardware_code;
+} tBtampTLVHCI_Hardware_Error_Event;
+
+#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT ( 16 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Hardware_Error_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Hardware_Error_Event*);
+
+v_U32_t btampPackTlvHCI_Hardware_Error_Event(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Hardware_Error_Event(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 1083 (0x043b)
+typedef struct sBtampTLVHCI_Logical_Link_Cancel_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       tx_flow_spec_id;
+} tBtampTLVHCI_Logical_Link_Cancel_Cmd;
+
+#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD ( 1083 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Logical_Link_Cancel_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Logical_Link_Cancel_Cmd*);
+
+v_U32_t btampPackTlvHCI_Logical_Link_Cancel_Cmd(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 69 (0x0045)
+typedef struct sBtampTLVHCI_Logical_Link_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U16_t      log_link_handle;
+    v_U8_t       phy_link_handle;
+    v_U8_t       flow_spec_id;
+} tBtampTLVHCI_Logical_Link_Complete_Event;
+
+#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT ( 69 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 7 )
+
+#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Logical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Logical_Link_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 25 (0x0019)
+typedef struct sBtampTLVHCI_Loopback_Command_Event {
+    v_U8_t       present;
+    v_U8_t       hci_command_packet[64];
+} tBtampTLVHCI_Loopback_Command_Event;
+
+#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT ( 25 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT_MIN_LEN ( 66 )
+
+#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT_MAX_LEN ( 66 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Loopback_Command_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Loopback_Command_Event*);
+
+v_U32_t btampPackTlvHCI_Loopback_Command_Event(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Loopback_Command_Event(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 64 (0x0040)
+typedef struct sBtampTLVHCI_Physical_Link_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U8_t       phy_link_handle;
+    v_U8_t       ch_number;
+} tBtampTLVHCI_Physical_Link_Complete_Event;
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT ( 64 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Physical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 67 (0x0043)
+typedef struct sBtampTLVHCI_Physical_Link_Loss_Warning_Event {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       reason;
+} tBtampTLVHCI_Physical_Link_Loss_Warning_Event;
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT ( 67 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*);
+
+v_U32_t btampPackTlvHCI_Physical_Link_Loss_Warning_Event(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 68 (0x0044)
+typedef struct sBtampTLVHCI_Physical_Link_Recovery_Event {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+} tBtampTLVHCI_Physical_Link_Recovery_Event;
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT ( 68 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Physical_Link_Recovery_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Recovery_Event*);
+
+v_U32_t btampPackTlvHCI_Physical_Link_Recovery_Event(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Recovery_Event(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 30 (0x001e)
+typedef struct sBtampTLVHCI_Qos_Violation_Event {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Qos_Violation_Event;
+
+#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT ( 30 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Qos_Violation_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Qos_Violation_Event*);
+
+v_U32_t btampPackTlvHCI_Qos_Violation_Event(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Qos_Violation_Event(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3177 (0x0c69)
+typedef struct sBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD ( 3177 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4101 (0x1005)
+typedef struct sBtampTLVHCI_Read_Buffer_Size_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Buffer_Size_Cmd;
+
+#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD ( 4101 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Buffer_Size_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Buffer_Size_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Buffer_Size_Cmd(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3093 (0x0c15)
+typedef struct sBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD ( 3093 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4106 (0x100a)
+typedef struct sBtampTLVHCI_Read_Data_Block_Size_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Data_Block_Size_Cmd;
+
+#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD ( 4106 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Data_Block_Size_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Data_Block_Size_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Data_Block_Size_Cmd(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5121 (0x1401)
+typedef struct sBtampTLVHCI_Read_Failed_Contact_Counter_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd;
+
+#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD ( 5121 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3174 (0x0c66)
+typedef struct sBtampTLVHCI_Read_Flow_Control_Mode_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Flow_Control_Mode_Cmd;
+
+#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD ( 3174 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5123 (0x1403)
+typedef struct sBtampTLVHCI_Read_Link_Quality_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Read_Link_Quality_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD ( 5123 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Link_Quality_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Link_Quality_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Link_Quality_Cmd(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Link_Quality_Cmd(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3126 (0x0c36)
+typedef struct sBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD ( 3126 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5130 (0x140a)
+typedef struct sBtampTLVHCI_Read_Local_AMP_Assoc_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U16_t      length_so_far;
+    v_U16_t      max_remote_amp_assoc_length;
+} tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD ( 5130 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD_MIN_LEN ( 7 )
+
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5129 (0x1409)
+typedef struct sBtampTLVHCI_Read_Local_AMP_Information_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Local_AMP_Information_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD ( 5129 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Local_AMP_Information_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4098 (0x1002)
+typedef struct sBtampTLVHCI_Read_Local_Supported_Cmds_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD ( 4098 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 4097 (0x1001)
+typedef struct sBtampTLVHCI_Read_Local_Version_Info_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Local_Version_Info_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD ( 4097 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Local_Version_Info_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_Version_Info_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Local_Version_Info_Cmd(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3172 (0x0c64)
+typedef struct sBtampTLVHCI_Read_Location_Data_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Location_Data_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD ( 3172 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Location_Data_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Location_Data_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Location_Data_Cmd(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Location_Data_Cmd(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3169 (0x0c61)
+typedef struct sBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD ( 3169 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 6145 (0x1801)
+typedef struct sBtampTLVHCI_Read_Loopback_Mode_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Read_Loopback_Mode_Cmd;
+
+#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD ( 6145 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_Loopback_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Loopback_Mode_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5125 (0x1405)
+typedef struct sBtampTLVHCI_Read_RSSI_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Read_RSSI_Cmd;
+
+#define BTAMP_TLV_HCI_READ_RSSI_CMD ( 5125 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_READ_RSSI_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_READ_RSSI_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Read_RSSI_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_RSSI_Cmd*);
+
+v_U32_t btampPackTlvHCI_Read_RSSI_Cmd(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Read_RSSI_Cmd(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3075 (0x0c03)
+typedef struct sBtampTLVHCI_Reset_Cmd {
+    v_U8_t       present;
+} tBtampTLVHCI_Reset_Cmd;
+
+#define BTAMP_TLV_HCI_RESET_CMD ( 3075 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_RESET_CMD_MIN_LEN ( 2 )
+
+#define BTAMP_TLV_HCI_RESET_CMD_MAX_LEN ( 2 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Reset_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Reset_Cmd*);
+
+v_U32_t btampPackTlvHCI_Reset_Cmd(void *, tBtampTLVHCI_Reset_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Reset_Cmd(void *, tBtampTLVHCI_Reset_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5122 (0x1402)
+typedef struct sBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+} tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd;
+
+#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD ( 5122 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*);
+
+v_U32_t btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3077 (0x0c05)
+typedef struct sBtampTLVHCI_Set_Event_Mask_Cmd {
+    v_U8_t       present;
+    v_U8_t       event_mask[8];
+} tBtampTLVHCI_Set_Event_Mask_Cmd;
+
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD ( 3077 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD_MIN_LEN ( 10 )
+
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Event_Mask_Cmd*);
+
+v_U32_t btampPackTlvHCI_Set_Event_Mask_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3171 (0x0c63)
+typedef struct sBtampTLVHCI_Set_Event_Mask_Page_2_Cmd {
+    v_U8_t       present;
+    v_U8_t       event_mask_page_2[8];
+} tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd;
+
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD ( 3171 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD_MIN_LEN ( 10 )
+
+#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD_MAX_LEN ( 10 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*);
+
+v_U32_t btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3179 (0x0c6b)
+typedef struct sBtampTLVHCI_Set_Short_Range_Mode_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U8_t       short_range_mode;
+} tBtampTLVHCI_Set_Short_Range_Mode_Cmd;
+
+#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD ( 3179 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*);
+
+v_U32_t btampPackTlvHCI_Set_Short_Range_Mode_Cmd(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 76 (0x004c)
+typedef struct sBtampTLVHCI_Short_Range_Mode_Change_Complete_Event {
+    v_U8_t       present;
+    v_U8_t       status;
+    v_U8_t       phy_link_handle;
+    v_U8_t       short_range_mode;
+} tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event;
+
+#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT ( 76 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT_MIN_LEN ( 5 )
+
+#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*);
+
+v_U32_t btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3178 (0x0c6a)
+typedef struct sBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+    v_U32_t      best_effort_flush_timeout;
+} tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD ( 3178 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MIN_LEN ( 8 )
+
+#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MAX_LEN ( 8 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3094 (0x0c16)
+typedef struct sBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      connection_accept_timeout;
+} tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD ( 3094 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3175 (0x0c67)
+typedef struct sBtampTLVHCI_Write_Flow_Control_Mode_Cmd {
+    v_U8_t       present;
+    v_U8_t       flow_control_mode;
+} tBtampTLVHCI_Write_Flow_Control_Mode_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD ( 3175 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3127 (0x0c37)
+typedef struct sBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      log_link_handle;
+    v_U16_t      link_supervision_timeout;
+} tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD ( 3127 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD_MIN_LEN ( 6 )
+
+#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD_MAX_LEN ( 6 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3173 (0x0c65)
+typedef struct sBtampTLVHCI_Write_Location_Data_Cmd {
+    v_U8_t       present;
+    v_U8_t       loc_domain_aware;
+    v_U8_t       loc_domain[3];
+    v_U8_t       loc_options;
+} tBtampTLVHCI_Write_Location_Data_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD ( 3173 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD_MIN_LEN ( 7 )
+
+#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD_MAX_LEN ( 7 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Location_Data_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Location_Data_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Location_Data_Cmd(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Location_Data_Cmd(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 3170 (0x0c62)
+typedef struct sBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd {
+    v_U8_t       present;
+    v_U16_t      logical_link_accept_timeout;
+} tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD ( 3170 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 4 )
+
+#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 4 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 6146 (0x1802)
+typedef struct sBtampTLVHCI_Write_Loopback_Mode_Cmd {
+    v_U8_t       present;
+    v_U8_t       loopback_mode;
+} tBtampTLVHCI_Write_Loopback_Mode_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD ( 6146 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD_MIN_LEN ( 3 )
+
+#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD_MAX_LEN ( 3 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Loopback_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Loopback_Mode_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 5131 (0x140b)
+typedef struct sBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd {
+    v_U8_t       present;
+    v_U8_t       phy_link_handle;
+    v_U16_t      length_so_far;
+    v_U16_t      amp_assoc_remaining_length;
+    v_U8_t       amp_assoc_fragment[248];
+} tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd;
+
+#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD ( 5131 )
+
+// N.B. These #defines do *not* include the ID & length
+#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD_MIN_LEN ( 7 )
+
+#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD_MAX_LEN ( 255 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+v_U32_t btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*);
+
+v_U32_t btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U32_t*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// ID 64512 (0xfc00)
+typedef struct sBtampTLVHCI_Vendor_Specific_Cmd_0 {
+    v_U8_t       present;
+} tBtampTLVHCI_Vendor_Specific_0_Cmd;
+
+#define BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0 ( 64512 )
+
+// ID 64513 (0xfc01)
+typedef struct sBtampTLVHCI_Vendor_Specific_Cmd_1 {
+    v_U8_t       present;
+} tBtampTLVHCI_Vendor_Specific_1_Cmd;
+
+#define BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_1 ( 64513 )
+
+/*********************************************************************
+ * Information Elements                                              *
+ ********************************************************************/
+
+/************************************************************************
+ * Frames
+ **********************************************************************/
+
+typedef struct sBtampAMP_ASSOC{
+    tBtampTLVAMP_Assoc_MAC_Addr AMP_Assoc_MAC_Addr;
+    tBtampTLVAMP_Assoc_Preferred_Channel_List AMP_Assoc_Preferred_Channel_List;
+    tBtampTLVAMP_Assoc_Connected_Channel AMP_Assoc_Connected_Channel;
+    tBtampTLVAMP_Assoc_PAL_Capabilities AMP_Assoc_PAL_Capabilities;
+    tBtampTLVAMP_Assoc_PAL_Version AMP_Assoc_PAL_Version;
+} tBtampAMP_ASSOC;
+
+#define BTAMP_AMP_ASSOC ( 1 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+v_U32_t btampUnpackAMP_ASSOC(void * pCtx, v_U8_t *pBuf, v_U32_t nBuf, tBtampAMP_ASSOC *pFrm);
+v_U32_t btampPackAMP_ASSOC(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U8_t *pBuf, v_U32_t nBuf, v_U32_t *pnConsumed);
+v_U32_t btampGetPackedAMP_ASSOCSize(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U32_t *pnNeeded);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+/* HCI Number of Completed Packets Event*/
+typedef struct sBtampTLVHCI_Num_Completed_Pkts_Event
+{
+    v_U8_t       present;
+    /* 
+      The number of Connection Handles and Num_Data_Packets
+      parameters pairs contained in this event.Range: 0-255
+    */
+
+    v_U8_t   num_handles;
+
+    /* 
+      Size , Number of Handles * 2 Octets,Range: 0x0000-0x0EFF 
+    */
+    v_U16_t  conn_handles[WLANBAP_MAX_LOG_LINKS];  
+
+    /* 
+      The number of HCI Data Packets that have been completed (transmitted
+      or flushed) for the associated Connection Handle since the previous time
+      the event was returned.Range for N: 0x0000-0xFFFF
+    */
+    v_U16_t  num_completed_pkts[WLANBAP_MAX_LOG_LINKS]; 
+} tBtampTLVHCI_Num_Completed_Pkts_Event;
+
+#define BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT ( 19 )
+
+v_U32_t btampPackTlvHCI_Num_Completed_Pkts_Event(void *, tBtampTLVHCI_Num_Completed_Pkts_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Num_Completed_Pkts_Event(void *, tBtampTLVHCI_Num_Completed_Pkts_Event*, v_U32_t*);
+
+/*Length of the value field expected in a TLV of type Flow SPec*/
+#define WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN          16
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+
+/* HCI Number of Completed Data Blocks Event*/
+typedef struct sBtampTLVHCI_Num_Completed_Data_Blocks_Event
+{
+    v_U8_t       present;
+    /* 
+      Total number of data block buffers available in the Controller for the
+      storage of data packets scheduled for transmission. This indicates
+      the existing value is unchanged, or increased, or reduced by up to
+      the sum of the Num_Of_Completed_Blocks values in this command
+    */
+
+    v_U16_t   total_num_data_blocks;
+
+    /* 
+      The number of Connection Handles and Num_Data_Packets
+      parameters pairs contained in this event.Range: 0-255
+    */
+
+    v_U8_t   num_handles;
+
+    /* 
+      Size , Number of Handles * 2 Octets,Range: 0x0000-0x0EFF 
+    */
+    v_U16_t  conn_handles[WLANBAP_MAX_LOG_LINKS];  
+
+    /* 
+      The number of HCI Data Packets that have been completed (transmitted
+      or flushed) for the associated Connection Handle since the previous time
+      the event was returned.Range for N: 0x0000-0xFFFF
+    */
+    v_U16_t  num_completed_pkts[WLANBAP_MAX_LOG_LINKS]; 
+
+    /* 
+      The number of data blocks that have been freed for the associated
+      Handle since the previous time that a Number Of Completed Data
+      Blocks event provided information about this Handle.
+      Range for N: 0x0000-0xFFFF
+    */
+    v_U16_t  num_completed_blocks[WLANBAP_MAX_LOG_LINKS]; 
+
+} tBtampTLVHCI_Num_Completed_Data_Blocks_Event;
+
+#define BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT ( 72 )
+
+v_U32_t btampPackTlvHCI_Num_Completed_Data_Blocks_Event(void *, tBtampTLVHCI_Num_Completed_Data_Blocks_Event*, v_U8_t*, v_U32_t, v_U32_t*);
+
+v_U32_t btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(void *, tBtampTLVHCI_Num_Completed_Data_Blocks_Event*, v_U32_t*);
+
+#ifdef __cplusplus
+} /* End extern "C". */
+#endif /* C++ */
+
+#endif /* BTAMPHCI_H */
+
+
diff --git a/CORE/BAP/src/bapApiData.c b/CORE/BAP/src/bapApiData.c
new file mode 100644
index 0000000..0875e31
--- /dev/null
+++ b/CORE/BAP/src/bapApiData.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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i D a t a . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  "platform independent" Data path functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiData.c,v 1.4 2008/11/10 22:34:22 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+//I need the TL types and API
+#include "wlan_qct_tl.h"
+
+#include "wlan_qct_hal.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+#include "bapApiTimer.h"
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+/*Endian-ness definitions*/
+
+#undef BAP_LITTLE_BIT_ENDIAN
+#define BAP_LITTLE_BIT_ENDIAN
+
+/*LLC header definitions*/
+
+/* Length of the LLC header*/
+#define WLANBAP_LLC_HEADER_LEN   8 
+#if 0
+/*Offset of the OUI field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_OUI_OFFSET                 3
+
+/*Size of the OUI type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_OUI_SIZE                   3
+
+/*Offset of the protocol type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_PROTO_TYPE_OFFSET  WLANBAP_LLC_OUI_OFFSET +  WLANBAP_LLC_OUI_SIZE
+
+/*Size of the protocol type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_PROTO_TYPE_SIZE            2
+#endif
+
+/*BT-AMP protocol type values*/
+/*BT-AMP packet of type data*/
+#define WLANBAP_BT_AMP_TYPE_DATA       0x0001
+
+/*BT-AMP packet of type activity report*/
+#define WLANBAP_BT_AMP_TYPE_AR         0x0002
+
+/*BT-AMP packet of type security frame*/
+#define WLANBAP_BT_AMP_TYPE_SEC        0x0003
+
+/*802.3 header definitions*/
+#define  WLANBAP_802_3_HEADER_LEN             14
+
+/* Offset of DA field in a 802.3 header*/
+#define  WLANBAP_802_3_HEADER_DA_OFFSET        0
+
+//*BT-AMP packet LLC OUI value*/
+const v_U8_t WLANBAP_BT_AMP_OUI[] =  {0x00, 0x19, 0x58 };
+
+/*LLC header value*/
+static v_U8_t WLANBAP_LLC_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
+
+/* HCI header definitions*/
+
+// Define the length of the ACL data packet HCI header
+#define WLANBAP_HCI_ACL_HEADER_LEN    4
+
+// Debug related defines
+//#define DBGLOG printf
+#define DUMPLOG_ON
+#ifdef DUMPLOG_ON
+#define DUMPLOG(n, name1, name2, aStr, size) \
+    if (1) \
+{\
+    int i;\
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%d. %s: %s = \n", n, name1, name2); \
+    for (i = 0; i < size; i++) \
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"\n"); \
+}
+#else
+#define DUMPLOG(n, name1, name2, aStr, size)
+#endif
+
+#if 0
+// Debug related defines
+#define DBGLOG printf
+#define DUMPLOG
+#if defined DUMPLOG
+#define DUMPLOG(n, name1, name2, aStr, size) \
+    if (1) \
+{\
+    int i;\
+    DBGLOG("%d. %s: %s = \n", n, name1, name2); \
+    for (i = 0; i < size; i++) \
+        DBGLOG("%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \
+    DBGLOG("\n"); \
+}
+#else
+#define DUMPLOG(n, name1, name2, aStr, size)
+#endif
+#endif
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+// Don't we have this type defined somewhere?
+#if 0
+/* 802.3 header */
+typedef struct 
+{
+ /* Destination address field */
+ v_U8_t   vDA[VOS_MAC_ADDR_SIZE];
+
+ /* Source address field */
+ v_U8_t   vSA[VOS_MAC_ADDR_SIZE];
+
+ /* Length field */
+ v_U16_t  usLenType;  /* Num bytes in info field (i.e., exclude 802.3 hdr) */
+                      /* Max length 1500 (0x5dc) (What about 0x5ee? That
+                       * includes 802.3 Header and FCS.) */
+}WLANBAP_8023HeaderType;
+#endif
+
+/**
+ * \brief HCI ACL Data packet format
+ *
+ *     0      7 8      15 16    23 24    31
+ *    +--------+----+----+--------+--------+
+ *    | phy_   |log_| PB/|   Data Total    |
+ *    | link_  |lnk_| BC |      Length     |
+ *    | handle |hndl|Flag|                 |
+ *    +--------+----+----+--------+--------+
+ *    |                                    |
+ *    |                Data                |
+ *    ~                                    ~
+ *    +--------+---------+--------+--------+
+ *
+ *  NB: 
+ *  This is in little-endian
+ *  1) phy_link_handle is the first 8 bits
+ *  2) log_link_handle is the next 4 bits 
+ *  3) PB flag is the next 2 bits
+ *  4) BC flags is the next 2 bits
+ *  5) Total length of the data field is the next 16 bits
+ *
+ */
+
+typedef struct 
+{
+
+#ifndef BAP_LITTLE_BIT_ENDIAN
+
+   v_U8_t phyLinkHandle; /* do I have to reverse the byte? I think so... */
+
+   v_U8_t BCFlag :2;
+   v_U8_t PBFlag :2;
+   v_U8_t logLinkHandle :4;
+
+   v_U16_t dataLength;  /* do I have to reverse each byte? and then reverse the two bytes?  I think so... */
+
+#else
+
+   v_U8_t phyLinkHandle;
+
+   v_U8_t logLinkHandle :4;
+   v_U8_t PBFlag :2;
+   v_U8_t BCFlag :2;
+
+   v_U16_t dataLength;  /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */
+
+#endif
+
+} WLANBAP_HCIACLHeaderType;
+
+
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+#define WLANBAP_DEBUG_FRAME_BYTE_PER_LINE    16
+#define WLANBAP_DEBUG_FRAME_BYTE_PER_BYTE    4
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_XlateTxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has a HCI Data Packet and it wants 
+    to translate it into a 802.3 LLC frame - ready to send using TL.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) 
+
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the BT-AMP packet to be 
+                 translated to an 802.3 LLC frame
+    tlMetaInfo:  return meta info gleaned from the outgoing frame, here.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_XlateTxDataPkt
+( 
+    ptBtampHandle     btampHandle,  /* Used by BAP to identify the actual session
+                                      and therefore addresses */ 
+    v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+    WLANTL_ACEnumType    *pucAC,        /* Return the AC here */
+    WLANTL_MetaInfoType  *tlMetaInfo, /* Return the MetaInfo here. An assist to WLANBAP_STAFetchPktCBType */
+    vos_pkt_t        *vosDataBuff
+)
+{
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle; 
+    tpBtampLogLinkCtx        pLogLinkContext;
+    WLANBAP_8023HeaderType   w8023Header;
+    WLANBAP_HCIACLHeaderType hciACLHeader;
+    v_U8_t                   aucLLCHeader[WLANBAP_LLC_HEADER_LEN];
+    VOS_STATUS               vosStatus;
+    v_U8_t                   ucSTAId;  /* The StaId (used by TL, PE, and HAL) */
+    v_PVOID_t                pHddHdl; /* Handle to return BSL context in */
+    v_U16_t                  headerLength;  /* The 802.3 frame length*/
+    v_U16_t                  protoType = WLANBAP_BT_AMP_TYPE_DATA;  /* The protocol type bytes*/
+    v_U32_t                  value = 0;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+ 
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // Here, I have to make the assumption that this is an 
+    // HCI ACL Data packet that I am being handed. 
+    vosStatus = vos_pkt_pop_head( vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN BAP: Failed to pop HCI ACL header from packet %d",
+                  vosStatus);
+
+        return vosStatus;
+    }
+
+    // JEZ081003: Remove this after debugging 
+    // Sanity check the phy_link_handle value 
+
+    if ( phy_link_handle != hciACLHeader.phyLinkHandle ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: phy_link_handle mismatch in %s phy_link_handle=%d hciACLHeader.phyLinkHandle=%d",
+                __FUNCTION__, phy_link_handle, hciACLHeader.phyLinkHandle);
+        return VOS_STATUS_E_INVAL;
+    }
+
+
+    /* Lookup the StaId using the phy_link_handle and the BAP context */ 
+
+    vosStatus = WLANBAP_GetStaIdFromLinkCtx ( 
+            btampHandle,  /* btampHandle value in  */ 
+            phy_link_handle,  /* phy_link_handle value in */
+            &ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+            &pHddHdl); /* Handle to return BSL context */
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                     "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // JEZ081003: Remove this after debugging 
+    // Sanity check the log_link_handle value 
+    if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "WLAN BAP: Invalid logical link handle (%d) in %s. Corrected.", 
+                hciACLHeader.logLinkHandle,
+                __FUNCTION__);
+
+        // JEZ090123: Insure that the logical link value is good
+        hciACLHeader.logLinkHandle = 1;
+        //return VOS_STATUS_E_INVAL;
+    }
+
+    /* Use the log_link_handle to retrieve the logical link context */ 
+    /* JEZ081006: abstract this with a proc.  So you can change the impl later */ 
+    pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]);
+
+    // JEZ081003: Remove this after debugging 
+    // Sanity check the log_link_handle value 
+    // JEZ081113: I changed this to fail on an UNOCCUPIED entry 
+    if ( pLogLinkContext->present != VOS_TRUE)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "WLAN BAP: Invalid logical link entry in %s",
+                __FUNCTION__);
+
+        return VOS_STATUS_E_INVAL;
+    }
+
+    // Return the AC and MetaInfo
+
+    // Now copy the AC values from the Logical Link context
+    *pucAC = pLogLinkContext->btampAC;
+    // Now copy the values from the Logical Link context to the MetaInfo 
+    tlMetaInfo->ucTID = pLogLinkContext->ucTID;
+    tlMetaInfo->ucUP = pLogLinkContext->ucUP;
+    tlMetaInfo->ucIsEapol = VOS_FALSE;
+    tlMetaInfo->ucDisableFrmXtl = VOS_FALSE;
+    tlMetaInfo->ucBcast = VOS_FALSE; /* hciACLHeader.BCFlag; */ /* Don't I want to use the BCFlag? */
+    tlMetaInfo->ucMcast = VOS_FALSE;
+    tlMetaInfo->ucType = 0x00;  /* What is this really ?? */
+//    tlMetaInfo->usTimeStamp = 0x00;  /* Ravi, shouldn't you be setting this?  It's in the VOS packet.  */
+
+    // Form the 802.3 header
+
+    vos_mem_copy( w8023Header.vDA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE);
+    vos_mem_copy( w8023Header.vSA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE);
+    
+    /* Now this length passed down in HCI...is in little-endian */
+    headerLength = vos_le16_to_cpu(hciACLHeader.dataLength);  
+    headerLength += WLANBAP_LLC_HEADER_LEN;  
+    /* Now the 802.3 length field is big-endian?! */
+    w8023Header.usLenType = vos_cpu_to_be16(headerLength);
+
+    /* Now adjust the protocol type bytes*/
+    protoType = vos_cpu_to_be16( protoType);
+
+    /* Now form the LLC header */
+    vos_mem_copy(aucLLCHeader, 
+            WLANBAP_LLC_HEADER,  
+            sizeof(WLANBAP_LLC_HEADER));
+    vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], 
+            WLANBAP_BT_AMP_OUI,  
+            WLANBAP_LLC_OUI_SIZE);
+    vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], 
+            &protoType,  //WLANBAP_BT_AMP_TYPE_DATA
+            WLANBAP_LLC_PROTO_TYPE_SIZE);
+ 
+    /* Push on the LLC header */
+    vos_pkt_push_head(vosDataBuff, 
+            aucLLCHeader, 
+            WLANBAP_LLC_HEADER_LEN);  
+
+    /* Push on the 802.3 header */
+    vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
+
+
+    /*Set the logical link handle as user data so that we can retrieve it on 
+      Tx Complete */
+    value = (v_U32_t)hciACLHeader.logLinkHandle;
+    vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP,
+                               (v_VOID_t *)value);
+
+    return VOS_STATUS_SUCCESS;
+}/*WLANBAP_XlateTxDataPkt*/
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_GetAcFromTxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has a HCI Data Packet (SKB) and it wants 
+    to find AC type of the data frame from the HCI header on the data pkt
+    - to be send using TL.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+ 
+    pHciData: Pointer to the HCI data frame
+ 
+    pucAC:       Pointer to return the access category 
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_GetAcFromTxDataPkt
+( 
+  ptBtampHandle     btampHandle,  /* Used by BAP to identify the actual session
+                                    and therefore addresses */
+  void              *pHciData,     /* Pointer to the HCI data frame */
+  WLANTL_ACEnumType *pucAC        /* Return the AC here */
+)
+{
+    ptBtampContext           pBtampCtx; 
+    tpBtampLogLinkCtx        pLogLinkContext;
+    WLANBAP_HCIACLHeaderType hciACLHeader;
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if (( NULL == btampHandle) || (NULL == pHciData) || (NULL == pucAC))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid params in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+    pBtampCtx = (ptBtampContext) btampHandle;
+
+    vos_mem_copy( &hciACLHeader, pHciData, WLANBAP_HCI_ACL_HEADER_LEN);
+    // Sanity check the log_link_handle value 
+    if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "WLAN BAP: Invalid logical link handle (%d) in %s", 
+                hciACLHeader.logLinkHandle,
+                __FUNCTION__);
+
+        return VOS_STATUS_E_INVAL;
+    }
+
+    /* Use the log_link_handle to retrieve the logical link context */ 
+    /* JEZ081006: abstract this with a proc.  So you can change the impl later */ 
+    pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]);
+
+    // Sanity check the log_link_handle value 
+    // JEZ081113: I changed this to fail on an UNOCCUPIED entry 
+    if ( pLogLinkContext->present != VOS_TRUE)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "WLAN BAP: Invalid logical link entry in %s",
+                __FUNCTION__);
+
+        return VOS_STATUS_E_INVAL;
+    }
+
+    // Return the AC
+
+    // Now copy the AC values from the Logical Link context
+    *pucAC = pLogLinkContext->btampAC;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_XlateRxDataPkt
+
+  DESCRIPTION 
+
+    HDD will call this API when it has received a 802.3 (TL/UMA has 
+    Xlated from 802.11) frame from TL and it wants to form a 
+    BT HCI Data Packet - ready to signal up to the BT stack application.
+
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the 802.3 frame to be 
+                 translated to BT HCI Data Packet
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_XlateRxDataPkt
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  WLANTL_ACEnumType  *pucAC,        /* Return the AC here. I don't think this is needed */
+  vos_pkt_t        *vosDataBuff
+)
+{
+    WLANBAP_8023HeaderType  w8023Header;
+    WLANBAP_HCIACLHeaderType hciACLHeader;
+    v_U8_t                   aucLLCHeader[WLANBAP_LLC_HEADER_LEN];
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle; 
+    VOS_STATUS               vosStatus;
+    //v_PVOID_t                pHddHdl; /* Handle to return BSL context in */
+    v_U16_t                  hciDataLength;  /* The HCI packet data length*/
+    v_U16_t                  protoType = WLANBAP_BT_AMP_TYPE_DATA;  /* The protocol type bytes*/
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // Here, I have to make the assumption that this is an 
+    // 802.3 header followed by an LLC/SNAP packet. 
+    vos_mem_set( &w8023Header, sizeof(w8023Header), 0 );
+    vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header, sizeof(w8023Header));
+
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN BAP: Failed to pop 802.3 header from packet %d",
+                  vosStatus);
+
+        return vosStatus;
+    }
+
+    // Here, is that LLC/SNAP header. 
+    // With the BT SIG OUI that I am being handed. 
+    vos_mem_set( aucLLCHeader, WLANBAP_LLC_HEADER_LEN, 0 );
+    vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader, WLANBAP_LLC_HEADER_LEN);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN BAP: Failed to pop LLC/SNAP header from packet %d",
+                  vosStatus);
+
+        return vosStatus;
+    }
+
+#ifdef BAP_DEBUG
+    // JEZ081003: Remove this after debugging 
+    // Should I double check that I am getting the BT SIG OUI ?
+    if ( !(vos_mem_compare( aucLLCHeader, 
+             WLANBAP_LLC_HEADER,  
+             sizeof(WLANBAP_LLC_HEADER)  
+             - WLANBAP_LLC_OUI_SIZE)  /* Don't check the last three bytes here */ 
+         && vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], 
+             (v_VOID_t*)WLANBAP_BT_AMP_OUI,  
+             WLANBAP_LLC_OUI_SIZE)))  /* check them here */ 
+    {
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid LLC header for BT-AMP packet in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+#endif //BAP_DEBUG
+
+    /* Now adjust the protocol type bytes*/
+    protoType = vos_cpu_to_be16( protoType);
+    // check if this is a data frame or other, internal to BAP, type...
+    // we are only handling data frames in here...
+    // The others (Security and AR) are handled by TLs BAP client API. 
+    // (Verify with TL)
+    if ( !(vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], 
+            &protoType,  //WLANBAP_BT_AMP_TYPE_DATA
+            WLANBAP_LLC_PROTO_TYPE_SIZE))) 
+    {
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid (non-data) frame type in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+#ifdef BAP_DEBUG
+    // JEZ081003: Remove this after debugging 
+    /*------------------------------------------------------------------------
+        Sanity check the MAC address in the physical link context 
+        against the value in the incoming Rx Frame.
+      ------------------------------------------------------------------------*/
+    if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE)
+    && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE))) 
+    {
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "MAC address mismatch in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+#endif //BAP_DEBUG
+
+    /* No lookup is needed.  Because TL has already told WLANBAP_STARxCB 
+     * the StaId.  And I told WLANBAP_STARxCBType the corresponding BSL context 
+     * Which he used to lookup the phy_link_handle value. 
+     */ 
+
+
+    // Start filling in the HCI header 
+    hciACLHeader.phyLinkHandle = phy_link_handle;
+
+    // Continue filling in the HCI header 
+    //JEZ100913: On Rx the Logical Link is ALWAYS 0. See Vol 2, Sec E, 5.4.2 of spec.
+    hciACLHeader.logLinkHandle = 0;
+    hciACLHeader.PBFlag = WLANBAP_HCI_PKT_AMP;
+    hciACLHeader.BCFlag = 0;
+
+    /* Now the length field is big-endian?! */
+    hciDataLength =  vos_be16_to_cpu(w8023Header.usLenType);
+    /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */
+    hciDataLength -= WLANBAP_LLC_HEADER_LEN;
+    /* The HCI packet data length is Little-endian */
+    hciACLHeader.dataLength = vos_cpu_to_le16(hciDataLength);  
+
+    /* Return the AC here. 
+     * (I can't because there is no way to figure out what it is.)
+     */
+    *pucAC = 0;        
+
+    /* Push on the HCI header */
+    vos_pkt_push_head(vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN);
+
+    return VOS_STATUS_SUCCESS;
+} /* WLANBAP_XlateRxDataPkt */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_STAFetchPktCB 
+
+  DESCRIPTION   
+    The fetch packet callback registered with TL. 
+    
+    It is called by the TL when the scheduling algorithms allows for 
+    transmission of another packet to the module. 
+    It will be called in the context of the BAL fetch transmit packet 
+    function, initiated by the bus lower layer. 
+
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle 
+                    to TL's or HDD's control block can be extracted 
+                    from its context 
+
+    IN/OUT
+    pucSTAId:       the Id of the station for which TL is requesting a 
+                    packet, in case HDD does not maintain per station 
+                    queues it can give the next packet in its queue 
+                    and put in the right value for the 
+    pucAC:          access category requested by TL, if HDD does not have 
+                    packets on this AC it can choose to service another AC 
+                    queue in the order of priority
+
+    OUT
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    tlMetaInfo:    meta info related to the data frame
+
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_STAFetchPktCB 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pucSTAId,
+  v_U8_t                ucAC,
+  vos_pkt_t**           vosDataBuff,
+  WLANTL_MetaInfoType*  tlMetaInfo
+)
+{
+    VOS_STATUS    vosStatus; 
+    ptBtampHandle bapHdl;  /* holds ptBtampHandle value returned  */ 
+    ptBtampContext bapContext; /* Holds the btampContext value returned */ 
+    v_PVOID_t     pHddHdl; /* Handle to return BSL context in */
+
+    /* Lookup the BSL and BAP contexts using the StaId */ 
+
+    vosStatus = WLANBAP_GetCtxFromStaId ( 
+            *pucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+            &bapHdl,  /* "handle" to return ptBtampHandle value in  */ 
+            &bapContext,  /* "handle" to return ptBtampContext value in  */ 
+            &pHddHdl); /* "handle" to return BSL context in */
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                   "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_STAFetchPktCB");
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Invoke the callback that BSL registered with me */ 
+    vosStatus = (*bapContext->pfnBtampFetchPktCB)( 
+            pHddHdl, 
+            (WLANTL_ACEnumType)   ucAC, /* typecast it for now */ 
+            vosDataBuff, 
+            tlMetaInfo);    
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                "Callback registered by BSL failed to fetch pkt in WLANNBAP_STAFetchPktCB");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    return vosStatus;
+} /* WLANBAP_STAFetchPktCB */ 
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_STARxCB
+
+  DESCRIPTION   
+    The receive callback registered with TL. 
+    
+    TL will call this to notify the client when a packet was received 
+    for a registered STA.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL's or HDD's control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was received
+                    (it may be a linked list) 
+    ucSTAId:        station id
+    pRxMetaInfo:   meta info for the received packet(s) 
+   
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_STARxCB
+( 
+  v_PVOID_t          pvosGCtx,
+  vos_pkt_t*         vosDataBuff,
+  v_U8_t             ucSTAId,
+  WLANTL_RxMetaInfoType* pRxMetaInfo
+)
+{
+    VOS_STATUS    vosStatus; 
+    ptBtampHandle bapHdl;  /* holds ptBtampHandle value returned  */ 
+    ptBtampContext bapContext; /* Holds the btampContext value returned */ 
+    v_PVOID_t     pHddHdl; /* Handle to return BSL context in */
+    ptBtampHandle            btampHandle;
+    WLANBAP_8023HeaderType   w8023Header;
+    v_U8_t                   aucLLCHeader[WLANBAP_LLC_HEADER_LEN];
+    v_U16_t                  protoType ;
+    v_SIZE_t                 llcHeaderLen = WLANBAP_LLC_HEADER_LEN ;
+    
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                   "In WLANBAP_STARxCB");
+
+    /* Lookup the BSL and BAP contexts using the StaId */ 
+
+    vosStatus = WLANBAP_GetCtxFromStaId ( 
+            ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+            &bapHdl,  /* "handle" to return ptBtampHandle value in  */ 
+            &bapContext,  /* "handle" to return ptBtampContext value in  */ 
+            &pHddHdl); /* "handle" to return BSL context in */
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                   "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_STARxCB");
+      /* Drop packet */
+      vos_pkt_return_packet(vosDataBuff);
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    vosStatus = vos_pkt_extract_data( vosDataBuff, sizeof(w8023Header), (v_VOID_t *)aucLLCHeader,
+                                   &llcHeaderLen);
+
+    if ( NULL == aucLLCHeader/*LLC Header*/ )
+    {
+        VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLANBAP_STARxCB:Cannot extract LLC header");
+        /* Drop packet */
+        vos_pkt_return_packet(vosDataBuff);
+        return VOS_STATUS_E_FAULT;
+    }
+    
+    vos_mem_copy(&protoType,&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET],WLANBAP_LLC_PROTO_TYPE_SIZE);
+    protoType = vos_be16_to_cpu(protoType);
+    
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "%s: received : %d, => BAP",__FUNCTION__,
+                 protoType);
+    
+    if(WLANBAP_BT_AMP_TYPE_DATA == protoType)
+    {
+        if (bapContext->bapLinkSupervisionTimerInterval)
+        {
+            /* Reset Link Supervision timer */
+            //vosStatus = WLANBAP_StopLinkSupervisionTimer(bapContext); 
+            //vosStatus = WLANBAP_StartLinkSupervisionTimer(bapContext,7000);
+            bapContext->dataPktPending = VOS_TRUE;//Indication for LinkSupervision module that data is pending 
+            /* Invoke the callback that BSL registered with me */ 
+            vosStatus = (*bapContext->pfnBtamp_STARxCB)( 
+                pHddHdl,
+                vosDataBuff,
+                pRxMetaInfo);
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+                     "WLANBAP_STARxCB:bapLinkSupervisionTimerInterval is 0");
+            /* Drop packet */
+            vos_pkt_return_packet(vosDataBuff);
+        }
+    }
+    else
+    {
+          VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "%s: link Supervision packet received over TL: %d, => BAP",
+                     __FUNCTION__,protoType);
+          btampHandle = (ptBtampHandle)bapContext; 
+          vosStatus = WLANBAP_RxProcLsPkt(
+                        btampHandle,
+                        bapContext->phy_link_handle,
+                        protoType,
+                        vosDataBuff
+                        );
+    }  
+
+    return vosStatus;
+} /* WLANBAP_STARxCB */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_TxCompCB
+
+  DESCRIPTION   
+    The tx complete callback registered with TL. 
+    
+    TL will call this to notify the client when a transmission for a 
+    packet  has ended. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL/HAL/PE/BAP/HDD control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    wTxSTAtus:      status of the transmission 
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_TxCompCB
+( 
+  v_PVOID_t      pvosGCtx,
+  vos_pkt_t*     vosDataBuff,
+  VOS_STATUS     wTxSTAtus 
+)
+{
+    VOS_STATUS    vosStatus; 
+    ptBtampHandle bapHdl;  /* holds ptBtampHandle value returned  */ 
+    ptBtampContext bapContext; /* Holds the btampContext value returned */ 
+    v_PVOID_t     pHddHdl; /* Handle to return BSL context in */
+    v_PVOID_t      pvlogLinkHandle = NULL;
+    v_U32_t       value;
+
+    WLANBAP_HCIACLHeaderType hciACLHeader;
+
+    /* retrieve the BSL and BAP contexts */ 
+
+    /* I don't really know how to do this - in the general case. */
+    /* So, for now, I will just use something that works. */
+    /* (In general, I will have to keep a list of the outstanding transmit */
+    /* buffers, in order to determine which assoc they are with.) */
+    //vosStatus = WLANBAP_GetCtxFromStaId ( 
+    //        ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+    //        &bapHdl,  /* "handle" to return ptBtampHandle value in  */ 
+    //        &bapContext,  /* "handle" to return ptBtampContext value in  */ 
+    //        &pHddHdl); /* "handle" to return BSL context in */
+    /* Temporarily we do the following*/ 
+    //bapHdl = &btampCtx;
+    bapHdl = (v_PVOID_t)gpBtampCtx;
+    /* Typecast the handle into a context. Works as we have only one link*/ 
+    bapContext = ((ptBtampContext) bapHdl);  
+
+    /*------------------------------------------------------------------------
+      Sanity check params
+    ------------------------------------------------------------------------*/
+    if ( NULL == vosDataBuff) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Invalid vosDataBuff value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    if ( NULL == bapContext) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Invalid bapContext value in %s", __FUNCTION__);
+        vos_pkt_return_packet( vosDataBuff ); 
+        return VOS_STATUS_E_FAULT;
+    }
+
+    pHddHdl = bapContext->pHddHdl;
+    vosStatus = VOS_STATUS_SUCCESS;
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                   "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_TxCompCB");
+      vos_pkt_return_packet( vosDataBuff ); 
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /*Get the logical link handle from the vos user data*/
+    vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP,
+                               &pvlogLinkHandle);
+
+    value = (v_U32_t)pvlogLinkHandle;
+    hciACLHeader.logLinkHandle = value;
+
+#ifdef BAP_DEBUG
+    /* Trace the bapContext referenced. */
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN BAP Context Monitor: bapContext value = %p in %s:%d. vosDataBuff=%p", bapContext, __FUNCTION__, __LINE__, vosDataBuff );
+#endif //BAP_DEBUG
+
+    // Sanity check the log_link_handle value 
+// JEZ100722: Temporary changes.
+    if (BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle))
+    {
+       vos_atomic_increment_U32(
+           &bapContext->btampLogLinkCtx[hciACLHeader.logLinkHandle].uTxPktCompleted);
+//           &bapContext->btampLogLinkCtx[0].uTxPktCompleted);
+//       vos_atomic_increment_U32(
+//           &bapContext->btampLogLinkCtx[1].uTxPktCompleted);
+    } else 
+    {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "In %s:%d: Invalid logical link handle: %d", __FUNCTION__, __LINE__, hciACLHeader.logLinkHandle);
+    }
+
+    /* Invoke the callback that BSL registered with me */ 
+    vosStatus = (*bapContext->pfnBtampTxCompCB)( 
+            pHddHdl,
+            vosDataBuff,
+            wTxSTAtus);
+
+    return vosStatus;
+} /* WLANBAP_TxCompCB */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_RegisterDataPlane
+
+  DESCRIPTION 
+    The HDD calls this routine to register the "data plane" routines
+    for Tx, Rx, and Tx complete with BT-AMP.  For now, with only one
+    physical association supported at a time, this COULD be called 
+    by HDD at the same time as WLANBAP_GetNewHndl.  But, in general
+    it needs to be called upon each new physical link establishment.
+    
+    This registration is really two part.  The routines themselves are
+    registered here.  But, the mapping between the BSL context and the
+    actual physical link takes place during WLANBAP_PhysicalLinkCreate. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_RegisterDataPlane
+( 
+  ptBtampHandle btampHandle,  /* BTAMP context */ 
+  WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB, 
+  WLANBAP_STARxCBType pfnBtamp_STARxCB,
+  WLANBAP_TxCompCBType pfnBtampTxCompCB,
+  // phy_link_handle, of course, doesn't come until much later.  At Physical Link create.
+  v_PVOID_t      pHddHdl   /* BSL specific context */
+)
+{
+    ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; 
+
+  
+    /*------------------------------------------------------------------------
+      Sanity check params
+     ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in WLANBAP_RegisterDataPlane");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
+    pBtampCtx->pfnBtampFetchPktCB = pfnBtampFetchPktCB; 
+    pBtampCtx->pfnBtamp_STARxCB = pfnBtamp_STARxCB;
+    pBtampCtx->pfnBtampTxCompCB = pfnBtampTxCompCB;
+
+    // (Right now, there is only one)
+    pBtampCtx->pHddHdl = pHddHdl;
+    /* Set the default data transfer mode */ 
+    pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLANBAP_RegisterDataPlane */
+
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_STAPktPending
+
+  DESCRIPTION 
+
+    HDD will call this API when a packet is pending transmission in its 
+    queues. HDD uses this instead of WLANTL_STAPktPending because he is
+    not aware of the mapping from session to STA ID.
+
+  DEPENDENCIES 
+
+    HDD must have called WLANBAP_GetNewHndl before calling this API.
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+                 BSL can obtain this from the physical handle value in the
+                 downgoing HCI Data Packet. He, after all, was there
+                 when the PhysicalLink was created. He knew the btampHandle 
+                 value returned by WLANBAP_GetNewHndl. He knows as well, his
+                 own pHddHdl (see next).
+    phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId)
+    ucAc:        The access category for the pending frame
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_STAPktPending 
+( 
+  ptBtampHandle  btampHandle,  /* Used by BAP to identify the app context and VOSS ctx (!?) */ 
+  v_U8_t         phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  WLANTL_ACEnumType ucAc   /* This is the first instance of a TL type in bapApi.h */
+)
+{
+    VOS_STATUS     vosStatus; 
+    ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; 
+    v_PVOID_t      pvosGCtx;
+    v_U8_t         ucSTAId;  /* The StaId (used by TL, PE, and HAL) */
+    v_PVOID_t      pHddHdl; /* Handle to return BSL context in */
+
+  
+#ifdef BAP_DEBUG
+    /* Trace the tBtampCtx being passed in. */
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN BAP Context Monitor: pBtampCtx value = %p in %s:%d", pBtampCtx, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+    /*------------------------------------------------------------------------
+      Sanity check params
+     ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Invalid BAP handle value in WLANBAP_STAPktPending"); 
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // Retrieve the VOSS context
+    pvosGCtx = pBtampCtx->pvosGCtx;
+ 
+    /* Lookup the StaId using the phy_link_handle and the BAP context */ 
+
+    vosStatus = WLANBAP_GetStaIdFromLinkCtx ( 
+            btampHandle,  /* btampHandle value in  */ 
+            phy_link_handle,  /* phy_link_handle value in */
+            &ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+            &pHddHdl); /* Handle to return BSL context */
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                   "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_STAPktPending");
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    // Let TL know we have a packet to send...
+    vosStatus = WLANTL_STAPktPending( 
+            pvosGCtx,
+            ucSTAId,
+            ucAc);
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                        "Tx: Packet rejected by TL in WLANBAP_STAPktPending");
+        return vosStatus;
+    }            
+    pBtampCtx->dataPktPending = VOS_TRUE;//Indication for LinkSupervision module that data is pending 
+    return VOS_STATUS_SUCCESS;
+} /* WLANBAP_STAPktPending */ 
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPRegisterBAPCallbacks() 
+
+  DESCRIPTION 
+    Register the BAP "Event" callbacks.
+    Return the per instance handle.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pBapHCIEventCB:  pointer to the Event callback
+    pAppHdl:  The context passed in by caller. (I.E., BSL app specific context.)
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEventCB is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPRegisterBAPCallbacks 
+( 
+  ptBtampHandle           btampHandle, /* BSL uses my handle to talk to me */
+                            /* Returned from WLANBAP_GetNewHndl() */
+                            /* It's like each of us is using the other */
+                            /* guys reference when invoking him. */
+  tpWLAN_BAPEventCB       pBapHCIEventCB, /*Implements the callback for ALL asynchronous events. */ 
+  v_PVOID_t               pAppHdl  // Per-app BSL context
+)
+{
+    ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; 
+
+  
+    /*------------------------------------------------------------------------
+      Sanity check params
+     ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in WLAN_BAPRegisterBAPCallbacks");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // Save the Event callback 
+    pBtampCtx->pBapHCIEventCB = pBapHCIEventCB; 
+
+    // (Right now, there is only one)
+    pBtampCtx->pAppHdl = pAppHdl;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPRegisterBAPCallbacks */
+
+
diff --git a/CORE/BAP/src/bapApiDebug.c b/CORE/BAP/src/bapApiDebug.c
new file mode 100644
index 0000000..5a334e3
--- /dev/null
+++ b/CORE/BAP/src/bapApiDebug.c
@@ -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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i D e b u g . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Debug functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiDebug.c,v 1.2 2008/11/10 22:37:58 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+
+//
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*
+Debug Commands
+*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLoopbackMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Loopback Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLoopbackMode:  pointer to the "HCI Read Loopback Mode".
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLoopbackMode or 
+                         pBapHCILoopbackMode is NULL.
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLoopbackMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Loopback_Mode_Cmd  *pBapHCIReadLoopbackMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLoopbackMode */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLoopbackMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Loopback Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLoopbackMode:  pointer to the "HCI Write Loopback Mode" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLoopbackMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLoopbackMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Loopback_Mode_Cmd   *pBapHCIWriteLoopbackMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteLoopbackMode */
+
+
+
+
+
diff --git a/CORE/BAP/src/bapApiExt.c b/CORE/BAP/src/bapApiExt.c
new file mode 100644
index 0000000..0a1bcab
--- /dev/null
+++ b/CORE/BAP/src/bapApiExt.c
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i E x t . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the external interfaces
+  required by the WLAN BAP module.  It is currently a temporary 
+  respository for API routines which should be furnished by CSR
+  or TL, but aren't yet implemented.
+  
+  The functions provide by this module are called by the rest of 
+  the BT-AMP PAL module.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiExt.c,v 1.1 2008/11/21 20:28:18 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-10-22    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+// I think this pulls in everything
+#include "bapApiExt.h"
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Utility Function implementations 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetCurrentChannel
+
+  DESCRIPTION 
+    Clear out all fields in the BAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    channel:     current configured channel number.
+    activeFlag:  flag indicating whether there is an active link.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to return channel is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetCurrentChannel
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t *channel, // return current channel here
+  v_U32_t *activeFlag   // return active flag here
+)
+{
+  //v_U32_t cb_enabled;
+  tHalHandle halHandle;
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if (( NULL == pBtampCtx ) || (NULL == channel) || (NULL == activeFlag))
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  halHandle =  VOS_GET_HAL_CB(pBtampCtx->pvosGCtx);
+
+  if(NULL == halHandle)
+  {
+     VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "halHandle is NULL in %s", __FUNCTION__);
+     return VOS_STATUS_E_FAULT;
+  }
+
+  if (ccmCfgGetInt(halHandle, WNI_CFG_CURRENT_CHANNEL, channel) 
+          != eHAL_STATUS_SUCCESS ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Get CFG failed in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  *activeFlag  = FALSE;  // return active flag here
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_GetCurrentChannel */
+
+
diff --git a/CORE/BAP/src/bapApiExt.h b/CORE/BAP/src/bapApiExt.h
new file mode 100644
index 0000000..df18071
--- /dev/null
+++ b/CORE/BAP/src/bapApiExt.h
@@ -0,0 +1,160 @@
+/*
+ * 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 WLAN_QCT_WLANBAP_API_EXT_H
+#define WLAN_QCT_WLANBAP_API_EXT_H
+
+/*===========================================================================
+
+               W L A N   B T - A M P  P A L   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external APIs used by the wlan BT-AMP PAL layer 
+  module.
+  
+      
+  Copyright (c) 2008 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiExt.h,v 1.1 2008/11/21 20:29:13 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $
+
+
+when        who    what, where, why
+--------    ---    ----------------------------------------------------------
+10/22/08    jez     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+// Pick up all the BT-AMP internal definitions 
+// And underlying supporting types. (Including VOSS, CSR, and...)
+#include "bapInternal.h" 
+
+/* Pick up the SIRIUS and HAL types */ 
+// Already taken care of, above 
+//#include "sirApi.h"
+//#include "halTypes.h"
+
+/* Pick up the CCM API def'n */ 
+#include "ccmApi.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+// Temporary 
+//#define BAP_DEBUG
+
+// How do I get BAP context from voss context? 
+//#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) 
+// How do I get halHandle from voss context? 
+//#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_HAL, ctx) 
+
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ *  Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  Utility Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetCurrentChannel
+
+  DESCRIPTION 
+    Clear out all fields in the BAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    channel:     current configured channel number.
+    activeFlag:  flag indicating whether there is an active link.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to return channel is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetCurrentChannel
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t *channel, // return current channel here
+  v_U32_t *activeFlag   // return active flag here
+);
+
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WLANBAP_API_EXT_H */
+
diff --git a/CORE/BAP/src/bapApiHCBB.c b/CORE/BAP/src/bapApiHCBB.c
new file mode 100644
index 0000000..8bc54ae
--- /dev/null
+++ b/CORE/BAP/src/bapApiHCBB.c
@@ -0,0 +1,1691 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i H C B B . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Host Controller and Baseband functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /prj/qct/asw/engbuilds/scl/users02/jzmuda/Android/ampBlueZ_6/CORE/BAP/src/bapApiHCBB.c,v 1.7 2011/05/06 00:59:27 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_trace.h"
+
+// Pick up the sme callback registration API
+#include "sme_Api.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+
+/* Host Controller and Baseband Commands */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReset()
+
+  DESCRIPTION 
+    Implements the actual HCI Reset command.
+    Produces an asynchronous command complete event. Through the 
+    command complete callback.  (I.E., (*tpWLAN_BAPEventCB).)
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReset
+( 
+  ptBtampHandle btampHandle
+)
+{
+    VOS_STATUS  vosStatus;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    tHalHandle     hHal = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate params */ 
+    if (btampHandle == NULL) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "btampHandle is NULL in %s", __FUNCTION__);
+
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Perform a "reset" */ 
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    //csrRoamDisconnect();
+    sme_RoamDisconnect(hHal,
+                       btampContext->sessionId,
+                       // Danlin, where are the richer reason codes?
+                       // I want to be able to convey everything 802.11 supports...
+                       eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+    /* Need to reset the timers as well*/
+    /* Connection Accept Timer interval*/
+    btampContext->bapConnectionAcceptTimerInterval = WLANBAP_CONNECTION_ACCEPT_TIMEOUT;  
+    /* Link Supervision Timer interval*/
+    btampContext->bapLinkSupervisionTimerInterval = WLANBAP_LINK_SUPERVISION_TIMEOUT;  
+    /* Logical Link Accept Timer interval*/
+    btampContext->bapLogicalLinkAcceptTimerInterval = WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT;  
+    /* Best Effort Flush timer interval*/
+    btampContext->bapBEFlushTimerInterval = WLANBAP_BE_FLUSH_TIMEOUT;  
+
+
+    /* Form and immediately return the command complete event... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    bapHCIEvent.u.btampCommandCompleteEvent.present = 1;
+    bapHCIEvent.u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_RESET_CMD;
+    bapHCIEvent.u.btampCommandCompleteEvent.cc_event.Reset.status 
+        = WLANBAP_STATUS_SUCCESS;
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         //btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+         btampContext->pAppHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_FALSE /* Flag to indicate assoc-specific event */ 
+        );
+
+    return vosStatus;
+} /* WLAN_BAPReset */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetEventMask()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Event Mask command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCISetEventMask:  pointer to the "HCI Set Event Mask" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCISetEventMask is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetEventMask
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Event_Mask_Cmd   *pBapHCISetEventMask,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPSetEventMask */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPFlush()
+
+  DESCRIPTION 
+    Implements the actual HCI Flush command
+    Produces an asynchronous command complete event. Through the 
+    event callback. And an asynchronous Flush occurred event. Also through the 
+    event callback.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlush:  pointer to the "HCI Flush" Structure.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlush is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPFlush
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Flush_Cmd     *pBapHCIFlush
+)
+{
+    VOS_STATUS  vosStatus;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Form and immediately return the command complete event... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    bapHCIEvent.u.btampCommandCompleteEvent.present = 1;
+    bapHCIEvent.u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_FLUSH_CMD;
+    bapHCIEvent.u.btampCommandCompleteEvent.cc_event.Flush.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         //btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+         btampContext->pAppHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_FALSE /* Flag to indicate assoc-specific event */ 
+        );
+
+    return vosStatus;
+} /* WLAN_BAPFlush */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_EnhancedBAPFlush()
+
+  DESCRIPTION 
+    Implements the actual HCI Enhanced Flush command
+    Produces an asynchronous command complete event. Through the command status 
+    event callback. And an asynchronous Enhanced Flush Complete event. 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlush:  pointer to the "HCI Enhanced Flush" Structure.
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlush is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_EnhancedBAPFlush
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Enhanced_Flush_Cmd     *pBapHCIFlush,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    ptBtampContext btampContext;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate params */ 
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = (ptBtampContext) btampHandle;
+    /* Form and return the command status event... */
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    bapHCIEvent.u.btampCommandStatusEvent.present = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.command_opcode
+        = BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD;
+    bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+
+    /* Form and immediately return the command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampEnhancedFlushCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampEnhancedFlushCompleteEvent.log_link_handle = 
+        pBapHCIFlush->log_link_handle;
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         //btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+         btampContext->pAppHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_FALSE /* Flag to indicate assoc-specific event */ 
+        );
+
+    return vosStatus;
+} /* WLAN_EnhancedBAPFlush */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadConnectionAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Connection Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadConnectionAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadConnectionAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete */
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Connection_Accept_TO.status
+        = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Connection_Accept_TO.connection_accept_timeout
+        = btampContext->bapConnectionAcceptTimerInterval;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadConnectionAcceptTimeout */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteConnectionAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Connection Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteConnectionAcceptTimeout:  pointer to the "HCI Connection Accept Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteConnectionAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteConnectionAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd   *pBapHCIWriteConnectionAcceptTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIWriteConnectionAcceptTimeout)
+        || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the allowed timeout interval range */
+    if ((pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout >
+         WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE) || 
+        (pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout <
+         WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Out of range for connection accept timeout parameters in %s",
+                   __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Connection_Accept_TO.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        /* Save the Physical link connection accept timeout value */
+        btampContext->bapConnectionAcceptTimerInterval = 
+            pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout;
+
+        /* Return status for command complete event */
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Connection_Accept_TO.status
+            = WLANBAP_STATUS_SUCCESS;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteConnectionAcceptTimeout */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLinkSupervisionTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Link Supervision Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLinkSupervisionTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLinkSupervisionTimeout
+( 
+  ptBtampHandle btampHandle,
+  /* Only 8 bits (phy_link_handle) of this log_link_handle are valid. */
+  tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pBapHCIReadLinkSupervisionTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U8_t         phyLinkHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIReadLinkSupervisionTimeout) ||
+        (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the phyiscal link handle extracted from
+       logical link handle (lower byte valid) */
+    phyLinkHandle = (v_U8_t) pBapHCIReadLinkSupervisionTimeout->log_link_handle;
+
+    if (phyLinkHandle != btampContext->phy_link_handle)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid Physical link handle in %s", __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.link_supervision_timeout
+            = 0x00; /* Invalid value */
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.log_link_handle
+            = pBapHCIReadLinkSupervisionTimeout->log_link_handle;
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.link_supervision_timeout
+            = btampContext->bapLinkSupervisionTimerInterval;
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.log_link_handle
+            = pBapHCIReadLinkSupervisionTimeout->log_link_handle;
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.status
+            = WLANBAP_STATUS_SUCCESS;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLinkSupervisionTimeout */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLinkSupervisionTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Link Supervision Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLinkSupervisionTimeout:  pointer to the "HCI Link Supervision Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLinkSupervisionTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLinkSupervisionTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd   *pBapHCIWriteLinkSupervisionTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U8_t         phyLinkHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIWriteLinkSupervisionTimeout) ||
+        (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the phyiscal link handle extracted from
+       logical link handle (lower byte valid) */
+    phyLinkHandle = (v_U8_t) pBapHCIWriteLinkSupervisionTimeout->log_link_handle;
+
+    if (phyLinkHandle != btampContext->phy_link_handle)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid Physical link handle in %s", __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.log_link_handle
+            = pBapHCIWriteLinkSupervisionTimeout->log_link_handle;
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        /* Save the LS timeout interval */
+        btampContext->bapLinkSupervisionTimerInterval =
+            pBapHCIWriteLinkSupervisionTimeout->link_supervision_timeout;
+
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.log_link_handle
+            = pBapHCIWriteLinkSupervisionTimeout->log_link_handle;
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.status
+            = WLANBAP_STATUS_SUCCESS;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteLinkSupervisionTimeout */
+
+/* v3.0 Host Controller and Baseband Commands */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLogicalLinkAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Logical Link Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLogicalLinkAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLogicalLinkAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Logical_Link_Accept_TO.status
+        = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout
+        = btampContext->bapLogicalLinkAcceptTimerInterval;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLogicalLinkAcceptTimeout */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLogicalLinkAcceptTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Logical Link Accept Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLogicalLinkAcceptTimeout:  pointer to the "HCI Logical Link Accept Timeout" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLogicalLinkAcceptTimeout is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLogicalLinkAcceptTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd   *pBapHCIWriteLogicalLinkAcceptTimeout,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIWriteLogicalLinkAcceptTimeout)
+        || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the allowed timeout interval range */
+    if ((pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout >
+         WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE) || 
+        (pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout <
+         WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Out of range for logical connection accept timeout parameters in %s",
+                   __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Logical_Link_Accept_TO.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        /* Save the Physical link connection accept timeout value */
+        btampContext->bapLogicalLinkAcceptTimerInterval = 
+            pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout;
+
+        /* Return status for command complete event */
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Logical_Link_Accept_TO.status
+            = WLANBAP_STATUS_SUCCESS;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteLogicalLinkAcceptTimeout */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetEventMaskPage2()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Event Mask Page 2 command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCISetEventMaskPage2:  pointer to the "HCI Set Event Mask Page 2" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCISetEventMaskPage2 is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetEventMaskPage2
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd   *pBapHCISetEventMaskPage2,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCISetEventMaskPage2)
+        || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+
+    /* Save away the event mask */
+    vos_mem_copy(  
+            btampContext->event_mask_page_2, 
+            pBapHCISetEventMaskPage2->event_mask_page_2, 
+            8 );
+
+    /* Return status for command complete event */
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Set_Event_Mask_Page_2.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPSetEventMaskPage2 */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocationData()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Location Data command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocationData is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocationData
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    ptBtampContext btampContext;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = (ptBtampContext) btampHandle;
+
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_domain_aware
+        = btampContext->btamp_Location_Data_Info.loc_domain_aware;
+
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_options
+        = btampContext->btamp_Location_Data_Info.loc_options;
+
+    vos_mem_copy(  
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_domain,
+            btampContext->btamp_Location_Data_Info.loc_domain, 
+            3 );
+
+    /* Return status for command complete event */
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLocationData */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteLocationData()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Location Data command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteLocationData:  pointer to the "HCI Write Location Data" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteLocationData is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteLocationData
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Location_Data_Cmd   *pBapHCIWriteLocationData,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIWriteLocationData)
+        || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = (ptBtampContext) btampHandle;
+
+    btampContext->btamp_Location_Data_Info.loc_domain_aware = 
+        pBapHCIWriteLocationData->loc_domain_aware;
+    
+    btampContext->btamp_Location_Data_Info.loc_options = 
+        pBapHCIWriteLocationData->loc_options;
+
+    vos_mem_copy(  
+            btampContext->btamp_Location_Data_Info.loc_domain, 
+            pBapHCIWriteLocationData->loc_domain, 
+            3 );
+
+    /* Return status for command complete event */
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Location_Data.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteLocationData */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadFlowControlMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Flow Control Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadFlowControlMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadFlowControlMode
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Flow_Control_Mode.status
+        = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Flow_Control_Mode.flow_control_mode
+        = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadFlowControlMode */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteFlowControlMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Flow Control Mode command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteFlowControlMode:  pointer to the "HCI Write Flow Control Mode" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteFlowControlMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteFlowControlMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Flow_Control_Mode_Cmd   *pBapHCIWriteFlowControlMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteFlowControlMode */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadBestEffortFlushTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Best Effort Flush Timeout command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadBEFlushTO is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadBestEffortFlushTimeout
+( 
+  ptBtampHandle btampHandle,
+  /* The log_link_hanlde identifies which logical link's BE TO*/
+  tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd   *pBapHCIReadBEFlushTO,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadBestEffortFlushTimeout */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteBestEffortFlushTimeout()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Best Effort Flush TO command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteBEFlushTO:  pointer to the "HCI Write BE Flush TO" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteBEFlushTO is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteBestEffortFlushTimeout
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd   *pBapHCIWriteBEFlushTO,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteBestEffortFlushTimeout */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetShortRangeMode()
+
+  DESCRIPTION 
+    Implements the actual HCI Set Short Range Mode command.  There is no need for 
+    a callback because when this call returns the action has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIShortRangeMode:  pointer to the "HCI Set Short Range Mode" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIShortRangeMode is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetShortRangeMode
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Set_Short_Range_Mode_Cmd   *pBapHCIShortRangeMode,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the BAP state to accept the Short Range Mode set request;
+       SRM set requests are allowed only in CONNECTED state */
+
+    /* Form and return the command status event... */
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
+        = BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD;
+
+    if (CONNECTED != instanceVar->stateVar)
+    {
+        /* Short Range Mode request in invalid state */
+        pBapHCIEvent->u.btampCommandStatusEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        return VOS_STATUS_SUCCESS;
+    }
+    else if (pBapHCIShortRangeMode->phy_link_handle != btampContext->phy_link_handle)
+    {
+       /* Invalid Physical link handle */
+        pBapHCIEvent->u.btampCommandStatusEvent.status =
+            WLANBAP_ERROR_NO_CNCT;
+        return VOS_STATUS_SUCCESS;
+    }
+    else if (pBapHCIShortRangeMode->short_range_mode > 0x01)
+    {
+        /* Invalid mode requested */
+        pBapHCIEvent->u.btampCommandStatusEvent.status =
+            WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        return VOS_STATUS_SUCCESS;
+    }
+
+    pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+
+    /* Send the Command Status event (success) here, since Change Complete is next */
+    (*btampContext->pBapHCIEventCB)
+        (
+         btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+         pBapHCIEvent, /* This now encodes ALL event types */
+         VOS_FALSE /* Flag to indicate assoc-specific event */
+        );
+
+    /* Format the Short Range Mode Complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.present = 1;
+
+    pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.status =
+        WLANBAP_STATUS_SUCCESS; /* Assumption for now */
+
+    /* The input parameters will go out in the CC Event */
+    pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.phy_link_handle =
+        pBapHCIShortRangeMode->phy_link_handle;
+
+    pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.short_range_mode =
+        pBapHCIShortRangeMode->short_range_mode; /* Assumption for now */
+
+    /* If the requested setting is different from the current setting... */
+    if (pBapHCIShortRangeMode->short_range_mode != btampContext->phy_link_srm)
+    {
+        /* ... then change the SRM according to the requested value.
+         * If the attempt fails, the assumptions above need to be corrected.
+         */
+        #if 0
+        // Suggested API, needs to be created
+        if (VOS_STATUS_SUCCESS != HALSetShortRangeMode(pBapHCIShortRangeMode->short_range_mode))
+        #else
+        if (0)
+        #endif
+        {
+            pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.status =
+                WLANBAP_ERROR_HARDWARE_FAILURE;
+            pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.short_range_mode =
+                btampContext->phy_link_srm; /* Switch back to current value */
+        }
+        else
+        {
+            /* Update the SRM setting for this physical link, since it worked */
+            btampContext->phy_link_srm = pBapHCIShortRangeMode->short_range_mode;
+        }
+    }
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPSetShortRangeMode */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPVendorSpecificCmd0()
+
+  DESCRIPTION
+    Implements the actual HCI Vendor Specific Command 0 (OGF 0x3f, OCF 0x0000).
+    There is no need for a callback because when this call returns the action has
+    been completed.
+
+    The command is received when:
+    - The A2MP Create Phy Link Response has been rx'd by the Bluetooth stack (initiator)
+
+  DEPENDENCIES
+    NA.
+
+  PARAMETERS
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event.
+                (The caller of this routine is responsible for sending
+                the Command Complete event up the HCI interface.)
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS
+
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPVendorSpecificCmd0
+(
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the BAP state to accept the Vendor Specific Cmd 0:
+       this is only allowed for the BT_INITIATOR in the CONNECTING state */
+
+    /* Form and return the command status event... */
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
+        = BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0;
+
+    if ( (BT_INITIATOR != btampContext->BAPDeviceRole) ||
+         (CONNECTING != instanceVar->stateVar) )
+    {
+        /* Vendor Specific Command 0 happened in invalid state */
+        pBapHCIEvent->u.btampCommandStatusEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        return VOS_STATUS_SUCCESS;
+    }
+
+    /* Signal BT Coexistence code in firmware to prefer WLAN */
+    WLANBAP_NeedBTCoexPriority(btampContext, 1);
+
+    pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+
+    /* Send the Command Status event (success) here, since Command Complete is next */
+    (*btampContext->pBapHCIEventCB)
+        (
+         btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+         pBapHCIEvent, /* This now encodes ALL event types */
+         VOS_FALSE /* Flag to indicate assoc-specific event */
+        );
+
+    /* Format the Vendor Specific Command 0 Complete event to return... */
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
+        = BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Vendor_Specific_Cmd_0.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPVendorSpecificCmd0 */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPVendorSpecificCmd1()
+
+  DESCRIPTION
+    Implements the actual HCI Vendor Specific Command 1 (OGF 0x3f, OCF 0x0001).
+    There is no need for a callback because when this call returns the action has
+    been completed.
+
+    The command is received when:
+    - HCI wants to enable testability
+
+  DEPENDENCIES
+    NA.
+
+  PARAMETERS
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event.
+                (The caller of this routine is responsible for sending
+                the Command Complete event up the HCI interface.)
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS
+
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPVendorSpecificCmd1
+(
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */
+    if ((NULL == btampHandle) || (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+
+    btampContext->btamp_async_logical_link_create = TRUE;
+
+
+    /* Format the Vendor Specific Command 1 Complete event to return... */
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
+        = BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Vendor_Specific_Cmd_1.status
+        = WLANBAP_STATUS_SUCCESS;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPVendorSpecificCmd1 */
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Callback registered with TL for BAP, this is required in order for
+    TL to inform BAP, that the flush operation requested has been completed. 
+    
+    The registered reception callback is being triggered by TL whenever a 
+    frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    ucStaId:        station identifier for the requested value
+    ucTid:          identifier of the tspec 
+    status:         status of the Flush operation
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_TLFlushCompCallback
+( 
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucStaId, 
+  v_U8_t        ucTID, 
+  v_U8_t        status
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} // WLANBAP_TLFlushCompCallback
+
+
+/* End of v3.0 Host Controller and Baseband Commands */
+
+
+ 
+
+
diff --git a/CORE/BAP/src/bapApiInfo.c b/CORE/BAP/src/bapApiInfo.c
new file mode 100644
index 0000000..4e43c84
--- /dev/null
+++ b/CORE/BAP/src/bapApiInfo.c
@@ -0,0 +1,605 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i I n f o . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Information functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /cygdrive/c/Dropbox/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_PAL/CORE/BAP/src/bapApiInfo.c,v 1.2 2008/11/10 22:55:24 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+#include "sme_Api.h"
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+
+/* Informational Parameters */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalVersionInfo()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local Version Info command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    // There are really no input parameters in this command.  
+    // Just the command opcode itself is sufficient.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalVersionInfo is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalVersionInfo
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.status 
+        = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_HCI_Version
+        = WLANBAP_HCI_VERSION;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_HCI_Revision
+        = WLANBAP_HCI_REVISION;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_PAL_Version
+        = WLANBAP_PAL_VERSION;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_Manufac_Name
+        = WLANBAP_QUALCOMM_COMPANY_ID;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version
+        = WLANBAP_PAL_SUBVERSION;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLocalVersionInfo */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalSupportedCmds()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local Supported Commands.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    // There are really no input parameters in this command.  
+    // Just the command opcode itself is sufficient.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalSupportedCmds is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalSupportedCmds
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    v_U8_t supportedCmds[] = WLANBAP_PAL_SUPPORTED_HCI_CMDS;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Supported_Cmds.status 
+        = WLANBAP_STATUS_SUCCESS;
+    /* Return the supported commands bitmask */ 
+    vos_mem_copy( 
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds,
+            supportedCmds,
+            sizeof( supportedCmds));    
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLocalSupportedCmds */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadBufferSize()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Buffer Size command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadBufferSize:  pointer to the "HCI Read Buffer Size" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadBufferSize is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadBufferSize
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.status 
+        = WLANBAP_STATUS_SUCCESS;
+    /* Return the supported Buffer sizes */ 
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length
+        = WLANBAP_MAX_80211_PAL_PDU_SIZE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_SCO_Packet_Length
+        = 0; /* Invalid assignment to Uint8, makes 0 */
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets
+        = 16;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets
+        = 0;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadBufferSize */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadDataBlockSize()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Data Block Size command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadDataBlockSize is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadDataBlockSize
+( 
+  ptBtampHandle btampHandle,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+   /* Validate params */ 
+   if ((btampHandle == NULL) || (NULL == pBapHCIEvent))
+   {
+     return VOS_STATUS_E_FAULT;
+   }
+
+
+   VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+
+   /* Format the command complete event to return... */ 
+   pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+   pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+   pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+   pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+       = BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD;
+   pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.status 
+       = WLANBAP_STATUS_SUCCESS;
+   /* Return the supported Block sizes */ 
+   pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Data_Block_Length
+       = WLANBAP_MAX_80211_PAL_PDU_SIZE;
+   pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length
+       = WLANBAP_MAX_80211_PAL_PDU_SIZE;
+   pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks
+       = 16;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadDataBlockSize */
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSetConfig()
+
+  DESCRIPTION 
+     The function updates some configuration for BAP module in SME during SMEs
+     close -> open sequence.
+   
+     BAP applies the new configuration at the next transaction.
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadRSSI:  pointer to the "HCI Read RSSI" structure.
+   
+    IN
+    pConfig: a pointer to a caller allocated object of typedef struct WLANBAP_ConfigType.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pConfig or btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPSetConfig
+( 
+  ptBtampHandle btampHandle,
+  WLANBAP_ConfigType *pConfig
+)
+{
+   ptBtampContext btampContext;
+   /* Validate params */ 
+   if ((NULL == btampHandle)|| (NULL == pConfig)) 
+   {
+     return VOS_STATUS_E_FAULT;
+   }
+   btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+
+   btampContext->config.ucPreferredChannel = pConfig->ucPreferredChannel;
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPGetMask()
+
+  DESCRIPTION 
+     The function gets the updated event mask from BAP core.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    
+   
+    IN
+    pEvent_mask_page_2: a pointer to a caller allocated object of 8 bytes.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pEvent_mask_page_2 or btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLAN_BAPGetMask( ptBtampHandle btampHandle, 
+                 v_U8_t       *pEvent_mask_page_2)
+{
+   ptBtampContext btampContext;
+   /* Validate params */ 
+   if ((NULL == btampHandle)|| (NULL == pEvent_mask_page_2)) 
+   {
+     return VOS_STATUS_E_FAULT;
+   }
+   btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+
+   vos_mem_copy( pEvent_mask_page_2, 
+                 btampContext->event_mask_page_2, 
+                 8 );
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPDisconnect()
+
+  DESCRIPTION 
+     The function to request to BAP core to disconnect currecnt AMP connection.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  btampHandle is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPDisconnect
+( 
+  ptBtampHandle btampHandle
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    v_U8_t status;    /* return the BT-AMP status here */
+    VOS_STATUS  vosStatus;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate params */ 
+    if (btampHandle == NULL) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL,
+                     "btampHandle is NULL in %s", __FUNCTION__);
+
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Fill in the event structure */ 
+    bapEvent.event = eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION;
+    bapEvent.params = NULL;
+
+
+    /* Handle event */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+
+        /* Fill in the event structure */ 
+    bapEvent.event =  eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
+    bapEvent.params = NULL;
+
+        /* Handle event */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPSessionOn()
+
+  DESCRIPTION 
+     The function to check from BAP core if AMP connection is up right now.
+   
+
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_TRUE:  AMP connection is on 
+    VOS_FALSE: AMP connection is not on
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+v_BOOL_t WLAN_BAPSessionOn
+( 
+  ptBtampHandle btampHandle
+)
+{
+   ptBtampContext btampContext = (ptBtampContext) btampHandle;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+   /* Validate params */ 
+   if (btampHandle == NULL) 
+   {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "btampHandle is NULL in %s", __FUNCTION__);
+
+       //?? shall we say true or false
+       return VOS_FALSE;
+   }
+
+   return btampContext->btamp_session_on;
+}
diff --git a/CORE/BAP/src/bapApiLinkCntl.c b/CORE/BAP/src/bapApiLinkCntl.c
new file mode 100644
index 0000000..e52a33d
--- /dev/null
+++ b/CORE/BAP/src/bapApiLinkCntl.c
@@ -0,0 +1,1938 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i L i n k C n t l . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Link Control functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapApiLinkCntl.c,v 1.1 2010/10/23 23:40:28 labuser Exp labuser $$DateTime$$Author: labuser $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+// Pick up the CSR callback definition
+#include "csrApi.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+#include "btampFsm.h"
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_RoamCallback()
+
+  DESCRIPTION 
+    Callback for Roam (connection status) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+      pContext:  is the pContext passed in with the roam request
+      pCsrRoamInfo: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
+      eRoamCmdResult: for detail valid members. It may be NULL
+      roamId: is to identify the callback related roam request. 0 means unsolicited
+      roamStatus: is a flag indicating the status of the callback
+      roamResult: is the result
+   
+  RETURN VALUE
+    The eHalStatus code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+#if 0
+eCSR_ROAM_RESULT_WDS_STARTED 
+#define eWLAN_BAP_MAC_START_BSS_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
+
+eCSR_ROAM_RESULT_FAILURE 
+eCSR_ROAM_RESULT_NOT_ASSOCIATED
+#define eWLAN_BAP_MAC_START_FAILS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+
+eCSR_ROAM_RESULT_WDS_ASSOCIATED
+#define eWLAN_BAP_MAC_CONNECT_COMPLETED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */
+
+
+eCSR_ROAM_RESULT_FAILURE 
+eCSR_ROAM_RESULT_NOT_ASSOCIATED 
+#define eWLAN_BAP_MAC_CONNECT_FAILED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+
+
+eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND
+#define eWLAN_BAP_MAC_CONNECT_INDICATION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */
+
+
+eCSR_ROAM_RESULT_KEY_SET 
+#define eWLAN_BAP_MAC_KEY_SET_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */
+
+
+eCSR_ROAM_RESULT_WDS_DISASSOC_IND
+#define eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOC_IND */
+
+
+eCSR_ROAM_RESULT_WDS_STOPPED
+#define eWLAN_BAP_MAC_READY_FOR_CONNECTIONS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */
+
+#endif //0
+
+
+eHalStatus
+WLANBAP_RoamCallback
+(
+  void *pContext, 
+  tCsrRoamInfo *pCsrRoamInfo,
+  tANI_U32 roamId, 
+  eRoamCmdStatus roamStatus, 
+  eCsrRoamResult roamResult
+)
+{
+    eHalStatus  halStatus = eHAL_STATUS_SUCCESS; 
+    /* btampContext value */    
+    ptBtampContext btampContext = (ptBtampContext) pContext; 
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS; 
+    v_U8_t status;    /* return the BT-AMP status here */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamStatus = %d", __FUNCTION__, roamStatus);
+
+    switch (roamStatus) {
+        //JEZ081110: For testing purposes, with Infra STA as BT STA, this 
+        //actually takes care of the "eCSR_ROAM_RESULT_WDS_STARTED" case, 
+        //below, better than "eCSR_ROAM_RESULT_IBSS_STARTED".  
+        //case eCSR_ROAM_ROAMING_START: 
+        case eCSR_ROAM_ASSOCIATION_START: 
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_ROAMING_START", roamResult);   
+            // This only gets called when CSR decides to roam on its own - due to lostlink. 
+#if 0
+            if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc))
+            {
+                memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId,
+                       sizeof(tSirMacAddr)); 
+                apple80211Interface->willRoam(&bssid);  // Return result isn't significant 
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: willRoam returns\n", __FUNCTION__);
+            }
+#endif //0
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+            break;
+
+        case eCSR_ROAM_SET_KEY_COMPLETE:
+            /* bapRoamCompleteCallback with eCSR_ROAM_SET_KEY_COMPLETE */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+
+        case eCSR_ROAM_DISASSOCIATED: 
+            /* bapRoamCompleteCallback with eCSR_ROAM_DISASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED", roamStatus);   
+        case eCSR_ROAM_LOSTLINK:
+            /* bapRoamCompleteCallback with eCSR_ROAM_LOSTLINK */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_LOSTLINK", roamStatus);   
+
+            if (roamResult != eCSR_ROAM_RESULT_NONE) {
+                /* Fill in the event structure */ 
+                bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; 
+                bapEvent.params = pCsrRoamInfo;
+                bapEvent.u1 = roamStatus;
+                bapEvent.u2 = roamResult; 
+                
+                /* Handle event */ 
+                vosStatus = btampFsm(btampContext, &bapEvent, &status);
+            }
+  
+            break;
+
+        default:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamStatus = %d", __FUNCTION__, roamStatus);
+
+            break;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamResult = %d", __FUNCTION__, roamResult);
+
+    switch (roamResult) {
+        //JEZ081110: Commented out for testing. Test relies upon IBSS. 
+        case eCSR_ROAM_RESULT_IBSS_STARTED:  
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_STARTED", roamResult);   
+        case eCSR_ROAM_RESULT_WDS_STARTED: 
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_STARTED", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+
+        //JEZ081110: Commented out for testing. Test relies upon IBSS. 
+        //JEZ081110: But I cannot rely upon IBSS for the initial testing. 
+        case eCSR_ROAM_RESULT_FAILURE: 
+        //case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
+        //case eCSR_ROAM_RESULT_IBSS_START_FAILED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE", roamResult);   
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+            break;
+#endif
+        case eCSR_ROAM_RESULT_WDS_START_FAILED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_START_FAILED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_START_FAILED", roamResult);   
+
+            /* Fill in the event structure */ 
+            /* I don't think I should signal a eCSR_ROAM_RESULT_FAILURE 
+             * as a eWLAN_BAP_MAC_START_FAILS
+             */ 
+            bapEvent.event = eWLAN_BAP_MAC_START_FAILS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+            break;
+
+        //JEZ081110: Commented out for testing. This handles both Infra STA and IBSS STA.
+        case eCSR_ROAM_RESULT_IBSS_CONNECT:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult);   
+        case eCSR_ROAM_RESULT_ASSOCIATED:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED", roamResult);   
+        case eCSR_ROAM_RESULT_WDS_ASSOCIATED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_ASSOCIATED", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_CONNECT_COMPLETED;
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+
+        //JEZ081110: Commented out for testing. Test relies upon IBSS. 
+        //JEZ081110: But I cannot rely upon IBSS for the initial testing. 
+        //case eCSR_ROAM_RESULT_FAILURE: 
+        case eCSR_ROAM_RESULT_IBSS_START_FAILED:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_START_FAILED", roamResult);   
+        case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED", roamResult);   
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+            break;
+#endif
+        case eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_CONNECT_FAILED; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+
+        //JEZ081110: I think I have to check for the bssType to
+        //differentiate between IBSS Start and IBSS Join success.  
+        //case eCSR_ROAM_RESULT_IBSS_CONNECT:
+            //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult);   
+
+        //JEZ081110: Commented out for testing. Test relies upon IBSS. 
+        // No longer commented out. 
+        case eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_CONNECT_INDICATION;
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            /* If BAP doesn't like the incoming association, signal SME/CSR */ 
+            if ( status != WLANBAP_STATUS_SUCCESS) 
+                halStatus = eHAL_STATUS_FAILURE;
+  
+            break;
+
+        //JEZ081110: Not supported in SME and CSR, yet. 
+#if 0
+        case eCSR_ROAM_RESULT_KEY_SET: 
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_KEY_SET", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+#endif //0
+
+        case eCSR_ROAM_RESULT_DISASSOC_IND:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND", roamResult);   
+        case eCSR_ROAM_RESULT_WDS_DISASSOCIATED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOCIATED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_DISASSOCIATED", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event =  eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            /* Fill in the event structure */ 
+            bapEvent.event =  eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+            break;
+
+        //JEZ081110: Commented out for testing. Test relies upon IBSS. 
+        case eCSR_ROAM_RESULT_IBSS_INACTIVE:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE", roamResult);   
+        case eCSR_ROAM_RESULT_WDS_STOPPED:
+            /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_STOPPED", roamResult);   
+
+            /* Fill in the event structure */ 
+            bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; 
+            bapEvent.params = pCsrRoamInfo;
+            bapEvent.u1 = roamStatus;
+            bapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+            break;
+
+        default:
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamResult = %d", __FUNCTION__, roamResult);
+
+            break;
+    }
+
+#if 0
+    switch (roamResult) {
+        case eCSR_ROAM_RESULT_IBSS_CONNECT:
+            // we have an IBSS connection...
+
+            // update our state
+            btampContext->mAssociatedStatus = WLANBAP_STATUS_SUCCESS;
+            btampContext->mAssociated = VOS_TRUE;
+            // update "assocBssid" with the BSSID of the IBSS
+            if (pCsrRoamInfo) 
+                memcpy(btampContext->assocBssid, pCsrRoamInfo->peerMacOrBssidForIBSS, 6);
+
+            // We must update the system role to match that of the
+            // lower layers in case the upper layers decided to try
+            // joining the network in infrastructure mode if the
+            // initial join in IBSS mode fails.  Andreas Wolf
+            // (awolf@apple.com) explains the behavior as follows:
+            // "If the client attempts to join an open network and it fails 
+            // on the first attempt, it reverts back to b-only mode. This
+            // workaround was specifically put in place to allow the client
+            // to associate to some third party b-only infrastructure APs.
+            // It did not take IBSS into account, it seems that the fallback
+            // always forces infrastructure." 
+
+            btampContext->systemRole = eSYSTEM_STA_IN_IBSS_ROLE;
+
+            if (mLinkStatus == 0)
+            {
+                // enable the flow of data
+                DBGLOG("%s: marking link as up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT");
+                mLinkStatus = 1;
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp);
+                outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE);
+                outputQueue->start();
+                // Let them know we are ready
+                ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE);
+            }
+            else
+            {
+                DBGLOG("%s: link is already up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT");
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_IBSS_INACTIVE:
+            // we have no more IBSS peers, so disable the flow of data
+            if (mLinkStatus != 0)
+            {
+                DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE");
+                mLinkStatus = (tANI_U8) 0;
+                // JEZ070627: Revisit ?
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+                outputQueue->stop();
+                outputQueue->setCapacity(0);
+
+                // update our state
+                btampContext->mAssociated = false;
+            }
+            else
+            {
+                DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE");
+            }
+
+            break;
+
+        case eCSR_ROAM_RESULT_ASSOCIATED:
+            btampContext->mAssociatedStatus = APPLE80211_STATUS_SUCCESS;
+            btampContext->mAssociated = true;
+
+            if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) {
+                ccpCsrToAppleScanResult(mPMacObject, pCsrRoamInfo->pBssDesc, &scanResult); 
+                
+                /* Save away the IEs used by the AP */
+                ccpCsrToAssocApiedata( mPMacObject, pCsrRoamInfo->pBssDesc, &(btampContext->apiedata));
+                
+                if (BssidChanged((tCsrBssid*) btampContext->assocBssid, (ether_addr*) scanResult.asr_bssid)) { 
+                    memcpy(btampContext->assocBssid, scanResult.asr_bssid, 6);
+                    ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_BSSID_CHANGED );
+                }
+            }
+
+            ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE);
+
+            if (mLinkStatus == 0)
+            {
+                mLinkStatus = (tANI_U8) 1;
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp);
+                DBGLOG("%s: marking link as up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED");
+                outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE);
+                outputQueue->start();
+            }
+            else
+            {
+                DBGLOG("%s: link is already up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED");
+            }
+            break;
+        case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
+            btampContext->mAssociatedStatus = APPLE80211_STATUS_UNAVAILABLE;
+            btampContext->mAssociated = false;
+
+            if (mLinkStatus != 0)
+            {
+                DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED");
+                mLinkStatus = (tANI_U8) 0;
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+            }
+            else
+            {
+                DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED");
+            }
+            break;
+           
+        case eCSR_ROAM_RESULT_FAILURE:
+            btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE;
+            btampContext->mAssociated = false;
+
+            if (mLinkStatus != 0)
+            {
+                DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE");
+                mLinkStatus = (tANI_U8) 0;
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+            }
+            else
+            {
+                DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE");
+            }
+            break;
+        
+        case eCSR_ROAM_RESULT_DISASSOC_IND:
+            {
+                btampContext->mAssociated = false;
+
+                if (mLinkStatus != 0)
+                {
+                    DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND");
+                    mLinkStatus = (tANI_U8) 0;
+                    ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+                }
+                else
+                {
+                    DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND");
+                }
+
+                //if (pCsrRoamInfo)  // For now, leave this commented out. Until CSR changes integrated.
+                {
+                    // Now set the reason and status codes.  
+                    // Actually, the "result code" field in the tSirSmeDisassocInd should be named reasonCode and NOT statusCode.  
+                    // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame.  
+                    // For now, we are going to have to (painfully) map the only "result code" type information we have 
+                    // available at ALL from LIM/CSR.  And that is the statusCode field of type tSirResultCodes         
+                    // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be 
+                    // of type tSirMacReasonCodes.         
+                    // Right now, we don't even have that.  So, I have to just make up some "reason code" that I will
+                    // pretend I found in the incoming DisAssoc Indication.        
+                    //btampContext->statusCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes         
+                    //btampContext->reasonCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes         
+                    btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes         
+                    btampContext->deAuthReasonCode = 0; // tANI_U16   // eSIR_SME_DEAUTH_FROM_PEER 
+                    // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16   // eSIR_SME_DISASSOC_FROM_PEER
+                    btampContext->disassocReasonCode = btampContext->reasonCode; // tSirMacReasonCodes 
+                    // Let's remember the peer who just disassoc'd us
+                    //memcpy(btampContext->peerMacAddr, pCsrRoamInfo->peerMacOrBssidForIBSS, 6);
+                } 
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_DEAUTH_IND:
+            {
+                btampContext->mAssociated = false;
+
+                if (mLinkStatus != 0)
+                {
+                    DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DEAUTH_IND");
+                    mLinkStatus = (tANI_U8) 0;
+                    ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+                }
+                else
+                {
+                    DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DEAUTH_IND");
+                }
+
+                //if (pCsrRoamInfo)  // For now, leave this commented out. Until CSR changes integrated.
+                {
+                    // Now set the reason and status codes.  
+                    // Actually, the "result code" field in the tSirSmeDeauthInd should be named reasonCode and NOT statusCode.  
+                    // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame.  
+                    // For now, we are going to have to (painfully) map the only "result code" type information we have 
+                    // available at ALL from LIM/CSR.  And that is the statusCode field of type tSirResultCodes         
+                    // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be 
+                    // of type tSirMacReasonCodes.         
+                    // Right now, we don't even have that.  So, I have to just make up some "reason code" that I will
+                    // pretend I found in the incoming DeAuth Indication.        
+                    //btampContext->statusCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes         
+                    //btampContext->reasonCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes         
+                    btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes         
+                    btampContext->disassocReasonCode = 0; // tANI_U16   // eSIR_SME_DISASSOC_FROM_PEER 
+                    // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16   // eSIR_SME_DEAUTH_FROM_PEER
+                    btampContext->deAuthReasonCode = btampContext->reasonCode; // tSirMacReasonCodes 
+                    // Let's remember the peer who just de-auth'd us
+                    //memcpy(btampContext->peerMacAddr, ((tpSirSmeDeauthInd) pCallbackInfo)->peerMacAddr, 6);                
+                } 
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_MIC_ERROR_UNICAST: 
+
+            //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus)  // Make sure
+            { 
+                if (btampContext->mTKIPCounterMeasures)
+                {
+                    ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_UCAST); 
+                    DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST"); 
+                } 
+                else 
+                { 
+                    DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST"); 
+                }
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_MIC_ERROR_GROUP: 
+
+            //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus)  // Make sure
+            { 
+                if (btampContext->mTKIPCounterMeasures)
+                { 
+                    ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_MCAST); 
+                    DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP"); 
+                } 
+                else 
+                { 
+                    DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP"); 
+                }
+            }
+            break;
+
+        default:
+            break;
+    }
+    switch (roamStatus) {
+        case eCSR_ROAM_ROAMING_START: 
+            DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ROAMING_START");
+            // This only gets called when CSR decides to roam on its own - due to lostlink. 
+            // Apple still needs to be told.
+            if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc))
+            {
+                memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId,
+                       sizeof(tSirMacAddr)); 
+                apple80211Interface->willRoam(&bssid);  // Return result isn't significant 
+                DBGLOG("%s: willRoam returns\n", __FUNCTION__);
+            }
+            break;
+
+        case eCSR_ROAM_SHOULD_ROAM:
+            if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) {
+                // pCallbackInfo points to the BSS desc. Convert to Apple Scan Result.
+                halStatus = ccpCsrToAppleScanResult( 
+                        mPMacObject, 
+                        pCsrRoamInfo->pBssDesc, 
+                        &scanResult); 
+                if ( halStatus != 0 ) 
+                    return eHAL_STATUS_FAILURE;
+                roamAccepted = apple80211Interface->shouldRoam(&scanResult);  // Return result is crucial
+                if (roamAccepted == true) { 
+                    // If the roam is acceptable, return SUCCESS 
+                    DBGLOG("%s: shouldRoam returns \"acceptable\"\n", __FUNCTION__);
+//#if 0
+                    // Actually, before returning, immediately signal willRoam
+                    // This is a workaround for a CSR bug.  Eventually, when 
+                    // eCSR_ROAM_ASSOCIATION_START gets called WITH callback param p1
+                    // pointing to a tBssDescription, this work-around can be removed.
+                    memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, sizeof(tSirMacAddr)); 
+                    apple80211Interface->willRoam(&bssid);  // Return result isn't significant 
+                    DBGLOG("%s: willRoam (called out of order) returns\n", __FUNCTION__);
+                    DBGLOG("    with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet));
+//#endif
+                    return eHAL_STATUS_SUCCESS;
+                } else { 
+                    // If the roam is NOT acceptable, return FAILURE
+                    DBGLOG("%s: shouldRoam returns \"NOT acceptable\"\n", __FUNCTION__);
+                    return eHAL_STATUS_FAILURE;
+                }
+            }
+            break;
+
+        case eCSR_ROAM_DISASSOCIATED:
+            //if (eCSR_ROAM_RESULT_FORCED == roamResult || eCSR_ROAM_RESULT_MIC_ERROR == roamResult)
+            {
+                btampContext->mAssociated = false;
+
+                if (mLinkStatus != 0)
+                {
+                    DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED");
+                    mLinkStatus = (tANI_U8) 0;
+                    ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+                }
+                else
+                {
+                    DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED");
+                }
+            }
+            break;
+
+        case eCSR_ROAM_LOSTLINK:
+            btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE;
+            btampContext->mAssociated = false;
+
+            if (mLinkStatus != 0)
+            {
+                DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_LOSTLINK");
+                mLinkStatus = (tANI_U8) 0;
+                ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
+            }
+            else
+            {
+                DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_LOSTLINK");
+            }
+            break;
+
+        case eCSR_ROAM_ASSOCIATION_START:
+            DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ASSOCIATION_START");
+#if 0
+            // This is the right place to call willRoam - for an "initial" association.
+            // But, unfortunately, when eCSR_ROAM_ASSOCIATION_START gets called, 
+            // it doesn't have a pointer to the tBssDescription in the roaming callback 
+            // routines parameter p1 (pCallbackInfo in SetWextState).   So, don't use this code, yet.
+            if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc) {
+                memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, 6); 
+                apple80211Interface->willRoam(&bssid);  // Return result isn't significant 
+                DBGLOG("%s: willRoam returns\n", __FUNCTION__);
+                DBGLOG("    with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet));
+            }
+#endif //0
+            break;
+
+        case eCSR_ROAM_ASSOCIATION_COMPLETION:
+            DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ASSOCIATION_COMPLETION");
+            break;
+
+        case eCSR_ROAM_MIC_ERROR_IND:   // Handled in eCSR_ROAM_RESULT_MIC_ERROR_UNICAST and GROUP, above
+        case eCSR_ROAM_CANCELLED:
+        case eCSR_ROAM_ROAMING_COMPLETION:
+        case eCSR_ROAM_SCAN_FOUND_NEW_BSS:
+        default:
+            break;
+    }
+#endif //0
+
+    return halStatus;
+}
+
+/*----------------------------------------------------------------------------
+    Host Controller Interface Procedural API
+ ---------------------------------------------------------------------------*/
+
+/** BT v3.0 Link Control commands */
+
+/*----------------------------------------------------------------------------
+    Each of the next eight command result in asynchronous events (e.g.,  
+    HCI_PHYSICAL_LINK_COMPLETE_EVENT, HCI_LOGICAL_LINK_COMPLETE_EVENT, etc...)
+    These are signalled thru the event callback. (I.E., (*tpWLAN_BAPEventCB).)
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkCreate()
+
+  DESCRIPTION 
+    Implements the actual HCI Create Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+                 WLANBAP_GetNewHndl has to be called before every call to 
+                 WLAN_BAPPhysicalLinkCreate. Since the context is per 
+                 physical link.
+    pBapHCIPhysLinkCreate:  pointer to the "HCI Create Physical Link" Structure.
+    pHddHdl:  The context passed in by the caller. (e.g., BSL specific context)
+
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkCreate is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkCreate 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Create_Physical_Link_Cmd   *pBapHCIPhysLinkCreate,
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+                            /* And I get phy_link_handle from the Command */
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus;
+    /* I am using btampContext, instead of pBapPhysLinkMachine */ 
+    //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+    v_U8_t status;    /* return the BT-AMP status here */
+    BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
+
+    /* Validate params */ 
+    if ((pBapHCIPhysLinkCreate == NULL) || (NULL == btampContext))
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %x, pBapHCIPhysLinkCreate is %x", 
+                 __FUNCTION__,  btampHandle, pBapHCIPhysLinkCreate); 
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    if(DISCONNECTED != instanceVar->stateVar)
+    {
+       /* Create/Accept Phy link request in invalid state */
+        status = WLANBAP_ERROR_MAX_NUM_CNCTS;
+
+    }
+    else
+    {
+        /* Fill in the event structure */ 
+        bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE;
+        bapEvent.params = pBapHCIPhysLinkCreate;
+        //bapEvent.callback = pBapHCIPhysLinkCreateCB;
+
+        /* Allocate a new state machine instance */ 
+        /* There will only ever be one of these (NB: Don't assume this.) */
+        /* So for now this returns a pointer to a static structure */ 
+        /* (With all state set to initial values) */
+        vosStatus = WLANBAP_CreateNewPhyLinkCtx ( 
+                btampHandle, 
+                pBapHCIPhysLinkCreate->phy_link_handle, /*  I get phy_link_handle from the Command */
+                pHddHdl,   /* BSL passes in its specific context */
+                &btampContext, /* Handle to return per assoc btampContext value in  */ 
+                BT_INITIATOR); /* BT_INITIATOR */ 
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  btampContext); 
+
+        /* Handle event */ 
+        vosStatus = btampFsm(btampContext, &bapEvent, &status);
+    }
+  
+        /* Format the command status event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.status = status;
+    pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.command_opcode 
+        = BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD;
+
+    /* ... */ 
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPPhysicalLinkCreate */ 
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkAccept()
+
+  DESCRIPTION 
+    Implements the actual HCI Accept Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIPhysLinkAccept:  pointer to the "HCI Accept Physical Link" Structure.
+    pHddHdl:  The context passed in by the caller. (e.g., BSL specific context)
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkAccept is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkAccept 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Accept_Physical_Link_Cmd   *pBapHCIPhysLinkAccept,
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+                            /* And I get phy_link_handle from the Command */
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus;
+    /* I am using btampContext, instead of pBapPhysLinkMachine */ 
+    //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+    v_U8_t status;    /* return the BT-AMP status here */
+    BTAMPFSM_INSTANCEDATA_T *instanceVar;
+
+    /* Validate params */ 
+    if ((pBapHCIPhysLinkAccept == NULL) || (NULL == btampContext))
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %x, pBapHCIPhysLinkAccept is %x", 
+                 __FUNCTION__,  btampHandle, pBapHCIPhysLinkAccept); 
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    instanceVar = &(btampContext->bapPhysLinkMachine);
+    if(DISCONNECTED != instanceVar->stateVar)
+    {
+       /* Create/Accept Phy link request in invalid state */
+        status = WLANBAP_ERROR_MAX_NUM_CNCTS;
+
+    }
+    else
+    {
+        /* Fill in the event structure */ 
+        bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT;
+        bapEvent.params = pBapHCIPhysLinkAccept;
+        //bapEvent.callback = pBapHCIPhysLinkAcceptCB;
+
+        /* Allocate a new state machine instance */ 
+        /* There will only ever be one of these (NB: Don't assume this.) */
+        /* So for now this returns a pointer to a static structure */ 
+        /* (With all state set to initial values) */
+        vosStatus = WLANBAP_CreateNewPhyLinkCtx ( 
+                btampHandle, 
+                pBapHCIPhysLinkAccept->phy_link_handle, /*  I get phy_link_handle from the Command */
+                pHddHdl,   /* BSL passes in its specific context */
+                &btampContext, /* Handle to return per assoc btampContext value in  */ 
+                BT_RESPONDER); /* BT_RESPONDER */ 
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  btampContext); 
+
+        /* Handle event */ 
+        vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+    }
+    /* Format the command status event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.status = status;
+    pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.command_opcode 
+        = BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD;
+
+    /* ... */ 
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPPhysicalLinkAccept */ 
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPPhysicalLinkDisconnect()
+
+  DESCRIPTION 
+    Implements the actual HCI Disconnect Physical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIPhysLinkDisconnect:  pointer to the "HCI Disconnect Physical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIPhysLinkDisconnect is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPPhysicalLinkDisconnect 
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Disconnect_Physical_Link_Cmd   *pBapHCIPhysLinkDisconnect,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus;
+    /* I am using btampContext, instead of pBapPhysLinkMachine */ 
+    //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+    v_U8_t status;    /* return the BT-AMP status here */
+
+    /* Validate params */ 
+    if (pBapHCIPhysLinkDisconnect == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate the Physical link handle */
+    if (pBapHCIPhysLinkDisconnect->phy_link_handle != btampContext->phy_link_handle) 
+    {
+        /* Format the command status event to return... */ 
+        pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+        pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+        pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+        pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+        pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
+            = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD;
+        return VOS_STATUS_SUCCESS;
+    }
+
+    /* Fill in the event structure */ 
+    bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT;
+    bapEvent.params = pBapHCIPhysLinkDisconnect;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  btampContext); 
+
+    /* Handle event */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+        /* Fill in the event structure */ 
+    bapEvent.event =  eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
+    bapEvent.params = pBapHCIPhysLinkDisconnect;
+
+        /* Handle event */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+
+    /* Format the command status event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.status = status;
+    pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
+        = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD;
+
+    /* ... */ 
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPPhysicalLinkDisconnect */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkCreate()
+
+  DESCRIPTION 
+    Implements the actual HCI Create Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkCreate:  pointer to the "HCI Create Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkCreate is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkCreate
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Create_Logical_Link_Cmd   *pBapHCILogLinkCreate,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    VOS_STATUS  vosStatus;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U16_t log_link_index = 0;
+    BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
+    VOS_STATUS  retval;
+    v_U16_t index_for_logLinkCtx = 0;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate params */ 
+    if (pBapHCILogLinkCreate == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate the BAP state to accept the logical link request
+       Logical Link create/accept requests are allowed only in
+       CONNECTED state */
+    /* Form and immediately return the command status event... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    bapHCIEvent.u.btampCommandStatusEvent.present = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.command_opcode 
+        = BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD;
+
+    retval = VOS_STATUS_E_FAILURE;
+    if(DISCONNECTED == instanceVar->stateVar)
+    {
+       /* Create Logical link request in invalid state */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+
+    }
+    else if (CONNECTED != instanceVar->stateVar)
+    {
+        /* Create Logical link request in invalid state */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED;
+    }
+    else if (pBapHCILogLinkCreate->phy_link_handle != btampContext->phy_link_handle)
+    {
+       /* Invalid Physical link handle */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress;
+
+        if( TRUE == btampContext->btamp_logical_link_cancel_pending )
+        {
+            pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                WLANBAP_ERROR_NO_CNCT;
+            bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+            btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+            btampContext->btamp_logical_link_cancel_pending = FALSE;
+        }
+        else
+        {
+            /* If btamp_async_logical_link_create is set, we will seralize the req
+               on MC thread & handle it there after; If the above flag is not set
+               respond to HCI the sync way as before */
+            if(FALSE == btampContext->btamp_async_logical_link_create)
+            {
+                 /* Allocate a logical link index for these flow specs */
+                 vosStatus = WLANBAP_CreateNewLogLinkCtx( 
+                   btampContext, /* per assoc btampContext value */ 
+                   pBapHCILogLinkCreate->phy_link_handle, /*  I get phy_link_handle from the Command */
+                   pBapHCILogLinkCreate->tx_flow_spec, /*  I get tx_flow_spec from the Command */
+                   pBapHCILogLinkCreate->rx_flow_spec, /*  I get rx_flow_spec from the Command */
+                   &log_link_index /*  Return the logical link index here */
+                   );
+                 if (VOS_STATUS_SUCCESS != vosStatus)
+                 {
+                     /* Invalid flow spec format */
+                     pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                        WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                     bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                     btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+                 }
+                 else
+                 {
+                      retval = VOS_STATUS_SUCCESS;
+                      bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+
+                      pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
+                      btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
+                 }
+            }
+            else
+            {
+                btampContext->btamp_logical_link_req_info.phyLinkHandle = 
+                    pBapHCILogLinkCreate->phy_link_handle;
+                vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec,
+                             pBapHCILogLinkCreate->tx_flow_spec, 18);
+                vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec,
+                             pBapHCILogLinkCreate->rx_flow_spec, 18);
+                btampContext->btamp_async_logical_link_create = FALSE;
+                vosStatus = btampEstablishLogLink(btampContext);
+                if(VOS_STATUS_SUCCESS == vosStatus)
+                {
+                    retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI
+                }
+                else
+                {
+                    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                        WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+                }
+    
+            }
+        }
+    }
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+                (  
+                 btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+                 &bapHCIEvent, /* This now encodes ALL event types */
+                 VOS_TRUE /* Flag to indicate assoc-specific event */ 
+                );
+
+    index_for_logLinkCtx = log_link_index >> 8;
+    /* Format the Logical Link Complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1;
+
+    /*  Return the logical link index here */
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle 
+        = log_link_index;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle 
+        = pBapHCILogLinkCreate->phy_link_handle;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id
+        = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
+
+    /* ... */ 
+
+    return retval;
+} /* WLAN_BAPLogicalLinkCreate */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkAccept()
+
+  DESCRIPTION 
+    Implements the actual HCI Accept Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkAccept:  pointer to the "HCI Accept Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkAccept is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkAccept
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Accept_Logical_Link_Cmd   *pBapHCILogLinkAccept,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    VOS_STATUS  vosStatus;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U16_t log_link_index = 0;
+    BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
+    VOS_STATUS  retval;
+    v_U16_t index_for_logLinkCtx;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate params */ 
+    if (pBapHCILogLinkAccept == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Validate the BAP state to accept the logical link request
+       Logical Link create/accept requests are allowed only in
+       CONNECTED state */
+    /* Form and immediately return the command status event... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    bapHCIEvent.u.btampCommandStatusEvent.present = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.command_opcode 
+        = BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD;
+
+    retval = VOS_STATUS_E_FAILURE;
+    if(DISCONNECTED == instanceVar->stateVar)
+    {
+       /* Create Logical link request in invalid state */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+
+    }
+    else if (CONNECTED != instanceVar->stateVar)
+    {
+        /* Create Logical link request in invalid state */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_CMND_DISALLOWED;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED;
+    }
+    else if (pBapHCILogLinkAccept->phy_link_handle != btampContext->phy_link_handle)
+    {
+       /* Invalid Physical link handle */
+        pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress;
+        if( TRUE == btampContext->btamp_logical_link_cancel_pending )
+        {
+            pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                WLANBAP_ERROR_NO_CNCT;
+            bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+            btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+            btampContext->btamp_logical_link_cancel_pending = FALSE;
+        }
+        else
+        {
+            /* If btamp_async_logical_link_create is set, we will seralize the req
+               on MC thread & handle it there after; If the above flag is not set
+               respond to HCI the sync way as before */
+            if(FALSE == btampContext->btamp_async_logical_link_create)
+            {
+                /* Allocate a logical link index for these flow specs */
+                vosStatus = WLANBAP_CreateNewLogLinkCtx( 
+                        btampContext, /* per assoc btampContext value */ 
+                        pBapHCILogLinkAccept->phy_link_handle, /*  I get phy_link_handle from the Command */
+                        pBapHCILogLinkAccept->tx_flow_spec, /*  I get tx_flow_spec from the Command */
+                        pBapHCILogLinkAccept->rx_flow_spec, /*  I get rx_flow_spec from the Command */
+                        &log_link_index /*  Return the logical link index here */
+                        );
+                if (VOS_STATUS_SUCCESS != vosStatus)
+                {
+                    /* Invalid flow spec format */
+                    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                        WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+                }
+                else
+                {
+                    retval = VOS_STATUS_SUCCESS;
+                    bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+
+                    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
+                    btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
+                }
+            }
+            else
+            {
+                btampContext->btamp_logical_link_req_info.phyLinkHandle = 
+                    pBapHCILogLinkAccept->phy_link_handle;
+                vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec,
+                             pBapHCILogLinkAccept->tx_flow_spec, 18);
+                vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec,
+                             pBapHCILogLinkAccept->rx_flow_spec, 18);
+                btampContext->btamp_async_logical_link_create = FALSE;
+                vosStatus = btampEstablishLogLink(btampContext);
+                if(VOS_STATUS_SUCCESS == vosStatus)
+                {
+                    retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI
+                }
+                else
+                {
+                    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
+                        WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+                    btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+                }
+    
+            }
+        }
+    }
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+            (  
+             btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+             &bapHCIEvent, /* This now encodes ALL event types */
+             VOS_TRUE /* Flag to indicate assoc-specific event */ 
+             );
+
+    index_for_logLinkCtx = log_link_index >> 8;
+
+    /* Format the Logical Link Complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1;
+    /*  Return the logical link index here */
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle 
+        = log_link_index;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle 
+        = pBapHCILogLinkAccept->phy_link_handle;
+    pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id
+        = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
+
+    /* ... */ 
+
+    return retval;
+} /* WLAN_BAPLogicalLinkAccept */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkDisconnect()
+
+  DESCRIPTION 
+    Implements the actual HCI Disconnect Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkDisconnect:  pointer to the "HCI Disconnect Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkDisconnect is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkDisconnect
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Disconnect_Logical_Link_Cmd   *pBapHCILogLinkDisconnect,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tBtampHCI_Event     bapHCIEvent; /* This now encodes ALL event types */
+    ptBtampContext      btampContext = (ptBtampContext) btampHandle;
+    tpBtampLogLinkCtx   pLogLinkContext;
+    VOS_STATUS          retval = VOS_STATUS_SUCCESS;
+    v_U8_t              log_link_index;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+    Sanity check
+    ------------------------------------------------------------------------*/
+    if (( NULL == pBapHCILogLinkDisconnect ) ||
+        ( NULL == btampContext))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                   "Critical error: Invalid input parameter on %s", 
+                   __FUNCTION__); 
+        return VOS_STATUS_E_FAULT; 
+    }
+
+    /* Derive logical link index from handle */
+    log_link_index = ((pBapHCILogLinkDisconnect->log_link_handle) >> 8);
+
+    if( log_link_index > WLANBAP_MAX_LOG_LINKS )
+    {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                  "Critical error: Invalid input parameter on %s", 
+                  __FUNCTION__); 
+        /* Fill in the event code to propagate the event notification to BRM
+           BRM generates the Command status Event based on this.*/
+        pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT;
+        pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1;
+        pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        return VOS_STATUS_E_INVAL; 
+
+    }
+
+#ifdef BAP_DEBUG
+  /* Trace the tBtampCtx being passed in. */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN BAP Context Monitor: btampContext value = %x in %s:%d", btampContext, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+    bapHCIEvent.u.btampCommandStatusEvent.present = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+    bapHCIEvent.u.btampCommandStatusEvent.command_opcode 
+        = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD;
+
+   /*------------------------------------------------------------------------
+    FIXME: Validate the Logical Link handle, Generation and freeing...
+    Here the Logical link is not validated and assumed that it is correct to. 
+    get the Logical link context.                                                                        . 
+    ------------------------------------------------------------------------*/
+    pLogLinkContext = 
+    &(btampContext->btampLogLinkCtx[log_link_index]);
+    
+    // Validate whether the context is active.
+    if ((VOS_FALSE == pLogLinkContext->present) ||
+        (pBapHCILogLinkDisconnect->log_link_handle != pLogLinkContext->log_link_handle))
+    {
+        /* If status is failed, the platform specific layer generates the
+           command status event with proper status */
+        pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status =
+            WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+        retval = VOS_STATUS_E_FAILURE;
+#ifdef BAP_DEBUG
+        /* Log the error. */
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "%s:%d Invalid Logical Link handle(should be) = %d(%d)", __FUNCTION__, __LINE__,  
+                pBapHCILogLinkDisconnect->log_link_handle, pLogLinkContext->log_link_handle);
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " Logical Link index = %d", log_link_index);
+#endif //BAP_DEBUG
+    }
+    else
+    {
+        /* Form and return the command status event... */ 
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+        pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status 
+            = WLANBAP_STATUS_SUCCESS;
+    
+
+        pLogLinkContext->present         = VOS_FALSE; 
+        pLogLinkContext->uTxPktCompleted = 0;
+        pLogLinkContext->log_link_handle = 0;
+        /* Decrement the total logical link count */
+        btampContext->total_log_link_index--;
+        btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+    }
+    
+    /* Notify the Command status Event */
+    (*btampContext->pBapHCIEventCB) 
+        (  
+            btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+            &bapHCIEvent, /* This now encodes ALL event types */
+            VOS_TRUE /* Flag to indicate assoc-specific event */ 
+        );
+
+    /* Format the Logical Link Complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1;
+    /*  Return the logical link index here */
+    pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.log_link_handle 
+        = pBapHCILogLinkDisconnect->log_link_handle;
+    pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.reason 
+        = WLANBAP_ERROR_TERM_BY_LOCAL_HOST;
+
+    return retval;
+} /* WLAN_BAPLogicalLinkDisconnect */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPLogicalLinkCancel()
+
+  DESCRIPTION 
+    Implements the actual HCI Cancel Logical Link command
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCILogLinkCancel:  pointer to the "HCI Cancel Logical Link" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+                (BTW, the required "HCI Logical Link Complete Event" 
+                will be generated by the BAP state machine and sent up 
+                via the (*tpWLAN_BAPEventCB).)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCILogLinkCancel is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPLogicalLinkCancel
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Logical_Link_Cancel_Cmd   *pBapHCILogLinkCancel,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+   ptBtampContext btampContext;
+   BTAMPFSM_INSTANCEDATA_T *instanceVar;
+    /* Validate params */ 
+    if ((btampHandle == NULL) || (pBapHCILogLinkCancel == NULL) || 
+        (pBapHCIEvent == NULL))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: Null Parameters Not allowed", __FUNCTION__); 
+        return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = (ptBtampContext) btampHandle;
+    instanceVar = &(btampContext->bapPhysLinkMachine);
+
+    /* Form and immediately return the command status event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode =
+        BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+
+    if (pBapHCILogLinkCancel->phy_link_handle != btampContext->phy_link_handle) 
+    {
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
+            WLANBAP_ERROR_NO_CNCT;
+    }
+    else
+    {
+        /* As the logical link create is returned immediately, the logical link is
+           created and so cancel can not return success.
+           And it returns WLANBAP_ERROR_NO_CNCT if not connected or
+           WLANBAP_ERROR_MAX_NUM_ACL_CNCTS if connected */
+        if(WLAN_BAPLogLinkClosed == btampContext->btamp_logical_link_state )
+        {
+           /* Cancel Logical link request in invalid state */
+           pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
+               WLANBAP_ERROR_NO_CNCT;
+        }
+        else if(WLAN_BAPLogLinkOpen == btampContext->btamp_logical_link_state )
+        {
+           /* Cancel Logical link request in conected state */
+           pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
+               WLANBAP_ERROR_MAX_NUM_ACL_CNCTS;       
+        }
+        else if(WLAN_BAPLogLinkInProgress == btampContext->btamp_logical_link_state )
+        {
+           /* Cancel Logical link request in progress state, need to fail logical link
+            creation as well */
+            btampContext->btamp_logical_link_cancel_pending = TRUE;
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
+                WLANBAP_STATUS_SUCCESS;       
+        }
+        else
+        {
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
+                WLANBAP_ERROR_NO_CNCT;
+        }
+    }
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.phy_link_handle =
+        pBapHCILogLinkCancel->phy_link_handle;
+    /* Since the status is not success, the Tx flow spec Id is not meaningful and
+       filling with 0 */
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.tx_flow_spec_id = 
+        pBapHCILogLinkCancel->tx_flow_spec_id;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPLogicalLinkCancel */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPFlowSpecModify()
+
+  DESCRIPTION 
+    Implements the actual HCI Modify Logical Link command
+    Produces an asynchronous flow spec modify complete event. Through the 
+    event callback.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIFlowSpecModify:  pointer to the "HCI Flow Spec Modify" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command status event. 
+                (The caller of this routine is responsible for sending 
+                the Command Status event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIFlowSpecModify is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPFlowSpecModify
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Flow_Spec_Modify_Cmd   *pBapHCIFlowSpecModify,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+   v_U16_t                  index_for_logLinkHandle = 0;
+   ptBtampContext           btampContext;
+   tpBtampLogLinkCtx        pLogLinkContext;
+   v_U32_t                  retval;
+   VOS_STATUS               vosStatus = VOS_STATUS_SUCCESS;
+   tBtampHCI_Event          bapHCIEvent; /* This now encodes ALL event types */
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+   /* Validate params */ 
+   if ((btampHandle == NULL) || (pBapHCIFlowSpecModify == NULL) || 
+       (pBapHCIEvent == NULL))
+   {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+           "%s: Null Parameters Not allowed", __FUNCTION__); 
+       return VOS_STATUS_E_FAULT;
+   }
+
+   btampContext = (ptBtampContext) btampHandle;
+
+   index_for_logLinkHandle = pBapHCIFlowSpecModify->log_link_handle >> 8; /*  Return the logical link index here */
+   VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+              " %s:index_for_logLinkHandle=%d", __FUNCTION__,index_for_logLinkHandle);
+
+   bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+   bapHCIEvent.u.btampCommandStatusEvent.present = 1;
+   bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+   bapHCIEvent.u.btampCommandStatusEvent.command_opcode 
+       = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD;
+
+   /*------------------------------------------------------------------------
+     Evaluate the Tx and Rx Flow specification for this logical link.
+   ------------------------------------------------------------------------*/
+   // Currently we only support flow specs with service types of BE (0x01) 
+
+   /*------------------------------------------------------------------------
+     Now configure the Logical Link context.
+   ------------------------------------------------------------------------*/
+   pLogLinkContext = &(btampContext->btampLogLinkCtx[index_for_logLinkHandle]);
+
+   /* Extract Tx flow spec into the context structure */
+   retval = btampUnpackTlvFlow_Spec((void *)btampContext, pBapHCIFlowSpecModify->tx_flow_spec,
+                                    WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN,
+                                    &pLogLinkContext->btampFlowSpec);
+   if (retval != BTAMP_PARSE_SUCCESS)
+   {
+     /* Flow spec parsing failed, return failure */
+     vosStatus = VOS_STATUS_E_FAILURE;
+     pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status =
+         WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+     bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+   }
+   else
+   {
+      bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
+      pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status 
+          = WLANBAP_STATUS_SUCCESS;
+
+   }
+           /* Notify the Command status Event */
+   vosStatus =   
+      (*btampContext->pBapHCIEventCB) 
+          (  
+           btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+           &bapHCIEvent, /* This now encodes ALL event types */
+           VOS_TRUE /* Flag to indicate assoc-specific event */ 
+          );
+
+   /* Form and immediately return the command status event... */ 
+   pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT;
+   pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.present = 1;
+   pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.log_link_handle = 
+      pBapHCIFlowSpecModify->log_link_handle;
+
+   return vosStatus;
+} /* WLAN_BAPFlowSpecModify */
+
+
+void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext)
+{
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    v_U16_t         log_link_index = 0;
+    v_U16_t         index_for_logLinkCtx = 0;
+    VOS_STATUS      vosStatus = VOS_STATUS_SUCCESS;
+
+    if (btampContext == NULL) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: Null Parameters Not allowed", __FUNCTION__); 
+        return;
+    }
+
+    if( TRUE == btampContext->btamp_logical_link_cancel_pending )
+    {
+        bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
+        btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+        btampContext->btamp_logical_link_cancel_pending = FALSE;
+    }
+    else
+    {
+        /* Allocate a logical link index for these flow specs */
+        vosStatus = WLANBAP_CreateNewLogLinkCtx( 
+            btampContext, /* per assoc btampContext value */ 
+            btampContext->btamp_logical_link_req_info.phyLinkHandle, /*  I get phy_link_handle from the Command */
+            btampContext->btamp_logical_link_req_info.txFlowSpec, /*  I get tx_flow_spec from the Command */
+            btampContext->btamp_logical_link_req_info.rxFlowSpec, /*  I get rx_flow_spec from the Command */
+            &log_link_index /*  Return the logical link index here */
+            );
+        if (VOS_STATUS_SUCCESS != vosStatus)
+        {
+            /* Invalid flow spec format */
+            bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+            btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
+        }
+        else
+        {
+            bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
+            btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
+        }
+    }
+    
+    index_for_logLinkCtx = log_link_index >> 8;
+    /* Format the Logical Link Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
+    bapHCIEvent.u.btampLogicalLinkCompleteEvent.present = 1;
+
+    /*  Return the logical link index here */
+    bapHCIEvent.u.btampLogicalLinkCompleteEvent.log_link_handle 
+        = log_link_index;
+    bapHCIEvent.u.btampLogicalLinkCompleteEvent.phy_link_handle 
+        = btampContext->btamp_logical_link_req_info.phyLinkHandle;
+    bapHCIEvent.u.btampLogicalLinkCompleteEvent.flow_spec_id
+        = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+    (  
+     btampContext->pHddHdl,   /* this refers to the BSL per connection context */
+     &bapHCIEvent, /* This now encodes ALL event types */
+     VOS_TRUE /* Flag to indicate assoc-specific event */ 
+     );
+    return;
+}
+
+
+
diff --git a/CORE/BAP/src/bapApiLinkSupervision.c b/CORE/BAP/src/bapApiLinkSupervision.c
new file mode 100644
index 0000000..e446e12
--- /dev/null
+++ b/CORE/BAP/src/bapApiLinkSupervision.c
@@ -0,0 +1,633 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i LinkSupervision . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  "platform independent" Data path functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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.
+
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-03-25    arulv     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+//I need the TL types and API
+#include "wlan_qct_tl.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h"
+#include "bapApiTimer.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+#if 1
+//*BT-AMP packet LLC OUI value*/
+static const v_U8_t WLANBAP_BT_AMP_OUI[] =  {0x00, 0x19, 0x58 };
+
+/*LLC header value*/
+static v_U8_t WLANBAP_LLC_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
+#endif
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+VOS_STATUS
+WLANBAP_AcquireLSPacket( ptBtampContext pBtampCtx, vos_pkt_t **ppPacket, v_U16_t size, tANI_BOOLEAN isLsReq )
+{
+    VOS_STATUS vosStatus;
+    vos_pkt_t *pPacket;
+    WLANBAP_8023HeaderType   w8023Header;
+    v_U8_t                   aucLLCHeader[WLANBAP_LLC_HEADER_LEN];
+    v_U16_t                  headerLength;  /* The 802.3 frame length*/
+    v_U16_t                  protoType;
+    v_U8_t                   *pData = NULL;
+     
+
+    if(isLsReq)
+    {
+        protoType = WLANTL_BT_AMP_TYPE_LS_REQ;
+    }
+    else
+    {
+        protoType = WLANTL_BT_AMP_TYPE_LS_REP;
+    }    
+
+    //If success, vosTxLsPacket is the packet and pData points to the head.
+   vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT,size, 1, 
+                                    VOS_TRUE, NULL, NULL );
+   if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+       vosStatus = vos_pkt_reserve_head( pPacket, (v_VOID_t *)&pData, size );
+       if( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+       {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: failed to reserve size = %d\n",__FUNCTION__, size );
+                 vos_pkt_return_packet( pPacket );
+       }
+   }
+
+   if( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLANBAP_LinkSupervisionTimerHandler failed to get vos_pkt\n" );
+       return vosStatus;
+   }
+
+         // Form the 802.3 header
+   vos_mem_copy( w8023Header.vDA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE);
+   vos_mem_copy( w8023Header.vSA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE);
+
+   headerLength = WLANBAP_LLC_HEADER_LEN;
+        /* Now the 802.3 length field is big-endian?! */
+   w8023Header.usLenType = vos_cpu_to_be16(headerLength); 
+        
+   /* Now adjust the protocol type bytes*/
+   protoType = vos_cpu_to_be16( protoType);
+         /* Now form the LLC header */
+   vos_mem_copy(aucLLCHeader, 
+            WLANBAP_LLC_HEADER,  
+            sizeof(WLANBAP_LLC_HEADER));
+   vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], 
+            WLANBAP_BT_AMP_OUI,  
+            WLANBAP_LLC_OUI_SIZE);
+   vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], 
+            &protoType,  //WLANBAP_BT_AMP_TYPE_LS_REQ
+            WLANBAP_LLC_PROTO_TYPE_SIZE);
+ 
+        /* Push on the LLC header */
+   vos_pkt_push_head(pPacket, 
+            aucLLCHeader, 
+            WLANBAP_LLC_HEADER_LEN);  
+
+        /* Push on the 802.3 header */
+   vos_pkt_push_head(pPacket, &w8023Header, sizeof(w8023Header));
+   *ppPacket = pPacket;
+   return vosStatus;
+}
+
+
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_InitLinkSupervision
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision module is to be initialized when connected at BAP
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+#define TX_LS_DATALEN   32
+
+VOS_STATUS
+WLANBAP_InitLinkSupervision
+( 
+  ptBtampHandle     btampHandle
+)
+{
+    VOS_STATUS               vosStatus = VOS_STATUS_SUCCESS;
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle;
+    vos_pkt_t                *pLSReqPacket; 
+    vos_pkt_t                *pLSRepPacket; 
+    v_U16_t                   lsPktln; 
+
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+#if 0    
+    /* Initialize Link supervision data structure */
+    vos_mem_set(pLsInfo, sizeof(tBtampLS),0);
+
+    /* Allocate memory for Static Tx Data */
+    pLsInfo->pTxPktData = vos_mem_malloc(sizeof(tBtampLsPktData)+TX_LS_DATALEN);
+
+    /* Initialize Static data for LS pkt Tx */
+    pLsInfo->pTxPktData->BufLen = TX_LS_DATALEN;
+    vos_mem_copy (&pLsInfo->pTxPktData->pBuf, LsTxData, pLsInfo->pTxPktData->BufLen);
+#endif
+    pBtampCtx->lsReqPktPending = VOS_FALSE;
+    pBtampCtx->retries = 0;
+
+    vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSReqPacket,32, TRUE );
+    if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+        pBtampCtx->lsReqPacket = pLSReqPacket;
+    }
+    else
+    {
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                       "%s:AcquireLSPacket failed\n",__FUNCTION__);
+         pBtampCtx->lsReqPacket = NULL;
+         return vosStatus;   
+    }
+
+    vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSRepPacket,32,FALSE );
+    if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+        pBtampCtx->lsRepPacket = pLSRepPacket;
+    }
+    else
+    {
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                       "%s:AcquireLSPacket failed\n",__FUNCTION__);
+         pBtampCtx->lsRepPacket = NULL;
+         return vosStatus;   
+    }        
+
+    vosStatus = vos_pkt_get_packet_length(pBtampCtx->lsRepPacket,&lsPktln); 
+
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                       "%s:vos_pkt_get_length error",__FUNCTION__);
+         return VOS_STATUS_E_FAULT;
+    }
+    pBtampCtx->lsPktln = lsPktln;
+
+    /* Start Link Supervision Timer if not configured for infinite */
+    if (pBtampCtx->bapLinkSupervisionTimerInterval)
+    {
+        vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx,
+                   pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME);
+    }
+    else
+    {
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                       "%s:No LS configured for infinite",__FUNCTION__);
+    }
+   
+    return vosStatus;
+}
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_DeInitLinkSupervision
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision module is to be stopped after disconnected at BAP 
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_DeInitLinkSupervision
+( 
+  ptBtampHandle     btampHandle 
+)
+{
+    VOS_STATUS               vosStatus = VOS_STATUS_SUCCESS;
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle;
+
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+   VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "In: %s", __FUNCTION__);
+
+   vosStatus = WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+
+   
+    /*Free the vos packet*/
+    if ( pBtampCtx->lsRepPacket )
+    {
+      vosStatus = vos_pkt_return_packet(pBtampCtx->lsRepPacket);
+      pBtampCtx->lsRepPacket = NULL;
+    }
+
+    if ( pBtampCtx->lsReqPacket )
+    {
+      vosStatus = vos_pkt_return_packet(pBtampCtx->lsReqPacket);
+      pBtampCtx->lsReqPacket = NULL; 
+    }
+    
+
+    return vosStatus;
+}
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_RxProcLsPkt
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision frames are received at BAP
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the 802.3 frame to be 
+                 translated to BT HCI Data Packet
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_RxProcLsPkt
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  v_U16_t            RxProtoType,     /* Protocol Type from the frame received */
+  vos_pkt_t         *vosRxLsBuff
+)
+{
+    VOS_STATUS               vosStatus;
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle;
+    WLANBAP_8023HeaderType   w8023Header;
+    v_SIZE_t                 HeaderLen = sizeof(w8023Header);
+
+
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+               "In %s Received RxProtoType=%x", __FUNCTION__,RxProtoType);
+    
+    vos_pkt_extract_data(vosRxLsBuff,0,(v_VOID_t*)&w8023Header,&HeaderLen);
+    if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE)
+    && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE)))
+    {
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "MAC address mismatch in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /*Free the vos packet*/
+    vosStatus = vos_pkt_return_packet( vosRxLsBuff );
+    if ( VOS_STATUS_SUCCESS != vosStatus)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Failed to free VOS packet in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+   
+    /* Reset Link Supervision timer */
+    if (RxProtoType ==  WLANTL_BT_AMP_TYPE_LS_REP)
+    { 
+        pBtampCtx->lsReqPktPending = FALSE;
+        pBtampCtx->retries = 0;
+        if (pBtampCtx->bapLinkSupervisionTimerInterval)
+        {
+            /* Restart the LS timer */
+            WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+            vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx,
+                   pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME);
+        }
+    }
+    else if(RxProtoType == WLANTL_BT_AMP_TYPE_LS_REQ)
+    {
+        if (pBtampCtx->bapLinkSupervisionTimerInterval)
+        {
+            /* Restart the LS timer */
+            WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+            vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx,
+                   pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME);
+        }
+        pBtampCtx->pPacket = pBtampCtx->lsRepPacket;
+        // Handle LS rep frame
+        vosStatus = WLANBAP_TxLinkSupervision( btampHandle, phy_link_handle, pBtampCtx->pPacket, WLANTL_BT_AMP_TYPE_LS_REP);
+    }
+   
+    return vosStatus; 
+
+}
+
+/* Tx callback function for LS packet */
+static VOS_STATUS WLANBAP_TxLinkSupervisionCB
+(
+    v_PVOID_t   pvosGCtx,
+    vos_pkt_t   *pPacket,
+    VOS_STATUS  retStatus
+)
+{
+    VOS_STATUS     vosStatus;
+    ptBtampContext bapContext; /* Holds the btampContext value returned */ 
+    vos_pkt_t                *pLSPacket; 
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+             "TxCompCB reached for LS Pkt");
+
+    /* Get the BT AMP context from the global */
+    bapContext = gpBtampCtx;
+
+    if (!VOS_IS_STATUS_SUCCESS (retStatus))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+              "TxCompCB:Transmit status Failure");
+    }
+
+    if ( pPacket == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "WLANBAP_TxCompCB bad input\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+
+    /* Return the packet & reallocate */
+    
+    if( pPacket == bapContext->lsReqPacket )
+    {
+        vosStatus = WLANBAP_AcquireLSPacket( bapContext, &pLSPacket,32, TRUE );
+    if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+            bapContext->lsReqPacket = pLSPacket;
+    }
+    else
+    {
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                       "%s:AcquireLSPacket failed\n",__FUNCTION__);
+         bapContext->lsReqPacket = NULL;
+         return vosStatus;   
+    }
+    }
+    else
+    {
+        vosStatus = WLANBAP_AcquireLSPacket( bapContext, &pLSPacket,32, FALSE );
+        if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+        {
+            bapContext->lsRepPacket = pLSPacket;
+        }
+        else
+        {
+             VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                           "%s:AcquireLSPacket failed\n",__FUNCTION__);
+             bapContext->lsRepPacket = NULL;
+             return vosStatus;   
+        }
+    }
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+               "%s:Returned Vos Packet:%x\n",__FUNCTION__, pPacket );
+
+    vos_pkt_return_packet( pPacket );
+
+    return (VOS_STATUS_SUCCESS );
+}
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_TxLinkSupervision
+
+  DESCRIPTION 
+
+    This API will be called to process Link Supervision Request received
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pucAC:       Pointer to return the access category 
+    vosDataBuff: The data buffer containing the 802.3 frame to be 
+                 translated to BT HCI Data Packet
+   
+  RETURN VALUE     
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_TxLinkSupervision
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  vos_pkt_t         *pPacket,
+  v_U16_t           protoType
+)
+{
+    ptBtampContext             pBtampCtx = (ptBtampContext)btampHandle;
+    VOS_STATUS                 vosStatus = VOS_STATUS_E_FAILURE;
+    v_PVOID_t                  pvosGCtx;
+    v_U8_t                     ucSTAId;  /* The StaId (used by TL, PE, and HAL) */
+    v_PVOID_t                  pHddHdl; /* Handle to return BSL context in */
+    WLANTL_MetaInfoType        metaInfo;
+
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                         "In  : %s protoType=%x", __FUNCTION__,protoType);
+
+        // Retrieve the VOSS context
+    pvosGCtx = pBtampCtx->pvosGCtx;
+
+    /* Lookup the StaId using the phy_link_handle and the BAP context */ 
+
+    vosStatus = WLANBAP_GetStaIdFromLinkCtx ( 
+            btampHandle,  /* btampHandle value in  */ 
+            phy_link_handle,  /* phy_link_handle value in */
+            &ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+            &pHddHdl); /* Handle to return BSL context */
+    
+    if ( VOS_STATUS_SUCCESS != vosStatus ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_TxLinKSupervisionReq");
+      return VOS_STATUS_E_FAULT;
+    }
+
+    vos_mem_zero( &metaInfo, sizeof( WLANTL_MetaInfoType ) );
+    
+    metaInfo.ucTID = 0x00 ;
+    metaInfo.ucUP = 0x00;
+    metaInfo.ucIsEapol =  VOS_FALSE;//Notify TL that this is NOT an EAPOL frame
+    metaInfo.ucDisableFrmXtl = VOS_FALSE;
+    metaInfo.ucType = 0x00;
+    pBtampCtx->metaInfo = metaInfo;
+    
+    vosStatus = WLANTL_TxBAPFrm( pvosGCtx, pPacket, &metaInfo, WLANBAP_TxLinkSupervisionCB );
+    if( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                        "Tx: Packet rejected by TL in WLANBAP_TxLinkSupervisionReq");
+        return vosStatus;
+    }
+    
+    if(protoType ==  WLANTL_BT_AMP_TYPE_LS_REQ)
+    {
+        pBtampCtx->lsReqPktPending = TRUE;
+        pBtampCtx->retries++;
+    }
+   
+    if (pBtampCtx->bapLinkSupervisionTimerInterval)
+    {
+        /* Restart the LS timer */
+        WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+        vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx,
+               pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME);
+    }
+
+   if( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLANBAP_TxLinkSupervisionReq failed to Start LinkSupervision Timer\n" );
+        return vosStatus;
+   }
+   
+   return vosStatus;
+} /* WLANBAP_RxLinkSupervisionReq */
+
+
+
diff --git a/CORE/BAP/src/bapApiStatus.c b/CORE/BAP/src/bapApiStatus.c
new file mode 100644
index 0000000..26a3e5d
--- /dev/null
+++ b/CORE/BAP/src/bapApiStatus.c
@@ -0,0 +1,851 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i S t a t u s . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Status functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) that properly register with the BAP Layer initially.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/src/bapApiStatus.c,v 1.7 2009/03/09 08:45:04 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+//#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*
+Status Parameters
+*/
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadFailedContactCounter()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Failed Contact Counter command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadFailedContactCounter:  pointer to the "HCI Read Failed Contact Counter" structure.
+    pFailedContactCounter:  pointer to return value for the "Failed Contact Counter"
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadFailedContactCounter or
+                         pFailedContactCounter is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadFailedContactCounter
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd  *pBapHCIReadFailedContactCounter,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including "Read" Command Complete*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadFailedContactCounter */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPResetFailedContactCounter()
+
+  DESCRIPTION 
+    Implements the actual HCI Reset Failed Contact Counter command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIResetFailedContactCounter:  pointer to the "HCI Reset Failed Contact Counter" structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIResetFailedContactCounter is NULL
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPResetFailedContactCounter
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pBapHCIResetFailedContactCounter,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPResetFailedContactCounter */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLinkQuality()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Link Quality command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLinkQuality:  pointer to the "HCI Read Link Quality" structure.
+    pBapHCILinkQuality:  pointer to return value for the "Link Quality"
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLinkQuality or 
+                         pBapHCILinkQuality is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLinkQuality
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Link_Quality_Cmd *pBapHCIReadLinkQuality,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U8_t         phyLinkHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIReadLinkQuality) ||
+        (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the physical link handle extracted from
+       input parameter. This parameter has 2 bytes for physical handle
+       (only lower byte valid) */
+    phyLinkHandle = (v_U8_t) pBapHCIReadLinkQuality->log_link_handle;
+
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.log_link_handle
+        = phyLinkHandle;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality = 0;
+
+    if (phyLinkHandle != btampContext->phy_link_handle)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid Physical link handle in %s", __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        /* Get the Link quality indication status from control block.
+           Link quality value is being updated on the SME callback */
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality
+            = btampContext->link_quality;
+
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status
+            = WLANBAP_STATUS_SUCCESS;
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLinkQuality */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadRSSI()
+
+  DESCRIPTION 
+    Implements the actual HCI Read RSSI command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadRSSI:  pointer to the "HCI Read RSSI" structure.
+    pBapHCIRSSI:  pointer to return value for the "RSSI".
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadRSSI or
+                         pBapHCIRSSI is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadRSSI
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_RSSI_Cmd *pBapHCIReadRSSI,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    VOS_STATUS     vosStatus;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle;
+    v_U8_t         phyLinkHandle;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: btampHandle value: %x", __FUNCTION__,  btampHandle);
+
+    /* Validate params */ 
+    if ((NULL == btampHandle) || (NULL == pBapHCIReadRSSI) ||
+        (NULL == pBapHCIEvent))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid input parameters in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate the physical link handle extracted from
+       input parameter. This parameter has 2 bytes for physical handle
+       (only lower byte valid) */
+    phyLinkHandle = (v_U8_t) pBapHCIReadRSSI->log_link_handle;
+
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.phy_link_handle
+        = phyLinkHandle;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi = 0;
+
+    if (phyLinkHandle != btampContext->phy_link_handle)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Invalid Physical link handle in %s", __FUNCTION__);
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
+            = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+    }
+    else
+    {
+        /* Get the RSSI value for this station (physical link) */
+        vosStatus = WLANTL_GetRssi(btampContext->pvosGCtx, btampContext->ucSTAId,
+                        &pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi);
+
+        if (VOS_STATUS_SUCCESS == vosStatus)
+        {
+            /* GetRssi success, indicate the to upper layer */
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
+                = WLANBAP_STATUS_SUCCESS;
+        }
+        else
+        {
+            /* API failed, indicate unspecified error to upper layer */
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
+                = WLANBAP_ERROR_UNSPECIFIED_ERROR;
+        }
+    }
+
+    /* Fill in the parameters for command complete event... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_RSSI_CMD;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadRSSI */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalAMPInfo()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local AMP Information command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLocalAMPInfo:  pointer to the "HCI Read Local AMP Info" Structure.
+   
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalAMPInfo or 
+                         pBapHCILocalAMPInfo is NULL
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalAMPInfo
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pBapHCIReadLocalAMPInfo,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    /* Validate params */ 
+    if (btampHandle == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    /* Validate params */ 
+    if (pBapHCIReadLocalAMPInfo == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.status 
+        = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Status
+        = WLANBAP_HCI_AMP_STATUS_NOT_SHARED;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Total_BW
+        = 24000;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW
+        = 12000;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Min_Latency
+        = 100;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size
+        = WLANBAP_MAX_80211_PAL_PDU_SIZE;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Controller_Type 
+        = 1;
+#if 0
+AMP Info PAL_Capabilities: Size: 2 Octets
+
+Value    Parameter Description
+0xXXXX   Bit 0: "Service Type = Guaranteed" is not supported by PAL = 0
+                "Service Type = Guaranteed" is supported by PAL = 1
+         Bits 15-1: Reserved (shall be set to 0)
+         (See EFS in Generic AMP FIPD [1])
+#endif //0
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities
+        = 0x00; // was 0x03. Completely wrong.
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length
+        = 248;
+        //= 40;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout
+        = 10000;  //10;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout
+        = 10000; //8;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLocalAMPInfo */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPReadLocalAMPAssoc()
+
+  DESCRIPTION 
+    Implements the actual HCI Read Local AMP Assoc command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIReadLocalAMPAssoc:  pointer to the "HCI Read Local AMP Assoc" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIReadLocalAMPAssoc 
+                        (or pBapHCILocalAMPAssoc) is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPReadLocalAMPAssoc
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd   *pBapHCIReadLocalAMPAssoc,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    VOS_STATUS  vosStatus;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+    tHalHandle hHal;
+    tBtampAMP_ASSOC btamp_ASSOC; 
+    v_U32_t nConsumed = 0;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+    /* Validate params */ 
+    if ((pBapHCIReadLocalAMPAssoc == NULL) || (NULL == btampHandle))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "param is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, 
+            "In %s, phy_link_handle = %d", __FUNCTION__, 
+            pBapHCIReadLocalAMPAssoc->phy_link_handle); 
+
+    /* Update the MAC address and SSID if in case the Read Local AMP Assoc
+     * Request is made before Create Physical Link creation.
+     */
+    WLANBAP_ReadMacConfig (btampContext);
+
+    /* Fill in the contents of an AMP_Assoc structure in preparation
+     * for Packing it into the AMP_assoc_fragment field of the Read 
+     * Local AMP Assoc Command Complete Event 
+     */ 
+    /* Return the local MAC address */ 
+    btamp_ASSOC.AMP_Assoc_MAC_Addr.present = 1;
+    vos_mem_copy( 
+            btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr,   
+            btampContext->self_mac_addr, 
+            sizeof(btampContext->self_mac_addr)); 
+
+    /*Save the local AMP assoc info*/
+    vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_mac_addr,
+                 btampContext->self_mac_addr, 
+                 sizeof(btampContext->self_mac_addr)); 
+
+
+    /* JEZ090303: This logic should return a single channel list with the */ 
+    /* selected channel, if we have one. */
+    //if (btampContext->channel)  
+    if (1)  
+    { 
+        /* Return the local Preferred Channel List */ 
+        /* Return both the Regulatory Info and one channel list */ 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1; 
+        memcpy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3); 
+        /*Save the local AMP assoc info*/
+        vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_pref_country, "XXX", 3);
+
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 2; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0; 
+
+        if (( BT_INITIATOR == btampContext->BAPDeviceRole ) &&
+            ( 0 != btampContext->channel ))
+        {
+          btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->channel;
+          btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x01; //we are AP - we start on their 1st preferred channel 
+          btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11;
+        }
+        else
+        {
+            if (btampContext->config.ucPreferredChannel)
+            {
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->config.ucPreferredChannel;
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 
+                    0x0B - btampContext->config.ucPreferredChannel + 1;  
+            }
+            else
+            {
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = 0x01; 
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x0B; //all channels for 1 to 11 
+            }
+
+            btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11;
+        }
+    } else 
+    { 
+        /* Return the local Preferred Channel List */ 
+        /* Return only the Regulatory Info */ 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1; 
+        memcpy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3); 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 1; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254; 
+        btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0;
+
+    }  
+
+    /*Save the local AMP assoc info*/
+    btampContext->btamp_AMP_Assoc.HC_pref_num_triplets   = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets;
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0];
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1]; 
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2];
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0];
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1]; 
+    btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2];
+
+    /* Also, at this point, lie and tell the other side we are connected on */
+    /* the one channel we support. I hope this convinces the peer as BT-AMP AP */
+    /* We really want him to use our channel.  Since we only support one.*/ 
+    /* Return the local Connected Channel */ 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.present = 1; 
+    memcpy (btamp_ASSOC.AMP_Assoc_Connected_Channel.country, "XXX", 3); 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.num_triplets = 2; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][0] = 201; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][1] = 254; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][2] = 0; 
+    //btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = 0x01; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = (0 != btampContext->channel)?btampContext->channel:0x01; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][1] = 0x01; 
+    btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][2] = 0x11;
+
+
+    /* Return the local PAL Capabilities */ 
+    btamp_ASSOC.AMP_Assoc_PAL_Capabilities.present = 1;
+
+#if 0
+AMP ASSOC Pal Capabilities: Size: 4 Octets
+
+   Value             Description
+     4               TypeID for 802.11 PAL Capabilities
+
+     4               Length
+
+   0xXXXXXXXX        Bit 0:
+                         0 signifies the PAL is not capable of utilizing
+                           received Activity Reports
+                         1 signifies the PAL is capable of utilizing
+                           received Activity Reports
+                     Bit 1:
+                         0 signifies the PAL is not capable of utilizing
+                           scheduling information sent in an Activity Report
+                         1 signifies the PAL is capable of utilizing
+                           scheduling information sent in an Activity Report
+                     Bits 2..31 Reserved
+
+#endif //0
+
+    btamp_ASSOC.AMP_Assoc_PAL_Capabilities.pal_capabilities 
+//        = btampContext->btamp_Remote_AMP_Assoc.HC_pal_capabilities; 
+        //= 0x03;
+        = 0x00;
+
+    /* Return the local PAL Version */ 
+    btamp_ASSOC.AMP_Assoc_PAL_Version.present = 1;
+
+    /* Return the version and company ID data */ 
+    btamp_ASSOC.AMP_Assoc_PAL_Version.pal_version = WLANBAP_PAL_VERSION;
+    btamp_ASSOC.AMP_Assoc_PAL_Version.pal_CompanyID = WLANBAP_QUALCOMM_COMPANY_ID;  // Qualcomm Company ID
+    btamp_ASSOC.AMP_Assoc_PAL_Version.pal_subversion = WLANBAP_PAL_SUBVERSION;
+
+    //Pack the AMP Assoc structure
+    vosStatus = btampPackAMP_ASSOC(
+            hHal, 
+            &btamp_ASSOC, 
+            pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment, 
+            248, 
+            &nConsumed);
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: nConsumed value: %d", __FUNCTION__,  nConsumed); 
+
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD;
+    /*Validate the Physical handle*/
+    if(pBapHCIReadLocalAMPAssoc->phy_link_handle != 
+       btampContext->phy_link_handle) { 
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: Wrong Physical Link handle in Read Local AMP Assoc cmd: current: %x, new: %x", __FUNCTION__,  
+                btampContext->phy_link_handle, 
+                pBapHCIReadLocalAMPAssoc->phy_link_handle);
+
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status
+            = WLANBAP_ERROR_NO_CNCT;
+    } else
+        pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status 
+            = WLANBAP_STATUS_SUCCESS;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle 
+        = pBapHCIReadLocalAMPAssoc->phy_link_handle;
+    /* We will fit in one fragment, so remaining is exactly equal to encoded size*/ 
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.remaining_length 
+        = nConsumed;
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPReadLocalAMPAssoc */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLAN_BAPWriteRemoteAMPAssoc()
+
+  DESCRIPTION 
+    Implements the actual HCI Write Remote AMP Assoc command.  There 
+    is no need for a callback because when this call returns the action 
+    has been completed.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    pBapHCIWriteRemoteAMPAssoc:  pointer to the "HCI Write Remote AMP Assoc" Structure.
+    
+    IN/OUT
+    pBapHCIEvent:  Return event value for the command complete event. 
+                (The caller of this routine is responsible for sending 
+                the Command Complete event up the HCI interface.)
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pBapHCIWriteRemoteAMPAssoc is NULL 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS  
+WLAN_BAPWriteRemoteAMPAssoc
+( 
+  ptBtampHandle btampHandle,
+  tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd   *pBapHCIWriteRemoteAMPAssoc,
+  tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
+                                /* Including Command Complete and Command Status*/
+)
+{
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus;
+    tBtampHCI_Event bapHCIEvent;
+
+    /* I am using btampContext, instead of pBapPhysLinkMachine */ 
+    //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
+    ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ 
+    v_U8_t status;    /* return the BT-AMP status here */
+
+    /* Validate params */ 
+    if (pBapHCIWriteRemoteAMPAssoc == NULL) {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__,  btampHandle); 
+
+    /* Fill in the event structure */ 
+    bapEvent.event = eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC;
+    bapEvent.params = pBapHCIWriteRemoteAMPAssoc;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  btampContext); 
+
+    /* Handle event */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+  
+    /* Format the command complete event to return... */ 
+    pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
+    pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
+    pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode 
+        = BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.status 
+        = status;
+    pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.phy_link_handle 
+        = pBapHCIWriteRemoteAMPAssoc->phy_link_handle;
+
+    if(WLANBAP_ERROR_NO_SUITABLE_CHANNEL == status)
+    {
+        /* Format the Physical Link Complete event to return... */ 
+        bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT;
+        bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1;
+        bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = status;
+        bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle 
+            = btampContext->phy_link_handle;
+        bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number 
+            = 0;
+    
+        vosStatus = (*btampContext->pBapHCIEventCB) 
+            (  
+             btampContext->pHddHdl,   /* this refers the BSL per application context */
+             &bapHCIEvent, /* This now encodes ALL event types */
+             VOS_TRUE /* Flag to indicate assoc-specific event */ 
+            );
+    }
+
+    /* ... */ 
+
+    return VOS_STATUS_SUCCESS;
+} /* WLAN_BAPWriteRemoteAMPAssoc */
+
+
+
+
+
+
diff --git a/CORE/BAP/src/bapApiTimer.c b/CORE/BAP/src/bapApiTimer.c
new file mode 100644
index 0000000..621507f
--- /dev/null
+++ b/CORE/BAP/src/bapApiTimer.c
@@ -0,0 +1,1034 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p A p i T i m e r . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the timer routines
+  required by the WLAN BAP module.  
+  
+  The functions provide by this module are called by the rest of 
+  the BT-AMP PAL module.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /home/labuser/btamp-label9/CORE/BAP/src/bapApiTimer.c,v 1.5 2010/09/04 00:14:37 labuser Exp labuser $$DateTime$$Author: labuser $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-10-23    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+// I think this pulls in everything
+#include "vos_types.h"
+#include "bapApiTimer.h"
+
+//#define BAP_DEBUG
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define WLAN_BAP_TX_PKT_MONITOR_TIME 100
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+#if 1
+//*BT-AMP packet LLC OUI value*/
+static const v_U8_t WLANBAP_BT_AMP_OUI[] =  {0x00, 0x19, 0x58 };
+
+#endif
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Utility Function implementations 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_InitConnectionAcceptTimer
+
+  DESCRIPTION 
+    Initialize the Connection Accept Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_InitConnectionAcceptTimer
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Initialize the timer */
+  vosStatus = vos_timer_init( 
+          &pBtampCtx->bapConnectionAcceptTimer,
+          VOS_TIMER_TYPE_SW, /* use this type */
+          WLANBAP_ConnectionAcceptTimerHandler,
+          pBtampCtx);
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_InitConnectionAcceptTimer */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_DeinitConnectionAcceptTimer
+
+  DESCRIPTION 
+    Destroy the Connection Accept Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_DeinitConnectionAcceptTimer
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Initialize and then Start the timer */
+  vosStatus = vos_timer_destroy ( 
+          &pBtampCtx->bapConnectionAcceptTimer );
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_DeinitConnectionAcceptTimer */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StartConnectionAcceptTimer
+
+  DESCRIPTION 
+    Start the Connection Accept Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    interval:    time interval.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StartConnectionAcceptTimer
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t interval
+)
+{
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Start the connection accept timer*/
+  vos_timer_start( 
+          &pBtampCtx->bapConnectionAcceptTimer,
+          interval);
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_StartConnectionAcceptTimer */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StopConnectionAcceptTimer 
+
+  DESCRIPTION 
+    Stop the Connection Accept Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StopConnectionAcceptTimer 
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Stop the timer */
+  vosStatus =  vos_timer_stop( 
+           &pBtampCtx->bapConnectionAcceptTimer);
+ 
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_StopConnectionAcceptTimer */ 
+
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_ConnectionAcceptTimerHandler
+
+  DESCRIPTION 
+    Callback function registered with vos timer for the Connection
+    Accept timer 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    userData:      pointer can be used to retrive the BT-AMP context 
+   
+  RETURN VALUE
+    None
+         
+  SIDE EFFECTS 
+  
+============================================================================*/
+v_VOID_t 
+WLANBAP_ConnectionAcceptTimerHandler
+( 
+  v_PVOID_t userData 
+)
+{
+  ptBtampContext  pBtampCtx = (ptBtampContext)userData;
+  tWLAN_BAPEvent bapEvent; /* State machine event */
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  v_U8_t status;    /* return the BT-AMP status here */
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-----------------------------------------------------------------------
+    Sanity check 
+   -----------------------------------------------------------------------*/
+  if ( NULL == pBtampCtx )
+  {
+     VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: Fatal error in %s", __FUNCTION__ );
+     VOS_ASSERT(0);
+     return; 
+  }
+
+ /*---------------------------------------------------------------------
+    Feed this timeout to the BTAMP FSM 
+   ---------------------------------------------------------------------*/
+  /* Fill in the event structure */ 
+  bapEvent.event = eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT;
+  bapEvent.params = NULL;
+
+  /* Handle event */ 
+  vosStatus = btampFsm(pBtampCtx, &bapEvent, &status);
+
+  /* Now transition to fully disconnected and notify phy link disconnect*/ 
+  bapEvent.event =  eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
+  bapEvent.params = NULL;
+
+  /* Handle event */ 
+  vosStatus = btampFsm(pBtampCtx, &bapEvent, &status);
+
+
+}/*WLANBAP_ConnectionAcceptTimerHandler*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_InitLinkSupervisionTimer
+
+  DESCRIPTION 
+    Initialize the Link Supervision Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_InitLinkSupervisionTimer
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Initialize the timer */
+  vosStatus = vos_timer_init( 
+          &pBtampCtx->bapLinkSupervisionTimer,
+          VOS_TIMER_TYPE_SW, /* use this type */
+          WLANBAP_LinkSupervisionTimerHandler,
+          pBtampCtx);
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_InitLinkSupervisionTimer */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_DeinitLinkSupervisionTimer
+
+  DESCRIPTION 
+    Destroy the Link Supervision Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_DeinitLinkSupervisionTimer
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Initialize and then Start the timer */
+  vosStatus = vos_timer_destroy ( 
+          &pBtampCtx->bapLinkSupervisionTimer );
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_DeinitLinkSupervisionTimer */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StartLinkSupervisionTimer
+
+  DESCRIPTION 
+    Start the LinkSupervisionTimer Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    interval:    time interval.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StartLinkSupervisionTimer
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t interval
+)
+{
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  vos_timer_start( 
+          &pBtampCtx->bapLinkSupervisionTimer,
+          interval);
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_StartLinkSupervisionTimer */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StopLinkSupervisionTimer 
+
+  DESCRIPTION 
+    Stop the LinkSupervision Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StopLinkSupervisionTimer 
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Stop the timer */
+  vosStatus =  vos_timer_stop( 
+           &pBtampCtx->bapLinkSupervisionTimer);
+ 
+   
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_StopLinkSupervisionTimer */ 
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_LinkSupervisionTimerHandler
+
+  DESCRIPTION 
+    Callback function registered with vos timer for the LinkSupervision timer 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    userData:      pointer can be used to retrive the BT-AMP context 
+   
+  RETURN VALUE
+    None
+         
+  SIDE EFFECTS 
+  
+============================================================================*/
+v_VOID_t 
+WLANBAP_LinkSupervisionTimerHandler
+( 
+  v_PVOID_t userData 
+)
+{
+    ptBtampContext           pBtampCtx =      (ptBtampContext)userData;
+    VOS_STATUS               vosStatus =      VOS_STATUS_SUCCESS;
+    ptBtampHandle            btampHandle =    (ptBtampHandle)userData;
+    tWLAN_BAPEvent           bapEvent; /* State machine event */
+    v_U8_t                   phy_link_handle;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-----------------------------------------------------------------------
+    Sanity check 
+   -----------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx )
+    {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: Fatal error in %s", __FUNCTION__ );
+       VOS_ASSERT(0);
+       return; 
+    }
+
+    phy_link_handle = pBtampCtx->phy_link_handle;
+     VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP:In LinkSupervision Timer handler %s", __FUNCTION__ );
+
+    if(pBtampCtx->dataPktPending == VOS_TRUE)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Data seen. Do nothing", __FUNCTION__ );
+
+        pBtampCtx->dataPktPending = VOS_FALSE;
+        pBtampCtx->lsReqPktPending = VOS_FALSE;
+        pBtampCtx->retries = 0;
+        vosStatus = WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+        vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx,
+                    pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME);
+
+        //Data is seen. or our previous packet is not yet fetched by TL.Don't do any thing.Just return;
+        return;
+    }
+    else if((pBtampCtx->lsReqPktPending == VOS_TRUE ) 
+            && (pBtampCtx->retries == WLANBAP_LINK_SUPERVISION_RETRIES))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "#########WLAN BAP: LinkSupervision Timed OUT######## %s", __FUNCTION__ );
+
+     /*---------------------------------------------------------------------
+    Feed this timeout to the BTAMP FSM 
+   ---------------------------------------------------------------------*/
+        /* Fill in the event structure */ 
+        /* JEZ110307: Which should this be? */ 
+        //bapEvent.event =eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT;
+        bapEvent.event =eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION;
+        bapEvent.params = NULL;
+
+        /* Handle event */ 
+        vosStatus = btampFsm(pBtampCtx, &bapEvent, (v_U8_t *)&vosStatus);
+    }
+    else
+    {    
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Resend the LS packet", __FUNCTION__ );
+
+        /* If we have transmit pkt pending and the time out occurred,resend the ls packet */
+        WLANBAP_StopLinkSupervisionTimer(pBtampCtx);
+        pBtampCtx->pPacket = pBtampCtx->lsReqPacket;
+        vosStatus = WLANBAP_TxLinkSupervision( btampHandle, 
+                                               phy_link_handle, 
+                                               pBtampCtx->pPacket ,
+                                               WLANTL_BT_AMP_TYPE_LS_REQ);
+    }
+    
+}/*WLANBAP_LinkSupervisionTimerHandler*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StartTxPacketMonitorTimer
+
+  DESCRIPTION 
+    Start the Tx Packet Monitor Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    interval:    time interval.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StartTxPacketMonitorTimer
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  v_U32_t     uInterval = WLAN_BAP_TX_PKT_MONITOR_TIME; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Start the timer */
+  vosStatus = vos_timer_start( &pBtampCtx->bapTxPktMonitorTimer,
+                                uInterval);
+
+  return vosStatus;
+}/* WLANBAP_StartTxPacketMonitorTimer */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StopTxPacketMonitorTimer 
+
+  DESCRIPTION 
+    Stop the Tx Packet Monitor Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StopTxPacketMonitorTimer 
+( 
+  ptBtampContext  pBtampCtx
+)
+{
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in %s", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Stop the timer */
+  vosStatus =  vos_timer_stop( &pBtampCtx->bapTxPktMonitorTimer);
+ 
+   
+  return vosStatus;
+}/* WLANBAP_StopTxPacketMonitorTimer */ 
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_SendCompletedPktsEvent
+
+  DESCRIPTION 
+    Utility function for sending the NUM_OF_COMPLETED_PKTS_EVENT to HCI 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block 
+   
+  RETURN VALUE
+    None
+         
+  SIDE EFFECTS 
+  
+============================================================================*/
+v_VOID_t 
+WLANBAP_SendCompletedPktsEvent
+( 
+  ptBtampContext     pBtampCtx 
+)
+{
+  v_U8_t             i, j;
+  tBtampHCI_Event    bapHCIEvent; /* This now encodes ALL event types */
+  v_U32_t            uTxCompleted    = 0; 
+  tpBtampLogLinkCtx  pLogLinkContext = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    /* Format the Number of completed packets event */ 
+  bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT;
+  bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = 0;
+
+ /*---------------------------------------------------------------------
+    Check if LL still exists, if TRUE generate num_pkt_event and
+    restart the timer 
+   ---------------------------------------------------------------------*/
+  for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) 
+  {
+     pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i];
+     if ( pLogLinkContext->present ) 
+     {
+       uTxCompleted = pLogLinkContext->uTxPktCompleted;
+       bapHCIEvent.u.btampNumOfCompletedPktsEvent.conn_handles[j] =
+           pLogLinkContext->log_link_handle;
+       bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_completed_pkts[j] =
+           uTxCompleted;
+
+       j++;
+
+       vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted,
+                                         (v_U32_t) uTxCompleted);
+
+       if (uTxCompleted) { 
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                  "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __FUNCTION__, 
+                  pLogLinkContext->log_link_handle, uTxCompleted);  
+       }
+     }
+  }
+
+  /* Indicate only if at least one logical link is present and number of
+     completed packets is non zero */
+  if (j && uTxCompleted)
+  {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: Indicating Num Completed packets Event");
+
+      /*issue num_pkt_event for uTxCompleted*/
+      bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = j;
+      (*pBtampCtx->pBapHCIEventCB)
+      (
+           pBtampCtx->pHddHdl,   /* this refers the BSL per application context */
+           &bapHCIEvent, /* This now encodes ALL event types */
+           VOS_TRUE /* Flag to indicate assoc-specific event */ 
+      );
+  }
+
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_SendCompletedDataBlksEvent
+
+  DESCRIPTION 
+    Utility function for sending the NUM_OF_COMPLETED_DATA_BLOCKS_EVENT to HCI 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block 
+   
+  RETURN VALUE
+    None
+         
+  SIDE EFFECTS 
+  
+============================================================================*/
+v_VOID_t 
+WLANBAP_SendCompletedDataBlksEvent
+( 
+  ptBtampContext     pBtampCtx 
+)
+{
+  v_U8_t             i, j;
+  tBtampHCI_Event    bapHCIEvent; /* This now encodes ALL event types */
+  v_U32_t            uTxCompleted    = 0; 
+  tpBtampLogLinkCtx  pLogLinkContext = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    /* Format the Number of completed data blocks event */ 
+  bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT;
+  bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = 0;
+
+ /*---------------------------------------------------------------------
+    Check if LL still exists, if TRUE generate num_data_blocks_event and
+    restart the timer 
+   ---------------------------------------------------------------------*/
+  for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) 
+  {
+     pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i];
+     if ( pLogLinkContext->present ) 
+     {
+       uTxCompleted = pLogLinkContext->uTxPktCompleted;
+       bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.conn_handles[j] =
+           pLogLinkContext->log_link_handle;
+       bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_pkts[j] =
+           uTxCompleted;
+       bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_blocks[j] =
+           uTxCompleted;
+       bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.total_num_data_blocks = 16;
+
+       j++;
+
+       vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted,
+                                         (v_U32_t) uTxCompleted);
+
+       if (uTxCompleted) { 
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                  "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __FUNCTION__, 
+                  pLogLinkContext->log_link_handle, uTxCompleted);  
+       }
+     }
+  }
+
+  /* Indicate only if at least one logical link is present and number of
+     completed data blocks is non zero */
+  if (j && uTxCompleted)
+  {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: Indicating Num Completed Data Blocks Event");
+
+      /*issue num_data_blocks_event for uTxCompleted*/
+      bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = j;
+      (*pBtampCtx->pBapHCIEventCB)
+      (
+           pBtampCtx->pHddHdl,   /* this refers the BSL per application context */
+           &bapHCIEvent, /* This now encodes ALL event types */
+           VOS_TRUE /* Flag to indicate assoc-specific event */ 
+      );
+  }
+
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_TxPacketMonitorHandler
+
+  DESCRIPTION 
+    Callback function registered with vos timer for the Tx Packet Monitor 
+    Timer.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    userData:      pointer can be used to retrive the BT-AMP context 
+   
+  RETURN VALUE
+    None
+         
+  SIDE EFFECTS 
+  
+============================================================================*/
+v_VOID_t 
+WLANBAP_TxPacketMonitorHandler
+( 
+  v_PVOID_t userData 
+)
+{
+  ptBtampContext     pBtampCtx       = (ptBtampContext)userData;
+  BTAMPFSM_INSTANCEDATA_T *instanceVar = &pBtampCtx->bapPhysLinkMachine;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-----------------------------------------------------------------------
+    Sanity check 
+   -----------------------------------------------------------------------*/
+  if ( NULL == pBtampCtx )
+  {
+     VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "WLAN BAP: Fatal error in %s", __FUNCTION__ );
+     VOS_ASSERT(0);
+     return; 
+  }
+
+#if 0 //BAP_DEBUG
+  /* Trace the tBtampCtx being passed in. */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+  if(WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED == pBtampCtx->ucDataTrafficMode)
+     {
+    WLANBAP_SendCompletedDataBlksEvent(pBtampCtx);
+       }
+  else
+  {
+    WLANBAP_SendCompletedPktsEvent(pBtampCtx);
+  }
+
+  /* Restart the Packet monitoring timer if still Physical link
+   * is present. 
+   * It is possible that when the physical link is tear down, 
+   * timer start request is in Q and could start again. 
+   */
+  if (CONNECTED == instanceVar->stateVar)
+  {
+    WLANBAP_StartTxPacketMonitorTimer(pBtampCtx);
+  }
+}/*WLANBAP_TxPacketMonitorHandler*/
+
diff --git a/CORE/BAP/src/bapApiTimer.h b/CORE/BAP/src/bapApiTimer.h
new file mode 100644
index 0000000..1d86dab
--- /dev/null
+++ b/CORE/BAP/src/bapApiTimer.h
@@ -0,0 +1,239 @@
+/*
+ * 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 WLAN_QCT_WLANBAP_API_TIMER_H
+#define WLAN_QCT_WLANBAP_API_TIMER_H
+
+/*===========================================================================
+
+               W L A N   B T - A M P  P A L   L A Y E R 
+                    T I M E R  S E R V I C E S  A P I
+                
+                   
+DESCRIPTION
+  This file contains the timer APIs used by the wlan BT-AMP PAL layer 
+  module.
+  
+      
+  Copyright (c) 2008 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiTimer.h,v 1.1 2008/11/21 20:30:20 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $
+
+
+when        who    what, where, why
+--------    ---    ----------------------------------------------------------
+10/23/08    jez     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+// Pick up all the BT-AMP internal definitions 
+// And underlying supporting types. (Including VOSS, CSR, and...)
+#include "bapInternal.h" 
+
+/* Pick up the SIRIUS and HAL types */ 
+// Already taken care of, above 
+//#include "sirApi.h"
+//#include "halTypes.h"
+
+/* Pick up the CCM API def'n */ 
+#include "ccmApi.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+// Temporary 
+//#define BAP_DEBUG
+
+
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ *  Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  Utility Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+#if 0
+/*==========================================================================
+
+  FUNCTION    WLANBAP_StartConnectionAcceptTimer
+
+  DESCRIPTION 
+    Clear out all fields in the BAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:   pointer to the BAP control block
+    interval:    time interval.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_StartConnectionAcceptTimer
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t interval
+);
+#endif // 0
+
+/* Connection Accept timer*/
+VOS_STATUS WLANBAP_InitConnectionAcceptTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_DeinitConnectionAcceptTimer
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_StartConnectionAcceptTimer 
+    (ptBtampContext  pBtampCtx, v_U32_t interval);
+
+VOS_STATUS WLANBAP_StopConnectionAcceptTimer 
+    ( ptBtampContext  pBtampCtx);
+
+v_VOID_t WLANBAP_ConnectionAcceptTimerHandler 
+    ( v_PVOID_t userData );
+
+/* Link Supervision timer*/
+VOS_STATUS WLANBAP_InitLinkSupervisionTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_DeinitLinkSupervisionTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_StartLinkSupervisionTimer 
+    (ptBtampContext  pBtampCtx, v_U32_t interval);
+
+VOS_STATUS WLANBAP_StopLinkSupervisionTimer 
+    ( ptBtampContext  pBtampCtx);
+
+v_VOID_t WLANBAP_LinkSupervisionTimerHandler 
+    ( v_PVOID_t userData );
+
+/* Logical Link Accept timer*/
+VOS_STATUS WLANBAP_InitLogicalLinkAcceptTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_DeinitLogicalLinkAcceptTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_StartLogicalLinkAcceptTimer 
+    (ptBtampContext  pBtampCtx, v_U32_t interval);
+
+VOS_STATUS WLANBAP_StopLogicalLinkAcceptTimer 
+    ( ptBtampContext  pBtampCtx);
+
+v_VOID_t WLANBAP_LogicalLinkAcceptTimerHandler 
+    ( v_PVOID_t userData );
+
+/* Best Effort Flush timer*/
+VOS_STATUS WLANBAP_InitBEFlushTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_DeinitBEFlushTimer 
+    ( ptBtampContext  pBtampCtx);
+
+VOS_STATUS WLANBAP_StartBEFlushTimer 
+    (ptBtampContext  pBtampCtx, v_U32_t interval);
+
+VOS_STATUS WLANBAP_StopBEFlushTimer 
+    ( ptBtampContext  pBtampCtx);
+
+v_VOID_t WLANBAP_BEFlushTimerHandler 
+    ( v_PVOID_t userData );
+
+/* Tx Packet monitor timer handler */
+v_VOID_t 
+WLANBAP_TxPacketMonitorHandler
+( 
+  v_PVOID_t userData 
+);
+
+/* Tx Packet monitor start timer */
+VOS_STATUS 
+WLANBAP_StartTxPacketMonitorTimer
+( 
+  ptBtampContext  pBtampCtx
+);
+
+/* Tx Packet monitor stop timer */
+VOS_STATUS 
+WLANBAP_StopTxPacketMonitorTimer 
+( 
+  ptBtampContext  pBtampCtx
+);
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WLANBAP_API_TIMER_H */
+
diff --git a/CORE/BAP/src/bapInternal.h b/CORE/BAP/src/bapInternal.h
new file mode 100644
index 0000000..7cfdc03
--- /dev/null
+++ b/CORE/BAP/src/bapInternal.h
@@ -0,0 +1,1310 @@
+/*
+ * 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 WLAN_QCT_WLANBAP_INTERNAL_H
+#define WLAN_QCT_WLANBAP_INTERNAL_H
+
+/*===========================================================================
+
+               W L A N   B T - A M P  P A L   L A Y E R 
+                       I N T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the internal API exposed by the wlan BT-AMP PAL layer 
+  module.
+  
+      
+  Copyright (c) 2008 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: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapInternal.h,v 1.3 2010/07/12 20:40:18 labuser Exp labuser $ $DateTime: $ $Author: labuser $
+
+
+when        who    what, where, why
+--------    ---    ----------------------------------------------------------
+09/15/08    jez     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_api.h" 
+#include "vos_packet.h" 
+
+// Pick up the CSR API definitions
+#include "csrApi.h"
+
+/* BT-AMP PAL API structure types  - FramesC generated */ 
+#include "btampHCI.h" 
+#include "bapApi.h" 
+
+// Pick up the BTAMP FSM definitions
+#include "fsmDefs.h"
+//#include "btampFsm.h"
+#include "btampFsm_ext.h"
+#include "bapRsn8021xFsm.h"
+#include "bapRsnErrors.h"
+
+#include "csrApi.h"
+#include "sirApi.h"
+#include "wniApi.h"
+#include "palApi.h"
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+// Temporary so that I can compile
+//#define VOS_MODULE_ID_BAP 9
+// Temporary 
+//#define BAP_DEBUG
+
+// Used to enable or disable security on the BT-AMP link 
+#define WLANBAP_SECURITY_ENABLED_STATE VOS_TRUE
+
+// How do I get BAP context from voss context? 
+#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) 
+// How do I get halHandle from voss context? 
+#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_SME, ctx) 
+
+// Default timeout values (in BR/EDR baseband slots)
+// Physical Link Connection Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec)
+/* chose to double it to 3FFF as we saw conn timeout in lab*/
+//#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT  0xFFFF
+// Set default to 0x1F40.  Which is ~5 secs.
+#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT  0x1F40
+
+/* Link Supervision Timer interval (0x7D00 * 0.625 = 20 sec) */
+#ifdef FEATURE_WLAN_BTAMP_UT
+#define WLANBAP_LINK_SUPERVISION_TIMEOUT   0x7D00
+#else
+#define WLANBAP_LINK_SUPERVISION_TIMEOUT   0x3E80  // 10 seconds
+#endif
+#define WLANBAP_LINK_SUPERVISION_RETRIES   2
+
+/* Logical Link Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec)*/
+#define WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT 0x1F40
+
+/* BR/EDR baseband 1 slot time period */
+#define WLANBAP_BREDR_BASEBAND_SLOT_TIME  1 // 0.625
+
+/* Maximum allowed range for connection accept timeout interval */
+#define WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE  0xB540
+
+/* Minimum allowed range for connection accept timeout interval */
+#define WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE   0x01
+
+/* Best Effort Flush timer interval*/
+#define WLANBAP_BE_FLUSH_TIMEOUT 10
+
+/* Length of the LLC header*/
+#define WLANBAP_LLC_HEADER_LEN   8 
+
+/*Size of the protocol type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_PROTO_TYPE_SIZE            2
+
+/*Size of the OUI type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_OUI_SIZE                   3
+
+/*Offset of the OUI field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_OUI_OFFSET                 3
+
+/*Offset of the protocol type field inside the LLC/SNAP header*/
+#define WLANBAP_LLC_PROTO_TYPE_OFFSET  WLANBAP_LLC_OUI_OFFSET +  WLANBAP_LLC_OUI_SIZE
+
+#define WLANBAP_MAX_NUM_TRIPLETS               5
+
+#define WLANBAP_MAX_SIZE_TRIPLETS              3
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+ *  Type Declarations - For internal BAP context information
+ * -------------------------------------------------------------------------*/
+typedef struct sBtampHCI_Buffer_Size {
+//    v_U8_t       present;
+    /* D9r14 says Max80211PALPDUSize 1492 */
+    v_U16_t      HC_ACL_Data_Packet_Length;  
+    v_U8_t       HC_SCO_Packet_Length;
+    v_U16_t      HC_Total_Num_ACL_Packets;
+    v_U16_t      HC_Total_Num_SCO_Packets;
+} tBtampHCI_Buffer_Size;
+
+typedef struct sBtampHCI_Data_Block_Size {
+//    v_U8_t       present;
+    v_U8_t       status;
+    /* D9r14 says Max80211PALPDUSize 1492 */
+    v_U16_t      HC_Max_ACL_Data_Packet_Length;  
+    v_U16_t      HC_Data_Block_Length;
+    v_U16_t      HC_Total_Num_Data_Blocks;
+} tBtampHCI_Data_Block_Size;
+
+typedef struct sBtampHCI_Version_Info {
+//    v_U8_t       present;
+    v_U8_t       HC_HCI_Version;
+    v_U16_t      HC_HCI_Revision;  
+    v_U8_t       HC_PAL_Version;  /* for 802.11 AMP: 0x01 */
+    v_U16_t      HC_PAL_Sub_Version; /* for 802.11 AMP: Vendor specific */ 
+    v_U16_t      HC_Manufac_Name; /* See BT assigned numbers */  
+} tBtampHCI_Version_Info;
+
+typedef struct sBtampHCI_Supported_Cmds {
+//    v_U8_t       present;
+    v_U8_t       HC_Support_Cmds[64]; /* a bitmask of cmds */
+} tBtampHCI_Supported_Cmds;
+
+typedef struct sBtampHCI_AMP_Info {
+//    v_U8_t       present;
+    v_U8_t       HC_AMP_Status; /* */
+    v_U32_t      HC_Total_BW; /* combined uplink and downlink */
+    v_U32_t      HC_Max_Guaranteed_BW; /* upper bound */
+    v_U32_t      HC_Min_Latency; /* AMP HCI latency + DIFS + CWMin */
+    v_U32_t      HC_Max_PDU_Size; /* Equal to Max80211PALPDUSize */
+    v_U8_t       HC_Controller_Type; /* 0x01 for 802.11 BT-AMP PAL  */
+    v_U16_t      HC_PAL_Capabilities;  /* Bit 0: 0 = No Guarantee; 1 = Guarantee */
+    v_U16_t      HC_AMP_Assoc_Length;  /* Length of AMP Assoc Info */
+                                       /* Equal to Max80211AMPASSOCLen (672) */
+    v_U16_t      HC_Max_Flush_Timeout;  /* Maximum time Tx attempted. 0 is inf retry */
+    v_U16_t      HC_BE_Flush_Timeout;  /* Maximum time BE Tx attempted. 0 is inf retry */
+} tBtampHCI_AMP_Info;
+
+typedef struct sBtampHCI_AMP_Assoc {
+//    v_U8_t       present;
+    v_U8_t       HC_cnct_country[3];   /* Connected channel */
+    v_U8_t       HC_cnct_num_triplets;
+    v_U8_t       HC_cnct_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS];
+    v_U8_t       HC_mac_addr[6];
+    v_U32_t      HC_pal_capabilities;
+    v_U8_t       HC_pref_country[3];   /* Preferred channels */
+    v_U8_t       HC_pref_num_triplets;
+    v_U8_t       HC_pref_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS];
+    v_U8_t       HC_pal_version;
+    v_U16_t      HC_pal_CompanyID;
+    v_U16_t      HC_pal_subversion;
+}  tBtampHCI_AMP_Assoc, *tpBtampHCI_AMP_Assoc ;
+
+typedef struct sBtampTLVHCI_Location_Data_Info {
+    v_U8_t       loc_domain_aware;
+    v_U8_t       loc_domain[3];
+    v_U8_t       loc_options;
+} tBtampTLVHCI_Location_Data_Info;
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations - For BAP logical link context information
+ * -------------------------------------------------------------------------*/
+typedef struct sBtampLogLinkCtx {
+    v_U8_t       present;  /* In use? */
+
+    v_U8_t       log_link_index;  /* small integer (<16) value assigned by us */
+    v_U16_t      log_link_handle;  /* 8 bits of phy_link_handle and our index */
+
+    /* The flow spec (From section 5.6 of Generic AMP spec)  */
+    tBtampTLVFlow_Spec btampFlowSpec;   
+
+    /* The Access category  */
+    WLANTL_ACEnumType btampAC;   
+
+    /* The TID  */
+    v_U8_t    ucTID;
+
+    /* UP of the packet being sent */
+    v_U8_t    ucUP;
+
+    /*Number of packets completed since the last time num pkt complete event 
+      was issued*/
+    v_U32_t   uTxPktCompleted;    
+
+}  tBtampLogLinkCtx, *tpBtampLogLinkCtx ;
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations - QOS related
+ * -------------------------------------------------------------------------*/
+/* BT-AMP QOS config */
+typedef struct sBtampQosCfg {
+    v_U8_t                    bWmmIsEnabled;
+} tBtampQosCfg;
+
+/*----------------------------------------------------------------------------
+ *  Opaque BAP context Type Declaration
+ * -------------------------------------------------------------------------*/
+// We were only using this syntax, when this was truly opaque. 
+// (I.E., it was defined in a different file.)
+//typedef struct sBtampContext tBtampContext, *ptBtampContext;
+
+
+// Validity check the logical link value 
+#define BTAMP_VALID_LOG_LINK(a) ( a > 0 && a < WLANBAP_MAX_LOG_LINKS ? 1 : 0)  
+
+/* Instance data definition of state machine */
+// Moved here from the BTAMP FSM definitions in btampFsm.h
+typedef struct{
+  BTAMPFSM_ENTRY_FLAG_T disconnectedEntry;
+  BTAMPFSM_STATEVAR_T stateVar;
+  BTAMPFSM_INST_ID_T inst_id;
+} BTAMPFSM_INSTANCEDATA_T;
+
+/* BT-AMP device role */
+typedef enum{
+    BT_RESPONDER,
+    BT_INITIATOR
+} tWLAN_BAPRole;
+
+/* BT-AMP device role */
+typedef enum{
+    WLAN_BAPLogLinkClosed,
+    WLAN_BAPLogLinkOpen,
+    WLAN_BAPLogLinkInProgress,
+} tWLAN_BAPLogLinkState;
+
+typedef struct{
+    v_U8_t       phyLinkHandle;
+    v_U8_t       txFlowSpec[18];
+    v_U8_t       rxFlowSpec[18];
+} tBtampLogLinkReqInfo;
+
+/*----------------------------------------------------------------------------
+ *  BAP context Data Type Declaration
+ * -------------------------------------------------------------------------*/
+#undef BTAMP_MULTIPLE_PHY_LINKS
+typedef struct sBtampContext {
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+
+    // Include the enclosing VOSS context here
+    v_PVOID_t                 pvosGCtx; 
+
+    //  include the phy link state machine structure here
+    tWLAN_BAPbapPhysLinkMachine   bapPhysLinkMachine;
+
+    // BAP device role
+    tWLAN_BAPRole             BAPDeviceRole;
+    // Include the SME(CSR) sessionId here
+    v_U8_t                    sessionId;
+
+    // Actual storage for AP and self (STA) SSID 
+    //tSirMacSSid               SSID[2];
+    tCsrSSIDInfo              SSIDList[2];
+    // Actual storage for AP bssid 
+    tCsrBssid                 bssid;
+    // Include the SME(CSR) context here
+    tCsrRoamProfile           csrRoamProfile; 
+    tANI_U32                  csrRoamId;
+
+    // QOS config
+    tBtampQosCfg              bapQosCfg;
+
+    /*Flag for signaling if security is enabled*/
+    v_U8_t                    ucSecEnabled;
+
+    // associated boolean flag
+    v_U8_t                    mAssociated;
+    // associated status 
+    v_U8_t                    mAssociatedStatus;
+    tCsrBssid                 assocBssid;  
+    tBssSystemRole            systemRole; 
+
+    // own SSID  
+    v_U8_t                    ownSsid[32];
+    v_U32_t                   ownSsidLen;
+
+    // incoming Assoc SSID  
+    v_U8_t                    assocSsid[32];
+    v_U32_t                   assocSsidLen;
+
+    // gNeedPhysLinkCompEvent
+    v_U8_t                    gNeedPhysLinkCompEvent;
+    // gPhysLinkStatus 
+    v_U8_t                    gPhysLinkStatus;
+    // gDiscRequested
+    v_U8_t                    gDiscRequested;
+    // gDiscReason 
+    v_U8_t                    gDiscReason;
+
+    // Include the BSL per-application context here
+    v_PVOID_t                 pAppHdl;  // Per-app BSL context
+    // Include the BSL per-association contexts here.
+    // (Right now, there is only one)
+    v_PVOID_t                 pHddHdl;
+    /* 8 bits of phy_link_handle identifies this association */
+    v_U8_t                    phy_link_handle;  
+    // Short Range Mode setting for this physical link
+    v_U8_t                    phy_link_srm;
+
+    // Include the key material for this physical link
+    v_U8_t                    key_type;
+    v_U8_t                    key_length;
+    v_U8_t                    key_material[32];
+    
+    /* Physical link quality status
+       After the physical link is up, SME indicates the link quality through
+       callback. This value is returned to upper layer on request.
+       */
+    v_U8_t                    link_quality;
+    
+    /* Connection Accept timer*/
+    vos_timer_t               bapConnectionAcceptTimer; 
+    /* Link Supervision timer*/
+    vos_timer_t               bapLinkSupervisionTimer; 
+    /* Logical Link Accept timer*/
+    vos_timer_t               bapLogicalLinkAcceptTimer; 
+    /* Best Effort Flush timer*/
+    vos_timer_t               bapBEFlushTimer; 
+
+    /* TX Packet Monitoring timer*/
+    vos_timer_t               bapTxPktMonitorTimer; 
+
+    /* Connection Accept Timer interval (in BR/EDR baseband slots)
+     * Interval length = N * 0.625 msec (1 BR/EDR baseband slot)
+     */
+    v_U16_t                   bapConnectionAcceptTimerInterval; 
+
+    /* Link Supervision Timer interval (in BR/EDR baseband slots) */
+    v_U16_t                   bapLinkSupervisionTimerInterval; 
+
+    /* Logical Link Accept Timer interval (in BR/EDR baseband slots) */
+    v_U16_t                   bapLogicalLinkAcceptTimerInterval; 
+
+    /* Best Effort Flush timer interval*/
+    v_U32_t                   bapBEFlushTimerInterval; 
+
+    // Include the current channel here
+    v_U32_t                   channel;
+
+    // Include the associations STA Id
+    v_U8_t                    ucSTAId;
+
+    // Include the associations MAC addresses
+    v_U8_t                    self_mac_addr[6];
+    v_U8_t                    peer_mac_addr[6];
+
+    // The array of logical links
+    /* the last small integer (<16) value assigned by us */
+    v_U8_t                    current_log_link_index; /* assigned mod 16 */  
+    v_U8_t                    total_log_link_index; /* should never be >16 */  
+    /* The actual array */
+    tBtampLogLinkCtx          btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS];  
+    
+    // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
+    WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB;
+    WLANBAP_STARxCBType       pfnBtamp_STARxCB;
+    WLANBAP_TxCompCBType      pfnBtampTxCompCB;
+
+    /* Implements the callback for ALL asynchronous events. */ 
+    tpWLAN_BAPEventCB         pBapHCIEventCB;
+
+    // Save Page2 of the event mask.  
+    v_U8_t                    event_mask_page_2[8];
+
+    // Include the Local Assoc structure.
+    // (This gets filled during initialization. It is used, for example, to 
+    // obtain the local MAC address for forming the 802.3 frame.) 
+    // <<Why don't I just pull out the individ fields I need?  Like MAC addr.>>
+    tBtampHCI_AMP_Assoc       btamp_AMP_Assoc;
+
+    // Remote AMP Assoc
+    tBtampHCI_AMP_Assoc       btamp_Remote_AMP_Assoc;
+
+    tBtampTLVHCI_Location_Data_Info  btamp_Location_Data_Info;
+
+    union
+    {
+        tAuthRsnFsm authFsm;
+        tSuppRsnFsm suppFsm;
+    }uFsm;
+    //LinkSupervision packet
+    tANI_BOOLEAN lsReqPktPending;
+    tANI_BOOLEAN dataPktPending;
+    tANI_U8 retries;
+    vos_pkt_t *pPacket;
+    vos_pkt_t *lsReqPacket;
+    vos_pkt_t *lsRepPacket;
+    v_U16_t    lsPktln;
+    v_U16_t    lsPending;
+    WLANTL_MetaInfoType  metaInfo;   
+    tANI_BOOLEAN isBapSessionOpen;
+
+    tWLAN_BAPLogLinkState  btamp_logical_link_state;
+
+    tBtampLogLinkReqInfo   btamp_logical_link_req_info;
+
+    tANI_BOOLEAN           btamp_async_logical_link_create;
+
+    tANI_BOOLEAN           btamp_logical_link_cancel_pending;
+
+    tANI_BOOLEAN           btamp_session_on;
+
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+    // Include the enclosing VOSS context here
+    v_PVOID_t                 pvosGCtx; 
+
+    //    include the state machine structure here
+
+    // Include the BSL per-application context here
+    v_PVOID_t                 pAppHdl;  // Per-app BSL context
+    // Include the BSL per-association contexts here.
+    // (Right now, there is only one)
+    v_PVOID_t                 pHddHdl;
+    /* 8 bits of phy_link_handle identifies this association */
+    v_U8_t                    phy_link_handle;  
+    // Short Range Mode setting for this physical link
+    v_U8_t                    phy_link_srm;
+
+    // Include the associations STA Id
+    v_U8_t                    ucSTAId;
+
+    // Include the associations MAC addresses
+    v_U8_t                    self_mac_addr[6];
+    v_U8_t                    peer_mac_addr[6];
+
+    // The array of logical links
+    /* the last small integer (<16) value assigned by us */
+    v_U8_t                    current_log_link_index; /* assigned mod 16 */  
+    v_U8_t                    total_log_link_index; /* should never be >16 */  
+    /* The actual array */
+    tBtampLogLinkCtx          btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS];  
+    
+    // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
+    WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB;
+    WLANBAP_STARxCBType       pfnBtamp_STARxCB;
+    WLANBAP_TxCompCBType      pfnBtampTxCompCB;
+
+    /* Implements the callback for ALL asynchronous events. */ 
+    tpWLAN_BAPEventCB         pBapHCIEventCB;
+
+    // Include the Local Assoc structure.
+    // (This gets filled during initialization. It is used, for example, to 
+    // obtain the local MAC address for forming the 802.3 frame.) 
+    // <<Why don't I just pull out the individ fields I need?  Like MAC addr.>>
+    tBtampHCI_AMP_Assoc       btamp_AMP_Assoc;
+    //LinkSupervision packet 
+    tANI_BOOLEAN lsReqPktPending;   
+    tANI_U8 retries;
+    vos_pkt_t *pPacket;
+    vos_pkt_t *lsReqPacket;
+    vos_pkt_t *lsRepPacket;
+    v_U16_t    lsPktln;
+    WLANTL_MetaInfoType*  metaInfo; 
+    tANI_BOOLEAN isBapSessionOpen;
+    //End of LinkSupervision packet
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+    WLANBAP_ConfigType   config;
+    /*multiple data structures getting accessed/written from both north & south
+    bound entities. To avoid multiple access, need a lock*/
+    vos_lock_t           bapLock;
+    // Either Block mode or Pkt mode
+    v_U8_t               ucDataTrafficMode;
+}*ptBtampContext; 
+//tBtampContext, *ptBtampContext;
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+typedef struct sBtampLsPktData {
+    v_U32_t    BufLen;
+    v_U8_t     pBuf[1]; // ptr to Data Buffer
+}tBtampLsPktData, *ptBtampLsPktData;
+
+typedef struct sBtampLsPkt {
+    v_U8_t     SrcMac[6];
+    v_U8_t     DstMac[6];
+    tBtampLsPktData Data;
+} tBtampLsPkt, *ptBtampLsPkt;
+
+/*----------------------------------------------------------------------------
+ *  BAP per-session Context Data Type Declaration
+ * -------------------------------------------------------------------------*/
+// For now, it is just the same thing as the per application context.
+typedef struct sBtampContext tBtampSessCtx;
+
+/*----------------------------------------------------------------------------
+ *  BAP state machine event definition
+ * -------------------------------------------------------------------------*/
+/* The event structure */ 
+typedef struct sWLAN_BAPEvent {
+    v_U32_t   event;  /* State machine input event message */
+    v_PVOID_t params;  /* A VOID pointer type for all possible inputs */
+    v_U32_t   u1;  /* introduced to handle csrRoamCompleteCallback roamStatus */
+    v_U32_t   u2;  /* introduced to handle csrRoamCompleteCallback roamResult */
+} tWLAN_BAPEvent, *ptWLAN_BAPEvent; 
+ 
+// Pick up the BTAMP FSM definitions
+#include "btampFsm.h"
+
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+//  The main per-Physical Link (per WLAN association) context.
+//extern tBtampContext btampCtx;
+extern ptBtampContext  gpBtampCtx;
+
+//  Include the Local AMP Info structure.
+extern tBtampHCI_AMP_Info        btampHCI_AMP_Info;
+//  Include the Local Data Block Size info structure.
+extern tBtampHCI_Data_Block_Size btampHCI_Data_Block_Size;
+//  Include the Local Version info structure.
+extern tBtampHCI_Version_Info   btampHCI_Version_Info;
+//  Include the Local Supported Cmds info structure.
+extern tBtampHCI_Supported_Cmds  btampHCI_Supported_Cmds;
+
+
+/*----------------------------------------------------------------------------
+ *  Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+/* I don't think any of this is needed */
+
+/* TL data path callbacks passed into WLANTL_RegisterSTAClient */
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_STAFetchPktCB 
+
+  DESCRIPTION   
+    The fetch packet callback registered with TL. 
+    
+    It is called by the TL when the scheduling algorithms allows for 
+    transmission of another packet to the module. 
+    It will be called in the context of the BAL fetch transmit packet 
+    function, initiated by the bus lower layer. 
+
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle 
+                    to TL's or HDD's control block can be extracted 
+                    from its context 
+
+    IN/OUT
+    pucSTAId:       the Id of the station for which TL is requesting a 
+                    packet, in case HDD does not maintain per station 
+                    queues it can give the next packet in its queue 
+                    and put in the right value for the 
+    pucAC:          access category requested by TL, if HDD does not have 
+                    packets on this AC it can choose to service another AC 
+                    queue in the order of priority
+
+    OUT
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    tlMetaInfo:    meta info related to the data frame
+
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_STAFetchPktCB 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pucSTAId,
+  v_U8_t                ucAC,
+  vos_pkt_t**           vosDataBuff,
+  WLANTL_MetaInfoType*  tlMetaInfo
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_STARxCB
+
+  DESCRIPTION   
+    The receive callback registered with TL. 
+    
+    TL will call this to notify the client when a packet was received 
+    for a registered STA.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL's or HDD's control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was received
+                    (it may be a linked list) 
+    ucSTAId:        station id
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_STARxCB
+(
+  v_PVOID_t              pvosGCtx, 
+  vos_pkt_t*             vosDataBuff,
+  v_U8_t                 ucSTAId, 
+  WLANTL_RxMetaInfoType* pRxMetaInfo
+);
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_TxCompCB
+
+  DESCRIPTION   
+    The tx complete callback registered with TL. 
+    
+    TL will call this to notify the client when a transmission for a 
+    packet  has ended. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL/HAL/PE/BAP/HDD control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    wTxSTAtus:      status of the transmission 
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS 
+WLANBAP_TxCompCB
+( 
+  v_PVOID_t      pvosGCtx,
+  vos_pkt_t*     vosDataBuff,
+  VOS_STATUS     wTxSTAtus 
+);
+
+/* Callbacks Registered with TL by WLANTL_RegisterBAPClient */
+
+/* RSN Callback */
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    The receive callback registered with TL for BAP. 
+    
+    The registered reception callback is being triggered by TL whenever a 
+    frame was received and it was filtered as a non-data BT AMP packet. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    vosDataBuff:   pointer to the vOSS buffer containing the received packet; 
+                    no chaining will be done on this path 
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+WLANTL_BAPRxCBType WLANBAP_TLRsnRxCallback
+(
+ v_PVOID_t         pvosGCtx,
+ vos_pkt_t*        vosDataBuff
+); 
+
+/* Flush complete Callback */
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Callback registered with TL for BAP, this is required inorder for
+    TL to inform BAP, that the flush operation requested has been completed. 
+    
+    The registered reception callback is being triggered by TL whenever a 
+    frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    ucStaId:        station identifier for the requested value
+    ucTid:          identifier of the tspec 
+    status:         status of the Flush operation
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_TLFlushCompCallback
+( 
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucStaId, 
+  v_U8_t        ucTID, 
+  v_U8_t        status
+);
+
+/*----------------------------------------------------------------------------
+ *  CSR Roam (Connection Status) callback 
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_RoamCallback()
+
+  DESCRIPTION 
+    Callback for Roam (connection status) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+      pContext:  is the pContext passed in with the roam request
+      pParam: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
+      eRoamCmdResult: for detail valid members. It may be NULL
+      roamId: is to identify the callback related roam request. 0 means unsolicited
+      roamStatus: is a flag indicating the status of the callback
+      roamResult: is the result
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+eHalStatus
+WLANBAP_RoamCallback
+(
+  void *pContext, 
+  tCsrRoamInfo *pCsrRoamInfo,
+  tANI_U32 roamId, 
+  eRoamCmdStatus roamStatus, 
+  eCsrRoamResult roamResult
+);
+
+/*----------------------------------------------------------------------------
+ *  Utility Function prototypes 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CleanCB
+
+  DESCRIPTION 
+    Clear out all fields in the BAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:  pointer to the BAP control block
+    freeFlag:   flag indicating whether to free any allocations.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CleanCB
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t freeFlag // 0 /*do not empty*/);
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetCtxFromStaId
+
+  DESCRIPTION 
+    Called inside the BT-AMP PAL (BAP) layer whenever we need either the
+    BSL context or the BTAMP context from the StaId.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    ucSTAId:   The StaId (used by TL, PE, and HAL) 
+   
+    OUT
+    hBtampHandle: Handle (pointer to a pointer) to return the 
+                  btampHandle value in.
+    hHddHdl:      Handle to return the BSL context pointer in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetCtxFromStaId
+( 
+  v_U8_t         ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+  ptBtampHandle *hBtampHandle,  /* Handle to return per app btampHandle value in  */ 
+  ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in  */ 
+  v_PVOID_t     *hHddHdl /* Handle to return BSL context in */
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetStaIdFromLinkCtx
+
+  DESCRIPTION 
+    Called inside the BT-AMP PAL (BAP) layer whenever we need the
+    StaId (or hHddHdl) from the BTAMP context and phy_link_handle.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    hBtampHandle: Handle (pointer to a pointer) to return the 
+                  btampHandle value in.
+    phy_link_handle: physical link handle value. Unique per assoc. 
+    
+    OUT
+    pucSTAId:   The StaId (used by TL, PE, and HAL) 
+    hHddHdl:   Handle to return the BSL context pointer in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetStaIdFromLinkCtx
+( 
+  ptBtampHandle  btampHandle,  /* btampHandle value in  */ 
+  v_U8_t         phy_link_handle,  /* phy_link_handle value in */
+  v_U8_t        *pucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+  v_PVOID_t     *hHddHdl /* Handle to return BSL context */
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CreateNewPhyLinkCtx
+
+  DESCRIPTION 
+    Called in order to create (or update) a BAP Physical Link "context"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle:     BAP app context handle
+    phy_link_handle: phy_link_handle from the Command 
+    pHddHdl:         BSL passes in its specific context
+    
+    OUT
+    hBtampContext:  Handle (pointer to a pointer) to return the 
+                    per "Phy Link" ptBtampContext value in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CreateNewPhyLinkCtx
+( 
+  ptBtampHandle  btampHandle,
+  v_U8_t         phy_link_handle, /*  I get phy_link_handle from the Command */
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+  ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in  */ 
+  tWLAN_BAPRole  BAPDeviceRole  /* Needed to determine which MAC address to use for self MAC  */
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_UpdatePhyLinkCtxStaId
+
+  DESCRIPTION 
+    Called to update the STAId value associated with Physical Link "context"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampContext:   ptBtampContext to update.
+    ucSTAId:         The StaId (used by TL, PE, and HAL) 
+    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_UpdatePhyLinkCtxStaId
+( 
+  ptBtampContext pBtampContext, /* btampContext value in  */ 
+  v_U8_t         ucSTAId
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CreateNewLogLinkCtx
+
+  DESCRIPTION 
+    Called in order to allocate a BAP Logical Link "context" and "index"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampContext:  Pointer to the ptBtampContext value in.
+    phy_link_handle: phy_link_handle involved 
+    
+    OUT
+    pLog_link_handle: return the log_link_handle here 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CreateNewLogLinkCtx
+( 
+  ptBtampContext pBtampContext, /* pointer to the per assoc btampContext value */ 
+  v_U8_t         phy_link_handle, /*  I get phy_link_handle from the Command */
+  v_U8_t         tx_flow_spec[18],
+  v_U8_t         rx_flow_spec[18],
+  v_U16_t         *pLog_link_handle /*  Return the logical link index here */
+);
+
+ /*==========================================================================
+
+  FUNCTION    WLANBAP_pmcFullPwrReqCB
+
+  DESCRIPTION 
+    Callback provide to PMC in the pmcRequestFullPower API. 
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    callbackContext:  The user passed in a context to identify 
+    status:           The halStatus 
+    
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void 
+WLANBAP_pmcFullPwrReqCB
+( 
+  void *callbackContext, 
+  eHalStatus status
+);
+  
+/*===========================================================================
+
+  FUNCTION    WLANBAP_RxProcLsPkt
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision frames are received at BAP
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+    pucAC:       Pointer to return the access category 
+    RxProtoType: Protocol type of Received Packet
+    vosDataBuff: The data buffer containing the 802.3 frame to be 
+                 translated to BT HCI Data Packet
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_RxProcLsPkt
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  v_U16_t            RxProtoType,     /* Protocol Type from the frame received */
+  vos_pkt_t         *vosRxLsBuff
+);
+
+
+/*----------------------------------------------------------------------------
+
+  FUNCTION    WLANBAP_TxLinkSupervisionReq()
+
+  DESCRIPTION 
+    Implements the LinkSupervision Tx Request procedure.This will be called by APIs that want
+    to transmit LinkSupervision Packets  
+    Calls PktPending CB to indicate a packet is pending for transmission
+    
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    btampHandle: pointer to the BAP handle.  Returned from WLANBAP_GetNewHndl.
+    phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId)
+    vosDataBuff:The actual packet being sent in Tx request
+    protoType : specifies if it is a LS REQ or LS REP packet 
+    
+     RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  Failure of Transmit procedure 
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+----------------------------------------------------------------------------*/
+VOS_STATUS
+WLANBAP_TxLinkSupervision
+( 
+  ptBtampHandle     btampHandle, 
+  v_U8_t            phy_link_handle,  /* Used by BAP to indentify the WLAN assoc. (StaId) */
+  vos_pkt_t         *vosDataBuff,
+  v_U16_t           protoType
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_ReadMacConfig
+
+  DESCRIPTION 
+    This function sets the MAC config (Address and SSID to BT-AMP context
+        
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void
+WLANBAP_ReadMacConfig
+( 
+  ptBtampContext  pBtampCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_NeedBTCoexPriority
+
+  DESCRIPTION 
+    This function will cause a message to be sent to BTC firmware
+    if a change in priority has occurred.  (From AMP's point-of-view.)
+        
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to HAL's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void
+WLANBAP_NeedBTCoexPriority
+( 
+  ptBtampContext  pBtampCtx, 
+  v_U32_t         needCoexPriority
+);
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_RxCallback
+
+  DESCRIPTION 
+    This function is called by TL call this function for all frames except for Data frames
+        
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context
+    pPacket         Vos packet
+    frameType       Frame type
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANBAP_RxCallback
+(
+    v_PVOID_t               pvosGCtx, 
+    vos_pkt_t              *pPacket,
+    WLANTL_BAPFrameEnumType frameType
+);
+
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_InitLinkSupervision
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision module is to be initialized when connected at BAP
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+#define TX_LS_DATALEN   32
+
+VOS_STATUS
+WLANBAP_InitLinkSupervision
+( 
+  ptBtampHandle     btampHandle
+);
+
+
+/*===========================================================================
+
+  FUNCTION    WLANBAP_DeInitLinkSupervision
+
+  DESCRIPTION 
+
+    This API will be called when Link Supervision module is to be stopped after disconnected at BAP 
+
+  PARAMETERS 
+
+    btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  BAP handle is NULL  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANBAP_DeInitLinkSupervision
+( 
+  ptBtampHandle     btampHandle 
+);
+
+void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext);
+
+ #ifdef __cplusplus
+ }
+
+
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WLANBAP_INTERNAL_H */
+
diff --git a/CORE/BAP/src/bapModule.c b/CORE/BAP/src/bapModule.c
new file mode 100644
index 0000000..3acdec2
--- /dev/null
+++ b/CORE/BAP/src/bapModule.c
@@ -0,0 +1,1399 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b a p M o d u l e . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN BAP modules
+  Module support functions. It is also where the global BAP module
+  context, and per-instance (returned in BAP_Open device open) contexts. 
+  
+  The functions externalized by this module are to be called by the device
+  specific BAP Shim Layer (BSL) (in HDD) which implements a stream device on a
+  particular platform.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapModule.c,v 1.1 2010/07/12 19:05:35 labuser Exp labuser $$DateTime$$Author: labuser $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-09-15    jez     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+// Pull in some message types used by BTC
+#include "sirParams.h"
+//#include "halFwApi.h"
+ 
+#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+// Pick up the sme callback registration API
+#include "sme_Api.h"
+#include "ccmApi.h"
+
+/* BT-AMP PAL API header file */ 
+#include "bapApi.h" 
+#include "bapInternal.h" 
+
+// Pick up the BTAMP RSN definitions
+#include "bapRsnTxRx.h"
+//#include "assert.h" 
+#include "bapApiTimer.h"
+
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_ANDROID)
+#include "bap_hdd_main.h"
+#endif
+
+//#define BAP_DEBUG
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+//#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) 
+
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+//  include the phy link state machine structure here
+static tWLAN_BAPbapPhysLinkMachine bapPhysLinkMachineInitial 
+    = BTAMPFSM_INSTANCEDATA_INIT;
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+//  No!  Get this from VOS.
+//  The main per-Physical Link (per WLAN association) context.
+//tBtampContext btampCtx;
+ptBtampContext  gpBtampCtx = NULL; 
+
+//  Include the Local AMP Info structure.
+tBtampHCI_AMP_Info        btampHCI_AMP_Info;
+//  Include the Local Data Block Size info structure.
+tBtampHCI_Data_Block_Size btampHCI_Data_Block_Size;
+//  Include the Local Version info structure.
+tBtampHCI_Version_Info   btampHCI_Version_Info;
+//  Include the Local Supported Cmds info structure.
+tBtampHCI_Supported_Cmds  btampHCI_Supported_Cmds;
+
+static unsigned char pBtStaOwnMacAddr[WNI_CFG_BSSID_LEN];
+
+ /*BT-AMP SSID; per spec should have this format: "AMP-00-0a-f5-04-05-08" */
+#define WLAN_BAP_SSID_MAX_LEN 21 
+static char pBtStaOwnSsid[WLAN_BAP_SSID_MAX_LEN];
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Open
+
+  DESCRIPTION 
+    Called at driver initialization (vos_open). BAP will initialize 
+    all its internal resources and will wait for the call to start to 
+    register with the other modules. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Open
+( 
+  v_PVOID_t  pvosGCtx 
+)
+{
+  ptBtampContext  pBtampCtx = NULL; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Allocate (and sanity check?!) BAP control block 
+   ------------------------------------------------------------------------*/
+  vos_alloc_context(pvosGCtx, VOS_MODULE_ID_BAP, (v_VOID_t**)&pBtampCtx, sizeof(tBtampContext));
+
+  pBtampCtx = VOS_GET_BAP_CB(pvosGCtx);
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer from pvosGCtx on WLANBAP_Open");
+                 //"Failed to allocate BAP pointer from pvosGCtx on WLANBAP_Open");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Clean up BAP control block, initialize all values
+   ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Open");
+
+  WLANBAP_CleanCB(pBtampCtx, 0 /*do not empty*/);
+
+  // Setup the "link back" to the VOSS context
+  pBtampCtx->pvosGCtx = pvosGCtx;
+   
+  // Store a pointer to the BAP context provided by VOSS
+  gpBtampCtx = pBtampCtx;
+  
+  /*------------------------------------------------------------------------
+    Allocate internal resources
+   ------------------------------------------------------------------------*/
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_Open */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Start
+
+  DESCRIPTION 
+    Called as part of the overall start procedure (vos_start). BAP will 
+    use this call to register with TL as the BAP entity for 
+    BT-AMP RSN frames. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other codes can be returned as a result of a BAL failure;
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Start
+( 
+  v_PVOID_t  pvosGCtx 
+)
+{
+  ptBtampContext  pBtampCtx = NULL; 
+  VOS_STATUS      vosStatus;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract BAP control block 
+   ------------------------------------------------------------------------*/
+  pBtampCtx = VOS_GET_BAP_CB(pvosGCtx);
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Invalid BAP pointer from pvosGCtx on WLANBAP_Start");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Register with TL as an BT-AMP RSN  client 
+  ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Start TL register");
+
+  /*------------------------------------------------------------------------
+    Register with CSR for Roam (connection status) Events  
+  ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Start CSR Register");
+
+
+  /* Initialize the BAP Tx packet monitor timer */
+  WLANBAP_InitConnectionAcceptTimer (pBtampCtx );
+  WLANBAP_InitLinkSupervisionTimer(pBtampCtx);
+
+  vosStatus = vos_timer_init( 
+          &pBtampCtx->bapTxPktMonitorTimer,
+          VOS_TIMER_TYPE_SW, /* use this type */
+          WLANBAP_TxPacketMonitorHandler,
+          pBtampCtx);
+
+  vosStatus = vos_lock_init(&pBtampCtx->bapLock);
+  if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"Lock Init Fail");
+  }
+
+  return vosStatus;
+}/* WLANBAP_Start */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Stop
+
+  DESCRIPTION 
+    Called by vos_stop to stop operation in BAP, before close. BAP will suspend all 
+    BT-AMP Protocol Adaption Layer operation and will wait for the close 
+    request to clean up its resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Stop
+( 
+  v_PVOID_t  pvosGCtx 
+)
+{
+  ptBtampContext  pBtampCtx = NULL; 
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract BAP control block 
+   ------------------------------------------------------------------------*/
+  pBtampCtx = VOS_GET_BAP_CB(pvosGCtx);
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer from pvosGCtx on WLANBAP_Stop");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Stop BAP (de-register RSN handler!?)  
+   ------------------------------------------------------------------------*/
+  vosStatus = WLANBAP_DeinitConnectionAcceptTimer(pBtampCtx);
+  if ( VOS_STATUS_SUCCESS != vosStatus)
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+               "Couldn't destroy  bapConnectionAcceptTimer");
+  }
+
+  vosStatus = WLANBAP_DeinitLinkSupervisionTimer(pBtampCtx);
+  if ( VOS_STATUS_SUCCESS != vosStatus)
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+               "Couldn't destroy  bapLinkSupervisionTimer");
+  }
+
+  vosStatus = vos_timer_destroy ( 
+    &pBtampCtx->bapTxPktMonitorTimer );
+  if ( VOS_STATUS_SUCCESS != vosStatus)
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+               "Couldn't destroy  bapTxPktMonitorTimer");
+  }
+  vos_lock_destroy(&pBtampCtx->bapLock);
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_Stop */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_Close
+
+  DESCRIPTION 
+    Called by vos_close during general driver close procedure. BAP will clean up 
+    all the internal resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_Close
+( 
+  v_PVOID_t  pvosGCtx 
+)
+{
+  ptBtampContext  pBtampCtx = NULL; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract BAP control block 
+   ------------------------------------------------------------------------*/
+  pBtampCtx = VOS_GET_BAP_CB(pvosGCtx);
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer from pvosGCtx on WLANBAP_Close");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Cleanup BAP control block. 
+   ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Close");
+  WLANBAP_CleanCB(pBtampCtx, 1 /* empty queues/lists/pkts if any*/);
+#if (defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_ANDROID))&& defined(WLAN_BTAMP_FEATURE)
+  BSL_Deinit(pvosGCtx);
+#endif
+  /*------------------------------------------------------------------------
+    Free BAP context from VOSS global 
+   ------------------------------------------------------------------------*/
+  vos_free_context(pvosGCtx, VOS_MODULE_ID_BAP, pBtampCtx);
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_Close */
+
+/*----------------------------------------------------------------------------
+    HDD interfaces - Per instance initialization 
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetNewHndl
+
+  DESCRIPTION 
+    Called by HDD at driver open (BSL_Open). BAP will initialize 
+    allocate a per-instance "file handle" equivalent for this specific
+    open call. 
+    
+    There should only ever be one call to BSL_Open.  Since 
+    the open app user is the BT stack.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    hBtampHandle:   Handle to return btampHandle value in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+
+VOS_STATUS 
+WLANBAP_GetNewHndl
+( 
+   ptBtampHandle *hBtampHandle  /* Handle to return btampHandle value in  */ 
+)
+{
+  ptBtampContext  btampContext = NULL; 
+  /*------------------------------------------------------------------------
+    Sanity check params
+   ------------------------------------------------------------------------*/
+  if ( NULL == hBtampHandle) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP handle pointer in WLANBAP_GetNewHndl");
+    return VOS_STATUS_E_FAULT;
+  }
+
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+  /*------------------------------------------------------------------------
+    Sanity check the BAP control block pointer 
+   ------------------------------------------------------------------------*/
+  if ( NULL == gpBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Invalid BAP pointer in WLANBAP_GetNewHndl");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  //*hBtampHandle = (ptBtampHandle) &btampCtx; 
+  /* return a pointer to the tBtampContext structure - allocated by VOS for us */ 
+  *hBtampHandle = (ptBtampHandle) gpBtampCtx; 
+  btampContext = gpBtampCtx; 
+
+  /* Update the MAC address and SSID if in case the Read Local AMP Assoc
+   * Request is made before Create Physical Link creation.
+   */
+  WLANBAP_ReadMacConfig (btampContext);
+  return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_GetNewHndl */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_ReleaseHndl
+
+  DESCRIPTION 
+    Called by HDD at driver open (BSL_Close). BAP will reclaim (invalidate) 
+    the "file handle" passed into this call.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle:   btampHandle value to invalidate.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  btampHandle is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_ReleaseHndl
+( 
+  ptBtampHandle btampHandle  /* btamp handle value to release  */ 
+)
+{
+  /* obtain btamp Context  */ 
+  ptBtampContext  btampContext = (ptBtampContext) btampHandle; 
+  tHalHandle halHandle;
+  eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+  /*------------------------------------------------------------------------
+    Sanity check params
+   ------------------------------------------------------------------------*/
+  if ( NULL == btampHandle) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP handle value in WLANBAP_ReleaseHndl");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /* JEZ081001: TODO: Major: */ 
+  /* Check to see if any wireless associations are still active */
+  /* ...if so, I have to call 
+   * sme_RoamDisconnect(VOS_GET_HAL_CB(btampHandle->pvosGCtx), 
+   *        btampHandle->sessionId, 
+   *       eCSR_DISCONNECT_REASON_UNSPECIFIED); 
+   * on all of them  */ 
+
+  halHandle = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+  if(NULL == halHandle)
+  {
+     VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "halHandle is NULL in %s", __FUNCTION__);
+     return VOS_STATUS_E_FAULT;
+  }
+
+  if( btampContext->isBapSessionOpen == TRUE )
+  {
+    halStatus = sme_CloseSession(halHandle, 
+            btampContext->sessionId, NULL, NULL);
+    if(eHAL_STATUS_SUCCESS == halStatus)
+    {
+      btampContext->isBapSessionOpen = FALSE;
+    }
+  }
+
+  /* release the btampHandle  */ 
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_ReleaseHndl */
+
+/*----------------------------------------------------------------------------
+ * Utility Function implementations 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CleanCB
+
+  DESCRIPTION 
+    Clear out all fields in the BAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampCtx:  pointer to the BAP control block
+    freeFlag:   flag indicating whether to free any allocations.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to BAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CleanCB
+( 
+  ptBtampContext  pBtampCtx,
+  v_U32_t freeFlag // 0 /*do not empty*/);
+)
+{
+  v_U16_t         i; /* Logical Link index */
+  tpBtampLogLinkCtx  pLogLinkContext = NULL;
+ 
+  /*------------------------------------------------------------------------
+    Sanity check BAP control block 
+   ------------------------------------------------------------------------*/
+
+  if ( NULL == pBtampCtx ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid BAP pointer in WLANBAP_CleanCB");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Clean up BAP control block, initialize all values
+   ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_CleanCB");
+
+  // First, clear out EVERYTHING in the BT-AMP context
+  vos_mem_set( pBtampCtx, sizeof( *pBtampCtx), 0);
+
+  pBtampCtx->pvosGCtx = NULL;
+
+  // Initialize physical link state machine to DISCONNECTED state
+  //pBtampCtx->bapPhysLinkMachine = BTAMPFSM_INSTANCEDATA_INIT;
+   
+  // Initialize physical link state machine to DISCONNECTED state
+  vos_mem_copy( 
+          &pBtampCtx->bapPhysLinkMachine,
+          &bapPhysLinkMachineInitial,   /* BTAMPFSM_INSTANCEDATA_INIT; */
+          sizeof( pBtampCtx->bapPhysLinkMachine));
+
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d", __FUNCTION__, bapPhysLinkMachineInitial.stateVar);   
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initialized State: %d", __FUNCTION__,  pBtampCtx->bapPhysLinkMachine.stateVar); 
+
+  //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  pBtampCtx); 
+#ifdef BAP_DEBUG
+  /* Trace the tBtampCtx being passed in. */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+
+  pBtampCtx->sessionId = 0;
+  pBtampCtx->pAppHdl = NULL; // Per-app BSL context
+  pBtampCtx->pHddHdl = NULL; // Per-app BSL context
+  /* 8 bits of phy_link_handle identifies this association */
+  pBtampCtx->phy_link_handle = 0;  
+  pBtampCtx->channel = 0; 
+  pBtampCtx->BAPDeviceRole = BT_RESPONDER;  
+  pBtampCtx->ucSTAId = 0;  
+
+  // gNeedPhysLinkCompEvent
+  pBtampCtx->gNeedPhysLinkCompEvent = VOS_FALSE;
+  // gPhysLinkStatus 
+  pBtampCtx->gPhysLinkStatus = WLANBAP_STATUS_SUCCESS;
+  // gDiscRequested
+  pBtampCtx->gDiscRequested = VOS_FALSE;
+  // gDiscReason 
+  pBtampCtx->gDiscReason = WLANBAP_STATUS_SUCCESS;
+
+  /* Connection Accept Timer interval*/
+  pBtampCtx->bapConnectionAcceptTimerInterval = WLANBAP_CONNECTION_ACCEPT_TIMEOUT;  
+  /* Link Supervision Timer interval*/
+  pBtampCtx->bapLinkSupervisionTimerInterval = WLANBAP_LINK_SUPERVISION_TIMEOUT;  
+  /* Logical Link Accept Timer interval*/
+  pBtampCtx->bapLogicalLinkAcceptTimerInterval = WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT;  
+  /* Best Effort Flush timer interval*/
+  pBtampCtx->bapBEFlushTimerInterval = WLANBAP_BE_FLUSH_TIMEOUT;  
+
+  // Include the associations MAC addresses
+  vos_mem_copy( 
+          pBtampCtx->self_mac_addr, 
+          pBtStaOwnMacAddr,   /* Where do I get the current MAC address? */
+          sizeof(pBtampCtx->self_mac_addr)); 
+
+  vos_mem_set( 
+          pBtampCtx->peer_mac_addr, 
+          sizeof(pBtampCtx->peer_mac_addr),
+          0); 
+
+  // The array of logical links
+  pBtampCtx->current_log_link_index = 0;  /* assigned mod 16 */  
+  pBtampCtx->total_log_link_index = 0;  /* should never be >16 */  
+
+  // Clear up the array of logical links
+  for (i = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) 
+  {
+     pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i];
+     pLogLinkContext->present = 0; 
+     pLogLinkContext->uTxPktCompleted = 0;
+     pLogLinkContext->log_link_handle = 0;
+  }
+
+
+  // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
+  pBtampCtx->pfnBtampFetchPktCB = NULL;   
+  pBtampCtx->pfnBtamp_STARxCB = NULL;   
+  pBtampCtx->pfnBtampTxCompCB = NULL;   
+  /* Implements the callback for ALL asynchronous events. */ 
+  pBtampCtx->pBapHCIEventCB = NULL;   
+
+  /* Set the default for event mask */ 
+  vos_mem_set( 
+          pBtampCtx->event_mask_page_2, 
+          sizeof(pBtampCtx->event_mask_page_2),
+          0); 
+
+  /* Set the default for location data. */ 
+  pBtampCtx->btamp_Location_Data_Info.loc_options = 0x58;   
+  /* Set the default data transfer mode */ 
+  pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANBAP_CleanCB */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetCtxFromStaId
+
+  DESCRIPTION 
+    Called inside the BT-AMP PAL (BAP) layer whenever we need either the
+    BSL context or the BTAMP context from the StaId.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    ucSTAId:   The StaId (used by TL, PE, and HAL) 
+   
+    OUT
+    hBtampHandle: Handle (pointer to a pointer) to return the 
+                  btampHandle value in.
+    hHddHdl:      Handle to return the BSL context pointer in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetCtxFromStaId
+( 
+  v_U8_t         ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+  ptBtampHandle *hBtampHandle,  /* Handle to return per app btampHandle value in  */ 
+  ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in  */ 
+  v_PVOID_t     *hHddHdl /* Handle to return BSL context in */
+)
+{
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+
+    /* For now, we know there is only one application context */ 
+    /* ...and only one physical link context */ 
+    //*hBtampHandle = &((ptBtampContext) btampCtx);  
+    //*hBtampHandle = &btampCtx;  
+    *hBtampHandle = (v_VOID_t*)gpBtampCtx;  
+  
+    //*hBtampContext = &btampCtx;
+    *hBtampContext = gpBtampCtx;
+
+    /* Handle to return BSL context in */
+    //*hHddHdl = btampCtx.pHddHdl;  
+    *hHddHdl = gpBtampCtx->pHddHdl;  
+
+    return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_GetCtxFromStaId */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_GetStaIdFromLinkCtx
+
+  DESCRIPTION 
+    Called inside the BT-AMP PAL (BAP) layer whenever we need the
+    StaId (or hHddHdl) from the BTAMP context and phy_link_handle.
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    hBtampHandle: Handle (pointer to a pointer) to return the 
+                  btampHandle value in.
+    phy_link_handle: physical link handle value. Unique per assoc. 
+    
+    OUT
+    pucSTAId:   The StaId (used by TL, PE, and HAL) 
+    hHddHdl:   Handle to return the BSL context pointer in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_GetStaIdFromLinkCtx
+( 
+  ptBtampHandle  btampHandle,  /* btampHandle value in  */ 
+  v_U8_t         phy_link_handle,  /* phy_link_handle value in */
+  v_U8_t        *pucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+  v_PVOID_t     *hHddHdl /* Handle to return BSL context */
+)
+{
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+    ptBtampContext           pBtampCtx = (ptBtampContext) btampHandle; 
+    
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if ( NULL == pBtampCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Since there is only one physical link...we have stored all
+     * the physical link specific context in the application context 
+     */ 
+    /* The StaId (used by TL, PE, and HAL) */
+    *pucSTAId = pBtampCtx->ucSTAId;  
+
+    /* Handle to return BSL context */
+    *hHddHdl = pBtampCtx->pHddHdl;  
+
+    return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_GetStaIdFromLinkCtx */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CreateNewPhyLinkCtx
+
+  DESCRIPTION 
+    Called in order to create (or update) a BAP Physical Link "context"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    btampHandle:     BAP app context handle
+    phy_link_handle: phy_link_handle from the Command 
+    pHddHdl:         BSL passes in its specific context
+    
+    OUT
+    hBtampContext:  Handle (pointer to a pointer) to return the 
+                    per "Phy Link" ptBtampContext value in.
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CreateNewPhyLinkCtx
+( 
+  ptBtampHandle  btampHandle,
+  v_U8_t         phy_link_handle, /*  I get phy_link_handle from the Command */
+  v_PVOID_t      pHddHdl,   /* BSL passes in its specific context */
+  ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in  */ 
+  tWLAN_BAPRole  BAPDeviceRole
+)
+{
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+  ptBtampContext  pBtampCtx = gpBtampCtx;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /* Read and Set MAC address and SSID to BT-AMP context */
+  WLANBAP_ReadMacConfig (pBtampCtx);
+
+  /*------------------------------------------------------------------------
+    For now, presume security is not enabled.
+  ------------------------------------------------------------------------*/
+  pBtampCtx->ucSecEnabled = WLANBAP_SECURITY_ENABLED_STATE;
+
+  /*------------------------------------------------------------------------
+    Initial Short Range Mode for this physical link is 'disabled'
+  ------------------------------------------------------------------------*/
+  pBtampCtx->phy_link_srm = 0;
+
+  /*------------------------------------------------------------------------
+    Clear out the logical links.
+  ------------------------------------------------------------------------*/
+  pBtampCtx->current_log_link_index = 0;
+  pBtampCtx->total_log_link_index = 0;
+
+  /*------------------------------------------------------------------------
+    Now configure the roaming profile links. To SSID and bssid.
+  ------------------------------------------------------------------------*/
+  // We have room for two SSIDs.  
+  pBtampCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.  
+  pBtampCtx->csrRoamProfile.SSIDs.SSIDList = pBtampCtx->SSIDList;  //Array of two  
+  pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0;
+  pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE;
+  pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = VOS_FALSE;
+
+  pBtampCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.  
+  pBtampCtx->csrRoamProfile.BSSIDs.bssid = &pBtampCtx->bssid;  
+
+  // Now configure the auth type in the roaming profile. To open.
+  //pBtampCtx->csrRoamProfile.AuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default  
+  //pBtampCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default  
+  pBtampCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_RSN_PSK;   
+  pBtampCtx->csrRoamProfile.negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_AES;  
+
+  pBtampCtx->phy_link_handle = phy_link_handle;
+  /* For now, we know there is only one physical link context */ 
+  //*hBtampContext = &btampCtx;
+
+  pBtampCtx->pHddHdl = pHddHdl;
+
+  *hBtampContext = pBtampCtx;
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Btamp Ctxt = %x", pBtampCtx);
+
+  return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_CreateNewPhyLinkCtx */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_UpdatePhyLinkCtxStaId
+
+  DESCRIPTION 
+    Called to update the STAId value associated with Physical Link "context"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampContext:   ptBtampContext to update.
+    ucSTAId:         The StaId (used by TL, PE, and HAL) 
+    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_UpdatePhyLinkCtxStaId
+( 
+  ptBtampContext pBtampContext, /* btampContext value in  */ 
+  v_U8_t         ucSTAId
+)
+{
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+
+    /*------------------------------------------------------------------------
+        Sanity check params
+      ------------------------------------------------------------------------*/
+    if ( NULL == pBtampContext) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid BAP handle value in %s", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* The StaId (used by TL, PE, and HAL) */
+    pBtampContext->ucSTAId = ucSTAId;  
+
+    return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_UpdatePhyLinkCtxStaId */
+
+v_U8_t 
+bapAllocNextLogLinkIndex
+( 
+  ptBtampContext pBtampContext, /* Pointer to the per assoc btampContext value */ 
+  v_U8_t         phy_link_handle /*  I get phy_link_handle from the Command */
+)
+{
+  return ++(pBtampContext->current_log_link_index) % WLANBAP_MAX_LOG_LINKS; 
+}/* bapAllocNextLogLinkIndex */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_CreateNewLogLinkCtx
+
+  DESCRIPTION 
+    Called in order to allocate a BAP Logical Link "context" and "index"
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pBtampContext:  Pointer to the ptBtampContext value in.
+    phy_link_handle: phy_link_handle involved 
+    
+    OUT
+    pLog_link_handle: return the log_link_handle here 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  NULL pointer; access would cause a page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANBAP_CreateNewLogLinkCtx
+( 
+  ptBtampContext pBtampContext, /* Pointer to the per assoc btampContext value */ 
+  v_U8_t         phy_link_handle, /*  I get phy_link_handle from the Command */
+  v_U8_t         tx_flow_spec[18],
+  v_U8_t         rx_flow_spec[18],
+  v_U16_t         *pLog_link_handle /*  Return the logical link index here */
+)
+{
+#ifndef BTAMP_MULTIPLE_PHY_LINKS
+  v_U16_t         i; /* Logical Link index */
+  tpBtampLogLinkCtx        pLogLinkContext;
+  v_U32_t         retval;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    For now, allocate the logical links serially.
+  ------------------------------------------------------------------------*/
+  i = pBtampContext->current_log_link_index 
+      = bapAllocNextLogLinkIndex(pBtampContext, phy_link_handle);
+  pBtampContext->total_log_link_index++; 
+
+  *pLog_link_handle = (i << 8) + ( v_U16_t ) phy_link_handle ; /*  Return the logical link index here */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                    " %s:*pLog_link_handle=%x", __FUNCTION__,*pLog_link_handle);
+
+  /*------------------------------------------------------------------------
+    Evaluate the Tx and Rx Flow specification for this logical link.
+  ------------------------------------------------------------------------*/
+  // Currently we only support flow specs with service types of BE (0x01) 
+
+#ifdef BAP_DEBUG
+  /* Trace the tBtampCtx being passed in. */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN BAP Context Monitor: pBtampContext value = %x in %s:%d", pBtampContext, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+  /*------------------------------------------------------------------------
+    Now configure the Logical Link context.
+  ------------------------------------------------------------------------*/
+  pLogLinkContext = &(pBtampContext->btampLogLinkCtx[i]);
+
+  /* Extract Tx flow spec into the context structure */
+  retval = btampUnpackTlvFlow_Spec((void *)pBtampContext, tx_flow_spec,
+                          WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN,
+                          &pLogLinkContext->btampFlowSpec);
+  if (retval != BTAMP_PARSE_SUCCESS)
+  {
+    /* Flow spec parsing failed, return failure */
+    return VOS_STATUS_E_BADMSG;
+  }
+
+  /* Save the Logical link handle in the logical link context
+     As of now, only the index is saved as logical link handle since
+     same is returned in the event.
+     FIXME: Decide whether this index has to be combined with physical
+     link handle to generate the Logical link handle.
+     */
+  pLogLinkContext->log_link_handle = *pLog_link_handle;
+
+  // Mark this entry as OCCUPIED 
+  pLogLinkContext->present = VOS_TRUE;
+  // Now initialize the Logical Link context
+  pLogLinkContext->btampAC = 1;
+  // Now initialize the values in the Logical Link context
+  pLogLinkContext->ucTID = 0;   // Currently we only support BE TID (0x00)
+  pLogLinkContext->ucUP = 0;
+  pLogLinkContext->uTxPktCompleted = 0;
+
+  return VOS_STATUS_SUCCESS;
+#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
+
+#endif //BTAMP_MULTIPLE_PHY_LINKS
+}/* WLANBAP_CreateNewLogLinkCtx */
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_pmcFullPwrReqCB
+
+  DESCRIPTION 
+    Callback provide to PMC in the pmcRequestFullPower API. 
+    
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    callbackContext:  The user passed in a context to identify 
+    status:           The halStatus 
+    
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void 
+WLANBAP_pmcFullPwrReqCB
+( 
+  void *callbackContext, 
+  eHalStatus status
+)
+{
+
+}/* WLANBAP_pmcFullPwrReqCB */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_ReadMacConfig
+
+  DESCRIPTION 
+    This function sets the MAC config (Address and SSID to BT-AMP context
+        
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void
+WLANBAP_ReadMacConfig
+( 
+  ptBtampContext  pBtampCtx 
+)
+{
+  tANI_U32        len = WNI_CFG_BSSID_LEN;
+  tHalHandle      pMac = NULL;
+
+  /*------------------------------------------------------------------------
+    Temporary method to get the self MAC address
+  ------------------------------------------------------------------------*/
+  if (NULL == pBtampCtx) 
+  {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "pBtampCtx is NULL in %s", __FUNCTION__);
+
+      return;
+  }
+
+  pMac = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pBtampCtx->pvosGCtx);
+  if (NULL == pMac) 
+  {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "pMac is NULL in %s", __FUNCTION__);
+
+      return;
+  }
+
+  ccmCfgGetStr( pMac, WNI_CFG_STA_ID, pBtStaOwnMacAddr, &len );
+
+  VOS_ASSERT( WNI_CFG_BSSID_LEN == len );
+  
+  /* Form the SSID from Mac address */
+  VOS_SNPRINTF( pBtStaOwnSsid, WLAN_BAP_SSID_MAX_LEN,
+            "AMP-%02x-%02x-%02x-%02x-%02x-%02x",
+            pBtStaOwnMacAddr[0], pBtStaOwnMacAddr[1], pBtStaOwnMacAddr[2], 
+            pBtStaOwnMacAddr[3], pBtStaOwnMacAddr[4], pBtStaOwnMacAddr[5]);
+
+  /*------------------------------------------------------------------------
+    Set the MAC address for this instance
+  ------------------------------------------------------------------------*/
+  vos_mem_copy( 
+          pBtampCtx->self_mac_addr, 
+          pBtStaOwnMacAddr,
+          sizeof(pBtampCtx->self_mac_addr)); 
+ 
+  /*------------------------------------------------------------------------
+    Set our SSID value
+  ------------------------------------------------------------------------*/
+  pBtampCtx->ownSsidLen = 21; 
+  vos_mem_copy(
+          pBtampCtx->ownSsid, 
+          pBtStaOwnSsid,
+          pBtampCtx->ownSsidLen); 
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_NeedBTCoexPriority
+
+  DESCRIPTION 
+    This function will cause a message to be sent to BTC firmware
+    if a change in priority has occurred.  (From AMP's point-of-view.)
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to HAL's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+// Global
+static int gBapCoexPriority = 0;
+
+void
+WLANBAP_NeedBTCoexPriority
+( 
+  ptBtampContext  pBtampCtx, 
+  v_U32_t         needCoexPriority
+)
+{
+  tHalHandle      pMac = NULL;
+  tSmeBtAmpEvent  btAmpEvent;
+
+
+  /*------------------------------------------------------------------------
+    Retrieve the pMac (HAL context)
+  ------------------------------------------------------------------------*/
+  pMac = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pBtampCtx->pvosGCtx);
+
+  // Is re-entrancy protection needed for this?
+  if (needCoexPriority != gBapCoexPriority) {
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, 
+            "Calling %s with needCoexPriority=%d.", __FUNCTION__, needCoexPriority);
+ 
+    gBapCoexPriority = needCoexPriority;
+    switch ( needCoexPriority)
+    {
+      case 0:  /* Idle */
+          btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_TERMINATED;
+          pBtampCtx->btamp_session_on = FALSE;
+          sme_sendBTAmpEvent(pMac, btAmpEvent);
+
+          break;
+
+      case 1:  /* Associating */
+          btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_START;
+          pBtampCtx->btamp_session_on = TRUE;
+          sme_sendBTAmpEvent(pMac, btAmpEvent);
+
+          break;
+
+      case 2:  /* Post-assoc */
+          btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_STOP;
+          sme_sendBTAmpEvent(pMac, btAmpEvent);
+
+          break;
+
+      default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid Coexistence priority request: %d",
+                   __FUNCTION__, needCoexPriority);
+    }
+
+  }
+}
+
+
+/*==========================================================================
+
+  FUNCTION    WLANBAP_RxCallback
+
+  DESCRIPTION 
+    This function is called by TL call this function for all frames except for Data frames
+        
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to BAP's 
+                    control block can be extracted from its context
+    pPacket         Vos packet
+    frameType       Frame type
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANBAP_RxCallback
+(
+    v_PVOID_t               pvosGCtx, 
+    vos_pkt_t              *pPacket,
+    WLANTL_BAPFrameEnumType frameType
+)
+{
+    ptBtampContext  pBtampCtx = NULL; 
+
+    pBtampCtx = VOS_GET_BAP_CB(pvosGCtx);
+    if ( NULL == pBtampCtx ) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "Invalid BAP pointer from pvosGCtx on WLANBAP_Start");
+      return VOS_STATUS_E_FAULT;
+    }
+
+    switch (frameType)
+    {
+      case WLANTL_BT_AMP_TYPE_LS_REQ:  /* Fall through */
+      case WLANTL_BT_AMP_TYPE_LS_REP:
+      {
+          /* Link supervision frame, process this frame */
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                     "%s: link Supervision packet received over TL: %d, => BAP",
+                     __FUNCTION__, frameType);
+          WLANBAP_RxProcLsPkt((ptBtampHandle)pBtampCtx,
+                               pBtampCtx->phy_link_handle,
+                               frameType,
+                               pPacket);
+          break;
+      }
+
+      case WLANTL_BT_AMP_TYPE_AR: /* Fall through */
+      case WLANTL_BT_AMP_TYPE_SEC:
+      {
+          /* Call the RSN callback handler */
+          bapRsnRxCallback (pvosGCtx, pPacket);
+          break;
+      }
+
+      default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid frametype from TL: %d, => BAP",
+                   __FUNCTION__, frameType);
+    }
+
+    return ( VOS_STATUS_SUCCESS );
+}
diff --git a/CORE/BAP/src/bapRsn8021xAuthFsm.c b/CORE/BAP/src/bapRsn8021xAuthFsm.c
new file mode 100644
index 0000000..9c89829
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xAuthFsm.c
@@ -0,0 +1,1614 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xAuthRsnFsm.c $
+ *
+ * Contains definitions for the RSN EAPOL-Key FSM on the
+ * authenticator side. This is based on 802.11i.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-December-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#include "vos_types.h"
+#include "bapRsnSsmServices.h"
+#include "bapRsnSsmEapol.h"
+#include "bapRsnErrors.h"
+#include "bapInternal.h"
+#include "bapRsn8021xFsm.h"
+#include "bapRsn8021xAuthFsm.h"
+#include "vos_utils.h"
+#include "vos_memory.h"
+#include "vos_timer.h"
+#include "bapRsnTxRx.h"
+#include "bapRsnSsmAesKeyWrap.h"
+#include "btampFsm.h"
+
+// The different states that this FSM transitions through
+#define DISCONNECT           0
+#define DISCONNECTED         1
+#define INITIALIZE           2
+#define AUTHENTICATION       3
+#define AUTHENTICATION_2     4
+#define GET_PSK              5   
+#define GET_EAP_KEY          6
+#define PTK_START            7
+#define PTK_INIT_NEGO        8
+#define PTK_INIT_NEGO_TX     9
+#define PTK_INIT_DONE       10
+#define UPDATE_KEYS_REQ     11
+#define INTEG_FAILURE       12
+#define KEY_UPDATE          13
+#define NUM_STATES (KEY_UPDATE + 1)
+
+
+
+static tAuthRsnFsmConsts authConsts = { 2000, 3 };  //timeout, retry limit
+static v_U8_t aniSsmIeRsnOui[] = ANI_SSM_IE_RSN_OUI;
+
+
+/**************************************
+ * Static functions in this module
+ **************************************/
+
+static 
+int zeroOutPtk(tAuthRsnFsm *fsm);
+static 
+int stopAllTimers(tAuthRsnFsm *fsm);
+
+static
+int checkMic(tAuthRsnFsm *fsm, 
+             tAniEapolKeyAvailEventData *data);
+
+static 
+int checkLocalReplayCounter(tAuthRsnFsm *fsm, 
+                            tAniEapolKeyAvailEventData *data);
+static 
+int checkPeerReplayCounter(tAuthRsnFsm *fsm, 
+                           tAniEapolKeyAvailEventData *data);
+
+static int checkInfoElement(tAuthRsnFsm *fsm,
+                            tAniEapolKeyAvailEventData *data);
+
+static
+int derivePtk(tAuthRsnFsm *fsm, 
+              tAniEapolKeyAvailEventData *data);
+
+
+static int checkTransition(tAuthRsnFsm *fsm, void *arg);
+
+static int
+gotoStateInit(tAuthRsnFsm *fsm);
+
+static void msg2TimerCallback( void * );
+static void msg4TimerCallback( void * );
+
+static int authRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket );
+static int authRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus );
+
+/********************************
+ * Functions Forward Declarations
+ ********************************/
+
+int authRsnAuthStartEventHandler( tAuthRsnFsm *fsm );
+int authRsnAuthDisconEventHandler( tAuthRsnFsm *fsm );
+
+/*************************
+ * The exported functions
+ *************************/
+
+/**
+ * authRsnFsmInit
+ *
+ * FUNCTION:
+ * Initializes the constants and the callbacks needed by this FSM
+ * module.
+ *
+ * @param consts the various constant values needed by this FSM
+ * @param cb callbacks to the various procedures needed by this FSM
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmInit(tAuthRsnFsmConsts *constsIn)
+{
+    // TODO: Read the constants in from config
+    // authConsts = *constsIn;
+    authConsts.timeoutPeriod = 2000;    //ms
+    authConsts.maxTries = 3;
+
+    return ANI_OK;
+}
+
+/**
+ * authRsnFsmCreate
+ *
+ * FUNCTION
+ * Allocates and initializes the state of an RSN key FSM instance for
+ * the given STA context.
+ * 
+ * @parm staCtx the STA context whose instance is being created
+ * @param pskBased pass in eANI_BOOLEAN_TRUE is this STA is to be
+ * authenticated based on a pre-shared key as opposed to EAP.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmCreate(tBtampContext *ctx)
+{
+    int retVal = ANI_OK;
+    tAuthRsnFsm *fsm = &ctx->uFsm.authFsm;
+
+    // First, clear everything out
+    vos_mem_zero( fsm, sizeof(tAuthRsnFsm));
+
+    if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( authRsnTxCompleteHandler,
+                                            authRsnRxFrameHandler ) ) )
+    {
+        return ANI_ERROR;
+    }
+
+    if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) )
+    {
+        return ANI_ERROR;
+    }
+
+    // Allocate the station context
+    fsm->staCtx = (tStaContext *)vos_mem_malloc( sizeof(tStaContext) );
+    if (fsm->staCtx == NULL) 
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+    // Clear out the station context
+    vos_mem_zero( fsm->staCtx, sizeof(tStaContext) );
+    
+    fsm->ctx = ctx;
+    fsm->staCtx->authRsnFsm = fsm;
+    //Only support CCMP
+    fsm->staCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES;
+
+    if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg2Timer, VOS_TIMER_TYPE_SW, msg2TimerCallback, fsm ) ) )
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg4Timer, VOS_TIMER_TYPE_SW, msg4TimerCallback, fsm ) ) )
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol,
+                                          RSN_MAX_PACKET_SIZE,
+                                          EAPOL_TX_HEADER_SIZE );
+    if (retVal != ANI_OK) 
+    {
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    aniAsfPacketAllocate(&fsm->staCtx->pmk);
+    if (fsm->staCtx->pmk == NULL) 
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    aniAsfPacketAllocateExplicit(&fsm->staCtx->ieSta,
+                                 RSN_IE_MAX_PACKET_SIZE,
+                                 RSN_IE_HEADER_SIZE );
+    if (fsm->staCtx->ieSta == NULL) 
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    fsm->cryptHandle = 0;
+    if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) )
+    {
+        retVal = ANI_E_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    fsm->currentState = INITIALIZE;
+    gotoStateInit(fsm);
+
+    //We can call this function here because it is connected at this time
+    authRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL );
+
+    return ANI_OK;
+
+ error:
+    authRsnFsmFree(ctx);
+
+    return retVal;
+    
+}
+
+/**
+ * authRsnFsmFree
+ *
+ * FUNCTION
+ * Frees a previously allocated RSN Key FSM in a STA context. If the
+ * RSN Key FSM is not yet allocated, then this is an error.
+ * 
+ * @param ctx the STA context whose FSM instance is to be freed
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmFree(tBtampContext *ctx)
+{
+    tAuthRsnFsm *fsm = &ctx->uFsm.authFsm;
+
+    VOS_ASSERT(fsm);
+
+    if( fsm->cryptHandle)
+    {
+        vos_crypto_deinit( fsm->cryptHandle );
+    }
+     
+    bapRsnClearTxRxCallbacks(); 
+
+    if ( fsm->staCtx )
+    {
+        fsm->staCtx->authRsnFsm = NULL;
+    }
+
+    if ( VOS_TIMER_STATE_UNUSED != fsm->msg2Timer.state ) vos_timer_destroy( &fsm->msg2Timer );
+    if ( VOS_TIMER_STATE_UNUSED != fsm->msg4Timer.state ) vos_timer_destroy( &fsm->msg4Timer );
+
+    if (fsm->lastEapol)
+    {    
+        aniAsfPacketFree(fsm->lastEapol);
+        fsm->lastEapol = NULL; 
+    }
+
+    if( fsm->staCtx )
+    {
+        if( fsm->staCtx->pmk )
+        {
+            aniAsfPacketFree( fsm->staCtx->pmk );
+            fsm->staCtx->pmk = NULL;
+        }
+       vos_mem_free(fsm->staCtx);
+       fsm->staCtx = NULL; 
+    }
+
+    vos_mem_zero( fsm, sizeof(tAuthRsnFsm) );
+
+    return ANI_OK;
+}
+
+/**
+ * authRsnFsmProcessEvent
+ *
+ * FUNCTION
+ * Passes an event to the RSN key FSM instance for immediate processing.
+ * 
+ * @param fsm the RSN Key FSM instance
+ * @param eventId the AAG event to process
+ * @param arg an optional argument for this event
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmProcessEvent(tAuthRsnFsm *fsm, tRsnFsmEvent eventId, void *arg)
+{
+    VOS_ASSERT(fsm);
+
+    switch (eventId) {
+    case RSN_FSM_TIMER_EXPIRED:
+        // Proceed straight to checkTransition
+        break;
+    case RSN_FSM_AUTH_START:
+        fsm->authReq = eANI_BOOLEAN_TRUE;
+        authRsnAuthStartEventHandler(fsm);
+        break;
+    case RSN_FSM_EAPOL_FRAME_AVAILABLE:
+        fsm->eapolAvail = eANI_BOOLEAN_TRUE;
+        break;
+    case RSN_FSM_DISCONNECT:
+        fsm->disconnect = eANI_BOOLEAN_TRUE;
+        authRsnAuthDisconEventHandler(fsm);
+        break;
+    case RSN_FSM_INTEG_FAILED:
+        fsm->integFailed = eANI_BOOLEAN_TRUE;
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Unknown event for Auth RSN Key Fsm: %d\n", eventId);
+        VOS_ASSERT( 0 );
+        return ANI_E_ILLEGAL_ARG;
+        break;
+    }
+
+    checkTransition(fsm, arg);
+
+    return ANI_OK;;
+}
+
+
+int
+authRsnAuthStartEventHandler(tAuthRsnFsm *fsm)
+{
+    static v_U8_t btampStaRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 
+        0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 };
+    // Copy required info
+    vos_mem_copy( &fsm->staCtx->authMac, fsm->ctx->self_mac_addr, 6);
+    vos_mem_copy( &fsm->staCtx->suppMac, fsm->ctx->peer_mac_addr, 6);
+    aniAsfPacketAppendBuffer( fsm->staCtx->pmk, fsm->ctx->key_material, fsm->ctx->key_length);
+
+    aniAsfPacketAppendBuffer( fsm->staCtx->ieSta, btampStaRSNIE, sizeof(btampStaRSNIE));
+    return ANI_OK;
+}
+
+int
+authRsnAuthDisconEventHandler(tAuthRsnFsm *fsm)
+{
+    // Free Stactx .?
+    return ANI_OK;
+}
+
+/***********************
+ * The static functions
+ ***********************/
+
+static int
+gotoStateInit(tAuthRsnFsm *fsm)
+{
+    fsm->currentState = INITIALIZE;
+
+    // TODO: Move this to a global position which applies to WEP as
+    // well 
+    //initGlobalKeys = eANI_BOOLEAN_FALSE; 
+
+    fsm->authReq = eANI_BOOLEAN_FALSE;
+    fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+    fsm->disconnect = eANI_BOOLEAN_FALSE;
+    fsm->integFailed = eANI_BOOLEAN_FALSE;
+
+    fsm->numTries = 0;
+
+    // Create two replay counter's..one for our requests, and another
+    // for STA's requests. Initialize the first one randomly.
+    aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->staCtx->localReplayCtr, 
+                          ANI_EAPOL_KEY_RSN_RSC_SIZE, 0);
+    aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->staCtx->peerReplayCtr, 
+                          ANI_EAPOL_KEY_RSN_RSC_SIZE, 0);
+
+    return ANI_OK;
+}
+
+static int
+gotoStateAuthentication(tAuthRsnFsm *fsm)
+{
+    fsm->currentState = AUTHENTICATION;
+
+    zeroOutPtk(fsm);
+    fsm->authReq = eANI_BOOLEAN_FALSE;
+
+    checkTransition(fsm, NULL); // UCT rule
+
+    return ANI_OK;
+}
+
+static int
+gotoStateAuthentication2(tAuthRsnFsm *fsm)
+{
+    fsm->currentState = AUTHENTICATION_2;
+
+    if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( fsm->cryptHandle, fsm->aNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE ) ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "gotoStateAuthentication2 fail to get random number. Disconnect\n" );
+        bapAuthDisconnect( fsm->ctx );
+        return ANI_ERROR;
+    }
+    fsm->numTries = 0;
+
+    checkTransition(fsm, NULL); // UCT rule
+
+    return ANI_OK;
+}
+
+
+static int
+gotoStateGetPsk(tAuthRsnFsm *fsm)
+{
+    //This is simply a transaction because we already have the PMK. We always do.
+    fsm->currentState = GET_PSK;
+
+    fsm->numTries = 0;
+    
+    checkTransition(fsm, NULL);
+    
+    return ANI_OK;
+}
+
+static int
+gotoStatePtkStart(tAuthRsnFsm *fsm)
+{
+    tAniEapolRsnKeyDesc txDesc;
+    int retVal;
+
+    fsm->msg2TimeOut = VOS_FALSE;
+    fsm->currentState = PTK_START;
+
+    // Create a new packet if we don't have one to retransmit
+    //if (aniAsfPacketGetLen(fsm->lastEapol) == 0) 
+#if 0    
+    if( fsm->lastEapol )
+    {
+        aniAsfPacketFree( fsm->lastEapol );
+        fsm->lastEapol = NULL;
+
+    retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol,
+                                          RSN_MAX_PACKET_SIZE,
+                                          EAPOL_TX_HEADER_SIZE );
+#endif    
+    aniAsfPacketEmptyExplicit(fsm->lastEapol, 
+                              EAPOL_TX_HEADER_SIZE);
+    //}
+   // if (1) 
+    //{
+
+        vos_mem_zero( &txDesc, sizeof(txDesc) );
+
+        // The Key Information bits...
+        if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) 
+        {
+            txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
+        } 
+        else {
+            return ANI_E_ILLEGAL_ARG;
+        }
+        txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
+        txDesc.info.ackFlag = eANI_BOOLEAN_TRUE;
+
+        // The other fields...
+        txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType);
+        aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter);
+        vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce));
+
+        retVal = aniEapolWriteKey(fsm->cryptHandle,
+                                  fsm->lastEapol,
+                                  fsm->staCtx->suppMac,
+                                  fsm->staCtx->authMac,
+                                  ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                  &txDesc,
+                                  NULL, 0);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            return retVal;
+        }
+#if 0
+    } 
+    else {
+        retransmit = eANI_BOOLEAN_TRUE;
+    }
+#endif    
+
+    if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+    {
+        retVal = ANI_OK;
+    }
+    else
+    {
+        //we fail to send the eapol frame disconnect
+        bapAuthDisconnect( fsm->ctx );
+        retVal = ANI_ERROR;
+    }
+
+    return retVal;
+}
+
+static int
+gotoStatePtkInitNego(tAuthRsnFsm *fsm, void *arg)
+{
+    fsm->currentState = PTK_INIT_NEGO;
+
+    // Replay counter will be automatically updated when we create a
+    // new packet
+
+    fsm->numTries = 0;
+    aniAsfPacketEmptyExplicit(fsm->lastEapol, 
+                              EAPOL_TX_HEADER_SIZE);
+
+    checkTransition(fsm, arg);
+
+    return ANI_OK;
+}
+
+// Use this only with trusted IE like the one we generated locally
+static int
+getRsnIeFromAdvertizedIes(tAuthRsnFsm *fsm, v_U8_t **rsnIe)
+{
+    int retVal = ANI_E_ILLEGAL_ARG;
+    v_U8_t *ptr = fsm->advertizedRsnIe;
+
+    if (*ptr == ANI_SSM_IE_RSN_ELEM_ID) 
+    {
+        retVal = *(ptr + 1) + 2; // The L field from the TLV + 2B TL
+        *rsnIe = ptr;
+    }
+
+    return retVal;
+}
+
+// Use this only with trusted IE like the one we generated locally
+static void
+addPad( 
+    v_U8_t *dataBytes,
+    int dataLen,
+    int padLen)
+{
+    int i;
+
+    // The first byte of padding is 0xdd.  The rest are 0x00's
+    // See 802.11i section 8.5.2 subsection "Key Data Encapsulation"
+
+    for ( i=dataLen ; i < dataLen+padLen; i++) 
+    {
+        if ( i == dataLen ) 
+        {
+            dataBytes[i] = 0xdd;
+        } 
+        else {
+            dataBytes[i] = 0x00;
+        }
+    }
+
+    return;
+}
+
+/**
+ * aagAppendGroupKeyForRsn
+ *
+ * Appends the group key to the packet in the RSN key encapulation format.
+ *
+ * @param packet - the packet to append to
+ * @param radioId - the radio whose group key needs to be appended
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+#define STATIC_WEP_KEY_LEN 16
+#define GROUP_KEY_ID 0
+#define ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID       0xDD
+#define ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID 1
+
+int
+aagAppendGroupKeyForRsn(tAniPacket *packet)
+{
+#if 0
+    tAniPacket *groupKey = NULL;
+#else
+    tANI_U8 groupKey[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+                          0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15};
+#endif
+    tANI_U8 *groupKeyBytes = NULL;
+    tANI_U8 *lenPtr = NULL;
+    tANI_U8 *endPtr = NULL;
+    int groupKeyLen;
+    int retVal;
+
+#if 0
+    groupKey = AAG_GROUP_KEY(radioId);
+    if (groupKey == NULL) {
+        ANI_AAG_LOG_E("Group key is not yet set on radio %d, id %d!",
+                      radioId, AAG_GROUP_KEY_ID(radioId));
+        assert(0 && "Group key is still NULL!");
+        return ANI_E_FAILED;
+    }
+
+    groupKeyLen = aniAsfPacketGetBytes(groupKey, &groupKeyBytes);
+    CHECK_NO_ERROR(groupKeyLen);
+
+    if (aagConfig.logLevel >= LOG_INFO) {
+        ANI_AAG_LOG_D("Will encapsulate group key bytes %s",
+                      aniAsfHexStr(groupKeyBytes, groupKeyLen));
+    }
+#else
+    groupKeyBytes = groupKey;
+
+    groupKeyLen = STATIC_WEP_KEY_LEN;
+#endif
+
+    /*
+     * Add the key data encapsulation needed for RSN/WPA2
+     */
+
+    // The IE ID
+    retVal = aniAsfPacketAppend8(packet, ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID);
+    //CHECK_NO_ERROR(retVal);
+
+    // Obtain the position for the length
+    aniAsfPacketGetBytesFromTail(packet, &lenPtr);
+
+    // Write out a dummy length - we'll fill this in later. It will be 
+    // 6 bytes more than the length of the GTK
+    retVal = aniAsfPacketAppend8(packet, 0);
+    //CHECK_NO_ERROR(retVal);
+
+    // Copy the RSN OUI
+    retVal = aniAsfPacketAppendBuffer(packet, aniSsmIeRsnOui, sizeof(aniSsmIeRsnOui));
+    //CHECK_NO_ERROR(retVal);
+
+    // Indicate that the key type is group key
+    retVal = aniAsfPacketAppend8(packet, ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID);
+    //CHECK_NO_ERROR(retVal);
+ 
+    // Copy the key-id to the first two bits of the next byte
+    // Copy the Tx bit the third bit of the same byte
+    // (Here, I assume the Group Key is to be used for both STA Tx and Rx)
+    retVal = aniAsfPacketAppend8(
+            packet,
+            GROUP_KEY_ID );
+            //AAG_GROUP_KEY_ID(radioId) );
+    //CHECK_NO_ERROR(retVal);
+
+    retVal = aniAsfPacketMoveRight(packet, 1); // Reserved bits (1 byte)
+    //CHECK_NO_ERROR(retVal);
+
+    // Copy the real key bytes
+    retVal = aniAsfPacketAppendBuffer(packet, groupKeyBytes, groupKeyLen);
+    //CHECK_NO_ERROR(retVal);
+    
+    // Calculate and enter the length of the entire encoding
+    aniAsfPacketGetBytesFromTail(packet, &endPtr);
+    *lenPtr = endPtr - (lenPtr + 1) ; // subtract one to avoid tail
+
+    return retVal;
+}
+
+static int
+gotoStatePtkInitNegoTx(tAuthRsnFsm *fsm)
+{
+    tAniEapolRsnKeyDesc txDesc;
+    v_BOOL_t retransmit = eANI_BOOLEAN_FALSE;
+    v_U8_t *rsnWpaIe = NULL;
+    int rsnWpaIeLen;
+    static tAniPacket *keyData = NULL;
+    // The longest length...the extra 8 bytes account for RSN key data
+    // encapsulation
+    v_U8_t paddedGroupKeyEncaps[1024];
+    int padLen = 0;
+    v_U8_t *groupKeyBytes;
+    int groupKeyLen;
+    v_U8_t *wrappedKey = NULL;
+    // Variables used for RC4 GTK wrap
+    //v_U8_t keyIv[ANI_EAPOL_KEY_RSN_IV_SIZE];
+    //v_U32_t keyIvLsb;
+    int retVal = 0;
+
+    //invalidate this
+    fsm->msg4TimeOut = VOS_FALSE;
+    fsm->currentState = PTK_INIT_NEGO_TX ;
+
+    if (keyData == NULL) 
+    {
+        // Allocate the packet the first time around that you enter
+        retVal = aniAsfPacketAllocateExplicit(&keyData, 1024, 10);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            return retVal;
+        }
+    } 
+    else {
+        // Just empty out the packet
+        aniAsfPacketEmptyExplicit(keyData, 10);
+    }
+
+    do
+    {
+        // Create a new EAPOL frame if we don't have one to retransmit
+        //if (aniAsfPacketGetLen(fsm->lastEapol) == 0) 
+#if 0
+        if( fsm->lastEapol )
+         {
+             aniAsfPacketFree( fsm->lastEapol );
+             fsm->lastEapol = NULL;
+
+             retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol,
+                                          RSN_MAX_PACKET_SIZE,
+                                          EAPOL_TX_HEADER_SIZE );
+#endif     
+             aniAsfPacketEmptyExplicit(fsm->lastEapol, 
+                              EAPOL_TX_HEADER_SIZE);
+      //  }
+
+        if (1) 
+        {
+
+            vos_mem_zero( &txDesc, sizeof(txDesc) );
+
+            // The Key Information bits...
+            if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) 
+            {
+                txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
+            } 
+            else {
+                txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_RC4;
+            }
+            txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
+            txDesc.info.installFlag = eANI_BOOLEAN_TRUE;
+            txDesc.info.ackFlag = eANI_BOOLEAN_TRUE;
+            txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
+
+            txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType);
+            aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter);
+            vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce));
+
+            // Add the RSN IE (but not any WPA IE)
+            rsnWpaIeLen = getRsnIeFromAdvertizedIes(fsm, &rsnWpaIe);
+
+            if( !ANI_IS_STATUS_SUCCESS( rsnWpaIeLen) ) break;
+
+            retVal = aniAsfPacketAppendBuffer(keyData, rsnWpaIe, rsnWpaIeLen);
+            if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+            // Add the RSN group key encapsulation
+            retVal = aagAppendGroupKeyForRsn ( keyData );
+
+            if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+            groupKeyLen = aniAsfPacketGetBytes(keyData, &groupKeyBytes);
+            if( !ANI_IS_STATUS_SUCCESS( groupKeyLen ) ) 
+            {
+                retVal = ANI_E_FAILED;
+                break;
+            }
+
+            txDesc.info.secureFlag = eANI_BOOLEAN_TRUE;
+            txDesc.info.encKeyDataFlag = eANI_BOOLEAN_TRUE;
+
+            if ( fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES ) 
+            {
+                /*
+                 * Use the AES key wrap algorithm if either one of the pairwise
+                 * key or the group key is an AES key.
+                 *
+                 * If the key being sent is not a multiple of
+                 * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then pad it with
+                 * zeroes. e.g., if we are sending a WEP key of 5 or 13
+                 * bytes.
+                 */
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                           "AES Key Wrap invoked. groupKeyLen = %d", groupKeyLen);
+
+                padLen = groupKeyLen % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
+                if (padLen != 0) {
+                    padLen = ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE - padLen;
+            
+                    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                               "Before AES Key Wrap: padLen = %d", padLen);
+
+                    if (groupKeyLen + padLen > sizeof(paddedGroupKeyEncaps)) {
+#if 0
+                        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                                   "Cannot encode group key encapsulation of len %d and cipher type %s "
+                                   "to send to %s %s (aid %d, radio %d, user %s)",
+                                   groupKeyLen,
+                                   aniSsmIntGetCipherStr(AAG_GROUP_CIPHER(fsm->ctx->radioId)),
+                                   (fsm->ctx->bpIndicator ? "BP" : "STA"),
+                                   aniAsfHexStr(fsm->ctx->suppMac, sizeof(tAniMacAddr)),
+                                   fsm->ctx->aid,
+                                   fsm->ctx->radioId,
+                                   aagGetStaUserId(fsm->ctx));
+#endif
+                         retVal = ANI_E_FAILED;
+                    }
+                    // OK, after you compute the pad length, you need to 
+                    // add the padding  - 0xdd followed by 0x00's
+                    addPad( groupKeyBytes , groupKeyLen , padLen );
+                    // add the padding length
+                    groupKeyLen += padLen;
+                    // IMMEDIATELY adjust the packet size to reflect the pad 
+                    aniAsfPacketMoveRight(keyData, padLen); 
+                    if( !ANI_IS_STATUS_SUCCESS( retVal) ) break;
+                }
+            
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                           "Before AES Key Wrap: padded groupKeyLen = %d", groupKeyLen);
+
+                retVal = aniSsmAesKeyWrap(fsm->cryptHandle, groupKeyBytes, groupKeyLen,
+                                          fsm->staCtx->ptk + ANI_EAPOL_KEY_RSN_MIC_SIZE,
+                                          ANI_EAPOL_KEY_RSN_ENC_KEY_SIZE,
+                                          &wrappedKey);
+                if( !ANI_IS_STATUS_SUCCESS( retVal) ) break;
+                // This doesn't work...
+                //groupKeyBytes = wrappedKey;
+                //groupKeyLen += ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
+                // ...here is the right way to do it
+                // Add the length of the prepended IV A[0]
+                if (NULL == wrappedKey)
+                {
+                    break;
+                }
+                groupKeyLen += ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
+                memcpy( groupKeyBytes, wrappedKey, groupKeyLen);
+                // Free the array used to hold the wrapped key
+                if (wrappedKey) vos_mem_free( wrappedKey);
+                // IMMEDIATELY adjust the packet size to reflect the IV 
+                aniAsfPacketMoveRight(keyData, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+            } 
+            else {
+            
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "Auth RC4 Key Wrap invoked. groupKeyLen = %d", groupKeyLen);
+            }
+            txDesc.keyDataLen = aniAsfPacketGetBytes(keyData, &txDesc.keyData);
+
+            retVal = aniEapolWriteKey(fsm->cryptHandle,
+                                      fsm->lastEapol,
+                                      fsm->staCtx->suppMac,
+                                      fsm->staCtx->authMac,
+                                      ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                      &txDesc,
+                                      fsm->staCtx->ptk,
+                                      CSR_AES_KEY_LEN);
+            if( !ANI_IS_STATUS_SUCCESS( retVal) ) break;
+        } 
+        else {
+            retransmit = eANI_BOOLEAN_TRUE;
+        }
+
+        if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+        {
+            retVal = ANI_OK;
+        }
+        else
+        {
+            //we fail to send the eapol frame disconnect
+            bapAuthDisconnect( fsm->ctx );
+            retVal = ANI_ERROR;
+        }
+
+    }while( 0 );
+
+    return retVal;
+}
+
+static int
+gotoStatePtkInitDone(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data)
+{
+    int retVal;
+    tAniEapolRsnKeyDesc *rxDesc;
+    tCsrRoamSetKey setKeyInfo;
+
+    fsm->currentState = PTK_INIT_DONE;
+
+    rxDesc = data->keyDesc;
+
+    vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) );
+    setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES;
+    setKeyInfo.keyDirection = eSIR_TX_RX;
+    vos_mem_copy( setKeyInfo.peerMac, fsm->staCtx->suppMac, sizeof( tAniMacAddr ) );
+    setKeyInfo.paeRole = 0; //this is a supplicant
+    setKeyInfo.keyId = 0;   //always
+    setKeyInfo.keyLength = CSR_AES_KEY_LEN; 
+    vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->staCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN );
+    //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one.
+    if( VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) )
+    {
+        //Done
+        aniAsfPacketEmptyExplicit(fsm->lastEapol, EAPOL_TX_HEADER_SIZE);
+        retVal = ANI_OK;
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Auth: gotoStatePtkInitDone fail to set key\n" );
+        retVal = ANI_ERROR;
+    }
+
+    return retVal;
+}
+
+static int
+gotoStateUpdateKeysReq(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data)
+{
+    tAniEapolRsnKeyDesc *rxDesc;
+
+    fsm->currentState = UPDATE_KEYS_REQ;
+
+    rxDesc = data->keyDesc;
+
+    aniSsmReplayCtrUpdate(fsm->staCtx->peerReplayCtr, rxDesc->replayCounter);
+
+    checkTransition(fsm, data);
+
+    return ANI_OK;
+}
+
+static int
+gotoStateIntegFailure(tAuthRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo)
+{
+    fsm->currentState = INTEG_FAILURE;
+
+    fsm->integFailed = eANI_BOOLEAN_FALSE;
+
+    checkTransition(fsm, NULL); // UCT
+
+    return ANI_OK;
+}
+
+static int
+gotoStateKeyUpdate(tAuthRsnFsm *fsm)
+{
+    fsm->currentState = KEY_UPDATE;
+
+    if( VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes(fsm->cryptHandle, fsm->aNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE) ) )
+    {
+
+        // Replay counter will be automatically updated when we create a
+        // new packet
+        
+        checkTransition(fsm, NULL); // UCT
+
+        return ANI_OK;
+    }
+    return ANI_ERROR;
+}
+
+static int
+gotoStateDisconnect(tAuthRsnFsm *fsm)
+{
+    fsm->currentState = DISCONNECT;
+
+    //What else do we need to clean up? Or BAP will call our vleanup function?
+
+    // FSM does not exist after this...
+    bapAuthDisconnect( fsm->ctx );
+
+    return ANI_OK;
+}
+
+static 
+int zeroOutPtk(tAuthRsnFsm *fsm)
+{
+    return ANI_OK;
+}
+
+static 
+int stopAllTimers(tAuthRsnFsm *fsm)
+{
+    vos_timer_stop( &fsm->msg2Timer );
+    vos_timer_stop( &fsm->msg4Timer );
+
+    return ANI_OK;
+}
+
+static
+int derivePtk(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data)
+{
+    v_U32_t prfLen;
+    tAniEapolRsnKeyDesc *rxDesc;
+
+    VOS_ASSERT(fsm->staCtx->pmk);
+
+    switch (fsm->staCtx->pwCipherType) 
+    {
+    case eCSR_ENCRYPT_TYPE_AES:
+        prfLen = AAG_RSN_PTK_PRF_LEN_CCMP;
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Auth cannot generate PTK for invalid algorithm %d\n",
+                      fsm->staCtx->pwCipherType);
+        return ANI_E_ILLEGAL_ARG;
+        break;
+    };
+
+    rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+    return aagPtkPrf(fsm->cryptHandle,
+                     fsm->staCtx->ptk,
+                     prfLen,
+                     fsm->staCtx->pmk,
+                     fsm->staCtx->authMac,
+                     fsm->staCtx->suppMac,
+                     fsm->aNonce,
+                     rxDesc->keyNonce);
+}
+
+static int 
+checkMic(tAuthRsnFsm *fsm, 
+         tAniEapolKeyAvailEventData *data)
+{
+    int retVal;
+
+    retVal = aniEapolKeyCheckMic(fsm->cryptHandle,
+                                 data->eapolFrame,
+                                 ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                 data->keyDesc,
+                                 fsm->staCtx->ptk,
+                                 CSR_AES_KEY_LEN);
+
+    if (retVal == ANI_E_MIC_FAILED) 
+    {
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Auth failed EAPOL-MIC check in pairwise key exchange!\n"); 
+    }
+
+    return retVal;
+}
+
+static int 
+checkLocalReplayCounter(tAuthRsnFsm *fsm, 
+                        tAniEapolKeyAvailEventData *data)
+{
+    int retVal = ANI_E_NULL_VALUE;
+    int cmp;
+    tAniEapolRsnKeyDesc *rxDesc;
+    
+    rxDesc = data->keyDesc;
+    if( rxDesc )
+    {
+        cmp = aniSsmReplayCtrCmp(fsm->staCtx->localReplayCtr, rxDesc->replayCounter);
+
+        // The STA should have sent back the same replay ctr as in our request
+        if (cmp != 0) 
+        {
+            retVal = ANI_E_REPLAY_CHECK_FAILED;
+        }
+        else
+        {
+            retVal = ANI_OK;
+        }
+    }
+
+    return retVal;
+}
+
+static 
+int checkPeerReplayCounter(tAuthRsnFsm *fsm, 
+                           tAniEapolKeyAvailEventData *data)
+{
+    int retVal = ANI_E_NULL_VALUE;
+    int cmp;
+    tAniEapolRsnKeyDesc *rxDesc;
+    
+    rxDesc = data->keyDesc;
+    if( rxDesc )
+    {
+        cmp = aniSsmReplayCtrCmp(fsm->staCtx->peerReplayCtr, rxDesc->replayCounter);
+
+        // The STA should have sent a newer replay ctr than its old
+        // request. The first message is exempted from the check.
+        if (fsm->staCtx->pastFirstPeerRequest && cmp >= 0) 
+        {
+            retVal = ANI_E_REPLAY_CHECK_FAILED;
+        }
+
+        fsm->staCtx->pastFirstPeerRequest = eANI_BOOLEAN_TRUE;
+    }
+
+    return retVal;
+}
+
+static int checkInfoElement(tAuthRsnFsm *fsm,
+                            tAniEapolKeyAvailEventData *data)
+{
+    tAniEapolRsnKeyDesc *desc;
+    v_U8_t *ieStaBytes;
+    int ieStaLen;
+
+    desc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+    if( desc )
+    {
+        ieStaLen = aniAsfPacketGetBytes(fsm->staCtx->ieSta, &ieStaBytes);
+        if( !ANI_IS_STATUS_SUCCESS( ieStaLen ) )
+        {
+            return ieStaLen;
+        }
+
+        if ((desc->keyDataLen != ieStaLen) ||
+            ( !vos_mem_compare(desc->keyData, ieStaBytes, ieStaLen-2) )) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                         "Auth STA sent inconsistent RSN IE!\n");
+            return ANI_E_FAILED;
+        }
+        // Copy RSN IE
+        //vos_mem_copy(fsm->advertizedRsnIe, desc->keyData, ieStaLen);
+        vos_mem_copy(fsm->advertizedRsnIe, ieStaBytes, ieStaLen);
+
+        return ANI_OK;
+    }
+    else
+    {
+        return ANI_E_NULL_VALUE;
+    }
+
+}
+
+static 
+int checkTransition(tAuthRsnFsm *fsm, void *arg)
+{
+    int retVal;
+    tAniEapolKeyAvailEventData *data;
+    tAniEapolRsnKeyDesc *rxDesc;
+    tSirMicFailureInfo *micFailureInfo;
+
+    if (fsm->disconnect) 
+    {
+        stopAllTimers(fsm);
+        gotoStateDisconnect(fsm);
+        return ANI_OK;
+    }
+
+    if (fsm->authReq) 
+    {
+        stopAllTimers(fsm);
+        gotoStateAuthentication(fsm);
+        return ANI_OK;
+    }
+
+    switch (fsm->currentState) 
+    {
+    case INITIALIZE:
+        break;
+    case AUTHENTICATION:
+        gotoStateAuthentication2(fsm);
+        break;
+    case AUTHENTICATION_2:
+        gotoStateGetPsk( fsm );
+        break;
+    case GET_PSK:
+        //We always have PMK otherwise BAP won't let us here
+        gotoStatePtkStart(fsm);
+        break;
+    case PTK_START:
+        if ( fsm->eapolAvail ) 
+        {
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            if (NULL == arg)
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                           "arg is NULL, exiting checkTransition()");
+                return ANI_E_FAILED;
+            }
+            data = (tAniEapolKeyAvailEventData *) arg;
+            retVal = checkLocalReplayCounter(fsm, data);
+            if (retVal != ANI_OK)
+                return ANI_OK; // Caller should not fail
+            retVal = derivePtk(fsm, data);
+            if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                         "Auth derivePtk failed with code %d!\n", retVal);
+                return retVal;
+            }
+            retVal = checkMic(fsm, data);
+            if (retVal != ANI_OK) 
+            {
+                bapAuthDisconnect( fsm->ctx );
+                return retVal;
+            }
+            retVal = gotoStatePtkInitNego(fsm, arg);
+        } 
+        else if ( fsm->msg2TimeOut ) 
+        {
+            if (fsm->numTries <= authConsts.maxTries) 
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                             "Auth Retransmitting EAPOL-Key Msg1\n");
+                // Stay in the same state but repeat actions
+                gotoStatePtkStart(fsm);
+            } 
+            else {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                             "Auth failed to recv EAPOL-Key Msg2 "
+                             "Disconnecting...\n");
+
+                gotoStateDisconnect(fsm);
+            }
+        }
+        break;
+    case PTK_INIT_NEGO:
+        if (NULL == arg)
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                       "arg is NULL, exiting checkTransition()");
+            return ANI_E_FAILED;
+        }
+        data = (tAniEapolKeyAvailEventData *) arg;
+        retVal = checkInfoElement(fsm, data);
+        if (retVal != ANI_OK) 
+        {
+            gotoStateDisconnect(fsm);
+        } 
+        else {
+            gotoStatePtkInitNegoTx(fsm);
+        }
+        break;
+    case PTK_INIT_NEGO_TX:
+        if (fsm->eapolAvail) 
+        {
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            if (NULL == arg)
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                           "arg is NULL, exiting checkTransition()");
+                return ANI_E_FAILED;
+            }
+            data = (tAniEapolKeyAvailEventData *) arg;
+            retVal = checkLocalReplayCounter(fsm, data);
+            if (retVal != ANI_OK)
+                return ANI_OK; // Caller should not fail
+            retVal = checkMic(fsm, data);
+            if (retVal != ANI_OK) 
+            {
+                bapAuthDisconnect( fsm->ctx );
+                return retVal;
+            }
+            retVal = gotoStatePtkInitDone(fsm, data);
+        } else if ( fsm->msg4TimeOut ) 
+        {
+            if (fsm->numTries <= authConsts.maxTries) 
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                             "Auth retransmitting EAPOL-Key Msg3 \n");
+                // Stay in the same state but repeat actions
+                gotoStatePtkInitNegoTx(fsm);
+            } 
+            else {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                             "Auth failed to recv EAPOL-Key Msg4 "
+                             "Disconnecting...\n" );
+
+                gotoStateDisconnect(fsm);
+            }
+        }
+        break;
+    case PTK_INIT_DONE:
+        if (fsm->eapolAvail) {
+
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            if (NULL == arg)
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                           "arg is NULL, exiting checkTransition()");
+                return ANI_E_FAILED;
+            }
+            data = (tAniEapolKeyAvailEventData *) arg;
+            rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+
+            if (rxDesc->info.requestFlag) 
+            {
+
+                retVal = checkPeerReplayCounter(fsm, data);
+                if (retVal != ANI_OK)
+                    return ANI_OK; // Caller should not fail
+
+                retVal = checkMic(fsm, data);
+                if (retVal != ANI_OK) 
+                {
+                    bapAuthDisconnect( fsm->ctx->pvosGCtx );
+                    return retVal;
+                }
+
+                retVal = gotoStateUpdateKeysReq(fsm, arg);
+            }
+        } 
+        else if (fsm->integFailed) {
+
+            micFailureInfo = (tSirMicFailureInfo *) arg;
+            gotoStateIntegFailure(fsm, arg);
+
+        }
+        break;
+    case UPDATE_KEYS_REQ:
+
+        if (NULL == arg)
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                       "arg is NULL, exiting checkTransition()");
+            return ANI_E_FAILED;
+        }
+        data = (tAniEapolKeyAvailEventData *) arg;
+        rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+
+        if (rxDesc->info.errorFlag) 
+        {
+
+            /*
+             * This was generated by a unicast packet sent from the AP to the STA/BP.
+             * The TX address is the AP's address. The src address is lost.
+             * If the STA is a BP, then the true dst is lost. We will treat
+             * the dst field as the address of the reporter of the MIC failure.
+             */
+
+            micFailureInfo = (tSirMicFailureInfo *) vos_mem_malloc( sizeof(tSirMicFailureInfo) );
+            if( NULL == micFailureInfo )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "Fail to allocate memory for AuthRsnFsm: %d\n",
+                      fsm->currentState);
+                return ANI_E_MALLOC_FAILED;
+            }
+
+            vos_mem_copy(micFailureInfo->taMacAddr, fsm->staCtx->authMac, sizeof(tAniMacAddr));
+            vos_mem_copy(micFailureInfo->dstMacAddr, fsm->staCtx->suppMac, sizeof(tAniMacAddr));
+            micFailureInfo->multicast = eANI_BOOLEAN_FALSE;
+            // Copy whatever sequence number came in the EAPOL-key message
+            vos_mem_copy(micFailureInfo->TSC, rxDesc->keyRecvSeqCounter, SIR_CIPHER_SEQ_CTR_SIZE);
+            gotoStateIntegFailure(fsm, micFailureInfo);
+            vos_mem_free(micFailureInfo);
+        } 
+        else {
+            // TBD: Untested. Why are local aNonce and local replyCtr not incremented in spec?
+            gotoStatePtkStart(fsm);
+        }
+        break;
+    case INTEG_FAILURE:
+        gotoStateKeyUpdate(fsm);
+        break;
+    case KEY_UPDATE:
+        gotoStatePtkStart(fsm);
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Nothing to do in this state for AuthRsnFsm: %d\n",
+                      fsm->currentState);
+        // Catch all for states that need no change:
+        //        assert(eANI_BOOLEAN_FALSE && "Illegal AuthRsnFsm state!");
+        return ANI_E_FAILED;
+    }
+
+    return ANI_OK;
+}
+
+
+static void msg2TimerCallback( void *pv )
+{
+    tAuthRsnFsm *fsm = (tAuthRsnFsm *)pv;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return;
+    }
+
+    //Only when waiting for msg2
+    if( PTK_START == fsm->currentState )
+    {
+        fsm->msg2TimeOut = eANI_BOOLEAN_TRUE;
+    }
+    //We may need to synchronize this call
+    authRsnFsmProcessEvent( fsm, RSN_FSM_TIMER_EXPIRED, NULL );
+}
+
+static void msg4TimerCallback( void *pv )
+{
+    tAuthRsnFsm *fsm = (tAuthRsnFsm *)pv;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return;
+    }
+
+    //Only when we are waiting for msg4
+    if( PTK_INIT_NEGO_TX == fsm->currentState )
+    {
+        fsm->msg4TimeOut = eANI_BOOLEAN_TRUE;
+    }
+    //We may need to synchronize this call
+    authRsnFsmProcessEvent( fsm, RSN_FSM_TIMER_EXPIRED, NULL );
+}
+
+
+//
+//This function alwasy assume the incoming vos_packet is 802_3 frame.
+static int authRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket )
+{
+    int retVal = ANI_ERROR;
+    tAniPacket *pAniPacket;
+    tBtampContext *ctx;
+    tAuthRsnFsm *fsm;
+
+    /* Validate params */ 
+    if ((pvosGCtx == NULL) || (NULL == pPacket))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "param is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+
+    ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
+    if (NULL == ctx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "ctx is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+
+    fsm = &ctx->uFsm.authFsm;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+
+    do
+    {
+        //ToDO: We need to synchronize this. For now, use the simplest form, drop the packet comes later.
+        if( fsm->fReceiving )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " ******authRsnRxFrameHandler receive eapol packet while processing. Drop the new comer\n" );
+            break;
+        }
+        fsm->fReceiving = VOS_TRUE;
+        retVal = bapRsnFormPktFromVosPkt( &pAniPacket, pPacket );
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+        //Now we can process the eapol frame
+        //handler will free the pAniPacket
+        bapRsnEapolHandler( fsm, pAniPacket, VOS_TRUE );
+    }while( 0 );
+
+    fsm->fReceiving = VOS_FALSE;
+    vos_pkt_return_packet( pPacket );
+
+    return retVal;
+}
+
+
+static int authRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus )
+{
+    tBtampContext *ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
+    tAuthRsnFsm *fsm;
+
+    vos_pkt_return_packet( pPacket );
+    if (NULL == ctx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "ctx is NULL in %s", __FUNCTION__);
+
+        return ANI_ERROR;
+    }
+
+    fsm = &ctx->uFsm.authFsm;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return ANI_ERROR;
+    }
+
+    if(!VOS_IS_STATUS_SUCCESS( retStatus ) )
+    {
+        //No need to do anything. Retransmit is handled by timeout
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Auth: TL Tx complete with error %d current state is %d \n", retStatus, fsm->currentState );
+    }
+    if( PTK_START == fsm->currentState )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+            " Auth: start msg2 timer\n" );
+        //Start msg2Timer
+        fsm->numTries++;
+        vos_timer_stop( &fsm->msg2Timer );
+        vos_timer_start(&fsm->msg2Timer, authConsts.timeoutPeriod);
+    }
+    else if( ( PTK_INIT_NEGO == fsm->currentState ) || 
+        ( PTK_INIT_NEGO_TX == fsm->currentState ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+            " Auth: start msg4 timer\n" );
+        fsm->numTries++;
+        vos_timer_stop( &fsm->msg4Timer );
+        vos_timer_start(&fsm->msg4Timer, authConsts.timeoutPeriod);
+    }
+
+    return ANI_OK;
+}
+
+
+static int
+authEapolKeyHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame, tAniMacAddr staMac )
+{
+    int retVal;
+
+    int descType;
+    void *keyDesc;
+    tAniEapolRsnKeyDesc *rsnDesc;
+    tAniEapolKeyAvailEventData data;
+
+    do
+    {
+        retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+                || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) 
+        {
+            rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc;
+            data.keyDesc = keyDesc;
+            data.eapolFrame = eapolFrame;
+            // Pass on the event to the RSN FSM only if it is for a pairwise key
+            if (rsnDesc->info.unicastFlag) 
+            {
+                retVal = authRsnFsmProcessEvent(fsm, 
+                                                RSN_FSM_EAPOL_FRAME_AVAILABLE,
+                                                &data);
+            } 
+            else {
+                //Not worry about GTK stuff
+            }
+        } 
+        else {
+
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "Got unexpected legacy 802.1x RC4 Key message \n" );
+            retVal = ANI_E_FAILED;
+            break;
+        }
+    }while( 0 );
+
+    aniEapolKeyFreeDesc(descType, keyDesc);
+    return retVal;
+}
+
+
+void authEapolHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac,
+                 v_U8_t *type)
+{
+    switch (*type) 
+    {
+    case ANI_EAPOL_TYPE_START:
+        //No doing anything because we only support WPA2-PSK
+        break;
+    case ANI_EAPOL_TYPE_LOGOFF:
+        //ignore
+        break;
+    case ANI_EAPOL_TYPE_KEY:
+        authEapolKeyHandler(fsm, eapolFrame, srcMac);
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Auth: EAPOL type not implemented: 0x%.2x\n", *type);
+        break;
+    }
+}
diff --git a/CORE/BAP/src/bapRsn8021xAuthFsm.h b/CORE/BAP/src/bapRsn8021xAuthFsm.h
new file mode 100644
index 0000000..f47d207
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xAuthFsm.h
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xAuthRsnFsm.h $
+ *
+ * Contains declarations for the RSN EAPOL-Key FSM on the
+ * authenticator side. This is based on 802.11i.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-December-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef __AAG_AUTH_RSN_FSM_H
+#define __AAG_AUTH_RSN_FSM_H
+
+#include "vos_types.h"
+#include "vos_timer.h"
+
+#include "bapInternal.h"
+#include "bapRsn8021xFsm.h"
+
+
+
+/**
+ * authRsnFsmInit
+ *
+ * FUNCTION:
+ * Initializes the constants and the callbacks needed by this FSM
+ * module.
+ *
+ * @param consts the various constant values needed by this FSM
+ * @param cb callbacks to the various procedures needed by this FSM
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmInit(tAuthRsnFsmConsts *consts);
+
+/**
+ * authRsnFsmCreate
+ *
+ * FUNCTION
+ * Allocates and initializes the state of an RSN key FSM instance for
+ * the given STA context.
+ * 
+ * @parm ctx the STA context whose instance is being created
+ * @param pskBased pass in eANI_BOOLEAN_TRUE is this STA is to be
+ * authenticated based on a pre-shared key as opposed to EAP.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmCreate(tBtampContext *ctx);
+
+
+
+int
+authRsnFsmSetPmk(tStaContext *ctx, v_U8_t *pmk);
+
+#endif //__AAG_AUTH_RSN_FSM_H
diff --git a/CORE/BAP/src/bapRsn8021xFsm.h b/CORE/BAP/src/bapRsn8021xFsm.h
new file mode 100644
index 0000000..422c7ff
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xFsm.h
@@ -0,0 +1,452 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xFsm.h $
+ * Contains the declarations for the Auth Agent's FSM's to work.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        21-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef __AAG_FSM_H_
+#define __AAG_FSM_H_
+
+#include "vos_types.h"
+#include "vos_trace.h"
+#include "vos_timer.h"
+#include <bapRsnSsmReplayCtr.h>
+#include <bapRsnAsfPacket.h>
+#include <bapRsnSsmEapol.h>
+#include "bapRsn8021xPrf.h"
+//#include "bapInternal.h"
+#include "csrApi.h"
+
+typedef struct sBtampContext tBtampContext;
+typedef struct tStaContext tStaContext;
+typedef struct tSuppContext tSuppContext;
+
+#define RSN_MAX_PACKET_SIZE 512
+#define RSN_80211_KEY_LEN    16
+#define RSN_IE_MAX_PACKET_SIZE 256
+#define RSN_IE_HEADER_SIZE 0
+#define ACCTG_SESSION_ID_SIZE 8
+#define ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE 8 // Bytes
+
+#define  BAP_SET_RSN_KEY   1
+#define  BAP_RESET_RSN_KEY  0 
+
+
+#define AAG_ACL_LOOKUP_NEEDED(ctx) \
+            ((ctx)->authType == eANI_SSM_AT_NONE || \
+             (ctx)->authType == eANI_SSM_AT_RSN_PSK || \
+             (ctx)->authType == eANI_SSM_AT_SHARED_KEY)
+
+#define AAG_ACL_LOOKUP_PENDING(ctx) \
+            ((ctx)->aclLookupFsm != NULL && (ctx)->radiusInfo.req != NULL)
+
+#define AAG_STA_AWAITING_CLEANUP(ctx) \
+            ((ctx)->ssid == NULL)
+
+#define AAG_MARK_STA_AS_AWAITING_CLEANUP(ctx) \
+            ((ctx)->ssid = NULL)
+
+/************************
+ * AuthRsnFsm structure:
+ *************************/
+typedef struct tagAuthRsnFsm 
+{
+    v_U8_t currentState;
+    
+    tBtampContext *ctx;
+    tStaContext *staCtx; 
+
+    // Variables used for EAPOL-Key messages
+    v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE];
+    v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE];
+ 
+    // Flags set by external events
+    v_U8_t authReq;
+    v_U8_t eapolAvail;
+    v_U8_t disconnect;
+    v_U8_t integFailed;
+    v_U8_t pmkAvailable;
+
+    // Variables maintained internally
+    v_U8_t numTries;
+    tAniPacket *lastEapol;  //Tx
+    v_BOOL_t fReceiving;
+    v_U32_t cryptHandle;
+
+    // Timers used..alternate them in different states
+    vos_timer_t msg2Timer;
+    vos_timer_t msg4Timer;
+    v_BOOL_t msg2TimeOut;
+    v_BOOL_t msg4TimeOut;
+    v_U8_t advertizedRsnIe[256];
+} tAuthRsnFsm;
+
+/************************
+ * SuppRsnFsm structure:
+ *************************/
+
+typedef struct tagSuppRsnFsm {
+
+    v_U8_t currentState;
+    
+    tBtampContext *ctx;
+    tSuppContext *suppCtx;
+
+    // Variables used for EAPOL-Key messages
+    tAniSsmReplayCtr *localReplayCtr;
+    tAniSsmReplayCtr *peerReplayCtr;
+    v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE];
+    v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE];
+
+    // Flags set by external events
+    v_U8_t authReq;
+    v_U8_t pmkAvail;
+    v_U8_t eapolAvail;
+    v_U8_t integFailed;
+    v_U8_t updateKeys;
+
+    // Variables maintained internally
+    int numTries;
+    tAniPacket *lastEapol;
+    v_BOOL_t fReceiving;
+    v_U32_t cryptHandle;
+} tSuppRsnFsm;
+
+
+typedef struct sAagZoneEntry tAagZoneEntry;
+typedef struct sAagSsidEntry tAagSsidEntry;
+
+typedef enum
+{
+    //Internal to RSN
+    //This event is triggered by RSN’s timers
+    RSN_FSM_TIMER_EXPIRED,  
+    //BAP use this event to inform auth/supp to start processing
+    //authentication. When BAP send this event to RSN, it is presumed 
+    //that the PMK is available.
+    RSN_FSM_AUTH_START,    
+    //Internal to RSN
+    //This event is triggered by the Rx routine when called by TL
+    RSN_FSM_EAPOL_FRAME_AVAILABLE,  
+    //BAP use this event to inform RSN that the connection is lost  
+    RSN_FSM_DISCONNECT,    
+    //Internal to RSN
+    //This event hannpens when RSN detect key integraty check fails
+    RSN_FSM_INTEG_FAILED,  
+
+}tRsnFsmEvent;
+
+/**
+ * Stores information about an EAP message that was last received or
+ * EAPOL messages that were last sent.
+ *
+ * 1. EAP messages last received are stripped out of their outer
+ *    encapsulation which may be either EAPOL or RADIUS, and are
+ *    preserved within this structure for the lifetime of one event:
+ *        - EAPOL_MESSAGE_AVAILABLE  => process and send to RADIUS
+ *        - RADIUS_MESSAGE_AVAILABLE => process and send to STA
+ *    When the event is fully handled, the incoming packet is freed,
+ *    therefore, the contents of this structure are no longer valid.
+ *
+ * 2. EAPOL messages last sent are stored in their entirety. They are
+ *     created and delete a little differently on the AP and BP sides:
+ *       - AP side: The EAPOL message contains the last EAP message
+ *     that was sent to the STA. As soon as a new EAP message arrives
+ *     from RADIUS, this EAPOL mesage is freed because a new one will
+ *     be generated.
+ *       - BP side: The EAPOL message contains the last EAP message
+ *     generated by the local supplicant. As soon as a new EAPOL
+ *     message is generated, this one is freed and the new one is
+ *     stored.
+ */
+typedef struct tEapInfo 
+
+{
+    tAniPacket *message;
+    v_U8_t id;
+} tEapInfo;
+
+
+typedef enum eAniSsmAuthState {
+    eANI_SSM_AUTH_STATE_INIT = 0,
+    eANI_SSM_AS_PW_KEY_CONF_AWAITED,
+    eANI_SSM_AS_PW_KEY_SET,
+} tAniSsmAuthState;
+
+
+/**
+ * The Station's context is stored in this structure. It contains
+ * pointers to the FSM's used by the STA (which in turn point back to
+ * the context). It also contains the transient event data like
+ * EAP-Message and RADIUS state that is obtained from various network
+ * packets.
+ */
+struct tStaContext {
+
+    // STA identification information
+    tAniMacAddr suppMac;
+    v_BOOL_t bpIndicator;
+
+    // Local association point
+    tAniMacAddr authMac;
+    v_U8_t ssidName[SIR_MAC_MAX_SSID_LENGTH + 1];    
+    tAagSsidEntry *ssid;
+
+    // The different FSM's that can be instantiated for the STA
+    tAuthRsnFsm *authRsnFsm;
+
+    // Keys derived for STA
+    v_U8_t ptk[AAG_PRF_MAX_OUTPUT_SIZE];
+    tAniPacket *pmk; // MS-MPPE-Recv-Key
+    tAniPacket *serverKey; // MS-MPPE-Send-Key
+    v_U8_t keyId;
+
+    // STA context timers
+    v_U32_t  sessionTimeout;
+    vos_timer_t reAuthTimer;
+    vos_timer_t sessionCleanupTimer;
+
+    // Radius Authentication attributes
+    v_U8_t *authClassAttr;
+
+    // Misc. authentication related state
+    eCsrAuthType authType;
+    eCsrEncryptionType pwCipherType;
+    tAniPacket *ieSta;
+    tAniSsmAuthState authState;
+    v_BOOL_t prmLookupInProgress;
+    v_BOOL_t firstTimeAuth;
+    v_BOOL_t secureLink; // 4-way h/s requries this to be 0 at startup or on MIC failures
+    tAniSsmReplayCtr *localReplayCtr;
+    tAniSsmReplayCtr *peerReplayCtr; // Goes hand in hand with flag below
+    v_BOOL_t pastFirstPeerRequest; // For use with peer replay counter
+
+    tAniPacket *cachedPmk; // MS-MPPE-Recv-Key
+    tAniPacket *cachedServerKey; // MS-MPPE-Send-Key
+    v_U8_t cachedKeyId;
+
+};
+
+
+struct tSuppContext {
+
+    // AP (peer) identification information
+    tAniMacAddr authMac;
+    v_U8_t *ssidStr;
+
+    // Local association point
+    tAniMacAddr suppMac;
+
+    // Keys derived on supplicant
+    v_U8_t ptk[AAG_PRF_MAX_OUTPUT_SIZE];
+    v_U8_t pwKeyLen; // # of bytes of PTK to send to LIM
+    tAniPacket *pmk; // MS-MPPE-Recv-Key
+    tAniPacket *serverKey; // MS-MPPE-Send-Key
+
+    // Misc. authentication related state
+    eCsrAuthType authType;
+    eCsrEncryptionType pwCipherType;
+    eCsrEncryptionType grpCipherType;
+    tAniPacket *ieBp;
+    tAniPacket *ieAp;
+    v_BOOL_t firstTimeAuth;
+
+};
+
+typedef struct tAniEapolKeyAvailEventData {
+    void *keyDesc;
+    tAniPacket *eapolFrame;
+} tAniEapolKeyAvailEventData;
+
+typedef struct tAniAagTimerEventData {
+    vos_timer_t timer;
+    void *appData;
+} tAniAagTimerEventData;
+
+
+/**
+ * Callback funtion that sets some status for a given STA context,
+ * e.g., the status of the controlled port.
+ */
+#if 0
+typedef int (*tAagSetStatus)(tStaContext *ctx);
+
+typedef int (*tAagTxEapolSupp)(tSuppContext *ctx);
+typedef int (*tAagSetStatusSupp)(tSuppContext *ctx);
+typedef int (*tAagSendEventToFsmSupp)(tSuppContext *ctx);
+#endif
+
+/**
+ * Callback function that posts a XXX_TIMER_EXPIRED event when a timer
+ * goes off. XXX represents the kind of timer that caused the event.
+ */
+typedef void (*tAagTimerCallback)(void *data);
+
+/**
+ * Callbacks provided to the GroupKeyFsm module from the FSM Manager
+ * module so that it can access procedures needed for network
+ * transmission, inter-FSM signalling, and communication with the main
+ * application.
+ */
+/*typedef struct tGroupKeyFsmCallbacks {
+    int (*getDefaultWepKeyId)(v_U32_t radioId);
+    int (*copyDefaultWepKey)(v_U32_t radioId);
+    int (*updateAllSta)(v_U32_t radioId);
+} tGroupKeyFsmCallbacks;*/
+
+/**
+ * This structure stores contants used by the AuthFsm as defined in
+ * [802.1X].
+ */
+typedef struct tAuthFsmConsts {
+    // Amount of time to ignore a misbehaving STA
+    v_U16_t quietPeriod;
+    // Number of reauthentication attempts allowed before ignoring STA
+    v_U8_t reAuthMax;
+    // Amount of time to wait for response from STA
+    v_U16_t txPeriod;
+} tAuthFsmConsts;
+
+
+
+/**
+ * This structure stores constants used by the AuthRsnFsm as defined in
+ * [802.11i].
+ */
+typedef struct tAuthRsnFsmConsts {
+    v_U32_t timeoutPeriod;
+    v_U32_t maxTries;
+} tAuthRsnFsmConsts;
+
+
+/**
+ * This structure stores contants used by the SuppFsm as defined in
+ * [802.1X].
+ */
+typedef struct tSuppFsmConsts {
+    v_U16_t authPeriod;
+    v_U16_t heldPeriod;
+    v_U16_t startPeriod;
+    v_U8_t maxStart;    
+} tSuppFsmConsts;
+
+/**
+ * This structure stores constants used by the SuppRsnFsm as defined in
+ * [802.11i].
+ */
+typedef struct tSuppRsnFsmConsts {
+    v_U32_t timeoutPeriod;
+    v_U32_t maxTries;
+} tSuppRsnFsmConsts;
+
+
+/**
+ * This structure stores constants used by the AuthRsnGroupKeyFsm as
+ * defined in [802.11i].
+ */
+typedef struct tAuthRsnGroupKeyFsmConsts {
+    v_U32_t timeoutPeriod;
+    v_U32_t maxTries;
+} tAuthRsnGroupKeyFsmConsts;
+
+/**
+ * authRsnFsmFree
+ *
+ * FUNCTION
+ * Frees a previously allocated RSN Key FSM in a STA context. If the
+ * RSN Key FSM is not yet allocated, then this is an error.
+ * 
+ * @param ctx the STA context whose FSM instance is to be freed
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmFree(tBtampContext *ctx);
+
+/**
+ * authRsnFsmProcessEvent
+ *
+ * FUNCTION
+ * Passes an event to the RSN key FSM instance for immediate processing.
+ * 
+ * @param fsm the RSN Key FSM instance
+ * @param eventId the AAG event to process
+ * @param arg an optional argument for this event
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+authRsnFsmProcessEvent(tAuthRsnFsm *fsm, tRsnFsmEvent eventId, void *arg);
+
+
+/**
+ * suppFsmCreate
+ *
+ * FUNCTION
+ * Allocates and initializes the state of an SuppFsm instance for the
+ * given STA context.
+ * 
+ * @parm ctx the supplicant context whose SuppFsm is being created
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmCreate(tBtampContext *ctx);
+
+/**
+ * suppFsmFree
+ *
+ * FUNCTION
+ * Frees a previously allocated SuppFsm.
+ * 
+ * @param suppCtx the supplicant context whose suppFsm is to be freed
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmFree(tBtampContext *ctx);
+
+/**
+ * suppFsmProcessEvent
+ *
+ * FUNCTION
+ * Passes an event to the suppFsm for immediate processing.
+ * 
+ * Note: The pertinent event data is already stored in the context.
+ *
+ * @param suppFsm the suppFsm
+ * @param eventId the AAG event to process
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmProcessEvent(tSuppRsnFsm *fsm, tRsnFsmEvent eventId, void *arg);
+
+#endif // __AAG_FSM_H_
diff --git a/CORE/BAP/src/bapRsn8021xPrf.c b/CORE/BAP/src/bapRsn8021xPrf.c
new file mode 100644
index 0000000..ffcf863
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xPrf.c
@@ -0,0 +1,268 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xPrf.c $
+ *
+ * Contains definitions for routines to calculate the 802.11i PRF
+ * functions.
+ *
+ * Author:  Mayank D. Upadhyay
+ * Date:    19-March-2003
+ * History:-
+ * Date     Modified by Modification Information
+ * ------------------------------------------------------
+ */
+
+/*#include <assert.h>
+#include <stdlib.h>
+#include <aniSsmSha1.h>
+*/
+#include "vos_utils.h"
+#include "vos_memory.h"
+#include "bapRsn8021xPrf.h"
+#include "bapRsnErrors.h"
+//#include "ani8021xUtils.h"
+
+#define AAG_PTK_PRF_ADD_PARAM 159
+#define AAG_PTK_PRF_DIV_PARAM 160
+
+#define AAG_PTK_PRF_CONST "Pairwise key expansion"
+#define AAG_PTK_PRF_CONST_LEN 22
+
+#define AAG_PTK_PRF_LM_POS 0
+#define AAG_PTK_PRF_HM_POS 6
+#define AAG_PTK_PRF_LN_POS 12
+#define AAG_PTK_PRF_HN_POS AAG_PTK_PRF_LN_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE
+
+#define AAG_PTK_PRF_TEXT_LEN AAG_PTK_PRF_HN_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE
+
+#define AAG_GTK_PRF_CONST "Group key expansion"
+#define AAG_GTK_PRF_CONST_LEN 19
+
+#define AAG_GTK_PRF_MAC_POS 0
+#define AAG_GTK_PRF_NONCE_POS 6
+
+#define AAG_GTK_PRF_TEXT_LEN AAG_GTK_PRF_NONCE_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE
+
+/**
+ * aagGetKeyMaterialLen
+ *
+ * Returns the number of bytes of the PTK that have to be provided to
+ * the MAC layer for a given cipher type.
+ *
+ * @param cipherType the cipher-type
+ *
+ * @return the number of bytes of key material for this cipher type,
+ * or 0 for invalid cipher types.
+ */
+int
+aagGetKeyMaterialLen(eCsrEncryptionType cipherType)
+{
+    switch (cipherType) {
+    case eCSR_ENCRYPT_TYPE_AES:
+        return AAG_RSN_KEY_MATERIAL_LEN_CCMP;
+        break;
+    default:
+        return 0;
+        break;
+    };
+}
+
+/**
+ * aagPtkPrf
+ *
+ * The PRF used for calculating the pairwise temporal key under IEEE
+ * 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param prfLen the number of BITS desired from the PRF result
+ * @param pmk the pairwise master-key
+ * @param authAddr the MAC address of the authenticator
+ * @param suppAddr the MAC address of the supplicant
+ * @param aNonce the nonce generated by the authenticator
+ * @param sNonce the nonce generated by the supplicant
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagPtkPrf(v_U32_t cryptHandle,
+          v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+          v_U32_t prfLen,
+          tAniPacket *pmk, 
+          tAniMacAddr authAddr,
+          tAniMacAddr suppAddr,
+          v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE],
+          v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE])
+{
+    v_U8_t *lowMac;
+    v_U8_t *highMac;
+    v_U8_t *lowNonce;
+    v_U8_t *highNonce;
+
+    v_U8_t *keyBytes;
+    int keyLen;
+
+    v_U8_t text[AAG_PTK_PRF_TEXT_LEN];
+
+    //Cannot use voss function here because vos_mem_compare doesn't tell whihc is larger
+    if (vos_mem_compare2(authAddr, suppAddr, sizeof(tAniMacAddr)) < 0) {
+        lowMac = authAddr;
+        highMac = suppAddr;
+    } else {
+        lowMac = suppAddr;
+        highMac = authAddr;
+    }
+
+    if (vos_mem_compare2(aNonce, sNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE) < 0) {
+        lowNonce = aNonce;
+        highNonce = sNonce;
+    } else {
+        lowNonce = sNonce;
+        highNonce = aNonce;
+    }
+
+    vos_mem_copy(text + AAG_PTK_PRF_LM_POS, lowMac, sizeof(tAniMacAddr));
+    vos_mem_copy(text + AAG_PTK_PRF_HM_POS, highMac, sizeof(tAniMacAddr));
+    vos_mem_copy(text + AAG_PTK_PRF_LN_POS, lowNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE);
+    vos_mem_copy(text + AAG_PTK_PRF_HN_POS, highNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE);
+
+    keyLen = aniAsfPacketGetBytes(pmk, &keyBytes);
+    if( !ANI_IS_STATUS_SUCCESS( keyLen ) )
+    {
+        return keyLen;
+    }
+
+    return aagPrf(cryptHandle,
+                  result, 
+                  keyBytes, keyLen, 
+                  (v_U8_t *)AAG_PTK_PRF_CONST, AAG_PTK_PRF_CONST_LEN,
+                  text, sizeof(text),
+                  prfLen);
+}
+
+/**
+ * aagGtkPrf
+ *
+ * The PRF used for calculating the group temporal key under IEEE
+ * 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param prfLen the number of BITS desired from the PRF result
+ * @param gmk the group master-key
+ * @param authAddr the MAC address of the authenticator
+ * @param gNonce the nonce generated by the authenticator for this purpose
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagGtkPrf(v_U32_t cryptHandle,
+          v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+          v_U32_t prfLen,
+          v_U8_t gmk[AAG_RSN_GMK_SIZE],
+          tAniMacAddr authAddr,
+          v_U8_t gNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE])
+{
+    v_U8_t text[AAG_GTK_PRF_TEXT_LEN];
+
+    vos_mem_copy(text + AAG_GTK_PRF_MAC_POS, authAddr, sizeof(tAniMacAddr));
+    vos_mem_copy(text + AAG_GTK_PRF_NONCE_POS, gNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE);
+
+    return aagPrf(cryptHandle,
+                  result,
+                  gmk, AAG_RSN_GMK_SIZE,
+                  (v_U8_t *)AAG_GTK_PRF_CONST, AAG_GTK_PRF_CONST_LEN,
+                  text, sizeof(text),
+                  prfLen);
+
+}
+
+/**
+ * aagPrf
+ *
+ * The raw PRF function that is used in IEEE 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param key the key to use in the PRF
+ * @param keyLen the length of the key
+ * @param a the parameter A which is usually a unique label
+ * @param aLen the length of the parameter A
+ * @ param b the parameter B
+ * @param bLen the length of parameter B
+ * @param prfLen the number to BITS desired from the PRF result
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagPrf(v_U32_t cryptHandle,
+       v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+       v_U8_t *key, v_U8_t keyLen,
+       v_U8_t *a, v_U8_t aLen,
+       v_U8_t *b, v_U8_t bLen,
+       v_U32_t prfLen)
+{
+    static v_U8_t y = 0;
+
+    v_U8_t *hmacText = NULL;
+    v_U8_t *resultOffset = result;
+    int numLoops;
+    int loopCtrPos;
+    int i, retVal=0;
+
+    hmacText = vos_mem_malloc( aLen + bLen + 2 );
+    if( NULL == hmacText )
+    {
+        return ANI_E_NULL_VALUE;
+    }
+
+    vos_mem_copy(hmacText + 0, a, aLen);
+    hmacText[aLen] = y;
+    vos_mem_copy(hmacText + aLen + 1, b, bLen);
+    loopCtrPos = aLen + 1 + bLen;
+
+    numLoops = prfLen + AAG_PTK_PRF_ADD_PARAM;
+    numLoops /= AAG_PTK_PRF_DIV_PARAM;
+
+    for (i = 0; i < numLoops; i++) 
+    {
+        VOS_ASSERT((resultOffset - result + VOS_DIGEST_SHA1_SIZE)
+               <= AAG_PRF_MAX_OUTPUT_SIZE);
+        hmacText[loopCtrPos] = i;
+        if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, hmacText, loopCtrPos + 1, key, keyLen, resultOffset) ) )
+        {
+            resultOffset += VOS_DIGEST_SHA1_SIZE;
+            retVal = ANI_OK;
+        }
+        else
+        {
+            retVal = ANI_ERROR;
+        }
+    }
+
+    vos_mem_free(hmacText);
+
+    return retVal;
+}
+
diff --git a/CORE/BAP/src/bapRsn8021xPrf.h b/CORE/BAP/src/bapRsn8021xPrf.h
new file mode 100644
index 0000000..e83ce38
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xPrf.h
@@ -0,0 +1,167 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xPrf.h $
+ *
+ * Contains declarations for routines to calculate the 802.11i PRF
+ * functions.
+ *
+ * Author:  Mayank D. Upadhyay
+ * Date:    19-March-2003
+ * History:-
+ * Date     Modified by Modification Information
+ * ------------------------------------------------------
+ */
+
+#ifndef __AAG_PRF_H_
+#define __AAG_PRF_H_
+
+#include "vos_types.h"
+#include <bapRsnAsfPacket.h>
+#include <bapRsnSsmEapol.h>
+#include "csrApi.h"
+
+
+/*
+ * Define the maximum size needed for the result array so that SHA-1
+ * overflow is accounted for.
+ */
+#define AAG_PRF_MAX_OUTPUT_SIZE 80
+
+#define AAG_RSN_PTK_TK1_OFFSET \
+    (AAG_RSN_EAPOL_MIC_KEY_LEN + AAG_RSN_EAPOL_ENC_KEY_LEN)
+
+// Pairwise key related definitions...
+
+#define AAG_RSN_PTK_PRF_LEN_TKIP   512 //bits
+#define AAG_RSN_PTK_PRF_LEN_CCMP   384 //bits
+#define AAG_RSN_PTK_PRF_LEN_WEP104 384 //bits
+#define AAG_RSN_PTK_PRF_LEN_WEP40  384 //bits
+
+// Group key related definitions...
+
+#define AAG_RSN_GMK_SIZE 16
+
+#define AAG_RSN_GTK_PRF_LEN_TKIP   256 //bits
+#define AAG_RSN_GTK_PRF_LEN_CCMP   128 //bits
+#define AAG_RSN_GTK_PRF_LEN_WEP104 128 //bits
+#define AAG_RSN_GTK_PRF_LEN_WEP40  128 //bits
+
+// Key material length that is sent to the MAC layer...
+
+#define AAG_RSN_KEY_MATERIAL_LEN_CCMP   16
+#define AAG_RSN_KEY_MATERIAL_LEN_TKIP   32
+#define AAG_RSN_KEY_MATERIAL_LEN_WEP104 13
+#define AAG_RSN_KEY_MATERIAL_LEN_WEP40  5
+
+/**
+ * aagGetKeyMaterialLen
+ *
+ * Returns the number of bytes of the PTK that have to be provided to
+ * the MAC layer for a given cipher type.
+ *
+ * @param cipherType the cipher-type
+ *
+ * @return the number of bytes of key material for this cipher type,
+ * or 0 for invalid cipher types.
+ */
+int
+aagGetKeyMaterialLen(eCsrEncryptionType cipherType);
+
+/**
+ * aagPtkPrf
+ *
+ * The PRF used for calculating the pairwise temporal key under IEEE
+ * 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param prfLen the number of BITS desired from the PRF result
+ * @param pmk the pairwise master-key
+ * @param authAddr the MAC address of the authenticator
+ * @param suppAddr the MAC address of the supplicant
+ * @param aNonce the nonce generated by the authenticator
+ * @param sNonce the nonce generated by the supplicant
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagPtkPrf(v_U32_t cryptHandle,
+          v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+          v_U32_t prfLen,
+          tAniPacket *pmk, 
+          tAniMacAddr authAddr,
+          tAniMacAddr suppAddr,
+          v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE],
+          v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]);
+
+
+/**
+ * aagGtkPrf
+ *
+ * The PRF used for calculating the group temporal key under IEEE
+ * 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param prfLen the number of BITS desired from the PRF result
+ * @param gmk the group master-key
+ * @param authAddr the MAC address of the authenticator
+ * @param gNonce the nonce generated by the authenticator for this purpose
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagGtkPrf(v_U32_t cryptHandle,
+          v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+          v_U32_t prfLen,
+          v_U8_t gmk[AAG_RSN_GMK_SIZE],
+          tAniMacAddr authAddr,
+          v_U8_t gNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]);
+
+/**
+ * aagPrf
+ *
+ * The raw PRF function that is used in IEEE 802.11i.
+ *
+ * @param result a fixed size array where the outputis stored. Should
+ * have enough place for the SHA-1 overflow.
+ * @param key the key to use in the PRF
+ * @param keyLen the length of the key
+ * @param a the parameter A which is usually a unique label
+ * @param aLen the length of the parameter A
+ * @ param b the parameter B
+ * @param bLen the length of parameter B
+ * @param prfLen the number to BITS desired from the PRF result
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aagPrf(v_U32_t cryptHandle,
+       v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
+       v_U8_t *key, v_U8_t keyLen,
+       v_U8_t *a, v_U8_t aLen,
+       v_U8_t *b, v_U8_t bLen,
+       v_U32_t prfLen);
+
+#endif //__AAG_PRF_H_
diff --git a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c
new file mode 100644
index 0000000..7a8a4cb
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c
@@ -0,0 +1,1159 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xSuppRsnFsm.c $
+ *
+ * Contains definitions for the RSN EAPOL-Key FSM on the
+ * supplicant side. This is based on 802.11i.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-December-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#include "bapRsnSsmServices.h"
+#include "bapRsnSsmEapol.h"
+#include "bapRsnErrors.h"
+#include "bapRsn8021xSuppRsnFsm.h"
+#include "vos_utils.h"
+#include "bapRsnTxRx.h"
+#include "btampFsm.h"
+
+// The different states that this FSM transitions through
+#define INITIALIZE           0
+#define AUTHENTICATION       1
+#define GOT_PMK              2
+#define STA_KEY_START        3
+#define STA_KEY_SET          4
+#define KEY_UPDATE           5   
+#define REKEY_MSG            6
+#define GROUP_KEY_SET        7
+#define NUM_STATES (GROUP_KEY_SET + 1)
+
+
+static tSuppRsnFsmConsts suppConsts = { 2000, 3 };    //timeout, retry limit
+
+int gReadToSetKey = 0;
+
+/**************************************
+ * Static functions in this module
+ **************************************/
+
+static 
+int zeroOutPtk(tSuppRsnFsm *fsm);
+
+static
+int checkMic(tSuppRsnFsm *fsm, 
+             tAniEapolKeyAvailEventData *data,
+             v_BOOL_t pwKeyExchange);
+
+static int checkInfoElement(tSuppRsnFsm *fsm,
+                            tAniEapolKeyAvailEventData *data);
+
+static
+int checkPeerReplayCounter(tSuppRsnFsm *fsm, 
+                           tAniEapolKeyAvailEventData *data,
+                           v_BOOL_t *retransmit,
+                           v_BOOL_t actualMicFlag,
+                           v_BOOL_t reTxMicFlag
+                           );
+
+static
+int derivePtk(tSuppRsnFsm *fsm, 
+              tAniEapolKeyAvailEventData *data);
+
+static 
+int checkTransition(tSuppRsnFsm *fsm, void *arg);
+
+static int
+gotoStateInit(tSuppRsnFsm *fsm);
+
+static int suppRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket );
+static int suppRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus );
+
+/*************************
+ * Internal Functions
+ *************************/
+int suppRsnAuthStartEventHandler(tSuppRsnFsm *fsm);
+
+/*************************
+ * The exported functions
+ *************************/
+
+/**
+ * suppRsnFsmInit
+ *
+ * FUNCTION:
+ * Initializes the constants and the callbacks needed by this FSM
+ * module.
+ *
+ * @param cb callbacks to the various procedures needed by this FSM
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmInit(void)
+{
+    // TODO: Read the constants in from config
+    // consts = constsIn;
+    suppConsts.timeoutPeriod = 2000;
+    suppConsts.maxTries = 3;
+
+    return ANI_OK;
+}
+
+/**
+ * suppRsnFsmCreate
+ *
+ * FUNCTION
+ * Allocates and initializes the state of an RSN key FSM instance for
+ * the given BP context.
+ * 
+ * @parm ctx the BP context whose instance is being created
+ * @param pskBased pass in eANI_BOOLEAN_TRUE is this BP is to be
+ * authenticated based on a pre-shared key as opposed to EAP.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmCreate(tBtampContext *ctx)
+{
+    int retVal = ANI_OK;
+    tSuppRsnFsm *fsm = &ctx->uFsm.suppFsm;
+
+    // First, clear everything out
+    vos_mem_zero( fsm, sizeof(tSuppRsnFsm));
+
+    if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( suppRsnTxCompleteHandler,
+                                            suppRsnRxFrameHandler ) ) )
+    {
+        return ANI_ERROR;
+    }
+
+    if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) )
+    {
+        return ANI_ERROR;
+    }
+
+    // Allocate the supplicant context
+    fsm->suppCtx = (tSuppContext *)vos_mem_malloc( sizeof(tSuppContext) );
+    if (fsm->suppCtx == NULL) 
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+    // Clear out the supplicant context
+    vos_mem_zero( fsm->suppCtx, sizeof(tSuppContext));
+
+    fsm->ctx = ctx;
+    //Only support CCMP
+    fsm->suppCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES;
+
+    retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol,
+                                          RSN_MAX_PACKET_SIZE,
+                                          EAPOL_TX_HEADER_SIZE);
+    if (retVal != ANI_OK) 
+    {
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    aniAsfPacketAllocate(&fsm->suppCtx->pmk);
+    if (fsm->suppCtx->pmk == NULL) 
+    {
+        retVal = ANI_E_MALLOC_FAILED;
+        VOS_ASSERT( 0 );
+        goto error;
+    }
+
+    fsm->suppCtx->ieAp = NULL; 
+
+    fsm->cryptHandle = 0;
+    if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) )
+    {
+        retVal = ANI_E_FAILED;
+        VOS_ASSERT( 0 );
+    }
+
+    fsm->currentState = INITIALIZE;
+    gotoStateInit(fsm);
+
+    suppRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL );
+
+    return ANI_OK;
+
+ error:
+    suppRsnFsmFree( ctx );
+
+    return retVal;
+    
+}
+
+/**
+ * suppRsnFsmFree
+ *
+ * FUNCTION
+ * Frees a previously allocated RSN Key FSM in a BP context. If the
+ * RSN Key FSM is not yet allocated, then this is an error.
+ * 
+ * @param ctx the BP context whose FSM instance is to be freed
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmFree(tBtampContext *ctx)
+{
+    tSuppRsnFsm *fsm;
+
+    fsm = &ctx->uFsm.suppFsm;
+
+    if( fsm->cryptHandle )
+    {  
+        vos_crypto_deinit( fsm->cryptHandle );
+    }
+
+    bapRsnClearTxRxCallbacks(); 
+
+    if (fsm->lastEapol)
+        aniAsfPacketFree(fsm->lastEapol);
+
+    if( fsm->suppCtx )
+    {
+        if ( fsm->suppCtx->pmk )
+        {
+            aniAsfPacketFree(fsm->suppCtx->pmk);
+        }
+        vos_mem_free( fsm->suppCtx );
+    }
+
+    // Finally, clear everything out
+    vos_mem_zero( fsm, sizeof(tSuppRsnFsm));
+
+    return ANI_OK;
+}
+
+/**
+ * suppRsnFsmProcessEvent
+ *
+ * FUNCTION
+ * Passes an event to the RSN key FSM instance for immediate processing.
+ * 
+ * @param fsm the RSN Key FSM instance
+ * @param eventId the AAG event to process
+ * @param arg an optional argument for this event
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmProcessEvent(tSuppRsnFsm *fsm, tRsnFsmEvent eventId, void *arg)
+{
+
+    switch (eventId) 
+    {
+    case RSN_FSM_TIMER_EXPIRED:
+        // Proceed straight to checkTransition
+        break;
+    case RSN_FSM_AUTH_START:
+        fsm->authReq = eANI_BOOLEAN_TRUE;
+        suppRsnAuthStartEventHandler(fsm);
+        break;
+    case RSN_FSM_EAPOL_FRAME_AVAILABLE:
+        fsm->eapolAvail = eANI_BOOLEAN_TRUE;
+        break;
+    case RSN_FSM_INTEG_FAILED:
+        fsm->integFailed = eANI_BOOLEAN_TRUE;
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp unknown event for SuppFsm: %d\n",
+                      eventId);
+        VOS_ASSERT( 0 );
+        return ANI_E_ILLEGAL_ARG;
+        break;
+    }
+
+    checkTransition(fsm, arg);
+
+    return ANI_OK;
+}
+
+int
+suppRsnAuthStartEventHandler(tSuppRsnFsm *fsm)
+{
+    // Copy required info
+    vos_mem_copy( &fsm->suppCtx->authMac, fsm->ctx->peer_mac_addr, 6);
+    vos_mem_copy( &fsm->suppCtx->suppMac, fsm->ctx->self_mac_addr, 6);
+    aniAsfPacketAppendBuffer( fsm->suppCtx->pmk, fsm->ctx->key_material, fsm->ctx->key_length);
+
+    return ANI_OK;
+}
+
+/***********************
+ * The static functions
+ ***********************/
+
+static int
+gotoStateInit(tSuppRsnFsm *fsm)
+{
+    fsm->currentState = INITIALIZE;
+
+    fsm->authReq = eANI_BOOLEAN_FALSE;
+    fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+    fsm->integFailed = eANI_BOOLEAN_FALSE;
+    fsm->pmkAvail = eANI_BOOLEAN_FALSE;
+
+    // Create two replay counter's..one for our requests, and another
+    // for STA's requests. Initialize the first one randomly.
+    aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->localReplayCtr, ANI_EAPOL_KEY_RSN_RSC_SIZE, 0);
+    aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->peerReplayCtr, ANI_EAPOL_KEY_RSN_RSC_SIZE, 0);
+
+    return ANI_OK;
+}
+
+static int
+gotoStateAuthentication(tSuppRsnFsm *fsm)
+{
+    fsm->currentState = AUTHENTICATION;
+
+    if( VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( fsm->cryptHandle, fsm->sNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE ) ) )
+    {
+        zeroOutPtk(fsm);
+        // TODO: Zero out all GTK's
+        fsm->authReq = eANI_BOOLEAN_FALSE;
+        /////getPmk(fsm->suppCtx);
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp fail to random number\n" );
+        return ANI_ERROR;
+    }
+
+    return ANI_OK;
+}
+
+static int
+gotoStateGotPmk(tSuppRsnFsm *fsm)
+{
+    fsm->currentState = GOT_PMK;
+
+    return ANI_OK;
+}
+
+static int
+gotoStateStaKeyStart(tSuppRsnFsm *fsm, 
+                     tAniEapolKeyAvailEventData *data,
+                     v_BOOL_t retransmit)
+{
+    int retVal;
+    tAniEapolRsnKeyDesc txDesc;
+    tAniEapolRsnKeyDesc *rxDesc;
+    static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 
+        0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 };
+
+    fsm->currentState = STA_KEY_START;
+
+    // Create a new EAPOL frame if we don't have to retransmit
+   // if (!retransmit) 
+    //{
+
+        rxDesc = data->keyDesc;
+        if( NULL == rxDesc)
+        {
+            return ANI_E_NULL_VALUE;
+        }
+        aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE );
+        retVal = derivePtk(fsm, data);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Supp derivePtk failed with code %d!\n", retVal);
+            return retVal;
+        }
+
+        vos_mem_zero( &txDesc, sizeof(txDesc) );
+
+        // The Key Information bits...
+        if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) 
+        {
+            txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
+        }
+        txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
+        txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
+        txDesc.keyLen = 0; //RSN_80211_KEY_LEN;
+
+        // Send back the same replayCtr that the authenticator sent
+        vos_mem_copy(txDesc.replayCounter, 
+               rxDesc->replayCounter, 
+               sizeof(txDesc.replayCounter));
+
+        vos_mem_copy(txDesc.keyNonce, fsm->sNonce, sizeof(txDesc.keyNonce));
+        txDesc.keyDataLen = sizeof(btampRSNIE);//aniAsfPacketGetBytes(fsm->suppCtx->ieBp,
+                                               //&txDesc.keyData);    
+        txDesc.keyData = btampRSNIE;
+        retVal = aniEapolWriteKey(fsm->cryptHandle,
+                                  fsm->lastEapol,
+                                  fsm->suppCtx->authMac,
+                                  fsm->suppCtx->suppMac,
+                                  ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                  &txDesc,
+                                  fsm->suppCtx->ptk, 
+                                  CSR_AES_KEY_LEN);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp gotoStateStaKeyStart fail to write key %d\n",
+                      retVal);
+            return retVal;
+        }
+    //}
+ 
+    if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+    {
+        retVal = ANI_OK;
+    }
+    else
+    {
+        retVal = ANI_ERROR;
+    }
+
+    return retVal;
+}
+
+static int
+gotoStateStaKeySet(tSuppRsnFsm *fsm, 
+                   tAniEapolKeyAvailEventData *data,
+                   v_BOOL_t retransmit)
+{
+    int retVal=0;
+    tAniEapolRsnKeyDesc txDesc;
+    tAniEapolRsnKeyDesc *rxDesc = NULL;
+    
+    fsm->currentState = STA_KEY_SET;
+
+    if (data == NULL) 
+    {
+        // We don't need to do anything
+        return ANI_OK;
+    }
+    
+    // Create a new EAPOL frame if we don't have to retransmit
+    if (!retransmit) 
+    {
+        // First check the IE that the AP sent
+        retVal = checkInfoElement(fsm, data);
+        if (retVal != ANI_OK) 
+        {
+            //FIX_RSN aagSetSuppFailureAndCleanup(fsm->suppCtx);
+
+            // FSM does not exist after this...
+
+            return retVal;
+        }
+
+        // Create a new EAPOL frame
+
+        rxDesc = data->keyDesc;
+        if( NULL == rxDesc )
+            return ANI_E_NULL_VALUE;
+
+        aniAsfPacketEmptyExplicit(fsm->lastEapol, 
+                                  EAPOL_TX_HEADER_SIZE );
+
+        vos_mem_zero( &txDesc, sizeof(txDesc) );
+
+        // The Key Information bits...
+        if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) 
+        {
+            txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
+        }
+
+        txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
+        txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
+        txDesc.info.secureFlag = eANI_BOOLEAN_TRUE;
+        txDesc.keyLen = 0; //RSN_80211_KEY_LEN;
+
+        // Send back the same replayCtr that the authenticator sent
+        vos_mem_copy(txDesc.replayCounter, 
+               rxDesc->replayCounter, 
+               sizeof(txDesc.replayCounter));
+
+        retVal = aniEapolWriteKey(fsm->cryptHandle,
+                                  fsm->lastEapol,
+                                  fsm->suppCtx->authMac,
+                                  fsm->suppCtx->suppMac,
+                                  ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                  &txDesc,
+                                  fsm->suppCtx->ptk,
+                                  CSR_AES_KEY_LEN);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            return retVal;
+        }
+    }
+    gReadToSetKey = BAP_SET_RSN_KEY;
+    if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+    {
+        /* making it global to access in bapTxRx file */
+#if 0
+        tCsrRoamSetKey setKeyInfo;
+
+
+        vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) );
+        setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES;
+        setKeyInfo.keyDirection = eSIR_TX_RX;
+        vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) );
+        setKeyInfo.paeRole = 0; //this is a supplicant
+        setKeyInfo.keyId = 0;   //always
+        setKeyInfo.keyLength = CSR_AES_KEY_LEN; 
+        vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN );
+        //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one.
+        /*
+          We will move the Set key to EAPOL Completion handler. We found a race condition betweem
+          sending EAPOL frame and setting Key */
+
+
+        if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" );
+            retVal = ANI_ERROR;
+        }
+#endif
+        gReadToSetKey = BAP_RESET_RSN_KEY;
+        retVal = ANI_ERROR;
+    }
+
+    return retVal;
+}
+
+static int
+gotoStateGroupKeySet(tSuppRsnFsm *fsm, 
+                     tAniEapolKeyAvailEventData *data)
+{
+    int retVal;
+    tAniEapolRsnKeyDesc txDesc;
+    tAniEapolRsnKeyDesc *rxDesc;
+
+    int groupKeyLen;
+    
+    fsm->currentState = GROUP_KEY_SET;
+    
+    do
+    {
+        rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+        if( NULL == rxDesc) 
+        {
+            retVal = ANI_E_NULL_VALUE;
+            break;
+        }
+
+        if (rxDesc->keyDataLen == 0 || rxDesc->keyData == NULL) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "Supp: AP sent no group key in group EAPOL-Key message!\n" );
+            retVal = ANI_E_ILLEGAL_ARG;
+            break;
+        }
+
+        if ( rxDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES ) 
+        {
+            groupKeyLen = rxDesc->keyDataLen - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
+            if( groupKeyLen <= 0 )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                    "Supp: AP sent GTK too short\n" );
+                retVal = ANI_E_ILLEGAL_ARG;
+                break;
+            }
+        } 
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "Supp: AP sent unsupported keyDescVer %d!\n", rxDesc->info.keyDescVers );
+            retVal = ANI_E_ILLEGAL_ARG;
+            break;
+        }
+
+        // Always create a new EAPOL frame
+
+        aniAsfPacketEmptyExplicit( fsm->lastEapol, 
+                                  EAPOL_TX_HEADER_SIZE );
+        
+        vos_mem_zero( &txDesc, sizeof(txDesc) );
+
+        // The Key Information bits...
+        if (fsm->suppCtx->grpCipherType == eCSR_ENCRYPT_TYPE_AES) 
+        {
+            txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
+        }
+
+        txDesc.info.unicastFlag = eANI_BOOLEAN_FALSE;
+        txDesc.info.keyId = rxDesc->info.keyId;
+        txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
+        txDesc.info.secureFlag = eANI_BOOLEAN_TRUE;
+        txDesc.keyLen = RSN_80211_KEY_LEN;
+
+        // Send back the same replayCtr that the authenticator sent
+        vos_mem_copy(txDesc.replayCounter, 
+               rxDesc->replayCounter, 
+               sizeof(txDesc.replayCounter));
+
+        retVal = aniEapolWriteKey(fsm->cryptHandle,
+                                  fsm->lastEapol,
+                                  fsm->suppCtx->authMac,
+                                  fsm->suppCtx->suppMac,
+                                  ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                  &txDesc,
+                                  fsm->suppCtx->ptk,
+                                  CSR_AES_KEY_LEN);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;    
+
+        if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+        {
+            retVal = ANI_ERROR;
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp could not send eapol. Disconnect\n" );
+            break;;    
+        }
+
+        //FIX_RSN there is no need to set GTK retVal = setGtk(fsm->suppCtx, rxDesc->keyRecvSeqCounter);
+
+        // This is never retransmitted
+        aniAsfPacketEmptyExplicit( fsm->lastEapol, 
+                                  EAPOL_TX_HEADER_SIZE );
+
+        checkTransition(fsm, NULL); // UCT rule
+    }while( 0 );
+
+    return retVal;
+}
+
+static int
+gotoStateKeyUpdate(tSuppRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo)
+{
+    //we don't update keys
+    bapSuppDisconnect( fsm->ctx );
+
+    return ANI_OK;
+}
+
+static int
+gotoStateRekeyMsg(tSuppRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo)
+{
+    //We don't support rekey, simply disconnect
+    bapSuppDisconnect( fsm->ctx );
+
+    return ANI_OK;
+}
+
+static 
+int zeroOutPtk(tSuppRsnFsm *fsm)
+{
+    return ANI_OK;
+}
+
+static
+int derivePtk(tSuppRsnFsm *fsm, tAniEapolKeyAvailEventData *data)
+{
+    v_U32_t prfLen;
+    tAniEapolRsnKeyDesc *rxDesc;
+
+    switch (fsm->suppCtx->pwCipherType) 
+    {
+    case eCSR_ENCRYPT_TYPE_AES:
+        prfLen = AAG_RSN_PTK_PRF_LEN_CCMP;
+        fsm->suppCtx->pwKeyLen = AAG_RSN_KEY_MATERIAL_LEN_CCMP;
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Cannot generate PTK for BP for invalid algorithm %d\n",
+                      fsm->suppCtx->pwCipherType);
+        return ANI_E_ILLEGAL_ARG;
+        break;
+    };
+
+    rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+    return aagPtkPrf(fsm->cryptHandle,
+                     fsm->suppCtx->ptk,
+                     prfLen,
+                     fsm->suppCtx->pmk,
+                     fsm->suppCtx->authMac,
+                     fsm->suppCtx->suppMac,
+                     rxDesc->keyNonce,
+                     fsm->sNonce);
+}
+
+static
+int checkMic(tSuppRsnFsm *fsm, 
+             tAniEapolKeyAvailEventData *data,
+             v_BOOL_t pwKeyExchange)
+{
+    int retVal;
+
+    retVal = aniEapolKeyCheckMic(fsm->cryptHandle,
+                                 data->eapolFrame,
+                                 ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
+                                 data->keyDesc,
+                                 fsm->suppCtx->ptk,
+                                 CSR_AES_KEY_LEN);
+
+    return retVal;
+}
+
+
+static int checkInfoElement(tSuppRsnFsm *fsm,
+                            tAniEapolKeyAvailEventData *data)
+{
+    tAniEapolRsnKeyDesc *desc;
+    v_U8_t *ieApBytes;
+    int ieApLen;
+
+    desc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+    if( NULL == desc )
+    {
+        return ANI_E_NULL_VALUE;
+    }
+
+    ieApLen = aniAsfPacketGetBytes(fsm->suppCtx->ieAp, &ieApBytes);
+    if( ANI_IS_STATUS_SUCCESS( ieApLen ) )
+    {
+
+        if ((desc->keyDataLen != ieApLen) ||
+            ( vos_mem_compare(desc->keyData, ieApBytes, ieApLen) )) 
+        {
+            // TODO: Send a fault here
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                         "Supp AP sent inconsistent RSN IE!\n" );
+            return ANI_E_FAILED;
+        }
+    }
+
+    return ANI_OK;
+}
+
+static 
+int checkPeerReplayCounter(tSuppRsnFsm *fsm, 
+                           tAniEapolKeyAvailEventData *data,
+                           v_BOOL_t *retransmit,
+                           v_BOOL_t actualMicFlag,
+                           v_BOOL_t reTxMicFlag)
+{
+    int retVal = ANI_OK;
+    int cmp;
+    tAniEapolRsnKeyDesc *rxDesc;
+    
+    rxDesc = data->keyDesc;
+    if( NULL == rxDesc )
+    {
+        return ANI_E_NULL_VALUE;
+    }
+
+    *retransmit = eANI_BOOLEAN_FALSE;
+    
+    cmp = aniSsmReplayCtrCmp(fsm->peerReplayCtr, rxDesc->replayCounter);
+    
+    // The AP should send us a replay counter greater than or equal to
+    // the last one it sent
+    /*Unless we are forgiving with this we will have interop issues with some vendros like CSR*/
+    if (cmp > 0) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "BP radio %d got old EAPOL replay counter from AP\n" );
+        retVal = ANI_E_REPLAY_CHECK_FAILED;
+
+    } 
+    else if (cmp <= 0) 
+    {
+        if ( actualMicFlag == reTxMicFlag ) 
+        { 
+            *retransmit = eANI_BOOLEAN_TRUE; 
+        }
+    }
+
+    return retVal;
+}
+
+static 
+int checkTransition(tSuppRsnFsm *fsm, void *arg)
+{
+    tAniEapolKeyAvailEventData *data;
+    tAniEapolRsnKeyDesc *rxDesc;
+    v_BOOL_t retransmit;
+    int retVal;
+
+    if (fsm->authReq) 
+    {
+        gotoStateAuthentication(fsm);
+        return ANI_OK;
+    }
+
+    switch (fsm->currentState) 
+    {
+    case INITIALIZE:
+        break;
+    case AUTHENTICATION:
+        gotoStateGotPmk(fsm);
+        checkTransition(fsm, arg);
+        break;
+    case GOT_PMK:
+        if (fsm->eapolAvail) {
+
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            data = (tAniEapolKeyAvailEventData *) arg;
+            rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+
+            if (rxDesc->info.ackFlag) 
+            {
+
+                aniSsmReplayCtrUpdate(fsm->peerReplayCtr,
+                                      rxDesc->replayCounter);
+
+                // Going from one state to another cannot be a retransmit
+                retVal = gotoStateStaKeyStart(fsm, data, eANI_BOOLEAN_FALSE);
+
+            }
+        }
+        break;
+    case STA_KEY_START:
+        if (fsm->eapolAvail) {
+
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            data = (tAniEapolKeyAvailEventData *) arg;
+            rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+
+            if (rxDesc->info.ackFlag) {
+
+                retVal = checkPeerReplayCounter(
+                        fsm, 
+                        data, 
+                        &retransmit, 
+                        rxDesc->info.micFlag,
+                        0);  // MIC not set means check for re-Tx M1.
+                if (retVal != ANI_OK)
+                    return ANI_OK; // Caller should not fail
+
+                if (retransmit) {
+
+                    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                                    "Resending EAPOL-Key Msg2 from "
+                                  "supplicant radio %d to AP\n" );
+                    retVal = gotoStateStaKeyStart(fsm, data, eANI_BOOLEAN_TRUE);
+
+                } 
+                else {
+                    retVal = checkMic(fsm, data, rxDesc->info.unicastFlag);
+                    if (retVal != ANI_OK) 
+                    {
+                        bapSuppDisconnect( fsm->ctx );
+                        return retVal;
+                    }
+
+                    aniSsmReplayCtrUpdate(fsm->peerReplayCtr,
+                                          rxDesc->replayCounter);
+
+                    gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_FALSE);
+
+                }
+            }
+        }
+        break;
+    case STA_KEY_SET:
+        if (fsm->eapolAvail) 
+        {
+            fsm->eapolAvail = eANI_BOOLEAN_FALSE;
+            data = (tAniEapolKeyAvailEventData *) arg;
+            rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
+
+            retVal = checkPeerReplayCounter(
+                        fsm, 
+                        data, 
+                        &retransmit, 
+                        rxDesc->info.micFlag,
+                        1);  // MIC set means check for re-Tx M3.
+            if (retVal != ANI_OK)
+                return ANI_OK; // Caller should not fail
+
+            if (!retransmit) 
+            {
+                retVal = checkMic(fsm, data, rxDesc->info.unicastFlag);
+                if (retVal != ANI_OK) 
+                {
+                    bapSuppDisconnect( fsm->ctx );
+                    return retVal;
+                }
+                aniSsmReplayCtrUpdate(fsm->peerReplayCtr,
+                                      rxDesc->replayCounter);
+
+            }
+
+            if (rxDesc->info.unicastFlag) 
+            {
+                /* 
+                 * Handle pairwise key message...in this state
+                 * pairwise key messages can only be for retransmissions.
+                 */
+                if (retransmit) 
+                {
+                    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                                   "Resending EAPOL-Key Msg4 from "
+                                  "supplicant \n" );
+                    retVal = gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_TRUE);
+                }
+            }
+            else 
+            {
+                /*
+                 * Handle group key message...with group key messages,
+                 * the replay counter has to change on
+                 * retransmissions.
+                 */
+                if (!retransmit) 
+                {
+                    retVal = gotoStateGroupKeySet(fsm, data);
+                    if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+                    {
+                        bapSuppDisconnect( fsm->ctx );
+                        return retVal;
+                    }
+                }
+            } 
+        } 
+        else {
+            if (fsm->integFailed) 
+            {
+                gotoStateKeyUpdate(fsm, arg);
+            }
+        }
+        break;
+    case GROUP_KEY_SET:
+        gotoStateStaKeySet(fsm, NULL, eANI_BOOLEAN_FALSE);
+        break;
+    case KEY_UPDATE:
+        gotoStateRekeyMsg(fsm, arg);
+        break;
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Illegal state for SuppRsnFsm: %d",
+                      fsm->currentState);
+        VOS_ASSERT( 0 );
+        return ANI_E_FAILED;
+    }
+
+    return ANI_OK;
+}
+
+
+
+static int
+suppEapolKeyHandler( tSuppRsnFsm *fsm,
+                    tAniPacket *eapolFrame, 
+                    tAniMacAddr suppMac)
+{
+    int retVal;
+    
+    int descType;
+    void *keyDesc;
+    tAniEapolRsnKeyDesc *rsnDesc;
+    tAniEapolKeyAvailEventData data;
+
+    do
+    {
+        retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            return retVal;
+        }
+
+        if (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+        {
+            rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc;
+            /*
+             * Pass on the event to the RSN FSM irrespective if it is
+             * pairwise or not.
+             */
+            data.keyDesc = keyDesc;
+            data.eapolFrame = eapolFrame;
+            retVal = suppRsnFsmProcessEvent(fsm, 
+                                            RSN_FSM_EAPOL_FRAME_AVAILABLE,
+                                            &data);
+        } 
+        else {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Supp: Got unexpected 802.1x RC4 Key message \n" );
+            retVal = ANI_E_FAILED;
+            break;
+        }
+    }while( 0 );
+
+    aniEapolKeyFreeDesc(descType, keyDesc);
+    return retVal;
+}
+
+
+
+//
+//This function alwasy assume the incoming vos_packet is 802_3 frame.
+static int suppRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket )
+{
+    int retVal = ANI_ERROR;
+    tAniPacket *pAniPacket;
+    tBtampContext *ctx;
+    tSuppRsnFsm *fsm;
+    /* Validate params */ 
+    if ((pvosGCtx == NULL) || (NULL == pPacket))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "param is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+    ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
+    if (NULL == ctx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "ctx is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+
+    fsm = &ctx->uFsm.suppFsm;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return retVal;
+    }
+
+    do
+    {
+        //ToDO: We need to synchronize this. For now, use the simplest form, drop the packet comes later.
+        if( fsm->fReceiving )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " ******suppRsnRxFrameHandler receive eapol packet while processing. Drop the new comer\n" );
+            break;
+        }
+        fsm->fReceiving = VOS_TRUE;
+        retVal = bapRsnFormPktFromVosPkt( &pAniPacket, pPacket );
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+        //Now we can process the eapol frame
+        //handler will free the pAniPacket
+        bapRsnEapolHandler( fsm, pAniPacket, VOS_FALSE );
+    }while( 0 );
+
+    fsm->fReceiving = VOS_FALSE;
+    vos_pkt_return_packet( pPacket );
+
+    return retVal;
+}
+
+
+static int suppRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus )
+{
+    tBtampContext *ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
+    tAuthRsnFsm *fsm;
+
+    vos_pkt_return_packet( pPacket );
+    if (pvosGCtx == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "param is NULL in %s", __FUNCTION__);
+
+        return ANI_ERROR;
+    }
+
+    if (NULL == ctx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "ctx is NULL in %s", __FUNCTION__);
+
+        return ANI_ERROR;
+    }
+
+    fsm = &ctx->uFsm.authFsm;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return ANI_ERROR;
+    }
+
+    //Synchronization needed
+    
+    if(!VOS_IS_STATUS_SUCCESS( retStatus ) )
+    {
+        //This is bad.
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Supp: TL Tx complete with error %d current state is %d\n", retStatus, fsm->currentState );
+        if( fsm->numTries <= suppConsts.maxTries )
+        {
+            //retransmit
+            fsm->numTries++;
+            if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
+            {
+                bapSuppDisconnect( fsm->ctx->pvosGCtx );
+            }
+        }
+        else
+        {
+            bapSuppDisconnect( fsm->ctx->pvosGCtx );
+        }
+    }
+
+    return ANI_OK;
+}
+
+
+/**
+ * suppEapolHandler
+ *
+ * Handles an incoming EAPOL frame on the supplicant side.
+ *
+ * @param eapolFrame the packet containing the EAPOL frame, with the
+ * head of the packet still at the start of the EAPOL frame
+ * @param dstMac the dstMac pointing inside the frame
+ * @param srcMac the srcMac pointing inside the frame
+ * @param type the type pointing inside the frame at the type field
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+void suppEapolHandler( tSuppRsnFsm *fsm, tAniPacket *eapolFrame,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac,
+                 v_U8_t *type )
+{
+    switch (*type) 
+    {
+    case ANI_EAPOL_TYPE_PACKET:
+        // Ignore EAP becasue it is only WPA2-PSK
+        break;
+    case ANI_EAPOL_TYPE_KEY:
+        suppEapolKeyHandler( fsm, eapolFrame, dstMac );
+        break;
+    case ANI_EAPOL_TYPE_ASF_ALERT:
+    default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "Supp: EAPOL type not implemented: %.2x\n", *type);
+        break;
+    }
+}
diff --git a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h
new file mode 100644
index 0000000..6c46a84
--- /dev/null
+++ b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xSuppRsnFsm.h $
+ *
+ * Contains declarations for the RSN EAPOL-Key FSM on the
+ * supplicant side. This is based on 802.11i.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-December-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef __AAG_SUPP_RSN_FSM_H
+#define __AAG_SUPP_RSN_FSM_H
+
+#include "bapRsn8021xFsm.h"
+#include "bapInternal.h"
+
+/**
+ * suppRsnFsmInit
+ *
+ * FUNCTION:
+ * Initializes the constants and the callbacks needed by this FSM
+ * module.
+ *
+ * @param cb callbacks to the various procedures needed by this FSM
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+suppRsnFsmInit(void);
+
+int
+suppRsnFsmSetPmk(tSuppContext *ctx, v_U8_t *pmk);
+
+#endif //__AAG_SUPP_RSN_FSM_H
diff --git a/CORE/BAP/src/bapRsnAsfPacket.c b/CORE/BAP/src/bapRsnAsfPacket.c
new file mode 100644
index 0000000..b45925e
--- /dev/null
+++ b/CORE/BAP/src/bapRsnAsfPacket.c
@@ -0,0 +1,1015 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File: $File: //depot/software/projects/feature_branches/nova_phase1/ap/apps/asf/aniAsfPacket.c $
+ * Contains definitions for packet manipulation routines that make it
+ * easy to create and parse multi-layered network frames. This module
+ * minimizes buffer copies while adding or removing headers, and
+ * adding or removing payload.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#include "vos_types.h"
+#include "vos_trace.h"
+#include <bapRsnAsfPacket.h>
+#include <bapRsnErrors.h>
+#include "vos_memory.h"
+#include "vos_packet.h"
+
+/*
+ * Allocate one more than required because the last bytes is waste. We
+ * waste the last byte because in the adopted model, the tail always
+ * points to the next location where data should be stored. In a full
+ * buffer we don't want to position the tail to memory we haven't
+ * allocated ourself.
+ */
+#define ANI_INTERNAL_DEFAULT_PACKET_SIZE (ANI_DEFAULT_PACKET_SIZE + 4)
+
+#define TAIL_SPACE(packet) \
+    ((packet)->buf + (packet)->size - (packet)->tail)
+
+#define HEAD_SPACE(packet) \
+     ((packet)->head - (packet)->buf)
+
+#define ANI_CHECK_RANGE(x , upper) \
+                ( (x) <= (upper) )
+
+/**
+ * Opaque packet structure with internal storage for raw bytes.
+ * Conceptually, a tAniPacket is a pre-allocated buffer that contains
+ * data in the middle and free space on either side. The start of the
+ * data is called the head. Routines are provided to add data at the
+ * front or at the rear. The length of the packet is the total number
+ * of valid data bytes contained in it. The size of the packet is the
+ * total number of preallocated bytes.
+ */
+struct tAniPacket {
+    v_U8_t *buf;
+    v_U32_t size;
+    v_U8_t *head;
+    v_U8_t *tail;
+    v_U8_t *recordHeader;
+    v_U32_t len;
+};
+
+/**
+ * aniAsfPacketAllocate
+ *
+ * FUNCTION:
+ * Create a packet of size 2*ANI_DEFAULT_PACKET_SIZE and positions the
+ * head of the packet in the center. The allocated storage can be free
+ * with a call to aniAsfPacketFree.
+ *
+ * LOGIC:
+ * Allocates storage for tAniPacket and its internal raw data
+ * buffer. Positions the head and tail pointers in the middle of the
+ * raw data buffer.
+ *
+ * @param packetPtr pointer that will be set to newly allocated
+ * tAniPacket if the operation succeeds.
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if
+ * memory could not be allocated.
+ * @see aniAsfPacketFree
+ */
+int
+aniAsfPacketAllocate(tAniPacket **packetPtr)
+{
+  return aniAsfPacketAllocateExplicit(packetPtr,
+                                   ANI_INTERNAL_DEFAULT_PACKET_SIZE,
+                                   ANI_INTERNAL_DEFAULT_PACKET_SIZE/2);
+}
+
+/**
+ * aniAsfPacketAllocateExplicit
+ *
+ * FUNCTION:
+ * Create a packet of the desired size and position the head of the
+ * packet at the desired offset in the internal raw data buffer. An
+ * application would normally set this offset to the expected length
+ * of the protocol header, then append the payload, and finally,
+ * prepend the header. The allocated storage can be free with a call
+ * to aniAsfPacketFree.
+ *
+ * LOGIC:
+ * Allocates storage for tAniPacket and its internal raw data
+ * buffer. Positions the head and tail pointers at the given offset in
+ * the internal raw data buffer.
+ *
+ * @param packetPtr pointer that will be set to newly allocated
+ * tAniPacket if the operation succeeds.
+ * @param size the size of the internal raw data buffer
+ * @param offset the offset in the internal raw data buffer where the
+ * head of the packet will be positioned initially
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if
+ * memory could not be allocated.
+ * @see aniAsfPacketFree
+ */
+int
+aniAsfPacketAllocateExplicit(tAniPacket **packetPtr,
+                             v_U32_t size,
+                             v_U32_t offset)
+{
+  tAniPacket *packet = NULL;
+  v_U32_t maxHead = size;
+
+  *packetPtr = NULL;
+  if (size == 0)
+    return ANI_E_ILLEGAL_ARG;
+
+  VOS_ASSERT(ANI_CHECK_RANGE(offset, maxHead));
+  if (!ANI_CHECK_RANGE(offset, maxHead))
+    return ANI_E_ILLEGAL_ARG;
+
+  packet = (tAniPacket *) vos_mem_malloc( sizeof(tAniPacket) );
+
+  if (packet == NULL) 
+  {
+      VOS_ASSERT( 0 );
+      return ANI_E_MALLOC_FAILED;
+  }
+
+  // transparently add one to the size since last byte is wasted
+  size = (size + 4) & 0xfffffffc;
+
+  packet->buf = (v_U8_t *)vos_mem_malloc( sizeof(v_U8_t) * size );
+  if (packet->buf == NULL) 
+  {
+      vos_mem_free( packet );
+      VOS_ASSERT( 0 );
+      return ANI_E_MALLOC_FAILED;
+  }
+
+  packet->size = size; // Should not be visible to the user
+  packet->head = packet->buf + offset;
+  packet->tail = packet->head;
+  packet->len = 0;
+
+  *packetPtr = packet;
+  return ANI_OK;
+}
+
+/**
+ * aniAsfPacketDuplicate
+ *
+ * Duplicates a given packet exactly. That is, the contents, the size
+ * of the packet, and the positions of the pointers are maintained in
+ * the new copy.
+ *
+ * @param newPacketPtr is set to a newly allocated packet that is a
+ * duplicate of oldPacket
+ * @param oldPacket the original packet that should be duplicated
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_NULL if oldPacket
+ * is NULL; 
+ */
+int
+aniAsfPacketDuplicate(tAniPacket **newPacketPtr, tAniPacket *oldPacket)
+{
+    int retVal;
+    int recordPos;
+    tAniPacket *packet = NULL;
+
+    if (oldPacket == NULL)
+        return ANI_E_NULL_VALUE;
+
+    retVal = aniAsfPacketAllocateExplicit(&packet,
+                                          oldPacket->size,
+                                          oldPacket->head - oldPacket->buf);
+    if (retVal != ANI_OK)
+        return retVal;
+
+    retVal = aniAsfPacketAppendBuffer(packet,
+                                      oldPacket->head,
+                                      oldPacket->len);
+    if (retVal != ANI_OK) 
+    {
+        VOS_ASSERT( 0 );
+        aniAsfPacketFree(packet);
+        return ANI_E_FAILED;
+    }
+
+    if (oldPacket->recordHeader != NULL) 
+    {
+        recordPos = oldPacket->recordHeader - oldPacket->buf;
+        packet->recordHeader = packet->buf + recordPos;
+    }
+    *newPacketPtr = packet;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketFree
+ *
+ * FUNCTION:
+ * Free a previously allocated tAniPacket and its internal raw data
+ * buffer.
+ *
+ * @param packet the packet to free
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_NULL_VALUE if an
+ * unexpected NULL pointer is encountered
+ */
+int
+aniAsfPacketFree(tAniPacket *packet)
+{
+  if (packet == NULL)
+    return ANI_E_NULL_VALUE;
+
+  if (packet->buf != NULL)
+    vos_mem_free( packet->buf );
+
+  vos_mem_free( packet );
+
+  return ANI_OK;
+}
+
+
+/**
+ * aniAsfPacketAppendBuffer
+ *
+ * FUNCTION:
+ * Appends the data contained in buf to the end of the data in
+ * destAniPacket. The head of destAniPacket remains unchanged, while its
+ * length increases by len.
+ *
+ * If there isn't enough free space in destAniPacket for all len bytes
+ * then the routine fails and the length of destAniPacket remains
+ * unchanged.
+ *
+ * LOGIC:
+ * Check that there is enough free space in the packet to append the
+ * buffer. If not, bail. Otherwise, copy bytes from the buffer into
+ * the packet's internal raw data buffer and increase the value of its
+ * length to reflect this.
+ *
+ * @param packet the packet to append to
+ * @param buf the buffer containing data to be appended to the packet
+ * @param len the number of bytes to append
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the
+ * packet does not have enough free space for the complete buffer
+ * @see aniAsfPacketPrependBuffer
+ */
+int
+aniAsfPacketAppendBuffer(tAniPacket *destPacket,
+                      const v_U8_t *buf,
+                      v_U32_t len)
+{
+  if (aniAsfPacketCanAppendBuffer(destPacket, len) != ANI_OK)
+      return ANI_E_FAILED;
+
+  if (buf == NULL)
+    return ANI_E_NULL_VALUE;
+
+  vos_mem_copy(destPacket->tail, buf, len);
+  destPacket->tail += len;
+  destPacket->len += len;
+  return ANI_OK;
+}
+
+/**
+ * aniAsfPacketPrependBuffer
+ *
+ * FUNCTION:
+ * Prepends the data contained in buf to the start of the data in
+ * destPacket. The head of destPacket is repositioned and the length
+ * of destPacket increases by len.
+ *
+ * If there isn't enough free space in destPacket for all len bytes
+ * then the routine fails and the length of destPacket remains
+ * unchanged.
+ *
+ * LOGIC:
+ * Check that there is enough free space in the packet to prepend the
+ * buffer. If not, bail. Otherwise, copy bytes from the buffer into
+ * the packet's internal raw data buffer and increase the value of its
+ * length to reflect this.
+ *
+ * @param packet the packet to prepend to
+ * @param buf the buffer containing data to be prepended to the packet
+ * @param len the number of bytes to prepend
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the
+ * packet does not have enough free space for the complete buffer
+ * @see aniAsfPacketAppendBuffer
+ */
+int
+aniAsfPacketPrependBuffer(tAniPacket *destPacket,
+                       const v_U8_t *buf,
+                       v_U32_t len)
+{
+  if (aniAsfPacketCanPrependBuffer(destPacket, len) != ANI_OK)
+      return ANI_E_FAILED;
+
+  if (buf == NULL)
+      return ANI_E_NULL_VALUE;
+
+  destPacket->head -= len;
+  destPacket->len += len;
+  vos_mem_copy(destPacket->head, buf, len);
+  return ANI_OK;
+
+}
+
+/**
+ * aniAsfPacketCanAppendBuffer
+ *
+ * FUNCTION:
+ * Determines if len bytes can be safely appended to destPacket
+ * without overflowing.
+ *
+ * LOGIC:
+ * Current packet tail plus len of buffer should not exceed packet
+ * start plus packet size
+ *
+ * Note: This does not return a boolean value, but instead an integer
+ * code.
+ *
+ * @param packet the packet to append to
+ * @param len the number of bytes to append
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketCanAppendBuffer(tAniPacket *destPacket,
+                         v_U32_t len)
+{
+  if (destPacket == NULL)
+    return ANI_E_FAILED;
+
+  if ((int)len <= TAIL_SPACE(destPacket))
+      return ANI_OK;
+  else
+      return ANI_E_FAILED;
+}
+
+/**
+ * aniAsfPacketCanPrependBuffer
+ *
+ * FUNCTION:
+ * Determines if len bytes can be safely prepended to destPacket
+ * without overflowing.
+ *
+ * LOGIC:
+ * Current packet head minus len of buffer should not be less than
+ * start of packet.
+ *
+ * Note: This does not return a boolean value, but instead an integer
+ * code.
+ *
+ * @param packet the packet to prepend to
+ * @param len the number of bytes to prepend
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketCanPrependBuffer(tAniPacket *destPacket,
+                          v_U32_t len)
+{
+  if (destPacket == NULL)
+      return ANI_E_FAILED;
+
+  if (!(len > 0))
+      return ANI_E_FAILED;
+
+  if ((int)len <= HEAD_SPACE(destPacket))
+      return ANI_OK;
+  else
+      return ANI_E_FAILED;
+}
+
+/**
+ * aniAsfPacketTruncateFromFront
+ *
+ * FUNCTION:
+ * Removes len bytes from the front of the packet by moving its
+ * head. The length of the packet is decremented by len.
+ *
+ * @param packet the packet to truncate from the front
+ * @param len the number of bytes to truncate
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketTruncateFromFront(tAniPacket *packet,
+                           v_U32_t len)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (!ANI_CHECK_RANGE(len, packet->len))
+        return ANI_E_FAILED;
+
+    packet->head += len;
+    packet->len -= len;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketTruncateFromRear
+ *
+ * FUNCTION:
+ * Removes len bytes from the rear of the packet by moving its
+ * tail. The length of the packet is decremented by len.
+ *
+ * @param packet the packet to truncate from the rear
+ * @param len the number of bytes to truncate
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketTruncateFromRear(tAniPacket *packet,
+                          v_U32_t len)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (!ANI_CHECK_RANGE(len, packet->len))
+        return ANI_E_FAILED;
+
+    packet->tail -= len;
+    packet->len -= len;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGetLen
+ *
+ * FUNCTION:
+ * Returns the number of valid data bytes stored in the packet.
+ *
+ * @param packet the packet whose len we need
+ *
+ * @return the non-negative number of bytes stored in the packet
+ */
+int
+aniAsfPacketGetLen(tAniPacket *packet)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    return packet->len;
+}
+
+/**
+ * aniAsfPacketGetBytes
+ *
+ * FUNCTION:
+ * Returns a pointer to the head of the valid data stored in the
+ * packet.
+ *
+ * @param packet the packet whose bytes we need
+ * @param rawBytesPtr the pointer that will be set the start of the
+ * raw bytes.
+ *
+ * @return The non-negative number of bytes stored in the packet if
+ * the operation succeeded. That is the same value as what would be
+ * returned by aniAsfPacketGetLen.
+ */
+int
+aniAsfPacketGetBytes(tAniPacket *packet, v_U8_t **rawBytesPtr)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    *rawBytesPtr = packet->head;
+    return packet->len;
+}
+
+/**
+ * aniAsfPacketGetN
+ *
+ * Returns N bytes from the packet and moves the head of the packet
+ * beyond those bytes.
+ *
+ * @param packet the packet to read from
+ * @param n the number of bytes to read
+ * @param bytesPtr is set to the start of the octets
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_SHORT_PACKET if the
+ * packet does not have n bytes.
+ */
+int
+aniAsfPacketGetN(tAniPacket *packet, int n, v_U8_t **bytesPtr)
+{
+    int retVal;
+    v_U8_t *bytes = NULL;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    retVal = aniAsfPacketGetBytes(packet, &bytes);
+    if (retVal < n)
+        return ANI_E_SHORT_PACKET;
+
+    aniAsfPacketTruncateFromFront(packet, n);
+
+    *bytesPtr = bytes;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketEmpty
+ *
+ * FUNCTION:
+ * Re-initializes the packet by positioning the head to the middle and
+ * setting the length to zero.
+ *
+ * @param packet the packet to empty
+ *
+ * @return ANI_OK if the operation succeeded
+ */
+int
+aniAsfPacketEmpty(tAniPacket *packet)
+{
+    return aniAsfPacketEmptyExplicit(packet, packet->size/2);
+}
+
+/**
+ * aniAsfPacketEmptyExplicit
+ *
+ * FUNCTION:
+ * Re-initializes the packet by positioning the head to the desired
+ * offset and setting the length to zero.
+ *
+ * @param packet the packet to empty
+ * @param offset the offset that the head of the packet should be set
+ * to. An application will be able to prepend and append data relative
+ * to this offset.
+ *
+ * @return ANI_OK if the operation succeeded
+ */
+int
+aniAsfPacketEmptyExplicit(tAniPacket *packet,
+                       v_U32_t offset)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    VOS_ASSERT(ANI_CHECK_RANGE(offset, packet->size));
+    if (!ANI_CHECK_RANGE(offset, packet->size))
+        return ANI_E_ILLEGAL_ARG;
+
+    packet->head = packet->buf + offset;
+    packet->tail = packet->head;
+    packet->len = 0;
+
+    return ANI_OK;
+}
+
+
+
+/**
+ * aniAsfPacketPrependHdr
+ *
+ * FUNCTION:
+ * Prepends a tAniHdr at the start of the packet.  All host to network
+ * byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param msgType the message type to write as part of the header
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrependHdr(tAniPacket *packet, v_U16_t msgType)
+{
+    int retVal;
+    int length;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    length = 4;
+
+    length = 2 + 2 + packet->len;
+
+    retVal = aniAsfPacketPrepend16(packet, length);
+    if (retVal < 0)
+        return retVal;
+
+    retVal = aniAsfPacketPrepend16(packet, msgType);
+    if (retVal < 0)
+        return retVal;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGet32
+ *
+ * FUNCTION:
+ * Reads a ANI_U32 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet32(tAniPacket *packet, v_U32_t *val)
+{
+    v_U8_t u32Arr[4];
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (val == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (packet->len < 4)
+        return ANI_E_SHORT_PACKET;
+
+    //packet is in network order, make sure it is align
+    u32Arr[0] = packet->head[0];
+    u32Arr[1] = packet->head[1];
+    u32Arr[2] = packet->head[2];
+    u32Arr[3] = packet->head[3];
+    *val = vos_be32_to_cpu( *(v_U32_t *)u32Arr );
+    aniAsfPacketTruncateFromFront(packet, 4);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketAppend32
+ *
+ * FUNCTION:
+ * Appends a ANI_U32 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend32(tAniPacket *packet, v_U32_t val)
+{
+    v_U8_t *p8;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (TAIL_SPACE(packet) < 4)
+        return ANI_E_FAILED;
+
+    val = vos_cpu_to_be32( val );
+    p8 = (v_U8_t *)&val;
+    packet->tail[0] =  p8[0];
+    packet->tail[1] =  p8[1];
+    packet->tail[2] =  p8[2];
+    packet->tail[3] =  p8[3];
+    aniAsfPacketMoveRight(packet, 4);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGet16
+ *
+ * FUNCTION:
+ * Reads a ANI_U16 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet16(tAniPacket *packet, v_U16_t *val)
+{
+    v_U8_t u16Arr[2];
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (val == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (packet->len < 2)
+        return ANI_E_SHORT_PACKET;
+
+    u16Arr[0] = packet->head[0];
+    u16Arr[1] = packet->head[1];
+    *val = vos_be16_to_cpu( *(v_U16_t *)u16Arr );
+    aniAsfPacketTruncateFromFront(packet, 2);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketPrepend16
+ *
+ * FUNCTION:
+ * Prepends a ANI_U16 to the start of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to prepend
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrepend16(tAniPacket *packet, v_U16_t val)
+{
+    v_U8_t *p8;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (HEAD_SPACE(packet) < 2)
+        return ANI_E_FAILED;
+
+    aniAsfPacketMoveLeft(packet, 2);
+    val = vos_cpu_to_be16( val );
+    p8 = (v_U8_t *)&val;
+    packet->head[0] =  p8[0];
+    packet->head[1] =  p8[1];
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketAppend16
+ *
+ * FUNCTION:
+ * Appends a ANI_U16 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend16(tAniPacket *packet, v_U16_t val)
+{
+    v_U8_t *p8;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (TAIL_SPACE(packet) < 2)
+        return ANI_E_FAILED;
+
+    val = vos_cpu_to_be16( val );
+    p8 = (v_U8_t *)&val;
+    packet->tail[0] =  p8[0];
+    packet->tail[1] =  p8[1];
+    aniAsfPacketMoveRight(packet, 2);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGet8
+ *
+ * FUNCTION:
+ * Reads a ANI_U8 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet8(tAniPacket *packet, v_U8_t *val)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (val == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (packet->len < 1)
+        return ANI_E_SHORT_PACKET;
+
+    *val = *(packet->head);
+    aniAsfPacketTruncateFromFront(packet, 1);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketPrepend8
+ *
+ * FUNCTION:
+ * Prepends a ANI_U8 to the start of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to prepend
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrepend8(tAniPacket *packet, v_U8_t val)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    VOS_ASSERT(HEAD_SPACE(packet) >= 1);
+    if (HEAD_SPACE(packet) < 1)
+        return ANI_E_FAILED;
+
+    aniAsfPacketMoveLeft(packet, 1);
+    *(packet->head) = val;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketAppend8
+ *
+ * FUNCTION:
+ * Appends a ANI_U8 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend8(tAniPacket *packet, v_U8_t val)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    if (TAIL_SPACE(packet) < 1)
+        return ANI_E_FAILED;
+
+    *(packet->tail) = val;
+    aniAsfPacketMoveRight(packet, 1);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGetMac
+ *
+ * FUNCTION:
+ * Returns a tAniMacAddr from the start of the packet.
+ *
+ * @param packet the packet to read from
+ * @param macAddr the destination to copy the MAC address to
+ *
+ * @return ANI_OK if the operation succeeds. Also, the packet head
+ * pointer is advanced past the MAC address.
+ */
+int
+aniAsfPacketGetMac(tAniPacket *packet, tAniMacAddr macAddr)
+{
+    if (packet->len < sizeof(tAniMacAddr))
+        return ANI_E_SHORT_PACKET;
+
+    vos_mem_copy(macAddr, packet->head, sizeof(tAniMacAddr));
+
+    packet->head += sizeof(tAniMacAddr);
+    packet->len -= sizeof(tAniMacAddr);
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketMoveLeft
+ *
+ * FUNCTION:
+ * Pretends that a certain number of bytes have been prepended to the
+ * packet, without actually copying any bytes in. The packet head and
+ * length are appropriately changed. This function is useful while
+ * interfacing with other libraries that only support byte array
+ * manipulation.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a two-step process - one: copy some bytes
+ * to the packet's internal buffer, two: move head and length. This
+ * violates the encapsulation the packet library aims to provide.
+ *
+ * @param packet the packet whose head and length needs to be modified
+ * @param count the number of bytes to modify by
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketMoveLeft(tAniPacket *packet, v_U32_t count)
+{
+    if (aniAsfPacketCanPrependBuffer(packet, count) != ANI_OK)
+        return ANI_E_FAILED;
+
+    packet->head -= count;
+    packet->len += count;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketMoveRight
+ *
+ * FUNCTION:
+ * Pretends that a certain number of bytes have been appended to the
+ * packet, without actually copying any bytes in. The packet tail and
+ * length are appropriately changed. This function is useful while
+ * interfacing with other libraries that only support byte array
+ * manipulation.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a two-step process - one: copy some bytes
+ * to the packet's internal buffer, two: move tail and length. This
+ * violates the encapsulation the packet library aims to provide.
+ *
+ * @param packet the packet whose head and length needs to be modified
+ * @param count the number of bytes to modify by
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketMoveRight(tAniPacket *packet, v_U32_t count)
+{
+    if (aniAsfPacketCanAppendBuffer(packet, count) != ANI_OK)
+        return ANI_E_FAILED;
+
+    packet->tail += count;
+    packet->len += count;
+
+    return ANI_OK;
+}
+
+/**
+ * aniAsfPacketGetBytesFromTail
+ *
+ * FUNCTION:
+ * Returns a pointer to the tail of the valid data stored 
+ * in the packet.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a three-step process - one: call this
+ * routine to obtain a pointer to the current tail of the packet. 
+ * two: treat this returned pointer like a simple array and copy 
+ * some bytes to the packet's internal buffer, and finally 
+ * three: move tail and length. This violates the encapsulation 
+ * the packet library aims to provide.
+ *
+ * @param packet the packet whose bytes we need
+ * @param rawBytesPtr the pointer that will be set the start of the
+ * raw bytes.
+ *
+ * @return The non-negative number of bytes stored in the packet if
+ * the operation succeeded. That is the same value as what would be
+ * returned by aniAsfPacketGetLen.
+ */
+int
+aniAsfPacketGetBytesFromTail(tAniPacket *packet, v_U8_t **rawBytesPtr)
+{
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    *rawBytesPtr = packet->tail;
+    return 0; // The length of used bytes returned is zero
+}
+
diff --git a/CORE/BAP/src/bapRsnAsfPacket.h b/CORE/BAP/src/bapRsnAsfPacket.h
new file mode 100644
index 0000000..e8a933d
--- /dev/null
+++ b/CORE/BAP/src/bapRsnAsfPacket.h
@@ -0,0 +1,607 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File: $File: //depot/software/projects/feature_branches/nova_phase1/ap/apps/include/aniAsfPacket.h $
+ * Contains declarations for packet manipulation routines that make it
+ * easy to create and parse multi-layered network frames. This module
+ * minimizes buffer copies while adding or removing headers, and
+ * adding or removing payload.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef _ANI_ASF_PACKET_H_
+#define _ANI_ASF_PACKET_H_
+
+#include "vos_types.h"
+#include "palTypes.h"
+
+#define ANI_ETH_FRAME_LEN 1516
+#define ANI_DEFAULT_PACKET_SIZE (ANI_ETH_FRAME_LEN*2)
+
+/**
+ * Opaque packet structure with internal storage for raw bytes.
+ * Conceptually, a tPacket is a pre-allocated buffer that contains
+ * data in the middle and free space on either side. The start of the
+ * data is called the head. Routines are provided to add data at the
+ * front or at the rear. The length of the packet is the total number
+ * of valid data bytes contained in it. The size of the packet is the
+ * total number of preallocated bytes.
+ */
+typedef struct tAniPacket tAniPacket;
+
+/**
+ * aniAsfPacketAllocate
+ *
+ * FUNCTION:
+ * Create a packet of size 2*ANI_DEFAULT_PACKET_SIZE and positions the
+ * head of the packet in the center. The allocated storage can be free
+ * with a call to aniAsfPacketFree.
+ *
+ * LOGIC:
+ * Allocates storage for tPacket and its internal raw data
+ * buffer. Positions the head and tail pointers in the middle of the
+ * raw data buffer.
+ *
+ * @param packetPtr pointer that will be set to newly allocated
+ * tPacket if the operation succeeds.
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if
+ * memory could not be allocated.
+ * @see aniAsfPacketFree
+ */
+int
+aniAsfPacketAllocate(tAniPacket **packetPtr);
+
+/**
+ * aniAsfPacketDuplicate
+ *
+ * Duplicates a given packet exactly. That is, the contents, the size
+ * of the packet, and the positions of the pointers are maintained in
+ * the new copy.
+ *
+ * @param newPacketPtr is set to a newly allocated packet that is a
+ * duplicate of oldPacket
+ * @param oldPacket the original packet that should be duplicated
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketDuplicate(tAniPacket **newPacketPtr, tAniPacket *oldPacket);
+
+/**
+ * aniAsfPacketAllocateExplicit
+ *
+ * FUNCTION:
+ * Create a packet of the desired size and position the head of the
+ * packet at the desired offset in the internal raw data buffer. An
+ * application would normally set this offset to the expected length
+ * of the protocol header, then append the payload, and finally,
+ * prepend the header. The allocated storage can be free with a call
+ * to aniAsfPacketFree.
+ *
+ * LOGIC:
+ * Allocates storage for tPacket and its internal raw data
+ * buffer. Positions the head and tail pointers at the given offset in
+ * the internal raw data buffer.
+ *
+ * @param packetPtr pointer that will be set to newly allocated
+ * tPacket if the operation succeeds.
+ * @param size the size of the internal raw data buffer
+ * @param offset the offset in the internal raw data buffer where the
+ * head of the packet will be positioned initially
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if
+ * memory could not be allocated.
+ * @see aniAsfPacketFree
+ */
+int
+aniAsfPacketAllocateExplicit(tAniPacket **packetPtr,
+                          v_U32_t size,
+                          v_U32_t offset);
+
+/**
+ * aniAsfPacketFree
+ *
+ * FUNCTION:
+ * Free a previously allocated tPacket and its internal raw data
+ * buffer.
+ *
+ * @param packet the packet to free
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_NULL_VALUE if an
+ * unexpected NULL pointer is encountered
+ */
+int
+aniAsfPacketFree(tAniPacket *packet);
+
+/**
+ * aniAsfPacket2Str
+ *
+ * FUNCTION:
+ * Returns a printable representation of the data contained in the
+ * packet. 
+ * Note: This function returns a static buffer used by aniAsfHexStr.
+ *
+ * @param packet the packet whose contents need to be printed
+ */
+v_U8_t *aniAsfPacket2Str(tAniPacket *packet);
+
+/**
+ * aniAsfPacketAppendBuffer
+ *
+ * FUNCTION:
+ * Appends the data contained in buf to the end of the data in
+ * destPacket. The head of destPacket remains unchanged, while its
+ * length increases by len.
+ *
+ * If there isn't enough free space in destPacket for all len bytes
+ * then the routine fails and the length of destPacket remains
+ * unchanged.
+ *
+ * LOGIC:
+ * Check that there is enough free space in the packet to append the
+ * buffer. If not, bail. Otherwise, copy bytes from the buffer into
+ * the packet's internal raw data buffer and increase the value of its
+ * length to reflect this.
+ *
+ * @param packet the packet to append to
+ * @param buf the buffer containing data to be appended to the packet
+ * @param len the number of bytes to append
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the
+ * packet does not have enough free space for the complete buffer
+ * @see aniAsfPacketPrependBuffer
+ */
+int
+aniAsfPacketAppendBuffer(tAniPacket *destPacket,
+                      const v_U8_t *buf,
+                      v_U32_t len);
+
+/**
+ * aniAsfPacketPrependBuffer
+ *
+ * FUNCTION:
+ * Prepends the data contained in buf to the start of the data in
+ * destPacket. The head of destPacket is repositioned and the length
+ * of destPacket increases by len.
+ *
+ * If there isn't enough free space in destPacket for all len bytes
+ * then the routine fails and the length of destPacket remains
+ * unchanged.
+ *
+ * LOGIC:
+ * Check that there is enough free space in the packet to prepend the
+ * buffer. If not, bail. Otherwise, copy bytes from the buffer into
+ * the packet's internal raw data buffer and increase the value of its
+ * length to reflect this.
+ *
+ * @param packet the packet to prepend to
+ * @param buf the buffer containing data to be prepended to the packet
+ * @param len the number of bytes to prepend
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the
+ * packet does not have enough free space for the complete buffer
+ * @see aniAsfPacketAppendBuffer
+ */
+int
+aniAsfPacketPrependBuffer(tAniPacket *destPacket,
+                       const v_U8_t *buf,
+                       v_U32_t len);
+
+/**
+ * aniAsfPacketCanAppendBuffer
+ *
+ * FUNCTION:
+ * Determines if len bytes can be safely appended to destPacket
+ * without overflowing.
+ *
+ * LOGIC:
+ * Current packet tail plus len of buffer should not exceed packet
+ * start plus packet size
+ *
+ * Note: This does not return a boolean value, but instead an integer
+ * code.
+ *
+ * @param packet the packet to append to
+ * @param len the number of bytes to append
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketCanAppendBuffer(tAniPacket *destPacket,
+                         v_U32_t len);
+
+/**
+ * aniAsfPacketCanPrependBuffer
+ *
+ * FUNCTION:
+ * Determines if len bytes can be safely prepended to destPacket
+ * without overflowing.
+ *
+ * LOGIC:
+ * Current packet head minus len of buffer should not be less than
+ * start of packet.
+ *
+ * Note: This does not return a boolean value, but instead an integer
+ * code.
+ *
+ * @param packet the packet to prepend to
+ * @param len the number of bytes to prepend
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketCanPrependBuffer(tAniPacket *destPacket,
+                          v_U32_t len);
+
+/**
+ * aniAsfPacketTruncateFromFront
+ *
+ * FUNCTION:
+ * Removes len bytes from the front of the packet by moving its
+ * head. The length of the packet is decremented by len.
+ *
+ * @param packet the packet to truncate from the front
+ * @param len the number of bytes to truncate
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketTruncateFromFront(tAniPacket *packet,
+                              v_U32_t len);
+
+/**
+ * aniAsfPacketTruncateFromRear
+ *
+ * FUNCTION:
+ * Removes len bytes from the rear of the packet by moving its
+ * tail. The length of the packet is decremented by len.
+ *
+ * @param packet the packet to truncate from the rear
+ * @param len the number of bytes to truncate
+ *
+ * @return ANI_OK if the append operation would succeed; ANI_E_FAILED
+ * otherwise
+ */
+int
+aniAsfPacketTruncateFromRear(tAniPacket *packet,
+                             v_U32_t len);
+
+/**
+ * aniAsfPacketGetLen
+ *
+ * FUNCTION:
+ * Returns the number of valid data bytes stored in the packet.
+ *
+ * @param packet the packet whose len we need
+ *
+ * @return the non-negative number of bytes stored in the packet
+ */
+int
+aniAsfPacketGetLen(tAniPacket *packet);
+
+/**
+ * aniAsfPacketGetBytes
+ *
+ * FUNCTION:
+ * Returns a pointer to the head of the valid data stored in the
+ * packet.
+ *
+ * @param packet the packet whose bytes we need
+ * @param rawBytesPtr the pointer that will be set the start of the
+ * raw bytes.
+ *
+ * @return The non-negative number of bytes stored in the packet if
+ * the operation succeeded. That is the same value as what would be
+ * returned by aniAsfPacketGetLen.
+ */
+int
+aniAsfPacketGetBytes(tAniPacket *packet, v_U8_t **rawBytesPtr);
+
+/**
+ * aniAsfPacketGetN
+ *
+ * Returns N bytes from the packet and moves the head of the packet
+ * beyond those bytes.
+ *
+ * @param packet the packet to read from
+ * @param n the number of bytes to read
+ * @param bytesPtr is set to the start of the octets
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_SHORT_PACKET if the
+ * packet does not have n bytes.
+ */
+int
+aniAsfPacketGetN(tAniPacket *packet, int n, v_U8_t **bytesPtr);
+
+/**
+ * aniAsfPacketEmpty
+ *
+ * FUNCTION:
+ * Re-initializes the packet by positioning the head to the middle and
+ * setting the length to zero.
+ *
+ * @param packet the packet to empty
+ *
+ * @return ANI_OK if the operation succeeded
+ */
+int
+aniAsfPacketEmpty(tAniPacket *packet);
+
+/**
+ * aniAsfPacketEmptyExplicit
+ *
+ * FUNCTION:
+ * Re-initializes the packet by positioning the head to the desired
+ * offset and setting the length to zero.
+ *
+ * @param packet the packet to empty
+ * @param offset the offset that the head of the packet should be set
+ * to. An application will be able to prepend and append data relative
+ * to this offset.
+ *
+ * @return ANI_OK if the operation succeeded
+ */
+int
+aniAsfPacketEmptyExplicit(tAniPacket *packet,
+                          v_U32_t offset);
+
+
+/**
+ * aniAsfPacketPrependHdr
+ *
+ * FUNCTION:
+ * Prepends a tAniHdr at the start of the packet.  All host to network
+ * byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param msgType the message type to write as part of the header
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrependHdr(tAniPacket *packet, v_U16_t msgType);
+
+/**
+ * aniAsfPacketGet32
+ *
+ * FUNCTION:
+ * Reads a ANI_U32 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet32(tAniPacket *packet, v_U32_t *val);
+
+/**
+ * aniAsfPacketAppend32
+ *
+ * FUNCTION:
+ * Appends a ANI_U32 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend32(tAniPacket *packet, v_U32_t val);
+
+/**
+ * aniAsfPacketGet16
+ *
+ * FUNCTION:
+ * Reads a ANI_U16 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet16(tAniPacket *packet, v_U16_t *val);
+
+/**
+ * aniAsfPacketPrepend16
+ *
+ * FUNCTION:
+ * Prepends a ANI_U16 to the start of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to prepend
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrepend16(tAniPacket *packet, v_U16_t val);
+
+/**
+ * aniAsfPacketAppend16
+ *
+ * FUNCTION:
+ * Appends a ANI_U16 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend16(tAniPacket *packet, v_U16_t val);
+
+/**
+ * aniAsfPacketGet8
+ *
+ * FUNCTION:
+ * Reads a ANI_U8 out of the packet and returns it. The packet's head
+ * is advanced and its length decremented by the appropriate length.
+ * All network to host byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to fill in
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketGet8(tAniPacket *packet, v_U8_t *val);
+
+/**
+ * aniAsfPacketPrepend8
+ *
+ * FUNCTION:
+ * Prepends a ANI_U8 to the start of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to read from
+ * @param val the value to prepend
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketPrepend8(tAniPacket *packet, v_U8_t val);
+
+/**
+ * aniAsfPacketAppend8
+ *
+ * FUNCTION:
+ * Appends a ANI_U8 to the end of the packet.
+ * All host to network byte order translation is also taken care of.
+ *
+ * @param packet the packet to write to
+ * @param val the value to append
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketAppend8(tAniPacket *packet, v_U8_t val);
+
+/**
+ * aniAsfPacketGetMac
+ *
+ * FUNCTION:
+ * Returns a tAniMacAddr from the start of the packet.
+ *
+ * @param packet the packet to read from
+ * @param macAddr the destination to copy the MAC address to
+ *
+ * @return ANI_OK if the operation succeeds. Also, the packet head
+ * pointer is advanced past the MAC address.
+ */
+int
+aniAsfPacketGetMac(tAniPacket *packet, tAniMacAddr macAddr);
+
+/**
+ * aniAsfPacketMoveLeft
+ *
+ * FUNCTION:
+ * Pretends that a certain number of bytes have been prepended to the
+ * packet, without actually copying any bytes in. The packet head and
+ * length are appropriately changed. This function is useful while
+ * interfacing with other libraries that only support byte array
+ * manipulation.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a two-step process - one: copy some bytes
+ * to the packet's internal buffer, two: move head and length. This
+ * violates the encapsulation the packet library aims to provide.
+ *
+ * @param packet the packet whose head and length needs to be modified
+ * @param count the number of bytes to modify by
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketMoveLeft(tAniPacket *packet, v_U32_t count);
+
+/**
+ * aniAsfPacketMoveRight
+ *
+ * FUNCTION:
+ * Pretends that a certain number of bytes have been appended to the
+ * packet, without actually copying any bytes in. The packet tail and
+ * length are appropriately changed. This function is useful while
+ * interfacing with other libraries that only support byte array
+ * manipulation.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a two-step process - one: copy some bytes
+ * to the packet's internal buffer, two: move tail and length. This
+ * violates the encapsulation the packet library aims to provide.
+ *
+ * @param packet the packet whose head and length needs to be modified
+ * @param count the number of bytes to modify by
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniAsfPacketMoveRight(tAniPacket *packet, v_U32_t count);
+
+/**
+ * aniAsfPacketGetBytesFromTail
+ *
+ * FUNCTION:
+ * Returns a pointer to the tail of the valid data stored 
+ * in the packet.
+ *
+ * WARNING: 
+ * Applications are discouraged from using this function
+ * because correct usage is a three-step process - one: call this
+ * routine to obtain a pointer to the current tail of the packet. 
+ * two: treat this returned pointer like a simple array and copy 
+ * some bytes to the packet's internal buffer, and finally 
+ * three: move tail and length. This violates the encapsulation 
+ * the packet library aims to provide.
+ *
+ * @param packet the packet whose bytes we need
+ * @param rawBytesPtr the pointer that will be set the start of the
+ * raw bytes.
+ *
+ * @return The non-negative number of bytes stored in the packet if
+ * the operation succeeded. That is the same value as what would be
+ * returned by aniAsfPacketGetLen.
+ */
+int
+aniAsfPacketGetBytesFromTail(tAniPacket *packet, v_U8_t **rawBytesPtr);
+
+
+#endif // _ANI_ASF_PACKET_H_
diff --git a/CORE/BAP/src/bapRsnErrors.h b/CORE/BAP/src/bapRsnErrors.h
new file mode 100644
index 0000000..1da6d59
--- /dev/null
+++ b/CORE/BAP/src/bapRsnErrors.h
@@ -0,0 +1,278 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File: $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniErrors.h $
+ *
+ * Contains definitions of error codes that are globally visible
+ * across WNI applications. There are two kinds of error codes:
+ * generic error codes and module specific error codes. Module specific
+ * error codes can further be of two kinds: those that are used
+ * internally within sub-modules, and those that are made visible
+ * to other modules. Each module will be pre-allocated a range of
+ * negative integers from which to choose both internal and external
+ * error codes uniquely. Note that internally used error codes need
+ * not be defined in this file so long as they adhere to the allocated
+ * range.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        17-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+
+#ifndef _ANI_ERRORS_H_
+#define _ANI_ERRORS_H_
+
+/**
+ * Indicates that the function returned successfully and no error was
+ * reported.
+ */
+#define ANI_OK      0
+#define ANI_ERROR   ANI_E_FAILED
+
+/**
+ * The range -1 to -1024 is reserved for generic error codes that are
+ * applicable to all modules.
+ */
+
+#define ANI_E_FAILED        -1 /// Generic error code for failure
+#define ANI_E_MALLOC_FAILED -2 /// Mem allocation failed
+#define ANI_E_ILLEGAL_ARG   -3 /// Function argument is illegal
+#define ANI_E_NULL_VALUE    -4 /// Encountered unexpected NULL value
+#define ANI_E_RAND_FAILED   -5 /// RNG failed
+#define ANI_E_SHORT_PACKET  -6 /// Packet is too small to contain data
+#define ANI_E_ELEM_NOT_FND  -7 /// Element not found
+#define ANI_E_INVALID_LEN   -8 /// Element has invalid Length 
+#define ANI_E_INVALID_DT    -9 /// Invalid Data Type 
+#define ANI_E_TIMEOUT       -10 /// Timeout occurred
+#define ANI_E_DBM_INVALID_ID    -11 /// Invalid DB id sent to server
+#define ANI_E_DBM_KEY_NOT_FOUND -12 /// Key's mapping was not found
+#define ANI_E_FILE_EMPTY    -13 /// file empty
+#define ANI_E_INVALID_MT    -14 /// Invalid ANI message type
+#define ANI_E_NOT_IMPLEMENTED   -15 /// Feature not implemented
+#define ANI_E_INVALID_PT    -16 /// Invalid Parameter Type 
+#define ANI_E_INVALID_PV    -17 /// Invalid Paramter Value
+#define ANI_E_IPCOPEN    -18 /// IPC open failed
+#define ANI_E_IPCCONNECT    -19 /// IPC connect failed
+#define ANI_E_IPCSEND    -20 /// IPC send failed
+#define ANI_E_FILE_NOT_FOUND    -21 /// file not found
+#define ANI_E_FILE_INVALID_CONTENT    -22 /// invalid file content
+#define ANI_E_FILE_READ_FAILED    -23 /// file read failed
+
+// ***** SSM libraries and applications use the range -1025 to -2999 *****
+
+/*
+ * The range -1025 to -2048 is reserved for use by the
+ * authentication agent and its sub-modules. The sub-range -1029 to
+ * -1150 is reserved for CLI usage.
+ */
+#define ANI_E_RANGE_START_AAG                   -1025
+
+// CLI Range starts here...
+#define ANI_E_RANGE_START_AAG_CLI               -1029
+#define ANI_E_CLI_ARG_MISSING                   -1029 // CLI command param missing
+#define ANI_E_CLI_ARG_INVALID                   -1030 // CLI command param invalid
+#define ANI_E_CLI_PAM_RADIUS_DB_UPDATE_FAILURE  -1031 // Failure to update PAM RADIUS DB
+#define ANI_E_CLI_AUTH_SERVER_NOT_FOUND         -1032 // Auth server not found
+#define ANI_E_CLI_SYS_INTERNAL_ERROR_PACKET_NULL -1033 // Internal error
+#define ANI_E_CLI_INVALID_DEVICE                -1034 // Invalid device
+#define ANI_E_CLI_AUTH_SERVER_INVALID_IPADDR    -1035 // Invalid IP addr
+#define ANI_E_CLI_AUTH_ZONE_NOT_EMPTY           -1036 // zone not empty
+#define ANI_E_CLI_AUTH_ZONE_AUTH_SERVERS_NOT_COPIED -1037 // zone not copied
+#define ANI_E_CLI_AUTH_ZONE_NAME_MISSING        -1038 // zone name missing
+#define ANI_E_CLI_AUTH_ZONE_EMPTY               -1039 // zone empty
+#define ANI_E_CLI_AUTH_ZONE_NOT_FOUND           -1040 // zone not found
+#define ANI_E_CLI_AUTH_SERVER_ARG_NOT_FOUND     -1041 // Cli Auth server arg missing
+#define ANI_E_CLI_IFNAME_ARG_NOT_FOUND          -1042 // Ifname arg missing
+#define ANI_E_CLI_KEYINDEX_ARG_NOT_FOUND        -1043 // Keyindex arg missing
+#define ANI_E_CLI_KEYLENGTH_ARG_NOT_FOUND       -1044 // KeyLength arg missing
+#define ANI_E_CLI_KEYLENGTH_ARG_INVALID         -1045 // KeyLength arg invalid
+#define ANI_E_CLI_SET_WEP_KEY_FAILED            -1046 // Set Wep key failed
+#define ANI_E_CLI_SYS_INTERNAL_ERROR            -1047 // Internal error
+#define ANI_E_CLI_OLD_PASSWORD_MISSING          -1048 // Old password missing
+#define ANI_E_CLI_NEW_PASSWORD_MISSING          -1049 // New password
+                                                      // missing
+#define ANI_E_CLI_WEP_KEY_LEN_ERROR             -1051 // key length error
+#define ANI_E_CLI_WEP_KEY_HEX_ERROR             -1052 // no hex character
+#define ANI_E_CLI_WPA_MODES_CFG_ERROR           -1053 // WPA config error
+#define ANI_E_CLI_WEP_AND_OPEN_CFG_ERROR        -1054 // WEP and open error
+#define ANI_E_CLI_OPEN_AND_WEP_CFG_ERROR        -1055 // open and WEP error
+#define ANI_E_CLI_LEGACY_WEP_AND_OPEN_CFG_ERROR -1056 // WEP and open error
+#define ANI_E_CLI_OPEN_AND_LEGACY_WEP_CFG_ERROR -1057 // open and WEP error
+#define ANI_E_CLI_WPA_MODES_NOT_AVAILABLE       -1058 // WPA modes not active
+#define ANI_E_CLI_INVALID_LISENCE_KEY           -1059 // invalid license
+#define ANI_E_CLI_EXISTING_LISENCE_KEY          -1060 // duplicated license
+#define ANI_E_CLI_WEP_INVALID_LENGTH_CHANGE     -1061 // invalid length change
+#define ANI_E_CLI_CNF_PASSWORD_MISMATCH         -1062 // confirm password mismatch
+#define ANI_E_CLI_INVALID_DISABLE               -1063 // cannot disable all sec modes
+#define ANI_E_CLI_PACKNUM_RANGE_ERROR           -1064 // cannot disable all sec modes
+#define ANI_E_CLI_IP_ADDR_INVALID               -1065 // IP address invalid
+#define ANI_E_CLI_AUTH_ZONE_NAME_INVALID        -1066 // zone name invalid
+#define ANI_E_CLI_OLD_PASSWORD_INVALID          -1067 // Old password invalid
+#define ANI_E_CLI_NO_EXT_RAD_ON_NONSECP         -1068 // Cannot add ext auth-server on
+                                                      // non-SEC/P with RAD proxying on
+#define ANI_E_CLI_NO_EXT_AUTH_ZONE_ALLOWED      -1069 // Cannot add ext auth-zone on
+                                                      // with RAD proxying on
+#define ANI_E_CLI_PORTAL_ZONE_AUTO_CONFIGURED   -1070 // Cannot manage portal auth-zone
+#define ANI_E_CLI_DEL_REQ_ON_REF_AUTH_SERVER    -1071 // Cannot delete auth-server
+                                                      // that is in a zone
+#define ANI_E_CLI_DEL_REQ_ON_REF_AUTH_ZONE      -1072 // Cannot delete auth-zone
+                                                      // that is used by SSID
+#define ANI_E_CLI_INVALID_INTERIM_UPDT_VALUE    -1073 // Invalid Accounting interim update interval
+#define ANI_E_RANGE_END_AAG_CLI                 -1199
+// ...CLI Range ends here
+
+// Non-CLI related error codes..
+#define ANI_E_MIC_FAILED                        -1200 // A MIC check failed
+#define ANI_E_REPLAY_CHECK_FAILED               -1201 // Replay Ctr mismatch
+#define ANI_E_RADIUS_PROFILE_MISSING            -1202 // User profile
+                                                      // not found
+#define ANI_E_AUTH_FAILED                       -1203 // Authentication failed
+#define ANI_E_RADIUS_PRIV_LEVEL_MISSING         -1204 // ANI_ADMIN_LEVEL is missing
+#define ANI_E_RADIUS_PRIV_LEVEL_INCORRECT       -1205 // ANI_ADMIN_LEVEL is incorrect
+
+// For some reason this is not contiguous with the other error codes(???)
+#define ANI_E_INVALID_COOKIE                    -1300 // Invalid cookie
+
+#define ANI_E_RANGE_END_AAG                     -2048
+
+/*
+ * The range -2049 to -2148 is reserved for use by the
+ * RADIUS client side library.
+ */
+#define ANI_E_RANGE_START_RAD       -2049
+#define ANI_E_RAD_FAILED            -2049 /// RADIUS operation failed
+#define ANI_E_RAD_ATTR_TOO_LONG     -2050 /// Attribute too long
+#define ANI_E_RAD_UNSOLICITED_RESP  -2051 /// Unsolicited response
+#define ANI_E_RAD_BAD_RESP_AUTH     -2052 /// Response auth check failed
+#define ANI_E_RAD_BAD_MESSG_AUTH    -2053 /// Response signature invalid
+#define ANI_E_RAD_ATTR_NOT_FOUND    -2054 /// Requested attr not found
+#define ANI_E_RAD_TIMEOUT           -2055 /// Request timed out waiting for server
+#define ANI_E_RAD_REJECT            -2056 /// Radius server did not accept user
+#define ANI_E_RANGE_END_RAD         -2148
+
+/*
+ * The range -2149 to -2999 is reserved for use by the SSM library.
+ */
+#define ANI_E_RANGE_START_SSM -2149
+#define ANI_E_SSM_CERT_UNPARSEABLE          ANI_E_RANGE_START_SSM - 1
+#define ANI_E_SSM_CERT_EXPIRED              ANI_E_RANGE_START_SSM - 2
+#define ANI_E_SSM_CERT_THUMBPRINT_MISMATCH  ANI_E_RANGE_START_SSM - 3
+#define ANI_E_SSM_CERT_NEW_ID               ANI_E_RANGE_START_SSM - 4
+#define ANI_E_RANGE_END_SSM   -2999
+
+/*
+ * The range -3000 to -3500 is reserved for use by the
+ * NetSim Server, Client, Client Modules and Pseudo driver
+ */
+#define ANI_E_RANGE_START_NETSIM     -3000
+#define ANI_E_RANGE_END_NETSIM       -3500
+
+/*
+ * The range -3501 to -4000 is reserved for use by the
+ * Discovery Server and its libraries.
+ */
+#define ANI_E_RANGE_START_DISC     -3501
+#define ANI_E_RANGE_END_DISC       -4000
+
+/*
+ * The range -4001 to -4500 is reserved for use by the
+ * Ezcfg Server
+ */
+#define ANI_E_RANGE_START_EZC     -4001
+
+// See file aniNmpEzcSvcMsgs.h for EZC specific error codes and messages
+#define ANI_E_RANGE_END_EZC       -4500
+
+/*
+ * The range -4501 to -4600 is reserved for use by the
+ * Software Download (SWD) Server
+ */
+#define ANI_E_RANGE_START_SWD     -4501
+
+// See file aniSwdSvcMsgs.h for SWD specific error codes and messages
+#define ANI_E_RANGE_END_SWD       -4600
+
+/*
+ * The range -4601 to -4700 is reserved for use by the
+ * Data Distribution Service (DDS) Server
+ */
+#define ANI_E_RANGE_START_DDS     -4601
+
+// See file aniDdsSvcMsgs.h for DDS specific error codes and messages
+#define ANI_E_RANGE_END_DDS       -4700
+
+/*
+ * The range -4701 to -4800 is reserved for use by
+ * HTTPS components.
+ */
+#define ANI_E_RANGE_START_HTTPS -4701
+#define ANI_E_HTTPS_UNREACHABLE      ANI_E_RANGE_START_HTTPS - 0
+#define ANI_E_HTTPS_UNTRUSTED_CERT   ANI_E_RANGE_START_HTTPS - 1
+#define ANI_E_HTTPS_RECVD_ALERT      ANI_E_RANGE_START_HTTPS - 2
+#define ANI_E_HTTPS_FAILED           ANI_E_RANGE_START_HTTPS - 3
+#define ANI_E_RANGE_END_HTTPS   -4800
+
+/*
+ * The range -4801 to -4900 is reserved for use by
+ * enrollment components.
+ */
+#define ANI_E_RANGE_START_ENROLLMENT -4801
+#define ANI_E_ENROLL_TP_AVAILABLE     ANI_E_RANGE_START_ENROLLMENT - 0
+#define ANI_E_ENROLL_ALREADY_TRUSTED  ANI_E_RANGE_START_ENROLLMENT - 1
+#define ANI_E_ENROLL_NOT_FOUND        ANI_E_RANGE_START_ENROLLMENT - 2
+#define ANI_E_ENROLL_PWD_FAILED       ANI_E_RANGE_START_ENROLLMENT - 3
+#define ANI_E_ENROLL_FAILED           ANI_E_RANGE_START_ENROLLMENT - 4
+#define ANI_E_ENROLL_NOT_PRISTINE     ANI_E_RANGE_START_ENROLLMENT - 5
+#define ANI_E_RANGE_END_ENROLLMENT   -4900
+
+
+/*
+ * The range -4901 to -5000 is reserved for use by NSM.
+ */
+#define ANI_E_RANGE_START_NSM -4901
+#define ANI_E_NSM_IPADDR_ASSIGNED     ANI_E_RANGE_START_NSM - 0
+#define ANI_E_RANGE_END_NSM   -5000
+
+/*
+ * The range -5001 to -5100 is reserved for use by the image
+ * validation library.
+ */
+#define ANI_E_RANGE_START_IMAGE -5001
+#define ANI_E_IMAGE_INVALID         ANI_E_RANGE_START_IMAGE - 0
+#define ANI_E_IMAGE_UNSUPPORTED     ANI_E_RANGE_START_IMAGE - 1
+#define ANI_E_RANGE_END_IMAGE   -5100
+
+/*
+ * The range -5101 to -5200 is reserved for use by CM
+ */
+#define ANI_E_RANGE_START_CM -5101
+#define ANI_E_MESG_UNAVAILABLE      ANI_E_RANGE_START_IMAGE - 0
+#define ANI_E_RANGE_END_CM   -5200
+
+
+#define ANI_IS_STATUS_SUCCESS( retVal )  ( ( retVal >= 0 ) )
+
+#endif //_ANI_ERRORS_H_
diff --git a/CORE/BAP/src/bapRsnSsmAesKeyWrap.c b/CORE/BAP/src/bapRsnSsmAesKeyWrap.c
new file mode 100644
index 0000000..fa97b88
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmAesKeyWrap.c
@@ -0,0 +1,394 @@
+/*
+ * 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.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmAesKeyWrap.c $
+ *
+ * Contains definitions for the AES Key Wrap algorithm from RFC 3394.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        31-March-2003
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+
+#include "vos_types.h"
+#include "bapRsnSsmServices.h"
+#include "bapRsnSsmEapol.h"
+#include "bapRsnErrors.h"
+#include "bapInternal.h"
+#include "bapRsn8021xFsm.h"
+#include "bapRsn8021xAuthFsm.h"
+#include "vos_utils.h"
+#include "vos_memory.h"
+#include "vos_timer.h"
+#include "bapRsnTxRx.h"
+#include "bapRsnSsmAesKeyWrap.h"
+
+#if 0
+
+#include <assert.h>
+#include <stdlib.h>
+#include <openssl/aes.h>
+
+#include <aniAsfHdr.h>
+#include <aniUtils.h>
+#include <aniErrors.h>
+#include <aniAsfLog.h>
+
+#include "aniSsmAesKeyWrap.h"
+#include "aniSsmUtils.h"
+#endif
+
+#define ANI_SSM_AES_KEY_WRAP_IC_SIZE    ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE
+
+typedef struct tag_aes_key {
+    tANI_U32 eK[64], dK[64];
+    int Nr;
+} AES_KEY;
+
+static tANI_U8 gAniSsmAesKeyWrapIv[] = {
+    0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6
+};
+
+static int
+aes(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen,
+    tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+    tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+    tANI_U8 b[AES_BLOCK_SIZE]);
+
+static int
+aes_1(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen,
+      tANI_U8 at[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+      tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+      tANI_U8 b[AES_BLOCK_SIZE]);
+
+static int
+xor(tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U32 t);
+
+/**
+ * Implements the AES Key Wrap algorithm described in RFC 3394.
+ * If n is the number of blocks in plainText, of size
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1)
+ * blocks. The first block is the IV from section 2.2.3 o the
+ * RFC. Note: It is the caller's responsibility to free the returned
+ * value.
+ * 
+ * @param plainText the plaintext data to wrap
+ * @param len the length of the plaintext, which must be a multiple of
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE.
+ * @param keyEncKey the encryption key
+ * @param keyEncKeyLen the length of keyEncKey
+ * @param cipherTextPtr is set to a newly allocated array containing
+ * the result if the operation succeeds. It is the caller's
+ * responsibility to free this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmAesKeyWrap(v_U32_t cryptHandle, tANI_U8 *plainText, tANI_U32 len,
+                 tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen,
+                 tANI_U8 **cipherTextPtr)
+{
+    int i, j, n;
+    int retVal;
+
+    tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE];
+    tANI_U8 *r = NULL;
+    tANI_U32 t;
+
+    tANI_U8 b[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2];
+
+    n = len / ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
+    if ((len % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Illegal number of input bytes to AES Key Wrap!");
+        return ANI_E_ILLEGAL_ARG;
+    }
+
+    // Allocate enough storage for 'A' as well as 'R'
+    r = vos_mem_malloc((n + 1) * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    if (r == NULL) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                 "Could not allocate space for R");
+        return ANI_E_MALLOC_FAILED;
+    }
+
+    vos_mem_copy(a, gAniSsmAesKeyWrapIv, sizeof(a));
+    vos_mem_copy(r + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, plainText, len);
+
+    for (j = 0; j <= 5; j++) {
+        for (i = 1; i <= n; i++) {
+
+            retVal = aes(cryptHandle, keyEncKey, keyEncKeyLen, 
+                         a,
+                         r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                         b);
+
+           if( !ANI_IS_STATUS_SUCCESS( retVal) ) goto error;
+
+            vos_mem_copy(a, b, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+            t = n*j + i;
+            xor(a, t);
+            vos_mem_copy(r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                   b + sizeof(b) - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                   ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+        }
+    }
+
+    vos_mem_copy(r, a, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    *cipherTextPtr = r;
+
+    return ANI_OK;
+
+ error:
+    if (r != NULL)
+        vos_mem_free(r);
+
+    return retVal;
+
+}
+
+/**
+ * Implements the AES Key Unwrap algorithm described in RFC 3394.
+ * If (n+1) is the number of blocks in cipherText, of size
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1)
+ * blocks. The actual plaintext consists of n blocks that start at the
+ * second block. Note: It is the caller's responsibility to free the
+ * returned value.
+ *
+ * @param cipherText the cipertext data to unwrap
+ * @param len the length of the ciphertext, which must be a multiple of
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE.
+ * @param keyEncKey the encryption key
+ * @param keyEncKeyLen the length of keyEncKey
+ * @param plainTextPtr is set to a newly allocated array containing
+ * the result if the operation succeeds. It is the caller's
+ * responsibility to free this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmAesKeyUnwrap(v_U32_t cryptHandle, tANI_U8 *cipherText, tANI_U32 len,
+                   tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen,
+                   tANI_U8 **plainTextPtr)
+{
+    int i, j;
+    int retVal;
+
+    tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE];
+    tANI_U8 *r = NULL;
+    tANI_U32 n;
+    tANI_U32 t;
+
+    tANI_U8 b[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2];
+
+    n = len / ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE - 1;
+    if ((len % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Illegal number of input bytes to AES Key Unwrap!");
+        return ANI_E_ILLEGAL_ARG;
+    }
+
+    // Allocate enough storage for 'A' as well as 'R'
+    r = vos_mem_malloc((n + 1) *  ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    if (r == NULL) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Could not allocate space for R");
+        return ANI_E_MALLOC_FAILED;
+    }
+
+    vos_mem_copy(a, cipherText, sizeof(a));
+    vos_mem_copy(r + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, 
+           cipherText + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, 
+           len - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+
+    for (j = 5; j >= 0; j--) {
+        for (i = n; i >= 1; i--) {
+
+            t = n*j + i;
+            xor(a, t);
+            retVal = aes_1(cryptHandle, keyEncKey, keyEncKeyLen, 
+                           a,
+                           r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                           b);
+           if( !ANI_IS_STATUS_SUCCESS( retVal) ) goto error;
+
+            vos_mem_copy(a, b, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+            vos_mem_copy(r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                   b + sizeof(b) - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE,
+                   ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+        }
+    }
+
+    if (vos_mem_compare2(a, gAniSsmAesKeyWrapIv, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) {
+        retVal = ANI_E_MIC_FAILED;
+        goto error;
+    }
+
+    *plainTextPtr = r;
+
+    return ANI_OK;
+
+ error:
+    if (r != NULL)
+        vos_mem_free(r);
+
+    return retVal;
+}
+
+static int
+aes(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen,
+    tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+    tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+    tANI_U8 b[AES_BLOCK_SIZE]) {
+
+    int retVal = 0;
+
+//    AES_KEY aesKey;
+
+    tANI_U8 in[AES_BLOCK_SIZE];
+    tANI_U8 *out;
+
+    VOS_ASSERT (AES_BLOCK_SIZE == ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2);
+
+    // Concatenate A and R[i]
+    vos_mem_copy(in, a, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    vos_mem_copy(in + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, 
+           ri, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    out = b;
+
+#if 0
+    retVal = AES_set_encrypt_key(keyBytes, keyLen*8, &aesKey);
+    if (retVal != 0) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "AES_set_encrypt_key returned %d", retVal);
+        return ANI_E_FAILED;
+    }
+
+    AES_encrypt(in, out, &aesKey);
+#else // Enable to use VOS function
+    retVal = vos_encrypt_AES(cryptHandle, /* Handle */
+                             in, /* input */
+                             out, /* output */
+                             keyBytes); /* key */
+    if (retVal != 0) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "vos_encrypt_AES returned %d", retVal);
+        return ANI_E_FAILED;
+    }
+#endif
+    return ANI_OK;
+}
+
+static int
+aes_1(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen,
+      tANI_U8 at[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+      tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE],
+      tANI_U8 b[AES_BLOCK_SIZE]) {
+
+    int retVal;
+
+//    AES_KEY aesKey;
+
+    tANI_U8 in[AES_BLOCK_SIZE];
+    tANI_U8 *out;
+
+    VOS_ASSERT (AES_BLOCK_SIZE == ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2);
+
+    // Concatenate A and R[i]
+    vos_mem_copy(in, at, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    vos_mem_copy(in + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, 
+           ri, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE);
+    out = b;
+
+#if 0
+    retVal = AES_set_decrypt_key(keyBytes, keyLen*8, &aesKey);
+    if (retVal != 0) {
+        ANI_SSM_LOG_E("AES_set_encrypt_key returned %d", retVal);
+        assert(0 && "AES_set_encrypt_key failed!");
+        return ANI_E_FAILED;
+    }
+
+    AES_decrypt(in, out, &aesKey);
+#else
+    retVal = vos_decrypt_AES(cryptHandle, /* Handle */
+                             in, /* input */
+                             out, /* output */
+                             keyBytes); /* key */
+    if (retVal != 0) {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "vos_decrypt_AES returned %d", retVal);
+    }
+#endif
+    return ANI_OK;
+}
+
+// From File : aniAsfHdr.h
+
+
+
+/*
+ * Put a long in host order into a char array in network order. 
+ * 
+ */
+static inline char *aniAsfWr32(char *cp, tANI_U32 x)
+{
+    tAniU32ValAry r;
+    int i;
+
+    r.val = vos_cpu_to_be32(x);
+    i = sizeof(tANI_U32) - 1;
+    cp[3] = r.ary[i--];
+    cp[2] = r.ary[i--];
+    cp[1] = r.ary[i--];
+    cp[0] = r.ary[i];
+
+    return (cp + sizeof(tANI_U32));
+}
+
+// From file : aniAsfMisc.c
+
+/*
+ * Put a long in host order into a char array in network order. 
+ * 
+ */
+char *aniAsfPut32(char *cp, tANI_U32 x)
+{
+    return(aniAsfWr32(cp, x));
+}
+
+
+static int
+xor(tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U32 t)
+{
+    tANI_U8 tmp[4];
+    aniAsfPut32((char *)tmp, t);
+    a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-1] ^= tmp[3];
+    a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-2] ^= tmp[2];
+    a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-3] ^= tmp[1];
+    a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-4] ^= tmp[0];
+    return ANI_OK;
+}
+
diff --git a/CORE/BAP/src/bapRsnSsmAesKeyWrap.h b/CORE/BAP/src/bapRsnSsmAesKeyWrap.h
new file mode 100644
index 0000000..428c1a3
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmAesKeyWrap.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.
+ */
+
+/*
+ * Qualcomm Inc, proprietary. All rights reserved.
+ * Ref File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/include/aniSsmAesKeyWrap.h $
+ *
+ * Contains SSM-private declarations related to the AES key WRAP
+ * algorithm described in RFC 3394.
+ *
+ * Author:      Arul V Raj
+ * Date:        27-February-2009
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+
+#ifndef _ANI_SSM_AES_KEY_WRAP_H_
+#define _ANI_SSM_AES_KEY_WRAP_H_
+
+#define ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE 8 // Bytes
+#define AES_BLOCK_SIZE 16 // Bytes
+
+typedef union uAniU32ValAry{
+    tANI_U32 val;
+    char ary[sizeof(tANI_U32)];
+} tAniU32ValAry;
+
+/**
+ * Implements the AES Key Wrap algorithm described in RFC 3394.
+ * If n is the number of blocks in plainText, of size
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1)
+ * blocks. The first block is the IV from section 2.2.3 o the
+ * RFC. Note: It is the caller's responsibility to free the returned
+ * value.
+ * 
+ * @param plainText the plaintext data to wrap
+ * @param len the length of the plaintext, which must be a multiple of
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE.
+ * @param keyEncKey the encryption key
+ * @param keyEncKeyLen the length of keyEncKey
+ * @param cipherTextPtr is set to a newly allocated array containing
+ * the result if the operation succeeds. It is the caller's
+ * responsibility to free this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmAesKeyWrap(v_U32_t cryptHandle, tANI_U8 *plainText, tANI_U32 len,
+                 tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen,
+                 tANI_U8 **cipherTextPtr);
+
+/**
+ * Implements the AES Key Unwrap algorithm described in RFC 3394.
+ * If (n+1) is the number of blocks in cipherText, of size
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1)
+ * blocks. The actual plaintext consists of n blocks that start at the
+ * second block. Note: It is the caller's responsibility to free the
+ * returned value.
+ *
+ * @param cipherText the cipertext data to unwrap
+ * @param len the length of the ciphertext, which must be a multiple of
+ * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE.
+ * @param keyEncKey the encryption key
+ * @param keyEncKeyLen the length of keyEncKey
+ * @param plainTextPtr is set to a newly allocated array containing
+ * the result if the operation succeeds. It is the caller's
+ * responsibility to free this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmAesKeyUnwrap(v_U32_t cryptHandle, tANI_U8 *cipherText, tANI_U32 len,
+                   tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen,
+                   tANI_U8 **plainTextPtr);
+
+
+#endif //_ANI_SSM_AES_KEY_WRAP_H_
+
diff --git a/CORE/BAP/src/bapRsnSsmEapol.c b/CORE/BAP/src/bapRsnSsmEapol.c
new file mode 100644
index 0000000..6d12fdc
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmEapol.c
@@ -0,0 +1,1128 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File: $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmEapol.c#2 $ 
+ *
+ * Contains definitions of various utilities for EAPoL frame
+ * parsing and creation.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#include "vos_utils.h"
+#include <bapRsnAsfPacket.h>
+#include <bapRsnErrors.h>
+#include <bapRsnSsmEapol.h>
+#include "bapRsn8021xFsm.h"
+#include "vos_memory.h"
+
+//#include "aniSsmUtils.h"
+
+#define CHECK_RETVAL(retVal) \
+              assert(retVal == ANI_OK); \
+              if (retVal != ANI_OK) return ANI_E_FAILED;
+
+
+//TODO: Put these in an array after EAPOL_TYPE is made an enum
+#define ANI_EAPOL_TYPE_PACKET_STR    "EAP"
+#define ANI_EAPOL_TYPE_START_STR     "START"
+#define ANI_EAPOL_TYPE_LOGOFF_STR    "LOGOFF"
+#define ANI_EAPOL_TYPE_KEY_STR       "KEY"
+#define ANI_EAPOL_TYPE_ASF_ALERT_STR "ALERT"
+#define ANI_EAPOL_TYPE_UNKNOWN_STR   "UNKNOWN"
+
+/**
+ * The EAPOL packet is structured as follows:
+ */
+#define DST_MAC_POS 0
+#define SRC_MAC_POS 6
+#define ETHER_PROTO_POS 12
+#define EAPOL_VERSION_POS 14
+#define ANI_EAPOL_TYPE_POS 15
+#define EAPOL_BODY_LEN_POS 16
+#define EAPOL_BODY_POS EAPOL_RX_HEADER_SIZE
+
+#define EAPOL_BODY_LEN_SIZE 2
+
+#define ANI_SSM_LEGACY_RC4_KEY_SIGN_OFFSET EAPOL_BODY_POS + 28
+
+/**
+ * Bitmasks for the RSN Key Information field
+ */
+#define ANI_SSM_RSN_KEY_DESC_VERS_MASK 0x0007
+#define ANI_SSM_RSN_UNICAST_MASK       0x0008
+#define ANI_SSM_RSN_KEY_INDEX_MASK     0x0030
+#define ANI_SSM_RSN_INSTALL_MASK       0x0040
+#define ANI_SSM_RSN_ACK_MASK           0x0080
+#define ANI_SSM_RSN_MIC_MASK           0x0100
+#define ANI_SSM_RSN_SECURE_MASK        0x0200
+#define ANI_SSM_RSN_ERROR_MASK         0x0400
+#define ANI_SSM_RSN_REQUEST_MASK       0x0800
+#define ANI_SSM_RSN_ENC_KEY_DATA_MASK  0x1000
+
+#define ANI_SSM_RSN_KEY_DESC_VERS_OFFSET  0
+#define ANI_SSM_RSN_KEY_INDEX_OFFSET      4
+
+#define ANI_SSM_RSN_KEY_MIC_OFFSET EAPOL_BODY_POS + 77
+
+/**
+ * Other hard coded values for convenience:
+ */
+static const v_U8_t 
+ANI_ETH_P_EAPOL_BYTES[2] = {0x00, 0x03};//BT-AMP security type{0x88, 0x8e};
+static const v_U8_t 
+EAPOL_VERSION_BYTES[1] = {EAPOL_VERSION_1};
+static const v_U8_t 
+ANI_EAPOL_TYPE_PACKET_BYTES[1] = {ANI_EAPOL_TYPE_PACKET};
+static const v_U8_t 
+ANI_EAPOL_TYPE_START_BYTES[1] = {ANI_EAPOL_TYPE_START};
+static const v_U8_t 
+ANI_EAPOL_TYPE_LOGOFF_BYTES[1] = {ANI_EAPOL_TYPE_LOGOFF};
+static const v_U8_t 
+ANI_EAPOL_TYPE_KEY_BYTES[1] = {ANI_EAPOL_TYPE_KEY};
+static const v_U8_t 
+ANI_EAPOL_TYPE_ASF_ALERT_BYTES[1] = {ANI_EAPOL_TYPE_ASF_ALERT};
+static const v_U8_t 
+ZERO_BYTES[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static v_U8_t BAP_RSN_LLC_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 };
+
+
+
+static int
+parseRsnKeyDesc(tAniPacket *packet, 
+                tAniEapolRsnKeyDesc **rsnDescPtr);
+
+static int
+parseRsnKeyInfo(tAniPacket *packet, 
+                tAniRsnKeyInfo *info);
+
+static int
+writeRsnKeyDesc(tAniPacket *packet,
+                tAniEapolRsnKeyDesc *rsnDesc,
+                v_U8_t keyDescType);
+
+static int
+writeRsnKeyInfo(tAniPacket *packet, tAniRsnKeyInfo *info);
+
+static int
+writeRsnKeyMic(v_U32_t cryptHandle,
+               tAniPacket *eapolFrame, 
+               tAniEapolRsnKeyDesc *rsnDesc,
+               v_U8_t *micKey, 
+               v_U32_t micKeyLen);
+
+static int
+checkRsnKeyMic(v_U32_t cryptHandle,
+               tAniPacket *eapolFrame,
+               tAniEapolRsnKeyDesc *rsnDesc,
+               v_U8_t *micKey,
+               v_U32_t micKeyLen);
+
+extern void authEapolHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac,
+                 v_U8_t *type);
+extern void suppEapolHandler( tSuppRsnFsm *fsm, tAniPacket *eapolFrame,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac,
+                 v_U8_t *type);
+
+/**
+ * addEapolHeaders
+ *
+ * FUNCTION:
+ * Prepends the EAPOL header to a packet.
+ *
+ * ASSUMPTIONS:
+ * The packet has enough space available for prepending the EAPOL
+ * header.
+ *
+ * @param packet the packet to prepend to
+ * @param dstMac the MAC address of the destination (authenticator)
+ * @param srcMac the MAC address of the source (supplicant)
+ * @param eapolType the EAPOL-Type field
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+static int
+addEapolHeaders(tAniPacket *packet, 
+                tAniMacAddr dstMac, 
+                tAniMacAddr srcMac, 
+                v_U8_t eapolType)
+{
+    int retVal;
+    v_U16_t len;
+  
+    do
+    {
+        retVal = aniAsfPacketGetLen(packet);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        len = retVal;
+        retVal = aniAsfPacketPrepend16(packet, len);
+
+        retVal = aniAsfPacketPrepend8(packet, eapolType);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketPrependBuffer(packet, EAPOL_VERSION_BYTES, 1);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketPrependBuffer(packet, ANI_ETH_P_EAPOL_BYTES, 2);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        //Since TL expects SNAP header in all packets we send, put it in
+        retVal = aniAsfPacketPrependBuffer(packet, BAP_RSN_LLC_HEADER, sizeof(BAP_RSN_LLC_HEADER));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        //packet length
+        len += 6/*length + eapolType+version + eth_type*/ + sizeof(BAP_RSN_LLC_HEADER);
+        retVal = aniAsfPacketPrepend16(packet, len);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketPrependBuffer(packet, srcMac, sizeof(tAniMacAddr));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketPrependBuffer(packet, dstMac, sizeof(tAniMacAddr));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+    }while( 0 );
+
+    return retVal;
+}
+
+/**
+ * aniEapolWriteStart
+ *
+ * FUNCTION:
+ * Writes an EAPOL-Start frame to the packet. It is only used by the
+ * supplicant.
+ *
+ * LOGIC:
+ * Prepend the appropriate EAPOL header to the packet. There is no
+ * EAPOL payload for this kind of frame.
+ *
+ * ASSUMPTIONS:
+ * The packet has enough space available for prepending the header.
+ *
+ * @param packet the packet to which the frame should be written
+ * @param dstMac the MAC address of the destination (authenticator)
+ * @param srcMac the MAC address of the source (supplicant)
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolWriteStart(tAniPacket *packet, 
+                   tAniMacAddr dstMac,
+                   tAniMacAddr srcMac)
+{
+    return ( addEapolHeaders(packet, dstMac, srcMac, ANI_EAPOL_TYPE_START) );
+}
+
+/**
+ * aniEapolWriteEapPacket
+ *
+ * FUNCTION:
+ * Writes the EAPOL/EAP-Packet frame headers. It is used
+ * by both the authenticator and the supplicant. This creates an EAPOL
+ * frame that is carrying an EAP message as its payload.
+ *
+ * LOGIC:
+ * Prepend the appropriate EAPOL header to the packet.
+ *
+ * ASSUMPTIONS:
+ * The EAP message (ie., the payload) is already available in the
+ * packet and that the packet has enough space available for
+ * prepending the EAPOL header.
+ *
+ * @param packet the packet containing the EAP message
+ * @param dstMac the MAC address of the destination (authenticator)
+ * @param srcMac the MAC address of the source (supplicant)
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolWriteEapPacket(tAniPacket *eapPacket, 
+                       tAniMacAddr dstMac, 
+                       tAniMacAddr srcMac)
+{
+    return( addEapolHeaders(eapPacket, dstMac, srcMac, ANI_EAPOL_TYPE_PACKET) );
+}
+
+/**
+ * aniEapolParse
+ *
+ * FUNCTION:
+ * Parses an EAPoL frame to the first level of headers (no EAP
+ * headers are parsed). 
+ *
+ * NOTE: This is a non-destructive read, that is the
+ * headers are not stripped off the packet. However, any additional
+ * data at  the end of the packet, beyond what the EAPoL headers encode
+ * will be stripped off.
+ *
+ * @param packet the packet containing the EAPoL frame to parse
+ * @param dstMac a pointer to set to the location of the destination
+ * MAC address
+ * @param srcMac a pointer to set to the location of the source
+ * MAC address
+ * @param type a pointer to set to the location of the EAPOL type
+ * field.
+ *
+ * @return the non-negative length of the EAPOL payload if the operation
+ * succeeds
+ */
+int 
+aniEapolParse(tAniPacket *packet,
+              v_U8_t **dstMac, 
+              v_U8_t **srcMac, 
+              v_U8_t **type)
+{
+    v_U16_t frameType;
+    v_U8_t *ptr;
+    int retVal;
+    int tmp;
+
+    if (aniAsfPacketGetLen(packet) < EAPOL_BODY_POS)
+        return ANI_E_ILLEGAL_ARG;
+
+    retVal = aniAsfPacketGetBytes(packet, &ptr);
+    if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+    {
+        return retVal;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+            "Supp parsing EAPOL packet of len %d: \n",
+                retVal);
+
+    frameType = (ptr[ETHER_PROTO_POS] << 8) + ptr[ETHER_PROTO_POS+1];
+
+    /*
+     * Validate the EAPOL-FRAME
+     */
+
+    if (frameType != ANI_ETH_P_EAPOL)
+        return ANI_E_ILLEGAL_ARG;
+
+    *dstMac = ptr + DST_MAC_POS;
+    *srcMac = ptr + SRC_MAC_POS;
+
+    //    if (ptr[EAPOL_VERSION_POS] != EAPOL_VERSION_1)
+    //        return ANI_E_ILLEGAL_ARG;
+
+    *type = ptr + ANI_EAPOL_TYPE_POS;
+    retVal = (ptr[EAPOL_BODY_LEN_POS] << 8) + ptr[EAPOL_BODY_LEN_POS + 1];
+ 
+    /* 
+     * Validate the length of the body. Allow for longer 
+     * packets than encoded, but encoding should not be larger than
+     * packet.
+     * Note: EAPOL body len does not include headers
+     */
+    tmp = aniAsfPacketGetLen(packet) - EAPOL_RX_HEADER_SIZE;
+    if (retVal > tmp) 
+    {
+        retVal = ANI_E_ILLEGAL_ARG;
+    } 
+    else {
+        if (retVal < tmp) 
+        {
+            retVal = aniAsfPacketTruncateFromRear(packet, tmp - retVal);
+        }
+    }
+
+    return retVal;
+}
+
+/**
+ * aniEapolWriteKey
+ *
+ * Writes out a complete EAPOL-Key frame. The key descriptor is
+ * appended to the packet and the EAPOL header is prepended to it. If
+ * a micKey is passed in, then a MIC is calculated and inserted into
+ * the frame.
+ *
+ * @param packet the packet to write to
+ * @param dstMac the destination MAC address
+ * @param srcMac the source MAC address
+ * @param descType the key descriptor type
+ * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
+ * ANI_EAPOL_KEY_DESC_TYPE_RSN).
+ * @param keyDescData the key descriptor data corresponding to the
+ * above descType. The signature field is ignored and will be
+ * generated in the packet. The key bytes are expected to be encrypted
+ * if they need to be encrypted.
+ * @param micKey the MIC key
+ * @param micKeyLen the number of bytes in the MIC key
+ *
+ * @return ANI_OK if the operation succeeds
+ *
+ */
+int
+aniEapolWriteKey(v_U32_t cryptHandle,
+                 tAniPacket *packet,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac, 
+                 int descType,
+                 void *keyDescData,
+                 v_U8_t *micKey,
+                 v_U32_t micKeyLen)
+{
+    int retVal;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    do
+    {
+        if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+                || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) 
+        {
+
+            retVal = writeRsnKeyDesc(packet,
+                                     (tAniEapolRsnKeyDesc *) keyDescData,
+                                     // Indicate 
+                                     // ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW 
+                                     // or ANI_EAPOL_KEY_DESC_TYPE_RSN
+                                     descType);
+            if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+            {
+                break;
+            }
+
+            retVal = addEapolHeaders(packet, dstMac, srcMac, ANI_EAPOL_TYPE_KEY);
+            if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
+
+            retVal = writeRsnKeyMic(cryptHandle,
+                                    packet, 
+                                    (tAniEapolRsnKeyDesc *) keyDescData,
+                                    micKey, micKeyLen);
+            if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
+
+        } 
+        else {
+            VOS_ASSERT( 0 );
+            return ANI_E_ILLEGAL_ARG;
+        }
+    }while( 0 );
+
+    return retVal;
+}
+
+
+/**
+ * aniEapolParseKey
+ *
+ * Parses and verifies a complete EAPOL-Key frame. The key descriptor
+ * type is returned and so is a newly allocated key descriptor structure
+ * that is appropriate for the type.
+ *
+ * NOTE: This is a non-destructive read. That is, the packet headers
+ * will be unchanged at the end of this read operation. This is so
+ * that a followup MIC check may be done on the complete packet. If
+ * the packet parsing fails, the packet headers are not guaranteed to
+ * be unchanged.
+ *
+ * @param packet the packet to read from. Note that the frame is not
+ * expected to contain any additional padding at the end other than
+ * the exact number of key bytes. (The aniEapolParse function will
+ * ensure this.)
+ * @param descType is set to the key descriptor type
+ * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
+ * ANI_EAPOL_KEY_DESC_TYPE_RSN).
+ * @param keyDescData is set to a newly allocated key descriptor
+ * corresponding to the above descType. The signature field is
+ * verified. The key bytes will be returned encrypted. It is the
+ * responsibility of the caller to free this structure and the data
+ * contained therein.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolParseKey(tAniPacket *packet,
+                 int *descType,
+                 void **keyDescData)
+{
+    int retVal;
+    v_U8_t *bytes;
+    v_U32_t eapolFrameLen;
+
+    if (packet == NULL)
+        return ANI_E_NULL_VALUE;
+
+    do
+    {
+        eapolFrameLen = aniAsfPacketGetLen(packet);
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "Supp parsing EAPOL-Key frame of len %d\n", 
+                      eapolFrameLen);
+
+        retVal = aniAsfPacketTruncateFromFront(packet, EAPOL_RX_HEADER_SIZE);
+        if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
+        
+        retVal = aniAsfPacketGetBytes(packet, &bytes);
+        if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
+
+        if (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN ||
+                   *bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+        {
+            tAniEapolRsnKeyDesc *rsnDesc = NULL;
+
+            //*descType = ANI_EAPOL_KEY_DESC_TYPE_RSN;
+            *descType = (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW ?  
+                 ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW :  ANI_EAPOL_KEY_DESC_TYPE_RSN) ;
+            retVal = parseRsnKeyDesc(packet, &rsnDesc);
+            if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
+            *keyDescData = rsnDesc;
+        } 
+        else 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "Supp received unknown EAPOL-Key descriptor: %d\n",
+                        *bytes);
+            retVal = ANI_E_ILLEGAL_ARG;
+            break;
+        }
+
+        aniAsfPacketMoveLeft(packet, eapolFrameLen);
+    }while( 0 );
+    
+    return retVal;
+}
+
+
+
+static int
+parseRsnKeyDesc(tAniPacket *packet, 
+                tAniEapolRsnKeyDesc **rsnDescPtr)
+{
+    int retVal = ANI_OK;
+    int len;
+    v_U8_t *bytes;
+    tAniEapolRsnKeyDesc *rsnDesc = NULL;
+
+    do
+    {
+        aniAsfPacketTruncateFromFront(packet, 1); // Desc-Type
+
+        rsnDesc = (tAniEapolRsnKeyDesc *) 
+            vos_mem_malloc( sizeof(tAniEapolRsnKeyDesc) );
+
+        if (rsnDesc == NULL) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                    "Supp could not malloc EAPOL-Key Descriptor for RSN\n");
+            retVal = ANI_E_MALLOC_FAILED;
+            break;
+        }
+
+        retVal = parseRsnKeyInfo(packet, &rsnDesc->info);
+        if (retVal != ANI_OK) break;
+
+        retVal = aniAsfPacketGet16(packet, &rsnDesc->keyLen);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+
+        len = sizeof(rsnDesc->replayCounter);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->replayCounter, bytes, len);
+
+        len = sizeof(rsnDesc->keyNonce);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->keyNonce, bytes, len);
+
+        len = sizeof(rsnDesc->keyIv);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->keyIv, bytes, len);
+
+        len = sizeof(rsnDesc->keyRecvSeqCounter);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->keyRecvSeqCounter, bytes, len);    
+
+        len = sizeof(rsnDesc->keyId);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->keyId, bytes, len);
+
+        len = sizeof(rsnDesc->keyMic);
+        retVal = aniAsfPacketGetN(packet, len, &bytes);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+        vos_mem_copy(rsnDesc->keyMic, bytes, len);
+
+        retVal = aniAsfPacketGet16(packet, &rsnDesc->keyDataLen);
+        if (retVal != ANI_OK)
+        {
+            break;
+        }
+
+        len = rsnDesc->keyDataLen;
+        if (len > 0) {
+            // We have a key
+            retVal = aniAsfPacketGetN(packet, len, &bytes);
+            if (retVal != ANI_OK)
+            {
+             break;
+            }
+            rsnDesc->keyData = (v_U8_t*)vos_mem_malloc(len);
+            if (rsnDesc->keyData == NULL) 
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Could not allocate RSN key bytes!\n");
+                VOS_ASSERT( 0 );
+                retVal = ANI_E_MALLOC_FAILED;
+                break;
+            }
+            vos_mem_copy(rsnDesc->keyData, bytes, len);
+        } 
+        else {
+            rsnDesc->keyData = NULL;
+        }
+
+        *rsnDescPtr = rsnDesc;
+
+    }while( 0 );
+
+    if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+    {
+        vos_mem_free(rsnDesc);
+    }
+
+    return retVal;
+}
+
+static int
+parseRsnKeyInfo(tAniPacket *packet, 
+                tAniRsnKeyInfo *info)
+{
+    v_U16_t tmp;
+    int retVal;
+
+    retVal = aniAsfPacketGet16(packet, &tmp);
+    if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+    {
+        return retVal;
+    }
+
+    info->keyDescVers = (tmp & ANI_SSM_RSN_KEY_DESC_VERS_MASK) 
+        >> ANI_SSM_RSN_KEY_DESC_VERS_OFFSET;
+    if (info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_RC4 &&
+        info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_AES)
+        return ANI_E_ILLEGAL_ARG;
+
+    info->unicastFlag = (tmp & ANI_SSM_RSN_UNICAST_MASK) ? 
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->keyId    = (tmp & ANI_SSM_RSN_KEY_INDEX_MASK)
+        >> ANI_SSM_RSN_KEY_INDEX_OFFSET;
+    info->installFlag = (tmp & ANI_SSM_RSN_INSTALL_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->ackFlag     = (tmp & ANI_SSM_RSN_ACK_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->micFlag     = (tmp & ANI_SSM_RSN_MIC_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->secureFlag  = (tmp & ANI_SSM_RSN_SECURE_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->errorFlag   = (tmp & ANI_SSM_RSN_ERROR_MASK) ?
+        eANI_BOOLEAN_TRUE: eANI_BOOLEAN_FALSE;
+    info->requestFlag = (tmp & ANI_SSM_RSN_REQUEST_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+    info->encKeyDataFlag = (tmp & ANI_SSM_RSN_ENC_KEY_DATA_MASK) ?
+        eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
+
+    return ANI_OK;
+}
+
+
+static int
+writeRsnKeyDesc(tAniPacket *packet, 
+                tAniEapolRsnKeyDesc *rsnDesc,
+                v_U8_t keyDescType)
+{
+    int retVal;
+
+    do
+    {
+        // This can be either ANI_EAPOL_KEY_DESC_TYPE_RSN
+        // or ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW
+        retVal = aniAsfPacketAppend8(packet, keyDescType);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = writeRsnKeyInfo(packet, &rsnDesc->info);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppend16(packet, rsnDesc->keyLen);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          rsnDesc->replayCounter,
+                                          sizeof(rsnDesc->replayCounter));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          rsnDesc->keyNonce, 
+                                          sizeof(rsnDesc->keyNonce));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          rsnDesc->keyIv, 
+                                          sizeof(rsnDesc->keyIv));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          rsnDesc->keyRecvSeqCounter, 
+                                          sizeof(rsnDesc->keyRecvSeqCounter));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          rsnDesc->keyId, 
+                                          sizeof(rsnDesc->keyId));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        // Zero out the key MIC
+        retVal = aniAsfPacketAppendBuffer(packet, 
+                                          ZERO_BYTES, 
+                                          sizeof(rsnDesc->keyMic));
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        retVal = aniAsfPacketAppend16(packet, rsnDesc->keyDataLen);
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+
+        if (rsnDesc->keyDataLen != 0) 
+        {
+            retVal = aniAsfPacketAppendBuffer(packet, 
+                                              rsnDesc->keyData, 
+                                              rsnDesc->keyDataLen);
+            if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+        }
+    }while( 0 );
+
+    return retVal;
+}
+
+static int
+writeRsnKeyInfo(tAniPacket *packet, tAniRsnKeyInfo *info)
+{
+    int retVal;
+    v_U16_t tmp;
+    v_U16_t infoValue;
+
+    infoValue = 0;
+
+    tmp = (v_U16_t)info->keyDescVers;
+    tmp = tmp << ANI_SSM_RSN_KEY_DESC_VERS_OFFSET;
+    infoValue |= (tmp & ANI_SSM_RSN_KEY_DESC_VERS_MASK);
+
+    if (info->unicastFlag)
+        infoValue |= ANI_SSM_RSN_UNICAST_MASK;
+
+    tmp = info->keyId;
+    tmp = tmp << ANI_SSM_RSN_KEY_INDEX_OFFSET;
+    infoValue |= (tmp & ANI_SSM_RSN_KEY_INDEX_MASK);
+
+    if (info->installFlag)
+        infoValue |= ANI_SSM_RSN_INSTALL_MASK;
+
+    if (info->ackFlag)
+        infoValue |= ANI_SSM_RSN_ACK_MASK;
+
+    if (info->micFlag)
+        infoValue |= ANI_SSM_RSN_MIC_MASK;
+
+    if (info->secureFlag)
+        infoValue |= ANI_SSM_RSN_SECURE_MASK;
+
+    if (info->errorFlag)
+        infoValue |= ANI_SSM_RSN_ERROR_MASK;
+
+    if (info->requestFlag)
+        infoValue |= ANI_SSM_RSN_REQUEST_MASK;
+    
+    if (info->encKeyDataFlag)
+        infoValue |= ANI_SSM_RSN_ENC_KEY_DATA_MASK;
+    
+    retVal = aniAsfPacketAppend16(packet, infoValue);
+
+    return retVal;
+}
+
+
+static int
+writeRsnKeyMic(v_U32_t cryptHandle,
+               tAniPacket *eapolFrame, 
+               tAniEapolRsnKeyDesc *rsnDesc,
+               v_U8_t *micKey, 
+               v_U32_t micKeyLen)
+{
+    int retVal = ANI_OK;
+    int len;
+
+    v_U8_t *ptr = NULL;
+    v_U8_t *micPos = NULL;
+    v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two
+
+    // Sanity check the arguments and return if no MIC generation is
+    // needed
+    if (micKey != NULL) 
+    {
+        if (micKeyLen == 0 || !rsnDesc->info.micFlag) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Supp MIC key provided but micKeyLen or micFlag is not set!\n");
+            VOS_ASSERT( 0 );
+            return ANI_E_ILLEGAL_ARG;
+        }
+    } 
+    else {
+        if (rsnDesc->info.micFlag) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Supp micFlag is set but MIC key not provided!\n");
+            VOS_ASSERT( 0 );
+            return ANI_E_ILLEGAL_ARG;
+        }
+        // Normal condition where MIC is not desired by the caller
+        return ANI_OK;
+    }
+
+    len = aniAsfPacketGetBytes(eapolFrame, &ptr);
+    if( !ANI_IS_STATUS_SUCCESS( len ) )
+    {
+        return len;
+    }
+
+    micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET + SNAP_HEADER_SIZE;
+
+    // Clear the MIC field in the packet before the MIC computation
+    vos_mem_zero( micPos, VOS_DIGEST_MD5_SIZE);
+
+    // Skip to the EAPOL version field for MIC computation
+    ptr += EAPOL_VERSION_POS + SNAP_HEADER_SIZE;
+    len -= (EAPOL_VERSION_POS + SNAP_HEADER_SIZE);
+
+    if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) 
+    {
+        if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) )
+        {
+            retVal = ANI_OK;
+        }
+        else
+        {
+            retVal = ANI_ERROR;
+        }
+    } 
+    else {
+        VOS_ASSERT( 0 );
+        retVal = ANI_E_ILLEGAL_ARG;
+    }
+
+    if (retVal == ANI_OK) 
+    {
+        // Copy only 16B which is the smaller of the two and the same as
+        // ANI_EAPOL_KEY_RSN_MIC_SIZE
+        vos_mem_copy(micPos, result, VOS_DIGEST_MD5_SIZE);
+    }
+
+    return retVal;
+}
+
+/**
+ * aniEapolKeyCheckMic
+ *
+ * @param eapolFrame the complete EAPOL-Key packet
+ * @param descType the key descriptor type
+ * @param keyDescData the key descriptor
+ * @param micKey the MIC key
+ * @param micKeyLen the number of bytes in the MIC key
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MIC_FAILED if the
+ * MIC check fails.
+ */
+int
+aniEapolKeyCheckMic(v_U32_t cryptHandle,
+                    tAniPacket *eapolFrame,
+                    int descType,
+                    void *keyDescData,
+                    v_U8_t *micKey,
+                    v_U32_t micKeyLen)
+{
+    if (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+    {
+        return checkRsnKeyMic(cryptHandle, eapolFrame, keyDescData, micKey, micKeyLen);
+    } 
+    else {
+        VOS_ASSERT( 0 );
+        return ANI_E_ILLEGAL_ARG;
+    }
+}
+
+
+static int
+checkRsnKeyMic(v_U32_t cryptHandle,
+               tAniPacket *eapolFrame,
+               tAniEapolRsnKeyDesc *rsnDesc,
+               v_U8_t *micKey,
+               v_U32_t micKeyLen) 
+{
+    int retVal = ANI_ERROR;
+    int len;
+
+    v_U8_t *ptr = NULL;
+    v_U8_t *micPos = NULL;
+
+    v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two
+    v_U8_t incomingMic[ANI_EAPOL_KEY_RSN_MIC_SIZE];
+
+    if (!rsnDesc->info.micFlag) 
+    {
+        VOS_ASSERT( 0 );
+        return ANI_E_ILLEGAL_ARG;
+    }
+
+    len = aniAsfPacketGetBytes(eapolFrame, &ptr);
+    if( ANI_IS_STATUS_SUCCESS( len ) )
+    {
+        micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET;
+
+        // Skip to the EAPOL version field for MIC computation
+        ptr += EAPOL_VERSION_POS;
+        len -= EAPOL_VERSION_POS;
+
+        // Copy existing MIC to temporary location and zero it out
+        vos_mem_copy( incomingMic, micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE );
+        vos_mem_zero( micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE );
+
+        if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) 
+        {
+            if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) )
+            {
+                retVal = ANI_OK;
+            }
+        } 
+        else {
+            VOS_ASSERT( 0 );
+            retVal = ANI_E_ILLEGAL_ARG;
+        }
+
+        if (retVal == ANI_OK) 
+        {
+            if ( !vos_mem_compare(incomingMic, result, ANI_EAPOL_KEY_RSN_MIC_SIZE))
+            {
+                retVal = ANI_E_MIC_FAILED;
+            }
+        }
+    }
+
+    return retVal;
+}
+
+/**
+ * aniEapolKeyFreeDesc
+ *
+ * Frees the EAPOL key descriptor and the key bytes contained within it.
+ *
+ * @param descType the key descriptor type
+ * @param keyDescData the key descriptor
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolKeyFreeDesc(int descType, void *keyDescData)
+{
+    tAniEapolRsnKeyDesc *rsnDesc;
+
+    if( keyDescData )
+    {
+        if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) 
+                || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) 
+        {
+
+            rsnDesc = (tAniEapolRsnKeyDesc *) keyDescData;
+            if (rsnDesc->keyData != NULL)
+                vos_mem_free(rsnDesc->keyData);
+
+        } 
+        else {
+
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "Supp asked to free illegal type: %d\n", descType);
+
+        }
+
+        vos_mem_free(keyDescData);
+    }
+
+    return ANI_OK;
+}
+
+v_U8_t *
+aniEapolType2Str(v_U8_t type)
+{
+    switch (type) 
+    {
+    case ANI_EAPOL_TYPE_PACKET:
+        return (v_U8_t *)ANI_EAPOL_TYPE_PACKET_STR;
+        break;
+    case ANI_EAPOL_TYPE_START:
+        return (v_U8_t *)ANI_EAPOL_TYPE_START_STR;
+        break;
+    case ANI_EAPOL_TYPE_LOGOFF:
+        return (v_U8_t *)ANI_EAPOL_TYPE_LOGOFF_STR;
+        break;
+    case ANI_EAPOL_TYPE_KEY:
+        return (v_U8_t *)ANI_EAPOL_TYPE_KEY_STR;
+        break;
+    case ANI_EAPOL_TYPE_ASF_ALERT:
+        return (v_U8_t *)ANI_EAPOL_TYPE_ASF_ALERT_STR;
+        break;
+    default:
+        return (v_U8_t *)ANI_EAPOL_TYPE_UNKNOWN_STR;
+        break;
+    }
+}
+
+
+void bapRsnEapolHandler( v_PVOID_t pvFsm, tAniPacket *packet, v_BOOL_t fIsAuth )
+{
+    int retVal;
+    v_U8_t *dstMac = NULL;
+    v_U8_t *srcMac = NULL;
+    v_U8_t *type = NULL;
+
+    retVal = aniEapolParse(packet, &dstMac, &srcMac, &type);
+    if ( retVal >= 0 )
+    {
+        retVal = ANI_OK;
+
+        // Sanity check that a PAE role has been assigned to it,
+        // and then dispatch to the appropriate handler
+
+        if( fIsAuth )
+        {
+            tAuthRsnFsm *fsm = (tAuthRsnFsm *)pvFsm;
+            authEapolHandler( fsm, packet, dstMac, srcMac, type );
+        }
+        else
+        {
+            tSuppRsnFsm *fsm = (tSuppRsnFsm *)pvFsm;
+            suppEapolHandler(fsm, packet, dstMac, srcMac, type);
+        } // switch statement
+    } // Successfully parsed EAPOL
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+            "eapolHandler Received bad EAPOL message of len %d (status=%d)\n",
+                      aniAsfPacketGetLen(packet), retVal );
+    } 
+    aniAsfPacketFree( packet );
+}
+
+
+int bapRsnFormPktFromVosPkt( tAniPacket **ppPacket, vos_pkt_t *pVosPacket )
+{
+    int retVal = ANI_ERROR;
+    VOS_STATUS status;
+    v_U16_t uPktLen;
+#define BAP_RSN_SNAP_TYPE_OFFSET 20
+#define BAP_RSN_ETHERNET_3_HEADER_LEN   22
+    v_U8_t *pFrame;
+    tAniPacket *pAniPacket = NULL;
+
+    do
+    {
+        status = vos_pkt_get_packet_length( pVosPacket, &uPktLen );
+        if( !VOS_IS_STATUS_SUCCESS(status) ) break;
+        if( (uPktLen < BAP_RSN_ETHERNET_3_HEADER_LEN) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " authRsnRxFrameHandler receive eapol packet size (%d) too small (%d)\n", 
+                uPktLen, BAP_RSN_ETHERNET_3_HEADER_LEN );
+            break;
+        }
+        status = vos_pkt_peek_data( pVosPacket, 0, (v_VOID_t *)&pFrame, uPktLen );
+        if( !VOS_IS_STATUS_SUCCESS(status) ) break;
+        retVal = aniAsfPacketAllocateExplicit(&pAniPacket, uPktLen, 0 );
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " authRsnRxFrameHandler failed to get buffer size (%d) \n", 
+                uPktLen );
+            break;
+        }
+        aniAsfPacketEmptyExplicit( pAniPacket, 0 );
+        pFrame[ETHER_PROTO_POS] = pFrame[BAP_RSN_SNAP_TYPE_OFFSET];
+        pFrame[ETHER_PROTO_POS + 1] = pFrame[BAP_RSN_SNAP_TYPE_OFFSET + 1];
+        //push ethernet II header in
+        retVal = aniAsfPacketAppendBuffer( pAniPacket, pFrame, ETHER_PROTO_POS + 2 );
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
+        //Get the rest of the data in
+        uPktLen -= BAP_RSN_ETHERNET_3_HEADER_LEN;
+        VOS_ASSERT( uPktLen > 0 );
+        retVal = aniAsfPacketAppendBuffer( pAniPacket, pFrame + BAP_RSN_ETHERNET_3_HEADER_LEN, 
+                            uPktLen );
+        if( !ANI_IS_STATUS_SUCCESS( retVal ) ) 
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                " authRsnRxFrameHandler cannot retrieve eapol payload size (%d)\n", 
+                uPktLen );
+            break;
+        }
+    }while( 0 );
+
+    if( ANI_IS_STATUS_SUCCESS( retVal ) )
+    {
+        *ppPacket = pAniPacket;
+    }
+    else if( pAniPacket )
+    {
+        aniAsfPacketFree( pAniPacket );
+    }
+
+    return retVal;
+}
+
+
diff --git a/CORE/BAP/src/bapRsnSsmEapol.h b/CORE/BAP/src/bapRsnSsmEapol.h
new file mode 100644
index 0000000..24fed8e
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmEapol.h
@@ -0,0 +1,328 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File:        $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmEapol.h#1 $ 
+ * Contains declarations of various utilities for EAPoL frame
+ * parsing and creation.
+ * range.
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef _ANI_SSM_EAPOL_H_
+#define _ANI_SSM_EAPOL_H_
+
+#include "vos_types.h"
+#include "vos_trace.h"
+#include "vos_packet.h"
+#include <bapRsnAsfPacket.h>
+
+#define ANI_ETH_P_EAPOL 0x0003
+#define ANI_ETH_P_IP 0x0800
+
+/**
+ * The EAPOL type field is one of the following:
+ */
+#define ANI_EAPOL_TYPE_PACKET 0
+#define ANI_EAPOL_TYPE_START 1
+#define ANI_EAPOL_TYPE_LOGOFF 2
+#define ANI_EAPOL_TYPE_KEY 3
+#define ANI_EAPOL_TYPE_ASF_ALERT 4
+
+#define EAPOL_VERSION_1 0x01
+
+#define EAPOL_RX_HEADER_SIZE    18
+#define EAPOL_TX_HEADER_SIZE    26  //include LLC_SNAP
+#define SNAP_HEADER_SIZE   8
+
+#define ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4   1
+// JEZ20041012 This needs to be fixed.  This needs to support BOTH 
+// the older WPA Key Descriptor type of 254 AS WELL AS the newer
+// Key Descriptor type of 2
+#define ANI_EAPOL_KEY_DESC_TYPE_RSN        254
+//#define ANI_EAPOL_KEY_DESC_TYPE_RSN          2
+#define ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW      2
+
+#define ANI_EAPOL_KEY_RSN_REPLAY_CTR_SIZE  8
+#define ANI_EAPOL_KEY_RSN_NONCE_SIZE      32
+#define ANI_EAPOL_KEY_RSN_IV_SIZE         16
+#define ANI_EAPOL_KEY_RSN_RSC_SIZE         8
+#define ANI_EAPOL_KEY_RSN_ID_SIZE          8
+#define ANI_EAPOL_KEY_RSN_MIC_SIZE        16
+#define ANI_EAPOL_KEY_RSN_ENC_KEY_SIZE 16
+
+#define ANI_EAPOL_KEY_DESC_VERS_RC4    1
+#define ANI_EAPOL_KEY_DESC_VERS_AES    2
+
+#define ANI_EAPOL_KEY_RC4_REPLAY_CTR_SIZE 8
+#define ANI_EAPOL_KEY_RC4_IV_SIZE        16
+#define ANI_EAPOL_KET_RC4_SIGN_SIZE      16
+
+#define ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID       0xDD
+#define ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID 1
+#define ANI_SSM_GROUP_KEY_KDE_TX_BIT            0x04
+
+typedef struct sAniEapolLegacyRc4KeyDesc {
+    v_U16_t keyLen;
+    v_U8_t  replayCounter[ANI_EAPOL_KEY_RC4_REPLAY_CTR_SIZE];
+    v_U8_t  keyIv[ANI_EAPOL_KEY_RC4_IV_SIZE];
+    tANI_BOOLEAN unicastFlag; // The high order 1 bit of key-index
+    v_U8_t  keyId; // The lower order 7 bits of key-index (but 0..3 based)
+    v_U8_t  signature[ANI_EAPOL_KET_RC4_SIGN_SIZE];
+    v_U8_t  *key;
+} tAniEapolLegacyRc4KeyDesc;
+
+typedef struct sAniRsnKeyInfo {
+    v_U32_t keyDescVers;
+    tANI_BOOLEAN unicastFlag; // Pair-wise key
+    v_U16_t keyId;
+    tANI_BOOLEAN installFlag;
+    tANI_BOOLEAN ackFlag;
+    tANI_BOOLEAN micFlag;
+    tANI_BOOLEAN secureFlag;
+    tANI_BOOLEAN errorFlag;
+    tANI_BOOLEAN requestFlag;
+    tANI_BOOLEAN encKeyDataFlag; // RSN only (Is 0 in WPA)
+} tAniRsnKeyInfo;
+
+typedef struct sAniEapolRsnKeyDesc {
+    tAniRsnKeyInfo info;
+    v_U16_t keyLen;
+    v_U8_t  replayCounter[ANI_EAPOL_KEY_RSN_REPLAY_CTR_SIZE];
+    v_U8_t  keyNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE];
+    v_U8_t  keyIv[ANI_EAPOL_KEY_RSN_IV_SIZE];
+    v_U8_t  keyRecvSeqCounter[ANI_EAPOL_KEY_RSN_RSC_SIZE];
+    v_U8_t  keyId[ANI_EAPOL_KEY_RSN_ID_SIZE];
+    v_U8_t  keyMic[ANI_EAPOL_KEY_RSN_MIC_SIZE];
+    v_U16_t keyDataLen;
+    v_U8_t  *keyData;
+} tAniEapolRsnKeyDesc;
+
+/**
+ * aniEapolWriteStart
+ *
+ * FUNCTION:
+ * Writes an EAPOL-Start frame to the packet. It is only used by the
+ * supplicant.
+ *
+ * LOGIC:
+ * Prepend the appropriate EAPOL header to the packet. There is no
+ * EAPOL payload for this kind of frame.
+ *
+ * ASSUMPTIONS:
+ * The packet has enough space available for prepending the header.
+ *
+ * @param packet the packet to which the frame should be written
+ * @param dstMac the MAC address of the destination (authenticator)
+ * @param srcMac the MAC address of the source (supplicant)
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolWriteStart(tAniPacket *packet,
+                   tAniMacAddr dstMac,
+                   tAniMacAddr srcMac);
+
+/**
+ * aniEapolWriteEapPacket
+ *
+ * FUNCTION:
+ * Writes the EAPOL/EAP-Packet frame headers. It is used
+ * by both the authenticator and the supplicant. This creates an EAPOL
+ * frame that is carrying an EAP message as its payload.
+ *
+ * LOGIC:
+ * Prepend the appropriate EAPOL header to the packet.
+ *
+ * ASSUMPTIONS:
+ * The EAP message (ie., the payload) is already available in the
+ * packet and that the packet has enough space available for
+ * prepending the EAPOL header.
+ *
+ * @param packet the packet containing the EAP message
+ * @param dstMac the MAC address of the destination (authenticator)
+ * @param srcMac the MAC address of the source (supplicant)
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolWriteEapPacket(tAniPacket *eapPacket, 
+                       tAniMacAddr dstMac, 
+                       tAniMacAddr srcMac);
+
+/**
+ * aniEapolParse
+ *
+ * FUNCTION:
+ * Parses an EAPoL frame to the first level of headers (no EAP
+ * headers are parsed). 
+ *
+ * NOTE: This is a non-destructive read, that is the
+ * headers are not stripped off the packet. However, any additional
+ * data at  the end of the packet, beyond what the EAPoL headers encode
+ * will be stripped off.
+ *
+ * @param packet the packet containing the EAPoL frame to parse
+ * @param dstMac a pointer to set to the location of the destination
+ * MAC address
+ * @param srcMac a pointer to set to the location of the source
+ * MAC address
+ * @param type a pointer to set to the location of the EAPOL type
+ * field.
+ *
+ * @return the non-negative length of the EAPOL payload if the operation
+ * succeeds
+ */
+int 
+aniEapolParse(tAniPacket *packet,
+              v_U8_t **dstMac, 
+              v_U8_t **srcMac, 
+              v_U8_t **type);
+
+/**
+ * aniEapolWriteKey
+ *
+ * Writes out a complete EAPOL-Key frame. The key descriptor is
+ * appended to the packet and the EAPOL header is prepended to it. If
+ * a micKey is passed in, then a MIC is calculated and inserted into
+ * the frame.
+ *
+ * @param packet the packet to write to
+ * @param dstMac the destination MAC address
+ * @param srcMac the source MAC address
+ * @param descType the key descriptor type
+ * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
+ * ANI_EAPOL_KEY_DESC_TYPE_RSN).
+ * @param keyDescData the key descriptor data corresponding to the
+ * above descType. The signature field is ignored and will be
+ * generated in the packet. The key bytes are expected to be enctypted
+ * is they need to be encrypted.
+ * @param micKey the MIC key
+ * @param micKeyLen the number of bytes in the MIC key
+ *
+ * @return ANI_OK if the operation succeeds
+ *
+ */
+int
+aniEapolWriteKey(v_U32_t cryptHandle,
+                 tAniPacket *packet,
+                 tAniMacAddr dstMac, 
+                 tAniMacAddr srcMac, 
+                 int descType,
+                 void *keyDescData,
+                 v_U8_t *micKey,
+                 v_U32_t micKeyLen);
+
+/**
+ * aniEapolParseKey
+ *
+ * Parses and verifies a complete EAPOL-Key frame. The key descriptor
+ * type is returned and so is a newly allocated key descriptor structure
+ * that is appropriate for the type.
+ *
+ * NOTE: This is a non-destructive read. That is, the packet headers
+ * will be unchanged at the end of this read operation. This is so
+ * that a followup MIC check may be done on the complete packet. If
+ * the packet parsing fails, the packet headers are not guaranteed to
+ * be unchanged.
+ *
+ * @param packet the packet to read from. Note that the frame is not
+ * expected to contain any additional padding at the end other than
+ * the exact number of key bytes. (The aniEapolParse function will
+ * ensure this.)
+ * @param descType is set to the key descriptor type
+ * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
+ * ANI_EAPOL_KEY_DESC_TYPE_RSN).
+ * @param keyDescData is set to a newly allocated key descriptor
+ * corresponding to the above descType. The signature field is
+ * verified. The key bytes will be returned encrypted. It is the
+ * responsibility of the caller to free this structure and the data
+ * contained therein.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolParseKey(tAniPacket *packet,
+                 int *descType,
+                 void **keyDescData);
+
+/**
+ * aniEapolKeyCheckMic
+ *
+ * @param eapolFrame the complete EAPOL-Key packet
+ * @param descType the key descriptor type
+ * @param keyDescData the key descriptor
+ * @param micKey the MIC key
+ * @param micKeyLen the number of bytes in the MIC key
+ *
+ * @return ANI_OK if the operation succeeds; ANI_E_MIC_FAILED if the
+ * MIC check fails.
+ */
+int
+aniEapolKeyCheckMic(v_U32_t cryptHandle,
+                    tAniPacket *eapolFrame,
+                    int descType,
+                    void *keyDescData,
+                    v_U8_t *micKey,
+                    v_U32_t micKeyLen);
+
+/**
+ * aniEapolKeyFreeDesc
+ *
+ * Frees the EAPOL key descriptor and the key bytes contained within it.
+ *
+ * @param descType the key descriptor type
+ * @param keyDescData the key descriptor
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolKeyFreeDesc(int descType, void *keyDescData);
+
+v_U8_t *
+aniEapolType2Str(v_U8_t type);
+
+v_U8_t *
+aniEapolHdr2Str(v_U8_t *hdr);
+
+/**
+ * aniEapolKeyLogDesc
+ *
+ * Logs information about the given EAPOL key desctiptor.
+ *
+ * @param descType the key descriptor type
+ * @param keyDescData the key descriptor
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniEapolKeyLogDesc(int descType, void *keyDescData);
+
+void bapRsnEapolHandler( v_PVOID_t pvFsm, tAniPacket *packet, v_BOOL_t fIsAuth );
+//Transfer from pVosPacket to tAniPacket.
+int bapRsnFormPktFromVosPkt( tAniPacket **ppPacket, vos_pkt_t *pVosPacket );
+
+#endif //_ANI_SSM_EAPOL_H_
diff --git a/CORE/BAP/src/bapRsnSsmReplayCtr.c b/CORE/BAP/src/bapRsnSsmReplayCtr.c
new file mode 100644
index 0000000..db919a6
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmReplayCtr.c
@@ -0,0 +1,244 @@
+/*
+ * 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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * File: $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmReplayCtr.c#2 $ 
+ *
+ * Contains definitions of various utilities for EAPoL frame
+ * parsing and creation.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        19-June-2002
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#include "vos_types.h"
+#include "vos_trace.h"
+#include <bapRsnErrors.h>
+
+#include <bapRsnSsmReplayCtr.h>
+#include "vos_status.h"
+#include "vos_memory.h"
+#include "vos_utils.h"
+#include "vos_packet.h"
+
+//#include "aniSsmUtils.h"
+
+/*
+ * Opaque replay counter type. Does TX and RX side replay counter
+ * tracking. On the TX side, it returns monotonically increasing values
+ * of the counter and checks that the peer returned a value matching
+ * the one we sent. On the RX side, it makes sure that the peer sent a
+ * replay counter greater than the last one seen (excepting for the
+ * first time a check is made which the application has to special case.)
+ */
+struct sAniSsmReplayCtr {
+    v_U8_t size;
+    v_U8_t *buf;
+    v_U32_t currentValue;
+    v_U8_t init;
+};
+
+static int
+updateCtrBuf(tAniSsmReplayCtr *ctr);
+
+/**
+ * aniSsmReplayCtrCreate
+ *
+ * Creates a replay counter and initializes it for first time
+ * use. The initialization can be done randomly or with a passed in
+ * value like 0. In case this is going to be used on the RX side, it
+ * doesn't matter what the initialization is and can be optimized to
+ * a fixed value so as to avoid the overhead of obtaining a random
+ * value.
+ *
+ * @param ctrPtr a pointer that will be set to the newly allocated
+ * counter if the operation succeeds
+ * @param size the number of bytes that are desired in the counter
+ * @param initValue if this is negative and size is greater than 4,
+ * the initialization is done randomly. Otherwise, these bytes are
+ * copied into the least significant four or less octets of the
+ * counter, depending on the size of the counter. i.e., if the counter
+ * is only 2B, then the least significant 2B of initValue will be
+ * copied over.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrCreate(v_U32_t cryptHandle, tAniSsmReplayCtr **ctrPtr, 
+                      v_U8_t size,
+                      int initValue)
+{
+    tAniSsmReplayCtr *ctr;
+
+    ctr = vos_mem_malloc( sizeof(tAniSsmReplayCtr) );
+    if( NULL == ctr )
+    {
+        return ANI_E_MALLOC_FAILED;
+    }
+
+    ctr->buf = vos_mem_malloc( size );
+    if (ctr->buf == NULL) 
+    {
+        VOS_ASSERT( 0 );
+        vos_mem_free(ctr);
+        return ANI_E_MALLOC_FAILED;
+    }
+
+    ctr->size = size;
+
+    // We cannot randomly generate the most significant bytes if the
+    // total number of bytes is not greater than 4 (sizeof ANI_U32).
+    if (initValue < 0 && ctr->size <= 4)
+        initValue = 0;
+
+    // If initValue is negative, initialize the ctr randomly, else
+    // initialize it to what the user specified.
+    if (initValue < 0) 
+    {
+        if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes(cryptHandle, ctr->buf, ctr->size) ) )
+        {
+            return ANI_ERROR;
+        }
+    } 
+    else {
+        ctr->currentValue = initValue - 1;
+    }
+
+    *ctrPtr = ctr;
+
+    return ANI_OK;
+}
+
+static int
+updateCtrBuf(tAniSsmReplayCtr *ctr)
+{
+
+    v_U32_t numBytes;
+    v_U32_t offset;
+    v_U32_t tmp;
+
+    tmp = vos_cpu_to_be32( ctr->currentValue );
+
+    numBytes = (4 <= ctr->size) ? 4 : ctr->size;
+    offset = 4 - numBytes;
+    vos_mem_copy(ctr->buf + ctr->size - numBytes, 
+           ((v_U8_t *) &tmp) + offset, numBytes);
+
+    return ANI_OK;
+}
+
+/**
+ * aniSsmReplayCtrCmp
+ *
+ * Used to check if the passed in value is greater
+ * than, less than, or the same as the previous value. 
+ *
+ * Can be used on the TX side to determine if the response to a
+ * request contains the same counter as the one in the request.
+ *
+ * Can be used on the RX side to determine if the request has a
+ * counter greater than the previous request, or if this is a
+ * retransmission of the previous request. The application should
+ * special-case the first time this is called on the RX side.
+ *
+ * @param ctr the current replay counter
+ * @param value the value to check against
+ *
+ * @return a negative value if current ctr is less than the
+ * given value, zero if they are the same, and a positive value if the
+ * current counter is greater than that of the given value.
+ */
+int
+aniSsmReplayCtrCmp(tAniSsmReplayCtr *ctr, v_U8_t *value)
+{
+    return vos_mem_compare2(ctr->buf, value, ctr->size);
+}
+
+/**
+ * aniSsmReplayCtrUpdate
+ *
+ * Used on the RX side to update the value of the current replay
+ * counter to that received in the next request. Typically this is
+ * called after it is determined that this is not a retransmission,
+ * and some sort of integrity checking is done on it.
+ *
+ * @param ctr the current replay counter
+ * @param value the value that it should be set to
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrUpdate(tAniSsmReplayCtr *ctr,
+                      v_U8_t *value)
+{
+    vos_mem_copy(ctr->buf, value, ctr->size);
+
+    return ANI_OK;
+}
+
+/**
+ * aniSsmReplayCtrNext
+ *
+ * Used on the RX side to obtain the next value that should be sent
+ * with a request. After this call, the current value is incremented
+ * by one.
+ *
+ * @param ctr the current replay counter
+ * @param value where the next counter value should be copied
+ * into. The caller must allocated enough storage for this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrNext(tAniSsmReplayCtr *ctr,
+                    v_U8_t *value)
+{
+    ctr->currentValue++;
+    updateCtrBuf(ctr);
+    vos_mem_copy(value, ctr->buf, ctr->size);
+
+    return ANI_OK;
+}
+
+/**
+ * aniSsmReplayCtrFree
+ *
+ * Frees the replay counter context.
+ *
+ * @param ctr the replay counter to free.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrFree(tAniSsmReplayCtr *ctr)
+{
+
+    if (ctr->buf != NULL)
+        vos_mem_free(ctr->buf);
+
+    vos_mem_free(ctr);
+
+    return ANI_OK;
+}
diff --git a/CORE/BAP/src/bapRsnSsmReplayCtr.h b/CORE/BAP/src/bapRsnSsmReplayCtr.h
new file mode 100644
index 0000000..33c9f06
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmReplayCtr.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.
+ */
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmReplayCtr.h $
+ *
+ * Contains declarations of various utilities for SSM replay counter
+ * module.
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        15-June-2003
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+#ifndef _ANI_SSM_REPLAY_CTR_H_
+#define _ANI_SSM_REPLAY_CTR_H_
+
+#include "vos_types.h"
+#include <bapRsnAsfPacket.h>
+
+/*
+ * Opaque replay counter type. Does TX and RX side replay counter
+ * tracking. On the TX side, it returns monotonicall increasing values
+ * of the counter and checks that the peer returned a value matching
+ * the one we sent. On the RX side, it makes sure that the peer sent a
+ * replay counter greater than the last one seen (excepting for the
+ * first time a check is made which the application has to special case.)
+ */
+typedef struct sAniSsmReplayCtr tAniSsmReplayCtr;
+
+/**
+ * aniSsmReplayCtrCreate
+ *
+ * Creates a replay counter and initializes it for first time
+ * use. The initialization can be done randomly or with a passed in
+ * value like 0. In case this is going to be used on the RX side, it
+ * doesn't matter what the initiaalization is and can be optimized to
+ * a fixed value so as to avoid the overhead of obtaining a random
+ * value.
+ *
+ * @param ctrPtr a pointer that will be set to the newly allocated
+ * counter if the operation succeeds
+ * @param size the number of bytes that are desired in the counter
+ * @param initValue if this is negative and size is greater than 4,
+ * the initialization is done randomly. Otherwise, these bytes are
+ * copied into the least significant four or less octets of the
+ * counter, depending on the size of the counter. i.e., if the counter
+ * is only 2B, then the least significant 2B of initValue will be
+ * copied over.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrCreate(v_U32_t cryptHandle, tAniSsmReplayCtr **ctrPtr, 
+                      v_U8_t size,
+                      int initValue);
+
+/**
+ * aniSsmReplayCtrCmp
+ *
+ * Used to check if the passed in value is greater
+ * than, less than, or the same as the previous value. 
+ *
+ * Can be used on the TX side to determine if the response to a
+ * request contains the same counter as the one in the request.
+ *
+ * Can be used on the RX side to determine if the request has a
+ * counter greater than the previous request, or if this is a
+ * retransmission of the previous request. The application should
+ * special-case the first time this is called on the RX side.
+ *
+ * @param ctr the current replay counter
+ * @param value the value to check against
+ *
+ * @return A negative error code if value is less than the
+ * current value of the counter, zero if they are the same, and a
+ * positive value if the current value is greater than that of the
+ * counter.
+ */
+int
+aniSsmReplayCtrCmp(tAniSsmReplayCtr *ctr,
+                   v_U8_t *value);
+
+/**
+ * aniSsmReplayCtrUpdate
+ *
+ * Used on the RX side to update the value of the current replay
+ * counter to that received in the next request. Typically this is
+ * called after it is determined that this is not a retransmission,
+ * and some sort of integrity checking is done on it.
+ *
+ * @param ctr the current replay counter
+ * @param value the value that it should be set to
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrUpdate(tAniSsmReplayCtr *ctr,
+                      v_U8_t *value);
+
+/**
+ * aniSsmReplayCtrNext
+ *
+ * Used on the RX side to obtain the next value that should be sent
+ * with a request. After this call, the current value is incremented
+ * by one.
+ *
+ * @param ctr the current replay counter
+ * @param value where the next counter value should be copied
+ * into. The caller must allocated enough storage for this.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrNext(tAniSsmReplayCtr *ctr,
+                    v_U8_t *value);
+
+/**
+ * aniSsmReplayCtrFree
+ *
+ * Frees the replay counter context.
+ *
+ * @param ctr the replay counter to free.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmReplayCtrFree(tAniSsmReplayCtr *ctr);
+
+#endif //_ANI_SSM_REPLAY_CTR_H_
diff --git a/CORE/BAP/src/bapRsnSsmServices.h b/CORE/BAP/src/bapRsnSsmServices.h
new file mode 100644
index 0000000..023cf57
--- /dev/null
+++ b/CORE/BAP/src/bapRsnSsmServices.h
@@ -0,0 +1,307 @@
+/*
+ * 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.
+ * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmServices.h $
+ *
+ * Contains definitions of common types that the SSM exports to other
+ * modules. 
+ *
+ * Author:      Mayank D. Upadhyay
+ * Date:        23-January-2003
+ * History:-
+ * Date         Modified by     Modification Information
+ * ------------------------------------------------------
+ *
+ */
+
+#ifndef _ANI_SSM_SERVICES_H_
+#define _ANI_SSM_SERVICES_H_
+
+#include "vos_types.h"
+#include "sirApi.h"
+
+#define ANI_SSM_MAX_KEYS_INFO_SIZE 512
+#define ANI_SSM_MAX_GROUP_SIZE     32
+#define ANI_SSM_MAX_USERID_SIZE    64
+
+#define ANI_SSM_RSN_PMK_LEN 32
+#define ANI_SSM_RSN_PSK_LEN ANI_SSM_RSN_PMK_LEN
+#define ANI_SSM_RSN_PSK_LEN_HEX ANI_SSM_RSN_PSK_LEN+ANI_SSM_RSN_PSK_LEN
+#define ANI_SSM_MAX_PASSPHRASE_LEN 128
+#define ANI_SSM_MAX_AUTHZONE_LEN  32
+#define ANI_SSM_MAX_LANDPG_URL_LEN 128
+#define ANI_SSM_MAX_GUEST_PORTAL_PWD_LEN 32
+
+#define ANI_SSM_IE_RSN_OUI {0x00, 0x0F, 0xAC}
+#define ANI_SSM_IE_WPA_OUI {0x00, 0x50, 0xF2}
+
+#define ANI_SSM_IE_RSN_ELEM_ID  48
+#define ANI_SSM_IE_WPA_ELEM_ID  221
+
+/*
+ * The total length of an RSN IE may be no longer than these many
+ * octets, including the two bytes for type and len.
+ */
+#define ANI_RSN_IE_MAX_LEN 257
+
+#ifndef ANI_AP_SDK
+#define ANI_AAG_CONF_FILE_NAME     ANI_STATIC_CONFIG_DIR"/ssm/1x.conf"
+#define ANI_AAG_AA_CFG_FILE_ORIG  ANI_STATIC_CONFIG_DIR"/ssm/1x.conf.orig"
+#else
+#define ANI_AAG_CONF_FILE_NAME      "/var/1x.conf"
+#define ANI_AAG_AA_CFG_FILE_ORIG    "/var/1x.conf.orig"
+#define ANI_WSM_DEFAULTS_FILE_NAME  "/var/wsmDefaults"
+#define ANI_WSM_DEFAULTS_FILE_ORIG  "/var/wsmDefaults.orig"
+#endif // !ANI_AP_SDK
+
+#define ANI_AAG_CONF_MAX_LINE 120
+
+/*
+ * PMKSA ID data type
+ * (PMKID is an HMAC-SHA1-128 value) 
+ */
+#define ANI_AAG_PMKID_SIZE 16
+
+#define ANI_SSM_AUTH_BITMASK   0x00010000
+#define ANI_SSM_IEMODE_BITMASK 0xC0000000
+#define ANI_SSM_ENCR_BITMASK   0x00000001
+#define ANI_SSM_IEMODE_SHIFT   (30)
+
+
+// Upper level authentication types used by AA
+typedef enum eAniSsmAuthType {
+    eANI_SSM_AT_UNDERFLOW = -1,
+
+    // The numbers are fixed so that they can be re-used in the XCLI
+    // config file and 1x.conf.
+    eANI_SSM_AT_NONE       = 0,
+    eANI_SSM_AT_SHARED_KEY = 1,
+    eANI_SSM_AT_LEGACY_EAP = 2,
+    eANI_SSM_AT_RSN_PSK    = 3,
+    eANI_SSM_AT_RSN_EAP    = 4,
+
+    eANI_SSM_AT_OVERFLOW
+} tAniSsmAuthType;
+
+// Upper level encryption types used by AA
+typedef enum eAniSsmCipherType {
+    eANI_SSM_CT_UNDERFLOW = -1,
+
+    // The numbers are fixed so that they can be re-used in the XCLI
+    // config file and 1x.conf.
+    eANI_SSM_CT_NONE       = 0,
+    eANI_SSM_CT_WEP40      = 1,
+    eANI_SSM_CT_WEP104     = 2,
+    eANI_SSM_CT_WPA_WEP40  = 3,
+    eANI_SSM_CT_WPA_WEP104 = 4,
+    eANI_SSM_CT_TKIP       = 5,
+    eANI_SSM_CT_CCMP       = 6,
+
+    eANI_SSM_CT_OVERFLOW
+} tAniSsmCipherType;
+
+
+// WPA modes
+typedef enum eAniSsmWpaModes {
+    eANI_SSM_WPA_UNDERFLOW = -1,
+
+    eANI_SSM_WPA_DISABLE = 0,
+    eANI_SSM_WPA_1 = 1,
+    eANI_SSM_WPA_2 = 2,
+
+    eANI_SSM_WPA_OVERFLOW = ((eANI_SSM_WPA_2 | eANI_SSM_WPA_1)  + 1)
+} tAniSsmWpaModes;
+
+typedef struct sAniSsmGroup {
+    v_U16_t len; // Valid range: 0..ANI_SSM_MAX_GROUP_SIZE
+    v_U8_t  group[1];
+} tAniSsmGroup;
+
+typedef struct sAniSsmUserId {
+    v_U16_t len; // Valid range: 0..ANI_SSM_MAX_USERID_SIZE
+    v_U8_t  userId[1];
+} tAniSsmUserId;
+
+/*
+ * PMKSA ID data type
+ * (PMKID is an HMAC-SHA1-128 value) 
+ */
+typedef v_U8_t tAniSsmPmkId[ANI_AAG_PMKID_SIZE];
+
+/**
+ * aniSsmInitStaticConf
+ *
+ * (Re-)Initializes the SSM internal static configuration. This may be
+ * from a static configuration file and will include items such as
+ * local MAC-ACL lists.
+ *
+ * @param configFileName - an optional filename to read from. If this is
+ * NULL, the default AAG static conf file is read.
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+int
+aniSsmInitStaticConf(char *configFileName);
+
+/**
+ * aniSsmIsStaMacAllowed
+ *
+ * Determines if a given STA passes the local MAC-ACL check. If
+ * MAC-ACL lookup is enabled, it may be either positive (whitelist) or
+ * negative (blacklist). If positive MAC-ACLs are on, then only those
+ * STAs that are in the whitelist are allowed in. If negative MAC-ACLs
+ * are on, then those STAs that are in the blacklist are not allowed in.
+ *
+ * Note that local MAC-ACLs may be maintained per SSID.
+ *
+ * @param staMac - the MAC address of the STA
+ * @param ssid - the SSID that the STA is associating on
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+v_BOOL_t
+aniSsmIsStaMacAllowed(const tAniMacAddr staMac, const tAniSSID *ssid);
+
+/**
+ * aniSsmIsSecModeAllowed
+ *
+ * Determines if the security suites requested by an RSN station or
+ * non-RSN station are allowed under the security mode in force at the
+ * moment.
+ *
+ * An RSN IE needs to be passed in if RSN is being used. Otherwise the
+ * ieLen field should be set to 0 or ieData set to NULL to indicate
+ * that no IE is present. If the RSN IE is present it is used to check
+ * both the authentication type and the cipher type for the group and
+ * pairwise keys. Special rules might apply in the case of a
+ * BP. Therefore, a separate flag indicates if the STA is a BP.
+ *
+ * If the station is not using RSN, the authentication type is
+ * tightly bound to the cipher type. For instance, when using
+ * shared-key MAC authentication, the cipher type will be assumed to
+ * be WEP. (Both WEP-40 and WEP-104 fall under the same security
+ * level.) When using open-system MAC authentication, the cipher type
+ * will be assumed to be WEP if the security level requires WEP,
+ * otherwise the cipher will be determined later. (When performing
+ * open-auth in the lowest security level, the STA is required to
+ * initiate EAPOL in order to establish WEP keys, or WEP cannot be not
+ * used.)
+ * 
+ * @param secMode the security mode that is in force
+ * @param macAuthType the MAC-level authentication type to check
+ * @param ieLen is set 0 if no RSN IE is present, or to the number of
+ * octets in the RSN IE.
+ * @param ieData the optional IE data bytes, or NULL if no IE is
+ * present.
+ * @param bpIndicator eANI_BOOLEAN_TRUE if the STA is a BP,
+ * eANI_BOOLEAN_FALSE otherwise.
+ *
+ * @return eANI_BOOLEAN_TRUE if the authentication type is allowed,
+ * eANI_BOOLEAN_FALSE if not.
+ *
+ * @see aniSsmIsRsnSuiteAllowed
+ */
+v_BOOL_t
+aniSsmIsSecModeAllowed(v_U32_t secMode,
+                       tAniAuthType macAuthType, 
+                       v_U8_t ieLen,
+                       v_U8_t *ieData,
+                       v_BOOL_t bpIndicator,
+                       v_BOOL_t wpsEnabled);
+
+/**
+ * aniSsmGenRsnSuiteList
+ *
+ * Generates a RSN information element containing a list of RSN suites
+ * that conform to the specified security level. This is generally
+ * used on the AP to generate the RSN information element it
+ * advertizes.
+ *
+ * @param secMode the security mode in force
+ * @param ieData the buffer in which to store the generated IE
+ *
+ * @return the non-negative number of bytes written into the buffer if
+ * the operation succeeds, or a negative error code.
+ */
+int
+aniSsmGenRsnSuiteList(v_U32_t secMode,
+                      v_U8_t ieData[ANI_RSN_IE_MAX_LEN]);
+
+/**
+ * aniSsmGenRsnSuiteForBp
+ *
+ * Generates a RSN information element containing exactly one RSN
+ * suite selector for authentication and exactly one for the
+ * cipher. This is generally used on the BP side while associating
+ * with an upstream AP.
+ *
+ * If RSN is turned off on the BP, then the IE is of length 0.
+ *
+ * NOTE: As per 802.11/D3.0, the BP has to send back the exact group
+ * key cipher that the AP indicated in its IE.
+ *
+ * @param apIeData contains the IE sent by the AP and is used to read
+ * the group key cipher that the AP wants us to use.
+ * @param apIeLen the length of the AP's IE
+ * @param bpRsnFlag should be 0 for no RSN, 1 for AES, 2 for TKIP
+ * @param bpPskFlag should be eANI_BOOLEAN_TRUE if RSN with PSK is
+ * desired. This is only relevant if bpRsnFlag is not zero.
+ * @param ieData the buffer in which to store the generated IE
+ *
+ * @return the non-negative number of bytes written into the buffer if
+ * the operation succeeds, or a negative error code.
+ */
+int
+aniSsmGenRsnSuiteForBp(const v_U8_t *apIeData,
+                       v_U8_t apIeLen,
+                       v_U32_t bpRsnFlag,
+                       v_BOOL_t bpPskFlag,
+                       v_U8_t ieData[ANI_RSN_IE_MAX_LEN]);
+
+/**
+ * aniSsmSecMode2Str
+ *
+ * Returns a descriptive string that can be used for logging the
+ * security mode.
+ *
+ * @param secMode the secMode to be printed
+ *
+ * @return a printable ASCII string representing the secMode
+ */
+v_U8_t *
+aniSsmSecMode2Str(v_U32_t secMode);
+
+/**
+ * aniSsmIe2Str
+ *
+ * Parses and returns a printable form of the IE (WPA/RSN).
+ *
+ * @param ieData the IE bytes
+ * @param ieLen the length of the IE
+ *
+ * @return ANI_OK if the operation succeeds
+ */
+v_U8_t *
+aniSsmIe2Str(const v_U8_t *ieData, v_U8_t ieLen);
+
+#endif /* _ANI_SSM_SERVICES_H_ */
diff --git a/CORE/BAP/src/bapRsnTxRx.c b/CORE/BAP/src/bapRsnTxRx.c
new file mode 100644
index 0000000..f13a65f
--- /dev/null
+++ b/CORE/BAP/src/bapRsnTxRx.c
@@ -0,0 +1,272 @@
+/*
+ * 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.
+ */
+
+/**=============================================================================
+  
+  vos_list.c
+  
+  \brief
+  
+  Description...
+    
+  
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ============================================================================== */
+/* $HEADER$ */
+#include "bapRsnTxRx.h"
+#include "bapRsn8021xFsm.h"
+#include "bapInternal.h"
+#include "vos_trace.h"
+#include "wlan_qct_tl.h"
+#include "vos_memory.h"
+
+
+static pnfTxCompleteHandler bapRsnFsmTxCmpHandler = NULL;
+static pnfRxFrameHandler bapRsnFsmRxFrameHandler = NULL;
+
+extern int gReadToSetKey;
+
+
+VOS_STATUS bapRsnRegisterTxRxCallbacks( pnfTxCompleteHandler pfnTxCom, pnfRxFrameHandler pnfRxFrame )
+{
+    if( bapRsnFsmTxCmpHandler || bapRsnFsmRxFrameHandler )
+    {
+        return VOS_STATUS_E_ALREADY;
+    }
+
+    bapRsnFsmTxCmpHandler = pfnTxCom;
+    bapRsnFsmRxFrameHandler = pnfRxFrame;
+
+    return ( VOS_STATUS_SUCCESS );
+}
+
+void bapRsnClearTxRxCallbacks(void)
+{
+    bapRsnFsmTxCmpHandler = NULL;
+    bapRsnFsmRxFrameHandler = NULL;
+}
+
+
+//To reserve a vos_packet for Tx eapol frame
+//If success, pPacket is the packet and pData points to the head.
+static VOS_STATUS bapRsnAcquirePacket( vos_pkt_t **ppPacket, v_U8_t **ppData, v_U16_t size )
+{
+    VOS_STATUS status;
+    vos_pkt_t *pPacket;
+
+    status = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, size, 1, 
+                                    VOS_TRUE, NULL, NULL );
+    if( VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        status = vos_pkt_reserve_head( pPacket, (v_VOID_t **)ppData, size );
+        if( !VOS_IS_STATUS_SUCCESS( status ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "bapRsnAcquirePacket failed to reserve size = %d\n", size );
+            vos_pkt_return_packet( pPacket );
+        }
+        else
+        {
+            *ppPacket = pPacket;
+        }
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "bapRsnAcquirePacket failed to get vos_pkt\n" );
+    }
+
+    return ( status );
+}
+
+
+static VOS_STATUS bapRsnTxCompleteCallback( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus )
+{
+    int retVal;
+    ptBtampContext btampContext; // use btampContext value  
+    tCsrRoamSetKey setKeyInfo;
+    tSuppRsnFsm *fsm;
+
+    if (NULL == pvosGCtx) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "pvosGCtx is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = VOS_GET_BAP_CB(pvosGCtx); 
+    if (NULL == btampContext) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "btampContext is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    fsm = &btampContext->uFsm.suppFsm;
+    if (NULL == fsm) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "fsm is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    //If we get a disconect from upper layer before getting the pkt from TL the
+    //bapRsnFsmTxCmpHandler could be NULL 
+    //VOS_ASSERT( bapRsnFsmTxCmpHandler );
+
+    if( bapRsnFsmTxCmpHandler )
+    {
+        //Change the state
+        //Call auth or supp FSM's handler
+        bapRsnFsmTxCmpHandler( pvosGCtx, pPacket, retStatus );
+    }
+    else
+    {
+        vos_pkt_return_packet( pPacket );
+        return (VOS_STATUS_SUCCESS );
+    }
+
+    //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one.
+    /*
+    We will move the Set key to EAPOL Completion handler. We found a race condition betweem
+    sending EAPOL frame and setting Key */
+    if (BAP_SET_RSN_KEY == gReadToSetKey) {
+        vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) );
+        setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES;
+        setKeyInfo.keyDirection = eSIR_TX_RX;
+        vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) );
+        setKeyInfo.paeRole = 0; //this is a supplicant
+        setKeyInfo.keyId = 0;   //always
+        setKeyInfo.keyLength = CSR_AES_KEY_LEN; 
+        vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN );
+
+        if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" );
+            retVal = ANI_ERROR;
+        }
+        gReadToSetKey = BAP_RESET_RSN_KEY;
+    }
+
+    return (VOS_STATUS_SUCCESS );
+}
+
+
+static VOS_STATUS bapRsnTxFrame( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket )
+{
+    VOS_STATUS status;
+    WLANTL_MetaInfoType metaInfo;
+
+    vos_mem_zero( &metaInfo, sizeof( WLANTL_MetaInfoType ) );
+    metaInfo.ucIsEapol = 1; //only send eapol frame
+    status = WLANTL_TxBAPFrm( pvosGCtx, pPacket, &metaInfo, bapRsnTxCompleteCallback );
+    if( !VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "bapRsnTxFrame failed to send vos_pkt status = %d\n", status );
+    }
+
+    return ( status );
+}
+
+
+/*
+    \brief bapRsnSendEapolFrame
+    To push an eapol frame to TL. 
+
+    \param pAniPkt - a ready eapol frame that is prepared in tAniPacket format
+*/
+VOS_STATUS bapRsnSendEapolFrame( v_PVOID_t pvosGCtx, tAniPacket *pAniPkt )
+{
+    VOS_STATUS status;
+    vos_pkt_t *pPacket;
+    v_U8_t *pData, *pSrc;
+    int pktLen = aniAsfPacketGetBytes( pAniPkt, &pSrc );
+
+    if( pktLen <= 0 )
+    {
+        return VOS_STATUS_E_EMPTY;
+    }
+    status = bapRsnAcquirePacket( &pPacket, &pData, pktLen );
+    if( VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        vos_mem_copy( pData, pSrc, pktLen );
+        //Send the packet, need to check whether we have an outstanding packet first.
+        status = bapRsnTxFrame( pvosGCtx, pPacket );
+        if( !VOS_IS_STATUS_SUCCESS( status ) )
+        {
+            vos_pkt_return_packet( pPacket );
+        }
+    }
+
+    return ( status );
+}
+
+
+//TL call this function on Rx frames, should only be EAPOL frames
+VOS_STATUS bapRsnRxCallback( v_PVOID_t pv, vos_pkt_t *pPacket )
+{
+    //Callback to auth or supp FSM's handler
+    VOS_ASSERT( bapRsnFsmRxFrameHandler );
+    if( bapRsnFsmRxFrameHandler )
+    {
+        bapRsnFsmRxFrameHandler( pv, pPacket );
+    }
+    else
+    {
+        //done
+        vos_pkt_return_packet( pPacket );
+    }
+
+    return ( VOS_STATUS_SUCCESS );
+}
+
+
+
+VOS_STATUS bapRsnRegisterRxCallback( v_PVOID_t pvosGCtx )
+{
+    VOS_STATUS status;
+
+    status = WLANTL_RegisterBAPClient( pvosGCtx, WLANBAP_RxCallback, WLANBAP_TLFlushCompCallback );
+    if( !VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        if( VOS_STATUS_E_EXISTS != status )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                "bapRsnRegisterRxCallback failed with status = %d\n", status );
+        }
+        else
+        {
+            //We consider it ok to register it multiple times because only BAP's RSN should call this
+            status = VOS_STATUS_SUCCESS;
+        }
+    }
+
+    return ( status );
+}
+
+
diff --git a/CORE/BAP/src/bapRsnTxRx.h b/CORE/BAP/src/bapRsnTxRx.h
new file mode 100644
index 0000000..d460268
--- /dev/null
+++ b/CORE/BAP/src/bapRsnTxRx.h
@@ -0,0 +1,84 @@
+/*
+ * 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( __BAPRSN_TXRX_H )
+#define __BAPRSN_TXRX_H
+
+/**=============================================================================
+  
+  bapRsnTxRx.h
+  
+  \brief
+  
+  Description...
+    
+  
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ==============================================================================*/
+
+#include "vos_types.h"
+#include "vos_status.h"
+#include "vos_packet.h"
+#include "bapRsnAsfPacket.h"
+
+
+typedef int (*pnfTxCompleteHandler)( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus );
+typedef int (*pnfRxFrameHandler)( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket );
+
+/*
+    \brief bapRsnSendEapolFrame
+    To push an eapol frame to TL. 
+
+    \param pAniPkt - a ready eapol frame that is prepared in tAniPacket format
+*/
+VOS_STATUS bapRsnSendEapolFrame( v_PVOID_t pvosGCtx, tAniPacket *pAniPkt );
+
+
+/*
+    \brief bapRsnRegisterTxRxCallbacks
+    To register two callbacks for txcomplete and rxFrames .
+
+    \param pfnTxCom - pointer to a function to handle the tx completion.
+    \param pnfRxFrame - point to a function to handle rx frames
+*/
+VOS_STATUS bapRsnRegisterTxRxCallbacks( pnfTxCompleteHandler pfnTxCom, pnfRxFrameHandler pnfRxFrame );
+
+//To set the callbaks to NULL so it can be change later
+void bapRsnClearTxRxCallbacks(void);
+
+/*
+    \brief bapRsnRegisterRxCallback
+    To register the RX frame callbacks to TL to receive EAPOL frames .
+
+    \param pvosGCtx - pointer to global VOSS context.
+*/
+VOS_STATUS bapRsnRegisterRxCallback( v_PVOID_t pvosGCtx );
+
+VOS_STATUS bapRsnRxCallback(v_PVOID_t pv, vos_pkt_t *pPacket);
+
+#endif //__BAPRSN_TXRX_H
+
+
+
+
diff --git a/CORE/BAP/src/btampFsm.c b/CORE/BAP/src/btampFsm.c
new file mode 100644
index 0000000..0842fc2
--- /dev/null
+++ b/CORE/BAP/src/btampFsm.c
@@ -0,0 +1,2708 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      b t a m p F s m . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the Finite State Machine that
+  controls the operation of each individual AMP Physical link.
+  (Currently, this is limited to ONE link.)
+
+  The btampFsm() routine provided by this module is called by the rest of
+  the BT-AMP PAL module whenever a control plane operation occurs that requires a
+  major state transition.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 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: /prj/qct/asw/engbuilds/scl/users02/jzmuda/gb-bluez/vendor/qcom/proprietary/wlan/libra/CORE/BAP/src/btampFsm.c,v 1.11 2011/03/30 21:52:10 jzmuda Exp jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2008-10-16    jez     Created module
+
+===========================================================================*/
+
+/* This file is generated from btampFsm.cdd - do not edit manually*/
+/* Generated on: Thu Oct 16 15:40:39 PDT 2008 / version 1.2 Beta 1 */
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+
+
+#include "fsmDefs.h"
+//#include "btampFsm.h"
+#include "bapInternal.h"
+#include "btampFsm_ext.h"
+
+// Pick up the BTAMP Timer API definitions
+#include "bapApiTimer.h"
+
+// Pick up the BTAMP RSN definitions
+#include "bapRsn8021xFsm.h"
+
+#include "bapRsn8021xAuthFsm.h"
+// Pick up the SME API definitions
+#include "sme_Api.h"
+
+// Pick up the PMC API definitions
+#include "pmcApi.h"
+
+// Pick up the BTAMP API defintions for interfacing to External subsystems
+#include "bapApiExt.h"
+
+#include "wlan_nlink_common.h"
+#include "wlan_btc_svc.h"
+
+// Pick up the DOT11 Frames compiler
+// I just need these one "opaque" type definition in order to use the "frames" code
+typedef struct sAniSirGlobal *tpAniSirGlobal;
+#include "dot11f.h"
+
+#if 0
+/*
+ * Event-related Defines. 
+ *  -  Ultimately, these events will be values
+ *  -  from an enumeration.  That are set by some
+ *  - of the following events.
+ */
+#define eWLAN_BAP_MAC_START_BSS_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
+#define eWLAN_BAP_MAC_START_FAILS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+#define eWLAN_BAP_MAC_SCAN_COMPLETE /* bapScanCompleteCallback */
+#define eWLAN_BAP_CHANNEL_NOT_SELECTED /* No existing Infra assoc  - e.g., use HAL to access the STA LIST and find nothing */
+#define eWLAN_BAP_MAC_CONNECT_COMPLETED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */
+#define eWLAN_BAP_MAC_CONNECT_FAILED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
+#define eWLAN_BAP_MAC_CONNECT_INDICATION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */
+#define eWLAN_BAP_RSN_SUCCESS /* setKey IOCTL from the Auth/Supp App */
+#define eWLAN_BAP_RSN_FAILURE /* deAuth IOCTL from the Auth/Supp App */
+#define eWLAN_BAP_MAC_KEY_SET_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */
+#define eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOC_IND */
+#define eWLAN_BAP_MAC_READY_FOR_CONNECTIONS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */
+#define eWLAN_BAP_CHANNEL_SELECTION_FAILED /* ??? */
+
+#endif /* 0 */
+
+/*Min and max channel values in 2.4GHz band for operational channel validation 
+  on connect*/
+#define WLAN_BAP_MIN_24G_CH  1
+#define WLAN_BAP_MAX_24G_CH  14
+
+
+/* The HCI Disconnect Logical Link Complete Event signalling routine*/
+VOS_STATUS
+signalHCIDiscLogLinkCompEvent
+( 
+  ptBtampContext btampContext, /* btampContext value */    
+  v_U8_t status,    /* the BT-AMP status */
+  v_U16_t log_link_handle,  /* The Logical Link that disconnected*/
+  v_U8_t reason    /* the BT-AMP reason code */
+);
+
+
+/* Stubs - TODO : Remove once the functions are available */
+int
+bapSuppDisconnect(tBtampContext *ctx)
+{
+    // Disconnect function is called internally
+    // TODO : Need to find, if it disconnect will be issued from bap for supplicant
+    return ANI_OK;
+}
+
+int
+bapAuthDisconnect(tBtampContext *ctx)
+{
+    // Disconnect function is called internally
+    // TODO : Need to find, if it disconnect will be issued from bap for supplicant
+    return ANI_OK;
+}
+
+VOS_STATUS
+bapSetKey( v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo )
+{
+    tWLAN_BAPEvent bapEvent; /* State machine event */
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    ptBtampContext btampContext; /* use btampContext value */ 
+    v_U8_t status;    /* return the BT-AMP status here */
+    eHalStatus  halStatus;
+    v_U32_t roamId = 0xFF;
+    tHalHandle     hHal = NULL;
+    v_U8_t groupMac[ANI_MAC_ADDR_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};  
+ 
+    /* Validate params */ 
+    if ((pvosGCtx == NULL) || (pSetKeyInfo == NULL))
+    {
+      return VOS_STATUS_E_FAULT;
+    }
+
+    btampContext = VOS_GET_BAP_CB(pvosGCtx); 
+    /* Validate params */ 
+    if ( btampContext == NULL)
+    {
+      return VOS_STATUS_E_FAULT;
+    }
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__,  btampContext); 
+
+    /* Fill in the event structure */ 
+    bapEvent.event = eWLAN_BAP_RSN_SUCCESS;
+    bapEvent.params = NULL;
+
+    /* Signal the successful RSN auth and key exchange event */ 
+    /* (You have to signal BEFORE calling sme_RoamSetKey) */ 
+    vosStatus = btampFsm(btampContext, &bapEvent, &status);
+
+    /* Set the Pairwise Key */ 
+    halStatus = sme_RoamSetKey( 
+            hHal, 
+            btampContext->sessionId, 
+            pSetKeyInfo, 
+            &roamId );
+    if ( halStatus != eHAL_STATUS_SUCCESS )
+    {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+              "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus );
+        return VOS_STATUS_E_FAULT;
+    }
+                         
+    /* Set the Group Key */ 
+    vos_mem_copy( pSetKeyInfo->peerMac, groupMac, sizeof( tAniMacAddr ) );;
+    halStatus = sme_RoamSetKey( 
+            hHal, 
+            btampContext->sessionId, 
+            pSetKeyInfo, 
+            &roamId );
+    if ( halStatus != eHAL_STATUS_SUCCESS )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus );
+      return VOS_STATUS_E_FAULT;
+    }
+  
+    return vosStatus;
+}
+
+/*
+ * Debug-related Defines. 
+ *  -  Ultimately, these events will be values
+ *  -  from an enumeration.  That are set by some
+ *  - of the following events.
+ */
+#define DUMPLOG_ON
+#if defined DUMPLOG_ON
+#define DUMPLOG(n, name1, name2, aStr, size) \
+    if (1) \
+{\
+    int i;\
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%d. %s: %s = \n", n, name1, name2); \
+    for (i = 0; i < size; i++) \
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "\n"); \
+}
+#else
+#define DUMPLOG(n, name1, name2, aStr, size)
+#endif
+
+/*
+ * State transition procedures 
+ */
+
+VOS_STATUS
+gotoS1
+( 
+    ptBtampContext btampContext, /* btampContext value */    
+    ptWLAN_BAPEvent bapEvent, /* State machine event */
+    tWLAN_BAPRole BAPDeviceRole,
+    v_U8_t *status    /* return the BT-AMP status here */
+) 
+{
+  tBtampTLVHCI_Create_Physical_Link_Cmd *pBapHCIPhysLinkCreate 
+      = (tBtampTLVHCI_Create_Physical_Link_Cmd *) bapEvent->params;
+  tBtampTLVHCI_Accept_Physical_Link_Cmd *pBapHCIPhysLinkAccept 
+      = (tBtampTLVHCI_Accept_Physical_Link_Cmd *) bapEvent->params;
+  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+  v_U32_t     conAcceptTOInterval;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /* Remember role */
+  btampContext->BAPDeviceRole = BAPDeviceRole;
+
+    switch(BAPDeviceRole)
+    {
+    case BT_INITIATOR:
+      /* Copy down the phy_link_handle value */
+      btampContext->phy_link_handle = pBapHCIPhysLinkCreate->phy_link_handle;
+      /* Copy out the key material from the HCI command */
+      btampContext->key_type = pBapHCIPhysLinkCreate->key_type;
+      btampContext->key_length = pBapHCIPhysLinkCreate->key_length;
+      vos_mem_copy( 
+              btampContext->key_material, 
+              pBapHCIPhysLinkCreate->key_material, 
+              32);  /* Need a key size define */
+      break;
+    case BT_RESPONDER:
+      /* Copy down the phy_link_handle value */
+      btampContext->phy_link_handle = pBapHCIPhysLinkAccept->phy_link_handle;
+      /* Copy out the key material from the HCI command */
+      btampContext->key_type = pBapHCIPhysLinkAccept->key_type; 
+      btampContext->key_length = pBapHCIPhysLinkAccept->key_length; 
+      vos_mem_copy( 
+              btampContext->key_material, 
+              pBapHCIPhysLinkAccept->key_material, 
+              32);  /* Need a key size define */
+      break;
+    default:
+      *status = WLANBAP_ERROR_HOST_REJ_RESOURCES;     /* return the BT-AMP status here */
+      return VOS_STATUS_E_RESOURCES;
+  }
+
+  conAcceptTOInterval = (btampContext->bapConnectionAcceptTimerInterval * 5)/ 8;
+  /* Start the Connection Accept Timer */
+  vosStatus = WLANBAP_StartConnectionAcceptTimer ( 
+          btampContext, 
+          conAcceptTOInterval);
+
+  *status = WLANBAP_STATUS_SUCCESS;     /* return the BT-AMP status here */
+  
+  return VOS_STATUS_SUCCESS;
+} //gotoS1
+
+VOS_STATUS
+gotoScanning
+( 
+    ptBtampContext btampContext, /* btampContext value */    
+    tWLAN_BAPRole BAPDeviceRole,
+    v_U8_t *status    /* return the BT-AMP status here */
+)
+{
+  /* Initiate a SCAN request */
+  //csrScanRequest();
+  *status = WLANBAP_STATUS_SUCCESS;     /* return the BT-AMP status here */
+
+  return VOS_STATUS_SUCCESS;
+}
+
+
+#if 0
+/*==========================================================================
+ 
+  FUNCTION: convertRoleToBssType
+
+  DESCRIPTION:  Return one of the following values:
+
+    eCSR_BSS_TYPE_INFRASTRUCTURE,
+    eCSR_BSS_TYPE_IBSS,           // an IBSS network we will NOT start
+    eCSR_BSS_TYPE_START_IBSS,     // an IBSS network we will start if no partners detected.
+    eCSR_BSS_TYPE_WDS_AP,         // BT-AMP AP
+    eCSR_BSS_TYPE_WDS_STA,        // BT-AMP station
+    eCSR_BSS_TYPE_ANY, 
+============================================================================*/
+#endif
+eCsrRoamBssType 
+convertRoleToBssType
+(
+    tWLAN_BAPRole bapRole  /* BT-AMP role */
+) 
+{
+    switch (bapRole)
+    {
+        case BT_RESPONDER: 
+            // an WDS network we will join
+            return eCSR_BSS_TYPE_WDS_STA;            
+            //return eCSR_BSS_TYPE_INFRASTRUCTURE;            
+            //return eCSR_BSS_TYPE_IBSS;     // Initial testing with IBSS on both ends makes more sense
+        case BT_INITIATOR: 
+            // an WDS network we will start if no partners detected.
+            return eCSR_BSS_TYPE_WDS_AP;      
+            //return eCSR_BSS_TYPE_START_IBSS; // I really should try IBSS on both ends      
+        default:
+            return eCSR_BSS_TYPE_INFRASTRUCTURE;
+    }
+} // convertRoleToBssType
+
+
+char hexValue[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+                   '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+                  };
+
+#define BAP_MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX_BYTES 8
+// Each byte will be converted to hex digits followed by a
+// punctuation (which is specified in the "delimiter" param.) Thus 
+// allocate three times the storage.
+v_U8_t *
+bapBin2Hex(const v_U8_t *bytes, v_U32_t len, char delimiter)
+{
+  static v_U8_t buf[MAX_BYTES*(2+1)];
+  v_U32_t i;
+  v_U8_t *ptr;
+
+  len = BAP_MIN(len, MAX_BYTES);
+    for (i = 0, ptr = buf; i < len; i++)
+    {
+    *ptr++ = hexValue[ (bytes[i] >> 4) & 0x0f];
+    *ptr++ = hexValue[ bytes[i] & 0x0f];
+    *ptr++ = delimiter;
+    //sprintf(ptr, "%.2x%c", bytes[i], delimiter);
+    //ptr += 3;
+  }
+
+  // Delete the extra punctuation and null terminate the string
+  if (len > 0)
+      ptr--;
+  *ptr = '\0';
+
+  return buf;
+}// bapBin2Hex
+
+char bapSsidPrefixValue[] = {'A', 'M', 'P', '-'};
+
+v_U8_t * 
+convertBSSIDToSSID
+(
+    v_U8_t *bssid  /* BSSID value */
+) 
+{
+    static v_U8_t ssId[32]; 
+
+    vos_mem_copy( 
+            ssId, 
+            bapSsidPrefixValue, 
+            4); 
+
+    vos_mem_copy( 
+            &ssId[4], 
+            bapBin2Hex(bssid, 6, '-'),
+            17); 
+
+    return ssId;
+} // convertBSSIDToSSID
+
+VOS_STATUS
+convertToCsrProfile
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    eCsrRoamBssType bssType,
+    tCsrRoamProfile *pProfile   /* return the profile info here */
+) 
+{
+    static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 
+                                  0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00
+                                 };
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    v_S7_t sessionid = -1;
+    tHalHandle     hHal = NULL;
+    v_U32_t triplet;
+    v_U8_t regulatoryClass;
+    v_U8_t firstChannel;
+    v_U8_t numChannels;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    if (NULL == btampContext) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "btampContext is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    //Zero out entire roamProfile structure to avoid problems in uninitialized pointers as the structure expands */
+    //vos_mem_zero(pProfile,sizeof(tCsrRoamProfile));
+
+    //Set the BSS Type
+    //pProfile->BSSType = convertRoleToBssType(btampContext->BAPDeviceRole ); 
+    pProfile->BSSType = bssType; 
+    //pProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+
+    //Set the SSID
+
+    if ( bssType == eCSR_BSS_TYPE_WDS_STA) 
+    {
+        pProfile->SSIDs.numOfSSIDs = 2;
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __FUNCTION__, "eCSR_BSS_TYPE_WDS_STA", convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr));
+    
+        vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, 
+                sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId));
+        vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId,
+                convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr),
+                21);  // Length of BTAMP SSID is 21 bytes
+        pProfile->SSIDs.SSIDList[0].SSID.length = 21;
+
+        vos_mem_zero(pProfile->SSIDs.SSIDList[1].SSID.ssId, 
+                sizeof(pProfile->SSIDs.SSIDList[1].SSID.ssId));
+        vos_mem_copy(pProfile->SSIDs.SSIDList[1].SSID.ssId,
+                convertBSSIDToSSID(btampContext->self_mac_addr),
+                21);  // Length of BTAMP SSID is 21 bytes
+        pProfile->SSIDs.SSIDList[1].SSID.length = 21;
+ 
+        //Set the BSSID to the Remote AP
+        pProfile->BSSIDs.numOfBSSIDs = 1;
+        vos_mem_copy(pProfile->BSSIDs.bssid, 
+                btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, 
+                sizeof( tCsrBssid ) ); 
+ 
+    }
+    else if ( bssType == eCSR_BSS_TYPE_WDS_AP)
+    {
+        pProfile->SSIDs.numOfSSIDs = 1;
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __FUNCTION__, "eCSR_BSS_TYPE_WDS_AP", convertBSSIDToSSID(btampContext->self_mac_addr));
+    
+        vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, 
+                sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId));
+        vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId,
+                convertBSSIDToSSID(btampContext->self_mac_addr),
+                21);  // Length of BTAMP SSID is 21 bytes
+        pProfile->SSIDs.SSIDList[0].SSID.length = 21;
+ 
+#if 0
+        //In case you are an AP, don't set the BSSID
+        pProfile->BSSIDs.numOfBSSIDs = 0;
+#endif //0
+ 
+        //Set the BSSID to your "self MAC Addr"
+        pProfile->BSSIDs.numOfBSSIDs = 1;
+        vos_mem_copy(pProfile->BSSIDs.bssid, 
+                btampContext->self_mac_addr,
+                sizeof( tCsrBssid ) ); 
+ 
+    }
+    else
+    // Handle everything else as bssType eCSR_BSS_TYPE_INFRASTRUCTURE
+    {
+        pProfile->SSIDs.numOfSSIDs = 1;
+    
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __FUNCTION__, "eCSR_BSS_TYPE_WDS_STA", convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr));
+
+        vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, 
+                sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId));
+        vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId,
+                convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr),
+                21);  // Length of BTAMP SSID is 21 bytes
+        pProfile->SSIDs.SSIDList[0].SSID.length = 21;
+ 
+        //Set the BSSID to the Remote AP
+        pProfile->BSSIDs.numOfBSSIDs = 1;
+        vos_mem_copy(pProfile->BSSIDs.bssid, 
+                btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, 
+                sizeof( tCsrBssid ) ); 
+ 
+    }
+ 
+    //Always set the Auth Type
+    //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_RSN_PSK;
+    //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_NONE;
+    //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+    pProfile->AuthType.numEntries = 1;
+    //pProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+    pProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK;
+
+    //Always set the Encryption Type
+    //pProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_AES;
+    //pProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+    pProfile->EncryptionType.numEntries = 1;
+    //pProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+    pProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES;
+
+    pProfile->mcEncryptionType.numEntries = 1;
+    //pProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+    pProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES;
+
+    //set the RSN IE
+    //This is weird, but it works
+    pProfile->pRSNReqIE = &btampRSNIE[0];
+    pProfile->nRSNReqIELength = 0x16; //TODO
+    //pProfile->pRSNReqIE = NULL;
+ 
+    /** We don't use the WPAIE.But NULL it to avoid being used **/
+    pProfile->pWPAReqIE = NULL;
+    pProfile->nWPAReqIELength = 0;
+
+    // Identify the operation channel
+
+    /* Choose the operation channel from the preferred channel list */
+    pProfile->operationChannel = 0;
+    regulatoryClass = 0;
+    for (triplet = 0; triplet < btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets; triplet++)
+        {
+        firstChannel = 0;
+        numChannels = 0;
+
+        /* is this a regulatory class triplet? */
+        if (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][0] == 201)
+            {
+            /* identify supported 2.4GHz regulatory classes */
+            switch (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][1])
+            {
+                case 254:
+                {
+                    /* class 254 is special regulatory class defined by BT HS+3.0 spec that
+                       is valid only for unknown/'mobile' country */
+                    if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'X') &&
+                        (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'X'))
+                    {
+                        regulatoryClass = 254;
+                        firstChannel = 1;
+                        numChannels = 11;
+                    }
+                    break;
+            }
+                case 12:
+            {
+                    /* class 12 in the US regulatory domain is 2.4GHz channels 1-11 */
+                    if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'U') &&
+                        (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'S'))
+                    {
+                        regulatoryClass = 12;
+                        firstChannel = 1;
+                        numChannels = 11;
+            }
+                    break;
+                }
+                case 4:
+            {
+                    /* class 4 in the Europe regulatory domain is 2.4GHz channels 1-13 */
+                    if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'G') &&
+                        (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'B'))
+                    {
+                        regulatoryClass = 4;
+                        firstChannel = 1;
+                        numChannels = 13;
+            }
+                    break;
+                }
+                case 30:
+            {
+                    /* class 30 in the Japan regulatory domain is 2.4GHz channels 1-13 */
+                    if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'J') &&
+                        (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'P'))
+                    {
+                        regulatoryClass = 30;
+                        firstChannel = 1;
+                        numChannels = 13;
+            }
+                    break;
+        }
+                default:
+        {
+                    break;
+                }
+            }
+            /* if the next triplet is not another regulatory class triplet then it must be a sub-band
+               triplet. Skip processing the default channels for this regulatory class triplet and let
+               the sub-band triplet restrict the available channels */
+            if (((triplet+1) < btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets) &&
+                (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet+1][0] != 201))
+            {
+                continue;
+        }
+    }
+    else
+    {
+            /* if the regulatory class is valid then this is a sub-band triplet */
+            if (regulatoryClass)
+            {
+                firstChannel = btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][0];
+                numChannels = btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][1];
+            }
+        }
+
+        if (firstChannel && numChannels)
+        {
+            if (!btampContext->btamp_AMP_Assoc.HC_pref_num_triplets)
+            {
+                pProfile->operationChannel = firstChannel;
+                break;
+            }
+            else if (((btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] + btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1]) <= firstChannel) ||
+               ((firstChannel + numChannels ) <= btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0]))
+            {
+                continue;
+            }
+            else if ((btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] + btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1]) > firstChannel)
+            {
+                pProfile->operationChannel = firstChannel;
+                break;
+            }
+            else if ((firstChannel + numChannels) > btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0])
+            {
+                pProfile->operationChannel =  btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0];
+                break;
+            }
+        }
+    }
+
+    if (!pProfile->operationChannel)
+    {
+        return VOS_STATUS_E_INVAL;
+    }
+
+    /*Set the selected channel */
+    sessionid = sme_GetInfraSessionId(hHal);
+    /*if there is infra session up already, use that channel only for BT AMP
+    connection, else we can use the user preferred one*/
+    if(-1 != sessionid)
+    {
+        pProfile->operationChannel = 
+            sme_GetInfraOperationChannel(hHal, 
+                                         sessionid);
+    }
+     
+    if(sme_IsChannelValid(hHal, pProfile->operationChannel))
+    {         
+        btampContext->channel = pProfile->operationChannel;
+    }
+    else
+    {
+        //no valid channel, not proceeding with connection
+        return VOS_STATUS_E_INVAL;
+    }
+     
+    if ( BT_INITIATOR == btampContext->BAPDeviceRole ) 
+    {
+      pProfile->ChannelInfo.numOfChannels = 1;
+      pProfile->ChannelInfo.ChannelList   = &pProfile->operationChannel;
+    }
+    else 
+    {
+        pProfile->ChannelInfo.numOfChannels = 1;
+        pProfile->ChannelInfo.ChannelList   = &pProfile->operationChannel;
+    }
+
+
+    // Turn off CB mode
+    pProfile->CBMode = eCSR_CB_OFF;
+
+    //set the phyMode to accept anything
+    //Taurus means everything because it covers all the things we support
+    pProfile->phyMode = eCSR_DOT11_MODE_11n; //eCSR_DOT11_MODE_TAURUS; //eCSR_DOT11_MODE_AUTO; /*eCSR_DOT11_MODE_BEST;*/
+
+    //set the mode in CFG as well
+    sme_CfgSetInt(hHal, WNI_CFG_DOT11_MODE, WNI_CFG_DOT11_MODE_11N, NULL, eANI_BOOLEAN_FALSE);
+
+    pProfile->bWPSAssociation = eANI_BOOLEAN_FALSE;
+
+    //Make sure we DON'T request UAPSD
+    pProfile->uapsd_mask = 0;
+
+    //return the vosStatus
+    return vosStatus;
+} //convertToCsrProfile
+
+VOS_STATUS
+gotoStarting
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    ptWLAN_BAPEvent bapEvent, /* State machine event */
+    eCsrRoamBssType bssType,
+    v_U8_t *status    /* return the BT-AMP status here */
+) 
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    eHalStatus  halStatus;
+    v_U32_t     parseStatus;
+    /* tHalHandle */    
+    tHalHandle hHal;
+    tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pBapHCIWriteRemoteAMPAssoc 
+        = (tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *) bapEvent->params;
+    tBtampAMP_ASSOC btamp_ASSOC; 
+
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    if (NULL == btampContext) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "btampContext is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+    //If we are a BT-Responder, we are assuming we are a BT "slave" and we HAVE
+    //to "squelch" the slaves frequent (every 1.25ms) polls.
+
+    if (eCSR_BSS_TYPE_WDS_STA == bssType)
+    {
+        /* Sleep for 300(200) milliseconds - to allow BT through */
+        vos_sleep( 200 );
+        /* Signal BT Coexistence code in firmware to prefer WLAN */
+        WLANBAP_NeedBTCoexPriority ( btampContext, 1);
+    }
+
+
+    //Tell PMC to exit BMPS;
+    halStatus = pmcRequestFullPower(
+            hHal, 
+            WLANBAP_pmcFullPwrReqCB, 
+            btampContext,
+            eSME_REASON_OTHER);
+            // JEZ081210: This has to wait until we sync down from 
+            // /main/latest as of 12/4.  We are currently at 12/3.
+            //eSME_FULL_PWR_NEEDED_BY_BAP);
+    //Need to check the result...because Host may have been told by 
+    //OS to go to standby (D2) device state. In that case, I have to 
+    //fail the HCI Create Physical Link 
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, 
+            "In %s, amp_assoc_remaining_length = %d", __FUNCTION__, 
+            pBapHCIWriteRemoteAMPAssoc->amp_assoc_remaining_length); 
+#if 0
+    DUMPLOG(1, __FUNCTION__, "amp_assoc_fragment",  
+            pBapHCIWriteRemoteAMPAssoc->amp_assoc_fragment, 
+            64);
+#endif //0
+
+    //What about parsing the AMP Assoc structure?
+    parseStatus = btampUnpackAMP_ASSOC(
+            hHal, 
+            pBapHCIWriteRemoteAMPAssoc->amp_assoc_fragment, 
+            pBapHCIWriteRemoteAMPAssoc->amp_assoc_remaining_length, 
+            &btamp_ASSOC);
+
+    /* Unknown or Reserved TLVs are allowed in the write AMP assoc fragment */
+    if ((BTAMP_PARSE_SUCCESS != parseStatus ) && (BTAMP_UNKNOWN_TLVS != parseStatus))  
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, parseStatus = %d", __FUNCTION__, parseStatus);
+        *status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
+        return VOS_STATUS_E_BADMSG;
+    }
+
+    //What about writing the peer MAC address, and other info to the BTAMP 
+    //context for this physical link?
+    if (btamp_ASSOC.AMP_Assoc_MAC_Addr.present == 1)
+    {
+        /* Save the peer MAC address */ 
+        vos_mem_copy( 
+                btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, 
+                btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr,   
+                sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr)); 
+        /* Save it in the peer MAC address field */ 
+        vos_mem_copy( 
+                btampContext->peer_mac_addr, 
+                btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr,   
+                sizeof(btampContext->peer_mac_addr)); 
+     }
+
+    if (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present == 1)
+    {
+        /* Save the peer Preferred Channel List */ 
+        vos_mem_copy( 
+                btampContext->btamp_Remote_AMP_Assoc.HC_pref_country, 
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country,   
+                sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_pref_country)); 
+        /* Save the peer Preferred Channel List */ 
+        btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets = 
+            btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets;   
+        if(WLANBAP_MAX_NUM_TRIPLETS < 
+           btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets)
+        {
+            btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets = 
+                WLANBAP_MAX_NUM_TRIPLETS;
+        }
+        vos_mem_copy( 
+                btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets, 
+                btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets,   
+                sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[0]) *
+                btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets   
+                ); 
+    }
+
+    if (btamp_ASSOC.AMP_Assoc_Connected_Channel.present == 1)
+    {
+        /* Save the peer Connected Channel */ 
+        vos_mem_copy( 
+                btampContext->btamp_Remote_AMP_Assoc.HC_cnct_country, 
+                btamp_ASSOC.AMP_Assoc_Connected_Channel.country,   
+                sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_cnct_country)); 
+        /* Save the peer Connected Channel */ 
+        btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets = 
+            btamp_ASSOC.AMP_Assoc_Connected_Channel.num_triplets;
+        if(WLANBAP_MAX_NUM_TRIPLETS < 
+           btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets)
+        {
+            btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets = 
+                WLANBAP_MAX_NUM_TRIPLETS;
+        }
+        vos_mem_copy( 
+                btampContext->btamp_Remote_AMP_Assoc.HC_cnct_triplets, 
+                btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets,   
+                sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_cnct_triplets[0]) *
+                btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets
+                ); 
+    }
+
+    if (btamp_ASSOC.AMP_Assoc_PAL_Capabilities.present == 1)
+    {
+        /* Save the peer PAL Capabilities */ 
+        btampContext->btamp_Remote_AMP_Assoc.HC_pal_capabilities 
+            = btamp_ASSOC.AMP_Assoc_PAL_Capabilities.pal_capabilities;
+    }
+
+    if (btamp_ASSOC.AMP_Assoc_PAL_Version.present == 1)
+    {
+        /* Save the peer PAL Version */ 
+        btampContext->btamp_Remote_AMP_Assoc.HC_pal_version 
+            = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_version;
+
+        btampContext->btamp_Remote_AMP_Assoc.HC_pal_CompanyID 
+            = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_CompanyID;
+
+        btampContext->btamp_Remote_AMP_Assoc.HC_pal_subversion 
+            = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_subversion;
+    }
+
+    //Set Connection Accept Timeout;
+    /* Already done in gotoS1() */
+    //Set gNeedPhysLinkCompEvent;
+    //JEZ081114: This needs to happen earlier. In gotoS1. Right at HCI Create Physical Link
+    btampContext->gNeedPhysLinkCompEvent = VOS_TRUE;
+    //Clear gDiscRequested;
+    btampContext->gDiscRequested = VOS_FALSE;
+    //Set gPhysLinkStatus to 0 (no error);
+    btampContext->gPhysLinkStatus = WLANBAP_STATUS_SUCCESS;
+    //Set gDiscReason to 0 (no reason);
+    btampContext->gDiscReason = WLANBAP_STATUS_SUCCESS;
+    /* Initiate the link as either START or JOIN */
+    //halStatus = csrRoamOpenSession(&newSession);
+    /*Added by Luiza:*/
+
+    if (btampContext->isBapSessionOpen == FALSE)
+    {
+
+        halStatus = sme_OpenSession(hHal, 
+                                    WLANBAP_RoamCallback, 
+                                    btampContext,
+                                    // <=== JEZ081210: FIXME
+                                    //(tANI_U8 *) btampContext->self_mac_addr,  
+                                    btampContext->self_mac_addr,  
+                                    &btampContext->sessionId);
+        if(eHAL_STATUS_SUCCESS == halStatus)
+        {
+            btampContext->isBapSessionOpen = TRUE;
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                         "sme_OpenSession failed in %s", __FUNCTION__);
+            *status = WLANBAP_ERROR_NO_CNCT;
+            return VOS_STATUS_E_FAILURE;
+        }
+    }
+    /* Update the SME Session info for this Phys Link (i.e., for this Phys State Machine instance) */
+    //bapUpdateSMESessionForThisPhysLink(newSession, PhysLinkHandle);
+    // Taken care of, above
+    //halStatus = csrRoamConnect(newSession, bssType);
+    // Final
+    vosStatus = convertToCsrProfile ( 
+            btampContext, /* btampContext value */    
+            bssType,
+            &btampContext->csrRoamProfile);   /* return the profile info here */
+    if(VOS_STATUS_E_INVAL == vosStatus)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "Incorrect channel to create AMP link %s", __FUNCTION__);
+        *status = WLANBAP_ERROR_NO_SUITABLE_CHANNEL;
+        return VOS_STATUS_E_INVAL;
+    }
+#if 0
+    halStatus = sme_RoamConnect(VOS_GET_HAL_CB(btampContext->pvosGCtx), 
+            &btampContext->csrRoamProfile, 
+            NULL,   /* tScanResultHandle hBssListIn, */ 
+            &btampContext->csrRoamId);
+#endif //0
+//#if 0
+    halStatus = sme_RoamConnect(hHal, 
+            btampContext->sessionId, 
+            &btampContext->csrRoamProfile, 
+            &btampContext->csrRoamId);
+//#endif //0
+
+    //Map the halStatus into a vosStatus
+    return vosStatus;
+} //gotoStarting
+          
+VOS_STATUS
+gotoConnecting(
+    ptBtampContext btampContext /* btampContext value */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+    /* No longer needed.  This call has been made in gotoStarting(). */
+    /* Signal BT Coexistence code in firmware to prefer WLAN */
+    WLANBAP_NeedBTCoexPriority ( btampContext, 1);
+
+    return vosStatus;
+} //gotoConnecting
+ 
+VOS_STATUS
+gotoAuthenticating(
+    ptBtampContext btampContext /* btampContext value */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+    /* Signal BT Coexistence code in firmware to prefer WLAN */
+    WLANBAP_NeedBTCoexPriority ( btampContext, 1);
+
+    return vosStatus;
+} //gotoAuthenticating
+
+#if 0
+VOID initRsnSupplicant()
+{
+/* This is a NO-OP.  The Supplicant waits for MSG 1 */
+}
+#endif /* 0 */
+VOS_STATUS
+initRsnSupplicant
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    tWLAN_BAPRole BAPDeviceRole
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+    /* This is a NO-OP.  The Supplicant waits for MSG 1 */
+    /* Init RSN FSM */
+    if (!(suppRsnFsmCreate(btampContext)))
+    {
+        /* Send Start Event */
+        /* RSN_FSM_AUTH_START */
+    }
+    else
+    {
+        /* RSN Init Failed */
+        vosStatus = VOS_STATUS_E_FAILURE;
+    }
+    /* This is a NO-OP.  The Supplicant waits for MSG 1 */
+    return vosStatus;
+}
+
+#if 0
+VOID initRsnAuthenticator()
+{
+/* Signal the Authenticator/Supplicant App that we are associated. */
+/* Use an IOCTL?  That the app is hanging a read on? Or use a "special" data packet. Again, that the app is waiting on a receive for. */
+}
+#endif /* 0 */
+VOS_STATUS
+initRsnAuthenticator
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    tWLAN_BAPRole BAPDeviceRole
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    /* Init RSN FSM */
+    if (!(authRsnFsmCreate(btampContext)))
+    {
+        /* Send Start Event */
+    }
+    else
+    {
+        /* RSN Init Failed */
+        vosStatus = VOS_STATUS_E_FAILURE;
+    }
+    return vosStatus;
+/* Signal the Authenticator/Supplicant App that we are associated. */
+/* Use an IOCTL?  That the app is hanging a read on? Or use a "special" data packet. Again, that the app is waiting on a receive for. */
+}
+
+/* We have to register our STA with TL */
+VOS_STATUS
+regStaWithTl
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    tWLAN_BAPRole BAPDeviceRole,
+    tCsrRoamInfo *pCsrRoamInfo
+)
+{
+    VOS_STATUS vosStatus;
+    WLAN_STADescType staDesc;
+    tANI_S8          rssi = 0;
+
+    vos_mem_zero(&staDesc, sizeof(WLAN_STADescType));
+    /* Fill in everything I know about the STA */
+    btampContext->ucSTAId = staDesc.ucSTAId = pCsrRoamInfo->staId;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BAP register TL ucSTAId=%d\n", 
+               staDesc.ucSTAId );
+
+    /* Fill in the peer MAC address */
+    vos_mem_copy( 
+            staDesc.vSTAMACAddress.bytes, 
+            btampContext->peer_mac_addr, 
+            sizeof(btampContext->peer_mac_addr)); 
+
+    /* Fill in the self MAC address */
+    vos_mem_copy( 
+            staDesc.vSelfMACAddress.bytes, 
+            btampContext->self_mac_addr, 
+            sizeof(btampContext->peer_mac_addr)); 
+
+    /* Set the STA Type */
+    staDesc.wSTAType = WLAN_STA_BT_AMP;
+
+    // Set the QoS field appropriately, if the info available
+    if( pCsrRoamInfo->u.pConnectedProfile)
+    { 
+        btampContext->bapQosCfg.bWmmIsEnabled = //1; 
+            pCsrRoamInfo->u.pConnectedProfile->qosConnection;
+    }
+    else
+    {
+        btampContext->bapQosCfg.bWmmIsEnabled = 0; 
+    }
+
+    // set the QoS field appropriately
+    if( btampContext->bapQosCfg.bWmmIsEnabled )
+    {
+       staDesc.ucQosEnabled = 1;
+    }
+    else
+    {
+       staDesc.ucQosEnabled = 0;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BAP register TL QoS_enabled=%d\n", 
+               staDesc.ucQosEnabled );
+
+    // UMA is ready we inform TL not to do frame 
+    // translation for WinMob 6.1
+    //*** Not to enabled UMA.
+    /* Enable UMA for TX translation only when there is no concurrent session active */
+#if defined (FEATURE_WLAN_INTEGRATED_SOC)
+    staDesc.ucSwFrameTXXlation = 1;
+#else
+    if (vos_concurrent_sessions_running())
+    {
+       staDesc.ucSwFrameTXXlation = 1;
+    }
+    else
+    {
+       staDesc.ucSwFrameTXXlation = 0;
+    }
+#endif
+    staDesc.ucSwFrameRXXlation = 1; 
+    staDesc.ucAddRmvLLC = 0;
+
+    if ( btampContext->ucSecEnabled )
+    {
+       staDesc.ucProtectedFrame = 1;
+    }
+    else
+    {
+       staDesc.ucProtectedFrame = 0;
+    }
+
+    staDesc.ucUcastSig = pCsrRoamInfo->ucastSig; 
+    staDesc.ucBcastSig = pCsrRoamInfo->bcastSig;
+    staDesc.ucInitState = ( btampContext->ucSecEnabled)?
+        WLANTL_STA_CONNECTED:WLANTL_STA_AUTHENTICATED;
+    staDesc.ucIsReplayCheckValid = VOS_FALSE;
+    if(NULL != pCsrRoamInfo->pBssDesc)
+    {
+        rssi = pCsrRoamInfo->pBssDesc->rssi;
+    }
+    /* register our STA with TL */
+    vosStatus = WLANTL_RegisterSTAClient 
+        ( 
+         btampContext->pvosGCtx,
+         WLANBAP_STARxCB,  
+         WLANBAP_TxCompCB,  
+         (WLANTL_STAFetchPktCBType)WLANBAP_STAFetchPktCB,
+         &staDesc ,
+         rssi);   
+    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                  "%s: WLANTL_RegisterSTAClient() failed to register.  Status= %d [0x%08lX]",
+                  __FUNCTION__, vosStatus, vosStatus );
+    }                                            
+     
+    if ( !  btampContext->ucSecEnabled )
+    {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED,
+                  "open/shared auth StaId= %d.  Changing TL state to AUTHENTICATED at Join time", btampContext->ucSTAId);
+    
+       // Connections that do not need Upper layer auth, transition TL directly
+       // to 'Authenticated' state.      
+       vosStatus = WLANTL_ChangeSTAState( btampContext->pvosGCtx, staDesc.ucSTAId, 
+                                            WLANTL_STA_AUTHENTICATED );
+    }                                            
+    else
+    {
+
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED,
+                  "ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time", btampContext->ucSTAId );
+      
+       vosStatus = WLANTL_ChangeSTAState( btampContext->pvosGCtx, staDesc.ucSTAId, 
+                                          WLANTL_STA_CONNECTED );
+    }                                            
+
+    return VOS_STATUS_SUCCESS;
+} /* regStaWithTl */
+
+#if 0
+/*==========================================================================
+
+  FUNCTION:  determineChan
+
+  DESCRIPTION:  Return the current channel we are to operate on
+
+============================================================================*/
+#endif
+
+VOS_STATUS
+determineChan
+(
+    ptBtampContext btampContext, /* btampContext value */    
+    tWLAN_BAPRole BAPDeviceRole,
+    v_U32_t *channel,  /* Current channel */
+    v_U8_t *status    /* return the BT-AMP status here */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    v_U32_t     activeFlag;  /* Channel active flag */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    switch(BAPDeviceRole)
+    {
+    case BT_INITIATOR:
+      /* if an Infra assoc already exists, return that channel. */
+      /* or use the results from the Scan to determine the least busy channel.  How? */
+      /* For now, just do this. */
+      vosStatus = WLANBAP_GetCurrentChannel (btampContext, channel, &activeFlag);
+    break;
+    case BT_RESPONDER:
+      /* return the value obtained from the Preferred Channels field of the AMP Assoc structure from the BT-AMP peer (device A) */
+      /* No!  I don't have that yet. */
+      /* For now, just do this. */
+      vosStatus = WLANBAP_GetCurrentChannel (btampContext, channel, &activeFlag);
+    break;
+    default:
+      *status = WLANBAP_ERROR_HOST_REJ_RESOURCES;     /* return the BT-AMP status here */
+      return VOS_STATUS_E_RESOURCES;
+  }
+  *status = WLANBAP_STATUS_SUCCESS;     /* return the BT-AMP status here */
+
+  return vosStatus;
+} // determineChan
+
+VOS_STATUS
+gotoDisconnected 
+(
+    ptBtampContext btampContext /* btampContext value */    
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    //Is it legitimate to always make this call?  
+    //What if pmcRequestFullPower wasn't called?
+    //Tell PMC to resume BMPS;  /* Whatever the previous BMPS "state" was */
+    //Comment this out until such time as we have PMC support
+    //halStatus = pmcResumePower ( hHal);
+
+    /* Signal BT Coexistence code in firmware to no longer prefer WLAN */
+    WLANBAP_NeedBTCoexPriority ( btampContext, 0);
+
+    //Map the halStatus into a vosStatus
+    return vosStatus;
+} // gotoDisconnected 
+
+VOS_STATUS
+gotoDisconnecting 
+(
+    ptBtampContext   btampContext, /* btampContext value */    
+    v_U8_t   needPhysLinkCompEvent,
+    v_U8_t   physLinkStatus,   /* BT-AMP disconnecting status */
+//    v_U8_t   statusPresent,    /* BT-AMP disconnecting status present */
+    v_U8_t   discRequested,
+    v_U8_t   discReason        /* BT-AMP disconnecting reason */
+)
+{
+
+    // gNeedPhysLinkCompEvent
+    btampContext->gNeedPhysLinkCompEvent = needPhysLinkCompEvent;
+    // gPhysLinkStatus 
+    btampContext->gPhysLinkStatus = physLinkStatus;   /* BT-AMP disconnecting status */
+    // gDiscRequested
+    btampContext->gDiscRequested = discRequested;
+    // gDiscReason 
+    btampContext->gDiscReason = discReason;       /* BT-AMP disconnecting reason */
+
+    //WLANBAP_DeInitLinkSupervision( btampHandle);
+    //WLANBAP_StopLinkSupervisionTimer(btampContext);
+
+    /* Inform user space that no AMP channel is in use, for AFH purposes */
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW,
+               "Calling send_btc_nlink_msg() with AMP channel = 0");
+    send_btc_nlink_msg(WLAN_AMP_ASSOC_DONE_IND, 0);
+
+    return VOS_STATUS_SUCCESS;
+} //gotoDisconnecting 
+
+VOS_STATUS
+gotoConnected
+(
+    ptBtampContext   btampContext /* btampContext value */    
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    ptBtampHandle     btampHandle = ( ptBtampHandle)btampContext;
+//#if 0
+    /* Stop the Connection Accept Timer */
+    vosStatus = WLANBAP_StopConnectionAcceptTimer (btampContext);
+//#endif
+    ///*De-initialize the timer */
+    //vosStatus = WLANBAP_DeinitConnectionAcceptTimer(btampContext);
+
+    /* Signal BT Coex in firmware to now honor only priority BT requests */
+    WLANBAP_NeedBTCoexPriority ( btampContext, 2);
+
+    // If required after successful Upper layer auth, transition TL 
+    // to 'Authenticated' state.      
+    if ( btampContext->ucSecEnabled )
+    { 
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED, 
+                "open/shared auth StaId= %d.  Changing TL state to AUTHENTICATED at Join time", btampContext->ucSTAId);
+    
+        vosStatus = WLANTL_ChangeSTAState( 
+                btampContext->pvosGCtx, 
+                btampContext->ucSTAId, 
+                WLANTL_STA_AUTHENTICATED );
+    }
+
+    btampContext->dataPktPending = VOS_FALSE;
+    vosStatus = WLANBAP_InitLinkSupervision( btampHandle);
+ 
+    /* Inform user space of the AMP channel selected, for AFH purposes */
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW,
+               "Calling send_btc_nlink_msg() with AMP channel %d", btampContext->channel);
+    send_btc_nlink_msg(WLAN_AMP_ASSOC_DONE_IND, btampContext->channel);
+
+    return vosStatus;
+} //gotoConnected 
+
+
+/* the HCI Event signalling routine*/
+VOS_STATUS
+signalHCIPhysLinkCompEvent
+( 
+  ptBtampContext btampContext, /* btampContext value */    
+  v_U8_t status    /* the BT-AMP status */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /* Format the Physical Link Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = status;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle 
+        = btampContext->phy_link_handle;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number 
+        = btampContext->channel;
+
+    if(WLANBAP_STATUS_SUCCESS == status)
+    {
+        /* Start the Tx packet monitoring timer */
+        WLANBAP_StartTxPacketMonitorTimer(btampContext);
+    }
+    else
+    {   //reset the PL handle
+        btampContext->phy_link_handle = 0;
+    }
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         btampContext->pHddHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_TRUE /* Flag to indicate assoc-specific event */ 
+        );
+  
+  return vosStatus;
+} /* signalHCIPhysLinkCompEvent */
+
+/* the HCI Disconnect Complete Event signalling routine*/
+VOS_STATUS
+signalHCIPhysLinkDiscEvent
+( 
+  ptBtampContext btampContext, /* btampContext value */    
+  v_U8_t status,    /* the BT-AMP status */
+  v_U8_t reason    /* the BT-AMP reason code */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    v_U8_t          i;
+    tpBtampLogLinkCtx  pLogLinkContext = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+#ifdef BAP_DEBUG
+  /* Trace the tBtampCtx being passed in. */
+  VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN BAP Context Monitor: btampContext value = %x in %s:%d", btampContext, __FUNCTION__, __LINE__ );
+#endif //BAP_DEBUG
+
+    /* Loop disconnecting all Logical Links on this Physical Link */
+    for (i = 0 ; i < WLANBAP_MAX_LOG_LINKS; i++)
+    {
+        pLogLinkContext = &(btampContext->btampLogLinkCtx[i]);
+
+        if (pLogLinkContext->present == VOS_TRUE) 
+        { 
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+                    "WLAN BAP: Deleting logical link entry %d in %s", i,
+                    __FUNCTION__); 
+
+            /* Mark this Logical Link index value as free */
+            pLogLinkContext->present = VOS_FALSE; 
+
+            // signalHCIDiscLogLink(status = SUCCESS, reason = CONNECTION_TERM_BY_REMOTE_HOST);
+            signalHCIDiscLogLinkCompEvent 
+                ( btampContext, 
+                  WLANBAP_STATUS_SUCCESS, 
+                  i,   // logical link 
+                  // I don't know how to signal CONNECTION_TERM_BY_REMOTE_HOST
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+    }
+
+    /*Reset current_log_link_index and total_log_link_index values*/
+    btampContext->current_log_link_index = 0; 
+    btampContext->total_log_link_index = 0; 
+
+    /* Format the Physical Link Disconnect Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT;
+    bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.present = 1;
+    bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.status = status;
+    bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.reason = reason;//uncommented to debug
+    bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.phy_link_handle 
+        = btampContext->phy_link_handle;
+
+    /* Stop the Tx packet monitoring timer */
+    WLANBAP_StopTxPacketMonitorTimer(btampContext);
+
+    /*Need to clean up the phy link handle as we are disconnected at this 
+      point
+      ?? - do we need to do any more cleanup on this*/
+    btampContext->phy_link_handle = 0; 
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         btampContext->pHddHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_TRUE /* Flag to indicate assoc-specific event */ 
+        );
+  
+  return vosStatus;
+} /* signalHCIPhysLinkDiscEvent */
+
+/* the HCI Channel Select Event signalling routine*/
+VOS_STATUS
+signalHCIChanSelEvent
+( 
+  ptBtampContext btampContext /* btampContext value */    
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /* Format the Physical Link Disconnect Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT;
+    bapHCIEvent.u.btampChannelSelectedEvent.present = 1;
+    bapHCIEvent.u.btampChannelSelectedEvent.phy_link_handle 
+        = btampContext->phy_link_handle;
+ 
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         btampContext->pHddHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_TRUE /* Flag to indicate assoc-specific event */ 
+        );
+
+  return vosStatus;
+} /* signalHCIChanSelEvent */
+
+
+/* the HCI Disconnect Logical Link Complete Event signalling routine*/
+VOS_STATUS
+signalHCIDiscLogLinkCompEvent
+( 
+  ptBtampContext btampContext, /* btampContext value */    
+  v_U8_t status,    /* the BT-AMP status */
+  v_U16_t log_link_handle,  /* The Logical Link that disconnected*/
+  v_U8_t reason    /* the BT-AMP reason code */
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /* Format the Logical Link Disconnect Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT;
+    bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.present = 1;
+    bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.status = status;
+    bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.reason = reason;
+    bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.log_link_handle 
+    = (log_link_handle  << 8) + btampContext->phy_link_handle;
+
+    vosStatus = (*btampContext->pBapHCIEventCB) 
+        (  
+         btampContext->pHddHdl,   /* this refers the BSL per application context */
+         &bapHCIEvent, /* This now encodes ALL event types */
+         VOS_TRUE /* Flag to indicate assoc-specific event */ 
+        );
+  
+  return vosStatus;
+} /* signalHCIDiscLogLinkCompEvent */
+
+ 
+// These are needed to recognize RSN suite types
+#define WLANBAP_RSN_OUI_SIZE 4
+tANI_U8 pRSNOui00[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher
+tANI_U8 pRSNOui01[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN
+tANI_U8 pRSNOui02[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK
+tANI_U8 pRSNOui03[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved
+tANI_U8 pRSNOui04[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP
+tANI_U8 pRSNOui05[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104
+
+#define GET_IE_LEN_IN_BSS(lenInBss) ( lenInBss + sizeof(lenInBss) - ((int) OFFSET_OF( tSirBssDescription, ieFields))) 
+/* Incoming Association indication validation predicate */
+v_U32_t 
+validAssocInd
+( 
+    ptBtampContext btampContext, /* btampContext value */    
+    tCsrRoamInfo *pRoamInfo
+)
+{
+    /* tHalHandle */    
+    tHalHandle hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    v_U32_t ieLen; 
+  
+    /* For now, always return true */ 
+    return VOS_TRUE;
+
+    /* Check for a valid peer MAC address */
+    /* For an incoming Assoc Indication, the peer MAC address
+     * should match the value that the BlueTooth AMP 
+     * configured us with.
+     */
+    if ( !vos_mem_compare( btampContext->peer_mac_addr, 
+                pRoamInfo->peerMac, 
+                           sizeof(btampContext->peer_mac_addr) ))
+    {
+        /* Return not valid */ 
+        return VOS_FALSE;
+    }
+
+    /* JEZ081115: For now, ignore the RSN IE */ 
+    /* Otherwise, it is valid */ 
+    return VOS_TRUE;
+
+    /* Check for a trivial case: IEs missing */
+    if( pRoamInfo->prsnIE == NULL )
+    {
+        //btampContext->ieFields = NULL;
+        //btampContext->ieLen = 0; 
+         /* Return not valid */ 
+        return VOS_FALSE;
+    }
+
+   //btampContext->ieLen = GET_IE_LEN_IN_BSS( pBssDesc->length );
+   //ieLen = GET_IE_LEN_IN_BSS( pBssDesc->length );
+   ieLen = pRoamInfo->rsnIELen;
+ 
+    /* Check for a trivial case: IEs zero length */
+    //if( btampContext->ieLen == 0 )
+    if( ieLen == 0 )
+    {
+        //btampContext->ieFields = NULL;
+        //btampContext->ieLen = 0; 
+         /* Return not valid */ 
+        return VOS_FALSE;
+    }
+
+    {
+        // ---  Start of block ---
+    tDot11fBeaconIEs dot11BeaconIEs; 
+    tDot11fIESSID *pDot11SSID;
+    tDot11fIERSN  *pDot11RSN;
+ 
+    // JEZ081215: This really needs to be updated to just validate the RSN IE.
+    // Validating the SSID can be done directly from...
+ 
+    // "Unpack" really wants tpAniSirGlobal (pMac) as its first param.
+    // But since it isn't used, I just pass in some arbitrary "context" pointer.
+    // So hHalHandle will make it happy.
+    dot11fUnpackBeaconIEs((tpAniSirGlobal) hHal, 
+            (tANI_U8 *) pRoamInfo->prsnIE,
+            ieLen, 
+            &dot11BeaconIEs);
+
+    //DUMPLOG(9,  __FUNCTION__, "dot11BeaconIEs", &dot11BeaconIEs, 64);
+
+    pDot11SSID = &dot11BeaconIEs.SSID; 
+
+    // Assume there wasn't an SSID in the Assoc Request
+    btampContext->assocSsidLen = 0;
+
+        if (pDot11SSID->present )
+        {
+
+        //DUMPLOG(10,  __FUNCTION__, "pDot11SSID present", pDot11SSID, 64);
+
+        btampContext->assocSsidLen = pDot11SSID->num_ssid;  
+        vos_mem_copy(btampContext->assocSsid, 
+                pDot11SSID->ssid, 
+                btampContext->assocSsidLen );
+        }
+        else
+        return VOS_FALSE;
+
+    // Check the validity of the SSID against our SSID value
+    if ( !vos_mem_compare( btampContext->ownSsid, 
+                pDot11SSID->ssid, 
+                               btampContext->ownSsidLen ))
+        {
+        /* Return not valid */ 
+        return VOS_FALSE;
+    }
+
+    pDot11RSN = &dot11BeaconIEs.RSN; 
+
+    // Assume there wasn't an RSN IE in the Assoc Request
+    //btampContext->assocRsnIeLen = 0;
+
+        if (pDot11RSN->present )
+        {
+
+        //DUMPLOG(10,  __FUNCTION__, "pDot11RSN present", pDot11RSN, 64);
+
+        //The 802.11 BT-AMP PAL only supports WPA2-PSK  
+        if (!vos_mem_compare(pRSNOui02, //  RSN-PSK
+                pDot11RSN->akm_suites[0], 
+                WLANBAP_RSN_OUI_SIZE)) 
+            return VOS_FALSE;
+
+        //The 802.11 BT-AMP PAL only supports AES-CCMP Unicast  
+        if (!vos_mem_compare(pRSNOui04, // AES-CCMP
+                pDot11RSN->pwise_cipher_suites[0], 
+                WLANBAP_RSN_OUI_SIZE)) 
+            return VOS_FALSE;
+        }
+        else
+        return VOS_FALSE;
+
+
+    } // --- End of block ---
+
+    /* Otherwise, it is valid */ 
+    return VOS_TRUE;
+} /* validAssocInd */
+
+/* the change state function*/
+void 
+btampfsmChangeToState
+(
+    BTAMPFSM_INSTANCEDATA_T *instance, 
+    BTAMPFSM_STATES_T state
+)
+{
+    instance->stateVar = state;
+    //BTAMPFSM_ENTRY_FLAG_T disconnectedEntry;
+  
+}
+
+/* Physical Link state machine function */
+//int 
+VOS_STATUS
+btampFsm
+(
+    //BTAMPFSM_INSTANCEDATA_T *instanceVar
+    ptBtampContext btampContext, /* btampContext value */    
+//    tBtampSessCtx *tpBtampSessCtx,  /* btampContext value */
+    ptWLAN_BAPEvent bapEvent, /* State machine event */
+    v_U8_t *status    /* return the BT-AMP status here */
+)
+{
+    /* Retrieve the phy link state machine structure 
+     * from the btampContext value 
+     */    
+    BTAMPFSM_INSTANCEDATA_T *instanceVar;
+    v_U32_t msg = bapEvent->event;  /* State machine input event message */
+    v_U32_t channel;  /* Current channel */
+    v_U32_t activeFlag;  /* Channel active flag */
+    VOS_STATUS      vosStatus = VOS_STATUS_SUCCESS;
+    ptBtampHandle btampHandle = ( ptBtampHandle)btampContext;
+    v_U8_t                   ucSTAId;  /* The StaId (used by TL, PE, and HAL) */
+    v_PVOID_t                pHddHdl; /* Handle to return BSL context in */
+    tHalHandle     hHal = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    /* Validate params */ 
+    if (btampHandle == NULL) 
+    {
+      return VOS_STATUS_E_FAULT;
+    }
+    instanceVar = &(btampContext->bapPhysLinkMachine);
+
+    hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
+    if (NULL == hHal) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "hHal is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+    }
+
+
+ 
+#define CHANNEL_NOT_SELECTED (WLANBAP_GetCurrentChannel (btampContext, &channel, &activeFlag) != VOS_STATUS_SUCCESS)
+
+  /*Initialize BTAMP PAL status code being returned to the btampFsm caller */
+  *status = WLANBAP_STATUS_SUCCESS;
+
+    switch(instanceVar->stateVar)
+    {
+
+      case DISCONNECTED:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE))
+        {
+          /*Transition from DISCONNECTED to S1 (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "DISCONNECTED", "S1");
+ 
+#if 0
+         /* This will have issues in multisession. Need not close the session */
+         /* TODO : Need to have better handling */ 
+          if(btampContext->isBapSessionOpen == TRUE)//We want to close only BT-AMP Session
+          {
+          sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx),
+                                         btampContext->sessionId);
+          /*Added by Luiza:*/
+          btampContext->isBapSessionOpen = FALSE; 
+          }   
+#endif
+
+          /* Set BAP device role */
+          vosStatus = gotoS1( btampContext, bapEvent, BT_INITIATOR, status); 
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, cmd status is %d", __FUNCTION__, *status);
+           /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,S1);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT))
+        {
+          /*Transition from DISCONNECTED to S1 (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "DISCONNECTED", "S1");
+          
+#if 0
+          if(btampContext->isBapSessionOpen == TRUE)
+          {
+          sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx),
+                                         btampContext->sessionId);
+          /*Added by Luiza:*/
+          btampContext->isBapSessionOpen = FALSE; 
+          }
+          /*Action code for transition */
+#endif
+
+          /* Set BAP device role */
+          vosStatus = gotoS1(btampContext, bapEvent, BT_RESPONDER, status);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,S1);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "DISCONNECTED", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case S1:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC
+           ) && (btampContext->BAPDeviceRole == BT_INITIATOR && !(CHANNEL_NOT_SELECTED)))
+        {
+          /*Transition from S1 to STARTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "S1", "STARTING");
+
+          /*Action code for transition */
+          vosStatus = determineChan(btampContext, BT_INITIATOR, &channel, status);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,STARTING);
+          // This has to be commented out until I get the BT-AMP SME/CSR changes 
+          vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_AP, status); 
+          if (VOS_STATUS_SUCCESS != vosStatus)
+          {
+              btampfsmChangeToState(instanceVar, S1);
+          }
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from S1 to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "S1", "DISCONNECTED");
+
+          /*Action code for transition */
+          /* Set everything back as dis-connected */    
+          gotoDisconnected( btampContext); 
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+          /*Signal the disconnect */
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_TIMEOUT);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from S1 to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "S1", "DISCONNECTED");
+
+          /*Action code for transition */
+          gotoDisconnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+          /*Signal the successful physical link disconnect */
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Signal the unsuccessful physical link creation */
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_NO_CNCT );
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC
+                ) && (btampContext->BAPDeviceRole == BT_RESPONDER))
+        {
+          /*Transition from S1 to STARTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "S1", "STARTING");
+
+          /*Action code for transition */
+          //determineChan(BT_RESPONDER);
+          vosStatus = determineChan(btampContext, BT_RESPONDER, &channel, status);
+          btampfsmChangeToState(instanceVar,STARTING);//Moved to here to debug
+          // This has to be commented out until I get the BT-AMP SME/CSR changes 
+          /*Advance outer statevar */
+         // btampfsmChangeToState(instanceVar,STARTING);
+          vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_STA, status); 
+          if (VOS_STATUS_SUCCESS != vosStatus)
+          {
+              btampfsmChangeToState(instanceVar, S1);
+          }
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC
+                ) && (btampContext->BAPDeviceRole == BT_INITIATOR && CHANNEL_NOT_SELECTED))
+        {
+          /*Transition from S1 to SCANNING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "S1", "SCANNING");
+
+          /*Action code for transition */
+          gotoScanning(btampContext, BT_RESPONDER, status);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,SCANNING);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "S1", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case STARTING:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_BSS_SUCCESS
+           ) && (btampContext->BAPDeviceRole == BT_INITIATOR))
+        {
+          /*Transition from STARTING to CONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "CONNECTING");
+
+          btampfsmChangeToState(instanceVar,CONNECTING);//Moved to debug
+
+          /*Set the selected channel */
+  /*should have been already set */
+          btampContext->channel = ( 0 == btampContext->channel )?1:btampContext->channel;
+
+          /*Action code for transition */
+          signalHCIChanSelEvent(btampContext);
+        
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from STARTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  // Danlin, where are the richer reason codes?
+                  // I want to be able to convey everything 802.11 supports...
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_NO_CNCT, 
+                  //VOS_TRUE,   // Should be VOS_FALSE !!! 
+                  VOS_FALSE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+          // It is NOT clear that we need to send the Phy Link Disconnect
+          // Complete Event here.
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_CHANNEL_SELECTION_FAILED))
+        {
+          /*Transition from STARTING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "DISCONNECTED");
+
+          gotoDisconnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+          /*Action code for transition */
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_REJ_RESOURCES );
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_BSS_SUCCESS
+                ) && (btampContext->BAPDeviceRole == BT_RESPONDER))
+        {
+          /*Transition from STARTING to CONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "CONNECTING");
+
+          /* Set the selected channel */
+          /*should have been already set */
+          btampContext->channel = ( 0 == btampContext->channel )?1:btampContext->channel;
+
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,CONNECTING);
+          /*Action code for transition */
+            gotoConnecting(btampContext);
+          
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from STARTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext, 
+                  VOS_TRUE,
+                  WLANBAP_ERROR_HOST_TIMEOUT, 
+                  VOS_FALSE,
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_FAILS))
+        {
+          /*Transition from STARTING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "STARTING", "DISCONNECTED");
+
+          /*Action code for transition */
+          gotoDisconnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_MAX_NUM_CNCTS );
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "STARTING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case CONNECTING:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_COMPLETED
+           ) && (btampContext->BAPDeviceRole == BT_RESPONDER))
+        {
+          /*Transition from CONNECTING to AUTHENTICATING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "AUTHENTICATING");
+          //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "CONNECTED");
+
+            gotoAuthenticating(btampContext);
+          /*Action code for transition */
+          initRsnSupplicant(btampContext, BT_RESPONDER);
+#if 1
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,AUTHENTICATING);
+#else
+          /*Action code for transition */
+          signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS);
+          gotoConnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,CONNECTED);
+#endif
+          /* register our STA with TL */
+          regStaWithTl ( 
+                  btampContext, /* btampContext value */ 
+                  BT_RESPONDER, 
+                  (tCsrRoamInfo *)bapEvent->params);
+
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from CONNECTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_NO_CNCT, 
+                  //VOS_TRUE,   // Should be VOS_FALSE !!! 
+                  VOS_FALSE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+          // It is NOT clear that we need to send the Phy Link Disconnect
+          // Complete Event here.
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_INDICATION
+        //) && (bssDesc indicates an invalid peer MAC Addr or SecParam)){
+                ) && !validAssocInd(btampContext, (tCsrRoamInfo *)bapEvent->params))
+        {
+          /*Transition from CONNECTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "DISCONNECTING");
+          /*Action code for transition */
+          //csrRoamDisconnect(DEAUTH);
+          //JEZ081120: Danlin points out that I could just ignore this
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_DEAUTH);
+                  //eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_AUTHENT_FAILURE, 
+                  VOS_FALSE, 
+                  0);
+
+          /*Set the status code being returned to the btampFsm caller */
+          *status = WLANBAP_ERROR_AUTHENT_FAILURE;
+
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_INDICATION
+        //) && (bssDesc indicates a valid MAC Addr and SecParam)){
+                ) && validAssocInd(btampContext, (tCsrRoamInfo *)bapEvent->params))
+        {
+          /*Transition from CONNECTING to VALIDATED (both without substates)*/
+          //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "VALIDATED");
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "AUTHENTICATING");
+          //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "CONNECTED");
+
+          /*Action code for transition */
+          // JEZ081027: This one is a pain.  Since we are responding in the
+          // callback itself.  This messes up my state machine.
+          //csrRoamAccept();
+
+          // No!  This is fine. 
+          /*Set the status code being returned to the btampFsm caller */
+          *status = WLANBAP_STATUS_SUCCESS;
+
+          /* JEZ081215: N.B.: Currently, I don't get the 
+           * eCSR_ROAM_RESULT_WDS_ASSOCIATED as an AP.
+           * So, I have to register with TL, here. This 
+           * seems weird.
+           */
+
+          /* register our STA with TL */
+          regStaWithTl ( 
+                  btampContext, /* btampContext value */ 
+                  BT_INITIATOR, 
+                  (tCsrRoamInfo *)bapEvent->params );
+          
+            gotoAuthenticating(btampContext);
+          /*Action code for transition */
+          initRsnAuthenticator(btampContext, BT_INITIATOR);
+
+#if 1
+          /*Advance outer statevar */
+          //btampfsmChangeToState(instanceVar,VALIDATED);
+          btampfsmChangeToState(instanceVar,AUTHENTICATING);
+#else
+          /*Action code for transition */
+          signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS);
+          gotoConnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,CONNECTED);
+#endif
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_FAILED))
+        {
+          /*Transition from CONNECTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "DISCONNECTING");
+
+          /*Action code for transition */
+            sme_RoamDisconnect(hHal,
+                               btampContext->sessionId,
+                               eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          /* Section 3.1.8 and section 3.1.9 have contradictory semantics for 0x16. 
+           * 3.1.8 is "connection terminated by local host". 3.1.9 is "failed connection".  
+           */
+          //gotoDisconnecting(FAILED_CONNECTION);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST, //FAILED_CONNECTION
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from CONNECTING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_HOST_TIMEOUT,
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "CONNECTING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case AUTHENTICATING:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_SUCCESS
+           ) && (btampContext->BAPDeviceRole == BT_RESPONDER))
+        {
+          /*Transition from AUTHENTICATING to KEYING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "AUTHENTICATING", "KEYING");
+
+          /*Action code for transition */
+          //sme_RoamSetContext(); 
+#if 0
+          sme_RoamSetKey(
+                  VOS_GET_HAL_CB(btampContext->pvosGCtx), 
+                  btampContext->sessionId, 
+                  tSirMacAddr peerBssId, 
+                  eCsrEncryptionType encryptType,
+                  tANI_U16 keyLength, 
+                  tANI_U8 *pKey,
+                  VOS_TRUE,   // TRUE 
+                  tANI_U8 paeRole);
+#endif //0
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,KEYING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_SUCCESS
+                ) && (btampContext->BAPDeviceRole == BT_INITIATOR))
+        {
+          /*Transition from AUTHENTICATING to KEYING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "AUTHENTICATING", "KEYING");
+
+          /*Action code for transition */
+          //sme_RoamSetContext(); 
+#if 0
+          sme_RoamSetKey(
+                  VOS_GET_HAL_CB(btampContext->pvosGCtx), 
+                  btampContext->sessionId, 
+                  tSirMacAddr peerBssId, 
+                  eCsrEncryptionType encryptType,
+                  tANI_U16 keyLength, 
+                  tANI_U8 *pKey,
+                  VOS_TRUE,   // TRUE 
+                  tANI_U8 paeRole);
+#endif //0
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,KEYING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s ConnectAcceptTimeout", __FUNCTION__, "AUTHENTICATING", "DISCONNECTING");
+
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_HOST_TIMEOUT,
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+          /*Action code for transition */
+         sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+         
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s Physicallink Disconnect", __FUNCTION__, "AUTHENTICATING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_NO_CNCT,
+                  //VOS_TRUE,   // Should be VOS_FALSE !!! 
+                  VOS_FALSE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+          // It is NOT clear that we need to send the Phy Link Disconnect
+          // Complete Event here.
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_FAILURE))
+        {
+          /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s RSN Failure", __FUNCTION__, "AUTHENTICATING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect(DEAUTH);
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_DEAUTH);
+                  //eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_AUTHENT_FAILURE, 
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "AUTHENTICATING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case CONNECTED:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from CONNECTED to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTED", "DISCONNECTING");
+
+            gotoDisconnecting(
+                  btampContext,
+                  VOS_FALSE, 
+                  0, 
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+
+          WLANBAP_DeInitLinkSupervision(( ptBtampHandle)btampContext);
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION))
+        {
+
+          /*Transition from CONNECTED to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "CONNECTED", "DISCONNECTING");
+          WLANBAP_DeInitLinkSupervision(( ptBtampHandle)btampContext);
+
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_FALSE, 
+                  0, 
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+            /*Action code for transition */
+            sme_RoamDisconnect(hHal,
+                               btampContext->sessionId,
+                               eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "CONNECTED", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+/* JEZ081107: This will only work if I have already signalled the disconnect complete
+ * event in every case where a physical link complete event is required. And a
+ * disconnect was requested.
+ *      - - -
+ * And only if I check for gNeedPhysLinkCompEvent BEFORE I check gDiscRequested.
+ * Naw! Not necessary.
+ */
+      case DISCONNECTING:
+         VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Entered DISCONNECTING:", __FUNCTION__);//Debug statement
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_READY_FOR_CONNECTIONS
+           ) && (btampContext->gDiscRequested == VOS_TRUE))
+        {
+          /*Transition from DISCONNECTING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "DISCONNECTING", "DISCONNECTED");
+
+    //Clear gDiscRequested;
+    btampContext->gDiscRequested = VOS_FALSE;
+           
+    if(btampContext->BAPDeviceRole == BT_INITIATOR) 
+          {
+                if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&btampContext->bapLock)))
+                {
+                   VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Get LOCK Fail");
+                }
+              authRsnFsmFree(btampContext);
+                if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&btampContext->bapLock)))
+                {
+                   VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Release LOCK Fail");
+                }
+          }
+          else if(btampContext->BAPDeviceRole == BT_RESPONDER)
+          {
+              suppRsnFsmFree(btampContext);
+          }
+
+          /* Lookup the StaId using the phy_link_handle and the BAP context */ 
+          vosStatus = WLANBAP_GetStaIdFromLinkCtx ( 
+                    btampHandle,  /* btampHandle value in  */ 
+                    btampContext->phy_link_handle,  /* phy_link_handle value in */
+                    &ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+                    &pHddHdl); /* Handle to return BSL context */
+          if ( VOS_STATUS_SUCCESS != vosStatus ) 
+          {
+              VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                          "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __FUNCTION__);
+              return VOS_STATUS_E_FAULT;
+          }
+          WLANTL_ClearSTAClient(btampContext->pvosGCtx, ucSTAId);
+
+    //      gotoDisconnected(btampContext);
+
+      //    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:In DISCONNECTING-changing outer state var to DISCONNECTED", __FUNCTION__);
+          /*Advance outer statevar */
+        //  btampfsmChangeToState(instanceVar,DISCONNECTED);
+
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                btampContext->gDiscReason);
+          /*sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx),
+                                         btampContext->sessionId);*/
+          /*Action code for transition */
+          gotoDisconnected(btampContext);
+
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:In DISCONNECTING-changing outer state var to DISCONNECTED", __FUNCTION__);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_READY_FOR_CONNECTIONS
+                ) && (btampContext->gNeedPhysLinkCompEvent == VOS_TRUE))
+        {
+          /*Transition from DISCONNECTING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s gNeedPhysLinkComp TRUE", __FUNCTION__, "DISCONNECTING", "DISCONNECTED");
+          if(btampContext->BAPDeviceRole == BT_INITIATOR) 
+          {
+              if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&btampContext->bapLock)))
+              {
+                  VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Get LOCK Fail");
+              }
+              authRsnFsmFree(btampContext);
+              if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&btampContext->bapLock)))
+              {
+                  VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Release LOCK Fail");
+              }
+
+          }
+          else if(btampContext->BAPDeviceRole == BT_RESPONDER)
+          {
+              suppRsnFsmFree(btampContext);
+          }
+          /* Lookup the StaId using the phy_link_handle and the BAP context */ 
+          vosStatus = WLANBAP_GetStaIdFromLinkCtx ( 
+                    btampHandle,  /* btampHandle value in  */ 
+                    btampContext->phy_link_handle,  /* phy_link_handle value in */
+                    &ucSTAId,  /* The StaId (used by TL, PE, and HAL) */
+                    &pHddHdl); /* Handle to return BSL context */
+          if ( VOS_STATUS_SUCCESS != vosStatus ) 
+          {
+              VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                          "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __FUNCTION__);
+              return VOS_STATUS_E_FAULT;
+          }
+          WLANTL_ClearSTAClient(btampContext->pvosGCtx, ucSTAId);
+
+
+          /*Action code for transition */
+         // signalHCIPhysLinkCompEvent(btampContext, WLANBAP_ERROR_NO_CNCT/*btampContext->gPhysLinkStatus*/);
+          signalHCIPhysLinkCompEvent(btampContext, btampContext->gPhysLinkStatus);
+          gotoDisconnected(btampContext);
+          /*sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx),
+                                         btampContext->sessionId);*/
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+         // signalHCIPhysLinkCompEvent(btampContext, btampContext->gPhysLinkStatus);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "DISCONNECTING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case KEYING:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from KEYING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "KEYING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_HOST_TIMEOUT,
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from KEYING to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "KEYING", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_NO_CNCT,
+                  //VOS_TRUE,   // Should be VOS_FALSE !!! 
+                  VOS_FALSE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+
+          // It is NOT clear that we need to send the Phy Link Disconnect
+          // Complete Event here.
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_KEY_SET_SUCCESS))
+        {
+          /*Transition from KEYING to CONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "KEYING", "CONNECTED");
+
+          /*Action code for transition */
+          gotoConnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,CONNECTED);
+          signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "KEYING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case SCANNING:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_SCAN_COMPLETE))
+        {
+          /*Transition from SCANNING to STARTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "SCANNING", "STARTING");
+
+          /*Action code for transition */
+          vosStatus = determineChan(btampContext, BT_INITIATOR, &channel, status);
+          // This has to be commented out until I get the BT-AMP SME/CSR changes 
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,STARTING);
+          vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_AP, status); 
+          if (VOS_STATUS_SUCCESS != vosStatus)
+          {
+              btampfsmChangeToState(instanceVar, SCANNING);
+          }
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from SCANNING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "SCANNING", "DISCONNECTED");
+
+          /*Action code for transition */
+          gotoDisconnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_TIMEOUT);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from SCANNING to DISCONNECTED (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "SCANNING", "DISCONNECTED");
+
+          /*Action code for transition */
+          gotoDisconnected(btampContext);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTED);
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_NO_CNCT);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "SCANNING", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      case VALIDATED:
+        if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_COMPLETED
+           ) && (btampContext->BAPDeviceRole == BT_INITIATOR))
+        {
+          /*Transition from VALIDATED to AUTHENTICATING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "VALIDATED", "AUTHENTICATING");
+
+            gotoAuthenticating(btampContext);
+          /*Action code for transition */
+          initRsnAuthenticator(btampContext, BT_INITIATOR);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,AUTHENTICATING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT))
+        {
+          /*Transition from VALIDATED to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "VALIDATED", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_HOST_TIMEOUT,
+                  VOS_FALSE, 
+                  0);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+        }
+        else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT))
+        {
+          /*Transition from VALIDATED to DISCONNECTING (both without substates)*/
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __FUNCTION__, "VALIDATED", "DISCONNECTING");
+
+          /*Action code for transition */
+          //csrRoamDisconnect();
+          sme_RoamDisconnect(hHal, 
+                  //JEZ081115: Fixme 
+                  btampContext->sessionId, 
+                  eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+          gotoDisconnecting(
+                  btampContext,
+                  VOS_TRUE, 
+                  WLANBAP_ERROR_NO_CNCT,
+                  //VOS_TRUE,   // Should be VOS_FALSE !!! 
+                  VOS_FALSE, 
+                  WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+          /*Advance outer statevar */
+          btampfsmChangeToState(instanceVar,DISCONNECTING);
+
+          // It is NOT clear that we need to send the Phy Link Disconnect
+          // Complete Event here.
+          signalHCIPhysLinkDiscEvent 
+              ( btampContext, 
+                WLANBAP_STATUS_SUCCESS,
+                WLANBAP_ERROR_TERM_BY_LOCAL_HOST);
+        }
+        else
+        {
+          VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __FUNCTION__, "VALIDATED", msg);
+          /* Intentionally left blank */
+        }
+      break;
+
+      default:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, invalid state %d", __FUNCTION__, instanceVar->stateVar);
+        /*Intentionally left blank*/
+      break;
+  }
+
+  return vosStatus;
+}
+
+VOS_STATUS btampEstablishLogLink(ptBtampContext btampContext)
+{  
+   VOS_STATUS      vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t       msg;
+
+   tAniBtAmpLogLinkReq *pMsg;
+
+   pMsg = vos_mem_malloc(sizeof(tAniBtAmpLogLinkReq));
+   if ( NULL == pMsg ) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, failed to allocate mem for req", __FUNCTION__);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_BTAMP_LOG_LINK_IND);
+   pMsg->msgLen = (tANI_U16)sizeof(tAniBtAmpLogLinkReq);
+   pMsg->sessionId = btampContext->sessionId;
+   pMsg->btampHandle = btampContext;
+
+   msg.type = eWNI_SME_BTAMP_LOG_LINK_IND;
+   msg.bodyptr = pMsg;
+   msg.reserved = 0;
+
+   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
+   {
+       VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, failed to post msg to self", __FUNCTION__);
+       vos_mem_free(pMsg);
+       vosStatus = VOS_STATUS_E_FAILURE;
+   }
+   return vosStatus;
+}
+
+void btampEstablishLogLinkHdlr(void* pMsg)
+{
+    tAniBtAmpLogLinkReq *pBtAmpLogLinkReq = (tAniBtAmpLogLinkReq*)pMsg;
+    ptBtampContext btampContext;
+
+    if(pBtAmpLogLinkReq)
+    {
+        btampContext = (ptBtampContext)pBtAmpLogLinkReq->btampHandle;
+        if(NULL != btampContext)
+        {
+            vos_sleep( 200 );
+            WLAN_BAPEstablishLogicalLink(btampContext);
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, btampContext is NULL", __FUNCTION__);                  
+            return;
+        }
+            
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, pBtAmpLogLinkReq is NULL", __FUNCTION__);    
+    }
+    return;
+}
+
diff --git a/CORE/BAP/src/btampFsm.h b/CORE/BAP/src/btampFsm.h
new file mode 100644
index 0000000..d03c511
--- /dev/null
+++ b/CORE/BAP/src/btampFsm.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) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
+ */
+
+/* This file is generated from btampFsm - do not edit manually*/
+/* Generated on: Thu Oct 16 15:40:39 PDT 2008 / version 1.2 Beta 1 */
+
+
+#ifndef __BTAMPFSM_H__
+#define __BTAMPFSM_H__
+
+#include "bapRsn8021xFsm.h"
+
+/* State definitions */
+typedef enum
+{
+    AUTHENTICATING,
+    DISCONNECTED,
+    CONNECTING,
+    DISCONNECTING,
+    SCANNING,
+    CONNECTED,
+    S1,
+    KEYING,
+    VALIDATED,
+    STARTING,
+} BTAMPFSM_STATES_T;
+
+
+#if 0
+/* Instance data definition of state machine */
+typedef struct
+{
+    BTAMPFSM_ENTRY_FLAG_T disconnectedEntry;
+    BTAMPFSM_STATEVAR_T stateVar;
+    BTAMPFSM_INST_ID_T inst_id;
+} BTAMPFSM_INSTANCEDATA_T;
+#endif //0
+
+/* Helper to initialize the machine's instance data */
+#define BTAMPFSM_INSTANCEDATA_INIT {  1,  DISCONNECTED/* set init state */,  0 /* instance id */};
+
+/*Prototype for the change state function*/
+void btampfsmChangeToState(BTAMPFSM_INSTANCEDATA_T *instance, BTAMPFSM_STATES_T state);
+
+
+
+/*Prototype of the state machine function */
+//int
+VOS_STATUS
+btampFsm
+(
+    //BTAMPFSM_INSTANCEDATA_T *instanceVar
+    ptBtampContext btampContext, /* btampContext value */
+//    tBtampSessCtx *tpBtampSessCtx,  /* btampContext value */
+    ptWLAN_BAPEvent bapEvent, /* State machine event */
+    v_U8_t *status    /* return the BT-AMP status here */
+);
+
+VOS_STATUS
+bapSetKey( v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo );
+
+int bapSuppDisconnect(tBtampContext *ctx);
+int bapAuthDisconnect(tBtampContext *ctx);
+VOS_STATUS btampEstablishLogLink(ptBtampContext btampContext);
+#endif
diff --git a/CORE/BAP/src/btampFsm_ext.h b/CORE/BAP/src/btampFsm_ext.h
new file mode 100644
index 0000000..4570825
--- /dev/null
+++ b/CORE/BAP/src/btampFsm_ext.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.
+ */
+
+/*
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary 
+ */
+
+/* This file is generated from btampFsm.cdd - do not edit manually*/
+/* Generated on: Thu Oct 16 15:40:39 PDT 2008 */
+
+
+#ifndef __BTAMPFSM_EXT_H__
+#define __BTAMPFSM_EXT_H__
+
+/* Events that can be sent to the state-machine */
+typedef enum
+{
+  eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT=0U,
+  eWLAN_BAP_MAC_CONNECT_COMPLETED
+,
+  eWLAN_BAP_CHANNEL_SELECTION_FAILED,
+  eWLAN_BAP_MAC_CONNECT_FAILED,
+  eWLAN_BAP_MAC_CONNECT_INDICATION
+,
+  eWLAN_BAP_MAC_KEY_SET_SUCCESS,
+  eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT,
+  eWLAN_BAP_RSN_FAILURE,
+  eWLAN_BAP_MAC_SCAN_COMPLETE,
+  eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE,
+  eWLAN_BAP_MAC_READY_FOR_CONNECTIONS
+,
+  eWLAN_BAP_MAC_START_BSS_SUCCESS
+,
+  eWLAN_BAP_RSN_SUCCESS,
+  eWLAN_BAP_MAC_START_FAILS,
+  eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT,
+  eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION,
+  eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC
+,
+  NO_MSG
+}MESSAGE_T;
+
+
+#endif
diff --git a/CORE/BAP/src/btampHCI.c b/CORE/BAP/src/btampHCI.c
new file mode 100644
index 0000000..a16f926
--- /dev/null
+++ b/CORE/BAP/src/btampHCI.c
@@ -0,0 +1,9316 @@
+/*
+ * 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 btampHCI.c
+  *
+  * \brief Structures, functions & definitions for
+  * working with 802.11 Frames
+  *
+  *
+  * Copyright (C) 2009 Airgo Networks, Incorporated.
+  *
+  *
+  * This file was automatically generated by 'framesc'
+  * Fri Feb 27 17:29:19 2009 from the following file(s):
+  *
+  * btampHCI.frms
+  * 
+  * PLEASE DON'T EDIT THIS FILE BY HAND!
+  *
+  *
+  */
+
+#ifndef ANI_OS_TYPE_OSX
+#include <memory.h> /* For memcpy */
+//#include <stdio.h>  /* For _vsnprintf */
+#include <stddef.h> /* For offsetof */
+#endif
+
+#define _vsnprintf vsnprintf
+
+#include "vos_api.h"
+#include "btampHCI.h"
+
+#if defined ( _MSC_VER )
+#   pragma warning (disable: 4244)
+#   pragma warning (disable: 4505)
+#   pragma warning (disable: 4702)
+#   pragma warning (disable: 4996) /* ... was declared deprecated */
+#endif /* Microsoft C/C++ */
+
+/*Length of the value field expected in a TLV of type Connected Channel in an 
+ AMP Assoc*/
+#define WLAN_BAP_PAL_AMP_ASSOC_CONN_CH_TLV_MIN_LEN    3
+
+/*Length of the value field expected in a TLV of type Prefered Channel in an 
+ AMP Assoc*/
+#define WLAN_BAP_PAL_AMP_ASSOC_PREF_CH_TLV_MIN_LEN    3
+
+/*Length of the value field expected in a TLV of type MAC Address*/
+#define WLAN_BAP_PAL_MAC_ADDR_TLV_LEN                 6
+
+/*Length of the value field expected in a TLV of type Capabilities*/
+#define WLAN_BAP_PAL_CAPABILITIES_TLV_LEN             4
+
+/*Length of the value field expected in a TLV of type Version*/
+#define WLAN_BAP_PAL_VERSION_TLV_LEN             5
+
+/*Length of the value field expected in a TLV of type Accept Phy Link*/
+#define WLAN_BAP_PAL_ACC_PHY_LINK_TLV_MIN_LEN               3
+
+/*Length of the value field expected in a TLV of type Accept Log Link*/
+#define WLAN_BAP_PAL_ACC_LOG_LINK_TLV_LEN                  37
+
+/*Length of the value field expected in a TLV of type Create Log Link*/
+#define WLAN_BAP_PAL_CREATE_LOG_LINK_TLV_LEN               37
+
+/*Length of the value field expected in a TLV of type Create Phy Link*/
+#define WLAN_BAP_PAL_CREATE_PHY_LINK_TLV_MIN_LEN            3
+
+/*Length of the value field expected in a TLV of type Disconnect Log Link*/
+#define WLAN_BAP_PAL_DISC_LOG_LINK_TLV_LEN                  2
+
+/*Length of the value field expected in a TLV of type Disconnect Phy Link*/
+#define WLAN_BAP_PAL_DISC_PHY_LINK_TLV_LEN                  2
+
+/*Length of the value field expected in a TLV of type Flow Spec Modify*/
+#define WLAN_BAP_PAL_FLOW_SPEC_MOD_TLV_LEN                 34
+
+/*Length of the value field expected in a TLV of type Flush*/
+#define WLAN_BAP_PAL_FLUSH_TLV_LEN                          2 
+
+/*Length of the value field expected in a TLV of type enhanced Flush*/
+#define WLAN_BAP_PAL_ENHANCED_FLUSH_TLV_LEN                 3 
+
+/*Length of the value field expected in a TLV of type Cancel Log Link*/
+#define WLAN_BAP_PAL_CANCEL_LOG_LINK_TLV_LEN                2
+
+/*Length of the value field expected in a TLV of type Read Best Effort Flush 
+ Timeout*/
+#define WLAN_BAP_PAL_READ_BE_FLUSH_TIMEOUT_TLV_LEN          2
+
+/*Length of the value field expected in a TLV of type Read Failed Contact 
+ Counter*/
+#define WLAN_BAP_PAL_READ_FAILED_CONTACT_CNT_TLV_LEN        2
+
+/*Length of the value field expected in a TLV of type Link Quality*/
+#define WLAN_BAP_PAL_READ_LINK_QUALITY_TLV_LEN              2
+
+/*Length of the value field expected in a TLV of type Read Link Supervision
+  Timeout*/
+#define WLAN_BAP_PAL_READ_LINK_SVISISON_TIMEOUT_TLV_LEN     2
+
+/*Length of the value field expected in a TLV of type Read Local AMP Assoc*/
+#define WLAN_BAP_PAL_READ_LOCAL_AMP_ASSOC_TLV_LEN           5
+
+/*Length of the value field expected in a TLV of type Read RSSI*/
+#define WLAN_BAP_PAL_READ_RSSI_TLV_LEN                      2
+
+/*Length of the value field expected in a TLV of type Reset Failed Contact 
+ Counter*/
+#define WLAN_BAP_PAL_RESET_FAILED_CONTACT_CNT_TLV_LEN       2
+
+/*Length of the value field expected in a TLV of type Set Event Mask*/
+#define WLAN_BAP_PAL_SET_EVENT_MASK_TLV_LEN                 8
+
+/*Length of the value field expected in a TLV of type Set Event Mask2*/
+#define WLAN_BAP_PAL_SET_EVENT_MASK2_TLV_LEN                8
+
+/*Length of the value field expected in a TLV of type Set SHort Range Mode*/
+#define WLAN_BAP_PAL_SET_SHORT_RANGE_MODE_TLV_LEN           2
+
+/*Length of the value field expected in a TLV of type Write Best Effort Flush 
+  Timeout*/
+#define WLAN_BAP_PAL_WRITE_BE_FLUSH_TIMEOUT_TLV_LEN         6
+
+/*Length of the value field expected in a TLV of type Write Connection Accept 
+  Timeout*/
+#define WLAN_BAP_PAL_WRITE_CON_ACC_TIMEOUT_TLV_LEN          2
+
+/*Length of the value field expected in a TLV of type Write Flow Control Mode*/
+#define WLAN_BAP_PAL_WRITE_FLOW_CTRL_MODE_TLV_LEN           1
+
+/*Length of the value field expected in a TLV of type Write Link Supervision
+  Timeout*/
+#define WLAN_BAP_PAL_WRITE_LINK_SVISION_TIMEOUT_TLV_LEN     4
+
+/*Length of the value field expected in a TLV of type Write Location Data*/
+#define WLAN_BAP_PAL_WRITE_LOCATION_DATA_CMD_TLV_LEN        5
+
+/*Length of the value field expected in a TLV of type Write LL Acc Timeout*/
+#define WLAN_BAP_PAL_WRITE_LOG_LINK_ACC_TIMEOUT_TLV_LEN     2
+
+/*Length of the value field expected in a TLV of type Write Loopback Mode*/
+#define WLAN_BAP_PAL_WRITE_LOOOPBACK_MODE_TLV_LEN           1
+
+/*Length of the value field expected in a TLV of type Write Remote AMP Assoc*/
+#define WLAN_BAP_PAL_WRITE_REMOTE_AMP_ASSOC_MIN_TLV_LEN     5 
+
+/* As per AMP specification */
+/* Regulatory Extension Identifier for channel list */
+#define WLAN_BAP_PAL_REG_EXTN_ID_VAL                        201
+
+/* Regulatory Class for channel list */
+#define WLAN_BAP_PAL_REG_CLASS_VAL                          254
+
+/* Coverage ClASS for channel list */
+#define WLAN_BAP_PAL_COVERAGE_CLASS_VAL                     0
+
+
+/* LOGGING and VALIDITY_CHECKING control */
+//#define WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+//#define WLAN_BAPHCI_ENABLE_LOGGING
+
+typedef unsigned char tFRAMES_BOOL;
+typedef void (*pfnGeneric_t)(void);
+
+
+typedef struct sFFDefn {
+    v_U8_t  size;
+    size_t       offset;
+    v_U16_t sig;
+    pfnGeneric_t pfn;
+    const char  *name;
+} tFFDefn;
+
+typedef struct sIEDefn {
+    v_U8_t   eid;
+    v_U16_t  minSize;
+    v_U16_t  maxSize;
+    size_t        offset;
+    size_t        presenceOffset;
+    size_t        countOffset;
+    v_U16_t  arraybound;
+    unsigned char oui[5];
+    unsigned char noui;
+    v_U16_t  sig;
+    pfnGeneric_t  pfn;
+    const char   *name;
+    tFRAMES_BOOL  fMandatory;
+} tIEDefn;
+
+#if !defined(countof)
+#define countof(x) ( sizeof( (x) ) / sizeof( (x)[0] ) )
+#endif
+
+#if ! defined(BTAMP_MEMCPY)
+#   define BTAMP_MEMCPY(ctx, dst, src, len) \
+        memcpy( (dst), (src), (len) )        \
+
+#endif
+
+#if ! defined(BTAMP_MEMCMP)
+#   define BTAMP_MEMCMP(ctx, lhs, rhs, len) \
+        memcmp( (lhs), (rhs), (len) )        \
+
+#endif
+
+#ifndef BTAMP_HAVE_LOG_SEVERITIES
+#   define FRLOG_OFF ( 0 )
+#   define FRLOGP    ( 1 )
+#   define FRLOGE    ( 2 )
+#   define FRLOGW    ( 3 )
+#   define FRLOG1    ( 4 )
+#   define FRLOG2    ( 5 )
+#   define FRLOG3    ( 6 )
+#   define FRLOG4    ( 7 )
+#endif
+
+#define FRFL(x) x
+
+#ifdef BTAMP_ENABLE_LOGGING
+
+#ifndef BTAMP_HAVE_LOG_MACROS
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifndef BTAMP_LOG_GATE
+#   define BTAMP_LOG_GATE FRLOGW
+#endif // BTAMP_LOG_GATE
+
+#ifdef WIN32
+
+#if defined ( _CONSOLE ) || defined ( _WINDOWS ) || defined ( _DLL ) || defined ( _LIB )
+#include <windows.h>
+#define DBGPRINT OutputDebugStringA
+#else  /* Not User mode */
+#define DBGPRINT DbgPrint
+#endif /* User mode */
+
+
+
+static void framesLog(void * pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{
+    va_list val;
+    char buffer[1024];
+    (void)pCtx;
+    if ( nSev <= BTAMP_LOG_GATE )
+    {
+        va_start(val, lpszFormat);
+        _vsnprintf(buffer, 1024, lpszFormat, val);
+        va_end(val);
+        DBGPRINT(buffer);
+    }
+}
+static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf)
+{
+    char buffer[35];
+    int i, offset;
+    pCtx;
+    offset = 0;
+    if ( nSev > BTAMP_LOG_GATE ) return;
+    for (i = 0; i < nBuf/8; ++i)
+    {
+        _snprintf(buffer, 35, "%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7));
+        pBuf += 8; offset += 8;
+        DBGPRINT(buffer);
+    }
+    _snprintf(buffer, 35, "%08x: ", offset);
+    DBGPRINT(buffer);
+    for (i = 0; i < nBuf % 8; ++i)
+    {
+        _snprintf(buffer, 35, "%02x ", *pBuf);
+        ++pBuf;
+        DBGPRINT(buffer);
+    }
+    DBGPRINT("\n");
+}
+
+#elif defined OS_X /* Not WIN32 */
+static void framesLog(void * pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{// To fill in when needed using IOLog
+
+}
+
+static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf)
+{
+}
+
+#elif defined LINUX
+
+static void framesLog(void * pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{
+    va_list marker;
+    (void)pCtx;
+    if ( nSev <= BTAMP_LOG_GATE )
+    {
+        va_start( marker, lpszFormat );
+        vprintf(lpszFormat, marker);
+        va_end( marker );
+    }
+}
+
+static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf)
+{
+    char buffer[35];
+    int i, offset;
+    (void)pCtx;
+    offset = 0;
+    if ( nSev > BTAMP_LOG_GATE ) return;
+    for (i = 0; i < nBuf/8; ++i)
+    {
+        printf("%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7));
+        pBuf += 8; offset += 8;
+    }
+    printf("%08x: ", offset);
+    for (i = 0; i < nBuf % 8; ++i)
+    {
+        printf("%02x ", *pBuf);
+        ++pBuf;
+    }
+    printf("\n");
+}
+
+#endif /* WIN32 */
+
+#define FRAMES_LOG0(ctx, sev, fmt) \
+     framesLog((ctx), (sev), (fmt));
+#define FRAMES_LOG1(ctx, sev, fmt, p1) \
+     framesLog((ctx), (sev), (fmt), (p1));
+#define FRAMES_LOG2(ctx, sev, fmt, p1, p2) \
+     framesLog((ctx), (sev), (fmt), (p1), (p2));
+#define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3) \
+     framesLog((ctx), (sev), (fmt), (p1), (p2), (p3));
+#define FRAMES_DUMP(ctx, sev, p, n) \
+     framesDump((ctx), (sev), (p), (n));
+#ifndef FRAMES_SEV_FOR_FRAME
+#   define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3
+#endif
+
+#endif /* End BTAMP_HAVE_LOG_MACROS */
+
+#else  // ! BTAMP_ENABLE_LOGGING
+#   define FRAMES_LOG0(ctx, sev, fmt)
+#   define FRAMES_LOG1(ctx, sev, fmt, p1)
+#   define FRAMES_LOG2(ctx, sev, fmt, p1, p2)
+#   define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3)
+#   define FRAMES_DUMP(ctx, sev, p, n)
+#   ifndef FRAMES_SEV_FOR_FRAME
+#       define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3
+#   endif
+#endif // BTAMP_ENABLE_LOGGING
+
+#if defined( BTAMP_ENABLE_DBG_BREAK ) && defined ( WIN32 )
+#   define FRAMES_DBG_BREAK() { _asm int 3 }
+#else
+#   define FRAMES_DBG_BREAK()
+#endif
+
+#if ! defined(BTAMP_PARAMETER_CHECK)
+#   if defined (BTAMP_HAVE_WIN32_API)
+
+#       define BTAMP_PARAMETER_CHECK(pBuf, nBuf, pFrm, nFrm) \
+        if (!pBuf || IsBadReadPtr(pBuf, nBuf)) return BTAMP_BAD_INPUT_BUFFER; \
+        if (!pFrm || IsBadWritePtr(pFrm, nFrm)) return BTAMP_BAD_OUTPUT_BUFFER \
+
+#       define BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) \
+        if (!pSrc || IsBadReadPtr(pSrc, 4)) return BTAMP_BAD_INPUT_BUFFER; \
+        if (!pBuf || IsBadWritePtr(pBuf, nBuf)) return BTAMP_BAD_OUTPUT_BUFFER; \
+        if (!nBuf) return BTAMP_BAD_OUTPUT_BUFFER; \
+        if (IsBadWritePtr(pnConsumed, 4)) return BTAMP_BAD_OUTPUT_BUFFER \
+
+#   else
+
+#       define BTAMP_PARAMETER_CHECK(pBuf, nBuf, pFrm, nFrm) \
+        if (!pBuf) return BTAMP_BAD_INPUT_BUFFER; \
+        if (!pFrm) return BTAMP_BAD_OUTPUT_BUFFER \
+
+#       define BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) \
+        if (!pSrc) return BTAMP_BAD_INPUT_BUFFER; \
+        if (!pBuf) return BTAMP_BAD_OUTPUT_BUFFER; \
+        if (!nBuf) return BTAMP_BAD_OUTPUT_BUFFER; \
+        if (!pnConsumed) return BTAMP_BAD_OUTPUT_BUFFER \
+
+#   endif
+#endif
+
+static void framesntohs(void *    pCtx,
+                        v_U16_t *pOut,
+                        v_U8_t  *pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( BTAMP_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        BTAMP_MEMCPY(pCtx, ( v_U16_t* )pOut, pIn, 2);
+    }
+    else
+    {
+        *pOut = ( v_U16_t )( *pIn << 8 ) | *( pIn + 1 );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut = ( v_U16_t )( *pIn | ( *( pIn + 1 ) << 8 ) );
+    }
+    else
+    {
+        BTAMP_MEMCPY(pCtx, ( v_U16_t* )pOut, pIn, 2);
+    }
+#   endif
+}
+
+static void framesntohl(void *    pCtx,
+                        v_U32_t *pOut,
+                        v_U8_t  *pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( BTAMP_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        *pOut = * ( v_U32_t* )pIn;
+    }
+    else
+    {
+        *pOut = ( v_U32_t )( *pIn         << 24 ) |
+                ( *( pIn + 1 ) << 16 ) |
+                ( *( pIn + 2 ) <<  8 ) |
+                ( *( pIn + 3 ) );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut = ( v_U32_t )( *( pIn + 3 ) << 24 ) |
+                                ( *( pIn + 2 ) << 16 ) |
+                                ( *( pIn + 1 ) <<  8 ) |
+                                ( *( pIn ) );
+    }
+    else
+    {
+        *pOut = * ( v_U32_t* )pIn;
+    }
+#   endif
+}
+
+static void frameshtons(void *    pCtx
+,                        v_U8_t  *pOut,
+                        v_U16_t  pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( BTAMP_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        BTAMP_MEMCPY(pCtx, pOut, &pIn, 2);
+    }
+    else
+    {
+        *pOut         = ( pIn & 0xff00 ) >> 8;
+        *( pOut + 1 ) = pIn & 0xff;
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut         = pIn & 0xff;
+        *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
+    }
+    else
+    {
+        BTAMP_MEMCPY(pCtx, pOut, &pIn, 2);
+    }
+#   endif
+}
+
+static void frameshtonl(void *    pCtx,
+                        v_U8_t  *pOut,
+                        v_U32_t  pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( BTAMP_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        BTAMP_MEMCPY(pCtx, pOut, &pIn, 4);
+    }
+    else
+    {
+        *pOut         = ( pIn & 0xff000000 ) >> 24;
+        *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
+        *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >>  8;
+        *( pOut + 3 ) = ( pIn & 0x000000ff );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *( pOut     ) = ( pIn & 0x000000ff );
+        *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >>  8;
+        *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
+        *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
+    }
+    else
+    {
+        BTAMP_MEMCPY(pCtx, pOut, &pIn, 4);
+    }
+#   endif
+}
+
+typedef struct sTLVDefn {
+    v_U32_t   id;
+    v_U32_t   pec;
+    v_U32_t   minSize;
+    v_U32_t   maxSize;
+    size_t         offset;
+    size_t         presenceOffset;
+    v_U16_t   sig;
+    pfnGeneric_t   pfn;
+    const char *   name;
+    v_U8_t    fMandatory;
+} tTLVDefn;
+
+static tTLVDefn* FindTLVDefn( void *    pCtx,
+                              v_U8_t  *pBuf,
+                              v_U32_t  nBuf,
+                              tTLVDefn      TLVs[ ] )
+{
+    tTLVDefn    *pTlv;
+    v_U32_t      sType, sLen;
+    v_U32_t pec;
+    v_U16_t id;
+ 
+    sType = 1;
+    sLen  = 2;
+ 
+    (void)pCtx;
+ 
+    if (sType == 2) 
+        framesntohs( pCtx, &id, pBuf, 2 );
+    else {
+        id = *pBuf;
+    }
+
+    pTlv = &( TLVs[ 0 ] );
+    while ( 0xffff != pTlv->id )
+    {
+        if ( id == pTlv->id )
+        {
+            if ( 0 == pTlv->pec ) return pTlv;
+
+            if( nBuf > 5 )
+            {
+                pec =  ( ( * ( pBuf + 4 ) ) << 16 ) |
+                       ( ( * ( pBuf + 5 ) ) <<  8 ) |
+                           * ( pBuf + 6 );
+                if ( pec == pTlv->pec )
+                {
+                    return pTlv;
+                }
+            }
+        }
+
+        ++pTlv;
+    }
+
+    return NULL;
+}
+
+static v_U32_t UnpackTlvCore( void *   pCtx,
+                                   v_U8_t *pBuf,
+                                   v_U32_t nBuf,
+                                   tTLVDefn     TLVs[ ],
+                                   v_U8_t *pFrm,
+                                   size_t       nFrm );
+static v_U32_t PackTlvCore(void * pCtx,
+                                v_U8_t *pSrc,
+                                v_U8_t *pBuf,
+                                v_U32_t  nBuf,
+                                v_U32_t *pnConsumed,
+                                tTLVDefn  TLVs[],
+                                v_U32_t *pidx);
+static v_U32_t GetPackedSizeTlvCore(void * pCtx,
+                                         v_U8_t *pFrm,
+                                         v_U32_t *pnNeeded,
+                                         tTLVDefn  TLVs[]);
+
+v_U32_t btampUnpackTlvAMP_Assoc_Connected_Channel(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_Connected_Channel *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_AMP_ASSOC_CONN_CH_TLV_MIN_LEN > tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+
+
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->country, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (v_U8_t)3;
+    if ( ! tlvlen )
+    {
+        pDst->num_triplets = 0U;
+        return 0U;
+    }
+    else
+    {
+        /* Maximum of 5 triplets allowed, based on size of triplets definition */
+        if (tlvlen / 3 > 5)
+        {
+            tlvlen = 15;
+        }
+        pDst->num_triplets = (v_U8_t)( tlvlen / 3 );
+
+        BTAMP_MEMCPY(pCtx, pDst->triplets, pBuf, ( tlvlen ) );
+        pBuf += ( tlvlen );
+        tlvlen -= ( tlvlen );
+    }
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvAMP_Assoc_Connected_Channel. */
+
+typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_Connected_Channel_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_Connected_Channel*);
+
+#define SigUnpackTlvAMP_Assoc_Connected_Channel ( 0x0001 )
+
+
+v_U32_t btampUnpackTlvAMP_Assoc_MAC_Addr(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_MAC_Addr *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_MAC_ADDR_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->mac_addr, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (v_U8_t)6;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvAMP_Assoc_MAC_Addr. */
+
+typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_MAC_Addr_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_MAC_Addr*);
+
+#define SigUnpackTlvAMP_Assoc_MAC_Addr ( 0x0002 )
+
+
+v_U32_t btampUnpackTlvAMP_Assoc_PAL_Capabilities(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_PAL_Capabilities *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_CAPABILITIES_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohl(pCtx, &pDst->pal_capabilities, pBuf, 0);
+    pBuf += 4;
+    tlvlen -= (v_U8_t)4;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvAMP_Assoc_PAL_Capabilities. */
+
+typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_PAL_Capabilities_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_PAL_Capabilities*);
+
+#define SigUnpackTlvAMP_Assoc_PAL_Capabilities ( 0x0003 )
+
+
+v_U32_t btampUnpackTlvAMP_Assoc_PAL_Version(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_PAL_Version *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+
+     /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_VERSION_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->pal_version = *pBuf;
+    pBuf += 1;  
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->pal_CompanyID, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohs(pCtx, &pDst->pal_subversion, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvAMP_Assoc_PAL_Version. */
+
+typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_PAL_Version_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_PAL_Version*);
+
+#define SigUnpackTlvAMP_Assoc_PAL_Version ( 0x0004 )
+
+
+v_U32_t btampUnpackTlvAMP_Assoc_Preferred_Channel_List(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_Preferred_Channel_List *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_AMP_ASSOC_PREF_CH_TLV_MIN_LEN > tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    /* Contry String - 3 bytes */
+    BTAMP_MEMCPY(pCtx, pDst->country, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (v_U8_t)3;
+
+    if ( ! tlvlen )
+    {
+        pDst->num_triplets = 0U;
+        return status;
+    }
+    else
+    {
+        /* Maximum of 5 triplets allowed, based on size of triplets definition */
+        if (tlvlen / 3 > 5)
+        {
+            tlvlen = 15;
+        }
+        pDst->num_triplets = (v_U8_t)( tlvlen / 3 );
+
+        BTAMP_MEMCPY(pCtx, pDst->triplets, pBuf, ( tlvlen ) );
+        pBuf += ( tlvlen );
+        tlvlen -= ( tlvlen );
+    }
+    return status;
+} /* End btampUnpackTlvAMP_Assoc_Preferred_Channel_List. */
+
+typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_Preferred_Channel_List_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_Preferred_Channel_List*);
+
+#define SigUnpackTlvAMP_Assoc_Preferred_Channel_List ( 0x0005 )
+
+
+v_U32_t btampUnpackTlvFlow_Spec(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVFlow_Spec *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING 
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->flow_spec_id = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->service_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->max_sdu, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohl(pCtx, &pDst->sdu_inter_arrival, pBuf, 0);
+    pBuf += 4;
+    tlvlen -= (v_U8_t)4;
+    framesntohl(pCtx, &pDst->access_latency, pBuf, 0);
+    pBuf += 4;
+    tlvlen -= (v_U8_t)4;
+    framesntohl(pCtx, &pDst->flush_timeout, pBuf, 0);
+    pBuf += 4;
+    tlvlen -= (v_U8_t)4;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvFlow_Spec. */
+
+typedef v_U32_t (*pfnUnpackTlvFlow_Spec_t)(void *, v_U8_t*, v_U16_t, tBtampTLVFlow_Spec*);
+
+#define SigUnpackTlvFlow_Spec ( 0x0006 )
+
+
+v_U32_t btampUnpackTlvHCI_Accept_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Accept_Logical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+    if ( WLAN_BAP_PAL_ACC_LOG_LINK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+//      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+#endif
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Accept_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Accept_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Accept_Logical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Accept_Logical_Link_Cmd ( 0x0007 )
+
+
+v_U32_t btampUnpackTlvHCI_Accept_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Accept_Physical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_ACC_PHY_LINK_TLV_MIN_LEN > tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->key_length = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->key_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    if (pDst->key_length > 32){
+        pDst->present = 0;
+        return BTAMP_SKIPPED_BAD_IE;
+    }
+
+    BTAMP_MEMCPY(pCtx, pDst->key_material, pBuf, ( pDst->key_length ) );
+    pBuf += ( pDst->key_length );
+    tlvlen -= ( pDst->key_length );
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Accept_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Accept_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Accept_Physical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Accept_Physical_Link_Cmd ( 0x0008 )
+
+
+v_U32_t btampUnpackTlvHCI_Channel_Selected_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Channel_Selected_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Channel_Selected_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Channel_Selected_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Channel_Selected_Event*);
+
+#define SigUnpackTlvHCI_Channel_Selected_Event ( 0x0009 )
+
+
+v_U32_t btampUnpackTlvHCI_Command_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Command_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    pDst->present = 1;
+    pDst->num_hci_command_packets = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->command_opcode, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    switch (pDst->command_opcode)
+    {
+        case 0x0c03:
+            pDst->cc_event.Reset.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c08:
+            pDst->cc_event.Flush.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Flush.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 0x043b:
+            pDst->cc_event.Logical_Link_Cancel.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Logical_Link_Cancel.phy_link_handle = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Logical_Link_Cancel.tx_flow_spec_id = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c05:
+            pDst->cc_event.Set_Event_Mask.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c15:
+            pDst->cc_event.Read_Connection_Accept_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Connection_Accept_TO.connection_accept_timeout, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 0x0c16:
+            pDst->cc_event.Write_Connection_Accept_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c36:
+            pDst->cc_event.Read_Link_Supervision_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Link_Supervision_TO.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Link_Supervision_TO.link_supervision_timeout, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 0x0c37:
+            pDst->cc_event.Write_Link_Supervision_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Write_Link_Supervision_TO.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 0x0c61:
+            pDst->cc_event.Read_Logical_Link_Accept_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 0x0c62:
+            pDst->cc_event.Write_Logical_Link_Accept_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c63:
+            pDst->cc_event.Set_Event_Mask_Page_2.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 0x0c64:
+            pDst->cc_event.Read_Location_Data.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Location_Data.loc_domain_aware = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Location_Data.loc_domain, pBuf, 3);
+            pBuf += 3;
+            tlvlen -= (v_U8_t)3;
+            pDst->cc_event.Read_Location_Data.loc_options = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 3173:
+            pDst->cc_event.Write_Location_Data.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 3174:
+            pDst->cc_event.Read_Flow_Control_Mode.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Flow_Control_Mode.flow_control_mode = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 3175:
+            pDst->cc_event.Write_Flow_Control_Mode.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 3177:
+            pDst->cc_event.Read_BE_Flush_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohl(pCtx, &pDst->cc_event.Read_BE_Flush_TO.best_effort_flush_timeout, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+        break;
+        case 3178:
+            pDst->cc_event.Write_BE_Flush_TO.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 3179:
+            pDst->cc_event.Set_Short_Range_Mode.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 4097:
+            pDst->cc_event.Read_Local_Version_Info.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Local_Version_Info.HC_HCI_Version = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_HCI_Revision, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            pDst->cc_event.Read_Local_Version_Info.HC_PAL_Version = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_Manufac_Name, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 4098:
+            pDst->cc_event.Read_Local_Supported_Cmds.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds, pBuf, 64);
+            pBuf += 64;
+            tlvlen -= (v_U8_t)64;
+        break;
+        case 4101:
+            pDst->cc_event.Read_Buffer_Size.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            pDst->cc_event.Read_Buffer_Size.HC_SCO_Packet_Length = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 4106:
+            pDst->cc_event.Read_Data_Block_Size.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Data_Block_Length, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 5121:
+            pDst->cc_event.Read_Failed_Contact_Counter.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Failed_Contact_Counter.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Failed_Contact_Counter.failed_contact_counter, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 5122:
+            pDst->cc_event.Reset_Failed_Contact_Counter.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Reset_Failed_Contact_Counter.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+        break;
+        case 5123:
+            pDst->cc_event.Read_Link_Quality.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Link_Quality.log_link_handle, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            pDst->cc_event.Read_Link_Quality.link_quality = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 5125:
+            pDst->cc_event.Read_RSSI.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_RSSI.phy_link_handle = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_RSSI.rssi = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 5129:
+            pDst->cc_event.Read_Local_AMP_Info.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Local_AMP_Info.HC_AMP_Status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Total_BW, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Min_Latency, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+            pDst->cc_event.Read_Local_AMP_Info.HC_Controller_Type = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohs(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+            framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout, pBuf, 0);
+            pBuf += 4;
+            tlvlen -= (v_U8_t)4;
+        break;
+        case 5130:
+            pDst->cc_event.Read_Read_Local_AMP_Assoc.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            framesntohs(pCtx, &pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length, pBuf, 0);
+            pBuf += 2;
+            tlvlen -= (v_U8_t)2;
+            if (pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length > 248){
+                        // pDst->cc_event.Read_Read_Local_AMP_Assoc.present = 0;
+                        return BTAMP_SKIPPED_BAD_IE;
+            }
+
+            BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment, pBuf, ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ) );
+            pBuf += ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length );
+            tlvlen -= ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length );
+        break;
+        case 5131:
+            pDst->cc_event.Write_Remote_AMP_Assoc.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Write_Remote_AMP_Assoc.phy_link_handle = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 6145:
+            pDst->cc_event.Read_Loopback_Mode.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+            pDst->cc_event.Read_Loopback_Mode.loopback_mode = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+        case 6146:
+            pDst->cc_event.Write_Loopback_Mode.status = *pBuf;
+            pBuf += 1;
+            tlvlen -= (v_U8_t)1;
+        break;
+    }
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Command_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Command_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Command_Complete_Event*);
+
+#define SigUnpackTlvHCI_Command_Complete_Event ( 0x000a )
+
+
+v_U32_t btampUnpackTlvHCI_Command_Status_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Command_Status_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->num_hci_command_packets = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->command_opcode, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Command_Status_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Command_Status_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Command_Status_Event*);
+
+#define SigUnpackTlvHCI_Command_Status_Event ( 0x000b )
+
+
+v_U32_t btampUnpackTlvHCI_Create_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Create_Logical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+    if ( WLAN_BAP_PAL_CREATE_LOG_LINK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+//      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+#endif 
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Create_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Create_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Create_Logical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Create_Logical_Link_Cmd ( 0x000c )
+
+
+v_U32_t btampUnpackTlvHCI_Create_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Create_Physical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_CREATE_PHY_LINK_TLV_MIN_LEN > tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING    
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->key_length = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->key_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    if (pDst->key_length > 32){
+        pDst->present = 0;
+        return BTAMP_SKIPPED_BAD_IE;
+    }
+
+    BTAMP_MEMCPY(pCtx, pDst->key_material, pBuf, ( pDst->key_length ) );
+    pBuf += ( pDst->key_length );
+    tlvlen -= ( pDst->key_length );
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Create_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Create_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Create_Physical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Create_Physical_Link_Cmd ( 0x000d )
+
+
+v_U32_t btampUnpackTlvHCI_Data_Buffer_Overflow_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Data_Buffer_Overflow_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->link_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Data_Buffer_Overflow_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Data_Buffer_Overflow_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Data_Buffer_Overflow_Event*);
+
+#define SigUnpackTlvHCI_Data_Buffer_Overflow_Event ( 0x000e )
+
+
+v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_DISC_LOG_LINK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Disconnect_Logical_Link_Cmd ( 0x000f )
+
+
+v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    pDst->reason = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*);
+
+#define SigUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x0010 )
+
+
+v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+    if ( WLAN_BAP_PAL_DISC_PHY_LINK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+//      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+#endif      
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->reason = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*);
+
+#define SigUnpackTlvHCI_Disconnect_Physical_Link_Cmd ( 0x0011 )
+
+
+v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+   (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->reason = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*);
+
+#define SigUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x0012 )
+
+
+v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flow_Spec_Modify_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_FLOW_SPEC_MOD_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    pDst->be_aggr_counter = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18);
+    pBuf += 18;
+    tlvlen -= (v_U8_t)18;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Flow_Spec_Modify_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Cmd*);
+
+#define SigUnpackTlvHCI_Flow_Spec_Modify_Cmd ( 0x0013 )
+
+
+v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*);
+
+#define SigUnpackTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x0014 )
+
+
+v_U32_t btampUnpackTlvHCI_Flush_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flush_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_FLUSH_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Flush_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Flush_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flush_Cmd*);
+
+#define SigUnpackTlvHCI_Flush_Cmd ( 0x0015 )
+
+
+v_U32_t btampUnpackTlvHCI_Flush_Occurred_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flush_Occurred_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Flush_Occurred_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Flush_Occurred_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flush_Occurred_Event*);
+
+#define SigUnpackTlvHCI_Flush_Occurred_Event ( 0x0016 )
+
+
+v_U32_t btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->bd_addr, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (v_U8_t)6;
+    BTAMP_MEMCPY(pCtx, pDst->generic_amp_link_key, pBuf, 32);
+    pBuf += 32;
+    tlvlen -= (v_U8_t)32;
+    pDst->key_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*);
+
+#define SigUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0017 )
+
+
+v_U32_t btampUnpackTlvHCI_Hardware_Error_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Hardware_Error_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->hardware_code = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Hardware_Error_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Hardware_Error_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Hardware_Error_Event*);
+
+#define SigUnpackTlvHCI_Hardware_Error_Event ( 0x0018 )
+
+
+v_U32_t btampUnpackTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Logical_Link_Cancel_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_CANCEL_LOG_LINK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->tx_flow_spec_id = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Logical_Link_Cancel_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Logical_Link_Cancel_Cmd*);
+
+#define SigUnpackTlvHCI_Logical_Link_Cancel_Cmd ( 0x0019 )
+
+
+v_U32_t btampUnpackTlvHCI_Logical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Logical_Link_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Logical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Logical_Link_Complete_Event*);
+
+#define SigUnpackTlvHCI_Logical_Link_Complete_Event ( 0x001a )
+
+
+v_U32_t btampUnpackTlvHCI_Loopback_Command_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Loopback_Command_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->hci_command_packet, pBuf, 64);
+    pBuf += 64;
+    tlvlen -= (v_U8_t)64;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Loopback_Command_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Loopback_Command_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Loopback_Command_Event*);
+
+#define SigUnpackTlvHCI_Loopback_Command_Event ( 0x001b )
+
+
+v_U32_t btampUnpackTlvHCI_Physical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Complete_Event*);
+
+#define SigUnpackTlvHCI_Physical_Link_Complete_Event ( 0x001c )
+
+
+v_U32_t btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->reason = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*);
+
+#define SigUnpackTlvHCI_Physical_Link_Loss_Warning_Event ( 0x001d )
+
+
+v_U32_t btampUnpackTlvHCI_Physical_Link_Recovery_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Recovery_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Physical_Link_Recovery_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Recovery_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Recovery_Event*);
+
+#define SigUnpackTlvHCI_Physical_Link_Recovery_Event ( 0x001e )
+
+
+v_U32_t btampUnpackTlvHCI_Qos_Violation_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Qos_Violation_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Qos_Violation_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Qos_Violation_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Qos_Violation_Event*);
+
+#define SigUnpackTlvHCI_Qos_Violation_Event ( 0x001f )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_READ_BE_FLUSH_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x0020 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Buffer_Size_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Buffer_Size_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Buffer_Size_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Buffer_Size_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Buffer_Size_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Buffer_Size_Cmd ( 0x0021 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x0022 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Data_Block_Size_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Data_Block_Size_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Data_Block_Size_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Data_Block_Size_Cmd ( 0x0023 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_READ_FAILED_CONTACT_CNT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x0024 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x0025 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Link_Quality_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Link_Quality_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_READ_LINK_QUALITY_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Link_Quality_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Link_Quality_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Link_Quality_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Link_Quality_Cmd ( 0x0026 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_READ_LINK_SVISISON_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x0027 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s. tlvlen=%d.", __FUNCTION__, tlvlen); 
+
+#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+    if ( WLAN_BAP_PAL_READ_LOCAL_AMP_ASSOC_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+//      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+#endif      
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->length_so_far, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohs(pCtx, &pDst->max_remote_amp_assoc_length, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x0028 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+     pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Local_AMP_Information_Cmd ( 0x0029 )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x002a )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_Version_Info_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Local_Version_Info_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_Version_Info_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Local_Version_Info_Cmd ( 0x002b )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Location_Data_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Location_Data_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Location_Data_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Location_Data_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Location_Data_Cmd ( 0x002c )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x002d )
+
+
+v_U32_t btampUnpackTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Loopback_Mode_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Loopback_Mode_Cmd*);
+
+#define SigUnpackTlvHCI_Read_Loopback_Mode_Cmd ( 0x002e )
+
+
+v_U32_t btampUnpackTlvHCI_Read_RSSI_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_RSSI_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_READ_RSSI_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Read_RSSI_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Read_RSSI_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_RSSI_Cmd*);
+
+#define SigUnpackTlvHCI_Read_RSSI_Cmd ( 0x002f )
+
+
+v_U32_t btampUnpackTlvHCI_Reset_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Reset_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Reset_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Reset_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Reset_Cmd*);
+
+#define SigUnpackTlvHCI_Reset_Cmd ( 0x0030 )
+
+
+v_U32_t btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_RESET_FAILED_CONTACT_CNT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*);
+
+#define SigUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x0031 )
+
+
+v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Event_Mask_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_SET_EVENT_MASK_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->event_mask, pBuf, 8);
+    pBuf += 8;
+    tlvlen -= (v_U8_t)8;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Set_Event_Mask_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Set_Event_Mask_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Event_Mask_Cmd*);
+
+#define SigUnpackTlvHCI_Set_Event_Mask_Cmd ( 0x0032 )
+
+
+v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s. tlvlen=%d.", __FUNCTION__, tlvlen); 
+#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING
+    if ( WLAN_BAP_PAL_SET_EVENT_MASK2_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+//      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+#endif      
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    BTAMP_MEMCPY(pCtx, pDst->event_mask_page_2, pBuf, 8);
+    pBuf += 8;
+    tlvlen -= (v_U8_t)8;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*);
+
+#define SigUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x0033 )
+
+
+v_U32_t btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_SET_SHORT_RANGE_MODE_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->short_range_mode = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*);
+
+#define SigUnpackTlvHCI_Set_Short_Range_Mode_Cmd ( 0x0034 )
+
+
+v_U32_t btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    pDst->status = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    pDst->short_range_mode = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*);
+
+#define SigUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x0035 )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_BE_FLUSH_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohl(pCtx, &pDst->best_effort_flush_timeout, pBuf, 0);
+    pBuf += 4;
+    tlvlen -= (v_U8_t)4;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x0036 )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_CON_ACC_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->connection_accept_timeout, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x0037 )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_FLOW_CTRL_MODE_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->flow_control_mode = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x0038 )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_LINK_SVISION_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohs(pCtx, &pDst->link_supervision_timeout, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x0039 )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Location_Data_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Location_Data_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_LOCATION_DATA_CMD_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->loc_domain_aware = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    BTAMP_MEMCPY(pCtx, pDst->loc_domain, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (v_U8_t)3;
+    pDst->loc_options = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Location_Data_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Location_Data_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Location_Data_Cmd ( 0x003a )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_LOG_LINK_ACC_TIMEOUT_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->logical_link_accept_timeout, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x003b )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Loopback_Mode_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_LOOOPBACK_MODE_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->loopback_mode = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Loopback_Mode_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Loopback_Mode_Cmd ( 0x003c )
+
+
+v_U32_t btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_WRITE_REMOTE_AMP_ASSOC_MIN_TLV_LEN > tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    pDst->phy_link_handle = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    framesntohs(pCtx, &pDst->length_so_far, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    framesntohs(pCtx, &pDst->amp_assoc_remaining_length, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    if (pDst->amp_assoc_remaining_length > 248){
+        pDst->present = 0;
+        return BTAMP_SKIPPED_BAD_IE;
+    }
+
+    BTAMP_MEMCPY(pCtx, pDst->amp_assoc_fragment, pBuf, ( pDst->amp_assoc_remaining_length ) );
+    pBuf += ( pDst->amp_assoc_remaining_length );
+    tlvlen -= ( pDst->amp_assoc_remaining_length );
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*);
+
+#define SigUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x003d )
+
+v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Enhanced_Flush_Cmd *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+
+    /*-----------------------------------------------------------------------
+       TLV Sanity check 
+    -------------------------------------------------------------------------*/
+    if ( WLAN_BAP_PAL_ENHANCED_FLUSH_TLV_LEN != tlvlen ) 
+    {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+      /*Log invalid len*/
+      VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, 
+            "Invalid TLV len on %s", __FUNCTION__); 
+#endif      
+      return BTAMP_INVALID_TLV_LENGTH; 
+    }
+
+    /*-----------------------------------------------------------------------
+      Parse TLV 
+     -----------------------------------------------------------------------*/
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    pDst->packet_type = *pBuf;
+    pBuf += 1;
+    tlvlen -= (v_U8_t)1;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Enhanced_Flush_Cmd. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Enhanced_Flush_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Enhanced_Flush_Cmd*);
+
+#define SigUnpackTlvHCI_Enhanced_Flush_Cmd ( 0x003e )
+
+
+v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Enhanced_Flush_Complete_Event *pDst)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (v_U8_t)2;
+    (void)pCtx;
+    return status;
+} /* End btampUnpackTlvHCI_Enhanced_Flush_Completed_Event. */
+
+typedef v_U32_t (*pfnUnpackTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Enhanced_Flush_Complete_Event*);
+
+#define SigUnpackTlvHCI_Enhanced_Flush_Complete_Event ( 0x003f )
+
+
+v_U32_t btampUnpackAMP_ASSOC(void * pCtx, v_U8_t *pBuf, v_U32_t nBuf, tBtampAMP_ASSOC *pFrm)
+{
+    v_U32_t i;
+    static tTLVDefn TLVS[ ] = {
+        {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigUnpackTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, },
+        {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 0xFF/*12*/, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigUnpackTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, },
+        {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 0xFF/*12*/, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigUnpackTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7, 7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigUnpackTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigUnpackTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, },
+    { 0xffff, 0 },
+    };
+
+    v_U32_t status = 0;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampUnpackAMP_ASSOC. nBuf - %d\n", nBuf); 
+#endif    
+
+    status |= UnpackTlvCore(pCtx,pBuf,nBuf,TLVS,(v_U8_t*)pFrm,sizeof(*pFrm));
+
+    (void)i;
+#   ifdef BTAMP_DUMP_FRAMES
+    if (!BTAMP_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Unpacked the AMP_ASSOC:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_MAC_Addr:\n"));
+        if (!pFrm->AMP_Assoc_MAC_Addr.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_MAC_Addr.mac_addr, 6);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Preferred_Channel_List:\n"));
+        if (!pFrm->AMP_Assoc_Preferred_Channel_List.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Preferred_Channel_List.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Preferred_Channel_List.triplets, 3 * pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Connected_Channel:\n"));
+        if (!pFrm->AMP_Assoc_Connected_Channel.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Connected_Channel.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Connected_Channel.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Connected_Channel.triplets, 3 * pFrm->AMP_Assoc_Connected_Channel.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Capabilities:\n"));
+        if (!pFrm->AMP_Assoc_PAL_Capabilities.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Capabilities.pal_capabilities, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Version:\n"));
+        if (!pFrm->AMP_Assoc_PAL_Version.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_CompanyID, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_subversion, 2);
+        }
+    }
+#   endif // BTAMP_DUMP_FRAMES
+    return status;
+
+} /* End btampUnpackAMP_ASSOC. */
+
+static v_U32_t UnpackTlvCore( void *   pCtx,
+                                   v_U8_t *pBuf,
+                                   v_U32_t nBuf,
+                                   tTLVDefn     TLVs[ ],
+                                   v_U8_t *pFrm,
+                                   size_t       nFrm )
+{
+    tTLVDefn *pTlv;
+    v_U32_t      nBufRemaining, status, status2, npec;
+    v_U32_t      sType, sLen;
+    v_U16_t      id, len;
+    v_U8_t      *pBufRemaining, *pfFound;
+
+    (void)pCtx;                 // Shutup the compiler
+    (void)nFrm;
+    status = BTAMP_PARSE_SUCCESS;
+    status2 = BTAMP_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In UnpackTlvCore, nBufRemaining - %d\n", nBufRemaining); 
+#endif    
+
+    // While we have data...
+    while ( nBufRemaining )
+    {
+        if ( 3 > nBufRemaining )
+        {
+            FRAMES_LOG0( pCtx, FRLOGE, FRFL( "This frame reports "
+                         "fewer three byte(s) remaining.\n" ) );
+            status |= BTAMP_INCOMPLETE_TLV;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        npec = 0U;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+        VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+          "Calling FindTLVDefn...\n", nBufRemaining); 
+#endif
+
+        // Look for a matching TLV definition,
+        pTlv = FindTLVDefn( pCtx, pBufRemaining, nBufRemaining, TLVs );
+        sType = 1;
+        sLen  = 2;
+        // consume the type,
+        if (sType == 2) 
+            framesntohs(pCtx, &id, pBufRemaining, 1);
+        else { 
+            id = *pBufRemaining; 
+        }
+        pBufRemaining += sType;
+        nBufRemaining -= sType;
+        // & length,
+        framesntohs(pCtx, &len, pBufRemaining, 1);
+        pBufRemaining += sLen;
+        nBufRemaining -= sLen;
+
+        if ( pTlv && pTlv->pec )
+        {
+            npec = 3U;
+            if ( 3 > nBufRemaining )
+            {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+                VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+                  "3 > nBufRemaining\n"); 
+#endif
+
+                FRAMES_LOG2(pCtx, FRLOGW, FRFL("TLV %d reports length"
+                    "%d, but it has a Private Enterprise Code (3 byte"
+                    "s.\n"), id, len);
+                FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+                FRAMES_LOG2(pCtx, FRLOG1, FRFL("We've parsed %d bytes"
+                    "of this buffer, and show %d left.\n"),
+                pBufRemaining - pBuf, nBufRemaining);
+                status |= BTAMP_INCOMPLETE_TLV;
+                FRAMES_DBG_BREAK();
+                goto MandatoryCheck;
+            }
+            pBufRemaining += 3;
+            nBufRemaining -= 3;
+            len           -= 3;
+        }
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+        VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+          "Len - %d nBufRemaining - %d\n", len, nBufRemaining); 
+#endif
+
+        // Whether we found a hit or not, we can validate the reported
+        // length of this TLV:
+        if ( len > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGW, FRFL("TLV %d reports length %"
+                "d, but there are only %d bytes remaining in this f"
+                "rame.\n"), id, len, nBufRemaining );
+            FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+            FRAMES_LOG2( pCtx, FRLOG1, FRFL( "We've parsed %d bytes"
+                " of this buffer, and show %d left.\n"),
+                pBufRemaining - pBuf, nBufRemaining);
+            status |= BTAMP_INCOMPLETE_TLV;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        // Now, *if* we found a hit...
+        if ( pTlv )
+        {
+            if ( nBufRemaining < pTlv->minSize - npec - (sType + sLen))
+            {
+                FRAMES_LOG3( pCtx, FRLOGW, FRFL("The IE %s must be "
+                    "at least %d bytes in size, but there are only "
+                    "%d bytes remaining in this frame.\n"),
+                     pTlv->name, pTlv->minSize, nBufRemaining );
+                FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+                status |= BTAMP_INCOMPLETE_TLV;
+                FRAMES_DBG_BREAK( );
+                goto MandatoryCheck;
+            }
+            else if ( len > pTlv->maxSize - npec - (sType + sLen))
+            {
+                FRAMES_LOG1( pCtx, FRLOGW, FRFL("The TLV %s reports "
+                    "an illegally large size; this TLV is presumably"
+                    "corrupt or otherwise invalid & will be skipped "
+                    "ipped.\n"), pTlv->name );
+                FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+                FRAMES_LOG2( pCtx, FRLOG1, FRFL("We've parsed %d by"
+                    "tes of this buffer, and show %d left.\n"),
+                    pBufRemaining - pBuf, nBufRemaining);
+                FRAMES_DBG_BREAK();
+                status |= BTAMP_SKIPPED_BAD_TLV;
+            }
+            else
+            {
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+                VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+                  "pTlv->sig - %d\n", pTlv->sig); 
+#endif
+
+                switch (pTlv->sig)
+                {
+                case SigUnpackTlvAMP_Assoc_Connected_Channel:
+                        status2 = ( (pfnUnpackTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvAMP_Assoc_MAC_Addr:
+                        status2 = ( (pfnUnpackTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvAMP_Assoc_PAL_Capabilities:
+                        status2 = ( (pfnUnpackTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvAMP_Assoc_PAL_Version:
+                        status2 = ( (pfnUnpackTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_PAL_Version* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvAMP_Assoc_Preferred_Channel_List:
+                        status2 = ( (pfnUnpackTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvFlow_Spec:
+                        status2 = ( (pfnUnpackTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVFlow_Spec* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Accept_Logical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Accept_Physical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Channel_Selected_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Channel_Selected_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Command_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Command_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Command_Status_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Command_Status_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Create_Logical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Create_Physical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Data_Buffer_Overflow_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Disconnect_Logical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Disconnect_Physical_Link_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Flow_Spec_Modify_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Flow_Spec_Modify_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Flush_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flush_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Flush_Occurred_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flush_Occurred_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Hardware_Error_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Hardware_Error_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Logical_Link_Cancel_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Logical_Link_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Loopback_Command_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Loopback_Command_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Physical_Link_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Physical_Link_Loss_Warning_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Physical_Link_Recovery_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Qos_Violation_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Qos_Violation_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Buffer_Size_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Data_Block_Size_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Link_Quality_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Local_AMP_Information_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Local_Version_Info_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Location_Data_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_Loopback_Mode_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Read_RSSI_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Reset_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Reset_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Set_Event_Mask_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Set_Short_Range_Mode_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event:
+                        status2 = ( (pfnUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Location_Data_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Loopback_Mode_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                case SigUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd:
+                        status2 = ( (pfnUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pFrm + pTlv->offset ));
+                    break;
+                default:
+                    FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR: I"
+                        " don't know about the TLV signature %d-- thi"
+                        "s is most likely a 'framesc' bug.\n"),
+                        pTlv->sig);
+                    FRAMES_DBG_BREAK();
+                    return BTAMP_INTERNAL_ERROR;
+                } // End switch on sig.
+            } // End if on length check.
+
+            status |= status2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+            VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+              "status - %x\n", status); 
+#endif
+        }
+        else
+        {
+            FRAMES_LOG2(pCtx, FRLOG3, FRFL("Skipping unknown TLV %d ("
+                "length %d)\n"), id, len);
+            FRAMES_DUMP(pCtx, FRLOG3, pBufRemaining - (sType + sLen), len);
+            status |= BTAMP_UNKNOWN_TLVS;
+        }
+
+        // Advance to the next TLV
+        pBufRemaining += len;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+        VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+          "len - %d nBufRemaining - %d\n", len, nBufRemaining); 
+#endif
+
+        if (len > nBufRemaining)
+         {
+             FRAMES_LOG0(pCtx, FRLOGW, FRFL("This TLV extends past th"
+                 "e buffer as it was defined to us.  This could mean "
+                 "a corrupt frame, or just an incorrect length parame"
+                 "ter.\n"));
+             FRAMES_DBG_BREAK();
+             status |= BTAMP_LAST_TLV_TOO_LONG;
+             goto MandatoryCheck;
+         }
+
+        nBufRemaining -= len;
+
+    } // End iteration over TLVs.
+
+MandatoryCheck:
+    pTlv = &TLVs[0];
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "pTlv->id - %x\n", pTlv->id); 
+#endif    
+
+    while (0xffff != pTlv->id)
+    {
+        if (pTlv->fMandatory)
+        {
+            pfFound = (v_U8_t*)(pFrm + pTlv->offset +
+                             pTlv->presenceOffset);
+            if (!*pfFound)
+            {
+                FRAMES_LOG1(pCtx, FRLOGW, FRFL("ERROR: The mandatory "
+                    "TLV %s wasn't seen.\n"),
+                    pTlv->name);
+                FRAMES_DBG_BREAK();
+                status |= BTAMP_MANDATORY_TLV_MISSING;
+            }
+
+        }
+        ++pTlv;
+    }
+
+    return status;
+} /* End UnpacTlvkCore. */
+v_U32_t btampGetPackedTlvAMP_Assoc_Connected_Channel(void * pCtx, tBtampTLVAMP_Assoc_Connected_Channel *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedTlvAMP_Assoc_Connected_Channel\n"); 
+#endif    
+
+    while ( pTlv->present )
+    {
+        *pnNeeded += 3;
+        if ( pTlv->num_triplets )
+        {
+            *pnNeeded += ( pTlv->num_triplets * 3 );
+        }
+        else break;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVAMP_Assoc_Connected_Channel. */
+
+typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_Connected_Channel_t)(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U32_t*);
+#define SigPackSizeTlvAMP_Assoc_Connected_Channel ( 0x003e )
+
+v_U32_t btampGetPackedTlvAMP_Assoc_MAC_Addr(void * pCtx, tBtampTLVAMP_Assoc_MAC_Addr *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedTlvAMP_Assoc_MAC_Addr\n"); 
+#endif    
+
+    while ( pTlv->present )
+    {
+        *pnNeeded += 6;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVAMP_Assoc_MAC_Addr. */
+
+typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_MAC_Addr_t)(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U32_t*);
+#define SigPackSizeTlvAMP_Assoc_MAC_Addr ( 0x003f )
+
+v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Capabilities(void * pCtx, tBtampTLVAMP_Assoc_PAL_Capabilities *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedTlvAMP_Assoc_PAL_Capabilities\n"); 
+#endif    
+
+    while ( pTlv->present )
+    {
+        *pnNeeded += 4;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVAMP_Assoc_PAL_Capabilities. */
+
+typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_PAL_Capabilities_t)(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U32_t*);
+#define SigPackSizeTlvAMP_Assoc_PAL_Capabilities ( 0x0040 )
+
+v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Version(void * pCtx, tBtampTLVAMP_Assoc_PAL_Version *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVAMP_Assoc_PAL_Version. */
+
+typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_PAL_Version_t)(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U32_t*);
+#define SigPackSizeTlvAMP_Assoc_PAL_Version ( 0x0041 )
+
+v_U32_t btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(void * pCtx, tBtampTLVAMP_Assoc_Preferred_Channel_List *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedTlvAMP_Assoc_Preferred_Channel_List\n"); 
+#endif    
+
+    while ( pTlv->present )
+    {
+        *pnNeeded += 3;
+        if ( pTlv->num_triplets )
+        {
+            *pnNeeded += ( pTlv->num_triplets * 3 );
+        }
+        else break;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVAMP_Assoc_Preferred_Channel_List. */
+
+typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_Preferred_Channel_List_t)(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U32_t*);
+#define SigPackSizeTlvAMP_Assoc_Preferred_Channel_List ( 0x0042 )
+
+v_U32_t btampGetPackedTlvFlow_Spec(void * pCtx, tBtampTLVFlow_Spec *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 4;
+        *pnNeeded += 4;
+        *pnNeeded += 4;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVFlow_Spec. */
+
+typedef v_U32_t (*pfnPackSizeTlvFlow_Spec_t)(void *, tBtampTLVFlow_Spec*, v_U32_t*);
+#define SigPackSizeTlvFlow_Spec ( 0x0043 )
+
+v_U32_t btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Accept_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 18;
+        *pnNeeded += 18;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Accept_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Accept_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Accept_Logical_Link_Cmd ( 0x0044 )
+
+v_U32_t btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Accept_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += pTlv->key_length;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Accept_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Accept_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Accept_Physical_Link_Cmd ( 0x0045 )
+
+v_U32_t btampGetPackedTlvHCI_Channel_Selected_Event(void * pCtx, tBtampTLVHCI_Channel_Selected_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Channel_Selected_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Channel_Selected_Event_t)(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Channel_Selected_Event ( 0x0046 )
+
+v_U32_t btampGetPackedTlvHCI_Command_Complete_Event(void * pCtx, tBtampTLVHCI_Command_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        switch (pTlv->command_opcode)
+        {
+            case 3075:
+                *pnNeeded += 1;
+            break;
+            case 3080:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+            break;
+            case 1083:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+            break;
+            case 3077:
+                *pnNeeded += 1;
+            break;
+            case 3093:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+            break;
+            case 3094:
+                *pnNeeded += 1;
+            break;
+            case 3126:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+            break;
+            case 3127:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+            break;
+            case 3169:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+            break;
+            case 3170:
+                *pnNeeded += 1;
+            break;
+            case 3171:
+                *pnNeeded += 1;
+            break;
+            case 3172:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 3;
+                *pnNeeded += 1;
+            break;
+            case 3173:
+                *pnNeeded += 1;
+            break;
+            case 3174:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+            break;
+            case 3175:
+                *pnNeeded += 1;
+            break;
+            case 3177:
+                *pnNeeded += 1;
+                *pnNeeded += 4;
+            break;
+            case 3178:
+                *pnNeeded += 1;
+            break;
+            case 3179:
+                *pnNeeded += 1;
+            break;
+            case 4097:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+            break;
+            case 4098:
+                *pnNeeded += 1;
+                *pnNeeded += 64;
+            break;
+            case 4101:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+            break;
+            case 4106:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+            break;
+            case 5121:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+            break;
+            case 5122:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+            break;
+            case 5123:
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 1;
+            break;
+            case 5125:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+            break;
+            case 5129:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 4;
+                *pnNeeded += 4;
+                *pnNeeded += 4;
+                *pnNeeded += 4;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+                *pnNeeded += 4;
+                *pnNeeded += 4;
+            break;
+            case 5130:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += pTlv->cc_event.Read_Read_Local_AMP_Assoc.remaining_length;
+            break;
+            case 5131:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+            break;
+            case 6145:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+            break;
+            case 6146:
+                *pnNeeded += 1;
+            break;
+        }
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Command_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Command_Complete_Event_t)(void *, tBtampTLVHCI_Command_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Command_Complete_Event ( 0x0047 )
+
+v_U32_t btampGetPackedTlvHCI_Command_Status_Event(void * pCtx, tBtampTLVHCI_Command_Status_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Command_Status_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Command_Status_Event_t)(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Command_Status_Event ( 0x0048 )
+
+v_U32_t btampGetPackedTlvHCI_Create_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Create_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 18;
+        *pnNeeded += 18;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Create_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Create_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Create_Logical_Link_Cmd ( 0x0049 )
+
+v_U32_t btampGetPackedTlvHCI_Create_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Create_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += pTlv->key_length;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Create_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Create_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Create_Physical_Link_Cmd ( 0x004a )
+
+v_U32_t btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(void * pCtx, tBtampTLVHCI_Data_Buffer_Overflow_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Data_Buffer_Overflow_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Data_Buffer_Overflow_Event_t)(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Data_Buffer_Overflow_Event ( 0x004b )
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Disconnect_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Disconnect_Logical_Link_Cmd ( 0x004c )
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Disconnect_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x004d )
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Disconnect_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Disconnect_Physical_Link_Cmd ( 0x004e )
+
+v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Disconnect_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x004f )
+
+v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx, tBtampTLVHCI_Flow_Spec_Modify_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        *pnNeeded += 18;
+        *pnNeeded += 18;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Flow_Spec_Modify_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Flow_Spec_Modify_Cmd ( 0x0050 )
+
+v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Flow_Spec_Modify_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x0051 )
+
+v_U32_t btampGetPackedTlvHCI_Flush_Cmd(void * pCtx, tBtampTLVHCI_Flush_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Flush_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Flush_Cmd_t)(void *, tBtampTLVHCI_Flush_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Flush_Cmd ( 0x0052 )
+
+v_U32_t btampGetPackedTlvHCI_Flush_Occurred_Event(void * pCtx, tBtampTLVHCI_Flush_Occurred_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Flush_Occurred_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Flush_Occurred_Event_t)(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Flush_Occurred_Event ( 0x0053 )
+
+v_U32_t btampGetPackedTlvHCI_Num_Completed_Pkts_Event(void * pCtx, tBtampTLVHCI_Num_Completed_Pkts_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+//    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+#if 0
+// New 
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+// End of New 
+#endif
+//        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Num_Completed_Pkts_Event. */
+
+v_U32_t btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(void * pCtx, tBtampTLVHCI_Num_Completed_Data_Blocks_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+//    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+//        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Num_Completed_Data_Blocks_Event. */
+
+//typedef v_U32_t (*pfnPackSizeTlvHCI_Num_Completed_Pkts_Event_t)(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*);
+//#define SigPackSizeTlvHCI_Num_Completed_Pkts_Event ( 0x0048 )
+
+v_U32_t btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 6;
+        *pnNeeded += 32;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Generic_AMP_Link_Key_Notification_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0054 )
+
+v_U32_t btampGetPackedTlvHCI_Hardware_Error_Event(void * pCtx, tBtampTLVHCI_Hardware_Error_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Hardware_Error_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Hardware_Error_Event_t)(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Hardware_Error_Event ( 0x0055 )
+
+v_U32_t btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx, tBtampTLVHCI_Logical_Link_Cancel_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Logical_Link_Cancel_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Logical_Link_Cancel_Cmd ( 0x0056 )
+
+v_U32_t btampGetPackedTlvHCI_Logical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Logical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Logical_Link_Complete_Event ( 0x0057 )
+
+v_U32_t btampGetPackedTlvHCI_Loopback_Command_Event(void * pCtx, tBtampTLVHCI_Loopback_Command_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 64;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Loopback_Command_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Loopback_Command_Event_t)(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Loopback_Command_Event ( 0x0058 )
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Physical_Link_Complete_Event ( 0x0059 )
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Physical_Link_Loss_Warning_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Physical_Link_Loss_Warning_Event ( 0x005a )
+
+v_U32_t btampGetPackedTlvHCI_Physical_Link_Recovery_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Recovery_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Physical_Link_Recovery_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Recovery_Event_t)(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Physical_Link_Recovery_Event ( 0x005b )
+
+v_U32_t btampGetPackedTlvHCI_Qos_Violation_Event(void * pCtx, tBtampTLVHCI_Qos_Violation_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Qos_Violation_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Qos_Violation_Event_t)(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Qos_Violation_Event ( 0x005c )
+
+v_U32_t btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x005d )
+
+v_U32_t btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(void * pCtx, tBtampTLVHCI_Read_Buffer_Size_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Buffer_Size_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Buffer_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Buffer_Size_Cmd ( 0x005e )
+
+v_U32_t btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x005f )
+
+v_U32_t btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx, tBtampTLVHCI_Read_Data_Block_Size_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Data_Block_Size_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Data_Block_Size_Cmd ( 0x0060 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x0061 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x0062 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Link_Quality_Cmd(void * pCtx, tBtampTLVHCI_Read_Link_Quality_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Link_Quality_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Link_Quality_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Link_Quality_Cmd ( 0x0063 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x0064 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Local_AMP_Assoc_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x0065 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Local_AMP_Information_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Local_AMP_Information_Cmd ( 0x0066 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Local_Supported_Cmds_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x0067 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_Version_Info_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Local_Version_Info_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Local_Version_Info_Cmd ( 0x0068 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Location_Data_Cmd(void * pCtx, tBtampTLVHCI_Read_Location_Data_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Location_Data_Cmd ( 0x0069 )
+
+v_U32_t btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x006a )
+
+v_U32_t btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx, tBtampTLVHCI_Read_Loopback_Mode_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_Loopback_Mode_Cmd ( 0x006b )
+
+v_U32_t btampGetPackedTlvHCI_Read_RSSI_Cmd(void * pCtx, tBtampTLVHCI_Read_RSSI_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Read_RSSI_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Read_RSSI_Cmd_t)(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Read_RSSI_Cmd ( 0x006c )
+
+v_U32_t btampGetPackedTlvHCI_Reset_Cmd(void * pCtx, tBtampTLVHCI_Reset_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Reset_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Reset_Cmd_t)(void *, tBtampTLVHCI_Reset_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Reset_Cmd ( 0x006d )
+
+v_U32_t btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Reset_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x006e )
+
+v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Cmd(void * pCtx, tBtampTLVHCI_Set_Event_Mask_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 8;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Set_Event_Mask_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Event_Mask_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Set_Event_Mask_Cmd ( 0x006f )
+
+v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 8;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Set_Event_Mask_Page_2_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x0070 )
+
+v_U32_t btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Set_Short_Range_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Set_Short_Range_Mode_Cmd ( 0x0071 )
+
+v_U32_t btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Short_Range_Mode_Change_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x0072 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 4;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x0073 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x0074 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x0075 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x0076 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Location_Data_Cmd(void * pCtx, tBtampTLVHCI_Write_Location_Data_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 3;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Location_Data_Cmd ( 0x0077 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x0078 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx, tBtampTLVHCI_Write_Loopback_Mode_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Loopback_Mode_Cmd ( 0x0079 )
+
+v_U32_t btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd\n"); 
+#endif    
+
+    while ( pTlv->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += pTlv->amp_assoc_remaining_length;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Write_Remote_AMP_ASSOC_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x007a )
+
+v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Cmd(void * pCtx, tBtampTLVHCI_Enhanced_Flush_Cmd *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Enhanced_Flush_Cmd. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Enhanced_Flush_Cmd_t)(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U32_t*);
+#define SigPackSizeTlvHCI_Enhanced_Flush_Cmd ( 0x007b )
+
+v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx, tBtampTLVHCI_Enhanced_Flush_Complete_Event *pTlv, v_U32_t *pnNeeded)
+{
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    (void)pCtx; (void)pTlv; (void)pnNeeded;
+    while ( pTlv->present )
+    {
+        *pnNeeded += 2;
+        break;
+    }
+    return status;
+} /* End btampGetPackedTLVHCI_Enhanced_Flush_Complete_Event. */
+
+typedef v_U32_t (*pfnPackSizeTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U32_t*);
+#define SigPackSizeTlvHCI_Enhanced_Flush_Complete_Event ( 0x007c )
+
+v_U32_t btampGetPackedAMP_ASSOCSize(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U32_t *pnNeeded)
+{
+    static tTLVDefn TLVS[ ] = {
+        {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigPackSizeTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, },
+        {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigPackSizeTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, },
+        {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigPackSizeTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7,  7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigPackSizeTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigPackSizeTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, },
+    { 0xffff, 0 },
+    };
+
+    v_U32_t status = 0;
+    *pnNeeded = 0;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampGetPackedAMP_ASSOCSize\n"); 
+#endif    
+
+    status |= GetPackedSizeTlvCore(pCtx,(v_U8_t*)pFrm,pnNeeded,TLVS);
+    return status;
+} /* End btampGetPackedAMP_ASSOCSize. */
+
+static v_U32_t GetPackedSizeTlvCore(void * pCtx,
+                                 v_U8_t *pFrm,
+                                 v_U32_t *pnNeeded,
+                                 tTLVDefn  TLVs[])
+{
+    tTLVDefn      *pTlv;
+    v_U32_t  status, status2;
+    tFRAMES_BOOL *pfFound;
+
+    status = BTAMP_PARSE_SUCCESS;
+    status2 = BTAMP_PARSE_SUCCESS;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In GetPackedSizeTlvCore\n"); 
+#endif    
+
+    pTlv = &( TLVs[0] );
+    while ( 0xffff != pTlv->id )
+    {
+        pfFound = (tFRAMES_BOOL*)(pFrm + pTlv->offset +
+                                  pTlv->presenceOffset);
+        if ( *pfFound )
+        {
+            *pnNeeded += 4U;
+            if ( pTlv->pec ) *pnNeeded += 3U;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+            VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+              "In GetPackedSizeTlvCore, pTlv->sig - %d\n", pTlv->sig); 
+#endif
+
+            switch (pTlv->sig)
+            {
+                case SigPackSizeTlvAMP_Assoc_Connected_Channel:
+                        status2 = ( (pfnPackSizeTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvAMP_Assoc_MAC_Addr:
+                        status2 = ( (pfnPackSizeTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvAMP_Assoc_PAL_Capabilities:
+                        status2 = ( (pfnPackSizeTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvAMP_Assoc_PAL_Version:
+                        status2 = ( (pfnPackSizeTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Version* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvAMP_Assoc_Preferred_Channel_List:
+                        status2 = ( (pfnPackSizeTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvFlow_Spec:
+                        status2 = ( (pfnPackSizeTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, ( tBtampTLVFlow_Spec* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Accept_Logical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Accept_Physical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Channel_Selected_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Channel_Selected_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Command_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Command_Status_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Status_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Create_Logical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Create_Physical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Data_Buffer_Overflow_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Disconnect_Logical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Disconnect_Physical_Link_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Flow_Spec_Modify_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Flush_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Flush_Occurred_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Occurred_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Hardware_Error_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Hardware_Error_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Logical_Link_Cancel_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Logical_Link_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Loopback_Command_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Loopback_Command_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Physical_Link_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Physical_Link_Loss_Warning_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Physical_Link_Recovery_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Qos_Violation_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Qos_Violation_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Buffer_Size_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Data_Block_Size_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Link_Quality_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Local_AMP_Information_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Local_Version_Info_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Location_Data_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_Loopback_Mode_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Read_RSSI_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Reset_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Set_Event_Mask_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Set_Short_Range_Mode_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event:
+                        status2 = ( (pfnPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Location_Data_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Loopback_Mode_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd:
+                        status2 = ( (pfnPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pFrm + pTlv->offset), pnNeeded);
+                        if (status2) status |= status2;
+                    break;
+            default:
+                FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don"
+                    "'t know about the TLV signature %d; this is most l"
+                    "ikely a bug in 'framesc'.\n"), pTlv->sig);
+                return BTAMP_INTERNAL_ERROR;
+            }
+        }
+        ++pTlv;
+    }
+    return status;
+}
+v_U32_t btampPackTlvAMP_Assoc_Connected_Channel(void * pCtx,
+                                                tBtampTLVAMP_Assoc_Connected_Channel *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampPackTlvAMP_Assoc_Connected_Channel\n"); 
+#endif    
+    // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvAMP_Assoc_Connected_Channel(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3, 0);
+        else *pBuf = 3;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->country, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        nBuf -= 3;
+        if ( pSrc->num_triplets )        {
+            BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->triplets ), ( pSrc->num_triplets * 3 ));
+            *pnConsumed += ( pSrc->num_triplets * 3 );
+            pBuf += ( ( pSrc->num_triplets * 3 ) );
+            nBuf -= ( ( pSrc->num_triplets * 3 ) );
+        }
+        else break;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } 
+    else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvAMP_Assoc_Connected_Channel. */
+
+typedef v_U32_t (*pfnPackTlvAMP_Assoc_Connected_Channel_t)(void *, tBtampTLVAMP_Assoc_Connected_Channel *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvAMP_Assoc_Connected_Channel ( 0x007b )
+
+v_U32_t btampPackTlvAMP_Assoc_MAC_Addr(void * pCtx,
+                                       tBtampTLVAMP_Assoc_MAC_Addr *pSrc,
+                                       v_U8_t *pBuf,
+                                       v_U32_t nBuf,
+                                       v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampPackTlvAMP_Assoc_MAC_Addr\n"); 
+#endif    
+    // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvAMP_Assoc_MAC_Addr(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1, 0);
+        else *pBuf = 1;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->mac_addr, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        nBuf -= 6;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvAMP_Assoc_MAC_Addr. */
+
+typedef v_U32_t (*pfnPackTlvAMP_Assoc_MAC_Addr_t)(void *, tBtampTLVAMP_Assoc_MAC_Addr *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvAMP_Assoc_MAC_Addr ( 0x007c )
+
+v_U32_t btampPackTlvAMP_Assoc_PAL_Capabilities(void * pCtx,
+                                               tBtampTLVAMP_Assoc_PAL_Capabilities *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampPackTlvAMP_Assoc_PAL_Capabilities\n"); 
+#endif    
+    // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvAMP_Assoc_PAL_Capabilities(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 4, 0);
+        else *pBuf = 4;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtonl(pCtx, pBuf, pSrc->pal_capabilities, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -= 4;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvAMP_Assoc_PAL_Capabilities. */
+
+typedef v_U32_t (*pfnPackTlvAMP_Assoc_PAL_Capabilities_t)(void *, tBtampTLVAMP_Assoc_PAL_Capabilities *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvAMP_Assoc_PAL_Capabilities ( 0x007d )
+
+v_U32_t btampPackTlvAMP_Assoc_PAL_Version(void * pCtx,
+                                          tBtampTLVAMP_Assoc_PAL_Version *pSrc,
+                                          v_U8_t *pBuf,
+                                          v_U32_t nBuf,
+                                          v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampPackTlvAMP_Assoc_PAL_Version\n"); 
+#endif    
+    // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvAMP_Assoc_PAL_Version(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5, 0);
+        else *pBuf = 5;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->pal_version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->pal_CompanyID, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->pal_subversion, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvAMP_Assoc_PAL_Version. */
+
+typedef v_U32_t (*pfnPackTlvAMP_Assoc_PAL_Version_t)(void *, tBtampTLVAMP_Assoc_PAL_Version *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvAMP_Assoc_PAL_Version ( 0x007e )
+
+v_U32_t btampPackTlvAMP_Assoc_Preferred_Channel_List(void * pCtx,
+                                                     tBtampTLVAMP_Assoc_Preferred_Channel_List *pSrc,
+                                                     v_U8_t *pBuf,
+                                                     v_U32_t nBuf,
+                                                     v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 2;
+#ifdef WLAN_BAPHCI_ENABLE_LOGGING
+    VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,
+      "In btampPackTlvAMP_Assoc_Preferred_Channel_List\n"); 
+#endif    
+    // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 2, 0);
+        else *pBuf = 2;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->country, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        nBuf -= 3;
+        if ( pSrc->num_triplets )        {
+            BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->triplets ), ( pSrc->num_triplets * 3 ));
+            *pnConsumed += ( pSrc->num_triplets * 3 );
+            pBuf += ( ( pSrc->num_triplets * 3 ) );
+            nBuf -= ( ( pSrc->num_triplets * 3 ) );
+        }
+        else break;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvAMP_Assoc_Preferred_Channel_List. */
+
+typedef v_U32_t (*pfnPackTlvAMP_Assoc_Preferred_Channel_List_t)(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvAMP_Assoc_Preferred_Channel_List ( 0x007f )
+
+v_U32_t btampPackTlvFlow_Spec(void * pCtx,
+                              tBtampTLVFlow_Spec *pSrc,
+                              v_U8_t *pBuf,
+                              v_U32_t nBuf,
+                              v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvFlow_Spec(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 6, 0);
+        else *pBuf = 6;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->flow_spec_id;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->service_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->max_sdu, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtonl(pCtx, pBuf, pSrc->sdu_inter_arrival, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -= 4;
+        frameshtonl(pCtx, pBuf, pSrc->access_latency, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -= 4;
+        frameshtonl(pCtx, pBuf, pSrc->flush_timeout, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -= 4;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen) 
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvFlow_Spec. */
+
+typedef v_U32_t (*pfnPackTlvFlow_Spec_t)(void *, tBtampTLVFlow_Spec *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvFlow_Spec ( 0x0080 )
+
+v_U32_t btampPackTlvHCI_Accept_Logical_Link_Cmd(void * pCtx,
+                                                tBtampTLVHCI_Accept_Logical_Link_Cmd *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1081, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Accept_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Accept_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Accept_Logical_Link_Cmd ( 0x0081 )
+
+v_U32_t btampPackTlvHCI_Accept_Physical_Link_Cmd(void * pCtx,
+                                                 tBtampTLVHCI_Accept_Physical_Link_Cmd *pSrc,
+                                                 v_U8_t *pBuf,
+                                                 v_U32_t nBuf,
+                                                 v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1078, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->key_length;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->key_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->key_material ), pSrc->key_length);
+        *pnConsumed += pSrc->key_length;
+        pBuf += ( pSrc->key_length );
+        nBuf -= ( pSrc->key_length );
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Accept_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Accept_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Accept_Physical_Link_Cmd ( 0x0082 )
+
+v_U32_t btampPackTlvHCI_Channel_Selected_Event(void * pCtx,
+                                               tBtampTLVHCI_Channel_Selected_Event *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Channel_Selected_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 65, 0);
+        else *pBuf = 65;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Channel_Selected_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Channel_Selected_Event_t)(void *, tBtampTLVHCI_Channel_Selected_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Channel_Selected_Event ( 0x0083 )
+
+v_U32_t btampPackTlvHCI_Command_Complete_Event(void * pCtx,
+                                               tBtampTLVHCI_Command_Complete_Event *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Command_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 14, 0);
+        else *pBuf = 14;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->num_hci_command_packets;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->command_opcode, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        switch (pSrc->command_opcode)
+        {
+            case 3075:
+                *pBuf = pSrc->cc_event.Reset.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3080:
+                *pBuf = pSrc->cc_event.Flush.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Flush.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 1083:
+                *pBuf = pSrc->cc_event.Logical_Link_Cancel.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Logical_Link_Cancel.phy_link_handle;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Logical_Link_Cancel.tx_flow_spec_id;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3077:
+                *pBuf = pSrc->cc_event.Set_Event_Mask.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3093:
+                *pBuf = pSrc->cc_event.Read_Connection_Accept_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Connection_Accept_TO.connection_accept_timeout, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 3094:
+                *pBuf = pSrc->cc_event.Write_Connection_Accept_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3126:
+                *pBuf = pSrc->cc_event.Read_Link_Supervision_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Supervision_TO.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Supervision_TO.link_supervision_timeout, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 3127:
+                *pBuf = pSrc->cc_event.Write_Link_Supervision_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Write_Link_Supervision_TO.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 3169:
+                *pBuf = pSrc->cc_event.Read_Logical_Link_Accept_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 3170:
+                *pBuf = pSrc->cc_event.Write_Logical_Link_Accept_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3171:
+                *pBuf = pSrc->cc_event.Set_Event_Mask_Page_2.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3172:
+                *pBuf = pSrc->cc_event.Read_Location_Data.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Location_Data.loc_domain_aware;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                BTAMP_MEMCPY(pCtx, pBuf, pSrc->cc_event.Read_Location_Data.loc_domain, 3);
+                *pnConsumed += 3;
+                pBuf += 3;
+                nBuf -= 3;
+                *pBuf = pSrc->cc_event.Read_Location_Data.loc_options;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3173:
+                *pBuf = pSrc->cc_event.Write_Location_Data.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3174:
+                *pBuf = pSrc->cc_event.Read_Flow_Control_Mode.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Flow_Control_Mode.flow_control_mode;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3175:
+                *pBuf = pSrc->cc_event.Write_Flow_Control_Mode.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3177:
+                *pBuf = pSrc->cc_event.Read_BE_Flush_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_BE_Flush_TO.best_effort_flush_timeout, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+            break;
+            case 3178:
+                *pBuf = pSrc->cc_event.Write_BE_Flush_TO.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 3179:
+                *pBuf = pSrc->cc_event.Set_Short_Range_Mode.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 4097:
+                *pBuf = pSrc->cc_event.Read_Local_Version_Info.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Local_Version_Info.HC_HCI_Version;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_HCI_Revision, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                *pBuf = pSrc->cc_event.Read_Local_Version_Info.HC_PAL_Version;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_Manufac_Name, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 4098:
+                *pBuf = pSrc->cc_event.Read_Local_Supported_Cmds.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                BTAMP_MEMCPY(pCtx, pBuf, pSrc->cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds, 64);
+                *pnConsumed += 64;
+                pBuf += 64;
+                nBuf -= 64;
+            break;
+            case 4101:
+                *pBuf = pSrc->cc_event.Read_Buffer_Size.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                *pBuf = pSrc->cc_event.Read_Buffer_Size.HC_SCO_Packet_Length;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 4106:
+                *pBuf = pSrc->cc_event.Read_Data_Block_Size.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Data_Block_Length, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 5121:
+                *pBuf = pSrc->cc_event.Read_Failed_Contact_Counter.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Failed_Contact_Counter.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Failed_Contact_Counter.failed_contact_counter, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 5122:
+                *pBuf = pSrc->cc_event.Reset_Failed_Contact_Counter.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Reset_Failed_Contact_Counter.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+            break;
+            case 5123:
+                *pBuf = pSrc->cc_event.Read_Link_Quality.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Quality.log_link_handle, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                *pBuf = pSrc->cc_event.Read_Link_Quality.link_quality;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 5125:
+                *pBuf = pSrc->cc_event.Read_RSSI.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_RSSI.phy_link_handle;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_RSSI.rssi;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 5129:
+                *pBuf = pSrc->cc_event.Read_Local_AMP_Info.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Local_AMP_Info.HC_AMP_Status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Total_BW, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Min_Latency, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+                *pBuf = pSrc->cc_event.Read_Local_AMP_Info.HC_Controller_Type;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+                frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout, 0);
+                *pnConsumed += 4;
+                pBuf += 4;
+                nBuf -= 4;
+            break;
+            case 5130:
+                *pBuf = pSrc->cc_event.Read_Read_Local_AMP_Assoc.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                nBuf -= 2;
+                BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment ), pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length);
+                *pnConsumed += pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length;
+                pBuf += ( pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length );
+                nBuf -= ( pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length );
+            break;
+            case 5131:
+                *pBuf = pSrc->cc_event.Write_Remote_AMP_Assoc.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Write_Remote_AMP_Assoc.phy_link_handle;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 6145:
+                *pBuf = pSrc->cc_event.Read_Loopback_Mode.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+                *pBuf = pSrc->cc_event.Read_Loopback_Mode.loopback_mode;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+            case 6146:
+                *pBuf = pSrc->cc_event.Write_Loopback_Mode.status;
+                *pnConsumed += 1;
+                pBuf += 1;
+                nBuf -= 1;
+            break;
+        }
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Command_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Command_Complete_Event_t)(void *, tBtampTLVHCI_Command_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Command_Complete_Event ( 0x0084 )
+
+v_U32_t btampPackTlvHCI_Command_Status_Event(void * pCtx,
+                                             tBtampTLVHCI_Command_Status_Event *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Command_Status_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 15, 0);
+        else *pBuf = 15;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->num_hci_command_packets;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->command_opcode, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Command_Status_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Command_Status_Event_t)(void *, tBtampTLVHCI_Command_Status_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Command_Status_Event ( 0x0085 )
+
+v_U32_t btampPackTlvHCI_Create_Logical_Link_Cmd(void * pCtx,
+                                                tBtampTLVHCI_Create_Logical_Link_Cmd *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+
+    nConsumedOnEntry = *pnConsumed;
+    status = btampGetPackedTlvHCI_Create_Logical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1080, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Create_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Create_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Create_Logical_Link_Cmd ( 0x0086 )
+
+v_U32_t btampPackTlvHCI_Create_Physical_Link_Cmd(void * pCtx,
+                                                 tBtampTLVHCI_Create_Physical_Link_Cmd *pSrc,
+                                                 v_U8_t *pBuf,
+                                                 v_U32_t nBuf,
+                                                 v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Create_Physical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1077, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->key_length;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->key_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->key_material ), pSrc->key_length);
+        *pnConsumed += pSrc->key_length;
+        pBuf += ( pSrc->key_length );
+        nBuf -= ( pSrc->key_length );
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Create_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Create_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Create_Physical_Link_Cmd ( 0x0087 )
+
+v_U32_t btampPackTlvHCI_Data_Buffer_Overflow_Event(void * pCtx,
+                                                   tBtampTLVHCI_Data_Buffer_Overflow_Event *pSrc,
+                                                   v_U8_t *pBuf,
+                                                   v_U32_t nBuf,
+                                                   v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 26, 0);
+        else *pBuf = 26;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->link_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Data_Buffer_Overflow_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Data_Buffer_Overflow_Event_t)(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Data_Buffer_Overflow_Event ( 0x0088 )
+
+v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx,
+                                                    tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pSrc,
+                                                    v_U8_t *pBuf,
+                                                    v_U32_t nBuf,
+                                                    v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1082, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Disconnect_Logical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Disconnect_Logical_Link_Cmd ( 0x0089 )
+
+v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx,
+                                                               tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pSrc,
+                                                               v_U8_t *pBuf,
+                                                               v_U32_t nBuf,
+                                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 70, 0);
+        else *pBuf = 70;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        *pBuf = pSrc->reason;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x008a )
+
+v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx,
+                                                     tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pSrc,
+                                                     v_U8_t *pBuf,
+                                                     v_U32_t nBuf,
+                                                     v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1079, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->reason;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Disconnect_Physical_Link_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Disconnect_Physical_Link_Cmd ( 0x008b )
+
+v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx,
+                                                                tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pSrc,
+                                                                v_U8_t *pBuf,
+                                                                v_U32_t nBuf,
+                                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 66, 0);
+        else *pBuf = 66;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->reason;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x008c )
+
+v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx,
+                                             tBtampTLVHCI_Flow_Spec_Modify_Cmd *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1084, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        *pBuf = pSrc->be_aggr_counter;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18);
+        *pnConsumed += 18;
+        pBuf += 18;
+        nBuf -= 18;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Flow_Spec_Modify_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Flow_Spec_Modify_Cmd ( 0x008d )
+
+v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx,
+                                                        tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pSrc,
+                                                        v_U8_t *pBuf,
+                                                        v_U32_t nBuf,
+                                                        v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 71, 0);
+        else *pBuf = 71;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Flow_Spec_Modify_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x008e )
+
+v_U32_t btampPackTlvHCI_Flush_Cmd(void * pCtx,
+                                  tBtampTLVHCI_Flush_Cmd *pSrc,
+                                  v_U8_t *pBuf,
+                                  v_U32_t nBuf,
+                                  v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Flush_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3080, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Flush_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Flush_Cmd_t)(void *, tBtampTLVHCI_Flush_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Flush_Cmd ( 0x008f )
+
+v_U32_t btampPackTlvHCI_Flush_Occurred_Event(void * pCtx,
+                                             tBtampTLVHCI_Flush_Occurred_Event *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Flush_Occurred_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 17, 0);
+        else *pBuf = 17;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Flush_Occurred_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Flush_Occurred_Event_t)(void *, tBtampTLVHCI_Flush_Occurred_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Flush_Occurred_Event ( 0x0090 )
+
+v_U32_t btampPackTlvHCI_Num_Completed_Pkts_Event(void * pCtx,
+                                             tBtampTLVHCI_Num_Completed_Pkts_Event *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Num_Completed_Pkts_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+//    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 19, 0);
+        else *pBuf = 19;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->num_handles;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->conn_handles[0], 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->num_completed_pkts[0], 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+#if 0
+        // New
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+// End of new
+#endif
+//        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Num_Completed_Pkts_Event. */
+
+v_U32_t btampPackTlvHCI_Num_Completed_Data_Blocks_Event(void * pCtx,
+                                             tBtampTLVHCI_Num_Completed_Data_Blocks_Event *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+//    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 72, 0);
+        else *pBuf = 72;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->total_num_data_blocks, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        *pBuf = pSrc->num_handles;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->conn_handles[0], 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->num_completed_pkts[0], 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->num_completed_blocks[0], 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+#if 0
+        // New
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, 0, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+// End of new
+#endif
+//        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Num_Completed_Data_Blocks_Event. */
+
+//typedef v_U32_t (*pfnPackTlvHCI_Num_Completed_Pkts_Event_t)(void *, tBtampTLVHCI_Num_Completed_Pkts_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+//#define SigPackTlvHCI_Num_Completed_Pkts_Event ( 0x0085 )
+
+v_U32_t btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx,
+                                                                tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pSrc,
+                                                                v_U8_t *pBuf,
+                                                                v_U32_t nBuf,
+                                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 62, 0);
+        else *pBuf = 62;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->bd_addr, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        nBuf -= 6;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->generic_amp_link_key, 32);
+        *pnConsumed += 32;
+        pBuf += 32;
+        nBuf -= 32;
+        *pBuf = pSrc->key_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0091 )
+
+v_U32_t btampPackTlvHCI_Hardware_Error_Event(void * pCtx,
+                                             tBtampTLVHCI_Hardware_Error_Event *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Hardware_Error_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 16, 0);
+        else *pBuf = 16;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->hardware_code;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Hardware_Error_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Hardware_Error_Event_t)(void *, tBtampTLVHCI_Hardware_Error_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Hardware_Error_Event ( 0x0092 )
+
+v_U32_t btampPackTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx,
+                                                tBtampTLVHCI_Logical_Link_Cancel_Cmd *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 1083, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->tx_flow_spec_id;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Logical_Link_Cancel_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Logical_Link_Cancel_Cmd ( 0x0093 )
+
+v_U32_t btampPackTlvHCI_Logical_Link_Complete_Event(void * pCtx,
+                                                    tBtampTLVHCI_Logical_Link_Complete_Event *pSrc,
+                                                    v_U8_t *pBuf,
+                                                    v_U32_t nBuf,
+                                                    v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Logical_Link_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 69, 0);
+        else *pBuf = 69;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->flow_spec_id;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Logical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Logical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Logical_Link_Complete_Event ( 0x0094 )
+
+v_U32_t btampPackTlvHCI_Loopback_Command_Event(void * pCtx,
+                                               tBtampTLVHCI_Loopback_Command_Event *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Loopback_Command_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 25, 0);
+        else *pBuf = 25;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->hci_command_packet, 64);
+        *pnConsumed += 64;
+        pBuf += 64;
+        nBuf -= 64;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Loopback_Command_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Loopback_Command_Event_t)(void *, tBtampTLVHCI_Loopback_Command_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Loopback_Command_Event ( 0x0095 )
+
+v_U32_t btampPackTlvHCI_Physical_Link_Complete_Event(void * pCtx,
+                                                     tBtampTLVHCI_Physical_Link_Complete_Event *pSrc,
+                                                     v_U8_t *pBuf,
+                                                     v_U32_t nBuf,
+                                                     v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Physical_Link_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 64, 0);
+        else *pBuf = 64;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Physical_Link_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Physical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Physical_Link_Complete_Event ( 0x0096 )
+
+v_U32_t btampPackTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx,
+                                                         tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pSrc,
+                                                         v_U8_t *pBuf,
+                                                         v_U32_t nBuf,
+                                                         v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 67, 0);
+        else *pBuf = 67;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->reason;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Physical_Link_Loss_Warning_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Physical_Link_Loss_Warning_Event ( 0x0097 )
+
+v_U32_t btampPackTlvHCI_Physical_Link_Recovery_Event(void * pCtx,
+                                                     tBtampTLVHCI_Physical_Link_Recovery_Event *pSrc,
+                                                     v_U8_t *pBuf,
+                                                     v_U32_t nBuf,
+                                                     v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Physical_Link_Recovery_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 68, 0);
+        else *pBuf = 68;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Physical_Link_Recovery_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Recovery_Event_t)(void *, tBtampTLVHCI_Physical_Link_Recovery_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Physical_Link_Recovery_Event ( 0x0098 )
+
+v_U32_t btampPackTlvHCI_Qos_Violation_Event(void * pCtx,
+                                            tBtampTLVHCI_Qos_Violation_Event *pSrc,
+                                            v_U8_t *pBuf,
+                                            v_U32_t nBuf,
+                                            v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Qos_Violation_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 30, 0);
+        else *pBuf = 30;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Qos_Violation_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Qos_Violation_Event_t)(void *, tBtampTLVHCI_Qos_Violation_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Qos_Violation_Event ( 0x0099 )
+
+v_U32_t btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx,
+                                                           tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pSrc,
+                                                           v_U8_t *pBuf,
+                                                           v_U32_t nBuf,
+                                                           v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3177, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x009a )
+
+v_U32_t btampPackTlvHCI_Read_Buffer_Size_Cmd(void * pCtx,
+                                             tBtampTLVHCI_Read_Buffer_Size_Cmd *pSrc,
+                                             v_U8_t *pBuf,
+                                             v_U32_t nBuf,
+                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 4101, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Buffer_Size_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Buffer_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Buffer_Size_Cmd ( 0x009b )
+
+v_U32_t btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx,
+                                                           tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pSrc,
+                                                           v_U8_t *pBuf,
+                                                           v_U32_t nBuf,
+                                                           v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3093, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x009c )
+
+v_U32_t btampPackTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx,
+                                                 tBtampTLVHCI_Read_Data_Block_Size_Cmd *pSrc,
+                                                 v_U8_t *pBuf,
+                                                 v_U32_t nBuf,
+                                                 v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 4106, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Data_Block_Size_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Data_Block_Size_Cmd ( 0x009d )
+
+v_U32_t btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx,
+                                                        tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pSrc,
+                                                        v_U8_t *pBuf,
+                                                        v_U32_t nBuf,
+                                                        v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5121, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x009e )
+
+v_U32_t btampPackTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx,
+                                                   tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pSrc,
+                                                   v_U8_t *pBuf,
+                                                   v_U32_t nBuf,
+                                                   v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3174, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+    
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x009f )
+
+v_U32_t btampPackTlvHCI_Read_Link_Quality_Cmd(void * pCtx,
+                                              tBtampTLVHCI_Read_Link_Quality_Cmd *pSrc,
+                                              v_U8_t *pBuf,
+                                              v_U32_t nBuf,
+                                              v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Link_Quality_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5123, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+    
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Link_Quality_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Link_Quality_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Quality_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Link_Quality_Cmd ( 0x00a0 )
+
+v_U32_t btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx,
+                                                          tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pSrc,
+                                                          v_U8_t *pBuf,
+                                                          v_U32_t nBuf,
+                                                          v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3126, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x00a1 )
+
+v_U32_t btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx,
+                                                 tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pSrc,
+                                                 v_U8_t *pBuf,
+                                                 v_U32_t nBuf,
+                                                 v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5130, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->length_so_far, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->max_remote_amp_assoc_length, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x00a2 )
+
+v_U32_t btampPackTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx,
+                                                       tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pSrc,
+                                                       v_U8_t *pBuf,
+                                                       v_U32_t nBuf,
+                                                       v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5129, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Local_AMP_Information_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Local_AMP_Information_Cmd ( 0x00a3 )
+
+v_U32_t btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx,
+                                                      tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pSrc,
+                                                      v_U8_t *pBuf,
+                                                      v_U32_t nBuf,
+                                                      v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 4098, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x00a4 )
+
+v_U32_t btampPackTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx,
+                                                    tBtampTLVHCI_Read_Local_Version_Info_Cmd *pSrc,
+                                                    v_U8_t *pBuf,
+                                                    v_U32_t nBuf,
+                                                    v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 4097, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen) 
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Local_Version_Info_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Local_Version_Info_Cmd ( 0x00a5 )
+
+v_U32_t btampPackTlvHCI_Read_Location_Data_Cmd(void * pCtx,
+                                               tBtampTLVHCI_Read_Location_Data_Cmd *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Location_Data_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3172, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Read_Location_Data_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Location_Data_Cmd ( 0x00a6 )
+
+v_U32_t btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx,
+                                                             tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pSrc,
+                                                             v_U8_t *pBuf,
+                                                             v_U32_t nBuf,
+                                                             v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3169, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x00a7 )
+
+v_U32_t btampPackTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx,
+                                               tBtampTLVHCI_Read_Loopback_Mode_Cmd *pSrc,
+                                               v_U8_t *pBuf,
+                                               v_U32_t nBuf,
+                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 6145, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_Loopback_Mode_Cmd ( 0x00a8 )
+
+v_U32_t btampPackTlvHCI_Read_RSSI_Cmd(void * pCtx,
+                                      tBtampTLVHCI_Read_RSSI_Cmd *pSrc,
+                                      v_U8_t *pBuf,
+                                      v_U32_t nBuf,
+                                      v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Read_RSSI_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5125, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Read_RSSI_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Read_RSSI_Cmd_t)(void *, tBtampTLVHCI_Read_RSSI_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Read_RSSI_Cmd ( 0x00a9 )
+
+v_U32_t btampPackTlvHCI_Reset_Cmd(void * pCtx,
+                                  tBtampTLVHCI_Reset_Cmd *pSrc,
+                                  v_U8_t *pBuf,
+                                  v_U32_t nBuf,
+                                  v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Reset_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3075, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Reset_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Reset_Cmd_t)(void *, tBtampTLVHCI_Reset_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Reset_Cmd ( 0x00aa )
+
+v_U32_t btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx,
+                                                         tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pSrc,
+                                                         v_U8_t *pBuf,
+                                                         v_U32_t nBuf,
+                                                         v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5122, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x00ab )
+
+v_U32_t btampPackTlvHCI_Set_Event_Mask_Cmd(void * pCtx,
+                                           tBtampTLVHCI_Set_Event_Mask_Cmd *pSrc,
+                                           v_U8_t *pBuf,
+                                           v_U32_t nBuf,
+                                           v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Set_Event_Mask_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3077, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->event_mask, 8);
+        *pnConsumed += 8;
+        pBuf += 8;
+        nBuf -= 8;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Set_Event_Mask_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Set_Event_Mask_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Set_Event_Mask_Cmd ( 0x00ac )
+
+v_U32_t btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx,
+                                                  tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pSrc,
+                                                  v_U8_t *pBuf,
+                                                  v_U32_t nBuf,
+                                                  v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3171, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->event_mask_page_2, 8);
+        *pnConsumed += 8;
+        pBuf += 8;
+        nBuf -= 8;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x00ad )
+
+v_U32_t btampPackTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx,
+                                                 tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pSrc,
+                                                 v_U8_t *pBuf,
+                                                 v_U32_t nBuf,
+                                                 v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3179, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->short_range_mode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Set_Short_Range_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Set_Short_Range_Mode_Cmd ( 0x00ae )
+
+v_U32_t btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx,
+                                                               tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pSrc,
+                                                               v_U8_t *pBuf,
+                                                               v_U32_t nBuf,
+                                                               v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 76, 0);
+        else *pBuf = 76;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        *pBuf = pSrc->short_range_mode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x00af )
+
+v_U32_t btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx,
+                                                            tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pSrc,
+                                                            v_U8_t *pBuf,
+                                                            v_U32_t nBuf,
+                                                            v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3178, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtonl(pCtx, pBuf, pSrc->best_effort_flush_timeout, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -= 4;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x00b0 )
+
+v_U32_t btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx,
+                                                            tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pSrc,
+                                                            v_U8_t *pBuf,
+                                                            v_U32_t nBuf,
+                                                            v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3094, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->connection_accept_timeout, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x00b1 )
+
+v_U32_t btampPackTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx,
+                                                    tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pSrc,
+                                                    v_U8_t *pBuf,
+                                                    v_U32_t nBuf,
+                                                    v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3175, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->flow_control_mode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Flow_Control_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x00b2 )
+
+v_U32_t btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx,
+                                                           tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pSrc,
+                                                           v_U8_t *pBuf,
+                                                           v_U32_t nBuf,
+                                                           v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3127, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->link_supervision_timeout, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x00b3 )
+
+v_U32_t btampPackTlvHCI_Write_Location_Data_Cmd(void * pCtx,
+                                                tBtampTLVHCI_Write_Location_Data_Cmd *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Location_Data_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3173, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->loc_domain_aware;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        BTAMP_MEMCPY(pCtx, pBuf, pSrc->loc_domain, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        nBuf -= 3;
+        *pBuf = pSrc->loc_options;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Location_Data_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Write_Location_Data_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Location_Data_Cmd ( 0x00b4 )
+
+v_U32_t btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx,
+                                                              tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pSrc,
+                                                              v_U8_t *pBuf,
+                                                              v_U32_t nBuf,
+                                                              v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3170, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->logical_link_accept_timeout, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x00b5 )
+
+v_U32_t btampPackTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx,
+                                                tBtampTLVHCI_Write_Loopback_Mode_Cmd *pSrc,
+                                                v_U8_t *pBuf,
+                                                v_U32_t nBuf,
+                                                v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 6146, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->loopback_mode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Loopback_Mode_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Loopback_Mode_Cmd ( 0x00b6 )
+
+v_U32_t btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx,
+                                                   tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pSrc,
+                                                   v_U8_t *pBuf,
+                                                   v_U32_t nBuf,
+                                                   v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 5131, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        *pBuf = pSrc->phy_link_handle;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        frameshtons(pCtx, pBuf, pSrc->length_so_far, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        frameshtons(pCtx, pBuf, pSrc->amp_assoc_remaining_length, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->amp_assoc_fragment ), pSrc->amp_assoc_remaining_length);
+        *pnConsumed += pSrc->amp_assoc_remaining_length;
+        pBuf += ( pSrc->amp_assoc_remaining_length );
+        nBuf -= ( pSrc->amp_assoc_remaining_length );
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x00b7 )
+
+v_U32_t btampPackTlvHCI_Enhanced_Flush_Cmd(void * pCtx,
+                                           tBtampTLVHCI_Enhanced_Flush_Cmd *pSrc,
+                                           v_U8_t *pBuf,
+                                           v_U32_t nBuf,
+                                           v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 2;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Enhanced_Flush_Cmd(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 3167, 0);
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        *pBuf = pSrc->packet_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -= 1;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Enhanced_Flush_Cmd. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Enhanced_Flush_Cmd_t)(void *, tBtampTLVHCI_Enhanced_Flush_Cmd *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Enhanced_Flush_Cmd ( 0x00b8 )
+
+v_U32_t btampPackTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx,
+                                                      tBtampTLVHCI_Enhanced_Flush_Complete_Event *pSrc,
+                                                      v_U8_t *pBuf,
+                                                      v_U32_t nBuf,
+                                                      v_U32_t *pnConsumed)
+{
+    v_U8_t* pTlvLen = 0;
+    v_U32_t nConsumedOnEntry;
+    v_U32_t status = BTAMP_PARSE_SUCCESS;
+    v_U32_t nNeeded = 0U;
+    v_U32_t sType = 0U;
+    v_U32_t sLen = 0U;
+    sType = 1;
+    sLen = 1;
+        // sanity checking
+    if( pCtx == NULL || pSrc == NULL ||
+        pBuf == NULL || pnConsumed == NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" );
+        return BTAMP_BAD_INPUT_BUFFER;
+    }
+    nConsumedOnEntry = *pnConsumed;
+
+    status = btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(pCtx, pSrc, &nNeeded);
+    if ( ! BTAMP_SUCCEEDED( status ) ) return status;
+    nNeeded += sType + sLen;
+    if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW;
+    pTlvLen = pBuf;
+    while ( pSrc->present )
+    {
+        if( sType == 2) frameshtons( pCtx, pBuf, 57, 0);
+        else *pBuf = 57;
+        pBuf += sType; nBuf -= sType; *pnConsumed += sType;
+        pTlvLen = pBuf;
+        pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen;
+        frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -= 2;
+        break;
+    }
+
+    if (pTlvLen && sLen == 2)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0);
+    } else if(NULL != pTlvLen)
+    {
+        *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen);
+    }
+    return status;
+} /* End btampPackTlvHCI_Enhanced_Flush_Complete_Event. */
+
+typedef v_U32_t (*pfnPackTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*);
+#define SigPackTlvHCI_Enhanced_Flush_Complete_Event ( 0x00b9 )
+
+v_U32_t btampPackAMP_ASSOC(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U8_t *pBuf, v_U32_t nBuf, v_U32_t *pnConsumed)
+{
+    v_U32_t i;
+    static tTLVDefn TLVS[ ] = {
+        {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigPackTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampPackTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, },
+        {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigPackTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampPackTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, },
+        {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigPackTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampPackTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7, 7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigPackTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampPackTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, },
+        {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigPackTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampPackTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, },
+    { 0xffff, 0 },
+    };
+
+    v_U32_t idx = 0;
+    v_U32_t status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status |= PackTlvCore(pCtx,(v_U8_t*)pFrm,pBuf,nBuf,pnConsumed,TLVS,&idx);
+
+#   ifdef BTAMP_DUMP_FRAMES
+    if (!BTAMP_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Packed the AMP_ASSOC:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_MAC_Addr:\n"));
+        if (!pFrm->AMP_Assoc_MAC_Addr.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_MAC_Addr.mac_addr, 6);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Preferred_Channel_List:\n"));
+        if (!pFrm->AMP_Assoc_Preferred_Channel_List.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Preferred_Channel_List.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Preferred_Channel_List.triplets, 3 * pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Connected_Channel:\n"));
+        if (!pFrm->AMP_Assoc_Connected_Channel.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Connected_Channel.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Connected_Channel.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Connected_Channel.triplets, 3 * pFrm->AMP_Assoc_Connected_Channel.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Capabilities:\n"));
+        if (!pFrm->AMP_Assoc_PAL_Capabilities.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Capabilities.pal_capabilities, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Version:\n"));
+        if (!pFrm->AMP_Assoc_PAL_Version.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_CompanyID, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_subversion, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), pBuf, nBuf);
+    }
+#   endif // BTAMP_DUMP_FRAMES
+    return status;
+
+} /* End btampUnpackAMP_ASSOC. */
+
+
+static v_U32_t PackTlvCore(void * pCtx,
+                        v_U8_t *pSrc,
+                        v_U8_t *pBuf,
+                        v_U32_t  nBuf,
+                        v_U32_t *pnConsumed,
+                        tTLVDefn  TLVs[],
+                        v_U32_t *pidx)
+{
+    tTLVDefn     *pTlv;
+    tFRAMES_BOOL *pfFound;
+    v_U8_t *pBufRemaining;
+    v_U32_t nBufRemaining, status, status2, len;
+
+    BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed);
+
+    (void)pCtx;
+    status = BTAMP_PARSE_SUCCESS;
+    status2 = BTAMP_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+
+    pTlv = &( TLVs[0] );
+    while ( 0xffff != pTlv->id )
+    {
+        pfFound = (tFRAMES_BOOL*)(pSrc + pTlv->offset +
+                                  pTlv->presenceOffset);
+        if ( *pfFound && pTlv->minSize > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGE, FRFL("The TLV %s takes at least"
+                " %d bytes, but there are only %d left in the buffer."
+                "\n"), pTlv->name, pTlv->minSize, nBufRemaining);
+            return BTAMP_BUFFER_OVERFLOW;
+        }
+
+        len = 0U;
+
+        if ( *pfFound ) {
+        switch ( pTlv->sig )
+        {
+                case SigPackTlvAMP_Assoc_Connected_Channel:
+                        status2 = ( (pfnPackTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvAMP_Assoc_MAC_Addr:
+                        status2 = ( (pfnPackTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvAMP_Assoc_PAL_Capabilities:
+                        status2 = ( (pfnPackTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvAMP_Assoc_PAL_Version:
+                        status2 = ( (pfnPackTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Version* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvAMP_Assoc_Preferred_Channel_List:
+                        status2 = ( (pfnPackTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvFlow_Spec:
+                        status2 = ( (pfnPackTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, ( tBtampTLVFlow_Spec* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Accept_Logical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Accept_Physical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Channel_Selected_Event:
+                        status2 = ( (pfnPackTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Channel_Selected_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Command_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Command_Status_Event:
+                        status2 = ( (pfnPackTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Status_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Create_Logical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Create_Physical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Data_Buffer_Overflow_Event:
+                        status2 = ( (pfnPackTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Disconnect_Logical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Disconnect_Logical_Link_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Disconnect_Physical_Link_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Disconnect_Physical_Link_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Flow_Spec_Modify_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Flow_Spec_Modify_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Flush_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Flush_Occurred_Event:
+                        status2 = ( (pfnPackTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Occurred_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Generic_AMP_Link_Key_Notification_Event:
+                        status2 = ( (pfnPackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Hardware_Error_Event:
+                        status2 = ( (pfnPackTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Hardware_Error_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Logical_Link_Cancel_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Logical_Link_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Loopback_Command_Event:
+                        status2 = ( (pfnPackTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Loopback_Command_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Physical_Link_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Physical_Link_Loss_Warning_Event:
+                        status2 = ( (pfnPackTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Physical_Link_Recovery_Event:
+                        status2 = ( (pfnPackTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Qos_Violation_Event:
+                        status2 = ( (pfnPackTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Qos_Violation_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Buffer_Size_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Data_Block_Size_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Link_Quality_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Local_AMP_Assoc_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Local_AMP_Information_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Local_Supported_Cmds_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Local_Version_Info_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Location_Data_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_Loopback_Mode_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Read_RSSI_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Reset_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Reset_Failed_Contact_Counter_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Set_Event_Mask_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Set_Event_Mask_Page_2_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Set_Short_Range_Mode_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Short_Range_Mode_Change_Complete_Event:
+                        status2 = ( (pfnPackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Connection_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Flow_Control_Mode_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Link_Supervision_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Location_Data_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Loopback_Mode_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+                case SigPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd:
+                        status2 = ( (pfnPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                        if (status2) status |= status2;
+                    break;
+        default:
+            FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don't "
+                "know about the TLV %d; this is most likely a bug in "
+                "'framesc'.\n"), pTlv->sig);
+            return BTAMP_INTERNAL_ERROR;
+        }
+
+        } /* End if on *pfFound */
+        pBufRemaining += len;
+        nBufRemaining -= len;
+        *pnConsumed   += len;
+        ++pTlv;
+        if(len) ++*pidx;
+    }
+
+    return status;
+
+}
+
diff --git a/CORE/BAP/src/fsmDefs.h b/CORE/BAP/src/fsmDefs.h
new file mode 100644
index 0000000..182fbee
--- /dev/null
+++ b/CORE/BAP/src/fsmDefs.h
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+// Project/System dependant defines and typedefs
+
+#ifndef __FSMDEFS_H__
+#define __FSMDEFS_H__
+
+/* Temporary fix until I clean up all the type names */
+#define BTAMPFSM_INSTANCEDATA_T tWLAN_BAPbapPhysLinkMachine 
+
+typedef unsigned char BTAMPFSM_ENTRY_FLAG_T;
+typedef unsigned char BTAMPFSM_STATEVAR_T;
+typedef unsigned char BTAMPFSM_INST_ID_T;
+typedef unsigned char BTAMPFSM_EVENT_T;
+#endif
diff --git a/CORE/DXE/inc/wlan_qct_dxe.h b/CORE/DXE/inc/wlan_qct_dxe.h
new file mode 100644
index 0000000..80665b8
--- /dev/null
+++ b/CORE/DXE/inc/wlan_qct_dxe.h
@@ -0,0 +1,445 @@
+/*
+ * 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 WLAN_QCT_DXE_H
+#define WLAN_QCT_DXE_H
+
+/**=========================================================================
+  
+  @file  wlan_qct_dxe.h
+  
+  @brief 
+               
+   This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   Copyright (c) 2008 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
+--------    ---         ----------------------------------------------------------
+08/03/10    schang      Created module.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_msg.h"
+#include "wlan_qct_pal_sync.h"
+#include "wlan_qct_wdi_dts.h"
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+/* DXE Descriptor contents SWAP option flag */
+
+//#define WLANDXE_ENDIAN_SWAP_ENABLE
+
+/* Default RX OS frame buffer size
+ * Size must be same with Vos Packet Size */
+#define WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE  (VPKT_SIZE_BUFFER)
+
+/*The maximum number of packets that can be chained in dxe for the Low 
+  priority channel
+  Note: Increased it to 240 from 128 for Windows(EA) becase Windows is
+  able to push 2~6 packet chain in one NET_BUFFER. It causes TX low
+  resource condition more easily than LA. It ends up to cause low 
+  throughut number and spend more CPU time*/
+#ifdef WINDOWS_DT
+#define WLANDXE_LO_PRI_RES_NUM 240
+#else
+#define WLANDXE_LO_PRI_RES_NUM 128
+#endif
+
+
+/*The maximum number of packets that can be chained in dxe for the HI 
+  priority channel */
+#define WLANDXE_HI_PRI_RES_NUM 10
+
+typedef enum
+{
+   WLANDXE_POWER_STATE_FULL,
+   WLANDXE_POWER_STATE_IMPS,
+   WLANDXE_POWER_STATE_BMPS,
+   WLANDXE_POWER_STATE_BMPS_PENDING,
+   WLANDXE_POWER_STATE_DOWN,
+   WLANDXE_POWER_STATE_MAX
+} WLANDXE_PowerStateType;
+
+typedef enum
+{
+   WLANDXE_RIVA_POWER_STATE_ACTIVE,
+   WLANDXE_RIVA_POWER_STATE_IMPS_UNKNOWN,
+   WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN,
+   WLANDXE_RIVA_POWER_STATE_DOWN_UNKNOWN,
+   WLANDXE_RIVA_POWER_STATE_MAX
+} WLANDXE_RivaPowerStateType;
+
+/*==========================================================================
+  @  Type Name
+      WLANDXE_RxFrameReadyCbType 
+
+  @  Description 
+       RX Frame Ready indication CB
+
+  @  Parameters
+         pVoid         pAdaptor : Driver global control block pointer
+         palPacket     pRXFramePtr : Received Frame Pointer
+         pVoid         userCtxt : DTS user contect pointer
+
+  @  Return
+        wpt_status
+===========================================================================*/
+typedef WDTS_RxFrameReadyCbType WLANDXE_RxFrameReadyCbType;
+
+/*==========================================================================
+  @  Type Name
+       WLANDXE_TxCompleteCbType 
+
+  @  Description 
+      TX complete indication CB
+
+  @  Parameters
+         pVoid      pAdaptor : Driver global control block pointer
+         void       pTXFramePtr : Completed TX Frame Pointer
+         pVoid      userCtxt : DTS user contect pointer
+
+  @  Return
+       wpt_status
+===========================================================================*/
+typedef WDTS_TxCompleteCbType WLANDXE_TxCompleteCbType;
+
+/*==========================================================================
+  @  Type Name
+      WLANDXE_LowResourceCbType 
+
+  @  Description 
+       DXE Low resource indication CB
+
+  @  Parameters
+      pVoid      pAdaptor : Driver global control block pointer
+      BOOL      lowResourceCondition : DXE low resource or not
+      pVoid      userCtxt : DTS user contect pointer
+
+  @  Return
+      wpt_status
+===========================================================================*/
+typedef WDTS_LowResourceCbType WLANDXE_LowResourceCbType;
+
+/*==========================================================================
+  @  Type Name
+      WLANDXE_SetPowerStateCbType 
+
+  @  Description 
+       DXE Set power state ACK callback. This callback function should be
+       invoked by the DXE to notify WDI that set power state request is complete
+
+  @  Parameters
+      status    status of the set operation
+      pUserData Cookie that should be passed back to the caller along with the
+                callback.
+
+  @  Return
+      None
+===========================================================================*/
+typedef WDTS_SetPSCbType  WLANDXE_SetPowerStateCbType;
+
+/*-------------------------------------------------------------------------
+ *Function declarations and documenation
+ *-------------------------------------------------------------------------*/
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Open
+
+  @  Description 
+      Open host DXE driver, allocate DXE resources
+      Allocate, DXE local control block, DXE descriptor pool, DXE descriptor control block pool
+
+  @  Parameters
+      pVoid      pAdaptor : Driver global control block pointer
+
+  @  Return
+      pVoid DXE local module control block pointer
+===========================================================================*/
+void *WLANDXE_Open
+(
+   void
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_ClientRegistration
+
+  @  Description 
+      Make callback functions registration into DXE driver from DXE driver client
+
+  @  Parameters
+      pVoid                       pDXEContext : DXE module control block
+      WDTS_RxFrameReadyCbType     rxFrameReadyCB : RX Frame ready CB function pointer
+      WDTS_TxCompleteCbType       txCompleteCB : TX complete CB function pointer
+      WDTS_LowResourceCbType      lowResourceCB : Low DXE resource notification CB function pointer
+      void                       *userContext : DXE Cliennt control block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_ClientRegistration
+(
+   void                       *pDXEContext,
+   WDTS_RxFrameReadyCbType     rxFrameReadyCB,
+   WDTS_TxCompleteCbType       txCompleteCB,
+   WDTS_LowResourceCbType      lowResourceCB,
+   void                       *userContext
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Start
+
+  @  Description 
+      Start Host DXE driver
+      Initialize DXE channels and start channel
+
+  @  Parameters
+      pVoid                       pDXEContext : DXE module control block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Start
+(
+   void  *pDXEContext
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_TXFrame
+
+  @  Description 
+      Trigger frame transmit from host to RIVA
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+      wpt_packet       pPacket : transmit packet structure
+      WDTS_ChannelType channel : TX channel
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_TxFrame
+(
+   void                 *pDXEContext,
+   wpt_packet           *pPacket,
+   WDTS_ChannelType      channel
+);
+
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_CompleteTX
+
+  @  Description 
+      Informs DXE that the current series of Tx packets is complete
+
+  @  Parameters
+      pDXEContext : DXE Control Block
+      ucTxResReq          TX resource number required by TL/WDI
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status
+WLANDXE_CompleteTX
+(
+  void* pDXEContext,
+  wpt_uint32 ucTxResReq
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Stop
+
+  @  Description 
+      Stop DXE channels and DXE engine operations
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Stop
+(
+   void *pDXEContext
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Close
+
+  @  Description 
+      Close DXE channels
+      Free DXE related resources
+      DXE descriptor free
+      Descriptor control block free
+      Pre allocated RX buffer free
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Close
+(
+   void *pDXEContext
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_TriggerTX
+
+  @  Description 
+      TBD
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_TriggerTX
+(
+   void *pDXEContext
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_SetPowerState
+
+  @  Description 
+      From Client let DXE knows what is the WLAN HW(RIVA) power state
+
+  @  Parameters
+      pVoid                    pDXEContext : DXE Control Block
+      WLANDXE_PowerStateType   powerState
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_SetPowerState
+(
+   void                    *pDXEContext,
+   WDTS_PowerStateType      powerState,
+   WDTS_SetPSCbType         cBack
+);
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_GetFreeTxDataResNumber
+
+  @  Description 
+      Returns free descriptor numbers for TX data channel (TX high priority)
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_uint32      Free descriptor number of TX high pri ch
+===========================================================================*/
+wpt_uint32 WLANDXE_GetFreeTxDataResNumber
+(
+   void *pDXEContext
+);
+
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_UnitTest
+
+  @  Description 
+      Temporary for the DXE module test
+
+  @  Parameters
+      NONE
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void WLANDXE_UnitTestStartDXE
+(
+   void
+);
+
+/*==========================================================================
+  @  Function Name 
+
+  @  Description 
+
+  @  Parameters
+
+  @  Return
+
+===========================================================================*/
+void WLANDXE_UnitTestDataTransfer
+(
+   void
+);
+
+/*==========================================================================
+  @  Function Name 
+
+  @  Description 
+
+  @  Parameters
+
+  @  Return
+
+===========================================================================*/
+void WLANDXE_UnitTestEventHandle
+(
+   void     *dxeCB
+);
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+#endif /* WLAN_QCT_DXE_H */
diff --git a/CORE/DXE/src/wlan_qct_dxe.c b/CORE/DXE/src/wlan_qct_dxe.c
new file mode 100644
index 0000000..2482c86
--- /dev/null
+++ b/CORE/DXE/src/wlan_qct_dxe.c
@@ -0,0 +1,4139 @@
+/*
+ * 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  wlan_qct_dxe.c
+  
+  @brief 
+               
+   This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   Copyright (c) 2010-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
+--------    ---         ----------------------------------------------------------
+08/03/10    schang      Created module.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_dxe.h"
+#include "wlan_qct_dxe_i.h"
+#include "wlan_qct_pal_device.h"
+#ifdef FEATURE_R33D
+#include "wlan_qct_pal_bus.h"
+#endif /* FEATURE_R33D */
+
+/*----------------------------------------------------------------------------
+ * Local Definitions
+ * -------------------------------------------------------------------------*/
+//#define WLANDXE_DEBUG_CH_INFO_DUMP
+
+/* Temporary configuration defines
+ * Have to find out permanent solution */
+#define T_WLANDXE_MAX_DESCRIPTOR_COUNT     40
+#define T_WLANDXE_MAX_FRAME_SIZE           2000
+#define T_WLANDXE_TX_INT_ENABLE_FCOUNT     1
+#define T_WLANDXE_MEMDUMP_BYTE_PER_LINE    16
+#define T_WLANDXE_MAX_RX_PACKET_WAIT       6000
+
+/* This is temporary fot the compile
+ * WDI will release official version
+ * This must be removed */
+#define WDI_GET_PAL_CTX()                  NULL
+
+/*-------------------------------------------------------------------------
+  *  Local Varables
+  *-------------------------------------------------------------------------*/
+/* This is temp, someone have to allocate for me, and must be part of global context */
+static WLANDXE_CtrlBlkType    *tempDxeCtrlBlk                = NULL;
+static char                   *channelType[WDTS_CHANNEL_MAX] =
+   {
+      "TX_LOW_PRI",
+      "TX_HIGH_PRI",
+      "RX_LOW_PRI",
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+      "RX_HIGH_PRI",
+#else
+      "H2H_TEST_TX",
+      "H2H_TEST_RX"
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+   };
+
+
+/*-------------------------------------------------------------------------
+  *  External Function Proto Type
+  *-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+  *  Local Function Proto Type
+  *-------------------------------------------------------------------------*/
+static wpt_status dxeRXFrameSingleBufferAlloc
+(
+   WLANDXE_CtrlBlkType      *dxeCtxt,
+   WLANDXE_ChannelCBType    *channelEntry,
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlock
+);
+
+/*-------------------------------------------------------------------------
+  *  Local Function
+  *-------------------------------------------------------------------------*/
+#ifdef WLANDXE_DEBUG_CH_INFO_DUMP
+/*==========================================================================
+  @  Function Name 
+      dxeChannelMonitor
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelMonitor
+(
+   char                    *monitorDescription,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "=== %s Channel Number %d, Channel Type %s",
+            monitorDescription, channelEntry->assignedDMAChannel, channelType[channelEntry->channelType]);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, 
+            "numDesc %d, numFreeDesc %d, numResvDesc %d",
+                   channelEntry->numDesc, channelEntry->numFreeDesc, channelEntry->numRsvdDesc);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "headCB 0x%x, next 0x%x,  DESC 0x%x",
+                   channelEntry->headCtrlBlk, channelEntry->headCtrlBlk->nextCtrlBlk, channelEntry->headCtrlBlk->linkedDescPhyAddr);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "tailCB 0x%x, next 0x%x,  DESC 0x%x",
+                   channelEntry->tailCtrlBlk, channelEntry->tailCtrlBlk->nextCtrlBlk, channelEntry->tailCtrlBlk->linkedDescPhyAddr);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "headCB Order %d, tailCB Order %d",
+            channelEntry->headCtrlBlk->ctrlBlkOrder, channelEntry->tailCtrlBlk->ctrlBlkOrder);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "numFragmentCurrentChain %d, numTotalFrame %d ===",
+            channelEntry->numFragmentCurrentChain,    channelEntry->numTotalFrame);
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeMemoryDump
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeMemoryDump
+(
+   wpt_uint8    *dumpPointer,
+   wpt_uint32    dumpSize,
+   char         *dumpTarget
+)
+{
+   wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                numBytes    = 0;
+   wpt_uint32                idx;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Location 0x%x, Size %d", dumpTarget, dumpPointer, dumpSize);
+
+   numBytes = dumpSize % T_WLANDXE_MEMDUMP_BYTE_PER_LINE;
+   for(idx = 0; idx < dumpSize; idx++)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "0x%2x ", dumpPointer[idx]);
+      if(0 == ((idx + 1) % T_WLANDXE_MEMDUMP_BYTE_PER_LINE))
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, "\n");
+      }
+   }
+   if(0 != numBytes)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, "\n");
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeDescriptorDump
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+wpt_status dxeDescriptorDump
+(
+   WLANDXE_ChannelCBType   *channelEntry,
+   WLANDXE_DescType        *targetDesc,
+   wpt_uint32               fragmentOrder
+)
+{
+   wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
+
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Descriptor Dump for channel %s, %d / %d fragment",
+                   channelType[channelEntry->channelType],
+                   fragmentOrder + 1,
+                   channelEntry->numFragmentCurrentChain);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "CTRL WORD 0x%x, TransferSize %d",
+                   WLANDXE_U32_SWAP_ENDIAN(targetDesc->descCtrl.ctrl),
+            WLANDXE_U32_SWAP_ENDIAN(targetDesc->xfrSize));
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "SRC ADD 0x%x, DST ADD 0x%x, NEXT DESC 0x%x",
+                   WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.srcMemAddrL),
+                   WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.dstMemAddrL),
+                   WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.phyNextL));
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelRegisterDump
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+wpt_status dxeChannelRegisterDump
+(
+   WLANDXE_ChannelCBType   *channelEntry,
+   char                    *dumpTarget
+)
+{
+   wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                regValue    = 0;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Channel register dump for %s, base address 0x%x", 
+                   channelType[channelEntry->channelType],
+                   dumpTarget,
+                   channelEntry->channelRegister.chDXEBaseAddr);
+   regValue = 0;
+   wpalReadRegister(channelEntry->channelRegister.chDXECtrlRegAddr, &regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Control Register 0x%x", regValue);
+
+   regValue = 0;
+   wpalReadRegister(channelEntry->channelRegister.chDXEStatusRegAddr, &regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Status Register 0x%x", regValue);
+   regValue = 0;
+
+   wpalReadRegister(channelEntry->channelRegister.chDXESadrlRegAddr, &regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Source Address Register 0x%x", regValue);
+   regValue = 0;
+
+   wpalReadRegister(channelEntry->channelRegister.chDXEDadrlRegAddr, &regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Destination Address Register 0x%x", regValue);
+   regValue = 0;
+
+   wpalReadRegister(channelEntry->channelRegister.chDXELstDesclRegAddr, &regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Descriptor Address Register 0x%x", regValue);
+
+   return status;
+}
+#endif /* WLANDXE_DEBUG_CH_INFO_DUMP */
+
+/*==========================================================================
+  @  Function Name 
+      dxeCtrlBlkAlloc
+
+  @  Description 
+      Allocate DXE Control block
+      DXE control block will used by Host DXE driver only, internal structure
+      Will make ring linked list
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeCtrlBlkAlloc
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   unsigned int              idx, fIdx;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
+   WLANDXE_DescCtrlBlkType  *freeCtrlBlk = NULL;
+   WLANDXE_DescCtrlBlkType  *prevCtrlBlk = NULL;
+   WLANDXE_DescCtrlBlkType  *nextCtrlBlk = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity check */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeCtrlBlkAlloc Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /* Allocate pre asigned number of control blocks */
+   for(idx = 0; idx < channelEntry->numDesc; idx++)
+   {
+      currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)wpalMemoryAllocate(sizeof(WLANDXE_DescCtrlBlkType));
+      if(NULL == currentCtrlBlk)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeCtrlBlkOpen MemAlloc Fail for channel %d",
+                  channelEntry->channelType);
+         freeCtrlBlk = channelEntry->headCtrlBlk;
+         for(fIdx = 0; fIdx < idx; fIdx++)
+         {
+            if(NULL == freeCtrlBlk)
+            {
+               break;
+            }
+
+            nextCtrlBlk = freeCtrlBlk->nextCtrlBlk;
+            wpalMemoryFree((void *)freeCtrlBlk);
+            freeCtrlBlk = nextCtrlBlk;
+         }
+         return eWLAN_PAL_STATUS_E_FAULT;
+      }
+
+      memset((wpt_uint8 *)currentCtrlBlk, 0, sizeof(WLANDXE_DescCtrlBlkType));
+      /* Initialize common elements first */
+      currentCtrlBlk->xfrFrame          = NULL;
+      currentCtrlBlk->linkedDesc        = NULL;
+      currentCtrlBlk->linkedDescPhyAddr = 0;
+      currentCtrlBlk->ctrlBlkOrder      = idx;
+
+      /* This is the first control block allocated
+       * Next Control block is not allocated yet
+       * head and tail must be first control block */
+      if(0 == idx)
+      {
+         currentCtrlBlk->nextCtrlBlk = NULL;
+         channelEntry->headCtrlBlk   = currentCtrlBlk;
+         channelEntry->tailCtrlBlk   = currentCtrlBlk;
+      }
+      /* This is not first, not last control block
+       * previous control block may has next linked block */
+      else if((0 < idx) && (idx < (channelEntry->numDesc - 1)))
+      {
+         prevCtrlBlk->nextCtrlBlk = currentCtrlBlk;
+      }
+      /* This is last control blocl
+       * next control block for the last control block is head, first control block
+       * then whole linked list made RING */
+      else if((channelEntry->numDesc - 1) == idx)
+      {
+         prevCtrlBlk->nextCtrlBlk    = currentCtrlBlk;
+         currentCtrlBlk->nextCtrlBlk = channelEntry->headCtrlBlk;
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeCtrlBlkOpen Invalid Ctrl Blk location %d",
+                  channelEntry->channelType);
+         wpalMemoryFree(currentCtrlBlk);
+         return eWLAN_PAL_STATUS_E_FAULT;
+      }
+
+      prevCtrlBlk = currentCtrlBlk;
+      channelEntry->numFreeDesc++;
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,"%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeDescLinkAlloc
+
+  @  Description 
+      Allocate DXE descriptor
+      DXE descriptor will be shared by DXE host driver and RIVA DXE engine
+      Will make RING linked list
+      Will be linked with Descriptor control block one by one
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeDescAllocAndLink
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_DescType         *currentDesc = NULL;
+   WLANDXE_DescType         *prevDesc    = NULL;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
+   unsigned int              idx;
+   void                     *physAddress = NULL;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   WLANDXE_ChannelCBType    *testTXChannelCB = &dxeCtrlBlk->dxeChannel[WDTS_CHANNEL_H2H_TEST_TX];
+   WLANDXE_DescCtrlBlkType  *currDescCtrlBlk = testTXChannelCB->headCtrlBlk;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE*/
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeDescLinkAlloc Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   currentCtrlBlk = channelEntry->headCtrlBlk;
+
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
+   /* allocate all DXE descriptors for this channel in one chunk */
+   channelEntry->descriptorAllocation = (WLANDXE_DescType *)
+      wpalDmaMemoryAllocate(sizeof(WLANDXE_DescType)*channelEntry->numDesc,
+                            &physAddress);
+   if(NULL == channelEntry->descriptorAllocation)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeDescLinkAlloc Descriptor Alloc Fail");
+      return eWLAN_PAL_STATUS_E_RESOURCES;
+   }
+   currentDesc = channelEntry->descriptorAllocation;
+#endif
+
+   /* Allocate pre asigned number of descriptor */
+   for(idx = 0; idx < channelEntry->numDesc; idx++)
+   {
+#ifndef FEATURE_R33D
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+      // descriptors were allocated in a chunk -- use the current one
+      memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+#else
+      if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
+      {
+         // allocate a descriptor
+         currentDesc = (WLANDXE_DescType *)wpalDmaMemoryAllocate(sizeof(WLANDXE_DescType),
+                                                                 &physAddress);
+         memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+      }
+      else
+      {
+         currentDesc     = currDescCtrlBlk->linkedDesc;
+         physAddress     = (void *)currDescCtrlBlk->linkedDescPhyAddr;
+         currDescCtrlBlk = (WLANDXE_DescCtrlBlkType *)currDescCtrlBlk->nextCtrlBlk;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+#else
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+      currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddress);
+      memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+#else
+      if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
+      {
+         currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddress);
+         memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+                  "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+      }
+      else
+      {
+         currentDesc     = currDescCtrlBlk->linkedDesc;
+         physAddress     = (void *)currDescCtrlBlk->linkedDescPhyAddr;
+         currDescCtrlBlk = (WLANDXE_DescCtrlBlkType *)currDescCtrlBlk->nextCtrlBlk;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+#endif /* FEATURE_R33D */
+      if(NULL == currentDesc)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeDescLinkAlloc MemAlloc Fail for channel %d",
+                  channelEntry->channelType);
+         return eWLAN_PAL_STATUS_E_FAULT;
+      }
+
+      if((WDTS_CHANNEL_TX_LOW_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+      {
+         currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_write;
+         currentDesc->dxedesc.dxe_short_desc.dstMemAddrL = channelEntry->extraConfig.refWQ_swapped;
+      }
+      else if((WDTS_CHANNEL_RX_LOW_PRI == channelEntry->channelType) ||
+              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+      {
+         currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_read;
+         currentDesc->dxedesc.dxe_short_desc.srcMemAddrL = channelEntry->extraConfig.refWQ_swapped;
+      }
+      else
+      {
+         /* Just in case. H2H Test RX channel, do nothing
+          * By Definition this must not happen */
+      }
+
+      currentCtrlBlk->linkedDesc        = currentDesc;
+      currentCtrlBlk->linkedDescPhyAddr = (unsigned int)physAddress;
+      /* First descriptor, next none
+       * descriptor bottom location is first descriptor address */
+      if(0 == idx)
+      {
+         currentDesc->dxedesc.dxe_short_desc.phyNextL = 0;
+         channelEntry->DescBottomLoc                  = currentDesc;
+         channelEntry->descBottomLocPhyAddr           = (unsigned int)physAddress;
+      }
+      /* Not first, not last descriptor
+       * may make link for previous descriptor with current descriptor
+       * ENDIAN SWAP needed ????? */
+      else if((0 < idx) && (idx < (channelEntry->numDesc - 1)))
+      {
+         prevDesc->dxedesc.dxe_short_desc.phyNextL = 
+                                  WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)physAddress);
+      }
+      /* Last descriptor
+       * make a ring by asign next pointer as first descriptor
+       * ENDIAN SWAP NEEDED ??? */
+      else if((channelEntry->numDesc - 1) == idx)
+      {
+         prevDesc->dxedesc.dxe_short_desc.phyNextL    = 
+                                  WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)physAddress);
+         currentDesc->dxedesc.dxe_short_desc.phyNextL =
+                                  WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)channelEntry->headCtrlBlk->linkedDescPhyAddr);
+      }
+
+      /* If Current Channel is RX channel PAL Packet and OS packet buffer should be
+       * Pre allocated and physical address must be assigned into
+       * Corresponding DXE Descriptor */
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+         (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_H2H_TEST_RX == channelEntry->channelType))
+#else
+      if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+         (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+      {
+         status = dxeRXFrameSingleBufferAlloc(dxeCtrlBlk,
+                                              channelEntry,
+                                              currentCtrlBlk);
+         if( !WLAN_PAL_IS_STATUS_SUCCESS(status) )
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeDescLinkAlloc RX Buffer Alloc Fail for channel %d",
+                     channelEntry->channelType);
+            return status;
+         }
+         --channelEntry->numFreeDesc;
+      }
+
+      currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
+      prevDesc       = currentDesc;
+
+#ifndef FEATURE_R33D
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+      // advance to the next pre-allocated descriptor in the chunk
+      currentDesc++;
+      physAddress = ((wpt_int8 *)physAddress) + sizeof(WLANDXE_DescType);
+#endif
+#endif
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name
+
+  @  Description 
+
+  @  Parameters
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeSetInterruptPath
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk
+)
+{
+   wpt_status                 status        = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                 interruptPath = 0;
+   wpt_uint32                 idx;
+   WLANDXE_ChannelCBType     *channelEntry = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      channelEntry = &dxeCtrlBlk->dxeChannel[idx];
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      if((WDTS_CHANNEL_TX_LOW_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_H2H_TEST_TX == channelEntry->channelType))
+#else
+      if((WDTS_CHANNEL_TX_LOW_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+      {
+         interruptPath |= (1 << channelEntry->assignedDMAChannel);
+      }
+      else if((WDTS_CHANNEL_RX_LOW_PRI == channelEntry->channelType) ||
+              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+      {
+         interruptPath |= (1 << (channelEntry->assignedDMAChannel + 16));
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "H2H TEST RX???? %d", channelEntry->channelType);
+      }
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "Interrupt Path Must be 0x%x", interruptPath);
+   dxeCtrlBlk->interruptPath = interruptPath;
+   wpalWriteRegister(WLANDXE_CCU_DXE_INT_SELECT, interruptPath);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name
+      dxeEngineCoreStart 
+
+  @  Description 
+      Trigger to start RIVA DXE Hardware
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeEngineCoreStart
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk
+)
+{
+   wpt_status                 status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                 registerData = 0;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* START This core init is not needed for the integrated system */
+   /* Reset First */
+   registerData = WLANDXE_DMA_CSR_RESET_MASK;
+   wpalWriteRegister(WALNDEX_DMA_CSR_ADDRESS,
+                          registerData);
+
+   registerData  = WLANDXE_DMA_CSR_EN_MASK;  
+   registerData |= WLANDXE_DMA_CSR_ECTR_EN_MASK;
+   registerData |= WLANDXE_DMA_CSR_TSTMP_EN_MASK;
+   registerData |= WLANDXE_DMA_CSR_H2H_SYNC_EN_MASK;
+
+   registerData = 0x00005c89;
+   wpalWriteRegister(WALNDEX_DMA_CSR_ADDRESS,
+                          registerData);
+
+   /* Is This needed?
+    * Not sure, revisit with integrated system */
+   /* END This core init is not needed for the integrated system */
+
+   dxeSetInterruptPath(dxeCtrlBlk);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelInitProgram
+
+  @  Description 
+      Program RIVA DXE engine register with initial value
+      What must be programmed
+         - Source Address             (SADRL, chDXESadrlRegAddr)
+         - Destination address        (DADRL, chDXEDadrlRegAddr)
+         - Next Descriptor address    (DESCL, chDXEDesclRegAddr)
+         - current descriptor address (LST_DESCL, chDXELstDesclRegAddr)
+
+      Not need to program now
+         - Channel Control register   (CH_CTRL, chDXECtrlRegAddr)
+           TX : Have to program to trigger send out frame
+           RX : programmed by DXE engine
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelInitProgram
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                idx;
+   WLANDXE_DescType         *currentDesc = NULL;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelInitProgram Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /* Program Source address and destination adderss */
+   if(!channelEntry->channelConfig.useShortDescFmt)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelInitProgram Long Descriptor not support yet");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   /* Common register area */
+   /* Next linked list Descriptor pointer */
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
+                                   channelEntry->headCtrlBlk->linkedDescPhyAddr);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelInitProgram Write DESC Address register fail");
+      return status;
+   }
+
+   if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+   {
+      /* Program default registers */
+      /* TX DMA channel, DMA destination address is work Q */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      channelEntry->channelConfig.refWQ);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write TX DAddress register fail");
+         return status;
+      }
+   }
+   else if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+   {
+      /* Initialize Descriptor control Word First */
+      currentCtrlBlk = channelEntry->headCtrlBlk;
+      for(idx = 0; idx < channelEntry->channelConfig.nDescs; idx++)
+      {
+         currentDesc = currentCtrlBlk->linkedDesc;
+         currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;         
+      }
+
+      /* RX DMA channel, DMA source address is work Q */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXESadrlRegAddr,
+                                      channelEntry->channelConfig.refWQ);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write RX SAddress WQ register fail");
+         return status;
+      }
+
+      /* RX DMA channel, Program pre allocated destination Address */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      WLANDXE_U32_SWAP_ENDIAN(channelEntry->DescBottomLoc->dxedesc.dxe_short_desc.phyNextL));
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write RX DAddress register fail");
+         return status;
+      }
+
+      /* RX Channels, default Control registers MUST BE ENABLED */
+      wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+                             channelEntry->extraConfig.chan_mask);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write RX Control register fail");
+         return status;
+      }
+   }
+   else
+   {
+      /* H2H test channel, not use work Q */
+      /* Program pre allocated destination Address */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      WLANDXE_U32_SWAP_ENDIAN(channelEntry->DescBottomLoc->dxedesc.dxe_short_desc.phyNextL));
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write RX DAddress register fail");
+         return status;
+      }
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelStart
+
+  @  Description 
+      Start Specific Channel
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelStart
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                regValue   = 0;
+   wpt_uint32                intMaskVal = 0;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   channelEntry->extraConfig.chEnabled    = eWLAN_PAL_TRUE;
+   channelEntry->extraConfig.chConfigured = eWLAN_PAL_TRUE;
+
+   /* Enable individual channel
+    * not to break current channel setup, first read register */
+   status = wpalReadRegister(WALNDEX_DMA_CH_EN_ADDRESS,
+                                  &regValue);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStart Read Channel Enable register fail");
+      return status;
+   }
+
+   /* Enable Channel specific Interrupt */
+   status = wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS,
+                                  &intMaskVal);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStart Read INT_MASK register fail");
+      return status;         
+   }
+   intMaskVal |= channelEntry->extraConfig.intMask;
+   status = wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS,
+                                   intMaskVal);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStart Write INT_MASK register fail");
+      return status;         
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name
+      dxeChannelStop
+
+  @  Description 
+      Stop Specific Channel
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelStop
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                intMaskVal = 0;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStop Invalid arg input");
+      return eWLAN_PAL_STATUS_E_INVAL; 
+   }
+
+   /* Maskout interrupt */
+   status = wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS,
+                                  &intMaskVal);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStop Read INT_MASK register fail");
+      return status;         
+   }
+   intMaskVal ^= channelEntry->extraConfig.intMask;
+   status = wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS,
+                                   intMaskVal);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStop Write INT_MASK register fail");
+      return status;         
+   }
+
+   channelEntry->extraConfig.chEnabled    = eWLAN_PAL_FALSE;
+
+   /* Stop Channel ??? */
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelClose
+
+  @  Description 
+      Close Specific Channel
+      Free pre allocated RX frame buffer if RX channel
+      Free DXE descriptor for each channel
+      Free Descriptor control block for each channel
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelClose
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status            = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                idx;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk    = NULL;
+   WLANDXE_DescCtrlBlkType  *nextCtrlBlk       = NULL;
+   WLANDXE_DescType         *currentDescriptor = NULL;
+   WLANDXE_DescType         *nextDescriptor    = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelStop Invalid arg input");
+      return eWLAN_PAL_STATUS_E_INVAL; 
+   }
+
+   currentCtrlBlk    = channelEntry->headCtrlBlk;
+   if(NULL != currentCtrlBlk)
+   {
+      currentDescriptor = currentCtrlBlk->linkedDesc;
+      for(idx = 0; idx < channelEntry->numDesc; idx++)
+      {
+          if (idx + 1 != channelEntry->numDesc)
+          {
+              nextCtrlBlk    = currentCtrlBlk->nextCtrlBlk;
+              nextDescriptor = nextCtrlBlk->linkedDesc;
+          }
+          else
+          {
+              nextCtrlBlk = NULL;
+              nextDescriptor = NULL;
+          }
+          if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+             (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+          {
+            if (NULL != currentCtrlBlk->xfrFrame)
+            {
+               wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+               wpalPacketFree(currentCtrlBlk->xfrFrame);
+            }
+         }
+         /*  
+          *  It is the responsibility of DXE to walk through the 
+          *  descriptor chain and unlock any pending packets (if 
+          *  locked). 
+          */
+         if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+            (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+         {
+             if((NULL != currentCtrlBlk->xfrFrame) && 
+                     (eWLAN_PAL_STATUS_SUCCESS == wpalIsPacketLocked(currentCtrlBlk->xfrFrame)))
+               {
+                  wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+                  wpalPacketFree(currentCtrlBlk->xfrFrame);
+               }
+         }
+#if (defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
+         // descriptors allocated individually so free them individually
+         wpalDmaMemoryFree(currentDescriptor);
+#endif
+         wpalMemoryFree(currentCtrlBlk);
+
+         currentCtrlBlk    = nextCtrlBlk;
+         currentDescriptor = nextDescriptor;
+      }
+   }
+
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
+   // descriptors were allocated as a single chunk so free the chunk
+   if(NULL != channelEntry->descriptorAllocation)
+   {
+      wpalDmaMemoryFree(channelEntry->descriptorAllocation);
+   }
+#endif
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name
+      dxeChannelCleanInt
+
+  @  Description 
+      Clean up interrupt from RIVA HW
+      After Host finish to handle interrupt, interrupt signal must be cleaned up
+      Otherwise next interrupt will not be generated
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+      wpt_uint32              *chStat
+                               Channel Status register value
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeChannelCleanInt
+(
+   WLANDXE_ChannelCBType   *channelEntry,
+   wpt_uint32              *chStat
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Read Channel Status Register to know why INT Happen */
+   status = wpalReadRegister(channelEntry->channelRegister.chDXEStatusRegAddr,
+                                  chStat);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelCleanInt Read CH STAT register fail");
+      return eWLAN_PAL_STATUS_E_FAULT;         
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Channel INT Clean, Status 0x%x",
+            channelType[channelEntry->channelType], *chStat);
+
+   /* Clean up all the INT within this channel */
+   status = wpalWriteRegister(WLANDXE_INT_CLR_ADDRESS,
+                                   (1 << channelEntry->assignedDMAChannel));
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelCleanInt Write CH Clean register fail");
+      return eWLAN_PAL_STATUS_E_FAULT;         
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXPacketAvailableCB
+
+  @  Description 
+      If RX frame handler encounts RX buffer pool empty condition,
+      DXE RX handle loop will be blocked till get available RX buffer pool.
+      When new RX buffer pool available, Packet available CB function will
+      be called.
+
+  @  Parameters
+   wpt_packet   *freePacket
+                Newly allocated RX buffer
+   v_VOID_t     *usrData
+                DXE context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeRXPacketAvailableCB
+(
+   wpt_packet   *freePacket,
+   v_VOID_t     *usrData
+)
+{
+   WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
+   wpt_status                status;
+
+   /* Simple Sanity */
+   if((NULL == freePacket) || (NULL == usrData))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "Get Free RX Buffer fail, Critical Error");
+      HDXE_ASSERT(0);
+      return;
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)usrData;
+
+   if(WLANDXE_CTXT_COOKIE != dxeCtxt->dxeCookie)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "DXE Context data corrupted, Critical Error");
+      HDXE_ASSERT(0);
+      return;
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "DXE RX packet available, post MSG to RX Thread");
+
+   dxeCtxt->freeRXPacket = freePacket;
+
+   /* Serialize RX Packet Available message upon RX thread */
+   HDXE_ASSERT(NULL != dxeCtxt->rxPktAvailMsg);
+
+   status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
+                          dxeCtxt->rxPktAvailMsg);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_ASSERT(eWLAN_PAL_STATUS_SUCCESS == status);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "dxeRXPacketAvailableCB serialize fail");
+   }
+
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXFrameSingleBufferAlloc
+
+  @  Description 
+      Allocate Platform packet buffer to prepare RX frame
+      RX frame memory space must be pre allocted and must be asigned to
+      descriptor
+      then whenever DMA engine want to tranfer frame from BMU,
+      buffer must be ready
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+      WLANDXE_DescCtrlBlkType  currentCtrlBlock
+                               current control block which have to be asigned 
+                               frame buffer
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeRXFrameSingleBufferAlloc
+(
+   WLANDXE_CtrlBlkType      *dxeCtxt,
+   WLANDXE_ChannelCBType    *channelEntry,
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlock
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_packet               *currentPalPacketBuffer = NULL;
+   WLANDXE_DescType         *currentDesc            = NULL;
+#ifdef FEATURE_R33D
+   wpt_uint32                virtualAddressPCIe;
+   wpt_uint32                physicalAddressPCIe;   
+#else
+   wpt_iterator              iterator;
+   wpt_uint32                allocatedSize          = 0;
+   void                     *physAddress            = NULL;
+#endif /* FEATURE_R33D */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if((NULL == dxeCtxt) || (NULL == channelEntry) || (NULL == currentCtrlBlock))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelInitProgram Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   currentDesc            = currentCtrlBlock->linkedDesc;
+
+   /* First check if a packet pointer has already been provided by a previously
+      invoked Rx packet available callback. If so use that packet. */
+   if(dxeCtxt->rxPalPacketUnavailable && (NULL != dxeCtxt->freeRXPacket))
+   {
+      currentPalPacketBuffer = dxeCtxt->freeRXPacket;
+      dxeCtxt->rxPalPacketUnavailable = eWLAN_PAL_FALSE;
+      dxeCtxt->freeRXPacket = NULL;
+   }
+   else if(!dxeCtxt->rxPalPacketUnavailable)
+   {
+   /* Allocate platform Packet buffer and OS Frame Buffer at here */
+   currentPalPacketBuffer = wpalPacketAlloc(eWLAN_PAL_PKT_TYPE_RX_RAW,
+                                            WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE,
+                                            dxeRXPacketAvailableCB,
+                                            (void *)dxeCtxt);
+
+      if(NULL == currentPalPacketBuffer)
+      {
+         dxeCtxt->rxPalPacketUnavailable = eWLAN_PAL_TRUE;
+      }
+   }
+   
+   if(NULL == currentPalPacketBuffer)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "!!! RX PAL Packet Alloc Fail, packet will be queued when the callback is invoked !!!");
+      return eWLAN_PAL_STATUS_E_RESOURCES;
+   }
+
+   currentCtrlBlock->xfrFrame       = currentPalPacketBuffer;
+   currentPalPacketBuffer->pktType  = eWLAN_PAL_PKT_TYPE_RX_RAW;
+   currentPalPacketBuffer->pBD      = NULL;
+   currentPalPacketBuffer->pBDPhys  = NULL;
+   currentPalPacketBuffer->BDLength = 0;
+#ifdef FEATURE_R33D
+   status = wpalAllocateShadowRxFrame(currentPalPacketBuffer,
+                                           &physicalAddressPCIe,
+                                           &virtualAddressPCIe);
+   HDXE_ASSERT(0 != physicalAddressPCIe);
+   HDXE_ASSERT(0 != virtualAddressPCIe);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "RX Shadow Memory Va 0x%x, Pa 0x%x",
+            virtualAddressPCIe, physicalAddressPCIe);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameBufferAlloc Shadow Mem Alloc fail");
+      return status;
+   }
+   currentCtrlBlock->shadowBufferVa = virtualAddressPCIe;
+   currentPalPacketBuffer->pBDPhys  = (void *)physicalAddressPCIe;
+   memset((wpt_uint8 *)currentCtrlBlock->shadowBufferVa, 0, WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+#else
+   status = wpalLockPacketForTransfer(currentPalPacketBuffer);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameBufferAlloc unable to lock packet");
+      return status;
+   }
+
+   /* Init iterator to get physical os buffer address */
+   status = wpalIteratorInit(&iterator, currentPalPacketBuffer);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameBufferAlloc iterator init fail");
+      return status;
+   }
+   status = wpalIteratorNext(&iterator,
+                             currentPalPacketBuffer,
+                             &physAddress,
+                             &allocatedSize);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameBufferAlloc iterator Get Next pointer fail");
+      return status;
+   }
+   currentPalPacketBuffer->pBDPhys = physAddress;
+#endif /* FEATURE_R33D */
+
+   /* DXE descriptor must have SWAPPED addres in it's structure
+    * !!! SWAPPED !!! */
+   currentDesc->dxedesc.dxe_short_desc.dstMemAddrL =
+                                       WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)currentPalPacketBuffer->pBDPhys);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXFrameRefillRing
+
+  @  Description 
+      Allocate Platform packet buffers to try to fill up the DXE Rx ring
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+      
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeRXFrameRefillRing
+(
+   WLANDXE_CtrlBlkType      *dxeCtxt,
+   WLANDXE_ChannelCBType    *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = channelEntry->tailCtrlBlk;
+   WLANDXE_DescType         *currentDesc    = NULL;
+
+   while(channelEntry->numFreeDesc > 0)
+   {
+      /* Current Control block is free
+       * and associated frame buffer is not linked with control block anymore
+       * allocate new frame buffer for current control block */
+      status = dxeRXFrameSingleBufferAlloc(dxeCtxt,
+                                           channelEntry,
+                                           currentCtrlBlk);
+
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "dxeRXFrameRefillRing, out of RX buffer pool, break here");
+         break;
+      }
+
+      currentDesc = currentCtrlBlk->linkedDesc;
+      currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_read;
+
+      /* Issue a dummy read from the DXE descriptor DDR location to ensure
+         that any posted writes are reflected in memory before DXE looks at
+         the descriptor. */
+      if(channelEntry->extraConfig.cw_ctrl_read != currentDesc->descCtrl.ctrl)
+      {
+         //HDXE_ASSERT(0);
+      }
+
+      /* Kick off the DXE ring, if not in any power save mode */
+      if((WLANDXE_POWER_STATE_IMPS != dxeCtxt->hostPowerState) &&
+         (WLANDXE_POWER_STATE_DOWN != dxeCtxt->hostPowerState))
+      {
+         wpalWriteRegister(WALNDEX_DMA_ENCH_ADDRESS,
+                           1 << channelEntry->assignedDMAChannel);
+      }
+      currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
+      --channelEntry->numFreeDesc;
+   }
+   
+   channelEntry->tailCtrlBlk = currentCtrlBlk;
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXFrameReady
+
+  @  Description 
+      Pop frame from descriptor and route frame to upper transport layer
+      Assign new platform packet buffer into used descriptor
+      Actual frame pop and resource realloc
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeRXFrameReady
+(
+   WLANDXE_CtrlBlkType     *dxeCtxt,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
+   WLANDXE_DescType         *currentDesc    = NULL;
+   wpt_uint32                descCtrl;
+   wpt_uint32                frameCount = 0;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if((NULL == dxeCtxt) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameReady Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   currentCtrlBlk = channelEntry->headCtrlBlk;
+   currentDesc    = currentCtrlBlk->linkedDesc;
+
+   /* Descriptoe should be SWAPPED ???? */
+   descCtrl = currentDesc->descCtrl.ctrl;
+
+   /* Get frames while VALID bit is not set (DMA complete) and a data 
+    * associated with it */
+   while(!(WLANDXE_U32_SWAP_ENDIAN(descCtrl) & WLANDXE_DESC_CTRL_VALID) &&
+         (eWLAN_PAL_STATUS_SUCCESS == wpalIsPacketLocked(currentCtrlBlk->xfrFrame)))
+   {
+      channelEntry->numTotalFrame++;
+      channelEntry->numFreeDesc++;
+#ifdef FEATURE_R33D
+      /* Transfer Size should be */
+      currentDesc->xfrSize = WLANDXE_U32_SWAP_ENDIAN(WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      status = wpalPrepareRxFrame(&currentCtrlBlk->xfrFrame,
+                                       (wpt_uint32)currentCtrlBlk->xfrFrame->pBDPhys,
+                                       currentCtrlBlk->shadowBufferVa,
+                                       WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady Prepare RX Frame fail");
+         return status;
+      }
+      status = wpalFreeRxFrame(currentCtrlBlk->shadowBufferVa);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady Free Shadow RX Frame fail");
+         return status;
+      }
+
+#else /* FEATURE_R33D */
+      status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+      if (eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady unable to unlock packet");
+         return status;
+      }
+#endif /* FEATURE_R33D */
+      if(NULL == dxeCtxt->rxReadyCB)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady rxReadyCB function is not registered");
+         return eWLAN_PAL_STATUS_E_INVAL;
+      }
+      /* This Descriptor is valid, so linked Control block is also valid
+       * Linked Control block has pre allocated packet buffer
+       * So, just let upper layer knows preallocated frame pointer will be OK */
+      frameCount++;
+      dxeCtxt->rxReadyCB(dxeCtxt->clientCtxt,
+                         currentCtrlBlk->xfrFrame,
+                         channelEntry->channelType);
+
+      /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
+      dxeRXFrameRefillRing(dxeCtxt,channelEntry);
+
+      /* Test next contorl block
+       * if valid, this control block also has new RX frame must be handled */
+      currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)currentCtrlBlk->nextCtrlBlk;
+      currentDesc    = currentCtrlBlk->linkedDesc;
+      descCtrl       = currentDesc->descCtrl.ctrl;
+   }
+
+   channelEntry->numFragmentCurrentChain = frameCount;
+   /* Update head control block
+    * current control block's valid bit was 0
+    * next trial first control block must be current control block */
+   channelEntry->headCtrlBlk = currentCtrlBlk;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeNotifySmsm
+
+  @  Description: Notify SMSM to start DXE engine and/or condition of Tx ring
+  buffer 
+
+  @  Parameters
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+static wpt_status dxeNotifySmsm
+(
+  wpt_boolean kickDxe,
+  wpt_boolean ringEmpty
+)
+{
+   wpt_uint32 clrSt = 0;
+   wpt_uint32 setSt = 0;
+
+   if(kickDxe)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "Kick off DXE");
+
+     if(tempDxeCtrlBlk->lastKickOffDxe == 0)
+     {
+       setSt |= WPAL_SMSM_WLAN_TX_ENABLE; 
+       tempDxeCtrlBlk->lastKickOffDxe = 1;
+     }
+     else if(tempDxeCtrlBlk->lastKickOffDxe == 1)
+     {
+       clrSt |= WPAL_SMSM_WLAN_TX_ENABLE;
+       tempDxeCtrlBlk->lastKickOffDxe = 0;
+     }
+     else
+     {
+       HDXE_ASSERT(0);
+     }
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "no need to kick off DXE");
+   }
+
+   if(ringEmpty)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "SMSM Tx Ring Empty");
+     clrSt |= WPAL_SMSM_WLAN_TX_RINGS_EMPTY; 
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "SMSM Tx Ring Not Empty");
+     setSt |= WPAL_SMSM_WLAN_TX_RINGS_EMPTY; 
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH, "C%x S%x", clrSt, setSt);
+
+   wpalNotifySmsm(clrSt, setSt);
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxePsComplete
+
+  @  Description: Utility function to check the resv desc to deside if we can
+  get into Power Save mode now 
+
+  @  Parameters
+
+  @  Return
+      None
+
+===========================================================================*/
+static void dxePsComplete(WLANDXE_CtrlBlkType *dxeCtxt, wpt_boolean intr_based)
+{
+   if( dxeCtxt->hostPowerState == WLANDXE_POWER_STATE_FULL )
+   {
+     return;
+   }
+
+   //if both HIGH & LOW Tx channels don't have anything on resv desc,all Tx pkts
+   //must have been consumed by RIVA, OK to get into BMPS
+   if((0 == dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc) &&
+      (0 == dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc))
+   {
+      tempDxeCtrlBlk->ringNotEmpty = eWLAN_PAL_FALSE;
+      //if host is in BMPS & no pkt to Tx, RIVA can go to power save
+      if(WLANDXE_POWER_STATE_BMPS == dxeCtxt->hostPowerState)
+      {
+         dxeCtxt->rivaPowerState = WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN;
+         dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+      }
+   }
+   else //still more pkts to be served by RIVA
+   {
+      tempDxeCtrlBlk->ringNotEmpty = eWLAN_PAL_TRUE;
+
+      switch(dxeCtxt->rivaPowerState)
+      {
+         case WLANDXE_RIVA_POWER_STATE_ACTIVE:
+            //NOP
+            break;
+         case WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN:
+            if(intr_based)
+            {
+               dxeCtxt->rivaPowerState = WLANDXE_RIVA_POWER_STATE_ACTIVE;
+               dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
+            }
+            break;
+         default:
+            //assert
+            break;
+      }
+   }
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXEventHandler
+
+  @  Description 
+      Handle serailized RX frame ready event
+      First disable interrupt then pick up frame from pre allocated buffer
+      Since frame handle is doen, clear interrupt bit to ready next interrupt
+      Finally re enable interrupt
+
+  @  Parameters
+      wpt_msg   *rxReadyMsg
+                 RX frame ready MSG pointer
+                 include DXE control context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeRXEventHandler
+(
+   wpt_msg                 *rxReadyMsg
+)
+{
+   wpt_msg                  *msgContent = (wpt_msg *)rxReadyMsg;
+   WLANDXE_CtrlBlkType      *dxeCtxt    = NULL;
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                intSrc     = 0;
+   WLANDXE_ChannelCBType    *channelCb  = NULL;
+   wpt_uint32                chHighStat;
+   wpt_uint32                chLowStat;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if(NULL == rxReadyMsg)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXEventHandler Channel Entry is not valid");
+      return;
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
+      
+   if((!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chEnabled) ||
+      (!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chEnabled))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+         "DXE already stopped in RX event handler. Just return");
+      return;
+   }
+
+   if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
+      (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+         "%s Riva is in %d, Just Pull frames without any register touch ",
+           __FUNCTION__, dxeCtxt->hostPowerState);
+
+      /* Not to touch any register, just pull frame directly from chain ring
+       * First high priority */
+      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
+      status = dxeRXFrameReady(dxeCtxt,
+                               channelCb);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler Pull from RX high channel fail");        
+      }
+
+       /* Second low priority */
+      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
+      status = dxeRXFrameReady(dxeCtxt,
+                               channelCb);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler Pull from RX low channel fail");        
+      }
+
+      /* Interrupt will not enabled at here, it will be enabled at PS mode change */
+      tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
+
+      return;
+   }
+
+   /* Disable device interrupt */
+   /* Read whole interrupt mask register and exclusive only this channel int */
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                             &intSrc);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXEventHandler Read INT_SRC register fail");
+      return;         
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "RX Event Handler INT Source 0x%x", intSrc);
+
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+   /* Test High Priority Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chHighStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chHighStat)
+      {
+         /* Error Happen during transaction, Handle it */
+      }
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chHighStat)
+      {
+         /* Handle RX Ready for high priority channel */
+         status = dxeRXFrameReady(dxeCtxt,
+                                  channelCb);
+      }
+      else if(WLANDXE_CH_STAT_MASKED_MASK & chHighStat)
+      {
+         status = dxeRXFrameReady(dxeCtxt,
+                                  channelCb);
+      }
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "RX HIGH CH EVNT STAT 0x%x, %d frames handled", chHighStat, channelCb->numFragmentCurrentChain);
+   }
+#else
+   /* Test H2H Test interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_H2H_TEST_RX];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         /* Error Happen during transaction, Handle it */
+      }
+      else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
+      {
+         /* Handle RX Ready for high priority channel */
+         status = dxeRXFrameReady(dxeCtxt,
+                                  channelCb);
+      }
+      /* Update the Rx DONE histogram */
+      channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
+      if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         channelCb->rxDoneHistogram |= 1;
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "DXE Channel Number %d, Rx DONE Histogram 0x%016llx",
+            channelCb->assignedDMAChannel, channelCb->rxDoneHistogram);
+      }
+      else
+      {
+         channelCb->rxDoneHistogram &= ~1;
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+   /* Test Low Priority Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chLowStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chLowStat)
+      {
+         /* Error Happen during transaction, Handle it */
+      }
+      else if(WLANDXE_CH_STAT_INT_ED_MASK & chLowStat)
+      {
+         /* Handle RX Ready for low priority channel */
+         status = dxeRXFrameReady(dxeCtxt,
+                                  channelCb);
+      }
+
+      /* Update the Rx DONE histogram */
+      channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
+      if(WLANDXE_CH_STAT_INT_DONE_MASK & chLowStat)
+      {
+         channelCb->rxDoneHistogram |= 1;
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "DXE Channel Number %d, Rx DONE Histogram 0x%016llx",
+            channelCb->assignedDMAChannel, channelCb->rxDoneHistogram);
+      }
+      else
+      {
+         channelCb->rxDoneHistogram &= ~1;
+      }
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "RX LOW CH EVNT STAT 0x%x, %d frames handled", chLowStat, channelCb->numFragmentCurrentChain);
+   }
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXEventHandler Handle Frame Ready Fail");
+      return;         
+   }
+
+   /* Enable system level ISR */
+   /* Enable RX ready Interrupt at here */
+   status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXEventHandler Enable RX Ready interrupt fail");
+      return;         
+   }
+
+   /* Prepare Control Register EN Channel */
+   if(!(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chan_mask & WLANDXE_CH_CTRL_EN_MASK))
+   {
+      HDXE_ASSERT(0);
+   }
+   if(!(WLANDXE_CH_STAT_INT_ED_MASK & chHighStat))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+               "dxeRXEventHandler RX High, Not yet ED, re-enable CH");
+      wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].channelRegister.chDXECtrlRegAddr,
+                        dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chan_mask);
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+               "dxeRXEventHandler RX High, CH STAT = ED_MASK, will RIVA PC");
+   }
+
+   /* Prepare Control Register EN Channel */
+   if(!(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chan_mask & WLANDXE_CH_CTRL_EN_MASK))
+   {
+      HDXE_ASSERT(0);
+   }
+   if(!(WLANDXE_CH_STAT_INT_ED_MASK & chLowStat))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+               "dxeRXEventHandler RX Low, Not yet ED, re-enable CH");
+      wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].channelRegister.chDXECtrlRegAddr,
+                        dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chan_mask);
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+               "dxeRXEventHandler RX Low, CH STAT = ED_MASK, will RIVA PC");
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXPacketAvailableEventHandler
+
+  @  Description 
+      Handle serialized RX Packet Available event when the corresponding callback
+      is invoked by WPAL.
+      Try to fill up any completed DXE descriptors with available Rx packet buffer
+      pointers.
+
+  @  Parameters
+      wpt_msg   *rxPktAvailMsg
+                 RX frame ready MSG pointer
+                 include DXE control context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeRXPacketAvailableEventHandler
+(
+   wpt_msg                 *rxPktAvailMsg
+)
+{
+   WLANDXE_CtrlBlkType      *dxeCtxt    = NULL;
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_ChannelCBType    *channelCb  = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if(NULL == rxPktAvailMsg)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXPacketAvailableEventHandler Context is not valid");
+      return;
+   }
+
+   dxeCtxt    = (WLANDXE_CtrlBlkType *)(rxPktAvailMsg->pContext);
+
+   do
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "dxeRXPacketAvailableEventHandler, start refilling ring");
+
+      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
+      status = dxeRXFrameRefillRing(dxeCtxt,channelCb);
+   
+      // Wait for another callback to indicate when Rx resources are available
+      // again.
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         break;
+      }
+   
+      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
+      status = dxeRXFrameRefillRing(dxeCtxt,channelCb);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         break;
+      }
+   } while(0);
+
+   if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
+      (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
+   {
+      /* Interrupt will not enabled at here, it will be enabled at PS mode change */
+      tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
+   }
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeRXISR
+
+  @  Description 
+      RX frame ready interrupt service routine
+      interrupt entry function, this function called based on ISR context
+      Must be serialized
+
+  @  Parameters
+      void    *hostCtxt
+               DXE host driver control context,
+               pre registerd during interrupt registration
+
+  @  Return
+      NONE
+
+===========================================================================*/
+static void dxeRXISR
+(
+   void                    *hostCtxt
+)
+{
+   WLANDXE_CtrlBlkType      *dxeCtxt    = (WLANDXE_CtrlBlkType *)hostCtxt;
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+#ifdef FEATURE_R33D
+   wpt_uint32                regValue;
+#endif /* FEATURE_R33D */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity Check */
+   if(NULL == hostCtxt)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameReadyISR input is not valid");
+      return;
+   }
+
+#ifdef FEATURE_R33D
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &regValue);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompISR Read INT_SRC_RAW fail");
+      return;
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "INT_SRC_RAW 0x%x", regValue);
+   if(0 == regValue)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "This is not DXE Interrupt, Reject it 0x%x", regValue);
+      return;
+   }
+#endif /* FEATURE_R33D */
+
+   /* Disable interrupt at here
+    * Disable RX Ready system level Interrupt at here
+    * Otherwise infinite loop might happen */
+   status = wpalDisableInterrupt(DXE_INTERRUPT_RX_READY);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameReadyISR Disable RX ready interrupt fail");
+      return;         
+   }
+
+   /* Serialize RX Ready interrupt upon RX thread */
+   HDXE_ASSERT(NULL != dxeCtxt->rxIsrMsg);
+   status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
+                          dxeCtxt->rxIsrMsg);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_ASSERT(eWLAN_PAL_STATUS_SUCCESS == status);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "dxeRXFrameReadyISR interrupt serialize fail");
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeTXPushFrame
+
+  @  Description
+      Push TX frame into DXE descriptor and DXE register
+      Send notification to DXE register that TX frame is ready to transfer
+
+  @  Parameters
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+      wpt_packet              *palPacket
+                               Packet pointer ready to transfer
+
+  @  Return
+      PAL_STATUS_T
+===========================================================================*/
+static wpt_status dxeTXPushFrame
+(
+   WLANDXE_ChannelCBType   *channelEntry,
+   wpt_packet              *palPacket
+)
+{
+   wpt_status                  status = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_DescCtrlBlkType    *currentCtrlBlk = NULL;
+   WLANDXE_DescType           *currentDesc    = NULL;
+   WLANDXE_DescType           *firstDesc      = NULL;
+   WLANDXE_DescType           *LastDesc       = NULL;
+   void                       *sourcePhysicalAddress = NULL;
+   wpt_uint32                  xferSize = 0;
+#ifdef FEATURE_R33D
+   tx_frm_pcie_vector_t        frameVector;
+   wpt_uint32                  Va;
+   wpt_uint32                  fragCount = 0;
+#else
+   wpt_iterator                iterator;
+#endif /* FEATURE_R33D */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   if(WLANDXE_POWER_STATE_BMPS == tempDxeCtrlBlk->hostPowerState)
+   {
+      tempDxeCtrlBlk->rivaPowerState = WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN;
+      dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+   }
+
+   channelEntry->numFragmentCurrentChain = 0;
+   currentCtrlBlk = channelEntry->headCtrlBlk;
+
+   /* Initialize interator, TX is fragmented */
+#ifdef FEATURE_R33D
+   memset(&frameVector, 0, sizeof(tx_frm_pcie_vector_t));
+   status = wpalPrepareTxFrame(palPacket,
+                                    &frameVector,
+                                    &Va);
+#else
+   status = wpalLockPacketForTransfer(palPacket);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame unable to lock packet");
+      return status;
+   }
+
+   status = wpalIteratorInit(&iterator, palPacket);
+#endif /* FEATURE_R33D */
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame iterator init fail");
+      return status;
+   }
+
+   /* !!!! Revisit break condition !!!!!!! */
+   while(1)
+   {
+      /* Get current descriptor pointer from current control block */
+      currentDesc = currentCtrlBlk->linkedDesc;
+      if(NULL == firstDesc)
+      {
+         firstDesc = currentCtrlBlk->linkedDesc;
+      }
+      /* All control block will have same palPacket Pointer
+       * to make logic simpler */
+      currentCtrlBlk->xfrFrame = palPacket;
+
+      /* Get next fragment physical address and fragment size
+       * if this is the first trial, will get first physical address
+       * if no more fragment, Descriptor src address will be set as NULL, OK??? */
+#ifdef FEATURE_R33D
+      if(fragCount == frameVector.num_frg)
+      {
+         break;
+      }
+      currentCtrlBlk->shadowBufferVa = frameVector.frg[0].va;
+      sourcePhysicalAddress          = (void *)frameVector.frg[fragCount].pa;
+      xferSize                       = frameVector.frg[fragCount].size;
+      fragCount++;
+      HDXE_ASSERT(0 != xferSize);
+      HDXE_ASSERT(NULL != sourcePhysicalAddress);
+#else
+      status = wpalIteratorNext(&iterator,
+                                palPacket,
+                                &sourcePhysicalAddress,
+                                &xferSize);
+      if((NULL == sourcePhysicalAddress) ||
+         (0    == xferSize))
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+                  "dxeTXPushFrame end of current frame");
+         break;
+      }
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Get next frame fail");
+         return status;
+      }
+#endif /* FEATURE_R33D */
+
+      /* This is the LAST descriptor valid for this transaction */
+      LastDesc    = currentCtrlBlk->linkedDesc;
+
+      /* Program DXE descriptor */
+      currentDesc->dxedesc.dxe_short_desc.srcMemAddrL =
+                               WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)sourcePhysicalAddress);
+
+      /* Just normal data transfer from aCPU Flat Memory to BMU Q */
+      if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+         (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+      {
+         currentDesc->dxedesc.dxe_short_desc.dstMemAddrL =
+                                WLANDXE_U32_SWAP_ENDIAN(channelEntry->channelConfig.refWQ);
+      }
+      else
+      {
+         /* Test specific H2H transfer, destination address already set
+          * Do Nothing */
+      }
+      currentDesc->xfrSize = WLANDXE_U32_SWAP_ENDIAN(xferSize);
+
+      /* Program channel control register */
+      /* First frame not set VAL bit, why ??? */
+      if(0 == channelEntry->numFragmentCurrentChain)
+      {
+         currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_write;
+      }
+      else
+      {
+         currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_write_valid;
+      }
+
+      /* Update statistics */
+      channelEntry->numFragmentCurrentChain++;
+      channelEntry->numFreeDesc--;
+      channelEntry->numRsvdDesc++;
+
+      /* Get next control block */
+      currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
+   }
+   channelEntry->numTotalFrame++;
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "NUM TX FRAG %d, Total Frame %d",
+            channelEntry->numFragmentCurrentChain, channelEntry->numTotalFrame);
+
+   /* Program Channel control register
+    * Set as end of packet
+    * Enable interrupt also for first code lock down
+    * performace optimization, this will be revisited */
+   if(NULL == LastDesc)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame NULL Last Descriptor, broken chain");
+      return eWLAN_PAL_STATUS_E_FAULT;
+   }
+   LastDesc->descCtrl.ctrl  = channelEntry->extraConfig.cw_ctrl_write_eop_int;
+   /* Now First one also Valid ????
+    * this procedure will prevent over handle descriptor from previous
+    * TX trigger */
+   firstDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_write_valid;
+
+   /* If in BMPS mode no need to notify the DXE Engine, notify SMSM instead */
+   if(WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN == tempDxeCtrlBlk->rivaPowerState)
+   {
+      /* Update channel head as next avaliable linked slot */
+      channelEntry->headCtrlBlk = currentCtrlBlk;
+      tempDxeCtrlBlk->ringNotEmpty = eWLAN_PAL_TRUE;
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, "SMSM_ret LO=%d HI=%d", tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc,
+               tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc );
+      dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
+	  return status;
+   }
+
+   /* If DXE use external descriptor, registers are not needed to be programmed
+    * Just after finish to program descriptor, tirigger to send */
+   if(channelEntry->extraConfig.chan_mask & WLANDXE_CH_CTRL_EDEN_MASK)
+   {
+      /* Issue a dummy read from the DXE descriptor DDR location to
+         ensure that any previously posted write to the descriptor
+         completes. */
+      if(channelEntry->extraConfig.cw_ctrl_write_valid != firstDesc->descCtrl.ctrl)
+      {
+         //HDXE_ASSERT(0);
+      }
+
+      /* Everything is ready
+       * Trigger to start DMA */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+                                      channelEntry->extraConfig.chan_mask);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Write Channel Ctrl Register fail");
+         return status;
+      }
+
+      /* Update channel head as next avaliable linked slot */
+      channelEntry->headCtrlBlk = currentCtrlBlk;
+
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "%s Exit", __FUNCTION__);
+      return status;
+   }
+
+   /* If DXE not use external descriptor, program each registers */
+   /* Circular buffer handle not need to program DESC register???
+    * GEN5 code not programed RING buffer case
+    * REVISIT THIS !!!!!! */
+   if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+   {
+      /* Destination address, assigned Work Q */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      channelEntry->channelConfig.refWQ);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Program dest address register fail");
+         return status;
+      }
+      /* If descriptor format is SHORT */
+      if(channelEntry->channelConfig.useShortDescFmt)
+      {
+         status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrhRegAddr,
+                                         0);
+         if(eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeTXPushFrame Program dest address register fail");
+            return status;
+         }
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame LONG Descriptor Format!!!");
+      }
+   }
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   else if(WDTS_CHANNEL_H2H_TEST_TX  == channelEntry->channelType)
+   {
+      /* Destination address, Physical memory address */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      WLANDXE_U32_SWAP_ENDIAN(firstDesc->dxedesc.dxe_short_desc.dstMemAddrL));
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Program dest address register fail");
+         return status;
+      }
+      /* If descriptor format is SHORT */
+      if(channelEntry->channelConfig.useShortDescFmt)
+      {
+         status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrhRegAddr,
+                                         0);
+         if(eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeTXPushFrame Program dest address register fail");
+            return status;
+         }
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame LONG Descriptor Format!!!");
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+   /* Program Source address register
+    * This address is already programmed into DXE Descriptor
+    * But register also upadte */
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXESadrlRegAddr,
+                                   WLANDXE_U32_SWAP_ENDIAN(firstDesc->dxedesc.dxe_short_desc.srcMemAddrL));
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame Program src address register fail");
+      return status;
+   }
+   /* If descriptor format is SHORT */
+   if(channelEntry->channelConfig.useShortDescFmt)
+   {
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXESadrhRegAddr,
+                                      0);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Program dest address register fail");
+         return status;
+      }
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame LONG Descriptor Format!!!");
+   }
+
+   /* Linked list Descriptor pointer */
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
+                                   channelEntry->headCtrlBlk->linkedDescPhyAddr);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame Write DESC Address register fail");
+      return status;
+   }
+   /* If descriptor format is SHORT */
+   if(channelEntry->channelConfig.useShortDescFmt)
+   {
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDeschRegAddr,
+                                      0);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Program dest address register fail");
+         return status;
+      }
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame LONG Descriptor Format!!!");
+   }
+
+   /* Transfer Size */
+   xferSize = WLANDXE_U32_SWAP_ENDIAN(firstDesc->xfrSize);
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXESzRegAddr,
+                                   xferSize);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame Write DESC Address register fail");
+      return status;
+   }
+
+   /* Everything is ready
+    * Trigger to start DMA */
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+                                   channelEntry->extraConfig.chan_mask);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXPushFrame Write Channel Ctrl Register fail");
+      return status;
+   }
+
+   /* Update channel head as next avaliable linked slot */
+   channelEntry->headCtrlBlk = currentCtrlBlk;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeTXCompFrame
+
+  @  Description 
+      TX Frame transfer complete event handler
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      PAL_STATUS_T
+===========================================================================*/
+static wpt_status dxeTXCompFrame
+(
+   WLANDXE_CtrlBlkType     *hostCtxt,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
+   WLANDXE_DescType         *currentDesc    = NULL;
+   wpt_uint32                descCtrlValue  = 0;
+   unsigned int             *lowThreshold   = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if((NULL == hostCtxt) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompFrame Invalid ARG");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if(NULL == hostCtxt->txCompCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompFrame TXCompCB is not registered");
+      return eWLAN_PAL_STATUS_E_EMPTY;
+   }
+
+   wpalMutexAcquire(&channelEntry->dxeChannelLock);
+
+   currentCtrlBlk = channelEntry->tailCtrlBlk;
+   currentDesc    = currentCtrlBlk->linkedDesc;
+
+   if( currentCtrlBlk == channelEntry->headCtrlBlk )
+   {
+      wpalMutexRelease(&channelEntry->dxeChannelLock);
+      return eWLAN_PAL_STATUS_E_EMPTY;
+   }
+
+   /*  */
+   while(1)
+   {
+//      HDXE_ASSERT(WLAN_PAL_IS_STATUS_SUCCESS(WLAN_RivaValidateDesc(currentDesc)));
+      descCtrlValue = currentDesc->descCtrl.ctrl;
+      if((descCtrlValue & WLANDXE_DESC_CTRL_VALID))
+      {
+         /* caught up with head, bail out */
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+                  "dxeTXCompFrame caught up with head - next DESC has VALID set");
+         break;
+      }
+
+      HDXE_ASSERT(currentCtrlBlk->xfrFrame != NULL);
+      channelEntry->numFreeDesc++;
+      channelEntry->numRsvdDesc--;
+
+      /* Send Frame TX Complete notification with frame start fragment location */
+      if(WLANDXE_U32_SWAP_ENDIAN(descCtrlValue) & WLANDXE_DESC_CTRL_EOP)
+      {
+         hostCtxt->txCompletedFrames--;
+#ifdef FEATURE_R33D
+         wpalFreeTxFrame(currentCtrlBlk->shadowBufferVa);
+#else
+         status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+         if (eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeRXFrameReady unable to unlock packet");
+            wpalMutexRelease(&channelEntry->dxeChannelLock);
+            return status;
+         }
+#endif /* FEATURE_R33D */
+         hostCtxt->txCompCB(hostCtxt->clientCtxt,
+                            currentCtrlBlk->xfrFrame,
+                            eWLAN_PAL_STATUS_SUCCESS);
+         channelEntry->numFragmentCurrentChain = 0;
+      }
+      currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
+      currentDesc    = currentCtrlBlk->linkedDesc;
+
+      /* Break condition
+       * Head control block is the control block must be programed for the next TX
+       * so, head control block is not programmed control block yet
+       * if loop encounte head control block, stop to complete
+       * in theory, COMP CB must be called already ??? */
+      if(currentCtrlBlk == channelEntry->headCtrlBlk)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+                  "dxeTXCompFrame caught up with head ptr");
+         break;
+      }
+      /* VALID Bit check ???? */
+   }
+
+   /* Tail and Head Control block must be same */
+   channelEntry->tailCtrlBlk = currentCtrlBlk;
+
+   lowThreshold = channelEntry->channelType == WDTS_CHANNEL_TX_LOW_PRI?
+      &(hostCtxt->txCompInt.txLowResourceThreshold_LoPriCh):
+      &(hostCtxt->txCompInt.txLowResourceThreshold_HiPriCh);
+
+   /* If specific channel hit low resource condition send notification to upper layer */
+   if((eWLAN_PAL_TRUE == channelEntry->hitLowResource) &&
+      (channelEntry->numFreeDesc > *lowThreshold))
+   {
+      /* Change it back if we raised it for fetching a remaining packet from TL */
+      if(WLANDXE_TX_LOW_RES_THRESHOLD > *lowThreshold)
+      {
+         *lowThreshold = WLANDXE_TX_LOW_RES_THRESHOLD;
+      }
+
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "DXE TX %d channel recovered from low resource", channelEntry->channelType);
+      hostCtxt->lowResourceCB(hostCtxt->clientCtxt,
+                              channelEntry->channelType,
+                              eWLAN_PAL_TRUE);
+      channelEntry->hitLowResource = eWLAN_PAL_FALSE;
+   }
+
+   wpalMutexRelease(&channelEntry->dxeChannelLock);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeTXEventHandler
+
+  @  Description 
+      If DXE HW sends TX related interrupt, this event handler will be called
+      Handle higher priority channel first
+      Figureout why interrupt happen and call appropriate final even handler
+      TX complete or error happen
+
+  @  Parameters
+         void               *msgPtr
+                             Even MSG
+
+  @  Return
+      PAL_STATUS_T
+===========================================================================*/
+void dxeTXEventHandler
+(
+   wpt_msg               *msgPtr
+)
+{
+   wpt_msg                  *msgContent = (wpt_msg *)msgPtr;
+   WLANDXE_CtrlBlkType      *dxeCtxt    = NULL;
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                intSrc     = 0;
+   wpt_uint32                chStat     = 0;
+   WLANDXE_ChannelCBType    *channelCb  = NULL;
+
+   wpt_uint8                 bEnableISR = 0; 
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
+   /* Return from here if the RIVA is in IMPS, to avoid register access */
+   if(WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+         "%s Riva is in %d, return from here ", __FUNCTION__, dxeCtxt->hostPowerState);
+      return;
+   }
+
+   if((!dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].extraConfig.chEnabled) ||
+      (!dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].extraConfig.chEnabled))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+         "DXE already stopped in TX event handler. Just return");
+      return;
+   }
+
+   dxeCtxt->ucTxMsgCnt = 0;   
+   
+   /* Disable device interrupt */
+   /* Read whole interrupt mask register and exclusive only this channel int */
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &intSrc);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompleteEventHandler Read INT_DONE_SRC register fail");
+      return;         
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "TX Event Handler INT Source 0x%x", intSrc);
+
+   /* Test High Priority Channel is the INT source or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "dxeTXEventHandler TX HI status=%x", chStat);
+         HDXE_ASSERT(0);
+      }
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         /* Handle TX complete for high priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+      }
+      else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
+      {
+         /* Handle TX complete for high priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "dxeTXEventHandler TX HI status=%x", chStat);
+      }
+
+      if(WLANDXE_CH_STAT_MASKED_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
+                  "dxeTXEventHandler TX HIGH Channel Masked Unmask it!!!!");
+      }
+
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
+               "TX HIGH STAT 0x%x RESRVD %d", chStat, channelCb->numRsvdDesc);
+   }
+
+   /* Test Low Priority Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "dxeTXEventHandler TX LO status=%x", chStat);
+         HDXE_ASSERT(0);
+      }
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         /* Handle TX complete for low priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+      }
+      else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
+      {
+         /* Handle TX complete for low priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "dxeTXEventHandler TX LO status=%x", chStat);
+      }
+
+      if(WLANDXE_CH_STAT_MASKED_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
+                  "dxeTXEventHandler TX Low Channel Masked Unmask it!!!!");
+      }
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "TX LOW STAT 0x%x RESRVD %d", chStat, channelCb->numRsvdDesc);
+   }
+
+
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   /* Test H2H TX Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_H2H_TEST_TX];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = wpalReadRegister(channelCb->channelRegister.chDXEStatusRegAddr,
+                                     &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelCleanInt Read CH STAT register fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                  "WLANDXE_CH_STAT_INT_ERR_MASK occurred");
+         HDXE_ASSERT(0);
+      }
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         /* Handle TX complete for high priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+         if(eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeTXEventHandler INT Clean up fail");
+            return;         
+         }
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "unexpected channel state %d", chStat);
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+   if((bEnableISR || (dxeCtxt->txCompletedFrames)) &&
+      (eWLAN_PAL_FALSE == dxeCtxt->txIntEnable))
+   {
+      dxeCtxt->txIntEnable =  eWLAN_PAL_TRUE; 
+      wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "TX COMP INT Enabled, remain TX frame count on ring %d",
+               dxeCtxt->txCompletedFrames);
+   }
+
+   /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
+     the posibility of a race*/
+   dxePsComplete(dxeCtxt, eWLAN_PAL_TRUE);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+
+
+/*==========================================================================
+  @  Function Name 
+      dxeTXCompleteProcessing
+
+  @  Description 
+      If DXE HW sends TX related interrupt, this event handler will be called
+      Handle higher priority channel first
+      Figureout why interrupt happen and call appropriate final even handler
+      TX complete or error happen
+
+  @  Parameters
+      dxeCtxt      DXE context 
+
+  @  Return
+      PAL_STATUS_T
+===========================================================================*/
+void dxeTXCompleteProcessing
+(
+   WLANDXE_CtrlBlkType *dxeCtxt
+)
+{
+   wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_ChannelCBType    *channelCb  = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+  
+   /* Test High Priority Channel is the INT source or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI];
+
+   /* Handle TX complete for high priority channel */
+   status = dxeTXCompFrame(dxeCtxt, channelCb);
+
+   /* Test Low Priority Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI];
+
+   /* Handle TX complete for low priority channel */
+   status = dxeTXCompFrame(dxeCtxt, channelCb);
+  
+   if((eWLAN_PAL_FALSE == dxeCtxt->txIntEnable) &&
+      ((dxeCtxt->txCompletedFrames > 0) ||
+       (WLANDXE_POWER_STATE_FULL == dxeCtxt->hostPowerState)))
+   {
+      dxeCtxt->txIntEnable =  eWLAN_PAL_TRUE; 
+      wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "%s %s : %d, %s : %d", __FUNCTION__,
+               channelType[dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].channelType],
+               dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc,
+               channelType[dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].channelType],
+               dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc);
+   }
+   
+   /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
+     the posibility of a race*/
+   dxePsComplete(dxeCtxt, eWLAN_PAL_FALSE);
+   
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+/*==========================================================================
+  @  Function Name 
+      dxeTXISR
+
+  @  Description 
+      TX interrupt ISR
+      Platform will call this function if INT is happen
+      This function must be registered into platform interrupt module
+
+  @  Parameters
+      void    *hostCtxt
+               DXE host driver control context,
+               pre registerd during interrupt registration
+
+  @  Return
+      PAL_STATUS_T
+===========================================================================*/
+static void dxeTXISR
+(
+   void                    *hostCtxt
+)
+{
+   WLANDXE_CtrlBlkType      *dxeCtxt    = (WLANDXE_CtrlBlkType *)hostCtxt;
+   wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
+#ifdef FEATURE_R33D
+   wpt_uint32                regValue;
+#endif /* FEATURE_R33D */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Return from here if the RIVA is in IMPS, to avoid register access */
+   if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
+      (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
+   {
+      /* Disable interrupt at here,
+         IMPS or IMPS Pending state should not access RIVA register */
+      status = wpalDisableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReadyISR Disable RX ready interrupt fail");
+         return;         
+      }
+      dxeCtxt->txIntDisabledByIMPS = eWLAN_PAL_TRUE;
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+         "%s Riva is in %d, return from here ", __FUNCTION__, dxeCtxt->hostPowerState);
+      return;
+   }
+
+#ifdef FEATURE_R33D
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &regValue);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompISR Read INT_SRC_RAW fail");
+      return;
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "INT_SRC_RAW 0x%x", regValue);
+   if(0 == regValue)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "This is not DXE Interrupt, Reject it");
+      return;
+   }
+#endif /* FEATURE_R33D */
+
+   /* Disable TX Complete Interrupt at here */
+   status = wpalDisableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompISR Disable TX complete interrupt fail");
+      return;         
+   }
+   dxeCtxt->txIntEnable = eWLAN_PAL_FALSE;
+
+
+   if( dxeCtxt->ucTxMsgCnt )
+   {
+    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "Avoiding serializing TX Complete event");
+    return;
+   }
+   
+   dxeCtxt->ucTxMsgCnt = 1;
+
+   /* Serialize TX complete interrupt upon TX thread */
+   HDXE_ASSERT(NULL != dxeCtxt->txIsrMsg);
+   status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
+                          dxeCtxt->txIsrMsg);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "dxeTXCompISR interrupt serialize fail status=%d", status);
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+
+/*-------------------------------------------------------------------------
+ *  Global Function
+ *-------------------------------------------------------------------------*/
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Open
+
+  @  Description 
+      Open host DXE driver, allocate DXE resources
+      Allocate, DXE local control block, DXE descriptor pool, DXE descriptor control block pool
+
+  @  Parameters
+      pVoid      pAdaptor : Driver global control block pointer
+
+  @  Return
+      pVoid DXE local module control block pointer
+===========================================================================*/
+void *WLANDXE_Open
+(
+   void
+)
+{
+   wpt_status              status = eWLAN_PAL_STATUS_SUCCESS;
+   unsigned int            idx;
+   WLANDXE_ChannelCBType  *currentChannel = NULL;
+   int                     smsmInitState;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   wpt_uint32                 sIdx;
+   WLANDXE_ChannelCBType     *channel = NULL;
+   WLANDXE_DescCtrlBlkType   *crntDescCB = NULL;
+   WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* This is temporary allocation */
+   tempDxeCtrlBlk = (WLANDXE_CtrlBlkType *)wpalMemoryAllocate(sizeof(WLANDXE_CtrlBlkType));
+   if(NULL == tempDxeCtrlBlk)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Control Block Alloc Fail");
+      return NULL;  
+   }
+   wpalMemoryZero(tempDxeCtrlBlk, sizeof(WLANDXE_CtrlBlkType));
+
+   status = dxeCommonDefaultConfig(tempDxeCtrlBlk);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Common Configuration Fail");
+      WLANDXE_Close(tempDxeCtrlBlk);
+      return NULL;         
+   }
+
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "WLANDXE_Open Channel %s Open Start", channelType[idx]);
+      currentChannel = &tempDxeCtrlBlk->dxeChannel[idx];
+      if(idx == WDTS_CHANNEL_TX_LOW_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_TX_LOW_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_TX_HIGH_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_TX_HIGH_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_RX_LOW_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_RX_LOW_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_RX_HIGH_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_RX_HIGH_PRI;
+      }
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      else if(idx == WDTS_CHANNEL_H2H_TEST_TX)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_H2H_TEST_TX;
+      }
+      else if(idx == WDTS_CHANNEL_H2H_TEST_RX)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_H2H_TEST_RX;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+      /* Config individual channels from channel default setup table */
+      status = dxeChannelDefaultConfig(tempDxeCtrlBlk,
+                                       currentChannel);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Open Channel Basic Configuration Fail for channel %d", idx);
+         WLANDXE_Close(tempDxeCtrlBlk);
+         return NULL;         
+      }
+
+      /* Allocate DXE Control Block will be used by host DXE driver */
+      status = dxeCtrlBlkAlloc(tempDxeCtrlBlk, currentChannel);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Open Alloc DXE Control Block Fail for channel %d", idx);
+
+         WLANDXE_Close(tempDxeCtrlBlk);
+         return NULL;         
+      }
+      status = wpalMutexInit(&currentChannel->dxeChannelLock); 
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "WLANDXE_Open Lock Init Fail for channel %d", idx);
+         WLANDXE_Close(tempDxeCtrlBlk);
+         return NULL;
+      }
+
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "WLANDXE_Open Channel %s Open Success", channelType[idx]);
+   }
+
+   /* Allocate and Init RX READY ISR Serialize Buffer */
+   tempDxeCtrlBlk->rxIsrMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
+   if(NULL == tempDxeCtrlBlk->rxIsrMsg)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Alloc RX ISR Fail");
+      WLANDXE_Close(tempDxeCtrlBlk);
+      return NULL;
+   }
+   wpalMemoryZero(tempDxeCtrlBlk->rxIsrMsg, sizeof(wpt_msg));
+   tempDxeCtrlBlk->rxIsrMsg->callback = dxeRXEventHandler;
+   tempDxeCtrlBlk->rxIsrMsg->pContext = (void *)tempDxeCtrlBlk;
+
+   /* Allocate and Init TX COMP ISR Serialize Buffer */
+   tempDxeCtrlBlk->txIsrMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
+   if(NULL == tempDxeCtrlBlk->txIsrMsg)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Alloc TX ISR Fail");
+      WLANDXE_Close(tempDxeCtrlBlk);
+      return NULL;
+   }
+   wpalMemoryZero(tempDxeCtrlBlk->txIsrMsg, sizeof(wpt_msg));
+   tempDxeCtrlBlk->txIsrMsg->callback = dxeTXEventHandler;
+   tempDxeCtrlBlk->txIsrMsg->pContext = (void *)tempDxeCtrlBlk;
+
+   /* Allocate and Init RX Packet Available Serialize Message Buffer */
+   tempDxeCtrlBlk->rxPktAvailMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
+   if(NULL == tempDxeCtrlBlk->rxPktAvailMsg)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Alloc RX Packet Available Message Fail");
+      WLANDXE_Close(tempDxeCtrlBlk);
+      return NULL;
+   }
+   wpalMemoryZero(tempDxeCtrlBlk->rxPktAvailMsg, sizeof(wpt_msg));
+   tempDxeCtrlBlk->rxPktAvailMsg->callback = dxeRXPacketAvailableEventHandler;
+   tempDxeCtrlBlk->rxPktAvailMsg->pContext = (void *)tempDxeCtrlBlk;
+   
+   tempDxeCtrlBlk->freeRXPacket = NULL;
+   tempDxeCtrlBlk->dxeCookie    = WLANDXE_CTXT_COOKIE;
+   tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_FALSE;
+   tempDxeCtrlBlk->txIntDisabledByIMPS = eWLAN_PAL_FALSE;
+
+   /* Initialize SMSM state
+    * Init State is
+    *    Clear TX Enable
+    *    RING EMPTY STATE */
+   smsmInitState = wpalNotifySmsm(WPAL_SMSM_WLAN_TX_ENABLE,
+                                  WPAL_SMSM_WLAN_TX_RINGS_EMPTY);
+   if(0 != smsmInitState)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "SMSM Channel init fail %d", smsmInitState);
+      for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+      {
+         dxeChannelClose(tempDxeCtrlBlk, &tempDxeCtrlBlk->dxeChannel[idx]);
+      }
+      wpalMemoryFree((void *)&tempDxeCtrlBlk->rxIsrMsg);
+      wpalMemoryFree((void *)&tempDxeCtrlBlk->txIsrMsg);
+      wpalMemoryFree(tempDxeCtrlBlk);
+      return NULL;
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "WLANDXE_Open Success");
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return (void *)tempDxeCtrlBlk;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_ClientRegistration
+
+  @  Description 
+      Make callback functions registration into DXE driver from DXE driver client
+
+  @  Parameters
+      pVoid                       pDXEContext : DXE module control block
+      WDTS_RxFrameReadyCbType     rxFrameReadyCB : RX Frame ready CB function pointer
+      WDTS_TxCompleteCbType       txCompleteCB : TX complete CB function pointer
+      WDTS_LowResourceCbType      lowResourceCB : Low DXE resource notification CB function pointer
+      void                       *userContext : DXE Cliennt control block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_ClientRegistration
+(
+   void                       *pDXEContext,
+   WLANDXE_RxFrameReadyCbType  rxFrameReadyCB,
+   WLANDXE_TxCompleteCbType    txCompleteCB,
+   WLANDXE_LowResourceCbType   lowResourceCB,
+   void                       *userContext
+)
+{
+   wpt_status                 status  = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_CtrlBlkType       *dxeCtxt;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid DXE CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == rxFrameReadyCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid RX READY CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == txCompleteCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid txCompleteCB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == lowResourceCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid lowResourceCB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == userContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid userContext");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
+
+   /* Assign */
+   dxeCtxt->rxReadyCB     = rxFrameReadyCB;
+   dxeCtxt->txCompCB      = txCompleteCB;
+   dxeCtxt->lowResourceCB = lowResourceCB;
+   dxeCtxt->clientCtxt    = userContext;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Start
+
+  @  Description 
+      Start Host DXE driver
+      Initialize DXE channels and start channel
+
+  @  Parameters
+      pVoid                       pDXEContext : DXE module control block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Start
+(
+   void  *pDXEContext
+)
+{
+   wpt_status                 status  = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                 idx;
+   WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start Invalid DXE CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+   dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
+
+   /* WLANDXE_Start called means DXE engine already initiates
+    * And DXE HW is reset and init finished
+    * But here to make sure HW is initialized, reset again */
+   status = dxeEngineCoreStart(dxeCtxt);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start DXE HW init Fail");
+      return status;         
+   }
+
+   /* Individual Channel Start */
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "WLANDXE_Start Channel %s Start", channelType[idx]);
+
+      /* Allocate DXE descriptor will be shared by Host driver and DXE engine */
+      /* Make connection between DXE descriptor and DXE control block */
+      status = dxeDescAllocAndLink(tempDxeCtrlBlk, &dxeCtxt->dxeChannel[idx]);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Start Alloc DXE Descriptor Fail for channel %d", idx);
+         return status;         
+      }
+
+      /* Program each channel register with configuration arguments */
+      status = dxeChannelInitProgram(dxeCtxt,
+                                     &dxeCtxt->dxeChannel[idx]);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Start %d Program DMA channel Fail", idx);
+         return status;         
+      }
+
+      /* ??? Trigger to start DMA channel
+       * This must be seperated from ??? */
+      status = dxeChannelStart(dxeCtxt,
+                               &dxeCtxt->dxeChannel[idx]);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Start %d Channel Start Fail", idx);
+         return status;         
+      }
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "WLANDXE_Start Channel %s Start Success", channelType[idx]);
+   }
+
+   /* Register ISR to OS */
+   /* Register TX complete interrupt into platform */
+   status = wpalRegisterInterrupt(DXE_INTERRUPT_TX_COMPLE,
+                                       dxeTXISR,
+                                       dxeCtxt);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start TX comp interrupt registration Fail");
+      return status;         
+   }
+
+   /* Register RX ready interrupt into platform */
+   status = wpalRegisterInterrupt(DXE_INTERRUPT_RX_READY,
+                                       dxeRXISR,
+                                       dxeCtxt);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start RX Ready interrupt registration Fail");
+      return status;         
+   }
+
+   /* Enable system level ISR */
+   /* Enable RX ready Interrupt at here */
+   status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompleteEventHandler Enable TX complete interrupt fail");
+      return status;         
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_TXFrame
+
+  @  Description 
+      Trigger frame transmit from host to RIVA
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+      wpt_packet       pPacket : transmit packet structure
+      WDTS_ChannelType channel : TX channel
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_TxFrame
+(
+   void                *pDXEContext,
+   wpt_packet          *pPacket,
+   WDTS_ChannelType     channel
+)
+{
+   wpt_status                 status         = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_ChannelCBType     *currentChannel = NULL;
+   WLANDXE_CtrlBlkType       *dxeCtxt        = NULL;
+   unsigned int              *lowThreshold   = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start Invalid DXE CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == pPacket)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start Invalid pPacket");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if((WDTS_CHANNEL_MAX < channel) || (WDTS_CHANNEL_MAX == channel))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start Invalid channel");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
+
+   currentChannel = &dxeCtxt->dxeChannel[channel];
+   
+
+   wpalMutexAcquire(&currentChannel->dxeChannelLock);
+
+   lowThreshold = currentChannel->channelType == WDTS_CHANNEL_TX_LOW_PRI?
+      &(dxeCtxt->txCompInt.txLowResourceThreshold_LoPriCh):
+      &(dxeCtxt->txCompInt.txLowResourceThreshold_HiPriCh);
+
+   /* Decide have to activate TX complete event or not */
+   switch(dxeCtxt->txCompInt.txIntEnable)
+   {
+      /* TX complete interrupt will be activated when low DXE resource */
+      case WLANDXE_TX_COMP_INT_LR_THRESHOLD:
+         if((currentChannel->numFreeDesc <= *lowThreshold) &&
+            (eWLAN_PAL_FALSE == dxeCtxt->txIntEnable))
+         {
+            dxeCtxt->txIntEnable = eWLAN_PAL_TRUE;
+            dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                                   channel,
+                                   eWLAN_PAL_FALSE);
+         }
+         break;
+
+      /* TX complete interrupt will be activated n number of frames transfered */
+      case WLANDXE_TX_COMP_INT_PER_K_FRAMES:
+         if(channel == WDTS_CHANNEL_TX_LOW_PRI)
+         {
+            currentChannel->numFrameBeforeInt++;
+         }
+         break;
+
+      /* TX complete interrupt will be activated periodically */
+      case WLANDXE_TX_COMP_INT_TIMER:
+         break;
+   }
+
+   dxeCtxt->txCompletedFrames++;
+
+   /* Update DXE descriptor, this is frame based
+    * if a frame consist of N fragments, N Descriptor will be programed */
+   status = dxeTXPushFrame(currentChannel, pPacket);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_TxFrame TX Push Frame fail");
+      wpalMutexRelease(&currentChannel->dxeChannelLock);
+      return status;
+   }
+
+   /* If specific channel hit low resource condition, send notification to upper layer */
+   if(currentChannel->numFreeDesc <= *lowThreshold)
+   {
+      dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                             channel,
+                             eWLAN_PAL_FALSE);
+      currentChannel->hitLowResource = eWLAN_PAL_TRUE;
+   }
+   wpalMutexRelease(&currentChannel->dxeChannelLock);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_CompleteTX
+
+  @  Description 
+      Informs DXE that the current series of Tx packets is complete
+
+  @  Parameters
+      pContext            pDXEContext : DXE Control Block
+      ucTxResReq          TX resource number required by TL/WDI
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status
+WLANDXE_CompleteTX
+(
+  void* pContext,
+  wpt_uint32 ucTxResReq
+)
+{
+  wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
+  WLANDXE_CtrlBlkType      *dxeCtxt = (WLANDXE_CtrlBlkType *)(pContext);
+  WLANDXE_ChannelCBType    *channelCb  = NULL;
+  wpt_boolean               inLowRes;
+
+  /* Sanity Check */
+  if( NULL == pContext )
+  {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_CompleteTX invalid param");
+      return eWLAN_PAL_STATUS_E_INVAL;
+  }
+
+  channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI];
+  inLowRes  = channelCb->hitLowResource;
+
+  if(WLANDXE_TX_LOW_RES_THRESHOLD < ucTxResReq)
+  {
+    /* Raise threshold temporarily if necessary */
+    dxeCtxt->txCompInt.txLowResourceThreshold_LoPriCh = ucTxResReq;
+
+    if(eWLAN_PAL_FALSE == inLowRes)
+    {
+      /* Put the channel to low resource condition */
+      dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                             WDTS_CHANNEL_TX_LOW_PRI,
+                             eWLAN_PAL_FALSE);
+      inLowRes = channelCb->hitLowResource = eWLAN_PAL_TRUE;
+    }
+  }
+
+  /*Try to reclaim resources*/
+  dxeTXCompleteProcessing(dxeCtxt);
+
+  /* In previous WLANTL_GetFrames call, TL didn't fetch a packet 
+     because its fragment size is larger than DXE free resource. */
+  if(0 < ucTxResReq)
+  {
+    /* DXE successfully claimed enough free DXE resouces for next fetch. */
+    if(WLANDXE_GetFreeTxDataResNumber(dxeCtxt) >= ucTxResReq)
+    {
+      /* DXE has not been in low resource condition. DXE forces to kick off
+         TX tranmit */
+      if((eWLAN_PAL_FALSE == inLowRes) && 
+         (eWLAN_PAL_FALSE == channelCb->hitLowResource))
+      {
+        dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                               WDTS_CHANNEL_TX_LOW_PRI,
+                               eWLAN_PAL_FALSE);
+        dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                               WDTS_CHANNEL_TX_LOW_PRI,
+                               eWLAN_PAL_TRUE);
+        channelCb->hitLowResource = eWLAN_PAL_FALSE;
+      }
+    }
+    else
+    {
+      /* DXE doesn't have enough free DXE resources. Put the channel
+         to low resource condition. */
+      if(eWLAN_PAL_FALSE == channelCb->hitLowResource)
+      {
+        /* Put the channel to low resource condition */
+        dxeCtxt->lowResourceCB(dxeCtxt->clientCtxt,
+                             WDTS_CHANNEL_TX_LOW_PRI,
+                             eWLAN_PAL_FALSE);
+        channelCb->hitLowResource = eWLAN_PAL_TRUE;
+      }
+    }
+  }
+ 
+  return status; 
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Stop
+
+  @  Description 
+      Stop DXE channels and DXE engine operations
+      Disable all channel interrupt
+      Stop all channel operation
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Stop
+(
+   void *pDXEContext
+)
+{
+   wpt_status                 status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                 idx;
+   WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Stop Invalid DXE CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      status = dxeChannelStop(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_Stop Channel %d Stop Fail", idx);
+         return status;
+      }
+   }
+
+   /* During Stop unregister interrupt */
+   wpalUnRegisterInterrupt(DXE_INTERRUPT_TX_COMPLE);
+   wpalUnRegisterInterrupt(DXE_INTERRUPT_RX_READY);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_Close
+
+  @  Description 
+      Close DXE channels
+      Free DXE related resources
+      DXE descriptor free
+      Descriptor control block free
+      Pre allocated RX buffer free
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_Close
+(
+   void *pDXEContext
+)
+{
+   wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                 idx;
+   WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   wpt_uint32                 sIdx;
+   WLANDXE_ChannelCBType     *channel = NULL;
+   WLANDXE_DescCtrlBlkType   *crntDescCB = NULL;
+   WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Sanity */
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Stop Invalid DXE CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      wpalMutexDelete(&dxeCtxt->dxeChannel[idx].dxeChannelLock);
+      dxeChannelClose(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      channel    = &dxeCtxt->dxeChannel[idx];
+      crntDescCB = channel->headCtrlBlk;
+      for(sIdx = 0; sIdx < channel->numDesc; sIdx++)
+      {
+         nextDescCB = (WLANDXE_DescCtrlBlkType *)crntDescCB->nextCtrlBlk;
+         wpalMemoryFree((void *)crntDescCB);
+         crntDescCB = nextDescCB;
+         if(NULL == crntDescCB)
+         {
+            break;
+         }
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+   }
+
+   if(NULL != dxeCtxt->rxIsrMsg)
+   {
+      wpalMemoryFree(dxeCtxt->rxIsrMsg);
+   }
+   if(NULL != dxeCtxt->txIsrMsg)
+   {
+      wpalMemoryFree(dxeCtxt->txIsrMsg);
+   }
+   if(NULL != dxeCtxt->rxPktAvailMsg)
+   {
+      wpalMemoryFree(dxeCtxt->rxPktAvailMsg);
+   }
+
+   wpalMemoryFree(pDXEContext);
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_TriggerTX
+
+  @  Description 
+      TBD
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_TriggerTX
+(
+   void *pDXEContext
+)
+{
+   wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* TBD */
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeTxThreadSetPowerStateEventHandler
+
+  @  Description 
+      If WDI sends set power state req, this event handler will be called in Tx
+      thread context
+
+  @  Parameters
+         void               *msgPtr
+                             Event MSG
+
+  @  Return
+      None
+===========================================================================*/
+void dxeTxThreadSetPowerStateEventHandler
+(
+    wpt_msg               *msgPtr
+)
+{
+   wpt_msg                  *msgContent = (wpt_msg *)msgPtr;
+   WLANDXE_CtrlBlkType      *dxeCtxt;
+   wpt_status                status = eWLAN_PAL_STATUS_E_FAILURE;
+   WLANDXE_PowerStateType    reqPowerState;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
+   reqPowerState = (WLANDXE_PowerStateType)msgContent->val;
+   dxeCtxt->setPowerStateCb = (WLANDXE_SetPowerStateCbType)msgContent->ptr;
+
+   switch(reqPowerState)
+   {
+      case WLANDXE_POWER_STATE_BMPS:
+         if(WLANDXE_RIVA_POWER_STATE_ACTIVE == dxeCtxt->rivaPowerState)
+         {
+            //don't block MC waiting for num_rsvd to become 0 since it may take a while
+            //based on amount of TX and RX activity - during this time any received 
+            // management frames will remain un-processed consuming RX buffers
+            dxeCtxt->rivaPowerState = WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN;
+            dxeCtxt->hostPowerState = reqPowerState;
+         }
+         else
+         {
+            status = eWLAN_PAL_STATUS_E_INVAL;
+         }
+         break;
+      case WLANDXE_POWER_STATE_IMPS:
+         if(WLANDXE_RIVA_POWER_STATE_ACTIVE == dxeCtxt->rivaPowerState)
+         {
+            dxeCtxt->rivaPowerState = WLANDXE_RIVA_POWER_STATE_IMPS_UNKNOWN;
+         }
+         else
+         {
+            status = eWLAN_PAL_STATUS_E_INVAL;
+         }
+         break;
+      case WLANDXE_POWER_STATE_FULL:
+         if(WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN == dxeCtxt->rivaPowerState)
+         {
+            dxeCtxt->rivaPowerState = WLANDXE_RIVA_POWER_STATE_ACTIVE;
+         }
+         dxeCtxt->hostPowerState = reqPowerState;
+         dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+         break;
+      case WLANDXE_POWER_STATE_DOWN:
+         WLANDXE_Stop((void *)dxeCtxt);         
+         break;
+      default:
+         //assert
+         break;
+   }
+
+   if(WLANDXE_POWER_STATE_BMPS_PENDING != dxeCtxt->hostPowerState)
+   {
+      dxeCtxt->setPowerStateCb(status, 
+                               dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].descBottomLocPhyAddr);
+   }
+   /* Free MSG buffer */
+   wpalMemoryFree(msgPtr);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+   return;
+}
+
+
+/*==========================================================================
+  @  Function Name 
+      dxeRxThreadSetPowerStateEventHandler
+
+  @  Description 
+      If WDI sends set power state req, this event handler will be called in Rx
+      thread context
+
+  @  Parameters
+         void               *msgPtr
+                             Event MSG
+
+  @  Return
+      None
+===========================================================================*/
+void dxeRxThreadSetPowerStateEventHandler
+(
+    wpt_msg               *msgPtr
+)
+{
+   wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   /* Now serialise the message through Tx thread also to make sure
+    * no register access when RIVA is in powersave */
+   /*Use the same message pointer just change the call back function */
+   msgPtr->callback = dxeTxThreadSetPowerStateEventHandler;
+   status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
+                       msgPtr);
+   if ( eWLAN_PAL_STATUS_SUCCESS != status )
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Tx thread Set power state req serialize fail status=%d",
+               status, 0, 0);
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_SetPowerState
+
+  @  Description 
+      From Client let DXE knows what is the WLAN HW(RIVA) power state
+
+  @  Parameters
+      pVoid                    pDXEContext : DXE Control Block
+      WLANDXE_PowerStateType   powerState
+
+  @  Return
+      wpt_status
+===========================================================================*/
+wpt_status WLANDXE_SetPowerState
+(
+   void                    *pDXEContext,
+   WDTS_PowerStateType      powerState,
+   WDTS_SetPSCbType         cBack
+)
+{
+   wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
+   WLANDXE_CtrlBlkType     *pDxeCtrlBlk;
+   WLANDXE_PowerStateType   hostPowerState;
+   wpt_msg                  *rxCompMsg;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "NULL pDXEContext passed by caller", 0, 0, 0);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+   pDxeCtrlBlk = (WLANDXE_CtrlBlkType *)pDXEContext;
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "Set DXE Power state %d", powerState);
+   switch(powerState)
+   {
+      case WDTS_POWER_STATE_FULL:
+         hostPowerState = WLANDXE_POWER_STATE_FULL;
+         break;
+      case WDTS_POWER_STATE_BMPS:
+         pDxeCtrlBlk->hostPowerState = WLANDXE_POWER_STATE_BMPS;
+         hostPowerState = WLANDXE_POWER_STATE_BMPS;
+         break;
+      case WDTS_POWER_STATE_IMPS:
+         pDxeCtrlBlk->hostPowerState = WLANDXE_POWER_STATE_IMPS;
+         hostPowerState = WLANDXE_POWER_STATE_IMPS;
+         break;
+      case WDTS_POWER_STATE_DOWN:
+         pDxeCtrlBlk->hostPowerState = WLANDXE_POWER_STATE_DOWN;
+         hostPowerState = WLANDXE_POWER_STATE_DOWN;
+         break;
+      default:
+         hostPowerState = WLANDXE_POWER_STATE_MAX;
+   }
+
+   // A callback i.e. ACK back is needed only when we want to enable BMPS
+   // and the data/management path is active because we want to ensure
+   // DXE registers are not accessed when RIVA may be power-collapsed. So
+   // we need a callback in enter_bmps_req (the request to RIVA is sent
+   // only after ACK back from TX thread). A callback is not needed in
+   // finish_scan_req during BMPS since data-path is resumed only in 
+   // finish_scan_rsp and no management frames are sent in between. No 
+   // callback is needed when going from BMPS enabled to BMPS suspended/
+   // disabled when it is known that RIVA is awake and cannot enter power
+   // collapse autonomously so no callback is needed in exit_bmps_rsp or
+   // init_scan_rsp
+   if ( cBack )
+   {
+      //serialize through Rx thread
+      rxCompMsg          = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
+      if(NULL == rxCompMsg)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "WLANDXE_SetPowerState, MSG MEM alloc Fail");
+         return eWLAN_PAL_STATUS_E_RESOURCES;
+      }
+
+      /* Event type, where it must be defined???? */
+      /* THIS MUST BE CLEARED ASAP
+      txCompMsg->type     = TX_COMPLETE; */
+      rxCompMsg->callback = dxeRxThreadSetPowerStateEventHandler;
+      rxCompMsg->pContext = pDxeCtrlBlk;
+      rxCompMsg->val      = hostPowerState;
+      rxCompMsg->ptr      = cBack;
+      status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
+                          rxCompMsg);
+      if ( eWLAN_PAL_STATUS_SUCCESS != status )
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "Rx thread Set power state req serialize fail status=%d",
+                  status, 0, 0);
+      }
+   }
+   else
+   {
+      if ( WLANDXE_POWER_STATE_FULL == hostPowerState )
+      {
+         if( WLANDXE_POWER_STATE_BMPS == pDxeCtrlBlk->hostPowerState )
+         {
+            dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+         }
+         else if( WLANDXE_POWER_STATE_IMPS == pDxeCtrlBlk->hostPowerState )
+         {
+            /* Requested Full power from exit IMPS, reenable the interrupts*/
+            if(eWLAN_PAL_TRUE == pDxeCtrlBlk->rxIntDisabledByIMPS)
+            {
+               pDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_FALSE;
+               /* Enable RX interrupt at here, if new PS is not IMPS */
+               status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
+               if(eWLAN_PAL_STATUS_SUCCESS != status)
+               {
+                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                           "%s Enable RX ready interrupt fail", __FUNCTION__);
+                  return status;
+               }
+            }
+            if(eWLAN_PAL_TRUE == pDxeCtrlBlk->txIntDisabledByIMPS)
+            {
+               pDxeCtrlBlk->txIntDisabledByIMPS = eWLAN_PAL_FALSE;
+               /* Enable RX interrupt at here, if new PS is not IMPS */
+               status = wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+               if(eWLAN_PAL_STATUS_SUCCESS != status)
+               {
+                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                           "%s Enable TX comp interrupt fail", __FUNCTION__);
+                  return status;
+               }
+            }
+         }
+         pDxeCtrlBlk->hostPowerState = hostPowerState;
+         pDxeCtrlBlk->rivaPowerState = WLANDXE_RIVA_POWER_STATE_ACTIVE;
+      }
+      else if ( hostPowerState == WLANDXE_POWER_STATE_BMPS )
+      {
+         pDxeCtrlBlk->hostPowerState = hostPowerState;
+         pDxeCtrlBlk->rivaPowerState = WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN;
+      }
+      else
+      {
+         HDXE_ASSERT(0);
+      }
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      WLANDXE_GetFreeTxDataResNumber
+
+  @  Description 
+      Returns free descriptor numbers for TX data channel (TX high priority)
+
+  @  Parameters
+      pVoid            pDXEContext : DXE Control Block
+
+  @  Return
+      wpt_uint32      Free descriptor number of TX high pri ch
+===========================================================================*/
+wpt_uint32 WLANDXE_GetFreeTxDataResNumber
+(
+   void *pDXEContext
+)
+{
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+
+   if(NULL == pDXEContext)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "NULL parameter passed by caller", 0, 0, 0);
+      return (0);
+   }
+
+   return 
+      ((WLANDXE_CtrlBlkType *)pDXEContext)->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numFreeDesc;
+}
diff --git a/CORE/DXE/src/wlan_qct_dxe_cfg_i.c b/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
new file mode 100644
index 0000000..6bb0d42
--- /dev/null
+++ b/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
@@ -0,0 +1,613 @@
+/*
+ * 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  wlan_qct_dxe_cfg_i.c
+  
+  @brief 
+               
+   This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   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
+--------    ---         ----------------------------------------------------------
+08/03/10    schang      Created module.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_dxe_i.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+typedef struct
+{
+   WDTS_ChannelType           wlanChannel;
+   WLANDXE_DMAChannelType     DMAChannel;
+   WLANDXE_ChannelConfigType *channelConfig;
+} WLANDXE_ChannelMappingType;
+
+wpt_uint32 channelBaseAddressList[WLANDXE_DMA_CHANNEL_MAX] =
+{
+   WLANDXE_DMA_CHAN0_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN1_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN2_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN3_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN4_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN5_BASE_ADDRESS,
+   WLANDXE_DMA_CHAN6_BASE_ADDRESS
+};
+
+wpt_uint32 channelInterruptMask[WLANDXE_DMA_CHANNEL_MAX] =
+{
+   WLANDXE_INT_MASK_CHAN_0,
+   WLANDXE_INT_MASK_CHAN_1,
+   WLANDXE_INT_MASK_CHAN_2,
+   WLANDXE_INT_MASK_CHAN_3,
+   WLANDXE_INT_MASK_CHAN_4,
+   WLANDXE_INT_MASK_CHAN_5,
+   WLANDXE_INT_MASK_CHAN_6
+};
+
+WLANDXE_ChannelConfigType chanTXLowPriConfig =
+{
+   /* Q handle type, Circular */
+   WLANDXE_CHANNEL_HANDLE_CIRCULA,
+
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   WLANDXE_LO_PRI_RES_NUM ,
+
+   /* MAX num RX Buffer */
+   0,
+
+   /* Reference WQ, TX23 */
+   23,
+
+   /* USB Only, End point info */
+   0,
+
+   /* Transfer Type */
+   WLANDXE_DESC_CTRL_XTYPE_H2B,
+
+   /* Channel Priority 7(Highest) - 0(Lowest) NOT CLEAR YET !!! */
+   4,
+
+   /* BD attached to frames for this pipe */
+   eWLAN_PAL_TRUE,
+
+   /* chk_size, NOT CLEAR YET !!!*/
+   0,
+
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   5,
+
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!! */
+   eWLAN_PAL_TRUE,
+
+   /* Use short Descriptor */
+   eWLAN_PAL_TRUE
+};
+
+WLANDXE_ChannelConfigType chanTXHighPriConfig =
+{
+   /* Q handle type, Circular */
+   WLANDXE_CHANNEL_HANDLE_CIRCULA,
+
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   WLANDXE_HI_PRI_RES_NUM ,
+
+   /* MAX num RX Buffer */
+   0,
+
+   /* Reference WQ, TX23 */
+   23,
+
+   /* USB Only, End point info */
+   0,
+
+   /* Transfer Type */
+   WLANDXE_DESC_CTRL_XTYPE_H2B,
+
+   /* Channel Priority 7(Highest) - 0(Lowest), NOT CLEAR YET !!! */
+   6,
+
+   /* BD attached to frames for this pipe */
+   eWLAN_PAL_TRUE,
+
+   /* chk_size, NOT CLEAR YET !!!*/
+   0,
+
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   7,
+
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!!*/
+   eWLAN_PAL_TRUE,
+
+   /* Use short Descriptor */
+   eWLAN_PAL_TRUE
+};
+
+WLANDXE_ChannelConfigType chanRXLowPriConfig =
+{
+   /* Q handle type, Circular */
+   WLANDXE_CHANNEL_HANDLE_CIRCULA,
+
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   256,
+
+   /* MAX num RX Buffer, NOT CLEAR YET !!! */
+   1,
+
+   /* Reference WQ, NOT CLEAR YET !!! */
+   /* Temporary BMU Work Q 4 */
+   11,
+
+   /* USB Only, End point info */
+   0,
+
+   /* Transfer Type */
+   WLANDXE_DESC_CTRL_XTYPE_B2H,
+
+   /* Channel Priority 7(Highest) - 0(Lowest), NOT CLEAR YET !!! */
+   5,
+
+   /* BD attached to frames for this pipe */
+   eWLAN_PAL_TRUE,
+
+   /* chk_size, NOT CLEAR YET !!!*/
+   0,
+
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   6,
+
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!!*/
+   eWLAN_PAL_TRUE,
+
+   /* Use short Descriptor */
+   eWLAN_PAL_TRUE
+};
+
+WLANDXE_ChannelConfigType chanRXHighPriConfig =
+{
+   /* Q handle type, Circular */
+   WLANDXE_CHANNEL_HANDLE_CIRCULA,
+
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   40,
+
+   /* MAX num RX Buffer, NOT CLEAR YET !!! */
+   1,
+
+   /* Reference WQ, RX11 */
+   4,
+
+   /* USB Only, End point info */
+   0,
+
+   /* Transfer Type */
+   WLANDXE_DESC_CTRL_XTYPE_B2H,
+
+   /* Channel Priority 7(Highest) - 0(Lowest), NOT CLEAR YET !!! */
+   6,
+
+   /* BD attached to frames for this pipe */
+   eWLAN_PAL_TRUE,
+
+   /* chk_size, NOT CLEAR YET !!!*/
+   0,
+
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   8,
+
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!!*/
+   eWLAN_PAL_TRUE,
+
+   /* Use short Descriptor */
+   eWLAN_PAL_TRUE
+};
+
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+WLANDXE_ChannelConfigType chanH2HTestConfig =
+{
+   /* Q handle type, Circular */
+   WLANDXE_CHANNEL_HANDLE_CIRCULA,
+
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   5,
+
+   /* MAX num RX Buffer, NOT CLEAR YET !!! */
+   0,
+
+   /* Reference WQ, NOT CLEAR YET !!! */
+   /* Temporary BMU Work Q 5 */
+   5,
+
+   /* USB Only, End point info */
+   0,
+
+   /* Transfer Type */
+   WLANDXE_DESC_CTRL_XTYPE_H2H,
+
+   /* Channel Priority 7(Highest) - 0(Lowest), NOT CLEAR YET !!! */
+   5,
+
+   /* BD attached to frames for this pipe */
+   eWLAN_PAL_FALSE,
+
+   /* chk_size, NOT CLEAR YET !!!*/
+   0,
+
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   0,
+
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!!*/
+   eWLAN_PAL_TRUE,
+
+   /* Use short Descriptor */
+   eWLAN_PAL_TRUE
+};
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
+WLANDXE_ChannelMappingType channelList[WDTS_CHANNEL_MAX] =
+{
+   {WDTS_CHANNEL_TX_LOW_PRI,  WLANDXE_DMA_CHANNEL_0, &chanTXLowPriConfig},
+   {WDTS_CHANNEL_TX_HIGH_PRI, WLANDXE_DMA_CHANNEL_4, &chanTXHighPriConfig},
+   {WDTS_CHANNEL_RX_LOW_PRI,  WLANDXE_DMA_CHANNEL_1, &chanRXLowPriConfig},
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+   {WDTS_CHANNEL_RX_HIGH_PRI, WLANDXE_DMA_CHANNEL_3, &chanRXHighPriConfig},
+#else
+   {WDTS_CHANNEL_H2H_TEST_TX,    WLANDXE_DMA_CHANNEL_2, &chanH2HTestConfig},
+   {WDTS_CHANNEL_H2H_TEST_RX,    WLANDXE_DMA_CHANNEL_2, &chanH2HTestConfig}
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+};
+
+WLANDXE_TxCompIntConfigType txCompInt = 
+{
+   /* TX Complete Interrupt enable method */
+   WLANDXE_TX_COMP_INT_PER_K_FRAMES,
+
+   /* TX Low Resource remaining resource threshold for Low Pri Ch */
+   WLANDXE_TX_LOW_RES_THRESHOLD,
+
+   /* TX Low Resource remaining resource threshold for High Pri Ch */
+   WLANDXE_TX_LOW_RES_THRESHOLD,
+
+   /* RX Low Resource remaining resource threshold */
+   5,
+
+   /* Per K frame enable Interrupt */
+   /*WLANDXE_HI_PRI_RES_NUM*/ 5,
+
+   /* Periodic timer msec */
+   10
+};
+
+/*==========================================================================
+  @  Function Name 
+      dxeCommonDefaultConfig
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+wpt_status dxeCommonDefaultConfig
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk
+)
+{
+   wpt_status                  status = eWLAN_PAL_STATUS_SUCCESS;
+
+   dxeCtrlBlk->rxReadyCB     = NULL;
+   dxeCtrlBlk->txCompCB      = NULL;
+   dxeCtrlBlk->lowResourceCB = NULL;
+
+   wpalMemoryCopy(&dxeCtrlBlk->txCompInt,
+                  &txCompInt,
+                  sizeof(WLANDXE_TxCompIntConfigType));
+
+   return status;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelDefaultConfig
+
+  @  Description 
+      Get defualt configuration values from pre defined structure
+      All the channels must have it's own configurations
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+wpt_status dxeChannelDefaultConfig
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+)
+{
+   wpt_status                  status = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_uint32                  baseAddress;
+   wpt_uint32                  dxeControlRead  = 0;
+   wpt_uint32                  dxeControlWrite = 0;
+   wpt_uint32                  dxeControlWriteValid = 0;
+   wpt_uint32                  dxeControlWriteEop = 0;
+   wpt_uint32                  dxeControlWriteEopInt = 0;
+   wpt_uint32                  idx;
+   WLANDXE_ChannelMappingType *mappedChannel = NULL;
+
+   /* Sanity Check */
+   if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeLinkDescAndCtrlBlk Channel Entry is not valid");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
+   {
+      if(channelEntry->channelType == channelList[idx].wlanChannel)
+      {
+         mappedChannel = &channelList[idx];
+         break;
+      }
+   }
+
+   if((NULL == mappedChannel) || (WDTS_CHANNEL_MAX == idx))
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "%s Failed to map channel", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   wpalMemoryCopy(&channelEntry->channelConfig,
+                  mappedChannel->channelConfig,
+                  sizeof(WLANDXE_ChannelConfigType));
+
+   baseAddress = channelBaseAddressList[mappedChannel->DMAChannel];
+   channelEntry->channelRegister.chDXEBaseAddr        = baseAddress;
+   channelEntry->channelRegister.chDXEStatusRegAddr   = baseAddress + WLANDXE_DMA_CH_STATUS_REG;
+   channelEntry->channelRegister.chDXEDesclRegAddr    = baseAddress + WLANDXE_DMA_CH_DESCL_REG;
+   channelEntry->channelRegister.chDXEDeschRegAddr    = baseAddress + WLANDXE_DMA_CH_DESCH_REG;
+   channelEntry->channelRegister.chDXELstDesclRegAddr = baseAddress + WLANDXE_DMA_CH_LST_DESCL_REG;
+   channelEntry->channelRegister.chDXECtrlRegAddr     = baseAddress + WLANDXE_DMA_CH_CTRL_REG;
+   channelEntry->channelRegister.chDXESzRegAddr       = baseAddress + WLANDXE_DMA_CH_SZ_REG;
+   channelEntry->channelRegister.chDXEDadrlRegAddr    = baseAddress + WLANDXE_DMA_CH_DADRL_REG;
+   channelEntry->channelRegister.chDXEDadrhRegAddr    = baseAddress + WLANDXE_DMA_CH_DADRH_REG;
+   channelEntry->channelRegister.chDXESadrlRegAddr    = baseAddress + WLANDXE_DMA_CH_SADRL_REG;
+   channelEntry->channelRegister.chDXESadrhRegAddr    = baseAddress + WLANDXE_DMA_CH_SADRH_REG;
+
+   /* Channel Mask?
+    * This value will control channel control register.
+    * This register will be set to trigger actual DMA transfer activate
+    * CH_N_CTRL */
+   channelEntry->extraConfig.chan_mask = 0;
+   /* Check VAL bit before processing descriptor */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_EDVEN_MASK;
+   /* Use External Descriptor Linked List */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_EDEN_MASK;
+   /* Enable Channel Interrupt on error */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_INE_ERR_MASK;
+   /* Enable INT after XFER done */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_INE_DONE_MASK;
+   /* Enable INT External Descriptor */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_INE_ED_MASK;
+   /* Set Channel This is not channel, event counter, somthing wrong */
+   channelEntry->extraConfig.chan_mask |= 
+                mappedChannel->DMAChannel << WLANDXE_CH_CTRL_CTR_SEL_OFFSET;
+   /* Transfer Type */
+   channelEntry->extraConfig.chan_mask |= mappedChannel->channelConfig->xfrType;
+   /* Use Short Descriptor, THIS LOOKS SOME WIERD, REVISIT */
+   if(!channelEntry->channelConfig.useShortDescFmt)
+   {
+      channelEntry->extraConfig.chan_mask |= WLANDXE_DESC_CTRL_DFMT;
+   }
+   /* TX Channel, Set DIQ bit, Clear SIQ bit since source is not WQ */
+   if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+   {
+      channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_DIQ_MASK;
+   }
+   /* RX Channel, Set SIQ bit, Clear DIQ bit since source is not WQ */
+   else if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+   {
+      channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_SIQ_MASK;
+   }
+   else
+   {
+      /* This is test H2H channel, TX, RX not use work Q
+       * Do Nothing */
+   }
+   /* Frame Contents Swap */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_SWAP_MASK;
+   /* Host System Using Little Endian */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_ENDIAN_MASK;
+   /* BMU Threshold select */
+   channelEntry->extraConfig.chan_mask |= 
+                 channelEntry->channelConfig.bmuThdSel << WLANDXE_CH_CTRL_BTHLD_SEL_OFFSET;
+   /* EOP for control register ??? */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_EOP_MASK;
+   /* Channel Priority */
+   channelEntry->extraConfig.chan_mask |= channelEntry->channelConfig.chPriority << WLANDXE_CH_CTRL_PRIO_OFFSET;
+   /* PDU REL */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_DESC_CTRL_PDU_REL;
+   /* Disable DMA transfer on this channel */
+   channelEntry->extraConfig.chan_mask_read_disable = channelEntry->extraConfig.chan_mask;
+   /* Enable DMA transfer on this channel */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_EN_MASK;
+   /* Channel Mask done */
+
+   /* Control Read
+    * Default Descriptor control Word value for RX ready DXE descriptor
+    * DXE engine will reference this value before DMA transfer */
+   dxeControlRead = 0;
+   /* Source is a Queue ID, not flat memory address */
+   dxeControlRead |= WLANDXE_DESC_CTRL_SIQ;
+   /* Transfer direction is BMU 2 Host */
+   dxeControlRead |= WLANDXE_DESC_CTRL_XTYPE_B2H;
+   /* End of Packet, RX is single fragment */
+   dxeControlRead |= WLANDXE_DESC_CTRL_EOP;
+   /* BD Present, default YES, B2H case it must be 0 to insert BD */
+   if(!channelEntry->channelConfig.bdPresent)
+   {
+      dxeControlRead |= WLANDXE_DESC_CTRL_BDH;
+   }
+   /* Channel Priority */
+   dxeControlRead |= channelEntry->channelConfig.chPriority << WLANDXE_CH_CTRL_PRIO_OFFSET;
+   /* BMU Threshold select, only used H2B, not this case??? */
+   dxeControlRead |= channelEntry->channelConfig.bmuThdSel << WLANDXE_CH_CTRL_BTHLD_SEL_OFFSET;
+   /* PDU Release, Release BD/PDU when DMA done */
+   dxeControlRead |= WLANDXE_DESC_CTRL_PDU_REL;
+   /* Use Short Descriptor, THIS LOOKS SOME WIERD, REVISIT */
+   if(!channelEntry->channelConfig.useShortDescFmt)
+   {
+      dxeControlRead |= WLANDXE_DESC_CTRL_DFMT;
+   }
+   /* Interrupt on Descriptor done */
+   dxeControlRead |= WLANDXE_DESC_CTRL_INT;
+   /* For ready status, this Control WORD must be VALID */
+   dxeControlRead |= WLANDXE_DESC_CTRL_VALID;
+   /* Frame Contents Swap */
+   dxeControlRead |= WLANDXE_DESC_CTRL_BDT_SWAP;
+   /* Host Little Endian */
+   if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
+      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+   {
+      dxeControlRead |= WLANDXE_DESC_CTRL_ENDIANNESS;
+   }
+
+   /* SWAP if needed */
+   channelEntry->extraConfig.cw_ctrl_read = WLANDXE_U32_SWAP_ENDIAN(dxeControlRead);
+   /* Control Read Done */
+
+   /* Control Write
+    * Write into DXE descriptor control word to TX frame
+    * DXE engine will reference this word to contorl TX DMA channel */
+   channelEntry->extraConfig.cw_ctrl_write = 0;
+   /* Transfer type, from Host 2 BMU */
+   dxeControlWrite |= mappedChannel->channelConfig->xfrType;
+   /* BD Present, this looks some weird ??? */
+   if(!channelEntry->channelConfig.bdPresent)
+   {
+      dxeControlWrite |= WLANDXE_DESC_CTRL_BDH;
+   }
+   /* Channel Priority */
+   dxeControlWrite |= channelEntry->channelConfig.chPriority << WLANDXE_CH_CTRL_PRIO_OFFSET;
+   /* Use Short Descriptor, THIS LOOKS SOME WIERD, REVISIT */
+   if(!channelEntry->channelConfig.useShortDescFmt)
+   {
+      dxeControlWrite |= WLANDXE_DESC_CTRL_DFMT;
+   }
+   /* BMU Threshold select, only used H2B, not this case??? */
+   dxeControlWrite |= channelEntry->channelConfig.bmuThdSel << WLANDXE_CH_CTRL_BTHLD_SEL_OFFSET;
+   /* Destination is WQ */
+   dxeControlWrite |= WLANDXE_DESC_CTRL_DIQ;
+   /* Frame Contents Swap */
+   dxeControlWrite |= WLANDXE_DESC_CTRL_BDT_SWAP;
+   /* Host Little Endian */
+   dxeControlWrite |= WLANDXE_DESC_CTRL_ENDIANNESS;
+   /* Interrupt Enable */
+   dxeControlWrite |= WLANDXE_DESC_CTRL_INT;
+
+   dxeControlWriteValid  = dxeControlWrite | WLANDXE_DESC_CTRL_VALID;
+   dxeControlWriteEop    = dxeControlWriteValid | WLANDXE_DESC_CTRL_EOP;
+   dxeControlWriteEopInt = dxeControlWriteEop | WLANDXE_DESC_CTRL_INT;
+
+   /* DXE Descriptor must has Endian swapped value */
+   channelEntry->extraConfig.cw_ctrl_write = WLANDXE_U32_SWAP_ENDIAN(dxeControlWrite);
+   /* Control Write DONE */
+
+   /* Control Write include VAL bit
+    * This Control word used to set valid bit and
+    * trigger DMA transfer for specific descriptor */
+   channelEntry->extraConfig.cw_ctrl_write_valid =
+                  WLANDXE_U32_SWAP_ENDIAN(dxeControlWriteValid);
+
+   /* Control Write include EOP
+    * End of Packet */
+   channelEntry->extraConfig.cw_ctrl_write_eop =
+                  WLANDXE_U32_SWAP_ENDIAN(dxeControlWriteEop);
+
+   /* Control Write include EOP and INT
+    * indicate End Of Packet and generate interrupt on descriptor Done */
+   channelEntry->extraConfig.cw_ctrl_write_eop_int =
+                  WLANDXE_U32_SWAP_ENDIAN(dxeControlWriteEopInt);
+
+
+   /* size mask???? */
+   channelEntry->extraConfig.chk_size_mask = 
+            mappedChannel->channelConfig->chk_size << 10;
+
+   channelEntry->extraConfig.refWQ_swapped = 
+                WLANDXE_U32_SWAP_ENDIAN(channelEntry->channelConfig.refWQ);
+
+   /* Set Channel specific Interrupt mask */
+   channelEntry->extraConfig.intMask = channelInterruptMask[mappedChannel->DMAChannel];
+
+
+   channelEntry->numDesc            = mappedChannel->channelConfig->nDescs;
+   channelEntry->assignedDMAChannel = mappedChannel->DMAChannel;
+   channelEntry->numFreeDesc             = 0;
+   channelEntry->numRsvdDesc             = 0;
+   channelEntry->numFragmentCurrentChain = 0;
+   channelEntry->numTotalFrame           = 0;
+   channelEntry->hitLowResource          = eWLAN_PAL_FALSE;
+
+   return status;
+}
diff --git a/CORE/DXE/src/wlan_qct_dxe_i.h b/CORE/DXE/src/wlan_qct_dxe_i.h
new file mode 100644
index 0000000..aebb686
--- /dev/null
+++ b/CORE/DXE/src/wlan_qct_dxe_i.h
@@ -0,0 +1,653 @@
+/*
+ * 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 WLAN_QCT_DXE_I_H
+#define WLAN_QCT_DXE_I_H
+
+/**=========================================================================
+  
+  @file  wlan_qct_dxe_i.h
+  
+  @brief 
+               
+   This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   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
+--------    ---         ----------------------------------------------------------
+08/03/10    schang      Created module.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_dxe.h"
+#include "wlan_qct_pal_trace.h"
+#include "vos_trace.h"
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define WLANDXE_CTXT_COOKIE              0xC00CC111
+
+
+/* From here RIVA DXE register information
+ * This is temporary definition location to make compile and unit test
+ * If official msmreg.h integrated, this part will be eliminated */
+/* Start with base address */
+
+#define WLANDXE_CCU_DXE_INT_SELECT       0x03200b10
+#define WLANDXE_CCU_DXE_INT_SELECT_STAT  0x03200b14
+#define WLANDXE_CCU_ASIC_INT_ENABLE      0x03200b18
+
+#ifdef PAL_OS_TYPE_BMP
+#define WLANDXE_RIVA_BASE_ADDRESS        0xCDD00000
+#else
+#define WLANDXE_RIVA_BASE_ADDRESS        0x03000000
+#endif /* PAL_OS_TYPE_BMP */
+
+#define WLANDXE_REGISTER_BASE_ADDRESS    WLANDXE_RIVA_BASE_ADDRESS + 0x202000
+
+/* Common over the channels register addresses */
+#define WALNDEX_DMA_CSR_ADDRESS          WLANDXE_REGISTER_BASE_ADDRESS + 0x00
+#define WALNDEX_DMA_ENCH_ADDRESS         WLANDXE_REGISTER_BASE_ADDRESS + 0x04
+#define WALNDEX_DMA_CH_EN_ADDRESS        WLANDXE_REGISTER_BASE_ADDRESS + 0x08
+#define WALNDEX_DMA_CH_DONE_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x0C
+#define WALNDEX_DMA_CH_ERR_ADDRESS       WLANDXE_REGISTER_BASE_ADDRESS + 0x10
+#define WALNDEX_DMA_CH_STOP_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x14
+
+/* Interrupt Control register address */
+#define WLANDXE_INT_MASK_REG_ADDRESS     WLANDXE_REGISTER_BASE_ADDRESS + 0x18
+#define WLANDXE_INT_SRC_MSKD_ADDRESS     WLANDXE_REGISTER_BASE_ADDRESS + 0x1C
+#define WLANDXE_INT_SRC_RAW_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x20
+#define WLANDXE_INT_ED_SRC_ADDRESS       WLANDXE_REGISTER_BASE_ADDRESS + 0x24
+#define WLANDXE_INT_DONE_SRC_ADDRESS     WLANDXE_REGISTER_BASE_ADDRESS + 0x28
+#define WLANDXE_INT_ERR_SRC_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x2C
+#define WLANDXE_INT_CLR_ADDRESS          WLANDXE_REGISTER_BASE_ADDRESS + 0x30
+#define WLANDXE_INT_ED_CLR_ADDRESS       WLANDXE_REGISTER_BASE_ADDRESS + 0x34
+#define WLANDXE_INT_DONE_CLR_ADDRESS     WLANDXE_REGISTER_BASE_ADDRESS + 0x38
+#define WLANDXE_INT_ERR_CLR_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x3C
+
+#define WLANDXE_DMA_CH_PRES_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x40
+#define WLANDXE_ARB_CH_MSK_CLR_ADDRRESS  WLANDXE_REGISTER_BASE_ADDRESS + 0x74
+
+/* Channel Counter register */
+#define WLANDXE_DMA_COUNTER_0            WLANDXE_REGISTER_BASE_ADDRESS + 0x200
+#define WLANDXE_DMA_COUNTER_1            WLANDXE_REGISTER_BASE_ADDRESS + 0x204
+#define WLANDXE_DMA_COUNTER_2            WLANDXE_REGISTER_BASE_ADDRESS + 0x208
+#define WLANDXE_DMA_COUNTER_3            WLANDXE_REGISTER_BASE_ADDRESS + 0x20C
+#define WLANDXE_DMA_COUNTER_4            WLANDXE_REGISTER_BASE_ADDRESS + 0x210
+#define WLANDXE_DMA_COUNTER_5            WLANDXE_REGISTER_BASE_ADDRESS + 0x214
+#define WLANDXE_DMA_COUNTER_6            WLANDXE_REGISTER_BASE_ADDRESS + 0x218
+
+#define WLANDXE_ENGINE_STAT_ADDRESS      WLANDXE_REGISTER_BASE_ADDRESS + 0x64
+#define WLANDXE_BMU_SB_QDAT_AV_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x5c
+
+/* Channel Base address */
+#define WLANDXE_DMA_CHAN0_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x400
+#define WLANDXE_DMA_CHAN1_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x440
+#define WLANDXE_DMA_CHAN2_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x480
+#define WLANDXE_DMA_CHAN3_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x4C0
+#define WLANDXE_DMA_CHAN4_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x500
+#define WLANDXE_DMA_CHAN5_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x540
+#define WLANDXE_DMA_CHAN6_BASE_ADDRESS   WLANDXE_REGISTER_BASE_ADDRESS + 0x580
+
+/* Channel specific register offset */
+#define WLANDXE_DMA_CH_CTRL_REG          0x0000
+#define WLANDXE_DMA_CH_STATUS_REG        0x0004
+#define WLANDXE_DMA_CH_SZ_REG            0x0008
+#define WLANDXE_DMA_CH_SADRL_REG         0x000C
+#define WLANDXE_DMA_CH_SADRH_REG         0x0010
+#define WLANDXE_DMA_CH_DADRL_REG         0x0014
+#define WLANDXE_DMA_CH_DADRH_REG         0x0018
+#define WLANDXE_DMA_CH_DESCL_REG         0x001C
+#define WLANDXE_DMA_CH_DESCH_REG         0x0020
+#define WLANDXE_DMA_CH_LST_DESCL_REG     0x0024
+#define WLANDXE_DMA_CH_LST_DESCH_REG     0x0028
+#define WLANDXE_DMA_CH_BD_REG            0x002C
+#define WLANDXE_DMA_CH_HEAD_REG          0x0030
+#define WLANDXE_DMA_CH_TAIL_REG          0x0034
+#define WLANDXE_DMA_CH_PDU_REG           0x0038
+#define WLANDXE_DMA_CH_TSTMP_REG         0x003C
+
+/* Common CSR Register Contorol mask and offset */
+#define WLANDXE_DMA_CSR_RESERVED_MASK         0xFFFE0000
+#define WLANDXE_DMA_CSR_RESERVED_OFFSET       0x11
+#define WLANDXE_DMA_CSR_RESERVED_DEFAULT      0x0
+
+#define WLANDXE_DMA_CSR_H2H_SYNC_EN_MASK      0x10000
+#define WLANDXE_DMA_CSR_H2H_SYNC_EN_OFFSET    0x10
+#define WLANDXE_DMA_CSR_H2H_SYNC_EN_DEFAULT   0x0
+
+#define WLANDXE_DMA_CSR_PAUSED_MASK           0x8000
+#define WLANDXE_DMA_CSR_PAUSED_OFFSET         0xF
+#define WLANDXE_DMA_CSR_PAUSED_DEFAULT        0x0
+
+#define WLANDXE_DMA_CSR_ECTR_EN_MASK          0x4000
+#define WLANDXE_DMA_CSR_ECTR_EN_OFFSET        0xE
+#define WLANDXE_DMA_CSR_ECTR_EN_DEFAULT       0x4000
+
+#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_MASK    0x3E00
+#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_OFFSET  0x9
+#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_DEFAULT 0xE00
+
+#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_MASK    0x1F0
+#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_OFFSET  0x4
+#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_DEFAULT 0x50
+
+#define WLANDXE_DMA_CSR_TSTMP_EN_MASK         0x8
+#define WLANDXE_DMA_CSR_TSTMP_EN_OFFSET       0x3
+#define WLANDXE_DMA_CSR_TSTMP_EN_DEFAULT      0x0
+
+#define WLANDXE_DMA_CSR_RESET_MASK            0x4
+#define WLANDXE_DMA_CSR_RESET_OFFSET          0x2
+#define WLANDXE_DMA_CSR_RESET_DEFAULT         0x0
+
+#define WLANDXE_DMA_CSR_PAUSE_MASK            0x2
+#define WLANDXE_DMA_CSR_PAUSE_OFFSET          0x1
+#define WLANDXE_DMA_CSR_PAUSE_DEFAULT         0x0
+
+#define WLANDXE_DMA_CSR_EN_MASK               0x1
+#define WLANDXE_DMA_CSR_EN_OFFSET             0x0
+#define WLANDXE_DMA_CSR_EN_DEFAULT            0x0
+#define WLANDXE_DMA_CSR_DEFAULT               0x4E50
+
+/* Channel CTRL Register Control mask and offset */
+#define WLANDXE_CH_CTRL_RSVD_MASK             0x80000000
+#define WLANDXE_CH_CTRL_RSVD_OFFSET           0x1F
+#define WLANDXE_CH_CTRL_RSVD_DEFAULT          0x0
+
+#define WLANDXE_CH_CTRL_SWAP_MASK             0x80000000
+
+#define WLANDXE_CH_CTRL_BDT_IDX_MASK          0x60000000
+#define WLANDXE_CH_CTRL_BDT_IDX_OFFSET        0x1D
+#define WLANDXE_CH_CTRL_BDT_IDX_DEFAULT       0x0
+
+#define WLANDXE_CH_CTRL_DFMT_MASK             0x10000000
+#define WLANDXE_CH_CTRL_DFMT_OFFSET           0x1C
+#define WLANDXE_CH_CTRL_DFMT_DEFAULT          0x10000000
+#define WLANDXE_CH_CTRL_DFMT_ESHORT           0x0
+#define WLANDXE_CH_CTRL_DFMT_ELONG            0x1
+
+#define WLANDXE_CH_CTRL_ABORT_MASK            0x8000000
+#define WLANDXE_CH_CTRL_ABORT_OFFSET          0x1B
+#define WLANDXE_CH_CTRL_ABORT_DEFAULT         0x0
+
+#define WLANDXE_CH_CTRL_ENDIAN_MASK           0x4000000
+
+#define WLANDXE_CH_CTRL_CTR_SEL_MASK          0x3C00000
+#define WLANDXE_CH_CTRL_CTR_SEL_OFFSET        0x16
+#define WLANDXE_CH_CTRL_CTR_SEL_DEFAULT       0x0
+
+#define WLANDXE_CH_CTRL_EDVEN_MASK            0x200000
+#define WLANDXE_CH_CTRL_EDVEN_OFFSET          0x15
+#define WLANDXE_CH_CTRL_EDVEN_DEFAULT         0x0
+
+#define WLANDXE_CH_CTRL_EDEN_MASK             0x100000
+#define WLANDXE_CH_CTRL_EDEN_OFFSET           0x14
+#define WLANDXE_CH_CTRL_EDEN_DEFAULT          0x0
+
+#define WLANDXE_CH_CTRL_INE_DONE_MASK         0x80000
+#define WLANDXE_CH_CTRL_INE_DONE_OFFSET       0x13
+#define WLANDXE_CH_CTRL_INE_DONE_DEFAULT      0x0
+
+#define WLANDXE_CH_CTRL_INE_ERR_MASK          0x40000
+#define WLANDXE_CH_CTRL_INE_ERR_OFFSET        0x12
+#define WLANDXE_CH_CTRL_INE_ERR_DEFAULT       0x0
+
+#define WLANDXE_CH_CTRL_INE_ED_MASK           0x20000
+#define WLANDXE_CH_CTRL_INE_ED_OFFSET         0x11
+#define WLANDXE_CH_CTRL_INE_ED_DEFAULT        0x0
+
+#define WLANDXE_CH_CTRL_STOP_MASK             0x10000
+#define WLANDXE_CH_CTRL_STOP_OFFSET           0x10
+#define WLANDXE_CH_CTRL_STOP_DEFAULT          0x0
+
+#define WLANDXE_CH_CTRL_PRIO_MASK             0xE000
+#define WLANDXE_CH_CTRL_PRIO_OFFSET           0xD
+#define WLANDXE_CH_CTRL_PRIO_DEFAULT          0x0
+
+#define WLANDXE_CH_CTRL_BTHLD_SEL_MASK        0x1E00
+#define WLANDXE_CH_CTRL_BTHLD_SEL_OFFSET      0x9
+#define WLANDXE_CH_CTRL_BTHLD_SEL_DEFAULT     0x600
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD0      0x0
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD1      0x1
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD2      0x2
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD3      0x3
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD4      0x4
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD5      0x5
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD6      0x6
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD7      0x7
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD8      0x8
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD9      0x9
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD10     0xA
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD11     0xB
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD12     0xC
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD13     0xD
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD14     0xE
+#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD15     0xF
+
+#define WLANDXE_CH_CTRL_PDU_REL_MASK          0x100
+#define WLANDXE_CH_CTRL_PDU_REL_OFFSET        0x8
+#define WLANDXE_CH_CTRL_PDU_REL_DEFAULT       0x100
+#define WLANDXE_CH_CTRL_PDU_REL_EKEEP         0x0
+#define WLANDXE_CH_CTRL_PDU_REL_ERELEASE      0x1
+
+#define WLANDXE_CH_CTRL_PIQ_MASK              0x80
+#define WLANDXE_CH_CTRL_PIQ_OFFSET            0x7
+#define WLANDXE_CH_CTRL_PIQ_DEFAULT           0x0
+#define WLANDXE_CH_CTRL_PIQ_EFLAT             0x0
+#define WLANDXE_CH_CTRL_PIQ_EQUEUE            0x1
+
+#define WLANDXE_CH_CTRL_DIQ_MASK              0x40
+#define WLANDXE_CH_CTRL_DIQ_OFFSET            0x6
+#define WLANDXE_CH_CTRL_DIQ_DEFAULT           0x0
+#define WLANDXE_CH_CTRL_DIQ_EFLAT             0x0
+#define WLANDXE_CH_CTRL_DIQ_EQUEUE            0x1
+
+#define WLANDXE_CH_CTRL_SIQ_MASK              0x20
+#define WLANDXE_CH_CTRL_SIQ_OFFSET            0x5
+#define WLANDXE_CH_CTRL_SIQ_DEFAULT           0x0
+#define WLANDXE_CH_CTRL_SIQ_EFLAT             0x0
+#define WLANDXE_CH_CTRL_SIQ_EQUEUE            0x1
+
+#define WLANDXE_CH_CTRL_BDH_MASK              0x10
+#define WLANDXE_CH_CTRL_BDH_OFFSET            0x4
+#define WLANDXE_CH_CTRL_BDH_DEFAULT           0x0
+
+#define WLANDXE_CH_CTRL_EOP_MASK              0x8
+#define WLANDXE_CH_CTRL_EOP_OFFSET            0x3
+#define WLANDXE_CH_CTRL_EOP_DEFAULT           0x8
+
+#define WLANDXE_CH_CTRL_XTYPE_MASK            0x6
+#define WLANDXE_CH_CTRL_XTYPE_OFFSET          0x1
+#define WLANDXE_CH_CTRL_XTYPE_DEFAULT         0x0
+#define WLANDXE_CH_CTRL_XTYPE_EH2H            0x0
+#define WLANDXE_CH_CTRL_XTYPE_EB2B            0x1
+#define WLANDXE_CH_CTRL_XTYPE_EH2B            0x2
+#define WLANDXE_CH_CTRL_XTYPE_EB2H            0x3
+
+#define WLANDXE_CH_CTRL_DONE_MASK             0x4
+
+#define WLANDXE_CH_CTRL_ERR_MASK              0x20
+
+#define WLANDXE_CH_CTRL_MASKED_MASK           0x8
+
+#define WLANDXE_CH_CTRL_EN_MASK               0x1
+#define WLANDXE_CH_CTRL_EN_OFFSET             0x0
+#define WLANDXE_CH_CTRL_EN_DEFAULT            0x0
+#define WLANDXE_CH_CTRL_DEFAULT               0x10000708
+
+
+#define WLANDXE_DESC_CTRL_VALID          0x00000001
+#define WLANDXE_DESC_CTRL_XTYPE_MASK     0x00000006
+#define WLANDXE_DESC_CTRL_XTYPE_H2H      0x00000000
+#define WLANDXE_DESC_CTRL_XTYPE_B2B      0x00000002
+#define WLANDXE_DESC_CTRL_XTYPE_H2B      0x00000004
+#define WLANDXE_DESC_CTRL_XTYPE_B2H      0x00000006
+#define WLANDXE_DESC_CTRL_EOP            0x00000008
+#define WLANDXE_DESC_CTRL_BDH            0x00000010
+#define WLANDXE_DESC_CTRL_SIQ            0x00000020
+#define WLANDXE_DESC_CTRL_DIQ            0x00000040
+#define WLANDXE_DESC_CTRL_PIQ            0x00000080
+#define WLANDXE_DESC_CTRL_PDU_REL        0x00000100
+#define WLANDXE_DESC_CTRL_BTHLD_SEL      0x00001E00
+#define WLANDXE_DESC_CTRL_PRIO           0x0000E000
+#define WLANDXE_DESC_CTRL_STOP           0x00010000
+#define WLANDXE_DESC_CTRL_INT            0x00020000
+#define WLANDXE_DESC_CTRL_BDT_SWAP       0x00100000
+#define WLANDXE_DESC_CTRL_ENDIANNESS     0x00200000
+#define WLANDXE_DESC_CTRL_DFMT           0x10000000
+#define WLANDXE_DESC_CTRL_RSVD           0xfffc0000
+/* CSR Register Control mask and offset */
+
+#define WLANDXE_CH_STAT_INT_DONE_MASK   0x00008000
+#define WLANDXE_CH_STAT_INT_ERR_MASK    0x00004000
+#define WLANDXE_CH_STAT_INT_ED_MASK     0x00002000
+
+#define WLANDXE_CH_STAT_MASKED_MASK     0x00000008
+/* Till here RIVA DXE register information
+ * This is temporary definition location to make compile and unit test
+ * If official msmreg.h integrated, this part will be eliminated */
+
+/* Interrupt control channel mask */
+#define WLANDXE_INT_MASK_CHAN_0          0x00000001
+#define WLANDXE_INT_MASK_CHAN_1          0x00000002
+#define WLANDXE_INT_MASK_CHAN_2          0x00000004
+#define WLANDXE_INT_MASK_CHAN_3          0x00000008
+#define WLANDXE_INT_MASK_CHAN_4          0x00000010
+#define WLANDXE_INT_MASK_CHAN_5          0x00000020
+#define WLANDXE_INT_MASK_CHAN_6          0x00000040
+
+#define WLANDXE_TX_LOW_RES_THRESHOLD     (5)
+
+/* DXE Descriptor Endian swap macro */
+#ifdef WLANDXE_ENDIAN_SWAP_ENABLE
+#define WLANDXE_U32_SWAP_ENDIAN(a) (((a & 0x000000FF) << 24) |    \
+                                    ((a & 0x0000FF00) << 8)  |    \
+                                    ((a & 0x00FF0000) >> 8)  |    \
+                                    ((a & 0xFF000000) >> 24))
+#else
+/* If DXE HW does not need endian swap, DO NOTHING */
+#define WLANDXE_U32_SWAP_ENDIAN(a) (a)
+#endif /* WLANDXE_ENDIAN_SWAP_ENABLE */
+
+/* Log Definition will be mappped with PAL MSG */
+#define HDXE_MSG                     WPAL_TRACE
+#define HDXE_ASSERT(a)               VOS_ASSERT(a)
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+/* DMA Channel Q handle Method type
+  * Linear handle or circular */
+typedef enum
+{
+   WLANDXE_CHANNEL_HANDLE_LINEAR,
+   WLANDXE_CHANNEL_HANDLE_CIRCULA
+}WLANDXE_ChannelHandleType;
+
+typedef enum
+{
+   WLANDXE_TX_COMP_INT_LR_THRESHOLD,
+   WLANDXE_TX_COMP_INT_PER_K_FRAMES,
+   WLANDXE_TX_COMP_INT_TIMER
+} WLANDXE_TXCompIntEnableType;
+
+typedef enum
+{
+   WLANDXE_SHORT_DESCRIPTOR,
+   WLANDXE_LONG_DESCRIPTOR
+} WLANDXE_DescriptorType;
+
+typedef enum
+{
+   WLANDXE_DMA_CHANNEL_0,
+   WLANDXE_DMA_CHANNEL_1,
+   WLANDXE_DMA_CHANNEL_2,
+   WLANDXE_DMA_CHANNEL_3,
+   WLANDXE_DMA_CHANNEL_4,
+   WLANDXE_DMA_CHANNEL_5,
+   WLANDXE_DMA_CHANNEL_6,
+   WLANDXE_DMA_CHANNEL_MAX
+} WLANDXE_DMAChannelType;
+
+/** DXE HW Long Descriptor format */
+typedef struct
+{
+   wpt_uint32                      srcMemAddrL;
+   wpt_uint32                      srcMemAddrH;
+   wpt_uint32                      dstMemAddrL;
+   wpt_uint32                      dstMemAddrH;
+   wpt_uint32                      phyNextL;
+   wpt_uint32                      phyNextH;
+} WLANDXE_LongDesc;
+
+
+/** DXE HW Short Descriptor format */
+typedef struct tDXEShortDesc
+{
+   wpt_uint32                      srcMemAddrL;
+   wpt_uint32                      dstMemAddrL;
+   wpt_uint32                      phyNextL;
+} WLANDXE_ShortDesc;
+
+
+/* DXE Descriptor Data Type
+  * Pick up from GEN5 */
+typedef struct
+{
+   union
+   {
+      wpt_uint32                   ctrl;
+      wpt_uint32                   valid          :1;     //0 = DMA stop, 1 = DMA continue with this descriptor
+      wpt_uint32                   transferType   :2;     //0 = Host to Host space
+      wpt_uint32                   eop            :1;     //End of Packet
+      wpt_uint32                   bdHandling     :1;          //if transferType = Host to BMU, then 0 means first 128 bytes contain BD, and 1 means create new empty BD
+      wpt_uint32                   siq            :1;     // SIQ
+      wpt_uint32                   diq            :1;     // DIQ
+      wpt_uint32                   pduRel         :1;     //0 = don't release BD and PDUs when done, 1 = release them
+      wpt_uint32                   bthldSel       :4;     //BMU Threshold Select
+      wpt_uint32                   prio           :3;     //Specifies the priority level to use for the transfer
+      wpt_uint32                   stopChannel    :1;     //1 = DMA stops processing further, channel requires re-enabling after this
+      wpt_uint32                   intr           :1;     //Interrupt on Descriptor Done
+      wpt_uint32                   rsvd           :1;     //reserved
+      wpt_uint32                   transferSize   :14;    //14 bits used - ignored for BMU transfers, only used for host to host transfers?
+   } descCtrl;
+   wpt_uint32                      xfrSize;
+   union
+   {
+      WLANDXE_LongDesc             dxe_long_desc;
+      WLANDXE_ShortDesc            dxe_short_desc;
+   }dxedesc; 
+} WLANDXE_DescType;
+
+typedef struct
+{
+   void                            *nextCtrlBlk;
+   wpt_packet                      *xfrFrame;  
+   WLANDXE_DescType                *linkedDesc;
+   unsigned int                    linkedDescPhyAddr;
+   wpt_uint32                       ctrlBlkOrder;
+#ifdef FEATURE_R33D
+   wpt_uint32                       shadowBufferVa;
+#endif /* FEATURE_R33D */
+} WLANDXE_DescCtrlBlkType;
+
+typedef struct
+{
+   /* Q handle method, linear or ring */
+   WLANDXE_ChannelHandleType       queueMethod;
+
+   /* Number of descriptors for DXE that can be queued for transfer at one time */
+   wpt_uint32                      nDescs;
+
+   /* Maximum number of receive buffers  of shared memory to use for this pipe */
+   wpt_uint32                      nRxBuffers;
+
+   /* Reference WQ - for H2B and B2H only */
+   wpt_uint32                      refWQ;
+
+   /* for usb only, endpoint info for CH_SADR or CH_DADR */
+   wpt_uint32                      refEP;
+
+   /* H2B(Tx), B2H(Rx), H2H(SRAM<->HostMem R/W) */
+   wpt_uint32                      xfrType;
+
+   /* Channel Priority 7(Highest) - 0(Lowest) */
+   wpt_uint32                      chPriority;
+
+   /* 1 = BD attached to frames for this pipe */
+   wpt_boolean                     bdPresent;
+
+   wpt_uint32                      chk_size;
+
+   wpt_uint32                      bmuThdSel;
+
+   /*  Added in Gen5 for Prefetch */
+   wpt_boolean                     useLower4G;
+
+   wpt_boolean                     useShortDescFmt;
+   /* Till here inharited from GEN5 code */
+   /* From now on, added for PRIMA  */
+} WLANDXE_ChannelConfigType;
+
+typedef struct
+{
+   wpt_uint32                      chDXEBaseAddr;
+   wpt_uint32                      chDXEStatusRegAddr;
+   wpt_uint32                      chDXEDesclRegAddr;
+   wpt_uint32                      chDXEDeschRegAddr;
+   wpt_uint32                      chDXELstDesclRegAddr;
+   wpt_uint32                      chDXECtrlRegAddr;
+   wpt_uint32                      chDXESzRegAddr;
+   wpt_uint32                      chDXEDadrlRegAddr;
+   wpt_uint32                      chDXEDadrhRegAddr;
+   wpt_uint32                      chDXESadrlRegAddr;
+   wpt_uint32                      chDXESadrhRegAddr;
+} WLANDXE_ChannelRegisterType;
+
+typedef struct
+{
+   wpt_uint32                      refWQ_swapped;
+   wpt_boolean                     chEnabled;
+   wpt_boolean                     chConfigured;    
+   wpt_uint32                      channel;
+   wpt_uint32                      chk_size_mask;
+   wpt_uint32                      bmuThdSel_mask;
+   wpt_uint32                      cw_ctrl_read;
+   wpt_uint32                      cw_ctrl_write;
+   wpt_uint32                      cw_ctrl_write_valid;
+   wpt_uint32                      cw_ctrl_write_eop;
+   wpt_uint32                      cw_ctrl_write_eop_int;
+   wpt_uint32                      chan_mask;
+   wpt_uint32                      chan_mask_read_disable;
+   wpt_uint32                      intMask;
+} WLANDXE_ChannelExConfigType;
+
+typedef struct
+{
+   WDTS_ChannelType                channelType;
+   WLANDXE_DescCtrlBlkType        *headCtrlBlk;
+   WLANDXE_DescCtrlBlkType        *tailCtrlBlk;
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
+   WLANDXE_DescType               *descriptorAllocation;
+#endif
+   WLANDXE_DescType               *DescBottomLoc;
+   unsigned int                    descBottomLocPhyAddr;
+   wpt_uint32                      numDesc;
+   wpt_uint32                      numFreeDesc;
+   wpt_uint32                      numRsvdDesc;
+   wpt_uint32                      maxFrameSize;
+   wpt_uint32                      numFragmentCurrentChain;
+   wpt_uint32                      numFrameBeforeInt;
+   wpt_uint32                      numTotalFrame;
+   wpt_mutex                       dxeChannelLock;
+   wpt_boolean                     hitLowResource;
+   WLANDXE_ChannelConfigType       channelConfig;
+   WLANDXE_ChannelRegisterType     channelRegister;
+   WLANDXE_ChannelExConfigType     extraConfig;
+   WLANDXE_DMAChannelType          assignedDMAChannel;
+   wpt_uint64                      rxDoneHistogram;
+} WLANDXE_ChannelCBType;
+
+typedef struct
+{
+   WLANDXE_TXCompIntEnableType     txIntEnable;
+   unsigned int                    txLowResourceThreshold_LoPriCh;
+   unsigned int                    txLowResourceThreshold_HiPriCh;
+   unsigned int                    rxLowResourceThreshold;
+   unsigned int                    txInterruptEnableFrameCount;
+   unsigned int                    txInterruptEnablePeriod;
+} WLANDXE_TxCompIntConfigType;
+
+typedef struct
+{
+   WLANDXE_ChannelCBType           dxeChannel[WDTS_CHANNEL_MAX];
+   WLANDXE_RxFrameReadyCbType      rxReadyCB;
+   WLANDXE_TxCompleteCbType        txCompCB;
+   WLANDXE_LowResourceCbType       lowResourceCB;
+   WLANDXE_TxCompIntConfigType     txCompInt;
+   void                           *clientCtxt;
+   wpt_uint32                      interruptPath;
+   wpt_msg                        *rxIsrMsg;
+   wpt_msg                        *txIsrMsg;
+   wpt_msg                        *rxPktAvailMsg;   
+   volatile WLANDXE_PowerStateType hostPowerState;
+   wpt_boolean                     rxIntDisabledByIMPS;
+   wpt_boolean                     txIntDisabledByIMPS;
+   WLANDXE_SetPowerStateCbType     setPowerStateCb;
+   volatile WLANDXE_RivaPowerStateType rivaPowerState;
+   wpt_boolean                     ringNotEmpty; 
+   wpt_boolean                     txIntEnable;
+   wpt_uint32                      txCompletedFrames; 
+   wpt_uint8                       ucTxMsgCnt; 
+   wpt_uint16                      lastKickOffDxe; 
+   wpt_uint32                      dxeCookie;
+   wpt_packet                     *freeRXPacket;
+   wpt_boolean                     rxPalPacketUnavailable;
+} WLANDXE_CtrlBlkType;
+
+/*==========================================================================
+  @  Function Name 
+      dxeCommonDefaultConfig
+
+  @  Description 
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+extern wpt_status dxeCommonDefaultConfig
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk
+);
+
+/*==========================================================================
+  @  Function Name 
+      dxeChannelDefaultConfig
+
+  @  Description 
+      Get defualt configuration values from pre defined structure
+      All the channels must have it's own configurations
+
+  @  Parameters
+      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+                               DXE host driver main control block
+      WLANDXE_ChannelCBType   *channelEntry
+                               Channel specific control block
+
+  @  Return
+      wpt_status
+
+===========================================================================*/
+extern wpt_status dxeChannelDefaultConfig
+(
+   WLANDXE_CtrlBlkType     *dxeCtrlBlk,
+   WLANDXE_ChannelCBType   *channelEntry
+);
+
+#endif /* WLAN_QCT_DXE_I_H */
diff --git a/CORE/HDD/inc/bap_hdd_main.h b/CORE/HDD/inc/bap_hdd_main.h
new file mode 100644
index 0000000..fe0a707
--- /dev/null
+++ b/CORE/HDD/inc/bap_hdd_main.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.
+ */
+
+#if !defined( BAP_HDD_MAIN_H )
+#define BAP_HDD_MAIN_H
+
+/**===========================================================================
+  
+  \file  BAP_HDD_MAIN_H.h
+  
+  \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+  
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <vos_list.h>
+#include <vos_types.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define BSL_MAX_CLIENTS               1
+#define BSL_MAX_PHY_LINK_PER_CLIENT   1
+
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+
+/**---------------------------------------------------------------------------
+  
+  \brief BSL_Init() - Initialize the BSL Misc char driver
+  
+  This is called in by WLANBAP_Open() as part of bringing up the BT-AMP PAL (BAP)
+  WLANBAP_Open() will pass in the device context created.
+  
+  \param  - NA
+  
+  \return - 0 for success non-zero for failure
+              
+  --------------------------------------------------------------------------*/
+int BSL_Init (void *pCtx);
+
+/**---------------------------------------------------------------------------
+  
+  \brief BSL_Deinit() - De-initialize the BSL Misc char driver
+  
+  This is called in by WLANBAP_Close() as part of bringing down the BT-AMP PAL (BAP)
+  
+  \param  - NA
+  
+  \return - 0 for success non-zero for failure
+              
+  --------------------------------------------------------------------------*/
+
+int BSL_Deinit(void *pCtx);
+
+
+
+#endif    // end #if !defined( BAP_HDD_MAIN_H )
diff --git a/CORE/HDD/inc/bap_hdd_misc.h b/CORE/HDD/inc/bap_hdd_misc.h
new file mode 100644
index 0000000..8a92bde
--- /dev/null
+++ b/CORE/HDD/inc/bap_hdd_misc.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( BAP_HDD_MISC_H )
+#define BAP_HDD_MISC_H
+
+/**===========================================================================
+  
+  \file  BAP_HDD_MISC.h
+  
+  \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+  
+#include <bapApi.h>
+#include <vos_types.h>
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+
+/**---------------------------------------------------------------------------
+  
+  \brief WLANBAP_SetConfig() - To updates some configuration for BAP module in
+  SME
+  
+  This should be called after WLANBAP_Start().
+  
+  \param  - NA
+  
+  \return -
+      The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAILURE:  failed to set the config in SME BAP 
+    VOS_STATUS_SUCCESS:  Success
+
+              
+  --------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_SetConfig
+(
+    WLANBAP_ConfigType *pConfig
+);
+
+/**---------------------------------------------------------------------------
+  
+  \brief WLANBAP_RegisterWithHCI() - To register WLAN PAL with HCI
+  
+  
+  \param
+   pAdapter : HDD adapter
+  
+  \return -
+      The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAILURE:  failed to register with HCI 
+    VOS_STATUS_SUCCESS:  Success
+
+              
+  --------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_RegisterWithHCI(hdd_adapter_t *pAdapter);
+
+/**---------------------------------------------------------------------------
+  
+  \brief WLANBAP_DeregisterFromHCI() - To deregister WLAN PAL with HCI
+  
+  
+  \param - NA
+  
+  \return -
+      The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAILURE:  failed to deregister with HCI 
+    VOS_STATUS_SUCCESS:  Success
+
+              
+  --------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_DeregisterFromHCI(void);
+
+/**---------------------------------------------------------------------------
+  
+  \brief WLANBAP_StopAmp() - To stop the current AMP traffic/connection
+  
+  
+  \param - NA
+  
+  \return -
+      The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAILURE:  failed to stop AMP connection 
+    VOS_STATUS_SUCCESS:  Success
+
+              
+  --------------------------------------------------------------------------*/
+VOS_STATUS WLANBAP_StopAmp(void);
+
+/**---------------------------------------------------------------------------
+  
+  \brief WLANBAP_AmpSessionOn() - To check if AMP connection is on currently
+  
+  
+  \param - NA
+  
+  \return -
+      The result code associated with performing the operation  
+
+    VOS_TRUE:  AMP connection is on 
+    VOS_FALSE: AMP connection is not on
+
+              
+  --------------------------------------------------------------------------*/
+v_BOOL_t WLANBAP_AmpSessionOn(void);
+#endif    // end #if !defined( BAP_HDD_MISC_H )
diff --git a/CORE/HDD/inc/qc_sap_ioctl.h b/CORE/HDD/inc/qc_sap_ioctl.h
new file mode 100644
index 0000000..0f5e3dc
--- /dev/null
+++ b/CORE/HDD/inc/qc_sap_ioctl.h
@@ -0,0 +1,252 @@
+/*
+ * 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 _QC_SAP_IOCTL_H_
+#define _QC_SAP_IOCTL_H_
+
+/*
+ * QCSAP ioctls.
+ */
+
+/*
+ * Max size of optional information elements.  We artificially
+ * constrain this; it's limited only by the max frame size (and
+ * the max parameter size of the wireless extensions).
+ */
+#define QCSAP_MAX_OPT_IE        256
+#define QCSAP_MAX_WSC_IE        256
+
+typedef struct sSSID
+{
+    u_int8_t       length;
+    u_int8_t       ssId[32];
+} tSSID;
+
+typedef struct sSSIDInfo
+{
+   tSSID     ssid;   
+   u_int8_t  ssidHidden;
+}tSSIDInfo;
+
+typedef enum {
+    eQC_DOT11_MODE_ALL = 0,
+    eQC_DOT11_MODE_ABG = 0x0001,    //11a/b/g only, no HT, no proprietary
+    eQC_DOT11_MODE_11A = 0x0002,
+    eQC_DOT11_MODE_11B = 0x0004,
+    eQC_DOT11_MODE_11G = 0x0008,
+    eQC_DOT11_MODE_11N = 0x0010,
+    eQC_DOT11_MODE_11G_ONLY = 0x0020,
+    eQC_DOT11_MODE_11N_ONLY = 0x0040,
+    eQC_DOT11_MODE_11B_ONLY = 0x0080,
+    eQC_DOT11_MODE_11A_ONLY = 0x0100,
+    //This is for WIFI test. It is same as eWNIAPI_MAC_PROTOCOL_ALL except when it starts IBSS in 11B of 2.4GHz
+    //It is for CSR internal use
+    eQC_DOT11_MODE_AUTO = 0x0200,
+
+} tQcPhyMode;
+
+#define QCSAP_ADDR_LEN  6
+
+typedef u_int8_t qcmacaddr[QCSAP_ADDR_LEN];
+
+struct qc_mac_acl_entry {
+    qcmacaddr addr;
+    int vlan_id;
+};
+
+typedef enum {
+    eQC_AUTH_TYPE_OPEN_SYSTEM,
+    eQC_AUTH_TYPE_SHARED_KEY,
+    eQC_AUTH_TYPE_AUTO_SWITCH
+} eQcAuthType; 
+
+typedef enum {
+    eQC_WPS_BEACON_IE,
+    eQC_WPS_PROBE_RSP_IE,
+    eQC_WPS_ASSOC_RSP_IE
+} eQCWPSType;
+
+typedef struct s_CommitConfig {
+
+    tSSIDInfo SSIDinfo;
+
+    u_int32_t beacon_int;       /* Beacon Interval */
+
+    tQcPhyMode hw_mode;         /* Wireless Mode */
+
+    u_int32_t channel;          /* Operation channel */
+
+    u_int32_t max_num_sta;      /* maximum number of STAs in station table */
+
+    u_int32_t dtim_period;      /* dtim interval */
+    u_int32_t max_listen_interval;
+
+    enum {
+        QC_ACCEPT_UNLESS_DENIED = 0,
+        QC_DENY_UNLESS_ACCEPTED = 1,
+    } qc_macaddr_acl;
+    
+    struct qc_mac_acl_entry *accept_mac; /* MAC filtering */
+    u_int32_t num_accept_mac;
+    struct qc_mac_acl_entry *deny_mac;   /* MAC filtering */
+    u_int32_t num_deny_mac;
+
+    u_int32_t ap_table_max_size;
+    u_int32_t ap_table_expiration_time;
+
+    int qcsap80211d;
+
+    u_int32_t countryCode[3];  //it ignored if [0] is 0.
+
+    u_int32_t ht_op_mode_fixed;
+    
+    /*HT capability information to enable/diabale protection
+     *           bit15   bit14   bit13   bit12 bit11 bit10    bit9 bit8
+     * (overlap) from11a from11b from11g Ht20  NonGf LsigTxop Rifs OBSS   
+     * bit7    bit6    bit5    bit4 bit3  bit2     bit1 bit0
+     * from11a from11b from11g ht20 nonGf lsigTxop rifs obss*/
+    u_int16_t ht_capab;
+
+    u_int32_t qcsap80211n;
+
+    eQcAuthType authType;
+
+    u_int8_t privacy;
+
+    u_int8_t set_ieee8021x;
+
+    u_int8_t RSNWPAReqIE[QCSAP_MAX_OPT_IE];     //If not null, it has the IE byte stream for RSN/WPA
+    u_int16_t RSNWPAReqIELength;  //The byte count in the pRSNReqIE/ WPAIE
+
+    u_int8_t wps_state; //wps_state - disbaled/not configured, configured
+} s_CommitConfig_t;
+
+
+/*
+ * MLME state manipulation request.  QCSAP_MLME_ASSOC
+ * is used for station mode only.  The other types are used for station or ap mode.
+ */
+struct sQcSapreq_mlme {
+    u_int8_t    im_op;          /* operation to perform */
+#define QCSAP_MLME_ASSOC        1       /* associate station */
+#define QCSAP_MLME_DISASSOC     2       /* disassociate station */
+#define QCSAP_MLME_DEAUTH       3       /* deauthenticate station */
+#define QCSAP_MLME_AUTHORIZE    4       /* authorize station */
+#define QCSAP_MLME_UNAUTHORIZE  5       /* unauthorize station */
+#define QCSAP_MLME_MICFAILURE   6       /* TKIP MICFAILURE */
+    u_int16_t   im_reason;      /* 802.11 reason code */
+    u_int8_t    im_macaddr[QCSAP_ADDR_LEN];
+};
+
+
+/*
+ * Retrieve the WPA/RSN information element for an associated station.
+ */
+struct sQcSapreq_wpaie {
+    u_int8_t    wpa_ie[QCSAP_MAX_OPT_IE];
+    u_int8_t    wpa_macaddr[QCSAP_ADDR_LEN];
+};
+
+/*
+ * Retrieve the WSC information element for an associated station.
+ */
+struct sQcSapreq_wscie {
+    u_int8_t    wsc_macaddr[QCSAP_ADDR_LEN];
+    u_int8_t    wsc_ie[QCSAP_MAX_WSC_IE];
+};
+
+
+/*
+ * Retrieve the WPS PBC Probe Request IEs.
+ */
+typedef struct sQcSapreq_WPSPBCProbeReqIES {
+    u_int8_t    macaddr[QCSAP_ADDR_LEN];
+    u_int16_t   probeReqIELen;
+    u_int8_t    probeReqIE[512]; 
+} sQcSapreq_WPSPBCProbeReqIES_t ;
+
+/*
+ * Channel List Info
+ */
+
+typedef struct
+{
+    v_U8_t            num_channels;    
+    v_U8_t            channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+}tChannelListInfo, *tpChannelListInfo;
+
+
+#ifdef __linux__
+/*
+ * Wireless Extensions API, private ioctl interfaces.
+ *
+ * NB: Even-numbered ioctl numbers have set semantics and are privileged!
+ *     (regardless of the incorrect comment in wireless.h!)
+ */
+
+#define QCSAP_IOCTL_SETPARAM          (SIOCIWFIRSTPRIV+0)
+#define QCSAP_IOCTL_GETPARAM          (SIOCIWFIRSTPRIV+1)
+#define QCSAP_IOCTL_COMMIT            (SIOCIWFIRSTPRIV+2)
+#define QCSAP_IOCTL_SETMLME           (SIOCIWFIRSTPRIV+3)
+
+#define QCSAP_IOCTL_GET_STAWPAIE      (SIOCIWFIRSTPRIV+4)
+#define QCSAP_IOCTL_SETWPAIE          (SIOCIWFIRSTPRIV+5)
+#define QCSAP_IOCTL_STOPBSS           (SIOCIWFIRSTPRIV+6)
+#define QCSAP_IOCTL_VERSION           (SIOCIWFIRSTPRIV+7)
+#define QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES       (SIOCIWFIRSTPRIV+8)
+#define QCSAP_IOCTL_GET_CHANNEL       (SIOCIWFIRSTPRIV+9)
+#define QCSAP_IOCTL_ASSOC_STA_MACADDR (SIOCIWFIRSTPRIV+10)
+#define QCSAP_IOCTL_DISASSOC_STA      (SIOCIWFIRSTPRIV+11)
+#define QCSAP_IOCTL_AP_STATS          (SIOCIWFIRSTPRIV+12)
+#define QCSAP_IOCTL_GET_STATS         (SIOCIWFIRSTPRIV+13)
+#define QCSAP_IOCTL_CLR_STATS         (SIOCIWFIRSTPRIV+14)
+
+#define QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV+15)
+#define WE_SET_WLAN_DBG 1
+#define QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV+16)
+#define WE_LOG_DUMP_CMD 1
+#define QCSAP_IOCTL_SET_CHANNEL_RANGE (SIOCIWFIRSTPRIV+17)
+
+#ifdef WLAN_FEATURE_P2P
+#define WE_P2P_NOA_CMD  2
+#endif
+
+#define QCSAP_IOCTL_MODIFY_ACL          (SIOCIWFIRSTPRIV+18)
+#define QCSAP_IOCTL_GET_CHANNEL_LIST    (SIOCIWFIRSTPRIV+19)
+
+#define MAX_VAR_ARGS         7
+#define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
+
+enum { 
+    QCSAP_PARAM_MAX_ASSOC = 1,
+    QCSAP_PARAM_MODULE_DOWN_IND = 5,
+    QCSAP_PARAM_CLR_ACL = 6,
+    QCSAP_PARAM_ACL_MODE = 7,
+    QCSAP_PARAM_HIDE_SSID = 8,
+};
+
+int iw_softap_get_channel_list(struct net_device *dev, 
+                               struct iw_request_info *info,
+                               union iwreq_data *wrqu, char *extra);
+
+#endif /* __linux__ */
+
+#endif /*_QC_SAP_IOCTL_H_*/
diff --git a/CORE/HDD/inc/wlan_hdd_assoc.h b/CORE/HDD/inc/wlan_hdd_assoc.h
new file mode 100644
index 0000000..f3e73c4
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_assoc.h
@@ -0,0 +1,107 @@
+/*
+ * 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( HDD_CONNECTION_H__ ) 
+#define HDD_CONNECTION_H__ 
+#include <wlan_hdd_mib.h>
+#define HDD_MAX_NUM_IBSS_STA ( 4 )
+#define TKIP_COUNTER_MEASURE_STARTED 1
+#define TKIP_COUNTER_MEASURE_STOPED  0 
+/* Timeout (in ms) for Link to Up before Registering Station */
+#define ASSOC_LINKUP_TIMEOUT 60
+typedef enum 
+{
+   /** Not associated in Infra or participating in an IBSS / Ad-hoc network.*/
+   eConnectionState_NotConnected,
+   /** Associated in an Infrastructure network.*/
+   eConnectionState_Associated,
+
+   /** Participating in an IBSS network though disconnected (no partner stations
+       in the IBSS).*/
+   eConnectionState_IbssDisconnected,
+
+   /** Participating in an IBSS network with partner stations also present*/
+   eConnectionState_IbssConnected
+
+}eConnectionState;
+/**This structure stores the connection information */
+typedef struct connection_info_s
+{
+   /** connection state of the NIC.*/
+   eConnectionState connState;
+   
+   /** BSS type of the current connection.   Comes from the MIB at the
+       time the connect request is issued in combination with the BssDescription
+      from the associated entity.*/
+      
+   eMib_dot11DesiredBssType connDot11DesiredBssType;
+   /** BSSID */
+   tCsrBssid bssId;
+   
+   /** SSID Info*/
+   tCsrSSIDInfo SSID;
+   
+   /** Station ID */
+   v_U8_t staId[ HDD_MAX_NUM_IBSS_STA ];
+   /** Peer Mac Address of the IBSS Stations */
+   v_MACADDR_t peerMacAddress[ HDD_MAX_NUM_IBSS_STA ];         
+   /** Auth Type */
+   eCsrAuthType   authType;
+
+   /** Unicast Encryption Type */
+   eCsrEncryptionType ucEncryptionType;
+
+   /** Multicast Encryption Type */
+   eCsrEncryptionType mcEncryptionType;
+
+   /** Keys */
+   tCsrKeys Keys;
+
+   /** Operation Channel  */
+   v_U8_t operationChannel; 
+   
+    /** Remembers authenticated state */
+   v_U8_t uIsAuthenticated;
+   
+}connection_info_t;
+/*Forward declaration of Adapter*/
+typedef struct hdd_adapter_s hdd_adapter_t;
+typedef struct hdd_context_s hdd_context_t;
+typedef struct hdd_station_ctx hdd_station_ctx_t;
+typedef struct hdd_ap_ctx_s  hdd_ap_ctx_t;
+#ifdef CONFIG_CFG80211   
+typedef struct hdd_mon_ctx_s  hdd_mon_ctx_t;
+#endif
+
+
+extern v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx );
+extern eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, v_U32_t roamId, 
+                                eRoamCmdStatus roamStatus, eCsrRoamResult roamResult );
+
+extern v_VOID_t hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType );
+
+inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddCtx, 
+        eMib_dot11DesiredBssType *pConnectedBssType );
+
+int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType );
+
+int hdd_set_csr_auth_type( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType );
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
new file mode 100644
index 0000000..8efaaf8
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -0,0 +1,1543 @@
+/*
+ * 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( HDD_CONFIG_H__ )
+#define HDD_CONFIG_H__
+
+/**===========================================================================
+
+  \file  hdd_Config.h
+
+  \brief Android WLAN Adapter Configuration functions
+
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+
+  ==========================================================================*/
+
+/* $HEADER$ */
+
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_wmm.h>
+#include <vos_types.h>
+#include <csrApi.h>
+
+//Number of items that can be configured
+#define MAX_CFG_INI_ITEMS   256
+
+// Defines for all of the things we read from the configuration (registry).
+
+#define CFG_RTS_THRESHOLD_NAME                 "RTSThreshold"
+#define CFG_RTS_THRESHOLD_MIN                  WNI_CFG_RTS_THRESHOLD_STAMIN // min is 0, meaning always use RTS.
+#define CFG_RTS_THRESHOLD_MAX                  WNI_CFG_RTS_THRESHOLD_STAMAX // max is the max frame size
+#define CFG_RTS_THRESHOLD_DEFAULT              WNI_CFG_RTS_THRESHOLD_STADEF
+
+#define CFG_FRAG_THRESHOLD_NAME                "gFragmentationThreshold"
+#define CFG_FRAG_THRESHOLD_MIN                 WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN 
+#define CFG_FRAG_THRESHOLD_MAX                 WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX
+#define CFG_FRAG_THRESHOLD_DEFAULT             WNI_CFG_FRAGMENTATION_THRESHOLD_STADEF
+
+#define CFG_CALIBRATION_NAME                   "gCalibration"
+#define CFG_CALIBRATION_MIN                    ( 0 ) 
+#define CFG_CALIBRATION_MAX                    ( 1 )
+#define CFG_CALIBRATION_MAC_DEFAULT            ( 1 )
+#define CFG_CALIBRATION_DEFAULT                CFG_CALIBRATION_MAC_DEFAULT
+
+#define CFG_CALIBRATION_PERIOD_NAME            "gCalibrationPeriod"
+#define CFG_CALIBRATION_PERIOD_MIN             ( 2 ) 
+#define CFG_CALIBRATION_PERIOD_MAX             ( 10 )
+#define CFG_CALIBRATION_PERIOD_MAC_DEFAULT     ( 5 )
+#define CFG_CALIBRATION_PERIOD_DEFAULT         CFG_CALIBRATION_PERIOD_MAC_DEFAULT          
+
+#define CFG_OPERATING_CHANNEL_NAME             "gOperatingChannel"
+#define CFG_OPERATING_CHANNEL_MIN              ( 0 )
+#define CFG_OPERATING_CHANNEL_MAX              ( 14 )
+#define CFG_OPERATING_CHANNEL_DEFAULT          ( 1 )
+
+#define CFG_SHORT_SLOT_TIME_ENABLED_NAME       "gShortSlotTimeEnabled"
+#define CFG_SHORT_SLOT_TIME_ENABLED_MIN        WNI_CFG_SHORT_SLOT_TIME_STAMIN
+#define CFG_SHORT_SLOT_TIME_ENABLED_MAX        WNI_CFG_SHORT_SLOT_TIME_STAMAX
+#define CFG_SHORT_SLOT_TIME_ENABLED_DEFAULT    WNI_CFG_SHORT_SLOT_TIME_STADEF
+
+#define CFG_11D_SUPPORT_ENABLED_NAME           "g11dSupportEnabled"
+#define CFG_11D_SUPPORT_ENABLED_MIN            WNI_CFG_11D_ENABLED_STAMIN 
+#define CFG_11D_SUPPORT_ENABLED_MAX            WNI_CFG_11D_ENABLED_STAMAX 
+#define CFG_11D_SUPPORT_ENABLED_DEFAULT        WNI_CFG_11D_ENABLED_STADEF    // Default is ON 
+
+#define CFG_ENFORCE_11D_CHANNELS_NAME          "gEnforce11dChannel"
+#define CFG_ENFORCE_11D_CHANNELS_MIN           ( 0 )
+#define CFG_ENFORCE_11D_CHANNELS_MAX           ( 1 )
+#define CFG_ENFORCE_11D_CHANNELS_DEFAULT       ( 0 )
+
+//COUNTRY Code Priority 
+#define CFG_COUNTRY_CODE_PRIORITY_NAME         "gCountryCodePriority"
+#define CFG_COUNTRY_CODE_PRIORITY_MIN          ( 0 )
+#define CFG_COUNTRY_CODE_PRIORITY_MAX          ( 1 )
+#define CFG_COUNTRY_CODE_PRIORITY_DEFAULT      ( 0 )
+
+#define CFG_ENFORCE_COUNTRY_CODE_MATCH_NAME    "gEnforceCountryCodeMatch"
+#define CFG_ENFORCE_COUNTRY_CODE_MATCH_MIN     ( 0 )
+#define CFG_ENFORCE_COUNTRY_CODE_MATCH_MAX     ( 1 )
+#define CFG_ENFORCE_COUNTRY_CODE_MATCH_DEFAULT ( 0 )
+
+#define CFG_ENFORCE_DEFAULT_DOMAIN_NAME        "gEnforceDefaultDomain"
+#define CFG_ENFORCE_DEFAULT_DOMAIN_MIN         ( 0 )
+#define CFG_ENFORCE_DEFAULT_DOMAIN_MAX         ( 1 ) 
+#define CFG_ENFORCE_DEFAULT_DOMAIN_DEFAULT     ( 0 )
+
+#define CFG_GENERIC_ID1_NAME                   "gCfg1Id"
+#define CFG_GENERIC_ID1_MIN                    ( 0 )
+#define CFG_GENERIC_ID1_MAX                    ( 0xffffffff )
+#define CFG_GENERIC_ID1_DEFAULT                ( 0 )
+
+#define CFG_GENERIC_ID2_NAME                   "gCfg2Id"
+#define CFG_GENERIC_ID2_MIN                    ( 0 )
+#define CFG_GENERIC_ID2_MAX                    ( 0xffffffff )
+#define CFG_GENERIC_ID2_DEFAULT                ( 0 )
+
+#define CFG_GENERIC_ID3_NAME                   "gCfg3Id"
+#define CFG_GENERIC_ID3_MIN                    ( 0 )
+#define CFG_GENERIC_ID3_MAX                    ( 0xffffffff )
+#define CFG_GENERIC_ID3_DEFAULT                ( 0 )
+
+#define CFG_GENERIC_ID4_NAME                   "gCfg4Id"
+#define CFG_GENERIC_ID4_MIN                    ( 0 )
+#define CFG_GENERIC_ID4_MAX                    ( 0xffffffff )
+#define CFG_GENERIC_ID4_DEFAULT                ( 0 )
+
+#define CFG_GENERIC_ID5_NAME                   "gCfg5Id"
+#define CFG_GENERIC_ID5_MIN                    ( 0 )
+#define CFG_GENERIC_ID5_MAX                    ( 0xffffffff )
+#define CFG_GENERIC_ID5_DEFAULT                ( 0 )
+
+#define CFG_GENERIC_VALUE1_NAME                "gCfg1Value"
+#define CFG_GENERIC_VALUE1_MIN                 ( 0 )
+#define CFG_GENERIC_VALUE1_MAX                 ( 0xffffffff )
+#define CFG_GENERIC_VALUE1_DEFAULT             ( 0 )
+
+#define CFG_GENERIC_VALUE2_NAME                "gCfg2Value"
+#define CFG_GENERIC_VALUE2_MIN                 ( 0 )
+#define CFG_GENERIC_VALUE2_MAX                 ( 0xffffffff )
+#define CFG_GENERIC_VALUE2_DEFAULT             ( 0 )
+
+#define CFG_GENERIC_VALUE3_NAME                "gCfg3Value"
+#define CFG_GENERIC_VALUE3_MIN                 ( 0 )
+#define CFG_GENERIC_VALUE3_MAX                 ( 0xffffffff )
+#define CFG_GENERIC_VALUE3_DEFAULT             ( 0 )
+
+#define CFG_GENERIC_VALUE4_NAME                "gCfg4Value"
+#define CFG_GENERIC_VALUE4_MIN                 ( 0 )
+#define CFG_GENERIC_VALUE4_MAX                 ( 0xffffffff )
+#define CFG_GENERIC_VALUE4_DEFAULT             ( 0 )
+
+#define CFG_GENERIC_VALUE5_NAME                "gCfg5Value"
+#define CFG_GENERIC_VALUE5_MIN                 ( 0 )
+#define CFG_GENERIC_VALUE5_MAX                 ( 0xffffffff )
+#define CFG_GENERIC_VALUE5_DEFAULT             ( 0 )
+
+#define CFG_HEARTBEAT_THRESH_24_NAME           "gHeartbeat24"
+#define CFG_HEARTBEAT_THRESH_24_MIN            WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN
+#define CFG_HEARTBEAT_THRESH_24_MAX            WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX
+#define CFG_HEARTBEAT_THRESH_24_DEFAULT        WNI_CFG_HEART_BEAT_THRESHOLD_STADEF
+
+#define CFG_POWER_USAGE_NAME                   "gPowerUsage"
+#define CFG_POWER_USAGE_MIN                    "Min" //Minimum Power Save
+#define CFG_POWER_USAGE_MAX                    "Max" //Maximum Power Save
+#define CFG_POWER_USAGE_DEFAULT                "Mod" //Moderate Power Save
+
+//Enable suspend on Android
+#define CFG_ENABLE_SUSPEND_NAME                "gEnableSuspend"
+#define CFG_ENABLE_SUSPEND_MIN                 ( 0 ) //No support for suspend
+#define CFG_ENABLE_SUSPEND_MAX                 ( 3 ) //Map to Deep Sleep
+#define CFG_ENABLE_SUSPEND_DEFAULT             ( 1 ) //Map to Standby
+
+//Driver start/stop command mappings
+#define CFG_ENABLE_ENABLE_DRIVER_STOP_NAME     "gEnableDriverStop"
+#define CFG_ENABLE_ENABLE_DRIVER_STOP_MIN      ( 0 ) //No support for stop
+#define CFG_ENABLE_ENABLE_DRIVER_STOP_MAX      ( 2 ) //Map to Deep Sleep
+#define CFG_ENABLE_ENABLE_DRIVER_STOP_DEFAULT  ( 0 )
+
+#define CFG_WOWL_PATTERN_NAME                  "gWowlPattern"
+#define CFG_WOWL_PATTERN_DEFAULT               ""
+
+//IMPS = IdleModePowerSave
+#define CFG_ENABLE_IMPS_NAME                   "gEnableImps"
+#define CFG_ENABLE_IMPS_MIN                    ( 0 )
+#define CFG_ENABLE_IMPS_MAX                    ( 1 )
+#define CFG_ENABLE_IMPS_DEFAULT                ( 1 )
+
+#define CFG_IMPS_MINIMUM_SLEEP_TIME_NAME       "gImpsMinSleepTime" 
+#define CFG_IMPS_MINIMUM_SLEEP_TIME_MIN        ( 0 )
+#define CFG_IMPS_MINIMUM_SLEEP_TIME_MAX        ( 65535 )
+#define CFG_IMPS_MINIMUM_SLEEP_TIME_DEFAULT    ( 5 )
+    
+#define CFG_IMPS_MODERATE_SLEEP_TIME_NAME      "gImpsModSleepTime"
+#define CFG_IMPS_MODERATE_SLEEP_TIME_MIN       ( 0 )
+#define CFG_IMPS_MODERATE_SLEEP_TIME_MAX       ( 65535 )
+#define CFG_IMPS_MODERATE_SLEEP_TIME_DEFAULT   ( 10)
+
+#define CFG_IMPS_MAXIMUM_SLEEP_TIME_NAME       "gImpsMaxSleepTime"
+#define CFG_IMPS_MAXIMUM_SLEEP_TIME_MIN        ( 0 )
+#define CFG_IMPS_MAXIMUM_SLEEP_TIME_MAX        ( 65535 )
+#define CFG_IMPS_MAXIMUM_SLEEP_TIME_DEFAULT    ( 15 )
+
+//BMPS = BeaconModePowerSave
+#define CFG_ENABLE_BMPS_NAME                   "gEnableBmps"
+#define CFG_ENABLE_BMPS_MIN                    ( 0 )
+#define CFG_ENABLE_BMPS_MAX                    ( 1 )
+#define CFG_ENABLE_BMPS_DEFAULT                ( 1 )
+
+#define CFG_BMPS_MINIMUM_LI_NAME               "gBmpsMinListenInterval"
+#define CFG_BMPS_MINIMUM_LI_MIN                ( 1 )
+#define CFG_BMPS_MINIMUM_LI_MAX                ( 65535 )
+#define CFG_BMPS_MINIMUM_LI_DEFAULT            ( 1 )
+    
+#define CFG_BMPS_MODERATE_LI_NAME              "gBmpsModListenInterval"
+#define CFG_BMPS_MODERATE_LI_MIN               ( 1 )
+#define CFG_BMPS_MODERATE_LI_MAX               ( 65535 )
+#define CFG_BMPS_MODERATE_LI_DEFAULT           ( 1 )
+
+#define CFG_BMPS_MAXIMUM_LI_NAME               "gBmpsMaxListenInterval"
+#define CFG_BMPS_MAXIMUM_LI_MIN                ( 1 )
+#define CFG_BMPS_MAXIMUM_LI_MAX                ( 65535 )
+#define CFG_BMPS_MAXIMUM_LI_DEFAULT            ( 1 )
+
+// gEnableAutoBmpsTimer has been previously published as an externally
+// configurable parameter. See analysis of CR 178211 for detailed info
+// on why we want to *always* set this to 1 i.e. we no longer want
+// this parameter to be configurable. the clean solution would be for 
+// users to not define this item in winreg so that the default value 
+// (which needs to be changed to 1) gets picked up but we cannot rely on that 
+// since this item has been published already hence the proposed
+// solution to change the name of the item along with the change in the
+// default value. also we could decide to not read this item from registry
+// but leaving open the option of being able to configure this item for
+// ASW's internal use
+#define CFG_ENABLE_AUTO_BMPS_TIMER_NAME        "gEnableAutoBmpsTimer_INTERNAL"
+#define CFG_ENABLE_AUTO_BMPS_TIMER_MIN         ( 0 )
+#define CFG_ENABLE_AUTO_BMPS_TIMER_MAX         ( 1 )
+#define CFG_ENABLE_AUTO_BMPS_TIMER_DEFAULT     ( 1 )
+
+#define CFG_AUTO_BMPS_TIMER_VALUE_NAME         "gAutoBmpsTimerValue" 
+#define CFG_AUTO_BMPS_TIMER_VALUE_MIN          ( 1000 )
+#define CFG_AUTO_BMPS_TIMER_VALUE_MAX          ( 4294967295UL )
+#define CFG_AUTO_BMPS_TIMER_VALUE_DEFAULT      ( 1000 )        
+    
+#define CFG_MAX_RX_AMPDU_FACTOR_NAME           "gMaxRxAmpduFactor"   
+#define CFG_MAX_RX_AMPDU_FACTOR_MIN            WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMIN 
+#define CFG_MAX_RX_AMPDU_FACTOR_MAX            WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX 
+#define CFG_MAX_RX_AMPDU_FACTOR_DEFAULT        WNI_CFG_MAX_RX_AMPDU_FACTOR_STADEF 
+
+typedef enum
+{
+    eHDD_DOT11_MODE_AUTO = 0, //covers all things we support
+    eHDD_DOT11_MODE_abg,      //11a/b/g only, no HT, no proprietary
+    eHDD_DOT11_MODE_11b,
+    eHDD_DOT11_MODE_11g,
+    eHDD_DOT11_MODE_11n,
+    eHDD_DOT11_MODE_11g_ONLY,
+    eHDD_DOT11_MODE_11n_ONLY,
+    eHDD_DOT11_MODE_11b_ONLY,
+}eHddDot11Mode;
+
+#define CFG_DOT11_MODE_NAME                    "gDot11Mode"
+#define CFG_DOT11_MODE_MIN                     eHDD_DOT11_MODE_AUTO
+#define CFG_DOT11_MODE_MAX                     eHDD_DOT11_MODE_11b_ONLY
+#define CFG_DOT11_MODE_DEFAULT                 eHDD_DOT11_MODE_11n
+
+#define CFG_CHANNEL_BONDING_MODE_24GHZ_NAME    "gChannelBondingMode24GHz"
+#define CFG_CHANNEL_BONDING_MODE_MIN           WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 
+#define CFG_CHANNEL_BONDING_MODE_MAX           WNI_CFG_CHANNEL_BONDING_MODE_STAMAX 
+#define CFG_CHANNEL_BONDING_MODE_DEFAULT       WNI_CFG_CHANNEL_BONDING_MODE_STADEF 
+
+#define CFG_CHANNEL_BONDING_MODE_5GHZ_NAME     "gChannelBondingMode5GHz"
+#define CFG_CHANNEL_BONDING_MODE_MIN           WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 
+#define CFG_CHANNEL_BONDING_MODE_MAX           WNI_CFG_CHANNEL_BONDING_MODE_STAMAX 
+#define CFG_CHANNEL_BONDING_MODE_DEFAULT       WNI_CFG_CHANNEL_BONDING_MODE_STADEF 
+
+#define CFG_FIXED_RATE_NAME                    "gFixedRate"
+#define CFG_FIXED_RATE_MIN                     WNI_CFG_FIXED_RATE_STAMIN
+#define CFG_FIXED_RATE_MAX                     WNI_CFG_FIXED_RATE_STAMAX
+#define CFG_FIXED_RATE_DEFAULT                 WNI_CFG_FIXED_RATE_STADEF 
+ 
+#define CFG_SHORT_GI_20MHZ_NAME                "gShortGI20Mhz"
+#define CFG_SHORT_GI_20MHZ_MIN                 WNI_CFG_SHORT_GI_20MHZ_STAMIN
+#define CFG_SHORT_GI_20MHZ_MAX                 WNI_CFG_SHORT_GI_20MHZ_STAMAX 
+#define CFG_SHORT_GI_20MHZ_DEFAULT             WNI_CFG_SHORT_GI_20MHZ_STADEF 
+
+#define CFG_BLOCK_ACK_AUTO_SETUP_NAME          "gBlockAckAutoSetup"
+#define CFG_BLOCK_ACK_AUTO_SETUP_MIN           ( 0 )
+#define CFG_BLOCK_ACK_AUTO_SETUP_MAX           ( 1 )
+#define CFG_BLOCK_ACK_AUTO_SETUP_DEFAULT       ( 1 )
+
+#define CFG_SCAN_RESULT_AGE_COUNT_NAME         "gScanResultAgeCount"
+#define CFG_SCAN_RESULT_AGE_COUNT_MIN          ( 1 )
+#define CFG_SCAN_RESULT_AGE_COUNT_MAX          ( 100 )
+#define CFG_SCAN_RESULT_AGE_COUNT_DEFAULT      ( 3 )
+
+//All in seconds
+//Not Connect, No Power Save
+#define CFG_SCAN_RESULT_AGE_TIME_NCNPS_NAME    "gScanResultAgeNCNPS"
+#define CFG_SCAN_RESULT_AGE_TIME_NCNPS_MIN     ( 10 )
+#define CFG_SCAN_RESULT_AGE_TIME_NCNPS_MAX     ( 10000 )
+#define CFG_SCAN_RESULT_AGE_TIME_NCNPS_DEFAULT ( 50 )
+//Not Connect, Power Save
+#define CFG_SCAN_RESULT_AGE_TIME_NCPS_NAME     "gScanResultAgeNCPS"
+#define CFG_SCAN_RESULT_AGE_TIME_NCPS_MIN      ( 10 )
+#define CFG_SCAN_RESULT_AGE_TIME_NCPS_MAX      ( 10000 )
+#define CFG_SCAN_RESULT_AGE_TIME_NCPS_DEFAULT  ( 300 )
+//Connect, No Power Save
+#define CFG_SCAN_RESULT_AGE_TIME_CNPS_NAME     "gScanResultAgeCNPS"
+#define CFG_SCAN_RESULT_AGE_TIME_CNPS_MIN      ( 10 )
+#define CFG_SCAN_RESULT_AGE_TIME_CNPS_MAX      ( 10000 )
+#define CFG_SCAN_RESULT_AGE_TIME_CNPS_DEFAULT  ( 150 )
+//Connect, Power Save
+#define CFG_SCAN_RESULT_AGE_TIME_CPS_NAME      "gScanResultAgeCPS"
+#define CFG_SCAN_RESULT_AGE_TIME_CPS_MIN       ( 10 )
+#define CFG_SCAN_RESULT_AGE_TIME_CPS_MAX       ( 10000 )
+#define CFG_SCAN_RESULT_AGE_TIME_CPS_DEFAULT   ( 600 )
+
+#define CFG_RSSI_CATEGORY_GAP_NAME             "gRssiCatGap"
+#define CFG_RSSI_CATEGORY_GAP_MIN              ( 10 )  
+#define CFG_RSSI_CATEGORY_GAP_MAX              ( 100 )  
+#define CFG_RSSI_CATEGORY_GAP_DEFAULT          ( 30 )
+
+#define CFG_STAT_TIMER_INTERVAL_NAME           "gStatTimerInterval"
+#define CFG_STAT_TIMER_INTERVAL_MIN            ( 50 )     //ms
+#define CFG_STAT_TIMER_INTERVAL_MAX            ( 10000 )  
+#define CFG_STAT_TIMER_INTERVAL_DEFAULT        ( 500 )
+
+#define CFG_SHORT_PREAMBLE_NAME                "gShortPreamble"
+#define CFG_SHORT_PREAMBLE_MIN                 WNI_CFG_SHORT_PREAMBLE_STAMIN
+#define CFG_SHORT_PREAMBLE_MAX                 WNI_CFG_SHORT_PREAMBLE_STAMAX
+#define CFG_SHORT_PREAMBLE_DEFAULT             WNI_CFG_SHORT_PREAMBLE_STADEF
+
+#define CFG_IBSS_AUTO_BSSID_NAME               "gAutoIbssBssid"
+#define CFG_IBSS_AUTO_BSSID_MIN                WNI_CFG_IBSS_AUTO_BSSID_STAMIN
+#define CFG_IBSS_AUTO_BSSID_MAX                WNI_CFG_IBSS_AUTO_BSSID_STAMAX
+#define CFG_IBSS_AUTO_BSSID_DEFAULT            WNI_CFG_IBSS_AUTO_BSSID_STADEF
+
+#define CFG_IBSS_BSSID_NAME                    "gIbssBssid"
+#define CFG_IBSS_BSSID_MIN                     "000000000000"
+#define CFG_IBSS_BSSID_MAX                     "ffffffffffff"
+#define CFG_IBSS_BSSID_DEFAULT                 "000AF5040506"
+
+#define CFG_INTF0_MAC_ADDR_NAME                  "Intf0MacAddress"
+#define CFG_INTF0_MAC_ADDR_MIN                   "000000000000"
+#define CFG_INTF0_MAC_ADDR_MAX                   "ffffffffffff"
+#define CFG_INTF0_MAC_ADDR_DEFAULT               "000AF5898980"
+
+#define CFG_INTF1_MAC_ADDR_NAME                  "Intf1MacAddress"
+#define CFG_INTF1_MAC_ADDR_MIN                   "000000000000"
+#define CFG_INTF1_MAC_ADDR_MAX                   "ffffffffffff"
+#define CFG_INTF1_MAC_ADDR_DEFAULT               "000AF5898981"
+
+#define CFG_INTF2_MAC_ADDR_NAME                  "Intf2MacAddress"
+#define CFG_INTF2_MAC_ADDR_MIN                   "000000000000"
+#define CFG_INTF2_MAC_ADDR_MAX                   "ffffffffffff"
+#define CFG_INTF2_MAC_ADDR_DEFAULT               "000AF5898982"
+
+#define CFG_INTF3_MAC_ADDR_NAME                  "Intf3MacAddress"
+#define CFG_INTF3_MAC_ADDR_MIN                   "000000000000"
+#define CFG_INTF3_MAC_ADDR_MAX                   "ffffffffffff"
+#define CFG_INTF3_MAC_ADDR_DEFAULT               "000AF5898983"
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define CFG_AP_QOS_UAPSD_MODE_NAME             "gEnableApUapsd" // ACs to setup U-APSD for at assoc
+#define CFG_AP_QOS_UAPSD_MODE_MIN              ( 0 )
+#define CFG_AP_QOS_UAPSD_MODE_MAX              ( 1 ) 
+#define CFG_AP_QOS_UAPSD_MODE_DEFAULT          ( 1 )   
+
+#define CFG_AP_COUNTRY_CODE                    "gAPCntryCode"
+#define CFG_AP_COUNTRY_CODE_MIN                "USI"
+#define CFG_AP_COUNTRY_CODE_MAX                "USI"
+#define CFG_AP_COUNTRY_CODE_DEFAULT            "FFF"
+
+#define CFG_AP_ENABLE_PROTECTION_MODE_NAME            "gEnableApProt"
+#define CFG_AP_ENABLE_PROTECTION_MODE_MIN             ( 0 )
+#define CFG_AP_ENABLE_PROTECTION_MODE_MAX             ( 1 )
+#define CFG_AP_ENABLE_PROTECTION_MODE_DEFAULT         ( 1 )
+
+// Bit map for CFG_AP_PROTECTION_MODE_DEFAULT
+// LOWER byte for associated stations
+// UPPER byte for overlapping stations
+// each byte will have the following info
+// bit15 bit14 bit13     bit12  bit11 bit10    bit9     bit8
+// OBSS  RIFS  LSIG_TXOP NON_GF HT20  FROM_11G FROM_11B FROM_11A
+// bit7  bit6  bit5      bit4   bit3  bit2     bit1     bit0
+// OBSS  RIFS  LSIG_TXOP NON_GF HT_20 FROM_11G FROM_11B FROM_11A
+#define CFG_AP_PROTECTION_MODE_NAME            "gApProtection"
+#define CFG_AP_PROTECTION_MODE_MIN             ( 0x0 )
+#define CFG_AP_PROTECTION_MODE_MAX             ( 0xFFFF )
+#define CFG_AP_PROTECTION_MODE_DEFAULT         ( 0xBFFF )
+
+#define CFG_AP_OBSS_PROTECTION_MODE_NAME       "gEnableApOBSSProt" 
+#define CFG_AP_OBSS_PROTECTION_MODE_MIN        ( 0 )
+#define CFG_AP_OBSS_PROTECTION_MODE_MAX        ( 1 ) 
+#define CFG_AP_OBSS_PROTECTION_MODE_DEFAULT    ( 0 )   
+
+#define CFG_AP_STA_SECURITY_SEPERATION_NAME    "gDisableIntraBssFwd"
+#define CFG_AP_STA_SECURITY_SEPERATION_MIN     ( 0 )
+#define CFG_AP_STA_SECURITY_SEPERATION_MAX     ( 1 ) 
+#define CFG_AP_STA_SECURITY_SEPERATION_DEFAULT ( 0 )   
+
+#define CFG_AP_LISTEN_MODE_NAME               "gEnablePhyAgcListenMode" 
+#define CFG_AP_LISTEN_MODE_MIN                (0)
+#define CFG_AP_LISTEN_MODE_MAX                (128) 
+#define CFG_AP_LISTEN_MODE_DEFAULT            (128)   
+
+#define CFG_AP_AUTO_SHUT_OFF                "gAPAutoShutOff"
+#define CFG_AP_AUTO_SHUT_OFF_MIN            ( 0 )
+#define CFG_AP_AUTO_SHUT_OFF_MAX            ( 4294967295UL )
+#define CFG_AP_AUTO_SHUT_OFF_DEFAULT        ( 0 )
+
+#define CFG_FRAMES_PROCESSING_TH_MODE_NAME     "gMinFramesProcThres"
+#define CFG_FRAMES_PROCESSING_TH_MIN           ( 0 )
+#define CFG_FRAMES_PROCESSING_TH_MAX           ( 39 )
+#define CFG_FRAMES_PROCESSING_TH_DEFAULT       ( 0 )
+
+#define CFG_SAP_CHANNEL_SELECT_START_CHANNEL    "gAPChannelSelectStartChannel"
+#define CFG_SAP_CHANNEL_SELECT_START_CHANNEL_MIN                (0)
+#define CFG_SAP_CHANNEL_SELECT_START_CHANNEL_MAX                (0xFF)
+#define CFG_SAP_CHANNEL_SELECT_START_CHANNEL_DEFAULT            (0)
+
+#define CFG_SAP_CHANNEL_SELECT_END_CHANNEL "gAPChannelSelectEndChannel"
+#define CFG_SAP_CHANNEL_SELECT_END_CHANNEL_MIN                  (0)
+#define CFG_SAP_CHANNEL_SELECT_END_CHANNEL_MAX                  (0xFF)
+#define CFG_SAP_CHANNEL_SELECT_END_CHANNEL_DEFAULT              (11)
+
+#define CFG_SAP_CHANNEL_SELECT_OPERATING_BAND "gAPChannelSelectOperatingBand"
+#define CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_MIN       (0)
+#define CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_MAX               (0x4)
+#define CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_DEFAULT           (0)
+
+#define CFG_DISABLE_PACKET_FILTER "gDisablePacketFilter"
+#define CFG_DISABLE_PACKET_FILTER_MIN       (0)
+#define CFG_DISABLE_PACKET_FILTER_MAX               (0x1)
+#define CFG_DISABLE_PACKET_FILTER_DEFAULT           (0)
+
+#define CFG_ENABLE_LTE_COEX              "gEnableLTECoex"
+#define CFG_ENABLE_LTE_COEX_MIN               ( 0 )
+#define CFG_ENABLE_LTE_COEX_MAX               ( 1 )
+#define CFG_ENABLE_LTE_COEX_DEFAULT           ( 0 )
+
+#define CFG_AP_KEEP_ALIVE_PERIOD_NAME          "gApKeepAlivePeriod"
+#define CFG_AP_KEEP_ALIVE_PERIOD_MIN           ( 0 )
+#define CFG_AP_KEEP_ALIVE_PERIOD_MAX           ( 255)
+#define CFG_AP_KEEP_ALIVE_PERIOD_DEFAULT       ( 20 )
+
+#define CFG_GO_KEEP_ALIVE_PERIOD_NAME          "gGoKeepAlivePeriod"
+#define CFG_GO_KEEP_ALIVE_PERIOD_MIN           ( 0 )
+#define CFG_GO_KEEP_ALIVE_PERIOD_MAX           ( 255)
+#define CFG_GO_KEEP_ALIVE_PERIOD_DEFAULT       ( 20 )
+
+#endif
+
+#define CFG_BEACON_INTERVAL_NAME               "gBeaconInterval"
+#define CFG_BEACON_INTERVAL_MIN                WNI_CFG_BEACON_INTERVAL_STAMIN
+#define CFG_BEACON_INTERVAL_MAX                WNI_CFG_BEACON_INTERVAL_STAMAX
+#define CFG_BEACON_INTERVAL_DEFAULT            WNI_CFG_BEACON_INTERVAL_STADEF
+
+//Handoff Configuration Parameters
+#define CFG_ENABLE_HANDOFF_NAME                "gEnableHandoff"
+#define CFG_ENABLE_HANDOFF_MIN                 ( 0 )
+#define CFG_ENABLE_HANDOFF_MAX                 ( 1 )
+#define CFG_ENABLE_HANDOFF_DEFAULT             ( 1 )
+
+
+//Additional Handoff related Parameters  
+#define CFG_ENABLE_IDLE_SCAN_NAME             "gEnableIdleScan"      
+#define CFG_ENABLE_IDLE_SCAN_MIN              ( 0 )
+#define CFG_ENABLE_IDLE_SCAN_MAX              ( 1 )
+#define CFG_ENABLE_IDLE_SCAN_DEFAULT          ( 1 ) 
+
+#define CFG_ROAMING_TIME_NAME                 "gRoamingTime"
+#define CFG_ROAMING_TIME_MIN                  ( 0 )
+#define CFG_ROAMING_TIME_MAX                  ( 4294967UL )
+#define CFG_ROAMING_TIME_DEFAULT              ( 10 )
+
+#define CFG_VCC_RSSI_TRIGGER_NAME             "gVccRssiTrigger"
+#define CFG_VCC_RSSI_TRIGGER_MIN              ( 0 )
+#define CFG_VCC_RSSI_TRIGGER_MAX              ( 80 ) 
+#define CFG_VCC_RSSI_TRIGGER_DEFAULT          ( 80 )
+
+#define CFG_VCC_UL_MAC_LOSS_THRESH_NAME       "gVccUlMacLossThresh"
+#define CFG_VCC_UL_MAC_LOSS_THRESH_MIN        ( 0 )  
+#define CFG_VCC_UL_MAC_LOSS_THRESH_MAX        ( 9 )
+#define CFG_VCC_UL_MAC_LOSS_THRESH_DEFAULT    ( 9 )
+   
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_NAME      "gPassiveMaxChannelTime"
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_MIN       ( 0 )
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_MAX       ( 10000 )
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_DEFAULT   ( 110 )
+
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_NAME      "gPassiveMinChannelTime"
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_MIN       ( 0 )
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_MAX       ( 10000 )
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_DEFAULT   ( 60 )
+
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_NAME       "gActiveMaxChannelTime"
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_MIN        ( 0 )
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_MAX        ( 10000 )
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_DEFAULT    ( 40 )
+
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_NAME       "gActiveMinChannelTime"
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_MIN        ( 0 )
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_MAX        ( 10000 )
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT    ( 20 )
+
+#define CFG_MAX_PS_POLL_NAME                   "gMaxPsPoll"
+#define CFG_MAX_PS_POLL_MIN                    WNI_CFG_MAX_PS_POLL_STAMIN
+#define CFG_MAX_PS_POLL_MAX                    WNI_CFG_MAX_PS_POLL_STAMAX
+#define CFG_MAX_PS_POLL_DEFAULT                WNI_CFG_MAX_PS_POLL_STADEF
+
+#define CFG_MAX_TX_POWER_NAME                   "gTxPowerCap"
+#define CFG_MAX_TX_POWER_MIN                    WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN
+#define CFG_MAX_TX_POWER_MAX                    WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX
+//Not to use CFG default because if no registry setting, this is ignored by SME.
+#define CFG_MAX_TX_POWER_DEFAULT                WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX
+
+
+#define CFG_LOW_GAIN_OVERRIDE_NAME             "gLowGainOverride"
+#define CFG_LOW_GAIN_OVERRIDE_MIN              WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN
+#define CFG_LOW_GAIN_OVERRIDE_MAX              WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX
+#define CFG_LOW_GAIN_OVERRIDE_DEFAULT          WNI_CFG_LOW_GAIN_OVERRIDE_STADEF
+
+#define CFG_RSSI_FILTER_PERIOD_NAME            "gRssiFilterPeriod"
+#define CFG_RSSI_FILTER_PERIOD_MIN             WNI_CFG_RSSI_FILTER_PERIOD_STAMIN
+#define CFG_RSSI_FILTER_PERIOD_MAX             WNI_CFG_RSSI_FILTER_PERIOD_STAMAX
+// Increased this value for Non-CCX AP. This is cause FW RSSI Monitoring
+// the consumer of this value is ON by default. So to impact power numbers
+// we are setting this to a high value.
+#define CFG_RSSI_FILTER_PERIOD_DEFAULT         WNI_CFG_RSSI_FILTER_PERIOD_STADEF
+
+#define CFG_IGNORE_DTIM_NAME                   "gIgnoreDtim"
+#define CFG_IGNORE_DTIM_MIN                    WNI_CFG_IGNORE_DTIM_STAMIN
+#define CFG_IGNORE_DTIM_MAX                    WNI_CFG_IGNORE_DTIM_STAMAX
+#define CFG_IGNORE_DTIM_DEFAULT                WNI_CFG_IGNORE_DTIM_STADEF
+
+#define CFG_RX_ANT_CONFIGURATION_NAME          "gNumRxAnt"
+#define CFG_RX_ANT_CONFIGURATION_NAME_MIN      ( 1 )
+#define CFG_RX_ANT_CONFIGURATION_NAME_MAX      ( 2 )
+#define CFG_RX_ANT_CONFIGURATION_NAME_DEFAULT  ( 2 )
+
+#define CFG_FW_HEART_BEAT_MONITORING_NAME      "gEnableFWHeartBeatMonitoring"
+#define CFG_FW_HEART_BEAT_MONITORING_MIN       ( 0 )
+#define CFG_FW_HEART_BEAT_MONITORING_MAX       ( 1 )
+#define CFG_FW_HEART_BEAT_MONITORING_DEFAULT   ( 1 )
+
+#define CFG_FW_BEACON_FILTERING_NAME           "gEnableFWBeaconFiltering"
+#define CFG_FW_BEACON_FILTERING_MIN            ( 0 )
+#define CFG_FW_BEACON_FILTERING_MAX            ( 1 )
+#define CFG_FW_BEACON_FILTERING_DEFAULT        ( 1 )
+
+#define CFG_FW_RSSI_MONITORING_NAME            "gEnableFWRssiMonitoring"
+#define CFG_FW_RSSI_MONITORING_MIN             ( 0 )
+#define CFG_FW_RSSI_MONITORING_MAX             ( 1 )
+#define CFG_FW_RSSI_MONITORING_DEFAULT         WNI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF
+
+#define CFG_DATA_INACTIVITY_TIMEOUT_NAME       "gDataInactivityTimeout"
+#define CFG_DATA_INACTIVITY_TIMEOUT_MIN        ( 1 )
+#define CFG_DATA_INACTIVITY_TIMEOUT_MAX        ( 255 )
+#define CFG_DATA_INACTIVITY_TIMEOUT_DEFAULT    ( 20 )
+
+#define CFG_NTH_BEACON_FILTER_NAME             "gNthBeaconFilter"
+#define CFG_NTH_BEACON_FILTER_MIN              ( WNI_CFG_NTH_BEACON_FILTER_STAMIN )
+#define CFG_NTH_BEACON_FILTER_MAX              ( WNI_CFG_NTH_BEACON_FILTER_STAMAX )
+#define CFG_NTH_BEACON_FILTER_DEFAULT          ( WNI_CFG_NTH_BEACON_FILTER_STADEF )
+
+#define CFG_RF_SETTLING_TIME_CLK_NAME          "rfSettlingTimeUs"
+#define CFG_RF_SETTLING_TIME_CLK_MIN           ( 0 )
+#define CFG_RF_SETTLING_TIME_CLK_MAX           ( 60000 )
+#define CFG_RF_SETTLING_TIME_CLK_DEFAULT       ( 1500 )
+
+#define CFG_INFRA_STA_KEEP_ALIVE_PERIOD_NAME          "gStaKeepAlivePeriod"
+#define CFG_INFRA_STA_KEEP_ALIVE_PERIOD_MIN           ( 0 )
+#define CFG_INFRA_STA_KEEP_ALIVE_PERIOD_MAX           ( 65535)
+#define CFG_INFRA_STA_KEEP_ALIVE_PERIOD_DEFAULT       ( 0 )
+
+//WMM configuration
+#define CFG_QOS_WMM_MODE_NAME                             "WmmIsEnabled"
+#define CFG_QOS_WMM_MODE_MIN                               (0)
+#define CFG_QOS_WMM_MODE_MAX                               (2) //HDD_WMM_NO_QOS
+#define CFG_QOS_WMM_MODE_DEFAULT                           (0) //HDD_WMM_AUTO
+
+#define CFG_QOS_WMM_80211E_ENABLED_NAME                   "80211eIsEnabled"
+#define CFG_QOS_WMM_80211E_ENABLED_MIN                     (0)
+#define CFG_QOS_WMM_80211E_ENABLED_MAX                     (1) 
+#define CFG_QOS_WMM_80211E_ENABLED_DEFAULT                 (0) 
+
+#define CFG_QOS_WMM_UAPSD_MASK_NAME                        "UapsdMask" // ACs to setup U-APSD for at assoc
+#define CFG_QOS_WMM_UAPSD_MASK_MIN                         (0x00)
+#define CFG_QOS_WMM_UAPSD_MASK_MAX                         (0xFF) 
+#define CFG_QOS_WMM_UAPSD_MASK_DEFAULT                     (0x00)   
+
+#define CFG_QOS_WMM_MAX_SP_LEN_NAME                        "MaxSpLength"
+#define CFG_QOS_WMM_MAX_SP_LEN_MIN                          (0)
+#define CFG_QOS_WMM_MAX_SP_LEN_MAX                          (3)
+#define CFG_QOS_WMM_MAX_SP_LEN_DEFAULT                      (0)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_NAME           "InfraUapsdVoSrvIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_MAX             (4294967295UL )
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_DEFAULT         (20)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_NAME           "InfraUapsdVoSuspIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_MAX             (4294967295UL )
+#define CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_DEFAULT         (2000)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_NAME           "InfraUapsdViSrvIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_MAX             (4294967295UL) 
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_DEFAULT         (300)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_NAME           "InfraUapsdViSuspIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_MAX             (4294967295UL)
+#define CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_DEFAULT         (2000)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_NAME           "InfraUapsdBeSrvIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_MAX             (4294967295UL)
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_DEFAULT         (300)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_NAME           "InfraUapsdBeSuspIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_MAX             (4294967295UL)
+#define CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_DEFAULT         (2000)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_NAME           "InfraUapsdBkSrvIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_MAX             (4294967295UL)
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_DEFAULT         (300)
+
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_NAME           "InfraUapsdBkSuspIntv"
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_MIN             (0)
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_MAX             (4294967295UL)             
+#define CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_DEFAULT         (2000)
+
+#ifdef FEATURE_WLAN_CCX
+#define CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_NAME         "InfraInactivityInterval"
+#define CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_MIN           (0)
+#define CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_MAX           (4294967295UL)
+#define CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_DEFAULT       (0) //disabled
+
+#define CFG_CCX_FEATURE_ENABLED_NAME                       "CcxEnabled"
+#define CFG_CCX_FEATURE_ENABLED_MIN                         (0)
+#define CFG_CCX_FEATURE_ENABLED_MAX                         (1)
+#define CFG_CCX_FEATURE_ENABLED_DEFAULT                     (0) //disabled
+#endif // FEATURE_WLAN_CCX
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+#define CFG_FT_RSSI_FILTER_PERIOD_NAME                     "FTRssiFilterPeriod"
+#define CFG_FT_RSSI_FILTER_PERIOD_MIN                      WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMIN
+#define CFG_FT_RSSI_FILTER_PERIOD_MAX                      WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMAX
+#define CFG_FT_RSSI_FILTER_PERIOD_DEFAULT                  WNI_CFG_FT_RSSI_FILTER_PERIOD_STADEF 
+
+// This flag will control fasttransition in case of 11r and ccx.
+// Basically with this the whole neighbor roam, pre-auth, reassoc
+// can be turned ON/OFF. 
+// With this turned OFF 11r will completely not work.
+// For 11r this flag has to be ON.
+// For CCX fastroam will not work.
+#define CFG_FAST_TRANSITION_ENABLED_NAME                    "FastTransitionEnabled"
+#define CFG_FAST_TRANSITION_ENABLED_NAME_MIN                (0)
+#define CFG_FAST_TRANSITION_ENABLED_NAME_MAX                (1)
+#define CFG_FAST_TRANSITION_ENABLED_NAME_DEFAULT            (0) //disabled
+#endif
+
+#define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME                "PktClassificationBasis" // DSCP or 802.1Q
+#define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_MIN                  (0)
+#define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_MAX                  (1)
+#define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_DEFAULT              (0) //DSCP
+
+/* default TSPEC parameters for AC_VO */
+#define CFG_QOS_WMM_INFRA_DIR_AC_VO_NAME                   "InfraDirAcVo"
+#define CFG_QOS_WMM_INFRA_DIR_AC_VO_MIN                     (0)
+#define CFG_QOS_WMM_INFRA_DIR_AC_VO_MAX                     (3)
+#define CFG_QOS_WMM_INFRA_DIR_AC_VO_DEFAULT                 (3) //WLAN_QCT_CUST_WMM_TSDIR_BOTH
+
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_NAME         "InfraNomMsduSizeAcVo"
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_MIN           (0x0)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_MAX           (0xFFFF)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_DEFAULT       (0x80D0)
+
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_NAME        "InfraMeanDataRateAcVo"
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_MIN          (0x0)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_MAX          (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_DEFAULT      (0x14500)
+
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_NAME          "InfraMinPhyRateAcVo"
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_MIN            (0x0)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_MAX            (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_DEFAULT        (0x5B8D80)
+
+#define CFG_QOS_WMM_INFRA_SBA_AC_VO_NAME                   "InfraSbaAcVo"
+#define CFG_QOS_WMM_INFRA_SBA_AC_VO_MIN                     (0x2001)
+#define CFG_QOS_WMM_INFRA_SBA_AC_VO_MAX                     (0xFFFF)
+#define CFG_QOS_WMM_INFRA_SBA_AC_VO_DEFAULT                 (0x2001)
+
+/* default TSPEC parameters for AC_VI */
+#define CFG_QOS_WMM_INFRA_DIR_AC_VI_NAME                   "InfraDirAcVi"
+#define CFG_QOS_WMM_INFRA_DIR_AC_VI_MIN                     (0)
+#define CFG_QOS_WMM_INFRA_DIR_AC_VI_MAX                     (3)
+#define CFG_QOS_WMM_INFRA_DIR_AC_VI_DEFAULT                 (3) //WLAN_QCT_CUST_WMM_TSDIR_BOTH
+
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_NAME         "InfraNomMsduSizeAcVi"
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_MIN           (0x0)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_MAX           (0xFFFF)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_DEFAULT       (0x85DC)
+
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_NAME        "InfraMeanDataRateAcVi"
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_MIN          (0x0)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_MAX          (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_DEFAULT      (0x57E40)
+
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_NAME          "InfraMinPhyRateAcVi"
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_MIN            (0x0)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_MAX            (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_DEFAULT        (0x5B8D80)
+
+#define CFG_QOS_WMM_INFRA_SBA_AC_VI_NAME                   "InfraSbaAcVi"
+#define CFG_QOS_WMM_INFRA_SBA_AC_VI_MIN                     (0x2001)
+#define CFG_QOS_WMM_INFRA_SBA_AC_VI_MAX                     (0xFFFF)
+#define CFG_QOS_WMM_INFRA_SBA_AC_VI_DEFAULT                 (0x2001)
+
+/* default TSPEC parameters for AC_BE*/
+#define CFG_QOS_WMM_INFRA_DIR_AC_BE_NAME                   "InfraDirAcBe"
+#define CFG_QOS_WMM_INFRA_DIR_AC_BE_MIN                     (0)
+#define CFG_QOS_WMM_INFRA_DIR_AC_BE_MAX                     (3)
+#define CFG_QOS_WMM_INFRA_DIR_AC_BE_DEFAULT                 (3) //WLAN_QCT_CUST_WMM_TSDIR_BOTH
+
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_NAME         "InfraNomMsduSizeAcBe"
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_MIN           (0x0)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_MAX           (0xFFFF)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_DEFAULT       (0x85DC)
+
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_NAME        "InfraMeanDataRateAcBe"
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_MIN          (0x0)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_MAX          (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_DEFAULT      (0x493E0)
+
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_NAME          "InfraMinPhyRateAcBe"
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_MIN            (0x0)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_MAX            (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_DEFAULT        (0x5B8D80)
+
+#define CFG_QOS_WMM_INFRA_SBA_AC_BE_NAME                   "InfraSbaAcBe"
+#define CFG_QOS_WMM_INFRA_SBA_AC_BE_MIN                     (0x2001)
+#define CFG_QOS_WMM_INFRA_SBA_AC_BE_MAX                     (0xFFFF)
+#define CFG_QOS_WMM_INFRA_SBA_AC_BE_DEFAULT                 (0x2001)
+
+/* default TSPEC parameters for AC_Bk*/
+#define CFG_QOS_WMM_INFRA_DIR_AC_BK_NAME                   "InfraDirAcBk"
+#define CFG_QOS_WMM_INFRA_DIR_AC_BK_MIN                     (0)
+#define CFG_QOS_WMM_INFRA_DIR_AC_BK_MAX                     (3)
+#define CFG_QOS_WMM_INFRA_DIR_AC_BK_DEFAULT                 (3) //WLAN_QCT_CUST_WMM_TSDIR_BOTH
+
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_NAME         "InfraNomMsduSizeAcBk"
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_MIN           (0x0)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_MAX           (0xFFFF)
+#define CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_DEFAULT       (0x85DC)
+
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_NAME        "InfraMeanDataRateAcBk"
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_MIN          (0x0)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_MAX          (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_DEFAULT      (0x493E0)
+
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_NAME          "InfraMinPhyRateAcBk"
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_MIN            (0x0)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_MAX            (0xFFFFFFFF)
+#define CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_DEFAULT        (0x5B8D80)
+
+#define CFG_QOS_WMM_INFRA_SBA_AC_BK_NAME                   "InfraSbaAcBk"
+#define CFG_QOS_WMM_INFRA_SBA_AC_BK_MIN                     (0x2001)
+#define CFG_QOS_WMM_INFRA_SBA_AC_BK_MAX                     (0xFFFF)
+#define CFG_QOS_WMM_INFRA_SBA_AC_BK_DEFAULT                 (0x2001)
+
+// TL configuration
+#define CFG_TL_WFQ_BK_WEIGHT_NAME                           "WfqBkWeight"
+#define CFG_TL_WFQ_BK_WEIGHT_MIN                            1
+#define CFG_TL_WFQ_BK_WEIGHT_MAX                            0xFF
+#define CFG_TL_WFQ_BK_WEIGHT_DEFAULT                        1
+
+#define CFG_TL_WFQ_BE_WEIGHT_NAME                           "WfqBeWeight"
+#define CFG_TL_WFQ_BE_WEIGHT_MIN                            1
+#define CFG_TL_WFQ_BE_WEIGHT_MAX                            0xFF
+#define CFG_TL_WFQ_BE_WEIGHT_DEFAULT                        3
+
+#define CFG_TL_WFQ_VI_WEIGHT_NAME                           "WfqViWeight"
+#define CFG_TL_WFQ_VI_WEIGHT_MIN                            1
+#define CFG_TL_WFQ_VI_WEIGHT_MAX                            0xFF
+#define CFG_TL_WFQ_VI_WEIGHT_DEFAULT                        5
+
+#define CFG_TL_WFQ_VO_WEIGHT_NAME                           "WfqVoWeight"
+#define CFG_TL_WFQ_VO_WEIGHT_MIN                            1
+#define CFG_TL_WFQ_VO_WEIGHT_MAX                            0xFF
+#define CFG_TL_WFQ_VO_WEIGHT_DEFAULT                        7
+
+#define CFG_TL_DELAYED_TRGR_FRM_INT_NAME                   "DelayedTriggerFrmInt"
+#define CFG_TL_DELAYED_TRGR_FRM_INT_MIN                     1
+#define CFG_TL_DELAYED_TRGR_FRM_INT_MAX                     (4294967295UL)
+#define CFG_TL_DELAYED_TRGR_FRM_INT_DEFAULT                 3000
+
+#if defined WLAN_FEATURE_VOWIFI
+#define CFG_RRM_ENABLE_NAME                              "gRrmEnable"
+#define CFG_RRM_ENABLE_MIN                               (0)
+#define CFG_RRM_ENABLE_MAX                               (1)  
+#define CFG_RRM_ENABLE_DEFAULT                           (0)
+
+#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_NAME         "gRrmOperChanMax" //section 11.10.3 IEEE std. 802.11k-2008
+#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_MIN          (0)             //Maxduration = 2^(maxDuration - 4) * bcnIntvl.
+#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_MAX          (8)  
+#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_DEFAULT      (3)             //max duration = 2^-1 * bcnIntvl (50% of bcn intvl)
+
+#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_NAME     "gRrmNonOperChanMax" //Same as above.
+#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MIN      (0)
+#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MAX      (8)  
+#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_DEFAULT  (3)
+
+#define CFG_RRM_MEAS_RANDOMIZATION_INTVL_NAME            "gRrmRandnIntvl"
+#define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MIN             (10)
+#define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MAX             (100)  
+#define CFG_RRM_MEAS_RANDOMIZATION_INTVL_DEFAULT         (100)
+#endif
+
+#define CFG_QOS_IMPLICIT_SETUP_ENABLED_NAME                 "ImplicitQosIsEnabled"
+#define CFG_QOS_IMPLICIT_SETUP_ENABLED_MIN                  (0)
+#define CFG_QOS_IMPLICIT_SETUP_ENABLED_MAX                  (1) 
+#define CFG_QOS_IMPLICIT_SETUP_ENABLED_DEFAULT              (1)
+
+#define CFG_19P2_MHZ_PMIC_CLK_ENABLED_NAME                  "19p2MhzPmicClkEnabled"
+#define CFG_19P2_MHZ_PMIC_CLK_ENABLED_MIN                   (0)
+#define CFG_19P2_MHZ_PMIC_CLK_ENABLED_MAX                   (1) 
+#define CFG_19P2_MHZ_PMIC_CLK_ENABLED_DEFAULT               (0)
+
+#define CFG_ENABLE_LOGP_NAME                                "gEnableLogp"
+#define CFG_ENABLE_LOGP_MIN                                 ( 0 )
+#define CFG_ENABLE_LOGP_MAX                                 ( 1 )
+#define CFG_ENABLE_LOGP_DEFAULT                             ( 0 )
+
+#define CFG_BTC_EXECUTION_MODE_NAME                         "BtcExecutionMode"
+#define CFG_BTC_EXECUTION_MODE_MIN                          ( 0 )
+#define CFG_BTC_EXECUTION_MODE_MAX                          ( 5 )
+#define CFG_BTC_EXECUTION_MODE_DEFAULT                      ( 0 )
+
+#define CFG_BTC_DHCP_PROTECTION_NAME                         "BtcConsBtSlotToBlockDuringDhcp"
+#define CFG_BTC_DHCP_PROTECTION_MIN                          ( 0 )
+#define CFG_BTC_DHCP_PROTECTION_MAX                          ( 0xFF )
+#define CFG_BTC_DHCP_PROTECTION_DEFAULT                      ( 0 )
+
+#define CFG_BTC_A2DP_DHCP_PROTECTION_NAME                    "BtcA2DPDhcpProtectLevel"
+#define CFG_BTC_A2DP_DHCP_PROTECTION_MIN                     ( 0 )
+#define CFG_BTC_A2DP_DHCP_PROTECTION_MAX                     ( 0xFF )
+#define CFG_BTC_A2DP_DHCP_PROTECTION_DEFAULT                 ( 7 )
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+#define CFG_FT_ENABLE_NAME                              "gFtEnabled"
+#define CFG_FT_ENABLE_MIN                               (0)
+#define CFG_FT_ENABLE_MAX                               (1)  
+#define CFG_FT_ENABLE_DEFAULT                           (0)
+
+#define CFG_FT_RESOURCE_REQ_NAME                        "gFTResourceReqSupported"
+#define CFG_FT_RESOURCE_REQ_MIN                         (0)
+#define CFG_FT_RESOURCE_REQ_MAX                         (1)
+#define CFG_FT_RESOURCE_REQ_DEFAULT                     (0)
+#endif
+
+#define CFG_TELE_BCN_TRANS_LI_NAME                   "telescopicBeaconTransListenInterval"
+#define CFG_TELE_BCN_TRANS_LI_MIN                    ( 0 )
+#define CFG_TELE_BCN_TRANS_LI_MAX                    ( 7 )
+#define CFG_TELE_BCN_TRANS_LI_DEFAULT                ( 3 )
+
+#define CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_NAME     "telescopicBeaconTransListenIntervalNumIdleBcns"
+#define CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_MIN      ( 5 )
+#define CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_MAX      ( 255 )
+#define CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_DEFAULT  ( 10 )
+
+#define CFG_TELE_BCN_MAX_LI_NAME                     "telescopicBeaconMaxListenInterval"
+#define CFG_TELE_BCN_MAX_LI_MIN                      ( 0 )
+#define CFG_TELE_BCN_MAX_LI_MAX                      ( 7 )
+#define CFG_TELE_BCN_MAX_LI_DEFAULT                  ( 5 )
+
+#define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_NAME       "telescopicBeaconMaxListenIntervalNumIdleBcns"
+#define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_MIN        ( 5 )
+#define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_MAX        ( 255 )
+#define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_DEFAULT    ( 15 )
+
+#define CFG_BCN_EARLY_TERM_WAKE_NAME                 "beaconEarlyTerminationWakeInterval"
+#define CFG_BCN_EARLY_TERM_WAKE_MIN                  ( 2 )
+#define CFG_BCN_EARLY_TERM_WAKE_MAX                  ( 255 )
+#define CFG_BCN_EARLY_TERM_WAKE_DEFAULT              ( 3 )
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_NAME             "gNeighborScanTimerPeriod"
+#define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MIN              (0)
+#define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MAX              (1000)
+#define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_DEFAULT          (200)
+
+#define CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_NAME              "gNeighborReassocThreshold"
+#define CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_MIN               (10)
+#define CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_MAX               (125)
+#define CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_DEFAULT           (125)
+
+#define CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_NAME      "gNeighborLookupThreshold"
+#define CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_MIN       (10)
+#define CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_MAX       (120)
+#define CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_DEFAULT   (120)
+
+#define CFG_NEIGHBOR_SCAN_CHAN_LIST_NAME                      "gNeighborScanChannelList"
+#define CFG_NEIGHBOR_SCAN_CHAN_LIST_DEFAULT                   "1,6"
+
+#define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_NAME                  "gNeighborScanChannelMinTime"
+#define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_MIN                   (10)   
+#define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_MAX                   (40)   
+#define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_DEFAULT               (20)   
+
+#define CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_NAME                  "gNeighborScanChannelMaxTime"
+#define CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_MIN                   (10)   
+#define CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_MAX                   (40)   
+#define CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_DEFAULT               (30)   
+
+#define CFG_11R_NEIGHBOR_REQ_MAX_TRIES_NAME           "gMaxNeighborReqTries"
+#define CFG_11R_NEIGHBOR_REQ_MAX_TRIES_MIN            (1)
+#define CFG_11R_NEIGHBOR_REQ_MAX_TRIES_MAX            (4)
+#define CFG_11R_NEIGHBOR_REQ_MAX_TRIES_DEFAULT        (1)
+
+
+#define CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_NAME         "gNeighborScanRefreshPeriod"
+#define CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN          (1000)
+#define CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX          (60000)
+#define CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_DEFAULT      (20000)
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
+#define CFG_QOS_WMM_BURST_SIZE_DEFN_NAME                        "burstSizeDefinition" 
+#define CFG_QOS_WMM_BURST_SIZE_DEFN_MIN                         (0)
+#define CFG_QOS_WMM_BURST_SIZE_DEFN_MAX                         (1)
+#define CFG_QOS_WMM_BURST_SIZE_DEFN_DEFAULT                     (0)
+
+#define CFG_QOS_WMM_TS_INFO_ACK_POLICY_NAME                        "tsInfoAckPolicy" 
+#define CFG_QOS_WMM_TS_INFO_ACK_POLICY_MIN                         (0x00)
+#define CFG_QOS_WMM_TS_INFO_ACK_POLICY_MAX                         (0x01)
+#define CFG_QOS_WMM_TS_INFO_ACK_POLICY_DEFAULT                     (0x00)
+
+#define CFG_SINGLE_TID_RC_NAME                             "SingleTIDRC"
+#define CFG_SINGLE_TID_RC_MIN                               (0) // Seperate replay counter for all TID
+#define CFG_SINGLE_TID_RC_MAX                               (1) // Single replay counter for all TID 
+#define CFG_SINGLE_TID_RC_DEFAULT                           (1) 
+#define CFG_MCAST_BCAST_FILTER_SETTING_NAME          "McastBcastFilter"
+#define CFG_MCAST_BCAST_FILTER_SETTING_MIN           (0)
+#define CFG_MCAST_BCAST_FILTER_SETTING_MAX           (3)
+#define CFG_MCAST_BCAST_FILTER_SETTING_DEFAULT       (0)
+
+#define CFG_DYNAMIC_PSPOLL_VALUE_NAME          "gDynamicPSPollvalue"
+#define CFG_DYNAMIC_PSPOLL_VALUE_MIN           (0)
+#define CFG_DYNAMIC_PSPOLL_VALUE_MAX           (255)
+#define CFG_DYNAMIC_PSPOLL_VALUE_DEFAULT       (0)
+
+#define CFG_TELE_BCN_WAKEUP_EN_NAME            "gTelescopicBeaconWakeupEn"
+#define CFG_TELE_BCN_WAKEUP_EN_MIN             (0)
+#define CFG_TELE_BCN_WAKEUP_EN_MAX             (1)
+#define CFG_TELE_BCN_WAKEUP_EN_DEFAULT         (0)
+
+#define CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_NAME                 "gAddTSWhenACMIsOff"
+#define CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MIN                  (0)
+#define CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MAX                  (1) //Send AddTs even when ACM is not set for the AC
+#define CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_DEFAULT              (0)
+
+
+#define CFG_VALIDATE_SCAN_LIST_NAME                 "gValidateScanList"
+#define CFG_VALIDATE_SCAN_LIST_MIN                  (0)
+#define CFG_VALIDATE_SCAN_LIST_MAX                  (1) 
+#define CFG_VALIDATE_SCAN_LIST_DEFAULT              (0)
+
+#define CFG_NULLDATA_AP_RESP_TIMEOUT_NAME       "gNullDataApRespTimeout"
+#define CFG_NULLDATA_AP_RESP_TIMEOUT_MIN        ( WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMIN )
+#define CFG_NULLDATA_AP_RESP_TIMEOUT_MAX        ( WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMAX )
+#define CFG_NULLDATA_AP_RESP_TIMEOUT_DEFAULT    ( WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STADEF )
+
+#define CFG_AP_DATA_AVAIL_POLL_PERIOD_NAME      "gApDataAvailPollInterval"
+#define CFG_AP_DATA_AVAIL_POLL_PERIOD_MIN       ( WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMIN )
+#define CFG_AP_DATA_AVAIL_POLL_PERIOD_MAX       ( WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMAX )
+#define CFG_AP_DATA_AVAIL_POLL_PERIOD_DEFAULT   ( WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STADEF )
+
+#define CFG_ENABLE_HOST_ARPOFFLOAD_NAME         "hostArpOffload"
+#define CFG_ENABLE_HOST_ARPOFFLOAD_MIN          ( 0 )
+#define CFG_ENABLE_HOST_ARPOFFLOAD_MAX          ( 1 )
+#define CFG_ENABLE_HOST_ARPOFFLOAD_DEFAULT      ( 0 )
+
+#define CFG_ENABLE_BTAMP_NAME                   "gEnableBtAmp"
+#define CFG_ENABLE_BTAMP_MIN                    ( 0 )
+#define CFG_ENABLE_BTAMP_MAX                    ( 1 )
+#define CFG_ENABLE_BTAMP_DEFAULT                ( 0 )
+
+#ifdef WLAN_BTAMP_FEATURE
+#define CFG_BT_AMP_PREFERRED_CHANNEL_NAME          "BtAmpPreferredChannel"
+#define CFG_BT_AMP_PREFERRED_CHANNEL_MIN           (1)
+#define CFG_BT_AMP_PREFERRED_CHANNEL_MAX           (11)
+#define CFG_BT_AMP_PREFERRED_CHANNEL_DEFAULT       (1)
+#endif //WLAN_BTAMP_FEATURE
+
+#define CFG_BAND_CAPABILITY_NAME          "BandCapability"
+#define CFG_BAND_CAPABILITY_MIN           (0)
+#define CFG_BAND_CAPABILITY_MAX           (2)
+#define CFG_BAND_CAPABILITY_DEFAULT       (1)
+
+#define CFG_ENABLE_BEACON_EARLY_TERMINATION_NAME          "enableBeaconEarlyTermination"
+#define CFG_ENABLE_BEACON_EARLY_TERMINATION_MIN           ( 0 )
+#define CFG_ENABLE_BEACON_EARLY_TERMINATION_MAX           ( 1 )
+#define CFG_ENABLE_BEACON_EARLY_TERMINATION_DEFAULT       ( 0 )
+
+#define CFG_ENABLE_CLOSE_LOOP_NAME                 "gEnableCloseLoop"
+#define CFG_ENABLE_CLOSE_LOOP_MIN                  WNI_CFG_FIXED_RATE_STAMIN
+#define CFG_ENABLE_CLOSE_LOOP_MAX                  WNI_CFG_FIXED_RATE_STAMAX
+#define CFG_ENABLE_CLOSE_LOOP_DEFAULT              WNI_CFG_FIXED_RATE_STADEF
+
+#define CFG_ENABLE_BYPASS_11D_NAME                 "gEnableBypass11d"
+#define CFG_ENABLE_BYPASS_11D_MIN                  ( 0 )
+#define CFG_ENABLE_BYPASS_11D_MAX                  ( 1 )
+#define CFG_ENABLE_BYPASS_11D_DEFAULT              ( 0 )
+
+#define CFG_ENABLE_DFS_CHNL_SCAN_NAME              "gEnableDFSChnlScan"
+#define CFG_ENABLE_DFS_CHNL_SCAN_MIN               ( 0 )
+#define CFG_ENABLE_DFS_CHNL_SCAN_MAX               ( 1 )
+#define CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT           ( 1 )
+
+typedef enum
+{
+    eHDD_LINK_SPEED_REPORT_ACTUAL = 0,
+    eHDD_LINK_SPEED_REPORT_MAX = 1,
+    eHDD_LINK_SPEED_REPORT_MAX_SCALED = 2,
+}eHddLinkSpeedReportType;
+
+#define CFG_REPORT_MAX_LINK_SPEED                  "gReportMaxLinkSpeed"
+#define CFG_REPORT_MAX_LINK_SPEED_MIN              ( eHDD_LINK_SPEED_REPORT_ACTUAL )
+#define CFG_REPORT_MAX_LINK_SPEED_MAX              ( eHDD_LINK_SPEED_REPORT_MAX_SCALED )
+#define CFG_REPORT_MAX_LINK_SPEED_DEFAULT          ( eHDD_LINK_SPEED_REPORT_ACTUAL )
+
+/*
+ * RSSI Thresholds
+ * Used when eHDD_LINK_SPEED_REPORT_SCALED is selected
+ */
+#define CFG_LINK_SPEED_RSSI_HIGH                   "gLinkSpeedRssiHigh"
+#define CFG_LINK_SPEED_RSSI_HIGH_MIN               ( -127 )
+#define CFG_LINK_SPEED_RSSI_HIGH_MAX               (  0 )
+#define CFG_LINK_SPEED_RSSI_HIGH_DEFAULT           ( -55 )
+
+#define CFG_LINK_SPEED_RSSI_LOW                    "gLinkSpeedRssiLow"
+#define CFG_LINK_SPEED_RSSI_LOW_MIN                ( -127 )
+#define CFG_LINK_SPEED_RSSI_LOW_MAX                (  0 )
+#define CFG_LINK_SPEED_RSSI_LOW_DEFAULT            ( -65 )
+
+#ifdef WLAN_FEATURE_P2P
+#define CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_NAME                "isP2pDeviceAddrAdministrated"
+#define CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_MIN                 ( 0 )
+#define CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_MAX                 ( 1 )
+#define CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_DEFAULT             ( 0 )
+#endif
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#define CFG_MC_ADDR_LIST_FILTER_NAME               "isMcAddrListFilter"
+#define CFG_MC_ADDR_LIST_FILTER_MIN                ( 0 )
+#define CFG_MC_ADDR_LIST_FILTER_MAX                ( 1 )
+#define CFG_MC_ADDR_LIST_FILTER_DEFAULT            ( 0 )
+#endif
+
+/*
+ * WDI Trace Enable Control
+ * Notes:
+ *  the MIN/MAX/DEFAULT values apply for all modules
+ *  the DEFAULT value is outside the valid range.  if the DEFAULT
+ *    value is not overridden, then no change will be made to the
+ *    "built in" default values compiled into the code
+ *  values are a bitmap indicating which log levels are to enabled
+ *    (must match order of wpt_tracelevel enumerations)
+ *    00000001  FATAL
+ *    00000010  ERROR
+ *    00000100  WARN
+ *    00001000  INFO
+ *    00010000  INFO HIGH
+ *    00100000  INFO MED
+ *    01000000  INFO LOW
+ *
+ *  hence a value of 0x7F would set all bits (enable all logs)
+ */
+#define CFG_WDI_TRACE_ENABLE_DAL_NAME     "wdiTraceEnableDAL"
+#define CFG_WDI_TRACE_ENABLE_CTL_NAME     "wdiTraceEnableCTL"
+#define CFG_WDI_TRACE_ENABLE_DAT_NAME     "wdiTraceEnableDAT"
+#define CFG_WDI_TRACE_ENABLE_PAL_NAME     "wdiTraceEnablePAL"
+#define CFG_WDI_TRACE_ENABLE_MIN          (0)
+#define CFG_WDI_TRACE_ENABLE_MAX          (0x7f)
+#define CFG_WDI_TRACE_ENABLE_DEFAULT      (0xffffffff)
+
+#define HDD_MCASTBCASTFILTER_FILTER_NONE                       0x00
+#define HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST              0x01
+#define HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST              0x02
+#define HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST    0x03
+
+/*
+ *
+ * SAP Auto Channel Enable
+ * Notes:
+ * Auto Channel selection for SAP configuration
+ * 0 - Disable Auto Channel
+ * 1 - Enable auto channel selection in auto mode.
+ *     When enable auto channel, channel provided by Supplicant will be ignored.
+ *
+ * Default configuration: Auto channel is disabled.
+ */
+
+#define CFG_SAP_AUTO_CHANNEL_SELECTION_NAME       "gApAutoChannelSelection"
+
+#define CFG_SAP_AUTO_CHANNEL_SELECTION_MIN        ( 0 )
+#define CFG_SAP_AUTO_CHANNEL_SELECTION_MAX        ( 1 )
+#define CFG_SAP_AUTO_CHANNEL_SELECTION_DEFAULT    ( 0 )
+
+
+/*
+ * Enable Dynamic DTIM
+ * Options
+ * 0 -Disable DynamicDTIM
+ * 1 to 5 - SLM will switch to DTIM specified here when host suspends and 
+ *          switch DTIM1 when host resumes */
+#define CFG_ENABLE_DYNAMIC_DTIM_NAME            "gEnableDynamicDTIM"
+#define CFG_ENABLE_DYNAMIC_DTIM_MIN        ( 0 )
+#define CFG_ENABLE_DYNAMIC_DTIM_MAX        ( 5 )
+#define CFG_ENABLE_DYNAMIC_DTIM_DEFAULT    ( 0 )
+
+#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_NAME  "gEnableAutomaticTxPowerControl"
+#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MIN        ( 0 )
+#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MAX        ( 1 )
+#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_DEFAULT    ( 1 )
+
+#define CFG_SHORT_GI_40MHZ_NAME                "gShortGI40Mhz"
+#define CFG_SHORT_GI_40MHZ_MIN                 0
+#define CFG_SHORT_GI_40MHZ_MAX                 1
+#define CFG_SHORT_GI_40MHZ_DEFAULT             1
+
+/*
+ * Enable / Disable MCC feature
+ * Default: Enable
+ */
+#define CFG_ENABLE_MCC_ENABLED_NAME             "gEnableMCCMode"      
+#define CFG_ENABLE_MCC_ENABLED_MIN              ( 0 )
+#define CFG_ENABLE_MCC_ENABLED_MAX              ( 1 )
+#define CFG_ENABLE_MCC_ENABLED_DEFAULT          ( 0 ) 
+
+/*
+ * Enable/Disable Thermal Mitigation feature
+ * Default: Disable
+ */
+#define CFG_THERMAL_MIGRATION_ENABLE_NAME      "gThermalMitigationEnable"   
+#define CFG_THERMAL_MIGRATION_ENABLE_MIN       ( 0 ) 
+#define CFG_THERMAL_MIGRATION_ENABLE_MAX       ( 1 ) 
+#define CFG_THERMAL_MIGRATION_ENABLE_DEFAULT   ( 0 ) 
+
+/*
+ * Enable/Disable Modulated DTIM feature
+ * Default: Disable
+ */
+#define CFG_ENABLE_MODULATED_DTIM_NAME       "gEnableModulatedDTIM"
+#define CFG_ENABLE_MODULATED_DTIM_MIN        ( 0 )
+#define CFG_ENABLE_MODULATED_DTIM_MAX        ( 5 )
+#define CFG_ENABLE_MODULATED_DTIM_DEFAULT    ( 0 )
+
+/*--------------------------------------------------------------------------- 
+  Type declarations
+  -------------------------------------------------------------------------*/ 
+
+typedef struct
+{
+   //Bitmap to track what is explicitly configured
+   DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS);
+
+   //Config parameters
+   v_U32_t       RTSThreshold;
+   v_U32_t       FragmentationThreshold;
+   v_U32_t       nCheckForHangTime;
+   v_U32_t       Calibration;
+   v_U32_t       CalibrationPeriod;
+   v_U8_t        OperatingChannel;
+   v_BOOL_t      ShortSlotTimeEnabled;
+   v_BOOL_t      Is11dSupportEnabled;
+   v_BOOL_t      fEnforce11dChannels;
+   v_BOOL_t      fSupplicantCountryCodeHasPriority;
+   v_BOOL_t      fEnforceCountryCodeMatch;
+   v_BOOL_t      fEnforceDefaultDomain;
+   v_U32_t       Cfg1Id;
+   v_U32_t       Cfg2Id;
+   v_U32_t       Cfg3Id;
+   v_U32_t       Cfg4Id;
+   v_U32_t       Cfg5Id;
+   v_U32_t       Cfg1Value;
+   v_U32_t       Cfg2Value;
+   v_U32_t       Cfg3Value;
+   v_U32_t       Cfg4Value;
+   v_U32_t       Cfg5Value;
+   v_U32_t       HeartbeatThresh24;
+   char          PowerUsageControl[4];
+   v_U8_t        nEnableSuspend;
+   v_U8_t        nEnableDriverStop;
+   v_BOOL_t      fIsImpsEnabled;
+   v_BOOL_t      fIsLogpEnabled;
+   v_U8_t        btcExecutionMode;
+   v_U8_t        btcConsBtSlotsToBlockDuringDhcp;
+   v_U8_t        btcA2DPBtSubIntervalsDuringDhcp;
+   v_U32_t       nImpsModSleepTime;
+   v_U32_t       nImpsMaxSleepTime;
+   v_U32_t       nImpsMinSleepTime;
+   v_BOOL_t      fIsBmpsEnabled;
+   v_U32_t       nBmpsModListenInterval;
+   v_U32_t       nBmpsMaxListenInterval;
+   v_U32_t       nBmpsMinListenInterval;
+   v_BOOL_t      fIsAutoBmpsTimerEnabled;
+   v_U32_t       nAutoBmpsTimerValue;
+   eHddDot11Mode dot11Mode;
+   v_U32_t       nChannelBondingMode24GHz;
+   v_U32_t       nChannelBondingMode5GHz;
+   v_U32_t       MaxRxAmpduFactor;
+   v_U32_t       nBAAgingTimerInterval;
+   v_U16_t       TxRate;
+   v_U32_t       AdaptiveThresholdAlgo;
+   v_U32_t       ShortGI20MhzEnable;
+   v_U32_t       BlockAckAutoSetup;
+   v_U32_t       ScanResultAgeCount;
+   v_U32_t       nScanAgeTimeNCNPS;
+   v_U32_t       nScanAgeTimeNCPS;
+   v_U32_t       nScanAgeTimeCNPS;
+   v_U32_t       nScanAgeTimeCPS;
+   v_U8_t        nRssiCatGap;
+   v_U32_t       nStatTimerInterval;
+   v_BOOL_t      fIsShortPreamble;
+   v_BOOL_t      fIsAutoIbssBssid;
+   v_MACADDR_t   IbssBssid;
+   
+   v_U8_t        intfAddrMask;
+   v_MACADDR_t   intfMacAddr[VOS_MAX_CONCURRENCY_PERSONA];
+
+#ifdef WLAN_SOFTAP_FEATURE
+   v_BOOL_t      apUapsdEnabled;
+   v_BOOL_t      apProtEnabled;
+   v_U16_t       apProtection;
+   v_BOOL_t      apOBSSProtEnabled;
+   v_U8_t        MinFramesProcThres;
+   v_U8_t        apCntryCode[4];
+   v_BOOL_t      apDisableIntraBssFwd;
+   v_U8_t        nEnableListenMode;    
+   v_U32_t       nAPAutoShutOff;
+   v_U8_t        apStartChannelNum;
+   v_U8_t        apEndChannelNum;
+   v_U8_t        apOperatingBand;
+   v_BOOL_t      apAutoChannelSelection;
+   v_U8_t        enableLTECoex;
+   v_U32_t       apKeepAlivePeriod;
+   v_U32_t       goKeepAlivePeriod;
+#endif
+   v_U32_t       nBeaconInterval;
+   v_U8_t        nTxPowerCap;   //In dBm
+   v_BOOL_t      fIsLowGainOverride;
+   v_U8_t        disablePacketFilter;
+#if defined WLAN_FEATURE_VOWIFI
+   v_BOOL_t      fRrmEnable;
+   v_U8_t        nInChanMeasMaxDuration;
+   v_U8_t        nOutChanMeasMaxDuration;
+   v_U16_t       nRrmRandnIntvl;
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   //Vowifi 11r params
+   v_BOOL_t      fFTEnable;
+   v_BOOL_t      fFTResourceReqSupported;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+   v_U16_t       nNeighborScanPeriod;
+   v_U16_t       nNeighborReassocRssiThreshold;
+   v_U16_t       nNeighborLookupRssiThreshold;
+   char          neighborScanChanList[100];         
+   v_U16_t       nNeighborScanMinChanTime; 
+   v_U16_t       nNeighborScanMaxChanTime; 
+   v_U16_t       nMaxNeighborReqTries;
+   v_U16_t       nNeighborResultsRefreshPeriod; 
+#endif
+
+   //Handoff Parameters
+   v_BOOL_t      fIsHandoffEnabled;
+
+   //Additional Handoff params
+   v_BOOL_t       nEnableIdleScan;
+   v_U32_t        nRoamingTime;
+   v_U16_t        nVccRssiTrigger;
+   v_U32_t        nVccUlMacLossThreshold;
+
+   v_U32_t        nPassiveMinChnTime;    //in units of milliseconds
+   v_U32_t        nPassiveMaxChnTime;    //in units of milliseconds
+   v_U32_t        nActiveMinChnTime;     //in units of milliseconds
+   v_U32_t        nActiveMaxChnTime;     //in units of milliseconds
+
+   v_U8_t         nMaxPsPoll;
+
+   v_U8_t         nRssiFilterPeriod;
+   v_BOOL_t       fIgnoreDtim;
+
+   v_U8_t         nRxAnt;
+   v_U8_t         fEnableFwHeartBeatMonitoring;
+   v_U8_t         fEnableFwBeaconFiltering;
+   v_U8_t         fEnableFwRssiMonitoring;
+   v_U8_t         nDataInactivityTimeout;
+   v_U8_t         nthBeaconFilter;
+
+   //WMM QoS Configuration
+   hdd_wmm_user_mode_t          WmmMode;
+   v_BOOL_t                     b80211eIsEnabled;
+   v_U8_t                       UapsdMask;    // what ACs to setup U-APSD for at assoc
+   v_U8_t                       MaxSpLength;
+   v_U32_t                      InfraUapsdVoSrvIntv;
+   v_U32_t                      InfraUapsdVoSuspIntv;
+   v_U32_t                      InfraUapsdViSrvIntv;
+   v_U32_t                      InfraUapsdViSuspIntv;
+   v_U32_t                      InfraUapsdBeSrvIntv;
+   v_U32_t                      InfraUapsdBeSuspIntv;
+   v_U32_t                      InfraUapsdBkSrvIntv;
+   v_U32_t                      InfraUapsdBkSuspIntv;
+#ifdef FEATURE_WLAN_CCX
+   v_U32_t                      InfraInactivityInterval;
+   v_BOOL_t                     isCcxIniFeatureEnabled;
+#endif
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+   v_U8_t                       FTRssiFilterPeriod;
+   v_BOOL_t                     isFastTransitionEnabled;
+#endif
+
+   hdd_wmm_classification_t     PktClassificationBasis; // DSCP or 802.1Q
+   v_BOOL_t                     bImplicitQosEnabled;
+
+   /* default TSPEC parameters for AC_VO */
+   sme_QosWmmDirType            InfraDirAcVo;
+   v_U16_t                      InfraNomMsduSizeAcVo;
+   v_U32_t                      InfraMeanDataRateAcVo;
+   v_U32_t                      InfraMinPhyRateAcVo;
+   v_U16_t                      InfraSbaAcVo;
+
+   /* default TSPEC parameters for AC_VI */
+   sme_QosWmmDirType            InfraDirAcVi;
+   v_U16_t                      InfraNomMsduSizeAcVi;
+   v_U32_t                      InfraMeanDataRateAcVi;
+   v_U32_t                      InfraMinPhyRateAcVi;
+   v_U16_t                      InfraSbaAcVi;
+
+   /* default TSPEC parameters for AC_BE */
+   sme_QosWmmDirType            InfraDirAcBe;
+   v_U16_t                      InfraNomMsduSizeAcBe;
+   v_U32_t                      InfraMeanDataRateAcBe;
+   v_U32_t                      InfraMinPhyRateAcBe;
+   v_U16_t                      InfraSbaAcBe;
+
+   /* default TSPEC parameters for AC_BK */
+   sme_QosWmmDirType            InfraDirAcBk;
+   v_U16_t                      InfraNomMsduSizeAcBk;
+   v_U32_t                      InfraMeanDataRateAcBk;
+   v_U32_t                      InfraMinPhyRateAcBk;
+   v_U16_t                      InfraSbaAcBk;
+
+   /* TL related configuration */
+   v_U8_t                       WfqBkWeight;
+   v_U8_t                       WfqBeWeight;
+   v_U8_t                       WfqViWeight;
+   v_U8_t                       WfqVoWeight;
+   v_U32_t                      DelayedTriggerFrmInt;
+
+   /* Wowl pattern */
+   char                        wowlPattern[1024];         
+   v_BOOL_t                    b19p2MhzPmicClkEnabled;
+
+   /* Control for Replay counetr. value 1 means 
+      single replay counter for all TID*/
+   v_BOOL_t                    bSingleTidRc;
+   v_U8_t                      mcastBcastFilterSetting;
+   v_BOOL_t                    fhostArpOffload;
+   v_BOOL_t                    burstSizeDefinition;
+   v_U8_t                      tsInfoAckPolicy;
+   
+   /* RF Settling Time Clock */
+   v_U32_t                     rfSettlingTimeUs;
+   v_U8_t                      enableBtAmp;
+#ifdef WLAN_BTAMP_FEATURE
+   v_U8_t                      preferredChannel;
+#endif //WLAN_BTAMP_FEATURE
+
+   v_U8_t                      dynamicPsPollValue;
+   v_BOOL_t                    AddTSWhenACMIsOff;
+   v_BOOL_t                    fValidateScanList;
+
+   v_U32_t                     infraStaKeepAlivePeriod;
+   v_U8_t                      nNullDataApRespTimeout;
+   v_U8_t                      nBandCapability;
+
+   v_U32_t                     apDataAvailPollPeriodInMs;
+   v_BOOL_t                    fEnableBeaconEarlyTermination;
+   v_BOOL_t                    teleBcnWakeupEn;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* WDI Trace Control */
+   v_U32_t                     wdiTraceEnableDAL;
+   v_U32_t                     wdiTraceEnableCTL;
+   v_U32_t                     wdiTraceEnableDAT;
+   v_U32_t                     wdiTraceEnablePAL;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+   v_U16_t                     nTeleBcnTransListenInterval;
+   v_U16_t                     nTeleBcnMaxListenInterval;
+   v_U16_t                     nTeleBcnTransLiNumIdleBeacons;
+   v_U16_t                     nTeleBcnMaxLiNumIdleBeacons;
+   v_U8_t                      bcnEarlyTermWakeInterval;
+   v_U32_t                     enableCloseLoop;
+   v_U8_t                      enableBypass11d;
+   v_U8_t                      enableDFSChnlScan;
+   v_U8_t                      enableDynamicDTIM;
+   v_U8_t                      enableAutomaticTxPowerControl;
+   v_U8_t                      ShortGI40MhzEnable;
+   eHddLinkSpeedReportType     reportMaxLinkSpeed;
+   v_S31_t                     linkSpeedRssiHigh;
+   v_S31_t                     linkSpeedRssiLow;
+   v_U8_t                      enableMCC;
+#ifdef WLAN_FEATURE_P2P
+   v_BOOL_t                    isP2pDeviceAddrAdministrated;
+#endif
+   v_U8_t                      thermalMitigationEnable;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+   v_BOOL_t                    isMcAddrListFilter;
+#endif
+   v_U8_t                      enableModulatedDTIM;
+} hdd_config_t;
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+VOS_STATUS hdd_parse_config_ini(hdd_context_t *pHddCtx);
+VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx );
+v_BOOL_t hdd_update_config_dat ( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_cfg_get_config(hdd_context_t *pHddCtx, char *pBuf, int buflen);
+eCsrPhyMode hdd_cfg_xlate_to_csr_phy_mode( eHddDot11Mode dot11Mode );
+VOS_STATUS hdd_execute_config_command(hdd_context_t *pHddCtx, char *command);
+
+#define FIELD_OFFSET(__type, __field) ((unsigned int)(&((__type *)0)->__field))
+#define VAR_OFFSET( _Struct, _Var ) ( (unsigned int) FIELD_OFFSET(_Struct, _Var ) )
+#define VAR_SIZE( _Struct, _Var ) sizeof( ((_Struct *)0)->_Var )
+
+#define VAR_FLAGS_NONE         (      0 )
+#define VAR_FLAGS_REQUIRED     ( 1 << 0 )   // bit 0 is Required or Optional
+#define VAR_FLAGS_OPTIONAL     ( 0 << 0 )
+
+#define VAR_FLAGS_RANGE_CHECK  ( 1 << 1 )   // bit 1 tells if range checking is required.
+                                            // If less than MIN, assume MIN.
+                                            // If greater than MAX, assume MAX.
+
+#define VAR_FLAGS_RANGE_CHECK_ASSUME_MINMAX ( VAR_FLAGS_RANGE_CHECK )
+
+#define VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT ( 1 << 2 )  // bit 2 is range checking that assumes the DEFAULT value
+                                                         // If less than MIN, assume DEFAULT,
+                                                         // If grateer than MAX, assume DEFAULT.
+
+#define VAR_FLAGS_DYNAMIC_CFG ( 1 << 3 )  // Bit 3 indicates that
+                                          // the config item can be
+                                          // modified dynamicially
+                                          // on a running system
+
+typedef enum 
+{
+  WLAN_PARAM_Integer,
+  WLAN_PARAM_SignedInteger,
+  WLAN_PARAM_HexInteger,
+  WLAN_PARAM_String,
+  WLAN_PARAM_MacAddr,
+}WLAN_PARAMETER_TYPE;
+
+#define REG_VARIABLE( _Name, _Type,  _Struct, _VarName,          \
+                      _Flags, _Default, _Min, _Max )             \
+{                                                                \
+  ( _Name ),                                                     \
+  ( _Type ),                                                     \
+  ( _Flags ),                                                    \
+  VAR_OFFSET( _Struct, _VarName ),                               \
+  VAR_SIZE( _Struct, _VarName ),                                 \
+  ( _Default ),                                                  \
+  ( _Min ),                                                      \
+  ( _Max ),                                                      \
+  NULL,                                                          \
+  0                                                              \
+}
+
+#define REG_DYNAMIC_VARIABLE( _Name, _Type,  _Struct, _VarName,  \
+                              _Flags, _Default, _Min, _Max,      \
+                              _CBFunc, _CBParam )                \
+{                                                                \
+  ( _Name ),                                                     \
+  ( _Type ),                                                     \
+  ( VAR_FLAGS_DYNAMIC_CFG | ( _Flags ) ),                        \
+  VAR_OFFSET( _Struct, _VarName ),                               \
+  VAR_SIZE( _Struct, _VarName ),                                 \
+  ( _Default ),                                                  \
+  ( _Min ),                                                      \
+  ( _Max ),                                                      \
+  ( _CBFunc ),                                                   \
+  ( _CBParam )                                                   \
+}
+
+#define REG_VARIABLE_STRING( _Name, _Type,  _Struct, _VarName,   \
+                             _Flags, _Default )                  \
+{                                                                \
+  ( _Name ),                                                     \
+  ( _Type ),                                                     \
+  ( _Flags ),                                                    \
+  VAR_OFFSET( _Struct, _VarName ),                               \
+  VAR_SIZE( _Struct, _VarName ),                                 \
+  (unsigned long)( _Default ),                                   \
+  0,                                                             \
+  0,                                                             \
+  NULL,                                                          \
+  0                                                              \
+}
+
+typedef struct tREG_TABLE_ENTRY {
+
+  char*               RegName;            // variable name in the qcom_cfg.ini file
+  WLAN_PARAMETER_TYPE RegType;            // variable type in the hdd_config_t structure
+  unsigned long       Flags;              // Specify optional parms and if RangeCheck is performed
+  unsigned short      VarOffset;          // offset to field from the base address of the structure
+  unsigned short      VarSize;            // size (in bytes) of the field
+  unsigned long       VarDefault;         // default value to use
+  unsigned long       VarMin;             // minimum value, for range checking
+  unsigned long       VarMax;             // maximum value, for range checking
+                                          // Dynamic modification notifier
+  void (*pfnDynamicNotify)(hdd_context_t *pHddCtx, unsigned long NotifyId);
+  unsigned long       NotifyId;           // Dynamic modification identifier
+} REG_TABLE_ENTRY;
+
+static __inline unsigned long utilMin( unsigned long a, unsigned long b )
+{
+  return( ( a < b ) ? a : b );
+}
+
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
new file mode 100644
index 0000000..597111b
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.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.
+ */
+
+#if !defined( HDD_CFG80211_H__ )
+#define HDD_CFG80211_H__
+
+
+/**===========================================================================
+  
+  \file  wlan_hdd_cfg80211.h
+  
+  \brief cfg80211 functions declarations
+    
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/* $HEADER$ */
+
+#ifdef CONFIG_CFG80211
+
+//value for initial part of frames and number of bytes to be compared
+#define GAS_INITIAL_REQ "\x04\x0a"  
+#define GAS_INITIAL_REQ_SIZE 2
+
+#define GAS_INITIAL_RSP "\x04\x0b"
+#define GAS_INITIAL_RSP_SIZE 2
+
+#define GAS_COMEBACK_REQ "\x04\x0c"
+#define GAS_COMEBACK_REQ_SIZE 2
+
+#define GAS_COMEBACK_RSP "\x04\x0d"
+#define GAS_COMEBACK_RSP_SIZE 2
+
+#define P2P_PUBLIC_ACTION_FRAME "\x04\x09\x50\x6f\x9a\x09" 
+#define P2P_PUBLIC_ACTION_FRAME_SIZE 6
+
+#define P2P_ACTION_FRAME "\x7f\x50\x6f\x9a\x09"
+#define P2P_ACTION_FRAME_SIZE 5
+
+#define HDD_P2P_WILDCARD_SSID "DIRECT-" //TODO Put it in proper place;
+#define HDD_P2P_WILDCARD_SSID_LEN 7
+
+#define WPA_OUI_TYPE   "\x00\x50\xf2\x01"
+#define BLACKLIST_OUI_TYPE   "\x00\x50\x00\x00"
+#define WHITELIST_OUI_TYPE   "\x00\x50\x00\x01"
+#define WPA_OUI_TYPE_SIZE  4
+
+#define WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
+#define BASIC_RATE_MASK   0x80
+#define RATE_MASK         0x7f
+
+struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter,
+                                      tCsrRoamInfo *pRoamInfo
+                                      );
+#ifdef FEATURE_WLAN_WAPI
+void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter,
+              u8 key_index, const u8 *mac_addr, u8 *key , int key_Len);
+#endif
+struct wiphy *wlan_hdd_cfg80211_init(int priv_size);
+
+int wlan_hdd_cfg80211_register(struct device *dev,
+                               struct wiphy *wiphy,
+                               hdd_config_t *pCfg
+                                         );
+
+void wlan_hdd_cfg80211_post_voss_start(hdd_adapter_t* pAdapter);
+
+void wlan_hdd_cfg80211_pre_voss_stop(hdd_adapter_t* pAdapter);
+
+
+#endif // CONFIG_CFG80211
+
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_dev_pwr.h b/CORE/HDD/inc/wlan_hdd_dev_pwr.h
new file mode 100644
index 0000000..27f55ef
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_dev_pwr.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.
+ */
+
+#ifndef __WLAN_HDD_DEV_PWR_H
+#define __WLAN_HDD_DEV_PWR_H
+
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_power.h>
+#include <vos_sched.h>
+#include <vos_api.h>
+
+/*----------------------------------------------------------------------------
+
+   @brief Registration function.
+        Register suspend, resume callback functions with platform driver. 
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Registration Success
+        VOS_STATUS_E_FAILURE     Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddRegisterPmOps(hdd_context_t *pHddCtx);
+
+/*----------------------------------------------------------------------------
+
+   @brief De-registration function.
+        Deregister the suspend, resume callback functions with platform driver
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       De-Registration Success
+        VOS_STATUS_E_FAILURE     De-Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDeregisterPmOps(hdd_context_t *pHddCtx);
+
+/*----------------------------------------------------------------------------
+
+   @brief TM Level Change handler
+          Received Tm Level changed notification
+
+   @param dev : Device context
+          changedTmLevel : Changed new TM level
+
+   @return 
+
+----------------------------------------------------------------------------*/
+void hddDevTmLevelChangedHandler(struct device *dev, int changedTmLevel);
+
+/*----------------------------------------------------------------------------
+
+   @brief Register function
+        Register Thermal Mitigation Level Changed handle callback function
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Registration Success
+        VOS_STATUS_E_FAILURE     Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDevTmRegisterNotifyCallback(hdd_context_t *pHddCtx);
+
+/*----------------------------------------------------------------------------
+
+   @brief Un-Register function
+        Un-Register Thermal Mitigation Level Changed handle callback function
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Un-Registration Success
+        VOS_STATUS_E_FAILURE     Un-Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDevTmUnregisterNotifyCallback(hdd_context_t *pHddCtx);
+
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_dp_utils.h b/CORE/HDD/inc/wlan_hdd_dp_utils.h
new file mode 100644
index 0000000..33d9418
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_dp_utils.h
@@ -0,0 +1,118 @@
+/*
+ * 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_HDD_DP_UTILS_H )
+#define __WLAN_HDD_DP_UTILS_H
+
+/**=============================================================================
+  wlan_hdd_dp_utils.h
+  
+  \brief      Utility functions for data path module
+  
+  Description...
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ==============================================================================**/
+/* $HEADER$ */
+  
+/**-----------------------------------------------------------------------------
+  Include files
+  ----------------------------------------------------------------------------*/
+#include <linux/list.h>
+#include <vos_types.h>
+#include <linux/kernel.h>
+#include <i_vos_types.h>
+#include <vos_status.h>
+#include <linux/spinlock.h>
+#include <vos_trace.h>
+#ifdef WLAN_SOFTAP_FEATURE
+#include <vos_list.h>
+#endif
+
+/**-----------------------------------------------------------------------------
+  Preprocessor definitions and constants
+ ----------------------------------------------------------------------------*/
+  
+/**-----------------------------------------------------------------------------
+  Type declarations
+ ----------------------------------------------------------------------------*/
+
+typedef struct list_head hdd_list_node_t;
+
+typedef struct hdd_list_s
+{
+   hdd_list_node_t anchor;
+   v_SIZE_t count;
+   v_SIZE_t max_size;
+   spinlock_t lock; 
+} hdd_list_t;
+
+typedef struct
+{
+   hdd_list_node_t anchor;
+   struct sk_buff *skb;
+   int userPriority;
+} skb_list_node_t;
+
+//FIXME Need a helper function to cleanup skbs in a queue. Required for cleanup/shutdown
+  
+/**-----------------------------------------------------------------------------
+  Function declarations and documenation
+ ----------------------------------------------------------------------------*/
+VOS_INLINE_FN v_VOID_t hdd_list_init( hdd_list_t *pList, v_SIZE_t max_size)
+{
+   INIT_LIST_HEAD( &pList->anchor );
+   pList->count = 0;
+   pList->max_size = max_size;
+   spin_lock_init(&pList->lock);
+}
+
+VOS_INLINE_FN v_VOID_t hdd_list_destroy( hdd_list_t *pList )
+{
+   if ( pList->count !=0 )
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s: list length not equal to zero",__FUNCTION__);
+   }
+}
+
+VOS_INLINE_FN v_VOID_t hdd_list_size( hdd_list_t *pList, v_SIZE_t *pSize )
+{
+   *pSize = pList->count;
+}
+
+VOS_STATUS hdd_list_insert_front( hdd_list_t *pList, hdd_list_node_t *pNode );
+
+VOS_STATUS hdd_list_insert_back( hdd_list_t *pList, hdd_list_node_t *pNode );
+
+VOS_STATUS hdd_list_insert_back_size( hdd_list_t *pList, hdd_list_node_t *pNode, v_SIZE_t *pSize );
+
+VOS_STATUS hdd_list_remove_front( hdd_list_t *pList, hdd_list_node_t **ppNode );
+
+VOS_STATUS hdd_list_remove_back( hdd_list_t *pList, hdd_list_node_t **ppNode );
+
+VOS_STATUS hdd_list_remove_node( hdd_list_t *pList, hdd_list_node_t *pNodeToRemove );
+VOS_STATUS hdd_list_peek_front( hdd_list_t *pList, hdd_list_node_t **ppNode );
+VOS_STATUS hdd_list_peek_next( hdd_list_t *pList, hdd_list_node_t *pNode,
+                               hdd_list_node_t **ppNode );
+VOS_STATUS hdd_string_to_hex( char *pSrcMac, int length, char *pDescMac );
+#endif //__WLAN_HDD_DP_UTILS_H
diff --git a/CORE/HDD/inc/wlan_hdd_ether.h b/CORE/HDD/inc/wlan_hdd_ether.h
new file mode 100644
index 0000000..ef83bda
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_ether.h
@@ -0,0 +1,87 @@
+/*
+ * 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 _WLAN_HDD_ETHER_H
+#define _WLAN_HDD_ETHER_H
+/*============================================================================
+  @file wlan_hdd_ether.h
+
+  This module describes Ethernet packet formats for processing by HDD.
+
+               Copyright (c) 2009 QUALCOMM Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary
+============================================================================*/
+/* $Header$ */
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include <linux/version.h>
+#include <linux/byteorder/generic.h>
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define WLAN_SNAP_OUI_LEN 3
+#define WLAN_SNAP_DSAP 0xAAU
+#define WLAN_SNAP_SSAP 0xAAU
+#define WLAN_SNAP_CTRL 0x03
+#define WLAN_MIN_PROTO 0x0600
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+struct wlan_snap_hdr {
+   unsigned char dsap;
+   unsigned char ssap;
+   unsigned char ctrl;
+   unsigned char oui[WLAN_SNAP_OUI_LEN];
+} __attribute__((packed));
+
+struct wlan_8023 {
+   unsigned char        h_dest[ETH_ALEN];
+   unsigned char        h_source[ETH_ALEN];
+   __be16               h_len;
+   struct wlan_snap_hdr h_snap;
+   __be16               h_proto;
+} __attribute__((packed));
+
+struct wlan_8023_vlan {
+   unsigned char        h_dest[ETH_ALEN];
+   unsigned char        h_source[ETH_ALEN];
+   __be16               h_vlan_proto;
+   __be16               h_vlan_TCI;
+   __be16               h_len;
+   struct wlan_snap_hdr h_snap;
+   __be16               h_proto;
+} __attribute__((packed));
+
+union generic_ethhdr {
+   struct ethhdr eth_II;
+   struct vlan_ethhdr eth_IIv;
+   struct wlan_8023 eth_8023;
+   struct wlan_8023_vlan eth_8023v;
+};
+
+#endif /* #ifndef _WLAN_HDD_ETHER_H */
diff --git a/CORE/HDD/inc/wlan_hdd_ftm.h b/CORE/HDD/inc/wlan_hdd_ftm.h
new file mode 100644
index 0000000..7f0cff0
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_ftm.h
@@ -0,0 +1,213 @@
+/*
+ * 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 WLAN_HDD_FTM_H
+#define WLAN_HDD_FTM_H
+#include "vos_status.h"
+#include "vos_mq.h"
+#include "vos_api.h"
+#include "msg.h"
+#include "halTypes.h"
+#include "vos_types.h"
+#include <wlan_ptt_sock_svc.h>
+
+#define WLAN_FTM_SUCCESS   0
+#define WLAN_FTM_FAILURE   1
+
+#define WLAN_FTM_START              1
+#define WLAN_FTM_STOP               2        
+#define WLAN_FTM_CMD                3
+
+
+#define WLAN_FTM_PHY_CMD         100
+#define SIR_HAL_FTM_CMD          10
+#define QUALCOMM_MODULE_TYPE     2
+#define WLAN_FTM_COMMAND_TIME_OUT 1000
+#define PHYDBG_PREAMBLE_NOT_SUPPORTED 0xFF
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_INT_GET_NONE    (SIOCIWFIRSTPRIV + 0)
+#define WE_FTM_ON_OFF         1
+#define WE_TX_PKT_GEN         2
+#define WE_SET_TX_IFS         3
+#define WE_SET_TX_PKT_CNT     4
+#define WE_SET_TX_PKT_LEN     5
+#define WE_SET_CHANNEL        6
+#define WE_SET_TX_POWER       7
+#define WE_CLEAR_RX_PKT_CNT   8
+#define WE_RX                 9
+#define WE_ENABLE_CHAIN      10
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_NONE_GET_INT    (SIOCIWFIRSTPRIV + 1)
+#define WE_GET_CHANNEL      1
+#define WE_GET_TX_POWER     2
+#define WE_GET_RX_PKT_CNT   3
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_INT_GET_INT     (SIOCIWFIRSTPRIV + 2)
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_CHAR_GET_NONE   (SIOCIWFIRSTPRIV + 3)
+#define WE_SET_MAC_ADDRESS   1
+#define WE_SET_TX_RATE       2
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_THREE_INT_GET_NONE   (SIOCIWFIRSTPRIV + 4)
+#define WE_SET_WLAN_DBG      1
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_GET_CHAR_SET_NONE   (SIOCIWFIRSTPRIV + 5)
+#define WE_GET_MAC_ADDRESS   1
+#define WE_GET_TX_RATE        2
+#define WE_GET_FTM_VERSION   3
+#define WE_GET_FTM_STATUS    4
+#define WE_GET_RX_RSSI       5
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_FTM_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
+#define WE_SET_NV_DEFAULTS    1
+
+#define WLAN_FTM_PRIV_SET_VAR_INT_GET_NONE   (SIOCIWFIRSTPRIV + 7)
+#define WE_SET_RSSI_OFFSET 1
+
+
+#define WE_FTM_MAX_STR_LEN 1024
+#define MAX_FTM_VAR_ARGS  7
+
+#define MAX_NV_TABLE_SIZE  30000
+
+typedef enum {
+    WLAN_FTM_CMD_START = 1,
+    WLAN_FTM_CMD_STOP,        
+    WLAN_FTM_CMD_CMD
+} wlan_hdd_ftm_cmds;
+typedef struct ftm_hdr_s {
+    v_U16_t cmd_id;
+    v_U16_t data_len;
+    v_U16_t respPktSize;
+} ftm_hdr_t;
+
+/* The request buffer of FTM which contains a byte of command and the request */
+typedef struct wlan_hdd_ftm_payload_s {
+    v_U16_t    ftm_cmd_type;
+    v_U8_t    pFtmCmd[1];
+}wlan_hdd_ftm_payload;
+#define SIZE_OF_FTM_DIAG_HEADER_LEN 12
+/* the FTM command/response structure */
+typedef struct wlan_hdd_ftm_request_s
+{
+    v_U8_t    cmd_code;
+    v_U8_t    sub_sys_id;
+    v_U16_t   mode_id;
+    ftm_hdr_t ftm_hdr; 
+    v_U16_t   module_type;
+    wlan_hdd_ftm_payload ftmpkt;
+}wlan_hdd_ftm_request_t;
+
+typedef struct wlan_hdd_ftm_response_s
+{
+    v_U8_t    cmd_code;
+    v_U8_t    sub_sys_id;
+    v_U16_t   mode_id;
+    ftm_hdr_t ftm_hdr; 
+    v_U16_t   ftm_err_code;
+    wlan_hdd_ftm_payload ftmpkt;
+}wlan_hdd_ftm_response_t;
+
+typedef enum {
+    WLAN_FTM_INITIALIZED,
+    WLAN_FTM_STOPPED,
+    WLAN_FTM_STARTED,
+} wlan_hdd_ftm_state;
+typedef struct wlan_hdd_ftm_status_s
+{
+    v_U8_t ftm_state;
+    wlan_hdd_ftm_request_t    *pRequestBuf;
+    wlan_hdd_ftm_response_t   *pResponseBuf;
+    tAniNlHdr *wnl;
+        /**vos event */
+    vos_event_t  ftm_vos_event;
+    
+   /** completion variable for ftm command to complete*/
+    struct completion ftm_comp_var;
+    v_BOOL_t  IsCmdPending;
+    v_BOOL_t  cmd_iwpriv;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    /** Large size of NV Table Handle **/
+    eNvTable  processingNVTable;
+    v_U32_t   targetNVTableSize;
+    v_U8_t   *targetNVTablePointer;
+    v_U32_t   processedNVTableSize;
+    v_U8_t   *tempNVTableBuffer;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+} wlan_hdd_ftm_status_t;
+typedef struct ftm_msg_s
+{
+    /* This field can be used as sequence 
+        number/dialogue token for matching request/response */
+    v_U16_t type;
+    
+    /* This guy carries the command buffer along with command id */
+    void *cmd_ptr;
+    v_U32_t bodyval;
+} ftm_msg_t;
+typedef struct ftm_rsp_msg_s
+{
+    v_U16_t   msgId;
+    v_U16_t   msgBodyLength;
+    v_U32_t   respStatus;
+    v_U8_t   *msgResponse;
+} ftm_rsp_msg_t;
+
+typedef struct rateIndex2Preamble
+{
+    v_U16_t   rate_index;
+    v_U16_t   Preamble;
+} rateIndex2Preamble_t;
+typedef struct freq_chan_s
+{
+    v_U16_t   freq;
+    v_U16_t   chan;
+} freq_chan_t;
+
+typedef struct rateStr2rateIndex_s
+{
+    v_U16_t   rate_index;
+    char      rate_str[30];
+} rateStr2rateIndex_t;
+
+
+#define FTM_SWAP16(A) ((((tANI_U16)(A) & 0xff00) >> 8) | \
+                         (((tANI_U16)(A) & 0x00ff) << 8)   \
+                      )
+#define PTT_HEADER_LENGTH 8
+
+#define FTM_VOS_EVENT_WAIT_TIME 10000
+
+#define SIZE_OF_TABLE(a) sizeof(a)/sizeof(a[0])                      
+
+int wlan_hdd_ftm_open(hdd_context_t *pHddCtx);
+void wlan_hdd_process_ftm_cmd (hdd_context_t *pHddCtx,tAniNlHdr *wnl);
+int wlan_hdd_ftm_close(hdd_context_t *pHddCtx);
+
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_host_offload.h b/CORE/HDD/inc/wlan_hdd_host_offload.h
new file mode 100644
index 0000000..de0f3f7
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_host_offload.h
@@ -0,0 +1,59 @@
+/*
+ * 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 __WLAN_HDD_HOST_OFFLOAD_H__
+#define __WLAN_HDD_HOST_OFFLOAD_H__
+
+/**===========================================================================
+
+  \file  wlan_hdd_host_offload.h
+
+  \brief Android WLAN HDD Host Offload API
+
+  Copyright 2011 (c) QUALCOMM Incorporated. All Rights Reserved.
+  QUALCOMM Proprietary and Confidential.
+
+  ==========================================================================*/
+
+/* Offload types. */
+#define WLAN_IPV4_ARP_REPLY_OFFLOAD           0
+#define WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD  1
+
+/* Enable or disable offload. */
+#define WLAN_OFFLOAD_DISABLE                     0
+#define WLAN_OFFLOAD_ENABLE                      0x1
+#define WLAN_OFFLOAD_BC_FILTER_ENABLE            0x2
+#define WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE    (WLAN_OFFLOAD_ENABLE | WLAN_OFFLOAD_BC_FILTER_ENABLE)
+
+/* Offload request. */
+typedef struct
+{
+    v_U8_t offloadType;
+    v_U8_t enableOrDisable;
+    union
+    {
+        v_U8_t hostIpv4Addr [4];
+        v_U8_t hostIpv6Addr [16];
+    } params;
+} tHostOffloadRequest, *tpHostOffloadRequest;
+
+#endif // __WLAN_HDD_HOST_OFFLOAD_H__
+
diff --git a/CORE/HDD/inc/wlan_hdd_hostapd.h b/CORE/HDD/inc/wlan_hdd_hostapd.h
new file mode 100644
index 0000000..00525a2
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_hostapd.h
@@ -0,0 +1,89 @@
+/*
+ * 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_HDD_HOSTAPD_H )
+#define WLAN_HDD_HOSTAPD_H
+
+/**===========================================================================
+  
+  \file  WLAN_HDD_HOSTAPD_H.h
+  
+  \brief Linux HDD HOSTAPD include file
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+  
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <vos_list.h>
+#include <vos_types.h>
+
+#include <wlan_qct_tl.h>
+#include <wlan_hdd_main.h>
+
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/ 
+
+hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *name);
+
+VOS_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held);
+
+VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter);
+
+eCsrAuthType 
+hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]);
+
+eCsrEncryptionType 
+hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]);
+
+eCsrEncryptionType 
+hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]);
+
+eCsrAuthType 
+hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]);
+
+eCsrEncryptionType 
+hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]);
+
+void hdd_softap_sta_deauth(hdd_adapter_t*,v_U8_t*);
+void hdd_softap_sta_disassoc(hdd_adapter_t*,v_U8_t*);
+void hdd_softap_tkip_mic_fail_counter_measure(hdd_adapter_t*,v_BOOL_t);
+int hdd_softap_unpackIE( tHalHandle halHandle,
+                eCsrEncryptionType *pEncryptType, 
+                eCsrEncryptionType *mcEncryptType, 
+                eCsrAuthType *pAuthType, 
+                u_int16_t gen_ie_len, 
+                u_int8_t *gen_ie );
+
+#ifdef WLAN_SOFTAP_FEATURE
+VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCallback);
+VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter );
+void hdd_set_ap_ops( struct net_device *pWlanHostapdDev );
+#endif
+
+#endif    // end #if !defined( WLAN_HDD_HOSTAPD_H )
diff --git a/CORE/HDD/inc/wlan_hdd_includes.h b/CORE/HDD/inc/wlan_hdd_includes.h
new file mode 100644
index 0000000..522405d
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_includes.h
@@ -0,0 +1,67 @@
+/*
+ * 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( HDD_INCLUDES_H__ )
+#define HDD_INCLUDES_H__
+
+/**===========================================================================
+  
+  \file  wlan_hdd_includes.h
+  
+  \brief Internal includes for the Linux HDD 
+  
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/* $HEADER$ */
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+
+// throw all the includes in here f to get the .c files  in the HDD to compile.
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/wireless.h>
+#include <linux/if_arp.h>
+
+
+#include <vos_api.h>
+
+#include <sme_Api.h>
+#include <wlan_qct_tl.h>
+
+#include "wlan_hdd_assoc.h"
+#include "wlan_hdd_dp_utils.h"
+#include "wlan_hdd_mib.h"
+#include "wlan_hdd_wext.h"
+#include "wlan_hdd_main.h"
+#include "wlan_hdd_version.h"
+#include "wlan_hdd_tx_rx.h"
+
+
+#endif    // end #if !defined( HDD_INCLUDES_H__ )
diff --git a/CORE/HDD/inc/wlan_hdd_innav.h b/CORE/HDD/inc/wlan_hdd_innav.h
new file mode 100644
index 0000000..1e9b029
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_innav.h
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
diff --git a/CORE/HDD/inc/wlan_hdd_keep_alive.h b/CORE/HDD/inc/wlan_hdd_keep_alive.h
new file mode 100644
index 0000000..910a46f
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_keep_alive.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.
+ */
+
+#ifndef __WLAN_HDD_KEEP_ALIVE_H__
+#define __WLAN_HDD_KEEP_ALIVE_H__
+
+/**===========================================================================
+
+  \file  wlan_hdd_keep_alive.h
+
+  \brief Android WLAN HDD Keep-Alive API
+
+  Copyright 2011 (c) QUALCOMM Incorporated. All Rights Reserved.
+  QUALCOMM Proprietary and Confidential.
+
+  ==========================================================================*/
+
+/* Packet Types. */
+#define WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP     2
+#define WLAN_KEEP_ALIVE_NULL_PKT              1
+
+/* Enable or disable offload. */
+#define WLAN_KEEP_ALIVE_DISABLE     0
+#define WLAN_KEEP_ALIVE_ENABLE    0x1
+
+/* Offload request. */
+typedef struct
+{
+    v_U8_t packetType;
+    v_U32_t timePeriod;
+    v_U8_t  hostIpv4Addr[4]; 
+    v_U8_t  destIpv4Addr[4];
+    v_U8_t  destMacAddr [6];
+} tKeepAliveRequest, *tpKeepAliveRequest;
+
+#endif // __WLAN_HDD_KEEP_ALIVE_H__
+
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
new file mode 100644
index 0000000..59609a4
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -0,0 +1,926 @@
+/*
+ * 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_HDD_MAIN_H )
+#define WLAN_HDD_MAIN_H
+/**===========================================================================
+  
+  \file  WLAN_HDD_MAIN_H.h
+  
+  \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+  
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#ifdef CONFIG_CFG80211
+#include <net/cfg80211.h>
+#endif
+#include <vos_list.h>
+#include <vos_types.h>
+#include "sirMacProtDef.h"
+#include "csrApi.h"
+#include <wlan_hdd_assoc.h>
+#include <wlan_hdd_dp_utils.h>
+#include <wlan_hdd_wmm.h>
+#include <wlan_hdd_cfg.h>
+#include <linux/spinlock.h>
+#ifdef ANI_MANF_DIAG
+#include <wlan_hdd_ftm.h>
+#endif
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/
+/** Number of attempts to detect/remove card */
+#define LIBRA_CARD_INSERT_DETECT_MAX_COUNT      5
+#define LIBRA_CARD_REMOVE_DETECT_MAX_COUNT      5
+/** Number of Tx Queues */  
+#define NUM_TX_QUEUES 4
+/** Queue length specified to OS in the net_device */
+#define NET_DEV_TX_QUEUE_LEN 100
+/** HDD's internal Tx Queue Length. Needs to be a power of 2 */
+#define HDD_TX_QUEUE_MAX_LEN 128
+/** HDD internal Tx Queue Low Watermark. Net Device TX queue is disabled
+ *  when HDD queue becomes full. This Low watermark is used to enable
+ *  the Net Device queue again */
+#define HDD_TX_QUEUE_LOW_WATER_MARK (HDD_TX_QUEUE_MAX_LEN*3/4)
+/** Bytes to reserve in the headroom */
+#define LIBRA_HW_NEEDED_HEADROOM   128
+/** Hdd Tx Time out value */
+#ifdef LIBRA_LINUX_PC
+#define HDD_TX_TIMEOUT          (8000)       
+#else
+#define HDD_TX_TIMEOUT          msecs_to_jiffies(5000)    
+#endif
+/** Hdd Default MTU */
+#define HDD_DEFAULT_MTU         (1500)
+/**event flags registered net device*/
+#define NET_DEVICE_REGISTERED  1<<0
+#define SME_SESSION_OPENED     1<<1
+#define INIT_TX_RX_SUCCESS     1<<2
+#define WMM_INIT_DONE          1<<3
+#define SOFTAP_BSS_STARTED     1<<4
+#define DEVICE_IFACE_OPENED    1<<5
+
+/** Maximum time(ms)to wait for disconnect to complete **/
+#define WLAN_WAIT_TIME_DISCONNECT  500
+#define WLAN_WAIT_TIME_STATS       800
+#define WLAN_WAIT_TIME_POWER       800
+#define WLAN_WAIT_TIME_SESSIONOPENCLOSE  2000
+#define WLAN_WAIT_TIME_ABORTSCAN  2000
+
+/* Scan Req Timeout */
+#define WLAN_WAIT_TIME_SCAN_REQ 100
+
+#define MAX_NUMBER_OF_ADAPTERS 4
+
+#define MAX_CFG_STRING_LEN  255
+
+#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+/** Mac Address string **/
+#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
+#define MAX_GENIE_LEN 255
+
+#if defined(QC_WLAN_CHIPSET_PRIMA)
+#define WLAN_CHIP_VERSION   "WCNSS"
+#elif defined(ANI_CHIPSET_LIBRA)
+#define WLAN_CHIP_VERSION   "WCN1312"
+#elif defined(ANI_CHIPSET_VOLANS)
+#define WLAN_CHIP_VERSION   "WCN1314"
+#else
+#define WLAN_CHIP_VERSION   "UNKNOWN"
+#endif
+
+#define hddLog(level, args...) VOS_TRACE( VOS_MODULE_ID_HDD, level, ## args)
+#define ENTER() VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Enter:%s", __FUNCTION__)
+#define EXIT()  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Exit:%s", __FUNCTION__)
+
+#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t*)(netdev_priv((__dev__)))
+
+#define MAX_EXIT_ATTEMPTS_DURING_LOGP 20
+
+#define MAX_NO_OF_2_4_CHANNELS 14
+
+typedef struct hdd_tx_rx_stats_s
+{
+   // start_xmit stats
+   __u32    txXmitCalled;
+   __u32    txXmitDropped;
+   __u32    txXmitBackPressured;
+   __u32    txXmitQueued;
+   __u32    txXmitClassifiedAC[NUM_TX_QUEUES];
+   __u32    txXmitDroppedAC[NUM_TX_QUEUES];
+   __u32    txXmitBackPressuredAC[NUM_TX_QUEUES];
+   __u32    txXmitQueuedAC[NUM_TX_QUEUES];
+   // fetch_cbk stats
+   __u32    txFetched;
+   __u32    txFetchedAC[NUM_TX_QUEUES];
+   __u32    txFetchEmpty;
+   __u32    txFetchLowResources;
+   __u32    txFetchDequeueError;
+   __u32    txFetchDequeued;
+   __u32    txFetchDequeuedAC[NUM_TX_QUEUES];
+   __u32    txFetchDePressured;
+   __u32    txFetchDePressuredAC[NUM_TX_QUEUES];
+   // complete_cbk_stats
+   __u32    txCompleted;
+   // flush stats
+   __u32    txFlushed;
+   __u32    txFlushedAC[NUM_TX_QUEUES];
+   // rx stats
+   __u32    rxChains;
+   __u32    rxPackets;
+   __u32    rxDropped;
+   __u32    rxDelivered;
+   __u32    rxRefused;
+} hdd_tx_rx_stats_t;
+
+typedef struct hdd_chip_reset_stats_s
+{
+   __u32    totalLogpResets;
+   __u32    totalCMD53Failures;
+   __u32    totalMutexReadFailures;
+   __u32    totalMIFErrorFailures;
+   __u32    totalFWHearbeatFailures;
+   __u32    totalUnknownExceptions;
+} hdd_chip_reset_stats_t;
+
+typedef struct hdd_stats_s
+{
+   tCsrSummaryStatsInfo       summary_stat;
+   tCsrGlobalClassAStatsInfo  ClassA_stat;
+   tCsrGlobalClassBStatsInfo  ClassB_stat;
+   tCsrGlobalClassCStatsInfo  ClassC_stat;
+   tCsrGlobalClassDStatsInfo  ClassD_stat;
+   tCsrPerStaStatsInfo        perStaStats;
+   hdd_tx_rx_stats_t          hddTxRxStats;
+   hdd_chip_reset_stats_t     hddChipResetStats;
+} hdd_stats_t;
+
+typedef enum
+{
+   HDD_ROAM_STATE_NONE,
+   
+   // Issuing a disconnect due to transition into low power states.  
+   HDD_ROAM_STATE_DISCONNECTING_POWER,
+   
+   // move to this state when HDD sets a key with SME/CSR.  Note this is
+   // an important state to get right because we will get calls into our SME
+   // callback routine for SetKey activity that we did not initiate!
+   HDD_ROAM_STATE_SETTING_KEY,
+} HDD_ROAM_STATE;
+
+typedef enum
+{
+   eHDD_SUSPEND_NONE = 0,
+   eHDD_SUSPEND_DEEP_SLEEP,
+   eHDD_SUSPEND_STANDBY,
+} hdd_ps_state_t;
+
+typedef struct roaming_info_s
+{
+   HDD_ROAM_STATE roamingState;
+   vos_event_t roamingEvent;
+   
+} roaming_info_t;
+
+#ifdef FEATURE_WLAN_WAPI
+/* Define WAPI macros for Length, BKID count etc*/
+#define MAX_WPI_KEY_LENGTH    16
+#define MAX_NUM_PN            16
+#define MAC_ADDR_LEN           6
+#define MAX_ADDR_INDEX        12
+#define MAX_NUM_AKM_SUITES    16
+#define MAX_NUM_UNI_SUITES    16
+#define MAX_NUM_BKIDS         16
+#define HDD_PAIRWISE_WAPI_KEY 0
+#define HDD_GROUP_WAPI_KEY    1
+
+/** WAPI AUTH mode definition */
+enum _WAPIAuthMode
+{
+   WAPI_AUTH_MODE_OPEN = 0,
+   WAPI_AUTH_MODE_PSK = 1,
+   WAPI_AUTH_MODE_CERT
+} __attribute__((packed));
+typedef enum _WAPIAuthMode WAPIAuthMode;
+
+/** WAPI Work mode structure definition */
+#define   WZC_ORIGINAL      0
+#define   WAPI_EXTENTION    1
+
+struct _WAPI_FUNCTION_MODE
+{
+   unsigned char wapiMode;
+}__attribute__((packed));
+
+typedef struct _WAPI_FUNCTION_MODE WAPI_FUNCTION_MODE;
+
+typedef struct _WAPI_BKID
+{
+   v_U8_t   bkid[16];
+}WAPI_BKID, *pWAPI_BKID;
+
+/** WAPI Association information structure definition */
+struct _WAPI_AssocInfo
+{
+   v_U8_t      elementID;
+   v_U8_t      length;
+   v_U16_t     version;
+   v_U16_t     akmSuiteCount;
+   v_U32_t     akmSuite[MAX_NUM_AKM_SUITES];
+   v_U16_t     unicastSuiteCount;
+   v_U32_t     unicastSuite[MAX_NUM_UNI_SUITES];
+   v_U32_t     multicastSuite;
+   v_U16_t     wapiCability;
+   v_U16_t     bkidCount;
+   WAPI_BKID   bkidList[MAX_NUM_BKIDS];
+} __attribute__((packed));
+
+typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
+typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
+
+/** WAPI KEY Type definition */
+enum _WAPIKeyType
+{
+   PAIRWISE_KEY, //0
+   GROUP_KEY     //1
+}__attribute__((packed));
+typedef enum _WAPIKeyType WAPIKeyType;
+
+/** WAPI KEY Direction definition */
+enum _KEY_DIRECTION
+{
+   None,
+   Rx,
+   Tx,
+   Rx_Tx
+}__attribute__((packed));
+
+typedef enum _KEY_DIRECTION WAPI_KEY_DIRECTION;
+
+/** WAPI KEY stucture definition */
+struct WLAN_WAPI_KEY
+{
+   WAPIKeyType     keyType;
+   WAPI_KEY_DIRECTION   keyDirection;  /*reserved for future use*/
+   v_U8_t          keyId;
+   v_U8_t          addrIndex[MAX_ADDR_INDEX]; /*reserved for future use*/
+   int             wpiekLen;
+   v_U8_t          wpiek[MAX_WPI_KEY_LENGTH];
+   int             wpickLen;
+   v_U8_t          wpick[MAX_WPI_KEY_LENGTH];
+   v_U8_t          pn[MAX_NUM_PN];        /*reserved for future use*/
+}__attribute__((packed));
+
+typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
+typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
+
+#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
+#define WLAN_EID_WAPI 68
+#define WAPI_PSK_AKM_SUITE  0x02721400
+#define WAPI_CERT_AKM_SUITE 0x01721400
+
+/** WAPI BKID List stucture definition */
+struct _WLAN_BKID_LIST
+{
+   v_U32_t          length;
+   v_U32_t          BKIDCount;
+   WAPI_BKID        BKID[1];
+}__attribute__((packed));
+
+typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
+typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
+
+
+/** WAPI Information stucture definition */
+struct hdd_wapi_info_s
+{
+   v_U32_t     nWapiMode;
+   v_BOOL_t    fIsWapiSta;
+   v_MACADDR_t cachedMacAddr;
+   v_UCHAR_t   wapiAuthMode;
+}__attribute__((packed));
+typedef struct hdd_wapi_info_s hdd_wapi_info_t;
+#endif /* FEATURE_WLAN_WAPI */
+
+#ifdef CONFIG_CFG80211
+typedef struct beacon_data_s {
+    u8 *head, *tail;
+    int head_len, tail_len;
+    int dtim_period;
+} beacon_data_t;
+#endif
+
+typedef enum device_mode
+{  /* MAINTAIN 1 - 1 CORRESPONDENCE WITH tVOS_CON_MODE*/
+   WLAN_HDD_INFRA_STATION,
+   WLAN_HDD_SOFTAP,
+   WLAN_HDD_P2P_CLIENT,
+   WLAN_HDD_P2P_GO,
+   WLAN_HDD_MONITOR
+#ifdef ANI_MANF_DIAG
+   ,WLAN_HDD_FTM,
+#endif
+}device_mode_t;
+
+typedef enum rem_on_channel_request_type
+{
+   REMAIN_ON_CHANNEL_REQUEST,
+   OFF_CHANNEL_ACTION_TX,
+}rem_on_channel_request_type_t;
+
+/* Thermal mitigation Level Enum Type */
+typedef enum
+{
+   WLAN_HDD_TM_LEVEL_0,
+   WLAN_HDD_TM_LEVEL_1,
+   WLAN_HDD_TM_LEVEL_2,
+   WLAN_HDD_TM_LEVEL_3,
+   WLAN_HDD_TM_LEVEL_4,
+   WLAN_HDD_TM_LEVEL_MAX
+} WLAN_TmLevelEnumType;
+
+/* Driver Action based on thermal mitigation level structure */
+typedef struct
+{
+   v_BOOL_t  ampduEnable;
+   v_BOOL_t  enterImps;
+   v_U32_t   txSleepDuration;
+   v_U32_t   txOperationDuration;
+   v_U32_t   txBlockFrameCountThreshold;
+} hdd_tmLevelAction_t;
+
+/* Thermal Mitigation control context structure */
+typedef struct
+{
+   WLAN_TmLevelEnumType currentTmLevel;
+   hdd_tmLevelAction_t  tmAction;
+   vos_timer_t          txSleepTimer;
+   struct mutex         tmOperationLock;
+   vos_event_t          setTmDoneEvent;
+   v_U32_t              txFrameCount;
+   v_TIME_t             lastblockTs;
+   v_TIME_t             lastOpenTs;
+   struct netdev_queue *blockedQueue;
+} hdd_thermal_mitigation_info_t;
+
+#if defined CONFIG_CFG80211
+typedef struct hdd_remain_on_chan_ctx
+{
+  struct net_device *dev;
+  struct ieee80211_channel chan;
+  enum nl80211_channel_type chan_type;
+  unsigned int duration;
+  u64 cookie;
+  rem_on_channel_request_type_t rem_on_chan_request;
+}hdd_remain_on_chan_ctx_t;
+
+typedef struct hdd_cfg80211_state_s 
+{
+  tANI_U16 current_freq;
+  u64 action_cookie;
+  tANI_U8 *buf;
+  size_t len;
+  struct sk_buff *skb;
+  hdd_remain_on_chan_ctx_t* remain_on_chan_ctx;
+}hdd_cfg80211_state_t;
+
+#endif
+struct hdd_station_ctx
+{
+  /** Handle to the Wireless Extension State */
+   hdd_wext_state_t WextState;
+
+   /**Connection information*/
+   connection_info_t conn_info;
+
+   roaming_info_t roam_info;
+
+   v_BOOL_t bSendDisconnect;
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+   int     ft_carrier_on;
+#endif
+};
+
+#define BSS_STOP    0 
+#define BSS_START   1
+typedef struct hdd_hostapd_state_s
+{
+    int bssState;
+    vos_event_t vosEvent;
+    VOS_STATUS vosStatus;
+    v_BOOL_t bCommit; 
+
+} hdd_hostapd_state_t;
+
+
+/*
+ * Per station structure kept in HDD for multiple station support for SoftAP
+*/
+typedef struct {
+    /** The station entry is used or not  */
+    v_BOOL_t isUsed;
+
+    /** Station ID reported back from HAL (through SAP). Broadcast
+     *  uses station ID zero by default in both libra and volans. */
+    v_U8_t ucSTAId;
+
+    /** MAC address of the station */
+    v_MACADDR_t macAddrSTA;
+
+    /** Current Station state so HDD knows how to deal with packet
+     *  queue. Most recent states used to change TL STA state. */
+    WLANTL_STAStateType tlSTAState;
+
+   /** Transmit queues for each AC (VO,VI,BE etc). */
+   hdd_list_t wmm_tx_queue[NUM_TX_QUEUES];
+
+   /** Might need to differentiate queue depth in contention case */
+   v_U16_t aTxQueueDepth[NUM_TX_QUEUES];
+   
+   /**Track whether OS TX queue has been disabled.*/
+   v_BOOL_t txSuspended[NUM_TX_QUEUES];
+
+   /** Track QoS status of station */
+   v_BOOL_t isQosEnabled;
+
+} hdd_station_info_t;
+
+struct hdd_ap_ctx_s
+{
+   hdd_hostapd_state_t HostapdState;
+
+   // Memory differentiation mode is enabled
+   //v_U16_t uMemoryDiffThreshold;
+   //v_U8_t uNumActiveAC;
+   //v_U8_t uActiveACMask;
+   //v_U8_t aTxQueueLimit[NUM_TX_QUEUES];
+
+   /** Packet Count to update uNumActiveAC and uActiveACMask */
+   //v_U16_t uUpdatePktCount;
+
+   /** Station ID assigned after BSS starts */
+   v_U8_t uBCStaId;
+
+   v_U8_t uPrivacy;  // The privacy bits of configuration
+   
+#ifdef WLAN_SOFTAP_FEATURE   
+   tSirWPSPBCProbeReq WPSPBCProbeReq;
+   
+   tsap_Config_t sapConfig;
+#endif
+   
+   struct semaphore semWpsPBCOverlapInd;
+   
+   v_BOOL_t apDisableIntraBssFwd;
+      
+   vos_timer_t hdd_ap_inactivity_timer;
+
+   v_U8_t   operatingChannel;
+   
+   v_BOOL_t uIsAuthenticated;
+
+   eCsrEncryptionType ucEncryptType;
+   
+#ifdef CONFIG_CFG80211   
+   //This will point to group key data, if it is received before start bss. 
+   tCsrRoamSetKey groupKey; 
+   // This will have WEP key data, if it is received before start bss
+   tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
+
+   beacon_data_t *beacon;
+#endif
+};
+
+#ifdef CONFIG_CFG80211   
+struct hdd_mon_ctx_s
+{
+   hdd_adapter_t *pAdapterForTx;
+};
+#endif
+
+typedef struct hdd_scaninfo_s
+{
+   /* The scan id  */
+   v_U32_t scanId; 
+
+   /* The scan pending  */
+   v_U32_t mScanPending;
+
+   /* Client Wait Scan Result */
+   v_U32_t waitScanResult;
+
+#ifdef WLAN_FEATURE_P2P
+   v_BOOL_t p2pSearch;
+#endif
+
+   /* Additional IE for scan */
+   tSirAddie scanAddIE; 
+
+   /* Scan mode*/
+   tSirScanType scan_mode;
+
+   /* Scan Completion Event */
+   struct completion scan_req_completion_event;
+
+   vos_event_t scan_finished_event;
+
+   hdd_scan_pending_option_e scan_pending_option;
+
+}hdd_scaninfo_t;
+
+#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e //ASCII "WLAN"
+struct hdd_adapter_s
+{
+   void *pHddCtx;
+
+   device_mode_t device_mode; 
+
+   /** Handle to the network device */
+   struct net_device *dev;
+    
+   //TODO Move this to sta Ctx
+#ifdef CONFIG_CFG80211
+   struct wireless_dev wdev ;
+   struct cfg80211_scan_request *request ; 
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+   /** ops checks if Opportunistic Power Save is Enable or Not
+    * ctw stores ctWindow value once we receive Opps command from 
+    * wpa_supplicant then using ctWindow value we need to Enable 
+    * Opportunistic Power Save
+    */
+    tANI_U8  ops;
+    tANI_U32 ctw;
+#endif
+
+   /** Current MAC Address for the adapter  */       
+   v_MACADDR_t macAddressCurrent;    
+      
+   /**Event Flags*/
+   unsigned long event_flags;
+
+   /**Device TX/RX statistics*/
+   struct net_device_stats stats;
+   /** HDD statistics*/
+   hdd_stats_t hdd_stats;
+   /**Mib information*/
+   sHddMib_t  hdd_mib;
+           
+   tANI_U8 sessionId;
+#ifdef WLAN_FEATURE_P2P   
+   /** p2pSessionId required to open new SME session for P2P 
+    *  Device address which is different from STA MAC Address
+    */ 
+   tANI_U8 p2pSessionId;
+#endif
+
+   /* Completion variable for session close */
+   struct completion session_close_comp_var;
+
+   /* Completion variable for session open */
+   struct completion session_open_comp_var;
+
+   //TODO: move these to sta ctx. These may not be used in AP 
+   /** completion variable for disconnect callback */
+   struct completion disconnect_comp_var;
+
+   /* completion variable for Linkup Event */
+   struct completion linkup_event_var;
+
+
+   /* completion variable for abortscan */
+   struct completion abortscan_event_var;
+#ifdef CONFIG_CFG80211
+   /* completion variable for cancel remain on channel Event */
+   struct completion cancel_rem_on_chan_var;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+   /* completion variable for off channel  remain on channel Event */
+   struct completion offchannel_tx_event;
+#endif
+   /* Completion variable for action frame */
+   struct completion tx_action_cnf_event;
+   /* Completion variable for remain on channel ready */
+   struct completion rem_on_chan_ready_event;
+#endif
+
+   /* Track whether the linkup handling is needed  */
+   v_BOOL_t isLinkUpSvcNeeded;
+
+/*************************************************************
+ *  Tx Queues
+ */
+   /** Transmit queues for each AC (VO,VI,BE etc) */
+   hdd_list_t wmm_tx_queue[NUM_TX_QUEUES];
+   /**Track whether VOS is in a low resource state*/
+   v_BOOL_t isVosOutOfResource;
+  
+   /**Track whether OS TX queue has been disabled.*/
+   v_BOOL_t isTxSuspended[NUM_TX_QUEUES];
+
+   /** WMM Status */
+   hdd_wmm_status_t hddWmmStatus;
+/*************************************************************
+ */
+/*************************************************************
+ * TODO - Remove it later
+ */
+    /** Multiple station supports */
+   /** Per-station structure */
+   spinlock_t staInfo_lock; //To protect access to station Info  
+   hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
+   //v_U8_t uNumActiveStation;
+
+   v_U16_t aTxQueueLimit[NUM_TX_QUEUES];
+/*************************************************************
+ */
+
+#ifdef FEATURE_WLAN_WAPI
+   hdd_wapi_info_t wapi_info;
+#endif
+   
+   v_S7_t rssi;
+#ifdef CONFIG_CFG80211
+   struct work_struct  monTxWorkQueue;
+   struct sk_buff *skb_to_tx;
+#endif
+
+   union {
+      hdd_station_ctx_t station;
+      hdd_ap_ctx_t  ap;
+#ifdef CONFIG_CFG80211   
+      hdd_mon_ctx_t monitor;
+#endif
+   }sessionCtx;
+
+   hdd_scaninfo_t scan_info;
+#ifdef CONFIG_CFG80211
+   hdd_cfg80211_state_t cfg80211State;
+#endif
+
+   //Magic cookie for adapter sanity verification
+   v_U32_t magic;
+   v_BOOL_t higherDtimTransition;
+};
+
+typedef struct hdd_dynamic_mcbcfilter_s
+{
+    v_BOOL_t     enableCfg;
+    v_U8_t       mcastBcastFilterSetting;
+    v_BOOL_t     enableSuspend;
+    v_U8_t       mcBcFilterSuspend;
+}hdd_dynamic_mcbcfilter_t;
+
+#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) &(pAdapter)->sessionCtx.station
+#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) &(pAdapter)->sessionCtx.ap
+#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter)  &(pAdapter)->sessionCtx.station.WextState
+#define WLAN_HDD_GET_CTX(pAdapter) (hdd_context_t*)pAdapter->pHddCtx
+#define WLAN_HDD_GET_HAL_CTX(pAdapter)  ((hdd_context_t*)(pAdapter->pHddCtx))->hHal
+#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) &(pAdapter)->sessionCtx.ap.HostapdState
+#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter)  &(pAdapter)->cfg80211State
+#define WLAN_HDD_MAX_MC_ADDR_LIST 10
+
+typedef struct hdd_adapter_list_node
+{
+   hdd_list_node_t node;     // MUST be first element
+   hdd_adapter_t *pAdapter;
+}hdd_adapter_list_node_t;
+
+typedef struct hdd_priv_data_s
+{
+   tANI_U8 *buf;
+   int used_len;
+   int total_len;
+}hdd_priv_data_t;
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+typedef struct multicast_addr_list
+{
+   v_U8_t isFilterApplied;
+   v_U8_t mc_cnt;
+   v_U8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
+} t_multicast_add_list;
+#endif
+
+/** Adapter stucture definition */
+
+struct hdd_context_s
+{
+   /** Global VOS context  */
+   v_CONTEXT_t pvosContext;
+
+   /** HAL handle...*/
+   tHalHandle hHal;
+
+#ifdef CONFIG_CFG80211
+   struct wiphy *wiphy ;
+#endif
+   //TODO Remove this from here.
+
+   hdd_list_t hddAdapters; //List of adapters
+   /* One per STA: 1 for RX_BCMC_STA_ID and 1 for SAP_SELF_STA_ID*/
+   hdd_adapter_t *sta_to_adapter[WLAN_MAX_STA_COUNT + 3]; //One per sta. For quick reference.
+
+   /** Pointer for firmware image data */
+   const struct firmware *fw;
+   
+   /** Pointer for configuration data */
+   const struct firmware *cfg;
+   
+   /** Pointer for nv data */
+   const struct firmware *nv;
+   
+   /** Pointer to the parent device */
+   struct device *parent_dev;
+
+   pid_t  pid_sdio_claimed;
+   atomic_t sdio_claim_count;
+
+   /** Config values read from qcom_cfg.ini file */ 
+   hdd_config_t *cfg_ini;
+  #ifdef ANI_MANF_DIAG
+   wlan_hdd_ftm_status_t ftm; 
+  #endif
+   /** completion variable for full power callback */
+   struct completion full_pwr_comp_var;
+   /** completion variable for Request BMPS callback */
+   struct completion req_bmps_comp_var;
+   
+   /** completion variable for standby callback */
+   struct completion standby_comp_var;
+   
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Completion  variable to indicate Rx Thread Suspended */
+   struct completion rx_sus_event_var;
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+   /* Completion  variable to indicate Tx Thread Suspended */
+   struct completion tx_sus_event_var;
+
+   /* Completion  variable to indicate Mc Thread Suspended */
+   struct completion mc_sus_event_var;
+
+
+   v_BOOL_t isWlanSuspended;
+
+   v_BOOL_t isTxThreadSuspended;
+
+   v_BOOL_t isMcThreadSuspended;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   v_BOOL_t isRxThreadSuspended;
+#endif
+
+   volatile v_BOOL_t isLogpInProgress;
+
+   v_BOOL_t isLoadUnloadInProgress;
+   
+   /**Track whether driver has been suspended.*/
+   hdd_ps_state_t hdd_ps_state;
+   
+   /* Track whether Mcast/Bcast Filter is enabled.*/
+   v_BOOL_t hdd_mcastbcast_filter_set;
+
+   /* Track whether ignore DTIM is enabled*/
+   v_BOOL_t hdd_ignore_dtim_enabled;
+   v_U32_t hdd_actual_ignore_DTIM_value;
+   v_U32_t hdd_actual_LI_value; 
+
+   
+   v_BOOL_t hdd_wlan_suspended;
+   
+   spinlock_t filter_lock;
+   
+   /* Lock to avoid race condtion during start/stop bss*/
+   struct mutex sap_lock;
+   
+   /** ptt Process ID*/
+   v_SINT_t ptt_pid;
+
+   v_U8_t change_iface;
+
+   /** Concurrency Parameters*/
+   tVOS_CONCURRENCY_MODE concurrency_mode;
+
+   v_U16_t no_of_sessions[VOS_MAX_NO_OF_MODE];
+
+   hdd_chip_reset_stats_t hddChipResetStats;
+   /* Number of times riva restarted */
+   v_U32_t  hddRivaResetStats;
+   
+   hdd_dynamic_mcbcfilter_t dynamic_mcbc_filter;
+   
+   /* Can we allow AMP connection right now*/
+   v_BOOL_t isAmpAllowed;
+   
+#ifdef WLAN_FEATURE_P2P
+   /** P2P Device MAC Address for the adapter  */
+   v_MACADDR_t p2pDeviceAddress;
+#endif
+
+   /* Thermal mitigation information */
+   hdd_thermal_mitigation_info_t tmInfo;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+   t_multicast_add_list mc_addr_list;
+#endif
+};
+
+
+
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+VOS_STATUS hdd_get_front_adapter( hdd_context_t *pHddCtx,
+                                  hdd_adapter_list_node_t** ppAdapterNode);
+
+VOS_STATUS hdd_get_next_adapter( hdd_context_t *pHddCtx,
+                                 hdd_adapter_list_node_t* pAdapterNode,
+                                 hdd_adapter_list_node_t** pNextAdapterNode);
+
+VOS_STATUS hdd_remove_adapter( hdd_context_t *pHddCtx,
+                               hdd_adapter_list_node_t* pAdapterNode);
+
+VOS_STATUS hdd_remove_front_adapter( hdd_context_t *pHddCtx,
+                                     hdd_adapter_list_node_t** ppAdapterNode);
+
+VOS_STATUS hdd_add_adapter_back( hdd_context_t *pHddCtx,
+                                 hdd_adapter_list_node_t* pAdapterNode);
+
+VOS_STATUS hdd_add_adapter_front( hdd_context_t *pHddCtx,
+                                  hdd_adapter_list_node_t* pAdapterNode);
+
+hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
+                                 char* name, tSirMacAddr macAddr, tANI_U8 rtnl_held );
+VOS_STATUS hdd_close_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_U8 rtnl_held );
+VOS_STATUS hdd_close_all_adapters( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_stop_all_adapters( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_reset_all_adapters( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx );
+hdd_adapter_t * hdd_get_adapter_by_name( hdd_context_t *pHddCtx, tANI_U8 *name );
+hdd_adapter_t * hdd_get_adapter_by_macaddr( hdd_context_t *pHddCtx, tSirMacAddr macAddr );
+hdd_adapter_t * hdd_get_mon_adapter( hdd_context_t *pHddCtx );
+VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter );
+hdd_adapter_t * hdd_get_adapter( hdd_context_t *pHddCtx, device_mode_t mode );
+void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
+VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
+void hdd_set_station_ops( struct net_device *pWlanDev );
+tANI_U8* wlan_hdd_get_intf_addr(hdd_context_t* pHddCtx);
+void wlan_hdd_release_intf_addr(hdd_context_t* pHddCtx, tANI_U8* releaseAddr);
+v_U8_t hdd_get_operating_channel( hdd_context_t *pHddCtx, device_mode_t mode );
+
+
+#if defined(WLAN_SOFTAP_FEATURE) || defined(ANI_MANF_DIAG)
+void hdd_set_conparam ( v_UINT_t newParam );
+tVOS_CON_MODE hdd_get_conparam( void );
+#endif
+
+void wlan_hdd_enable_deepsleep(v_VOID_t * pVosContext);
+v_BOOL_t hdd_is_apps_power_collapse_allowed(hdd_context_t* pHddCtx);
+void hdd_abort_mac_scan(hdd_context_t *pHddCtx);
+#ifdef CONFIG_CFG80211
+void wlan_hdd_set_monitor_tx_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
+void hdd_cleanup_actionframe( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
+#endif
+void wlan_hdd_set_concurrency_mode(hdd_context_t *pHddCtx, tVOS_CON_MODE mode);
+void wlan_hdd_clear_concurrency_mode(hdd_context_t *pHddCtx, tVOS_CON_MODE mode);
+void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter);
+void hdd_prevent_suspend(void);
+void hdd_allow_suspend(void);
+v_U8_t hdd_is_ssr_required(void);
+void hdd_set_ssr_required(v_U8_t value);
+
+VOS_STATUS hdd_enable_bmps_imps(hdd_context_t *pHddCtx);
+VOS_STATUS hdd_disable_bmps_imps(hdd_context_t *pHddCtx, tANI_U8 session_type);
+
+eHalStatus hdd_smeCloseSessionCallback(void *pContext);
+#endif    // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/CORE/HDD/inc/wlan_hdd_mib.h b/CORE/HDD/inc/wlan_hdd_mib.h
new file mode 100644
index 0000000..0cb3dbe
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_mib.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( WLAN_HDD_MIB_h__ )
+#define WLAN_HDD_MIB_h__ 
+
+
+#include <vos_types.h>
+
+typedef enum
+{
+    eMib_dot11DesiredBssType_infrastructure = 1,
+    eMib_dot11DesiredBssType_independent = 2,
+    eMib_dot11DesiredBssType_infra_ap =3,
+    eMib_dot11DesiredBssType_any = 4
+    
+} eMib_dot11DesiredBssType;
+
+
+/** This is the maximum number of BSSIDs supported in the 
+      dot11DesiredBssidList.  All the code operates off of 
+      this maximum BSSID list count.  */
+#define MIB_DOT11_DESIRED_BSSID_LIST_MAX_COUNT ( 1 )
+
+typedef struct
+{
+    v_U32_t cEntries;
+    
+    v_MACADDR_t BSSIDs[ MIB_DOT11_DESIRED_BSSID_LIST_MAX_COUNT ];     
+
+}  sMib_dot11DesiredBssidList;
+
+
+
+/** This is the maximum number of SSIDs supported in the 
+     dot11DesiredSsidList.  All the code operates off of 
+     this maximum SSID list count.  */
+     
+#define MIB_DOT11_DESIRED_SSID_LIST_MAX_COUNT ( 1 )
+
+#define MIB_DOT11_SSID_MAX_LENGTH ( 32 )
+
+typedef struct
+{
+    v_U32_t ssidLength;
+    v_U8_t  ssid[ MIB_DOT11_SSID_MAX_LENGTH ];
+    
+} sDot11Ssid;
+
+typedef struct
+{
+    v_U32_t cEntries;
+    
+    sDot11Ssid SSIDs[ MIB_DOT11_DESIRED_SSID_LIST_MAX_COUNT ];     
+
+}  sMib_dot11DesiredSsidList;
+
+
+
+typedef enum
+{
+    // these are bitmasks....
+    eMib_dot11AutoConfigEnabled_None = 0U,
+    eMib_dot11AutoConfigEnabled_Phy  = 0x00000001U,
+    eMib_dot11AutoConfigEnabled_Mac  = 0x00000002U
+    
+} eMib_dot11AutoConfigEnabled;
+
+
+
+#define MIB_DOT11_SUPPORTED_PHY_TYPES_MAX_COUNT ( 3 )
+
+typedef enum tagMib_dot11PhyType 
+{
+    eMib_dot11PhyType_11b,
+    eMib_dot11PhyType_11a,
+    eMib_dot11PhyType_11g,
+    eMib_dot11PhyType_all
+} eMib_dot11PhyType;
+
+typedef struct tagMib_dot11SupportedPhyTypes
+{
+    v_U32_t cEntries;    
+    eMib_dot11PhyType phyTypes[ MIB_DOT11_SUPPORTED_PHY_TYPES_MAX_COUNT ];     
+}  sMib_dot11SupportedPhyTypes;
+
+
+typedef enum
+{
+   eMib_DevicePowerState_D0, 
+   eMib_DevicePowerState_D1, 
+   eMib_DevicePowerState_D2, 
+   eMib_DevicePowerState_D3
+   
+} eMib_DevicePowerState;    
+   
+
+typedef enum
+{
+    eMib_dot11NICPowerState_OFF = VOS_FALSE,
+    eMib_dot11NICPowerState_ON  = VOS_TRUE
+    
+} eMib_dot11NICPowerState;
+
+
+typedef enum
+{
+    eMib_dot11HardwarePHYState_OFF = VOS_FALSE,
+    eMib_dot11HardwarePHYState_ON  = VOS_TRUE
+    
+} eMib_dot11HardwarePHYState;
+
+
+typedef enum
+{
+    eMib_dot11PowerSavingLevel_None, 
+    eMib_dot11PowerSavingLevel_MaxPS,
+    eMib_dot11PowerSavingLevel_FastPS,
+    eMib_dot11PowerSavingLevel_MaximumLevel
+    
+} eMib_dot11PowerSavingLevel;    
+
+
+#define MIB_DOT11_MAC_EXCLUSION_LIST_MAX_COUNT 4
+typedef struct
+{
+    v_U32_t cEntries;
+    
+    v_MACADDR_t macAddrs[ MIB_DOT11_MAC_EXCLUSION_LIST_MAX_COUNT ];     
+
+} sMib_dot11MacExcludeList;
+
+#define MIB_DOT11_PRIVACY_EXEMPT_LIST_MAX_COUNT 32
+
+typedef enum
+{
+    eMib_dot11ExemptionAction_Always,
+    eMib_dot11ExemptionAction_OnKeyMapUnavailable
+
+}eMib_dot11ExemptAction;
+
+typedef enum
+{
+    eMib_dot11ExemptPacket_Unicast,
+    eMib_dot11ExemptPacket_Multicast,
+    eMib_dot11ExemptPacket_Both
+
+}eMib_dot11ExemptPacket;
+
+typedef struct
+{
+    v_U16_t uEtherType;
+    eMib_dot11ExemptAction exemptAction;
+    eMib_dot11ExemptPacket exemptPacket;
+
+}sMib_dot11PrivacyExemption;
+
+typedef struct
+{
+    v_U32_t cEntries;
+
+    sMib_dot11PrivacyExemption privacyExemptList[ MIB_DOT11_PRIVACY_EXEMPT_LIST_MAX_COUNT ];
+
+} sMib_dot11PrivacyExemptionList;
+
+typedef struct sHddMib_s
+{
+    eMib_dot11DesiredBssType    mibDot11DesiredBssType;
+
+    sMib_dot11DesiredBssidList  mibDot11DesiredBssidList;
+
+    sMib_dot11DesiredSsidList   mibDot11DesiredSsidList;
+
+    eMib_dot11AutoConfigEnabled mibDot11AutoConfigEnabled;
+
+    // the device power state for the device (the D-state... you know D0, D1, D2, etc.
+    eMib_DevicePowerState      mibDevicePowerState;
+
+    // dot11NICPowerState is really the on/off state of the PHY.  This can be
+    // mamipulated through OIDs like a software control for radio on/off.
+    eMib_dot11NICPowerState    mibDot11NICPowerState;
+
+    // Hardware PHY state is the on/off state of the hardware PHY.
+    eMib_dot11HardwarePHYState mibDot11HardwarePHYState;
+
+    // dot11 Power Saving level is the 802.11 power saving level/state for the 802.11
+    // NIC.  Typically this is mapped to 802.11 BMPS in some fashion.  We are not going
+    // to disappoint; the Libra NIC maps these to different BMPS settings.
+    eMib_dot11PowerSavingLevel mibDot11PowerSavingLevel;
+
+    sMib_dot11MacExcludeList mibDot11MacExcludeList;
+
+    sMib_dot11PrivacyExemptionList mibDot11PrivacyExemptionList;
+
+    sMib_dot11SupportedPhyTypes  mibDot11SupportedPhyTypes;
+    eMib_dot11PhyType            mibDot11CurrentPhyType;
+
+    v_BOOL_t                      dot11IbssJoinOnly;
+    v_BOOL_t                      HiddenNetworkEnabled;
+
+
+}sHddMib_t;
+
+#endif
diff --git a/CORE/HDD/inc/wlan_hdd_p2p.h b/CORE/HDD/inc/wlan_hdd_p2p.h
new file mode 100644
index 0000000..63d47b1
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_p2p.h
@@ -0,0 +1,127 @@
+/*
+ * 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 __P2P_H
+#define __P2P_H
+/**===========================================================================
+
+\file         wlan_hdd_p2p.h
+
+\brief       Linux HDD P2P include file
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+
+==========================================================================*/
+#ifdef CONFIG_CFG80211
+#define ACTION_FRAME_TX_TIMEOUT 1000
+#define WAIT_CANCEL_REM_CHAN    100
+#define WAIT_REM_CHAN_READY     100
+#define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000
+
+#define WLAN_HDD_GET_TYPE_FRM_FC(__fc__)         (((__fc__) & 0x0F) >> 2)
+#define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__)      (((__fc__) & 0xF0) >> 4)
+#define WLAN_HDD_80211_FRM_DA_OFFSET             4
+#define P2P_WILDCARD_SSID_LEN                    7
+#define P2P_WILDCARD_SSID                        "DIRECT-"
+
+enum hdd_rx_flags {
+    HDD_RX_FLAG_DECRYPTED        = 1 << 0,
+    HDD_RX_FLAG_MMIC_STRIPPED    = 1 << 1,
+    HDD_RX_FLAG_IV_STRIPPED      = 1 << 2,
+};
+
+
+#ifdef WLAN_FEATURE_P2P
+#define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC        1 << 0;
+#define P2P_POWER_SAVE_TYPE_PERIODIC_NOA         1 << 1;
+#define P2P_POWER_SAVE_TYPE_SINGLE_NOA           1 << 2;
+
+typedef struct p2p_app_setP2pPs{
+   tANI_U8     opp_ps;
+   tANI_U32     ctWindow;
+   tANI_U8     count;
+   tANI_U32     duration;
+   tANI_U32    interval;
+   tANI_U32    single_noa_duration;
+   tANI_U8      psSelection;
+}p2p_app_setP2pPs_t;
+
+int wlan_hdd_cfg80211_remain_on_channel( struct wiphy *wiphy,
+                                struct net_device *dev,
+                                struct ieee80211_channel *chan,
+                                enum nl80211_channel_type channel_type,
+                                unsigned int duration, u64 *cookie );
+
+int wlan_hdd_cfg80211_cancel_remain_on_channel( struct wiphy *wiphy,
+                                       struct net_device *dev,
+                                       u64 cookie );
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 
+                                          struct net_device *dev,
+                                          u64 cookie);
+#endif
+
+int hdd_setP2pPs( struct net_device *dev, void *msgData );
+int hdd_setP2pOpps( struct net_device *dev, tANI_U8 *command );
+int hdd_setP2pNoa( struct net_device *dev, tANI_U8 *command );
+
+void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter,
+                            tANI_U32 nFrameLength, tANI_U8* pbFrames,
+                            tANI_U8 frameType,
+                            tANI_U32 rxChan);
+
+void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter );
+void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess );
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan, bool offchan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid, unsigned int wait,
+                     const u8 *buf, size_t len,  bool no_cck,
+                     bool dont_wait_for_ack, u64 *cookie );
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan, bool offchan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid, unsigned int wait,
+                     const u8 *buf, size_t len, u64 *cookie );
+#else
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid,
+                     const u8 *buf, size_t len, u64 *cookie );
+#endif
+
+#endif // WLAN_FEATURE_P2P
+
+struct net_device* wlan_hdd_add_virtual_intf(
+                  struct wiphy *wiphy, char *name, enum nl80211_iftype type,
+                  u32 *flags, struct vif_params *params );
+
+int wlan_hdd_del_virtual_intf( struct wiphy *wiphy, struct net_device *dev );
+
+#endif // CONFIG_CFG80211
+
+#endif // __P2P_H
diff --git a/CORE/HDD/inc/wlan_hdd_packet_filtering.h b/CORE/HDD/inc/wlan_hdd_packet_filtering.h
new file mode 100644
index 0000000..d42c091
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_packet_filtering.h
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  wlan_hdd_packet_filtering.h
+*
+* Description: Packet Filter Definitions.
+*
+* Copyright (c) 2011 QUALCOMM Incorporated. All Rights Reserved.
+* QUALCOMM Proprietary and Confidential.
+*
+******************************************************************************/
+
+#ifndef __WLAN_HDD_PACKET_FILTERING_H__
+#define __WLAN_HDD_PACKET_FILTERING_H__
+
+typedef struct
+{
+    v_U8_t       mcastBcastFilterSetting;
+}tMcBcFilterCfg, *tpMcBcFilterCfg;
+
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#define HDD_MAX_CMP_PER_PACKET_FILTER     5     
+
+typedef enum
+{
+  HDD_FILTER_PROTO_TYPE_INVALID = 0,
+  HDD_FILTER_PROTO_TYPE_MAC = 1,
+  HDD_FILTER_PROTO_TYPE_ARP = 2,
+  HDD_FILTER_PROTO_TYPE_IPV4 =3 ,
+  HDD_FILTER_PROTO_TYPE_IPV6 = 4,
+  HDD_FILTER_PROTO_TYPE_UDP = 5,
+  HDD_FILTER_PROTO_TYPE_MAX
+} eProtoLayer;
+
+typedef enum
+{
+  HDD_RCV_FILTER_INVALID = 0,
+  HDD_RCV_FILTER_SET = 1,
+  HDD_RCV_FILTER_CLEAR = 2,
+  HDD_RCV_FILTER_MAX
+}eFilterAction;
+
+typedef enum 
+{
+  HDD_FILTER_CMP_TYPE_INVALID = 0,
+  HDD_FILTER_CMP_TYPE_EQUAL = 1,
+  HDD_FILTER_CMP_TYPE_MASK_EQUAL = 2,
+  HDD_FILTER_CMP_TYPE_NOT_EQUAL = 3,
+  HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL = 4,
+  HDD_FILTER_CMP_TYPE_MAX
+}eCompareFlag;
+
+struct PacketFilterParamsCfg
+{
+    v_U8_t              protocolLayer;
+    v_U8_t              cmpFlag;   
+    v_U8_t              dataOffset;
+    v_U8_t              dataLength;
+    v_U8_t              compareData[8];
+    v_U8_t              dataMask[8];
+};
+
+typedef struct
+{
+    v_U8_t            filterAction;    
+    v_U8_t            filterId;
+    v_U8_t            numParams;
+    struct PacketFilterParamsCfg paramsData [HDD_MAX_CMP_PER_PACKET_FILTER];
+}tPacketFilterCfg, *tpPacketFilterCfg;
+
+#endif
+#endif // __WLAN_HDD_PACKET_FILTERING_H__
diff --git a/CORE/HDD/inc/wlan_hdd_power.h b/CORE/HDD/inc/wlan_hdd_power.h
new file mode 100644
index 0000000..82b5008
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_power.h
@@ -0,0 +1,90 @@
+/*
+ * 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 __WLAN_HDD_POWER_H
+#define __WLAN_HDD_POWER_H
+
+/**===========================================================================
+
+  \file  wlan_hdd_power.h
+
+  \brief Linux HDD Power
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+
+  ==========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+ * Include Files
+ *------------------------------------------------------------------------*/
+#include "wlan_hdd_main.h"
+
+/*---------------------------------------------------------------------------
+ *   Preprocessor definitions and constants
+ *-------------------------------------------------------------------------*/
+ //gEnableSuspend = 1 in INI file implies suspend to standby
+ #define WLAN_MAP_SUSPEND_TO_STANDBY     1
+
+ //gEnableSuspend = 2 in INI file implies suspend to deep sleep
+ #define WLAN_MAP_SUSPEND_TO_DEEP_SLEEP  2
+
+ //gEnableSuspend = 3 in INI file implies suspend to set MCAST/BCAST filter 
+ #define WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER  3
+
+ //gEnableDriverStop = 1 implies map driver stop to standby
+ #define WLAN_MAP_DRIVER_STOP_TO_STANDBY     1
+
+ //gEnableDriverStop = 2 implies map sriver stop to deep sleep
+ #define WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP  2
+
+ //Maximum time (ms) to wait for standby to complete
+ #define WLAN_WAIT_TIME_STANDBY          3000
+
+ //Maximum time (ms) to wait for full pwr to complete
+ #define WLAN_WAIT_TIME_FULL_PWR         3000
+
+
+/*---------------------------------------------------------------------------
+ *   Type declarations
+ *-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+ * Function declarations and documentation
+ * ------------------------------------------------------------------------*/
+ eHalStatus hdd_exit_standby(hdd_context_t *pHddCtx);
+ VOS_STATUS hdd_exit_deep_sleep(hdd_context_t *pHddCtx, 
+                                hdd_adapter_t* pAdapter);
+ VOS_STATUS hdd_enter_standby(hdd_context_t *pHddCtx);
+ VOS_STATUS hdd_enter_deep_sleep(hdd_context_t *pHddCtx, 
+                                hdd_adapter_t* pAdapter);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ VOS_STATUS hdd_wlan_reset(void);
+ VOS_STATUS hdd_wlan_reset_initialization(void) ;
+#endif
+ /* SSR shutdown & re-init functions */
+ VOS_STATUS hdd_wlan_shutdown(void);
+ VOS_STATUS hdd_wlan_re_init(void);
+
+void hdd_conf_mcastbcast_filter(hdd_context_t* pHddCtx, v_BOOL_t setfilter);
+VOS_STATUS hdd_conf_hostarpoffload(hdd_context_t* pHddCtx, v_BOOL_t fenable);
+#endif // if !defined __WLAN_QCT_DRIVER_H
diff --git a/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h b/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
new file mode 100644
index 0000000..4f566d9
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
@@ -0,0 +1,302 @@
+/*
+ * 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_HDD_SOFTAP_TX_RX_H )
+#define WLAN_HDD_SOFTAP_TX_RX_H
+
+/**===========================================================================
+  
+  \file  wlan_hdd_softap_tx_rx.h
+  
+  \brief Linux HDD SOFTAP Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+#include <wlan_hdd_hostapd.h>
+
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/ 
+#define HDD_SOFTAP_TX_BK_QUEUE_MAX_LEN (82*2)
+#define HDD_SOFTAP_TX_BE_QUEUE_MAX_LEN (78*2)
+#define HDD_SOFTAP_TX_VI_QUEUE_MAX_LEN (74*2)
+#define HDD_SOFTAP_TX_VO_QUEUE_MAX_LEN (70*2)
+
+/* SoftAP specific AC Weights */
+#define HDD_SOFTAP_BK_WEIGHT_DEFAULT                        1
+#define HDD_SOFTAP_BE_WEIGHT_DEFAULT                        3
+#define HDD_SOFTAP_VI_WEIGHT_DEFAULT                        8
+#define HDD_SOFTAP_VO_WEIGHT_DEFAULT                        18
+
+/*--------------------------------------------------------------------------- 
+  Type declarations
+  -------------------------------------------------------------------------*/ 
+ 
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+
+/**============================================================================
+  @brief hdd_softap_hard_start_xmit() - Function registered with the Linux OS for 
+  transmitting packets
+
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param dev      : [in] pointer to Libra softap network device
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+extern int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
+
+/**============================================================================
+  @brief hdd_softap_tx_timeout() - Function called by OS if there is any
+  timeout during transmission. Since HDD simply enqueues packet
+  and returns control to OS right away, this would never be invoked
+
+  @param dev : [in] pointer to Libra network device
+  @return    : None
+  ===========================================================================*/
+extern void hdd_softap_tx_timeout(struct net_device *dev);
+
+/**============================================================================
+  @brief hdd_softap_stats() - Function registered with the Linux OS for 
+  device TX/RX statistics
+
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : pointer to net_device_stats structure
+  ===========================================================================*/
+extern struct net_device_stats* hdd_softap_stats(struct net_device *dev);
+
+/**============================================================================
+  @brief hdd_softap_init_tx_rx() - Init function to initialize Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_init_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_softap_deinit_tx_rx() - Deinit function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_deinit_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_softap_init_tx_rx_sta() - Init function to initialize a station in Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deinit
+  @param pmacAddrSTA  : [in] pointer to the MAC address of the station  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA);
+
+/**============================================================================
+  @brief hdd_softap_deinit_tx_rx_sta() - Deinit function to clean up a statioin in Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deinit 
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId );
+
+/**============================================================================
+  @brief hdd_disconnect_tx_rx() - Disconnect function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_disconnect_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_tx_complete_cbk() - Callback function invoked by TL
+  to indicate that a packet has been transmitted across the SDIO bus
+  succesfully. OS packet resources can be released after this cbk.
+
+  @param vosContext   : [in] pointer to VOS context   
+  @param pVosPacket   : [in] pointer to VOS packet (containing skb) 
+  @param vosStatusIn  : [in] status of the transmission 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_tx_complete_cbk( v_VOID_t *vosContext, 
+                                       vos_pkt_t *pVosPacket, 
+                                       VOS_STATUS vosStatusIn );
+
+/**============================================================================
+  @brief hdd_softap_tx_fetch_packet_cbk() - Callback function invoked by TL to 
+  fetch a packet for transmission.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param staId        : [in] Station for which TL is requesting a pkt
+  @param ucAC         : [in] pointer to access category requested by TL
+  @param pVosPacket   : [out] pointer to VOS packet packet pointer
+  @param pPktMetaInfo : [out] pointer to meta info for the pkt 
+  
+  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
+                      : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_tx_fetch_packet_cbk( v_VOID_t *vosContext,
+                                           v_U8_t *pStaId,
+                                           WLANTL_ACEnumType    ucAC,
+                                           vos_pkt_t **ppVosPacket,
+                                           WLANTL_MetaInfoType *pPktMetaInfo );
+
+/**============================================================================
+  @brief hdd_softap_tx_low_resource_cbk() - Callback function invoked in the 
+  case where VOS packets are not available at the time of the call to get 
+  packets. This callback function is invoked by VOS when packets are 
+  available.
+
+  @param pVosPacket : [in]  pointer to VOS packet 
+  @param userData   : [in]  opaque user data that was passed initially 
+  
+  @return           : VOS_STATUS_E_FAILURE if any errors encountered, 
+                    : VOS_STATUS_SUCCESS otherwise
+  =============================================================================*/
+extern VOS_STATUS hdd_softap_tx_low_resource_cbk( vos_pkt_t *pVosPacket, 
+                                           v_VOID_t *userData );
+
+/**============================================================================
+  @brief hdd_softap_rx_packet_cbk() - Receive callback registered with TL.
+  TL will call this to notify the HDD when a packet was received 
+  for a registered STA.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param pVosPacket   : [in] pointer to VOS packet (conatining sk_buff) 
+  @param staId        : [in] Station Id
+  @param pRxMetaInfo  : [in] pointer to meta info for the received pkt(s) 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered, 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_rx_packet_cbk( v_VOID_t *vosContext, 
+                                     vos_pkt_t *pVosPacket, 
+                                     v_U8_t staId,
+                                     WLANTL_RxMetaInfoType* pRxMetaInfo );
+
+/**============================================================================
+  @brief hdd_softap_DeregisterSTA - Deregister a station from TL block
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deregister
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_softap_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId );
+
+/**============================================================================
+  @brief hdd_softap_RegisterSTA - Register a station into TL block
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deregister
+  @param fAuthRequired: [in] Station requires further security negotiation or not
+  @param fPrivacyBit  : [in] privacy bit needs to be set or not
+  @param ucastSig  : [in] Unicast Signature send to TL
+  @param bcastSig  : [in] Broadcast Signature send to TL
+  @param pPeerMacAddress  : [in] station MAC address
+  @param fWmmEnabled  : [in] Wmm enabled sta or not
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_RegisterSTA( hdd_adapter_t *pAdapter,
+                                       v_BOOL_t fAuthRequired,
+                                       v_BOOL_t fPrivacyBit,    
+                                       v_U8_t staId,
+                                       v_U8_t ucastSig,
+                                       v_U8_t bcastSig,
+                                       v_MACADDR_t *pPeerMacAddress,
+                                       v_BOOL_t fWmmEnabled);
+
+/**============================================================================
+  @brief hdd_softap_Register_BC_STA - Register a default broadcast station into TL block
+
+  @param pAdapter : [in] pointer to adapter context
+  @param fPrivacyBit : [in] privacy bit needs to be set or not
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_Register_BC_STA( hdd_adapter_t *pAdapter, v_BOOL_t fPrivacyBit);
+
+/**============================================================================
+  @brief hdd_softap_DeregisterSTA - DeRegister the default broadcast station into TL block
+
+  @param pAdapter : [in] pointer to adapter context
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_Deregister_BC_STA( hdd_adapter_t *pAdapter);
+
+/**============================================================================
+  @brief hdd_softap_stop_bss - Helper function to stop bss and do cleanup in HDD and TL
+
+  @param pAdapter : [in] pointer to adapter context
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_stop_bss( hdd_adapter_t *pHostapdAdapter);
+
+
+/**============================================================================
+  @brief hdd_softap_change_STA_state - Helper function to change station state by MAC address
+
+  @param pAdapter : [in] pointer to adapter context
+  @param pDestMacAddress : [in] pointer to station MAC address
+  @param state    : [in] new station state
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_change_STA_state( hdd_adapter_t *pAdapter, v_MACADDR_t *pDestMacAddress, WLANTL_STAStateType state);
+
+/**============================================================================
+  @brief hdd_softap_GetStaId - Helper function to get station Id from MAC address
+
+  @param pAdapter : [in] pointer to adapter context
+  @param pDestMacAddress : [in] pointer to station MAC address
+  @param staId    : [out] station id
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  =========================================================================== */
+extern VOS_STATUS hdd_softap_GetStaId( hdd_adapter_t *pAdapter, v_MACADDR_t *pMacAddress, v_U8_t *staId);
+
+#endif    // end #if !defined( WLAN_HDD_SOFTAP_TX_RX_H )
diff --git a/CORE/HDD/inc/wlan_hdd_tx_rx.h b/CORE/HDD/inc/wlan_hdd_tx_rx.h
new file mode 100644
index 0000000..d8bf1cd
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_tx_rx.h
@@ -0,0 +1,238 @@
+/*
+ * 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_HDD_TX_RX_H )
+#define WLAN_HDD_TX_RX_H
+
+/**===========================================================================
+  
+  \file  wlan_hdd_tx_rx.h
+  
+  \brief Linux HDD Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+#include <wlan_hdd_includes.h>
+#include <vos_api.h>
+#include <linux/skbuff.h>
+#include <wlan_qct_tl.h>
+
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/ 
+#define HDD_ETHERTYPE_802_1_X              ( 0x888E )
+#define HDD_ETHERTYPE_802_1_X_FRAME_OFFSET ( 12 )
+#define HDD_ETHERTYPE_802_1_X_SIZE         ( 2 )
+#ifdef FEATURE_WLAN_WAPI
+#define HDD_ETHERTYPE_WAI                  ( 0x88b4 )
+#endif
+
+#define HDD_80211_HEADER_LEN      24
+#define HDD_80211_HEADER_QOS_CTL  2
+#define HDD_LLC_HDR_LEN           6
+#define HDD_FRAME_TYPE_MASK       0x0c 
+#define HDD_FRAME_SUBTYPE_MASK    0xf0 
+#define HDD_FRAME_TYPE_DATA       0x08
+#define HDD_FRAME_TYPE_MGMT       0x00
+#define HDD_FRAME_SUBTYPE_QOSDATA 0x80
+#define HDD_FRAME_SUBTYPE_DEAUTH  0xC0
+#define HDD_FRAME_SUBTYPE_DISASSOC 0xA0
+#define HDD_DEST_ADDR_OFFSET      6
+
+#define HDD_MAC_HDR_SIZE          6
+/*--------------------------------------------------------------------------- 
+  Type declarations
+  -------------------------------------------------------------------------*/ 
+ 
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/ 
+
+/**============================================================================
+  @brief hdd_hard_start_xmit() - Function registered with the Linux OS for 
+  transmitting packets
+
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+extern int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
+
+#ifdef CONFIG_CFG80211   
+extern int hdd_mon_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
+#endif
+/**============================================================================
+  @brief hdd_tx_timeout() - Function called by OS if there is any
+  timeout during transmission. Since HDD simply enqueues packet
+  and returns control to OS right away, this would never be invoked
+
+  @param dev : [in] pointer to Libra network device
+  @return    : None
+  ===========================================================================*/
+extern void hdd_tx_timeout(struct net_device *dev);
+
+/**============================================================================
+  @brief hdd_stats() - Function registered with the Linux OS for 
+  device TX/RX statistics
+
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : pointer to net_device_stats structure
+  ===========================================================================*/
+extern struct net_device_stats* hdd_stats(struct net_device *dev);
+
+/**============================================================================
+  @brief hdd_init_tx_rx() - Init function to initialize Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_init_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_deinit_tx_rx() - Deinit function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_deinit_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_disconnect_tx_rx() - Disconnect function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_disconnect_tx_rx( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_tx_complete_cbk() - Callback function invoked by TL
+  to indicate that a packet has been transmitted across the SDIO bus
+  succesfully. OS packet resources can be released after this cbk.
+
+  @param vosContext   : [in] pointer to VOS context   
+  @param pVosPacket   : [in] pointer to VOS packet (containing skb) 
+  @param vosStatusIn  : [in] status of the transmission 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_tx_complete_cbk( v_VOID_t *vosContext, 
+                                       vos_pkt_t *pVosPacket, 
+                                       VOS_STATUS vosStatusIn );
+
+/**============================================================================
+  @brief hdd_tx_fetch_packet_cbk() - Callback function invoked by TL to 
+  fetch a packet for transmission.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param staId        : [in] Station for which TL is requesting a pkt
+  @param ucAC         : [in] pointer to access category requested by TL
+  @param pVosPacket   : [out] pointer to VOS packet packet pointer
+  @param pPktMetaInfo : [out] pointer to meta info for the pkt 
+  
+  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
+                      : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_tx_fetch_packet_cbk( v_VOID_t *vosContext,
+                                           v_U8_t *pStaId,
+                                           WLANTL_ACEnumType    ucAC,
+                                           vos_pkt_t **ppVosPacket,
+                                           WLANTL_MetaInfoType *pPktMetaInfo );
+
+/**============================================================================
+  @brief hdd_tx_low_resource_cbk() - Callback function invoked in the 
+  case where VOS packets are not available at the time of the call to get 
+  packets. This callback function is invoked by VOS when packets are 
+  available.
+
+  @param pVosPacket : [in]  pointer to VOS packet 
+  @param userData   : [in]  opaque user data that was passed initially 
+  
+  @return           : VOS_STATUS_E_FAILURE if any errors encountered, 
+                    : VOS_STATUS_SUCCESS otherwise
+  =============================================================================*/
+extern VOS_STATUS hdd_tx_low_resource_cbk( vos_pkt_t *pVosPacket, 
+                                           v_VOID_t *userData );
+
+/**============================================================================
+  @brief hdd_rx_packet_cbk() - Receive callback registered with TL.
+  TL will call this to notify the HDD when a packet was received 
+  for a registered STA.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param pVosPacket   : [in] pointer to VOS packet (conatining sk_buff) 
+  @param staId        : [in] Station Id
+  @param pRxMetaInfo  : [in] pointer to meta info for the received pkt(s) 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered, 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+extern VOS_STATUS hdd_rx_packet_cbk( v_VOID_t *vosContext, 
+                                     vos_pkt_t *pVosPacket, 
+                                     v_U8_t staId,
+                                     WLANTL_RxMetaInfoType* pRxMetaInfo );
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/**============================================================================
+  @brief hdd_IsEAPOLPacket() - Checks the packet is EAPOL or not.
+
+  @param pVosPacket : [in] pointer to vos packet  
+  @return         : VOS_TRUE if the packet is EAPOL 
+                  : VOS_FALSE otherwise
+  ===========================================================================*/
+extern v_BOOL_t hdd_IsEAPOLPacket( vos_pkt_t *pVosPacket );
+#endif
+
+#ifdef CONFIG_CFG80211
+/**============================================================================
+  @brief hdd_mon_tx_mgmt_pkt() - Transmit MGMT packet received on monitor 
+                                 interface.
+
+  @param pAdapter: [in] SAP/P2P GO adaptor. 
+  ===========================================================================*/
+void hdd_mon_tx_mgmt_pkt(hdd_adapter_t* pAdapter);
+
+/**============================================================================
+  @brief hdd_mon_tx_work_queue() - workqueue handler for transmitting mgmt packets..
+
+  @param work: [in] workqueue structure.
+  ===========================================================================*/
+void hdd_mon_tx_work_queue(struct work_struct *work);
+#endif
+
+#endif    // end #if !defined( WLAN_HDD_TX_RX_H )
diff --git a/CORE/HDD/inc/wlan_hdd_version.h b/CORE/HDD/inc/wlan_hdd_version.h
new file mode 100644
index 0000000..dca987f
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_version.h
@@ -0,0 +1,91 @@
+/*
+ * 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:         hdd_Version.h
+//
+//  Description:  Miniport driver version information
+//
+//  Author:       Larry Cawley
+// 
+//  Copyright 2007, QUALCOMM, Inc.  All rights reserved.
+//
+//===================================================================
+#if !defined( __hddVersion_h__ )
+#define __hddVersion_h__
+
+// force string expansion from chars                               
+#define strEXPAND(x) #x
+#define strSTRING(x) strEXPAND(x)
+#define strVERSION( _mj, _mn, _sfx, _build ) strSTRING(_mj) "." strSTRING(_mn) "." strSTRING(_sfx) "." strSTRING(_build)
+
+
+#if defined( BLD_REL )
+#define HDD_DRIVER_MAJOR_VERSION BLD_REL
+#else 
+#define HDD_DRIVER_MAJOR_VERSION             0   
+#endif
+
+#if defined( BLD_VER )
+#define HDD_DRIVER_MINOR_VERSION BLD_VER
+#else 
+#define HDD_DRIVER_MINOR_VERSION             0
+#endif
+
+#if defined( BLD_SFX )
+#define HDD_DRIVER_SUFFIX BLD_SFX 
+#else
+#define HDD_DRIVER_SUFFIX                    0
+#endif 
+
+#if defined( BLD_NUM )
+#define HDD_DRIVER_BUILD BLD_NUM
+#else 
+#define HDD_DRIVER_BUILD                     0000  
+#endif 
+#define HDD_BUILD_DATETIME __DATE__ " " __TIME__  
+
+#define HDD_DRIVER_VERSION WNI_DRIVER_MAJOR_VERSION,WNI_DRIVER_MINOR_VERSION
+
+#define HDD_DRIVER_VERSION_STR strVERSION( WNI_DRIVER_MAJOR_VERSION, WNI_DRIVER_MINOR_VERSION, WNI_DRIVER_SUFFIX, WNI_DRIVER_BUILD )
+                                            
+#define HDD_COMPANYNAME_FULL        "QUALCOMM, Inc."
+#define HDD_DRIVER_DESCRIPTION      "QUALCOMM Gen6 802.11n Wireless Adapter"
+#define OEM_FILEDESCRIPTION_STR     ANI_DRIVER_DESCRIPTION 
+                        
+#define OEM_COMPANYNAME_STR         ANI_COMPANYNAME_FULL 
+
+#define OEM_INTERNALNAME_STR        "WLAN_QCT_DRV.dll"
+#define OEM_INTERNALNAME_STR2       "WLAN_QCT_DRV.dll"
+#define OEM_ORIGINALFILENAME_STR    "WLAN_QCT_DRV.dll"
+
+#define OEM_LEGALCOPYRIGHT_YEARS    "2008"
+#define OEM_LEGALCOPYRIGHT_STR      "Copyright \251 " OEM_COMPANYNAME_STR "," OEM_LEGALCOPYRIGHT_YEARS
+#define OEM_PRODUCTNAME_STR         HDD_DRIVER_DESCRIPTION
+
+#define OEM_PRODUCTVERSION          HDD_DRIVER_VERSION
+#define OEM_FILEVERSION_STR         HDD_DRIVER_VERSION_STR
+#define OEM_FILEVERSION             HDD_DRIVER_MAJOR_VERSION,HDD_DRIVER_MINOR_VERSION,HDD_DRIVER_SUFFIX,HDD_DRIVER_BUILD
+#define OEM_PRODUCTVERSION_STR      HDD_DRIVER_VERSION_STR
+
+
+#endif  // __hddVersion_h__
diff --git a/CORE/HDD/inc/wlan_hdd_wext.h b/CORE/HDD/inc/wlan_hdd_wext.h
new file mode 100644
index 0000000..1c1399a
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_wext.h
@@ -0,0 +1,382 @@
+/*
+ * 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 __WEXT_IW_H__
+#define __WEXT_IW_H__
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
+#include <linux/timer.h>
+#include "vos_event.h"
+
+/*
+ * order of parameters in addTs private ioctl
+ */
+#define HDD_WLAN_WMM_PARAM_HANDLE                       0
+#define HDD_WLAN_WMM_PARAM_TID                          1
+#define HDD_WLAN_WMM_PARAM_DIRECTION                    2
+#define HDD_WLAN_WMM_PARAM_USER_PRIORITY                3
+#define HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE            4
+#define HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE            5
+#define HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE            6
+#define HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE               7
+#define HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE               8
+#define HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE               9
+#define HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE            10
+#define HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE 11
+#define HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL            12
+#define HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL         13
+#define HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN             14
+#define HDD_WLAN_WMM_PARAM_ACK_POLICY                  15
+#define HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL         16
+#define HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL        17
+#define HDD_WLAN_WMM_PARAM_COUNT                       18
+
+typedef enum
+{
+   HDD_WLAN_WMM_DIRECTION_UPSTREAM      = 0,
+   HDD_WLAN_WMM_DIRECTION_DOWNSTREAM    = 1,
+   HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL = 2,
+} hdd_wlan_wmm_direction_e;
+
+typedef enum
+{
+   HDD_WLAN_WMM_POWER_SAVE_LEGACY       = 0,
+   HDD_WLAN_WMM_POWER_SAVE_UAPSD        = 1,
+} hdd_wlan_wmm_power_save_e;
+
+typedef enum
+{
+   // TSPEC/re-assoc done, async
+   HDD_WLAN_WMM_STATUS_SETUP_SUCCESS = 0,
+   // no need to setup TSPEC since ACM=0 and no UAPSD desired, sync + async
+   HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD = 1,
+   // no need to setup TSPEC since ACM=0 and UAPSD already exists, sync + async
+   HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING = 2,
+   // TSPEC result pending, sync
+   HDD_WLAN_WMM_STATUS_SETUP_PENDING = 3,
+   // TSPEC/re-assoc failed, sync + async
+   HDD_WLAN_WMM_STATUS_SETUP_FAILED = 4,
+   // Request rejected due to invalid params, sync + async
+   HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM = 5,
+   // TSPEC request rejected since AP!=QAP, sync
+   HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM = 6,
+
+   // TSPEC modification/re-assoc successful, async
+   HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS = 7,
+   // TSPEC modification a no-op since ACM=0 and no change in UAPSD, sync + async
+   HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD = 8,
+   // TSPEC modification a no-op since ACM=0 and requested U-APSD already exists, sync + async
+   HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING = 9,
+   // TSPEC result pending, sync
+   HDD_WLAN_WMM_STATUS_MODIFY_PENDING = 10,
+   // TSPEC modification failed, prev TSPEC in effect, sync + async
+   HDD_WLAN_WMM_STATUS_MODIFY_FAILED = 11,
+   // TSPEC modification request rejected due to invalid params, sync + async
+   HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM = 12,
+
+   // TSPEC release successful, sync and also async
+   HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS = 13,
+   // TSPEC release pending, sync
+   HDD_WLAN_WMM_STATUS_RELEASE_PENDING = 14,
+   // TSPEC release failed, sync + async
+   HDD_WLAN_WMM_STATUS_RELEASE_FAILED = 15,
+   // TSPEC release rejected due to invalid params, sync
+   HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM = 16,
+   // TSPEC modified due to the mux'ing of requests on ACs, async
+
+   HDD_WLAN_WMM_STATUS_MODIFIED = 17,
+   // TSPEC revoked by AP, async
+   HDD_WLAN_WMM_STATUS_LOST = 18,
+   // some internal failure like memory allocation failure, etc, sync
+   HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE = 19, 
+
+   // U-APSD failed during setup but OTA setup (whether TSPEC exchnage or
+   // re-assoc) was done so app should release this QoS, async
+   HDD_WLAN_WMM_STATUS_SETUP_UAPSD_SET_FAILED = 20,
+   // U-APSD failed during modify, but OTA setup (whether TSPEC exchnage or
+   // re-assoc) was done so app should release this QoS, async
+   HDD_WLAN_WMM_STATUS_MODIFY_UAPSD_SET_FAILED = 21
+
+} hdd_wlan_wmm_status_e;
+
+/** TS Info Ack Policy */
+typedef enum
+{
+   HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK      = 0,
+   HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK    = 1,
+} hdd_wlan_wmm_ts_info_ack_policy_e;
+
+/** vendor element ID */
+#define IE_EID_VENDOR        ( 221 ) /* 0xDD */
+#define IE_LEN_SIZE          1
+#define IE_EID_SIZE          1
+#define IE_VENDOR_OUI_SIZE   4
+
+/** Maximum Length of WPA/RSN IE */
+#define MAX_WPA_RSN_IE_LEN 40
+
+/** Maximum Number of WEP KEYS */
+#define MAX_WEP_KEYS 4
+
+/** Ether Address Length */
+#define ETHER_ADDR_LEN 6
+
+/** Enable 11d */
+#define ENABLE_11D  1
+
+/** Disable 11d */
+#define DISABLE_11D 0
+
+/* 
+   refer wpa.h in wpa supplicant code for REASON_MICHAEL_MIC_FAILURE
+
+   supplicant sets REASON_MICHAEL_MIC_FAILURE as the reason code when it sends the MLME deauth IOCTL 
+   for TKIP counter measures
+*/
+#define HDD_REASON_MICHAEL_MIC_FAILURE 14
+
+/* 
+  * These are for TLV fields in WPS IE
+  */
+#define HDD_WPS_UUID_LEN                    16 
+#define HDD_WPS_ELEM_VERSION                0x104a 
+#define HDD_WPS_ELEM_REQUEST_TYPE           0x103a 
+#define HDD_WPS_ELEM_CONFIG_METHODS         0x1008 
+#define HDD_WPS_ELEM_UUID_E                 0x1047 
+#define HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE    0x1054 
+#define HDD_WPS_ELEM_RF_BANDS               0x103c 
+#define HDD_WPS_ELEM_ASSOCIATION_STATE      0x1002 
+#define HDD_WPS_ELEM_CONFIGURATION_ERROR    0x1009
+#define HDD_WPS_ELEM_DEVICE_PASSWORD_ID     0x1012 
+
+#define HDD_WPA_ELEM_VENDOR_EXTENSION       0x1049
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define HDD_WPS_MANUFACTURER_LEN            64
+#define HDD_WPS_MODEL_NAME_LEN              32
+#define HDD_WPS_MODEL_NUM_LEN               32
+#define HDD_WPS_SERIAL_NUM_LEN              32
+#define HDD_WPS_DEVICE_OUI_LEN               4
+#define HDD_WPS_DEVICE_NAME_LEN             32
+
+#define HDD_WPS_ELEM_WPS_STATE              0x1044
+#define HDD_WPS_ELEM_APSETUPLOCK            0x1057
+#define HDD_WPS_ELEM_SELECTEDREGISTRA       0x1041  
+#define HDD_WPS_ELEM_RSP_TYPE               0x103B
+#define HDD_WPS_ELEM_MANUFACTURER           0x1021
+#define HDD_WPS_ELEM_MODEL_NAME             0x1023
+#define HDD_WPS_ELEM_MODEL_NUM              0x1024
+#define HDD_WPS_ELEM_SERIAL_NUM             0x1042 
+#define HDD_WPS_ELEM_DEVICE_NAME            0x1011
+#define HDD_WPS_ELEM_REGISTRA_CONF_METHODS  0x1053
+#endif
+
+
+ 
+#define WPS_OUI_TYPE   "\x00\x50\xf2\x04"
+#define WPS_OUI_TYPE_SIZE  4
+ 
+#ifdef WLAN_FEATURE_P2P
+#define P2P_OUI_TYPE   "\x50\x6f\x9a\x09"
+#define P2P_OUI_TYPE_SIZE  4
+#endif
+
+
+#ifdef WLAN_FEATURE_WFD
+#define WFD_OUI_TYPE   "\x50\x6f\x9a\x0a"
+#define WFD_OUI_TYPE_SIZE  4
+#endif
+
+typedef enum
+{
+    eWEXT_WPS_OFF = 0,
+    eWEXT_WPS_ON = 1,
+}hdd_wps_mode_e;
+
+typedef enum
+{
+    DRIVER_POWER_MODE_AUTO = 0,
+    DRIVER_POWER_MODE_ACTIVE = 1,
+} hdd_power_mode_e;
+
+typedef enum
+{
+    WEXT_SCAN_PENDING_GIVEUP = 0,
+    WEXT_SCAN_PENDING_PIGGYBACK = 1,
+    WEXT_SCAN_PENDING_DELAY = 2,
+    WEXT_SCAN_PENDING_MAX
+} hdd_scan_pending_option_e;
+
+/* 
+ * This structure contains the interface level (granularity) 
+ * configuration information in support of wireless extensions. 
+ */
+typedef struct hdd_wext_state_s 
+{
+   /** The CSR "desired" Profile */
+   tCsrRoamProfile roamProfile; 
+
+   /** BSSID to which connect request is received */
+   tCsrBssid req_bssId;
+
+   /** The association status code */ 
+   v_U32_t statusCode;
+
+   /** wpa version WPA/WPA2/None*/
+   v_S31_t wpaVersion; 
+   
+   /**WPA or RSN IE*/
+   u_int8_t WPARSNIE[MAX_WPA_RSN_IE_LEN]; 
+
+   /**gen IE */
+   tSirAddie genIE;
+
+   /**Additional IE for assoc */
+   tSirAddie assocAddIE; 
+   
+   /**auth key mgmt */
+   v_S31_t authKeyMgmt; 
+
+    /**vos event */
+   vos_event_t  vosevent;
+
+   vos_event_t  scanevent;
+
+   /**Counter measure state, Started/Stopped*/
+   v_BOOL_t mTKIPCounterMeasures;  
+
+   /**Completion Variable*/
+   struct completion completion_var;
+
+#ifdef FEATURE_WLAN_CCX
+   /* CCX state variables */
+   v_BOOL_t isCCXConnection;
+   eCsrAuthType collectedAuthType; /* Collected from ALL SIOCSIWAUTH Ioctls. Will be negotiatedAuthType - in tCsrProfile */
+#endif
+}hdd_wext_state_t;
+
+typedef struct ccp_freq_chan_map_s{
+    // List of frequencies
+    v_U32_t freq;
+    v_U32_t chan;
+}hdd_freq_chan_map_t;
+
+#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
+    wlan_hdd_get_vendor_oui_ie_ptr(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, ie, ie_len)
+
+#ifdef WLAN_FEATURE_P2P
+#define wlan_hdd_get_p2p_ie_ptr(ie, ie_len) \
+    wlan_hdd_get_vendor_oui_ie_ptr(P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE, ie, ie_len)
+#endif
+
+#ifdef WLAN_FEATURE_WFD
+#define wlan_hdd_get_wfd_ie_ptr(ie, ie_len) \
+    wlan_hdd_get_vendor_oui_ie_ptr(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, ie, ie_len)
+#endif
+
+extern int hdd_UnregisterWext(struct net_device *dev);
+extern int hdd_register_wext(struct net_device *dev);
+extern int hdd_wlan_get_freq(v_U32_t chan,v_U32_t *freq);
+extern int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter,
+                                      union iwreq_data *wrqu);
+extern int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter,
+                                      union iwreq_data *wrqu);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+extern int hdd_wlan_get_version(hdd_adapter_t *pAdapter,
+                                union iwreq_data *wrqu, char *extra);
+#endif
+
+extern int iw_get_scan(struct net_device *dev, 
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra);
+
+extern int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra);
+
+extern int iw_set_cscan(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra);
+
+extern int iw_set_essid(struct net_device *dev, 
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra);
+
+extern int iw_get_essid(struct net_device *dev, 
+                       struct iw_request_info *info,
+                       struct iw_point *dwrq, char *extra);
+
+
+extern int iw_set_ap_address(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra);
+
+extern int iw_get_ap_address(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra);
+
+extern int iw_set_auth(struct net_device *dev,struct iw_request_info *info,
+                       union iwreq_data *wrqu,char *extra);
+
+extern int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
+                       union iwreq_data *wrqu,char *extra);
+
+VOS_STATUS iw_set_pno(struct net_device *dev, struct iw_request_info *info,
+                      union iwreq_data *wrqu, char *extra, int nOffset);
+
+
+VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info,
+                              union iwreq_data *wrqu, char *extra, int nOffset);
+
+VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info,
+                      union iwreq_data *wrqu, char *extra, int nOffset);
+
+void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result);
+
+extern int iw_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra);
+
+extern int iw_set_three_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra);
+
+void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter);
+void hdd_GetClassA_statisticsCB(void *pStats, void *pContext);
+
+VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter);
+
+v_U8_t* wlan_hdd_get_vendor_oui_ie_ptr(v_U8_t *oui, v_U8_t oui_size, 
+                       v_U8_t *ie, int ie_len);
+
+VOS_STATUS wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode);
+
+VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx,
+                                       hdd_adapter_t *pAdapter);
+
+VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx);
+
+VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter);
+
+VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value);
+
+#endif // __WEXT_IW_H__
+
diff --git a/CORE/HDD/inc/wlan_hdd_wmm.h b/CORE/HDD/inc/wlan_hdd_wmm.h
new file mode 100644
index 0000000..7c27ff7
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_wmm.h
@@ -0,0 +1,388 @@
+/*
+ * 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 _WLAN_HDD_WMM_H
+#define _WLAN_HDD_WMM_H
+/*============================================================================
+  @file wlan_hdd_wmm.h
+
+  This module (wlan_hdd_wmm.h interface + wlan_hdd_wmm.c implementation)
+  houses all the logic for WMM in HDD.
+
+  On the control path, it has the logic to setup QoS, modify QoS and delete
+  QoS (QoS here refers to a TSPEC). The setup QoS comes in two flavors: an
+  explicit application invoked and an internal HDD invoked.  The implicit QoS
+  is for applications that do NOT call the custom QCT WLAN OIDs for QoS but
+  which DO mark their traffic for priortization. It also has logic to start,
+  update and stop the U-APSD trigger frame generation. It also has logic to
+  read WMM related config parameters from the registry.
+
+  On the data path, it has the logic to figure out the WMM AC of an egress
+  packet and when to signal TL to serve a particular AC queue. It also has the
+  logic to retrieve a packet based on WMM priority in response to a fetch from
+  TL.
+
+  The remaining functions are utility functions for information hiding.
+
+
+               Copyright (c) 2008-9 QUALCOMM Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary
+============================================================================*/
+/* $Header$ */
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include <linux/workqueue.h>
+#include <linux/list.h>
+#include <wlan_hdd_main.h>
+#include <wlan_hdd_wext.h>
+#include <wlan_qct_tl.h>
+#include <sme_QosApi.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+// #define HDD_WMM_DEBUG 1
+
+#define HDD_WMM_CTX_MAGIC 0x574d4d58    // "WMMX"
+
+#define HDD_WMM_HANDLE_IMPLICIT 0xFFFFFFFF
+
+#define HDD_WLAN_INVALID_STA_ID 0xFF
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+/*! @brief AC/Queue Index values for Linux Qdisc to operate on different traffic.
+*/
+typedef enum
+{
+   HDD_LINUX_AC_VO = 0,
+   HDD_LINUX_AC_VI = 1,
+   HDD_LINUX_AC_BE = 2,
+   HDD_LINUX_AC_BK = 3
+
+} hdd_wmm_linuxac_t;
+ 
+/*! @brief types of classification supported
+*/
+typedef enum
+{
+   HDD_WMM_CLASSIFICATION_DSCP = 0,
+   HDD_WMM_CLASSIFICATION_802_1Q = 1
+
+} hdd_wmm_classification_t;
+
+/*! @brief UAPSD state
+*/
+typedef enum
+{
+   HDD_WMM_NON_UAPSD = 0,
+   HDD_WMM_UAPSD = 1
+
+} hdd_wmm_uapsd_state_t;
+
+
+typedef enum
+{
+   //STA can associate with any AP, & HDD looks at the SME notification after
+   // association to find out if associated with QAP and acts accordingly
+   HDD_WMM_USER_MODE_AUTO = 0,
+   //SME will add the extra logic to make sure STA associates with a QAP only
+   HDD_WMM_USER_MODE_QBSS_ONLY = 1,
+   //SME will not join a QoS AP, unless the phy mode setting says "Auto". In
+   // that case, STA is free to join 11n AP. Although from HDD point of view,
+   // it will not be doing any packet classifications
+   HDD_WMM_USER_MODE_NO_QOS = 2,
+
+} hdd_wmm_user_mode_t;
+
+
+/*! @brief WMM Qos instance control block
+*/
+typedef struct
+{
+   struct list_head             node;
+   v_U32_t                      handle;
+   v_U32_t                      qosFlowId;
+   hdd_adapter_t*               pAdapter;
+   WLANTL_ACEnumType            acType;
+   hdd_wlan_wmm_status_e        lastStatus;
+   struct work_struct           wmmAcSetupImplicitQos;
+   v_U32_t                      magic;
+} hdd_wmm_qos_context_t;
+
+/*! @brief WMM related per-AC state & status info
+*/
+typedef struct
+{
+   // does the AP require access to this AC?
+   v_BOOL_t                     wmmAcAccessRequired;
+
+   // does the worker thread need to acquire access to this AC?
+   v_BOOL_t                     wmmAcAccessNeeded;
+
+   // is implicit QoS negotiation currently taking place?
+   v_BOOL_t                     wmmAcAccessPending;
+
+   // has implicit QoS negotiation already failed?
+   v_BOOL_t                     wmmAcAccessFailed;
+
+   // has implicit QoS negotiation already succeeded?
+   v_BOOL_t                     wmmAcAccessGranted;
+
+   // is access to this AC allowed, either because we are not doing
+   // WMM, we are not doing implicit QoS, implict QoS has completed,
+   // or explicit QoS has completed?
+   v_BOOL_t                     wmmAcAccessAllowed;
+
+   // is the wmmAcTspecInfo valid?
+   v_BOOL_t                     wmmAcTspecValid;
+
+   // are the wmmAcUapsd* fields valid?
+   v_BOOL_t                     wmmAcUapsdInfoValid;
+
+   // current (possibly aggregate) Tspec for this AC
+   sme_QosWmmTspecInfo          wmmAcTspecInfo;
+
+   // current U-APSD parameters
+   v_U32_t                      wmmAcUapsdServiceInterval;
+   v_U32_t                      wmmAcUapsdSuspensionInterval;
+   sme_QosWmmDirType            wmmAcUapsdDirection;
+
+#ifdef FEATURE_WLAN_CCX
+   // Inactivity time parameters for TSPEC
+   v_U32_t                      wmmInactivityTime;
+   v_U32_t                      wmmPrevTrafficCnt;
+   vos_timer_t                  wmmInactivityTimer;
+#endif
+
+} hdd_wmm_ac_status_t;
+
+/*! @brief WMM state & status info
+*/
+typedef struct
+{
+   struct list_head             wmmContextList;
+   struct mutex                 wmmLock;
+   hdd_wmm_ac_status_t          wmmAcStatus[WLANTL_MAX_AC];
+   v_BOOL_t                     wmmQap;
+   v_BOOL_t                     wmmQosConnection;
+} hdd_wmm_status_t;
+
+extern const v_U8_t hdd_QdiscAcToTlAC[];
+extern const v_U8_t hddWmmUpToAcMap[]; 
+extern const v_U8_t hddLinuxUpToAcMap[];
+
+/**============================================================================
+  @brief hdd_wmm_init() - Function which will initialize the WMM configuation
+  and status to an initial state.  The configuration can later be overwritten
+  via application APIs
+
+  @param pHddCtx : [in]  pointer to HDD context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_init ( hdd_context_t* pHddCtx );
+
+/**============================================================================
+  @brief hdd_wmm_adapter_init() - Function which will initialize the WMM configuation
+  and status to an initial state.  The configuration can later be overwritten
+  via application APIs
+
+  @param pAdapter : [in]  pointer to Adapter context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_adapter_init( hdd_adapter_t *pAdapter );
+
+/**============================================================================
+  @brief hdd_wmm_adapter_close() - Function which will perform any necessary work to
+  to clean up the WMM functionality prior to the kernel module unload
+
+  @param pAdapter : [in]  pointer to adapter context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_adapter_close ( hdd_adapter_t* pAdapter );
+
+/**============================================================================
+  @brief hdd_wmm_select_queue() - Function which will classify an OS packet
+  into linux Qdisc expectation
+
+  @param dev      : [in]  pointer to net_device structure
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+
+  @return         : queue_index/linux AC value.
+  ===========================================================================*/
+v_U16_t hdd_wmm_select_queue(struct net_device * dev, struct sk_buff *skb);
+
+/**============================================================================
+  @brief hdd_hostapd_select_queue() - Function which will classify the packet
+         according to linux qdisc expectation.
+
+
+  @param dev      : [in]  pointer to net_device structure
+  @param skb      : [in]  pointer to os packet
+
+  @return         : Qdisc queue index
+  ===========================================================================*/
+
+v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb);
+
+
+
+/**============================================================================
+  @brief hdd_wmm_classify_pkt() - Function which will classify an OS packet
+  into a WMM AC based on either 802.1Q or DSCP
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param pAcType  : [out] pointer to WMM AC type of OS packet
+
+  @return         : None
+  ===========================================================================*/
+v_VOID_t hdd_wmm_classify_pkt ( hdd_adapter_t* pAdapter,
+                                struct sk_buff *skb,
+                                WLANTL_ACEnumType* pAcType,
+                                sme_QosWmmUpType* pUserPri);
+
+
+/**============================================================================
+  @brief hdd_wmm_acquire_access() - Function which will attempt to acquire
+  admittance for a WMM AC
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param acType   : [in]  WMM AC type of OS packet
+  @param pGranted : [out] pointer to boolean flag when indicates if access
+                          has been granted or not
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_acquire_access( hdd_adapter_t* pAdapter,
+                                   WLANTL_ACEnumType acType,
+                                   v_BOOL_t * pGranted );
+
+/**============================================================================
+  @brief hdd_wmm_assoc() - Function which will handle the housekeeping
+  required by WMM when association takes place
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param pRoamInfo: [in]  pointer to roam information
+  @param eBssType : [in]  type of BSS
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_assoc( hdd_adapter_t* pAdapter,
+                          tCsrRoamInfo *pRoamInfo,
+                          eCsrRoamBssType eBssType );
+
+/**============================================================================
+  @brief hdd_wmm_connect() - Function which will handle the housekeeping
+  required by WMM when a connection is established
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param pRoamInfo: [in]  pointer to roam information
+  @param eBssType : [in]  type of BSS
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_connect( hdd_adapter_t* pAdapter,
+                            tCsrRoamInfo *pRoamInfo,
+                            eCsrRoamBssType eBssType );
+
+/**============================================================================
+  @brief hdd_wmm_get_uapsd_mask() - Function which will calculate the
+  initial value of the UAPSD mask based upon the device configuration
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param pUapsdMask: [in]  pointer to where the UAPSD Mask is to be stored
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_get_uapsd_mask( hdd_adapter_t* pAdapter,
+                                   tANI_U8 *pUapsdMask );
+
+/**============================================================================
+  @brief hdd_wmm_is_active() - Function which will determine if WMM is
+  active on the current connection
+
+  @param pAdapter  : [in]  pointer to adapter context
+
+  @return         : VOS_TRUE if WMM is enabled
+                  : VOS_FALSE if WMM is not enabled
+  ===========================================================================*/
+v_BOOL_t hdd_wmm_is_active( hdd_adapter_t* pAdapter );
+
+/**============================================================================
+  @brief hdd_wmm_addts() - Function which will add a traffic spec at the
+  request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+  @param pTspec    : [in]  pointer to the traffic spec
+
+  @return          : HDD_WLAN_WMM_STATUS_* 
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_addts( hdd_adapter_t* pAdapter,
+                                     v_U32_t handle,
+                                     sme_QosWmmTspecInfo* pTspec );
+
+/**============================================================================
+  @brief hdd_wmm_delts() - Function which will delete a traffic spec at the
+  request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+
+  @return          : HDD_WLAN_WMM_STATUS_* 
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_delts( hdd_adapter_t* pAdapter,
+                                     v_U32_t handle );
+
+/**============================================================================
+  @brief hdd_wmm_checkts() - Function which will return the status of a traffic
+  spec at the request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+
+  @return          : HDD_WLAN_WMM_STATUS_* 
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_checkts( hdd_adapter_t* pAdapter,
+                                       v_U32_t handle );
+
+#endif /* #ifndef _WLAN_HDD_WMM_H */
diff --git a/CORE/HDD/inc/wlan_hdd_wowl.h b/CORE/HDD/inc/wlan_hdd_wowl.h
new file mode 100644
index 0000000..8a4ed15
--- /dev/null
+++ b/CORE/HDD/inc/wlan_hdd_wowl.h
@@ -0,0 +1,163 @@
+/*
+ * 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 _WLAN_HDD_WOWL_H
+#define _WLAN_HDD_WOWL_H
+
+/*============================================================================
+  @file wlan_hdd_wowl.h
+
+  This module houses all the logic for WOWL in HDD. 
+  
+  It provides the following APIs
+
+  - Ability to enable/disable following WoWL modes
+    1) Magic packet (MP) mode
+    2) Pattern Byte Matching (PBM) mode
+  - Ability to add/remove patterns for PBM
+
+  A Magic Packet is a packet that contains 6 0xFFs followed by 16 contiguous 
+  copies of the receiving NIC's Ethernet address. There is no API to configure
+  Magic Packet Pattern.
+
+  Wakeup pattern (used for PBM) is defined as following:
+  typedef struct 
+  {
+    U8  PatternSize;                  // Non-Zero pattern size
+    U8  PatternMaskSize;              // Non-zero pattern mask size
+    U8  PatternMask[PatternMaskSize]; // Pattern mask
+    U8  Pattern[PatternSize];         // Pattern
+  } hdd_wowl_ptrn_t;
+
+  PatternSize and PatternMaskSize indicate size of the variable length Pattern
+  and PatternMask. PatternMask indicates which bytes of an incoming packet 
+  should be compared with corresponding bytes in the pattern.
+
+  Maximum allowed pattern size is 128 bytes. Maximum allowed PatternMaskSize 
+  is 16 bytes. 
+
+  Maximum number of patterns that can be configured is 8
+
+  HDD will add following 2 commonly used patterns for PBM by default:
+    1) ARP Broadcast Pattern
+    2) Unicast Pattern
+  
+  However note that WoWL will not be enabled by default by HDD. WoWL needs to 
+  enabled explcitly by exercising the iwpriv command.
+
+  HDD will expose an API that accepts patterns as Hex string in the following
+  format: "PatternSize:PatternMaskSize:PatternMask:Pattern". Mutliple patterns
+  can be specified by deleimiting each pattern with the ';' token.
+  "PatternSize1:PatternMaskSize1:PatternMask1:Pattern1;PatternSize2:...."
+
+  Patterns can be configured dynamically via iwpriv cmd or statically via
+  qcom_cfg.ini file
+
+  PBM (when enabled) can perform filtering on unicast data or broadcast data or
+  both. These configurations are part of factory defaults (cfg.dat) and
+  the deafult behavior is to perform filtering on both unicast and data frames.
+
+  MP filtering (when enabled) is performed ALWAYS on both unicast and broadcast
+  data frames.
+
+  Mangement frames are not subjected to WoWL filtering and are discarded when
+  WoWL is enabled.
+
+  Whenever a patern match succeeds, RX path is restored and packets (both 
+  management and data) will be pushed to the host from that point onwards. 
+  Therefore, exit from WoWL is implicit and happens automatically when the 
+  first packet match succeeds.
+
+  WoWL works on top of BMPS. So when WoWL is requested, SME will attempt to put
+  the device in BMPS mode (if not already in BMPS). If attempt to BMPS fails, 
+  request for WoWL will be rejected.
+
+  Copyright (c) 2009 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
+
+============================================================================*/
+/* $Header$ */
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include <vos_types.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/**============================================================================
+  @brief hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be
+  used when PBM filtering is enabled
+
+  @param ptrn : [in]  pointer to the pattern string to be added
+
+  @return     : FALSE if any errors encountered
+              : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_add_wowl_ptrn (const char * ptrn);
+
+/**============================================================================
+  @brief hdd_del_wowl_ptrn() - Function which will remove a WoWL pattern
+
+  @param ptrn : [in]  pointer to the pattern string to be removed
+
+  @return     : FALSE if any errors encountered
+              : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_del_wowl_ptrn (const char * ptrn);
+
+/**============================================================================
+  @brief hdd_enter_wowl() - Function which will enable WoWL. Atleast one
+  of MP and PBM must be enabled
+
+  @param enable_mp  : [in] Whether to enable magic packet WoWL mode
+  @param enable_pbm : [in] Whether to enable pattern byte matching WoWL mode
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_enter_wowl (hdd_adapter_t *pAdapter, v_BOOL_t enable_mp, v_BOOL_t enable_pbm);
+
+/**============================================================================
+  @brief hdd_exit_wowl() - Function which will disable WoWL
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_exit_wowl (void);
+
+/**============================================================================
+  @brief hdd_init_wowl() - Init function which will initialize the WoWL module
+  and perform any required intial configuration 
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_init_wowl (void* pAdapter);
+
+#endif /* #ifndef _WLAN_HDD_WOWL_H */
diff --git a/CORE/HDD/inc/wlan_qct_driver.h b/CORE/HDD/inc/wlan_qct_driver.h
new file mode 100644
index 0000000..aaca28f
--- /dev/null
+++ b/CORE/HDD/inc/wlan_qct_driver.h
@@ -0,0 +1,78 @@
+/*
+ * 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_QCT_DRIVER_H )
+#define __WLAN_QCT_DRIVER_H
+
+/**========================================================================
+  
+  \file  wlan_qct_driver.h
+  
+  \brief Header file for Wireless LAN Host Device Driver Kernel Module
+               
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  04/05/09    kanand     Created module. 
+
+  ===========================================================================*/
+
+/*--------------------------------------------------------------------------
+ * Include Files
+ *------------------------------------------------------------------------*/
+#include <linux/module.h>
+#include <linux/kobject.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/fs.h>
+#include <linux/cdev.h>
+#include <linux/time.h>
+
+/*--------------------------------------------------------------------------- 
+ *   Preprocessor definitions and constants
+ *-------------------------------------------------------------------------*/ 
+
+/*--------------------------------------------------------------------------- 
+ *   Type declarations
+ *-------------------------------------------------------------------------*/ 
+
+/*------------------------------------------------------------------------- 
+ * Function declarations and documentation
+ * ------------------------------------------------------------------------*/
+                                                 
+#endif // if !defined __WLAN_QCT_DRIVER_H
diff --git a/CORE/HDD/src/bap_hdd_main.c b/CORE/HDD/src/bap_hdd_main.c
new file mode 100644
index 0000000..60a42aa
--- /dev/null
+++ b/CORE/HDD/src/bap_hdd_main.c
@@ -0,0 +1,4545 @@
+/*
+ * 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  bap_hdd_main.c
+
+  \brief 802.11 BT-AMP PAL Host Device Driver implementation
+
+   Copyright 2008 (c) 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: /prj/qct/asw/engbuilds/scl/users02/jzmuda/gb-bluez/vendor/qcom/proprietary/wlan/libra/CORE/HDD/src/bap_hdd_main.c,v 1.63 2011/04/01 15:24:20 jzmuda Exp jzmuda $   $DateTime: $ $Author: jzmuda $
+
+
+  when        who    what, where, why
+  --------    ---    --------------------------------------------------------
+  12/1/09     JZmuda    Created module.
+
+  ==========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#ifdef WLAN_BTAMP_FEATURE
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/miscdevice.h>
+#include <linux/platform_device.h>
+#include <linux/fs.h>
+#include <linux/file.h>
+#include <linux/spinlock.h>
+//#include <linux/delay.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+//#include <wlan_qct_driver.h>
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_dp_utils.h>
+/* -------------------------------------------------------------------------*/
+#include <bap_hdd_main.h>
+#include <vos_api.h>
+#include <bapApi.h>
+#include <btampHCI.h>
+/* -------------------------------------------------------------------------*/
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+
+#ifdef WLAN_SOFTAP_FEATURE
+#include <wlan_hdd_misc.h>
+#endif
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+// the difference between the next two is that the first is the max
+// number we support in our current implementation while the second is
+// the max allowed by the spec
+#define BSL_MAX_PHY_LINKS           ( BSL_MAX_CLIENTS * BSL_MAX_PHY_LINK_PER_CLIENT )
+#define BSL_MAX_ALLOWED_PHY_LINKS   255
+
+// these likely will need tuning based on experiments
+#define BSL_MAX_RX_PKT_DESCRIPTOR   100
+#define BSL_MAX_TX_PKT_DESCRIPTOR   100
+
+// these caps are in place to not have run-away queues, again needs empirical tuning
+#define BSL_MAX_SIZE_TX_ACL_QUEUE   50
+#define BSL_MAX_SIZE_RX_ACL_QUEUE   50
+#define BSL_MAX_SIZE_RX_EVT_QUEUE   50
+
+#if 0
+What are the maximum sizes of a command packet, an event packet and an ACL
+data packet?
+
+[JimZ]: Sizes:
+1. Cmd Maximum size is slightly greater than 672 btyes.  But I am pretty sure
+right now that I will never have more than 240 bytes to send down at a time.  And
+that is good. Because some rather unpleasant things happen at the HCI interface
+if I exceed that.  ( Think 8-bit CPUs.  And the limitations of an 8-bit length
+                    field. )
+
+2. Event -  Ditto.
+
+3. Data 1492 bytes
+#endif
+
+// jimz
+// TLV related defines
+
+#define USE_FINAL_FRAMESC
+//#undef USE_FINAL_FRAMESC
+// jimz
+// TLV related defines
+
+#ifndef USE_FINAL_FRAMESC        //USE_FINAL_FRAMESC
+// AMP ASSOC TLV related defines
+#define AMP_ASSOC_TLV_TYPE_SIZE 2
+#define AMP_ASSOC_TLV_LEN_SIZE 2
+#define AMP_ASSOC_TLV_TYPE_AND_LEN_SIZE  (AMP_ASSOC_TLV_TYPE_SIZE + AMP_ASSOC_TLV_LEN_SIZE)
+
+// FLOW SPEC TLV related defines
+#define FLOWSPEC_TYPE_SIZE 2
+#define FLOWSPEC_LEN_SIZE 2
+#define FLOWSPEC_TYPE_AND_LEN_SIZE  (FLOWSPEC_TYPE_SIZE + FLOWSPEC_LEN_SIZE)
+
+// CMD TLV related defines
+#define CMD_TLV_TYPE_SIZE 2
+#define CMD_TLV_LEN_SIZE 2
+#define CMD_TLV_TYPE_AND_LEN_SIZE  (CMD_TLV_TYPE_SIZE + CMD_TLV_LEN_SIZE)
+
+// Event TLV related defines
+#define EVENT_TLV_TYPE_SIZE 2
+#define EVENT_TLV_LEN_SIZE 2
+#define EVENT_TLV_TYPE_AND_LEN_SIZE  (EVENT_TLV_TYPE_SIZE + EVENT_TLV_LEN_SIZE)
+
+// Data header size related defines
+#define DATA_HEADER_SIZE 4
+
+#else                            //USE_FINAL_FRAMESC
+
+// AMP ASSOC TLV related defines
+#define AMP_ASSOC_TLV_TYPE_SIZE 1
+#define AMP_ASSOC_TLV_LEN_SIZE 2
+#define AMP_ASSOC_TLV_TYPE_AND_LEN_SIZE  (AMP_ASSOC_TLV_TYPE_SIZE + AMP_ASSOC_TLV_LEN_SIZE)
+
+// FLOW SPEC TLV related defines
+#define FLOWSPEC_TYPE_SIZE 1
+#define FLOWSPEC_LEN_SIZE 1
+#define FLOWSPEC_TYPE_AND_LEN_SIZE  (FLOWSPEC_TYPE_SIZE + FLOWSPEC_LEN_SIZE)
+
+// CMD TLV related defines
+#define CMD_TLV_TYPE_SIZE 2
+#define CMD_TLV_LEN_SIZE 1
+#define CMD_TLV_TYPE_AND_LEN_SIZE  (CMD_TLV_TYPE_SIZE + CMD_TLV_LEN_SIZE)
+
+// Event TLV related defines
+#define EVENT_TLV_TYPE_SIZE 1
+#define EVENT_TLV_LEN_SIZE 1
+#define EVENT_TLV_TYPE_AND_LEN_SIZE  (EVENT_TLV_TYPE_SIZE + EVENT_TLV_LEN_SIZE)
+
+// Data header size related defines
+#define DATA_HEADER_SIZE 4
+
+#endif                           // USE_FINAL_FRAMESC
+// jimz
+
+#define BSL_MAX_EVENT_SIZE 700
+
+#define BSL_DEV_HANDLE 0x1234
+
+// Debug related defines
+#define DBGLOG printf
+//#define DUMPLOG
+#if defined DUMPLOG
+#define DUMPLOG(n, name1, name2, aStr, size) \
+    if (1) \
+{\
+    int i;\
+    DBGLOG("%d. %s: %s = \n", n, name1, name2); \
+    for (i = 0; i < size; i++) \
+        DBGLOG("%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \
+    DBGLOG("\n"); \
+}
+#else
+#define DUMPLOG(n, name1, name2, aStr, size)
+#endif
+
+// These are required to replace some Microsoft specific specifiers
+//#define UNALIGNED __align
+#define UNALIGNED
+#define INFINITE 0
+
+#define BT_AMP_HCI_CTX_MAGIC 0x48434949    // "HCII"
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+// Temporary Windows types
+typedef int            BOOL;
+typedef unsigned char  BYTE;
+typedef unsigned short WORD;
+typedef unsigned long  DWORD;
+typedef void * HANDLE;
+typedef char  TCHAR;
+typedef void *LPVOID;
+typedef const void *LPCVOID;
+
+typedef struct
+{
+    BOOL                         used;          // is this a valid context?
+    vos_event_t                  ReadableEvt;   // the event a ReadFile can block on
+    ptBtampHandle                bapHdl;        // our handle in BAP
+    vos_list_t                   PhyLinks;      // a list of all associations setup by this client
+//  Newly added for BlueZ
+    struct hci_dev               *hdev;        // the BlueZ HCI device structure
+
+    /* I don't know how many of these Tx fields we need */
+    spinlock_t                   lock;         /* For serializing operations */
+
+    struct                       sk_buff_head txq; /* We need the ACL Data Tx queue */
+
+    /* We definitely need some of these rx_skb fields */
+    unsigned long                rx_state;
+    unsigned long                rx_count;
+    struct sk_buff               *rx_skb;
+
+    struct net_device            *p_dev; // Our parent wlan network device
+
+} BslClientCtxType;
+
+typedef struct
+{
+    BslClientCtxType* pctx;
+    /* Tx skb queue and the workstructure for handling Tx as deferred work. */
+    struct sk_buff               *tx_skb;
+
+    struct work_struct           hciInterfaceProcessing;
+    v_U32_t                      magic;
+
+} BslHciWorkStructure;
+
+typedef struct
+{
+    TCHAR* ValueName;     // name of the value
+    DWORD  Type;          // type of value
+    DWORD  DwordValue;    // DWORD value
+    TCHAR* StringValue;   // string value
+
+} BslRegEntry;
+
+typedef struct
+{
+    BOOL              used;                // is this a valid context?
+    hdd_list_t        ACLTxQueue[WLANTL_MAX_AC];  // the TX ACL queues
+    BslClientCtxType* pClientCtx;          // ptr to application context that spawned
+    // this association
+    v_U8_t            PhyLinkHdl;          // BAP handle for this association
+    void*             pPhyLinkDescNode;    // ptr to node in list of assoc in client ctx
+    // real type BslPhyLinksNodeType*
+
+} BslPhyLinkCtxType;
+
+typedef struct
+{
+    vos_list_node_t    node;  // MUST be first element
+    BslPhyLinkCtxType* pPhy;  // ptr to an association context
+
+} BslPhyLinksNodeType;
+
+typedef struct
+{
+    vos_list_node_t node;     // MUST be first element
+    vos_pkt_t*      pVosPkt;  // ptr to a RX VoS pkt which can hold an HCI event or ACL data
+
+} BslRxListNodeType;
+
+// Borrowed from wlan_hdd_dp_utils.h
+typedef struct
+{
+    hdd_list_node_t     node;         // MUST be first element
+    struct sk_buff *    skb;          // ptr to the ACL data
+
+} BslTxListNodeType;
+
+typedef struct
+{
+    BslPhyLinkCtxType* ptr;   // ptr to the association context for this phy_link_handle
+
+} BslPhyLinkMapEntryType;
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+BslClientCtxType* gpBslctx;
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+// Temporary (until multi-phy link) pointer to BT-AMP context
+static void *gpCtx;
+
+// an efficient lookup from phy_link_handle to phy link context
+static BslPhyLinkMapEntryType BslPhyLinkMap[BSL_MAX_ALLOWED_PHY_LINKS];
+
+//static HANDLE hBsl = NULL; //INVALID_HANDLE_VALUE;
+static BOOL bBslInited = FALSE;
+
+static BslClientCtxType BslClientCtx[BSL_MAX_CLIENTS];
+//static vos_lock_t BslClientLock;
+
+static BslPhyLinkCtxType BslPhyLinkCtx[BSL_MAX_PHY_LINKS];
+//static vos_lock_t BslPhyLock;
+
+// the pool for association contexts
+static vos_list_t BslPhyLinksDescPool;
+static BslPhyLinksNodeType BslPhyLinksDesc[BSL_MAX_PHY_LINKS];
+
+//static v_U32_t Eventlen = 0;
+
+/*---------------------------------------------------------------------------
+ *   Forward declarations
+ *-------------------------------------------------------------------------*/
+static void bslWriteFinish(struct work_struct *work);
+
+/*---------------------------------------------------------------------------
+ *   Driver Entry points and Structure definitions
+ *-------------------------------------------------------------------------*/
+static int BSL_Open (struct hci_dev *hdev);
+static int BSL_Close (struct hci_dev *hdev);
+static int BSL_Flush(struct hci_dev *hdev);
+static int BSL_IOControl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
+static int BSL_Write(struct sk_buff *skb);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+static void BSL_Destruct(struct hci_dev *hdev);
+#endif
+
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+static v_BOOL_t WLANBAP_AmpConnectionAllowed(void)
+{
+    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+    hdd_context_t *pHddCtx;
+    v_BOOL_t retVal = VOS_FALSE;
+
+    if (NULL != pVosContext)
+    {
+       pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+       if (NULL != pHddCtx)
+       {
+           return pHddCtx->isAmpAllowed;
+       }
+       else
+       {
+           return retVal;
+       }
+    }
+    return retVal;
+}
+
+/**
+  @brief WLANBAP_STAFetchPktCB() - The fetch packet callback registered
+  with BAP by HDD.
+
+  It is called by the BAP immediately upon the underlying
+  WLANTL_STAFetchPktCBType routine being called.  Which is called by
+  TL when the scheduling algorithms allows for transmission of another
+  packet to the module.
+
+  This function is here to "wrap" or abstract WLANTL_STAFetchPktCBType.
+  Because the BAP-specific HDD "shim" layer (BSL) doesn't know anything
+  about STAIds, or other parameters required by TL.
+
+  @param pHddHdl: [in] The HDD(BSL) specific context for this association.
+  Use the STAId passed to me by TL in WLANTL_STAFetchCBType to retreive
+  this value.
+  @param  pucAC: [inout] access category requested by TL, if HDD does not
+  have packets on this AC it can choose to service another AC queue in
+  the order of priority
+  @param  vosDataBuff: [out] pointer to the VOSS data buffer that was
+  transmitted
+  @param tlMetaInfo: [out] meta info related to the data frame
+
+  @return
+  The result code associated with performing the operation
+*/
+static VOS_STATUS WLANBAP_STAFetchPktCB
+(
+    v_PVOID_t             pHddHdl,
+    WLANTL_ACEnumType     ucAC,
+    vos_pkt_t**           vosDataBuff,
+    WLANTL_MetaInfoType*  tlMetaInfo
+)
+{
+    BslPhyLinkCtxType* pPhyCtx;
+    VOS_STATUS VosStatus;
+    v_U8_t AcIdxStart;
+    v_U8_t AcIdx;
+    hdd_list_node_t *pLink;
+    BslTxListNodeType *pNode;
+    struct sk_buff *    skb;
+    BslClientCtxType* pctx;
+    WLANTL_ACEnumType Ac;
+    vos_pkt_t* pVosPkt;
+    WLANTL_MetaInfoType TlMetaInfo;
+    pctx = &BslClientCtx[0];
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "WLANBAP_STAFetchPktCB\n" );
+
+    // sanity checking
+    if( pHddHdl == NULL || vosDataBuff == NULL ||
+            tlMetaInfo == NULL || ucAC >= WLANTL_MAX_AC || ucAC < 0 )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB bad input\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    // Initialize the VOSS packet returned to NULL - in case of error
+    *vosDataBuff = NULL;
+
+    pPhyCtx = (BslPhyLinkCtxType *)pHddHdl;
+    AcIdx = AcIdxStart = ucAC;
+
+    spin_lock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock);
+    VosStatus = hdd_list_remove_front( &pPhyCtx->ACLTxQueue[AcIdx], &pLink );
+    spin_unlock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock);
+
+    if ( VOS_STATUS_E_EMPTY == VosStatus )
+    {
+        do
+        {
+            AcIdx = (AcIdx + 1) % WLANTL_MAX_AC;
+
+            spin_lock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock);
+            VosStatus = hdd_list_remove_front( &pPhyCtx->ACLTxQueue[AcIdx], &pLink );
+            spin_unlock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock);
+
+        }
+        while ( VosStatus == VOS_STATUS_E_EMPTY && AcIdx != AcIdxStart );
+
+        if ( VosStatus == VOS_STATUS_E_EMPTY )
+        {
+            // Queue is empty.  This can happen.  Just return NULL back to TL...
+            return(VOS_STATUS_E_EMPTY);
+        }
+        else if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_ASSERT( 0 );
+        }
+    }
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_ASSERT( 0 );
+    }
+
+    pNode = (BslTxListNodeType *)pLink;
+    skb   = pNode->skb;
+
+   // I will access the skb in a VOSS packet
+   // Wrap the OS provided skb in a VOSS packet
+    // Attach skb to VOS packet.
+    VosStatus = vos_pkt_wrap_data_packet( &pVosPkt,
+                                          VOS_PKT_TYPE_TX_802_3_DATA,
+                                          skb,
+                                          NULL,
+                                          NULL);
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB vos_pkt_wrap_data_packet "
+             "failed status =%d\n", VosStatus );
+        kfree_skb(skb);  
+        return VosStatus;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s: pVosPkt(vos_pkt_t *)=%p\n", __FUNCTION__,
+               pVosPkt );
+
+    VosStatus = WLANBAP_XlateTxDataPkt( pctx->bapHdl, pPhyCtx->PhyLinkHdl,
+                                        &Ac, &TlMetaInfo, pVosPkt);
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB WLANBAP_XlateTxDataPkt "
+             "failed status =%d\n", VosStatus );
+
+        // return the packet
+        VosStatus = vos_pkt_return_packet( pVosPkt );
+        kfree_skb(skb);  
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+        return VosStatus;
+    }
+    // give TL the VoS pkt
+    *vosDataBuff = pVosPkt;
+
+    // provide the meta-info BAP provided previously
+    *tlMetaInfo = TlMetaInfo;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: *vosDataBuff(vos_pkt_t *)=%p\n", __FUNCTION__, *vosDataBuff );
+
+    return(VOS_STATUS_SUCCESS);
+} // WLANBAP_STAFetchPktCB()
+
+/**
+  @brief WLANBAP_STARxCB() - The receive callback registered with BAP by HDD.
+
+  It is called by the BAP immediately upon the underlying
+  WLANTL_STARxCBType routine being called.  Which is called by
+  TL to notify when a packet was received for a registered STA.
+
+  @param  pHddHdl: [in] The HDD(BSL) specific context for this association.
+  Use the STAId passed to me by TL in WLANTL_STARxCBType to retrieve this value.
+  @param  vosDataBuff: [in] pointer to the VOSS data buffer that was received
+  (it may be a linked list)
+  @param  pRxMetaInfo: [in] Rx meta info related to the data frame
+
+  @return
+  The result code associated with performing the operation
+*/
+static VOS_STATUS WLANBAP_STARxCB
+(
+    v_PVOID_t              pHddHdl,
+    vos_pkt_t*             vosDataBuff,
+    WLANTL_RxMetaInfoType* pRxMetaInfo
+)
+{
+    BslPhyLinkCtxType* pctx;
+    BslClientCtxType* ppctx;
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    WLANTL_ACEnumType Ac; // this is not needed really
+    struct sk_buff *skb = NULL;
+    vos_pkt_t* pVosPacket;
+    vos_pkt_t* pNextVosPacket;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "WLANBAP_STARxCB\n" );
+
+    // sanity checking
+    if ( pHddHdl == NULL || vosDataBuff == NULL || pRxMetaInfo == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STARxCB bad input\n" );
+        if(NULL != vosDataBuff)
+        {
+            VosStatus = vos_pkt_return_packet( vosDataBuff );
+        }
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pctx = (BslPhyLinkCtxType *)pHddHdl;
+    ppctx = pctx->pClientCtx;
+
+    if( NULL == ppctx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STARxCB ClientCtx is NULL\n" );
+        VosStatus = vos_pkt_return_packet( vosDataBuff );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    // walk the chain until all are processed
+   pVosPacket = vosDataBuff;
+   do
+   {
+       // get the pointer to the next packet in the chain
+       // (but don't unlink the packet since we free the entire chain later)
+       VosStatus = vos_pkt_walk_packet_chain( pVosPacket, &pNextVosPacket, VOS_FALSE);
+       
+       // both "success" and "empty" are acceptable results
+       if (!((VosStatus == VOS_STATUS_SUCCESS) || (VosStatus == VOS_STATUS_E_EMPTY)))
+       {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: Failure walking packet chain", __FUNCTION__);
+           return VOS_STATUS_E_FAILURE;
+       }
+       
+       // process the packet
+       VosStatus = WLANBAP_XlateRxDataPkt( ppctx->bapHdl, pctx->PhyLinkHdl,
+                                              &Ac, pVosPacket );
+
+       if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+       {
+           VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "WLANBAP_STARxCB WLANBAP_XlateRxDataPkt "
+           "failed status = %d\n", VosStatus );
+
+           VosStatus = VOS_STATUS_E_FAILURE;
+
+           break;
+       }
+
+       // Extract the OS packet (skb).
+       // Tell VOS to detach the OS packet from the VOS packet
+       VosStatus = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
+       if(!VOS_IS_STATUS_SUCCESS( VosStatus ))
+       {
+           VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: Failure extracting skb from vos pkt. "
+             "VosStatus = %d\n", __FUNCTION__, VosStatus );
+
+           VosStatus = VOS_STATUS_E_FAILURE;
+
+           break;
+       }
+
+       //JEZ100809: While an skb is being handled by the kernel, is "skb->dev" de-ref'd?
+       skb->dev = (struct net_device *) gpBslctx->hdev;
+       bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
+       //skb->protocol = eth_type_trans(skb, skb->dev);
+       //skb->ip_summed = CHECKSUM_UNNECESSARY;
+ 
+       // This is my receive skb pointer
+       gpBslctx->rx_skb = skb;
+
+       // This is how data and events are passed up to BlueZ
+       hci_recv_frame(gpBslctx->rx_skb);
+
+       // now process the next packet in the chain
+       pVosPacket = pNextVosPacket;
+       
+   } while (pVosPacket);
+
+
+    //JEZ100922: We are free to return the enclosing VOSS packet.
+    VosStatus = vos_pkt_return_packet( vosDataBuff );
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+
+    return(VOS_STATUS_SUCCESS);
+} // WLANBAP_STARxCB()
+
+/**
+  @brief WLANBAP_TxCompCB() - The Tx complete callback registered with BAP by HDD.
+
+  It is called by the BAP immediately upon the underlying
+  WLANTL_TxCompCBType routine being called.  Which is called by
+  TL to notify when a transmission for a packet has ended.
+
+  @param pHddHdl: [in] The HDD(BSL) specific context for this association
+  @param vosDataBuff: [in] pointer to the VOSS data buffer that was transmitted
+  @param wTxSTAtus: [in] status of the transmission
+
+  @return
+  The result code associated with performing the operation
+*/
+extern v_VOID_t WLANBAP_TxPacketMonitorHandler ( v_PVOID_t ); // our handle in BAP
+
+static VOS_STATUS WLANBAP_TxCompCB
+(
+    v_PVOID_t      pHddHdl,
+    vos_pkt_t*     vosDataBuff,
+    VOS_STATUS     wTxSTAtus
+)
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    //BslTxListNodeType* pTxNode;
+    void* pOsPkt = NULL;
+    BslPhyLinkCtxType* pctx;
+    BslClientCtxType* ppctx;
+    static int num_packets = 0;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "WLANBAP_TxCompCB. vosDataBuff(vos_pkt_t *)=%p\n", vosDataBuff );
+
+    // be aware that pHddHdl can be NULL or can point to the per association
+    // BSL context from the register data plane. In either case it does not
+    // matter since we will simply free the VoS pkt and reclaim the TX
+    // descriptor
+
+    // sanity checking
+    if ( vosDataBuff == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_TxCompCB bad input\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    //Return the skb to the OS
+    VosStatus = vos_pkt_get_os_packet( vosDataBuff, &pOsPkt, VOS_TRUE );
+    if(!VOS_IS_STATUS_SUCCESS( VosStatus ))
+    {
+        //This is bad but still try to free the VOSS resources if we can
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
+        vos_pkt_return_packet( vosDataBuff );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    kfree_skb((struct sk_buff *)pOsPkt);
+
+    //Return the VOS packet resources.
+    VosStatus = vos_pkt_return_packet( vosDataBuff );
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_ASSERT(0);
+    }
+
+    // JEZ110330: Now signal the layer above me...that I have released some packets.
+    pctx = (BslPhyLinkCtxType *)pHddHdl;
+    ppctx = pctx->pClientCtx;
+    num_packets = (num_packets + 1) % 4;
+    if (num_packets == 0 )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s: Sending up number of completed packets.  num_packets = %d.\n", __FUNCTION__, num_packets );
+        WLANBAP_TxPacketMonitorHandler ( (v_PVOID_t) ppctx->bapHdl ); // our handle in BAP
+    }
+
+    return(VOS_STATUS_SUCCESS);
+} // WLANBAP_TxCompCB()
+
+/**
+  @brief BslFlushTxQueues() - flush the Tx  queues
+
+  @param pPhyCtx : [in] ptr to the phy context whose queues need to be flushed
+
+  @return
+  VOS_STATUS
+
+*/
+static VOS_STATUS BslFlushTxQueues
+(
+    BslPhyLinkCtxType* pPhyCtx
+)
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    v_SINT_t i = -1;
+    hdd_list_node_t* pLink;
+    BslTxListNodeType *pNode;
+
+
+    if(TRUE == pPhyCtx->used)
+    {
+        while (++i != WLANTL_MAX_AC)
+        {
+            //Free up any packets in the Tx queue
+            spin_lock_bh(&pPhyCtx->ACLTxQueue[i].lock);
+            while (true)
+            {
+                VosStatus = hdd_list_remove_front(&pPhyCtx->ACLTxQueue[i], &pLink );
+                if(VOS_STATUS_E_EMPTY != VosStatus)
+                {
+                    pNode = (BslTxListNodeType *)pLink;
+                    kfree_skb(pNode->skb);
+                    continue;
+                }
+                break;
+            }
+            spin_unlock_bh(&pPhyCtx->ACLTxQueue[i].lock);
+        }
+    }
+    return(VOS_STATUS_SUCCESS);
+} // BslFlushTxQueues
+
+
+/**
+  @brief BslReleasePhyCtx() - this function will free up an association context
+
+  @param pPhyCtx : [in] ptr to the phy context to release
+
+  @return
+  None
+
+*/
+static void BslReleasePhyCtx
+(
+    BslPhyLinkCtxType* pPhyCtx
+)
+{
+    v_U32_t OldMapVal;
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslReleasePhyCtx\n" );
+
+    pPhyCtx->used = FALSE;
+
+
+    if (BslPhyLinkMap[pPhyCtx->PhyLinkHdl].ptr == NULL) return;
+
+
+    // update the phy link handle based map so TX data is stopped from flowing through
+    OldMapVal = vos_atomic_set_U32( (v_U32_t *) (BslPhyLinkMap[pPhyCtx->PhyLinkHdl].ptr),
+                                    (v_U32_t) 0 );
+
+    // clear out the Tx Queues
+    VosStatus =  BslFlushTxQueues(pPhyCtx);
+
+    // clear out the parent ptr
+    //  pPhyCtx->pClientCtx = NULL;//commented to debug exception
+
+    // we also need to remove this assocation from the list of active
+    // associations maintained in the application context
+    if( pPhyCtx->pPhyLinkDescNode )
+    {
+        VosStatus = vos_list_remove_node( &pPhyCtx->pClientCtx->PhyLinks,
+                                          &((BslPhyLinksNodeType*)pPhyCtx->pPhyLinkDescNode)->node);
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+        //Return the PhyLink handle to the free pool
+        VosStatus = vos_list_insert_front(&BslPhyLinksDescPool,&((BslPhyLinksNodeType*)pPhyCtx->pPhyLinkDescNode)->node);
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+
+        pPhyCtx->pPhyLinkDescNode = NULL;
+    }
+    pPhyCtx->pClientCtx = NULL;//Moved here to bebug the exception
+
+    pPhyCtx->used = FALSE;
+
+} // BslReleasePhyCtx()
+
+/**
+  @brief WLAN_BAPEventCB() - Implements the callback for ALL asynchronous events.
+
+  Including Events resulting from:
+     * HCI Create Physical Link,
+     * Disconnect Physical Link,
+     * Create Logical Link,
+     * Flow Spec Modify,
+     * HCI Reset,
+     * HCI Flush,...
+
+  Also used to return sync events locally by BSL
+
+  @param pHddHdl: [in] The HDD(BSL) specific context for this association.
+  BSL gets this from the downgoing packets Physical handle value.
+  @param pBapHCIEvent: [in] pointer to the union of "HCI Event" structures.
+  Contains all info needed for HCI event.
+  @param AssocSpecificEvent: [in] flag indicates assoc-specific (1) or
+  global (0) event
+
+  @return
+  The result code associated with performing the operation
+
+  VOS_STATUS_E_FAULT:  pointer to pBapHCIEvent is NULL
+  VOS_STATUS_SUCCESS:  Success
+*/
+static VOS_STATUS WLANBAP_EventCB
+(
+    v_PVOID_t      pHddHdl,   /* this could refer to either the BSL per
+                                association context which got passed in during
+                                register data plane OR the BSL per application
+                                context passed in during register BAP callbacks
+                                based on setting of the Boolean flag below */
+    tpBtampHCI_Event pBapHCIEvent, /* This now encodes ALL event types including
+                                     Command Complete and Command Status*/
+    v_BOOL_t AssocSpecificEvent /* Flag to indicate global or assoc-specific event */
+)
+{
+    BslClientCtxType* pctx;
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    vos_pkt_t* pVosPkt;
+    v_U32_t PackStatus;
+    static v_U8_t Buff[BSL_MAX_EVENT_SIZE]; // stack overflow?
+    v_U32_t Written = 0; // FramesC REQUIRES this
+    v_U32_t OldMapVal;
+    struct sk_buff *skb = NULL;
+
+    // sanity checking
+    if ( pBapHCIEvent == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB bad input\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB event=%d "
+       "assoc_specific=%d\n", pBapHCIEvent->bapHCIEventCode, AssocSpecificEvent );
+
+    if ( pHddHdl == NULL )
+    {
+        /* Consider the following error scenarios to bypass the NULL check: 
+        - create LL without a call for create PL before 
+        - delete LL or PL when no AMP connection has been established yet 
+        Client context is unimportant from HCI point of view, only needed by the TLV API in BAP 
+        TODO: Change the TLV APIs to not to carry the client context; it doesn't use it anyway 
+        */
+        if (( AssocSpecificEvent ) && 
+            (BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT != pBapHCIEvent->bapHCIEventCode) &&
+            (BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT != pBapHCIEvent->bapHCIEventCode))
+        {
+            pctx = gpBslctx;
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "WLANBAP_EventCB bad input\n" );
+            return VOS_STATUS_E_FAILURE;
+        }
+    }
+
+
+    if(NULL != pHddHdl)
+    {
+        if ( AssocSpecificEvent )
+        {
+            // get the app context from the assoc context
+            pctx = ((BslPhyLinkCtxType *)pHddHdl)->pClientCtx;
+        }
+        else
+        {
+            pctx = (BslClientCtxType *)pHddHdl;
+        }
+    }
+
+    if(NULL == pctx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                     "pctx is NULL in %s", __FUNCTION__);
+
+        return VOS_STATUS_E_FAULT;
+
+    }
+
+    VosStatus = vos_pkt_get_packet( &pVosPkt, VOS_PKT_TYPE_RX_RAW,
+                                    BSL_MAX_EVENT_SIZE, 1, 0, NULL, NULL);
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB vos_pkt_get_packet "
+          "failed status=%d\n", VosStatus );
+        return(VosStatus);
+    }
+
+    switch ( pBapHCIEvent->bapHCIEventCode )
+    {
+        /** BT events */
+    case BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT:
+    {
+        /*
+            BTAMP_TLV_HCI_RESET_CMD:
+            BTAMP_TLV_HCI_FLUSH_CMD:
+            BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD:
+            BTAMP_TLV_HCI_SET_EVENT_MASK_CMD:
+            BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD:
+            BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD:
+            BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD:
+            BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD:
+            BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD:
+            BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD:
+            BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TO_CMD:
+            BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TO_CMD:
+            BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD:
+            BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFORMATION_CMD:
+            BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_COMMANDS_CMD:
+            BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD:
+            BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD:
+            BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD:
+            BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD:
+            BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD:
+            BTAMP_TLV_HCI_READ_RSSI_CMD:
+            BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD:
+            BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD:
+            BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD:
+            BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD:
+            BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD:
+            BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0:
+
+         */
+
+        // pack
+        PackStatus = btampPackTlvHCI_Command_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampCommandCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Command_Complete_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_COMMAND_STATUS_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Command_Status_Event( pctx,
+                     &pBapHCIEvent->u.btampCommandStatusEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Command_Status_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Num_Completed_Pkts_Event( pctx,
+                     &pBapHCIEvent->u.btampNumOfCompletedPktsEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Num_Completed_Pkts_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Num_Completed_Data_Blocks_Event( pctx,
+                     &pBapHCIEvent->u.btampNumOfCompletedDataBlocksEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Num_Completed_Data_Blocks_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Hardware_Error_Event( pctx,
+                     &pBapHCIEvent->u.btampHardwareErrorEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Flush_Occurred_Event( pctx,
+                     &pBapHCIEvent->u.btampFlushOccurredEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Flush_Occurred_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Enhanced_Flush_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampEnhancedFlushCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Enhanced_Flush_Complete_Event failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Loopback_Command_Event( pctx,
+                     &pBapHCIEvent->u.btampLoopbackCommandEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Data_Buffer_Overflow_Event( pctx,
+                     &pBapHCIEvent->u.btampDataBufferOverflowEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_QOS_VIOLATION_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Qos_Violation_Event( pctx,
+                     &pBapHCIEvent->u.btampQosViolationEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    /** BT v3.0 events */
+    case BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event( pctx,
+                     &pBapHCIEvent->u.btampGenericAMPLinkKeyNotificationEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Physical_Link_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampPhysicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        // look at this event to determine whether to cleanup the PHY context
+        if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                WLANBAP_STATUS_SUCCESS )
+        {
+            // register the data plane now
+            VosStatus = WLANBAP_RegisterDataPlane( pctx->bapHdl,
+                                                   WLANBAP_STAFetchPktCB,
+                                                   WLANBAP_STARxCB,
+                                                   WLANBAP_TxCompCB,
+                                                   (BslPhyLinkCtxType *)pHddHdl );
+
+            if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB WLANBAP_RegisterDataPlane "
+                  "failed status = %d\n", VosStatus );
+                // we still want to send the event upto app so do not bail
+            }
+            else
+            {
+                // update the phy link handle based map so TX data can start flowing through
+                OldMapVal = vos_atomic_set_U32( (v_U32_t *)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle,
+                                                (v_U32_t) pHddHdl );
+
+//                  VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect
+            }
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  WLANBAP_ERROR_HOST_REJ_RESOURCES )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  WLANBAP_ERROR_HOST_TIMEOUT )
+        {
+            //We need to update the phy link handle here to be able to reissue physical link accept
+            // update the phy link handle based map so TX data can start flowing through
+            OldMapVal = vos_atomic_set_U32( (v_U32_t *)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle,
+                                            (v_U32_t) pHddHdl );
+
+//                  VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect
+
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  WLANBAP_ERROR_MAX_NUM_CNCTS )
+        {
+            //We need to update the phy link handle here to be able to reissue physical link /create/accept
+            // update the phy link handle based map so TX data can start flowing through
+            OldMapVal = vos_atomic_set_U32( (v_U32_t *)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle,
+                                            (v_U32_t) pHddHdl );
+//                  VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect
+
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  WLANBAP_ERROR_HOST_TIMEOUT )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  0x16 /* WLANBAP_ERROR_FAILED_CONNECTION? */ )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  0x8 /* WLANBAP_ERROR_AUTH_FAILED? */ )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ==
+                  WLANBAP_ERROR_NO_CNCT )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected HCI Phy Link Comp Evt "
+               "status =%d\n", pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status );
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Channel_Selected_Event( pctx,
+                     &pBapHCIEvent->u.btampChannelSelectedEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        // we need to cleanup the PHY context always but have these checks to make
+        // sure we catch unexpected behavior, strangely enough even when peer triggers
+        // the disconnect the reason code is still 0x16, weird
+        if ( pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.status == WLANBAP_STATUS_SUCCESS &&
+                pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.reason == WLANBAP_ERROR_TERM_BY_LOCAL_HOST )
+        {
+            BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl );
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected HCI Dis Phy Link Comp Evt "
+               "status =%d reason =%d\n", pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.status,
+                       pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.reason );
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Physical_Link_Loss_Warning_Event( pctx,
+                     &pBapHCIEvent->u.btampPhysicalLinkLossWarningEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Physical_Link_Recovery_Event( pctx,
+                     &pBapHCIEvent->u.btampPhysicalLinkRecoveryEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Logical_Link_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampLogicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Flow_Spec_Modify_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT:
+    {
+        // pack
+        PackStatus = btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event( pctx,
+                     &pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written );
+
+        if ( !BTAMP_SUCCEEDED( PackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus);
+            // handle the error
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+        break;
+    }
+    default:
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected event\n" );
+
+        VosStatus = vos_pkt_return_packet( pVosPkt );
+
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+        return(VOS_STATUS_E_FAILURE);
+        break;
+    }
+    }
+
+    VOS_ASSERT(Written <= BSL_MAX_EVENT_SIZE);
+
+    // stick the event into a VoS pkt
+    VosStatus = vos_pkt_push_head( pVosPkt, Buff, Written );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB vos_pkt_push_head "
+          "status =%d\n", VosStatus );
+
+            // return the packet
+            VosStatus = vos_pkt_return_packet( pVosPkt );
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+            return(VOS_STATUS_E_FAILURE);
+        }
+
+    // Extract the OS packet (skb).
+    // Tell VOS to detach the OS packet from the VOS packet
+    VosStatus = vos_pkt_get_os_packet( pVosPkt, (v_VOID_t **)&skb, VOS_TRUE );
+    if(!VOS_IS_STATUS_SUCCESS( VosStatus ))
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: Failure extracting skb from vos pkt. "
+          "VosStatus = %d\n", __FUNCTION__, VosStatus );
+
+        // return the packet
+        VosStatus = vos_pkt_return_packet( pVosPkt );
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+        return(VOS_STATUS_E_FAILURE);
+    }
+
+    //JEZ100922: We are free to return the enclosing VOSS packet.
+    VosStatus = vos_pkt_return_packet( pVosPkt );
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ));
+
+    //JEZ100809: While an skb is being handled by the kernel, is "skb->dev" de-ref'd?
+    skb->dev = (struct net_device *) gpBslctx->hdev;
+    bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
+    //skb->protocol = eth_type_trans(skb, skb->dev);
+    //skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+    // This is my receive skb pointer
+    gpBslctx->rx_skb = skb;
+
+    // This is how data and events are passed up to BlueZ
+    hci_recv_frame(gpBslctx->rx_skb);
+
+    return(VOS_STATUS_SUCCESS);
+} // WLANBAP_EventCB()
+
+static VOS_STATUS  
+WLANBAP_PhyLinkFailure
+( 
+    BslClientCtxType* pctx,
+    v_U8_t       phy_link_handle
+)
+{
+    VOS_STATUS  vosStatus;
+    tBtampHCI_Event bapHCIEvent;
+
+    /* Format the Physical Link Complete event to return... */ 
+    bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = WLANBAP_ERROR_UNSPECIFIED_ERROR;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle 
+        = phy_link_handle;
+    bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number 
+        = 0;
+    //TBD: Could be a cleaner way to get the PhyLinkCtx handle; For now works
+    BslPhyLinkCtx[0].pClientCtx = pctx;
+    vosStatus = WLANBAP_EventCB( &BslPhyLinkCtx[0], &bapHCIEvent, TRUE );
+
+    return vosStatus;
+}
+
+/**
+  @brief BslFindAndInitClientCtx() - This function will find and initialize a client
+  a.k.a app context
+
+  @param pctx : [inout] ptr to the client context
+
+  @return
+  TRUE if all OK, FALSE otherwise
+
+*/
+static BOOL BslFindAndInitClientCtx
+(
+    BslClientCtxType** pctx_
+)
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    BslClientCtxType* pctx;
+    v_U8_t i;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslFindAndInitClientCtx\n" );
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,"%s:BslClientLock already inited",__FUNCTION__);
+        // return(0);
+    }
+
+    for ( i=0; i < BSL_MAX_CLIENTS; i++ )
+    {
+        if ( !BslClientCtx[i].used )
+        {
+            VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,"%s:BslClientCtx[%d] selected",__FUNCTION__, i);
+            BslClientCtx[i].used = TRUE;
+            break;
+        }
+    }
+
+    if ( i == BSL_MAX_CLIENTS )
+    {
+        // no more clients can be supported
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslFindAndInitClientCtx no more "
+          "clients can be supported MAX=%d\n", BSL_MAX_CLIENTS );
+        return FALSE;
+    }
+
+    //pctx = BslClientCtx + i;
+    pctx = gpBslctx;
+
+    // get a handle from BAP
+    VosStatus = WLANBAP_GetNewHndl(&pctx->bapHdl);
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        pctx->used = FALSE;
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:WLAN_GetNewHndl Failed",__FUNCTION__);
+
+        return(FALSE);
+    }
+
+    // register the event cb with BAP, this cb is used for BOTH association
+    // specific and non-association specific event notifications by BAP.
+    // However association specific events will be called with a different
+    // cookie that is passed in during the physical link create/accept
+    VosStatus = WLAN_BAPRegisterBAPCallbacks( pctx->bapHdl, WLANBAP_EventCB, pctx );
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        pctx->used = FALSE;
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:WLAN_BAPRegsiterBAPCallaback Failed",__FUNCTION__);
+
+        return(FALSE);
+    }
+
+    // init the PhyLinks queue to keep track of the assoc's of this client
+    VosStatus = vos_list_init( &pctx->PhyLinks );
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+
+    *pctx_ = pctx;
+
+    return(TRUE);
+} //BslFindAndInitClientCtx()
+
+/**
+  @brief BslReleaseClientCtx() - This function will release a client a.k.a. app
+  context
+
+  @param pctx : [in] ptr to the client context
+
+  @return
+  None
+
+*/
+//#if 0
+static void BslReleaseClientCtx
+(
+    BslClientCtxType* pctx
+)
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    vos_list_node_t* pLink;
+    BslPhyLinksNodeType *pPhyNode;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslReleaseClientCtx\n" );
+
+    // an app can do this without cleaning up after itself i.e. it can have active associations and
+    // data pending, we need to cleanup its mess
+
+    // first tell BAP we dont want the handle anymore, BAP will cleanup all the associations and
+    // consume resulting HCI events, so after this we will not get any HCI events. we will also
+    // not see any FetchPktCB and RxPktCB. We can still expect TxCompletePktCB
+    VosStatus = WLANBAP_ReleaseHndl( pctx->bapHdl );
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+
+
+    // find and free all of the association contexts belonging to this app
+    while ( VOS_IS_STATUS_SUCCESS( VosStatus = vos_list_remove_front( &pctx->PhyLinks, &pLink ) ) )
+    {
+        pPhyNode = (BslPhyLinksNodeType *)pLink;
+
+        // since the phy link has already been removed from the list of active
+        // associations, make sure we dont attempt to do this again
+        pPhyNode->pPhy->pPhyLinkDescNode = NULL;
+
+        BslReleasePhyCtx( pPhyNode->pPhy );
+    }
+
+    VOS_ASSERT( VosStatus == VOS_STATUS_E_EMPTY );
+
+    // destroy the PhyLinks queue
+    VosStatus = vos_list_destroy( &pctx->PhyLinks );
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+
+    pctx->used = FALSE;
+
+} // BslReleaseClientCtx()
+//#endif
+
+/**
+  @brief BslInitPhyCtx() - Initialize the Phy Context array.
+
+
+  @return
+  TRUE if all OK, FALSE otherwise
+
+*/
+static BOOL BslInitPhyCtx (void)
+{
+    v_U16_t i;
+    // free PHY context
+
+    for ( i=0; i<BSL_MAX_PHY_LINKS; i++ )
+    {
+        BslPhyLinkCtx[i].used = FALSE;
+    }
+
+    return (TRUE);
+} // BslInitPhyCtx()
+
+
+/**
+  @brief BslFindAndInitPhyCtx() - This function will try to find a free physical
+  link a.k.a assocation context and if successful, then init that context
+
+  @param pctx : [in] the client context
+  @param PhyLinkHdl : [in] the physical link handle chosen by application
+  @param ppPhyCtx : [inout] ptr to the physical link context
+
+  @return
+  TRUE if all OK, FALSE otherwise
+
+*/
+static BOOL BslFindAndInitPhyCtx
+(
+    BslClientCtxType*   pctx,
+    v_U8_t              PhyLinkHdl,
+    BslPhyLinkCtxType** ppPhyCtx
+)
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    v_U16_t i;
+    v_U16_t j;
+    vos_list_node_t* pLink;
+    BslPhyLinksNodeType *pNode;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslFindAndInitPhyCtx\n" );
+
+    for ( i=0; i<BSL_MAX_PHY_LINKS; i++ )
+    {
+        if ( !BslPhyLinkCtx[i].used )
+        {
+            BslPhyLinkCtx[i].used = TRUE;
+            break;
+        }
+    }
+
+    if ( i==BSL_MAX_PHY_LINKS )
+    {
+        return(FALSE);
+    }
+    else
+    {
+
+        // now init this context
+
+        *ppPhyCtx = BslPhyLinkCtx + i;
+
+        // setup a ptr to the app context that this assocation specific context lives in
+        BslPhyLinkCtx[i].pClientCtx = pctx;
+
+        // Mark as used
+        (*ppPhyCtx)->used = TRUE;
+
+        // store the PHY link handle
+        BslPhyLinkCtx[i].PhyLinkHdl = PhyLinkHdl;
+
+        // init the TX queues
+        for ( j=0; j<WLANTL_MAX_AC; j++ )
+        {
+            hdd_list_init( &BslPhyLinkCtx[i].ACLTxQueue[j], HDD_TX_QUEUE_MAX_LEN );
+            //VosStatus = vos_list_init( &BslPhyLinkCtx[i].ACLTxQueue[j] );
+            //VosStatus = vos_list_init( &(BslPhyLinkCtx+i)->ACLTxQueue );
+            VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+        }
+
+        // need to add this Phy context to the client list of associations,
+        // useful during Close operation
+
+        // get a pkt desc
+        VosStatus = vos_list_remove_front( &BslPhyLinksDescPool, &pLink );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            // this could happen due to pool not being big enough, etc
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslFindAndInitPhyCtx failed to "
+             "get node from BslPhyLinksDescPool vstatus=%d\n", VosStatus );
+            BslReleasePhyCtx( *ppPhyCtx );
+            return FALSE;
+        }
+
+        // stick the VOS pkt into the node
+        pNode = (BslPhyLinksNodeType *) pLink;
+        pNode->node = *pLink;
+        pNode->pPhy = *ppPhyCtx;
+
+
+        // now queue the pkt into the correct queue
+        VosStatus = vos_list_insert_back( &pctx->PhyLinks, pLink );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_ASSERT(0);
+        }
+
+        // need to record the desc for this assocation in the list of
+        // active assocations in client context to allow cleanup later
+        (*ppPhyCtx)->pPhyLinkDescNode = pNode;
+
+        return(TRUE);
+    }
+} // BslFindAndInitPhyCtx()
+
+/**
+  @brief BslProcessHCICommand() - This function will process an HCI command i.e
+  take an HCI command buffer, unpack it and then call the appropriate BAP API
+
+  @param pctx : [in] ptr to the client context
+  @param pBuffer_ : [in] the input buffer containing the HCI command
+  @param Count_ : [in] size of the HCI command buffer
+
+  @return
+  TRUE if all OK, FALSE otherwise
+
+*/
+static BOOL BslProcessHCICommand
+(
+    BslClientCtxType* pctx,
+    LPCVOID pBuffer_,
+    DWORD Count_
+)
+{
+    LPVOID pBuffer = (LPVOID) pBuffer_; // castaway the const-ness of the ptr
+    v_U16_t Count = (v_U16_t) Count_;  // this should be OK max size < 1500
+    v_U32_t UnpackStatus;
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    BOOL Status;
+    BslPhyLinkCtxType* pPhyCtx;
+    tBtampHCI_Event HCIEvt;
+    v_U16_t x = 1;
+    int i = 0;
+
+    // the opcode is in LE, if we are LE too then this is fine else we need some
+    // byte swapping
+    v_U16_t cmdOpcode = *(UNALIGNED v_U16_t *)pBuffer;
+    v_U8_t *pBuf = (v_U8_t *)pBuffer;
+    v_U8_t *pTmp = (v_U8_t *)pBuf;
+
+    // TODO: do we really need to do this per call even though the op is quite cheap
+    if(*(v_U8_t *)&x == 0)
+    {
+        // BE
+        cmdOpcode = ( cmdOpcode & 0xFF ) << 8 | ( cmdOpcode & 0xFF00 ) >> 8;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslProcessHCICommand: cmdOpcode = %hx\n", cmdOpcode );
+
+    for(i=0; i<4; i++)
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: *pBuf before advancepTmp[%x] = %x\n", i,pTmp[i] );
+
+    pBuf+=CMD_TLV_TYPE_AND_LEN_SIZE;
+
+
+    switch ( cmdOpcode )
+    {
+        /** BT v3.0 Link Control commands */
+    case BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Create_Physical_Link_Cmd CreatePhysicalLinkCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Create_Physical_Link_Cmd( NULL,
+                       pBuf, Count, &CreatePhysicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        if(VOS_FALSE == WLANBAP_AmpConnectionAllowed())
+        {
+            VosStatus = WLANBAP_PhyLinkFailure(pctx, CreatePhysicalLinkCmd.phy_link_handle);
+            if ( VOS_STATUS_SUCCESS != VosStatus )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_PhyLinkFailure failed");
+                // handle the error
+                return(FALSE);
+            }
+            break;
+        }
+
+        // setup the per PHY link BAP context
+        Status = BslFindAndInitPhyCtx( pctx, CreatePhysicalLinkCmd.phy_link_handle,
+                                       &pPhyCtx );
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "CreatePhysicalLinkCmd.phy_link_handle=%d\n",CreatePhysicalLinkCmd.phy_link_handle);
+
+        if ( !Status )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: BslFindAndInitPhyCtx failed");
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPPhysicalLinkCreate( pctx->bapHdl,
+                                                &CreatePhysicalLinkCmd, pPhyCtx, &HCIEvt );
+
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkCreate failed status %d", VosStatus);
+            // handle the error
+            BslReleasePhyCtx( pPhyCtx );
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pPhyCtx, &HCIEvt, TRUE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            BslReleasePhyCtx( pPhyCtx );
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Accept_Physical_Link_Cmd AcceptPhysicalLinkCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Accept_Physical_Link_Cmd( NULL,
+                       pBuf, Count, &AcceptPhysicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Accept_Physical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        if(VOS_FALSE == WLANBAP_AmpConnectionAllowed())
+        {
+            VosStatus = WLANBAP_PhyLinkFailure(pctx, AcceptPhysicalLinkCmd.phy_link_handle);
+            if ( VOS_STATUS_SUCCESS != VosStatus )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_PhyLinkFailure failed");
+                // handle the error
+                return(FALSE);
+            }
+            break;
+        }
+
+        // setup the per PHY link BAP context
+        Status = BslFindAndInitPhyCtx( pctx, AcceptPhysicalLinkCmd.phy_link_handle,
+                                       &pPhyCtx );
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "AcceptPhysicalLinkCmd.phy_link_handle=%d\n",AcceptPhysicalLinkCmd.phy_link_handle);
+
+        if ( !Status )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: BslFindAndInitPhyCtx failed");
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPPhysicalLinkAccept( pctx->bapHdl,
+                                                &AcceptPhysicalLinkCmd, pPhyCtx, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkAccept failed status %d", VosStatus);
+            // handle the error
+            BslReleasePhyCtx( pPhyCtx );
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pPhyCtx, &HCIEvt, TRUE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            BslReleasePhyCtx( pPhyCtx );
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Disconnect_Physical_Link_Cmd DisconnectPhysicalLinkCmd;
+        Count = Count - 3;//Type and length field lengths are not needed
+        pTmp = pBuf;
+        for(i=0; i<4; i++)
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: *pBuf in Disconnect phy link pTmp[%x] = %x\n", i,pTmp[i] );
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd( NULL,
+                       pBuf, Count, &DisconnectPhysicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPPhysicalLinkDisconnect( pctx->bapHdl,
+                    &DisconnectPhysicalLinkCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkDisconnect failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Create_Logical_Link_Cmd CreateLogicalLinkCmd;
+        Count -= 3; //To send the correct length to unpack event
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Create_Logical_Link_Cmd( NULL,
+                       pBuf, Count, &CreateLogicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Create_Logical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPLogicalLinkCreate( pctx->bapHdl,
+                                               &CreateLogicalLinkCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkCreate failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Accept_Logical_Link_Cmd AcceptLogicalLinkCmd;
+        Count = Count - 3;//Subtract Type and Length fields
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Accept_Logical_Link_Cmd( NULL,
+                       pBuf, Count, &AcceptLogicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Accept_Logical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPLogicalLinkAccept( pctx->bapHdl,
+                                               &AcceptLogicalLinkCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkAccept failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD:
+    {
+        tBtampTLVHCI_Disconnect_Logical_Link_Cmd DisconnectLogicalLinkCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd( NULL,
+                       pBuf, Count, &DisconnectLogicalLinkCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPLogicalLinkDisconnect( pctx->bapHdl,
+                    &DisconnectLogicalLinkCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkDisconnect failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD:
+    {
+        tBtampTLVHCI_Logical_Link_Cancel_Cmd LogicalLinkCancelCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Logical_Link_Cancel_Cmd( NULL,
+                       pBuf, Count, &LogicalLinkCancelCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Logical_Link_Cancel_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPLogicalLinkCancel( pctx->bapHdl,
+                                               &LogicalLinkCancelCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkCancel failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD:
+    {
+        tBtampTLVHCI_Flow_Spec_Modify_Cmd FlowSpecModifyCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Flow_Spec_Modify_Cmd( NULL,
+                       pBuf, Count, &FlowSpecModifyCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Flow_Spec_Modify_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPFlowSpecModify( pctx->bapHdl,
+                                            &FlowSpecModifyCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPFlowSpecModify failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /*
+      Host Controller and Baseband Commands
+    */
+    case BTAMP_TLV_HCI_RESET_CMD:
+    {
+        VosStatus = WLAN_BAPReset( pctx->bapHdl );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReset failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_SET_EVENT_MASK_CMD:
+    {
+        tBtampTLVHCI_Set_Event_Mask_Cmd SetEventMaskCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Set_Event_Mask_Cmd( NULL,
+                       pBuf, Count, &SetEventMaskCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Event_Mask_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPSetEventMask( pctx->bapHdl,
+                                          &SetEventMaskCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetEventMask failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_FLUSH_CMD:
+    {
+        tBtampTLVHCI_Flush_Cmd FlushCmd;
+
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Flush_Cmd( NULL,
+                       pBuf, Count, &FlushCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Flush_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        /* Flush the TX queue */
+//#ifdef BAP_DEBUG
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s:HCI Flush command  - will flush Tx Queue", __FUNCTION__);
+//#endif //BAP_DEBUG
+        // JEZ100604: Temporary short cut
+        pPhyCtx = &BslPhyLinkCtx[0];
+        VosStatus = BslFlushTxQueues ( pPhyCtx);
+
+        /* Acknowledge the command */
+        VosStatus = WLAN_BAPFlush( pctx->bapHdl, &FlushCmd );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLAN_BAPFlush failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD:
+    {
+        tBtampTLVHCI_Enhanced_Flush_Cmd FlushCmd;
+
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Enhanced_Flush_Cmd( NULL,
+                                                             pBuf, Count, &FlushCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: btampUnpackTlvHCI_Enhanced_Flush_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        /* Flush the TX queue */
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:HCI Flush command  - will flush Tx Queue for pkt type %d", __FUNCTION__, FlushCmd.packet_type);
+        // We support BE traffic only
+        if(WLANTL_AC_BE == FlushCmd.packet_type)
+        {
+            pPhyCtx = &BslPhyLinkCtx[0];
+            VosStatus = BslFlushTxQueues ( pPhyCtx);
+        }
+
+        /* Acknowledge the command */
+        VosStatus = WLAN_EnhancedBAPFlush( pctx->bapHdl, &FlushCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLAN_EnahncedBAPFlush failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD:
+    {
+        VosStatus = WLAN_BAPReadConnectionAcceptTimeout( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadConnectionAcceptTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd WriteConnectionAcceptTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd( NULL,
+                       pBuf, Count, &WriteConnectionAcceptTimeoutCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteConnectionAcceptTimeout( pctx->bapHdl,
+                    &WriteConnectionAcceptTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteConnectionAcceptTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd ReadLinkSupervisionTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd( NULL,
+                       pBuf, Count, &ReadLinkSupervisionTimeoutCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadLinkSupervisionTimeout( pctx->bapHdl,
+                    &ReadLinkSupervisionTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLinkSupervisionTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd WriteLinkSupervisionTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd( NULL,
+                       pBuf, Count, &WriteLinkSupervisionTimeoutCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteLinkSupervisionTimeout( pctx->bapHdl,
+                    &WriteLinkSupervisionTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLinkSupervisionTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /* v3.0 Host Controller and Baseband Commands */
+    case BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD:
+    {
+        VosStatus = WLAN_BAPReadLogicalLinkAcceptTimeout( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLogicalLinkAcceptTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd WriteLogicalLinkAcceptTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd( NULL,
+                       pBuf, Count, &WriteLogicalLinkAcceptTimeoutCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteLogicalLinkAcceptTimeout( pctx->bapHdl,
+                    &WriteLogicalLinkAcceptTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLogicalLinkAcceptTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD:
+    {
+        tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd SetEventMaskPage2Cmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd( NULL,
+                       pBuf, Count, &SetEventMaskPage2Cmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPSetEventMaskPage2( pctx->bapHdl,
+                                               &SetEventMaskPage2Cmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetEventMaskPage2 failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD:
+    {
+        VosStatus = WLAN_BAPReadLocationData( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocationData failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD:
+    {
+        tBtampTLVHCI_Write_Location_Data_Cmd WriteLocationDataCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Location_Data_Cmd( NULL,
+                       pBuf, Count, &WriteLocationDataCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Location_Data_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteLocationData( pctx->bapHdl,
+                                               &WriteLocationDataCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLocationData failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD:
+    {
+        VosStatus = WLAN_BAPReadFlowControlMode( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadFlowControlMode failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD:
+    {
+        tBtampTLVHCI_Write_Flow_Control_Mode_Cmd WriteFlowControlModeCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd( NULL,
+                       pBuf, Count, &WriteFlowControlModeCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteFlowControlMode( pctx->bapHdl,
+                    &WriteFlowControlModeCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteFlowControlMode failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd ReadBestEffortFlushTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd( NULL,
+                       pBuf, Count, &ReadBestEffortFlushTimeoutCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadBestEffortFlushTimeout( pctx->bapHdl,
+                    &ReadBestEffortFlushTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadBestEffortFlushTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD:
+    {
+        tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd WriteBestEffortFlushTimeoutCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd( NULL,
+                       pBuf, Count, &WriteBestEffortFlushTimeoutCmd);
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteBestEffortFlushTimeout( pctx->bapHdl,
+                    &WriteBestEffortFlushTimeoutCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteBestEffortFlushTimeout failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /** opcode definition for this command from AMP HCI CR D9r4 markup */
+    case BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD:
+    {
+        tBtampTLVHCI_Set_Short_Range_Mode_Cmd SetShortRangeModeCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd( NULL,
+                       pBuf, Count, &SetShortRangeModeCmd);
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPSetShortRangeMode( pctx->bapHdl,
+                                               &SetShortRangeModeCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetShortRangeMode failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /* End of v3.0 Host Controller and Baseband Commands */
+    /*
+       Informational Parameters
+    */
+    case BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD:
+    {
+        VosStatus = WLAN_BAPReadLocalVersionInfo( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalVersionInfo failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD:
+    {
+        VosStatus = WLAN_BAPReadLocalSupportedCmds( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalSupportedCmds failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD:
+    {
+        VosStatus = WLAN_BAPReadBufferSize( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadBufferSize failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /* v3.0 Informational commands */
+    case BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD:
+    {
+        VosStatus = WLAN_BAPReadDataBlockSize( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadDataBlockSize failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /*
+      Status Parameters
+    */
+    case BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD:
+    {
+        tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd ReadFailedContactCounterCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd( NULL,
+                       pBuf, Count, &ReadFailedContactCounterCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadFailedContactCounter( pctx->bapHdl,
+                    &ReadFailedContactCounterCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadFailedContactCounter failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD:
+    {
+        tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd ResetFailedContactCounterCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd( NULL,
+                       pBuf, Count, &ResetFailedContactCounterCmd);
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPResetFailedContactCounter( pctx->bapHdl,
+                    &ResetFailedContactCounterCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPResetFailedContactCounter failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD:
+    {
+        tBtampTLVHCI_Read_Link_Quality_Cmd ReadLinkQualityCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Link_Quality_Cmd( NULL,
+                       pBuf, Count, &ReadLinkQualityCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Link_Quality_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadLinkQuality( pctx->bapHdl,
+                                             &ReadLinkQualityCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLinkQuality failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_RSSI_CMD:
+    {
+        tBtampTLVHCI_Read_RSSI_Cmd ReadRssiCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_RSSI_Cmd( NULL,
+                       pBuf, Count, &ReadRssiCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_RSSI_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadRSSI( pctx->bapHdl,
+                                      &ReadRssiCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadRSSI failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD:
+    {
+        tBtampTLVHCI_Read_Local_AMP_Information_Cmd ReadLocalAmpInformationCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd( NULL,
+                       pBuf, Count, &ReadLocalAmpInformationCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadLocalAMPInfo( pctx->bapHdl,
+                                              &ReadLocalAmpInformationCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalAMPInfo failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD:
+    {
+        tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd ReadLocalAmpAssocCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd( NULL,
+                       pBuf, Count, &ReadLocalAmpAssocCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadLocalAMPAssoc( pctx->bapHdl,
+                                               &ReadLocalAmpAssocCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalAMPAssoc failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD:
+    {
+        tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd WriteRemoteAmpAssocCmd;
+        // unpack
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: HCI_Write_Remote_AMP_ASSOC_Cmd Count = %d", Count);
+        DUMPLOG(1, __FUNCTION__, "HCI_Write_Remote_AMP_ASSOC cmd",
+                pBuf,
+                Count);
+
+        UnpackStatus = btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd( NULL,
+                       pBuf, Count, &WriteRemoteAmpAssocCmd );
+
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WriteRemoteAmpAssocCmd.amp_assoc_remaining_length = %d",
+                   WriteRemoteAmpAssocCmd.amp_assoc_remaining_length
+                 );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+//#define BAP_UNIT_TEST
+#ifdef BAP_UNIT_TEST
+        {
+            unsigned char test_amp_assoc_fragment[] =
+            {
+                0x01, 0x00, 0x06, 0x00, 0x00, 0xde, 0xad, 0xbe,
+                0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+                0x0c, 0x00, 0x55, 0x53, 0x20, 0xc9, 0x0c, 0x00,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x55, 0x53,
+                0x20, 0xc9, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x00, 0x00,
+                0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00,
+                0x00, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x00, 0x00
+            };
+            WriteRemoteAmpAssocCmd.present = 1;
+            WriteRemoteAmpAssocCmd.phy_link_handle = 1;
+            WriteRemoteAmpAssocCmd.length_so_far = 0;
+            WriteRemoteAmpAssocCmd.amp_assoc_remaining_length = 74;
+            /* Set the amp_assoc_fragment to the right values of MAC addr and
+             * channels
+             */
+            vos_mem_copy(
+                WriteRemoteAmpAssocCmd.amp_assoc_fragment,
+                test_amp_assoc_fragment,
+                sizeof( test_amp_assoc_fragment));
+
+        }
+#endif
+
+        VosStatus = WLAN_BAPWriteRemoteAMPAssoc( pctx->bapHdl,
+                    &WriteRemoteAmpAssocCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteRemoteAMPAssoc failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    /*
+      Debug Commands
+    */
+    case BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD:
+    {
+        tBtampTLVHCI_Read_Loopback_Mode_Cmd ReadLoopbackModeCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Read_Loopback_Mode_Cmd( NULL,
+                       pBuf, Count, &ReadLoopbackModeCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Loopback_Mode_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPReadLoopbackMode( pctx->bapHdl,
+                                              &ReadLoopbackModeCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLoopbackMode failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD:
+    {
+        tBtampTLVHCI_Write_Loopback_Mode_Cmd WriteLoopbackModeCmd;
+        // unpack
+        UnpackStatus = btampUnpackTlvHCI_Write_Loopback_Mode_Cmd( NULL,
+                       pBuf, Count, &WriteLoopbackModeCmd );
+
+        if ( !BTAMP_SUCCEEDED( UnpackStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Loopback_Mode_Cmd failed status %d", UnpackStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        VosStatus = WLAN_BAPWriteLoopbackMode( pctx->bapHdl,
+                                               &WriteLoopbackModeCmd, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLoopbackMode failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0:
+    {
+        VosStatus = WLAN_BAPVendorSpecificCmd0( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPVendorSpecificCmd0 failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    case BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_1:
+    {
+        VosStatus = WLAN_BAPVendorSpecificCmd1( pctx->bapHdl, &HCIEvt );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPVendorSpecificCmd1 failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+        break;
+    }
+    default:
+    {
+        /* Unknow opcode. Return a command status event...with "Unknown Opcode" status  */
+
+        /* Format the command status event to return... */
+        HCIEvt.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
+        HCIEvt.u.btampCommandStatusEvent.present = 1;
+        HCIEvt.u.btampCommandStatusEvent.status = WLANBAP_ERROR_UNKNOWN_HCI_CMND;
+        HCIEvt.u.btampCommandStatusEvent.num_hci_command_packets = 1;
+        HCIEvt.u.btampCommandStatusEvent.command_opcode
+        = cmdOpcode;
+
+        // this may look strange as this is the function registered
+        // with BAP for the EventCB but we are also going to use it
+        // as a helper function. The difference is that this invocation
+        // runs in HCI command sending caller context while the callback
+        // will happen in BAP's context whatever that may be
+        VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus);
+            // handle the error
+            return(FALSE);
+        }
+
+
+        break;
+    }
+    }
+
+    return(TRUE);
+} // BslProcessHCICommand()
+
+
+/**
+  @brief BslProcessACLDataTx() - This function will process an egress ACL data packet
+
+  @param pctx : [in] ptr to the client context
+  @param pBuffer_ : [in] ptr to the buffer containing the ACL data packet
+  @param pCount : [in] size of the ACL data packet buffer
+
+  @return
+  TRUE if all OK, FALSE otherwise
+
+*/
+#define BTAMP_USE_VOS_WRAPPER
+//#undef BTAMP_USE_VOS_WRAPPER
+#ifdef BTAMP_USE_VOS_WRAPPER
+static BOOL BslProcessACLDataTx
+(
+    BslClientCtxType* pctx,
+    struct sk_buff *skb,
+    v_SIZE_t* pCount
+)
+#else
+static BOOL BslProcessACLDataTx
+(
+    BslClientCtxType* pctx,
+    LPCVOID pBuffer_,
+    v_SIZE_t* pCount
+)
+#endif
+{
+#ifndef BTAMP_USE_VOS_WRAPPER
+    LPVOID pBuffer = (LPVOID) pBuffer_; // castaway const-ness of ptr
+#endif
+    BOOL findPhyStatus;
+    BslPhyLinkCtxType* pPhyCtx;
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    WLANTL_ACEnumType Ac;
+    hdd_list_node_t* pLink;
+    BslTxListNodeType *pNode;
+    v_SIZE_t ListSize;
+    // I will access the skb in a VOSS packet
+#ifndef BTAMP_USE_VOS_WRAPPER
+    struct sk_buff *skb;
+#endif
+#if 0
+    static int num_packets = 0;
+#endif
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslProcessACLDataTx\n" );
+
+    // need to find the PHY link for this ACL data pkt based on phy_link_handle
+    // TODO need some endian-ness check?
+    ////findPhyStatus = BslFindPhyCtx( pctx, *(v_U8_t *)skb->data, &pPhyCtx );
+    //findPhyStatus = BslFindPhyCtx( pctx, *(v_U8_t *)pBuffer, &pPhyCtx );
+    // JEZ100604: Temporary short cut
+    pPhyCtx = &BslPhyLinkCtx[0];
+    findPhyStatus = VOS_TRUE;
+
+    if ( findPhyStatus )
+    {
+        //Use the skb->cb field to hold the list node information
+        pNode = (BslTxListNodeType *) &skb->cb;
+
+        // This list node info includes the VOS pkt
+        pNode->skb = skb;
+
+        // stick the SKB into the node
+        pLink = (hdd_list_node_t *) pNode;
+        VosStatus = WLANBAP_GetAcFromTxDataPkt(pctx->bapHdl, skb->data, &Ac);
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx WLANBAP_GetAcFromTxDataPkt "
+                 "failed status =%d\n", VosStatus );
+
+            Ac = WLANTL_AC_BE;
+        }
+
+        // now queue the pkt into the correct queue
+        // We will want to insert a node of type BslTxListNodeType (was going to be vos_pkt_list_node_t)
+        spin_lock_bh(&pPhyCtx->ACLTxQueue[Ac].lock);
+        VosStatus = hdd_list_insert_back( &pPhyCtx->ACLTxQueue[Ac], pLink );
+        spin_unlock_bh(&pPhyCtx->ACLTxQueue[Ac].lock);
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_ASSERT(0);
+        }
+
+        // determine if there is a need to signal TL through BAP
+        hdd_list_size( &pPhyCtx->ACLTxQueue[Ac], &ListSize );
+
+        if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+        {
+            VOS_ASSERT(0);
+        }
+
+        if ( ListSize == 1 )
+        {
+            // Let TL know we have a packet to send for this AC
+            VosStatus = WLANBAP_STAPktPending( pctx->bapHdl, pPhyCtx->PhyLinkHdl, Ac );
+
+            if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+            {
+                VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx WLANBAP_STAPktPending "
+                "failed status =%d\n", VosStatus );
+                VOS_ASSERT(0);
+            }
+        }
+
+        return(TRUE);
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx attempting to send "
+          "data for a non-existant assocation\n" );
+
+        return(FALSE);
+    }
+
+
+} // BslProcessACLDataTx()
+
+
+static inline void *hci_get_drvdata(struct hci_dev *hdev)
+{
+    return hdev->driver_data;
+}
+
+static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
+{
+    hdev->driver_data = data;
+}
+
+/*---------------------------------------------------------------------------
+ *   Function definitions
+ *-------------------------------------------------------------------------*/
+
+/**---------------------------------------------------------------------------
+
+  \brief BSL_Init() - Initialize the BSL Misc char driver
+
+  This is called in vos_open(), right after WLANBAP_Open(), as part of
+  bringing up the BT-AMP PAL (BAP)
+  vos_open() will pass in the VOS context. In which a BSL context can be created.
+
+  \param  - NA
+
+  \return - 0 for success non-zero for failure
+
+  --------------------------------------------------------------------------*/
+//int BSL_Init (void *pCtx)
+int BSL_Init ( v_PVOID_t  pvosGCtx )
+{
+    BslClientCtxType* pctx = NULL;
+    ptBtampHandle bapHdl = NULL;        // our handle in BAP
+    //ptBtampContext  pBtampCtx = NULL;
+    int err = 0;
+    struct hci_dev *hdev = NULL;
+    //struct net_device *dev = NULL; // Our parent wlan network device
+    hdd_adapter_t *pAdapter = NULL;  // Used to retrieve the parent WLAN device
+    hdd_context_t *pHddCtx = NULL;
+    hdd_config_t *pConfig = NULL;
+    hdd_adapter_list_node_t *pAdapterNode = NULL;
+    VOS_STATUS status;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Init");
+
+    /*------------------------------------------------------------------------
+      Allocate (and sanity check?!) BSL control block
+     ------------------------------------------------------------------------*/
+    //vos_alloc_context(pvosGCtx, VOS_MODULE_ID_BSL, (v_VOID_t**)&pctx, sizeof(BslClientCtxType));
+    pctx = &BslClientCtx[0];
+
+    bapHdl = vos_get_context( VOS_MODULE_ID_BAP, pvosGCtx);
+    if ( NULL == bapHdl )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BAP pointer from pvosGCtx on BSL_Init");
+        return VOS_STATUS_E_FAULT;
+    }
+    // Save away the btamp (actually the vos) context
+    gpCtx = pvosGCtx;
+
+    /* Save away the pointer to the BT-AMP PAL context in the BSL driver context */
+    pctx->bapHdl = bapHdl;
+
+    /* Save away the pointer to the BSL driver context in a global (fix this) */
+    gpBslctx = pctx;
+
+    /* Initialize all the Phy Contexts to un-used */
+    BslInitPhyCtx();
+
+    /* Initialize the Rx fields in the HCI driver context */
+    //pctx->rx_state = RECV_WAIT_PACKET_TYPE;
+    pctx->rx_count = 0;
+    pctx->rx_skb = NULL;
+
+    /* JEZ100713: Temporarily the Tx skb queue will have depth one.*/
+    // Don't disturb tx_skb
+    //pctx->tx_skb = NULL;
+    //pctx->tx_skb = alloc_skb(WLANBAP_MAX_80211_PAL_PDU_SIZE+12, GFP_ATOMIC);
+
+    pctx->hdev = NULL;
+    //Get the HDD context.
+    pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, pvosGCtx );
+    if(NULL != pHddCtx)
+    {
+        pConfig = pHddCtx->cfg_ini;
+    }
+    if(NULL == pConfig)
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                  "Didn't register as HCI device");
+        return 0;
+    }
+    else if(0 == pConfig->enableBtAmp)
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
+                  "Didn't register as HCI device, user option(gEnableBtAmp) is set to 0");
+        return 0;
+    }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if (VOS_STA_SAP_MODE == hdd_get_conparam())
+    {
+        status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+        if ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+        {
+            if ( WLAN_HDD_SOFTAP == pAdapterNode->pAdapter->device_mode)
+            {
+                pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP);
+            }
+            else if (WLAN_HDD_P2P_GO == pAdapterNode->pAdapter->device_mode)
+            {
+                pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_GO);
+            }
+        }
+     }
+    else
+#endif
+        pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+
+
+    if ( NULL == pAdapter )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid HDD Adapter pointer from pvosGCtx on BSL_Init");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Save away the pointer to the parent WLAN device in BSL driver context */
+    pctx->p_dev = pAdapter->dev;
+
+    /* Initialize HCI device */
+    hdev = hci_alloc_dev();
+    if (!hdev)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Can't allocate HCI device in BSL_Init");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Save away the HCI device pointer in the BSL driver context */
+    pctx->hdev = hdev;
+
+#if defined HCI_80211 || defined HCI_AMP
+#define BUILD_FOR_BLUETOOTH_NEXT_2_6
+#else
+#undef BUILD_FOR_BLUETOOTH_NEXT_2_6
+#endif
+
+#ifdef BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* HCI "bus type" of HCI_VIRTUAL should apply */
+    hdev->bus = HCI_VIRTUAL;
+    /* Set the dev_type to BT-AMP 802.11 */
+#ifdef HCI_80211
+    hdev->dev_type = HCI_80211;
+#else
+    hdev->dev_type = HCI_AMP;
+#endif
+#ifdef FEATURE_WLAN_BTAMP_UT
+    /* For the "real" BlueZ build, DON'T Set the device "quirks" to indicate RAW */
+    set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+#endif
+#else //BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* HCI "bus type" of HCI_VIRTUAL should apply */
+    hdev->type = HCI_VIRTUAL;
+    /* Set the dev_type to BT-AMP 802.11 */
+    //hdev->dev_type = HCI_80211;
+    ////hdev->dev_type = HCI_AMP;
+    /* For the "temporary" BlueZ build, Set the device "quirks" to indicate RAW */
+    set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+#endif //BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* Save away the BSL driver pointer in the HCI device context */
+
+    hci_set_drvdata(hdev, pctx);
+    /* Set the parent device for this HCI device.  This is our WLAN net_device */
+    SET_HCIDEV_DEV(hdev, &pctx->p_dev->dev);
+
+    hdev->open     = BSL_Open;
+    hdev->close    = BSL_Close;
+    hdev->flush    = BSL_Flush;
+    hdev->send     = BSL_Write;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+    hdev->destruct = BSL_Destruct;
+    hdev->owner = THIS_MODULE;
+#endif
+    hdev->ioctl    = BSL_IOControl;
+
+
+    /* Timeout before it is safe to send the first HCI packet */
+    msleep(1000);
+
+    /* Register HCI device */
+    err = hci_register_dev(hdev);
+    if (err < 0)
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "Unable to register HCI device, err=%d\n", err);
+        pctx->hdev = NULL;
+        hci_free_dev(hdev);
+        return -ENODEV;
+    }
+
+    pHddCtx->isAmpAllowed = VOS_TRUE;
+    return 0;
+} // BSL_Init()
+
+/**---------------------------------------------------------------------------
+
+  \brief BSL_Deinit() - De-initialize the BSL Misc char driver
+
+  This is called in by WLANBAP_Close() as part of bringing down the BT-AMP PAL (BAP)
+
+  \param  - NA
+
+  \return - 0 for success non-zero for failure
+
+  --------------------------------------------------------------------------*/
+
+int BSL_Deinit( v_PVOID_t  pvosGCtx )
+{
+    //int err = 0;
+    struct hci_dev *hdev;
+    BslClientCtxType* pctx = NULL;
+
+    //pctx = vos_get_context( VOS_MODULE_ID_BSL, pvosGCtx);
+    pctx = gpBslctx;
+
+    if ( NULL == pctx )
+    {
+        //VOS_TRACE( VOS_MODULE_ID_BSL, VOS_TRACE_LEVEL_ERROR,
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pvosGCtx on BSL_Init");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Retrieve the HCI device pointer from the BSL driver context */
+    hdev = pctx->hdev;
+
+    if (!hdev)
+        return 0;
+
+    /* hci_unregister_dev is called again here, in case user didn't call it */
+    /* Unregister device from BlueZ; fcn sends us HCI commands before it returns */
+    /* And then the registered hdev->close fcn should be called by BlueZ (BSL_Close) */
+    hci_unregister_dev(hdev);
+    /* BSL_Close is called again here, in case BlueZ didn't call it */
+    BSL_Close(hdev);
+    hci_free_dev(hdev);
+    pctx->hdev = NULL;
+
+    return 0;
+} // BSL_Deinit()
+
+
+/**
+  @brief BSL_Open() - This function opens a device for reading, and writing.
+  An application indirectly invokes this function when it calls the fopen()
+  system call to open a special device file names.
+
+  @param *hdev : [in] pointer to the open HCI device structure.
+  BSL_Init (Device Manager) function creates and stores this HCI
+  device context in the BSL context.
+
+  @return
+  This function returns a status code.  Negative codes are failures.
+
+  NB: I don't seem to be following this convention.
+*/
+//static int BSL_Open(struct inode *pInode, struct file *pFile)
+static int BSL_Open( struct hci_dev *hdev )
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    BslClientCtxType* pctx = (BslClientCtxType *)(hci_get_drvdata(hdev));
+    v_U16_t i;
+    BOOL rval;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Open");
+
+    /*  you can only open a btamp device one time */
+    if (bBslInited)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BSL_Open: Already Opened.");
+        return -EPERM; /* Operation not permitted */
+    }
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSLClientLock already inited");
+        // return -EIO;  /* I/O error */
+        return 0;
+    }
+
+    VosStatus = vos_list_init( &BslPhyLinksDescPool );
+
+    if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) )
+    {
+        //return -EIO;  /* I/O error */
+        return 0;
+    }
+
+    // now we need to populate this pool with the free pkt desc from the array
+    for ( i=0; i<BSL_MAX_PHY_LINKS; i++ )
+    {
+        VosStatus = vos_list_insert_front( &BslPhyLinksDescPool, &BslPhyLinksDesc[i].node );
+        VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+    }
+
+    // This is redundent.  See the check above on (fp->private_data != NULL)
+    bBslInited = TRUE;
+
+    rval = BslFindAndInitClientCtx( &pctx );
+
+    if(rval != TRUE)
+    {
+        // Where is the clean-up in case the above BslFindAndInitClientCtx() call
+        // fails?
+        //return -EIO;  /* I/O error */
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSLFindAndInitClientContext failed");
+        return 0;
+    }
+
+
+    /* Let Linux fopen() know everything is all right */
+    return 0;
+} // BSL_Open()
+
+/**
+  @brief BSL_Close() - This function closes a device context created by
+  BSL_Open(). May be called more than once during AMP PAL shut down.
+
+  @param *hdev : [in] pointer to the open HCI device structure.
+  BSL_Init (Device Manager) function creates and stores this HCI
+  device context in the BSL context.
+
+  @return
+  TRUE indicates success. FALSE indicates failure.
+*/
+//static int BSL_Close (struct inode *pInode, struct file *pFile)
+static int BSL_Close ( struct hci_dev *hdev )
+{
+    VOS_STATUS VosStatus = VOS_STATUS_SUCCESS;
+    BslClientCtxType* pctx;
+    vos_list_node_t* pLink;
+    v_U16_t i;
+    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+    hdd_context_t *pHddCtx;
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Close");
+    if (NULL != pVosContext)
+    {
+       pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+       if (NULL != pHddCtx)
+       {
+          pHddCtx->isAmpAllowed = VOS_FALSE;
+       }
+    }
+
+    // it may seem there is some risk here because we are using a value
+    // passed into us as a pointer. what if this pointer is 0 or points to
+    // someplace bad? as it turns out the caller is device manager and not
+    // the application. kernel should trap such invalid access but we will check
+    // for NULL pointer
+    if ( hdev == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Close: NULL hdev specified");
+        return FALSE;
+    }
+
+    pctx = (BslClientCtxType *)(hci_get_drvdata(hdev));
+
+    if ( pctx == NULL || !bBslInited)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BSL_Close: %s is not open", hdev->name);
+        return TRUE;
+    }
+
+    // need to cleanup any per PHY state and the common RX state
+    BslReleaseClientCtx( pctx );
+    for ( i=0; i<BslPhyLinksDescPool.count; i++ )
+    {
+        VosStatus = vos_list_remove_front( &BslPhyLinksDescPool, &pLink );
+        //nothing to free as the nodes came from BslPhyLinksDesc, which is a static
+        //this is needed to allow vos_list_destroy() to go through
+    }
+    VosStatus = vos_list_destroy( &BslPhyLinksDescPool );
+
+    VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus ) );
+
+
+    bBslInited = FALSE;
+
+// The next line is temporary
+    return(0);
+} //BSL_Close()
+
+/**
+  @brief BSL_IOControl() - This function sends a command to a device.
+
+  @param *hdev : [in] pointer to the open HCI device structure.
+  @param cmd : [in] I/O control operation to perform. These codes are
+  device-specific and are usually exposed to developers through a header file.
+  @param arg : [in] Additional input parameter.
+
+  @return
+  TRUE indicates success. FALSE indicates failure.
+*/
+//static long BSL_IOControl(struct file *pFile, unsigned int cmd, unsigned long arg)
+static int BSL_IOControl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
+{
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_IOControl - not supported");
+    return(TRUE);
+} // BSL_IOControl()
+
+/**
+  @brief BSL_Flush() - This function flushes all pending commands on a device.
+
+  @param *hdev : [in] pointer to the open HCI device structure.
+
+  @return
+  TRUE indicates success. FALSE indicates failure.
+*/
+static int BSL_Flush(struct hci_dev *hdev)
+{
+    VOS_STATUS VosStatus;
+    BslPhyLinkCtxType* pPhyCtx;
+
+    //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Flush - will flush ALL Tx Queues");
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s - will flush ALL Tx Queues", __FUNCTION__);
+
+    /* Flush the TX queue */
+    // JEZ100604: Temporary short cut
+    pPhyCtx = &BslPhyLinkCtx[0];
+
+    VosStatus = BslFlushTxQueues ( pPhyCtx);
+
+    //return(TRUE);
+    return(0);
+} // BSL_Flush()
+
+/**
+  @brief BSL_Destruct() - This function destroys an HCI device.
+
+  @param *hdev : [in] pointer to the open HCI device structure.
+
+  @return
+  TRUE indicates success. FALSE indicates failure.
+*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+static void BSL_Destruct(struct hci_dev *hdev)
+{
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Destruct - not supported");
+    return; //(TRUE);
+} // BSL_Destruct()
+#endif
+
+
+/**
+  @brief BSL_Write() - This function writes data to the device.
+  An application indirectly invokes this function when it calls the fwrite()
+  system call to write to a special device file.
+
+  @param *skb : [in] pointer to the skb being transmitted. This skb contains
+  the HCI command or HCI data.  Also a pointer (hdev) to the HCI device struct
+
+  @return
+  The number of bytes written indicates success.
+  Negative values indicate various failures.
+*/
+//static ssize_t BSL_Write(struct file *pFile, const char __user *pBuffer,
+//                         size_t Count, loff_t *pOff)
+static int BSL_Write(struct sk_buff *skb)
+{
+    struct hci_dev *hdev;
+    BslClientCtxType* pctx;
+    v_SIZE_t written = 0;
+    BOOL status;
+    //char *bslBuff = NULL;
+    BslHciWorkStructure *pHciContext;
+
+    //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s", __FUNCTION__);
+
+    // Sanity check inputs
+    if ( skb == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is bad i/p", __FUNCTION__);
+        //return -EFAULT; /* Bad address */
+        return 0;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Count (skb->len)=%d", __FUNCTION__, skb->len);
+
+    // Sanity check inputs
+    if ( 0 == skb->len )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is empty", __FUNCTION__);
+        //return -EFAULT; /* Bad address */
+        return 0;
+    }
+
+    hdev = (struct hci_dev *)(skb->dev);
+
+    // Sanity check the HCI device in the skb
+    if ( hdev == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Frame for Unknown HCI device (hdev=NULL)", __FUNCTION__);
+        //return -ENODEV; /* no device */
+        return 0;
+    }
+
+    pctx = (BslClientCtxType *)hci_get_drvdata(hdev);
+
+    // Sanity check inputs
+    if ( pctx == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx is bad i/p", __FUNCTION__);
+        //return -EFAULT; /* Bad address */
+        return 0;
+        /* Maybe I should return "no device" */
+        //return -ENODEV; /* no device */
+    }
+
+    // Switch for each case of packet type
+    switch (bt_cb(skb)->pkt_type)
+    {
+    case HCI_ACLDATA_PKT:
+        // Directly execute the data write
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "%s: HCI ACL data tx, skb=%p",
+                  __FUNCTION__, skb);
+        // ACL data
+        hdev->stat.acl_tx++;
+        // Correct way of doing this...
+        written = skb->len;
+#ifdef BTAMP_USE_VOS_WRAPPER
+        status = BslProcessACLDataTx( pctx, skb, &written );
+#else
+        status = BslProcessACLDataTx( pctx, skb->data, &written );
+        // Free up the skb
+        kfree_skb(skb);
+#endif //BTAMP_USE_VOS_WRAPPER
+        break;
+    case HCI_COMMAND_PKT:
+        // Defer the HCI command writes
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HCI command", __FUNCTION__);
+        hdev->stat.cmd_tx++;
+
+        // Allocate an HCI context. To use as a "container" for the "work" to be deferred.
+        pHciContext = kmalloc(sizeof(*pHciContext), GFP_ATOMIC);
+        if (NULL == pHciContext)
+        {
+            // no memory for HCI context.  Nothing we can do but drop
+            VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                      "%s: Unable to allocate context", __FUNCTION__);
+            kfree_skb(skb);
+            return 0;
+        }
+
+        // save away the tx skb in the HCI context...so it can be
+        // retrieved by the work procedure.
+        pHciContext->tx_skb = skb;
+        // save away the pctx context...so it can be retrieved by the work procedure.
+        pHciContext->pctx = pctx;
+        pHciContext->magic = BT_AMP_HCI_CTX_MAGIC;
+        INIT_WORK(&pHciContext->hciInterfaceProcessing,
+                  bslWriteFinish);
+
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "%s: Scheduling work for skb %p, BT-AMP Client context %p, work %p",
+                  __FUNCTION__, skb, pctx, pHciContext);
+
+        status = schedule_work(&pHciContext->hciInterfaceProcessing);
+
+        // Check result
+        if ( 0 == status )
+        {
+            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: hciInterfaceProcessing work already queued. This should never happen.", __FUNCTION__);
+        }
+
+
+        // Temporary way of doing this
+        //written = skb->len-CMD_TLV_TYPE_AND_LEN_SIZE;
+        written = skb->len;
+        break;
+    case HCI_SCODATA_PKT:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: unknown type", __FUNCTION__);
+        hdev->stat.sco_tx++;
+        // anything else including HCI events and SCO data
+        status = FALSE;
+        // Free up the skb
+        kfree_skb(skb);
+        break;
+    default:
+        // anything else including HCI events and SCO data
+        status = FALSE;
+        // Free up the skb
+        kfree_skb(skb);
+        break;
+    };
+
+
+    // JEZ100809: For the HCI command, will the caller need to wait until the work takes place and
+    // return the ACTUAL amount of data written.
+
+// The next line is temporary
+    //written = skb->len;
+    return(written);
+} // BSL_Write()
+
+/**
+  @brief bslWriteFinish() - This function finished the writes operation
+  started by BSL_Write().
+
+  @param work     : [in]  pointer to work structure
+
+  @return         : void
+
+*/
+static void bslWriteFinish(struct work_struct *work)
+{
+    //BslClientCtxType* pctx =
+    //    container_of(work, BslClientCtxType, hciInterfaceProcessing);
+    BslHciWorkStructure *pHciContext =
+        container_of(work, BslHciWorkStructure, hciInterfaceProcessing);
+    BslClientCtxType* pctx = pHciContext->pctx;
+    VOS_STATUS status;
+    struct sk_buff *skb;
+    struct hci_dev *hdev;
+    //char *bslBuff = NULL;
+    v_SIZE_t written = 0;
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+              "%s: Entered, context %p",
+              __FUNCTION__, pctx);
+
+    // Sanity check inputs
+    if ( pctx == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx is bad i/p", __FUNCTION__);
+        return; // -EFAULT; /* Bad address */
+    }
+
+    //skb = pctx->tx_skb;
+    skb = pHciContext->tx_skb;
+    kfree( pHciContext);
+
+    // Sanity check inputs
+    if ( skb == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is bad i/p", __FUNCTION__);
+        return; // -EFAULT; /* Bad address */
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Count (skb->len)=%d", __FUNCTION__, skb->len);
+
+    hdev = (struct hci_dev *)(skb->dev);
+
+    // Sanity check the HCI device in the skb
+    if ( hdev == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Frame for Unknown HCI device (hdev=NULL)", __FUNCTION__);
+        return; // -ENODEV; /* no device */
+    }
+
+
+    // Sanity check inputs
+    if ( pctx != (BslClientCtxType *)hci_get_drvdata(hdev));
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx and hdev not consistent - bad i/p", __FUNCTION__);
+        return; // -EFAULT; /* Bad address */
+        /* Maybe I should return "no device" */
+        //return -ENODEV; /* no device */
+    }
+
+    // Switch for each case of packet type
+    switch (bt_cb(skb)->pkt_type)
+    {
+    case HCI_COMMAND_PKT:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HCI command", __FUNCTION__);
+        hdev->stat.cmd_tx++;
+        // HCI command
+        status = BslProcessHCICommand( pctx, skb->data, skb->len-CMD_TLV_TYPE_AND_LEN_SIZE);
+        // Temporary way of doing this
+        //written = skb->len-CMD_TLV_TYPE_AND_LEN_SIZE;
+        written = skb->len;
+        break;
+    case HCI_SCODATA_PKT:
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: unknown type", __FUNCTION__);
+        hdev->stat.sco_tx++;
+        // anything else including HCI events and SCO data
+        status = FALSE;
+        break;
+    default:
+        // anything else including HCI events and SCO data
+        status = FALSE;
+        break;
+    };
+
+    VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
+              "%s: Freeing skb %p",
+              __FUNCTION__, skb);
+
+    consume_skb(skb);
+
+// How do I return the actual number of bytes written to the caller?
+//   return(written);
+    return;
+} //bslWriteFinish()
+
+VOS_STATUS WLANBAP_SetConfig
+(
+    WLANBAP_ConfigType *pConfig
+)
+{
+    BslClientCtxType* pctx;
+    VOS_STATUS status;
+    // sanity checking
+    if ( pConfig == NULL )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig bad input\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+    pctx = gpBslctx;
+    if ( NULL == pctx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pctx on WLANBAP_SetConfig");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    // get a handle from BAP
+    status = WLANBAP_GetNewHndl(&pctx->bapHdl);
+    if ( !VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig can't get BAP handle\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+
+    status = WLAN_BAPSetConfig(pctx->bapHdl, pConfig);
+    if ( !VOS_IS_STATUS_SUCCESS( status ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig can't set BAP config\n" );
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    return(VOS_STATUS_SUCCESS);
+}
+
+VOS_STATUS WLANBAP_RegisterWithHCI(hdd_adapter_t *pAdapter)
+{
+    struct hci_dev *hdev = NULL;
+    BslClientCtxType* pctx = NULL;
+    int err = 0;
+    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+    hdd_context_t *pHddCtx;
+
+    pctx = gpBslctx;
+
+    if ( NULL == pctx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pctx on WLANBAP_RegisterWithHCI");
+        return VOS_STATUS_E_FAULT;
+    }
+    if ( NULL == pAdapter )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid HDD Adapter pointer from pvosGCtx on WLANBAP_RegisterWithHCI");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    if(NULL != pctx->hdev)
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_WARN,
+                  "Already registered as HCI device\n");
+        return VOS_STATUS_SUCCESS;
+    }
+
+
+
+    /* Save away the pointer to the parent WLAN device in BSL driver context */
+    pctx->p_dev = pAdapter->dev;
+
+    /* Initialize HCI device */
+    hdev = hci_alloc_dev();
+    if (!hdev)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Can't allocate HCI device in WLANBAP_RegisterWithHCI");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Save away the HCI device pointer in the BSL driver context */
+    pctx->hdev = hdev;
+
+#if defined HCI_80211 || defined HCI_AMP
+#define BUILD_FOR_BLUETOOTH_NEXT_2_6
+#else
+#undef BUILD_FOR_BLUETOOTH_NEXT_2_6
+#endif
+
+#ifdef BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* HCI "bus type" of HCI_VIRTUAL should apply */
+    hdev->bus = HCI_VIRTUAL;
+    /* Set the dev_type to BT-AMP 802.11 */
+#ifdef HCI_80211
+    hdev->dev_type = HCI_80211;
+#else
+    hdev->dev_type = HCI_AMP;
+#endif
+#ifdef FEATURE_WLAN_BTAMP_UT
+    /* For the "real" BlueZ build, DON'T Set the device "quirks" to indicate RAW */
+    set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+#endif
+#else //BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* HCI "bus type" of HCI_VIRTUAL should apply */
+    hdev->type = HCI_VIRTUAL;
+    /* Set the dev_type to BT-AMP 802.11 */
+    //hdev->dev_type = HCI_80211;
+    ////hdev->dev_type = HCI_AMP;
+    /* For the "temporary" BlueZ build, Set the device "quirks" to indicate RAW */
+    set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+#endif //BUILD_FOR_BLUETOOTH_NEXT_2_6
+    /* Save away the BSL driver pointer in the HCI device context */
+    hci_set_drvdata(hdev, pctx);
+    /* Set the parent device for this HCI device.  This is our WLAN net_device */
+    SET_HCIDEV_DEV(hdev, &pctx->p_dev->dev);
+
+    hdev->open     = BSL_Open;
+    hdev->close    = BSL_Close;
+    hdev->flush    = BSL_Flush;
+    hdev->send     = BSL_Write;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+    hdev->owner = THIS_MODULE;
+    hdev->destruct = BSL_Destruct;
+#endif
+    hdev->ioctl    = BSL_IOControl;
+
+
+    /* Timeout before it is safe to send the first HCI packet */
+    msleep(1000);
+
+    /* Register HCI device */
+    err = hci_register_dev(hdev);
+    if (err < 0)
+    {
+        VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                  "Unable to register HCI device, err=%d\n", err);
+        pctx->hdev = NULL;
+        hci_free_dev(hdev);
+        return VOS_STATUS_E_FAULT;
+    }
+    if (NULL != pVosContext)
+    {
+       pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+       if (NULL != pHddCtx)
+       {
+          pHddCtx->isAmpAllowed = VOS_TRUE;
+       }
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS WLANBAP_DeregisterFromHCI(void)
+{
+    struct hci_dev *hdev;
+    BslClientCtxType* pctx = NULL;
+
+    pctx = gpBslctx;
+
+    if ( NULL == pctx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pvosGCtx on WLANBAP_DeregisterFromHCI");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Retrieve the HCI device pointer from the BSL driver context */
+    hdev = pctx->hdev;
+
+    if (!hdev)
+        return VOS_STATUS_E_FAULT;
+
+    /* Unregister device from BlueZ; fcn sends us HCI commands before it returns */
+    /* And then the registered hdev->close fcn should be called by BlueZ (BSL_Close) */
+    hci_unregister_dev(hdev);
+
+    /* BSL_Close is called again here, in case BlueZ didn't call it */
+    BSL_Close(hdev);
+    hci_free_dev(hdev);
+    pctx->hdev = NULL;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS WLANBAP_StopAmp(void)
+{
+    BslClientCtxType* pctx;
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+    pctx = gpBslctx;
+
+    if(NULL == pctx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pvosGCtx on WLANBAP_StopAmp");
+        status = VOS_STATUS_E_FAULT;
+    }
+    else
+    {
+        //is AMP session on, if so disconnect
+        if(VOS_TRUE == WLAN_BAPSessionOn(pctx->bapHdl))
+        {
+            status = WLAN_BAPDisconnect(pctx->bapHdl);
+        }
+    }
+    return status;
+}
+
+v_BOOL_t WLANBAP_AmpSessionOn(void)
+{
+    BslClientCtxType* pctx;
+
+    pctx = gpBslctx;
+    if(NULL == pctx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid BSL pointer from pvosGCtx on WLANBAP_AmpSessionOn");
+        return VOS_FALSE;
+    }
+    else
+    {
+        return( WLAN_BAPSessionOn(pctx->bapHdl));
+    }
+}
+
+
+#endif // WLAN_BTAMP_FEATURE
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
new file mode 100644
index 0000000..c988db1
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -0,0 +1,2748 @@
+/*
+ * 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  wlan_hdd_assoc.c
+  \brief WLAN Host Device Driver implementation
+               
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  05/06/09     Shailender     Created module. 
+  ==========================================================================*/
+  
+#include "wlan_hdd_includes.h"
+#include <aniGlobal.h>
+#include "dot11f.h"
+#include "wlan_nlink_common.h"
+#include "wlan_btc_svc.h"
+#include "wlan_hdd_power.h"
+#ifdef CONFIG_CFG80211
+#include <linux/ieee80211.h>
+#include <linux/wireless.h>
+#include <net/cfg80211.h>
+#include "wlan_hdd_cfg80211.h"
+#include "csrInsideApi.h"
+#endif
+#if defined CONFIG_CFG80211
+#include "wlan_hdd_p2p.h"
+#endif
+#include "sme_Api.h"
+
+v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter );
+
+struct ether_addr 
+{
+    u_char  ether_addr_octet[6];
+};
+// These are needed to recognize WPA and RSN suite types
+#define HDD_WPA_OUI_SIZE 4
+v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 };
+v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 };
+v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
+v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 };
+v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 };
+v_U8_t ccpWpaOui05[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x05 };
+#ifdef FEATURE_WLAN_CCX
+v_U8_t ccpWpaOui06[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
+#endif /* FEATURE_WLAN_CCX */
+#define HDD_RSN_OUI_SIZE 4
+v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher
+v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN
+v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK
+v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved
+v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP
+v_U8_t ccpRSNOui05[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104
+#ifdef FEATURE_WLAN_CCX
+v_U8_t ccpRSNOui06[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
+#endif /* FEATURE_WLAN_CCX */
+
+#if defined(WLAN_FEATURE_VOWIFI_11R) 
+// Offset where the EID-Len-IE, start.
+#define FT_ASSOC_RSP_IES_OFFSET 6
+#endif
+
+#define BEACON_FRAME_IES_OFFSET 12
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+#endif
+
+
+static inline v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, eConnectionState connState )
+{         
+   // save the new connection state 
+   pHddStaCtx->conn_info.connState = connState;
+}
+
+// returns FALSE if not connected.
+// returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ).
+// returns the connection state.  Can specify NULL if you dont' want to get the actual state.
+
+static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, 
+                                    eConnectionState *pConnState ) 
+{
+   v_BOOL_t fConnected; 
+   eConnectionState connState;
+    
+   // get the connection state.
+   connState = pHddStaCtx->conn_info.connState;
+   // Set the fConnected return variable based on the Connected State.  
+   if ( eConnectionState_Associated == connState ||
+        eConnectionState_IbssConnected == connState )
+   {
+      fConnected = VOS_TRUE;
+   }
+   else 
+   {
+      fConnected = VOS_FALSE;
+   }
+    
+   if ( pConnState )
+   {
+      *pConnState = connState;
+   }
+  
+   return( fConnected );
+}
+
+v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx )
+{
+   return( hdd_connGetConnectionState( pHddStaCtx, NULL ) );
+}  
+
+//TODO - Not used anyhwere. Can be removed.
+#if 0
+//
+v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter )
+{
+   v_BOOL_t fConnectedInfra = FALSE;
+   eConnectionState connState;
+   
+   if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) )
+   {   
+      if ( eConnectionState_Associated == connState ) 
+      {
+         fConnectedInfra = TRUE;
+      }   
+   }
+   
+   return( fConnectedInfra );
+}
+#endif
+    
+static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo )
+{
+    v_BOOL_t fConnected = VOS_FALSE;
+    
+    fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
+  
+    if ( pConnectedCipherAlgo ) 
+    {
+        *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType;
+    }
+    
+    return( fConnected );
+}
+ 
+inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType )
+{
+    v_BOOL_t fConnected = VOS_FALSE;
+    
+    fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
+  
+    if ( pConnectedBssType ) 
+    {
+        *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType;
+    }
+    
+    return( fConnected );
+}
+
+static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType )
+{
+   switch( csrRoamBssType ) 
+   {
+      case eCSR_BSS_TYPE_INFRASTRUCTURE:
+          pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure;
+         break;
+                     
+      case eCSR_BSS_TYPE_IBSS:
+      case eCSR_BSS_TYPE_START_IBSS:
+          pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent;
+         break;
+           
+      /** We will never set the BssType to 'any' when attempting a connection 
+            so CSR should never send this back to us.*/
+      case eCSR_BSS_TYPE_ANY:                      
+      default:
+         VOS_ASSERT( 0 );
+         break;      
+   }                     
+    
+}
+
+void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType )
+{
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE;
+ 
+   VOS_ASSERT( pRoamInfo );
+   
+   if ( pRoamInfo )   
+   {
+      // Save the BSSID for the connection...  
+      if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType )
+      {
+          VOS_ASSERT( pRoamInfo->pBssDesc );
+          vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 );
+
+          // Save the Station ID for this station from the 'Roam Info'.
+          //For IBSS mode, staId is assigned in NEW_PEER_IND
+          //For reassoc, the staID doesn't change and it may be invalid in this structure
+          //so no change here.
+          if( !pRoamInfo->fReassocReq )
+          {
+              pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId;
+          }
+      }
+      else if ( eCSR_BSS_TYPE_IBSS == eBssType )
+      {   
+         vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) );
+      }   
+      else
+      {
+         // can't happen.  We need a valid IBSS or Infra setting in the BSSDescription
+         // or we can't function.
+         VOS_ASSERT( 0 );
+      }
+
+      // notify WMM
+      hdd_wmm_connect(pAdapter, pRoamInfo, eBssType);
+
+      if( !pRoamInfo->u.pConnectedProfile )
+      {
+         VOS_ASSERT( pRoamInfo->u.pConnectedProfile );
+      }
+      else
+      {
+          // Get Multicast Encryption Type
+          encryptType =  pRoamInfo->u.pConnectedProfile->mcEncryptionType;
+          pHddStaCtx->conn_info.mcEncryptionType = encryptType;
+          // Get Unicast Encrytion Type
+          encryptType =  pRoamInfo->u.pConnectedProfile->EncryptionType;
+          pHddStaCtx->conn_info.ucEncryptionType = encryptType;
+
+          pHddStaCtx->conn_info.authType =  pRoamInfo->u.pConnectedProfile->AuthType;
+
+          pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel;
+
+          // Save the ssid for the connection
+          vos_mem_copy( &pHddStaCtx->conn_info.SSID.SSID, &pRoamInfo->u.pConnectedProfile->SSID, sizeof( tSirMacSSid ) );
+      }
+   }   
+      
+   // save the connected BssType
+   hdd_connSaveConnectedBssType( pHddStaCtx, eBssType );  
+   
+}
+
+#if defined(WLAN_FEATURE_VOWIFI_11R)
+/*
+ * Send the 11R key information to the supplicant.
+ * Only then can the supplicant generate the PMK-R1.
+ * (BTW, the CCX supplicant also needs the Assoc Resp IEs
+ * for the same purpose.)
+ *
+ * Mainly the Assoc Rsp IEs are passed here. For the IMDA
+ * this contains the R1KHID, R0KHID and the MDID.
+ * For FT, this consists of the Reassoc Rsp FTIEs.
+ * This is the Assoc Response.
+ */
+static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, 
+                tCsrRoamInfo *pCsrRoamInfo)
+{
+    union iwreq_data wrqu;
+    char *buff;
+    unsigned int len = 0;
+    u8 *pFTAssocRsp = NULL;
+    
+    if (pCsrRoamInfo->nAssocRspLength == 0) 
+    {
+        hddLog(LOGE,
+            "%s: pCsrRoamInfo->nAssocRspLength=%d",
+            __func__, (int)pCsrRoamInfo->nAssocRspLength);
+        return;
+    }
+
+    pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + 
+        pCsrRoamInfo->nAssocReqLength);
+    if (pFTAssocRsp == NULL) 
+    {
+        hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); 
+        return;
+    }
+
+    // pFTAssocRsp needs to point to the IEs
+    pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
+    hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
+        (unsigned int)pFTAssocRsp[0],
+        (unsigned int)pFTAssocRsp[1]);
+
+    // We need to send the IEs to the supplicant.
+    buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC);
+    if (buff == NULL) 
+    {
+        hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); 
+        return;
+    }
+
+    // Send the Assoc Resp, the supplicant needs this for initial Auth.
+    len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
+    wrqu.data.length = len; 
+    memset(buff, 0, IW_GENERIC_IE_MAX);
+    memcpy(buff, pFTAssocRsp, len); 
+    wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff);
+
+    kfree(buff);
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */ 
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+/*---------------------------------------------------
+ *
+ * Send the FTIEs, RIC IEs during FT. This is eventually
+ * used to send the FT events to the supplicant
+ *
+ * At the reception of Auth2 we send the RIC followed
+ * by the auth response IEs to the supplicant.
+ * Once both are received in the supplicant, an FT
+ * event is generated to the supplicant.
+ *
+ *---------------------------------------------------
+ */
+void hdd_SendFTEvent(hdd_adapter_t *pAdapter)
+{
+    union iwreq_data wrqu;
+    //struct wpabuf *ric = NULL;
+    char *buff;
+    tANI_U16 auth_resp_len = 0;
+    tANI_U32 ric_ies_length = 0;
+    tANI_U16 str_len;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+    // We need to send the IEs to the supplicant.
+    buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
+    vos_mem_zero(buff, IW_CUSTOM_MAX); 
+    if (buff == NULL) 
+    {
+        hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); 
+        return;
+    }
+
+    // Sme needs to send the RIC IEs first 
+    str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX);
+    sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), 
+                   (IW_CUSTOM_MAX - str_len), &ric_ies_length ); 
+    if (ric_ies_length == 0) 
+    {
+        hddLog(LOGW, "%s: RIC IEs is of length 0 not sending RIC Information for now", __func__); 
+    }
+    else
+    {
+        wrqu.data.length = str_len + ric_ies_length;
+        wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
+    }
+
+    // Sme needs to provide the Auth Resp
+    vos_mem_zero(buff, IW_CUSTOM_MAX); 
+    str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX);
+    sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], 
+                             (IW_CUSTOM_MAX - str_len),  &auth_resp_len);
+
+    if (auth_resp_len == 0) 
+    {
+        hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); 
+        return;
+    }
+
+    wrqu.data.length = str_len + auth_resp_len;
+    wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
+
+    kfree(buff);
+}
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef FEATURE_WLAN_CCX
+
+/*
+ * Send the CCX required "new AP Channel info" to the supplicant.
+ * (This keeps the supplicant "up to date" on the current channel.)
+ *
+ * The current (new AP) channel information is passed in.
+ */
+static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, 
+                tCsrRoamInfo *pCsrRoamInfo)
+{
+    union iwreq_data wrqu;
+    tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc;
+     
+
+    if (descriptor == NULL) 
+    {
+        hddLog(LOGE,
+            "%s: pCsrRoamInfo->pBssDesc=%p\n",
+            __func__, descriptor);
+        return;
+    }
+
+    // Send the Channel event, the supplicant needs this to generate the Adjacent AP report.
+    hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d\n", __func__, descriptor->channelId);
+    memset(&wrqu, '\0', sizeof(wrqu));
+    wrqu.freq.m = descriptor->channelId;
+    wrqu.freq.e = 0;
+    wrqu.freq.i = 0;
+    wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL);
+}
+
+#endif /* FEATURE_WLAN_CCX */
+
+void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo)
+{
+    union iwreq_data wrqu;
+    u8  *pBeaconIes;
+    u8 currentLen = 0;
+    char *buff;
+    int totalIeLen = 0, currentOffset = 0, strLen;
+
+    memset(&wrqu, '\0', sizeof(wrqu));
+
+    if (0 == pCsrRoamInfo->nBeaconLength)
+    {
+        hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__);
+        return;
+    }
+    pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET);
+    if (pBeaconIes == NULL) 
+    {
+        hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); 
+        return;
+    }
+
+    // pBeaconIes needs to point to the IEs
+    hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__,
+        (unsigned int)pBeaconIes[0],
+        (unsigned int)pBeaconIes[1]);
+    hddLog(LOG1, "%s: Beacon IEs length = %d", __func__, pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET);
+    
+   // We need to send the IEs to the supplicant.
+    buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
+    if (buff == NULL) 
+    {
+        hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); 
+        return;
+    }
+    vos_mem_zero(buff, IW_CUSTOM_MAX); 
+
+    strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX);
+    currentLen = strLen + 1;
+
+    totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET;
+    do
+    {
+        /* If the beacon size exceeds max CUSTOM event size, break it into chunks of CUSTOM event 
+         * max size and send it to supplicant. Changes are done in supplicant to handle this */
+        vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1));
+        currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1);
+        vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen);
+        currentOffset += currentLen;
+        totalIeLen -= currentLen;
+        wrqu.data.length = strLen + 1 + currentLen;
+        if (totalIeLen)
+          buff[strLen] = 1;   // This tells supplicant more chunks are pending 
+        else
+          buff[strLen] = 0;   // For last chunk of beacon IE to supplicant
+
+        hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen);
+        wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
+    } while (totalIeLen > 0);
+
+    kfree(buff);
+}
+
+static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    union iwreq_data wrqu;
+    int we_event;
+    char *msg;
+    int type = -1;
+
+#if defined (WLAN_FEATURE_VOWIFI_11R) 
+    // Added to find the auth type on the fly at run time 
+    // rather than with cfg to see if FT is enabled 
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);   
+    tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
+#endif
+ 
+    memset(&wrqu, '\0', sizeof(wrqu));
+    wrqu.ap_addr.sa_family = ARPHRD_ETHER; 
+    we_event = SIOCGIWAP;
+   
+    if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
+    {
+        memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId));
+        type = WLAN_STA_ASSOC_DONE_IND;
+
+        pr_info("wlan: connected to %02x:%02x:%02x:%02x:%02x:%02x\n",
+                      wrqu.ap_addr.sa_data[0],
+                      wrqu.ap_addr.sa_data[1],
+                      wrqu.ap_addr.sa_data[2],
+                      wrqu.ap_addr.sa_data[3],
+                      wrqu.ap_addr.sa_data[4],
+                      wrqu.ap_addr.sa_data[5]);
+        hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo);
+
+        /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or
+         * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled
+         * and fFTEnable is TRUE */
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        // Send FT Keys to the supplicant when FT is enabled
+        if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) ||
+            (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) 
+#ifdef FEATURE_WLAN_CCX
+            || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) ||
+            (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA)
+#endif
+        )
+        {
+            hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo);
+        }
+#endif
+    }
+    else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated
+    {
+        memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, sizeof(wrqu.ap_addr.sa_data));
+        type = WLAN_STA_ASSOC_DONE_IND;
+        pr_info("wlan: new IBSS connection to %02x:%02x:%02x:%02x:%02x:%02x",
+                      pHddStaCtx->conn_info.bssId[0],
+                      pHddStaCtx->conn_info.bssId[1],
+                      pHddStaCtx->conn_info.bssId[2],
+                      pHddStaCtx->conn_info.bssId[3],
+                      pHddStaCtx->conn_info.bssId[4],
+                      pHddStaCtx->conn_info.bssId[5]);
+    }
+    else /* Not Associated */
+    {
+        pr_info("wlan: disconnected\n");
+        type = WLAN_STA_DISASSOC_DONE_IND;
+        memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
+    }
+
+    msg = NULL;
+    /*During the WLAN uninitialization,supplicant is stopped before the
+      driver so not sending the status of the connection to supplicant*/
+    if(pHddCtx->isLoadUnloadInProgress != TRUE)
+    {
+        wireless_send_event(dev, we_event, &wrqu, msg);
+#ifdef FEATURE_WLAN_CCX
+        if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
+        {        
+            if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || 
+                (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) 
+            hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo);
+        }
+#endif
+    }
+    send_btc_nlink_msg(type, 0);
+}
+
+void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx )
+{
+   // Remove staId, bssId and peerMacAddress
+   pHddStaCtx->conn_info.staId [ 0 ] = 0;
+   vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) );
+   vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) );
+
+   // Clear all security settings
+   pHddStaCtx->conn_info.authType         = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+   pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+   pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+
+   vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) );
+
+   // Set not-connected state
+   pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY;
+   hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );  
+
+   vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) );
+}
+/* TODO Revist this function. and data path */
+static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
+{
+    VOS_STATUS vosStatus;
+    hdd_disconnect_tx_rx(pAdapter);
+    vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
+    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                   "%s: WLANTL_ClearSTAClient() failed to for staID %d.  "
+                   "Status= %d [0x%08lX]",
+                   __FUNCTION__, staId, vosStatus, vosStatus );
+    }
+    return( vosStatus );
+}
+
+
+static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
+                                            tANI_U32 roamId, eRoamCmdStatus roamStatus,
+                                            eCsrRoamResult roamResult )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    struct net_device *dev = pAdapter->dev;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    // notify apps that we can't pass traffic anymore
+    netif_tx_disable(dev);
+    netif_carrier_off(dev);
+    
+    hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );
+    /* If only STA mode is on */
+    if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1))
+    {
+        pHddCtx->isAmpAllowed = VOS_TRUE;
+    }
+    hdd_clearRoamProfileIe( pAdapter );
+
+    // indicate 'disconnect' status to wpa_supplicant...
+    hdd_SendAssociationEvent(dev,pRoamInfo);
+#ifdef CONFIG_CFG80211
+    /* indicate disconnected event to nl80211 */
+    if(roamStatus != eCSR_ROAM_IBSS_LEAVE)
+    {
+        /*During the WLAN uninitialization,supplicant is stopped before the
+            driver so not sending the status of the connection to supplicant*/
+        if(pHddCtx->isLoadUnloadInProgress != TRUE)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, 
+                    "%s: sent disconnected event to nl80211", 
+                    __func__);
+            /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
+            if( eCSR_ROAM_LOSTLINK == roamStatus )
+            {
+                cfg80211_disconnected(dev, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, NULL, 0, GFP_KERNEL);
+            }
+            else
+            {
+                cfg80211_disconnected(dev, WLAN_REASON_UNSPECIFIED, NULL, 0, GFP_KERNEL); 
+            }
+
+            //If the Device Mode is Station
+            // and the P2P Client is Connected
+            //Enable BMPS
+            if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
+                (vos_concurrent_sessions_running()))
+            {
+               //Enable BMPS only of other Session is P2P Client
+               hdd_context_t *pHddCtx = NULL;
+               v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );    
+
+               if (NULL != pVosContext)
+               {
+                   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+
+                   if(NULL != pHddCtx)
+                   {
+                       //Only P2P Client is there Enable Bmps back
+                       if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
+                          (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
+                          (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
+                       {
+                           hdd_enable_bmps_imps(pHddCtx);
+                       }
+                   }
+               }
+            }
+        }
+    }
+#endif
+    
+
+    //We should clear all sta register with TL, for now, only one.
+    status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
+    if ( !VOS_IS_STATUS_SUCCESS(status ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                  "hdd_roamDeregisterSTA() failed to for staID %d.  "
+                  "Status= %d [0x%x]",
+                    pHddStaCtx->conn_info.staId[0], status, status );
+
+        status = eHAL_STATUS_FAILURE;
+    }
+
+    pHddCtx->sta_to_adapter[pHddStaCtx->conn_info.staId[0]] = NULL;
+    // Clear saved connection information in HDD
+    hdd_connRemoveConnectInfo( pHddStaCtx );
+
+    //Unblock anyone waiting for disconnect to complete
+    complete(&pAdapter->disconnect_comp_var);
+    return( status );
+}
+static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter,
+                                       tCsrRoamInfo *pRoamInfo,
+                                       v_U8_t staId,
+                                       v_MACADDR_t *pPeerMacAddress,
+                                       tSirBssDescription *pBssDesc )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+   WLAN_STADescType staDesc = {0};
+   eCsrEncryptionType connectedCipherAlgo;
+   v_BOOL_t  fConnected;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   
+   // Get the Station ID from the one saved during the assocation.
+   staDesc.ucSTAId = staId;
+
+   if ( pHddStaCtx->conn_info.connDot11DesiredBssType == eMib_dot11DesiredBssType_infrastructure)
+   { 
+      staDesc.wSTAType = WLAN_STA_INFRA;
+      
+      // grab the bssid from the connection info in the adapter structure and hand that 
+      // over to TL when registering. 
+      vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,sizeof(pHddStaCtx->conn_info.bssId) ); 
+   }
+   else 
+   {
+      // for an IBSS 'connect', setup the Station Descriptor for TL.   
+      staDesc.wSTAType = WLAN_STA_IBSS;
+      
+      // Note that for IBSS, the STA MAC address and BSSID are goign to be different where
+      // in infrastructure, they are the same (BSSID is the MAC address of the AP).  So,
+      // for IBSS we have a second field to pass to TL in the STA descriptor that we don't
+      // pass when making an Infrastructure connection.
+      vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) );
+      vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 );
+   }
+      
+   vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
+
+   // set the QoS field appropriately
+   if (hdd_wmm_is_active(pAdapter))
+   {
+      staDesc.ucQosEnabled = 1;
+   }
+   else
+   {
+      staDesc.ucQosEnabled = 0;
+   }
+
+   fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
+   if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE )
+   {
+      staDesc.ucProtectedFrame = 1;
+   }
+   else
+   {
+      staDesc.ucProtectedFrame = 0;
+
+   }
+
+#ifdef FEATURE_WLAN_CCX
+   staDesc.ucIsCcxSta = pRoamInfo->isCCXAssoc;
+#endif //FEATURE_WLAN_CCX
+
+#ifdef VOLANS_ENABLE_SW_REPLAY_CHECK
+   /* check whether replay check is valid for the station or not */
+   if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo))
+   {
+       /* Encryption mode is either TKIP or AES
+          and replay check is valid for only these
+          two encryption modes */
+       staDesc.ucIsReplayCheckValid = VOS_TRUE;
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                 "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid);
+   }
+  
+   else
+   {
+      /* For other encryption modes replay check is 
+         not needed */
+        staDesc.ucIsReplayCheckValid = VOS_FALSE; 
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                 "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid);
+   }
+#endif
+
+#ifdef FEATURE_WLAN_WAPI
+   hddLog(LOG1, "%s: WAPI STA Registered: %d", __FUNCTION__, pAdapter->wapi_info.fIsWapiSta);
+   if (pAdapter->wapi_info.fIsWapiSta)
+   {
+      staDesc.ucIsWapiSta = 1;
+   }
+   else
+   {
+      staDesc.ucIsWapiSta = 0;
+   }
+#endif /* FEATURE_WLAN_WAPI */
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                 "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame );
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   // UMA is Not ready yet, Xlation will be done by TL
+   staDesc.ucSwFrameTXXlation = 1;
+#else
+   /* Enable UMA for TX translation only when there is no concurrent session active */
+   if (vos_concurrent_sessions_running())
+   {
+      staDesc.ucSwFrameTXXlation = 1;
+   }
+   else
+   {
+      staDesc.ucSwFrameTXXlation = 0;
+   }
+#endif
+   staDesc.ucSwFrameRXXlation = 1;
+   staDesc.ucAddRmvLLC = 1;
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register TL QoS_enabled=%d", 
+              staDesc.ucQosEnabled );
+   // Initialize signatures and state
+   staDesc.ucUcastSig  = pRoamInfo->ucastSig;
+   staDesc.ucBcastSig  = pRoamInfo->bcastSig;
+   staDesc.ucInitState = pRoamInfo->fAuthRequired ?
+      WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED;
+   // Register the Station with TL...      
+   vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, 
+                                         hdd_rx_packet_cbk, 
+                                         hdd_tx_complete_cbk, 
+                                         hdd_tx_fetch_packet_cbk, &staDesc,
+                                         pBssDesc->rssi );
+   
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, 
+                 "WLANTL_RegisterSTAClient() failed to register.  Status= %d [0x%08lX]",
+                 vosStatus, vosStatus );
+      return vosStatus;      
+   }                                            
+
+   // if ( WPA ), tell TL to go to 'connected' and after keys come to the driver, 
+   // then go to 'authenticated'.  For all other authentication types (those that do 
+   // not require upper layer authentication) we can put TL directly into 'authenticated'
+   // state.
+   
+   VOS_ASSERT( fConnected );
+  
+   if ( !pRoamInfo->fAuthRequired )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                 "open/shared auth StaId= %d.  Changing TL state to AUTHENTICATED at Join time", pHddStaCtx->conn_info.staId[ 0 ] );
+   
+      // Connections that do not need Upper layer auth, transition TL directly
+      // to 'Authenticated' state.      
+      vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, 
+                                         WLANTL_STA_AUTHENTICATED );
+  
+      pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
+   }                                            
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                 "ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time", pHddStaCtx->conn_info.staId[ 0 ] );
+   
+      vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, 
+                                         WLANTL_STA_CONNECTED );
+
+      pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
+   }      
+   return( vosStatus );
+}
+
+#ifdef FEATURE_WLAN_CCX
+static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter,
+    tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength)
+{
+    unsigned int len = 0;
+    u8 *pFTAssocRsp = NULL;
+    v_U8_t rspRsnIe[IW_GENERIC_IE_MAX];
+    tANI_U32 rspRsnLength = 0;
+    struct ieee80211_channel *chan;
+
+    if (pCsrRoamInfo == NULL)
+        return;
+
+    if (pCsrRoamInfo->nAssocRspLength == 0)
+        return;
+
+    pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
+                    pCsrRoamInfo->nAssocReqLength);
+    if (pFTAssocRsp == NULL)
+        return;
+
+    //pFTAssocRsp needs to point to the IEs
+    pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
+    hddLog(LOG1, "%s: AssocRsp is now at %02x%02x\n", __func__,
+                    (unsigned int)pFTAssocRsp[0],
+                    (unsigned int)pFTAssocRsp[1]);
+
+    // Send the Assoc Resp, the supplicant needs this for initial Auth.
+    len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
+    rspRsnLength = len;
+    memset(rspRsnIe, 0, IW_GENERIC_IE_MAX);
+    memcpy(rspRsnIe, pFTAssocRsp, len);
+
+    chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int) pCsrRoamInfo->pBssDesc->channelId);
+    cfg80211_roamed(dev,chan,pCsrRoamInfo->bssid,
+                    reqRsnIe, reqRsnLength,
+                    rspRsnIe, rspRsnLength,GFP_KERNEL);
+}
+#endif /* FEATURE_WLAN_CCX */
+
+static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
+                                                    tANI_U32 roamId, eRoamCmdStatus roamStatus,                                                
+                                                    eCsrRoamResult roamResult )
+{
+    struct net_device *dev = pAdapter->dev;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    VOS_STATUS vosStatus;
+#ifdef FEATURE_WLAN_CCX
+    int ft_carrier_on = FALSE;
+#endif
+    int status;
+ 
+    if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult )
+    {
+        hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated );
+
+        // Save the connection info from CSR...
+        hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE );
+#ifdef FEATURE_WLAN_WAPI
+        if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE ||
+                pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK )
+        {
+            pAdapter->wapi_info.fIsWapiSta = 1;
+        }
+        else
+        {
+            pAdapter->wapi_info.fIsWapiSta = 0;
+        }
+#endif  /* FEATURE_WLAN_WAPI */
+
+        // indicate 'connect' status to userspace
+        hdd_SendAssociationEvent(dev,pRoamInfo);
+
+
+        // Initialize the Linkup event completion variable 
+        INIT_COMPLETION(pAdapter->linkup_event_var);
+
+        /*
+           Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any
+           packet to go up to the application, device activation has to be ensured for proper queue mapping by the
+           kernel. we have registered net device notifier for device change notification. With this we will come to 
+           know that the device is getting activated properly.
+           */
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+        if (pHddStaCtx->ft_carrier_on == FALSE)
+        {
+#endif
+            // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable       
+            pAdapter->isLinkUpSvcNeeded = TRUE;
+
+            // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable       
+            pAdapter->isLinkUpSvcNeeded = TRUE;
+
+            // Switch on the Carrier to activate the device
+            netif_carrier_on(dev);
+
+            // Wait for the Link to up to ensure all the queues are set properly by the kernel
+            status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var,
+                                                   msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT));
+            if(!status) 
+            {
+                hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__);
+            }
+
+            // Disable Linkup Event Servicing - no more service required from the net device notifier call
+            pAdapter->isLinkUpSvcNeeded = FALSE;
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+        }
+        else { 
+            pHddStaCtx->ft_carrier_on = FALSE;
+#ifdef FEATURE_WLAN_CCX
+            ft_carrier_on = TRUE;
+#endif /* FEATURE_WLAN_CCX */
+        }
+#endif
+        pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
+
+        //For reassoc, the station is already registered, all we need is to change the state
+        //of the STA in TL.
+        //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED
+        if( !pRoamInfo->fReassocReq )
+        {
+#ifdef CONFIG_CFG80211
+            v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN];
+            v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN];
+            tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN;
+            tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN;
+            struct cfg80211_bss *bss;
+
+            /* add bss_id to cfg80211 data base */
+            bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
+            if (NULL == bss)
+            {
+                pr_err("wlan: Not able to create BSS entry\n");
+                return eHAL_STATUS_FAILURE;
+            }
+
+            /* wpa supplicant expecting WPA/RSN IE in connect result */
+            csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                    pAdapter->sessionId,
+                    &reqRsnLength,
+                    reqRsnIe);
+
+            csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                    pAdapter->sessionId,
+                    &rspRsnLength,
+                    rspRsnIe);
+#ifdef FEATURE_WLAN_CCX
+            if(ft_carrier_on)
+                    hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
+            else
+#endif /* FEATURE_WLAN_CCX */
+
+            {
+            /* inform connect result to nl80211 */
+            cfg80211_connect_result(dev, pRoamInfo->bssid, 
+                    reqRsnIe, reqRsnLength, 
+                    rspRsnIe, rspRsnLength,
+                    WLAN_STATUS_SUCCESS, 
+                    GFP_KERNEL); 
+
+            cfg80211_put_bss(bss);
+            }
+#endif
+
+            // Register the Station with TL after associated...
+            vosStatus = hdd_roamRegisterSTA( pAdapter,
+                    pRoamInfo,
+                    pHddStaCtx->conn_info.staId[ 0 ],
+                    NULL,
+                    pRoamInfo->pBssDesc );
+        }
+        else
+        {
+            //Reassoc successfully
+            if( pRoamInfo->fAuthRequired )
+            {
+                vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], 
+                        WLANTL_STA_CONNECTED );
+                pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
+            }
+            else
+            {
+                vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], 
+                        WLANTL_STA_AUTHENTICATED );
+                pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
+            }
+        }
+
+        if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+        {
+            // perform any WMM-related association processing
+            hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE);
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                    "Cannot register STA with TL.  Failed with vosStatus = %d [%08lX]",
+                    vosStatus, vosStatus );
+        }
+
+        // Start the Queue
+        netif_tx_wake_all_queues(dev);
+    }  
+    else 
+    {
+        char country_code[3] = SME_INVALID_COUNTRY_CODE;
+        eHalStatus status = eHAL_STATUS_SUCCESS;
+        hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+
+        hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+        pr_info("wlan: connection failed\n");
+
+        /*Handle all failure conditions*/
+        hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected);
+        if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1))
+        {
+            pHddCtx->isAmpAllowed = VOS_TRUE;
+        }
+
+        //If the Device Mode is Station
+        // and the P2P Client is Connected
+        //Enable BMPS
+        if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
+            (vos_concurrent_sessions_running()))
+        {
+           //Enable BMPS only of other Session is P2P Client
+           hdd_context_t *pHddCtx = NULL;
+           v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+
+           if (NULL != pVosContext)
+           {
+               pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+
+               if(NULL != pHddCtx)
+               {
+                   //Only P2P Client is there Enable Bmps back
+                   if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
+                      (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
+                      (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
+                   {
+                       hdd_enable_bmps_imps(pHddCtx);
+                   }
+               }
+           }
+        }
+
+#ifdef CONFIG_CFG80211
+        /* inform association failure event to nl80211 */
+        cfg80211_connect_result(dev, pWextState->req_bssId,
+                NULL, 0, NULL, 0,
+                WLAN_STATUS_UNSPECIFIED_FAILURE, 
+                GFP_KERNEL);
+#endif 
+
+        netif_tx_disable(dev);
+        netif_carrier_off(dev);
+
+        /* Association failed; Reset the country code information
+         * so that it re-initialize the valid channel list*/
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Association failed and resetting the country code"
+                "to default \n",__func__);
+
+        status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL, 
+                                            &country_code[0], pAdapter,
+                                            pHddCtx->pvosContext);
+        if( 0 != status )
+        {
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: SME Change Country code to default failed \n",__func__);
+        }
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/**============================================================================
+ *
+  @brief roamRoamIbssIndicationHandler() - Here we update the status of the 
+  Ibss when we receive information that we have started/joined an ibss session
+  We always return SUCCESS.
+  
+  ===========================================================================*/
+static eHalStatus roamRoamIbssIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
+   tANI_U32 roamId, eRoamCmdStatus roamStatus,                                                
+   eCsrRoamResult roamResult )
+{
+   switch( roamResult )
+   {
+      // both IBSS Started and IBSS Join should come in here.
+      case eCSR_ROAM_RESULT_IBSS_STARTED:
+      case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS:
+      {
+         // we should have a pRoamInfo on this callback...
+         VOS_ASSERT( pRoamInfo );
+        
+         // When IBSS Started comes from CSR, we need to move connection state to 
+         // IBSS Disconnected (meaning no peers are in the IBSS).
+         hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssDisconnected );
+
+         break;
+      }
+      
+      case eCSR_ROAM_RESULT_IBSS_START_FAILED:
+      {
+         VOS_ASSERT( pRoamInfo );
+         
+         break;
+      }
+      
+      default:
+         break;
+   }   
+   
+    return( eHAL_STATUS_SUCCESS );
+}
+
+/**============================================================================
+ *
+  @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter.
+  This information is passed to iwconfig later. The peer that joined
+  last is passed as information to iwconfig.
+  If we add HDD_MAX_NUM_IBSS_STA or less STA we return success else we 
+  return FALSE.
+  
+  ===========================================================================*/
+static int roamSaveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId, v_MACADDR_t *peerMacAddress )
+{
+   int fSuccess = FALSE;
+   int idx = 0;
+   
+   for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
+   {
+      if ( 0 == pHddStaCtx->conn_info.staId[ idx ] )
+      {
+         pHddStaCtx->conn_info.staId[ idx ] = staId;
+      
+         vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress );
+         
+         fSuccess = TRUE;
+         break;
+      }
+   }
+   
+   return( fSuccess );   
+}
+/**============================================================================
+ *
+  @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter.
+  If we remove HDD_MAX_NUM_IBSS_STA or less STA we return success else we 
+  return FALSE.
+  
+  ===========================================================================*/
+static int roamRemoveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId )
+{
+   int fSuccess = FALSE;
+   int idx = 0;
+   v_U8_t  valid_idx   = 0;
+   v_U8_t  del_idx   = 0;
+   
+   for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
+   {
+      if ( staId == pHddStaCtx->conn_info.staId[ idx ] )
+      {
+         pHddStaCtx->conn_info.staId[ idx ] = 0;
+
+         vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] );
+
+         fSuccess = TRUE;
+         // Note the deleted Index, if its 0 we need special handling
+         del_idx = idx;
+      }
+      else
+      {
+         if (pHddStaCtx->conn_info.staId[idx] != 0) 
+         {
+            valid_idx = idx;
+         }
+      }
+   }
+
+   // Find next active staId, to have a valid sta trigger for TL.
+   if (fSuccess == TRUE)
+   {
+      if (del_idx == 0)
+      {
+         if (pHddStaCtx->conn_info.staId[valid_idx] != 0)
+         {
+            pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx];
+            vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ],
+               &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]);
+
+            pHddStaCtx->conn_info.staId[valid_idx] = 0;
+            vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] );
+         }
+      }
+   }
+   return( fSuccess );
+}
+
+/**============================================================================
+ *
+  @brief roamIbssConnectHandler() : We update the status of the IBSS to 
+  connected in this function.
+  
+  ===========================================================================*/
+static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo )
+{
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "IBSS Connect Indication from SME!!!" );
+   // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)...
+   hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected );
+
+   // Save the connection info from CSR...
+   hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS );
+
+   // Send the bssid address to the wext.
+   hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
+#ifdef CONFIG_CFG80211
+   /* add bss_id to cfg80211 data base */
+   wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
+   /* send ibss join indication to nl80211 */
+   cfg80211_ibss_joined(pAdapter->dev, &pRoamInfo->bssid[0], GFP_KERNEL);
+#endif
+
+   return( eHAL_STATUS_SUCCESS );
+}
+/**============================================================================
+ *
+  @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters.
+  
+  ===========================================================================*/
+static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
+                                                 tANI_U32 roamId, eRoamCmdStatus roamStatus,                                                
+                                                 eCsrRoamResult roamResult )
+{
+   eCsrEncryptionType connectedCipherAlgo;
+   v_BOOL_t fConnected   = FALSE;
+   VOS_STATUS vosStatus    = VOS_STATUS_E_FAILURE;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   ENTER();
+   // if ( WPA ), tell TL to go to 'authenticated' after the keys are set.
+   // then go to 'authenticated'.  For all other authentication types (those that do 
+   // not require upper layer authentication) we can put TL directly into 'authenticated'
+   // state.
+   fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
+   if( fConnected )
+   {
+      // TODO: Considering getting a state machine in HDD later.
+      // This routuine is invoked twice. 1)set PTK 2)set GTK. The folloing if statement will be
+      // TRUE when setting GTK. At this time we don't handle the state in detail.
+      // Related CR: 174048 - TL not in authenticated state
+      if(( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                    "Key set for StaId= %d.  Changing TL state to AUTHENTICATED", pHddStaCtx->conn_info.staId[ 0 ] );
+                    
+         // Connections that do not need Upper layer authentication, transition TL 
+         // to 'Authenticated' state after the keys are set.
+         vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], 
+                                            WLANTL_STA_AUTHENTICATED );
+ 
+         pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
+      }
+      
+      pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+   }
+   else
+   {
+      // possible disassoc after issuing set key and waiting set key complete
+      pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+   }
+   
+   EXIT();
+   return( eHAL_STATUS_SUCCESS );
+}
+/**============================================================================
+ *
+  @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant.
+  ===========================================================================*/
+static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
+                                                 tANI_U32 roamId, eRoamCmdStatus roamStatus,                                                                              eCsrRoamResult roamResult )
+{   
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+   if( eConnectionState_Associated == pHddStaCtx->conn_info.connState &&
+      TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures )
+   {
+      struct iw_michaelmicfailure msg;
+      union iwreq_data wreq;
+      memset(&msg, '\0', sizeof(msg));
+      msg.src_addr.sa_family = ARPHRD_ETHER;
+      memcpy(msg.src_addr.sa_data, pRoamInfo->u.pMICFailureInfo->taMacAddr, sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr));
+      hddLog(LOG1, "MIC MAC %02x:%02x:%02x:%02x:%02x:%02x",
+                                    msg.src_addr.sa_data[0],
+                                    msg.src_addr.sa_data[1],
+                                    msg.src_addr.sa_data[2],
+                                    msg.src_addr.sa_data[3],
+                                    msg.src_addr.sa_data[4],
+                                    msg.src_addr.sa_data[5]);
+  
+      if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE)
+         msg.flags = IW_MICFAILURE_GROUP;
+      else 
+         msg.flags = IW_MICFAILURE_PAIRWISE;
+      memset(&wreq, 0, sizeof(wreq));
+      wreq.data.length = sizeof(msg);
+      wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg);
+#ifdef CONFIG_CFG80211
+      /* inform mic failure to nl80211 */
+      cfg80211_michael_mic_failure(pAdapter->dev, 
+              pRoamInfo->u.pMICFailureInfo->taMacAddr,
+              ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ?
+               NL80211_KEYTYPE_GROUP :
+               NL80211_KEYTYPE_PAIRWISE),
+              pRoamInfo->u.pMICFailureInfo->keyId, 
+              pRoamInfo->u.pMICFailureInfo->TSC, 
+              GFP_KERNEL);
+#endif
+      
+   }
+   
+   return( eHAL_STATUS_SUCCESS );
+}
+
+/**============================================================================
+ *
+  @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is 
+  updated regularly here in this function.
+  
+  ===========================================================================*/
+static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
+   tANI_U32 roamId, eRoamCmdStatus roamStatus,                                                
+   eCsrRoamResult roamResult )
+{
+   VOS_STATUS vosStatus;
+
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   switch( roamResult )
+   {
+      case eCSR_ROAM_RESULT_IBSS_NEW_PEER:
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "IBSS New Peer indication from SME "
+                    "with peerMac %2x-%2x-%2x-%2x-%2x-%2x  and  stationID= %d",
+                    pRoamInfo->peerMac[0], pRoamInfo->peerMac[1], pRoamInfo->peerMac[2],
+                    pRoamInfo->peerMac[3], pRoamInfo->peerMac[4], pRoamInfo->peerMac[5], 
+                    pRoamInfo->staId );
+         
+         if ( !roamSaveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId, (v_MACADDR_t *)pRoamInfo->peerMac ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                       "New IBSS peer but we already have the max we can handle.  Can't register this one" );
+            break;
+         }
+
+         pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
+
+         // Register the Station with TL for the new peer. 
+         vosStatus = hdd_roamRegisterSTA( pAdapter,
+                                          pRoamInfo,
+                                          pRoamInfo->staId,
+                                          (v_MACADDR_t *)pRoamInfo->peerMac,
+                                          pRoamInfo->pBssDesc );
+         if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "Cannot register STA with TL for IBSS.  Failed with vosStatus = %d [%08lX]",
+               vosStatus, vosStatus );
+         }
+         
+         netif_carrier_on(pAdapter->dev);
+         netif_tx_start_all_queues(pAdapter->dev);
+         break;
+      }
+         
+      case eCSR_ROAM_RESULT_IBSS_CONNECT:
+      {
+      
+         roamIbssConnectHandler( pAdapter, pRoamInfo );
+         
+         break;
+      }   
+      case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED:
+      {
+
+         if ( !roamRemoveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                    "IBSS peer departed by cannot find peer in our registration table with TL" );
+         }
+
+         hdd_roamDeregisterSTA( pAdapter, pRoamInfo->staId );
+
+         pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL;
+
+         break;
+      }
+      case eCSR_ROAM_RESULT_IBSS_INACTIVE:
+      {
+         // Stop only when we are inactive
+         netif_tx_disable(pAdapter->dev);
+         netif_carrier_off(pAdapter->dev);
+         hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected );
+         
+         // Send the bssid address to the wext.
+         hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
+         // clean up data path
+         hdd_disconnect_tx_rx(pAdapter);
+         break;
+      }
+      default:
+         break;
+   
+   }
+   
+   return( eHAL_STATUS_SUCCESS );
+}
+
+eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, 
+                                eRoamCmdStatus roamStatus, eCsrRoamResult roamResult )
+{
+    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+    hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
+    hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
+            "CSR Callback: status= %d result= %d roamID=%ld", 
+                    roamStatus, roamResult, roamId ); 
+    switch( roamStatus )
+    {
+        case eCSR_ROAM_SESSION_OPENED:
+            if(pAdapter != NULL)
+            {
+                set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
+                complete(&pAdapter->session_open_comp_var);
+            }
+            break;
+            
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+            /* We did pre-auth,then we attempted a 11r or ccx reassoc.
+             * reassoc failed due to failure, timeout, reject from ap
+             * in any case tell the OS, our carrier is off and mark 
+             * interface down */
+        case eCSR_ROAM_FT_REASSOC_FAILED:
+            hddLog(LOG1, FL("Reassoc Failed\n"));
+            halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
+            if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#ifdef MSM_PLATFORM
+                    hdd_conf_mcastbcast_filter((WLAN_HDD_GET_CTX(pAdapter)), FALSE);
+#endif
+#endif
+                    (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
+            }
+            pHddStaCtx->ft_carrier_on = FALSE;
+            break;
+
+        case eCSR_ROAM_FT_START:
+            // When we roam for CCX and 11r, we dont want the 
+            // OS to be informed that the link is down. So mark
+            // the link ready for ft_start. After this the 
+            // eCSR_ROAM_SHOULD_ROAM will be received.
+            // Where in we will not mark the link down
+            // Also we want to stop tx at this point when we will be
+            // doing disassoc at this time. This saves 30-60 msec
+            // after reassoc. We see old traffic from old connection on new channel
+            {
+                struct net_device *dev = pAdapter->dev;
+                netif_tx_disable(dev);
+            }
+            pHddStaCtx->ft_carrier_on = TRUE;
+            break;
+#endif
+
+        case eCSR_ROAM_SHOULD_ROAM:
+           // Dont need to do anything
+            {
+                VOS_STATUS  status = VOS_STATUS_SUCCESS;
+                struct net_device *dev = pAdapter->dev;
+                hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+                // notify apps that we can't pass traffic anymore
+                netif_tx_disable(dev);
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+                if (pHddStaCtx->ft_carrier_on == FALSE)
+                {
+#endif
+                    netif_carrier_off(dev);
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+                }
+#endif
+
+                //We should clear all sta register with TL, for now, only one.
+                status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
+                if ( !VOS_IS_STATUS_SUCCESS(status ) )
+                {
+                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                        FL("hdd_roamDeregisterSTA() failed to for staID %d.  Status= %d [0x%x]"),
+                                        pHddStaCtx->conn_info.staId[0], status, status );
+                    status = eHAL_STATUS_FAILURE;
+                }
+
+                // Clear saved connection information in HDD
+                hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) );
+            }
+           break;
+        case eCSR_ROAM_LOSTLINK:
+        case eCSR_ROAM_DISASSOCIATED:
+            {
+                char country_code[3] = SME_INVALID_COUNTRY_CODE;
+                eHalStatus status = eHAL_STATUS_SUCCESS;
+                hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                        "****eCSR_ROAM_DISASSOCIATED****");
+                halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+                /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
+                if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) {
+                    hdd_conf_mcastbcast_filter((WLAN_HDD_GET_CTX(pAdapter)), FALSE);
+                    (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
+                }
+#ifdef WLAN_FEATURE_PACKET_FILTERING    
+                if (pHddCtx->cfg_ini->isMcAddrListFilter)
+                {
+                    /*Multicast addr filtering is enabled*/
+                    if(pHddCtx->mc_addr_list.isFilterApplied)
+                    {
+                        /*Filter applied during suspend mode*/
+                        /*Clear it here*/
+                        wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
+                    }
+                }
+#endif
+
+                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                        "%s: Disconnected from the AP and "
+                        "resetting the country code to default\n",__func__);
+                /*reset the country code of previous connection*/
+                status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL,
+                        &country_code[0], pAdapter,
+                        pHddCtx->pvosContext
+                        );
+                if( 0 != status )
+                {
+                    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                            "%s: SME Change Country code to default failed \n",__func__);
+                }
+            }
+            break;
+        case eCSR_ROAM_IBSS_LEAVE:
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "****eCSR_ROAM_IBSS_LEAVE****");
+            halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            break;
+        case eCSR_ROAM_ASSOCIATION_COMPLETION:
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "****eCSR_ROAM_ASSOCIATION_COMPLETION****");
+            if (  (roamResult != eCSR_ROAM_RESULT_ASSOCIATED)
+               && (   (pWextState->roamProfile.EncryptionType.encryptionType[0] == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) 
+                   || (pWextState->roamProfile.EncryptionType.encryptionType[0] == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)
+                  )
+               && (eCSR_AUTH_TYPE_SHARED_KEY != pWextState->roamProfile.AuthType.authType[0])
+               )
+            {
+                v_U32_t roamId = 0;
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
+                        "****WEP open authentication failed, trying with shared authentication****");
+                (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY;
+                pWextState->roamProfile.AuthType.authType[0] = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
+                pWextState->roamProfile.csrPersona = pAdapter->device_mode;
+                halStatus = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &(pWextState->roamProfile), &roamId);
+            }
+            else
+            {
+                halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            }
+
+            break;
+        case eCSR_ROAM_ASSOCIATION_FAILURE:
+            halStatus = hdd_AssociationCompletionHandler( pAdapter, 
+                    pRoamInfo, roamId, roamStatus, roamResult );
+            break;
+        case eCSR_ROAM_IBSS_IND:
+            halStatus = roamRoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            break;
+
+        case eCSR_ROAM_CONNECT_STATUS_UPDATE:
+            halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            break;            
+
+        case eCSR_ROAM_MIC_ERROR_IND:
+            halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            break;
+
+        case eCSR_ROAM_SET_KEY_COMPLETE:
+            halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
+            break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_ROAM_FT_RESPONSE:
+            hdd_SendFTEvent(pAdapter);
+            break;
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+        case eCSR_ROAM_INDICATE_MGMT_FRAME:
+            hdd_indicateMgmtFrame( pAdapter,
+                                  pRoamInfo->nFrameLength,
+                                  pRoamInfo->pbFrames,
+                                  pRoamInfo->frameType,
+                                  pRoamInfo->rxChan );
+            break;
+        case eCSR_ROAM_REMAIN_CHAN_READY:
+            hdd_remainChanReadyHandler( pAdapter );
+            break;
+        case eCSR_ROAM_SEND_ACTION_CNF:
+            hdd_sendActionCnf( pAdapter,
+               (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE );
+            break;
+#endif
+        default:
+            break;
+    }
+    return( halStatus );
+}
+eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) 
+{
+    eCsrAuthType auth_type;
+    // is the auth type supported?
+    if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_RSN;
+    } else 
+    if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_RSN_PSK;
+    } else 
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) 
+    {
+        // Check for 11r FT Authentication with PSK
+        auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK;
+    } else 
+    if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) 
+    {
+        // Check for 11R FT Authentication with 802.1X
+        auth_type = eCSR_AUTH_TYPE_FT_RSN;
+    } else 
+#endif
+#ifdef FEATURE_WLAN_CCX
+    if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_CCKM_RSN;
+    } else
+#endif /* FEATURE_WLAN_CCX */
+    { 
+        auth_type = eCSR_AUTH_TYPE_UNKNOWN;
+    }
+    return auth_type;
+} 
+#ifdef WLAN_SOFTAP_FEATURE
+eCsrAuthType 
+hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) 
+#else
+static eCsrAuthType hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) 
+#endif
+{
+    eCsrAuthType auth_type;
+    // is the auth type supported?
+    if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_WPA;
+    } else 
+    if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_WPA_PSK;
+    } else 
+#ifdef FEATURE_WLAN_CCX
+    if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) 
+    {
+        auth_type = eCSR_AUTH_TYPE_CCKM_WPA;
+    } else 
+#endif /* FEATURE_WLAN_CCX */
+    { 
+        auth_type = eCSR_AUTH_TYPE_UNKNOWN;
+    }
+    hddLog(LOG1, FL("auth_type: %d"), auth_type);
+    return auth_type;
+}
+#ifdef WLAN_SOFTAP_FEATURE
+eCsrEncryptionType 
+hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4])
+#else
+static eCsrEncryptionType hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4])                                    
+#endif
+{
+    eCsrEncryptionType cipher_type;
+    // is the cipher type supported?
+    if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_AES;
+    } 
+    else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
+    } 
+    else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_NONE;
+    } 
+    else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+    } 
+    else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) 
+    {        
+        cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; 
+    } 
+    else 
+    { 
+        cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
+    }
+    hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
+    return cipher_type;
+} 
+/* To find if the MAC address is NULL */
+static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length)
+{
+    int i;
+    for (i = 0; i < length; i++)
+    {
+        if (0x00 != (macAddr[i]))
+        {
+            return FALSE;
+        }
+    }
+    return TRUE;
+} /****** end hdd_IsMACAddrNULL() ******/
+#ifdef WLAN_SOFTAP_FEATURE
+eCsrEncryptionType 
+hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4])
+#else
+static eCsrEncryptionType 
+hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4])                                    
+#endif
+{
+    eCsrEncryptionType cipher_type;
+    // is the cipher type supported?
+    if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_AES;
+    } else 
+    if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
+    } else 
+    if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_NONE;
+    } else 
+    if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+    } else 
+    if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) 
+    {
+        cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; 
+    } else 
+    { 
+        cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
+    }
+    hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
+    return cipher_type;
+} 
+
+static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, 
+                struct ether_addr *pBssid, 
+                eCsrEncryptionType *pEncryptType, 
+                eCsrEncryptionType *mcEncryptType, 
+                eCsrAuthType *pAuthType, 
+                u_int16_t gen_ie_len, 
+                u_int8_t *gen_ie) 
+{
+    tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    eHalStatus result; 
+    tDot11fIERSN dot11RSNIE; 
+    tDot11fIEWPA dot11WPAIE; 
+    tANI_U32 i; 
+    tANI_U8 *pRsnIe; 
+    tANI_U16 RSNIeLen; 
+    tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory
+
+    /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present
+       flag to 0 */
+    memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) );
+    memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) );
+
+    // Validity checks
+    if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) ||  
+            (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) 
+        return -EINVAL;
+    // Type check
+    if ( gen_ie[0] ==  DOT11F_EID_RSN) 
+    {         
+        // Validity checks
+        if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) ||  
+                (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) )
+        {
+            return -EINVAL;
+        }
+        // Skip past the EID byte and length byte  
+        pRsnIe = gen_ie + 2; 
+        RSNIeLen = gen_ie_len - 2; 
+        // Unpack the RSN IE 
+        dot11fUnpackIeRSN((tpAniSirGlobal) halHandle, 
+                            pRsnIe, 
+                            RSNIeLen, 
+                            &dot11RSNIE);
+        // Copy out the encryption and authentication types 
+        hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), 
+                __FUNCTION__, dot11RSNIE.pwise_cipher_suite_count );
+        hddLog(LOG1, FL("%s: authentication suite count: %d"), 
+                __FUNCTION__, dot11RSNIE.akm_suite_count);
+        /*Here we have followed the apple base code, 
+          but probably I suspect we can do something different*/
+        //dot11RSNIE.akm_suite_count
+        // Just translate the FIRST one 
+        *pAuthType =  hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]); 
+        //dot11RSNIE.pwise_cipher_suite_count 
+        *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]);                     
+        //dot11RSNIE.gp_cipher_suite_count 
+        *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite);                     
+        // Set the PMKSA ID Cache for this interface
+        for (i=0; i<dot11RSNIE.pmkid_count; i++) 
+        {
+            if ( pBssid == NULL) 
+            {
+                break;
+            }
+            if ( hdd_IsMACAddrNULL( (u_char *) pBssid , sizeof( (char *) pBssid))) 
+            {
+                break;
+            }
+            // For right now, I assume setASSOCIATE() has passed in the bssid.
+            vos_mem_copy(PMKIDCache[i].BSSID,
+                            pBssid, ETHER_ADDR_LEN);
+            vos_mem_copy(PMKIDCache[i].PMKID,
+                            dot11RSNIE.pmkid[i],
+                            CSR_RSN_PMKID_SIZE);
+        }
+        // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache
+        hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %ld."), 
+                                                                            __FUNCTION__, i );
+        // Finally set the PMKSA ID Cache in CSR
+        result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId,
+                                        PMKIDCache, 
+                                        dot11RSNIE.pmkid_count );
+    }
+    else if (gen_ie[0] == DOT11F_EID_WPA)
+    {
+        // Validity checks
+        if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) ||
+                    (gen_ie_len > DOT11F_IE_WPA_MAX_LEN))
+        {
+            return -EINVAL;
+        }
+        // Skip past the EID byte and length byte - and four byte WiFi OUI
+        pRsnIe = gen_ie + 2 + 4; 
+        RSNIeLen = gen_ie_len - (2 + 4); 
+        // Unpack the WPA IE 
+        dot11fUnpackIeWPA((tpAniSirGlobal) halHandle,
+                            pRsnIe,
+                            RSNIeLen,
+                            &dot11WPAIE);
+        // Copy out the encryption and authentication types
+        hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"),
+               __FUNCTION__, dot11WPAIE.unicast_cipher_count );
+        hddLog(LOG1, FL("%s: WPA authentication suite count: %d"),
+               __FUNCTION__, dot11WPAIE.auth_suite_count);
+        //dot11WPAIE.auth_suite_count
+        // Just translate the FIRST one
+        *pAuthType =  hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]);
+        //dot11WPAIE.unicast_cipher_count
+        *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]);
+        //dot11WPAIE.unicast_cipher_count
+        *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher);
+    }
+    else
+    {
+        hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]);
+        return -EINVAL; 
+    }
+    return 0;
+}
+int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType)
+{
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    v_U32_t status = 0;
+    eCsrEncryptionType RSNEncryptType;
+    eCsrEncryptionType mcRSNEncryptType;
+    struct ether_addr   bSsid;   // MAC address of assoc peer
+    // MAC address of assoc peer
+    // But, this routine is only called when we are NOT associated.
+    vos_mem_copy(bSsid.ether_addr_octet,
+            pWextState->roamProfile.BSSIDs.bssid,
+            sizeof(bSsid.ether_addr_octet));
+    if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA)
+    {
+        //continue
+    } 
+    else
+    {
+        return 0;
+    }
+    // The actual processing may eventually be more extensive than this.
+    // Right now, just consume any PMKIDs that are  sent in by the app.
+    status = hdd_ProcessGENIE(pAdapter,
+            &bSsid,   // MAC address of assoc peer
+            &RSNEncryptType,
+            &mcRSNEncryptType,
+            RSNAuthType,
+            pWextState->WPARSNIE[1]+2,
+            pWextState->WPARSNIE);
+    if (status == 0)
+    {
+        // Now copy over all the security attributes you have parsed out
+        pWextState->roamProfile.EncryptionType.numEntries = 1;
+        pWextState->roamProfile.mcEncryptionType.numEntries = 1;
+        
+        pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE
+        pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType;
+        hddLog( LOG1, "%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", __FUNCTION__, *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
+    }
+    return 0;
+}
+int hdd_set_csr_auth_type ( hdd_adapter_t  *pAdapter, eCsrAuthType RSNAuthType)
+{
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    ENTER();
+    
+    pRoamProfile->AuthType.numEntries = 1;
+    hddLog( LOG1, "%s: pHddStaCtx->conn_info.authType = %d\n", __FUNCTION__, pHddStaCtx->conn_info.authType);
+      
+    switch( pHddStaCtx->conn_info.authType)
+    {
+       case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+#ifdef FEATURE_WLAN_CCX
+       case eCSR_AUTH_TYPE_CCKM_WPA:
+       case eCSR_AUTH_TYPE_CCKM_RSN:
+#endif
+        if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) {           
+           
+           pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ;
+        } else 
+        if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) {
+           
+#ifdef FEATURE_WLAN_CCX
+            if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && 
+                ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) 
+                 == IW_AUTH_KEY_MGMT_802_1X)) { 
+                hddLog( LOG1, "%s: set authType to CCKM WPA. AKM also 802.1X.\n", __FUNCTION__);
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;   
+            } else 
+            if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { 
+                hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.\n", __FUNCTION__);
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;   
+            } else
+#endif
+            if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
+                    == IW_AUTH_KEY_MGMT_802_1X) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA;   
+            } else 
+            if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
+                    == IW_AUTH_KEY_MGMT_PSK) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK;
+            } else {     
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE;
+            }    
+        }
+        if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) {
+#ifdef FEATURE_WLAN_CCX
+            if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && 
+                ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) 
+                 == IW_AUTH_KEY_MGMT_802_1X)) { 
+                hddLog( LOG1, "%s: set authType to CCKM RSN. AKM also 802.1X.\n", __FUNCTION__);
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;   
+            } else
+            if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { 
+                hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.\n", __FUNCTION__);
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;   
+            } else
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+            if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && 
+                ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) 
+                 == IW_AUTH_KEY_MGMT_802_1X)) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN;   
+            }
+            if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && 
+                ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
+                 == IW_AUTH_KEY_MGMT_PSK)) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK;   
+            } else
+#endif
+
+            if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) 
+                    == IW_AUTH_KEY_MGMT_802_1X) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN;   
+            } else 
+            if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
+                    == IW_AUTH_KEY_MGMT_PSK) {
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK;
+            } else {             
+               pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
+            }    
+        }
+        break;     
+         
+       case eCSR_AUTH_TYPE_SHARED_KEY:
+         
+          pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;  
+          break;
+        default:
+         
+#ifdef FEATURE_WLAN_CCX
+           hddLog( LOG1, "%s: In default, unknown auth type.\n", __FUNCTION__); 
+#endif /* FEATURE_WLAN_CCX */
+           pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
+           break;
+    }
+   
+    hddLog( LOG1, "%s Set roam Authtype to %d",
+            __FUNCTION__, pWextState->roamProfile.AuthType.authType[0]);
+   
+   EXIT();
+    return 0;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief iw_set_essid() - 
+   This function sets the ssid received from wpa_supplicant
+   to the CSR roam profile. 
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+
+int iw_set_essid(struct net_device *dev, 
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    v_U32_t status = 0;
+    hdd_wext_state_t *pWextState;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    v_U32_t roamId;
+    tCsrRoamProfile          *pRoamProfile;
+    eMib_dot11DesiredBssType connectedBssType;
+    eCsrAuthType RSNAuthType;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+ 
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+    
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
+    }
+
+    if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) {
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__);
+        return -EBUSY;
+    }
+    if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length )
+        return -EINVAL;
+    pRoamProfile = &pWextState->roamProfile;
+    if (pRoamProfile) 
+    {
+        if ( hdd_connGetConnectedBssType( pHddStaCtx, &connectedBssType ) ||
+             ( eMib_dot11DesiredBssType_independent == pHddStaCtx->conn_info.connDot11DesiredBssType ))
+        {
+            VOS_STATUS vosStatus;
+            // need to issue a disconnect to CSR. 
+            INIT_COMPLETION(pAdapter->disconnect_comp_var);
+            vosStatus = sme_RoamDisconnect( hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED );
+
+            if(VOS_STATUS_SUCCESS == vosStatus)
+               wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+                     msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+        }
+    }
+    /** wpa_supplicant 0.8.x, wext driver uses */
+    else 
+    {
+        return -EINVAL;
+    }
+    /** wpa_supplicant 0.8.x, wext driver uses */
+#ifdef CONFIG_CFG80211
+    /** when cfg80211 defined, wpa_supplicant wext driver uses 
+      zero-length, null-string ssid for force disconnection. 
+      after disconnection (if previously connected) and cleaning ssid, 
+      driver MUST return success */
+    if ( 0 == wrqu->essid.length ) {
+        return 0;
+    }
+#endif
+
+    status = hdd_wmm_get_uapsd_mask(pAdapter,
+                                    &pWextState->roamProfile.uapsd_mask);
+    if (VOS_STATUS_SUCCESS != status)
+    {
+       pWextState->roamProfile.uapsd_mask = 0;
+    }
+    pWextState->roamProfile.SSIDs.numOfSSIDs = 1;
+     
+    pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length;
+   
+    vos_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); 
+    vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length);
+    if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion ||
+        IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) {
+   
+        //set gen ie
+        hdd_SetGENIEToCsr(pAdapter, &RSNAuthType);
+
+        //set auth
+        hdd_set_csr_auth_type(pAdapter, RSNAuthType);
+    }
+#ifdef FEATURE_WLAN_WAPI
+    hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __FUNCTION__);
+    if (pAdapter->wapi_info.nWapiMode)
+    {
+        switch (pAdapter->wapi_info.wapiAuthMode)
+        {
+            case WAPI_AUTH_MODE_PSK:
+            {
+                hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __FUNCTION__, pAdapter->wapi_info.wapiAuthMode);
+                pRoamProfile->AuthType.numEntries = 1;
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
+                break;
+            }
+            case WAPI_AUTH_MODE_CERT:
+            {
+                hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __FUNCTION__, pAdapter->wapi_info.wapiAuthMode);
+                pRoamProfile->AuthType.numEntries = 1;
+                pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
+                break;
+            }
+        } // End of switch
+        if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK ||
+             pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT)
+        {
+            hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __FUNCTION__);
+            pRoamProfile->EncryptionType.numEntries = 1;
+            pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
+            pRoamProfile->mcEncryptionType.numEntries = 1;
+            pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
+        }
+    }
+#endif /* FEATURE_WLAN_WAPI */
+    /* if previous genIE is not NULL, update AssocIE */
+    if (0 != pWextState->genIE.length)
+    {
+        memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) );
+        memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata,
+            pWextState->genIE.length);
+        pWextState->assocAddIE.length = pWextState->genIE.length;
+        pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
+        pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
+
+        /* clear previous genIE after use it */
+        memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
+    }
+
+    /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */
+    pWextState->roamProfile.bWPSAssociation = FALSE;
+
+    if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc,
+        pWextState->roamProfile.nAddIEAssocLength))
+        pWextState->roamProfile.bWPSAssociation = TRUE;
+
+
+    // Disable auto BMPS entry by PMC until DHCP is done
+    sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE);
+
+    pWextState->roamProfile.csrPersona = pAdapter->device_mode; 
+    (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE;
+    status = sme_RoamConnect( hHal,pAdapter->sessionId, &(pWextState->roamProfile),&roamId);
+    pRoamProfile->ChannelInfo.ChannelList = NULL; 
+    pRoamProfile->ChannelInfo.numOfChannels = 0;
+
+    EXIT();
+    return status;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief iw_get_essid() - 
+   This function returns the essid to the wpa_supplicant.
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_get_essid(struct net_device *dev, 
+                       struct iw_request_info *info,
+                       struct iw_point *dwrq, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   ENTER();
+
+   if((pHddStaCtx->conn_info.connState == eConnectionState_Associated &&
+     wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) ||
+      ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected ||
+        pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) &&
+        wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0))
+   {
+       dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length;
+       memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length);
+       dwrq->flags = 1;
+   } else {
+       memset(extra, 0, dwrq->length);
+       dwrq->length = 0;
+       dwrq->flags = 0;
+   }
+   EXIT();
+   return 0;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief iw_set_auth() - 
+   This function sets the auth type received from the wpa_supplicant.
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_set_auth(struct net_device *dev,struct iw_request_info *info,
+                        union iwreq_data *wrqu,char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
+   eCsrEncryptionType mcEncryptionType;   
+   eCsrEncryptionType ucEncryptionType;
+   
+   ENTER();
+   switch(wrqu->param.flags & IW_AUTH_INDEX)
+   {
+      case IW_AUTH_WPA_VERSION:
+        
+         pWextState->wpaVersion = wrqu->param.value;
+       
+         break;
+   
+   case IW_AUTH_CIPHER_PAIRWISE:
+   {
+      if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {            
+         ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+      }           
+      else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
+         ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
+      }            
+      else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
+         ucEncryptionType = eCSR_ENCRYPT_TYPE_AES;
+      }    
+            
+     else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
+           
+         if( (IW_AUTH_KEY_MGMT_802_1X 
+                     == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)  ) 
+                 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) )
+                /*Dynamic WEP key*/
+             ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;     
+         else
+                /*Static WEP key*/
+             ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;              
+      }      
+      else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
+           
+         if( ( IW_AUTH_KEY_MGMT_802_1X 
+                     == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) 
+                 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+                  /*Dynamic WEP key*/
+            ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
+         else
+                /*Static WEP key*/
+            ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+               
+         }
+         else {
+           
+               hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
+                      __FUNCTION__, wrqu->param.value); 
+               return -EINVAL;
+         }
+       
+         pRoamProfile->EncryptionType.numEntries = 1;
+         pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType;
+      }     
+      break;
+      case IW_AUTH_CIPHER_GROUP:
+      {            
+          if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {
+            mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+      }
+        
+      else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
+             mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
+      }
+        
+      else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {              
+              mcEncryptionType = eCSR_ENCRYPT_TYPE_AES;
+      }
+        
+      else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
+           
+         if( ( IW_AUTH_KEY_MGMT_802_1X 
+                     == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) 
+                 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))  
+                                            
+            mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
+            
+         else            
+               mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; 
+      }
+        
+      else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) 
+      {     
+             /*Dynamic WEP keys won't work with shared keys*/
+         if( ( IW_AUTH_KEY_MGMT_802_1X 
+                     == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) 
+                 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+         {
+            mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
+         }
+         else
+         {
+            mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+         }
+      }
+      else {
+           
+          hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
+                 __FUNCTION__, wrqu->param.value); 
+          return -EINVAL;
+       }
+              
+         pRoamProfile->mcEncryptionType.numEntries = 1;
+         pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType;
+      }
+      break;
+
+      case IW_AUTH_80211_AUTH_ALG:
+      {
+           /*Save the auth algo here and set auth type to SME Roam profile
+                in the iw_set_ap_address*/
+          if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM)    
+             pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+          
+          else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY)
+             pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY;
+
+          else if(wrqu->param.value & IW_AUTH_ALG_LEAP)
+            /*Not supported*/
+             pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+          pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType;
+      }
+      break;
+
+      case IW_AUTH_KEY_MGMT:
+      {
+#ifdef FEATURE_WLAN_CCX
+#define IW_AUTH_KEY_MGMT_CCKM       8  /* Should be in linux/wireless.h */
+         /*Check for CCKM AKM type */
+         if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) {
+            //hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"%s: CCKM AKM Set %d\n", __FUNCTION__, wrqu->param.value);
+            hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d\n", __FUNCTION__, wrqu->param.value);
+            /* Set the CCKM bit in authKeyMgmt */ 
+            /* Right now, this breaks all ref to authKeyMgmt because our 
+             * code doesn't realize it is a "bitfield" 
+             */
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM;
+            /*Set the key management to 802.1X*/
+            //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X;
+            pWextState->isCCXConnection = eANI_BOOLEAN_TRUE;
+            //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
+            pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
+         } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) {
+            /*Save the key management*/
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK;
+            //pWextState->authKeyMgmt = wrqu->param.value;
+            //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
+            pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
+         } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) {
+            pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE
+            /*Save the key management anyway*/
+            pWextState->authKeyMgmt = wrqu->param.value;
+         } else { // It must be IW_AUTH_KEY_MGMT_802_1X
+            /*Save the key management*/
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X;
+            //pWextState->authKeyMgmt = wrqu->param.value;
+            //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
+            pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
+         }
+#else
+         /*Save the key management*/
+         pWextState->authKeyMgmt = wrqu->param.value;
+#endif /* FEATURE_WLAN_CCX */
+      }
+      break;
+
+      case IW_AUTH_TKIP_COUNTERMEASURES:
+      {
+         if(wrqu->param.value) {
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Counter Measure started %d", wrqu->param.value);
+            pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED;
+         }
+         else {
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Counter Measure stopped=%d", wrqu->param.value);
+            pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED;
+         }
+      }
+      break;
+      case IW_AUTH_DROP_UNENCRYPTED:
+      case IW_AUTH_WPA_ENABLED:
+      case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+      case IW_AUTH_ROAMING_CONTROL:
+      case IW_AUTH_PRIVACY_INVOKED:
+         
+      default:
+         
+         hddLog(LOGW, "%s called with unsupported auth type %d", __FUNCTION__,
+               wrqu->param.flags & IW_AUTH_INDEX);
+      break;
+   }
+   
+   EXIT();
+   return 0;
+}
+/**---------------------------------------------------------------------------
+ 
+  \brief iw_get_auth() - 
+   This function returns the auth type to the wpa_supplicant.
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
+                         union iwreq_data *wrqu,char *extra)
+{
+    hdd_adapter_t* pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+    tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
+    ENTER();
+    switch(pRoamProfile->negotiatedAuthType)
+    {
+        case eCSR_AUTH_TYPE_WPA_NONE:
+            wrqu->param.flags = IW_AUTH_WPA_VERSION;
+            wrqu->param.value =  IW_AUTH_WPA_VERSION_DISABLED;
+            break;
+        case eCSR_AUTH_TYPE_WPA:
+            wrqu->param.flags = IW_AUTH_WPA_VERSION;
+            wrqu->param.value = IW_AUTH_WPA_VERSION_WPA;
+            break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_AUTH_TYPE_FT_RSN:
+#endif
+        case eCSR_AUTH_TYPE_RSN:
+            wrqu->param.flags = IW_AUTH_WPA_VERSION;
+            wrqu->param.value =  IW_AUTH_WPA_VERSION_WPA2;
+            break;
+         case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+             wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
+             break;
+         case eCSR_AUTH_TYPE_SHARED_KEY:
+             wrqu->param.value =  IW_AUTH_ALG_SHARED_KEY;
+             break;
+         case eCSR_AUTH_TYPE_UNKNOWN:
+             hddLog(LOG1,"%s called with unknown auth type", __FUNCTION__);
+             wrqu->param.value =  IW_AUTH_ALG_OPEN_SYSTEM;
+             break;
+         case eCSR_AUTH_TYPE_AUTOSWITCH:
+             wrqu->param.value =  IW_AUTH_ALG_OPEN_SYSTEM;
+             break;
+         case eCSR_AUTH_TYPE_WPA_PSK:
+             hddLog(LOG1,"%s called with unknown auth type", __FUNCTION__);
+             wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
+             return -EIO;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+         case eCSR_AUTH_TYPE_FT_RSN_PSK:
+#endif
+         case eCSR_AUTH_TYPE_RSN_PSK:
+             hddLog(LOG1,"%s called with unknown auth type", __FUNCTION__);
+             wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
+             return -EIO;
+         default:
+             hddLog(LOG1,"%s called with unknown auth type", __FUNCTION__);
+             wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
+             return -EIO;
+    }
+    if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE))
+    {
+        switch(pRoamProfile->negotiatedUCEncryptionType)
+        {
+            case eCSR_ENCRYPT_TYPE_NONE:
+                wrqu->param.value = IW_AUTH_CIPHER_NONE;
+                break;
+            case eCSR_ENCRYPT_TYPE_WEP40:
+            case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+                wrqu->param.value = IW_AUTH_CIPHER_WEP40;
+                break;
+            case eCSR_ENCRYPT_TYPE_TKIP:
+                wrqu->param.value = IW_AUTH_CIPHER_TKIP;
+                break;
+            case eCSR_ENCRYPT_TYPE_WEP104:
+            case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+                wrqu->param.value = IW_AUTH_CIPHER_WEP104;
+                break;
+            case eCSR_ENCRYPT_TYPE_AES:
+                wrqu->param.value = IW_AUTH_CIPHER_CCMP;
+                break;
+            default:
+                hddLog(LOG1, "%s called with unknown auth type", __FUNCTION__);
+                return -EIO;
+        }
+   }
+
+    if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) 
+    {
+        switch(pRoamProfile->negotiatedMCEncryptionType)
+        {
+        case eCSR_ENCRYPT_TYPE_NONE:
+            wrqu->param.value = IW_AUTH_CIPHER_NONE;
+            break;
+        case eCSR_ENCRYPT_TYPE_WEP40:
+        case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+            wrqu->param.value = IW_AUTH_CIPHER_WEP40;
+            break;
+        case eCSR_ENCRYPT_TYPE_TKIP:
+            wrqu->param.value = IW_AUTH_CIPHER_TKIP;
+            break;
+         case eCSR_ENCRYPT_TYPE_WEP104:
+         case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+             wrqu->param.value = IW_AUTH_CIPHER_WEP104;
+             break;
+         case eCSR_ENCRYPT_TYPE_AES:
+             wrqu->param.value = IW_AUTH_CIPHER_CCMP;
+             break;
+         default:
+             hddLog(LOG1, "%s called with unknown auth type", __FUNCTION__);
+            return -EIO;
+       }
+   }
+
+    hddLog(LOG1, "%s called with auth type %d",
+           __FUNCTION__, pRoamProfile->AuthType.authType[0]);
+    EXIT();
+    return 0;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief iw_set_ap_address() - 
+   This function calls the sme_RoamConnect function to associate 
+   to the AP with the specified BSSID received from the wpa_supplicant.
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_set_ap_address(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
+    v_U8_t  *pMacAddress=NULL;
+    ENTER();
+    pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data;
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%02x:%02x:%02x:%02x:%02x:%02x",pMacAddress[0],pMacAddress[1],
+          pMacAddress[2],pMacAddress[3],pMacAddress[4],pMacAddress[5]);
+    vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid ));
+    EXIT();
+   
+    return 0;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief iw_get_ap_address() - 
+   This function returns the BSSID to the wpa_supplicant
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_get_ap_address(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra)
+{
+    //hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
+
+    ENTER();
+
+    if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) ||
+        (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
+    {
+        memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,sizeof(wrqu->ap_addr.sa_data));
+    }
+    else
+    {
+        memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data));
+    }
+    EXIT();
+    return 0;
+}
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
new file mode 100644
index 0000000..f921155
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -0,0 +1,3123 @@
+/*
+ * 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.
+ */
+
+/**========================================================================= 
+
+                       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 
+  --------    ---    --------------------------------------------------------
+  07/27/09    kanand Created module. 
+
+  ==========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+
+#include <linux/firmware.h>
+#include <linux/string.h>
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_main.h>
+#include <wlan_hdd_assoc.h>
+#include <wlan_hdd_cfg.h>
+#include <linux/string.h>
+#include <vos_types.h>
+#include <csrApi.h>
+#include <pmcApi.h>
+#include <wlan_hdd_misc.h>
+
+
+REG_TABLE_ENTRY g_registry_table[] =
+{
+   REG_VARIABLE( CFG_RTS_THRESHOLD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, RTSThreshold, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RTS_THRESHOLD_DEFAULT, 
+                 CFG_RTS_THRESHOLD_MIN, 
+                 CFG_RTS_THRESHOLD_MAX ), 
+
+   REG_VARIABLE( CFG_FRAG_THRESHOLD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, FragmentationThreshold, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_FRAG_THRESHOLD_DEFAULT, 
+                 CFG_FRAG_THRESHOLD_MIN, 
+                 CFG_FRAG_THRESHOLD_MAX ),              
+
+   REG_VARIABLE( CFG_CALIBRATION_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Calibration, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_CALIBRATION_DEFAULT, 
+                 CFG_CALIBRATION_MIN, 
+                 CFG_CALIBRATION_MAX ),
+                
+   REG_VARIABLE( CFG_CALIBRATION_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, CalibrationPeriod, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_CALIBRATION_PERIOD_DEFAULT, 
+                 CFG_CALIBRATION_PERIOD_MIN, 
+                 CFG_CALIBRATION_PERIOD_MAX ), 
+
+   REG_VARIABLE( CFG_OPERATING_CHANNEL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, OperatingChannel,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_OPERATING_CHANNEL_DEFAULT, 
+                 CFG_OPERATING_CHANNEL_MIN, 
+                 CFG_OPERATING_CHANNEL_MAX ),
+
+   REG_VARIABLE( CFG_SHORT_SLOT_TIME_ENABLED_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, ShortSlotTimeEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SHORT_SLOT_TIME_ENABLED_DEFAULT, 
+                 CFG_SHORT_SLOT_TIME_ENABLED_MIN, 
+                 CFG_SHORT_SLOT_TIME_ENABLED_MAX ),
+
+   REG_VARIABLE( CFG_11D_SUPPORT_ENABLED_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Is11dSupportEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_11D_SUPPORT_ENABLED_DEFAULT, 
+                 CFG_11D_SUPPORT_ENABLED_MIN, 
+                 CFG_11D_SUPPORT_ENABLED_MAX ),
+
+   REG_VARIABLE( CFG_ENFORCE_11D_CHANNELS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fEnforce11dChannels, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_ENFORCE_11D_CHANNELS_DEFAULT, 
+                 CFG_ENFORCE_11D_CHANNELS_MIN, 
+                 CFG_ENFORCE_11D_CHANNELS_MAX ),
+
+   REG_VARIABLE( CFG_COUNTRY_CODE_PRIORITY_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fSupplicantCountryCodeHasPriority, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_COUNTRY_CODE_PRIORITY_DEFAULT, 
+                 CFG_COUNTRY_CODE_PRIORITY_MIN, 
+                 CFG_COUNTRY_CODE_PRIORITY_MAX),
+
+   REG_VARIABLE( CFG_ENFORCE_COUNTRY_CODE_MATCH_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fEnforceCountryCodeMatch, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_ENFORCE_COUNTRY_CODE_MATCH_DEFAULT, 
+                 CFG_ENFORCE_COUNTRY_CODE_MATCH_MIN, 
+                 CFG_ENFORCE_COUNTRY_CODE_MATCH_MAX ),
+
+   REG_VARIABLE( CFG_ENFORCE_DEFAULT_DOMAIN_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fEnforceDefaultDomain, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_ENFORCE_DEFAULT_DOMAIN_DEFAULT, 
+                 CFG_ENFORCE_DEFAULT_DOMAIN_MIN, 
+                 CFG_ENFORCE_DEFAULT_DOMAIN_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_ID1_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg1Id,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_ID1_DEFAULT, 
+                 CFG_GENERIC_ID1_MIN, 
+                 CFG_GENERIC_ID1_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_ID2_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg2Id,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_ID2_DEFAULT, 
+                 CFG_GENERIC_ID2_MIN, 
+                 CFG_GENERIC_ID2_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_ID3_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg3Id,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_ID3_DEFAULT, 
+                 CFG_GENERIC_ID3_MIN, 
+                 CFG_GENERIC_ID3_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_ID4_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg4Id,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_ID4_DEFAULT, 
+                 CFG_GENERIC_ID4_MIN, 
+                 CFG_GENERIC_ID4_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_ID5_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg5Id,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_ID5_DEFAULT, 
+                 CFG_GENERIC_ID5_MIN, 
+                 CFG_GENERIC_ID5_MAX ),
+
+   REG_VARIABLE( CFG_GENERIC_VALUE1_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg1Value,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_VALUE1_DEFAULT, 
+                 CFG_GENERIC_VALUE1_MIN, 
+                 CFG_GENERIC_VALUE1_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_VALUE2_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg2Value,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_VALUE2_DEFAULT, 
+                 CFG_GENERIC_VALUE2_MIN, 
+                 CFG_GENERIC_VALUE2_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_VALUE3_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg3Value,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_VALUE3_DEFAULT, 
+                 CFG_GENERIC_VALUE3_MIN, 
+                 CFG_GENERIC_VALUE3_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_VALUE4_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg4Value,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_VALUE4_DEFAULT, 
+                 CFG_GENERIC_VALUE4_MIN, 
+                 CFG_GENERIC_VALUE4_MAX ),
+                
+   REG_VARIABLE( CFG_GENERIC_VALUE5_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, Cfg5Value,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_GENERIC_VALUE5_DEFAULT, 
+                 CFG_GENERIC_VALUE5_MIN, 
+                 CFG_GENERIC_VALUE5_MAX ),
+
+   REG_VARIABLE( CFG_HEARTBEAT_THRESH_24_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, HeartbeatThresh24, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_HEARTBEAT_THRESH_24_DEFAULT, 
+                 CFG_HEARTBEAT_THRESH_24_MIN, 
+                 CFG_HEARTBEAT_THRESH_24_MAX ),
+                
+   REG_VARIABLE_STRING( CFG_POWER_USAGE_NAME, WLAN_PARAM_String,
+                        hdd_config_t, PowerUsageControl, 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_POWER_USAGE_DEFAULT ),
+
+   REG_VARIABLE( CFG_ENABLE_SUSPEND_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nEnableSuspend, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_SUSPEND_DEFAULT, 
+                 CFG_ENABLE_SUSPEND_MIN, 
+                 CFG_ENABLE_SUSPEND_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_ENABLE_DRIVER_STOP_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nEnableDriverStop, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_ENABLE_DRIVER_STOP_DEFAULT, 
+                 CFG_ENABLE_ENABLE_DRIVER_STOP_MIN, 
+                 CFG_ENABLE_ENABLE_DRIVER_STOP_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_IMPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsImpsEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_IMPS_DEFAULT, 
+                 CFG_ENABLE_IMPS_MIN, 
+                 CFG_ENABLE_IMPS_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_LOGP_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsLogpEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_LOGP_DEFAULT, 
+                 CFG_ENABLE_LOGP_MIN, 
+                 CFG_ENABLE_LOGP_MAX ),
+
+   REG_VARIABLE( CFG_IMPS_MINIMUM_SLEEP_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nImpsMinSleepTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_IMPS_MINIMUM_SLEEP_TIME_DEFAULT, 
+                 CFG_IMPS_MINIMUM_SLEEP_TIME_MIN, 
+                 CFG_IMPS_MINIMUM_SLEEP_TIME_MAX ),
+
+   REG_VARIABLE( CFG_IMPS_MAXIMUM_SLEEP_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nImpsMaxSleepTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_IMPS_MAXIMUM_SLEEP_TIME_DEFAULT, 
+                 CFG_IMPS_MAXIMUM_SLEEP_TIME_MIN, 
+                 CFG_IMPS_MAXIMUM_SLEEP_TIME_MAX ),
+
+   REG_VARIABLE( CFG_IMPS_MODERATE_SLEEP_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nImpsModSleepTime,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_IMPS_MODERATE_SLEEP_TIME_DEFAULT, 
+                 CFG_IMPS_MODERATE_SLEEP_TIME_MIN, 
+                 CFG_IMPS_MODERATE_SLEEP_TIME_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_BMPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsBmpsEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_BMPS_DEFAULT, 
+                 CFG_ENABLE_BMPS_MIN, 
+                 CFG_ENABLE_BMPS_MAX ),
+
+   REG_VARIABLE( CFG_BMPS_MINIMUM_LI_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nBmpsMinListenInterval, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_BMPS_MINIMUM_LI_DEFAULT, 
+                 CFG_BMPS_MINIMUM_LI_MIN, 
+                 CFG_BMPS_MINIMUM_LI_MAX ),
+
+   REG_VARIABLE( CFG_BMPS_MAXIMUM_LI_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nBmpsMaxListenInterval, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_BMPS_MAXIMUM_LI_DEFAULT, 
+                 CFG_BMPS_MAXIMUM_LI_MIN, 
+                 CFG_BMPS_MAXIMUM_LI_MAX ),
+
+   REG_VARIABLE( CFG_BMPS_MODERATE_LI_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nBmpsModListenInterval,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_BMPS_MODERATE_LI_DEFAULT, 
+                 CFG_BMPS_MODERATE_LI_MIN, 
+                 CFG_BMPS_MODERATE_LI_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_AUTO_BMPS_TIMER_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsAutoBmpsTimerEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_AUTO_BMPS_TIMER_DEFAULT, 
+                 CFG_ENABLE_AUTO_BMPS_TIMER_MIN, 
+                 CFG_ENABLE_AUTO_BMPS_TIMER_MAX ),
+
+   REG_VARIABLE( CFG_AUTO_BMPS_TIMER_VALUE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nAutoBmpsTimerValue, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_AUTO_BMPS_TIMER_VALUE_DEFAULT, 
+                 CFG_AUTO_BMPS_TIMER_VALUE_MIN, 
+                 CFG_AUTO_BMPS_TIMER_VALUE_MAX ),
+
+   REG_VARIABLE( CFG_DOT11_MODE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, dot11Mode, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_DOT11_MODE_DEFAULT, 
+                 CFG_DOT11_MODE_MIN, 
+                 CFG_DOT11_MODE_MAX ),
+                 
+   REG_VARIABLE( CFG_CHANNEL_BONDING_MODE_24GHZ_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nChannelBondingMode24GHz, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_CHANNEL_BONDING_MODE_DEFAULT, 
+                 CFG_CHANNEL_BONDING_MODE_MIN, 
+                 CFG_CHANNEL_BONDING_MODE_MAX),
+              
+   REG_VARIABLE( CFG_CHANNEL_BONDING_MODE_5GHZ_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nChannelBondingMode5GHz, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_CHANNEL_BONDING_MODE_DEFAULT, 
+                 CFG_CHANNEL_BONDING_MODE_MIN, 
+                 CFG_CHANNEL_BONDING_MODE_MAX),
+              
+   REG_VARIABLE( CFG_MAX_RX_AMPDU_FACTOR_NAME, WLAN_PARAM_Integer,   
+                 hdd_config_t, MaxRxAmpduFactor, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK , 
+                 CFG_MAX_RX_AMPDU_FACTOR_DEFAULT, 
+                 CFG_MAX_RX_AMPDU_FACTOR_MIN, 
+                 CFG_MAX_RX_AMPDU_FACTOR_MAX),
+                
+   REG_VARIABLE( CFG_FIXED_RATE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, TxRate, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_FIXED_RATE_DEFAULT, 
+                 CFG_FIXED_RATE_MIN, 
+                 CFG_FIXED_RATE_MAX ),
+
+   REG_VARIABLE( CFG_SHORT_GI_20MHZ_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, ShortGI20MhzEnable, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_SHORT_GI_20MHZ_DEFAULT, 
+                 CFG_SHORT_GI_20MHZ_MIN, 
+                 CFG_SHORT_GI_20MHZ_MAX ),
+
+   REG_VARIABLE( CFG_BLOCK_ACK_AUTO_SETUP_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, BlockAckAutoSetup, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_BLOCK_ACK_AUTO_SETUP_DEFAULT, 
+                 CFG_BLOCK_ACK_AUTO_SETUP_MIN, 
+                 CFG_BLOCK_ACK_AUTO_SETUP_MAX ),
+  
+   REG_VARIABLE( CFG_SCAN_RESULT_AGE_COUNT_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, ScanResultAgeCount, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SCAN_RESULT_AGE_COUNT_DEFAULT, 
+                 CFG_SCAN_RESULT_AGE_COUNT_MIN, 
+                 CFG_SCAN_RESULT_AGE_COUNT_MAX ),
+
+   REG_VARIABLE( CFG_SCAN_RESULT_AGE_TIME_NCNPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nScanAgeTimeNCNPS, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCNPS_DEFAULT, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCNPS_MIN, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCNPS_MAX ),
+
+   REG_VARIABLE( CFG_SCAN_RESULT_AGE_TIME_NCPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nScanAgeTimeNCPS, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCPS_DEFAULT, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCPS_MIN, 
+                 CFG_SCAN_RESULT_AGE_TIME_NCPS_MAX ),
+
+   REG_VARIABLE( CFG_SCAN_RESULT_AGE_TIME_CNPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nScanAgeTimeCNPS, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SCAN_RESULT_AGE_TIME_CNPS_DEFAULT, 
+                 CFG_SCAN_RESULT_AGE_TIME_CNPS_MIN, 
+                 CFG_SCAN_RESULT_AGE_TIME_CNPS_MAX ),
+
+   REG_VARIABLE( CFG_SCAN_RESULT_AGE_TIME_CPS_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nScanAgeTimeCPS, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_SCAN_RESULT_AGE_TIME_CPS_DEFAULT, 
+                 CFG_SCAN_RESULT_AGE_TIME_CPS_MIN, 
+                 CFG_SCAN_RESULT_AGE_TIME_CPS_MAX ),
+
+   REG_VARIABLE( CFG_RSSI_CATEGORY_GAP_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nRssiCatGap, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RSSI_CATEGORY_GAP_DEFAULT, 
+                 CFG_RSSI_CATEGORY_GAP_MIN, 
+                 CFG_RSSI_CATEGORY_GAP_MAX ),  
+
+   REG_VARIABLE( CFG_STAT_TIMER_INTERVAL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nStatTimerInterval, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_STAT_TIMER_INTERVAL_DEFAULT, 
+                 CFG_STAT_TIMER_INTERVAL_MIN, 
+                 CFG_STAT_TIMER_INTERVAL_MAX ),
+
+   REG_VARIABLE( CFG_SHORT_PREAMBLE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsShortPreamble, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_SHORT_PREAMBLE_DEFAULT, 
+                 CFG_SHORT_PREAMBLE_MIN, 
+                 CFG_SHORT_PREAMBLE_MAX ),
+
+   REG_VARIABLE( CFG_IBSS_AUTO_BSSID_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsAutoIbssBssid, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_IBSS_AUTO_BSSID_DEFAULT, 
+                 CFG_IBSS_AUTO_BSSID_MIN, 
+                 CFG_IBSS_AUTO_BSSID_MAX ),
+
+   REG_VARIABLE_STRING( CFG_IBSS_BSSID_NAME, WLAN_PARAM_MacAddr,
+                        hdd_config_t, IbssBssid, 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_IBSS_BSSID_DEFAULT ),
+
+   REG_VARIABLE_STRING( CFG_INTF0_MAC_ADDR_NAME, WLAN_PARAM_MacAddr,
+                        hdd_config_t, intfMacAddr[0], 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_INTF0_MAC_ADDR_DEFAULT ),
+
+   REG_VARIABLE_STRING( CFG_INTF1_MAC_ADDR_NAME, WLAN_PARAM_MacAddr,
+                        hdd_config_t, intfMacAddr[1], 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_INTF1_MAC_ADDR_DEFAULT ),
+
+   REG_VARIABLE_STRING( CFG_INTF2_MAC_ADDR_NAME, WLAN_PARAM_MacAddr,
+                        hdd_config_t, intfMacAddr[2], 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_INTF2_MAC_ADDR_DEFAULT ),
+
+   REG_VARIABLE_STRING( CFG_INTF3_MAC_ADDR_NAME, WLAN_PARAM_MacAddr,
+                        hdd_config_t, intfMacAddr[3], 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_INTF3_MAC_ADDR_DEFAULT ),
+
+#ifdef WLAN_SOFTAP_FEATURE
+   REG_VARIABLE( CFG_AP_QOS_UAPSD_MODE_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, apUapsdEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_AP_QOS_UAPSD_MODE_DEFAULT, 
+                 CFG_AP_QOS_UAPSD_MODE_MIN, 
+                 CFG_AP_QOS_UAPSD_MODE_MAX ),
+
+   REG_VARIABLE_STRING( CFG_AP_COUNTRY_CODE, WLAN_PARAM_String,
+                        hdd_config_t, apCntryCode, 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_AP_COUNTRY_CODE_DEFAULT ),
+
+   REG_VARIABLE( CFG_AP_ENABLE_PROTECTION_MODE_NAME, WLAN_PARAM_Integer,
+                        hdd_config_t, apProtEnabled, 
+                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                        CFG_AP_ENABLE_PROTECTION_MODE_DEFAULT,
+                        CFG_AP_ENABLE_PROTECTION_MODE_MIN,
+                        CFG_AP_ENABLE_PROTECTION_MODE_MAX ),
+
+   REG_VARIABLE( CFG_AP_PROTECTION_MODE_NAME, WLAN_PARAM_HexInteger,
+                        hdd_config_t, apProtection,
+                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                        CFG_AP_PROTECTION_MODE_DEFAULT,
+                        CFG_AP_PROTECTION_MODE_MIN,
+                        CFG_AP_PROTECTION_MODE_MAX ),
+                        
+   REG_VARIABLE( CFG_AP_OBSS_PROTECTION_MODE_NAME, WLAN_PARAM_Integer,
+                        hdd_config_t, apOBSSProtEnabled, 
+                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                        CFG_AP_OBSS_PROTECTION_MODE_DEFAULT,
+                        CFG_AP_OBSS_PROTECTION_MODE_MIN,
+                        CFG_AP_OBSS_PROTECTION_MODE_MAX ),
+                        
+   REG_VARIABLE( CFG_AP_STA_SECURITY_SEPERATION_NAME, WLAN_PARAM_Integer,
+                        hdd_config_t, apDisableIntraBssFwd, 
+                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                        CFG_AP_STA_SECURITY_SEPERATION_DEFAULT,
+                        CFG_AP_STA_SECURITY_SEPERATION_MIN,
+                        CFG_AP_STA_SECURITY_SEPERATION_MAX ),
+
+   REG_VARIABLE( CFG_FRAMES_PROCESSING_TH_MODE_NAME, WLAN_PARAM_Integer,
+                        hdd_config_t, MinFramesProcThres, 
+                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                        CFG_FRAMES_PROCESSING_TH_DEFAULT,
+                        CFG_FRAMES_PROCESSING_TH_MIN,
+                        CFG_FRAMES_PROCESSING_TH_MAX ),
+
+   REG_VARIABLE(CFG_SAP_CHANNEL_SELECT_START_CHANNEL , WLAN_PARAM_Integer,
+                 hdd_config_t, apStartChannelNum,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_START_CHANNEL_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_START_CHANNEL_MIN,
+                 CFG_SAP_CHANNEL_SELECT_START_CHANNEL_MAX ),
+
+   REG_VARIABLE(CFG_SAP_CHANNEL_SELECT_END_CHANNEL , WLAN_PARAM_Integer,
+                 hdd_config_t, apEndChannelNum,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_END_CHANNEL_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_END_CHANNEL_MIN,
+                 CFG_SAP_CHANNEL_SELECT_END_CHANNEL_MAX ),
+
+   REG_VARIABLE(CFG_SAP_CHANNEL_SELECT_OPERATING_BAND , WLAN_PARAM_Integer,
+                 hdd_config_t, apOperatingBand,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_DEFAULT,
+                 CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_MIN,
+                 CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_MAX ),
+
+   REG_VARIABLE(CFG_SAP_AUTO_CHANNEL_SELECTION_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, apAutoChannelSelection,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_SAP_AUTO_CHANNEL_SELECTION_DEFAULT,
+                 CFG_SAP_AUTO_CHANNEL_SELECTION_MIN,
+                 CFG_SAP_AUTO_CHANNEL_SELECTION_MAX ),
+   
+   REG_VARIABLE(CFG_ENABLE_LTE_COEX , WLAN_PARAM_Integer,
+                 hdd_config_t, enableLTECoex,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_ENABLE_LTE_COEX_DEFAULT,
+                 CFG_ENABLE_LTE_COEX_MIN,
+                 CFG_ENABLE_LTE_COEX_MAX ),
+
+   REG_VARIABLE( CFG_AP_KEEP_ALIVE_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, apKeepAlivePeriod,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_AP_KEEP_ALIVE_PERIOD_DEFAULT,
+                 CFG_AP_KEEP_ALIVE_PERIOD_MIN,
+                 CFG_AP_KEEP_ALIVE_PERIOD_MAX),
+
+   REG_VARIABLE( CFG_GO_KEEP_ALIVE_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, goKeepAlivePeriod,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_GO_KEEP_ALIVE_PERIOD_DEFAULT,
+                 CFG_GO_KEEP_ALIVE_PERIOD_MIN,
+                 CFG_GO_KEEP_ALIVE_PERIOD_MAX),
+
+#endif
+   REG_VARIABLE(CFG_DISABLE_PACKET_FILTER , WLAN_PARAM_Integer,
+                 hdd_config_t, disablePacketFilter,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_DISABLE_PACKET_FILTER_DEFAULT,
+                 CFG_DISABLE_PACKET_FILTER_MIN,
+                 CFG_DISABLE_PACKET_FILTER_MAX ),
+
+   REG_VARIABLE( CFG_BEACON_INTERVAL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nBeaconInterval, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+                 CFG_BEACON_INTERVAL_DEFAULT, 
+                 CFG_BEACON_INTERVAL_MIN, 
+                 CFG_BEACON_INTERVAL_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_HANDOFF_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsHandoffEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_HANDOFF_DEFAULT, 
+                 CFG_ENABLE_HANDOFF_MIN, 
+                 CFG_ENABLE_HANDOFF_MAX ),
+
+
+   REG_VARIABLE( CFG_ENABLE_IDLE_SCAN_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, nEnableIdleScan, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_IDLE_SCAN_DEFAULT, 
+                 CFG_ENABLE_IDLE_SCAN_MIN, 
+                 CFG_ENABLE_IDLE_SCAN_MAX ),
+
+   REG_VARIABLE( CFG_ROAMING_TIME_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, nRoamingTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ROAMING_TIME_DEFAULT, 
+                 CFG_ROAMING_TIME_MIN, 
+                 CFG_ROAMING_TIME_MAX ),
+
+   REG_VARIABLE( CFG_VCC_RSSI_TRIGGER_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, nVccRssiTrigger, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_VCC_RSSI_TRIGGER_DEFAULT, 
+                 CFG_VCC_RSSI_TRIGGER_MIN, 
+                 CFG_VCC_RSSI_TRIGGER_MAX ),
+
+   REG_VARIABLE( CFG_VCC_UL_MAC_LOSS_THRESH_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, nVccUlMacLossThreshold, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_VCC_UL_MAC_LOSS_THRESH_DEFAULT, 
+                 CFG_VCC_UL_MAC_LOSS_THRESH_MIN, 
+                 CFG_VCC_UL_MAC_LOSS_THRESH_MAX ),
+
+   REG_VARIABLE( CFG_PASSIVE_MAX_CHANNEL_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nPassiveMaxChnTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_DEFAULT, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_MIN, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_MAX ),
+
+   REG_VARIABLE( CFG_PASSIVE_MIN_CHANNEL_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nPassiveMinChnTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_DEFAULT, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_MIN, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_MAX ),
+
+   REG_VARIABLE( CFG_ACTIVE_MAX_CHANNEL_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nActiveMaxChnTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_DEFAULT, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_MIN, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_MAX ),
+
+   REG_VARIABLE( CFG_ACTIVE_MIN_CHANNEL_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nActiveMinChnTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_MIN, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ),
+   
+   REG_VARIABLE( CFG_MAX_PS_POLL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nMaxPsPoll, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_MAX_PS_POLL_DEFAULT, 
+                 CFG_MAX_PS_POLL_MIN, 
+                 CFG_MAX_PS_POLL_MAX ),
+
+    REG_VARIABLE( CFG_MAX_TX_POWER_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nTxPowerCap, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_MAX_TX_POWER_DEFAULT, 
+                 CFG_MAX_TX_POWER_MIN, 
+                 CFG_MAX_TX_POWER_MAX ),
+
+   REG_VARIABLE( CFG_LOW_GAIN_OVERRIDE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIsLowGainOverride,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_LOW_GAIN_OVERRIDE_DEFAULT, 
+                 CFG_LOW_GAIN_OVERRIDE_MIN, 
+                 CFG_LOW_GAIN_OVERRIDE_MAX ),
+
+   REG_VARIABLE( CFG_RSSI_FILTER_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nRssiFilterPeriod,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RSSI_FILTER_PERIOD_DEFAULT, 
+                 CFG_RSSI_FILTER_PERIOD_MIN, 
+                 CFG_RSSI_FILTER_PERIOD_MAX ),
+
+   REG_VARIABLE( CFG_IGNORE_DTIM_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fIgnoreDtim,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_IGNORE_DTIM_DEFAULT, 
+                 CFG_IGNORE_DTIM_MIN, 
+                 CFG_IGNORE_DTIM_MAX ),
+                 
+   REG_VARIABLE( CFG_RX_ANT_CONFIGURATION_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, nRxAnt, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_RX_ANT_CONFIGURATION_NAME_DEFAULT, 
+                CFG_RX_ANT_CONFIGURATION_NAME_MIN, 
+                CFG_RX_ANT_CONFIGURATION_NAME_MAX ),
+
+   REG_VARIABLE( CFG_FW_HEART_BEAT_MONITORING_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, fEnableFwHeartBeatMonitoring, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_FW_HEART_BEAT_MONITORING_DEFAULT, 
+                CFG_FW_HEART_BEAT_MONITORING_MIN, 
+                CFG_FW_HEART_BEAT_MONITORING_MAX ),
+
+   REG_VARIABLE( CFG_FW_BEACON_FILTERING_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, fEnableFwBeaconFiltering, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_FW_BEACON_FILTERING_DEFAULT, 
+                CFG_FW_BEACON_FILTERING_MIN, 
+                CFG_FW_BEACON_FILTERING_MAX ),
+
+   REG_VARIABLE( CFG_FW_RSSI_MONITORING_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, fEnableFwRssiMonitoring, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_FW_RSSI_MONITORING_DEFAULT, 
+                CFG_FW_RSSI_MONITORING_MIN, 
+                CFG_FW_RSSI_MONITORING_MAX ),
+
+   REG_VARIABLE( CFG_DATA_INACTIVITY_TIMEOUT_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, nDataInactivityTimeout, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_DATA_INACTIVITY_TIMEOUT_DEFAULT, 
+                CFG_DATA_INACTIVITY_TIMEOUT_MIN, 
+                CFG_DATA_INACTIVITY_TIMEOUT_MAX ),
+                
+   REG_VARIABLE( CFG_NTH_BEACON_FILTER_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, nthBeaconFilter, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_NTH_BEACON_FILTER_DEFAULT, 
+                CFG_NTH_BEACON_FILTER_MIN, 
+                CFG_NTH_BEACON_FILTER_MAX ),              
+
+   REG_VARIABLE( CFG_QOS_WMM_MODE_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, WmmMode, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_MODE_DEFAULT, 
+                 CFG_QOS_WMM_MODE_MIN, 
+                 CFG_QOS_WMM_MODE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_80211E_ENABLED_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, b80211eIsEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_80211E_ENABLED_DEFAULT, 
+                 CFG_QOS_WMM_80211E_ENABLED_MIN, 
+                 CFG_QOS_WMM_80211E_ENABLED_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_UAPSD_MASK_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, UapsdMask, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_UAPSD_MASK_DEFAULT, 
+                 CFG_QOS_WMM_UAPSD_MASK_MIN, 
+                 CFG_QOS_WMM_UAPSD_MASK_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_MAX_SP_LEN_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, MaxSpLength, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_MAX_SP_LEN_DEFAULT, 
+                 CFG_QOS_WMM_MAX_SP_LEN_MIN, 
+                 CFG_QOS_WMM_MAX_SP_LEN_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdVoSrvIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SRV_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdVoSuspIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VO_SUS_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdViSrvIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SRV_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdViSuspIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_VI_SUS_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdBeSrvIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SRV_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdBeSuspIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BE_SUS_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdBkSrvIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SRV_INTV_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraUapsdBkSuspIntv, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_MIN, 
+                 CFG_QOS_WMM_INFRA_UAPSD_BK_SUS_INTV_MAX ),
+
+#ifdef FEATURE_WLAN_CCX
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, InfraInactivityInterval, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_MIN, 
+                 CFG_QOS_WMM_INFRA_INACTIVITY_INTERVAL_MAX),
+   REG_VARIABLE( CFG_CCX_FEATURE_ENABLED_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, isCcxIniFeatureEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_CCX_FEATURE_ENABLED_DEFAULT, 
+                 CFG_CCX_FEATURE_ENABLED_MIN, 
+                 CFG_CCX_FEATURE_ENABLED_MAX),
+#endif // FEATURE_WLAN_CCX
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+   REG_VARIABLE( CFG_FT_RSSI_FILTER_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, FTRssiFilterPeriod,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_FT_RSSI_FILTER_PERIOD_DEFAULT, 
+                 CFG_FT_RSSI_FILTER_PERIOD_MIN, 
+                 CFG_FT_RSSI_FILTER_PERIOD_MAX ),
+
+
+   // flag to turn ON/OFF 11r and CCX FastTransition
+   REG_VARIABLE( CFG_FAST_TRANSITION_ENABLED_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, isFastTransitionEnabled,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_FAST_TRANSITION_ENABLED_NAME_DEFAULT, 
+                 CFG_FAST_TRANSITION_ENABLED_NAME_MIN, 
+                 CFG_FAST_TRANSITION_ENABLED_NAME_MAX),
+#endif
+
+   REG_VARIABLE( CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, PktClassificationBasis, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_PKT_CLASSIFY_BASIS_DEFAULT, 
+                 CFG_QOS_WMM_PKT_CLASSIFY_BASIS_MIN, 
+                 CFG_QOS_WMM_PKT_CLASSIFY_BASIS_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_DIR_AC_VO_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraDirAcVo, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VO_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VO_MIN, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VO_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraNomMsduSizeAcVo, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_MIN, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VO_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMeanDataRateAcVo, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_MIN, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VO_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMinPhyRateAcVo, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_MIN, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VO_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_SBA_AC_VO_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraSbaAcVo, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VO_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VO_MIN, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VO_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_DIR_AC_VI_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraDirAcVi, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VI_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VI_MIN, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_VI_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraNomMsduSizeAcVi, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_MIN, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_VI_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMeanDataRateAcVi, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_MIN, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_VI_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMinPhyRateAcVi, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_MIN, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_VI_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_SBA_AC_VI_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraSbaAcVi, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VI_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VI_MIN, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_VI_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_DIR_AC_BE_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraDirAcBe, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BE_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BE_MIN, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraNomMsduSizeAcBe, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_MIN, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMeanDataRateAcBe, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_MIN, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMinPhyRateAcBe, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_MIN, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_SBA_AC_BE_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraSbaAcBe, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BE_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BE_MIN, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BE_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_DIR_AC_BK_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, InfraDirAcBk, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BK_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BK_MIN, 
+                 CFG_QOS_WMM_INFRA_DIR_AC_BK_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraNomMsduSizeAcBk, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_MIN, 
+                 CFG_QOS_WMM_INFRA_NOM_MSDU_SIZE_AC_BK_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMeanDataRateAcBk, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_MIN, 
+                 CFG_QOS_WMM_INFRA_MEAN_DATA_RATE_AC_BK_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraMinPhyRateAcBk, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_MIN, 
+                 CFG_QOS_WMM_INFRA_MIN_PHY_RATE_AC_BK_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_INFRA_SBA_AC_BK_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, InfraSbaAcBk, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BK_DEFAULT, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BK_MIN, 
+                 CFG_QOS_WMM_INFRA_SBA_AC_BK_MAX ),
+
+   REG_VARIABLE( CFG_TL_WFQ_BK_WEIGHT_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, WfqBkWeight, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_TL_WFQ_BK_WEIGHT_DEFAULT, 
+                 CFG_TL_WFQ_BK_WEIGHT_MIN, 
+                 CFG_TL_WFQ_BK_WEIGHT_MAX ),
+
+   REG_VARIABLE( CFG_TL_WFQ_BE_WEIGHT_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, WfqBeWeight, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_TL_WFQ_BE_WEIGHT_DEFAULT, 
+                 CFG_TL_WFQ_BE_WEIGHT_MIN, 
+                 CFG_TL_WFQ_BE_WEIGHT_MAX ),
+
+   REG_VARIABLE( CFG_TL_WFQ_VI_WEIGHT_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, WfqViWeight, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_TL_WFQ_VI_WEIGHT_DEFAULT, 
+                 CFG_TL_WFQ_VI_WEIGHT_MIN, 
+                 CFG_TL_WFQ_VI_WEIGHT_MAX ),
+
+   REG_VARIABLE( CFG_TL_WFQ_VO_WEIGHT_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, WfqVoWeight, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_TL_WFQ_VO_WEIGHT_DEFAULT, 
+                 CFG_TL_WFQ_VO_WEIGHT_MIN, 
+                 CFG_TL_WFQ_VO_WEIGHT_MAX ),
+
+   REG_VARIABLE( CFG_TL_DELAYED_TRGR_FRM_INT_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, DelayedTriggerFrmInt, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_TL_DELAYED_TRGR_FRM_INT_DEFAULT, 
+                 CFG_TL_DELAYED_TRGR_FRM_INT_MIN, 
+                 CFG_TL_DELAYED_TRGR_FRM_INT_MAX ),
+
+   REG_VARIABLE_STRING( CFG_WOWL_PATTERN_NAME, WLAN_PARAM_String,
+                        hdd_config_t, wowlPattern, 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_WOWL_PATTERN_DEFAULT ),
+
+   REG_VARIABLE( CFG_QOS_IMPLICIT_SETUP_ENABLED_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, bImplicitQosEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_IMPLICIT_SETUP_ENABLED_DEFAULT, 
+                 CFG_QOS_IMPLICIT_SETUP_ENABLED_MIN, 
+                 CFG_QOS_IMPLICIT_SETUP_ENABLED_MAX ),
+
+   REG_VARIABLE( CFG_19P2_MHZ_PMIC_CLK_ENABLED_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, b19p2MhzPmicClkEnabled, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_19P2_MHZ_PMIC_CLK_ENABLED_DEFAULT, 
+                 CFG_19P2_MHZ_PMIC_CLK_ENABLED_MIN, 
+                 CFG_19P2_MHZ_PMIC_CLK_ENABLED_MAX ),
+
+   REG_VARIABLE( CFG_BTC_EXECUTION_MODE_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, btcExecutionMode, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_BTC_EXECUTION_MODE_DEFAULT, 
+                 CFG_BTC_EXECUTION_MODE_MIN, 
+                 CFG_BTC_EXECUTION_MODE_MAX ),
+
+   REG_VARIABLE( CFG_BTC_DHCP_PROTECTION_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, btcConsBtSlotsToBlockDuringDhcp,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_BTC_DHCP_PROTECTION_DEFAULT,
+                 CFG_BTC_DHCP_PROTECTION_MIN,
+                 CFG_BTC_DHCP_PROTECTION_MAX ),
+
+   REG_VARIABLE( CFG_BTC_A2DP_DHCP_PROTECTION_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, btcA2DPBtSubIntervalsDuringDhcp,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_BTC_A2DP_DHCP_PROTECTION_DEFAULT,
+                 CFG_BTC_A2DP_DHCP_PROTECTION_MIN,
+                 CFG_BTC_A2DP_DHCP_PROTECTION_MAX ),
+
+#ifdef WLAN_SOFTAP_FEATURE
+   REG_VARIABLE( CFG_AP_LISTEN_MODE_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, nEnableListenMode, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_AP_LISTEN_MODE_DEFAULT, 
+                 CFG_AP_LISTEN_MODE_MIN, 
+                 CFG_AP_LISTEN_MODE_MAX ),                     
+
+   REG_VARIABLE( CFG_AP_AUTO_SHUT_OFF , WLAN_PARAM_Integer,
+                 hdd_config_t, nAPAutoShutOff,
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_AP_AUTO_SHUT_OFF_DEFAULT,
+                 CFG_AP_AUTO_SHUT_OFF_MIN,
+                 CFG_AP_AUTO_SHUT_OFF_MAX ),
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+   REG_VARIABLE( CFG_RRM_ENABLE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fRrmEnable, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RRM_ENABLE_DEFAULT, 
+                 CFG_RRM_ENABLE_MIN, 
+                 CFG_RRM_ENABLE_MAX ),
+
+   REG_VARIABLE( CFG_RRM_OPERATING_CHAN_MAX_DURATION_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nInChanMeasMaxDuration, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RRM_OPERATING_CHAN_MAX_DURATION_DEFAULT, 
+                 CFG_RRM_OPERATING_CHAN_MAX_DURATION_MIN, 
+                 CFG_RRM_OPERATING_CHAN_MAX_DURATION_MAX ),
+
+   REG_VARIABLE( CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nOutChanMeasMaxDuration, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_DEFAULT, 
+                 CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MIN, 
+                 CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MAX ),
+
+   REG_VARIABLE( CFG_RRM_MEAS_RANDOMIZATION_INTVL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nRrmRandnIntvl, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_RRM_MEAS_RANDOMIZATION_INTVL_DEFAULT, 
+                 CFG_RRM_MEAS_RANDOMIZATION_INTVL_MIN, 
+                 CFG_RRM_MEAS_RANDOMIZATION_INTVL_MAX ),
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R   
+   REG_VARIABLE( CFG_FT_ENABLE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fFTEnable, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_FT_ENABLE_DEFAULT, 
+                 CFG_FT_ENABLE_MIN, 
+                 CFG_FT_ENABLE_MAX ),
+
+   REG_VARIABLE( CFG_FT_RESOURCE_REQ_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fFTResourceReqSupported, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_FT_RESOURCE_REQ_DEFAULT, 
+                 CFG_FT_RESOURCE_REQ_MIN, 
+                 CFG_FT_RESOURCE_REQ_MAX ),
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+   REG_VARIABLE( CFG_NEIGHBOR_SCAN_TIMER_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborScanPeriod, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_TIMER_PERIOD_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MIN, 
+                 CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MAX ),
+
+   REG_VARIABLE( CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborReassocRssiThreshold, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_DEFAULT, 
+                 CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_MIN, 
+                 CFG_NEIGHBOR_REASSOC_RSSI_THRESHOLD_MAX ),
+
+   REG_VARIABLE( CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborLookupRssiThreshold, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_DEFAULT, 
+                 CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_MIN, 
+                 CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_MAX ),
+
+   REG_VARIABLE_STRING( CFG_NEIGHBOR_SCAN_CHAN_LIST_NAME, WLAN_PARAM_String,
+                        hdd_config_t, neighborScanChanList, 
+                        VAR_FLAGS_OPTIONAL,
+                        (void *)CFG_NEIGHBOR_SCAN_CHAN_LIST_DEFAULT ),
+
+   REG_VARIABLE( CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborScanMinChanTime,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_DEFAULT,
+                 CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_MIN,
+                 CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_MAX ),
+
+   REG_VARIABLE( CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborScanMaxChanTime, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_MIN, 
+                 CFG_NEIGHBOR_SCAN_MAX_CHAN_TIME_MAX ),
+
+   REG_VARIABLE( CFG_11R_NEIGHBOR_REQ_MAX_TRIES_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nMaxNeighborReqTries,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_11R_NEIGHBOR_REQ_MAX_TRIES_DEFAULT,
+                 CFG_11R_NEIGHBOR_REQ_MAX_TRIES_MIN,
+                 CFG_11R_NEIGHBOR_REQ_MAX_TRIES_MAX),
+
+   REG_VARIABLE( CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nNeighborResultsRefreshPeriod, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_DEFAULT, 
+                 CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN, 
+                 CFG_NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX ),
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
+   REG_VARIABLE( CFG_QOS_WMM_BURST_SIZE_DEFN_NAME , WLAN_PARAM_Integer,
+                 hdd_config_t, burstSizeDefinition, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_BURST_SIZE_DEFN_DEFAULT, 
+                 CFG_QOS_WMM_BURST_SIZE_DEFN_MIN, 
+                 CFG_QOS_WMM_BURST_SIZE_DEFN_MAX ),
+
+   REG_VARIABLE( CFG_MCAST_BCAST_FILTER_SETTING_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, mcastBcastFilterSetting,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_MCAST_BCAST_FILTER_SETTING_DEFAULT,
+                 CFG_MCAST_BCAST_FILTER_SETTING_MIN,
+                 CFG_MCAST_BCAST_FILTER_SETTING_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_HOST_ARPOFFLOAD_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, fhostArpOffload,
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_ENABLE_HOST_ARPOFFLOAD_DEFAULT,
+                 CFG_ENABLE_HOST_ARPOFFLOAD_MIN,
+                 CFG_ENABLE_HOST_ARPOFFLOAD_MAX ),
+
+   REG_VARIABLE( CFG_QOS_WMM_TS_INFO_ACK_POLICY_NAME , WLAN_PARAM_HexInteger,
+                 hdd_config_t, tsInfoAckPolicy, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_QOS_WMM_TS_INFO_ACK_POLICY_DEFAULT, 
+                 CFG_QOS_WMM_TS_INFO_ACK_POLICY_MIN, 
+                 CFG_QOS_WMM_TS_INFO_ACK_POLICY_MAX ),
+
+    REG_VARIABLE( CFG_SINGLE_TID_RC_NAME, WLAN_PARAM_Integer,
+                  hdd_config_t, bSingleTidRc,
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                  CFG_SINGLE_TID_RC_DEFAULT,
+                  CFG_SINGLE_TID_RC_MIN,
+                  CFG_SINGLE_TID_RC_MAX),
+
+    REG_VARIABLE( CFG_DYNAMIC_PSPOLL_VALUE_NAME, WLAN_PARAM_Integer,
+                  hdd_config_t, dynamicPsPollValue,
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                  CFG_DYNAMIC_PSPOLL_VALUE_DEFAULT,
+                  CFG_DYNAMIC_PSPOLL_VALUE_MIN,
+                  CFG_DYNAMIC_PSPOLL_VALUE_MAX ),
+
+   REG_VARIABLE( CFG_TELE_BCN_WAKEUP_EN_NAME, WLAN_PARAM_Integer,
+                  hdd_config_t, teleBcnWakeupEn,
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                  CFG_TELE_BCN_WAKEUP_EN_DEFAULT,
+                  CFG_TELE_BCN_WAKEUP_EN_MIN,
+                  CFG_TELE_BCN_WAKEUP_EN_MAX ),
+
+    REG_VARIABLE( CFG_INFRA_STA_KEEP_ALIVE_PERIOD_NAME, WLAN_PARAM_Integer,
+                  hdd_config_t, infraStaKeepAlivePeriod,
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                  CFG_INFRA_STA_KEEP_ALIVE_PERIOD_DEFAULT,
+                  CFG_INFRA_STA_KEEP_ALIVE_PERIOD_MIN,
+                  CFG_INFRA_STA_KEEP_ALIVE_PERIOD_MAX),
+
+    REG_VARIABLE( CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_NAME , WLAN_PARAM_Integer,
+                  hdd_config_t, AddTSWhenACMIsOff, 
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                  CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_DEFAULT, 
+                  CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MIN, 
+                  CFG_QOS_ADDTS_WHEN_ACM_IS_OFF_MAX ),
+
+
+    REG_VARIABLE( CFG_VALIDATE_SCAN_LIST_NAME , WLAN_PARAM_Integer,
+                  hdd_config_t, fValidateScanList, 
+                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                  CFG_VALIDATE_SCAN_LIST_DEFAULT, 
+                  CFG_VALIDATE_SCAN_LIST_MIN, 
+                  CFG_VALIDATE_SCAN_LIST_MAX ),
+   
+    REG_VARIABLE( CFG_NULLDATA_AP_RESP_TIMEOUT_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, nNullDataApRespTimeout, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_NULLDATA_AP_RESP_TIMEOUT_DEFAULT, 
+                CFG_NULLDATA_AP_RESP_TIMEOUT_MIN, 
+                CFG_NULLDATA_AP_RESP_TIMEOUT_MAX ),
+
+    REG_VARIABLE( CFG_AP_DATA_AVAIL_POLL_PERIOD_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, apDataAvailPollPeriodInMs, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_AP_DATA_AVAIL_POLL_PERIOD_DEFAULT, 
+                CFG_AP_DATA_AVAIL_POLL_PERIOD_MIN, 
+                CFG_AP_DATA_AVAIL_POLL_PERIOD_MAX ),
+                                
+   REG_VARIABLE( CFG_ENABLE_BTAMP_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, enableBtAmp, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ENABLE_BTAMP_DEFAULT, 
+                 CFG_ENABLE_BTAMP_MIN, 
+                 CFG_ENABLE_BTAMP_MAX ),
+
+#ifdef WLAN_BTAMP_FEATURE
+   REG_VARIABLE( CFG_BT_AMP_PREFERRED_CHANNEL_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, preferredChannel, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                 CFG_BT_AMP_PREFERRED_CHANNEL_DEFAULT,
+                 CFG_BT_AMP_PREFERRED_CHANNEL_MIN,
+                 CFG_BT_AMP_PREFERRED_CHANNEL_MAX ),
+#endif //WLAN_BTAMP_FEATURE
+   REG_VARIABLE( CFG_BAND_CAPABILITY_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nBandCapability, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_BAND_CAPABILITY_DEFAULT, 
+                 CFG_BAND_CAPABILITY_MIN, 
+                 CFG_BAND_CAPABILITY_MAX ), 
+
+   REG_VARIABLE( CFG_ENABLE_BEACON_EARLY_TERMINATION_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, fEnableBeaconEarlyTermination, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_ENABLE_BEACON_EARLY_TERMINATION_DEFAULT, 
+                CFG_ENABLE_BEACON_EARLY_TERMINATION_MIN, 
+                CFG_ENABLE_BEACON_EARLY_TERMINATION_MAX ), 
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* note that since the default value is out of range we cannot
+      enable range check, otherwise we get a system log message */
+   REG_VARIABLE( CFG_WDI_TRACE_ENABLE_DAL_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, wdiTraceEnableDAL,
+                VAR_FLAGS_OPTIONAL,
+                CFG_WDI_TRACE_ENABLE_DEFAULT,
+                CFG_WDI_TRACE_ENABLE_MIN,
+                CFG_WDI_TRACE_ENABLE_MAX ),
+
+   REG_VARIABLE( CFG_WDI_TRACE_ENABLE_CTL_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, wdiTraceEnableCTL,
+                VAR_FLAGS_OPTIONAL,
+                CFG_WDI_TRACE_ENABLE_DEFAULT,
+                CFG_WDI_TRACE_ENABLE_MIN,
+                CFG_WDI_TRACE_ENABLE_MAX ),
+
+   REG_VARIABLE( CFG_WDI_TRACE_ENABLE_DAT_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, wdiTraceEnableDAT,
+                VAR_FLAGS_OPTIONAL,
+                CFG_WDI_TRACE_ENABLE_DEFAULT,
+                CFG_WDI_TRACE_ENABLE_MIN,
+                CFG_WDI_TRACE_ENABLE_MAX ),
+
+   REG_VARIABLE( CFG_WDI_TRACE_ENABLE_PAL_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, wdiTraceEnablePAL,
+                VAR_FLAGS_OPTIONAL,
+                CFG_WDI_TRACE_ENABLE_DEFAULT,
+                CFG_WDI_TRACE_ENABLE_MIN,
+                CFG_WDI_TRACE_ENABLE_MAX ),
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+  REG_VARIABLE( CFG_TELE_BCN_TRANS_LI_NAME, WLAN_PARAM_Integer,
+               hdd_config_t, nTeleBcnTransListenInterval, 
+               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+               CFG_TELE_BCN_TRANS_LI_DEFAULT, 
+               CFG_TELE_BCN_TRANS_LI_MIN, 
+               CFG_TELE_BCN_TRANS_LI_MAX ), 
+
+  REG_VARIABLE( CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_NAME, WLAN_PARAM_Integer,
+               hdd_config_t, nTeleBcnTransLiNumIdleBeacons, 
+               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+               CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_DEFAULT, 
+               CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_MIN, 
+               CFG_TELE_BCN_TRANS_LI_NUM_IDLE_BCNS_MAX ), 
+
+  REG_VARIABLE( CFG_TELE_BCN_MAX_LI_NAME, WLAN_PARAM_Integer,
+               hdd_config_t, nTeleBcnMaxListenInterval, 
+               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+               CFG_TELE_BCN_MAX_LI_DEFAULT, 
+               CFG_TELE_BCN_MAX_LI_MIN, 
+               CFG_TELE_BCN_MAX_LI_MAX ), 
+
+  REG_VARIABLE( CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_NAME, WLAN_PARAM_Integer,
+               hdd_config_t, nTeleBcnMaxLiNumIdleBeacons, 
+               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+               CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_DEFAULT, 
+               CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_MIN, 
+               CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_MAX ), 
+
+  REG_VARIABLE( CFG_BCN_EARLY_TERM_WAKE_NAME, WLAN_PARAM_Integer,
+               hdd_config_t, bcnEarlyTermWakeInterval, 
+               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+               CFG_BCN_EARLY_TERM_WAKE_DEFAULT, 
+               CFG_BCN_EARLY_TERM_WAKE_MIN, 
+               CFG_BCN_EARLY_TERM_WAKE_MAX ), 
+
+ REG_VARIABLE( CFG_AP_DATA_AVAIL_POLL_PERIOD_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, apDataAvailPollPeriodInMs, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_AP_DATA_AVAIL_POLL_PERIOD_DEFAULT, 
+              CFG_AP_DATA_AVAIL_POLL_PERIOD_MIN, 
+              CFG_AP_DATA_AVAIL_POLL_PERIOD_MAX ),
+
+   REG_VARIABLE( CFG_ENABLE_CLOSE_LOOP_NAME, WLAN_PARAM_Integer,
+                hdd_config_t, enableCloseLoop, 
+                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                CFG_ENABLE_CLOSE_LOOP_DEFAULT, 
+                CFG_ENABLE_CLOSE_LOOP_MIN, 
+                CFG_ENABLE_CLOSE_LOOP_MAX ),
+
+ REG_VARIABLE( CFG_ENABLE_BYPASS_11D_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableBypass11d, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_BYPASS_11D_DEFAULT, 
+              CFG_ENABLE_BYPASS_11D_MIN, 
+              CFG_ENABLE_BYPASS_11D_MAX ),
+
+ REG_VARIABLE( CFG_ENABLE_DFS_CHNL_SCAN_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableDFSChnlScan, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT, 
+              CFG_ENABLE_DFS_CHNL_SCAN_MIN, 
+              CFG_ENABLE_DFS_CHNL_SCAN_MAX ),
+
+ REG_VARIABLE( CFG_ENABLE_DYNAMIC_DTIM_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableDynamicDTIM, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_DYNAMIC_DTIM_DEFAULT, 
+              CFG_ENABLE_DYNAMIC_DTIM_MIN, 
+              CFG_ENABLE_DYNAMIC_DTIM_MAX ),
+
+ REG_VARIABLE( CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableAutomaticTxPowerControl, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_DEFAULT, 
+              CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MIN, 
+              CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MAX ),
+
+ REG_VARIABLE( CFG_SHORT_GI_40MHZ_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, ShortGI40MhzEnable, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_SHORT_GI_40MHZ_DEFAULT, 
+              CFG_SHORT_GI_40MHZ_MIN, 
+              CFG_SHORT_GI_40MHZ_MAX ),
+
+ REG_DYNAMIC_VARIABLE( CFG_REPORT_MAX_LINK_SPEED, WLAN_PARAM_Integer,
+                       hdd_config_t, reportMaxLinkSpeed, 
+                       VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                       CFG_REPORT_MAX_LINK_SPEED_DEFAULT, 
+                       CFG_REPORT_MAX_LINK_SPEED_MIN, 
+                       CFG_REPORT_MAX_LINK_SPEED_MAX,
+                       NULL, 0 ),
+
+ REG_DYNAMIC_VARIABLE( CFG_LINK_SPEED_RSSI_HIGH, WLAN_PARAM_SignedInteger,
+                       hdd_config_t, linkSpeedRssiHigh,
+                       VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                       CFG_LINK_SPEED_RSSI_HIGH_DEFAULT,
+                       CFG_LINK_SPEED_RSSI_HIGH_MIN,
+                       CFG_LINK_SPEED_RSSI_HIGH_MAX,
+                       NULL, 0 ),
+
+ REG_DYNAMIC_VARIABLE( CFG_LINK_SPEED_RSSI_LOW, WLAN_PARAM_SignedInteger,
+                       hdd_config_t, linkSpeedRssiLow,
+                       VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                       CFG_LINK_SPEED_RSSI_LOW_DEFAULT,
+                       CFG_LINK_SPEED_RSSI_LOW_MIN,
+                       CFG_LINK_SPEED_RSSI_LOW_MAX,
+                       NULL, 0 ),
+
+#ifdef WLAN_FEATURE_P2P
+ REG_VARIABLE( CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, isP2pDeviceAddrAdministrated,
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+              CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_DEFAULT,
+              CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_MIN,
+              CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED_MAX ),
+#endif
+
+REG_VARIABLE( CFG_ENABLE_MCC_ENABLED_NAME, WLAN_PARAM_Integer,
+             hdd_config_t, enableMCC, 
+             VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+             CFG_ENABLE_MCC_ENABLED_DEFAULT, 
+             CFG_ENABLE_MCC_ENABLED_MIN, 
+             CFG_ENABLE_MCC_ENABLED_MAX ),
+
+ REG_VARIABLE( CFG_THERMAL_MIGRATION_ENABLE_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, thermalMitigationEnable, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_THERMAL_MIGRATION_ENABLE_DEFAULT, 
+              CFG_THERMAL_MIGRATION_ENABLE_MIN, 
+              CFG_THERMAL_MIGRATION_ENABLE_MAX ),
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ REG_VARIABLE( CFG_MC_ADDR_LIST_FILTER_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, isMcAddrListFilter,
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+              CFG_MC_ADDR_LIST_FILTER_DEFAULT,
+              CFG_MC_ADDR_LIST_FILTER_MIN,
+              CFG_MC_ADDR_LIST_FILTER_MAX ),
+#endif
+  
+REG_VARIABLE( CFG_ENABLE_MODULATED_DTIM_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableModulatedDTIM, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_MODULATED_DTIM_DEFAULT, 
+              CFG_ENABLE_MODULATED_DTIM_MIN, 
+              CFG_ENABLE_MODULATED_DTIM_MAX ),
+
+};
+
+/*
+ * This function returns a pointer to the character after the occurence
+ * of a new line character. It also modifies the original string by replacing
+ * the '\n' character with the null character.
+ * Function returns NULL if no new line character was found before end of
+ * string was reached
+ */
+static char* get_next_line(char* str)
+{
+  char c;
+
+  if( str == NULL || *str == '\0') {
+    return NULL;
+  }
+
+  c = *str;
+  while(c != '\n'  && c != '\0' && c != 0xd)  { 
+    str = str + 1;
+    c = *str;
+  }
+
+  if (c == '\0' ) {
+    return NULL;
+  }
+  else
+  {
+    *str = '\0'; 
+    return (str+1);
+  }
+
+  return NULL;
+}
+
+// look for space. Ascii values to look are -
+// 0x09 == horizontal tab
+// 0x0a == Newline ("\n")
+// 0x0b == vertical tab
+// 0x0c == Newpage or feed form.
+// 0x0d == carriage return (CR or "\r")
+// Null ('\0') should not considered as space.
+#define i_isspace(ch)  (((ch) >= 0x09 && (ch) <= 0x0d) || (ch) == ' ')
+
+/*
+ * This function trims any leading and trailing white spaces
+ */
+static char *i_trim(char *str)
+
+{
+   char *ptr;
+
+   if(*str == '\0') return str;
+
+   /* Find the first non white-space*/
+   for (ptr = str; i_isspace(*ptr); ptr++);
+      if (*ptr == '\0')
+         return str;
+
+   /* This is the new start of the string*/
+   str = ptr;
+
+   /* Find the last non white-space */
+   ptr += strlen(ptr) - 1;
+   for (; ptr != str && i_isspace(*ptr); ptr--);
+      /* Null terminate the following character */
+      ptr[1] = '\0';
+                                  
+   return str;
+}
+
+
+//Structure to store each entry in qcom_cfg.ini file
+typedef struct
+{
+   char *name;
+   char *value;
+}tCfgIniEntry;
+
+static VOS_STATUS hdd_apply_cfg_ini( hdd_context_t * pHddCtx, 
+    tCfgIniEntry* iniTable, unsigned long entries);
+
+#ifdef WLAN_CFG_DEBUG
+void dump_cfg_ini (tCfgIniEntry* iniTable, unsigned long entries) 
+{
+   unsigned long i;
+
+   for (i = 0; i < entries; i++) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s entry Name=[%s] value=[%s]", 
+           WLAN_INI_FILE, iniTable[i].name, iniTable[i].value);
+     }
+}
+#endif 
+
+/*
+ * This function reads the qcom_cfg.ini file and
+ * parses each 'Name=Value' pair in the ini file
+ */
+VOS_STATUS hdd_parse_config_ini(hdd_context_t* pHddCtx)
+{
+   int status, i=0;
+   /** Pointer for firmware image data */
+   const struct firmware *fw = NULL;
+   char *buffer, *line,*pTemp;
+   size_t size;
+   char *name, *value;
+   tCfgIniEntry cfgIniTable[MAX_CFG_INI_ITEMS];
+   VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+
+   memset(cfgIniTable, 0, sizeof(cfgIniTable));
+
+   status = request_firmware(&fw, WLAN_INI_FILE, pHddCtx->parent_dev);
+   
+   if(status)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: request_firmware failed %d\n",__FUNCTION__, status);
+      return VOS_STATUS_E_FAILURE;   
+   }
+   if(!fw || !fw->data || !fw->size) 
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: %s download failed\n",
+             __FUNCTION__, WLAN_INI_FILE);
+      return VOS_STATUS_E_FAILURE;
+   } 
+
+   hddLog(LOG1, "%s: qcom_cfg.ini Size %d\n",__FUNCTION__, fw->size);
+
+   buffer = (char*)vos_mem_malloc(fw->size);
+   
+   if(NULL == buffer) {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: kmalloc failure",__FUNCTION__);
+      release_firmware(fw);
+      return VOS_STATUS_E_FAILURE;
+   } 
+   pTemp = buffer;
+
+   vos_mem_copy((void*)buffer,(void *)fw->data, fw->size);
+   size = fw->size;
+  
+   while (buffer != NULL)
+   {
+      line = get_next_line(buffer);
+      buffer = i_trim(buffer);
+
+      hddLog(LOG1, "%s: item", buffer);
+
+      if(strlen((char*)buffer) == 0 || *buffer == '#')  {
+         buffer = line;
+         continue;
+      }
+      else if(strncmp(buffer, "END", 3) == 0 ) {
+         break;
+      }
+      else
+      {
+         name = buffer;
+         while(*buffer != '=' && *buffer != '\0') 
+            buffer++;
+         if(*buffer != '\0') {
+            *buffer++ = '\0';
+            i_trim(name);
+            if(strlen (name) != 0) {
+               buffer = i_trim(buffer);
+               if(strlen(buffer)>0) {
+                  value = buffer;
+                  while(!i_isspace(*buffer) && *buffer != '\0') 
+                     buffer++;
+                  *buffer = '\0';
+                  cfgIniTable[i].name= name;
+                  cfgIniTable[i++].value= value;
+                  if(i >= MAX_CFG_INI_ITEMS) {
+                     hddLog(LOGE,"%s: Number of items in %s > %d \n",
+                        __FUNCTION__, WLAN_INI_FILE, MAX_CFG_INI_ITEMS);
+                     break;
+                  }
+               }
+            }
+         }
+      }
+      buffer = line;
+   }
+
+   //Loop through the registry table and apply all these configs
+   vos_status = hdd_apply_cfg_ini(pHddCtx, cfgIniTable, i);
+
+   release_firmware(fw);
+   vos_mem_free(pTemp);
+   return vos_status;
+} 
+
+
+static void print_hdd_cfg(hdd_context_t *pHddCtx)
+{
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "*********Config values in HDD Adapter*******");
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [RTSThreshold] Value = %lu",pHddCtx->cfg_ini->RTSThreshold) ;
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [OperatingChannel] Value = [%u]",pHddCtx->cfg_ini->OperatingChannel);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [PowerUsageControl] Value = [%s]",pHddCtx->cfg_ini->PowerUsageControl);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fIsImpsEnabled] Value = [%u]",pHddCtx->cfg_ini->fIsImpsEnabled);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [AutoBmpsTimerEnabled] Value = [%u]",pHddCtx->cfg_ini->fIsAutoBmpsTimerEnabled);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nAutoBmpsTimerValue] Value = [%lu]",pHddCtx->cfg_ini->nAutoBmpsTimerValue);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nVccRssiTrigger] Value = [%u]",pHddCtx->cfg_ini->nVccRssiTrigger);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gIbssBssid] Value =[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x]",
+      pHddCtx->cfg_ini->IbssBssid.bytes[0],pHddCtx->cfg_ini->IbssBssid.bytes[1],
+      pHddCtx->cfg_ini->IbssBssid.bytes[2],pHddCtx->cfg_ini->IbssBssid.bytes[3],
+      pHddCtx->cfg_ini->IbssBssid.bytes[4],pHddCtx->cfg_ini->IbssBssid.bytes[5]);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, 
+          "Name = [Intf0MacAddress] Value =[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x]",
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[0],
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[1],
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[2],
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[3],
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[4],
+                                  pHddCtx->cfg_ini->intfMacAddr[0].bytes[5]);
+
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, 
+          "Name = [Intf1MacAddress] Value =[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x]",
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[0],
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[1],
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[2],
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[3],
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[4],
+                                  pHddCtx->cfg_ini->intfMacAddr[1].bytes[5]);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, 
+          "Name = [Intf2MacAddress] Value =[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x]",
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[0],
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[1],
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[2],
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[3],
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[4],
+                                  pHddCtx->cfg_ini->intfMacAddr[2].bytes[5]);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, 
+          "Name = [Intf3MacAddress] Value =[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x]",
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[0],
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[1],
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[2],
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[3],
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[4],
+                                  pHddCtx->cfg_ini->intfMacAddr[3].bytes[5]);
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApEnableUapsd] value = [%u]\n",pHddCtx->cfg_ini->apUapsdEnabled);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAPCntryCode] Value =[%c%c%c]\n",
+      pHddCtx->cfg_ini->apCntryCode[0],pHddCtx->cfg_ini->apCntryCode[1],
+      pHddCtx->cfg_ini->apCntryCode[2]);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableApProt] value = [%u]", pHddCtx->cfg_ini->apProtEnabled);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAPAutoShutOff] Value = [%u]\n", pHddCtx->cfg_ini->nAPAutoShutOff);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableListenMode] Value = [%u]\n", pHddCtx->cfg_ini->nEnableListenMode);  
+  VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApProtection] value = [%u]\n",pHddCtx->cfg_ini->apProtection);
+  VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableApOBSSProt] value = [%u]\n",pHddCtx->cfg_ini->apOBSSProtEnabled);
+  VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApAutoChannelSelection] value = [%u]\n",pHddCtx->cfg_ini->apAutoChannelSelection);
+#endif
+  
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ChannelBondingMode] Value = [%lu]",pHddCtx->cfg_ini->nChannelBondingMode24GHz);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ChannelBondingMode] Value = [%lu]",pHddCtx->cfg_ini->nChannelBondingMode5GHz);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [dot11Mode] Value = [%lu]",pHddCtx->cfg_ini->dot11Mode);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [WmmMode] Value = [%u] ",pHddCtx->cfg_ini->WmmMode);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [UapsdMask] Value = [0x%x] ",pHddCtx->cfg_ini->UapsdMask);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [PktClassificationBasis] Value = [%u] ",pHddCtx->cfg_ini->PktClassificationBasis);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ImplicitQosIsEnabled] Value = [%u]",(int)pHddCtx->cfg_ini->bImplicitQosEnabled);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdVoSrvIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdVoSrvIntv);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdVoSuspIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdVoSuspIntv);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdViSrvIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdViSrvIntv);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdViSuspIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdViSuspIntv);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdBeSrvIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdBeSrvIntv);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdBeSuspIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdBeSuspIntv);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdBkSrvIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdBkSrvIntv);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraUapsdBkSuspIntv] Value = [%lu] ",pHddCtx->cfg_ini->InfraUapsdBkSuspIntv);
+#ifdef FEATURE_WLAN_CCX
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraInactivityInterval] Value = [%lu] ",pHddCtx->cfg_ini->InfraInactivityInterval);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [CcxEnabled] Value = [%lu] ",pHddCtx->cfg_ini->isCcxIniFeatureEnabled);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [FastTransitionEnabled] Value = [%lu] ",pHddCtx->cfg_ini->isFastTransitionEnabled);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gTxPowerCap] Value = [%lu] dBm ",pHddCtx->cfg_ini->nTxPowerCap);
+#endif 
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraDirAcVo] Value = [%u] ",pHddCtx->cfg_ini->InfraDirAcVo);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraNomMsduSizeAcVo] Value = [0x%x] ",pHddCtx->cfg_ini->InfraNomMsduSizeAcVo);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMeanDataRateAcVo] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMeanDataRateAcVo);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMinPhyRateAcVo] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMinPhyRateAcVo);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraSbaAcVo] Value = [0x%x] ",pHddCtx->cfg_ini->InfraSbaAcVo);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraDirAcVi] Value = [%u] ",pHddCtx->cfg_ini->InfraDirAcVi);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraNomMsduSizeAcVi] Value = [0x%x] ",pHddCtx->cfg_ini->InfraNomMsduSizeAcVi);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMeanDataRateAcVi] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMeanDataRateAcVi);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMinPhyRateAcVi] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMinPhyRateAcVi);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraSbaAcVi] Value = [0x%x] ",pHddCtx->cfg_ini->InfraSbaAcVi);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraDirAcBe] Value = [%u] ",pHddCtx->cfg_ini->InfraDirAcBe);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraNomMsduSizeAcBe] Value = [0x%x] ",pHddCtx->cfg_ini->InfraNomMsduSizeAcBe);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMeanDataRateAcBe] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMeanDataRateAcBe);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMinPhyRateAcBe] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMinPhyRateAcBe);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraSbaAcBe] Value = [0x%x] ",pHddCtx->cfg_ini->InfraSbaAcBe);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraDirAcBk] Value = [%u] ",pHddCtx->cfg_ini->InfraDirAcBk);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraNomMsduSizeAcBk] Value = [0x%x] ",pHddCtx->cfg_ini->InfraNomMsduSizeAcBk);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMeanDataRateAcBk] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMeanDataRateAcBk);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMinPhyRateAcBk] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMinPhyRateAcBk);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraSbaAcBk] Value = [0x%x] ",pHddCtx->cfg_ini->InfraSbaAcBk);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [WfqBkWeight] Value = [%u] ",pHddCtx->cfg_ini->WfqBkWeight);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [WfqBeWeight] Value = [%u] ",pHddCtx->cfg_ini->WfqBeWeight);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [WfqViWeight] Value = [%u] ",pHddCtx->cfg_ini->WfqViWeight);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [WfqVoWeight] Value = [%u] ",pHddCtx->cfg_ini->WfqVoWeight);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [DelayedTriggerFrmInt] Value = [%lu] ",pHddCtx->cfg_ini->DelayedTriggerFrmInt);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [mcastBcastFilterSetting] Value = [%u] ",pHddCtx->cfg_ini->mcastBcastFilterSetting);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fhostArpOffload] Value = [%u] ",pHddCtx->cfg_ini->fhostArpOffload);
+#ifdef WLAN_FEATURE_VOWIFI_11R  
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fFTEnable] Value = [%lu] ",pHddCtx->cfg_ini->fFTEnable);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fFTResourceReqSupported] Value = [%lu] ",pHddCtx->cfg_ini->fFTResourceReqSupported);
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborReassocRssiThreshold] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborReassocRssiThreshold);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborLookupRssiThreshold] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborLookupRssiThreshold);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborScanMinChanTime] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborScanMinChanTime);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborScanMaxChanTime] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborScanMaxChanTime);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nMaxNeighborRetries] Value = [%lu] ",pHddCtx->cfg_ini->nMaxNeighborReqTries);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborScanPeriod] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborScanPeriod);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborScanResultsRefreshPeriod] Value = [%lu] ",pHddCtx->cfg_ini->nNeighborResultsRefreshPeriod);
+#endif
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [burstSizeDefinition] Value = [0x%x] ",pHddCtx->cfg_ini->burstSizeDefinition);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [tsInfoAckPolicy] Value = [0x%x] ",pHddCtx->cfg_ini->tsInfoAckPolicy);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [rfSettlingTimeUs] Value = [%u] ",pHddCtx->cfg_ini->rfSettlingTimeUs);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [bSingleTidRc] Value = [%u] ",pHddCtx->cfg_ini->bSingleTidRc);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gDynamicPSPollvalue] Value = [%u] ",pHddCtx->cfg_ini->dynamicPsPollValue);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAddTSWhenACMIsOff] Value = [%u] ",pHddCtx->cfg_ini->AddTSWhenACMIsOff);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gValidateScanList] Value = [%u] ",pHddCtx->cfg_ini->fValidateScanList);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gStaKeepAlivePeriod] Value = [%u] ",pHddCtx->cfg_ini->infraStaKeepAlivePeriod);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApDataAvailPollInterVal] Value = [%u] ",pHddCtx->cfg_ini->apDataAvailPollPeriodInMs);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableBtAmp] Value = [%u] ",pHddCtx->cfg_ini->enableBtAmp);
+#ifdef WLAN_BTAMP_FEATURE
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [BtAmpPreferredChannel] Value = [%u] ",pHddCtx->cfg_ini->preferredChannel);
+#endif //WLAN_BTAMP_FEATURE
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [BandCapability] Value = [%u] ",pHddCtx->cfg_ini->nBandCapability);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fEnableBeaconEarlyTermination] Value = [%u] ",pHddCtx->cfg_ini->fEnableBeaconEarlyTermination);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [teleBcnWakeupEnable] Value = [%u] ",pHddCtx->cfg_ini->teleBcnWakeupEn);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [transListenInterval] Value = [%u] ",pHddCtx->cfg_ini->nTeleBcnTransListenInterval);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [transLiNumIdleBeacons] Value = [%u] ",pHddCtx->cfg_ini->nTeleBcnTransLiNumIdleBeacons);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [maxListenInterval] Value = [%u] ",pHddCtx->cfg_ini->nTeleBcnMaxListenInterval);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [maxLiNumIdleBeacons] Value = [%u] ",pHddCtx->cfg_ini->nTeleBcnMaxLiNumIdleBeacons);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [bcnEarlyTermWakeInterval] Value = [%u] ",pHddCtx->cfg_ini->bcnEarlyTermWakeInterval);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApDataAvailPollInterVal] Value = [%u] ",pHddCtx->cfg_ini->apDataAvailPollPeriodInMs);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableBypass11d] Value = [%u] ",pHddCtx->cfg_ini->enableBypass11d);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableDFSChnlScan] Value = [%u] ",pHddCtx->cfg_ini->enableDFSChnlScan);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gReportMaxLinkSpeed] Value = [%u] ",pHddCtx->cfg_ini->reportMaxLinkSpeed);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [thermalMitigationEnable] Value = [%u] ",pHddCtx->cfg_ini->thermalMitigationEnable);
+}
+
+
+#define CFG_VALUE_MAX_LEN 256
+#define CFG_ENTRY_MAX_LEN (32+CFG_VALUE_MAX_LEN)
+VOS_STATUS hdd_cfg_get_config(hdd_context_t *pHddCtx, char *pBuf, int buflen)
+{
+   unsigned int idx;
+   REG_TABLE_ENTRY *pRegEntry = g_registry_table;
+   unsigned long cRegTableEntries  = sizeof(g_registry_table) / sizeof( g_registry_table[ 0 ]);
+   v_U32_t value;
+   char valueStr[CFG_VALUE_MAX_LEN];
+   char configStr[CFG_ENTRY_MAX_LEN];
+   char *fmt;
+   void *pField;
+   v_MACADDR_t *pMacAddr;
+   char *pCur = pBuf;
+   int curlen;
+
+   // start with an empty string
+   *pCur = '\0';
+
+   for ( idx = 0; idx < cRegTableEntries; idx++, pRegEntry++ ) 
+   {
+      pField = ( (v_U8_t *)pHddCtx->cfg_ini) + pRegEntry->VarOffset;
+
+      if ( ( WLAN_PARAM_Integer       == pRegEntry->RegType ) ||
+           ( WLAN_PARAM_SignedInteger == pRegEntry->RegType ) ||
+           ( WLAN_PARAM_HexInteger    == pRegEntry->RegType ) ) 
+      {
+         value = 0;
+         memcpy( &value, pField, pRegEntry->VarSize );
+         if ( WLAN_PARAM_HexInteger == pRegEntry->RegType )
+         {
+            fmt = "%x";
+         }
+         else if ( WLAN_PARAM_SignedInteger == pRegEntry->RegType )
+         {
+            fmt = "%d";
+         }
+         else
+         {
+            fmt = "%u";
+         }
+         snprintf(valueStr, CFG_VALUE_MAX_LEN, fmt, value);
+      }
+      else if ( WLAN_PARAM_String == pRegEntry->RegType )
+      {
+         snprintf(valueStr, CFG_VALUE_MAX_LEN, "%s", (char *)pField);
+      }
+      else if ( WLAN_PARAM_MacAddr == pRegEntry->RegType )
+      {
+         pMacAddr = (v_MACADDR_t *) pField;
+         snprintf(valueStr, CFG_VALUE_MAX_LEN,
+                  "%02x:%02x:%02x:%02x:%02x:%02x",
+                  pMacAddr->bytes[0],
+                  pMacAddr->bytes[1],
+                  pMacAddr->bytes[2],
+                  pMacAddr->bytes[3],
+                  pMacAddr->bytes[4],
+                  pMacAddr->bytes[5]);
+      }
+      else
+      {
+         snprintf(valueStr, CFG_VALUE_MAX_LEN, "(unhandled)");
+      }
+      curlen = snprintf(configStr, CFG_ENTRY_MAX_LEN,
+                        "%s=[%s]%s\n",
+                        pRegEntry->RegName,
+                        valueStr,
+                        test_bit(idx, (void *)&pHddCtx->cfg_ini->bExplicitCfg) ?
+                        "*" : "");
+
+      // ideally we want to return the config to the application
+      // however the config is too big so we just printk() for now
+#ifdef RETURN_IN_BUFFER
+      if (curlen <= buflen)
+      {
+         // copy string + '\0'
+         memcpy(pCur, configStr, curlen+1);
+
+         // account for addition;
+         pCur += curlen;
+         buflen -= curlen;
+      }
+      else
+      {
+         // buffer space exhausted, return what we have
+         return VOS_STATUS_E_RESOURCES;
+      }
+#else
+      printk(KERN_CRIT "%s", configStr);
+#endif // RETURN_IN_BUFFER
+
+}
+
+#ifndef RETURN_IN_BUFFER
+   // notify application that output is in system log
+   snprintf(pCur, buflen, "WLAN configuration written to system log");
+#endif // RETURN_IN_BUFFER
+
+   return VOS_STATUS_SUCCESS;
+}
+
+static VOS_STATUS find_cfg_item (tCfgIniEntry* iniTable, unsigned long entries,
+    char *name, char** value) 
+{
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   unsigned long i;
+
+   for (i = 0; i < entries; i++) {
+     if (strcmp(iniTable[i].name, name) == 0) {
+       *value = iniTable[i].value;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Found %s entry for Name=[%s] Value=[%s] ",
+           WLAN_INI_FILE, name, *value);
+       return VOS_STATUS_SUCCESS;
+     }
+   }
+
+   return status;
+}
+
+static int parseHexDigit(char c)
+{
+  if (c >= '0' && c <= '9')
+    return c-'0';
+  if (c >= 'a' && c <= 'f')
+    return c-'a'+10;
+  if (c >= 'A' && c <= 'F')
+    return c-'A'+10;
+
+  return 0;
+}
+
+
+static VOS_STATUS hdd_apply_cfg_ini( hdd_context_t *pHddCtx, tCfgIniEntry* iniTable, unsigned long entries)
+{
+   VOS_STATUS match_status = VOS_STATUS_E_FAILURE;
+   VOS_STATUS ret_status = VOS_STATUS_SUCCESS;
+   unsigned int idx;
+   void *pField;
+   char *value_str = NULL;
+   unsigned long len_value_str;
+   char *candidate;
+   v_U32_t value;
+   v_S31_t svalue;
+   void *pStructBase = pHddCtx->cfg_ini;
+   REG_TABLE_ENTRY *pRegEntry = g_registry_table;
+   unsigned long cRegTableEntries  = sizeof(g_registry_table) / sizeof( g_registry_table[ 0 ]);
+   v_U32_t cbOutString;
+   int i;
+
+   // sanity test
+   if (MAX_CFG_INI_ITEMS < cRegTableEntries)
+   {
+      hddLog(LOGE, "%s: MAX_CFG_INI_ITEMS too small, must be at least %d",
+             __FUNCTION__, cRegTableEntries);
+   }
+
+   for ( idx = 0; idx < cRegTableEntries; idx++, pRegEntry++ )
+   {
+      //Calculate the address of the destination field in the structure.
+      pField = ( (v_U8_t *)pStructBase )+ pRegEntry->VarOffset;
+
+      match_status = find_cfg_item(iniTable, entries, pRegEntry->RegName, &value_str);
+
+      if( (match_status != VOS_STATUS_SUCCESS) && ( pRegEntry->Flags & VAR_FLAGS_REQUIRED ) )
+      {
+         // If we could not read the cfg item and it is required, this is an error.
+         hddLog(LOGE, "%s: Failed to read required config parameter %s",
+            __FUNCTION__, pRegEntry->RegName);
+         ret_status = VOS_STATUS_E_FAILURE;
+         break;
+      }
+
+      if ( ( WLAN_PARAM_Integer    == pRegEntry->RegType ) ||
+           ( WLAN_PARAM_HexInteger == pRegEntry->RegType ) )
+      {
+         // If successfully read from the registry, use the value read.
+         // If not, use the default value.
+         if ( match_status == VOS_STATUS_SUCCESS && (WLAN_PARAM_Integer == pRegEntry->RegType)) {
+            value = simple_strtoul(value_str, NULL, 10);
+         }
+         else if ( match_status == VOS_STATUS_SUCCESS && (WLAN_PARAM_HexInteger == pRegEntry->RegType)) {
+            value = simple_strtoul(value_str, NULL, 16);
+         }
+         else {
+            value = pRegEntry->VarDefault;
+         }
+
+         // If this parameter needs range checking, do it here.
+         if ( pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK )
+         {
+            if ( value > pRegEntry->VarMax )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s > allowed Maximum [%lu > %lu]. Enforcing Maximum",
+                      __FUNCTION__, pRegEntry->RegName, value, pRegEntry->VarMax );
+               value = pRegEntry->VarMax;
+            }
+
+            if ( value < pRegEntry->VarMin )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s < allowed Minimum [%lu < %lu]. Enforcing Minimum",
+                      __FUNCTION__, pRegEntry->RegName, value, pRegEntry->VarMin);
+               value = pRegEntry->VarMin;
+            }
+         }
+         // If this parameter needs range checking, do it here.
+         else if ( pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT )
+         {
+            if ( value > pRegEntry->VarMax )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s > allowed Maximum [%lu > %lu]. Enforcing Default= %lu",
+                  __FUNCTION__, pRegEntry->RegName, value, pRegEntry->VarMax, pRegEntry->VarDefault  );
+               value = pRegEntry->VarDefault;
+            }
+
+            if ( value < pRegEntry->VarMin )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s < allowed Minimum [%lu < %lu]. Enforcing Default= %lu",
+                  __FUNCTION__, pRegEntry->RegName, value, pRegEntry->VarMin, pRegEntry->VarDefault  );
+               value = pRegEntry->VarDefault;
+            }
+         }
+
+         // Move the variable into the output field.
+         memcpy( pField, &value, pRegEntry->VarSize );
+      }
+      else if ( WLAN_PARAM_SignedInteger == pRegEntry->RegType )
+      {
+         // If successfully read from the registry, use the value read.
+         // If not, use the default value.
+         if (VOS_STATUS_SUCCESS == match_status)
+         {
+            svalue = simple_strtol(value_str, NULL, 10);
+         }
+         else
+         {
+            svalue = (v_S31_t)pRegEntry->VarDefault;
+         }
+
+         // If this parameter needs range checking, do it here.
+         if ( pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK )
+         {
+            if ( svalue > (v_S31_t)pRegEntry->VarMax )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s > allowed Maximum "
+                      "[%ld > %ld]. Enforcing Maximum", __FUNCTION__,
+                      pRegEntry->RegName, svalue, (int)pRegEntry->VarMax );
+               svalue = (v_S31_t)pRegEntry->VarMax;
+            }
+
+            if ( svalue < (v_S31_t)pRegEntry->VarMin )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s < allowed Minimum "
+                      "[%ld < %ld]. Enforcing Minimum",  __FUNCTION__,
+                      pRegEntry->RegName, svalue, (int)pRegEntry->VarMin);
+               svalue = (v_S31_t)pRegEntry->VarMin;
+            }
+         }
+         // If this parameter needs range checking, do it here.
+         else if ( pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT )
+         {
+            if ( svalue > (v_S31_t)pRegEntry->VarMax )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s > allowed Maximum "
+                      "[%ld > %ld]. Enforcing Default= %ld",
+                      __FUNCTION__, pRegEntry->RegName, svalue,
+                      (int)pRegEntry->VarMax,
+                      (int)pRegEntry->VarDefault  );
+               svalue = (v_S31_t)pRegEntry->VarDefault;
+            }
+
+            if ( svalue < (v_S31_t)pRegEntry->VarMin )
+            {
+               hddLog(LOGE, "%s: Reg Parameter %s < allowed Minimum "
+                      "[%ld < %ld]. Enforcing Default= %ld",
+                      __FUNCTION__, pRegEntry->RegName, svalue,
+                      (int)pRegEntry->VarMin,
+                      (int)pRegEntry->VarDefault);
+               svalue = pRegEntry->VarDefault;
+            }
+         }
+
+         // Move the variable into the output field.
+         memcpy( pField, &svalue, pRegEntry->VarSize );
+      }
+      // Handle string parameters
+      else if ( WLAN_PARAM_String == pRegEntry->RegType )
+      {
+#ifdef WLAN_CFG_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "RegName = %s, VarOffset %u VarSize %u VarDefault %s\n",
+            pRegEntry->RegName, pRegEntry->VarOffset, pRegEntry->VarSize, (char*)pRegEntry->VarDefault); 
+#endif
+
+         if ( match_status == VOS_STATUS_SUCCESS) 
+         {
+            len_value_str = strlen(value_str);
+
+            if(len_value_str > (pRegEntry->VarSize - 1)) {
+               hddLog(LOGE, "%s: Invalid Value=[%s] specified for Name=[%s] in %s\n", 
+                  __FUNCTION__, value_str, pRegEntry->RegName, WLAN_INI_FILE);
+               cbOutString = utilMin( strlen( (char *)pRegEntry->VarDefault ), pRegEntry->VarSize - 1 );
+               memcpy( pField, (void *)(pRegEntry->VarDefault), cbOutString );
+               ( (v_U8_t *)pField )[ cbOutString ] = '\0';
+            }
+            else
+            {
+               memcpy( pField, (void *)(value_str), len_value_str);
+               ( (v_U8_t *)pField )[ len_value_str ] = '\0';
+            }
+         }
+         else 
+         {
+            // Failed to read the string parameter from the registry.  Use the default.
+            cbOutString = utilMin( strlen( (char *)pRegEntry->VarDefault ), pRegEntry->VarSize - 1 );
+            memcpy( pField, (void *)(pRegEntry->VarDefault), cbOutString );
+            ( (v_U8_t *)pField )[ cbOutString ] = '\0';                 
+         }
+      }
+      else if ( WLAN_PARAM_MacAddr == pRegEntry->RegType )
+      {
+         if(pRegEntry->VarSize != VOS_MAC_ADDR_SIZE) {
+               hddLog(LOGE, "%s: Invalid VarSize %u for Name=[%s]\n", 
+                   __FUNCTION__, pRegEntry->VarSize, pRegEntry->RegName); 
+            continue;
+         }
+         candidate = (char*)pRegEntry->VarDefault;
+         if ( match_status == VOS_STATUS_SUCCESS) {
+            len_value_str = strlen(value_str);
+            if(len_value_str != (VOS_MAC_ADDR_SIZE*2)) {
+               hddLog(LOGE, "%s: Invalid MAC addr [%s] specified for Name=[%s] in %s\n", 
+                  __FUNCTION__, value_str, pRegEntry->RegName, WLAN_INI_FILE);
+            }
+            else
+               candidate = value_str;
+         }
+         //parse the string and store it in the byte array
+         for(i=0; i<VOS_MAC_ADDR_SIZE; i++)
+         {
+            ((char*)pField)[i] = 
+              (char)(parseHexDigit(candidate[i*2])*16 + parseHexDigit(candidate[i*2+1])); 
+         }
+      }
+      else
+      {
+         hddLog(LOGE, "%s: Unknown param type for name[%s] in registry table\n", 
+            __FUNCTION__, pRegEntry->RegName);
+      }
+
+      // did we successfully parse a cfg item for this parameter?
+      if( (match_status == VOS_STATUS_SUCCESS) &&
+          (idx < MAX_CFG_INI_ITEMS) )
+      {
+         set_bit(idx, (void *)&pHddCtx->cfg_ini->bExplicitCfg);
+      }
+   }
+
+   print_hdd_cfg(pHddCtx);
+
+  return( ret_status );
+}
+
+eCsrPhyMode hdd_cfg_xlate_to_csr_phy_mode( eHddDot11Mode dot11Mode )
+{
+   switch (dot11Mode) 
+   {
+      case (eHDD_DOT11_MODE_abg):
+         return eCSR_DOT11_MODE_abg;
+      case (eHDD_DOT11_MODE_11b):
+         return eCSR_DOT11_MODE_11b;
+      case (eHDD_DOT11_MODE_11g):
+         return eCSR_DOT11_MODE_11g;
+      default:
+      case (eHDD_DOT11_MODE_11n):
+         return eCSR_DOT11_MODE_11n;
+      case (eHDD_DOT11_MODE_11g_ONLY):
+         return eCSR_DOT11_MODE_11g_ONLY;
+      case (eHDD_DOT11_MODE_11n_ONLY):
+         return eCSR_DOT11_MODE_11n_ONLY;
+      case (eHDD_DOT11_MODE_11b_ONLY):
+         return eCSR_DOT11_MODE_11b_ONLY;
+      case (eHDD_DOT11_MODE_AUTO):
+         return eCSR_DOT11_MODE_AUTO;
+   }
+
+}
+
+static void hdd_set_btc_config(hdd_context_t *pHddCtx) 
+{
+   hdd_config_t *pConfig = pHddCtx->cfg_ini;
+   tSmeBtcConfig btcParams;
+   
+   sme_BtcGetConfig(pHddCtx->hHal, &btcParams);
+
+   btcParams.btcExecutionMode = pConfig->btcExecutionMode;
+
+   btcParams.btcConsBtSlotsToBlockDuringDhcp = pConfig->btcConsBtSlotsToBlockDuringDhcp;
+
+   btcParams.btcA2DPBtSubIntervalsDuringDhcp = pConfig->btcA2DPBtSubIntervalsDuringDhcp;
+
+   sme_BtcSetConfig(pHddCtx->hHal, &btcParams);
+}
+
+static void hdd_set_power_save_config(hdd_context_t *pHddCtx, tSmeConfigParams *smeConfig) 
+{
+   hdd_config_t *pConfig = pHddCtx->cfg_ini;
+
+   tPmcBmpsConfigParams bmpsParams;
+   
+   sme_GetConfigPowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE, &bmpsParams);
+   
+   if (strcmp(pConfig->PowerUsageControl, "Min") == 0)
+   {
+      smeConfig->csrConfig.impsSleepTime   = pConfig->nImpsMinSleepTime;
+      bmpsParams.bmpsPeriod                = pConfig->nBmpsMinListenInterval;
+      bmpsParams.enableBeaconEarlyTermination = pConfig->fEnableBeaconEarlyTermination;
+      bmpsParams.bcnEarlyTermWakeInterval  = pConfig->bcnEarlyTermWakeInterval;
+   }
+   if (strcmp(pConfig->PowerUsageControl, "Max") == 0)
+   {
+      smeConfig->csrConfig.impsSleepTime   = pConfig->nImpsMaxSleepTime;
+      bmpsParams.bmpsPeriod                = pConfig->nBmpsMaxListenInterval;
+      bmpsParams.enableBeaconEarlyTermination = pConfig->fEnableBeaconEarlyTermination;
+      bmpsParams.bcnEarlyTermWakeInterval  = pConfig->bcnEarlyTermWakeInterval;
+   }
+   if (strcmp(pConfig->PowerUsageControl, "Mod") == 0)
+   {
+      smeConfig->csrConfig.impsSleepTime   = pConfig->nImpsModSleepTime;
+      bmpsParams.bmpsPeriod                = pConfig->nBmpsModListenInterval;
+      bmpsParams.enableBeaconEarlyTermination = pConfig->fEnableBeaconEarlyTermination;
+      bmpsParams.bcnEarlyTermWakeInterval  = pConfig->bcnEarlyTermWakeInterval;
+   }
+
+   if (pConfig->fIsImpsEnabled)
+   {
+      sme_EnablePowerSave (pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   }
+   else
+   {
+      sme_DisablePowerSave (pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   }
+
+   if (pConfig->fIsBmpsEnabled)
+   {
+      sme_EnablePowerSave (pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   }
+   else
+   {
+      sme_DisablePowerSave (pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   }
+
+   bmpsParams.trafficMeasurePeriod = pConfig->nAutoBmpsTimerValue;
+
+   if (sme_SetConfigPowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE, &bmpsParams)== eHAL_STATUS_FAILURE)
+   {
+      hddLog(LOGE, "SetConfigPowerSave failed to set BMPS params\n");
+   }
+  
+   if(pConfig->fIsAutoBmpsTimerEnabled)
+   {
+      sme_StartAutoBmpsTimer(pHddCtx->hHal);
+   }
+
+}
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+static VOS_STATUS hdd_string_to_u8_array( char *str, tANI_U8 *intArray, tANI_U8 *len, tANI_U8 intArrayMaxLen )
+{
+   char *s = str;
+
+   if( str == NULL || intArray == NULL || len == NULL )
+   {
+      return VOS_STATUS_E_INVAL;
+   }
+   *len = 0;
+
+#ifdef VERSION_USING_STRPBRK
+   while ( (s != NULL) && (*len < intArrayMaxLen) )
+   {
+      int val;
+      //Increment length only if sscanf succesfully extracted one element.
+      //Any other return value means error. Ignore it.
+      if( sscanf(s, "%d", &val ) == 1 )
+      {
+         intArray[*len] = (tANI_U8) val;
+         *len += 1;
+      }
+      s = strpbrk( s, "," );
+      if( s )
+         s++;
+   }
+#else
+   while( (*s != '\0')  && (*len < intArrayMaxLen) )
+   {
+      unsigned long val;
+
+      val = simple_strtoul( s, &s, 10 );
+      if( val )
+      {
+         intArray[*len] = (tANI_U8) val;
+         *len += 1;
+      }
+      if( *s )
+         s++;
+   }
+#endif
+
+   return VOS_STATUS_SUCCESS;
+   
+}
+#endif
+
+
+v_BOOL_t hdd_update_config_dat( hdd_context_t *pHddCtx )
+{
+   v_BOOL_t  fStatus = TRUE;
+
+   hdd_config_t *pConfig = pHddCtx->cfg_ini;
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_SHORT_GI_20MHZ, 
+      pConfig->ShortGI20MhzEnable, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_SHORT_GI_20MHZ to CCM\n");
+   }
+       
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_CAL_CONTROL, pConfig->Calibration, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_CAL_CONTROL to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_CAL_PERIOD, pConfig->CalibrationPeriod,
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_CAL_PERIOD to CCM\n");
+   }
+
+   if ( 0 != pConfig->Cfg1Id )
+   {
+      if (ccmCfgSetInt(pHddCtx->hHal, pConfig->Cfg1Id, pConfig->Cfg1Value, NULL, 
+         eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE, "Could not pass on Cfg1Id to CCM\n");
+      }
+          
+   }
+
+   if ( 0 != pConfig->Cfg2Id )
+   {
+      if (ccmCfgSetInt(pHddCtx->hHal, pConfig->Cfg2Id, pConfig->Cfg2Value, 
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE, "Could not pass on Cfg2Id to CCM\n");
+      }
+   }
+
+   if ( 0 != pConfig->Cfg3Id )
+   {
+      if (ccmCfgSetInt(pHddCtx->hHal, pConfig->Cfg3Id, pConfig->Cfg3Value, 
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE, "Could not pass on Cfg3Id to CCM\n");
+      }
+   }
+
+   if ( 0 != pConfig->Cfg4Id )
+   {
+      if (ccmCfgSetInt(pHddCtx->hHal, pConfig->Cfg4Id, pConfig->Cfg4Value, 
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE, "Could not pass on Cfg4Id to CCM\n");
+      }
+   }
+
+   if ( 0 != pConfig->Cfg5Id )
+   {
+      if (ccmCfgSetInt(pHddCtx->hHal, pConfig->Cfg5Id, pConfig->Cfg5Value, 
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE, "Could not pass on Cfg5Id to CCM\n");
+      }
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_BA_AUTO_SETUP, pConfig->BlockAckAutoSetup, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_BA_AUTO_SETUP to CCM\n");
+   }
+       
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_FIXED_RATE, pConfig->TxRate, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_FIXED_RATE to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_MAX_RX_AMPDU_FACTOR, 
+      pConfig->MaxRxAmpduFactor, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE,"Could not pass on WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_SHORT_PREAMBLE, pConfig->fIsShortPreamble,
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE,"Could not pass on WNI_CFG_SHORT_PREAMBLE to CCM\n");
+   }
+
+   if (pConfig->fIsAutoIbssBssid) 
+   {
+      if (ccmCfgSetStr(pHddCtx->hHal, WNI_CFG_BSSID, (v_U8_t *)"000000000000", 
+         sizeof(v_BYTE_t) * VOS_MAC_ADDR_SIZE, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+      {
+         fStatus = FALSE;
+         hddLog(LOGE,"Could not pass on WNI_CFG_BSSID to CCM\n");
+      }
+   }
+   else
+   { 
+      if ( VOS_FALSE == vos_is_macaddr_group( &pConfig->IbssBssid ))
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                    "MAC Addr (IBSS BSSID) read from Registry is: %02x-%02x-%02x-%02x-%02x-%02x",
+                    pConfig->IbssBssid.bytes[0], pConfig->IbssBssid.bytes[1], pConfig->IbssBssid.bytes[2], 
+                    pConfig->IbssBssid.bytes[3], pConfig->IbssBssid.bytes[4], pConfig->IbssBssid.bytes[5]);
+         if (ccmCfgSetStr(pHddCtx->hHal, WNI_CFG_BSSID, pConfig->IbssBssid.bytes, 
+            sizeof(v_BYTE_t) * VOS_MAC_ADDR_SIZE, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+         {
+            fStatus = FALSE;
+            hddLog(LOGE,"Could not pass on WNI_CFG_BSSID to CCM\n");
+         }
+      }
+      else
+      {
+         fStatus = FALSE;
+         hddLog(LOGE,"Could not pass on WNI_CFG_BSSID to CCM\n");
+      }
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_BEACON_INTERVAL, pConfig->nBeaconInterval, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_BEACON_INTERVAL to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_MAX_PS_POLL, pConfig->nMaxPsPoll, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_MAX_PS_POLL to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_CURRENT_RX_ANTENNA, pConfig-> nRxAnt, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Failure: Could not pass on WNI_CFG_CURRENT_RX_ANTENNA configuration info to HAL\n"  );
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LOW_GAIN_OVERRIDE, pConfig->fIsLowGainOverride, 
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_LOW_GAIN_OVERRIDE to HAL\n");
+   }
+ 
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RSSI_FILTER_PERIOD, pConfig->nRssiFilterPeriod,
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_RSSI_FILTER_PERIOD to CCM\n");
+   }
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_FT_RSSI_FILTER_PERIOD, pConfig->FTRssiFilterPeriod,
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_FT_RSSI_FILTER_PERIOD to CCM\n");
+   }
+#endif
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, pConfig->fIgnoreDtim,
+         NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_IGNORE_DTIM configuration to CCM\n"  );
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PS_ENABLE_HEART_BEAT, pConfig->fEnableFwHeartBeatMonitoring, 
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Failure: Could not pass on WNI_CFG_PS_HEART_BEAT configuration info to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PS_ENABLE_BCN_FILTER, pConfig->fEnableFwBeaconFiltering, 
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Failure: Could not pass on WNI_CFG_PS_BCN_FILTER configuration info to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, pConfig->fEnableFwRssiMonitoring, 
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, pConfig->nDataInactivityTimeout, 
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_NTH_BEACON_FILTER, pConfig->nthBeaconFilter, 
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_NTH_BEACON_FILTER configuration info to CCM\n");
+   }
+
+#ifdef WLAN_SOFTAP_FEATURE
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_LTE_COEX, pConfig->enableLTECoex, 
+        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_LTE_COEX to CCM\n");
+     }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE, pConfig->nEnableListenMode, 
+        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE to CCM\n");
+     }
+
+     WLANSAP_SetChannelRange(pHddCtx->hHal, pConfig->apStartChannelNum, pConfig->apEndChannelNum, pConfig->apOperatingBand);
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_AP_KEEP_ALIVE_TIMEOUT, pConfig->apKeepAlivePeriod, 
+        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE, "Could not pass on WNI_CFG_AP_KEEP_ALIVE_TIMEOUT to CCM\n");
+     } 
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_GO_KEEP_ALIVE_TIMEOUT, pConfig->goKeepAlivePeriod, 
+        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE, "Could not pass on WNI_CFG_GO_KEEP_ALIVE_TIMEOUT to CCM\n");
+     }
+#endif
+   
+#if defined WLAN_FEATURE_VOWIFI
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RRM_ENABLED, pConfig->fRrmEnable, 
+                     NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_RRM_ENABLE configuration info to CCM\n");
+    }
+
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RRM_OPERATING_CHAN_MAX, pConfig->nInChanMeasMaxDuration, 
+                     NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_RRM_OPERATING_CHAN_MAX configuration info to CCM\n");
+    }
+
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, pConfig->nOutChanMeasMaxDuration, 
+                     NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_RRM_OUT_CHAN_MAX configuration info to CCM\n");
+    }
+
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_MCAST_BCAST_FILTER_SETTING, pConfig->mcastBcastFilterSetting, 
+                     NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+#endif
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_SINGLE_TID_RC, pConfig->bSingleTidRc, 
+                      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_SINGLE_TID_RC configuration info to CCM\n");
+     }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TELE_BCN_WAKEUP_EN, pConfig->teleBcnWakeupEn, 
+                      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_TELE_BCN_WAKEUP_EN configuration info to CCM\n"  );
+     }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TELE_BCN_TRANS_LI, pConfig->nTeleBcnTransListenInterval, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_TELE_BCN_TRANS_LI configuration info to CCM\n"  );
+    }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TELE_BCN_MAX_LI, pConfig->nTeleBcnMaxListenInterval, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_TELE_BCN_MAX_LI configuration info to CCM\n"  );
+    }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS, pConfig->nTeleBcnTransLiNumIdleBeacons, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS configuration info to CCM\n"  );
+    }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS, pConfig->nTeleBcnMaxLiNumIdleBeacons, 
+      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS configuration info to CCM\n"  );
+    }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RF_SETTLING_TIME_CLK, pConfig->rfSettlingTimeUs,
+        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_RF_SETTLING_TIME_CLK configuration info to CCM\n"  );
+    }
+
+     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD, pConfig->infraStaKeepAlivePeriod, 
+                      NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+     {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD configuration info to CCM\n"  );
+     }
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_DYNAMIC_PS_POLL_VALUE, pConfig->dynamicPsPollValue, 
+                     NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_DYNAMIC_PS_POLL_VALUE configuration info to CCM\n"  );
+    }
+
+    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT, pConfig->nNullDataApRespTimeout,
+               NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_PS_NULLDATA_DELAY_TIMEOUT configuration info to CCM\n"  );
+    } 
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, pConfig->apDataAvailPollPeriodInMs,
+               NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+       fStatus = FALSE;
+       hddLog(LOGE,"Failure: Could not pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD configuration info to CCM\n"  );
+   } 
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, pConfig->FragmentationThreshold, 
+                   NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+    {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_FRAGMENTATION_THRESHOLD configuration info to CCM\n"  );
+    }
+    if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RTS_THRESHOLD, pConfig->RTSThreshold, 
+                        NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+    {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_RTS_THRESHOLD configuration info to CCM\n"  );
+    }
+
+    if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_11D_ENABLED, pConfig->Is11dSupportEnabled, 
+                        NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+    {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_11D_ENABLED configuration info to CCM\n"  );
+    }
+    if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_HEART_BEAT_THRESHOLD, pConfig->HeartbeatThresh24, 
+                        NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+    {
+        fStatus = FALSE;
+        hddLog(LOGE,"Failure: Could not pass on WNI_CFG_HEART_BEAT_THRESHOLD configuration info to CCM\n"  );
+    }
+
+#endif
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, pConfig->apDataAvailPollPeriodInMs,
+               NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE,"Failure: Could not pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD configuration info to CCM\n"  );
+   }
+
+   if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_CLOSE_LOOP, 
+                   pConfig->enableCloseLoop, NULL, eANI_BOOLEAN_FALSE)
+       ==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_CLOSE_LOOP to CCM\n");
+   }
+
+   if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TX_PWR_CTRL_ENABLE, 
+                   pConfig->enableAutomaticTxPowerControl, NULL, eANI_BOOLEAN_FALSE)
+                   ==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_TX_PWR_CTRL_ENABLE to CCM\n");
+   }
+
+   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_SHORT_GI_40MHZ, 
+      pConfig->ShortGI40MhzEnable, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+   {
+      fStatus = FALSE;
+      hddLog(LOGE, "Could not pass on WNI_CFG_SHORT_GI_40MHZ to CCM\n");
+   }
+
+   return fStatus;
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_init_set_sme_config() - 
+
+   This function initializes the sme configuration parameters
+   
+  \param  - pHddCtx - Pointer to the HDD Adapter.
+              
+  \return - 0 for success, non zero for failure
+    
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   eHalStatus halStatus;
+   tSmeConfigParams smeConfig;
+
+   hdd_config_t *pConfig = pHddCtx->cfg_ini;
+
+   vos_mem_zero( &smeConfig, sizeof( smeConfig ) );
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, 
+              "%s bWmmIsEnabled=%d 802_11e_enabled=%d dot11Mode=%d\n", __func__,
+              pConfig->WmmMode, pConfig->b80211eIsEnabled, pConfig->dot11Mode);
+
+   // Config params obtained from the registry
+   smeConfig.csrConfig.RTSThreshold             = pConfig->RTSThreshold;
+   smeConfig.csrConfig.FragmentationThreshold   = pConfig->FragmentationThreshold;
+   smeConfig.csrConfig.shortSlotTime            = pConfig->ShortSlotTimeEnabled;
+   smeConfig.csrConfig.Is11dSupportEnabled      = pConfig->Is11dSupportEnabled;
+   smeConfig.csrConfig.HeartbeatThresh24        = pConfig->HeartbeatThresh24;
+
+   smeConfig.csrConfig.phyMode                  = hdd_cfg_xlate_to_csr_phy_mode ( pConfig->dot11Mode );
+
+   smeConfig.csrConfig.channelBondingMode24GHz  = pConfig->nChannelBondingMode24GHz;
+   smeConfig.csrConfig.channelBondingMode5GHz   = pConfig->nChannelBondingMode5GHz;
+   smeConfig.csrConfig.TxRate                   = pConfig->TxRate;
+   smeConfig.csrConfig.nScanResultAgeCount      = pConfig->ScanResultAgeCount;
+   smeConfig.csrConfig.scanAgeTimeNCNPS         = pConfig->nScanAgeTimeNCNPS;
+   smeConfig.csrConfig.scanAgeTimeNCPS          = pConfig->nScanAgeTimeNCPS;
+   smeConfig.csrConfig.scanAgeTimeCNPS          = pConfig->nScanAgeTimeCNPS;
+   smeConfig.csrConfig.scanAgeTimeCPS           = pConfig->nScanAgeTimeCPS;
+   smeConfig.csrConfig.AdHocChannel24           = pConfig->OperatingChannel;
+   smeConfig.csrConfig.fEnforce11dChannels      = pConfig->fEnforce11dChannels;
+   smeConfig.csrConfig.fSupplicantCountryCodeHasPriority     = pConfig->fSupplicantCountryCodeHasPriority;
+   smeConfig.csrConfig.fEnforceCountryCodeMatch = pConfig->fEnforceCountryCodeMatch;
+   smeConfig.csrConfig.fEnforceDefaultDomain    = pConfig->fEnforceDefaultDomain;
+   smeConfig.csrConfig.bCatRssiOffset           = pConfig->nRssiCatGap;
+   smeConfig.csrConfig.vccRssiThreshold         = pConfig->nVccRssiTrigger;
+   smeConfig.csrConfig.vccUlMacLossThreshold    = pConfig->nVccUlMacLossThreshold;
+   smeConfig.csrConfig.nRoamingTime             = pConfig->nRoamingTime;
+   smeConfig.csrConfig.IsIdleScanEnabled        = pConfig->nEnableIdleScan; 
+   smeConfig.csrConfig.nActiveMaxChnTime        = pConfig->nActiveMaxChnTime;
+   smeConfig.csrConfig.nActiveMinChnTime        = pConfig->nActiveMinChnTime;
+   smeConfig.csrConfig.nPassiveMaxChnTime       = pConfig->nPassiveMaxChnTime;
+   smeConfig.csrConfig.nPassiveMinChnTime       = pConfig->nPassiveMinChnTime;
+   smeConfig.csrConfig.Is11eSupportEnabled      = pConfig->b80211eIsEnabled;
+   smeConfig.csrConfig.WMMSupportMode           = pConfig->WmmMode;
+
+#if defined WLAN_FEATURE_VOWIFI
+   smeConfig.rrmConfig.rrmEnabled = pConfig->fRrmEnable;
+   smeConfig.rrmConfig.maxRandnInterval = pConfig->nRrmRandnIntvl;
+#endif
+   //Remaining config params not obtained from registry
+   // On RF EVB beacon using channel 1.
+   
+   smeConfig.csrConfig.AdHocChannel5G            = 44; 
+   smeConfig.csrConfig.ProprietaryRatesEnabled   = 0;  
+   smeConfig.csrConfig.HeartbeatThresh50         = 40; 
+   if( smeConfig.csrConfig.Is11dSupportEnabled )
+   {
+      smeConfig.csrConfig.Is11hSupportEnabled    = 1;
+   }
+   else
+   {
+      smeConfig.csrConfig.Is11hSupportEnabled    = 0;
+   }
+   smeConfig.csrConfig.bandCapability            = pConfig->nBandCapability; 
+   smeConfig.csrConfig.cbChoice                  = 0;   
+   smeConfig.csrConfig.bgScanInterval            = 0; 
+   smeConfig.csrConfig.eBand                     = pConfig->nBandCapability; 
+   smeConfig.csrConfig.nTxPowerCap = pConfig->nTxPowerCap;
+   smeConfig.csrConfig.fEnableBypass11d          = pConfig->enableBypass11d;
+   smeConfig.csrConfig.fEnableDFSChnlScan        = pConfig->enableDFSChnlScan;
+   
+   //FIXME 11d config is hardcoded
+#ifdef WLAN_SOFTAP_FEATURE
+   if ( VOS_STA_SAP_MODE != hdd_get_conparam()){
+#endif
+   smeConfig.csrConfig.Csr11dinfo.Channels.numChannels = 0;
+
+   //if there is a requirement that HDD will control the default channel list & 
+   //country code (say from .ini file) we need to add some logic here. Otherwise 
+   //the default 11d info should come from NV as per our current implementation
+   
+#ifdef WLAN_SOFTAP_FEATURE
+   }
+   else{
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "AP country Code %s", pConfig->apCntryCode);
+
+    if (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)
+       sme_setRegInfo(pHddCtx->hHal, pConfig->apCntryCode);
+       sme_set11dinfo(pHddCtx->hHal, &smeConfig);
+    }
+#endif
+   hdd_set_power_save_config(pHddCtx, &smeConfig);
+   hdd_set_btc_config(pHddCtx);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R   
+   smeConfig.csrConfig.csr11rConfig.IsFTResourceReqSupported = pConfig->fFTResourceReqSupported;
+#endif
+#ifdef FEATURE_WLAN_CCX
+   smeConfig.csrConfig.isCcxIniFeatureEnabled = pConfig->isCcxIniFeatureEnabled;
+#endif
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+   smeConfig.csrConfig.isFastTransitionEnabled = pConfig->isFastTransitionEnabled;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborReassocRssiThreshold = pConfig->nNeighborReassocRssiThreshold;
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborLookupRssiThreshold = pConfig->nNeighborLookupRssiThreshold;
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborScanMaxChanTime = pConfig->nNeighborScanMaxChanTime; 
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborScanMinChanTime = pConfig->nNeighborScanMinChanTime; 
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborScanTimerPeriod = pConfig->nNeighborScanPeriod;
+   smeConfig.csrConfig.neighborRoamConfig.nMaxNeighborRetries = pConfig->nMaxNeighborReqTries; 
+   smeConfig.csrConfig.neighborRoamConfig.nNeighborResultsRefreshPeriod = pConfig->nNeighborResultsRefreshPeriod;
+   hdd_string_to_u8_array( pConfig->neighborScanChanList, 
+                                        smeConfig.csrConfig.neighborRoamConfig.neighborScanChanList.channelList, 
+                                        &smeConfig.csrConfig.neighborRoamConfig.neighborScanChanList.numChannels, 
+                                        WNI_CFG_VALID_CHANNEL_LIST_LEN );
+#endif
+
+   smeConfig.csrConfig.addTSWhenACMIsOff = pConfig->AddTSWhenACMIsOff;
+   smeConfig.csrConfig.fValidateList = pConfig->fValidateScanList;
+
+   //Enable/Disable MCC 
+   smeConfig.csrConfig.fEnableMCCMode = pConfig->enableMCC;
+
+   halStatus = sme_UpdateConfig( pHddCtx->hHal, &smeConfig);    
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   
+   return status;   
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_execute_config_command() -
+
+   This function executes an arbitrary configuration set command
+
+  \param - pHddCtx - Pointer to the HDD Adapter.
+  \parmm - command - a configuration command of the form:
+                     <name>=<value>
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS hdd_execute_config_command(hdd_context_t *pHddCtx, char *command)
+{
+   size_t tableSize = sizeof(g_registry_table)/sizeof(g_registry_table[0]);
+   REG_TABLE_ENTRY *pRegEntry;
+   char *clone;
+   char *pCmd;
+   void *pField;
+   char *name;
+   char *value_str;
+   v_U32_t value;
+   v_S31_t svalue;
+   size_t len_value_str;
+   unsigned int idx;
+   unsigned int i;
+   VOS_STATUS vstatus;
+
+   // assume failure until proven otherwise
+   vstatus = VOS_STATUS_E_FAILURE;
+
+   // clone the command so that we can manipulate it
+   clone = kstrdup(command, GFP_ATOMIC);
+   if (NULL == clone)
+   {
+      hddLog(LOGE, "%s: memory allocation failure, unable to process [%s]",
+             __FUNCTION__, command);
+      return vstatus;
+   }
+
+   // 'clone' will point to the beginning of the string so it can be freed
+   // 'pCmd' will be used to walk/parse the command
+   pCmd = clone;
+
+   // get rid of leading/trailing whitespace
+   pCmd = i_trim(pCmd);
+   if ('\0' == *pCmd)
+   {
+      // only whitespace
+      hddLog(LOGE, "%s: invalid command, only whitespace:[%s]",
+             __FUNCTION__, command);
+      goto done;
+   }
+
+   // parse the <name> = <value>
+   name = pCmd;
+   while (('=' != *pCmd) && ('\0' != *pCmd))
+   {
+      pCmd++;
+   }
+   if ('\0' == *pCmd)
+   {
+      // did not find '='
+      hddLog(LOGE, "%s: invalid command, no '=':[%s]",
+             __FUNCTION__, command);
+      goto done;
+   }
+
+   // replace '=' with NUL to terminate the <name>
+   *pCmd++ = '\0';
+   name = i_trim(name);
+   if ('\0' == *name)
+   {
+      // did not find a name
+      hddLog(LOGE, "%s: invalid command, no <name>:[%s]",
+             __FUNCTION__, command);
+      goto done;
+   }
+
+   value_str = i_trim(pCmd);
+   if ('\0' == *value_str)
+   {
+      // did not find a value
+      hddLog(LOGE, "%s: invalid command, no <value>:[%s]",
+             __FUNCTION__, command);
+      goto done;
+   }
+
+   // lookup the configuration item
+   for (idx = 0; idx < tableSize; idx++)
+   {
+      if (0 == strcmp(name, g_registry_table[idx].RegName))
+      {
+         // found a match
+         break;
+      }
+   }
+   if (tableSize == idx)
+   {
+      // did not match the name
+      hddLog(LOGE, "%s: invalid command, unknown configuration item:[%s]",
+             __FUNCTION__, command);
+      goto done;
+   }
+
+   pRegEntry = &g_registry_table[idx];
+   if (!(pRegEntry->Flags & VAR_FLAGS_DYNAMIC_CFG))
+   {
+      // does not support dynamic configuration
+      hddLog(LOGE, "%s: invalid command, %s does not support "
+             "dynamic configuration", __FUNCTION__, name);
+      goto done;
+   }
+
+   pField = ((v_U8_t *)pHddCtx->cfg_ini) + pRegEntry->VarOffset;
+
+   switch (pRegEntry->RegType)
+   {
+   case WLAN_PARAM_Integer:
+      value = simple_strtoul(value_str, NULL, 10);
+      if (value < pRegEntry->VarMin)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %u < min value %u",
+                __FUNCTION__, value, pRegEntry->VarMin);
+         goto done;
+      }
+      if (value > pRegEntry->VarMax)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %u > max value %u",
+                __FUNCTION__, value, pRegEntry->VarMax);
+         goto done;
+      }
+      memcpy(pField, &value, pRegEntry->VarSize);
+      break;
+
+   case WLAN_PARAM_HexInteger:
+      value = simple_strtoul(value_str, NULL, 16);
+      if (value < pRegEntry->VarMin)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %x < min value %x",
+                __FUNCTION__, value, pRegEntry->VarMin);
+         goto done;
+      }
+      if (value > pRegEntry->VarMax)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %x > max value %x",
+                __FUNCTION__, value, pRegEntry->VarMax);
+         goto done;
+      }
+      memcpy(pField, &value, pRegEntry->VarSize);
+      break;
+
+   case WLAN_PARAM_SignedInteger:
+      svalue = simple_strtol(value_str, NULL, 10);
+      if (svalue < (v_S31_t)pRegEntry->VarMin)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %d < min value %d",
+                __FUNCTION__, svalue, (int)pRegEntry->VarMin);
+         goto done;
+      }
+      if (svalue > (v_S31_t)pRegEntry->VarMax)
+      {
+         // out of range
+         hddLog(LOGE, "%s: invalid command, value %d > max value %d",
+                __FUNCTION__, svalue, (int)pRegEntry->VarMax);
+         goto done;
+      }
+      memcpy(pField, &svalue, pRegEntry->VarSize);
+      break;
+
+   case WLAN_PARAM_String:
+      len_value_str = strlen(value_str);
+      if (len_value_str > (pRegEntry->VarSize - 1))
+      {
+         // too big
+         hddLog(LOGE,
+                "%s: invalid command, string [%s] length "
+                "%u exceeds maximum length %u",
+                __FUNCTION__, value_str,
+                len_value_str, (pRegEntry->VarSize - 1));
+         goto done;
+      }
+      // copy string plus NUL
+      memcpy(pField, value_str, (len_value_str + 1));
+      break;
+
+   case WLAN_PARAM_MacAddr:
+      len_value_str = strlen(value_str);
+      if (len_value_str != (VOS_MAC_ADDR_SIZE * 2))
+      {
+         // out of range
+         hddLog(LOGE,
+                "%s: invalid command, MAC address [%s] length "
+                "%u is not expected length %u",
+                __FUNCTION__, value_str,
+                len_value_str, (VOS_MAC_ADDR_SIZE * 2));
+         goto done;
+      }
+      //parse the string and store it in the byte array
+      for (i = 0; i < VOS_MAC_ADDR_SIZE; i++)
+      {
+         ((char*)pField)[i] = (char)
+            ((parseHexDigit(value_str[(i * 2)]) * 16) +
+             parseHexDigit(value_str[(i * 2) + 1]));
+      }
+      break;
+
+   default:
+      goto done;
+   }
+
+   // if we get here, we had a successful modification
+   vstatus = VOS_STATUS_SUCCESS;
+
+   // config table has been modified, is there a notifier?
+   if (NULL != pRegEntry->pfnDynamicNotify)
+   {
+      (pRegEntry->pfnDynamicNotify)(pHddCtx, pRegEntry->NotifyId);
+   }
+
+   // note that this item was explicitly configured
+   if (idx < MAX_CFG_INI_ITEMS)
+   {
+      set_bit(idx, (void *)&pHddCtx->cfg_ini->bExplicitCfg);
+   }
+ done:
+   kfree(clone);
+   return vstatus;
+}
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
new file mode 100644
index 0000000..dc8f4c5
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -0,0 +1,5114 @@
+/*
+ * 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  wlan_hdd_cfg80211.c
+
+  \brief WLAN Host Device Driver implementation
+
+  Copyright 2008 (c) 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 
+  --------    ---            --------------------------------------------------------
+ 21/12/09     Ashwani        Created module.  
+
+ 07/06/10     Kumar Deepak   Implemented cfg80211 callbacks for ANDROID
+              Ganesh K       
+  ==========================================================================*/
+
+#ifdef CONFIG_CFG80211
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/wireless.h>
+#include <wlan_hdd_includes.h>
+#include <net/arp.h>
+#include <net/cfg80211.h>
+#include <linux/wireless.h>
+#include <wlan_hdd_wowl.h>
+#include <aniGlobal.h>
+#include "ccmApi.h"
+#include "sirParams.h"
+#include "dot11f.h"
+#include "wlan_hdd_assoc.h"
+#include "wlan_hdd_wext.h"
+#include "sme_Api.h"
+#include "wlan_hdd_p2p.h"
+#include "wlan_hdd_cfg80211.h"
+#include "wlan_hdd_hostapd.h"
+#include "sapInternal.h"
+#include "wlan_hdd_softap_tx_rx.h"
+#include "wlan_hdd_main.h"
+#ifdef WLAN_BTAMP_FEATURE
+#include "bap_hdd_misc.h"
+#endif
+#include <qc_sap_ioctl.h>
+
+#define g_mode_rates_size (12)
+#define a_mode_rates_size (8)
+#define FREQ_BASE_80211G          (2407)
+#define FREQ_BAND_DIFF_80211G     (5)
+#define MAX_SCAN_SSID 2
+#define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \
+        ((int) OFFSET_OF( tSirBssDescription, ieFields)))
+
+#define HDD2GHZCHAN(freq, chan, flag)   {     \
+    .band =  IEEE80211_BAND_2GHZ, \
+    .center_freq = (freq), \
+    .hw_value = (chan),\
+    .flags = (flag), \
+    .max_antenna_gain = 0 ,\
+    .max_power = 30, \
+}
+
+#define HDD5GHZCHAN(freq, chan, flag)   {     \
+    .band =  IEEE80211_BAND_5GHZ, \
+    .center_freq = (freq), \
+    .hw_value = (chan),\
+    .flags = (flag), \
+    .max_antenna_gain = 0 ,\
+    .max_power = 30, \
+}
+
+#define HDD_G_MODE_RATETAB(rate, rate_id, flag)\
+{\
+    .bitrate = rate, \
+    .hw_value = rate_id, \
+    .flags = flag, \
+}
+
+static const u32 hdd_cipher_suites[] = 
+{
+    WLAN_CIPHER_SUITE_WEP40,
+    WLAN_CIPHER_SUITE_WEP104,
+    WLAN_CIPHER_SUITE_TKIP,
+#ifdef FEATURE_WLAN_CCX
+#define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */
+    WLAN_CIPHER_SUITE_KRK,
+    WLAN_CIPHER_SUITE_CCMP,
+#else
+    WLAN_CIPHER_SUITE_CCMP,
+#endif
+#ifdef FEATURE_WLAN_WAPI
+    WLAN_CIPHER_SUITE_SMS4,
+#endif
+};
+
+static inline int is_broadcast_ether_addr(const u8 *addr)
+{
+    return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&
+            (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
+}
+
+static struct ieee80211_channel hdd_channels_2_4_GHZ[] =
+{  
+    HDD2GHZCHAN(2412, 1, 0) ,
+    HDD2GHZCHAN(2417, 2, 0) ,
+    HDD2GHZCHAN(2422, 3, 0) ,
+    HDD2GHZCHAN(2427, 4, 0) ,
+    HDD2GHZCHAN(2432, 5, 0) ,
+    HDD2GHZCHAN(2437, 6, 0) ,
+    HDD2GHZCHAN(2442, 7, 0) ,
+    HDD2GHZCHAN(2447, 8, 0) ,
+    HDD2GHZCHAN(2452, 9, 0) ,
+    HDD2GHZCHAN(2457, 10, 0) ,
+    HDD2GHZCHAN(2462, 11, 0) ,
+    HDD2GHZCHAN(2467, 12, 0) ,
+    HDD2GHZCHAN(2472, 13, 0) ,
+    HDD2GHZCHAN(2484, 14, 0) ,
+};
+
+#ifdef WLAN_FEATURE_P2P
+static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] =
+{
+    HDD2GHZCHAN(2412, 1, 0) ,
+    HDD2GHZCHAN(2437, 6, 0) ,
+    HDD2GHZCHAN(2462, 11, 0) ,
+};
+#endif
+
+static struct ieee80211_channel hdd_channels_5_GHZ[] =
+{
+    HDD5GHZCHAN(5180, 36, 0) ,
+    HDD5GHZCHAN(5200, 40, 0) ,
+    HDD5GHZCHAN(5220, 44, 0) ,
+    HDD5GHZCHAN(5240, 48, 0) ,
+    HDD5GHZCHAN(5260, 52, 0) ,
+    HDD5GHZCHAN(5280, 56, 0) ,
+    HDD5GHZCHAN(5300, 60, 0) ,
+    HDD5GHZCHAN(5320, 64, 0) ,
+    HDD5GHZCHAN(5500,100, 0) ,
+    HDD5GHZCHAN(5520,104, 0) ,
+    HDD5GHZCHAN(5540,108, 0) ,
+    HDD5GHZCHAN(5560,112, 0) ,
+    HDD5GHZCHAN(5580,116, 0) ,
+    HDD5GHZCHAN(5600,120, 0) ,
+    HDD5GHZCHAN(5620,124, 0) ,
+    HDD5GHZCHAN(5640,128, 0) ,
+    HDD5GHZCHAN(5660,132, 0) ,
+    HDD5GHZCHAN(5680,136, 0) ,
+    HDD5GHZCHAN(5700,140, 0) ,
+    HDD5GHZCHAN(5745,149, 0) ,
+    HDD5GHZCHAN(5765,153, 0) ,
+    HDD5GHZCHAN(5785,157, 0) ,
+    HDD5GHZCHAN(5805,161, 0) ,
+    HDD5GHZCHAN(5825,165, 0) ,
+};
+
+static struct ieee80211_rate g_mode_rates[] =
+{
+    HDD_G_MODE_RATETAB(10, 0x1, 0),    
+    HDD_G_MODE_RATETAB(20, 0x2, 0),    
+    HDD_G_MODE_RATETAB(55, 0x4, 0),    
+    HDD_G_MODE_RATETAB(110, 0x8, 0),    
+    HDD_G_MODE_RATETAB(60, 0x10, 0),    
+    HDD_G_MODE_RATETAB(90, 0x20, 0),    
+    HDD_G_MODE_RATETAB(120, 0x40, 0),    
+    HDD_G_MODE_RATETAB(180, 0x80, 0),    
+    HDD_G_MODE_RATETAB(240, 0x100, 0),    
+    HDD_G_MODE_RATETAB(360, 0x200, 0),    
+    HDD_G_MODE_RATETAB(480, 0x400, 0),    
+    HDD_G_MODE_RATETAB(540, 0x800, 0),
+};   
+
+static struct ieee80211_rate a_mode_rates[] =
+{
+    HDD_G_MODE_RATETAB(60, 0x10, 0),    
+    HDD_G_MODE_RATETAB(90, 0x20, 0),    
+    HDD_G_MODE_RATETAB(120, 0x40, 0),    
+    HDD_G_MODE_RATETAB(180, 0x80, 0),    
+    HDD_G_MODE_RATETAB(240, 0x100, 0),    
+    HDD_G_MODE_RATETAB(360, 0x200, 0),    
+    HDD_G_MODE_RATETAB(480, 0x400, 0),    
+    HDD_G_MODE_RATETAB(540, 0x800, 0),
+};
+
+static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ =
+{
+    .channels = hdd_channels_2_4_GHZ,
+    .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ),
+    .band       = IEEE80211_BAND_2GHZ,
+    .bitrates = g_mode_rates,
+    .n_bitrates = g_mode_rates_size,
+    .ht_cap.ht_supported   = 1,
+    .ht_cap.cap            =  IEEE80211_HT_CAP_SGI_20
+                            | IEEE80211_HT_CAP_GRN_FLD
+                            | IEEE80211_HT_CAP_DSSSCCK40
+                            | IEEE80211_HT_CAP_LSIG_TXOP_PROT,
+    .ht_cap.ampdu_factor   = IEEE80211_HT_MAX_AMPDU_64K,
+    .ht_cap.ampdu_density  = IEEE80211_HT_MPDU_DENSITY_16,
+    .ht_cap.mcs.rx_mask    = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+    .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ),
+    .ht_cap.mcs.tx_params  = IEEE80211_HT_MCS_TX_DEFINED,
+};
+
+#ifdef WLAN_FEATURE_P2P
+static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ =
+{
+    .channels = hdd_social_channels_2_4_GHZ,
+    .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ),
+    .band       = IEEE80211_BAND_2GHZ,
+    .bitrates = g_mode_rates,
+    .n_bitrates = g_mode_rates_size,
+    .ht_cap.ht_supported   = 1,
+    .ht_cap.cap            =  IEEE80211_HT_CAP_SGI_20
+                            | IEEE80211_HT_CAP_GRN_FLD
+                            | IEEE80211_HT_CAP_DSSSCCK40
+                            | IEEE80211_HT_CAP_LSIG_TXOP_PROT,
+    .ht_cap.ampdu_factor   = IEEE80211_HT_MAX_AMPDU_64K,
+    .ht_cap.ampdu_density  = IEEE80211_HT_MPDU_DENSITY_16,
+    .ht_cap.mcs.rx_mask    = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+    .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ),
+    .ht_cap.mcs.tx_params  = IEEE80211_HT_MCS_TX_DEFINED,
+};
+#endif
+
+static struct ieee80211_supported_band wlan_hdd_band_5_GHZ =
+{
+    .channels = hdd_channels_5_GHZ,
+    .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ),
+    .band     = IEEE80211_BAND_5GHZ,
+    .bitrates = a_mode_rates,
+    .n_bitrates = a_mode_rates_size,
+    .ht_cap.ht_supported   = 1,
+    .ht_cap.cap            =  IEEE80211_HT_CAP_SGI_20
+                            | IEEE80211_HT_CAP_GRN_FLD
+                            | IEEE80211_HT_CAP_DSSSCCK40
+                            | IEEE80211_HT_CAP_LSIG_TXOP_PROT
+                            | IEEE80211_HT_CAP_SGI_40
+                            | IEEE80211_HT_CAP_SUP_WIDTH_20_40,
+    .ht_cap.ampdu_factor   = IEEE80211_HT_MAX_AMPDU_64K,
+    .ht_cap.ampdu_density  = IEEE80211_HT_MPDU_DENSITY_16,
+    .ht_cap.mcs.rx_mask    = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+    .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ),
+    .ht_cap.mcs.tx_params  = IEEE80211_HT_MCS_TX_DEFINED,
+};
+
+/* This structure contain information what kind of frame are expected in 
+     TX/RX direction for each kind of interface */
+static const struct ieee80211_txrx_stypes
+wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = {
+    [NL80211_IFTYPE_STATION] = {
+        .tx = 0xffff,
+        .rx = BIT(SIR_MAC_MGMT_ACTION) |
+            BIT(SIR_MAC_MGMT_PROBE_REQ),
+    },
+    [NL80211_IFTYPE_AP] = {
+        .tx = 0xffff,
+        .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) |
+            BIT(SIR_MAC_MGMT_REASSOC_REQ) |
+            BIT(SIR_MAC_MGMT_PROBE_REQ) |
+            BIT(SIR_MAC_MGMT_DISASSOC) |
+            BIT(SIR_MAC_MGMT_AUTH) |
+            BIT(SIR_MAC_MGMT_DEAUTH) |
+            BIT(SIR_MAC_MGMT_ACTION),
+    },
+#ifdef WLAN_FEATURE_P2P    
+    [NL80211_IFTYPE_P2P_CLIENT] = {
+        .tx = 0xffff,
+        .rx = BIT(SIR_MAC_MGMT_ACTION) |
+            BIT(SIR_MAC_MGMT_PROBE_REQ),
+    },
+    [NL80211_IFTYPE_P2P_GO] = {
+        /* This is also same as for SoftAP */
+        .tx = 0xffff,
+        .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) |
+            BIT(SIR_MAC_MGMT_REASSOC_REQ) |
+            BIT(SIR_MAC_MGMT_PROBE_REQ) |
+            BIT(SIR_MAC_MGMT_DISASSOC) |
+            BIT(SIR_MAC_MGMT_AUTH) |
+            BIT(SIR_MAC_MGMT_DEAUTH) |
+            BIT(SIR_MAC_MGMT_ACTION),
+    },
+#endif    
+};
+
+static struct cfg80211_ops wlan_hdd_cfg80211_ops;
+
+/* Data rate 100KBPS based on IE Index */
+struct index_data_rate_type
+{
+   v_U8_t   beacon_rate_index;
+   v_U16_t  supported_rate[4];
+};
+
+/* 11B, 11G Rate table include Basic rate and Extended rate
+   The IDX field is the rate index
+   The HI field is the rate when RSSI is strong or being ignored
+    (in this case we report actual rate)
+   The MID field is the rate when RSSI is moderate
+    (in this case we cap 11b rates at 5.5 and 11g rates at 24)
+   The LO field is the rate when RSSI is low
+    (in this case we don't report rates, actual current rate used)
+ */
+static const struct
+{
+   v_U8_t   beacon_rate_index;
+   v_U16_t  supported_rate[3];
+} supported_data_rate[] =
+{
+/* IDX     HI  MID LO (RSSI-based index */
+   {2,   { 10,  10, 0}},
+   {4,   { 20,  20, 0}},
+   {11,  { 55,  55, 0}},
+   {12,  { 60,  60, 0}},
+   {18,  { 90,  90, 0}},
+   {22,  {110,  55, 0}},
+   {24,  {120, 120, 0}},
+   {36,  {180, 180, 0}},
+   {44,  {220, 220, 0}},
+   {48,  {240, 240, 0}},
+   {66,  {330, 240, 0}},
+   {72,  {360, 240, 0}},
+   {96,  {480, 240, 0}},
+   {108, {540, 240, 0}}
+};
+
+/* MCS Based rate table */
+static struct index_data_rate_type supported_mcs_rate[] =
+{
+/* MCS  L20   L40   S20  S40 */
+   {0,  {65,  135,  72,  150}},
+   {1,  {130, 270,  144, 300}},
+   {2,  {195, 405,  217, 450}},
+   {3,  {260, 540,  289, 600}},
+   {4,  {390, 810,  433, 900}},
+   {5,  {520, 1080, 578, 1200}},
+   {6,  {585, 1215, 650, 1350}},
+   {7,  {650, 1350, 722, 1500}}
+};
+
+extern struct net_device_ops net_ops_struct;
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_init
+ * This function is called by hdd_wlan_startup() 
+ * during initialization. 
+ * This function is used to initialize and register wiphy structure.
+ */
+struct wiphy *wlan_hdd_cfg80211_init(int priv_size)
+{
+    struct wiphy *wiphy;
+    ENTER();
+
+    /* 
+     *   Create wiphy device 
+     */
+    wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size);
+
+    if (!wiphy)
+    {
+        /* Print error and jump into err label and free the memory */
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__);
+        return NULL;
+    }
+
+    return wiphy;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_update_band
+ * This function is called from the supplicant through a 
+ * private ioctl to change the band value
+ */
+int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand)
+{
+    switch(eBand)
+    {
+        case eCSR_BAND_24:
+            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
+            wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
+            break;
+        case eCSR_BAND_5G:
+            wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
+            wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
+            break;
+        case eCSR_BAND_ALL:
+        default:
+            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
+            wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
+    }
+    return 0;
+}
+/*
+ * FUNCTION: wlan_hdd_cfg80211_init
+ * This function is called by hdd_wlan_startup() 
+ * during initialization. 
+ * This function is used to initialize and register wiphy structure.
+ */
+int wlan_hdd_cfg80211_register(struct device *dev, 
+                               struct wiphy *wiphy,
+                               hdd_config_t *pCfg
+                               )
+{
+    /* Now bind the underlying wlan device with wiphy */
+    set_wiphy_dev(wiphy, dev);
+
+    wiphy->mgmt_stypes = wlan_hdd_txrx_stypes;
+
+    wiphy->flags |=   WIPHY_FLAG_HAVE_AP_SME 
+                    | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD
+                    | WIPHY_FLAG_CUSTOM_REGULATORY;
+
+    wiphy->max_scan_ssids = MAX_SCAN_SSID; 
+    
+    wiphy->max_scan_ie_len = 200 ; //TODO: define a macro
+
+    /* Supports STATION & AD-HOC modes right now */
+    wiphy->interface_modes =   BIT(NL80211_IFTYPE_STATION) 
+                             | BIT(NL80211_IFTYPE_ADHOC)
+#ifdef WLAN_FEATURE_P2P
+                             | BIT(NL80211_IFTYPE_P2P_CLIENT)
+                             | BIT(NL80211_IFTYPE_P2P_GO)
+#endif                       
+                             | BIT(NL80211_IFTYPE_AP);
+
+    /* Before registering we need to update the ht capabilitied based
+     * on ini values*/
+    if( !pCfg->ShortGI20MhzEnable )
+    {
+        wlan_hdd_band_2_4_GHZ.ht_cap.cap     &= ~IEEE80211_HT_CAP_SGI_20;
+        wlan_hdd_band_5_GHZ.ht_cap.cap       &= ~IEEE80211_HT_CAP_SGI_20;
+        wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20;
+    }
+
+    if( !pCfg->ShortGI40MhzEnable )
+    {
+        wlan_hdd_band_5_GHZ.ht_cap.cap       &= ~IEEE80211_HT_CAP_SGI_40;
+    }
+
+    if( !pCfg->nChannelBondingMode5GHz )
+    {
+        wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+    }
+
+    /*Initialize band capability*/
+    switch(pCfg->nBandCapability)
+    {
+        case eCSR_BAND_24:
+            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
+            break;
+        case eCSR_BAND_5G:
+#ifdef WLAN_FEATURE_P2P
+            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_p2p_2_4_GHZ;
+#endif
+            wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
+            break;
+        case eCSR_BAND_ALL:
+        default:
+            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
+            wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
+    }
+    /*Initialise the supported cipher suite details*/
+    wiphy->cipher_suites = hdd_cipher_suites;
+    wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites);
+
+    /*signal strength in mBm (100*dBm) */
+    wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+#ifdef WLAN_FEATURE_P2P
+    wiphy->max_remain_on_channel_duration = 1000;
+#endif
+#endif
+
+    /* Register our wiphy dev with cfg80211 */
+    if (0 > wiphy_register(wiphy))
+    {
+        /* print eror */
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__);
+        return -EIO;
+    }
+
+    EXIT();
+    return 0;
+}     
+
+/* In this function we will do all post VOS start initialization.
+   In this function we will register for all frame in which supplicant
+   is interested. 
+*/
+void wlan_hdd_cfg80211_post_voss_start(hdd_adapter_t* pAdapter)
+{
+#ifdef WLAN_FEATURE_P2P
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    /* Register for all P2P action, public action etc frames */
+    v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
+
+   /* Right now we are registering these frame when driver is getting
+      initialized. Once we will move to 2.6.37 kernel, in which we have
+      frame register ops, we will move this code as a part of that */
+    /* GAS Initial Request */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, 
+                         (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE );
+
+    /* GAS Initial Response */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE );
+    
+    /* GAS Comeback Request */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE );
+
+    /* GAS Comeback Response */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE );
+
+    /* P2P Public Action */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, 
+                                  P2P_PUBLIC_ACTION_FRAME_SIZE );
+
+    /* P2P Action */
+    sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)P2P_ACTION_FRAME,
+                                  P2P_ACTION_FRAME_SIZE );
+#endif /* WLAN_FEATURE_P2P */
+}
+
+void wlan_hdd_cfg80211_pre_voss_stop(hdd_adapter_t* pAdapter)
+{
+#ifdef WLAN_FEATURE_P2P
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    /* Register for all P2P action, public action etc frames */
+    v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
+
+   /* Right now we are registering these frame when driver is getting
+      initialized. Once we will move to 2.6.37 kernel, in which we have
+      frame register ops, we will move this code as a part of that */
+    /* GAS Initial Request */
+
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                          (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE );
+
+    /* GAS Initial Response */
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE );
+    
+    /* GAS Comeback Request */
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE );
+
+    /* GAS Comeback Response */
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE );
+
+    /* P2P Public Action */
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, 
+                                  P2P_PUBLIC_ACTION_FRAME_SIZE );
+
+    /* P2P Action */
+    sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type,
+                         (v_U8_t*)P2P_ACTION_FRAME,
+                                  P2P_ACTION_FRAME_SIZE );
+#endif /* WLAN_FEATURE_P2P */
+}
+
+#ifdef FEATURE_WLAN_WAPI
+void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index,
+                                     const u8 *mac_addr, u8 *key , int key_Len)
+{
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    tCsrRoamSetKey  setKey;
+    v_BOOL_t isConnected = TRUE;
+    int status = 0;
+    v_U32_t roamId= 0xFF;
+    tANI_U8 *pKeyPtr = NULL;
+    int n = 0;
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                                        __func__,pAdapter->device_mode);
+
+    setKey.keyId = key_index; // Store Key ID
+    setKey.encType  = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption
+    setKey.keyDirection = eSIR_TX_RX;  // Key Directionn both TX and RX
+    setKey.paeRole = 0 ; // the PAE role
+    if (!mac_addr || is_broadcast_ether_addr(mac_addr))
+    {
+        vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac );
+    }
+    else
+    {
+        isConnected = hdd_connIsConnected(pHddStaCtx);
+        vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN);
+    }
+    setKey.keyLength = key_Len;
+    pKeyPtr = setKey.Key;
+    memcpy( pKeyPtr, key, key_Len);
+
+    hddLog(VOS_TRACE_LEVEL_INFO,"\n%s: WAPI KEY LENGTH:0x%04x",
+                                            __func__, key_Len);
+    for (n = 0 ; n < key_Len; n++)
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ",
+                                           __func__,n,setKey.Key[n]);
+
+    pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;
+    if ( isConnected )
+    {
+        status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                             pAdapter->sessionId, &setKey, &roamId );
+    }
+    if ( status != 0 )
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "[%4d] sme_RoamSetKey returned ERROR status= %d",
+                                                __LINE__, status );
+        pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+    }
+}
+#endif /* FEATURE_WLAN_WAPI*/
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, 
+                                       beacon_data_t **ppBeacon,
+                                       struct beacon_parameters *params)
+{    
+    int size;
+    beacon_data_t *beacon = NULL;
+    beacon_data_t *old = NULL;
+    int head_len,tail_len;
+
+    if (params->head && !params->head_len)
+        return -EINVAL;
+
+    old = pAdapter->sessionCtx.ap.beacon;
+
+    if (!params->head && !old)
+        return -EINVAL;
+
+    if (params->tail && !params->tail_len)
+        return -EINVAL;
+
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38))
+    /* Kernel 3.0 is not updating dtim_period for set beacon */
+    if (!params->dtim_period)
+        return -EINVAL;
+#endif
+
+    if(params->head)
+        head_len = params->head_len;
+    else
+        head_len = old->head_len;
+
+    if(params->tail || !old)
+        tail_len = params->tail_len;
+    else
+        tail_len = old->tail_len;
+
+    size = sizeof(beacon_data_t) + head_len + tail_len;
+
+    beacon = kzalloc(size, GFP_KERNEL);
+
+    if( beacon == NULL )
+        return -ENOMEM;
+
+    if(params->dtim_period || !old )
+        beacon->dtim_period = params->dtim_period;
+    else
+        beacon->dtim_period = old->dtim_period;
+ 
+    beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t);
+    beacon->tail = beacon->head + head_len;
+    beacon->head_len = head_len;
+    beacon->tail_len = tail_len;
+
+    if(params->head) {
+        memcpy (beacon->head,params->head,beacon->head_len);
+    }
+    else { 
+        if(old)
+            memcpy (beacon->head,old->head,beacon->head_len);
+    }
+    
+    if(params->tail) {
+        memcpy (beacon->tail,params->tail,beacon->tail_len);
+    }
+    else {
+       if(old)   
+           memcpy (beacon->tail,old->tail,beacon->tail_len);
+    }
+
+    *ppBeacon = beacon;
+
+    kfree(old);
+
+    return 0;
+
+}
+#endif //LINUX_VERSION_CODE
+
+v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid)
+{
+    int left = length;
+    v_U8_t *ptr = pIes;
+    v_U8_t elem_id,elem_len;
+   
+    while(left >= 2)
+    {   
+        elem_id  =  ptr[0];
+        elem_len =  ptr[1];
+        left -= 2;
+        if(elem_len > left)
+        {
+            hddLog(VOS_TRACE_LEVEL_FATAL,
+                    "****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 + 2);
+    }
+    return NULL;
+}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+/* Check if rate is 11g rate or not */
+static int wlan_hdd_rate_is_11g(u8 rate)
+{
+    u8 gRateArray[8] = {12, 18, 24, 36, 48, 72, 96, 104}; /* actual rate * 2 */
+    u8 i;
+    for (i = 0; i < 8; i++)
+    {
+        if(rate == gRateArray[i])
+            return TRUE;
+    }
+    return FALSE;
+}
+
+/* Check for 11g rate and set proper 11g only mode */
+static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht,
+                     u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode)
+{
+    u8 i, num_rates = pIe[0];
+
+    pIe += 1;
+    for ( i = 0; i < num_rates; i++)
+    {
+        if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK)))
+        {
+            /* If rate set have 11g rate than change the mode to 11G */
+            *pSapHw_mode = eSAP_DOT11_MODE_11g;
+            if (pIe[i] & BASIC_RATE_MASK)
+            {
+                /* If we have 11g rate as  basic rate, it means mode
+                   is 11g only mode.
+                 */
+               *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY;
+               *pCheckRatesfor11g = FALSE;
+            }
+        }
+        else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i])
+        {
+            *require_ht = TRUE;
+        }
+    }
+    return;
+}
+
+static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter)
+{
+    tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig;
+    beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
+    struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head;
+    u8 checkRatesfor11g = TRUE;
+    u8 require_ht = FALSE;
+    u8 *pIe=NULL;
+
+    pConfig->SapHw_mode= eSAP_DOT11_MODE_11b;
+
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0],
+                                       pBeacon->head_len, WLAN_EID_SUPP_RATES);
+    if (pIe != NULL)
+    {
+        pIe += 1;
+        wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g,
+                               &pConfig->SapHw_mode);
+    }
+
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len,
+                                WLAN_EID_EXT_SUPP_RATES);
+    if (pIe != NULL)
+    {
+
+        pIe += 1;
+        wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g,
+                               &pConfig->SapHw_mode);
+    }
+
+    if( pConfig->channel > 14 )
+    {
+        pConfig->SapHw_mode= eSAP_DOT11_MODE_11a;
+    }
+
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len,
+                                       WLAN_EID_HT_CAPABILITY);
+
+    if(pIe) 
+    {
+        pConfig->SapHw_mode= eSAP_DOT11_MODE_11n;
+        if(require_ht)
+            pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY;
+    }
+}
+
+static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter,
+                            struct beacon_parameters *params)
+{
+    v_U8_t *genie;
+    v_U8_t total_ielen = 0, ielen = 0;
+    v_U8_t *pIe = NULL;
+    v_U8_t addIE[1] = {0};
+    beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
+
+    genie = vos_mem_malloc(MAX_GENIE_LEN);
+
+    if(genie == NULL) {
+
+        return -ENOMEM;
+    }
+
+    pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len);
+
+    if(pIe)
+    {
+        /*Copy the wps IE*/
+        ielen = pIe[1] + 2;
+        if( ielen <=MAX_GENIE_LEN)
+        {
+            vos_mem_copy(genie, pIe, ielen);
+        }
+        else 
+        {
+            hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too big***\n");
+            return -EINVAL;
+        }
+        total_ielen = ielen;
+    }
+
+#ifdef WLAN_FEATURE_WFD
+    pIe = wlan_hdd_get_wfd_ie_ptr(pBeacon->tail,pBeacon->tail_len);
+
+    if(pIe) 
+    { 
+        ielen = pIe[1] + 2;
+        if(total_ielen + ielen <= MAX_GENIE_LEN) {
+            vos_mem_copy(&genie[total_ielen],pIe,(pIe[1] + 2));
+        }
+        else {
+           hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie + P2p Ie + Wfd Ie Length is too big***\n");
+           return -EINVAL;
+        }
+        total_ielen += ielen; 
+    }
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+    pIe = wlan_hdd_get_p2p_ie_ptr(pBeacon->tail,pBeacon->tail_len);
+
+    if(pIe)
+    {
+        ielen = pIe[1] + 2;
+        if(total_ielen + ielen <= MAX_GENIE_LEN)
+        {
+            vos_mem_copy(&genie[total_ielen], pIe, (pIe[1] + 2));
+        }
+        else
+        {
+            hddLog( VOS_TRACE_LEVEL_ERROR, 
+                    "**Wps Ie+ P2pIE Length is too big***\n");
+            return -EINVAL;
+        }
+        total_ielen += ielen;
+    }
+#endif
+
+    if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+       WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL,
+               eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+        hddLog(LOGE,
+               "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM");
+        return -EINVAL;
+    }
+
+    if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+          WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL,
+          test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ?
+                   eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE)
+          ==eHAL_STATUS_FAILURE)
+    {
+        hddLog(LOGE,
+            "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM");
+        return -EINVAL;
+    }
+
+    // Added for ProResp IE
+    if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) )
+    {
+        u16 rem_probe_resp_ie_len = params->proberesp_ies_len;
+        u8 probe_rsp_ie_len[3] = {0};
+        u8 counter = 0;
+        /* Check Probe Resp Length if it is greater then 255 then Store
+           Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 &
+           WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able
+           Store More then 255 bytes into One Variable.
+        */
+        while ((rem_probe_resp_ie_len > 0) && (counter < 3))
+        {
+            if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN)
+            {
+                probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN;
+                rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN;
+            }
+            else
+            {
+                probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len;
+                rem_probe_resp_ie_len = 0;
+            }
+        }
+
+        rem_probe_resp_ie_len = 0;
+
+        if (probe_rsp_ie_len[0] > 0)
+        {
+            if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA1,
+                            (tANI_U8*)&params->proberesp_ies[rem_probe_resp_ie_len],
+                            probe_rsp_ie_len[0], NULL,
+                            eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+            {
+                 hddLog(LOGE,
+                       "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM");
+                 return -EINVAL;
+            }
+            rem_probe_resp_ie_len += probe_rsp_ie_len[0];
+        }
+
+        if (probe_rsp_ie_len[1] > 0)
+        {
+            if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA2,
+                            (tANI_U8*)&params->proberesp_ies[rem_probe_resp_ie_len],
+                            probe_rsp_ie_len[1], NULL,
+                            eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+            {
+                 hddLog(LOGE,
+                       "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM");
+                 return -EINVAL;
+            }
+            rem_probe_resp_ie_len += probe_rsp_ie_len[1];
+        }
+
+        if (probe_rsp_ie_len[2] > 0)
+        {
+            if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
+                            (tANI_U8*)&params->proberesp_ies[rem_probe_resp_ie_len],
+                            probe_rsp_ie_len[2], NULL,
+                            eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+            {
+                 hddLog(LOGE,
+                       "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM");
+                 return -EINVAL;
+            }
+            rem_probe_resp_ie_len += probe_rsp_ie_len[2];
+        }
+
+        if (probe_rsp_ie_len[1] == 0 )
+        {
+            if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+            {
+                hddLog(LOGE,
+                   "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM\n");
+            }
+        }
+
+        if (probe_rsp_ie_len[2] == 0 )
+        {
+            if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+            {
+                hddLog(LOGE,
+                   "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM\n");
+            }
+        }
+
+        if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+             WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL,
+             test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ?
+                      eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE)
+             == eHAL_STATUS_FAILURE)
+        {
+           hddLog(LOGE,
+             "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
+           return -EINVAL;
+        }
+    }
+    else
+    {
+        // Reset WNI_CFG_PROBE_RSP Flags
+        wlan_hdd_reset_prob_rspies(pHostapdAdapter);
+
+        hddLog(VOS_TRACE_LEVEL_INFO,
+               "%s: No Probe Response IE received in set beacon",
+               __func__);
+    }
+
+    // Added for AssocResp IE
+    if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) )
+    {
+       if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+               WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies,
+               params->assocresp_ies_len, NULL,
+               eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+       {
+            hddLog(LOGE,
+                  "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM");
+            return -EINVAL;
+       }
+
+       if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+          WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL,
+          test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ?
+                   eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE)
+          == eHAL_STATUS_FAILURE)
+       {
+          hddLog(LOGE,
+            "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM");
+          return -EINVAL;
+       }
+    }
+    else
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO,
+               "%s: No Assoc Response IE received in set beacon",
+               __func__);
+
+        if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+        {
+            hddLog(LOGE,
+               "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM\n");
+        }
+    }
+
+    vos_mem_free(genie);
+    return 0;
+}
+#endif //LINUX_VERSION_CODE
+
+/* 
+ * FUNCTION: wlan_hdd_validate_operation_channel
+ * called by wlan_hdd_cfg80211_start_bss() and
+ * wlan_hdd_cfg80211_set_channel()
+ * This function validates whether given channel is part of valid
+ * channel list. 
+ */ 
+static VOS_STATUS wlan_hdd_validate_operation_channel(hdd_adapter_t *pAdapter,int channel)
+{
+        
+    v_U32_t num_ch = 0;
+    u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    u32 indx = 0;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+     
+    num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+
+    if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST,
+            valid_ch, &num_ch))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: failed to get valid channel list\n", __func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    for (indx = 0; indx < num_ch; indx++)
+    {
+        if (channel == valid_ch[indx])
+        {
+            break;
+        }
+    }
+
+    if (indx >= num_ch)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid Channel [%d] \n", __func__, channel);
+        return VOS_STATUS_E_FAILURE;
+    }
+    return VOS_STATUS_SUCCESS;
+         
+}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
+                            struct beacon_parameters *params)
+{
+    tsap_Config_t *pConfig;
+    beacon_data_t *pBeacon = NULL;
+    struct ieee80211_mgmt *pMgmt_frame;
+    v_U8_t *pIe=NULL;
+    v_U16_t capab_info;
+    eCsrAuthType RSNAuthType;
+    eCsrEncryptionType RSNEncryptType;
+    eCsrEncryptionType mcRSNEncryptType;
+    int status = VOS_STATUS_SUCCESS;
+    tpWLAN_SAPEventCB pSapEventCallback;
+    hdd_hostapd_state_t *pHostapdState;
+    v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4];  //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
+    struct qc_mac_acl_entry *acl_entry = NULL;
+    v_SINT_t i;
+
+    ENTER();
+
+    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+
+    pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig;
+
+    pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
+
+    pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head;
+
+    pConfig->beacon_int =  pMgmt_frame->u.beacon.beacon_int;
+
+    //channel is already set in the set_channel Call back
+    //pConfig->channel = pCommitConfig->channel;
+
+    /*Protection parameter to enable or disable*/
+    pConfig->protEnabled = 
+           (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled;
+
+    pConfig->dtim_period = pBeacon->dtim_period;
+
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***\n",
+                                      pConfig->dtim_period);
+
+
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, 
+                                       WLAN_EID_COUNTRY);
+    if(pIe)
+    { 
+        tANI_BOOLEAN restartNeeded;
+        tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+
+        pConfig->ieee80211d = 1;
+        vos_mem_copy(pConfig->countryCode, &pIe[2], 3);
+        sme_setRegInfo(hHal, pConfig->countryCode);
+        sme_ResetCountryCodeInformation(hHal, &restartNeeded);
+        /*
+         * If auto channel is configured i.e. channel is 0,
+         * so skip channel validation.
+        */
+        if( AUTO_CHANNEL_SELECT != pConfig->channel )
+        {
+            if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                         "%s: Invalid Channel [%d] \n", __func__, pConfig->channel);
+                return -EINVAL;
+            }
+        }
+    }
+    else 
+    {
+        pConfig->ieee80211d = 0;
+    }
+    pConfig->authType = eSAP_AUTO_SWITCH;
+
+    capab_info = pMgmt_frame->u.beacon.capab_info;
+    
+    pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & 
+                        WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE;
+
+    (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy;
+
+    /*Set wps station to configured*/
+    pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len);
+
+    if(pIe)
+    {
+        if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE))
+        {
+            hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***\n");
+            return -EINVAL;
+        }
+        else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0)
+        {
+             hddLog( VOS_TRACE_LEVEL_ERROR, "** WPS IE(len %d) ***\n", (pIe[1]+2));
+             /* Check 15 bit of WPS IE as it contain information for wps state
+              * WPS state
+              */
+              if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15])
+              {
+                  pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED;
+              } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15])
+              {
+                  pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED;
+              }
+        }
+    }
+    else
+    {
+        pConfig->wps_state = SAP_WPS_DISABLED;
+    }
+    pConfig->fwdWPSPBCProbeReq  = 1; // Forward WPS PBC probe request frame up 
+
+    pConfig->RSNWPAReqIELength = 0;
+    pConfig->pRSNWPAReqIE = NULL;
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, 
+                                       WLAN_EID_RSN);
+    if(pIe && pIe[1])
+    { 
+        pConfig->RSNWPAReqIELength = pIe[1] + 2;
+        memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength);
+        pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0];
+        /* The actual processing may eventually be more extensive than 
+         * this. Right now, just consume any PMKIDs that are  sent in 
+         * by the app.
+         * */
+        status = hdd_softap_unpackIE( 
+                        vos_get_context( VOS_MODULE_ID_SME, pVosContext),
+                        &RSNEncryptType,
+                        &mcRSNEncryptType,
+                        &RSNAuthType,
+                        pConfig->pRSNWPAReqIE[1]+2,
+                        pConfig->pRSNWPAReqIE );
+
+        if( VOS_STATUS_SUCCESS == status )
+        {
+            /* Now copy over all the security attributes you have 
+             * parsed out 
+             * */
+            pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE
+            pConfig->mcRSNEncryptType = mcRSNEncryptType;
+            (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType
+                                                              = RSNEncryptType;
+            hddLog( LOG1, FL("%s: CSR AuthType = %d, "
+                        "EncryptionType = %d mcEncryptionType = %d\n"),
+                        RSNAuthType, RSNEncryptType, mcRSNEncryptType);
+        }
+    }
+    
+    pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE,
+                                         pBeacon->tail, pBeacon->tail_len);
+
+    if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA))
+    {
+        if (pConfig->pRSNWPAReqIE)
+        {
+            /*Mixed mode WPA/WPA2*/
+            memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2);
+            pConfig->RSNWPAReqIELength += pIe[1] + 2;
+        }
+        else
+        {
+            pConfig->RSNWPAReqIELength = pIe[1] + 2;
+            memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength);
+            pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0];
+            status = hdd_softap_unpackIE( 
+                          vos_get_context( VOS_MODULE_ID_SME, pVosContext),
+                          &RSNEncryptType,
+                          &mcRSNEncryptType,
+                          &RSNAuthType,
+                          pConfig->pRSNWPAReqIE[1]+2,
+                          pConfig->pRSNWPAReqIE );
+
+            if( VOS_STATUS_SUCCESS == status )
+            {
+                /* Now copy over all the security attributes you have 
+                 * parsed out 
+                 * */
+                pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE
+                pConfig->mcRSNEncryptType = mcRSNEncryptType;
+                (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType
+                                                              = RSNEncryptType;
+                hddLog( LOG1, FL("%s: CSR AuthType = %d, "
+                                "EncryptionType = %d mcEncryptionType = %d\n"),
+                                RSNAuthType, RSNEncryptType, mcRSNEncryptType);
+            }
+        }
+    }
+
+    pConfig->SSIDinfo.ssidHidden = VOS_FALSE;
+
+    if (params->ssid != NULL)
+    {
+        memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len);
+        pConfig->SSIDinfo.ssid.length = params->ssid_len;
+        if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE)
+            pConfig->SSIDinfo.ssidHidden = VOS_TRUE;
+    }
+    vos_mem_copy(pConfig->self_macaddr.bytes, 
+               pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t));
+    
+    /* default value */
+    pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED;
+    pConfig->num_accept_mac = 0;
+    pConfig->num_deny_mac = 0;
+
+    pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE,
+                                         pBeacon->tail, pBeacon->tail_len);
+
+    /* pIe for black list is following form:
+            type    : 1 byte
+            length  : 1 byte
+            OUI     : 4 bytes
+            acl type : 1 byte
+            no of mac addr in black list: 1 byte
+            list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id
+    */    
+    if ((pIe != NULL) && (pIe[1] != 0))    
+    {
+        pConfig->SapMacaddr_acl = pIe[6];
+        pConfig->num_deny_mac   = pIe[7];
+        hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d\n",
+                                     pIe[6], pIe[7]);
+        if (pConfig->num_deny_mac > MAX_MAC_ADDRESS_DENIED)
+            pConfig->num_deny_mac = MAX_MAC_ADDRESS_DENIED;
+        acl_entry = (struct qc_mac_acl_entry *)(pIe + 8);
+        for (i = 0; i < pConfig->num_deny_mac; i++)
+        {
+            vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr));
+            acl_entry++;
+        }        
+    }
+    pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE,
+                                         pBeacon->tail, pBeacon->tail_len);
+
+    /* pIe for white list is following form:
+            type    : 1 byte
+            length  : 1 byte
+            OUI     : 4 bytes
+            acl type : 1 byte
+            no of mac addr in white list: 1 byte
+            list of mac_acl_entries: variable, 6 bytes per mac address + sizeof(int) for vlan id
+    */    
+    if ((pIe != NULL) && (pIe[1] != 0))    
+    {
+        pConfig->SapMacaddr_acl = pIe[6];
+        pConfig->num_accept_mac   = pIe[7];
+        hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d\n",
+                                      pIe[6], pIe[7]);
+        if (pConfig->num_accept_mac > MAX_MAC_ADDRESS_ACCEPTED)
+            pConfig->num_accept_mac = MAX_MAC_ADDRESS_ACCEPTED;
+        acl_entry = (struct qc_mac_acl_entry *)(pIe + 8);
+        for (i = 0; i < pConfig->num_accept_mac; i++)
+        {
+            vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr));
+            acl_entry++;
+        }
+    }
+    wlan_hdd_set_sapHwmode(pHostapdAdapter);
+
+    // ht_capab is not what the name conveys,this is used for protection bitmap
+    pConfig->ht_capab =
+                 (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
+
+    if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) )
+    {
+        hddLog(LOGE, FL("SAP Not able to set AP IEs"));
+        return -EINVAL;
+    }
+
+    //Uapsd Enabled Bit
+    pConfig->UapsdEnable =  
+          (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled;
+    //Enable OBSS protection
+    pConfig->obssProtEnabled = 
+           (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; 
+
+    hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR"\n"), 
+                 MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes));
+    hddLog(LOGW,FL("ssid =%s\n"), pConfig->SSIDinfo.ssid.ssId);  
+    hddLog(LOGW,FL("beaconint=%d, channel=%d\n"), (int)pConfig->beacon_int,
+                                                     (int)pConfig->channel);
+    hddLog(LOGW,FL("hw_mode=%x\n"),  pConfig->SapHw_mode);
+    hddLog(LOGW,FL("privacy=%d, authType=%d\n"), pConfig->privacy, 
+                                                 pConfig->authType); 
+    hddLog(LOGW,FL("RSN/WPALen=%d, \n"),(int)pConfig->RSNWPAReqIELength);
+    hddLog(LOGW,FL("Uapsd = %d\n"),pConfig->UapsdEnable); 
+    hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d\n"),
+                          pConfig->protEnabled, pConfig->obssProtEnabled);
+
+    if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) 
+    {
+        //Bss already started. just return.
+        //TODO Probably it should update some beacon params.
+        hddLog( LOGE, "Bss Already started...Ignore the request");
+        EXIT();
+        return 0;
+    }
+    
+    pConfig->persona = pHostapdAdapter->device_mode;
+
+    pSapEventCallback = hdd_hostapd_SAPEventCB;
+    if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig,
+                 (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS)
+    {
+        hddLog(LOGE,FL("SAP Start Bss fail\n"));
+        return -EINVAL;
+    }
+
+    hddLog(LOGE, 
+           FL("Waiting for Scan to complete(auto mode) and BSS to start"));
+
+    status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
+   
+    if (!VOS_IS_STATUS_SUCCESS(status))
+    {  
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                 ("ERROR: HDD vos wait for single_event failed!!\n"));
+        VOS_ASSERT(0);
+    }
+ 
+    //Succesfully started Bss update the state bit.
+    set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags);
+
+    pHostapdState->bCommit = TRUE;
+    EXIT();
+
+   return 0;
+}
+
+static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, 
+                                        struct net_device *dev, 
+                                        struct beacon_parameters *params)
+{
+    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+    int status=VOS_STATUS_SUCCESS; 
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d\n",pAdapter->device_mode);
+
+    if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) 
+#ifdef WLAN_FEATURE_P2P
+      || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+       )
+    {
+        beacon_data_t *old,*new;
+
+        old = pAdapter->sessionCtx.ap.beacon;
+   
+        if (old)
+            return -EALREADY;
+
+        status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params);
+
+        if(status != VOS_STATUS_SUCCESS) 
+        {
+             hddLog(VOS_TRACE_LEVEL_FATAL,
+                   "%s:Error!!! Allocating the new beacon\n",__func__);
+             return -EINVAL;
+        }
+
+        pAdapter->sessionCtx.ap.beacon = new;
+
+        status = wlan_hdd_cfg80211_start_bss(pAdapter, params);
+    }
+
+    EXIT();
+    return status;
+}
+ 
+static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, 
+                                        struct net_device *dev,
+                                        struct beacon_parameters *params)
+{
+    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev); 
+    int status=VOS_STATUS_SUCCESS;
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                                __func__,pAdapter->device_mode);
+
+    if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) 
+#ifdef WLAN_FEATURE_P2P
+     || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+       ) 
+    {
+        beacon_data_t *old,*new;
+                
+        old = pAdapter->sessionCtx.ap.beacon;
+        
+        if (!old)
+            return -ENOENT;
+
+        status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params);
+
+        if(status != VOS_STATUS_SUCCESS) {
+            hddLog(VOS_TRACE_LEVEL_FATAL, 
+                   "%s: Error!!! Allocating the new beacon\n",__func__);
+            return -EINVAL;
+       }
+
+       pAdapter->sessionCtx.ap.beacon = new;
+
+       status = wlan_hdd_cfg80211_start_bss(pAdapter, params);
+    }
+
+    EXIT();
+    return status;
+}
+
+static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy,
+                                        struct net_device *dev)
+{
+    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx;
+    VOS_STATUS status = 0;
+
+    ENTER();
+
+    if (NULL == pAdapter)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s: HDD adapter context is Null", __FUNCTION__);
+        return -ENODEV;
+    }
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+        return -EAGAIN;
+    }
+
+    pHddCtx  =  (hdd_context_t*)pAdapter->pHddCtx;
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                              __func__,pAdapter->device_mode);
+
+    if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
+#ifdef WLAN_FEATURE_P2P
+     || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+       )
+    {
+        beacon_data_t *old;
+
+        old = pAdapter->sessionCtx.ap.beacon;
+
+        if (!old)
+            return -ENOENT;
+
+#ifdef CONFIG_CFG80211
+        hdd_cleanup_actionframe(pHddCtx, pAdapter);
+#endif
+
+        mutex_lock(&pHddCtx->sap_lock);
+        if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))
+        {
+            if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pAdapter))->pvosContext) ) )
+            {
+                hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
+
+                status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
+
+                if (!VOS_IS_STATUS_SUCCESS(status))
+                {
+                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                             ("ERROR: HDD vos wait for single_event failed!!\n"));
+                    VOS_ASSERT(0);
+                }
+            }
+            clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags);
+        }
+        mutex_unlock(&pHddCtx->sap_lock);
+
+        if(status != VOS_STATUS_SUCCESS)
+        {
+            hddLog(VOS_TRACE_LEVEL_FATAL,
+                    "%s:Error!!! Stopping the BSS\n",__func__);
+            return -EINVAL;
+        }
+
+        if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
+            WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE)
+                                                    ==eHAL_STATUS_FAILURE)
+        {
+            hddLog(LOGE,
+               "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM\n");
+        }
+
+        if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
+                            WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+        {
+            hddLog(LOGE,
+               "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM\n");
+        }
+
+        // Reset WNI_CFG_PROBE_RSP Flags
+        wlan_hdd_reset_prob_rspies(pAdapter);
+
+        pAdapter->sessionCtx.ap.beacon = NULL;
+        kfree(old);
+    }
+    EXIT();
+    return status;
+}
+#endif //LINUX_VERSION_CODE
+
+static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy,
+                                      struct net_device *dev,
+                                      struct bss_parameters *params)
+{
+    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+
+    ENTER();
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                               __func__,pAdapter->device_mode);
+
+    if((pAdapter->device_mode == WLAN_HDD_SOFTAP)
+#ifdef WLAN_FEATURE_P2P
+     ||  (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+      ) 
+    {
+        /* ap_isolate == -1 means that in change bss, upper layer doesn't
+         * want to update this parameter */
+        if (-1 != params->ap_isolate) 
+        {
+            pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate;
+        } 
+    }
+
+    EXIT();
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_change_iface
+ * This function is used to set the interface type (INFRASTRUCTURE/ADHOC)
+ */
+int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy,
+                                    struct net_device *ndev,
+                                    enum nl80211_iftype type,
+                                    u32 *flags,
+                                    struct vif_params *params
+                                  )
+{
+    struct wireless_dev *wdev;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    tCsrRoamProfile *pRoamProfile = NULL;
+    eCsrRoamBssType LastBSSType;
+    hdd_config_t *pConfig = pHddCtx->cfg_ini;
+    eMib_dot11DesiredBssType connectedBssType;
+    VOS_STATUS status;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+        return -EAGAIN;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+                             __func__, pAdapter->device_mode);
+
+    wdev = ndev->ieee80211_ptr;
+
+#ifdef WLAN_BTAMP_FEATURE
+    if((NL80211_IFTYPE_P2P_CLIENT == type)||
+       (NL80211_IFTYPE_ADHOC == type)||
+       (NL80211_IFTYPE_AP == type)||
+       (NL80211_IFTYPE_P2P_GO == type))
+    {
+        pHddCtx->isAmpAllowed = VOS_FALSE;
+        // stop AMP traffic
+        status = WLANBAP_StopAmp();
+        if(VOS_STATUS_SUCCESS != status )
+        {
+            pHddCtx->isAmpAllowed = VOS_TRUE;
+            hddLog(VOS_TRACE_LEVEL_FATAL,
+                   "%s: Failed to stop AMP", __func__);
+            return -EINVAL;
+        }
+    }
+#endif //WLAN_BTAMP_FEATURE
+    /* Reset the current device mode bit mask*/
+    wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode);
+
+    if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
+#ifdef WLAN_FEATURE_P2P
+      || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+#endif
+      )
+    {
+        hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+        pRoamProfile = &pWextState->roamProfile;
+        LastBSSType = pRoamProfile->BSSType;
+
+        switch (type)
+        {
+            case NL80211_IFTYPE_STATION:
+#ifdef WLAN_FEATURE_P2P
+            case NL80211_IFTYPE_P2P_CLIENT:
+#endif
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                   "%s: setting interface Type to INFRASTRUCTURE", __func__);
+                pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+                pRoamProfile->phyMode =
+                   hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+                wdev->iftype = type;
+#ifdef WLAN_FEATURE_P2P
+                pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
+                                WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT;
+#endif
+                break;
+            case NL80211_IFTYPE_ADHOC:
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                  "%s: setting interface Type to ADHOC", __func__);
+                pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS;
+                pRoamProfile->phyMode =
+                    hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+                wdev->iftype = type;
+                break;
+
+            case NL80211_IFTYPE_AP:
+#ifdef WLAN_FEATURE_P2P
+            case NL80211_IFTYPE_P2P_GO:
+#endif
+            {
+                hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                      "%s: setting interface Type to %s", __func__,
+                      (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo");
+
+                //De-init the adapter.
+                hdd_stop_adapter( pHddCtx, pAdapter );
+                hdd_deinit_adapter( pHddCtx, pAdapter );
+                memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
+#ifdef WLAN_SOFTAP_FEATURE
+#ifdef WLAN_FEATURE_P2P
+                pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
+                                   WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO;
+#else
+                pAdapter->device_mode = WLAN_HDD_SOFTAP;
+#endif
+                hdd_set_ap_ops( pAdapter->dev );
+
+                status = hdd_init_ap_mode(pAdapter);
+                if(status != VOS_STATUS_SUCCESS)
+                {
+                    hddLog(VOS_TRACE_LEVEL_FATAL,
+                           "%s: Error initializing the ap mode", __func__);
+                    return -EINVAL;
+                }
+                hdd_set_conparam(1);
+
+#endif
+                /*interface type changed update in wiphy structure*/
+                if(wdev)
+                {
+                    wdev->iftype = type;
+                    pHddCtx->change_iface = type;
+                }
+                else
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR,
+                            "%s: ERROR !!!! Wireless dev is NULL", __func__);
+                    return -EINVAL;
+                }
+                goto done;
+            }
+
+            default:
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type",
+                        __func__);
+                return -EOPNOTSUPP;
+        }
+    }
+    else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP)
+#ifdef WLAN_FEATURE_P2P
+           || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+            )
+    {
+       switch(type)
+       {
+           case NL80211_IFTYPE_STATION:
+#ifdef WLAN_FEATURE_P2P
+           case NL80211_IFTYPE_P2P_CLIENT:
+#endif
+           case NL80211_IFTYPE_ADHOC:
+                wdev->iftype = type;
+#ifdef WLAN_FEATURE_P2P
+                pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
+                                  WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT;
+#endif
+                hdd_set_conparam(0);
+                pHddCtx->change_iface = type;
+                hdd_stop_adapter( pHddCtx, pAdapter );
+                hdd_deinit_adapter( pHddCtx, pAdapter );
+                memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
+                hdd_set_station_ops( pAdapter->dev );
+                status = hdd_init_station_mode( pAdapter );
+                if( VOS_STATUS_SUCCESS != status )
+                    return -EOPNOTSUPP;
+                goto done;
+            case NL80211_IFTYPE_AP:
+#ifdef WLAN_FEATURE_P2P
+            case NL80211_IFTYPE_P2P_GO:
+#endif
+                wdev->iftype = type;
+#ifdef WLAN_FEATURE_P2P
+                pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
+                                        WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO;
+#endif
+               goto done;
+           default:
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type",
+                        __func__);
+                return -EOPNOTSUPP;
+
+       }
+
+    }
+    else
+    {
+      return -EOPNOTSUPP;
+    }
+
+
+    if(pRoamProfile)
+    {
+        if ( LastBSSType != pRoamProfile->BSSType )
+        {
+            /*interface type changed update in wiphy structure*/
+            wdev->iftype = type;
+
+            /*the BSS mode changed, We need to issue disconnect
+              if connected or in IBSS disconnect state*/
+            if ( hdd_connGetConnectedBssType(
+                 WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) ||
+                ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) )
+            {
+                /*need to issue a disconnect to CSR.*/
+                INIT_COMPLETION(pAdapter->disconnect_comp_var);
+                if( eHAL_STATUS_SUCCESS ==
+                        sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                pAdapter->sessionId,
+                                eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
+                {
+                    wait_for_completion_interruptible_timeout(
+                              &pAdapter->disconnect_comp_var,
+                              msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                }
+            }
+        }
+    }
+
+done:
+    /*set bitmask based on updated value*/
+    wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode);
+#ifdef WLAN_BTAMP_FEATURE
+    if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && 
+       (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1))
+    {
+        //we are ok to do AMP
+        pHddCtx->isAmpAllowed = VOS_TRUE;
+    }
+#endif //WLAN_BTAMP_FEATURE
+    EXIT();
+    return 0;
+}
+
+static int wlan_hdd_change_station(struct wiphy *wiphy,
+                                         struct net_device *dev,
+                                         u8 *mac,
+                                         struct station_parameters *params)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
+    v_MACADDR_t STAMacAddress;
+
+    vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t));
+
+    if ( ( pAdapter->device_mode == WLAN_HDD_SOFTAP )
+#ifdef WLAN_FEATURE_P2P
+      || ( pAdapter->device_mode == WLAN_HDD_P2P_GO )
+#endif
+       )
+    {
+        if(params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) 
+        {
+            status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, 
+                                                  WLANTL_STA_AUTHENTICATED);
+
+            VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                "%s: Station MAC address does not matching", __FUNCTION__);
+            return -EINVAL;
+        }
+    }
+    
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_get_ibss_peer_staidx
+ * This function is used to get peer station index in IBSS mode
+ */
+static u8 wlan_hdd_cfg80211_get_ibss_peer_staidx(hdd_adapter_t* pAdapter)
+{
+    u8 idx = 0;
+    u8 temp[VOS_MAC_ADDR_SIZE] = {0}; 
+    ENTER();
+    memset(temp, 0, VOS_MAC_ADDR_SIZE);
+    for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
+    {
+        if ( (0 != 
+            (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[idx]) 
+          && memcmp((u8*)&(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.peerMacAddress[idx],
+                                                     temp, VOS_MAC_ADDR_SIZE) 
+           )
+        {
+            return idx;
+        }
+    }
+    return idx;
+}
+
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_add_key
+ * This function is used to initialize the key information
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, 
+                                      struct net_device *ndev,
+                                      u8 key_index, bool pairwise,
+                                      const u8 *mac_addr,
+                                      struct key_params *params
+                                      )
+#else
+static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, 
+                                      struct net_device *ndev,
+                                      u8 key_index, const u8 *mac_addr,
+                                      struct key_params *params
+                                      )
+#endif
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); 
+    tCsrRoamSetKey  setKey;
+    u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+    int status = 0;
+    v_U32_t roamId= 0xFF; 
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;  
+    hdd_hostapd_state_t *pHostapdState;
+    VOS_STATUS vos_status;
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+            __func__,pAdapter->device_mode);
+
+    if (CSR_MAX_NUM_KEY <= key_index)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, 
+                key_index);
+
+        return -EINVAL;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+            "%s: called with key index = %d & key length %d",
+            __func__, key_index, params->key_len);
+
+    /*extract key idx, key len and key*/
+    vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+    setKey.keyId = key_index;
+    setKey.keyLength = params->key_len;
+    vos_mem_copy(&setKey.Key[0],params->key, params->key_len);
+
+    switch (params->cipher) 
+    {
+        case WLAN_CIPHER_SUITE_WEP40:
+            setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+            break;
+
+        case WLAN_CIPHER_SUITE_WEP104:
+            setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+            break;
+
+        case WLAN_CIPHER_SUITE_TKIP:
+            {
+                u8 *pKey = &setKey.Key[0];
+                setKey.encType = eCSR_ENCRYPT_TYPE_TKIP;
+
+                vos_mem_zero(pKey, CSR_MAX_KEY_LEN);
+
+                /*Supplicant sends the 32bytes key in this order 
+
+                  |--------------|----------|----------|
+                  |   Tk1        |TX-MIC    |  RX Mic  | 
+                  |--------------|----------|----------|
+                  <---16bytes---><--8bytes--><--8bytes-->
+
+                */
+                /*Sme expects the 32 bytes key to be in the below order
+
+                  |--------------|----------|----------|
+                  |   Tk1        |RX-MIC    |  TX Mic  | 
+                  |--------------|----------|----------|
+                  <---16bytes---><--8bytes--><--8bytes-->
+                  */
+                /* Copy the Temporal Key 1 (TK1) */
+                vos_mem_copy(pKey, params->key,16);
+
+                /*Copy the rx mic first*/
+                vos_mem_copy(&pKey[16],&params->key[24],8); 
+
+                /*Copy the tx mic */
+                vos_mem_copy(&pKey[24],&params->key[16],8); 
+
+
+                break;
+            }
+
+        case WLAN_CIPHER_SUITE_CCMP:
+            setKey.encType = eCSR_ENCRYPT_TYPE_AES;
+            break;
+
+#ifdef FEATURE_WLAN_WAPI
+        case WLAN_CIPHER_SUITE_SMS4:
+            {
+                vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+                wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr,
+                        params->key, params->key_len);
+                return 0;
+            }
+#endif
+#ifdef FEATURE_WLAN_CCX
+        case WLAN_CIPHER_SUITE_KRK:
+            setKey.encType = eCSR_ENCRYPT_TYPE_KRK;
+            break;
+#endif
+        default:
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %lu",
+                    __func__, params->cipher);
+            return -EOPNOTSUPP;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d",
+            __func__, setKey.encType);
+
+
+
+    if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
+#ifdef WLAN_FEATURE_P2P
+            || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+       )
+    {
+
+
+        if ( 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+                (!pairwise)
+#else
+                (!mac_addr || is_broadcast_ether_addr(mac_addr)) 
+#endif
+           )
+        {
+            /* set group key*/
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "%s- %d: setting Broacast key",
+                    __func__, __LINE__);
+            setKey.keyDirection = eSIR_RX_ONLY;
+            vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+        }
+        else
+        {
+            /* set pairwise key*/
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "%s- %d: setting pairwise key",
+                    __func__, __LINE__);
+            setKey.keyDirection = eSIR_TX_RX;
+            vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN);
+        }
+
+        pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
+        if( pHostapdState->bssState == BSS_START ) 
+        { 
+            status = WLANSAP_SetKeySta( pVosContext, &setKey);
+
+            if ( status != eHAL_STATUS_SUCCESS )
+            {
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                        "[%4d] WLANSAP_SetKeySta returned ERROR status= %d",
+                        __LINE__, status );
+            }
+        }
+
+        /* Saving WEP keys */
+        else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY  == setKey.encType ||
+                eCSR_ENCRYPT_TYPE_WEP104_STATICKEY  == setKey.encType  )
+        {
+            //Save the wep key in ap context. Issue setkey after the BSS is started.
+            hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
+            vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey));
+        }
+        else
+        {
+            //Save the key in ap context. Issue setkey after the BSS is started.
+            hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); 
+            vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey));
+        }
+    }
+    else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) 
+#ifdef WLAN_FEATURE_P2P
+            || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+#endif
+            )
+    {
+        hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+        hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+        pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len;
+
+        vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], 
+                params->key, params->key_len);
+
+        pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;
+
+    if (!(  ( IW_AUTH_KEY_MGMT_802_1X 
+                    == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) 
+                    && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)
+             )
+                &&
+                (  (WLAN_CIPHER_SUITE_WEP40 == params->cipher)
+                   || (WLAN_CIPHER_SUITE_WEP104 == params->cipher)
+                )
+           )
+        {
+            /* in case of static WEP, macaddr/bssid is not coming from nl80211
+             * interface, copy bssid for pairwise key and group macaddr for 
+             * group key initialization*/
+
+            tCsrRoamProfile          *pRoamProfile = &pWextState->roamProfile;
+
+            pWextState->roamProfile.negotiatedUCEncryptionType = 
+                pHddStaCtx->conn_info.ucEncryptionType = 
+                ((WLAN_CIPHER_SUITE_WEP40 == params->cipher) ?
+                 eCSR_ENCRYPT_TYPE_WEP40_STATICKEY :
+                 eCSR_ENCRYPT_TYPE_WEP104_STATICKEY);
+
+
+            hddLog(VOS_TRACE_LEVEL_INFO_MED, 
+                    "%s: Negotiated encryption type %d", __func__, 
+                    pWextState->roamProfile.negotiatedUCEncryptionType);
+
+            sme_SetCfgPrivacy((tpAniSirGlobal)WLAN_HDD_GET_HAL_CTX(pAdapter),
+                    &pWextState->roamProfile, true);
+            setKey.keyLength = 0;
+            setKey.keyDirection =  eSIR_TX_RX;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+            if (pairwise) 
+            {
+#endif
+                if (mac_addr)
+                {
+                    vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN);
+                }
+                else
+                {
+                    /* macaddr is NULL, set the peerMac to bssId in case of BSS, 
+                     * and peerMacAddress in case of IBSS*/
+                    if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType)
+                    {
+                        u8 staidx = wlan_hdd_cfg80211_get_ibss_peer_staidx(pAdapter);
+                        if (HDD_MAX_NUM_IBSS_STA != staidx)
+                        {
+                            vos_mem_copy(setKey.peerMac,
+                                    &pHddStaCtx->conn_info.peerMacAddress[staidx],
+                                    WNI_CFG_BSSID_LEN);
+
+                        } 
+                        else
+                        {
+                            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No peerMac found", 
+                                    __func__);
+                            return -EOPNOTSUPP;
+                        } 
+                    }
+                    else
+                    {
+                        vos_mem_copy(setKey.peerMac,
+                                &pHddStaCtx->conn_info.bssId[0],
+                                WNI_CFG_BSSID_LEN);
+                    }
+                }
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+            }
+            else
+            {
+                /* set group key*/
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                        "%s- %d: setting Group key",
+                        __func__, __LINE__);
+                setKey.keyDirection = eSIR_RX_ONLY;
+                vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN);
+            }
+#endif
+        }
+        else if (
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+                (!pairwise)
+#else
+                (!mac_addr || is_broadcast_ether_addr(mac_addr)) 
+#endif
+                )
+        {
+            /* set group key*/
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "%s- %d: setting Group key",
+                    __func__, __LINE__);
+            setKey.keyDirection = eSIR_RX_ONLY;
+            vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+        }
+        else
+        {
+            /* set pairwise key*/
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "%s- %d: setting pairwise key",
+                    __func__, __LINE__);
+            setKey.keyDirection = eSIR_TX_RX;
+            vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN);
+        }
+
+        hddLog(VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: set key for peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d",
+                __func__, setKey.peerMac[0], setKey.peerMac[1], 
+                setKey.peerMac[2], setKey.peerMac[3], 
+                setKey.peerMac[4], setKey.peerMac[5], 
+                setKey.keyDirection);
+
+        vos_status = wlan_hdd_check_ula_done(pAdapter);
+
+        if ( vos_status != VOS_STATUS_SUCCESS )
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d",
+                    __LINE__, vos_status );
+
+            pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+
+            return -EINVAL;
+
+        }
+
+
+        /* issue set key request to SME*/
+        status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                pAdapter->sessionId, &setKey, &roamId );
+
+        if ( 0 != status )
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: sme_RoamSetKey failed, returned %d", __func__, status);
+            pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+            return -EINVAL;
+        }
+
+
+        /* in case of IBSS as there was no information available about WEP keys during 
+         * IBSS join, group key intialized with NULL key, so re-initialize group key 
+         * with correct value*/
+        if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && 
+            !(  ( IW_AUTH_KEY_MGMT_802_1X 
+                    == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) 
+                    && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)
+                 )
+                &&
+                (  (WLAN_CIPHER_SUITE_WEP40 == params->cipher)
+                   || (WLAN_CIPHER_SUITE_WEP104 == params->cipher)
+                )
+           )
+        {
+            setKey.keyDirection = eSIR_RX_ONLY;
+            vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+
+            hddLog(VOS_TRACE_LEVEL_INFO_MED, 
+                    "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d",
+                    __func__, setKey.peerMac[0], setKey.peerMac[1], 
+                    setKey.peerMac[2], setKey.peerMac[3], 
+                    setKey.peerMac[4], setKey.peerMac[5], 
+                    setKey.keyDirection);
+
+            status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                    pAdapter->sessionId, &setKey, &roamId );
+
+            if ( 0 != status )
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, 
+                        "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", 
+                        __func__, status);
+                pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+                return -EINVAL;
+            }
+        }
+    }
+
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_get_key
+ * This function is used to get the key information
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_cfg80211_get_key( 
+                        struct wiphy *wiphy, 
+                        struct net_device *ndev,
+                        u8 key_index, bool pairwise, 
+                        const u8 *mac_addr, void *cookie,
+                        void (*callback)(void *cookie, struct key_params*)
+                        )
+#else
+static int wlan_hdd_cfg80211_get_key( 
+                        struct wiphy *wiphy, 
+                        struct net_device *ndev,
+                        u8 key_index, const u8 *mac_addr, void *cookie,
+                        void (*callback)(void *cookie, struct key_params*)
+                        )
+#endif
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); 
+    hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
+    struct key_params params;
+
+    ENTER();
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                                 __func__,pAdapter->device_mode);
+    
+    memset(&params, 0, sizeof(params));
+
+    if (CSR_MAX_NUM_KEY <= key_index)
+    {
+        return -EINVAL;
+    }   
+
+    switch(pRoamProfile->EncryptionType.encryptionType[0])
+    {
+        case eCSR_ENCRYPT_TYPE_NONE:
+            params.cipher = IW_AUTH_CIPHER_NONE;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+        case eCSR_ENCRYPT_TYPE_WEP40:
+            params.cipher = WLAN_CIPHER_SUITE_WEP40;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+        case eCSR_ENCRYPT_TYPE_WEP104:
+            params.cipher = WLAN_CIPHER_SUITE_WEP104;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_TKIP:
+            params.cipher = WLAN_CIPHER_SUITE_TKIP;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_AES:
+            params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
+            break;
+
+        default:
+            params.cipher = IW_AUTH_CIPHER_NONE;
+            break;
+    }
+
+    params.key_len = pRoamProfile->Keys.KeyLength[key_index];
+    params.seq_len = 0;
+    params.seq = NULL;
+    params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0];
+    callback(cookie, &params);
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_del_key
+ * This function is used to delete the key information
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, 
+                                      struct net_device *ndev,
+                                      u8 key_index, 
+                                      bool pairwise, 
+                                      const u8 *mac_addr
+                                    )
+#else
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, 
+                                      struct net_device *ndev,
+                                      u8 key_index,
+                                      const u8 *mac_addr
+                                    )
+#endif
+{
+    int status = 0;
+
+    //This code needs to be revisited. There is sme_removeKey API, we should
+    //plan to use that. After the change to use correct index in setkey, 
+    //it is observed that this is invalidating peer
+    //key index whenever re-key is done. This is affecting data link.
+    //It should be ok to ignore del_key.
+#if 0
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); 
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;  
+    u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+    tCsrRoamSetKey  setKey;
+    v_U32_t roamId= 0xFF;
+    
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n",
+                                     __func__,pAdapter->device_mode);
+
+    if (CSR_MAX_NUM_KEY <= key_index)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, 
+                key_index);
+
+        return -EINVAL;
+    }
+
+    vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+    setKey.keyId = key_index;
+
+    if (mac_addr)
+        vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN);
+    else
+        vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN);
+
+    setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+
+    if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
+#ifdef WLAN_FEATURE_P2P
+      || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+       ) 
+    { 
+       
+        hdd_hostapd_state_t *pHostapdState =  
+                                  WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
+        if( pHostapdState->bssState == BSS_START)
+        {
+            status = WLANSAP_SetKeySta( pVosContext, &setKey);
+    
+            if ( status != eHAL_STATUS_SUCCESS )
+            {
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                     "[%4d] WLANSAP_SetKeySta returned ERROR status= %d",
+                     __LINE__, status );
+            }
+        }
+    }
+    else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
+#ifdef WLAN_FEATURE_P2P
+           || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) 
+#endif
+            )
+    {
+        hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+        pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;   
+    
+        hddLog(VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x",
+                __func__, setKey.peerMac[0], setKey.peerMac[1], 
+                setKey.peerMac[2], setKey.peerMac[3], 
+                setKey.peerMac[4], setKey.peerMac[5]);
+        if(pAdapter->sessionCtx.station.conn_info.connState == 
+                                       eConnectionState_Associated) 
+        {
+            status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                   pAdapter->sessionId, &setKey, &roamId );
+        
+            if ( 0 != status )
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, 
+                        "%s: sme_RoamSetKey failure, returned %d",
+                                                     __func__, status);
+                pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+                return -EINVAL;
+            }
+        }
+    }
+#endif
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_default_key
+ * This function is used to set the default tx key index
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy,
+                                              struct net_device *ndev,
+                                              u8 key_index,
+                                              bool unicast, bool multicast)
+#else
+static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy,
+                                              struct net_device *ndev,
+                                              u8 key_index)
+#endif
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); 
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    int status = 0;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d \n",
+                                         __func__,pAdapter->device_mode, key_index);
+   
+    if (CSR_MAX_NUM_KEY <= key_index)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, 
+                key_index);
+
+        return -EINVAL;
+    }
+
+    
+    if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
+#ifdef WLAN_FEATURE_P2P
+     || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+#endif
+       ) 
+    {
+        if ( (key_index != pWextState->roamProfile.Keys.defaultIndex) && 
+             (eCSR_ENCRYPT_TYPE_TKIP != 
+                pWextState->roamProfile.EncryptionType.encryptionType[0]) &&
+             (eCSR_ENCRYPT_TYPE_AES != 
+                pWextState->roamProfile.EncryptionType.encryptionType[0])
+           )
+        {  
+            /* if default key index is not same as previous one, 
+             * then update the default key index */
+    
+            tCsrRoamSetKey  setKey;
+            v_U32_t roamId= 0xFF;
+            tCsrKeys *Keys = &pWextState->roamProfile.Keys;
+            
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", 
+                    __func__, key_index);
+            
+            Keys->defaultIndex = (u8)key_index;
+            vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+            setKey.keyId = key_index;
+            setKey.keyLength = Keys->KeyLength[key_index];
+            
+            vos_mem_copy(&setKey.Key[0], 
+                    &Keys->KeyMaterial[key_index][0], 
+                    Keys->KeyLength[key_index]);
+    
+            setKey.keyDirection = eSIR_TX_ONLY;
+    
+            vos_mem_copy(setKey.peerMac, 
+                    &pHddStaCtx->conn_info.bssId[0],
+                    WNI_CFG_BSSID_LEN);
+    
+            setKey.encType = 
+                pWextState->roamProfile.EncryptionType.encryptionType[0];
+             
+            /* issue set key request */
+            status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                   pAdapter->sessionId, &setKey, &roamId );
+    
+            if ( 0 != status )
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, 
+                        "%s: sme_RoamSetKey failed, returned %d", __func__, 
+                        status);
+                return -EINVAL;
+            }
+        }
+    }
+
+    /* In SoftAp mode setting key direction for default mode */
+    else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode )
+    {
+        if ( (eCSR_ENCRYPT_TYPE_TKIP !=
+                pWextState->roamProfile.EncryptionType.encryptionType[0]) &&
+             (eCSR_ENCRYPT_TYPE_AES !=
+                pWextState->roamProfile.EncryptionType.encryptionType[0])
+           )
+        {
+            /*  Saving key direction for default key index to TX default */
+            hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
+            pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT;
+        }
+    }
+ 
+    return status;
+}
+
+/**
+ * FUNCTION: wlan_hdd_cfg80211_set_channel
+ * This function is used to set the channel number 
+ */
+int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev,
+                                   struct ieee80211_channel *chan,
+                                   enum nl80211_channel_type channel_type
+                                 )
+{
+    v_U32_t num_ch = 0;
+    u32 channel = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    int freq = chan->center_freq; /* freq is in MHZ */ 
+ 
+    ENTER();
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+                "%s: device_mode = %d  freq = %d \n",__func__, 
+                            pAdapter->device_mode, chan->center_freq);
+
+    /* 
+     * Do freq to chan conversion
+     * TODO: for 11a
+     */
+
+    channel = ieee80211_frequency_to_channel(freq);
+    
+    /* Check freq range */
+    if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || 
+            (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: Channel [%d] is outside valid range from %d to %d\n",
+                __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN,
+                WNI_CFG_CURRENT_CHANNEL_STAMAX);
+        return -EINVAL;
+    }
+
+    num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+
+    if ((WLAN_HDD_SOFTAP != pAdapter->device_mode)
+#ifdef WLAN_FEATURE_P2P
+     && (WLAN_HDD_P2P_GO != pAdapter->device_mode)
+#endif
+      )
+    {
+        if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel))
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR,
+                    "%s: Invalid Channel [%d] \n", __func__, channel);
+            return -EINVAL;
+        }
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: set channel to [%d] for device mode =%d", 
+                          __func__, channel,pAdapter->device_mode);
+    }
+    if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
+#ifdef WLAN_FEATURE_P2P
+     || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+#endif
+      )
+    {
+        hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+        tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile;
+        hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+        if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)
+        {
+           /* Link is up then return cant set channel*/
+            hddLog( VOS_TRACE_LEVEL_ERROR, 
+                   "%s: IBSS Associated, can't set the channel\n", __func__);
+            return -EINVAL;
+        }
+
+        num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1;
+        pHddStaCtx->conn_info.operationChannel = channel; 
+        pRoamProfile->ChannelInfo.ChannelList = 
+            &pHddStaCtx->conn_info.operationChannel; 
+    }
+    else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) 
+#ifdef WLAN_FEATURE_P2P
+        ||   (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+#endif
+            ) 
+    {
+        (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel;
+
+        if ( WLAN_HDD_SOFTAP == pAdapter->device_mode )
+        {
+            hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini;
+
+            /* If auto channel selection is configured as enable/ 1 then ignore
+            channel set by supplicant
+            */
+            if ( cfg_param->apAutoChannelSelection )
+            {
+                (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = AUTO_CHANNEL_SELECT;
+
+                hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                       "%s: set channel to auto channel (0) for device mode =%d",
+                       __func__, pAdapter->device_mode);
+            }
+        }
+    }
+    else 
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, 
+               "%s: Invalid device mode failed to set valid channel", __func__);
+        return -EINVAL;
+    }
+    EXIT();
+    return 0;
+}
+
+
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_inform_bss
+ * This function is used to inform the BSS details to nl80211 interface.
+ */
+static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss(
+                    hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile)
+{
+    struct net_device *dev = pAdapter->dev;
+    struct wireless_dev *wdev = dev->ieee80211_ptr;
+    struct wiphy *wiphy = wdev->wiphy;
+    tSirBssDescription *pBssDesc = roamProfile->pBssDesc;
+    int chan_no;
+    int ie_length;
+    const char *ie;
+    unsigned int freq;
+    struct ieee80211_channel *chan;
+    int rssi = 0;
+    struct cfg80211_bss *bss = NULL;
+
+    ENTER();
+
+    if( NULL == pBssDesc )
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL\n", __func__);
+        return bss;
+    }
+
+    chan_no = pBssDesc->channelId;
+    ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length );
+    ie =  ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL);
+
+    if( NULL == ie )
+    {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: IE of BSS descriptor is NULL\n", __func__);
+       return bss;
+    }
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+    if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ))
+    {
+        freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ);
+    }
+    else
+    {
+        freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ);
+    }
+#else
+    freq = ieee80211_channel_to_frequency(chan_no);
+#endif
+
+    chan = __ieee80211_get_channel(wiphy, freq);
+
+    bss = cfg80211_get_bss(wiphy, chan, pBssDesc->bssId,
+                           &roamProfile->SSID.ssId[0], roamProfile->SSID.length,
+                           WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+    if (bss == NULL)
+    {
+        rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100;
+
+        return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, 
+                le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), 
+                pBssDesc->capabilityInfo,
+                pBssDesc->beaconInterval, ie, ie_length,
+                rssi, GFP_KERNEL ));
+}
+    else
+    {
+        return bss;
+    }
+}
+
+
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame
+ * This function is used to inform the BSS details to nl80211 interface.
+ */
+struct cfg80211_bss*
+wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter,
+                                    tSirBssDescription *bss_desc
+                                    )
+{
+    /*
+      cfg80211_inform_bss() is not updating ie field of bss entry, if entry
+      already exists in bss data base of cfg80211 for that particular BSS ID.
+      Using cfg80211_inform_bss_frame to update the bss entry instead of
+      cfg80211_inform_bss, But this call expects mgmt packet as input. As of
+      now there is no possibility to get the mgmt(probe response) frame from PE,
+      converting bss_desc to ieee80211_mgmt(probe response) and passing to
+      cfg80211_inform_bss_frame.
+     */
+    struct net_device *dev = pAdapter->dev;
+    struct wireless_dev *wdev = dev->ieee80211_ptr;
+    struct wiphy *wiphy = wdev->wiphy;
+    int chan_no = bss_desc->channelId;
+    int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length );
+    const char *ie =
+        ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL);
+    unsigned int freq;
+    struct ieee80211_channel *chan;
+    struct ieee80211_mgmt *mgmt =
+        kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL);
+    struct cfg80211_bss *bss_status = NULL;
+    size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length;
+    int rssi = 0;
+
+    ENTER();
+
+    memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN);
+    memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp,
+            sizeof (bss_desc->timeStamp));
+    mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval;
+    mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo;
+    memcpy(mgmt->u.probe_resp.variable, ie, ie_length);
+
+    mgmt->frame_control |=
+        (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+    if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && 
+        (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL))
+    {
+        freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ);
+    }
+    else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && 
+        (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL))
+
+    {
+        freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ);
+    }
+    else
+    {
+        kfree(mgmt);
+        return NULL;
+    }
+#else
+    freq = ieee80211_channel_to_frequency(chan_no);
+#endif
+    chan = __ieee80211_get_channel(wiphy, freq);
+
+    /*To keep the rssi icon of the connected AP in the scan window
+    *and the rssi icon of the wireless networks in sync 
+    * */
+    if (( eConnectionState_Associated ==
+             pAdapter->sessionCtx.station.conn_info.connState ) &&
+             ( VOS_TRUE == vos_mem_compare(bss_desc->bssId,
+                             pAdapter->sessionCtx.station.conn_info.bssId,
+                             WNI_CFG_BSSID_LEN)))
+    {
+       /* supplicant takes the signal strength in terms of mBm(100*dBm) */
+       rssi = (pAdapter->rssi * 100);
+    }
+    else
+    {
+       rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100;
+    }
+
+    bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt,
+            frame_len, rssi, GFP_KERNEL);
+    kfree(mgmt);
+    return bss_status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_update_bss_db
+ * This function is used to update the BSS data base of CFG8011
+ */
+struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter, 
+                                      tCsrRoamInfo *pRoamInfo
+                                      )
+{
+    tCsrRoamConnectedProfile roamProfile;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    struct cfg80211_bss *bss = NULL;
+
+    ENTER();
+
+    memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile));
+    sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile);
+
+    if (NULL != roamProfile.pBssDesc)
+    {
+        bss = wlan_hdd_cfg80211_inform_bss(pAdapter, 
+                &roamProfile);
+
+        if (NULL == bss)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL",
+                    __func__);
+        }
+
+        sme_RoamFreeConnectProfile(hHal, &roamProfile);
+    }
+    else
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s:  roamProfile.pBssDesc is NULL",
+                __func__);
+    }
+    return bss;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_update_bss
+ */
+static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, 
+                                         hdd_adapter_t *pAdapter 
+                                        )
+{   
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    tCsrScanResultInfo *pScanResult;
+    eHalStatus status = 0;
+    tScanResultHandle pResult;
+    struct cfg80211_bss *bss_status = NULL;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return -EAGAIN;
+    }
+
+    /*
+     * start getting scan results and populate cgf80211 BSS database
+     */
+    status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult);
+
+    /* no scan results */
+    if (NULL == pResult)
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result\n", __func__);
+        return status;
+    }
+
+    pScanResult = sme_ScanResultGetFirst(hHal, pResult);
+
+    while (pScanResult)
+    {
+        /* 
+         * cfg80211_inform_bss() is not updating ie field of bss entry, if 
+         * entry already exists in bss data base of cfg80211 for that 
+         * particular BSS ID.  Using cfg80211_inform_bss_frame to update the 
+         * bss entry instead of cfg80211_inform_bss, But this call expects 
+         * mgmt packet as input. As of now there is no possibility to get 
+         * the mgmt(probe response) frame from PE, converting bss_desc to 
+         * ieee80211_mgmt(probe response) and passing to c
+         * fg80211_inform_bss_frame.
+         * */
+
+        bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter,
+                &pScanResult->BssDescriptor);
+    
+
+        if (NULL == bss_status)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    "%s: NULL returned by cfg80211_inform_bss\n", __func__);
+        }
+        else
+        {
+            cfg80211_put_bss(bss_status);
+        }
+
+        pScanResult = sme_ScanResultGetNext(hHal, pResult);
+    }
+
+    sme_ScanResultPurge(hHal, pResult); 
+
+    return 0; 
+}
+
+/*
+ * FUNCTION: hdd_cfg80211_scan_done_callback
+ * scanning callback function, called after finishing scan
+ *
+ */
+static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, 
+        void *pContext, tANI_U32 scanId, eCsrScanStatus status)
+{
+    struct net_device *dev = (struct net_device *) pContext;
+    //struct wireless_dev *wdev = dev->ieee80211_ptr;    
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
+    hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    struct cfg80211_scan_request *req = NULL;
+    int ret = 0;
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "%s called with halHandle = %p, pContext = %p,"
+            "scanID = %d, returned status = %d\n", 
+            __func__, halHandle, pContext, (int) scanId, (int) status);
+
+    //Block on scan req completion variable. Can't wait forever though.
+    ret = wait_for_completion_interruptible_timeout(
+                         &pScanInfo->scan_req_completion_event,
+                         msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ));
+    if (!ret)
+    {
+       VOS_ASSERT(pScanInfo->mScanPending);
+       return 0;
+    }
+
+    if(pScanInfo->mScanPending != VOS_TRUE)
+    {
+        VOS_ASSERT(pScanInfo->mScanPending);
+        return 0;
+    }
+
+    /* Check the scanId */
+    if (pScanInfo->scanId != scanId) 
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO,
+                "%s called with mismatched scanId pScanInfo->scanId = %d "
+                "scanId = %d \n", __func__, (int) pScanInfo->scanId, 
+                (int) scanId);
+    }
+
+    /* Scan is no longer pending */
+    pScanInfo->mScanPending = VOS_FALSE;
+
+    ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, 
+                                        pAdapter);
+
+    if (0 > ret)
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);    
+
+
+    /* If any client wait scan result through WEXT
+     * send scan done event to client */
+    if (pAdapter->scan_info.waitScanResult)
+    {
+        /* The other scan request waiting for current scan finish
+         * Send event to notify current scan finished */
+        if(WEXT_SCAN_PENDING_DELAY == pAdapter->scan_info.scan_pending_option)
+        {
+            vos_event_set(&pAdapter->scan_info.scan_finished_event);
+        }
+        /* Send notify to WEXT client */
+        else if(WEXT_SCAN_PENDING_PIGGYBACK == pAdapter->scan_info.scan_pending_option)
+        {
+            struct net_device *dev = pAdapter->dev;
+            union iwreq_data wrqu;
+            int we_event;
+            char *msg;
+
+            memset(&wrqu, '\0', sizeof(wrqu));
+            we_event = SIOCGIWSCAN;
+            msg = NULL;
+            wireless_send_event(dev, we_event, &wrqu, msg);
+        }
+    }
+    pAdapter->scan_info.waitScanResult = FALSE;
+
+    /* Get the Scan Req */
+    req = pAdapter->request;
+
+    if (!req)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n");
+        return 0;
+    }
+
+    /*
+     * setting up 0, just in case.
+     */  
+    req->n_ssids = 0;
+    req->n_channels = 0;
+    req->ie = 0;
+
+    /*
+     * cfg80211_scan_done informing NL80211 about completion
+     * of scanning
+     */
+    cfg80211_scan_done(req, false);
+    complete(&pAdapter->abortscan_event_var);
+    pAdapter->request = NULL;
+
+#ifdef WLAN_FEATURE_P2P
+    /* Flush out scan result after p2p_serach is done */
+    if(pScanInfo->p2pSearch )
+    {
+        tANI_U8 sessionId = pAdapter->sessionId;
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        { 
+            sessionId = pAdapter->p2pSessionId;
+        } 
+        sme_ScanFlushResult(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId);
+        pScanInfo->p2pSearch = 0;
+    }
+#endif
+
+    EXIT();
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_scan
+ * this scan respond to scan trigger and update cfg80211 scan database
+ * later, scan dump command can be used to recieve scan results
+ */
+int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, struct net_device *dev,
+        struct cfg80211_scan_request *request)
+{  
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini;
+    tCsrScanRequest scanRequest;
+    tANI_U8 *channelList = NULL, i;
+    v_U32_t scanId = 0;
+    int status = 0;
+    hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
+#ifdef WLAN_FEATURE_P2P
+    v_U8_t* pP2pIe = NULL;
+#endif
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
+                                   __func__,pAdapter->device_mode);
+#ifdef WLAN_BTAMP_FEATURE
+    //Scan not supported when AMP traffic is on.
+    if( VOS_TRUE == WLANBAP_AmpSessionOn() ) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: No scanning when AMP is on", __func__);
+        return -EOPNOTSUPP;
+    }
+#endif
+    //Scan on any other interface is not supported.
+    if( pAdapter->device_mode == WLAN_HDD_SOFTAP ) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: Not scanning on device_mode = %d",
+                                    __func__, pAdapter->device_mode);
+        return -EOPNOTSUPP;
+    }
+
+    if (TRUE == pScanInfo->mScanPending)
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: mScanPending is TRUE", __func__);
+        return -EBUSY;                  
+    }
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EAGAIN;
+    }
+
+    if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
+                  "%s: Aquire lock fail", __func__);
+        return -EAGAIN;
+    }    
+    if (TRUE == pHddCtx->tmInfo.tmAction.enterImps)
+    {
+        hddLog(VOS_TRACE_LEVEL_WARN,
+               "%s: MAX TM Level Scan not allowed", __func__);
+        mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
+        return -EBUSY;                  
+    }
+    mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
+
+    vos_mem_zero( &scanRequest, sizeof(scanRequest));
+
+    if (NULL != request)
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d",
+               (int)request->n_ssids);  
+
+        /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1.
+         * Becasue of this, driver is assuming that this is not wildcard scan and so
+         * is not aging out the scan results.
+         */
+        if ('\0' == request->ssids->ssid[0])
+        {
+            request->n_ssids = 0;
+        }
+
+        if (0 < request->n_ssids)
+        {
+            tCsrSSIDInfo *SsidInfo;
+            int j;
+            scanRequest.SSIDs.numOfSSIDs = request->n_ssids;
+            /* Allocate num_ssid tCsrSSIDInfo structure */
+            SsidInfo = scanRequest.SSIDs.SSIDList =
+                      ( tCsrSSIDInfo *)vos_mem_malloc(
+                              request->n_ssids*sizeof(tCsrSSIDInfo));
+
+            if(NULL == scanRequest.SSIDs.SSIDList)
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                               "memory alloc failed SSIDInfo buffer");
+                return -ENOMEM;
+            }
+
+            /* copy all the ssid's and their length */
+            for(j = 0; j < request->n_ssids; j++, SsidInfo++)
+            {
+                /* get the ssid length */
+                SsidInfo->SSID.length = request->ssids[j].ssid_len;
+                vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0],
+                             SsidInfo->SSID.length);
+                SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0';
+                hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d:  %s",
+                                                   j, SsidInfo->SSID.ssId);
+            }
+            /* set the scan type to active */
+            scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        }
+        else if(WLAN_HDD_P2P_GO == pAdapter->device_mode)
+        {
+            /* set the scan type to active */
+            scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        }
+        else
+        {
+            /*Set the scan type to default type, in this case it is ACTIVE*/
+            scanRequest.scanType = pScanInfo->scan_mode;
+        }
+        scanRequest.minChnTime = cfg_param->nActiveMinChnTime; 
+        scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime;
+    }
+    else
+    {
+        /* set the scan type to active */
+        scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff );
+
+        /* set min and max channel time to zero */
+        scanRequest.minChnTime = 0;
+        scanRequest.maxChnTime = 0;
+    }
+
+    /* set BSSType to default type */
+    scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+
+    /*TODO: scan the requested channels only*/
+
+    /*Right now scanning all the channels */
+    if( request )
+    {
+        if( request->n_channels )
+        {
+            channelList = vos_mem_malloc( request->n_channels );
+            if( NULL == channelList )
+            {
+                status = -ENOMEM;
+                goto free_mem;
+            }
+
+            for( i = 0 ; i < request->n_channels ; i++ )
+                channelList[i] = request->channels[i]->hw_value;
+        }
+
+        scanRequest.ChannelInfo.numOfChannels = request->n_channels;
+        scanRequest.ChannelInfo.ChannelList = channelList;
+
+        /* set requestType to full scan */
+        scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+
+        if( request->ie_len )
+        {
+            /* save this for future association (join requires this) */
+            memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) );
+            memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len);
+            pScanInfo->scanAddIE.length = request->ie_len;
+
+            if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
+              )
+            {
+               pwextBuf->roamProfile.pAddIEScan = pScanInfo->scanAddIE.addIEdata;
+               pwextBuf->roamProfile.nAddIEScanLength = pScanInfo->scanAddIE.length;
+            }
+
+            scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length;
+            scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata;
+
+#ifdef WLAN_FEATURE_P2P
+            pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie,
+                                                       request->ie_len);
+            if (pP2pIe != NULL)
+            {
+                if ( (request->n_ssids == 1) && 
+                     (request->ssids[0].ssid_len == P2P_WILDCARD_SSID_LEN) &&
+                     !memcmp(request->ssids[0].ssid, P2P_WILDCARD_SSID,
+                             P2P_WILDCARD_SSID_LEN ))
+                {
+                    tANI_U8 sessionId = pAdapter->sessionId;
+                    hddLog(VOS_TRACE_LEVEL_INFO,
+                           "%s: This is a P2P Search", __func__);
+                    scanRequest.p2pSearch = 1;
+                    pScanInfo->p2pSearch = 1;
+
+                    /* set requestType to P2P Discovery */
+                    scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY;
+                    if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+                    {
+                        sessionId = pAdapter->p2pSessionId;
+                    }
+                    sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                          sessionId );
+                }
+            }
+#endif
+        }
+    }
+
+    INIT_COMPLETION(pScanInfo->scan_req_completion_event);
+
+    if ((pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated) &&
+        (scanRequest.p2pSearch))
+    {
+        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                              pAdapter->p2pSessionId, &scanRequest, &scanId,
+                              &hdd_cfg80211_scan_done_callback, dev );
+    }
+    else
+    {
+        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                              pAdapter->sessionId, &scanRequest, &scanId,
+                              &hdd_cfg80211_scan_done_callback, dev );
+    }
+    
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: sme_ScanRequest returned error %d", __func__, status);
+        complete(&pScanInfo->scan_req_completion_event);
+        status = -EIO;
+        goto free_mem;
+    }
+
+    pScanInfo->mScanPending = TRUE;
+    pAdapter->request = request;
+    pScanInfo->scanId = scanId;
+
+    complete(&pScanInfo->scan_req_completion_event);
+
+free_mem:
+    if( scanRequest.SSIDs.SSIDList )
+    {
+        vos_mem_free(scanRequest.SSIDs.SSIDList);
+    }
+
+    if( channelList )
+      vos_mem_free( channelList );
+
+    EXIT();
+
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_connect_start
+ * This function is used to start the association process 
+ */
+int wlan_hdd_cfg80211_connect_start( hdd_adapter_t  *pAdapter, 
+        const u8 *ssid, size_t ssid_len, const u8 *bssid)
+{
+    int status = 0;
+    hdd_wext_state_t *pWextState;
+    v_U32_t roamId;
+    tCsrRoamProfile *pRoamProfile;
+    eMib_dot11DesiredBssType connectedBssType;
+    eCsrAuthType RSNAuthType;
+
+    ENTER();
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    
+    if (SIR_MAC_MAX_SSID_LENGTH < ssid_len)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__);
+        return -EINVAL;
+    }
+
+    pRoamProfile = &pWextState->roamProfile;
+
+    if (pRoamProfile) 
+    {
+        if (hdd_connGetConnectedBssType(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
+            &connectedBssType ) || ( eMib_dot11DesiredBssType_independent == 
+              connectedBssType))
+        {
+            /* Issue disconnect to CSR */
+            INIT_COMPLETION(pAdapter->disconnect_comp_var);
+            if( eHAL_STATUS_SUCCESS == 
+                  sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                            pAdapter->sessionId,
+                            eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
+            {
+                wait_for_completion_interruptible_timeout(
+                        &pAdapter->disconnect_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+            }
+        }
+
+        if (HDD_WMM_USER_MODE_NO_QOS == 
+                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode)
+        {
+            /*QoS not enabled in cfg file*/
+            pRoamProfile->uapsd_mask = 0;
+        }
+        else
+        {
+            /*QoS enabled, update uapsd mask from cfg file*/
+            pRoamProfile->uapsd_mask = 
+                     (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask;
+        }
+
+        pRoamProfile->SSIDs.numOfSSIDs = 1;
+        pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len;
+        vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId,
+                sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); 
+        vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId),
+                ssid, ssid_len);
+
+        if (bssid)
+        {
+            pRoamProfile->BSSIDs.numOfBSSIDs = 1;
+            vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid,
+                    WNI_CFG_BSSID_LEN);
+            /* Save BSSID in seperate variable as well, as RoamProfile 
+               BSSID is getting zeroed out in the association process. And in 
+               case of join failure we should send valid BSSID to supplicant
+             */
+            vos_mem_copy((void *)(pWextState->req_bssId), bssid,
+                    WNI_CFG_BSSID_LEN);
+        }
+
+        if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) ||
+                (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion))
+        { 
+            /*set gen ie*/
+            hdd_SetGENIEToCsr(pAdapter, &RSNAuthType);
+            /*set auth*/
+            hdd_set_csr_auth_type(pAdapter, RSNAuthType);
+        }
+        else if ( (pWextState->roamProfile.AuthType.authType[0] == 
+                    eCSR_AUTH_TYPE_OPEN_SYSTEM)
+                && ((pWextState->roamProfile.EncryptionType.encryptionType[0] == 
+                        eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) 
+                    || (pWextState->roamProfile.EncryptionType.encryptionType[0] == 
+                        eCSR_ENCRYPT_TYPE_WEP104_STATICKEY))
+                )
+        {
+            /*Android UI not having any option to configure the Authentication type to OPEN/SHARED;
+             * The authentication type will be always eCSR_AUTH_TYPE_OPEN_SYSTEM when WEP is used
+             * Use eCSR_AUTH_TYPE_AUTOSWITCH when WEP encryption used*/
+            (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType = 
+                                                     eCSR_AUTH_TYPE_AUTOSWITCH;
+            pWextState->roamProfile.AuthType.authType[0] = 
+                  (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
+        }
+#ifdef FEATURE_WLAN_WAPI
+        if (pAdapter->wapi_info.nWapiMode)
+        {
+            hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __FUNCTION__);
+            switch (pAdapter->wapi_info.wapiAuthMode)
+            {
+                case WAPI_AUTH_MODE_PSK:
+                {
+                    hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __FUNCTION__,
+                                                   pAdapter->wapi_info.wapiAuthMode);
+                    pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
+                    break;
+                }
+                case WAPI_AUTH_MODE_CERT:
+                {
+                    hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __FUNCTION__,
+                                                    pAdapter->wapi_info.wapiAuthMode);
+                    pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
+                    break;
+                }
+            } // End of switch
+            if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK ||
+                pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT)
+            {
+                hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __FUNCTION__);
+                pRoamProfile->AuthType.numEntries = 1;
+                pRoamProfile->EncryptionType.numEntries = 1;
+                pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
+                pRoamProfile->mcEncryptionType.numEntries = 1;
+                pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
+            }
+        }
+#endif /* FEATURE_WLAN_WAPI */
+        pRoamProfile->csrPersona = pAdapter->device_mode;
+
+        status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                            pAdapter->sessionId, pRoamProfile, &roamId);
+
+        pRoamProfile->ChannelInfo.ChannelList = NULL; 
+        pRoamProfile->ChannelInfo.numOfChannels = 0;
+    }
+    else
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__);
+        return -EINVAL;
+    }
+    EXIT(); 
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_set_cfg80211_auth_type
+ * This function is used to set the authentication type (OPEN/SHARED).
+ *
+ */
+static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter,
+        enum nl80211_auth_type auth_type)
+{
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);   
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    ENTER();
+
+    /*set authentication type*/
+    switch (auth_type) 
+    {
+        case NL80211_AUTHTYPE_OPEN_SYSTEM:
+        case NL80211_AUTHTYPE_AUTOMATIC:
+            hddLog(VOS_TRACE_LEVEL_INFO, 
+                    "%s: set authentication type to OPEN", __func__);
+            pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+            break;
+
+        case NL80211_AUTHTYPE_SHARED_KEY:
+            hddLog(VOS_TRACE_LEVEL_INFO, 
+                    "%s: set authentication type to SHARED", __func__);
+            pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY;
+            break;
+#ifdef FEATURE_WLAN_CCX
+        case NL80211_AUTHTYPE_NETWORK_EAP:
+            hddLog(VOS_TRACE_LEVEL_INFO, 
+                            "%s: set authentication type to CCKM WPA", __func__);
+            pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required.
+            break;
+#endif
+
+
+        default:
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: Unsupported authentication type %d", __func__, 
+                    auth_type);
+            pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN;
+            return -EINVAL;
+    }
+
+    pWextState->roamProfile.AuthType.authType[0] = 
+                                        pHddStaCtx->conn_info.authType;
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_set_akm_suite
+ * This function is used to set the key mgmt type(PSK/8021x).
+ *
+ */
+static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, 
+                                   u32 key_mgmt
+                                   )
+{
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    ENTER();
+    
+    /*set key mgmt type*/
+    switch(key_mgmt)
+    {
+        case WLAN_AKM_SUITE_PSK:
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", 
+                    __func__);
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK;
+            break;
+
+        case WLAN_AKM_SUITE_8021X:
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", 
+                    __func__);
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X;
+            break;
+#ifdef FEATURE_WLAN_CCX
+#define WLAN_AKM_SUITE_CCKM         0x00409600 /* Should be in ieee802_11_defs.h */
+#define IW_AUTH_KEY_MGMT_CCKM       8  /* Should be in linux/wireless.h */
+        case WLAN_AKM_SUITE_CCKM:
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM",
+                            __func__);
+            pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM;
+            break;
+#endif
+
+        default:
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", 
+                    __func__, key_mgmt);
+            return -EINVAL;
+
+    }
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_cipher
+ * This function is used to set the encryption type 
+ * (NONE/WEP40/WEP104/TKIP/CCMP).
+ */
+static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, 
+                                u32 cipher, 
+                                bool ucast
+                                )
+{
+    eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);   
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    ENTER();
+
+    if (!cipher) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", 
+                __func__, cipher);
+        encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+    }
+    else
+    {
+    
+        /*set encryption method*/
+        switch (cipher) 
+        {
+            case IW_AUTH_CIPHER_NONE:
+                encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+                break;
+    
+            case WLAN_CIPHER_SUITE_WEP40:
+                if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && 
+                    (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+                    encryptionType = eCSR_ENCRYPT_TYPE_WEP40;
+                else
+                    encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+                break;
+    
+            case WLAN_CIPHER_SUITE_WEP104:
+                if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && 
+                    (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+                    encryptionType = eCSR_ENCRYPT_TYPE_WEP104;
+                else
+                    encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+                break;
+    
+            case WLAN_CIPHER_SUITE_TKIP:
+                encryptionType = eCSR_ENCRYPT_TYPE_TKIP;
+                break;
+    
+            case WLAN_CIPHER_SUITE_CCMP:
+                encryptionType = eCSR_ENCRYPT_TYPE_AES;
+                break;
+#ifdef FEATURE_WLAN_WAPI
+        case WLAN_CIPHER_SUITE_SMS4:
+            encryptionType = eCSR_ENCRYPT_TYPE_WPI;
+            break;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+        case WLAN_CIPHER_SUITE_KRK:
+            encryptionType = eCSR_ENCRYPT_TYPE_KRK;
+            break;
+#endif
+            default:
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", 
+                        __func__, cipher);
+                return -EOPNOTSUPP;
+        }
+    }
+
+    if (ucast)
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", 
+                __func__, encryptionType);
+        pHddStaCtx->conn_info.ucEncryptionType            = encryptionType;
+        pWextState->roamProfile.EncryptionType.numEntries = 1;
+        pWextState->roamProfile.EncryptionType.encryptionType[0] = 
+                                          encryptionType;
+    }
+    else
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", 
+                __func__, encryptionType);
+        pHddStaCtx->conn_info.mcEncryptionType                       = encryptionType;
+        pWextState->roamProfile.mcEncryptionType.numEntries        = 1;
+        pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType;
+    }
+
+    return 0;
+}
+
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_ie
+ * This function is used to parse WPA/RSN IE's.
+ */
+int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, 
+                              u8 *ie, 
+                              size_t ie_len
+                              )
+{
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    u8 *genie = ie;
+    v_U16_t remLen = ie_len;
+#ifdef FEATURE_WLAN_WAPI
+    v_U32_t akmsuite[MAX_NUM_AKM_SUITES];
+    u16 *tmp;
+    v_U16_t akmsuiteCount;
+    int *akmlist;
+#endif
+    ENTER();
+
+    /* clear previous assocAddIE */
+    pWextState->assocAddIE.length = 0;
+    pWextState->roamProfile.bWPSAssociation = VOS_FALSE;
+
+    while (remLen >= 2)
+    {
+        v_U16_t eLen = 0;
+        v_U8_t elementId;
+        elementId = *genie++;
+        eLen  = *genie++;
+        remLen -= 2;
+    
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]\n", 
+            __func__, elementId, eLen);
+         
+        switch ( elementId ) 
+        {
+            case DOT11F_EID_WPA: 
+                if ((2+4) > eLen) /* should have at least OUI */
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, 
+                              "%s: Invalid WPA IE", __func__);
+                    return -EINVAL;
+                }
+                else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) 
+                {
+                    v_U16_t curAddIELen = pWextState->assocAddIE.length;
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", 
+                            __func__, eLen + 2);
+                    
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    {
+                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accomadate assocAddIE. "
+                                                      "Need bigger buffer space\n");
+                       VOS_ASSERT(0);
+                       return -ENOMEM;
+                    }
+                    // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE
+                    memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2);
+                    pWextState->assocAddIE.length += eLen + 2;
+                    
+                    pWextState->roamProfile.bWPSAssociation = VOS_TRUE;
+                    pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
+                    pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
+                }
+                else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) 
+                {  
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2);
+                    memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
+                    memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/);
+                    pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE;
+                    pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len;
+                }
+#ifdef WLAN_FEATURE_P2P
+                else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, 
+                                                         P2P_OUI_TYPE_SIZE)) 
+                        /*Consider P2P IE, only for P2P Client */
+                         && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) )
+                {
+                    v_U16_t curAddIELen = pWextState->assocAddIE.length;
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", 
+                            __func__, eLen + 2);
+                    
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    {
+                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accomadate assocAddIE "
+                                                      "Need bigger buffer space\n");
+                       VOS_ASSERT(0);
+                       return -ENOMEM;
+                    }
+                    // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE
+                    memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2);
+                    pWextState->assocAddIE.length += eLen + 2;
+                    
+                    pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
+                    pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
+                }
+#endif
+#ifdef WLAN_FEATURE_WFD
+                else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, 
+                                                         WFD_OUI_TYPE_SIZE)) 
+                        /*Consider WFD IE, only for P2P Client */
+                         && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) )
+                {
+                    v_U16_t curAddIELen = pWextState->assocAddIE.length;
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", 
+                            __func__, eLen + 2);
+                    
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    {
+                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accomadate assocAddIE "
+                                                      "Need bigger buffer space\n");
+                       VOS_ASSERT(0);
+                       return -ENOMEM;
+                    }
+                    // WFD IE is saved to Additional IE ; it should be accumulated to handle
+                    // WPS IE + P2P IE + WFD IE
+                    memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2);
+                    pWextState->assocAddIE.length += eLen + 2;
+                    
+                    pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
+                    pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
+                }
+#endif
+                break;
+            case DOT11F_EID_RSN:
+                hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2);
+                memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
+                memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/);
+                pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE;
+                pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len;
+                break;
+#ifdef FEATURE_WLAN_WAPI
+            case WLAN_EID_WAPI:
+                pAdapter->wapi_info.nWapiMode = 1;   //Setting WAPI Mode to ON=1
+                hddLog(VOS_TRACE_LEVEL_INFO,"WAPI MODE IS  %lu \n",
+                                          pAdapter->wapi_info.nWapiMode);
+                tmp = (u16 *)ie;
+                tmp = tmp + 2; // Skip element Id and Len, Version        
+                akmsuiteCount = WPA_GET_LE16(tmp);
+                tmp = tmp + 1;
+                akmlist = (int *)(tmp);
+                if(akmsuiteCount <= MAX_NUM_AKM_SUITES)
+                {
+                    memcpy(akmsuite, akmlist, (4*akmsuiteCount));
+                }
+                else
+                {
+                    hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count\n");
+                    VOS_ASSERT(0);
+                    return -EINVAL;
+                }
+
+                if (WAPI_PSK_AKM_SUITE == akmsuite[0])
+                {
+                    hddLog(VOS_TRACE_LEVEL_INFO, "%s: WAPI AUTH MODE SET TO PSK",
+                                                            __FUNCTION__);
+                    pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK;
+                }    
+                if (WAPI_CERT_AKM_SUITE == akmsuite[0])
+                {     
+                    hddLog(VOS_TRACE_LEVEL_INFO, "%s: WAPI AUTH MODE SET TO CERTIFICATE",
+                                                             __FUNCTION__);
+                    pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT;
+                }
+                break;
+#endif
+            default:
+                hddLog (VOS_TRACE_LEVEL_ERROR, 
+                        "%s Set UNKNOWN IE %X", __func__, elementId);
+                return 0;
+        }
+        genie += eLen;
+        remLen -= eLen;
+    }
+    EXIT();
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_privacy
+ * This function is used to initialize the security 
+ * parameters during connect operation.
+ */
+int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, 
+                                   struct cfg80211_connect_params *req
+                                   )
+{
+    int status = 0;
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);   
+    ENTER();
+
+    /*set wpa version*/
+    pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
+
+    if (req->crypto.wpa_versions) 
+    {
+        if ( (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions)
+            && ( (req->ie_len) 
+           && (0 == memcmp( &req->ie[2], "\x00\x50\xf2",3) ) ) ) 
+           // Make sure that it is including a WPA IE.
+           /* Currently NL is putting WPA version 1 even for open, 
+            * since p2p ie is also put in same buffer.
+            * */
+        {
+            pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA;
+        }
+        else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions)
+        {
+            pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2;
+        }
+    }
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, 
+            pWextState->wpaVersion);
+
+    /*set authentication type*/
+    status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type);
+
+    if (0 > status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: failed to set authentication type ", __func__);
+        return status;
+    }
+
+    /*set key mgmt type*/
+    if (req->crypto.n_akm_suites)
+    {
+        status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]);
+        if (0 > status)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", 
+                    __func__);
+            return status;
+        }
+    }
+
+    /*set pairwise cipher type*/
+    if (req->crypto.n_ciphers_pairwise)
+    {
+        status = wlan_hdd_cfg80211_set_cipher(pAdapter,
+                                      req->crypto.ciphers_pairwise[0], true);
+        if (0 > status)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: failed to set unicast cipher type", __func__);
+            return status;
+        }
+    }
+    else
+    {
+        /*Reset previous cipher suite to none*/
+        status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true);
+        if (0 > status)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: failed to set unicast cipher type", __func__);
+            return status;
+        }
+    }
+
+    /*set group cipher type*/
+    status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group,
+                                                                       false);
+
+    if (0 > status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", 
+                __func__);
+        return status;
+    }
+
+    /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/
+    if (req->ie_len)
+    {
+        status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len);
+        if ( 0 > status)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse the WPA/RSN IE", 
+                    __func__);
+            return status;
+        }
+    }
+
+    /*incase of WEP set default key information*/
+    if (req->key && req->key_len) 
+    {
+        if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0])
+                || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0])
+          )
+        {
+            if ( IW_AUTH_KEY_MGMT_802_1X 
+                    == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X  ))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", 
+                        __func__);
+                return -EOPNOTSUPP;
+            }
+            else
+            {
+                u8 key_len = req->key_len;
+                u8 key_idx = req->key_idx;
+
+                if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) 
+                        && (CSR_MAX_NUM_KEY > key_idx)
+                  )
+                {
+                    hddLog(VOS_TRACE_LEVEL_INFO, 
+                     "%s: setting default wep key, key_idx = %hu key_len %hu", 
+                            __func__, key_idx, key_len);
+                    vos_mem_copy(
+                       &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], 
+                                  req->key, key_len);
+                    pWextState->roamProfile.Keys.KeyLength[key_idx] = 
+                                                               (u8)key_len;
+                    pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx;
+                }
+            }
+        }
+    }
+
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_privacy
+ * This function is used to initialize the security 
+ * parameters during connect operation.
+ */
+static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, 
+                                      struct net_device *ndev,
+                                      struct cfg80211_connect_params *req
+                                      )
+{
+    int status = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); 
+    VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL;
+    hdd_context_t *pHddCtx = NULL;
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+             "%s: device_mode = %d\n",__func__,pAdapter->device_mode);
+
+    if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EAGAIN;
+    }
+
+#ifdef WLAN_BTAMP_FEATURE
+    //Infra connect not supported when AMP traffic is on.
+    if( VOS_TRUE == WLANBAP_AmpSessionOn() ) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: No connection when AMP is on", __func__);
+        return -1;
+    }
+#endif
+    /*initialise security parameters*/
+    status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); 
+
+    if ( 0 > status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", 
+                __func__);
+        return status;
+    }
+
+    //If Device Mode is Station Concurrent Sessions Exit BMps
+    //P2P Mode will be taken care in Open/close adaptor
+    if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
+        (vos_concurrent_sessions_running()))
+    {
+        v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+
+        if (NULL != pVosContext)
+        {
+            pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+            if(NULL != pHddCtx)
+            {
+               exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
+            }
+        }
+    }
+
+    status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, 
+                                                req->ssid_len, req->bssid);
+
+    if (0 > status)
+    {
+        //ReEnable BMPS if disabled
+        if((VOS_STATUS_SUCCESS == exitbmpsStatus) &&
+            (NULL != pHddCtx))
+        {
+           //ReEnable Bmps and Imps back
+           hdd_enable_bmps_imps(pHddCtx);
+        }
+
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__);
+        return status;
+    }
+    (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE;
+    EXIT();
+    return status;
+}
+
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_disconnect
+ * This function is used to issue a disconnect request to SME
+ */
+static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, 
+                                         struct net_device *dev,
+                                         u16 reason
+                                         )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    tCsrRoamProfile  *pRoamProfile = 
+                    &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile;
+    int status = 0;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    
+    ENTER();
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n", 
+                                    __func__,pAdapter->device_mode);
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", 
+            __func__, reason);    
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s:LOGP in Progress. Ignore!!!",__func__);
+        return -EAGAIN;
+    }
+    if (NULL != pRoamProfile)
+    {
+        /*issue disconnect request to SME, if station is in connected state*/
+        if (pHddStaCtx->conn_info.connState == eConnectionState_Associated)
+        {
+            eCsrRoamDisconnectReason reasonCode = 
+                                       eCSR_DISCONNECT_REASON_UNSPECIFIED;
+            switch(reason)
+            {
+                case WLAN_REASON_MIC_FAILURE:
+                    reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR;
+                    break;
+
+                case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY:
+                case WLAN_REASON_DISASSOC_AP_BUSY:
+                case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA:
+                    reasonCode = eCSR_DISCONNECT_REASON_DISASSOC;
+                    break;
+
+                case WLAN_REASON_PREV_AUTH_NOT_VALID:
+                case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA:
+                    reasonCode = eCSR_DISCONNECT_REASON_DEAUTH;
+                    break;
+
+                case WLAN_REASON_DEAUTH_LEAVING:
+                default:
+                    reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED;
+                    break;
+            }
+            pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
+            (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_TRUE;
+            INIT_COMPLETION(pAdapter->disconnect_comp_var);
+
+            /*issue disconnect*/
+            status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                         pAdapter->sessionId, reasonCode);
+
+            if ( 0 != status)
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                        "%s csrRoamDisconnect failure, returned %d \n", 
+                        __func__, (int)status );
+                return -EINVAL;
+            }
+
+            wait_for_completion_interruptible_timeout(
+                   &pAdapter->disconnect_comp_var,
+                   msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+
+
+            /*stop tx queues*/
+            netif_tx_disable(dev);
+            netif_carrier_off(dev);
+        }
+    }
+    else
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__);
+    }
+
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss
+ * This function is used to initialize the security 
+ * settings in IBSS mode.
+ */
+static int wlan_hdd_cfg80211_set_privacy_ibss(
+                                         hdd_adapter_t *pAdapter, 
+                                         struct cfg80211_ibss_params *params
+                                         )
+{
+    int status = 0;
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);   
+    eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    
+    ENTER();
+
+    pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
+
+    if (params->ie_len && ( NULL != params->ie) )
+    {
+        if (WLAN_EID_RSN == params->ie[0]) 
+        {
+            pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2;
+            encryptionType = eCSR_ENCRYPT_TYPE_AES;
+        }
+        else
+        {
+            pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA;
+            encryptionType = eCSR_ENCRYPT_TYPE_TKIP;
+        }
+        status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len);
+
+        if (0 > status)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", 
+                    __func__);
+            return status;
+        }
+    }
+
+    pWextState->roamProfile.AuthType.authType[0] = 
+                                pHddStaCtx->conn_info.authType = 
+                                eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+    if (params->privacy)
+    {
+        /* Security enabled IBSS, At this time there is no information available 
+         * about the security paramters, so initialise the encryption type to 
+         * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY.
+         * The correct security parameters will be updated later in 
+         * wlan_hdd_cfg80211_add_key */
+        /* Hal expects encryption type to be set inorder 
+         *enable privacy bit in beacons */
+
+        encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+    }
+
+    pHddStaCtx->conn_info.ucEncryptionType                   = encryptionType;
+    pWextState->roamProfile.EncryptionType.numEntries        = 1;
+    pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType;
+
+    return status;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_join_ibss
+ * This function is used to create/join an IBSS 
+ */
+static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, 
+                                        struct net_device *dev,
+                                        struct cfg80211_ibss_params *params
+                                       )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile          *pRoamProfile;
+    int status;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    ENTER();
+    
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+                  "%s: device_mode = %d\n",__func__,pAdapter->device_mode);
+
+    if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EAGAIN;
+    }
+
+    if (NULL == pWextState)
+    {
+        hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption\n", 
+                __func__);
+        return -EIO;
+    }
+
+    pRoamProfile = &pWextState->roamProfile;
+
+    if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType )
+    {
+        hddLog (VOS_TRACE_LEVEL_ERROR, 
+                "%s Interface type is not set to IBSS \n", __func__);
+        return -EINVAL;
+    }
+
+    /* Set Channel */
+    if (NULL != params->channel)
+    {
+        u8 channelNum;
+        if (IEEE80211_BAND_5GHZ == params->channel->band)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: IBSS join is called with unsupported band %d", 
+                    __func__, params->channel->band);
+            return -EOPNOTSUPP;
+        }
+
+        /* Get channel number */
+        channelNum = 
+               ieee80211_frequency_to_channel(params->channel->center_freq);
+
+        /*TODO: use macro*/
+        if (14 >= channelNum)
+        {
+            v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+            v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+            tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+            int indx;
+
+            if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST,
+                        validChan, &numChans))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", 
+                        __func__);
+                return -EOPNOTSUPP;
+            }
+
+            for (indx = 0; indx < numChans; indx++)
+            {
+                if (channelNum == validChan[indx])
+                {
+                    break;
+                }
+            }
+            if (indx >= numChans)
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", 
+                        __func__, channelNum);
+                return -EINVAL;
+            }
+            /* Set the Operational Channel */
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, 
+                    channelNum);
+            pRoamProfile->ChannelInfo.numOfChannels = 1;
+            pHddStaCtx->conn_info.operationChannel = channelNum;
+            pRoamProfile->ChannelInfo.ChannelList = 
+                &pHddStaCtx->conn_info.operationChannel;
+        }
+        else
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %hu", 
+                    __func__, channelNum);
+            return -EINVAL;
+        }
+    }
+
+    /* Initialize security parameters */
+    status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); 
+    if (status < 0)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", 
+                __func__);
+        return status;
+    }
+
+    /* Issue connect start */
+    status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, 
+            params->ssid_len, params->bssid);
+
+    if (0 > status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__);
+        return status;
+    }
+
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_leave_ibss
+ * This function is used to leave an IBSS 
+ */
+static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, 
+                                         struct net_device *dev
+                                         )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile;
+
+    ENTER();
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",__func__,pAdapter->device_mode);
+    if (NULL == pWextState)
+    {
+        hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption\n", 
+                __func__);
+        return -EIO;
+    }
+
+    pRoamProfile = &pWextState->roamProfile;
+
+    /* Issue disconnect only if interface type is set to IBSS */
+    if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType)
+    {
+        hddLog (VOS_TRACE_LEVEL_ERROR, "%s: BSS Type is not set to IBSS", 
+                __func__);
+        return -EINVAL;
+    }
+
+    /* Issue Disconnect request */
+    INIT_COMPLETION(pAdapter->disconnect_comp_var);
+    sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,
+                                  eCSR_DISCONNECT_REASON_IBSS_LEAVE);
+
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_wiphy_params
+ * This function is used to set the phy parameters
+ * (RTS Threshold/FRAG Threshold/Retry Count etc ...)
+ */
+static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, 
+        u32 changed)
+{
+    hdd_context_t *pHddCtx = wiphy_priv(wiphy);
+    tHalHandle hHal = pHddCtx->hHal;
+
+    ENTER();
+
+    if (changed & WIPHY_PARAM_RTS_THRESHOLD)
+    {
+        u16 rts_threshold = (wiphy->rts_threshold == -1) ?
+                               WNI_CFG_RTS_THRESHOLD_STAMAX :
+                               wiphy->rts_threshold;
+
+        if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) ||
+                (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) 
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: Invalid RTS Threshold value %hu", 
+                    __func__, rts_threshold);
+            return -EINVAL;
+        }
+
+        if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD,
+                    rts_threshold, ccmCfgSetCallback,
+                    eANI_BOOLEAN_TRUE)) 
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: ccmCfgSetInt failed for rts_threshold value %hu", 
+                    __func__, rts_threshold);
+            return -EIO;
+        }
+
+        hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, 
+                rts_threshold);
+    }
+
+    if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
+    {
+        u16 frag_threshold = (wiphy->frag_threshold == -1) ?
+                                WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX :
+                                wiphy->frag_threshold;
+
+        if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)||
+                (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) 
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: Invalid frag_threshold value %hu", __func__, 
+                    frag_threshold);
+            return -EINVAL;
+        }
+
+        if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD,
+                    frag_threshold, ccmCfgSetCallback,
+                    eANI_BOOLEAN_TRUE)) 
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, 
+                    "%s: ccmCfgSetInt failed for frag_threshold value %hu", 
+                    __func__, frag_threshold);
+            return -EIO;
+        }
+
+        hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__,
+                frag_threshold);
+    }
+
+    if ((changed & WIPHY_PARAM_RETRY_SHORT)
+            || (changed & WIPHY_PARAM_RETRY_LONG))
+    {
+        u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ?
+                         wiphy->retry_short :
+                         wiphy->retry_long;
+
+        if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) ||
+                (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value))
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", 
+                    __func__, retry_value);
+            return -EINVAL;
+        }
+
+        if (changed & WIPHY_PARAM_RETRY_SHORT)
+        {
+            if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT,
+                        retry_value, ccmCfgSetCallback,
+                        eANI_BOOLEAN_TRUE)) 
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, 
+                        "%s: ccmCfgSetInt failed for long retry count %hu", 
+                        __func__, retry_value);
+                return -EIO;
+            }
+            hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", 
+                    __func__, retry_value);
+        }
+        else if (changed & WIPHY_PARAM_RETRY_SHORT)
+        {
+            if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT,
+                        retry_value, ccmCfgSetCallback,
+                        eANI_BOOLEAN_TRUE)) 
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, 
+                        "%s: ccmCfgSetInt failed for short retry count %hu", 
+                        __func__, retry_value);
+                return -EIO;
+            }
+            hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", 
+                    __func__, retry_value);
+        }
+    }
+
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_set_txpower
+ * This function is used to set the txpower
+ */
+static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35)
+        enum tx_power_setting type, 
+#else
+        enum nl80211_tx_power_setting type, 
+#endif
+        int dbm)
+{
+    hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+    tHalHandle hHal = pHddCtx->hHal;
+    tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+    tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+
+    ENTER();
+
+    if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, 
+                dbm, ccmCfgSetCallback, 
+                eANI_BOOLEAN_TRUE)) 
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm);
+        return -EIO;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__,
+            dbm);
+
+    switch(type)
+    {
+    case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/
+       /* Fall through */
+    case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/
+       if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS )
+       {
+          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", 
+                 __func__); 
+          return -EIO;          
+       }
+       break;
+    case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", 
+              __func__);
+       return -EOPNOTSUPP;
+       break;
+    default:
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", 
+              __func__, type); 
+       return -EIO;
+    }
+
+    return 0;
+}
+
+/*
+ * FUNCTION: wlan_hdd_cfg80211_get_txpower
+ * This function is used to read the txpower
+ */
+static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
+{
+
+    hdd_adapter_t *pAdapter;
+    hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+
+    if (NULL == pHddCtx)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+        *dbm = 0;
+        return -ENOENT;
+    }
+
+    pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+    if (NULL == pAdapter)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__);
+        return -ENOENT;
+    }
+
+    wlan_hdd_get_classAstats(pAdapter);
+    *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
+
+    return 0;
+}
+
+static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
+                                   u8* mac, struct station_info *sinfo)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length;
+    tANI_U8 rate_flags;
+
+    hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+    hdd_config_t  *pCfg    = pHddCtx->cfg_ini;
+    tHalHandle hHal        = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+    tANI_U8  OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX];
+    tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX;
+    tANI_U8  ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX];
+    tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX;
+    tANI_U8  MCSRates[SIZE_OF_BASIC_MCS_SET];
+    tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET;
+    tANI_U16 maxRate = 0;
+    tANI_U16 myRate;
+    tANI_U16 currentRate = 0;
+    tANI_U8  maxSpeedMCS = 0;
+    tANI_U8  maxMCSIdx = 0;
+    tANI_U8  rateFlag = 1;
+    tANI_U8  i, j, rssidx;
+
+    if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
+            (0 == ssidlen))
+    {
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or"
+                    " Invalid ssidlen, %d", __func__, ssidlen);
+        /*To keep GUI happy*/
+        return 0;
+    }
+
+    wlan_hdd_get_rssi(pAdapter, &sinfo->signal);
+    sinfo->filled |= STATION_INFO_SIGNAL;
+
+    wlan_hdd_get_classAstats(pAdapter);
+    rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags;
+
+    //convert to the UI units of 100kbps
+    myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5;
+
+#ifdef LINKSPEED_DEBUG_ENABLED
+    pr_info("RSSI %d, RLMS %u, rate %d, rssi high %d, rssi low %d\n",
+            sinfo->signal,
+            pCfg->reportMaxLinkSpeed,
+            myRate,
+            (int) pCfg->linkSpeedRssiHigh,
+            (int) pCfg->linkSpeedRssiLow);
+#endif //LINKSPEED_DEBUG_ENABLED
+
+    if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed)
+    {
+        // we do not want to necessarily report the current speed
+        if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed)
+        {
+            // report the max possible speed
+            rssidx = 0;
+        }
+        else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed)
+        {
+            // report the max possible speed with RSSI scaling
+            if (sinfo->signal >= pCfg->linkSpeedRssiHigh)
+            {
+                // report the max possible speed
+                rssidx = 0;
+            }
+            else if (sinfo->signal >= pCfg->linkSpeedRssiLow)
+            {
+                // report middle speed
+                rssidx = 1;
+            }
+            else
+            {
+                // report actual speed
+                rssidx = 2;
+            }
+        }
+        else
+        {
+            // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX
+            hddLog(VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid value for reportMaxLinkSpeed: %u",
+                    __func__, pCfg->reportMaxLinkSpeed);
+            rssidx = 0;
+        }
+
+        maxRate = 0;
+
+        /* Get Basic Rate Set */
+        ccmCfgGetStr(hHal, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, &ORLeng);
+        for (i = 0; i < ORLeng; i++)
+        {
+            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            {
+                /* Validate Rate Set */
+                if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F))
+                {
+                    currentRate = supported_data_rate[j].supported_rate[rssidx];
+                    break;
+                }
+            }
+            /* Update MAX rate */
+            maxRate = (currentRate > maxRate)?currentRate:maxRate;
+        }
+
+        /* Get Extended Rate Set */
+        ccmCfgGetStr(hHal, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedRates, &ERLeng);
+        for (i = 0; i < ERLeng; i++)
+        {
+            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            {
+                if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F))
+                {
+                    currentRate = supported_data_rate[j].supported_rate[rssidx];
+                    break;
+                }
+            }
+            /* Update MAX rate */
+            maxRate = (currentRate > maxRate)?currentRate:maxRate;
+        }
+
+        /* Get MCS Rate Set -- but only if we are connected at MCS
+           rates or if we are always reporting max speed or if we have
+           good rssi */
+        if ((0 == rssidx) || !(rate_flags & eHAL_TX_RATE_LEGACY))
+        {
+            ccmCfgGetStr(hHal, WNI_CFG_CURRENT_MCS_SET, MCSRates, &MCSLeng);
+            rateFlag = 0;
+            if (rate_flags & eHAL_TX_RATE_HT40)
+            {
+                rateFlag |= 1;
+            }
+            if (rate_flags & eHAL_TX_RATE_SGI)
+            {
+                rateFlag |= 2;
+            }
+
+            for (i = 0; i < MCSLeng; i++)
+            {
+                for (j = 0; j < sizeof(supported_mcs_rate); j++)
+                {
+                    if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i])
+                    {
+                        currentRate = supported_mcs_rate[j].supported_rate[rateFlag];
+                        break;
+                    }
+                }
+                if (currentRate > maxRate)
+                {
+                    maxRate     = currentRate;
+                    maxSpeedMCS = 1;
+                    maxMCSIdx   = supported_mcs_rate[j].beacon_rate_index;
+                }
+            }
+        }
+
+        // make sure we report a value at least as big as our current rate
+        if (maxRate < myRate)
+        {
+           maxRate = myRate;
+           if (rate_flags & eHAL_TX_RATE_LEGACY)
+           {
+              maxSpeedMCS = 0;
+           }
+           else
+           {
+              maxSpeedMCS = 1;
+              maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index;
+           }
+        }
+
+        if (!maxSpeedMCS)
+        {
+            sinfo->txrate.legacy  = maxRate;
+#ifdef LINKSPEED_DEBUG_ENABLED
+            pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy);
+#endif //LINKSPEED_DEBUG_ENABLED
+        }
+        else
+        {
+            sinfo->txrate.mcs    = maxMCSIdx;
+            sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
+            if (rate_flags & eHAL_TX_RATE_SGI)
+            {
+                sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+            }
+            if (rate_flags & eHAL_TX_RATE_HT40)
+            {
+                sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
+            }
+#ifdef LINKSPEED_DEBUG_ENABLED
+            pr_info("Reporting MCS rate %d flags %x\n",
+                    sinfo->txrate.mcs,
+                    sinfo->txrate.flags );
+#endif //LINKSPEED_DEBUG_ENABLED
+        }
+    }
+    else
+    {
+        // report current rate instead of max rate
+
+        if (rate_flags & eHAL_TX_RATE_LEGACY)
+        {
+            //provide to the UI in units of 100kbps
+            sinfo->txrate.legacy = myRate;
+#ifdef LINKSPEED_DEBUG_ENABLED
+            pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy);
+#endif //LINKSPEED_DEBUG_ENABLED
+        }
+        else
+        {
+            //must be MCS
+            sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index;
+            sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
+            if (rate_flags & eHAL_TX_RATE_SGI)
+            {
+                sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+            }
+            if (rate_flags & eHAL_TX_RATE_HT40)
+            {
+                sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
+            }
+#ifdef LINKSPEED_DEBUG_ENABLED
+            pr_info("Reporting actual MCS rate %d flags %x\n",
+                    sinfo->txrate.mcs,
+                    sinfo->txrate.flags );
+#endif //LINKSPEED_DEBUG_ENABLED
+        }
+    }
+    sinfo->filled |= STATION_INFO_TX_BITRATE;
+
+    return 0;
+}
+
+static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
+                     struct net_device *dev, bool mode, v_SINT_t timeout)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    VOS_STATUS vos_status;
+
+    if (NULL == pAdapter)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__);
+        return -ENODEV;
+    }
+
+    /**The get power cmd from the supplicant gets updated by the nl only
+     *on successful execution of the function call
+     *we are oppositely mapped w.r.t mode in the driver
+     **/
+    vos_status =  wlan_hdd_enter_bmps(pAdapter, !mode);
+
+    if (VOS_STATUS_E_FAILURE == vos_status)
+    {
+        return -EINVAL;
+    }
+    return 0;
+}
+
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
+                         struct net_device *netdev,
+                         u8 key_index)
+{
+    return 0;
+}
+#endif //LINUX_VERSION_CODE 
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
+                   struct net_device *dev,
+                   struct ieee80211_txq_params *params)
+{
+    return 0;
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
+                   struct ieee80211_txq_params *params)
+{
+    return 0;
+}
+#endif //LINUX_VERSION_CODE
+
+static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
+                                         struct net_device *dev, u8 *mac)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+    if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
+        return -EINVAL;
+    }
+
+    if (((hdd_context_t*)pAdapter->pHddCtx)->isLoadUnloadInProgress)
+    {
+         hddLog( LOGE,
+                 "%s: Wlan Load/Unload is in progress", __func__);
+         return -EBUSY;
+    }
+
+    if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode)
+#ifdef WLAN_FEATURE_P2P
+       || (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+#endif
+       )
+    {
+        if( NULL == mac )
+        {
+            v_U16_t i;
+            for(i = 0; i < WLAN_MAX_STA_COUNT; i++)
+            {
+                if(pAdapter->aStaInfo[i].isUsed)
+                {
+                    u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes;
+                    hddLog(VOS_TRACE_LEVEL_INFO,
+                                        "%s: Delete STA with MAC::"
+                                        "%02x:%02x:%02x:%02x:%02x:%02x",
+                                        __func__,
+                                        macAddr[0], macAddr[1], macAddr[2],
+                                        macAddr[3], macAddr[4], macAddr[5]);
+                    hdd_softap_sta_deauth(pAdapter, macAddr);
+                }
+            }
+        }
+        else
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                                "%s: Delete STA with MAC::"
+                                "%02x:%02x:%02x:%02x:%02x:%02x",
+                                __func__,
+                                mac[0], mac[1], mac[2],
+                                mac[3], mac[4], mac[5]);
+            hdd_softap_sta_deauth(pAdapter, mac);
+        }
+    }
+
+    EXIT();
+
+    return 0;
+}
+
+static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy,
+          struct net_device *dev, u8 *mac, struct station_parameters *params)
+{
+    // TODO: Implement this later.
+    return 0;
+}
+
+/* cfg80211_ops */
+static struct cfg80211_ops wlan_hdd_cfg80211_ops = 
+{
+    .add_virtual_intf = wlan_hdd_add_virtual_intf,
+    .del_virtual_intf = wlan_hdd_del_virtual_intf,
+    .change_virtual_intf = wlan_hdd_cfg80211_change_iface,
+    .change_station = wlan_hdd_change_station,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+    .add_beacon = wlan_hdd_cfg80211_add_beacon,
+    .del_beacon = wlan_hdd_cfg80211_del_beacon,
+    .set_beacon = wlan_hdd_cfg80211_set_beacon,
+#endif
+    .change_bss = wlan_hdd_cfg80211_change_bss,
+    .add_key = wlan_hdd_cfg80211_add_key,
+    .get_key = wlan_hdd_cfg80211_get_key,
+    .del_key = wlan_hdd_cfg80211_del_key,
+    .set_default_key = wlan_hdd_cfg80211_set_default_key,
+    .set_channel = wlan_hdd_cfg80211_set_channel,
+    .scan = wlan_hdd_cfg80211_scan,
+    .connect = wlan_hdd_cfg80211_connect,
+    .disconnect = wlan_hdd_cfg80211_disconnect,
+    .join_ibss  = wlan_hdd_cfg80211_join_ibss,
+    .leave_ibss = wlan_hdd_cfg80211_leave_ibss,
+    .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params,
+    .set_tx_power = wlan_hdd_cfg80211_set_txpower,
+    .get_tx_power = wlan_hdd_cfg80211_get_txpower,
+#ifdef WLAN_FEATURE_P2P
+    .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel,
+    .cancel_remain_on_channel =  wlan_hdd_cfg80211_cancel_remain_on_channel,
+    .mgmt_tx =  wlan_hdd_action,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+     .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait,
+     .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key,
+     .set_txq_params = wlan_hdd_set_txq_params,
+#endif
+#endif
+     .get_station = wlan_hdd_cfg80211_get_station,
+     .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt,
+     .del_station  = wlan_hdd_cfg80211_del_station,
+     .add_station  = wlan_hdd_cfg80211_add_station
+};
+
+#endif // CONFIG_CFG80211
diff --git a/CORE/HDD/src/wlan_hdd_dev_pwr.c b/CORE/HDD/src/wlan_hdd_dev_pwr.c
new file mode 100644
index 0000000..db68ac9
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_dev_pwr.c
@@ -0,0 +1,545 @@
+/*
+ * 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.
+ */
+
+/**========================================================================= 
+
+                       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 
+  --------    ---    --------------------------------------------------------
+  03/29/11    tbh    Created module. 
+
+  ==========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include <wlan_hdd_dev_pwr.h>
+#ifdef ANI_BUS_TYPE_PLATFORM
+#include <linux/wcnss_wlan.h>
+#else
+#include <wcnss_wlan.h>
+#endif // ANI_BUS_TYP_PLATFORM
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------
+ * Global variables.
+ *-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+ * Local variables.
+ *-------------------------------------------------------------------------*/
+/* Reference VoIP, 100msec delay make disconnect.
+ * So TX sleep must be less than 100msec
+ * Every 20msec TX frame will goes out.
+ * 10 frame means 2seconds TX operation */
+static const hdd_tmLevelAction_t thermalMigrationAction[WLAN_HDD_TM_LEVEL_MAX] =
+{
+   /* TM Level 0, Do nothing, just normal operaton */
+   {1, 0, 0, 0, 0xFFFFF},
+   /* Tm Level 1, disable TX AMPDU */
+   {0, 0, 0, 0, 0xFFFFF},
+   /* TM Level 2, disable AMDPU,
+    * TX sleep 100msec if TX frame count is larger than 16 during 300msec */
+   {0, 0, 100, 300, 16},
+   /* TM Level 3, disable AMDPU,
+    * TX sleep 500msec if TX frame count is larger than 11 during 500msec */
+   {0, 0, 500, 500, 11},
+   /* TM Level 4, MAX TM level, enter IMPS */
+   {0, 1, 1000, 500, 10}
+};
+
+
+/*----------------------------------------------------------------------------
+
+   @brief Function to suspend the wlan driver.
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+
+   @return None
+
+----------------------------------------------------------------------------*/
+static int wlan_suspend(hdd_context_t* pHddCtx)
+{
+   int rc = 0;
+
+   pVosSchedContext vosSchedContext = NULL;
+
+   /* Get the global VOSS context */
+   vosSchedContext = get_vos_sched_ctxt();
+
+   if(!vosSchedContext) {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: Global VOS_SCHED context is Null",__func__);
+      return 0;
+   }
+   if(!vos_is_apps_power_collapse_allowed(pHddCtx))
+   {
+       /* Fail this suspend */
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Fail wlan suspend: not in IMPS/BMPS", __func__);
+       return -1;
+   }
+
+   /* Set the Station state as Suspended */
+   pHddCtx->isWlanSuspended = TRUE;
+
+   /*
+     Suspending MC Thread, Rx Thread and Tx Thread as the platform driver is going to Suspend.     
+   */
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Suspending Mc, Rx and Tx Threads",__func__);
+
+   init_completion(&pHddCtx->tx_sus_event_var);
+
+   /* Indicate Tx Thread to Suspend */
+   set_bit(TX_SUSPEND_EVENT_MASK, &vosSchedContext->txEventFlag);
+
+   wake_up_interruptible(&vosSchedContext->txWaitQueue);
+
+   /* Wait for Suspend Confirmation from Tx Thread */
+   rc = wait_for_completion_interruptible_timeout(&pHddCtx->tx_sus_event_var, msecs_to_jiffies(200));
+
+   if(!rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: Not able to suspend TX thread timeout happened", __func__);
+      clear_bit(TX_SUSPEND_EVENT_MASK, &vosSchedContext->txEventFlag);
+
+      return -1;
+   }
+   /* Set the Tx Thread as Suspended */
+   pHddCtx->isTxThreadSuspended = TRUE;
+
+   init_completion(&pHddCtx->rx_sus_event_var);
+
+   /* Indicate Rx Thread to Suspend */
+   set_bit(RX_SUSPEND_EVENT_MASK, &vosSchedContext->rxEventFlag);
+
+   wake_up_interruptible(&vosSchedContext->rxWaitQueue);
+
+   /* Wait for Suspend Confirmation from Rx Thread */
+   rc = wait_for_completion_interruptible_timeout(&pHddCtx->rx_sus_event_var, msecs_to_jiffies(200));
+
+   if(!rc)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: Not able to suspend Rx thread timeout happened", __func__);
+
+       clear_bit(RX_SUSPEND_EVENT_MASK, &vosSchedContext->rxEventFlag);
+
+       /* Indicate Tx Thread to Resume */
+       complete(&vosSchedContext->ResumeTxEvent);
+
+       /* Set the Tx Thread as Resumed */
+       pHddCtx->isTxThreadSuspended = FALSE;
+
+       return -1;
+   }
+
+   /* Set the Rx Thread as Suspended */
+   pHddCtx->isRxThreadSuspended = TRUE;
+
+   init_completion(&pHddCtx->mc_sus_event_var);
+
+   /* Indicate MC Thread to Suspend */
+   set_bit(MC_SUSPEND_EVENT_MASK, &vosSchedContext->mcEventFlag);
+
+   wake_up_interruptible(&vosSchedContext->mcWaitQueue);
+
+   /* Wait for Suspend Confirmation from MC Thread */
+   rc = wait_for_completion_interruptible_timeout(&pHddCtx->mc_sus_event_var, msecs_to_jiffies(200));
+
+   if(!rc)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: Not able to suspend MC thread timeout happened", __func__);
+
+       clear_bit(MC_SUSPEND_EVENT_MASK, &vosSchedContext->mcEventFlag);
+
+       /* Indicate Rx Thread to Resume */
+       complete(&vosSchedContext->ResumeRxEvent);
+
+       /* Set the Rx Thread as Resumed */
+       pHddCtx->isRxThreadSuspended = FALSE;
+
+       /* Indicate Tx Thread to Resume */
+       complete(&vosSchedContext->ResumeTxEvent);
+
+       /* Set the Tx Thread as Resumed */
+       pHddCtx->isTxThreadSuspended = FALSE;
+
+       return -1;
+   }
+
+   /* Set the Mc Thread as Suspended */
+   pHddCtx->isMcThreadSuspended = TRUE;
+   
+   /* Set the Station state as Suspended */
+   pHddCtx->isWlanSuspended = TRUE;
+
+   return 0;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief Function to resume the wlan driver.
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+
+   @return None
+
+----------------------------------------------------------------------------*/
+static void wlan_resume(hdd_context_t* pHddCtx)
+{
+   pVosSchedContext vosSchedContext = NULL;
+
+   //Get the global VOSS context.
+   vosSchedContext = get_vos_sched_ctxt();
+
+   if(!vosSchedContext) {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: Global VOS_SCHED context is Null",__func__);
+      return;
+   }
+
+   /*
+     Resuming Mc, Rx and Tx Thread as platform Driver is resuming.
+   */
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Resuming Mc, Rx and Tx Thread",__func__);
+
+   /* Indicate MC Thread to Resume */
+   complete(&vosSchedContext->ResumeMcEvent);
+
+   /* Set the Mc Thread as Resumed */
+   pHddCtx->isMcThreadSuspended = FALSE;
+
+   /* Indicate Rx Thread to Resume */
+   complete(&vosSchedContext->ResumeRxEvent);
+
+   /* Set the Rx Thread as Resumed */
+   pHddCtx->isRxThreadSuspended = FALSE;
+
+   /* Indicate Tx Thread to Resume */
+   complete(&vosSchedContext->ResumeTxEvent);
+
+   /* Set the Tx Thread as Resumed */
+   pHddCtx->isTxThreadSuspended = FALSE;
+
+   /* Set the Station state as Suspended */
+   pHddCtx->isWlanSuspended = FALSE;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief Function to suspend the wlan driver.
+   This function will get called by platform driver Suspend on System Suspend
+
+   @param dev    platform_func_device
+
+
+   @return None
+
+----------------------------------------------------------------------------*/
+int hddDevSuspendHdlr(struct device *dev)
+{
+   int ret = 0;
+   hdd_context_t* pHddCtx = NULL;
+
+   pHddCtx =  (hdd_context_t*)wcnss_wlan_get_drvdata(dev);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: WLAN suspended by platform driver",__func__);
+
+   /* Get the HDD context */
+   if(!pHddCtx) {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return 0;
+   }
+
+   if(pHddCtx->isWlanSuspended == TRUE)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: WLAN is already in suspended state",__func__);
+      return 0;
+   }
+
+   /* Suspend the wlan driver */
+   ret = wlan_suspend(pHddCtx);
+   if(ret != 0)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: Not able to suspend wlan",__func__);
+      return ret;
+   }
+
+   return 0;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief Function to resume the wlan driver.
+   This function will get called by platform driver Resume on System Resume 
+
+   @param dev    platform_func_device
+
+
+   @return None
+
+----------------------------------------------------------------------------*/
+int hddDevResumeHdlr(struct device *dev)
+{
+   hdd_context_t* pHddCtx = NULL;
+
+   pHddCtx =  (hdd_context_t*)wcnss_wlan_get_drvdata(dev);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed by Android OS",__func__);
+
+   if(pHddCtx->isWlanSuspended != TRUE)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: WLAN is already in resumed state",__func__);
+      return 0;
+   }
+
+   /* Resume the wlan driver */
+   wlan_resume(pHddCtx);
+
+   return 0;
+}
+
+static const struct dev_pm_ops pm_ops = {
+   .suspend = hddDevSuspendHdlr,
+   .resume = hddDevResumeHdlr,
+};
+
+/*----------------------------------------------------------------------------
+ *
+
+   @brief Registration function.
+        Register suspend, resume callback functions with platform driver. 
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Registration Success
+        VOS_STATUS_E_FAILURE     Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddRegisterPmOps(hdd_context_t *pHddCtx)
+{
+    wcnss_wlan_set_drvdata(pHddCtx->parent_dev, pHddCtx);
+#ifndef FEATURE_R33D
+    wcnss_wlan_register_pm_ops(pHddCtx->parent_dev, &pm_ops);
+#endif /* FEATURE_R33D */
+    return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief De-registration function.
+        Deregister the suspend, resume callback functions with platform driver
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       De-Registration Success
+        VOS_STATUS_E_FAILURE     De-Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDeregisterPmOps(hdd_context_t *pHddCtx)
+{
+#ifndef FEATURE_R33D
+    wcnss_wlan_unregister_pm_ops(pHddCtx->parent_dev, &pm_ops);
+#endif /* FEATURE_R33D */
+    return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief TX frame block timeout handler
+          Resume TX, and reset TX frame count
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return NONE
+
+----------------------------------------------------------------------------*/
+void hddDevTmTxBlockTimeoutHandler(void *usrData)
+{
+   hdd_context_t        *pHddCtx = (hdd_context_t *)usrData;
+   hdd_adapter_t        *staAdapater;
+   /* Sanity, This should not happen */
+   if(NULL == pHddCtx)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL Context", __func__);
+      VOS_ASSERT(0);
+      return;
+   }
+
+   staAdapater = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+   if(mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
+                "%s: Aquire lock fail", __func__);
+      return;
+   }
+   pHddCtx->tmInfo.txFrameCount = 0;
+
+   /* Resume TX flow */
+   netif_tx_start_all_queues(staAdapater->dev);
+   mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
+
+   return;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief TM Level Change handler
+          Received Tm Level changed notification
+
+   @param dev : Device context
+          changedTmLevel : Changed new TM level
+
+   @return 
+
+----------------------------------------------------------------------------*/
+void hddDevTmLevelChangedHandler(struct device *dev, int changedTmLevel)
+{
+   hdd_context_t        *pHddCtx = NULL;
+   WLAN_TmLevelEnumType  newTmLevel = changedTmLevel;
+   hdd_adapter_t        *staAdapater;
+
+   pHddCtx =  (hdd_context_t*)wcnss_wlan_get_drvdata(dev);
+
+   if((pHddCtx->tmInfo.currentTmLevel == newTmLevel) ||
+      (!pHddCtx->cfg_ini->thermalMitigationEnable))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_WARN,
+                "%s: TM Not enabled %d or Level does not changed %d",
+                __func__, pHddCtx->cfg_ini->thermalMitigationEnable, newTmLevel);
+      /* TM Level does not changed,
+       * Or feature does not enabled
+       * do nothing */
+      return;
+   }
+
+   sme_SetTmLevel(pHddCtx->hHal, changedTmLevel, 0);
+
+   if(mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
+                "%s: Aquire lock fail", __func__);
+      return;
+   }
+
+   pHddCtx->tmInfo.currentTmLevel = changedTmLevel;
+   pHddCtx->tmInfo.txFrameCount = 0;
+   vos_mem_copy(&pHddCtx->tmInfo.tmAction,
+                &thermalMigrationAction[newTmLevel],
+                sizeof(hdd_tmLevelAction_t));
+
+
+   if(pHddCtx->tmInfo.tmAction.enterImps)
+   {
+      staAdapater = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+      if(staAdapater)
+      {
+         if(hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(staAdapater)))
+         {
+            sme_RoamDisconnect(pHddCtx->hHal,
+                               staAdapater->sessionId, 
+                               eCSR_DISCONNECT_REASON_UNSPECIFIED);
+         }
+      }
+   }
+
+   mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
+
+   return;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief Register function
+        Register Thermal Mitigation Level Changed handle callback function
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Registration Success
+        VOS_STATUS_E_FAILURE     Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDevTmRegisterNotifyCallback(hdd_context_t *pHddCtx)
+{
+   VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO,
+             "%s: Register TM Handler", __func__);
+
+   wcnss_register_thermal_mitigation(pHddCtx->parent_dev ,hddDevTmLevelChangedHandler);
+
+   /* Set Default TM Level as Lowest, do nothing */
+   pHddCtx->tmInfo.currentTmLevel = WLAN_HDD_TM_LEVEL_0;
+   vos_mem_zero(&pHddCtx->tmInfo.tmAction, sizeof(hdd_tmLevelAction_t)); 
+   vos_timer_init(&pHddCtx->tmInfo.txSleepTimer,
+                  VOS_TIMER_TYPE_SW,
+                  hddDevTmTxBlockTimeoutHandler,
+                  (void *)pHddCtx);
+   mutex_init(&pHddCtx->tmInfo.tmOperationLock);
+   pHddCtx->tmInfo.txFrameCount = 0;
+   pHddCtx->tmInfo.blockedQueue = NULL;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+   @brief Un-Register function
+        Un-Register Thermal Mitigation Level Changed handle callback function
+
+   @param hdd_context_t pHddCtx
+        Global hdd context
+
+   @return General status code
+        VOS_STATUS_SUCCESS       Un-Registration Success
+        VOS_STATUS_E_FAILURE     Un-Registration Fail
+
+----------------------------------------------------------------------------*/
+VOS_STATUS hddDevTmUnregisterNotifyCallback(hdd_context_t *pHddCtx)
+{
+   wcnss_unregister_thermal_mitigation(hddDevTmLevelChangedHandler);
+   return VOS_STATUS_SUCCESS;
+}
+
diff --git a/CORE/HDD/src/wlan_hdd_dp_utils.c b/CORE/HDD/src/wlan_hdd_dp_utils.c
new file mode 100644
index 0000000..c7ee744
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_dp_utils.c
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+/**=============================================================================
+  wlan_hdd_dp_utils.c
+  
+  \brief      Utility functions for data path module
+  
+  Description...
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  
+  ==============================================================================**/
+/* $HEADER$ */
+  
+/**-----------------------------------------------------------------------------
+  Include files
+  ----------------------------------------------------------------------------*/
+#include <wlan_hdd_dp_utils.h>
+
+/**-----------------------------------------------------------------------------
+  Preprocessor definitions and constants
+ ----------------------------------------------------------------------------*/
+  
+/**-----------------------------------------------------------------------------
+  Type declarations
+ ----------------------------------------------------------------------------*/
+  
+/**-----------------------------------------------------------------------------
+  Function declarations and documenation
+ ----------------------------------------------------------------------------*/
+
+
+VOS_STATUS hdd_list_insert_front( hdd_list_t *pList, hdd_list_node_t *pNode )
+{
+   list_add( pNode, &pList->anchor );
+   pList->count++;
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_insert_back( hdd_list_t *pList, hdd_list_node_t *pNode )
+{
+   list_add_tail( pNode, &pList->anchor );
+   pList->count++;
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_insert_back_size( hdd_list_t *pList, hdd_list_node_t *pNode, v_SIZE_t *pSize )
+{
+   list_add_tail( pNode, &pList->anchor );
+   pList->count++;
+   *pSize = pList->count;
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_remove_front( hdd_list_t *pList, hdd_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+
+   if ( list_empty( &pList->anchor ) )
+   {
+      return VOS_STATUS_E_EMPTY;
+   }
+         
+   listptr = pList->anchor.next;
+   *ppNode = listptr;
+   list_del(pList->anchor.next);
+   pList->count--;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_remove_back( hdd_list_t *pList, hdd_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+
+   if ( list_empty( &pList->anchor ) )
+   {
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   listptr = pList->anchor.prev;
+   *ppNode = listptr;
+   list_del(pList->anchor.prev);
+   pList->count--;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_remove_node( hdd_list_t *pList,
+                                 hdd_list_node_t *pNodeToRemove )
+{
+   hdd_list_node_t *tmp;
+   int found = 0;
+
+   if ( list_empty( &pList->anchor ) )
+   {
+      return VOS_STATUS_E_EMPTY;
+   }
+
+    // verify that pNodeToRemove is indeed part of list pList
+   list_for_each(tmp, &pList->anchor) 
+   {
+     if (tmp == pNodeToRemove)
+     {
+        found = 1;
+        break;
+     }
+   }
+   if (found == 0)
+       return VOS_STATUS_E_INVAL;
+
+   list_del(pNodeToRemove); 
+   pList->count--;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_peek_front( hdd_list_t *pList,
+                                hdd_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   if ( list_empty( &pList->anchor ) )
+   {
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   listptr = pList->anchor.next;
+   *ppNode = listptr;
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_list_peek_next( hdd_list_t *pList, hdd_list_node_t *pNode,
+                               hdd_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int found = 0;
+   hdd_list_node_t *tmp;
+      
+   if ( ( pList == NULL) || ( pNode == NULL) || (ppNode == NULL))
+   {
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+       return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNode is indeed part of list pList
+   list_for_each(tmp, &pList->anchor) 
+   {
+     if (tmp == pNode)
+     {
+        found = 1;
+        break;
+     }
+   }
+
+   if (found == 0)
+   {
+      return VOS_STATUS_E_INVAL;
+   }
+
+   listptr = pNode->next;
+   if (listptr == &pList->anchor)
+   {
+       return VOS_STATUS_E_EMPTY;
+   }
+
+   *ppNode =  listptr;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_string_to_hex( char *pSrcMac, int length, char *pDescMac )
+{
+   int i;
+   int k;
+   char temp[3] = {0};
+
+   //18 is MAC Address length plus the colons
+   if ( !pSrcMac && (length > 18 || length < 18) )
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+   i = k = 0;
+   while ( i < length )
+   {
+       memcpy(temp, pSrcMac+i, 2);
+       pDescMac[k++] = (char)simple_strtoul (temp, NULL, 16);
+       i += 3;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
new file mode 100644
index 0000000..762aa59
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -0,0 +1,2211 @@
+/*
+ * 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.
+ */
+
+/**=============================================================================
+*     wlan_hdd_early_suspend.c
+*
+*     \brief      power management functions
+*
+*     Description
+*                 Copyright 2009 (c) Qualcomm, Incorporated.
+*                 All Rights Reserved.
+*                 Qualcomm Confidential and Proprietary.
+*
+==============================================================================**/
+/* $HEADER$ */
+
+/**-----------------------------------------------------------------------------
+*   Include files
+* ----------------------------------------------------------------------------*/
+#ifdef CONFIG_HAS_EARLYSUSPEND
+
+#include <linux/pm.h>
+#include <linux/wait.h>
+#include <linux/earlysuspend.h>
+#include <linux/wcnss_wlan.h>
+#include <wlan_hdd_includes.h>
+#include <wlan_qct_driver.h>
+#include <linux/wakelock.h>
+#endif
+
+#include "halTypes.h"
+#include "sme_Api.h"
+#include <vos_api.h>
+#include "vos_power.h"
+#include <vos_sched.h>
+#include <macInitApi.h>
+#ifdef ANI_BUS_TYPE_SDIO
+#include <wlan_qct_sal.h>
+#include <wlan_qct_bal.h>
+#endif
+#include <wlan_qct_sys.h>
+#include <wlan_btc_svc.h>
+#include <wlan_nlink_common.h>
+#include <wlan_hdd_main.h>
+#include <wlan_hdd_assoc.h>
+#include <wlan_hdd_dev_pwr.h>
+#ifdef ANI_BUS_TYPE_SDIO
+#include <wlan_sal_misc.h>
+#include <libra_sdioif.h>
+#endif
+#include <wlan_nlink_srv.h>
+#include <wlan_hdd_misc.h>
+
+#ifdef WLAN_SOFTAP_FEATURE
+#include <linux/semaphore.h>
+#include <wlan_hdd_hostapd.h>
+#endif
+#include "cfgApi.h"
+
+#ifdef WLAN_BTAMP_FEATURE
+#include "bapApi.h"
+#include "bap_hdd_main.h"
+#include "bap_hdd_misc.h"
+#endif
+
+#include <linux/inetdevice.h>
+#include <wlan_hdd_cfg.h>
+/**-----------------------------------------------------------------------------
+*   Preprocessor definitions and constants
+* ----------------------------------------------------------------------------*/
+
+/**-----------------------------------------------------------------------------
+*   Type declarations
+* ----------------------------------------------------------------------------*/
+
+/**-----------------------------------------------------------------------------
+*   Function and variables declarations
+* ----------------------------------------------------------------------------*/
+#include "wlan_hdd_power.h"
+#include "wlan_hdd_packet_filtering.h"
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static struct early_suspend wlan_early_suspend;
+#endif
+
+static eHalStatus g_full_pwr_status;
+static eHalStatus g_standby_status;
+
+extern VOS_STATUS hdd_post_voss_start_config(hdd_context_t* pHddCtx);
+extern VOS_STATUS vos_chipExitDeepSleepVREGHandler(
+   vos_call_status_type* status,
+   vos_power_cb_type callback,
+   v_PVOID_t user_data);
+extern void hdd_wlan_initial_scan(hdd_context_t *pHddCtx);
+void unregister_wlan_suspend(void);
+
+extern struct notifier_block hdd_netdev_notifier;
+#ifdef WLAN_SOFTAP_FEATURE
+extern tVOS_CON_MODE hdd_get_conparam ( void );
+#endif
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+#endif
+
+//Callback invoked by PMC to report status of standby request
+void hdd_suspend_standby_cbk (void *callbackContext, eHalStatus status)
+{
+   hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext;
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Standby status = %d", __func__, status);
+   g_standby_status = status; 
+
+   if(eHAL_STATUS_SUCCESS == status)
+   {
+      pHddCtx->hdd_ps_state = eHDD_SUSPEND_STANDBY;
+   }
+   else
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed",__func__);
+   }
+
+   complete(&pHddCtx->standby_comp_var);
+}
+
+//Callback invoked by PMC to report status of full power request
+void hdd_suspend_full_pwr_callback(void *callbackContext, eHalStatus status)
+{
+   hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext;
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Full Power status = %d", __func__, status);
+   g_full_pwr_status = status;
+
+   if(eHAL_STATUS_SUCCESS == status)
+   {
+      pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE;
+   }
+   else
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__);
+   }
+
+   complete(&pHddCtx->full_pwr_comp_var);
+}
+
+eHalStatus hdd_exit_standby(hdd_context_t *pHddCtx)
+{  
+    eHalStatus status = VOS_STATUS_SUCCESS;
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed from standby",__func__);
+    INIT_COMPLETION(pHddCtx->full_pwr_comp_var);
+
+   g_full_pwr_status = eHAL_STATUS_FAILURE;
+    status = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, pHddCtx,
+      eSME_FULL_PWR_NEEDED_BY_HDD);
+
+   if(status == eHAL_STATUS_PMC_PENDING)
+   {
+      //Block on a completion variable. Can't wait forever though
+      wait_for_completion_interruptible_timeout(&pHddCtx->full_pwr_comp_var, 
+         msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR));
+      status = g_full_pwr_status;
+      if(g_full_pwr_status != eHAL_STATUS_SUCCESS)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__);
+         VOS_ASSERT(0);
+         goto failure;
+      }
+    }
+    else if(status != eHAL_STATUS_SUCCESS)
+    {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed - status %d",
+         __func__, status);
+      VOS_ASSERT(0);
+      goto failure;
+    }
+    else
+      pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE;
+
+failure:
+    //No blocking to reduce latency. No other device should be depending on WLAN
+    //to finish resume and WLAN won't be instantly on after resume
+    return status;
+}
+
+
+//Helper routine to put the chip into standby
+VOS_STATUS hdd_enter_standby(hdd_context_t *pHddCtx)
+{
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   //Disable IMPS/BMPS as we do not want the device to enter any power
+   //save mode on its own during suspend sequence
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+
+   //Note we do not disable queues unnecessarily. Queues should already be disabled
+   //if STA is disconnected or the queue will be disabled as and when disconnect
+   //happens because of standby procedure.
+   
+   //Ensure that device is in full power first. There is scope for optimization
+   //here especially in scenarios where PMC is already in IMPS or REQUEST_IMPS.
+   //Core s/w needs to be optimized to handle this. Until then we request full
+   //power before issuing request for standby.
+   INIT_COMPLETION(pHddCtx->full_pwr_comp_var);
+   g_full_pwr_status = eHAL_STATUS_FAILURE;
+   halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, 
+       pHddCtx, eSME_FULL_PWR_NEEDED_BY_HDD);
+
+   if(halStatus == eHAL_STATUS_PMC_PENDING)
+   {
+      //Block on a completion variable. Can't wait forever though
+      wait_for_completion_interruptible_timeout(&pHddCtx->full_pwr_comp_var, 
+         msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR));
+      if(g_full_pwr_status != eHAL_STATUS_SUCCESS)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower Failed",__func__);
+         VOS_ASSERT(0);
+         vosStatus = VOS_STATUS_E_FAILURE;
+         goto failure;
+      }
+   }
+   else if(halStatus != eHAL_STATUS_SUCCESS)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed - status %d",
+         __func__, halStatus);
+      VOS_ASSERT(0);
+      vosStatus = VOS_STATUS_E_FAILURE;
+      goto failure;
+   }
+
+   if(pHddCtx->hdd_mcastbcast_filter_set == TRUE) {
+         hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
+         pHddCtx->hdd_mcastbcast_filter_set = FALSE;
+   }
+
+   //Request standby. Standby will cause the STA to disassociate first. TX queues
+   //will be disabled (by HDD) when STA disconnects. You do not want to disable TX
+   //queues here. Also do not assert if the failure code is eHAL_STATUS_PMC_NOT_NOW as PMC
+   //will send this failure code in case of concurrent sessions. Power Save cannot be supported
+   //when there are concurrent sessions.
+   INIT_COMPLETION(pHddCtx->standby_comp_var);
+   g_standby_status = eHAL_STATUS_FAILURE;
+   halStatus = sme_RequestStandby(pHddCtx->hHal, hdd_suspend_standby_cbk, pHddCtx);
+
+   if (halStatus == eHAL_STATUS_PMC_PENDING) 
+   {
+      //Wait till WLAN device enters standby mode
+      wait_for_completion_timeout(&pHddCtx->standby_comp_var, 
+         msecs_to_jiffies(WLAN_WAIT_TIME_STANDBY));
+      if (g_standby_status != eHAL_STATUS_SUCCESS && g_standby_status != eHAL_STATUS_PMC_NOT_NOW)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed",__func__);
+         VOS_ASSERT(0);
+         vosStatus = VOS_STATUS_E_FAILURE;
+         goto failure;
+      }
+   }
+   else if (halStatus != eHAL_STATUS_SUCCESS && halStatus != eHAL_STATUS_PMC_NOT_NOW) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed - status %d",
+         __func__, halStatus);
+      VOS_ASSERT(0);
+      vosStatus = VOS_STATUS_E_FAILURE;
+      goto failure;
+   }
+   else
+      pHddCtx->hdd_ps_state = eHDD_SUSPEND_STANDBY;
+
+failure:
+   //Restore IMPS config
+   if(pHddCtx->cfg_ini->fIsImpsEnabled)
+      sme_EnablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+
+   //Restore BMPS config
+   if(pHddCtx->cfg_ini->fIsBmpsEnabled)
+      sme_EnablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+
+   return vosStatus;
+}
+
+
+//Helper routine for Deep sleep entry
+VOS_STATUS hdd_enter_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter)
+{
+   eHalStatus halStatus;
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_call_status_type callType;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev_current = NULL;
+   int attempts = 0;
+#endif
+   //Stop the Interface TX queue.
+   netif_tx_disable(pAdapter->dev);
+   netif_carrier_off(pAdapter->dev);
+
+   //Disable IMPS,BMPS as we do not want the device to enter any power
+   //save mode on it own during suspend sequence
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+
+   //Ensure that device is in full power as we will touch H/W during vos_Stop
+   INIT_COMPLETION(pHddCtx->full_pwr_comp_var);
+   g_full_pwr_status = eHAL_STATUS_FAILURE;
+   halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, 
+       pHddCtx, eSME_FULL_PWR_NEEDED_BY_HDD);
+
+   if(halStatus == eHAL_STATUS_PMC_PENDING)
+   {
+      //Block on a completion variable. Can't wait forever though
+      wait_for_completion_interruptible_timeout(&pHddCtx->full_pwr_comp_var, 
+         msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR));
+      if(g_full_pwr_status != eHAL_STATUS_SUCCESS){
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__);
+         VOS_ASSERT(0);
+      }
+   }
+   else if(halStatus != eHAL_STATUS_SUCCESS)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Request for Full Power failed",__func__);
+      VOS_ASSERT(0);
+   }
+
+   //Issue a disconnect. This is required to inform the supplicant that
+   //STA is getting disassociated and for GUI to be updated properly
+   INIT_COMPLETION(pAdapter->disconnect_comp_var);
+   halStatus = sme_RoamDisconnect(pHddCtx->hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+   //Success implies disconnect command got queued up successfully
+   if(halStatus == eHAL_STATUS_SUCCESS)
+   {
+      //Block on a completion variable. Can't wait forever though.
+      wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, 
+         msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+   }
+
+
+   //None of the steps should fail after this. Continue even in case of failure
+   vosStatus = vos_stop( pHddCtx->pvosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+#ifdef ANI_BUS_TYPE_SDIO
+   vosStatus = WLANBAL_Stop( pHddCtx->pvosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   vosStatus = WLANBAL_SuspendChip( pHddCtx->pvosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   vosStatus = WLANSAL_Stop(pHddCtx->pvosContext);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+#endif
+
+   vosStatus = vos_chipAssertDeepSleep( &callType, NULL, NULL );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   //Vote off any PMIC voltage supplies
+   vosStatus = vos_chipPowerDown(NULL, NULL, NULL);
+
+#ifdef ANI_BUS_TYPE_SDIO
+    //Get the Current SDIO Func
+   sdio_func_dev_current = libra_getsdio_funcdev();
+   if(NULL != sdio_func_dev_current) {
+      libra_detect_card_change();
+      do {
+         msleep(100);
+         //Get the SDIO func device
+         sdio_func_dev_current = libra_getsdio_funcdev();
+         if(NULL == sdio_func_dev_current) {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Card Removed Successfully",__func__);
+            break;
+         }
+         else {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to Remove the Card: Trying Again",__func__);
+            attempts++;
+         }
+      } while (attempts < LIBRA_CARD_REMOVE_DETECT_MAX_COUNT);
+
+      if(LIBRA_CARD_REMOVE_DETECT_MAX_COUNT == attempts) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to Remove the Card: Fatal",__func__);
+         goto err_fail;
+      }
+   }
+#endif
+
+   pHddCtx->hdd_ps_state = eHDD_SUSPEND_DEEP_SLEEP;
+
+   //Restore IMPS config
+   if(pHddCtx->cfg_ini->fIsImpsEnabled)
+      sme_EnablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+
+   //Restore BMPS config
+   if(pHddCtx->cfg_ini->fIsBmpsEnabled)
+      sme_EnablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+
+#ifdef ANI_BUS_TYPE_SDIO
+err_fail:
+#endif
+   return vosStatus;
+}
+
+VOS_STATUS hdd_exit_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter)
+{
+   VOS_STATUS vosStatus;
+   eHalStatus halStatus;
+#ifdef ANI_BUS_TYPE_SDIO
+   int attempts = 0;
+   struct sdio_func *sdio_func_dev = NULL;
+#endif
+
+   //Power Up Libra WLAN card first if not already powered up
+   vosStatus = vos_chipPowerUp(NULL,NULL,NULL);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not Powered Up. "
+          "exiting", __func__);
+      goto err_deep_sleep;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   libra_detect_card_change();
+
+   do {
+      sdio_func_dev = libra_getsdio_funcdev();
+      if (NULL == sdio_func_dev) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not detected yet.",__func__);
+         attempts++;
+      }
+      else {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN detecton succeeded",__func__);
+         break;
+      }
+
+      if(LIBRA_CARD_INSERT_DETECT_MAX_COUNT == attempts)
+        break;
+
+      msleep(250);
+
+   }while (attempts < LIBRA_CARD_INSERT_DETECT_MAX_COUNT);
+
+   //Retry to detect the card again by Powering Down the chip and Power up the chip
+   //again. This retry is done to recover from CRC Error
+   if (NULL == sdio_func_dev) {
+
+      attempts = 0;
+
+      //Vote off any PMIC voltage supplies
+      vos_chipPowerDown(NULL, NULL, NULL);
+
+      msleep(1000);
+
+      //Power Up Libra WLAN card first if not already powered up
+      vosStatus = vos_chipPowerUp(NULL,NULL,NULL);
+      if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN not Powered Up. "
+             "exiting", __func__);
+         goto err_deep_sleep;
+      }
+
+      do {
+         sdio_func_dev = libra_getsdio_funcdev();
+         if (NULL == sdio_func_dev) {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN not detected yet.",__func__);
+            attempts++;
+         }
+         else {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN detecton succeeded",__func__);
+            break;
+         }
+
+         if(attempts == 2)
+           break;
+
+         msleep(1000);
+
+      }while (attempts < 3);
+
+   }
+
+   if (NULL == sdio_func_dev) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not found!!",__func__);
+         goto err_deep_sleep;
+   }
+
+   SET_NETDEV_DEV(pAdapter->dev, &sdio_func_dev->dev);
+   libra_sdio_setprivdata (sdio_func_dev, pHddCtx);
+   atomic_set(&pHddCtx->sdio_claim_count, 0);
+   pHddCtx->parent_dev = &sdio_func_dev->dev;
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+      "%s: calling WLANSAL_Start",__func__);
+   vosStatus = WLANSAL_Start(pHddCtx->pvosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to start SAL",__func__);
+      goto err_deep_sleep;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+      "%s: calling WLANBAL_ResumeChip",__func__);
+   vosStatus = WLANBAL_ResumeChip( pHddCtx->pvosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed in WLANBAL_ResumeChip",__func__);
+      goto err_sal_stop;
+   }
+
+   vosStatus = WLANBAL_Start(pHddCtx->pvosContext);
+
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to start BAL",__func__);
+      goto err_sal_stop;
+   }
+#endif
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+      "%s: calling hdd_set_sme_config",__func__);
+   vosStatus = hdd_set_sme_config( pHddCtx );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed in hdd_set_sme_config",__func__);
+#ifdef ANI_BUS_TYPE_SDIO
+      goto err_bal_stop;
+#else
+      goto err_deep_sleep;
+#endif
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+      "%s: calling vos_start",__func__);
+   vosStatus = vos_start( pHddCtx->pvosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed in vos_start",__func__);
+#ifdef ANI_BUS_TYPE_SDIO
+      goto err_bal_stop;
+#else
+      goto err_deep_sleep;
+#endif
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+      "%s: calling hdd_post_voss_start_config",__func__);
+   vosStatus = hdd_post_voss_start_config( pHddCtx );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed in hdd_post_voss_start_config",__func__);
+      goto err_voss_stop;
+   }
+
+
+   //Open a SME session for future operation
+   halStatus = sme_OpenSession( pHddCtx->hHal, hdd_smeRoamCallback, pHddCtx,
+                                (tANI_U8 *)&pAdapter->macAddressCurrent, &pAdapter->sessionId );
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"sme_OpenSession() failed with status code %08d [x%08lx]",
+                    halStatus, halStatus );
+      goto err_voss_stop;
+
+   }
+
+   pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE;
+
+   //Trigger the initial scan
+   hdd_wlan_initial_scan(pHddCtx);
+
+   return VOS_STATUS_SUCCESS;
+
+err_voss_stop:
+   vos_stop(pHddCtx->pvosContext);
+#ifdef ANI_BUS_TYPE_SDIO
+err_bal_stop:
+   WLANBAL_Stop(pHddCtx->pvosContext);
+err_sal_stop:
+   WLANSAL_Stop(pHddCtx->pvosContext);
+#endif
+err_deep_sleep:
+   return VOS_STATUS_E_FAILURE;
+
+}
+
+VOS_STATUS hdd_conf_hostarpoffload(hdd_context_t* pHddCtx, v_BOOL_t fenable)
+{
+   struct in_ifaddr **ifap = NULL;
+   struct in_ifaddr *ifa = NULL;
+   struct in_device *in_dev;
+   int i = 0;
+   hdd_adapter_t *pAdapter = NULL;   
+   tSirHostOffloadReq  offLoadRequest;
+
+   hddLog(VOS_TRACE_LEVEL_ERROR, "%s: \n", __func__);
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+   if (pHddCtx->cfg_ini->isMcAddrListFilter)
+   {
+      pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_GO);
+      if (pAdapter != NULL)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "%s: Can't set multicast addr filtering in P2P-GO HDD", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT);
+      if (pAdapter == NULL)    
+         pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+
+      if(pAdapter == NULL)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+   }
+   else
+   {
+#endif
+      pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_INFRA_STATION);
+      if(pAdapter == NULL)
+      {
+         pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_P2P_CLIENT);
+         if(pAdapter == NULL)
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+            return VOS_STATUS_E_FAILURE;
+         }
+      }
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+   }
+#endif
+   if(fenable)
+   {
+       if ((in_dev = __in_dev_get_rtnl(pAdapter->dev)) != NULL)
+       {
+           for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; 
+                   ifap = &ifa->ifa_next)
+           {
+               if (!strcmp(pAdapter->dev->name, ifa->ifa_label))
+               {
+                   break; /* found */
+               }
+           }
+       }
+       
+       if(ifa && ifa->ifa_local)
+       {
+           offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
+           offLoadRequest.enableOrDisable = SIR_OFFLOAD_ENABLE;
+
+           hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Enabled \n", __func__);
+
+           if((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST ==
+                   pHddCtx->cfg_ini->mcastBcastFilterSetting )
+                    || (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST ==
+                    pHddCtx->cfg_ini->mcastBcastFilterSetting))
+           {
+               //MCAST filter is set by hdd_conf_mcastbcast_filter fn call
+               offLoadRequest.enableOrDisable = 
+                       SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE;
+           }
+           
+           //converting u32 to IPV4 address
+           for(i = 0 ; i < 4; i++)
+           {
+              offLoadRequest.params.hostIpv4Addr[i] = 
+                      (ifa->ifa_local >> (i*8) ) & 0xFF ;
+           }
+           hddLog(VOS_TRACE_LEVEL_WARN, " Enable SME HostOffload: %d.%d.%d.%d",
+                  offLoadRequest.params.hostIpv4Addr[0],
+                  offLoadRequest.params.hostIpv4Addr[1],
+                  offLoadRequest.params.hostIpv4Addr[2],
+                  offLoadRequest.params.hostIpv4Addr[3]);
+
+          if (eHAL_STATUS_SUCCESS != 
+                    sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter) , &offLoadRequest))
+          {
+              hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to enable HostOffload "
+                      "feature\n", __func__);
+              return VOS_STATUS_E_FAILURE;
+          }
+          return VOS_STATUS_SUCCESS;
+       }
+       else
+       {
+           hddLog(VOS_TRACE_LEVEL_INFO, "%s:IP Address is not assigned \n", __func__);
+           return VOS_STATUS_E_AGAIN;
+       }
+   }
+   else
+   {
+       vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq));
+       offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
+       offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
+
+       if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offLoadRequest))
+       {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to disable host "
+                             "offload feature\n", __func__);
+            return VOS_STATUS_E_FAILURE;
+       }
+       return VOS_STATUS_SUCCESS;
+   }
+}
+
+void hdd_conf_mcastbcast_filter(hdd_context_t* pHddCtx, v_BOOL_t setfilter)
+{
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    tpAniSirGlobal pMac = (tpAniSirGlobal) vos_get_context(VOS_MODULE_ID_SME, pHddCtx->pvosContext);
+#else
+    tpSirWlanSetRxpFilters wlanRxpFilterParam =
+                     vos_mem_malloc(sizeof(tSirWlanSetRxpFilters));
+    if(NULL == wlanRxpFilterParam)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL,
+           "%s: vos_mem_alloc failed ", __func__);
+        return;
+    }
+#endif
+    hddLog(VOS_TRACE_LEVEL_INFO,
+        "%s: Configuring Mcast/Bcast Filter Setting. setfilter %d", __func__, setfilter);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    if ( pMac ) 
+    {
+      halStatus = halRxp_configureRxpFilterMcstBcst( pMac, setfilter);
+    }
+    else
+    {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pMac is initialised to NULL",__func__ );
+    }
+#else
+    wlanRxpFilterParam->setMcstBcstFilter = setfilter;
+    wlanRxpFilterParam->configuredMcstBcstFilterSetting = 
+                      pHddCtx->cfg_ini->mcastBcastFilterSetting;
+    halStatus = sme_ConfigureRxpFilter(pHddCtx->hHal, wlanRxpFilterParam);
+#endif
+    if(setfilter && (eHAL_STATUS_SUCCESS == halStatus))
+       pHddCtx->hdd_mcastbcast_filter_set = TRUE;
+}
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
+                                 hdd_adapter_t *pAdapter)
+{
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+    tpSirWlanSuspendParam wlanSuspendParam =
+      vos_mem_malloc(sizeof(tSirWlanSuspendParam));
+
+    if(NULL == wlanSuspendParam)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL,
+           "%s: vos_mem_alloc failed ", __func__);
+        return;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+      "%s: send wlan suspend indication", __func__);
+
+    if((pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER))
+    {
+        if((pHddCtx->cfg_ini->fhostArpOffload) && 
+           (eConnectionState_Associated == 
+            (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) 
+        {
+            halStatus = hdd_conf_hostarpoffload(pHddCtx, TRUE);
+            if (!VOS_IS_STATUS_SUCCESS(halStatus))
+            {
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                       "%s:Failed to enable ARPOFFLOAD Feature %d\n",
+                       __func__, halStatus);
+            }
+        }
+
+        if(pHddCtx->dynamic_mcbc_filter.enableCfg)
+        {
+            wlanSuspendParam->configuredMcstBcstFilterSetting = 
+                         pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting;
+            pHddCtx->dynamic_mcbc_filter.enableSuspend = TRUE;
+            pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = 
+                         wlanSuspendParam->configuredMcstBcstFilterSetting;
+        }
+        else
+        {
+            pHddCtx->dynamic_mcbc_filter.enableSuspend = FALSE;
+            wlanSuspendParam->configuredMcstBcstFilterSetting = 
+                                    pHddCtx->cfg_ini->mcastBcastFilterSetting;
+        }
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+        if (pHddCtx->cfg_ini->isMcAddrListFilter)
+        {
+           /*Multicast addr list filter is enabled during suspend*/
+           if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || 
+                    (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
+                 && pHddCtx->mc_addr_list.mc_cnt
+                 && (eConnectionState_Associated == 
+                    (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
+           {
+              /*set the filter*/
+              wlan_hdd_set_mc_addr_list(pHddCtx, TRUE);
+           }
+        }
+#endif
+    }
+
+    halStatus = sme_ConfigureSuspendInd(pHddCtx->hHal, wlanSuspendParam);
+    if(eHAL_STATUS_SUCCESS == halStatus)
+    {
+        pHddCtx->hdd_mcastbcast_filter_set = TRUE;
+    }
+}
+
+static void hdd_conf_resume_ind(hdd_context_t* pHddCtx)
+{
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+    tpSirWlanResumeParam wlanResumeParam =
+      vos_mem_malloc(sizeof(tSirWlanResumeParam));
+
+    if(NULL == wlanResumeParam)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL,
+           "%s: vos_mem_alloc failed ", __func__);
+        return;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO, 
+      "%s: send wlan resume indication", __func__);
+
+    if(pHddCtx->cfg_ini->fhostArpOffload)
+    {
+        halStatus = hdd_conf_hostarpoffload(pHddCtx, FALSE);
+        if (!VOS_IS_STATUS_SUCCESS(halStatus))
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s:Failed to disable ARPOFFLOAD "
+                  "Feature %d\n", __func__, halStatus);
+        }
+    }
+    if (pHddCtx->dynamic_mcbc_filter.enableSuspend)
+    {
+        wlanResumeParam->configuredMcstBcstFilterSetting = 
+                               pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend;
+    }
+    else
+    {
+        wlanResumeParam->configuredMcstBcstFilterSetting = 
+                                    pHddCtx->cfg_ini->mcastBcastFilterSetting;
+    }
+    sme_ConfigureResumeReq(pHddCtx->hHal, wlanResumeParam);
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING    
+    if (pHddCtx->cfg_ini->isMcAddrListFilter)
+    {
+       /*Mutlicast addr filtering is enabled*/
+       if(pHddCtx->mc_addr_list.isFilterApplied)
+       {
+          /*Filter applied during suspend mode*/
+          /*Clear it here*/
+          wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
+       }
+    }
+#endif
+}
+#endif
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+//Suspend routine registered with Android OS
+void hdd_suspend_wlan(struct early_suspend *wlan_suspend)
+{
+   hdd_context_t *pHddCtx = NULL;
+   v_CONTEXT_t pVosContext = NULL;
+
+   hdd_adapter_t *pAdapter = NULL; 
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = NULL;
+#endif
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being suspended by Android OS",__func__);
+
+   //Get the global VOSS context.
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if(!pVosContext) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      return;
+   }
+
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+
+   if(!pHddCtx) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return;
+   }
+
+   if (pHddCtx->isLogpInProgress) {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Ignore suspend wlan, LOGP in progress!", __func__);
+      return;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   sdio_func_dev = libra_getsdio_funcdev();
+
+   if(sdio_func_dev == NULL)
+   {
+        /* Our card got removed */
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+        return;
+   }
+
+   if(!sd_is_drvdata_available(sdio_func_dev))
+   {
+        /* Our card got removed */
+        hddLog(VOS_TRACE_LEVEL_FATAL,
+               "%s: HDD context is not available in sdio_func_dev!",__func__);
+        return;
+   }
+
+   sd_claim_host(sdio_func_dev);
+   
+   // Prevent touching the pMac while LOGP reset in progress, we should never get here
+   // as the wake lock is already acquired and it would prevent from entering suspend 
+   if (pHddCtx->isLogpInProgress) {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Ignore suspend wlan, LOGP in progress!", __func__);
+      sd_release_host(sdio_func_dev);
+      return;
+   }
+#endif
+
+   /*loop through all adapters. TBD fix for Concurrency */
+   status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+       pAdapter = pAdapterNode->pAdapter;
+       if ( (WLAN_HDD_INFRA_STATION != pAdapter->device_mode)
+         && (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) )
+
+       {  //just do for station interface
+           status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+           pAdapterNode = pNext;
+           continue;
+       }
+
+#ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP
+       if (pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_STANDBY)
+       {
+          //stop the interface before putting the chip to standby
+          netif_tx_disable(pAdapter->dev);
+          netif_carrier_off(pAdapter->dev);
+       }
+       else if (pHddCtx->cfg_ini->nEnableSuspend == 
+               WLAN_MAP_SUSPEND_TO_DEEP_SLEEP)
+       {
+          //Execute deep sleep procedure
+          hdd_enter_deep_sleep(pHddCtx, pAdapter);
+       }
+#endif
+
+   if((pHddCtx->cfg_ini->enableDynamicDTIM ||
+       pHddCtx->cfg_ini->enableModulatedDTIM) && 
+       (eANI_BOOLEAN_TRUE == pAdapter->higherDtimTransition) &&
+      (eConnectionState_Associated == 
+         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) &&
+         (pHddCtx->cfg_ini->fIsBmpsEnabled))
+   {
+      tSirSetPowerParamsReq powerRequest = { 0 };
+
+      powerRequest.uIgnoreDTIM = 1;
+  
+      /*Back up the actual values from CFG */
+      wlan_cfgGetInt(pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, 
+                              &pHddCtx->hdd_actual_ignore_DTIM_value);
+      wlan_cfgGetInt(pHddCtx->hHal, WNI_CFG_LISTEN_INTERVAL, 
+                              &pHddCtx->hdd_actual_LI_value);
+      
+      if(pHddCtx->cfg_ini->enableModulatedDTIM)
+      {
+          powerRequest.uDTIMPeriod = pHddCtx->cfg_ini->enableModulatedDTIM;
+          powerRequest.uListenInterval = pHddCtx->hdd_actual_LI_value;
+      }
+      else
+      {
+          powerRequest.uListenInterval = pHddCtx->cfg_ini->enableDynamicDTIM;
+      }   
+
+      /* Update ignoreDTIM and ListedInterval in CFG to remain at the DTIM 
+      *specified during Enter/Exit BMPS when LCD off*/
+      ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, powerRequest.uIgnoreDTIM,
+                       NULL, eANI_BOOLEAN_FALSE);
+      ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LISTEN_INTERVAL, powerRequest.uListenInterval, 
+                       NULL, eANI_BOOLEAN_FALSE);
+
+      /* switch to the DTIM specified in cfg.ini */
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+                     "Switch to DTIM%d \n", powerRequest.uListenInterval);
+      sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest);    
+
+      if (BMPS == pmcGetPmcState(pHddCtx->hHal))
+      {
+          /* put the device into full power */
+          wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE);
+
+          /* put the device back into BMPS */
+          wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
+
+          pHddCtx->hdd_ignore_dtim_enabled = TRUE;
+      }
+   }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /*Suspend notification sent down to driver*/
+      hdd_conf_suspend_ind(pHddCtx, pAdapter);
+#else
+      if(pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER) {
+         if(eConnectionState_Associated == 
+            (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) {
+            hdd_conf_mcastbcast_filter(pHddCtx, TRUE);
+            halPSAppsCpuWakeupState(vos_get_context(VOS_MODULE_ID_SME,
+                                  pHddCtx->pvosContext), FALSE);
+         }
+      } 
+#endif
+   status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+   pAdapterNode = pNext;
+  }
+  pHddCtx->hdd_wlan_suspended = TRUE;
+
+#ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP
+  if(pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_STANDBY)
+  {
+      hdd_enter_standby(pHddCtx);
+  }
+#endif
+#ifdef ANI_BUS_TYPE_SDIO
+   sd_release_host(sdio_func_dev);
+#endif
+
+   return;
+}
+
+static void hdd_PowerStateChangedCB
+(
+   v_PVOID_t callbackContext,
+   tPmcState newState
+)
+{
+   hdd_context_t *pHddCtx = callbackContext;
+   
+   /* if the driver was not in BMPS during early suspend,
+    * the dynamic DTIM is now updated at Riva */
+   if ((newState == BMPS) && pHddCtx->hdd_wlan_suspended
+           && pHddCtx->cfg_ini->enableDynamicDTIM
+           && (pHddCtx->hdd_ignore_dtim_enabled == FALSE))
+   {
+       pHddCtx->hdd_ignore_dtim_enabled = TRUE;
+   }
+   spin_lock(&pHddCtx->filter_lock);
+   if((newState == BMPS) &&  pHddCtx->hdd_wlan_suspended
+          && (pHddCtx->hdd_mcastbcast_filter_set != TRUE)) {
+      spin_unlock(&pHddCtx->filter_lock);
+      hdd_conf_mcastbcast_filter(pHddCtx, TRUE);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+      halPSAppsCpuWakeupState(vos_get_context(VOS_MODULE_ID_SME, pHddCtx->pvosContext), FALSE);
+#endif
+      if(pHddCtx->hdd_mcastbcast_filter_set != TRUE)
+         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not able to set mcast/bcast filter ", __func__);
+   }
+   else 
+      spin_unlock(&pHddCtx->filter_lock);
+}
+
+
+
+void hdd_register_mcast_bcast_filter(hdd_context_t *pHddCtx)
+{
+   v_CONTEXT_t pVosContext;
+   tHalHandle smeContext;
+
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if (NULL == pVosContext)
+   {
+      hddLog(LOGE, "%s: Invalid pContext", __FUNCTION__);
+      return;
+   }
+   smeContext = vos_get_context(VOS_MODULE_ID_SME, pVosContext);
+   if (NULL == smeContext)
+   {
+      hddLog(LOGE, "%s: Invalid smeContext", __FUNCTION__);
+      return;
+   }
+
+   spin_lock_init(&pHddCtx->filter_lock);
+   if (WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER ==
+                                            pHddCtx->cfg_ini->nEnableSuspend)
+   {
+      pmcRegisterDeviceStateUpdateInd(smeContext,
+                                      hdd_PowerStateChangedCB, pHddCtx);
+   }
+}
+
+void hdd_unregister_mcast_bcast_filter(hdd_context_t *pHddCtx)
+{
+   v_CONTEXT_t pVosContext;
+   tHalHandle smeContext;
+
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if (NULL == pVosContext)
+   {
+      hddLog(LOGE, "%s: Invalid pContext", __FUNCTION__);
+      return;
+   }
+   smeContext = vos_get_context(VOS_MODULE_ID_SME, pVosContext);
+   if (NULL == smeContext)
+   {
+      hddLog(LOGE, "%s: Invalid smeContext", __FUNCTION__);
+      return;
+   }
+
+   if (WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER == 
+                                            pHddCtx->cfg_ini->nEnableSuspend)
+   {
+      pmcDeregisterDeviceStateUpdateInd(smeContext, hdd_PowerStateChangedCB);
+   }
+}
+
+void hdd_resume_wlan(struct early_suspend *wlan_suspend)
+{
+   hdd_context_t *pHddCtx = NULL;
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   v_CONTEXT_t pVosContext = NULL;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = NULL;
+#endif
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed by Android OS",__func__);
+
+   //Get the global VOSS context.
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if(!pVosContext) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      return;
+   }
+
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+
+   if(!pHddCtx) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return;
+   }
+   
+   if (pHddCtx->isLogpInProgress) {
+      hddLog(VOS_TRACE_LEVEL_INFO,
+             "%s: Ignore resume wlan, LOGP in progress!", __func__);
+      return;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   sdio_func_dev = libra_getsdio_funcdev();
+
+   if(sdio_func_dev == NULL)
+   {
+      /* Our card got removed */
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+      return;
+   }
+
+   if(!sd_is_drvdata_available(sdio_func_dev))
+   {
+        /* Our card got removed */
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is not available "
+                                       "in sdio_func_dev!",__func__);
+        return;
+   }
+
+   sd_claim_host(sdio_func_dev);
+   
+   // Prevent touching the pMac while LOGP reset in progress, 
+   if (pHddCtx->isLogpInProgress) {
+      hddLog(VOS_TRACE_LEVEL_INFO, "%s: Ignore resume wlan, LOGP in progress!", __func__);
+      sd_release_host(sdio_func_dev);
+      return;
+   }
+#endif
+   pHddCtx->hdd_wlan_suspended = FALSE;
+   /*loop through all adapters. Concurrency */
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+       pAdapter = pAdapterNode->pAdapter;
+       if ( (WLAN_HDD_INFRA_STATION != pAdapter->device_mode)
+         && (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) )
+       {  //just do for station interface
+            status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+            pAdapterNode = pNext;
+            continue;
+       }
+#ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP   
+       if(pHddCtx->hdd_ps_state == eHDD_SUSPEND_DEEP_SLEEP) 
+       {
+          hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed from deep sleep",__func__);
+          hdd_exit_deep_sleep(pAdapter);
+       }
+#endif
+
+      if(pHddCtx->hdd_ignore_dtim_enabled == TRUE)
+      {
+         /*Switch back to DTIM 1*/
+         tSirSetPowerParamsReq powerRequest = { 0 }; 
+
+         powerRequest.uIgnoreDTIM = pHddCtx->hdd_actual_ignore_DTIM_value;
+         powerRequest.uListenInterval = pHddCtx->hdd_actual_LI_value;
+
+         /*Disabled ModulatedDTIM if enabled on suspend*/
+         if(pHddCtx->cfg_ini->enableModulatedDTIM)
+             powerRequest.uDTIMPeriod = 0;
+
+         /* Update ignoreDTIM and ListedInterval in CFG with default values */
+         ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, powerRequest.uIgnoreDTIM,
+                          NULL, eANI_BOOLEAN_FALSE);
+         ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LISTEN_INTERVAL, powerRequest.uListenInterval, 
+                          NULL, eANI_BOOLEAN_FALSE);
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+                        "Switch to DTIM%d \n",powerRequest.uListenInterval);
+         sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest);    
+
+         /* put the device into full power */
+         wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE);
+
+         /* put the device back into BMPS */
+         wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
+
+         pHddCtx->hdd_ignore_dtim_enabled = FALSE;
+      }
+
+         if(pHddCtx->hdd_mcastbcast_filter_set == TRUE) {
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+           hdd_conf_resume_ind(pHddCtx);
+#else
+                  hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
+                              pHddCtx->hdd_mcastbcast_filter_set = FALSE;
+                  halPSAppsCpuWakeupState(vos_get_context(VOS_MODULE_ID_SME,
+                                          pHddCtx->pvosContext), TRUE);
+#endif
+           pHddCtx->hdd_mcastbcast_filter_set = FALSE;
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+#ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP   
+   if(pHddCtx->hdd_ps_state == eHDD_SUSPEND_STANDBY) 
+   {
+       hdd_exit_standby(pHddCtx);
+   }    
+#endif
+
+#ifdef ANI_BUS_TYPE_SDIO
+   sd_release_host(sdio_func_dev);
+#endif
+   return;
+}
+
+VOS_STATUS hdd_wlan_reset(void) 
+{
+   VOS_STATUS vosStatus;
+   hdd_context_t *pHddCtx = NULL;
+   v_CONTEXT_t pVosContext = NULL;
+   pVosSchedContext vosSchedContext = NULL;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev_new = NULL;
+   struct sdio_func *sdio_func_dev_current = NULL;
+   unsigned int attempts = 0;
+#endif
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN being reset",__func__);
+
+   //Get the global VOSS context.
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if(!pVosContext) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
+   if(!pHddCtx) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+#ifdef ANI_BUS_TYPE_SDIO
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing SAL Stop",__func__);
+   //Invoke SAL stop
+   vosStatus = WLANSAL_Stop( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to stop SAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+#endif
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Asserting Deep Sleep",__func__);
+   //Assert Deep sleep signal now to put Libra HW in lowest power state
+   vosStatus = vos_chipAssertDeepSleep( NULL, NULL, NULL );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Power Down Chip",__func__);   
+   //Vote off any PMIC voltage supplies
+   vos_chipPowerDown(NULL, NULL, NULL);
+
+
+   /**
+   EVM issue is observed with 1.6Mhz freq for 1.3V supply in wlan standalone case.
+   During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed. 
+   To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+   during exit.
+   */
+   if (vos_chipVoteFreqFor1p3VSupply(NULL, NULL, NULL, VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_1P6MH) != VOS_STATUS_SUCCESS)
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to set the freq to 1.6Mhz for 1.3V Supply",__func__ );
+
+   //Disable IMPS/BMPS as we do not want the device to enter any power
+   //save mode on its own during reset sequence
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_UAPSD_MODE_POWER_SAVE);
+
+   //Kill all the threads first. We do not want any messages
+   //to be a processed any more and the best way to ensure that
+   //is to terminate the threads gracefully.
+   vosSchedContext = get_vos_sched_ctxt();
+
+   /* Wakeup Mc Thread if Suspended */
+   if(TRUE == pHddCtx->isMcThreadSuspended){
+      complete(&vosSchedContext->ResumeMcEvent);
+      pHddCtx->isMcThreadSuspended= FALSE;
+   }
+   /* Wakeup Tx Thread if Suspended */
+   if(TRUE == pHddCtx->isTxThreadSuspended){
+      complete(&vosSchedContext->ResumeTxEvent);
+      pHddCtx->isTxThreadSuspended= FALSE;
+   }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Wakeup Rx Thread if Suspended */
+   if(TRUE == pHddCtx->isRxThreadSuspended){
+      complete(&vosSchedContext->ResumeRxEvent);
+      pHddCtx->isRxThreadSuspended= FALSE;
+   }
+#endif
+
+   /* Reset the Suspend Variable */
+   pHddCtx->isWlanSuspended = FALSE;
+
+   //Wait for MC to exit
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down MC thread",__func__);
+   set_bit(MC_SHUTDOWN_EVENT_MASK, &vosSchedContext->mcEventFlag);
+   set_bit(MC_POST_EVENT_MASK, &vosSchedContext->mcEventFlag);
+   wake_up_interruptible(&vosSchedContext->mcWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->McShutdown);
+
+   //Wait for TX to exit
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down TX thread",__func__);
+   set_bit(TX_SHUTDOWN_EVENT_MASK, &vosSchedContext->txEventFlag);
+   set_bit(TX_POST_EVENT_MASK, &vosSchedContext->txEventFlag);
+   wake_up_interruptible(&vosSchedContext->txWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->TxShutdown);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   //Wait for RX to exit
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down RX thread",__func__);
+   set_bit(RX_SHUTDOWN_EVENT_MASK, &vosSchedContext->rxEventFlag);
+   set_bit(RX_POST_EVENT_MASK, &vosSchedContext->rxEventFlag);
+   wake_up_interruptible(&vosSchedContext->rxWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->RxShutdown);
+#endif
+
+   /* Cancel the vote for XO Core ON in LOGP since we are reinitializing our driver
+    * This is done here to ensure there is no race condition since MC and TX thread have
+    * exited at this point
+    */
+   hddLog(VOS_TRACE_LEVEL_WARN, "In LOGP: Cancel XO Core ON vote\n");
+   if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "Could not cancel XO Core ON vote. Not returning failure."
+                                         "Power consumed will be high\n");
+   }
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing SME STOP",__func__);
+   //Stop SME - Cannot invoke vos_stop as vos_stop relies
+   //on threads being running to process the SYS Stop
+   vosStatus = sme_Stop( pHddCtx->hHal, TRUE );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing MAC STOP",__func__);
+   //Stop MAC (PE and HAL)
+   vosStatus = macStop( pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing TL STOP",__func__);
+   //Stop TL
+   vosStatus = WLANTL_Stop( pVosContext );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+#ifdef ANI_BUS_TYPE_SDIO
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing BAL STOP",__func__);
+   vosStatus = WLANBAL_Stop( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to stop BAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+#endif
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_unregister_mcast_bcast_filter(pHddCtx);
+#endif
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Flush Queues",__func__);
+   //Clean up message queues of TX and MC thread
+   vos_sched_flush_mc_mqs(vosSchedContext);
+   vos_sched_flush_tx_mqs(vosSchedContext);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   vos_sched_flush_rx_mqs(vosSchedContext);
+#endif
+
+   //Deinit all the TX and MC queues
+   vos_sched_deinit_mqs(vosSchedContext);
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing VOS Close",__func__);
+
+   //Close VOSS
+   vos_close(pVosContext);
+
+#ifdef ANI_BUS_TYPE_SDIO
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing BAL Close",__func__);
+   vosStatus = WLANBAL_Close(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
+          "%s: Failed to close BAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+   //Get the Current SDIO Func
+   sdio_func_dev_current = libra_getsdio_funcdev();
+
+   if(NULL != sdio_func_dev_current) {
+      libra_detect_card_change();
+      attempts = 0;
+      do {
+         msleep(100);
+         //Get the SDIO func device
+         sdio_func_dev_current = libra_getsdio_funcdev();
+         if(NULL == sdio_func_dev_current) {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Card Removed Successfully",__func__);
+            break;
+         }
+         else {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to Remove the Card: Trying Again",__func__);
+            attempts++;
+         }
+      } while (attempts < LIBRA_CARD_REMOVE_DETECT_MAX_COUNT);
+
+      if(LIBRA_CARD_REMOVE_DETECT_MAX_COUNT == attempts) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to Remove the Card: Fatal",__func__);
+         goto err_fail;
+      }
+   }
+#endif
+
+#ifdef TIMER_MANAGER
+   vos_timer_exit();
+#endif
+
+#ifdef MEMORY_DEBUG
+   vos_mem_clean();
+#endif
+#ifdef ANI_BUS_TYPE_SDIO
+   //Reinitialize the variable
+   attempts = 0;
+#endif
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Powering Up chip Again",__func__);
+   //Power Up Libra WLAN card first if not already powered up
+   vosStatus = vos_chipPowerUp(NULL,NULL,NULL);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not Powered Up. "
+             "exiting", __func__);
+      goto err_pwr_fail;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   // Trigger card detect
+   libra_detect_card_change();
+
+   //Reinitialize the variable
+   attempts = 0;
+
+   do {
+      msleep(500);
+
+      //Get the SDIO func device
+      sdio_func_dev_new = libra_getsdio_funcdev();
+      if(sdio_func_dev_new != NULL)
+      {
+         //Not needed but in case it causes probs then put a loop and set for each adapter
+         //SET_NETDEV_DEV(pAdapter->dev, &sdio_func_dev_new->dev); 
+         libra_sdio_setprivdata (sdio_func_dev_new, pHddCtx);
+         atomic_set(&pHddCtx->sdio_claim_count, 0);
+         pHddCtx->parent_dev = &sdio_func_dev_new->dev;
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+          "%s: Card Detected Successfully %p",__func__, 
+          sdio_func_dev_new);
+         break;
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+          "%s: Failed to detect card change %p",__func__, 
+          sdio_func_dev_new);     
+         attempts++;
+      }
+   }while (attempts < LIBRA_CARD_INSERT_DETECT_MAX_COUNT);
+
+   if(LIBRA_CARD_INSERT_DETECT_MAX_COUNT == attempts){
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN fail to detect in reset, "
+             "exiting", __func__);
+      goto err_fail;
+   }
+   //Get the SDIO func device
+   sdio_func_dev_new = libra_getsdio_funcdev();
+   if(sdio_func_dev_new != NULL)
+   {
+       sd_claim_host(sdio_func_dev_new);
+       /* Enable IRQ capabilities in host controller */
+       libra_disable_sdio_irq_capability(sdio_func_dev_new, 0);
+       libra_enable_sdio_irq(sdio_func_dev_new, 1);
+       sd_release_host(sdio_func_dev_new);
+   }
+   else
+   {
+        /* Our card got removed before LOGP. */
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+        goto err_fail;
+   }
+
+   vosStatus = WLANBAL_Open(pVosContext);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+        "%s: Failed to open BAL",__func__);
+     goto err_fail;
+   }
+
+   vosStatus = WLANSAL_Start(pVosContext);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to start SAL",__func__);
+      goto err_balclose;
+   }
+
+   /* Chip is reset so allow Lower MAC to start accessing WLAN registers. Note HDD is still blocked */
+   vos_set_logp_in_progress(VOS_MODULE_ID_HDD, FALSE);
+
+   /* Start BAL */
+   vosStatus = WLANBAL_Start(pVosContext);
+
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to start BAL",__func__);
+      goto err_salstop;
+   }
+#endif
+   // Open VOSS 
+   vosStatus = vos_open( &pVosContext, 0);
+
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_open failed",__func__);
+#ifdef ANI_BUS_TYPE_SDIO
+      goto err_balstop;
+#else
+      goto err_pwr_fail;
+#endif
+   }
+
+   /* Save the hal context in Adapter */
+   pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pVosContext );
+
+   if ( NULL == pHddCtx->hHal )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HAL context is null",__func__);      
+      goto err_vosclose;
+   }
+   // Set the SME configuration parameters...
+   vosStatus = hdd_set_sme_config(pHddCtx);
+
+   if ( VOS_STATUS_SUCCESS != vosStatus )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed hdd_set_sme_config",__func__); 
+      goto err_vosclose;
+   }
+
+   //Initialize the WMM module
+   vosStatus = hdd_wmm_init(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: hdd_wmm_init failed", __FUNCTION__);
+      goto err_vosclose;
+   }
+
+   /*Start VOSS which starts up the SME/MAC/HAL modules and everything else
+     Note: Firmware image will be read and downloaded inside vos_start API */
+   vosStatus = vos_start( pVosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
+      goto err_vosclose;
+   }
+
+   vosStatus = hdd_post_voss_start_config( pHddCtx );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_post_voss_start_config failed", 
+         __func__);
+      goto err_vosstop;
+   }
+
+   /* Restart all adapters */
+   hdd_start_all_adapters(pHddCtx);
+   pHddCtx->isLogpInProgress = FALSE;
+   pHddCtx->hdd_mcastbcast_filter_set = FALSE;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_register_mcast_bcast_filter(pHddCtx);
+#endif
+
+   // Allow the phone to go to sleep
+   hdd_allow_suspend();
+
+   goto success;
+
+err_vosstop:
+   vos_stop(pVosContext);
+
+err_vosclose:
+   vos_close(pVosContext ); 
+   vos_sched_close(pVosContext);
+
+#ifdef ANI_BUS_TYPE_SDIO
+err_balstop:
+#ifndef ANI_MANF_DIAG 
+   wlan_hdd_enable_deepsleep(pVosContext);
+#endif
+   WLANBAL_Stop(pVosContext);
+   WLANBAL_SuspendChip(pVosContext);
+
+err_salstop:
+   WLANSAL_Stop(pVosContext);
+
+err_balclose:
+   WLANBAL_Close(pVosContext);
+
+err_fail:
+   //Assert Deep sleep signal now to put Libra HW in lowest power state
+   vosStatus = vos_chipAssertDeepSleep( NULL, NULL, NULL );
+
+   //Vote off any PMIC voltage supplies
+   vos_chipPowerDown(NULL, NULL, NULL);
+#endif
+
+err_pwr_fail:
+   vos_chipVoteOffXOBuffer(NULL, NULL, NULL);
+
+   // Allow the phone to go to sleep
+   hdd_allow_suspend();
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   // unregister suspend/resume callbacks
+   if(pHddCtx->cfg_ini->nEnableSuspend)
+      unregister_wlan_suspend();
+#endif
+
+   // Unregister the Net Device Notifier
+   unregister_netdevice_notifier(&hdd_netdev_notifier);
+
+  //Clean up HDD Nlink Service
+   send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); 
+   nl_srv_exit();
+
+  hdd_close_all_adapters(pHddCtx);
+  //Free up dynamically allocated members inside HDD Adapter
+   kfree(pHddCtx->cfg_ini);
+   pHddCtx->cfg_ini= NULL;
+
+#ifdef CONFIG_CFG80211
+   wiphy_unregister(pHddCtx->wiphy);
+   wiphy_free(pHddCtx->wiphy);
+#else
+   vos_mem_free(pHddCtx);
+#endif
+
+#ifdef ANI_BUS_TYPE_SDIO
+   WLANSAL_Close(pVosContext);
+#endif
+   vos_preClose(&pVosContext);
+
+#ifdef MEMORY_DEBUG
+   vos_mem_exit();
+#endif
+
+   return -1;
+
+success:
+   //Trigger replay of BTC events
+   send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+   return VOS_STATUS_SUCCESS;
+
+}
+
+
+
+VOS_STATUS hdd_wlan_reset_initialization(void) 
+{
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = NULL;
+   v_U8_t  regValue = 0;
+   int  err_ret = 0;
+#endif
+   v_CONTEXT_t pVosContext = NULL;
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN being reset",__func__);  
+
+   //Get the global VOSS context.
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if(!pVosContext) 
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Preventing the phone from going to suspend",__func__);
+
+   // Prevent the phone from going to sleep
+   hdd_prevent_suspend();
+
+#ifdef ANI_BUS_TYPE_SDIO
+   /* Clear pending interrupt and  disable Interrupts. Use only CMD52 */
+   VOS_TRACE( VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_FATAL, 
+          "%s LOGP in progress. Disabling Interrupt", __func__);
+
+   sdio_func_dev = libra_getsdio_funcdev();
+
+   if(sdio_func_dev == NULL)
+   {
+      /* Our card got removed before LOGP. Continue with reset anyways */
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+      return VOS_STATUS_SUCCESS;
+   }
+
+   sd_claim_host(sdio_func_dev);
+
+   regValue = 0;
+   libra_sdiocmd52(sdio_func_dev, QWLAN_SIF_SIF_INT_EN_REG,  
+                             &regValue, 1, &err_ret);
+
+   VOS_TRACE( VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_FATAL, 
+      "%s LOGP Cleared SIF_SIF_INT_EN_REG status:%d", __func__,err_ret);
+
+   regValue = 0;
+   libra_sdiocmd52(sdio_func_dev, QWLAN_SIF_BAR4_INT_PEND_REG,  
+                             &regValue, 1, &err_ret);
+
+   VOS_TRACE( VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_FATAL, 
+      "%s LOGP Cleared SIF_BAR4_INT_PEND_REG status :%d", __func__,err_ret);
+
+   regValue = 0;
+   libra_sdiocmd52(sdio_func_dev, QWLAN_SIF_BAR4_INT_ENABLE_REG,  
+                             &regValue, 1, &err_ret);
+
+   VOS_TRACE( VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_FATAL, 
+      "%s LOGP Cleared SIF_BAR4_INT_ENABLE_REG: Status:%d", __func__,err_ret);
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing Suspend Chip",__func__);
+
+   //Put the chip is standby before asserting deep sleep
+   WLANBAL_SuspendChip_NoLock( pVosContext );
+
+   sd_release_host(sdio_func_dev);
+#endif
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+void register_wlan_suspend(void)
+{
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Register WLAN suspend/resume "
+            "callbacks",__func__);
+   wlan_early_suspend.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING;
+   wlan_early_suspend.suspend = hdd_suspend_wlan;
+   wlan_early_suspend.resume = hdd_resume_wlan;
+   register_early_suspend(&wlan_early_suspend);
+}
+
+void unregister_wlan_suspend(void)
+{
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Unregister WLAN suspend/resume "
+            "callbacks",__func__);
+   unregister_early_suspend(&wlan_early_suspend);
+}
+#endif
+
+/* the HDD interface to WLAN driver shutdown,
+ * the primary shutdown function in SSR
+ */
+VOS_STATUS hdd_wlan_shutdown(void)
+{
+   VOS_STATUS       vosStatus;
+   v_CONTEXT_t      pVosContext = NULL;
+   hdd_context_t    *pHddCtx = NULL;
+   pVosSchedContext vosSchedContext = NULL;
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN driver shutting down! ",__func__);
+
+   /* Get the global VOSS context. */
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+   if(!pVosContext) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   /* Get the HDD context. */
+   pHddCtx = (hdd_context_t*)vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
+   if(!pHddCtx) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   hdd_reset_all_adapters(pHddCtx);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    /* unregister suspend/resume callbacks */
+    if(pHddCtx->cfg_ini->nEnableSuspend)
+    {
+        unregister_wlan_suspend();
+    }
+#endif
+   /* DeRegister with platform driver as client for Suspend/Resume */
+   vosStatus = hddDeregisterPmOps(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDeregisterPmOps failed",__func__);
+   }
+
+   vosStatus = hddDevTmUnregisterNotifyCallback(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDevTmUnregisterNotifyCallback failed",__func__);
+   }
+
+   /* Disable IMPS/BMPS as we do not want the device to enter any power
+    * save mode on its own during reset sequence
+    */
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_UAPSD_MODE_POWER_SAVE);
+
+   vosSchedContext = get_vos_sched_ctxt();
+
+   /* Wakeup all driver threads */
+   if(TRUE == pHddCtx->isMcThreadSuspended){
+      complete(&vosSchedContext->ResumeMcEvent);
+      pHddCtx->isMcThreadSuspended= FALSE;
+   }
+   if(TRUE == pHddCtx->isTxThreadSuspended){
+      complete(&vosSchedContext->ResumeTxEvent);
+      pHddCtx->isTxThreadSuspended= FALSE;
+   }
+   if(TRUE == pHddCtx->isRxThreadSuspended){
+      complete(&vosSchedContext->ResumeRxEvent);
+      pHddCtx->isRxThreadSuspended= FALSE;
+   }
+   /* Reset the Suspend Variable */
+   pHddCtx->isWlanSuspended = FALSE;
+
+   /* Stop all the threads; we do not want any messages to be a processed,
+    * any more and the best way to ensure that is to terminate the threads
+    * gracefully.
+    */
+   /* Wait for MC to exit */
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down MC thread",__func__);
+   set_bit(MC_SHUTDOWN_EVENT_MASK, &vosSchedContext->mcEventFlag);
+   set_bit(MC_POST_EVENT_MASK, &vosSchedContext->mcEventFlag);
+   wake_up_interruptible(&vosSchedContext->mcWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->McShutdown);
+
+   /* Wait for TX to exit */
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down TX thread",__func__);
+   set_bit(TX_SHUTDOWN_EVENT_MASK, &vosSchedContext->txEventFlag);
+   set_bit(TX_POST_EVENT_MASK, &vosSchedContext->txEventFlag);
+   wake_up_interruptible(&vosSchedContext->txWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->TxShutdown);
+
+   /* Wait for RX to exit */
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down RX thread",__func__);
+   set_bit(RX_SHUTDOWN_EVENT_MASK, &vosSchedContext->rxEventFlag);
+   set_bit(RX_POST_EVENT_MASK, &vosSchedContext->rxEventFlag);
+   wake_up_interruptible(&vosSchedContext->rxWaitQueue);
+   wait_for_completion_interruptible(&vosSchedContext->RxShutdown);
+
+#ifdef WLAN_BTAMP_FEATURE
+   vosStatus = WLANBAP_Stop(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to stop BAP",__func__);
+   }
+#endif //WLAN_BTAMP_FEATURE
+   vosStatus = vos_wda_shutdown(pVosContext);
+   VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing SME STOP",__func__);
+   /* Stop SME - Cannot invoke vos_stop as vos_stop relies
+    * on threads being running to process the SYS Stop
+    */
+   vosStatus = sme_Stop(pHddCtx->hHal, TRUE);
+   VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing MAC STOP",__func__);
+   /* Stop MAC (PE and HAL) */
+   vosStatus = macStop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET);
+   VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
+
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing TL STOP",__func__);
+   /* Stop TL */
+   vosStatus = WLANTL_Stop(pVosContext);
+   VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_unregister_mcast_bcast_filter(pHddCtx);
+#endif
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Flush Queues",__func__);
+   /* Clean up message queues of TX and MC thread */
+   vos_sched_flush_mc_mqs(vosSchedContext);
+   vos_sched_flush_tx_mqs(vosSchedContext);
+   vos_sched_flush_rx_mqs(vosSchedContext);
+
+   /* Deinit all the TX and MC queues */
+   vos_sched_deinit_mqs(vosSchedContext);
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Doing VOS Shutdown",__func__);
+
+   /* shutdown VOSS */
+   vos_shutdown(pVosContext);
+   if (free_riva_power_on_lock("wlan"))
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to free power on lock",
+                                           __func__);
+   }
+   hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN driver shutdown complete"
+                                   ,__func__);
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+/* the HDD interface to WLAN driver re-init.
+ * This is called to initialize/start WLAN driver after a shutdown.
+ */
+VOS_STATUS hdd_wlan_re_init(void)
+{
+   VOS_STATUS       vosStatus;
+   v_CONTEXT_t      pVosContext = NULL;
+   hdd_context_t    *pHddCtx = NULL;
+   eHalStatus       halStatus;
+#ifdef WLAN_BTAMP_FEATURE
+   hdd_config_t     *pConfig = NULL;
+   WLANBAP_ConfigType btAmpConfig;
+#endif
+
+   hdd_prevent_suspend();
+   /* Re-open VOSS, it is a re-open b'se control transport was never closed. */
+   vosStatus = vos_open(&pVosContext, 0);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_open failed",__func__);
+      goto err_re_init;
+   }
+
+   /* Get the HDD context. */
+   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
+   if(!pHddCtx)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      goto err_vosclose;
+   }
+
+   /* Save the hal context in Adapter */
+   pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pVosContext );
+   if ( NULL == pHddCtx->hHal )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HAL context is null",__func__);
+      goto err_vosclose;
+   }
+
+   /* Set the SME configuration parameters. */
+   vosStatus = hdd_set_sme_config(pHddCtx);
+   if ( VOS_STATUS_SUCCESS != vosStatus )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed hdd_set_sme_config",__func__);
+      goto err_vosclose;
+   }
+
+   /* Initialize the WMM module */
+   vosStatus = hdd_wmm_init(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: hdd_wmm_init failed", __FUNCTION__);
+      goto err_vosclose;
+   }
+
+   vosStatus = vos_preStart( pHddCtx->pvosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
+      goto err_vosclose;
+   }
+
+   /* In the integrated architecture we update the configuration from
+      the INI file and from NV before vOSS has been started so that
+      the final contents are available to send down to the cCPU   */
+   /* Apply the cfg.ini to cfg.dat */
+   if (FALSE == hdd_update_config_dat(pHddCtx))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: config update failed",__func__ );
+      goto err_vosclose;
+   }
+
+   /* Set the MAC Address, currently this is used by HAL to add self sta.
+    * Remove this once self sta is added as part of session open. */
+   halStatus = cfgSetStr(pHddCtx->hHal, WNI_CFG_STA_ID,
+         (v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[0],
+           sizeof(pHddCtx->cfg_ini->intfMacAddr[0]));
+   if (!HAL_STATUS_SUCCESS(halStatus))
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failed to set MAC Address. "
+            "HALStatus is %08d [x%08x]",__func__, halStatus, halStatus);
+      goto err_vosclose;
+   }
+
+   /* Start VOSS which starts up the SME/MAC/HAL modules and everything else
+      Note: Firmware image will be read and downloaded inside vos_start API */
+   vosStatus = vos_start( pVosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
+      goto err_vosclose;
+   }
+
+   vosStatus = hdd_post_voss_start_config( pHddCtx );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_post_voss_start_config failed",
+         __func__);
+      goto err_vosstop;
+   }
+
+#ifdef WLAN_BTAMP_FEATURE
+   vosStatus = WLANBAP_Open(pVosContext);
+   if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to open BAP",__func__);
+      goto err_vosstop;
+   }
+   vosStatus = BSL_Init(pVosContext);
+   if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to Init BSL",__func__);
+     goto err_bap_close;
+   }
+   vosStatus = WLANBAP_Start(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to start TL",__func__);
+       goto err_bap_close;
+   }
+   pConfig = pHddCtx->cfg_ini;
+   btAmpConfig.ucPreferredChannel = pConfig->preferredChannel;
+   vosStatus = WLANBAP_SetConfig(&btAmpConfig);
+#endif //WLAN_BTAMP_FEATURE
+
+    /* Restart all adapters */
+   hdd_start_all_adapters(pHddCtx);
+   pHddCtx->isLogpInProgress = FALSE;
+   pHddCtx->hdd_mcastbcast_filter_set = FALSE;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_register_mcast_bcast_filter(pHddCtx);
+#endif
+
+   /* Register with platform driver as client for Suspend/Resume */
+   vosStatus = hddRegisterPmOps(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__);
+      goto err_bap_stop;
+   }
+   // Register suspend/resume callbacks
+   if(pHddCtx->cfg_ini->nEnableSuspend)
+   {
+      register_wlan_suspend();
+   }
+   /* Allow the phone to go to sleep */
+   hdd_allow_suspend();
+   /* register for riva power on lock */
+   if (req_riva_power_on_lock("wlan"))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: req riva power on lock failed",
+                                        __func__);
+      goto err_unregister_pmops;
+   }
+   goto success;
+
+err_unregister_pmops:
+   hddDeregisterPmOps(pHddCtx);
+
+err_bap_stop:
+#ifdef WLAN_BTAMP_FEATURE
+  WLANBAP_Stop(pVosContext);
+#endif
+
+#ifdef WLAN_BTAMP_FEATURE
+err_bap_close:
+   WLANBAP_Close(pVosContext);
+#endif
+
+err_vosstop:
+   vos_stop(pVosContext);
+
+err_vosclose:
+   vos_close(pVosContext);
+   vos_sched_close(pVosContext);
+   if (pHddCtx)
+   {
+#ifdef CONFIG_HAS_EARLYSUSPEND
+       /* unregister suspend/resume callbacks */
+       if (pHddCtx->cfg_ini->nEnableSuspend)
+           unregister_wlan_suspend();
+#endif
+       /* Unregister the Net Device Notifier */
+       unregister_netdevice_notifier(&hdd_netdev_notifier);
+       /* Clean up HDD Nlink Service */
+       send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+       nl_srv_exit();
+       hdd_close_all_adapters(pHddCtx);
+       /* Free up dynamically allocated members inside HDD Adapter */
+       kfree(pHddCtx->cfg_ini);
+       pHddCtx->cfg_ini= NULL;
+
+#ifdef CONFIG_CFG80211
+       wiphy_unregister(pHddCtx->wiphy);
+       wiphy_free(pHddCtx->wiphy);
+#else
+       vos_mem_free(pHddCtx);
+#endif
+   }
+   vos_preClose(&pVosContext);
+
+#ifdef MEMORY_DEBUG
+   vos_mem_exit();
+#endif
+
+err_re_init:
+   /* Allow the phone to go to sleep */
+   hdd_allow_suspend();
+   return -1;
+
+success:
+   /* Trigger replay of BTC events */
+   send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+   return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/HDD/src/wlan_hdd_ftm.c b/CORE/HDD/src/wlan_hdd_ftm.c
new file mode 100644
index 0000000..f3122db
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_ftm.c
@@ -0,0 +1,4736 @@
+/*
+ * 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  wlan_hdd_ftm.c
+
+  \brief This file contains the WLAN factory test mode implementation
+
+   Copyright 2008 (c) 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
+  --------    ---    --------------------------------------------------------
+  04/20/11    Leo/Henri      Convergence for Prima and Volans. Single image
+                             for FTM and mission mode
+  04/5/09     Shailender     Created module.
+
+  ==========================================================================*/
+#include <vos_mq.h>
+#include "vos_sched.h"
+#include <vos_api.h>
+#include "sirTypes.h"
+#include "halTypes.h"
+#include "sirApi.h"
+#include "sirMacProtDef.h"
+#include "sme_Api.h"
+#include "macInitApi.h"
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_sal.h"
+#include "wlan_qct_bal.h"
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+#include "wlan_qct_sys.h"
+#include "wlan_qct_tl.h"
+#include "wlan_hdd_misc.h"
+#include "i_vos_packet.h"
+#include "vos_nvitem.h"
+#include "wlan_hdd_main.h"
+#include "vos_power.h"
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#include "ani_assert.h"
+#include "sys_api.h"
+#include "pttModuleApi.h"
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+#include "qwlan_version.h"
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_nv.h"
+#include "wlan_qct_wda.h"
+#include "cfgApi.h"
+#include "pttMsgApi.h"
+#include "wlan_qct_pal_device.h"
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#ifdef ANI_MANF_DIAG
+#define RXMODE_DISABLE_ALL 0
+#define RXMODE_ENABLE_ALL  1
+#define RXMODE_ENABLE_11GN 2
+#define RXMODE_ENABLE_11B  3
+
+#define FTM_CHAIN_SEL_NO_RX_TX      0
+#define FTM_CHAIN_SEL_R0_ON         1
+#define FTM_CHAIN_SEL_T0_ON         2
+#define FTM_CHAIN_SEL_R0_T0_ON      3
+#define FTM_CHAIN_SEL_MAX           3
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#ifndef QWLAN_PHYDBG_BASE
+#define QWLAN_PHYDBG_BASE                   0x03004000
+#endif /* QWLAN_PHYDBG_BASE */
+
+#ifndef QWLAN_PHYDBG_TXPKT_CNT_REG
+#define QWLAN_PHYDBG_TXPKT_CNT_REG          QWLAN_PHYDBG_BASE + 0x6C
+#define QWLAN_PHYDBG_TXPKT_CNT_CNT_MASK     0xFFFF
+#endif
+
+#ifndef QWLAN_AGC_BASE
+#define QWLAN_AGC_BASE                      0x03013C00
+#endif /* QWLAN_AGC_BASE */
+
+#ifndef QWLAN_AGC_CHANNEL_FREQ_REG
+#define QWLAN_AGC_CHANNEL_FREQ_REG          QWLAN_AGC_BASE + 0x34
+#define QWLAN_AGC_CHANNEL_FREQ_FREQ_MASK    0x1FFF
+#endif /* QWLAN_AGC_CHANNEL_FREQ_REG */
+
+#ifndef QWLAN_AGC_SUBBAND_CONFIG_REG
+#define QWLAN_AGC_SUBBAND_CONFIG_REG        QWLAN_AGC_BASE + 0x30
+#define QWLAN_AGC_SUBBAND_CONFIG_STG2_SUBBAND_MASK  0x03
+#endif /* QWLAN_AGC_SUBBAND_CONFIG_REG */
+
+#ifndef QWLAN_RFAPB_BASE
+#define QWLAN_RFAPB_BASE                    0x0E02F800
+#endif /* QWLAN_RFAPB_BASE */
+
+#ifndef QWLAN_RFAPB_REV_ID_REG
+#define QWLAN_RFAPB_REV_ID_REG              QWLAN_RFAPB_BASE + 0x00
+#endif /* QWLAN_RFAPB_REV_ID_REG */
+
+#ifndef QWLAN_TXCTL_BASE
+#define QWLAN_TXCTL_BASE                    0x03012000
+#endif /* QWLAN_TXCTL_BASE */
+
+#ifndef QWLAN_TXCTL_FSHIFT_REG
+#define QWLAN_TXCTL_FSHIFT_REG              QWLAN_TXCTL_BASE + 0x20
+#define QWLAN_TXCTL_FSHIFT_BW14_OFFSET      0x02
+#define QWLAN_TXCTL_FSHIFT_BW14_MASK        0x1C
+#define QWLAN_TXCTL_FSHIFT_BW12_OFFSET      0x00
+#define QWLAN_TXCTL_FSHIFT_BW12_MASK        0x03
+#endif /* QWLAN_TXCTL_FSHIFT_REG */
+
+/* To set 4MAC addresses from given first MAC address,
+ * Last byte value within given MAC address must less than 0xFF - 3 */
+#define QWLAN_MAX_MAC_LAST_BYTE_VALUE       0xFC
+
+typedef struct {
+   tANI_U32 tableSize;                      /* Whole NV Table Size */
+   tANI_U32 chunkSize;                      /* Current Chunk Size < 2K */
+   eNvTable nvTable;
+   tANI_U8  tableData;                     /* Filled by host driver */
+} pttGetNvTable;
+
+typedef struct {
+   tANI_U32 tableSize;                      /* Whole NV Table Size */
+   tANI_U32 chunkSize;                      /* Current Chunk Size < 2K */
+   eNvTable nvTable;
+   tANI_U8  tableData; 
+} pttSetNvTable;
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+extern const sHalNv nvDefaults;
+static int wlan_ftm_register_wext(hdd_adapter_t *pAdapter);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+static v_VOID_t ftm_vos_sys_probe_thread_cback( v_VOID_t *pUserData );
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/* for PRIMA: all the available frequency, channal pair i the table are defined for channel frequency @ RF center frequency 
+   Since it is associated to agc.channel_freq register for mapping.
+   For channel bonding, the channel number is +2 or -2 for CB with primary high, or with primary low respectively.
+*/
+static const freq_chan_t  freq_chan_tbl[] = {
+     {2412, 1}, {2417, 2},{2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7},
+     {2447, 8}, {2452, 9},{2457, 10},{2462, 11},{2467 ,12},{2472, 13},{2484, 14}
+};
+
+static rateStr2rateIndex_t rateName_rateIndex_tbl[] =
+{
+   { HAL_PHY_RATE_11B_LONG_1_MBPS,       "11B_LONG_1_MBPS"},
+   { HAL_PHY_RATE_11B_LONG_2_MBPS,       "11B_LONG_2_MBPS"},
+   { HAL_PHY_RATE_11B_LONG_5_5_MBPS,     "11B_LONG_5_5_MBPS"},
+   { HAL_PHY_RATE_11B_LONG_11_MBPS,      "11B_LONG_11_MBPS"},
+   { HAL_PHY_RATE_11B_SHORT_2_MBPS,      "11B_SHORT_2_MBPS"},
+   { HAL_PHY_RATE_11B_SHORT_5_5_MBPS,    "11B_SHORT_5_5_MBPS"},
+   { HAL_PHY_RATE_11B_SHORT_11_MBPS,     "11B_SHORT_11_MBPS"},
+   //Spica_Virgo 11A 20MHz Rates
+   { HAL_PHY_RATE_11A_6_MBPS,            "11A_6_MBPS"},
+   { HAL_PHY_RATE_11A_9_MBPS,            "11A_9_MBPS"},
+   { HAL_PHY_RATE_11A_12_MBPS,           "11A_12_MBPS"},
+   { HAL_PHY_RATE_11A_18_MBPS,           "11A_18_MBPS"},
+   { HAL_PHY_RATE_11A_24_MBPS,           "11A_24_MBPS"},
+   { HAL_PHY_RATE_11A_36_MBPS,           "11A_36_MBPS"},
+   { HAL_PHY_RATE_11A_48_MBPS,           "11A_48_MBPS"},
+   { HAL_PHY_RATE_11A_54_MBPS,           "11A_54_MBPS"},
+
+//MCS Index #0-15 (20MHz)
+   { HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,   "MCS_6_5_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_13_MBPS,    "MCS_13_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,  "MCS_19_5_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_26_MBPS,    "MCS_26_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_39_MBPS,    "MCS_39_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_52_MBPS,    "MCS_52_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,  "MCS_58_5_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_65_MBPS,    "MCS_65_MBPS"},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS, "MCS_72_2_MBPS"}
+};
+
+static rateIndex2Preamble_t rate_index_2_preamble_table[] =
+{
+
+   { HAL_PHY_RATE_11B_LONG_1_MBPS,       PHYDBG_PREAMBLE_LONGB},
+   { HAL_PHY_RATE_11B_LONG_2_MBPS,       PHYDBG_PREAMBLE_LONGB},
+   { HAL_PHY_RATE_11B_LONG_5_5_MBPS,     PHYDBG_PREAMBLE_LONGB},
+   { HAL_PHY_RATE_11B_LONG_11_MBPS,      PHYDBG_PREAMBLE_LONGB},
+   { HAL_PHY_RATE_11B_SHORT_2_MBPS,      PHYDBG_PREAMBLE_SHORTB},
+   { HAL_PHY_RATE_11B_SHORT_5_5_MBPS,    PHYDBG_PREAMBLE_SHORTB},
+   { HAL_PHY_RATE_11B_SHORT_11_MBPS,     PHYDBG_PREAMBLE_SHORTB},
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    //SLR Rates
+   { HAL_PHY_RATE_SLR_0_25_MBPS,        PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_SLR_0_5_MBPS,         PHYDBG_PREAMBLE_NOT_SUPPORTED},
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+   //Spica_Virgo 11A 20MHz Rates
+   { HAL_PHY_RATE_11A_6_MBPS,           PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_9_MBPS,           PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_12_MBPS,          PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_18_MBPS,          PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_24_MBPS,          PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_36_MBPS,          PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_48_MBPS,          PHYDBG_PREAMBLE_OFDM},
+   { HAL_PHY_RATE_11A_54_MBPS,          PHYDBG_PREAMBLE_OFDM},
+
+   //MCS Index #0-15 (20MHz)
+   { HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,   PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_13_MBPS,    PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,  PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_26_MBPS,    PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_39_MBPS,    PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_52_MBPS,    PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,  PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_65_MBPS,    PHYDBG_PREAMBLE_MIXED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS, PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS, PHYDBG_PREAMBLE_NOT_SUPPORTED},
+   { HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS, PHYDBG_PREAMBLE_MIXED},
+};
+
+typedef struct
+{
+    tANI_BOOLEAN frameGenEnabled;
+    tANI_BOOLEAN wfmEnabled;
+    sPttFrameGenParams frameParams;
+    v_U16_t txpower;
+    v_U16_t rxmode;
+    v_U16_t chainSelect;
+
+} FTM_STATUS ;
+static FTM_STATUS ftm_status;
+
+//tpAniSirGlobal pMac;
+
+static void _ftm_status_init(void)
+{
+    tANI_U8 addr1[ANI_MAC_ADDR_SIZE] = { 0x00, 0x11, 0x11, 0x11, 0x11, 0x11 };   //dest
+    tANI_U8 addr2[ANI_MAC_ADDR_SIZE] = { 0x00, 0x22, 0x22, 0x22, 0x22, 0x22 };   //sour
+    tANI_U8 addr3[ANI_MAC_ADDR_SIZE] = { 0x00, 0x33, 0x33, 0x33, 0x33, 0x33 };   //bssId
+
+    ftm_status.wfmEnabled = eANI_BOOLEAN_FALSE;
+    ftm_status.frameGenEnabled = eANI_BOOLEAN_FALSE;
+    ftm_status.frameParams.numTestPackets = 0;   //Continuous
+    ftm_status.frameParams.interFrameSpace = 10;
+    ftm_status.frameParams.rate = HAL_PHY_RATE_11A_6_MBPS;
+    ftm_status.frameParams.payloadContents = TEST_PAYLOAD_RANDOM;
+    ftm_status.frameParams.payloadLength = 2000;
+    ftm_status.frameParams.payloadFillByte = 0xA5;
+    ftm_status.frameParams.pktAutoSeqNum = eANI_BOOLEAN_FALSE;
+    ftm_status.frameParams.tx_mode = 0;
+    ftm_status.frameParams.crc = 0;
+    ftm_status.frameParams.preamble = PHYDBG_PREAMBLE_OFDM;
+    memcpy(&ftm_status.frameParams.addr1[0], addr1, ANI_MAC_ADDR_SIZE);
+    memcpy(&ftm_status.frameParams.addr2[0], addr2, ANI_MAC_ADDR_SIZE);
+    memcpy(&ftm_status.frameParams.addr3[0], addr3, ANI_MAC_ADDR_SIZE);
+    ftm_status.txpower = 2 ;
+    ftm_status.rxmode = RXMODE_ENABLE_ALL; /* macStart() enables all receive pkt types */
+    ftm_status.chainSelect = FTM_CHAIN_SEL_R0_T0_ON;
+
+    return;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_postmsg() -
+
+   The function used for sending the command to the halphy.
+
+  \param  - cmd_ptr - Pointer command buffer.
+
+  \param  - cmd_len - Command length.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static v_U32_t wlan_ftm_postmsg(v_U8_t *cmd_ptr, v_U16_t cmd_len)
+{
+    vos_msg_t   *ftmReqMsg;
+    vos_msg_t    ftmMsg;
+    ENTER();
+
+    ftmReqMsg = (vos_msg_t *) cmd_ptr;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    ftmMsg.type = WDA_FTM_CMD_REQ;
+#else
+    ftmMsg.type = ftmReqMsg->type;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+    ftmMsg.reserved = 0;
+    ftmMsg.bodyptr = (v_U8_t*)cmd_ptr;
+    ftmMsg.bodyval = 0;
+
+    /* Use Vos messaging mechanism to send the command to halPhy */
+    /*
+       Note that VOS_MODULE_ID_HAL corresponds to VOS_MODULE_ID_WDA
+       for INTEGRATED_SOC. SO this code is left as it is.
+    */
+    if (VOS_STATUS_SUCCESS != vos_mq_post_message(
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+        VOS_MODULE_ID_HAL,
+#else
+        VOS_MODULE_ID_WDA,
+#endif
+                                    (vos_msg_t *)&ftmMsg)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: : Failed to post Msg to HAL\n",__func__);
+
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    EXIT();
+    return VOS_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+
+  \brief wlan_ftm_vos_open() - Open the vOSS Module
+
+  The \a wlan_ftm_vos_open() function opens the vOSS Scheduler
+  Upon successful initialization:
+
+     - All VOS submodules should have been initialized
+
+     - The VOS scheduler should have opened
+
+     - All the WLAN SW components should have been opened. This include
+       MAC.
+
+
+  \param  hddContextSize: Size of the HDD context to allocate.
+
+
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initialize the scheduler
+
+
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
+
+  \sa wlan_ftm_vos_open()
+
+---------------------------------------------------------------------------*/
+static VOS_STATUS wlan_ftm_vos_open( v_CONTEXT_t pVosContext, v_SIZE_t hddContextSize )
+{
+   VOS_STATUS vStatus      = VOS_STATUS_SUCCESS;
+   int iter                = 0;
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+   tMacOpenParameters macOpenParms;
+   pVosContextType gpVosContext = (pVosContextType)pVosContext;
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: Opening VOSS", __func__);
+
+   if (NULL == gpVosContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Trying to open VOSS without a PreOpen",__func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Initialize the probe event */
+   if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Unable to init probeEvent",__func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   if(vos_event_init(&(gpVosContext->wdaCompleteEvent)) != VOS_STATUS_SUCCESS )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Unable to init wdaCompleteEvent",__func__);
+      VOS_ASSERT(0);
+    
+      goto err_probe_event;
+   }
+#endif /*FEATURE_WLAN_INTEGRATED_SOC */
+
+   /* Initialize the free message queue */
+   vStatus = vos_mq_init(&gpVosContext->freeVosMq);
+   if (! VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to initialize VOS free message queue",__func__);
+      VOS_ASSERT(0);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      goto err_wda_complete_event;
+#else
+      goto err_probe_event;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+   }
+
+   for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
+   {
+      (gpVosContext->aMsgWrappers[iter]).pVosMsg =
+         &(gpVosContext->aMsgBuffers[iter]);
+      INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode);
+      vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter]));
+   }
+
+   /* Now Open the VOS Scheduler */
+   vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched,
+                           sizeof(VosSchedContext));
+
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to open VOS Scheduler", __func__);
+      VOS_ASSERT(0);
+      goto err_msg_queue;
+   }
+
+   /* Open the SYS module */
+   vStatus = sysOpen(gpVosContext);
+
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to open SYS module",__func__);
+      VOS_ASSERT(0);
+      goto err_sched_close;
+   }
+
+ #ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /*Open the WDA module */
+   vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0);
+   macOpenParms.driverType = eDRIVER_TYPE_MFG;
+   vStatus = WDA_open(gpVosContext, gpVosContext->pHDDContext, &macOpenParms);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to open WDA module",__func__);
+      VOS_ASSERT(0);
+      goto err_sys_close;
+   }
+#endif
+
+   /* initialize the NV module */
+   vStatus = vos_nv_open();
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     // NV module cannot be initialized, however the driver is allowed
+     // to proceed
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to initialize the NV module", __func__);
+     goto err_wda_close;
+   }
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   /* Probe the MC thread */
+   sysMcThreadProbe(gpVosContext,
+                    &ftm_vos_sys_probe_thread_cback,
+                    gpVosContext);
+
+
+   if (vos_wait_single_event(&gpVosContext->ProbeEvent, 0)!= VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to probe MC Thread", __func__);
+      VOS_ASSERT(0);
+      goto err_nv_close;
+   }
+#endif
+   /* If we arrive here, both threads dispacthing messages correctly */
+
+   /* Now proceed to open the MAC */
+
+   /* UMA is supported in hardware for performing the
+      frame translation 802.11 <-> 802.3 */
+   macOpenParms.frameTransRequired = 1;
+   sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext,
+                         &macOpenParms);
+
+   if (eSIR_SUCCESS != sirStatus)
+   {
+     /* Critical Error ...  Cannot proceed further */
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to open MAC", __func__);
+     VOS_ASSERT(0);
+     goto err_nv_close;
+   }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   vStatus = WLANBAL_Open(gpVosContext);
+   if(!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to open BAL",__func__);
+     goto err_mac_close;
+   }
+#else
+   /* Now proceed to open the SME */
+   vStatus = sme_Open(gpVosContext->pMACContext);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Failed to open SME",__func__);
+      goto err_mac_close;
+   }
+   return VOS_STATUS_SUCCESS;
+
+#endif
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS successfully Opened",__func__);
+
+   return VOS_STATUS_SUCCESS;
+err_mac_close:
+   macClose(gpVosContext->pMACContext);
+
+err_nv_close:
+   vos_nv_close();
+
+err_wda_close:
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   WDA_close(gpVosContext);
+
+err_sys_close:
+#endif
+   sysClose(gpVosContext);
+
+err_sched_close:
+   vos_sched_close(gpVosContext);
+err_msg_queue:
+   vos_mq_deinit(&gpVosContext->freeVosMq);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+err_wda_complete_event:
+   vos_event_destroy(&gpVosContext->wdaCompleteEvent);
+#endif
+
+err_probe_event:
+   vos_event_destroy(&gpVosContext->ProbeEvent);
+
+   return VOS_STATUS_E_FAILURE;
+
+} /* wlan_ftm_vos_open() */
+
+/*---------------------------------------------------------------------------
+
+  \brief wlan_ftm_vos_close() - Close the vOSS Module
+
+  The \a wlan_ftm_vos_close() function closes the vOSS Module
+
+  \param vosContext  context of vos
+
+  \return VOS_STATUS_SUCCESS - successfully closed
+
+  \sa wlan_ftm_vos_close()
+
+---------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_vos_close( v_CONTEXT_t vosContext )
+{
+  VOS_STATUS vosStatus;
+  pVosContextType gpVosContext = (pVosContextType)vosContext;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = WLANBAL_Close(vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close BAL",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#else
+  vosStatus = sme_Close(((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close BAL",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif
+
+  vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close MAC",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  ((pVosContextType)vosContext)->pMACContext = NULL;
+
+  vosStatus = vos_nv_close();
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close NV",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+
+  vosStatus = sysClose( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close SYS",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = WDA_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close WDA",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+  vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
+
+  vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to destroy ProbeEvent",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to destroy wdaCompleteEvent",__func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif
+
+  return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_txifs() -
+
+   This function is used for
+
+  \param  - pAdapter - Pointer HDD Context.
+          - ifs
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+
+
+static VOS_STATUS wlan_ftm_priv_set_txifs(hdd_adapter_t *pAdapter,v_U32_t ifs)
+{
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot set txifs when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if (ifs > 100000) //max = (MSK_24 / ONE_MICROSECOND)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:ifs value is invalid ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    ftm_status.frameParams.interFrameSpace = ifs;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_txpktcnt() -
+
+   This function is used for
+
+  \param  - pAdapter - Pointer HDD Context.
+          - ifs
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_set_txpktcnt(hdd_adapter_t *pAdapter,v_U32_t cnt)
+{
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot set txpktcnt when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if (cnt > QWLAN_PHYDBG_TXPKT_CNT_CNT_MASK) //0xFFFF
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pktcnt value is invalid",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    ftm_status.frameParams.numTestPackets = cnt;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+static VOS_STATUS wlan_ftm_priv_set_txpktlen(hdd_adapter_t *pAdapter,v_U32_t len)
+{
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot set txpktcnt when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if (len > 4095) //4096
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:payload len is invalid",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    ftm_status.frameParams.payloadLength = (tANI_U16)len;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_enable_chain(hdd_adapter_t *pAdapter,v_U16_t chainSelect)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U16_t chainSelect_save = chainSelect;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if (chainSelect > FTM_CHAIN_SEL_MAX)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid chain",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot select chain when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    switch (chainSelect)
+    {
+        case FTM_CHAIN_SEL_NO_RX_TX:
+            chainSelect = PHY_CHAIN_SEL_NO_RX_TX;
+            break;
+
+        case FTM_CHAIN_SEL_R0_ON:
+            chainSelect = PHY_CHAIN_SEL_R0_ON;
+            break;
+
+        case FTM_CHAIN_SEL_T0_ON:
+            chainSelect = PHY_CHAIN_SEL_T0_ON;
+            break;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_ENABLE_CHAINS;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttEnableChains) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->EnableChains.chainSelect = chainSelect;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    ftm_status.chainSelect = chainSelect_save;
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+  --------------------------------------------------------------------------*/
+static VOS_STATUS wlan_ftm_priv_get_status(hdd_adapter_t *pAdapter,char *buf)
+{
+    int ii;
+    int lenBuf = WE_FTM_MAX_STR_LEN;
+    int lenRes = 0;
+    char *chain[] = {
+        "None",
+        "R0,R1",
+        "R0",
+        "R1",
+        "T0",
+        "R0,R1,T0"
+    };
+    char *rx[] = {
+        "disable",
+        "11b/g/n",
+        "11g/n",
+        "11b"
+    };
+    char *tx[] = {
+        "stopped",
+        "started",
+    };
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    lenRes = snprintf(buf, lenBuf, "\n chainSelect: %s\n rxmode: %s\n "
+                                   "txpktgen: %s\n  txifs: %ld\n  txrate: ",
+                      chain[ftm_status.chainSelect], rx[ftm_status.rxmode], 
+                      tx[ftm_status.frameGenEnabled], 
+                      ftm_status.frameParams.interFrameSpace);
+    if ((lenRes < 0) || (lenRes >= lenBuf))
+    {
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    for (ii = 0; ii < SIZE_OF_TABLE(rateName_rateIndex_tbl); ii++)
+    {
+        if (rateName_rateIndex_tbl[ii].rate_index == ftm_status.frameParams.rate)
+            break;
+    }
+
+    if (ii < SIZE_OF_TABLE(rateName_rateIndex_tbl))
+    {
+        lenRes = strlcpy(buf, rateName_rateIndex_tbl[ii].rate_str, lenBuf);
+    }
+    else
+    {
+        lenRes = strlcpy(buf, "invalid", lenBuf);
+    }
+    if ((lenRes < 0) || (lenRes >= lenBuf))
+    {
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    lenRes = snprintf(buf, lenBuf, "\n  txpower: %d\n  txpktcnt: %ld\n  "
+                                   "txpktlen: %d\n", ftm_status.txpower, 
+                      ftm_status.frameParams.numTestPackets, 
+                      ftm_status.frameParams.payloadLength);
+
+    if ((lenRes < 0) || (lenRes >= lenBuf))
+    {
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+v_VOID_t
+static ftm_vos_sys_probe_thread_cback
+(
+  v_VOID_t *pUserData
+)
+{
+    pVosContextType pVosContext= (pVosContextType)pUserData;
+    if (vos_event_set(&pVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "%s: vos_event_set failed", __FUNCTION__);
+        return;
+    }
+} /* vos_sys_probe_thread_cback() */
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+void HEXDUMP(char *s0, char *s1, int len)
+{
+    int tmp;
+    printk(KERN_EMERG "%s\n :", s0);
+
+    for (tmp = 0; tmp< len; tmp++) {
+        printk(KERN_EMERG "%02x ", *s1++);
+    }
+    printk("\n");
+}
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*---------------------------------------------------------------------------
+
+  \brief vos_ftm_preStart() -
+
+  The \a vos_ftm_preStart() function to download CFG.
+  including:
+      - ccmStart
+
+      - WDA: triggers the CFG download
+
+
+  \param  pVosContext: The VOS context
+
+
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initialize the scheduler
+
+
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
+
+  \sa vos_start
+
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_ftm_preStart( v_CONTEXT_t vosContext )
+{
+   VOS_STATUS vStatus          = VOS_STATUS_SUCCESS;
+   pVosContextType pVosContext = (pVosContextType)vosContext;
+   
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+             "vos prestart");
+
+
+   VOS_ASSERT( NULL != pVosContext->pWDAContext);
+
+   /* call macPreStart */
+   vStatus = macPreStart(pVosContext->pMACContext);
+   if ( !VOS_IS_STATUS_SUCCESS(vStatus) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+             "Failed at macPreStart ");
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* call ccmStart */
+   ccmStart(pVosContext->pMACContext);
+
+   /* Reset wda wait event */
+   vos_event_reset(&pVosContext->wdaCompleteEvent);   
+    
+
+   /*call WDA pre start*/
+   vStatus = WDA_preStart(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+             "Failed to WDA prestart ");
+      macStop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
+      ccmStop(pVosContext->pMACContext);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Need to update time out of complete */
+   vStatus = vos_wait_single_event( &pVosContext->wdaCompleteEvent, 1000);
+   if ( vStatus != VOS_STATUS_SUCCESS )
+   {
+      if ( vStatus == VOS_STATUS_E_TIMEOUT )
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s: Timeout occurred before WDA complete\n",__func__);
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: WDA_preStart reporting  other error \n",__func__);
+      }
+      VOS_ASSERT( 0 );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+#endif
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_open() -
+
+   The function hdd_wlan_startup calls this function to initialize the FTM specific modules.
+
+  \param  - pAdapter - Pointer HDD Context.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+int wlan_hdd_ftm_open(hdd_context_t *pHddCtx)
+{
+    VOS_STATUS vStatus       = VOS_STATUS_SUCCESS;
+    pVosContextType pVosContext= NULL;
+    hdd_adapter_t *pAdapter;
+    
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: Opening VOSS", __func__);
+
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+    if (NULL == pVosContext)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Trying to open VOSS without a PreOpen",__func__);
+        VOS_ASSERT(0);
+        goto err_vos_status_failure;
+    }
+
+   // Open VOSS
+   vStatus = wlan_ftm_vos_open( pVosContext, 0);
+
+   if ( !VOS_IS_STATUS_SUCCESS( vStatus ))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_open failed",__func__);
+      goto err_vos_status_failure;
+   }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /* Start SAL now */
+    vStatus = WLANSAL_Start(pVosContext);
+    if (!VOS_IS_STATUS_SUCCESS(vStatus))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+              "%s: Failed to start SAL",__func__);
+        goto err_vos_open_failure;
+    }
+
+       /* Save the hal context in Adapter */
+    pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_HAL, pVosContext );
+#else
+    /*
+     For Integrated SOC, only needed to start WDA, whihc happens in wlan_hdd_ftm_start()
+    */
+    /* Save the hal context in Adapter */
+    pHddCtx->hHal = (tHalHandle)vos_get_context(VOS_MODULE_ID_SME, pVosContext );
+#endif
+
+    if ( NULL == pHddCtx->hHal )
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: HAL context is null",__func__);
+       goto err_sal_close;
+    }
+
+    pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_FTM, "wlan%d",
+                wlan_hdd_get_intf_addr(pHddCtx), FALSE);
+    if( NULL == pAdapter )
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: hdd_open_adapter failed",__func__);
+               goto err_adapter_open_failure;
+    }
+
+    if( wlan_ftm_register_wext(pAdapter)!= 0 )
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%S: hdd_register_wext failed",__func__);
+       goto err_sal_close;
+    }
+
+       //Initialize the nlink service
+    if(nl_srv_init() != 0)
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%S: nl_srv_init failed",__func__);
+       goto err_ftm_register_wext_close;
+    }
+
+#ifdef PTT_SOCK_SVC_ENABLE
+    //Initialize the PTT service
+    if(ptt_sock_activate_svc(pHddCtx) != 0)
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: ptt_sock_activate_svc failed",__func__);
+       goto err_nl_srv_init;
+    }
+#endif
+    if (!VOS_IS_STATUS_SUCCESS(vos_chipVoteOnXOBuffer(NULL, NULL, NULL)))
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to configure 19.2 MHz Clock", __func__);
+        goto err_nl_srv_init;
+    }
+#ifdef HDD_SESSIONIZE
+    //Turn off carrier state
+    netif_carrier_off(pAdapter->dev);
+
+    //Stop the Interface TX queue. Just being safe
+    netif_tx_disable(pAdapter->dev);
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+   pHddCtx->ftm.targetNVTableSize    = 0;
+   pHddCtx->ftm.targetNVTablePointer = NULL;
+   pHddCtx->ftm.processedNVTableSize = 0;
+   pHddCtx->ftm.tempNVTableBuffer    = (v_U8_t *)vos_mem_malloc(MAX_NV_TABLE_SIZE);
+   if(NULL == pHddCtx->ftm.tempNVTableBuffer)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: NV Table Buffer Alloc Fail",__func__);
+      VOS_ASSERT(0);
+      goto err_nl_srv_init; 
+   }
+   vos_mem_zero((v_VOID_t *)pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+    _ftm_status_init();
+    /* Initialize the ftm vos event */
+    if (vos_event_init(&pHddCtx->ftm.ftm_vos_event) != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Unable to init probeEvent",__func__);
+        VOS_ASSERT(0);
+        vos_mem_free(pHddCtx->ftm.tempNVTableBuffer);
+        goto err_nl_srv_init;
+    }
+
+    pHddCtx->ftm.ftm_state = WLAN_FTM_INITIALIZED;
+
+    return VOS_STATUS_SUCCESS;
+
+err_nl_srv_init:
+nl_srv_exit();
+
+err_ftm_register_wext_close:
+hdd_UnregisterWext(pAdapter->dev);
+
+err_adapter_open_failure:
+hdd_close_all_adapters( pHddCtx );
+
+err_sal_close:
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+WLANSAL_Stop(pVosContext);
+
+err_vos_open_failure:
+wlan_ftm_vos_close(pVosContext);
+#endif 
+
+err_vos_status_failure:
+
+    return VOS_STATUS_E_FAILURE;
+}
+
+
+
+int wlan_hdd_ftm_close(hdd_context_t *pHddCtx)
+{
+    VOS_STATUS vosStatus;
+    v_CONTEXT_t vosContext = pHddCtx->pvosContext;
+
+    hdd_adapter_t *pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_FTM);
+    ENTER();
+    if(pAdapter == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pAdapter is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    vosStatus = WLANBAL_SuspendChip( pHddCtx->pvosContext );
+       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+    vosStatus = WLANSAL_Stop(pHddCtx->pvosContext);
+       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+    //Assert Deep sleep signal now to put Libra HW in lowest power state
+    vosStatus = vos_chipAssertDeepSleep( NULL, NULL, NULL );
+       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+    //Vote off any PMIC voltage supplies
+    vos_chipPowerDown(NULL, NULL, NULL);
+
+    vos_chipVoteOffXOBuffer(NULL, NULL, NULL);
+
+    nl_srv_exit();
+
+    //TODO----------
+    //Deregister the device with the kernel
+    hdd_UnregisterWext(pAdapter->dev);
+
+    hdd_close_all_adapters( pHddCtx );
+#if 0
+    if(test_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags)) 
+    {
+        unregister_netdev(pAdapter->dev);
+        clear_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags);
+    }
+#endif
+    //-----------------
+
+    vosStatus = vos_sched_close( vosContext );
+    if (!VOS_IS_STATUS_SUCCESS(vosStatus))       {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s: Failed to close VOSS Scheduler",__func__);
+       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+    }
+
+    //Close VOSS
+    wlan_ftm_vos_close(vosContext);
+
+
+    vosStatus = vos_event_destroy(&pHddCtx->ftm.ftm_vos_event);
+    if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to destroy ftm_vos Event",__func__);
+        VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+    }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    vos_mem_free(pHddCtx->ftm.tempNVTableBuffer);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+    //Free up dynamically allocated members inside HDD Adapter
+    kfree(pHddCtx->cfg_ini);
+    pHddCtx->cfg_ini= NULL;
+
+    return 0;
+
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_send_response() -
+
+   The function sends the response to the ptt socket application running in user space.
+
+  \param  - pAdapter - Pointer HDD Context.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_send_response(hdd_context_t *pHddCtx){
+
+   if( ptt_sock_send_msg_to_app(&pHddCtx->ftm.wnl->wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ftm.wnl->nlh.nlmsg_pid) < 0) {
+
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n"));
+       return VOS_STATUS_E_FAILURE;
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_start() -
+
+   This function gets called when the FTM start commands received from the ptt socket application and
+   it starts the following modules.
+   1) SAL Start.
+   2) BAL Start.
+   3) MAC Start to download the firmware.
+
+
+  \param  - pAdapter - Pointer HDD Context.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static int wlan_hdd_ftm_start(hdd_context_t *pHddCtx)
+{
+    VOS_STATUS vStatus          = VOS_STATUS_SUCCESS;
+    tSirRetStatus sirStatus      = eSIR_SUCCESS;
+    pVosContextType pVosContext = (pVosContextType)(pHddCtx->pvosContext);
+    tHalMacStartParameters halStartParams;
+
+    if (WLAN_FTM_STARTED == pHddCtx->ftm.ftm_state)
+    {
+       return VOS_STATUS_SUCCESS;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "%s: Starting Libra SW", __func__);
+
+    /* We support only one instance for now ...*/
+    if (pVosContext == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+           "%s: mismatch in context",__FUNCTION__);
+        goto err_status_failure;
+    }
+
+ #ifndef FEATURE_WLAN_INTEGRATED_SOC
+    if (pVosContext->pBALContext == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "%s: BAL NULL context",__FUNCTION__);
+        goto err_status_failure;
+    }
+#endif
+   
+    if (pVosContext->pMACContext == NULL)
+    {    
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "%s: MAC NULL context",__FUNCTION__);
+        goto err_status_failure;
+    }
+
+ #ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /* Start BAL */
+    vStatus = WLANBAL_Start(pVosContext);
+
+    if (!VOS_IS_STATUS_SUCCESS(vStatus))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+              "%s: Failed to start BAL",__func__);
+        goto err_sal_stop;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+             "%s: BAL correctly started",__func__);
+#else
+    /*
+      Prima needs to start the WDA correctly instead of BAL and SAL
+    */
+
+    /* Vos preStart is calling */
+    if ( !VOS_IS_STATUS_SUCCESS(vos_ftm_preStart(pHddCtx->pvosContext) ) )
+    {
+       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
+       goto err_status_failure;
+    }
+
+
+    vStatus = WDA_NVDownload_Start(pVosContext);
+
+    if ( vStatus != VOS_STATUS_SUCCESS )
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Failed to start NV Download",__func__);
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000);
+
+    if ( vStatus != VOS_STATUS_SUCCESS )
+    {
+       if ( vStatus == VOS_STATUS_E_TIMEOUT )
+       {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Timeout occurred before WDA_NVDownload_Start complete\n",__func__);
+       }
+       else
+       {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WDA_NVDownload_Start reporting  other error \n",__func__);
+       }
+       VOS_ASSERT(0);
+       goto err_wda_stop;   
+    }
+
+    vStatus = WDA_start(pVosContext);
+    if (vStatus != VOS_STATUS_SUCCESS)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Failed to start WDA",__func__);
+       goto err_status_failure;
+    }
+#endif
+    
+
+    /* Start the MAC */
+    vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters));
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /* Attempt to get the firmware binary through VOS.  We need to pass this
+           to the MAC when starting. */
+    vStatus = hdd_request_firmware(WLAN_FW_FILE, pHddCtx,
+                               (v_VOID_t **)&halStartParams.FW.pImage,
+                               (v_SIZE_t *)&halStartParams.FW.cbImage);
+
+    if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+             "%s: Failed to get firmware binary",__func__);
+        goto err_bal_stop;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+             "%s: Firmware binary file found",__func__);
+#endif
+
+    halStartParams.driverType = eDRIVER_TYPE_MFG;
+
+    /* Start the MAC */
+    sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams);
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /* Free uo the FW image no matter what */
+    if( NULL != halStartParams.FW.pImage )
+    {
+        hdd_release_firmware(WLAN_FW_FILE, pVosContext->pHDDContext);
+        halStartParams.FW.pImage = NULL;
+        halStartParams.FW.cbImage = 0;
+    }
+#endif
+
+    if (eSIR_SUCCESS != sirStatus)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+              "%s: Failed to start MAC", __func__);
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+        goto err_bal_stop;
+#else
+        goto err_wda_stop;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "%s: MAC correctly started",__func__);
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+
+   /**
+   EVM issue is observed with 1.6Mhz freq for 1.3V RF supply in wlan standalone case.
+   During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed. 
+   To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+   during exit.
+   Since using 3.2Mhz has a side effect on power (extra 200ua), this is left configurable.
+   If customers do their design right, they should not see the EVM issue and in that case they
+   can decide to keep 1.6Mhz by setting an NV.
+   If NV item is not present, use the default 3.2Mhz
+   vos_stop is also invoked if wlan startup seq fails (after vos_start, where 3.2Mhz is voted.)
+   */
+  {
+   sFreqFor1p3VSupply freq;
+   vStatus = vos_nv_read( NV_TABLE_FREQUENCY_FOR_1_3V_SUPPLY, &freq, NULL,
+         sizeof(freq) );
+   if (VOS_STATUS_SUCCESS != vStatus)
+    freq.freqFor1p3VSupply = VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_3P2MH;
+
+    if (vos_chipVoteFreqFor1p3VSupply(NULL, NULL, NULL, freq.freqFor1p3VSupply) != VOS_STATUS_SUCCESS)
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to set the freq %d for 1.3V Supply",__func__,freq.freqFor1p3VSupply );
+  }
+
+
+    /* START SYS. This will trigger the CFG download */
+    sysMcStart(pVosContext, ftm_vos_sys_probe_thread_cback, pVosContext);
+#endif
+
+    pHddCtx->ftm.ftm_state = WLAN_FTM_STARTED;
+
+    return VOS_STATUS_SUCCESS;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+err_bal_stop:
+WLANBAL_Stop(pVosContext);
+
+err_sal_stop:
+WLANSAL_Stop(pVosContext);
+
+#else
+err_wda_stop:   
+   vos_event_reset(&(pVosContext->wdaCompleteEvent));
+   WDA_stop(pVosContext, HAL_STOP_TYPE_RF_KILL);
+   vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000);
+   if(vStatus != VOS_STATUS_SUCCESS)
+   {
+      if(vStatus == VOS_STATUS_E_TIMEOUT)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Timeout occurred before WDA_stop complete\n",__func__);
+
+      }
+      else
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                  "%s: WDA_stop reporting  other error \n",__func__);
+      }
+      VOS_ASSERT(0);
+   }
+#endif
+
+err_status_failure:
+
+    return VOS_STATUS_E_FAILURE;
+
+}
+
+
+static int wlan_ftm_stop(hdd_context_t *pHddCtx)
+{
+   VOS_STATUS vosStatus;
+
+   if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+       return VOS_STATUS_E_FAILURE;
+   }
+
+   //if(pHddCtx->ftm.cmd_iwpriv == TRUE)
+   {
+       /*  STOP MAC only */
+       v_VOID_t *hHal;
+       hHal = vos_get_context( VOS_MODULE_ID_SME, pHddCtx->pvosContext );
+       if (NULL == hHal)
+       {
+           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                      "%s: NULL hHal", __func__);
+       }
+       else
+       {
+           vosStatus = macStop(hHal, HAL_STOP_TYPE_SYS_DEEP_SLEEP );
+           if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+           {
+               VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                          "%s: Failed to stop SYS", __func__);
+               VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+           }
+       }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+       vosStatus = WLANBAL_Stop( pHddCtx->pvosContext );
+       if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+       {
+           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             "%s: Failed to stop BAL",__func__);
+           VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+       }
+
+       /**
+       EVM issue is observed with 1.6Mhz freq for 1.3V supply in wlan standalone case.
+       During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed. 
+       To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+       during exit.
+       vos_stop is also invoked if wlan startup seq fails (after vos_start, where 3.2Mhz is voted.)
+       */
+       if (vos_chipVoteFreqFor1p3VSupply(NULL, NULL, NULL, VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_1P6MH) != VOS_STATUS_SUCCESS)
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Failed to set the freq to 1.6Mhz for 1.3V Supply",__func__ );
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+       WDA_stop(pHddCtx->pvosContext, HAL_STOP_TYPE_RF_KILL);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+    }
+   return WLAN_FTM_SUCCESS;
+}
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_get_nv_table() -
+            Get Specific NV table
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             1, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_get_nv_table
+(
+   hdd_context_t  *pHddCtx,
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   VOS_STATUS          nvStatus = VOS_STATUS_SUCCESS;
+   pttGetNvTable      *nvTable = (pttGetNvTable *)&ftmCmd->msgBody.GetNvTable;
+   v_SIZE_t            nvSize;
+   sHalNv             *nvContents = NULL;
+
+   if (NULL == pHddCtx)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Not valid driver context");
+      return -1;
+   }
+
+   /* Test first chunk of NV table */
+   if ((NV_MAX_TABLE == pHddCtx->ftm.processingNVTable) ||
+      (0 == pHddCtx->ftm.processedNVTableSize))
+   {
+      nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+      if ((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "Fail to get cached NV value Status %d", nvStatus);
+         return -1;
+      }
+
+      switch (nvTable->nvTable)
+      {
+         case NV_TABLE_RATE_POWER_SETTINGS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.pwrOptimum);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pwrOptimum;
+            break;
+
+         case NV_TABLE_REGULATORY_DOMAINS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.regDomains);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.regDomains;
+            break;
+
+         case NV_TABLE_DEFAULT_COUNTRY:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.defaultCountryTable);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.defaultCountryTable;
+            break;
+
+         case NV_TABLE_TPC_POWER_TABLE:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.plutCharacterized);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.plutCharacterized[0];
+            break;
+
+         case NV_TABLE_TPC_PDADC_OFFSETS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.plutPdadcOffset);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.plutPdadcOffset[0];
+            break;
+
+         case NV_TABLE_VIRTUAL_RATE:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.pwrOptimum_virtualRate);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pwrOptimum_virtualRate[0];
+            break;
+
+         case NV_TABLE_RSSI_CHANNEL_OFFSETS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.rssiChanOffsets);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.rssiChanOffsets[0];
+            break;
+
+         case NV_TABLE_RF_CAL_VALUES:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.rFCalValues);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.rFCalValues;
+            break;
+
+         case NV_TABLE_ANTENNA_PATH_LOSS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.antennaPathLoss);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.antennaPathLoss[0];
+            break;
+
+         case NV_TABLE_PACKET_TYPE_POWER_LIMITS:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.pktTypePwrLimits);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pktTypePwrLimits[0][0];
+            break;
+
+         default:
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                       "Not Valid NV Table %d", nvTable->nvTable);
+            return -1;
+            break;
+      }
+
+      if (pHddCtx->ftm.targetNVTableSize != nvTable->tableSize)
+      {
+         /* Invalid table size, discard and initialize data */
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "Invalid Table Size %d", nvTable->tableSize);
+         pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+         pHddCtx->ftm.targetNVTableSize    = 0;
+         pHddCtx->ftm.processedNVTableSize = 0;
+         vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+         return -1;
+      }
+
+      /* Set Current Processing NV table type */
+      pHddCtx->ftm.processingNVTable = nvTable->nvTable;
+      /* Copy target NV table value into temp context buffer */
+      vos_mem_copy(pHddCtx->ftm.tempNVTableBuffer,
+                   pHddCtx->ftm.targetNVTablePointer,
+                   pHddCtx->ftm.targetNVTableSize);
+
+   }
+
+   if (pHddCtx->ftm.processingNVTable != nvTable->nvTable)
+   {
+      /* Invalid table type */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                 "Invalid NV Table, now Processing %d, not %d",
+                  pHddCtx->ftm.processingNVTable, nvTable->nvTable);
+      pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+      pHddCtx->ftm.targetNVTableSize    = 0;
+      pHddCtx->ftm.processedNVTableSize = 0;
+      vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+ 
+      return -1;
+   }
+
+   /* Copy next chunk of NV table value into response buffer */
+   vos_mem_copy(&nvTable->tableData, 
+                pHddCtx->ftm.tempNVTableBuffer + pHddCtx->ftm.processedNVTableSize,
+                nvTable->chunkSize);
+   /* Update processed pointer to prepare next chunk copy */
+   pHddCtx->ftm.processedNVTableSize += nvTable->chunkSize;
+
+   if (pHddCtx->ftm.targetNVTableSize == pHddCtx->ftm.processedNVTableSize)
+   {
+      /* Finished to process last chunk of data, initialize buffer */
+      pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+      pHddCtx->ftm.targetNVTableSize    = 0;
+      pHddCtx->ftm.processedNVTableSize = 0;
+      vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_set_nv_table() -
+            Set Specific NV table as given
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             1, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_set_nv_table
+(
+   hdd_context_t  *pHddCtx,
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   VOS_STATUS          nvStatus = VOS_STATUS_SUCCESS;
+   pttSetNvTable      *nvTable = (pttSetNvTable *)&ftmCmd->msgBody.SetNvTable;
+   v_SIZE_t            nvSize;
+   sHalNv             *nvContents = NULL;
+
+   if (NULL == pHddCtx)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Not valid driver context");
+      return -1;
+   }
+
+   /* Test first chunk of NV table */
+   if ((NV_MAX_TABLE == pHddCtx->ftm.processingNVTable) ||
+       (0 == pHddCtx->ftm.processedNVTableSize))
+   {
+      nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+      if ((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "Fail to get cached NV value Status %d", nvStatus);
+         return -1;
+      }
+
+      switch (nvTable->nvTable)
+      {
+         case NV_TABLE_RATE_POWER_SETTINGS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.pwrOptimum);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pwrOptimum;
+            break;
+
+         case NV_TABLE_REGULATORY_DOMAINS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.regDomains);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.regDomains;
+            break;
+
+         case NV_TABLE_DEFAULT_COUNTRY:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.defaultCountryTable);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.defaultCountryTable;
+            break;
+
+         case NV_TABLE_TPC_POWER_TABLE:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.plutCharacterized);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.plutCharacterized[0];
+            break;
+
+         case NV_TABLE_TPC_PDADC_OFFSETS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.plutPdadcOffset);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.plutPdadcOffset[0];
+            break;
+
+         case NV_TABLE_VIRTUAL_RATE:
+            pHddCtx->ftm.targetNVTableSize = sizeof(nvContents->tables.pwrOptimum_virtualRate);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pwrOptimum_virtualRate[0];
+            break;
+
+         case NV_TABLE_RSSI_CHANNEL_OFFSETS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.rssiChanOffsets);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.rssiChanOffsets[0];
+            break;
+
+         case NV_TABLE_RF_CAL_VALUES:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.rFCalValues);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.rFCalValues;
+            break;
+
+         case NV_TABLE_ANTENNA_PATH_LOSS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.antennaPathLoss);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.antennaPathLoss[0];
+            break;
+
+         case NV_TABLE_PACKET_TYPE_POWER_LIMITS:
+            pHddCtx->ftm.targetNVTableSize    = sizeof(nvContents->tables.pktTypePwrLimits);
+            pHddCtx->ftm.targetNVTablePointer = (v_U8_t *)&nvContents->tables.pktTypePwrLimits[0][0];
+            break;
+
+         default:
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                       "Not Valid NV Table %d", nvTable->nvTable);
+            return -1;
+            break;
+      }
+
+      /* Set Current Processing NV table type */
+      pHddCtx->ftm.processingNVTable = nvTable->nvTable;
+      if (pHddCtx->ftm.targetNVTableSize != nvTable->tableSize)
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "Invalid Table Size %d", nvTable->tableSize);
+         pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+         pHddCtx->ftm.targetNVTableSize    = 0;
+         pHddCtx->ftm.processedNVTableSize = 0;
+         vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+         return -1;
+      }
+   }
+
+   if (pHddCtx->ftm.processingNVTable != nvTable->nvTable)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid NV Table, now Processing %d, not %d",
+                  pHddCtx->ftm.processingNVTable, nvTable->nvTable);
+      pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+      pHddCtx->ftm.targetNVTableSize    = 0;
+      pHddCtx->ftm.processedNVTableSize = 0;
+      vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+      return -1;
+   }
+   vos_mem_copy(pHddCtx->ftm.tempNVTableBuffer + pHddCtx->ftm.processedNVTableSize,
+                &nvTable->tableData, 
+                nvTable->chunkSize);
+
+   pHddCtx->ftm.processedNVTableSize += nvTable->chunkSize;
+   if (pHddCtx->ftm.targetNVTableSize == pHddCtx->ftm.processedNVTableSize)
+   {
+      vos_mem_copy(pHddCtx->ftm.targetNVTablePointer,
+                   pHddCtx->ftm.tempNVTableBuffer,
+                   pHddCtx->ftm.targetNVTableSize);
+      pHddCtx->ftm.processingNVTable    = NV_MAX_TABLE;
+      pHddCtx->ftm.targetNVTableSize    = 0;
+      pHddCtx->ftm.processedNVTableSize = 0;
+      vos_mem_zero(pHddCtx->ftm.tempNVTableBuffer, MAX_NV_TABLE_SIZE);
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_blank_nv() -
+            Set all NV table value as default
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             0, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_blank_nv_table
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   VOS_STATUS      nvStatus = VOS_STATUS_SUCCESS;
+   v_SIZE_t            nvSize;
+   v_SIZE_t            itemSize;
+   sHalNv             *nvContents = NULL;
+
+   nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+   if((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "Fail to get cached NV value Status %d", nvStatus);
+      return -1;
+   }
+
+   itemSize = sizeof(nvContents->tables.pwrOptimum);
+   memcpy(&nvContents->tables.pwrOptimum,
+          &nvDefaults.tables.pwrOptimum,
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.regDomains);
+   memcpy(&nvContents->tables.regDomains,
+          &nvDefaults.tables.regDomains,
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.defaultCountryTable);
+   memcpy(&nvContents->tables.defaultCountryTable,
+          &nvDefaults.tables.defaultCountryTable,
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.plutCharacterized);
+   memcpy(&nvContents->tables.plutCharacterized[0],
+          &nvDefaults.tables.plutCharacterized[0],
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.plutPdadcOffset);
+   memcpy(&nvContents->tables.plutPdadcOffset[0],
+          &nvDefaults.tables.plutPdadcOffset[0],
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.pwrOptimum_virtualRate);
+   memcpy(&nvContents->tables.pwrOptimum_virtualRate[0],
+          &nvDefaults.tables.pwrOptimum_virtualRate[0],
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.rssiChanOffsets);
+   memcpy(&nvContents->tables.rssiChanOffsets[0],
+          &nvDefaults.tables.rssiChanOffsets[0],
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.rFCalValues);
+   memcpy(&nvContents->tables.rFCalValues,
+          &nvDefaults.tables.rFCalValues,
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.antennaPathLoss);
+   memcpy(&nvContents->tables.antennaPathLoss[0],
+          &nvDefaults.tables.antennaPathLoss[0],
+          itemSize);
+
+   itemSize = sizeof(nvContents->tables.pktTypePwrLimits);
+   memcpy(&nvContents->tables.pktTypePwrLimits[0][0],
+          &nvDefaults.tables.pktTypePwrLimits[0][0],
+          itemSize);
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_delete_nv_table() -
+            Delete Specific NV table
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             1, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_delete_nv_table
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   VOS_STATUS      nvStatus = VOS_STATUS_SUCCESS;
+   tMsgPttDelNvTable  *nvTable = (tMsgPttDelNvTable *)&ftmCmd->msgBody.DelNvTable;
+   v_SIZE_t            nvSize;
+   v_SIZE_t            itemSize;
+   sHalNv             *nvContents = NULL;
+
+   nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+   if ((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "Fail to get cached NV value Status %d", nvStatus);
+      return -1;
+   }
+
+   switch (nvTable->nvTable)
+   {
+      case NV_TABLE_RATE_POWER_SETTINGS:
+         itemSize = sizeof(nvContents->tables.pwrOptimum);
+         memcpy(&nvContents->tables.pwrOptimum,
+                &nvDefaults.tables.pwrOptimum,
+                itemSize);
+         break;
+
+      case NV_TABLE_REGULATORY_DOMAINS:
+         itemSize = sizeof(nvContents->tables.regDomains);
+         memcpy(&nvContents->tables.regDomains,
+                &nvDefaults.tables.regDomains,
+                itemSize);
+         break;
+
+      case NV_TABLE_DEFAULT_COUNTRY:
+         itemSize = sizeof(nvContents->tables.defaultCountryTable);
+         memcpy(&nvContents->tables.defaultCountryTable,
+                &nvDefaults.tables.defaultCountryTable,
+                itemSize);
+         break;
+
+      case NV_TABLE_TPC_POWER_TABLE:
+         itemSize = sizeof(nvContents->tables.plutCharacterized);
+         memcpy(&nvContents->tables.plutCharacterized[0],
+                &nvDefaults.tables.plutCharacterized[0],
+                itemSize);
+         break;
+
+      case NV_TABLE_TPC_PDADC_OFFSETS:
+         itemSize = sizeof(nvContents->tables.plutPdadcOffset);
+         memcpy(&nvContents->tables.plutPdadcOffset[0],
+                &nvDefaults.tables.plutPdadcOffset[0],
+                itemSize);
+         break;
+
+      case NV_TABLE_VIRTUAL_RATE:
+         itemSize = sizeof(nvContents->tables.pwrOptimum_virtualRate);
+         memcpy(&nvContents->tables.pwrOptimum_virtualRate[0],
+                &nvDefaults.tables.pwrOptimum_virtualRate[0],
+                itemSize);
+         break;
+
+      case NV_TABLE_RSSI_CHANNEL_OFFSETS:
+         itemSize = sizeof(nvContents->tables.rssiChanOffsets);
+         memcpy(&nvContents->tables.rssiChanOffsets[0],
+                &nvDefaults.tables.rssiChanOffsets[0],
+                itemSize);
+         break;
+
+      case NV_TABLE_RF_CAL_VALUES:
+         itemSize = sizeof(nvContents->tables.rFCalValues);
+         memcpy(&nvContents->tables.rFCalValues,
+                &nvDefaults.tables.rFCalValues,
+                itemSize);
+         break;
+
+      case NV_TABLE_ANTENNA_PATH_LOSS:
+         itemSize = sizeof(nvContents->tables.antennaPathLoss);
+         memcpy(&nvContents->tables.antennaPathLoss[0],
+                &nvDefaults.tables.antennaPathLoss[0],
+                itemSize);
+         break;
+
+      case NV_TABLE_PACKET_TYPE_POWER_LIMITS:
+         itemSize = sizeof(nvContents->tables.pktTypePwrLimits);
+         memcpy(&nvContents->tables.pktTypePwrLimits[0][0],
+                &nvDefaults.tables.pktTypePwrLimits[0][0],
+                itemSize);
+         break;
+
+      default:
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "Not Valid NV Table %d", nvTable->nvTable);
+         return -1;
+         break;
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_get_nv_field() -
+            Get Specific NV field
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             1, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_get_nv_field
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   sNvFields           nvFieldDataBuffer;
+   tMsgPttGetNvField  *nvField = (tMsgPttGetNvField *)&ftmCmd->msgBody.GetNvField;
+   VOS_STATUS          nvStatus = VOS_STATUS_SUCCESS;
+   sHalNv             *nvContents = NULL;
+   v_SIZE_t            nvSize;
+
+   nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+   if ((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "Fail to get cached NV value Status %d", nvStatus);
+      return -1;
+   }
+   memcpy(&nvFieldDataBuffer, &nvContents->fields, sizeof(sNvFields));
+
+   switch (nvField->nvField)
+   {
+      case NV_COMMON_PRODUCT_ID:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.productId,
+             sizeof(nvFieldDataBuffer.productId));
+         break;
+
+      case NV_COMMON_PRODUCT_BANDS:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.productBands,
+             sizeof(nvFieldDataBuffer.productBands));
+         break;
+
+      case NV_COMMON_NUM_OF_TX_CHAINS:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.numOfTxChains,
+             sizeof(nvFieldDataBuffer.numOfTxChains));
+         break;
+
+      case NV_COMMON_NUM_OF_RX_CHAINS:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.numOfRxChains,
+             sizeof(nvFieldDataBuffer.numOfRxChains));
+         break;
+
+      case NV_COMMON_MAC_ADDR:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.macAddr[0],
+             NV_FIELD_MAC_ADDR_SIZE);
+         break;
+
+      case NV_COMMON_MFG_SERIAL_NUMBER:
+         memcpy((void *)&nvField->fieldData,
+             &nvFieldDataBuffer.mfgSN[0],
+             NV_FIELD_MFG_SN_SIZE);
+         break;
+
+      case NV_COMMON_COUPLER_TYPE:
+         memcpy((void *)&nvField->fieldData,
+                &nvFieldDataBuffer.couplerType,
+                sizeof(nvFieldDataBuffer.couplerType));
+         break;
+
+      default:
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "Not Valid NV field %d", nvField->nvField);
+         return -1;
+         break;
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_set_nv_field() -
+            Set Specific NV field
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             1, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_set_nv_field
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   tMsgPttSetNvField *nvField = (tMsgPttSetNvField *)&ftmCmd->msgBody.SetNvField;
+   VOS_STATUS         nvStatus = VOS_STATUS_SUCCESS;
+   v_SIZE_t           nvSize;
+   sHalNv            *nvContents = NULL;
+   v_U8_t             macLoop;
+   v_U8_t            *pNVMac;
+   v_U8_t             lastByteMAC;
+
+   nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+   if((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "Fail to get cached NV value Status %d", nvStatus);
+      return -1;
+   }
+
+   switch (nvField->nvField)
+   {
+      case NV_COMMON_PRODUCT_ID:
+         memcpy(&nvContents->fields.productId,
+                &nvField->fieldData,
+                sizeof(nvContents->fields.productId));
+         break;
+
+      case NV_COMMON_PRODUCT_BANDS:
+         memcpy(&nvContents->fields.productBands,
+                &nvField->fieldData,
+                sizeof(nvContents->fields.productBands));
+         break;
+
+      case NV_COMMON_NUM_OF_TX_CHAINS:
+         memcpy(&nvContents->fields.numOfTxChains,
+                &nvField->fieldData,
+                sizeof(nvContents->fields.numOfTxChains));
+         break;
+
+      case NV_COMMON_NUM_OF_RX_CHAINS:
+         memcpy(&nvContents->fields.numOfRxChains,
+                &nvField->fieldData,
+                sizeof(nvContents->fields.numOfRxChains));
+         break;
+
+      case NV_COMMON_MAC_ADDR:
+         /* If Last byte is larger than 252 (0xFC), return Error,
+          * Since 3MACs should be derived from first MAC */
+         if(QWLAN_MAX_MAC_LAST_BYTE_VALUE <
+            nvField->fieldData.macAddr[VOS_MAC_ADDRESS_LEN - 1])
+         {
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                       "Last Byte of the seed MAC is too large 0x%x",
+                        nvField->fieldData.macAddr[VOS_MAC_ADDRESS_LEN - 1]);
+            return -1;
+         }
+
+         pNVMac = (v_U8_t *)nvContents->fields.macAddr;
+         lastByteMAC = nvField->fieldData.macAddr[VOS_MAC_ADDRESS_LEN - 1];
+         for(macLoop = 0; macLoop < VOS_MAX_CONCURRENCY_PERSONA; macLoop++)
+         {
+            nvField->fieldData.macAddr[VOS_MAC_ADDRESS_LEN - 1] =
+                                               lastByteMAC + macLoop;
+            vos_mem_copy(pNVMac + (macLoop * NV_FIELD_MAC_ADDR_SIZE),
+                         &nvField->fieldData.macAddr[0],
+                         NV_FIELD_MAC_ADDR_SIZE);
+         }
+         break;
+
+      case NV_COMMON_MFG_SERIAL_NUMBER:
+         memcpy(&nvContents->fields.mfgSN[0],
+                &nvField->fieldData,
+             NV_FIELD_MFG_SN_SIZE);
+         break;
+
+      case NV_COMMON_COUPLER_TYPE:
+         memcpy(&nvContents->fields.couplerType,
+                &nvField->fieldData,
+                sizeof(nvContents->fields.couplerType));
+         break;
+
+      default:
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "Not Valid NV field %d", nvField->nvField);
+         return -1;
+         break;
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_store_nv_table() -
+            Store Cached NV information into Flash Memory, file
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             0, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_store_nv_table
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   VOS_STATUS           nvStatus = VOS_STATUS_SUCCESS;
+   v_SIZE_t             nvSize;
+   sHalNv              *nvContents = NULL;
+   tMsgPttStoreNvTable *nvTable = (tMsgPttStoreNvTable *)&ftmCmd->msgBody.StoreNvTable;
+   void                *tablePtr = NULL;
+   unsigned int         tableSize = 0;
+   VNV_TYPE             tableVNVType = VNV_FIELD_IMAGE;
+
+   nvStatus = vos_nv_getNVBuffer((void **)&nvContents, &nvSize);
+   if((VOS_STATUS_SUCCESS != nvStatus) || (NULL == nvContents))
+   {
+      return -1;
+   }
+
+   /* Set Platform type as PRIMA */
+   nvContents->fields.wlanNvRevId = 2;
+
+   switch(nvTable->nvTable)
+   {
+      case NV_FIELDS_IMAGE:
+         tablePtr     = (void *)&nvContents->fields;
+         tableSize    = sizeof(nvContents->fields);
+         tableVNVType = VNV_FIELD_IMAGE;
+         break;
+
+      case NV_TABLE_RATE_POWER_SETTINGS:
+         tablePtr     = (void *)&nvContents->tables.pwrOptimum[0];
+         tableSize    = sizeof(nvContents->tables.pwrOptimum);
+         tableVNVType = VNV_RATE_TO_POWER_TABLE;
+         break;
+
+      case NV_TABLE_REGULATORY_DOMAINS:
+         tablePtr     = (void *)&nvContents->tables.regDomains[0];
+         tableSize    = sizeof(nvContents->tables.regDomains);
+         tableVNVType = VNV_REGULARTORY_DOMAIN_TABLE;
+         break;
+
+      case NV_TABLE_DEFAULT_COUNTRY:
+         tablePtr     = (void *)&nvContents->tables.defaultCountryTable;
+         tableSize    = sizeof(nvContents->tables.defaultCountryTable);
+         tableVNVType = VNV_DEFAULT_LOCATION;
+         break;
+
+      case NV_TABLE_TPC_POWER_TABLE:
+         tablePtr     = (void *)&nvContents->tables.plutCharacterized[0];
+         tableSize    = sizeof(nvContents->tables.plutCharacterized);
+         tableVNVType = VNV_TPC_POWER_TABLE;
+         break;
+
+      case NV_TABLE_TPC_PDADC_OFFSETS:
+         tablePtr     = (void *)&nvContents->tables.plutPdadcOffset[0];
+         tableSize    = sizeof(nvContents->tables.plutPdadcOffset);
+         tableVNVType = VNV_TPC_PDADC_OFFSETS;
+         break;
+
+      case NV_TABLE_VIRTUAL_RATE:
+         tablePtr     = (void *)&nvContents->tables.pwrOptimum_virtualRate[0];
+         tableSize    = sizeof(nvContents->tables.pwrOptimum_virtualRate);
+         tableVNVType = VNV_TABLE_VIRTUAL_RATE;
+         break;
+
+      case NV_TABLE_RSSI_CHANNEL_OFFSETS:
+         tablePtr     = (void *)&nvContents->tables.rssiChanOffsets[0];
+         tableSize    = sizeof(nvContents->tables.rssiChanOffsets);
+         tableVNVType = VNV_RSSI_CHANNEL_OFFSETS;
+         break;
+
+      case NV_TABLE_RF_CAL_VALUES:
+         tablePtr     = (void *)&nvContents->tables.rFCalValues;
+         tableSize    = sizeof(nvContents->tables.rFCalValues);
+         tableVNVType = VNV_RF_CAL_VALUES;
+         break;
+
+      case NV_TABLE_ANTENNA_PATH_LOSS:
+         tablePtr     = (void *)&nvContents->tables.antennaPathLoss[0];
+         tableSize    = sizeof(nvContents->tables.antennaPathLoss);
+         tableVNVType = VNV_ANTENNA_PATH_LOSS;
+         break;
+
+      case NV_TABLE_PACKET_TYPE_POWER_LIMITS:
+         tablePtr     = (void *)&nvContents->tables.pktTypePwrLimits[0][0];
+         tableSize    = sizeof(nvContents->tables.pktTypePwrLimits);
+         tableVNVType = VNV_PACKET_TYPE_POWER_LIMITS;
+         break;
+
+      default:
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "Not Supported Table Type %d", nvTable->nvTable);
+         return -1;
+         break;
+         
+   }
+
+   nvStatus = vos_nv_write(tableVNVType,
+                           tablePtr,
+                           tableSize);
+   if(VOS_STATUS_SUCCESS != nvStatus)
+   {
+      return -1;
+   }
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_ftm_temp_get_rel_num() -
+            Get internal release number
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             0, Process Host command success
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_ftm_temp_get_rel_num
+(
+   tPttMsgbuffer  *ftmCmd
+)
+{
+   tMsgPttGetBuildReleaseNumber *relNum = (tMsgPttGetBuildReleaseNumber *)&ftmCmd->msgBody.GetBuildReleaseNumber;
+
+   relNum->relParams.drvMjr = QWLAN_VERSION_MAJOR;
+   relNum->relParams.drvMnr = QWLAN_VERSION_MINOR;
+   relNum->relParams.drvPtch = QWLAN_VERSION_PATCH;
+   relNum->relParams.drvBld = QWLAN_VERSION_BUILD;
+   relNum->relParams.pttMax = 10;
+   relNum->relParams.pttMin = 1;
+
+   return 1;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_process_ftm_host_cmd() -
+            process any command should be handled within host.
+            decide any command should be send to HAL or not
+
+  \param  - ftmCmd - Pointer FTM Commad Buffer
+
+  \return - int
+            -1, Process Host command fail, vail out
+             0, Process Host command success, not need to send CMD to HAL
+             1, Process Host command success, need to send CMD to HAL
+
+  --------------------------------------------------------------------------*/
+int wlan_hdd_process_ftm_host_cmd
+(
+   hdd_context_t *pHddCtx,
+   void *ftmCmd
+)
+{
+   tPttMsgbuffer *pFTMCmd = (tPttMsgbuffer *)ftmCmd;
+   int            needToRouteHal = 1;
+   int            hostState = 1;
+
+   switch(pFTMCmd->msgId)
+   {
+      case PTT_MSG_GET_NV_TABLE:
+         hostState = wlan_hdd_ftm_get_nv_table(pHddCtx, pFTMCmd);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_SET_NV_TABLE:
+         hostState = wlan_hdd_ftm_set_nv_table(pHddCtx, pFTMCmd);
+         /* Temp NV Operation will be isolated to host
+         needToRouteHal = 1; */
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_BLANK_NV:
+         hostState = wlan_hdd_ftm_blank_nv_table(pFTMCmd);
+         needToRouteHal = 1;
+         break;
+
+      case PTT_MSG_DEL_NV_TABLE:
+         hostState = wlan_hdd_ftm_delete_nv_table(pFTMCmd);
+         needToRouteHal = 1;
+         break;
+
+      case PTT_MSG_GET_NV_FIELD:
+         hostState = wlan_hdd_ftm_get_nv_field(pFTMCmd);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_SET_NV_FIELD:
+         hostState = wlan_hdd_ftm_set_nv_field(pFTMCmd);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_STORE_NV_TABLE:
+         hostState = wlan_hdd_ftm_store_nv_table(pFTMCmd);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_DBG_READ_REGISTER:
+         wpalReadRegister(pFTMCmd->msgBody.DbgReadRegister.regAddr,
+                          &pFTMCmd->msgBody.DbgReadRegister.regValue);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_DBG_WRITE_REGISTER:
+         wpalWriteRegister(pFTMCmd->msgBody.DbgWriteRegister.regAddr,
+                           pFTMCmd->msgBody.DbgWriteRegister.regValue);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_DBG_READ_MEMORY:
+         wpalReadDeviceMemory(pFTMCmd->msgBody.DbgReadMemory.memAddr,
+                              (unsigned char *)pFTMCmd->msgBody.DbgReadMemory.pMemBuf,
+                              pFTMCmd->msgBody.DbgReadMemory.nBytes);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_DBG_WRITE_MEMORY:
+         wpalWriteDeviceMemory(pFTMCmd->msgBody.DbgWriteMemory.memAddr,
+                               (unsigned char *)pFTMCmd->msgBody.DbgWriteMemory.pMemBuf,
+                               pFTMCmd->msgBody.DbgWriteMemory.nBytes);
+         needToRouteHal = 0;
+         break;
+
+      case PTT_MSG_GET_BUILD_RELEASE_NUMBER:
+         wlan_hdd_ftm_temp_get_rel_num(pFTMCmd);
+         needToRouteHal = 0;
+         break;
+
+      default:
+         needToRouteHal = 1;
+         break;
+   }
+
+   if(-1 == hostState)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "Host Command Handle Fail, Bailout");
+      return -1;
+   }
+
+   return needToRouteHal;
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_hdd_process_ftm_cmd() -
+
+   This function process the commands received from the ptt socket application.
+
+  \param  - pAdapter - Pointer HDD Context.
+
+  \param  - wnl - Pointer to the ANI netlink header.
+
+  \return - none
+
+  --------------------------------------------------------------------------*/
+
+void wlan_hdd_process_ftm_cmd
+(
+    hdd_context_t *pHddCtx,
+    tAniNlHdr *wnl
+)
+{
+    wlan_hdd_ftm_request_t  *pRequestBuf = (wlan_hdd_ftm_request_t*)(((v_U8_t*)(&wnl->wmsg))+sizeof(tAniHdr)) ;
+    v_U16_t   cmd_len;
+    v_U8_t *pftm_data;
+    pVosContextType pVosContext = (pVosContextType)(pHddCtx->pvosContext);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    int hostState;
+    tPttMsgbuffer *tempRspBuffer = NULL;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */        
+
+    ENTER();
+
+    if (!pRequestBuf) {
+
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: request buffer is null\n",__func__);
+        return ;
+    }
+    /*Save the received request*/
+    pHddCtx->ftm.pRequestBuf = pRequestBuf;
+
+    pHddCtx->ftm.pResponseBuf = (wlan_hdd_ftm_response_t*)pRequestBuf;
+     /*Save the received request netlink header used for sending the response*/
+    pHddCtx->ftm.wnl = wnl;
+    if (pRequestBuf->module_type != QUALCOMM_MODULE_TYPE) {
+
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Invalid Module Type =%d\n",__func__,pRequestBuf->module_type);
+
+        pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+        wlan_ftm_send_response(pHddCtx);
+        return ;
+    }
+
+    switch (pRequestBuf->ftmpkt.ftm_cmd_type)
+    {
+    case WLAN_FTM_START:
+        if (pHddCtx->ftm.ftm_state == WLAN_FTM_STARTED) {
+
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s: FTM has already started =%d\n",__func__,pRequestBuf->ftmpkt.ftm_cmd_type);
+            pHddCtx->ftm.pResponseBuf->ftm_hdr.data_len -= 1;
+            pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+            wlan_ftm_send_response(pHddCtx);
+            return;
+        }
+
+        if (wlan_hdd_ftm_start(pVosContext->pHDDContext) != VOS_STATUS_SUCCESS)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: : Failed to start WLAN FTM"
+                   ,__func__);
+            pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+            wlan_ftm_send_response(pHddCtx);
+            return;
+        }
+        /* Ptt application running on the host PC expects the length to be one byte less that what we have received*/
+        pHddCtx->ftm.pResponseBuf->ftm_hdr.data_len -= 1;
+        pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+        pHddCtx->ftm.pResponseBuf->ftmpkt.ftm_cmd_type = 0;
+
+        wlan_ftm_send_response(pHddCtx);
+
+        break;
+
+    case WLAN_FTM_STOP:
+        if (pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED) {
+
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s:: FTM has not started\n",__func__);
+            pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+            wlan_ftm_send_response(pHddCtx);
+            return;
+        }
+
+        if (VOS_STATUS_SUCCESS != wlan_ftm_stop(pHddCtx)) {
+
+            pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+            wlan_ftm_send_response(pHddCtx);
+            return;
+        }
+
+        pHddCtx->ftm.ftm_state = WLAN_FTM_STOPPED;
+        /* This would send back the Command Success Status */
+        pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+
+        wlan_ftm_send_response(pHddCtx);
+
+        break;
+
+    case WLAN_FTM_CMD:
+        /* if it is regular FTM command, pass it to HAL PHY */
+        if(pHddCtx->ftm.IsCmdPending == TRUE) {
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s:: FTM command pending for process\n",__func__);
+            return;
+        }
+        if (pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED) {
+
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s:: FTM has not started\n",__func__);
+
+            pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+            wlan_ftm_send_response(pHddCtx);
+            return;
+
+        }
+        vos_event_reset(&pHddCtx->ftm.ftm_vos_event);
+        cmd_len = pRequestBuf->ftm_hdr.data_len;
+        cmd_len -= (sizeof(wlan_hdd_ftm_request_t)- sizeof(pRequestBuf->ftmpkt.ftm_cmd_type));
+        pftm_data = pRequestBuf->ftmpkt.pFtmCmd;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+        hostState = wlan_hdd_process_ftm_host_cmd(pHddCtx, pftm_data);
+        if (0 == hostState)
+        {
+           tempRspBuffer = (tPttMsgbuffer *)vos_mem_malloc(((tPttMsgbuffer *)pftm_data)->msgBodyLength);
+           if (NULL == tempRspBuffer)
+           {
+              hddLog(VOS_TRACE_LEVEL_ERROR,
+                     "%s:: temp Mem Alloc Fail\n",__func__);
+              pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+              wlan_ftm_send_response(pHddCtx);
+              return;
+           }
+           memcpy(tempRspBuffer, pftm_data, ((tPttMsgbuffer *)pftm_data)->msgBodyLength);
+           tempRspBuffer->msgResponse = PTT_STATUS_SUCCESS;
+           memcpy((unsigned char *)&pHddCtx->ftm.pResponseBuf->ftmpkt,
+                  (unsigned char *) tempRspBuffer,
+                  tempRspBuffer->msgBodyLength);
+           pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+           wlan_ftm_send_response(pHddCtx);
+           vos_mem_free(tempRspBuffer);
+           return;
+        }
+        else if (-1 == hostState)
+        {
+           hddLog(VOS_TRACE_LEVEL_ERROR, "*** Host Command Handle Fail ***");
+           pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
+           wlan_ftm_send_response(pHddCtx);
+           return;
+        }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+        //HEXDUMP("Request:",(char*)pftm_data,cmd_len);
+
+        pHddCtx->ftm.IsCmdPending = TRUE;
+
+        /*Post the command to the HAL*/
+        if (wlan_ftm_postmsg(pftm_data, cmd_len) != VOS_STATUS_SUCCESS) {
+
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s:: FTM command failed\n",__func__);
+            return;
+
+        }
+        /*Wait here until you get the response from HAL*/
+        if (vos_wait_single_event(&pHddCtx->ftm.ftm_vos_event, FTM_VOS_EVENT_WAIT_TIME)!= VOS_STATUS_SUCCESS)
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: vos_wait_single_event failed",__func__);
+            return;
+        }
+
+        cmd_len = be16_to_cpu(pHddCtx->ftm.wnl->wmsg.length);
+
+        //HEXDUMP("Response to QXDM:", (char *)&pAdapter->ftm.wnl->wmsg, cmd_len);
+
+        wlan_ftm_send_response(pHddCtx);
+        pHddCtx->ftm.IsCmdPending = FALSE;
+        break;
+
+    default:
+
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s:: Command not supported \n",__func__);
+        return;
+    }
+
+    EXIT();
+    return;
+} /* wlan_adp_ftm_cmd() */
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_start_stop_ftm() -
+
+   This function is used for start/stop the ftm driver.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - start - 1/0 to start/stop ftm driver.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_start_stop_ftm(hdd_adapter_t *pAdapter,
+                                               v_U16_t start)
+{
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if (start) 
+    {
+        pHddCtx->ftm.cmd_iwpriv = TRUE;
+        status = wlan_hdd_ftm_start(pHddCtx);
+
+        if (status != VOS_STATUS_SUCCESS)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                      "FTM Start Failed");
+            return VOS_STATUS_E_FAILURE;
+        }
+    }
+    else
+    {
+        status = wlan_ftm_stop(pHddCtx);
+
+        if (status != VOS_STATUS_SUCCESS)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                      "FTM Stop Failed");
+            return VOS_STATUS_E_FAILURE;
+        }
+    }
+    return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_channel() -
+
+   This function is used for setting the channel to the halphy ptt module.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - channel   -  Channel Number 1-14.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_set_channel(hdd_adapter_t *pAdapter,v_U16_t channel)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if(!(channel >= 1 && channel <= 14))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Channel Number. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_SET_CHANNEL;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttSetChannel) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    pMsgBody->SetChannel.chId = channel;
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Channel =%d\n",pMsgBody->SetChannel.chId);
+    pMsgBody->SetChannel.cbState = PHY_SINGLE_CHANNEL_CENTERED;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+
+    }
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_txpower() -
+
+   This function is used for setting the txpower to the halphy ptt module.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - txpower   -  txpower Number 1-18.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_set_txpower(hdd_adapter_t *pAdapter,v_U16_t txpower)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled, although halphy does allow changing tx power
+     * when tx pktgen is enabled
+     */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot set txpower when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if(!(txpower >= 9 && txpower <= 24))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid tx power. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_CLOSE_TPC_LOOP;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttCloseTpcLoop) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->CloseTpcLoop.tpcClose = TRUE;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_SET_TX_POWER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttSetTxPower) + PTT_HEADER_LENGTH;
+
+    pMsgBody->SetTxPower.dbmPwr = txpower*100;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    ftm_status.txpower = txpower ;
+ done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+
+}
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_txrate() -
+
+   This function is used for setting the txrate to the halphy ptt module.
+   It converts the user input string for txrate to the tx rate index.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - txrate   -  Pointer to the tx rate string.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_set_txrate(hdd_adapter_t *pAdapter,char *txrate)
+{
+    int ii;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* do not allow to change setting when tx pktgen is enabled */
+    if (ftm_status.frameGenEnabled)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:cannot set txrate when pktgen is enabled.",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    for(ii = 0; ii < SIZE_OF_TABLE(rateName_rateIndex_tbl); ii++)
+    {
+        if(!strcmp(rateName_rateIndex_tbl[ii].rate_str,txrate))
+           break;
+    }
+    if(ii >= SIZE_OF_TABLE(rateName_rateIndex_tbl))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Rate String\n",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    ftm_status.frameParams.rate = rateName_rateIndex_tbl[ii].rate_index;
+    ftm_status.frameParams.preamble = rate_index_2_preamble_table[rateName_rateIndex_tbl[ii].rate_index].Preamble;
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_start_stop_tx_pktgen() -
+
+   This function is used for start/stop the tx packet generation.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - startStop   -  Value( 1/0) start/stop the tx packet generation.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_start_stop_tx_pktgen(hdd_adapter_t *pAdapter,v_U16_t startStop)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if(startStop != 1 && startStop != 0)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Tx value is invalid ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if ((ftm_status.frameGenEnabled && startStop == 1) ||
+        (!ftm_status.frameGenEnabled && startStop == 0))
+    {
+        return VOS_STATUS_SUCCESS ;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    if (startStop == 1)
+    {
+        init_completion(&pHddCtx->ftm.ftm_comp_var);
+        pMsgBuf->msgId = PTT_MSG_CONFIG_TX_PACKET_GEN;
+        pMsgBuf->msgBodyLength = sizeof(tMsgPttConfigTxPacketGen) + PTT_HEADER_LENGTH;
+        pMsgBody = &pMsgBuf->msgBody;
+        pMsgBody->ConfigTxPacketGen.frameParams = ftm_status.frameParams ;
+
+        status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+        if(status != VOS_STATUS_SUCCESS)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:posting PTT_MSG_CONFIG_TX_PACKET_GEN failed",__func__);
+            status = VOS_STATUS_E_FAILURE;
+            goto done;
+        }
+
+        wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+        if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: PTT_MSG_CONFIG_TX_PACKET_GEN failed",__func__);
+            status = VOS_STATUS_E_FAILURE;
+            goto done;
+        }
+    }
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_START_STOP_TX_PACKET_GEN;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttStartStopTxPacketGen) + PTT_HEADER_LENGTH;
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->StartStopTxPacketGen.startStop = startStop;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    if (status == VOS_STATUS_SUCCESS)
+    {
+        if (startStop == 1)
+        {
+            ftm_status.frameGenEnabled = eANI_BOOLEAN_TRUE ;
+        }
+        else
+        {
+            ftm_status.frameGenEnabled = eANI_BOOLEAN_FALSE ;
+        }
+    }
+
+    return status;
+}
+
+
+static VOS_STATUS wlan_ftm_priv_set_rssi_offset(hdd_adapter_t *pAdapter,v_S15_t *phyRxChains)
+{
+#ifndef ANI_CHIPSET_VOLANS
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_SET_NV_TABLE;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttSetNvTable) + PTT_HEADER_LENGTH;
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->SetNvTable.nvTable= NV_TABLE_RSSI_OFFSETS;
+    memcpy(&pMsgBody->SetNvTable.tableData.rssiOffset[0], phyRxChains,sizeof(tANI_S16) * PHY_MAX_RX_CHAINS);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "rssiOffset[0]= %d rssiOffset[1]= %d\n",
+                                                            pMsgBody->SetNvTable.tableData.rssiOffset[0],
+                                                            pMsgBody->SetNvTable.tableData.rssiOffset[1]);
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_STORE_NV_TABLE;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttStoreNvTable) + PTT_HEADER_LENGTH;
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->StoreNvTable.nvTable= NV_TABLE_RSSI_OFFSETS;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+#else
+    return VOS_STATUS_E_FAILURE;
+#endif
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_rx_mode() -
+
+   This function is used for start/stop the rx packet generation.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - rxmode   -  0-disable RX.
+                               -  1-rx ALL frames
+                               -  2-rx 11 g/n frames
+                               -  3-rx 11b frames
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_rx_mode(hdd_adapter_t *pAdapter,v_U16_t rxmode)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if(rxmode > 3)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Rx mode value is invalid ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+
+    pMsgBuf->msgId = PTT_MSG_SET_RX_DISABLE_MODE;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttSetRxDisableMode) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    switch(rxmode)
+    {
+        case RXMODE_DISABLE_ALL:
+          pMsgBody->SetRxDisableMode.disabled.agPktsDisabled = VOS_TRUE;
+          pMsgBody->SetRxDisableMode.disabled.bPktsDisabled  = VOS_TRUE;
+          pMsgBody->SetRxDisableMode.disabled.slrPktsDisabled= VOS_TRUE;
+          break;
+
+        case RXMODE_ENABLE_ALL:
+          pMsgBody->SetRxDisableMode.disabled.agPktsDisabled = VOS_FALSE;
+          pMsgBody->SetRxDisableMode.disabled.bPktsDisabled  = VOS_FALSE;
+          pMsgBody->SetRxDisableMode.disabled.slrPktsDisabled= VOS_FALSE;
+          break;
+
+        case RXMODE_ENABLE_11GN:
+          pMsgBody->SetRxDisableMode.disabled.agPktsDisabled = VOS_FALSE;
+          pMsgBody->SetRxDisableMode.disabled.bPktsDisabled  = VOS_TRUE;
+          pMsgBody->SetRxDisableMode.disabled.slrPktsDisabled= VOS_TRUE;
+          break;
+
+        case RXMODE_ENABLE_11B:
+          pMsgBody->SetRxDisableMode.disabled.agPktsDisabled = VOS_TRUE;
+          pMsgBody->SetRxDisableMode.disabled.bPktsDisabled  = VOS_FALSE;
+          pMsgBody->SetRxDisableMode.disabled.slrPktsDisabled= VOS_TRUE;
+          break;
+
+    }
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    ftm_status.rxmode = rxmode ;
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_rx_pkt_clear() -
+
+   This function sets the rx pkt count to zero.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - rx_pkt_clear   -  rx_pkt_clear value.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_rx_pkt_clear(hdd_adapter_t *pAdapter,v_U16_t rx_pkt_clear)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if(rx_pkt_clear != 1)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid rx_pkt_clear value ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_RESET_RX_PACKET_STATISTICS;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttResetRxPacketStatistics) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->ResetRxPacketStatistics.notUsed= rx_pkt_clear;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_channel() -
+
+   This function gets the channel number from the halphy ptt module and
+   returns the channel number to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pChannel   -  Poniter to get the Channel number.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_channel(hdd_adapter_t *pAdapter,v_U16_t *pChannel)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U16_t  freq;
+    v_U8_t indx=0;
+
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_DBG_READ_REGISTER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttDbgReadRegister) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->DbgReadRegister.regAddr = QWLAN_AGC_CHANNEL_FREQ_REG;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    freq = ((v_U16_t)pMsgBody->DbgReadRegister.regValue & QWLAN_AGC_CHANNEL_FREQ_FREQ_MASK);
+
+    while ((indx <  SIZE_OF_TABLE(freq_chan_tbl)) && (freq != freq_chan_tbl[indx].freq))
+            indx++;
+    if (indx >= SIZE_OF_TABLE(freq_chan_tbl))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Frequency!!!",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    *pChannel = freq_chan_tbl[indx].chan; 
+
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Channel = %d  freq = %d\n",*pChannel, freq);
+ done:
+     vos_mem_free((v_VOID_t * )pMsgBuf);
+
+     return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_txpower() -
+
+   This function gets the TX power from the halphy ptt module and
+   returns the TX power to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pTxPwr   -  Poniter to get the Tx power.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_txpower(hdd_adapter_t *pAdapter,v_U16_t *pTxPwr)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_GET_TX_POWER_REPORT;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetTxPowerReport) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: PTT_MSG_GET_TX_POWER_REPORT failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    *pTxPwr = ((((pMsgBody->GetTxPowerReport.pwrTemplateIndex & 0x1F) + 4)*50)/100);
+
+ done:
+     vos_mem_free((v_VOID_t * )pMsgBuf);
+
+     return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_ftm_version() -
+
+   This function gets ftm driver and firmware version.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pTxRate   -  Poniter to get the Tx rate.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS wlan_ftm_priv_get_ftm_version(hdd_adapter_t *pAdapter,char *pftmVer)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U32_t reg_val;
+    char *buf = pftmVer;
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    FwVersionInfo *pFwVersion;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    int lenRes = 0;
+    int lenBuf = WE_FTM_MAX_STR_LEN;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_DBG_READ_REGISTER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttDbgReadRegister) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->DbgReadRegister.regAddr = QWLAN_RFAPB_REV_ID_REG;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    reg_val = (v_U16_t)pMsgBody->DbgReadRegister.regValue;
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+
+    pMsgBuf->msgId = PTT_MSG_GET_BUILD_RELEASE_NUMBER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetBuildReleaseNumber) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+
+    lenRes = snprintf(buf, lenBuf, "%s_",WLAN_CHIP_VERSION);
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    /*Read the RevID*/
+    lenRes = snprintf(buf, lenBuf, "%x.%x-",(v_U8_t)(reg_val >> 8), (v_U8_t)(reg_val &0x000000FF)); 
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    lenRes = snprintf(buf, lenBuf, "%s-", QWLAN_VERSIONSTR);
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    pFwVersion = &pMsgBody->GetBuildReleaseNumber.relParams.fwVer;
+    lenRes = snprintf(buf, lenBuf, "%ld.%ld.%ld.%ld", pFwVersion->uMj,pFwVersion->uMn,pFwVersion->uPatch,pFwVersion->uBuild ) ;
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_txrate() -
+
+   This function gets the TX rate from the halphy ptt module and
+   returns the TX rate to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pTxRate   -  Poniter to get the Tx rate.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_txrate(hdd_adapter_t *pAdapter,char *pTxRate)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U16_t rate_index,ii;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_GET_TX_POWER_REPORT;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetTxPowerReport) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse == PTT_STATUS_SUCCESS) {
+
+       rate_index = pMsgBody->GetTxPowerReport.rate;
+    }
+    else {
+       /*Return the default rate*/
+       //rate_index = HAL_PHY_RATE_11A_6_MBPS;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: PTT_MSG_GET_TX_POWER_REPORT failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    for(ii = 0; ii < SIZE_OF_TABLE(rateName_rateIndex_tbl); ii++) {
+        if(rateName_rateIndex_tbl[ii].rate_index == rate_index)
+          break;
+    }
+    if(ii >= SIZE_OF_TABLE(rateName_rateIndex_tbl))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Rate Index\n",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    strlcpy(pTxRate,rateName_rateIndex_tbl[ii].rate_str, WE_FTM_MAX_STR_LEN);
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_rx_pkt_count() -
+
+   This function gets the rx pkt count from the halphy ptt module and
+   returns the rx pkt count  to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pRxPktCnt   -  Poniter to get the rx pkt count.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_rx_pkt_count(hdd_adapter_t *pAdapter,v_U16_t *pRxPktCnt)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_GET_RX_PKT_COUNTS;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetRxPktCounts) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    *pRxPktCnt = pMsgBody->GetRxPktCounts.counters.totalRxPackets;
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_rx_rssi() -
+
+   This function gets the rx rssi from the halphy ptt module and
+   returns the rx rssi to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - buf   -  Poniter to get rssi of Rx chains
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_rx_rssi(hdd_adapter_t *pAdapter,char *buf)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+   int ret;
+   
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_GET_RX_RSSI;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetRxRssi) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+   ret = snprintf(buf, WE_FTM_MAX_STR_LEN, " R0:%d, R1:%d", 
+                      pMsgBody->GetRxRssi.rssi.rx[0], 
+                  pMsgBody->GetRxRssi.rssi.rx[1]);
+
+   if( ret < 0 || ret >= WE_FTM_MAX_STR_LEN )
+   {
+      status = VOS_STATUS_E_FAILURE;
+   }
+   
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_get_mac_address() -
+
+   This function gets the mac address from the halphy ptt module and
+   returns the mac address  to the application.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - buf   -  Poniter to get the mac address.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_get_mac_address(hdd_adapter_t *pAdapter,char *buf)
+{
+    v_BOOL_t itemIsValid = VOS_FALSE;
+    v_U8_t macAddr[VOS_MAC_ADDRESS_LEN] = {0, 0x0a, 0xf5, 4,5, 6};
+    int ret;
+   
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    /*Check the NV FIELD is valid or not*/
+    if (vos_nv_getValidity(VNV_FIELD_IMAGE, &itemIsValid) == VOS_STATUS_SUCCESS)
+    {
+       if (itemIsValid == VOS_TRUE) 
+       {
+            vos_nv_readMacAddress(macAddr);
+
+         ret = snprintf(buf, WE_FTM_MAX_STR_LEN, 
+                             "%02x:%02x:%02x:%02x:%02x:%02x", 
+                        MAC_ADDR_ARRAY(macAddr));
+         if( ret < 0 || ret >= WE_FTM_MAX_STR_LEN )
+         {
+             return VOS_STATUS_E_FAILURE;
+         }
+       }
+   }
+   else 
+   {
+         /*Return Hard coded mac address*/
+      ret = snprintf(buf, WE_FTM_MAX_STR_LEN, 
+                            "%02x:%02x:%02x:%02x:%02x:%02x", 
+                     MAC_ADDR_ARRAY(macAddr));
+
+      if( ret < 0 || ret >= WE_FTM_MAX_STR_LEN )
+      {
+          return VOS_STATUS_E_FAILURE;
+      }
+   }
+    return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief wlan_ftm_priv_set_mac_address() -
+
+   This function sets the mac address to the halphy ptt module and
+   sends the netlink message to the ptt socket application which writes
+   the macaddress to the qcom_wlan_nv.bin file
+
+  \param  - pAdapter - Pointer HDD Context.
+              - buf   -  Poniter to the macaddress.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_ftm_priv_set_mac_address(hdd_adapter_t *pAdapter,char *buf)
+{
+    tPttMsgbuffer *pMsgBuf;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    int macAddr[VOS_MAC_ADDRESS_LEN];
+    v_U8_t *pMacAddress;
+    v_U8_t  ii;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+
+    if(pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ftm has not started. Please start the ftm. ",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    pMsgBuf = (tPttMsgbuffer *)vos_mem_malloc(sizeof(tPttMsgbuffer));
+    if(pMsgBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pMsgBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_SET_NV_FIELD;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttSetNvField) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->SetNvField.nvField = NV_COMMON_MAC_ADDR;
+
+    /*We get the mac address in string format "XX:XX:XX:XX:XX:XX" convert to hex*/
+    sscanf(buf,"%02x:%02x:%02x:%02x:%02x:%02x",&macAddr[0],(int*)&macAddr[1],(int*)&macAddr[2],(int*)&macAddr[3],(int*)&macAddr[4],(int*)&macAddr[5]);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "MacAddress = %02x:%02x:%02x:%02x:%02x:%02x",MAC_ADDR_ARRAY(macAddr));
+
+
+    pMacAddress = &pMsgBody->SetNvField.fieldData.macAddr[0];
+
+    for(ii = 0; ii < VOS_MAC_ADDRESS_LEN; ii++)
+       pMacAddress[ii] = (v_U8_t)macAddr[ii];
+
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pMacAddress = %02x:%02x:%02x:%02x:%02x:%02x",MAC_ADDR_ARRAY(pMacAddress));
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed!!",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+
+    if(pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Ptt response status failed",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "NV_COMMON_MAC_ADDR Success!!!\n");
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    memset( pMsgBuf,0,sizeof(tPttMsgbuffer));
+
+    pMsgBuf->msgId = PTT_MSG_STORE_NV_TABLE;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttStoreNvTable) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    pMsgBody->StoreNvTable.nvTable = NV_FIELDS_IMAGE;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if(status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:wlan_ftm_postmsg failed!!!!",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var, msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+done:
+    vos_mem_free((v_VOID_t * )pMsgBuf);
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/* set param sub-ioctls */
+static int iw_ftm_setchar_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    int sub_cmd = wrqu->data.flags;
+    int ret = 0; /* sucess */
+    VOS_STATUS status;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+
+    switch(sub_cmd)
+    {
+       case WE_SET_MAC_ADDRESS:
+       {
+
+          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "SET MAC ADDRESS\n");
+
+          status  = wlan_ftm_priv_set_mac_address(pAdapter,(char*)wrqu->data.pointer);
+
+          if(status != VOS_STATUS_SUCCESS)
+          {
+             hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_mac_address Failed =%d\n",status);
+             ret = -EINVAL;
+          }
+
+       }
+       break;
+       case WE_SET_TX_RATE:
+       {
+            status  = wlan_ftm_priv_set_txrate(pAdapter,(char*)wrqu->data.pointer);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_txrate Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+
+            break;
+        }
+       default:
+       {
+           hddLog(LOGE, "%s: Invalid sub command %d\n",__FUNCTION__, sub_cmd);
+           ret = -EINVAL;
+           break;
+       }
+    }
+    return ret;
+}
+
+static int iw_ftm_setint_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    int *value = (int *)extra;
+    int sub_cmd = value[0];
+    int set_value = value[1];
+    int ret = 0; /* success */
+    VOS_STATUS status;
+
+    switch(sub_cmd)
+    {
+        case WE_FTM_ON_OFF:
+        {
+            status  = wlan_ftm_priv_start_stop_ftm(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"%s Failed =%d\n",__FUNCTION__, status);
+               ret = -EINVAL;
+            }
+
+            break;
+        }
+
+        case WE_TX_PKT_GEN:
+            status  = wlan_ftm_priv_start_stop_tx_pktgen(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_start_stop_tx_pktgen Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+
+        case WE_SET_TX_IFS:
+            status  = wlan_ftm_priv_set_txifs(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_txifs Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+
+        case WE_SET_TX_PKT_CNT:
+            status  = wlan_ftm_priv_set_txpktcnt(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_txpktcnt Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+
+        case WE_SET_TX_PKT_LEN:
+            status  = wlan_ftm_priv_set_txpktlen(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_txpktlen Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+
+        case WE_SET_CHANNEL:
+        {
+            status  = wlan_ftm_priv_set_channel(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_channel Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+        }
+        case WE_SET_TX_POWER:
+        {
+            status  = wlan_ftm_priv_set_txpower(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_set_txpower Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+        }
+        case WE_CLEAR_RX_PKT_CNT:
+        {
+            status  = wlan_ftm_priv_rx_pkt_clear(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_rx_pkt_clear Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+        }
+        case WE_RX:
+        {
+            status  = wlan_ftm_priv_rx_mode(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_rx_mode Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+        }
+        case WE_ENABLE_CHAIN:
+        {
+            status  = wlan_ftm_priv_enable_chain(pAdapter,set_value);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+               hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_enable_chain Failed =%d\n",status);
+               ret = -EINVAL;
+            }
+            break;
+        }
+
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d \n",
+                sub_cmd, set_value);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+/* get param sub-ioctls */
+static int iw_ftm_setnone_getint(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    int *value = (int *)extra;
+    int ret = 0; /* sucess */
+    VOS_STATUS status;
+
+    switch (value[0])
+    {
+        case WE_GET_CHANNEL:
+        {
+           status = wlan_ftm_priv_get_channel(pAdapter,(v_U16_t*)value);
+
+           if(status != VOS_STATUS_SUCCESS)
+           {
+              hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_get_channel Failed =%d\n",status);
+              ret = -EINVAL;
+           }
+           break;
+        }
+        case WE_GET_TX_POWER:
+        {
+           status = wlan_ftm_priv_get_txpower(pAdapter,(v_U16_t*)value);
+
+           if(status != VOS_STATUS_SUCCESS)
+           {
+              hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_get_txpower Failed =%d\n",status);
+              ret = -EINVAL;
+           }
+           break;
+        }
+        case WE_GET_RX_PKT_CNT:
+        {
+           status = wlan_ftm_priv_get_rx_pkt_count(pAdapter,(v_U16_t*)value);
+
+           if(status != VOS_STATUS_SUCCESS)
+           {
+              hddLog(VOS_TRACE_LEVEL_FATAL,"wlan_ftm_priv_get_rx_pkt_count Failed =%d\n",status);
+              ret = -EINVAL;
+           }
+           break;
+        }
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+static int iw_ftm_get_char_setnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    int sub_cmd = wrqu->data.flags;
+    VOS_STATUS status;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+
+    switch(sub_cmd)
+    {
+        case WE_GET_MAC_ADDRESS:
+        {
+            status = wlan_ftm_priv_get_mac_address(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_mac_address failed =%d\n",status);
+                return -EINVAL;
+            }
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        case WE_GET_TX_RATE:
+        {
+            status = wlan_ftm_priv_get_txrate(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_txrate failed =%d\n",status);
+                return -EINVAL;
+            }
+
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        case WE_GET_FTM_VERSION:
+        {
+            status = wlan_ftm_priv_get_ftm_version(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_mac_address failed =%d\n",status);
+                return -EINVAL;
+            }
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        case WE_GET_FTM_STATUS:
+        {
+            status = wlan_ftm_priv_get_status(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_status failed =%d\n",status);
+                return -EINVAL;
+            }
+
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        case WE_GET_RX_RSSI:
+        {
+            status = wlan_ftm_priv_get_rx_rssi(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_rx_rssi failed =%d\n",status);
+                return -EINVAL;
+            }
+
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL command %d  \n",  sub_cmd );
+            break;
+        }
+    }
+
+    return 0;
+}
+#endif//ANI_MANF_DIAG
+
+VOS_STATUS wlan_write_to_efs (v_U8_t *pData, v_U16_t data_len)
+{
+#if defined(ANI_MANF_DIAG) && defined(MSM_PLATFORM)
+    tAniHdr *wmsg = NULL;
+    v_U8_t *pBuf;
+    hdd_context_t *pHddCtx = NULL;
+    v_CONTEXT_t pVosContext= NULL;
+
+    pBuf =  (v_U8_t*)vos_mem_malloc(sizeof(tAniHdr) + sizeof(v_U32_t)+ data_len);
+    if(pBuf == NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pBuf is NULL",__func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    wmsg = (tAniHdr*)pBuf;
+    wmsg->type = PTT_MSG_FTM_CMDS_TYPE;
+    wmsg->length = data_len + sizeof(tAniHdr)+ sizeof(v_U32_t);
+    wmsg->length = FTM_SWAP16(wmsg->length);
+    pBuf += sizeof(tAniHdr);
+
+     /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+     /*Get the Hdd Context */
+    //pAdapter = ((VosContextType*)(pVosContext))->pHDDContext;
+    pHddCtx = (hdd_context_t *)(((VosContextType*)(pVosContext))->pHDDContext);
+
+    /* EfS command Code */
+    *(v_U32_t*)pBuf = 0x000000EF;
+
+    pBuf += sizeof(v_U32_t);
+
+    memcpy(pBuf, pData,data_len);
+
+   if(pHddCtx->ftm.cmd_iwpriv == TRUE) {
+       if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) {
+
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n"));
+           vos_mem_free((v_VOID_t*)wmsg);
+           return VOS_STATUS_E_FAILURE;
+       }
+   }
+   else {
+    if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ftm.wnl->nlh.nlmsg_pid) < 0) {
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n"));
+        vos_mem_free((v_VOID_t*)wmsg);
+        return VOS_STATUS_E_FAILURE;
+    }
+   }
+
+    vos_mem_free((v_VOID_t*)wmsg);
+#endif //FTM and ANDROID
+
+    return VOS_STATUS_SUCCESS;
+}
+
+#ifdef ANI_MANF_DIAG
+/*  action sub-ioctls */
+static int iw_ftm_setnone_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    int sub_cmd = wrqu->data.flags;
+    int ret = 0; /* sucess */
+
+    switch (sub_cmd)
+    {
+        case WE_SET_NV_DEFAULTS:
+        {
+            v_U8_t *pu8buf,*pTempBuf;
+            v_U16_t size;
+            size = sizeof(v_U32_t) + sizeof(sHalNv);
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"HAL NV Size =%d\n",size);
+            pu8buf = vos_mem_malloc(size);
+            if(pu8buf == NULL)
+            {
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pu8buf is NULL",__func__);
+                return VOS_STATUS_E_NOMEM;
+            }
+            memset(pu8buf,0,size);
+            pTempBuf = pu8buf;
+            pTempBuf += sizeof(v_U32_t);
+            memcpy(pTempBuf,&nvDefaults,sizeof(sHalNv));
+
+            wlan_write_to_efs(pu8buf,size);
+            vos_mem_free(pu8buf);
+        }
+
+        default:
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: unknown ioctl %d", __FUNCTION__, sub_cmd);
+            hddLog(LOGE, "Invalid IOCTL action command %d ", sub_cmd);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+static int iw_ftm_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    int sub_cmd = wrqu->data.flags;
+    int *value = (int*)wrqu->data.pointer;
+    v_S15_t phyRxChains[MAX_FTM_VAR_ARGS] = {0};
+
+    if(wrqu->data.length != 2)
+    {
+        hddLog(LOGE, "Invalid number of Arguments  %d  \n",  wrqu->data.length);
+        return -EINVAL;
+    }
+    switch (sub_cmd)
+    {
+        case WE_SET_RSSI_OFFSET:
+        {
+            phyRxChains[0] = *(v_S15_t*) value++;
+            phyRxChains[1] = *(v_S15_t*) value;
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,"PhyRxchain0=%d PhyRxChain1=%d\n",phyRxChains[0],phyRxChains[1]);
+            wlan_ftm_priv_set_rssi_offset(pAdapter, &phyRxChains[0]);
+        }
+        break;
+
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL command %d  \n",  sub_cmd );
+            break;
+        }
+    }
+
+    return 0;
+}
+
+static const iw_handler we_ftm_private[] = {
+
+   [WLAN_FTM_PRIV_SET_INT_GET_NONE      - SIOCIWFIRSTPRIV]   = iw_ftm_setint_getnone,  //set priv ioctl
+   [WLAN_FTM_PRIV_SET_NONE_GET_INT      - SIOCIWFIRSTPRIV]   = iw_ftm_setnone_getint,  //get priv ioctl
+   [WLAN_FTM_PRIV_SET_CHAR_GET_NONE     - SIOCIWFIRSTPRIV]   = iw_ftm_setchar_getnone, //get priv ioctl
+   [WLAN_FTM_PRIV_GET_CHAR_SET_NONE     - SIOCIWFIRSTPRIV]   = iw_ftm_get_char_setnone,
+   [WLAN_FTM_PRIV_SET_NONE_GET_NONE     - SIOCIWFIRSTPRIV]   = iw_ftm_setnone_getnone, //action priv ioctl
+   [WLAN_FTM_PRIV_SET_VAR_INT_GET_NONE  - SIOCIWFIRSTPRIV]   = iw_ftm_set_var_ints_getnone,
+};
+
+/*Maximum command length can be only 15 */
+static const struct iw_priv_args we_ftm_private_args[] = {
+
+    /* handlers for main ioctl */
+    {   WLAN_FTM_PRIV_SET_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "" },
+
+    {   WE_FTM_ON_OFF,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "ftm" },
+
+    {   WE_TX_PKT_GEN,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "tx" },
+
+    {   WE_SET_TX_IFS,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set_txifs" },
+
+    {   WE_SET_TX_PKT_CNT,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set_txpktcnt" },
+
+    {   WE_SET_TX_PKT_LEN,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set_txpktlen" },
+
+    {   WE_SET_CHANNEL,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set_channel" },
+
+    {   WE_SET_TX_POWER,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set_txpower" },
+
+    {   WE_CLEAR_RX_PKT_CNT,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "clr_rxpktcnt" },
+
+    {   WE_RX,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "rx" },
+
+    {   WE_ENABLE_CHAIN,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "ena_chain" },
+
+    /* handlers for main ioctl */
+    {   WLAN_FTM_PRIV_SET_NONE_GET_INT,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "" },
+
+    {   WE_GET_CHANNEL,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "get_channel" },
+
+    {   WE_GET_TX_POWER,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "get_txpower" },
+
+    {   WE_GET_RX_PKT_CNT,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "get_rxpktcnt" },
+
+    /* handlers for main ioctl */
+    {   WLAN_FTM_PRIV_SET_CHAR_GET_NONE,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "" },
+
+    {   WE_SET_MAC_ADDRESS,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "set_mac_address" },
+
+    {   WE_SET_TX_RATE,
+        IW_PRIV_TYPE_CHAR | 512,
+        0,
+        "set_txrate" },
+
+    /* handlers for main ioctl */
+    {   WLAN_FTM_PRIV_GET_CHAR_SET_NONE,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "" },
+
+    {   WE_GET_MAC_ADDRESS,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "get_mac_address" },
+
+    {   WE_GET_FTM_VERSION,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "ftm_version" },
+
+    {   WE_GET_TX_RATE,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "get_txrate" },
+
+    {   WE_GET_FTM_STATUS,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "get_status" },
+
+    {   WE_GET_RX_RSSI,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "get_rx_rssi" },
+
+    {   WLAN_FTM_PRIV_SET_VAR_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | MAX_FTM_VAR_ARGS,
+        0,
+        "" },
+
+    {   WE_SET_RSSI_OFFSET,
+        IW_PRIV_TYPE_INT| MAX_FTM_VAR_ARGS,
+        0,
+        "set_rssi_offset" },
+
+    /* handlers for main ioctl */
+    {   WLAN_FTM_PRIV_SET_NONE_GET_NONE,
+        0,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_SET_NV_DEFAULTS,
+        0,
+        0,
+        "set_nv_defaults" },
+
+};
+
+const struct iw_handler_def we_ftm_handler_def = {
+   .num_standard     = 0,
+   .num_private      = sizeof(we_ftm_private) / sizeof(we_ftm_private[0]),
+   .num_private_args = sizeof(we_ftm_private_args) / sizeof(we_ftm_private_args[0]),
+
+   .standard         = (iw_handler *)NULL,
+   .private          = (iw_handler *)we_ftm_private,
+   .private_args     = we_ftm_private_args,
+   .get_wireless_stats = NULL,
+};
+
+static int wlan_ftm_register_wext(hdd_adapter_t *pAdapter)
+{
+
+    //hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    // Zero the memory.  This zeros the profile structure.
+    //memset(pwextBuf, 0,sizeof(hdd_wext_state_t));
+   
+    pAdapter->dev->wireless_handlers = (struct iw_handler_def *)&we_ftm_handler_def;
+
+    return 0;
+}
+
+#endif //ANI_MANF_DIAG
+
+VOS_STATUS WLANFTM_McProcessMsg (v_VOID_t *message)
+{
+#ifdef ANI_MANF_DIAG
+    ftm_rsp_msg_t   *pFtmMsgRsp;
+
+    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+    hdd_context_t *pHddCtx;
+    v_CONTEXT_t pVosContext= NULL;
+
+    ENTER();
+
+    pFtmMsgRsp = (ftm_rsp_msg_t *)message;
+
+    if (!message )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                "WLAN FTM:Invalid parameter sent on WLANFTM_ProcessMainMessage");
+        return VOS_STATUS_E_INVAL;
+    }
+    /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+     /*Get the Hdd Context */
+    pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext;
+
+    if (pHddCtx->ftm.cmd_iwpriv == TRUE) {
+
+        complete(&pHddCtx->ftm.ftm_comp_var);
+    }
+    else {
+    /*Response length to Ptt App*/
+    pHddCtx->ftm.wnl->wmsg.length = sizeof(tAniHdr)+ SIZE_OF_FTM_DIAG_HEADER_LEN + pFtmMsgRsp->msgBodyLength;
+
+     /*Ptt App expects the response length in LE */
+    pHddCtx->ftm.wnl->wmsg.length = FTM_SWAP16(pHddCtx->ftm.wnl->wmsg.length);
+
+    /*Response expects the length to be in */
+    pHddCtx->ftm.pResponseBuf->ftm_hdr.data_len = pHddCtx->ftm.pRequestBuf->ftm_hdr.data_len - 
+                                           sizeof(pHddCtx->ftm.pRequestBuf->ftm_hdr.data_len);
+
+    /*Copy the message*/
+    memcpy((char*)&pHddCtx->ftm.pResponseBuf->ftmpkt,(char*)message,pFtmMsgRsp->msgBodyLength);
+
+    /*Update the error code*/
+    pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_SUCCESS;
+
+    vos_status = vos_event_set(&pHddCtx->ftm.ftm_vos_event);
+
+    if (!VOS_IS_STATUS_SUCCESS(vos_status))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos_event_set failed!!\n"));
+       return VOS_STATUS_E_FAILURE;
+    }
+    }
+    EXIT();
+#endif
+    return VOS_STATUS_SUCCESS;
+
+}
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
new file mode 100644
index 0000000..585dc9b
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -0,0 +1,2753 @@
+/*
+ * 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  wlan_hdd_hostapd.c
+  \brief WLAN Host Device Driver implementation
+               
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  04/5/09     Shailender     Created module. 
+  06/03/10    js - Added support to hostapd driven deauth/disassoc/mic failure
+  ==========================================================================*/
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+   
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/wireless.h>
+#include <linux/semaphore.h>
+#include <vos_api.h>
+#include <vos_sched.h>
+#include <linux/etherdevice.h>
+#include <wlan_hdd_includes.h>
+#include <qc_sap_ioctl.h>
+#include <wlan_hdd_hostapd.h>
+#include <sapApi.h>
+#include <sapInternal.h>
+#include <wlan_qct_tl.h>
+#include <wlan_hdd_softap_tx_rx.h>
+#include <wlan_hdd_main.h>
+#include <linux/netdevice.h>
+#include <linux/mmc/sdio_func.h>
+#include "wlan_nlink_common.h"
+#include "wlan_btc_svc.h"
+#include <bap_hdd_main.h>
+#if defined CONFIG_CFG80211
+#include "wlan_hdd_p2p.h"
+#endif
+
+#define    IS_UP(_dev) \
+    (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
+#define    IS_UP_AUTO(_ic) \
+    (IS_UP((_ic)->ic_dev) && (_ic)->ic_roaming == IEEE80211_ROAMING_AUTO)
+#define WE_WLAN_VERSION     1
+#define STATS_CONTEXT_MAGIC 0x53544154
+
+struct statsContext
+{
+   struct completion completion;
+   hdd_adapter_t *pAdapter;
+   unsigned int magic;
+};
+#define SAP_24GHZ_CH_COUNT (14) 
+/*--------------------------------------------------------------------------- 
+ *   Function definitions
+ *-------------------------------------------------------------------------*/
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_hostapd_open() - HDD Open function for hostapd interface
+  
+  This is called in response to ifconfig up
+  
+  \param  - dev Pointer to net_device structure
+  
+  \return - 0 for success non-zero for failure
+              
+  --------------------------------------------------------------------------*/
+int hdd_hostapd_open (struct net_device *dev)
+{
+   ENTER();
+
+   //Turn ON carrier state
+   netif_carrier_on(dev);
+   //Enable all Tx queues  
+   netif_tx_start_all_queues(dev);
+   
+   EXIT();
+   return 0;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_hostapd_stop() - HDD stop function for hostapd interface
+  
+  This is called in response to ifconfig down
+  
+  \param  - dev Pointer to net_device structure
+  
+  \return - 0 for success non-zero for failure
+              
+  --------------------------------------------------------------------------*/
+int hdd_hostapd_stop (struct net_device *dev)
+{
+   ENTER();
+
+   //Stop all tx queues
+   netif_tx_disable(dev);
+   
+   //Turn OFF carrier state
+   netif_carrier_off(dev);
+
+   EXIT();
+   return 0;
+}
+/**---------------------------------------------------------------------------
+
+  \brief hdd_hostapd_uninit() - HDD uninit function
+
+  This is called during the netdev unregister to uninitialize all data
+associated with the device
+
+  \param  - dev Pointer to net_device structure
+
+  \return - void
+
+  --------------------------------------------------------------------------*/
+static void hdd_hostapd_uninit (struct net_device *dev)
+{
+   hdd_adapter_t *pHostapdAdapter = netdev_priv(dev);
+
+   ENTER();
+
+   if (pHostapdAdapter && pHostapdAdapter->pHddCtx)
+   {
+      hdd_deinit_adapter(pHostapdAdapter->pHddCtx, pHostapdAdapter);
+
+      /* after uninit our adapter structure will no longer be valid */
+      pHostapdAdapter->dev = NULL;
+   }
+
+   EXIT();
+}
+
+
+/**============================================================================
+  @brief hdd_hostapd_hard_start_xmit() - Function registered with the Linux OS for 
+  transmitting packets. There are 2 versions of this function. One that uses
+  locked queue and other that uses lockless queues. Both have been retained to
+  do some performance testing
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+int hdd_hostapd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+    return 0;    
+}
+int hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu)
+{
+    return 0;
+}
+
+int hdd_hostapd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_priv_data_t priv_data;
+    tANI_U8 *command = NULL;
+    int ret = 0;
+
+    if (NULL == pAdapter)
+    {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+          "%s: HDD adapter context is Null", __FUNCTION__);
+       ret = -ENODEV;
+       goto exit;
+    }
+
+    if ((!ifr) && (!ifr->ifr_data))
+    {
+        ret = -EINVAL;
+        goto exit;
+    }
+
+    if (copy_from_user(&priv_data, ifr->ifr_data, sizeof(hdd_priv_data_t)))
+    {
+        ret = -EFAULT;
+        goto exit;
+    }
+
+    command = kmalloc(priv_data.total_len, GFP_KERNEL);
+    if (!command)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+           "%s: failed to allocate memory\n", __FUNCTION__);
+        ret = -ENOMEM;
+        goto exit;
+    }
+
+    if (copy_from_user(command, priv_data.buf, priv_data.total_len))
+    {
+        ret = -EFAULT;
+        goto exit;
+    }
+
+    if ((SIOCDEVPRIVATE + 1) == cmd)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+           "***HOSTAPD*** : Received %s cmd from Wi-Fi GUI***", command);
+
+#ifdef WLAN_FEATURE_P2P
+        if(strncmp(command, "P2P_SET_NOA", 11) == 0 )   
+        {
+            hdd_setP2pNoa(dev, command);
+        }
+        else if( strncmp(command, "P2P_SET_PS", 10) == 0 )
+        {
+            hdd_setP2pOpps(dev, command);
+        }
+#endif
+    }
+exit:
+   if (command)
+   {
+       kfree(command);
+   }
+   return ret;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_hostapd_set_mac_address() - 
+   This function sets the user specified mac address using 
+   the command ifconfig wlanX hw ether <mac adress>.
+   
+  \param  - dev - Pointer to the net device.
+              - addr - Pointer to the sockaddr.
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+
+static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr)
+{
+   struct sockaddr *psta_mac_addr = addr;
+   ENTER();
+   memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN);
+   EXIT();
+   return 0;
+}
+void hdd_hostapd_inactivity_timer_cb(v_PVOID_t usrDataForCallback)
+{
+    struct net_device *dev = (struct net_device *)usrDataForCallback;
+    v_BYTE_t we_custom_event[64];
+    union iwreq_data wrqu;
+#ifdef DISABLE_CONCURRENCY_AUTOSAVE    
+    VOS_STATUS vos_status;
+    hdd_adapter_t *pHostapdAdapter;
+    hdd_ap_ctx_t *pHddApCtx;
+#endif /*DISABLE_CONCURRENCY_AUTOSAVE */
+
+    /* event_name space-delimiter driver_module_name */
+    /* Format of the event is "AUTO-SHUT.indication" " " "module_name" */
+    char * autoShutEvent = "AUTO-SHUT.indication" " "  KBUILD_MODNAME;
+    int event_len = strlen(autoShutEvent) + 1; /* For the NULL at the end */
+
+    ENTER();
+
+#ifdef DISABLE_CONCURRENCY_AUTOSAVE    
+    if (vos_concurrent_sessions_running())
+    {  
+       /*
+              This timer routine is going to be called only when AP
+              persona is up.
+              If there are concurrent sessions running we do not want
+              to shut down the Bss.Instead we run the timer again so
+              that if Autosave is enabled next time and other session
+              was down only then we bring down AP 
+             */
+        pHostapdAdapter = netdev_priv(dev);
+        pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
+        vos_status = vos_timer_start(
+         &pHddApCtx->hdd_ap_inactivity_timer, 
+         (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff
+          * 1000);
+        if (!VOS_IS_STATUS_SUCCESS(vos_status))
+        {
+            hddLog(LOGE, FL("Failed to init AP inactivity timer"));
+        }
+        EXIT();
+        return;
+    }
+#endif /*DISABLE_CONCURRENCY_AUTOSAVE */
+    memset(&we_custom_event, '\0', sizeof(we_custom_event));
+    memcpy(&we_custom_event, autoShutEvent, event_len);
+
+    memset(&wrqu, 0, sizeof(wrqu));
+    wrqu.data.length = event_len;
+
+    hddLog(LOG1, FL("Shutting down AP interface due to inactivity"));
+    wireless_send_event(dev, IWEVCUSTOM, &wrqu, (char *)we_custom_event);    
+
+    EXIT();
+}
+
+
+VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCallback)
+{
+    hdd_adapter_t *pHostapdAdapter;
+    hdd_ap_ctx_t *pHddApCtx;
+    hdd_hostapd_state_t *pHostapdState;
+    struct net_device *dev;
+    eSapHddEvent sapEvent;
+    union iwreq_data wrqu;
+    v_BYTE_t *we_custom_event_generic = NULL;
+    int we_event = 0;
+    int i = 0;
+    v_U8_t staId;
+    VOS_STATUS vos_status; 
+    v_BOOL_t bWPSState;
+    v_BOOL_t bApActive = FALSE;
+    v_BOOL_t bAuthRequired = TRUE;
+    tpSap_AssocMacAddr pAssocStasArray = NULL;
+    char unknownSTAEvent[IW_CUSTOM_MAX+1];
+    char maxAssocExceededEvent[IW_CUSTOM_MAX+1];
+    v_BYTE_t we_custom_start_event[64];
+    char *startBssEvent; 
+
+    dev = (struct net_device *)usrDataForCallback;
+    pHostapdAdapter = netdev_priv(dev);
+    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); 
+    pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
+    sapEvent = pSapEvent->sapHddEventCode;
+    memset(&wrqu, '\0', sizeof(wrqu));
+
+    switch(sapEvent)
+    {
+        case eSAP_START_BSS_EVENT :
+            hddLog(LOG1, FL("BSS configured status = %s, channel = %lu, bc sta Id = %d\n"),
+                            pSapEvent->sapevt.sapStartBssCompleteEvent.status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS",
+                            pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel,
+                              pSapEvent->sapevt.sapStartBssCompleteEvent.staId);
+
+            pHostapdState->vosStatus = pSapEvent->sapevt.sapStartBssCompleteEvent.status;
+            vos_status = vos_event_set(&pHostapdState->vosEvent);
+   
+            if (!VOS_IS_STATUS_SUCCESS(vos_status) || pHostapdState->vosStatus)
+            {     
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: startbss event failed!!\n"));
+                goto stopbss;
+            }
+            else
+            {                
+                pHddApCtx->uBCStaId = pSapEvent->sapevt.sapStartBssCompleteEvent.staId;
+                //@@@ need wep logic here to set privacy bit
+                hdd_softap_Register_BC_STA(pHostapdAdapter, pHddApCtx->uPrivacy);
+            }
+            
+            if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff)
+            {
+                // AP Inactivity timer init and start
+                vos_status = vos_timer_init( &pHddApCtx->hdd_ap_inactivity_timer, VOS_TIMER_TYPE_SW, 
+                                            hdd_hostapd_inactivity_timer_cb, (v_PVOID_t)dev );
+                if (!VOS_IS_STATUS_SUCCESS(vos_status))
+                   hddLog(LOGE, FL("Failed to init AP inactivity timer\n"));
+
+                vos_status = vos_timer_start( &pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000);
+                if (!VOS_IS_STATUS_SUCCESS(vos_status))
+                   hddLog(LOGE, FL("Failed to init AP inactivity timer\n"));
+
+            }
+            pHddApCtx->operatingChannel = pSapEvent->sapevt.sapStartBssCompleteEvent.operatingChannel;
+            pHostapdState->bssState = BSS_START;
+
+            // Send current operating channel of SoftAP to BTC-ES
+            send_btc_nlink_msg(WLAN_BTC_SOFTAP_BSS_START, 0);
+
+#ifdef CONFIG_CFG80211            
+            //Check if there is any group key pending to set.
+            if( pHddApCtx->groupKey.keyLength )
+            {
+                 if( eHAL_STATUS_SUCCESS !=  WLANSAP_SetKeySta( 
+                               (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext,
+                               &pHddApCtx->groupKey ) )
+                 {
+                      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                             "%s: WLANSAP_SetKeySta failed", __func__);
+                 }
+                 pHddApCtx->groupKey.keyLength = 0;
+            }
+            else if ( pHddApCtx->wepKey[0].keyLength )
+            {
+                int i=0;
+                for ( i = 0; i < CSR_MAX_NUM_KEY; i++ ) 
+                {
+                    if( eHAL_STATUS_SUCCESS !=  WLANSAP_SetKeySta(
+                                (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext,
+                                &pHddApCtx->wepKey[i] ) )
+                    {   
+                          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                             "%s: WLANSAP_SetKeySta failed idx %d", __func__, i);
+                    }
+                    pHddApCtx->wepKey[i].keyLength = 0;
+                }
+           }
+#endif
+            //Fill the params for sending IWEVCUSTOM Event with SOFTAP.enabled
+            startBssEvent = "SOFTAP.enabled";
+            memset(&we_custom_start_event, '\0', sizeof(we_custom_start_event));
+            memcpy(&we_custom_start_event, startBssEvent, strlen(startBssEvent));
+            memset(&wrqu, 0, sizeof(wrqu));
+            wrqu.data.length = strlen(startBssEvent);
+            we_event = IWEVCUSTOM;
+            we_custom_event_generic = we_custom_start_event;
+
+            break; //Event will be sent after Switch-Case stmt 
+
+        case eSAP_STOP_BSS_EVENT:
+            hddLog(LOG1, FL("BSS stop status = %s\n"),pSapEvent->sapevt.sapStopBssCompleteEvent.status ? 
+                             "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS");
+
+            pHddApCtx->operatingChannel = 0; //Invalidate the channel info.
+            vos_event_set(&pHostapdState->vosEvent);
+            goto stopbss;
+        case eSAP_STA_SET_KEY_EVENT:
+            //TODO: forward the message to hostapd once implementtation is done for now just print
+            hddLog(LOG1, FL("SET Key: configured status = %s\n"),pSapEvent->sapevt.sapStationSetKeyCompleteEvent.status ? 
+                            "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS");
+            return VOS_STATUS_SUCCESS;
+        case eSAP_STA_DEL_KEY_EVENT:
+           //TODO: forward the message to hostapd once implementtation is done for now just print
+           hddLog(LOG1, FL("Event received %s\n"),"eSAP_STA_DEL_KEY_EVENT");
+           return VOS_STATUS_SUCCESS;
+        case eSAP_STA_MIC_FAILURE_EVENT:
+        {
+            struct iw_michaelmicfailure msg;
+            memset(&msg, '\0', sizeof(msg));
+            msg.src_addr.sa_family = ARPHRD_ETHER;
+            memcpy(msg.src_addr.sa_data, &pSapEvent->sapevt.sapStationMICFailureEvent.staMac, sizeof(msg.src_addr.sa_data));
+            hddLog(LOG1, "MIC MAC "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(msg.src_addr.sa_data));
+            if(pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eCSR_ROAM_RESULT_MIC_ERROR_GROUP)
+             msg.flags = IW_MICFAILURE_GROUP;
+            else 
+             msg.flags = IW_MICFAILURE_PAIRWISE;
+            memset(&wrqu, 0, sizeof(wrqu));
+            wrqu.data.length = sizeof(msg);
+            we_event = IWEVMICHAELMICFAILURE;
+            we_custom_event_generic = (v_BYTE_t *)&msg;
+        }
+#ifdef CONFIG_CFG80211
+      /* inform mic failure to nl80211 */
+        cfg80211_michael_mic_failure(dev, 
+                                     pSapEvent->sapevt.
+                                     sapStationMICFailureEvent.staMac.bytes,
+                                     ((pSapEvent->sapevt.sapStationMICFailureEvent.multicast == eSIR_TRUE) ? 
+                                      NL80211_KEYTYPE_GROUP :
+                                      NL80211_KEYTYPE_PAIRWISE),
+                                     pSapEvent->sapevt.sapStationMICFailureEvent.keyId, 
+                                     pSapEvent->sapevt.sapStationMICFailureEvent.TSC, 
+                                     GFP_KERNEL);
+#endif
+            break;
+        
+        case eSAP_STA_ASSOC_EVENT:
+        case eSAP_STA_REASSOC_EVENT:
+            wrqu.addr.sa_family = ARPHRD_ETHER;
+            memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac, 
+                sizeof(wrqu.addr.sa_data));
+            hddLog(LOG1, " associated "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(wrqu.addr.sa_data));
+            we_event = IWEVREGISTERED;
+            
+            WLANSAP_Get_WPS_State((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, &bWPSState);
+         
+            if ( (eCSR_ENCRYPT_TYPE_NONE == pHddApCtx->ucEncryptType) ||
+                 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddApCtx->ucEncryptType ) || 
+                 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddApCtx->ucEncryptType ) )
+            {
+                bAuthRequired = FALSE;
+            }
+
+            if (bAuthRequired || bWPSState == eANI_BOOLEAN_TRUE )
+            {
+                hdd_softap_RegisterSTA( pHostapdAdapter,
+                                       TRUE,
+                                       pHddApCtx->uPrivacy,
+                                       pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId,
+                                       0,
+                                       0,
+                                       (v_MACADDR_t *)wrqu.addr.sa_data,
+                                       pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled);
+            }
+            else
+            {
+                hdd_softap_RegisterSTA( pHostapdAdapter,
+                                       FALSE,
+                                       pHddApCtx->uPrivacy,
+                                       pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId,
+                                       0,
+                                       0,
+                                       (v_MACADDR_t *)wrqu.addr.sa_data,
+                                       pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled);
+            } 
+            
+            // Stop AP inactivity timer
+            if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_RUNNING)
+            {
+                vos_status = vos_timer_stop(&pHddApCtx->hdd_ap_inactivity_timer);
+                if (!VOS_IS_STATUS_SUCCESS(vos_status))
+                   hddLog(LOGE, FL("Failed to start AP inactivity timer\n"));
+            }
+#ifdef CONFIG_CFG80211
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+            {
+                struct station_info staInfo;
+                v_U16_t iesLen =  pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.iesLen;
+
+                memset(&staInfo, 0, sizeof(staInfo));
+                if (iesLen <= MAX_ASSOC_IND_IE_LEN )
+                {
+                    staInfo.assoc_req_ies =
+                        (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.ies[0];
+                    staInfo.assoc_req_ies_len = iesLen;
+                    cfg80211_new_sta(dev,
+                                 (const u8 *)&pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staMac.bytes[0],
+                                 &staInfo, GFP_KERNEL);
+                }
+                else
+                {
+                    hddLog(LOGE, FL(" Assoc Ie length is too long \n"));
+                }
+             }
+#endif
+#endif
+
+            break;
+        case eSAP_STA_DISASSOC_EVENT:
+            memcpy(wrqu.addr.sa_data, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac,
+                   sizeof(wrqu.addr.sa_data));
+            hddLog(LOG1, " disassociated "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(wrqu.addr.sa_data));
+            if (pSapEvent->sapevt.sapStationDisassocCompleteEvent.reason == eSAP_USR_INITATED_DISASSOC)
+                hddLog(LOG1," User initiated disassociation");
+            else
+                hddLog(LOG1," MAC initiated disassociation");
+            we_event = IWEVEXPIRED;
+            vos_status = hdd_softap_GetStaId(pHostapdAdapter, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, &staId);
+            if (!VOS_IS_STATUS_SUCCESS(vos_status))
+            {
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD Failed to find sta id!!\n"));
+                return VOS_STATUS_E_FAILURE;
+            }
+            hdd_softap_DeregisterSTA(pHostapdAdapter, staId);
+
+            if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff)
+            {
+                spin_lock_bh( &pHostapdAdapter->staInfo_lock );
+                // Start AP inactivity timer if no stations associated with it
+                for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
+                {
+                    if (pHostapdAdapter->aStaInfo[i].isUsed && i != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId)
+                    {
+                        bApActive = TRUE;
+                        break;
+                    }
+                }
+                spin_unlock_bh( &pHostapdAdapter->staInfo_lock );
+
+                if (bApActive == FALSE)
+                {
+                    if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_STOPPED)
+                    {
+                        vos_status = vos_timer_start(&pHddApCtx->hdd_ap_inactivity_timer, (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff * 1000);
+                        if (!VOS_IS_STATUS_SUCCESS(vos_status))
+                            hddLog(LOGE, FL("Failed to init AP inactivity timer\n"));
+                    }
+                    else
+                        VOS_ASSERT(vos_timer_getCurrentState(&pHddApCtx->hdd_ap_inactivity_timer) == VOS_TIMER_STATE_STOPPED);
+                }
+            }
+#ifdef CONFIG_CFG80211
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+            cfg80211_del_sta(dev,
+                            (const u8 *)&pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac.bytes[0],
+                            GFP_KERNEL);
+#endif
+#endif
+            break;
+        case eSAP_WPS_PBC_PROBE_REQ_EVENT:
+        {
+                static const char * message ="MLMEWPSPBCPROBEREQ.indication";
+                union iwreq_data wreq;
+               
+                down(&pHddApCtx->semWpsPBCOverlapInd);
+                pHddApCtx->WPSPBCProbeReq.probeReqIELen = pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIELen;
+                
+                vos_mem_copy(pHddApCtx->WPSPBCProbeReq.probeReqIE, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.probeReqIE, 
+                    pHddApCtx->WPSPBCProbeReq.probeReqIELen);
+                     
+                vos_mem_copy(pHddApCtx->WPSPBCProbeReq.peerMacAddr, pSapEvent->sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq.peerMacAddr, sizeof(v_MACADDR_t));
+                hddLog(LOG1, "WPS PBC probe req "MAC_ADDRESS_STR"\n", MAC_ADDR_ARRAY(pHddApCtx->WPSPBCProbeReq.peerMacAddr));
+                memset(&wreq, 0, sizeof(wreq));
+                wreq.data.length = strlen(message); // This is length of message
+                wireless_send_event(dev, IWEVCUSTOM, &wreq, (char *)message); 
+                
+                return VOS_STATUS_SUCCESS;
+        }
+        case eSAP_ASSOC_STA_CALLBACK_EVENT:
+            pAssocStasArray = pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas;
+            if (pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta != 0)
+            {   // List of associated stations
+                for (i = 0; i < pSapEvent->sapevt.sapAssocStaListEvent.noOfAssocSta; i++)
+                {
+                    hddLog(LOG1,"Associated Sta Num %d:assocId=%d, staId=%d, staMac="MAC_ADDRESS_STR,
+                        i+1,
+                        pAssocStasArray->assocId,
+                        pAssocStasArray->staId,
+                                    MAC_ADDR_ARRAY(pAssocStasArray->staMac.bytes));
+                        pAssocStasArray++;             
+            }
+            }
+            vos_mem_free(pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas);// Release caller allocated memory here
+            return VOS_STATUS_SUCCESS;
+#ifdef WLAN_FEATURE_P2P
+        case eSAP_INDICATE_MGMT_FRAME:
+           hdd_indicateMgmtFrame( pHostapdAdapter, 
+                                 pSapEvent->sapevt.sapManagementFrameInfo.nFrameLength,
+                                 pSapEvent->sapevt.sapManagementFrameInfo.pbFrames,
+                                 pSapEvent->sapevt.sapManagementFrameInfo.frameType, 
+                                 pSapEvent->sapevt.sapManagementFrameInfo.rxChan);
+           return VOS_STATUS_SUCCESS;
+        case eSAP_REMAIN_CHAN_READY:
+           hdd_remainChanReadyHandler( pHostapdAdapter );
+           return VOS_STATUS_SUCCESS;
+        case eSAP_SEND_ACTION_CNF:
+           hdd_sendActionCnf( pHostapdAdapter, 
+                              ( eSAP_STATUS_SUCCESS == 
+                                pSapEvent->sapevt.sapActionCnf.actionSendSuccess ) ? 
+                                TRUE : FALSE );
+           return VOS_STATUS_SUCCESS;
+#endif
+        case eSAP_UNKNOWN_STA_JOIN:
+            snprintf(unknownSTAEvent, IW_CUSTOM_MAX, "JOIN_UNKNOWN_STA-%02x:%02x:%02x:%02x:%02x:%02x",
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[0],
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[1],
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[2],
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[3],
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[4],
+                pSapEvent->sapevt.sapUnknownSTAJoin.macaddr.bytes[5]);
+            we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */
+            wrqu.data.pointer = unknownSTAEvent;
+            wrqu.data.length = strlen(unknownSTAEvent);
+            we_custom_event_generic = (v_BYTE_t *)unknownSTAEvent;
+            hddLog(LOG1,"%s\n", unknownSTAEvent);
+            break;
+
+        case eSAP_MAX_ASSOC_EXCEEDED:
+            snprintf(maxAssocExceededEvent, IW_CUSTOM_MAX, "Peer %02x:%02x:%02x:%02x:%02x:%02x denied"
+                    " assoc due to Maximum Mobile Hotspot connections reached. Please disconnect"
+                    " one or more devices to enable the new device connection",
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[0],
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[1],
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[2],
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[3],
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[4],
+                    pSapEvent->sapevt.sapMaxAssocExceeded.macaddr.bytes[5]);
+            we_event = IWEVCUSTOM; /* Discovered a new node (AP mode). */
+            wrqu.data.pointer = maxAssocExceededEvent;
+            wrqu.data.length = strlen(maxAssocExceededEvent);
+            we_custom_event_generic = (v_BYTE_t *)maxAssocExceededEvent;
+            hddLog(LOG1,"%s\n", maxAssocExceededEvent);
+            break;
+        case eSAP_STA_ASSOC_IND:
+            return VOS_STATUS_SUCCESS;
+        default:
+            hddLog(LOG1,"SAP message is not handled\n");
+            goto stopbss;
+            return VOS_STATUS_SUCCESS;
+    }
+    wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic);
+    return VOS_STATUS_SUCCESS;
+
+stopbss :
+    {
+        v_BYTE_t we_custom_event[64];
+        char *stopBssEvent = "STOP-BSS.response";//17
+        int event_len = strlen(stopBssEvent);
+
+        hddLog(LOG1, FL("BSS stop status = %s"),
+               pSapEvent->sapevt.sapStopBssCompleteEvent.status ?
+                            "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS");
+
+        /* Change the BSS state now since, as we are shutting things down,
+         * we don't want interfaces to become re-enabled */
+        pHostapdState->bssState = BSS_STOP;
+
+        /* Stop the pkts from n/w stack as we are going to free all of
+         * the TX WMM queues for all STAID's */
+        hdd_hostapd_stop(dev);
+
+        /* reclaim all resources allocated to the BSS */
+        hdd_softap_stop_bss(pHostapdAdapter);
+
+        /* notify userspace that the BSS has stopped */
+        memset(&we_custom_event, '\0', sizeof(we_custom_event));
+        memcpy(&we_custom_event, stopBssEvent, event_len);
+        memset(&wrqu, 0, sizeof(wrqu));
+        wrqu.data.length = event_len;
+        we_event = IWEVCUSTOM;
+        we_custom_event_generic = we_custom_event;
+        wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic);
+    }
+    return VOS_STATUS_SUCCESS;
+}
+int hdd_softap_unpackIE( 
+                tHalHandle halHandle,
+                eCsrEncryptionType *pEncryptType, 
+                eCsrEncryptionType *mcEncryptType, 
+                eCsrAuthType *pAuthType, 
+                u_int16_t gen_ie_len, 
+                u_int8_t *gen_ie )
+{
+    tDot11fIERSN dot11RSNIE; 
+    tDot11fIEWPA dot11WPAIE; 
+ 
+    tANI_U8 *pRsnIe; 
+    tANI_U16 RSNIeLen;
+    
+    if (NULL == halHandle)
+    {
+        hddLog(LOGE, FL("Error haHandle returned NULL\n"));
+        return -EINVAL;
+    }
+    
+    // Validity checks
+    if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) ||  
+        (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) 
+        return -EINVAL;
+    // Type check
+    if ( gen_ie[0] ==  DOT11F_EID_RSN) 
+    {         
+        // Validity checks
+        if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) ||  
+            (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) )
+        {
+            return VOS_STATUS_E_FAILURE;
+        }
+        // Skip past the EID byte and length byte  
+        pRsnIe = gen_ie + 2; 
+        RSNIeLen = gen_ie_len - 2; 
+        // Unpack the RSN IE
+        memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN));
+        dot11fUnpackIeRSN((tpAniSirGlobal) halHandle, 
+                            pRsnIe, 
+                            RSNIeLen, 
+                            &dot11RSNIE);
+        // Copy out the encryption and authentication types 
+        hddLog(LOG1, FL("%s: pairwise cipher suite count: %d\n"), 
+                __FUNCTION__, dot11RSNIE.pwise_cipher_suite_count );
+        hddLog(LOG1, FL("%s: authentication suite count: %d\n"), 
+                __FUNCTION__, dot11RSNIE.akm_suite_count);
+        /*Here we have followed the apple base code, 
+          but probably I suspect we can do something different*/
+        //dot11RSNIE.akm_suite_count
+        // Just translate the FIRST one 
+        *pAuthType =  hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]); 
+        //dot11RSNIE.pwise_cipher_suite_count 
+        *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]);                     
+        //dot11RSNIE.gp_cipher_suite_count 
+        *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite);                     
+        // Set the PMKSA ID Cache for this interface
+          
+        // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache
+    } else 
+    if (gen_ie[0] == DOT11F_EID_WPA) 
+    {         
+        // Validity checks
+        if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) ||  
+            (gen_ie_len > DOT11F_IE_WPA_MAX_LEN))
+        {
+            return VOS_STATUS_E_FAILURE;
+        }
+        // Skip past the EID byte and length byte - and four byte WiFi OUI  
+        pRsnIe = gen_ie + 2 + 4; 
+        RSNIeLen = gen_ie_len - (2 + 4); 
+        // Unpack the WPA IE
+        memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA));
+        dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, 
+                            pRsnIe, 
+                            RSNIeLen, 
+                            &dot11WPAIE);
+        // Copy out the encryption and authentication types 
+        hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d\n"), 
+                __FUNCTION__, dot11WPAIE.unicast_cipher_count );
+        hddLog(LOG1, FL("%s: WPA authentication suite count: %d\n"), 
+                __FUNCTION__, dot11WPAIE.auth_suite_count);
+        //dot11WPAIE.auth_suite_count
+        // Just translate the FIRST one 
+        *pAuthType =  hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); 
+        //dot11WPAIE.unicast_cipher_count 
+        *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]);                       
+        //dot11WPAIE.unicast_cipher_count 
+        *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher);                       
+    } 
+    else 
+    { 
+        hddLog(LOGW, FL("%s: gen_ie[0]: %d\n"), __FUNCTION__, gen_ie[0]);
+        return VOS_STATUS_E_FAILURE; 
+    }
+    return VOS_STATUS_SUCCESS;
+}
+int
+static iw_softap_setparam(struct net_device *dev, 
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    int *value = (int *)extra;
+    int sub_cmd = value[0];
+    int set_value = value[1];
+    eHalStatus status;
+    int ret = 0; /* success */
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
+
+    switch(sub_cmd)
+    {
+
+        case QCSAP_PARAM_CLR_ACL:
+            if ( eHAL_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext ))
+            {
+               ret = -EIO;            
+            }
+            break;
+
+        case QCSAP_PARAM_ACL_MODE:
+            if ((eSAP_ALLOW_ALL < (eSapMacAddrACL)set_value) || 
+                (eSAP_ACCEPT_UNLESS_DENIED > (eSapMacAddrACL)set_value))
+            {
+                hddLog(LOGE, FL("Invalid ACL Mode value %d"), set_value);
+                ret = -EINVAL;
+            }
+            else
+            {
+                WLANSAP_SetMode(pVosContext, set_value);
+            }
+            break;
+        case QCSAP_PARAM_MAX_ASSOC:
+            if (WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value)
+            {
+                hddLog(LOGE, FL("Invalid setMaxAssoc value %d"), set_value);
+                ret = -EINVAL;
+            }
+            else
+            {
+                if (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)
+                {
+                    hddLog(LOGW, FL("setMaxAssoc value %d higher than max allowed %d."
+                                "Setting it to max allowed and continuing"),
+                                set_value, WNI_CFG_ASSOC_STA_LIMIT_STAMAX);
+                    set_value = WNI_CFG_ASSOC_STA_LIMIT_STAMAX;
+                }
+                status = ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT,
+                                      set_value, NULL, eANI_BOOLEAN_FALSE);
+                if ( status != eHAL_STATUS_SUCCESS ) 
+                {
+                    hddLog(LOGE, FL("setMaxAssoc failure, status %d"),
+                            status);
+                    ret = -EIO;
+                }
+            }
+            break;
+
+        case QCSAP_PARAM_HIDE_SSID:
+            {
+                eHalStatus status = eHAL_STATUS_SUCCESS;
+                status = sme_HideSSID(hHal, pHostapdAdapter->sessionId, set_value);
+                if(eHAL_STATUS_SUCCESS != status)
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR,
+                            "%s: QCSAP_PARAM_HIDE_SSID failed",
+                            __FUNCTION__);
+                    return status;
+                }
+                break;
+            }
+
+        default:
+            hddLog(LOGE, FL("Invalid setparam command %d value %d"),
+                    sub_cmd, set_value);
+            ret = -EINVAL;
+            break;
+    }
+
+    return ret;
+}
+
+
+int
+static iw_softap_getparam(struct net_device *dev, 
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    int *value = (int *)extra;
+    int sub_cmd = value[0];
+    eHalStatus status;
+    int ret = 0; /* success */
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
+
+    switch (sub_cmd)
+    {
+    case QCSAP_PARAM_MAX_ASSOC:
+        status = ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value);
+        if (eHAL_STATUS_SUCCESS != status)
+        {
+            ret = -EIO;
+        }
+        break;
+        
+    case QCSAP_PARAM_CLR_ACL:
+        if ( eHAL_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext ))
+        {
+               ret = -EIO;            
+        }               
+        *value = 0;
+        break;
+        
+    case QCSAP_PARAM_MODULE_DOWN_IND:
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "%s: sending WLAN_MODULE_DOWN_IND", __FUNCTION__);
+            send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+#ifdef WLAN_BTAMP_FEATURE 
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "%s: Take down AMP PAL", __FUNCTION__);
+            BSL_Deinit(vos_get_global_context(VOS_MODULE_ID_HDD, NULL));
+#endif            
+            *value = 0;
+            break;
+         }
+    
+    default:
+        hddLog(LOGE, FL("Invalid getparam command %d"), sub_cmd);
+        ret = -EINVAL;
+        break;
+
+    }
+
+    return ret;
+}
+
+/* Usage:
+    BLACK_LIST  = 0
+    WHITE_LIST  = 1 
+    ADD MAC = 0
+    REMOVE MAC  = 1
+
+    mac addr will be accepted as a 6 octet mac address with each octet inputted in hex
+    for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33
+    while using this ioctl
+
+    Syntax:
+    iwpriv softap.0 modify_acl 
+    <6 octet mac addr> <list type> <cmd type>
+
+    Examples:
+    eg 1. to add a mac addr 00:0a:f5:89:89:90 to the black list
+    iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 0 0
+    eg 2. to delete a mac addr 00:0a:f5:89:89:90 from white list
+    iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 1 1
+*/
+int iw_softap_modify_acl(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
+    v_BYTE_t *value = (v_BYTE_t*)extra;
+    v_U8_t pPeerStaMac[VOS_MAC_ADDR_SIZE];
+    int listType, cmd, i;
+    int ret = 0; /* success */
+
+    ENTER();
+    for (i=0; i<VOS_MAC_ADDR_SIZE; i++)
+    {
+        pPeerStaMac[i] = *(value+i);
+    }
+    listType = (int)(*(value+i));
+    i++;
+    cmd = (int)(*(value+i));
+
+    hddLog(LOG1, "%s: SAP Modify ACL arg0 %02x:%02x:%02x:%02x:%02x:%02x arg1 %d arg2 %d\n",
+            __FUNCTION__, pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], 
+            pPeerStaMac[3], pPeerStaMac[4], pPeerStaMac[5], listType, cmd);
+
+    if (WLANSAP_ModifyACL(pVosContext, pPeerStaMac,(eSapACLType)listType,(eSapACLCmdType)cmd)
+            != VOS_STATUS_SUCCESS)
+    {
+        hddLog(LOGE, FL("Modify ACL failed\n"));
+        ret = -EIO;
+    }
+    EXIT();
+    return ret;
+}
+
+int
+static iw_softap_getchannel(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+
+    *(v_U32_t *)(wrqu->data.pointer) = (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->operatingChannel;
+
+    wrqu->data.length = sizeof((WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->operatingChannel);
+
+    return 0;
+}
+
+#define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
+
+int
+static iw_softap_getassoc_stamacaddr(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    unsigned char *pmaclist;
+    hdd_station_info_t *pStaInfo = pHostapdAdapter->aStaInfo;
+    int cnt = 0, len;
+
+
+    pmaclist = wrqu->data.pointer + sizeof(unsigned long int);
+    len = wrqu->data.length;
+
+    spin_lock_bh( &pHostapdAdapter->staInfo_lock );
+    while((cnt < WLAN_MAX_STA_COUNT) && (len > (sizeof(v_MACADDR_t)+1))) {
+        if (TRUE == pStaInfo[cnt].isUsed) {
+            
+            if(!IS_BROADCAST_MAC(pStaInfo[cnt].macAddrSTA.bytes)) {
+                memcpy((void *)pmaclist, (void *)&(pStaInfo[cnt].macAddrSTA), sizeof(v_MACADDR_t));
+                pmaclist += sizeof(v_MACADDR_t);
+                len -= sizeof(v_MACADDR_t);
+            }
+        }
+        cnt++;
+    } 
+    spin_unlock_bh( &pHostapdAdapter->staInfo_lock );
+
+    *pmaclist = '\0';
+
+    wrqu->data.length -= len;
+
+    *(unsigned long int *)(wrqu->data.pointer) = wrqu->data.length;
+
+    return 0;
+}
+
+/* Usage:
+    mac addr will be accepted as a 6 octet mac address with each octet inputted in hex
+    for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33
+    while using this ioctl
+
+    Syntax:
+    iwpriv softap.0 disassoc_sta <6 octet mac address>
+
+    e.g.
+    disassociate sta with mac addr 00:0a:f5:11:22:33 from softap
+    iwpriv softap.0 disassoc_sta 0x00 0x0a 0xf5 0x11 0x22 0x33
+*/
+
+int
+static iw_softap_disassoc_sta(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_U8_t *peerMacAddr;    
+    
+    ENTER();
+    /* the comparison below is needed since if iwpriv tool is used for calling this ioctl
+     * data is passed in extra (less than 16 octets); however in android wifi framework
+     * data is placed in wrqu->data.pointer.
+     */
+    if ((v_U8_t*)wrqu == (v_U8_t*)extra)
+        peerMacAddr = (v_U8_t *)(extra);
+    else
+        peerMacAddr = (v_U8_t *)(wrqu->data.pointer);
+
+    hddLog(LOG1, "data %02x:%02x:%02x:%02x:%02x:%02x",
+            peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
+            peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);
+    hdd_softap_sta_disassoc(pHostapdAdapter, peerMacAddr);
+    EXIT();
+    return 0;
+}
+
+int
+static iw_softap_ap_stats(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    WLANTL_TRANSFER_STA_TYPE  statBuffer;
+    char *pstatbuf;
+    int len = wrqu->data.length;
+    pstatbuf = wrqu->data.pointer;
+
+    WLANSAP_GetStatistics((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext, &statBuffer, (v_BOOL_t)wrqu->data.flags);
+
+    len = snprintf(pstatbuf, len,
+            "RUF=%d RMF=%d RBF=%d "
+            "RUB=%d RMB=%d RBB=%d "
+            "TUF=%d TMF=%d TBF=%d "
+            "TUB=%d TMB=%d TBB=%d",
+            (int)statBuffer.rxUCFcnt, (int)statBuffer.rxMCFcnt, (int)statBuffer.rxBCFcnt,
+            (int)statBuffer.rxUCBcnt, (int)statBuffer.rxMCBcnt, (int)statBuffer.rxBCBcnt,
+            (int)statBuffer.txUCFcnt, (int)statBuffer.txMCFcnt, (int)statBuffer.txBCFcnt,
+            (int)statBuffer.txUCBcnt, (int)statBuffer.txMCBcnt, (int)statBuffer.txBCBcnt
+            );
+
+    wrqu->data.length -= len;
+    return 0;
+}
+
+int
+static iw_softap_commit(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    hdd_hostapd_state_t *pHostapdState;
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
+    tpWLAN_SAPEventCB pSapEventCallback;
+    tsap_Config_t *pConfig;
+    s_CommitConfig_t *pCommitConfig;
+    struct qc_mac_acl_entry *acl_entry = NULL;
+    v_SINT_t i = 0, num_mac = 0;
+    v_U32_t status = 0;
+    eCsrAuthType RSNAuthType;
+    eCsrEncryptionType RSNEncryptType;
+    eCsrEncryptionType mcRSNEncryptType;
+
+    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+    pCommitConfig = (s_CommitConfig_t *)extra;
+    
+    pConfig = kmalloc(sizeof(tsap_Config_t), GFP_KERNEL);
+    if(NULL == pConfig) {
+        hddLog(LOG1, "VOS unable to allocate memory\n");
+        return -ENOMEM;
+    }
+    pConfig->beacon_int =  pCommitConfig->beacon_int;
+    pConfig->channel = pCommitConfig->channel;
+
+    /*Protection parameter to enable or disable*/
+    pConfig->protEnabled = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled;
+    pConfig->dtim_period = pCommitConfig->dtim_period;
+    switch(pCommitConfig->hw_mode )
+    {
+        case eQC_DOT11_MODE_11A:
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11a; 
+            break;
+        case eQC_DOT11_MODE_11B:
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11b; 
+            break;
+        case eQC_DOT11_MODE_11G:
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11g;
+            break;
+       
+        case eQC_DOT11_MODE_11N:
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11n;
+            break;
+        case eQC_DOT11_MODE_11G_ONLY:
+            pConfig->SapHw_mode = eSAP_DOT11_MODE_11g_ONLY;
+            break;
+        case eQC_DOT11_MODE_11N_ONLY:
+            pConfig->SapHw_mode = eSAP_DOT11_MODE_11n_ONLY;
+            break;
+        default:
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11n;
+            break;
+            
+    }
+  
+    pConfig->ieee80211d = pCommitConfig->qcsap80211d;
+    vos_mem_copy(pConfig->countryCode, pCommitConfig->countryCode, 3);
+    if(pCommitConfig->authType == eQC_AUTH_TYPE_SHARED_KEY)
+        pConfig->authType = eSAP_SHARED_KEY;
+    else if(pCommitConfig->authType == eQC_AUTH_TYPE_OPEN_SYSTEM) 
+        pConfig->authType = eSAP_OPEN_SYSTEM;
+    else
+        pConfig->authType = eSAP_AUTO_SWITCH;
+    
+    pConfig->privacy = pCommitConfig->privacy;
+    (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pCommitConfig->privacy;
+    pConfig->wps_state = pCommitConfig->wps_state;
+    pConfig->fwdWPSPBCProbeReq  = 1; // Forward WPS PBC probe request frame up 
+    pConfig->RSNWPAReqIELength = pCommitConfig->RSNWPAReqIELength;
+    if(pConfig->RSNWPAReqIELength){
+        pConfig->pRSNWPAReqIE = &pCommitConfig->RSNWPAReqIE[0];
+        if ((pConfig->pRSNWPAReqIE[0] == DOT11F_EID_RSN) || (pConfig->pRSNWPAReqIE[0] == DOT11F_EID_WPA)){
+            // The actual processing may eventually be more extensive than this.
+            // Right now, just consume any PMKIDs that are  sent in by the app.
+            status = hdd_softap_unpackIE( 
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+                                  vos_get_context( VOS_MODULE_ID_HAL, pVosContext),
+#else
+                                  vos_get_context( VOS_MODULE_ID_PE, pVosContext),
+#endif
+                                  &RSNEncryptType,
+                                  &mcRSNEncryptType,
+                                  &RSNAuthType,
+                                  pConfig->pRSNWPAReqIE[1]+2,
+                                  pConfig->pRSNWPAReqIE );
+             
+            if( VOS_STATUS_SUCCESS == status )
+            {
+                 // Now copy over all the security attributes you have parsed out
+                 //TODO: Need to handle mixed mode     
+                 pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE
+                 pConfig->mcRSNEncryptType = mcRSNEncryptType;
+                 hddLog( LOG1, FL("%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d\n"), 
+                                  RSNAuthType, RSNEncryptType, mcRSNEncryptType);
+             } 
+        }
+    }
+    else
+    {
+        /* If no RSNIE, set encrypt type to NONE*/
+        pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE;
+        pConfig->mcRSNEncryptType =  eCSR_ENCRYPT_TYPE_NONE;
+        hddLog( LOG1, FL("EncryptionType = %d mcEncryptionType = %d\n"), 
+                         pConfig->RSNEncryptType, pConfig->mcRSNEncryptType);
+    }
+
+    pConfig->SSIDinfo.ssidHidden = pCommitConfig->SSIDinfo.ssidHidden; 
+    pConfig->SSIDinfo.ssid.length = pCommitConfig->SSIDinfo.ssid.length;
+    vos_mem_copy(pConfig->SSIDinfo.ssid.ssId, pCommitConfig->SSIDinfo.ssid.ssId, pConfig->SSIDinfo.ssid.length);
+    vos_mem_copy(pConfig->self_macaddr.bytes, pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t));
+    
+    pConfig->SapMacaddr_acl = pCommitConfig->qc_macaddr_acl;
+
+    // ht_capab is not what the name conveys,this is used for protection bitmap
+    pConfig->ht_capab = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
+
+    if (pCommitConfig->num_accept_mac > MAX_MAC_ADDRESS_ACCEPTED)
+        num_mac = pConfig->num_accept_mac = MAX_MAC_ADDRESS_ACCEPTED;
+    else
+        num_mac = pConfig->num_accept_mac = pCommitConfig->num_accept_mac;
+    acl_entry = pCommitConfig->accept_mac;
+    for (i = 0; i < num_mac; i++)
+    {
+        vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(v_MACADDR_t));
+        acl_entry++;
+    }
+    if (pCommitConfig->num_deny_mac > MAX_MAC_ADDRESS_DENIED)
+        num_mac = pConfig->num_deny_mac = MAX_MAC_ADDRESS_DENIED;
+    else
+        num_mac = pConfig->num_deny_mac = pCommitConfig->num_deny_mac;
+    acl_entry = pCommitConfig->deny_mac;
+    for (i = 0; i < num_mac; i++)
+    {
+        vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(v_MACADDR_t));
+        acl_entry++;
+    }
+    //Uapsd Enabled Bit
+    pConfig->UapsdEnable =  (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled;
+    //Enable OBSS protection
+    pConfig->obssProtEnabled = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; 
+    (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->apDisableIntraBssFwd = (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apDisableIntraBssFwd;
+    
+    hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR"\n"), MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes));
+    hddLog(LOGW,FL("ssid =%s\n"), pConfig->SSIDinfo.ssid.ssId);  
+    hddLog(LOGW,FL("beaconint=%d, channel=%d\n"), (int)pConfig->beacon_int, (int)pConfig->channel);
+    hddLog(LOGW,FL("hw_mode=%x\n"),  pConfig->SapHw_mode);
+    hddLog(LOGW,FL("privacy=%d, authType=%d\n"), pConfig->privacy, pConfig->authType); 
+    hddLog(LOGW,FL("RSN/WPALen=%d, \n"),(int)pConfig->RSNWPAReqIELength);
+    hddLog(LOGW,FL("Uapsd = %d\n"),pConfig->UapsdEnable); 
+    hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d\n"),pConfig->protEnabled, pConfig->obssProtEnabled); 
+    hddLog(LOGW,FL("DisableIntraBssFwd = %d\n"),(WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->apDisableIntraBssFwd); 
+            
+    pSapEventCallback = hdd_hostapd_SAPEventCB;
+    pConfig->persona = pHostapdAdapter->device_mode;
+    if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig,(v_PVOID_t)dev) != VOS_STATUS_SUCCESS)
+    {
+           hddLog(LOGE,FL("SAP Start Bss fail\n"));
+    }
+    
+    kfree(pConfig);
+    
+    hddLog(LOG1, FL("Waiting for Scan to complete(auto mode) and BSS to start"));
+    vos_status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
+   
+    if (!VOS_IS_STATUS_SUCCESS(vos_status))
+    {  
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos wait for single_event failed!!\n"));
+       VOS_ASSERT(0);
+    }
+ 
+    pHostapdState->bCommit = TRUE;
+    if(pHostapdState->vosStatus)
+    {
+        return -1;
+    }
+    else
+    {
+        set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags);
+        WLANSAP_Update_WpsIe ( pVosContext );            
+        return 0;
+    }
+}
+static 
+int iw_softap_setmlme(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    struct sQcSapreq_mlme *pmlme;
+    hdd_adapter_t *pHostapdAdapter = (hdd_adapter_t*)(netdev_priv(dev));
+    v_MACADDR_t destAddress;
+    pmlme = (struct sQcSapreq_mlme *)(wrqu->name);
+    /* NOTE: this address is not valid incase of TKIP failure, since not filled */
+    vos_mem_copy(&destAddress.bytes, pmlme->im_macaddr, sizeof(v_MACADDR_t));
+    switch(pmlme->im_op)
+    {
+        case QCSAP_MLME_AUTHORIZE:
+                    hdd_softap_change_STA_state( pHostapdAdapter, &destAddress, WLANTL_STA_AUTHENTICATED);
+        break;
+        case QCSAP_MLME_ASSOC:
+        //TODO:inform to TL after associating (not needed  as we do in sapCallback)
+        break;
+        case QCSAP_MLME_UNAUTHORIZE:
+        //TODO: send the disassoc to station
+        //hdd_softap_change_STA_state( pHostapdAdapter, pmlme->im_macaddr, WLANTL_STA_AUTHENTICATED);
+        break;
+        case QCSAP_MLME_DISASSOC:
+            hdd_softap_sta_disassoc(pHostapdAdapter,pmlme->im_macaddr);
+        break;
+        case QCSAP_MLME_DEAUTH:
+            hdd_softap_sta_deauth(pHostapdAdapter,pmlme->im_macaddr);
+        break;
+        case QCSAP_MLME_MICFAILURE:
+            hdd_softap_tkip_mic_fail_counter_measure(pHostapdAdapter,pmlme->im_reason);
+        break;
+        default:
+        break;
+    }
+    return 0;
+}
+
+static int iw_softap_set_channel_range(struct net_device *dev, 
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+
+    int *value = (int *)extra;
+    int startChannel = value[0];
+    int endChannel = value[1];
+    int band = value[2];
+    eHalStatus status;
+    int ret = 0; /* success */
+
+    status = WLANSAP_SetChannelRange(hHal,startChannel,endChannel,band);
+    if(status != VOS_STATUS_SUCCESS)
+    {
+      hddLog( LOGE, FL("iw_softap_set_channel_range:  startChannel = %d, endChannel = %d band = %d\n"), 
+                                  startChannel,endChannel, band);
+      ret = -EINVAL;
+    }
+    return ret;
+}
+
+int iw_softap_get_channel_list(struct net_device *dev, 
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu, char *extra)
+{
+    v_U32_t num_channels = 0;
+    v_U8_t i = 0;
+    v_U8_t bandStartChannel = RF_CHAN_1;
+    v_U8_t bandEndChannel = RF_CHAN_165;
+    v_U32_t temp_num_channels = 0;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    v_REGDOMAIN_t domainIdCurrentSoftap;
+
+    tpChannelListInfo channel_list = (tpChannelListInfo) extra;
+    wrqu->data.length = sizeof(tChannelListInfo);
+    ENTER();
+
+    for( i = bandStartChannel; i <= bandEndChannel; i++ )
+    {
+        if( NV_CHANNEL_ENABLE == regChannels[i].enabled )
+        {
+            channel_list->channels[num_channels] = rfChannels[i].channelNum; 
+            num_channels++;
+        }
+    }
+
+    /* remove indoor channels if the domain is FCC, channels 36 - 48 */
+
+    temp_num_channels = num_channels;
+
+    if(eHAL_STATUS_SUCCESS != sme_getSoftApDomain(hHal,(v_REGDOMAIN_t *) &domainIdCurrentSoftap))
+    {
+        hddLog(LOG1,FL("Failed to get Domain ID, %d \n"),domainIdCurrentSoftap);
+        return -1;
+    }
+
+    if(REGDOMAIN_FCC == domainIdCurrentSoftap)
+    {
+        for(i = 0; i < temp_num_channels; i++)
+        {
+      
+           if((channel_list->channels[i] > 35) && 
+              (channel_list->channels[i] < 49))
+           {
+               vos_mem_move(&channel_list->channels[i], 
+                            &channel_list->channels[i+1], 
+                            temp_num_channels - (i-1));
+               num_channels--;
+               temp_num_channels--;
+               i--;
+           } 
+        }
+    }
+
+    hddLog(LOG1,FL(" number of channels %d\n"), num_channels); 
+
+    if (num_channels > IW_MAX_FREQUENCIES)
+    {
+        num_channels = IW_MAX_FREQUENCIES;
+    }
+
+    channel_list->num_channels = num_channels;
+    EXIT();
+
+    return 0;
+}
+
+static 
+int iw_get_genie(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
+    eHalStatus status;
+    v_U32_t length = DOT11F_IE_RSN_MAX_LEN;
+    v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN];
+    ENTER();
+    hddLog(LOG1,FL("getGEN_IE ioctl\n"));
+    // Actually retrieve the RSN IE from CSR.  (We previously sent it down in the CSR Roam Profile.)
+    status = WLANSap_getstationIE_information(pVosContext, 
+                                   &length,
+                                   genIeBytes);
+    wrqu->data.length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN);
+    vos_mem_copy( wrqu->data.pointer, (v_VOID_t*)genIeBytes, wrqu->data.length);
+    
+    hddLog(LOG1,FL(" RSN IE of %d bytes returned\n"), wrqu->data.length ); 
+    
+   
+    EXIT();
+    return 0;
+}
+static 
+int iw_get_WPSPBCProbeReqIEs(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));    
+    sQcSapreq_WPSPBCProbeReqIES_t *pWPSPBCProbeReqIEs;
+    hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
+    ENTER();
+        
+    hddLog(LOG1,FL("get_WPSPBCProbeReqIEs ioctl\n"));
+    
+    pWPSPBCProbeReqIEs = (sQcSapreq_WPSPBCProbeReqIES_t *)(wrqu->data.pointer);
+    pWPSPBCProbeReqIEs->probeReqIELen = pHddApCtx->WPSPBCProbeReq.probeReqIELen;
+    vos_mem_copy(pWPSPBCProbeReqIEs->probeReqIE, pHddApCtx->WPSPBCProbeReq.probeReqIE, pWPSPBCProbeReqIEs->probeReqIELen);
+    vos_mem_copy(pWPSPBCProbeReqIEs->macaddr, pHddApCtx->WPSPBCProbeReq.peerMacAddr, sizeof(v_MACADDR_t));
+    wrqu->data.length = 12 + pWPSPBCProbeReqIEs->probeReqIELen;
+    hddLog(LOG1, FL("Macaddress : "MAC_ADDRESS_STR"\n"),  MAC_ADDR_ARRAY(pWPSPBCProbeReqIEs->macaddr));
+    up(&pHddApCtx->semWpsPBCOverlapInd);
+    EXIT();
+    return 0;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief iw_set_auth_hostap() - 
+   This function sets the auth type received from the wpa_supplicant.
+   
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+int iw_set_auth_hostap(struct net_device *dev,struct iw_request_info *info,
+                        union iwreq_data *wrqu,char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
+
+   ENTER();
+   switch(wrqu->param.flags & IW_AUTH_INDEX)
+   {
+      case IW_AUTH_TKIP_COUNTERMEASURES:
+      {
+         if(wrqu->param.value) {
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Counter Measure started %d", wrqu->param.value);
+            pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED;
+         }  
+         else {   
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Counter Measure stopped=%d", wrqu->param.value);
+            pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED;
+         }
+
+         hdd_softap_tkip_mic_fail_counter_measure(pAdapter,
+                                                  wrqu->param.value);
+      }   
+      break;
+         
+      default:
+         
+         hddLog(LOGW, "%s called with unsupported auth type %d", __FUNCTION__, 
+               wrqu->param.flags & IW_AUTH_INDEX);
+      break;
+   }
+   
+   EXIT();
+   return 0;
+}
+
+static int iw_set_ap_encodeext(struct net_device *dev, 
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;    
+    hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
+    eHalStatus halStatus= eHAL_STATUS_SUCCESS;
+    struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
+    v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+    int key_index;
+    struct iw_point *encoding = &wrqu->encoding;
+    tCsrRoamSetKey  setKey;   
+//    tCsrRoamRemoveKey RemoveKey;
+    int i;
+    ENTER();    
+   
+    key_index = encoding->flags & IW_ENCODE_INDEX;
+   
+    if(key_index > 0) {
+      
+         /*Convert from 1-based to 0-based keying*/
+        key_index--;
+    }
+    if(!ext->key_len) {
+#if 0     
+      /*Set the encrytion type to NONE*/
+#if 0
+       pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+#endif
+     
+         RemoveKey.keyId = key_index;
+         if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
+              /*Key direction for group is RX only*/
+             vos_mem_copy(RemoveKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+         }
+         else {
+             vos_mem_copy(RemoveKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN);
+         }
+         switch(ext->alg)
+         {
+           case IW_ENCODE_ALG_NONE:
+              RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+              break;
+           case IW_ENCODE_ALG_WEP:
+              RemoveKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104;
+              break;
+           case IW_ENCODE_ALG_TKIP:
+              RemoveKey.encType = eCSR_ENCRYPT_TYPE_TKIP;
+           break;
+           case IW_ENCODE_ALG_CCMP:
+              RemoveKey.encType = eCSR_ENCRYPT_TYPE_AES;
+              break;
+          default:
+              RemoveKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+              break;
+         }
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Remove key cipher_alg:%d key_len%d *pEncryptionType :%d \n",
+                    __FUNCTION__,(int)ext->alg,(int)ext->key_len,RemoveKey.encType);
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Peer Mac = "MAC_ADDRESS_STR"\n",
+                    __FUNCTION__, MAC_ADDR_ARRAY(RemoveKey.peerMac));
+          );
+         halStatus = WLANSAP_DelKeySta( pVosContext, &RemoveKey);
+         if ( halStatus != eHAL_STATUS_SUCCESS )
+         {
+             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "[%4d] WLANSAP_DeleteKeysSta returned ERROR status= %d",
+                        __LINE__, halStatus );
+         }
+#endif         
+         return halStatus;
+
+    }   
+    
+    vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+   
+    setKey.keyId = key_index;
+    setKey.keyLength = ext->key_len;
+   
+    if(ext->key_len <= CSR_MAX_KEY_LEN) {
+       vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len);
+    }   
+   
+    if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
+      /*Key direction for group is RX only*/
+       setKey.keyDirection = eSIR_RX_ONLY;
+       vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+    }
+    else {   
+      
+       setKey.keyDirection =  eSIR_TX_RX;
+       vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN);
+    }
+    if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
+    {
+       setKey.keyDirection = eSIR_TX_DEFAULT;
+       vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN);
+    }
+ 
+    /*For supplicant pae role is zero*/
+    setKey.paeRole = 0;
+      
+    switch(ext->alg)
+    {   
+       case IW_ENCODE_ALG_NONE:   
+         setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+         break;
+         
+       case IW_ENCODE_ALG_WEP:
+         setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104;
+         pHddApCtx->uPrivacy = 1;
+         hddLog(LOG1, "(%s) uPrivacy=%d", __FUNCTION__, pHddApCtx->uPrivacy);
+         break;
+      
+       case IW_ENCODE_ALG_TKIP:
+       {
+          v_U8_t *pKey = &setKey.Key[0];
+  
+          setKey.encType = eCSR_ENCRYPT_TYPE_TKIP;
+  
+          vos_mem_zero(pKey, CSR_MAX_KEY_LEN);
+  
+          /*Supplicant sends the 32bytes key in this order 
+          
+                |--------------|----------|----------|
+                |   Tk1        |TX-MIC    |  RX Mic  | 
+                |--------------|----------|----------|
+                <---16bytes---><--8bytes--><--8bytes-->
+                
+                */
+          /*Sme expects the 32 bytes key to be in the below order
+  
+                |--------------|----------|----------|
+                |   Tk1        |RX-MIC    |  TX Mic  | 
+                |--------------|----------|----------|
+                <---16bytes---><--8bytes--><--8bytes-->
+               */
+          /* Copy the Temporal Key 1 (TK1) */
+          vos_mem_copy(pKey,ext->key,16);
+           
+         /*Copy the rx mic first*/
+          vos_mem_copy(&pKey[16],&ext->key[24],8); 
+          
+         /*Copy the tx mic */
+          vos_mem_copy(&pKey[24],&ext->key[16],8); 
+  
+       }     
+       break;
+      
+       case IW_ENCODE_ALG_CCMP:
+          setKey.encType = eCSR_ENCRYPT_TYPE_AES;
+          break;
+          
+       default:
+          setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+          break;
+    }
+         
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+          ("%s:EncryptionType:%d key_len:%d, :%d, KeyId:%d \n"),__FUNCTION__, setKey.encType, setKey.keyLength,
+            setKey.keyId);
+    for(i=0; i< ext->key_len; i++)
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+          ("%02x"), setKey.Key[i]);    
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+          ("\n"));
+    halStatus = WLANSAP_SetKeySta( pVosContext, &setKey);
+    
+    if ( halStatus != eHAL_STATUS_SUCCESS )
+    {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", __LINE__, halStatus );
+    }   
+   
+   return halStatus;
+}
+static int iw_set_ap_mlme(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu,
+                       char *extra)
+{
+#if 0
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    struct iw_mlme *mlme = (struct iw_mlme *)extra;
+ 
+    ENTER();    
+   
+    //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED
+    switch (mlme->cmd) {
+        case IW_MLME_DISASSOC:
+        case IW_MLME_DEAUTH:
+            hddLog(LOG1, "Station disassociate");    
+            if( pAdapter->conn_info.connState == eConnectionState_Associated ) 
+            {
+                eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED;
+                
+                if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE )
+                    reason = eCSR_DISCONNECT_REASON_MIC_ERROR;
+                
+                status = sme_RoamDisconnect( pAdapter->hHal,pAdapter->sessionId, reason);
+                
+                //clear all the reason codes
+                if (status != 0)
+                {
+                    hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d \n", __FUNCTION__, (int)mlme->cmd, (int)status );
+                }
+                
+               netif_stop_queue(dev);
+               netif_carrier_off(dev);
+            }
+            else
+            {
+                hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state \n", __FUNCTION__, (int)mlme->cmd );
+            }
+        default:
+            hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate \n", __FUNCTION__, (int)mlme->cmd );
+            return -EINVAL;
+    }//end of switch
+    EXIT();
+#endif    
+    return 0;
+//    return status;
+}
+
+static int iw_get_ap_rts_threshold(struct net_device *dev,
+            struct iw_request_info *info,
+            union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+   v_U32_t status = 0;
+
+   status = hdd_wlan_get_rts_threshold(pHostapdAdapter, wrqu);
+
+   return status;
+}
+
+static int iw_get_ap_frag_threshold(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_U32_t status = 0;
+
+    status = hdd_wlan_get_frag_threshold(pHostapdAdapter, wrqu);
+
+    return status;
+}
+
+static int iw_get_ap_freq(struct net_device *dev, struct iw_request_info *info,
+             struct iw_freq *fwrq, char *extra)
+{
+   v_U32_t status = 0,channel,freq;
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+   tHalHandle hHal;
+   hdd_hostapd_state_t *pHostapdState;
+   hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);  
+
+   ENTER();
+
+   if ((WLAN_HDD_GET_CTX(pHostapdAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
+   }
+
+   pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+   hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+
+   if(pHostapdState->bssState == BSS_STOP )
+   {
+       if (ccmCfgGetInt(hHal, WNI_CFG_CURRENT_CHANNEL, &channel)
+                                                  != eHAL_STATUS_SUCCESS)
+       {
+           return -EIO;
+       }
+       else
+       {
+          status = hdd_wlan_get_freq(channel, &freq);
+          fwrq->m = freq;
+          fwrq->e = 0;
+       }
+    }
+    else
+    {
+       channel = pHddApCtx->operatingChannel;
+       status = hdd_wlan_get_freq(channel, &freq);
+       fwrq->m = freq;
+       fwrq->e = 0;
+    }
+   return status;
+}
+
+static int iw_softap_setwpsie(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, 
+        char *extra)
+{
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+   v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
+   hdd_hostapd_state_t *pHostapdState;
+   eHalStatus halStatus= eHAL_STATUS_SUCCESS;
+   u_int8_t *wps_genie =  wrqu->data.pointer;
+   u_int8_t *pos;
+   tpSap_WPSIE pSap_WPSIe;
+   u_int8_t WPSIeType;
+   u_int16_t length;   
+   ENTER();
+
+   if(!wrqu->data.length)
+      return 0;
+
+   pSap_WPSIe = vos_mem_malloc(sizeof(tSap_WPSIE));
+   if (NULL == pSap_WPSIe) 
+   {
+      hddLog(LOGE, "VOS unable to allocate memory\n");
+      return -ENOMEM;
+   }
+   vos_mem_zero(pSap_WPSIe, sizeof(tSap_WPSIE));
+ 
+   hddLog(LOG1,"%s WPS IE type[0x%X] IE[0x%X], LEN[%d]\n", __FUNCTION__, wps_genie[0], wps_genie[1], wps_genie[2]);
+   WPSIeType = wps_genie[0];
+   if ( wps_genie[0] == eQC_WPS_BEACON_IE)
+   {
+      pSap_WPSIe->sapWPSIECode = eSAP_WPS_BEACON_IE; 
+      wps_genie = wps_genie + 1;
+      switch ( wps_genie[0] ) 
+      {
+         case DOT11F_EID_WPA: 
+            if (wps_genie[1] < 2 + 4)
+            {
+               vos_mem_free(pSap_WPSIe); 
+               return -EINVAL;
+            }
+            else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) 
+            {
+             hddLog (LOG1, "%s Set WPS BEACON IE(len %d)",__FUNCTION__, wps_genie[1]+2);
+             pos = &wps_genie[6];
+             while (((size_t)pos - (size_t)&wps_genie[6])  < (wps_genie[1] - 4) )
+             {
+                switch((u_int16_t)(*pos<<8) | *(pos+1))
+                {
+                   case HDD_WPS_ELEM_VERSION:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version = *pos;   
+                      hddLog(LOG1, "WPS version %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_VER_PRESENT;   
+                      pos += 1;
+                      break;
+                   
+                   case HDD_WPS_ELEM_WPS_STATE:
+                      pos +=4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState = *pos;
+                      hddLog(LOG1, "WPS State %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_STATE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_APSETUPLOCK:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked = *pos;
+                      hddLog(LOG1, "AP setup lock %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_APSETUPLOCK_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_SELECTEDREGISTRA:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra = *pos;
+                      hddLog(LOG1, "Selected Registra %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRA_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_PASSWORD_ID:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Password ID: %x\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_DEVICEPASSWORDID_PRESENT;
+                      pos += 2; 
+                      break;
+                   case HDD_WPS_ELEM_REGISTRA_CONF_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Select Registra Config Methods: %x\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT;
+                      pos += 2; 
+                      break;
+                
+                   case HDD_WPS_ELEM_UUID_E:
+                      pos += 2; 
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSBeaconIE.UUID_E, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_UUIDE_PRESENT; 
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_RF_BANDS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand = *pos;
+                      hddLog(LOG1, "RF band: %d\n", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_RF_BANDS_PRESENT;
+                      pos += 1;
+                      break;
+                   
+                   default:
+                      hddLog (LOGW, "UNKNOWN TLV in WPS IE(%x)\n", (*pos<<8 | *(pos+1)));
+                      vos_mem_free(pSap_WPSIe);
+                      return -EINVAL; 
+                }
+              }  
+            }
+            else { 
+                 hddLog (LOGE, "%s WPS IE Mismatch %X",
+                         __FUNCTION__, wps_genie[0]);
+            }     
+            break;
+                 
+         default:
+            hddLog (LOGE, "%s Set UNKNOWN IE %X",__FUNCTION__, wps_genie[0]);
+            vos_mem_free(pSap_WPSIe);
+            return 0;
+      }
+    } 
+    else if( wps_genie[0] == eQC_WPS_PROBE_RSP_IE)
+    {
+      pSap_WPSIe->sapWPSIECode = eSAP_WPS_PROBE_RSP_IE; 
+      wps_genie = wps_genie + 1;
+      switch ( wps_genie[0] ) 
+      {
+         case DOT11F_EID_WPA: 
+            if (wps_genie[1] < 2 + 4)
+            {
+               vos_mem_free(pSap_WPSIe); 
+               return -EINVAL;
+            }
+            else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) 
+            {
+             hddLog (LOG1, "%s Set WPS PROBE RSP IE(len %d)",__FUNCTION__, wps_genie[1]+2);
+             pos = &wps_genie[6];
+             while (((size_t)pos - (size_t)&wps_genie[6])  < (wps_genie[1] - 4) )
+             {
+              switch((u_int16_t)(*pos<<8) | *(pos+1))
+              {
+                   case HDD_WPS_ELEM_VERSION:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version = *pos;   
+                      hddLog(LOG1, "WPS version %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version); 
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_VER_PRESENT;   
+                      pos += 1;
+                      break;
+                   
+                   case HDD_WPS_ELEM_WPS_STATE:
+                      pos +=4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState = *pos;
+                      hddLog(LOG1, "WPS State %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_STATE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_APSETUPLOCK:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked = *pos;
+                      hddLog(LOG1, "AP setup lock %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_APSETUPLOCK_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_SELECTEDREGISTRA:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra = *pos;
+                      hddLog(LOG1, "Selected Registra %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRA_PRESENT;                      
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_PASSWORD_ID:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Password ID: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICEPASSWORDID_PRESENT;
+                      pos += 2; 
+                      break;
+                   case HDD_WPS_ELEM_REGISTRA_CONF_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Select Registra Config Methods: %x\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT;
+                      pos += 2; 
+                      break;
+                  case HDD_WPS_ELEM_RSP_TYPE:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType = *pos;
+                      hddLog(LOG1, "Config Methods: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RESPONSETYPE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_UUID_E:
+                      pos += 2; 
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.UUID_E, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_UUIDE_PRESENT;
+                      pos += length;
+                      break;
+                   
+                   case HDD_WPS_ELEM_MANUFACTURER:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.num_name = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.name, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MANUFACTURE_PRESENT;
+                      pos += length;
+                      break;
+ 
+                   case HDD_WPS_ELEM_MODEL_NAME:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNAME_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_MODEL_NUM:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNUMBER_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_SERIAL_NUM:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SERIALNUMBER_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory = (*pos<<8 | *(pos+1));
+                      hddLog(LOG1, "primary dev category: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory);  
+                      pos += 2;
+                      
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceOUI, pos, HDD_WPS_DEVICE_OUI_LEN);
+                      hddLog(LOG1, "primary dev oui: %02x, %02x, %02x, %02x\n", pos[0], pos[1], pos[2], pos[3]);
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory = (*pos<<8 | *(pos+1));
+                      hddLog(LOG1, "primary dev sub category: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory);  
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT;                      
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_NAME:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.text, pos, length);
+                      pos += length;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICENAME_PRESENT;
+                      break;
+                   case HDD_WPS_ELEM_CONFIG_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ConfigMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Config Methods: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod);
+                      pos += 2; 
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_CONFIGMETHODS_PRESENT;
+                      break;
+ 
+                   case HDD_WPS_ELEM_RF_BANDS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand = *pos;
+                      hddLog(LOG1, "RF band: %d\n", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand);
+                      pos += 1;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RF_BANDS_PRESENT;
+                      break;
+              }  // switch
+            }
+         } 
+         else
+         {
+            hddLog (LOGE, "%s WPS IE Mismatch %X",__FUNCTION__, wps_genie[0]);
+         }
+         
+      } // switch
+    }
+    halStatus = WLANSAP_Set_WpsIe(pVosContext, pSap_WPSIe);
+    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+    if( pHostapdState->bCommit && WPSIeType == eQC_WPS_PROBE_RSP_IE)
+    {
+        //hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+        //v_CONTEXT_t pVosContext = pHostapdAdapter->pvosContext;
+        WLANSAP_Update_WpsIe ( pVosContext );
+    }
+ 
+    vos_mem_free(pSap_WPSIe);   
+    EXIT();
+    return halStatus;
+}
+
+static int iw_softap_stopbss(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, 
+        char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    ENTER();
+    if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) 
+    {
+        if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) )
+        {
+            hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+
+            status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
+   
+            if (!VOS_IS_STATUS_SUCCESS(status))
+            {  
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                         ("ERROR: HDD vos wait for single_event failed!!\n"));
+                VOS_ASSERT(0);
+            }
+        }
+        clear_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags);
+    }
+    EXIT();
+    return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY;
+}
+
+static int iw_softap_version(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, 
+        char *extra)
+{
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    VOS_STATUS status;
+    ENTER();
+    status = hdd_wlan_get_version(pHostapdAdapter, wrqu, extra);
+    if ( !VOS_IS_STATUS_SUCCESS( status ) ) {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!\n",__func__);
+       return -EINVAL;
+    }
+    EXIT();
+#endif//TODO need to handle in prima
+    return 0;
+}
+static int iw_set_ap_genie(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, 
+        char *extra)
+{
+ 
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
+    eHalStatus halStatus= eHAL_STATUS_SUCCESS;
+    u_int8_t *genie = wrqu->data.pointer;
+    
+    ENTER();
+    
+    if(!wrqu->data.length)
+    {
+        EXIT();
+        return 0;
+    }
+    
+    switch (genie[0]) 
+    {
+        case DOT11F_EID_WPA: 
+        case DOT11F_EID_RSN:
+            if((WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy == 0)
+            {
+                hdd_softap_Deregister_BC_STA(pHostapdAdapter);
+                hdd_softap_Register_BC_STA(pHostapdAdapter, 1);
+            }   
+            (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = 1;
+            halStatus = WLANSAP_Set_WPARSNIes(pVosContext, wrqu->data.pointer, wrqu->data.length);
+            break;
+            
+        default:
+            hddLog (LOGE, "%s Set UNKNOWN IE %X",__FUNCTION__, genie[0]);
+            halStatus = 0;
+    }
+    
+    EXIT();
+    return halStatus; 
+}
+
+static VOS_STATUS  wlan_hdd_get_classAstats_for_station(hdd_adapter_t *pAdapter, u8 staid)
+{
+   eHalStatus hstatus;
+   long lrc;
+   struct statsContext context;
+
+   if (NULL == pAdapter)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Padapter is NULL", __func__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   init_completion(&context.completion);
+   context.pAdapter = pAdapter;
+   context.magic = STATS_CONTEXT_MAGIC;
+   hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                  eCSR_HDD,
+                                  SME_GLOBAL_CLASSA_STATS,
+                                  hdd_GetClassA_statisticsCB,
+                                  0, // not periodic
+                                  FALSE, //non-cached results
+                                  staid,
+                                  &context);
+   if (eHAL_STATUS_SUCCESS != hstatus)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+            "%s: Unable to retrieve statistics for link speed",
+            __FUNCTION__);
+   }
+   else
+   {
+      lrc = wait_for_completion_interruptible_timeout(&context.completion,
+            msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
+      context.magic = 0;
+      if (lrc <= 0)
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: SME %s while retrieving link speed",
+              __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+         msleep(50);
+      }
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+int iw_get_softap_linkspeed(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu,
+        char *extra)
+
+{
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+   char *pLinkSpeed = (char*)extra;
+   v_U16_t link_speed;
+   unsigned short staId;
+   int len = sizeof(v_U16_t)+1;
+   v_BYTE_t macAddress[VOS_MAC_ADDR_SIZE];
+   VOS_STATUS status;
+   int rc;
+
+   if ( hdd_string_to_hex ((char *)wrqu->data.pointer, wrqu->data.length, macAddress ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "ERROR: Command not found");
+      return -EINVAL;
+   }
+
+   status = hdd_softap_GetStaId(pHostapdAdapter, (v_MACADDR_t *)macAddress, (void *)(&staId));
+
+   if (!VOS_IS_STATUS_SUCCESS(status ))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD Failed to find sta id!!\n"));
+      link_speed = 0;
+   }
+   else
+   {
+      status = wlan_hdd_get_classAstats_for_station(pHostapdAdapter , staId);
+      if (!VOS_IS_STATUS_SUCCESS(status ))
+      {
+          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unable to retrieve SME statistics", __FUNCTION__);
+          return -EINVAL;
+      }
+      link_speed =(int)pHostapdAdapter->hdd_stats.ClassA_stat.tx_rate/2;
+   }
+
+   wrqu->data.length = len;
+   rc = snprintf(pLinkSpeed, len, "%u", link_speed);
+   if ((rc < 0) || (rc >= len))
+   {
+      // encoding or length error?
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+            "%s: Unable to encode link speed, got [%s]",
+             __FUNCTION__, pLinkSpeed);
+      return -EIO;
+   }
+
+   return 0;
+}
+
+static const iw_handler      hostapd_handler[] =
+{
+   (iw_handler) NULL,           /* SIOCSIWCOMMIT */
+   (iw_handler) NULL,           /* SIOCGIWNAME */
+   (iw_handler) NULL,           /* SIOCSIWNWID */
+   (iw_handler) NULL,           /* SIOCGIWNWID */
+   (iw_handler) NULL,           /* SIOCSIWFREQ */
+   (iw_handler) iw_get_ap_freq,    /* SIOCGIWFREQ */
+   (iw_handler) NULL,           /* SIOCSIWMODE */
+   (iw_handler) NULL,           /* SIOCGIWMODE */
+   (iw_handler) NULL,           /* SIOCSIWSENS */
+   (iw_handler) NULL,           /* SIOCGIWSENS */
+   (iw_handler) NULL,           /* SIOCSIWRANGE */
+   (iw_handler) NULL,           /* SIOCGIWRANGE */
+   (iw_handler) NULL,           /* SIOCSIWPRIV */
+   (iw_handler) NULL,           /* SIOCGIWPRIV */
+   (iw_handler) NULL,           /* SIOCSIWSTATS */
+   (iw_handler) NULL,           /* SIOCGIWSTATS */
+   (iw_handler) NULL,           /* SIOCSIWSPY */
+   (iw_handler) NULL,           /* SIOCGIWSPY */
+   (iw_handler) NULL,           /* SIOCSIWTHRSPY */
+   (iw_handler) NULL,           /* SIOCGIWTHRSPY */
+   (iw_handler) NULL,           /* SIOCSIWAP */
+   (iw_handler) NULL,           /* SIOCGIWAP */
+   (iw_handler) iw_set_ap_mlme,    /* SIOCSIWMLME */
+   (iw_handler) NULL,           /* SIOCGIWAPLIST */
+   (iw_handler) NULL,           /* SIOCSIWSCAN */
+   (iw_handler) NULL,           /* SIOCGIWSCAN */
+   (iw_handler) NULL,           /* SIOCSIWESSID */
+   (iw_handler) NULL,           /* SIOCGIWESSID */
+   (iw_handler) NULL,           /* SIOCSIWNICKN */
+   (iw_handler) NULL,           /* SIOCGIWNICKN */
+   (iw_handler) NULL,           /* -- hole -- */
+   (iw_handler) NULL,           /* -- hole -- */
+   (iw_handler) NULL,           /* SIOCSIWRATE */
+   (iw_handler) NULL,           /* SIOCGIWRATE */
+   (iw_handler) NULL,           /* SIOCSIWRTS */
+   (iw_handler) iw_get_ap_rts_threshold,     /* SIOCGIWRTS */
+   (iw_handler) NULL,           /* SIOCSIWFRAG */
+   (iw_handler) iw_get_ap_frag_threshold,    /* SIOCGIWFRAG */
+   (iw_handler) NULL,           /* SIOCSIWTXPOW */
+   (iw_handler) NULL,           /* SIOCGIWTXPOW */
+   (iw_handler) NULL,           /* SIOCSIWRETRY */
+   (iw_handler) NULL,           /* SIOCGIWRETRY */
+   (iw_handler) NULL,           /* SIOCSIWENCODE */
+   (iw_handler) NULL,           /* SIOCGIWENCODE */
+   (iw_handler) NULL,           /* SIOCSIWPOWER */
+   (iw_handler) NULL,           /* SIOCGIWPOWER */
+   (iw_handler) NULL,           /* -- hole -- */
+   (iw_handler) NULL,           /* -- hole -- */
+   (iw_handler) iw_set_ap_genie,     /* SIOCSIWGENIE */
+   (iw_handler) NULL,           /* SIOCGIWGENIE */
+   (iw_handler) iw_set_auth_hostap,    /* SIOCSIWAUTH */
+   (iw_handler) NULL,           /* SIOCGIWAUTH */
+   (iw_handler) iw_set_ap_encodeext,     /* SIOCSIWENCODEEXT */
+   (iw_handler) NULL,           /* SIOCGIWENCODEEXT */
+   (iw_handler) NULL,           /* SIOCSIWPMKSA */
+};
+
+#define    IW_PRIV_TYPE_OPTIE    IW_PRIV_TYPE_BYTE | QCSAP_MAX_OPT_IE
+#define    IW_PRIV_TYPE_MLME \
+    IW_PRIV_TYPE_BYTE | sizeof(struct ieee80211req_mlme)
+
+static const struct iw_priv_args hostapd_private_args[] = {
+  { QCSAP_IOCTL_SETPARAM,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" },
+  { QCSAP_IOCTL_SETPARAM,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" },
+  { QCSAP_PARAM_MAX_ASSOC,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMaxAssoc" },
+   { QCSAP_PARAM_HIDE_SSID,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,  "hideSSID" },
+  { QCSAP_IOCTL_GETPARAM,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "getparam" },
+  { QCSAP_IOCTL_GETPARAM, 0,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "" },
+  { QCSAP_PARAM_MAX_ASSOC, 0,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "getMaxAssoc" },
+  { QCSAP_PARAM_MODULE_DOWN_IND, 0,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "moduleDownInd" },
+  { QCSAP_PARAM_CLR_ACL, 0,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "setClearAcl" },
+  { QCSAP_PARAM_ACL_MODE,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAclMode" },
+  { QCSAP_IOCTL_COMMIT,
+      IW_PRIV_TYPE_BYTE | sizeof(struct s_CommitConfig) | IW_PRIV_SIZE_FIXED, 0, "commit" },
+  { QCSAP_IOCTL_SETMLME,
+      IW_PRIV_TYPE_BYTE | sizeof(struct sQcSapreq_mlme)| IW_PRIV_SIZE_FIXED, 0, "setmlme" },
+  { QCSAP_IOCTL_GET_STAWPAIE,
+      IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "get_staWPAIE" },
+  { QCSAP_IOCTL_SETWPAIE,
+      IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE | IW_PRIV_SIZE_FIXED, 0, "setwpaie" },
+  { QCSAP_IOCTL_STOPBSS,
+      IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED, 0, "stopbss" },
+  { QCSAP_IOCTL_VERSION, 0,
+      IW_PRIV_TYPE_CHAR | QCSAP_MAX_WSC_IE, "version" },
+  { QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES,
+      IW_PRIV_TYPE_BYTE | sizeof(sQcSapreq_WPSPBCProbeReqIES_t) | IW_PRIV_SIZE_FIXED | 1, 0, "getProbeReqIEs" },
+  { QCSAP_IOCTL_GET_CHANNEL, 0,
+      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | sizeof(signed long int), "getchannel" },
+  { QCSAP_IOCTL_ASSOC_STA_MACADDR, 0,
+      IW_PRIV_TYPE_BYTE | /*((WLAN_MAX_STA_COUNT*6)+100)*/1 , "get_assoc_stamac" },
+    { QCSAP_IOCTL_DISASSOC_STA,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 6 , 0, "disassoc_sta" },
+  { QCSAP_IOCTL_AP_STATS,
+        IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE, 0, "ap_stats" },
+  { QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED,
+        IW_PRIV_TYPE_CHAR | 18,
+        IW_PRIV_TYPE_CHAR | 3, "getLinkSpeed" },
+
+  { QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "" },
+   /* handlers for sub-ioctl */
+   {   WE_SET_WLAN_DBG,
+       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+       0, 
+       "setwlandbg" },
+
+   /* handlers for main ioctl */
+   {   QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE,
+       IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
+       0, 
+       "" },
+
+   /* handlers for sub-ioctl */
+   {   WE_LOG_DUMP_CMD,
+       IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
+       0, 
+       "dump" },
+#ifdef WLAN_FEATURE_P2P
+   {   WE_P2P_NOA_CMD,
+       IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
+       0, 
+       "SetP2pPs" },
+#endif
+    /* handlers for main ioctl */
+    {   QCSAP_IOCTL_MODIFY_ACL,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 8,
+        0, 
+        "modify_acl" },
+
+    /* handlers for main ioctl */
+    {   QCSAP_IOCTL_GET_CHANNEL_LIST,
+        0, 
+        IW_PRIV_TYPE_BYTE | sizeof(tChannelListInfo),
+        "getChannelList" },
+
+};
+static const iw_handler hostapd_private[] = {
+   [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam,  //set priv ioctl
+   [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam,  //get priv ioctl   
+   [QCSAP_IOCTL_COMMIT   - SIOCIWFIRSTPRIV] = iw_softap_commit, //get priv ioctl   
+   [QCSAP_IOCTL_SETMLME  - SIOCIWFIRSTPRIV] = iw_softap_setmlme,
+   [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, //get station genIE
+   [QCSAP_IOCTL_SETWPAIE - SIOCIWFIRSTPRIV] = iw_softap_setwpsie,
+   [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss,       // stop bss
+   [QCSAP_IOCTL_VERSION - SIOCIWFIRSTPRIV] = iw_softap_version,       // get driver version
+   [QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES - SIOCIWFIRSTPRIV] = iw_get_WPSPBCProbeReqIEs,
+   [QCSAP_IOCTL_GET_CHANNEL - SIOCIWFIRSTPRIV] = iw_softap_getchannel,
+   [QCSAP_IOCTL_ASSOC_STA_MACADDR - SIOCIWFIRSTPRIV] = iw_softap_getassoc_stamacaddr,
+   [QCSAP_IOCTL_DISASSOC_STA - SIOCIWFIRSTPRIV] = iw_softap_disassoc_sta,
+   [QCSAP_IOCTL_AP_STATS - SIOCIWFIRSTPRIV] = iw_softap_ap_stats,
+   [QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV]  = iw_set_three_ints_getnone,   
+   [QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV]     = iw_set_var_ints_getnone,
+   [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range,
+   [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV]   = iw_softap_modify_acl,
+   [QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV]   = iw_softap_get_channel_list,
+   [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV]     = iw_get_softap_linkspeed
+};
+const struct iw_handler_def hostapd_handler_def = {
+   .num_standard     = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]),
+   .num_private      = sizeof(hostapd_private) / sizeof(hostapd_private[0]),
+   .num_private_args = sizeof(hostapd_private_args) / sizeof(hostapd_private_args[0]),
+   .standard         = (iw_handler *)hostapd_handler,
+   .private          = (iw_handler *)hostapd_private,
+   .private_args     = hostapd_private_args,
+   .get_wireless_stats = NULL,
+};
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
+struct net_device_ops net_ops_struct  = {
+    .ndo_open = hdd_hostapd_open,
+    .ndo_stop = hdd_hostapd_stop,
+    .ndo_uninit = hdd_hostapd_uninit,
+    .ndo_start_xmit = hdd_softap_hard_start_xmit,
+    .ndo_tx_timeout = hdd_softap_tx_timeout,
+    .ndo_get_stats = hdd_softap_stats,
+    .ndo_set_mac_address = hdd_hostapd_set_mac_address,
+    .ndo_do_ioctl = hdd_hostapd_ioctl,
+    .ndo_change_mtu = hdd_hostapd_change_mtu,
+    .ndo_select_queue = hdd_hostapd_select_queue,
+ };
+#endif
+
+int hdd_set_hostapd(hdd_adapter_t *pAdapter)
+{
+    return VOS_STATUS_SUCCESS;
+} 
+
+void hdd_set_ap_ops( struct net_device *pWlanHostapdDev )
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
+  pWlanHostapdDev->netdev_ops = &net_ops_struct;
+#else
+  pWlanHostapdDev->open = hdd_hostapd_open;
+  pWlanHostapdDev->stop = hdd_hostapd_stop;
+  pWlanHostapdDev->uninit = hdd_hostapd_uninit;
+  pWlanHostapdDev->hard_start_xmit = hdd_softap_hard_start_xmit;
+  pWlanHostapdDev->tx_timeout = hdd_softap_tx_timeout;
+  pWlanHostapdDev->get_stats = hdd_softap_stats;
+  pWlanHostapdDev->set_mac_address = hdd_hostapd_set_mac_address;
+  pWlanHostapdDev->do_ioctl = hdd_hostapd_ioctl;
+#endif
+}
+
+VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
+{   
+    hdd_hostapd_state_t * phostapdBuf;
+    struct net_device *dev = pAdapter->dev;
+    VOS_STATUS status;
+    ENTER();
+       // Allocate the Wireless Extensions state structure   
+    phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR( pAdapter );
+ 
+    // Zero the memory.  This zeros the profile structure.
+    memset(phostapdBuf, 0,sizeof(hdd_hostapd_state_t));
+    
+    // Set up the pointer to the Wireless Extensions state structure
+    // NOP
+    status = hdd_set_hostapd(pAdapter);
+    if(!VOS_IS_STATUS_SUCCESS(status)) {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_hostapd failed!!\n"));
+         return status;
+    }
+ 
+    status = vos_event_init(&phostapdBuf->vosEvent);
+    if (!VOS_IS_STATUS_SUCCESS(status))
+    {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: Hostapd HDD vos event init failed!!\n"));
+         return status;
+    }
+    
+    init_completion(&pAdapter->session_close_comp_var);
+    init_completion(&pAdapter->session_open_comp_var);
+
+    sema_init(&(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->semWpsPBCOverlapInd, 1);
+ 
+     // Register as a wireless device
+    dev->wireless_handlers = (struct iw_handler_def *)& hostapd_handler_def;
+
+    //Initialize the data path module
+    status = hdd_softap_init_tx_rx(pAdapter);
+    if ( !VOS_IS_STATUS_SUCCESS( status ))
+    {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: hdd_softap_init_tx_rx failed", __FUNCTION__);
+    }
+    
+#ifdef CONFIG_CFG80211
+    wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), pAdapter );
+#endif
+#ifdef WLAN_FEATURE_P2P
+    /* If administrative interface is enabled then one interface being
+     * created for p2p device address. This will take one HW STA and 
+     * the max number of clients that can connect to softAP will be 
+     * reduced by one. So as soon as SoftAP interface got created remove 
+     * the session for p2p device address.
+     */
+    if ( VOS_IS_STATUS_SUCCESS( status ) && 
+            ( pAdapter->device_mode == WLAN_HDD_SOFTAP ) && 
+            ( !strncmp( pAdapter->dev->name, "wlan", 4 )) )
+    {
+        hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        {
+            INIT_COMPLETION(pAdapter->session_close_comp_var);
+            if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
+                        pAdapter->p2pSessionId,
+                        hdd_smeCloseSessionCallback, pAdapter ) )
+            {
+                //Block on a completion variable. Can't wait forever though.
+                wait_for_completion_interruptible_timeout(
+                        &pAdapter->session_close_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+            }
+        }
+    }
+#endif
+    EXIT();
+    return status;
+}
+
+hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *iface_name )
+{
+    struct net_device *pWlanHostapdDev = NULL;
+    hdd_adapter_t *pHostapdAdapter = NULL;
+    v_CONTEXT_t pVosContext= NULL;
+
+#ifdef CONFIG_CFG80211
+   pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES);
+#else   
+   pWlanHostapdDev = alloc_etherdev_mq(sizeof(hdd_adapter_t), NUM_TX_QUEUES);
+#endif
+
+    if (pWlanHostapdDev != NULL)
+    {
+        pHostapdAdapter = netdev_priv(pWlanHostapdDev);
+
+        //Init the net_device structure
+        ether_setup(pWlanHostapdDev);
+
+        //Initialize the adapter context to zeros.
+        vos_mem_zero(pHostapdAdapter, sizeof( hdd_adapter_t ));
+        pHostapdAdapter->dev = pWlanHostapdDev;
+        pHostapdAdapter->pHddCtx = pHddCtx; 
+        pHostapdAdapter->magic = WLAN_HDD_ADAPTER_MAGIC;
+
+        //Get the Global VOSS context.
+        pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+        //Save the adapter context in global context for future.
+        ((VosContextType*)(pVosContext))->pHDDSoftAPContext = (v_VOID_t*)pHostapdAdapter;
+
+        //Init the net_device structure
+        strlcpy(pWlanHostapdDev->name, (const char *)iface_name, IFNAMSIZ);
+
+        hdd_set_ap_ops( pHostapdAdapter->dev );
+
+        pWlanHostapdDev->tx_queue_len = NET_DEV_TX_QUEUE_LEN;
+        pWlanHostapdDev->watchdog_timeo = HDD_TX_TIMEOUT;
+        pWlanHostapdDev->mtu = HDD_DEFAULT_MTU;
+    
+        vos_mem_copy(pWlanHostapdDev->dev_addr, (void *)macAddr,sizeof(tSirMacAddr));
+        vos_mem_copy(pHostapdAdapter->macAddressCurrent.bytes, (void *)macAddr, sizeof(tSirMacAddr));
+
+        pWlanHostapdDev->destructor = free_netdev;
+#ifdef CONFIG_CFG80211
+        pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ;
+        pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy;  
+        pHostapdAdapter->wdev.netdev =  pWlanHostapdDev;
+        init_completion(&pHostapdAdapter->tx_action_cnf_event);
+#endif 
+        init_completion(&pHostapdAdapter->cancel_rem_on_chan_var);
+        init_completion(&pHostapdAdapter->rem_on_chan_ready_event);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+        init_completion(&pHostapdAdapter->offchannel_tx_event);
+#endif
+
+        init_completion(&pHostapdAdapter->scan_info.scan_req_completion_event);
+
+        SET_NETDEV_DEV(pWlanHostapdDev, pHddCtx->parent_dev);
+    }
+    return pHostapdAdapter;
+}
+
+VOS_STATUS hdd_register_hostapd( hdd_adapter_t *pAdapter, tANI_U8 rtnl_lock_held )
+{
+   struct net_device *dev = pAdapter->dev;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   ENTER();
+   
+   if( rtnl_lock_held )
+   {
+      if (strchr(dev->name, '%')) {
+         if( dev_alloc_name(dev, dev->name) < 0 )
+         {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s:Failed:dev_alloc_name", __func__);
+            return VOS_STATUS_E_FAILURE;            
+         }
+      }
+      if (register_netdevice(dev))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s:Failed:register_netdevice", __func__);
+         return VOS_STATUS_E_FAILURE;         
+      }
+   }
+   else
+   {
+      if (register_netdev(dev))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed:register_netdev", __func__);
+         return VOS_STATUS_E_FAILURE;
+      }
+   }
+   set_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags);
+     
+   EXIT();
+   return status;
+}
+    
+VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter)
+{
+   ENTER();
+   
+   hdd_softap_deinit_tx_rx(pAdapter);
+
+   /* if we are being called during driver unload, then the dev has already
+      been invalidated.  if we are being called at other times, then we can
+      detatch the wireless device handlers */
+   if (pAdapter->dev)
+   {
+      pAdapter->dev->wireless_handlers = NULL;
+   }
+   EXIT();
+   return 0;
+}
diff --git a/CORE/HDD/src/wlan_hdd_innav.c b/CORE/HDD/src/wlan_hdd_innav.c
new file mode 100644
index 0000000..1e9b029
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_innav.c
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
new file mode 100644
index 0000000..53397a0
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -0,0 +1,4469 @@
+/*
+ * 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  wlan_hdd_main.c
+
+  \brief WLAN Host Device Driver implementation
+
+   Copyright 2008 (c) 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
+  --------    ---    --------------------------------------------------------
+  04/5/09     Shailender     Created module.
+  02/24/10    Sudhir.S.Kohalli  Added to support param for SoftAP module
+  06/03/10    js - Added support to hostapd driven deauth/disassoc/mic failure
+  ==========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+//#include <wlan_qct_driver.h>
+#include <wlan_hdd_includes.h>
+#ifdef ANI_BUS_TYPE_SDIO
+#include <wlan_sal_misc.h>
+#endif // ANI_BUS_TYPE_SDIO
+#include <vos_api.h>
+#include <vos_sched.h>
+#include <vos_power.h>
+#include <linux/etherdevice.h>
+#include <linux/firmware.h>
+#ifdef ANI_BUS_TYPE_SDIO
+#include <linux/mmc/sdio_func.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
+// added in 2.6.32, need to define locally if using an earlier kernel
+#define dev_to_sdio_func(d)      container_of(d, struct sdio_func, dev)
+#endif
+#endif // ANI_BUS_TYPE_SDIO
+#ifdef ANI_BUS_TYPE_PLATFORM
+#include <linux/wcnss_wlan.h>
+#endif //ANI_BUS_TYPE_PLATFORM
+#ifdef ANI_BUS_TYPE_PCI
+#include "wcnss_wlan.h"
+#endif /* ANI_BUS_TYPE_PCI */
+#include <wlan_hdd_tx_rx.h>
+#include <palTimer.h>
+#include <wniApi.h>
+#include <wlan_nlink_srv.h>
+#include <wlan_btc_svc.h>
+#include <wlan_hdd_cfg.h>
+#include <wlan_ptt_sock_svc.h>
+#include <wlan_hdd_wowl.h>
+#include <wlan_hdd_misc.h>
+#include <wlan_hdd_wext.h>
+#ifdef WLAN_BTAMP_FEATURE
+#include <bap_hdd_main.h>
+#include <bapInternal.h>
+#endif // WLAN_BTAMP_FEATURE
+
+#ifdef CONFIG_CFG80211
+#include <linux/wireless.h>
+#include <net/cfg80211.h>
+#include "wlan_hdd_cfg80211.h"
+#include "wlan_hdd_p2p.h"
+#endif
+#include <linux/rtnetlink.h>
+#ifdef ANI_MANF_DIAG
+int wlan_hdd_ftm_start(hdd_context_t *pAdapter);
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+#include "sapApi.h"
+#include <linux/semaphore.h>
+#include <mach/subsystem_restart.h>
+#include <wlan_hdd_hostapd.h>
+#include <wlan_hdd_softap_tx_rx.h>
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "cfgApi.h"
+#endif
+#include "wlan_hdd_dev_pwr.h"
+#ifdef WLAN_BTAMP_FEATURE
+#include "bap_hdd_misc.h"
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_pal_trace.h"
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+#include "qwlan_version.h"
+
+#ifdef MODULE
+#define WLAN_MODULE_NAME  module_name(THIS_MODULE)
+#else
+#define WLAN_MODULE_NAME  "wlan"
+#endif
+
+#ifdef TIMER_MANAGER
+#define TIMER_MANAGER_STR " +TIMER_MANAGER"
+#else
+#define TIMER_MANAGER_STR ""
+#endif
+
+#ifdef MEMORY_DEBUG
+#define MEMORY_DEBUG_STR " +MEMORY_DEBUG"
+#else
+#define MEMORY_DEBUG_STR ""
+#endif
+
+/* the Android framework expects this param even though we don't use it */
+#define BUF_LEN 20
+static char fwpath[BUF_LEN];
+module_param_string(fwpath, fwpath, BUF_LEN,
+                    S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+static struct wake_lock wlan_wake_lock;
+/* set when SSR is needed after unload */
+static v_U8_t      isSsrRequired;
+
+//internal function declaration
+v_U16_t hdd_select_queue(struct net_device *dev,
+    struct sk_buff *skb);
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+static void hdd_set_multicast_list(struct net_device *dev);
+#endif
+
+void hdd_wlan_initial_scan(hdd_adapter_t *pAdapter);
+
+extern int hdd_setBand_helper(struct net_device *dev, tANI_U8* ptr);
+
+static int hdd_netdev_notifier_call(struct notifier_block * nb,
+                                         unsigned long state,
+                                         void *ndev)
+{
+   struct net_device *dev = ndev;
+   hdd_adapter_t *pAdapter = NULL;
+#ifdef WLAN_BTAMP_FEATURE
+   VOS_STATUS status;
+   hdd_context_t *pHddCtx;
+#endif
+
+   //Make sure that this callback corresponds to our device.
+   if((strncmp( dev->name, "wlan", 4 )) && 
+      (strncmp( dev->name, "p2p-wlan", 8))
+     )
+      return NOTIFY_DONE;
+
+#ifdef CONFIG_CFG80211
+   if (!dev->ieee80211_ptr)
+       return NOTIFY_DONE;
+#endif
+
+   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+   if(NULL == pAdapter)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD Adaptor Null Pointer", __func__);
+      VOS_ASSERT(0);
+      return NOTIFY_DONE;
+   }
+
+   hddLog(VOS_TRACE_LEVEL_INFO,"%s: New Net Device State = %lu", __func__, state);
+
+   switch (state) {
+   case NETDEV_REGISTER:
+        break;
+
+   case NETDEV_UNREGISTER:
+        break;
+
+   case NETDEV_UP:
+        break;
+
+   case NETDEV_DOWN:
+        break;
+
+   case NETDEV_CHANGE:
+        if(VOS_STA_MODE == hdd_get_conparam()) 
+        {
+            if(TRUE == pAdapter->isLinkUpSvcNeeded)
+               complete(&pAdapter->linkup_event_var);
+           }
+        break;
+
+   case NETDEV_GOING_DOWN:
+        if( pAdapter->scan_info.mScanPending != FALSE )
+        { 
+           int result;
+           INIT_COMPLETION(pAdapter->abortscan_event_var);
+           hdd_abort_mac_scan(pAdapter->pHddCtx);
+           result = wait_for_completion_interruptible_timeout(
+                               &pAdapter->abortscan_event_var,
+                               msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN));
+           if(!result)
+           {
+              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                         "%s: Timeout occured while waiting for abortscan" ,
+                          __FUNCTION__);
+           }
+        }
+        else
+        {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               "%s: Scan is not Pending from user" , __FUNCTION__);
+        }
+#ifdef WLAN_BTAMP_FEATURE
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __FUNCTION__);
+        pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+        status = WLANBAP_StopAmp();
+        if(VOS_STATUS_SUCCESS != status )
+        {
+           pHddCtx->isAmpAllowed = VOS_TRUE;
+           hddLog(VOS_TRACE_LEVEL_FATAL,
+                  "%s: Failed to stop AMP", __func__);
+        }
+        else
+        {
+           //a state m/c implementation in PAL is TBD to avoid this delay
+           msleep(500);
+           pHddCtx->isAmpAllowed = VOS_FALSE;
+           WLANBAP_DeregisterFromHCI();
+        }
+#endif //WLAN_BTAMP_FEATURE
+        break;
+
+   default:
+        break;
+   }
+
+   return NOTIFY_DONE;
+}
+
+struct notifier_block hdd_netdev_notifier = {
+   .notifier_call = hdd_netdev_notifier_call,
+};
+
+/*---------------------------------------------------------------------------
+ *   Function definitions
+ *-------------------------------------------------------------------------*/
+extern int isWDresetInProgress(void);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+extern void register_wlan_suspend(void);
+extern void unregister_wlan_suspend(void);
+void hdd_unregister_mcast_bcast_filter(hdd_context_t *pHddCtx);
+void hdd_register_mcast_bcast_filter(hdd_context_t *pHddCtx);
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+//variable to hold the insmod parameters
+static int con_mode = 0;
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**---------------------------------------------------------------------------
+
+  \brief hdd_wdi_trace_enable() - Configure initial WDI Trace enable
+
+  Called immediately after the cfg.ini is read in order to configure
+  the desired trace levels in the WDI.
+
+  \param  - moduleId - module whose trace level is being configured
+  \param  - bitmask - bitmask of log levels to be enabled
+
+  \return - void
+
+  --------------------------------------------------------------------------*/
+static void hdd_wdi_trace_enable(wpt_moduleid moduleId, v_U32_t bitmask)
+{
+   wpt_tracelevel level;
+
+   /* if the bitmask is the default value, then a bitmask was not
+      specified in cfg.ini, so leave the logging level alone (it
+      will remain at the "compiled in" default value) */
+   if (CFG_WDI_TRACE_ENABLE_DEFAULT == bitmask)
+   {
+      return;
+   }
+
+   /* a mask was specified.  start by disabling all logging */
+   wpalTraceSetLevel(moduleId, eWLAN_PAL_TRACE_LEVEL_NONE, 0);
+
+   /* now cycle through the bitmask until all "set" bits are serviced */
+   level = eWLAN_PAL_TRACE_LEVEL_FATAL;
+   while (0 != bitmask)
+   {
+      if (bitmask & 1)
+      {
+         wpalTraceSetLevel(moduleId, level, 1);
+      }
+      level++;
+      bitmask >>= 1;
+   }
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_priv_data_t priv_data;
+   tANI_U8 *command = NULL;
+   int ret = 0;
+
+   if (NULL == pAdapter)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD adapter context is Null", __FUNCTION__);
+      ret = -ENODEV;
+      goto exit; 
+   }
+
+   if ((!ifr) && (!ifr->ifr_data))
+   {
+       ret = -EINVAL;
+       goto exit; 
+   }
+
+   if (copy_from_user(&priv_data, ifr->ifr_data, sizeof(hdd_priv_data_t)))
+   {
+       ret = -EFAULT;
+       goto exit;
+   }
+
+   command = kmalloc(priv_data.total_len, GFP_KERNEL);
+   if (!command)
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+          "%s: failed to allocate memory\n", __FUNCTION__);
+       ret = -ENOMEM;
+       goto exit;
+   }
+
+   if (copy_from_user(command, priv_data.buf, priv_data.total_len))
+   {
+       ret = -EFAULT;
+       goto exit;
+   }
+
+   if ((SIOCDEVPRIVATE + 1) == cmd)
+   {
+       hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                   "***Received %s cmd from Wi-Fi GUI***", command);
+
+       if (strncmp(command, "P2P_DEV_ADDR", 12) == 0 )
+       {
+           if (copy_to_user(priv_data.buf, pHddCtx->p2pDeviceAddress.bytes,
+                                                           sizeof(tSirMacAddr)))
+           {
+               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                  "%s: failed to copy data to user buffer\n", __FUNCTION__);
+               ret = -EFAULT;
+           }
+       }
+       if(strncmp(priv_data.buf, "SETBAND", 7) == 0)
+       {
+           tANI_U8 *ptr = (tANI_U8*)priv_data.buf ;
+           int ret = 0 ;
+        
+           /* Change band request received */
+   
+           /* First 8 bytes will have "SETBAND " and 
+            * 9 byte will have band setting value */
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: SetBandCommand Info  comm %s UL %d, TL %d", __FUNCTION__, priv_data.buf, priv_data.used_len, priv_data.total_len);
+        
+           /* Change band request received */
+           ret = hdd_setBand_helper(dev, ptr);   
+       } 
+   }
+exit:
+   if (command)
+   {
+       kfree(command);
+   }
+   return ret;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_open() - HDD Open function
+
+  This is called in response to ifconfig up
+
+  \param  - dev Pointer to net_device structure
+
+  \return - 0 for success non-zero for failure
+
+  --------------------------------------------------------------------------*/
+int hdd_open (struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_context_t *pHddCtx;
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   v_BOOL_t in_standby = TRUE;
+
+   if (NULL == pAdapter) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD adapter context is Null", __FUNCTION__);
+      return -ENODEV;
+   }
+   
+   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+   if (NULL == pHddCtx)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD context is Null", __FUNCTION__);
+      return -ENODEV;
+   }
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+   while ( (NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status) )
+   {
+        if( pAdapterNode->pAdapter->event_flags & DEVICE_IFACE_OPENED)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: chip already out of " 
+                  "standby", __func__, pAdapter->device_mode);
+            in_standby = FALSE;
+            break;
+        }
+        else
+        {
+            status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+            pAdapterNode = pNext;
+        }
+   }
+ 
+   if (TRUE == in_standby)
+   {
+       if (VOS_STATUS_SUCCESS != wlan_hdd_exit_lowpower(pHddCtx, pAdapter))
+       {
+           hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to bring " 
+                   "wlan out of power save", __func__);
+           return -EINVAL;
+       }
+   }
+   
+   pAdapter->event_flags |= DEVICE_IFACE_OPENED;
+   if (hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) 
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                 "%s: Enabling Tx Queues", __FUNCTION__);
+       /* Enable TX queues only when we are connected */
+       netif_tx_start_all_queues(dev);
+   }
+
+   return 0;
+}
+
+int hdd_mon_open (struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+   if(pAdapter == NULL) {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD adapter context is Null", __FUNCTION__);
+      return -1;
+   }
+
+   netif_start_queue(dev);
+
+   return 0;
+}
+/**---------------------------------------------------------------------------
+
+  \brief hdd_stop() - HDD stop function
+
+  This is called in response to ifconfig down
+
+  \param  - dev Pointer to net_device structure
+
+  \return - 0 for success non-zero for failure
+
+  --------------------------------------------------------------------------*/
+
+int hdd_stop (struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_context_t *pHddCtx;
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   v_BOOL_t enter_standby = TRUE;
+   
+   ENTER();
+
+   if (NULL == pAdapter)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD adapter context is Null", __FUNCTION__);
+      return -ENODEV;
+   }
+
+   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+   if (NULL == pHddCtx)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: HDD context is Null", __FUNCTION__);
+      return -ENODEV;
+   }
+
+   pAdapter->event_flags &= ~(DEVICE_IFACE_OPENED);
+   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disabling OS Tx queues", __func__);
+   netif_tx_disable(pAdapter->dev);
+   netif_carrier_off(pAdapter->dev);
+
+
+   /* SoftAP ifaces should never go in power save mode
+      making sure same here. */
+   if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode )
+                 || (WLAN_HDD_MONITOR == pAdapter->device_mode )
+#ifdef WLAN_FEATURE_P2P
+                 || (WLAN_HDD_P2P_GO == pAdapter->device_mode )
+#endif
+      )
+   {
+      /* SoftAP mode, so return from here */
+      EXIT();
+      return 0;
+   }
+
+   /* Find if any iface is up then
+      if any iface is up then can't put device to sleep/ power save mode. */
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+   while ( (NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status) )
+   {
+        if ( pAdapterNode->pAdapter->event_flags & DEVICE_IFACE_OPENED)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: Still other ifaces are up cannot "
+                   "put device to sleep", __func__, pAdapter->device_mode);
+            enter_standby = FALSE;
+            break;
+        }
+        else
+        { 
+            status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+            pAdapterNode = pNext;
+        }
+   }
+
+   if (TRUE == enter_standby)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO, "%s: All Interfaces are Down " 
+                 "entering standby", __func__);
+       if (VOS_STATUS_SUCCESS != wlan_hdd_enter_lowpower(pHddCtx))
+       {
+           /*log and return success*/
+           hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to put "
+                   "wlan in power save", __func__);
+       }
+   }
+   
+   EXIT();
+   return 0;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_uninit() - HDD uninit function
+
+  This is called during the netdev unregister to uninitialize all data
+associated with the device
+
+  \param  - dev Pointer to net_device structure
+
+  \return - void
+
+  --------------------------------------------------------------------------*/
+static void hdd_uninit (struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+   ENTER();
+
+   do
+   {
+      if (NULL == pAdapter)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: NULL pAdapter", __func__);
+         break;
+      }
+
+      if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: Invalid magic", __func__);
+         break;
+      }
+
+      if (NULL == pAdapter->pHddCtx)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: NULL pHddCtx", __func__);
+         break;
+      }
+
+      if (dev != pAdapter->dev)
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: Invalid device reference", __func__);
+         /* we haven't validated all cases so let this go for now */
+      }
+
+      hdd_deinit_adapter(pAdapter->pHddCtx, pAdapter);
+
+      /* after uninit our adapter structure will no longer be valid */
+      pAdapter->dev = NULL;
+      pAdapter->magic = 0;
+   } while (0);
+
+   EXIT();
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_release_firmware() -
+
+   This function calls the release firmware API to free the firmware buffer.
+
+  \param  - pFileName Pointer to the File Name.
+                  pCtx - Pointer to the adapter .
+
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS hdd_release_firmware(char *pFileName,v_VOID_t *pCtx)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   hdd_context_t *pHddCtx = (hdd_context_t*)pCtx;
+   ENTER();
+
+
+   if (!strcmp(WLAN_FW_FILE, pFileName)) {
+   
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"%s: Loaded firmware file is %s",__func__,pFileName);
+
+       if(pHddCtx->fw) {
+          release_firmware(pHddCtx->fw);
+          pHddCtx->fw = NULL;
+       }
+       else
+          status = VOS_STATUS_E_FAILURE;
+   }
+   else if (!strcmp(WLAN_NV_FILE,pFileName)) {
+       if(pHddCtx->nv) {
+          release_firmware(pHddCtx->nv);
+          pHddCtx->nv = NULL;
+       }
+       else
+          status = VOS_STATUS_E_FAILURE;
+
+   }
+
+   EXIT();
+   return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_request_firmware() -
+
+   This function reads the firmware file using the request firmware
+   API and returns the the firmware data and the firmware file size.
+
+  \param  - pfileName - Pointer to the file name.
+              - pCtx - Pointer to the adapter .
+              - ppfw_data - Pointer to the pointer of the firmware data.
+              - pSize - Pointer to the file size.
+
+  \return - VOS_STATUS_SUCCESS for success, VOS_STATUS_E_FAILURE for failure
+
+  --------------------------------------------------------------------------*/
+
+
+VOS_STATUS hdd_request_firmware(char *pfileName,v_VOID_t *pCtx,v_VOID_t **ppfw_data, v_SIZE_t *pSize)
+{
+   int status;
+   VOS_STATUS retval = VOS_STATUS_SUCCESS;
+   hdd_context_t *pHddCtx = (hdd_context_t*)pCtx;
+   ENTER();
+
+   if( (!strcmp(WLAN_FW_FILE, pfileName)) ) {
+
+       status = request_firmware(&pHddCtx->fw, pfileName, pHddCtx->parent_dev);
+
+       if(status || !pHddCtx->fw || !pHddCtx->fw->data) {
+           hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Firmware %s download failed",
+                  __func__, pfileName);
+           retval = VOS_STATUS_E_FAILURE;
+       }
+
+       else {
+         *ppfw_data = (v_VOID_t *)pHddCtx->fw->data;
+         *pSize = pHddCtx->fw->size;
+          hddLog(VOS_TRACE_LEVEL_INFO, "%s: Firmware size = %d",
+                 __func__, *pSize);
+       }
+   }
+   else if(!strcmp(WLAN_NV_FILE, pfileName)) {
+
+       status = request_firmware(&pHddCtx->nv, pfileName, pHddCtx->parent_dev);
+
+       if(status || !pHddCtx->nv || !pHddCtx->nv->data) {
+           hddLog(VOS_TRACE_LEVEL_FATAL, "%s: nv %s download failed",
+                  __func__, pfileName);
+           retval = VOS_STATUS_E_FAILURE;
+       }
+
+       else {
+         *ppfw_data = (v_VOID_t *)pHddCtx->nv->data;
+         *pSize = pHddCtx->nv->size;
+          hddLog(VOS_TRACE_LEVEL_INFO, "%s: nv file size = %d",
+                 __func__, *pSize);
+       }
+   }
+
+   EXIT();
+   return retval;
+}
+/**---------------------------------------------------------------------------
+     \brief hdd_full_pwr_cbk() - HDD full power callbackfunction
+
+      This is the function invoked by SME to inform the result of a full power
+      request issued by HDD
+
+     \param  - callbackcontext - Pointer to cookie
+               status - result of request
+
+     \return - None
+
+--------------------------------------------------------------------------*/
+void hdd_full_pwr_cbk(void *callbackContext, eHalStatus status)
+{
+   hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext;
+
+   hddLog(VOS_TRACE_LEVEL_ERROR,"HDD full Power callback status = %d", status);
+   if(&pHddCtx->full_pwr_comp_var)
+   {
+      complete(&pHddCtx->full_pwr_comp_var);
+   }
+}
+
+/**---------------------------------------------------------------------------
+
+    \brief hdd_req_bmps_cbk() - HDD Request BMPS callback function
+
+     This is the function invoked by SME to inform the result of BMPS
+     request issued by HDD
+
+    \param  - callbackcontext - Pointer to cookie
+               status - result of request
+
+    \return - None
+
+--------------------------------------------------------------------------*/
+void hdd_req_bmps_cbk(void *callbackContext, eHalStatus status)
+{
+
+   struct completion *completion_var = (struct completion*) callbackContext;
+
+   hddLog(VOS_TRACE_LEVEL_ERROR, "HDD BMPS request Callback, status = %d\n", status);
+   if(completion_var != NULL)
+   {
+      complete(completion_var);
+   }
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_get_cfg_file_size() -
+
+   This function reads the configuration file using the request firmware
+   API and returns the configuration file size.
+
+  \param  - pCtx - Pointer to the adapter .
+              - pFileName - Pointer to the file name.
+              - pBufSize - Pointer to the buffer size.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS hdd_get_cfg_file_size(v_VOID_t *pCtx, char *pFileName, v_SIZE_t *pBufSize)
+{
+   int status;
+   hdd_context_t *pHddCtx = (hdd_context_t*)pCtx;
+
+   ENTER();
+
+   status = request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev);
+
+   if(status || !pHddCtx->fw || !pHddCtx->fw->data) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: CFG download failed",__func__);
+      status = VOS_STATUS_E_FAILURE;
+   }
+   else {
+      *pBufSize = pHddCtx->fw->size;
+      hddLog(VOS_TRACE_LEVEL_INFO, "%s: CFG size = %d", __func__, *pBufSize);
+      release_firmware(pHddCtx->fw);
+      pHddCtx->fw = NULL;
+   }
+
+   EXIT();
+   return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_read_cfg_file() -
+
+   This function reads the configuration file using the request firmware
+   API and returns the cfg data and the buffer size of the configuration file.
+
+  \param  - pCtx - Pointer to the adapter .
+              - pFileName - Pointer to the file name.
+              - pBuffer - Pointer to the data buffer.
+              - pBufSize - Pointer to the buffer size.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS hdd_read_cfg_file(v_VOID_t *pCtx, char *pFileName,
+    v_VOID_t *pBuffer, v_SIZE_t *pBufSize)
+{
+   int status;
+   hdd_context_t *pHddCtx = (hdd_context_t*)pCtx;
+
+   ENTER();
+
+   status = request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev);
+
+   if(status || !pHddCtx->fw || !pHddCtx->fw->data) {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: CFG download failed",__func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   else {
+      if(*pBufSize != pHddCtx->fw->size) {
+         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Caller sets invalid CFG "
+             "file size", __func__);
+         release_firmware(pHddCtx->fw);
+         pHddCtx->fw = NULL;
+         return VOS_STATUS_E_FAILURE;
+      }
+        else {
+         if(pBuffer) {
+            vos_mem_copy(pBuffer,pHddCtx->fw->data,*pBufSize);
+         }
+         release_firmware(pHddCtx->fw);
+         pHddCtx->fw = NULL;
+        }
+   }
+
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_set_mac_addr_cb() -
+
+   This function is the call back function for setting the station
+   mac adrress called by ccm module to indicate the
+   success/failure result.
+
+  \param  - hHal - Pointer to the hal module.
+              - result - returns the result of the set mac address.
+
+  \return - void
+
+  --------------------------------------------------------------------------*/
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+static void hdd_set_mac_addr_cb( tHalHandle hHal, tANI_S32 result )
+{
+  // ignore the STA_ID response for now.
+
+  VOS_ASSERT( CCM_IS_RESULT_SUCCESS( result ) );
+}
+#endif
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_set_mac_address() -
+
+   This function sets the user specified mac address using
+   the command ifconfig wlanX hw ether <mac adress>.
+
+  \param  - dev - Pointer to the net device.
+              - addr - Pointer to the sockaddr.
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static int hdd_set_mac_address(struct net_device *dev, void *addr)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   struct sockaddr *psta_mac_addr = addr;
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+
+   ENTER();
+
+   memcpy(&pAdapter->macAddressCurrent, psta_mac_addr->sa_data, ETH_ALEN);
+
+#ifdef HDD_SESSIONIZE 
+   // set the MAC address though the STA ID CFG.
+   halStatus = ccmCfgSetStr( pAdapter->hHal, WNI_CFG_STA_ID,
+                             (v_U8_t *)&pAdapter->macAddressCurrent,
+                             sizeof( pAdapter->macAddressCurrent ),
+                             hdd_set_mac_addr_cb, VOS_FALSE );
+#endif
+
+   memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN);
+
+   EXIT();
+   return halStatus;
+}
+
+tANI_U8* wlan_hdd_get_intf_addr(hdd_context_t* pHddCtx)
+{
+   int i;
+   for ( i = 0; i < VOS_MAX_CONCURRENCY_PERSONA; i++)
+   {
+      if( 0 == (pHddCtx->cfg_ini->intfAddrMask >> i))
+         break;
+   }
+
+   if( VOS_MAX_CONCURRENCY_PERSONA == i)
+      return NULL;
+
+   pHddCtx->cfg_ini->intfAddrMask |= (1 << i);
+   return &pHddCtx->cfg_ini->intfMacAddr[i].bytes[0];
+}
+
+void wlan_hdd_release_intf_addr(hdd_context_t* pHddCtx, tANI_U8* releaseAddr)
+{
+   int i;
+   for ( i = 0; i < VOS_MAX_CONCURRENCY_PERSONA; i++)
+   {
+      if ( !memcmp(releaseAddr, &pHddCtx->cfg_ini->intfMacAddr[i].bytes[0], 6) )
+      {
+         pHddCtx->cfg_ini->intfAddrMask &= ~(1 << i);
+         break;
+      } 
+   }
+   return;
+}
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+  static struct net_device_ops wlan_drv_ops = {
+      .ndo_open = hdd_open,
+      .ndo_stop = hdd_stop,
+      .ndo_uninit = hdd_uninit,
+      .ndo_start_xmit = hdd_hard_start_xmit,
+      .ndo_tx_timeout = hdd_tx_timeout,
+      .ndo_get_stats = hdd_stats,
+      .ndo_do_ioctl = hdd_ioctl,
+      .ndo_set_mac_address = hdd_set_mac_address,
+      .ndo_select_queue    = hdd_select_queue,
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0))
+      .ndo_set_rx_mode = hdd_set_multicast_list,
+#else
+      .ndo_set_multicast_list = hdd_set_multicast_list,
+#endif //LINUX_VERSION_CODE
+#endif
+ };
+#ifdef CONFIG_CFG80211   
+ static struct net_device_ops wlan_mon_drv_ops = {
+      .ndo_open = hdd_mon_open,
+      .ndo_stop = hdd_stop,
+      .ndo_uninit = hdd_uninit,
+      .ndo_start_xmit = hdd_mon_hard_start_xmit,  
+      .ndo_tx_timeout = hdd_tx_timeout,
+      .ndo_get_stats = hdd_stats,
+      .ndo_do_ioctl = hdd_ioctl,
+      .ndo_set_mac_address = hdd_set_mac_address,
+ };
+#endif
+
+#endif
+
+void hdd_set_station_ops( struct net_device *pWlanDev )
+{
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+      pWlanDev->tx_queue_len = NET_DEV_TX_QUEUE_LEN,
+      pWlanDev->netdev_ops = &wlan_drv_ops;
+#else
+      pWlanDev->open = hdd_open;
+      pWlanDev->stop = hdd_stop;
+      pWlanDev->uninit = hdd_uninit;
+      pWlanDev->hard_start_xmit = NULL;
+      pWlanDev->tx_timeout = hdd_tx_timeout;
+      pWlanDev->get_stats = hdd_stats;
+      pWlanDev->do_ioctl = hdd_ioctl;
+      pWlanDev->tx_queue_len = NET_DEV_TX_QUEUE_LEN;
+      pWlanDev->set_mac_address = hdd_set_mac_address;
+#endif
+}
+
+hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMacAddr macAddr, char* name )
+{
+   struct net_device *pWlanDev = NULL;
+   hdd_adapter_t *pAdapter = NULL;
+#ifdef CONFIG_CFG80211
+   /*
+    * cfg80211 initialization and registration....
+    */ 
+   pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, ether_setup, NUM_TX_QUEUES);
+   
+#else      
+   //Allocate the net_device and private data (station ctx) 
+   pWlanDev = alloc_etherdev_mq(sizeof( hdd_adapter_t ), NUM_TX_QUEUES);
+
+#endif
+
+   if(pWlanDev != NULL)
+   {
+
+      //Save the pointer to the net_device in the HDD adapter
+      pAdapter = (hdd_adapter_t*) netdev_priv( pWlanDev );
+
+#ifndef CONFIG_CFG80211
+      //Init the net_device structure
+      ether_setup(pWlanDev);
+#endif
+
+      vos_mem_zero( pAdapter, sizeof( hdd_adapter_t ) );
+
+      pAdapter->dev = pWlanDev;
+      pAdapter->pHddCtx = pHddCtx; 
+      pAdapter->magic = WLAN_HDD_ADAPTER_MAGIC;
+
+      init_completion(&pAdapter->session_open_comp_var);
+      init_completion(&pAdapter->session_close_comp_var);
+      init_completion(&pAdapter->disconnect_comp_var);
+      init_completion(&pAdapter->linkup_event_var);
+      init_completion(&pAdapter->cancel_rem_on_chan_var);
+      init_completion(&pAdapter->rem_on_chan_ready_event);
+      init_completion(&pAdapter->abortscan_event_var);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+      init_completion(&pAdapter->offchannel_tx_event);
+#endif
+#ifdef CONFIG_CFG80211
+      init_completion(&pAdapter->tx_action_cnf_event);
+#endif
+      init_completion(&pHddCtx->mc_sus_event_var);
+      init_completion(&pHddCtx->tx_sus_event_var);
+
+      init_completion(&pAdapter->scan_info.scan_req_completion_event);
+
+      pAdapter->isLinkUpSvcNeeded = FALSE; 
+      pAdapter->higherDtimTransition = eANI_BOOLEAN_TRUE;
+      //Init the net_device structure
+      strlcpy(pWlanDev->name, name, IFNAMSIZ);
+
+      vos_mem_copy(pWlanDev->dev_addr, (void *)macAddr, sizeof(tSirMacAddr));
+      vos_mem_copy( pAdapter->macAddressCurrent.bytes, macAddr, sizeof(tSirMacAddr));
+      pWlanDev->watchdog_timeo = HDD_TX_TIMEOUT;
+      pWlanDev->hard_header_len += LIBRA_HW_NEEDED_HEADROOM;
+
+      hdd_set_station_ops( pAdapter->dev );
+
+      pWlanDev->destructor = free_netdev;
+#ifdef CONFIG_CFG80211
+      pWlanDev->ieee80211_ptr = &pAdapter->wdev ;
+      pAdapter->wdev.wiphy = pHddCtx->wiphy;  
+      pAdapter->wdev.netdev =  pWlanDev;
+#endif  
+      /* set pWlanDev's parent to underlying device */
+      SET_NETDEV_DEV(pWlanDev, pHddCtx->parent_dev);
+   }
+
+   return pAdapter;
+}
+
+VOS_STATUS hdd_register_interface( hdd_adapter_t *pAdapter, tANI_U8 rtnl_lock_held )
+{
+   struct net_device *pWlanDev = pAdapter->dev;
+   //hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
+   //hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+   //eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+
+   if( rtnl_lock_held )
+   {
+      if (strchr(pWlanDev->name, '%')) {
+         if( dev_alloc_name(pWlanDev, pWlanDev->name) < 0 )
+         {
+            hddLog(VOS_TRACE_LEVEL_ERROR,"%s:Failed:dev_alloc_name",__func__);
+            return VOS_STATUS_E_FAILURE;            
+         }
+      }
+      if (register_netdevice(pWlanDev))
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,"%s:Failed:register_netdev",__func__);
+         return VOS_STATUS_E_FAILURE;         
+      }
+   }
+   else
+   {
+      if(register_netdev(pWlanDev))
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failed:register_netdev",__func__);
+         return VOS_STATUS_E_FAILURE;         
+      }
+   }
+   set_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+eHalStatus hdd_smeCloseSessionCallback(void *pContext)
+{
+   if(pContext != NULL)
+   {
+      clear_bit(SME_SESSION_OPENED, &((hdd_adapter_t*)pContext)->event_flags);
+
+      /* need to make sure all of our scheduled work has completed.
+       * This callback is called from MC thread context, so it is safe to 
+       * to call below flush workqueue API from here. 
+       */
+      flush_scheduled_work();
+      complete(&((hdd_adapter_t*)pContext)->session_close_comp_var);
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter )
+{
+   struct net_device *pWlanDev = pAdapter->dev;
+   hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   int rc = 0;
+
+   INIT_COMPLETION(pAdapter->session_open_comp_var);
+   //Open a SME session for future operation
+   halStatus = sme_OpenSession( pHddCtx->hHal, hdd_smeRoamCallback, pAdapter,
+         (tANI_U8 *)&pAdapter->macAddressCurrent, &pAdapter->sessionId );
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+             "sme_OpenSession() failed with status code %08d [x%08lx]",
+                                                 halStatus, halStatus );
+      status = VOS_STATUS_E_FAILURE;
+      goto error_sme_open;
+   }
+   
+   //Block on a completion variable. Can't wait forever though.
+   rc = wait_for_completion_interruptible_timeout(
+                        &pAdapter->session_open_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+   if (!rc)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+             "Session is not opened within timeout period code %08d", rc );
+      status = VOS_STATUS_E_FAILURE;
+      goto error_sme_open;
+   }
+
+   // Register wireless extensions
+   if( eHAL_STATUS_SUCCESS !=  (halStatus = hdd_register_wext(pWlanDev)))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+              "hdd_register_wext() failed with status code %08d [x%08lx]",
+                                                   halStatus, halStatus );
+      status = VOS_STATUS_E_FAILURE;
+      goto error_register_wext;
+   }
+   //Safe to register the hard_start_xmit function again
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+   wlan_drv_ops.ndo_start_xmit = hdd_hard_start_xmit;
+#else
+   pWlanDev->hard_start_xmit = hdd_hard_start_xmit;
+#endif
+
+   //Set the Connection State to Not Connected
+   pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
+
+   //Set the default operation channel
+   pHddStaCtx->conn_info.operationChannel = pHddCtx->cfg_ini->OperatingChannel;
+
+   /* Make the default Auth Type as OPEN*/
+   pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+   if( VOS_STATUS_SUCCESS != ( status = hdd_init_tx_rx( pAdapter ) ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+            "hdd_init_tx_rx() failed with status code %08d [x%08lx]",
+                            status, status );
+      goto error_init_txrx;
+   }
+
+   set_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
+
+   if( VOS_STATUS_SUCCESS != ( status = hdd_wmm_adapter_init( pAdapter ) ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+            "hdd_wmm_adapter_init() failed with status code %08d [x%08lx]",
+                            status, status );
+      goto error_wmm_init;
+   }
+
+   set_bit(WMM_INIT_DONE, &pAdapter->event_flags);
+
+   return VOS_STATUS_SUCCESS;
+
+error_wmm_init:
+   clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
+   hdd_deinit_tx_rx(pAdapter);
+error_init_txrx:
+   hdd_UnregisterWext(pWlanDev);
+error_register_wext:
+   if(test_bit(SME_SESSION_OPENED, &pAdapter->event_flags))
+   {
+      INIT_COMPLETION(pAdapter->session_close_comp_var);
+      if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
+                                    pAdapter->sessionId,
+                                    hdd_smeCloseSessionCallback, pAdapter ) )
+      {
+         //Block on a completion variable. Can't wait forever though.
+         wait_for_completion_interruptible_timeout(
+                          &pAdapter->session_close_comp_var,
+                           msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+      }
+}
+error_sme_open:
+   return status;
+}
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ * hdd_init_p2p_device_mode
+ *
+ *FUNCTION:
+ * This function is called from hdd_wlan_startup function when wlan 
+ * driver module is loaded. 
+ *
+ *LOGIC:
+ * Open New SME session with P2P Device Mac Address which is different 
+ * from STA Mac Address SME session. When driver receive any frame on STA Mac 
+ * Address then we divert all the frame using P2P Device Mac Address instaed of 
+ * STA Mac address. 
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param  pAdapter   Pointer to pAdapter structure
+ *
+ * @return None
+ */
+VOS_STATUS hdd_init_p2p_device_mode( hdd_adapter_t *pAdapter)
+{
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   int rc = 0;
+
+   INIT_COMPLETION(pAdapter->session_open_comp_var);
+   //Open a SME session for future operation
+   halStatus = sme_OpenSession( pHddCtx->hHal, hdd_smeRoamCallback, pAdapter,
+               (tANI_U8 *)&pHddCtx->p2pDeviceAddress, &pAdapter->p2pSessionId);
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+             "sme_OpenSession() failed with status code %08d [x%08lx]",
+                                                 halStatus, halStatus );
+      status = VOS_STATUS_E_FAILURE;
+      return status;
+   }
+   
+   //Block on a completion variable. Can't wait forever though.
+   rc = wait_for_completion_interruptible_timeout(
+                        &pAdapter->session_open_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+   if (!rc)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+             "Session is not opened within timeout period code %08d", rc );
+      status = VOS_STATUS_E_FAILURE;
+      return status;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+#endif
+
+#ifdef CONFIG_CFG80211
+void hdd_cleanup_actionframe( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
+{
+   hdd_cfg80211_state_t *cfgState;
+
+   cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+
+   if( NULL != cfgState->buf )
+   {
+      int rc;
+      INIT_COMPLETION(pAdapter->tx_action_cnf_event);
+      rc = wait_for_completion_interruptible_timeout(
+                     &pAdapter->tx_action_cnf_event,
+                     msecs_to_jiffies(ACTION_FRAME_TX_TIMEOUT));
+      if(!rc)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+              ("ERROR: HDD Wait for Action Confirmation Failed!!\n"));
+      }
+   }
+   return;
+}
+#endif
+
+void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
+{
+   ENTER();
+   switch ( pAdapter->device_mode )
+   {
+      case WLAN_HDD_INFRA_STATION:
+      case WLAN_HDD_P2P_CLIENT:
+      {
+         if(test_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags))
+         {
+            hdd_deinit_tx_rx( pAdapter );
+            clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
+         }
+
+         if(test_bit(WMM_INIT_DONE, &pAdapter->event_flags))
+         {
+            hdd_wmm_adapter_close( pAdapter );
+            clear_bit(WMM_INIT_DONE, &pAdapter->event_flags);
+         }
+
+#ifdef CONFIG_CFG80211
+         hdd_cleanup_actionframe(pHddCtx, pAdapter);
+#endif
+
+         break;
+      }
+
+      case WLAN_HDD_SOFTAP:
+      case WLAN_HDD_P2P_GO:
+#ifdef WLAN_SOFTAP_FEATURE
+      {
+#ifdef CONFIG_CFG80211
+         hdd_cleanup_actionframe(pHddCtx, pAdapter);
+#endif
+
+         hdd_unregister_hostapd(pAdapter);
+         hdd_set_conparam( 0 );
+#ifdef CONFIG_CFG80211
+         wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), NULL );
+#endif
+         break;
+      }
+
+      case WLAN_HDD_MONITOR:
+      {
+#ifdef CONFIG_CFG80211
+          hdd_adapter_t* pAdapterforTx = pAdapter->sessionCtx.monitor.pAdapterForTx;
+#endif
+         if(test_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags))
+         {
+            hdd_deinit_tx_rx( pAdapter );
+            clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
+         }
+#ifdef CONFIG_CFG80211
+         if(NULL != pAdapterforTx)
+         {
+            hdd_cleanup_actionframe(pHddCtx, pAdapterforTx);
+         }
+#endif
+#endif //WLAN_SOFTAP_FEATURE
+         break;
+      }
+
+
+      default:
+      break;
+   }
+
+   EXIT();
+}
+
+void hdd_cleanup_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_U8 rtnl_held )
+{
+   struct net_device *pWlanDev = pAdapter->dev;
+
+   if(test_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags)) {
+      if( rtnl_held )
+      {
+         unregister_netdevice(pWlanDev);
+      }
+      else
+      {
+         unregister_netdev(pWlanDev);
+      }
+      // note that the pAdapter is no longer valid at this point
+      // since the memory has been reclaimed
+   }
+
+}
+
+VOS_STATUS hdd_enable_bmps_imps(hdd_context_t *pHddCtx)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   if(pHddCtx->cfg_ini->fIsBmpsEnabled)
+   {
+      sme_EnablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   }
+
+   if(pHddCtx->cfg_ini->fIsAutoBmpsTimerEnabled)
+   {
+      sme_StartAutoBmpsTimer(pHddCtx->hHal); 
+   }
+
+   if (pHddCtx->cfg_ini->fIsImpsEnabled)
+   {
+      sme_EnablePowerSave (pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   }
+
+   return status;
+}
+
+VOS_STATUS hdd_disable_bmps_imps(hdd_context_t *pHddCtx, tANI_U8 session_type)
+{
+   hdd_adapter_t *pAdapter = NULL;
+   eHalStatus halStatus;
+   VOS_STATUS status = VOS_STATUS_E_INVAL;
+   v_BOOL_t disableBmps = FALSE;
+   v_BOOL_t disableImps = FALSE;
+   
+   switch(session_type)
+   {
+       case WLAN_HDD_INFRA_STATION:
+       case WLAN_HDD_SOFTAP:
+#ifdef WLAN_FEATURE_P2P
+       case WLAN_HDD_P2P_CLIENT:
+       case WLAN_HDD_P2P_GO:
+#endif
+          //Exit BMPS -> Is Sta/P2P Client is already connected
+          pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
+          if((NULL != pAdapter)&&
+              hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)))
+          {
+             disableBmps = TRUE;
+          }
+
+          pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT);
+          if((NULL != pAdapter)&&
+              hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)))
+          {
+             disableBmps = TRUE;
+          }
+
+          //Exit both Bmps and Imps incase of Go/SAP Mode
+          if((WLAN_HDD_SOFTAP == session_type) ||
+              (WLAN_HDD_P2P_GO == session_type))
+          {
+             disableBmps = TRUE;
+             disableImps = TRUE;
+          }
+
+          if(TRUE == disableImps)
+          {
+             if (pHddCtx->cfg_ini->fIsImpsEnabled)
+             {
+                sme_DisablePowerSave (pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+             }
+          }
+
+          if(TRUE == disableBmps)
+          {
+             if(pHddCtx->cfg_ini->fIsBmpsEnabled)
+             {
+                 halStatus = sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+
+                 if(eHAL_STATUS_SUCCESS != halStatus)
+                 {
+                    status = VOS_STATUS_E_FAILURE;
+                    hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Fail to Disable Power Save\n", __func__);
+                    VOS_ASSERT(0);
+                    return status;
+                 }
+              }
+
+              if(pHddCtx->cfg_ini->fIsAutoBmpsTimerEnabled)
+              {
+                 halStatus = sme_StopAutoBmpsTimer(pHddCtx->hHal);
+
+                 if(eHAL_STATUS_SUCCESS != halStatus)
+                 {
+                    status = VOS_STATUS_E_FAILURE;
+                    hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Fail to Stop Auto Bmps Timer\n", __func__);
+                    VOS_ASSERT(0);
+                    return status;
+                 }
+              }
+          }
+
+          if((TRUE == disableBmps) ||
+              (TRUE == disableImps))
+          {
+              /* Now, get the chip into Full Power now */
+              INIT_COMPLETION(pHddCtx->full_pwr_comp_var);
+              halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_full_pwr_cbk,
+                                   pHddCtx, eSME_FULL_PWR_NEEDED_BY_HDD);
+
+              if(halStatus != eHAL_STATUS_SUCCESS)
+              {
+                 if(halStatus == eHAL_STATUS_PMC_PENDING)
+                 {
+                    //Block on a completion variable. Can't wait forever though
+                    wait_for_completion_interruptible_timeout(
+                         &pHddCtx->full_pwr_comp_var, msecs_to_jiffies(1000));
+                 }
+                 else
+                 {
+                    status = VOS_STATUS_E_FAILURE;
+                    hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Request for Full Power failed\n", __func__);
+                    VOS_ASSERT(0);
+                    return status;
+                 }
+              }
+
+              status = VOS_STATUS_SUCCESS;
+          }
+
+          break;
+   }
+   return status;
+}
+
+hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
+                                 char *iface_name, tSirMacAddr macAddr, 
+                                 tANI_U8 rtnl_held )
+{
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_adapter_list_node_t *pHddAdapterNode = NULL;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   VOS_STATUS exitbmpsStatus;
+
+   hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s iface =%s type = %d\n",__func__,iface_name,session_type);
+
+   //Disable BMPS incase of Concurrency
+   exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, session_type);
+
+   if(VOS_STATUS_E_FAILURE == exitbmpsStatus)
+   {
+      //Fail to Exit BMPS
+      VOS_ASSERT(0);
+      return NULL;
+   }
+
+   switch(session_type)
+   {
+      case WLAN_HDD_INFRA_STATION:
+#ifdef WLAN_FEATURE_P2P
+      case WLAN_HDD_P2P_CLIENT:
+#endif
+      {
+         pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
+
+         if( NULL == pAdapter )
+            return NULL;
+
+#ifdef CONFIG_CFG80211
+         pAdapter->wdev.iftype = (session_type == WLAN_HDD_INFRA_STATION) ?
+                                  NL80211_IFTYPE_STATION :
+                                  NL80211_IFTYPE_P2P_CLIENT;
+#endif
+
+
+         pAdapter->device_mode = session_type;
+
+         status = hdd_init_station_mode( pAdapter );
+         if( VOS_STATUS_SUCCESS != status )
+            goto err_free_netdev;
+
+         status = hdd_register_interface( pAdapter, rtnl_held );
+         if( VOS_STATUS_SUCCESS != status )
+         {
+            hdd_deinit_adapter(pHddCtx, pAdapter);
+            goto err_free_netdev;
+         }
+         //Stop the Interface TX queue.
+         netif_tx_disable(pAdapter->dev);
+         //netif_tx_disable(pWlanDev);
+         netif_carrier_off(pAdapter->dev);
+
+         break;
+      }
+
+#ifdef WLAN_FEATURE_P2P
+      case WLAN_HDD_P2P_GO:
+#endif
+      case WLAN_HDD_SOFTAP:
+      {
+         pAdapter = hdd_wlan_create_ap_dev( pHddCtx, macAddr, (tANI_U8 *)iface_name );
+         if( NULL == pAdapter )
+            return NULL;
+
+#ifdef CONFIG_CFG80211
+         pAdapter->wdev.iftype = (session_type == WLAN_HDD_SOFTAP) ?
+                                  NL80211_IFTYPE_AP:
+                                  NL80211_IFTYPE_P2P_GO;
+#endif
+         pAdapter->device_mode = session_type;
+
+         status = hdd_init_ap_mode(pAdapter);
+         if( VOS_STATUS_SUCCESS != status )
+            goto err_free_netdev;
+
+         status = hdd_register_hostapd( pAdapter, rtnl_held );
+         if( VOS_STATUS_SUCCESS != status )
+         {
+            hdd_deinit_adapter(pHddCtx, pAdapter);
+            goto err_free_netdev;
+         }
+
+         netif_tx_disable(pAdapter->dev);
+         netif_carrier_off(pAdapter->dev);
+
+         hdd_set_conparam( 1 );
+         break;
+      }
+      case WLAN_HDD_MONITOR:
+      {
+#ifdef CONFIG_CFG80211   
+         pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
+         if( NULL == pAdapter )
+            return NULL;
+
+         pAdapter->wdev.iftype = NL80211_IFTYPE_MONITOR; 
+         pAdapter->device_mode = session_type;
+         status = hdd_register_interface( pAdapter, rtnl_held );
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
+         pAdapter->dev->netdev_ops = &wlan_mon_drv_ops;
+#else
+         pAdapter->dev->open = hdd_mon_open;
+         pAdapter->dev->hard_start_xmit = hdd_mon_hard_start_xmit;
+#endif
+         hdd_init_tx_rx( pAdapter );
+         set_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
+         //Set adapter to be used for data tx. It will use either GO or softap.
+         pAdapter->sessionCtx.monitor.pAdapterForTx = 
+                           hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_SOFTAP);
+#ifdef WLAN_FEATURE_P2P
+         if (NULL == pAdapter->sessionCtx.monitor.pAdapterForTx)
+         {
+            pAdapter->sessionCtx.monitor.pAdapterForTx = 
+                           hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_GO);
+         }
+#endif
+         /* This workqueue will be used to transmit management packet over
+          * monitor interface. */
+         INIT_WORK(&pAdapter->sessionCtx.monitor.pAdapterForTx->monTxWorkQueue,
+                   hdd_mon_tx_work_queue);
+#endif
+      }
+         break;
+#ifdef ANI_MANF_DIAG
+      case WLAN_HDD_FTM:
+      {
+         pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
+
+         if( NULL == pAdapter )
+            return NULL;
+         /* Assign NL80211_IFTYPE_STATION as interface type to resolve Kernel Warning
+          * message while loading driver in FTM mode. */
+         pAdapter->wdev.iftype = NL80211_IFTYPE_STATION;
+         pAdapter->device_mode = session_type;
+         status = hdd_register_interface( pAdapter, rtnl_held );
+      }
+         break;
+#endif
+      default:
+      {
+         VOS_ASSERT(0);
+         return NULL;
+      }
+   }
+
+
+   if( VOS_STATUS_SUCCESS == status )
+   {
+      //Add it to the hdd's session list. 
+      pHddAdapterNode = vos_mem_malloc( sizeof( hdd_adapter_list_node_t ) );
+      if( NULL == pHddAdapterNode )
+      {
+         status = VOS_STATUS_E_NOMEM;
+      }
+      else
+      {
+         pHddAdapterNode->pAdapter = pAdapter;
+         status = hdd_add_adapter_back ( pHddCtx, 
+                                         pHddAdapterNode );
+      }
+   }
+
+   if( VOS_STATUS_SUCCESS != status )
+   {
+      if( NULL != pAdapter )
+      {
+         hdd_cleanup_adapter( pHddCtx, pAdapter, rtnl_held );
+         pAdapter = NULL;   
+      }
+      if( NULL != pHddAdapterNode )
+      {
+         vos_mem_free( pHddAdapterNode );
+      }
+
+      goto resume_bmps;
+   }
+
+   if(VOS_STATUS_SUCCESS == status)
+   {
+      wlan_hdd_set_concurrency_mode(pHddCtx, session_type);
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+      /* If there are concurrent session enable SW frame translation 
+            * for all registered STA
+            * This is not required in case of PRIMA as HW frame translation
+            * is disabled in PRIMA*/ 
+      if (vos_concurrent_sessions_running())
+      {
+         WLANTL_ConfigureSwFrameTXXlationForAll(pHddCtx->pvosContext, TRUE);
+      }
+#endif
+   }
+
+   return pAdapter;
+
+err_free_netdev:
+   free_netdev(pAdapter->dev);
+   wlan_hdd_release_intf_addr( pHddCtx,
+                               pAdapter->macAddressCurrent.bytes );
+
+resume_bmps:
+   //If bmps disabled enable it
+   if(VOS_STATUS_SUCCESS == exitbmpsStatus)
+   {
+      hdd_enable_bmps_imps(pHddCtx);
+   }
+   return NULL;
+}
+
+VOS_STATUS hdd_close_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
+                              tANI_U8 rtnl_held )
+{
+   hdd_adapter_list_node_t *pAdapterNode, *pCurrent, *pNext;
+   VOS_STATUS status;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pCurrent );
+   if( VOS_STATUS_SUCCESS != status )
+      return status;
+
+   while ( pCurrent->pAdapter != pAdapter )
+   {
+      status = hdd_get_next_adapter ( pHddCtx, pCurrent, &pNext );
+      if( VOS_STATUS_SUCCESS != status )
+         break;
+
+      pCurrent = pNext;
+   }
+   pAdapterNode = pCurrent;
+   if( VOS_STATUS_SUCCESS == status )
+   {
+      wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode);
+      hdd_cleanup_adapter( pHddCtx, pAdapterNode->pAdapter, rtnl_held );
+      hdd_remove_adapter( pHddCtx, pAdapterNode );
+      vos_mem_free( pAdapterNode );
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+      /* If there is no concurrent session disable SW frame translation 
+       * for all registered STA */ 
+      /* This is not required in case of PRIMA as HW frame translation
+       * is disabled in PRIMA*/
+      if (!vos_concurrent_sessions_running())
+      {
+         WLANTL_ConfigureSwFrameTXXlationForAll(pHddCtx->pvosContext, FALSE);
+      }
+#endif
+
+      /* If there is a single session of STA/P2P client, re-enable BMPS */
+      if ((!vos_concurrent_sessions_running()) && 
+           ((pHddCtx->no_of_sessions[VOS_STA_MODE] >= 1) || 
+           (pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE] >= 1)))
+      {
+         hdd_enable_bmps_imps(pHddCtx);
+      }
+
+      return VOS_STATUS_SUCCESS;
+   }
+
+   return VOS_STATUS_E_FAILURE;
+}
+
+VOS_STATUS hdd_close_all_adapters( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pHddAdapterNode;
+   VOS_STATUS status;
+
+   ENTER();
+
+   do
+   {
+      status = hdd_remove_front_adapter( pHddCtx, &pHddAdapterNode );
+      if( pHddAdapterNode && VOS_STATUS_SUCCESS == status )
+      {
+         hdd_cleanup_adapter( pHddCtx, pHddAdapterNode->pAdapter, FALSE );
+         vos_mem_free( pHddAdapterNode );
+      }
+   }while( NULL != pHddAdapterNode && VOS_STATUS_E_EMPTY != status );
+   
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter)
+{
+    v_U8_t addIE[1] = {0};
+
+    if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA1,(tANI_U8*)addIE, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+    {
+        hddLog(LOGE,
+           "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM\n");
+    }
+
+    if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+    {
+        hddLog(LOGE,
+           "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM\n");
+    }
+
+    if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
+                            WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL,
+                            eANI_BOOLEAN_FALSE) )
+    {
+        hddLog(LOGE,
+           "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM\n");
+    }
+}
+
+VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
+{
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   union iwreq_data wrqu;
+
+   ENTER();
+
+   switch(pAdapter->device_mode)
+   {
+      case WLAN_HDD_INFRA_STATION:
+      case WLAN_HDD_P2P_CLIENT:
+         if( hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR( pAdapter )) )
+         {
+            if (pWextState->roamProfile.BSSType == eCSR_BSS_TYPE_START_IBSS)
+                halStatus = sme_RoamDisconnect(pHddCtx->hHal,
+                                             pAdapter->sessionId,
+                                             eCSR_DISCONNECT_REASON_IBSS_LEAVE);
+            else
+                halStatus = sme_RoamDisconnect(pHddCtx->hHal,
+                                            pAdapter->sessionId, 
+                                            eCSR_DISCONNECT_REASON_UNSPECIFIED);
+            //success implies disconnect command got queued up successfully
+            if(halStatus == eHAL_STATUS_SUCCESS)
+            {
+               wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+               msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+            }
+            memset(&wrqu, '\0', sizeof(wrqu));
+            wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+            memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
+            wireless_send_event(pAdapter->dev, SIOCGIWAP, &wrqu, NULL);
+         }
+         else
+         {
+            hdd_abort_mac_scan(pHddCtx);
+         }
+
+         if (test_bit(SME_SESSION_OPENED, &pAdapter->event_flags)) 
+         {
+            INIT_COMPLETION(pAdapter->session_close_comp_var);
+            if (eHAL_STATUS_SUCCESS ==
+                sme_CloseSession(pHddCtx->hHal, pAdapter->sessionId, 
+                                 hdd_smeCloseSessionCallback, pAdapter))
+            {
+               //Block on a completion variable. Can't wait forever though.
+               wait_for_completion_interruptible_timeout(
+                          &pAdapter->session_close_comp_var, 
+                          msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+            }
+         }
+
+         break;
+
+      case WLAN_HDD_SOFTAP:
+      case WLAN_HDD_P2P_GO:
+         //Any softap specific cleanup here...
+         mutex_lock(&pHddCtx->sap_lock);
+         if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) 
+         {
+            VOS_STATUS status;
+            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+            //Stop Bss.
+            status = WLANSAP_StopBss(pHddCtx->pvosContext);
+            if (VOS_IS_STATUS_SUCCESS(status))
+            {
+               hdd_hostapd_state_t *pHostapdState = 
+                  WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
+
+               status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
+   
+               if (!VOS_IS_STATUS_SUCCESS(status))
+               {
+                  hddLog(LOGE, "%s: failure waiting for WLANSAP_StopBss",
+                         __FUNCTION__);
+               }
+            }
+            else
+            {
+               hddLog(LOGE, "%s: failure in WLANSAP_StopBss", __FUNCTION__);
+            }
+            clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags);
+
+            if (eHAL_STATUS_FAILURE ==
+                ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG,
+                             0, NULL, eANI_BOOLEAN_FALSE))
+            {
+               hddLog(LOGE,
+                      "%s: Failed to set WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG",
+                      __FUNCTION__);
+            }
+
+            if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
+                     WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL,
+                     eANI_BOOLEAN_FALSE) )
+            {
+               hddLog(LOGE,
+                     "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM");
+            }
+
+            // Reset WNI_CFG_PROBE_RSP Flags
+            wlan_hdd_reset_prob_rspies(pAdapter);
+            kfree(pAdapter->sessionCtx.ap.beacon);
+            pAdapter->sessionCtx.ap.beacon = NULL;
+         }
+         mutex_unlock(&pHddCtx->sap_lock);
+         break;
+      case WLAN_HDD_MONITOR:
+         break;
+      default:
+         break;
+   }
+
+   EXIT();
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_stop_all_adapters( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   hdd_adapter_t      *pAdapter;
+
+   ENTER();
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+      netif_tx_disable(pAdapter->dev);
+      netif_carrier_off(pAdapter->dev);
+
+      hdd_stop_adapter( pHddCtx, pAdapter );
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_reset_all_adapters( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   hdd_adapter_t *pAdapter;
+
+   ENTER();
+
+   status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+      netif_tx_disable(pAdapter->dev);
+      netif_carrier_off(pAdapter->dev);
+
+      //Record whether STA is associated
+      pAdapter->sessionCtx.station.bSendDisconnect = 
+            hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR( pAdapter )) ?
+                                                       VOS_TRUE : VOS_FALSE;
+
+      hdd_deinit_tx_rx(pAdapter);
+      hdd_wmm_adapter_close(pAdapter);
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   hdd_adapter_t      *pAdapter;
+   v_MACADDR_t  bcastMac = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
+
+   ENTER();
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      switch(pAdapter->device_mode)
+      {
+         case WLAN_HDD_INFRA_STATION:
+         case WLAN_HDD_P2P_CLIENT:
+            hdd_init_station_mode(pAdapter);
+            /* Open the gates for HDD to receive Wext commands */
+            pAdapter->isLinkUpSvcNeeded = FALSE; 
+            pAdapter->scan_info.mScanPending = FALSE;
+            pAdapter->scan_info.waitScanResult = FALSE;
+
+            //Trigger the initial scan
+            hdd_wlan_initial_scan(pAdapter);
+
+            //Indicate disconnect event to supplicant if associated previously
+            if(pAdapter->sessionCtx.station.bSendDisconnect)
+            {
+               union iwreq_data wrqu;
+               memset(&wrqu, '\0', sizeof(wrqu));
+               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+               memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
+               wireless_send_event(pAdapter->dev, SIOCGIWAP, &wrqu, NULL);
+               pAdapter->sessionCtx.station.bSendDisconnect = VOS_FALSE;
+
+#ifdef CONFIG_CFG80211
+               /* indicate disconnected event to nl80211 */
+               cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED,
+                                     NULL, 0, GFP_KERNEL); 
+#endif
+            }
+            break;
+
+         case WLAN_HDD_SOFTAP:
+            /* softAP can handle SSR */
+            break;
+
+         case WLAN_HDD_P2P_GO:
+#ifdef CONFIG_CFG80211
+              hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant",
+                                                       __func__);
+              /* event supplicant to restart */
+              cfg80211_del_sta(pAdapter->dev,
+                        (const u8 *)&bcastMac.bytes[0], GFP_KERNEL);
+#endif
+            break;
+
+         case WLAN_HDD_MONITOR:
+            /* monitor interface start */
+            break;
+         default:
+            break;
+      }
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t *pAdapter;
+   VOS_STATUS status;
+   v_U32_t roamId;
+
+   ENTER();
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+             (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) )
+      {
+         hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+         hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+         pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
+         init_completion(&pAdapter->disconnect_comp_var);
+         sme_RoamDisconnect(pHddCtx->hHal, pAdapter->sessionId,
+                             eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+         wait_for_completion_interruptible_timeout(
+                                &pAdapter->disconnect_comp_var,
+                                msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+
+         pWextState->roamProfile.csrPersona = pAdapter->device_mode; 
+         pHddCtx->isAmpAllowed = VOS_FALSE;
+         sme_RoamConnect(pHddCtx->hHal,
+                         pAdapter->sessionId, &(pWextState->roamProfile),
+                         &roamId); 
+      }
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   EXIT();
+
+   return VOS_STATUS_SUCCESS;
+}
+
+v_U8_t hdd_is_ssr_required( void)
+{
+    return isSsrRequired;
+}
+
+void hdd_set_ssr_required( v_U8_t value)
+{
+    isSsrRequired = value;
+}
+
+VOS_STATUS hdd_get_front_adapter( hdd_context_t *pHddCtx,
+                                  hdd_adapter_list_node_t** ppAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status =  hdd_list_peek_front ( &pHddCtx->hddAdapters,
+                   (hdd_list_node_t**) ppAdapterNode );
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+VOS_STATUS hdd_get_next_adapter( hdd_context_t *pHddCtx,
+                                 hdd_adapter_list_node_t* pAdapterNode,
+                                 hdd_adapter_list_node_t** pNextAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status = hdd_list_peek_next ( &pHddCtx->hddAdapters,
+                                  (hdd_list_node_t*) pAdapterNode,
+                                  (hdd_list_node_t**)pNextAdapterNode );
+
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+VOS_STATUS hdd_remove_adapter( hdd_context_t *pHddCtx,
+                               hdd_adapter_list_node_t* pAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status =  hdd_list_remove_node ( &pHddCtx->hddAdapters,
+                                     &pAdapterNode->node );
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+VOS_STATUS hdd_remove_front_adapter( hdd_context_t *pHddCtx,
+                                     hdd_adapter_list_node_t** ppAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status =  hdd_list_remove_front( &pHddCtx->hddAdapters,
+                   (hdd_list_node_t**) ppAdapterNode );
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+VOS_STATUS hdd_add_adapter_back( hdd_context_t *pHddCtx,
+                                 hdd_adapter_list_node_t* pAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status =  hdd_list_insert_back ( &pHddCtx->hddAdapters,
+                   (hdd_list_node_t*) pAdapterNode );
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+VOS_STATUS hdd_add_adapter_front( hdd_context_t *pHddCtx,
+                                  hdd_adapter_list_node_t* pAdapterNode)
+{
+    VOS_STATUS status;
+    spin_lock(&pHddCtx->hddAdapters.lock);
+    status =  hdd_list_insert_front ( &pHddCtx->hddAdapters,
+                   (hdd_list_node_t*) pAdapterNode );
+    spin_unlock(&pHddCtx->hddAdapters.lock);
+    return status;
+}
+
+hdd_adapter_t * hdd_get_adapter_by_macaddr( hdd_context_t *pHddCtx,
+                                            tSirMacAddr macAddr )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t *pAdapter;
+   VOS_STATUS status;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( pAdapter && vos_mem_compare( pAdapter->macAddressCurrent.bytes,
+                                       macAddr, sizeof(tSirMacAddr) ) )
+      {
+         return pAdapter;
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   return NULL;
+
+} 
+
+hdd_adapter_t * hdd_get_adapter_by_name( hdd_context_t *pHddCtx, tANI_U8 *name )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t *pAdapter;
+   VOS_STATUS status;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( pAdapter && !strncmp( pAdapter->dev->name, (const char *)name,
+          IFNAMSIZ ) )
+      {
+         return pAdapter;
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   return NULL;
+
+} 
+
+hdd_adapter_t * hdd_get_adapter( hdd_context_t *pHddCtx, device_mode_t mode )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t *pAdapter;
+   VOS_STATUS status;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( pAdapter && (mode == pAdapter->device_mode) )
+      {
+         return pAdapter;
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   return NULL;
+
+} 
+
+//Remove this function later
+hdd_adapter_t * hdd_get_mon_adapter( hdd_context_t *pHddCtx )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t *pAdapter;
+   VOS_STATUS status;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( pAdapter && WLAN_HDD_MONITOR == pAdapter->device_mode )
+      {
+         return pAdapter;
+      }
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+
+   return NULL;
+
+} 
+
+#ifdef CONFIG_CFG80211
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_set_monitor_tx_adapter() - 
+
+   This API initializes the adapter to be used while transmitting on monitor
+   adapter. 
+   
+  \param  - pHddCtx - Pointer to the HDD context.
+            pAdapter - Adapter that will used for TX. This can be NULL.
+  \return - None. 
+  --------------------------------------------------------------------------*/
+void wlan_hdd_set_monitor_tx_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
+{
+   hdd_adapter_t *pMonAdapter;
+
+   pMonAdapter = hdd_get_adapter( pHddCtx, WLAN_HDD_MONITOR );
+
+   if( NULL != pMonAdapter )
+   {
+      pMonAdapter->sessionCtx.monitor.pAdapterForTx = pAdapter;
+   }
+}
+#endif
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_select_queue() - 
+
+   This API returns the operating channel of the requested device mode 
+   
+  \param  - pHddCtx - Pointer to the HDD context.
+              - mode - Device mode for which operating channel is required
+                suported modes - WLAN_HDD_INFRA_STATION, WLAN_HDD_P2P_CLIENT
+                                 WLAN_HDD_SOFTAP, WLAN_HDD_P2P_GO.
+  \return - channel number. "0" id the requested device is not found OR it is not connected. 
+  --------------------------------------------------------------------------*/
+v_U8_t hdd_get_operating_channel( hdd_context_t *pHddCtx, device_mode_t mode )
+{
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   VOS_STATUS status;
+   hdd_adapter_t      *pAdapter;
+   v_U8_t operatingChannel = 0;
+
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+   {
+      pAdapter = pAdapterNode->pAdapter;
+
+      if( mode == pAdapter->device_mode )
+      {
+        switch(pAdapter->device_mode)
+        {
+          case WLAN_HDD_INFRA_STATION:
+          case WLAN_HDD_P2P_CLIENT: 
+            if( hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR( pAdapter )) )
+              operatingChannel = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.operationChannel;
+            break;
+          case WLAN_HDD_SOFTAP:
+          case WLAN_HDD_P2P_GO:
+            /*softap connection info */
+            if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) 
+              operatingChannel = (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->operatingChannel;
+            break;
+          default:
+            break;
+        }
+
+        break; //Found the device of interest. break the loop
+      }
+
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   }
+   return operatingChannel;
+}
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/**---------------------------------------------------------------------------
+
+  \brief hdd_set_multicast_list() - 
+
+  This used to set the multicast address list.
+
+  \param  - dev - Pointer to the WLAN device.
+  - skb - Pointer to OS packet (sk_buff).
+  \return - success/fail 
+
+  --------------------------------------------------------------------------*/
+static void hdd_set_multicast_list(struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_context_t *pHddCtx;
+   int mc_count;
+   int i = 0;
+   struct netdev_hw_addr *ha;
+   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+   if (NULL == pHddCtx)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+            "%s: HDD context is Null", __FUNCTION__);
+      return;
+   }
+
+   if (dev->flags & IFF_ALLMULTI)
+   {
+      hddLog(VOS_TRACE_LEVEL_INFO,
+            "%s: allow all multicast frames", __FUNCTION__);
+      pHddCtx->mc_addr_list.mc_cnt = 0;
+   }
+   else 
+   {
+      mc_count = netdev_mc_count(dev);
+      hddLog(VOS_TRACE_LEVEL_INFO,
+            "%s: mc_count = %u", __FUNCTION__, mc_count);
+      if (mc_count > WLAN_HDD_MAX_MC_ADDR_LIST)
+      {
+         hddLog(VOS_TRACE_LEVEL_INFO,
+               "%s: No free filter available; allow all multicast frames", __FUNCTION__);
+         pHddCtx->mc_addr_list.mc_cnt = 0;
+         return;
+      }
+
+      pHddCtx->mc_addr_list.mc_cnt = mc_count;
+
+      netdev_for_each_mc_addr(ha, dev) {
+         if (i == mc_count)
+            break;
+         memset(&(pHddCtx->mc_addr_list.addr[i][0]), 0, ETH_ALEN);
+         memcpy(&(pHddCtx->mc_addr_list.addr[i][0]), ha->addr, ETH_ALEN);
+         hddLog(VOS_TRACE_LEVEL_INFO, "\n%s: mlist[%d] = %02x:%02x:%02x:%02x:%02x:%02x", 
+               __func__, i, 
+               pHddCtx->mc_addr_list.addr[i][0], pHddCtx->mc_addr_list.addr[i][1], 
+               pHddCtx->mc_addr_list.addr[i][2], pHddCtx->mc_addr_list.addr[i][3], 
+               pHddCtx->mc_addr_list.addr[i][4], pHddCtx->mc_addr_list.addr[i][5]);
+         i++;
+      }
+   }
+   return;
+}
+#endif
+
+/**---------------------------------------------------------------------------
+  
+  \brief hdd_select_queue() - 
+
+   This function is registered with the Linux OS for network
+   core to decide which queue to use first.
+   
+  \param  - dev - Pointer to the WLAN device.
+              - skb - Pointer to OS packet (sk_buff).
+  \return - ac, Queue Index/access category corresponding to UP in IP header 
+  
+  --------------------------------------------------------------------------*/
+v_U16_t hdd_select_queue(struct net_device *dev,
+    struct sk_buff *skb)
+{
+   return hdd_wmm_select_queue(dev, skb);
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_wlan_initial_scan() -
+
+   This function triggers the initial scan
+
+  \param  - pAdapter - Pointer to the HDD adapter.
+
+  --------------------------------------------------------------------------*/
+void hdd_wlan_initial_scan(hdd_adapter_t *pAdapter)
+{
+   tCsrScanRequest scanReq;
+   tCsrChannelInfo channelInfo;
+   eHalStatus halStatus;
+   unsigned long scanId;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+   vos_mem_zero(&scanReq, sizeof(tCsrScanRequest));
+   vos_mem_set(&scanReq.bssid, sizeof(tCsrBssid), 0xff);
+   scanReq.BSSType = eCSR_BSS_TYPE_ANY;
+
+   if(sme_Is11dSupported(pHddCtx->hHal))
+   {
+      halStatus = sme_ScanGetBaseChannels( pHddCtx->hHal, &channelInfo );
+      if ( HAL_STATUS_SUCCESS( halStatus ) )
+      {
+         scanReq.ChannelInfo.ChannelList = vos_mem_malloc(channelInfo.numOfChannels);
+         if( !scanReq.ChannelInfo.ChannelList )
+         {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s kmalloc failed", __func__);
+            vos_mem_free(channelInfo.ChannelList);
+            return;
+         }
+         vos_mem_copy(scanReq.ChannelInfo.ChannelList, channelInfo.ChannelList,
+            channelInfo.numOfChannels);
+         scanReq.ChannelInfo.numOfChannels = channelInfo.numOfChannels;
+         vos_mem_free(channelInfo.ChannelList);
+      }
+
+      scanReq.scanType = eSIR_PASSIVE_SCAN;
+      scanReq.requestType = eCSR_SCAN_REQUEST_11D_SCAN;
+      scanReq.maxChnTime = pHddCtx->cfg_ini->nPassiveMaxChnTime;
+      scanReq.minChnTime = pHddCtx->cfg_ini->nPassiveMinChnTime;
+   }
+   else
+   {
+      scanReq.scanType = eSIR_ACTIVE_SCAN;
+      scanReq.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+      scanReq.maxChnTime = pHddCtx->cfg_ini->nActiveMaxChnTime;
+      scanReq.minChnTime = pHddCtx->cfg_ini->nActiveMinChnTime;
+   }
+
+   halStatus = sme_ScanRequest(pHddCtx->hHal, pAdapter->sessionId, &scanReq, &scanId, NULL, NULL);
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_ScanRequest failed status code %d",
+         __func__, halStatus );
+   }
+
+   if(sme_Is11dSupported(pHddCtx->hHal))
+        vos_mem_free(scanReq.ChannelInfo.ChannelList);
+}
+
+struct fullPowerContext
+{
+   struct completion completion;
+   unsigned int magic;
+};
+#define POWER_CONTEXT_MAGIC  0x504F5752   //POWR
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_full_power_callback() - HDD full power callback function
+
+  This is the function invoked by SME to inform the result of a full power
+  request issued by HDD
+
+  \param  - callbackcontext - Pointer to cookie
+  \param  - status - result of request
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+static void hdd_full_power_callback(void *callbackContext, eHalStatus status)
+{
+   struct fullPowerContext *pContext = callbackContext;
+
+   hddLog(VOS_TRACE_LEVEL_INFO,
+          "%s: context = %p, status = %d", pContext, status);
+
+   if (NULL == callbackContext)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Bad param, context [%p]",
+             __FUNCTION__, callbackContext);
+      return;
+   }
+
+   /* there is a race condition that exists between this callback function
+      and the caller since the caller could time out either before or
+      while this code is executing.  we'll assume the timeout hasn't
+      occurred, but we'll verify that right before we save our work */
+
+   if (POWER_CONTEXT_MAGIC != pContext->magic)
+   {
+      /* the caller presumably timed out so there is nothing we can do */
+      hddLog(VOS_TRACE_LEVEL_WARN,
+             "%s: Invalid context, magic [%08x]",
+              __FUNCTION__, pContext->magic);
+      return;
+   }
+
+   /* the race is on.  caller could have timed out immediately after
+      we verified the magic, but if so, caller will wait a short time
+      for us to notify the caller, so the context will stay valid */
+   complete(&pContext->completion);
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_wlan_exit() - HDD WLAN exit function
+
+  This is the driver exit point (invoked during rmmod)
+
+  \param  - pHddCtx - Pointer to the HDD Context
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+void hdd_wlan_exit(hdd_context_t *pHddCtx)
+{
+   eHalStatus halStatus;
+   v_CONTEXT_t pVosContext = pHddCtx->pvosContext;
+   VOS_STATUS vosStatus;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = NULL;
+#endif // ANI_BUS_TYPE_SDIO
+#ifdef CONFIG_CFG80211
+    struct wiphy *wiphy = pHddCtx->wiphy;
+#endif 
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   hdd_adapter_t* pAdapter;
+#endif
+   struct fullPowerContext powerContext;
+   long lrc;
+
+   ENTER();
+
+#ifdef CONFIG_CFG80211
+#ifdef WLAN_SOFTAP_FEATURE
+   if (VOS_STA_SAP_MODE != hdd_get_conparam())
+#endif
+   {
+#ifdef ANI_MANF_DIAG
+      if (VOS_FTM_MODE != hdd_get_conparam())
+#endif /* ANI_MANF_DIAG */
+      {
+         hdd_adapter_t* pAdapter = hdd_get_adapter(pHddCtx,
+                                      WLAN_HDD_INFRA_STATION);
+         if (pAdapter == NULL)
+            pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT);
+
+         if (pAdapter != NULL)
+         {
+            wlan_hdd_cfg80211_pre_voss_stop(pAdapter);
+            hdd_UnregisterWext(pAdapter->dev);
+         }
+      }
+   }
+#endif
+
+#ifdef ANI_MANF_DIAG
+   if (VOS_FTM_MODE == hdd_get_conparam())
+  {
+    wlan_hdd_ftm_close(pHddCtx);
+    goto free_hdd_ctx;
+  }
+#endif  
+   //Stop the Interface TX queue.
+   //netif_tx_disable(pWlanDev);
+   //netif_carrier_off(pWlanDev);
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   // unregister suspend/resume callbacks
+   if(pHddCtx->cfg_ini->nEnableSuspend)
+   {
+      unregister_wlan_suspend();
+   }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#ifdef WLAN_SOFTAP_FEATURE
+   if (VOS_STA_SAP_MODE == hdd_get_conparam())
+   {
+      pAdapter = hdd_get_adapter(pHddCtx,
+                                   WLAN_HDD_SOFTAP);
+   }
+   else
+   {
+#endif
+#ifdef ANI_MANF_DIAG
+      if (VOS_FTM_MODE != hdd_get_conparam())
+#endif /* ANI_MANF_DIAG */
+      {
+         pAdapter = hdd_get_adapter(pHddCtx,
+                                    WLAN_HDD_INFRA_STATION);
+      }
+#ifdef WLAN_SOFTAP_FEATURE
+   }
+#endif
+   /* DeRegister with platform driver as client for Suspend/Resume */
+   vosStatus = hddDeregisterPmOps(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDeregisterPmOps failed",__func__);
+      VOS_ASSERT(0);
+   }
+
+   vosStatus = hddDevTmUnregisterNotifyCallback(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDevTmUnregisterNotifyCallback failed",__func__);
+   }
+#endif //FEATURE_WLAN_INTEGRATED_SOC
+
+   // Cancel any outstanding scan requests.  We are about to close all
+   // of our adapters, but an adapter structure is what SME passes back
+   // to our callback function.  Hence if there are any outstanding scan
+   // requests then there is a race condition between when the adapter
+   // is closed and when the callback is invoked.  We try to resolve that
+   // race condition here by canceling any outstanding scans before we
+   // close the adapters.
+   // Note that the scans may be cancelled in an asynchronous manner, so
+   // ideally there needs to be some kind of synchronization.  Rather than
+   // introduce a new synchronization here, we will utilize the fact that
+   // we are about to Request Full Power, and since that is synchronized,
+   // the expectation is that by the time Request Full Power has completed,
+   // all scans will be cancelled.
+   hdd_abort_mac_scan( pHddCtx );
+
+   //Disable IMPS/BMPS as we do not want the device to enter any power
+   //save mode during shutdown
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE);
+   sme_DisablePowerSave(pHddCtx->hHal, ePMC_UAPSD_MODE_POWER_SAVE);
+
+   //Ensure that device is in full power as we will touch H/W during vos_Stop
+   init_completion(&powerContext.completion);
+   powerContext.magic = POWER_CONTEXT_MAGIC;
+
+   halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_full_power_callback,
+                                    &powerContext, eSME_FULL_PWR_NEEDED_BY_HDD);
+
+   if (eHAL_STATUS_SUCCESS != halStatus)
+   {
+      if (eHAL_STATUS_PMC_PENDING == halStatus)
+      {
+         /* request was sent -- wait for the response */
+         lrc = wait_for_completion_interruptible_timeout(
+                                      &powerContext.completion,
+                                      msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
+         /* either we have a response or we timed out
+            either way, first invalidate our magic */
+         powerContext.magic = 0;
+         if (lrc <= 0)
+         {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s while requesting full power",
+                   __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+            /* there is a race condition such that the callback
+               function could be executing at the same time we are. of
+               primary concern is if the callback function had already
+               verified the "magic" but hasn't yet set the completion
+               variable.  Since the completion variable is on our
+               stack, we'll delay just a bit to make sure the data is
+               still valid if that is the case */
+            msleep(50);
+         }
+      }
+      else
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: Request for Full Power failed, status %d",
+                __FUNCTION__, halStatus);
+         VOS_ASSERT(0);
+         /* continue -- need to clean up as much as possible */
+      }
+   }
+
+   // Unregister the Net Device Notifier
+   unregister_netdevice_notifier(&hdd_netdev_notifier);
+   
+#ifdef WLAN_FEATURE_P2P
+   if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+   {
+       hdd_adapter_t* pAdapter = hdd_get_adapter(pHddCtx,
+                                    WLAN_HDD_INFRA_STATION);
+       if (pAdapter != NULL)
+       {
+          INIT_COMPLETION(pAdapter->session_close_comp_var);
+          if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
+                                        pAdapter->p2pSessionId,
+                                        hdd_smeCloseSessionCallback, pAdapter ) )
+          {
+              //Block on a completion variable. Can't wait forever though.
+              wait_for_completion_interruptible_timeout(
+                         &pAdapter->session_close_comp_var,
+                         msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+          }
+       }
+   }
+#endif
+   hdd_stop_all_adapters( pHddCtx );
+
+#ifdef ANI_BUS_TYPE_SDIO
+   sdio_func_dev = libra_getsdio_funcdev();
+
+   if(sdio_func_dev == NULL)
+   {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+        VOS_ASSERT(0);
+        return;
+   }
+
+   sd_claim_host(sdio_func_dev);
+
+   /* Disable SDIO IRQ since we are exiting */
+   libra_enable_sdio_irq(sdio_func_dev, 0);
+
+   sd_release_host(sdio_func_dev);
+#endif // ANI_BUS_TYPE_SDIO
+
+#ifdef WLAN_BTAMP_FEATURE
+   vosStatus = WLANBAP_Stop(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to stop BAP",__func__);
+   }
+#endif //WLAN_BTAMP_FEATURE
+
+   //Stop all the modules
+   vosStatus = vos_stop( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to stop VOSS",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   vosStatus = WLANBAL_Stop( pVosContext );
+
+   hddLog(VOS_TRACE_LEVEL_ERROR,"WLAN BAL STOP\n");
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to stop BAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+
+    msleep(50);
+   //Put the chip is standby before asserting deep sleep
+   vosStatus = WLANBAL_SuspendChip( pVosContext );
+
+   hddLog(VOS_TRACE_LEVEL_ERROR,"WLAN Suspend Chip\n");
+
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to suspend chip ",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+   //Invoke SAL stop
+   vosStatus = WLANSAL_Stop( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to stop SAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+
+#endif // ANI_BUS_TYPE_SDIO
+
+   //Assert Deep sleep signal now to put Libra HW in lowest power state
+   vosStatus = vos_chipAssertDeepSleep( NULL, NULL, NULL );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+   //Vote off any PMIC voltage supplies
+   vos_chipPowerDown(NULL, NULL, NULL);
+
+   vos_chipVoteOffXOBuffer(NULL, NULL, NULL);
+
+   //Clean up HDD Nlink Service
+   send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+   nl_srv_exit();
+
+   //This requires pMac access, Call this before vos_close().
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_unregister_mcast_bcast_filter(pHddCtx);
+#endif
+
+   //Close the scheduler before calling vos_close to make sure no thread is 
+   // scheduled after the each module close is called i.e after all the data 
+   // structures are freed.
+   vosStatus = vos_sched_close( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))    {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to close VOSS Scheduler",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+   
+
+   //Close VOSS
+   //This frees pMac(HAL) context. There should not be any call that requires pMac access after this.
+   vos_close(pVosContext);
+
+#ifdef ANI_BUS_TYPE_SDIO
+   vosStatus = WLANBAL_Close(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
+          "%s: Failed to close BAL",__func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   }
+   hddLog(VOS_TRACE_LEVEL_ERROR,"Returned WLAN BAL CLOSE\n\n\n\n");
+#endif // ANI_BUS_TYPE_SDIO
+
+   //Close Watchdog
+   if(pHddCtx->cfg_ini->fIsLogpEnabled)
+      vos_watchdog_close(pVosContext);
+
+   /* Cancel the vote for XO Core ON. 
+    * This is done here to ensure there is no race condition since MC, TX and WD threads have
+    * exited at this point
+    */
+   hddLog(VOS_TRACE_LEVEL_WARN, "In module exit: Cancel the vote for XO Core ON"
+                                    " when WLAN is turned OFF\n");
+   if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "Could not cancel the vote for XO Core ON." 
+                                        " Not returning failure."
+                                        " Power consumed will be high\n");
+   }  
+
+   hdd_close_all_adapters( pHddCtx );
+
+
+   //Free up dynamically allocated members inside HDD Adapter
+   kfree(pHddCtx->cfg_ini);
+   pHddCtx->cfg_ini= NULL;
+
+   /* free the power on lock from platform driver */
+   if (free_riva_power_on_lock("wlan"))
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to free power on lock",
+                                           __func__);
+   }
+
+#ifdef ANI_MANF_DIAG
+free_hdd_ctx:   
+#endif
+#ifdef CONFIG_CFG80211
+   wiphy_unregister(wiphy) ; 
+   wiphy_free(wiphy) ;
+#else
+   vos_mem_free( pHddCtx );
+#endif
+   if (hdd_is_ssr_required())
+   {
+       /* WDI timeout had happened during unload, so SSR is needed here */
+       subsystem_restart("riva");
+       msleep(5000);
+   }
+   hdd_set_ssr_required (VOS_FALSE);
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_update_config_from_nv() - Function to update the contents of
+         the running configuration with parameters taken from NV storage
+
+  \param  - pHddCtx - Pointer to the HDD global context
+
+  \return - VOS_STATUS_SUCCESS if successful
+
+  --------------------------------------------------------------------------*/
+static VOS_STATUS hdd_update_config_from_nv(hdd_context_t* pHddCtx)
+{
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   eHalStatus halStatus;
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   v_BOOL_t itemIsValid = VOS_FALSE;
+   VOS_STATUS status;
+   v_MACADDR_t macFromNV[VOS_MAX_CONCURRENCY_PERSONA];
+   v_U8_t      macLoop;
+
+   /*If the NV is valid then get the macaddress from nv else get it from qcom_cfg.ini*/
+   status = vos_nv_getValidity(VNV_FIELD_IMAGE, &itemIsValid);
+   if(status != VOS_STATUS_SUCCESS)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR," vos_nv_getValidity() failed\n ");
+       return VOS_STATUS_E_FAILURE;
+   }
+
+   if (itemIsValid == VOS_TRUE) 
+   {
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH," Reading the Macaddress from NV\n ");
+      status = vos_nv_readMultiMacAddress((v_U8_t *)&macFromNV[0].bytes[0],
+                                          VOS_MAX_CONCURRENCY_PERSONA);
+        if(status != VOS_STATUS_SUCCESS)
+        {
+         /* Get MAC from NV fail, not update CFG info
+          * INI MAC value will be used for MAC setting */
+         hddLog(VOS_TRACE_LEVEL_ERROR," vos_nv_readMacAddress() failed\n ");
+            return VOS_STATUS_E_FAILURE;
+        }
+
+      /* If first MAC is not valid, treat all others are not valid
+       * Then all MACs will be got from ini file */
+      if(vos_is_macaddr_zero(&macFromNV[0]))
+      {
+         /* MAC address in NV file is not configured yet */
+         hddLog(VOS_TRACE_LEVEL_WARN, "Invalid MAC in NV file");
+         return VOS_STATUS_E_INVAL;
+   }
+
+      /* Get MAC address from NV, update CFG info */
+      for(macLoop = 0; macLoop < VOS_MAX_CONCURRENCY_PERSONA; macLoop++)
+      {
+         if(vos_is_macaddr_zero(&macFromNV[macLoop]))
+         {
+            printk(KERN_ERR "not valid MAC from NV for %d", macLoop);
+            /* This MAC is not valid, skip it
+             * This MAC will be got from ini file */
+         }
+         else
+         {
+            vos_mem_copy((v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[macLoop].bytes[0],
+                         (v_U8_t *)&macFromNV[macLoop].bytes[0],
+                   VOS_MAC_ADDR_SIZE);
+         }
+      }
+   }
+   else
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "NV ITEM, MAC Not valid");
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#if 1 /* need to fix for concurrency */
+   // Set the MAC Address
+   // Currently this is used by HAL to add self sta. Remove this once self sta is added as part of session open.
+   halStatus = ccmCfgSetStr( pHddCtx->hHal, WNI_CFG_STA_ID,
+                             (v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[0],
+                             sizeof( pHddCtx->cfg_ini->intfMacAddr[0]),
+                             hdd_set_mac_addr_cb, VOS_FALSE );
+
+   if (!HAL_STATUS_SUCCESS( halStatus ))
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failed to set MAC Address. "
+          "HALStatus is %08d [x%08x]",__func__, halStatus, halStatus );
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+#endif
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_post_voss_start_config() - HDD post voss start config helper
+
+  \param  - pAdapter - Pointer to the HDD
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS hdd_post_voss_start_config(hdd_context_t* pHddCtx)
+{
+   eHalStatus halStatus;
+   v_U32_t listenInterval;
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   /* In the non-integrated architecture we update the configuration from
+      the INI file and from NV after vOSS has been started
+   */
+
+   // Apply the cfg.ini to cfg.dat
+   if (FALSE == hdd_update_config_dat(pHddCtx))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: config update failed",__func__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   // Apply the NV to cfg.dat
+   if (VOS_STATUS_SUCCESS != hdd_update_config_from_nv(pHddCtx))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,
+             "%s: config update from NV failed", __func__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif // FEATURE_WLAN_NON_INTEGRATED_SOC
+
+   // Send ready indication to the HDD.  This will kick off the MAC
+   // into a 'running' state and should kick off an initial scan.
+   halStatus = sme_HDDReadyInd( pHddCtx->hHal );
+   if ( !HAL_STATUS_SUCCESS( halStatus ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%S: sme_HDDReadyInd() failed with status "
+          "code %08d [x%08x]",__func__, halStatus, halStatus );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   // Set default LI into HDD context,
+   // otherwise under some race condition, HDD will set 0 LI value into RIVA,
+   // And RIVA will crash
+   wlan_cfgGetInt(pHddCtx->hHal, WNI_CFG_LISTEN_INTERVAL, &listenInterval);
+   pHddCtx->hdd_actual_LI_value = listenInterval;
+   
+   return VOS_STATUS_SUCCESS;
+}
+
+#ifdef ANI_BUS_TYPE_SDIO
+
+#ifndef ANI_MANF_DIAG
+// Routine to initialize the PMU
+void wlan_hdd_enable_deepsleep(v_VOID_t * pVosContext)
+{
+/*-------------- Need to fix this correctly while doing Deepsleep testing
+    tANI_U32 regValue = 0;
+
+    regValue  = QWLAN_PMU_LDO_CTRL_REG_PMU_ANA_DEEP_SLEEP_EN_MASK |
+                QWLAN_PMU_LDO_CTRL_REG_PMU_ANA_1P23_LPM_AON_MASK_MASK |
+                QWLAN_PMU_LDO_CTRL_REG_PMU_ANA_1P23_LPM_SW_MASK_MASK |
+                QWLAN_PMU_LDO_CTRL_REG_PMU_ANA_2P3_LPM_MASK_MASK;
+
+    WLANBAL_WriteRegister(pVosContext, QWLAN_PMU_LDO_CTRL_REG_REG, regValue);
+---------------------*/
+
+    return;
+}
+#endif
+#endif
+
+/* wake lock APIs for HDD */
+void hdd_prevent_suspend(void)
+{
+    wake_lock(&wlan_wake_lock);
+}
+
+void hdd_allow_suspend(void)
+{
+    wake_unlock(&wlan_wake_lock);
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_wlan_startup() - HDD init function
+
+  This is the driver startup code executed once a WLAN device has been detected
+
+  \param  - dev - Pointer to the underlying device
+
+  \return -  0 for success -1 for failure
+
+  --------------------------------------------------------------------------*/
+
+int hdd_wlan_startup(struct device *dev )
+{
+   VOS_STATUS status;
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_context_t *pHddCtx = NULL;
+   v_CONTEXT_t pVosContext= NULL;
+#ifdef WLAN_BTAMP_FEATURE
+   VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
+   WLANBAP_ConfigType btAmpConfig;
+   hdd_config_t *pConfig;
+#endif
+   int ret;
+#ifdef CONFIG_CFG80211
+   struct wiphy *wiphy;
+#endif
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = dev_to_sdio_func(dev);
+#endif //ANI_BUS_TYPE_SDIO
+
+   ENTER();
+#ifdef CONFIG_CFG80211
+   /*
+    * cfg80211: wiphy allocation
+    */
+   wiphy = wlan_hdd_cfg80211_init(sizeof(hdd_context_t)) ;
+
+   if(wiphy == NULL)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cfg80211 init failed", __func__);
+      return -1;
+   }
+
+   pHddCtx = wiphy_priv(wiphy);
+
+#else      
+      
+   pHddCtx = vos_mem_malloc ( sizeof( hdd_context_t ) );
+   if(pHddCtx == NULL)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cfg80211 init failed", __func__);
+      return -1;
+   }
+
+#endif   
+   //Initialize the adapter context to zeros.
+   vos_mem_zero(pHddCtx, sizeof( hdd_context_t ));
+
+#ifdef CONFIG_CFG80211
+   pHddCtx->wiphy = wiphy;
+#endif
+   hdd_prevent_suspend();
+   pHddCtx->isLoadUnloadInProgress = TRUE;
+
+   vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+
+   /*Get vos context here bcoz vos_open requires it*/
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+   //Save the Global VOSS context in adapter context for future.
+   pHddCtx->pvosContext = pVosContext;
+
+   //Save the adapter context in global context for future.
+   ((VosContextType*)(pVosContext))->pHDDContext = (v_VOID_t*)pHddCtx;
+
+#ifdef ANI_BUS_TYPE_SDIO
+   // Set the private data for the device to our adapter.
+   libra_sdio_setprivdata (sdio_func_dev, pHddCtx);
+   atomic_set(&pHddCtx->sdio_claim_count, 0);
+#endif // ANI_BUS_TYPE_SDIO
+
+   pHddCtx->parent_dev = dev;
+
+   init_completion(&pHddCtx->full_pwr_comp_var);
+   init_completion(&pHddCtx->standby_comp_var);
+   init_completion(&pHddCtx->req_bmps_comp_var);
+
+
+   hdd_list_init( &pHddCtx->hddAdapters, MAX_NUMBER_OF_ADAPTERS );
+
+   // Load all config first as TL config is needed during vos_open
+   pHddCtx->cfg_ini = (hdd_config_t*) kmalloc(sizeof(hdd_config_t), GFP_KERNEL);
+   if(pHddCtx->cfg_ini == NULL)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed kmalloc hdd_config_t",__func__);
+      goto err_free_hdd_context;
+   }
+
+   vos_mem_zero(pHddCtx->cfg_ini, sizeof( hdd_config_t ));
+
+   // Read and parse the qcom_cfg.ini file
+   status = hdd_parse_config_ini( pHddCtx );
+   if ( VOS_STATUS_SUCCESS != status )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: error parsing %s",
+             __func__, WLAN_INI_FILE);
+      goto err_config;
+   }
+
+#ifdef CONFIG_CFG80211
+   /*
+    * cfg80211: Initialization and registration ...
+    */
+   if (0 < wlan_hdd_cfg80211_register(dev, wiphy, pHddCtx->cfg_ini))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, 
+              "%s: wlan_hdd_cfg80211_register return failure", __func__);
+      goto err_wiphy_reg;
+   }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   // Update WDI trace levels based upon the cfg.ini
+   hdd_wdi_trace_enable(eWLAN_MODULE_DAL,
+                        pHddCtx->cfg_ini->wdiTraceEnableDAL);
+   hdd_wdi_trace_enable(eWLAN_MODULE_DAL_CTRL,
+                        pHddCtx->cfg_ini->wdiTraceEnableCTL);
+   hdd_wdi_trace_enable(eWLAN_MODULE_DAL_DATA,
+                        pHddCtx->cfg_ini->wdiTraceEnableDAT);
+   hdd_wdi_trace_enable(eWLAN_MODULE_PAL,
+                        pHddCtx->cfg_ini->wdiTraceEnablePAL);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#ifdef ANI_MANF_DIAG 
+   if(VOS_FTM_MODE == hdd_get_conparam())
+  {
+      if ( VOS_STATUS_SUCCESS != wlan_hdd_ftm_open(pHddCtx) )
+      {
+          hddLog(VOS_TRACE_LEVEL_FATAL,"%s: wlan_hdd_ftm_open Failed",__func__);
+          goto err_free_hdd_context;
+      }
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: FTM driver loaded success fully",__func__);
+      return VOS_STATUS_SUCCESS;
+  }
+#endif
+
+    //Open watchdog module
+   if(pHddCtx->cfg_ini->fIsLogpEnabled)
+   {
+      status = vos_watchdog_open(pVosContext,
+         &((VosContextType*)pVosContext)->vosWatchdog, sizeof(VosWatchdogContext));
+
+      if(!VOS_IS_STATUS_SUCCESS( status ))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_watchdog_open failed",__func__);
+#ifdef CONFIG_CFG80211
+         goto err_wiphy_reg;
+#else
+         goto err_config;
+#endif
+      }
+   }
+
+   pHddCtx->isLogpInProgress = FALSE;
+   vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, FALSE);
+
+#ifdef ANI_BUS_TYPE_SDIO
+   status = WLANBAL_Open(pHddCtx->pvosContext);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to open BAL",__func__);
+      goto err_wdclose;
+   }
+#endif // ANI_BUS_TYPE_SDIO
+
+   status = vos_chipVoteOnXOBuffer(NULL, NULL, NULL);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to configure 19.2 MHz Clock", __func__);
+#ifdef ANI_BUS_TYPE_SDIO
+      goto err_balclose;
+#else
+      goto err_wdclose;
+#endif
+   }
+
+
+#ifdef ANI_BUS_TYPE_SDIO
+   status = WLANSAL_Start(pHddCtx->pvosContext);
+   if (!VOS_IS_STATUS_SUCCESS(status))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Failed to start SAL",__func__);
+      goto err_clkvote;
+   }
+
+  /* Start BAL */
+  status = WLANBAL_Start(pHddCtx->pvosContext);
+
+  if (!VOS_IS_STATUS_SUCCESS(status))
+   {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: Failed to start BAL",__func__);
+     goto err_salstop;
+  }
+#endif // ANI_BUS_TYPE_SDIO
+
+#ifdef MSM_PLATFORM_7x30
+   /* FIXME: Volans 2.0 configuration. Reconfigure 1.3v SW supply to 1.3v. It will be configured to
+    * 1.4v in vos_ChipPowerup() routine above
+    */
+#endif
+
+   status = vos_open( &pVosContext, 0);
+   if ( !VOS_IS_STATUS_SUCCESS( status ))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_open failed",__func__);
+      goto err_balstop;   
+   }
+
+   /* Save the hal context in Adapter */
+   pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pVosContext );
+
+   if ( NULL == pHddCtx->hHal )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HAL context is null",__func__);      
+      goto err_vosclose;
+   }
+
+   // Set the SME configuration parameters...
+   status = hdd_set_sme_config( pHddCtx );
+
+   if ( VOS_STATUS_SUCCESS != status )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed hdd_set_sme_config",__func__); 
+         goto err_vosclose;
+      }
+
+   //Initialize the WMM module
+   status = hdd_wmm_init(pHddCtx);
+   if (!VOS_IS_STATUS_SUCCESS(status))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: hdd_wmm_init failed", __FUNCTION__);
+      goto err_vosclose;
+   }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Vos preStart is calling */
+   status = vos_preStart( pHddCtx->pvosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
+      goto err_vosclose;
+   }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* In the integrated architecture we update the configuration from
+      the INI file and from NV before vOSS has been started so that
+      the final contents are available to send down to the cCPU   */
+
+   // Apply the cfg.ini to cfg.dat
+   if (FALSE == hdd_update_config_dat(pHddCtx))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: config update failed",__func__ );
+      goto err_vosclose;
+   }
+
+   // Apply the NV to cfg.dat
+   /* Prima Update MAC address only at here */
+   if (VOS_STATUS_SUCCESS != hdd_update_config_from_nv(pHddCtx))
+   {
+#ifdef WLAN_AUTOGEN_MACADDR_FEATURE
+      /* There was not a valid set of MAC Addresses in NV.  See if the
+         default addresses were modified by the cfg.ini settings.  If so,
+         we'll use them, but if not, we'll autogenerate a set of MAC
+         addresses based upon the device serial number */
+
+      static const v_MACADDR_t default_address =
+         {{0x00, 0x0A, 0xF5, 0x89, 0x89, 0xFF}};
+      unsigned int serialno;
+      int i;
+
+      serialno = wcnss_get_serial_number();
+      if ((0 != serialno) &&
+          (0 == memcmp(&default_address, &pHddCtx->cfg_ini->intfMacAddr[0],
+                       sizeof(default_address))))
+      {
+         /* cfg.ini has the default address, invoke autogen logic */
+
+         /* MAC address has 3 bytes of OUI so we have a maximum of 3
+            bytes of the serial number that can be used to generate
+            the other 3 bytes of the MAC address.  Mask off all but
+            the lower 3 bytes (this will also make sure we don't
+            overflow in the next step) */
+         serialno &= 0x00FFFFFF;
+
+         /* we need a unique address for each session */
+         serialno *= VOS_MAX_CONCURRENCY_PERSONA;
+
+         /* autogen all addresses */
+         for (i = 0; i < VOS_MAX_CONCURRENCY_PERSONA; i++)
+         {
+            /* start with the entire default address */
+            pHddCtx->cfg_ini->intfMacAddr[i] = default_address;
+            /* then replace the lower 3 bytes */
+            pHddCtx->cfg_ini->intfMacAddr[i].bytes[3] = (serialno >> 16) & 0xFF;
+            pHddCtx->cfg_ini->intfMacAddr[i].bytes[4] = (serialno >> 8) & 0xFF;
+            pHddCtx->cfg_ini->intfMacAddr[i].bytes[5] = serialno & 0xFF;
+
+            serialno++;
+         }
+
+         pr_info("wlan: Invalid MAC addresses in NV, autogenerated "
+                MAC_ADDRESS_STR,
+                MAC_ADDR_ARRAY(pHddCtx->cfg_ini->intfMacAddr[0].bytes));
+      }
+      else
+#endif //WLAN_AUTOGEN_MACADDR_FEATURE
+      {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid MAC address in NV, using MAC from ini file "
+                MAC_ADDRESS_STR, __func__,
+                MAC_ADDR_ARRAY(pHddCtx->cfg_ini->intfMacAddr[0].bytes));
+      }
+   }
+   {
+      eHalStatus halStatus;
+      // Set the MAC Address
+      // Currently this is used by HAL to add self sta. Remove this once self sta is added as part of session open.
+      halStatus = cfgSetStr( pHddCtx->hHal, WNI_CFG_STA_ID,
+                             (v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[0],
+                             sizeof( pHddCtx->cfg_ini->intfMacAddr[0]) );
+   
+      if (!HAL_STATUS_SUCCESS( halStatus ))
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failed to set MAC Address. "
+                "HALStatus is %08d [x%08x]",__func__, halStatus, halStatus );
+         return VOS_STATUS_E_FAILURE;
+      }
+   }
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+   /*Start VOSS which starts up the SME/MAC/HAL modules and everything else
+     Note: Firmware image will be read and downloaded inside vos_start API */
+   status = vos_start( pHddCtx->pvosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
+      goto err_vosclose;
+   }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* retrieve and display WCNSS version information */
+   do {
+      tSirVersionType versionCompiled;
+      tSirVersionType versionReported;
+      tSirVersionString versionString;
+      tANI_U8 fwFeatCapsMsgSupported = 0;
+      VOS_STATUS vstatus;
+
+      vstatus = sme_GetWcnssWlanCompiledVersion(pHddCtx->hHal,
+                                                &versionCompiled);
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS WLAN compiled version",
+                __FUNCTION__);
+         break;
+      }
+
+      vstatus = sme_GetWcnssWlanReportedVersion(pHddCtx->hHal,
+                                                &versionReported);
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS WLAN reported version",
+                __FUNCTION__);
+         break;
+      }
+
+      if ((versionCompiled.major != versionReported.major) ||
+          (versionCompiled.minor != versionReported.minor) ||
+          (versionCompiled.version != versionReported.version) ||
+          (versionCompiled.revision != versionReported.revision))
+      {
+         pr_err("%s: WCNSS WlAN Version %u.%u.%u.%u, "
+                "Host expected %u.%u.%u.%u\n",
+                WLAN_MODULE_NAME,
+                (int)versionReported.major,
+                (int)versionReported.minor,
+                (int)versionReported.version,
+                (int)versionReported.revision,
+                (int)versionCompiled.major,
+                (int)versionCompiled.minor,
+                (int)versionCompiled.version,
+                (int)versionCompiled.revision);
+      }
+      else
+      {
+         pr_info("%s: WCNSS WLAN version %u.%u.%u.%u\n",
+                 WLAN_MODULE_NAME,
+                 (int)versionReported.major,
+                 (int)versionReported.minor,
+                 (int)versionReported.version,
+                 (int)versionReported.revision);
+      }
+
+      vstatus = sme_GetWcnssSoftwareVersion(pHddCtx->hHal,
+                                            versionString,
+                                            sizeof(versionString));
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS software version string",
+                __FUNCTION__);
+         break;
+      }
+
+      pr_info("%s: WCNSS software version %s\n",
+              WLAN_MODULE_NAME, versionString);
+
+      vstatus = sme_GetWcnssHardwareVersion(pHddCtx->hHal,
+                                            versionString,
+                                            sizeof(versionString));
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS hardware version string",
+                __FUNCTION__);
+         break;
+      }
+
+      pr_info("%s: WCNSS hardware version %s\n",
+              WLAN_MODULE_NAME, versionString);
+
+      /* Check if FW version is greater than 0.1.1.0. Only then send host-FW capability exchange message */
+      if ((versionReported.major>0) || (versionReported.minor>1) || ((versionReported.minor>=1) && (versionReported.version>=1)))
+         fwFeatCapsMsgSupported = 1;
+      if (fwFeatCapsMsgSupported)
+        sme_featureCapsExchange(pHddCtx->hHal);
+   } while (0);
+
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+   status = hdd_post_voss_start_config( pHddCtx );
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_post_voss_start_config failed", 
+         __func__);
+      goto err_vosstop;
+   }
+
+#ifdef WLAN_SOFTAP_FEATURE
+   if (VOS_STA_SAP_MODE == hdd_get_conparam())
+   {
+     pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_SOFTAP, "softap.%d", 
+         wlan_hdd_get_intf_addr(pHddCtx), FALSE );
+   }
+   else
+   {
+#endif
+     pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_INFRA_STATION, "wlan%d",
+         wlan_hdd_get_intf_addr(pHddCtx), FALSE );
+     if (pAdapter != NULL)
+     {
+#ifdef WLAN_FEATURE_P2P
+         vos_mem_copy( pHddCtx->p2pDeviceAddress.bytes, 
+                       pHddCtx->cfg_ini->intfMacAddr[0].bytes,
+                       sizeof(tSirMacAddr));
+         if ( pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated )
+         {
+             /* Generate the P2P Device Address.  This consists of the device's
+              * primary MAC address with the locally administered bit set.
+              */
+             pHddCtx->p2pDeviceAddress.bytes[0] |= 0x02;
+             status = hdd_init_p2p_device_mode(pAdapter);
+             if ( VOS_STATUS_SUCCESS != status )
+             {
+                 hddLog(VOS_TRACE_LEVEL_FATAL,
+                         "%s: Init Session fail for P2P Device Address Mode ",
+                          __FUNCTION__);
+                 goto err_close_adapter;
+             }
+         }
+#endif
+    }
+#ifdef WLAN_SOFTAP_FEATURE
+   }
+#endif
+
+   if( pAdapter == NULL )
+   {
+     hddLog(VOS_TRACE_LEVEL_ERROR,"%s: hdd_open_adapter failed",__func__);
+#ifdef ANI_BUS_TYPE_SDIO
+     goto err_balstop;
+#else
+     goto err_clkvote;
+#endif
+   }
+   
+     
+#ifdef WLAN_BTAMP_FEATURE
+   vStatus = WLANBAP_Open(pVosContext);
+   if(!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to open BAP",__func__);
+      goto err_p2psession_close;
+   }
+
+   vStatus = BSL_Init(pVosContext);
+   if(!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Failed to Init BSL",__func__);
+     goto err_bap_close;
+   }
+   vStatus = WLANBAP_Start(pVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to start TL",__func__);
+       goto err_bap_close;
+   }
+
+   pConfig = pHddCtx->cfg_ini;
+   btAmpConfig.ucPreferredChannel = pConfig->preferredChannel;
+   status = WLANBAP_SetConfig(&btAmpConfig);
+
+#endif //WLAN_BTAMP_FEATURE
+ 
+#ifdef FEATURE_WLAN_SCAN_PNO
+   /*SME must send channel update configuration to RIVA*/
+   sme_UpdateChannelConfig(pHddCtx->hHal); 
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Register with platform driver as client for Suspend/Resume */
+   status = hddRegisterPmOps(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__);
+#ifdef WLAN_BTAMP_FEATURE
+      goto err_bap_stop;
+#else
+      goto err_p2psession_close; 
+#endif //WLAN_BTAMP_FEATURE
+   }
+
+   /* Register TM level change handler function to the platform */
+   status = hddDevTmRegisterNotifyCallback(pHddCtx);
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDevTmRegisterNotifyCallback failed",__func__);
+      goto err_unregister_pmops;
+   }
+#endif
+
+   /* register for riva power on lock to platform driver */
+   if (req_riva_power_on_lock("wlan"))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: req riva power on lock failed",
+                                     __func__);
+      goto err_unregister_pmops;
+   }
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   // Register suspend/resume callbacks
+   if(pHddCtx->cfg_ini->nEnableSuspend)
+   {
+      register_wlan_suspend();
+   }
+#endif
+
+   // register net device notifier for device change notification
+   ret = register_netdevice_notifier(&hdd_netdev_notifier);
+
+   if(ret < 0)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: register_netdevice_notifier failed",__func__);
+      goto err_free_power_on_lock;
+   }
+
+   //Initialize the nlink service
+   if(nl_srv_init() != 0)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%S: nl_srv_init failed",__func__);
+      goto err_reg_netdev;
+   }
+
+   //Initialize the BTC service
+   if(btc_activate_service(pHddCtx) != 0)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: btc_activate_service failed",__func__);
+      goto err_nl_srv;
+   }
+
+#ifdef PTT_SOCK_SVC_ENABLE
+   //Initialize the PTT service
+   if(ptt_sock_activate_svc(pHddCtx) != 0)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: ptt_sock_activate_svc failed",__func__);
+      goto err_nl_srv;
+   }
+#endif
+
+   //Initialize the WoWL service
+   if(!hdd_init_wowl(pHddCtx))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_init_wowl failed",__func__);
+      goto err_nl_srv;
+   }
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+   hdd_register_mcast_bcast_filter(pHddCtx);
+#endif
+#ifdef CONFIG_CFG80211
+#ifdef WLAN_SOFTAP_FEATURE
+   if (VOS_STA_SAP_MODE != hdd_get_conparam())
+#endif
+   {
+      wlan_hdd_cfg80211_post_voss_start(pAdapter);
+   }
+#endif
+
+   mutex_init(&pHddCtx->sap_lock);
+
+   pHddCtx->isLoadUnloadInProgress = FALSE;
+
+   vos_event_init(&pAdapter->scan_info.scan_finished_event);
+   pAdapter->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP;
+
+   vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
+   hdd_allow_suspend();
+  
+   goto success;
+
+err_nl_srv:
+   nl_srv_exit();
+
+err_reg_netdev:
+   unregister_netdevice_notifier(&hdd_netdev_notifier);
+
+err_free_power_on_lock:
+   free_riva_power_on_lock("wlan");
+
+err_unregister_pmops:
+   hddDevTmUnregisterNotifyCallback(pHddCtx);
+   hddDeregisterPmOps(pHddCtx);
+
+#ifdef WLAN_BTAMP_FEATURE
+err_bap_stop:
+  WLANBAP_Stop(pVosContext);
+#endif
+
+#ifdef WLAN_BTAMP_FEATURE
+err_bap_close:
+   WLANBAP_Close(pVosContext);
+#endif
+
+err_p2psession_close:
+#ifdef WLAN_FEATURE_P2P
+   if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+   {
+       hdd_adapter_t* pAdapter = hdd_get_adapter(pHddCtx,
+                                    WLAN_HDD_INFRA_STATION);
+
+       if (pAdapter != NULL)
+       {
+          INIT_COMPLETION(pAdapter->session_close_comp_var);
+          if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
+                                        pAdapter->p2pSessionId,
+                                        hdd_smeCloseSessionCallback, pAdapter ) )
+          {
+              //Block on a completion variable. Can't wait forever though.
+              wait_for_completion_interruptible_timeout(
+                         &pAdapter->session_close_comp_var,
+                         msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+          }
+       }
+   }
+#endif
+
+err_close_adapter:
+   hdd_close_all_adapters( pHddCtx );
+
+err_vosstop:
+   vos_stop(pVosContext);
+
+err_vosclose:    
+   status = vos_sched_close( pVosContext );
+   if (!VOS_IS_STATUS_SUCCESS(status))    {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: Failed to close VOSS Scheduler", __func__);
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+   }
+   vos_close(pVosContext ); 
+
+err_balstop:
+#ifdef ANI_BUS_TYPE_SDIO
+#ifndef ANI_MANF_DIAG
+       wlan_hdd_enable_deepsleep(pHddCtx->pvosContext);
+#endif
+
+   WLANBAL_Stop(pHddCtx->pvosContext);
+   WLANBAL_SuspendChip(pHddCtx->pvosContext);
+#endif
+
+#ifdef ANI_BUS_TYPE_SDIO
+err_salstop:
+   WLANSAL_Stop(pHddCtx->pvosContext);
+
+#endif
+err_clkvote:
+    vos_chipVoteOffXOBuffer(NULL, NULL, NULL);
+
+#ifdef ANI_BUS_TYPE_SDIO
+err_balclose:
+   WLANBAL_Close(pHddCtx->pvosContext);
+#endif // ANI_BUS_TYPE_SDIO
+
+err_wdclose:
+   if(pHddCtx->cfg_ini->fIsLogpEnabled)
+      vos_watchdog_close(pVosContext);
+
+#ifdef CONFIG_CFG80211
+err_wiphy_reg:
+   wiphy_unregister(wiphy) ; 
+#endif
+
+err_config:
+   kfree(pHddCtx->cfg_ini);
+   pHddCtx->cfg_ini= NULL;
+
+err_free_hdd_context:
+   hdd_allow_suspend();
+#ifdef CONFIG_CFG80211
+   wiphy_free(wiphy) ;
+   //kfree(wdev) ;
+#else
+   vos_mem_free( pHddCtx );
+#endif
+   VOS_BUG(1);
+
+   return -1;
+
+success:
+   EXIT();
+   return 0;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_module_init() - Init Function
+
+   This is the driver entry point (invoked when module is loaded using insmod)
+
+  \param  - None
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static int __init hdd_module_init ( void)
+{
+   VOS_STATUS status;
+   v_CONTEXT_t pVosContext = NULL;
+#ifdef ANI_BUS_TYPE_SDIO
+   struct sdio_func *sdio_func_dev = NULL;
+   unsigned int attempts = 0;
+#endif // ANI_BUS_TYPE_SDIO
+   struct device *dev = NULL;
+   int ret_status = 0;
+
+   ENTER();
+
+   wake_lock_init(&wlan_wake_lock, WAKE_LOCK_SUSPEND, "wlan");
+
+   pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME,
+           QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR);
+
+   //Power Up Libra WLAN card first if not already powered up
+   status = vos_chipPowerUp(NULL,NULL,NULL);
+   if (!VOS_IS_STATUS_SUCCESS(status))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not Powered Up. "
+          "exiting", __func__);
+      return -1;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   //SDIO Polling should be turned on for card detection. When using Android Wi-Fi GUI
+   //users need not trigger SDIO polling explicitly. However when loading drivers via
+   //command line (Adb shell), users must turn on SDIO polling prior to loading WLAN.
+   do {
+      sdio_func_dev = libra_getsdio_funcdev();
+      if (NULL == sdio_func_dev) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN not detected yet.",__func__);
+         attempts++;
+      }
+      else {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN detecton succeeded",__func__);
+         dev = &sdio_func_dev->dev;
+         break;
+      }
+
+      if(attempts == 7)
+         break;
+
+      msleep(250);
+
+   }while (attempts < 7);
+
+   //Retry to detect the card again by Powering Down the chip and Power up the chip
+   //again. This retry is done to recover from CRC Error
+   if (NULL == sdio_func_dev) {
+
+      attempts = 0;
+
+      //Vote off any PMIC voltage supplies
+      vos_chipPowerDown(NULL, NULL, NULL);
+
+      msleep(1000);
+
+      //Power Up Libra WLAN card first if not already powered up
+      status = vos_chipPowerUp(NULL,NULL,NULL);
+      if (!VOS_IS_STATUS_SUCCESS(status))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN not Powered Up. "
+             "exiting", __func__);
+         return -1;
+      }
+
+      do {
+         sdio_func_dev = libra_getsdio_funcdev();
+         if (NULL == sdio_func_dev) {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN not detected yet.",__func__);
+            attempts++;
+         }
+         else {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Retry Libra WLAN detecton succeeded",__func__);
+            dev = &sdio_func_dev->dev;
+            break;
+         }
+
+         if(attempts == 2)
+           break;
+
+         msleep(1000);
+
+      }while (attempts < 3);
+   }
+
+#endif // ANI_BUS_TYPE_SDIO
+
+#ifdef ANI_BUS_TYPE_PCI
+
+   dev = wcnss_wlan_get_device();
+
+#endif // ANI_BUS_TYPE_PCI
+
+#ifdef ANI_BUS_TYPE_PLATFORM
+   dev = wcnss_wlan_get_device();
+#endif // ANI_BUS_TYPE_PLATFORM
+
+
+   do {
+      if (NULL == dev) {
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN device not found!!",__func__);
+         ret_status = -1;
+         break;
+   }
+
+#ifdef MEMORY_DEBUG
+      vos_mem_init();
+#endif
+
+#ifdef TIMER_MANAGER
+      vos_timer_manager_init();
+#endif
+
+      /* Preopen VOSS so that it is ready to start at least SAL */
+      status = vos_preOpen(&pVosContext);
+
+   if (!VOS_IS_STATUS_SUCCESS(status))
+   {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed to preOpen VOSS", __func__);
+         ret_status = -1;
+         break;
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   /* Now Open SAL */
+   status = WLANSAL_Open(pVosContext, 0);
+
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed to open SAL", __func__);
+
+      /* If unable to open, cleanup and return failure */
+      vos_preClose( &pVosContext );
+         ret_status = -1;
+         break;
+   }
+#endif // ANI_BUS_TYPE_SDIO
+
+#if defined(FEATURE_WLAN_INTEGRATED_SOC) && defined(ANI_MANF_DIAG)
+      if(5 == con_mode)
+      {
+         hdd_set_conparam(VOS_FTM_MODE);
+      }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC && ANI_MANF_DIAG */
+
+      // Call our main init function
+      if(hdd_wlan_startup(dev)) {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: WLAN Driver Initialization failed",
+          __func__);
+#ifdef ANI_BUS_TYPE_SDIO
+         WLANSAL_Close(pVosContext);
+#endif // ANI_BUS_TYPE_SDIO
+         vos_preClose( &pVosContext );
+         ret_status = -1;
+         break;
+      }
+
+      /* Cancel the vote for XO Core ON
+       * This is done here for safety purposes in case we re-initialize without turning
+       * it OFF in any error scenario.
+       */
+      hddLog(VOS_TRACE_LEVEL_ERROR, "In module init: Ensure Force XO Core is OFF"
+                                       " when  WLAN is turned ON so Core toggles"
+                                       " unless we enter PS\n");
+      if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
+      {
+          hddLog(VOS_TRACE_LEVEL_ERROR, "Could not cancel XO Core ON vote. Not returning failure."
+                                            " Power consumed will be high\n");
+      }
+   } while (0);
+
+   if (0 != ret_status)
+   {
+      //Assert Deep sleep signal now to put Libra HW in lowest power state
+      status = vos_chipAssertDeepSleep( NULL, NULL, NULL );
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status) );
+
+      //Vote off any PMIC voltage supplies
+      vos_chipPowerDown(NULL, NULL, NULL);
+#ifdef TIMER_MANAGER
+      vos_timer_exit();
+#endif
+#ifdef MEMORY_DEBUG
+      vos_mem_exit();
+#endif
+
+      wake_lock_destroy(&wlan_wake_lock);
+      pr_err("%s: driver load failure\n", WLAN_MODULE_NAME);
+   }
+   else
+   {
+      //Send WLAN UP indication to Nlink Service
+      send_btc_nlink_msg(WLAN_MODULE_UP_IND, 0);
+
+      pr_info("%s: driver loaded\n", WLAN_MODULE_NAME);
+
+   }
+
+   EXIT();
+
+   return ret_status;
+}
+
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_module_exit() - Exit function
+
+  This is the driver exit point (invoked when module is unloaded using rmmod)
+
+  \param  - None
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+static void __exit hdd_module_exit(void)
+{
+   hdd_context_t *pHddCtx = NULL;
+   v_CONTEXT_t pVosContext = NULL;
+   int attempts = 0;
+
+   pr_info("%s: unloading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR);
+
+   //Get the global vos context
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+   if(!pVosContext)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+      goto done;
+   }
+
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+
+   if(!pHddCtx)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: module exit called before probe",__func__);
+   }
+   else
+   {
+      while(isWDresetInProgress()){
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Reset in Progress by LOGP. Block rmmod for 500ms!!!",__func__);
+         VOS_ASSERT(0);
+         msleep(500);
+         attempts++;
+         if(attempts==MAX_EXIT_ATTEMPTS_DURING_LOGP)
+           break;
+       }
+
+      pHddCtx->isLoadUnloadInProgress = TRUE;
+      vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+
+      //Do all the cleanup before deregistering the driver
+      hdd_wlan_exit(pHddCtx);
+   }
+
+#ifdef ANI_BUS_TYPE_SDIO
+   WLANSAL_Close(pVosContext);
+#endif // ANI_BUS_TYPE_SDIO
+
+   vos_preClose( &pVosContext );
+
+#ifdef TIMER_MANAGER
+   vos_timer_exit();
+#endif
+#ifdef MEMORY_DEBUG
+   vos_mem_exit();
+#endif
+
+done:
+   wake_lock_destroy(&wlan_wake_lock);
+   pr_info("%s: driver unloaded\n", WLAN_MODULE_NAME);
+}
+
+#if defined(WLAN_SOFTAP_FEATURE) || defined(ANI_MANF_DIAG)
+/**---------------------------------------------------------------------------
+
+  \brief hdd_get_conparam() -
+
+  This is the driver exit point (invoked when module is unloaded using rmmod)
+
+  \param  - None
+
+  \return - tVOS_CON_MODE
+
+  --------------------------------------------------------------------------*/
+tVOS_CON_MODE hdd_get_conparam ( void )
+{
+    return (tVOS_CON_MODE)con_mode;
+
+}
+void hdd_set_conparam ( v_UINT_t newParam )
+{
+  con_mode = newParam;
+}
+/**---------------------------------------------------------------------------
+
+  \brief hdd_softap_sta_deauth() - function
+
+  This to take counter measure to handle deauth req from HDD
+
+  \param  - pAdapter - Pointer to the HDD
+
+  \param  - enable - boolean value
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+
+void hdd_softap_sta_deauth(hdd_adapter_t *pAdapter, v_U8_t *pDestMacAddress)
+{
+    v_U8_t STAId;
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    tHalHandle hHalHandle;
+#endif
+
+    ENTER();
+
+    hddLog( LOGE, "hdd_softap_sta_deauth:(0x%x, false)", (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+
+    //Ignore request to deauth bcmc station
+    if( pDestMacAddress[0] & 0x1 )
+       return;
+
+    WLANSAP_DeauthSta(pVosContext,pDestMacAddress);
+
+    /*Get the Station ID*/
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    hHalHandle = (tHalHandle ) vos_get_context(VOS_MODULE_ID_HAL, pVosContext);
+    if (eHAL_STATUS_SUCCESS ==
+        halTable_FindStaidByAddr(hHalHandle, (tANI_U8 *)pDestMacAddress,
+                                 &STAId))
+    {
+       hdd_softap_DeregisterSTA(pAdapter, STAId);
+    }
+#else
+    if (VOS_STATUS_SUCCESS ==
+        hdd_softap_GetStaId(pAdapter, (v_MACADDR_t *)pDestMacAddress,
+                            &STAId))
+    {
+      hdd_softap_DeregisterSTA(pAdapter, STAId);
+    }
+#endif
+
+    EXIT();
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_softap_sta_disassoc() - function
+
+  This to take counter measure to handle deauth req from HDD
+
+  \param  - pAdapter - Pointer to the HDD
+
+  \param  - enable - boolean value
+
+  \return - None
+
+  --------------------------------------------------------------------------*/
+
+void hdd_softap_sta_disassoc(hdd_adapter_t *pAdapter,v_U8_t *pDestMacAddress)
+{
+        v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
+
+    ENTER();
+
+    hddLog( LOGE, "hdd_softap_sta_disassoc:(0x%x, false)", (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+
+    //Ignore request to disassoc bcmc station
+    if( pDestMacAddress[0] & 0x1 )
+       return;
+
+    WLANSAP_DisassocSta(pVosContext,pDestMacAddress);
+}
+
+void hdd_softap_tkip_mic_fail_counter_measure(hdd_adapter_t *pAdapter,v_BOOL_t enable)
+{
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
+
+    ENTER();
+
+    hddLog( LOGE, "hdd_softap_tkip_mic_fail_counter_measure:(0x%x, false)", (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+
+    WLANSAP_SetCounterMeasure(pVosContext, (v_BOOL_t)enable);
+}
+
+#endif /* WLAN_SOFTAP_FEATURE */
+/**---------------------------------------------------------------------------
+ *
+ *   \brief hdd_get__concurrency_mode() -
+ *
+ *
+ *   \param  - None
+ *
+ *   \return - CONCURRENCY MODE
+ *
+ * --------------------------------------------------------------------------*/
+tVOS_CONCURRENCY_MODE hdd_get_concurrency_mode ( void )
+{
+    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
+    hdd_context_t *pHddCtx;
+
+    if (NULL != pVosContext)
+    {
+       pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+       if (NULL != pHddCtx)
+       {
+          return (tVOS_CONCURRENCY_MODE)pHddCtx->concurrency_mode;
+       }
+    }
+
+    /* we are in an invalid state :( */
+    hddLog(LOGE, "%s: Invalid context", __FUNCTION__);
+    return VOS_STA;
+}
+
+/* Decide whether to allow/not the apps power collapse. 
+ * Allow apps power collapse if we are in connected state.
+ * if not, allow only if we are in IMPS  */
+v_BOOL_t hdd_is_apps_power_collapse_allowed(hdd_context_t* pHddCtx)
+{
+    tPmcState pmcState = pmcGetPmcState(pHddCtx->hHal);
+    hdd_config_t *pConfig = pHddCtx->cfg_ini;
+    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; 
+    hdd_adapter_t *pAdapter = NULL; 
+    VOS_STATUS status;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if (VOS_STA_SAP_MODE == hdd_get_conparam())
+        return TRUE;
+#endif
+
+    /*loop through all adapters. TBD fix for Concurrency */
+    status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+    {
+        pAdapter = pAdapterNode->pAdapter;
+        if ( (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)
+          || (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) )
+        {
+            if ((pConfig->fIsImpsEnabled || pConfig->fIsBmpsEnabled)
+                 && (pmcState != IMPS && pmcState != BMPS
+                 &&  pmcState != STOPPED && pmcState != STANDBY))
+            {
+                return FALSE;
+            }
+        }
+        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+        pAdapterNode = pNext;
+    }
+    return TRUE;
+}
+
+void wlan_hdd_set_concurrency_mode(hdd_context_t *pHddCtx, tVOS_CON_MODE mode)
+{
+   switch(mode)
+   {
+       case WLAN_HDD_INFRA_STATION:
+#ifdef WLAN_FEATURE_P2P
+       case WLAN_HDD_P2P_CLIENT:
+       case WLAN_HDD_P2P_GO:
+#endif
+       case WLAN_HDD_SOFTAP:
+    pHddCtx->concurrency_mode |= (1 << mode);
+    pHddCtx->no_of_sessions[mode]++;
+            break;
+       default:
+            break;
+
+   }
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: concurrency_mode = 0x%x NumberofSessions for mode %d = %d",
+    __func__,pHddCtx->concurrency_mode,mode,pHddCtx->no_of_sessions[mode]);
+}
+
+
+void wlan_hdd_clear_concurrency_mode(hdd_context_t *pHddCtx, tVOS_CON_MODE mode)
+{
+   switch(mode)
+   {
+       case WLAN_HDD_INFRA_STATION:
+#ifdef WLAN_FEATURE_P2P
+       case WLAN_HDD_P2P_CLIENT:
+       case WLAN_HDD_P2P_GO:
+#endif
+       case WLAN_HDD_SOFTAP:
+    pHddCtx->no_of_sessions[mode]--;
+    if (!(pHddCtx->no_of_sessions[mode]))
+            pHddCtx->concurrency_mode &= (~(1 << mode));
+            break;
+       default:
+            break;
+   }
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: concurrency_mode = 0x%x NumberofSessions for mode %d = %d",
+    __func__,pHddCtx->concurrency_mode,mode,pHddCtx->no_of_sessions[mode]);
+}
+
+//Register the module init/exit functions
+module_init(hdd_module_init);
+module_exit(hdd_module_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Qualcomm Atheros, Inc.");
+MODULE_DESCRIPTION("WLAN HOST DEVICE DRIVER");
+
+#if defined(WLAN_SOFTAP_FEATURE) || defined(ANI_MANF_DIAG)
+module_param(con_mode, int, 0);
+#endif
diff --git a/CORE/HDD/src/wlan_hdd_mib.c b/CORE/HDD/src/wlan_hdd_mib.c
new file mode 100644
index 0000000..f6dbab2
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_mib.c
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+#include "wlan_hdd_includes.h"
+
+
+static inline v_VOID_t mibGetDot11DesiredBssType( hdd_adapter_t *pAdapter, eMib_dot11DesiredBssType *pDot11DesiredBssType )
+{
+    *pDot11DesiredBssType = pAdapter->hdd_mib.mibDot11DesiredBssType;
+    return;
+}
+
+static inline VOS_STATUS mibSetDot11DesiredBssType( hdd_adapter_t *pAdapter, eMib_dot11DesiredBssType mibDot11DesiredBssType )
+{
+    pAdapter->hdd_mib.mibDot11DesiredBssType = mibDot11DesiredBssType;
+    return( VOS_STATUS_SUCCESS );
+}
+
+v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter )
+{
+    eMib_dot11DesiredBssType mibDot11DesiredBssType; 
+    mibGetDot11DesiredBssType( pAdapter, &mibDot11DesiredBssType );
+    
+    return( eMib_dot11DesiredBssType_infrastructure == mibDot11DesiredBssType );   
+}
+
+
+static inline v_BOOL_t mibIsDot11DesiredBssTypeIndependent( hdd_adapter_t *pAdapter )
+{
+    eMib_dot11DesiredBssType mibDot11DesiredBssType; 
+    mibGetDot11DesiredBssType( pAdapter, &mibDot11DesiredBssType );
+    
+    return( eMib_dot11DesiredBssType_independent == mibDot11DesiredBssType );   
+}
+
+static inline v_VOID_t mibGetDot11IbssJoinOnly( hdd_adapter_t *pAdapter, v_BOOL_t *pdot11IbssJoinOnly )
+{
+    *pdot11IbssJoinOnly = pAdapter->hdd_mib.dot11IbssJoinOnly;
+    return;
+}
+
+static inline VOS_STATUS mibSetDot11IbssJoinOnly( hdd_adapter_t *pAdapter, v_BOOL_t dot11IbssJoinOnly )
+{
+    pAdapter->hdd_mib.dot11IbssJoinOnly = dot11IbssJoinOnly;
+    return( VOS_STATUS_SUCCESS );
+}
+
+static inline VOS_STATUS mibSetDot11NICPowerState( hdd_adapter_t *pAdapter, eMib_dot11NICPowerState *pMibDot11NICPowerState )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+    pAdapter->hdd_mib.mibDot11NICPowerState = *pMibDot11NICPowerState;
+    
+    return( status );
+}
+
+static inline VOS_STATUS mibSetDot11NICPowerStateOff( hdd_adapter_t *pAdapter )
+{
+    eMib_dot11NICPowerState dot11NICPowerState = eMib_dot11NICPowerState_OFF;
+    return( mibSetDot11NICPowerState( pAdapter, &dot11NICPowerState ) );
+}
+
+static inline void mibGetDot11NICPowerState( hdd_adapter_t *pAdapter, eMib_dot11NICPowerState *pMibDot11NICPowerState )
+{
+    *pMibDot11NICPowerState = pAdapter->hdd_mib.mibDot11NICPowerState;
+    
+    return;
+}
+
+static inline v_BOOL_t mibIsDot11NICPowerStateOn( hdd_adapter_t *pAdapter )
+{
+    eMib_dot11NICPowerState dot11NICPowerState;
+
+    mibGetDot11NICPowerState( pAdapter, &dot11NICPowerState );
+    
+    return( eMib_dot11NICPowerState_ON == dot11NICPowerState );
+}
+
+static inline v_BOOL_t mibIsDot11NICPowerStateOff( hdd_adapter_t *pAdapter )
+{
+    return( !mibIsDot11NICPowerStateOn( pAdapter ) );
+}
+
+static inline VOS_STATUS mibSetDot11DesiredSsidList( hdd_adapter_t *pAdapter, sMib_dot11DesiredSsidList *pDot11DesiredSsidList )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+        
+    if ( pDot11DesiredSsidList->cEntries > MIB_DOT11_DESIRED_SSID_LIST_MAX_COUNT )
+
+        pAdapter->hdd_mib.mibDot11DesiredSsidList = *pDot11DesiredSsidList ;
+              
+    return( status );
+}
+
+static inline VOS_STATUS mibSetDot11DesiredBssidList( hdd_adapter_t *pAdapter, sMib_dot11DesiredBssidList *pDot11DesiredBssidList )
+{   
+    pAdapter->hdd_mib.mibDot11DesiredBssidList = *pDot11DesiredBssidList;
+    
+    return( VOS_STATUS_SUCCESS );
+}
+
+
+static inline v_VOID_t mibGetDot11DesiredBssidList( hdd_adapter_t *pAdapter, sMib_dot11DesiredBssidList *pMibDot11DesiredBssidList )
+{
+    *pMibDot11DesiredBssidList = pAdapter->hdd_mib.mibDot11DesiredBssidList;
+    
+    return;
+}
+
+
+static inline v_VOID_t mibGetDot11DesiredSsidList( hdd_adapter_t *pAdapter, sMib_dot11DesiredSsidList *pMibDot11DesiredSsidList )
+{
+    *pMibDot11DesiredSsidList = pAdapter->hdd_mib.mibDot11DesiredSsidList;
+    
+    return;
+}
+
+
+static inline VOS_STATUS mibSetDot11AutoConfigEnabled( hdd_adapter_t *pAdapter, eMib_dot11AutoConfigEnabled *pMibDot11AutoConfigEnabled )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+    pAdapter->hdd_mib.mibDot11AutoConfigEnabled = *pMibDot11AutoConfigEnabled;
+    
+    return( status );
+}
+
+
+static inline v_VOID_t mibGetDot11AutoConfigEnabled( hdd_adapter_t *pAdapter, eMib_dot11AutoConfigEnabled *pMibDot11AutoConfigEnabled )
+{
+    *pMibDot11AutoConfigEnabled = pAdapter->hdd_mib.mibDot11AutoConfigEnabled;
+    
+    return;
+}
+
+static inline VOS_STATUS mibSetDot11MacExcludeList( hdd_adapter_t *pAdapter, sMib_dot11MacExcludeList *pDot11MacExcludeList )
+{
+    pAdapter->hdd_mib.mibDot11MacExcludeList = *pDot11MacExcludeList;
+    
+    return( VOS_STATUS_SUCCESS );
+}
+
+static inline VOS_STATUS mibGetDot11MacExcludeList( hdd_adapter_t *pAdapter, sMib_dot11MacExcludeList *pDot11MacExcludeList )
+{
+    *pDot11MacExcludeList =  pAdapter->hdd_mib.mibDot11MacExcludeList;
+
+    return( VOS_STATUS_SUCCESS );
+}
+
+static inline void mibSetDefaultDot11MacExcludeList( hdd_adapter_t *pAdapter )
+{
+    pAdapter->hdd_mib.mibDot11MacExcludeList.cEntries = 0;
+}
+
+static inline VOS_STATUS mibSetDot11HardwarePHYState( hdd_adapter_t *pAdapter, eMib_dot11HardwarePHYState *pMibDot11HardwarePHYState )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    
+    pAdapter->hdd_mib.mibDot11HardwarePHYState = *pMibDot11HardwarePHYState;
+    
+    return( status );
+}
+
+
+static inline void mibGetDot11HardwarePHYState( hdd_adapter_t *pAdapter, eMib_dot11HardwarePHYState *pMibDot11HardwarePHYState )
+{
+    *pMibDot11HardwarePHYState = pAdapter->hdd_mib.mibDot11HardwarePHYState;
+    
+    return;
+}
+
+static inline void mibSetDefaultDot11PrivacyExemptionList( hdd_adapter_t *pAdapter )
+{
+    pAdapter->hdd_mib.mibDot11PrivacyExemptionList.cEntries = 0;
+}
+
+
+static inline void mibGetDot11PowerSavingLevel( hdd_adapter_t *pAdapter, eMib_dot11PowerSavingLevel *pMibDot11PowerSavingLevel )
+{
+    *pMibDot11PowerSavingLevel = pAdapter->hdd_mib.mibDot11PowerSavingLevel;
+    
+    return;
+}
+
+
+static inline void mibGetDevicePowerState( hdd_adapter_t *pAdapter, eMib_DevicePowerState *pMibDevicePowerState )
+{
+    *pMibDevicePowerState = pAdapter->hdd_mib.mibDevicePowerState;
+
+    return;
+}
+
+
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
new file mode 100644
index 0000000..4ca922c
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -0,0 +1,1230 @@
+/*
+ * 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  wlan_hdd_p2p.c
+
+  \brief WLAN Host Device Driver implementation for P2P commands interface
+
+  Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+  Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+#ifdef CONFIG_CFG80211
+
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_hostapd.h>
+#include <net/cfg80211.h>
+#include "sme_Api.h"
+#include "wlan_hdd_p2p.h"
+#include "sapApi.h"
+
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/etherdevice.h>
+#include <net/ieee80211_radiotap.h>
+
+extern struct net_device_ops net_ops_struct;
+
+static int hdd_wlan_add_rx_radiotap_hdr( struct sk_buff *skb,
+                                         int rtap_len, int flag );
+
+static void hdd_wlan_tx_complete( hdd_adapter_t* pAdapter,
+                                  hdd_cfg80211_state_t* cfgState,
+                                  tANI_BOOLEAN actionSendSuccess );
+
+static void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter,
+                                               tANI_U32 nFrameLength, 
+                                               tANI_U8* pbFrames,
+                                               tANI_U8 frameType );
+
+#ifdef WLAN_FEATURE_P2P
+eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
+                                                eHalStatus status )
+{
+    hdd_adapter_t *pAdapter = (hdd_adapter_t*) pCtx;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
+
+    if( pRemainChanCtx == NULL )
+    {
+       hddLog( LOGW,
+          "%s: No Rem on channel pending for which Rsp is received", __func__);
+       return eHAL_STATUS_SUCCESS;
+    }
+
+    hddLog( LOG1, "Received remain on channel rsp");
+
+    cfgState->remain_on_chan_ctx = NULL;
+
+    if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
+    {
+        if( cfgState->buf )
+        {
+           hddLog( LOGP, 
+                   "%s: We need to receive yet an ack from one of tx packet",
+                   __func__);
+        }
+        cfg80211_remain_on_channel_expired( pRemainChanCtx->dev,
+                              pRemainChanCtx->cookie,
+                              &pRemainChanCtx->chan,
+                              pRemainChanCtx->chan_type, GFP_KERNEL );
+    }
+
+    vos_mem_free( pRemainChanCtx );
+
+    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+       )
+    {
+        tANI_U8 sessionId = pAdapter->sessionId;
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        {
+            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
+                sessionId = pAdapter->p2pSessionId;
+        }
+        sme_DeregisterMgmtFrame(
+                   hHal, sessionId,
+                   (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
+                    NULL, 0 );
+    }
+    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
+    {
+        WLANSAP_DeRegisterMgmtFrame(
+                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
+                NULL, 0 );
+    }
+
+    complete(&pAdapter->cancel_rem_on_chan_var);
+    return eHAL_STATUS_SUCCESS;
+}
+
+static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy,
+                                   struct net_device *dev,
+                                   struct ieee80211_channel *chan,
+                                   enum nl80211_channel_type channel_type,
+                                   unsigned int duration, u64 *cookie,
+                                   rem_on_channel_request_type_t request_type )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx;
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    int status = 0;
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+                                 __func__,pAdapter->device_mode);
+
+    hddLog( LOG1,
+        "chan(hw_val)0x%x chan(centerfreq) %d chan type 0x%x, duration %d",
+        chan->hw_value, chan->center_freq, channel_type, duration );
+
+    if( cfgState->remain_on_chan_ctx != NULL)
+    {
+        /* Wait till remain on channel ready indication before issuing cancel 
+         * remain on channel request, otherwise if remain on channel not 
+         * received and if the driver issues cancel remain on channel then lim 
+         * will be in unknown state.
+         */
+        status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
+               msecs_to_jiffies(WAIT_REM_CHAN_READY));
+        if (!status)
+        {
+            hddLog( LOGE, 
+                    "%s: timeout waiting for remain on channel ready indication",
+                    __func__);
+        }
+
+        INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
+        
+        /* Issue abort remain on chan request to sme.
+         * The remain on channel callback will make sure the remain_on_chan
+         * expired event is sent.
+        */
+        if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+             ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+           )
+        {
+            sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
+                                                     pAdapter->sessionId );
+        }
+        else if ( (WLAN_HDD_SOFTAP== pAdapter->device_mode) ||
+                  (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+                )
+        {
+            WLANSAP_CancelRemainOnChannel(
+                                     (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+        }
+        
+        wait_for_completion_interruptible_timeout(&pAdapter->cancel_rem_on_chan_var,
+               msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
+    }
+
+    /* When P2P-GO and if we are trying to unload the driver then 
+     * wlan driver is keep on receiving the remain on channel command
+     * and which is resulting in crash. So not allowing any remain on 
+     * channel requets when Load/Unload is in progress*/
+    if (((hdd_context_t*)pAdapter->pHddCtx)->isLoadUnloadInProgress)
+    {
+        hddLog( LOGE,
+                "%s: Wlan Load/Unload is in progress", __func__);
+        return -EBUSY;
+    }
+
+    pRemainChanCtx = vos_mem_malloc( sizeof(hdd_remain_on_chan_ctx_t) );
+    if( NULL == pRemainChanCtx )
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL,
+             "%s: Not able to allocate memory for Channel context",
+                                         __func__);
+        return -ENOMEM;
+    }
+
+    vos_mem_copy( &pRemainChanCtx->chan, chan,
+                   sizeof(struct ieee80211_channel) );
+
+    pRemainChanCtx->chan_type = channel_type;
+    pRemainChanCtx->duration = duration;
+    pRemainChanCtx->dev = dev;
+    *cookie = (tANI_U32) pRemainChanCtx;
+    pRemainChanCtx->cookie = *cookie;
+    pRemainChanCtx->rem_on_chan_request = request_type;
+    cfgState->remain_on_chan_ctx = pRemainChanCtx;
+    cfgState->current_freq = chan->center_freq;
+    
+    INIT_COMPLETION(pAdapter->rem_on_chan_ready_event);
+
+    //call sme API to start remain on channel.
+    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+       )
+    {
+        tANI_U8 sessionId = pAdapter->sessionId; 
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        {
+            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
+                sessionId = pAdapter->p2pSessionId;
+        }
+        //call sme API to start remain on channel.
+        sme_RemainOnChannel(
+                       WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId,
+                       chan->hw_value, duration,
+                       wlan_hdd_remain_on_channel_callback, pAdapter );
+
+        sme_RegisterMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                              sessionId, (SIR_MAC_MGMT_FRAME << 2) |
+                              (SIR_MAC_MGMT_PROBE_REQ << 4), NULL, 0 );
+
+    }
+    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
+    {
+        //call sme API to start remain on channel.
+        if (eHAL_STATUS_SUCCESS != WLANSAP_RemainOnChannel(
+                          (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                          chan->hw_value, duration,
+                          wlan_hdd_remain_on_channel_callback, pAdapter ))
+
+        {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANSAP_RemainOnChannel returned fail", __func__);
+           cfgState->remain_on_chan_ctx = NULL;
+           vos_mem_free (pRemainChanCtx);             
+           return -EINVAL;
+        }
+
+
+        if (eHAL_STATUS_SUCCESS != WLANSAP_RegisterMgmtFrame(
+                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                    (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
+                    NULL, 0 ))
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANSAP_RegisterMgmtFrame returned fail", __func__);
+            WLANSAP_CancelRemainOnChannel(
+                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+            return -EINVAL;
+        }
+
+    }
+    return 0;
+
+}
+
+int wlan_hdd_cfg80211_remain_on_channel( struct wiphy *wiphy,
+                                struct net_device *dev,
+                                struct ieee80211_channel *chan,
+                                enum nl80211_channel_type channel_type,
+                                unsigned int duration, u64 *cookie )
+{
+    return wlan_hdd_request_remain_on_channel(wiphy, dev,
+                                        chan, channel_type, duration, cookie,
+                                        REMAIN_ON_CHANNEL_REQUEST);
+}
+
+void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter )
+{
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    hdd_remain_on_chan_ctx_t* pRemainChanCtx = cfgState->remain_on_chan_ctx;
+
+    hddLog( LOG1, "Ready on chan ind");
+
+    if( pRemainChanCtx != NULL )
+    {
+        if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
+        {
+            cfg80211_ready_on_channel( pAdapter->dev, (tANI_U32)pRemainChanCtx,
+                               &pRemainChanCtx->chan, pRemainChanCtx->chan_type,
+                               pRemainChanCtx->duration, GFP_KERNEL );
+        }
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+        else if( OFF_CHANNEL_ACTION_TX == pRemainChanCtx->rem_on_chan_request )
+        {
+            complete(&pAdapter->offchannel_tx_event);
+        }
+#endif
+        complete(&pAdapter->rem_on_chan_ready_event);
+    }
+    else
+    {
+        hddLog( LOGW, "%s: No Pending Remain on channel Request", __func__);
+    }
+    return;
+}
+
+int wlan_hdd_cfg80211_cancel_remain_on_channel( struct wiphy *wiphy,
+                                      struct net_device *dev, u64 cookie )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    int status = 0;
+
+    hddLog( LOG1, "Cancel remain on channel req");
+
+    /* FIXME cancel currently running remain on chan.
+     * Need to check cookie and cancel accordingly
+     */
+    if( (cfgState->remain_on_chan_ctx == NULL) ||
+        (cfgState->remain_on_chan_ctx->cookie != cookie) )
+    {
+        hddLog( LOGE,
+            "%s: No Remain on channel pending with specified cookie value",
+             __func__);
+        return -EINVAL;
+    }
+    
+    /* wait until remain on channel ready event received 
+     * for already issued remain on channel request */
+    status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
+            msecs_to_jiffies(WAIT_REM_CHAN_READY));
+    if (!status)
+    {
+        hddLog( LOGE, 
+                "%s: timeout waiting for remain on channel ready indication",
+                __func__);
+    }
+    INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
+    /* Issue abort remain on chan request to sme.
+     * The remain on channel callback will make sure the remain_on_chan
+     * expired event is sent.
+     */
+    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+       )
+    {
+        tANI_U8 sessionId = pAdapter->sessionId; 
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        {
+            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
+                sessionId = pAdapter->p2pSessionId;
+        }
+        sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
+                                            sessionId );
+    }
+    else if ( (WLAN_HDD_SOFTAP== pAdapter->device_mode) ||
+              (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+            )
+    {
+        WLANSAP_CancelRemainOnChannel(
+                                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+    }
+    else 
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid device_mode = %d",
+                            __func__, pAdapter->device_mode);
+       return -EIO;
+    }
+    wait_for_completion_interruptible_timeout(&pAdapter->cancel_rem_on_chan_var,
+            msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
+    return 0;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan, bool offchan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid, unsigned int wait,
+                     const u8 *buf, size_t len,  bool no_cck,
+                     bool dont_wait_for_ack, u64 *cookie )
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan, bool offchan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid, unsigned int wait,
+                     const u8 *buf, size_t len, u64 *cookie )
+#else
+int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
+                     struct ieee80211_channel *chan,
+                     enum nl80211_channel_type channel_type,
+                     bool channel_type_valid,
+                     const u8 *buf, size_t len, u64 *cookie )
+#endif //LINUX_VERSION_CODE
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    hdd_adapter_t *goAdapter;
+#endif
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+                            __func__,pAdapter->device_mode);
+
+    //Call sme API to send out a action frame.
+    // OR can we send it directly through data path??
+    // After tx completion send tx status back.
+    if ( ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+       )
+    {
+        tANI_U8 type = WLAN_HDD_GET_TYPE_FRM_FC(buf[0]);
+        tANI_U8 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(buf[0]);
+        if (type == SIR_MAC_MGMT_FRAME)
+        {
+            if (subType == SIR_MAC_MGMT_PROBE_RSP)
+            {
+                /* Drop Probe response recieved from supplicant, as for GO and 
+                   SAP PE itself sends probe response
+                   */ 
+                goto err_rem_channel;
+            }
+            else if ((subType == SIR_MAC_MGMT_DISASSOC) ||
+                    (subType == SIR_MAC_MGMT_DEAUTH))
+            {
+                /* Deauth/Disassoc received from supplicant, If we simply 
+                 * transmit the frame over air, driver doesn't come to know 
+                 * about the deauth/disassoc. Because of this reason the 
+                 * supplicant and driver will be out of sync.
+                 * Drop the frame here and initiate the disassoc procedure 
+                 * from driver, the core stack will take care of sending
+                 * disassoc frame and indicating corresponding events to supplicant.
+                 */
+                tANI_U8 dstMac[ETH_ALEN] = {0};
+                memcpy(&dstMac, &buf[WLAN_HDD_80211_FRM_DA_OFFSET], ETH_ALEN);
+                hddLog(VOS_TRACE_LEVEL_INFO, 
+                        "%s: Deauth/Disassoc received for STA:"
+                        "%02x:%02x:%02x:%02x:%02x:%02x", 
+                        __func__, 
+                        dstMac[0], dstMac[1], dstMac[2], 
+                        dstMac[3], dstMac[4], dstMac[5]);
+                hdd_softap_sta_disassoc(pAdapter, (v_U8_t *)&dstMac);
+                goto err_rem_channel;
+            }
+        }
+    }
+
+    if( NULL != cfgState->buf )
+        return -EBUSY;
+
+    hddLog( LOG1, "Action frame tx request");
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    goAdapter = hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_P2P_GO );
+
+    //If GO adapter exists and operating on same frequency
+    //then we will not request remain on channel
+    if( goAdapter && ( ieee80211_frequency_to_channel(chan->center_freq)
+                         == goAdapter->sessionCtx.ap.operatingChannel ) )
+    {
+        goto send_frame;
+    }
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    if( offchan && wait)
+    {
+        int status;
+
+        // In case of P2P Client mode if we are already
+        // on the same channel then send the frame directly
+
+        if((cfgState->remain_on_chan_ctx != NULL) &&
+           (cfgState->current_freq == chan->center_freq)
+          )
+        {
+            goto send_frame;
+        }
+
+        INIT_COMPLETION(pAdapter->offchannel_tx_event);
+
+        status = wlan_hdd_request_remain_on_channel(wiphy, dev,
+                                        chan, channel_type, wait, cookie,
+                                        OFF_CHANNEL_ACTION_TX);
+
+        if(0 != status)
+        {
+            if( (-EBUSY == status) &&
+                (cfgState->current_freq == chan->center_freq) )
+            {
+                goto send_frame;
+            }
+            goto err_rem_channel;
+        }
+
+        /* Wait for driver to be ready on the requested channel */
+        status = wait_for_completion_interruptible_timeout(
+                     &pAdapter->offchannel_tx_event,
+                     msecs_to_jiffies(WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX));
+        if(!status)
+        {
+            hddLog( LOGE, "Not able to complete remain on channel request"
+                          " within timeout period");
+            goto err_rem_channel;
+        }
+    }
+    else if ( offchan )
+    {
+        /* Check before sending action frame 
+           whether we already remain on channel */ 
+        if(NULL == cfgState->remain_on_chan_ctx)
+        {
+            goto err_rem_channel;
+        }
+    }
+    send_frame:
+#endif
+
+    cfgState->buf = vos_mem_malloc( len ); //buf;
+    if( cfgState->buf == NULL )
+        return -ENOMEM;
+
+    cfgState->len = len;
+
+    vos_mem_copy( cfgState->buf, buf, len);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    if( cfgState->remain_on_chan_ctx )
+    {
+        cfgState->action_cookie = cfgState->remain_on_chan_ctx->cookie;
+        *cookie = cfgState->action_cookie;
+    }
+    else
+    {
+#endif
+        *cookie = (tANI_U32) cfgState->buf;
+        cfgState->action_cookie = *cookie;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    }
+#endif
+
+    if ( (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+         (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
+       )
+    {
+        tANI_U8 sessionId = pAdapter->sessionId; 
+        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        {
+            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
+            {
+                sessionId = pAdapter->p2pSessionId;
+                vos_mem_copy((void*) (&buf[10]), 
+                             (void*) (&pHddCtx->p2pDeviceAddress.bytes[0]),
+                                     sizeof(tSirMacAddr));
+            }
+        }
+        if (eHAL_STATUS_SUCCESS !=
+               sme_sendAction( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                               sessionId, buf, len) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                     "%s: sme_sendAction returned fail", __func__);
+            goto err;
+        }
+    }
+    else if( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
+     {
+        if( eHAL_STATUS_SUCCESS !=
+             WLANSAP_SendAction( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                  buf, len ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANSAP_SendAction returned fail", __func__);
+            goto err;
+        }
+    }
+
+    return 0;
+err:
+    hdd_sendActionCnf( pAdapter, FALSE );
+    return 0;
+err_rem_channel:
+    *cookie = (tANI_U32)cfgState;
+    cfg80211_mgmt_tx_status( pAdapter->dev, *cookie, buf, len, FALSE, GFP_KERNEL );
+    return 0;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 
+                                          struct net_device *dev,
+                                          u64 cookie)
+{
+    return wlan_hdd_cfg80211_cancel_remain_on_channel( wiphy, dev, cookie );
+}
+#endif
+
+void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess )
+{
+    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+
+    hddLog( LOG1, "Send Action cnf, actionSendSuccess %d", actionSendSuccess);
+    if( NULL == cfgState->buf )
+    {
+        VOS_ASSERT( cfgState->buf );
+        return;
+    }
+
+    /* If skb is NULL it means this packet was received on CFG80211 interface
+     * else it was received on Monitor interface */
+    if( cfgState->skb == NULL )
+    {
+        /*
+         * buf is the same pointer it passed us to send. Since we are sending
+         * it through control path, we use different buffers.
+         * In case of mac80211, they just push it to the skb and pass the same
+         * data while sending tx ack status.
+         * */
+         cfg80211_mgmt_tx_status( pAdapter->dev, cfgState->action_cookie,
+                cfgState->buf, cfgState->len, actionSendSuccess, GFP_KERNEL );
+         vos_mem_free( cfgState->buf );
+         cfgState->buf = NULL;
+    }
+    else
+    {
+        hdd_adapter_t* pMonAdapter =
+                    hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_MONITOR );
+        if( pMonAdapter == NULL )
+        {
+            hddLog( LOGE, "Not able to get Monitor Adapter");
+            cfgState->skb = NULL;
+            vos_mem_free( cfgState->buf );
+            cfgState->buf = NULL;
+            complete(&pAdapter->tx_action_cnf_event);
+            return;
+        }
+        /* Send TX completion feedback over monitor interface. */
+        hdd_wlan_tx_complete( pMonAdapter, cfgState, actionSendSuccess );
+        cfgState->skb = NULL;
+        vos_mem_free( cfgState->buf );
+        cfgState->buf = NULL;
+        /* Look for the next Mgmt packet to TX */
+        hdd_mon_tx_mgmt_pkt(pAdapter);
+    }
+    complete(&pAdapter->tx_action_cnf_event);
+}
+
+/**
+ * hdd_setP2pNoa
+ *
+ *FUNCTION:
+ * This function is called from hdd_hostapd_ioctl function when Driver 
+ * get P2P_SET_NOA comand from wpa_supplicant using private ioctl
+ *
+ *LOGIC:
+ * Fill NoA Struct According to P2P Power save Option and Pass it to SME layer 
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param  dev         Pointer to net device structure
+ * @param  command     Pointer to command 
+ *
+ * @return Status
+ */
+
+int hdd_setP2pNoa( struct net_device *dev, tANI_U8 *command )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tP2pPsConfig NoA;
+    int count, duration, interval;
+    char *param;
+
+    param = strchr(command, ' ');
+    if (param == NULL)
+        return -1;
+    param++;
+    sscanf(param, "%d %d %d", &count, &duration, &interval);
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               "%s: P2P_SET GO NoA: count=%d duration=%d interval=%d \n",
+                __func__, count, duration, interval);
+
+    /* PS Selection
+     * Periodic NoA (2)
+     * Single NOA   (4)
+     */
+    NoA.opp_ps = 0;
+    NoA.ctWindow = 0;
+    if (count == 1)
+    {
+        NoA.duration = 0;
+        NoA.single_noa_duration = duration;
+        NoA.psSelection = P2P_POWER_SAVE_TYPE_SINGLE_NOA;
+    }
+    else
+    {
+        NoA.duration = duration;
+        NoA.single_noa_duration = 0;
+        NoA.psSelection = P2P_POWER_SAVE_TYPE_PERIODIC_NOA;
+    }
+    NoA.interval = interval;
+    NoA.count = count;
+    NoA.sessionid = pAdapter->sessionId;
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d "
+                "interval %d count %d single noa duration %d "
+                "PsSelection %x \n", __func__, NoA.opp_ps, 
+                NoA.ctWindow, NoA.duration, NoA.interval, 
+                NoA.count, NoA.single_noa_duration,
+                NoA.psSelection);
+
+    sme_p2pSetPs(hHal, &NoA);
+    return status;
+}
+
+/**
+ * hdd_setP2pOpps
+ *
+ *FUNCTION:
+ * This function is called from hdd_hostapd_ioctl function when Driver
+ * get P2P_SET_PS comand from wpa_supplicant using private ioctl
+ *
+ *LOGIC:
+ * Fill NoA Struct According to P2P Power save Option and Pass it to SME layer
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param  dev         Pointer to net device structure
+ * @param  command     Pointer to command
+ *
+ * @return Status
+ */
+
+int hdd_setP2pOpps( struct net_device *dev, tANI_U8 *command )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tP2pPsConfig NoA;
+    char *param;
+    int legacy_ps, opp_ps, ctwindow;
+
+    param = strchr(command, ' ');
+    if (param == NULL)
+        return -1;
+    param++;
+    sscanf(param, "%d %d %d", &legacy_ps, &opp_ps, &ctwindow);
+    VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                 "%s: P2P_SET GO PS: legacy_ps=%d opp_ps=%d ctwindow=%d \n",
+                 __func__, legacy_ps, opp_ps, ctwindow);
+
+    /* PS Selection
+     * Opportunistic Power Save (1)
+     */
+
+    /* From wpa_cli user need to use separate command to set ctWindow and Opps
+     * When user want to set ctWindow during that time other parameters
+     * values are coming from wpa_supplicant as -1. 
+     * Example : User want to set ctWindow with 30 then wpa_cli command : 
+     * P2P_SET ctwindow 30 
+     * Command Received at hdd_hostapd_ioctl is as below: 
+     * P2P_SET_PS -1 -1 30 (legacy_ps = -1, opp_ps = -1, ctwindow = 30)
+     */ 
+    if (ctwindow != -1)
+    {
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    "Opportunistic Power Save is %s \n", 
+                    (TRUE == pAdapter->ops) ? "Enable" : "Disable" );
+
+        if (ctwindow != pAdapter->ctw)
+        {
+            pAdapter->ctw = ctwindow;
+        
+            if(pAdapter->ops)
+            {
+                NoA.opp_ps = pAdapter->ops;
+                NoA.ctWindow = pAdapter->ctw;
+                NoA.duration = 0;
+                NoA.single_noa_duration = 0;
+                NoA.interval = 0;
+                NoA.count = 0;
+                NoA.psSelection = P2P_POWER_SAVE_TYPE_OPPORTUNISTIC;
+                NoA.sessionid = pAdapter->sessionId;
+ 
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                            "%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d "
+                            "interval %d count %d single noa duration %d "
+                            "PsSelection %x \n", __func__, NoA.opp_ps, 
+                            NoA.ctWindow, NoA.duration, NoA.interval, 
+                            NoA.count, NoA.single_noa_duration,
+                            NoA.psSelection);
+
+               sme_p2pSetPs(hHal, &NoA);
+           }
+           return 0;
+        }
+    }
+
+    if (opp_ps != -1)
+    {
+        pAdapter->ops = opp_ps;
+
+        if ((opp_ps != -1) && (pAdapter->ctw)) 
+        {
+            NoA.opp_ps = opp_ps;
+            NoA.ctWindow = pAdapter->ctw;
+            NoA.duration = 0;
+            NoA.single_noa_duration = 0;
+            NoA.interval = 0;
+            NoA.count = 0;
+            NoA.psSelection = P2P_POWER_SAVE_TYPE_OPPORTUNISTIC;
+            NoA.sessionid = pAdapter->sessionId;
+
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                        "%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d "
+                        "interval %d count %d single noa duration %d "
+                        "PsSelection %x \n", __func__, NoA.opp_ps, 
+                        NoA.ctWindow, NoA.duration, NoA.interval, 
+                        NoA.count, NoA.single_noa_duration,
+                        NoA.psSelection);
+
+           sme_p2pSetPs(hHal, &NoA);
+        }
+    }
+    return status;
+}
+
+int hdd_setP2pPs( struct net_device *dev, void *msgData )
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tP2pPsConfig NoA;
+    p2p_app_setP2pPs_t *pappNoA = (p2p_app_setP2pPs_t *) msgData;
+
+    NoA.opp_ps = pappNoA->opp_ps;
+    NoA.ctWindow = pappNoA->ctWindow;
+    NoA.duration = pappNoA->duration;
+    NoA.interval = pappNoA->interval;
+    NoA.count = pappNoA->count;
+    NoA.single_noa_duration = pappNoA->single_noa_duration;
+    NoA.psSelection = pappNoA->psSelection;
+    NoA.sessionid = pAdapter->sessionId;
+
+    sme_p2pSetPs(hHal, &NoA);
+    return status;
+}
+#endif
+
+static tANI_U8 wlan_hdd_get_session_type( enum nl80211_iftype type )
+{
+    tANI_U8 sessionType;
+
+    switch( type )
+    {
+        case NL80211_IFTYPE_AP:
+            sessionType = WLAN_HDD_SOFTAP;
+            break;
+        case NL80211_IFTYPE_P2P_GO:
+            sessionType = WLAN_HDD_P2P_GO;
+            break;
+        case NL80211_IFTYPE_P2P_CLIENT:
+            sessionType = WLAN_HDD_P2P_CLIENT;
+            break;
+        case NL80211_IFTYPE_STATION:
+            sessionType = WLAN_HDD_INFRA_STATION;
+            break;
+        case NL80211_IFTYPE_MONITOR:
+            sessionType = WLAN_HDD_MONITOR;
+            break;
+        default:
+            sessionType = WLAN_HDD_INFRA_STATION;
+            break;
+    }
+
+    return sessionType;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+struct net_device* wlan_hdd_add_virtual_intf(
+                  struct wiphy *wiphy, char *name, enum nl80211_iftype type,
+                  u32 *flags, struct vif_params *params )
+#else
+int wlan_hdd_add_virtual_intf( struct wiphy *wiphy, char *name,
+                               enum nl80211_iftype type,
+                               u32 *flags, struct vif_params *params )
+#endif
+{
+    hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+    hdd_adapter_t* pAdapter = NULL;
+
+    ENTER();
+
+    if ( pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated )
+    {
+        if( (NL80211_IFTYPE_P2P_GO == type) || 
+            (NL80211_IFTYPE_P2P_CLIENT == type) )
+        {
+            /* Generate the P2P Interface Address. this address must be
+             * different from the P2P Device Address.
+             */
+            v_MACADDR_t p2pDeviceAddress = pHddCtx->p2pDeviceAddress;
+            p2pDeviceAddress.bytes[4] ^= 0x80;
+            pAdapter = hdd_open_adapter( pHddCtx, 
+                                         wlan_hdd_get_session_type(type),
+                                         name, p2pDeviceAddress.bytes,
+                                         VOS_TRUE );
+        }
+    }
+    else
+    {
+       pAdapter = hdd_open_adapter( pHddCtx, wlan_hdd_get_session_type(type),
+                          name, wlan_hdd_get_intf_addr(pHddCtx), VOS_TRUE );
+    }
+
+    if( NULL == pAdapter)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: hdd_open_adapter failed",__func__);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+        return NULL;
+#else
+        return -EINVAL;
+#endif
+    }
+    EXIT();
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+    return pAdapter->dev;
+#else
+    return 0;
+#endif
+}
+
+int wlan_hdd_del_virtual_intf( struct wiphy *wiphy, struct net_device *dev )
+{
+     hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+     hdd_adapter_t *pVirtAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+     ENTER();
+
+     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+            __func__,pVirtAdapter->device_mode);
+
+     wlan_hdd_release_intf_addr( pHddCtx,
+                                 pVirtAdapter->macAddressCurrent.bytes );
+
+     hdd_stop_adapter( pHddCtx, pVirtAdapter );
+     hdd_close_adapter( pHddCtx, pVirtAdapter, TRUE );
+     EXIT();
+     return 0;
+}
+
+void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter,
+                                        tANI_U32 nFrameLength, tANI_U8* pbFrames,
+                                        tANI_U8 frameType )  
+{
+    //Indicate a Frame over Monitor Intf.
+    int rxstat;
+    struct sk_buff *skb = NULL;
+    int needed_headroom = 0;
+    int flag = HDD_RX_FLAG_IV_STRIPPED | HDD_RX_FLAG_DECRYPTED |
+               HDD_RX_FLAG_MMIC_STRIPPED;
+
+    hddLog( LOG1, FL("Indicate Frame over Monitor Intf"));
+
+    VOS_ASSERT( (pbFrames != NULL) );
+
+    /* room for the radiotap header based on driver features
+     * 1 Byte for RADIO TAP Flag, 1 Byte padding and 2 Byte for
+     * RX flags.
+     * */
+     needed_headroom = sizeof(struct ieee80211_radiotap_header) + 4;
+
+     //alloc skb  here
+     skb = alloc_skb(VPKT_SIZE_BUFFER, GFP_ATOMIC);
+     if (unlikely(NULL == skb))
+     {
+         hddLog( LOGW, FL("Unable to allocate skb"));
+         return;
+     }
+     skb_reserve(skb, VPKT_SIZE_BUFFER);
+     if (unlikely(skb_headroom(skb) < nFrameLength))
+     {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "HDD [%d]: Insufficient headroom, "
+                   "head[%p], data[%p], req[%d]",
+                   __LINE__, skb->head, skb->data, nFrameLength);
+         kfree_skb(skb);
+         return ;
+     }
+     // actually push the data
+     memcpy(skb_push(skb, nFrameLength), pbFrames, nFrameLength);
+     /* prepend radiotap information */
+     if( 0 != hdd_wlan_add_rx_radiotap_hdr( skb, needed_headroom, flag ) )
+     {
+         hddLog( LOGE, FL("Not Able Add Radio Tap"));
+         //free skb
+         kfree_skb(skb);
+         return ;
+     }
+
+     skb_reset_mac_header( skb );
+     skb->dev = pMonAdapter->dev;
+     skb->protocol = eth_type_trans( skb, skb->dev );
+     skb->ip_summed = CHECKSUM_UNNECESSARY;
+     rxstat = netif_rx_ni(skb);
+     if( NET_RX_SUCCESS == rxstat )
+     {
+         hddLog( LOG1, FL("Success"));
+     }
+     else
+         hddLog( LOGE, FL("Failed %d"), rxstat);                   
+
+     return ;
+}
+
+void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter,
+                            tANI_U32 nFrameLength, 
+                            tANI_U8* pbFrames,
+                            tANI_U8 frameType,
+                            tANI_U32 rxChan )
+{
+    tANI_U16 freq;
+
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d\n",
+            __func__, frameType, nFrameLength);
+
+    if (NULL == pAdapter)
+    {
+        hddLog( LOGE, FL("pAdapter is NULL"));
+        return;
+    }
+
+    if (NULL == pAdapter->dev)
+    {
+        hddLog( LOGE, FL("pAdapter->dev is NULL"));
+        return;
+    }
+
+    if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+    {
+        hddLog( LOGE, FL("pAdapter has invalid magic"));
+        return;
+    }
+
+    if( !nFrameLength )
+    {
+        hddLog( LOGE, FL("Frame Length is Invalid ZERO"));
+        return;
+    }
+
+    if( ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) 
+            || ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+      )
+    {
+        hdd_adapter_t *pMonAdapter =
+            hdd_get_mon_adapter( WLAN_HDD_GET_CTX(pAdapter) );
+
+        if( NULL != pMonAdapter )
+        {
+            hddLog( LOG1, FL("Indicate Frame over Monitor Interface"));
+            hdd_sendMgmtFrameOverMonitorIface( pMonAdapter, nFrameLength,
+                    pbFrames, frameType);
+            return;
+        }
+    }
+
+    //Channel indicated may be wrong. TODO
+    //Indicate an action frame.
+    if( rxChan <= MAX_NO_OF_2_4_CHANNELS )
+    {
+        freq = ieee80211_channel_to_frequency( rxChan,
+                IEEE80211_BAND_2GHZ);
+    }
+    else
+    {
+        freq = ieee80211_channel_to_frequency( rxChan,
+                IEEE80211_BAND_5GHZ);
+    }
+
+    //Indicate Frame Over Normal Interface
+    hddLog( LOG1, FL("Indicate Frame over NL80211 Interface"));
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+    cfg80211_rx_mgmt( pAdapter->dev, freq, 0,
+                      pbFrames, nFrameLength,
+                      GFP_ATOMIC );
+#else
+    cfg80211_rx_mgmt( pAdapter->dev, freq,
+                      pbFrames, nFrameLength,
+                      GFP_ATOMIC );
+#endif //LINUX_VERSION_CODE
+}
+
+/*
+ * ieee80211_add_rx_radiotap_header - add radiotap header
+ */
+static int hdd_wlan_add_rx_radiotap_hdr (
+             struct sk_buff *skb, int rtap_len, int flag )
+{
+    u8 rtap_temp[20] = {0};
+    struct ieee80211_radiotap_header *rthdr;
+    unsigned char *pos;
+    u16 rx_flags = 0;
+
+    rthdr = (struct ieee80211_radiotap_header *)(&rtap_temp[0]);
+
+    /* radiotap header, set always present flags */
+    rthdr->it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS)   |
+                                    (1 << IEEE80211_RADIOTAP_RX_FLAGS));
+    rthdr->it_len = cpu_to_le16(rtap_len);
+
+    pos = (unsigned char *) (rthdr + 1);
+
+    /* the order of the following fields is important */
+
+    /* IEEE80211_RADIOTAP_FLAGS */
+    *pos = 0;
+    pos++;
+
+    /* IEEE80211_RADIOTAP_RX_FLAGS: Length 2 Bytes */
+    /* ensure 2 byte alignment for the 2 byte field as required */
+    if ((pos - (u8 *)rthdr) & 1)
+        pos++;
+    put_unaligned_le16(rx_flags, pos);
+    pos += 2;
+    
+    // actually push the data
+    memcpy(skb_push(skb, rtap_len), &rtap_temp[0], rtap_len);
+
+    return 0;
+}
+
+static void hdd_wlan_tx_complete( hdd_adapter_t* pAdapter,
+                                  hdd_cfg80211_state_t* cfgState,
+                                  tANI_BOOLEAN actionSendSuccess )
+{
+    struct ieee80211_radiotap_header *rthdr;
+    unsigned char *pos;
+    struct sk_buff *skb = cfgState->skb;
+
+    /* 2 Byte for TX flags and 1 Byte for Retry count */
+    u32 rtHdrLen = sizeof(*rthdr) + 3;
+
+    u8 *data;
+
+    /* We have to return skb with Data starting with MAC header. We have
+     * copied SKB data starting with MAC header to cfgState->buf. We will pull
+     * entire skb->len from skb and then we will push cfgState->buf to skb
+     * */
+    if( NULL == skb_pull(skb, skb->len) )
+    {
+        hddLog( LOGE, FL("Not Able to Pull %d byte from skb"), skb->len);
+        kfree_skb(cfgState->skb);
+        return;
+    }
+
+    data = skb_push( skb, cfgState->len );
+
+    if (data == NULL)
+    {
+        hddLog( LOGE, FL("Not Able to Push %d byte to skb"), cfgState->len);
+        kfree_skb( cfgState->skb );
+        return;
+    }
+
+    memcpy( data, cfgState->buf, cfgState->len );
+
+    /* send frame to monitor interfaces now */
+    if( skb_headroom(skb) < rtHdrLen )
+    {
+        hddLog( LOGE, FL("No headroom for rtap header"));
+        kfree_skb(cfgState->skb);
+        return;
+    }
+
+    rthdr = (struct ieee80211_radiotap_header*) skb_push( skb, rtHdrLen );
+
+    memset( rthdr, 0, rtHdrLen );
+    rthdr->it_len = cpu_to_le16( rtHdrLen );
+    rthdr->it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) |
+                                    (1 << IEEE80211_RADIOTAP_DATA_RETRIES)
+                                   );
+
+    pos = (unsigned char *)( rthdr+1 );
+
+    // Fill TX flags
+    *pos = actionSendSuccess;
+    pos += 2;
+
+    // Fill retry count
+    *pos = 0;
+    pos++;
+
+    skb_set_mac_header( skb, 0 );
+    skb->ip_summed = CHECKSUM_UNNECESSARY;
+    skb->pkt_type  = PACKET_OTHERHOST;
+    skb->protocol  = htons(ETH_P_802_2);
+    memset( skb->cb, 0, sizeof( skb->cb ) );
+    if (in_interrupt())
+        netif_rx( skb );
+    else
+        netif_rx_ni( skb );
+
+    /* Enable Queues which we have disabled earlier */
+    netif_tx_start_all_queues( pAdapter->dev ); 
+
+}
+#endif // CONFIG_CFG80211
diff --git a/CORE/HDD/src/wlan_hdd_scan.c b/CORE/HDD/src/wlan_hdd_scan.c
new file mode 100644
index 0000000..ed13968
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_scan.c
@@ -0,0 +1,1154 @@
+/*
+ * 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  wlan_hdd_scan.c
+
+  \brief WLAN Host Device Driver implementation
+
+   Copyright 2008 (c) 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
+  --------    ---    --------------------------------------------------------
+  04/5/09     Shailender     Created module.
+
+  ==========================================================================*/
+      /* To extract the Scan results */
+
+/* Add a stream event */
+
+#include <wlan_qct_driver.h>
+#include <wlan_hdd_includes.h>
+#include <vos_api.h>
+#include <palTypes.h>
+#include <aniGlobal.h>
+#include <dot11f.h>
+#ifdef WLAN_BTAMP_FEATURE
+#include "bap_hdd_misc.h"
+#endif
+
+#ifdef CONFIG_CFG80211
+#include <linux/wireless.h>
+#include <net/cfg80211.h>
+#endif
+
+#define GET_IE_LEN_IN_BSS(lenInBss) ( lenInBss + sizeof(lenInBss) - \
+              ((int) OFFSET_OF( tSirBssDescription, ieFields)))
+
+#define WEXT_CSCAN_HEADER               "CSCAN S\x01\x00\x00S\x00"
+#define WEXT_CSCAN_HEADER_SIZE          12
+#define WEXT_CSCAN_SSID_SECTION         'S'
+#define WEXT_CSCAN_CHANNEL_SECTION      'C'
+#define WEXT_CSCAN_NPROBE_SECTION       'N'
+#define WEXT_CSCAN_ACTV_DWELL_SECTION   'A'
+#define WEXT_CSCAN_PASV_DWELL_SECTION   'P'
+#define WEXT_CSCAN_HOME_DWELL_SECTION   'H'
+#define WEXT_CSCAN_TYPE_SECTION         'T'
+#define WEXT_CSCAN_PENDING_SECTION      'O'
+#define WEXT_CSCAN_TYPE_DEFAULT         0
+#define WEXT_CSCAN_TYPE_PASSIVE         1
+#define WEXT_CSCAN_PASV_DWELL_TIME      130
+#define WEXT_CSCAN_PASV_DWELL_TIME_DEF  250
+#define WEXT_CSCAN_PASV_DWELL_TIME_MAX  3000
+#define WEXT_CSCAN_HOME_DWELL_TIME      130
+#define MAX_RATES                       12
+
+#define WEXT_CSCAN_SCAN_DONE_WAIT_TIME  2000
+
+typedef struct hdd_scan_info{
+    struct net_device *dev;
+    struct iw_request_info *info;
+    char *start;
+    char *end;
+} hdd_scan_info_t, *hdd_scan_info_tp;
+
+static v_S31_t hdd_TranslateABGRateToMbpsRate(v_U8_t *pFcRate)
+{
+
+    /** Slightly more sophisticated processing has to take place here.
+              Basic rates are rounded DOWN.  HT rates are rounded UP.*/
+    return ( (( ((v_S31_t) *pFcRate) & 0x007f) * 1000000) / 2);
+}
+
+
+static eHalStatus hdd_AddIwStreamEvent(int cmd, int length, char* data, hdd_scan_info_t *pscanInfo, char **last_event, char **current_event )
+{
+    struct iw_event event;
+
+    *last_event = *current_event;
+    vos_mem_zero(&event, sizeof (struct iw_event));
+    event.cmd = cmd;
+    event.u.data.flags = 1;
+    event.u.data.length = length;
+    *current_event = iwe_stream_add_point (pscanInfo->info,*current_event, pscanInfo->end,  &event, data);
+
+    if(*last_event == *current_event)
+    {
+            /* no space to add event */
+        return -E2BIG; /* Error code, may be E2BIG */
+    }
+
+    return 0;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_GetWPARSNIEs() -
+
+   This function extract the WPA/RSN IE from the Bss descriptor IEs fields
+
+  \param  - ieFields - Pointer to the Bss Descriptor IEs.
+              - ie_length - IE Length.
+              - last_event -Points to the last event.
+              - current_event - Points to the
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+
+/* Extract the WPA and/or RSN IEs */
+static eHalStatus hdd_GetWPARSNIEs( v_U8_t *ieFields, v_U16_t ie_length, char **last_event, char **current_event, hdd_scan_info_t *pscanInfo )
+{
+    v_U8_t eid, elen, *element;
+    v_U16_t tie_length=0;
+
+    ENTER();
+
+    element = ieFields;
+    tie_length = ie_length;
+
+    while( tie_length > 2 && element != NULL )
+    {
+        eid = element[0];
+        elen = element[1];
+
+        /*If element length is greater than total remaining ie length,
+         *break the loop*/
+        if ((elen+2) > tie_length)
+           break;
+
+        switch(eid)
+        {
+            case DOT11F_EID_WPA:
+            case DOT11F_EID_RSN:
+#ifdef FEATURE_WLAN_WAPI
+            case DOT11F_EID_WAPI:
+#endif
+                if(hdd_AddIwStreamEvent( IWEVGENIE,  elen+2, (char*)element, pscanInfo, last_event, current_event ) < 0 )
+                    return -E2BIG;
+                break;
+
+            default:
+                break;
+        }
+
+        /* Next element */
+        tie_length -= (2 + elen);
+        element += 2 + elen;
+    }
+
+    return 0;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_IndicateScanResult() -
+
+   This function returns the scan results to the wpa_supplicant
+
+  \param  - scanInfo - Pointer to the scan info structure.
+              - descriptor - Pointer to the Bss Descriptor.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+#define MAX_CUSTOM_LEN 64
+static eHalStatus hdd_IndicateScanResult(hdd_scan_info_t *scanInfo, tCsrScanResultInfo *scan_result)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(scanInfo->dev) ;
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+   tSirBssDescription *descriptor = &scan_result->BssDescriptor;
+   struct iw_event event;
+   char *current_event = scanInfo->start;
+   char *end = scanInfo->end;
+   char *last_event;
+   char *current_pad;
+   v_U16_t ie_length = 0;
+   v_U16_t capabilityInfo;
+   char *modestr;
+   int error;
+   char custom[MAX_CUSTOM_LEN];
+   char *p;
+
+   hddLog( LOG1, "hdd_IndicateScanResult %02x:%02x:%02x:%02x:%02x:%02x",
+          descriptor->bssId[0],
+          descriptor->bssId[1],
+          descriptor->bssId[2],
+          descriptor->bssId[3],
+          descriptor->bssId[4],
+          descriptor->bssId[5]);
+
+   error = 0;
+   last_event = current_event;
+   vos_mem_zero(&event, sizeof (event));
+
+   /* BSSID */
+   event.cmd = SIOCGIWAP;
+   event.u.ap_addr.sa_family = ARPHRD_ETHER;
+   vos_mem_copy (event.u.ap_addr.sa_data, descriptor->bssId,
+                  sizeof (descriptor->bssId));
+   current_event = iwe_stream_add_event(scanInfo->info,current_event, end,
+                   &event, IW_EV_ADDR_LEN);
+
+   if (last_event == current_event)
+   {
+      /* no space to add event */
+      /* Error code may be E2BIG */
+       hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWAP ");
+       return -E2BIG;
+   }
+
+   last_event = current_event;
+   vos_mem_zero(&event, sizeof (struct iw_event));
+
+ /* Protocol Name */
+   event.cmd = SIOCGIWNAME;
+
+   switch (descriptor->nwType)
+   {
+   case eSIR_11A_NW_TYPE:
+       modestr = "a";
+       break;
+   case eSIR_11B_NW_TYPE:
+       modestr = "b";
+       break;
+   case eSIR_11G_NW_TYPE:
+       modestr = "g";
+       break;
+   case eSIR_11N_NW_TYPE:
+       modestr = "n";
+       break;
+   default:
+       hddLog( LOGW, "%s: Unknown network type [%d]",
+              __FUNCTION__, descriptor->nwType);
+       modestr = "?";
+       break;
+   }
+   snprintf(event.u.name, IFNAMSIZ, "IEEE 802.11%s", modestr);
+   current_event = iwe_stream_add_event(scanInfo->info,current_event, end,
+                   &event, IW_EV_CHAR_LEN);
+
+   if (last_event == current_event)
+   { /* no space to add event */
+       hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWNAME");
+      /* Error code, may be E2BIG */
+       return -E2BIG;
+   }
+
+   last_event = current_event;
+   vos_mem_zero( &event, sizeof (struct iw_event));
+
+   /*Freq*/
+   event.cmd = SIOCGIWFREQ;
+
+   event.u.freq.m = descriptor->channelId;
+   event.u.freq.e = 0;
+   event.u.freq.i = 0;
+   current_event = iwe_stream_add_event(scanInfo->info,current_event, end,
+                                        &event, IW_EV_FREQ_LEN);
+
+   if (last_event == current_event)
+   { /* no space to add event */
+       return -E2BIG;
+   }
+
+   last_event = current_event;
+   vos_mem_zero( &event, sizeof (struct iw_event));
+
+   /* BSS Mode */
+   event.cmd = SIOCGIWMODE;
+
+   capabilityInfo = descriptor->capabilityInfo;
+
+   if (SIR_MAC_GET_ESS(capabilityInfo))
+   {
+       event.u.mode = IW_MODE_INFRA;
+   }
+   else if (SIR_MAC_GET_IBSS(capabilityInfo))
+   {
+       event.u.mode = IW_MODE_ADHOC;
+   }
+   else
+   {
+       /* neither ESS or IBSS */
+       event.u.mode = IW_MODE_AUTO;
+   }
+
+   current_event = iwe_stream_add_event(scanInfo->info,current_event, end,
+                                        &event, IW_EV_UINT_LEN);
+
+   if (last_event == current_event)
+   { /* no space to add event */
+       hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWMODE");
+       return -E2BIG;
+   }
+   /* To extract SSID */
+   ie_length = GET_IE_LEN_IN_BSS( descriptor->length );
+
+   if (ie_length > 0)
+   {
+       tDot11fBeaconIEs dot11BeaconIEs;
+       tDot11fIESSID *pDot11SSID;
+       tDot11fIESuppRates *pDot11SuppRates;
+       tDot11fIEExtSuppRates *pDot11ExtSuppRates;
+       tDot11fIEHTCaps *pDot11IEHTCaps;
+       int numBasicRates = 0;
+       int maxNumRates = 0;
+
+       pDot11IEHTCaps = NULL;
+
+       dot11fUnpackBeaconIEs ((tpAniSirGlobal)
+           hHal, (tANI_U8 *) descriptor->ieFields, ie_length,  &dot11BeaconIEs);
+
+       pDot11SSID = &dot11BeaconIEs.SSID;
+
+
+       if (pDot11SSID->present ) {
+          last_event = current_event;
+          vos_mem_zero (&event, sizeof (struct iw_event));
+
+          event.cmd = SIOCGIWESSID;
+          event.u.data.flags = 1;
+          event.u.data.length = scan_result->ssId.length;
+          current_event = iwe_stream_add_point (scanInfo->info,current_event, end,
+                  &event, (char *)scan_result->ssId.ssId);
+
+          if(last_event == current_event)
+          { /* no space to add event */
+             hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWESSID");
+             return -E2BIG;
+          }
+       }
+
+      if( hdd_GetWPARSNIEs( ( tANI_U8 *) descriptor->ieFields, ie_length, &last_event, &current_event, scanInfo )  < 0    )
+      {
+          hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWESSID");
+          return -E2BIG;
+      }
+
+      last_event = current_event;
+      current_pad = current_event + IW_EV_LCP_LEN;
+      vos_mem_zero( &event, sizeof (struct iw_event));
+
+      /*Rates*/
+      event.cmd = SIOCGIWRATE;
+
+
+      pDot11SuppRates = &dot11BeaconIEs.SuppRates;
+
+      if (pDot11SuppRates->present )
+      {
+          int i;
+
+          numBasicRates = pDot11SuppRates->num_rates;;
+          for (i=0; i<pDot11SuppRates->num_rates; i++)
+          {
+              if (0 != (pDot11SuppRates->rates[i] & 0x7F))
+              {
+                  event.u.bitrate.value = hdd_TranslateABGRateToMbpsRate (
+                      &pDot11SuppRates->rates[i]);
+
+                  current_pad = iwe_stream_add_value (scanInfo->info,current_event,
+                      current_pad, end, &event, IW_EV_PARAM_LEN);
+              }
+          }
+
+      }
+
+      pDot11ExtSuppRates = &dot11BeaconIEs.ExtSuppRates;
+
+      if (pDot11ExtSuppRates->present )
+      {
+          int i,no_of_rates;
+          maxNumRates = numBasicRates + pDot11ExtSuppRates->num_rates;
+
+          /* Check to make sure the total number of rates
+               doesn't exceed IW_MAX_BITRATES */
+
+          maxNumRates = VOS_MIN(maxNumRates , IW_MAX_BITRATES);
+
+          if((maxNumRates - numBasicRates) > MAX_RATES)
+          {
+             no_of_rates = MAX_RATES;
+             hddLog( LOGW, "Accessing array out of bound that array is pDot11ExtSuppRates->rates ");
+          }
+          else
+          {
+            no_of_rates = maxNumRates - numBasicRates;
+          }
+          for ( i=0; i< no_of_rates ; i++ )
+          {
+              if (0 != (pDot11ExtSuppRates->rates[i] & 0x7F))
+              {
+                  event.u.bitrate.value = hdd_TranslateABGRateToMbpsRate (
+                      &pDot11ExtSuppRates->rates[i]);
+
+                  current_pad = iwe_stream_add_value (scanInfo->info,current_event,
+                      current_pad, end, &event, IW_EV_PARAM_LEN);
+              }
+          }
+      }
+
+
+      if ((current_pad - current_event) >= IW_EV_LCP_LEN)
+      {
+          current_event = current_pad;
+      }
+      else
+      {
+          if (last_event == current_event)
+          { /* no space to add event */
+              hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWRATE");
+              return -E2BIG;
+          }
+      }
+
+      last_event = current_event;
+      vos_mem_zero (&event, sizeof (struct iw_event));
+
+
+      event.cmd = SIOCGIWENCODE;
+
+      if (SIR_MAC_GET_PRIVACY(capabilityInfo))
+      {
+         event.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+      }
+      else
+      {
+         event.u.data.flags = IW_ENCODE_DISABLED;
+      }
+      event.u.data.length = 0;
+
+      current_event = iwe_stream_add_point(scanInfo->info,current_event, end, &event, (char *)pDot11SSID->ssid);
+
+
+      if(last_event == current_event)
+      { /* no space to add event
+               Error code, may be E2BIG */
+          return -E2BIG;
+      }
+   }
+
+   last_event = current_event;
+   vos_mem_zero( &event, sizeof (struct iw_event));
+
+    /*RSSI*/
+   event.cmd = IWEVQUAL;
+   event.u.qual.qual = descriptor->rssi;
+   event.u.qual.noise = descriptor->sinr;
+
+   /*To keep the rssi icon of the connected AP in the scan window
+    *and the rssi icon of the wireless networks in sync */   
+   if (( eConnectionState_Associated == 
+              pAdapter->sessionCtx.station.conn_info.connState ) &&
+              ( VOS_TRUE == vos_mem_compare(descriptor->bssId, 
+                             pAdapter->sessionCtx.station.conn_info.bssId, 
+                             WNI_CFG_BSSID_LEN)))
+   {
+      event.u.qual.level = pAdapter->rssi;
+   }
+   else
+   {
+      event.u.qual.level = VOS_MIN ((descriptor->rssi + descriptor->sinr), 0);
+   }
+   
+   event.u.qual.updated = IW_QUAL_ALL_UPDATED;
+
+   current_event = iwe_stream_add_event(scanInfo->info,current_event,
+       end, &event, IW_EV_QUAL_LEN);
+
+   if(last_event == current_event)
+   { /* no space to add event */
+       hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVQUAL");
+       return -E2BIG;
+   }
+
+
+   /* AGE */
+   event.cmd = IWEVCUSTOM;
+   p = custom;
+   p += snprintf(p, MAX_CUSTOM_LEN, " Age: %lu",
+                 vos_timer_get_system_ticks() - descriptor->nReceivedTime);
+   event.u.data.length = p - custom;
+   current_event = iwe_stream_add_point (scanInfo->info,current_event, end,
+                                         &event, custom);
+   if(last_event == current_event)
+   { /* no space to add event */
+      hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVCUSTOM (age)");
+      return -E2BIG;
+   }
+
+   scanInfo->start = current_event;
+
+   return 0;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief hdd_ScanRequestCallback() -
+
+   The sme module calls this callback function once it finish the scan request
+   and this function notifies the scan complete event to the wpa_supplicant.
+
+  \param  - halHandle - Pointer to the Hal Handle.
+              - pContext - Pointer to the data context.
+              - scanId - Scan ID.
+              - status - CSR Status.
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+static eHalStatus hdd_ScanRequestCallback(tHalHandle halHandle, void *pContext,
+                         tANI_U32 scanId, eCsrScanStatus status)
+{
+    struct net_device *dev = (struct net_device *) pContext;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+    union iwreq_data wrqu;
+    int we_event;
+    char *msg;
+    
+    ENTER();
+
+    hddLog(LOGW,"%s called with halHandle = %p, pContext = %p, scanID = %d,"
+           " returned status = %d", __FUNCTION__, halHandle, pContext,
+           (int) scanId, (int) status);
+
+    /* if there is a scan request pending when the wlan driver is unloaded
+       we may be invoked as SME flushes its pending queue.  If that is the
+       case, the underlying net_device may have already been destroyed, so
+       do some quick sanity before proceeding */
+    if (pAdapter->dev != dev)
+    {
+       hddLog(LOGW, "%s: device mismatch %p vs %p",
+               __FUNCTION__, pAdapter->dev, dev);
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    /* Check the scanId */
+    if (pAdapter->scan_info.scanId != scanId)
+    {
+        hddLog(LOGW, "%s called with mismatched scanId pAdapter->scan_info.scanId = %d "
+               "scanId = %d ", __FUNCTION__, (int) pAdapter->scan_info.scanId,
+                (int) scanId);
+    }
+
+    /* Scan is no longer pending */
+    pAdapter->scan_info.mScanPending = VOS_FALSE;
+
+    // notify any applications that may be interested
+    memset(&wrqu, '\0', sizeof(wrqu));
+    we_event = SIOCGIWSCAN;
+    msg = NULL;
+    wireless_send_event(dev, we_event, &wrqu, msg);
+
+    EXIT();
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief iw_set_scan() -
+
+   This function process the scan request from the wpa_supplicant
+   and set the scan request to the SME
+
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+
+int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
+                 union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+   hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   tCsrScanRequest scanRequest;
+   v_U32_t scanId = 0;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   struct iw_scan_req *scanReq = (struct iw_scan_req *)extra;
+
+   ENTER();
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__);
+
+#ifdef WLAN_BTAMP_FEATURE
+   //Scan not supported when AMP traffic is on.
+   if( VOS_TRUE == WLANBAP_AmpSessionOn() ) 
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__);
+       return eHAL_STATUS_SUCCESS;
+   }
+#endif
+   if(pAdapter->scan_info.mScanPending == TRUE)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__);
+       return eHAL_STATUS_SUCCESS;
+   }
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return eHAL_STATUS_SUCCESS;
+   }
+   vos_mem_zero( &scanRequest, sizeof(scanRequest));
+
+   if (NULL != wrqu->data.pointer)
+   {
+       /* set scanType, active or passive */
+       if ((IW_SCAN_TYPE_ACTIVE ==  scanReq->scan_type) || (eSIR_ACTIVE_SCAN == pAdapter->scan_info.scan_mode))
+       {
+           scanRequest.scanType = eSIR_ACTIVE_SCAN;
+       }
+       else
+       {
+           scanRequest.scanType = eSIR_PASSIVE_SCAN;
+       }
+
+       /* set bssid using sockaddr from iw_scan_req */
+       vos_mem_copy(scanRequest.bssid,
+                       &scanReq->bssid.sa_data, sizeof(scanRequest.bssid) );
+
+      if (wrqu->data.flags & IW_SCAN_THIS_ESSID)  {
+
+          if(scanReq->essid_len) {
+              scanRequest.SSIDs.numOfSSIDs = 1;
+              scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo));
+              if(scanRequest.SSIDs.SSIDList) {
+                 scanRequest.SSIDs.SSIDList->SSID.length =             scanReq->essid_len;
+                 vos_mem_copy(scanRequest.SSIDs.SSIDList->  SSID.ssId,scanReq->essid,scanReq->essid_len);
+              }
+              else
+              {
+                scanRequest.SSIDs.numOfSSIDs = 0;
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Unable to allocate memory",__FUNCTION__);
+                VOS_ASSERT(0);
+              }
+          }
+      }
+
+       /* set min and max channel time */
+       scanRequest.minChnTime = scanReq->min_channel_time;
+       scanRequest.maxChnTime = scanReq->max_channel_time;
+
+   }
+   else
+   {
+       if(pAdapter->scan_info.scan_mode == eSIR_ACTIVE_SCAN) {
+           /* set the scan type to active */
+           scanRequest.scanType = eSIR_ACTIVE_SCAN;
+       } else {
+           scanRequest.scanType = eSIR_PASSIVE_SCAN;
+       }
+
+       vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff );
+
+       /* set min and max channel time to zero */
+       scanRequest.minChnTime = 0;
+       scanRequest.maxChnTime = 0;
+   }
+
+   /* set BSSType to default type */
+   scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+
+   /*Scan all the channels */
+   scanRequest.ChannelInfo.numOfChannels = 0;
+
+   scanRequest.ChannelInfo.ChannelList = NULL;
+
+   /* set requestType to full scan */
+   scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+
+   /* if previous genIE is not NULL, update ScanIE */
+   if (0 != pwextBuf->genIE.length)
+   {
+       memset( &pAdapter->scan_info.scanAddIE, 0, sizeof(pAdapter->scan_info.scanAddIE) );
+       memcpy( pAdapter->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, 
+           pwextBuf->genIE.length );
+       pAdapter->scan_info.scanAddIE.length = pwextBuf->genIE.length;
+
+       pwextBuf->roamProfile.pAddIEScan = pAdapter->scan_info.scanAddIE.addIEdata;
+       pwextBuf->roamProfile.nAddIEScanLength = pAdapter->scan_info.scanAddIE.length;
+   
+       /* clear previous genIE after use it */
+       memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) );
+   }
+
+   /* push addIEScan in scanRequset if exist */
+   if (pAdapter->scan_info.scanAddIE.addIEdata && 
+       pAdapter->scan_info.scanAddIE.length)
+   { 
+       scanRequest.uIEFieldLen = pAdapter->scan_info.scanAddIE.length;
+       scanRequest.pIEField = pAdapter->scan_info.scanAddIE.addIEdata;
+   }
+
+   status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); 
+   if (!HAL_STATUS_SUCCESS(status))
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:sme_ScanRequest  fail %d!!!",__func__, status);
+       goto error;
+   }
+
+   pAdapter->scan_info.mScanPending = TRUE;
+
+   pAdapter->scan_info.scanId = scanId;
+
+error:
+   if ((wrqu->data.flags & IW_SCAN_THIS_ESSID) && (scanReq->essid_len))
+       vos_mem_free(scanRequest.SSIDs.SSIDList);
+
+   EXIT();
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__);
+   return status;
+}
+
+/**---------------------------------------------------------------------------
+
+  \brief iw_get_scan() -
+
+   This function returns the scan results to the wpa_supplicant
+
+  \param  - dev - Pointer to the net device.
+              - info - Pointer to the iw_request_info.
+              - wrqu - Pointer to the iwreq_data.
+              - extra - Pointer to the data.
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+
+int iw_get_scan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+   tCsrScanResultInfo *pScanResult;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   hdd_scan_info_t scanInfo;
+   tScanResultHandle pResult;
+   int i = 0;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter buffer length %d!!!",
+       __func__, (wrqu->data.length)?wrqu->data.length:IW_SCAN_MAX_DATA);
+   ENTER();
+
+   if (TRUE == pAdapter->scan_info.mScanPending)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__);
+       return -EAGAIN;
+   }
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return -EAGAIN;
+   }
+
+   scanInfo.dev = dev;
+   scanInfo.start = extra;
+   scanInfo.info = info;
+
+   if (0 == wrqu->data.length)
+   {
+       scanInfo.end = extra + IW_SCAN_MAX_DATA;
+   }
+   else
+   {
+       scanInfo.end = extra + wrqu->data.length;
+   }
+
+   status = sme_ScanGetResult(hHal,pAdapter->sessionId,NULL,&pResult);
+
+   if (NULL == pResult)
+   {
+       // no scan results
+       hddLog(LOG1,"iw_get_scan: NULL Scan Result ");
+       return 0;
+   }
+
+   pScanResult = sme_ScanResultGetFirst(hHal, pResult);
+
+   while (pScanResult)
+   {
+       status = hdd_IndicateScanResult(&scanInfo, pScanResult);
+       if (0 != status)
+       {
+           break;
+       }
+       i++;
+       pScanResult = sme_ScanResultGetNext(hHal, pResult);
+   }
+
+   sme_ScanResultPurge(hHal, pResult);
+
+   EXIT();
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit total %d BSS reported !!!",__func__, i);
+   return status;
+}
+
+#if 0
+static eHalStatus hdd_CscanRequestCallback(tHalHandle halHandle, void *pContext,
+                         tANI_U32 scanId, eCsrScanStatus status)
+{
+    struct net_device *dev = (struct net_device *) pContext;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    union iwreq_data wrqu;
+    int we_event;
+    char *msg;
+    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+    ENTER();
+
+    hddLog(LOG1,"%s called with halHandle = %p, pContext = %p, scanID = %d,"
+           " returned status = %d", __FUNCTION__, halHandle, pContext,
+            (int) scanId, (int) status);
+
+    /* Check the scanId */
+    if (pwextBuf->scanId != scanId)
+    {
+        hddLog(LOGW, "%s called with mismatched scanId pWextState->scanId = %d "
+               "scanId = %d ", __FUNCTION__, (int) pwextBuf->scanId,
+                (int) scanId);
+    }
+
+    /* Scan is no longer pending */
+    pwextBuf->mScanPending = VOS_FALSE;
+
+    // notify any applications that may be interested
+    memset(&wrqu, '\0', sizeof(wrqu));
+    we_event = SIOCGIWSCAN;
+    msg = NULL;
+    wireless_send_event(dev, we_event, &wrqu, msg);
+
+    vos_status = vos_event_set(&pwextBuf->vosevent);
+
+    if (!VOS_IS_STATUS_SUCCESS(vos_status))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos_event_set failed!!"));
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    EXIT();
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__);
+
+    return eHAL_STATUS_SUCCESS;
+}
+#endif
+
+int iw_set_cscan(struct net_device *dev, struct iw_request_info *info,
+                 union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrScanRequest scanRequest;
+    v_U32_t scanId = 0;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    v_U8_t channelIdx;
+
+    ENTER();
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__);
+
+#ifdef WLAN_BTAMP_FEATURE
+    //Scan not supported when AMP traffic is on.
+    if( VOS_TRUE == WLANBAP_AmpSessionOn() )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__);
+        return eHAL_STATUS_SUCCESS;
+    }
+#endif
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    vos_mem_zero( &scanRequest, sizeof(scanRequest));
+    if (NULL != wrqu->data.pointer)
+    {
+        char *str_ptr = NULL;
+        tCsrSSIDInfo *SsidInfo = NULL;
+        int num_ssid = 0;
+        int i, j, ssid_start;
+        hdd_scan_pending_option_e scanPendingOption = WEXT_SCAN_PENDING_GIVEUP;
+
+        /* save the original buffer */
+        str_ptr = wrqu->data.pointer;
+
+        i = WEXT_CSCAN_HEADER_SIZE;
+
+        if( WEXT_CSCAN_PENDING_SECTION == str_ptr[i] )
+        {
+            scanPendingOption = (hdd_scan_pending_option_e)str_ptr[++i];
+            ++i;
+        }
+        pAdapter->scan_info.scan_pending_option = scanPendingOption;
+
+        if(pAdapter->scan_info.mScanPending == TRUE)
+        {
+            hddLog(LOG1,"%s: mScanPending is TRUE",__func__);
+            /* If any scan is pending, just giveup this scan request */
+            if(WEXT_SCAN_PENDING_GIVEUP == scanPendingOption)
+            {
+                pAdapter->scan_info.waitScanResult = FALSE;
+                return eHAL_STATUS_SUCCESS; 
+            }
+            /* If any scan pending, wait till finish current scan,
+               and try this scan request when previous scan finish */
+            else if(WEXT_SCAN_PENDING_DELAY == scanPendingOption)
+            {
+                pAdapter->scan_info.waitScanResult = TRUE;
+                vos_event_reset(&pAdapter->scan_info.scan_finished_event);
+                if(vos_wait_single_event(&pAdapter->scan_info.scan_finished_event,
+                                          WEXT_CSCAN_SCAN_DONE_WAIT_TIME))
+                {
+                    hddLog(LOG1,"%s: Previous SCAN does not finished on time",__func__);
+                    return eHAL_STATUS_SUCCESS; 
+                }
+            }
+            /* Piggyback previous scan result */
+            else if(WEXT_SCAN_PENDING_PIGGYBACK == scanPendingOption)
+            {
+                pAdapter->scan_info.waitScanResult = TRUE;
+                return eHAL_STATUS_SUCCESS; 
+            }
+        }
+        pAdapter->scan_info.waitScanResult = FALSE;
+
+        /* Check for scan IE */
+        while( WEXT_CSCAN_SSID_SECTION == str_ptr[i] ) 
+        {
+            /* ssid_len */
+            if(str_ptr[++i] != WEXT_CSCAN_CHANNEL_SECTION) 
+            {
+                /* total number of ssid's */
+                num_ssid++;
+                /* increment length filed */
+                i += str_ptr[i] + 1;
+            }  
+            /* i should be saved and it will be pointing to 'C' */
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: numSsid %d !!!",__func__, num_ssid);
+        if( num_ssid ) 
+        {
+            /* To be fixed in SME and PE: override the number of ssid with 1,
+            * as SME and PE does not handle multiple SSID in scan request
+            * */
+          scanRequest.SSIDs.numOfSSIDs = num_ssid;
+          /* Allocate num_ssid tCsrSSIDInfo structure */
+          SsidInfo = scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(num_ssid*sizeof(tCsrSSIDInfo));
+          if(NULL == scanRequest.SSIDs.SSIDList) {
+             hddLog(VOS_TRACE_LEVEL_ERROR, "memory alloc failed SSIDInfo buffer");
+             return -ENOMEM;
+          }
+
+          /* copy all the ssid's and their length */
+          ssid_start = WEXT_CSCAN_HEADER_SIZE + 1;/* skipping 'S' */
+          for(j = 0; j < num_ssid; j++) {
+             if( SIR_MAC_MAX_SSID_LENGTH < str_ptr[ssid_start]){
+                scanRequest.SSIDs.numOfSSIDs -= 1;
+             } else{
+                /* get the ssid length */
+                SsidInfo->SSID.length = str_ptr[ssid_start++];
+                vos_mem_copy(SsidInfo->SSID.ssId, &str_ptr[ssid_start], SsidInfo->SSID.length);
+                hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d:  %s\n", j, SsidInfo->SSID.ssId);
+             }
+                /* skipping length */
+             ssid_start += str_ptr[ssid_start - 1] + 1;
+             /* Store next ssid info */
+             SsidInfo++;
+          }
+       }
+
+        /* Check for Channel IE */
+        if ( WEXT_CSCAN_CHANNEL_SECTION == str_ptr[i]) 
+        {
+            if( str_ptr[++i] == 0 ) 
+            {
+                scanRequest.ChannelInfo.numOfChannels = 0;
+                scanRequest.ChannelInfo.ChannelList = NULL;
+                i++;
+            }
+            else {
+
+                /* increment the counter */
+                scanRequest.ChannelInfo.numOfChannels = str_ptr[i++];
+                /* store temp channel list */
+                /* SME expects 1 byte channel content */
+                scanRequest.ChannelInfo.ChannelList = vos_mem_malloc(scanRequest.ChannelInfo.numOfChannels * sizeof(v_U8_t));
+                if(NULL == scanRequest.ChannelInfo.ChannelList) 
+                {
+                    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "memory alloc failed for channel list creation");
+                    status = -ENOMEM;
+                    goto exit_point;
+                }
+
+                for(channelIdx = 0; channelIdx < scanRequest.ChannelInfo.numOfChannels; channelIdx++)
+                {
+                   /* SCAN request from upper layer has 2 bytes channel */
+                   scanRequest.ChannelInfo.ChannelList[channelIdx] = (v_U8_t)str_ptr[i];
+                   i += sizeof(v_U16_t);
+                }
+            }
+        }
+
+        /* Set default */
+        scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        scanRequest.minChnTime = 0;
+        scanRequest.maxChnTime = 0;
+
+        /* Now i is pointing to passive dwell dwell time */
+        /* 'P',min dwell time, max dwell time */
+        /* next two offsets contain min and max channel time */
+        if( WEXT_CSCAN_PASV_DWELL_SECTION == (str_ptr[i]) ) 
+        {
+            /* No SSID specified, num_ssid == 0, then start paasive scan */
+            if (!num_ssid || (eSIR_PASSIVE_SCAN == pAdapter->scan_info.scan_mode))
+            {
+                scanRequest.scanType = eSIR_PASSIVE_SCAN;
+                scanRequest.minChnTime = (v_U8_t)str_ptr[++i];//scanReq->min_channel_time;
+                scanRequest.maxChnTime = (v_U8_t)str_ptr[++i];//scanReq->max_channel_time;
+                i++;
+            }
+            else
+            {
+                i += 3;
+            }    
+        }   
+
+        /* H indicates active channel time */
+        if( WEXT_CSCAN_HOME_DWELL_SECTION == (str_ptr[i]) ) 
+        {
+            if (num_ssid || (eSIR_ACTIVE_SCAN == pAdapter->scan_info.scan_mode))
+            {
+                scanRequest.scanType = eSIR_ACTIVE_SCAN;
+                scanRequest.minChnTime = str_ptr[++i];//scanReq->min_channel_time;
+                scanRequest.maxChnTime = str_ptr[++i];//scanReq->max_channel_time;
+                i++;
+            }
+            else
+            {
+                i +=3;
+            }
+        }
+        scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+        /* set requestType to full scan */
+        scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+        pAdapter->scan_info.mScanPending = TRUE;
+
+        /* if previous genIE is not NULL, update ScanIE */
+        if(0 != pwextBuf->genIE.length)
+        {
+            memset( &pAdapter->scan_info.scanAddIE, 0, sizeof(pAdapter->scan_info.scanAddIE) );
+            memcpy( pAdapter->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, 
+                pwextBuf->genIE.length );
+            pAdapter->scan_info.scanAddIE.length = pwextBuf->genIE.length;
+
+            pwextBuf->roamProfile.pAddIEScan = pAdapter->scan_info.scanAddIE.addIEdata;
+            pwextBuf->roamProfile.nAddIEScanLength = pAdapter->scan_info.scanAddIE.length;
+
+            /* clear previous genIE after use it */
+            memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) );
+        }
+
+        /* push addIEScan in scanRequset if exist */
+        if (pAdapter->scan_info.scanAddIE.addIEdata && 
+            pAdapter->scan_info.scanAddIE.length)
+        {
+            scanRequest.uIEFieldLen = pAdapter->scan_info.scanAddIE.length;
+            scanRequest.pIEField = pAdapter->scan_info.scanAddIE.addIEdata;
+        }
+
+        status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, 
+            pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); 
+        if( !HAL_STATUS_SUCCESS(status) )
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: SME scan fail status %d !!!",__func__, status);
+            pAdapter->scan_info.mScanPending = FALSE;
+            status = -EINVAL;
+            goto exit_point;
+        }
+
+        pAdapter->scan_info.scanId = scanId;
+
+    } //end of data->pointer
+    else {
+        status = -1;
+    }
+
+exit_point:
+
+    /* free ssidlist */
+    if (scanRequest.SSIDs.SSIDList) 
+    {
+        vos_mem_free(scanRequest.SSIDs.SSIDList);
+    }
+    /* free the channel list */
+    if(scanRequest.ChannelInfo.ChannelList)
+    {
+        vos_mem_free((void*)scanRequest.ChannelInfo.ChannelList);
+    }
+
+    EXIT();
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__);
+    return status;
+}
+
+/* Abort any MAC scan if in progress */
+void hdd_abort_mac_scan(hdd_context_t* pHddCtx)
+{
+    sme_AbortMacScan(pHddCtx->hHal);
+}
+
diff --git a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
new file mode 100644
index 0000000..a4a5509
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
@@ -0,0 +1,1597 @@
+/*
+ * 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  wlan_hdd_softap_tx_rx.c
+  
+  \brief Linux HDD Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+#ifdef WLAN_SOFTAP_FEATURE
+
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+#include <linux/semaphore.h>
+#include <wlan_hdd_tx_rx.h>
+#include <wlan_hdd_softap_tx_rx.h>
+#include <wlan_hdd_dp_utils.h>
+#include <wlan_qct_tl.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/etherdevice.h>
+//#include <vos_list.h>
+#include <vos_types.h>
+#include <aniGlobal.h>
+#include <halTypes.h>
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include <halHddApis.h>
+#endif
+#include <net/ieee80211_radiotap.h>
+
+
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/ 
+
+/*--------------------------------------------------------------------------- 
+  Type declarations
+  -------------------------------------------------------------------------*/ 
+
+/*--------------------------------------------------------------------------- 
+  Function definitions and documenation
+  -------------------------------------------------------------------------*/ 
+#if 0
+static void hdd_softap_dump_sk_buff(struct sk_buff * skb)
+{
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: head = %p ", __FUNCTION__, skb->head);
+  //VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: data = %p ", __FUNCTION__, skb->data);
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: tail = %p ", __FUNCTION__, skb->tail);
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: end = %p ", __FUNCTION__, skb->end);
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: len = %d ", __FUNCTION__, skb->len);
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: data_len = %d ", __FUNCTION__, skb->data_len);
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: mac_len = %d\n", __FUNCTION__, skb->mac_len);
+
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x ", 
+     skb->data[0], skb->data[1], skb->data[2], skb->data[3], skb->data[4], 
+     skb->data[5], skb->data[6], skb->data[7]); 
+  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x \n", 
+     skb->data[8], skb->data[9], skb->data[10], skb->data[11], skb->data[12],
+     skb->data[13], skb->data[14], skb->data[15]); 
+}
+#endif
+/**============================================================================
+  @brief hdd_softap_flush_tx_queues() - Utility function to flush the TX queues
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+static VOS_STATUS hdd_softap_flush_tx_queues( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SINT_t i = -1;
+   v_U8_t STAId = 0;
+   hdd_list_node_t *anchor = NULL;
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
+   {
+      if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
+      {
+         continue;
+      }
+
+      for (i = 0; i < NUM_TX_QUEUES; i ++)
+      {
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
+         while (true) 
+         {
+            status = hdd_list_remove_front ( &pAdapter->aStaInfo[STAId].wmm_tx_queue[i], &anchor);
+
+            if (VOS_STATUS_E_EMPTY != status)
+            {
+               //If success then we got a valid packet from some AC
+               pktNode = list_entry(anchor, skb_list_node_t, anchor);
+               skb = pktNode->skb;
+               ++pAdapter->stats.tx_dropped;
+               ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
+               ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
+               kfree_skb(skb);
+               continue;
+            }
+
+            //current list is empty
+            break;
+         }
+         pAdapter->aStaInfo[STAId].txSuspended[i] = VOS_FALSE;
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
+      }
+   }
+
+   spin_unlock_bh( &pAdapter->staInfo_lock );
+
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_hard_start_xmit() - Function registered with the Linux OS for 
+  transmitting packets. There are 2 versions of this function. One that uses
+  locked queue and other that uses lockless queues. Both have been retained to
+  do some performance testing
+
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+   VOS_STATUS status;
+   WLANTL_ACEnumType ac = WLANTL_AC_BE;
+   sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
+   skb_list_node_t *pktNode = NULL;
+   v_SIZE_t pktListSize = 0;
+   v_BOOL_t txSuspended = VOS_FALSE;
+   hdd_adapter_t *pAdapter = (hdd_adapter_t *)netdev_priv(dev);
+   hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);   
+   vos_list_node_t *anchor = NULL;
+   v_U8_t STAId = WLAN_MAX_STA_COUNT;
+   //Extract the destination address from ethernet frame
+   v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
+   int os_status = NETDEV_TX_OK; 
+
+   pDestMacAddress = (v_MACADDR_t*)skb->data;
+   
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: enter", __FUNCTION__);
+
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
+   {
+      //The BC/MC station ID is assigned during BSS starting phase. SAP will return the station 
+      //ID used for BC/MC traffic. The station id is registered to TL as well.
+      STAId = pHddApCtx->uBCStaId;
+      
+      /* Setting priority for broadcast packets which doesn't go to select_queue function */
+      skb->priority = SME_QOS_WMM_UP_BE;
+      skb->queue_mapping = HDD_LINUX_AC_BE;
+
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
+              "%s: BC/MC packet\n", __FUNCTION__);
+   }
+   else
+   {
+      STAId = *(v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
+      if (STAId == HDD_WLAN_INVALID_STA_ID)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Failed to find right station", __FUNCTION__);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         kfree_skb(skb);
+         goto xmit_done;
+      }
+      else if (FALSE == pAdapter->aStaInfo[STAId].isUsed )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: STA is unregistered", __FUNCTION__, STAId);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         kfree_skb(skb);
+         goto xmit_done;
+      }
+
+      if ( (WLANTL_STA_CONNECTED != pAdapter->aStaInfo[STAId].tlSTAState) && 
+           (WLANTL_STA_AUTHENTICATED != pAdapter->aStaInfo[STAId].tlSTAState) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Station not connected yet", __FUNCTION__);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         kfree_skb(skb);
+         goto xmit_done;
+      }
+      else if(WLANTL_STA_CONNECTED == pAdapter->aStaInfo[STAId].tlSTAState)
+      {
+        if(ntohs(skb->protocol) != HDD_ETHERTYPE_802_1_X)
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: NON-EAPOL packet in non-Authenticated state", __FUNCTION__);
+            ++pAdapter->stats.tx_dropped;
+            ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+            kfree_skb(skb);
+            goto xmit_done;
+        }
+      }
+   }
+
+   //Get TL AC corresponding to Qdisc queue index/AC.
+   ac = hdd_QdiscAcToTlAC[skb->queue_mapping];
+   //user priority from IP header, which is already extracted and set from 
+   //select_queue call back function
+   up = skb->priority;
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: Classified as ac %d up %d", __FUNCTION__, ac, up);
+
+   // If the memory differentiation mode is enabled, the memory limit of each queue will be 
+   // checked. Over-limit packets will be dropped.
+    spin_lock(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+    hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
+    if(pktListSize >= pAdapter->aTxQueueLimit[ac])
+    {
+       VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: station %d ac %d queue over limit %d \n", __FUNCTION__, STAId, ac, pktListSize); 
+       pAdapter->aStaInfo[STAId].txSuspended[ac] = VOS_TRUE;
+       netif_stop_subqueue(dev, skb_get_queue_mapping(skb));
+       txSuspended = VOS_TRUE;
+    }
+   spin_unlock(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+
+   if (VOS_TRUE == txSuspended)
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, 
+                  "%s: TX queue full for AC=%d Disable OS TX queue", 
+                  __FUNCTION__, ac );
+      os_status = NETDEV_TX_BUSY;   
+      goto xmit_done;
+   }
+
+   //Use the skb->cb field to hold the list node information
+   pktNode = (skb_list_node_t *)&skb->cb;
+
+   //Stick the OS packet inside this node.
+   pktNode->skb = skb;
+
+   //Stick the User Priority inside this node 
+   pktNode->userPriority = up;
+
+   INIT_LIST_HEAD(&pktNode->anchor);
+
+   spin_lock(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   status = hdd_list_insert_back_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s:Insert Tx queue failed. Pkt dropped", __FUNCTION__);
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+      ++pAdapter->stats.tx_dropped;
+      kfree_skb(skb);
+      goto xmit_done;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueued;
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[ac];
+
+   if (1 == pktListSize)
+   {
+      //Let TL know we have a packet to send for this AC
+      status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, STAId, ac );      
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, "%s: Failed to signal TL for AC=%d STAId =%d", 
+                    __FUNCTION__, ac, STAId );
+
+         //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
+         //as we are in a soft irq context. Also it must be the same packet that we just allocated.
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
+         goto xmit_done;
+      }
+   }
+   dev->trans_start = jiffies;
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW, "%s: exit \n", __FUNCTION__);
+
+xmit_done:
+   spin_unlock_bh( &pAdapter->staInfo_lock );
+   return os_status;
+}
+
+/**============================================================================
+  @brief hdd_softap_sta_2_sta_xmit This function for Transmitting the frames when the traffic is between two stations.
+
+  @param skb      : [in] pointer to packet (sk_buff)
+  @param dev      : [in] pointer to Libra network device
+  @param STAId    : [in] Station Id of Destination Station
+  @param up       : [in] User Priority 
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+VOS_STATUS hdd_softap_sta_2_sta_xmit(struct sk_buff *skb, 
+                                      struct net_device *dev,
+                                      v_U8_t STAId, 
+                                      v_U8_t up)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS; 
+   skb_list_node_t *pktNode = NULL;
+   v_SIZE_t pktListSize = 0;
+   hdd_adapter_t *pAdapter = (hdd_adapter_t *)netdev_priv(dev);
+   v_U8_t ac;
+   vos_list_node_t *anchor = NULL;
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: enter", __FUNCTION__);
+
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if ( FALSE == pAdapter->aStaInfo[STAId].isUsed )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: STA is unregistered", __FUNCTION__, STAId );
+      kfree_skb(skb);
+      status = VOS_STATUS_E_FAILURE;
+      goto xmit_end;
+   }
+
+   /* If the QoS is not enabled on the receiving station, then send it with BE priority */
+   if ( !pAdapter->aStaInfo[STAId].isQosEnabled )
+       up = SME_QOS_WMM_UP_BE;
+
+   ac = hddWmmUpToAcMap[up];
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: Classified as ac %d up %d", __FUNCTION__, ac, up);
+
+   skb->queue_mapping = hddLinuxUpToAcMap[up];
+
+   //Use the skb->cb field to hold the list node information
+   pktNode = (skb_list_node_t *)&skb->cb;
+
+   //Stick the OS packet inside this node.
+   pktNode->skb = skb;
+
+   //Stick the User Priority inside this node 
+   pktNode->userPriority = up;
+
+   INIT_LIST_HEAD(&pktNode->anchor);
+
+   spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
+   if(pAdapter->aStaInfo[STAId].txSuspended[ac] ||
+       pktListSize >= pAdapter->aTxQueueLimit[ac])
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: station %d ac %d queue over limit %d \n", __FUNCTION__, STAId, ac, pktListSize); 
+       /* TODO:Rx Flowchart should be trigerred here to SUPEND SSC on RX side.
+        * SUSPEND should be done based on Threshold. RESUME would be 
+        * triggered in fetch cbk after recovery.
+        */
+       kfree_skb(skb);
+       spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+       status = VOS_STATUS_E_FAILURE;
+       goto xmit_end;
+   }
+   status = hdd_list_insert_back_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s:Insert Tx queue failed. Pkt dropped", __FUNCTION__);
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+      ++pAdapter->stats.tx_dropped;
+      kfree_skb(skb);
+      status = VOS_STATUS_E_FAILURE;
+      goto xmit_end;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueued;
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[ac];
+
+   if (1 == pktListSize)
+   {
+      //Let TL know we have a packet to send for this AC
+      //VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s:Indicating Packet to TL", __FUNCTION__);
+      status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, STAId, ac );      
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, "%s: Failed to signal TL for AC=%d STAId =%d", 
+                    __FUNCTION__, ac, STAId );
+
+         //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
+         //as we are in a soft irq context. Also it must be the same packet that we just allocated.
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
+         status = VOS_STATUS_E_FAILURE;
+         goto xmit_end;
+      }
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW, "%s: exit \n", __FUNCTION__);
+
+xmit_end:
+   spin_unlock_bh( &pAdapter->staInfo_lock );
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_tx_timeout() - Function called by OS if there is any
+  timeout during transmission. Since HDD simply enqueues packet
+  and returns control to OS right away, this would never be invoked
+
+  @param dev : [in] pointer to Libra network device
+  @return    : None
+  ===========================================================================*/
+void hdd_softap_tx_timeout(struct net_device *dev)
+{
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+      "%s: Transmission timeout occurred", __FUNCTION__);
+   //Getting here implies we disabled the TX queues for too long. Queues are 
+   //disabled either because of disassociation or low resource scenarios. In
+   //case of disassociation it is ok to ignore this. But if associated, we have
+   //do possible recovery here
+} 
+
+
+/**============================================================================
+  @brief hdd_softap_stats() - Function registered with the Linux OS for 
+  device TX/RX statistic
+
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : pointer to net_device_stats structure
+  ===========================================================================*/
+struct net_device_stats* hdd_softap_stats(struct net_device *dev)
+{
+   hdd_adapter_t* priv = netdev_priv(dev);
+   return &priv->stats;
+}
+
+
+/**============================================================================
+  @brief hdd_softap_init_tx_rx() - Init function to initialize Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_init_tx_rx( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SINT_t i = -1;
+   v_SIZE_t size = 0;
+
+   v_U8_t STAId = 0;
+
+   v_U8_t pACWeights[] = {
+                           HDD_SOFTAP_BK_WEIGHT_DEFAULT, 
+                           HDD_SOFTAP_BE_WEIGHT_DEFAULT, 
+                           HDD_SOFTAP_VI_WEIGHT_DEFAULT, 
+                           HDD_SOFTAP_VO_WEIGHT_DEFAULT
+                         };
+   pAdapter->isVosOutOfResource = VOS_FALSE;
+
+   vos_mem_zero(&pAdapter->stats, sizeof(struct net_device_stats));
+
+   while (++i != NUM_TX_QUEUES) 
+      hdd_list_init( &pAdapter->wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+
+   /* Initial HDD buffer control / flow control fields*/
+   vos_pkt_get_available_buffer_pool (VOS_PKT_TYPE_TX_802_3_DATA, &size);
+
+   pAdapter->aTxQueueLimit[WLANTL_AC_BK] = HDD_SOFTAP_TX_BK_QUEUE_MAX_LEN;
+   pAdapter->aTxQueueLimit[WLANTL_AC_BE] = HDD_SOFTAP_TX_BE_QUEUE_MAX_LEN;
+   pAdapter->aTxQueueLimit[WLANTL_AC_VI] = HDD_SOFTAP_TX_VI_QUEUE_MAX_LEN;
+   pAdapter->aTxQueueLimit[WLANTL_AC_VO] = HDD_SOFTAP_TX_VO_QUEUE_MAX_LEN;
+
+   spin_lock_init( &pAdapter->staInfo_lock );
+
+   for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
+   {
+      vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
+      for (i = 0; i < NUM_TX_QUEUES; i ++)
+      {
+         hdd_list_init(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+      }
+   }
+
+   /* Update the AC weights suitable for SoftAP mode of operation */
+   WLANTL_SetACWeights((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, pACWeights);
+
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_deinit_tx_rx() - Deinit function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_deinit_tx_rx( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   status = hdd_softap_flush_tx_queues(pAdapter);
+
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_flush_tx_queues_sta() - Utility function to flush the TX queues of a station
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deinit 
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+static VOS_STATUS hdd_softap_flush_tx_queues_sta( hdd_adapter_t *pAdapter, v_U8_t STAId )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_U8_t i = -1;
+
+   hdd_list_node_t *anchor = NULL;
+
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
+   {
+      return status;
+   }
+
+   for (i = 0; i < NUM_TX_QUEUES; i ++)
+   {
+      spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
+      while (true) 
+      {
+         status = hdd_list_remove_front ( &pAdapter->aStaInfo[STAId].wmm_tx_queue[i], &anchor);
+         if (VOS_STATUS_E_EMPTY != status)
+         {
+            //If success then we got a valid packet from some AC
+            pktNode = list_entry(anchor, skb_list_node_t, anchor);
+            skb = pktNode->skb;
+            ++pAdapter->stats.tx_dropped;
+            ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
+            ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
+            kfree_skb(skb);
+            continue;
+         }
+
+         //current list is empty
+         break;
+      }
+      spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
+   }
+
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_init_tx_rx_sta() - Init function to initialize a station in Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deinit
+  @param pmacAddrSTA  : [in] pointer to the MAC address of the station  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA)
+{
+   v_U8_t i = 0;
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (pAdapter->aStaInfo[STAId].isUsed)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, "%s: Reinit station %d", __FUNCTION__, STAId );
+      spin_unlock_bh( &pAdapter->staInfo_lock );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
+   for (i = 0; i < NUM_TX_QUEUES; i ++)
+   {
+      hdd_list_init(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+   }
+
+   pAdapter->aStaInfo[STAId].isUsed = TRUE;
+   vos_copy_macaddr( &pAdapter->aStaInfo[STAId].macAddrSTA, pmacAddrSTA);
+
+   spin_unlock_bh( &pAdapter->staInfo_lock );
+   return VOS_STATUS_SUCCESS;
+}
+
+/**============================================================================
+  @brief hdd_softap_deinit_tx_rx_sta() - Deinit function to clean up a statioin in Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context
+  @param STAId    : [in] Station ID to deinit 
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_U8_t ac;
+   /**Track whether OS TX queue has been disabled.*/
+   v_BOOL_t txSuspended[NUM_TX_QUEUES];
+   v_U8_t tlAC;
+   hdd_hostapd_state_t *pHostapdState;
+
+   pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
+
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Deinit station not inited %d", __FUNCTION__, STAId );
+      spin_unlock_bh( &pAdapter->staInfo_lock );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   status = hdd_softap_flush_tx_queues_sta(pAdapter, STAId);
+
+   pAdapter->aStaInfo[STAId].isUsed = FALSE;
+
+   /* if this STA had any of its WMM TX queues suspended, then the
+      associated queue on the network interface was disabled.  check
+      to see if that is the case, in which case we need to re-enable
+      the interface queue.  but we only do this if the BSS is running
+      since, if the BSS is stopped, all of the interfaces have been
+      stopped and should not be re-enabled */
+
+   if (BSS_START == pHostapdState->bssState)
+   {
+      for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
+      {
+         tlAC = hdd_QdiscAcToTlAC[ac];
+         txSuspended[ac] = pAdapter->aStaInfo[STAId].txSuspended[tlAC];
+      }
+   }
+   vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
+
+   if (BSS_START == pHostapdState->bssState)
+   {
+      for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
+      {
+         if (txSuspended[ac])
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                       "%s: TX queue re-enabled", __FUNCTION__);
+            netif_wake_subqueue(pAdapter->dev, ac);
+         }
+      }
+   }
+
+   spin_unlock_bh( &pAdapter->staInfo_lock );
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_softap_disconnect_tx_rx() - Disconnect function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_disconnect_tx_rx( hdd_adapter_t *pAdapter )
+{
+   return hdd_softap_flush_tx_queues(pAdapter);
+}
+
+/**============================================================================
+  @brief hdd_softap_tx_complete_cbk() - Callback function invoked by TL
+  to indicate that a packet has been transmitted across the bus
+  succesfully. OS packet resources can be released after this cbk.
+
+  @param vosContext   : [in] pointer to VOS context   
+  @param pVosPacket   : [in] pointer to VOS packet (containing skb) 
+  @param vosStatusIn  : [in] status of the transmission 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_tx_complete_cbk( v_VOID_t *vosContext, 
+                                vos_pkt_t *pVosPacket, 
+                                VOS_STATUS vosStatusIn )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   hdd_adapter_t *pAdapter = NULL;   
+   void* pOsPkt = NULL;
+   
+   if( ( NULL == vosContext ) || ( NULL == pVosPacket )  )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Null params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE; 
+   }
+
+   //Return the skb to the OS
+   status = vos_pkt_get_os_packet( pVosPacket, &pOsPkt, VOS_TRUE );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      //This is bad but still try to free the VOSS resources if we can
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
+      vos_pkt_return_packet( pVosPacket );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Get the Adapter context.
+   pAdapter = (hdd_adapter_t *)netdev_priv(((struct sk_buff *)pOsPkt)->dev);
+   if(pAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+   }
+   else
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txCompleted;
+   }
+
+   kfree_skb((struct sk_buff *)pOsPkt); 
+
+   //Return the VOS packet resources.
+   status = vos_pkt_return_packet( pVosPacket );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Could not return VOS packet to the pool", __FUNCTION__);
+   }
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_softap_tx_fetch_packet_cbk() - Callback function invoked by TL to 
+  fetch a packet for transmission.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param staId        : [in] Station for which TL is requesting a pkt
+  @param ac           : [in] access category requested by TL
+  @param pVosPacket   : [out] pointer to VOS packet packet pointer
+  @param pPktMetaInfo : [out] pointer to meta info for the pkt 
+  
+  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
+                      : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_tx_fetch_packet_cbk( v_VOID_t *vosContext,
+                                    v_U8_t *pStaId,
+                                    WLANTL_ACEnumType  ac,
+                                    vos_pkt_t **ppVosPacket,
+                                    WLANTL_MetaInfoType *pPktMetaInfo )
+{
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_list_node_t *anchor = NULL;
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+   vos_pkt_t *pVosPacket = NULL;
+   v_MACADDR_t* pDestMacAddress = NULL;
+   v_TIME_t timestamp;
+   v_SIZE_t size = 0;
+   v_U8_t STAId = WLAN_MAX_STA_COUNT;   
+   hdd_context_t *pHddCtx = NULL;
+
+   //Sanity check on inputs
+   if ( ( NULL == vosContext ) || 
+        ( NULL == pStaId ) || 
+        ( NULL == ppVosPacket ) ||
+        ( NULL == pPktMetaInfo ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Null Params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+    
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+   if ( NULL == pHddCtx )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pAdapter = pHddCtx->sta_to_adapter[*pStaId];
+   if( NULL == pAdapter )
+   {
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+ 
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetched;
+
+   STAId = *pStaId;
+   if (STAId >= WLAN_MAX_STA_COUNT)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invalid STAId %d passed by TL", __FUNCTION__, STAId);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Unregistered STAId %d passed by TL", __FUNCTION__, STAId);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   *ppVosPacket = NULL;
+
+   //Make sure the AC being asked for is sane
+   if( ac > WLANTL_MAX_AC || ac < 0)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invalid AC %d passed by TL", __FUNCTION__, ac);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[ac];
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: AC %d passed by TL", __FUNCTION__, ac);
+
+   //Get the vos packet. I don't want to dequeue and enqueue again if we are out of VOS resources 
+   //This simplifies the locking and unlocking of Tx queue
+   status = vos_pkt_wrap_data_packet( &pVosPacket, 
+                                      VOS_PKT_TYPE_TX_802_3_DATA, 
+                                      NULL, //OS Pkt is not being passed
+                                      hdd_softap_tx_low_resource_cbk, 
+                                      pAdapter );
+
+   if (status == VOS_STATUS_E_ALREADY || status == VOS_STATUS_E_RESOURCES)
+   {
+      //Remember VOS is in a low resource situation
+      pAdapter->isVosOutOfResource = VOS_TRUE;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchLowResources;
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: VOSS in Low Resource scenario", __FUNCTION__);
+      //TL needs to handle this case. VOS_STATUS_E_EMPTY is returned when the queue is empty.
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Only fetch this station and this AC. Return VOS_STATUS_E_EMPTY if nothing there. Do not get next AC
+      as the other branch does.
+   */
+   spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &size);
+
+   if (0 == size)
+   {
+      spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+      vos_pkt_return_packet(pVosPacket);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   status = hdd_list_remove_front( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor );
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                       "%s: AC %d has packets pending", __FUNCTION__, ac);
+
+   if(VOS_STATUS_SUCCESS == status)
+   {
+      //If success then we got a valid packet from some AC
+      pktNode = list_entry(anchor, skb_list_node_t, anchor);
+      skb = pktNode->skb;
+   }
+   else
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Error in de-queuing skb from Tx queue status = %d",
+                 __FUNCTION__, status );
+      vos_pkt_return_packet(pVosPacket);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Attach skb to VOS packet.
+   status = vos_pkt_set_os_packet( pVosPacket, skb );
+   if (status != VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Error attaching skb", __FUNCTION__);
+      vos_pkt_return_packet(pVosPacket);
+      ++pAdapter->stats.tx_dropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      kfree_skb(skb);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Just being paranoid. To be removed later
+   if(pVosPacket == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: VOS packet returned by VOSS is NULL", __FUNCTION__);
+      ++pAdapter->stats.tx_dropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      kfree_skb(skb);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Return VOS packet to TL;
+   *ppVosPacket = pVosPacket;
+
+   //Fill out the meta information needed by TL
+   //FIXME This timestamp is really the time stamp of wrap_data_packet
+   vos_pkt_get_timestamp( pVosPacket, &timestamp );
+   pPktMetaInfo->usTimeStamp = (v_U16_t)timestamp;
+   if ( 1 < size )
+   {
+       pPktMetaInfo->bMorePackets = 1; //HDD has more packets to send
+   }
+   else
+   {
+       pPktMetaInfo->bMorePackets = 0;
+   }
+
+   pPktMetaInfo->ucIsEapol = 0;
+
+   if(pAdapter->aStaInfo[STAId].tlSTAState != WLANTL_STA_AUTHENTICATED) 
+   {
+      if (TRUE == hdd_IsEAPOLPacket( pVosPacket ))
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "%s: VOS packet is EAPOL packet", __FUNCTION__);
+         pPktMetaInfo->ucIsEapol = 1;
+      }
+   }
+ 
+//xg: @@@@: temporarily disble these. will revisit later
+#ifndef WLAN_SOFTAP_FEATURE
+   if(pAdapter->conn_info.uIsAuthenticated == VOS_TRUE)
+      pPktMetaInfo->ucIsEapol = 0;       
+   else 
+      pPktMetaInfo->ucIsEapol = hdd_IsEAPOLPacket( pVosPacket ) ? 1 : 0;
+
+   if ((HDD_WMM_USER_MODE_NO_QOS == pAdapter->cfg_ini->WmmMode) ||
+       (!pAdapter->hddWmmStatus.wmmQap))
+   {
+      // either we don't want QoS or the AP doesn't support QoS
+      pPktMetaInfo->ucUP = 0;
+      pPktMetaInfo->ucTID = 0;
+   }
+   else
+#endif
+   {
+      pPktMetaInfo->ucUP = pktNode->userPriority;
+      pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
+   }
+
+   pPktMetaInfo->ucType = 0;          //FIXME Don't know what this is
+   //Extract the destination address from ethernet frame
+   pDestMacAddress = (v_MACADDR_t*)skb->data;
+
+   // we need 802.3 to 802.11 frame translation
+   // (note that Bcast/Mcast will be translated in SW, unicast in HW)
+   pPktMetaInfo->ucDisableFrmXtl = 0;
+   pPktMetaInfo->ucBcast = vos_is_macaddr_broadcast( pDestMacAddress ) ? 1 : 0;
+   pPktMetaInfo->ucMcast = vos_is_macaddr_group( pDestMacAddress ) ? 1 : 0;
+
+   if ( (pAdapter->aStaInfo[STAId].txSuspended[ac]) &&
+        (size <= ((pAdapter->aTxQueueLimit[ac]*3)/4) ))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                 "%s: TX queue re-enabled", __FUNCTION__);
+      pAdapter->aStaInfo[STAId].txSuspended[ac] = VOS_FALSE;
+      netif_wake_subqueue(pAdapter->dev, skb_get_queue_mapping(skb));
+   }    
+
+   // We're giving the packet to TL so consider it transmitted from
+   // a statistics perspective.  We account for it here instead of
+   // when the packet is returned for two reasons.  First, TL will
+   // manipulate the skb to the point where the len field is not
+   // accurate, leading to inaccurate byte counts if we account for
+   // it later.  Second, TL does not provide any feedback as to
+   // whether or not the packet was successfully sent over the air,
+   // so the packet counts will be the same regardless of where we
+   // account for them
+   pAdapter->stats.tx_bytes += skb->len;
+   ++pAdapter->stats.tx_packets;
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeued;
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeuedAC[ac];
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "%s: Valid VOS PKT returned to TL", __FUNCTION__);
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_softap_tx_low_resource_cbk() - Callback function invoked in the 
+  case where VOS packets are not available at the time of the call to get 
+  packets. This callback function is invoked by VOS when packets are 
+  available.
+
+  @param pVosPacket : [in]  pointer to VOS packet 
+  @param userData   : [in]  opaque user data that was passed initially 
+  
+  @return           : VOS_STATUS_E_FAILURE if any errors encountered, 
+                    : VOS_STATUS_SUCCESS otherwise
+  =============================================================================*/
+VOS_STATUS hdd_softap_tx_low_resource_cbk( vos_pkt_t *pVosPacket, 
+                                    v_VOID_t *userData )
+{
+   VOS_STATUS status;
+   v_SINT_t i = 0;
+   v_SIZE_t size = 0;
+   hdd_adapter_t* pAdapter = (hdd_adapter_t *)userData;
+   v_U8_t STAId = WLAN_MAX_STA_COUNT;
+ 
+   if(pAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Return the packet to VOS. We just needed to know that VOS is out of low resource
+   //situation. Here we will only signal TL that there is a pending data for a STA. 
+   //VOS packet will be requested (if needed) when TL comes back to fetch data.
+   vos_pkt_return_packet( pVosPacket );
+
+   pAdapter->isVosOutOfResource = VOS_FALSE;
+   
+   // Indicate to TL that there is pending data if a queue is non empty.
+   // This Code wasnt included in earlier version which resulted in
+   // Traffic stalling
+   for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
+   {
+      if ((pAdapter->aStaInfo[STAId].tlSTAState == WLANTL_STA_AUTHENTICATED) ||
+           (pAdapter->aStaInfo[STAId].tlSTAState == WLANTL_STA_CONNECTED))
+      {
+         for( i=NUM_TX_QUEUES-1; i>=0; --i )
+         {
+            size = 0;
+            hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], &size);
+            if ( size > 0 )
+            {
+               status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, 
+                                        STAId, 
+                                        (WLANTL_ACEnumType)i );
+               if( !VOS_IS_STATUS_SUCCESS( status ) )
+               {
+                  VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Failure in indicating pkt to TL for ac=%d", __FUNCTION__,i); 
+               }
+            }
+         }
+      }
+   } 
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**============================================================================
+  @brief hdd_softap_rx_packet_cbk() - Receive callback registered with TL.
+  TL will call this to notify the HDD when one or more packets were
+  received for a registered STA.
+
+  @param vosContext      : [in] pointer to VOS context  
+  @param pVosPacketChain : [in] pointer to VOS packet chain
+  @param staId           : [in] Station Id (Adress 1 Index)
+  @param pRxMetaInfo     : [in] pointer to meta info for the received pkt(s).
+
+  @return                : VOS_STATUS_E_FAILURE if any errors encountered, 
+                         : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_softap_rx_packet_cbk( v_VOID_t *vosContext, 
+                              vos_pkt_t *pVosPacketChain,
+                              v_U8_t staId,
+                              WLANTL_RxMetaInfoType* pRxMetaInfo )
+{
+   hdd_adapter_t *pAdapter = NULL;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   int rxstat;
+   struct sk_buff *skb = NULL;
+   vos_pkt_t* pVosPacket;
+   vos_pkt_t* pNextVosPacket;   
+   hdd_context_t *pHddCtx = NULL;   
+
+   //Sanity check on inputs
+   if ( ( NULL == vosContext ) || 
+        ( NULL == pVosPacketChain ) ||
+        ( NULL == pRxMetaInfo ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Null params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+   if ( NULL == pHddCtx )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pAdapter = pHddCtx->sta_to_adapter[staId];
+   if( NULL == pAdapter )
+   {
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   ++pAdapter->hdd_stats.hddTxRxStats.rxChains;
+
+   // walk the chain until all are processed
+   pVosPacket = pVosPacketChain;
+   do
+   {
+      // get the pointer to the next packet in the chain
+      // (but don't unlink the packet since we free the entire chain later)
+      status = vos_pkt_walk_packet_chain( pVosPacket, &pNextVosPacket, VOS_FALSE);
+
+      // both "success" and "empty" are acceptable results
+      if (!((status == VOS_STATUS_SUCCESS) || (status == VOS_STATUS_E_EMPTY)))
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Failure walking packet chain", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      // Extract the OS packet (skb).
+      // Tell VOS to detach the OS packet from the VOS packet
+      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
+      if(!VOS_IS_STATUS_SUCCESS( status ))
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+   
+      //hdd_softap_dump_sk_buff(skb);
+
+      skb->dev = pAdapter->dev;
+      
+      if(skb->dev == NULL) {
+  
+          hddLog(VOS_TRACE_LEVEL_FATAL, "ERROR!!Invalid netdevice\n");
+          return VOS_STATUS_E_FAILURE;
+      }
+      ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
+      ++pAdapter->stats.rx_packets;
+      pAdapter->stats.rx_bytes += skb->len;
+
+      if (WLAN_RX_BCMC_STA_ID == pRxMetaInfo->ucDesSTAId)
+      {
+         //MC/BC packets. Duplicate a copy of packet
+         struct sk_buff *pSkbCopy;
+         hdd_ap_ctx_t *pHddApCtx;
+
+         pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
+         if (!(pHddApCtx->apDisableIntraBssFwd))
+         {
+             pSkbCopy = skb_copy(skb, GFP_ATOMIC);
+             if (pSkbCopy)
+             {
+               hdd_softap_sta_2_sta_xmit(pSkbCopy, pSkbCopy->dev,
+                          pHddApCtx->uBCStaId, (pRxMetaInfo->ucUP));
+             }
+         }
+         else
+         {
+             VOS_TRACE(VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                      "%s: skb allocation fails", __FUNCTION__);
+         }
+ 
+
+      } //(WLAN_RX_BCMC_STA_ID == staId)
+
+      if ((WLAN_RX_BCMC_STA_ID == pRxMetaInfo->ucDesSTAId) || 
+          (WLAN_RX_SAP_SELF_STA_ID == pRxMetaInfo->ucDesSTAId))
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
+                          "%s: send one packet to kernel \n", __FUNCTION__);
+
+         skb->protocol = eth_type_trans(skb, skb->dev);
+         skb->ip_summed = CHECKSUM_UNNECESSARY;
+         rxstat = netif_rx_ni(skb);
+         if (NET_RX_SUCCESS == rxstat)
+         {
+            ++pAdapter->hdd_stats.hddTxRxStats.rxDelivered;
+         }
+         else
+         {
+            ++pAdapter->hdd_stats.hddTxRxStats.rxRefused;
+         }
+      }
+      else if ((WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->apDisableIntraBssFwd)
+      {
+        kfree_skb(skb);   
+      } 
+      else
+      {
+         //loopback traffic
+        status = hdd_softap_sta_2_sta_xmit(skb, skb->dev,
+                 pRxMetaInfo->ucDesSTAId, (pRxMetaInfo->ucUP));
+      }
+
+      // now process the next packet in the chain
+      pVosPacket = pNextVosPacket;
+
+   } while (pVosPacket);
+
+   //Return the entire VOS packet chain to the resource pool
+   status = vos_pkt_return_packet( pVosPacketChain );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,"%s: Failure returning vos pkt", __FUNCTION__);
+   }
+   
+   pAdapter->dev->last_rx = jiffies;
+
+   return status;   
+}
+
+VOS_STATUS hdd_softap_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
+{
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    hdd_context_t *pHddCtx = pAdapter->pHddCtx;
+
+    //Clear station in TL and then update HDD data structures. This helps 
+    //to block RX frames from other station to this station.
+    vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
+    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, 
+                    "WLANTL_ClearSTAClient() failed to for staID %d.  "
+                    "Status= %d [0x%08lX]",
+                    staId, vosStatus, vosStatus );
+    }
+
+    vosStatus = hdd_softap_deinit_tx_rx_sta ( pAdapter, staId );
+    if( VOS_STATUS_E_FAILURE == vosStatus )
+    {
+        VOS_TRACE ( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                    "hdd_softap_deinit_tx_rx_sta() failed for staID %d. "
+                    "Status = %d [0x%08lX]",
+                    staId, vosStatus, vosStatus );
+        return( vosStatus );
+    }
+    
+    pHddCtx->sta_to_adapter[staId] = NULL;
+
+    return( vosStatus );
+}
+
+VOS_STATUS hdd_softap_RegisterSTA( hdd_adapter_t *pAdapter,
+                                       v_BOOL_t fAuthRequired,
+                                       v_BOOL_t fPrivacyBit,
+                                       v_U8_t staId,
+                                       v_U8_t ucastSig,
+                                       v_U8_t bcastSig,
+                                       v_MACADDR_t *pPeerMacAddress,
+                                       v_BOOL_t fWmmEnabled )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+   WLAN_STADescType staDesc;   
+   hdd_context_t *pHddCtx = pAdapter->pHddCtx;
+   hdd_adapter_t *pmonAdapter = NULL;
+
+   //eCsrEncryptionType connectedCipherAlgo;
+   //v_BOOL_t  fConnected;
+   
+   /*
+    * Clean up old entry if it is not cleaned up properly
+   */
+   if ( pAdapter->aStaInfo[staId].isUsed )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                 "clean up old entry for STA %d", staId);
+      hdd_softap_DeregisterSTA( pAdapter, staId );
+   }
+
+   // Get the Station ID from the one saved during the assocation.
+   
+   staDesc.ucSTAId = staId;
+   
+
+   /*Save the pAdapter Pointer for this staId*/
+   pHddCtx->sta_to_adapter[staId] = pAdapter;
+
+   staDesc.wSTAType = WLAN_STA_SOFTAP;
+
+   vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) );
+   vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, &pAdapter->macAddressCurrent,6 );
+   vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
+
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "register station \n");
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "station mac %02x:%02x:%02x:%02x:%02x:%02x",
+              staDesc.vSTAMACAddress.bytes[0],
+              staDesc.vSTAMACAddress.bytes[1],
+              staDesc.vSTAMACAddress.bytes[2],
+              staDesc.vSTAMACAddress.bytes[3],
+              staDesc.vSTAMACAddress.bytes[4],
+              staDesc.vSTAMACAddress.bytes[5]);
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "BSSIDforIBSS %02x:%02x:%02x:%02x:%02x:%02x",
+              staDesc.vBSSIDforIBSS.bytes[0],
+              staDesc.vBSSIDforIBSS.bytes[1],
+              staDesc.vBSSIDforIBSS.bytes[2],
+              staDesc.vBSSIDforIBSS.bytes[3],
+              staDesc.vBSSIDforIBSS.bytes[4],
+              staDesc.vBSSIDforIBSS.bytes[5]);
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "SOFTAP SELFMAC %02x:%02x:%02x:%02x:%02x:%02x",
+              staDesc.vSelfMACAddress.bytes[0],
+              staDesc.vSelfMACAddress.bytes[1],
+              staDesc.vSelfMACAddress.bytes[2],
+              staDesc.vSelfMACAddress.bytes[3],
+              staDesc.vSelfMACAddress.bytes[4],
+              staDesc.vSelfMACAddress.bytes[5]);
+
+   vosStatus = hdd_softap_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress);
+
+#ifdef WLAN_SOFTAP_FEATURE
+   staDesc.ucQosEnabled = fWmmEnabled;
+#else
+   // set the QoS field appropriately
+   if (hdd_wmm_is_active(pAdapter))
+   {
+      staDesc.ucQosEnabled = 1;
+   }
+   else
+   {
+      staDesc.ucQosEnabled = 0;
+   }
+#endif
+   VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+              "HDD SOFTAP register TL QoS_enabled=%d",
+              staDesc.ucQosEnabled );
+
+   staDesc.ucProtectedFrame = (v_U8_t)fPrivacyBit ;
+
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   /* Enable UMA for TX translation only when there is no concurrent session active */
+   if (vos_concurrent_sessions_running())
+   {
+      staDesc.ucSwFrameTXXlation = 1;
+   }
+   else
+   {
+      staDesc.ucSwFrameTXXlation = 0;
+   }
+
+   // Enable frame translation in software for AMSDU 
+   // reception ONLY. The remaining rx is still 
+   // translated in HW.
+   staDesc.ucSwFrameRXXlation = 1;
+#else
+   // For PRIMA UMA frame translation is not enable yet.
+   staDesc.ucSwFrameTXXlation = 1;
+   staDesc.ucSwFrameRXXlation = 1;
+#endif
+   staDesc.ucAddRmvLLC = 1;
+
+   // Initialize signatures and state
+   staDesc.ucUcastSig  = ucastSig;
+   staDesc.ucBcastSig  = bcastSig;
+   staDesc.ucInitState = fAuthRequired ?
+      WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED;
+
+   // Register the Station with TL...      
+   vosStatus = WLANTL_RegisterSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, 
+                                         hdd_softap_rx_packet_cbk, 
+                                         hdd_softap_tx_complete_cbk, 
+                                         hdd_softap_tx_fetch_packet_cbk, &staDesc, 0 );
+   
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR, 
+                 "SOFTAP WLANTL_RegisterSTAClient() failed to register.  Status= %d [0x%08lX]",
+                 vosStatus, vosStatus );
+      return vosStatus;      
+   }
+
+   // if ( WPA ), tell TL to go to 'connected' and after keys come to the driver, 
+   // then go to 'authenticated'.  For all other authentication types (those that do 
+   // not require upper layer authentication) we can put TL directly into 'authenticated'
+   // state.
+   
+   //VOS_ASSERT( fConnected );
+   pAdapter->aStaInfo[staId].ucSTAId = staId;
+   pAdapter->aStaInfo[staId].isQosEnabled = fWmmEnabled;
+
+   if ( !fAuthRequired )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                 "open/shared auth StaId= %d.  Changing TL state to AUTHENTICATED at Join time", pAdapter->aStaInfo[staId].ucSTAId );
+   
+      // Connections that do not need Upper layer auth, transition TL directly
+      // to 'Authenticated' state.      
+      vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, 
+                                         WLANTL_STA_AUTHENTICATED );
+  
+      pAdapter->aStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED;
+      pAdapter->sessionCtx.ap.uIsAuthenticated = VOS_TRUE;
+   }                                            
+   else
+   {
+
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                 "ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time", pAdapter->aStaInfo[staId].ucSTAId );
+   
+      vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, 
+                                         WLANTL_STA_CONNECTED );
+      pAdapter->aStaInfo[staId].tlSTAState = WLANTL_STA_CONNECTED;
+
+      pAdapter->sessionCtx.ap.uIsAuthenticated = VOS_FALSE;
+
+   }      
+   pmonAdapter= hdd_get_mon_adapter( pAdapter->pHddCtx);
+   if(pmonAdapter) 
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Turn on Monitor the carrier\n");
+       netif_carrier_on(pmonAdapter->dev);
+           //Enable Tx queue
+       netif_tx_start_all_queues(pmonAdapter->dev);
+    }
+   netif_carrier_on(pAdapter->dev);
+   //Enable Tx queue
+   netif_tx_start_all_queues(pAdapter->dev);
+
+   return( vosStatus );
+}
+
+VOS_STATUS hdd_softap_Register_BC_STA( hdd_adapter_t *pAdapter, v_BOOL_t fPrivacyBit)
+{
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
+   
+   
+   pHddCtx->sta_to_adapter[WLAN_RX_BCMC_STA_ID] = pAdapter;
+   pHddCtx->sta_to_adapter[WLAN_RX_SAP_SELF_STA_ID] = pAdapter;
+   vosStatus = hdd_softap_RegisterSTA( pAdapter, VOS_FALSE, fPrivacyBit, (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->uBCStaId, 0, 1, &broadcastMacAddr,0);
+
+   return vosStatus;
+}
+
+VOS_STATUS hdd_softap_Deregister_BC_STA( hdd_adapter_t *pAdapter)
+{
+   return hdd_softap_DeregisterSTA( pAdapter, (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->uBCStaId);
+}
+
+VOS_STATUS hdd_softap_stop_bss( hdd_adapter_t *pAdapter)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+    v_U8_t staId = 0;
+
+    vosStatus = hdd_softap_Deregister_BC_STA( pAdapter);
+
+    if (!HAL_STATUS_SUCCESS(vosStatus))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Failed to deregister BC sta Id %d", __FUNCTION__, (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->uBCStaId);
+    }
+
+    for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++)
+    {
+        if (pAdapter->aStaInfo[staId].isUsed)// This excludes BC sta as it is already deregistered
+            vosStatus = hdd_softap_DeregisterSTA( pAdapter, staId);
+
+        if (!HAL_STATUS_SUCCESS(vosStatus))
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Failed to deregister sta Id %d", __FUNCTION__, staId);
+        }
+    }
+
+    return vosStatus;
+}
+
+VOS_STATUS hdd_softap_change_STA_state( hdd_adapter_t *pAdapter, v_MACADDR_t *pDestMacAddress, WLANTL_STAStateType state)
+{
+    v_U8_t ucSTAId = WLAN_MAX_STA_COUNT;
+    VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    tHalHandle hHalHandle = (tHalHandle ) vos_get_context(VOS_MODULE_ID_HAL, pVosContext);
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+
+    VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+               "%s: enter", __FUNCTION__);
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    if(!hHalHandle )
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_FATAL,
+                 "%s: The hHalHandle is  NULL ptr value");
+      VOS_ASSERT( 0 );
+      return VOS_STATUS_E_FAILURE;
+    }    
+
+    if (eHAL_STATUS_SUCCESS != halTable_FindStaidByAddr(hHalHandle, (tANI_U8 *)pDestMacAddress, &ucSTAId))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Failed to find right station", __FUNCTION__);
+        return VOS_STATUS_E_FAILURE;
+    }
+#else
+    if (eHAL_STATUS_SUCCESS != hdd_softap_GetStaId(pAdapter, pDestMacAddress, &ucSTAId))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Failed to find right station", __FUNCTION__);
+        return VOS_STATUS_E_FAILURE;
+    }
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+
+    if (FALSE == vos_is_macaddr_equal(&pAdapter->aStaInfo[ucSTAId].macAddrSTA, pDestMacAddress))
+    {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Station MAC address does not matching", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+    }
+
+    vosStatus = WLANTL_ChangeSTAState( pVosContext, ucSTAId, state );
+    VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                   "%s: change station to state %d succeed", __FUNCTION__, state);
+
+    if (eHAL_STATUS_SUCCESS == vosStatus)
+    {
+       pAdapter->aStaInfo[ucSTAId].tlSTAState = WLANTL_STA_AUTHENTICATED;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+                                     "%s exit\n",__FUNCTION__);
+
+    return vosStatus;
+}
+
+
+VOS_STATUS hdd_softap_GetStaId(hdd_adapter_t *pAdapter, v_MACADDR_t *pMacAddress, v_U8_t *staId)
+{
+    v_U8_t i;
+
+    for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
+    {
+        if (vos_mem_compare(&pAdapter->aStaInfo[i].macAddrSTA, pMacAddress, sizeof(v_MACADDR_t)) &&
+            pAdapter->aStaInfo[i].isUsed)
+        {
+            *staId = i;
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    return VOS_STATUS_E_FAILURE;
+}
+
+#endif //WLAN_SOFTAP_FEATURE
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
new file mode 100644
index 0000000..d48df9d
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -0,0 +1,1351 @@
+/*
+ * 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  wlan_hdd_tx_rx.c
+  
+  \brief Linux HDD Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
+  
+  ==========================================================================*/
+  
+/*--------------------------------------------------------------------------- 
+  Include files
+  -------------------------------------------------------------------------*/ 
+#include <wlan_hdd_tx_rx.h>
+#include <wlan_hdd_softap_tx_rx.h>
+#include <wlan_hdd_dp_utils.h>
+#include <wlan_qct_tl.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/etherdevice.h>
+
+#ifdef CONFIG_CFG80211
+#include <wlan_hdd_p2p.h>
+#include <linux/wireless.h>
+#include <net/cfg80211.h>
+#include <net/ieee80211_radiotap.h>
+#include "sapApi.h"
+#endif
+
+/*--------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/ 
+
+const v_U8_t hddWmmAcToHighestUp[] = {
+   SME_QOS_WMM_UP_RESV,
+   SME_QOS_WMM_UP_EE,
+   SME_QOS_WMM_UP_VI,
+   SME_QOS_WMM_UP_NC
+};
+
+//Mapping Linux AC interpretation to TL AC.
+const v_U8_t hdd_QdiscAcToTlAC[] = {
+   WLANTL_AC_VO,
+   WLANTL_AC_VI,
+   WLANTL_AC_BE,
+   WLANTL_AC_BK,
+};
+
+#ifdef CONFIG_CFG80211
+static struct sk_buff* hdd_mon_tx_fetch_pkt(hdd_adapter_t* pAdapter);
+#endif
+
+/*--------------------------------------------------------------------------- 
+  Type declarations
+  -------------------------------------------------------------------------*/ 
+  
+/*--------------------------------------------------------------------------- 
+  Function definitions and documenation
+  -------------------------------------------------------------------------*/ 
+
+#ifdef DATA_PATH_UNIT_TEST
+//Utility function to dump an sk_buff
+static void dump_sk_buff(struct sk_buff * skb)
+{
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: head = %p ", __FUNCTION__, skb->head);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: data = %p ", __FUNCTION__, skb->data);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: tail = %p ", __FUNCTION__, skb->tail);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: end = %p ", __FUNCTION__, skb->end);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: len = %d ", __FUNCTION__, skb->len);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: data_len = %d ", __FUNCTION__, skb->data_len);
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: mac_len = %d\n", __FUNCTION__, skb->mac_len);
+
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x ", 
+     skb->data[0], skb->data[1], skb->data[2], skb->data[3], skb->data[4], 
+     skb->data[5], skb->data[6], skb->data[7]); 
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x \n", 
+     skb->data[8], skb->data[9], skb->data[10], skb->data[11], skb->data[12],
+     skb->data[13], skb->data[14], skb->data[15]); 
+}
+
+//Function for Unit Test only
+static void transport_thread(hdd_adapter_t *pAdapter)
+{
+   v_U8_t staId;
+   WLANTL_ACEnumType ac = WLANTL_AC_BE;
+   vos_pkt_t *pVosPacket = NULL ;
+   vos_pkt_t dummyPacket;
+   WLANTL_MetaInfoType pktMetaInfo;
+   WLANTL_RxMetaInfoType pktRxMetaInfo;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+
+   status = hdd_tx_fetch_packet_cbk( pAdapter->pvosContext,
+                                     &staId,
+                                     &ac,
+                                     &pVosPacket,
+                                     &pktMetaInfo );
+  if (status != VOS_STATUS_SUCCESS && status != VOS_STATUS_E_EMPTY)
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test FAIL hdd_tx_fetch_packet_cbk", __FUNCTION__);
+  else
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test PASS hdd_tx_fetch_packet_cbk", __FUNCTION__);
+
+  status = hdd_tx_complete_cbk(pAdapter->pvosContext, &dummyPacket, VOS_STATUS_SUCCESS);; 
+  if (status != VOS_STATUS_SUCCESS)
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test FAIL hdd_tx_complete_cbk", __FUNCTION__);
+  else
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test PASS hdd_tx_complete_cbk", __FUNCTION__);
+
+  status = hdd_tx_low_resource_cbk(pVosPacket, pAdapter);
+  if (status != VOS_STATUS_SUCCESS)
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test FAIL hdd_tx_low_resource_cbk", __FUNCTION__);
+  else
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test PASS hdd_tx_low_resource_cbk", __FUNCTION__);
+  
+  status = hdd_rx_packet_cbk( pAdapter->pvosContext,
+                              &dummyPacket,
+                              staId,
+                              &pktRxMetaInfo);
+  if (status != VOS_STATUS_SUCCESS)
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test FAIL hdd_rx_packet_cbk", __FUNCTION__);
+  else
+     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Test PASS hdd_rx_packet_cbk", __FUNCTION__);
+
+}
+#endif
+
+
+/**============================================================================
+  @brief hdd_flush_tx_queues() - Utility function to flush the TX queues
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+static VOS_STATUS hdd_flush_tx_queues( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SINT_t i = -1;
+   hdd_list_node_t *anchor = NULL;
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+
+   while (++i != NUM_TX_QUEUES) 
+   {
+      //Free up any packets in the Tx queue
+      spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock);
+      while (true) 
+      {
+         status = hdd_list_remove_front( &pAdapter->wmm_tx_queue[i], &anchor );
+         if(VOS_STATUS_E_EMPTY != status)
+         {
+            pktNode = list_entry(anchor, skb_list_node_t, anchor);
+            skb = pktNode->skb;
+            //TODO
+            //++pAdapter->stats.tx_dropped; 
+            ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
+            ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
+            kfree_skb(skb);
+            continue;
+         }
+         break;
+      }
+      spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock);
+      // backpressure is no longer in effect
+      pAdapter->isTxSuspended[i] = VOS_FALSE;
+   }
+
+   return status;
+}
+
+#ifdef CONFIG_CFG80211
+static struct sk_buff* hdd_mon_tx_fetch_pkt(hdd_adapter_t* pAdapter)
+{
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+   v_SIZE_t size = 0;
+   WLANTL_ACEnumType ac = 0;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   hdd_list_node_t *anchor = NULL;
+
+   if( NULL == pAdapter )
+   {
+      VOS_ASSERT(0);
+      return NULL;
+   }
+
+   // do we have any packets pending in this AC?
+   hdd_list_size( &pAdapter->wmm_tx_queue[ac], &size ); 
+   if( size == 0 )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: NO Packet Pending", __FUNCTION__);
+      return NULL;
+   }
+
+   //Remove the packet from the queue
+   spin_lock_bh(&pAdapter->wmm_tx_queue[ac].lock);
+   status = hdd_list_remove_front( &pAdapter->wmm_tx_queue[ac], &anchor );
+   spin_unlock_bh(&pAdapter->wmm_tx_queue[ac].lock);
+
+   if(VOS_STATUS_SUCCESS == status)
+   {
+      //If success then we got a valid packet from some AC
+      pktNode = list_entry(anchor, skb_list_node_t, anchor);
+      skb = pktNode->skb;
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s: Not able to remove Packet from the list",
+                  __FUNCTION__);
+
+      return NULL;
+   }
+
+   // if we are in a backpressure situation see if we can turn the hose back on
+   if ( (pAdapter->isTxSuspended[ac]) &&
+        (size <= HDD_TX_QUEUE_LOW_WATER_MARK) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                 "%s: TX queue[%d] re-enabled", __FUNCTION__, ac);
+      pAdapter->isTxSuspended[ac] = VOS_FALSE;      
+      /* Enable Queues which we have disabled earlier */
+      netif_tx_start_all_queues( pAdapter->dev ); 
+   }
+
+   return skb;
+}
+
+void hdd_mon_tx_mgmt_pkt(hdd_adapter_t* pAdapter)
+{
+   hdd_cfg80211_state_t *cfgState;
+   struct sk_buff* skb;
+   hdd_adapter_t* pMonAdapter = NULL;
+   struct ieee80211_hdr *hdr;
+
+   if (pAdapter == NULL )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+       "%s: pAdapter is NULL", __func__);
+      return;
+   }
+
+   pMonAdapter = hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_MONITOR );
+
+   cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+
+   if( NULL != cfgState->buf )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+          "%s: Already one MGMT packet Tx going on", __func__);
+      return;
+   }
+
+   skb = hdd_mon_tx_fetch_pkt(pMonAdapter);
+
+   if (NULL == skb)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+       "%s: No Packet Pending", __func__);
+      return;
+   }
+
+   cfgState->buf = vos_mem_malloc( skb->len ); //buf;
+   if( cfgState->buf == NULL )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+          "%s: Failed to Allocate memory", __func__);
+      goto fail;
+   }
+
+   cfgState->len = skb->len;
+
+   vos_mem_copy( cfgState->buf, skb->data, skb->len);
+
+   cfgState->skb = skb; //buf;
+   cfgState->action_cookie = (tANI_U32)cfgState->buf;
+
+   hdr = (struct ieee80211_hdr *)skb->data;
+   if( (hdr->frame_control & HDD_FRAME_TYPE_MASK)
+                                       == HDD_FRAME_TYPE_MGMT )
+   {
+       if( (hdr->frame_control & HDD_FRAME_SUBTYPE_MASK)
+                                       == HDD_FRAME_SUBTYPE_DEAUTH )
+       {
+          hdd_softap_sta_deauth( pAdapter, hdr->addr1 ); 
+          goto mgmt_handled;
+       }
+       else if( (hdr->frame_control & HDD_FRAME_SUBTYPE_MASK) 
+                                      == HDD_FRAME_SUBTYPE_DISASSOC )
+       {
+          hdd_softap_sta_disassoc( pAdapter, hdr->addr1 ); 
+          goto mgmt_handled;
+       }
+   }
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+      "%s: Sending action frame to SAP to TX, Len %d", __func__, skb->len);
+
+   if (eHAL_STATUS_SUCCESS != 
+      WLANSAP_SendAction( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                           skb->data, skb->len) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+          "%s: WLANSAP_SendAction returned fail", __func__);
+      hdd_sendActionCnf( pAdapter, FALSE );
+   }
+   return;
+
+mgmt_handled:
+   hdd_sendActionCnf( pAdapter, TRUE );
+   return;
+fail:
+   kfree_skb(pAdapter->skb_to_tx);
+   pAdapter->skb_to_tx = NULL;
+   return;
+}
+
+void hdd_mon_tx_work_queue(struct work_struct *work)
+{
+   hdd_adapter_t* pAdapter = container_of(work, hdd_adapter_t, monTxWorkQueue);
+   hdd_mon_tx_mgmt_pkt(pAdapter);
+}
+
+int hdd_mon_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+   v_U16_t rt_hdr_len;
+   struct ieee80211_hdr *hdr;
+   hdd_adapter_t *pPgBkAdapter, *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+   struct ieee80211_radiotap_header *rtap_hdr =
+                        (struct ieee80211_radiotap_header *)skb->data;
+
+   /*Supplicant sends the EAPOL packet on monitor interface*/
+   pPgBkAdapter = pAdapter->sessionCtx.monitor.pAdapterForTx;    
+   if(pPgBkAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+           "%s: No Adapter to piggy back. Dropping the pkt on monitor inf",
+                                                                 __func__);
+      goto fail; /* too short to be possibly valid */
+   }
+ 
+   /* check if toal skb length is greater then radio tab header length of not */
+   if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
+      goto fail; /* too short to be possibly valid */
+   
+   /* check if radio tap header version is correct or not */
+   if (unlikely(rtap_hdr->it_version))
+      goto fail; /* only version 0 is supported */
+ 
+   /*Strip off the radio tap header*/
+   rt_hdr_len = ieee80211_get_radiotap_len(skb->data);
+ 
+   /* check if skb length if greator then total radio tap header length ot not*/
+   if (unlikely(skb->len < rt_hdr_len))
+      goto fail;
+ 
+   /* Update the trans_start for this netdev */  
+   dev->trans_start = jiffies;
+   /*
+    * fix up the pointers accounting for the radiotap
+    * header still being in there.
+    */
+   skb_set_mac_header(skb, rt_hdr_len);
+   skb_set_network_header(skb, rt_hdr_len);
+   skb_set_transport_header(skb, rt_hdr_len); 
+
+   /* Pull rtap header out of the skb */
+   skb_pull(skb, rt_hdr_len);
+  
+   /*Supplicant adds: radiotap Hdr + radiotap data + 80211 Header. So after 
+    * radio tap header and 802.11 header starts 
+    */
+   hdr = (struct ieee80211_hdr *)skb->data;
+ 
+   /* Send data frames through the normal Data path. In this path we will 
+    * conver rcvd 802.11 packet to 802.3 packet */
+   if ( (hdr->frame_control & HDD_FRAME_TYPE_MASK)  == HDD_FRAME_TYPE_DATA)
+   { 
+      v_U8_t da[6];
+      v_U8_t sa[6];
+
+      memcpy (da, hdr->addr1, VOS_MAC_ADDR_SIZE);
+      memcpy (sa, hdr->addr2, VOS_MAC_ADDR_SIZE);
+ 
+      /* Pull 802.11 MAC header */ 
+      skb_pull(skb, HDD_80211_HEADER_LEN);
+ 
+      if ( HDD_FRAME_SUBTYPE_QOSDATA == 
+          (hdr->frame_control & HDD_FRAME_SUBTYPE_MASK))
+      {
+         skb_pull(skb, HDD_80211_HEADER_QOS_CTL);
+      }
+
+      /* Pull LLC header */ 
+      skb_pull(skb, HDD_LLC_HDR_LEN);
+
+      /* Create space for Ethernet header */ 
+      skb_push(skb, HDD_MAC_HDR_SIZE*2);
+      memcpy(&skb->data[0], da, HDD_MAC_HDR_SIZE);
+      memcpy(&skb->data[HDD_DEST_ADDR_OFFSET], sa, HDD_MAC_HDR_SIZE);
+
+      /* Only EAPOL Data packets are allowed through monitor interface */ 
+      if (vos_be16_to_cpu(
+         (*(unsigned short*)&skb->data[HDD_ETHERTYPE_802_1_X_FRAME_OFFSET]) ) 
+                                                     != HDD_ETHERTYPE_802_1_X)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+           "%s: Not a Eapol packet. Drop this frame", __func__);
+         //If not EAPOL frames, drop them.
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+
+      skb->protocol = htons(HDD_ETHERTYPE_802_1_X);
+ 
+      hdd_hostapd_select_queue(pPgBkAdapter->dev, skb);
+      return hdd_softap_hard_start_xmit( skb, pPgBkAdapter->dev );
+   }
+   else
+   {
+      VOS_STATUS status;
+      WLANTL_ACEnumType ac = 0;
+      skb_list_node_t *pktNode = NULL;
+      v_SIZE_t pktListSize = 0;
+
+      spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+      //If we have already reached the max queue size, disable the TX queue
+      if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)
+      {
+         /* We want to process one packet at a time, so lets disable all TX queues
+           * and re-enable the queues once we get TX feedback for this packet */
+         netif_tx_stop_all_queues(pAdapter->dev);
+         pAdapter->isTxSuspended[ac] = VOS_TRUE;
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);      
+         return NETDEV_TX_BUSY;   
+      }
+      spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);      
+
+      //Use the skb->cb field to hold the list node information
+      pktNode = (skb_list_node_t *)&skb->cb;
+
+      //Stick the OS packet inside this node.
+      pktNode->skb = skb;
+
+      INIT_LIST_HEAD(&pktNode->anchor);
+
+      //Insert the OS packet into the appropriate AC queue
+      spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+      status = hdd_list_insert_back_size( &pAdapter->wmm_tx_queue[ac],
+                                          &pktNode->anchor, &pktListSize );
+      spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s:Insert Tx queue failed. Pkt dropped", __FUNCTION__);
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+
+      if ( pktListSize == 1 )
+      {
+         /* In this context we cannot acquire any mutex etc. And to transmit 
+          * this packet we need to call SME API. So to take care of this we will
+          * schedule a workqueue 
+          */
+         schedule_work(&pPgBkAdapter->monTxWorkQueue);
+      }
+      return NETDEV_TX_OK;
+   }
+ 
+fail:
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+           "%s: Packet Rcvd at Monitor interface is not proper,"
+           " Dropping the packet",
+            __func__);
+   kfree_skb(skb);
+   return NETDEV_TX_OK;
+}
+#endif
+/**============================================================================
+  @brief hdd_hard_start_xmit() - Function registered with the Linux OS for 
+  transmitting packets. There are 2 versions of this function. One that uses
+  locked queue and other that uses lockless queues. Both have been retained to
+  do some performance testing
+
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : NET_XMIT_DROP if packets are dropped
+                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
+  ===========================================================================*/
+int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+   VOS_STATUS status;
+   WLANTL_ACEnumType ac;
+   sme_QosWmmUpType up;
+   skb_list_node_t *pktNode = NULL;
+   hdd_list_node_t *anchor = NULL;
+   v_SIZE_t pktListSize = 0;
+   hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+   v_BOOL_t granted;
+
+   hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
+   
+   v_BOOL_t txSuspended = VOS_FALSE;
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
+
+   //Get TL AC corresponding to Qdisc queue index/AC.
+   ac = hdd_QdiscAcToTlAC[skb->queue_mapping];
+
+   //user priority from IP header, which is already extracted and set from 
+   //select_queue call back function
+   up = skb->priority;
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s: Classified as ac %d up %d", __FUNCTION__, ac, up);
+#endif // HDD_WMM_DEBUG
+
+   spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+
+   //If we have already reached the max queue size, disable the TX queue
+   if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressured;
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressuredAC[ac];
+
+      netif_tx_stop_queue(netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)));
+      pAdapter->isTxSuspended[ac] = VOS_TRUE;
+      txSuspended = VOS_TRUE;
+   }
+
+   spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);      
+   if (VOS_TRUE == txSuspended)
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, 
+                  "%s: TX queue full for AC=%d Disable OS TX queue", 
+                  __FUNCTION__, ac );
+      return NETDEV_TX_BUSY;   
+   }
+
+   //Use the skb->cb field to hold the list node information
+   pktNode = (skb_list_node_t *)&skb->cb;
+
+   //Stick the OS packet inside this node.
+   pktNode->skb = skb;
+
+   //Stick the User Priority inside this node 
+   pktNode->userPriority = up;
+
+
+   INIT_LIST_HEAD(&pktNode->anchor);
+
+   //Insert the OS packet into the appropriate AC queue
+   spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+   status = hdd_list_insert_back_size( &pAdapter->wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s:Insert Tx queue failed. Pkt dropped", __FUNCTION__);
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+      ++pAdapter->stats.tx_dropped;
+      kfree_skb(skb);
+      return NETDEV_TX_OK;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueued;
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[ac];
+
+   //Make sure we have access to this access category
+   if (likely(pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed) || 
+           ( pHddStaCtx->conn_info.uIsAuthenticated == VOS_FALSE))
+   {
+      granted = VOS_TRUE;
+   }
+   else
+   {
+      status = hdd_wmm_acquire_access( pAdapter, ac, &granted );
+   }
+
+   if ( granted && ( pktListSize == 1 ))
+   {
+      //Let TL know we have a packet to send for this AC
+      //VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s:Indicating Packet to TL", __FUNCTION__);
+      status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, pHddStaCtx->conn_info.staId[0], ac );      
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Failed to signal TL for AC=%d", __FUNCTION__, ac );
+
+         //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
+         //as we are in a soft irq context. Also it must be the same packet that we just allocated.
+         spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->wmm_tx_queue[ac], &anchor );
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+   }
+
+   dev->trans_start = jiffies;
+
+   return NETDEV_TX_OK;
+}
+
+/**============================================================================
+  @brief hdd_tx_timeout() - Function called by OS if there is any
+  timeout during transmission. Since HDD simply enqueues packet
+  and returns control to OS right away, this would never be invoked
+
+  @param dev : [in] pointer to Libra network device
+  @return    : None
+  ===========================================================================*/
+void hdd_tx_timeout(struct net_device *dev)
+{
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+      "%s: Transmission timeout occurred", __FUNCTION__);
+   //Getting here implies we disabled the TX queues for too long. Queues are 
+   //disabled either because of disassociation or low resource scenarios. In
+   //case of disassociation it is ok to ignore this. But if associated, we have
+   //do possible recovery here
+} 
+
+
+/**============================================================================
+  @brief hdd_stats() - Function registered with the Linux OS for 
+  device TX/RX statistic
+
+  @param dev      : [in] pointer to Libra network device
+  
+  @return         : pointer to net_device_stats structure
+  ===========================================================================*/
+struct net_device_stats* hdd_stats(struct net_device *dev)
+{
+   hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+   
+   return &pAdapter->stats;
+}
+
+
+/**============================================================================
+  @brief hdd_init_tx_rx() - Init function to initialize Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_init_tx_rx( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SINT_t i = -1;
+
+   pAdapter->isVosOutOfResource = VOS_FALSE;
+
+   //vos_mem_zero(&pAdapter->stats, sizeof(struct net_device_stats));
+   //Will be zeroed out during alloc
+
+   while (++i != NUM_TX_QUEUES)
+   { 
+      pAdapter->isTxSuspended[i] = VOS_FALSE; 
+      hdd_list_init( &pAdapter->wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+   }
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_deinit_tx_rx() - Deinit function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_deinit_tx_rx( hdd_adapter_t *pAdapter )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SINT_t i = -1;
+
+   status = hdd_flush_tx_queues(pAdapter);
+   while (++i != NUM_TX_QUEUES) 
+   {
+      //Free up actual list elements in the Tx queue
+      hdd_list_destroy( &pAdapter->wmm_tx_queue[i] );
+   }
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_disconnect_tx_rx() - Disconnect function to clean up Tx/RX
+  modules in HDD
+
+  @param pAdapter : [in] pointer to adapter context  
+  @return         : VOS_STATUS_E_FAILURE if any errors encountered 
+                  : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_disconnect_tx_rx( hdd_adapter_t *pAdapter )
+{
+   return hdd_flush_tx_queues(pAdapter);
+}
+
+
+/**============================================================================
+  @brief hdd_IsEAPOLPacket() - Checks the packet is EAPOL or not.
+
+  @param pVosPacket : [in] pointer to vos packet  
+  @return         : VOS_TRUE if the packet is EAPOL 
+                  : VOS_FALSE otherwise
+  ===========================================================================*/
+
+v_BOOL_t hdd_IsEAPOLPacket( vos_pkt_t *pVosPacket )
+{
+    VOS_STATUS vosStatus  = VOS_STATUS_SUCCESS;
+    v_BOOL_t   fEAPOL     = VOS_FALSE; 
+    void       *pBuffer   = NULL;
+
+    
+    vosStatus = vos_pkt_peek_data( pVosPacket, (v_SIZE_t)HDD_ETHERTYPE_802_1_X_FRAME_OFFSET,
+                          &pBuffer, HDD_ETHERTYPE_802_1_X_SIZE );
+    if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+       if ( vos_be16_to_cpu( *(unsigned short*)pBuffer ) == HDD_ETHERTYPE_802_1_X )
+       {
+          fEAPOL = VOS_TRUE;
+       }
+    }  
+    
+   return fEAPOL;
+}
+
+
+#ifdef FEATURE_WLAN_WAPI // Need to update this function
+/**============================================================================
+  @brief hdd_IsWAIPacket() - Checks the packet is WAI or not.
+
+  @param pVosPacket : [in] pointer to vos packet
+  @return         : VOS_TRUE if the packet is WAI
+                  : VOS_FALSE otherwise
+  ===========================================================================*/
+
+v_BOOL_t hdd_IsWAIPacket( vos_pkt_t *pVosPacket )
+{
+    VOS_STATUS vosStatus  = VOS_STATUS_SUCCESS;
+    v_BOOL_t   fIsWAI     = VOS_FALSE;
+    void       *pBuffer   = NULL;
+
+    // Need to update this function
+    vosStatus = vos_pkt_peek_data( pVosPacket, (v_SIZE_t)HDD_ETHERTYPE_802_1_X_FRAME_OFFSET,
+                          &pBuffer, HDD_ETHERTYPE_802_1_X_SIZE );
+
+    if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
+    {
+       if ( vos_be16_to_cpu( *(unsigned short*)pBuffer ) == HDD_ETHERTYPE_WAI)
+       {
+          fIsWAI = VOS_TRUE;
+       }
+    }
+
+   return fIsWAI;
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+/**============================================================================
+  @brief hdd_tx_complete_cbk() - Callback function invoked by TL
+  to indicate that a packet has been transmitted across the SDIO bus
+  succesfully. OS packet resources can be released after this cbk.
+
+  @param vosContext   : [in] pointer to VOS context   
+  @param pVosPacket   : [in] pointer to VOS packet (containing skb) 
+  @param vosStatusIn  : [in] status of the transmission 
+
+  @return             : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_tx_complete_cbk( v_VOID_t *vosContext, 
+                                vos_pkt_t *pVosPacket, 
+                                VOS_STATUS vosStatusIn )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   hdd_adapter_t *pAdapter = NULL;   
+   hdd_context_t *pHddCtx = NULL;
+   void* pOsPkt = NULL;
+   
+   if( ( NULL == vosContext ) || ( NULL == pVosPacket )  )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Null params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE; 
+   }
+
+   //Return the skb to the OS
+   status = vos_pkt_get_os_packet( pVosPacket, &pOsPkt, VOS_TRUE );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      //This is bad but still try to free the VOSS resources if we can
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
+      vos_pkt_return_packet( pVosPacket );
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+   //Get the Adapter context.
+   pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_INFRA_STATION);
+   if(pAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+   }
+   else
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txCompleted;
+   }
+
+   kfree_skb((struct sk_buff *)pOsPkt); 
+
+   //Return the VOS packet resources.
+   status = vos_pkt_return_packet( pVosPacket );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Could not return VOS packet to the pool", __FUNCTION__);
+   }
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_tx_fetch_packet_cbk() - Callback function invoked by TL to 
+  fetch a packet for transmission.
+
+  @param vosContext   : [in] pointer to VOS context  
+  @param staId        : [in] Station for which TL is requesting a pkt
+  @param ac           : [in] access category requested by TL
+  @param pVosPacket   : [out] pointer to VOS packet packet pointer
+  @param pPktMetaInfo : [out] pointer to meta info for the pkt 
+  
+  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
+                      : VOS_STATUS_E_FAILURE if any errors encountered 
+                      : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_tx_fetch_packet_cbk( v_VOID_t *vosContext,
+                                    v_U8_t *pStaId,
+                                    WLANTL_ACEnumType  ac,
+                                    vos_pkt_t **ppVosPacket,
+                                    WLANTL_MetaInfoType *pPktMetaInfo )
+{
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_context_t *pHddCtx = NULL;
+   hdd_list_node_t *anchor = NULL;
+   skb_list_node_t *pktNode = NULL;
+   struct sk_buff *skb = NULL;
+   vos_pkt_t *pVosPacket = NULL;
+   v_MACADDR_t* pDestMacAddress = NULL;
+   v_TIME_t timestamp;
+   WLANTL_ACEnumType newAc;
+   v_SIZE_t size = 0;
+   tANI_U8   acAdmitted, i;
+
+   //Sanity check on inputs
+   if ( ( NULL == vosContext ) || 
+        ( NULL == pStaId ) || 
+        ( NULL == ppVosPacket ) ||
+        ( NULL == pPktMetaInfo ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Null Params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Get the HDD context.
+   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+   if(pHddCtx == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+ 
+   pAdapter = pHddCtx->sta_to_adapter[*pStaId];
+   if( NULL == pAdapter )
+   {
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetched;
+
+   *ppVosPacket = NULL;
+
+   //Make sure the AC being asked for is sane
+   if( ac >= WLANTL_MAX_AC || ac < 0)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Invalid AC %d passed by TL", __FUNCTION__, ac);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[ac];
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: AC %d passed by TL", __FUNCTION__, ac);
+#endif // HDD_WMM_DEBUG
+
+   // We find an AC with packets
+   // or we determine we have no more packets to send
+   // HDD is not allowed to change AC.
+
+   // has this AC been admitted? or 
+   // To allow EAPOL packets when not authenticated
+   if (unlikely((0==pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed) &&
+                (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.uIsAuthenticated))
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
+#ifdef HDD_WMM_DEBUG
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                 "%s: no packets pending", __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+      return VOS_STATUS_E_FAILURE;
+   }
+      
+   // do we have any packets pending in this AC?
+   hdd_list_size( &pAdapter->wmm_tx_queue[ac], &size ); 
+   if( size >  0 )
+   {
+       // yes, so process it
+#ifdef HDD_WMM_DEBUG
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                       "%s: AC %d has packets pending", __FUNCTION__, ac);
+#endif // HDD_WMM_DEBUG
+   }
+   else
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
+#ifdef HDD_WMM_DEBUG
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s: no packets pending", __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Get the vos packet. I don't want to dequeue and enqueue again if we are out of VOS resources 
+   //This simplifies the locking and unlocking of Tx queue
+   status = vos_pkt_wrap_data_packet( &pVosPacket, 
+                                      VOS_PKT_TYPE_TX_802_3_DATA, 
+                                      NULL, //OS Pkt is not being passed
+                                      hdd_tx_low_resource_cbk, 
+                                      pAdapter );
+
+   if (status == VOS_STATUS_E_ALREADY || status == VOS_STATUS_E_RESOURCES)
+   {
+      //Remember VOS is in a low resource situation
+      pAdapter->isVosOutOfResource = VOS_TRUE;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchLowResources;
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: VOSS in Low Resource scenario", __FUNCTION__);
+      //TL will now think we have no more packets in this AC
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Remove the packet from the queue
+   spin_lock_bh(&pAdapter->wmm_tx_queue[ac].lock);
+   status = hdd_list_remove_front( &pAdapter->wmm_tx_queue[ac], &anchor );
+   spin_unlock_bh(&pAdapter->wmm_tx_queue[ac].lock);
+
+   if(VOS_STATUS_SUCCESS == status)
+   {
+      //If success then we got a valid packet from some AC
+      pktNode = list_entry(anchor, skb_list_node_t, anchor);
+      skb = pktNode->skb;
+   }
+   else
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Error in de-queuing "
+         "skb from Tx queue status = %d", __FUNCTION__, status );
+      vos_pkt_return_packet(pVosPacket);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Attach skb to VOS packet.
+   status = vos_pkt_set_os_packet( pVosPacket, skb );
+   if (status != VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Error attaching skb", __FUNCTION__);
+      vos_pkt_return_packet(pVosPacket);
+      ++pAdapter->stats.tx_dropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      kfree_skb(skb);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Just being paranoid. To be removed later
+   if(pVosPacket == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: VOS packet returned by VOSS is NULL", __FUNCTION__);
+      ++pAdapter->stats.tx_dropped;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
+      kfree_skb(skb);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Return VOS packet to TL;
+   *ppVosPacket = pVosPacket;
+
+   //Fill out the meta information needed by TL
+   //FIXME This timestamp is really the time stamp of wrap_data_packet
+   vos_pkt_get_timestamp( pVosPacket, &timestamp );
+   pPktMetaInfo->usTimeStamp = (v_U16_t)timestamp;
+   
+   if(pAdapter->sessionCtx.station.conn_info.uIsAuthenticated == VOS_TRUE)
+      pPktMetaInfo->ucIsEapol = 0;       
+   else 
+      pPktMetaInfo->ucIsEapol = hdd_IsEAPOLPacket( pVosPacket ) ? 1 : 0;
+
+#ifdef FEATURE_WLAN_WAPI
+   // Override usIsEapol value when its zero for WAPI case
+      pPktMetaInfo->ucIsWai = hdd_IsWAIPacket( pVosPacket ) ? 1 : 0;
+#endif /* FEATURE_WLAN_WAPI */
+
+   if ((HDD_WMM_USER_MODE_NO_QOS == pHddCtx->cfg_ini->WmmMode) ||
+       (!pAdapter->hddWmmStatus.wmmQap))
+   {
+      // either we don't want QoS or the AP doesn't support QoS
+      pPktMetaInfo->ucUP = 0;
+      pPktMetaInfo->ucTID = 0;
+   }
+   else
+   {
+      /* 1. Check if ACM is set for this AC 
+       * 2. If set, check if this AC had already admitted 
+       * 3. If not already admitted, downgrade the UP to next best UP */
+      if(!pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired ||
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid)
+      {
+        pPktMetaInfo->ucUP = pktNode->userPriority;
+        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
+      }
+      else
+      {
+        //Downgrade the UP
+        acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid;
+        newAc = WLANTL_AC_BK;
+        for (i=ac-1; i>0; i--)
+        {
+            if (pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessRequired == 0)
+            {
+                newAc = i;
+                break;
+            }
+        }
+        pPktMetaInfo->ucUP = hddWmmAcToHighestUp[newAc];
+        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,"Downgrading UP %d to UP %d ", pktNode->userPriority, pPktMetaInfo->ucUP);
+      }
+   }
+
+   pPktMetaInfo->ucType = 0;          //FIXME Don't know what this is
+   pPktMetaInfo->ucDisableFrmXtl = 0; //802.3 frame so we need to xlate
+   if ( 1 < size )
+   {
+       pPktMetaInfo->bMorePackets = 1; //HDD has more packets to send
+   }
+   else
+   {
+       pPktMetaInfo->bMorePackets = 0;
+   }
+
+   //Extract the destination address from ethernet frame
+   pDestMacAddress = (v_MACADDR_t*)skb->data;
+   pPktMetaInfo->ucBcast = vos_is_macaddr_broadcast( pDestMacAddress ) ? 1 : 0;
+   pPktMetaInfo->ucMcast = vos_is_macaddr_group( pDestMacAddress ) ? 1 : 0;
+
+   
+
+   // if we are in a backpressure situation see if we can turn the hose back on
+   if ( (pAdapter->isTxSuspended[ac]) &&
+        (size <= HDD_TX_QUEUE_LOW_WATER_MARK) )
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDePressured;
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDePressuredAC[ac];
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                 "%s: TX queue[%d] re-enabled", __FUNCTION__, ac);
+      pAdapter->isTxSuspended[ac] = VOS_FALSE;      
+      netif_tx_wake_queue(netdev_get_tx_queue(pAdapter->dev, 
+                                        skb_get_queue_mapping(skb) ));
+   }
+
+
+   // We're giving the packet to TL so consider it transmitted from
+   // a statistics perspective.  We account for it here instead of
+   // when the packet is returned for two reasons.  First, TL will
+   // manipulate the skb to the point where the len field is not
+   // accurate, leading to inaccurate byte counts if we account for
+   // it later.  Second, TL does not provide any feedback as to
+   // whether or not the packet was successfully sent over the air,
+   // so the packet counts will be the same regardless of where we
+   // account for them
+   pAdapter->stats.tx_bytes += skb->len;
+   ++pAdapter->stats.tx_packets;
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeued;
+   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeuedAC[ac];
+
+   if(pHddCtx->cfg_ini->thermalMitigationEnable)
+   {
+      if(mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Tm Lock fail", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+      if(WLAN_HDD_TM_LEVEL_1 < pHddCtx->tmInfo.currentTmLevel)
+      {
+         if(0 == pHddCtx->tmInfo.txFrameCount)
+         {
+            /* Just recovered from sleep timeout */
+            pHddCtx->tmInfo.lastOpenTs = timestamp;
+         }
+
+         if(((timestamp - pHddCtx->tmInfo.lastOpenTs) > (pHddCtx->tmInfo.tmAction.txOperationDuration / 10)) &&
+            (pHddCtx->tmInfo.txFrameCount >= pHddCtx->tmInfo.tmAction.txBlockFrameCountThreshold))
+         {
+            spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+            /* During TX open duration, TX frame count is larger than threshold
+             * Block TX during Sleep time */
+            netif_tx_stop_all_queues(pAdapter->dev);
+            spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+            pHddCtx->tmInfo.lastblockTs = timestamp;
+            if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pHddCtx->tmInfo.txSleepTimer))
+            {
+               vos_timer_start(&pHddCtx->tmInfo.txSleepTimer, pHddCtx->tmInfo.tmAction.txSleepDuration);
+            }
+         }
+         else if(((timestamp - pHddCtx->tmInfo.lastOpenTs) > (pHddCtx->tmInfo.tmAction.txOperationDuration / 10)) &&
+                 (pHddCtx->tmInfo.txFrameCount < pHddCtx->tmInfo.tmAction.txBlockFrameCountThreshold))
+         {
+            /* During TX open duration, TX frame count is less than threshold
+             * Reset count and timestamp to prepare next cycle */
+            pHddCtx->tmInfo.lastOpenTs = timestamp;
+            pHddCtx->tmInfo.txFrameCount = 0;
+         }
+         else
+         {
+            /* Do Nothing */
+         }
+         pHddCtx->tmInfo.txFrameCount++;
+      }
+      mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
+   }
+
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: Valid VOS PKT returned to TL", __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+
+   return status;
+}
+
+
+/**============================================================================
+  @brief hdd_tx_low_resource_cbk() - Callback function invoked in the 
+  case where VOS packets are not available at the time of the call to get 
+  packets. This callback function is invoked by VOS when packets are 
+  available.
+
+  @param pVosPacket : [in]  pointer to VOS packet 
+  @param userData   : [in]  opaque user data that was passed initially 
+  
+  @return           : VOS_STATUS_E_FAILURE if any errors encountered, 
+                    : VOS_STATUS_SUCCESS otherwise
+  =============================================================================*/
+VOS_STATUS hdd_tx_low_resource_cbk( vos_pkt_t *pVosPacket, 
+                                    v_VOID_t *userData )
+{
+   VOS_STATUS status;
+   v_SINT_t i = 0;
+   v_SIZE_t size = 0;
+   hdd_adapter_t* pAdapter = (hdd_adapter_t *)userData;
+   
+   if(pAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //Return the packet to VOS. We just needed to know that VOS is out of low resource
+   //situation. Here we will only signal TL that there is a pending data for a STA. 
+   //VOS packet will be requested (if needed) when TL comes back to fetch data.
+   vos_pkt_return_packet( pVosPacket );
+
+   pAdapter->isVosOutOfResource = VOS_FALSE;
+
+   //Indicate to TL that there is pending data if a queue is non empty
+   for( i=NUM_TX_QUEUES-1; i>=0; --i )
+   {
+      size = 0;
+      hdd_list_size( &pAdapter->wmm_tx_queue[i], &size );
+      if ( size > 0 )
+      {
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, 
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId [0], 
+                                        (WLANTL_ACEnumType)i );
+         if( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure in indicating pkt to TL for ac=%d", __FUNCTION__,i); 
+         }
+      }
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**============================================================================
+  @brief hdd_rx_packet_cbk() - Receive callback registered with TL.
+  TL will call this to notify the HDD when one or more packets were
+  received for a registered STA.
+
+  @param vosContext      : [in] pointer to VOS context  
+  @param pVosPacketChain : [in] pointer to VOS packet chain
+  @param staId           : [in] Station Id
+  @param pRxMetaInfo     : [in] pointer to meta info for the received pkt(s) 
+
+  @return                : VOS_STATUS_E_FAILURE if any errors encountered, 
+                         : VOS_STATUS_SUCCESS otherwise
+  ===========================================================================*/
+VOS_STATUS hdd_rx_packet_cbk( v_VOID_t *vosContext, 
+                              vos_pkt_t *pVosPacketChain,
+                              v_U8_t staId,
+                              WLANTL_RxMetaInfoType* pRxMetaInfo )
+{
+   hdd_adapter_t *pAdapter = NULL;
+   hdd_context_t *pHddCtx = NULL;
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   int rxstat;
+   struct sk_buff *skb = NULL;
+   vos_pkt_t* pVosPacket;
+   vos_pkt_t* pNextVosPacket;
+
+   //Sanity check on inputs
+   if ( ( NULL == vosContext ) || 
+        ( NULL == pVosPacketChain ) ||
+        ( NULL == pRxMetaInfo ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Null params being passed", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+   if ( NULL == pHddCtx )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pAdapter = pHddCtx->sta_to_adapter[staId];
+   if( NULL == pAdapter )
+   {
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   ++pAdapter->hdd_stats.hddTxRxStats.rxChains;
+
+   // walk the chain until all are processed
+   pVosPacket = pVosPacketChain;
+   do
+   {
+      // get the pointer to the next packet in the chain
+      // (but don't unlink the packet since we free the entire chain later)
+      status = vos_pkt_walk_packet_chain( pVosPacket, &pNextVosPacket, VOS_FALSE);
+
+      // both "success" and "empty" are acceptable results
+      if (!((status == VOS_STATUS_SUCCESS) || (status == VOS_STATUS_E_EMPTY)))
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure walking packet chain", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      // Extract the OS packet (skb).
+      // Tell VOS to detach the OS packet from the VOS packet
+      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
+      if(!VOS_IS_STATUS_SUCCESS( status ))
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+   
+      skb->dev = pAdapter->dev;
+      skb->protocol = eth_type_trans(skb, skb->dev);
+      skb->ip_summed = CHECKSUM_UNNECESSARY;
+      ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
+      ++pAdapter->stats.rx_packets;
+      pAdapter->stats.rx_bytes += skb->len;
+      rxstat = netif_rx_ni(skb);
+      if (NET_RX_SUCCESS == rxstat)
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxDelivered;
+      }
+      else
+      {
+         ++pAdapter->hdd_stats.hddTxRxStats.rxRefused;
+      }
+      // now process the next packet in the chain
+      pVosPacket = pNextVosPacket;
+
+   } while (pVosPacket);
+
+   //Return the entire VOS packet chain to the resource pool
+   status = vos_pkt_return_packet( pVosPacketChain );
+   if(!VOS_IS_STATUS_SUCCESS( status ))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure returning vos pkt", __FUNCTION__);
+   }
+   
+   pAdapter->dev->last_rx = jiffies;
+
+   return status;   
+}
+
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
new file mode 100644
index 0000000..4dc3cc7
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -0,0 +1,6054 @@
+/*
+ * 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 wlan_hdd_wext.c
+
+    \brief Airgo Linux Wireless Extensions Common Control Plane Types and
+    interfaces.
+
+    $Id: wlan_hdd_wext.c,v 1.34 2007/04/14 01:49:23 jimz Exp jimz $
+
+    Copyright (C) 2007 Airgo Networks, Incorporated
+
+    This file defines all of the types that are utilized by the CCP module
+    of the "Portable" HDD.   This file also includes the underlying Linux
+    Wireless Extensions Data types referred to by CCP.
+
+  ======================================================================== */
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/wireless.h>
+#include <wlan_hdd_includes.h>
+#include <wlan_btc_svc.h>
+#include <wlan_nlink_common.h>
+#ifdef WLAN_BTAMP_FEATURE
+#include <bap_hdd_main.h>
+#endif
+#include <vos_api.h>
+#include <net/arp.h>
+#include "ccmApi.h"
+#include "sirParams.h"
+#include "csrApi.h"
+#include "csrInsideApi.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "smeRrmInternal.h"
+#endif
+#include <aniGlobal.h>
+#include "dot11f.h"
+#include <wlan_hdd_wowl.h>
+#include <wlan_hdd_cfg.h>
+#include <wlan_hdd_wmm.h>
+#include "utilsApi.h"
+#ifdef WLAN_FEATURE_P2P
+#include "wlan_hdd_p2p.h"
+#endif
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+#include "wlan_hdd_power.h"
+#include "qwlan_version.h"
+#include <vos_power.h>
+#include "wlan_hdd_host_offload.h"
+#include "wlan_hdd_keep_alive.h"
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#include "wlan_hdd_packet_filtering.h"
+#endif
+
+#ifdef CONFIG_CFG80211
+#include <linux/wireless.h>
+#include <net/cfg80211.h>
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_pal_trace.h"
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+#include "wlan_hdd_misc.h"
+#include "bap_hdd_misc.h"
+
+#include "wlan_hdd_dev_pwr.h"
+#include "qc_sap_ioctl.h"
+#define WE_MAX_STR_LEN 1024
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend);
+extern void hdd_resume_wlan(struct early_suspend *wlan_suspend);
+#endif
+
+
+#define HDD_FINISH_ULA_TIME_OUT    800
+
+extern int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand);
+int hdd_setBand_helper(struct net_device *dev, tANI_U8* ptr);
+
+static int ioctl_debug = 0;
+module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+struct statsContext
+{
+   struct completion completion;
+   hdd_adapter_t *pAdapter;
+   unsigned int magic;
+};
+
+#define STATS_CONTEXT_MAGIC 0x53544154   //STAT
+#define RSSI_CONTEXT_MAGIC  0x52535349   //RSSI
+#define POWER_CONTEXT_MAGIC 0x504F5752   // POWR
+
+/* To Validate Channel against the Frequency and Vice-Versa */
+static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2},
+        {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7}, {2447, 8},
+        {2452, 9}, {2457, 10}, {2462, 11}, {2467 ,12}, {2472, 13},
+        {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, {4980, 252},
+        {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, {5200, 40}, {5220, 44},
+        {5240, 48}, {5260, 52}, {5280, 56}, {5300, 60}, {5320, 64}, {5500, 100},
+        {5520, 104}, {5540, 108}, {5560, 112}, {5580, 116}, {5600, 120},
+        {5620, 124}, {5640, 128}, {5660, 132}, {5680, 136}, {5700, 140},
+        {5745, 149}, {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165} };
+
+#define FREQ_CHAN_MAP_TABLE_SIZE sizeof(freq_chan_map)/sizeof(freq_chan_map[0])
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_INT_GET_NONE    (SIOCIWFIRSTPRIV + 0)
+#define WE_SET_11D_STATE     1
+#define WE_WOWL              2
+#define WE_SET_POWER         3
+#define WE_SET_MAX_ASSOC     4
+#define WE_SET_SAP_AUTO_CHANNEL_SELECTION     5
+#define WE_SET_DATA_INACTIVITY_TO  6
+#define WE_SET_MAX_TX_POWER  7
+#define WE_SET_HIGHER_DTIM_TRANSITION   8
+#define WE_SET_TM_LEVEL      9
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_NONE_GET_INT    (SIOCIWFIRSTPRIV + 1)
+#define WE_GET_11D_STATE     1
+#define WE_IBSS_STATUS       2
+#define WE_PMC_STATE         3
+#define WE_GET_WLAN_DBG      4
+#define WE_MODULE_DOWN_IND   5
+#define WE_GET_MAX_ASSOC     6
+#define WE_GET_WDI_DBG       7
+#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
+#define WE_GET_CONCURRENCY_MODE 9
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_INT_GET_INT     (SIOCIWFIRSTPRIV + 2)
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_CHAR_GET_NONE   (SIOCIWFIRSTPRIV + 3)
+#define WE_WOWL_ADD_PTRN     1
+#define WE_WOWL_DEL_PTRN     2
+#if defined WLAN_FEATURE_VOWIFI
+#define WE_NEIGHBOR_REPORT_REQUEST 3
+#endif
+#define WE_SET_AP_WPS_IE     4  //This is called in station mode to set probe rsp ie.
+#define WE_SET_CONFIG        5
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_THREE_INT_GET_NONE   (SIOCIWFIRSTPRIV + 4)
+#define WE_SET_WLAN_DBG      1
+#define WE_SET_WDI_DBG       2
+#define WE_SET_SAP_CHANNELS  3
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_GET_CHAR_SET_NONE   (SIOCIWFIRSTPRIV + 5)
+#define WE_WLAN_VERSION      1
+#define WE_GET_STATS         2
+#define WE_GET_CFG           3
+#define WE_GET_WMM_STATUS    4
+#define WE_GET_CHANNEL_LIST  5
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
+#define WE_CLEAR_STATS       1
+#define WE_INIT_AP           2
+#define WE_STOP_AP           3
+#define WE_ENABLE_AMP        4
+#define WE_DISABLE_AMP       5
+
+/* Private ioctls and their sub-ioctls */
+#define WLAN_PRIV_SET_VAR_INT_GET_NONE   (SIOCIWFIRSTPRIV + 7)
+#define WE_LOG_DUMP_CMD      1
+
+#ifdef WLAN_FEATURE_P2P
+#define WE_P2P_NOA_CMD       2
+#endif
+
+#define MAX_VAR_ARGS         7
+
+/* Private ioctls (with no sub-ioctls) */
+/* note that they must be odd so that they have "get" semantics */
+#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV +  9)
+#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
+#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
+
+#ifdef FEATURE_WLAN_WAPI
+/* Private ioctls EVEN NO: SET, ODD NO:GET */
+#define WLAN_PRIV_SET_WAPI_MODE         (SIOCIWFIRSTPRIV + 8)
+#define WLAN_PRIV_GET_WAPI_MODE         (SIOCIWFIRSTPRIV + 16)
+#define WLAN_PRIV_SET_WAPI_ASSOC_INFO   (SIOCIWFIRSTPRIV + 10)
+#define WLAN_PRIV_SET_WAPI_KEY          (SIOCIWFIRSTPRIV + 12)
+#define WLAN_PRIV_SET_WAPI_BKID         (SIOCIWFIRSTPRIV + 14)
+#define WLAN_PRIV_GET_WAPI_BKID         (SIOCIWFIRSTPRIV + 15)
+#define WAPI_PSK_AKM_SUITE  0x02721400
+#define WAPI_CERT_AKM_SUITE 0x01721400
+#endif
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#define WLAN_PRIV_SET_FTIES             (SIOCIWFIRSTPRIV + 20)
+#endif
+
+/* Private ioctl for setting the host offload feature */
+#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
+
+/* Private ioctl to get the statistics */
+#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
+
+/* Private ioctl to set the Keep Alive Params */
+#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/* Private ioctl to set the Packet Filtering Params */
+#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
+#endif
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/* Private ioctl to get the statistics */
+#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
+#endif
+
+#define WLAN_SET_BAND_CONFIG  (SIOCIWFIRSTPRIV + 25)  /*Don't change this number*/
+
+#define WLAN_PRIV_SET_MCBC_FILTER    (SIOCIWFIRSTPRIV + 26)
+#define WLAN_PRIV_CLEAR_MCBC_FILTER  (SIOCIWFIRSTPRIV + 27)
+#define WLAN_SET_POWER_PARAMS        (SIOCIWFIRSTPRIV + 29)
+#define WLAN_GET_LINK_SPEED          (SIOCIWFIRSTPRIV + 31)
+
+#define WLAN_STATS_INVALID            0
+#define WLAN_STATS_RETRY_CNT          1
+#define WLAN_STATS_MUL_RETRY_CNT      2
+#define WLAN_STATS_TX_FRM_CNT         3
+#define WLAN_STATS_RX_FRM_CNT         4
+#define WLAN_STATS_FRM_DUP_CNT        5
+#define WLAN_STATS_FAIL_CNT           6
+#define WLAN_STATS_RTS_FAIL_CNT       7
+#define WLAN_STATS_ACK_FAIL_CNT       8
+#define WLAN_STATS_RTS_SUC_CNT        9
+#define WLAN_STATS_RX_DISCARD_CNT     10
+#define WLAN_STATS_RX_ERROR_CNT       11
+#define WLAN_STATS_TX_BYTE_CNT        12
+
+#define WLAN_STATS_RX_BYTE_CNT        13
+#define WLAN_STATS_RX_RATE            14
+#define WLAN_STATS_TX_RATE            15
+
+#define FILL_TLV(__p, __type, __size, __val, __tlen) \
+{\
+    if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \
+    {\
+        *__p++ = __type;\
+        *__p++ = __size;\
+        memcpy(__p, __val, __size);\
+        __p += __size;\
+        __tlen += __size + 2;\
+    }\
+    else \
+    {                                                         \
+        hddLog(VOS_TRACE_LEVEL_ERROR, "FILL_TLV Failed!!!\n");\
+    }                                                         \
+}while(0);
+
+#define VERSION_VALUE_MAX_LEN 32
+
+#define TX_PER_TRACKING_DEFAULT_RATIO             5
+#define TX_PER_TRACKING_MAX_RATIO                10
+#define TX_PER_TRACKING_DEFAULT_WATERMARK         5
+
+#define WLAN_HDD_UI_BAND_AUTO                     0
+#define WLAN_HDD_UI_BAND_5_GHZ                    1
+#define WLAN_HDD_UI_BAND_2_4_GHZ                  2
+#define WLAN_HDD_UI_SET_BAND_VALUE_OFFSET         8
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest);
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+#endif
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+/**---------------------------------------------------------------------------
+
+  \brief hdd_wlan_get_version() -
+
+   This function use to get Wlan Driver And Firmware Version.
+
+  \param  - pAdapter Pointer to the adapter.
+            wrqu - Pointer to IOCTL REQUEST Data.
+            extra - Pointer to char
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+int hdd_wlan_get_version(hdd_adapter_t *pAdapter, union iwreq_data *wrqu,
+                         char *extra)
+{
+    VOS_STATUS status;
+    FwVersionInfo fwversion;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    v_U32_t reg_val;
+    char *buf = extra;
+
+    buf += snprintf(buf, VERSION_VALUE_MAX_LEN, "%s_", WLAN_CHIP_VERSION);
+    /*Read the RevID*/
+    status = sme_DbgReadRegister(hHal, QWLAN_RFAPB_REV_ID_REG, &reg_val);
+
+    if ( !VOS_IS_STATUS_SUCCESS( status ) ) {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!\n", __func__);
+       return -EINVAL;
+    }
+
+    buf += snprintf(buf, VERSION_VALUE_MAX_LEN, "%x.%x-", (v_U8_t)(reg_val >> 8),
+                               (v_U8_t)(reg_val & 0x000000FF));
+
+    status = sme_GetFwVersion(hHal, &fwversion);
+
+    if ( !VOS_IS_STATUS_SUCCESS( status ) ) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!\n", __func__);
+        return -EINVAL;
+    }
+    buf += snprintf(buf, VERSION_VALUE_MAX_LEN, "%s-", QWLAN_VERSIONSTR);
+    buf += snprintf(buf, VERSION_VALUE_MAX_LEN, "%ld.%ld.%ld.%ld",
+                                    fwversion.uMj, fwversion.uMn,
+                                    fwversion.uPatch, fwversion.uBuild);
+    wrqu->data.length = strlen(extra);
+
+    return 0;
+}
+
+#endif
+int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
+{
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    v_U32_t threshold = 0,status = 0;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
+    }
+
+    if ( eHAL_STATUS_SUCCESS !=
+                     ccmCfgGetInt(hHal, WNI_CFG_RTS_THRESHOLD, &threshold) )
+    {
+       return -EIO;
+    }
+    wrqu->rts.value = threshold;
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                 ("Rts-Threshold=%ld!!\n"), wrqu->rts.value);
+
+    EXIT();
+
+    return 0;
+}
+
+int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
+{
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    v_U32_t threshold = 0,status = 0;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
+    }
+
+    if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
+                                                != eHAL_STATUS_SUCCESS )
+    {
+        return -EIO;
+    }
+    wrqu->frag.value = threshold;
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                               ("Frag-Threshold=%ld!!\n"), wrqu->frag.value);
+
+    EXIT();
+
+    return 0;
+}
+
+int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq)
+{
+     if((channel > 0) && (channel <= (FREQ_CHAN_MAP_TABLE_SIZE - 1)))
+     {
+       *pfreq = freq_chan_map[channel - 1].freq * 100000;
+       return 0;
+     }
+     else
+       return -EINVAL;
+}
+
+static v_BOOL_t
+hdd_IsAuthTypeRSN( tHalHandle halHandle, eCsrAuthType authType)
+{
+    v_BOOL_t rsnType = VOS_FALSE;
+    // is the authType supported?
+    switch (authType)
+    {
+        case eCSR_AUTH_TYPE_NONE:    //never used
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+        // MAC layer authentication types
+        case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+        case eCSR_AUTH_TYPE_SHARED_KEY:
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+        case eCSR_AUTH_TYPE_AUTOSWITCH:
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+
+        // Upper layer authentication types
+        case eCSR_AUTH_TYPE_WPA:
+            rsnType = eANI_BOOLEAN_TRUE;
+            break;
+        case eCSR_AUTH_TYPE_WPA_PSK:
+            rsnType = eANI_BOOLEAN_TRUE;
+            break;
+        case eCSR_AUTH_TYPE_WPA_NONE:
+            rsnType = eANI_BOOLEAN_TRUE;
+            break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_AUTH_TYPE_FT_RSN:
+#endif
+        case eCSR_AUTH_TYPE_RSN:
+            rsnType = eANI_BOOLEAN_TRUE;
+            break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_AUTH_TYPE_FT_RSN_PSK:
+#endif
+        case eCSR_AUTH_TYPE_RSN_PSK:
+            rsnType = eANI_BOOLEAN_TRUE;
+            break;
+        //case eCSR_AUTH_TYPE_FAILED:
+        case eCSR_AUTH_TYPE_UNKNOWN:
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+        default:
+            hddLog(LOGE, FL("%s called with unknown authType - default to Open, None\n"),
+                                                                                      __FUNCTION__);
+            rsnType = eANI_BOOLEAN_FALSE;
+            break;
+    }
+    hddLog(LOGE, FL("%s called with authType: %d, returned: %d\n"),
+                                             __FUNCTION__, authType, rsnType);
+    return rsnType;
+}
+
+static void hdd_GetRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext )
+{
+   struct statsContext *pStatsContext;
+   hdd_adapter_t *pAdapter;
+
+   if (ioctl_debug)
+   {
+      pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n",
+              __FUNCTION__, (int)rssi, (int)staId, pContext);
+   }
+
+   if (NULL == pContext)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Bad param, pContext [%p]",
+             __FUNCTION__, pContext);
+      return;
+   }
+
+   /* there is a race condition that exists between this callback function
+      and the caller since the caller could time out either before or
+      while this code is executing.  we'll assume the timeout hasn't
+      occurred, but we'll verify that right before we save our work */
+
+   pStatsContext = pContext;
+   pAdapter      = pStatsContext->pAdapter;
+   if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic))
+   {
+      /* the caller presumably timed out so there is nothing we can do */
+      hddLog(VOS_TRACE_LEVEL_WARN,
+             "%s: Invalid context, pAdapter [%p] magic [%08x]",
+              __FUNCTION__, pAdapter, pStatsContext->magic);
+      if (ioctl_debug)
+      {
+         pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
+                 __FUNCTION__, pAdapter, pStatsContext->magic);
+      }
+      return;
+   }
+
+   /* the race is on.  caller could have timed out immediately after
+      we verified the magic, but if so, caller will wait a short time
+      for us to copy over the rssi */
+   pAdapter->rssi = rssi;
+
+   /* and notify the caller */
+   complete(&pStatsContext->completion);
+}
+
+VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value)
+{
+   struct statsContext context;
+   hdd_context_t *pHddCtx;
+   hdd_station_ctx_t *pHddStaCtx;
+   eHalStatus hstatus;
+   long lrc;
+
+   if (NULL == pAdapter)
+   {
+       hddLog(VOS_TRACE_LEVEL_WARN,
+              "%s: Invalid context, pAdapter", __func__);
+       return VOS_STATUS_E_FAULT;
+   }
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__);
+       /* return a cached value */
+       *rssi_value = pAdapter->rssi;
+       return VOS_STATUS_SUCCESS;
+   }
+
+   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+   init_completion(&context.completion);
+   context.pAdapter = pAdapter;
+   context.magic = RSSI_CONTEXT_MAGIC;
+
+   hstatus = sme_GetRssi(pHddCtx->hHal, hdd_GetRssiCB,
+                         pHddStaCtx->conn_info.staId[ 0 ],
+                         pHddStaCtx->conn_info.bssId,
+                         &context, pHddCtx->pvosContext);
+   if (eHAL_STATUS_SUCCESS != hstatus)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI",
+              __FUNCTION__);
+       /* we'll returned a cached value below */
+   }
+   else
+   {
+       /* request was sent -- wait for the response */
+       lrc = wait_for_completion_interruptible_timeout(&context.completion,
+                                    msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
+       /* either we have a response or we timed out
+          either way, first invalidate our magic */
+       context.magic = 0;
+       if (lrc <= 0)
+       {
+          hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while retrieving RSSI ",
+                 __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+          /* there is a race condition such that the callback
+             function could be executing at the same time we are. of
+             primary concern is if the callback function had already
+             verified the "magic" but hasn't yet set the completion
+             variable.  Since the completion variable is on our
+             stack, we'll delay just a bit to make sure the data is
+             still valid if that is the case */
+          msleep(50);
+          /* we'll now returned a cached value below */
+       }
+   }
+   *rssi_value = pAdapter->rssi;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+void hdd_StatisticsCB( void *pStats, void *pContext )
+{
+   hdd_adapter_t             *pAdapter      = (hdd_adapter_t *)pContext;
+   hdd_stats_t               *pStatsCache   = NULL;
+   hdd_wext_state_t *pWextState;
+   VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+
+   tCsrSummaryStatsInfo      *pSummaryStats = NULL;
+   tCsrGlobalClassAStatsInfo *pClassAStats  = NULL;
+   tCsrGlobalClassBStatsInfo *pClassBStats  = NULL;
+   tCsrGlobalClassCStatsInfo *pClassCStats  = NULL;
+   tCsrGlobalClassDStatsInfo *pClassDStats  = NULL;
+   tCsrPerStaStatsInfo       *pPerStaStats  = NULL;
+
+   if (pAdapter!= NULL)
+     pStatsCache = &pAdapter->hdd_stats;
+
+
+   pSummaryStats = (tCsrSummaryStatsInfo *)pStats;
+   pClassAStats  = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 );
+   pClassBStats  = (tCsrGlobalClassBStatsInfo *)( pClassAStats + 1 );
+   pClassCStats  = (tCsrGlobalClassCStatsInfo *)( pClassBStats + 1 );
+   pClassDStats  = (tCsrGlobalClassDStatsInfo *)( pClassCStats + 1 );
+   pPerStaStats  = (tCsrPerStaStatsInfo *)( pClassDStats + 1 );
+
+   if (pStatsCache!=NULL)
+   {
+      // and copy the stats into the cache we keep in the adapter instance structure
+      vos_mem_copy( &pStatsCache->summary_stat, pSummaryStats, sizeof( pStatsCache->summary_stat ) );
+      vos_mem_copy( &pStatsCache->ClassA_stat, pClassAStats, sizeof( pStatsCache->ClassA_stat ) );
+      vos_mem_copy( &pStatsCache->ClassB_stat, pClassBStats, sizeof( pStatsCache->ClassB_stat ) );
+      vos_mem_copy( &pStatsCache->ClassC_stat, pClassCStats, sizeof( pStatsCache->ClassC_stat ) );
+      vos_mem_copy( &pStatsCache->ClassD_stat, pClassDStats, sizeof( pStatsCache->ClassD_stat ) );
+      vos_mem_copy( &pStatsCache->perStaStats, pPerStaStats, sizeof( pStatsCache->perStaStats ) );
+   }
+
+    if(pAdapter)
+    {
+        pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+        if(pWextState)
+        {
+           vos_status = vos_event_set(&pWextState->vosevent);
+           if (!VOS_IS_STATUS_SUCCESS(vos_status))
+           {
+              VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                        "%s: vos_event_set failed", __FUNCTION__);
+              return;
+           }
+        }
+    }
+}
+
+void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result)
+{
+   v_CONTEXT_t pVosContext;
+   hdd_context_t *pHddCtx;
+   VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx );
+#if 0
+   hdd_wext_state_t *pWextState;
+   v_U32_t roamId;
+#endif
+
+   ENTER();
+
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL);
+
+   pHddCtx = (hdd_context_t*) vos_get_context(VOS_MODULE_ID_HDD,pVosContext);
+   if (NULL == pHddCtx)
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid pHddCtx", __FUNCTION__);
+      return;
+   }
+#if 0
+   pWextState = pAdapter->pWextState;
+#endif
+
+   if (WNI_CFG_NEED_RESTART == result || WNI_CFG_NEED_RELOAD == result)
+   {
+      //TODO Verify is this is really used. If yes need to fix it.
+      hdd_reconnect_all_adapters( pHddCtx );
+#if 0
+      pAdapter->conn_info.connState = eConnectionState_NotConnected;
+      INIT_COMPLETION(pAdapter->disconnect_comp_var);
+      vosStatus = sme_RoamDisconnect(halHandle, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+      if(VOS_STATUS_SUCCESS == vosStatus)
+          wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+                     msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+
+      sme_RoamConnect(halHandle,
+                     pAdapter->sessionId, &(pWextState->roamProfile),
+                     &roamId);
+#endif
+   }
+
+   EXIT();
+
+}
+
+void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter)
+{
+   int i = 0;
+   hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+   /* clear WPA/RSN/WSC IE information in the profile */
+   pWextState->roamProfile.nWPAReqIELength = 0;
+   pWextState->roamProfile.pWPAReqIE = (tANI_U8 *)NULL;
+   pWextState->roamProfile.nRSNReqIELength = 0;
+   pWextState->roamProfile.pRSNReqIE = (tANI_U8 *)NULL;
+
+   pWextState->roamProfile.bWPSAssociation = VOS_FALSE;
+   pWextState->roamProfile.pAddIEScan = (tANI_U8 *)NULL;
+   pWextState->roamProfile.nAddIEScanLength = 0;
+   pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL;
+   pWextState->roamProfile.nAddIEAssocLength = 0;
+
+   pWextState->roamProfile.EncryptionType.numEntries = 1;
+   pWextState->roamProfile.EncryptionType.encryptionType[0]
+                                                     = eCSR_ENCRYPT_TYPE_NONE;
+
+   pWextState->roamProfile.mcEncryptionType.numEntries = 1;
+   pWextState->roamProfile.mcEncryptionType.encryptionType[0]
+                                                     = eCSR_ENCRYPT_TYPE_NONE;
+
+   pWextState->roamProfile.AuthType.numEntries = 1;
+   pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+   pWextState->authKeyMgmt = 0;
+
+   for (i=0; i < CSR_MAX_NUM_KEY; i++)
+   {
+      if (pWextState->roamProfile.Keys.KeyMaterial[i])
+      {
+         pWextState->roamProfile.Keys.KeyLength[i] = 0;
+      }
+   }
+#ifdef FEATURE_WLAN_WAPI
+   pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN;
+   pAdapter->wapi_info.nWapiMode = 0;
+#endif
+
+   vos_mem_zero((void *)(pWextState->req_bssId), WNI_CFG_BSSID_LEN);
+
+}
+
+void wlan_hdd_ula_done_cb(v_VOID_t *callbackContext)
+{
+    hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext;
+    hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    complete(&pWextState->completion_var);
+}
+
+VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter)
+{
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    VOS_STATUS vos_status;
+
+    if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)
+    {
+        INIT_COMPLETION(pWextState->completion_var);
+
+        /*To avoid race condition between the set key and the last EAPOL
+          packet, notify TL to finish upper layer authentication incase if the
+          last EAPOL packet pending in the TL queue.*/
+        vos_status = WLANTL_Finish_ULA(wlan_hdd_ula_done_cb,pAdapter);
+
+        if ( vos_status != VOS_STATUS_SUCCESS )
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "[%4d] WLANTL_Finish_ULA returned ERROR status= %d",
+                   __LINE__, vos_status );
+            return vos_status;
+
+        }
+
+        wait_for_completion_timeout(&pWextState->completion_var,
+                                    msecs_to_jiffies(HDD_FINISH_ULA_TIME_OUT));
+    }
+    return VOS_STATUS_SUCCESS;
+}
+
+v_U8_t* wlan_hdd_get_vendor_oui_ie_ptr(v_U8_t *oui, v_U8_t oui_size, v_U8_t *ie, int ie_len)
+{
+
+    int left = ie_len;
+    v_U8_t *ptr = ie;
+    v_U8_t elem_id,elem_len;
+    v_U8_t eid = 0xDD;
+
+    if ( NULL == ie || 0 == ie_len )
+       return NULL;
+
+    while(left >= 2)
+    {
+        elem_id  = ptr[0];
+        elem_len = ptr[1];
+        left -= 2;
+        if(elem_len > left)
+        {
+            hddLog(VOS_TRACE_LEVEL_FATAL,
+                   "****Invalid IEs eid = %d elem_len=%d left=%d*****\n",
+                    eid,elem_len,left);
+            return NULL;
+        }
+        if (elem_id == eid)
+        {
+            if(memcmp( &ptr[2], oui, oui_size)==0)
+                return ptr;
+        }
+
+        left -= elem_len;
+        ptr += (elem_len + 2);
+    }
+    return NULL;
+}
+
+static int iw_set_commit(struct net_device *dev, struct iw_request_info *info,
+                         union iwreq_data *wrqu, char *extra)
+{
+    hddLog( LOG1, "In %s\n", __FUNCTION__);
+    /* Do nothing for now */
+    return 0;
+}
+
+static int iw_get_name(struct net_device *dev,
+                       struct iw_request_info *info,
+                       char *wrqu, char *extra)
+{
+
+    ENTER();
+    strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ);
+    EXIT();
+    return 0;
+}
+
+static int iw_set_mode(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra)
+{
+    hdd_wext_state_t         *pWextState;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tCsrRoamProfile          *pRoamProfile;
+    eCsrRoamBssType          LastBSSType;
+    eMib_dot11DesiredBssType connectedBssType;
+    hdd_config_t             *pConfig;
+#ifdef CONFIG_CFG80211
+    struct wireless_dev      *wdev;
+#endif
+
+    ENTER();
+
+    if (NULL == pAdapter)
+    {
+        hddLog(VOS_TRACE_LEVEL_WARN,
+               "%s: Invalid context, pAdapter", __func__);
+        return 0;
+    }
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    if (pWextState == NULL)
+    {
+        hddLog (LOGE, "%s ERROR: Data Storage Corruption", __FUNCTION__);
+        return -EINVAL;
+    }
+
+#ifdef CONFIG_CFG80211
+    wdev = dev->ieee80211_ptr;
+#endif
+    pRoamProfile = &pWextState->roamProfile;
+    LastBSSType = pRoamProfile->BSSType;
+
+    hddLog( LOG1,"%s Old Bss type = %d", __FUNCTION__, LastBSSType);
+
+    switch (wrqu->mode)
+    {
+    case IW_MODE_ADHOC:
+        hddLog( LOG1,"%s Setting AP Mode as IW_MODE_ADHOC", __FUNCTION__);
+        pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS;
+        // Set the phymode correctly for IBSS.
+        pConfig  = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini;
+        pWextState->roamProfile.phyMode = hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+#ifdef CONFIG_CFG80211
+        wdev->iftype = NL80211_IFTYPE_ADHOC;
+#endif
+        break;
+    case IW_MODE_INFRA:
+        hddLog( LOG1, "%s Setting AP Mode as IW_MODE_INFRA", __FUNCTION__);
+        pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+#ifdef CONFIG_CFG80211
+        wdev->iftype = NL80211_IFTYPE_STATION;
+#endif
+        break;
+    case IW_MODE_AUTO:
+        hddLog(LOG1,"%s Setting AP Mode as IW_MODE_AUTO", __FUNCTION__);
+        pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY;
+        break;
+    default:
+        hddLog(LOG1,"%s Unknown AP Mode value", __FUNCTION__);
+        return -EOPNOTSUPP;
+    }
+
+    if ( LastBSSType != pRoamProfile->BSSType )
+    {
+        //the BSS mode changed
+        // We need to issue disconnect if connected or in IBSS disconnect state
+        if ( hdd_connGetConnectedBssType( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) ||
+             ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) )
+        {
+            VOS_STATUS vosStatus;
+            // need to issue a disconnect to CSR.
+            INIT_COMPLETION(pAdapter->disconnect_comp_var);
+            vosStatus = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                          pAdapter->sessionId,
+                                          eCSR_DISCONNECT_REASON_IBSS_LEAVE );
+            if(VOS_STATUS_SUCCESS == vosStatus)
+                 wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+                     msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+        }
+    }
+
+
+
+    EXIT();
+    return 0;
+}
+
+
+static int iw_get_mode(struct net_device *dev,
+                             struct iw_request_info *info,
+                             v_U32_t *uwrq, char *extra)
+{
+
+    hdd_wext_state_t *pWextState;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+    hddLog (LOG1, "In %s",__FUNCTION__);
+
+    if (NULL == pAdapter)
+    {
+        hddLog(VOS_TRACE_LEVEL_WARN,
+               "%s: Invalid context, pAdapter", __func__);
+        return 0;
+    }
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    if (pWextState == NULL)
+    {
+        hddLog (LOGE, "%s ERROR: Data Storage Corruption", __FUNCTION__);
+        return -EINVAL;
+    }
+
+    switch (pWextState->roamProfile.BSSType)
+    {
+    case eCSR_BSS_TYPE_INFRASTRUCTURE:
+        hddLog(LOG1, "%s returns IW_MODE_INFRA\n", __FUNCTION__);
+        *uwrq = IW_MODE_INFRA ;
+        break;
+    case eCSR_BSS_TYPE_IBSS:
+    case eCSR_BSS_TYPE_START_IBSS:
+        hddLog( LOG1,"%s returns IW_MODE_ADHOC\n", __FUNCTION__);
+        *uwrq= IW_MODE_ADHOC;
+        break;
+    case eCSR_BSS_TYPE_ANY:
+        hddLog( LOG1,"%s returns IW_MODE_AUTO\n", __FUNCTION__);
+        *uwrq= IW_MODE_AUTO;
+        break;
+    default:
+        hddLog( LOG1,"%s returns APMODE_UNKNOWN\n", __FUNCTION__);
+        break;
+    }
+    return 0;
+}
+
+static int iw_set_freq(struct net_device *dev, struct iw_request_info *info,
+             union iwreq_data *wrqu, char *extra)
+{
+    v_U32_t numChans = 0;
+    v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    v_U32_t indx = 0;
+    v_U32_t status = 0;
+
+    hdd_wext_state_t *pWextState;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    tCsrRoamProfile * pRoamProfile;
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return status;
+    }
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    pRoamProfile = &pWextState->roamProfile;
+
+    hddLog(LOG1,"setCHANNEL ioctl\n");
+
+    /* Link is up then return cant set channel*/
+    if(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState ||
+       eConnectionState_Associated == pHddStaCtx->conn_info.connState)
+    {
+        hddLog( LOGE, "IBSS Associated\n");
+        return -EOPNOTSUPP;
+    }
+
+    /* Settings by Frequency as input */
+    if((wrqu->freq.e == 1) && (wrqu->freq.m >= (tANI_U32)2.412e8) &&
+                            (wrqu->freq.m <= (tANI_U32)5.825e8))
+    {
+        tANI_U32 freq = wrqu->freq.m / 100000;
+
+        while ((indx <  FREQ_CHAN_MAP_TABLE_SIZE) && (freq != freq_chan_map[indx].freq))
+            indx++;
+        if (indx >= FREQ_CHAN_MAP_TABLE_SIZE)
+        {
+            return -EINVAL;
+        }
+        wrqu->freq.e = 0;
+        wrqu->freq.m = freq_chan_map[indx].chan;
+
+    }
+
+    if (wrqu->freq.e == 0)
+    {
+        if((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) ||
+                        (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX))
+        {
+            hddLog(LOG1,"%s: Channel [%d] is outside valid range from %d to %d\n",
+                __FUNCTION__, wrqu->freq.m, WNI_CFG_CURRENT_CHANNEL_STAMIN,
+                    WNI_CFG_CURRENT_CHANNEL_STAMAX);
+             return -EINVAL;
+        }
+
+        numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+
+        if (ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST,
+                validChan, &numChans) != eHAL_STATUS_SUCCESS){
+            return -EIO;
+        }
+
+        for (indx = 0; indx < numChans; indx++) {
+            if (wrqu->freq.m == validChan[indx]){
+                break;
+            }
+        }
+    }
+    else{
+
+        return -EINVAL;
+    }
+
+    if(indx >= numChans)
+    {
+        return -EINVAL;
+    }
+
+    /* Set the Operational Channel */
+    numChans = pRoamProfile->ChannelInfo.numOfChannels = 1;
+    pHddStaCtx->conn_info.operationChannel = wrqu->freq.m;
+    pRoamProfile->ChannelInfo.ChannelList = &pHddStaCtx->conn_info.operationChannel;
+
+    hddLog(LOG1,"pRoamProfile->operationChannel  = %d\n", wrqu->freq.m);
+
+    EXIT();
+
+    return status;
+}
+
+static int iw_get_freq(struct net_device *dev, struct iw_request_info *info,
+             struct iw_freq *fwrq, char *extra)
+{
+   v_U32_t status = 0,channel,freq = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal;
+   hdd_wext_state_t *pWextState;
+   tCsrRoamProfile * pRoamProfile;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+   ENTER();
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
+   }
+
+   pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+   pRoamProfile = &pWextState->roamProfile;
+
+   if( pHddStaCtx->conn_info.connState== eConnectionState_Associated )
+   {
+       if (sme_GetOperationChannel(hHal, &channel) != eHAL_STATUS_SUCCESS)
+       {
+           return -EIO;
+       }
+       else
+       {
+          fwrq->m = channel;
+          fwrq->e = 0;
+       }
+    }
+    else
+    {
+       channel = pHddStaCtx->conn_info.operationChannel;
+       status = hdd_wlan_get_freq(channel,&freq);
+       fwrq->m = freq;
+       fwrq->e = 0;
+    }
+   return status;
+}
+
+static int iw_get_tx_power(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+   if (pHddCtx->isLogpInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!",__func__);
+      return -EBUSY;
+   }
+
+   if(eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+   {
+      wrqu->txpower.value = 0;
+      return 0;
+   }
+   wlan_hdd_get_classAstats(pAdapter);
+   wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr;
+
+   return 0;
+}
+
+static int iw_set_tx_power(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+    ENTER();
+
+    if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
+    {
+        return -EIO;
+    }
+
+    EXIT();
+
+    return 0;
+}
+
+static int iw_get_bitrate(struct net_device *dev,
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu, char *extra)
+{
+   VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   hdd_wext_state_t *pWextState;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+   ENTER();
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
+   }
+
+   if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
+        wrqu->bitrate.value = 0;
+   }
+   else {
+      status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD,
+                               SME_SUMMARY_STATS       |
+                               SME_GLOBAL_CLASSA_STATS |
+                               SME_GLOBAL_CLASSB_STATS |
+                               SME_GLOBAL_CLASSC_STATS |
+                               SME_GLOBAL_CLASSD_STATS |
+                               SME_PER_STA_STATS,
+                               hdd_StatisticsCB, 0, FALSE,
+                               pHddStaCtx->conn_info.staId[0], pAdapter );
+
+      if(eHAL_STATUS_SUCCESS != status)
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: Unable to retrieve statistics",
+                __FUNCTION__);
+         return status;
+      }
+
+      pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+      vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
+
+      if (!VOS_IS_STATUS_SUCCESS(vos_status))
+      {
+         hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: SME timeout while retrieving statistics",
+                __FUNCTION__);
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      wrqu->bitrate.value = pAdapter->hdd_stats.ClassA_stat.tx_rate*500*1000;
+   }
+
+   EXIT();
+
+   return vos_status;
+}
+/* ccm call back function */
+
+static int iw_set_bitrate(struct net_device *dev,
+                          struct iw_request_info *info,
+                          union iwreq_data *wrqu,
+                          char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
+    v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
+    v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
+    v_U32_t i, rate;
+    v_U32_t valid_rate = FALSE, active_phy_mode = 0;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+    {
+        return -ENXIO ;
+    }
+
+    rate = wrqu->bitrate.value;
+
+    if (rate == -1)
+    {
+        rate = WNI_CFG_FIXED_RATE_AUTO;
+        valid_rate = TRUE;
+    }
+    else if (ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                        WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS)
+    {
+        if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G
+            || active_phy_mode == WNI_CFG_DOT11_MODE_11B)
+        {
+            if ((ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                        WNI_CFG_SUPPORTED_RATES_11A,
+                        supp_rates, &a_len) == eHAL_STATUS_SUCCESS) &&
+                (ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                        WNI_CFG_SUPPORTED_RATES_11B,
+                        supp_rates, &b_len) == eHAL_STATUS_SUCCESS))
+            {
+                for (i = 0; i < (b_len + a_len); ++i)
+                {
+                    /* supported rates returned is double the actual rate so we divide it by 2 */
+                    if ((supp_rates[i]&0x7F)/2 == rate)
+                    {
+                        valid_rate = TRUE;
+                        rate = i + WNI_CFG_FIXED_RATE_1MBPS;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+    if (valid_rate != TRUE)
+    {
+        return -EINVAL;
+    }
+    if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                     WNI_CFG_FIXED_RATE, rate,
+                     ccmCfgSetCallback,eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
+    {
+        return -EIO;
+    }
+    return 0;
+}
+
+
+static int iw_set_genie(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu,
+        char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    u_int8_t *genie;
+    v_U16_t remLen;
+
+   ENTER();
+   if(!wrqu->data.length) {
+      hdd_clearRoamProfileIe(pAdapter);
+      EXIT();
+      return 0;
+   }
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return 0;
+   }
+
+    genie = wrqu->data.pointer;
+    remLen = wrqu->data.length;
+
+    hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]\n", genie[0], genie[1]);
+
+    /* clear any previous genIE before this call */
+    memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
+
+    while (remLen >= 2)
+   {
+        v_U16_t eLen = 0;
+        v_U8_t elementId;
+        elementId = *genie++;
+        eLen  = *genie++;
+        remLen -= 2;
+
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]\n",
+            __func__, elementId, eLen);
+
+        switch ( elementId )
+         {
+            case IE_EID_VENDOR:
+                if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */
+                return -EINVAL;
+
+                if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4))
+                {
+                    v_U16_t curGenIELen = pWextState->genIE.length;
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS OUI(%02x %02x %02x %02x) IE(len %d)",
+                            __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2);
+
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) )
+                    {
+                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
+                                                      "Need bigger buffer space\n");
+                       VOS_ASSERT(0);
+                       return -ENOMEM;
+                    }
+                    // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
+                    memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
+                    pWextState->genIE.length += eLen + 2;
+                }
+                else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3))
+                {
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2);
+                    memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
+                    memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
+                    pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE;
+                    pWextState->roamProfile.nWPAReqIELength = eLen + 2;
+                }
+                else /* any vendorId except WPA IE should be accumulated to genIE */
+                {
+                    v_U16_t curGenIELen = pWextState->genIE.length;
+                    hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OUI(%02x %02x %02x %02x) IE(len %d)",
+                            __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2);
+
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) )
+                    {
+                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
+                                                      "Need bigger buffer space\n");
+                       VOS_ASSERT(0);
+                       return -ENOMEM;
+                    }
+                    // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
+                    memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
+                    pWextState->genIE.length += eLen + 2;
+                }
+              break;
+         case DOT11F_EID_RSN:
+                hddLog (LOG1, "%s Set RSN IE (len %d)",__FUNCTION__, eLen+2);
+                memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
+                memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
+                pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE;
+                pWextState->roamProfile.nRSNReqIELength = eLen + 2;
+              break;
+
+         default:
+                hddLog (LOGE, "%s Set UNKNOWN IE %X",__FUNCTION__, elementId);
+            return 0;
+    }
+        genie += eLen;
+        remLen -= eLen;
+    }
+    EXIT();
+    return 0;
+}
+
+static int iw_get_genie(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu,
+                        char *extra)
+{
+    hdd_wext_state_t *pWextState;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    eHalStatus status;
+    v_U32_t length = DOT11F_IE_RSN_MAX_LEN;
+    v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN];
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+
+    hddLog(LOG1,"getGEN_IE ioctl\n");
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected)
+    {
+        return -ENXIO;
+    }
+
+    // Return something ONLY if we are associated with an RSN or WPA network
+    if ( VOS_TRUE != hdd_IsAuthTypeRSN(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                                pWextState->roamProfile.negotiatedAuthType))
+    {
+        return -ENXIO;
+    }
+
+    // Actually retrieve the RSN IE from CSR.  (We previously sent it down in the CSR Roam Profile.)
+    status = csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                   pAdapter->sessionId,
+                                   &length,
+                                   genIeBytes);
+    wrqu->data.length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN);
+
+    vos_mem_copy( wrqu->data.pointer, (v_VOID_t*)genIeBytes, wrqu->data.length);
+
+    hddLog(LOG1,"%s: RSN IE of %d bytes returned\n", __FUNCTION__, wrqu->data.length );
+
+    EXIT();
+
+    return 0;
+}
+
+static int iw_get_encode(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct iw_point *dwrq, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
+    int keyId;
+    eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
+    int i;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
+
+    keyId = pRoamProfile->Keys.defaultIndex;
+
+    if(keyId < 0 || keyId >= MAX_WEP_KEYS)
+    {
+        hddLog(LOG1,"%s: Invalid keyId : %d\n",__FUNCTION__,keyId);
+        return -EINVAL;
+    }
+
+    if(pRoamProfile->Keys.KeyLength[keyId] > 0)
+    {
+        dwrq->flags |= IW_ENCODE_ENABLED;
+        dwrq->length = pRoamProfile->Keys.KeyLength[keyId];
+        vos_mem_copy(extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]);
+
+        dwrq->flags |= (keyId + 1);
+
+    }
+    else
+    {
+        dwrq->flags |= IW_ENCODE_DISABLED;
+    }
+
+    for(i=0; i < MAX_WEP_KEYS; i++)
+    {
+        if(pRoamProfile->Keys.KeyMaterial[i] == NULL)
+        {
+            continue;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    if(MAX_WEP_KEYS == i)
+    {
+        dwrq->flags |= IW_ENCODE_NOKEY;
+    }
+
+    authType = ((hdd_station_ctx_t*)WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
+
+    if(eCSR_AUTH_TYPE_OPEN_SYSTEM == authType)
+    {
+        dwrq->flags |= IW_ENCODE_OPEN;
+    }
+    else
+    {
+        dwrq->flags |= IW_ENCODE_RESTRICTED;
+    }
+    EXIT();
+    return 0;
+}
+
+#define PAE_ROLE_AUTHENTICATOR 1 // =1 for authenticator,
+#define PAE_ROLE_SUPPLICANT 0 // =0 for supplicant
+
+
+/*
+ * This function sends a single 'key' to LIM at all time.
+ */
+
+static int iw_get_rts_threshold(struct net_device *dev,
+            struct iw_request_info *info,
+            union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   v_U32_t status = 0;
+
+   status = hdd_wlan_get_rts_threshold(pAdapter,wrqu);
+
+   return status;
+}
+
+static int iw_set_rts_threshold(struct net_device *dev,
+                                struct iw_request_info *info,
+                                union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+    ENTER();
+
+    if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX )
+    {
+        return -EINVAL;
+    }
+
+    if ( ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
+    {
+        return -EIO;
+    }
+
+    EXIT();
+
+    return 0;
+}
+
+static int iw_get_frag_threshold(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    v_U32_t status = 0;
+
+    status = hdd_wlan_get_frag_threshold(pAdapter,wrqu);
+
+    return status;
+}
+
+static int iw_set_frag_threshold(struct net_device *dev,
+             struct iw_request_info *info,
+                 union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+   ENTER();
+
+    if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX )
+    {
+        return -EINVAL;
+    }
+
+    if ( ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
+    {
+        return -EIO;
+    }
+
+   EXIT();
+
+   return 0;
+}
+
+static int iw_get_power_mode(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra)
+{
+   ENTER();
+   return -EOPNOTSUPP;
+}
+
+static int iw_set_power_mode(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra)
+{
+    ENTER();
+    return -EOPNOTSUPP;
+}
+
+static int iw_get_range(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+   struct iw_range *range = (struct iw_range *) extra;
+
+   v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+
+   v_U32_t num_channels = sizeof(channels);
+   v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
+   v_U32_t a_len;
+   v_U32_t b_len;
+   v_U32_t active_phy_mode = 0;
+   v_U8_t index = 0, i;
+
+   ENTER();
+
+   wrqu->data.length = sizeof(struct iw_range);
+   memset(range, 0, sizeof(struct iw_range));
+
+
+   /*Get the phy mode*/
+   if (ccmCfgGetInt(hHal,
+                  WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "active_phy_mode = %ld", active_phy_mode);
+
+      if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G)
+      {
+         /*Get the supported rates for 11G band*/
+         if (ccmCfgGetStr(hHal,
+                          WNI_CFG_SUPPORTED_RATES_11A,
+                          supp_rates, &a_len) == eHAL_STATUS_SUCCESS)
+         {
+            if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN)
+            {
+               a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
+            }
+            for (i = 0; i < a_len; i++)
+            {
+               range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000;
+            }
+            range->num_bitrates = a_len;
+         }
+         else
+         {
+            return -EIO;
+         }
+      }
+      else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B)
+      {
+         /*Get the supported rates for 11B band*/
+         if (ccmCfgGetStr(hHal,
+                          WNI_CFG_SUPPORTED_RATES_11B,
+                          supp_rates, &b_len) == eHAL_STATUS_SUCCESS)
+         {
+            if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN)
+            {
+               b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
+            }
+            for (i = 0; i < b_len; i++)
+            {
+               range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000;
+            }
+            range->num_bitrates = b_len;
+         }
+         else
+         {
+            return -EIO;
+         }
+      }
+   }
+
+   range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX;
+   range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN;
+   range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX;
+
+   range->encoding_size[0] = 5;
+   range->encoding_size[1] = 13;
+   range->num_encoding_sizes = 2;
+   range->max_encoding_tokens = MAX_WEP_KEYS;
+
+   // we support through Wireless Extensions 22
+   range->we_version_compiled = WIRELESS_EXT;
+   range->we_version_source = 22;
+
+   /*Supported Channels and Frequencies*/
+   if (ccmCfgGetStr((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, &num_channels) != eHAL_STATUS_SUCCESS)
+   {
+      return -EIO;
+   }
+   if (num_channels > IW_MAX_FREQUENCIES)
+   {
+      num_channels = IW_MAX_FREQUENCIES;
+   }
+
+   range->num_channels = num_channels;
+   range->num_frequency = num_channels;
+
+   for (index=0; index < num_channels; index++)
+   {
+      v_U32_t frq_indx = 0;
+
+      range->freq[index].i = channels[index];
+      while (frq_indx <  FREQ_CHAN_MAP_TABLE_SIZE)
+      {
+           if(channels[index] == freq_chan_map[frq_indx].chan)
+           {
+             range->freq[index].m = freq_chan_map[frq_indx].freq * 100000;
+             range->freq[index].e = 1;
+             break;
+           }
+           frq_indx++;
+      }
+   }
+
+   /* Event capability (kernel + driver) */
+   range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
+                    IW_EVENT_CAPA_MASK(SIOCGIWAP) |
+                    IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
+   range->event_capa[1] = IW_EVENT_CAPA_K_1;
+
+   /*Encryption capability*/
+   range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
+                IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
+
+   /* Txpower capability */
+   range->txpower_capa = IW_TXPOW_MWATT;
+
+   /*Scanning capability*/
+   #if WIRELESS_EXT >= 22
+   range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL;
+   #endif
+
+   EXIT();
+   return 0;
+}
+
+/* Callback function registered with PMC to know status of PMC request */
+static void iw_power_callback_fn (void *pContext, eHalStatus status)
+{
+   struct statsContext *pStatsContext;
+   hdd_adapter_t *pAdapter;
+
+   if (NULL == pContext)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+            "%s: Bad param, pContext [%p]",
+              __FUNCTION__, pContext);
+       return;
+   }
+
+  /* there is a race condition that exists between this callback function
+     and the caller since the caller could time out either before or
+     while this code is executing.  we'll assume the timeout hasn't
+     occurred, but we'll verify that right before we save our work */
+
+   pStatsContext = (struct statsContext *)pContext;
+   pAdapter = pStatsContext->pAdapter;
+
+   if ((NULL == pAdapter) || (POWER_CONTEXT_MAGIC != pStatsContext->magic))
+   {
+       /* the caller presumably timed out so there is nothing we can do */
+       hddLog(VOS_TRACE_LEVEL_WARN,
+           "%s: Invalid context, pAdapter [%p] magic [%08x]",
+           __FUNCTION__, pAdapter, pStatsContext->magic);
+
+       if (ioctl_debug)
+       {
+           pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
+             __FUNCTION__, pAdapter, pStatsContext->magic);
+       }
+       return;
+  }
+
+  /* and notify the caller */
+  complete(&pStatsContext->completion);
+}
+
+/* Callback function for tx per hit */
+void hdd_tx_per_hit_cb (void *pCallbackContext)
+{
+    hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCallbackContext;
+    unsigned char tx_fail[16];
+    union iwreq_data wrqu;
+
+    if (NULL == pAdapter)
+    {
+        hddLog(LOGE, "hdd_tx_per_hit_cb: pAdapter is NULL\n");
+        return;
+    }
+    memset(&wrqu, 0, sizeof(wrqu));
+    wrqu.data.length = strlcpy(tx_fail, "TX_FAIL", sizeof(tx_fail));
+    wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail);
+}
+
+void hdd_GetClassA_statisticsCB(void *pStats, void *pContext)
+{
+   struct statsContext *pStatsContext;
+   tCsrGlobalClassAStatsInfo *pClassAStats;
+   hdd_adapter_t *pAdapter;
+
+   if (ioctl_debug)
+   {
+      pr_info("%s: pStats [%p] pContext [%p]\n",
+              __FUNCTION__, pStats, pContext);
+   }
+
+   if ((NULL == pStats) || (NULL == pContext))
+   {
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Bad param, pStats [%p] pContext [%p]",
+              __FUNCTION__, pStats, pContext);
+      return;
+   }
+
+   /* there is a race condition that exists between this callback function
+      and the caller since the caller could time out either before or
+      while this code is executing.  we'll assume the timeout hasn't
+      occurred, but we'll verify that right before we save our work */
+
+   pClassAStats  = pStats;
+   pStatsContext = pContext;
+   pAdapter      = pStatsContext->pAdapter;
+   if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic))
+   {
+      /* the caller presumably timed out so there is nothing we can do */
+      hddLog(VOS_TRACE_LEVEL_WARN,
+             "%s: Invalid context, pAdapter [%p] magic [%08x]",
+              __FUNCTION__, pAdapter, pStatsContext->magic);
+      if (ioctl_debug)
+      {
+         pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
+                 __FUNCTION__, pAdapter, pStatsContext->magic);
+      }
+      return;
+   }
+
+   /* the race is on.  caller could have timed out immediately after
+      we verified the magic, but if so, caller will wait a short time
+      for us to copy over the stats. do so as a struct copy */
+   pAdapter->hdd_stats.ClassA_stat = *pClassAStats;
+
+   /* and notify the caller */
+   complete(&pStatsContext->completion);
+}
+
+VOS_STATUS  wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter)
+{
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   eHalStatus hstatus;
+   long lrc;
+   struct statsContext context;
+
+   if (NULL == pAdapter)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__);
+       return VOS_STATUS_E_FAULT;
+   }
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return VOS_STATUS_SUCCESS;
+   }
+
+   /* we are connected
+   prepare our callback context */
+   init_completion(&context.completion);
+   context.pAdapter = pAdapter;
+   context.magic = STATS_CONTEXT_MAGIC;
+   /* query only for Class A statistics (which include link speed) */
+   hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                  eCSR_HDD,
+                                  SME_GLOBAL_CLASSA_STATS,
+                                  hdd_GetClassA_statisticsCB,
+                                  0, // not periodic
+                                  FALSE, //non-cached results
+                                  pHddStaCtx->conn_info.staId[0],
+                                  &context);
+   if (eHAL_STATUS_SUCCESS != hstatus)
+   {
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: Unable to retrieve Class A statistics ",
+               __FUNCTION__);
+       /* we'll returned a cached value below */
+   }
+   else
+   {
+       /* request was sent -- wait for the response */
+       lrc = wait_for_completion_interruptible_timeout(&context.completion,
+                                    msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
+       /* either we have a response or we timed out
+          either way, first invalidate our magic */
+       context.magic = 0;
+       if (lrc <= 0)
+       {
+          hddLog(VOS_TRACE_LEVEL_ERROR,
+                 "%s: SME %s while retrieving Class A statistics",
+                 __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+             /* there is a race condition such that the callback
+             function could be executing at the same time we are. of
+             primary concern is if the callback function had already
+             verified the "magic" but hasn't yet set the completion
+             variable.  Since the completion variable is on our
+             stack, we'll delay just a bit to make sure the data is
+             still valid if that is the case */
+          msleep(50);
+      }
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * Support for the LINKSPEED private command
+ * Per the WiFi framework the response must be of the form
+ *         "LinkSpeed xx"
+ */
+static int iw_get_linkspeed(struct net_device *dev,
+                            struct iw_request_info *info,
+                            union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   char *pLinkSpeed = (char*)extra;
+   int len = sizeof(v_U16_t) + 1;
+   v_U16_t link_speed;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   int rc;
+
+   if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+   {
+      /* we are not connected so we don't have a classAstats */
+      link_speed = 0;
+   }
+   else
+   {
+       wlan_hdd_get_classAstats(pAdapter);
+       //The linkspeed returned by HAL is in units of 500kbps.
+       //converting it to mbps
+       link_speed = pAdapter->hdd_stats.ClassA_stat.tx_rate/2;
+   }
+
+   wrqu->data.length = len;
+   // return the linkspeed in the format required by the WiFi Framework
+   rc = snprintf(pLinkSpeed, len, "%u", link_speed);
+   if ((rc < 0) || (rc >= len))
+   {
+       // encoding or length error?
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+                "%s: Unable to encode link speed, got [%s]",
+                __FUNCTION__,pLinkSpeed);
+       return -EIO;
+   }
+
+  /* a value is being successfully returned */
+   return 0;
+}
+
+
+/*
+ * Support for the RSSI & RSSI-APPROX private commands
+ * Per the WiFi framework the response must be of the form
+ *         "<ssid> rssi <xx>"
+ * unless we are not associated, in which case the response is
+ *         "OK"
+ */
+static int iw_get_rssi(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   char *cmd = (char*)wrqu->data.pointer;
+   int len = wrqu->data.length;
+   v_S7_t s7Rssi = 0;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length;
+   VOS_STATUS vosStatus;
+   int rc;
+
+   if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
+       (0 == ssidlen) || (ssidlen >= len))
+   {
+      /* we are not connected or our SSID is too long
+         so we cannot report an rssi */
+      rc = snprintf(cmd, len, "OK");
+   }
+   else
+   {
+      /* we are connected with a valid SSID
+         so we can write the SSID into the return buffer
+         (note that it is not NUL-terminated) */
+      memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen );
+
+      vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi);
+
+      if (VOS_STATUS_SUCCESS == vosStatus)
+      {
+          /* append the rssi to the ssid in the format required by
+             the WiFI Framework */
+          rc = snprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi);
+      }
+      else
+      {
+          rc = -1;
+      }
+   }
+
+   /* verify that we wrote a valid response */
+   if ((rc < 0) || (rc >= len))
+   {
+      // encoding or length error?
+      hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Unable to encode RSSI, got [%s]",
+             __FUNCTION__, cmd);
+      return -EIO;
+   }
+
+   /* a value is being successfully returned */
+   return 0;
+}
+
+/*
+ * Support for SoftAP channel range private command
+ */
+static int iw_softap_set_channel_range( struct net_device *dev,
+                                        int startChannel,
+                                        int endChannel,
+                                        int band)
+{
+    eHalStatus status;
+    int ret = 0;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+
+    status = WLANSAP_SetChannelRange(hHal, startChannel, endChannel, band);
+    if (VOS_STATUS_SUCCESS != status)
+    {
+        ret = -EINVAL;
+    }
+    return ret;
+}
+
+VOS_STATUS  wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode)
+{
+   struct statsContext context;
+   eHalStatus status;
+   hdd_context_t *pHddCtx;
+
+   if (NULL == pAdapter)
+   {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "Adapter NULL");
+       return VOS_STATUS_E_FAULT;
+   }
+
+   hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode);
+   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   init_completion(&context.completion);
+
+   context.pAdapter = pAdapter;
+   context.magic = POWER_CONTEXT_MAGIC;
+
+   if (DRIVER_POWER_MODE_ACTIVE == mode)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering "
+               "Full Power", __func__);
+       status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                       iw_power_callback_fn, &context,
+                       eSME_FULL_PWR_NEEDED_BY_HDD);
+       // Enter Full power command received from GUI this means we are disconnected
+       // Set PMC remainInPowerActiveTillDHCP flag to disable auto BMPS entry by PMC
+       sme_SetDHCPTillPowerActiveFlag(pHddCtx->hHal, TRUE);
+       if (eHAL_STATUS_PMC_PENDING == status)
+       {
+           int lrc = wait_for_completion_interruptible_timeout(
+                   &context.completion,
+                   msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
+           context.magic = 0;
+           if (lrc <= 0)
+           {
+               hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting fullpower ",
+                  __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+               /* there is a race condition such that the callback
+                  function could be executing at the same time we are. of
+                  primary concern is if the callback function had already
+                  verified the "magic" but hasn't yet set the completion
+                  variable. Since the completion variable is on our
+                  stack, we'll delay just a bit to make sure the data is
+                  still valid if that is the case */
+               msleep(50);
+               /* we'll now returned a cached value below */
+           }
+       }
+   }
+   else if (DRIVER_POWER_MODE_AUTO == mode)
+   {
+       if (pHddCtx->cfg_ini->fIsBmpsEnabled)
+       {
+           hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ",
+                  __func__);
+           // Enter BMPS command received from GUI this means DHCP is completed
+           // Clear PMC remainInPowerActiveTillDHCP flag to enable auto BMPS entry
+           sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                    FALSE);
+           status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                           iw_power_callback_fn, &context);
+           if (eHAL_STATUS_PMC_PENDING == status)
+           {
+               int lrc = wait_for_completion_interruptible_timeout(
+                           &context.completion,
+                           msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
+               context.magic = 0;
+               if (lrc <= 0)
+               {
+                   hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting BMPS ",
+                      __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
+                   /* there is a race condition such that the callback
+                      function could be executing at the same time we are. of
+                      primary concern is if the callback function had already
+                      verified the "magic" but hasn't yet set the completion
+                      variable. Since the completion variable is on our
+                      stack, we'll delay just a bit to make sure the data is
+                      still valid if that is the case */
+                   msleep(50);
+                   /* we'll now returned a cached value below */
+               }
+           }
+       }
+       else
+       {
+           hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "BMPS is not "
+                   "enabled in the cfg");
+       }
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx,
+                                       hdd_adapter_t *pAdapter)
+{
+   VOS_STATUS vos_Status;
+
+   if ((NULL == pAdapter) || (NULL == pHddCtx))
+   {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid pointer");
+       return VOS_STATUS_E_FAULT;
+   }
+
+   /**Exit from Deep sleep or standby if we get the driver
+   START cmd from android GUI
+    */
+   if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit "
+              "from Stand by",__func__);
+       vos_Status = hdd_exit_standby(pHddCtx);
+   }
+   else if (eHDD_SUSPEND_DEEP_SLEEP == pHddCtx->hdd_ps_state)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit "
+              "from deep sleep",__func__);
+       vos_Status = hdd_exit_deep_sleep(pHddCtx, pAdapter);
+   }
+   else
+   {
+       hddLog(VOS_TRACE_LEVEL_WARN, "%s: Not in standby or deep sleep. "
+               "Ignore start cmd %d", __func__, pHddCtx->hdd_ps_state);
+       vos_Status = VOS_STATUS_SUCCESS;
+   }
+
+   return vos_Status;
+}
+
+VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx)
+{
+   VOS_STATUS vos_Status = VOS_STATUS_E_FAILURE;
+
+   if (NULL == pHddCtx)
+   {
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "HDD context NULL");
+        return VOS_STATUS_E_FAULT;
+   }
+
+   if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop)
+   {
+      //Execute standby procedure.
+      //Executing standby procedure will cause the STA to
+      //disassociate first and then the chip will be put into standby.
+      hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering Stand by mode");
+      vos_Status  = hdd_enter_standby(pHddCtx);
+   }
+   else if (WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP ==
+            pHddCtx->cfg_ini->nEnableDriverStop)
+   {
+       //Execute deep sleep procedure
+       hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering "
+               "deep sleep mode\n");
+       //Deep sleep not supported
+       vos_Status  = hdd_enter_standby(pHddCtx);
+   }
+   else
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO_LOW, "%s: Driver stop is not enabled %d",
+           __func__, pHddCtx->cfg_ini->nEnableDriverStop);
+       vos_Status = VOS_STATUS_SUCCESS;
+   }
+
+   return vos_Status;
+}
+
+static int iw_set_priv(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    char *cmd = (char*)wrqu->data.pointer;
+    int cmd_len = wrqu->data.length;
+    int ret = 0;
+    int status = 0;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+    ENTER();
+
+    if (ioctl_debug)
+    {
+       pr_info("%s: req [%s] len [%d]\n", __FUNCTION__, cmd, cmd_len);
+    }
+
+    hddLog(VOS_TRACE_LEVEL_INFO_MED, "***Received %s cmd from Wi-Fi GUI***", cmd);
+
+    if (pHddCtx->isLogpInProgress) {
+       if (ioctl_debug)
+       {
+          pr_info("%s: RESTART in progress\n", __FUNCTION__);
+       }
+
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                 "%s:LOGP in Progress. Ignore!!!",__func__);
+       return status;
+    }
+
+    if(strncmp(cmd, "CSCAN",5) == 0 )
+    {
+       status = iw_set_cscan(dev, info, wrqu, extra);
+    }
+    else if( strcasecmp(cmd, "start") == 0 ) {
+
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command\n");
+        /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/
+        status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter);
+
+        if(status == VOS_STATUS_SUCCESS)
+        {
+            union iwreq_data wrqu;
+            char buf[10];
+
+            memset(&wrqu, 0, sizeof(wrqu));
+            wrqu.data.length = strlcpy(buf, "START", sizeof(buf));
+            wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
+        }
+        else
+        {
+            hddLog(VOS_TRACE_LEVEL_FATAL, "%s: START CMD Status %d", __func__, status);
+        }
+        goto done;
+    }
+    else if( strcasecmp(cmd, "stop") == 0 )
+    {
+        union iwreq_data wrqu;
+        char buf[10];
+
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command\n");
+
+        wlan_hdd_enter_lowpower(pHddCtx);
+        memset(&wrqu, 0, sizeof(wrqu));
+        wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf));
+        wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
+        status = VOS_STATUS_SUCCESS;
+        goto done;
+    }
+    else if (strcasecmp(cmd, "macaddr") == 0)
+    {
+        ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR,
+                       MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes));
+    }
+    else if (strcasecmp(cmd, "scan-active") == 0)
+    {
+        pAdapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
+        ret = snprintf(cmd, cmd_len, "OK");
+    }
+    else if (strcasecmp(cmd, "scan-passive") == 0)
+    {
+        pAdapter->scan_info.scan_mode = eSIR_PASSIVE_SCAN;
+        ret = snprintf(cmd, cmd_len, "OK");
+    }
+    else if( strcasecmp(cmd, "scan-mode") == 0 )
+    {
+        ret = snprintf(cmd, cmd_len, "ScanMode = %u", pAdapter->scan_info.scan_mode);
+    }
+    else if( strcasecmp(cmd, "linkspeed") == 0 )
+    {
+        status = iw_get_linkspeed(dev, info, wrqu, extra);
+    }
+    else if( strncasecmp(cmd, "COUNTRY", 7) == 0 ) {
+        char *country_code;
+
+        country_code =  cmd + 8;
+
+        status = (int)sme_ChangeCountryCode(pHddCtx->hHal,
+                                            NULL,
+                                            country_code,
+                                            pAdapter,
+                                            pHddCtx->pvosContext);
+        if( 0 != status )
+        {
+             VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                        "%s: SME Change Country code fail \n",__func__);
+             return VOS_STATUS_E_FAILURE;
+        }
+    }
+    else if( strncasecmp(cmd, "rssi", 4) == 0 )
+    {
+        status = iw_get_rssi(dev, info, wrqu, extra);
+    }
+    else if( strncasecmp(cmd, "powermode", 9) == 0 ) {
+        int mode;
+        char *ptr = (char*)(cmd + 9);
+
+        sscanf(ptr,"%d",&mode);
+        wlan_hdd_enter_bmps(pAdapter, mode);
+        /*TODO:Set the power mode*/
+    }
+    else if (strncasecmp(cmd, "getpower", 8) == 0 ) {
+        v_U32_t pmc_state;
+        v_U16_t value;
+
+        pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter));
+        if(pmc_state == BMPS) {
+           value = DRIVER_POWER_MODE_AUTO;
+        }
+        else {
+           value = DRIVER_POWER_MODE_ACTIVE;
+        }
+        ret = snprintf(cmd, cmd_len, "powermode = %u", value);
+    }
+    else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) {
+        hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode\n");
+        /*TODO: set the btcoexmode*/
+    }
+    else if( strcasecmp(cmd, "btcoexstat") == 0 ) {
+
+        hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status\n");
+        /*TODO: Return the btcoex status*/
+    }
+    else if( strcasecmp(cmd, "rxfilter-start") == 0 ) {
+
+        hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command\n");
+
+        /*TODO: Enable Rx data Filter*/
+    }
+    else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) {
+
+        hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command\n");
+
+        /*TODO: Disable Rx data Filter*/
+    }
+    else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) {
+
+        hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command\n");
+        /*TODO: rxfilter-statistics*/
+    }
+    else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) {
+
+        hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add\n");
+        /*TODO: rxfilter-add*/
+    }
+    else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) {
+
+        hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove\n");
+        /*TODO: rxfilter-remove*/
+    }
+#ifdef FEATURE_WLAN_SCAN_PNO
+    else if( strncasecmp(cmd, "pno",3) == 0 ) {
+
+        hddLog( VOS_TRACE_LEVEL_INFO, "pno\n");
+        status = iw_set_pno(dev, info, wrqu, extra, 3);
+        return status;
+    }
+    else if( strncasecmp(cmd, "rssifilter",10) == 0 ) {
+
+        hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter\n");
+        status = iw_set_rssi_filter(dev, info, wrqu, extra, 10);
+        return status;
+    }
+#endif /*FEATURE_WLAN_SCAN_PNO*/
+    else if( strncasecmp(cmd, "powerparams",11) == 0 ) {
+      hddLog( VOS_TRACE_LEVEL_INFO, "powerparams\n");
+      status = iw_set_power_params(dev, info, wrqu, extra, 11);
+      return status;
+    }
+    else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) {
+        tSirTxPerTrackingParam tTxPerTrackingParam;
+        char *ptr = (char*)(cmd + 18);
+        sscanf(ptr,"%hhu %hhu %hhu %lu",&(tTxPerTrackingParam.ucTxPerTrackingEnable), &(tTxPerTrackingParam.ucTxPerTrackingPeriod),
+               &(tTxPerTrackingParam.ucTxPerTrackingRatio), &(tTxPerTrackingParam.uTxPerTrackingWatermark));
+
+        // parameters checking
+        // period has to be larger than 0
+        if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct");
+            return VOS_STATUS_E_FAILURE;
+        }
+
+        // use default value 5 is the input is not reasonable. in unit of 10%
+        if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio))
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5");
+            tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO;
+        }
+
+        // default is 5
+        if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5");
+            tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK;
+        }
+
+        status = sme_SetTxPerTracking(pHddCtx->hHal, hdd_tx_per_hit_cb, (void*)pAdapter, &tTxPerTrackingParam);
+        if(status != eHAL_STATUS_SUCCESS){
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!");
+        }
+    }
+    else {
+        hddLog( VOS_TRACE_LEVEL_WARN, "Unsupported GUI command %s", cmd);
+    }
+done:
+    /* many of the commands write information back into the command
+       string using snprintf().  check the return value here in one
+       place */
+    if ((ret < 0) || (ret >= cmd_len))
+    {
+       /* there was an encoding error or overflow */
+       status = -EIO;
+    }
+
+    if (ioctl_debug)
+    {
+       pr_info("%s: rsp [%s] len [%d] status %d\n",
+               __FUNCTION__, cmd, wrqu->data.length, status);
+    }
+    return status;
+
+}
+
+static int iw_set_nick(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+   ENTER();
+   return 0;
+}
+
+static int iw_get_nick(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+   ENTER();
+   return 0;
+}
+
+static struct iw_statistics *get_wireless_stats(struct net_device *dev)
+{
+   ENTER();
+   return NULL;
+}
+
+static int iw_set_encode(struct net_device *dev,struct iw_request_info *info,
+                        union iwreq_data *wrqu,char *extra)
+
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   struct iw_point *encoderq = &(wrqu->encoding);
+   v_U32_t keyId;
+   v_U8_t key_length;
+   eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+   v_BOOL_t fKeyPresent = 0;
+   int i;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+
+   ENTER();
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
+   }
+
+
+   keyId = encoderq->flags & IW_ENCODE_INDEX;
+
+   if(keyId)
+   {
+       if(keyId > MAX_WEP_KEYS)
+       {
+           return -EINVAL;
+       }
+
+       fKeyPresent = 1;
+       keyId--;
+   }
+   else
+   {
+       fKeyPresent = 0;
+   }
+
+
+   if(wrqu->data.flags & IW_ENCODE_DISABLED)
+   {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****iwconfig wlan0 key off*****\n");
+       if(!fKeyPresent) {
+
+          for(i=0;i < CSR_MAX_NUM_KEY; i++) {
+
+             if(pWextState->roamProfile.Keys.KeyMaterial[i])
+                pWextState->roamProfile.Keys.KeyLength[i] = 0;
+          }
+       }
+       pHddStaCtx->conn_info.authType =  eCSR_AUTH_TYPE_OPEN_SYSTEM;
+       pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
+       pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+       pWextState->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+
+       pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+       pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
+
+       if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)
+       {
+           INIT_COMPLETION(pAdapter->disconnect_comp_var);
+           status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED );
+           if(VOS_STATUS_SUCCESS == status)
+                 wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+                     msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+       }
+
+       return status;
+
+   }
+
+   if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED))
+   {
+      hddLog(VOS_TRACE_LEVEL_INFO, "iwconfig wlan0 key on");
+
+      pHddStaCtx->conn_info.authType = (encoderq->flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+   }
+
+
+   if(wrqu->data.length > 0)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO, "%s : wrqu->data.length : %d",__FUNCTION__,wrqu->data.length);
+
+       key_length = wrqu->data.length;
+
+       /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued.*/
+
+       if(5 == key_length)
+       {
+           hddLog(VOS_TRACE_LEVEL_INFO, "%s: Call with WEP40,key_len=%d",__FUNCTION__,key_length);
+
+           if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+           {
+               encryptionType = eCSR_ENCRYPT_TYPE_WEP40;
+           }
+           else
+           {
+               encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+           }
+       }
+       else if(13 == key_length)
+       {
+           hddLog(VOS_TRACE_LEVEL_INFO, "%s:Call with WEP104,key_len:%d",__FUNCTION__,key_length);
+
+           if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
+           {
+               encryptionType = eCSR_ENCRYPT_TYPE_WEP104;
+           }
+           else
+           {
+               encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+           }
+       }
+       else
+       {
+           hddLog(VOS_TRACE_LEVEL_WARN, "%s: Invalid WEP key length :%d",
+                  __FUNCTION__, key_length);
+           return -EINVAL;
+       }
+
+       pHddStaCtx->conn_info.ucEncryptionType = encryptionType;
+       pHddStaCtx->conn_info.mcEncryptionType = encryptionType;
+       pWextState->roamProfile.EncryptionType.numEntries = 1;
+       pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType;
+       pWextState->roamProfile.mcEncryptionType.numEntries = 1;
+       pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType;
+
+       if((eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) &&
+            ((eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ||
+              (eCSR_AUTH_TYPE_SHARED_KEY == pHddStaCtx->conn_info.authType)))
+       {
+
+          vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[keyId][0],extra,key_length);
+
+          pWextState->roamProfile.Keys.KeyLength[keyId] = (v_U8_t)key_length;
+          pWextState->roamProfile.Keys.defaultIndex = (v_U8_t)keyId;
+
+          return status;
+       }
+   }
+
+   return 0;
+}
+
+static int iw_get_encodeext(struct net_device *dev,
+               struct iw_request_info *info,
+               struct iw_point *dwrq,
+               char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
+    int keyId;
+    eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
+    eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
+    int i;
+
+    ENTER();
+
+    keyId = pRoamProfile->Keys.defaultIndex;
+
+    if(keyId < 0 || keyId >= MAX_WEP_KEYS)
+    {
+        hddLog(LOG1,"%s: Invalid keyId : %d\n",__FUNCTION__,keyId);
+        return -EINVAL;
+    }
+
+    if(pRoamProfile->Keys.KeyLength[keyId] > 0)
+    {
+        dwrq->flags |= IW_ENCODE_ENABLED;
+        dwrq->length = pRoamProfile->Keys.KeyLength[keyId];
+        palCopyMemory(dev,extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]);
+    }
+    else
+    {
+        dwrq->flags |= IW_ENCODE_DISABLED;
+    }
+
+    for(i=0; i < MAX_WEP_KEYS; i++)
+    {
+        if(pRoamProfile->Keys.KeyMaterial[i] == NULL)
+        {
+            continue;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    if(MAX_WEP_KEYS == i)
+    {
+        dwrq->flags |= IW_ENCODE_NOKEY;
+    }
+    else
+    {
+        dwrq->flags |= IW_ENCODE_ENABLED;
+    }
+
+    encryptionType = pRoamProfile->EncryptionType.encryptionType[0];
+
+    if(eCSR_ENCRYPT_TYPE_NONE == encryptionType)
+    {
+        dwrq->flags |= IW_ENCODE_DISABLED;
+    }
+
+    authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
+
+    if(IW_AUTH_ALG_OPEN_SYSTEM == authType)
+    {
+        dwrq->flags |= IW_ENCODE_OPEN;
+    }
+    else
+    {
+        dwrq->flags |= IW_ENCODE_RESTRICTED;
+    }
+    EXIT();
+    return 0;
+
+}
+
+static int iw_set_encodeext(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    eHalStatus halStatus= eHAL_STATUS_SUCCESS;
+
+    tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
+    v_U32_t status = 0;
+
+    struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
+
+    v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+
+    int key_index;
+    struct iw_point *encoding = &wrqu->encoding;
+    tCsrRoamSetKey  setKey;
+    v_U32_t  roamId= 0xFF;
+    VOS_STATUS vos_status;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
+    }
+
+    key_index = encoding->flags & IW_ENCODE_INDEX;
+
+    if(key_index > 0) {
+
+         /*Convert from 1-based to 0-based keying*/
+        key_index--;
+    }
+    if(!ext->key_len) {
+
+      /*Set the encrytion type to NONE*/
+       pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+       return status;
+    }
+
+    if(eConnectionState_NotConnected == pHddStaCtx->conn_info.connState &&
+                                                  (IW_ENCODE_ALG_WEP == ext->alg))
+    {
+       if(IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) {
+
+          VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,("Invalid Configuration:%s \n"),__FUNCTION__);
+          return -EINVAL;
+       }
+       else {
+         /*Static wep, update the roam profile with the keys */
+          if(ext->key && (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) &&
+                                                               key_index < CSR_MAX_NUM_KEY) {
+             vos_mem_copy(&pRoamProfile->Keys.KeyMaterial[key_index][0],ext->key,ext->key_len);
+             pRoamProfile->Keys.KeyLength[key_index] = (v_U8_t)ext->key_len;
+
+             if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
+                pRoamProfile->Keys.defaultIndex = (v_U8_t)key_index;
+
+          }
+       }
+       return status;
+    }
+
+    vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+
+    setKey.keyId = key_index;
+    setKey.keyLength = ext->key_len;
+
+    if(ext->key_len <= CSR_MAX_KEY_LEN) {
+       vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len);
+    }
+
+    if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
+      /*Key direction for group is RX only*/
+       setKey.keyDirection = eSIR_RX_ONLY;
+       vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
+    }
+    else {
+
+       setKey.keyDirection =  eSIR_TX_RX;
+       vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN);
+    }
+
+    /*For supplicant pae role is zero*/
+    setKey.paeRole = 0;
+
+    switch(ext->alg)
+    {
+       case IW_ENCODE_ALG_NONE:
+         setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+         break;
+
+       case IW_ENCODE_ALG_WEP:
+         setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104;
+         break;
+
+       case IW_ENCODE_ALG_TKIP:
+       {
+          v_U8_t *pKey = &setKey.Key[0];
+
+          setKey.encType = eCSR_ENCRYPT_TYPE_TKIP;
+
+          vos_mem_zero(pKey, CSR_MAX_KEY_LEN);
+
+          /*Supplicant sends the 32bytes key in this order
+
+                |--------------|----------|----------|
+                |   Tk1        |TX-MIC    |  RX Mic  |
+                |--------------|----------|----------|
+                <---16bytes---><--8bytes--><--8bytes-->
+
+                */
+          /*Sme expects the 32 bytes key to be in the below order
+
+                |--------------|----------|----------|
+                |   Tk1        |RX-MIC    |  TX Mic  |
+                |--------------|----------|----------|
+                <---16bytes---><--8bytes--><--8bytes-->
+               */
+          /* Copy the Temporal Key 1 (TK1) */
+          vos_mem_copy(pKey,ext->key,16);
+
+         /*Copy the rx mic first*/
+          vos_mem_copy(&pKey[16],&ext->key[24],8);
+
+         /*Copy the tx mic */
+          vos_mem_copy(&pKey[24],&ext->key[16],8);
+
+       }
+       break;
+
+       case IW_ENCODE_ALG_CCMP:
+          setKey.encType = eCSR_ENCRYPT_TYPE_AES;
+          break;
+
+#ifdef FEATURE_WLAN_CCX
+#define IW_ENCODE_ALG_KRK 6
+       case IW_ENCODE_ALG_KRK:
+          setKey.encType = eCSR_ENCRYPT_TYPE_KRK;
+          break;
+#endif  /* FEATURE_WLAN_CCX */
+
+       default:
+          setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
+          break;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+          ("%s:cipher_alg:%d key_len[%d] *pEncryptionType :%d \n"),__FUNCTION__,(int)ext->alg,(int)ext->key_len,setKey.encType);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* The supplicant may attempt to set the PTK once pre-authentication is done.
+   Save the key in the UMAC and include it in the ADD BSS request */
+    halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey);
+    if( halStatus == eHAL_STATUS_SUCCESS )
+    {
+       return halStatus;
+    }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+    pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;
+
+    vos_status = wlan_hdd_check_ula_done(pAdapter);
+    if ( vos_status != VOS_STATUS_SUCCESS )
+    {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d",
+                   __LINE__, vos_status );
+
+       pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+    }
+
+    halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),pAdapter->sessionId, &setKey, &roamId );
+
+    if ( halStatus != eHAL_STATUS_SUCCESS )
+    {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "[%4d] sme_RoamSetKey returned ERROR status= %d",
+                   __LINE__, halStatus );
+
+       pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+    }
+
+   return halStatus;
+}
+
+static int iw_set_retry(struct net_device *dev, struct iw_request_info *info,
+           union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+   ENTER();
+
+   if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN ||
+       wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) {
+
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Invalid Retry-Limit=%ld!!\n"),wrqu->retry.value);
+
+      return -EINVAL;
+   }
+
+   if(wrqu->retry.flags & IW_RETRY_LIMIT) {
+
+       if((wrqu->retry.flags & IW_RETRY_LONG))
+       {
+          if ( ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
+          {
+             return -EIO;
+          }
+       }
+       else if((wrqu->retry.flags & IW_RETRY_SHORT))
+       {
+          if ( ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
+          {
+             return -EIO;
+          }
+       }
+   }
+   else
+   {
+       return -EOPNOTSUPP;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Set Retry-Limit=%ld!!\n"),wrqu->retry.value);
+
+   EXIT();
+
+   return 0;
+
+}
+
+static int iw_get_retry(struct net_device *dev, struct iw_request_info *info,
+           union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+   v_U32_t retry = 0;
+
+   ENTER();
+
+   if((wrqu->retry.flags & IW_RETRY_LONG))
+   {
+      wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
+
+      if ( ccmCfgGetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS )
+      {
+         return -EIO;
+      }
+
+      wrqu->retry.value = retry;
+   }
+   else if ((wrqu->retry.flags & IW_RETRY_SHORT))
+   {
+      wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
+
+      if ( ccmCfgGetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS )
+      {
+         return -EIO;
+      }
+
+      wrqu->retry.value = retry;
+   }
+   else {
+      return -EOPNOTSUPP;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Retry-Limit=%ld!!\n"),retry);
+
+   EXIT();
+
+   return 0;
+}
+
+static int iw_set_mlme(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu,
+                       char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    struct iw_mlme *mlme = (struct iw_mlme *)extra;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    ENTER();
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
+    }
+
+    //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED
+    switch (mlme->cmd) {
+        case IW_MLME_DISASSOC:
+        case IW_MLME_DEAUTH:
+
+            if( pHddStaCtx->conn_info.connState == eConnectionState_Associated )
+            {
+                eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED;
+
+                if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE )
+                    reason = eCSR_DISCONNECT_REASON_MIC_ERROR;
+
+                INIT_COMPLETION(pAdapter->disconnect_comp_var);
+                status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,reason);
+
+                if(VOS_STATUS_SUCCESS == status)
+                    wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                else
+                    hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d \n",
+                       __FUNCTION__, (int)mlme->cmd, (int)status );
+
+                /* Resetting authKeyMgmt */
+                (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0;
+
+                netif_tx_disable(dev);
+                netif_carrier_off(dev);
+
+            }
+            else
+            {
+                hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state \n", __FUNCTION__, (int)mlme->cmd );
+            }
+            break;
+        default:
+            hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate \n", __FUNCTION__, (int)mlme->cmd );
+            return -EINVAL;
+    }//end of switch
+
+    EXIT();
+
+    return status;
+
+}
+
+/* set param sub-ioctls */
+static int iw_setint_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    int *value = (int *)extra;
+    int sub_cmd = value[0];
+    int set_value = value[1];
+    int ret = 0; /* success */
+    int enable_pbm, enable_mp;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    v_U8_t nEnableSuspendOld;
+#endif
+    INIT_COMPLETION(pWextState->completion_var);
+
+    switch(sub_cmd)
+    {
+        case WE_SET_11D_STATE:
+        {
+            tSmeConfigParams smeConfig;;
+            if((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) {
+
+                sme_GetConfigParam(hHal,&smeConfig);
+                smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value;
+
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%ld!!\n"),smeConfig.csrConfig.Is11dSupportEnabled);
+
+                sme_UpdateConfig(hHal,&smeConfig);
+            }
+            else {
+               return -EINVAL;
+            }
+            break;
+        }
+
+        case WE_WOWL:
+        {
+           switch (set_value)
+           {
+              case 0x00:
+                 hdd_exit_wowl();
+                 break;
+              case 0x01:
+              case 0x02:
+              case 0x03:
+                 enable_mp =  (set_value & 0x01) ? 1 : 0;
+                 enable_pbm = (set_value & 0x02) ? 1 : 0;
+                 hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s\n",
+                     (enable_mp ? "YES":"NO"), (enable_pbm ? "YES":"NO"));
+                 hdd_enter_wowl(pAdapter, enable_mp, enable_pbm);
+                 break;
+              default:
+                 hddLog(LOGE, "Invalid arg  %d in WE_WOWL IOCTL\n", set_value);
+                 ret = -EINVAL;
+                 break;
+           }
+
+           break;
+        }
+        case WE_SET_POWER:
+        {
+           switch (set_value)
+           {
+              case  0: //Full Power
+              {
+                 struct statsContext context;
+                 eHalStatus status;
+
+                 init_completion(&context.completion);
+
+                 context.pAdapter = pAdapter;
+                 context.magic = POWER_CONTEXT_MAGIC;
+
+                 status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                              iw_power_callback_fn, &context,
+                              eSME_FULL_PWR_NEEDED_BY_HDD);
+                 if(eHAL_STATUS_PMC_PENDING == status)
+                 {
+                    int lrc = wait_for_completion_interruptible_timeout(
+                                  &context.completion,
+                                  msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
+                    context.magic = 0;
+                    if (lrc <= 0)
+                    {
+                       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while "
+                                 "requesting fullpower ",
+                                 __FUNCTION__, (0 == lrc) ?
+                                 "timeout" : "interrupt");
+                       /* there is a race condition such that the callback
+                          function could be executing at the same time we are. of
+                          primary concern is if the callback function had already
+                          verified the "magic" but hasn't yet set the completion
+                          variable. Since the completion variable is on our
+                          stack, we'll delay just a bit to make sure the data is
+                          still valid if that is the case */
+                       msleep(50);
+                       /* we'll now returned a cached value below */
+                    }
+                 }
+                 hddLog(LOGE, "iwpriv Full Power completed\n");
+                 break;
+              }
+              case  1: //Enable BMPS
+                 sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
+                 break;
+              case  2: //Disable BMPS
+                 sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
+                 break;
+              case  3: //Request Bmps
+              {
+                 struct statsContext context;
+                 eHalStatus status;
+
+                 init_completion(&context.completion);
+
+                 context.pAdapter = pAdapter;
+                 context.magic = POWER_CONTEXT_MAGIC;
+
+                 status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                           iw_power_callback_fn, &context);
+                 if(eHAL_STATUS_PMC_PENDING == status)
+                 {
+                    int lrc = wait_for_completion_interruptible_timeout(
+                                  &context.completion,
+                                  msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
+                    context.magic = 0;
+                    if (lrc <= 0)
+                    {
+                       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while "
+                                "requesting BMPS",
+                                 __FUNCTION__, (0 == lrc) ? "timeout" :
+                                 "interrupt");
+                       /* there is a race condition such that the callback
+                          function could be executing at the same time we are. of
+                          primary concern is if the callback function had already
+                          verified the "magic" but hasn't yet set the completion
+                          variable. Since the completion variable is on our
+                          stack, we'll delay just a bit to make sure the data is
+                          still valid if that is the case */
+                       msleep(50);
+                       /* we'll now returned a cached value below */
+                    }
+                 }
+                 hddLog(LOGE, "iwpriv Request BMPS completed\n");
+                 break;
+              }
+              case  4: //Enable IMPS
+                 sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
+                 break;
+              case  5: //Disable IMPS
+                 sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
+                 break;
+              case  6: //Enable Standby
+                 sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
+                 break;
+              case  7: //Disable Standby
+                 sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
+                 break;
+              case  8: //Request Standby
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+                 (void)hdd_enter_standby(pAdapter->pHddCtx);
+#endif
+#endif
+                 break;
+              case  9: //Start Auto Bmps Timer
+                 sme_StartAutoBmpsTimer(hHal);
+                 break;
+              case  10://Stop Auto BMPS Timer
+                 sme_StopAutoBmpsTimer(hHal);
+                 break;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+              case  11://suspend to standby
+#ifdef CONFIG_HAS_EARLYSUSPEND
+                 nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend;
+                 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 1;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+                 hdd_suspend_wlan(NULL);
+#endif
+                 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld;
+#endif
+                 break;
+              case  12://suspend to deep sleep
+#ifdef CONFIG_HAS_EARLYSUSPEND
+                 nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend;
+                 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 2;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+                 hdd_suspend_wlan(NULL);
+#endif
+                 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld;
+#endif
+                 break;
+              case  13://resume from suspend
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+                 hdd_resume_wlan(NULL);
+#endif
+#endif
+                 break;
+#endif
+              case  14://reset wlan (power down/power up)
+                 vos_chipReset(NULL, VOS_FALSE, NULL, NULL, VOS_CHIP_RESET_UNKNOWN_EXCEPTION);
+                 break;
+              default:
+                 hddLog(LOGE, "Invalid arg  %d in WE_SET_POWER IOCTL\n", set_value);
+                 ret = -EINVAL;
+                 break;
+           }
+           break;
+        }
+
+        case WE_SET_MAX_ASSOC:
+        {
+            if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
+                (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value))
+            {
+                ret = -EINVAL;
+            }
+            else if ( ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT,
+                                   set_value, NULL, eANI_BOOLEAN_FALSE)
+                      != eHAL_STATUS_SUCCESS )
+            {
+                ret = -EIO;
+            }
+            break;
+        }
+
+        case WE_SET_SAP_AUTO_CHANNEL_SELECTION:
+        {
+            if( 0 == set_value )
+            {
+                (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 0;
+            }
+            else if ( 1 == set_value )
+            {
+                (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 1;
+            }
+            else
+            {
+                 hddLog(LOGE, "Invalid arg  %d in WE_SET_SAP_AUTO_CHANNEL_SELECTION IOCTL\n", set_value);
+                 ret = -EINVAL;
+            }
+            break;
+         }
+
+        case  WE_SET_DATA_INACTIVITY_TO:
+        {
+           if  ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
+                (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
+                (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
+                    WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
+                    set_value,
+                    NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE))
+           {
+               hddLog(LOGE,"Failure: Could not pass on "
+                "WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info "
+                "to CCM\n");
+               ret = -EINVAL;
+           }
+           break;
+        }
+        case WE_SET_MAX_TX_POWER:
+        {
+           tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+           tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+
+           hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm",
+                  __func__, set_value);
+           if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) !=
+               eHAL_STATUS_SUCCESS )
+           {
+              hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed",
+              __func__);
+              return -EIO;
+           }
+
+           break;
+        }
+        case WE_SET_HIGHER_DTIM_TRANSITION:
+        {
+            if(!((set_value == eANI_BOOLEAN_FALSE) ||
+                          (set_value == eANI_BOOLEAN_TRUE)))
+            {
+                hddLog(LOGE, "Dynamic DTIM Incorrect data:%d", set_value);
+                ret = -EINVAL;
+            }
+            else
+            {
+                if(pAdapter->higherDtimTransition != set_value)
+                {
+                    pAdapter->higherDtimTransition = set_value;
+                    hddLog(LOG1, "%s: higherDtimTransition set to :%d", __FUNCTION__, pAdapter->higherDtimTransition);
+                }
+            }
+
+           break;
+        }
+
+        case WE_SET_TM_LEVEL:
+        {
+           hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter);
+           hddLog(VOS_TRACE_LEVEL_INFO, "Set Thermal Mitigation Level %d", (int)set_value); 
+           hddDevTmLevelChangedHandler(hddCtxt->parent_dev, set_value);
+
+           break;
+        }
+
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d \n",
+                sub_cmd, set_value);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+/* set param sub-ioctls */
+static int iw_setchar_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    VOS_STATUS vstatus;
+    int sub_cmd = wrqu->data.flags;
+    int ret = 0; /* success */
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+#ifdef WLAN_FEATURE_VOWIFI
+    hdd_config_t  *pConfig = pHddCtx->cfg_ini;
+#endif /* WLAN_FEATURE_VOWIFI */
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+
+    switch(sub_cmd)
+    {
+       case WE_WOWL_ADD_PTRN:
+          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN\n");
+          hdd_add_wowl_ptrn((char*)wrqu->data.pointer);
+          break;
+       case WE_WOWL_DEL_PTRN:
+          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN\n");
+          hdd_del_wowl_ptrn((char*)wrqu->data.pointer);
+          break;
+#if defined WLAN_FEATURE_VOWIFI
+       case WE_NEIGHBOR_REPORT_REQUEST:
+          {
+             tRrmNeighborReq neighborReq;
+             tRrmNeighborRspCallbackInfo callbackInfo;
+
+             if (pConfig->fRrmEnable)
+             {
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Neighbor Request\n");
+                neighborReq.no_ssid = (wrqu->data.length - 1) ? false : true ;
+                if( !neighborReq.no_ssid )
+                {
+                   neighborReq.ssid.length = (wrqu->data.length - 1) > 32 ? 32 : (wrqu->data.length - 1) ;
+                   vos_mem_copy( neighborReq.ssid.ssId, wrqu->data.pointer, neighborReq.ssid.length );
+                }
+
+                callbackInfo.neighborRspCallback = NULL;
+                callbackInfo.neighborRspCallbackContext = NULL;
+                callbackInfo.timeout = 5000;   //5 seconds
+                sme_NeighborReportRequest(  WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &neighborReq, &callbackInfo );
+             }
+             else
+             {
+                hddLog(LOGE, "%s: Ignoring neighbor request as RRM is not enabled\n", __func__);
+                ret = -EINVAL;
+             }
+          }
+          break;
+#endif
+#ifdef WLAN_FEATURE_P2P
+       case WE_SET_AP_WPS_IE:
+          hddLog( LOGE, "Received WE_SET_AP_WPS_IE" );
+#ifdef WLAN_FEATURE_P2P
+          sme_updateP2pIe( WLAN_HDD_GET_HAL_CTX(pAdapter), wrqu->data.pointer, wrqu->data.length );
+#endif // WLAN_FEATURE_P2P
+          break;
+#endif
+       case WE_SET_CONFIG:
+          vstatus = hdd_execute_config_command(pHddCtx, wrqu->data.pointer);
+          if (VOS_STATUS_SUCCESS != vstatus)
+          {
+             ret = -EINVAL;
+          }
+          break;
+       default:
+       {
+           hddLog(LOGE, "%s: Invalid sub command %d\n",__FUNCTION__, sub_cmd);
+           ret = -EINVAL;
+           break;
+       }
+    }
+    return ret;
+}
+
+/* get param sub-ioctls */
+static int iw_setnone_getint(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    int *value = (int *)extra;
+    int ret = 0; /* success */
+
+
+    switch (value[0])
+    {
+        case WE_GET_11D_STATE:
+        {
+           tSmeConfigParams smeConfig;;
+           
+           sme_GetConfigParam(hHal,&smeConfig);
+           
+           *value = smeConfig.csrConfig.Is11dSupportEnabled;
+
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%ld!!\n"),*value);
+
+           break;
+        }
+
+        case WE_IBSS_STATUS:
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****Return IBSS Status*****\n");
+           break;
+
+        case WE_PMC_STATE:
+        {
+             *value = pmcGetPmcState(hHal);
+             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("PMC state=%ld!!\n"),*value);
+             break;
+        }
+        case WE_GET_WLAN_DBG:
+        {
+           vos_trace_display();
+           *value = 0;
+           break;
+        }
+        case WE_MODULE_DOWN_IND:
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: sending WLAN_MODULE_DOWN_IND", __FUNCTION__);
+            send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
+#ifdef WLAN_BTAMP_FEATURE
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: Take down AMP PAL", __FUNCTION__);
+            BSL_Deinit(vos_get_global_context(VOS_MODULE_ID_HDD, NULL));
+#endif
+            //WLANBAP_Close(vos_get_global_context(VOS_MODULE_ID_HDD, NULL));
+
+            *value = 0;
+            break;
+        }
+        case WE_GET_MAX_ASSOC:
+        {
+            if (ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value) != eHAL_STATUS_SUCCESS)
+            {
+                ret = -EIO;
+            }
+            break;
+        }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+        case WE_GET_WDI_DBG:
+        {
+           wpalTraceDisplay();
+           *value = 0;
+           break;
+        }
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+        case WE_GET_SAP_AUTO_CHANNEL_SELECTION:
+        {
+            *value = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection;
+            break;
+        }
+        case WE_GET_CONCURRENCY_MODE:
+        {
+           *value = hdd_get_concurrency_mode ( );
+
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("concurrency mode=%d \n"),*value);
+           break;
+        }
+
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+/* set param sub-ioctls */
+int iw_set_three_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    int *value = (int *)extra;
+    int sub_cmd = value[0];
+    int ret = 0;
+
+    switch(sub_cmd)
+    {
+        case WE_SET_WLAN_DBG:
+        {
+            vos_trace_setValue( value[1], value[2], value[3]);
+            break;
+        }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+        case WE_SET_WDI_DBG:
+        {
+            wpalTraceSetLevel( value[1], value[2], value[3]);
+            break;
+        }
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+        case WE_SET_SAP_CHANNELS:
+        {
+            ret = iw_softap_set_channel_range( dev, value[1], value[2], value[3]);
+            break;
+        }
+
+        default:
+        {
+            hddLog(LOGE, "Invalid IOCTL command %d  \n",  sub_cmd );
+            break;
+        }
+    }
+    return ret;
+}
+
+static int iw_get_char_setnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    int sub_cmd = wrqu->data.flags;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    VOS_STATUS status;
+#endif // FEATURE_WLAN_NON_INTEGRATED_SOC
+    switch(sub_cmd)
+    {
+        case WE_WLAN_VERSION:
+        {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+            status = hdd_wlan_get_version(pAdapter, wrqu, extra);
+#else // FEATURE_WLAN_NON_INTEGRATED_SOC
+            char *buf = extra;
+            wrqu->data.length = snprintf(buf, WE_MAX_STR_LEN, "%s_",
+                                         WLAN_CHIP_VERSION);
+#endif
+            break;
+        }
+
+        case WE_GET_STATS:
+        {
+            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+            hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats;
+            hdd_chip_reset_stats_t *pResetStats = &pHddCtx->hddChipResetStats;
+
+            snprintf(extra, WE_MAX_STR_LEN,
+                     "\nTransmit"
+                     "\ncalled %u, dropped %u, backpressured %u, queued %u"
+                     "\n      dropped BK %u, BE %u, VI %u, VO %u"
+                     "\n   classified BK %u, BE %u, VI %u, VO %u"
+                     "\nbackpressured BK %u, BE %u, VI %u, VO %u"
+                     "\n       queued BK %u, BE %u, VI %u, VO %u"
+                     "\nfetched %u, empty %u, lowres %u, deqerr %u"
+                     "\ndequeued %u, depressured %u, completed %u, flushed %u"
+                     "\n      fetched BK %u, BE %u, VI %u, VO %u"
+                     "\n     dequeued BK %u, BE %u, VI %u, VO %u"
+                     "\n  depressured BK %u, BE %u, VI %u, VO %u"
+                     "\n      flushed BK %u, BE %u, VI %u, VO %u"
+                     "\n\nReceive"
+                     "\nchains %u, packets %u, dropped %u, delivered %u, refused %u"
+                     "\n\nResetsStats"
+                     "\n TotalLogp %u Cmd53 %u MutexRead %u  MIF-Error %u FW-Heartbeat %u Others %u"
+                     "\n",
+                     pStats->txXmitCalled,
+                     pStats->txXmitDropped,
+                     pStats->txXmitBackPressured,
+                     pStats->txXmitQueued,
+
+                     pStats->txXmitDroppedAC[WLANTL_AC_BK],
+                     pStats->txXmitDroppedAC[WLANTL_AC_BE],
+                     pStats->txXmitDroppedAC[WLANTL_AC_VI],
+                     pStats->txXmitDroppedAC[WLANTL_AC_VO],
+
+                     pStats->txXmitClassifiedAC[WLANTL_AC_BK],
+                     pStats->txXmitClassifiedAC[WLANTL_AC_BE],
+                     pStats->txXmitClassifiedAC[WLANTL_AC_VI],
+                     pStats->txXmitClassifiedAC[WLANTL_AC_VO],
+
+                     pStats->txXmitBackPressuredAC[WLANTL_AC_BK],
+                     pStats->txXmitBackPressuredAC[WLANTL_AC_BE],
+                     pStats->txXmitBackPressuredAC[WLANTL_AC_VI],
+                     pStats->txXmitBackPressuredAC[WLANTL_AC_VO],
+
+                     pStats->txXmitQueuedAC[WLANTL_AC_BK],
+                     pStats->txXmitQueuedAC[WLANTL_AC_BE],
+                     pStats->txXmitQueuedAC[WLANTL_AC_VI],
+                     pStats->txXmitQueuedAC[WLANTL_AC_VO],
+
+                     pStats->txFetched,
+                     pStats->txFetchEmpty,
+                     pStats->txFetchLowResources,
+                     pStats->txFetchDequeueError,
+
+                     pStats->txFetchDequeued,
+                     pStats->txFetchDePressured,
+                     pStats->txCompleted,
+                     pStats->txFlushed,
+
+                     pStats->txFetchedAC[WLANTL_AC_BK],
+                     pStats->txFetchedAC[WLANTL_AC_BE],
+                     pStats->txFetchedAC[WLANTL_AC_VI],
+                     pStats->txFetchedAC[WLANTL_AC_VO],
+
+                     pStats->txFetchDequeuedAC[WLANTL_AC_BK],
+                     pStats->txFetchDequeuedAC[WLANTL_AC_BE],
+                     pStats->txFetchDequeuedAC[WLANTL_AC_VI],
+                     pStats->txFetchDequeuedAC[WLANTL_AC_VO],
+
+                     pStats->txFetchDePressuredAC[WLANTL_AC_BK],
+                     pStats->txFetchDePressuredAC[WLANTL_AC_BE],
+                     pStats->txFetchDePressuredAC[WLANTL_AC_VI],
+                     pStats->txFetchDePressuredAC[WLANTL_AC_VO],
+
+                     pStats->txFlushedAC[WLANTL_AC_BK],
+                     pStats->txFlushedAC[WLANTL_AC_BE],
+                     pStats->txFlushedAC[WLANTL_AC_VI],
+                     pStats->txFlushedAC[WLANTL_AC_VO],
+
+                     pStats->rxChains,
+                     pStats->rxPackets,
+                     pStats->rxDropped,
+                     pStats->rxDelivered,
+                     pStats->rxRefused,
+
+                     pResetStats->totalLogpResets,
+                     pResetStats->totalCMD53Failures,
+                     pResetStats->totalMutexReadFailures,
+                     pResetStats->totalMIFErrorFailures,
+                     pResetStats->totalFWHearbeatFailures,
+                     pResetStats->totalUnknownExceptions
+                     );
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+
+        case WE_GET_CFG:
+        {
+            hdd_cfg_get_config(WLAN_HDD_GET_CTX(pAdapter), extra, WE_MAX_STR_LEN);
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+
+        case WE_GET_WMM_STATUS:
+        {
+            snprintf(extra, WE_MAX_STR_LEN,
+                    "\nDir: 0=up, 1=down, 3=both\n"
+                    "|------------------------|\n"
+                    "|AC | ACM |Admitted| Dir |\n"
+                    "|------------------------|\n"
+                    "|VO |  %d  |  %3s   |  %d  |\n"
+                    "|VI |  %d  |  %3s   |  %d  |\n"
+                    "|BE |  %d  |  %3s   |  %d  |\n"
+                    "|BK |  %d  |  %3s   |  %d  |\n"
+                    "|------------------------|\n",
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessRequired,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessAllowed?"YES":"NO",
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcTspecInfo.ts_info.direction,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessRequired,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessAllowed?"YES":"NO",
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcTspecInfo.ts_info.direction,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessRequired,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessAllowed?"YES":"NO",
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcTspecInfo.ts_info.direction,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessRequired,
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO",
+                    pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction);
+
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+        case WE_GET_CHANNEL_LIST:
+        {
+            VOS_STATUS status;
+            v_U8_t i, len;
+            char* buf ;
+            tChannelListInfo channel_list;
+
+            status = iw_softap_get_channel_list(dev, info, wrqu, (char *)&channel_list);
+            if ( !VOS_IS_STATUS_SUCCESS( status ) ) 
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s GetChannelList Failed!!!\n",__func__);
+                return -EINVAL;
+            }
+            buf = extra;
+
+            /**
+                       * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. Maximum buffer
+                       * needed = 5 * number of channels. Check if sufficient buffer is available and 
+                       * then proceed to fill the buffer.
+                       */
+            if(WE_MAX_STR_LEN < (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s Insufficient Buffer to populate channel list\n",__func__);
+                return -EINVAL;
+            }
+            len = snprintf(buf, 5, "%u ", channel_list.num_channels);
+            buf += len;
+            for(i = 0 ; i < channel_list.num_channels; i++)
+            {
+                len = snprintf(buf, 5,
+                               "%u ", channel_list.channels[i]);
+                buf += len;
+            }
+            wrqu->data.length = strlen(extra)+1;
+
+            break;
+        }
+        default:  
+        {
+            hddLog(LOGE, "Invalid IOCTL command %d  \n",  sub_cmd );
+            break;
+        }
+    }
+
+    return 0;
+}
+
+/*  action sub-ioctls */
+static int iw_setnone_getnone(struct net_device *dev, struct iw_request_info *info,
+                       union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    int sub_cmd = wrqu->data.flags;
+    int ret = 0; /* sucess */
+
+    switch (sub_cmd)
+    {
+        case WE_CLEAR_STATS:
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: clearing", __FUNCTION__);
+            memset(&pAdapter->stats, 0, sizeof(pAdapter->stats));
+            memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats));
+            break;
+        }
+#ifdef WLAN_SOFTAP_FEATURE
+        case WE_INIT_AP:
+        {
+          pr_info("Init AP trigger\n");
+          hdd_open_adapter( WLAN_HDD_GET_CTX(pAdapter), WLAN_HDD_SOFTAP, "softap.%d",
+                 wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE);
+          break;
+        }
+        case WE_STOP_AP:
+        {
+           /*FIX ME: Need to be revisited if multiple SAPs to be supported */
+           /* As Soft AP mode has been changed to STA already with killing of Hostapd,
+            * this is a dead code and need to find the adpater by name rather than mode */
+           hdd_adapter_t* pAdapter_to_stop =
+                hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0");
+           if( pAdapter_to_stop )
+           {
+               hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+               pr_info("Stopping AP mode\n");
+
+               /*Make sure that pAdapter cleaned properly*/
+               hdd_stop_adapter( pHddCtx, pAdapter_to_stop );
+               hdd_deinit_adapter( pHddCtx, pAdapter_to_stop );
+               memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx));
+
+               wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter),
+                       pAdapter_to_stop->macAddressCurrent.bytes);
+               hdd_close_adapter(WLAN_HDD_GET_CTX(pAdapter), pAdapter_to_stop,
+                       TRUE);
+           }
+           else
+           {
+              printk(KERN_ERR"SAP adaptor not found to stop it!\n");
+           }
+
+           break;
+        }
+#endif
+#ifdef WLAN_BTAMP_FEATURE
+        case WE_ENABLE_AMP:
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: enabling AMP", __FUNCTION__);
+            WLANBAP_RegisterWithHCI(pAdapter);
+            break;
+        }
+        case WE_DISABLE_AMP:
+        {
+            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+            VOS_STATUS status;
+
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __FUNCTION__);
+
+            pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+            status = WLANBAP_StopAmp();
+            if(VOS_STATUS_SUCCESS != status )
+            {
+               pHddCtx->isAmpAllowed = VOS_TRUE;
+               hddLog(VOS_TRACE_LEVEL_FATAL,
+                      "%s: Failed to stop AMP", __func__);
+            }
+            else
+            {
+               //a state m/c implementation in PAL is TBD to avoid this delay
+               msleep(500);
+               pHddCtx->isAmpAllowed = VOS_FALSE;
+               WLANBAP_DeregisterFromHCI();
+            }
+
+            break;
+        }
+#endif
+
+        default:
+        {
+            hddLog(LOGE, "%s: unknown ioctl %d", __FUNCTION__, sub_cmd);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+int iw_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    int sub_cmd = wrqu->data.flags;
+    int *value = (int*)wrqu->data.pointer;
+    int apps_args[MAX_VAR_ARGS] = {0};
+    int num_args = wrqu->data.length;
+
+    hddLog(LOG1, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    if (num_args > MAX_VAR_ARGS)
+    {
+       num_args = MAX_VAR_ARGS;
+    }
+    vos_mem_copy(apps_args, value, (sizeof(int)) * num_args);
+
+    switch (sub_cmd)
+    {
+        case WE_LOG_DUMP_CMD:
+            {
+                hddLog(LOG1, "%s: LOG_DUMP %d arg1 %d arg2 %d arg3 %d arg4 %d",
+                        __FUNCTION__, apps_args[0], apps_args[1], apps_args[2],
+                        apps_args[3], apps_args[4]);
+
+                logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2],
+                        apps_args[3], apps_args[4]);
+
+            }
+            break;
+
+#ifdef WLAN_FEATURE_P2P
+        case WE_P2P_NOA_CMD:
+            {
+                p2p_app_setP2pPs_t p2pNoA;
+
+                p2pNoA.opp_ps = apps_args[0];
+                p2pNoA.ctWindow = apps_args[1];
+                p2pNoA.duration = apps_args[2];
+                p2pNoA.interval  = apps_args[3];
+                p2pNoA.count = apps_args[4];
+                p2pNoA.single_noa_duration = apps_args[5];
+                p2pNoA.psSelection = apps_args[6];
+
+                hddLog(LOG1, "%s: P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d "
+                       "interval %d count %d single noa duration %d PsSelection %x",
+                       __FUNCTION__, apps_args[0], apps_args[1], apps_args[2],
+                       apps_args[3], apps_args[4], apps_args[5], apps_args[6]);
+
+                hdd_setP2pPs(dev, &p2pNoA);
+
+            }
+            break;
+#endif
+
+        default:
+            {
+                hddLog(LOGE, "Invalid IOCTL command %d",  sub_cmd );
+            }
+            break;
+    }
+
+    return 0;
+}
+
+
+static int iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
+   int params[HDD_WLAN_WMM_PARAM_COUNT];
+   sme_QosWmmTspecInfo tSpec;
+   v_U32_t handle;
+
+   // make sure the application is sufficiently priviledged
+   // note that the kernel will do this for "set" ioctls, but since
+   // this ioctl wants to return status to user space it must be
+   // defined as a "get" ioctl
+   if (!capable(CAP_NET_ADMIN))
+   {
+      return -EPERM;
+   }
+
+   // we must be associated in order to add a tspec
+   if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+   {
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   // since we are defined to be a "get" ioctl, and since the number
+   // of params exceeds the number of params that wireless extensions
+   // will pass down in the iwreq_data, we must copy the "set" params
+   // from user space ourselves
+   if (copy_from_user(&params, wrqu->data.pointer, sizeof(params)))
+   {
+      // hmmm, can't get them
+      return -EIO;
+   }
+
+   // clear the tspec
+   memset(&tSpec, 0, sizeof(tSpec));
+
+   // validate the handle
+   handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
+   if (HDD_WMM_HANDLE_IMPLICIT == handle)
+   {
+      // that one is reserved
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   // validate the TID
+   if (params[HDD_WLAN_WMM_PARAM_TID] > 7)
+   {
+      // out of range
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+   tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
+
+   // validate the direction
+   switch (params[HDD_WLAN_WMM_PARAM_DIRECTION])
+   {
+   case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
+      tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
+      break;
+
+   case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
+      tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
+      break;
+
+   case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
+      tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
+      break;
+
+   default:
+      // unknown
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   // validate the user priority
+   if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX)
+   {
+      // out of range
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+   tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
+
+   tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
+   tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
+   tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
+   tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
+   tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
+   tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
+   tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
+   tSpec.surplus_bw_allowance = params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
+   tSpec.min_service_interval = params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
+   tSpec.max_service_interval = params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
+   tSpec.suspension_interval = params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
+   tSpec.inactivity_interval = params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
+
+   tSpec.ts_info.burst_size_defn = params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
+
+   // validate the ts info ack policy
+   switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY])
+   {
+   case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
+      tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
+      break;
+
+   case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
+      tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
+      break;
+
+   default:
+      // unknown
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec);
+   return 0;
+}
+
+
+static int iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   int *params = (int *)extra;
+   hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
+   v_U32_t handle;
+
+   // make sure the application is sufficiently priviledged
+   // note that the kernel will do this for "set" ioctls, but since
+   // this ioctl wants to return status to user space it must be
+   // defined as a "get" ioctl
+   if (!capable(CAP_NET_ADMIN))
+   {
+      return -EPERM;
+   }
+
+   // although we are defined to be a "get" ioctl, the params we require
+   // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
+   // is no need to copy the params from user space
+
+   // validate the handle
+   handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
+   if (HDD_WMM_HANDLE_IMPLICIT == handle)
+   {
+      // that one is reserved
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   *pStatus = hdd_wmm_delts(pAdapter, handle);
+   return 0;
+}
+
+
+static int iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   int *params = (int *)extra;
+   hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
+   v_U32_t handle;
+
+   // although we are defined to be a "get" ioctl, the params we require
+   // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
+   // is no need to copy the params from user space
+
+   // validate the handle
+   handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
+   if (HDD_WMM_HANDLE_IMPLICIT == handle)
+   {
+      // that one is reserved
+      *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+      return 0;
+   }
+
+   *pStatus = hdd_wmm_checkts(pAdapter, handle);
+   return 0;
+}
+
+
+#ifdef FEATURE_WLAN_WAPI
+static int iw_qcom_set_wapi_mode(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
+
+    WAPI_FUNCTION_MODE *pWapiMode = (WAPI_FUNCTION_MODE *)wrqu->data.pointer;
+
+    hddLog(LOG1, "The function iw_qcom_set_wapi_mode called");
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+    hddLog(LOG1, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    hddLog(LOG1, "%s: Input Data (wreq) WAPI Mode:%02d", __FUNCTION__, pWapiMode->wapiMode);
+
+
+    if(WZC_ORIGINAL == pWapiMode->wapiMode) {
+        hddLog(LOG1, "%s: WAPI Mode Set to OFF", __FUNCTION__);
+         /* Set Encryption mode to defualt , this allows next successfull non-WAPI Association */
+        pRoamProfile->EncryptionType.numEntries = 1;
+        pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+        pRoamProfile->mcEncryptionType.numEntries = 1;
+        pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+
+        pRoamProfile->AuthType.numEntries = 1;
+        pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+        pRoamProfile->AuthType.authType[0] = pHddStaCtx->conn_info.authType;
+    }
+    else if(WAPI_EXTENTION == pWapiMode->wapiMode) {
+        hddLog(LOG1, "%s: WAPI Mode Set to ON", __FUNCTION__);
+    }
+    else
+         return -EINVAL;
+
+    pAdapter->wapi_info.nWapiMode = pWapiMode->wapiMode;
+
+    return 0;
+}
+
+static int iw_qcom_get_wapi_mode(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    WAPI_FUNCTION_MODE *pWapiMode = (WAPI_FUNCTION_MODE *)(extra);
+
+    hddLog(LOG1, "The function iw_qcom_get_wapi_mode called");
+
+    pWapiMode->wapiMode = pAdapter->wapi_info.nWapiMode;
+    hddLog(LOG1, "%s: GET WAPI Mode Value:%02d", __FUNCTION__, pWapiMode->wapiMode);
+    printk("\nGET WAPI MODE:%d",pWapiMode->wapiMode);
+    return 0;
+}
+
+static int iw_qcom_set_wapi_assoc_info(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+//    WAPI_AssocInfo *pWapiAssocInfo = (WAPI_AssocInfo *)(wrqu->data.pointer);
+    WAPI_AssocInfo *pWapiAssocInfo = (WAPI_AssocInfo *)(extra);
+    int i = 0, j = 0;
+    hddLog(LOG1, "The function iw_qcom_set_wapi_assoc_info called");
+    hddLog(LOG1, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)extra);
+
+    VOS_ASSERT(pWapiAssocInfo);
+
+    hddLog(LOG1, "%s: INPUT DATA:\nElement ID:0x%02x Length:0x%02x Version:0x%04x\n",__FUNCTION__,pWapiAssocInfo->elementID,pWapiAssocInfo->length,pWapiAssocInfo->version);
+    hddLog(LOG1,"%s: akm Suite Cnt:0x%04x",__FUNCTION__,pWapiAssocInfo->akmSuiteCount);
+    for(i =0 ; i < 16 ; i++)
+        hddLog(LOG1,"akm suite[%02d]:0x%08lx",i,pWapiAssocInfo->akmSuite[i]);
+
+    hddLog(LOG1,"%s: Unicast Suite Cnt:0x%04x",__FUNCTION__,pWapiAssocInfo->unicastSuiteCount);
+    for(i =0 ; i < 16 ; i++)
+        hddLog(LOG1, "Unicast suite[%02d]:0x%08lx",i,pWapiAssocInfo->unicastSuite[i]);
+
+    hddLog(LOG1,"%s: Multicast suite:0x%08lx Wapi capa:0x%04x",__FUNCTION__,pWapiAssocInfo->multicastSuite,pWapiAssocInfo->wapiCability);
+    hddLog(LOG1, "%s: BKID Cnt:0x%04x\n",__FUNCTION__,pWapiAssocInfo->bkidCount);
+    for(i = 0 ; i < 16 ; i++) {
+        hddLog(LOG1, "BKID List[%02d].bkid:0x",i);
+        for(j = 0 ; j < 16 ; j++)
+            hddLog(LOG1,"%02x",pWapiAssocInfo->bkidList[i].bkid[j]);
+    }
+
+    /* We are not using the entire IE as provided by the supplicant.
+     * This is being calculated by SME. This is the same as in the
+     * case of WPA. Only the auth mode information needs to be
+     * extracted here*/
+    if ( pWapiAssocInfo->akmSuite[0] == WAPI_PSK_AKM_SUITE ) {
+       hddLog(LOG1, "%s: WAPI AUTH MODE SET TO PSK",__FUNCTION__);
+       pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK;
+    }
+
+    if ( pWapiAssocInfo->akmSuite[0] == WAPI_CERT_AKM_SUITE) {
+       hddLog(LOG1, "%s: WAPI AUTH MODE SET TO CERTIFICATE",__FUNCTION__);
+       pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT;
+    }
+    return 0;
+}
+
+static int iw_qcom_set_wapi_key(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    eHalStatus       halStatus   = eHAL_STATUS_SUCCESS;
+    tANI_U32         roamId      = 0xFF;
+    tANI_U8         *pKeyPtr     = NULL;
+    v_BOOL_t         isConnected = TRUE;
+    tCsrRoamSetKey   setKey;
+    int i = 0;
+
+//    WLAN_WAPI_KEY *pWapiKey = (WLAN_WAPI_KEY *)(wrqu->data.pointer);
+    WLAN_WAPI_KEY *pWapiKey = (WLAN_WAPI_KEY *)(extra);
+
+    hddLog(LOG1, "The function iw_qcom_set_wapi_key called ");
+    hddLog(LOG1, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)extra);
+
+    hddLog(LOG1,":s: INPUT DATA:\nKey Type:0x%02x Key Direction:0x%02x KEY ID:0x%02x\n", __FUNCTION__,pWapiKey->keyType,pWapiKey->keyDirection,pWapiKey->keyId);
+    hddLog(LOG1,"Add Index:0x");
+    for(i =0 ; i < 12 ; i++)
+        hddLog(LOG1,"%02x",pWapiKey->addrIndex[i]);
+
+    hddLog(LOG1,"\n%s: WAPI ENCRYPTION KEY LENGTH:0x%04x", __FUNCTION__,pWapiKey->wpiekLen);
+    hddLog(LOG1, "WAPI ENCRYPTION KEY:0x");
+    for(i =0 ; i < 16 ; i++)
+        hddLog(LOG1,"%02x",pWapiKey->wpiek[i]);
+
+    hddLog(LOG1,"\n%s: WAPI INTEGRITY CHECK KEY LENGTH:0x%04x", __FUNCTION__,pWapiKey->wpickLen);
+    hddLog(LOG1,"WAPI INTEGRITY CHECK KEY:0x");
+    for(i =0 ; i < 16 ; i++)
+        hddLog(LOG1,"%02x",pWapiKey->wpick[i]);
+
+    hddLog(LOG1,"\nWAPI PN NUMBER:0x");
+    for(i = 0 ; i < 16 ; i++)
+        hddLog(LOG1,"%02x",pWapiKey->pn[i]);
+
+    // Clear the setkey memory
+    vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
+    // Store Key ID
+    setKey.keyId = (unsigned char)( pWapiKey->keyId );
+    // SET WAPI Encryption
+    setKey.encType  = eCSR_ENCRYPT_TYPE_WPI;
+    // Key Directionn both TX and RX
+    setKey.keyDirection = eSIR_TX_RX; // Do WE NEED to update this based on Key Type as GRP/UNICAST??
+    // the PAE role
+    setKey.paeRole = 0 ;
+
+    switch ( pWapiKey->keyType )
+    {
+        case HDD_PAIRWISE_WAPI_KEY:
+        {
+            isConnected = hdd_connIsConnected(pHddStaCtx);
+            vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN);
+            break;
+        }
+        case HDD_GROUP_WAPI_KEY:
+        {
+            vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac );
+            break;
+        }
+        default:
+        {
+            //Any other option is invalid.
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                       "[%4d] %s() failed to Set Key. Invalid key type %d", __LINE__,__FUNCTION__ , -1 );
+
+            hddLog(LOGE," %s: Error WAPI Key Add Type",__FUNCTION__);
+            halStatus = !eHAL_STATUS_SUCCESS; // NEED TO UPDATE THIS WITH CORRECT VALUE
+            break; // NEED RETURN FROM HERE ????
+        }
+    }
+
+    // Concatenating the Encryption Key (EK) and the MIC key (CK): EK followed by CK
+    setKey.keyLength = (v_U16_t)((pWapiKey->wpiekLen)+(pWapiKey->wpickLen));
+    pKeyPtr = setKey.Key;
+    memcpy( pKeyPtr, pWapiKey->wpiek, pWapiKey->wpiekLen );
+    pKeyPtr += pWapiKey->wpiekLen;
+    memcpy( pKeyPtr, pWapiKey->wpick, pWapiKey->wpickLen );
+
+    // Set the new key with SME.
+    pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;
+
+    if ( isConnected ) {
+        halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &setKey, &roamId );
+        if ( halStatus != eHAL_STATUS_SUCCESS )
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                       "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus );
+
+            pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+        }
+    }
+#if 0 /// NEED TO CHECK ON THIS
+    else
+    {
+        // Store the keys in the adapter to be moved to the profile & passed to
+        // SME in the ConnectRequest if we are not yet in connected state.
+         memcpy( &pAdapter->setKey[ setKey.keyId ], &setKey, sizeof( setKey ) );
+         pAdapter->fKeySet[ setKey.keyId ] = TRUE;
+
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
+                    "  Saving key [idx= %d] to apply when moving to connected state ",
+                    setKey.keyId );
+
+    }
+#endif
+    return halStatus;
+}
+
+static int iw_qcom_set_wapi_bkid(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+#ifdef WLAN_DEBUG
+    int i = 0;
+    WLAN_BKID_LIST  *pBkid       = ( WLAN_BKID_LIST *) (wrqu->data.pointer);
+#endif
+
+    hddLog(LOG1, "The function iw_qcom_set_wapi_bkid called");
+    hddLog(LOG1, "%s: Received length %d", __FUNCTION__, wrqu->data.length);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)wrqu->data.pointer);
+    hddLog(LOG1, "%s: Received data %s", __FUNCTION__, (char*)extra);
+
+    hddLog(LOG1,"%s: INPUT DATA:\n BKID Length:0x%08lx\n", __FUNCTION__,pBkid->length);
+    hddLog(LOG1,"%s: BKID Cnt:0x%04lx",pBkid->BKIDCount);
+
+    hddLog(LOG1,"BKID KEY LIST[0]:0x");
+#ifdef WLAN_DEBUG
+    for(i =0 ; i < 16 ; i++)
+        hddLog(LOG1,"%02x",pBkid->BKID[0].bkid[i]);
+#endif
+
+    return 0;
+}
+
+static int iw_qcom_get_wapi_bkid(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    /* Yet to implement this function, 19th April 2010 */
+    hddLog(LOG1, "The function iw_qcom_get_wapi_bkid called ");
+
+    return 0;
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+//
+//
+// Each time the supplicant has the auth_request or reassoc request
+// IEs ready. This is pushed to the driver. The driver will inturn use
+// it to send out the auth req and reassoc req for 11r FT Assoc.
+//
+static int iw_set_fties(struct net_device *dev, struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    //v_CONTEXT_t pVosContext;
+
+    if (!wrqu->data.length)
+    {
+        hddLog(LOGE, FL("%s called with 0 length IEs\n"));
+        return -EINVAL;
+    }
+    if (wrqu->data.pointer == NULL)
+    {
+        hddLog(LOGE, FL("%s called with NULL IE\n"));
+        return -EINVAL;
+    }
+
+    // Added for debug on reception of Re-assoc Req.
+    if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+    {
+        hddLog(LOGE, FL("Called with Ie of length = %d when not associated\n"),
+            wrqu->data.length);
+        hddLog(LOGE, FL("Should be Re-assoc Req IEs\n"));
+    }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+    hddLog(LOGE, FL("%s called with Ie of length = %d\n"), __func__, wrqu->data.length);
+#endif
+
+    // Pass the received FT IEs to SME
+    sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, wrqu->data.pointer,
+        wrqu->data.length);
+
+    return 0;
+}
+#endif
+
+static int iw_set_dynamic_mcbc_filter(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tpMcBcFilterCfg pRequest = (tpMcBcFilterCfg)wrqu->data.pointer;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+           "%s: Set MC BC Filter Config request: %d",
+           __FUNCTION__, pRequest->mcastBcastFilterSetting);
+
+    pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting =
+                               pRequest->mcastBcastFilterSetting;
+    pHddCtx->dynamic_mcbc_filter.enableCfg = TRUE;
+
+    return 0;
+}
+
+static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: ", __FUNCTION__);
+
+    pHddCtx->dynamic_mcbc_filter.enableCfg = FALSE;
+
+    return 0;
+}
+
+static int iw_set_host_offload(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tpHostOffloadRequest pRequest = (tpHostOffloadRequest)wrqu->data.pointer;
+    tSirHostOffloadReq offloadRequest;
+
+    /* Debug display of request components. */
+    switch (pRequest->offloadType)
+    {
+        case WLAN_IPV4_ARP_REPLY_OFFLOAD:
+            hddLog(VOS_TRACE_LEVEL_WARN, "%s: Host offload request: ARP reply", __FUNCTION__);
+            switch (pRequest->enableOrDisable)
+            {
+                case WLAN_OFFLOAD_DISABLE:
+                    hddLog(VOS_TRACE_LEVEL_WARN, "   disable");
+                    break;
+                case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
+                    hddLog(VOS_TRACE_LEVEL_WARN, "   BC Filtering enable");
+                case WLAN_OFFLOAD_ENABLE:
+                    hddLog(VOS_TRACE_LEVEL_WARN, "   ARP offload enable");
+                    hddLog(VOS_TRACE_LEVEL_WARN, "   IP address: %d.%d.%d.%d",
+                            pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1],
+                            pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]);
+            }
+            break;
+
+    case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
+        hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Host offload request: neighbor discovery\n",
+               __FUNCTION__);
+        switch (pRequest->enableOrDisable)
+        {
+        case WLAN_OFFLOAD_DISABLE:
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "   disable");
+            break;
+        case WLAN_OFFLOAD_ENABLE:
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "   enable");
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "   IP address: %x:%x:%x:%x:%x:%x:%x:%x",
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 2),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 4),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 6),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 8),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 10),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 12),
+                   *(v_U16_t *)(pRequest->params.hostIpv6Addr + 14));
+        }
+    }
+
+    /* Execute offload request. The reason that we can copy the request information
+       from the ioctl structure to the SME structure is that they are laid out
+       exactly the same.  Otherwise, each piece of information would have to be
+       copied individually. */
+    memcpy(&offloadRequest, pRequest, wrqu->data.length);
+    if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offloadRequest))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request\n",
+               __func__);
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
+static int iw_set_keepalive_params(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tpKeepAliveRequest pRequest = (tpKeepAliveRequest)wrqu->data.pointer;
+    tSirKeepAliveReq keepaliveRequest;
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
+    }
+
+    /* Debug display of request components. */
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: Set Keep Alive Request : TimePeriod %d size %d",
+           __FUNCTION__,pRequest->timePeriod, sizeof(tKeepAliveRequest));
+
+      switch (pRequest->packetType)
+      {
+        case WLAN_KEEP_ALIVE_NULL_PKT:
+            hddLog(VOS_TRACE_LEVEL_WARN, "%s: Keep Alive Request: Tx NULL", __FUNCTION__);
+            break;
+
+        case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
+
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Keep Alive Request: Tx UnSolicited ARP RSP\n",
+               __FUNCTION__);
+
+            hddLog(VOS_TRACE_LEVEL_WARN, "  Host IP address: %d.%d.%d.%d",
+            pRequest->hostIpv4Addr[0], pRequest->hostIpv4Addr[1],
+            pRequest->hostIpv4Addr[2], pRequest->hostIpv4Addr[3]);
+
+            hddLog(VOS_TRACE_LEVEL_WARN, "  Dest IP address: %d.%d.%d.%d",
+            pRequest->destIpv4Addr[0], pRequest->destIpv4Addr[1],
+            pRequest->destIpv4Addr[2], pRequest->destIpv4Addr[3]);
+
+            hddLog(VOS_TRACE_LEVEL_WARN, "  Dest MAC address: %d:%d:%d:%d:%d:%d",
+            pRequest->destMacAddr[0], pRequest->destMacAddr[1],
+            pRequest->destMacAddr[2], pRequest->destMacAddr[3],
+            pRequest->destMacAddr[4], pRequest->destMacAddr[5]);
+            break;
+
+      }
+
+    /* Execute keep alive request. The reason that we can copy the request information
+       from the ioctl structure to the SME structure is that they are laid out
+       exactly the same.  Otherwise, each piece of information would have to be
+       copied individually. */
+       memcpy(&keepaliveRequest, pRequest, wrqu->data.length);
+
+       hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d\n", keepaliveRequest.timePeriod);
+
+    if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), &keepaliveRequest))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive\n",
+               __func__);
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest)
+{
+    tSirRcvPktFilterCfgType    packetFilterSetReq;
+    tSirRcvFltPktClearParam    packetFilterClrReq;
+    int i=0;
+
+    if (pHddCtx->cfg_ini->disablePacketFilter)
+    {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Packet Filtering Disabled. Returning ",
+                __FUNCTION__ );
+        return 0;
+    }
+
+    /* Debug display of request components. */
+    hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Packet Filter Request : FA %d params %d",
+            __FUNCTION__, pRequest->filterAction, pRequest->numParams);
+
+    switch (pRequest->filterAction)
+    {
+        case HDD_RCV_FILTER_SET:
+            hddLog(VOS_TRACE_LEVEL_INFO, "%s: Set Packet Filter Request for Id: %d",
+                    __FUNCTION__, pRequest->filterId);
+
+            packetFilterSetReq.filterId = pRequest->filterId;
+            if ( pRequest->numParams >= HDD_MAX_CMP_PER_PACKET_FILTER)
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Number of Params exceed Max limit %d\n",
+                        __func__, pRequest->numParams);
+                return -EINVAL;
+            }
+            packetFilterSetReq.numFieldParams = pRequest->numParams;
+            packetFilterSetReq.coalesceTime = 0;
+            packetFilterSetReq.filterType = 1;
+            for (i=0; i < pRequest->numParams; i++)
+            {
+                packetFilterSetReq.paramsData[i].protocolLayer = pRequest->paramsData[i].protocolLayer;
+                packetFilterSetReq.paramsData[i].cmpFlag = pRequest->paramsData[i].cmpFlag;
+                packetFilterSetReq.paramsData[i].dataOffset = pRequest->paramsData[i].dataOffset;
+                packetFilterSetReq.paramsData[i].dataLength = pRequest->paramsData[i].dataLength;
+                packetFilterSetReq.paramsData[i].reserved = 0;
+
+                hddLog(VOS_TRACE_LEVEL_INFO, "Proto %d Comp Flag %d Filter Type\n",
+                        pRequest->paramsData[i].protocolLayer, pRequest->paramsData[i].cmpFlag,
+                        packetFilterSetReq.filterType);
+
+                hddLog(VOS_TRACE_LEVEL_INFO, "Data Offset %d Data Len %d\n",
+                        pRequest->paramsData[i].dataOffset, pRequest->paramsData[i].dataLength);
+
+                memcpy(&packetFilterSetReq.paramsData[i].compareData,
+                        pRequest->paramsData[i].compareData, pRequest->paramsData[i].dataLength);
+                memcpy(&packetFilterSetReq.paramsData[i].dataMask,
+                        pRequest->paramsData[i].dataMask, pRequest->paramsData[i].dataLength);
+
+                hddLog(VOS_TRACE_LEVEL_INFO, "CData %d CData %d CData %d CData %d CData %d CData %d\n",
+                        pRequest->paramsData[i].compareData[0], pRequest->paramsData[i].compareData[1],
+                        pRequest->paramsData[i].compareData[2], pRequest->paramsData[i].compareData[3],
+                        pRequest->paramsData[i].compareData[4], pRequest->paramsData[i].compareData[5]);
+
+                hddLog(VOS_TRACE_LEVEL_INFO, "MData %d MData %d MData %d MData %d MData %d MData %d\n",
+                        pRequest->paramsData[i].dataMask[0], pRequest->paramsData[i].dataMask[1],
+                        pRequest->paramsData[i].dataMask[2], pRequest->paramsData[i].dataMask[3],
+                        pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]);
+            }
+
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx, &packetFilterSetReq))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter\n",
+                        __func__);
+                return -EINVAL;
+            }
+
+            break;
+
+        case HDD_RCV_FILTER_CLEAR:
+
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d\n",
+                    __FUNCTION__, pRequest->filterId);
+            packetFilterClrReq.filterId = pRequest->filterId;
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx, &packetFilterClrReq))
+            {
+                hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter\n",
+                        __func__);
+                return -EINVAL;
+            }
+            break;
+
+        default :
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Packet Filter Request: Invalid %d\n",
+                    __FUNCTION__, pRequest->filterAction);
+            return -EINVAL;
+    }
+    return 0;
+}
+
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set)
+{
+    v_U8_t filterAction = 0; 
+    tPacketFilterCfg request = {0}; 
+    v_U8_t i = 0;
+
+    filterAction = set ? HDD_RCV_FILTER_SET : HDD_RCV_FILTER_CLEAR;
+
+    /*set mulitcast addr list*/
+    for (i = 0; i < pHddCtx->mc_addr_list.mc_cnt; i++)
+    {
+        memset(&request, 0, sizeof (tPacketFilterCfg));
+        request.filterAction = filterAction;
+        request.filterId = i; 
+        if (set)
+        {
+            request.numParams = 1; 
+            request.paramsData[0].protocolLayer = HDD_FILTER_PROTO_TYPE_MAC; 
+            request.paramsData[0].cmpFlag = HDD_FILTER_CMP_TYPE_EQUAL;   
+            request.paramsData[0].dataOffset = WLAN_HDD_80211_FRM_DA_OFFSET;
+            request.paramsData[0].dataLength = ETH_ALEN;
+            memcpy(&(request.paramsData[0].compareData[0]), 
+                    &(pHddCtx->mc_addr_list.addr[i][0]), ETH_ALEN);
+            /*set mulitcast filters*/
+            hddLog(VOS_TRACE_LEVEL_INFO, 
+                    "%s: %s multicast filter: addr =" 
+                    "%02x:%02x:%02x:%02x:%02x:%02x", 
+                    __func__, set ? "setting" : "clearing", 
+                    request.paramsData[0].compareData[0], 
+                    request.paramsData[0].compareData[1],
+                    request.paramsData[0].compareData[2], 
+                    request.paramsData[0].compareData[3],
+                    request.paramsData[0].compareData[4], 
+                    request.paramsData[0].compareData[5]);
+        }
+        wlan_hdd_set_filter(pHddCtx, &request);
+    }
+    pHddCtx->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
+}
+
+static int iw_set_packet_filter_params(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
+{   
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tpPacketFilterCfg pRequest = (tpPacketFilterCfg)wrqu->data.pointer;
+    return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest);
+}
+#endif
+static int iw_get_statistics(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+
+  VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+  eHalStatus status = eHAL_STATUS_SUCCESS;
+  hdd_wext_state_t *pWextState;
+  hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+  hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+  char *p = extra;
+  int tlen = 0;
+  tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat);
+
+  tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat);
+  tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat);
+
+  ENTER();
+
+  if (pHddCtx->isLogpInProgress) {
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+     return -EINVAL;
+  }
+
+  if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) {
+
+     wrqu->txpower.value = 0;
+  }
+  else {
+    status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD,
+                       SME_SUMMARY_STATS      |
+                       SME_GLOBAL_CLASSA_STATS |
+                       SME_GLOBAL_CLASSB_STATS |
+                       SME_GLOBAL_CLASSC_STATS |
+                       SME_GLOBAL_CLASSD_STATS |
+                       SME_PER_STA_STATS,
+                       hdd_StatisticsCB, 0, FALSE,
+                       (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter );
+
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+              "%s: Unable to retrieve SME statistics",
+              __FUNCTION__);
+        return -EINVAL;
+    }
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
+    if (!VOS_IS_STATUS_SUCCESS(vos_status))
+    {
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+              "%s: SME timeout while retrieving statistics",
+              __FUNCTION__);
+       /*Remove the SME statistics list by passing NULL in callback argument*/
+       status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD,
+                       SME_SUMMARY_STATS      |
+                       SME_GLOBAL_CLASSA_STATS |
+                       SME_GLOBAL_CLASSB_STATS |
+                       SME_GLOBAL_CLASSC_STATS |
+                       SME_GLOBAL_CLASSD_STATS |
+                       SME_PER_STA_STATS,
+                       NULL, 0, FALSE,
+                       (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter );
+
+       return -EINVAL;
+    }
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RETRY_CNT,
+              (tANI_U8) sizeof (pStats->retry_cnt),
+              (char*) &(pStats->retry_cnt[0]),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_MUL_RETRY_CNT,
+              (tANI_U8) sizeof (pStats->multiple_retry_cnt),
+              (char*) &(pStats->multiple_retry_cnt[0]),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_FRM_CNT,
+              (tANI_U8) sizeof (pStats->tx_frm_cnt),
+              (char*) &(pStats->tx_frm_cnt[0]),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_FRM_CNT,
+              (tANI_U8) sizeof (pStats->rx_frm_cnt),
+              (char*) &(pStats->rx_frm_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_FRM_DUP_CNT,
+              (tANI_U8) sizeof (pStats->frm_dup_cnt),
+              (char*) &(pStats->frm_dup_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_FAIL_CNT,
+              (tANI_U8) sizeof (pStats->fail_cnt),
+              (char*) &(pStats->fail_cnt[0]),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_FAIL_CNT,
+              (tANI_U8) sizeof (pStats->rts_fail_cnt),
+              (char*) &(pStats->rts_fail_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_ACK_FAIL_CNT,
+              (tANI_U8) sizeof (pStats->ack_fail_cnt),
+              (char*) &(pStats->ack_fail_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_SUC_CNT,
+              (tANI_U8) sizeof (pStats->rts_succ_cnt),
+              (char*) &(pStats->rts_succ_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_DISCARD_CNT,
+              (tANI_U8) sizeof (pStats->rx_discard_cnt),
+              (char*) &(pStats->rx_discard_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_ERROR_CNT,
+              (tANI_U8) sizeof (pStats->rx_error_cnt),
+              (char*) &(pStats->rx_error_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT,
+              (tANI_U8) sizeof (pStats->tx_byte_cnt),
+              (char*) &(pStats->tx_byte_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT,
+              (tANI_U8) sizeof (dStats->rx_byte_cnt),
+              (char*) &(dStats->rx_byte_cnt),
+              tlen);
+
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_RATE,
+              (tANI_U8) sizeof (dStats->rx_rate),
+              (char*) &(dStats->rx_rate),
+              tlen);
+
+    /* Transmit rate, in units of 500 kbit/sec */
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_RATE,
+              (tANI_U8) sizeof (aStats->tx_rate),
+              (char*) &(aStats->tx_rate),
+              tlen);
+
+    wrqu->data.length = tlen;
+
+  }
+
+  EXIT();
+
+  return 0;
+}
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+
+/*Max Len for PNO notification*/
+#define MAX_PNO_NOTIFY_LEN 100
+void found_pref_network_cb (void *callbackContext,
+                              tSirPrefNetworkFoundInd *pPrefNetworkFoundInd)
+{
+  hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext;
+  union iwreq_data wrqu;
+  char buf[MAX_PNO_NOTIFY_LEN+1];
+
+  hddLog(VOS_TRACE_LEVEL_WARN, "A preferred network was found: %s with rssi: -%d",
+         pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi);
+
+  // create the event
+  memset(&wrqu, 0, sizeof(wrqu));
+  memset(buf, 0, sizeof(buf));
+
+  snprintf(buf, MAX_PNO_NOTIFY_LEN, "QCOM: Found preferred network: %s with RSSI of -%u",
+           pPrefNetworkFoundInd->ssId.ssId,
+          (unsigned int)pPrefNetworkFoundInd->rssi);
+
+  wrqu.data.pointer = buf;
+  wrqu.data.length = strlen(buf);
+
+  // send the event
+
+  wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
+
+}
+
+
+/*string based input*/
+VOS_STATUS iw_set_pno(struct net_device *dev, struct iw_request_info *info,
+                      union iwreq_data *wrqu, char *extra, int nOffset)
+{
+  hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+  tSirPNOScanReq pnoRequest;
+  char *ptr;
+  v_U8_t i,j, ucParams, ucMode;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "PNO data len %d data %s",
+            wrqu->data.length,
+            wrqu->data.pointer);
+
+  if (wrqu->data.length <= nOffset )
+  {
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "PNO input is not correct");
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  pnoRequest.enable = 0;
+  pnoRequest.ucNetworksCount = 0;
+  /*-----------------------------------------------------------------------
+    Input is string based and expected to be like this:
+
+    <enabled> <netw_count>
+    for each network:
+    <ssid_len> <ssid> <authentication> <encryption>
+    <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
+    <scan_timers> <scan_time> <scan_repeat> <scan_time> <scan_repeat>
+
+    e.g:
+    1 2 4 test 0 0 3 1 6 11 2 40 5 test2 4 4 6 1 2 3 4 5 6 1 0 2 5 2 300 0 
+
+    this translates into:
+    -----------------------------
+    enable PNO
+    look for 2 networks:
+    test - with authentication type 0 and encryption type 0,
+    that can be found on 3 channels: 1 6 and 11 ,
+    SSID bcast type is unknown (directed probe will be sent if AP not found)
+    and must meet -40dBm RSSI
+
+    test2 - with auth and enrytption type 4/4
+    that can be found on 6 channels 1, 2, 3, 4, 5 and 6
+    bcast type is non-bcast (directed probe will be sent)
+    and must not meet any RSSI threshold
+
+    scan every 5 seconds 2 times, scan every 300 seconds until stopped 
+  -----------------------------------------------------------------------*/
+  ptr = (char*)(wrqu->data.pointer + nOffset);
+
+  sscanf(ptr,"%hhu%n", &(pnoRequest.enable), &nOffset);
+
+  if ( 0 == pnoRequest.enable )
+  {
+    /*Disable PNO*/
+    memset(&pnoRequest, 0, sizeof(pnoRequest));
+    sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest,
+                                pAdapter->sessionId,
+                                found_pref_network_cb, pAdapter);
+    return VOS_STATUS_SUCCESS;
+  }
+
+  ptr += nOffset;
+  sscanf(ptr,"%hhu %n", &(pnoRequest.ucNetworksCount), &nOffset);
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "PNO enable %d networks count %d offset %d",
+            pnoRequest.enable,
+            pnoRequest.ucNetworksCount,
+            nOffset);
+
+  /* Parameters checking:
+      ucNetworksCount has to be larger than 0*/
+  if (( 0 == pnoRequest.ucNetworksCount ) ||
+      ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS ))
+  {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Network input is not correct");
+      return VOS_STATUS_E_FAILURE;
+  }
+
+  ptr += nOffset;
+
+  for ( i = 0; i < pnoRequest.ucNetworksCount; i++ )
+  {
+
+    pnoRequest.aNetworks[i].ssId.length = 0;
+
+    sscanf(ptr,"%hhu %n",
+           &(pnoRequest.aNetworks[i].ssId.length), &nOffset);
+
+    if (( 0 == pnoRequest.aNetworks[i].ssId.length ) ||
+        ( pnoRequest.aNetworks[i].ssId.length > 32 ) )
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "SSID Len %d is not correct for network %d",
+                pnoRequest.aNetworks[i].ssId.length, i);
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    /*Advance to SSID*/
+    ptr += nOffset;
+
+    ucParams = sscanf(ptr,"%32s %lu %lu %hhu %n",
+           pnoRequest.aNetworks[i].ssId.ssId,
+           &(pnoRequest.aNetworks[i].authentication),
+           &(pnoRequest.aNetworks[i].encryption),
+           &(pnoRequest.aNetworks[i].ucChannelCount),
+           &nOffset);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "PNO len %d ssid %s auth %d encry %d channel count %d offset %d",
+            pnoRequest.aNetworks[i].ssId.length,
+            pnoRequest.aNetworks[i].ssId.ssId,
+            pnoRequest.aNetworks[i].authentication,
+            pnoRequest.aNetworks[i].encryption,
+            pnoRequest.aNetworks[i].ucChannelCount,
+            nOffset );
+
+    if ( 4 != ucParams )
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                "Incorrect cmd");
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    /*Advance to channel list*/
+    ptr += nOffset;
+
+    if ( SIR_PNO_MAX_NETW_CHANNELS < pnoRequest.aNetworks[i].ucChannelCount )
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                "Incorrect number of channels");
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    if ( 0 !=  pnoRequest.aNetworks[i].ucChannelCount)
+    {
+      for ( j = 0; j < pnoRequest.aNetworks[i].ucChannelCount; j++)
+      {
+        sscanf(ptr,"%hhu %n",
+              &(pnoRequest.aNetworks[i].aChannels[j]), &nOffset);
+        /*Advance to next channel number*/
+        ptr += nOffset;
+      }
+    }
+
+    sscanf(ptr,"%lu %n",
+              &(pnoRequest.aNetworks[i].bcastNetwType), &nOffset);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "PNO bcastNetwType %d offset %d",
+            pnoRequest.aNetworks[i].bcastNetwType,
+            nOffset );
+
+    /*Advance to rssi Threshold*/
+    ptr += nOffset;
+
+    sscanf(ptr,"%hhu %n",
+              &(pnoRequest.aNetworks[i].rssiThreshold), &nOffset);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "PNO rssi %d offset %d",
+            pnoRequest.aNetworks[i].rssiThreshold,
+            nOffset );
+    /*Advance to next network*/
+    ptr += nOffset;
+  }/*For ucNetworkCount*/
+
+  ucParams = sscanf(ptr,"%hhu %n",
+              &(pnoRequest.scanTimers.ucScanTimersCount), &nOffset);
+
+  /*Read the scan timers*/
+  if (( 1 == ucParams )&&(  pnoRequest.scanTimers.ucScanTimersCount >= 0 ))
+  {
+     ptr += nOffset;
+
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+        "Scan timer count %d offset %d", 
+        pnoRequest.scanTimers.ucScanTimersCount,
+        nOffset );
+
+     if ( SIR_PNO_MAX_SCAN_TIMERS < pnoRequest.scanTimers.ucScanTimersCount )
+     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                    "Incorrect cmd - too many scan timers");
+       return VOS_STATUS_E_FAILURE;
+     }
+
+     for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++ )
+     {
+        ucParams = sscanf(ptr,"%lu %lu %n",
+           &(pnoRequest.scanTimers.aTimerValues[i].uTimerValue),
+           &( pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat),
+           &nOffset);
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+            "PNO Timer value %d Timer repeat %d offset %d", 
+            pnoRequest.scanTimers.aTimerValues[i].uTimerValue, 
+            pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat,
+            nOffset );
+
+        if ( 2 != ucParams )
+        {
+          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                    "Incorrect cmd - diff params then expected %d", ucParams);
+          return VOS_STATUS_E_FAILURE;
+        }
+
+        ptr += nOffset;
+     }
+
+  }
+  else
+  {
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+       "No scan timers provided param count %d scan timers %d", 
+        ucParams,  pnoRequest.scanTimers.ucScanTimersCount );
+
+    /*Scan timers defaults to 5 minutes*/
+    pnoRequest.scanTimers.ucScanTimersCount = 1;
+    pnoRequest.scanTimers.aTimerValues[0].uTimerValue  = 60;
+    pnoRequest.scanTimers.aTimerValues[0].uTimerRepeat = 0;
+  }
+
+  ucParams = sscanf(ptr,"%hhu %n",
+              &(ucMode), &nOffset);
+
+  pnoRequest.modePNO = ucMode;
+  /*for LA we just expose suspend option*/
+  if (( 1 != ucParams )||(  ucMode >= SIR_PNO_MODE_MAX ))
+  {
+     pnoRequest.modePNO = SIR_PNO_MODE_ON_SUSPEND;
+  }
+
+  sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest,
+                                pAdapter->sessionId,
+                                found_pref_network_cb, pAdapter);
+
+  return VOS_STATUS_SUCCESS;
+}/*iw_set_pno*/
+
+VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra, int nOffset)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    v_U8_t rssiThreshold = 0;
+    v_U8_t nRead;
+
+    nRead = sscanf(wrqu->data.pointer + nOffset,"%hhu",
+           &rssiThreshold);
+
+    if ( 1 != nRead )
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                "Incorrect format");
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    sme_SetRSSIFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), rssiThreshold);
+    return VOS_STATUS_SUCCESS;
+}
+
+
+static int iw_set_pno_priv(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "Set PNO Private");
+  return iw_set_pno(dev,info,wrqu,extra,0);
+}
+#endif /*FEATURE_WLAN_SCAN_PNO*/
+
+//Common function to SetBand
+int hdd_setBand_helper(struct net_device *dev, tANI_U8* ptr)
+{
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    tANI_U8 band = 0;
+    eCsrBand currBand = eCSR_BAND_MAX;
+
+    band = ptr[WLAN_HDD_UI_SET_BAND_VALUE_OFFSET] - '0'; /*convert the band value from ascii to integer*/
+
+    switch(band)
+    {
+        case WLAN_HDD_UI_BAND_AUTO:
+             band = eCSR_BAND_ALL;
+        break;
+        case WLAN_HDD_UI_BAND_5_GHZ:
+            band = eCSR_BAND_5G;
+        break;
+        case WLAN_HDD_UI_BAND_2_4_GHZ:
+            band = eCSR_BAND_24;
+        break;
+        default:
+            band = eCSR_BAND_MAX;
+    }
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change band to %u",
+                __FUNCTION__, band);
+
+    if (band == eCSR_BAND_MAX)
+    {
+        /* Received change band request with invalid band value */
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "%s: Invalid band value %u", __FUNCTION__, band);
+        return -EIO;
+    }
+
+    if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand))
+    {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+              "%s: Failed to get current band config",
+                 __FUNCTION__);
+         return -EIO;
+    }
+
+    if (currBand != band)
+    {
+        /* Change band request received.
+         * Abort pending scan requests, flush the existing scan results,
+         * and change the band capability
+         */
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "%s: Current band value = %u, new setting %u ",
+                 __FUNCTION__, currBand, band);
+
+        if (hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)))
+        {
+             hdd_station_ctx_t *pHddStaCtx = &(pAdapter)->sessionCtx.station;
+             eHalStatus status = eHAL_STATUS_SUCCESS;
+             long lrc;
+
+             /* STA already connected on current band, So issue disconnect first,
+                        * then change the band*/
+
+             hddLog(VOS_TRACE_LEVEL_INFO,
+                     "%s STA connected in band %u, Changing band to %u, Issuing Disconnect",
+                        __func__, csrGetCurrentBand(hHal), band);
+
+             pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
+             INIT_COMPLETION(pAdapter->disconnect_comp_var);
+
+             status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
+             pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+
+             if ( VOS_STATUS_SUCCESS != status)
+             {
+                 hddLog(VOS_TRACE_LEVEL_ERROR,
+                         "%s csrRoamDisconnect failure, returned %d \n",
+                           __func__, (int)status );
+                 return -EINVAL;
+             }
+
+             lrc = wait_for_completion_interruptible_timeout(
+                     &pAdapter->disconnect_comp_var,
+                     msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+
+             if(lrc <= 0) {
+
+                hddLog(VOS_TRACE_LEVEL_ERROR,"%s: %s while while waiting for csrRoamDisconnect ",
+                 __FUNCTION__, (0 == lrc) ? "Timeout" : "Interrupt");
+
+                return (0 == lrc) ? -ETIMEDOUT : -EINTR;
+             }
+        }
+
+        hdd_abort_mac_scan(pHddCtx);
+        sme_ScanFlushResult(hHal, pAdapter->sessionId);
+        if(eHAL_STATUS_SUCCESS != sme_SetFreqBand(hHal, (eCsrBand)band))
+        {
+             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                     "%s: failed to set the band value to %u ",
+                        __FUNCTION__, band);
+             return -EINVAL;
+        }
+#ifdef CONFIG_CFG80211
+        wlan_hdd_cfg80211_update_band(pHddCtx->wiphy, (eCsrBand)band);
+#endif
+    }
+    return 0;
+}
+
+static int iw_set_band_config(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+    tANI_U8 *ptr = (tANI_U8*)wrqu->data.pointer;
+    int ret = 0;
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: ", __FUNCTION__);
+
+    if (memcmp(ptr, "SETBAND ", 8) == 0)
+    {
+        /* Change band request received */
+        ret = hdd_setBand_helper(dev, ptr);
+        return ret;
+
+    }
+    return 0;
+}
+
+static int iw_set_power_params_priv(struct net_device *dev,
+                           struct iw_request_info *info,
+                           union iwreq_data *wrqu, char *extra)
+{
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "Set power params Private");
+  return iw_set_power_params(dev,info,wrqu,extra,0);
+}
+
+
+
+/*string based input*/
+VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info,
+                      union iwreq_data *wrqu, char *extra, int nOffset)
+{
+  hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+  tSirSetPowerParamsReq powerRequest;
+  char *ptr;
+  v_U8_t  ucType;
+  v_U32_t  uTotalSize, uValue;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            "Power Params data len %d data %s",
+            wrqu->data.length,
+            wrqu->data.pointer);
+
+  if (wrqu->data.length <= nOffset )
+  {
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct");
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  uTotalSize = wrqu->data.length - nOffset;
+
+  /*-----------------------------------------------------------------------
+    Input is string based and expected to be like this:
+
+    <param_type> <param_value> <param_type> <param_value> ...
+
+    e.g:
+    1 2 2 3 3 0 4 1 5 1
+
+    e.g. setting just a few:
+    1 2 4 1
+
+    parameter types:
+    -----------------------------
+    1 - Ignore DTIM
+    2 - Listen Interval
+    3 - Broadcast Multicas Filter
+    4 - Beacon Early Termination
+    5 - Beacon Early Termination Interval
+  -----------------------------------------------------------------------*/
+  powerRequest.uIgnoreDTIM       = SIR_NOCHANGE_POWER_VALUE;
+  powerRequest.uListenInterval   = SIR_NOCHANGE_POWER_VALUE;
+  powerRequest.uBcastMcastFilter = SIR_NOCHANGE_POWER_VALUE;
+  powerRequest.uEnableBET        = SIR_NOCHANGE_POWER_VALUE;
+  powerRequest.uBETInterval      = SIR_NOCHANGE_POWER_VALUE;
+
+  ptr = (char*)(wrqu->data.pointer + nOffset);
+
+  while ( uTotalSize )
+  {
+    sscanf(ptr,"%hhu %n", &(ucType), &nOffset);
+
+    uTotalSize -= nOffset;
+
+    if (!uTotalSize)
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "Invalid input parametery type : %d with no value at offset %d",
+                ucType, nOffset);
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    ptr += nOffset;
+    sscanf(ptr,"%lu %n", &(uValue), &nOffset);
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+              "Power request parameter %d value %d offset %d",
+              ucType, uValue, nOffset);
+
+    switch (ucType)
+    {
+      case eSIR_IGNORE_DTIM:
+      powerRequest.uIgnoreDTIM       = uValue;
+      break;
+      case eSIR_LISTEN_INTERVAL:
+      powerRequest.uListenInterval   = uValue;
+      break;
+      case eSIR_MCAST_BCAST_FILTER:
+      powerRequest.uBcastMcastFilter = uValue;
+      break;
+      case eSIR_ENABLE_BET:
+      powerRequest.uEnableBET        = uValue;
+      break;
+      case eSIR_BET_INTERVAL:
+      powerRequest.uBETInterval      = uValue;
+      break;
+      default:
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "Invalid input parametery type : %d with value: %d at offset %d",
+                ucType, uValue,  nOffset);
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    uTotalSize -= nOffset;
+    ptr += nOffset;
+
+  }/*Go for as long as we have a valid string*/
+
+  /* put the device into full power*/
+  wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE);
+
+  /* Apply the power save params*/
+  sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest);
+
+  /* put the device back to power save*/
+  wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
+
+  return VOS_STATUS_SUCCESS;
+}/*iw_set_power_params*/
+
+
+// Define the Wireless Extensions to the Linux Network Device structure
+// A number of these routines are NULL (meaning they are not implemented.)
+
+static const iw_handler      we_handler[] =
+{
+   (iw_handler) iw_set_commit,      /* SIOCSIWCOMMIT */
+   (iw_handler) iw_get_name,      /* SIOCGIWNAME */
+   (iw_handler) NULL,            /* SIOCSIWNWID */
+   (iw_handler) NULL,            /* SIOCGIWNWID */
+   (iw_handler) iw_set_freq,      /* SIOCSIWFREQ */
+   (iw_handler) iw_get_freq,      /* SIOCGIWFREQ */
+   (iw_handler) iw_set_mode,      /* SIOCSIWMODE */
+   (iw_handler) iw_get_mode,      /* SIOCGIWMODE */
+   (iw_handler) NULL,              /* SIOCSIWSENS */
+   (iw_handler) NULL,              /* SIOCGIWSENS */
+   (iw_handler) NULL,             /* SIOCSIWRANGE */
+   (iw_handler) iw_get_range,      /* SIOCGIWRANGE */
+   (iw_handler) iw_set_priv,       /* SIOCSIWPRIV */
+   (iw_handler) NULL,             /* SIOCGIWPRIV */
+   (iw_handler) NULL,             /* SIOCSIWSTATS */
+   (iw_handler) NULL,             /* SIOCGIWSTATS */
+   iw_handler_set_spy,             /* SIOCSIWSPY */
+   iw_handler_get_spy,             /* SIOCGIWSPY */
+   iw_handler_set_thrspy,         /* SIOCSIWTHRSPY */
+   iw_handler_get_thrspy,         /* SIOCGIWTHRSPY */
+   (iw_handler) iw_set_ap_address,   /* SIOCSIWAP */
+   (iw_handler) iw_get_ap_address,   /* SIOCGIWAP */
+   (iw_handler) iw_set_mlme,              /* SIOCSIWMLME */
+   (iw_handler) NULL,              /* SIOCGIWAPLIST */
+   (iw_handler) iw_set_scan,      /* SIOCSIWSCAN */
+   (iw_handler) iw_get_scan,      /* SIOCGIWSCAN */
+   (iw_handler) iw_set_essid,      /* SIOCSIWESSID */
+   (iw_handler) iw_get_essid,      /* SIOCGIWESSID */
+   (iw_handler) iw_set_nick,      /* SIOCSIWNICKN */
+   (iw_handler) iw_get_nick,      /* SIOCGIWNICKN */
+   (iw_handler) NULL,             /* -- hole -- */
+   (iw_handler) NULL,             /* -- hole -- */
+   (iw_handler) iw_set_bitrate,   /* SIOCSIWRATE */
+   (iw_handler) iw_get_bitrate,   /* SIOCGIWRATE */
+   (iw_handler) iw_set_rts_threshold,/* SIOCSIWRTS */
+   (iw_handler) iw_get_rts_threshold,/* SIOCGIWRTS */
+   (iw_handler) iw_set_frag_threshold,   /* SIOCSIWFRAG */
+   (iw_handler) iw_get_frag_threshold,   /* SIOCGIWFRAG */
+   (iw_handler) iw_set_tx_power,      /* SIOCSIWTXPOW */
+   (iw_handler) iw_get_tx_power,      /* SIOCGIWTXPOW */
+   (iw_handler) iw_set_retry,          /* SIOCSIWRETRY */
+   (iw_handler) iw_get_retry,          /* SIOCGIWRETRY */
+   (iw_handler) iw_set_encode,          /* SIOCSIWENCODE */
+   (iw_handler) iw_get_encode,          /* SIOCGIWENCODE */
+   (iw_handler) iw_set_power_mode,      /* SIOCSIWPOWER */
+   (iw_handler) iw_get_power_mode,      /* SIOCGIWPOWER */
+   (iw_handler) NULL,                 /* -- hole -- */
+   (iw_handler) NULL,                /* -- hole -- */
+   (iw_handler) iw_set_genie,      /* SIOCSIWGENIE */
+   (iw_handler) iw_get_genie,      /* SIOCGIWGENIE */
+   (iw_handler) iw_set_auth,      /* SIOCSIWAUTH */
+   (iw_handler) iw_get_auth,      /* SIOCGIWAUTH */
+   (iw_handler) iw_set_encodeext,   /* SIOCSIWENCODEEXT */
+   (iw_handler) iw_get_encodeext,   /* SIOCGIWENCODEEXT */
+   (iw_handler) NULL,         /* SIOCSIWPMKSA */
+};
+
+static const iw_handler we_private[] = {
+
+   [WLAN_PRIV_SET_INT_GET_NONE      - SIOCIWFIRSTPRIV]   = iw_setint_getnone,  //set priv ioctl
+   [WLAN_PRIV_SET_NONE_GET_INT      - SIOCIWFIRSTPRIV]   = iw_setnone_getint,  //get priv ioctl
+   [WLAN_PRIV_SET_CHAR_GET_NONE     - SIOCIWFIRSTPRIV]   = iw_setchar_getnone, //get priv ioctl
+   [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV]  = iw_set_three_ints_getnone,
+   [WLAN_PRIV_GET_CHAR_SET_NONE      - SIOCIWFIRSTPRIV]  = iw_get_char_setnone,
+   [WLAN_PRIV_SET_NONE_GET_NONE     - SIOCIWFIRSTPRIV]   = iw_setnone_getnone, //action priv ioctl
+   [WLAN_PRIV_SET_VAR_INT_GET_NONE  - SIOCIWFIRSTPRIV]   = iw_set_var_ints_getnone,
+   [WLAN_PRIV_ADD_TSPEC             - SIOCIWFIRSTPRIV]   = iw_add_tspec,
+   [WLAN_PRIV_DEL_TSPEC             - SIOCIWFIRSTPRIV]   = iw_del_tspec,
+   [WLAN_PRIV_GET_TSPEC             - SIOCIWFIRSTPRIV]   = iw_get_tspec,
+
+#ifdef FEATURE_WLAN_WAPI
+   [WLAN_PRIV_SET_WAPI_MODE             - SIOCIWFIRSTPRIV]  = iw_qcom_set_wapi_mode,
+   [WLAN_PRIV_GET_WAPI_MODE             - SIOCIWFIRSTPRIV]  = iw_qcom_get_wapi_mode,
+   [WLAN_PRIV_SET_WAPI_ASSOC_INFO       - SIOCIWFIRSTPRIV]  = iw_qcom_set_wapi_assoc_info,
+   [WLAN_PRIV_SET_WAPI_KEY              - SIOCIWFIRSTPRIV]  = iw_qcom_set_wapi_key,
+   [WLAN_PRIV_SET_WAPI_BKID             - SIOCIWFIRSTPRIV]  = iw_qcom_set_wapi_bkid,
+   [WLAN_PRIV_GET_WAPI_BKID             - SIOCIWFIRSTPRIV]  = iw_qcom_get_wapi_bkid,
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   [WLAN_PRIV_SET_FTIES                 - SIOCIWFIRSTPRIV]   = iw_set_fties,
+#endif
+   [WLAN_PRIV_SET_HOST_OFFLOAD          - SIOCIWFIRSTPRIV]   = iw_set_host_offload,
+   [WLAN_GET_WLAN_STATISTICS            - SIOCIWFIRSTPRIV]   = iw_get_statistics,
+   [WLAN_SET_KEEPALIVE_PARAMS           - SIOCIWFIRSTPRIV]   = iw_set_keepalive_params
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+   ,
+   [WLAN_SET_PACKET_FILTER_PARAMS       - SIOCIWFIRSTPRIV]   = iw_set_packet_filter_params
+#endif
+#ifdef FEATURE_WLAN_SCAN_PNO
+   ,
+   [WLAN_SET_PNO                        - SIOCIWFIRSTPRIV]   = iw_set_pno_priv
+#endif
+   ,
+   [WLAN_SET_BAND_CONFIG                - SIOCIWFIRSTPRIV]   = iw_set_band_config,
+   [WLAN_PRIV_SET_MCBC_FILTER           - SIOCIWFIRSTPRIV]   = iw_set_dynamic_mcbc_filter,
+   [WLAN_PRIV_CLEAR_MCBC_FILTER         - SIOCIWFIRSTPRIV]   = iw_clear_dynamic_mcbc_filter,
+   [WLAN_SET_POWER_PARAMS               - SIOCIWFIRSTPRIV]   = iw_set_power_params_priv,
+   [WLAN_GET_LINK_SPEED                 - SIOCIWFIRSTPRIV]   = iw_get_linkspeed
+};
+
+/*Maximum command length can be only 15 */
+static const struct iw_priv_args we_private_args[] = {
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_SET_11D_STATE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "set11Dstate" },
+
+    {   WE_WOWL,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "wowl" },
+
+    {   WE_SET_POWER,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "setPower" },
+
+    {   WE_SET_MAX_ASSOC,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "setMaxAssoc" },
+
+    {   WE_SET_SAP_AUTO_CHANNEL_SELECTION,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "setAutoChannel" },
+
+    {   WE_SET_DATA_INACTIVITY_TO,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "inactivityTO" },
+
+    {   WE_SET_MAX_TX_POWER,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "setMaxTxPower" },
+    /* set Higher DTIM Transition (DTIM1 to DTIM3)
+     * 1 = enable and 0 = disable */
+    {
+        WE_SET_HIGHER_DTIM_TRANSITION,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "setHDtimTransn" },
+
+    {   WE_SET_TM_LEVEL,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0, 
+        "setTmLevel" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_NONE_GET_INT,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_GET_11D_STATE,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "get11Dstate" },
+
+    {   WE_IBSS_STATUS,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getAdhocStatus" },
+
+    {   WE_PMC_STATE,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "pmcState" },
+
+    {   WE_GET_WLAN_DBG,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getwlandbg" },
+
+    {   WE_MODULE_DOWN_IND,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "moduleDownInd" },
+
+    {   WE_GET_MAX_ASSOC,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getMaxAssoc" },
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    {   WE_GET_WDI_DBG,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getwdidbg" },
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+    {   WE_GET_SAP_AUTO_CHANNEL_SELECTION,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getAutoChannel" },
+
+    {   WE_GET_CONCURRENCY_MODE,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getconcurrency" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_CHAR_GET_NONE,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_WOWL_ADD_PTRN,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "wowlAddPtrn" },
+
+    {   WE_WOWL_DEL_PTRN,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "wowlDelPtrn" },
+
+#if defined WLAN_FEATURE_VOWIFI
+    /* handlers for sub-ioctl */
+    {   WE_NEIGHBOR_REPORT_REQUEST,
+        IW_PRIV_TYPE_CHAR | 512,
+        0,
+        "neighbor" },
+#endif
+    {   WE_SET_AP_WPS_IE,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "set_ap_wps_ie" },
+
+    {   WE_SET_CONFIG,
+        IW_PRIV_TYPE_CHAR| 512,
+        0,
+        "setConfig" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_THREE_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_SET_WLAN_DBG,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+        0,
+        "setwlandbg" },
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    {   WE_SET_WDI_DBG,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+        0,
+        "setwdidbg" },
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+
+    {   WE_SET_SAP_CHANNELS,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+        0,
+        "setsapchannels" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_GET_CHAR_SET_NONE,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_WLAN_VERSION,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "version" },
+    {   WE_GET_STATS,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "getStats" },
+    {   WE_GET_CFG,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "getConfig" },
+    {   WE_GET_WMM_STATUS,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "getWmmStatus" },
+    {
+        WE_GET_CHANNEL_LIST,
+        0, 
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "getChannelList" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_NONE_GET_NONE,
+        0,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_CLEAR_STATS,
+        0,
+        0,
+        "clearStats" },
+    {   WE_INIT_AP,
+        0,
+        0,
+        "initAP" },
+    {   WE_STOP_AP,
+        0,
+        0,
+        "exitAP" },
+    {   WE_ENABLE_AMP,
+        0,
+        0,
+        "enableAMP" },
+    {   WE_DISABLE_AMP,
+        0,
+        0,
+        "disableAMP" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_SET_VAR_INT_GET_NONE,
+        IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
+        0,
+        "" },
+
+    /* handlers for sub-ioctl */
+    {   WE_LOG_DUMP_CMD,
+        IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
+        0,
+        "dump" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_ADD_TSPEC,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "addTspec" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_DEL_TSPEC,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "delTspec" },
+
+    /* handlers for main ioctl */
+    {   WLAN_PRIV_GET_TSPEC,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "getTspec" },
+
+
+#ifdef FEATURE_WLAN_WAPI
+   /* handlers for main ioctl SET_WAPI_MODE */
+    {   WLAN_PRIV_SET_WAPI_MODE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "SET_WAPI_MODE" },
+
+   /* handlers for main ioctl GET_WAPI_MODE */
+    {   WLAN_PRIV_GET_WAPI_MODE,
+        0,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "GET_WAPI_MODE" },
+
+   /* handlers for main ioctl SET_ASSOC_INFO */
+    {   WLAN_PRIV_SET_WAPI_ASSOC_INFO,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 400,
+        0,
+        "SET_WAPI_ASSOC" },
+
+   /* handlers for main ioctl SET_WAPI_KEY */
+    {   WLAN_PRIV_SET_WAPI_KEY,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 71,
+        0,
+        "SET_WAPI_KEY" },
+
+   /* handlers for main ioctl SET_WAPI_BKID */
+    {   WLAN_PRIV_SET_WAPI_BKID,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 24,
+        0,
+        "SET_WAPI_BKID" },
+
+   /* handlers for main ioctl GET_WAPI_BKID */
+    {   WLAN_PRIV_GET_WAPI_BKID,
+        0,
+        IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 24,
+        "GET_WAPI_BKID" },
+#endif /* FEATURE_WLAN_WAPI */
+
+    /* handlers for main ioctl - host offload */
+    {
+        WLAN_PRIV_SET_HOST_OFFLOAD,
+        IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest),
+        0,
+        "setHostOffload" },
+
+    {
+        WLAN_GET_WLAN_STATISTICS,
+        0,
+        IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
+        "getWlanStats" },
+
+    {
+        WLAN_SET_KEEPALIVE_PARAMS,
+        IW_PRIV_TYPE_BYTE  | sizeof(tKeepAliveRequest),
+        0,
+        "setKeepAlive" },
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+    {
+        WLAN_SET_PACKET_FILTER_PARAMS,
+        IW_PRIV_TYPE_BYTE  | sizeof(tPacketFilterCfg),
+        0,
+        "setPktFilter" },
+#endif
+#ifdef FEATURE_WLAN_SCAN_PNO
+    {
+        WLAN_SET_PNO,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        0,
+        "setpno" },
+#endif
+    {
+        WLAN_SET_BAND_CONFIG,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        0,
+        "SETBAND" },
+    /* handlers for dynamic MC BC ioctl */
+    {
+        WLAN_PRIV_SET_MCBC_FILTER,
+        IW_PRIV_TYPE_BYTE | sizeof(tMcBcFilterCfg),
+        0,
+        "setMCBCFilter" },
+    {
+        WLAN_PRIV_CLEAR_MCBC_FILTER,
+        0,
+        0,
+        "clearMCBCFilter" },
+    {
+        WLAN_SET_POWER_PARAMS,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        0,
+        "setpowerparams" },
+    {
+        WLAN_GET_LINK_SPEED,
+        IW_PRIV_TYPE_CHAR | 18,
+        IW_PRIV_TYPE_CHAR | 3, "getLinkSpeed" },
+};
+
+
+
+const struct iw_handler_def we_handler_def = {
+   .num_standard     = sizeof(we_handler) / sizeof(we_handler[0]),
+   .num_private      = sizeof(we_private) / sizeof(we_private[0]),
+   .num_private_args = sizeof(we_private_args) / sizeof(we_private_args[0]),
+
+   .standard         = (iw_handler *)we_handler,
+   .private          = (iw_handler *)we_private,
+   .private_args     = we_private_args,
+   .get_wireless_stats = get_wireless_stats,
+};
+
+int hdd_set_wext(hdd_adapter_t *pAdapter)
+{
+    hdd_wext_state_t *pwextBuf;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+    // Now configure the roaming profile links. To SSID and bssid.
+    pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0;
+    pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID;
+
+    pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0;
+    pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId;
+
+    /*Set the numOfChannels to zero to scan all the channels*/
+    pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0;
+    pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL;
+
+    /* Default is no encryption */
+    pwextBuf->roamProfile.EncryptionType.numEntries = 1;
+    pwextBuf->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+
+    pwextBuf->roamProfile.mcEncryptionType.numEntries = 1;
+    pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+
+    pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+
+    /* Default is no authentication */
+    pwextBuf->roamProfile.AuthType.numEntries = 1;
+    pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+    pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_TAURUS;
+    pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
+
+    /*Set the default scan mode*/
+    pAdapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
+
+    hdd_clearRoamProfileIe(pAdapter);
+
+    return VOS_STATUS_SUCCESS;
+
+    }
+
+int hdd_register_wext(struct net_device *dev)
+    {
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    VOS_STATUS status;
+
+   ENTER();
+
+    // Zero the memory.  This zeros the profile structure.
+   memset(pwextBuf, 0,sizeof(hdd_wext_state_t));
+
+    init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->completion_var);
+
+
+    status = hdd_set_wext(pAdapter);
+
+    if(!VOS_IS_STATUS_SUCCESS(status)) {
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_wext failed!!\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->vosevent)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos event init failed!!\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->scanevent)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD scan event init failed!!\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    // Register as a wireless device
+    dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
+
+    EXIT();
+    return 0;
+}
+
+int hdd_UnregisterWext(struct net_device *dev)
+{
+#if 0
+   hdd_wext_state_t *wextBuf;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+   ENTER();
+   // Set up the pointer to the Wireless Extensions state structure
+   wextBuf = pAdapter->pWextState;
+
+   // De-allocate the Wireless Extensions state structure
+   kfree(wextBuf);
+
+   // Clear out the pointer to the Wireless Extensions state structure
+   pAdapter->pWextState = NULL;
+
+   EXIT();
+#endif
+   dev->wireless_handlers = NULL;
+   return 0;
+}
+
+
diff --git a/CORE/HDD/src/wlan_hdd_wmm.c b/CORE/HDD/src/wlan_hdd_wmm.c
new file mode 100644
index 0000000..c8da218
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_wmm.c
@@ -0,0 +1,2501 @@
+/*
+ * 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 wlan_hdd_wmm.c
+
+  This module (wlan_hdd_wmm.h interface + wlan_hdd_wmm.c implementation)
+  houses all the logic for WMM in HDD.
+
+  On the control path, it has the logic to setup QoS, modify QoS and delete
+  QoS (QoS here refers to a TSPEC). The setup QoS comes in two flavors: an
+  explicit application invoked and an internal HDD invoked.  The implicit QoS
+  is for applications that do NOT call the custom QCT WLAN OIDs for QoS but
+  which DO mark their traffic for priortization. It also has logic to start,
+  update and stop the U-APSD trigger frame generation. It also has logic to
+  read WMM related config parameters from the registry.
+
+  On the data path, it has the logic to figure out the WMM AC of an egress
+  packet and when to signal TL to serve a particular AC queue. It also has the
+  logic to retrieve a packet based on WMM priority in response to a fetch from
+  TL.
+
+  The remaining functions are utility functions for information hiding.
+
+
+               Copyright (c) 2008-9 QUALCOMM Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary
+============================================================================*/
+
+/*---------------------------------------------------------------------------
+  Include files
+  -------------------------------------------------------------------------*/
+#include <wlan_hdd_tx_rx.h>
+#include <wlan_hdd_dp_utils.h>
+#include <wlan_hdd_wmm.h>
+#include <wlan_hdd_ether.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/etherdevice.h>
+#include <linux/if_vlan.h>
+#include <linux/ip.h>
+#include <linux/semaphore.h>
+#include <wlan_hdd_hostapd.h>
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include <wlan_hdd_softap_tx_rx.h>
+#endif
+
+// change logging behavior based upon debug flag
+#ifdef HDD_WMM_DEBUG
+#define WMM_TRACE_LEVEL_FATAL      VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_ERROR      VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_WARN       VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_INFO       VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_INFO_HIGH  VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_INFO_LOW   VOS_TRACE_LEVEL_FATAL
+#else
+#define WMM_TRACE_LEVEL_FATAL      VOS_TRACE_LEVEL_FATAL
+#define WMM_TRACE_LEVEL_ERROR      VOS_TRACE_LEVEL_ERROR
+#define WMM_TRACE_LEVEL_WARN       VOS_TRACE_LEVEL_WARN
+#define WMM_TRACE_LEVEL_INFO       VOS_TRACE_LEVEL_INFO
+#define WMM_TRACE_LEVEL_INFO_HIGH  VOS_TRACE_LEVEL_INFO_HIGH
+#define WMM_TRACE_LEVEL_INFO_LOW   VOS_TRACE_LEVEL_INFO_LOW
+#endif
+
+
+// UAPSD Mask bits
+// (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored)
+#define HDD_AC_VO 0x1
+#define HDD_AC_VI 0x2
+#define HDD_AC_BK 0x4
+#define HDD_AC_BE 0x8
+
+#define WLAN_HDD_MAX_DSCP 0x3f
+
+static sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP+1];
+
+const v_U8_t hddWmmUpToAcMap[] = {
+   WLANTL_AC_BE,
+   WLANTL_AC_BK,
+   WLANTL_AC_BK,
+   WLANTL_AC_BE,
+   WLANTL_AC_VI,
+   WLANTL_AC_VI,
+   WLANTL_AC_VO,
+   WLANTL_AC_VO
+};
+
+//Linux based UP -> AC Mapping
+const v_U8_t hddLinuxUpToAcMap[8] = {
+   HDD_LINUX_AC_BE,
+   HDD_LINUX_AC_BK,
+   HDD_LINUX_AC_BK,
+   HDD_LINUX_AC_BE,
+   HDD_LINUX_AC_VI,
+   HDD_LINUX_AC_VI,
+   HDD_LINUX_AC_VO,
+   HDD_LINUX_AC_VO
+};
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+/**
+  @brief hdd_wmm_enable_tl_uapsd() - function which decides whether and
+  how to update UAPSD parameters in TL
+
+  @param pQosContext : [in] the pointer the QoS instance control block
+
+  @return
+  None
+*/
+static void hdd_wmm_enable_tl_uapsd (hdd_wmm_qos_context_t* pQosContext)
+{
+   hdd_adapter_t* pAdapter = pQosContext->pAdapter;
+   WLANTL_ACEnumType acType = pQosContext->acType;
+   hdd_wmm_ac_status_t *pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+   VOS_STATUS status;
+   v_U32_t service_interval;
+   v_U32_t suspension_interval;
+   sme_QosWmmDirType direction;
+
+
+   // The TSPEC must be valid
+   if (pAc->wmmAcTspecValid == VOS_FALSE)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Invoked with invalid TSPEC",
+                __FUNCTION__);
+      return;
+   }
+
+   // determine the service interval
+   if (pAc->wmmAcTspecInfo.min_service_interval)
+   {
+      service_interval = pAc->wmmAcTspecInfo.min_service_interval;
+   }
+   else if (pAc->wmmAcTspecInfo.max_service_interval)
+   {
+      service_interval = pAc->wmmAcTspecInfo.max_service_interval;
+   }
+   else
+   {
+      // no service interval is present in the TSPEC
+      // this is OK, there just won't be U-APSD
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: No service interval supplied",
+                __FUNCTION__);
+      return;
+   }
+
+   // determine the suspension interval & direction
+   suspension_interval = pAc->wmmAcTspecInfo.suspension_interval;
+   direction = pAc->wmmAcTspecInfo.ts_info.direction;
+
+   // if we have previously enabled U-APSD, have any params changed?
+   if ((pAc->wmmAcUapsdInfoValid) &&
+       (pAc->wmmAcUapsdServiceInterval == service_interval) &&
+       (pAc->wmmAcUapsdSuspensionInterval == suspension_interval) &&
+       (pAc->wmmAcUapsdDirection == direction))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: No change in U-APSD parameters",
+                __FUNCTION__);
+      return;
+   }
+
+   // are we in the appropriate power save modes?
+   if (!sme_IsPowerSaveEnabled(WLAN_HDD_GET_HAL_CTX(pAdapter), ePMC_BEACON_MODE_POWER_SAVE))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: BMPS is not enabled",
+                __FUNCTION__);
+      return;
+   }
+
+   if (!sme_IsPowerSaveEnabled(WLAN_HDD_GET_HAL_CTX(pAdapter), ePMC_UAPSD_MODE_POWER_SAVE))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: U-APSD is not enabled",
+                __FUNCTION__);
+      return;
+   }
+
+   // everything is in place to notify TL
+   status = WLANTL_EnableUAPSDForAC((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                    (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                    acType,
+                                    pAc->wmmAcTspecInfo.ts_info.tid,
+                                    pAc->wmmAcTspecInfo.ts_info.up,
+                                    service_interval,
+                                    suspension_interval,
+                                    direction);
+
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: Failed to enable U-APSD for AC=%d",
+                 __FUNCTION__, acType );
+      return;
+   }
+
+   // stash away the parameters that were used
+   pAc->wmmAcUapsdInfoValid = VOS_TRUE;
+   pAc->wmmAcUapsdServiceInterval = service_interval;
+   pAc->wmmAcUapsdSuspensionInterval = suspension_interval;
+   pAc->wmmAcUapsdDirection = direction;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: Enabled UAPSD in TL srv_int=%ld "
+             "susp_int=%ld dir=%d AC=%d",
+             __FUNCTION__,
+             service_interval,
+             suspension_interval,
+             direction,
+             acType);
+
+}
+
+/**
+  @brief hdd_wmm_disable_tl_uapsd() - function which decides whether
+  to disable UAPSD parameters in TL
+
+  @param pQosContext : [in] the pointer the QoS instance control block
+
+  @return
+  None
+*/
+static void hdd_wmm_disable_tl_uapsd (hdd_wmm_qos_context_t* pQosContext)
+{
+   hdd_adapter_t* pAdapter = pQosContext->pAdapter;
+   WLANTL_ACEnumType acType = pQosContext->acType;
+   hdd_wmm_ac_status_t *pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+   VOS_STATUS status;
+
+
+   // have we previously enabled UAPSD?
+   if (pAc->wmmAcUapsdInfoValid == VOS_TRUE)
+   {
+      status = WLANTL_DisableUAPSDForAC((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType);
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                    "%s: Failed to disable U-APSD for AC=%d",
+                    __FUNCTION__, acType );
+      }
+      else
+      {
+         // TL no longer has valid UAPSD info
+         pAc->wmmAcUapsdInfoValid = VOS_FALSE;
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Disabled UAPSD in TL for AC=%d",
+                   __FUNCTION__,
+                   acType);
+      }
+   }
+}
+
+#endif
+
+/**
+  @brief hdd_wmm_free_context() - function which frees a QoS context
+
+  @param pQosContext : [in] the pointer the QoS instance control block
+
+  @return
+  None
+*/
+static void hdd_wmm_free_context (hdd_wmm_qos_context_t* pQosContext)
+{
+   hdd_adapter_t* pAdapter;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered, context %p",
+             __FUNCTION__, pQosContext);
+
+   if (unlikely((NULL == pQosContext) ||
+                (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
+   {
+      // must have been freed in another thread
+      return;
+   }
+
+   // get pointer to the adapter context
+   pAdapter = pQosContext->pAdapter;
+
+   // take the wmmLock since we're manipulating the context list
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+
+   // make sure nobody thinks this is a valid context
+   pQosContext->magic = 0;
+
+   // unlink the context
+   list_del(&pQosContext->node);
+
+   // done manipulating the list
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+
+   // reclaim memory
+   kfree(pQosContext);
+
+}
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+/**
+  @brief hdd_wmm_notify_app() - function which notifies an application
+                                changes in state of it flow
+
+  @param pQosContext : [in] the pointer the QoS instance control block
+
+  @return
+  None
+*/
+#define MAX_NOTIFY_LEN 50
+static void hdd_wmm_notify_app (hdd_wmm_qos_context_t* pQosContext)
+{
+   hdd_adapter_t* pAdapter;
+   union iwreq_data wrqu;
+   char buf[MAX_NOTIFY_LEN+1];
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered, context %p",
+             __FUNCTION__, pQosContext);
+
+   if (unlikely((NULL == pQosContext) ||
+                (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Invalid QoS Context",
+                __FUNCTION__);
+      return;
+   }
+
+
+   // create the event
+   memset(&wrqu, 0, sizeof(wrqu));
+   memset(buf, 0, sizeof(buf));
+
+   snprintf(buf, MAX_NOTIFY_LEN, "QCOM: TS change[%u: %u]",
+            (unsigned int)pQosContext->handle,
+            (unsigned int)pQosContext->lastStatus);
+
+   wrqu.data.pointer = buf;
+   wrqu.data.length = strlen(buf);
+
+   // get pointer to the adapter
+   pAdapter = pQosContext->pAdapter;
+
+   // send the event
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: Sending [%s]", __FUNCTION__, buf);
+   wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
+}
+
+
+/**
+  @brief hdd_wmm_is_access_allowed() - function which determines if access
+  is allowed for the given AC.  this is designed to be called during SME
+  callback processing since that is when access can be granted or removed
+
+  @param pAdapter    : [in] pointer to adapter context
+  @param pAc         : [in] pointer to the per-AC status
+
+  @return            : VOS_TRUE - access is allowed
+                     : VOS_FALSE - access is not allowed
+  None
+*/
+static v_BOOL_t hdd_wmm_is_access_allowed(hdd_adapter_t* pAdapter,
+                                          hdd_wmm_ac_status_t* pAc)
+{
+   // if we don't want QoS or the AP doesn't support QoS
+   // or we don't want to do implicit QoS
+   // or if AP doesn't require admission for this AC
+   // then we have access
+   if (!hdd_wmm_is_active(pAdapter) ||
+       !(WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->bImplicitQosEnabled ||
+       !pAc->wmmAcAccessRequired)
+   {
+      return VOS_TRUE;
+   }
+
+   // if implicit QoS has already completed, successfully or not,
+   // then access is allowed
+   if (pAc->wmmAcAccessGranted || pAc->wmmAcAccessFailed)
+   {
+      return VOS_TRUE;
+   }
+
+   // admission is required and implicit QoS hasn't completed
+   // however explicit QoS may have completed and we'll have
+   // a Tspec
+   // if we don't have a Tspec then access is not allowed
+   if (!pAc->wmmAcTspecValid)
+   {
+      return VOS_FALSE;
+   }
+
+   // we have a Tspec -- does it allow upstream or bidirectional traffic?
+   // if it only allows downstream traffic then access is not allowed
+   if (pAc->wmmAcTspecInfo.ts_info.direction == SME_QOS_WMM_TS_DIR_DOWNLINK)
+   {
+      return VOS_FALSE;
+   }
+
+   // we meet all of the criteria for access
+   return VOS_TRUE;
+}
+
+#ifdef FEATURE_WLAN_CCX
+/**
+  @brief hdd_wmm_inactivity_timer_cb() - timer handler function which is
+  called for every inactivity interval per AC. This function gets the
+  current transmitted packets on the given AC, and checks if there where
+  any TX activity from the previous interval. If there was no traffic
+  then it would delete the TS that was negotiated on that AC.
+
+  @param pUserData   : [in] pointer to pQosContext
+
+  @return            : NONE
+*/
+void hdd_wmm_inactivity_timer_cb( v_PVOID_t pUserData )
+{
+    hdd_wmm_qos_context_t* pQosContext = (hdd_wmm_qos_context_t*)pUserData;
+    hdd_adapter_t* pAdapter;
+    hdd_wmm_ac_status_t *pAc;
+    hdd_wlan_wmm_status_e status;
+    VOS_STATUS vos_status;
+    v_U32_t currentTrafficCnt = 0;
+    WLANTL_ACEnumType acType = pQosContext->acType;
+
+    pAdapter = pQosContext->pAdapter;
+    pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+
+    // Get the Tx stats for this AC.
+    currentTrafficCnt = pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[pQosContext->acType];
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+            FL("WMM inactivity Timer for AC=%d, currentCnt=%d, prevCnt=%d\n"),
+            acType, (int)currentTrafficCnt, (int)pAc->wmmPrevTrafficCnt);
+    if (pAc->wmmPrevTrafficCnt == currentTrafficCnt)
+    {
+        // If there is no traffic activity, delete the TSPEC for this AC
+        status = hdd_wmm_delts(pAdapter, pQosContext->handle);
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                FL("Deleted TS on AC %d, due to inactivity with status = %d!!!"),
+                acType, status);
+    }
+    else
+    {
+        pAc->wmmPrevTrafficCnt = currentTrafficCnt;
+        if (pAc->wmmInactivityTimer.state == VOS_TIMER_STATE_STOPPED)
+        {
+            // Restart the timer
+            vos_status = vos_timer_start(&pAc->wmmInactivityTimer, pAc->wmmInactivityTime);
+            if (!VOS_IS_STATUS_SUCCESS(vos_status))
+            {
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                        FL("Restarting inactivity timer failed on AC %d"), acType);
+            }
+        }
+        else
+        {
+            VOS_ASSERT(vos_timer_getCurrentState(
+                        &pAc->wmmInactivityTimer) == VOS_TIMER_STATE_STOPPED);
+        }
+    }
+
+    return;
+}
+
+
+/**
+  @brief hdd_wmm_enable_inactivity_timer() - function to enable the
+  traffic inactivity timer for the given AC, if the inactivity_interval
+  specified in the ADDTS parameters is non-zero
+
+  @param pQosContext   : [in] pointer to pQosContext
+  @param inactivityTime: [in] value of the inactivity interval in millisecs
+
+  @return              : VOS_STATUS_E_FAILURE
+                         VOS_STATUS_SUCCESS
+*/
+VOS_STATUS hdd_wmm_enable_inactivity_timer(hdd_wmm_qos_context_t* pQosContext, v_U32_t inactivityTime)
+{
+    VOS_STATUS vos_status = VOS_STATUS_E_FAILURE;
+    hdd_adapter_t* pAdapter = pQosContext->pAdapter;
+    WLANTL_ACEnumType acType = pQosContext->acType;
+    hdd_wmm_ac_status_t *pAc;
+
+    pAdapter = pQosContext->pAdapter;
+    pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+
+
+    // If QoS-Tspec is successfully setup and if the inactivity timer is non-zero,
+    // a traffic inactivity timer needs to be started for the given AC
+    vos_status = vos_timer_init(
+            &pAc->wmmInactivityTimer,
+            VOS_TIMER_TYPE_SW,
+            hdd_wmm_inactivity_timer_cb,
+            (v_PVOID_t)pQosContext );
+    if ( !VOS_IS_STATUS_SUCCESS(vos_status))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                FL("Initializing inactivity timer failed on AC %d"), acType);
+        return vos_status;
+    }
+
+    // Start the inactivity timer
+    vos_status = vos_timer_start(
+            &pAc->wmmInactivityTimer,
+            inactivityTime);
+    if ( !VOS_IS_STATUS_SUCCESS(vos_status))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                FL("Starting inactivity timer failed on AC %d"), acType);
+        return vos_status;
+    }
+    pAc->wmmInactivityTime = inactivityTime;
+    // Initialize the current tx traffic count on this AC
+    pAc->wmmPrevTrafficCnt = pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[pQosContext->acType];
+
+    return vos_status;
+}
+
+/**
+  @brief hdd_wmm_enable_inactivity_timer() - function to disable the
+  traffic inactivity timer for the given AC. This would be called when
+  deleting the TS.
+
+  @param pQosContext   : [in] pointer to pQosContext
+
+  @return              : VOS_STATUS_E_FAILURE
+                         VOS_STATUS_SUCCESS
+*/
+VOS_STATUS hdd_wmm_disable_inactivity_timer(hdd_wmm_qos_context_t* pQosContext)
+{
+    hdd_adapter_t* pAdapter = pQosContext->pAdapter;
+    WLANTL_ACEnumType acType = pQosContext->acType;
+    hdd_wmm_ac_status_t *pAc  = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+    VOS_STATUS vos_status = VOS_STATUS_E_FAILURE;
+
+    // Clear the timer and the counter
+    pAc->wmmInactivityTime = 0;
+    pAc->wmmPrevTrafficCnt = 0;
+    vos_timer_stop(&pAc->wmmInactivityTimer);
+    vos_status = vos_timer_destroy(&pAc->wmmInactivityTimer);
+
+    return vos_status;
+}
+#endif // FEATURE_WLAN_CCX
+
+/**
+  @brief hdd_wmm_sme_callback() - callback registered by HDD with SME for receiving
+  QoS notifications. Even though this function has a static scope it gets called
+  externally through some function pointer magic (so there is a need for
+  rigorous parameter checking)
+
+  @param hHal : [in] the HAL handle
+  @param HddCtx : [in] the HDD specified handle
+  @param pCurrentQosInfo : [in] the TSPEC params
+  @param SmeStatus : [in] the QoS related SME status
+
+  @return
+  eHAL_STATUS_SUCCESS if all good, eHAL_STATUS_FAILURE otherwise
+*/
+static eHalStatus hdd_wmm_sme_callback (tHalHandle hHal,
+                                        void * hddCtx,
+                                        sme_QosWmmTspecInfo* pCurrentQosInfo,
+                                        sme_QosStatusType smeStatus,
+                                        v_U32_t qosFlowId)
+{
+   hdd_wmm_qos_context_t* pQosContext = hddCtx;
+   hdd_adapter_t* pAdapter;
+   WLANTL_ACEnumType acType;
+   hdd_wmm_ac_status_t *pAc;
+   VOS_STATUS status;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered, context %p",
+             __FUNCTION__, pQosContext);
+
+   if (unlikely((NULL == pQosContext) ||
+                (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Invalid QoS Context",
+                __FUNCTION__);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   pAdapter = pQosContext->pAdapter;
+   acType = pQosContext->acType;
+   pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: status %d flowid %d info %p",
+             __FUNCTION__, smeStatus, qosFlowId, pCurrentQosInfo);
+
+   switch (smeStatus)
+   {
+
+   case SME_QOS_STATUS_SETUP_SUCCESS_IND:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Setup is complete",
+                __FUNCTION__);
+
+      // there will always be a TSPEC returned with this status, even if
+      // a TSPEC is not exchanged OTA
+      if (pCurrentQosInfo)
+      {
+         pAc->wmmAcTspecValid = VOS_TRUE;
+         memcpy(&pAc->wmmAcTspecInfo,
+                pCurrentQosInfo,
+                sizeof(pAc->wmmAcTspecInfo));
+      }
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL for TL AC %d",
+                   __FUNCTION__, acType);
+
+         // this was triggered by implicit QoS so we know packets are pending
+         // update state
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+         pAc->wmmAcAccessGranted = VOS_TRUE;
+         pAc->wmmAcAccessPending = VOS_FALSE;
+
+         // notify TL that packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+#ifdef FEATURE_WLAN_CCX
+      // Check if the inactivity interval is specified
+      if (pCurrentQosInfo->inactivity_interval) {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                 "%s: Inactivity timer value = %d for AC=%d\n",
+                 __FUNCTION__, pCurrentQosInfo->inactivity_interval, acType);
+         hdd_wmm_enable_inactivity_timer(pQosContext, pCurrentQosInfo->inactivity_interval);
+      }
+#endif // FEATURE_WLAN_CCX
+
+      // notify TL to enable trigger frames if necessary
+      hdd_wmm_enable_tl_uapsd(pQosContext);
+
+      break;
+
+   case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: Setup is complete (U-APSD set previously)",
+                __FUNCTION__);
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL",
+                   __FUNCTION__);
+
+         // this was triggered by implicit QoS so we know packets are pending
+         // update state
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+         pAc->wmmAcAccessGranted = VOS_TRUE;
+         pAc->wmmAcAccessPending = VOS_FALSE;
+
+         // notify TL that packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      break;
+
+   case SME_QOS_STATUS_SETUP_FAILURE_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Setup failed",
+                __FUNCTION__);
+      // QoS setup failed
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL",
+                   __FUNCTION__);
+
+         // we note the failure, but we also mark access as allowed so that
+         // the packets will flow.  Note that the MAC will "do the right thing"
+         pAc->wmmAcAccessPending = VOS_FALSE;
+         pAc->wmmAcAccessFailed = VOS_TRUE;
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+
+         // this was triggered by implicit QoS so we know packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      /* Setting up QoS Failed, QoS context can be released.
+       * SME is releasing this flow information and if HDD doen't release this context,
+       * next time if application uses the same handle to set-up QoS, HDD (as it has
+       * QoS context for this handle) will issue Modify QoS request to SME but SME will
+       * reject as no it has no information for this flow.
+       */
+      hdd_wmm_free_context(pQosContext);
+      break;
+
+   case SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Setup Invalid Params, notify TL",
+                __FUNCTION__);
+      // QoS setup failed
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL",
+                   __FUNCTION__);
+
+         // we note the failure, but we also mark access as allowed so that
+         // the packets will flow.  Note that the MAC will "do the right thing"
+         pAc->wmmAcAccessPending = VOS_FALSE;
+         pAc->wmmAcAccessFailed = VOS_TRUE;
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+
+         // this was triggered by implicit QoS so we know packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP:
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: Setup failed, not a QoS AP\n",
+                 __FUNCTION__);
+      if (!HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: Setup pending",
+                __FUNCTION__);
+      // not a callback status -- ignore if we get it
+      break;
+
+   case SME_QOS_STATUS_SETUP_MODIFIED_IND:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: Setup modified",
+                __FUNCTION__);
+      if (pCurrentQosInfo)
+      {
+         // update the TSPEC
+         pAc->wmmAcTspecValid = VOS_TRUE;
+         memcpy(&pAc->wmmAcTspecInfo,
+                pCurrentQosInfo,
+                sizeof(pAc->wmmAcTspecInfo));
+
+         if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+         {
+            VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                      "%s: Explicit Qos, notifying userspace",
+                      __FUNCTION__);
+
+            // this was triggered by an application
+            pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFIED;
+            hdd_wmm_notify_app(pQosContext);
+         }
+
+         // need to tell TL to update its UAPSD handling
+         hdd_wmm_enable_tl_uapsd(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP:
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL",
+                   __FUNCTION__);
+
+         // this was triggered by implicit QoS so we know packets are pending
+         pAc->wmmAcAccessPending = VOS_FALSE;
+         pAc->wmmAcAccessGranted = VOS_TRUE;
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+
+         // notify TL that packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING:
+      // nothing to do for now
+      break;
+
+   case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Setup successful but U-APSD failed",
+                __FUNCTION__);
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Implicit Qos, notifying TL",
+                   __FUNCTION__);
+
+         // QoS setup was successful but setting U=APSD failed
+         // Since the OTA part of the request was successful, we don't mark
+         // this as a failure.
+         // the packets will flow.  Note that the MAC will "do the right thing"
+         pAc->wmmAcAccessGranted = VOS_TRUE;
+         pAc->wmmAcAccessAllowed = VOS_TRUE;
+         pAc->wmmAcAccessFailed = VOS_FALSE;
+         pAc->wmmAcAccessPending = VOS_FALSE;
+
+         // this was triggered by implicit QoS so we know packets are pending
+         status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        acType );
+
+         if ( !VOS_IS_STATUS_SUCCESS( status ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                       "%s: Failed to signal TL for AC=%d",
+                       __FUNCTION__, acType );
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_SETUP_UAPSD_SET_FAILED;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      // Since U-APSD portion failed disabled trigger frame generation
+      hdd_wmm_disable_tl_uapsd(pQosContext);
+
+      break;
+
+   case SME_QOS_STATUS_RELEASE_SUCCESS_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: Release is complete",
+                __FUNCTION__);
+
+      if (pCurrentQosInfo)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: flows still active",
+                   __FUNCTION__);
+
+         // there is still at least one flow active for this AC
+         // so update the AC state
+         memcpy(&pAc->wmmAcTspecInfo,
+                pCurrentQosInfo,
+                sizeof(pAc->wmmAcTspecInfo));
+
+         // need to tell TL to update its UAPSD handling
+         hdd_wmm_enable_tl_uapsd(pQosContext);
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: last flow",
+                   __FUNCTION__);
+
+         // this is the last flow active for this AC so update the AC state
+         pAc->wmmAcTspecValid = VOS_FALSE;
+
+         // need to tell TL to update its UAPSD handling
+         hdd_wmm_disable_tl_uapsd(pQosContext);
+      }
+
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      // we are done with this flow
+      hdd_wmm_free_context(pQosContext);
+      break;
+
+   case SME_QOS_STATUS_RELEASE_FAILURE_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: Release failure",
+                __FUNCTION__);
+
+      // we don't need to update our state or TL since nothing has changed
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_RELEASE_FAILED;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      break;
+
+   case SME_QOS_STATUS_RELEASE_QOS_LOST_IND:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: QOS Lost indication received",
+                __FUNCTION__);
+
+      // current TSPEC is no longer valid
+      pAc->wmmAcTspecValid = VOS_FALSE;
+
+      // need to tell TL to update its UAPSD handling
+      hdd_wmm_disable_tl_uapsd(pQosContext);
+
+      if (HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
+      {
+         // we no longer have implicit access granted
+         pAc->wmmAcAccessGranted = VOS_FALSE;
+         pAc->wmmAcAccessFailed = VOS_FALSE;
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: Explicit Qos, notifying userspace",
+                   __FUNCTION__);
+
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_LOST;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      // we are done with this flow
+      hdd_wmm_free_context(pQosContext);
+      break;
+
+   case SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Release pending",
+                __FUNCTION__);
+      // not a callback status -- ignore if we get it
+      break;
+
+   case SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Release Invalid Params",
+                __FUNCTION__);
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Modification is complete, notify TL",
+                __FUNCTION__);
+
+      // there will always be a TSPEC returned with this status, even if
+      // a TSPEC is not exchanged OTA
+      if (pCurrentQosInfo)
+      {
+         pAc->wmmAcTspecValid = VOS_TRUE;
+         memcpy(&pAc->wmmAcTspecInfo,
+                pCurrentQosInfo,
+                sizeof(pAc->wmmAcTspecInfo));
+      }
+
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      // notify TL to enable trigger frames if necessary
+      hdd_wmm_enable_tl_uapsd(pQosContext);
+
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY:
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP:
+      // the flow modification failed so we'll leave in place
+      // whatever existed beforehand
+
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_FAILED;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: modification pending",
+                __FUNCTION__);
+      // not a callback status -- ignore if we get it
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP:
+      // the flow modification was successful but no QoS changes required
+
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP:
+      // invalid params -- notify the application
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM;
+         hdd_wmm_notify_app(pQosContext);
+      }
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING:
+      // nothing to do for now.  when APSD is established we'll have work to do
+      break;
+
+   case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED:
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Modify successful but U-APSD failed",
+                __FUNCTION__);
+
+      // QoS modification was successful but setting U=APSD failed.
+      // This will always be an explicit QoS instance, so all we can
+      // do is notify the application and let it clean up.
+      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      {
+         // this was triggered by an application
+         pQosContext->lastStatus = HDD_WLAN_WMM_STATUS_MODIFY_UAPSD_SET_FAILED;
+         hdd_wmm_notify_app(pQosContext);
+      }
+
+      // Since U-APSD portion failed disabled trigger frame generation
+      hdd_wmm_disable_tl_uapsd(pQosContext);
+
+      break;
+
+   case SME_QOS_STATUS_HANDING_OFF:
+      // no roaming so we won't see this
+      break;
+
+   case SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND:
+      // need to tell TL to stop trigger frame generation
+      hdd_wmm_disable_tl_uapsd(pQosContext);
+      break;
+
+   case SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND:
+      // need to tell TL to start sending trigger frames again
+      hdd_wmm_enable_tl_uapsd(pQosContext);
+      break;
+
+   default:
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: unexpected SME Status=%d\n",
+                 __FUNCTION__, smeStatus );
+      VOS_ASSERT(0);
+   }
+
+   // our access to the particular access category may have changed.
+   // some of the implicit QoS cases above may have already set this
+   // prior to invoking TL (so that we will properly service the
+   // Tx queues) but let's consistently handle all cases here
+   pAc->wmmAcAccessAllowed = hdd_wmm_is_access_allowed(pAdapter, pAc);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: complete, access for TL AC %d is%sallowed",
+             __FUNCTION__,
+             acType,
+             pAc->wmmAcAccessAllowed ? " " : " not ");
+
+   return eHAL_STATUS_SUCCESS;
+}
+#endif
+
+/**============================================================================
+  @brief hdd_wmm_do_implicit_qos() - Function which will attempt to setup
+  QoS for any AC requiring it
+
+  @param work     : [in]  pointer to work structure
+
+  @return         : void
+  ===========================================================================*/
+static void hdd_wmm_do_implicit_qos(struct work_struct *work)
+{
+   hdd_wmm_qos_context_t* pQosContext =
+      container_of(work, hdd_wmm_qos_context_t, wmmAcSetupImplicitQos);
+   hdd_adapter_t* pAdapter;
+   WLANTL_ACEnumType acType;
+   hdd_wmm_ac_status_t *pAc;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   VOS_STATUS status;
+   sme_QosStatusType smeStatus;
+#endif
+   sme_QosWmmTspecInfo qosInfo;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered, context %p",
+             __FUNCTION__, pQosContext);
+
+   if (unlikely(HDD_WMM_CTX_MAGIC != pQosContext->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Invalid QoS Context",
+                __FUNCTION__);
+      return;
+   }
+
+   pAdapter = pQosContext->pAdapter;
+   acType = pQosContext->acType;
+   pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: pAdapter %p acType %d",
+             __FUNCTION__, pAdapter, acType);
+
+   if (!pAc->wmmAcAccessNeeded)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: AC %d doesn't need service",
+                __FUNCTION__, acType);
+      pQosContext->magic = 0;
+      kfree(pQosContext);
+      return;
+   }
+
+   pAc->wmmAcAccessPending = VOS_TRUE;
+   pAc->wmmAcAccessNeeded = VOS_FALSE;
+
+   memset(&qosInfo, 0, sizeof(qosInfo));
+
+   switch (acType)
+   {
+   case WLANTL_AC_VO:
+      qosInfo.ts_info.up = SME_QOS_WMM_UP_VO;
+      qosInfo.ts_info.psb = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask & 0x01;
+      qosInfo.ts_info.direction = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraDirAcVo;
+      qosInfo.ts_info.tid = 255;
+      qosInfo.mean_data_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMeanDataRateAcVo;
+      qosInfo.min_phy_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMinPhyRateAcVo;
+      qosInfo.min_service_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdVoSrvIntv;
+      qosInfo.nominal_msdu_size = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraNomMsduSizeAcVo;
+      qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcVo;
+      qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdVoSuspIntv;
+      break;
+   case WLANTL_AC_VI:
+      qosInfo.ts_info.up = SME_QOS_WMM_UP_VI;
+      qosInfo.ts_info.psb = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask & 0x02;
+      qosInfo.ts_info.direction = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraDirAcVi;
+      qosInfo.ts_info.tid = 255;
+      qosInfo.mean_data_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMeanDataRateAcVi;
+      qosInfo.min_phy_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMinPhyRateAcVi;
+      qosInfo.min_service_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSrvIntv;
+      qosInfo.nominal_msdu_size = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraNomMsduSizeAcVi;
+      qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcVi;
+      qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSuspIntv;
+      break;
+   default:
+   case WLANTL_AC_BE:
+      qosInfo.ts_info.up = SME_QOS_WMM_UP_BE;
+      qosInfo.ts_info.psb = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask & 0x08;
+      qosInfo.ts_info.direction = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraDirAcBe;
+      qosInfo.ts_info.tid = 255;
+      qosInfo.mean_data_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMeanDataRateAcBe;
+      qosInfo.min_phy_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMinPhyRateAcBe;
+      qosInfo.min_service_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBeSrvIntv;
+      qosInfo.nominal_msdu_size = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraNomMsduSizeAcBe;
+      qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcBe;
+      qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBeSuspIntv;
+      break;
+   case WLANTL_AC_BK:
+      qosInfo.ts_info.up = SME_QOS_WMM_UP_BK;
+      qosInfo.ts_info.psb = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask & 0x04;
+      qosInfo.ts_info.direction = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraDirAcBk;
+      qosInfo.ts_info.tid = 255;
+      qosInfo.mean_data_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMeanDataRateAcBk;
+      qosInfo.min_phy_rate = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraMinPhyRateAcBk;
+      qosInfo.min_service_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSrvIntv;
+      qosInfo.nominal_msdu_size = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraNomMsduSizeAcBk;
+      qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcBk;
+      qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSuspIntv;
+      break;
+   }
+#ifdef FEATURE_WLAN_CCX
+   qosInfo.inactivity_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraInactivityInterval;
+#endif
+   qosInfo.ts_info.burst_size_defn = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->burstSizeDefinition;
+
+   switch ((WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->tsInfoAckPolicy)
+   {
+     case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
+       qosInfo.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
+       break;
+
+     case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
+       qosInfo.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
+       break;
+
+     default:
+       // unknown
+       qosInfo.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
+   }
+
+   if(qosInfo.ts_info.ack_policy == SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK)
+   {
+     if(!sme_QosIsTSInfoAckPolicyValid((tpAniSirGlobal)WLAN_HDD_GET_HAL_CTX(pAdapter), &qosInfo, pAdapter->sessionId))
+     {
+       qosInfo.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
+     }
+   }
+
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+   list_add(&pQosContext->node, &pAdapter->hddWmmStatus.wmmContextList);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   smeStatus = sme_QosSetupReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                               pAdapter->sessionId,
+                               &qosInfo,
+                               hdd_wmm_sme_callback,
+                               pQosContext,
+                               qosInfo.ts_info.up,
+                               &pQosContext->qosFlowId);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: sme_QosSetupReq returned %d flowid %d",
+             __FUNCTION__, smeStatus, pQosContext->qosFlowId);
+
+   // need to check the return values and act appropriately
+   switch (smeStatus)
+   {
+   case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP:
+   case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING:
+      // setup is pending, so no more work to do now.
+      // all further work will be done in hdd_wmm_sme_callback()
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Setup is pending, no further work",
+                __FUNCTION__);
+
+      break;
+
+
+   case SME_QOS_STATUS_SETUP_FAILURE_RSP:
+      // we can't tell the difference between when a request fails because
+      // AP rejected it versus when SME encountered an internal error
+
+      // in either case SME won't ever reference this context so
+      // free the record
+      hdd_wmm_free_context(pQosContext);
+
+      // fall through and start packets flowing
+   case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP:
+      // no ACM in effect, no need to setup U-APSD
+   case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY:
+      // no ACM in effect, U-APSD is desired but was already setup
+
+      // for these cases everything is already setup so we can
+      // signal TL that it has work to do
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Setup is complete, notify TL",
+                __FUNCTION__);
+
+      pAc->wmmAcAccessAllowed = VOS_TRUE;
+      pAc->wmmAcAccessGranted = VOS_TRUE;
+      pAc->wmmAcAccessPending = VOS_FALSE;
+
+      status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                     (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                     acType );
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                    "%s: Failed to signal TL for AC=%d",
+                    __FUNCTION__, acType );
+      }
+
+      break;
+
+
+   default:
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: unexpected SME Status=%d\n",
+                 __FUNCTION__, smeStatus );
+      VOS_ASSERT(0);
+   }
+#endif
+
+}
+
+/**============================================================================
+  @brief hdd_wmm_init() - Function which will initialize the WMM configuation
+  and status to an initial state.  The configuration can later be overwritten
+  via application APIs
+
+  @param pHddCtx : [in]  pointer to HDD context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_init ( hdd_context_t* pHddCtx )
+{
+   v_U8_t dscp;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+
+   // DSCP to User Priority Lookup Table
+   for (dscp = 0; dscp <= WLAN_HDD_MAX_DSCP; dscp++)
+   {
+      hddWmmDscpToUpMap[dscp] = SME_QOS_WMM_UP_BE;
+   }
+   hddWmmDscpToUpMap[8]  = SME_QOS_WMM_UP_BK;
+   hddWmmDscpToUpMap[16] = SME_QOS_WMM_UP_RESV;
+   hddWmmDscpToUpMap[24] = SME_QOS_WMM_UP_EE;
+   hddWmmDscpToUpMap[32] = SME_QOS_WMM_UP_CL;
+   hddWmmDscpToUpMap[40] = SME_QOS_WMM_UP_VI;
+   hddWmmDscpToUpMap[48] = SME_QOS_WMM_UP_VO;
+   hddWmmDscpToUpMap[56] = SME_QOS_WMM_UP_NC;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**============================================================================
+  @brief hdd_wmm_adapter_init() - Function which will initialize the WMM configuation
+  and status to an initial state.  The configuration can later be overwritten
+  via application APIs
+
+  @param pAdapter : [in]  pointer to Adapter context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_adapter_init( hdd_adapter_t *pAdapter )
+{
+   hdd_wmm_ac_status_t *pAcStatus;
+   WLANTL_ACEnumType acType;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+
+   pAdapter->hddWmmStatus.wmmQap = VOS_FALSE;
+   INIT_LIST_HEAD(&pAdapter->hddWmmStatus.wmmContextList);
+   mutex_init(&pAdapter->hddWmmStatus.wmmLock);
+
+   for (acType = 0; acType < WLANTL_MAX_AC; acType++)
+   {
+      pAcStatus = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
+      pAcStatus->wmmAcAccessRequired = VOS_FALSE;
+      pAcStatus->wmmAcAccessNeeded = VOS_FALSE;
+      pAcStatus->wmmAcAccessPending = VOS_FALSE;
+      pAcStatus->wmmAcAccessFailed = VOS_FALSE;
+      pAcStatus->wmmAcAccessGranted = VOS_FALSE;
+      pAcStatus->wmmAcAccessAllowed = VOS_FALSE;
+      pAcStatus->wmmAcTspecValid = VOS_FALSE;
+      pAcStatus->wmmAcUapsdInfoValid = VOS_FALSE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+/**============================================================================
+  @brief hdd_wmm_close() - Function which will perform any necessary work to
+  to clean up the WMM functionality prior to the kernel module unload
+
+  @param pAdapter : [in]  pointer to adapter context
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_adapter_close ( hdd_adapter_t* pAdapter )
+{
+   hdd_wmm_qos_context_t* pQosContext;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+
+   // free any context records that we still have linked
+   while (!list_empty(&pAdapter->hddWmmStatus.wmmContextList))
+   {
+      pQosContext = list_first_entry(&pAdapter->hddWmmStatus.wmmContextList,
+                                     hdd_wmm_qos_context_t, node);
+#ifdef FEATURE_WLAN_CCX
+      hdd_wmm_disable_inactivity_timer(pQosContext);
+#endif
+      hdd_wmm_free_context(pQosContext);
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**============================================================================
+  @brief hdd_wmm_classify_pkt() - Function which will classify an OS packet
+  into a WMM AC based on either 802.1Q or DSCP
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param skb      : [in]  pointer to OS packet (sk_buff)
+  @param pAcType  : [out] pointer to WMM AC type of OS packet
+
+  @return         : None
+  ===========================================================================*/
+v_VOID_t hdd_wmm_classify_pkt ( hdd_adapter_t* pAdapter,
+                                struct sk_buff *skb,
+                                WLANTL_ACEnumType* pAcType,
+                                sme_QosWmmUpType *pUserPri)
+{
+   unsigned char * pPkt;
+   union generic_ethhdr *pHdr;
+   struct iphdr *pIpHdr;
+   unsigned char tos;
+   unsigned char dscp;
+   sme_QosWmmUpType userPri;
+   WLANTL_ACEnumType acType;
+
+   // this code is executed for every packet therefore
+   // all debug code is kept conditional
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+
+   pPkt = skb->data;
+   pHdr = (union generic_ethhdr *)pPkt;
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: proto/length is 0x%04x",
+             __FUNCTION__, pHdr->eth_II.h_proto);
+#endif // HDD_WMM_DEBUG
+
+   if (HDD_WMM_CLASSIFICATION_DSCP == (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->PktClassificationBasis)
+   {
+      if (pHdr->eth_II.h_proto == htons(ETH_P_IP))
+      {
+         // case 1: Ethernet II IP packet
+         pIpHdr = (struct iphdr *)&pPkt[sizeof(pHdr->eth_II)];
+         tos = pIpHdr->tos;
+#ifdef HDD_WMM_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: Ethernet II IP Packet, tos is %d",
+                   __FUNCTION__, tos);
+#endif // HDD_WMM_DEBUG
+
+      }
+      else if ((ntohs(pHdr->eth_II.h_proto) < WLAN_MIN_PROTO) &&
+               (pHdr->eth_8023.h_snap.dsap == WLAN_SNAP_DSAP) &&
+               (pHdr->eth_8023.h_snap.ssap == WLAN_SNAP_SSAP) &&
+               (pHdr->eth_8023.h_snap.ctrl == WLAN_SNAP_CTRL) &&
+               (pHdr->eth_8023.h_proto == htons(ETH_P_IP)))
+      {
+         // case 2: 802.3 LLC/SNAP IP packet
+         pIpHdr = (struct iphdr *)&pPkt[sizeof(pHdr->eth_8023)];
+         tos = pIpHdr->tos;
+#ifdef HDD_WMM_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: 802.3 LLC/SNAP IP Packet, tos is %d",
+                   __FUNCTION__, tos);
+#endif // HDD_WMM_DEBUG
+      }
+      else if (pHdr->eth_II.h_proto == htons(ETH_P_8021Q))
+      {
+         // VLAN tagged
+
+         if (pHdr->eth_IIv.h_vlan_encapsulated_proto == htons(ETH_P_IP))
+         {
+            // case 3: Ethernet II vlan-tagged IP packet
+            pIpHdr = (struct iphdr *)&pPkt[sizeof(pHdr->eth_IIv)];
+            tos = pIpHdr->tos;
+#ifdef HDD_WMM_DEBUG
+            VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                      "%s: Ethernet II VLAN tagged IP Packet, tos is %d",
+                      __FUNCTION__, tos);
+#endif // HDD_WMM_DEBUG
+         }
+         else if ((ntohs(pHdr->eth_IIv.h_vlan_encapsulated_proto) < WLAN_MIN_PROTO) &&
+                  (pHdr->eth_8023v.h_snap.dsap == WLAN_SNAP_DSAP) &&
+                  (pHdr->eth_8023v.h_snap.ssap == WLAN_SNAP_SSAP) &&
+                  (pHdr->eth_8023v.h_snap.ctrl == WLAN_SNAP_CTRL) &&
+                  (pHdr->eth_8023v.h_proto == htons(ETH_P_IP)))
+         {
+            // case 4: 802.3 LLC/SNAP vlan-tagged IP packet
+            pIpHdr = (struct iphdr *)&pPkt[sizeof(pHdr->eth_8023v)];
+            tos = pIpHdr->tos;
+#ifdef HDD_WMM_DEBUG
+            VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                      "%s: 802.3 LLC/SNAP VLAN tagged IP Packet, tos is %d",
+                      __FUNCTION__, tos);
+#endif // HDD_WMM_DEBUG
+         }
+         else
+         {
+            // default
+#ifdef HDD_WMM_DEBUG
+            VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
+                      "%s: VLAN tagged Unhandled Protocol, using default tos",
+                      __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+            tos = 0;
+         }
+      }
+      else
+      {
+          // default
+#ifdef HDD_WMM_DEBUG
+          VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
+                  "%s: Unhandled Protocol, using default tos",
+                  __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+          //Give the highest priority to 802.1x packet
+          if (pHdr->eth_II.h_proto == htons(HDD_ETHERTYPE_802_1_X))
+              tos = 0xC0;
+          else
+              tos = 0;
+      }
+
+      dscp = (tos>>2) & 0x3f;
+      userPri = hddWmmDscpToUpMap[dscp];
+
+#ifdef HDD_WMM_DEBUG
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                "%s: tos is %d, dscp is %d, up is %d",
+                __FUNCTION__, tos, dscp, userPri);
+#endif // HDD_WMM_DEBUG
+
+   }
+   else if (HDD_WMM_CLASSIFICATION_802_1Q == (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->PktClassificationBasis)
+   {
+      if (pHdr->eth_IIv.h_vlan_proto == htons(ETH_P_8021Q))
+      {
+         // VLAN tagged
+         userPri = (ntohs(pHdr->eth_IIv.h_vlan_TCI)>>13) & 0x7;
+#ifdef HDD_WMM_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+                   "%s: Tagged frame, UP is %d",
+                   __FUNCTION__, userPri);
+#endif // HDD_WMM_DEBUG
+      }
+      else
+      {
+          // not VLAN tagged, use default
+#ifdef HDD_WMM_DEBUG
+          VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
+                  "%s: Untagged frame, using default UP",
+                  __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+          //Give the highest priority to 802.1x packet
+          if (pHdr->eth_II.h_proto == htons(HDD_ETHERTYPE_802_1_X))
+              userPri = SME_QOS_WMM_UP_VO;
+          else
+              userPri = SME_QOS_WMM_UP_BE;
+      }
+   }
+   else
+   {
+      // default
+#ifdef HDD_WMM_DEBUG
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Unknown classification scheme, using default UP",
+                __FUNCTION__);
+#endif // HDD_WMM_DEBUG
+      userPri = SME_QOS_WMM_UP_BE;
+   }
+
+   acType = hddWmmUpToAcMap[userPri];
+
+#ifdef HDD_WMM_DEBUG
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: UP is %d, AC is %d",
+             __FUNCTION__, userPri, acType);
+#endif // HDD_WMM_DEBUG
+
+   *pUserPri = userPri;
+   *pAcType = acType;
+
+   return;
+}
+
+/**============================================================================
+  @brief hdd_hostapd_select_quueue() - Function which will classify the packet
+         according to linux qdisc expectation.
+
+
+  @param dev      : [in]  pointer to net_device structure
+  @param skb      : [in]  pointer to os packet
+
+  @return         : Qdisc queue index
+  ===========================================================================*/
+v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb)
+{
+   WLANTL_ACEnumType ac;
+   sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
+   v_USHORT_t queueIndex;
+   v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
+   hdd_adapter_t *pAdapter = (hdd_adapter_t *)netdev_priv(dev);
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   tpAniSirGlobal  pMac = (tpAniSirGlobal) vos_get_context(VOS_MODULE_ID_HAL, pHddCtx->pvosContext);
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+   v_U8_t STAId;
+   v_U8_t *pSTAId = (v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
+
+   /*Get the Station ID*/
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   if (eHAL_STATUS_SUCCESS != halTable_FindStaidByAddr(pMac, (tANI_U8 *)pDestMacAddress, &STAId))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to find right station", __FUNCTION__);
+      *pSTAId = HDD_WLAN_INVALID_STA_ID;
+      goto done;
+   }
+#else
+   if (VOS_STATUS_SUCCESS != hdd_softap_GetStaId(pAdapter, pDestMacAddress, &STAId))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to find right station", __FUNCTION__);
+      *pSTAId = HDD_WLAN_INVALID_STA_ID;
+      goto done;
+   }
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (FALSE == vos_is_macaddr_equal(&pAdapter->aStaInfo[STAId].macAddrSTA, pDestMacAddress))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Station MAC address does not matching", __FUNCTION__);
+
+      *pSTAId = HDD_WLAN_INVALID_STA_ID;
+      goto release_lock;
+   }
+   if (pAdapter->aStaInfo[STAId].isUsed && pAdapter->aStaInfo[STAId].isQosEnabled && (HDD_WMM_USER_MODE_NO_QOS != pHddCtx->cfg_ini->WmmMode))
+   {
+      /* Get the user priority from IP header & corresponding AC */
+      hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
+   }
+   *pSTAId = STAId;
+
+release_lock:
+    spin_unlock_bh( &pAdapter->staInfo_lock );
+done:
+   skb->priority = up;
+   queueIndex = hddLinuxUpToAcMap[skb->priority];
+
+   return queueIndex;
+}
+
+/**============================================================================
+  @brief hdd_wmm_select_quueue() - Function which will classify the packet
+         according to linux qdisc expectation.
+
+
+  @param dev      : [in]  pointer to net_device structure
+  @param skb      : [in]  pointer to os packet
+
+  @return         : Qdisc queue index
+  ===========================================================================*/
+v_U16_t hdd_wmm_select_queue(struct net_device * dev, struct sk_buff *skb)
+{
+   WLANTL_ACEnumType ac;
+   sme_QosWmmUpType up = 0;
+   v_USHORT_t queueIndex;
+
+   hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+
+   // if we don't want QoS or the AP doesn't support Qos
+   // All traffic will get equal opportuniy to transmit data frames.
+   if( hdd_wmm_is_active(pAdapter) ) {
+      /* Get the user priority from IP header & corresponding AC */
+      hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
+   }
+
+   skb->priority = up;
+   queueIndex = hddLinuxUpToAcMap[skb->priority];
+
+   return queueIndex;
+}
+
+/**============================================================================
+  @brief hdd_wmm_acquire_access() - Function which will attempt to acquire
+  admittance for a WMM AC
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param acType   : [in]  WMM AC type of OS packet
+  @param pGranted : [out] pointer to boolean flag when indicates if access
+                          has been granted or not
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_acquire_access( hdd_adapter_t* pAdapter,
+                                   WLANTL_ACEnumType acType,
+                                   v_BOOL_t * pGranted )
+{
+   hdd_wmm_qos_context_t *pQosContext;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered for AC %d", __FUNCTION__, acType);
+
+   if (!hdd_wmm_is_active(pAdapter) || !(WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->bImplicitQosEnabled)
+   {
+      // either we don't want QoS or the AP doesn't support QoS
+      // or we don't want to do implicit QoS
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: QoS not configured on both ends ", __FUNCTION__);
+
+      pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessAllowed = VOS_TRUE;
+      *pGranted = VOS_TRUE;
+      return VOS_STATUS_SUCCESS;
+   }
+
+   // do we already have an implicit QoS request pending for this AC?
+   if ((pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessNeeded) ||
+       (pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessPending))
+   {
+      // request already pending so we need to wait for that response
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Implicit QoS for TL AC %d already scheduled",
+                __FUNCTION__, acType);
+
+      *pGranted = VOS_FALSE;
+      return VOS_STATUS_SUCCESS;
+   }
+
+   // did we already fail to establish implicit QoS for this AC?
+   // (if so, access should have been granted when the failure was handled)
+   if (pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessFailed)
+   {
+      // request previously failed
+      // allow access, but we'll be downgraded
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Implicit QoS for TL AC %d previously failed",
+                __FUNCTION__, acType);
+
+      pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessAllowed = VOS_TRUE;
+      *pGranted = VOS_TRUE;
+      return VOS_STATUS_SUCCESS;
+   }
+
+   // we need to establish implicit QoS
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: Need to schedule implicit QoS for TL AC %d, pAdapter is %p",
+             __FUNCTION__, acType, pAdapter);
+
+   pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessNeeded = VOS_TRUE;
+
+   pQosContext = kmalloc(sizeof(*pQosContext), GFP_KERNEL);
+   if (NULL == pQosContext)
+   {
+      // no memory for QoS context.  Nothing we can do but let data flow
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Unable to allocate context", __FUNCTION__);
+      pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessAllowed = VOS_TRUE;
+      *pGranted = VOS_TRUE;
+      return VOS_STATUS_SUCCESS;
+   }
+
+   pQosContext->acType = acType;
+   pQosContext->pAdapter = pAdapter;
+   pQosContext->qosFlowId = 0;
+   pQosContext->handle = HDD_WMM_HANDLE_IMPLICIT;
+   pQosContext->magic = HDD_WMM_CTX_MAGIC;
+   INIT_WORK(&pQosContext->wmmAcSetupImplicitQos,
+             hdd_wmm_do_implicit_qos);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: Scheduling work for AC %d, context %p",
+             __FUNCTION__, acType, pQosContext);
+
+   schedule_work(&pQosContext->wmmAcSetupImplicitQos);
+
+   // caller will need to wait until the work takes place and
+   // TSPEC negotiation completes
+   *pGranted = VOS_FALSE;
+   return VOS_STATUS_SUCCESS;
+}
+
+/**============================================================================
+  @brief hdd_wmm_assoc() - Function which will handle the housekeeping
+  required by WMM when association takes place
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param pRoamInfo: [in]  pointer to roam information
+  @param eBssType : [in]  type of BSS
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_assoc( hdd_adapter_t* pAdapter,
+                          tCsrRoamInfo *pRoamInfo,
+                          eCsrRoamBssType eBssType )
+{
+   tANI_U8 uapsdMask;
+   VOS_STATUS status;
+
+   // when we associate we need to notify TL if it needs to enable
+   // UAPSD for any access categories
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+
+   if (pRoamInfo->fReassocReq)
+   {
+      // when we reassociate we should continue to use whatever
+      // parameters were previously established.  if we are
+      // reassociating due to a U-APSD change for a particular
+      // Access Category, then the change will be communicated
+      // to HDD via the QoS callback associated with the given
+      // flow, and U-APSD parameters will be updated there
+
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: Reassoc so no work, Exiting", __FUNCTION__);
+
+      return VOS_STATUS_SUCCESS;
+   }
+
+   // get the negotiated UAPSD Mask
+   uapsdMask = pRoamInfo->u.pConnectedProfile->modifyProfileFields.uapsd_mask;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: U-APSD mask is 0x%02x", __FUNCTION__, (int) uapsdMask);
+
+   if (uapsdMask & HDD_AC_VO)
+   {
+      status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        WLANTL_AC_VO,
+                                        7,
+                                        7,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdVoSrvIntv,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdVoSuspIntv,
+                                        WLANTL_BI_DIR );
+
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ));
+   }
+
+   if (uapsdMask & HDD_AC_VI)
+   {
+      status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        WLANTL_AC_VI,
+                                        5,
+                                        5,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSrvIntv,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSuspIntv,
+                                        WLANTL_BI_DIR );
+
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ));
+   }
+
+   if (uapsdMask & HDD_AC_BK)
+   {
+      status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        WLANTL_AC_BK,
+                                        2,
+                                        2,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSrvIntv,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSuspIntv,
+                                        WLANTL_BI_DIR );
+
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ));
+   }
+
+   if (uapsdMask & HDD_AC_BE)
+   {
+      status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
+                                        WLANTL_AC_BE,
+                                        3,
+                                        3,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBeSrvIntv,
+                                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBeSuspIntv,
+                                        WLANTL_BI_DIR );
+
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ));
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Exiting", __FUNCTION__);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+static const v_U8_t acmMaskBit[WLANTL_MAX_AC] =
+   {
+      0x4, /* WLANTL_AC_BK */
+      0x8, /* WLANTL_AC_BE */
+      0x2, /* WLANTL_AC_VI */
+      0x1  /* WLANTL_AC_VO */
+   };
+
+/**============================================================================
+  @brief hdd_wmm_connect() - Function which will handle the housekeeping
+  required by WMM when a connection is established
+
+  @param pAdapter : [in]  pointer to adapter context
+  @param pRoamInfo: [in]  pointer to roam information
+  @param eBssType : [in]  type of BSS
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_connect( hdd_adapter_t* pAdapter,
+                            tCsrRoamInfo *pRoamInfo,
+                            eCsrRoamBssType eBssType )
+{
+   int ac;
+   v_BOOL_t qap;
+   v_BOOL_t qosConnection;
+   v_U8_t acmMask;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered", __FUNCTION__);
+
+   if ((eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) &&
+       pRoamInfo &&
+       pRoamInfo->u.pConnectedProfile)
+   {
+      qap = pRoamInfo->u.pConnectedProfile->qap;
+      qosConnection = pRoamInfo->u.pConnectedProfile->qosConnection;
+      acmMask = pRoamInfo->u.pConnectedProfile->acm_mask;
+   }
+   else
+   {
+      qap = VOS_TRUE;
+      qosConnection = VOS_TRUE;
+      acmMask = 0x0;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: qap is %d, qosConnection is %d, acmMask is 0x%x",
+             __FUNCTION__, qap, qosConnection, acmMask);
+
+   pAdapter->hddWmmStatus.wmmQap = qap;
+   pAdapter->hddWmmStatus.wmmQosConnection = qosConnection;
+
+   for (ac = 0; ac < WLANTL_MAX_AC; ac++)
+   {
+      if (qap &&
+          qosConnection &&
+          (acmMask & acmMaskBit[ac]))
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: ac %d on",
+                   __FUNCTION__, ac);
+
+         // admission is required
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired = VOS_TRUE;
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed = VOS_FALSE;
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessGranted = VOS_FALSE;
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: ac %d off",
+                   __FUNCTION__, ac);
+         // admission is not required so access is allowed
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired = VOS_FALSE;
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed = VOS_TRUE;
+      }
+
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Exiting", __FUNCTION__);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**============================================================================
+  @brief hdd_wmm_get_uapsd_mask() - Function which will calculate the
+  initial value of the UAPSD mask based upon the device configuration
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param pUapsdMask: [in]  pointer to where the UAPSD Mask is to be stored
+
+  @return         : VOS_STATUS_SUCCESS if succssful
+                  : other values if failure
+  ===========================================================================*/
+VOS_STATUS hdd_wmm_get_uapsd_mask( hdd_adapter_t* pAdapter,
+                                   tANI_U8 *pUapsdMask )
+{
+   tANI_U8 uapsdMask;
+
+   if (HDD_WMM_USER_MODE_NO_QOS == (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode)
+   {
+      // no QOS then no UAPSD
+      uapsdMask = 0;
+   }
+   else
+   {
+      // start with the default mask
+      uapsdMask = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask;
+
+      // disable UAPSD for any ACs with a 0 Service Interval
+      if( (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdVoSrvIntv == 0 )
+      {
+         uapsdMask &= ~HDD_AC_VO;
+      }
+
+      if( (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSrvIntv == 0 )
+      {
+         uapsdMask &= ~HDD_AC_VI;
+      }
+
+      if( (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSrvIntv == 0 )
+      {
+         uapsdMask &= ~HDD_AC_BK;
+      }
+
+      if( (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBeSrvIntv == 0 )
+      {
+         uapsdMask &= ~HDD_AC_BE;
+      }
+   }
+
+   // return calculated mask
+   *pUapsdMask = uapsdMask;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**============================================================================
+  @brief hdd_wmm_is_active() - Function which will determine if WMM is
+  active on the current connection
+
+  @param pAdapter  : [in]  pointer to adapter context
+
+  @return         : VOS_TRUE if WMM is enabled
+                  : VOS_FALSE if WMM is not enabled
+  ===========================================================================*/
+v_BOOL_t hdd_wmm_is_active( hdd_adapter_t* pAdapter )
+{
+   if ((!pAdapter->hddWmmStatus.wmmQosConnection) ||
+       (!pAdapter->hddWmmStatus.wmmQap))
+   {
+      return VOS_FALSE;
+   }
+   else
+   {
+      return VOS_TRUE;
+   }
+}
+
+/**============================================================================
+  @brief hdd_wmm_addts() - Function which will add a traffic spec at the
+  request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+  @param pTspec    : [in]  pointer to the traffic spec
+
+  @return          : HDD_WLAN_WMM_STATUS_*
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_addts( hdd_adapter_t* pAdapter,
+                                     v_U32_t handle,
+                                     sme_QosWmmTspecInfo* pTspec )
+{
+   hdd_wmm_qos_context_t *pQosContext;
+   hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS ;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   sme_QosStatusType smeStatus;
+#endif
+   v_BOOL_t found = VOS_FALSE;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered with handle 0x%x", __FUNCTION__, handle);
+
+   // see if a context already exists with the given handle
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+   list_for_each_entry(pQosContext,
+                       &pAdapter->hddWmmStatus.wmmContextList,
+                       node)
+   {
+      if (pQosContext->handle == handle)
+      {
+         found = VOS_TRUE;
+         break;
+      }
+   }
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+   if (found)
+   {
+      // record with that handle already exists
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Record already exists with handle 0x%x",
+                __FUNCTION__, handle);
+
+      /* Application is trying to modify some of the Tspec params. Allow it */
+      smeStatus = sme_QosModifyReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                  pTspec,
+                                  pQosContext->qosFlowId);
+
+      // need to check the return value and act appropriately
+      switch (smeStatus)
+      {
+        case SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP:
+          status = HDD_WLAN_WMM_STATUS_MODIFY_PENDING;
+          break;
+        case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP:
+          status = HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD;
+          break;
+        case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY:
+          status = HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING;
+          break;
+        case SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP:
+          status = HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM;
+          break;
+        case SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP:
+          status = HDD_WLAN_WMM_STATUS_MODIFY_FAILED;
+          break;
+        case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP:
+          status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM;
+          break;
+        default:
+          // we didn't get back one of the SME_QOS_STATUS_MODIFY_* status codes
+          VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                     "%s: unexpected SME Status=%d\n", smeStatus );
+          VOS_ASSERT(0);
+          return HDD_WLAN_WMM_STATUS_MODIFY_FAILED;
+      }
+
+      // we were successful, save the status
+      pQosContext->lastStatus = status;
+      return status;
+   }
+
+   pQosContext = kmalloc(sizeof(*pQosContext), GFP_KERNEL);
+   if (NULL == pQosContext)
+   {
+      // no memory for QoS context.  Nothing we can do
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                "%s: Unable to allocate QoS context", __FUNCTION__);
+      return HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE;
+   }
+
+   // we assume the tspec has already been validated by the caller
+
+   pQosContext->handle = handle;
+   pQosContext->acType = hddWmmUpToAcMap[pTspec->ts_info.up];
+   pQosContext->pAdapter = pAdapter;
+   pQosContext->qosFlowId = 0;
+   pQosContext->magic = HDD_WMM_CTX_MAGIC;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: Setting up QoS, context %p",
+             __FUNCTION__, pQosContext);
+
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+   list_add(&pQosContext->node, &pAdapter->hddWmmStatus.wmmContextList);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   smeStatus = sme_QosSetupReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                               pAdapter->sessionId,
+                               pTspec,
+                               hdd_wmm_sme_callback,
+                               pQosContext,
+                               pTspec->ts_info.up,
+                               &pQosContext->qosFlowId);
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
+             "%s: sme_QosSetupReq returned %d flowid %d",
+             __FUNCTION__, smeStatus, pQosContext->qosFlowId);
+
+   // need to check the return value and act appropriately
+   switch (smeStatus)
+   {
+   case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP:
+      status = HDD_WLAN_WMM_STATUS_SETUP_PENDING;
+      break;
+   case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP:
+      status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD;
+      break;
+   case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY:
+      status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING;
+      break;
+   case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING:
+      status = HDD_WLAN_WMM_STATUS_SETUP_PENDING;
+      break;
+   case SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP:
+      hdd_wmm_free_context(pQosContext);
+      return HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
+   case SME_QOS_STATUS_SETUP_FAILURE_RSP:
+      // we can't tell the difference between when a request fails because
+      // AP rejected it versus when SME encounterd an internal error
+      hdd_wmm_free_context(pQosContext);
+      return HDD_WLAN_WMM_STATUS_SETUP_FAILED;
+   case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP:
+      hdd_wmm_free_context(pQosContext);
+      return HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM;
+   default:
+      // we didn't get back one of the SME_QOS_STATUS_SETUP_* status codes
+      hdd_wmm_free_context(pQosContext);
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: unexpected SME Status=%d\n", smeStatus );
+      VOS_ASSERT(0);
+      return HDD_WLAN_WMM_STATUS_SETUP_FAILED;
+   }
+#endif
+
+   // we were successful, save the status
+   pQosContext->lastStatus = status;
+
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_wmm_delts() - Function which will delete a traffic spec at the
+  request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+
+  @return          : HDD_WLAN_WMM_STATUS_*
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_delts( hdd_adapter_t* pAdapter,
+                                     v_U32_t handle )
+{
+   hdd_wmm_qos_context_t *pQosContext;
+   v_BOOL_t found = VOS_FALSE;
+   WLANTL_ACEnumType acType = 0;
+   v_U32_t qosFlowId = 0;
+   hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS ;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   sme_QosStatusType smeStatus;
+#endif
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered with handle 0x%x", __FUNCTION__, handle);
+
+   // locate the context with the given handle
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+   list_for_each_entry(pQosContext,
+                       &pAdapter->hddWmmStatus.wmmContextList,
+                       node)
+   {
+      if (pQosContext->handle == handle)
+      {
+         found = VOS_TRUE;
+         acType = pQosContext->acType;
+         qosFlowId = pQosContext->qosFlowId;
+         break;
+      }
+   }
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+
+   if (VOS_FALSE == found)
+   {
+      // we didn't find the handle
+      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                "%s: handle 0x%x not found", __FUNCTION__, handle);
+      return HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM;
+   }
+
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: found handle 0x%x, flow %d, AC %d, context %p",
+             __FUNCTION__, handle, qosFlowId, acType, pQosContext);
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   smeStatus = sme_QosReleaseReq( WLAN_HDD_GET_HAL_CTX(pAdapter), qosFlowId );
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: SME flow %d released, SME status %d",
+             __FUNCTION__, qosFlowId, smeStatus);
+
+   switch(smeStatus)
+   {
+   case SME_QOS_STATUS_RELEASE_SUCCESS_RSP:
+      // this flow is the only one on that AC, so go ahead and update
+      // our TSPEC state for the AC
+      pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcTspecValid = VOS_FALSE;
+
+      // need to tell TL to stop trigger timer, etc
+      hdd_wmm_disable_tl_uapsd(pQosContext);
+
+#ifdef FEATURE_WLAN_CCX
+      // disable the inactivity timer
+      hdd_wmm_disable_inactivity_timer(pQosContext);
+#endif
+      // we are done with this context
+      hdd_wmm_free_context(pQosContext);
+
+      // SME must not fire any more callbacks for this flow since the context
+      // is no longer valid
+
+      return HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS;
+
+   case SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP:
+      // do nothing as we will get a response from SME
+      status = HDD_WLAN_WMM_STATUS_RELEASE_PENDING;
+      break;
+
+   case SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP:
+      // nothing we can do with the existing flow except leave it
+      status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM;
+      break;
+
+   case SME_QOS_STATUS_RELEASE_FAILURE_RSP:
+      // nothing we can do with the existing flow except leave it
+      status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED;
+
+   default:
+      // we didn't get back one of the SME_QOS_STATUS_RELEASE_* status codes
+      VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
+                 "%s: unexpected SME Status=%d\n", smeStatus );
+      VOS_ASSERT(0);
+      status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED;
+   }
+
+#endif
+   pQosContext->lastStatus = status;
+   return status;
+}
+
+/**============================================================================
+  @brief hdd_wmm_checkts() - Function which will return the status of a traffic
+  spec at the request of an application
+
+  @param pAdapter  : [in]  pointer to adapter context
+  @param handle    : [in]  handle to uniquely identify a TS
+
+  @return          : HDD_WLAN_WMM_STATUS_*
+  ===========================================================================*/
+hdd_wlan_wmm_status_e hdd_wmm_checkts( hdd_adapter_t* pAdapter,
+                                       v_U32_t handle )
+{
+   hdd_wmm_qos_context_t *pQosContext;
+   hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_LOST;
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+             "%s: Entered with handle 0x%x", __FUNCTION__, handle);
+
+   // locate the context with the given handle
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+   list_for_each_entry(pQosContext,
+                       &pAdapter->hddWmmStatus.wmmContextList,
+                       node)
+   {
+      if (pQosContext->handle == handle)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
+                   "%s: found handle 0x%x, context %p",
+                   __FUNCTION__, handle, pQosContext);
+
+         status = pQosContext->lastStatus;
+         break;
+      }
+   }
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
+   return status;
+}
diff --git a/CORE/HDD/src/wlan_hdd_wowl.c b/CORE/HDD/src/wlan_hdd_wowl.c
new file mode 100644
index 0000000..fa41a23
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_wowl.c
@@ -0,0 +1,394 @@
+/*
+ * 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 wlan_hdd_wowl.c
+ *
+ * Copyright (c) 2009 QUALCOMM Incorporated.
+ * All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
+ *
+ * ==========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+
+#include <wlan_hdd_includes.h>
+#include <wlan_hdd_wowl.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+#define WOWL_PTRN_MAX_SIZE          128
+#define WOWL_PTRN_MASK_MAX_SIZE      16
+#define WOWL_MAX_PTRNS_ALLOWED        8
+#define WOWL_INTER_PTRN_TOKENIZER   ';'
+#define WOWL_INTRA_PTRN_TOKENIZER   ':'
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+static struct hdd_context_s *pAdapterHandle = NULL;
+
+char *g_hdd_wowl_ptrns[WOWL_MAX_PTRNS_ALLOWED]; //Patterns 0-7 
+
+static int parse_hex(unsigned char c)
+{
+  if (c >= '0' && c <= '9')
+    return c-'0';
+  if (c >= 'a' && c <= 'f')
+    return c-'a'+10;
+  if (c >= 'A' && c <= 'F')
+    return c-'A'+10;
+
+  return 0;
+}
+
+static inline int find_ptrn_len(const char* ptrn)
+{
+  int len = 0;
+  while (*ptrn != '\0' && *ptrn != WOWL_INTER_PTRN_TOKENIZER)
+  {
+    len++; ptrn++;
+  }
+  return len;
+}
+
+static void hdd_wowl_callback( void *pContext, eHalStatus halStatus )
+{
+  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+    "%s: Return code = (%ld)\n", __FUNCTION__, halStatus );
+}
+
+static void dump_hdd_wowl_ptrn(tSirWowlAddBcastPtrn *ptrn)
+{
+  int i;
+
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ucPatetrnId = 0x%x", __func__, 
+      ptrn->ucPatternId);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ucPatternByteOffset = 0x%x", __func__, 
+      ptrn->ucPatternByteOffset);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ucPatternSize = 0x%x", __func__, 
+      ptrn->ucPatternSize);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ucPatternMaskSize = 0x%x", __func__, 
+      ptrn->ucPatternMaskSize);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Pattern: ", __func__);
+  for(i = 0; i<ptrn->ucPatternSize; i++)
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO," %02X", ptrn->ucPattern[i]);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: PatternMask: ", __func__);
+  for(i = 0; i<ptrn->ucPatternMaskSize; i++)
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%02X", ptrn->ucPatternMask[i]);
+}
+
+
+/**============================================================================
+  @brief hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be
+  used when PBM filtering is enabled
+
+  @param ptrn : [in]  pointer to the pattern string to be added
+
+  @return     : FALSE if any errors encountered
+              : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_add_wowl_ptrn (const char * ptrn) 
+{
+  tSirWowlAddBcastPtrn localPattern;
+  int i, first_empty_slot, len, offset;
+  eHalStatus halStatus;
+  const char *temp;
+
+  len = find_ptrn_len(ptrn);
+
+  /* There has to have atleast 1 byte for each field (pattern size, mask size,
+   * pattern, mask) e.g. PP:QQ:RR:SS ==> 11 chars */
+  while ( len >= 11 ) 
+  {
+    first_empty_slot = -1;
+
+    // Find an empty slot to store the pattern
+    for (i=0; i<WOWL_MAX_PTRNS_ALLOWED; i++)
+    {
+      if(g_hdd_wowl_ptrns[i] == NULL) {
+        first_empty_slot = i;
+        break;
+      }
+    }
+
+    // Maximum number of patterns have been configured already
+    if(first_empty_slot == -1)
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: Cannot add anymore patterns. No free slot!", __FUNCTION__);
+      return VOS_FALSE;
+    }
+
+    // Detect duplicate pattern
+    for (i=0; i<WOWL_MAX_PTRNS_ALLOWED; i++)
+    {
+      if(g_hdd_wowl_ptrns[i] == NULL) continue;
+
+      if(!memcmp(ptrn, g_hdd_wowl_ptrns[i], len))
+      {
+        // Pattern Already configured, skip to next pattern
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+            "Trying to add duplicate WoWL pattern. Skip it!");
+        ptrn += len; 
+        goto next_ptrn;
+      }
+    }
+
+    //Validate the pattern
+    if(ptrn[2] != WOWL_INTRA_PTRN_TOKENIZER || 
+       ptrn[5] != WOWL_INTRA_PTRN_TOKENIZER)
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: Malformed pattern string. Skip!\n", __FUNCTION__);
+      ptrn += len; 
+      goto next_ptrn;
+    }
+
+    // Extract the pattern size
+    localPattern.ucPatternSize = 
+      ( parse_hex( ptrn[0] ) * 0x10 ) + parse_hex( ptrn[1] );
+
+    // Extract the pattern mask size
+    localPattern.ucPatternMaskSize = 
+      ( parse_hex( ptrn[3] ) * 0x10 ) + parse_hex( ptrn[4] );
+
+    if(localPattern.ucPatternSize > WOWL_PTRN_MAX_SIZE ||
+       localPattern.ucPatternMaskSize > WOWL_PTRN_MASK_MAX_SIZE)
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: Invalid length specified. Skip!\n", __FUNCTION__);
+      ptrn += len; 
+      goto next_ptrn;
+    }
+
+    //compute the offset of tokenizer after the pattern
+    offset = 5 + 2*localPattern.ucPatternSize + 1;
+    if(offset >= len || ptrn[offset] != WOWL_INTRA_PTRN_TOKENIZER) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: Malformed pattern string..skip!\n", __FUNCTION__);
+      ptrn += len; 
+      goto next_ptrn;
+    }
+
+    //compute the end of pattern sring
+    offset = offset + 2*localPattern.ucPatternMaskSize;
+    if(offset+1 != len) //offset begins with 0
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: Malformed pattern string...skip!\n", __FUNCTION__);
+      ptrn += len; 
+      goto next_ptrn;
+    }
+
+    temp = ptrn;
+
+    // Now advance to where pattern begins 
+    ptrn += 6; 
+
+    // Extract the pattern
+    for(i=0; i < localPattern.ucPatternSize; i++)
+    {
+      localPattern.ucPattern[i] = 
+        (parse_hex( ptrn[0] ) * 0x10 ) + parse_hex( ptrn[1] );
+      ptrn += 2; //skip to next byte
+    }
+
+    ptrn++; // Skip over the ':' seperator after the pattern
+
+    // Extract the pattern Mask
+    for(i=0; i < localPattern.ucPatternMaskSize; i++)
+    {
+      localPattern.ucPatternMask[i] = 
+        (parse_hex( ptrn[0] ) * 0x10 ) + parse_hex( ptrn[1] );
+      ptrn += 2; //skip to next byte
+    }
+
+    //All is good. Store the pattern locally
+    g_hdd_wowl_ptrns[first_empty_slot] = (char*) kmalloc(len+1, GFP_KERNEL); 
+    if(g_hdd_wowl_ptrns[first_empty_slot] == NULL) 
+    {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "%s: kmalloc failure", __FUNCTION__);
+      return VOS_FALSE;
+    }
+
+    memcpy(g_hdd_wowl_ptrns[first_empty_slot], temp, len);
+    g_hdd_wowl_ptrns[first_empty_slot][len] = '\0';
+    localPattern.ucPatternId = first_empty_slot;
+    localPattern.ucPatternByteOffset = 0;
+
+    // Register the pattern downstream
+    halStatus = sme_WowlAddBcastPattern( pAdapterHandle->hHal, &localPattern );
+    if ( !HAL_STATUS_SUCCESS( halStatus ) )
+    {
+      // Add failed, so invalidate the local storage
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "sme_WowlAddBcastPattern failed with error code (%ld)", halStatus );
+      kfree(g_hdd_wowl_ptrns[first_empty_slot]);
+      g_hdd_wowl_ptrns[first_empty_slot] = NULL;
+    }
+
+    dump_hdd_wowl_ptrn(&localPattern);
+ 
+ next_ptrn:
+    if (*ptrn ==  WOWL_INTER_PTRN_TOKENIZER)
+    {
+      ptrn += 1; // move past the tokenizer
+      len = find_ptrn_len(ptrn);
+      continue;
+    }
+    else 
+      break;
+  }
+
+  return VOS_TRUE;
+}
+
+/**============================================================================
+  @brief hdd_del_wowl_ptrn() - Function which will remove a WoWL pattern
+
+  @param ptrn : [in]  pointer to the pattern string to be removed
+
+  @return     : FALSE if any errors encountered
+              : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_del_wowl_ptrn (const char * ptrn) 
+{
+  tSirWowlDelBcastPtrn delPattern;
+  unsigned char id;
+  v_BOOL_t patternFound = VOS_FALSE;
+  eHalStatus halStatus;
+
+  // Detect pattern
+  for (id=0; id<WOWL_MAX_PTRNS_ALLOWED && g_hdd_wowl_ptrns[id] != NULL; id++)
+  {
+    if(!strcmp(ptrn, g_hdd_wowl_ptrns[id]))
+    {
+      patternFound = VOS_TRUE;
+      break;
+    }
+  }
+
+  // If pattern present, remove it from downstream
+  if(patternFound)
+  {
+    delPattern.ucPatternId = id;
+    halStatus = sme_WowlDelBcastPattern( pAdapterHandle->hHal, &delPattern );
+    if ( HAL_STATUS_SUCCESS( halStatus ) )
+    {
+      // Remove from local storage as well
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "Deleted pattern with id %d [%s]", id, g_hdd_wowl_ptrns[id]);
+
+      kfree(g_hdd_wowl_ptrns[id]);
+      g_hdd_wowl_ptrns[id] = NULL;
+      return VOS_TRUE;
+    }
+  }
+  return VOS_FALSE;
+}
+
+/**============================================================================
+  @brief hdd_enter_wowl() - Function which will enable WoWL. Atleast one
+  of MP and PBM must be enabled
+
+  @param enable_mp  : [in] Whether to enable magic packet WoWL mode
+  @param enable_pbm : [in] Whether to enable pattern byte matching WoWL mode
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_enter_wowl (hdd_adapter_t *pAdapter, v_BOOL_t enable_mp, v_BOOL_t enable_pbm) 
+{
+  tSirSmeWowlEnterParams wowParams;
+  eHalStatus halStatus;
+
+  wowParams.ucPatternFilteringEnable = enable_pbm;
+  wowParams.ucMagicPktEnable = enable_mp;
+  if(enable_mp)
+  {
+    vos_copy_macaddr( (v_MACADDR_t *)&(wowParams.magicPtrn),
+                    &(pAdapter->macAddressCurrent) );
+  }
+
+  // Request to put Libra into WoWL
+  halStatus = sme_EnterWowl( pAdapterHandle->hHal, hdd_wowl_callback, 
+      pAdapterHandle, &wowParams );
+
+  if ( !HAL_STATUS_SUCCESS( halStatus ) )
+  {
+    if ( eHAL_STATUS_PMC_PENDING != halStatus )
+    {
+      // We failed to enter WoWL
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+          "sme_EnterWowl failed with error code (%ld)", halStatus );
+      return VOS_FALSE;
+    }
+  }
+  return VOS_TRUE;
+}
+
+/**============================================================================
+  @brief hdd_exit_wowl() - Function which will disable WoWL
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_exit_wowl (void) 
+{
+  eHalStatus halStatus;
+
+  halStatus = sme_ExitWowl( pAdapterHandle->hHal );
+  if ( !HAL_STATUS_SUCCESS( halStatus ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+      "sme_ExitWowl failed with error code (%ld)", halStatus );
+    return VOS_FALSE;
+  }
+
+  return VOS_TRUE;
+}
+
+/**============================================================================
+  @brief hdd_init_wowl() - Init function which will initialize the WoWL module
+  and perform any required intial configuration 
+
+  @return           : FALSE if any errors encountered
+                    : TRUE otherwise
+  ===========================================================================*/
+v_BOOL_t hdd_init_wowl (void *pAdapter) 
+{
+  pAdapterHandle = (struct hdd_context_s*)pAdapter;
+
+  memset(g_hdd_wowl_ptrns, 0, sizeof(g_hdd_wowl_ptrns));
+
+  //Add any statically configured patterns 
+  hdd_add_wowl_ptrn(pAdapterHandle->cfg_ini->wowlPattern); 
+
+  return VOS_TRUE;
+}
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 *) &currentSSID,
+                   (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,
+        &currentBssUapsd , &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,&param))
+    {
+        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(&params[i][cwminidx]));
+        psessionEntry->gLimEdcaParamsBC[i].cw.max =  convertCW(GET_CW(&params[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(&params[i][cwminidx]));
+        psessionEntry->gLimEdcaParams[i].cw.max =  convertCW(GET_CW(&params[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
diff --git a/CORE/SAP/inc/sapApi.h b/CORE/SAP/inc/sapApi.h
new file mode 100644
index 0000000..6c9953e
--- /dev/null
+++ b/CORE/SAP/inc/sapApi.h
@@ -0,0 +1,1502 @@
+/*
+ * 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 WLAN_QCT_WLANSAP_H
+#define WLAN_QCT_WLANSAP_H
+
+/*===========================================================================
+
+               W L A N   S O F T A P  P A L   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan SAP PAL layer 
+  module.
+  
+      
+  Copyright (c) 2010 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: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/SAP/inc/sapApi.h,v 1.21 2009/03/09 08:58:26 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $
+
+
+when           who                what, where, why
+--------    ---                 ----------------------------------------------------------
+07/01/08     SAP team       Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_api.h" 
+#include "vos_packet.h" 
+#include "vos_types.h"
+
+#ifdef WLAN_FEATURE_P2P
+#include "p2p_Api.h"
+#endif
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+ 
+/*--------------------------------------------------------------------------
+  defines and enum
+  ------------------------------------------------------------------------*/
+  
+#define       MAX_SSID_LEN                 32
+#define       MAX_MAC_ADDRESS_ACCEPTED     16
+#define       MAX_MAC_ADDRESS_DENIED       MAX_MAC_ADDRESS_ACCEPTED
+#define       AUTO_CHANNEL_SELECT          0
+#define       MAX_ASSOC_IND_IE_LEN         255
+
+/* defines for WPS config states */
+#define       SAP_WPS_DISABLED             0
+#define       SAP_WPS_ENABLED_UNCONFIGURED 1
+#define       SAP_WPS_ENABLED_CONFIGURED   2
+
+#define       MAX_NAME_SIZE                64
+#define       MAX_TEXT_SIZE                32
+
+
+/*--------------------------------------------------------------------------
+  reasonCode take form 802.11 standard Table 7-22 to be passed to WLANSAP_DisassocSta api.
+  ------------------------------------------------------------------------*/
+
+typedef enum{  
+    eSAP_RC_RESERVED0,               /*0*/  
+    eSAP_RC_UNSPECIFIED,             /*1*/  
+    eSAP_RC_PREV_AUTH_INVALID,       /*2*/  
+    eSAP_RC_STA_LEFT_DEAUTH,         /*3*/  
+    eSAP_RC_INACTIVITY_DISASSOC,     /*4*/ 
+    eSAP_RC_AP_CAPACITY_FULL,        /*5*/
+    eSAP_RC_CLS2_FROM_NON_AUTH_STA,  /*6*/
+    eSAP_RC_CLS3_FROM_NON_AUTH_STA,  /*7*/
+    eSAP_RC_STA_LEFT_DISASSOC,       /*8*/
+    eSAP_RC_STA_NOT_AUTH,            /*9*/
+    eSAP_RC_PC_UNACCEPTABLE,         /*10*/
+    eSAP_RC_SC_UNACCEPTABLE,         /*11*/
+    eSAP_RC_RESERVED1,               /*12*/
+    eSAP_RC_INVALID_IE,              /*13*/
+    eSAP_RC_MIC_FAIL,                /*14*/
+    eSAP_RC_4_WAY_HANDSHAKE_TO,      /*15*/
+    eSAP_RC_GO_KEY_HANDSHAKE_TO,     /*16*/
+    eSAP_RC_IE_MISMATCH,             /*17*/
+    eSAP_RC_INVALID_GRP_CHIPHER,     /*18*/
+    eSAP_RC_INVALID_PAIR_CHIPHER,    /*19*/
+    eSAP_RC_INVALID_AKMP,            /*20*/
+    eSAP_RC_UNSUPPORTED_RSN,         /*21*/
+    eSAP_RC_INVALID_RSN,             /*22*/
+    eSAP_RC_1X_AUTH_FAILED,          /*23*/
+    eSAP_RC_CHIPER_SUITE_REJECTED,   /*24*/
+}eSapReasonCode;    
+
+typedef enum {
+    eSAP_DOT11_MODE_abg = 0x0001,
+    eSAP_DOT11_MODE_11a = 0x0002,
+    eSAP_DOT11_MODE_11b = 0x0004,     
+    eSAP_DOT11_MODE_11g = 0x0008,     
+    eSAP_DOT11_MODE_11n = 0x0010,     
+    eSAP_DOT11_MODE_11g_ONLY = 0x0080,
+    eSAP_DOT11_MODE_11n_ONLY = 0x0100,
+    eSAP_DOT11_MODE_11b_ONLY = 0x0400,
+
+} eSapPhyMode;
+
+typedef enum {
+    eSAP_ACCEPT_UNLESS_DENIED = 0,
+    eSAP_DENY_UNLESS_ACCEPTED = 1,
+    eSAP_SUPPORT_ACCEPT_AND_DENY = 2, /* this type is added to support both accept and deny lists at the same time */
+    eSAP_ALLOW_ALL = 3, /*In this mode all MAC addresses are allowed to connect*/
+} eSapMacAddrACL;
+
+typedef enum {
+    eSAP_BLACK_LIST = 0, /* List of mac addresses NOT allowed to assoc */
+    eSAP_WHITE_LIST = 1, /* List of mac addresses allowed to assoc */
+} eSapACLType;
+
+typedef enum {
+    ADD_STA_TO_ACL      = 0, /* cmd to add STA to access control list */
+    DELETE_STA_FROM_ACL = 1, /* cmd to delete STA from access control list */
+} eSapACLCmdType;
+
+typedef enum {
+    eSAP_START_BSS_EVENT = 0, /*Event sent when BSS is started*/
+    eSAP_STOP_BSS_EVENT,      /*Event sent when BSS is stopped*/
+    eSAP_STA_ASSOC_IND,       /* Indicate the association request to upper layers */    
+    eSAP_STA_ASSOC_EVENT,     /*Event sent when we have successfully associated a station and 
+                                upper layer neeeds to allocate a context*/
+    eSAP_STA_REASSOC_EVENT,   /*Event sent when we have successfully reassociated a station and 
+                                upper layer neeeds to allocate a context*/
+    eSAP_STA_DISASSOC_EVENT,  /*Event sent when associated a station has disassociated as a result of various conditions */
+    eSAP_STA_SET_KEY_EVENT,   /*Event sent when user called WLANSAP_SetKeySta */
+    eSAP_STA_DEL_KEY_EVENT,   /*Event sent when user called WLANSAP_DelKeySta */
+    eSAP_STA_MIC_FAILURE_EVENT, /*Event sent whenever there is MIC failure detected */
+    eSAP_ASSOC_STA_CALLBACK_EVENT,  /*Event sent when user called WLANSAP_GetAssocStations */
+    eSAP_GET_WPSPBC_SESSION_EVENT,  /* Event send when user call  WLANSAP_getWpsSessionOverlap */  
+    eSAP_WPS_PBC_PROBE_REQ_EVENT, /* Event send on WPS PBC probe request is received */
+#ifdef WLAN_FEATURE_P2P
+    eSAP_INDICATE_MGMT_FRAME,
+    eSAP_REMAIN_CHAN_READY,
+    eSAP_SEND_ACTION_CNF,
+#endif
+    eSAP_UNKNOWN_STA_JOIN, /* Event send when a STA in neither white list or black list tries to associate in softap mode */
+    eSAP_MAX_ASSOC_EXCEEDED, /* Event send when a new STA is rejected association since softAP max assoc limit has reached */
+} eSapHddEvent;
+
+typedef enum {
+    eSAP_OPEN_SYSTEM,
+    eSAP_SHARED_KEY,
+    eSAP_AUTO_SWITCH
+ } eSapAuthType; 
+
+typedef enum {
+    eSAP_MAC_INITATED_DISASSOC = 0x10000, /*Disassociation was internally initated from CORE stack*/
+    eSAP_USR_INITATED_DISASSOC /*Disassociation was internally initated from host by invoking WLANSAP_DisassocSta call*/
+ } eSapDisassocReason; 
+
+/*Handle boolean over here*/
+typedef enum {
+    eSAP_FALSE,
+    eSAP_TRUE,
+}eSapBool;
+
+/*---------------------------------------------------------------------------
+SAP PAL "status" and "reason" error code defines 
+ ---------------------------------------------------------------------------*/    
+typedef enum  {
+    eSAP_STATUS_SUCCESS,                 /* Success.  */
+    eSAP_STATUS_FAILURE,                 /* General Failure.  */
+    eSAP_START_BSS_CHANNEL_NOT_SELECTED, /* Channel not selected during intial scan.  */
+    eSAP_ERROR_MAC_START_FAIL,           /* Failed to start Infra BSS */
+}eSapStatus;
+
+/*---------------------------------------------------------------------------
+SAP PAL "status" and "reason" error code defines 
+ ---------------------------------------------------------------------------*/    
+typedef enum  {
+    eSAP_WPSPBC_OVERLAP_IN120S,                 /* Overlap */
+    eSAP_WPSPBC_NO_WPSPBC_PROBE_REQ_IN120S,     /* no WPS probe request in 120 second */
+    eSAP_WPSPBC_ONE_WPSPBC_PROBE_REQ_IN120S,    /* One WPS probe request in 120 second  */
+}eWPSPBCOverlap;
+
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+typedef struct sap_StartBssCompleteEvent_s {
+    v_U8_t  status;
+    v_U8_t  operatingChannel;
+    v_U16_t staId; //self StaID
+} tSap_StartBssCompleteEvent;
+
+typedef struct sap_StopBssCompleteEvent_s {
+    v_U8_t status;
+} tSap_StopBssCompleteEvent;
+
+typedef struct sap_StationAssocIndication_s {
+    v_MACADDR_t  staMac;
+    v_U8_t       assoId;
+    v_U8_t       staId;
+    v_U8_t       status;
+    // Required for indicating the frames to upper layer
+    tANI_U32     beaconLength;
+    tANI_U8*     beaconPtr;
+    tANI_U32     assocReqLength;
+    tANI_U8*     assocReqPtr;
+    tANI_BOOLEAN fWmmEnabled;
+#if WLAN_SOFTAP_FEATURE
+    eCsrAuthType negotiatedAuthType;
+    eCsrEncryptionType negotiatedUCEncryptionType;
+    eCsrEncryptionType negotiatedMCEncryptionType;
+    tANI_BOOLEAN fAuthRequired;
+#endif
+} tSap_StationAssocIndication;
+
+typedef struct sap_StationAssocReassocCompleteEvent_s {
+    v_MACADDR_t  staMac;
+    v_U8_t       staId;
+    v_U8_t       status;
+    v_U8_t       ies[MAX_ASSOC_IND_IE_LEN];
+    v_U16_t      iesLen;
+    v_U32_t      statusCode; 
+    eSapAuthType SapAuthType;
+    v_BOOL_t     wmmEnabled;
+    // Required for indicating the frames to upper layer
+    tANI_U32     beaconLength;
+    tANI_U8*     beaconPtr;
+    tANI_U32     assocReqLength;
+    tANI_U8*     assocReqPtr;
+    tANI_U32     assocRespLength;
+    tANI_U8*     assocRespPtr;    
+} tSap_StationAssocReassocCompleteEvent;
+
+typedef struct sap_StationDisassocCompleteEvent_s {
+    v_MACADDR_t        staMac;
+    v_U8_t             staId;    //STAID should not be used
+    v_U8_t             status;
+    v_U32_t            statusCode;
+    eSapDisassocReason reason;
+} tSap_StationDisassocCompleteEvent;
+
+typedef struct sap_StationSetKeyCompleteEvent_s {
+    v_U8_t        status;
+    v_MACADDR_t   peerMacAddr;
+} tSap_StationSetKeyCompleteEvent;
+
+/*struct corresponding to SAP_STA_DEL_KEY_EVENT */
+typedef struct sap_StationDeleteKeyCompleteEvent_s {
+    v_U8_t status;
+    v_U8_t  keyId; /* Key index */
+} tSap_StationDeleteKeyCompleteEvent;
+
+/*struct corresponding to SAP_STA_MIC_FAILURE_EVENT */
+typedef struct sap_StationMICFailureEvent_s {
+    v_MACADDR_t   srcMacAddr; //address used to compute MIC 
+    v_MACADDR_t   staMac; //taMacAddr transmitter address
+    v_MACADDR_t   dstMacAddr;
+    eSapBool   multicast;
+    v_U8_t     IV1;            // first byte of IV
+    v_U8_t     keyId;          // second byte of IV
+    v_U8_t     TSC[SIR_CIPHER_SEQ_CTR_SIZE]; // sequence number
+
+} tSap_StationMICFailureEvent;
+/*Structure to return MAC address of associated stations */
+typedef struct sap_AssocMacAddr_s {
+    v_MACADDR_t staMac;     /*MAC address of Station that is associated*/
+    v_U8_t      assocId;        /*Association ID for the station that is associated*/
+    v_U8_t      staId;            /*Station Id that is allocated to the station*/
+} tSap_AssocMacAddr, *tpSap_AssocMacAddr;
+
+/*struct corresponding to SAP_ASSOC_STA_CALLBACK_EVENT */
+typedef struct sap_AssocStaListEvent_s {
+    VOS_MODULE_ID      module; /* module id that was passed in WLANSAP_GetAssocStations API*/
+    v_U8_t             noOfAssocSta;  /* Number of associated stations*/
+    tpSap_AssocMacAddr pAssocStas; /*Pointer to pre allocated memory to obtain list of associated 
+                                    stations passed in WLANSAP_GetAssocStations API*/
+} tSap_AssocStaListEvent;
+ 
+typedef struct sap_GetWPSPBCSessionEvent_s {
+    v_U8_t         status;
+    VOS_MODULE_ID  module; /* module id that was passed in WLANSAP_GetAssocStations API*/       
+    v_U8_t         UUID_E[16];         // Unique identifier of the AP.
+    v_MACADDR_t    addr;  
+    eWPSPBCOverlap wpsPBCOverlap;
+} tSap_GetWPSPBCSessionEvent; 
+
+typedef struct sap_WPSPBCProbeReqEvent_s {
+    v_U8_t             status;
+    VOS_MODULE_ID      module; /* module id that was passed in WLANSAP_GetAssocStations API*/   
+    tSirWPSPBCProbeReq WPSPBCProbeReq;
+} tSap_WPSPBCProbeReqEvent; 
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sap_ManagementFrameInfo_s {
+    tANI_U32 nFrameLength;
+    tANI_U8  frameType;
+    tANI_U32 rxChan;            //Channel of where packet is recevied 
+    tANI_U8 *pbFrames;         //Point to a buffer contain the beacon, assoc req, assoc rsp frame, in that order
+                             //user needs to use nBeaconLength, nAssocReqLength, nAssocRspLength to desice where
+                            //each frame starts and ends.
+} tSap_ManagementFrameInfo;
+
+typedef struct sap_SendActionCnf_s {
+    eSapStatus actionSendSuccess; 
+} tSap_SendActionCnf;
+#endif
+
+typedef struct sap_UnknownSTAJoinEvent_s {
+    v_MACADDR_t    macaddr;  
+} tSap_UnknownSTAJoinEvent;
+
+typedef struct sap_MaxAssocExceededEvent_s {
+    v_MACADDR_t    macaddr;  
+} tSap_MaxAssocExceededEvent;
+
+
+/* 
+   This struct will be filled in and passed to tpWLAN_SAPEventCB that is provided during WLANSAP_StartBss call   
+   The event id corresponding to structure  in the union is defined in comment next to the structure
+*/
+
+typedef struct sap_Event_s {
+    eSapHddEvent sapHddEventCode;
+    union {
+        tSap_StartBssCompleteEvent                sapStartBssCompleteEvent; /*SAP_START_BSS_EVENT*/
+        tSap_StopBssCompleteEvent                 sapStopBssCompleteEvent;  /*SAP_STOP_BSS_EVENT*/
+        tSap_StationAssocIndication               sapAssocIndication;       /*SAP_ASSOC_INDICATION */         
+        tSap_StationAssocReassocCompleteEvent     sapStationAssocReassocCompleteEvent; /*SAP_STA_ASSOC_EVENT, SAP_STA_REASSOC_EVENT*/
+        tSap_StationDisassocCompleteEvent         sapStationDisassocCompleteEvent;/*SAP_STA_DISASSOC_EVENT*/
+        tSap_StationSetKeyCompleteEvent           sapStationSetKeyCompleteEvent;/*SAP_STA_SET_KEY_EVENT*/
+        tSap_StationDeleteKeyCompleteEvent        sapStationDeleteKeyCompleteEvent;/*SAP_STA_DEL_KEY_EVENT*/
+        tSap_StationMICFailureEvent               sapStationMICFailureEvent; /*SAP_STA_MIC_FAILURE_EVENT */
+        tSap_AssocStaListEvent                    sapAssocStaListEvent; /*SAP_ASSOC_STA_CALLBACK_EVENT */
+        tSap_GetWPSPBCSessionEvent                sapGetWPSPBCSessionEvent; /*SAP_GET_WPSPBC_SESSION_EVENT */
+        tSap_WPSPBCProbeReqEvent                  sapPBCProbeReqEvent; /*eSAP_WPS_PBC_PROBE_REQ_EVENT */
+#ifdef WLAN_FEATURE_P2P
+        tSap_ManagementFrameInfo                  sapManagementFrameInfo; /*eSAP_INDICATE_MGMT_FRAME*/
+        tSap_SendActionCnf                        sapActionCnf;  /* eSAP_SEND_ACTION_CNF */ 
+#endif
+        tSap_UnknownSTAJoinEvent                  sapUnknownSTAJoin; /* eSAP_UNKNOWN_STA_JOIN */
+        tSap_MaxAssocExceededEvent                sapMaxAssocExceeded; /* eSAP_MAX_ASSOC_EXCEEDED */
+    } sapevt;
+} tSap_Event, *tpSap_Event;
+
+
+typedef __ani_attr_pre_packed struct sap_SSID {
+    v_U8_t       length;
+    v_U8_t       ssId[MAX_SSID_LEN];
+} __ani_attr_packed tSap_SSID_t;
+
+typedef __ani_attr_pre_packed struct sap_SSIDInfo {
+    tSap_SSID_t  ssid;       /*SSID of the AP*/
+    v_U8_t       ssidHidden; /*SSID shouldn't/should be broadcast in probe RSP and beacon*/
+} __ani_attr_packed tSap_SSIDInfo_t;
+
+typedef struct sap_Config {
+    tSap_SSIDInfo_t SSIDinfo;
+    eSapPhyMode     SapHw_mode; /* Wireless Mode */
+    eSapMacAddrACL  SapMacaddr_acl;
+    v_MACADDR_t     accept_mac[MAX_MAC_ADDRESS_ACCEPTED]; /* MAC filtering */
+    v_BOOL_t        ieee80211d;      /*Specify if 11D is enabled or disabled*/
+    v_BOOL_t        protEnabled;     /*Specify if protection is enabled or disabled*/
+    v_BOOL_t        obssProtEnabled; /*Specify if OBSS protection is enabled or disabled*/
+    v_MACADDR_t     deny_mac[MAX_MAC_ADDRESS_DENIED]; /* MAC filtering */
+    v_MACADDR_t     self_macaddr; //self macaddress or BSSID
+   
+    v_U8_t          channel;         /* Operation channel */
+    v_U8_t          max_num_sta;     /* maximum number of STAs in station table */
+    v_U8_t          dtim_period;     /* dtim interval */
+    v_U8_t          num_accept_mac;
+    v_U8_t          num_deny_mac;
+    v_U8_t          *pRSNWPAReqIE;   //If not null, it has the IE byte stream for RSN /WPA
+
+    v_U8_t          countryCode[WNI_CFG_COUNTRY_CODE_LEN];  //it is ignored if [0] is 0.
+    v_U8_t          RSNAuthType;
+    v_U8_t          RSNEncryptType;
+    v_U8_t          mcRSNEncryptType;
+    eSapAuthType    authType;
+    v_BOOL_t        privacy;
+    v_BOOL_t        UapsdEnable;
+    v_BOOL_t        fwdWPSPBCProbeReq;
+    v_U8_t          wps_state; // 0 - disabled, 1 - not configured , 2 - configured
+
+    v_U16_t         ht_capab;
+    v_U16_t         RSNWPAReqIELength;   //The byte count in the pWPAReqIE
+
+    v_U32_t         beacon_int;     /* Beacon Interval */
+    v_U32_t         ap_table_max_size;
+    v_U32_t         ap_table_expiration_time;
+    v_U32_t         ht_op_mode_fixed;
+    tVOS_CON_MODE   persona; /*Tells us which persona it is GO or AP for now*/
+
+} tsap_Config_t;
+
+typedef enum {
+    eSAP_WPS_PROBE_RSP_IE,
+    eSAP_WPS_BEACON_IE,
+    eSAP_WPS_ASSOC_RSP_IE
+} eSapWPSIE_CODE;
+
+typedef struct sSapName {
+    v_U8_t num_name;
+    v_U8_t name[MAX_NAME_SIZE];
+} tSapName;
+
+typedef struct sSapText {
+    v_U8_t num_text;
+    v_U8_t text[MAX_TEXT_SIZE];
+} tSapText;
+
+#define WPS_PROBRSP_VER_PRESENT                          0x00000001
+#define WPS_PROBRSP_STATE_PRESENT                        0x00000002
+#define WPS_PROBRSP_APSETUPLOCK_PRESENT                  0x00000004
+#define WPS_PROBRSP_SELECTEDREGISTRA_PRESENT             0x00000008
+#define WPS_PROBRSP_DEVICEPASSWORDID_PRESENT             0x00000010
+#define WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT    0x00000020
+#define WPS_PROBRSP_RESPONSETYPE_PRESENT                 0x00000040
+#define WPS_PROBRSP_UUIDE_PRESENT                        0x00000080
+#define WPS_PROBRSP_MANUFACTURE_PRESENT                  0x00000100
+#define WPS_PROBRSP_MODELNAME_PRESENT                    0x00000200
+#define WPS_PROBRSP_MODELNUMBER_PRESENT                  0x00000400
+#define WPS_PROBRSP_SERIALNUMBER_PRESENT                 0x00000800
+#define WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT            0x00001000
+#define WPS_PROBRSP_DEVICENAME_PRESENT                   0x00002000
+#define WPS_PROBRSP_CONFIGMETHODS_PRESENT                0x00004000
+#define WPS_PROBRSP_RF_BANDS_PRESENT                     0x00008000
+
+typedef struct sap_WPSProbeRspIE_s {
+    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.
+    tSapName    Manufacture;
+    tSapText    ModelName;
+    tSapText    ModelNumber;
+    tSapText    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
+    tSapText    DeviceName;
+    v_U16_t    ConfigMethod;     // Configuaration method
+    v_U8_t    RFBand;           // RF bands available on the AP
+} tSap_WPSProbeRspIE;
+
+#define WPS_BEACON_VER_PRESENT                         0x00000001
+#define WPS_BEACON_STATE_PRESENT                       0x00000002
+#define WPS_BEACON_APSETUPLOCK_PRESENT                 0x00000004
+#define WPS_BEACON_SELECTEDREGISTRA_PRESENT            0x00000008
+#define WPS_BEACON_DEVICEPASSWORDID_PRESENT            0x00000010
+#define WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT   0x00000020
+#define WPS_BEACON_UUIDE_PRESENT                       0x00000080
+#define WPS_BEACON_RF_BANDS_PRESENT                    0x00000100
+
+typedef struct sap_WPSBeaconIE_s {
+    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
+} tSap_WPSBeaconIE;
+
+#define WPS_ASSOCRSP_VER_PRESENT             0x00000001
+#define WPS_ASSOCRSP_RESPONSETYPE_PRESENT    0x00000002
+
+typedef struct sap_WPSAssocRspIE_s {
+   v_U32_t FieldPresent;
+   v_U32_t Version;
+   v_U8_t ResposeType;
+} tSap_WPSAssocRspIE;
+
+typedef struct sap_WPSIE_s {
+    eSapWPSIE_CODE sapWPSIECode;
+    union {
+               tSap_WPSProbeRspIE  sapWPSProbeRspIE;    /*WPS Set Probe Respose IE*/
+               tSap_WPSBeaconIE    sapWPSBeaconIE;      /*WPS Set Beacon IE*/
+               tSap_WPSAssocRspIE  sapWPSAssocRspIE;    /*WPS Set Assoc Response IE*/
+    } sapwpsie;
+} tSap_WPSIE, *tpSap_WPSIE;
+
+typedef struct sap_SoftapStats_s {
+   v_U32_t txUCFcnt;
+   v_U32_t txMCFcnt;
+   v_U32_t txBCFcnt;
+   v_U32_t txUCBcnt;
+   v_U32_t txMCBcnt;
+   v_U32_t txBCBcnt;
+   v_U32_t rxUCFcnt;
+   v_U32_t rxMCFcnt;
+   v_U32_t rxBCFcnt;
+   v_U32_t rxUCBcnt;
+   v_U32_t rxMCBcnt;
+   v_U32_t rxBCBcnt;
+   v_U32_t rxBcnt;
+   v_U32_t rxBcntCRCok;
+   v_U32_t rxRate;
+} tSap_SoftapStats, *tpSap_SoftapStats;
+
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Set_WpsIe
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to set WPS IE.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+  pvosGCtx: Pointer to vos global context structure
+  pWPSIE:  tSap_WPSIE structure for the station
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Set_WpsIe
+(
+    v_PVOID_t pvosGCtx, tSap_WPSIE *pWPSIe
+);
+
+/*==========================================================================
+  FUNCTION   WLANSAP_Update_WpsIe
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to start WPS session.
+
+  DEPENDENCIES
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Update_WpsIe
+(
+    v_PVOID_t pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Stop_Wps
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to stop WPS session.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Stop_Wps
+(
+    v_PVOID_t pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Get_WPS_State
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to get WPS state.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+
+    OUT
+pbWPSState: Pointer to variable to indicate if it is in WPS Registration state
+ 
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Get_WPS_State
+(
+    v_PVOID_t pvosGCtx, v_BOOL_t * pbWPSState
+); 
+
+/*----------------------------------------------------------------------------
+ *  Opaque SAP handle Type Declaration 
+ * -------------------------------------------------------------------------*/
+
+typedef v_PVOID_t tSapHandle, *ptSapHandle;
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Open
+
+  DESCRIPTION 
+    Called at driver initialization (vos_open). SAP will initialize 
+    all its internal resources and will wait for the call to start to 
+    register with the other modules. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+  pvosGCtx:       pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Open
+( 
+    v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Start
+
+  DESCRIPTION 
+    Called as part of the overall start procedure (vos_start). 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to SAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other codes can be returned as a result of a BAL failure;
+    
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Start
+( 
+    v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Stop
+
+  DESCRIPTION 
+    Called by vos_stop to stop operation in SAP, before close. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to SAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Stop
+( 
+    v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Close
+
+  DESCRIPTION 
+    Called by vos_close during general driver close procedure. SAP will clean up 
+    all the internal resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to SAP's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Close
+( 
+    v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+  FUNCTION    (*tpWLAN_SAPEventCB)
+
+  DESCRIPTION 
+    Implements the callback for ALL asynchronous events. 
+    Including Events resulting from:
+     * Start BSS 
+     * Stop BSS,...
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    pSapEvent:  pointer to the union of "Sap Event" structures. This now encodes ALL event types.
+        Including Command Complete and Command Status
+    pUsrContext   : pUsrContext parameter that was passed to sapStartBss
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to pSapEvent is NULL
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+typedef VOS_STATUS (*tpWLAN_SAPEventCB)( tpSap_Event pSapEvent, v_PVOID_t  pUsrContext);
+
+
+
+/*==========================================================================
+  FUNCTION    WLANSAP_getState
+
+  DESCRIPTION 
+    This api returns the current SAP state to the caller.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pContext            : Pointer to Sap Context structure
+
+  RETURN VALUE
+    Returns the SAP FSM state.  
+============================================================================*/
+
+v_U8_t WLANSAP_getState ( v_PVOID_t  pvosGCtx);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_StartBss
+
+  DESCRIPTION 
+    This api function provides SAP FSM event eWLAN_SAP_HDD_PHYSICAL_LINK_CREATE for
+starting AP BSS 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pConfig: Pointer to configuration structure passed down from HDD(HostApd for Android)
+hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results
+usrDataForCallback: Parameter that will be passed back in all the SAP callback events.
+
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_StartBss
+(
+    v_PVOID_t  pvosGCtx, 
+    tpWLAN_SAPEventCB pSapEventCallback, 
+    tsap_Config_t *pConfig, v_PVOID_t  pUsrContext
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Stop
+
+  DESCRIPTION 
+    This api function provides SAP FSM event eWLAN_SAP_HDD_PHYSICAL_LINK_DISCONNECT for
+stopping BSS 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS W
+
+    IN
+    pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_StopBss
+(
+    v_PVOID_t  pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_DisassocSta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD initiated disassociation of station
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx            : Pointer to vos global context structure
+    pPeerStaMac         : Mac address of the station to disassociate
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_DisassocSta
+(
+    v_PVOID_t  pvosGCtx, v_U8_t *pPeerStaMac
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_DeauthSta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD initiated deauthentication of station
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx            : Pointer to vos global context structure
+    pPeerStaMac         : Mac address of the station to deauthenticate
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_DeauthSta
+(
+    v_PVOID_t  pvosGCtx, v_U8_t *pPeerStaMac
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_SetChannelRange
+
+  DESCRIPTION 
+      This api function sets the range of channels for SoftAP.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    startChannel         : start channel
+    endChannel           : End channel
+    operatingBand        : Operating band (2.4GHz/5GHz)
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel, 
+                              v_U8_t operatingBand);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_SetKeySta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to delete key for a station.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pSetKeyInfo: tCsrRoamSetKey structure for the station
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetKeySta
+(
+    v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo
+); 
+
+/*==========================================================================
+  FUNCTION    WLANSAP_DelKeySta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to delete key for a station.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pSetKeyInfo: tCsrRoamSetKey structure for the station
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_DelKeySta
+(
+    v_PVOID_t pvosGCtx, tCsrRoamRemoveKey *pDelKeyInfo
+); 
+
+
+
+/*==========================================================================
+  FUNCTION    WLANSAP_GetAssocStations
+
+  DESCRIPTION 
+    This api function is used to probe the list of associated stations from various modules of CORE stack
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+mod: Module from whom list of associtated stations  is supposed to be probed. If an invalid module is passed
+then by default VOS_MODULE_ID_PE will be probed
+    IN/OUT
+pNoOfAssocStas:- Number of  associated stations that are known to the module specified in mod parameter
+pAssocStas: Pointer to list of associated stations that are known to the module specified in mod parameter 
+NOTE:- The memory for this list will be allocated by the caller of this API
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_GetAssocStations
+(
+    v_PVOID_t pvosGCtx, VOS_MODULE_ID module, 
+    tpSap_AssocMacAddr pAssocStas
+); 
+/*==========================================================================
+  FUNCTION    WLANSAP_RemoveWpsSessionOverlap
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to remove an entry from session session overlap info.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx: Pointer to vos global context structure
+    pRemoveMac: pointer to v_MACADDR_t for session MAC address that needs to be removed from wps session
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+    VOS_STATUS_E_FAULT:  Session is not dectected. The parameter is function not valid.
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_RemoveWpsSessionOverlap
+
+(
+    v_PVOID_t pvosGCtx,
+    v_MACADDR_t pRemoveMac
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_getWpsSessionOverlap
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to get WPS session overlap info.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pSessionMac: pointer to v_MACADDR_t for session MAC address
+uuide: Pointer to 16 bytes array for session UUID_E
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+    VOS_STATUS_E_FAULT:  Overlap is dectected. The parameter is function not valid.
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_getWpsSessionOverlap
+(
+    v_PVOID_t pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_SetCounterMeasure
+
+  DESCRIPTION 
+    This api function is used to disassociate all the stations and prevent 
+    association for any other station.Whenever Authenticator receives 2 mic failures 
+    within 60 seconds, Authenticator will enable counter measure at SAP Layer. 
+    Authenticator will start the 60 seconds timer. Core stack will not allow any 
+    STA to associate till HDD disables counter meassure. Core stack shall kick out all the 
+    STA which are currently associated and DIASSOC Event will be propogated to HDD for 
+    each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator 
+    will disable the counter meassure at core stack. Now core stack can allow STAs to associate.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE
+will come out of this state.
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetCounterMeasure
+(
+    v_PVOID_t pvosGCtx, v_BOOL_t bEnable
+);
+
+/*==========================================================================
+  FUNCTION    WLANSap_getstationIE_information
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to retrive the WPA and RSNIE of a station.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+        pLen : length of WPARSN elment IE where it would be copied
+        pBuf : buf to copy the WPARSNIe 
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSap_getstationIE_information(v_PVOID_t pvosGCtx, 
+                                 v_U32_t   *pLen,
+                                 v_U8_t    *pBuf);
+
+
+VOS_STATUS
+WLANSAP_getWpsSessionOverlap
+(
+    v_PVOID_t pvosGCtx
+);
+/*==========================================================================
+  FUNCTION    WLANSAP_ClearACL
+
+  DESCRIPTION 
+    This api function removes all the entries in both accept and deny lists.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_ClearACL
+( 
+    v_PVOID_t  pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_SetMode
+
+  DESCRIPTION 
+    This api is used to set mode for ACL
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_SetMode
+( 
+    v_PVOID_t  pvosGCtx,
+    v_U32_t mode
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_ModifyACL
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to add/remove mac addresses from black/white lists (ACLs).
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx        : Pointer to vos global context structure
+        pPeerStaMac     : MAC address to be added or removed 
+        listType        : add/remove to be done on black or white list
+        cmd             : Are we doing to add or delete a mac addr from an ACL.
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_ModifyACL
+(
+    v_PVOID_t  pvosGCtx,
+    v_U8_t *pPeerStaMac,
+    eSapACLType listType,
+    eSapACLCmdType cmd
+);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Set_WPARSNIes
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+        pWPARSNIEs: buffer to the WPA/RSN IEs 
+        WPARSNIEsLen: length of WPA/RSN IEs
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen);
+
+/*==========================================================================
+  FUNCTION    WLANSAP_GetStatistics
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to get TL statistics for all stations of Soft AP.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+        bReset: If set TL statistics will be cleared after reading
+    OUT
+        statBuf: Buffer to get the statistics
+
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset);
+
+#ifdef WLAN_FEATURE_P2P
+/*==========================================================================
+
+  FUNCTION    WLANSAP_SendAction
+
+  DESCRIPTION 
+    This api function provides to send action frame sent by upper layer.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    pBuf: Pointer of the action frame to be transmitted
+    len: Length of the action frame
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf, 
+                               tANI_U32 len );
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_RemainOnChannel
+
+  DESCRIPTION 
+    This api function provides to set Remain On channel on specified channel
+    for specified duration.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    channel: Channel on which driver has to listen 
+    duration: Duration for which driver has to listen on specified channel
+    callback: Callback function to be called once Listen is done.
+    pContext: Context needs to be called in callback function. 
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx,
+                                    tANI_U8 channel, tANI_U32 duration,
+                                    remainOnChanCallback callback, 
+                                    void *pContext );
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_CancelRemainOnChannel
+
+  DESCRIPTION 
+    This api cancel previous remain on channel request.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx );
+
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_RegisterMgmtFrame
+
+  DESCRIPTION 
+    HDD use this API to register specified type of frame with CORE stack.
+    On receiving such kind of frame CORE stack should pass this frame to HDD
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    frameType: frameType that needs to be registered with PE.
+    matchData: Data pointer which should be matched after frame type is matched.
+    matchLen: Length of the matchData
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType, 
+                                      tANI_U8* matchData, tANI_U16 matchLen );
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_DeRegisterMgmtFrame
+
+  DESCRIPTION 
+   This API is used to deregister previously registered frame. 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    frameType: frameType that needs to be De-registered with PE.
+    matchData: Data pointer which should be matched after frame type is matched.
+    matchLen: Length of the matchData
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType, 
+                                      tANI_U8* matchData, tANI_U16 matchLen );
+#endif // WLAN_FEATURE_P2P
+
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WLANSAP_H */
+
diff --git a/CORE/SAP/src/sapApiLinkCntl.c b/CORE/SAP/src/sapApiLinkCntl.c
new file mode 100644
index 0000000..e57d493
--- /dev/null
+++ b/CORE/SAP/src/sapApiLinkCntl.c
@@ -0,0 +1,620 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      s a p A p i L i n k C n t l . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN SAP modules
+  Link Control functions.
+  
+  The functions externalized by this module are to be called ONLY by other 
+  WLAN modules (HDD) 
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2010 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: /cygdrive/c/Dropbox/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_SAP_PAL/CORE/SAP/src/sapApiLinkCntl.c,v 1.7 2008/12/18 19:44:11 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2010-03-15              Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_trace.h"
+// Pick up the CSR callback definition
+#include "csrApi.h"
+#include "sme_Api.h"
+// SAP Internal API header file
+#include "sapInternal.h" 
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define SAP_DEBUG
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+  FUNCTION    WLANSAP_ScanCallback()
+
+  DESCRIPTION 
+    Callback for Scan (scan results) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    tHalHandle  : tHalHandle passed in with the scan request
+    *pContext   : The second context pass in for the caller (sapContext)
+    scanID      : scanID got after the scan
+    status      : Status of scan -success, failure or abort
+   
+  RETURN VALUE
+    The eHalStatus code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+eHalStatus
+WLANSAP_ScanCallback
+(
+  tHalHandle halHandle, 
+  void *pContext,           /* Opaque SAP handle */
+  v_U32_t scanID, 
+  eCsrScanStatus scanStatus
+)
+{
+    tScanResultHandle pResult = NULL;
+    eHalStatus scanGetResultStatus = eHAL_STATUS_FAILURE;
+    ptSapContext psapContext = (ptSapContext)pContext;
+    tWLAN_SAPEvent sapEvent; /* State machine event */
+    v_U8_t operChannel = 0;
+    VOS_STATUS sapstatus;
+#ifdef SOFTAP_CHANNEL_RANGE
+    v_U32_t operatingBand;
+#endif
+
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on scanStatus = %d", __FUNCTION__, scanStatus);
+
+    switch (scanStatus) 
+    {
+        case eCSR_SCAN_SUCCESS:
+            // sapScanCompleteCallback with eCSR_SCAN_SUCCESS
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR scanStatus = %s (%d)", __FUNCTION__, "eCSR_SCAN_SUCCESS", scanStatus);
+
+            // Get scan results, Run channel selection algorithm, select channel and keep in pSapContext->Channel
+            scanGetResultStatus = sme_ScanGetResult(halHandle, 0, NULL, &pResult);
+
+            if ((NULL == pResult) || (scanGetResultStatus != eHAL_STATUS_SUCCESS))
+            {
+                // No scan results
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, sme_ScanGetResult = NULL", __FUNCTION__);
+                break;
+            }
+
+            operChannel = sapSelectChannel(halHandle, pResult);
+            sme_ScanResultPurge(halHandle, pResult);
+            break;
+
+        default:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR scanStatus = %s (%d)", __FUNCTION__, "eCSR_SCAN_ABORT/FAILURE", scanStatus);
+    }
+    
+    if (operChannel == SAP_CHANNEL_NOT_SELECTED)
+#ifdef SOFTAP_CHANNEL_RANGE
+    {
+       if(psapContext->channelList != NULL)
+       {
+          psapContext->channel = psapContext->channelList[0];
+       }
+       else 
+       {
+         /* if the channel list is empty then there is no valid channel in 
+                the selected sub-band so select default channel in the 
+                BAND(2.4GHz/5GHZ) */
+          ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand);
+          if(RF_SUBBAND_2_4_GHZ == operatingBand )
+              psapContext->channel = SAP_DEFAULT_CHANNEL;
+          else
+              psapContext->channel = SAP_DEFAULT_5GHZ_CHANNEL;
+         
+       }
+    }
+#else
+       psapContext->channel = SAP_DEFAULT_CHANNEL;
+#endif
+    else
+    {
+      psapContext->channel = operChannel;
+    }
+    
+#ifdef SOFTAP_CHANNEL_RANGE
+    if(psapContext->channelList != NULL)
+    {
+        /* Always free up the memory for channel selection whatever 
+         * the result */
+        vos_mem_free(psapContext->channelList);
+        psapContext->channelList = NULL;
+    }
+#endif    
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Channel selected = %d", __FUNCTION__, psapContext->channel);
+
+    /* Fill in the event structure */
+    sapEvent.event = eSAP_MAC_SCAN_COMPLETE;
+    sapEvent.params = 0;        // pCsrRoamInfo;
+    sapEvent.u1 = scanStatus;   // roamstatus
+    sapEvent.u2 = 0;            // roamResult
+
+    /* Handle event */ 
+    sapstatus = sapFsm(psapContext, &sapEvent);
+
+    return sapstatus;
+}// WLANSAP_ScanCallback
+
+/*==========================================================================
+  FUNCTION    WLANSAP_RoamCallback()
+
+  DESCRIPTION 
+    Callback for Roam (connection status) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+      pContext      : pContext passed in with the roam request
+      pCsrRoamInfo  : Pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
+      eRoamCmdResult: For detail valid members. It may be NULL
+      roamId        : To identify the callback related roam request. 0 means unsolicited
+      roamStatus    : Flag indicating the status of the callback
+      roamResult    : Result
+   
+  RETURN VALUE
+    The eHalStatus code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+eHalStatus
+WLANSAP_RoamCallback
+(
+    void *pContext,           /* Opaque SAP handle */ 
+    tCsrRoamInfo *pCsrRoamInfo,
+    v_U32_t roamId, 
+    eRoamCmdStatus roamStatus, 
+    eCsrRoamResult roamResult
+)
+{
+    /* sapContext value */    
+    ptSapContext sapContext = (ptSapContext) pContext; 
+    tWLAN_SAPEvent sapEvent; /* State machine event */
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamStatus = %d\n", __FUNCTION__, roamStatus);
+    switch(roamStatus)
+    {
+        case eCSR_ROAM_SESSION_OPENED:
+        {
+            /* tHalHandle */
+            tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+
+            if (NULL == hHal)
+            {
+               VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                          "In %s invalid hHal", __FUNCTION__);
+               halStatus = eHAL_STATUS_FAILED_ALLOC;
+            }
+            else
+            {
+               VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                          "In %s calling sme_RoamConnect with eCSR_BSS_TYPE_INFRA_AP", __FUNCTION__);
+               sapContext->isSapSessionOpen = eSAP_TRUE;
+               halStatus = sme_RoamConnect(hHal, sapContext->sessionId,
+                                           &sapContext->csrRoamProfile,
+                                           &sapContext->csrRoamId);
+            }
+            break;
+        }
+
+        case eCSR_ROAM_INFRA_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                      __FUNCTION__, "eCSR_ROAM_INFRA_IND", roamStatus);
+            if(roamResult == eCSR_ROAM_RESULT_INFRA_START_FAILED)
+            {
+                /* Fill in the event structure */ 
+                sapEvent.event = eSAP_MAC_START_FAILS; 
+                sapEvent.params = pCsrRoamInfo;
+                sapEvent.u1 = roamStatus;
+                sapEvent.u2 = roamResult; 
+                
+                /* Handle event */ 
+                vosStatus = sapFsm(sapContext, &sapEvent);
+                if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+                {
+                    halStatus = eHAL_STATUS_FAILURE;
+                }
+            }
+            break;
+
+        case eCSR_ROAM_LOSTLINK:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_LOSTLINK", roamStatus);
+            break;
+
+        case eCSR_ROAM_MIC_ERROR_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                __FUNCTION__, "eCSR_ROAM_MIC_ERROR_IND", roamStatus);
+            break;
+
+        case eCSR_ROAM_SET_KEY_COMPLETE:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                __FUNCTION__, "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus);
+            if (roamResult == eCSR_ROAM_RESULT_FAILURE )
+            {
+                /* Format the SET KEY complete information pass to HDD... */
+                sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_STA_SET_KEY_EVENT,(v_PVOID_t) eSAP_STATUS_FAILURE);
+            }
+            break;
+
+        case eCSR_ROAM_REMOVE_KEY_COMPLETE:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                        __FUNCTION__, "eCSR_ROAM_REMOVE_KEY_COMPLETE", roamStatus);
+            if (roamResult == eCSR_ROAM_RESULT_FAILURE )
+            {
+                /* Format the SET KEY complete information pass to HDD... */
+                sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_STA_DEL_KEY_EVENT, (v_PVOID_t)eSAP_STATUS_FAILURE);
+            }
+            break;
+
+        case eCSR_ROAM_ASSOCIATION_COMPLETION:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_ASSOCIATION_COMPLETION", roamStatus);
+            if (roamResult == eCSR_ROAM_RESULT_FAILURE )
+            {
+                /* Format the SET KEY complete information pass to HDD... */
+                sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_STA_REASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_FAILURE);
+            }
+            break;
+
+        case eCSR_ROAM_DISASSOCIATED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_DISASSOCIATED", roamStatus);
+            if (roamResult == eCSR_ROAM_RESULT_MIC_FAILURE)
+            {
+                /* Format the MIC failure event to return... */
+                sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_STA_MIC_FAILURE_EVENT,(v_PVOID_t) eSAP_STATUS_FAILURE);
+            }
+            break;
+                        
+        case eCSR_ROAM_WPS_PBC_PROBE_REQ_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_WPS_PBC_PROBE_REQ_IND", roamStatus);
+            break;        
+
+#ifdef WLAN_FEATURE_P2P
+        case eCSR_ROAM_INDICATE_MGMT_FRAME:
+            sapSignalHDDevent(sapContext, pCsrRoamInfo, 
+                              eSAP_INDICATE_MGMT_FRAME, 
+                              (v_PVOID_t) eSAP_STATUS_SUCCESS);
+            break;
+        case eCSR_ROAM_REMAIN_CHAN_READY:
+            sapSignalHDDevent(sapContext, pCsrRoamInfo, 
+                              eSAP_REMAIN_CHAN_READY, 
+                              (v_PVOID_t) eSAP_STATUS_SUCCESS);
+            break;
+        case eCSR_ROAM_SEND_ACTION_CNF:
+            sapSignalHDDevent(sapContext, pCsrRoamInfo, 
+                            eSAP_SEND_ACTION_CNF, 
+                            (v_PVOID_t)(( roamResult == eCSR_ROAM_RESULT_NONE) ?
+                            eSAP_STATUS_SUCCESS : eSAP_STATUS_FAILURE));
+            break;
+#endif
+
+        default:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, CSR roamStatus not handled roamStatus = %s (%d)\n",
+                       __FUNCTION__, get_eRoamCmdStatus_str(roamStatus), roamStatus);
+            break;
+
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamResult = %d\n",
+               __FUNCTION__, roamResult);
+
+    switch (roamResult)
+    {
+        case eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND", roamResult);
+            sapContext->nStaWPARSnReqIeLength = pCsrRoamInfo->rsnIELen;
+             
+            if(sapContext->nStaWPARSnReqIeLength)
+                vos_mem_copy( sapContext->pStaWpaRsnReqIE,
+                              pCsrRoamInfo->prsnIE, sapContext->nStaWPARSnReqIeLength);
+
+            sapContext->nStaAddIeLength = pCsrRoamInfo->addIELen;
+             
+            if(sapContext->nStaAddIeLength)
+                vos_mem_copy( sapContext->pStaAddIE,
+                        pCsrRoamInfo->paddIE, sapContext->nStaAddIeLength);
+
+            sapContext->SapQosCfg.WmmIsEnabled = pCsrRoamInfo->wmmEnabledSta;
+            // MAC filtering
+            vosStatus = sapIsPeerMacAllowed(sapContext, (v_U8_t *)pCsrRoamInfo->peerMac);
+            
+            if ( VOS_STATUS_SUCCESS == vosStatus )
+            {
+                vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_ASSOC_IND, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+                if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+                {
+                   VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, 
+                      "In %s, CSR roamResult = (%d) MAC"
+                      "(%02X-%02X-%02X-%02X-%02X-%02X) fail",
+                      __FUNCTION__, roamResult, pCsrRoamInfo->peerMac[0],
+                      pCsrRoamInfo->peerMac[1], pCsrRoamInfo->peerMac[2],
+                      pCsrRoamInfo->peerMac[3], pCsrRoamInfo->peerMac[4],
+                      pCsrRoamInfo->peerMac[5]);
+                    halStatus = eHAL_STATUS_FAILURE;
+                }
+            }
+            else
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, 
+                   "In %s, CSR roamResult = (%d) MAC"
+                   "(%02X-%02X-%02X-%02X-%02X-%02X) not allowed",
+                   __FUNCTION__, roamResult, pCsrRoamInfo->peerMac[0],
+                   pCsrRoamInfo->peerMac[1], pCsrRoamInfo->peerMac[2],
+                   pCsrRoamInfo->peerMac[3], pCsrRoamInfo->peerMac[4], pCsrRoamInfo->peerMac[5]);
+                halStatus = eHAL_STATUS_FAILURE;
+            } 
+
+            break;
+
+        case eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __FUNCTION__, "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF", roamResult);
+
+            sapContext->nStaWPARSnReqIeLength = pCsrRoamInfo->rsnIELen;
+            if (sapContext->nStaWPARSnReqIeLength)
+                vos_mem_copy( sapContext->pStaWpaRsnReqIE,
+                              pCsrRoamInfo->prsnIE, sapContext->nStaWPARSnReqIeLength);
+
+            sapContext->nStaAddIeLength = pCsrRoamInfo->addIELen;
+            if(sapContext->nStaAddIeLength)
+                vos_mem_copy( sapContext->pStaAddIE,
+                    pCsrRoamInfo->paddIE, sapContext->nStaAddIeLength);
+
+            sapContext->SapQosCfg.WmmIsEnabled = pCsrRoamInfo->wmmEnabledSta;
+            /* Fill in the event structure */
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_ASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_DISASSOC_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND", roamResult);
+            /* Fill in the event structure */
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_DEAUTH_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_DEAUTH_IND", roamResult);
+            /* Fill in the event structure */
+            //TODO: we will use the same event inorder to inform HDD to disassociate the station
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_MIC_ERROR_GROUP:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP", roamResult);
+            /* Fill in the event structure */
+            //TODO: support for group key MIC failure event to be handled
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_MIC_FAILURE_EVENT,(v_PVOID_t) NULL);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_MIC_ERROR_UNICAST: 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST", roamResult);
+            /* Fill in the event structure */
+            //TODO: support for unicast key MIC failure event to be handled
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_MIC_FAILURE_EVENT,(v_PVOID_t) NULL);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_AUTHENTICATED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_AUTHENTICATED", roamResult);
+            /* Fill in the event structure */
+            sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_SET_KEY_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_ASSOCIATED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED", roamResult);
+            /* Fill in the event structure */
+            sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_REASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            break;
+
+        case eCSR_ROAM_RESULT_INFRA_STARTED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_INFRA_STARTED", roamResult);
+            /* Fill in the event structure */ 
+            sapEvent.event = eSAP_MAC_START_BSS_SUCCESS;
+            sapEvent.params = pCsrRoamInfo;
+            sapEvent.u1 = roamStatus;
+            sapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = sapFsm(sapContext, &sapEvent);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_INFRA_STOPPED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_INFRA_STOPPED", roamResult);
+            /* Fill in the event structure */ 
+            sapEvent.event = eSAP_MAC_READY_FOR_CONNECTIONS;
+            sapEvent.params = pCsrRoamInfo;
+            sapEvent.u1 = roamStatus;
+            sapEvent.u2 = roamResult;
+
+            /* Handle event */ 
+            vosStatus = sapFsm(sapContext, &sapEvent);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __FUNCTION__, "eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND", roamResult);
+            /* Fill in the event structure */
+            //TODO: support for group key MIC failure event to be handled
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_WPS_PBC_PROBE_REQ_EVENT,(v_PVOID_t) NULL);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_FORCED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __FUNCTION__, "eCSR_ROAM_RESULT_FORCED", roamResult);
+            //This event can be used to inform hdd about user triggered disassoc event
+            /* Fill in the event structure */
+            sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            break;
+
+        case eCSR_ROAM_RESULT_NONE:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                    __FUNCTION__, "eCSR_ROAM_RESULT_NONE", roamResult);
+            //This event can be used to inform hdd about user triggered disassoc event
+            /* Fill in the event structure */
+            if ( roamStatus == eCSR_ROAM_SET_KEY_COMPLETE)
+            {
+                sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_SET_KEY_EVENT,(v_PVOID_t) eSAP_STATUS_SUCCESS);
+            }
+            else if (roamStatus == eCSR_ROAM_REMOVE_KEY_COMPLETE )
+            {
+                sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_DEL_KEY_EVENT,(v_PVOID_t) eSAP_STATUS_SUCCESS);
+            }
+            break;
+
+        case eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                    __FUNCTION__, "eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED", roamResult);
+            /* Fill in the event structure */
+            vosStatus = sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_MAX_ASSOC_EXCEEDED, (v_PVOID_t)NULL);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+
+            break;
+        default:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, CSR roamResult = %s (%d) not handled\n",
+                       __FUNCTION__,get_eCsrRoamResult_str(roamResult),roamResult);
+            break;
+    }
+
+    return halStatus;
+}
diff --git a/CORE/SAP/src/sapChSelect.c b/CORE/SAP/src/sapChSelect.c
new file mode 100644
index 0000000..33c109d
--- /dev/null
+++ b/CORE/SAP/src/sapChSelect.c
@@ -0,0 +1,471 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      s a p C h S e l e c t . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN SAP modules
+  functions for channel selection.  
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2010 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.
+
+
+
+  when        who       what, where, why
+----------    ---       --------------------------------------------------------
+2010-03-15  SOFTAP      Created module
+
+===========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+  Include Files
+------------------------------------------------------------------------*/
+#include "vos_trace.h"
+#include "csrApi.h"
+#include "sme_Api.h"
+#include "sapChSelect.h"
+#include "sapInternal.h"
+
+/*--------------------------------------------------------------------------
+  Function definitions
+--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  Defines
+--------------------------------------------------------------------------*/
+#define SAP_DEBUG
+
+/*==========================================================================
+  FUNCTION    sapChanSelInit
+
+  DESCRIPTION 
+    Function sapChanSelInit allocates the memory, intializes the
+         structures used by the channel selection algorithm
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    *pSpectInfoParams  : Pointer to tSapChSelSpectInfo structure
+   
+  RETURN VALUE
+    v_BOOL_t:  Success or FAIL
+  
+  SIDE EFFECTS 
+============================================================================*/
+v_BOOL_t sapChanSelInit(tHalHandle halHandle, tSapChSelSpectInfo *pSpectInfoParams)
+{
+    tSapSpectChInfo *pSpectCh = NULL;
+    v_U8_t *pChans = NULL;
+    v_U16_t channelnum = 0;
+    tpAniSirGlobal pMac = PMAC_STRUCT(halHandle);
+
+    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s", __FUNCTION__);
+
+    // Channels for that 2.4GHz band
+    //Considered only for 2.4GHz need to change in future to support 5GHz support
+    pSpectInfoParams->numSpectChans = pMac->scan.base20MHzChannels.numChannels;
+       
+    // Allocate memory for weight computation of 2.4GHz
+    pSpectCh = (tSapSpectChInfo *)vos_mem_malloc((pSpectInfoParams->numSpectChans) * sizeof(*pSpectCh));
+
+    if(pSpectCh == NULL) {
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, VOS_MALLOC_ERR", __FUNCTION__);
+        return eSAP_FALSE;
+    }
+
+    vos_mem_zero(pSpectCh, (pSpectInfoParams->numSpectChans) * sizeof(*pSpectCh));
+
+    // Initialize the pointers in the DfsParams to the allocated memory
+    pSpectInfoParams->pSpectCh = pSpectCh;
+
+    pChans = pMac->scan.base20MHzChannels.channelList;
+
+    // Fill the channel number in the spectrum in the operating freq band
+    for (channelnum = 0; channelnum < pSpectInfoParams->numSpectChans; channelnum++) {
+
+        if(*pChans == 14 ) //OFDM rates are not supported on channel 14
+            continue;
+        pSpectCh->chNum = *pChans;
+        pSpectCh->valid = eSAP_TRUE;
+        pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;// Initialise for all channels
+        pSpectCh++;
+        pChans++;
+    }
+    return eSAP_TRUE;
+}
+
+/*==========================================================================
+  FUNCTION    sapweightRssiCount
+
+  DESCRIPTION 
+    Function weightRssiCount calculates the channel weight due to rssi
+         and data count(here number of BSS observed)
+         
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    rssi        : Max signal strength receieved from a BSS for the channel
+    count       : Number of BSS observed in the channel
+   
+  RETURN VALUE
+    v_U32_t     : Calculated channel weight based on above two
+  
+  SIDE EFFECTS 
+============================================================================*/
+v_U32_t sapweightRssiCount(v_S7_t rssi, v_U16_t count)
+{
+    v_S31_t     rssiWeight=0;
+    v_S31_t     countWeight=0;
+    v_U32_t     rssicountWeight=0;
+    
+    // Weight from RSSI
+    rssiWeight = SOFTAP_RSSI_WEIGHT * (rssi - SOFTAP_MIN_RSSI)
+                 /(SOFTAP_MAX_RSSI - SOFTAP_MIN_RSSI);
+                 
+    if(rssiWeight > SOFTAP_RSSI_WEIGHT)
+        rssiWeight = SOFTAP_RSSI_WEIGHT;
+    else if (rssiWeight < 0)
+        rssiWeight = 0;
+
+    // Weight from data count
+    countWeight = SOFTAP_COUNT_WEIGHT * (count - SOFTAP_MIN_COUNT)
+                  /(SOFTAP_MAX_COUNT - SOFTAP_MIN_COUNT);
+                      
+    if(countWeight > SOFTAP_COUNT_WEIGHT)
+        countWeight = SOFTAP_COUNT_WEIGHT;
+    else if (countWeight < 0)
+        countWeight = 0;
+        
+    rssicountWeight =  rssiWeight + countWeight;      
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, rssiWeight=%d, countWeight=%d, rssicountWeight=%d",
+              __FUNCTION__, rssiWeight, countWeight, rssicountWeight);
+    
+    return(rssicountWeight);
+}
+
+/*==========================================================================
+  FUNCTION    sapComputeSpectWeight
+
+  DESCRIPTION 
+    Main function for computing the weight of each channel in the
+    spectrum based on the RSSI value of the BSSes on the channel
+    and number of BSS
+    
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    pSpectInfoParams       : Pointer to the tSpectInfoParams structure
+    halHandle              : Pointer to HAL handle
+    pResult                : Pointer to tScanResultHandle
+   
+  RETURN VALUE
+    void     : NULL
+  
+  SIDE EFFECTS 
+============================================================================*/
+void sapComputeSpectWeight( tSapChSelSpectInfo* pSpectInfoParams, 
+                                 tHalHandle halHandle, tScanResultHandle pResult)
+{
+    v_S7_t rssi = 0;
+    v_U8_t chn_num = 0;
+    v_U8_t channel_id = 0;
+
+    tCsrScanResultInfo *pScanResult;
+    tSapSpectChInfo *pSpectCh   = pSpectInfoParams->pSpectCh;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Computing spectral weight", __FUNCTION__);
+
+    /**
+    * Soft AP specific channel weight calculation using DFS formula
+    */
+
+    pScanResult = sme_ScanResultGetFirst(halHandle, pResult);    
+
+    while (pScanResult) {
+        pSpectCh = pSpectInfoParams->pSpectCh;
+        // Processing for each tCsrScanResultInfo in the tCsrScanResult DLink list
+        for (chn_num = 0; chn_num < pSpectInfoParams->numSpectChans; chn_num++) {
+
+            /*
+             *  if the Beacon has channel ID, use it other wise we will 
+             *  rely on the channelIdSelf
+             */
+            if(pScanResult->BssDescriptor.channelId == 0)
+                channel_id = pScanResult->BssDescriptor.channelIdSelf;
+            else
+                channel_id = pScanResult->BssDescriptor.channelId;
+
+            if (channel_id == pSpectCh->chNum) {        
+                if (pSpectCh->rssiAgr < pScanResult->BssDescriptor.rssi)
+                    pSpectCh->rssiAgr = pScanResult->BssDescriptor.rssi;
+
+                ++pSpectCh->bssCount; // Increment the count of BSS
+
+                VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "In %s, bssdes.ch_self=%d, bssdes.ch_ID=%d, bssdes.rssi=%d, SpectCh.bssCount=%d, pScanResult=0x%x",
+                  __FUNCTION__, pScanResult->BssDescriptor.channelIdSelf, pScanResult->BssDescriptor.channelId, 
+                  pScanResult->BssDescriptor.rssi, pSpectCh->bssCount, pScanResult);
+                         
+                 pSpectCh++;
+                 break;
+           } else {
+             pSpectCh++;
+           }
+        }
+
+        pScanResult = sme_ScanResultGetNext(halHandle, pResult);
+    }
+
+    // Calculate the weights for all channels in the spectrum pSpectCh
+    pSpectCh = pSpectInfoParams->pSpectCh;
+
+    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Spectrum Channels Weight", __FUNCTION__);
+
+    for (chn_num = 0; chn_num < (pSpectInfoParams->numSpectChans); chn_num++) {
+    
+        /*
+          rssi : Maximum received signal strength among all BSS on that channel
+          bssCount : Number of BSS on that channel
+        */
+
+        rssi = (v_S7_t)pSpectCh->rssiAgr;
+
+        pSpectCh->weight = SAPDFS_NORMALISE_1000 * sapweightRssiCount(rssi, pSpectCh->bssCount);
+
+        //------ Debug Info ------ 
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Chan=%d Weight= %d rssiAgr=%d bssCount=%d", __FUNCTION__, pSpectCh->chNum,
+            pSpectCh->weight, pSpectCh->rssiAgr, pSpectCh->bssCount);
+        //------ Debug Info ------ 
+        pSpectCh++;
+    }
+}
+
+/*==========================================================================
+  FUNCTION    sapChanSelExit
+
+  DESCRIPTION 
+    Exit function for free out the allocated memory, to be called 
+    at the end of the dfsSelectChannel function
+    
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    pSpectInfoParams       : Pointer to the tSapChSelSpectInfo structure
+   
+  RETURN VALUE
+    void     : NULL
+  
+  SIDE EFFECTS 
+============================================================================*/
+void sapChanSelExit( tSapChSelSpectInfo *pSpectInfoParams )
+{
+    // Free all the allocated memory
+    vos_mem_free(pSpectInfoParams->pSpectCh);
+}
+
+/*==========================================================================
+  FUNCTION    sapSortChlWeight
+
+  DESCRIPTION 
+    Funtion to sort the channels with the least weight first
+    
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    pSpectInfoParams       : Pointer to the tSapChSelSpectInfo structure
+   
+  RETURN VALUE
+    void     : NULL
+  
+  SIDE EFFECTS 
+============================================================================*/
+void sapSortChlWeight(tSapChSelSpectInfo *pSpectInfoParams)
+{
+    tSapSpectChInfo temp;
+
+    tSapSpectChInfo *pSpectCh = NULL;
+    v_U32_t i = 0, j = 0, minWeightIndex = 0;
+
+    pSpectCh = pSpectInfoParams->pSpectCh;
+#ifdef SOFTAP_CHANNEL_RANGE
+    // Sorting the channels as per weights
+    for (i = 0; i < pSpectInfoParams->numSpectChans; i++) {
+        minWeightIndex = i;
+        for( j = i + 1; j < pSpectInfoParams->numSpectChans; j++) {
+            if(pSpectCh[j].weight < pSpectCh[minWeightIndex].weight) {
+                minWeightIndex = j; 
+            }
+        }
+        if(minWeightIndex != i) {
+            vos_mem_copy(&temp, &pSpectCh[minWeightIndex], sizeof(*pSpectCh));
+            vos_mem_copy(&pSpectCh[minWeightIndex], &pSpectCh[i], sizeof(*pSpectCh));
+            vos_mem_copy(&pSpectCh[i], &temp, sizeof(*pSpectCh));
+        }
+    }
+#else
+    // Sorting the channels as per weights
+    for (i = 0; i < SPECT_24GHZ_CH_COUNT; i++) {
+        minWeightIndex = i;
+        for( j = i + 1; j < SPECT_24GHZ_CH_COUNT; j++) {
+            if(pSpectCh[j].weight < pSpectCh[minWeightIndex].weight) {
+                minWeightIndex = j; 
+            }
+        }
+        if(minWeightIndex != i) {
+            vos_mem_copy(&temp, &pSpectCh[minWeightIndex], sizeof(*pSpectCh));
+            vos_mem_copy(&pSpectCh[minWeightIndex], &pSpectCh[i], sizeof(*pSpectCh));
+            vos_mem_copy(&pSpectCh[i], &temp, sizeof(*pSpectCh));
+        }
+    }
+#endif
+
+    /* For testing */
+    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Sorted Spectrum Channels Weight", __FUNCTION__);
+    pSpectCh = pSpectInfoParams->pSpectCh;
+    for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Channel=%d Weight= %d rssi=%d bssCount=%d",
+                    __FUNCTION__, pSpectCh->chNum, pSpectCh->weight, pSpectCh->rssiAgr, pSpectCh->bssCount);
+        pSpectCh++;
+    }
+
+}
+
+/*==========================================================================
+  FUNCTION    sapSelectChannel
+
+  DESCRIPTION 
+    Runs a algorithm to select the best channel to operate in based on BSS 
+    rssi and bss count on each channel
+    
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    halHandle       : Pointer to HAL handle
+    pResult         : Pointer to tScanResultHandle
+   
+  RETURN VALUE
+    v_U8_t          : Success - channel number, Fail - zero
+  
+  SIDE EFFECTS 
+============================================================================*/
+v_U8_t sapSelectChannel(tHalHandle halHandle, tScanResultHandle pScanResult)
+{
+    // DFS param object holding all the data req by the algo
+    tSapChSelSpectInfo oSpectInfoParams = {NULL,0}; 
+    tSapChSelSpectInfo *pSpectInfoParams = &oSpectInfoParams; // Memory? NB    
+
+    v_U8_t bestChNum = 0;
+#ifdef SOFTAP_CHANNEL_RANGE
+    v_U32_t startChannelNum;
+    v_U32_t endChannelNum;
+    v_U32_t operatingBand;
+    v_U8_t  count = 0;
+#endif    
+    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Running SAP Ch Select", __FUNCTION__);
+
+    // Set to zero tSapChSelParams
+    //vos_mem_zero(&sapChSelParams, sizeof(sapChSelParams));
+
+    // Initialize the structure pointed by pSpectInfoParams
+    if(sapChanSelInit( halHandle, pSpectInfoParams) != eSAP_TRUE ) {
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, Ch Select initialization failed", __FUNCTION__);
+        return SAP_CHANNEL_NOT_SELECTED;
+    }
+
+    // Compute the weight of the entire spectrum in the operating band
+    sapComputeSpectWeight( pSpectInfoParams, halHandle, pScanResult);
+
+    // Sort the 20M channel list as per the computed weights, lesser weight first.
+    sapSortChlWeight(pSpectInfoParams);
+
+#ifdef SOFTAP_CHANNEL_RANGE
+    ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, &startChannelNum);
+    ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, &endChannelNum);
+    ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand);
+
+    /*Loop till get the best channel in the given range */
+    for(count=0; count < pSpectInfoParams->numSpectChans ; count++)
+    {
+        if((startChannelNum <= pSpectInfoParams->pSpectCh[count].chNum)&&
+          ( endChannelNum >= pSpectInfoParams->pSpectCh[count].chNum))
+        {
+            bestChNum = (v_U8_t)pSpectInfoParams->pSpectCh[count].chNum;
+            break;
+        }
+    }
+
+#else
+    // Get the first channel in sorted array as best 20M Channel
+    bestChNum = (v_U8_t)pSpectInfoParams->pSpectCh[0].chNum;
+
+#endif
+
+    // Free all the allocated memory
+    sapChanSelExit(pSpectInfoParams);
+
+    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Running SAP Ch select Completed, Ch=%d",
+                __FUNCTION__, bestChNum);
+
+    if (bestChNum > 0 && bestChNum <= 252)
+        return bestChNum;
+    else
+        return SAP_CHANNEL_NOT_SELECTED;
+}
+
diff --git a/CORE/SAP/src/sapChSelect.h b/CORE/SAP/src/sapChSelect.h
new file mode 100644
index 0000000..af0ad75
--- /dev/null
+++ b/CORE/SAP/src/sapChSelect.h
@@ -0,0 +1,115 @@
+/*
+ * 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( __SAP_CH_SELECT_H )
+#define __SAP_CH_SELECT_H
+/*===========================================================================
+
+                      s a p C h S e l e c t . h
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN SAP modules
+  functions for channel selection.
+
+  DEPENDENCIES:   
+  
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2010 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.
+
+
+
+  when             who       what, where, why
+----------       -----    --------------------------------------------------------
+2010-03-15        SoftAP    Created module
+
+===========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+  Include Files
+------------------------------------------------------------------------*/
+#include "aniGlobal.h"
+/*--------------------------------------------------------------------------
+  defines and enum
+--------------------------------------------------------------------------*/
+
+#define SPECT_24GHZ_CH_COUNT    (11) // USA regulatory domain
+#define SAPDFS_NORMALISE_1000      (1000/9) // Case of spec20 with channel diff = 0
+/* Gen 5 values
+#define SOFTAP_MIN_RSSI         (-85)
+#define SOFTAP_MAX_RSSI         (-45)
+*/
+#define SOFTAP_MIN_RSSI         (-100)
+#define SOFTAP_MAX_RSSI         (0)
+#define SOFTAP_MIN_COUNT        (0)
+#define SOFTAP_MAX_COUNT        (60)
+#define SOFTAP_RSSI_WEIGHT      (20)
+#define SOFTAP_COUNT_WEIGHT     (20)
+
+#define SAP_DEFAULT_CHANNEL     (6)
+#define SAP_DEFAULT_5GHZ_CHANNEL      (40)
+#define SAP_CHANNEL_NOT_SELECTED (0)
+/**
+* Structure holding information of each channel in the spectrum, 
+* it contains the channel number, the computed weight
+*/
+typedef struct {
+    v_U16_t chNum;      // Channel Number
+    v_U16_t bssCount;   // bss found in scanresult for this channel
+    v_S31_t rssiAgr;    // Max value of rssi among all BSS(es) from scanresult for this channel
+    v_U32_t weight;     // Weightage of this channel
+    v_BOOL_t valid;     // Is this a valid center frequency for regulatory domain
+} tSapSpectChInfo;//tDfsSpectChInfo;
+
+/**
+* Structure holding all the information required to make a 
+* decision for the best operating channel based on dfs formula
+*/
+typedef struct {
+    tSapSpectChInfo *pSpectCh;//tDfsSpectChInfo *pSpectCh;  // Ptr to the channels in the entire spectrum band
+    v_U8_t numSpectChans;      // Total num of channels in the spectrum
+} tSapChSelSpectInfo;//tDfsChSelParams;
+
+/**
+ * Structure for channel weight calculation parameters
+ */
+typedef struct sSapChSelParams {
+    void *pSpectInfoParams;//*pDfsParams;   // Filled with tSapChSelSpectInfo
+    v_U16_t numChannels;
+} tSapChSelParams;
+
+#endif // if !defined __SAP_CH_SELECT_H
+
diff --git a/CORE/SAP/src/sapFsm.c b/CORE/SAP/src/sapFsm.c
new file mode 100644
index 0000000..13afccb
--- /dev/null
+++ b/CORE/SAP/src/sapFsm.c
@@ -0,0 +1,1347 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      s a p F s m . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN SAP Finite
+  State Machine modules  
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+
+  
+  Copyright (c) 2010 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.
+
+
+
+  when        who     what, where, why
+----------    ---    --------------------------------------------------------
+2010-03-15         Created module
+
+===========================================================================*/
+
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "sapInternal.h"
+// Pick up the SME API definitions
+#include "sme_Api.h"
+// Pick up the PMC API definitions
+#include "pmcApi.h"
+#include "wlan_nv.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+#ifdef SOFTAP_CHANNEL_RANGE
+static VOS_STATUS sapGetChannelList(ptSapContext sapContext, v_U8_t **channelList, 
+                                 v_U8_t  *numberOfChannels);
+#endif
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+  FUNCTION    sapEventInit
+
+  DESCRIPTION 
+    Function for initializing sWLAN_SAPEvent structure
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapEvent    : State machine event
+   
+  RETURN VALUE
+
+    None
+  
+  SIDE EFFECTS 
+============================================================================*/
+static inline void sapEventInit(ptWLAN_SAPEvent sapEvent)
+{
+   sapEvent->event = eSAP_MAC_SCAN_COMPLETE;
+   sapEvent->params = 0;
+   sapEvent->u1 = 0;
+   sapEvent->u2 = 0;
+}
+
+/*==========================================================================
+  FUNCTION    sapGotoChannelSel
+
+  DESCRIPTION 
+    Function for initiating scan request for SME 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    sapEvent    : State machine event
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapGotoChannelSel
+(
+    ptSapContext sapContext,
+    ptWLAN_SAPEvent sapEvent
+)
+{
+    /* Initiate a SCAN request */
+    eSapStatus sapStatus = eSAP_STATUS_SUCCESS;
+    tCsrScanRequest scanRequest;/* To be initialised if scan is required */
+    v_U32_t    scanRequestID = 0;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+#ifdef SOFTAP_CHANNEL_RANGE
+    v_U8_t     *channelList = NULL;
+    v_U8_t     numOfChannels = 0 ;
+#endif
+    tHalHandle hHal;
+    tANI_U8   channel;
+
+    hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, sapContext->pvosGCtx);
+    if (NULL == hHal)
+    {
+        /* we have a serious problem */
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
+                   "In %s, invalid hHal", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /*If STA-AP concurrency is enabled take the concurrent connected channel first. In other cases wpa_supplicant should take care */
+    if (vos_get_concurrency_mode() == VOS_STA_SAP)
+    {
+        channel = sme_GetConcurrentOperationChannel(hHal);
+
+        if (channel)
+        { /*if a valid channel is returned then use concurrent channel. 
+                  Else take whatever comes from configuartion*/
+            sapContext->channel = channel;
+        }
+    }
+    
+    if (sapContext->channel == AUTO_CHANNEL_SELECT) 
+    {
+        vos_mem_zero(&scanRequest, sizeof(scanRequest));
+
+        /* Set scanType to Passive scan */
+        scanRequest.scanType = eSIR_PASSIVE_SCAN;
+
+        /* Set min and max channel time to zero */
+        scanRequest.minChnTime = 0;
+        scanRequest.maxChnTime = 0;
+
+        /* Set BSSType to default type */
+        scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+        
+#ifndef SOFTAP_CHANNEL_RANGE        
+        /*Scan all the channels */
+        scanRequest.ChannelInfo.numOfChannels = 0;
+
+        scanRequest.ChannelInfo.ChannelList = NULL;
+
+        scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;//eCSR_SCAN_REQUEST_11D_SCAN;
+
+#else
+
+        sapGetChannelList(sapContext, &channelList, &numOfChannels);
+
+        /*Scan the channels in the list*/
+        scanRequest.ChannelInfo.numOfChannels = numOfChannels;
+        
+        scanRequest.ChannelInfo.ChannelList = channelList;
+
+        scanRequest.requestType = eCSR_SCAN_SOFTAP_CHANNEL_RANGE;
+
+        sapContext->channelList = channelList;
+        
+#endif
+        /* Set requestType to Full scan */
+
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, calling sme_ScanRequest", __FUNCTION__);
+
+        sapStatus = sme_ScanRequest(hHal,
+                            0,//Not used in csrScanRequest
+                            &scanRequest,
+                            &scanRequestID,//, when ID == 0 11D scan/active scan with callback, min-maxChntime set in csrScanRequest()?
+                            &WLANSAP_ScanCallback,//csrScanCompleteCallback callback,
+                            sapContext);//void * pContext scanRequestID filled up
+        if (!VOS_IS_STATUS_SUCCESS(sapStatus))
+        {
+            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "%s:sme_ScanRequest  fail %d!!!", __FUNCTION__, sapStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "SoftAP Configuring for default channel, Ch= %d", sapContext->channel);
+            /* In case of error, switch to default channel */
+            sapContext->channel = SAP_DEFAULT_CHANNEL;
+
+#ifdef SOFTAP_CHANNEL_RANGE
+            if(sapContext->channelList != NULL)
+            {
+                sapContext->channel = sapContext->channelList[0];
+                vos_mem_free(sapContext->channelList);
+                sapContext->channelList = NULL;
+            }
+#endif
+            /* Fill in the event structure */
+            sapEventInit(sapEvent);
+            /* Handle event */
+            vosStatus = sapFsm(sapContext, sapEvent);
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, return from sme_ScanRequest, scanRequestID=%d, Ch= %d",
+                   __FUNCTION__, scanRequestID, sapContext->channel);
+        }
+
+    }
+    else 
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, for configured channel, Ch= %d", __FUNCTION__, sapContext->channel);
+        /* Fill in the event structure */
+        // Eventhough scan was not done, means a user set channel was chosen
+        sapEventInit(sapEvent);
+        /* Handle event */
+        vosStatus = sapFsm(sapContext, sapEvent);
+    }
+
+    /* If scan failed, get default channel and advance state machine as success with default channel */
+    /* Have to wait for the call back to be called to get the channel cannot advance state machine here as said above */
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before exiting sapGotoChannelSel channel=%d", __FUNCTION__, sapContext->channel);
+
+    return VOS_STATUS_SUCCESS;
+}// sapGotoChannelSel
+
+/*==========================================================================
+  FUNCTION    sapGotoStarting
+
+  DESCRIPTION 
+    Function for initiating start bss request for SME
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    sapEvent    : State machine event
+    bssType     : Type of bss to start, INRA AP
+    status      : Return the SAP status here
+
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapGotoStarting
+( 
+    ptSapContext sapContext,
+    ptWLAN_SAPEvent sapEvent,
+    eCsrRoamBssType bssType
+)
+{
+    /* tHalHandle */    
+    tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+    eHalStatus halStatus;
+    
+    /*- - - - - - - - TODO:once configs from hdd available - - - - - - - - -*/
+    char key_material[32]={ 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,}; 
+    sapContext->key_type = 0x05;
+    sapContext->key_length = 32;
+    vos_mem_copy(sapContext->key_material, key_material, sizeof(key_material));  /* Need a key size define */
+    
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s", __FUNCTION__);
+    if (NULL == hHal)
+    {
+        /* we have a serious problem */
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
+                   "In %s, invalid hHal", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    //TODO: What shall we do if failure????
+    halStatus = pmcRequestFullPower( hHal, 
+                            WLANSAP_pmcFullPwrReqCB, 
+                            sapContext,
+                            eSME_REASON_OTHER);
+
+    /* Open SME Session for Softap */
+    halStatus = sme_OpenSession(hHal,
+                        &WLANSAP_RoamCallback, 
+                        sapContext,
+                        sapContext->self_mac_addr,  
+                        &sapContext->sessionId);
+
+    if(eHAL_STATUS_SUCCESS != halStatus )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Error: In %s calling sme_RoamConnect status = %d", __FUNCTION__, halStatus);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    return VOS_STATUS_SUCCESS;
+}// sapGotoStarting
+
+/*==========================================================================
+  FUNCTION    sapGotoDisconnecting
+
+  DESCRIPTION 
+    Processing of SAP FSM Disconnecting state
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    status      : Return the SAP status here
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapGotoDisconnecting
+(
+    ptSapContext sapContext
+)
+{
+    eHalStatus halStatus;
+    tHalHandle hHal;
+
+    hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+    if (NULL == hHal)
+    {
+        /* we have a serious problem */
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "In %s, invalid hHal", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    sapFreeRoamProfile(&sapContext->csrRoamProfile);
+    halStatus = sme_RoamStopBss(hHal, sapContext->sessionId);
+    if(eHAL_STATUS_SUCCESS != halStatus )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Error: In %s calling sme_RoamStopBss status = %d", __FUNCTION__, halStatus);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+static eHalStatus sapRoamSessionCloseCallback(void *pContext)
+{
+    ptSapContext sapContext = (ptSapContext)pContext;
+    return sapSignalHDDevent(sapContext, NULL, 
+                    eSAP_STOP_BSS_EVENT, (v_PVOID_t) eSAP_STATUS_SUCCESS);
+}
+
+/*==========================================================================
+  FUNCTION    sapGotoDisconnected
+
+  DESCRIPTION 
+    Function for setting the SAP FSM to Disconnection state
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    sapEvent    : State machine event
+    status      : Return the SAP status here
+
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapGotoDisconnected
+(
+    ptSapContext sapContext
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+    tWLAN_SAPEvent sapEvent;
+    // Processing has to be coded
+    // Clean up stations from TL etc as AP BSS is shut down then set event
+    sapEvent.event = eSAP_MAC_READY_FOR_CONNECTIONS;// hardcoded
+    sapEvent.params = 0;
+    sapEvent.u1 = 0;
+    sapEvent.u2 = 0;
+    /* Handle event */
+    vosStatus = sapFsm(sapContext, &sapEvent);
+            
+    return vosStatus;
+}
+
+/*==========================================================================
+  FUNCTION    sapSignalHDDevent
+
+  DESCRIPTION 
+    Function for HDD to send the event notification using callback
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    pCsrRoamInfo : Pointer to CSR roam information
+    sapHddevent      : SAP HDD event
+    context          : to pass the element for future support 
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapSignalHDDevent 
+( 
+    ptSapContext sapContext, /* sapContext value */
+    tCsrRoamInfo *pCsrRoamInfo,
+    eSapHddEvent sapHddevent,
+    void         *context
+)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tSap_Event sapApAppEvent; /* This now encodes ALL event types */
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /* Format the Start BSS Complete event to return... */
+    VOS_ASSERT(sapContext->pfnSapEventCallback);
+
+    switch (sapHddevent)
+    {
+        case eSAP_STA_ASSOC_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "TODO: Indicate the assoc request indication to OS\n");
+            sapApAppEvent.sapHddEventCode = eSAP_STA_ASSOC_IND;
+
+            vos_mem_copy( &sapApAppEvent.sapevt.sapAssocIndication.staMac, pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
+            sapApAppEvent.sapevt.sapAssocIndication.staId = pCsrRoamInfo->staId;
+            sapApAppEvent.sapevt.sapAssocIndication.status = 0;
+            // Required for indicating the frames to upper layer
+            sapApAppEvent.sapevt.sapAssocIndication.beaconLength = pCsrRoamInfo->beaconLength;
+            sapApAppEvent.sapevt.sapAssocIndication.beaconPtr = pCsrRoamInfo->beaconPtr;
+            sapApAppEvent.sapevt.sapAssocIndication.assocReqLength = pCsrRoamInfo->assocReqLength;
+            sapApAppEvent.sapevt.sapAssocIndication.assocReqPtr = pCsrRoamInfo->assocReqPtr;
+            sapApAppEvent.sapevt.sapAssocIndication.fWmmEnabled = pCsrRoamInfo->wmmEnabledSta;
+            if ( pCsrRoamInfo->u.pConnectedProfile != NULL )
+            {
+               sapApAppEvent.sapevt.sapAssocIndication.negotiatedAuthType = pCsrRoamInfo->u.pConnectedProfile->AuthType;
+               sapApAppEvent.sapevt.sapAssocIndication.negotiatedUCEncryptionType = pCsrRoamInfo->u.pConnectedProfile->EncryptionType;
+               sapApAppEvent.sapevt.sapAssocIndication.negotiatedMCEncryptionType = pCsrRoamInfo->u.pConnectedProfile->mcEncryptionType;
+               sapApAppEvent.sapevt.sapAssocIndication.fAuthRequired = pCsrRoamInfo->fAuthRequired;
+            }  
+            break;
+       case eSAP_START_BSS_EVENT:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                __FUNCTION__, "eSAP_START_BSS_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_START_BSS_EVENT;
+            sapApAppEvent.sapevt.sapStartBssCompleteEvent.status = (eSapStatus )context;
+            if(pCsrRoamInfo != NULL ){
+                sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId = pCsrRoamInfo->staId;
+            }
+            else
+                sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId = 0;              
+            sapApAppEvent.sapevt.sapStartBssCompleteEvent.operatingChannel = (v_U8_t)sapContext->channel;
+            break;
+
+        case eSAP_STOP_BSS_EVENT:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_STOP_BSS_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_STOP_BSS_EVENT;
+            sapApAppEvent.sapevt.sapStopBssCompleteEvent.status = (eSapStatus )context;
+            break;
+
+        case eSAP_STA_ASSOC_EVENT:
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                __FUNCTION__, "eSAP_STA_ASSOC_EVENT");
+            if (pCsrRoamInfo->fReassocReq)
+                sapApAppEvent.sapHddEventCode = eSAP_STA_REASSOC_EVENT;
+            else
+                sapApAppEvent.sapHddEventCode = eSAP_STA_ASSOC_EVENT;
+
+            //TODO: Need to fill the SET KEY information and pass to HDD
+            vos_mem_copy( &sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.staMac,
+                         pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));  
+            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.staId = pCsrRoamInfo->staId ; 
+            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.statusCode = pCsrRoamInfo->statusCode;
+            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen = pCsrRoamInfo->rsnIELen;
+            vos_mem_copy(sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.ies, pCsrRoamInfo->prsnIE, 
+                        pCsrRoamInfo->rsnIELen);
+           
+            if(pCsrRoamInfo->addIELen) 
+            {
+                v_U8_t  len = sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen;
+                sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen 
+                                                        += pCsrRoamInfo->addIELen;
+                vos_mem_copy(&sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.ies[len], pCsrRoamInfo->paddIE, 
+                            pCsrRoamInfo->addIELen);
+            }
+
+            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled = pCsrRoamInfo->wmmEnabledSta;
+            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.status = (eSapStatus )context;
+            //TODO: Need to fill sapAuthType
+            //sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.SapAuthType = pCsrRoamInfo->pProfile->negotiatedAuthType; 
+            break;
+        }
+
+        case eSAP_STA_DISASSOC_EVENT:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_STA_DISASSOC_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_STA_DISASSOC_EVENT;
+        
+            vos_mem_copy( &sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.staMac,
+                          pCsrRoamInfo->peerMac, sizeof(tSirMacAddr));  
+            sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.staId = pCsrRoamInfo->staId;
+            if (pCsrRoamInfo->reasonCode == eCSR_ROAM_RESULT_FORCED)
+                sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.reason = eSAP_USR_INITATED_DISASSOC;
+            else
+                sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.reason = eSAP_MAC_INITATED_DISASSOC;
+
+            sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.statusCode = pCsrRoamInfo->statusCode;
+            sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.status = (eSapStatus )context;
+            break;
+
+        case eSAP_STA_SET_KEY_EVENT:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_STA_SET_KEY_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_STA_SET_KEY_EVENT;
+            sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.status = (eSapStatus )context;
+            vos_mem_copy(&sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.peerMacAddr,
+                         pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
+            break;
+
+        case eSAP_STA_DEL_KEY_EVENT :
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_STA_DEL_KEY_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_STA_DEL_KEY_EVENT;
+            sapApAppEvent.sapevt.sapStationDeleteKeyCompleteEvent.status = (eSapStatus )context;
+            //TODO: Should we need to send the key information
+            //sapApAppEvent.sapevt.sapStationDeleteKeyCompleteEvent.keyId = ;
+            break;
+
+        case eSAP_STA_MIC_FAILURE_EVENT :
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                        __FUNCTION__, "eSAP_STA_MIC_FAILURE_EVENT");
+            sapApAppEvent.sapHddEventCode = eSAP_STA_MIC_FAILURE_EVENT;
+            vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.srcMacAddr,
+                          pCsrRoamInfo->u.pMICFailureInfo->srcMacAddr,
+                          sizeof(tSirMacAddr));
+            vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.staMac,
+                          pCsrRoamInfo->u.pMICFailureInfo->taMacAddr,
+                          sizeof(tSirMacAddr));
+            vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.dstMacAddr,
+                          pCsrRoamInfo->u.pMICFailureInfo->dstMacAddr,
+                          sizeof(tSirMacAddr));
+            sapApAppEvent.sapevt.sapStationMICFailureEvent.multicast = pCsrRoamInfo->u.pMICFailureInfo->multicast;
+            sapApAppEvent.sapevt.sapStationMICFailureEvent.IV1 = pCsrRoamInfo->u.pMICFailureInfo->IV1;
+            sapApAppEvent.sapevt.sapStationMICFailureEvent.keyId = pCsrRoamInfo->u.pMICFailureInfo->keyId;
+            vos_mem_copy( sapApAppEvent.sapevt.sapStationMICFailureEvent.TSC,
+                          pCsrRoamInfo->u.pMICFailureInfo->TSC,
+                          SIR_CIPHER_SEQ_CTR_SIZE);
+            break;            
+
+        case eSAP_ASSOC_STA_CALLBACK_EVENT:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_ASSOC_STA_CALLBACK_EVENT");
+            break;
+            
+        case eSAP_WPS_PBC_PROBE_REQ_EVENT:
+            sapApAppEvent.sapHddEventCode = eSAP_WPS_PBC_PROBE_REQ_EVENT;
+                        
+            vos_mem_copy( &sapApAppEvent.sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq,
+                          pCsrRoamInfo->u.pWPSPBCProbeReq,
+                          sizeof(tSirWPSPBCProbeReq));  
+            break;
+
+#ifdef WLAN_FEATURE_P2P
+       case eSAP_INDICATE_MGMT_FRAME:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                                 "In %s, SAP event callback event = %s",
+                                __FUNCTION__, "eSAP_INDICATE_MGMT_FRAME");
+            sapApAppEvent.sapHddEventCode = eSAP_INDICATE_MGMT_FRAME;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.nFrameLength
+                                           = pCsrRoamInfo->nFrameLength;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.pbFrames
+                                           = pCsrRoamInfo->pbFrames;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.frameType
+                                           = pCsrRoamInfo->frameType;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.rxChan
+                                           = pCsrRoamInfo->rxChan;
+
+            break;
+       case eSAP_REMAIN_CHAN_READY:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                                 "In %s, SAP event callback event = %s",
+                                __FUNCTION__, "eSAP_REMAIN_CHAN_READY");
+           sapApAppEvent.sapHddEventCode = eSAP_REMAIN_CHAN_READY;
+            break;
+       case eSAP_SEND_ACTION_CNF:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                                 "In %s, SAP event callback event = %s",
+                                __FUNCTION__, "eSAP_SEND_ACTION_CNF");
+            sapApAppEvent.sapHddEventCode = eSAP_SEND_ACTION_CNF;
+            sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context; 
+            break;
+#endif
+
+        case eSAP_UNKNOWN_STA_JOIN:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                       "In %s, SAP event callback event = %s",
+                       __FUNCTION__, "eSAP_UNKNOWN_STA_JOIN");
+            sapApAppEvent.sapHddEventCode = eSAP_UNKNOWN_STA_JOIN;
+            vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapUnknownSTAJoin.macaddr.bytes, 
+                         (v_PVOID_t)context, sizeof(v_MACADDR_t));
+            break;
+
+        case eSAP_MAX_ASSOC_EXCEEDED:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "In %s, SAP event callback event = %s",
+                    __FUNCTION__, "eSAP_MAX_ASSOC_EXCEEDED");
+            sapApAppEvent.sapHddEventCode = eSAP_MAX_ASSOC_EXCEEDED;
+            vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapMaxAssocExceeded.macaddr.bytes, 
+                    (v_PVOID_t)pCsrRoamInfo->peerMac, sizeof(v_MACADDR_t));
+            break;
+
+        default:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, SAP Unknown callback event = %d",
+                       __FUNCTION__,sapHddevent);
+            break;
+    }
+    vosStatus = (*sapContext->pfnSapEventCallback)
+                (
+                 &sapApAppEvent,
+                 sapContext->pUsrContext//userdataforcallback - hdd opaque handle
+                 );
+                 
+    return vosStatus;
+
+} /* sapSignalApAppStartBssEvent */
+
+/*==========================================================================
+  FUNCTION    sapFsm
+
+  DESCRIPTION 
+    SAP State machine entry function
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    sapContext  : Sap Context value
+    sapEvent    : State machine event
+    status      : Return the SAP status here
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS: Success
+  
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS
+sapFsm
+(
+    ptSapContext sapContext,    /* sapContext value */    
+    ptWLAN_SAPEvent sapEvent   /* State machine event */
+)
+{
+   /* Retrieve the phy link state machine structure 
+     * from the sapContext value
+     */
+    eSapFsmStates_t stateVar = sapContext->sapsMachine; /*state var that keeps track of state machine*/
+    tCsrRoamInfo    *roamInfo = (tCsrRoamInfo *)(sapEvent->params);
+    v_U32_t msg = sapEvent->event;  /* State machine input event message */
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+
+    switch (stateVar)
+    {
+        case eSAP_DISCONNECTED:
+            if ((msg == eSAP_HDD_START_INFRA_BSS))
+            {
+                /* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, new from state %s => %s",
+                            __FUNCTION__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT");
+
+                /* There can be one SAP Session for softap */
+                if (sapContext->isSapSessionOpen == eSAP_TRUE) 
+                {
+                   VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
+                        "%s:SME Session is already opened\n",__FUNCTION__);
+                   return VOS_STATUS_E_EXISTS;
+                }
+
+                sapContext->sessionId = 0xff;
+
+                /* Set SAP device role */
+                sapContext->sapsMachine = eSAP_CH_SELECT;
+
+                /* Perform sme_ScanRequest */
+                vosStatus = sapGotoChannelSel(sapContext, sapEvent);
+                
+                /* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                           __FUNCTION__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT");
+            } 
+            else 
+            {
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, event msg %d",
+                             __FUNCTION__, "eSAP_DISCONNECTED", msg);
+            }
+            break;
+
+        case eSAP_CH_SELECT:
+            if (msg == eSAP_MAC_SCAN_COMPLETE) 
+            {
+                 /* Transition from eSAP_CH_SELECT to eSAP_STARTING (both without substates) */
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                            __FUNCTION__, "eSAP_CH_SELECT", "eSAP_STARTING");
+                 // Channel selected. Now can sapGotoStarting
+                 sapContext->sapsMachine = eSAP_STARTING;
+                 // Specify the channel
+                 sapContext->csrRoamProfile.ChannelInfo.numOfChannels = 1;
+                 sapContext->csrRoamProfile.ChannelInfo.ChannelList = &sapContext->csrRoamProfile.operationChannel;
+                 sapContext->csrRoamProfile.operationChannel = (tANI_U8)sapContext->channel;
+                 vosStatus = sapGotoStarting( sapContext, sapEvent, eCSR_BSS_TYPE_INFRA_AP);
+                 /* Transition from eSAP_CH_SELECT to eSAP_STARTING (both without substates) */
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                             __FUNCTION__, "eSAP_CH_SELECT", "eSAP_STARTING");
+            }
+            else
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, invalid event msg %d",
+                            __FUNCTION__, "eSAP_CH_SELECT", msg);
+            }
+            break;
+
+        case eSAP_STARTING:
+            if (msg == eSAP_MAC_START_BSS_SUCCESS ) 
+            {
+                /* Transition from eSAP_STARTING to eSAP_STARTED (both without substates) */
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state channel = %d %s => %s",
+                            __FUNCTION__,sapContext->channel, "eSAP_STARTING", "eSAP_STARTED");
+
+                 sapContext->sapsMachine = eSAP_STARTED;
+                 /*Action code for transition */
+                 vosStatus = sapSignalHDDevent( sapContext, roamInfo, eSAP_START_BSS_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+
+                 /* Transition from eSAP_STARTING to eSAP_STARTED (both without substates) */
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                            __FUNCTION__, "eSAP_STARTING", "eSAP_STARTED");
+             }
+             else if (msg == eSAP_MAC_START_FAILS) 
+             {
+                 /*Transition from STARTING to DISCONNECTED (both without substates)*/                         
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                            __FUNCTION__, "eSAP_STARTING", "eSAP_DISCONNECTED");
+                
+                 /*Action code for transition */
+                 vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT,(v_PVOID_t) eSAP_STATUS_FAILURE);
+                 vosStatus =  sapGotoDisconnected(sapContext);
+
+                 /*Advance outer statevar */
+                 sapContext->sapsMachine = eSAP_DISCONNECTED;
+             }
+             else if (msg == eSAP_HDD_STOP_INFRA_BSS)
+             {
+                 /*Transition from eSAP_STARTING to eSAP_DISCONNECTING (both without substates)*/        
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                             __FUNCTION__, "eSAP_STARTING", "eSAP_DISCONNECTING");
+
+                 /*Advance outer statevar */
+                 sapContext->sapsMachine = eSAP_DISCONNECTED;
+                 vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT, (v_PVOID_t)eSAP_STATUS_FAILURE);
+                 vosStatus = sapGotoDisconnected(sapContext);
+                 /* Close the SME session*/
+
+                 if (eSAP_TRUE == sapContext->isSapSessionOpen) 
+                 {
+                    tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+                    if (NULL == hHal)
+                    {
+                       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                                  "In %s, NULL hHal in state %s, msg %d",
+                                  __FUNCTION__, "eSAP_STARTING", msg);
+                    }
+                    else if (eHAL_STATUS_SUCCESS == 
+                         sme_CloseSession(hHal,
+                                         sapContext->sessionId, NULL, NULL))
+                     {
+                         sapContext->isSapSessionOpen = eSAP_FALSE;
+                     }
+                 }
+             }
+             else 
+             {
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                             "In %s, in state %s, invalid event msg %d",
+                             __FUNCTION__, "eSAP_STARTING", msg);
+                 /* Intentionally left blank */
+             }
+             break;
+
+        case eSAP_STARTED:
+            if (msg == eSAP_HDD_STOP_INFRA_BSS)
+            {
+                /* Transition from eSAP_STARTED to eSAP_DISCONNECTING (both without substates) */
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                           __FUNCTION__, "eSAP_STARTED", "eSAP_DISCONNECTING");
+                sapContext->sapsMachine = eSAP_DISCONNECTING;
+                vosStatus = sapGotoDisconnecting(sapContext);
+            }
+            else
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, invalid event msg %d",
+                           __FUNCTION__, "eSAP_STARTED", msg);
+            }
+            break;
+
+        case eSAP_DISCONNECTING:
+            if (msg == eSAP_MAC_READY_FOR_CONNECTIONS)
+            {
+                /* Transition from eSAP_DISCONNECTING to eSAP_DISCONNECTED (both without substates) */
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
+                          __FUNCTION__, "eSAP_DISCONNECTING", "eSAP_DISCONNECTED");
+
+                sapContext->sapsMachine = eSAP_DISCONNECTED;
+                /* Close the SME session*/
+                if (eSAP_TRUE == sapContext->isSapSessionOpen) 
+                {
+                    tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+
+                    if (NULL == hHal)
+                    {
+                        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                                   "In %s, NULL hHal in state %s, msg %d",
+                                   __FUNCTION__, "eSAP_DISCONNECTING", msg);
+                    }
+                    else
+                    {
+                        sapContext->isSapSessionOpen = eSAP_FALSE;
+                        if (!HAL_STATUS_SUCCESS(
+                            sme_CloseSession(hHal,
+                                     sapContext->sessionId,
+                                     sapRoamSessionCloseCallback, sapContext)))
+                        {
+                            vosStatus = sapSignalHDDevent(sapContext, NULL,
+                                              eSAP_STOP_BSS_EVENT, 
+                                              (v_PVOID_t) eSAP_STATUS_SUCCESS);
+                        }
+                    }
+                }
+            }
+            else 
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, 
+                           "In %s, in state %s, invalid event msg %d",
+                          __FUNCTION__, "eSAP_DISCONNECTING", msg);
+            }
+            break;
+      }
+      return vosStatus;
+}// sapFsm
+
+
+eSapStatus
+sapconvertToCsrProfile(tsap_Config_t *pconfig_params, eCsrRoamBssType bssType, tCsrRoamProfile *profile)
+{
+    //Create Roam profile for SoftAP to connect
+    profile->BSSType = eCSR_BSS_TYPE_INFRA_AP;
+    profile->SSIDs.numOfSSIDs = 1;
+    profile->csrPersona = pconfig_params->persona;
+
+    vos_mem_zero(profile->SSIDs.SSIDList[0].SSID.ssId, 
+                 sizeof(profile->SSIDs.SSIDList[0].SSID.ssId));
+
+    //Flag to not broadcast the SSID information
+    profile->SSIDs.SSIDList[0].ssidHidden =  pconfig_params->SSIDinfo.ssidHidden;
+
+    profile->SSIDs.SSIDList[0].SSID.length = pconfig_params->SSIDinfo.ssid.length;
+    vos_mem_copy(&profile->SSIDs.SSIDList[0].SSID.ssId, pconfig_params->SSIDinfo.ssid.ssId,
+                  sizeof(pconfig_params->SSIDinfo.ssid.ssId));
+
+    profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+    if (pconfig_params->authType == eSAP_OPEN_SYSTEM)
+    {
+        profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+    }
+    else if (pconfig_params->authType == eSAP_SHARED_KEY)
+    {
+        profile->negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY;
+    }
+    else
+    {
+        profile->negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH;
+    }
+
+    profile->AuthType.numEntries = 1;
+    profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+    //Always set the Encryption Type
+    profile->EncryptionType.numEntries = 1;
+    profile->EncryptionType.encryptionType[0] = pconfig_params->RSNEncryptType;
+
+    profile->mcEncryptionType.numEntries = 1;
+    profile->mcEncryptionType.encryptionType[0] = pconfig_params->mcRSNEncryptType;
+
+    if (pconfig_params->privacy & eSAP_SHARED_KEY)
+    {
+        profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;
+    }
+
+    profile->privacy = pconfig_params->privacy;
+    profile->fwdWPSPBCProbeReq = pconfig_params->fwdWPSPBCProbeReq;
+
+    if (pconfig_params->authType == eSAP_SHARED_KEY)
+    {
+        profile->csr80211AuthType = eSIR_SHARED_KEY;
+    }
+    else if (pconfig_params->authType == eSAP_OPEN_SYSTEM)
+    {
+        profile->csr80211AuthType = eSIR_OPEN_SYSTEM;
+    }
+    else
+    {
+        profile->csr80211AuthType = eSIR_AUTO_SWITCH; 
+    }
+
+    //Initialize we are not going to use it 
+    profile->pWPAReqIE = NULL;
+    profile->nWPAReqIELength = 0;
+
+    //set the RSN/WPA IE
+    profile->pRSNReqIE = NULL;
+    profile->nRSNReqIELength = pconfig_params->RSNWPAReqIELength; 
+    if (pconfig_params->RSNWPAReqIELength)
+    {
+        profile->pRSNReqIE = vos_mem_malloc(pconfig_params->RSNWPAReqIELength);
+        if( NULL == profile->pRSNReqIE )
+        {
+           VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, " %s Fail to alloc memory", __FUNCTION__);
+           return eSAP_STATUS_FAILURE;
+        }
+        vos_mem_copy(profile->pRSNReqIE, pconfig_params->pRSNWPAReqIE, pconfig_params->RSNWPAReqIELength);
+        profile->nRSNReqIELength = pconfig_params->RSNWPAReqIELength; 
+    }
+
+    // Turn off CB mode
+    profile->CBMode = eCSR_CB_OFF;
+
+    //set the phyMode to accept anything
+    //Best means everything because it covers all the things we support
+    profile->phyMode = pconfig_params->SapHw_mode; /*eCSR_DOT11_MODE_BEST*/
+
+    //Configure beaconInterval
+    profile->beaconInterval = (tANI_U16)pconfig_params->beacon_int;
+
+    // set DTIM period
+    profile->dtimPeriod = pconfig_params->dtim_period;
+
+    //set Uapsd enable bit
+    profile->ApUapsdEnable = pconfig_params->UapsdEnable;
+
+    //Enable protection parameters
+    profile->protEnabled       = pconfig_params->protEnabled;
+    profile->obssProtEnabled   = pconfig_params->obssProtEnabled;
+    profile->cfg_protection    = pconfig_params->ht_capab;
+
+    //country code
+    if (pconfig_params->countryCode[0])
+        vos_mem_copy(profile->countryCode, pconfig_params->countryCode, WNI_CFG_COUNTRY_CODE_LEN); 
+#ifdef WLAN_SOFTAP_FEATURE
+    profile->ieee80211d = pconfig_params->ieee80211d;
+#endif
+    //wps config info
+    profile->wps_state = pconfig_params->wps_state;
+
+    return eSAP_STATUS_SUCCESS; /* Success.  */
+}
+
+
+void sapFreeRoamProfile(tCsrRoamProfile *profile)
+{
+   if(profile->pRSNReqIE)
+   {
+      vos_mem_free(profile->pRSNReqIE);
+      profile->pRSNReqIE = NULL;
+   }
+}
+
+
+void
+sapSortMacList(v_MACADDR_t *macList, v_U8_t size)
+{
+    v_U8_t outer, inner;
+    v_MACADDR_t temp;
+    v_SINT_t nRes = -1;
+
+    for(outer = 0; outer < size; outer++)
+    {
+        for(inner = 0; inner < size - 1; inner++)
+        {
+            nRes = vos_mem_compare2((macList + inner)->bytes, (macList + inner + 1)->bytes, sizeof(v_MACADDR_t));
+            if (nRes > 0)
+            {
+                vos_mem_copy(temp.bytes, (macList + inner + 1)->bytes, sizeof(v_MACADDR_t));
+                vos_mem_copy((macList + inner + 1)->bytes, (macList + inner)->bytes, sizeof(v_MACADDR_t));
+                vos_mem_copy((macList + inner)->bytes, temp.bytes, sizeof(v_MACADDR_t));
+             }
+        }
+    }
+}
+
+eSapBool
+sapSearchMacList(v_MACADDR_t *macList, v_U8_t num_mac, v_U8_t *peerMac, v_U8_t *index)
+{
+    v_SINT_t nRes = -1;
+    v_S7_t nStart = 0, nEnd, nMiddle;
+    nEnd = num_mac - 1;
+
+    while (nStart <= nEnd)
+    {
+        nMiddle = (nStart + nEnd) / 2;
+        nRes = vos_mem_compare2(&macList[nMiddle], peerMac, sizeof(v_MACADDR_t));
+
+        if (0 == nRes)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "search SUCC");
+            // "index equals NULL" means the caller does not need the
+            // index value of the peerMac being searched
+            if (index != NULL) 
+            {
+                *index = (v_U8_t) nMiddle;
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                        "index %d", *index);
+            }
+            return eSAP_TRUE;
+        }
+        if (nRes < 0)
+            nStart = nMiddle + 1;
+        else
+            nEnd = nMiddle - 1;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+            "search not succ");
+    return eSAP_FALSE;
+}
+
+void
+sapAddMacToACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t *peerMac)
+{
+    v_SINT_t nRes = -1;
+    int i;
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"add acl entered");
+    for (i=((*size)-1); i>=0; i--)
+    {
+        nRes = vos_mem_compare2(&macList[i], peerMac, sizeof(v_MACADDR_t));
+        if (nRes > 0)
+        {
+            /* Move alphabetically greater mac addresses one index down to allow for insertion
+               of new mac in sorted order */
+            vos_mem_copy((macList+i+1)->bytes,(macList+i)->bytes, sizeof(v_MACADDR_t));
+        }
+        else
+        {
+            break;
+        }
+    }
+    //This should also take care of if the element is the first to be added in the list
+    vos_mem_copy((macList+i+1)->bytes, peerMac, sizeof(v_MACADDR_t));
+    // increment the list size
+    (*size)++;
+}
+
+void
+sapRemoveMacFromACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t index)    
+{
+    int i;
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"remove acl entered");
+    /* return if the list passed is empty. Ideally this should never happen since this funcn is always
+       called after sapSearchMacList to get the index of the mac addr to be removed and this will
+       only get called if the search is successful. Still no harm in having the check */
+    if (macList==NULL) return;
+    for (i=index; i<((*size)-1); i++)
+    {
+        /* Move mac addresses starting from "index" passed one index up to delete the void
+           created by deletion of a mac address in ACL */
+        vos_mem_copy((macList+i)->bytes,(macList+i+1)->bytes, sizeof(v_MACADDR_t));
+    }
+    // The last space should be made empty since all mac addesses moved one step up
+    vos_mem_zero((macList+(*size)-1)->bytes, sizeof(v_MACADDR_t));
+    //reduce the list size by 1
+    (*size)--;
+}
+
+void sapPrintACL(v_MACADDR_t *macList, v_U8_t size)
+{
+    int i;
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"print acl entered");    
+    if (size==0) return;
+    for (i=0; i<size; i++)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                "** ACL entry %i - %02x:%02x:%02x:%02x:%02x:%02x", i, 
+                (macList+i)->bytes[0], (macList+i)->bytes[1], (macList+i)->bytes[2],
+                (macList+i)->bytes[3], (macList+i)->bytes[4], (macList+i)->bytes[5]);
+    }
+    return;
+}
+
+VOS_STATUS
+sapIsPeerMacAllowed(ptSapContext sapContext, v_U8_t *peerMac)
+{
+    if (eSAP_ALLOW_ALL == sapContext->eSapMacAddrAclMode)
+              return VOS_STATUS_SUCCESS;
+
+    if (sapSearchMacList(sapContext->acceptMacList, sapContext->nAcceptMac, peerMac, NULL))
+        return VOS_STATUS_SUCCESS;
+
+    if (sapSearchMacList(sapContext->denyMacList, sapContext->nDenyMac, peerMac, NULL))
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Peer %02x:%02x:%02x:%02x:%02x:%02x in deny list",
+                __FUNCTION__, *peerMac, *(peerMac + 1), *(peerMac + 2), *(peerMac + 3), *(peerMac + 4), *(peerMac + 5));
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    // A new station CAN associate, unless in deny list. Less stringent mode
+    if (eSAP_ACCEPT_UNLESS_DENIED == sapContext->eSapMacAddrAclMode)
+        return VOS_STATUS_SUCCESS;
+
+    // A new station CANNOT associate, unless in accept list. More stringent mode
+    if (eSAP_DENY_UNLESS_ACCEPTED == sapContext->eSapMacAddrAclMode)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Peer %02x:%02x:%02x:%02x:%02x:%02x denied, Mac filter mode is eSAP_DENY_UNLESS_ACCEPTED",
+                __FUNCTION__,  *peerMac, *(peerMac + 1), *(peerMac + 2), *(peerMac + 3), *(peerMac + 4), *(peerMac + 5));
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    /* The new STA is neither in accept list nor in deny list. In this case, deny the association
+     * but send a wifi event notification indicating the mac address being denied
+     */
+    if (eSAP_SUPPORT_ACCEPT_AND_DENY == sapContext->eSapMacAddrAclMode)
+    {
+        sapSignalHDDevent(sapContext, NULL, eSAP_UNKNOWN_STA_JOIN, (v_PVOID_t)peerMac);    
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Peer %02x:%02x:%02x:%02x:%02x:%02x denied, Mac filter mode is eSAP_SUPPORT_ACCEPT_AND_DENY",
+                __FUNCTION__,  *peerMac, *(peerMac + 1), *(peerMac + 2), *(peerMac + 3), *(peerMac + 4), *(peerMac + 5));
+        return VOS_STATUS_E_FAILURE;
+    }
+    return VOS_STATUS_SUCCESS;
+}
+
+#ifdef SOFTAP_CHANNEL_RANGE
+static VOS_STATUS sapGetChannelList(ptSapContext sapContext,
+                                 v_U8_t **channelList, v_U8_t *numberOfChannels)
+{
+    v_U32_t startChannelNum;
+    v_U32_t endChannelNum;
+    v_U32_t operatingBand;
+    v_U8_t  loopCount;
+    v_U8_t *list;
+    v_U8_t channelCount;
+    v_U8_t bandStartChannel;
+    v_U8_t bandEndChannel ;
+    v_U32_t enableLTECoex;
+    tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
+
+    if (NULL == hHal)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+             "Invalid HAL pointer from pvosGCtx on sapGetChannelList");
+        *numberOfChannels = 0;
+        *channelList = NULL;
+        return VOS_STATUS_E_FAULT;
+    }
+    
+    ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, &startChannelNum);
+    ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, &endChannelNum);
+    ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand);
+    ccmCfgGetInt(hHal, WNI_CFG_ENABLE_LTE_COEX, &enableLTECoex);
+    
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+             "%s:sapGetChannelList: startChannel %d,EndChannel %d,Operatingband:%d",
+             __FUNCTION__,startChannelNum,endChannelNum,operatingBand);
+    
+    switch(operatingBand)
+    {
+        case RF_SUBBAND_2_4_GHZ:
+           bandStartChannel = RF_CHAN_1;
+           bandEndChannel = RF_CHAN_14;
+           break;
+           
+        case RF_SUBBAND_5_LOW_GHZ:
+           bandStartChannel = RF_CHAN_36;
+           bandEndChannel = RF_CHAN_64;
+           break;
+           
+        case RF_SUBBAND_5_MID_GHZ:
+           bandStartChannel = RF_CHAN_100;
+           bandEndChannel = RF_CHAN_140;
+           break;
+           
+        case RF_SUBBAND_5_HIGH_GHZ:
+           bandStartChannel = RF_CHAN_149;
+           bandEndChannel = RF_CHAN_165;
+           break;
+           
+        case RF_SUBBAND_4_9_GHZ:
+           bandStartChannel = RF_CHAN_240;
+           bandEndChannel = RF_CHAN_216;
+           break;
+        default:
+           VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+             "sapGetChannelList:OperatingBand not valid ");
+           /* assume 2.4 GHz */
+           bandStartChannel = RF_CHAN_1;
+           bandEndChannel = RF_CHAN_14;
+           break;
+    }
+    /*Check if LTE coex is enabled and 2.4GHz is selected*/
+    if (enableLTECoex && (bandStartChannel == RF_CHAN_1) 
+       && (bandEndChannel == RF_CHAN_14))
+    {
+        /*Set 2.4GHz upper limit to channel 9 for LTE COEX*/
+        bandEndChannel = RF_CHAN_9;
+    }      
+    /* Allocate the max number of channel supported */
+    list = (v_U8_t *)vos_mem_malloc(NUM_5GHZ_CHANNELS);
+    if (NULL == list)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Unable to allocate channel list", __FUNCTION__);
+        *numberOfChannels = 0;
+        *channelList = NULL;
+        return VOS_STATUS_E_RESOURCES;
+    }
+
+    /*Search for the Active channels in the given range */
+    channelCount = 0;
+    for( loopCount = bandStartChannel; loopCount <= bandEndChannel; loopCount++ )
+    {
+        if((startChannelNum <= rfChannels[loopCount].channelNum)&&
+            (endChannelNum >= rfChannels[loopCount].channelNum ))
+        {
+            if( regChannels[loopCount].enabled )
+            {
+                list[channelCount] = rfChannels[loopCount].channelNum; 
+                channelCount++;
+            }
+        }
+    }
+    if (0 == channelCount)
+    { 
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+        "sapGetChannelList:No active channels present in the given range for the current region");
+        /*LTE COEX: channel range outside the restricted 2.4GHz band limits*/
+        if (enableLTECoex && (startChannelNum > bandEndChannel))
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
+            "sapGetChannelList:SAP cannot be started as LTE COEX restricted 2.4GHz limits");
+        }
+    }
+   
+    /* return the channel list and number of channels to scan*/
+    *numberOfChannels = channelCount;
+    if(channelCount != 0)
+    {         
+       *channelList = list;
+    }
+    else
+    {
+       *channelList = NULL;
+        vos_mem_free(list);
+    }
+    return VOS_STATUS_SUCCESS;
+}
+#endif
diff --git a/CORE/SAP/src/sapFsm_ext.h b/CORE/SAP/src/sapFsm_ext.h
new file mode 100644
index 0000000..ca0b9f3
--- /dev/null
+++ b/CORE/SAP/src/sapFsm_ext.h
@@ -0,0 +1,57 @@
+/*
+ * 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) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary 
+ */
+
+/* This file is generated from btampFsm.cdd - do not edit manually*/
+/* Generated on: Thu Oct 16 15:40:39 PDT 2008 */
+
+
+#ifndef __SAPFSM_EXT_H__
+#define __SAPFSM_EXT_H__
+
+/* Events that can be sent to the SAP state-machine */
+typedef enum
+{
+  eSAP_TIMER_CONNECT_ACCEPT_TIMEOUT=0U,
+  eSAP_MAC_CONNECT_COMPLETED,
+  eSAP_CHANNEL_SELECTION_FAILED,
+  eSAP_MAC_CONNECT_INDICATION,
+  eSAP_MAC_KEY_SET_SUCCESS,
+  eSAP_RSN_FAILURE,
+  eSAP_MAC_SCAN_COMPLETE,
+  eSAP_HDD_START_INFRA_BSS,
+  eSAP_MAC_READY_FOR_CONNECTIONS,
+  eSAP_MAC_START_BSS_SUCCESS,
+  eSAP_MAC_START_BSS_FAILURE,
+  eSAP_RSN_SUCCESS,
+  eSAP_MAC_START_FAILS,
+  eSAP_HDD_STOP_INFRA_BSS,
+  eSAP_WRITE_REMOTE_AMP_ASSOC,
+
+  eSAP_NO_MSG
+}eSapMsg_t;
+
+
+#endif
diff --git a/CORE/SAP/src/sapInternal.h b/CORE/SAP/src/sapInternal.h
new file mode 100644
index 0000000..a148656
--- /dev/null
+++ b/CORE/SAP/src/sapInternal.h
@@ -0,0 +1,738 @@
+/*
+ * 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 WLAN_QCT_WLANSAP_INTERNAL_H
+#define WLAN_QCT_WLANSAP_INTERNAL_H
+
+/*===========================================================================
+
+               W L A N   S A P  P A L   L A Y E R 
+                       I N T E R N A L  A P I
+
+
+DESCRIPTION
+  This file contains the internal API exposed by the wlan SAP PAL layer 
+  module.
+
+
+  Copyright (c) 2008 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: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/src/bapInternal.h,v 1.7 2009/03/09 08:50:43 rgidvani Exp rgidvani $ $DateTime: $ $Author: jzmuda $
+
+
+when           who        what, where, why
+--------     ---         ----------------------------------------------------------
+09/15/08    SOFTAP     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_api.h" 
+#include "vos_packet.h" 
+
+// Pick up the CSR API definitions
+#include "csrApi.h"
+#include "sapApi.h"
+#include "sapFsm_ext.h"
+#include "sapChSelect.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+
+/*----------------------------------------------------------------------------
+ *  Defines
+ * -------------------------------------------------------------------------*/
+#define SAP_DEBUG
+// Used to enable or disable security on the BT-AMP link 
+#define WLANSAP_SECURITY_ENABLED_STATE VOS_TRUE
+// How do I get SAP context from voss context? 
+#define VOS_GET_SAP_CB(ctx) vos_get_context( VOS_MODULE_ID_SAP, ctx) 
+
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+// How do I get halHandle from voss context? 
+#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_HAL, ctx) 
+#else
+#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_PE, ctx) 
+#endif
+//MAC Address length
+#define ANI_EAPOL_KEY_RSN_NONCE_SIZE      32
+
+extern sRegulatoryChannel *regChannels;
+extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
+
+/*----------------------------------------------------------------------------
+ *  Typedefs
+ * -------------------------------------------------------------------------*/
+typedef struct sSapContext tSapContext;
+// tSapContext, *ptSapContext;
+/*----------------------------------------------------------------------------
+ *  Type Declarations - For internal SAP context information
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+ *  Opaque SAP context Type Declaration
+ * -------------------------------------------------------------------------*/
+// We were only using this syntax, when this was truly opaque. 
+// (I.E., it was defined in a different file.)
+
+
+/* SAP FSM states for Access Point role */
+typedef enum {
+    eSAP_DISCONNECTED,
+    eSAP_CH_SELECT,
+    eSAP_STARTING,
+    eSAP_STARTED,
+    eSAP_DISCONNECTING
+} eSapFsmStates_t;
+
+/*----------------------------------------------------------------------------
+ *  SAP context Data Type Declaration
+ * -------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------------
+ *  Type Declarations - QOS related
+ * -------------------------------------------------------------------------*/
+/* SAP QOS config */
+typedef struct sSapQosCfg {
+    v_U8_t              WmmIsEnabled;
+} tSapQosCfg;
+
+typedef struct sSapContext {
+
+    vos_lock_t          SapGlobalLock;
+
+    // Include the current channel of AP
+    v_U32_t             channel;
+
+    // Include the SME(CSR) sessionId here
+    v_U8_t              sessionId;
+
+    // Include the key material for this physical link
+    v_U8_t              key_type;
+    v_U8_t              key_length;
+    v_U8_t              key_material[32];
+
+    // Include the associations MAC addresses
+    v_U8_t              self_mac_addr[VOS_MAC_ADDRESS_LEN];
+
+    // Own SSID  
+    v_U8_t              ownSsid[MAX_SSID_LEN];
+    v_U32_t             ownSsidLen;
+
+    // Flag for signaling if security is enabled
+    v_U8_t              ucSecEnabled;
+
+    // Include the SME(CSR) context here
+    tCsrRoamProfile     csrRoamProfile; 
+    v_U32_t             csrRoamId;
+
+    //Sap session
+    tANI_BOOLEAN        isSapSessionOpen;
+
+    // SAP event Callback to hdd
+    tpWLAN_SAPEventCB   pfnSapEventCallback;
+
+    // Include the enclosing VOSS context here
+    v_PVOID_t           pvosGCtx; 
+
+    // Include the state machine structure here, state var that keeps track of state machine
+    eSapFsmStates_t     sapsMachine;
+
+    // Actual storage for AP and self (STA) SSID 
+    tCsrSSIDInfo        SSIDList[2];
+
+    // Actual storage for AP bssid 
+    tCsrBssid           bssid;
+
+    // Mac filtering settings
+    eSapMacAddrACL      eSapMacAddrAclMode;
+    v_MACADDR_t         acceptMacList[MAX_MAC_ADDRESS_ACCEPTED];
+    v_U8_t              nAcceptMac;
+    v_MACADDR_t         denyMacList[MAX_MAC_ADDRESS_DENIED];
+    v_U8_t              nDenyMac;
+
+    // QOS config
+    tSapQosCfg        SapQosCfg;
+
+    v_PVOID_t         pUsrContext;
+
+    v_U32_t           nStaWPARSnReqIeLength;
+    v_U8_t            pStaWpaRsnReqIE[MAX_ASSOC_IND_IE_LEN]; 
+    tSirAPWPSIEs      APWPSIEs;
+    tSirRSNie         APWPARSNIEs;
+
+    v_U32_t           nStaAddIeLength;
+    v_U8_t            pStaAddIE[MAX_ASSOC_IND_IE_LEN]; 
+    v_U8_t            *channelList;
+} *ptSapContext;
+
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+//  The main per-Physical Link (per WLAN association) context.
+extern ptSapContext  gpSapCtx;
+
+/*----------------------------------------------------------------------------
+ *  SAP state machine event definition
+ * -------------------------------------------------------------------------*/
+/* The event structure */ 
+typedef struct sWLAN_SAPEvent {
+    v_PVOID_t params;   /* A VOID pointer type for all possible inputs */
+    v_U32_t   event;    /* State machine input event message */
+    v_U32_t   u1;       /* introduced to handle csrRoamCompleteCallback roamStatus */
+    v_U32_t   u2;       /* introduced to handle csrRoamCompleteCallback roamResult */
+} tWLAN_SAPEvent, *ptWLAN_SAPEvent; 
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_ScanCallback()
+
+  DESCRIPTION 
+    Callback for Scan (scan results) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+    tHalHandle:  the tHalHandle passed in with the scan request
+    *p2: the second context pass in for the caller, opaque sap Handle here
+    scanID:
+    status: Status of scan -success, failure or abort 
+   
+  RETURN VALUE
+    The eHalStatus code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+
+============================================================================*/
+eHalStatus
+WLANSAP_ScanCallback
+(
+  tHalHandle halHandle, 
+  void *pContext,
+  v_U32_t scanID, 
+  eCsrScanStatus scanStatus
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_RoamCallback()
+
+  DESCRIPTION 
+    Callback for Roam (connection status) Events  
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS 
+
+    IN
+      pContext:  is the pContext passed in with the roam request
+      pCsrRoamInfo: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
+      eRoamCmdResult: for detail valid members. It may be NULL
+      roamId: is to identify the callback related roam request. 0 means unsolicited
+      roamStatus: is a flag indicating the status of the callback
+      roamResult: is the result
+   
+  RETURN VALUE
+    The eHalStatus code associated with performing the operation  
+
+    eHAL_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS 
+  
+============================================================================*/
+eHalStatus
+WLANSAP_RoamCallback
+(
+  void *pContext, 
+  tCsrRoamInfo *pCsrRoamInfo,
+  v_U32_t roamId, 
+  eRoamCmdStatus roamStatus, 
+  eCsrRoamResult roamResult
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_CleanCB
+
+  DESCRIPTION 
+    Clear out all fields in the SAP context.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pSapCtx:  pointer to the SAP control block
+    freeFlag:   flag indicating whether to free any allocations.
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+
+============================================================================*/
+VOS_STATUS 
+WLANSAP_CleanCB
+( 
+  ptSapContext  pSapCtx,
+  v_U32_t freeFlag /* If 0 do not empty */
+);
+/*==========================================================================
+
+  FUNCTION    WLANSapFsm
+
+  DESCRIPTION 
+    SAP forward state machine to handle the states of the SAP 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    sapContext:  pointer to the SAP control block
+    sapEvent   : SAP event
+    status : status of SAP state machine
+   
+  RETURN VALUE
+    Status of the SAP forward machine
+
+    VOS_STATUS_E_FAULT:  pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+
+============================================================================*/
+
+VOS_STATUS
+SapFsm
+(
+    ptSapContext sapContext, /* sapContext value */    
+    ptWLAN_SAPEvent sapEvent, /* State machine event */
+    v_U8_t *status    /* return the SAP status here */
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_pmcFullPwrReqCB
+
+  DESCRIPTION 
+    Callback provide to PMC in the pmcRequestFullPower API.     
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    callbackContext:  The user passed in a context to identify 
+    status:           The halStatus     
+   
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+
+============================================================================*/
+void 
+WLANSAP_pmcFullPwrReqCB
+( 
+  void *callbackContext, 
+  eHalStatus status
+);
+
+/*==========================================================================
+
+  FUNCTION    sapSelectChannel
+
+  DESCRIPTION 
+    Runs a algorithm to select the best channel to operate in for Soft AP in 2.4GHz band
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       halHandle : Pointer to HAL handle
+       pResult : Pointer to tScanResultHandle
+   
+  RETURN VALUE
+    If SUCCESS channel number or zero for FAILURE.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+v_U8_t sapSelectChannel(tHalHandle halHandle, tScanResultHandle pScanResult);
+
+/*==========================================================================
+
+  FUNCTION    sapSignalHDDevent
+
+  DESCRIPTION 
+    SAP HDD event callback function
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       sapContext : Pointer to SAP handle
+       pCsrRoamInfo : csrRoamprofile 
+       sapHddevent    : SAP HDD callback event
+   
+  RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+sapSignalHDDevent( ptSapContext sapContext, tCsrRoamInfo * pCsrRoamInfo, eSapHddEvent sapHddevent, void *);
+
+/*==========================================================================
+
+  FUNCTION    sapFsm
+
+  DESCRIPTION 
+    SAP Forward state machine
+
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+       sapContext : Pointer to SAP handle
+       sapEvent : state machine event
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+VOS_STATUS
+sapFsm
+(
+    ptSapContext sapContext,    /* sapContext value */
+    ptWLAN_SAPEvent sapEvent   /* State machine event */
+);
+
+/*==========================================================================
+
+  FUNCTION    sapConvertToCsrProfile
+
+  DESCRIPTION 
+    sapConvertToCsrProfile
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       pconfig_params : Pointer to configuration structure
+       bssType : SoftAP type
+       profile : pointer to a csrProfile that needs to be passed
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS
+
+============================================================================*/
+eSapStatus
+sapconvertToCsrProfile(tsap_Config_t *pconfig_params, eCsrRoamBssType bssType, tCsrRoamProfile *profile);
+
+/*==========================================================================
+
+  FUNCTION    sapFreeRoamProfile
+
+  DESCRIPTION 
+    sapConvertToCsrProfile
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       profile : pointer to a csrProfile that needs to be freed
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS
+
+============================================================================*/
+void sapFreeRoamProfile(tCsrRoamProfile *profile);
+
+/*==========================================================================
+
+  FUNCTION    sapIsPeerMacAllowed
+
+  DESCRIPTION 
+    Function to implement MAC filtering for station association in SoftAP
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       sapContext : Pointer to SAP handle
+       peerMac    : Mac address of the peer
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+VOS_STATUS
+sapIsPeerMacAllowed(ptSapContext sapContext, v_U8_t *peerMac);
+
+/*==========================================================================
+
+  FUNCTION    sapSortMacList
+
+  DESCRIPTION 
+    Function to implement sorting of MAC addresses
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       macList : Pointer to mac address array
+       size    : Number of entries in mac address array
+
+ RETURN VALUE
+    None
+
+  SIDE EFFECTS 
+
+============================================================================*/
+void
+sapSortMacList(v_MACADDR_t *macList, v_U8_t size);
+
+/*==========================================================================
+
+  FUNCTION    sapAddMacToACL
+
+  DESCRIPTION 
+    Function to ADD a mac address in an ACL.
+    The function ensures that the ACL list remains sorted after the addition.
+    This API does not take care of buffer overflow i.e. if the list is already maxed out while adding a mac address,
+    it will still try to add. 
+    The caller must take care that the ACL size is less than MAX_MAC_ADDRESS_ACCEPTED before calling this function.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       macList          : ACL list of mac addresses (black/white list)
+       size (I/O)       : size of the ACL. It is an I/O arg. The API takes care of incrementing the size by 1.
+       peerMac          : Mac address of the peer to be added
+
+ RETURN VALUE
+    None.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+void
+sapAddMacToACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t *peerMac);
+
+/*==========================================================================
+
+  FUNCTION    sapRemoveMacFromACL
+
+  DESCRIPTION 
+    Function to REMOVE a mac address from an ACL.
+    The function ensures that the ACL list remains sorted after the DELETION.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       macList          : ACL list of mac addresses (black/white list)
+       size (I/O)       : size of the ACL. It is an I/O arg. The API takes care of decrementing the size by 1.
+       index            : index in the ACL list where the peerMac is present
+                          This index can be found by using the "sapSearchMacList" API which returns the index of the MAC
+                          addr, if found in an ACL, in one of the arguments passed by the caller.
+
+ RETURN VALUE
+    None.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+void
+sapRemoveMacFromACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t index);
+
+/*==========================================================================
+
+  FUNCTION    sapPrintACL
+
+  DESCRIPTION 
+    Function to print all the mac address of an ACL.
+    Useful for debug.
+    
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       macList          : ACL list of mac addresses (black/white list)
+       size             : size of the ACL
+
+ RETURN VALUE
+    None.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+void 
+sapPrintACL(v_MACADDR_t *macList, v_U8_t size);
+
+/*==========================================================================
+
+  FUNCTION    sapSearchMacList
+
+  DESCRIPTION 
+    Function to search for a mac address in an ACL
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       macList          : list of mac addresses (black/white list)
+       num_mac          : size of the ACL
+       peerMac          : Mac address of the peer
+    OP       
+       index            : the index at which the peer mac is found
+                              this value gets filled in this function. If the caller is not interested
+                              in the index of the peerMac to be searched, it can pass NULL here.
+
+ RETURN VALUE
+    SUCCESS          : if the mac addr being searched for is found
+    FAILURE          : if the mac addr being searched for is NOT found
+
+  SIDE EFFECTS 
+
+============================================================================*/
+eSapBool
+sapSearchMacList(v_MACADDR_t *macList, v_U8_t num_mac, v_U8_t *peerMac, v_U8_t *index);
+
+
+/*==========================================================================
+
+  FUNCTION    sap_AcquireGlobalLock
+
+  DESCRIPTION 
+    Function to implement acquire SAP global lock
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       sapContext : Pointer to SAP handle
+       peerMac    : Mac address of the peer
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+VOS_STATUS
+sap_AcquireGlobalLock( ptSapContext  pSapCtx );
+
+/*==========================================================================
+
+  FUNCTION    sapIsPeerMacAllowed
+
+  DESCRIPTION 
+    Function to implement release SAP global lock
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+       sapContext : Pointer to SAP handle
+       peerMac    : Mac address of the peer
+
+ RETURN VALUE
+    If SUCCESS or FAILURE.
+
+  SIDE EFFECTS 
+
+============================================================================*/
+VOS_STATUS
+sap_ReleaseGlobalLock( ptSapContext  pSapCtx );
+
+#ifdef __cplusplus
+}
+#endif 
+#endif /* #ifndef WLAN_QCT_WLANSAP_INTERNAL_H */
+
diff --git a/CORE/SAP/src/sapModule.c b/CORE/SAP/src/sapModule.c
new file mode 100644
index 0000000..ffa755e
--- /dev/null
+++ b/CORE/SAP/src/sapModule.c
@@ -0,0 +1,2301 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                      s a p M o d u l e . C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN SAP modules
+  functions providing EXTERNAL APIs. It is also where the global SAP module
+  context gets initialised
+  
+  DEPENDENCIES: 
+
+  Are listed for each API below.
+  
+  Copyright (c) 2010 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.
+
+
+
+  when               who                 what, where, why
+----------       ---                --------------------------------------------------------
+03/15/10     SOFTAP team            Created module
+06/03/10     js                     Added support to hostapd driven 
+ *                                  deauth/disassoc/mic failure
+
+===========================================================================*/
+
+/* $Header$ */
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_tl.h"
+#include "vos_trace.h"
+
+// Pick up the sme callback registration API
+#include "sme_Api.h"
+
+// SAP API header file
+
+#include "sapInternal.h"
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+#include "halInternal.h"
+#endif
+#include "smeInside.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define SAP_DEBUG
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ *  External declarations for global context 
+ * -------------------------------------------------------------------------*/
+//  No!  Get this from VOS.
+//  The main per-Physical Link (per WLAN association) context.
+ptSapContext  gpSapCtx = NULL;
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Open
+
+  DESCRIPTION 
+    Called at driver initialization (vos_open). SAP will initialize 
+    all its internal resources and will wait for the call to start to 
+    register with the other modules. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Open
+(
+    v_PVOID_t pvosGCtx
+)
+{
+
+    ptSapContext  pSapCtx = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+    VOS_ASSERT(pvosGCtx);
+    /*------------------------------------------------------------------------
+    Allocate (and sanity check?!) SAP control block 
+    ------------------------------------------------------------------------*/
+    vos_alloc_context(pvosGCtx, VOS_MODULE_ID_SAP, (v_VOID_t **)&pSapCtx, sizeof(tSapContext));
+
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    vos_mem_zero(pSapCtx, sizeof(tSapContext));
+
+    /*------------------------------------------------------------------------
+        Clean up SAP control block, initialize all values
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Open");
+
+    WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/);
+
+    // Setup the "link back" to the VOSS context
+    pSapCtx->pvosGCtx = pvosGCtx;
+
+    // Store a pointer to the SAP context provided by VOSS
+    gpSapCtx = pSapCtx;
+   
+    /*------------------------------------------------------------------------
+        Allocate internal resources
+       ------------------------------------------------------------------------*/
+
+    return VOS_STATUS_SUCCESS;
+}// WLANSAP_Open
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Start
+
+  DESCRIPTION 
+    Called as part of the overall start procedure (vos_start). SAP will 
+    use this call to register with TL as the SAP entity for 
+    SAP RSN frames. 
+
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+
+VOS_STATUS 
+WLANSAP_Start
+( 
+    v_PVOID_t  pvosGCtx 
+)
+{
+#ifdef WLAN_SOFTAP_FEATURE
+    ptSapContext  pSapCtx = NULL;
+
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLANSAP_Start invoked successfully\n");
+    /*------------------------------------------------------------------------
+        Sanity check
+        Extract SAP control block 
+    ------------------------------------------------------------------------*/
+    pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+    if ( NULL == pSapCtx ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /*------------------------------------------------------------------------
+        For now, presume security is not enabled.
+    -----------------------------------------------------------------------*/
+    pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE;
+
+
+    /*------------------------------------------------------------------------
+        Now configure the roaming profile links. To SSID and bssid.
+    ------------------------------------------------------------------------*/
+    // We have room for two SSIDs.  
+    pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.  
+    pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList;  //Array of two  
+    pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0;
+    pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE;
+    pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = pSapCtx->SSIDList[0].ssidHidden;
+
+    pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.  
+    pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid;  
+
+    // Now configure the auth type in the roaming profile. To open.
+    pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default
+    
+    if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock)))
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                 "WLANSAP_Start failed init lock\n");        
+        return VOS_STATUS_E_FAULT;
+    }
+
+
+#endif 
+
+    return VOS_STATUS_SUCCESS;
+}/* WLANSAP_Start */
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_Stop
+
+  DESCRIPTION 
+    Called by vos_stop to stop operation in SAP, before close. SAP will suspend all 
+    BT-AMP Protocol Adaption Layer operation and will wait for the close 
+    request to clean up its resources. 
+
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Stop
+( 
+    v_PVOID_t  pvosGCtx 
+)
+{
+
+#ifdef WLAN_SOFTAP_FEATURE
+    ptSapContext  pSapCtx = NULL;
+
+    /*------------------------------------------------------------------------
+        Sanity check
+        Extract SAP control block 
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLANSAP_Stop invoked successfully ");
+
+    pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    sapFreeRoamProfile(&pSapCtx->csrRoamProfile);
+    
+    if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pSapCtx->SapGlobalLock ) ) )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                 "WLANSAP_Stop failed destroy lock\n");        
+        return VOS_STATUS_E_FAULT;
+    }
+    /*------------------------------------------------------------------------
+        Stop SAP (de-register RSN handler!?)  
+    ------------------------------------------------------------------------*/
+#endif
+
+    return VOS_STATUS_SUCCESS;
+}/* WLANSAP_Stop */
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Close
+
+  DESCRIPTION 
+    Called by vos_close during general driver close procedure. SAP will clean up 
+    all the internal resources. 
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS 
+WLANSAP_Close
+( 
+    v_PVOID_t  pvosGCtx 
+)
+{
+#ifdef WLAN_SOFTAP_FEATURE
+    ptSapContext  pSapCtx = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /*------------------------------------------------------------------------
+        Sanity check
+        Extract SAP control block 
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLANSAP_Close invoked");
+
+    pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /*------------------------------------------------------------------------
+        Cleanup SAP control block. 
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Close");
+    WLANSAP_CleanCB(pSapCtx, VOS_TRUE /* empty queues/lists/pkts if any*/);
+
+    /*------------------------------------------------------------------------
+        Free SAP context from VOSS global 
+    ------------------------------------------------------------------------*/
+    vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
+
+#endif
+    return VOS_STATUS_SUCCESS;
+}/* WLANSAP_Close */
+
+/*----------------------------------------------------------------------------
+ * Utility Function implementations 
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_CleanCB
+
+  DESCRIPTION 
+    Clear out all fields in the SAP context.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its context 
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS 
+WLANSAP_CleanCB
+( 
+    ptSapContext  pSapCtx,
+    v_U32_t freeFlag // 0 /*do not empty*/);
+)
+{
+#ifdef WLAN_SOFTAP_FEATURE
+    /*------------------------------------------------------------------------
+        Sanity check SAP control block 
+    ------------------------------------------------------------------------*/
+
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /*------------------------------------------------------------------------
+        Clean up SAP control block, initialize all values
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB");
+
+    vos_mem_zero( pSapCtx, sizeof(tSapContext));
+
+    pSapCtx->pvosGCtx = NULL;
+
+    pSapCtx->sapsMachine= eSAP_DISCONNECTED;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d, sapContext value = %x",
+            __FUNCTION__, pSapCtx->sapsMachine, pSapCtx);   
+    pSapCtx->sessionId = 0;
+    pSapCtx->channel = 0;  
+
+#endif
+    return VOS_STATUS_SUCCESS;
+}// WLANSAP_CleanCB
+
+/*==========================================================================
+  FUNCTION    WLANSAP_pmcFullPwrReqCB
+
+  DESCRIPTION 
+    Callback provide to PMC in the pmcRequestFullPower API. 
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    callbackContext:  The user passed in a context to identify 
+    status:           The halStatus 
+
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS
+============================================================================*/
+void
+WLANSAP_pmcFullPwrReqCB
+(
+    void *callbackContext,
+    eHalStatus status
+)
+{
+    if(HAL_STATUS_SUCCESS(status))
+    {
+         //If success what else to be handled???
+    }
+    else
+    {
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, 
+               "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n");
+
+        //ASSERT
+        VOS_ASSERT(0);
+    }
+
+}// WLANSAP_pmcFullPwrReqCB
+/*==========================================================================
+  FUNCTION    WLANSAP_getState
+
+  DESCRIPTION 
+    This api returns the current SAP state to the caller.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pContext            : Pointer to Sap Context structure
+
+  RETURN VALUE
+    Returns the SAP FSM state.  
+============================================================================*/
+
+v_U8_t WLANSAP_getState 
+(
+    v_PVOID_t  pvosGCtx
+)
+{
+    ptSapContext  pSapCtx = NULL;
+
+    pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    if ( NULL == pSapCtx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+    return pSapCtx->sapsMachine;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_StartBss
+
+  DESCRIPTION 
+    This api function provides SAP FSM event eWLAN_SAP_PHYSICAL_LINK_CREATE for
+    starting AP BSS
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pContext            : Pointer to Sap Context structure
+    pQctCommitConfig    : Pointer to configuration structure passed down from HDD(HostApd for Android)
+    hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results
+    pUsrContext         : Parameter that will be passed back in all the SAP callback events.
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS 
+WLANSAP_StartBss
+(
+    v_PVOID_t  pvosGCtx,//pwextCtx
+    tpWLAN_SAPEventCB pSapEventCallback,
+    tsap_Config_t *pConfig,
+    v_PVOID_t  pUsrContext
+)
+{
+    tWLAN_SAPEvent sapEvent;    /* State machine event*/
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    ptSapContext  pSapCtx = NULL;
+    tANI_BOOLEAN restartNeeded;
+    tHalHandle hHal; 
+    
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /*------------------------------------------------------------------------
+        Sanity check
+        Extract SAP control block 
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLANSAP_StartBss");
+
+    if (VOS_STA_SAP_MODE == vos_get_conparam ())
+    {
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if ( NULL == pSapCtx )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        pSapCtx->sapsMachine = eSAP_DISCONNECTED;
+
+        /* Channel selection is auto or configured */
+        pSapCtx->channel = pConfig->channel;
+        pSapCtx->pUsrContext = pUsrContext;
+
+        //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
+        pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
+        vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid, 
+                     pSapCtx->self_mac_addr,
+                     sizeof( tCsrBssid ) ); 
+
+        //Save a copy to SAP context
+        vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid, 
+                    pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
+        vos_mem_copy(pSapCtx->self_mac_addr,
+                    pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
+
+        //copy the configuration items to csrProfile
+        sapconvertToCsrProfile( pConfig, eCSR_BSS_TYPE_INFRA_AP, &pSapCtx->csrRoamProfile);
+        hHal = (tHalHandle)VOS_GET_HAL_CB(pvosGCtx); 
+        if (NULL == hHal)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                       "%s: Invalid MAC context from pvosGCtx", __FUNCTION__);
+        }
+        else
+        {
+            //If concurrent session is running that is already associated
+            //then we just follow that sessions country info (whether
+            //present or not doesn't maater as we have to follow whatever
+            //STA session does)
+            if (0 == sme_GetConcurrentOperationChannel(hHal))
+            {
+                /* Setting the region/country  information */
+                sme_setRegInfo(hHal, pConfig->countryCode);
+                sme_ResetCountryCodeInformation(hHal, &restartNeeded);
+            }
+        }
+
+        // Copy MAC filtering settings to sap context
+        pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl;
+        vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, sizeof(pConfig->accept_mac));
+        pSapCtx->nAcceptMac = pConfig->num_accept_mac;
+        sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
+        vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, sizeof(pConfig->deny_mac));
+        pSapCtx->nDenyMac = pConfig->num_deny_mac;
+        sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac);
+
+        /* Fill in the event structure for FSM */
+        sapEvent.event = eSAP_HDD_START_INFRA_BSS;
+        sapEvent.params = 0;//pSapPhysLinkCreate
+
+        /* Store the HDD callback in SAP context */
+        pSapCtx->pfnSapEventCallback = pSapEventCallback;
+
+        /* Handle event*/
+        vosStatus = sapFsm(pSapCtx, &sapEvent);
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                "SoftAp role has not been enabled");
+     }
+
+    return vosStatus;
+}// WLANSAP_StartBss
+
+/*==========================================================================
+  FUNCTION    WLANSAP_StopBss
+
+  DESCRIPTION 
+    This api function provides SAP FSM event eSAP_HDD_STOP_INFRA_BSS for
+    stopping AP BSS
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx    : Pointer to the global vos context; a handle to SAP's 
+                  control block can be extracted from its contexe
+
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT: Pointer to VOSS GC is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS: Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS 
+WLANSAP_StopBss
+(
+ v_PVOID_t  pvosGCtx
+)
+{
+    tWLAN_SAPEvent sapEvent;    /* State machine event*/
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    ptSapContext  pSapCtx = NULL;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /*------------------------------------------------------------------------
+        Sanity check
+        Extract SAP control block 
+    ------------------------------------------------------------------------*/
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLANSAP_StopBss");
+
+    if ( NULL == pvosGCtx ) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid Global VOSS handle", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    if (NULL == pSapCtx )
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    /* Fill in the event structure for FSM */
+    sapEvent.event = eSAP_HDD_STOP_INFRA_BSS;
+    sapEvent.params = 0;
+
+    /* Handle event*/
+    vosStatus = sapFsm(pSapCtx, &sapEvent);
+
+    return vosStatus;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_GetAssocStations
+
+  DESCRIPTION 
+    This api function is used to probe the list of associated stations from various modules of CORE stack
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx        : Pointer to vos global context structure
+    modId           : Module from whom list of associtated stations  is supposed to be probed. If an invalid module is passed
+                        then by default VOS_MODULE_ID_PE will be probed
+    IN/OUT
+    pAssocStas      : Pointer to list of associated stations that are known to the module specified in mod parameter
+
+  NOTE: The memory for this list will be allocated by the caller of this API
+
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:  Success
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+WLANSAP_GetAssocStations
+(
+    v_PVOID_t pvosGCtx,
+    VOS_MODULE_ID modId,
+    tpSap_AssocMacAddr pAssocStas
+)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      Extract SAP control block 
+      ------------------------------------------------------------------------*/
+    if (NULL == pSapCtx)
+    {
+      VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+    }
+
+    sme_RoamGetAssociatedStas( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
+                                modId,
+                                pSapCtx->pUsrContext,
+                                (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
+                                (v_U8_t *)pAssocStas );
+
+    return VOS_STATUS_SUCCESS;
+}
+
+
+/*==========================================================================
+  FUNCTION    WLANSAP_RemoveWpsSessionOverlap
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to remove an entry from session session overlap info.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx: Pointer to vos global context structure
+    pRemoveMac: pointer to v_MACADDR_t for session MAC address
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+    VOS_STATUS_E_FAULT:  Session is not dectected. The parameter is function not valid.
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_RemoveWpsSessionOverlap
+
+(
+    v_PVOID_t pvosGCtx,
+    v_MACADDR_t pRemoveMac
+)
+{
+  ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract SAP control block 
+  ------------------------------------------------------------------------*/
+  if (NULL == pSapCtx)
+  {
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+               "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
+                                pSapCtx->pUsrContext,
+                                (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
+                                pRemoveMac);
+
+  return VOS_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_getWpsSessionOverlap
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to get WPS session overlap info.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_getWpsSessionOverlap
+(
+ v_PVOID_t pvosGCtx  
+)
+{
+    v_MACADDR_t pRemoveMac = VOS_MAC_ADDR_ZERO_INITIALIZER; 
+
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      Extract SAP control block 
+      ------------------------------------------------------------------------*/
+    if (NULL == pSapCtx)
+    {
+      VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+    }
+    
+    sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
+                                pSapCtx->pUsrContext,
+                                (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
+                                pRemoveMac);
+
+    return VOS_STATUS_SUCCESS;
+}
+
+
+/* This routine will set the mode of operation for ACL dynamically*/
+VOS_STATUS
+WLANSAP_SetMode ( v_PVOID_t  pvosGCtx, v_U32_t mode)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    pSapCtx->eSapMacAddrAclMode = (eSapMacAddrACL)mode;
+    return VOS_STATUS_SUCCESS;
+}
+
+/* This routine will clear all the entries in accept list as well as deny list  */
+
+VOS_STATUS 
+WLANSAP_ClearACL( v_PVOID_t  pvosGCtx)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+    v_U8_t i;
+
+    if (NULL == pSapCtx)
+    {
+        return VOS_STATUS_E_RESOURCES;
+    }
+
+    if (pSapCtx->denyMacList != NULL) 
+    {
+        for (i = 0; i < (pSapCtx->nDenyMac-1); i++)
+        {
+            vos_mem_zero((pSapCtx->denyMacList+i)->bytes, sizeof(v_MACADDR_t));
+
+        }
+    }
+    sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
+    pSapCtx->nDenyMac  = 0;
+
+    if (pSapCtx->acceptMacList!=NULL) 
+    {
+        for (i = 0; i < (pSapCtx->nAcceptMac-1); i++)
+        {
+            vos_mem_zero((pSapCtx->acceptMacList+i)->bytes, sizeof(v_MACADDR_t));
+
+        }
+    }
+    sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
+    pSapCtx->nAcceptMac = 0;
+    
+    return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS 
+WLANSAP_ModifyACL
+(
+    v_PVOID_t  pvosGCtx,
+    v_U8_t *pPeerStaMac,
+    eSapACLType listType,
+    eSapACLCmdType cmd
+)
+{   
+    eSapBool staInWhiteList=eSAP_FALSE, staInBlackList=eSAP_FALSE;
+    v_U8_t staWLIndex, staBLIndex;
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    if (NULL == pSapCtx)
+    {
+       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Invalid SAP Context", __FUNCTION__);
+       return VOS_STATUS_E_FAULT;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"Modify ACL entered\n"
+            "Before modification of ACL\n"
+            "size of accept and deny lists %d %d",
+            pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
+    sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
+    sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
+
+    /* the expectation is a mac addr will not be in both the lists at the same time.
+       It is the responsiblity of userspace to ensure this */
+    staInWhiteList = sapSearchMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac, pPeerStaMac, &staWLIndex);
+    staInBlackList = sapSearchMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac, pPeerStaMac, &staBLIndex);
+
+    if (staInWhiteList && staInBlackList)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                "Peer mac %02x:%02x:%02x:%02x:%02x:%02x found in white and black lists."
+                "Initial lists passed incorrect. Cannot execute this command.", 
+                pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                pPeerStaMac[4], pPeerStaMac[5]);
+        return VOS_STATUS_E_FAILURE;
+
+    }
+
+    switch(listType)
+    {
+        case eSAP_WHITE_LIST:           
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "cmd %d", cmd);
+            if (cmd == ADD_STA_TO_ACL)
+            {
+                //error check
+                // if list is already at max, return failure
+                if (pSapCtx->nAcceptMac == MAX_MAC_ADDRESS_ACCEPTED)
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                            "White list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x", 
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                    return VOS_STATUS_E_FAILURE;
+                }
+                if (staInWhiteList)
+                {
+                    //Do nothing if already present in white list. Just print a warning
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                            "MAC address already present in white list %02x:%02x:%02x:%02x:%02x:%02x",
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                } else 
+                {
+                    if (staInBlackList)
+                    {
+                        //remove it from black list before adding to the white list
+                        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                                "STA present in black list so first remove from it");
+                        sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);                      
+                    }
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                            "... Now add to the white list");                   
+                    sapAddMacToACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, pPeerStaMac);
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
+                            pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
+                }               
+            }
+            else if (cmd == DELETE_STA_FROM_ACL)
+            {
+                if (staInWhiteList)
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from white list");                                      
+                    sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);                                      
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
+                            pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
+                }
+                else
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                            "MAC address to be deleted is not present in the white list %02x:%02x:%02x:%02x:%02x:%02x",
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                    return VOS_STATUS_E_FAILURE;
+                }
+            }
+            else
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");                                                        
+                return VOS_STATUS_E_FAILURE;
+            }
+            break;
+
+        case eSAP_BLACK_LIST:           
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,
+                    "cmd %d", cmd);
+            if (cmd == ADD_STA_TO_ACL)
+            {
+                //error check
+                // if list is already at max, return failure
+                if (pSapCtx->nDenyMac == MAX_MAC_ADDRESS_ACCEPTED)
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                            "Black list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x",
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                    return VOS_STATUS_E_FAILURE;
+                }
+                if (staInBlackList)
+                {
+                    //Do nothing if already present in white list
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                            "MAC address already present in black list %02x:%02x:%02x:%02x:%02x:%02x",
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                } else 
+                {
+                    if (staInWhiteList)
+                    {
+                        //remove it from white list before adding to the white list
+                        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                                "Present in white list so first remove from it");
+                        sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);                      
+                    }
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                            "... Now add to black list");                   
+                    sapAddMacToACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, pPeerStaMac);
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"size of accept and deny lists %d %d",
+                            pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
+                }                   
+            }
+            else if (cmd == DELETE_STA_FROM_ACL)
+            {
+                if (staInBlackList)
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from black list");                                      
+                    sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);                                      
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"no accept and deny mac %d %d",
+                            pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
+                }
+                else
+                {
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
+                            "MAC address to be deleted is not present in the black list %02x:%02x:%02x:%02x:%02x:%02x",
+                            pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
+                            pPeerStaMac[4], pPeerStaMac[5]);
+                    return VOS_STATUS_E_FAILURE;
+                }
+            }
+            else
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");                                                        
+                return VOS_STATUS_E_FAILURE;
+            }
+            break;
+
+        default:
+            {
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                        "Invalid list type passed %d",listType);
+                return VOS_STATUS_E_FAILURE;
+            }
+    }
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"After modification of ACL");
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
+    sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
+    sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
+    return VOS_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_DisassocSta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD initiated disassociation of station
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx            : Pointer to vos global context structure
+    pPeerStaMac         : Mac address of the station to disassociate
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_DisassocSta
+(
+    v_PVOID_t  pvosGCtx,
+    v_U8_t *pPeerStaMac
+)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      Extract SAP control block 
+      ------------------------------------------------------------------------*/    
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    sme_RoamDisconnectSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
+                            pPeerStaMac);
+
+    return VOS_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+  FUNCTION    WLANSAP_DeauthSta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD initiated deauthentication of station
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    pvosGCtx            : Pointer to vos global context structure
+    pPeerStaMac         : Mac address of the station to deauthenticate
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS 
+WLANSAP_DeauthSta
+(
+    v_PVOID_t  pvosGCtx,
+    v_U8_t *pPeerStaMac
+)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      Extract SAP control block 
+      ------------------------------------------------------------------------*/    
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    sme_RoamDeauthSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
+                            pPeerStaMac);
+
+    return VOS_STATUS_SUCCESS;
+}
+/*==========================================================================
+  FUNCTION    WLANSAP_SetChannelRange
+
+  DESCRIPTION 
+    This api function sets the range of channels for AP.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+    startChannel         : start channel
+    endChannel           : End channel
+    operatingBand        : Operating band (2.4GHz/5GHz)
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel, 
+                              v_U8_t operatingBand)
+{
+
+    v_U8_t    validChannelFlag =0;
+    v_U8_t    loopStartCount =0;
+    v_U8_t    loopEndCount =0;
+    v_U8_t    bandStartChannel =0;
+    v_U8_t    bandEndChannel =0;   
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+         "WLANSAP_SetChannelRange:startChannel %d,EndChannel %d,Operatingband:%d",
+         startChannel,endChannel,operatingBand);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      ------------------------------------------------------------------------*/    
+    if (( WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMIN > operatingBand)||
+          (WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMAX < operatingBand))
+    {
+         VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                     "Invalid operatingBand on WLANSAP_SetChannelRange");
+        return VOS_STATUS_E_FAULT;
+    }
+    if (( WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMIN > startChannel)||
+         (WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMAX < startChannel))
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                    "Invalid startChannel value on WLANSAP_SetChannelRange");
+        return VOS_STATUS_E_FAULT;
+    }
+    if (( WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMIN > endChannel)||
+         (WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMAX < endChannel))
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                      "Invalid endChannel value on WLANSAP_SetChannelRange");
+        return VOS_STATUS_E_FAULT;
+    }
+    switch(operatingBand)
+    {
+       case RF_SUBBAND_2_4_GHZ:
+          bandStartChannel = RF_CHAN_1;
+          bandEndChannel = RF_CHAN_14;
+          break;
+          
+       case RF_SUBBAND_5_LOW_GHZ:
+          bandStartChannel = RF_CHAN_36;
+          bandEndChannel = RF_CHAN_64;
+          break;
+          
+       case RF_SUBBAND_5_MID_GHZ:
+          bandStartChannel = RF_CHAN_100;
+          bandEndChannel = RF_CHAN_140;
+          break;
+          
+       case RF_SUBBAND_5_HIGH_GHZ:
+          bandStartChannel = RF_CHAN_149;
+          bandEndChannel = RF_CHAN_165;
+          break;
+          
+       case RF_SUBBAND_4_9_GHZ:
+          bandStartChannel = RF_CHAN_240;
+          bandEndChannel = RF_CHAN_216;
+          break;
+       default:
+          VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "Invalid operatingBand value on WLANSAP_SetChannelRange");
+          break;
+    }      
+ 
+    /* Validating the start channel is in range or not*/
+    for(loopStartCount = bandStartChannel ; loopStartCount <= bandEndChannel ; 
+    loopStartCount++)
+    { 
+       if(rfChannels[loopStartCount].channelNum == startChannel )
+       {
+          /* start channel is in the range */
+          break;
+       }
+    }
+    /* Validating the End channel is in range or not*/
+    for(loopEndCount = bandStartChannel ; loopEndCount <= bandEndChannel ; 
+    loopEndCount++)
+    { 
+        if(rfChannels[loopEndCount].channelNum == endChannel )
+        {
+          /* End channel is in the range */
+            break;
+        }
+    }
+    if((loopStartCount > bandEndChannel)||(loopEndCount > bandEndChannel))
+    {
+       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Invalid startChannel-%d or EndChannel-%d for band -%d",
+                   __FUNCTION__,startChannel,endChannel,operatingBand);
+       /* Supplied channels are nt in the operating band so set the default 
+            channels for the given operating band */
+       startChannel = rfChannels[bandStartChannel].channelNum;
+       endChannel = rfChannels[bandEndChannel].channelNum;;
+    }
+    
+    /*Search for the Active channels in the given range */
+    for( loopStartCount = bandStartChannel; loopStartCount <= bandEndChannel; loopStartCount++ )
+    {
+       if((startChannel <= rfChannels[loopStartCount].channelNum)&&
+             (endChannel >= rfChannels[loopStartCount].channelNum ))
+       {
+          if( regChannels[loopStartCount].enabled )
+          {
+             validChannelFlag = 1;
+             break;
+          }
+       }
+    }
+    if(0 == validChannelFlag)
+    { 
+       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+         "%s-No active channels present in the given range for the current region",
+         __FUNCTION__);
+       /* There is no active channel in the supplied range.Updating the config 
+       with the default channels in the given band so that we can select the best channel in the sub-band*/
+       startChannel = rfChannels[bandStartChannel].channelNum;
+       endChannel = rfChannels[bandEndChannel].channelNum;;
+    }
+   
+    if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, 
+       operatingBand, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+         VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+          "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND to CCn");
+         return VOS_STATUS_E_FAULT;
+    }
+    if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, 
+        startChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+ 
+       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+          "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
+       return VOS_STATUS_E_FAULT;
+       
+    }     
+    if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, 
+       endChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
+    {
+ 
+       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+          "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
+       return VOS_STATUS_E_FAULT;
+    }
+    return VOS_STATUS_SUCCESS;
+}
+#endif
+
+/*==========================================================================
+  FUNCTION    WLANSAP_SetCounterMeasure
+
+  DESCRIPTION 
+    This api function is used to disassociate all the stations and prevent 
+    association for any other station.Whenever Authenticator receives 2 mic failures 
+    within 60 seconds, Authenticator will enable counter measure at SAP Layer. 
+    Authenticator will start the 60 seconds timer. Core stack will not allow any 
+    STA to associate till HDD disables counter meassure. Core stack shall kick out all the 
+    STA which are currently associated and DIASSOC Event will be propogated to HDD for 
+    each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator 
+    will disable the counter meassure at core stack. Now core stack can allow STAs to associate.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE
+will come out of this state.
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetCounterMeasure
+(
+    v_PVOID_t pvosGCtx,
+    v_BOOL_t bEnable
+)
+{
+    ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+
+    /*------------------------------------------------------------------------
+      Sanity check
+      Extract SAP control block 
+      ------------------------------------------------------------------------*/
+    if (NULL == pSapCtx)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+    }
+
+    sme_RoamTKIPCounterMeasures(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, bEnable);
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_SetKeysSta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to set key for a station.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pSetKeyInfo: tCsrRoamSetKey structure for the station
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetKeySta
+(
+    v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+        eHalStatus halStatus = eHAL_STATUS_FAILURE;
+        v_U32_t roamId=0xFF;
+
+    if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
+    {
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if (NULL == hHal)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        halStatus = sme_RoamSetKey(hHal, pSapCtx->sessionId, pSetKeyInfo, &roamId);
+
+        if (halStatus == eHAL_STATUS_SUCCESS)
+        {
+            vosStatus = VOS_STATUS_SUCCESS;
+        } else
+        {
+            vosStatus = VOS_STATUS_E_FAULT;
+        }
+    }
+    else
+        vosStatus = VOS_STATUS_E_FAULT;
+
+    return vosStatus;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_DelKeySta
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to delete key for a station.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pSetKeyInfo: tCsrRoamRemoveKey structure for the station
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_DelKeySta
+(
+     v_PVOID_t pvosGCtx, 
+    tCsrRoamRemoveKey *pRemoveKeyInfo
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+    v_U32_t roamId=0xFF;
+    tCsrRoamRemoveKey RemoveKeyInfo;
+
+    if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
+    {
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if (NULL == pSapCtx)
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if (NULL == hHal)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+
+        vos_mem_zero(&RemoveKeyInfo, sizeof(RemoveKeyInfo));
+        RemoveKeyInfo.encType = pRemoveKeyInfo->encType;
+        vos_mem_copy(RemoveKeyInfo.peerMac, pRemoveKeyInfo->peerMac, WNI_CFG_BSSID_LEN); 
+        RemoveKeyInfo.keyId = pRemoveKeyInfo->keyId;
+
+        halStatus = sme_RoamRemoveKey(hHal, pSapCtx->sessionId, &RemoveKeyInfo, &roamId);
+
+        if (HAL_STATUS_SUCCESS(halStatus))
+        {
+            vosStatus = VOS_STATUS_SUCCESS;
+        }
+        else
+        {
+            vosStatus = VOS_STATUS_E_FAULT;
+        }
+    }
+    else
+        vosStatus = VOS_STATUS_E_FAULT;
+
+    return vosStatus;
+}
+
+VOS_STATUS
+WLANSap_getstationIE_information(v_PVOID_t pvosGCtx, 
+                                 v_U32_t   *pLen,
+                                 v_U8_t    *pBuf)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+    ptSapContext  pSapCtx = NULL;
+    v_U32_t len = 0;
+
+    if (VOS_STA_SAP_MODE == vos_get_conparam ( )){
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if (NULL == pSapCtx)
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        if (pLen)
+        {
+            len = *pLen;
+            *pLen = pSapCtx->nStaWPARSnReqIeLength;
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                       "%s: WPAIE len : %x", __FUNCTION__, *pLen);
+            if(pBuf)
+            {
+                if(len >= pSapCtx->nStaWPARSnReqIeLength)
+                {
+                    vos_mem_copy( pBuf, pSapCtx->pStaWpaRsnReqIE, pSapCtx->nStaWPARSnReqIeLength);
+                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                               "%s: WPAIE: %02x:%02x:%02x:%02x:%02x:%02x",
+                               __FUNCTION__,
+                               pBuf[0], pBuf[1], pBuf[2],
+                               pBuf[3], pBuf[4], pBuf[5]);
+                    vosStatus = VOS_STATUS_SUCCESS;
+                }
+            }
+        }
+    }
+   
+    if( VOS_STATUS_E_FAILURE == vosStatus)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Error unable to populate the RSNWPAIE",
+                  __FUNCTION__); 
+    }
+
+    return vosStatus;
+
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Set_WpsIe
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to set WPS IE.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+pWPSIE:  tSap_WPSIE structure that include WPS IEs
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Set_WpsIe
+(
+ v_PVOID_t pvosGCtx, tSap_WPSIE *pSap_WPSIe
+)
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+            "%s, %d", __FUNCTION__, __LINE__);    
+            
+    if(VOS_STA_SAP_MODE == vos_get_conparam ( )) {
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if ( NULL == pSapCtx )
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if ( NULL == hHal ){
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        
+        if ( sap_AcquireGlobalLock( pSapCtx ) == VOS_STATUS_SUCCESS )
+        {
+            if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_BEACON_IE)
+            {
+                vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSBeaconIE, &pSap_WPSIe->sapwpsie.sapWPSBeaconIE, sizeof(tSap_WPSBeaconIE));    
+            }
+            else if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_PROBE_RSP_IE) 
+            {
+                vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSProbeRspIE, &pSap_WPSIe->sapwpsie.sapWPSProbeRspIE, sizeof(tSap_WPSProbeRspIE));
+            }
+            else
+            {
+                sap_ReleaseGlobalLock( pSapCtx );
+                return VOS_STATUS_E_FAULT;
+            }
+            sap_ReleaseGlobalLock( pSapCtx );
+            return VOS_STATUS_SUCCESS;
+        }
+        else
+            return VOS_STATUS_E_FAULT;
+    }
+    else
+        return VOS_STATUS_E_FAULT;
+}
+
+/*==========================================================================
+  FUNCTION   WLANSAP_Update_WpsIe
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to update WPS IEs.
+
+  DEPENDENCIES
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Update_WpsIe
+(
+ v_PVOID_t pvosGCtx
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
+    ptSapContext  pSapCtx = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+    v_PVOID_t hHal = NULL;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+            "%s, %d", __FUNCTION__, __LINE__);    
+    
+    if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if ( NULL == pSapCtx )
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if ( NULL == hHal ){
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_RoamUpdateAPWPSIE( hHal, pSapCtx->sessionId, &pSapCtx->APWPSIEs);
+
+        if(halStatus == eHAL_STATUS_SUCCESS) {
+            vosStatus = VOS_STATUS_SUCCESS;
+        } else
+        {
+            vosStatus = VOS_STATUS_E_FAULT;
+        }
+
+    }
+
+    return vosStatus;
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Get_WPS_State
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to check if WPS session in process.
+
+  DEPENDENCIES
+    NA. 
+
+  PARAMETERS
+
+    IN
+pvosGCtx: Pointer to vos global context structure
+
+    OUT
+pbWPSState: Pointer to variable to indicate if it is in WPS Registration state
+ 
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS
+WLANSAP_Get_WPS_State
+(
+ v_PVOID_t pvosGCtx, v_BOOL_t *bWPSState
+)
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+        "%s, %d", __FUNCTION__, __LINE__);    
+          
+    if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
+    
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if ( NULL == pSapCtx )
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+             return VOS_STATUS_E_FAULT;
+        }
+
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if ( NULL == hHal ){
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+    
+        if ( sap_AcquireGlobalLock(pSapCtx ) == VOS_STATUS_SUCCESS )
+        {
+            if(pSapCtx->APWPSIEs.SirWPSProbeRspIE.FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
+                *bWPSState = eANI_BOOLEAN_TRUE;
+            else
+                *bWPSState = eANI_BOOLEAN_FALSE;
+            
+            sap_ReleaseGlobalLock( pSapCtx  );
+            
+            return VOS_STATUS_SUCCESS;
+        }
+        else 
+            return VOS_STATUS_E_FAULT;
+    }
+    else
+        return VOS_STATUS_E_FAULT;
+
+}
+
+VOS_STATUS
+sap_AcquireGlobalLock
+(
+    ptSapContext  pSapCtx 
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
+
+    if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &pSapCtx->SapGlobalLock) ) )
+    {
+            vosStatus = VOS_STATUS_SUCCESS;
+    }
+
+    return (vosStatus);
+}
+
+VOS_STATUS
+sap_ReleaseGlobalLock
+(
+    ptSapContext  pSapCtx 
+)
+{
+    VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
+
+    if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &pSapCtx->SapGlobalLock) ) )
+    {
+        vosStatus = VOS_STATUS_SUCCESS;
+    }
+
+    return (vosStatus);
+}
+
+/*==========================================================================
+  FUNCTION    WLANSAP_Set_WPARSNIes
+
+  DESCRIPTION 
+    This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+    IN
+        pvosGCtx: Pointer to vos global context structure
+        pWPARSNIEs: buffer to the WPA/RSN IEs 
+        WPARSNIEsLen: length of WPA/RSN IEs
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen)
+{
+ 
+    ptSapContext  pSapCtx = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+    v_PVOID_t hHal = NULL;
+
+    if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
+        pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
+        if ( NULL == pSapCtx )
+        { 
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if ( NULL == hHal ){
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        
+        pSapCtx->APWPARSNIEs.length = (tANI_U16)WPARSNIEsLen;
+        vos_mem_copy(pSapCtx->APWPARSNIEs.rsnIEdata, pWPARSNIEs, WPARSNIEsLen);
+    
+        halStatus = sme_RoamUpdateAPWPARSNIEs( hHal, pSapCtx->sessionId, &pSapCtx->APWPARSNIEs);
+
+        if(halStatus == eHAL_STATUS_SUCCESS) {
+            return VOS_STATUS_SUCCESS;
+        } else
+        {
+            return VOS_STATUS_E_FAULT;
+        }
+    }
+
+    return VOS_STATUS_E_FAULT;    
+}
+
+VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset)
+{
+    if (NULL == pvosGCtx)
+    {
+        return VOS_STATUS_E_FAULT;
+    }
+
+    return (WLANTL_GetSoftAPStatistics(pvosGCtx, statBuf, bReset));
+}
+
+#ifdef WLAN_FEATURE_P2P
+/*==========================================================================
+
+  FUNCTION    WLANSAP_SendAction
+
+  DESCRIPTION 
+    This api function provides to send action frame sent by upper layer.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    pBuf: Pointer of the action frame to be transmitted
+    len: Length of the action frame
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf,
+                               tANI_U32 len )
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+
+    if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
+    {
+        pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
+                       __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_sendAction( hHal, pSapCtx->sessionId, pBuf, len );
+
+        if ( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+               "Failed to Send Action Frame");
+
+    return VOS_STATUS_E_FAULT;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_RemainOnChannel
+
+  DESCRIPTION 
+    This api function provides to set Remain On channel on specified channel
+    for specified duration.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    channel: Channel on which driver has to listen 
+    duration: Duration for which driver has to listen on specified channel
+    callback: Callback function to be called once Listen is done.
+    pContext: Context needs to be called in callback function. 
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx,
+                                    tANI_U8 channel, tANI_U32 duration,
+                                    remainOnChanCallback callback,
+                                    void *pContext )
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+
+    if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
+    {
+        pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
+                       __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_RemainOnChannel( hHal, pSapCtx->sessionId,
+                          channel, duration, callback, pContext );
+
+        if( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+               "Failed to Set Remain on Channel");
+
+    return VOS_STATUS_E_FAULT;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_CancelRemainOnChannel
+
+  DESCRIPTION 
+    This api cancel previous remain on channel request.
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx )
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+
+    if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
+    {
+        pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
+                       __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_CancelRemainOnChannel( hHal, pSapCtx->sessionId );
+
+        if( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to Cancel Remain on Channel");
+
+    return VOS_STATUS_E_FAULT;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_RegisterMgmtFrame
+
+  DESCRIPTION 
+    HDD use this API to register specified type of frame with CORE stack.
+    On receiving such kind of frame CORE stack should pass this frame to HDD
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    frameType: frameType that needs to be registered with PE.
+    matchData: Data pointer which should be matched after frame type is matched.
+    matchLen: Length of the matchData
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
+                                      tANI_U8* matchData, tANI_U16 matchLen )
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+
+    if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
+    {
+        pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
+                       __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_RegisterMgmtFrame(hHal, pSapCtx->sessionId,
+                          frameType, matchData, matchLen);
+
+        if( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to Register MGMT frame");
+
+    return VOS_STATUS_E_FAULT;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANSAP_DeRegisterMgmtFrame
+
+  DESCRIPTION 
+   This API is used to deregister previously registered frame. 
+
+  DEPENDENCIES 
+    NA. 
+
+  PARAMETERS
+
+  IN
+    pvosGCtx: Pointer to vos global context structure
+    frameType: frameType that needs to be De-registered with PE.
+    matchData: Data pointer which should be matched after frame type is matched.
+    matchLen: Length of the matchData
+   
+  RETURN VALUE
+    The VOS_STATUS code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:  Success
+  
+  SIDE EFFECTS   
+============================================================================*/
+VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
+                                      tANI_U8* matchData, tANI_U16 matchLen )
+{
+    ptSapContext  pSapCtx = NULL;
+    v_PVOID_t hHal = NULL;
+    eHalStatus halStatus = eHAL_STATUS_FAILURE;
+
+    if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
+    {
+        pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
+        if (NULL == pSapCtx)
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
+            return VOS_STATUS_E_FAULT;
+        }
+        hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+        if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                       "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
+                       __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
+            return VOS_STATUS_E_FAULT;
+        }
+
+        halStatus = sme_DeregisterMgmtFrame( hHal, pSapCtx->sessionId,
+                          frameType, matchData, matchLen );
+
+        if( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            return VOS_STATUS_SUCCESS;
+        }
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to Deregister MGMT frame");
+
+    return VOS_STATUS_E_FAULT;
+}
+#endif // WLAN_FEATURE_P2P
diff --git a/CORE/SME/inc/btcApi.h b/CORE/SME/inc/btcApi.h
new file mode 100644
index 0000000..9cd2466
--- /dev/null
+++ b/CORE/SME/inc/btcApi.h
@@ -0,0 +1,347 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  btcApi.h
+*
+* Description: BTC Events Layer API definitions.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+
+#ifndef __BTC_API_H__
+#define __BTC_API_H__
+
+#include "vos_types.h"
+#include "vos_timer.h"
+
+#define BT_INVALID_CONN_HANDLE (0xFFFF)  /**< Invalid connection handle */
+
+/* ACL and Sync connection attempt results */
+#define BT_CONN_STATUS_FAIL      (0)         /**< Connection failed */
+#define BT_CONN_STATUS_SUCCESS   (1)         /**< Connection successful */
+#define BT_CONN_STATUS_MAX       (2)         /**< This and beyond are invalid values */
+
+/** ACL and Sync link types
+  These must match the Bluetooth Spec!
+*/
+#define BT_SCO                  (0)   /**< SCO Link */
+#define BT_ACL                  (1)   /**< ACL Link */
+#define BT_eSCO                 (2)   /**< eSCO Link */
+#define BT_LINK_TYPE_MAX        (3)   /**< This value and higher are invalid */
+
+/** ACL link modes
+    These must match the Bluetooth Spec!
+*/
+#define BT_ACL_ACTIVE           (0)   /**< Active mode */
+#define BT_ACL_HOLD             (1)   /**< Hold mode */
+#define BT_ACL_SNIFF            (2)   /**< Sniff mode */
+#define BT_ACL_PARK             (3)   /**< Park mode */
+#define BT_ACL_MODE_MAX         (4)   /**< This value and higher are invalid */
+
+/**
+ * A2DP BTC max no of BT sub intervals
+ *
+ * **/
+#define BTC_MAX_NUM_ACL_BT_SUB_INTS (7)
+
+/** BTC Executions Modes allowed to be set by user
+*/
+#define BTC_SMART_COEXISTENCE   (0) /** BTC Mapping Layer decides whats best */
+#define BTC_WLAN_ONLY           (1) /** WLAN takes all mode */
+#define BTC_PTA_ONLY            (2) /** Allow only 3 wire protocol in H/W */
+#define BTC_SMART_MAX_WLAN      (3) /** BTC Mapping Layer decides whats best, WLAN weighted */
+#define BTC_SMART_MAX_BT        (4) /** BTC Mapping Layer decides whats best, BT weighted */
+#define BTC_SMART_BT_A2DP       (5) /** BTC Mapping Layer decides whats best, balanced + BT A2DP weight */
+#define BT_EXEC_MODE_MAX        (6) /** This and beyond are invalid values */
+
+/** Enumeration of different kinds actions that BTC Mapping Layer
+    can do if PM indication (to AP) fails.
+*/
+#define BTC_RESTART_CURRENT     (0) /** Restart the interval we just failed to leave */
+#define BTC_START_NEXT          (1) /** Start the next interval even though the PM transition at the AP was unsuccessful */
+#define BTC_ACTION_TYPE_MAX     (2) /** This and beyond are invalid values */
+
+#define BTC_BT_INTERVAL_MODE1_DEFAULT       (120) /** BT Interval in Mode 1 */
+#define BTC_WLAN_INTERVAL_MODE1_DEFAULT     (30)  /** WLAN Interval in Mode 1 */
+
+/** Bitmaps used for maintaining various BT events that requires
+    enough time to complete such that it might require disbling of
+    heartbeat monitoring to avoid WLAN link loss with the AP
+*/
+#define BT_INQUIRY_STARTED                  (1<<0)
+#define BT_PAGE_STARTED                     (1<<1)
+#define BT_CREATE_ACL_CONNECTION_STARTED    (1<<2)
+#define BT_CREATE_SYNC_CONNECTION_STARTED   (1<<3)
+
+/** Maximum time duration in milliseconds between a specific BT start event and its
+    respective stop event, before it can be declared timed out on receiving the stop event.
+*/
+#define BT_MAX_EVENT_DONE_TIMEOUT   45000
+
+
+/*
+    To suppurt multiple SCO connections for BT+UAPSD work
+*/
+#define BT_MAX_SCO_SUPPORT  3
+#define BT_MAX_ACL_SUPPORT  3
+#define BT_MAX_DISCONN_SUPPORT (BT_MAX_SCO_SUPPORT+BT_MAX_ACL_SUPPORT)
+#define BT_MAX_NUM_EVENT_ACL_DEFERRED  4  //We may need to defer these many BT events for ACL
+#define BT_MAX_NUM_EVENT_SCO_DEFERRED  4  //We may need to defer these many BT events for SYNC
+
+
+/** Enumeration of all the different kinds of BT events
+*/
+typedef enum eSmeBtEventType
+{
+  BT_EVENT_DEVICE_SWITCHED_ON,
+  BT_EVENT_DEVICE_SWITCHED_OFF,
+  BT_EVENT_INQUIRY_STARTED,
+  BT_EVENT_INQUIRY_STOPPED,
+  BT_EVENT_INQUIRY_SCAN_STARTED,
+  BT_EVENT_INQUIRY_SCAN_STOPPED,
+  BT_EVENT_PAGE_STARTED,
+  BT_EVENT_PAGE_STOPPED,
+  BT_EVENT_PAGE_SCAN_STARTED,
+  BT_EVENT_PAGE_SCAN_STOPPED,
+  BT_EVENT_CREATE_ACL_CONNECTION,
+  BT_EVENT_ACL_CONNECTION_COMPLETE,
+  BT_EVENT_CREATE_SYNC_CONNECTION,
+  BT_EVENT_SYNC_CONNECTION_COMPLETE,
+  BT_EVENT_SYNC_CONNECTION_UPDATED,
+  BT_EVENT_DISCONNECTION_COMPLETE,
+  BT_EVENT_MODE_CHANGED,
+  BT_EVENT_A2DP_STREAM_START,
+  BT_EVENT_A2DP_STREAM_STOP,
+  BT_EVENT_TYPE_MAX,    //This and beyond are invalid values
+} tSmeBtEventType;
+
+/** BT-AMP events type
+*/
+typedef enum eSmeBtAmpEventType
+{
+  BTAMP_EVENT_CONNECTION_START,
+  BTAMP_EVENT_CONNECTION_STOP,
+  BTAMP_EVENT_CONNECTION_TERMINATED,
+  BTAMP_EVENT_TYPE_MAX, //This and beyond are invalid values
+} tSmeBtAmpEventType;
+
+
+/**Data structure that specifies the needed event parameters for
+    BT_EVENT_CREATE_ACL_CONNECTION and BT_EVENT_ACL_CONNECTION_COMPLETE
+*/
+typedef struct sSmeBtAclConnectionParam
+{
+   v_U8_t       bdAddr[6];
+   v_U16_t      connectionHandle;
+   v_U8_t       status;
+} tSmeBtAclConnectionParam, *tpSmeBtAclConnectionParam;
+
+/** Data structure that specifies the needed event parameters for
+    BT_EVENT_CREATE_SYNC_CONNECTION, BT_EVENT_SYNC_CONNECTION_COMPLETE
+    and BT_EVENT_SYNC_CONNECTION_UPDATED
+*/
+typedef struct sSmeBtSyncConnectionParam
+{
+   v_U8_t       bdAddr[6];
+   v_U16_t      connectionHandle;
+   v_U8_t       status;
+   v_U8_t       linkType;
+   v_U8_t       scoInterval; //units in number of 625us slots
+   v_U8_t       scoWindow;   //units in number of 625us slots
+   v_U8_t       retransmisisonWindow; //units in number of 625us slots
+} tSmeBtSyncConnectionParam, *tpSmeBtSyncConnectionParam;
+
+typedef struct sSmeBtSyncUpdateHist
+{
+    tSmeBtSyncConnectionParam btSyncConnection;
+    v_BOOL_t fValid;
+} tSmeBtSyncUpdateHist, *tpSmeBtSyncUpdateHist;
+
+/**Data structure that specifies the needed event parameters for
+    BT_EVENT_MODE_CHANGED
+*/
+typedef struct sSmeBtAclModeChangeParam
+{
+    v_U16_t     connectionHandle;
+    v_U8_t      mode;
+} tSmeBtAclModeChangeParam, *tpSmeBtAclModeChangeParam;
+
+/*Data structure that specifies the needed event parameters for
+    BT_EVENT_DISCONNECTION_COMPLETE
+*/
+typedef struct sSmeBtDisconnectParam
+{
+   v_U16_t connectionHandle;
+} tSmeBtDisconnectParam, *tpSmeBtDisconnectParam;
+
+/*Data structure that specifies the needed event parameters for
+    BT_EVENT_A2DP_STREAM_START
+    BT_EVENT_A2DP_STREAM_STOP
+*/
+typedef struct sSmeBtA2DPParam
+{
+   v_U8_t       bdAddr[6];
+} tSmeBtA2DPParam, *tpSmeBtA2DPParam;
+
+
+/** Generic Bluetooth Event structure for BTC
+*/
+typedef struct sSmeBtcBtEvent
+{
+   tSmeBtEventType btEventType;
+   union
+   {
+      v_U8_t                    bdAddr[6];    /**< For events with only a BT Addr in event_data */
+      tSmeBtAclConnectionParam  btAclConnection;
+      tSmeBtSyncConnectionParam btSyncConnection;
+      tSmeBtDisconnectParam     btDisconnect;
+      tSmeBtAclModeChangeParam  btAclModeChange;
+   }uEventParam;
+} tSmeBtEvent, *tpSmeBtEvent;
+
+
+/**
+    BT-AMP Event Structure
+*/
+typedef struct sSmeBtAmpEvent
+{
+  tSmeBtAmpEventType btAmpEventType;
+
+} tSmeBtAmpEvent, *tpSmeBtAmpEvent;
+
+
+/** Data structure that specifies the BTC Configuration parameters
+*/
+typedef struct sSmeBtcConfig
+{
+   v_U8_t       btcExecutionMode;
+   v_U8_t       btcConsBtSlotsToBlockDuringDhcp;
+   v_U8_t       btcA2DPBtSubIntervalsDuringDhcp;
+   v_U8_t       btcActionOnPmFail;
+   v_U8_t       btcBtIntervalMode1;
+   v_U8_t       btcWlanIntervalMode1;
+
+} tSmeBtcConfig, *tpSmeBtcConfig;
+
+
+typedef struct sSmeBtAclModeChangeEventHist
+{
+    tSmeBtAclModeChangeParam  btAclModeChange;
+    v_BOOL_t fValid;
+} tSmeBtAclModeChangeEventHist, *tpSmeBtAclModeChangeEventHist;
+
+typedef struct sSmeBtAclEventHist
+{
+    //At most, cached events are COMPLETION, DISCONNECT, CREATION, COMPLETION
+    tSmeBtEventType btEventType[BT_MAX_NUM_EVENT_ACL_DEFERRED];
+    tSmeBtAclConnectionParam  btAclConnection[BT_MAX_NUM_EVENT_ACL_DEFERRED];
+    //bNextEventIdx == 0 meaning no event cached here
+    tANI_U8 bNextEventIdx;
+} tSmeBtAclEventHist, *tpSmeBtAclEventHist;
+
+typedef struct sSmeBtSyncEventHist
+{
+    //At most, cached events are COMPLETION, DISCONNECT, CREATION, COMPLETION
+    tSmeBtEventType btEventType[BT_MAX_NUM_EVENT_SCO_DEFERRED];
+    tSmeBtSyncConnectionParam  btSyncConnection[BT_MAX_NUM_EVENT_SCO_DEFERRED];
+    //bNextEventIdx == 0 meaning no event cached here
+    tANI_U8 bNextEventIdx;
+} tSmeBtSyncEventHist, *tpSmeBtSyncEventHist;
+
+typedef struct sSmeBtDisconnectEventHist
+{
+    tSmeBtDisconnectParam btDisconnect;
+    v_BOOL_t fValid;
+} tSmeBtDisconnectEventHist, *tpSmeBtDisconnectEventHist;
+
+
+/*
+  Data structure for the history of BT events
+*/
+typedef struct sSmeBtcEventHist
+{
+   tSmeBtSyncEventHist btSyncConnectionEvent[BT_MAX_SCO_SUPPORT];
+   tSmeBtAclEventHist btAclConnectionEvent[BT_MAX_ACL_SUPPORT];
+   tSmeBtAclModeChangeEventHist btAclModeChangeEvent[BT_MAX_ACL_SUPPORT];
+   tSmeBtDisconnectEventHist btDisconnectEvent[BT_MAX_DISCONN_SUPPORT];
+   tSmeBtSyncUpdateHist btSyncUpdateEvent[BT_MAX_SCO_SUPPORT];
+   int nInquiryEvent;    //>0 for # of outstanding inquiriy starts
+                         //<0 for # of outstanding inquiry stops
+                         //0 == no inquiry event
+   int nPageEvent;  //>0 for # of outstanding page starts
+                    //<0 for # of outstanding page stops
+                    //0 == no page event
+   v_BOOL_t fA2DPStarted;
+   v_BOOL_t fA2DPStopped;
+} tSmeBtcEventHist, *tpSmeBtcEventHist;
+
+typedef struct sSmeBtcEventReplay
+{
+   tSmeBtcEventHist btcEventHist;
+   v_BOOL_t fBTSwitchOn;
+   v_BOOL_t fBTSwitchOff;
+   //This is not directly tied to BT event so leave it alone when processing BT events
+   v_BOOL_t fRestoreHBMonitor;
+} tSmeBtcEventReplay, *tpSmeBtcEventReplay;
+
+typedef struct sSmeBtcInfo
+{
+   tSmeBtcConfig btcConfig;
+   v_BOOL_t      btcReady;
+   v_U8_t        btcEventState;
+   v_U8_t        btcHBActive;    /* Is HB currently active */
+   v_U8_t        btcHBCount;     /* default HB count */
+   vos_timer_t   restoreHBTimer; /* Timer to restore heart beat */
+   tSmeBtcEventReplay btcEventReplay;
+   v_BOOL_t      fReplayBTEvents;
+   v_BOOL_t      btcUapsdOk;  /* Indicate whether BTC is ok with UAPSD */
+   v_BOOL_t      fA2DPTrafStop;/*flag to check A2DP_STOP event has come before MODE_CHANGED*/
+   v_U16_t       btcScoHandles[BT_MAX_SCO_SUPPORT];  /* Handles for SCO, if any*/
+   v_BOOL_t      fA2DPUp;        /*remember whether A2DP is in session*/
+} tSmeBtcInfo, *tpSmeBtcInfo;
+
+
+/** Routine definitions
+*/
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+VOS_STATUS btcOpen (tHalHandle hHal);
+VOS_STATUS btcClose (tHalHandle hHal);
+VOS_STATUS btcReady (tHalHandle hHal);
+VOS_STATUS btcSendCfgMsg(tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig);
+VOS_STATUS btcSignalBTEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent);
+VOS_STATUS btcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig);
+VOS_STATUS btcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig);
+/*
+   Caller can check whether BTC's current event allows UAPSD. This doesn't affect
+   BMPS.
+   return:  VOS_TRUE -- BTC is ready for UAPSD
+            VOS_FALSE -- certain BT event is active, cannot enter UAPSD
+*/
+v_BOOL_t btcIsReadyForUapsd( tHalHandle hHal );
+eHalStatus btcHandleCoexInd(tHalHandle hHal, void* pMsg);
+#endif /* End of WLAN_MDM_CODE_REDUCTION_OPT */
+
+#endif
diff --git a/CORE/SME/inc/ccmApi.h b/CORE/SME/inc/ccmApi.h
new file mode 100644
index 0000000..5195459
--- /dev/null
+++ b/CORE/SME/inc/ccmApi.h
@@ -0,0 +1,116 @@
+/*
+ * 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 ccmApi.h
+  
+    \brief Exports and types for the Common Config Module (CCM)
+  
+    $Id$ 
+  
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated
+
+    This file contains all the interfaces for thge Platform Abstration Layer
+    functions.  It is intended to be included in all modules that are using 
+    the PAL interfaces.
+  
+   ========================================================================== */
+#ifndef CCMAPI_H__
+#define CCMAPI_H__
+
+//#include "wniCfgAp.h" /* CFG_PARAM_MAX_NUM */
+#include "wniCfgSta.h"
+#include "halTypes.h"
+
+#define CCM_11B_CHANNEL_END             14
+
+#define CCM_IS_RESULT_SUCCESS(result)   (WNI_CFG_SUCCESS == (result) ||\
+                                         WNI_CFG_NEED_RESTART == (result) || \
+                                         WNI_CFG_NEED_RELOAD == (result))
+
+#define CCM_INTEGER_TYPE                0
+#define CCM_STRING_TYPE                 1
+
+typedef void (*tCcmCfgSetCallback)(tHalHandle hHal, tANI_S32 result) ;
+
+typedef enum {
+    eCCM_STOPPED,
+    eCCM_STARTED,
+    eCCM_REQ_SENT,
+    eCCM_REQ_QUEUED,
+    eCCM_REQ_DONE,
+} eCcmState ;
+
+/* We do not use Linux's list facility */
+typedef struct cfgreq {
+    struct cfgreq       *next ;
+    tANI_U16            cfgId ;
+    tANI_U8             type ;
+    tANI_U8             state : 7 ;
+    tANI_U8             toBeSaved : 1 ;
+    tANI_S32            length ;
+    void                *ccmPtr;
+    tANI_U32            ccmValue;
+    tCcmCfgSetCallback  callback;
+    void                *done ;
+} tCfgReq ;
+
+typedef struct {
+    tANI_U16            started : 1 ;
+    tANI_U16            in_progress : 1 ;
+    tANI_U16            reserved : 14 ;
+    tANI_S16            nr_param ;
+    tANI_U32            result ;
+    tCcmCfgSetCallback  callback ;
+    void                *done ;
+} tCfgReplay ;
+
+struct ccmlink {
+    tCfgReq *head;
+    tCfgReq *tail;
+} ;
+
+typedef struct {
+    struct ccmlink      reqQ ;
+    eCcmState           state ;
+    tCfgReq *           comp[CFG_PARAM_MAX_NUM] ;
+    tCfgReplay          replay ;
+    void                *lock;
+} tCcm ;
+
+void ccmCfgCnfMsgHandler(tHalHandle hHal, void *msg) ;
+eHalStatus ccmOpen(tHalHandle hHal) ;
+eHalStatus ccmClose(tHalHandle hHal) ;
+void ccmStart(tHalHandle hHal) ;
+void ccmStop(tHalHandle hHal) ;
+//If callback is NULL, the API is not serialized for the CFGs
+eHalStatus ccmCfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) ;
+//If callback is NULL, the API is not serialized for the CFGs
+eHalStatus ccmCfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, tANI_U32 length, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) ;
+eHalStatus ccmCfgUpdate(tHalHandle hHal, tCcmCfgSetCallback callback) ;
+eHalStatus ccmCfgGetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 *pValue) ;
+eHalStatus ccmCfgGetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength) ;
+
+void ccmDumpInit(tHalHandle hHal);
+
+#endif /*CCMAPI_H__*/
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
new file mode 100644
index 0000000..60d9da9
--- /dev/null
+++ b/CORE/SME/inc/csrApi.h
@@ -0,0 +1,1385 @@
+/*
+ * 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 csrApi.h
+  
+    Exports and types for the Common Scan and Roaming Module interfaces.
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated 
+   ========================================================================== */
+#ifndef CSRAPI_H__
+#define CSRAPI_H__
+
+#include "sirApi.h"
+#include "sirMacProtDef.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halRfTypes.h"
+#endif
+#include "csrLinkList.h"
+
+typedef enum 
+{
+    eCSR_AUTH_TYPE_NONE,    //never used
+    // MAC layer authentication types
+    eCSR_AUTH_TYPE_OPEN_SYSTEM,
+    eCSR_AUTH_TYPE_SHARED_KEY,
+    eCSR_AUTH_TYPE_AUTOSWITCH,
+
+    // Upper layer authentication types
+    eCSR_AUTH_TYPE_WPA,
+    eCSR_AUTH_TYPE_WPA_PSK,
+    eCSR_AUTH_TYPE_WPA_NONE,
+
+    eCSR_AUTH_TYPE_RSN,
+    eCSR_AUTH_TYPE_RSN_PSK,
+#if defined WLAN_FEATURE_VOWIFI_11R
+    eCSR_AUTH_TYPE_FT_RSN,
+    eCSR_AUTH_TYPE_FT_RSN_PSK,
+#endif
+#ifdef FEATURE_WLAN_WAPI
+    eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE,
+    eCSR_AUTH_TYPE_WAPI_WAI_PSK,
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_CCX
+    eCSR_AUTH_TYPE_CCKM_WPA,
+    eCSR_AUTH_TYPE_CCKM_RSN,
+#endif /* FEATURE_WLAN_CCX */
+    eCSR_NUM_OF_SUPPORT_AUTH_TYPE,
+    eCSR_AUTH_TYPE_FAILED = 0xff,
+    eCSR_AUTH_TYPE_UNKNOWN = eCSR_AUTH_TYPE_FAILED,
+
+}eCsrAuthType;
+
+
+typedef enum 
+{
+    eCSR_ENCRYPT_TYPE_NONE,
+    eCSR_ENCRYPT_TYPE_WEP40_STATICKEY,
+    eCSR_ENCRYPT_TYPE_WEP104_STATICKEY,
+
+    eCSR_ENCRYPT_TYPE_WEP40,
+    eCSR_ENCRYPT_TYPE_WEP104,
+    eCSR_ENCRYPT_TYPE_TKIP,
+    eCSR_ENCRYPT_TYPE_AES,
+#ifdef FEATURE_WLAN_WAPI
+    eCSR_ENCRYPT_TYPE_WPI, //WAPI
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_CCX
+    eCSR_ENCRYPT_TYPE_KRK,
+#endif /* FEATURE_WLAN_CCX */
+#ifdef WLAN_FEATURE_11W
+    //11w BIP
+    eCSR_ENCRYPT_TYPE_AES_CMAC,
+#endif
+    eCSR_ENCRYPT_TYPE_ANY,
+    eCSR_NUM_OF_ENCRYPT_TYPE = eCSR_ENCRYPT_TYPE_ANY,
+
+    eCSR_ENCRYPT_TYPE_FAILED = 0xff,
+    eCSR_ENCRYPT_TYPE_UNKNOWN = eCSR_ENCRYPT_TYPE_FAILED,
+
+}eCsrEncryptionType;
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various Security types
+---------------------------------------------------------------------------*/
+typedef enum
+{
+    eCSR_SECURITY_TYPE_WPA,
+    eCSR_SECURITY_TYPE_RSN,
+#ifdef FEATURE_WLAN_WAPI
+    eCSR_SECURITY_TYPE_WAPI,
+#endif /* FEATURE_WLAN_WAPI */
+    eCSR_SECURITY_TYPE_UNKNOWN,
+
+}eCsrSecurityType;
+
+typedef enum
+{
+    eCSR_DOT11_MODE_TAURUS = 0, //This mean everything because it covers all thing we support
+    eCSR_DOT11_MODE_abg = 0x0001,    //11a/b/g only, no HT, no proprietary
+    eCSR_DOT11_MODE_11a = 0x0002,
+    eCSR_DOT11_MODE_11b = 0x0004,
+    eCSR_DOT11_MODE_11g = 0x0008,
+    eCSR_DOT11_MODE_11n = 0x0010,
+    eCSR_DOT11_MODE_POLARIS = 0x0020,
+    eCSR_DOT11_MODE_TITAN = 0x0040,
+    eCSR_DOT11_MODE_11g_ONLY = 0x0080,
+    eCSR_DOT11_MODE_11n_ONLY = 0x0100,
+    eCSR_DOT11_MODE_TAURUS_ONLY = 0x0200,
+    eCSR_DOT11_MODE_11b_ONLY = 0x0400,
+    eCSR_DOT11_MODE_11a_ONLY = 0x0800,
+    //This is for WIFI test. It is same as eWNIAPI_MAC_PROTOCOL_ALL except when it starts IBSS in 11B of 2.4GHz
+    //It is for CSR internal use
+    eCSR_DOT11_MODE_AUTO = 0x1000,
+
+    eCSR_NUM_PHY_MODE = 16,     //specify the number of maximum bits for phyMode
+}eCsrPhyMode;
+
+
+typedef tANI_U8 tCsrBssid[WNI_CFG_BSSID_LEN];
+
+typedef enum
+{
+    eCSR_BSS_TYPE_INFRASTRUCTURE,
+#ifdef WLAN_SOFTAP_FEATURE
+    eCSR_BSS_TYPE_INFRA_AP,       // SoftAP AP
+#endif
+    eCSR_BSS_TYPE_IBSS,           // an IBSS network we will NOT start
+    eCSR_BSS_TYPE_START_IBSS,     // an IBSS network we will start if no partners detected.
+    eCSR_BSS_TYPE_WDS_AP,         // BT-AMP AP
+    eCSR_BSS_TYPE_WDS_STA,        // BT-AMP station
+    eCSR_BSS_TYPE_ANY,            // any BSS type (IBSS or Infrastructure).
+}eCsrRoamBssType;
+
+
+
+typedef enum {
+    eCSR_SCAN_REQUEST_11D_SCAN = 1,
+    eCSR_SCAN_REQUEST_FULL_SCAN,
+    eCSR_SCAN_IDLE_MODE_SCAN,
+    eCSR_SCAN_HO_BG_SCAN, // bg scan request in NRT & RT Handoff sub-states
+    eCSR_SCAN_HO_PROBE_SCAN, // directed probe on an entry from the candidate list
+    eCSR_SCAN_HO_NT_BG_SCAN, // bg scan request in NT  sub-state
+    eCSR_SCAN_P2P_DISCOVERY,
+
+    eCSR_SCAN_SOFTAP_CHANNEL_RANGE,
+    eCSR_SCAN_P2P_FIND_PEER,
+}eCsrRequestType;
+
+typedef enum {
+    eCSR_SCAN_RESULT_GET = 0,
+    eCSR_SCAN_RESULT_FLUSH = 1,     //to delete all cached scan results
+}eCsrScanResultCmd;
+
+typedef enum
+{
+    eCSR_SCAN_SUCCESS,
+    eCSR_SCAN_FAILURE,
+    eCSR_SCAN_ABORT,
+   eCSR_SCAN_FOUND_PEER,    
+}eCsrScanStatus;
+
+#define CSR_SCAN_TIME_DEFAULT       0
+#define CSR_VALUE_IGNORED           0xFFFFFFFF
+#define CSR_RSN_PMKID_SIZE          16
+#define CSR_MAX_PMKID_ALLOWED       16
+#define CSR_WEP40_KEY_LEN       5
+#define CSR_WEP104_KEY_LEN      13
+#define CSR_TKIP_KEY_LEN        32
+#define CSR_AES_KEY_LEN         16
+#define CSR_MAX_TX_POWER        ( WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX )
+#define CSR_MAX_RSC_LEN          16
+#ifdef FEATURE_WLAN_WAPI
+#define CSR_WAPI_BKID_SIZE          16
+#define CSR_MAX_BKID_ALLOWED        16
+#define CSR_WAPI_KEY_LEN        32
+#define CSR_MAX_KEY_LEN         ( CSR_WAPI_KEY_LEN )  //longest one is for WAPI
+#else
+#define CSR_MAX_KEY_LEN         ( CSR_TKIP_KEY_LEN )  //longest one is for TKIP
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_CCX
+#define CSR_KRK_KEY_LEN 16
+#endif
+
+
+
+typedef struct tagCsrChannelInfo
+{
+    tANI_U8 numOfChannels;
+    tANI_U8 *ChannelList;   //it will be an array of channels
+}tCsrChannelInfo;
+
+typedef struct tagCsrSSIDInfo
+{
+   tSirMacSSid     SSID;   
+   tANI_BOOLEAN    handoffPermitted;
+   tANI_BOOLEAN    ssidHidden;
+}tCsrSSIDInfo;
+
+typedef struct tagCsrSSIDs
+{
+    tANI_U32 numOfSSIDs;
+    tCsrSSIDInfo *SSIDList;   //To be allocated for array of SSIDs
+}tCsrSSIDs;
+
+typedef struct tagCsrBSSIDs
+{
+    tANI_U32 numOfBSSIDs;
+    tCsrBssid *bssid;
+}tCsrBSSIDs;
+
+
+typedef struct tagCsrScanRequest 
+{
+    tSirScanType scanType;
+    tCsrBssid bssid;
+    eCsrRoamBssType BSSType;
+    tCsrSSIDs SSIDs;   
+    tCsrChannelInfo ChannelInfo;
+    tANI_U32 minChnTime;    //in units of milliseconds
+    tANI_U32 maxChnTime;    //in units of milliseconds
+    tANI_U32 restTime;      //in units of milliseconds  //ignored when not connected
+    tANI_U32 uIEFieldLen;
+    tANI_U8 *pIEField;
+    eCsrRequestType requestType;    //11d scan or full scan
+#ifdef WLAN_FEATURE_P2P
+    tANI_BOOLEAN p2pSearch;
+#endif
+}tCsrScanRequest;
+
+typedef struct tagCsrBGScanRequest
+{
+    tSirScanType scanType;
+    tSirMacSSid SSID;
+    tCsrChannelInfo ChannelInfo;
+    tANI_U32 scanInterval;  //in units of milliseconds
+    tANI_U32 minChnTime;    //in units of milliseconds
+    tANI_U32 maxChnTime;    //in units of milliseconds
+    tANI_U32 restTime;      //in units of milliseconds  //ignored when not connected
+    tANI_U32 throughputImpact;      //specify whether BG scan cares about impacting throughput  //ignored when not connected
+    tCsrBssid bssid;    //how to use it?? Apple
+}tCsrBGScanRequest;
+
+
+typedef struct tagCsrScanResultInfo
+{
+    //Carry the IEs for the current BSSDescription. A pointer to tDot11fBeaconIEs. Maybe NULL for start BSS.
+    void *pvIes;
+    tAniSSID ssId;
+    v_TIME_t timer; // timer is variable which is used for hidden SSID's timer value
+    //This member must be the last in the structure because the end of tSirBssDescription is an
+    //    array with nonknown size at this time
+    tSirBssDescription BssDescriptor;
+}tCsrScanResultInfo;
+
+typedef struct tagCsrEncryptionList
+{
+
+    tANI_U32 numEntries;
+    eCsrEncryptionType encryptionType[eCSR_NUM_OF_ENCRYPT_TYPE];
+
+}tCsrEncryptionList, *tpCsrEncryptionList;
+
+typedef struct tagCsrAuthList
+{
+    tANI_U32 numEntries;
+    eCsrAuthType authType[eCSR_NUM_OF_SUPPORT_AUTH_TYPE];
+}tCsrAuthList, *tpCsrAuthList;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+typedef struct tagCsrMobilityDomainInfo
+{
+    tANI_U8 mdiePresent;
+    tANI_U16 mobilityDomain;
+} tCsrMobilityDomainInfo;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+typedef struct tagCsrCcxCckmInfo
+{
+    tANI_U32       reassoc_req_num;
+    tANI_BOOLEAN   krk_plumbed;
+    tANI_U8        krk[CSR_KRK_KEY_LEN];
+} tCsrCcxCckmInfo;
+#endif
+
+
+typedef struct tagCsrScanResultFilter
+{
+    tCsrBSSIDs BSSIDs;    //each bssid has a length of WNI_CFG_BSSID_LEN (6)
+    tCsrSSIDs SSIDs;   
+    tCsrChannelInfo ChannelInfo;
+    tCsrAuthList authType;
+    tCsrEncryptionList EncryptionType;
+    //eCSR_ENCRYPT_TYPE_ANY cannot be set in multicast encryption type. If caller doesn't case, 
+    //put all supported encryption types in here
+    tCsrEncryptionList mcEncryptionType;
+    eCsrRoamBssType BSSType;   
+    //this is a bit mask of all the needed phy mode defined in eCsrPhyMode
+    tANI_U32 phyMode;   
+    //If countryCode[0] is not 0, countryCode is checked independent of fCheckUnknownCountryCode
+    tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN]; 
+    tANI_U8 uapsd_mask; 
+    /*For WPS filtering if true => auth and ecryption should be ignored*/
+    tANI_BOOLEAN bWPSAssociation;
+#if defined WLAN_FEATURE_VOWIFI
+    /*For measurement reports --> if set, only SSID, BSSID and channel is considered for filtering.*/
+    tANI_BOOLEAN fMeasurement;
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tCsrMobilityDomainInfo MDID;
+#endif
+    tANI_BOOLEAN p2pResult;
+}tCsrScanResultFilter;
+
+
+typedef struct sCsrChnPower_
+{
+  tANI_U8 firstChannel;
+  tANI_U8 numChannels;
+  tANI_U8 maxtxPower;
+}sCsrChnPower;
+
+
+typedef struct sCsrChannel_
+{
+    tANI_U8 numChannels;
+    tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+}sCsrChannel;
+
+
+typedef struct tagCsr11dinfo
+{
+  sCsrChannel     Channels;
+  tANI_U8         countryCode[WNI_CFG_COUNTRY_CODE_LEN+1];
+  //max power channel list
+  sCsrChnPower    ChnPower[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+}tCsr11dinfo;
+
+
+typedef enum
+{
+    eCSR_ROAM_CANCELLED = 1,
+    //this mean error happens before association_start or roaming_start is called.
+    eCSR_ROAM_FAILED,   
+    //a CSR trigger roaming operation starts, callback may get a pointer to tCsrConnectedProfile
+    eCSR_ROAM_ROAMING_START,    
+    //a CSR trigger roaming operation is completed
+    eCSR_ROAM_ROAMING_COMPLETION,   
+    //Connection completed status.
+    eCSR_ROAM_CONNECT_COMPLETION, 
+    //an association or start_IBSS operation starts, 
+    //callback may get a pointer to tCsrRoamProfile and a pointer to tSirBssDescription 
+    eCSR_ROAM_ASSOCIATION_START,    
+    //a roaming operation is finish, see eCsrRoamResult for 
+    //possible data passed back
+    eCSR_ROAM_ASSOCIATION_COMPLETION,   
+    eCSR_ROAM_DISASSOCIATED,
+    eCSR_ROAM_ASSOCIATION_FAILURE,
+    //when callback with this flag. callback gets a pointer to the BSS desc.
+    eCSR_ROAM_SHOULD_ROAM,  
+    //A new candidate for PMKID is found
+    eCSR_ROAM_SCAN_FOUND_NEW_BSS,
+    //CSR is done lostlink roaming and still cannot reconnect
+    eCSR_ROAM_LOSTLINK,
+    //a link lost is detected. CSR starts roaming.
+    eCSR_ROAM_LOSTLINK_DETECTED,   
+    //TKIP MIC error detected, callback gets a pointer to tpSirSmeMicFailureInd
+    eCSR_ROAM_MIC_ERROR_IND,
+    eCSR_ROAM_IBSS_IND, //IBSS indications.
+    //Update the connection status, useful for IBSS: new peer added, network is active etc. 
+    eCSR_ROAM_CONNECT_STATUS_UPDATE,  
+    eCSR_ROAM_GEN_INFO,
+    eCSR_ROAM_SET_KEY_COMPLETE,
+    eCSR_ROAM_REMOVE_KEY_COMPLETE,
+    eCSR_ROAM_IBSS_LEAVE, //IBSS indications.
+    //BSS in WDS mode status indication
+    eCSR_ROAM_WDS_IND,
+#ifdef WLAN_SOFTAP_FEATURE
+    //BSS in SoftAP mode status indication
+    eCSR_ROAM_INFRA_IND,
+    eCSR_ROAM_WPS_PBC_PROBE_REQ_IND,
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    eCSR_ROAM_FT_RESPONSE,
+#endif
+    eCSR_ROAM_FT_START,
+    eCSR_ROAM_INDICATE_MGMT_FRAME,
+    eCSR_ROAM_REMAIN_CHAN_READY,
+    eCSR_ROAM_SEND_ACTION_CNF,
+    //this mean error happens before association_start or roaming_start is called.
+    eCSR_ROAM_SESSION_OPENED,
+    eCSR_ROAM_FT_REASSOC_FAILED,
+}eRoamCmdStatus;
+
+
+//comment inside indicates what roaming callback gets
+typedef enum
+{
+    eCSR_ROAM_RESULT_NONE,
+    //this means no more action in CSR
+    //If roamStatus is eCSR_ROAM_ASSOCIATION_COMPLETION, tCsrRoamInfo's pBssDesc may pass back
+    eCSR_ROAM_RESULT_FAILURE,   
+    //Pass back pointer to tCsrRoamInfo
+    eCSR_ROAM_RESULT_ASSOCIATED,    
+    eCSR_ROAM_RESULT_NOT_ASSOCIATED,
+    eCSR_ROAM_RESULT_MIC_FAILURE,
+    eCSR_ROAM_RESULT_FORCED,
+    eCSR_ROAM_RESULT_DISASSOC_IND,
+    eCSR_ROAM_RESULT_DEAUTH_IND,
+    eCSR_ROAM_RESULT_CAP_CHANGED,
+    //This means we starts an IBSS
+    //tCsrRoamInfo's pBssDesc may pass back
+    eCSR_ROAM_RESULT_IBSS_STARTED,  
+    //START_BSS failed
+    //tCsrRoamInfo's pBssDesc may pass back
+    eCSR_ROAM_RESULT_IBSS_START_FAILED, 
+    eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS,
+    eCSR_ROAM_RESULT_IBSS_JOIN_FAILED, 
+    eCSR_ROAM_RESULT_IBSS_CONNECT,
+    eCSR_ROAM_RESULT_IBSS_INACTIVE,
+    //If roamStatus is eCSR_ROAM_ASSOCIATION_COMPLETION
+    //tCsrRoamInfo's pBssDesc may pass back. and the peer's MAC address in peerMacOrBssid 
+    //If roamStatus is eCSR_ROAM_IBSS_IND,  
+    //the peer's MAC address in peerMacOrBssid and a beacon frame of the IBSS in pbFrames
+    eCSR_ROAM_RESULT_IBSS_NEW_PEER, 
+    //Peer departed from IBSS, Callback may get a pointer tSmeIbssPeerInd in pIbssPeerInd
+    eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED, 
+    //Coalescing in the IBSS network (joined an IBSS network)
+    //Callback pass a BSSID in peerMacOrBssid
+    eCSR_ROAM_RESULT_IBSS_COALESCED,    
+    //If roamStatus is eCSR_ROAM_ROAMING_START, callback may get a pointer to tCsrConnectedProfile used to connect.
+    eCSR_ROAM_RESULT_IBSS_STOP,  
+    eCSR_ROAM_RESULT_LOSTLINK, 
+    eCSR_ROAM_RESULT_MIC_ERROR_UNICAST,
+    eCSR_ROAM_RESULT_MIC_ERROR_GROUP,
+    eCSR_ROAM_RESULT_AUTHENTICATED,
+    eCSR_ROAM_RESULT_NEW_RSN_BSS,
+#ifdef FEATURE_WLAN_WAPI
+    eCSR_ROAM_RESULT_NEW_WAPI_BSS,
+#endif /* FEATURE_WLAN_WAPI */
+    // WDS started successfully
+    eCSR_ROAM_RESULT_WDS_STARTED,
+    // WDS start failed
+    eCSR_ROAM_RESULT_WDS_START_FAILED,
+    // WDS stopped
+    eCSR_ROAM_RESULT_WDS_STOPPED,
+    // WDS joined successfully in STA mode
+    eCSR_ROAM_RESULT_WDS_ASSOCIATED,
+    // A station joined WDS AP 
+    eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND,
+    // WDS join failed in STA mode
+    eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED,
+    // WDS disassociated
+    eCSR_ROAM_RESULT_WDS_DISASSOCIATED,
+#ifdef WLAN_SOFTAP_FEATURE
+    // INFRA started successfully
+    eCSR_ROAM_RESULT_INFRA_STARTED,
+    // INFRA start failed
+    eCSR_ROAM_RESULT_INFRA_START_FAILED,
+    // INFRA stopped
+    eCSR_ROAM_RESULT_INFRA_STOPPED,
+    // A station joining INFRA AP
+    eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND,
+    // A station joined INFRA AP
+    eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF,
+    // INFRA disassociated
+    eCSR_ROAM_RESULT_INFRA_DISASSOCIATED,
+    eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND,
+#endif
+#ifdef WLAN_FEATURE_P2P
+    eCSR_ROAM_RESULT_SEND_ACTION_FAIL,
+#endif
+    // peer rejected assoc because max assoc limit reached. callback gets pointer to peer
+    eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED,
+}eCsrRoamResult;
+
+
+
+/*----------------------------------------------------------------------------
+  List of link quality indications HDD can receive from SME
+-----------------------------------------------------------------------------*/
+typedef enum
+{
+ eCSR_ROAM_LINK_QUAL_MIN_IND     = -1,
+
+ eCSR_ROAM_LINK_QUAL_POOR_IND            =  0,   /* bad link                */
+ eCSR_ROAM_LINK_QUAL_GOOD_IND            =  1,   /* acceptable for voice    */
+ eCSR_ROAM_LINK_QUAL_VERY_GOOD_IND       =  2,   /* suitable for voice      */
+ eCSR_ROAM_LINK_QUAL_EXCELLENT_IND       =  3,   /* suitable for voice      */
+
+ eCSR_ROAM_LINK_QUAL_MAX_IND  /* invalid value */
+
+} eCsrRoamLinkQualityInd;
+
+typedef enum
+{
+    eCSR_DISCONNECT_REASON_UNSPECIFIED = 0,
+    eCSR_DISCONNECT_REASON_MIC_ERROR,
+    eCSR_DISCONNECT_REASON_DISASSOC,
+    eCSR_DISCONNECT_REASON_DEAUTH,
+    eCSR_DISCONNECT_REASON_HANDOFF,
+    eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE,
+    eCSR_DISCONNECT_REASON_IBSS_LEAVE,
+}eCsrRoamDisconnectReason;
+
+typedef enum 
+{
+    // Not associated in Infra or participating in an IBSS / Ad-hoc network.
+    eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED,
+    // Associated in an Infrastructure network.
+    eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED,
+    // Participating in an IBSS network though disconnected (no partner stations
+    // in the IBSS).
+    eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED,
+    // Participating in an IBSS network with partner stations also present
+    eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED,
+    // Participating in a WDS network in AP or STA mode but not connected yet
+    eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED,
+    // Participating in a WDS network and connected peer to peer
+    eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED,
+#ifdef WLAN_SOFTAP_FEATURE
+    // Participating in a Infra network in AP not yet in connected state
+    eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED,
+    // Participating in a Infra network and connected to a peer
+    eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED,
+#endif
+
+}eCsrConnectState;
+
+
+// This parameter is no longer supported in the Profile.  Need to set this in the global properties
+// for the adapter.
+typedef enum eCSR_MEDIUM_ACCESS 
+{
+    eCSR_MEDIUM_ACCESS_AUTO = 0,
+    eCSR_MEDIUM_ACCESS_DCF,
+    eCSR_MEDIUM_ACCESS_eDCF,
+    eCSR_MEDIUM_ACCESS_HCF,
+
+    eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p,
+    eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP,
+    eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify,
+    eCSR_MEDIUM_ACCESS_11e_eDCF = eCSR_MEDIUM_ACCESS_eDCF,
+    eCSR_MEDIUM_ACCESS_11e_HCF  = eCSR_MEDIUM_ACCESS_HCF,
+}eCsrMediaAccessType;
+
+typedef enum 
+{
+    eCSR_TX_RATE_AUTO = 0,   // use rate adaption to determine Tx rate.
+
+    eCSR_TX_RATE_1Mbps   = 0x00000001,
+    eCSR_TX_RATE_2Mbps   = 0x00000002,
+    eCSR_TX_RATE_5_5Mbps = 0x00000004,
+    eCSR_TX_RATE_6Mbps   = 0x00000008,
+    eCSR_TX_RATE_9Mbps   = 0x00000010,
+    eCSR_TX_RATE_11Mbps  = 0x00000020,
+    eCSR_TX_RATE_12Mbps  = 0x00000040,
+    eCSR_TX_RATE_18Mbps  = 0x00000080,
+    eCSR_TX_RATE_24Mbps  = 0x00000100,
+    eCSR_TX_RATE_36Mbps  = 0x00000200,
+    eCSR_TX_RATE_42Mbps  = 0x00000400,
+    eCSR_TX_RATE_48Mbps  = 0x00000800,
+    eCSR_TX_RATE_54Mbps  = 0x00001000,
+    eCSR_TX_RATE_72Mbps  = 0x00002000,
+    eCSR_TX_RATE_84Mbps  = 0x00004000,
+    eCSR_TX_RATE_96Mbps  = 0x00008000,
+    eCSR_TX_RATE_108Mbps = 0x00010000,
+    eCSR_TX_RATE_126Mbps = 0x00020000,
+    eCSR_TX_RATE_144Mbps = 0x00040000,
+    eCSR_TX_RATE_168Mbps = 0x00080000,
+    eCSR_TX_RATE_192Mbps = 0x00100000,
+    eCSR_TX_RATE_216Mbps = 0x00200000,
+    eCSR_TX_RATE_240Mbps = 0x00400000,
+
+}eCsrExposedTxRate;
+
+typedef enum 
+{
+    eCSR_OPERATING_CHANNEL_ALL  = 0,
+    eCSR_OPERATING_CHANNEL_AUTO = eCSR_OPERATING_CHANNEL_ALL,
+    eCSR_OPERATING_CHANNEL_ANY  = eCSR_OPERATING_CHANNEL_ALL,
+}eOperationChannel;
+
+typedef enum 
+{
+    eCSR_DOT11_FRAG_THRESH_AUTO            = -1,
+    eCSR_DOT11_FRAG_THRESH_MIN             = 256,
+    eCSR_DOT11_FRAG_THRESH_MAX             = 2346,
+    eCSR_DOT11_FRAG_THRESH_DEFAULT         = 2000
+}eCsrDot11FragThresh;
+
+
+//for channel bonding for ibss
+typedef enum 
+{
+    eCSR_CB_OFF = 0,
+    eCSR_CB_AUTO = 1,
+    eCSR_CB_DOWN = 2,
+    eCSR_CB_UP = 3,
+}eCsrCBChoice;
+
+//For channel bonding, the channel number gap is 4, either up or down. For both 11a and 11g mode.
+#define CSR_CB_CHANNEL_GAP 4
+#define CSR_CB_CENTER_CHANNEL_OFFSET    2
+#define CSR_MAX_24GHz_CHANNEL_NUMBER ( SIR_11B_CHANNEL_END )
+
+// WEP keysize (in bits)...
+typedef enum  
+{
+    eCSR_SECURITY_WEP_KEYSIZE_40  =  40,   // 40 bit key + 24bit IV = 64bit WEP
+    eCSR_SECURITY_WEP_KEYSIZE_104 = 104,   // 104bit key + 24bit IV = 128bit WEP
+
+    eCSR_SECURITY_WEP_KEYSIZE_MIN = eCSR_SECURITY_WEP_KEYSIZE_40,
+    eCSR_SECURITY_WEP_KEYSIZE_MAX = eCSR_SECURITY_WEP_KEYSIZE_104,
+    eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES = ( eCSR_SECURITY_WEP_KEYSIZE_MAX / 8 ),
+}eCsrWEPKeySize;
+
+
+// Possible values for the WEP static key ID...
+typedef enum
+{
+
+    eCSR_SECURITY_WEP_STATIC_KEY_ID_MIN       =  0,
+    eCSR_SECURITY_WEP_STATIC_KEY_ID_MAX       =  3,
+    eCSR_SECURITY_WEP_STATIC_KEY_ID_DEFAULT   =  0,
+
+    eCSR_SECURITY_WEP_STATIC_KEY_ID_INVALID   = -1,
+
+}eCsrWEPStaticKeyID;
+
+#define CSR_MAX_NUM_KEY     (eCSR_SECURITY_WEP_STATIC_KEY_ID_MAX + 1)
+
+typedef enum 
+{
+    eCSR_SECURITY_SET_KEY_ACTION_NO_CHANGE,
+    eCSR_SECURITY_SET_KEY_ACTION_SET_KEY,
+    eCSR_SECURITY_SET_KEY_ACTION_DELETE_KEY,
+}eCsrSetKeyAction;
+
+typedef enum
+{
+    eCSR_BAND_ALL,
+    eCSR_BAND_24,
+    eCSR_BAND_5G,
+    eCSR_BAND_MAX,
+}eCsrBand;
+
+
+typedef enum 
+{
+   // Roaming because HDD requested for reassoc by changing one of the fields in 
+   // tCsrRoamModifyProfileFields. OR
+   // Roaming because SME requested for reassoc by changing one of the fields in 
+   // tCsrRoamModifyProfileFields.
+   eCsrRoamReasonStaCapabilityChanged,
+   // Roaming because SME requested for reassoc to a different AP, as part of 
+   // inter AP handoff.
+   eCsrRoamReasonBetterAP,
+   // Roaming because SME requested it as the link is lost - placeholder, will 
+   // clean it up once handoff code gets in
+   eCsrRoamReasonSmeIssuedForLostLink,
+
+}eCsrRoamReasonCodes;
+
+typedef enum
+{
+   eCsrRoamWmmAuto = 0,
+   eCsrRoamWmmQbssOnly = 1,
+   eCsrRoamWmmNoQos = 2,
+
+} eCsrRoamWmmUserModeType;
+
+typedef enum
+{
+   eCSR_REQUESTER_MIN = 0,
+   eCSR_DIAG,
+   eCSR_UMA_GAN,
+   eCSR_HDD
+} eCsrStatsRequesterType;
+
+typedef struct tagPmkidCandidateInfo
+{
+    tCsrBssid BSSID;
+    tANI_BOOLEAN preAuthSupported;
+}tPmkidCandidateInfo;
+
+typedef struct tagPmkidCacheInfo
+{
+    tCsrBssid BSSID;
+    tANI_U8 PMKID[CSR_RSN_PMKID_SIZE];
+}tPmkidCacheInfo;
+
+#ifdef FEATURE_WLAN_WAPI
+typedef struct tagBkidCandidateInfo
+{
+    tCsrBssid BSSID;
+    tANI_BOOLEAN preAuthSupported;
+}tBkidCandidateInfo;
+
+typedef struct tagBkidCacheInfo
+{
+    tCsrBssid BSSID;
+    tANI_U8 BKID[CSR_WAPI_BKID_SIZE];
+}tBkidCacheInfo;
+#endif /* FEATURE_WLAN_WAPI */
+
+typedef struct tagCsrKeys
+{
+    tANI_U8 KeyLength[ CSR_MAX_NUM_KEY ];   //Also use to indicate whether the key index is set
+    tANI_U8 KeyMaterial[ CSR_MAX_NUM_KEY ][ CSR_MAX_KEY_LEN ];
+    tANI_U8 defaultIndex;
+}tCsrKeys;
+
+/* Following are fields which are part of tCsrRoamConnectedProfile might need 
+   modification dynamically once STA is up & running and this could trigger
+   reassoc */
+typedef struct tagCsrRoamModifyProfileFields
+{
+   // during connect this specifies ACs U-APSD is to be setup 
+   //   for (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored).
+   //  During assoc response this COULD carry confirmation of what ACs U-APSD 
+   // got setup for. Later if an APP looking for APSD, SME-QoS might need to
+   // modify this field
+   tANI_U8     uapsd_mask;
+   // HDD might ask to modify this field
+   tANI_U16    listen_interval;
+}tCsrRoamModifyProfileFields;
+
+typedef struct tagCsrRoamProfile
+{
+    //For eCSR_BSS_TYPE_WDS_AP. There must be one SSID in SSIDs.
+    //For eCSR_BSS_TYPE_WDS_STA. There must be two SSIDs. Index 0 is the SSID of the WDS-AP
+    //that we need to join. Index 1 is the SSID for self BSS.
+    tCsrSSIDs SSIDs;
+    tCsrBSSIDs BSSIDs;
+    tANI_U32 phyMode;   //this is a bit mask of all the needed phy mode defined in eCsrPhyMode
+    eCsrRoamBssType BSSType;
+
+    tCsrAuthList AuthType;
+    eCsrAuthType negotiatedAuthType;
+
+    tCsrEncryptionList EncryptionType;
+    //This field is for output only, not for input
+    eCsrEncryptionType negotiatedUCEncryptionType;
+
+    //eCSR_ENCRYPT_TYPE_ANY cannot be set in multicast encryption type. If caller doesn't case, 
+    //put all supported encryption types in here
+    tCsrEncryptionList mcEncryptionType;
+    //This field is for output only, not for input
+    eCsrEncryptionType negotiatedMCEncryptionType;  
+
+    tCsrKeys Keys;
+    eCsrCBChoice CBMode; //up, down or auto
+    tCsrChannelInfo ChannelInfo;
+    tANI_U8 operationChannel;   
+    tANI_U16 beaconInterval;    //If this is 0, SME will fill in for caller.
+    // during connect this specifies ACs U-APSD is to be setup 
+    //   for (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored).
+    //  During assoc response this COULD carry confirmation of what ACs U-APSD got setup for
+    tANI_U8 uapsd_mask; 
+    tANI_U32 nWPAReqIELength;   //The byte count in the pWPAReqIE
+    tANI_U8 *pWPAReqIE;   //If not null, it has the IE byte stream for WPA
+    tANI_U32 nRSNReqIELength;  //The byte count in the pRSNReqIE
+    tANI_U8 *pRSNReqIE;     //If not null, it has the IE byte stream for RSN
+#ifdef FEATURE_WLAN_WAPI
+    tANI_U32 nWAPIReqIELength;   //The byte count in the pWAPIReqIE
+    tANI_U8 *pWAPIReqIE;   //If not null, it has the IE byte stream for WAPI
+#endif /* FEATURE_WLAN_WAPI */
+
+    tANI_U32 nAddIEScanLength;   //The byte count in the pAddIE for scan (at the time of join)
+    tANI_U8 *pAddIEScan;       //If not null, it has the IE byte stream for additional IE, which can be WSC IE and/or P2P IE
+    tANI_U32 nAddIEAssocLength;   //The byte count in the pAddIE for assoc 
+    tANI_U8 *pAddIEAssoc;       //If not null, it has the IE byte stream for additional IE, which can be WSC IE and/or P2P IE
+
+    tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN];  //it is ignored if [0] is 0.
+    /*WPS Association if true => auth and ecryption should be ignored*/
+    tANI_BOOLEAN bWPSAssociation;
+    tANI_U32 nWSCReqIELength;   //The byte count in the pWSCReqIE
+    tANI_U8 *pWSCReqIE;   //If not null, it has the IE byte stream for WSC
+
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U8 ieee80211d;
+    tANI_U8 privacy;
+    tANI_BOOLEAN fwdWPSPBCProbeReq;
+    tAniAuthType csr80211AuthType;
+    tANI_U32 dtimPeriod;
+    tANI_BOOLEAN ApUapsdEnable;
+    tANI_BOOLEAN protEnabled;
+    tANI_BOOLEAN obssProtEnabled;
+    tANI_U16 cfg_protection;
+    tANI_U8 wps_state;
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tCsrMobilityDomainInfo MDID;
+#endif
+    tVOS_CON_MODE csrPersona;
+
+}tCsrRoamProfile;
+
+
+typedef struct tagCsrRoamConnectedProfile
+{
+    tSirMacSSid SSID;
+    tANI_BOOLEAN    handoffPermitted;
+    tANI_BOOLEAN    ssidHidden;
+    tCsrBssid bssid;
+    eCsrRoamBssType BSSType;
+    eCsrAuthType AuthType;
+    tCsrAuthList AuthInfo;
+    eCsrEncryptionType EncryptionType;
+    tCsrEncryptionList EncryptionInfo;
+    eCsrEncryptionType mcEncryptionType;
+    tCsrEncryptionList mcEncryptionInfo;
+    eCsrCBChoice CBMode; //up, down or auto
+    tANI_U8 operationChannel;
+    tCsrKeys Keys;
+    // meaningless on connect. It's an OUT param from CSR's point of view
+    // During assoc response carries the ACM bit-mask i.e. what
+    // ACs have ACM=1 (if any), 
+    // (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored)
+    tANI_U8  acm_mask;
+    tCsrRoamModifyProfileFields modifyProfileFields;
+    tSirBssDescription *pBssDesc;   
+    tANI_BOOLEAN   qap; //AP supports QoS
+    tANI_BOOLEAN   qosConnection; //A connection is QoS enabled
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tCsrMobilityDomainInfo MDID;
+#endif
+    
+#ifdef FEATURE_WLAN_CCX
+    tCsrCcxCckmInfo ccxCckmInfo;
+    tANI_BOOLEAN    isCCXAssoc; 
+#endif
+}tCsrRoamConnectedProfile;
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+typedef struct tagCsr11rConfigParams
+{
+    tANI_BOOLEAN   IsFTResourceReqSupported;
+} tCsr11rConfigParams;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+typedef struct tagCsrNeighborRoamConfigParams
+{
+
+    tANI_U32       nNeighborScanTimerPeriod;
+    tANI_U8        nNeighborLookupRssiThreshold;
+    tANI_U8        nNeighborReassocRssiThreshold;
+    tANI_U16       nNeighborScanMinChanTime;
+    tANI_U16       nNeighborScanMaxChanTime;
+    sCsrChannel    neighborScanChanList;
+    tANI_U8        nMaxNeighborRetries;
+    tANI_U16       nNeighborResultsRefreshPeriod;
+}tCsrNeighborRoamConfigParams;
+#endif
+
+typedef struct tagCsrConfigParam
+{
+    tANI_U32 FragmentationThreshold;
+    tANI_U32 channelBondingMode24GHz;
+    tANI_U32 channelBondingMode5GHz;
+    eCsrPhyMode phyMode;
+    eCsrBand eBand;
+    tANI_U32 RTSThreshold;
+    tANI_U32 HeartbeatThresh50;
+    tANI_U32 HeartbeatThresh24;
+    eCsrCBChoice cbChoice;
+    eCsrBand bandCapability;     //indicate hw capability
+    tANI_U32 bgScanInterval;
+    tANI_U16 TxRate;
+    eCsrRoamWmmUserModeType WMMSupportMode;
+    tANI_BOOLEAN Is11eSupportEnabled;
+    tANI_BOOLEAN Is11dSupportEnabled;
+    tANI_BOOLEAN Is11dSupportEnabledOriginal;
+    tANI_BOOLEAN Is11hSupportEnabled;
+    tANI_BOOLEAN shortSlotTime;
+    tANI_BOOLEAN ProprietaryRatesEnabled;
+    tANI_U8 AdHocChannel24;
+    tANI_U8 AdHocChannel5G;
+    tANI_U32 impsSleepTime;     //in units of seconds
+    tANI_U32 nScanResultAgeCount;   //this number minus one is the number of times a scan doesn't find it before it is removed
+    tANI_U32 scanAgeTimeNCNPS;  //scan result aging time threshold when Not-Connect-No-Power-Save, in seconds
+    tANI_U32 scanAgeTimeNCPS;   //scan result aging time threshold when Not-Connect-Power-Save, in seconds
+    tANI_U32 scanAgeTimeCNPS;   //scan result aging time threshold when Connect-No-Power-Save, in seconds,
+    tANI_U32 scanAgeTimeCPS;   //scan result aging time threshold when Connect-Power-Savein seconds
+    tANI_U32 nRoamingTime;  //In seconds, CSR will try this long before gives up. 0 means no roaming
+    tANI_U8 bCatRssiOffset;     //to set the RSSI difference for each category
+    tANI_U8 fEnableMCCMode; //to set MCC Enable/Disable mode
+
+    tCsr11dinfo  Csr11dinfo;
+    //Whether to limit the channels to the ones set in Csr11dInfo. If true, the opertaional
+    //channels are limited to the default channel list. It is an "AND" operation between the 
+    //default channels and the channels in the 802.11d IE.
+    tANI_BOOLEAN fEnforce11dChannels;  
+    //Country Code Priority
+    //0 = 802.11D > Country IOCTL > NV 
+    //1 = Country IOCTL > 802.11D > NV
+    tANI_BOOLEAN fSupplicantCountryCodeHasPriority;
+    //When true, AP with unknown country code won't be see. 
+    //"Unknown country code" means either Ap doesn't have 11d IE or we cannot 
+    //find a domain for the country code in its 11d IE. 
+    tANI_BOOLEAN fEnforceCountryCodeMatch;  
+    //When true, only APs in the default domain can be seen. If the Ap has "unknown country
+    //code", or the domain of the country code doesn't match the default domain, the Ap is
+    //not acceptable.
+    tANI_BOOLEAN fEnforceDefaultDomain;     
+
+    tANI_U16 vccRssiThreshold;
+    tANI_U32 vccUlMacLossThreshold;
+
+    tANI_U32  nPassiveMinChnTime;    //in units of milliseconds
+    tANI_U32  nPassiveMaxChnTime;    //in units of milliseconds
+    tANI_U32  nActiveMinChnTime;     //in units of milliseconds
+    tANI_U32  nActiveMaxChnTime;     //in units of milliseconds
+
+    tANI_BOOLEAN IsIdleScanEnabled;
+    //in dBm, the maximum TX power
+    //The actual TX power is the lesser of this value and 11d. 
+    //If 11d is disable, the lesser of this and default setting.
+    tANI_U8 nTxPowerCap;     
+    tANI_U32  statsReqPeriodicity;  //stats request frequency from PE while in full power
+    tANI_U32  statsReqPeriodicityInPS;//stats request frequency from PE while in power save
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tCsr11rConfigParams  csr11rConfig;
+#endif
+#ifdef FEATURE_WLAN_CCX
+    tANI_U8   isCcxIniFeatureEnabled;
+#endif
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    tANI_U8   isFastTransitionEnabled;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    tCsrNeighborRoamConfigParams    neighborRoamConfig;
+#endif
+
+    /* Instead of Reassoc, send ADDTS/DELTS even when ACM is off for that AC 
+     * This is mandated by WMM-AC certification */
+    tANI_BOOLEAN addTSWhenACMIsOff;
+
+    
+    /*channelPowerInfoList24 has been seen corrupted. Set this flag to true trying to 
+    * detect when it happens. Adding this into code because we can't reproduce it easily.
+    * We don't know when it happens. */
+    tANI_BOOLEAN fValidateList;
+
+    /*Customer wants to start with an active scan based on the default country code.
+    * This optimization will minimize the driver load to association time.
+    * Based on this flag we will bypass the initial passive scan needed for 11d
+    * to determine the country code & domain */
+    tANI_BOOLEAN fEnableBypass11d;
+
+    /*Customer wants to optimize the scan time. Avoiding scans(passive) on DFS 
+    * channels while swipping through both bands can save some time 
+    * (apprx 1.3 sec) */
+    tANI_BOOLEAN fEnableDFSChnlScan;
+
+    //To enable/disable scanning 2.4Ghz channels twice on a single scan request from HDD
+    tANI_BOOLEAN fScanTwice;
+
+}tCsrConfigParam;   
+
+//Tush
+typedef struct tagCsrUpdateConfigParam
+{
+   tCsr11dinfo  Csr11dinfo;
+}tCsrUpdateConfigParam;
+
+typedef struct tagCsrRoamInfo
+{
+    tCsrRoamProfile *pProfile;  //may be NULL
+    tSirBssDescription *pBssDesc;  //May be NULL
+    tANI_U32 nBeaconLength; //the length, in bytes, of the beacon frame, can be 0
+    tANI_U32 nAssocReqLength;   //the length, in bytes, of the assoc req frame, can be 0
+    tANI_U32 nAssocRspLength;   //The length, in bytes, of the assoc rsp frame, can be 0
+    tANI_U32 nFrameLength;
+    tANI_U8  frameType;
+    tANI_U8 *pbFrames;  //Point to a buffer contain the beacon, assoc req, assoc rsp frame, in that order
+                        //user needs to use nBeaconLength, nAssocReqLength, nAssocRspLength to desice where
+                        //each frame starts and ends.
+    tANI_BOOLEAN fReassocReq;   //set to true if for re-association
+    tANI_BOOLEAN fReassocRsp;   //set to true if for re-association
+    tCsrBssid bssid;
+    //Only valid in IBSS 
+    //this is the peers MAC address for eCSR_ROAM_RESULT_IBSS_NEW_PEER or PEER_DEPARTED
+    tCsrBssid peerMac;  
+    tSirResultCodes statusCode;
+    tANI_U32 reasonCode;    //this could be our own defined or sent from the other BSS(per 802.11 spec)
+    tANI_U8  staId;         // Peer stationId when connected
+    /*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_BOOLEAN fAuthRequired;   //FALSE means auth needed from supplicant. TRUE means authenticated(static WEP, open)
+    tANI_U8 sessionId;
+    tANI_U8 rsnIELen;
+    tANI_U8 *prsnIE;
+
+    tANI_U8 addIELen;
+    tANI_U8 *paddIE;
+    
+    union
+    {
+        tSirMicFailureInfo *pMICFailureInfo;
+        tCsrRoamConnectedProfile *pConnectedProfile;
+#ifdef WLAN_SOFTAP_FEATURE
+        tSirWPSPBCProbeReq *pWPSPBCProbeReq;
+#endif
+    } u;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_BOOLEAN wmmEnabledSta;   //set to true if WMM enabled STA
+    tANI_U32 dtimPeriod;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+    tANI_BOOLEAN isCCXAssoc;
+#endif
+#ifdef WLAN_FEATURE_P2P
+    void* pRemainCtx; 
+    tANI_U32 rxChan;
+#endif
+
+    // Required for indicating the frames to upper layer
+    tANI_U32 beaconLength;
+    tANI_U8* beaconPtr;
+    tANI_U32 assocReqLength;
+    tANI_U8* assocReqPtr;    
+}tCsrRoamInfo;
+
+
+
+
+
+typedef struct tagCsrFreqScanInfo
+{
+    tANI_U32 nStartFreq;    //in unit of MHz
+    tANI_U32 nEndFreq;      //in unit of MHz
+    tSirScanType scanType;
+}tCsrFreqScanInfo;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+typedef struct sSirSmeAssocIndToUpperLayerCnf
+{
+    tANI_U16             messageType; // eWNI_SME_ASSOC_CNF
+    tANI_U16             length;
+    tANI_U8              sessionId;
+    tSirResultCodes      statusCode;
+    tSirMacAddr          bssId;      // Self BSSID
+    tSirMacAddr          peerMacAddr;
+    tANI_U16             aid;
+    tSirMacAddr          alternateBssId;
+    tANI_U8              alternateChannelId;
+    tANI_U8              wmmEnabledSta;   //set to true if WMM enabled STA
+    tSirRSNie            rsnIE;           // RSN IE received from peer
+    tSirAddie            addIE;           // Additional IE received from peer, which can be WSC and/or P2P IE
+    tANI_U8              reassocReq;      //set to true if reassoc
+} tSirSmeAssocIndToUpperLayerCnf, *tpSirSmeAssocIndToUpperLayerCnf;
+#endif
+
+typedef struct tagCsrSummaryStatsInfo
+{
+   tANI_U32 retry_cnt[4];
+   tANI_U32 multiple_retry_cnt[4];
+   tANI_U32 tx_frm_cnt[4];
+   //tANI_U32 num_rx_frm_crc_err; same as rx_error_cnt
+   //tANI_U32 num_rx_frm_crc_ok; same as rx_frm_cnt
+   tANI_U32 rx_frm_cnt;
+   tANI_U32 frm_dup_cnt;
+   tANI_U32 fail_cnt[4];
+   tANI_U32 rts_fail_cnt;
+   tANI_U32 ack_fail_cnt;
+   tANI_U32 rts_succ_cnt;
+   tANI_U32 rx_discard_cnt;
+   tANI_U32 rx_error_cnt;
+   tANI_U32 tx_byte_cnt;
+
+}tCsrSummaryStatsInfo;
+
+typedef struct tagCsrGlobalClassAStatsInfo
+{
+   tANI_U32 rx_frag_cnt;
+   tANI_U32 promiscuous_rx_frag_cnt;
+   //tANI_U32 rx_fcs_err;
+   tANI_U32 rx_input_sensitivity;
+   tANI_U32 max_pwr;
+   //tANI_U32 default_pwr;
+   tANI_U32 sync_fail_cnt;
+   tANI_U32 tx_rate;
+   //mcs index for HT20 and HT40 rates
+   tANI_U32  mcs_index;
+   //to defferentiate between HT20 and HT40 rates;short and long guard interval
+   tANI_U32  tx_rate_flags;
+
+}tCsrGlobalClassAStatsInfo;
+
+typedef struct tagCsrGlobalClassBStatsInfo
+{
+   tANI_U32 uc_rx_wep_unencrypted_frm_cnt;
+   tANI_U32 uc_rx_mic_fail_cnt;
+   tANI_U32 uc_tkip_icv_err;
+   tANI_U32 uc_aes_ccmp_format_err;
+   tANI_U32 uc_aes_ccmp_replay_cnt;
+   tANI_U32 uc_aes_ccmp_decrpt_err;
+   tANI_U32 uc_wep_undecryptable_cnt;
+   tANI_U32 uc_wep_icv_err;
+   tANI_U32 uc_rx_decrypt_succ_cnt;
+   tANI_U32 uc_rx_decrypt_fail_cnt;
+   tANI_U32 mcbc_rx_wep_unencrypted_frm_cnt;
+   tANI_U32 mcbc_rx_mic_fail_cnt;
+   tANI_U32 mcbc_tkip_icv_err;
+   tANI_U32 mcbc_aes_ccmp_format_err;
+   tANI_U32 mcbc_aes_ccmp_replay_cnt;
+   tANI_U32 mcbc_aes_ccmp_decrpt_err;
+   tANI_U32 mcbc_wep_undecryptable_cnt;
+   tANI_U32 mcbc_wep_icv_err;
+   tANI_U32 mcbc_rx_decrypt_succ_cnt;
+   tANI_U32 mcbc_rx_decrypt_fail_cnt;
+
+}tCsrGlobalClassBStatsInfo;
+
+typedef struct tagCsrGlobalClassCStatsInfo
+{
+   tANI_U32 rx_amsdu_cnt;
+   tANI_U32 rx_ampdu_cnt;
+   tANI_U32 tx_20_frm_cnt;
+   tANI_U32 rx_20_frm_cnt;
+   tANI_U32 rx_mpdu_in_ampdu_cnt;
+   tANI_U32 ampdu_delimiter_crc_err;
+
+}tCsrGlobalClassCStatsInfo;
+
+typedef struct tagCsrGlobalClassDStatsInfo
+{
+   tANI_U32 tx_uc_frm_cnt;
+   tANI_U32 tx_mc_frm_cnt;
+   tANI_U32 tx_bc_frm_cnt;
+   tANI_U32 rx_uc_frm_cnt;
+   tANI_U32 rx_mc_frm_cnt;
+   tANI_U32 rx_bc_frm_cnt;
+   tANI_U32 tx_uc_byte_cnt[4];
+   tANI_U32 tx_mc_byte_cnt;
+   tANI_U32 tx_bc_byte_cnt;
+   tANI_U32 rx_uc_byte_cnt[4];
+   tANI_U32 rx_mc_byte_cnt;
+   tANI_U32 rx_bc_byte_cnt;
+   tANI_U32 rx_byte_cnt;
+   tANI_U32 num_rx_bytes_crc_ok;
+   tANI_U32 rx_rate;
+
+}tCsrGlobalClassDStatsInfo;
+
+typedef struct tagCsrPerStaStatsInfo
+{
+   tANI_U32 tx_frag_cnt[4];
+   tANI_U32 tx_ampdu_cnt;
+   tANI_U32 tx_mpdu_in_ampdu_cnt;
+} tCsrPerStaStatsInfo;
+
+typedef struct tagCsrRoamSetKey
+{
+    eCsrEncryptionType encType;
+    tAniKeyDirection keyDirection;    //Tx, Rx or Tx-and-Rx
+    tCsrBssid peerMac;   //Peers MAC address. ALL 1's for group key
+    tANI_U8 paeRole;      //0 for supplicant
+    tANI_U8 keyId;  // Kye index
+    tANI_U16 keyLength;  //Number of bytes containing the key in pKey
+    tANI_U8 Key[CSR_MAX_KEY_LEN];
+    tANI_U8 keyRsc[CSR_MAX_RSC_LEN];
+} tCsrRoamSetKey;
+
+typedef struct tagCsrRoamRemoveKey
+{
+    eCsrEncryptionType encType;
+    tCsrBssid peerMac;   //Peers MAC address. ALL 1's for group key
+    tANI_U8 keyId;  //key index
+} tCsrRoamRemoveKey;
+
+
+typedef void * tScanResultHandle;
+
+#define CSR_INVALID_SCANRESULT_HANDLE       (NULL)
+
+
+
+////////////////////////////////////////////Common SCAN starts
+
+//void *p2 -- the second context pass in for the caller
+//***what if callback is called before requester gets the scanId??
+typedef eHalStatus (*csrScanCompleteCallback)(tHalHandle, void *p2, tANI_U32 scanID, eCsrScanStatus status);   
+
+
+
+///////////////////////////////////////////Common Roam starts
+
+//pContext is the pContext passed in with the roam request
+//pParam is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
+//   eRoamCmdResult for detail valid members. It may be NULL
+//roamId is to identify the callback related roam request. 0 means unsolicit
+//roamStatus is a flag indicating the status of the callback
+//roamResult is the result
+typedef eHalStatus (*csrRoamCompleteCallback)(void *pContext, tCsrRoamInfo *pParam, tANI_U32 roamId, 
+                                              eRoamCmdStatus roamStatus, eCsrRoamResult roamResult);
+
+typedef eHalStatus (*csrRoamSessionCloseCallback)(void *pContext);   
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetNumPMKIDCache
+    \brief return number of PMKID cache entries
+    \return tANI_U32 - the number of PMKID cache entries
+  -------------------------------------------------------------------------------*/
+//tANI_U32 csrRoamGetNumPMKIDCache(tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetPMKIDCache
+    \brief return PMKID cache from CSR
+    \param pNum - caller allocated memory that has the space of the number of pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the 
+    needed or actually number in tPmkidCacheInfo.
+    \param pPmkidCache - Caller allocated memory that contains PMKID cache, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+//eHalStatus csrRoamGetPMKIDCache(tHalHandle hHal, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache);
+
+//pProfile - pointer to tCsrRoamProfile
+#define CSR_IS_START_IBSS(pProfile) (eCSR_BSS_TYPE_START_IBSS == (pProfile)->BSSType)
+#define CSR_IS_JOIN_TO_IBSS(pProfile) (eCSR_BSS_TYPE_IBSS == (pProfile)->BSSType)
+#define CSR_IS_IBSS(pProfile) ( CSR_IS_START_IBSS(pProfile) || CSR_IS_JOIN_TO_IBSS(pProfile) )
+#define CSR_IS_INFRASTRUCTURE(pProfile) (eCSR_BSS_TYPE_INFRASTRUCTURE == (pProfile)->BSSType)
+#define CSR_IS_ANY_BSS_TYPE(pProfile) (eCSR_BSS_TYPE_ANY == (pProfile)->BSSType)
+#define CSR_IS_WDS_AP( pProfile )  ( eCSR_BSS_TYPE_WDS_AP == (pProfile)->BSSType )
+#define CSR_IS_WDS_STA( pProfile ) ( eCSR_BSS_TYPE_WDS_STA == (pProfile)->BSSType )
+#define CSR_IS_WDS( pProfile )  ( CSR_IS_WDS_AP( pProfile ) || CSR_IS_WDS_STA( pProfile ) )
+#ifdef WLAN_SOFTAP_FEATURE
+#define CSR_IS_INFRA_AP( pProfile )  ( eCSR_BSS_TYPE_INFRA_AP == (pProfile)->BSSType )
+#endif
+
+//pProfile - pointer to tCsrRoamConnectedProfile
+#ifdef WLAN_SOFTAP_FEATURE
+#define CSR_IS_CONN_INFRA_AP( pProfile )  ( eCSR_BSS_TYPE_INFRA_AP == (pProfile)->BSSType )
+#endif
+#define CSR_IS_CONN_WDS_AP( pProfile )  ( eCSR_BSS_TYPE_WDS_AP == (pProfile)->BSSType )
+#define CSR_IS_CONN_WDS_STA( pProfile ) ( eCSR_BSS_TYPE_WDS_STA == (pProfile)->BSSType )
+#define CSR_IS_CONN_WDS( pProfile )  ( CSR_IS_WDS_AP( pProfile ) || CSR_IS_WDS_STA( pProfile ) )
+
+
+
+///////////////////////////////////////////Common Roam ends
+
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+    \fn csrSetChannels
+    \brief HDD calls this function to change some global settings. 
+    caller must set the all fields or call csrGetConfigParam to prefill the fields.
+    \param pParam - caller allocated memory
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+
+eHalStatus csrSetChannels(tHalHandle hHal,  tCsrConfigParam *pParam  );
+
+eHalStatus csrSetRegInfo(tHalHandle hHal,  tANI_U8 *apCntryCode);
+#endif
+
+
+//enum to string conversion for debug output
+const char * get_eRoamCmdStatus_str(eRoamCmdStatus val);
+const char * get_eCsrRoamResult_str(eCsrRoamResult val);
+/* ---------------------------------------------------------------------------
+    \fn csrSetPhyMode
+    \brief HDD calls this function to set the phyMode.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    CSR.
+    \param phyMode - indicate the phyMode needs to set to. The value has to be either 0, or some bits set. 
+    See eCsrPhyMode for definition
+    \param eBand - specify the operational band (2.4, 5 or both)
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded);
+
+void csrDumpInit(tHalHandle hHal);
+
+
+/*---------------------------------------------------------------------------
+  This is the type for a link quality callback to be registered with SME
+  for indications
+  Once the link quality has been indicated, subsequently, link indications are 
+  posted each time there is a CHANGE in link quality.
+  *** If there is no change in link, there will be no indication ***
+
+  The indications may be based on one or more criteria internal to SME
+  such as RSSI and PER.
+
+  \param ind - Indication being posted
+  \param pContext - any user data given at callback registration.  
+  \return None
+  
+---------------------------------------------------------------------------*/
+typedef void (* csrRoamLinkQualityIndCallback)
+             (eCsrRoamLinkQualityInd  ind, void *pContext);
+
+
+/*---------------------------------------------------------------------------
+  This is the type for a statistics callback to be registered with SME
+  for stats reporting
+
+  Since the client requesting for the stats already know which class/type of 
+  stats it asked for, the callback will carry them in the rsp buffer 
+  (void * stats) whose size will be same as the size of requested stats & 
+  will be exactly in the same order requested in the stats mask from LSB to MSB
+
+  \param stats - stats rsp buffer sent back with the report
+  \param pContext - any user data given at callback registration.  
+  \return None
+  
+---------------------------------------------------------------------------*/
+typedef void ( *tCsrStatsCallback) (void * stats, void *pContext);
+
+/*---------------------------------------------------------------------------
+  This is the type for a rssi callback to be registered with SME
+  for getting rssi
+
+  \param rssi - rssi
+  \param pContext - any user data given at callback registration.  
+  \return None
+  
+---------------------------------------------------------------------------*/
+
+typedef void ( *tCsrRssiCallback) (v_S7_t rssi, tANI_U32 staId, void *pContext);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription);
+#endif
+
+/*---------------------------------------------------------------------------
+  This is the function to change the Band configuraiton (ALL/2.4 GHZ/5 GHZ) 
+
+  \param hHal - handle to Hal context 
+  \param eBand - band value
+  \return  eHalStatus
+  
+---------------------------------------------------------------------------*/
+eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand);
+
+/*---------------------------------------------------------------------------
+  This is the function to get the current operating band value
+  \param hHal - handl to Hal context
+  \return eCsrband - band value
+  
+---------------------------------------------------------------------------*/
+eCsrBand csrGetCurrentBand (tHalHandle hHal);
+
+#endif
+
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
new file mode 100644
index 0000000..9fc423d
--- /dev/null
+++ b/CORE/SME/inc/csrInternal.h
@@ -0,0 +1,1177 @@
+/*
+ * 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 csrInternal.h
+  
+    Define internal data structure for MAC.
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated 
+   ========================================================================== */
+#ifndef CSRINTERNAL_H__
+#define CSRINTERNAL_H__
+
+#if defined(VOSS_ENABLED)
+#include "vos_status.h"
+#include "vos_lock.h"
+#endif //#if defined(VOSS_ENABLED)
+
+#include "palTimer.h"
+#include "csrSupport.h"
+#include "vos_nvitem.h"
+#include "wlan_qct_tl.h"
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#include "csrNeighborRoam.h"
+#endif
+
+#define CSR_MAX_STA (HAL_NUM_STA)
+
+#define CSR_SME_SCAN_FLAGS_DELETE_CACHE     0x80
+
+#define CSR_TITAN_MAX_RATE_MIMO_CB 240
+#define CSR_TITAN_MAX_RATE_MIMO    126
+
+//define scan return criteria. LIM should use these define as well
+#define CSR_SCAN_RETURN_AFTER_ALL_CHANNELS          (    0 )
+#define CSR_SCAN_RETURN_AFTER_FIRST_MATCH           ( 0x01 )
+#define CSR_SCAN_RETURN_AFTER_5_BAND_11d_FOUND      ( 0x80 )
+#define CSR_SCAN_RETURN_AFTER_24_BAND_11d_FOUND     ( 0x40 )
+#define CSR_SCAN_RETURN_AFTER_EITHER_BAND_11d_FOUND ( CSR_SCAN_RETURN_AFTER_5_BAND_11d_FOUND | CSR_SCAN_RETURN_AFTER_24_BAND_11d_FOUND )
+#define CSR_NUM_RSSI_CAT        5
+#define CSR_MAX_STATISTICS_REQ        10
+
+//Support for multiple session
+#define CSR_SESSION_ID_INVALID    0xFF   // session ID invalid
+#define CSR_ROAM_SESSION_MAX      5   // No of sessions to be supported, and a
+                                      // session is for Infra, IBSS or BT-AMP
+
+#define CSR_IS_SESSION_VALID( pMac, sessionId ) ( ( (sessionId) < CSR_ROAM_SESSION_MAX ) \
+                                                  && ( (pMac)->roam.roamSession[(sessionId)].sessionActive ) )
+#define CSR_GET_SESSION( pMac, sessionId ) \
+( \
+    (sessionId < CSR_ROAM_SESSION_MAX) ? \
+     (&(pMac)->roam.roamSession[(sessionId)]) :\
+     NULL \
+)
+
+
+
+typedef enum
+{
+    //eCSR_CFG_DOT11_MODE_BEST = 0,
+    eCSR_CFG_DOT11_MODE_TAURUS = 0,
+    eCSR_CFG_DOT11_MODE_ABG,    
+    eCSR_CFG_DOT11_MODE_11A,    
+    eCSR_CFG_DOT11_MODE_11B,    
+    eCSR_CFG_DOT11_MODE_11G,    
+    eCSR_CFG_DOT11_MODE_11N,   
+    eCSR_CFG_DOT11_MODE_POLARIS,    
+    eCSR_CFG_DOT11_MODE_TITAN,    
+#ifdef WLAN_SOFTAP_FEATURE
+    eCSR_CFG_DOT11_MODE_11G_ONLY,    
+    eCSR_CFG_DOT11_MODE_11N_ONLY,   
+#endif 
+    //This value can never set to CFG. It is for CSR's internal use
+    eCSR_CFG_DOT11_MODE_AUTO,
+}eCsrCfgDot11Mode;  //Used to determine what to set to the WNI_CFG_DOT11_MODE
+
+typedef enum etCsrRoamCommands 
+{
+    eCsrRoamNoCommand,                 
+    eCsrRoamCommandScan,
+    eCsrRoamCommandRoam, 
+    eCsrRoamCommandWmStatusChange, 
+    eCsrRoamCommandSetKey,
+    eCsrRoamCommandRemoveKey,
+
+} eCsrRoamCommands;
+
+typedef enum  
+{
+    eCsrScanOther = 1,
+    eCsrScanLostLink1,
+    eCsrScanLostLink2,
+    eCsrScanLostLink3,
+    eCsrScanLostLink4,
+    eCsrScan11d1,  //First 11d scan
+    eCsrScan11d2,  //First 11d scan has failed
+    eCsrScan11dDone,  //11d scan succeeded, try the rest of the channel
+    eCsrScanUserRequest,
+    eCsrScanGetResult,
+    eCsrScanSetBGScanParam, //used for HO too - bg scan request in NT Handoff sub-state
+    eCsrScanForSsid,
+    eCsrScanForCapsChange,
+    eCsrScanBGScanAbort,
+    eCsrScanBGScanEnable,
+    eCsrScanIdleScan,
+    eCsrScanGetScanChnInfo,     //To get the list of channels scanned
+
+    eCsrScanBgScan, // bg scan request in NRT & RT Handoff sub-states
+    eCsrScanProbeBss, // directed probe on an entry from the candidate list - HO
+    eCsrScanAbortBgScan,    //aborting a BG scan (meaning the scan is triggered by LIM timer)
+    eCsrScanAbortNormalScan, //aborting a normal scan (the scan is trigger by eWNI_SME_SCAN_REQ)
+    eCsrScanP2PFindPeer    
+}eCsrScanReason;
+
+typedef enum 
+{
+    eCsrNoConnection,          // Roaming because we have not established the initial connection.
+    eCsrCapsChange,            // roaming because LIM reported a Capability change in the associated AP.
+    eCsrForcedDisassoc,        // roaming becuase someone asked us to Disassoc and stay disassociated.
+    eCsrHddIssued,             // roaming because an 802.11 request was issued to the driver.
+    eCsrLostLink1,             // roaming because we lost link to an associated AP
+    eCsrLostLink2, 
+    eCsrLostLink3,
+    eCsrForcedDisassocMICFailure, // roaming because we need to force a Disassoc due to MIC failure
+    eCsrHddIssuedReassocToSameAP,
+    eCsrSmeIssuedReassocToSameAP,
+    eCsrSmeIssuedReassocToDiffAP,
+    eCsrForcedDeauth,        // roaming becuase someone asked us to deauth and stay disassociated.
+    eCsrSmeIssuedDisassocForHandoff, // will be issued by Handoff logic to disconect from current AP
+    eCsrSmeIssuedAssocToSimilarAP, // will be issued by Handoff logic to join a new AP with same profile
+    eCsrSmeIssuedIbssJoinFailure, // ibss join timer fired before any perr showed up, so shut down the network
+    eCsrForcedIbssLeave,
+    eCsrStopBss,
+    eCsrSmeIssuedFTReassoc,
+    eCsrForcedDisassocSta,
+    eCsrForcedDeauthSta,
+    
+}eCsrRoamReason;
+
+typedef enum
+{
+    eCSR_ROAM_SUBSTATE_NONE = 0,                 
+    eCSR_ROAM_SUBSTATE_START_BSS_REQ,            
+    eCSR_ROAM_SUBSTATE_JOIN_REQ,                 
+    eCSR_ROAM_SUBSTATE_REASSOC_REQ,              
+    eCSR_ROAM_SUBSTATE_DISASSOC_REQ,             
+    eCSR_ROAM_SUBSTATE_STOP_BSS_REQ,             
+    eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING,   //Continue the current roam command after disconnect            
+    eCSR_ROAM_SUBSTATE_AUTH_REQ,                 
+    eCSR_ROAM_SUBSTATE_CONFIG,                   
+    eCSR_ROAM_SUBSTATE_DEAUTH_REQ,               
+    eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, 
+    eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, 
+    eCSR_ROAM_SUBSTATE_DISASSOC_FORCED,          
+    eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY,
+    eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF,
+    eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC,
+    eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC,
+    eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC,
+//  max is 15 unless the bitfield is expanded...
+} eCsrRoamSubState;
+
+
+typedef enum 
+{
+  eCSR_ROAMING_STATE_STOP = 0,
+  eCSR_ROAMING_STATE_IDLE,
+  eCSR_ROAMING_STATE_SCANNING,
+  eCSR_ROAMING_STATE_JOINING,
+  eCSR_ROAMING_STATE_JOINED,
+}eCsrRoamState;
+
+
+typedef enum 
+{
+    eCsrContinueRoaming,
+    eCsrStopRoaming,
+    eCsrStartIbss,
+    eCsrStartIbssSameIbss,
+    eCsrReassocToSelfNoCapChange,
+    
+}eCsrJoinState;
+
+typedef enum
+{
+    eCsrNotRoaming,
+    eCsrLostlinkRoamingDisassoc,
+    eCsrLostlinkRoamingDeauth,
+    eCsrDynamicRoaming,
+   eCsrReassocRoaming,
+}eCsrRoamingReason;
+
+typedef enum 
+{
+    eCsrDisassociated,
+    eCsrDeauthenticated
+
+}eCsrRoamWmStatusChangeTypes;
+
+typedef enum
+{
+   eCsrSummaryStats = 0,
+   eCsrGlobalClassAStats,
+   eCsrGlobalClassBStats,
+   eCsrGlobalClassCStats,
+   eCsrGlobalClassDStats,
+   eCsrPerStaStats,
+   eCsrMaxStats
+}eCsrRoamStatsClassTypes;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+typedef enum
+{
+   eCSR_WLAN_STATUS_CONNECT =0,
+   eCSR_WLAN_STATUS_DISCONNECT
+
+}eCsrDiagWlanStatusEventSubtype;
+
+typedef enum
+{
+   eCSR_REASON_UNSPECIFIED = 0,
+   eCSR_REASON_USER_REQUESTED,
+   eCSR_REASON_MIC_ERROR,
+   eCSR_REASON_DISASSOC,
+   eCSR_REASON_DEAUTH,
+   eCSR_REASON_HANDOFF,
+
+}eCsrDiagWlanStatusEventReason;
+
+typedef enum
+{
+   eCSR_WLAN_HANDOFF_EVENT =0,
+
+}eCsrDiagWlanHandoffEventSubtype;
+
+typedef enum
+{
+   eCSR_WLAN_VCC_EVENT =0,
+
+}eCsrDiagWlanVccEventSubtype;
+
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+typedef struct tagCsrChannel
+{
+    tANI_U8 numChannels;
+    tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+}tCsrChannel;
+
+typedef struct tagScanProfile
+{
+    tANI_U32 minChnTime;
+    tANI_U32 maxChnTime;
+    tANI_U32 restTime;  //This is ignored if not associated
+    tANI_U32 numOfChannels;
+    tANI_U8 *pChannelList;
+    tSirScanType scanType;  //active or passive
+    eCsrRoamBssType bssType;    //BSS or IBSS
+    tANI_U8 ssid[WNI_CFG_SSID_LEN];
+    tANI_U8 bReturnAfter1stMatch;
+    tANI_U8 fUniqueResult;
+    tANI_U8 freshScan;
+    tCsrBssid bssid;
+}tScanProfile;
+
+typedef struct tagBssConfigParam
+{
+    eCsrMediaAccessType qosType;
+    tSirMacSSid SSID;
+    tANI_U32 uRTSThresh;
+    tANI_U32 uDeferThresh;  //
+    eCsrCfgDot11Mode uCfgDot11Mode;
+    eCsrBand eBand;
+    tANI_U8 standardRate[CSR_DOT11_SUPPORTED_RATES_MAX];
+    tANI_U8 extendedRate[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX];
+    eCsrExposedTxRate txRate;
+    tAniAuthType authType;
+    eCsrEncryptionType encType;
+    tANI_U32 uShortSlotTime;
+    tANI_U32 uHTSupport;    //High throughput
+    tANI_U32 uPowerLimit;
+    tANI_U32 uHeartBeatThresh;
+    tANI_U32 uJoinTimeOut;
+    tSirMacCapabilityInfo BssCap;
+    tANI_BOOLEAN f11hSupport;
+    tAniCBSecondaryMode cbMode;
+}tBssConfigParam;
+
+
+typedef struct tagCsrRoamStartBssParams
+{
+    tSirMacSSid         ssId;
+    tCsrBssid           bssid;    //this is the BSSID for the party we want to join (only use for IBSS or WDS)
+    tSirNwType          sirNwType;
+    tAniCBSecondaryMode cbMode;
+    tSirMacRateSet      operationalRateSet;
+    tSirMacRateSet      extendedRateSet;
+    tANI_U8             operationChn;
+    eCsrCfgDot11Mode    uCfgDot11Mode;
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U8             privacy;
+    tANI_BOOLEAN        fwdWPSPBCProbeReq;
+    tANI_BOOLEAN        protEnabled;
+    tANI_BOOLEAN        obssProtEnabled;
+    tAniAuthType        authType;
+    tANI_U16            beaconInterval;    //If this is 0, SME will fill in for caller.
+    tANI_U16            ht_protection;
+    tANI_U32            dtimPeriod;
+    tANI_U8             ApUapsdEnable;
+    tANI_U8             ssidHidden;
+    tANI_U8             wps_state;
+#endif
+    tVOS_CON_MODE       bssPersona;
+    tANI_U16            nRSNIELength;  //The byte count in the pRSNIE, if 0, pRSNIE is ignored.
+    tANI_U8             *pRSNIE;     //If not null, it has the IE byte stream for RSN
+}tCsrRoamStartBssParams;
+
+
+typedef struct tagScanCmd
+{
+    tANI_U32                scanID;
+    csrScanCompleteCallback callback;
+    void                    *pContext;
+    eCsrScanReason          reason;
+    eCsrRoamState           lastRoamState[CSR_ROAM_SESSION_MAX];
+    tCsrRoamProfile         *pToRoamProfile;
+    tANI_U32                roamId;    //this is the ID related to the pToRoamProfile
+    union
+    {
+        tCsrScanRequest   scanRequest;
+        tCsrBGScanRequest bgScanRequest;
+    }u;
+}tScanCmd;
+
+typedef struct tagRoamCmd 
+{
+    tANI_U32 roamId;
+    eCsrRoamReason roamReason;
+    tCsrRoamProfile roamProfile;
+    tScanResultHandle hBSSList;     //BSS list fits the profile
+    tListElem *pRoamBssEntry;  //point to the current BSS in the list that is roaming. It starts from head to tail        
+    tSirBssDescription *pLastRoamBss;   //the last BSS we try and failed
+    tANI_BOOLEAN fReleaseBssList;  //whether to free hBSSList 
+    tANI_BOOLEAN fReleaseProfile;  //whether to free roamProfile
+    tANI_BOOLEAN fReassoc;  //whether this command is for reassociation
+    tANI_BOOLEAN fUpdateCurRoamProfile;     //whether pMac->roam.pCurRoamProfile needs to be updated
+    //this is for CSR internal used only. And it should not be assigned when creating the command
+    //This causes the roam command not to do anything.
+    tANI_BOOLEAN fReassocToSelfNoCapChange;    
+
+    tANI_BOOLEAN fStopWds;
+    tSirMacAddr peerMac;
+    tSirMacReasonCodes reason;
+}tRoamCmd;
+
+typedef struct tagSetKeyCmd
+{
+    tANI_U32 roamId;
+    eCsrEncryptionType encType;
+    eCsrAuthType authType;
+    tAniKeyDirection keyDirection;    //Tx, Rx or Tx-and-Rx
+    tSirMacAddr peerMac;   //Peer's MAC address. ALL 1's for group key
+    tANI_U8 paeRole;      //0 for supplicant
+    tANI_U8 keyId;  // Kye index
+    tANI_U8 keyLength;  //Number of bytes containing the key in pKey
+    tANI_U8 Key[CSR_MAX_KEY_LEN];
+    tANI_U8 keyRsc[CSR_MAX_RSC_LEN];
+} tSetKeyCmd;
+
+typedef struct tahRemoveKeyCmd
+{
+    tANI_U32 roamId;
+    eCsrEncryptionType encType;
+    eCsrAuthType authType;
+    tSirMacAddr peerMac;   //Peer's MAC address. ALL 1's for group key
+    tANI_U8 keyId;  //key index
+} tRemoveKeyCmd;
+
+typedef struct tagWmStatusChangeCmd 
+{
+    eCsrRoamWmStatusChangeTypes Type;
+    union 
+    {    
+        tSirSmeDeauthInd   DeauthIndMsg;
+        tSirSmeDisassocInd DisassocIndMsg;
+    }u;    
+
+}tWmStatusChangeCmd;
+
+typedef struct tagAddStaForSessionCmd
+{
+   //Session self mac addr
+   tSirMacAddr selfMacAddr;
+}tAddStaForSessionCmd;
+
+typedef struct tagDelStaForSessionCmd
+{
+   //Session self mac addr
+   tSirMacAddr selfMacAddr;
+   csrRoamSessionCloseCallback callback;
+   void *pContext;
+}tDelStaForSessionCmd;
+
+//This structure represents one scan request
+typedef struct tagCsrCmd
+{
+    tListElem Link;
+    eCsrRoamCommands command;
+    tANI_U8 sessionId;              // Session ID for this command
+    union
+    {
+        tScanCmd scanCmd;
+        tRoamCmd roamCmd;
+        tWmStatusChangeCmd wmStatusChangeCmd;
+        tSetKeyCmd setKeyCmd;
+        tRemoveKeyCmd removeKeyCmd;
+        tAddStaForSessionCmd addStaSessionCmd;
+        tDelStaForSessionCmd delStaSessionCmd;
+    }u;
+}tCsrCmd;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+typedef struct tagCsr11rConfig
+{
+    tANI_BOOLEAN   IsFTResourceReqSupported;
+} tCsr11rConfig;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+typedef struct tagCsrNeighborRoamConfig
+{
+    tANI_U32       nNeighborScanTimerPeriod;
+    tANI_U8        nNeighborLookupRssiThreshold;
+    tANI_U8        nNeighborReassocRssiThreshold;
+    tANI_U16       nNeighborScanMinChanTime;
+    tANI_U16       nNeighborScanMaxChanTime;
+    sCsrChannel    neighborScanChanList;
+    tANI_U8        nMaxNeighborRetries;
+    tANI_U16       nNeighborResultsRefreshPeriod;
+}tCsrNeighborRoamConfig;
+#endif
+
+typedef struct tagCsrConfig
+{
+    tANI_U32 agingCount;
+    tANI_U32 FragmentationThreshold;
+    tANI_U32 channelBondingMode24GHz;
+    tANI_U32 channelBondingMode5GHz;
+    tANI_U32 RTSThreshold;
+    eCsrPhyMode phyMode;
+    eCsrCfgDot11Mode uCfgDot11Mode;
+    eCsrBand eBand;
+    tANI_U32 HeartbeatThresh50;
+    tANI_U32 HeartbeatThresh24;
+    tANI_U32 bgScanInterval;
+    eCsrCBChoice cbChoice;
+    eCsrBand bandCapability;     //indicate hw capability
+    eCsrRoamWmmUserModeType WMMSupportMode;
+    tANI_BOOLEAN Is11eSupportEnabled;
+    tANI_BOOLEAN Is11dSupportEnabled;
+    tANI_BOOLEAN Is11dSupportEnabledOriginal;
+    tANI_BOOLEAN Is11hSupportEnabled;
+    tANI_BOOLEAN shortSlotTime;
+    tANI_BOOLEAN ProprietaryRatesEnabled;
+    tANI_BOOLEAN  fenableMCCMode;
+    tANI_U16 TxRate;
+    tANI_U8 AdHocChannel24;
+    tANI_U8 AdHocChannel5G;
+    tANI_U32 impsSleepTime;     //in units of microseconds
+    tANI_U32 scanAgeTimeNCNPS;  //scan result aging time threshold when Not-Connect-No-Power-Save, in seconds
+    tANI_U32 scanAgeTimeNCPS;   //scan result aging time threshold when Not-Connect-Power-Save, in seconds
+    tANI_U32 scanAgeTimeCNPS;   //scan result aging time threshold when Connect-No-Power-Save, in seconds,
+    tANI_U32 scanAgeTimeCPS;   //scan result aging time threshold when Connect-Power-Savein seconds
+    tANI_U32 BssPreferValue[CSR_NUM_RSSI_CAT];  //each RSSI category has one value
+    int RSSICat[CSR_NUM_RSSI_CAT];
+    tANI_U8 bCatRssiOffset;     //to set the RSSI difference for each category
+    tANI_U32 nRoamingTime;  //In seconds, CSR will try this long before gives up, 0 means no roaming
+    //Whether to limit the channels to the ones set in Csr11dInfo. If true, the opertaional
+    //channels are limited to the default channel list. It is an "AND" operation between the 
+    //default channels and the channels in the 802.11d IE.
+    tANI_BOOLEAN fEnforce11dChannels;   
+    //Country Code Priority
+    //0 = 802.11D > Configured Country > NV 
+    //1 = Configured Country > 802.11D > NV
+    tANI_BOOLEAN fSupplicantCountryCodeHasPriority;
+    //When true, AP with unknown country code won't be see. 
+    //"Unknown country code" means either Ap doesn't have 11d IE or we cannot 
+    //find a domain for the country code in its 11d IE.
+    tANI_BOOLEAN fEnforceCountryCodeMatch;  
+    //When true, only APs in the default domain can be seen. If the Ap has "unknown country
+    //code", or the doamin of the country code doesn't match the default domain, the Ap is
+    //not acceptable.
+    tANI_BOOLEAN fEnforceDefaultDomain;     
+
+    tANI_U16 vccRssiThreshold;
+    tANI_U32 vccUlMacLossThreshold;
+
+    tANI_U32  nPassiveMinChnTime;    //in units of milliseconds
+    tANI_U32  nPassiveMaxChnTime;    //in units of milliseconds
+    tANI_U32  nActiveMinChnTime;     //in units of milliseconds
+    tANI_U32  nActiveMaxChnTime;     //in units of milliseconds
+
+    tANI_BOOLEAN IsIdleScanEnabled;
+    //in dBm, the maximum TX power
+    //The actual TX power is the lesser of this value and 11d. 
+    //If 11d is disable, the lesser of this and default setting.
+    tANI_U8 nTxPowerCap;
+    tANI_U32  statsReqPeriodicity;  //stats request frequency from PE while in full power
+    tANI_U32  statsReqPeriodicityInPS;//stats request frequency from PE while in power save
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U32 dtimPeriod;
+    tANI_BOOLEAN    ssidHidden;
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tCsr11rConfig csr11rConfig;
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+    tANI_U8   isCcxIniFeatureEnabled;
+#endif
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    tANI_U8   isFastTransitionEnabled;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    tCsrNeighborRoamConfig neighborRoamConfig;
+#endif
+
+    /* Instead of Reassoc, send ADDTS/DELTS even when ACM is off for that AC 
+     * This is mandated by WMM-AC certification */
+    tANI_BOOLEAN addTSWhenACMIsOff;
+
+    tANI_BOOLEAN fValidateList;
+    tANI_BOOLEAN concurrencyEnabled;
+
+    //To enable/disable scanning 2.4Ghz channels twice on a single scan request from HDD
+    tANI_BOOLEAN fScanTwice;
+
+}tCsrConfig;
+
+typedef struct tagCsrChannelPowerInfo 
+{
+    tListElem link;
+    tANI_U8 firstChannel;
+    tANI_U8 numChannels;
+    tANI_U8 txPower;
+    tANI_U8 interChannelOffset;
+}tCsrChannelPowerInfo;
+
+typedef struct tagRoamJoinStatus
+{
+    tSirResultCodes statusCode;
+    //this is set to unspecified if statusCode indicates timeout. Or it is the failed reason from the other BSS(per 802.11 spec)
+    tANI_U32 reasonCode;    
+}tCsrRoamJoinStatus;
+
+typedef struct tagCsrOsChannelMask
+{
+    tANI_U8 numChannels;
+    tANI_BOOLEAN scanEnabled[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+}tCsrOsChannelMask;
+
+
+typedef struct tagCsrScanStruct
+{
+    tScanProfile scanProfile;
+    tANI_U32 nextScanID;
+    tDblLinkList scanResultList;
+    tDblLinkList tempScanResults;
+    tANI_BOOLEAN fScanEnable;
+    tANI_BOOLEAN fFullScanIssued;
+    tPalTimerHandle hTimerGetResult;
+#ifdef WLAN_AP_STA_CONCURRENCY
+    tPalTimerHandle hTimerStaApConcTimer;
+#endif
+    tPalTimerHandle hTimerIdleScan;
+    tPalTimerHandle hTimerResultAging;
+    tPalTimerHandle hTimerBgScan;
+    //changes on every scan, it is used as a flag for whether 11d info is found on every scan
+    tANI_U8 channelOf11dInfo;   
+    //changes on every scan, a flag to tell whether conflict 11d info found on each BSS
+    tANI_BOOLEAN fAmbiguous11dInfoFound;    
+    //Tush: changes on every scan, a flag to tell whether the applied 11d info present in one of the scan results
+    tANI_BOOLEAN fCurrent11dInfoMatch;    
+    tANI_BOOLEAN f11dInfoReset;     //to indicate whether the 11d info in CFG is reset to default
+    tSirScanType curScanType;
+    tCsrChannel baseChannels;   //This are all the supported channels AND(&) to the current eBand
+    tCsrChannel channels11d;
+    tChannelListWithPower defaultPowerTable[WNI_CFG_VALID_CHANNEL_LIST_LEN]; //From NV
+    tChannelListWithPower defaultPowerTable40MHz[WNI_CFG_VALID_CHANNEL_LIST_LEN]; //From NV
+    tANI_U32 numChannelsDefault; //total channels of NV
+    tCsrChannel base20MHzChannels;   //The channel base to work on
+    tCsrChannel base40MHzChannels;   //center channels for 40MHz channels
+    tDblLinkList channelPowerInfoList24;
+    tDblLinkList channelPowerInfoList5G;
+    tANI_U32 nLastAgeTimeOut;
+    tANI_U32 nAgingCountDown;
+    tANI_U8 countryCodeDefault[WNI_CFG_COUNTRY_CODE_LEN+1];     //The country code from NV
+    tANI_U8 countryCodeCurrent[WNI_CFG_COUNTRY_CODE_LEN+1];
+    tANI_U8 countryCode11d[WNI_CFG_COUNTRY_CODE_LEN+1];
+    v_REGDOMAIN_t domainIdDefault;  //default regulatory domain
+    v_REGDOMAIN_t domainIdCurrent;  //current regulatory domain
+    tANI_BOOLEAN f11dInfoApplied;
+    tANI_BOOLEAN fCancelIdleScan;
+#ifdef FEATURE_WLAN_WAPI
+//    tANI_U16 NumBkidCandidate;
+//    tBkidCandidateInfo BkidCandidateInfo[CSR_MAX_BKID_ALLOWED]; /* Move this as part of SessionEntry */
+#endif /* FEATURE_WLAN_WAPI */
+    tANI_U8 numBGScanChannel;   //number of valid channels in the bgScanChannelList
+    tANI_U8 bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
+    //the ChannelInfo member is not used in this structure.
+    //numBGScanChannel and bgScanChannelList are used for the BG scan channel info
+    tCsrBGScanRequest bgScanParams;  
+    tANI_BOOLEAN fRestartIdleScan;
+    tANI_U32 nIdleScanTimeGap;  //the time since last trying to trigger idle scan
+    tCsrOsChannelMask osScanChannelMask;//keep a track of channels to be scnned while in traffic condition
+    tANI_U16 nBssLimit; //the maximum number of BSS in scan cache
+    /*channelPowerInfoList24 has been seen corrupted. Set this flag to true trying to 
+    * detect when it happens. Adding this into code because we can't reproduce it easily.
+    * We don't know when it happens. */
+    tANI_BOOLEAN fValidateList;
+    /*Customer wants to start with an active scan based on the default country code.
+    * This optimization will minimize the driver load to association time.
+    * Based on this flag we will bypass the initial passive scan needed for 11d
+    * to determine the country code & domain */
+    tANI_BOOLEAN fEnableBypass11d;
+
+    /*Customer wants to optimize the scan time. Avoiding scans(passive) on DFS 
+    * channels while swipping through both bands can save some time 
+    * (apprx 1.3 sec) */
+    tANI_BOOLEAN fEnableDFSChnlScan;
+
+    tANI_BOOLEAN fDropScanCmd; //true means we don't accept scan commands
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+    tDblLinkList scanCmdPendingList;
+#endif    
+}tCsrScanStruct;
+
+
+//Save the connected information. This structure + connectedProfile
+//should contain all information about the connection
+typedef struct tagRoamCsrConnectedInfo
+{
+    tANI_U32 nBeaconLength; //the length, in bytes, of the beacon frame, can be 0
+    tANI_U32 nAssocReqLength;   //the length, in bytes, of the assoc req frame, can be 0
+    tANI_U32 nAssocRspLength;   //The length, in bytes, of the assoc rsp frame, can be 0
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    tANI_U32 nRICRspLength; //Length of the parsed RIC response IEs received in reassoc response
+#endif    
+#ifdef FEATURE_WLAN_CCX
+    tANI_U32 nTspecIeLength;
+#endif    
+    tANI_U8 *pbFrames;  //Point to a buffer contain the beacon, assoc req, assoc rsp frame, in that order
+                        //user needs to use nBeaconLength, nAssocReqLength, nAssocRspLength to desice where
+                        //each frame starts and ends.
+    tANI_U8 staId;
+}tCsrRoamConnectedInfo;
+
+
+typedef struct tagCsrLinkQualityIndInfo
+{   
+   csrRoamLinkQualityIndCallback  callback;
+   void                          *context;
+}tCsrLinkQualityIndInfo;
+
+typedef struct tagCsrPeStatsReqInfo
+{
+   tListElem              link;  /* list links */
+   tANI_U32               statsMask;
+   tANI_U32               periodicity;
+   tANI_BOOLEAN           rspPending;
+   vos_timer_t            hPeStatsTimer;
+   tANI_BOOLEAN           timerRunning;
+   tANI_U8                staId;
+   tANI_U8                numClient;
+   tpAniSirGlobal         pMac;
+   /* To remember if the peStats timer is stopped successfully or not */   
+   tANI_BOOLEAN           timerStopFailed;
+
+}tCsrPeStatsReqInfo;
+
+typedef struct tagCsrStatsClientReqInfo
+{
+   tListElem              link;  /* list links */
+   eCsrStatsRequesterType requesterId;
+   tCsrStatsCallback      callback;
+   tANI_U32               periodicity;
+   void                  *pContext;
+   tANI_U32               statsMask;
+   tCsrPeStatsReqInfo    *pPeStaEntry;
+   tANI_U8                staId;
+   vos_timer_t            timer;
+   tANI_BOOLEAN           timerExpired;
+   tpAniSirGlobal         pMac; // TODO: Confirm this change BTAMP
+}tCsrStatsClientReqInfo;
+
+typedef struct tagCsrTlStatsReqInfo
+{
+   tANI_U32               periodicity;
+   tANI_BOOLEAN           timerRunning;
+   tPalTimerHandle        hTlStatsTimer;
+   tANI_U8                numClient;
+}tCsrTlStatsReqInfo;
+
+typedef struct tagCsrRoamSession
+{
+    tANI_U8 sessionId;             // Session ID
+    tANI_BOOLEAN sessionActive;      // TRUE if it is used
+    tCsrBssid selfMacAddr;           // For BT-AMP station, this serve as BSSID for self-BSS.
+    csrRoamCompleteCallback callback;
+    void *pContext;
+    eCsrConnectState connectState;
+    tCsrRoamConnectedProfile connectedProfile;
+    tCsrRoamConnectedInfo connectedInfo;
+    tCsrRoamProfile *pCurRoamProfile;   
+    tSirBssDescription *pConnectBssDesc;
+    tANI_U16 NumPmkidCache;
+    tPmkidCacheInfo PmkidCacheInfo[CSR_MAX_PMKID_ALLOWED];
+    tANI_U8 cJoinAttemps;
+    //This may or may not have the up-to-date valid channel list
+    //It is used to get WNI_CFG_VALID_CHANNEL_LIST and not allocate memory all the time
+    tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    tANI_S32 sPendingCommands;    //0 means CSR is ok to low power
+#ifdef FEATURE_WLAN_WAPI
+    tANI_U16 NumBkidCache;
+    tBkidCacheInfo BkidCacheInfo[CSR_MAX_BKID_ALLOWED];
+#endif /* FEATURE_WLAN_WAPI */
+    tANI_BOOLEAN fRoaming;  //indicate whether CSR is roaming (either via lostlink or dynamic roaming)
+    //to remember some parameters needed for START_BSS.
+    //All member must be set every time we try to join or start an IBSS or BT-AMP
+    tCsrRoamStartBssParams bssParams;   
+    tANI_U32 nWpaRsnReqIeLength;   //the byte count of pWpaRsnIE;
+    tANI_U8 *pWpaRsnReqIE; //this contain the WPA/RSN IE in assoc request or the one sent in beacon (IBSS)
+    tANI_U32 nWpaRsnRspIeLength;    //the byte count for pWpaRsnRspIE
+    tANI_U8 *pWpaRsnRspIE;  //this contain the WPA/RSN IE in beacon/probe rsp
+#ifdef FEATURE_WLAN_WAPI
+    tANI_U32 nWapiReqIeLength;   //the byte count of pWapiReqIE;
+    tANI_U8 *pWapiReqIE; //this contain the WAPI IE in assoc request or the one sent in beacon (IBSS)
+    tANI_U32 nWapiRspIeLength;    //the byte count for pWapiRspIE
+    tANI_U8 *pWapiRspIE;  //this contain the WAPI IE in beacon/probe rsp
+#endif /* FEATURE_WLAN_WAPI */
+    tANI_U32 nAddIEScanLength;  //the byte count of pAddIeScanIE;
+    tANI_U8 *pAddIEScan; //this contains the additional IE in (unicast) probe request at the time of join
+    tANI_U32 nAddIEAssocLength;      //the byte count for pAddIeAssocIE
+    tANI_U8 *pAddIEAssoc; //this contains the additional IE in (re) assoc request
+
+    tANI_TIMESTAMP roamingStartTime;    //in units of 10ms
+    tCsrTimerInfo roamingTimerInfo;
+    eCsrRoamingReason roamingReason;
+    tANI_BOOLEAN fCancelRoaming;
+    tPalTimerHandle hTimerRoaming;
+    tPalTimerHandle hTimerIbssJoining;
+    tCsrTimerInfo ibssJoinTimerInfo;
+    tANI_BOOLEAN ibss_join_pending;
+    eCsrRoamResult roamResult;  //the roamResult that is used when the roaming timer fires
+    tCsrRoamJoinStatus joinFailStatusCode;    //This is the reason code for join(assoc) failure
+    //The status code returned from PE for deauth or disassoc (in case of lostlink), or our own dynamic roaming
+    tANI_U32 roamingStatusCode;     
+    tANI_U16 NumPmkidCandidate;
+    tPmkidCandidateInfo PmkidCandidateInfo[CSR_MAX_PMKID_ALLOWED];
+ #ifdef FEATURE_WLAN_WAPI
+    tANI_U16 NumBkidCandidate;
+    tBkidCandidateInfo BkidCandidateInfo[CSR_MAX_BKID_ALLOWED]; 
+#endif
+    tANI_BOOLEAN fWMMConnection;
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+    //To retry a join later when it fails if so desired
+    tPalTimerHandle hTimerJoinRetry;
+    tCsrTimerInfo joinRetryTimerInfo;
+    tANI_U32 maxRetryCount;
+#endif
+#ifdef FEATURE_WLAN_CCX
+    tCsrCcxCckmInfo ccxCckmInfo;
+    tANI_BOOLEAN isPrevApInfoValid;
+    tSirMacSSid prevApSSID;
+    tCsrBssid prevApBssid;
+    tANI_U8 prevOpChannel;
+    tANI_U16 clientDissSecs;
+    tANI_U32 roamTS1;
+#endif
+    tANI_U8 bRefAssocStartCnt;   //Tracking assoc start indication
+} tCsrRoamSession;
+
+typedef struct tagCsrRoamStruct
+{
+    tANI_U32 nextRoamId;
+    tDblLinkList roamCmdPendingList;
+    tDblLinkList channelList5G;
+    tDblLinkList channelList24;
+    tCsrConfig configParam;
+    tANI_U32 numChannelsEeprom; //total channels of eeprom
+    tCsrChannel base20MHzChannels;   //The channel base to work on              
+    tCsrChannel base40MHzChannels;   //center channels for 40MHz channels      
+    eCsrRoamState curState[CSR_ROAM_SESSION_MAX];  
+    eCsrRoamSubState curSubState[CSR_ROAM_SESSION_MAX];
+    //This may or may not have the up-to-date valid channel list
+    //It is used to get WNI_CFG_VALID_CHANNEL_LIST and not allocate memory all the time
+    tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    tANI_U32 numValidChannels; //total number of channels in CFG
+    
+    tANI_S32 sPendingCommands;
+    tChannelListWithPower   *powerTableFromEeprom;
+    tChannelListWithPower   *powerTableFromEeprom40MHz;
+    tPalTimerHandle hTimerWaitForKey;  //To support timeout for WaitForKey state
+    tCsrSummaryStatsInfo       summaryStatsInfo;
+    tCsrGlobalClassAStatsInfo  classAStatsInfo;
+    tCsrGlobalClassBStatsInfo  classBStatsInfo;
+    tCsrGlobalClassCStatsInfo  classCStatsInfo;
+    tCsrGlobalClassDStatsInfo  classDStatsInfo;
+    tCsrPerStaStatsInfo        perStaStatsInfo[CSR_MAX_STA];
+    tDblLinkList  statsClientReqList;
+    tDblLinkList  peStatsReqList;
+    tCsrTlStatsReqInfo  tlStatsReqInfo;
+    eCsrRoamLinkQualityInd vccLinkQuality;
+    tCsrLinkQualityIndInfo linkQualityIndInfo;
+    v_CONTEXT_t gVosContext; //used for interaction with TL
+    //To specify whether an association or a IBSS is WMM enabled
+    //This parameter is only valid during a join or start BSS command is being executed
+    //tANI_BOOLEAN fWMMConnection;      /* Moving it to be part of roamsession */
+    v_U8_t ucACWeights[WLANTL_MAX_AC];
+    /* TODO : Upto here */
+    tCsrTimerInfo WaitForKeyTimerInfo;
+    tCsrRoamSession   *roamSession;
+    tANI_U32 transactionId;        // Current transaction ID for internal use. 
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING    
+    tCsrNeighborRoamControlInfo neighborRoamInfo;
+#endif
+#ifdef FEATURE_WLAN_CCX
+    tANI_U8   isCcxIniFeatureEnabled;
+#endif
+}tCsrRoamStruct;
+
+
+#define GET_NEXT_ROAM_ID(pRoamStruct)  (((pRoamStruct)->nextRoamId + 1 == 0) ? 1 : (pRoamStruct)->nextRoamId)
+#define CSR_IS_ROAM_STATE(pMac, state, sessionId)  ( (state) == (pMac)->roam.curState[sessionId] )
+
+#define CSR_IS_ROAM_STOP(pMac, sessionId) CSR_IS_ROAM_STATE( (pMac), eCSR_ROAMING_STATE_STOP, sessionId ) 
+#define CSR_IS_ROAM_INIT(pMac, sessionId)  CSR_IS_ROAM_STATE( (pMac), eCSR_ROAMING_STATE_INIT, sessionId ) 
+#define CSR_IS_ROAM_SCANNING(pMac, sessionId)  CSR_IS_ROAM_STATE( pMac, eCSR_ROAMING_STATE_SCANNING, sessionId )
+#define CSR_IS_ROAM_JOINING(pMac, sessionId)   CSR_IS_ROAM_STATE( pMac, eCSR_ROAMING_STATE_JOINING, sessionId )
+#define CSR_IS_ROAM_IDLE(pMac, sessionId) CSR_IS_ROAM_STATE( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ) 
+#define CSR_IS_ROAM_JOINED(pMac, sessionId)    CSR_IS_ROAM_STATE( pMac, eCSR_ROAMING_STATE_JOINED, sessionId )
+
+#define CSR_IS_ROAM_SUBSTATE(pMac, subState, sessionId)   ((subState) == (pMac)->roam.curSubState[sessionId])
+#define CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_AUTH_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_AUTH_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_REASSOC_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISASSOC_FORCED, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_START_BSS_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_STOP_BSS_REQ, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_CONFIG, sessionId)
+#define CSR_IS_ROAM_SUBSTATE_WAITFORKEY(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId)
+#define CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_HO_NT(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_HO_NRT(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC, sessionId) 
+#define CSR_IS_ROAM_SUBSTATE_HO_RT(pMac, sessionId)    CSR_IS_ROAM_SUBSTATE((pMac), eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC, sessionId) 
+
+#define CSR_IS_PHY_MODE_B_ONLY(pMac) \
+        ((eCSR_DOT11_MODE_11b == (pMac)->roam.configParam.phyMode) ||\
+        (eCSR_DOT11_MODE_11b_ONLY == (pMac)->roam.configParam.phyMode))
+        
+#define CSR_IS_PHY_MODE_G_ONLY(pMac) \
+        (eCSR_DOT11_MODE_11g == (pMac)->roam.configParam.phyMode || eCSR_DOT11_MODE_11g_ONLY == (pMac)->roam.configParam.phyMode)        
+        
+#define CSR_IS_PHY_MODE_A_ONLY(pMac) \
+        ((eCSR_DOT11_MODE_11a == (pMac)->roam.configParam.phyMode) ||\
+        (eCSR_DOT11_MODE_11a_ONLY == (pMac)->roam.configParam.phyMode))
+        
+#define CSR_IS_PHY_MODE_DUAL_BAND(phyMode) \
+        ((eCSR_DOT11_MODE_abg & (phyMode)) || (eCSR_DOT11_MODE_11n & (phyMode)) || \
+        (eCSR_DOT11_MODE_TAURUS & (phyMode)) || \
+        (eCSR_DOT11_MODE_AUTO & (phyMode)))
+
+// this function returns TRUE if the NIC is operating exclusively in the 2.4 GHz band, meaning
+// it is NOT operating in the 5.0 GHz band.
+#define CSR_IS_24_BAND_ONLY(pMac) \
+        (eCSR_BAND_24 == (pMac)->roam.configParam.eBand)
+
+#define CSR_IS_5G_BAND_ONLY(pMac) \
+        (eCSR_BAND_5G == (pMac)->roam.configParam.eBand)
+
+#define CSR_IS_RADIO_DUAL_BAND(pMac) \
+        (eCSR_BAND_ALL == (pMac)->roam.configParam.bandCapability)
+
+#define CSR_IS_RADIO_BG_ONLY(pMac) \
+        (eCSR_BAND_24 == (pMac)->roam.configParam.bandCapability)
+
+// this function returns TRUE if the NIC is operating exclusively in the 5.0 GHz band, meaning
+// it is NOT operating in the 2.4 GHz band
+#define CSR_IS_RADIO_A_ONLY(pMac) \
+        (eCSR_BAND_5G == (pMac)->roam.configParam.bandCapability)
+
+// this function returns TRUE if the NIC is operating in both bands.
+#define CSR_IS_OPEARTING_DUAL_BAND(pMac) \
+        ((eCSR_BAND_ALL == (pMac)->roam.configParam.bandCapability) && (eCSR_BAND_ALL == (pMac)->roam.configParam.eBand))
+
+// this function returns TRUE if the NIC can operate in the 5.0 GHz band (could operate in the
+// 2.4 GHz band also).
+#define CSR_IS_OPERATING_A_BAND(pMac) \
+        (CSR_IS_OPEARTING_DUAL_BAND((pMac)) || CSR_IS_RADIO_A_ONLY((pMac)) || CSR_IS_5G_BAND_ONLY((pMac)))
+
+// this function returns TRUE if the NIC can operate in the 2.4 GHz band (could operate in the
+// 5.0 GHz band also).
+#define CSR_IS_OPERATING_BG_BAND(pMac) \
+        (CSR_IS_OPEARTING_DUAL_BAND((pMac)) || CSR_IS_RADIO_BG_ONLY((pMac)) || CSR_IS_24_BAND_ONLY((pMac)))
+
+#define CSR_IS_CHANNEL_5GHZ(chnNum) \
+        ((chnNum) > CSR_MAX_24GHz_CHANNEL_NUMBER)
+
+#define CSR_IS_CHANNEL_24GHZ(chnNum) \
+        (((chnNum) > 0) && ((chnNum) <= CSR_MAX_24GHz_CHANNEL_NUMBER))
+        
+#define CSR_IS_SAME_BAND_CHANNELS(ch1, ch2) (CSR_IS_CHANNEL_5GHZ(ch1) == CSR_IS_CHANNEL_5GHZ(ch2))
+
+
+#define CSR_IS_11D_INFO_FOUND(pMac) \
+        (0 != (pMac)->scan.channelOf11dInfo)
+// DEAUTHIND
+#define CSR_IS_ROAMING(pSession) ((CSR_IS_LOSTLINK_ROAMING((pSession)->roamingReason)) || \
+                              (eCsrDynamicRoaming == (pSession)->roamingReason)  || \
+                              (eCsrReassocRoaming == (pSession)->roamingReason))   
+
+
+#define CSR_IS_SET_KEY_COMMAND( pCommand )    ( eSmeCommandSetKey == (pCommand)->command )
+
+#define CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(pMac) (pMac->roam.configParam.addTSWhenACMIsOff)
+// DEAUTHIND
+#define CSR_IS_LOSTLINK_ROAMING(reason)  ((eCsrLostlinkRoamingDisassoc == (reason)) || (eCsrLostlinkRoamingDeauth == (reason)))
+
+//Stop CSR from asking for IMPS, This function doesn't disable IMPS from CSR
+void csrScanSuspendIMPS( tpAniSirGlobal pMac );
+//Start CSR from asking for IMPS. This function doesn't trigger CSR to request entering IMPS
+//because IMPS maybe disabled.
+void csrScanResumeIMPS( tpAniSirGlobal pMac );
+
+eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
+
+eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     tCsrRoamModifyProfileFields *pModifyProfileFields);
+/* ---------------------------------------------------------------------------
+    \fn csrGetModifyProfileFields
+    \brief HDD or SME - QOS calls this function to get the current values of 
+    connected profile fields changing which can cause reassoc.
+    This function must be called after CFG is downloaded and STA is in connected
+    state.
+    \param pModifyProfileFields - pointer to the connected profile fields 
+    changing which can cause reassoc
+
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     tCsrRoamModifyProfileFields * pModifyProfileFields);
+void csrSetGlobalCfgs( tpAniSirGlobal pMac );
+void csrSetDefaultDot11Mode( tpAniSirGlobal pMac );
+void csrScanSetChannelMask(tpAniSirGlobal pMac, tCsrChannelInfo *pChannelInfo);
+tANI_BOOLEAN csrIsConnStateDisconnected(tpAniSirGlobal pMac, tANI_U32 sessionId);
+tANI_BOOLEAN csrIsConnStateConnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateDisconnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateConnectedInfra( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateConnected( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateInfra( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateIbss( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateWds( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateConnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsConnStateDisconnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId );
+tANI_BOOLEAN csrIsAnySessionInConnectState( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsAllSessionDisconnected( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsInfraConnected( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsConcurrentInfraConnected( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsIBSSStarted( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsBTAMPStarted( tpAniSirGlobal pMac );
+tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId );
+eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId );
+tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId);
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_BOOLEAN csrIsConnStateConnectedInfraAp( tpAniSirGlobal pMac, tANI_U32 sessionId );
+#endif
+/*----------------------------------------------------------------------------
+  \fn csrRoamRegisterLinkQualityIndCallback
+
+  \brief
+  a CSR function to allow HDD to register a callback handler with CSR for 
+  link quality indications. 
+
+  Only one callback may be registered at any time.
+  In order to deregister the callback, a NULL cback may be provided.
+
+  Registration happens in the task context of the caller.
+
+  \param callback - Call back being registered
+  \param pContext - user data
+  
+  DEPENDENCIES: After CSR open
+
+  \return eHalStatus  
+-----------------------------------------------------------------------------*/
+eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac,
+                                                 csrRoamLinkQualityIndCallback   callback,  
+                                                 void                           *pContext);
+/* ---------------------------------------------------------------------------
+    \fn csrGetStatistics
+    \brief csr function that client calls to register a callback to get 
+    different PHY level statistics from CSR. 
+    
+    \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
+    \param statsMask - The different category/categories of stats requester is looking for
+    \param callback - SME sends back the requested stats using the callback
+    \param periodicity - If requester needs periodic update, 0 means it's an one 
+                         time request
+    \param cache - If requester is happy with cached stats
+    \param staId - The station ID for which the stats is requested for
+    \param pContext - user context to be passed back along with the callback
+
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, 
+                            tANI_U32 statsMask, 
+                            tCsrStatsCallback callback, 
+                            tANI_U32 periodicity, tANI_BOOLEAN cache, 
+                            tANI_U8 staId, void *pContext);
+
+
+eHalStatus csrGetRssi(tpAniSirGlobal pMac,tCsrRssiCallback callback,tANI_U8 staId,tCsrBssid bssId,void * pContext,void * pVosContext);
+eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext);
+/* ---------------------------------------------------------------------------
+    \fn csrGetConfigParam
+    \brief HDD calls this function to get the global settings currently maintained by CSR. 
+    \param pParam - caller allocated memory
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam);
+
+/* ---------------------------------------------------------------------------
+    \fn csrMsgProcessor
+    \brief HDD calls this function to change some global settings. 
+    caller must set the all fields or call csrGetConfigParam to prefill the fields.
+    \param pParam - caller allocated memory
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam);
+
+
+/* ---------------------------------------------------------------------------
+    \fn csrMsgProcessor
+    \brief HDD calls this function for the messages that are handled by CSR.
+    \param pMsgBuf - a pointer to a buffer that maps to various structures base on the message type.
+    The beginning of the buffer can always map to tSirSmeRsp.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrMsgProcessor( tpAniSirGlobal pMac,  void *pMsgBuf );
+
+/* ---------------------------------------------------------------------------
+    \fn csrOpen
+    \brief This function must be called before any API call to CSR. 
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrOpen(tpAniSirGlobal pMac);
+/* ---------------------------------------------------------------------------
+    \fn csrClose
+    \brief To close down CSR module. There should not be any API call into CSR after calling this function.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrClose(tpAniSirGlobal pMac);
+/* ---------------------------------------------------------------------------
+    \fn csrStart
+    \brief To start CSR.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrStart(tpAniSirGlobal pMac);
+/* ---------------------------------------------------------------------------
+    \fn csrStop
+    \brief To stop CSR. CSR still keeps its current setting.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrStop(tpAniSirGlobal pMac);
+/* ---------------------------------------------------------------------------
+    \fn csrReady
+    \brief To let CSR is ready to operate
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrReady(tpAniSirGlobal pMac);
+
+#ifdef FEATURE_WLAN_WAPI
+eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum,
+                                tBkidCacheInfo *pBkidCache);
+
+
+eHalStatus csrScanGetBKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                       tBkidCandidateInfo *pBkidList, tANI_U32 *pNumItems );
+tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId);
+eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
+                                 tANI_U32 numItems );
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetWapiReqIE
+    \brief return the WAPI IE CSR passes to PE to JOIN request or START_BSS request
+    \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the 
+    needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetWapiRspIE
+    \brief return the WAPI IE from the beacon or probe rsp if connected
+    \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the 
+    needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf);
+tANI_U8 csrConstructWapiIe( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                            tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe );
+#endif /* FEATURE_WLAN_WAPI */
+
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs *pAPWPSIES );
+eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie);
+#endif
+void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy );
+tANI_S8 csrGetInfraSessionId( tpAniSirGlobal pMac );
+tANI_U8 csrGetInfraOperationChannel( tpAniSirGlobal pMac, tANI_U8 sessionId);
+tANI_U8 csrGetConcurrentOperationChannel( tpAniSirGlobal pMac );
+
+eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                               tCsrRoamConnectedProfile *pProfile);
+tANI_BOOLEAN csrIsSetKeyAllowed(tpAniSirGlobal pMac, tANI_U32 sessionId);
+
+void csrSetOppositeBandChannelInfo( tpAniSirGlobal pMac );
+void csrConstructCurrentValidChannelList( tpAniSirGlobal pMac, tDblLinkList *pChannelSetList, 
+                                            tANI_U8 *pChannelList, tANI_U8 bSize, tANI_U8 *pNumChannels );
+
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+//Returns whether the current association is a 11r assoc or not
+tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac);
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+//Returns whether the current association is a CCX assoc or not
+tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac);
+#endif
+
+void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac);
diff --git a/CORE/SME/inc/csrLinkList.h b/CORE/SME/inc/csrLinkList.h
new file mode 100644
index 0000000..569ca14
--- /dev/null
+++ b/CORE/SME/inc/csrLinkList.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.
+ */
+
+/** ------------------------------------------------------------------------- * 
+    ------------------------------------------------------------------------- *  
+    \file csrLinkList.h
+  
+    Exports and types for the Common link list interfaces.
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated
+ 
+   ========================================================================== */
+#ifndef CSR_LINK_LIST_H__
+#define CSR_LINK_LIST_H__
+
+#include "vos_lock.h"
+
+
+#define LL_ACCESS_LOCK          eANI_BOOLEAN_TRUE
+#define LL_ACCESS_NOLOCK        eANI_BOOLEAN_FALSE
+
+typedef struct tagListElem
+{
+    struct tagListElem *last;
+    struct tagListElem *next;
+}tListElem;
+
+typedef enum
+{
+    LIST_FLAG_CLOSE = 0,
+    LIST_FLAG_OPEN = 0xa1b2c4d7,
+}tListFlag;
+
+//This is a circular double link list
+typedef struct tagDblLinkList
+{
+  tListElem ListHead;
+  vos_lock_t Lock;
+  tANI_U32  Count;
+  tHddHandle hHdd;
+  tListFlag Flag;
+}tDblLinkList;
+
+//To get the address of an object of (type) base on the (address) of one of its (field)
+#define GET_BASE_ADDR(address, type, field) ((type *)( \
+                                                  (tANI_U8 *)(address) - \
+                                                  (tANI_U8 *)(&((type *)0)->field)))
+                                     
+//To get the offset of (field) inside structure (type)                                                  
+#define GET_FIELD_OFFSET(type, field)  ((tANI_U32_OR_PTR)(&(((type *)0)->field)))
+
+#define GET_ROUND_UP( _Field, _Boundary ) (((_Field) + ((_Boundary) - 1))  & ~((_Boundary) - 1))
+#define BITS_ON(  _Field, _Bitmask ) ( (_Field) |=  (_Bitmask) )
+#define BITS_OFF( _Field, _Bitmask ) ( (_Field) &= ~(_Bitmask) )
+
+#define CSR_MAX(a, b)  ((a) > (b) ? (a) : (b))
+#define CSR_MIN(a, b)  ((a) < (b) ? (a) : (b))
+
+                                                  
+#define csrIsListEmpty(pHead) ((pHead)->next == (pHead))
+
+tANI_U32 csrLLCount( tDblLinkList *pList );
+
+eHalStatus csrLLOpen( tHddHandle hHdd, tDblLinkList  *pList );
+void csrLLClose( tDblLinkList *pList );
+
+void csrLLLock( tDblLinkList *pList );
+void csrLLUnlock( tDblLinkList *pList );
+
+tANI_BOOLEAN csrLLIsListEmpty( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+
+void csrLLInsertHead( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked );
+void csrLLInsertTail( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked );
+//This function put pNewEntry before pEntry. Caller should have found pEntry
+void csrLLInsertEntry( tDblLinkList *pList, tListElem *pEntry, tListElem *pNewEntry, tANI_BOOLEAN fInterlocked );
+
+tListElem *csrLLPeekHead( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+tListElem *csrLLPeekTail( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+
+tListElem *csrLLRemoveHead( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+tListElem *csrLLRemoveTail( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+tANI_BOOLEAN  csrLLRemoveEntry( tDblLinkList *pList, tListElem *pEntryToRemove, tANI_BOOLEAN fInterlocked );
+void csrLLPurge( tDblLinkList *pList, tANI_BOOLEAN fInterlocked );
+
+//csrLLNext return NULL if reaching the end or list is empty
+tListElem *csrLLNext( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked );
+
+tListElem *csrLLPrevious( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked );
+
+tANI_BOOLEAN csrLLFindEntry( tDblLinkList *pList, tListElem *pEntryToFind );
+
+
+#endif
+
diff --git a/CORE/SME/inc/csrNeighborRoam.h b/CORE/SME/inc/csrNeighborRoam.h
new file mode 100644
index 0000000..b5f535b
--- /dev/null
+++ b/CORE/SME/inc/csrNeighborRoam.h
@@ -0,0 +1,186 @@
+/*
+ * 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 csrNeighborRoam.h
+  
+    Exports and types for the neighbor roaming algorithm which is sepcifically 
+    designed for Android.
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated
+   
+========================================================================== */
+#ifndef CSR_NEIGHBOR_ROAM_H
+#define CSR_NEIGHBOR_ROAM_H
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+
+/* Enumeration of various states in neighbor roam algorithm */
+typedef enum
+{
+    eCSR_NEIGHBOR_ROAM_STATE_CLOSED,
+    eCSR_NEIGHBOR_ROAM_STATE_INIT,
+    eCSR_NEIGHBOR_ROAM_STATE_CONNECTED,
+    eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN,
+    eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING,
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY,
+    eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN,
+    eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING,
+    eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE,
+#endif /* WLAN_FEATURE_VOWIFI_11R */    
+    eNEIGHBOR_STATE_MAX
+} eCsrNeighborRoamState;
+
+/* Parameters that are obtained from CFG */
+typedef struct sCsrNeighborRoamCfgParams
+{
+    tANI_U8         maxNeighborRetries;
+    tANI_U32        neighborScanPeriod;
+    tCsrChannelInfo channelInfo;
+    tANI_U8         neighborLookupThreshold;
+    tANI_U8         neighborReassocThreshold;
+    tANI_U32        minChannelScanTime;
+    tANI_U32        maxChannelScanTime;
+    tANI_U16        neighborResultsRefreshPeriod;
+} tCsrNeighborRoamCfgParams, *tpCsrNeighborRoamCfgParams;
+
+#define CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX    255
+typedef struct sCsrNeighborRoamChannelInfo
+{
+    tANI_BOOLEAN    IAPPNeighborListReceived; // Flag to mark reception of IAPP Neighbor list
+    tANI_BOOLEAN    chanListScanInProgress;
+    tANI_U8         currentChanIndex;       //Current channel index that is being scanned
+    tCsrChannelInfo currentChannelListInfo; //Max number of channels in channel list and the list of channels
+} tCsrNeighborRoamChannelInfo, *tpCsrNeighborRoamChannelInfo;
+
+typedef struct sCsrNeighborRoamBSSInfo
+{
+    tListElem           List;
+    tANI_U8             apPreferenceVal;
+//    tCsrScanResultInfo  *scanResultInfo;
+    tpSirBssDescription pBssDescription;
+} tCsrNeighborRoamBSSInfo, *tpCsrNeighborRoamBSSInfo;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#define CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT  1000    //in milliseconds
+#define CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER   5     //in milliseconds
+#define MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS       10 //Max number of MAC addresses with which the pre-auth was failed
+#define MAX_BSS_IN_NEIGHBOR_RPT                 4
+#define CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES 3
+
+/* Black listed APs. List of MAC Addresses with which the Preauthentication was failed. */
+typedef struct sCsrPreauthFailListInfo
+{
+    tANI_U8     numMACAddress;
+    tSirMacAddr macAddress[MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS];
+} tCsrPreauthFailListInfo, *tpCsrPreauthFailListInfo;
+
+typedef struct sCsrNeighborReportBssInfo
+{
+    tANI_U8 channelNum;
+    tANI_U8 neighborScore;
+    tSirMacAddr neighborBssId;
+} tCsrNeighborReportBssInfo, *tpCsrNeighborReportBssInfo;
+
+typedef struct sCsr11rAssocNeighborInfo
+{
+    tANI_BOOLEAN                preauthRspPending;
+    tANI_BOOLEAN                neighborRptPending;
+    tANI_U8                     currentNeighborRptRetryNum;
+    tPalTimerHandle             preAuthRspWaitTimer; //This timer is used for preauth response
+    tCsrTimerInfo               preAuthRspWaitTimerInfo;
+    tCsrPreauthFailListInfo     preAuthFailList;
+    tANI_U32                    neighborReportTimeout;
+    tANI_U32                    PEPreauthRespTimeout;
+    tANI_U8                     numPreAuthRetries;
+    tDblLinkList                preAuthDoneList;    /* Linked list which consists or preauthenticated nodes */
+    tANI_U8                     numBssFromNeighborReport;
+    tCsrNeighborReportBssInfo   neighboReportBssInfo[MAX_BSS_IN_NEIGHBOR_RPT];  //Contains info needed during REPORT_SCAN State
+} tCsr11rAssocNeighborInfo, *tpCsr11rAssocNeighborInfo;
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+/* Below macros are used to increase the registered neighbor Lookup threshold with TL when 
+ * we dont see any AP during back ground scanning. The values are incremented from neighborLookupThreshold 
+ * from CFG, incremented by 5,10,15...50(LOOKUP_THRESHOLD_INCREMENT_MULTIPLIER_MAX * 
+ * NEIGHBOR_LOOKUP_THRESHOLD_INCREMENT_CONSTANT) */
+#define NEIGHBOR_LOOKUP_THRESHOLD_INCREMENT_CONSTANT    5
+#define LOOKUP_THRESHOLD_INCREMENT_MULTIPLIER_MAX       4
+
+/* Complete control information for neighbor roam algorithm */
+typedef struct sCsrNeighborRoamControlInfo
+{
+    eCsrNeighborRoamState       neighborRoamState;
+    eCsrNeighborRoamState       prevNeighborRoamState;
+    tCsrNeighborRoamCfgParams   cfgParams;
+    tCsrBssid                   currAPbssid; // current assoc AP
+    tANI_U8                     currAPoperationChannel; // current assoc AP
+    tPalTimerHandle             neighborScanTimer;
+    tPalTimerHandle             neighborResultsRefreshTimer;
+    tCsrTimerInfo               neighborScanTimerInfo;
+    tCsrNeighborRoamChannelInfo roamChannelInfo;
+    tANI_U8                     currentNeighborLookupThreshold;
+    tANI_U8                     currentLookupIncrementMultiplier;
+    tANI_BOOLEAN                scanRspPending;
+    tANI_TIMESTAMP              scanRequestTimeStamp;
+    tDblLinkList                roamableAPList;    // List of current FT candidates
+    tANI_U32                    csrSessionId;
+    tCsrRoamProfile             csrNeighborRoamProfile;
+#ifdef WLAN_FEATURE_VOWIFI_11R    
+    tANI_BOOLEAN                is11rAssoc;
+    tCsr11rAssocNeighborInfo    FTRoamInfo;
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+#ifdef FEATURE_WLAN_CCX    
+    tANI_BOOLEAN                isCCXAssoc;
+    tANI_BOOLEAN                isVOAdmitted;
+    tANI_U32                    MinQBssLoadRequired;
+#endif
+} tCsrNeighborRoamControlInfo, *tpCsrNeighborRoamControlInfo;
+
+
+/* All the necessary Function declarations are here */
+eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac,tANI_U8 sessionId, VOS_STATUS status);
+eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac,tANI_U8 sessionId);
+tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac);
+void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac);
+eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac);
+void csrNeighborRoamClose(tpAniSirGlobal pMac);
+void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac);
+VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac);
+VOS_STATUS csrNeighborRoamTransitionToPreauthDone(tpAniSirGlobal pMac);
+eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter);
+void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode);
+void csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac);
+#endif
+VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac);
+void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac);
+
+
+
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
+#endif /* CSR_NEIGHBOR_ROAM_H */
diff --git a/CORE/SME/inc/csrSupport.h b/CORE/SME/inc/csrSupport.h
new file mode 100644
index 0000000..d7257e7
--- /dev/null
+++ b/CORE/SME/inc/csrSupport.h
@@ -0,0 +1,813 @@
+/*
+ * 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 csrSupport.h
+  
+    Exports and types for the Common Scan and Roaming supporting interfaces.
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated
+ 
+   ========================================================================== */
+#ifndef CSR_SUPPORT_H__
+#define CSR_SUPPORT_H__
+
+#include "csrLinkList.h"
+#include "csrApi.h"
+#include "vos_nvitem.h"
+
+#ifdef FEATURE_WLAN_WAPI
+#define CSR_WAPI_OUI_SIZE              ( 4 )
+#define CSR_WAPI_VERSION_SUPPORTED     ( 1 )
+#define CSR_WAPI_MAX_AUTH_SUITES       ( 2 )
+#define CSR_WAPI_MAX_CYPHERS           ( 5 )
+#define CSR_WAPI_MAX_UNICAST_CYPHERS   ( 5 )
+#define CSR_WAPI_MAX_MULTICAST_CYPHERS ( 1 )
+#endif /* FEATURE_WLAN_WAPI */
+
+#define CSR_RSN_OUI_SIZE              ( 4 )
+#define CSR_RSN_VERSION_SUPPORTED     ( 1 )
+#define CSR_RSN_MAX_AUTH_SUITES       ( 2 )
+#define CSR_RSN_MAX_CYPHERS           ( 5 )
+#define CSR_RSN_MAX_UNICAST_CYPHERS   ( 5 )
+#define CSR_RSN_MAX_MULTICAST_CYPHERS ( 1 )
+
+#define CSR_WPA_OUI_SIZE              ( 4 )
+#define CSR_WPA_VERSION_SUPPORTED     ( 1 )
+#define CSR_WME_OUI_SIZE ( 4 )
+#define CSR_WPA_MAX_AUTH_SUITES       ( 2 )
+#define CSR_WPA_MAX_CYPHERS           ( 5 )
+#define CSR_WPA_MAX_UNICAST_CYPHERS   ( 5 )
+#define CSR_WPA_MAX_MULTICAST_CYPHERS ( 1 )
+#define CSR_WPA_IE_MIN_SIZE           ( 6 )   // minimum size of the IE->length is the size of the Oui + Version.
+#define CSR_WPA_IE_MIN_SIZE_W_MULTICAST ( HDD_WPA_IE_MIN_SIZE + HDD_WPA_OUI_SIZE )
+#define CSR_WPA_IE_MIN_SIZE_W_UNICAST   ( HDD_WPA_IE_MIN_SIZE + HDD_WPA_OUI_SIZE + sizeof( pWpaIe->cUnicastCyphers ) )
+
+#define CSR_DOT11_SUPPORTED_RATES_MAX ( 12 )
+#define CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ( 8 )
+
+#define CSR_DOT11_MAX_NUM_SUPPORTED_11B_RATES ( 4 )
+#define CSR_DOT11_MAX_NUM_SUPPORTED_11A_RATES ( 8 )
+#define CSR_DOT11_BASIC_RATE_MASK ( 0x80 )
+
+#define CSR_WME_INFO_IE_VERSION_SUPPORTED ( 1 )
+#define CSR_WME_PARM_IE_VERSION_SUPPORTED ( 1 )
+
+#define CSR_PASSIVE_SCAN_STARTING_CHANNEL ( 52)
+#define CSR_PASSIVE_SCAN_ENDING_CHANNEL ( 140)
+
+#define CSR_DOT11_MAX_11A_RATE ( 54 * 2 )
+#define CSR_DOT11_MIN_11A_RATE (  6 * 2 )
+#define CSR_DOT11_MAX_11B_RATE ( 11 * 2 )
+#define CSR_DOT11_MIN_11B_RATE (  1 * 2 )
+#define CSR_DOT11_MAX_11G_RATE ( 54 * 2 )
+#define CSR_DOT11_MIN_11G_RATE (  6 * 2 )
+
+//Define the frequency ranges that need to be passive scan, MHz
+#define CSR_PASSIVE_SCAN_CAT1_LOW       5250 
+#define CSR_PASSIVE_SCAN_CAT1_HIGH      5350
+#define CSR_PASSIVE_SCAN_CAT2_LOW       5470 
+#define CSR_PASSIVE_SCAN_CAT2_HIGH      5725
+#define CSR_PASSIVE_SCAN_CAT3_LOW       5500 
+#define CSR_PASSIVE_SCAN_CAT3_HIGH      5560
+
+#define CSR_OUI_USE_GROUP_CIPHER_INDEX 0x00
+#define CSR_OUI_WEP40_OR_1X_INDEX      0x01
+#define CSR_OUI_TKIP_OR_PSK_INDEX      0x02
+#define CSR_OUI_RESERVED_INDEX         0x03
+#define CSR_OUI_AES_INDEX              0x04
+#define CSR_OUI_WEP104_INDEX           0x05
+
+#ifdef FEATURE_WLAN_WAPI
+#define CSR_OUI_WAPI_RESERVED_INDEX    0x00
+#define CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX    0x01
+#define CSR_OUI_WAPI_WAI_PSK_INDEX     0x02
+#endif /* FEATURE_WLAN_WAPI */
+
+
+typedef enum 
+{
+    // 11b rates
+    eCsrSuppRate_1Mbps   =   1 * 2,
+    eCsrSuppRate_2Mbps   =   2 * 2,
+    eCsrSuppRate_5_5Mbps =  11,      // 5.5 * 2
+    eCsrSuppRate_11Mbps  =  11 * 2,
+
+    // 11a / 11g rates
+    eCsrSuppRate_6Mbps   =   6 * 2,
+    eCsrSuppRate_9Mbps   =   9 * 2,
+    eCsrSuppRate_12Mbps  =  12 * 2,
+    eCsrSuppRate_18Mbps  =  18 * 2,
+    eCsrSuppRate_24Mbps  =  24 * 2,
+    eCsrSuppRate_36Mbps  =  36 * 2,
+    eCsrSuppRate_48Mbps  =  48 * 2,
+    eCsrSuppRate_54Mbps  =  54 * 2,
+
+    // airgo proprietary rates
+    eCsrSuppRate_10Mbps  =  10 * 2,
+    eCsrSuppRate_10_5Mbps=  21,     // 10.5 * 2
+    eCsrSuppRate_20Mbps  =  20 * 2,
+    eCsrSuppRate_21Mbps  =  21 * 2,
+    eCsrSuppRate_40Mbps  =  40 * 2,
+    eCsrSuppRate_42Mbps  =  42 * 2,
+    eCsrSuppRate_60Mbps  =  60 * 2,
+    eCsrSuppRate_63Mbps  =  63 * 2,
+    eCsrSuppRate_72Mbps  =  72 * 2,
+    eCsrSuppRate_80Mbps  =  80 * 2,
+    eCsrSuppRate_84Mbps  =  84 * 2,
+    eCsrSuppRate_96Mbps  =  96 * 2,
+    eCsrSuppRate_108Mbps = 108 * 2,
+    eCsrSuppRate_120Mbps = 120 * 2,
+    eCsrSuppRate_126Mbps = 126 * 2,
+    eCsrSuppRate_144Mbps = 144 * 2,
+    eCsrSuppRate_160Mbps = 160 * 2,
+    eCsrSuppRate_168Mbps = 168 * 2,
+    eCsrSuppRate_192Mbps = 192 * 2,
+    eCsrSuppRate_216Mbps = 216 * 2,
+    eCsrSuppRate_240Mbps = 240 * 2
+}eCsrSupportedRates;
+
+typedef enum
+{
+    eCsrPassiveScanNot,     //can be scanned actively on the whole 5GHz band
+    eCsrPassiveScanCat1,    //always passive scan from 5250 to 5350MHz
+    eCsrPassiveScanCat2,    //always passive scan from 5250 to 5350MHz, and from 5470 to 5725MHz
+    eCsrPassiveScanCat3,    //always passive scan from 5250 to 5350MHz, from 5470 to 5725MHz, and from 5500 to 5560MHz
+}eCsrPassiveScanCat;
+
+
+//Please donot insert in the middle of the enum here because they tie to the indiex
+typedef enum
+{
+    eCSR_COUNTRY_INDEX_US = 0,  //Always set US as index 0
+    eCSR_COUNTRY_INDEX_ANDORRA,
+    eCSR_COUNTRY_INDEX_UAE,     //United Arab Emirates
+    eCSR_COUNTRY_INDEX_AFGHANISTAN,
+    eCSR_COUNTRY_INDEX_ANTIGUA_AND_BARBUDA,
+    eCSR_COUNTRY_INDEX_ANGUILLA,
+    eCSR_COUNTRY_INDEX_ALBANIA,
+    eCSR_COUNTRY_INDEX_ARMENIA,
+    eCSR_COUNTRY_INDEX_NETHERLANDS_ANTILLES,
+    eCSR_COUNTRY_INDEX_ANGOLA,
+    eCSR_COUNTRY_INDEX_ANTARCTICA,
+    eCSR_COUNTRY_INDEX_ARGENTINA,
+    eCSR_COUNTRY_INDEX_AMERICAN_SAMOA,
+    eCSR_COUNTRY_INDEX_AUSTRIA,
+    eCSR_COUNTRY_INDEX_AUSTRALIA,
+    eCSR_COUNTRY_INDEX_ARUBA,
+    eCSR_COUNTRY_INDEX_ALAND_ISLANDS,
+    eCSR_COUNTRY_INDEX_AZERBAIJAN,
+    eCSR_COUNTRY_INDEX_BOSNIA_AND_HERZEGOVINA,
+    eCSR_COUNTRY_INDEX_BARBADOS,
+    eCSR_COUNTRY_INDEX_BANGLADESH,
+    eCSR_COUNTRY_INDEX_BELGIUM,
+    eCSR_COUNTRY_INDEX_BURKINA_FASO,
+    eCSR_COUNTRY_INDEX_BULGARIA,
+    eCSR_COUNTRY_INDEX_BAHRAIN,
+    eCSR_COUNTRY_INDEX_BURUNDI,
+    eCSR_COUNTRY_INDEX_BENIN,
+    eCSR_COUNTRY_INDEX_SAINT_BARTHELEMY,
+    eCSR_COUNTRY_INDEX_BERMUDA,
+    eCSR_COUNTRY_INDEX_BRUNEI_DARUSSALAM,
+    eCSR_COUNTRY_INDEX_BOLVIA,
+    eCSR_COUNTRY_INDEX_BRAZIL,
+    eCSR_COUNTRY_INDEX_BAHAMAS,
+    eCSR_COUNTRY_INDEX_BHUTAN,
+    eCSR_COUNTRY_INDEX_BOUVET_ISLAND,
+    eCSR_COUNTRY_INDEX_BOTSWANA,
+    eCSR_COUNTRY_INDEX_BELARUS,
+    eCSR_COUNTRY_INDEX_BELIZE,
+    eCSR_COUNTRY_INDEX_CANADA,      
+    eCSR_COUNTRY_INDEX_COCOS_KEELING_ISLANDS,
+    eCSR_COUNTRY_INDEX_CONGO_REP,
+    eCSR_COUNTRY_INDEX_CENTRAL_AFRICAN,
+    eCSR_COUNTRY_INDEX_CONGO,
+    eCSR_COUNTRY_INDEX_SWITZERLAND,
+    eCSR_COUNTRY_INDEX_COTE_DIVOIRE,
+    eCSR_COUNTRY_INDEX_COOK_ISLANDS,
+    eCSR_COUNTRY_INDEX_CHILE,
+    eCSR_COUNTRY_INDEX_CAMEROON,
+    eCSR_COUNTRY_INDEX_CHINA,
+    eCSR_COUNTRY_INDEX_COLUMBIA,
+    eCSR_COUNTRY_INDEX_COSTA_RICA,
+    eCSR_COUNTRY_INDEX_CUBA,
+    eCSR_COUNTRY_INDEX_CAPE_VERDE,
+    eCSR_COUNTRY_INDEX_CHRISTMAS_ISLAND,
+    eCSR_COUNTRY_INDEX_CYPRUS,
+    eCSR_COUNTRY_INDEX_CZECH,
+    eCSR_COUNTRY_INDEX_GERMANY,
+    eCSR_COUNTRY_INDEX_DJIBOUTI,
+    eCSR_COUNTRY_INDEX_DENMARK,
+    eCSR_COUNTRY_INDEX_DOMINICA,
+    eCSR_COUNTRY_INDEX_DOMINICAN_REP,
+    eCSR_COUNTRY_INDEX_ALGERIA,
+    eCSR_COUNTRY_INDEX_ECUADOR,
+    eCSR_COUNTRY_INDEX_ESTONIA,
+    eCSR_COUNTRY_INDEX_EGYPT,
+    eCSR_COUNTRY_INDEX_WESTERN_SAHARA,
+    eCSR_COUNTRY_INDEX_ERITREA,
+    eCSR_COUNTRY_INDEX_SPAIN,
+    eCSR_COUNTRY_INDEX_ETHIOPIA,
+    eCSR_COUNTRY_INDEX_FINLAND,
+    eCSR_COUNTRY_INDEX_FIJI,
+    eCSR_COUNTRY_INDEX_FALKLAND_ISLANDS,
+    eCSR_COUNTRY_INDEX_MICRONESIA,
+    eCSR_COUNTRY_INDEX_FAROE_ISLANDS,
+    eCSR_COUNTRY_INDEX_FRANCE,
+    eCSR_COUNTRY_INDEX_GABON,
+    eCSR_COUNTRY_INDEX_UNITED_KINGDOM,
+    eCSR_COUNTRY_INDEX_GRENADA,
+    eCSR_COUNTRY_INDEX_GEORGIA,
+    eCSR_COUNTRY_INDEX_FRENCH_GUIANA,
+    eCSR_COUNTRY_INDEX_GUERNSEY,
+    eCSR_COUNTRY_INDEX_GHANA,
+    eCSR_COUNTRY_INDEX_GIBRALTAR,
+    eCSR_COUNTRY_INDEX_GREENLAND,
+    eCSR_COUNTRY_INDEX_GAMBIA,
+    eCSR_COUNTRY_INDEX_GUINEA,
+    eCSR_COUNTRY_INDEX_GUADELOUPE,
+    eCSR_COUNTRY_INDEX_EQUATORIAL_GUINEA,
+    eCSR_COUNTRY_INDEX_GREECE,
+    eCSR_COUNTRY_INDEX_SOUTH_GEORGIA,
+    eCSR_COUNTRY_INDEX_GUATEMALA,
+    eCSR_COUNTRY_INDEX_GUAM,
+    eCSR_COUNTRY_INDEX_GUINEA_BISSAU,
+    eCSR_COUNTRY_INDEX_GUYANA,
+    eCSR_COUNTRY_INDEX_HONGKONG,
+    eCSR_COUNTRY_INDEX_HEARD_ISLAND,
+    eCSR_COUNTRY_INDEX_HONDURAS,
+    eCSR_COUNTRY_INDEX_CROATIA,
+    eCSR_COUNTRY_INDEX_HAITI,
+    eCSR_COUNTRY_INDEX_HUNGARY,
+    eCSR_COUNTRY_INDEX_INDONESIA,
+    eCSR_COUNTRY_INDEX_IRELAND,
+    eCSR_COUNTRY_INDEX_ISRAEL,
+    eCSR_COUNTRY_INDEX_ISLE_OF_MAN,
+    eCSR_COUNTRY_INDEX_INDIA,
+    eCSR_COUNTRY_INDEX_BRITISH_INDIAN,
+    eCSR_COUNTRY_INDEX_IRAQ,
+    eCSR_COUNTRY_INDEX_IRAN,
+    eCSR_COUNTRY_INDEX_ICELAND,
+    eCSR_COUNTRY_INDEX_ITALY,
+    eCSR_COUNTRY_INDEX_JERSEY,
+    eCSR_COUNTRY_INDEX_JAMAICA,
+    eCSR_COUNTRY_INDEX_JORDAN,
+    eCSR_COUNTRY_INDEX_JAPAN,
+    eCSR_COUNTRY_INDEX_KENYA,
+    eCSR_COUNTRY_INDEX_KYRGYZSTAN,
+    eCSR_COUNTRY_INDEX_CAMBODIA,
+    eCSR_COUNTRY_INDEX_KIRIBATI,
+    eCSR_COUNTRY_INDEX_COMOROS,
+    eCSR_COUNTRY_INDEX_SAINT_KITTS_AND_NEVIS,
+    eCSR_COUNTRY_INDEX_KOREA_NORTH,
+    eCSR_COUNTRY_INDEX_KOREA_SOUTH,
+    eCSR_COUNTRY_INDEX_KUWAIT,
+    eCSR_COUNTRY_INDEX_CAYMAN_ISLANDS,
+    eCSR_COUNTRY_INDEX_KAZAKHSTAN,
+    eCSR_COUNTRY_INDEX_LAO,
+    eCSR_COUNTRY_INDEX_LEBANON,
+    eCSR_COUNTRY_INDEX_SAINT_LUCIA,
+    eCSR_COUNTRY_INDEX_LIECHTENSTEIN,
+    eCSR_COUNTRY_INDEX_SRI_LANKA,
+    eCSR_COUNTRY_INDEX_LIBERIA,
+    eCSR_COUNTRY_INDEX_LESOTHO,
+    eCSR_COUNTRY_INDEX_LITHUANIA,
+    eCSR_COUNTRY_INDEX_LUXEMBOURG,
+    eCSR_COUNTRY_INDEX_LATVIA,
+    eCSR_COUNTRY_INDEX_LIBYAN_ARAB_JAMAHIRIYA,
+    eCSR_COUNTRY_INDEX_MOROCCO,
+    eCSR_COUNTRY_INDEX_MONACO,
+    eCSR_COUNTRY_INDEX_MOLDOVA,
+    eCSR_COUNTRY_INDEX_MONTENEGRO,
+    eCSR_COUNTRY_INDEX_MADAGASCAR,
+    eCSR_COUNTRY_INDEX_MARSHALL_ISLANDS,
+    eCSR_COUNTRY_INDEX_MACEDONIA,
+    eCSR_COUNTRY_INDEX_MALI,
+    eCSR_COUNTRY_INDEX_MYANMAR,
+    eCSR_COUNTRY_INDEX_MONGOLIA,
+    eCSR_COUNTRY_INDEX_MACAO,
+    eCSR_COUNTRY_INDEX_NORTHERN_MARIANA_ISLANDS,
+    eCSR_COUNTRY_INDEX_MARTINIQUE,
+    eCSR_COUNTRY_INDEX_MAURITANIA,
+    eCSR_COUNTRY_INDEX_MONTSERRAT,
+    eCSR_COUNTRY_INDEX_MALTA,
+    eCSR_COUNTRY_INDEX_MAURITIUS,
+    eCSR_COUNTRY_INDEX_MALDIVES,
+    eCSR_COUNTRY_INDEX_MALAWI,
+    eCSR_COUNTRY_INDEX_MEXICO,
+    eCSR_COUNTRY_INDEX_MALAYSIA,
+    eCSR_COUNTRY_INDEX_MOZAMBIQUE,
+    eCSR_COUNTRY_INDEX_NAMIBIA,
+    eCSR_COUNTRY_INDEX_NEW_CALENDONIA,
+    eCSR_COUNTRY_INDEX_NIGER,
+    eCSR_COUNTRY_INDEX_NORFOLK_ISLAND,
+    eCSR_COUNTRY_INDEX_NIGERIA,
+    eCSR_COUNTRY_INDEX_NICARAGUA,
+    eCSR_COUNTRY_INDEX_NETHERLANDS,
+    eCSR_COUNTRY_INDEX_NORWAY,
+    eCSR_COUNTRY_INDEX_NEPAL,
+    eCSR_COUNTRY_INDEX_NAURU,
+    eCSR_COUNTRY_INDEX_NIUE,
+    eCSR_COUNTRY_INDEX_NEW_ZEALAND,
+    eCSR_COUNTRY_INDEX_OMAN,
+    eCSR_COUNTRY_INDEX_PANAMA,
+    eCSR_COUNTRY_INDEX_PERU,
+    eCSR_COUNTRY_INDEX_FRENCH_POLYNESIA,
+    eCSR_COUNTRY_INDEX_PAPUA_NEW_HUINEA,
+    eCSR_COUNTRY_INDEX_PHILIPPINES,
+    eCSR_COUNTRY_INDEX_PAKISTAN,
+    eCSR_COUNTRY_INDEX_POLAND,
+    eCSR_COUNTRY_INDEX_SAINT_PIERRE_AND_MIQUELON,
+    eCSR_COUNTRY_INDEX_PITCAIRN,
+    eCSR_COUNTRY_INDEX_PUERTO_RICO,
+    eCSR_COUNTRY_INDEX_PALESTINIAN_TERRITOTY_OCCUPIED,
+    eCSR_COUNTRY_INDEX_PORTUGAL,
+    eCSR_COUNTRY_INDEX_PALAU,
+    eCSR_COUNTRY_INDEX_PARAGUAY,
+    eCSR_COUNTRY_INDEX_QATAR,
+    eCSR_COUNTRY_INDEX_REUNION,
+    eCSR_COUNTRY_INDEX_ROMANIA,
+    eCSR_COUNTRY_INDEX_SERBIA,
+    eCSR_COUNTRY_INDEX_RUSSIAN,
+    eCSR_COUNTRY_INDEX_RWANDA,
+    eCSR_COUNTRY_INDEX_SAUDI_ARABIA,
+    eCSR_COUNTRY_INDEX_SOLOMON_ISLANDS,
+    eCSR_COUNTRY_INDEX_SEYCHELLES,
+    eCSR_COUNTRY_INDEX_SUDAN,
+    eCSR_COUNTRY_INDEX_SWEDEN,
+    eCSR_COUNTRY_INDEX_SINGAPORE,
+    eCSR_COUNTRY_INDEX_SAINT_HELENA,
+    eCSR_COUNTRY_INDEX_SLOVENIA,
+    eCSR_COUNTRY_INDEX_SVALBARD_AND_JAN_MAYEN,
+    eCSR_COUNTRY_INDEX_SLOVAKIA,
+    eCSR_COUNTRY_INDEX_SIERRA_LEONE,
+    eCSR_COUNTRY_INDEX_SAN_MARINO,
+    eCSR_COUNTRY_INDEX_SENEGAL,
+    eCSR_COUNTRY_INDEX_SOMOLIA,
+    eCSR_COUNTRY_INDEX_SURINAME,
+    eCSR_COUNTRY_INDEX_SAO_TOME_AND_PRINCIPE,
+    eCSR_COUNTRY_INDEX_EL_SALVADOR,
+    eCSR_COUNTRY_INDEX_SYRIAN_REP,
+    eCSR_COUNTRY_INDEX_SWAZILAND,
+    eCSR_COUNTRY_INDEX_TURKS_AND_CAICOS_ISLANDS,
+    eCSR_COUNTRY_INDEX_CHAD,
+    eCSR_COUNTRY_INDEX_FRENCH_SOUTHERN_TERRRTORY,
+    eCSR_COUNTRY_INDEX_TOGO,
+    eCSR_COUNTRY_INDEX_THAILAND,
+    eCSR_COUNTRY_INDEX_TAJIKSTAN,
+    eCSR_COUNTRY_INDEX_TOKELAU,
+    eCSR_COUNTRY_INDEX_TIMOR_LESTE,
+    eCSR_COUNTRY_INDEX_TURKMENISTAN,
+    eCSR_COUNTRY_INDEX_TUNISIA,
+    eCSR_COUNTRY_INDEX_TONGA,
+    eCSR_COUNTRY_INDEX_TURKEY,
+    eCSR_COUNTRY_INDEX_TRINIDAD_AND_TOBAGO,
+    eCSR_COUNTRY_INDEX_TUVALU,
+    eCSR_COUNTRY_INDEX_TAIWAN,
+    eCSR_COUNTRY_INDEX_TANZANIA,
+    eCSR_COUNTRY_INDEX_UKRAINE,
+    eCSR_COUNTRY_INDEX_UGANDA,
+    eCSR_COUNTRY_INDEX_US_MINOR_OUTLYING_ISLANDS,
+    eCSR_COUNTRY_INDEX_URUGUAY,
+    eCSR_COUNTRY_INDEX_UZBEKISTAN,
+    eCSR_COUNTRY_INDEX_HOLY_SEE,
+    eCSR_COUNTRY_INDEX_SAINT_VINCENT_AND_THE_GRENADINES,
+    eCSR_COUNTRY_INDEX_VENESUELA,
+    eCSR_COUNTRY_INDEX_VIRGIN_ISLANDS_BRITISH,
+    eCSR_COUNTRY_INDEX_VIRGIN_ISLANDS_US,
+    eCSR_COUNTRY_INDEX_VIET_NAM,
+    eCSR_COUNTRY_INDEX_VANUATU,
+    eCSR_COUNTRY_INDEX_WALLIS_AND_FUTUNA,
+    eCSR_COUNTRY_INDEX_SAMOA,
+    eCSR_COUNTRY_INDEX_YEMEN,
+    eCSR_COUNTRY_INDEX_MAYOTTE,
+    eCSR_COUNTRY_INDEX_SOTHER_AFRICA,
+    eCSR_COUNTRY_INDEX_ZAMBIA,
+    eCSR_COUNTRY_INDEX_ZIMBABWE,
+
+    eCSR_COUNTRY_INDEX_KOREA_1,
+    eCSR_COUNTRY_INDEX_KOREA_2,
+    eCSR_COUNTRY_INDEX_KOREA_3,
+    eCSR_COUNTRY_INDEX_KOREA_4,
+
+    eCSR_NUM_COUNTRY_INDEX,     
+}eCsrCountryIndex;
+//Please donot insert in the middle of the enum above because they tie to the indiex
+
+
+typedef struct tagCsrSirMBMsgHdr 
+{
+    tANI_U16 type;
+    tANI_U16 msgLen;
+
+}tCsrSirMBMsgHdr;
+
+typedef struct tagCsrCfgMsgTlvHdr 
+{
+    tANI_U32 type;
+    tANI_U32 length;    
+
+}tCsrCfgMsgTlvHdr;
+
+
+
+typedef struct tagCsrCfgMsgTlv
+{
+    tCsrCfgMsgTlvHdr Hdr;
+    tANI_U32 variable[ 1 ];    // placeholder for the data
+    
+}tCsrCfgMsgTlv;
+
+typedef struct tagCsrCfgGetRsp 
+{
+  tCsrSirMBMsgHdr hdr;
+  tANI_U32    respStatus;
+  tANI_U32    paramId;
+  tANI_U32    attribLen;
+  tANI_U32    attribVal[1];
+}tCsrCfgGetRsp;
+
+typedef struct tagCsrCfgSetRsp 
+{
+  
+  tCsrSirMBMsgHdr hdr;
+  tANI_U32    respStatus;
+  tANI_U32    paramId;
+}tCsrCfgSetRsp;
+
+
+typedef struct tagCsrDomainChnScanInfo
+{
+    tANI_U8 chnId;
+    tSirScanType scanType;  //whether this channel must be scan passively
+}tCsrDomainChnScanInfo;
+
+
+#if defined(__ANI_COMPILER_PRAGMA_PACK_STACK)
+#pragma pack( push )
+#pragma pack( 1 )
+#elif defined(__ANI_COMPILER_PRAGMA_PACK)
+#pragma pack( 1 )
+#endif
+
+// Generic Information Element Structure
+typedef __ani_attr_pre_packed struct sDot11IEHeader 
+{
+    tANI_U8 ElementID;
+    tANI_U8 Length;
+}__ani_attr_packed tDot11IEHeader;
+
+typedef __ani_attr_pre_packed struct tagCsrWmeInfoIe
+{
+    tDot11IEHeader IeHeader;
+    tANI_U8    Oui[ CSR_WME_OUI_SIZE ];  // includes the 3 byte OUI + 1 byte Type
+    tANI_U8    Subtype;
+    tANI_U8    Version;
+    tANI_U8    QoSInfo;
+    
+} __ani_attr_packed tCsrWmeInfoIe;
+
+typedef __ani_attr_pre_packed struct tagCsrWmeAcParms
+{
+    tANI_U8  AciAifsn;
+    tANI_U8  EcwMinEcwMax;
+    tANI_U16 TxOpLimit;
+    
+} __ani_attr_packed tCsrWmeAcParms;
+
+typedef __ani_attr_pre_packed struct tagCsrWmeParmIe
+{
+    tDot11IEHeader IeHeader;
+    tANI_U8    Oui[ CSR_WME_OUI_SIZE ];  // includes the 3 byte OUI + 1 byte Type
+    tANI_U8    Subtype;
+    tANI_U8    Version;
+    tANI_U8    QoSInfo;
+    tANI_U8    Reserved;
+    tCsrWmeAcParms   BestEffort;
+    tCsrWmeAcParms   Background;
+    tCsrWmeAcParms   Video;
+    tCsrWmeAcParms   Voice;
+        
+} __ani_attr_packed tCsrWmeParmIe;
+
+typedef __ani_attr_pre_packed struct tagCsrWpaIe 
+{
+    tDot11IEHeader IeHeader;
+    tANI_U8    Oui[ CSR_WPA_OUI_SIZE ];
+    tANI_U16   Version;
+    tANI_U8    MulticastOui[ CSR_WPA_OUI_SIZE ];
+    tANI_U16   cUnicastCyphers;
+    
+    __ani_attr_pre_packed struct {
+    
+        tANI_U8 Oui[ CSR_WPA_OUI_SIZE ];
+        
+    } __ani_attr_packed UnicastOui[ 1 ];
+    
+} __ani_attr_packed tCsrWpaIe;
+
+typedef __ani_attr_pre_packed struct tagCsrWpaAuthIe 
+{
+
+    tANI_U16 cAuthenticationSuites;
+    
+    __ani_attr_pre_packed struct {
+    
+        tANI_U8 Oui[ CSR_WPA_OUI_SIZE ];
+    
+    } __ani_attr_packed AuthOui[ 1 ];
+
+} __ani_attr_packed tCsrWpaAuthIe;
+
+
+typedef __ani_attr_pre_packed struct tagCsrRSNIe 
+{
+    tDot11IEHeader IeHeader;
+    tANI_U16   Version;
+    tANI_U8    MulticastOui[ CSR_RSN_OUI_SIZE ];
+    tANI_U16   cUnicastCyphers;
+    
+    __ani_attr_pre_packed struct {
+    
+        tANI_U8 Oui[ CSR_RSN_OUI_SIZE ];
+        
+    } __ani_attr_packed UnicastOui[ 1 ];
+    
+} __ani_attr_packed tCsrRSNIe;
+
+typedef __ani_attr_pre_packed struct tagCsrRSNAuthIe 
+{
+    tANI_U16 cAuthenticationSuites;
+    __ani_attr_pre_packed struct {
+    
+        tANI_U8 Oui[ CSR_RSN_OUI_SIZE ];
+    
+    } __ani_attr_packed AuthOui[ 1 ];
+
+} __ani_attr_packed tCsrRSNAuthIe;
+
+typedef __ani_attr_pre_packed struct tagCsrRSNCapabilities 
+{
+    tANI_U16 PreAuthSupported:1;
+    tANI_U16 NoPairwise:1;
+    tANI_U16 PTKSAReplayCounter:2;
+    tANI_U16 GTKSAReplayCounter:2;
+    tANI_U16 Reserved:10;
+} __ani_attr_packed tCsrRSNCapabilities;
+
+typedef __ani_attr_pre_packed struct tagCsrRSNPMKIe 
+{
+    tANI_U16 cPMKIDs;
+    
+    __ani_attr_pre_packed struct {
+    
+        tANI_U8 PMKID[ CSR_RSN_PMKID_SIZE ];
+    
+    } __ani_attr_packed PMKIDList[ 1 ];
+
+
+} __ani_attr_packed tCsrRSNPMKIe;
+
+typedef __ani_attr_pre_packed struct tCsrIELenInfo
+{
+    tANI_U8 min;
+    tANI_U8 max;
+} __ani_attr_packed tCsrIELenInfo;
+
+#ifdef FEATURE_WLAN_WAPI
+typedef __ani_attr_pre_packed struct tagCsrWapiIe 
+{
+    tDot11IEHeader IeHeader;
+    tANI_U16   Version;
+
+    tANI_U16 cAuthenticationSuites;
+    __ani_attr_pre_packed struct {
+
+        tANI_U8 Oui[ CSR_WAPI_OUI_SIZE ];
+
+    } __ani_attr_packed AuthOui[ 1 ];
+
+    tANI_U16   cUnicastCyphers;
+    __ani_attr_pre_packed struct {
+
+        tANI_U8 Oui[ CSR_WAPI_OUI_SIZE ];
+
+    } __ani_attr_packed UnicastOui[ 1 ];
+
+    tANI_U8    MulticastOui[ CSR_WAPI_OUI_SIZE ];    
+
+    __ani_attr_pre_packed struct {
+       tANI_U16 PreAuthSupported:1;
+       tANI_U16 Reserved:15;
+    } __ani_attr_packed tCsrWapiCapabilities;
+
+
+} __ani_attr_packed tCsrWapiIe;
+
+typedef __ani_attr_pre_packed struct tagCsrWAPIBKIe 
+{
+    tANI_U16 cBKIDs;
+    __ani_attr_pre_packed struct {
+
+        tANI_U8 BKID[ CSR_WAPI_BKID_SIZE ];
+
+    } __ani_attr_packed BKIDList[ 1 ];
+
+
+} __ani_attr_packed tCsrWAPIBKIe;
+#endif /* FEATURE_WLAN_WAPI */
+
+#if defined(__ANI_COMPILER_PRAGMA_PACK_STACK)
+#pragma pack( pop )
+#endif
+
+// Structure used to describe a group of continuous channels and hook it into the 
+// corresponding channel list
+typedef struct tagCsrChannelSet 
+{
+  tListElem      channelListLink;
+  tANI_U8   firstChannel;
+  tANI_U8   interChannelOffset;
+  tANI_U8   numChannels;
+  tANI_U8   txPower;
+}tCsrChannelSet;
+
+
+typedef struct sDot11InfoIBSSParmSet 
+{
+    tDot11IEHeader dot11IEHeader;
+    tANI_U8 ATIMWindow;
+}tDot11InfoIBSSParmSet;
+
+
+typedef struct sDot11IECountry 
+{
+    tDot11IEHeader dot11IEHeader;
+    tANI_U8 countryString[3];
+    tSirMacChanInfo chanInfo[1];
+}tDot11IECountry;
+
+
+typedef struct sDot11IEExtenedSupportedRates 
+{
+    tDot11IEHeader dot11IEHeader;
+    tANI_U8 ExtendedSupportedRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ];
+}tDot11IEExtenedSupportedRates;
+
+#define CSR_DOT11_AP_NAME_MAX_LENGTH ( 32 )
+
+typedef struct tagDot11IEAPName
+{
+    tDot11IEHeader dot11IEHeader;
+    tANI_U8 ApName[ CSR_DOT11_AP_NAME_MAX_LENGTH ];
+}tDot11IEAPName;
+
+typedef struct tagDot11IE11HLocalPowerConstraint
+{
+    tDot11IEHeader dot11IEHeader;
+    tANI_U8 localPowerConstraint;
+
+}tDot11IE11HLocalPowerConstraint;
+
+typedef struct tagRoamingTimerInfo
+{
+    tpAniSirGlobal pMac;
+    tANI_U8 sessionId;
+} tCsrTimerInfo;
+
+
+#define CSR_IS_11A_BSS(pBssDesc)    ( eSIR_11A_NW_TYPE == (pBssDesc)->nwType )
+#define CSR_IS_BASIC_RATE(rate)     ((rate) & CSR_DOT11_BASIC_RATE_MASK)
+#define CSR_IS_QOS_BSS(pIes)  ( (pIes)->WMMParams.present || (pIes)->WMMInfoAp.present )
+
+#define CSR_IS_UAPSD_BSS(pIes) \
+    ( ((pIes)->WMMParams.present && ((pIes)->WMMParams.qosInfo & SME_QOS_AP_SUPPORTS_APSD)) || \
+               ((pIes)->WMMInfoAp.present && (pIes)->WMMInfoAp.uapsd) )
+
+//This macro returns the total length needed of Tlv with with len bytes of data
+#define GET_TLV_MSG_LEN(len)    GET_ROUND_UP((sizeof(tCsrCfgMsgTlvHdr) + (len)), sizeof(tANI_U32))
+
+tANI_BOOLEAN csrGetBssIdBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tCsrBssid *pBssId ); 
+tANI_BOOLEAN csrIsBssIdEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 );
+
+eCsrMediaAccessType csrGetQoSFromBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc,
+                                          tDot11fBeaconIEs *pIes);
+tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len );
+tANI_BOOLEAN csrIsInfraBssDesc( tSirBssDescription *pSirBssDesc ); 
+tANI_BOOLEAN csrIsIbssBssDesc( tSirBssDescription *pSirBssDesc ); 
+tANI_BOOLEAN csrIsPrivacy( tSirBssDescription *pSirBssDesc );
+tSirResultCodes csrGetDisassocRspStatusCode( tSirSmeDisassocRsp *pSmeDisassocRsp );
+tSirResultCodes csrGetDeAuthRspStatusCode( tSirSmeDeauthRsp *pSmeRsp );
+tANI_U32 csrGetFragThresh( tHalHandle hHal );
+tANI_U32 csrGetRTSThresh( tHalHandle hHal );
+eCsrPhyMode csrGetPhyModeFromBssDesc( tSirBssDescription *pSirBssDesc );
+tANI_U32 csrGet11hPowerConstraint( tHalHandle hHal, tDot11fIEPowerConstraints *pPowerConstraint );
+tANI_U8 csrConstructRSNIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                            tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe );
+tANI_U8 csrConstructWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                           tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe );
+#ifdef FEATURE_WLAN_WAPI
+
+tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile );
+#endif /* FEATURE_WLAN_WAPI */
+//If a WPAIE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
+tANI_U8 csrRetrieveWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                          tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe );
+tANI_BOOLEAN csrIsSsidEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, 
+                             tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 );
+//Null ssid means match
+tANI_BOOLEAN csrIsSsidInList( tHalHandle hHal, tSirMacSSid *pSsid, tCsrSSIDs *pSsidList );
+tANI_BOOLEAN csrIsProfileWpa( tCsrRoamProfile *pProfile );
+tANI_BOOLEAN csrIsProfileRSN( tCsrRoamProfile *pProfile );
+//This function returns the raw byte array of WPA and/or RSN IE
+tANI_BOOLEAN csrGetWpaRsnIe( tHalHandle hHal, tANI_U8 *pIes, tANI_U32 len,
+                             tANI_U8 *pWpaIe, tANI_U8 *pcbWpaIe, tANI_U8 *pRSNIe, tANI_U8 *pcbRSNIe);
+//If a RSNIE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
+tANI_U8 csrRetrieveRsnIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                          tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe );
+#ifdef FEATURE_WLAN_WAPI
+//If a WAPI IE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWapiIe and guarrantee it can contain a max length WAPI IE
+tANI_U8 csrRetrieveWapiIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                          tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe );
+#endif /* FEATURE_WLAN_WAPI */
+tANI_BOOLEAN csrSearchChannelListForTxPower(tHalHandle hHal, tSirBssDescription *pBssDescription, tCsrChannelSet *returnChannelGroup);
+tANI_BOOLEAN csrRatesIsDot11Rate11bSupportedRate( tANI_U8 dot11Rate );
+tANI_BOOLEAN csrRatesIsDot11Rate11aSupportedRate( tANI_U8 dot11Rate );
+tAniEdType csrTranslateEncryptTypeToEdType( eCsrEncryptionType EncryptType ); 
+//pIes shall contain IEs from pSirBssDesc. It shall be returned from function csrGetParsedBssDescriptionIEs 
+tANI_BOOLEAN csrIsSecurityMatch( tHalHandle hHal, tCsrAuthList *authType, tCsrEncryptionList *pUCEncryptionType, tCsrEncryptionList *pMCEncryptionType,
+                                 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, 
+                                 eCsrAuthType *negotiatedAuthtype, eCsrEncryptionType *negotiatedUCCipher, eCsrEncryptionType *negotiatedMCCipher );
+tANI_BOOLEAN csrIsBSSTypeMatch(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2);
+tANI_BOOLEAN csrIsBssTypeIBSS(eCsrRoamBssType bssType);
+tANI_BOOLEAN csrIsBssTypeWDS(eCsrRoamBssType bssType);
+//ppIes can be NULL. If caller want to get the *ppIes allocated by this function, pass in *ppIes = NULL
+//Caller needs to free the memory in this case
+tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrScanResultFilter *pFilter, 
+                          eCsrAuthType *pNegAuth, eCsrEncryptionType *pNegUc, eCsrEncryptionType *pNegMc,
+                          tDot11fBeaconIEs **ppIes);
+
+tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid );
+tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile,
+                                          tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes );
+tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate );
+tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates );
+tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype);
+                            
+//Caller allocates memory for pIEStruct
+eHalStatus csrParseBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIEStruct);
+//This function will allocate memory for the parsed IEs to the caller. Caller must free the memory
+//after it is done with the data only if this function succeeds
+eHalStatus csrGetParsedBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs **ppIEStruct);
+
+tANI_BOOLEAN csrValidateCountryString( tHalHandle hHal, tANI_U8 *pCountryString );
+tSirScanType csrGetScanType(tpAniSirGlobal pMac, tANI_U8 chnId);
+
+tANI_U8 csrToUpper( tANI_U8 ch );
+eHalStatus csrGetPhyModeFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription, 
+                                eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes);
+
+//fForce -- force reassoc regardless of whether there is any change
+//The reason is that for UAPSD-bypass, the code underneath this call determine whether
+//to allow UAPSD. The information in pModProfileFields reflects what the user wants.
+//There may be discrepency in it. UAPSD-bypass logic should decide if it needs to reassoc
+eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                      tCsrRoamModifyProfileFields *pModProfileFields,
+                      tANI_U32 *pRoamId, v_BOOL_t fForce);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile );
+tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType );
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+tANI_BOOLEAN csrIsAuthTypeCCX( eCsrAuthType AuthType );
+tANI_BOOLEAN csrIsProfileCCX( tCsrRoamProfile *pProfile );
+#endif
+
+#endif
+
diff --git a/CORE/SME/inc/measApi.h b/CORE/SME/inc/measApi.h
new file mode 100644
index 0000000..1e9b029
--- /dev/null
+++ b/CORE/SME/inc/measApi.h
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
diff --git a/CORE/SME/inc/measInternal.h b/CORE/SME/inc/measInternal.h
new file mode 100644
index 0000000..1e9b029
--- /dev/null
+++ b/CORE/SME/inc/measInternal.h
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
diff --git a/CORE/SME/inc/p2p_Api.h b/CORE/SME/inc/p2p_Api.h
new file mode 100644
index 0000000..13276de
--- /dev/null
+++ b/CORE/SME/inc/p2p_Api.h
@@ -0,0 +1,527 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  p2p_Api.h
+*
+* Description: P2P FSM defines.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+
+#ifndef __P2P_API_H__
+#define __P2P_API_H__
+
+#include "vos_types.h"
+#include "halTypes.h"
+#include "palTimer.h"
+#include "vos_lock.h"
+
+typedef struct sP2pPsConfig{
+  tANI_U8   opp_ps;
+  tANI_U32  ctWindow;
+  tANI_U8   count; 
+  tANI_U32  duration;
+  tANI_U32  interval;
+  tANI_U32  single_noa_duration;
+  tANI_U8   psSelection;
+  tANI_U8   sessionid;   
+}tP2pPsConfig,*tpP2pPsConfig;
+
+typedef eHalStatus (*remainOnChanCallback)( tHalHandle, void* context, 
+                                            eHalStatus status );
+
+typedef struct sRemainOnChn{
+    tANI_U8 chn;
+    tANI_U32 duration;
+    remainOnChanCallback callback;
+  void *pCBContext;
+}tRemainOnChn, tpRemainOnChn;
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+
+#define MAX_SOCIAL_CHANNELS 3
+#define P2P_OPERATING_CHANNEL 6
+#define P2P_MAX_GROUP_LIMIT 5
+#define P2P_MAC_ADDRESS_LEN 6
+#define MAX_LISTEN_SEARCH_CYCLE 3
+#define P2P_LISTEN_TIMEOUT_AUTO    500 //0.5 sec
+#define P2P_LISTEN_TIMEOUT_HIGH    200 //0.4 sec
+#define P2P_LISTEN_TIMEOUT         1000  //1 sec
+#define P2P_REMAIN_ON_CHAN_TIMEOUT 300
+#define P2P_REMAIN_ON_CHAN_TIMEOUT_HIGH 1000
+#define P2P_REMAIN_ON_CHAN_TIMEOUT_LOW 100
+#define ACTION_FRAME_RETRY_TIMEOUT 50
+#define P2P_COUNTRY_CODE_LEN 3
+
+#define P2P_CLEAR_POWERSAVE 0
+#define P2P_OPPORTUNISTIC_PS 1
+#define P2P_PERIODIC_NOA 2
+#define P2P_SINGLE_NOA 4
+
+
+/* Wi-Fi Direct Device Discovery Type */
+typedef enum ep2pDiscoverType {
+   /** Driver must perform device discovery only using the scan phase*/
+   WFD_DISCOVER_TYPE_SCAN_ONLY = 1,
+   /** Driver must perform device discovery only using the find phase*/
+   WFD_DISCOVER_TYPE_FIND_ONLY = 2,
+   /** Driver can use either use scan phase or find phase to discovery 
+   P2P devices. In our case Driver uses scan phase */
+   WFD_DISCOVER_TYPE_AUTO = 3,
+   /*Scan only social channel*/
+   WFD_DISCOVER_SCAN_ONLY_SOCIAL_CHN,
+   /** If it is set, driver must perform a complete discovery, 
+   If it is false, it can do partial discovery.*/
+   WFD_DISCOVER_TYPE_FORCED = 0x80000000
+} ep2pDiscoverType, *ePp2pDiscoverType;
+
+//bit mask for what to discover
+#define QCWLAN_P2P_DISCOVER_DEVICE     0x1
+#define QCWLAN_P2P_DISCOVER_GO         0x2
+#define QCWLAN_P2P_DISCOVER_ANY        0x8
+
+#define P2P_DISCOVER_SCAN_ONLY(t) ( (WFD_DISCOVER_TYPE_SCAN_ONLY == (t)) \
+                                    || (WFD_DISCOVER_SCAN_ONLY_SOCIAL_CHN == (t)) )
+
+/* Scan Type */
+typedef enum ep2pScanType {
+   P2P_SCAN_TYPE_ACTIVE = 1,  /**  device should perform active scans for the scan phase of device discovery */
+   P2P_SCAN_TYPE_PASSIVE = 2, /** device should perform passive scanning for the scan phase of device discovery  */
+   P2P_SCAN_TYPE_AUTO = 3     /** The selection of the scan type is upto the driver */
+} ep2pScanType, * ePp2pScanType;
+
+/** Listen State Discoverability */
+typedef enum ep2pListenStateDiscoverability {
+   P2P_DEVICE_NOT_DISCOVERABLE, /**  Wi-Fi Direct Device Port must not make itself discoverable */
+   P2P_DEVICE_AUTO_AVAILABILITY, /** Wi-Fi Direct Device Port must periodically put itself in the listen state to become discoverable*/
+   P2P_DEVICE_HIGH_AVAILABILITY  /** Wi-Fi Direct Device Port must be frequently put itself in the listen state 
+                                 to increase the speed and reliability of remote devices discovering it */
+} ep2pListenStateDiscoverability, * ePp2pListenStateDiscoverability;
+
+typedef enum ep2pOperatingMode {
+   OPERATION_MODE_INVALID,
+   OPERATION_MODE_P2P_DEVICE,
+   OPERATION_MODE_P2P_GROUP_OWNER,
+   OPERATION_MODE_P2P_CLIENT
+}ep2pOperatingMode;
+
+typedef struct _tp2pDiscoverDeviceFilter{ 
+   tSirMacAddr DeviceID; 
+   v_UCHAR_t ucBitmask; 
+   tSirMacSSid GroupSSID; 
+} tp2pDiscoverDeviceFilter;
+
+typedef struct _tp2pDiscoverRequest {
+   ep2pDiscoverType discoverType;
+   ep2pScanType scanType;
+   tANI_U32 uDiscoverTimeout;
+   tANI_U32 uNumDeviceFilters;
+   tp2pDiscoverDeviceFilter *pDeviceFilters;
+   tANI_BOOLEAN bForceScanLegacyNetworks;
+   tANI_U32 uNumOfLegacySSIDs;
+   tANI_U8  *pLegacySSIDs;
+   tANI_U32 uIELen;
+   tANI_U8 *pIEField;
+} tP2PDiscoverRequest;
+
+typedef enum _eP2PDiscoverStatus {
+   eP2P_DISCOVER_SUCCESS,
+   eP2P_DISCOVER_FAILURE,
+   eP2P_DISCOVER_ABORT,
+   eP2P_DIRECTED_DISCOVER
+} eP2PDiscoverStatus;
+
+typedef eHalStatus (*p2pDiscoverCompleteCallback)(tHalHandle hHal, void *pContext, eP2PDiscoverStatus discoverStatus);
+
+typedef struct sP2PGroupId {
+    tANI_U8 present;
+    tANI_U8 deviceAddress[6];
+    tANI_U8 num_ssid;
+    tANI_U8 ssid[32];
+} tP2PGroupId;
+
+typedef struct sP2PGroupBssid {
+    tANI_U8 present;
+    tANI_U8 P2PGroupBssid[6];
+} tP2PGroupBssid;
+
+typedef struct sP2PChannel {
+   tANI_U8 present;
+   tANI_U8 countryString[P2P_COUNTRY_CODE_LEN];
+   tANI_U8 regulatoryClass;
+   tANI_U8 channel;
+} tP2P_OperatingChannel, tP2P_ListenChannel;
+
+/** Structure contains parameters required for Wi-Fi Direct Device functionality such as device discovery, Group Owner Negotiation */
+typedef enum P2PFrameType {
+   eP2P_INVALID_FRM,
+   eP2P_PROBE_REQ,
+   eP2P_PROBE_RSP,
+   eP2P_GONEGO_REQ,
+   eP2P_GONEGO_RES,
+   eP2P_GONEGO_CNF,
+   eP2P_PROVISION_DISCOVERY_REQUEST,
+   eP2P_PROVISION_DISCOVERY_RESPONSE,
+   eP2P_BEACON,
+   eP2P_GROUP_ID,
+   eP2P_ASSOC_REQ,
+   eP2P_INVITATION_REQ,
+   eP2P_INVITATION_RSP,
+   eP2P_DEVICE_DISCOVERY_REQ,
+   eP2P_DEVICE_DISCOVERY_RSP,
+} eP2PFrameType;
+
+typedef enum P2PRequest {
+   eWFD_DISCOVER_REQUEST,
+   eWFD_DEVICE_ID,
+   eWFD_DEVICE_CAPABILITY,
+   eWFD_GROUP_OWNER_CAPABILITY,
+   eWFD_DEVICE_INFO,
+   eWFD_SECONDARY_DEVICE_TYPE_LIST,
+   eWFD_ADDITIONAL_IE,
+   eWFD_GROUP_ID,
+   eWFD_SEND_GO_NEGOTIATION_REQUEST,
+   eWFD_SEND_GO_NEGOTIATION_RESPONSE,
+   eWFD_SEND_GO_NEGOTIATION_CONFIRMATION,
+   eWFD_SEND_PROVISION_DISCOVERY_REQUEST,
+   eWFD_SEND_PROVISION_DISCOVERY_RESPONSE,
+   eWFD_SEND_INVITATION_REQUEST,
+   eWFD_SEND_INVITATION_RESPONSE,
+   eWFD_OPERATING_CHANNEL,
+   eWFD_LISTEN_CHANNEL
+} eP2PRequest;
+
+typedef struct _p2p_device_capability_config {
+   tANI_BOOLEAN bServiceDiscoveryEnabled;
+   tANI_BOOLEAN bClientDiscoverabilityEnabled;
+   tANI_BOOLEAN bConcurrentOperationSupported;
+   tANI_BOOLEAN bInfrastructureManagementEnabled;
+   tANI_BOOLEAN bDeviceLimitReached;
+   tANI_BOOLEAN bInvitationProcedureEnabled;
+   tANI_U32 WPSVersionsEnabled;
+} tp2p_device_capability_config;
+
+typedef struct _p2p_group_owner_capability_config {
+   tANI_BOOLEAN bPersistentGroupEnabled;
+   tANI_BOOLEAN bIntraBSSDistributionSupported;
+   tANI_BOOLEAN bCrossConnectionSupported;
+   tANI_BOOLEAN bPersistentReconnectSupported;
+   tANI_BOOLEAN bGroupFormationEnabled;
+   tANI_U32 uMaximumGroupLimit;
+} tp2p_group_owner_capability_config;
+
+typedef struct _tP2P_ProvDiscoveryReq {
+   tANI_U8     dialogToken;
+   tANI_U8  PeerDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U32 uSendTimeout;
+   tANI_U8  GroupCapability;
+   tP2PGroupId GroupId;
+   tANI_BOOLEAN bUseGroupID;
+   tANI_U32 uIELength;
+   tANI_U8 *IEdata;
+} tP2P_ProvDiscoveryReq;
+
+typedef struct _tP2P_ProvDiscoveryRes {
+   tANI_U8  dialogToken;
+   tANI_U8  ReceiverDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U32 uSendTimeout;
+   tANI_U32 uIELength;
+   tANI_U8 *IEdata;
+} tP2P_ProvDiscoveryRes;
+
+typedef struct p2p_go_request {
+   tANI_U8     dialogToken;
+   tANI_U8    peerDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U32 uSendTimeout;
+   tANI_U8 GoIntent;
+   tANI_U32 GoTimeout;
+   tANI_U32 ClientTimeout;
+   tANI_U8    IntendedInterfaceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8 GroupCapability;
+   tANI_U32 uIELength;
+   tANI_U8 *IEdata;
+} tP2P_go_request;
+
+typedef struct p2p_go_confirm {
+   tANI_U8    peerDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8    dialog_token;
+   tANI_U32 uSendTimeout;
+   tANI_U8    status;
+   tANI_U8 GroupCapability;
+   tP2PGroupId GroupId;
+   tANI_BOOLEAN bUsedGroupId;
+   tANI_U32 uIELength;
+   tANI_U8 *IEdata;
+} tP2P_go_confirm;
+
+typedef struct p2p_go_response {
+   tANI_U8    peerDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8    dialog_token;
+   tANI_U32 uSendTimeout;
+   tANI_U8    status;
+   tANI_U8 GoIntent;
+   tANI_U32 GoTimeout;
+   tANI_U32 ClientTimeout;
+   tANI_U8    IntendedInterfaceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8 GroupCapability;
+   tP2PGroupId GroupId;
+   tANI_BOOLEAN bUsedGroupId;
+   tANI_U32 uIELength;
+   tANI_U8 *IEdata;
+} tP2P_go_response;
+
+//Invitation Req parameters
+typedef struct p2p_invitation_request {
+    tANI_U8 DialogToken;
+    tANI_U8 PeerDeviceAddress[P2P_MAC_ADDRESS_LEN];
+    tANI_U32 uSendTimeout;
+    tANI_U32 GoTimeout;
+    tANI_U32 ClientTimeout; 
+    tANI_U8 InvitationFlags;
+    tP2PGroupBssid GroupBSSID;
+    tP2P_OperatingChannel OperatingChannel;
+    tP2PGroupId GroupID;
+    tANI_U32 uIELength;
+    tANI_U8 *IEdata;
+} tP2P_invitation_request;
+
+
+//Invitation Response parameters
+typedef struct p2p_invitation_response {
+    tANI_U8 ReceiverDeviceAddress[P2P_MAC_ADDRESS_LEN];
+    tANI_U8 DialogToken;
+    void* RequestContext;
+    tANI_U32 uSendTimeout;
+    tANI_U8     status;
+    tANI_U32 GoTimeout;
+    tANI_U32 ClientTimeout; 
+    tP2PGroupBssid GroupBSSID;
+    tP2P_OperatingChannel OperatingChannel;
+    tANI_U32 uIELength;
+    tANI_U8 *IEdata;
+} tP2P_invitation_response;
+
+typedef enum eOUISubType {
+   eOUI_P2P_GONEGO_REQ,
+   eOUI_P2P_GONEGO_RES,
+   eOUI_P2P_GONEGO_CNF,
+   eOUI_P2P_INVITATION_REQ,
+   eOUI_P2P_INVITATION_RES,
+   eOUI_P2P_DEVICE_DISCOVERABILITY_REQ,
+   eOUI_P2P_DEVICE_DISCOVERABILITY_RES,
+   eOUI_P2P_PROVISION_DISCOVERY_REQ,
+   eOUI_P2P_PROVISION_DISCOVERY_RES,
+   eOUI_P2P_INVALID
+}eOUISubType;
+
+typedef enum _eP2PPort {
+   eP2PPortDevice,
+   eP2PPortGroupOwner,
+   eP2PPortClient
+} eP2PPort;
+
+typedef enum eListenDiscoverableState {
+   eStateDisabled,
+   eStateEnabled,
+
+}eListenDiscoverableState;
+
+typedef enum P2PRemainOnChnReason
+{
+   eP2PRemainOnChnReasonUnknown,
+   eP2PRemainOnChnReasonDiscovery, //Part of the discovery (search and listen)
+   eP2PRemainOnChnReasonSendFrame, //Found peer and before sending request frame
+   eP2PRemainOnChnReasonListen,    //In listen-only mode
+}eP2PRemainOnChnReason;
+
+typedef struct sGroupFormationReq {
+   tCsrBssid deviceAddress;
+   tANI_U8 targetListenChannel;
+   tANI_U8 persistent_group;
+   tANI_U8 group_limit; /* may be internal */
+   tANI_U8 GO_config_timeout;
+   tANI_U8 CL_config_timeout;
+   tANI_U8 GO_intent;
+   tANI_U16 devicePasswdId;
+   tSirMacAddr groupBssid;
+   tSirMacSSid groupSsid;
+}tGroupFormationReq;
+
+typedef struct tP2PConfigParam
+{
+   v_U32_t P2POperatingChannel;
+   v_U32_t P2PListenChannel;
+   v_U32_t P2PPSSelection;
+   v_U32_t P2POpPSCTWindow;
+   v_U32_t P2PNoADuration;
+   v_U32_t P2PNoACount;
+   v_U32_t P2PNoAInterval;
+}tP2PConfigParam;
+
+#endif
+
+typedef struct sp2pContext
+{
+   v_CONTEXT_t vosContext;
+   tHalHandle hHal;
+   tANI_U8 sessionId; //Session id corresponding to P2P. On windows it is same as HDD sessionid not sme sessionid.
+   tANI_U8 SMEsessionId;
+   tANI_U8 probeReqForwarding;
+   tANI_U8 *probeRspIe;
+   tANI_U32 probeRspIeLength;
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+   tANI_U8 numClients;
+   tANI_U32 maxGroupLimit;
+   ep2pOperatingMode operatingmode;
+   tANI_U8 state;
+   tANI_U8 socialChannel[MAX_SOCIAL_CHANNELS];
+   tANI_U8 currentSearchIndex;
+   tANI_U8 listenIndex;
+   tANI_U8 dialogToken;
+   tANI_U8 receivedDialogToken;
+   eOUISubType actionFrameOUI;
+   eP2PFrameType actionFrameType;
+   tANI_BOOLEAN actionFrameTimeout;
+   tANI_U8 *pSentActionFrame;
+   tANI_U32 ActionFrameLen;
+   tANI_U32 ActionFrameSendTimeout;
+   eListenDiscoverableState listenDiscoverableState;
+   tPalTimerHandle listenTimerHandler;
+   tPalTimerHandle WPSRegistrarCheckTimerHandler;
+   tANI_U32 WPSRegistrarSet;
+   tANI_U8 bWaitForWPSReady;
+   tANI_U8 bInGroupFormation;
+   tPalTimerHandle discoverTimer;
+   tPalTimerHandle retryActionFrameTimer;
+   tPalTimerHandle actionFrameTimer;
+   tPalTimerHandle nextActionFrameTimer;
+   tANI_U8 peerMacAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8 selfMacAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8 ReceiverDeviceAddress[P2P_MAC_ADDRESS_LEN];
+   tANI_U8 listen_search_cycle;
+   ep2pDiscoverType discoverType;
+   ep2pScanType scanType;
+   tANI_U32 uDiscoverTimeout;
+   tp2pDiscoverDeviceFilter *directedDiscoveryFilter;
+   tANI_U32 uNumDeviceFilters;
+   //Number of deviceFilter directedDiscoveryFilter holds
+   tANI_U32 uNumDeviceFilterAllocated; 
+   tGroupFormationReq formationReq;
+   tANI_U8 GroupFormationPending;
+   tANI_BOOLEAN PeerFound;
+   tANI_BOOLEAN directedDiscovery;
+   tANI_U32 listenDuration;
+   tANI_U32 expire_time;
+   p2pDiscoverCompleteCallback p2pDiscoverCBFunc;
+   void *pContext;
+   tANI_BOOLEAN bForceScanLegacyNetworks;
+   tANI_U8 *DiscoverReqIeField;
+   tANI_U32 DiscoverReqIeLength;
+   tANI_U8 *GoNegoReqIeField;
+   tANI_U32 GoNegoReqIeLength;
+   tANI_U8 *GoNegoResIeField;
+   tANI_U32 GoNegoResIeLength;
+   tANI_U8 *GoNegoCnfIeField;
+   tANI_U32 GoNegoCnfIeLength;
+   tANI_U8 *ProvDiscReqIeField;
+   tANI_U32 ProvDiscReqIeLength;
+   tANI_U8 *ProvDiscResIeField;
+   tANI_U32 ProvDiscResIeLength;
+   tANI_U8 *InvitationReqIeField;
+   tANI_U32 InvitationReqIeLength;
+   tANI_U8 *InvitationResIeField;
+   tANI_U32 InvitationResIeLength;
+   tANI_U32 DiscoverableCfg;
+   vos_spin_lock_t lState;
+   tANI_U8 *pNextActionFrm;
+   tANI_U32 nNextFrmLen;
+   tANI_U32 nNextFrameTimeOut;
+   eP2PFrameType NextActionFrameType;
+   tANI_U8 ssid[32];
+   v_U32_t P2PListenChannel;
+   v_U32_t P2POperatingChannel;
+   tP2pPsConfig pNoA;
+   tANI_U8 OriginalGroupCapability;
+#endif
+} tp2pContext, *tPp2pContext;
+
+
+eHalStatus sme_RemainOnChannel( tHalHandle hHal, tANI_U8 sessionId,
+                                tANI_U8 channel, tANI_U32 duration,
+                                remainOnChanCallback callback, 
+                                void *pContext );
+eHalStatus sme_ReportProbeReq( tHalHandle hHal, tANI_U8 flag );
+eHalStatus sme_updateP2pIe( tHalHandle hHal, void *p2pIe, 
+                            tANI_U32 p2pIeLength );
+eHalStatus sme_sendAction( tHalHandle hHal, tANI_U8 sessionId,
+                           const tANI_U8 *pBuf, tANI_U32 len );
+eHalStatus sme_CancelRemainOnChannel( tHalHandle hHal, tANI_U8 sessionId );
+eHalStatus sme_p2pOpen( tHalHandle hHal );
+eHalStatus p2pStop( tHalHandle hHal );
+eHalStatus sme_p2pClose( tHalHandle hHal );
+eHalStatus sme_p2pSetPs( tHalHandle hHal, tP2pPsConfig * data );
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+eHalStatus p2pRemainOnChannel( tHalHandle hHal, tANI_U8 sessionId,
+                               tANI_U8 channel, tANI_U32 duration,
+                               remainOnChanCallback callback, void *pContext,
+                               eP2PRemainOnChnReason reason);
+#else
+eHalStatus p2pRemainOnChannel( tHalHandle hHal, tANI_U8 sessionId,
+                               tANI_U8 channel, tANI_U32 duration,
+                               remainOnChanCallback callback, void *pContext);
+#endif
+eHalStatus p2pSendAction( tHalHandle hHal, tANI_U8 sessionId,
+                          const tANI_U8 *pBuf, tANI_U32 len );
+eHalStatus p2pCancelRemainOnChannel( tHalHandle hHal, tANI_U8 sessionId );
+eHalStatus p2pSetPs( tHalHandle hHal, tP2pPsConfig *pNoA );
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+eHalStatus p2pRemainOnChannelCallback(tHalHandle halHandle, void *pContext, eHalStatus scan_status);
+eHalStatus P2P_DiscoverRequest(tHalHandle hHal, tANI_U8 SessionID, tP2PDiscoverRequest *pDiscoverRequest, 
+                               p2pDiscoverCompleteCallback callback, void *pContext);
+tANI_U8 p2pGetDialogToken(tHalHandle hHal, tANI_U8 SessionID, eP2PFrameType actionFrameType);
+eHalStatus P2P_ListenStateDiscoverable(tHalHandle hHal, tANI_U8 sessionId, ep2pListenStateDiscoverability listenState);
+eHalStatus p2pCreateSendActionFrame(tHalHandle hHal, tANI_U8 SessionID, 
+      void *p2pactionframe, eP2PFrameType actionFrameType, tANI_U32 timeout);
+eHalStatus p2pScanRequest(tp2pContext *p2pContext, p2pDiscoverCompleteCallback callback, void *pContext);
+void p2pActionFrameTimerHandler(void *pContext);
+void p2pListenDiscoverTimerHandler(void *pContext);
+void p2pDiscoverTimerHandler(void *pContext);
+void p2pRetryActionFrameTimerHandler(void *pContext);
+eHalStatus p2pGrpFormationRemainOnChanRspCallback(tHalHandle halHandle, void *pContext, tANI_U32 scanId, eCsrScanStatus scan_status);
+eHalStatus p2pChangeDefaultConfigParam(tHalHandle hHal, tP2PConfigParam *pParam);
+eHalStatus p2pGetConfigParam(tHalHandle hHal, tP2PConfigParam *pParam);
+eHalStatus p2pPS(tHalHandle hHal, tANI_U8 sessionId);
+eHalStatus p2pCloseSession(tHalHandle hHal, tANI_U8 SessionID);
+eHalStatus p2pSetSessionId(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 SmeSessionId);
+tANI_BOOLEAN p2pIsOperatingChannEqualListenChann(tHalHandle hHal, tANI_U8 SessionID);
+eHalStatus p2pGetListenChannel(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 *channel);
+eHalStatus p2pSetListenChannel(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 channel);
+eHalStatus p2pStopDiscovery(tHalHandle hHal, tANI_U8 SessionID);
+tANI_U8 getP2PSessionIdFromSMESessionId(tHalHandle hHal, tANI_U8 SessionID);
+void p2pCallDiscoverCallback(tp2pContext *p2pContext, eP2PDiscoverStatus statusCode);
+eHalStatus p2pGetResultFilter(tp2pContext *pP2pContext,
+                              tCsrScanResultFilter *pFilter);
+#endif//INTERNAL
+#endif //__P2P_API_H__
diff --git a/CORE/SME/inc/pmc.h b/CORE/SME/inc/pmc.h
new file mode 100644
index 0000000..e2e3c7f
--- /dev/null
+++ b/CORE/SME/inc/pmc.h
@@ -0,0 +1,251 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  pmc.h
+*
+* Description: Power Management Control (PMC) internal definitions.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated.  
+  All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+
+#ifndef __PMC_H__
+#define __PMC_H__
+
+
+#include "palTimer.h"
+#include "csrLinkList.h"
+#include "pmcApi.h"
+#include "smeInternal.h"
+
+
+//Change PMC_ABORT to no-op for now. We need to define it as VOS_ASSERT(0) once we 
+//cleanup the usage.
+#define PMC_ABORT  
+
+/* Host power sources. */
+typedef enum ePowerSource
+{
+    AC_POWER,  /* host is operating from AC power */
+    BATTERY_POWER  /* host is operating from battery power */
+} tPowerSource;
+
+
+/* Power save check routine list entry. */
+typedef struct sPowerSaveCheckEntry
+{
+    tListElem link;  /* list links */
+    tANI_BOOLEAN (*checkRoutine) (void *checkContext);  /* power save check routine */
+    void *checkContext;  /* value to be passed as parameter to routine specified above */
+} tPowerSaveCheckEntry, *tpPowerSaveCheckEntry;
+
+
+/* Device Power State update indication list entry. */
+typedef struct sDeviceStateUpdateIndEntry
+{
+    tListElem link;  /* list links */
+    void (*callbackRoutine) (void *callbackContext, tPmcState pmcState); /* Callback routine to be invoked when pmc changes device state */
+    void *callbackContext;  /* value to be passed as parameter to routine specified above */
+} tDeviceStateUpdateIndEntry, *tpDeviceStateUpdateIndEntry;
+
+/* Request full power callback routine list entry. */
+typedef struct sRequestFullPowerEntry
+{
+    tListElem link;  /* list links */
+    void (*callbackRoutine) (void *callbackContext, eHalStatus status);  /* routine to call when full power is restored */
+    void *callbackContext;  /* value to be passed as parameter to routine specified above */
+} tRequestFullPowerEntry, *tpRequestFullPowerEntry;
+
+
+/* Request BMPS callback routine list entry. */
+typedef struct sRequestBmpsEntry
+{
+   tListElem link;  /* list links */
+
+   /* routine to call when BMPS request succeeded/failed */
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status);
+
+   /* value to be passed as parameter to routine specified above */
+   void *callbackContext;  
+
+} tRequestBmpsEntry, *tpRequestBmpsEntry;
+
+
+/* Start U-APSD callback routine list entry. */
+typedef struct sStartUapsdEntry
+{
+   tListElem link;  /* list links */
+
+   /* routine to call when Uapsd Start succeeded/failed*/
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status);
+
+   /* value to be passed as parameter to routine specified above */
+   void *callbackContext;  
+
+} tStartUapsdEntry, *tpStartUapsdEntry;
+
+typedef struct sPmcDeferredMsg
+{
+    tListElem link;
+    tpAniSirGlobal pMac;
+    tANI_U16 messageType;
+    tANI_U16 size;  //number of bytes in u.data
+    union
+    {
+        tSirPowerSaveCfg powerSaveConfig;
+        tSirWowlAddBcastPtrn wowlAddPattern;
+        tSirWowlDelBcastPtrn wowlDelPattern;
+        tANI_U8 data[1];    //a place holder
+    }u;
+} tPmcDeferredMsg;
+
+
+
+/* Current PMC information for a particular device. */
+typedef struct sPmcInfo
+{
+    tPowerSource powerSource;  /* host power source */
+    tPmcSwitchState hwWlanSwitchState;  /* Hardware WLAN Switch state */
+    tPmcSwitchState swWlanSwitchState;  /* Software WLAN Switch state */
+    tPmcState pmcState;  /* PMC state */
+    tANI_BOOLEAN requestFullPowerPending;  /* TRUE if a request for full power is pending */
+    tRequestFullPowerReason requestFullPowerReason; /* reason for requesting full power */
+    tPmcImpsConfigParams impsConfig;  /* IMPS configuration */
+    tPmcBmpsConfigParams bmpsConfig;  /* BMPS configuration */
+    tPmcSmpsConfigParams smpsConfig;  /* SMPS configuration */
+    tANI_BOOLEAN impsEnabled;  /* TRUE if IMPS is enabled */
+    tANI_BOOLEAN bmpsEnabled;  /* TRUE if BMPS is enabled */
+    tANI_BOOLEAN autoBmpsEntryEnabled;  /* TRUE if auto BMPS entry is enabled. If set to TRUE, PMC will
+                                           attempt to put the device into BMPS on entry into full Power */
+    tANI_BOOLEAN bmpsRequestedByHdd; /*TRUE if BMPS mode has been requested by HDD */
+    tANI_BOOLEAN bmpsRequestQueued; /*If a enter BMPS request is queued*/
+    tANI_BOOLEAN smpsEnabled;  /* TRUE if SMPS is enabled */
+    tANI_BOOLEAN remainInPowerActiveTillDHCP;  /* Remain in Power active till DHCP completes */
+    tANI_U32 remainInPowerActiveThreshold;  /*Remain in Power active till DHCP threshold*/
+    tANI_U32 impsPeriod;  /* amount of time to remain in IMPS */
+    void (*impsCallbackRoutine) (void *callbackContext, eHalStatus status);  /* routine to call when IMPS period
+                                                                                has finished */ 
+    void *impsCallbackContext;  /* value to be passed as parameter to routine specified above */
+    tPalTimerHandle hImpsTimer;  /* timer to use with IMPS */
+    vos_timer_t hTrafficTimer;  /* timer to measure traffic for BMPS */
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    tPalTimerHandle hDiagEvtTimer;  /* timer to report PMC state through DIAG event */
+#endif
+    tPalTimerHandle hExitPowerSaveTimer;  /* timer for deferred exiting of power save mode */
+    tDblLinkList powerSaveCheckList; /* power save check routine list */
+    tDblLinkList requestFullPowerList; /* request full power callback routine list */
+    tANI_U32 cLastTxUnicastFrames;  /* transmit unicast frame count at last BMPS traffic timer expiration */
+    tANI_U32 cLastRxUnicastFrames;  /* receive unicast frame count at last BMPS traffic timer expiration */
+
+
+    tANI_BOOLEAN uapsdEnabled;  /* TRUE if UAPSD is enabled */
+    tANI_BOOLEAN uapsdSessionRequired; /* TRUE if device should go to UAPSD on entering BMPS*/
+    tDblLinkList requestBmpsList; /* request Bmps callback routine list */
+    tDblLinkList requestStartUapsdList; /* request start Uapsd callback routine list */
+    tANI_BOOLEAN standbyEnabled;  /* TRUE if Standby is enabled */
+    void (*standbyCallbackRoutine) (void *callbackContext, eHalStatus status); /* routine to call for standby request */ 
+    void *standbyCallbackContext;/* value to be passed as parameter to routine specified above */
+    tDblLinkList deviceStateUpdateIndList; /*update device state indication list */
+    tANI_BOOLEAN pmcReady; /*whether eWNI_SME_SYS_READY_IND has been sent to PE or not */
+    tANI_BOOLEAN wowlEnabled;  /* TRUE if WoWL is enabled */
+    tANI_BOOLEAN wowlModeRequired; /* TRUE if device should go to WOWL on entering BMPS */
+    void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status); /* routine to call for wowl request */ 
+    void *enterWowlCallbackContext;/* value to be passed as parameter to routine specified above */
+    tSirSmeWowlEnterParams wowlEnterParams; /* WOWL mode configuration */
+    tDblLinkList deferredMsgList;   //The message in here are deferred and DONOT expect response from PE
+    tANI_BOOLEAN rfSuppliesVotedOff;  //Whether RF supplies are voted off or not.
+#ifdef FEATURE_WLAN_SCAN_PNO
+    preferredNetworkFoundIndCallback  prefNetwFoundCB; /* routine to call for Preferred Network Found Indication */ 
+    void *preferredNetworkFoundIndCallbackContext;/* value to be passed as parameter to routine specified above */
+#endif // FEATURE_WLAN_SCAN_PNO
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+    FilterMatchCountCallback  FilterMatchCountCB; /* routine to call for Packet Coalescing Filter Match Count */ 
+    void *FilterMatchCountCBContext;/* value to be passed as parameter to routine specified above */
+#endif // WLAN_FEATURE_PACKET_FILTERING
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+    GTKOffloadGetInfoCallback  GtkOffloadGetInfoCB; /* routine to call for GTK Offload Information */ 
+    void *GtkOffloadGetInfoCBContext;        /* value to be passed as parameter to routine specified above */
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+    void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd);  /* routine to call for Wake Reason Indication */ 
+    void *wakeReasonIndCBContext;  /* value to be passed as parameter to routine specified above */
+#endif // WLAN_WAKEUP_EVENTS
+} tPmcInfo, *tpPmcInfo;
+
+
+//MACRO
+#define PMC_IS_READY(pMac)  ( ((pMac)->pmc.pmcReady) && (STOPPED != (pMac)->pmc.pmcState) )
+
+
+/* Routine definitions. */
+extern eHalStatus pmcEnterLowPowerState (tHalHandle hHal);
+extern eHalStatus pmcExitLowPowerState (tHalHandle hHal);
+extern eHalStatus pmcEnterFullPowerState (tHalHandle hHal);
+extern eHalStatus pmcEnterRequestFullPowerState (tHalHandle hHal, tRequestFullPowerReason fullPowerReason);
+extern eHalStatus pmcEnterRequestImpsState (tHalHandle hHal);
+extern eHalStatus pmcEnterImpsState (tHalHandle hHal);
+extern eHalStatus pmcEnterRequestBmpsState (tHalHandle hHal);
+extern eHalStatus pmcEnterBmpsState (tHalHandle hHal);
+extern eHalStatus pmcEnterRequestStartUapsdState (tHalHandle hHal);
+extern eHalStatus pmcEnterUapsdState (tHalHandle hHal);
+extern eHalStatus pmcEnterRequestStopUapsdState (tHalHandle hHal);
+extern eHalStatus pmcEnterRequestStandbyState (tHalHandle hHal);
+extern eHalStatus pmcEnterStandbyState (tHalHandle hHal);
+extern tANI_BOOLEAN pmcPowerSaveCheck (tHalHandle hHal);
+extern eHalStatus pmcSendPowerSaveConfigMessage (tHalHandle hHal);
+extern eHalStatus pmcSendMessage (tpAniSirGlobal pMac, tANI_U16 messageType, void *pMessageData, tANI_U32 messageSize);
+extern void pmcDoCallbacks (tHalHandle hHal, eHalStatus callbackStatus);
+extern void pmcDoBmpsCallbacks (tHalHandle hHal, eHalStatus callbackStatus);
+extern void pmcDoStartUapsdCallbacks (tHalHandle hHal, eHalStatus callbackStatus);
+extern void pmcDoStandbyCallbacks (tHalHandle hHal, eHalStatus callbackStatus);
+extern eHalStatus pmcStartTrafficTimer (tHalHandle hHal, tANI_U32 expirationTime);
+extern void pmcStopTrafficTimer (tHalHandle hHal);
+extern void pmcImpsTimerExpired (tHalHandle hHal);
+extern void pmcTrafficTimerExpired (tHalHandle hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+extern eHalStatus pmcStartDiagEvtTimer (tHalHandle hHal);
+extern void pmcStopDiagEvtTimer (tHalHandle hHal);
+extern void pmcDiagEvtTimerExpired (tHalHandle hHal);
+#endif
+
+extern void pmcExitPowerSaveTimerExpired (tHalHandle hHal);
+extern tPmcState pmcGetPmcState (tHalHandle hHal);
+extern const char* pmcGetPmcStateStr(tPmcState state);
+extern void pmcDoDeviceStateUpdateCallbacks (tHalHandle hHal, tPmcState state);
+extern eHalStatus pmcRequestEnterWowlState(tHalHandle hHal, tpSirSmeWowlEnterParams wowlEnterParams);
+extern eHalStatus pmcEnterWowlState (tHalHandle hHal);
+extern eHalStatus pmcRequestExitWowlState(tHalHandle hHal);
+extern void pmcDoEnterWowlCallbacks (tHalHandle hHal, eHalStatus callbackStatus);
+//The function will request for full power as well in addition to defer the message
+extern eHalStatus pmcDeferMsg( tpAniSirGlobal pMac, tANI_U16 messageType, 
+                                               void *pData, tANI_U32 size);
+extern eHalStatus pmcIssueCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam, 
+                                   tANI_U32 size, tANI_BOOLEAN fPutToListHead );
+extern eHalStatus pmcEnterImpsCheck( tpAniSirGlobal pMac );
+extern eHalStatus pmcEnterBmpsCheck( tpAniSirGlobal pMac );
+extern tANI_BOOLEAN pmcShouldBmpsTimerRun( tpAniSirGlobal pMac );
+#endif
diff --git a/CORE/SME/inc/pmcApi.h b/CORE/SME/inc/pmcApi.h
new file mode 100644
index 0000000..05a7fff
--- /dev/null
+++ b/CORE/SME/inc/pmcApi.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.
+ */
+
+/******************************************************************************
+
+*
+
+* Name:  pmcApi.h
+
+*
+
+* Description: Power Management Control (PMC) API definitions.
+
+* Copyright 2008 (c) Qualcomm, Incorporated.  
+
+* All Rights Reserved.
+
+* Qualcomm Confidential and Proprietary.
+
+*
+
+******************************************************************************/
+
+
+#ifndef __PMC_API_H__
+
+#define __PMC_API_H__
+
+//This timer value determines the default periodicity at which BMPS retries will happen
+//This default value is overwritten typicaly by OS specific registry/INI values. 
+#define BMPS_TRAFFIC_TIMER_DEFAULT 5000  //unit = ms
+#define DHCP_REMAIN_POWER_ACTIVE_THRESHOLD 12 // (12 * 5) sec = 60 seconds = 1 min
+
+//This timer value is used when starting the timer right after association. This value
+//should be large enough to allow the auth, DHCP handshake to complete
+#define BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP 8000  //unit = ms
+
+#define PMC_IS_CHIP_ACCESSIBLE(pmcState) ( (IMPS != (pmcState)) && (REQUEST_IMPS != (pmcState)) && \
+       (STANDBY != (pmcState)) && (REQUEST_STANDBY != (pmcState)) )
+
+
+
+/* Power events that are signaled to PMC. */
+
+typedef enum ePmcPowerEvent
+
+{
+
+    ePMC_SYSTEM_HIBERNATE,  /* host is entering hibernation */
+
+    ePMC_SYSTEM_RESUME,  /* host is resuming after hibernation */
+
+    ePMC_HW_WLAN_SWITCH_OFF,  /* Hardware WLAN Switch has been turned off */
+
+    ePMC_HW_WLAN_SWITCH_ON,  /* Hardware WLAN Switch has been turned on */
+
+    ePMC_SW_WLAN_SWITCH_OFF,  /* Software WLAN Switch has been turned off */
+
+    ePMC_SW_WLAN_SWITCH_ON,  /* Software WLAN Switch has been turned on */
+
+    ePMC_BATTERY_OPERATION,  /* host is now operating on battery power */
+
+    ePMC_AC_OPERATION  /* host is now operating on AC power */
+
+} tPmcPowerEvent;
+
+
+
+
+/* Power saving modes. */
+
+typedef enum ePmcPowerSavingMode
+
+{
+
+    ePMC_IDLE_MODE_POWER_SAVE,  /* Idle Mode Power Save (IMPS) */
+
+    ePMC_BEACON_MODE_POWER_SAVE,  /* Beacon Mode Power Save (BMPS) */
+
+    ePMC_SPATIAL_MULTIPLEX_POWER_SAVE,  /* Spatial Multiplexing Power Save (SMPS) */
+
+    ePMC_UAPSD_MODE_POWER_SAVE,  /* Unscheduled Automatic Power Save Delivery Mode */
+
+    ePMC_STANDBY_MODE_POWER_SAVE,  /* Standby Power Save Mode */
+
+    ePMC_WOWL_MODE_POWER_SAVE  /* Wake-on-Wireless LAN Power Save Mode */
+
+} tPmcPowerSavingMode;
+
+
+
+
+/* Switch states. */
+
+typedef enum ePmcSwitchState
+
+{
+
+    ePMC_SWITCH_OFF,  /* switch off */
+
+    ePMC_SWITCH_ON  /* switch on */
+
+} tPmcSwitchState;
+
+
+
+
+/* Device power states. */
+
+typedef enum ePmcPowerState
+
+{
+
+    ePMC_FULL_POWER,  /* full power */
+
+    ePMC_LOW_POWER,  /* low power */
+
+} tPmcPowerState;
+
+ 
+
+/* PMC states. */
+
+typedef enum ePmcState
+
+{
+
+    STOPPED, /* PMC is stopped */
+
+    FULL_POWER, /* full power */
+
+    LOW_POWER, /* low power */
+
+    REQUEST_IMPS,  /* requesting IMPS */
+
+    IMPS,  /* in IMPS */
+
+    REQUEST_BMPS,  /* requesting BMPS */
+
+    BMPS,  /* in BMPS */
+
+    REQUEST_FULL_POWER,  /* requesting full power */
+
+    REQUEST_START_UAPSD,  /* requesting Start UAPSD */
+
+    REQUEST_STOP_UAPSD,  /* requesting Stop UAPSD */
+
+    UAPSD,           /* in UAPSD */
+
+    REQUEST_STANDBY,  /* requesting standby mode */
+
+    STANDBY,  /* in standby mode */
+
+    REQUEST_ENTER_WOWL, /* requesting enter WOWL */
+
+    REQUEST_EXIT_WOWL,  /* requesting exit WOWL */
+
+    WOWL                /* Chip in WOWL mode */
+
+} tPmcState;
+
+
+/* Which beacons should be forwarded to the host. */
+
+typedef enum ePmcBeaconsToForward
+
+{
+
+    ePMC_NO_BEACONS,  /* none */
+
+    ePMC_BEACONS_WITH_TIM_SET,  /* with TIM set */
+
+    ePMC_BEACONS_WITH_DTIM_SET,  /* with DTIM set */
+
+    ePMC_NTH_BEACON,  /* every Nth beacon */
+
+    ePMC_ALL_BEACONS  /* all beacons */
+
+} tPmcBeaconsToForward;
+
+
+
+
+/* The Spatial Mulitplexing Power Save modes. */
+
+typedef enum ePmcSmpsMode
+
+{
+
+    ePMC_DYNAMIC_SMPS,  /* dynamic SMPS */
+
+    ePMC_STATIC_SMPS  /* static SMPS */
+
+} tPmcSmpsMode;
+
+
+
+
+/* Configuration parameters for Idle Mode Power Save (IMPS). */
+
+typedef struct sPmcImpsConfigParams
+
+{
+
+    tANI_BOOLEAN enterOnAc;  /* FALSE if device should enter IMPS only when host operating
+
+                                on battery power, TRUE if device should enter always */
+
+} tPmcImpsConfigParams, *tpPmcImpsConfigParams;
+
+
+
+
+/* Configuration parameters for Beacon Mode Power Save (BMPS). */
+
+typedef struct sPmcBmpsConfigParams
+
+{
+
+    tANI_BOOLEAN enterOnAc;  /* FALSE if device should enter BMPS only when host operating on
+
+                                battery power, TRUE if device should enter always */
+
+    tANI_U32 txThreshold;  /* transmit rate under which BMPS should be entered (frames / traffic measurement period) */
+
+    tANI_U32 rxThreshold;  /* receive rate under which BMPS should be entered (frames / traffic measurement period) */
+
+    tANI_U32 trafficMeasurePeriod; /* period for BMPS traffic measurement (milliseconds) */
+
+    tANI_U32 bmpsPeriod;  /* amount of time in low power (beacon intervals) */
+
+    tPmcBeaconsToForward forwardBeacons;  /* which beacons should be forwarded to the host */
+
+    tANI_U32 valueOfN;  /* the value of N when forwardBeacons is set to ePMC_NTH_BEACON */
+
+    tANI_BOOLEAN usePsPoll;  /* TRUE if PS-POLL should be used to retrieve frames from AP, FALSE if a
+
+                                null data frame with the PM bit reset should be used */
+
+    tANI_BOOLEAN setPmOnLastFrame; /* TRUE to keep device in BMPS as much as possible, FALSE otherwise, TRUE means:
+
+                                      1) PM bit should be set on last pending transmit data frame
+
+                                      2) null frame with PM bit set should be transmitted after last pending receive
+
+                                         frame has been processed */
+
+    tANI_BOOLEAN enableBeaconEarlyTermination; /* if TRUE, BET feature in RIVA 
+                                      will be enabled, FALSE otherwise, TRUE means:
+                                      RXP will read the beacon header for the 
+                                      TIM bit & discard the rest if set to 0, 
+                                      while in BMPS              */
+    tANI_U8      bcnEarlyTermWakeInterval; /* This specifies how often in terms 
+                                      of LI we will disable BET in order to sync 
+                                      up TSF*/
+
+} tPmcBmpsConfigParams, *tpPmcBmpsConfigParams;
+
+
+
+
+/* Configuration parameters for Spatial Mulitplexing Power Save (SMPS). */
+
+typedef struct sPmcSmpsConfigParams
+
+{
+
+    tPmcSmpsMode mode;  /* mode to use */
+
+    tANI_BOOLEAN enterOnAc;  /* FALSE if device should enter SMPS only when host operating on
+
+                                battery power, TRUE if device should enter always */
+
+} tPmcSmpsConfigParams, *tpPmcSmpsConfigParams;
+
+
+/* Routine definitions. */
+
+extern eHalStatus pmcOpen (tHalHandle hHal);
+
+extern eHalStatus pmcStart (tHalHandle hHal);
+
+extern eHalStatus pmcStop (tHalHandle hHal);
+
+extern eHalStatus pmcClose (tHalHandle hHal );
+
+extern eHalStatus pmcSignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event);
+
+extern eHalStatus pmcSetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
+
+extern eHalStatus pmcGetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
+
+extern eHalStatus pmcEnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
+
+extern eHalStatus pmcStartAutoBmpsTimer (tHalHandle hHal);
+
+extern eHalStatus pmcStopAutoBmpsTimer (tHalHandle hHal);
+
+extern eHalStatus pmcDisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
+
+extern eHalStatus pmcQueryPowerState (tHalHandle hHal, tPmcPowerState *pPowerState, tPmcSwitchState *pHwWlanSwitchState,
+
+                                      tPmcSwitchState *pSwWlanSwitchState);
+
+extern tANI_BOOLEAN pmcIsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode);
+
+extern eHalStatus pmcRequestFullPower (tHalHandle hHal, void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+
+                                       void *callbackContext, tRequestFullPowerReason fullPowerReason);
+
+extern eHalStatus pmcRequestImps (tHalHandle hHal, tANI_U32 impsPeriod,
+
+                                  void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+
+                                  void *callbackContext);
+
+extern eHalStatus pmcRegisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext),
+
+                                             void *checkContext);
+
+extern eHalStatus pmcDeregisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext));
+
+extern void pmcMessageProcessor (tHalHandle hHal, tSirSmeRsp *pMsg);
+
+
+extern eHalStatus pmcRequestBmps (
+
+   tHalHandle hHal,
+
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+
+   void *callbackContext);
+
+
+extern eHalStatus pmcStartUapsd (
+
+   tHalHandle hHal,
+
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+
+   void *callbackContext);
+
+
+extern eHalStatus pmcStopUapsd (tHalHandle hHal);
+
+
+extern eHalStatus pmcRequestStandby (
+
+   tHalHandle hHal,
+
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+
+   void *callbackContext);
+
+
+extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal, 
+
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
+
+   void *callbackContext);
+
+
+extern eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal, 
+
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
+
+
+extern eHalStatus pmcReady(tHalHandle hHal);
+
+
+void pmcDumpInit(tHalHandle hHal);
+
+
+extern eHalStatus pmcWowlAddBcastPattern (
+
+   tHalHandle hHal, 
+
+   tpSirWowlAddBcastPtrn pattern);
+
+
+extern eHalStatus pmcWowlDelBcastPattern (
+
+   tHalHandle hHal, 
+
+   tpSirWowlDelBcastPtrn pattern);
+
+
+extern eHalStatus pmcEnterWowl ( 
+
+    tHalHandle hHal, 
+
+    void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
+
+    void *enterWowlCallbackContext,
+#ifdef WLAN_WAKEUP_EVENTS
+    void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
+
+    void *wakeReasonIndCBContext,
+#endif // WLAN_WAKEUP_EVENTS
+    tpSirSmeWowlEnterParams wowlEnterParams);
+
+extern eHalStatus pmcExitWowl (tHalHandle hHal);
+
+
+extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
+
+/* ---------------------------------------------------------------------------
+    \fn pmcSetKeepAlive
+    \brief  Set the Keep Alive feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest - Pointer to the Keep Alive.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the keepalive.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest);
+
+extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
+
+extern tANI_BOOLEAN pmcAllowImps( tHalHandle hHal );
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*Pref netw found Cb declaration*/
+typedef void(*preferredNetworkFoundIndCallback)(void *callbackContext, tpSirPrefNetworkFoundInd pPrefNetworkFoundInd);
+
+extern eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext);
+extern eHalStatus pmcSetRssiFilter(tHalHandle hHal, v_U8_t rssiThreshold);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+// Packet Coalescing Filter Match Count Callback declaration
+typedef void(*FilterMatchCountCallback)(void *callbackContext,
+                                        tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp);
+extern eHalStatus pmcGetFilterMatchCount(tHalHandle hHal, FilterMatchCountCallback callbackRoutine, void *callbackContext);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+// GTK Offload Information Callback declaration
+typedef void(*GTKOffloadGetInfoCallback)(void *callbackContext, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
+
+/* ---------------------------------------------------------------------------
+    \fn pmcSetGTKOffload
+    \brief  Set GTK offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pGtkOffload - Pointer to the GTK offload request.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload);
+
+/* ---------------------------------------------------------------------------
+    \fn pmcGetGTKOffload
+    \brief  Get GTK offload information.
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus pmcGetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#endif
+
diff --git a/CORE/SME/inc/smeInside.h b/CORE/SME/inc/smeInside.h
new file mode 100644
index 0000000..742ac7d
--- /dev/null
+++ b/CORE/SME/inc/smeInside.h
@@ -0,0 +1,195 @@
+/*
+ * 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( __SMEINSIDE_H )
+#define __SMEINSIDE_H
+
+
+/**=========================================================================
+  
+  \file  smeInside.h
+  
+  \brief prototype for SME structures and APIs used insside SME
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_status.h"
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "sirApi.h"
+#include "csrInternal.h"
+#include "sme_QosApi.h"
+#include "smeQosInternal.h"
+
+
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "sme_RrmApi.h"
+#endif
+
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+#define SME_TOTAL_COMMAND  20
+
+
+typedef struct sGenericPmcCmd
+{
+    tANI_U32 size;  //sizeof the data in the union, if any
+    tRequestFullPowerReason fullPowerReason;
+    tANI_BOOLEAN fReleaseWhenDone; //if TRUE, the command shall not put back to the queue, free te memory instead.
+    union
+    {
+        tExitBmpsInfo exitBmpsInfo;
+        tSirSmeWowlEnterParams enterWowlInfo;
+    }u;
+} tGenericPmcCmd;
+
+
+typedef struct sGenericQosCmd
+{
+    sme_QosWmmTspecInfo tspecInfo;
+    sme_QosEdcaAcType ac;
+    v_U8_t tspec_mask;
+} tGenericQosCmd;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sRemainChlCmd
+{
+    tANI_U8 chn;
+    tANI_U8 phyMode;
+    tANI_U32 duration;
+    void* callback;
+    void* callbackCtx;
+}tRemainChlCmd;
+
+typedef struct sNoACmd
+{
+    tP2pPsConfig NoA;
+} tNoACmd;
+#endif
+
+typedef struct tagSmeCmd
+{
+    tListElem Link;
+    eSmeCommandType command;
+    tANI_U32 sessionId;
+    union
+    {
+        tScanCmd scanCmd;
+        tRoamCmd roamCmd;
+        tWmStatusChangeCmd wmStatusChangeCmd;
+        tSetKeyCmd setKeyCmd;
+        tRemoveKeyCmd removeKeyCmd;
+        tGenericPmcCmd pmcCmd;
+        tGenericQosCmd qosCmd;
+#ifdef WLAN_FEATURE_P2P
+        tRemainChlCmd remainChlCmd;
+        tNoACmd NoACmd;
+#endif
+        tAddStaForSessionCmd addStaSessionCmd;
+        tDelStaForSessionCmd delStaSessionCmd;
+    }u;
+}tSmeCmd;
+
+
+
+/*-------------------------------------------------------------------------- 
+                         Internal to SME
+  ------------------------------------------------------------------------*/
+
+//To get a command buffer
+//Return: NULL if there no more command buffer left
+tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac );
+void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority );
+void smeProcessPendingQueue( tpAniSirGlobal pMac );
+void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd);
+void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId);
+tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac);
+tANI_BOOLEAN pmcProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+//this function is used to abort a command where the normal processing of the command
+//is terminated without going through the normal path. it is here to take care of callbacks for
+//the command, if applicable.
+void pmcAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
+tANI_BOOLEAN qosProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+
+eHalStatus csrProcessScanCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); 
+void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+//eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId );
+eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                         tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId );
+eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, tRequestFullPowerReason *pReason,
+                                 tANI_BOOLEAN *pfNeedPower);
+void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
+
+eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme);
+eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme);
+
+
+eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
+eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
+
+#ifdef WLAN_NS_OFFLOAD
+/* ---------------------------------------------------------------------------
+    \fn pmcSetNSOffload
+    \brief  Set the host offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest - Pointer to the offload request.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
+#endif //WLAN_NS_OFFLOAD
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine,  void *callbackContext);
+eHalStatus pmcUpdateScanParams(tHalHandle hHal, tCsrConfig *pRequest, tCsrChannel *pChannelList, tANI_U8 b11dResolved);
+eHalStatus pmcSetRssiFilter(tHalHandle hHal,   v_U8_t        rssiThreshold);
+#endif // FEATURE_WLAN_SCAN_PNO
+eHalStatus pmcSetPowerParams(tHalHandle hHal,   tSirSetPowerParamsReq*  pwParams);
+
+tANI_BOOLEAN csrRoamGetConcurrencyConnectStatusForBmps(tpAniSirGlobal pMac);
+#endif //#if !defined( __SMEINSIDE_H )
diff --git a/CORE/SME/inc/smeInternal.h b/CORE/SME/inc/smeInternal.h
new file mode 100644
index 0000000..3d27d9b
--- /dev/null
+++ b/CORE/SME/inc/smeInternal.h
@@ -0,0 +1,116 @@
+/*
+ * 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( __SMEINTERNAL_H )
+#define __SMEINTERNAL_H
+
+
+/**=========================================================================
+  
+  \file  smeInternal.h
+  
+  \brief prototype for SME internal structures and APIs used for SME and MAC
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_status.h"
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "csrLinkList.h"
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+// Mask can be only have one bit set
+typedef enum eSmeCommandType 
+{
+    eSmeNoCommand = 0, 
+    eSmeDropCommand,
+    //CSR
+    eSmeCsrCommandMask = 0x10000,   //this is not a command, it is to identify this is a CSR command
+    eSmeCommandScan,
+    eSmeCommandRoam, 
+    eSmeCommandWmStatusChange, 
+    eSmeCommandSetKey,
+    eSmeCommandRemoveKey,
+    eSmeCommandAddStaSession,
+    eSmeCommandDelStaSession,
+    //PMC
+    eSmePmcCommandMask = 0x20000, //To identify PMC commands
+    eSmeCommandEnterImps,
+    eSmeCommandExitImps,
+    eSmeCommandEnterBmps,
+    eSmeCommandExitBmps,
+    eSmeCommandEnterUapsd,
+    eSmeCommandExitUapsd,
+    eSmeCommandEnterWowl,
+    eSmeCommandExitWowl,
+    eSmeCommandEnterStandby,
+    //QOS
+    eSmeQosCommandMask = 0x40000,  //To identify Qos commands
+    eSmeCommandAddTs,
+    eSmeCommandDelTs,
+#ifdef WLAN_FEATURE_P2P
+    eSmeCommandRemainOnChannel,
+    eSmeCommandNoAUpdate,
+#endif
+} eSmeCommandType;
+
+
+typedef enum eSmeState
+{
+    SME_STATE_STOP,
+    SME_STATE_START,
+    SME_STATE_READY,
+} eSmeState;
+
+
+#define SME_IS_START(pMac)  (SME_STATE_STOP != (pMac)->sme.state)
+#define SME_IS_READY(pMac)  (SME_STATE_READY == (pMac)->sme.state)
+
+
+typedef struct tagSmeStruct
+{
+    eSmeState state;
+    vos_lock_t lkSmeGlobalLock;
+    tANI_U32 totalSmeCmd;
+    void *pSmeCmdBufAddr;
+    tDblLinkList smeCmdActiveList;
+    tDblLinkList smeCmdPendingList;
+    tDblLinkList smeCmdFreeList;   //preallocated roam cmd list
+    void (*pTxPerHitCallback) (void *pCallbackContext); /* callback for Tx PER hit to HDD */ 
+    void *pTxPerHitCbContext;
+} tSmeStruct, *tpSmeStruct;
+
+
+#endif //#if !defined( __SMEINTERNAL_H )
diff --git a/CORE/SME/inc/smeQosInternal.h b/CORE/SME/inc/smeQosInternal.h
new file mode 100644
index 0000000..f318af1
--- /dev/null
+++ b/CORE/SME/inc/smeQosInternal.h
@@ -0,0 +1,249 @@
+/*
+ * 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( __SMEQOSINTERNAL_H )
+#define __SMEQOSINTERNAL_H
+
+
+/**=========================================================================
+  
+  \file  smeQosInternal.h
+  
+  \brief prototype for SME QoS APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "aniGlobal.h"
+#include "sirApi.h"
+#include "sme_QosApi.h"
+#include "smeInternal.h"
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+#define SME_QOS_AP_SUPPORTS_APSD         0x80
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various EDCA Access Categories:
+   Based on AC to ACI mapping in 802.11e spec (identical to WMM)
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_EDCA_AC_BE = 0,  /* Best effort access category             */
+   SME_QOS_EDCA_AC_BK = 1,  /* Background access category              */
+   SME_QOS_EDCA_AC_VI = 2,  /* Video access category                   */
+   SME_QOS_EDCA_AC_VO = 3,  /* Voice access category                   */
+  
+   SME_QOS_EDCA_AC_MAX
+} sme_QosEdcaAcType;
+
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various CSR event indication types that would be reported 
+   by CSR
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_CSR_JOIN_REQ = 0,
+   SME_QOS_CSR_ASSOC_COMPLETE,
+   SME_QOS_CSR_REASSOC_REQ,
+   SME_QOS_CSR_REASSOC_COMPLETE,
+   SME_QOS_CSR_REASSOC_FAILURE,
+   SME_QOS_CSR_DISCONNECT_REQ,
+   SME_QOS_CSR_DISCONNECT_IND,
+   SME_QOS_CSR_HANDOFF_ASSOC_REQ,
+   SME_QOS_CSR_HANDOFF_COMPLETE,
+   SME_QOS_CSR_HANDOFF_FAILURE,
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   SME_QOS_CSR_PREAUTH_SUCCESS_IND,
+   SME_QOS_CSR_SET_KEY_SUCCESS_IND,
+#endif
+}sme_QosCsrEventIndType;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+typedef enum
+{
+   SME_QOS_DIAG_ADDTS_REQ = 0,
+   SME_QOS_DIAG_ADDTS_RSP,
+   SME_QOS_DIAG_DELTS
+
+}sme_QosDiagQosEventSubtype;
+
+typedef enum
+{
+   SME_QOS_DIAG_ADDTS_ADMISSION_ACCEPTED = 0,
+   SME_QOS_DIAG_ADDTS_INVALID_PARAMS,
+   SME_QOS_DIAG_ADDTS_RESERVED,
+   SME_QOS_DIAG_ADDTS_REFUSED,
+   SME_QOS_DIAG_USER_REQUESTED,
+   SME_QOS_DIAG_DELTS_IND_FROM_AP,
+
+}sme_QosDiagQosEventReasonCode;
+
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+/*---------------------------------------------------------------------------
+    The association information structure to be passed by CSR after assoc or 
+    reassoc is done
+---------------------------------------------------------------------------*/
+typedef struct
+{ 
+   tSirBssDescription            *pBssDesc;
+   tCsrRoamProfile               *pProfile;
+} sme_QosAssocInfo;
+
+/*-------------------------------------------------------------------------- 
+                         External APIs for CSR - Internal to SME
+  ------------------------------------------------------------------------*/
+
+/* --------------------------------------------------------------------------
+    \brief sme_QosOpen() - This function must be called before any API call to 
+    SME QoS module.
+
+    \param pMac - Pointer to the global MAC parameter structure.
+    
+    \return eHalStatus     
+----------------------------------------------------------------------------*/
+eHalStatus sme_QosOpen(tpAniSirGlobal pMac);
+
+/* --------------------------------------------------------------------------
+    \brief sme_QosClose() - To close down SME QoS module. There should not be 
+    any API call into this module after calling this function until another
+    call of sme_QosOpen.
+
+    \param pMac - Pointer to the global MAC parameter structure.
+    
+    \return eHalStatus     
+----------------------------------------------------------------------------*/
+eHalStatus sme_QosClose(tpAniSirGlobal pMac);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetParams() - This function is used by HDD to provide the 
+   default TSPEC params to SME.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info per AC as defined above, provided by HDD
+  
+  \return eHAL_STATUS_SUCCESS - Setparam is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosSetParams(tpAniSirGlobal pMac, sme_QosWmmTspecInfo * pQoSInfo);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosMsgProcessor() - sme_ProcessMsg() calls this function for the 
+  messages that are handled by SME QoS module.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param msg_type - the type of msg passed by PE as defined in wniApi.h
+  \param pMsgBuf - a pointer to a buffer that maps to various structures base 
+                   on the message type.
+                   The beginning of the buffer can always map to tSirSmeRsp.
+  
+  \return eHalStatus.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosMsgProcessor( tpAniSirGlobal pMac,  v_U16_t msg_type, 
+                                void *pMsgBuf);
+
+/*-------------------------------------------------------------------------- 
+                         Internal APIs for CSR
+  ------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosValidateParams() - The SME QoS API exposed to CSR to validate AP 
+  capabilities regarding QoS support & any other QoS parameter validation.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pBssDesc - Pointer to the BSS Descriptor information passed down by 
+                    CSR to PE while issuing the Join request
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosValidateParams(tpAniSirGlobal pMac, 
+                                 tSirBssDescription *pBssDesc);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCsrEventInd() - The QoS sub-module in SME expects notifications 
+  from CSR when certain events occur as mentioned in sme_QosCsrEventIndType.
+
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param ind - The event occurred of type sme_QosCsrEventIndType.
+  \param pEvent_info - Information related to the event
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosCsrEventInd(tpAniSirGlobal pMac,
+                              v_U8_t sessionId,
+                              sme_QosCsrEventIndType ind, 
+                              void *pEvent_info);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosGetACMMask() - The QoS sub-module API to find out on which ACs
+  AP mandates Admission Control (ACM = 1)
+
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pSirBssDesc - The event occurred of type sme_QosCsrEventIndType.
+  \param pIes - the parsed IE for pSirBssDesc. This can be NULL.
+
+  
+  \return a bit mask indicating for which ACs AP has ACM set to 1
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_U8_t sme_QosGetACMMask(tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes);
+
+/*
+  sme_QosTriggerUapsdChange
+        It trigger a change on UAPSD (either disable/enable UAPSD) on current QoS flows
+*/
+sme_QosStatusType sme_QosTriggerUapsdChange( tpAniSirGlobal pMac );
+
+#ifdef FEATURE_WLAN_CCX
+v_U8_t sme_QosCCxRetrieveTspecInfo(tpAniSirGlobal pMac, v_U8_t sessionId, tTspecInfo *pTspecInfo);
+
+#endif
+
+#endif //#if !defined( __SMEQOSINTERNAL_H )
diff --git a/CORE/SME/inc/smeRrmInternal.h b/CORE/SME/inc/smeRrmInternal.h
new file mode 100644
index 0000000..072a5e0
--- /dev/null
+++ b/CORE/SME/inc/smeRrmInternal.h
@@ -0,0 +1,109 @@
+/*
+ * 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( __SMERRMINTERNAL_H )
+#define __SMERRMINTERNAL_H
+
+
+/**=========================================================================
+  
+  \file  smeRrmInternal.h
+  
+  \brief prototype for SME RRM APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "palTimer.h"
+#include "rrmGlobal.h"
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+typedef struct sRrmConfigParam
+{
+   tANI_U8 rrmEnabled;
+   tANI_U8 maxRandnInterval;
+}tRrmConfigParam, *tpRrmConfigParam;
+
+typedef struct sRrmNeighborReportDesc
+{
+   tListElem    List;
+   tSirNeighborBssDescription   *pNeighborBssDescription;
+   tANI_U32                     roamScore;
+} tRrmNeighborReportDesc, *tpRrmNeighborReportDesc;
+
+
+typedef void (*NeighborReportRspCallback) (void *context, VOS_STATUS vosStatus);
+
+typedef struct sRrmNeighborRspCallbackInfo
+{
+    tANI_U32                  timeout;  //in ms.. min value is 10 (10ms)
+    NeighborReportRspCallback neighborRspCallback;
+    void                      *neighborRspCallbackContext;
+} tRrmNeighborRspCallbackInfo, *tpRrmNeighborRspCallbackInfo;
+
+typedef struct sRrmNeighborRequestControlInfo
+{
+    tANI_BOOLEAN    isNeighborRspPending;   //To check whether a neighbor req is already sent and response pending
+    vos_timer_t     neighborRspWaitTimer;
+    tRrmNeighborRspCallbackInfo neighborRspCallbackInfo;
+} tRrmNeighborRequestControlInfo, *tpRrmNeighborRequestControlInfo;
+
+typedef struct sRrmSMEContext
+{
+   tANI_U16 token;
+   tCsrBssid sessionBssId;
+   tANI_U8 regClass;
+   tCsrChannelInfo channelList; //list of all channels to be measured.
+   tANI_U8 currentIndex;
+   tAniSSID ssId;  //SSID used in the measuring beacon report.
+   tSirMacAddr bssId; //bssid used for beacon report measurement.
+   tANI_U16 randnIntvl; //Randomization interval to be used in subsequent measurements.
+   tANI_U16 duration;
+   tANI_U16 measMode;
+   tRrmConfigParam rrmConfig;
+   vos_timer_t IterMeasTimer;
+   tDblLinkList neighborReportCache;
+   tRrmNeighborRequestControlInfo neighborReqControlInfo;
+}tRrmSMEContext, *tpRrmSMEContext; 
+
+typedef struct sRrmNeighborReq
+{
+   tANI_U8 no_ssid;
+   tSirMacSSid ssid;
+}tRrmNeighborReq, *tpRrmNeighborReq;
+
+#endif //#if !defined( __SMERRMINTERNAL_H )
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
new file mode 100644
index 0000000..c14d3f9
--- /dev/null
+++ b/CORE/SME/inc/sme_Api.h
@@ -0,0 +1,2089 @@
+/*
+ * 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( __SME_API_H )
+#define __SME_API_H
+
+
+/**=========================================================================
+  
+  \file  smeApi.h
+  
+  \brief prototype for SME APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "ccmApi.h"
+#include "csrApi.h"
+#include "pmcApi.h"
+#include "vos_mq.h"
+#include "vos_lock.h"
+#include "halTypes.h"
+#include "sirApi.h"
+#include "btcApi.h"
+#include "vos_nvitem.h"
+#include "p2p_Api.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halFw.h"
+#endif
+
+
+#if defined WLAN_FEATURE_VOWIFI
+#include "smeRrmInternal.h"
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#define SME_SUMMARY_STATS         1
+#define SME_GLOBAL_CLASSA_STATS   2
+#define SME_GLOBAL_CLASSB_STATS   4
+#define SME_GLOBAL_CLASSC_STATS   8
+#define SME_GLOBAL_CLASSD_STATS  16
+#define SME_PER_STA_STATS        32
+
+#define SME_INVALID_COUNTRY_CODE "XX"
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+typedef struct _smeConfigParams
+{
+   tCsrConfigParam  csrConfig;
+#if defined WLAN_FEATURE_VOWIFI
+   tRrmConfigParam  rrmConfig;
+#endif
+#if defined FEATURE_WLAN_CCX
+    tANI_U8   isCcxIniFeatureEnabled;
+#endif
+#if defined WLAN_FEATURE_P2P_INTERNAL
+   tP2PConfigParam  p2pConfig;
+#endif
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    tANI_U8   isFastTransitionEnabled;
+#endif
+} tSmeConfigParams, *tpSmeConfigParams;
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_Open() - Initialze all SME modules and put them at idle state
+  
+  The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon 
+  successfully return, all modules are at idle state ready to start.
+
+  smeOpen must be called before any other SME APIs can be involved. 
+  smeOpen must be called after macOpen.
+  
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
+  
+          Other status means SME is failed to be initialized     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Open(tHalHandle hHal);
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_Close() - Release all SME modules and their resources.
+  
+  The function release each module in SME, PMC, CCM, CSR, etc. . Upon 
+  return, all modules are at closed state.
+
+  No SME APIs can be involved after sme_Close except sme_Open. 
+  sme_Close must be called before macClose.
+  
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - SME is successfully close.
+  
+          Other status means SME is failed to be closed but caller still cannot
+          call any other SME functions except smeOpen.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Close(tHalHandle hHal);
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_Start() - Put all SME modules at ready state.
+  
+  The function starts each module in SME, PMC, CCM, CSR, etc. . Upon 
+  successfully return, all modules are ready to run.
+
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - SME is ready.
+  
+          Other status means SME is failed to start.     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Start(tHalHandle hHal);
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_Stop() - Stop all SME modules and put them at idle state
+  
+  The function stops each module in SME, PMC, CCM, CSR, etc. . Upon 
+  return, all modules are at idle state ready to start.
+
+  
+  \param hHal - The handle returned by macOpen.
+
+  \param pmcFlag - The flag tells SME if we want to stop PMC or not
+  
+  \return eHAL_STATUS_SUCCESS - SME is stopped.
+  
+          Other status means SME is failed to stop but caller should still consider 
+          SME is stopped.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag);
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_OpenSession() - Open a session for scan/roam operation. 
+  
+  This is a synchronous API.
+
+  
+  \param hHal - The handle returned by macOpen.
+  \param callback - A pointer to the function caller specifies for roam/connect status indication
+  \param pContext - The context passed with callback
+  \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
+  \param pbSessionId - pointer to a caller allocated buffer for returned session ID
+  
+  \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
+  
+          Other status means SME is failed to open the session.  
+          eHAL_STATUS_RESOURCES - no more session available.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext, 
+                           tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId);
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_CloseSession() - Open a session for scan/roam operation. 
+  
+  This is a synchronous API.
+
+  
+  \param hHal - The handle returned by macOpen.
+
+  \param sessionId - A previous opened session's ID.
+  
+  \return eHAL_STATUS_SUCCESS - session is closed. 
+  
+          Other status means SME is failed to open the session.  
+          eHAL_STATUS_INVALID_PARAMETER - session is not opened. 
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
+                         csrRoamSessionCloseCallback callback, void *pContext);
+
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_UpdateConfig() - Change configurations for all SME moduels
+  
+  The function updates some configuration for modules in SME, CCM, CSR, etc
+  during SMEs close -> open sequence.
+   
+  Modules inside SME apply the new configuration at the next transaction.
+
+  
+  \param hHal - The handle returned by macOpen.
+  \Param pSmeConfigParams - a pointer to a caller allocated object of 
+  typedef struct _smeConfigParams.
+  
+  \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
+  
+          Other status means SME is failed to update the config parameters.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*--------------------------------------------------------------------------
+
+  \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
+ 
+  It is used at driver start up to inform RIVA of the default channel 
+  configuration. 
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
+
+          Other status means SME is failed to update the channel config.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_UpdateChannelConfig(tHalHandle hHal);
+
+#endif // FEATURE_WLAN_SCAN_PNLO
+#ifdef WLAN_SOFTAP_FEATURE
+/*--------------------------------------------------------------------------
+  
+  \brief sme_set11dinfo() - Set the 11d information about valid channels
+   and there power using information from nvRAM 
+   This function is called only for AP.
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by macOpen.
+  \Param pSmeConfigParams - a pointer to a caller allocated object of
+  typedef struct _smeConfigParams.
+
+  \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
+
+          Other status means SME is failed to update the config parameters.
+  \sa
+--------------------------------------------------------------------------*/
+
+eHalStatus sme_set11dinfo(tHalHandle hHal,  tpSmeConfigParams pSmeConfigParams);
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by HostapdAdapter.
+  \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
+
+  \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
+
+          Other status means, failed to get the current regulatory domain.
+  \sa
+--------------------------------------------------------------------------*/
+
+eHalStatus sme_getSoftApDomain(tHalHandle hHal,  v_REGDOMAIN_t *domainIdSoftAp);
+
+eHalStatus sme_setRegInfo(tHalHandle hHal,  tANI_U8 *apCntryCode);
+
+#endif
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ChangeConfigParams
+    \brief The SME API exposed for HDD to provide config params to SME during 
+    SMEs stop -> start sequence. 
+    
+    If HDD changed the domain that will cause a reset. This function will 
+    provide the new set of 11d information for the new domain. Currrently this
+    API provides info regarding 11d only at reset but we can extend this for
+    other params (PMC, QoS) which needs to be initialized again at reset.
+
+    This is a synchronuous call
+    
+    \param hHal - The handle returned by macOpen.
+
+    \Param
+    pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that 
+                currently provides 11d related information like Country code, 
+                Regulatory domain, valid channel list, Tx power per channel, a 
+                list with active/passive scan allowed per valid channel. 
+
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ChangeConfigParams(tHalHandle hHal, 
+                                 tCsrUpdateConfigParam *pUpdateConfigParam);
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform that the NIC
+  is ready tio run.
+  
+  The function is called by HDD at the end of initialization stage so PE/HAL can enable the NIC 
+  to running state. 
+  
+  
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE successfully.
+  
+          Other status means SME failed to send the message to PE.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_HDDReadyInd(tHalHandle hHal);
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief sme_ProcessMsg() - The main message processor for SME.
+  
+  The function is called by a message dispatcher when to process a message 
+  targeted for SME. 
+  
+  
+  \param hHal - The handle returned by macOpen.
+  \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
+  
+  \return eHAL_STATUS_SUCCESS - SME successfully process the message.
+  
+          Other status means SME failed to process the message.
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg);
+
+v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanRequest
+    \brief a wrapper function to Request a 11d or full scan from CSR.
+    \param pScanRequestID - pointer to an object to get back the request ID
+    \param callback - a callback function that scan calls upon finish, will not 
+                      be called if csrScanRequest returns error
+    \param pContext - a pointer passed in for the callback
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *, 
+                           tANI_U32 *pScanRequestID, 
+                           csrScanCompleteCallback callback, void *pContext);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanSetBGScanparams
+    \brief a wrapper function to request CSR to set BG scan params in PE
+    \param pScanReq - BG scan request structure
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetResult
+    \brief a wrapper function to request scan results from CSR.
+    \param pFilter - If pFilter is NULL, all cached results are returned
+    \param phResult - an object for the result.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter, 
+                            tScanResultHandle *phResult);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanFlushResult
+    \brief a wrapper function to request CSR to clear scan results.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultGetFirst
+    \brief a wrapper function to request CSR to returns the first element of 
+           scan result.
+    \param hScanResult - returned from csrScanGetResult
+    \return tCsrScanResultInfo * - NULL if no result     
+  ---------------------------------------------------------------------------*/
+tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle, 
+                                          tScanResultHandle hScanResult);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultGetNext
+    \brief a wrapper function to request CSR to returns the next element of 
+           scan result. It can be called without calling csrScanResultGetFirst 
+           first
+    \param hScanResult - returned from csrScanGetResult
+    \return Null if no result or reach the end     
+  ---------------------------------------------------------------------------*/
+tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle, 
+                                          tScanResultHandle hScanResult);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultPurge
+    \brief a wrapper function to request CSR to remove all items(tCsrScanResult) 
+           in the list and free memory for each item
+    \param hScanResult - returned from csrScanGetResult. hScanResult is 
+                         considered gone by 
+    calling this function and even before this function reutrns.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetPMKIDCandidateList
+    \brief a wrapper function to return the PMKID candidate list
+    \param pPmkidList - caller allocated buffer point to an array of 
+                        tPmkidCandidateInfo
+    \param pNumItems - pointer to a variable that has the number of 
+                       tPmkidCandidateInfo allocated when retruning, this is 
+                       either the number needed or number of items put into 
+                       pPmkidList
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough and pNumItems
+    has the number of tPmkidCandidateInfo.
+    \Note: pNumItems is a number of tPmkidCandidateInfo, 
+           not sizeof(tPmkidCandidateInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
+                                        tPmkidCandidateInfo *pPmkidList, 
+                                        tANI_U32 *pNumItems );
+
+
+/*----------------------------------------------------------------------------
+  \fn sme_RoamRegisterLinkQualityIndCallback
+
+  \brief
+  a wrapper function to allow HDD to register a callback handler with CSR for 
+  link quality indications. 
+
+  Only one callback may be registered at any time.
+  In order to deregister the callback, a NULL cback may be provided.
+
+  Registration happens in the task context of the caller.
+
+  \param callback - Call back being registered
+  \param pContext - user data
+  
+  DEPENDENCIES: After CSR open
+
+  \return eHalStatus  
+-----------------------------------------------------------------------------*/
+eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
+                                                  csrRoamLinkQualityIndCallback   callback,  
+                                                  void                           *pContext);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamConnect
+    \brief a wrapper function to request CSR to inititiate an association
+    \param sessionId - the sessionId returned by sme_OpenSession.
+    \param pProfile - can be NULL to join to any open ones
+    \param pRoamId - to get back the request ID
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile, 
+                           tANI_U32 *pRoamId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamReassoc
+    \brief a wrapper function to request CSR to inititiate a re-association
+    \param pProfile - can be NULL to join the currently connected AP. In that 
+    case modProfileFields should carry the modified field(s) which could trigger
+    reassoc  
+    \param modProfileFields - fields which are part of tCsrRoamConnectedProfile 
+    that might need modification dynamically once STA is up & running and this 
+    could trigger a reassoc
+    \param pRoamId - to get back the request ID
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
+                          tCsrRoamModifyProfileFields modProfileFields,
+                          tANI_U32 *pRoamId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamConnectToLastProfile
+    \brief a wrapper function to request CSR to disconnect and reconnect with 
+           the same profile
+    \return eHalStatus. It returns fail if currently connected     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDisconnect
+    \brief a wrapper function to request CSR to disconnect from a network
+    \param reason -- To indicate the reason for disconnecting. Currently, only 
+                     eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason);
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamStopBss
+    \brief a wrapper function to request CSR to stop bss
+    \param sessionId    - sessionId of SoftAP
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetAssociatedStas
+    \brief To probe the list of associated stations from various modules of CORE stack.
+    \This is an asynchronous API.
+    \param sessionId    - sessionId of SoftAP
+    \param modId        - Module from whom list of associtated stations is to be probed.
+                          If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
+    \param pUsrContext  - Opaque HDD context
+    \param pfnSapEventCallback  - Sap event callback in HDD
+    \param pAssocBuf    - Caller allocated memory to be filled with associatd stations info
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
+                                        VOS_MODULE_ID modId, void *pUsrContext,
+                                        void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDisconnectSta
+    \brief To disassociate a station. This is an asynchronous API.
+    \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pPeerMacAddr);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDeauthSta
+    \brief To disassociate a station. This is an asynchronous API.
+    \param hHal - Global structure
+    \param sessionId - sessionId of SoftAP
+    \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results    
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
+                                tANI_U8 *pPeerMacAddr);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamTKIPCounterMeasures
+    \brief To start or stop TKIP counter measures. This is an asynchronous API.
+    \param sessionId - sessionId of SoftAP
+    \param bEnable - Flag to start/stop TKIP countermeasures
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results    
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId, tANI_BOOLEAN bEnable);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetWpsSessionOverlap
+    \brief To get the WPS PBC session overlap information.
+    \This is an asynchronous API.
+    \param sessionId    - sessionId of SoftAP
+    \param pUsrContext  - Opaque HDD context
+    \param pfnSapEventCallback  - Sap event callback in HDD
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
+                                        void *pUsrContext, void *pfnSapEventCallback,
+                                        v_MACADDR_t pRemoveMac);
+#endif
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetConnectState
+    \brief a wrapper function to request CSR to return the current connect state 
+           of Roaming
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetConnectProfile
+    \brief a wrapper function to request CSR to return the current connect 
+           profile. Caller must call csrRoamFreeConnectProfile after it is done 
+           and before reuse for another csrRoamGetConnectProfile call.
+    \param pProfile - pointer to a caller allocated structure 
+                      tCsrRoamConnectedProfile
+    \return eHalStatus. Failure if not connected     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
+                                     tCsrRoamConnectedProfile *pProfile);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamFreeConnectProfile
+    \brief a wrapper function to request CSR to free and reinitialize the 
+           profile returned previously by csrRoamGetConnectProfile.
+    \param pProfile - pointer to a caller allocated structure 
+                      tCsrRoamConnectedProfile
+    \return eHalStatus.      
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal, 
+                                      tCsrRoamConnectedProfile *pProfile);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamSetPMKIDCache
+    \brief a wrapper function to request CSR to return the PMKID candidate list
+    \param pPMKIDCache - caller allocated buffer point to an array of 
+                         tPmkidCacheInfo
+    \param numItems - a variable that has the number of tPmkidCacheInfo 
+                      allocated when retruning, this is either the number needed 
+                      or number of items put into pPMKIDCache
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough and pNumItems has the number of 
+                         tPmkidCacheInfo.
+    \Note: pNumItems is a number of tPmkidCacheInfo, 
+           not sizeof(tPmkidCacheInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache, 
+                                  tANI_U32 numItems );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetSecurityReqIE
+    \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
+           passes to PE to JOIN request or START_BSS request
+    This is a synchronuous call.
+    \param sessionId - returned by sme_OpenSession.
+    \param pLen - caller allocated memory that has the length of pBuf as input. 
+                  Upon returned, *pLen has the needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, 
+                  upon return
+    \param secType - Specifies whether looking for WPA/WPA2/WAPI IE                  
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
+                                  tANI_U8 *pBuf, eCsrSecurityType secType);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetSecurityRspIE
+    \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from 
+           the beacon or probe rsp if connected
+    \param sessionId - returned by sme_OpenSession.
+    \param pLen - caller allocated memory that has the length of pBuf as input. 
+                  Upon returned, *pLen has the needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, 
+                  upon return
+    \param secType - Specifies whether looking for WPA/WPA2/WAPI IE                                       
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
+                                  tANI_U8 *pBuf, eCsrSecurityType secType);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetNumPMKIDCache
+    \brief a wrapper function to request CSR to return number of PMKID cache 
+           entries
+    \return tANI_U32 - the number of PMKID cache entries
+  ---------------------------------------------------------------------------*/
+tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetPMKIDCache
+    \brief a wrapper function to request CSR to return PMKID cache from CSR
+    \param pNum - caller allocated memory that has the space of the number of 
+                  pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the 
+                  needed or actually number in tPmkidCacheInfo.
+    \param pPmkidCache - Caller allocated memory that contains PMKID cache, if 
+                         any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum, 
+                                 tPmkidCacheInfo *pPmkidCache);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetConfigParam
+    \brief a wrapper function that HDD calls to get the global settings 
+           currently maintained by CSR. 
+    \param pParam - caller allocated memory
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetStatistics
+    \brief a wrapper function that client calls to register a callback to get 
+    different PHY level statistics from CSR. 
+    
+    \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
+    \param statsMask - The different category/categories of stats requester is looking for
+    The order in which you set the bits in the statsMask for requesting 
+    different type of stats is:
+
+      eCsrSummaryStats = bit 0
+      eCsrGlobalClassAStats = bit 1
+      eCsrGlobalClassBStats = bit 2
+      eCsrGlobalClassCStats = bit 3
+      eCsrGlobalClassDStats = bit 4
+      eCsrPerStaStats = bit 5
+
+    \param callback - SME sends back the requested stats using the callback
+    \param periodicity - If requester needs periodic update, 0 means it's an one 
+                         time request
+    \param cache - If requester is happy with cached stats
+    \param staId - The station ID for which the stats is requested for
+    \param pContext - user context to be passed back along with the callback
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId, 
+                             tANI_U32 statsMask, 
+                             tCsrStatsCallback callback, 
+                             tANI_U32 periodicity, tANI_BOOLEAN cache, 
+                             tANI_U8 staId, void *pContext);
+
+eHalStatus sme_GetRssi(tHalHandle hHal, 
+                             tCsrRssiCallback callback, 
+                             tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_CfgSetInt
+    \brief a wrapper function that HDD calls to set parameters in CFG. 
+    \param cfgId - Configuration Parameter ID (type) for STA. 
+    \param ccmValue - The information related to Configuration Parameter ID
+                      which needs to be saved in CFG
+    \param callback - To be registered by CSR with CCM. Once the CFG done with 
+                      saving the information in the database, it notifies CCM & 
+                      then the callback will be invoked to notify. 
+    \param toBeSaved - To save the request for future reference
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, 
+                         tCcmCfgSetCallback callback, eAniBoolean toBeSaved) ;
+
+/* ---------------------------------------------------------------------------
+    \fn sme_CfgSetStr
+    \brief a wrapper function that HDD calls to set parameters in CFG. 
+    \param cfgId - Configuration Parameter ID (type) for STA. 
+    \param pStr - Pointer to the byte array which carries the information needs 
+                  to be saved in CFG
+    \param length - Length of the data to be saved                  
+    \param callback - To be registered by CSR with CCM. Once the CFG done with 
+                      saving the information in the database, it notifies CCM & 
+                      then the callback will be invoked to notify. 
+    \param toBeSaved - To save the request for future reference
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, 
+                         tANI_U32 length, tCcmCfgSetCallback callback, 
+                         eAniBoolean toBeSaved) ;
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetModifyProfileFields
+    \brief HDD or SME - QOS calls this function to get the current values of 
+    connected profile fields, changing which can cause reassoc.
+    This function must be called after CFG is downloaded and STA is in connected
+    state. Also, make sure to call this function to get the current profile
+    fields before calling the reassoc. So that pModifyProfileFields will have
+    all the latest values plus the one(s) has been updated as part of reassoc
+    request.
+    \param pModifyProfileFields - pointer to the connected profile fields 
+    changing which can cause reassoc
+
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId, 
+                                     tCsrRoamModifyProfileFields * pModifyProfileFields);
+
+
+/*--------------------------------------------------------------------------
+    \fn sme_SetConfigPowerSave
+    \brief  Wrapper fn to change power save configuration in SME (PMC) module.
+            For BMPS related configuration, this function also updates the CFG
+            and sends a message to FW to pick up the new values. Note: Calling
+            this function only updates the configuration and does not enable 
+            the specified power save mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - Power Saving mode being modified
+    \param  pConfigParams - a pointer to a caller allocated object of type
+            tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams 
+    \return eHalStatus   
+  --------------------------------------------------------------------------*/
+eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
+                                  void *pConfigParams);
+
+/*--------------------------------------------------------------------------
+    \fn sme_GetConfigPowerSave
+    \brief  Wrapper fn to retireve power save configuration in SME (PMC) module
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - Power Saving mode
+    \param  pConfigParams - a pointer to a caller allocated object of type
+            tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams 
+    \return eHalStatus   
+  --------------------------------------------------------------------------*/
+eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
+                                  void *pConfigParams);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SignalPowerEvent
+    \brief  Signals to PMC that a power event has occurred. Used for putting
+            the chip into deep sleep mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  event - the event that has occurred
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_SignalPowerEvent (
+   tHalHandle hHal,
+   tPmcPowerEvent event);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_EnablePowerSave
+    \brief  Enables one of the power saving modes. This API does not cause a
+            device state change. This is purely a configuration API.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - The power saving mode to enable.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_EnablePowerSave (
+   tHalHandle hHal,
+   tPmcPowerSavingMode psMode);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DisablePowerSave
+    \brief   Disables one of the power saving modes.Disabling does not imply
+             that device will be brought out of the current PS mode. This is 
+             purely a configuration API.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - The power saving mode to disable. 
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_DisablePowerSave (
+   tHalHandle hHal,
+   tPmcPowerSavingMode psMode);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StartAutoBmpsTimer
+    \brief  Starts a timer that periodically polls all the registered
+            module for entry into Bmps mode. This timer is started only if BMPS is
+            enabled and whenever the device is in full power.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StopAutoBmpsTimer
+    \brief  Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
+            Stopping the timer does not cause a device state change. Only the timer
+            is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_QueryPowerState
+    \brief  Returns the current power state of the device.
+    \param  hHal - The handle returned by macOpen.
+    \param pPowerState - pointer to location to return power state
+    \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_QueryPowerState (
+   tHalHandle hHal,
+   tPmcPowerState *pPowerState,
+   tPmcSwitchState *pSwWlanSwitchState);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_IsPowerSaveEnabled
+    \brief  Checks if the device is able to enter a particular power save mode
+            This does not imply that the device is in a particular PS mode
+    \param  hHal - The handle returned by macOpen.
+    \param psMode - the power saving mode
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern tANI_BOOLEAN sme_IsPowerSaveEnabled(
+   tHalHandle hHal,
+   tPmcPowerSavingMode psMode);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestFullPower
+    \brief  Request that the device be brought to full power state.
+            Note 1: If "fullPowerReason" specificied in this API is set to
+            eSME_FULL_PWR_NEEDED_BY_HDD, PMC will clear any "buffered wowl" requests
+            and also clear any "buffered BMPS requests by HDD". Assumption is that since
+            HDD is requesting full power, we need to undo any previous HDD requests for 
+            BMPS (using sme_RequestBmps) or WoWL (using sme_EnterWoWL). If the reason is
+            specified anything other than above, the buffered requests for BMPS and WoWL
+            will not be cleared.
+            Note 2: Requesting full power (no matter what the fullPowerReason is) doesn't
+            disable the "auto bmps timer" (if it is enabled) or clear any "buffered uapsd
+            request".
+            Note 3: When the device finally enters Full Power PMC will start a timer 
+            if any of the following holds true:
+            - Auto BMPS mode is enabled
+            - Uapsd request is pending
+            - HDD's request for BMPS is pending
+            - HDD's request for WoWL is pending
+            On timer expiry PMC will attempt to put the device in BMPS mode if following 
+            (in addition to those listed above) holds true:
+            - Polling of all modules through the Power Save Check routine passes
+            - STA is associated to an access point
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \param  - callbackContext -  Cookie to be passed back during callback
+    \param  - fullPowerReason - Reason why this API is being invoked. SME needs to
+              distinguish between BAP and HDD requests
+    \return eHalStatus - status 
+     eHAL_STATUS_SUCCESS - device brought to full power state
+     eHAL_STATUS_FAILURE - device cannot be brought to full power state
+     eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_RequestFullPower (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext,
+   tRequestFullPowerReason fullPowerReason);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestBmps
+    \brief  Request that the device be put in BMPS state. Request will be 
+            accepted only if BMPS mode is enabled and power save check routine
+            passes. Only HDD should invoke this API.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \param  - callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus
+      eHAL_STATUS_SUCCESS - device is in BMPS state
+      eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
+      eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_RequestBmps (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext);
+
+/* ---------------------------------------------------------------------------
+    \fn  sme_SetDHCPTillPowerActiveFlag
+    \brief  Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS 
+            entry by PMC
+    \param  hHal - The handle returned by macOpen.
+  ---------------------------------------------------------------------------*/
+void  sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StartUapsd
+    \brief  Request that the device be put in UAPSD state. If the device is in
+            Full Power it will be put in BMPS mode first and then into UAPSD
+            mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \param  - callbackContext -  Cookie to be passed back during callback
+      eHAL_STATUS_SUCCESS - device is in UAPSD state
+      eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
+      eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
+      eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_StartUapsd (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StopUapsd
+    \brief  Request that the device be put out of UAPSD state. Device will be
+            put in in BMPS state after stop UAPSD completes. Buffered requests for
+            UAPSD will be cleared after this.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus  
+      eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
+      eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_StopUapsd (tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestStandby
+    \brief  Request that the device be put in standby. It is HDD's responsibility
+            to bring the chip to full power and do a discconnect before calling
+            this API. Request for standby will be rejected if STA is associated
+            to an AP.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \param  - callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus  
+      eHAL_STATUS_SUCCESS - device is in Standby mode
+      eHAL_STATUS_FAILURE - device cannot be put in standby mode
+      eHAL_STATUS_PMC_PENDING - device is being put in standby mode
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_RequestStandby (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RegisterPowerSaveCheck
+    \brief  Register a power save check routine that is called whenever
+            the device is about to enter one of the power save modes.
+    \param  hHal - The handle returned by macOpen.
+    \param  checkRoutine -  Power save check routine to be registered
+    \param  callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully registered
+            eHAL_STATUS_FAILURE - not successfully registered  
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_RegisterPowerSaveCheck (
+   tHalHandle hHal, 
+   tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DeregisterPowerSaveCheck
+    \brief  Deregister a power save check routine
+    \param  hHal - The handle returned by macOpen.
+    \param  checkRoutine -  Power save check routine to be deregistered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully deregistered
+            eHAL_STATUS_FAILURE - not successfully deregistered  
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_DeregisterPowerSaveCheck (
+   tHalHandle hHal, 
+   tANI_BOOLEAN (*checkRoutine) (void *checkContext));
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RegisterDeviceStateUpdateInd
+    \brief  Register a callback routine that is called whenever
+            the device enters a new device state (Full Power, BMPS, UAPSD)
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be registered
+    \param  callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully registered
+            eHAL_STATUS_FAILURE - not successfully registered  
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_RegisterDeviceStateUpdateInd (
+   tHalHandle hHal, 
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
+   void *callbackContext);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DeregisterDeviceStateUpdateInd
+    \brief  Deregister a routine that was registered for device state changes
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be deregistered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully deregistered
+            eHAL_STATUS_FAILURE - not successfully deregistered  
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_DeregisterDeviceStateUpdateInd (
+   tHalHandle hHal, 
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
+
+/* ---------------------------------------------------------------------------
+    \fn sme_WowlAddBcastPattern
+    \brief  Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
+            do a pattern match on these patterns when Wowl is enabled during BMPS
+            mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pattern to be added
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot add pattern
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_WowlAddBcastPattern (
+   tHalHandle hHal, 
+   tpSirWowlAddBcastPtrn pattern);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_WowlDelBcastPattern
+    \brief  Delete a pattern that was added for Pattern Byte Matching.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pattern to be deleted
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot delete pattern
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_WowlDelBcastPattern (
+   tHalHandle hHal, 
+   tpSirWowlDelBcastPtrn pattern);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_EnterWowl
+    \brief  This is the API to request entry into WOWL mode. 
+            WoWLAN works on top of BMPS mode. If the device is not in BMPS mode, 
+            SME will will cache the information that WOWL has been requested and
+            attempt to put the device in BMPS first. On entry into BMPS, SME will
+            enter the WOWL mode.
+            Note 1: After WoWL request is accepted, If module other than HDD requests
+            full power BEFORE WoWL request is completed, PMC will buffer the WoWL request
+            and attempt to put the chip into BMPS+WOWL based on a timer.
+            Note 2: Buffered request for WoWL will be cleared immedisately AFTER "enter Wowl"
+            completes or if HDD requests full power or if sme_ExitWoWL API is invoked.
+            Note 3: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
+            will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
+            are required. Currently there is no requirement or use case to support UAPSD
+            and WOWL at the same time.
+            Note 4. Request for WoWL is rejected if there is a pending UAPSD request.
+            Note 5. Request for WoWL is rejected if BMPS is disabled.
+            
+    \param  hHal - The handle returned by macOpen.
+    \param  enterWowlCallbackRoutine -  Callback routine provided by HDD.
+                               Used for success/failure notification by SME
+    \param  enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
+                              at the time of callback.
+    \param  wakeReasonIndCB -  Callback routine provided by HDD.
+                               Used for Wake Reason Indication by SME
+    \param  wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
+                              at the time of callback.
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS  Device is already in WoWLAN mode
+            eHAL_STATUS_FAILURE  Device cannot enter WoWLAN mode.
+            eHAL_STATUS_PMC_PENDING  Request accepted. SME will enable WOWL when BMPS
+                                      mode is entered.
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_EnterWowl (
+    tHalHandle hHal,
+    void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
+    void *enterWowlCallbackContext,
+#ifdef WLAN_WAKEUP_EVENTS
+    void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
+    void *wakeReasonIndCBContext,
+#endif // WLAN_WAKEUP_EVENTS
+    tpSirSmeWowlEnterParams wowlEnterParams);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ExitWowl
+    \brief  This is the SME API exposed to HDD to request exit from WoWLAN mode. 
+            SME will initiate exit from WoWLAN mode and device will be put in BMPS 
+            mode. Any Buffered request for WoWL will be cleared after this API.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Device cannot exit WoWLAN mode. This can happen
+                                  only if the previous "Enter WOWL" transaction has
+                                  not even completed.
+            eHAL_STATUS_SUCCESS  Request accepted to exit WoWLAN mode. 
+  ---------------------------------------------------------------------------*/
+extern eHalStatus sme_ExitWowl (tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamSetKey
+
+    \brief To set encryption key. This function should be called only when connected
+    This is an asynchronous API.
+
+    \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
+
+    \param pRoamId  Upon success return, this is the id caller can use to identify the request in roamcallback
+
+    \return eHalStatus  SUCCESS  Roam callback will be called indicate actually results
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetKey(tHalHandle, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamRemoveKey
+
+    \brief To set encryption key. This is an asynchronous API.
+
+    \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
+
+    \param pRoamId  Upon success return, this is the id caller can use to identify the request in roamcallback
+
+    \return eHalStatus  SUCCESS  Roam callback will be called indicate actually results
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamRemoveKey(tHalHandle, tANI_U8 sessionId, tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId);
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetCountryCode
+
+    \brief To return the current country code. If no country code is applied, default country code is 
+    used to fill the buffer.
+    If 11d supported is turned off, an error is return and the last applied/default country code is used.
+    This is a synchronous API.
+
+    \param pBuf - pointer to a caller allocated buffer for returned country code.
+
+    \param pbLen  For input, this parameter indicates how big is the buffer.
+                   Upon return, this parameter has the number of bytes for country. If pBuf
+                   doesn't have enough space, this function returns
+                   fail status and this parameter contains the number that is needed.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetCountryCode
+
+    \brief To change the current/default country code. 
+    If 11d supported is turned off, an error is return.
+    This is a synchronous API.
+
+    \param pCountry - pointer to a caller allocated buffer for the country code.
+
+    \param pfRestartNeeded  A pointer to caller allocated memory, upon successful return, it indicates
+    whether a reset is required.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ResetCountryCodeInformation
+    \brief this function is to reset the country code current being used back to EEPROM default
+    this includes channel list and power setting. This is a synchronous API.
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetSupportedCountryCode
+    \brief this function is to get a list of the country code current being supported
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, 
+    this has the country code list. 3 bytes for each country code. This may be NULL if
+    caller wants to know the needed byte count.
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetCurrentRegulatoryDomain
+    \brief this function is to get the current regulatory domain. This is a synchronous API.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    SME. The function fails if 11d support is turned off.
+    \param pDomain - Caller allocated buffer to return the current domain.
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetRegulatoryDomain
+    \brief this function is to set the current regulatory domain.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    SME. This is a synchronous API.
+    \param domainId - indicate the domain (defined in the driver) needs to set to.  
+    See v_REGDOMAIN_t for definition
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetRegulatoryDomainForCountry
+
+    \brief To return a regulatory domain base on a country code. This is a synchronous API.
+
+    \param pCountry - pointer to a caller allocated buffer for input country code.
+
+    \param pDomainId  Upon successful return, it is the domain that country belongs to.
+    If it is NULL, returning success means that the country code is known.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId);
+
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetSupportedRegulatoryDomains
+
+    \brief To return a list of supported regulatory domains. This is a synchronous API.
+
+    \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
+
+    \param pNumDomains  For input, this parameter indicates howm many domains pDomains can hold.
+                         Upon return, this parameter has the number for supported domains. If pDomains
+                         doesn't have enough space for all the supported domains, this function returns
+                         fail status and this parameter contains the number that is needed.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains);
+
+//some support functions
+tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal);
+tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal);
+tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal); 
+//Upper layer to get the list of the base channels to scan for passively 11d info from csr
+eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo );
+
+typedef void ( *tSmeChangeCountryCallback)(void *pContext);
+/* ---------------------------------------------------------------------------
+
+    \fn sme_ChangeCountryCode
+
+    \brief Change Country code from upperlayer during WLAN driver operation.
+           This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+
+    \param pCountry New Country Code String
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
+                                  tSmeChangeCountryCallback callback,
+                                  tANI_U8 *pCountry,
+                                  void *pContext,
+                                  void* pVosContext );
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcSignalBtEvent
+    \brief  API to signal Bluetooth (BT) event to the WLAN driver. Based on the
+            BT event type and the current operating mode of Libra (full power,
+            BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
+            would be employed.
+    \param  hHal - The handle returned by macOpen.
+    \param  pBtcBtEvent -  Pointer to a caller allocated object of type tSmeBtEvent
+                           Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  BT Event not passed to HAL. This can happen
+                                   if driver has not yet been initialized or if BTC 
+                                   Events Layer has been disabled.
+            VOS_STATUS_SUCCESS    BT Event passed to HAL 
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtcBtEvent);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcSetConfig
+    \brief  API to change the current Bluetooth Coexistence (BTC) configuration
+            This function should be invoked only after CFG download has completed.
+            Calling it after sme_HDDReadyInd is recommended.
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtcConfig. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  Config not passed to HAL. 
+            VOS_STATUS_SUCCESS  Config passed to HAL 
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcGetConfig
+    \brief  API to retrieve the current Bluetooth Coexistence (BTC) configuration
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
+                            Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetCfgPrivacy
+    \brief  API to set configure privacy parameters
+    \param  hHal - The handle returned by macOpen.
+    \param  pProfile - Pointer CSR Roam profile.
+    \param  fPrivacy - This parameter indicates status of privacy 
+                            
+    \return void
+  ---------------------------------------------------------------------------*/
+void sme_SetCfgPrivacy(tHalHandle hHal, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy);
+
+#if defined WLAN_FEATURE_VOWIFI
+/* ---------------------------------------------------------------------------
+    \fn sme_NeighborReportRequest
+    \brief  API to request neighbor report.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRrmNeighborReq - Pointer to a caller allocated object of type
+                            tRrmNeighborReq. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId, 
+                tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo);
+#endif
+
+//The following are debug APIs to support direct read/write register/memory
+//They are placed in SME because HW cannot be access when in LOW_POWER state
+//AND not connected. The knowledge and synchronization is done in SME
+
+//sme_DbgReadRegister
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue);
+
+//sme_DbgWriteRegister
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue);
+
+//sme_DbgReadMemory
+//Caller needs to validate the input values
+//pBuf caller allocated buffer has the length of nLen
+VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen);
+
+//sme_DbgWriteMemory
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen);
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+//sme_GetFwVersion
+VOS_STATUS sme_GetFwVersion (tHalHandle hHal,FwVersionInfo *pVersion);
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
+                                           tSirVersionType *pVersion);
+VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
+                                           tSirVersionType *pVersion);
+VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize);
+VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize);
+#endif
+eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
+                                    csrRoamCompleteCallback callback,
+                                    void *pContext);
+
+#ifdef FEATURE_WLAN_WAPI
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamSetBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to provde SME the BKID 
+    candidate list.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after 
+    it is opened (by calling halOpen).
+    \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
+    \param numItems - a variable that has the number of tBkidCacheInfo allocated 
+    when retruning, this is the number of items put into pBKIDCache
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+    big enough and pNumItems has the number of tBkidCacheInfo.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
+                                 tANI_U32 numItems );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to request SME to return its 
+    BKID cache.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after 
+    it is opened (by calling halOpen).
+    \param pNum - caller allocated memory that has the space of the number of 
+    tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries 
+    in SME cache.
+    \param pBkidCache - Caller allocated memory that contains BKID cache, if any, 
+    upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+    big enough.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
+                                tBkidCacheInfo *pBkidCache);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetNumBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to request SME to return the 
+    number of BKID cache entries.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after 
+    it is opened (by calling halOpen).
+    \return tANI_U32 - the number of BKID cache entries.
+  ---------------------------------------------------------------------------*/
+tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetBKIDCandidateList
+    \brief a wrapper function to return the BKID candidate list
+    \param pBkidList - caller allocated buffer point to an array of 
+                        tBkidCandidateInfo
+    \param pNumItems - pointer to a variable that has the number of 
+                       tBkidCandidateInfo allocated when retruning, this is 
+                       either the number needed or number of items put into 
+                       pPmkidList
+    \return eHalStatus - when fail, it usually means the buffer allocated is not 
+                         big enough and pNumItems
+    has the number of tBkidCandidateInfo.
+    \Note: pNumItems is a number of tBkidCandidateInfo, 
+           not sizeof(tBkidCandidateInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
+                                        tBkidCandidateInfo *pBkidList, 
+                                        tANI_U32 *pNumItems );
+#endif /* FEATURE_WLAN_WAPI */
+
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamUpdateAPWPSIE
+
+    \brief To update AP's WPS IE. This function should be called after SME AP session is created
+    This is an asynchronous API.
+
+    \param pAPWPSIES - pointer to a caller allocated object of tCsrRoamAPWPSIES
+
+    \return eHalStatus – SUCCESS – Roam callback will be called indicate actually results
+
+                         FAILURE or RESOURCES – The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+
+eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES);
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamUpdateAPWPARSNIEs
+
+    \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
+    This is an asynchronous API.
+
+    \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
+
+    \return eHalStatus – SUCCESS – 
+
+                         FAILURE or RESOURCES – The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie);
+
+#endif
+
+/* ---------------------------------------------------------------------------
+  \fn sme_sendBTAmpEvent
+  \brief API to send the btAMPstate to FW
+  \param  hHal - The handle returned by macOpen.
+  \param  btAmpEvent -- btAMP event
+  \return eHalStatus – SUCCESS –
+
+                         FAILURE or RESOURCES – The API finished and failed.
+
+--------------------------------------------------------------------------- */
+
+eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent);
+
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetHostOffload
+    \brief  API to set the host offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the offload request.
+    \return eHalStatus
+   ---------------------------------------------------------------------------*/
+eHalStatus sme_SetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetKeepAlive
+    \brief  API to set the Keep Alive feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the Keep Alive request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest);
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_AbortMacScan
+    \brief  API to cancel MAC scan.
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_AbortMacScan(tHalHandle hHal);
+
+/* ----------------------------------------------------------------------------
+   \fn sme_GetOperationChannel
+   \brief API to get current channel on which STA is parked
+   this function gives channel information only of infra station or IBSS station.
+   \param hHal and poiter to memory location 
+   \returns eHAL_STATUS_SUCCESS
+            eHAL_STATUS_FAILURE
+-------------------------------------------------------------------------------*/
+eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel);
+
+#ifdef WLAN_FEATURE_P2P
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RegisterMgtFrame
+
+    \brief To register managment frame of specified type and subtype. 
+    \param frameType - type of the frame that needs to be passed to HDD.
+    \param matchData - data which needs to be matched before passing frame 
+                       to HDD. 
+    \param matchDataLen - Length of matched data.
+    \return eHalStatus 
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, 
+                     tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_DeregisterMgtFrame
+
+    \brief To De-register managment frame of specified type and subtype. 
+    \param frameType - type of the frame that needs to be passed to HDD.
+    \param matchData - data which needs to be matched before passing frame 
+                       to HDD. 
+    \param matchDataLen - Length of matched data.
+    \return eHalStatus 
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, 
+                     tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen);
+#endif
+
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureRxpFilter
+
+  \brief 
+    SME will pass this request to lower mac to set/reset the filter on RXP for
+    multicast & broadcast traffic.
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
+    Basically to enable/disable the filter (to filter "all" mcbc traffic) based
+    on this param. In future we can use this as a mask to set various types of
+    filters as suggested below:
+    FILTER_ALL_MULTICAST:
+    FILTER_ALL_BROADCAST:
+    FILTER_ALL_MULTICAST_BROADCAST:
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal, 
+                              tpSirWlanSetRxpFilters  wlanRxpFilterParam);
+
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureAppsCpuWakeupState
+
+  \brief 
+    SME will pass this request to lower mac to dynamically adjusts the listen
+    interval based on the WLAN/MSM activity. This feature is named as
+    Telescopic Beacon wakeup feature.
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    isAppsAwake- Depicts the state of the Apps CPU
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureAppsCpuWakeupState( tHalHandle hHal, tANI_BOOLEAN  isAppsAwake);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureSuspendInd
+
+  \brief 
+    SME will pass this request to lower mac to Indicate that the wlan needs to 
+    be suspended
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    wlanSuspendParam- Depicts the wlan suspend params
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal, 
+                             tpSirWlanSuspendParam  wlanSuspendParam);
+
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureResumeReq
+
+  \brief 
+    SME will pass this request to lower mac to Indicate that the wlan needs to 
+    be Resumed
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    wlanResumeParam- Depicts the wlan resume params
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureResumeReq( tHalHandle hHal, 
+                             tpSirWlanResumeParam  wlanResumeParam);
+
+#endif
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetInfraSessionId
+
+    \brief To get the session ID for infra session, if connected
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+
+    \return sessionid, -1 if infra session is not connected
+
+  -------------------------------------------------------------------------------*/
+tANI_S8 sme_GetInfraSessionId(tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetInfraOperationChannel
+
+    \brief To get the operating channel for infra session, if connected
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+    \param sessionId - the sessionId returned by sme_OpenSession.
+
+    \return operating channel, 0 if infra session is not connected
+
+  -------------------------------------------------------------------------------*/
+tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId);
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetConcurrentOperationChannel
+
+    \brief To get the operating channel for other concurrent sessions, if connected
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+    \param currentPersona - persona that is trying to come up.
+
+    \return operating channel, 0 if infra session is not connected
+
+  -------------------------------------------------------------------------------*/
+tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_AbortMacScan
+    \brief  API to cancel MAC scan.
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_AbortMacScan(tHalHandle hHal);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetCfgValidChannels
+    \brief  API to get valid channel list
+    \param  hHal - The handle returned by macOpen.
+    \param  aValidChannels -  Pointer to the valid channel list
+    \param  len -  valid channel list length
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetPreferredNetworkList
+    \brief  API to set the Preferred Network List Offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetRSSIFilter
+    \brief  API to set RSSI Filter feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold);
+
+/******************************************************************************
+*
+* Name: sme_PreferredNetworkFoundInd
+*
+* Description:
+*    Invoke Preferred Network Found Indication 
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    pMsg - found network description
+* 
+* Returns: eHalStatus
+*
+******************************************************************************/
+eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetPowerParams
+    \brief  API to set Power Parameters 
+    \param  hHal - The handle returned by macOpen.
+    \param  pwParams -  Pointer to the power parameters requested.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetTxPerTracking
+    \brief  Set Tx PER tracking configuration parameters
+    \param  hHal - The handle returned by macOpen.
+    \param  pTxPerTrackingParam - Tx PER configuration parameters
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetTxPerTracking (
+   tHalHandle hHal,
+   void (*pCallbackfn) (void *pCallbackContext),
+   void *pCallbackContext,
+   tpSirTxPerTrackingParam pTxPerTrackingParam);
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/* ---------------------------------------------------------------------------
+    \fn sme_ReceiveFilterSetFilter
+    \brief  API to set 8023 Multicast Address List
+    \param  hHal - The handle returned by macOpen.
+    \param  pMulticastAddrs - Pointer to the Multicast Address List
+    \return eHalStatus   
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_8023MulticastList(tHalHandle hHal, tpSirRcvFltMcAddrList pMulticastAddrs);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ReceiveFilterSetFilter
+    \brief  API to set Receive Packet Filter
+    \param  hHal - The handle returned by macOpen.
+    \param  pRcvPktFilterCfg - Receive Packet Filter parameter
+    \return eHalStatus   
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetFilterMatchCount
+    \brief  API to get D0 PC Filter Match Count
+    \param  hHal - The handle returned by macOpen 
+    \param  callbackRoutine - Callback routine invoked to receive Packet Coalescing Filter Match Count
+    \param  callbackContext - Cookie to be passed back during callback 
+    \return eHalStatus   
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetFilterMatchCount(tHalHandle hHal, 
+                                   FilterMatchCountCallback callbackRoutine, 
+                                   void *callbackContext );
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ReceiveFilterClearFilter
+    \brief  API to clear Receive Packet Filter
+    \param  hHal - The handle returned by macOpen.
+    \param  pRcvFltPktClearParam - Receive Packet Filter Clear parameter
+    \return eHalStatus   
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal,
+                                        tpSirRcvFltPktClearParam pRcvFltPktClearParam);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+/* ---------------------------------------------------------------------------
+
+    \fn sme_IsChannelValid
+    \brief To check if the channel is valid for currently established domain
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+    \param channel - channel to verify
+
+    \return TRUE/FALSE, TRUE if channel is valid
+
+  -------------------------------------------------------------------------------*/
+tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetFreqBand
+    \brief  Used to set frequency band.
+    \param  hHal
+    \eBand  band value to be configured
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetFreqBand
+    \brief  Used to get the current band settings.
+    \param  hHal
+    \pBand  pointer to hold the current band value
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand);
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetTxPerTracking
+    \brief  Set Tx PER tracking configuration parameters
+    \param  hHal - The handle returned by macOpen.
+    \param  pTxPerTrackingParam - Tx PER configuration parameters
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetTxPerTracking (
+   tHalHandle hHal,
+   void (*pCallbackfn) (void *pCallbackContext),
+   void *pCallbackContext,
+   tpSirTxPerTrackingParam pTxPerTrackingParam);
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/* ---------------------------------------------------------------------------
+    \fn sme_SetGTKOffload
+    \brief  API to set GTK offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the GTK offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetGTKOffload
+    \brief  API to get GTK offload information.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the GTK offload response.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext );
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg);
+#endif // WLAN_WAKEUP_EVENTS
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetTxPerTracking
+    \brief  Set Tx PER tracking configuration parameters
+    \param  hHal - The handle returned by macOpen.
+    \param  pTxPerTrackingParam - Tx PER configuration parameters
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetTxPerTracking (
+   tHalHandle hHal,
+   void (*pCallbackfn) (void *pCallbackContext),
+   void *pCallbackContext,
+   tpSirTxPerTrackingParam pTxPerTrackingParam);
+
+
+//return frequency for a particular channel
+tANI_U16 sme_ChnToFreq(tANI_U8 chanNum);
+
+tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel);
+
+#if defined WLAN_FEATURE_P2P_INTERNAL
+
+eHalStatus sme_p2pResetSession(tHalHandle hHal, tANI_U8 HDDSessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn sme_p2pFlushDeviceList
+    \brief  Remove cached P2P result from scan results
+    \param  hHal - The handle returned by macOpen.
+    \param  HDDSessionId - HDD's sessionId. Currently unused.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_p2pFlushDeviceList(tHalHandle hHal, tANI_U8 HDDSessionId);
+
+eHalStatus sme_p2pGetResultFilter(tHalHandle hHal, tANI_U8 HDDSessionId,
+                              tCsrScanResultFilter *pFilter);
+
+#endif //#if defined WLAN_FEATURE_P2P_INTERNAL
+   
+/* ---------------------------------------------------------------------------
+    \fn sme_SetMaxTxPower
+    \brief  Used to set the Maximum Transmit Power dynamically. Note: this
+    setting will not persist over reboots
+    \param  hHal
+    \param pBssid  BSSID to set the power cap for
+    \param pBssid  pSelfMacAddress self MAC Address
+    \param pBssid  power to set in dB
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid, 
+                             tSirMacAddr pSelfMacAddress, v_S7_t dB);
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+
+    \fn sme_HideSSID
+
+    \brief Enable/Disables hidden SSID dynamically. Note: this setting will
+    not persist over reboots.
+
+    \param hHal
+    \param sessionId 
+    \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
+    \- return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden);
+#endif
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetTmLevel
+    \brief  Set Thermal Mitigation Level to RIVA
+    \param  hHal - The handle returned by macOpen.
+    \param  newTMLevel - new Thermal Mitigation Level
+    \param  tmMode - Thermal Mitigation handle mode, default 0
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode);
+
+/*---------------------------------------------------------------------------
+
+  \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
+  Host and FW.
+
+  \param  hHal - HAL handle for device
+
+  \return NONE
+
+---------------------------------------------------------------------------*/
+void sme_featureCapsExchange(tHalHandle hHal);
+
+#endif //#if !defined( __SME_API_H )
diff --git a/CORE/SME/inc/sme_FTApi.h b/CORE/SME/inc/sme_FTApi.h
new file mode 100644
index 0000000..30465c6
--- /dev/null
+++ b/CORE/SME/inc/sme_FTApi.h
@@ -0,0 +1,84 @@
+/*
+ * 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( __SME_FTAPI_H )
+#define __SME_FTAPI_H
+
+#include <limFTDefs.h>
+#include <palTimer.h>
+
+/**=========================================================================
+  
+  \brief macros and prototype for SME APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+typedef enum eFTIEState
+{
+    eFT_START_READY,                // Start before and after 11r assoc
+    eFT_AUTH_REQ_READY,             // When we have recvd the 1st or nth auth req
+    eFT_WAIT_AUTH2,                 // Sent auth1 and waiting auth2
+    eFT_AUTH_COMPLETE,              // We are now ready for FT phase, send auth1, recd auth2
+    eFT_REASSOC_REQ_WAIT,           // Now we have sent Auth Rsp to the supplicant and waiting
+                                    // Reassoc Req from the supplicant.
+    eFT_SET_KEY_WAIT,               // We have received the Reassoc request from 
+                                    // supplicant. Waiting for the keys.
+} tFTIEStates;
+
+
+typedef struct sFTSMEContext
+{
+    tANI_U8           *auth_ft_ies;
+    tANI_U32          auth_ft_ies_length;
+
+    tANI_U8           *reassoc_ft_ies;
+    tANI_U16          reassoc_ft_ies_length;
+
+    // Pre-Auth info
+    tFTIEStates       FTState;               // The state of FT in the current 11rAssoc
+    tSirMacAddr       preAuthbssId;          // BSSID to preauth to
+    tANI_U32          smeSessionId;
+
+    // Saved pFTPreAuthRsp
+    tpSirFTPreAuthRsp psavedFTPreAuthRsp;
+
+    // Time to trigger reassoc once pre-auth is successful
+    tPalTimerHandle   preAuthReassocIntvlTimer;
+
+} tftSMEContext, *tpftSMEContext;
+
+/*--------------------------------------------------------------------------
+  Prototype functions
+  ------------------------------------------------------------------------*/
+void sme_FTOpen(tHalHandle hHal);
+void sme_FTClose(tHalHandle hHal);
+void sme_SetFTIEs( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *ft_ies, tANI_U16 ft_ies_length );
+eHalStatus sme_FTUpdateKey( tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo );
+void csrFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp );
+void sme_GetFTPreAuthResponse( tHalHandle hHal, tANI_U8 *ft_ies, tANI_U32 ft_ies_ip_len, tANI_U16 *ft_ies_length );
+void sme_GetRICIEs( tHalHandle hHal, tANI_U8 *ric_ies, tANI_U32 ric_ies_ip_len, tANI_U32 *ric_ies_length );
+void sme_PreauthReassocIntvlTimerCallback(void *context);
+
+
+#endif //#if !defined( __SME_FTAPI_H )
diff --git a/CORE/SME/inc/sme_QosApi.h b/CORE/SME/inc/sme_QosApi.h
new file mode 100644
index 0000000..d6614fd
--- /dev/null
+++ b/CORE/SME/inc/sme_QosApi.h
@@ -0,0 +1,356 @@
+/*
+ * 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( __SME_QOSAPI_H )
+#define __SME_QOSAPI_H
+
+
+/**=========================================================================
+  
+  \file  sme_QosApi.h
+  
+  \brief prototype for SME QoS APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "aniGlobal.h"
+#include "sirApi.h"
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various QoS status types that would be reported to HDD
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   //async: once PE notifies successful TSPEC negotiation, or CSR notifies for
+   //successful reassoc, notifies HDD with current QoS Params
+   SME_QOS_STATUS_SETUP_SUCCESS_IND = 0, 
+   //sync: only when App asked for APSD & it's already set with ACM = 0
+   SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY,
+   //both: sync or async: in case of async notifies HDD with current QoS Params
+   SME_QOS_STATUS_SETUP_FAILURE_RSP, 
+   //sync
+   SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP, 
+   //sync: AP doesn't support QoS (WMM)
+   SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP, 
+   //sync: either req has been sent down to PE or just buffered in SME
+   SME_QOS_STATUS_SETUP_REQ_PENDING_RSP, 
+   //async: in case of flow aggregation, if the new TSPEC negotiation is 
+   //successful, OR, 
+   //notify existing flows that TSPEC is modified with current QoS Params
+   SME_QOS_STATUS_SETUP_MODIFIED_IND,
+   //sync: no APSD asked for & ACM = 0
+   SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP, 
+   //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or 
+   //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
+   //put the module in UAPSD mode right away (eHAL_STATUS_PMC_PENDING)
+   SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING, 
+   //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or 
+   //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
+   //put the module in UAPSD mode at all (eHAL_STATUS_FAILURE)
+   SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED, 
+
+   //sync: req has been sent down to PE in case of delts or addts for remain 
+   // flows, OR if the AC doesn't have APSD or ACM
+   //async: once the downgrade req for QoS params is successful
+   SME_QOS_STATUS_RELEASE_SUCCESS_RSP = 100,
+   //both: sync or async: in case of async notifies HDD with current QoS Params
+   SME_QOS_STATUS_RELEASE_FAILURE_RSP,
+   //async: AP sent DELTS indication
+   SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
+   //sync: an addts req has been sent down to PE to downgrade the QoS params or 
+   // just buffered in SME
+   SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP, 
+   //sync
+   SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP, 
+
+   //async: for QoS modify request if modification is successful, notifies HDD 
+   // with current QoS Params
+   SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND = 200,
+   //sync: only when App asked for APSD & it's already set with ACM = 0
+   SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY,
+   //both: sync or async: in case of async notifies HDD with current QoS Params
+   SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP,
+   //sync: either req has been sent down to PE or just buffered in SME
+   SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP,
+   //sync: no APSD asked for & ACM = 0
+   SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP, 
+   //sync
+   SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP, 
+   //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or 
+   //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
+   //put the module in UAPSD mode right away (eHAL_STATUS_PMC_PENDING)
+   SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING, 
+   //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or 
+   //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
+   //put the module in UAPSD mode at all (eHAL_STATUS_FAILURE)
+   SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED,
+   //sync: STA is handing off to a new AP
+   SME_QOS_STATUS_HANDING_OFF = 300,
+   //async:powersave mode changed by PMC from UAPSD to Full power
+   SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND = 400,
+   //async:powersave mode changed by PMC from Full power to UAPSD
+   SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND,
+   
+}sme_QosStatusType;
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various User priority (UP) types
+   
+   From 802.1D/802.11e/WMM specifications (all refer to same table)
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_WMM_UP_BE      = 0,
+   SME_QOS_WMM_UP_BK      = 1,
+   SME_QOS_WMM_UP_RESV    = 2,    /* Reserved                              */
+   SME_QOS_WMM_UP_EE      = 3,
+   SME_QOS_WMM_UP_CL      = 4,
+   SME_QOS_WMM_UP_VI      = 5,
+   SME_QOS_WMM_UP_VO      = 6,
+   SME_QOS_WMM_UP_NC      = 7,
+
+   SME_QOS_WMM_UP_MAX
+
+}sme_QosWmmUpType;
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various TSPEC directions
+   
+   From 802.11e/WMM specifications
+---------------------------------------------------------------------------*/
+
+typedef enum
+{
+   SME_QOS_WMM_TS_DIR_UPLINK   = 0,
+   SME_QOS_WMM_TS_DIR_DOWNLINK = 1,
+   SME_QOS_WMM_TS_DIR_RESV     = 2,   /* Reserved                          */
+   SME_QOS_WMM_TS_DIR_BOTH     = 3,
+
+}sme_QosWmmDirType;
+
+/*---------------------------------------------------------------------------
+   Enumeration of the various TSPEC ack policies.
+   
+   From 802.11 WMM specification
+---------------------------------------------------------------------------*/
+
+typedef enum
+{
+   SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK   = 0,
+   SME_QOS_WMM_TS_ACK_POLICY_RESV1 = 1,
+   SME_QOS_WMM_TS_ACK_POLICY_RESV2     = 2,   /* Reserved                          */
+   SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK     = 3,
+
+}sme_QosWmmAckPolicyType;
+
+/*---------------------------------------------------------------------------
+   TS Info field in the WMM TSPEC
+   
+   See suggestive values above
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t              burst_size_defn;
+   sme_QosWmmAckPolicyType    ack_policy;
+   sme_QosWmmUpType    up;        /* User priority                    */
+   v_U8_t              psb;       /* power-save bit                   */
+   sme_QosWmmDirType   direction; /* Direction                        */
+   v_U8_t              tid;       /* TID : To be filled up by SME-QoS */
+} sme_QosWmmTsInfoType;
+
+/*---------------------------------------------------------------------------
+    The WMM TSPEC Element (from the WMM spec)
+---------------------------------------------------------------------------*/
+typedef struct
+{ 
+  sme_QosWmmTsInfoType            ts_info;
+  v_U16_t                         nominal_msdu_size;
+  v_U16_t                         maximum_msdu_size;
+  v_U32_t                         min_service_interval;
+  v_U32_t                         max_service_interval;
+  v_U32_t                         inactivity_interval;
+  v_U32_t                         suspension_interval;
+  v_U32_t                         svc_start_time;
+  v_U32_t                         min_data_rate;
+  v_U32_t                         mean_data_rate;
+  v_U32_t                         peak_data_rate;
+  v_U32_t                         max_burst_size;
+  v_U32_t                         delay_bound;
+  v_U32_t                         min_phy_rate;
+  v_U16_t                         surplus_bw_allowance;
+  v_U16_t                         medium_time;
+} sme_QosWmmTspecInfo;
+
+
+/*-------------------------------------------------------------------------- 
+                         External APIs
+  ------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCallback() - This is a callback function which is registered 
+   per flow while HDD is requesting for QoS. Used for any notification for the 
+   flow (i.e. setup success/failure/release) which needs to be sent to HDD. HDD
+   will notify the application in turn, if needed.
+  
+  \param hHal - The handle returned by macOpen.
+  \param HDDcontext - A cookie passed by HDD during QoS setup, to be used by SME 
+                      during any QoS notification (through the callabck) to HDD 
+  \param pCurrentQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM 
+                           TSPEC related info as defined above, fed back to HDD
+  \param status - The status of the flow running on an AC. It could be of 
+                  sme_QosStatusType
+  
+  \return eHAL_STATUS_SUCCESS - Callback invoke successful.
+  
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+typedef eHalStatus (*sme_QosCallback)(tHalHandle hHal, void * HDDcontext, 
+                                      sme_QosWmmTspecInfo * pCurrentQoSInfo, 
+                                      sme_QosStatusType status,
+                                      v_U32_t QosFlowID);   
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetupReq() - The SME QoS API exposed to HDD to request for QoS 
+  on a particular AC. This function should be called after a link has been 
+  established, i.e. STA is associated with an AP etc. If the request involves 
+  admission control on the requested AC, HDD needs to provide the necessary 
+  Traffic Specification (TSPEC) parameters otherwise SME is going to use the
+  default params.
+  
+  \param hHal - The handle returned by macOpen.
+  \param sessionId - sessionId returned by sme_OpenSession. Current QOS code doesn't 
+                     support multiple session. This function returns failure when different
+                     sessionId is passed in before calling sme_QosReleaseReq.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QoSCallback - The callback which is registered per flow while 
+                       requesting for QoS. Used for any notification for the 
+                       flow (i.e. setup success/failure/release) which needs to 
+                       be sent to HDD
+  \param HDDcontext - A cookie passed by HDD to be used by SME during any QoS 
+                      notification (through the callabck) to HDD 
+  \param UPType - Useful only if HDD or any other upper layer module (BAP etc.)
+                  looking for implicit QoS setup, in that 
+                  case, the pQoSInfo will be NULL & SME will know about the AC
+                  (from the UP provided in this param) QoS is requested on
+  \param pQosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+                  
+  \return SME_QOS_STATUS_SETUP_SUCCESS - Setup request processed successfully.
+  
+          Other status means Setup request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosSetupReq(tHalHandle hHal, tANI_U32 sessionId,
+                                  sme_QosWmmTspecInfo * pQoSInfo,
+                                  sme_QosCallback QoSCallback, void * HDDcontext,
+                                  sme_QosWmmUpType UPType, v_U32_t * pQosFlowID);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosModifyReq() - The SME QoS API exposed to HDD to request for 
+  modification of certain QoS params on a flow running on a particular AC. 
+  This function should be called after a link has been established, i.e. STA is 
+  associated with an AP etc. & a QoS setup has been succesful for that flow. 
+  If the request involves admission control on the requested AC, HDD needs to 
+  provide the necessary Traffic Specification (TSPEC) parameters & SME might
+  start the renegotiation process through ADDTS.
+  
+  \param hHal - The handle returned by macOpen.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow has 
+                     been successful already
+                  
+  \return SME_QOS_STATUS_SETUP_SUCCESS - Modification request processed 
+                                         successfully.
+  
+          Other status means request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosModifyReq(tHalHandle hHal, 
+                                   sme_QosWmmTspecInfo * pQoSInfo,
+                                   v_U32_t QosFlowID);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosReleaseReq() - The SME QoS API exposed to HDD to request for 
+  releasing a QoS flow running on a particular AC. This function should be 
+  called only if a QoS is set up with a valid FlowID. HDD sould invoke this 
+  API only if an explicit request for QoS release has come from Application 
+  
+  \param hHal - The handle returned by macOpen.
+  \param QosFlowID - Identification per flow running on each AC generated by SME 
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+  
+  \return SME_QOS_STATUS_RELEASE_SUCCESS - Release request processed 
+                                           successfully.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosReleaseReq(tHalHandle hHal, v_U32_t QosFlowID);
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosIsTSInfoAckPolicyValid() - The SME QoS API exposed to HDD to 
+  check if TS info ack policy field can be set to "HT-immediate block acknowledgement" 
+  
+  \param pMac - The handle returned by macOpen.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info, provided by HDD
+  \param sessionId - sessionId returned by sme_OpenSession.
+  
+  \return VOS_TRUE - Current Association is HT association and so TS info ack policy
+                     can be set to "HT-immediate block acknowledgement"
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_BOOL_t sme_QosIsTSInfoAckPolicyValid(tpAniSirGlobal pMac,
+    sme_QosWmmTspecInfo * pQoSInfo,
+    v_U8_t sessionId);
+
+#endif //#if !defined( __SME_QOSAPI_H )
diff --git a/CORE/SME/inc/sme_RrmApi.h b/CORE/SME/inc/sme_RrmApi.h
new file mode 100644
index 0000000..9b105b2
--- /dev/null
+++ b/CORE/SME/inc/sme_RrmApi.h
@@ -0,0 +1,68 @@
+/*
+ * 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( __SMERRMAPI_H )
+#define __SMERRMAPI_H
+
+
+/**=========================================================================
+  
+  \file  sme_RrmApi.h
+  
+  \brief prototype for SME RRM APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_lock.h"
+#include "vos_trace.h"
+#include "vos_memory.h"
+#include "vos_types.h"
+#include "aniGlobal.h"
+#include "sirApi.h"
+#include "smeInternal.h"
+#include "smeRrmInternal.h"
+
+
+//APIs
+eHalStatus sme_RrmMsgProcessor( tpAniSirGlobal pMac,  v_U16_t msg_type, 
+                                void *pMsgBuf);
+
+VOS_STATUS rrmClose (tpAniSirGlobal pMac);
+VOS_STATUS rrmReady (tpAniSirGlobal pMac);
+VOS_STATUS rrmOpen (tpAniSirGlobal pMac);
+VOS_STATUS rrmChangeDefaultConfigParam(tpAniSirGlobal pMac, tpRrmConfigParam pRrmConfig);
+VOS_STATUS sme_RrmNeighborReportRequest(tpAniSirGlobal pMac, tANI_U8 sessionId, tpRrmNeighborReq pNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo);
+
+tRrmNeighborReportDesc* smeRrmGetFirstBssEntryFromNeighborCache( tpAniSirGlobal pMac);
+tRrmNeighborReportDesc* smeRrmGetNextBssEntryFromNeighborCache( tpAniSirGlobal pMac, tpRrmNeighborReportDesc pBssEntry);
+
+
+#endif
diff --git a/CORE/SME/inc/smsDebug.h b/CORE/SME/inc/smsDebug.h
new file mode 100644
index 0000000..9d91493
--- /dev/null
+++ b/CORE/SME/inc/smsDebug.h
@@ -0,0 +1,45 @@
+/*
+ * 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 cssDebug.h
+  
+    Define debug log interface for SMS.
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated
+ 
+   ========================================================================== */
+   
+#ifndef SMS_DEBUG_H__
+#define SMS_DEBUG_H__
+
+//#include <stdio.h>
+//#include <stdarg.h>
+
+#include "utilsApi.h"
+#include "sirDebug.h"
+
+void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...); 
+
+#endif // __HAL_DEBUG_H__
diff --git a/CORE/SME/inc/wlan_ps_wow_diag.h b/CORE/SME/inc/wlan_ps_wow_diag.h
new file mode 100644
index 0000000..0291923
--- /dev/null
+++ b/CORE/SME/inc/wlan_ps_wow_diag.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.
+ */
+
+#ifndef _WLAN_PS_WOW_DIAG_H_
+#define _WLAN_PS_WOW_DIAG_H_
+
+
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT 
+
+typedef enum
+{
+   WLAN_BMPS_ENTER_REQ =0,
+   WLAN_UAPSD_START_REQ =1,
+   WLAN_UAPSD_STOP_REQ =2,
+   WLAN_ENTER_STANDBY_REQ =3,
+   WLAN_ENTER_DEEP_SLEEP_REQ =4,
+   WLAN_START_BMPS_AUTO_TIMER_REQ =5,
+   WLAN_STOP_BMPS_AUTO_TIMER_REQ =6,
+   WLAN_IMPS_ENTER_REQ =7,
+   WLAN_ENTER_FULL_POWER_REQ =8,
+   WLAN_PMC_CURRENT_STATE =9,
+   WLAN_PS_MODE_ENABLE_REQ =10,
+   WLAN_PS_MODE_DISABLE_REQ =11,
+   WLAN_WINMOB_D_POWER_STATE =12,
+   WLAN_BMPS_DTIM_PERIOD =13,
+   WLAN_BMPS_FINAL_LI =14,
+   WLAN_BMPS_SET_CONFIG =15,
+
+} wlan_ps_evt_subtype_t;
+
+// maps directly to eRequestFullPowerReason
+typedef enum
+{
+   WLAN_MISSED_BEACON_IND_RCVD,    /* PE received a MAX_MISSED_BEACON_IND */
+   WLAN_BMPS_STATUS_IND_RCVD,      /* PE received a SIR_HAL_BMPS_STATUS_IND */
+   WLAN_BMPS_MODE_DISABLED,        /* BMPS mode was disabled by HDD in SME */
+   WLAN_LINK_DISCONNECTED_BY_HDD,  /* Link has been disconnected requested by HDD */
+   WLAN_LINK_DISCONNECTED_BY_OTHER,/* Disconnect due to linklost or requested by peer */
+   WLAN_FULL_PWR_NEEDED_BY_HDD,    /* HDD request full power for some reason */
+   WLAN_FULL_PWR_NEEDED_BY_BAP,    /* BAP request full power for BT_AMP */
+   WLAN_FULL_PWR_NEEDED_BY_CSR,    /* CSR requests full power */
+   WLAN_FULL_PWR_NEEDED_BY_QOS,    /* QOS requests full power */
+   WLAN_REASON_OTHER               /* No specific reason. General reason code */ 
+
+} wlan_ps_full_power_request_reason_t;
+
+// maps directly to ePmcState
+typedef enum 
+{
+   WLAN_PMC_STOPPED, /* PMC is stopped */
+   WLAN_PMC_FULL_POWER, /* full power */
+   WLAN_PMC_LOW_POWER, /* low power */
+   WLAN_PMC_REQUEST_IMPS,  /* requesting IMPS */
+   WLAN_PMC_IMPS,  /* in IMPS */
+   WLAN_PMC_REQUEST_BMPS,  /* requesting BMPS */
+   WLAN_PMC_BMPS,  /* in BMPS */
+   WLAN_PMC_REQUEST_FULL_POWER,  /* requesting full power */
+   WLAN_PMC_REQUEST_START_UAPSD,  /* requesting Start UAPSD */
+   WLAN_PMC_REQUEST_STOP_UAPSD,  /* requesting Stop UAPSD */
+   WLAN_PMC_UAPSD,           /* in UAPSD */
+   WLAN_PMC_REQUEST_STANDBY,  /* requesting standby mode */
+   WLAN_PMC_STANDBY,  /* in standby mode */
+   WLAN_PMC_REQUEST_ENTER_WOWL, /* requesting enter WOWL */
+   WLAN_PMC_REQUEST_EXIT_WOWL,  /* requesting exit WOWL */
+   WLAN_PMC_WOWL                /* Chip in WOWL mode */
+
+} wlan_ps_pmc_current_state_t;
+
+// maps directly to ePmcPowerSavingMode
+typedef enum
+{
+   WLAN_IDLE_MODE_POWER_SAVE,  /* Idle Mode Power Save (IMPS) */
+   WLAN_BEACON_MODE_POWER_SAVE,  /* Beacon Mode Power Save (BMPS) */
+   WLAN_SPATIAL_MULTIPLEX_POWER_SAVE,  /* Spatial Multiplexing Power Save (SMPS) */
+   WLAN_UAPSD_MODE_POWER_SAVE,  /* Unscheduled Automatic Power Save Delivery Mode */
+   WLAN_STANDBY_MODE_POWER_SAVE,  /* Standby Power Save Mode */
+   WLAN_WOWL_MODE_POWER_SAVE  /* Wake-on-Wireless LAN Power Save Mode */
+
+} wlan_ps_enable_disable_ps_mode_t;
+
+typedef enum
+{
+   WLAN_D0,
+   WLAN_D1,
+   WLAN_D2,
+   WLAN_D3,
+   WLAN_D4
+
+} wlan_ps_winmob_d_power_state_t;
+
+typedef enum
+{
+   WLAN_WOW_ENTER_REQ =0,
+   WLAN_WOW_EXIT_REQ =1,
+   WLAN_WOW_DEL_PTRN_REQ =2,
+   WLAN_WOW_WAKEUP = 3
+
+} wlan_ps_wow_evt_subtype_t;
+
+typedef enum
+{
+   WLAN_WOW_TYPE_NONE,
+   WLAN_WOW_TYPE_MAGIC_PKT_ONLY,
+   WLAN_WOW_TYPE_PTRN_BYTE_MATCH_ONLY,
+   WLAN_WOW_TYPE_MAGIC_PKT_PTRN_BYTE_MATCH,
+
+} wlan_ps_wow_type_t;
+
+typedef enum
+{
+   WLAN_WOW_MAGIC_PKT_MATCH,
+   WLAN_WOW_PTRN_BYTE_MATCH
+
+} wlan_ps_wos_wakeup_cause_t;
+
+#endif // FEATURE_WLAN_DIAG_SUPPORT
+
+#endif // _WLAN_PS_WOW_DIAG_H_
+
diff --git a/CORE/SME/src/QoS/sme_Qos.c b/CORE/SME/src/QoS/sme_Qos.c
new file mode 100644
index 0000000..7729594
--- /dev/null
+++ b/CORE/SME/src/QoS/sme_Qos.c
@@ -0,0 +1,7890 @@
+/*
+ * 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  sme_Qos.c
+  
+  \brief implementation for SME QoS APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+/* $Header$ */
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h" //Check if the below include of aniGobal.h is sufficient for Volans too.
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "aniGlobal.h"
+#endif
+
+#include "smeInside.h"
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#include "smsDebug.h"
+#include "utilsParser.h"
+#endif
+#ifdef FEATURE_WLAN_CCX
+#include <csrCcx.h>
+#endif
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+/* TODO : 6Mbps as Cisco APs seem to like only this value; analysis req.   */
+#define SME_QOS_MIN_PHY_RATE         0x5B8D80    
+#define SME_QOS_SURPLUS_BW_ALLOWANCE  0x2000     /* Ratio of 1.0           */
+/*---------------------------------------------------------------------------
+  Max values to bound tspec params against and avoid rollover
+---------------------------------------------------------------------------*/
+#define SME_QOS_32BIT_MAX  0xFFFFFFFF
+#define SME_QOS_16BIT_MAX  0xFFFF
+#define SME_QOS_16BIT_MSB  0x8000
+/*---------------------------------------------------------------------------
+  Adds y to x, but saturates at 32-bit max to avoid rollover
+---------------------------------------------------------------------------*/
+#define SME_QOS_BOUNDED_U32_ADD_Y_TO_X( _x, _y )                            \
+  do                                                                        \
+  {                                                                         \
+    (_x) = ( (SME_QOS_32BIT_MAX-(_x))<(_y) ) ?                              \
+    (SME_QOS_32BIT_MAX) : (_x)+(_y);                                        \
+  } while(0)
+/*---------------------------------------------------------------------------
+  As per WMM spec there could be max 2 TSPEC running on the same AC with 
+  different direction. We will refer each TSPEC with an index
+---------------------------------------------------------------------------*/
+#define SME_QOS_TSPEC_INDEX_0            0
+#define SME_QOS_TSPEC_INDEX_1            1
+#define SME_QOS_TSPEC_INDEX_MAX          2
+#define SME_QOS_TSPEC_MASK_BIT_1_SET     1
+#define SME_QOS_TSPEC_MASK_BIT_2_SET     2
+#define SME_QOS_TSPEC_MASK_BIT_1_2_SET   3
+#define SME_QOS_TSPEC_MASK_CLEAR         0
+
+//which key to search on, in the flowlist (1 = flowID, 2 = AC, 4 = reason)
+#define SME_QOS_SEARCH_KEY_INDEX_1       1
+#define SME_QOS_SEARCH_KEY_INDEX_2       2
+#define SME_QOS_SEARCH_KEY_INDEX_3       4
+#define SME_QOS_SEARCH_KEY_INDEX_4       8  // ac + direction
+#define SME_QOS_SEARCH_KEY_INDEX_5       0x10  // ac + tspec_mask
+//special value for searching any Session Id
+#define SME_QOS_SEARCH_SESSION_ID_ANY    CSR_ROAM_SESSION_MAX
+#define SME_QOS_ACCESS_POLICY_EDCA       1
+#define SME_QOS_MAX_TID                  255
+#define SME_QOS_TSPEC_IE_LENGTH          61
+#define SME_QOS_TSPEC_IE_TYPE            2
+#define SME_QOS_MIN_FLOW_ID              1
+#define SME_QOS_MAX_FLOW_ID              0xFFFFFFFE
+#define SME_QOS_INVALID_FLOW_ID          0xFFFFFFFF
+// per the WMM Specification v1.2 Section 2.2.10
+// The Dialog Token field shall be set [...] to a non-zero value
+#define SME_QOS_MIN_DIALOG_TOKEN         1
+#define SME_QOS_MAX_DIALOG_TOKEN         0xFF
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+   Enumeration of the various states in the QoS state m/c
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_CLOSED = 0,
+   SME_QOS_INIT,
+   SME_QOS_LINK_UP,
+   SME_QOS_REQUESTED,
+   SME_QOS_QOS_ON,
+   SME_QOS_HANDOFF,
+   
+}sme_QosStates;
+/*---------------------------------------------------------------------------
+   Enumeration of the various QoS cmds 
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_SETUP_REQ = 0,
+   SME_QOS_RELEASE_REQ,
+   SME_QOS_MODIFY_REQ,
+   SME_QOS_RESEND_REQ,
+   SME_QOS_CMD_MAX
+}sme_QosCmdType;
+/*---------------------------------------------------------------------------
+   Enumeration of the various QoS reason codes to be used in the Flow list 
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   SME_QOS_REASON_SETUP = 0,
+   SME_QOS_REASON_RELEASE,
+   SME_QOS_REASON_MODIFY,
+   SME_QOS_REASON_MODIFY_PENDING,
+   SME_QOS_REASON_REQ_SUCCESS,
+   SME_QOS_REASON_MAX
+}sme_QosReasonType;
+
+/*---------------------------------------------------------------------------
+  Table to map user priority passed in as an argument to appropriate Access 
+  Category as specified in 802.11e/WMM
+---------------------------------------------------------------------------*/
+sme_QosEdcaAcType sme_QosUPtoACMap[SME_QOS_WMM_UP_MAX] = 
+{
+   SME_QOS_EDCA_AC_BE, /* User Priority 0 */
+   SME_QOS_EDCA_AC_BK, /* User Priority 1 */
+   SME_QOS_EDCA_AC_BK, /* User Priority 2 */
+   SME_QOS_EDCA_AC_BE, /* User Priority 3 */
+   SME_QOS_EDCA_AC_VI, /* User Priority 4 */
+   SME_QOS_EDCA_AC_VI, /* User Priority 5 */
+   SME_QOS_EDCA_AC_VO, /* User Priority 6 */
+   SME_QOS_EDCA_AC_VO  /* User Priority 7 */
+};
+
+/*---------------------------------------------------------------------------
+  Table to map access category (AC) to appropriate user priority as specified
+  in 802.11e/WMM
+  Note: there is a quantization loss here because 4 ACs are mapped to 8 UPs
+  Mapping is done for consistency
+---------------------------------------------------------------------------*/
+sme_QosWmmUpType sme_QosACtoUPMap[SME_QOS_EDCA_AC_MAX] = 
+{
+   SME_QOS_WMM_UP_BE,   /* AC BE */
+   SME_QOS_WMM_UP_BK,   /* AC BK */
+   SME_QOS_WMM_UP_VI,   /* AC VI */
+   SME_QOS_WMM_UP_VO    /* AC VO */
+};
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's FLOW Link List structure. This list can hold information per 
+  flow/request, like TSPEC params requested, which AC it is running on 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosFlowInfoEntry_s
+{
+    tListElem             link;  /* list links */
+    v_U8_t                sessionId;
+    v_U8_t                tspec_mask;
+    sme_QosReasonType     reason;
+    v_U32_t               QosFlowID;
+    sme_QosEdcaAcType     ac_type;
+    sme_QosWmmTspecInfo   QoSInfo;
+    void                * HDDcontext;
+    sme_QosCallback       QoSCallback;
+    v_BOOL_t              hoRenewal;//set to TRUE while re-negotiating flows after
+                                     //handoff, will set to FALSE once done with
+                                     //the process. Helps SME to decide if at all 
+                                     //to notify HDD/LIS for flow renewal after HO
+} sme_QosFlowInfoEntry;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's setup request cmd related information structure. 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosSetupCmdInfo_s
+{
+    v_U32_t               QosFlowID;
+    sme_QosWmmTspecInfo   QoSInfo;
+    void                 *HDDcontext;
+    sme_QosCallback       QoSCallback;
+    sme_QosWmmUpType      UPType;
+    v_BOOL_t              hoRenewal;//set to TRUE while re-negotiating flows after
+                                     //handoff, will set to FALSE once done with
+                                     //the process. Helps SME to decide if at all 
+                                     //to notify HDD/LIS for flow renewal after HO
+} sme_QosSetupCmdInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's modify cmd related information structure. 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosModifyCmdInfo_s
+{
+    v_U32_t               QosFlowID;
+    sme_QosEdcaAcType     ac;
+    sme_QosWmmTspecInfo   QoSInfo;
+} sme_QosModifyCmdInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's resend cmd related information structure. 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosResendCmdInfo_s
+{
+    v_U8_t                tspecMask;
+    sme_QosEdcaAcType     ac;
+    sme_QosWmmTspecInfo   QoSInfo;
+} sme_QosResendCmdInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's release cmd related information structure. 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosReleaseCmdInfo_s
+{
+    v_U32_t               QosFlowID;
+} sme_QosReleaseCmdInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's buffered cmd related information structure. 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosCmdInfo_s
+{
+    sme_QosCmdType        command;
+    tpAniSirGlobal        pMac;
+    v_U8_t                sessionId;
+    union
+    {
+       sme_QosSetupCmdInfo    setupCmdInfo;
+       sme_QosModifyCmdInfo   modifyCmdInfo;
+       sme_QosResendCmdInfo   resendCmdInfo;
+       sme_QosReleaseCmdInfo  releaseCmdInfo;
+    }u;
+} sme_QosCmdInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's buffered cmd List structure. This list can hold information 
+  related to any pending cmd from HDD
+---------------------------------------------------------------------------*/
+typedef struct sme_QosCmdInfoEntry_s
+{
+    tListElem             link;  /* list links */
+    sme_QosCmdInfo        cmdInfo;
+} sme_QosCmdInfoEntry;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's Per AC information structure. This can hold information on
+  how many flows running on the AC, the current, previous states the AC is in 
+---------------------------------------------------------------------------*/
+typedef struct sme_QosACInfo_s
+{
+   v_U8_t                 num_flows[SME_QOS_TSPEC_INDEX_MAX];
+   sme_QosStates          curr_state;
+   sme_QosStates          prev_state;
+   sme_QosWmmTspecInfo    curr_QoSInfo[SME_QOS_TSPEC_INDEX_MAX];
+   sme_QosWmmTspecInfo    requested_QoSInfo[SME_QOS_TSPEC_INDEX_MAX];
+   v_BOOL_t               reassoc_pending;//reassoc requested for APSD
+   //As per WMM spec there could be max 2 TSPEC running on the same AC with 
+   //different direction. We will refer each TSPEC with an index
+   v_U8_t                 tspec_mask_status; //status showing if both the indices are in use
+   v_U8_t                 tspec_pending;//tspec negotiation going on for which index
+   v_BOOL_t               hoRenewal;//set to TRUE while re-negotiating flows after
+                                    //handoff, will set to FALSE once done with
+                                    //the process. Helps SME to decide if at all 
+                                    //to notify HDD/LIS for flow renewal after HO
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   v_U8_t                 ricIdentifier[SME_QOS_TSPEC_INDEX_MAX];
+   /* stores the ADD TS response for each AC. The ADD TS response is formed by
+   parsing the RIC received in the the reassoc response */
+   tSirAddtsRsp           addTsRsp[SME_QOS_TSPEC_INDEX_MAX];
+#endif
+
+} sme_QosACInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's Per session information structure. This can hold information
+  on the state of the session
+---------------------------------------------------------------------------*/
+typedef struct sme_QosSessionInfo_s
+{
+   // what is this entry's session id
+   v_U8_t                 sessionId;
+   // is the session currently active
+   v_BOOL_t               sessionActive;
+   // All AC info for this session
+   sme_QosACInfo          ac_info[SME_QOS_EDCA_AC_MAX];
+   // Bitmask of the ACs with APSD on 
+   // Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored
+   v_U8_t                 apsdMask;
+   // association information for this session
+   sme_QosAssocInfo       assocInfo;
+   // ID assigned to our reassoc request
+   v_U32_t                roamID;
+   // maintaining a powersave status in QoS module, to be fed back to PMC at 
+   // times through the sme_QosPmcCheckRoutine
+   v_BOOL_t               readyForPowerSave;
+   // are we in the process of handing off to a different AP
+   v_BOOL_t               handoffRequested;
+   // following reassoc or AddTS has UAPSD already been requested from PMC
+   v_BOOL_t               uapsdAlreadyRequested;
+   // commands that are being buffered for this session
+   tDblLinkList           bufferedCommandList;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   v_BOOL_t               ftHandoffInProgress;
+#endif
+
+} sme_QosSessionInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  Search key union. We can use the flowID, ac type, or reason to find an entry 
+  in the flow list
+---------------------------------------------------------------------------*/
+typedef union sme_QosSearchKey_s
+{
+   v_U32_t               QosFlowID;
+   sme_QosEdcaAcType     ac_type;
+   sme_QosReasonType     reason;
+}sme_QosSearchKey;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  We can either use the flowID or the ac type to find an entry in the flow list.
+  The index is a bitmap telling us which key to use. Starting from LSB,
+  bit 0 - Flow ID
+  bit 1 - AC type
+---------------------------------------------------------------------------*/
+typedef struct sme_QosSearchInfo_s
+{
+   v_U8_t           sessionId;
+   v_U8_t           index;
+   sme_QosSearchKey key;
+   sme_QosWmmDirType   direction;
+   v_U8_t              tspec_mask;
+}sme_QosSearchInfo;
+/*---------------------------------------------------------------------------
+DESCRIPTION
+  SME QoS module's internal control block.
+---------------------------------------------------------------------------*/
+struct sme_QosCb_s
+{
+   //global Mac pointer
+   tpAniSirGlobal   pMac;
+   //All Session Info
+   sme_QosSessionInfo     sessionInfo[CSR_ROAM_SESSION_MAX];
+   //All FLOW info
+   tDblLinkList           flow_list;
+   //default TSPEC params
+   sme_QosWmmTspecInfo    def_QoSInfo[SME_QOS_EDCA_AC_MAX];
+   //counter for assigning Flow IDs
+   v_U32_t                nextFlowId;
+   //counter for assigning Dialog Tokens
+   v_U8_t                nextDialogToken;
+}sme_QosCb;
+typedef eHalStatus (*sme_QosProcessSearchEntry)(tpAniSirGlobal pMac, tListElem *pEntry);
+/*-------------------------------------------------------------------------- 
+                         Internal function declarations
+  ------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosInternalSetupReq(tpAniSirGlobal pMac, 
+                                          v_U8_t sessionId,
+                                          sme_QosWmmTspecInfo * pQoSInfo,
+                                          sme_QosCallback QoSCallback, 
+                                          void * HDDcontext,
+                                          sme_QosWmmUpType UPType, 
+                                          v_U32_t QosFlowID,
+                                          v_BOOL_t buffered_cmd,
+                                          v_BOOL_t hoRenewal);
+sme_QosStatusType sme_QosInternalModifyReq(tpAniSirGlobal pMac, 
+                                           sme_QosWmmTspecInfo * pQoSInfo,
+                                           v_U32_t QosFlowID,
+                                           v_BOOL_t buffered_cmd);
+sme_QosStatusType sme_QosInternalReleaseReq(tpAniSirGlobal pMac, 
+                                            v_U32_t QosFlowID,
+                                            v_BOOL_t buffered_cmd);
+sme_QosStatusType sme_QosSetup(tpAniSirGlobal pMac,
+                               v_U8_t sessionId,
+                               sme_QosWmmTspecInfo *pTspec_Info, 
+                               sme_QosEdcaAcType ac);
+eHalStatus sme_QosAddTsReq(tpAniSirGlobal pMac,
+                           v_U8_t sessionId,
+                           sme_QosWmmTspecInfo * pTspec_Info,
+                           sme_QosEdcaAcType ac);
+eHalStatus sme_QosDelTsReq(tpAniSirGlobal pMac,
+                           v_U8_t sessionId,
+                           sme_QosEdcaAcType ac,
+                           v_U8_t tspec_mask);
+eHalStatus sme_QosProcessAddTsRsp(tpAniSirGlobal pMac, void *pMsgBuf);
+eHalStatus sme_QosProcessDelTsInd(tpAniSirGlobal pMac, void *pMsgBuf);
+eHalStatus sme_QosProcessDelTsRsp(tpAniSirGlobal pMac, void *pMsgBuf);
+eHalStatus sme_QosProcessAssocCompleteEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessReassocReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessReassocSuccessEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessReassocFailureEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessDisconnectEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessJoinReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessHandoffAssocReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessHandoffSuccessEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessHandoffFailureEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+eHalStatus sme_QosProcessPreauthSuccessInd(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessSetKeySuccessInd(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info);
+eHalStatus sme_QosProcessAggrQosRsp(tpAniSirGlobal pMac, void *pMsgBuf);
+eHalStatus sme_QosFTAggrQosReq( tpAniSirGlobal pMac, v_U8_t sessionId );
+#endif
+eHalStatus sme_QosProcessAddTsSuccessRsp(tpAniSirGlobal pMac, 
+                                         v_U8_t sessionId,
+                                         tSirAddtsRspInfo * pRsp);
+eHalStatus sme_QosProcessAddTsFailureRsp(tpAniSirGlobal pMac, 
+                                         v_U8_t sessionId,
+                                         tSirAddtsRspInfo * pRsp);
+eHalStatus sme_QosAggregateParams(
+   sme_QosWmmTspecInfo * pInput_Tspec_Info,
+   sme_QosWmmTspecInfo * pCurrent_Tspec_Info,
+   sme_QosWmmTspecInfo * pUpdated_Tspec_Info);
+static eHalStatus sme_QosUpdateParams(v_U8_t sessionId,
+                                      sme_QosEdcaAcType ac,
+                                      v_U8_t tspec_mask, 
+                                      sme_QosWmmTspecInfo * pTspec_Info);
+sme_QosWmmUpType sme_QosAcToUp(sme_QosEdcaAcType ac);
+sme_QosEdcaAcType sme_QosUpToAc(sme_QosWmmUpType up);
+v_BOOL_t sme_QosIsACM(tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, 
+                      sme_QosEdcaAcType ac, tDot11fBeaconIEs *pIes);
+tListElem *sme_QosFindInFlowList(sme_QosSearchInfo search_key);
+eHalStatus sme_QosFindAllInFlowList(tpAniSirGlobal pMac,
+                                    sme_QosSearchInfo search_key, 
+                                    sme_QosProcessSearchEntry fnp);
+static void sme_QosStateTransition(v_U8_t sessionId,
+                                   sme_QosEdcaAcType ac,
+                                   sme_QosStates new_state);
+eHalStatus sme_QosBufferCmd(sme_QosCmdInfo *pcmd, v_BOOL_t insert_head);
+static eHalStatus sme_QosProcessBufferedCmd(v_U8_t sessionId);
+eHalStatus sme_QosSaveAssocInfo(sme_QosSessionInfo *pSession, sme_QosAssocInfo *pAssoc_info);
+eHalStatus sme_QosSetupFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosModificationNotifyFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosModifyFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosDelTsIndFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosReassocSuccessEvFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosAddTsFailureFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+eHalStatus sme_QosAddTsSuccessFnp(tpAniSirGlobal pMac, tListElem *pEntry);
+static v_BOOL_t sme_QosIsRspPending(v_U8_t sessionId, sme_QosEdcaAcType ac);
+static v_BOOL_t sme_QosIsUapsdActive(void);
+void sme_QosPmcFullPowerCallback(void *callbackContext, eHalStatus status);
+void sme_QosPmcStartUapsdCallback(void *callbackContext, eHalStatus status);
+v_BOOL_t sme_QosPmcCheckRoutine(void *callbackContext);
+void sme_QosPmcDeviceStateUpdateInd(void *callbackContext, tPmcState pmcState);
+eHalStatus sme_QosProcessOutOfUapsdMode(tpAniSirGlobal pMac);
+eHalStatus sme_QosProcessIntoUapsdMode(tpAniSirGlobal pMac);
+static eHalStatus sme_QosBufferExistingFlows(tpAniSirGlobal pMac,
+                                             v_U8_t sessionId);
+static eHalStatus sme_QosDeleteExistingFlows(tpAniSirGlobal pMac,
+                                             v_U8_t sessionId);
+static void sme_QosCleanupCtrlBlkForHandoff(tpAniSirGlobal pMac,
+                                            v_U8_t sessionId);
+static eHalStatus sme_QosDeleteBufferedRequests(tpAniSirGlobal pMac,
+                                                v_U8_t sessionId);
+v_BOOL_t sme_QosValidateRequestedParams(tpAniSirGlobal pMac,
+    sme_QosWmmTspecInfo * pQoSInfo,
+    v_U8_t sessionId);
+
+extern eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme);
+extern eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme);
+static eHalStatus qosIssueCommand( tpAniSirGlobal pMac, v_U8_t sessionId,
+                                   eSmeCommandType cmdType, sme_QosWmmTspecInfo * pQoSInfo,
+                                   sme_QosEdcaAcType ac, v_U8_t tspec_mask );
+/*
+    sme_QosReRequestAddTS to re-send AddTS for the combined QoS request
+*/
+static sme_QosStatusType sme_QosReRequestAddTS(tpAniSirGlobal pMac,
+                                               v_U8_t sessionId,
+                                               sme_QosWmmTspecInfo * pQoSInfo,
+                                               sme_QosEdcaAcType ac,
+                                               v_U8_t tspecMask);
+static void sme_QosInitACs(tpAniSirGlobal pMac, v_U8_t sessionId);
+static eHalStatus sme_QosRequestReassoc(tpAniSirGlobal pMac, tANI_U8 sessionId,
+                                        tCsrRoamModifyProfileFields *pModFields,
+                                        v_BOOL_t fForce );
+static v_U32_t sme_QosAssignFlowId(void);
+static v_U8_t sme_QosAssignDialogToken(void);
+static eHalStatus sme_QosUpdateTspecMask(v_U8_t sessionId,
+                                      sme_QosSearchInfo search_key,
+                                      v_U8_t new_tspec_mask);
+/*-------------------------------------------------------------------------- 
+                         External APIs definitions
+  ------------------------------------------------------------------------*/
+/* --------------------------------------------------------------------------
+    \brief sme_QosOpen() - This function must be called before any API call to 
+    SME QoS module.
+    \param pMac - Pointer to the global MAC parameter structure.
+    
+    \return eHalStatus     
+----------------------------------------------------------------------------*/
+eHalStatus sme_QosOpen(tpAniSirGlobal pMac)
+{
+   sme_QosSessionInfo *pSession;
+   v_U8_t sessionId;
+   eHalStatus status;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: initializing SME-QoS module",
+             __FUNCTION__, __LINE__);
+   //init the control block
+   //(note that this will make all sessions invalid)
+   vos_mem_zero(&sme_QosCb, sizeof(sme_QosCb));
+   sme_QosCb.pMac = pMac;
+   sme_QosCb.nextFlowId = SME_QOS_MIN_FLOW_ID;
+   sme_QosCb.nextDialogToken = SME_QOS_MIN_DIALOG_TOKEN;
+   //init flow list
+   status = csrLLOpen(pMac->hHdd, &sme_QosCb.flow_list);
+   if (!HAL_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                "%s: %d: cannot initialize Flow List",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   
+   for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId)
+   {
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      pSession->sessionId = sessionId;
+      // initialize the session's per-AC information
+      sme_QosInitACs(pMac, sessionId);
+      // initialize the session's buffered command list
+      status = csrLLOpen(pMac->hHdd, &pSession->bufferedCommandList);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                   "%s: %d: cannot initialize cmd list for session %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId);
+         return eHAL_STATUS_FAILURE;
+      }
+      pSession->readyForPowerSave = VOS_TRUE;
+   }
+   //the routine registered here gets called by PMC whenever the device is about 
+   //to enter one of the power save modes. PMC runs a poll with all the 
+   //registered modules if device can enter powersave mode or remain full power
+   if(!HAL_STATUS_SUCCESS(
+      pmcRegisterPowerSaveCheck(pMac, sme_QosPmcCheckRoutine, pMac)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                "%s: %d: cannot register with pmcRegisterPowerSaveCheck()",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   //the routine registered here gets called by PMC whenever there is a device 
+   // state change. PMC might go to full power because of many reasons and this 
+   // is the way for PMC to inform all the other registered modules so that 
+   // everyone is in sync.
+   if(!HAL_STATUS_SUCCESS(
+      pmcRegisterDeviceStateUpdateInd(pMac, sme_QosPmcDeviceStateUpdateInd, pMac)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                "%s: %d: cannot register with pmcRegisterDeviceStateUpdateInd()",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: done initializing SME-QoS module",
+             __FUNCTION__, __LINE__);
+   return eHAL_STATUS_SUCCESS;
+}
+/* --------------------------------------------------------------------------
+    \brief sme_QosClose() - To close down SME QoS module. There should not be 
+    any API call into this module after calling this function until another
+    call of sme_QosOpen.
+    \param pMac - Pointer to the global MAC parameter structure.
+    
+    \return eHalStatus     
+----------------------------------------------------------------------------*/
+eHalStatus sme_QosClose(tpAniSirGlobal pMac)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosEdcaAcType ac;
+   v_U8_t sessionId;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: closing down SME-QoS",
+             __FUNCTION__, __LINE__);
+   // deregister with PMC
+   if(!HAL_STATUS_SUCCESS(
+      pmcDeregisterDeviceStateUpdateInd(pMac, sme_QosPmcDeviceStateUpdateInd)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                "%s: %d: cannot deregister with pmcDeregisterDeviceStateUpdateInd()",
+                __FUNCTION__, __LINE__);
+   }
+   if(!HAL_STATUS_SUCCESS(
+      pmcDeregisterPowerSaveCheck(pMac, sme_QosPmcCheckRoutine)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+                "%s: %d: cannot deregister with pmcDeregisterPowerSaveCheck()",
+                __FUNCTION__, __LINE__);
+   }
+   //cleanup control block
+   //close the flow list
+   csrLLClose(&sme_QosCb.flow_list);
+   // shut down all of the sessions
+   for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId)
+   {
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      if (pSession == NULL)
+            continue;
+
+       sme_QosInitACs(pMac, sessionId);
+       // this session doesn't require UAPSD
+       pSession->apsdMask = 0;
+
+       pSession->uapsdAlreadyRequested = VOS_FALSE;
+       pSession->handoffRequested = VOS_FALSE;
+       pSession->readyForPowerSave = VOS_TRUE;
+       pSession->roamID = 0;
+       //need to clean up buffered req
+       sme_QosDeleteBufferedRequests(pMac, sessionId);
+       //need to clean up flows
+       sme_QosDeleteExistingFlows(pMac, sessionId);
+
+       // Clean up the assoc info if already allocated
+       if (pSession->assocInfo.pBssDesc) {
+          vos_mem_free(pSession->assocInfo.pBssDesc);
+          pSession->assocInfo.pBssDesc = NULL;
+       }
+
+      // close the session's buffered command list
+      csrLLClose(&pSession->bufferedCommandList);
+      for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+      {
+         sme_QosStateTransition(sessionId, ac, SME_QOS_CLOSED);
+      }
+      pSession->sessionActive = VOS_FALSE;
+      pSession->readyForPowerSave = VOS_TRUE;
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: closed down QoS",
+             __FUNCTION__, __LINE__);
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetupReq() - The SME QoS API exposed to HDD to request for QoS 
+  on a particular AC. This function should be called after a link has been 
+  established, i.e. STA is associated with an AP etc. If the request involves 
+  admission control on the requested AC, HDD needs to provide the necessary 
+  Traffic Specification (TSPEC) parameters otherwise SME is going to use the
+  default params.
+  
+  \param hHal - The handle returned by macOpen.
+  \param sessionId - sessionId returned by sme_OpenSession.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QoSCallback - The callback which is registered per flow while 
+                       requesting for QoS. Used for any notification for the 
+                       flow (i.e. setup success/failure/release) which needs to 
+                       be sent to HDD
+  \param HDDcontext - A cookie passed by HDD to be used by SME during any QoS 
+                      notification (through the callabck) to HDD 
+  \param UPType - Useful only if HDD or any other upper layer module (BAP etc.)
+                  looking for implicit QoS setup, in that 
+                  case, the pQoSInfo will be NULL & SME will know about the AC
+                  (from the UP provided in this param) QoS is requested on
+  \param pQosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+                  
+  \return eHAL_STATUS_SUCCESS - Setup is successful.
+  
+          Other status means Setup request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosSetupReq(tHalHandle hHal, tANI_U32 sessionId,
+                                  sme_QosWmmTspecInfo * pQoSInfo,
+                                  sme_QosCallback QoSCallback,
+                                  void * HDDcontext,
+                                  sme_QosWmmUpType UPType, v_U32_t * pQosFlowID)
+{
+   sme_QosSessionInfo *pSession;
+   eHalStatus lock_status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   sme_QosStatusType status;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS Setup requested by client on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   lock_status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( !HAL_STATUS_SUCCESS( lock_status ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Unable to obtain lock",
+                __FUNCTION__, __LINE__);
+      return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   }
+   //Make sure the session is valid
+   if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Supplied Session ID %d is invalid",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   }
+   else
+   {
+      //Make sure the session is active
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      if (!pSession->sessionActive)
+      { 
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: Supplied Session ID %d is inactive",
+                   __FUNCTION__, __LINE__,
+                   sessionId);
+         status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+      }
+      else
+      {
+         //Assign a Flow ID
+         *pQosFlowID = sme_QosAssignFlowId();
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: QoS request on session %d assigned Flow ID %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, *pQosFlowID);
+         //Call the internal function for QoS setup,
+         // adding a layer of abstraction
+         status = sme_QosInternalSetupReq(pMac, (v_U8_t)sessionId, pQoSInfo,
+                                          QoSCallback, HDDcontext, UPType,
+                                          *pQosFlowID, VOS_FALSE, VOS_FALSE);
+      }
+   }
+   sme_ReleaseGlobalLock( &pMac->sme );
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS setup return status on session %d is %d",
+             __FUNCTION__, __LINE__,
+             sessionId, status);
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosModifyReq() - The SME QoS API exposed to HDD to request for 
+  modification of certain QoS params on a flow running on a particular AC. 
+  This function should be called after a link has been established, i.e. STA is 
+  associated with an AP etc. & a QoS setup has been succesful for that flow. 
+  If the request involves admission control on the requested AC, HDD needs to 
+  provide the necessary Traffic Specification (TSPEC) parameters & SME might
+  start the renegotiation process through ADDTS.
+  
+  \param hHal - The handle returned by macOpen.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow has 
+                     been successful already
+                  
+  \return SME_QOS_STATUS_SETUP_SUCCESS_RSP - Modification is successful.
+  
+          Other status means request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosModifyReq(tHalHandle hHal, 
+                                   sme_QosWmmTspecInfo * pQoSInfo,
+                                   v_U32_t QosFlowID)
+{
+   eHalStatus lock_status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   sme_QosStatusType status;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS Modify requested by client for Flow %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID);
+   lock_status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( !HAL_STATUS_SUCCESS( lock_status ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Unable to obtain lock",
+                __FUNCTION__, __LINE__);
+      return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+   }
+   //Call the internal function for QoS modify, adding a layer of abstraction
+   status = sme_QosInternalModifyReq(pMac, pQoSInfo, QosFlowID, VOS_FALSE);
+   sme_ReleaseGlobalLock( &pMac->sme );
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS Modify return status on Flow %d is %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID, status);
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosReleaseReq() - The SME QoS API exposed to HDD to request for 
+  releasing a QoS flow running on a particular AC. This function should be 
+  called only if a QoS is set up with a valid FlowID. HDD sould invoke this 
+  API only if an explicit request for QoS release has come from Application 
+  
+  \param hHal - The handle returned by macOpen.
+  \param QosFlowID - Identification per flow running on each AC generated by SME
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+  
+  \return eHAL_STATUS_SUCCESS - Release is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosReleaseReq(tHalHandle hHal, v_U32_t QosFlowID)
+{
+   eHalStatus lock_status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   sme_QosStatusType status;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS Release requested by client for Flow %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID);
+   lock_status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( !HAL_STATUS_SUCCESS( lock_status ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Unable to obtain lock",
+                __FUNCTION__, __LINE__);
+      return SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+   }
+   //Call the internal function for QoS release, adding a layer of abstraction
+   status = sme_QosInternalReleaseReq(pMac, QosFlowID, VOS_FALSE);
+   sme_ReleaseGlobalLock( &pMac->sme );
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS Release return status on Flow %d is %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID, status);
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetParams() - This function is used by HDD to provide the 
+   default TSPEC params to SME.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info per AC as defined above, provided by HDD
+  
+  \return eHAL_STATUS_SUCCESS - Setparam is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosSetParams(tpAniSirGlobal pMac, sme_QosWmmTspecInfo * pQoSInfo)
+{
+   sme_QosEdcaAcType ac;
+   // find the AC
+   ac = sme_QosUpToAc(pQoSInfo->ts_info.up);
+   if(SME_QOS_EDCA_AC_MAX == ac)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Invalid AC %d (via UP %d)",
+                __FUNCTION__, __LINE__,
+                ac, pQoSInfo->ts_info.up );
+      return eHAL_STATUS_FAILURE;
+   }
+   //copy over the default params for this AC
+   sme_QosCb.def_QoSInfo[ac] = *pQoSInfo;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: QoS default params set for AC %d (via UP %d)",
+             __FUNCTION__, __LINE__,
+             ac, pQoSInfo->ts_info.up );
+   return eHAL_STATUS_SUCCESS;
+}
+
+void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+   vos_mem_zero( &pCommand->u.qosCmd, sizeof( tGenericQosCmd ) );
+   smeReleaseCommand( pMac, pCommand );
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosMsgProcessor() - sme_ProcessMsg() calls this function for the 
+  messages that are handled by SME QoS module.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param msg_type - the type of msg passed by PE as defined in wniApi.h
+  \param pMsgBuf - a pointer to a buffer that maps to various structures base 
+                   on the message type.
+                   The beginning of the buffer can always map to tSirSmeRsp.
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosMsgProcessor( tpAniSirGlobal pMac,  v_U16_t msg_type, 
+                                void *pMsgBuf)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tListElem *pEntry;
+   tSmeCmd *pCommand;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: msg = %d for QoS",
+             __FUNCTION__, __LINE__, msg_type);
+   //switch on the msg type & make the state transition accordingly
+   switch(msg_type)
+   {
+      case eWNI_SME_ADDTS_RSP:
+         pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+         if( pEntry )
+         {
+             pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+             if( eSmeCommandAddTs == pCommand->command )
+             {
+                status = sme_QosProcessAddTsRsp(pMac, pMsgBuf);
+                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                {
+                   qosReleaseCommand( pMac, pCommand );
+                }
+                smeProcessPendingQueue( pMac );
+             }
+         }
+         break;
+      case eWNI_SME_DELTS_RSP:
+         pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+         if( pEntry )
+         {
+             pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+             if( eSmeCommandDelTs == pCommand->command )
+             {
+                status = sme_QosProcessDelTsRsp(pMac, pMsgBuf);
+                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                {
+                   qosReleaseCommand( pMac, pCommand );
+                }
+                smeProcessPendingQueue( pMac );
+             }
+         }
+         break;
+      case eWNI_SME_DELTS_IND:
+         status = sme_QosProcessDelTsInd(pMac, pMsgBuf);
+         break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+      case eWNI_SME_FT_AGGR_QOS_RSP:
+         status = sme_QosProcessAggrQosRsp(pMac, pMsgBuf);
+         break;
+#endif
+
+      default:
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: unknown msg type = %d",
+                   __FUNCTION__, __LINE__, msg_type);
+         break;
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosValidateParams() - The SME QoS API exposed to CSR to validate AP
+  capabilities regarding QoS support & any other QoS parameter validation.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pBssDesc - Pointer to the BSS Descriptor information passed down by 
+                    CSR to PE while issuing the Join request
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosValidateParams(tpAniSirGlobal pMac, 
+                                 tSirBssDescription *pBssDesc)
+{
+   tDot11fBeaconIEs *pIes = NULL;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: %d: validation for QAP & APSD",
+             __FUNCTION__, __LINE__);
+   do
+   {
+      if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes)))
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: csrGetParsedBssDescriptionIEs() failed",
+                   __FUNCTION__, __LINE__);
+         break;
+      }
+      //check if the AP is QAP & it supports APSD
+      if( !CSR_IS_QOS_BSS(pIes) )
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: AP doesn't support QoS",
+                   __FUNCTION__, __LINE__);
+         
+         break;
+      }
+      if(!(pIes->WMMParams.qosInfo & SME_QOS_AP_SUPPORTS_APSD) &&
+         !(pIes->WMMInfoAp.uapsd))
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: AP doesn't support APSD",
+                   __FUNCTION__, __LINE__);
+         break;
+      }
+      status = eHAL_STATUS_SUCCESS;
+   }while(0);
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: validated with status = %d",
+             __FUNCTION__, __LINE__, status);
+   if(pIes)
+   {
+      vos_mem_free(pIes);
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosCsrEventInd() - The QoS sub-module in SME expects notifications 
+  from CSR when certain events occur as mentioned in sme_QosCsrEventIndType.
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param ind - The event occurred of type sme_QosCsrEventIndType.
+  \param pEvent_info - Information related to the event
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosCsrEventInd(tpAniSirGlobal pMac,
+                              v_U8_t sessionId,
+                              sme_QosCsrEventIndType ind, 
+                              void *pEvent_info)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: On Session %d Event %d received from CSR",
+             __FUNCTION__, __LINE__,
+             sessionId, ind );
+   switch(ind)
+   {
+      case SME_QOS_CSR_ASSOC_COMPLETE:
+         //expecting assoc info in pEvent_info
+         status = sme_QosProcessAssocCompleteEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_REASSOC_REQ:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessReassocReqEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_REASSOC_COMPLETE:
+         //expecting assoc info in pEvent_info
+         status = sme_QosProcessReassocSuccessEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_REASSOC_FAILURE:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessReassocFailureEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_DISCONNECT_REQ:
+      case SME_QOS_CSR_DISCONNECT_IND:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessDisconnectEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_JOIN_REQ:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessJoinReqEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_HANDOFF_ASSOC_REQ:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessHandoffAssocReqEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_HANDOFF_COMPLETE:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessHandoffSuccessEv(pMac, sessionId, pEvent_info);
+         break;
+      case SME_QOS_CSR_HANDOFF_FAILURE:
+         //nothing expected in pEvent_info
+         status = sme_QosProcessHandoffFailureEv(pMac, sessionId, pEvent_info);
+         break;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+      case SME_QOS_CSR_PREAUTH_SUCCESS_IND:
+         status = sme_QosProcessPreauthSuccessInd(pMac, sessionId, pEvent_info);
+         break;
+#ifdef FEATURE_WLAN_CCX
+      case SME_QOS_CSR_SET_KEY_SUCCESS_IND:
+         status = sme_QosProcessSetKeySuccessInd(pMac, sessionId, pEvent_info);
+         break;
+#endif
+#endif
+      default:
+         //Err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On Session %d Unknown Event %d received from CSR",
+                   __FUNCTION__, __LINE__,
+                   sessionId, ind );
+         break;
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: On Session %d processed Event %d with status %d",
+             __FUNCTION__, __LINE__,
+             sessionId, ind, status );
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosGetACMMask() - The QoS sub-module API to find out on which ACs
+  AP mandates Admission Control (ACM = 1)
+  (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored)
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pSirBssDesc - The event occurred of type sme_QosCsrEventIndType.
+
+  \return a bit mask indicating for which ACs AP has ACM set to 1
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_U8_t sme_QosGetACMMask(tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes)
+{
+   sme_QosEdcaAcType ac;
+   v_U8_t acm_mask = 0;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked",
+             __FUNCTION__, __LINE__);
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+   {
+      if(sme_QosIsACM(pMac, pSirBssDesc, ac, pIes))
+      {
+         acm_mask = acm_mask | (1 << (SME_QOS_EDCA_AC_VO - ac));
+      }
+      
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: mask is %d",
+             __FUNCTION__, __LINE__, acm_mask);
+   return acm_mask;
+}
+/*-------------------------------------------------------------------------- 
+                         Internal function definitions
+  ------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------
+  \brief sme_QosInternalSetupReq() - The SME QoS internal setup request handling
+  function.
+  If the request involves admission control on the requested AC, HDD needs to 
+  provide the necessary Traffic Specification (TSPEC) parameters otherwise SME 
+  is going to use the default params.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QoSCallback - The callback which is registered per flow while 
+                       requesting for QoS. Used for any notification for the 
+                       flow (i.e. setup success/failure/release) which needs to 
+                       be sent to HDD
+  \param HDDcontext - A cookie passed by HDD to be used by SME during any QoS 
+                      notification (through the callabck) to HDD 
+  \param UPType - Useful only if HDD or any other upper layer module (BAP etc.)
+                  looking for implicit QoS setup, in that 
+                  case, the pQoSInfo will be NULL & SME will know about the AC
+                  (from the UP provided in this param) QoS is requested on
+  \param QosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+  \param buffered_cmd - tells us if the cmd was a buffered one or fresh from 
+                        client
+                  
+  \return eHAL_STATUS_SUCCESS - Setup is successful.
+  
+          Other status means Setup request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosInternalSetupReq(tpAniSirGlobal pMac, 
+                                          v_U8_t sessionId,
+                                          sme_QosWmmTspecInfo * pQoSInfo,
+                                          sme_QosCallback QoSCallback, 
+                                          void * HDDcontext,
+                                          sme_QosWmmUpType UPType, 
+                                          v_U32_t QosFlowID,
+                                          v_BOOL_t buffered_cmd,
+                                          v_BOOL_t hoRenewal)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac;
+   sme_QosWmmTspecInfo Tspec_Info;
+   sme_QosStates new_state = SME_QOS_CLOSED;
+   sme_QosFlowInfoEntry *pentry = NULL;
+   sme_QosCmdInfo  cmd;
+   sme_QosStatusType status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   v_U8_t tmask = 0;
+   v_U8_t new_tmask = 0;
+   sme_QosSearchInfo search_key;
+   v_BOOL_t bufferCommand;
+   eHalStatus hstatus;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for flow %d",
+             __FUNCTION__, __LINE__,
+             sessionId, QosFlowID);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   // if caller sent an empty TSPEC, fill up with the default one
+   if(!pQoSInfo)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                "%s: %d: caller sent an empty QoS param list, using defaults",
+                __FUNCTION__, __LINE__);
+      // find the AC with UPType passed in
+      ac = sme_QosUpToAc(UPType);
+      if(SME_QOS_EDCA_AC_MAX == ac)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: invalid AC %d from UP %d",
+                   __FUNCTION__, __LINE__,
+                   ac, UPType);
+         
+         return SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP;
+      }
+      Tspec_Info = sme_QosCb.def_QoSInfo[ac];
+   }
+   else
+   {
+      // find the AC
+      ac = sme_QosUpToAc(pQoSInfo->ts_info.up);
+      if(SME_QOS_EDCA_AC_MAX == ac)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: invalid AC %d from UP %d",
+                   __FUNCTION__, __LINE__,
+                   ac, pQoSInfo->ts_info.up);
+         
+         return SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP;
+      }
+      //validate QoS params
+      if(!sme_QosValidateRequestedParams(pMac, pQoSInfo, sessionId))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: invalid params",
+                   __FUNCTION__, __LINE__);
+         return SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP;
+      }
+      Tspec_Info = *pQoSInfo;
+   }
+   pACInfo = &pSession->ac_info[ac];
+   // need to vote off powersave for the duration of this request
+   pSession->readyForPowerSave = VOS_FALSE;
+   // assume we won't have to (re)buffer the command
+   bufferCommand = VOS_FALSE;
+   //check to consider the following flowing scenario
+   //Addts request is pending on one AC, while APSD requested on another which 
+   //needs a reassoc. Will buffer a request if Addts is pending on any AC, 
+   //which will safegaurd the above scenario, & also won't confuse PE with back 
+   //to back Addts or Addts followed by Reassoc
+   if(sme_QosIsRspPending(sessionId, ac))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: buffering the setup request for flow %d in state %d "
+                "since another request is pending",
+                __FUNCTION__, __LINE__, 
+                QosFlowID, pACInfo->curr_state );
+      bufferCommand = VOS_TRUE;
+   }
+   else
+   {
+      // make sure we are in full power so that we can issue
+      // an AddTS or reassoc if necessary
+      hstatus = pmcRequestFullPower(pMac, sme_QosPmcFullPowerCallback,
+                                    pSession, eSME_REASON_OTHER);
+      if( eHAL_STATUS_PMC_PENDING == hstatus )
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                   "%s: %d: buffering the setup request for flow %d in state %d, "
+                   "waiting for full power",
+                   __FUNCTION__, __LINE__, 
+                   QosFlowID, pACInfo->curr_state );
+         bufferCommand = VOS_TRUE;
+      }
+   }
+   if (bufferCommand)
+   {
+      // we need to buffer the command
+      cmd.command = SME_QOS_SETUP_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.setupCmdInfo.HDDcontext = HDDcontext;
+      cmd.u.setupCmdInfo.QoSInfo = Tspec_Info;
+      cmd.u.setupCmdInfo.QoSCallback = QoSCallback;
+      cmd.u.setupCmdInfo.UPType = UPType;
+      cmd.u.setupCmdInfo.hoRenewal = hoRenewal;
+      cmd.u.setupCmdInfo.QosFlowID = QosFlowID;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the setup request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+      }
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Buffered setup request for flow = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID);
+      return SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+   }
+
+   //get into the state m/c to see if the request can be granted
+   switch(pACInfo->curr_state)
+   {
+   case SME_QOS_LINK_UP:
+      //call the internal qos setup logic to decide on if the
+      // request is NOP, or need reassoc for APSD and/or need to send out ADDTS
+      status = sme_QosSetup(pMac, sessionId, &Tspec_Info, ac);
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: On session %d with AC %d in state SME_QOS_LINK_UP "
+                "sme_QosSetup returned with status %d",
+                __FUNCTION__, __LINE__,
+                sessionId, ac, status);
+      if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP != status)
+      {
+         // we aren't waiting for a response from the AP
+         // so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+      }
+      if((SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status)||
+         (SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+         (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status))
+      {
+         // we received an expected "good" status
+         //create an entry in the flow list
+         pentry = vos_mem_malloc(sizeof(*pentry));
+         if (!pentry)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                      "%s: %d: couldn't allocate memory for the new "
+                      "entry in the Flow List",
+                      __FUNCTION__, __LINE__);
+            return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+         }
+         pentry->ac_type = ac;
+         pentry->HDDcontext = HDDcontext;
+         pentry->QoSCallback = QoSCallback;
+         pentry->hoRenewal = hoRenewal;
+         pentry->QosFlowID = QosFlowID;
+         pentry->sessionId = sessionId;
+         // since we are in state SME_QOS_LINK_UP this must be the
+         // first TSPEC on this AC, so use index 0 (mask bit 1)
+         pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0] = Tspec_Info;
+         if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status)
+         {
+            if(pACInfo->tspec_mask_status &&
+               !pACInfo->reassoc_pending)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: On session %d with AC %d in state "
+                            "SME_QOS_LINK_UP tspec_mask_status is %d "
+                         "but should not be set yet",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac, pACInfo->tspec_mask_status);
+               //ASSERT
+               VOS_ASSERT(0);
+               vos_mem_free(pentry);
+               return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+            }
+            pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_BIT_1_SET;
+            if(!pACInfo->reassoc_pending)
+            {
+               // we didn't request for reassoc, it must be a tspec negotiation
+               pACInfo->tspec_pending = 1;
+            }
+             
+            pentry->reason = SME_QOS_REASON_SETUP;
+            new_state = SME_QOS_REQUESTED;
+         }
+         else
+         {
+            // SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP or
+            // SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY
+            pentry->reason = SME_QOS_REASON_REQ_SUCCESS;
+            new_state = SME_QOS_QOS_ON;
+            pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_BIT_1_SET;
+            pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0] = Tspec_Info;
+            if(buffered_cmd && !pentry->hoRenewal)
+            {
+               QoSCallback(pMac, HDDcontext, 
+                           &pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0],
+                           status,
+                           pentry->QosFlowID);
+            }
+            pentry->hoRenewal = VOS_FALSE;
+         }
+         pACInfo->num_flows[SME_QOS_TSPEC_INDEX_0]++;
+
+         //indicate on which index the flow entry belongs to & add it to the 
+         //Flow List at the end
+         pentry->tspec_mask = pACInfo->tspec_mask_status;
+         pentry->QoSInfo = Tspec_Info;
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Creating entry on session %d at %p with flowID %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, pentry, QosFlowID);
+         csrLLInsertTail(&sme_QosCb.flow_list, &pentry->link, VOS_TRUE);
+      }
+      else
+      {
+         // unexpected status returned by sme_QosSetup()
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On session %d unexpected status %d "
+                   "returned by sme_QosSetup",
+                   __FUNCTION__, __LINE__,
+                   sessionId, status);
+         new_state = pACInfo->curr_state;
+         if(buffered_cmd && hoRenewal)
+         {
+            QoSCallback(pMac, HDDcontext, 
+                        &pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0],
+                        SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
+                        QosFlowID);
+         }
+      }
+      break;
+   case SME_QOS_HANDOFF:
+   case SME_QOS_REQUESTED:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: Buffering setup request for flow %d in state = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID, pACInfo->curr_state );
+      //buffer cmd
+      cmd.command = SME_QOS_SETUP_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.setupCmdInfo.HDDcontext = HDDcontext;
+      cmd.u.setupCmdInfo.QoSInfo = Tspec_Info;
+      cmd.u.setupCmdInfo.QoSCallback = QoSCallback;
+      cmd.u.setupCmdInfo.UPType = UPType;
+      cmd.u.setupCmdInfo.hoRenewal = hoRenewal;
+      cmd.u.setupCmdInfo.QosFlowID = QosFlowID;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On session %d couldn't buffer the setup "
+                   "request for flow %d in state = %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, QosFlowID, pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+      }
+      status = SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+      new_state = pACInfo->curr_state;
+      break;
+   case SME_QOS_QOS_ON:
+      
+      //check if multiple flows running on the ac
+      if((pACInfo->num_flows[SME_QOS_TSPEC_INDEX_0] > 0)||
+         (pACInfo->num_flows[SME_QOS_TSPEC_INDEX_1] > 0))
+      {
+         //do we need to care about the case where APSD needed on ACM = 0 below?
+         if(CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(pMac) ||
+            sme_QosIsACM(pMac, pSession->assocInfo.pBssDesc, ac, NULL))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                      "%s: %d: tspec_mask_status = %d for AC = %d",
+                      __FUNCTION__, __LINE__,
+                      pACInfo->tspec_mask_status, ac);
+            if(!pACInfo->tspec_mask_status)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: tspec_mask_status can't be 0 for ac = %d in "
+                         "state = %d",
+                         __FUNCTION__, __LINE__,
+                         ac, pACInfo->curr_state);
+               //ASSERT
+               VOS_ASSERT(0);
+               // unable to service the request
+               // nothing is pending so vote powersave back on
+               pSession->readyForPowerSave = VOS_TRUE;
+               return status;
+            }
+            /* Flow aggregation */
+            if(SME_QOS_TSPEC_MASK_BIT_1_2_SET != pACInfo->tspec_mask_status)
+            {
+              /* Either of upstream, downstream or bidirectional flows are present */
+              /* If either of new stream or current stream is for bidirecional, aggregate 
+               * the new stream with the current streams present and send out aggregated Tspec.*/
+              if((Tspec_Info.ts_info.direction == SME_QOS_WMM_TS_DIR_BOTH) ||
+                 (pACInfo->curr_QoSInfo[pACInfo->tspec_mask_status - 1].
+                      ts_info.direction == SME_QOS_WMM_TS_DIR_BOTH))
+              {
+                // Aggregate the new stream with the current stream(s).
+                tmask = pACInfo->tspec_mask_status;
+              }
+              /* None of new stream or current (aggregated) streams are for bidirectional.
+               * Check if the new stream direction matches the current stream direction. */
+              else if(pACInfo->curr_QoSInfo[pACInfo->tspec_mask_status - 1].
+                  ts_info.direction == Tspec_Info.ts_info.direction)
+              {
+                // Aggregate the new stream with the current stream(s).
+                tmask = pACInfo->tspec_mask_status;
+              }
+              /* New stream is in different direction. */
+              else
+              {
+                // No Aggregation. Mark the 2nd tpsec index also as active.
+                tmask = SME_QOS_TSPEC_MASK_CLEAR;
+                new_tmask = SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~pACInfo->tspec_mask_status;
+                pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_BIT_1_2_SET;
+              }
+            }
+            else
+            {
+              /* Both uplink and downlink streams are present. */
+              /* If new stream is bidirectional, aggregate new stream with all existing
+               * upstreams and downstreams. Send out new aggregated tpsec. */
+              if(Tspec_Info.ts_info.direction == SME_QOS_WMM_TS_DIR_BOTH)
+              {
+                // Only one tspec index (0) will be in use after this aggregation.
+                tmask = SME_QOS_TSPEC_MASK_BIT_1_2_SET;
+                pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_BIT_1_SET;
+              }
+              /* New stream is also uni-directional
+               * Find out the tsepc index with which it needs to be aggregated */
+              else if(pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0].ts_info.direction != 
+                   Tspec_Info.ts_info.direction)
+              {
+                // Aggregate with 2nd tspec index
+                tmask = SME_QOS_TSPEC_MASK_BIT_2_SET;
+              }
+              else
+              {
+                // Aggregate with 1st tspec index
+                tmask = SME_QOS_TSPEC_MASK_BIT_1_SET;
+              }
+            }
+         }
+         else
+         {
+            //ACM = 0
+            // We won't be sending a TSPEC to the AP but we still need
+            // to aggregate to calculate trigger frame parameters
+            tmask = SME_QOS_TSPEC_MASK_BIT_1_SET;
+         }
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED,
+                   "%s: %d: tmask = %d, new_tmask = %d in state = %d",
+                   __FUNCTION__, __LINE__,
+                   tmask, new_tmask, pACInfo->curr_state );
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED,
+                   "%s: %d: tspec_mask_status = %d for AC = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->tspec_mask_status, ac);
+         if(tmask)
+         {
+            // create the aggregate TSPEC
+            if(tmask != SME_QOS_TSPEC_MASK_BIT_1_2_SET)
+            {
+              hstatus = sme_QosAggregateParams(&Tspec_Info, 
+                                               &pACInfo->curr_QoSInfo[tmask - 1],
+                                               &pACInfo->requested_QoSInfo[tmask - 1]);
+            }
+            else
+            {
+              /* Aggregate the new bidirectional stream with the existing upstreams and 
+               * downstreams in tspec indices 0 and 1. */
+              tmask = SME_QOS_TSPEC_MASK_BIT_1_SET;
+
+              if((hstatus = sme_QosAggregateParams(&Tspec_Info, 
+                                                   &pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0],
+                                                   &pACInfo->requested_QoSInfo[tmask - 1]))
+                          == eHAL_STATUS_SUCCESS)
+              {
+                hstatus = sme_QosAggregateParams(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                                                 &pACInfo->requested_QoSInfo[tmask - 1],
+                                                 NULL);
+              }
+            }
+
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: failed to aggregate params",
+                         __FUNCTION__, __LINE__);
+               // unable to service the request
+               // nothing is pending so vote powersave back on
+               pSession->readyForPowerSave = VOS_TRUE;
+               return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+            }
+         }
+         else
+         {
+            tmask = new_tmask;
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: no flows running for ac = %d while in state = %d",
+                   __FUNCTION__, __LINE__,
+                   ac, pACInfo->curr_state );
+         //ASSERT
+         VOS_ASSERT(0);
+         // unable to service the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return status;
+      }
+      //although aggregating, make sure to request on the correct UP
+      pACInfo->requested_QoSInfo[tmask - 1].ts_info.up = Tspec_Info.ts_info.up;
+      status = sme_QosSetup(pMac, sessionId,
+                            &pACInfo->requested_QoSInfo[tmask - 1], ac);
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: On session %d with AC %d in state SME_QOS_QOS_ON "
+                "sme_QosSetup returned with status %d",
+                __FUNCTION__, __LINE__,
+                sessionId, ac, status);
+      if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP != status)
+      {
+         // we aren't waiting for a response from the AP
+         // so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+      }
+      if((SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status)||
+         (SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+         (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status))
+      {
+         // we received an expected "good" status
+         //create an entry in the flow list
+         pentry = (sme_QosFlowInfoEntry *) vos_mem_malloc(sizeof(*pentry));
+         if (!pentry)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                      "%s: %d: couldn't allocate memory for the new "
+                      "entry in the Flow List",
+                      __FUNCTION__, __LINE__);
+            return SME_QOS_STATUS_SETUP_FAILURE_RSP;
+         }
+         pentry->ac_type = ac;
+         pentry->HDDcontext = HDDcontext;
+         pentry->QoSCallback = QoSCallback;
+         pentry->hoRenewal = hoRenewal;
+         pentry->QosFlowID = QosFlowID;
+         pentry->sessionId = sessionId;
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Creating flow %d",
+                   __FUNCTION__, __LINE__,
+                   QosFlowID);
+         if((SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status)||
+            (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status))
+         {
+            new_state = pACInfo->curr_state;
+            pentry->reason = SME_QOS_REASON_REQ_SUCCESS;
+            pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0] = 
+               pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0];
+            if(buffered_cmd && !pentry->hoRenewal)
+            {
+               QoSCallback(pMac, HDDcontext, 
+                           &pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0],
+                           status,
+                           pentry->QosFlowID);
+            }
+            if(SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status)
+            {
+               // if we are not in handoff, then notify all flows on
+               // this AC that the aggregate TSPEC may have changed
+               if(!pentry->hoRenewal)
+               {
+                  vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+                  search_key.key.ac_type = ac;
+                  search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+                  search_key.sessionId = sessionId;
+                  hstatus = sme_QosFindAllInFlowList(pMac, search_key,
+                                                     sme_QosSetupFnp);
+                  if(!HAL_STATUS_SUCCESS(hstatus))
+                  {
+                     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                               "%s: %d: couldn't notify other "
+                               "entries on this AC =%d",
+                               __FUNCTION__, __LINE__, ac);
+                  }
+               }
+            }
+            pentry->hoRenewal = VOS_FALSE;
+         }
+         else
+         {
+            // SME_QOS_STATUS_SETUP_REQ_PENDING_RSP
+            new_state = SME_QOS_REQUESTED;
+            pentry->reason = SME_QOS_REASON_SETUP;
+            //Need this info when addts comes back from PE to know on
+            //which index of the AC the request was from
+            pACInfo->tspec_pending = tmask;
+         }
+         pACInfo->num_flows[tmask - 1]++;
+         //indicate on which index the flow entry belongs to & add it to the 
+         //Flow List at the end
+         pentry->tspec_mask = tmask;
+         pentry->QoSInfo = Tspec_Info;
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: On session %d creating entry at %p with flowID %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, pentry, QosFlowID);
+         csrLLInsertTail(&sme_QosCb.flow_list, &pentry->link, VOS_TRUE);
+      }
+      else
+      {
+         // unexpected status returned by sme_QosSetup()
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On session %d unexpected status %d "
+                   "returned by sme_QosSetup",
+                   __FUNCTION__, __LINE__,
+                   sessionId, status);
+         new_state = pACInfo->curr_state;
+      }
+      break;
+   case SME_QOS_CLOSED:
+   case SME_QOS_INIT:
+   default:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: setup requested in unexpected state = %d",
+                __FUNCTION__, __LINE__,
+                pACInfo->curr_state);
+      // unable to service the request
+      // nothing is pending so vote powersave back on
+      pSession->readyForPowerSave = VOS_TRUE;
+      VOS_ASSERT(0);
+      new_state = pACInfo->curr_state;
+   }
+   /* if current state is same as previous no need for transistion,
+      if we are doing reassoc & we are already in handoff state, no need to move
+      to requested state. But make sure to set the previous state as requested
+      state
+   */
+   if((new_state != pACInfo->curr_state)&&
+      (!(pACInfo->reassoc_pending && 
+         (SME_QOS_HANDOFF == pACInfo->curr_state))))
+   {
+      sme_QosStateTransition(sessionId, ac, new_state);
+   }
+   
+   if(pACInfo->reassoc_pending && 
+      (SME_QOS_HANDOFF == pACInfo->curr_state))
+   {
+      pACInfo->prev_state = SME_QOS_REQUESTED;
+   }
+   if((SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+      (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status)) 
+   {
+      (void)sme_QosProcessBufferedCmd(sessionId);
+   }
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosInternalModifyReq() - The SME QoS internal function to request 
+  for modification of certain QoS params on a flow running on a particular AC. 
+  If the request involves admission control on the requested AC, HDD needs to 
+  provide the necessary Traffic Specification (TSPEC) parameters & SME might
+  start the renegotiation process through ADDTS.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info as defined above, provided by HDD
+  \param QosFlowID - Identification per flow running on each AC generated by 
+                      SME. 
+                     It is only meaningful if the QoS setup for the flow has 
+                     been successful already
+                  
+  \return SME_QOS_STATUS_SETUP_SUCCESS_RSP - Modification is successful.
+  
+          Other status means request failed     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosInternalModifyReq(tpAniSirGlobal pMac, 
+                                           sme_QosWmmTspecInfo * pQoSInfo,
+                                           v_U32_t QosFlowID,
+                                           v_BOOL_t buffered_cmd)
+{
+   tListElem *pEntry= NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *pNewEntry= NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosEdcaAcType ac;
+   sme_QosStates new_state = SME_QOS_CLOSED;
+   sme_QosStatusType status = SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+   sme_QosWmmTspecInfo Aggr_Tspec_Info;
+   sme_QosSearchInfo search_key;
+   sme_QosCmdInfo  cmd;
+   v_U8_t sessionId;
+   v_BOOL_t bufferCommand;
+   eHalStatus hstatus;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked for flow %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID);
+
+   vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+   //set the key type & the key to be searched in the Flow List
+   search_key.key.QosFlowID = QosFlowID;
+   search_key.index = SME_QOS_SEARCH_KEY_INDEX_1;
+   search_key.sessionId = SME_QOS_SEARCH_SESSION_ID_ANY;
+   //go through the link list to find out the details on the flow
+   pEntry = sme_QosFindInFlowList(search_key);
+   if(!pEntry)
+   {
+      //Err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: no match found for flowID = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID);
+      return SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP;
+   }
+   // find the AC
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+
+   sessionId = flow_info->sessionId;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+
+   //validate QoS params
+   if(!sme_QosValidateRequestedParams(pMac, pQoSInfo, sessionId))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: invalid params",
+                __FUNCTION__, __LINE__);
+      return SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP;
+   }
+   // For modify, make sure that direction, TID and UP are not being altered
+   if((pQoSInfo->ts_info.direction != flow_info->QoSInfo.ts_info.direction) ||
+      (pQoSInfo->ts_info.up != flow_info->QoSInfo.ts_info.up) ||
+      (pQoSInfo->ts_info.tid != flow_info->QoSInfo.ts_info.tid))
+   {
+     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s: %d: Modification of direction/tid/up is not allowed",
+               __FUNCTION__, __LINE__);
+
+     return SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP;
+   }
+   // need to vote off powersave for the duration of this request
+   pSession->readyForPowerSave = VOS_FALSE;
+   // assume we won't have to (re)buffer the command
+   bufferCommand = VOS_FALSE;
+   //check to consider the following flowing scenario
+   //Addts request is pending on one AC, while APSD requested on another which 
+   //needs a reassoc. Will buffer a request if Addts is pending on any AC, 
+   //which will safegaurd the above scenario, & also won't confuse PE with back 
+   //to back Addts or Addts followed by Reassoc
+   if(sme_QosIsRspPending(sessionId, ac))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: buffering the modify request for flow %d in state %d "
+                "since another request is pending",
+                __FUNCTION__, __LINE__, 
+                QosFlowID, pACInfo->curr_state );
+      bufferCommand = VOS_TRUE;
+   }
+   else
+   {
+      // make sure we are in full power so that we can issue
+      // an AddTS or reassoc if necessary
+      hstatus = pmcRequestFullPower(pMac, sme_QosPmcFullPowerCallback,
+                                    pSession, eSME_REASON_OTHER);
+      if( eHAL_STATUS_PMC_PENDING == hstatus )
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                   "%s: %d: buffering the modify request for flow %d in state %d, "
+                   "waiting for full power",
+                   __FUNCTION__, __LINE__, 
+                   QosFlowID, pACInfo->curr_state );
+         bufferCommand = VOS_TRUE;
+      }
+   }
+   if (bufferCommand)
+   {
+      // we need to buffer the command
+      cmd.command = SME_QOS_MODIFY_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.modifyCmdInfo.QosFlowID = QosFlowID;
+      cmd.u.modifyCmdInfo.QoSInfo = *pQoSInfo;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the modify request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      }
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Buffered modify request for flow = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID);
+      return SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+   }
+   //get into the stat m/c to see if the request can be granted
+   switch(pACInfo->curr_state)
+   {
+   case SME_QOS_QOS_ON:
+      //save the new params adding a new (duplicate) entry in the Flow List
+      //Once we have decided on OTA exchange needed or not we can delete the
+      //original one from the List
+      pNewEntry = (sme_QosFlowInfoEntry *) vos_mem_malloc(sizeof(*pNewEntry));
+      if (!pNewEntry)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                   "%s: %d: couldn't allocate memory for the new "
+                   "entry in the Flow List",
+                   __FUNCTION__, __LINE__);
+         // unable to service the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      }
+      pNewEntry->ac_type = ac;
+      pNewEntry->sessionId = sessionId;
+      pNewEntry->HDDcontext = flow_info->HDDcontext;
+      pNewEntry->QoSCallback = flow_info->QoSCallback;
+      pNewEntry->QosFlowID = flow_info->QosFlowID;
+      pNewEntry->reason = SME_QOS_REASON_MODIFY_PENDING;
+      //since it is a modify request, use the same index on which the flow
+      //entry originally was running & add it to the Flow List at the end
+      pNewEntry->tspec_mask = flow_info->tspec_mask;
+      pNewEntry->QoSInfo = *pQoSInfo;
+      //update the entry from Flow List which needed to be modified
+      flow_info->reason = SME_QOS_REASON_MODIFY;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: On session %d creating modified "
+                "entry at %p with flowID %d",
+                __FUNCTION__, __LINE__,
+                sessionId, pNewEntry, pNewEntry->QosFlowID);
+      //add the new entry under construction to the Flow List
+      csrLLInsertTail(&sme_QosCb.flow_list, &pNewEntry->link, VOS_TRUE);
+      //update TSPEC with the new param set
+      hstatus = sme_QosUpdateParams(sessionId,
+                                    ac, pNewEntry->tspec_mask, 
+                                    &Aggr_Tspec_Info);
+      if(HAL_STATUS_SUCCESS(hstatus))
+      {
+         pACInfo->requested_QoSInfo[pNewEntry->tspec_mask -1] = Aggr_Tspec_Info;
+         //if ACM, send out a new ADDTS
+         status = sme_QosSetup(pMac, sessionId,
+                               &pACInfo->requested_QoSInfo[pNewEntry->tspec_mask -1],
+                               ac);
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: On session %d with AC %d in state SME_QOS_QOS_ON "
+                   "sme_QosSetup returned with status %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, ac, status);
+         if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP != status)
+         {
+            // we aren't waiting for a response from the AP
+            // so vote powersave back on
+            pSession->readyForPowerSave = VOS_TRUE;
+         }
+         if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status) 
+         {
+            new_state = SME_QOS_REQUESTED;
+            status = SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+            pACInfo->tspec_pending = pNewEntry->tspec_mask;
+         }
+         else if((SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+                 (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status))
+         {
+            new_state = SME_QOS_QOS_ON;
+
+            vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+            //delete the original entry in FLOW list which got modified
+            search_key.key.ac_type = ac;
+            search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+            search_key.sessionId = sessionId;
+            hstatus = sme_QosFindAllInFlowList(pMac, search_key,
+                                               sme_QosModifyFnp);
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               status = SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+            }
+            if(SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP != status)
+            {
+               pACInfo->curr_QoSInfo[pNewEntry->tspec_mask -1] = 
+                  pACInfo->requested_QoSInfo[pNewEntry->tspec_mask -1];
+               if(SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status)
+               {
+                  status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY;
+                  vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+                  search_key.key.ac_type = ac;
+                  search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+                  search_key.sessionId = sessionId;
+                  hstatus = sme_QosFindAllInFlowList(pMac, search_key, 
+                                                     sme_QosModificationNotifyFnp);
+                  if(!HAL_STATUS_SUCCESS(hstatus))
+                  {
+                     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                               "%s: %d: couldn't notify other "
+                               "entries on this AC =%d",
+                               __FUNCTION__, __LINE__, ac);
+                  }
+               }
+               else if(SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status)
+               {
+                  status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP;
+               }
+            }
+            if(buffered_cmd)
+            {
+               flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                      &pACInfo->curr_QoSInfo[pNewEntry->tspec_mask -1],
+                                      status,
+                                      flow_info->QosFlowID);
+            }
+            
+         }
+         else
+         {
+            // unexpected status returned by sme_QosSetup()
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d unexpected status %d "
+                      "returned by sme_QosSetup",
+                      __FUNCTION__, __LINE__,
+                      sessionId, status);
+            new_state = SME_QOS_QOS_ON;
+         }
+      }
+      else
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: sme_QosUpdateParams() failed",
+                   __FUNCTION__, __LINE__);
+         // unable to service the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         new_state = SME_QOS_LINK_UP;
+      }
+      /* if we are doing reassoc & we are already in handoff state, no need
+         to move to requested state. But make sure to set the previous state
+         as requested state
+      */
+      if(!(pACInfo->reassoc_pending && 
+           (SME_QOS_HANDOFF == pACInfo->curr_state)))
+      {
+         sme_QosStateTransition(sessionId, ac, new_state);
+      }
+      else
+      {
+         pACInfo->prev_state = SME_QOS_REQUESTED;
+      }
+      break;
+   case SME_QOS_HANDOFF:
+   case SME_QOS_REQUESTED:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: Buffering modify request for flow %d in state = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID, pACInfo->curr_state );
+      //buffer cmd
+      cmd.command = SME_QOS_MODIFY_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.modifyCmdInfo.QosFlowID = QosFlowID;
+      cmd.u.modifyCmdInfo.QoSInfo = *pQoSInfo;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the modify request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      }
+      status = SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+      break;
+   case SME_QOS_CLOSED:
+   case SME_QOS_INIT:
+   case SME_QOS_LINK_UP:
+   default:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: modify requested in unexpected state = %d",
+                __FUNCTION__, __LINE__,
+                pACInfo->curr_state);
+      // unable to service the request
+      // nothing is pending so vote powersave back on
+      pSession->readyForPowerSave = VOS_TRUE;
+      break;
+   }
+   if((SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+      (SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY == status)) 
+   {
+      (void)sme_QosProcessBufferedCmd(sessionId);
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosInternalReleaseReq() - The SME QoS internal function to request 
+  for releasing a QoS flow running on a particular AC. 
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param QosFlowID - Identification per flow running on each AC generated by SME 
+                     It is only meaningful if the QoS setup for the flow is 
+                     successful
+  
+  \return eHAL_STATUS_SUCCESS - Release is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosInternalReleaseReq(tpAniSirGlobal pMac, 
+                                            v_U32_t QosFlowID,
+                                            v_BOOL_t buffered_cmd)
+{
+   tListElem *pEntry= NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosFlowInfoEntry *pDeletedFlow = NULL;
+   sme_QosEdcaAcType ac;
+   sme_QosStates new_state = SME_QOS_CLOSED;
+   sme_QosStatusType status = SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+   sme_QosWmmTspecInfo Aggr_Tspec_Info;
+   sme_QosSearchInfo search_key;
+   sme_QosCmdInfo  cmd;
+   tCsrRoamModifyProfileFields modifyProfileFields;
+   v_BOOL_t  deltsIssued = VOS_FALSE;
+   v_U8_t sessionId;
+   v_BOOL_t bufferCommand;
+   eHalStatus hstatus;
+   v_BOOL_t biDirectionalFlowsPresent = VOS_FALSE;
+   v_BOOL_t uplinkFlowsPresent = VOS_FALSE;
+   v_BOOL_t downlinkFlowsPresent = VOS_FALSE;
+   tListElem *pResult= NULL;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked for flow %d",
+             __FUNCTION__, __LINE__,
+             QosFlowID);
+
+   vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+   //set the key type & the key to be searched in the Flow List
+   search_key.key.QosFlowID = QosFlowID;
+   search_key.index = SME_QOS_SEARCH_KEY_INDEX_1;
+   search_key.sessionId = SME_QOS_SEARCH_SESSION_ID_ANY;
+   //go through the link list to find out the details on the flow
+   pEntry = sme_QosFindInFlowList(search_key);
+   
+   if(!pEntry)
+   {
+      //Err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: no match found for flowID = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID);
+      return SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP;
+   }
+   // find the AC
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   sessionId = flow_info->sessionId;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   // need to vote off powersave for the duration of this request
+   pSession->readyForPowerSave = VOS_FALSE;
+   // assume we won't have to (re)buffer the command
+   bufferCommand = VOS_FALSE;
+   //check to consider the following flowing scenario
+   //Addts request is pending on one AC, while APSD requested on another which 
+   //needs a reassoc. Will buffer a request if Addts is pending on any AC, 
+   //which will safegaurd the above scenario, & also won't confuse PE with back 
+   //to back Addts or Addts followed by Reassoc
+   if(sme_QosIsRspPending(sessionId, ac))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: buffering the release request for flow %d in state %d "
+                "since another request is pending",
+                __FUNCTION__, __LINE__, 
+                QosFlowID, pACInfo->curr_state );
+      bufferCommand = VOS_TRUE;
+   }
+   else
+   {
+      // make sure we are in full power so that we can issue
+      // a DelTS or reassoc if necessary
+      hstatus = pmcRequestFullPower(pMac, sme_QosPmcFullPowerCallback,
+                                    pSession, eSME_REASON_OTHER);
+      if( eHAL_STATUS_PMC_PENDING == hstatus )
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                   "%s: %d: buffering the release request for flow %d in state %d, "
+                   "waiting for full power",
+                   __FUNCTION__, __LINE__, 
+                   QosFlowID, pACInfo->curr_state );
+         bufferCommand = VOS_TRUE;
+      }
+   }
+   if (bufferCommand)
+   {
+      // we need to buffer the command
+      cmd.command = SME_QOS_RELEASE_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.releaseCmdInfo.QosFlowID = QosFlowID;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the release request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+      }
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Buffered release request for flow = %d",
+                __FUNCTION__, __LINE__,
+                QosFlowID);
+      return SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP;
+   }
+   //get into the stat m/c to see if the request can be granted
+   switch(pACInfo->curr_state)
+   {
+   case SME_QOS_QOS_ON:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                "%s: %d: tspec_mask_status = %d for AC = %d with "
+                "entry tspec_mask = %d",
+                __FUNCTION__, __LINE__, 
+                pACInfo->tspec_mask_status, ac, flow_info->tspec_mask);
+
+      //check if multiple flows running on the ac
+      if(pACInfo->num_flows[flow_info->tspec_mask - 1] > 1)
+      {
+         //don't want to include the flow in the new TSPEC on which release 
+         //is requested
+         flow_info->reason = SME_QOS_REASON_RELEASE;
+
+         /* Check if the flow being released is for bi-diretional.
+          * Following flows may present in the system. 
+          * a) bi-directional flows
+          * b) uplink flows
+          * c) downlink flows. 
+          * If the flow being released is for bidirectional, splitting of existing 
+          * streams into two tspec indices is required in case ff (b), (c) are present 
+          * and not (a).
+          * In case if split occurs, all upstreams are aggregated into tspec index 0, 
+          * downstreams are aggregaed into tspec index 1 and two tspec requests for 
+          * (aggregated) upstream(s) followed by (aggregated) downstream(s) is sent
+          * to AP. */
+         if(flow_info->QoSInfo.ts_info.direction == SME_QOS_WMM_TS_DIR_BOTH)
+         {
+           vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+           //set the key type & the key to be searched in the Flow List
+           search_key.key.ac_type = ac;
+           search_key.index = SME_QOS_SEARCH_KEY_INDEX_4;
+           search_key.sessionId = sessionId;
+           search_key.direction = SME_QOS_WMM_TS_DIR_BOTH;
+           pResult = sme_QosFindInFlowList(search_key);
+           if(pResult)
+             biDirectionalFlowsPresent = VOS_TRUE;
+
+           if(!biDirectionalFlowsPresent)
+           {
+             // The only existing bidirectional flow is being released
+
+             // Check if uplink flows exist
+             search_key.direction = SME_QOS_WMM_TS_DIR_UPLINK;
+             pResult = sme_QosFindInFlowList(search_key);
+             if(pResult)
+               uplinkFlowsPresent = VOS_TRUE;
+
+             // Check if downlink flows exist
+             search_key.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
+             pResult = sme_QosFindInFlowList(search_key);
+             if(pResult)
+               downlinkFlowsPresent = VOS_TRUE;
+
+             if(uplinkFlowsPresent && downlinkFlowsPresent)
+             {
+               // Need to split the uni-directional flows into SME_QOS_TSPEC_INDEX_0 and SME_QOS_TSPEC_INDEX_1
+
+               vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+               // Mark all downstream flows as using tspec index 1
+               search_key.key.ac_type = ac;
+               search_key.index = SME_QOS_SEARCH_KEY_INDEX_4;
+               search_key.sessionId = sessionId;
+               search_key.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
+               sme_QosUpdateTspecMask(sessionId, search_key, SME_QOS_TSPEC_MASK_BIT_2_SET);
+
+               // Aggregate all downstream flows
+               hstatus = sme_QosUpdateParams(sessionId,
+                                             ac, SME_QOS_TSPEC_MASK_BIT_2_SET,
+                                             &Aggr_Tspec_Info);
+
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                         "%s: %d: On session %d buffering the AddTS request "
+                            "for AC %d in state %d as Addts is pending "
+                         "on other Tspec index of this AC",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac, pACInfo->curr_state);
+
+               // Buffer the (aggregated) tspec request for downstream flows.
+               // Please note that the (aggregated) tspec for upstream flows is sent 
+               // out by the susequent logic.
+               cmd.command = SME_QOS_RESEND_REQ;
+               cmd.pMac = pMac;
+               cmd.sessionId = sessionId;
+               cmd.u.resendCmdInfo.ac = ac;
+               cmd.u.resendCmdInfo.tspecMask = SME_QOS_TSPEC_MASK_BIT_2_SET;
+               cmd.u.resendCmdInfo.QoSInfo = Aggr_Tspec_Info;
+               pACInfo->requested_QoSInfo[SME_QOS_TSPEC_MASK_BIT_2_SET - 1] = Aggr_Tspec_Info;
+               if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_FALSE)))
+               {
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                            "%s: %d: On session %d unable to buffer the AddTS "
+                            "request for AC %d TSPEC %d in state %d",
+                            __FUNCTION__, __LINE__,
+                            sessionId, ac, SME_QOS_TSPEC_MASK_BIT_2_SET, pACInfo->curr_state);
+
+                  // unable to buffer the request
+                  // nothing is pending so vote powersave back on
+                  pSession->readyForPowerSave = VOS_TRUE;
+
+                  return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+               }
+               pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_BIT_1_2_SET;
+
+             }
+           }
+         }
+
+         /* In case of splitting of existing streams,
+          * tspec_mask will be pointing to tspec index 0 and 
+          * aggregated tspec for upstream(s) is sent out here. */
+         hstatus = sme_QosUpdateParams(sessionId,
+                                       ac, flow_info->tspec_mask,
+                                       &Aggr_Tspec_Info);
+         if(HAL_STATUS_SUCCESS(hstatus))
+         {
+            pACInfo->requested_QoSInfo[flow_info->tspec_mask - 1] = Aggr_Tspec_Info;
+            //if ACM, send out a new ADDTS
+            status = sme_QosSetup(pMac, sessionId,
+                                  &pACInfo->requested_QoSInfo[flow_info->tspec_mask - 1], ac);
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: On session %d with AC %d in state SME_QOS_QOS_ON "
+                      "sme_QosSetup returned with status %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, status);
+            if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP != status)
+            {
+               // we aren't waiting for a response from the AP
+               // so vote powersave back on
+               pSession->readyForPowerSave = VOS_TRUE;
+            }
+            if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status) 
+            {
+               new_state = SME_QOS_REQUESTED;
+               status = SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP;
+               pACInfo->tspec_pending = flow_info->tspec_mask;
+            }
+            else if((SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+                    (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status))
+            {
+               new_state = SME_QOS_QOS_ON;
+               pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+               pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1] =
+                  pACInfo->requested_QoSInfo[flow_info->tspec_mask - 1];
+               //delete the entry from Flow List
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: Deleting entry at %p with flowID %d",
+                         __FUNCTION__, __LINE__,
+                         flow_info, QosFlowID);
+               csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+               pDeletedFlow = flow_info;
+               if(SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status)
+               {
+                  vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+                  search_key.key.ac_type = ac;
+                  search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+                  search_key.sessionId = sessionId;
+                  hstatus = sme_QosFindAllInFlowList(pMac, search_key, 
+                                                     sme_QosSetupFnp);
+                  if(!HAL_STATUS_SUCCESS(hstatus))
+                  {
+                     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                               "%s: %d: couldn't notify other "
+                               "entries on this AC =%d",
+                               __FUNCTION__, __LINE__, ac);
+                  }
+               }
+               status = SME_QOS_STATUS_RELEASE_SUCCESS_RSP;
+               if(buffered_cmd)
+               {
+                  flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                         &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                                         status,
+                                         flow_info->QosFlowID);
+               }
+            }
+            else
+            {
+               // unexpected status returned by sme_QosSetup()
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: On session %d unexpected status %d "
+                         "returned by sme_QosSetup",
+                         __FUNCTION__, __LINE__,
+                         sessionId, status);
+               new_state = SME_QOS_LINK_UP;
+               pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+               pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1] =
+                  pACInfo->requested_QoSInfo[flow_info->tspec_mask - 1];
+               //delete the entry from Flow List
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: On session %d deleting entry at "
+                         "%p with flowID %d",
+                         __FUNCTION__, __LINE__,
+                         sessionId, flow_info, QosFlowID);
+               csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+               pDeletedFlow = flow_info;
+               if(buffered_cmd)
+               {
+                  flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                         &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                                         status,
+                                         flow_info->QosFlowID);
+               }
+            }
+         }
+         else
+         {
+            //err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosUpdateParams() failed",
+                      __FUNCTION__, __LINE__);
+            // unable to service the request
+            // nothing is pending so vote powersave back on
+            pSession->readyForPowerSave = VOS_TRUE;
+            new_state = SME_QOS_LINK_UP;
+            if(buffered_cmd)
+            {
+               flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                      &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                                      status,
+                                      flow_info->QosFlowID);
+            }
+         }
+      }
+      else
+      {
+         // this is the only flow aggregated in this TSPEC
+         status = SME_QOS_STATUS_RELEASE_SUCCESS_RSP;
+#ifdef FEATURE_WLAN_CCX
+         if (ac == SME_QOS_EDCA_AC_VO)
+         {
+            // Indicate to neighbor roam logic of the new required VO
+            // ac bandwidth requirement.
+            csrNeighborRoamIndicateVoiceBW( pMac, pACInfo->curr_QoSInfo[0].peak_data_rate, FALSE );
+         }
+#endif
+         //check if delts needs to be sent
+         if(CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(pMac) ||
+            sme_QosIsACM(pMac, pSession->assocInfo.pBssDesc, ac, NULL))
+         {
+            //check if other TSPEC for this AC is also in use
+            if(SME_QOS_TSPEC_MASK_BIT_1_2_SET != pACInfo->tspec_mask_status)
+            {
+               // this is the only TSPEC active on this AC
+               // so indicate that we no longer require APSD
+               pSession->apsdMask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+               //Also update modifyProfileFields.uapsd_mask in CSR for consistency
+               csrGetModifyProfileFields(pMac, flow_info->sessionId, &modifyProfileFields);
+               modifyProfileFields.uapsd_mask = pSession->apsdMask; 
+               csrSetModifyProfileFields(pMac, flow_info->sessionId, &modifyProfileFields);
+               if(!pSession->apsdMask)
+               {
+                  // this session no longer needs UAPSD
+                  // do any sessions still require UAPSD?
+                  if (!sme_QosIsUapsdActive())
+                  {
+                     // No sessions require UAPSD so turn it off
+                     // (really don't care when PMC stops it)
+                     (void)pmcStopUapsd(pMac);
+                  }
+               }
+            }
+            //send delts
+            hstatus = qosIssueCommand(pMac, sessionId, eSmeCommandDelTs,
+                                      NULL, ac, flow_info->tspec_mask);
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: sme_QosDelTsReq() failed",
+                         __FUNCTION__, __LINE__);
+               status = SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+               // we won't be waiting for a response from the AP
+               // so vote powersave back on
+               pSession->readyForPowerSave = VOS_TRUE;
+            }
+            else
+            {
+               pACInfo->tspec_mask_status &= SME_QOS_TSPEC_MASK_BIT_1_2_SET & 
+                  (~flow_info->tspec_mask);
+               deltsIssued = VOS_TRUE;
+            }
+         }
+         else if(pSession->apsdMask & (1 << (SME_QOS_EDCA_AC_VO - ac)))
+         {
+            //reassoc logic
+            csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields);
+            modifyProfileFields.uapsd_mask |= pSession->apsdMask;
+            modifyProfileFields.uapsd_mask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+            pSession->apsdMask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+            if(!pSession->apsdMask)
+            {
+               // this session no longer needs UAPSD
+               // do any sessions still require UAPSD?
+               if (!sme_QosIsUapsdActive())
+               {
+                  // No sessions require UAPSD so turn it off
+                  // (really don't care when PMC stops it)
+                  (void)pmcStopUapsd(pMac);
+               }
+            }
+            hstatus = sme_QosRequestReassoc(pMac, sessionId,
+                                            &modifyProfileFields, VOS_FALSE);
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: Reassoc failed",
+                         __FUNCTION__, __LINE__);
+               status = SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+               // we won't be waiting for a response from the AP
+               // so vote powersave back on
+               pSession->readyForPowerSave = VOS_TRUE;
+            }
+            else
+            {
+               pACInfo->reassoc_pending = VOS_FALSE;//no need to wait
+               pACInfo->prev_state = SME_QOS_LINK_UP;
+               pACInfo->tspec_pending = 0;
+            }
+         }
+         else
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: nothing to do for AC = %d",
+                      __FUNCTION__, __LINE__, ac);
+            // we won't be waiting for a response from the AP
+            // so vote powersave back on
+            pSession->readyForPowerSave = VOS_TRUE;
+         }
+         if(buffered_cmd)
+         {
+            flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                   NULL,
+                                   status,
+                                   flow_info->QosFlowID);
+         }
+         if(SME_QOS_STATUS_RELEASE_FAILURE_RSP == status)
+         {
+            break;
+         }
+
+         if(((SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~flow_info->tspec_mask) > 0) &&
+            ((SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~flow_info->tspec_mask) <= 
+                SME_QOS_TSPEC_INDEX_MAX))
+         {
+            if(pACInfo->num_flows[(SME_QOS_TSPEC_MASK_BIT_1_2_SET & 
+                                    ~flow_info->tspec_mask) - 1] > 0)
+            {
+               new_state = SME_QOS_QOS_ON;
+            }
+            else
+            {
+               new_state = SME_QOS_LINK_UP;
+            }         
+         }
+         else
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: Exceeded the array bounds of pACInfo->num_flows",
+                      __FUNCTION__, __LINE__);
+            VOS_ASSERT (0);
+            return SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP;
+         }
+
+         if(VOS_FALSE == deltsIssued)
+         {
+            vos_mem_zero(&pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1], 
+                      sizeof(sme_QosWmmTspecInfo));
+         }
+         vos_mem_zero(&pACInfo->requested_QoSInfo[flow_info->tspec_mask - 1], 
+                      sizeof(sme_QosWmmTspecInfo));
+         pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+         //delete the entry from Flow List
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: On session %d deleting entry at %p with flowID %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, flow_info, QosFlowID);
+         csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+         pDeletedFlow = flow_info;
+      }
+      /* if we are doing reassoc & we are already in handoff state, no need
+         to move to requested state. But make sure to set the previous state
+         as requested state
+      */
+      if(SME_QOS_HANDOFF != pACInfo->curr_state)
+      {
+         sme_QosStateTransition(sessionId, ac, new_state);
+      }
+      if(pACInfo->reassoc_pending)
+      {
+         pACInfo->prev_state = SME_QOS_REQUESTED;
+      }
+      break;
+   case SME_QOS_HANDOFF:
+   case SME_QOS_REQUESTED:
+      //buffer cmd
+      cmd.command = SME_QOS_RELEASE_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.releaseCmdInfo.QosFlowID = QosFlowID;
+      hstatus = sme_QosBufferCmd(&cmd, buffered_cmd);
+      if(!HAL_STATUS_SUCCESS(hstatus))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the release request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to service the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+      }
+      status = SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP;
+      break;
+   case SME_QOS_CLOSED:
+   case SME_QOS_INIT:
+   case SME_QOS_LINK_UP:
+   default:
+      //print error msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: release request in unexpected state = %d",
+                __FUNCTION__, __LINE__,
+                pACInfo->curr_state );
+      //ASSERT
+      VOS_ASSERT(0);
+      // unable to service the request
+      // nothing is pending so vote powersave back on
+      pSession->readyForPowerSave = VOS_TRUE;
+      break;
+   }
+   // if we deleted a flow, reclaim the memory
+   if (pDeletedFlow)
+   {
+      vos_mem_free(pDeletedFlow);
+   }
+   if((SME_QOS_STATUS_RELEASE_SUCCESS_RSP == status)) 
+   {
+      (void)sme_QosProcessBufferedCmd(sessionId);
+   }
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetup() - The internal qos setup function which has the 
+  intelligence if the request is NOP, or for APSD and/or need to send out ADDTS.
+  It also does the sanity check for QAP, AP supports APSD etc.
+  \param pMac - Pointer to the global MAC parameter structure.   
+  \param sessionId - Session upon which setup is being performed
+  \param pTspec_Info - Pointer to sme_QosWmmTspecInfo which contains the WMM 
+                       TSPEC related info as defined above
+  \param ac - Enumeration of the various EDCA Access Categories.
+  
+  \return SME_QOS_STATUS_SETUP_SUCCESS_RSP if the setup is successful
+  The logic used in the code might be confusing. Trying to cover all the cases 
+  here.
+  AP supports  App wants   ACM = 1  Already set APSD   Result
+  |    0     |    0     |     0   |       0          |  NO ACM NO APSD
+  |    0     |    0     |     0   |       1          |  NO ACM NO APSD/INVALID
+  |    0     |    0     |     1   |       0          |  ADDTS
+  |    0     |    0     |     1   |       1          |  ADDTS
+  |    0     |    1     |     0   |       0          |  FAILURE
+  |    0     |    1     |     0   |       1          |  INVALID
+  |    0     |    1     |     1   |       0          |  ADDTS
+  |    0     |    1     |     1   |       1          |  ADDTS
+  |    1     |    0     |     0   |       0          |  NO ACM NO APSD
+  |    1     |    0     |     0   |       1          |  NO ACM NO APSD
+  |    1     |    0     |     1   |       0          |  ADDTS
+  |    1     |    0     |     1   |       1          |  ADDTS
+  |    1     |    1     |     0   |       0          |  REASSOC
+  |    1     |    1     |     0   |       1          |  NOP: APSD SET ALREADY
+  |    1     |    1     |     1   |       0          |  ADDTS
+  |    1     |    1     |     1   |       1          |  ADDTS
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosStatusType sme_QosSetup(tpAniSirGlobal pMac,
+                               v_U8_t sessionId,
+                               sme_QosWmmTspecInfo *pTspec_Info, 
+                               sme_QosEdcaAcType ac)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosStatusType status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   tDot11fBeaconIEs *pIes = NULL;
+   tCsrRoamModifyProfileFields modifyProfileFields;
+   eHalStatus hstatus;
+   if( !CSR_IS_SESSION_VALID( pMac, sessionId ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Session Id %d is invalid",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      return status;
+   }
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   if( !pSession->sessionActive )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Session %d is inactive",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      return status;
+   }
+   if(!pSession->assocInfo.pBssDesc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Session %d has an Invalid BSS Descriptor",
+                __FUNCTION__, __LINE__,
+                sessionId, ac);
+      return status;
+   }
+   hstatus = csrGetParsedBssDescriptionIEs(pMac,
+                                           pSession->assocInfo.pBssDesc,
+                                           &pIes);
+   if(!HAL_STATUS_SUCCESS(hstatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                "%s: %d: On session %d unable to parse BSS IEs",
+                __FUNCTION__, __LINE__,
+                sessionId, ac);
+      return status;
+   }
+
+   /* success so pIes was allocated */
+
+   if( !CSR_IS_QOS_BSS(pIes) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d AP doesn't support QoS",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      vos_mem_free(pIes);
+      //notify HDD through the synchronous status msg
+      return SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP;
+   }
+   if(pTspec_Info->max_service_interval || pTspec_Info->min_service_interval)
+   {
+      pTspec_Info->ts_info.psb = 1;
+   }
+   else
+   {
+      pTspec_Info->ts_info.psb = 0;
+   }
+
+   pACInfo = &pSession->ac_info[ac];
+   do
+   {
+      // is ACM enabled for this AC?
+      if(CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(pMac) ||
+         sme_QosIsACM(pMac, pSession->assocInfo.pBssDesc, ac, NULL))
+      {
+         // ACM is enabled for this AC so we must send an AddTS
+         if(pTspec_Info->ts_info.psb && 
+            (!pMac->pmc.uapsdEnabled ))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: Request is looking for APSD but PMC doesn't "
+                      "have support for APSD",
+                      __FUNCTION__, __LINE__);
+            break;
+         }
+         if(SME_QOS_MAX_TID == pTspec_Info->ts_info.tid)
+         {
+            //App didn't set TID, generate one
+            pTspec_Info->ts_info.tid =
+               (v_U8_t)(SME_QOS_WMM_UP_NC - pTspec_Info->ts_info.up);
+         }
+         //addts logic
+         hstatus = qosIssueCommand(pMac, sessionId, eSmeCommandAddTs,
+                                   pTspec_Info, ac, 0);
+         if(!HAL_STATUS_SUCCESS(hstatus))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosAddTsReq() failed",
+                      __FUNCTION__, __LINE__);
+            break;
+         }
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "%s: %d: On session %d AddTS on AC %d is pending",
+                   __FUNCTION__, __LINE__,
+                   sessionId, ac);
+         status = SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+         break;
+      }
+      // ACM is not enabled for this AC
+      // Is the application looking for APSD?
+      if(0 == pTspec_Info->ts_info.psb)
+      {
+         //no, we don't need APSD
+         //but check the case, if the setup is called as a result of a release 
+         // or modify which boils down to the fact that APSD was set on this AC
+         // but no longer needed - so we need a reassoc for the above case to 
+         // let the AP know
+         if(pSession->apsdMask & (1 << (SME_QOS_EDCA_AC_VO - ac)))
+         {
+            // APSD was formerly enabled on this AC but is no longer required
+            // so we must reassociate
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: On session %d reassoc needed "
+                      "to disable APSD on AC %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac);
+            csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields);
+            modifyProfileFields.uapsd_mask |= pSession->apsdMask;
+            modifyProfileFields.uapsd_mask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+            hstatus = sme_QosRequestReassoc(pMac, sessionId,
+                                            &modifyProfileFields, VOS_FALSE);
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: Unable to request reassociation",
+                         __FUNCTION__, __LINE__);
+               break;
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                         "%s: %d: On session %d reassociation to enable "
+                         "APSD on AC %d is pending",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac);
+               status = SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+               pACInfo->reassoc_pending = VOS_TRUE;
+            }
+         }
+         else
+         {
+            // we don't need APSD on this AC
+            // and we don't currently have APSD on this AC
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: Request is not looking for APSD & Admission "
+                      "Control isn't mandatory for the AC",
+                      __FUNCTION__, __LINE__);
+            //return success right away
+            status = SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP;
+         }
+         break;
+      }
+      else if(!(pIes->WMMParams.qosInfo & SME_QOS_AP_SUPPORTS_APSD) &&
+              !(pIes->WMMInfoAp.uapsd))
+      {
+         // application is looking for APSD but AP doesn't support it
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On session %d AP doesn't support APSD",
+                   __FUNCTION__, __LINE__,
+                   sessionId);
+         break;
+      }
+      else if(pSession->apsdMask & (1 << (SME_QOS_EDCA_AC_VO - ac)))
+      {
+         // application is looking for APSD
+         // and it is already enabled on this AC
+         status = SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY;
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Request is looking for APSD and it is already "
+                   "set for the AC",
+                   __FUNCTION__, __LINE__);
+         break;
+      }
+      else
+      {
+         // application is looking for APSD
+         // but it is not enabled on this AC
+         // so we need to reassociate
+         if(pMac->pmc.uapsdEnabled)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: On session %d reassoc needed "
+                      "to enable APSD on AC %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac);
+            //reassoc logic
+            // update the UAPSD mask to include the new 
+            // AC on which APSD is requested
+            csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields);
+            modifyProfileFields.uapsd_mask |= pSession->apsdMask;
+            modifyProfileFields.uapsd_mask |= 1 << (SME_QOS_EDCA_AC_VO - ac);
+            hstatus = sme_QosRequestReassoc(pMac, sessionId,
+                                            &modifyProfileFields, VOS_FALSE);
+            if(!HAL_STATUS_SUCCESS(hstatus))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: Unable to request reassociation",
+                         __FUNCTION__, __LINE__);
+               break;
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                         "%s: %d: On session %d reassociation to enable "
+                         "APSD on AC %d is pending",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac);
+               status = SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+               pACInfo->reassoc_pending = VOS_TRUE;
+            }
+         }
+         else
+         {
+            //err msg: no support for APSD from PMC
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: no support for APSD or BMPS from PMC",
+                      __FUNCTION__, __LINE__);
+         }
+      }
+   }while(0);
+
+   vos_mem_free(pIes);
+   return status;
+}
+
+#ifdef FEATURE_WLAN_CCX
+/* This is a dummy function now. But the purpose of me adding this was to 
+ * delay the TSPEC processing till SET_KEY completes. This function can be 
+ * used to do any SME_QOS processing after the SET_KEY. As of now, it is 
+ * not required as we are ok with tspec getting programmed before set_key 
+ * as the roam timings are measured without tspec in reassoc!
+ */
+eHalStatus sme_QosProcessSetKeySuccessInd(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+            "########### CCX Set Key Complete #############");
+    return eHAL_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCCXSaveTspecResponse() - This function saves the TSPEC
+         parameters that came along in the TSPEC IE in the reassoc response
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param sessionId - SME session ID 
+  \param pTspec - Pointer to the TSPEC IE from the reassoc rsp
+  \param ac - Access Category for which this TSPEC rsp is received
+  \param tspecIndex - flow/direction
+  
+  \return eHAL_STATUS_SUCCESS - Release is successful.
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosCCXSaveTspecResponse(tpAniSirGlobal pMac, v_U8_t sessionId, tDot11fIEWMMTSPEC *pTspec, v_U8_t ac, v_U8_t tspecIndex)
+{
+    tpSirAddtsRsp pAddtsRsp = &sme_QosCb.sessionInfo[sessionId].ac_info[ac].addTsRsp[tspecIndex];
+
+    ac = sme_QosUPtoACMap[pTspec->user_priority];
+
+    vos_mem_zero(pAddtsRsp, sizeof(tSirAddtsRsp));
+
+    pAddtsRsp->messageType = eWNI_SME_ADDTS_RSP;
+    pAddtsRsp->length = sizeof(tSirAddtsRsp);
+    pAddtsRsp->rc = eSIR_SUCCESS;
+    pAddtsRsp->sessionId = sessionId;
+    pAddtsRsp->rsp.dialogToken = 0;
+    pAddtsRsp->rsp.status = eSIR_SUCCESS;
+    pAddtsRsp->rsp.wmeTspecPresent = pTspec->present;
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+            "%s: Copy Tspec to local data structure ac=%d, tspecIdx=%d", 
+            __FUNCTION__, ac, tspecIndex);
+
+    if (pAddtsRsp->rsp.wmeTspecPresent)
+    {
+        //Copy TSPEC params received in assoc response to addts response
+        ConvertWMMTSPEC(pMac, &pAddtsRsp->rsp.tspec, pTspec);
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCCXProcessReassocTspecRsp() - This function processes the
+         WMM TSPEC IE in the reassoc response. Reassoc triggered as part of 
+         CCX roaming to another CCX capable AP. If the TSPEC was added before 
+         reassoc, as part of Call Admission Control, the reasso req from the
+         STA would carry the TSPEC parameters which were already negotiated
+         with the older AP.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param sessionId - SME session ID 
+  \param pEven_info - Pointer to the smeJoinRsp structure
+  
+  \return eHAL_STATUS_SUCCESS - Release is successful.
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosCCXProcessReassocTspecRsp(tpAniSirGlobal pMac, v_U8_t sessionId, void* pEvent_info)
+{
+    sme_QosSessionInfo *pSession;
+    sme_QosACInfo *pACInfo;
+    tDot11fIEWMMTSPEC *pTspecIE = NULL;
+    tCsrRoamSession *pCsrSession = CSR_GET_SESSION( pMac, sessionId );
+    tCsrRoamConnectedInfo *pCsrConnectedInfo = &pCsrSession->connectedInfo;
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    v_U8_t ac, numTspec, cnt;
+    v_U8_t tspec_flow_index, tspec_mask_status;
+    v_U32_t tspecIeLen;
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+    // Get the TSPEC IEs which came along with the reassoc response 
+    // from the pbFrames pointer
+    pTspecIE = (tDot11fIEWMMTSPEC *)(pCsrConnectedInfo->pbFrames + pCsrConnectedInfo->nBeaconLength +
+        pCsrConnectedInfo->nAssocReqLength + pCsrConnectedInfo->nAssocRspLength + pCsrConnectedInfo->nRICRspLength);
+
+    // Get the number of tspecs Ies in the frame, the min length
+    // should be atleast equal to the one TSPEC IE 
+    tspecIeLen = pCsrConnectedInfo->nTspecIeLength;
+    if (tspecIeLen < sizeof(tDot11fIEWMMTSPEC)) {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                FL("CCX Tspec IE len %d less than min %d"), 
+                tspecIeLen, sizeof(tDot11fIEWMMTSPEC));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
+             "TspecLen = %d, pbFrames = %p, pTspecIE = %p\n", 
+             tspecIeLen, pCsrConnectedInfo->pbFrames, pTspecIE);
+
+    numTspec = (tspecIeLen)/sizeof(tDot11fIEWMMTSPEC);
+    for(cnt=0; cnt<numTspec; cnt++) {
+        ac = sme_QosUpToAc(pTspecIE->user_priority);
+        pACInfo = &pSession->ac_info[ac];
+        tspec_mask_status = pACInfo->tspec_mask_status;
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                FL("UP=%d, ac=%d, tspec_mask_status=%x"), 
+                pTspecIE->user_priority, ac,  tspec_mask_status );
+
+            for (tspec_flow_index = 0; tspec_flow_index < SME_QOS_TSPEC_INDEX_MAX; tspec_flow_index++) {
+                if (tspec_mask_status & (1 << tspec_flow_index)) {
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                FL("Found Tspec entry flow = %d AC = %d"),tspec_flow_index, ac);
+                    sme_QosCCXSaveTspecResponse(pMac, sessionId, pTspecIE, ac, tspec_flow_index);
+                } else {
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                FL("Not found Tspec entry flow = %d AC = %d"),tspec_flow_index, ac);
+                }
+            }
+        // Increment the pointer to point it to the next TSPEC IE
+        pTspecIE++;
+    }
+
+    /* Send the Aggregated QoS request to HAL */
+    status = sme_QosFTAggrQosReq(pMac,sessionId);
+
+    return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCopyTspecInfo() - This function copies the existing TSPEC 
+         parameters from the source structure to the destination structure.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pTspec_Info - source structure
+  \param pTspec - destination structure
+  
+  \return void 
+  --------------------------------------------------------------------------*/
+static void sme_QosCopyTspecInfo(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pTspec_Info, tSirMacTspecIE* pTspec)
+{
+    /* As per WMM_AC_testplan_v0.39 Minimum Service Interval, Maximum Service
+     * Interval, Service Start Time, Suspension Interval and Delay Bound are
+     * all intended for HCCA operation and therefore must be set to zero*/
+    pTspec->delayBound        = pTspec_Info->delay_bound;
+    pTspec->inactInterval     = pTspec_Info->inactivity_interval;
+    pTspec->length            = SME_QOS_TSPEC_IE_LENGTH;
+    pTspec->maxBurstSz        = pTspec_Info->max_burst_size;
+    pTspec->maxMsduSz         = pTspec_Info->maximum_msdu_size;
+    pTspec->maxSvcInterval    = pTspec_Info->max_service_interval;
+    pTspec->meanDataRate      = pTspec_Info->mean_data_rate;
+    pTspec->mediumTime        = pTspec_Info->medium_time;
+    pTspec->minDataRate       = pTspec_Info->min_data_rate;
+    pTspec->minPhyRate        = pTspec_Info->min_phy_rate;
+    pTspec->minSvcInterval    = pTspec_Info->min_service_interval;
+    pTspec->nomMsduSz         = pTspec_Info->nominal_msdu_size;
+    pTspec->peakDataRate      = pTspec_Info->peak_data_rate;
+    pTspec->surplusBw         = pTspec_Info->surplus_bw_allowance;
+    pTspec->suspendInterval   = pTspec_Info->suspension_interval;
+    pTspec->svcStartTime      = pTspec_Info->svc_start_time;
+    pTspec->tsinfo.traffic.direction = pTspec_Info->ts_info.direction;
+
+    //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup
+    if (pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac)) {
+        pTspec->tsinfo.traffic.psb = pTspec_Info->ts_info.psb;
+    } else {
+        pTspec->tsinfo.traffic.psb = 0;
+        pTspec_Info->ts_info.psb = 0;
+    }
+    pTspec->tsinfo.traffic.tsid           = pTspec_Info->ts_info.tid;
+    pTspec->tsinfo.traffic.userPrio       = pTspec_Info->ts_info.up;
+    pTspec->tsinfo.traffic.accessPolicy   = SME_QOS_ACCESS_POLICY_EDCA;
+    pTspec->tsinfo.traffic.burstSizeDefn  = pTspec_Info->ts_info.burst_size_defn;
+    pTspec->tsinfo.traffic.ackPolicy      = pTspec_Info->ts_info.ack_policy;
+    pTspec->type                          = SME_QOS_TSPEC_IE_TYPE;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: %d: up = %d, tid = %d",
+            __FUNCTION__, __LINE__,
+            pTspec_Info->ts_info.up,
+            pTspec_Info->ts_info.tid);
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosCCxRetrieveTspecInfo() - This function is called by CSR
+         when try to create reassoc request message to PE - csrSendSmeReassocReqMsg
+         This functions get the existing tspec parameters to be included
+         in the reassoc request.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param sessionId - SME session ID 
+  \param pTspecInfo - Pointer to the structure to carry back the TSPEC parameters
+  
+  \return v_U8_t - number of existing negotiated TSPECs
+  --------------------------------------------------------------------------*/
+v_U8_t sme_QosCCxRetrieveTspecInfo(tpAniSirGlobal pMac, v_U8_t sessionId, tTspecInfo *pTspecInfo)
+{
+    sme_QosSessionInfo *pSession;
+    sme_QosACInfo *pACInfo;
+    v_U8_t tspec_mask_status = 0;
+    v_U8_t tspec_pending_status = 0;
+    v_U8_t ac, numTspecs = 0;
+    tTspecInfo *pDstTspec = pTspecInfo;
+
+    //TODO: Check if TSPEC has already been established, if not return
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];    
+
+    for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) {
+        volatile v_U8_t tspec_index = 0;
+
+        pACInfo = &pSession->ac_info[ac];
+        tspec_pending_status = pACInfo->tspec_pending;
+        tspec_mask_status = pACInfo->tspec_mask_status;
+
+        do {
+            if (tspec_mask_status & SME_QOS_TSPEC_MASK_BIT_1_SET) {
+                /* If a tspec status is pending, take requested_QoSInfo for RIC request, else use curr_QoSInfo
+                   for the RIC request */
+                if (tspec_pending_status & SME_QOS_TSPEC_MASK_BIT_1_SET) {
+                    sme_QosCopyTspecInfo(pMac, &pACInfo->requested_QoSInfo[tspec_index], &pDstTspec->tspec);
+                } else {
+                    sme_QosCopyTspecInfo(pMac, &pACInfo->curr_QoSInfo[tspec_index], &pDstTspec->tspec);
+                }
+                pDstTspec->valid = TRUE;
+                numTspecs++;
+                pDstTspec++;
+            }
+            tspec_mask_status >>= 1;
+            tspec_pending_status >>= 1;
+            tspec_index++;
+        } while (tspec_mask_status);
+    }
+
+    return numTspecs;
+}
+
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+eHalStatus sme_QosCreateTspecRICIE(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pTspec_Info,
+                                                       v_U8_t *pRICBuffer, v_U32_t *pRICLength, v_U8_t *pRICIdentifier)
+{
+    tDot11fIERICDataDesc    ricIE;
+    tANI_U32                nStatus;
+
+    VOS_ASSERT(NULL != pRICBuffer);
+    VOS_ASSERT(NULL != pRICLength);
+    VOS_ASSERT(NULL != pRICIdentifier);
+
+    vos_mem_zero(&ricIE, sizeof(tDot11fIERICDataDesc));
+
+    ricIE.present = 1;
+    ricIE.RICData.present = 1;
+    ricIE.RICData.resourceDescCount = 1;
+    ricIE.RICData.statusCode = 0;
+    ricIE.RICData.Identifier = sme_QosAssignDialogToken();
+#ifndef USE_80211_WMMTSPEC_FOR_RIC
+    ricIE.TSPEC.present = 1;
+    ricIE.TSPEC.delay_bound = pTspec_Info->delay_bound;
+    ricIE.TSPEC.inactivity_int = pTspec_Info->inactivity_interval;
+    ricIE.TSPEC.burst_size = pTspec_Info->max_burst_size;
+    ricIE.TSPEC.max_msdu_size = pTspec_Info->maximum_msdu_size;
+    ricIE.TSPEC.max_service_int = pTspec_Info->max_service_interval;
+    ricIE.TSPEC.mean_data_rate = pTspec_Info->mean_data_rate;
+    ricIE.TSPEC.medium_time = pTspec_Info->medium_time;
+    ricIE.TSPEC.min_data_rate = pTspec_Info->min_data_rate;
+    ricIE.TSPEC.min_phy_rate = pTspec_Info->min_phy_rate;
+    ricIE.TSPEC.min_service_int = pTspec_Info->min_service_interval;
+    ricIE.TSPEC.size = pTspec_Info->nominal_msdu_size;
+    ricIE.TSPEC.peak_data_rate = pTspec_Info->peak_data_rate;
+    ricIE.TSPEC.surplus_bw_allowance = pTspec_Info->surplus_bw_allowance;
+    ricIE.TSPEC.suspension_int = pTspec_Info->suspension_interval;
+    ricIE.TSPEC.service_start_time = pTspec_Info->svc_start_time;
+    ricIE.TSPEC.direction = pTspec_Info->ts_info.direction;
+    //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup
+    if( pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac) )
+    {
+       ricIE.TSPEC.psb = pTspec_Info->ts_info.psb;
+    }
+    else
+    {
+       ricIE.TSPEC.psb = 0;
+    }
+    ricIE.TSPEC.tsid = pTspec_Info->ts_info.tid;
+    ricIE.TSPEC.user_priority = pTspec_Info->ts_info.up;
+    ricIE.TSPEC.access_policy = SME_QOS_ACCESS_POLICY_EDCA;
+
+    *pRICIdentifier = ricIE.RICData.Identifier;
+    
+    nStatus = dot11fPackIeRICDataDesc(pMac, &ricIE, pRICBuffer, sizeof(ricIE), pRICLength);
+    if (DOT11F_FAILED(nStatus))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                FL("Packing of RIC Data of length %d failed with status %d"), 
+                                        *pRICLength, nStatus);
+    }
+#else // WMM TSPEC
+    /*As per WMM_AC_testplan_v0.39 Minimum Service Interval, Maximum Service 
+      Interval, Service Start Time, Suspension Interval and Delay Bound are 
+      all intended for HCCA operation and therefore must be set to zero*/
+    ricIE.WMMTSPEC.present = 1;
+    ricIE.WMMTSPEC.version = 1;
+    ricIE.WMMTSPEC.delay_bound = pTspec_Info->delay_bound;
+    ricIE.WMMTSPEC.inactivity_int = pTspec_Info->inactivity_interval;
+    ricIE.WMMTSPEC.burst_size = pTspec_Info->max_burst_size;
+    ricIE.WMMTSPEC.max_msdu_size = pTspec_Info->maximum_msdu_size;
+    ricIE.WMMTSPEC.max_service_int = pTspec_Info->max_service_interval;
+    ricIE.WMMTSPEC.mean_data_rate = pTspec_Info->mean_data_rate;
+    ricIE.WMMTSPEC.medium_time = pTspec_Info->medium_time;
+    ricIE.WMMTSPEC.min_data_rate = pTspec_Info->min_data_rate;
+    ricIE.WMMTSPEC.min_phy_rate = pTspec_Info->min_phy_rate;
+    ricIE.WMMTSPEC.min_service_int = pTspec_Info->min_service_interval;
+    ricIE.WMMTSPEC.size = pTspec_Info->nominal_msdu_size;
+    ricIE.WMMTSPEC.peak_data_rate = pTspec_Info->peak_data_rate;
+    ricIE.WMMTSPEC.surplus_bw_allowance = pTspec_Info->surplus_bw_allowance;
+    ricIE.WMMTSPEC.suspension_int = pTspec_Info->suspension_interval;
+    ricIE.WMMTSPEC.service_start_time = pTspec_Info->svc_start_time;
+    ricIE.WMMTSPEC.direction = pTspec_Info->ts_info.direction;
+    //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup
+    if( pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac) )
+    {
+       ricIE.WMMTSPEC.psb = pTspec_Info->ts_info.psb;
+    }
+    else
+    {
+       ricIE.WMMTSPEC.psb = 0;
+    }
+    ricIE.WMMTSPEC.tsid = pTspec_Info->ts_info.tid;
+    ricIE.WMMTSPEC.user_priority = pTspec_Info->ts_info.up;
+    ricIE.WMMTSPEC.access_policy = SME_QOS_ACCESS_POLICY_EDCA;
+
+    
+    nStatus = dot11fPackIeRICDataDesc(pMac, &ricIE, pRICBuffer, sizeof(ricIE), pRICLength);
+    if (DOT11F_FAILED(nStatus))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                FL("Packing of RIC Data of length %d failed with status %d"), 
+                                        *pRICLength, nStatus);
+    }
+#endif /* 80211_TSPEC */
+    *pRICIdentifier = ricIE.RICData.Identifier;
+    return nStatus;
+}
+
+eHalStatus sme_QosProcessFTReassocReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+    sme_QosSessionInfo *pSession;
+    sme_QosACInfo *pACInfo;
+    v_U8_t ac, qos_requested = FALSE;
+    v_U8_t tspec_flow_index;
+    sme_QosFlowInfoEntry *flow_info = NULL;
+    tListElem *pEntry= NULL;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+            FL("Invoked on session %d"), sessionId);
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+    for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+    {
+        pACInfo = &pSession->ac_info[ac];
+        qos_requested = FALSE;
+
+        for (tspec_flow_index = 0; tspec_flow_index < SME_QOS_TSPEC_INDEX_MAX; tspec_flow_index++)
+        {
+            /* Only in the below case, copy the AC's curr QoS Info to requested QoS info */
+            if ((pACInfo->ricIdentifier[tspec_flow_index] && !pACInfo->tspec_pending) ||
+                    (pACInfo->tspec_mask_status & (1<<tspec_flow_index)))
+            {
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                        FL("Copying the currentQos to requestedQos for AC=%d, flow=%d\n"),
+                        ac, tspec_flow_index );
+
+                pACInfo->requested_QoSInfo[tspec_flow_index] = pACInfo->curr_QoSInfo[tspec_flow_index];
+                vos_mem_zero(&pACInfo->curr_QoSInfo[tspec_flow_index], sizeof(sme_QosWmmTspecInfo));
+                qos_requested = TRUE;
+            }
+        }
+
+        // Only if the tspec is required, transition the state to 
+        // SME_QOS_REQUESTED for this AC
+        if (qos_requested) 
+        {
+            switch(pACInfo->curr_state)
+            {
+                case SME_QOS_HANDOFF:
+                    sme_QosStateTransition(sessionId, ac, SME_QOS_REQUESTED);
+                    break;
+                default:
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                            FL("FT Reassoc req event in unexpected state %d"), pACInfo->curr_state);
+                    VOS_ASSERT(0);
+            }
+        }
+
+    }
+
+    /* At this point of time, we are disconnected from the old AP, so it is safe
+     *             to reset all these session variables */
+    pSession->apsdMask = 0;
+    pSession->uapsdAlreadyRequested = 0;
+    pSession->readyForPowerSave = 0;
+
+    /* Now change reason and HO renewal of all the flow in this session only */
+    pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+    if(!pEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
+                "%s: %d: Flow List empty, nothing to update",
+                __FUNCTION__, __LINE__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    do
+    {
+        flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+        if(sessionId == flow_info->sessionId)
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "%s: %d: Changing FlowID %d reason to SETUP and HO renewal to FALSE",
+                    __FUNCTION__, __LINE__,
+                    flow_info->QosFlowID);
+            flow_info->reason = SME_QOS_REASON_SETUP;
+            flow_info->hoRenewal = eANI_BOOLEAN_TRUE;
+        }
+        pEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+    } while( pEntry );
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus sme_QosFTAggrQosReq( tpAniSirGlobal pMac, v_U8_t sessionId )
+{
+    tSirAggrQosReq *pMsg = NULL;
+    sme_QosSessionInfo *pSession;
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    int i, j = 0;
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: %d: invoked on session %d", __FUNCTION__, __LINE__,
+            sessionId);
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+    pMsg = (tSirAggrQosReq *)vos_mem_malloc(sizeof(tSirAggrQosReq));
+
+    if (!pMsg)
+    {
+        //err msg
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                "%s: %d: couldn't allocate memory for the msg buffer",
+                __FUNCTION__, __LINE__);
+
+        return eHAL_STATUS_FAILURE;
+      }
+
+    vos_mem_zero(pMsg, sizeof(tSirAggrQosReq));
+
+    pMsg->messageType = pal_cpu_to_be16((v_U16_t)eWNI_SME_FT_AGGR_QOS_REQ);
+    pMsg->length = sizeof(tSirAggrQosReq);
+    pMsg->sessionId = sessionId;
+    pMsg->timeout = 0;
+    pMsg->rspReqd = VOS_TRUE;
+    vos_mem_copy( &pMsg->bssId[ 0 ],
+            &pSession->assocInfo.pBssDesc->bssId[ 0 ],
+            sizeof(tCsrBssid) );
+
+    for( i = 0; i < SME_QOS_EDCA_AC_MAX; i++ )
+    {
+        for( j = 0; j < SME_QOS_TSPEC_INDEX_MAX; j++ )
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                    FL("ac=%d, tspec_mask_staus=%x, tspec_index=%d\n"), 
+                    i, pSession->ac_info[i].tspec_mask_status, j);
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                    FL("direction = %d\n"), pSession->ac_info[i].addTsRsp[j].rsp.tspec.tsinfo.traffic.direction);
+            // Check if any flow is active on this AC
+            if ((pSession->ac_info[i].tspec_mask_status) & (1 << j))
+            {
+                tANI_U8 direction = pSession->ac_info[i].addTsRsp[j].rsp.tspec.tsinfo.traffic.direction;
+                if ((direction == SME_QOS_WMM_TS_DIR_UPLINK) ||
+                        (direction == SME_QOS_WMM_TS_DIR_BOTH))
+                {
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                            FL("Found tspec entry AC=%d, flow=%d, direction = %d\n"), i, j, direction);
+                    pMsg->aggrInfo.aggrAddTsInfo[i].dialogToken =
+                        sme_QosAssignDialogToken();
+                    pMsg->aggrInfo.aggrAddTsInfo[i].lleTspecPresent =
+                        pSession->ac_info[i].addTsRsp[j].rsp.lleTspecPresent;
+                    pMsg->aggrInfo.aggrAddTsInfo[i].numTclas =
+                        pSession->ac_info[i].addTsRsp[j].rsp.numTclas;
+                    vos_mem_copy( pMsg->aggrInfo.aggrAddTsInfo[i].tclasInfo,
+                            pSession->ac_info[i].addTsRsp[j].rsp.tclasInfo,
+                            SIR_MAC_TCLASIE_MAXNUM );
+                    pMsg->aggrInfo.aggrAddTsInfo[i].tclasProc =
+                        pSession->ac_info[i].addTsRsp[j].rsp.tclasProc;
+                    pMsg->aggrInfo.aggrAddTsInfo[i].tclasProcPresent =
+                        pSession->ac_info[i].addTsRsp[j].rsp.tclasProcPresent;
+                    pMsg->aggrInfo.aggrAddTsInfo[i].tspec =
+                        pSession->ac_info[i].addTsRsp[j].rsp.tspec;
+                    pMsg->aggrInfo.aggrAddTsInfo[i].wmeTspecPresent =
+                        pSession->ac_info[i].addTsRsp[j].rsp.wmeTspecPresent;
+                    pMsg->aggrInfo.aggrAddTsInfo[i].wsmTspecPresent =
+                        pSession->ac_info[i].addTsRsp[j].rsp.wsmTspecPresent;
+                    pMsg->aggrInfo.tspecIdx |= ( 1 << i );
+
+                    // Mark the index for this AC as pending for response, which would be 
+                    // used to validate the AddTS response from HAL->PE->SME
+                    pSession->ac_info[i].tspec_pending = (1<<j);
+                }
+            }
+        }
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+            "Sending aggregated message to HAL 0x%x\n", pMsg->aggrInfo.tspecIdx);
+
+    if(HAL_STATUS_SUCCESS(palSendMBMessage(pMac->hHdd, pMsg)))
+    {
+        status = eHAL_STATUS_SUCCESS;
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                "%s: %d: sent down a AGGR QoS req to PE",
+                __FUNCTION__, __LINE__);
+    }
+
+    return status;
+}
+
+eHalStatus sme_QosProcessFTRICResponse(tpAniSirGlobal pMac, v_U8_t sessionId, tDot11fIERICDataDesc *pRicDataDesc, v_U8_t ac, v_U8_t tspecIndex)
+{
+    tANI_U8        i = 0;
+    tpSirAddtsRsp   pAddtsRsp
+        = &sme_QosCb.sessionInfo[sessionId].ac_info[ac].addTsRsp[tspecIndex];
+
+    vos_mem_zero(pAddtsRsp, sizeof(tSirAddtsRsp));
+
+    pAddtsRsp->messageType = eWNI_SME_ADDTS_RSP;
+    pAddtsRsp->length = sizeof(tSirAddtsRsp);
+    pAddtsRsp->rc = pRicDataDesc->RICData.statusCode;
+    pAddtsRsp->sessionId = sessionId;
+    pAddtsRsp->rsp.dialogToken = pRicDataDesc->RICData.Identifier;
+    pAddtsRsp->rsp.status = pRicDataDesc->RICData.statusCode;
+    pAddtsRsp->rsp.wmeTspecPresent = pRicDataDesc->TSPEC.present;
+    if (pAddtsRsp->rsp.wmeTspecPresent)
+    {
+        //Copy TSPEC params received in RIC response to addts response
+        ConvertTSPEC(pMac, &pAddtsRsp->rsp.tspec, &pRicDataDesc->TSPEC);
+    }
+
+    pAddtsRsp->rsp.numTclas = pRicDataDesc->num_TCLAS;
+    if (pAddtsRsp->rsp.numTclas)
+    {
+        for (i = 0; i < pAddtsRsp->rsp.numTclas; i++)
+        {
+            //Copy TCLAS info per index to the addts response
+            ConvertTCLAS(pMac, &pAddtsRsp->rsp.tclasInfo[i], &pRicDataDesc->TCLAS[i]);
+        }
+    }
+
+    pAddtsRsp->rsp.tclasProcPresent = pRicDataDesc->TCLASSPROC.present;
+    if (pAddtsRsp->rsp.tclasProcPresent)
+        pAddtsRsp->rsp.tclasProc = pRicDataDesc->TCLASSPROC.processing;
+
+
+    pAddtsRsp->rsp.schedulePresent = pRicDataDesc->Schedule.present;
+    if (pAddtsRsp->rsp.schedulePresent)
+   {
+        //Copy Schedule IE params to addts response
+        ConvertSchedule(pMac, &pAddtsRsp->rsp.schedule, &pRicDataDesc->Schedule);
+    }
+
+    //Need to check the below portion is a part of WMM TSPEC
+    //Process Delay element
+    if (pRicDataDesc->TSDelay.present)
+        ConvertTSDelay(pMac, &pAddtsRsp->rsp.delay, &pRicDataDesc->TSDelay);
+    //return sme_QosProcessAddTsRsp(pMac, &addtsRsp);
+    return eHAL_STATUS_SUCCESS;
+   }
+eHalStatus sme_QosProcessAggrQosRsp(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+    tpSirAggrQosRsp pAggrRsp = (tpSirAggrQosRsp)pMsgBuf;
+    tSirAddtsRsp   addtsRsp;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    int i, j = 0;
+    tANI_U8 sessionId = pAggrRsp->sessionId;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+            FL("Received AGGR_QOS resp from LIM"));
+
+    /* Copy over the updated response information for TSPEC of all the ACs */
+    for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
+    {
+        tANI_U8 tspec_mask_status = sme_QosCb.sessionInfo[sessionId].ac_info[i].tspec_mask_status;
+        for( j = 0; j < SME_QOS_TSPEC_INDEX_MAX; j++ ) 
+        {
+            tANI_U8 direction = sme_QosCb.sessionInfo[sessionId].ac_info[i].
+                addTsRsp[j].rsp.tspec.tsinfo.traffic.direction;
+
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                    FL("Addts rsp from LIM AC=%d, flow=%d dir=%d, tspecIdx=%x\n"),
+                    i, j, direction, pAggrRsp->aggrInfo.tspecIdx);
+            // Check if the direction is Uplink or bi-directional
+            if( ((1<<i) & pAggrRsp->aggrInfo.tspecIdx) &&
+                    ((tspec_mask_status) & (1<<j)) &&
+                    ((direction == SME_QOS_WMM_TS_DIR_UPLINK) ||
+                     (direction == SME_QOS_WMM_TS_DIR_BOTH)))
+            {
+                addtsRsp = sme_QosCb.sessionInfo[sessionId].ac_info[i].addTsRsp[j];
+                addtsRsp.rc = pAggrRsp->aggrInfo.aggrRsp[i].status;
+                addtsRsp.rsp.status = pAggrRsp->aggrInfo.aggrRsp[i].status;
+                addtsRsp.rsp.tspec = pAggrRsp->aggrInfo.aggrRsp[i].tspec;
+
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                        FL("%s: Processing Addts rsp from LIM AC=%d, flow=%d\n"), i, j);
+                /* post ADD TS response for each */
+                if (sme_QosProcessAddTsRsp(pMac, &addtsRsp) != eHAL_STATUS_SUCCESS)
+                {
+                    status = eHAL_STATUS_FAILURE;
+                }
+            }
+        }
+    }
+   return status;
+}
+
+
+eHalStatus sme_QosProcessFTReassocRspEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+    sme_QosSessionInfo *pSession;
+    sme_QosACInfo *pACInfo;
+    v_U8_t ac;
+    v_U8_t tspec_flow_index;
+    tDot11fIERICDataDesc *pRicDataDesc = NULL;
+    eHalStatus            status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pCsrSession = CSR_GET_SESSION( pMac, sessionId );
+    tCsrRoamConnectedInfo *pCsrConnectedInfo = &pCsrSession->connectedInfo;
+    tANI_U32    ricRspLen = pCsrConnectedInfo->nRICRspLength;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: %d: invoked on session %d",
+            __FUNCTION__, __LINE__,
+            sessionId);
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+    pRicDataDesc = (tDot11fIERICDataDesc *)pCsrConnectedInfo->pbFrames + pCsrConnectedInfo->nBeaconLength +
+        pCsrConnectedInfo->nAssocReqLength + pCsrConnectedInfo->nAssocRspLength;
+
+    for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+    {
+        pACInfo = &pSession->ac_info[ac];
+
+        for (tspec_flow_index = 0; tspec_flow_index < SME_QOS_TSPEC_INDEX_MAX; tspec_flow_index++)
+        {
+            /* Only in the below case, copy the AC's curr QoS Info to requested QoS info */
+            if (pACInfo->ricIdentifier[tspec_flow_index])
+            {
+
+                if (!ricRspLen)
+                {
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                            FL("RIC Response not received for AC %d on TSPEC Index %d, RIC Req Identifier = %d"),
+                            ac, tspec_flow_index, pACInfo->ricIdentifier[tspec_flow_index]);
+                    VOS_ASSERT(0);
+                }
+                else
+                {
+                    /* Now we got response for this identifier. Process it. */
+                    if (pRicDataDesc->present)
+                    {
+                        if (pRicDataDesc->RICData.present)
+                        {
+                            if (pRicDataDesc->RICData.Identifier != pACInfo->ricIdentifier[tspec_flow_index])
+                            {
+                                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                        FL("RIC response order not same as request sent. Request ID = %d, Response ID = %d"),
+                                        pACInfo->ricIdentifier[tspec_flow_index], pRicDataDesc->RICData.Identifier);
+                                VOS_ASSERT(0);
+                            }
+                            else
+                            {
+                                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                        FL("Processing RIC Response for AC %d, TSPEC Flow index %d with RIC ID %d \n"),
+                                        ac, tspec_flow_index, pRicDataDesc->RICData.Identifier);
+                                status = sme_QosProcessFTRICResponse(pMac, sessionId, pRicDataDesc, ac, tspec_flow_index);
+                                if (eHAL_STATUS_SUCCESS != status)
+                                {
+                                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                            FL("Failed with status %d for AC %d in TSPEC Flow index = %d\n"),
+                                            status, ac, tspec_flow_index);
+                                }
+                            }
+                            pRicDataDesc++;
+                            ricRspLen -= sizeof(tDot11fIERICDataDesc);
+                        }
+                    }
+                }
+            }
+
+        }
+    }
+
+    if (ricRspLen)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                FL("RIC Response still follows despite traversing through all ACs. Remaining len = %d\n"), ricRspLen);
+        VOS_ASSERT(0);
+    }
+
+    /* Send the Aggregated QoS request to HAL */
+    status = sme_QosFTAggrQosReq(pMac,sessionId);
+
+    return status;
+}
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosAddTsReq() - To send down the ADDTS request with TSPEC params
+  to PE 
+  
+ 
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param sessionId - Session upon which the TSPEC should be added
+  \param pTspec_Info - Pointer to sme_QosWmmTspecInfo which contains the WMM 
+                       TSPEC related info as defined above
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosAddTsReq(tpAniSirGlobal pMac,
+                           v_U8_t sessionId,
+                           sme_QosWmmTspecInfo * pTspec_Info,
+                           sme_QosEdcaAcType ac)
+{
+   tSirAddtsReq *pMsg = NULL;
+   sme_QosSessionInfo *pSession;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+#ifdef FEATURE_WLAN_CCX
+   tCsrRoamSession *pCsrSession = CSR_GET_SESSION( pMac, sessionId );
+#endif
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   WLAN_VOS_DIAG_EVENT_DEF(qos, vos_event_wlan_qos_payload_type);
+#endif
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for AC %d",
+             __FUNCTION__, __LINE__,
+             sessionId, ac);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pMsg = (tSirAddtsReq *)vos_mem_malloc(sizeof(tSirAddtsReq));
+   if (!pMsg)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: couldn't allocate memory for the msg buffer",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_zero(pMsg, sizeof(tSirAddtsReq));
+   pMsg->messageType = pal_cpu_to_be16((v_U16_t)eWNI_SME_ADDTS_REQ);
+   pMsg->length = sizeof(tSirAddtsReq);
+   pMsg->sessionId = sessionId;
+   pMsg->timeout = 0;
+   pMsg->rspReqd = VOS_TRUE;
+   pMsg->req.dialogToken = sme_QosAssignDialogToken();
+   /*As per WMM_AC_testplan_v0.39 Minimum Service Interval, Maximum Service 
+     Interval, Service Start Time, Suspension Interval and Delay Bound are 
+     all intended for HCCA operation and therefore must be set to zero*/
+   pMsg->req.tspec.delayBound = 0;
+   pMsg->req.tspec.inactInterval = pTspec_Info->inactivity_interval;
+   pMsg->req.tspec.length = SME_QOS_TSPEC_IE_LENGTH;
+   pMsg->req.tspec.maxBurstSz = pTspec_Info->max_burst_size;
+   pMsg->req.tspec.maxMsduSz = pTspec_Info->maximum_msdu_size;
+   pMsg->req.tspec.maxSvcInterval = pTspec_Info->max_service_interval;
+   pMsg->req.tspec.meanDataRate = pTspec_Info->mean_data_rate;
+   pMsg->req.tspec.mediumTime = pTspec_Info->medium_time;
+   pMsg->req.tspec.minDataRate = pTspec_Info->min_data_rate;
+   pMsg->req.tspec.minPhyRate = pTspec_Info->min_phy_rate;
+   pMsg->req.tspec.minSvcInterval = pTspec_Info->min_service_interval;
+   pMsg->req.tspec.nomMsduSz = pTspec_Info->nominal_msdu_size;
+   pMsg->req.tspec.peakDataRate = pTspec_Info->peak_data_rate;
+   pMsg->req.tspec.surplusBw = pTspec_Info->surplus_bw_allowance;
+   pMsg->req.tspec.suspendInterval = pTspec_Info->suspension_interval;
+   pMsg->req.tspec.svcStartTime = 0;
+   pMsg->req.tspec.tsinfo.traffic.direction = pTspec_Info->ts_info.direction;
+   //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup
+   if( pTspec_Info->ts_info.psb 
+         && btcIsReadyForUapsd(pMac) 
+     )
+   {
+      pMsg->req.tspec.tsinfo.traffic.psb = pTspec_Info->ts_info.psb;
+   }
+   else
+   {
+      pMsg->req.tspec.tsinfo.traffic.psb = 0;
+      pTspec_Info->ts_info.psb = 0;
+   }
+   pMsg->req.tspec.tsinfo.traffic.tsid = pTspec_Info->ts_info.tid;
+   pMsg->req.tspec.tsinfo.traffic.userPrio = pTspec_Info->ts_info.up;
+   pMsg->req.tspec.tsinfo.traffic.accessPolicy = SME_QOS_ACCESS_POLICY_EDCA;
+   pMsg->req.tspec.tsinfo.traffic.burstSizeDefn = pTspec_Info->ts_info.burst_size_defn;
+   pMsg->req.tspec.tsinfo.traffic.ackPolicy = pTspec_Info->ts_info.ack_policy;
+   pMsg->req.tspec.type = SME_QOS_TSPEC_IE_TYPE;
+   /*Fill the BSSID pMsg->req.bssId*/
+   if (NULL == pSession->assocInfo.pBssDesc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: BSS descriptor is NULL so we don't send requst to PE",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_copy( &pMsg->bssId[ 0 ], 
+                 &pSession->assocInfo.pBssDesc->bssId[ 0 ], 
+                 sizeof(tCsrBssid) );
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: up = %d, tid = %d",
+             __FUNCTION__, __LINE__, 
+             pTspec_Info->ts_info.up,
+             pTspec_Info->ts_info.tid);
+#ifdef FEATURE_WLAN_CCX
+   if(pCsrSession->connectedProfile.isCCXAssoc)
+   {
+      pMsg->req.tsrsIE.tsid = pTspec_Info->ts_info.up;
+      pMsg->req.tsrsPresent = 1;
+   }
+#endif
+   if(HAL_STATUS_SUCCESS(palSendMBMessage(pMac->hHdd, pMsg)))
+   {
+      status = eHAL_STATUS_SUCCESS;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: sent down a ADDTS req to PE",
+                __FUNCTION__, __LINE__);
+      //event: EVENT_WLAN_QOS
+#ifdef FEATURE_WLAN_DIAG_SUPPORT          
+      qos.eventId = SME_QOS_DIAG_ADDTS_REQ;
+      qos.reasonCode = SME_QOS_DIAG_USER_REQUESTED;
+      WLAN_VOS_DIAG_EVENT_REPORT(&qos, EVENT_WLAN_QOS);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosDelTsReq() - To send down the DELTS request with TSPEC params
+  to PE 
+  
+ 
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param sessionId - Session from which the TSPEC should be deleted
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \param tspec_mask - on which tspec per AC, the delts is requested
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosDelTsReq(tpAniSirGlobal pMac,
+                           v_U8_t sessionId,
+                           sme_QosEdcaAcType ac,
+                           v_U8_t tspec_mask)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   tSirDeltsReq *pMsg;
+   sme_QosWmmTspecInfo *pTspecInfo;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   WLAN_VOS_DIAG_EVENT_DEF(qos, vos_event_wlan_qos_payload_type);
+#endif
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for AC %d",
+             __FUNCTION__, __LINE__,
+             sessionId, ac);
+   pMsg = (tSirDeltsReq *)vos_mem_malloc(sizeof(tSirDeltsReq));
+   if (!pMsg)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: couldn't allocate memory for the msg buffer",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_zero(pMsg, sizeof(tSirDeltsReq));
+   // get pointer to the TSPEC being deleted
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   pTspecInfo = &pACInfo->curr_QoSInfo[tspec_mask - 1];
+   pMsg->messageType = pal_cpu_to_be16((v_U16_t)eWNI_SME_DELTS_REQ);
+   pMsg->length = sizeof(tSirDeltsReq);
+   pMsg->sessionId = sessionId;
+   pMsg->rspReqd = VOS_TRUE;
+   pMsg->req.tspec.delayBound = pTspecInfo->delay_bound;
+   pMsg->req.tspec.inactInterval = pTspecInfo->inactivity_interval;
+   pMsg->req.tspec.length = SME_QOS_TSPEC_IE_LENGTH;
+   pMsg->req.tspec.maxBurstSz = pTspecInfo->max_burst_size;
+   pMsg->req.tspec.maxMsduSz = pTspecInfo->maximum_msdu_size;
+   pMsg->req.tspec.maxSvcInterval = pTspecInfo->max_service_interval;
+   pMsg->req.tspec.meanDataRate = pTspecInfo->mean_data_rate;
+   pMsg->req.tspec.mediumTime = pTspecInfo->medium_time;
+   pMsg->req.tspec.minDataRate = pTspecInfo->min_data_rate;
+   pMsg->req.tspec.minPhyRate = pTspecInfo->min_phy_rate;
+   pMsg->req.tspec.minSvcInterval = pTspecInfo->min_service_interval;
+   pMsg->req.tspec.nomMsduSz = pTspecInfo->nominal_msdu_size;
+   pMsg->req.tspec.peakDataRate = pTspecInfo->peak_data_rate;
+   pMsg->req.tspec.surplusBw = pTspecInfo->surplus_bw_allowance;
+   pMsg->req.tspec.suspendInterval = pTspecInfo->suspension_interval;
+   pMsg->req.tspec.svcStartTime = pTspecInfo->svc_start_time;
+   pMsg->req.tspec.tsinfo.traffic.direction = pTspecInfo->ts_info.direction;
+   pMsg->req.tspec.tsinfo.traffic.psb = pTspecInfo->ts_info.psb;
+   pMsg->req.tspec.tsinfo.traffic.tsid = pTspecInfo->ts_info.tid;
+   pMsg->req.tspec.tsinfo.traffic.userPrio = pTspecInfo->ts_info.up;
+   pMsg->req.tspec.tsinfo.traffic.accessPolicy = SME_QOS_ACCESS_POLICY_EDCA;
+   pMsg->req.tspec.tsinfo.traffic.burstSizeDefn = pTspecInfo->ts_info.burst_size_defn;
+   pMsg->req.tspec.tsinfo.traffic.ackPolicy = pTspecInfo->ts_info.ack_policy;
+   pMsg->req.tspec.type = SME_QOS_TSPEC_IE_TYPE;
+   /*Fill the BSSID pMsg->req.bssId*/
+   if (NULL == pSession->assocInfo.pBssDesc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: BSS descriptor is NULL so we don't send request to PE",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_copy( &pMsg->bssId[ 0 ], 
+                 &pSession->assocInfo.pBssDesc->bssId[ 0 ], 
+                 sizeof(tCsrBssid) );
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: up = %d, tid = %d",
+             __FUNCTION__, __LINE__, 
+             pTspecInfo->ts_info.up,
+             pTspecInfo->ts_info.tid);
+   vos_mem_zero(&pACInfo->curr_QoSInfo[tspec_mask - 1], 
+                sizeof(sme_QosWmmTspecInfo));
+   if(HAL_STATUS_SUCCESS(palSendMBMessage(pMac->hHdd, pMsg)))
+   {
+      status = eHAL_STATUS_SUCCESS;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: sme_QosDelTsReq:Test: sent down a DELTS req to PE",
+                __FUNCTION__, __LINE__);
+      //event: EVENT_WLAN_QOS
+#ifdef FEATURE_WLAN_DIAG_SUPPORT          
+      qos.eventId = SME_QOS_DIAG_DELTS;
+      qos.reasonCode = SME_QOS_DIAG_USER_REQUESTED;
+      WLAN_VOS_DIAG_EVENT_REPORT(&qos, EVENT_WLAN_QOS);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+   }
+
+   return status;
+}
+
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessAddTsRsp() - Function to process the
+  eWNI_SME_ADDTS_RSP came from PE 
+  
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param pMsgBuf - Pointer to the msg buffer came from PE.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessAddTsRsp(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+   tpSirAddtsRsp paddts_rsp = (tpSirAddtsRsp)pMsgBuf;
+   sme_QosSessionInfo *pSession;
+   v_U8_t sessionId = paddts_rsp->sessionId;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    sme_QosWmmUpType up = (sme_QosWmmUpType)paddts_rsp->rsp.tspec.tsinfo.traffic.userPrio;
+    sme_QosACInfo *pACInfo;
+    sme_QosEdcaAcType ac;
+#endif
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+            "%s: %d: invoked on session %d for UP %d",
+            __FUNCTION__, __LINE__,
+            sessionId, up);
+
+    ac = sme_QosUpToAc(up);
+    if(SME_QOS_EDCA_AC_MAX == ac)
+    {
+        //err msg
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: invalid AC %d from UP %d",
+                __FUNCTION__, __LINE__, ac, up);
+
+        return eHAL_STATUS_FAILURE;
+    }
+    pACInfo = &pSession->ac_info[ac];   
+    if (SME_QOS_HANDOFF == pACInfo->curr_state)
+    {
+        smsLog(pMac, LOG1, FL("ADDTS Response received for AC %d in HANDOFF State.. Dropping"), ac);
+        pSession->readyForPowerSave = VOS_TRUE;
+        return eHAL_STATUS_SUCCESS;
+    }
+#endif
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   WLAN_VOS_DIAG_EVENT_DEF(qos, vos_event_wlan_qos_payload_type);
+#endif
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked on session %d with return code %d",
+             __FUNCTION__, __LINE__,
+             sessionId, paddts_rsp->rc);
+   // our outstanding request has been serviced
+   // we can go into powersave
+   pSession->readyForPowerSave = VOS_TRUE;
+   if(paddts_rsp->rc)
+   {
+      //event: EVENT_WLAN_QOS
+#ifdef FEATURE_WLAN_DIAG_SUPPORT          
+      qos.eventId = SME_QOS_DIAG_ADDTS_RSP;
+      qos.reasonCode = SME_QOS_DIAG_ADDTS_REFUSED;
+      WLAN_VOS_DIAG_EVENT_REPORT(&qos, EVENT_WLAN_QOS);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+      status = sme_QosProcessAddTsFailureRsp(pMac, sessionId, &paddts_rsp->rsp);
+   }
+   else
+   {
+      status = sme_QosProcessAddTsSuccessRsp(pMac, sessionId, &paddts_rsp->rsp);
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessDelTsRsp() - Function to process the
+  eWNI_SME_DELTS_RSP came from PE 
+  
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param pMsgBuf - Pointer to the msg buffer came from PE.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessDelTsRsp(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+   tpSirDeltsRsp pDeltsRsp = (tpSirDeltsRsp)pMsgBuf;
+   sme_QosSessionInfo *pSession;
+   v_U8_t sessionId = pDeltsRsp->sessionId;
+   // msg
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked on session %d with return code %d",
+             __FUNCTION__, __LINE__,
+             sessionId, pDeltsRsp->rc);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   // our outstanding request has been serviced
+   // we can go into powersave
+   pSession->readyForPowerSave = VOS_TRUE;
+   (void)sme_QosProcessBufferedCmd(sessionId);
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessDelTsInd() - Function to process the
+  eWNI_SME_DELTS_IND came from PE 
+  
+  Since it's a DELTS indication from AP, will notify all the flows running on 
+  this AC about QoS release
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param pMsgBuf - Pointer to the msg buffer came from PE.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessDelTsInd(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+   tpSirDeltsRsp pdeltsind = (tpSirDeltsRsp)pMsgBuf;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   v_U8_t sessionId = pdeltsind->sessionId;
+   sme_QosEdcaAcType ac;
+   sme_QosSearchInfo search_key;
+   sme_QosWmmUpType up = (sme_QosWmmUpType)pdeltsind->rsp.tspec.tsinfo.traffic.userPrio;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   WLAN_VOS_DIAG_EVENT_DEF(qos, vos_event_wlan_qos_payload_type);
+#endif
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked on session %d for UP %d",
+             __FUNCTION__, __LINE__,
+             sessionId, up);
+   ac = sme_QosUpToAc(up);
+   if(SME_QOS_EDCA_AC_MAX == ac)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: invalid AC %d from UP %d",
+                __FUNCTION__, __LINE__,
+                ac, up);
+      return eHAL_STATUS_FAILURE;
+   }
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+
+   vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+   //set the key type & the key to be searched in the Flow List
+   search_key.key.ac_type = ac;
+   search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+   search_key.sessionId = sessionId;
+   //find all Flows on the perticular AC & delete them, also send HDD indication
+   // through the callback it registered per request
+   if(!HAL_STATUS_SUCCESS(sme_QosFindAllInFlowList(pMac, search_key, sme_QosDelTsIndFnp)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: no match found for ac = %d",
+                __FUNCTION__, __LINE__, 
+                search_key.key.ac_type);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   //clean up the CB
+   vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                sizeof(sme_QosWmmTspecInfo));
+   vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                sizeof(sme_QosWmmTspecInfo));
+   vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                sizeof(sme_QosWmmTspecInfo));
+   vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                sizeof(sme_QosWmmTspecInfo));
+   pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_CLEAR;
+   pACInfo->tspec_pending = 0;
+   //event: EVENT_WLAN_QOS
+#ifdef FEATURE_WLAN_DIAG_SUPPORT          
+   qos.eventId = SME_QOS_DIAG_DELTS;
+   qos.reasonCode = SME_QOS_DIAG_DELTS_IND_FROM_AP;
+   WLAN_VOS_DIAG_EVENT_REPORT(&qos, EVENT_WLAN_QOS);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+
+   sme_QosStateTransition(sessionId, ac, SME_QOS_LINK_UP);
+   (void)sme_QosProcessBufferedCmd(sessionId);
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessAssocCompleteEv() - Function to process the
+  SME_QOS_CSR_ASSOC_COMPLETE event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessAssocCompleteEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   sme_QosEdcaAcType ac = SME_QOS_EDCA_AC_BE;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   if(((SME_QOS_INIT == pSession->ac_info[SME_QOS_EDCA_AC_BE].curr_state)&&
+       (SME_QOS_INIT == pSession->ac_info[SME_QOS_EDCA_AC_BK].curr_state)&&
+       (SME_QOS_INIT == pSession->ac_info[SME_QOS_EDCA_AC_VI].curr_state)&&
+       (SME_QOS_INIT == pSession->ac_info[SME_QOS_EDCA_AC_VO].curr_state)) ||
+       (pSession->handoffRequested))
+   {
+      //get the association info
+      if(!pEvent_info)
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: pEvent_info is NULL",
+                   __FUNCTION__, __LINE__);
+         return status;
+      }
+      if(!((sme_QosAssocInfo *)pEvent_info)->pBssDesc)
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: pBssDesc is NULL",
+                   __FUNCTION__, __LINE__);
+         return status;
+      }
+      if((pSession->assocInfo.pBssDesc) &&
+         (csrIsBssidMatch(pMac, (tCsrBssid *)&pSession->assocInfo.pBssDesc->bssId, 
+                          (tCsrBssid *) &(((sme_QosAssocInfo *)pEvent_info)->pBssDesc->bssId))))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: assoc with the same BSS, no update needed",
+                   __FUNCTION__, __LINE__);
+      }
+      else
+      {
+         status = sme_QosSaveAssocInfo(pSession, pEvent_info);
+      }
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: wrong state: BE %d, BK %d, VI %d, VO %d",
+                __FUNCTION__, __LINE__,
+                pSession->ac_info[SME_QOS_EDCA_AC_BE].curr_state,
+                pSession->ac_info[SME_QOS_EDCA_AC_BK].curr_state,
+                pSession->ac_info[SME_QOS_EDCA_AC_VI].curr_state,
+                pSession->ac_info[SME_QOS_EDCA_AC_VO].curr_state);
+      //ASSERT
+      VOS_ASSERT(0);
+      return status;
+   }
+   // the session is active
+   pSession->sessionActive = VOS_TRUE;
+   if(pSession->handoffRequested)
+   {
+      pSession->handoffRequested = VOS_FALSE;
+      //renew all flows
+      (void)sme_QosProcessBufferedCmd(sessionId);
+      status = eHAL_STATUS_SUCCESS;
+   }
+   else
+   {
+      for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+      {
+         pACInfo = &pSession->ac_info[ac];
+         switch(pACInfo->curr_state)
+         {
+            case SME_QOS_INIT:
+               sme_QosStateTransition(sessionId, ac, SME_QOS_LINK_UP);
+               break;
+            case SME_QOS_LINK_UP:
+            case SME_QOS_REQUESTED:
+            case SME_QOS_QOS_ON:
+            case SME_QOS_HANDOFF:
+            case SME_QOS_CLOSED:
+            default:
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: On session %d AC %d is in wrong state %d",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac, pACInfo->curr_state);
+               //ASSERT
+               VOS_ASSERT(0);
+               break;
+         }
+      }
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessReassocReqEv() - Function to process the
+  SME_QOS_CSR_REASSOC_REQ event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessReassocReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   if(pSession->ftHandoffInProgress)
+   {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: %d: no need for state transition, should "
+               "already be in handoff state",
+               __FUNCTION__, __LINE__);
+       VOS_ASSERT(pSession->ac_info[0].curr_state == SME_QOS_HANDOFF);
+       VOS_ASSERT(pSession->ac_info[1].curr_state == SME_QOS_HANDOFF);
+       VOS_ASSERT(pSession->ac_info[2].curr_state == SME_QOS_HANDOFF);
+       VOS_ASSERT(pSession->ac_info[3].curr_state == SME_QOS_HANDOFF);
+       sme_QosProcessFTReassocReqEv(pMac, sessionId, pEvent_info);
+       return eHAL_STATUS_SUCCESS;
+   }
+#endif
+
+   if(pSession->handoffRequested)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: no need for state transition, should "
+                "already be in handoff state",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT(pSession->ac_info[0].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[1].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[2].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[3].curr_state == SME_QOS_HANDOFF);
+
+      //buffer the existing flows to be renewed after handoff is done
+      sme_QosBufferExistingFlows(pMac, sessionId);
+      //clean up the control block partially for handoff
+      sme_QosCleanupCtrlBlkForHandoff(pMac, sessionId);
+      return eHAL_STATUS_SUCCESS;
+   }
+//TBH: Assuming both handoff algo & 11r willn't be enabled at the same time
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   if(pSession->ftHandoffInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: no need for state transition, should "
+                "already be in handoff state",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT(pSession->ac_info[0].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[1].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[2].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[3].curr_state == SME_QOS_HANDOFF);
+
+      sme_QosProcessFTReassocReqEv(pMac, sessionId, pEvent_info);
+      return eHAL_STATUS_SUCCESS;
+   }
+#endif
+
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_LINK_UP:
+         case SME_QOS_REQUESTED:
+         case SME_QOS_QOS_ON:
+            sme_QosStateTransition(sessionId, ac, SME_QOS_HANDOFF);
+            break;
+         case SME_QOS_HANDOFF:
+            //This is normal because sme_QosRequestReassoc may already change the state
+            break;
+         case SME_QOS_CLOSED:
+         case SME_QOS_INIT:
+         default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessReassocSuccessEv() - Function to process the
+  SME_QOS_CSR_REASSOC_COMPLETE event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessReassocSuccessEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   tpSirSmeJoinRsp pSmeJoinRsp = (tpSirSmeJoinRsp) pEvent_info;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac, ac_index;
+   sme_QosSearchInfo search_key;
+   sme_QosSearchInfo search_key1;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tListElem *pEntry= NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   // our pending reassociation has completed
+   // we can allow powersave
+   pSession->readyForPowerSave = VOS_TRUE;
+   //get the association info
+   if(!pEvent_info)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: pEvent_info is NULL",
+                __FUNCTION__, __LINE__);
+      return status;
+   }
+   if(!((sme_QosAssocInfo *)pEvent_info)->pBssDesc)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: pBssDesc is NULL",
+                __FUNCTION__, __LINE__);
+      return status;
+   }
+   status = sme_QosSaveAssocInfo(pSession, pEvent_info);
+   if(status)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: sme_QosSaveAssocInfo() failed",
+                __FUNCTION__, __LINE__);
+   }
+//TBH: Assuming both handoff algo & 11r willn't be enabled at the same time   
+   if(pSession->handoffRequested)
+   {
+      pSession->handoffRequested = VOS_FALSE;
+      //renew all flows
+      (void)sme_QosProcessBufferedCmd(sessionId);
+      return eHAL_STATUS_SUCCESS;
+   }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   if (pSession->ftHandoffInProgress)
+   {
+       if (csrRoamIs11rAssoc(pMac)) {
+           if (pSmeJoinRsp->parsedRicRspLen) {
+               status = sme_QosProcessFTReassocRspEv(pMac, sessionId, pEvent_info);
+           }
+       }
+#ifdef FEATURE_WLAN_CCX
+       // If CCX association check for TSPEC IEs in the reassoc rsp frame
+       if (csrRoamIsCCXAssoc(pMac)) {
+           if (pSmeJoinRsp->tspecIeLen) {
+               status = sme_QosCCXProcessReassocTspecRsp(pMac, sessionId, pEvent_info);
+           }
+       }
+#endif
+       pSession->ftHandoffInProgress = VOS_FALSE;
+       pSession->handoffRequested = VOS_FALSE;
+       return status;
+   }
+#endif
+
+   pSession->sessionActive = VOS_TRUE;
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_HANDOFF:
+            // return to our previous state
+            sme_QosStateTransition(sessionId, ac, pACInfo->prev_state);
+            //for which ac APSD (hence the reassoc) is requested
+            if(pACInfo->reassoc_pending)
+            {
+               //update the apsd mask in CB - make sure to take care of the case
+               //where we are resetting the bit in apsd_mask
+               if(pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0].ts_info.psb)
+               {
+                  pSession->apsdMask |= 1 << (SME_QOS_EDCA_AC_VO - ac);
+               }
+               else
+               {
+                  pSession->apsdMask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+               }
+               pACInfo->reassoc_pending = VOS_FALSE;
+               //during setup it gets set as addts & reassoc both gets a pending flag
+               //pACInfo->tspec_pending = 0;
+               sme_QosStateTransition(sessionId, ac, SME_QOS_QOS_ON);
+               // notify HDD with new Service Interval
+               pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0] = 
+                  pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0];
+               vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+               //set the key type & the key to be searched in the Flow List
+               search_key.key.ac_type = ac;
+               search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+               search_key.sessionId = sessionId;
+               //notify PMC that reassoc is done for APSD on certain AC??
+
+               vos_mem_zero(&search_key1, sizeof(sme_QosSearchInfo));
+               //set the hoRenewal field in control block if needed
+               search_key1.index = SME_QOS_SEARCH_KEY_INDEX_3;
+               search_key1.key.reason = SME_QOS_REASON_SETUP;
+               search_key1.sessionId = sessionId;
+               for(ac_index = SME_QOS_EDCA_AC_BE; ac_index < SME_QOS_EDCA_AC_MAX; ac_index++)
+               {
+                  pEntry = sme_QosFindInFlowList(search_key1);
+                  if(pEntry)
+                  {
+                     flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+                     if(flow_info->ac_type == ac)
+                     {
+                        pACInfo->hoRenewal = flow_info->hoRenewal;
+                        break;
+                     }
+                  }
+               }
+               //notify HDD the success for the requested flow 
+               //notify all the other flows running on the AC that QoS got modified
+               if(!HAL_STATUS_SUCCESS(sme_QosFindAllInFlowList(pMac, search_key, sme_QosReassocSuccessEvFnp)))
+               {
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                            "%s: %d: no match found for ac = %d",
+                            __FUNCTION__, __LINE__,
+                            search_key.key.ac_type);
+                  //ASSERT
+                  VOS_ASSERT(0);
+                  return eHAL_STATUS_FAILURE;
+               }
+               pACInfo->hoRenewal = VOS_FALSE;
+               vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                            sizeof(sme_QosWmmTspecInfo));
+            }
+            status = eHAL_STATUS_SUCCESS;
+            break;
+         case SME_QOS_INIT:
+         case SME_QOS_CLOSED:
+            //NOP
+            status = eHAL_STATUS_SUCCESS;
+            break;
+         case SME_QOS_LINK_UP:
+         case SME_QOS_REQUESTED:
+         case SME_QOS_QOS_ON:
+         default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   (void)sme_QosProcessBufferedCmd(sessionId);
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessReassocFailureEv() - Function to process the
+  SME_QOS_CSR_REASSOC_FAILURE event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessReassocFailureEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   // our pending reassociation has completed
+   // we can allow powersave
+   pSession->readyForPowerSave = VOS_TRUE;
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_HANDOFF:
+            sme_QosStateTransition(sessionId, ac, SME_QOS_INIT);
+            if(pACInfo->reassoc_pending)
+            {
+               pACInfo->reassoc_pending = VOS_FALSE;
+            }
+            vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                         sizeof(sme_QosWmmTspecInfo));
+            pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_CLEAR;
+            pACInfo->tspec_pending = 0;
+            pACInfo->num_flows[SME_QOS_TSPEC_INDEX_0] = 0;
+            pACInfo->num_flows[SME_QOS_TSPEC_INDEX_1] = 0;
+            break;
+         case SME_QOS_INIT:
+         case SME_QOS_CLOSED:
+            //NOP
+            break;
+         case SME_QOS_LINK_UP:
+         case SME_QOS_REQUESTED:
+         case SME_QOS_QOS_ON:
+         default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   //need to clean up flows
+   sme_QosDeleteExistingFlows(pMac, sessionId);
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessHandoffAssocReqEv() - Function to process the
+  SME_QOS_CSR_HANDOFF_ASSOC_REQ event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessHandoffAssocReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   v_U8_t ac;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_LINK_UP:
+         case SME_QOS_REQUESTED:
+         case SME_QOS_QOS_ON:
+            sme_QosStateTransition(sessionId, ac, SME_QOS_HANDOFF);
+            break;
+         case SME_QOS_HANDOFF:
+            //print error msg
+#ifdef WLAN_FEATURE_VOWIFI_11R
+            if(pSession->ftHandoffInProgress)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: SME_QOS_CSR_HANDOFF_ASSOC_REQ received in "
+                         "SME_QOS_HANDOFF state with FT in progress"
+                         , __FUNCTION__, __LINE__); 
+               break; 
+            }
+#endif            
+
+         case SME_QOS_CLOSED:
+         case SME_QOS_INIT:
+         default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   // If FT handoff is in progress, legacy handoff need not be enabled
+   if (!pSession->ftHandoffInProgress) {
+       pSession->handoffRequested = VOS_TRUE;
+   }
+   // this session no longer needs UAPSD
+   pSession->apsdMask = 0;
+   // do any sessions still require UAPSD?
+   if (!sme_QosIsUapsdActive())
+   {
+      // No sessions require UAPSD so turn it off
+      // (really don't care when PMC stops it)
+      (void)pmcStopUapsd(pMac);
+   }
+   pSession->uapsdAlreadyRequested = VOS_FALSE;
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessHandoffSuccessEv() - Function to process the
+  SME_QOS_CSR_HANDOFF_COMPLETE event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessHandoffSuccessEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   v_U8_t ac;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   //go back to original state before handoff
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_HANDOFF:
+            sme_QosStateTransition(sessionId, ac, pACInfo->prev_state);
+            //we will retry for the requested flow(s) with the new AP
+            if(SME_QOS_REQUESTED == pACInfo->curr_state)
+            {
+               pACInfo->curr_state = SME_QOS_LINK_UP;
+            }
+            status = eHAL_STATUS_SUCCESS;
+            break;
+         // FT logic, has already moved it to QOS_REQUESTED state during the 
+         // reassoc request event, which would include the Qos (TSPEC) params
+         // in the reassoc req frame
+         case SME_QOS_REQUESTED:
+            break;
+         case SME_QOS_INIT:
+         case SME_QOS_CLOSED:
+         case SME_QOS_LINK_UP:
+         case SME_QOS_QOS_ON:
+         default:
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* In case of 11r - RIC, we request QoS and Hand-off at the same time hence the
+   state may be SME_QOS_REQUESTED */
+            if( pSession->ftHandoffInProgress )
+               break;
+#endif
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessHandoffFailureEv() - Function to process the
+  SME_QOS_CSR_HANDOFF_FAILURE event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessHandoffFailureEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   v_U8_t ac;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      switch(pACInfo->curr_state)
+      {
+         case SME_QOS_HANDOFF:
+            sme_QosStateTransition(sessionId, ac, SME_QOS_INIT);
+            //need to clean up flows: TODO
+            vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                         sizeof(sme_QosWmmTspecInfo));
+            vos_mem_zero(&pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_1], 
+                         sizeof(sme_QosWmmTspecInfo));
+            pACInfo->tspec_mask_status = SME_QOS_TSPEC_MASK_CLEAR;
+            pACInfo->tspec_pending = 0;
+            pACInfo->num_flows[SME_QOS_TSPEC_INDEX_0] = 0;
+            pACInfo->num_flows[SME_QOS_TSPEC_INDEX_1] = 0;
+            break;
+         case SME_QOS_INIT:
+         case SME_QOS_CLOSED:
+         case SME_QOS_LINK_UP:
+         case SME_QOS_REQUESTED:
+         case SME_QOS_QOS_ON:
+         default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: On session %d AC %d is in wrong state %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId, ac, pACInfo->curr_state);
+            //ASSERT
+            VOS_ASSERT(0);
+            break;
+      }
+   }
+   //no longer in handoff
+   pSession->handoffRequested = VOS_FALSE;
+   //clean up the assoc info
+   if(pSession->assocInfo.pBssDesc)
+   {
+      vos_mem_free(pSession->assocInfo.pBssDesc);
+      pSession->assocInfo.pBssDesc = NULL;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessDisconnectEv() - Function to process the
+  SME_QOS_CSR_DISCONNECT_REQ or  SME_QOS_CSR_DISCONNECT_IND event indication 
+  from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessDisconnectEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   if((pSession->handoffRequested)
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* In case of 11r - RIC, we request QoS and Hand-off at the same time hence the
+   state may be SME_QOS_REQUESTED */
+      && !pSession->ftHandoffInProgress
+#endif
+      )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: no need for state transition, should "
+                "already be in handoff state",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT(pSession->ac_info[0].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[1].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[2].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[3].curr_state == SME_QOS_HANDOFF);
+      return eHAL_STATUS_SUCCESS;
+   }
+   sme_QosInitACs(pMac, sessionId);
+   // this session doesn't require UAPSD
+   pSession->apsdMask = 0;
+   // do any sessions still require UAPSD?
+   if (!sme_QosIsUapsdActive())
+   {
+      // No sessions require UAPSD so turn it off
+      // (really don't care when PMC stops it)
+      (void)pmcStopUapsd(pMac);
+   }
+   pSession->uapsdAlreadyRequested = VOS_FALSE;
+   pSession->handoffRequested = VOS_FALSE;
+   pSession->readyForPowerSave = VOS_TRUE;
+   pSession->roamID = 0;
+   //need to clean up buffered req
+   sme_QosDeleteBufferedRequests(pMac, sessionId);
+   //need to clean up flows
+   sme_QosDeleteExistingFlows(pMac, sessionId);
+   //clean up the assoc info
+   if(pSession->assocInfo.pBssDesc)
+   {
+      vos_mem_free(pSession->assocInfo.pBssDesc);
+      pSession->assocInfo.pBssDesc = NULL;
+   }
+   sme_QosCb.sessionInfo[sessionId].sessionActive = VOS_FALSE;
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessJoinReqEv() - Function to process the
+  SME_QOS_CSR_JOIN_REQ event indication from CSR
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessJoinReqEv(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosEdcaAcType ac;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   if(pSession->handoffRequested)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: no need for state transition, should "
+                "already be in handoff state",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT(pSession->ac_info[0].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[1].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[2].curr_state == SME_QOS_HANDOFF);
+      VOS_ASSERT(pSession->ac_info[3].curr_state == SME_QOS_HANDOFF);
+      //buffer the existing flows to be renewed after handoff is done
+      sme_QosBufferExistingFlows(pMac, sessionId);
+      //clean up the control block partially for handoff
+      sme_QosCleanupCtrlBlkForHandoff(pMac, sessionId);
+      return eHAL_STATUS_SUCCESS;
+   }
+
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      sme_QosStateTransition(sessionId, ac, SME_QOS_INIT);
+   }
+   //clean up the assoc info if already set
+   if(pSession->assocInfo.pBssDesc)
+   {
+      vos_mem_free(pSession->assocInfo.pBssDesc);
+      pSession->assocInfo.pBssDesc = NULL;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessPreauthSuccessInd() - Function to process the
+  SME_QOS_CSR_PREAUTH_SUCCESS_IND event indication from CSR
+
+  \param pEvent_info - Pointer to relevant info from CSR.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessPreauthSuccessInd(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
+{
+    sme_QosSessionInfo *pSession;
+    sme_QosACInfo *pACInfo;
+    v_U8_t ac;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: %d: invoked on session %d",
+            __FUNCTION__, __LINE__,
+            sessionId);
+
+    pSession = &sme_QosCb.sessionInfo[sessionId];
+
+    for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+    {
+        pACInfo = &pSession->ac_info[ac];
+
+        switch(pACInfo->curr_state)
+        {
+            case SME_QOS_LINK_UP:
+            case SME_QOS_REQUESTED:
+            case SME_QOS_QOS_ON:
+                sme_QosStateTransition(sessionId, ac, SME_QOS_HANDOFF);
+                break;
+            case SME_QOS_HANDOFF:
+                //print error msg
+            case SME_QOS_CLOSED:
+            case SME_QOS_INIT:
+            default:
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                        "%s: %d: On session %d AC %d is in wrong state %d",
+                        __FUNCTION__, __LINE__,
+                        sessionId, ac, pACInfo->curr_state);
+                //ASSERT
+                VOS_ASSERT(0);
+                break;
+        }
+    }
+
+    pSession->ftHandoffInProgress = VOS_TRUE;
+
+    // Check if its a 11R roaming before preparing the RIC IEs
+    if (csrRoamIs11rAssoc(pMac)) 
+    {
+        v_U16_t ricOffset = 0;
+        v_U32_t ricIELength = 0;
+        v_U8_t  *ricIE;
+        v_U8_t  tspec_mask_status = 0;
+        v_U8_t  tspec_pending_status = 0;
+
+        /* Any Block Ack info there, should have been already filled by PE and present in this buffer
+           and the ric_ies_length should contain the length of the whole RIC IEs. Filling of TSPEC info
+           should start from this length */
+        ricIE = pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies;
+        ricOffset = pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length;
+
+        /* Now we have to process the currentTspeInfo inside this session and create the RIC IEs */
+        for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+        {
+            volatile v_U8_t   tspec_index = 0;
+
+            pACInfo = &pSession->ac_info[ac];
+            tspec_pending_status = pACInfo->tspec_pending;
+            tspec_mask_status = pACInfo->tspec_mask_status;
+            vos_mem_zero(pACInfo->ricIdentifier, SME_QOS_TSPEC_INDEX_MAX);
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                    FL("AC %d ==> TSPEC status = %d, tspec pending = %d"), 
+                    ac, tspec_mask_status, tspec_pending_status);
+
+            do
+            {
+                if (tspec_mask_status & 0x1)
+                {
+                    /* If a tspec status is pending, take requested_QoSInfo for RIC request, else use curr_QoSInfo
+                       for the RIC request */
+                    if (tspec_pending_status & 0x1)
+                    {
+                        status = sme_QosCreateTspecRICIE(pMac, &pACInfo->requested_QoSInfo[tspec_index],
+                                ricIE + ricOffset, &ricIELength, &pACInfo->ricIdentifier[tspec_index]);
+                    }
+                    else
+                    {
+                        status = sme_QosCreateTspecRICIE(pMac, &pACInfo->curr_QoSInfo[tspec_index],
+                                ricIE + ricOffset, &ricIELength, &pACInfo->ricIdentifier[tspec_index]);
+                    }
+                }
+                ricOffset += ricIELength;
+                pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length += ricIELength;
+
+                tspec_mask_status >>= 1;
+                tspec_pending_status >>= 1;
+                tspec_index++;
+            } while (tspec_mask_status);
+        }
+    }
+    return status;
+}
+
+#endif
+
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessAddTsFailureRsp() - Function to process the
+  Addts request failure response came from PE 
+  
+  We will notify HDD only for the requested Flow, other Flows running on the AC 
+  stay intact
+  
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param pRsp - Pointer to the addts response structure came from PE.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessAddTsFailureRsp(tpAniSirGlobal pMac, 
+                                         v_U8_t sessionId,
+                                         tSirAddtsRspInfo * pRsp)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac;
+   sme_QosSearchInfo search_key;
+   v_U8_t tspec_pending;
+   sme_QosWmmUpType up = (sme_QosWmmUpType)pRsp->tspec.tsinfo.traffic.userPrio;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for UP %d",
+             __FUNCTION__, __LINE__,
+             sessionId, up);
+   ac = sme_QosUpToAc(up);
+   if(SME_QOS_EDCA_AC_MAX == ac)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: invalid AC %d from UP %d",
+                __FUNCTION__, __LINE__, ac, up);
+      return eHAL_STATUS_FAILURE;
+   }
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   // is there a TSPEC request pending on this AC?
+   tspec_pending = pACInfo->tspec_pending;
+   if(!tspec_pending)
+   {
+      //ASSERT
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d an AddTS is not pending on AC %d",
+                __FUNCTION__, __LINE__,
+                sessionId, ac);
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+   //set the key type & the key to be searched in the Flow List
+   search_key.key.ac_type = ac;
+   search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+   search_key.sessionId = sessionId;
+   if(!HAL_STATUS_SUCCESS(sme_QosFindAllInFlowList(pMac, search_key, sme_QosAddTsFailureFnp)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d no match found for ac = %d",
+                __FUNCTION__, __LINE__,
+                sessionId, search_key.key.ac_type);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_zero(&pACInfo->requested_QoSInfo[tspec_pending - 1], 
+                sizeof(sme_QosWmmTspecInfo));
+
+   if((!pACInfo->num_flows[0])&&
+      (!pACInfo->num_flows[1]))
+   {
+      pACInfo->tspec_mask_status &= SME_QOS_TSPEC_MASK_BIT_1_2_SET & 
+         (~pACInfo->tspec_pending);
+      sme_QosStateTransition(sessionId, ac, SME_QOS_LINK_UP);
+   }
+   else
+   {
+      sme_QosStateTransition(sessionId, ac, SME_QOS_QOS_ON);
+   }
+   pACInfo->tspec_pending = 0;
+
+   (void)sme_QosProcessBufferedCmd(sessionId);
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosUpdateTspecMask() - Utiltity function to update the tspec.
+  Typical usage while aggregating unidirectional flows into a bi-directional
+  flow on AC which is running multiple flows
+  
+  \param sessionId - Session upon which the TSPEC is being updated
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \param old_tspec_mask - on which tspec per AC, the update is requested
+  \param new_tspec_mask - tspec to be set for this AC
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosUpdateTspecMask(v_U8_t sessionId,
+                                      sme_QosSearchInfo search_key,
+                                      v_U8_t new_tspec_mask)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for AC %d TSPEC %d",
+             __FUNCTION__, __LINE__,
+             sessionId, search_key.key.ac_type, new_tspec_mask);
+
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   
+   if (search_key.key.ac_type < SME_QOS_EDCA_AC_MAX)
+   {
+   pACInfo = &pSession->ac_info[search_key.key.ac_type];
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Exceeded the array bounds of pSession->ac_info",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT (0);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, nothing to update",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+
+      if(search_key.sessionId == flow_info->sessionId)
+      {
+         if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_4)
+         {
+            if((search_key.key.ac_type == flow_info->ac_type) &&
+               (search_key.direction == flow_info->QoSInfo.ts_info.direction))
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: Flow %d matches",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+               pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+               pACInfo->num_flows[new_tspec_mask - 1]++;
+               flow_info->tspec_mask = new_tspec_mask;
+            }
+         }
+         else if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_5)
+         {
+            if((search_key.key.ac_type == flow_info->ac_type) &&
+               (search_key.tspec_mask == flow_info->tspec_mask))
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: Flow %d matches",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+               pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+               pACInfo->num_flows[new_tspec_mask - 1]++;
+               flow_info->tspec_mask = new_tspec_mask;
+            }
+         }
+      }
+
+      pEntry = pNextEntry;
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessAddTsSuccessRsp() - Function to process the
+  Addts request success response came from PE 
+  
+  We will notify HDD with addts success for the requested Flow, & for other 
+  Flows running on the AC we will send an addts modify status 
+  
+  
+  \param pMac - Pointer to the global MAC parameter structure.  
+  \param pRsp - Pointer to the addts response structure came from PE.   
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessAddTsSuccessRsp(tpAniSirGlobal pMac, 
+                                         v_U8_t sessionId,
+                                         tSirAddtsRspInfo * pRsp)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac, ac_index;
+   sme_QosSearchInfo search_key;
+   sme_QosSearchInfo search_key1;
+   v_U8_t tspec_pending;
+   tListElem *pEntry= NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosWmmUpType up = (sme_QosWmmUpType)pRsp->tspec.tsinfo.traffic.userPrio;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   WLAN_VOS_DIAG_EVENT_DEF(qos, vos_event_wlan_qos_payload_type);
+   vos_log_qos_tspec_pkt_type *log_ptr = NULL;
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for UP %d",
+             __FUNCTION__, __LINE__,
+             sessionId, up);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   ac = sme_QosUpToAc(up);
+   if(SME_QOS_EDCA_AC_MAX == ac)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: invalid AC %d from UP %d",
+                __FUNCTION__, __LINE__, ac, up);
+      return eHAL_STATUS_FAILURE;
+   }
+   pACInfo = &pSession->ac_info[ac];
+   // is there a TSPEC request pending on this AC?
+   tspec_pending = pACInfo->tspec_pending;
+   if(!tspec_pending)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d an AddTS is not pending on AC %d",
+                __FUNCTION__, __LINE__,
+                sessionId, ac);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   //App is looking for APSD or the App which was looking for APSD has been 
+   //released, so STA re-negotiated with AP
+   if(pACInfo->requested_QoSInfo[tspec_pending - 1].ts_info.psb)
+   {
+      //update the session's apsd mask
+      pSession->apsdMask |= 1 << (SME_QOS_EDCA_AC_VO - ac);
+   }
+   else
+   {
+      if(((SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~tspec_pending) > 0) &&
+         ((SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~tspec_pending) <= 
+            SME_QOS_TSPEC_INDEX_MAX))
+      {
+      if(!pACInfo->requested_QoSInfo
+         [(SME_QOS_TSPEC_MASK_BIT_1_2_SET & ~tspec_pending) - 1].ts_info.psb)
+      {
+         //update the session's apsd mask
+         pSession->apsdMask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+      }
+   }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Exceeded the array bounds of pACInfo->requested_QosInfo",
+                   __FUNCTION__, __LINE__);
+         VOS_ASSERT (0);
+         return eHAL_STATUS_FAILURE;
+      }
+   }
+   pACInfo->curr_QoSInfo[tspec_pending - 1] = 
+      pACInfo->requested_QoSInfo[tspec_pending - 1];
+   /* Check if the current flow is for bi-directional. If so, update the number of flows
+    * to reflect that all flows are aggregated into tspec index 0. */
+   if((pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.direction == SME_QOS_WMM_TS_DIR_BOTH) &&
+      (pACInfo->num_flows[SME_QOS_TSPEC_INDEX_1] > 0))
+   {
+     vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+     /* update tspec_mask for all the flows having SME_QOS_TSPEC_MASK_BIT_2_SET to SME_QOS_TSPEC_MASK_BIT_1_SET */
+     search_key.key.ac_type = ac;
+     search_key.index = SME_QOS_SEARCH_KEY_INDEX_5;
+     search_key.sessionId = sessionId;
+     search_key.tspec_mask = SME_QOS_TSPEC_MASK_BIT_2_SET;
+     sme_QosUpdateTspecMask(sessionId, search_key, SME_QOS_TSPEC_MASK_BIT_1_SET);
+   }
+
+   vos_mem_zero(&search_key1, sizeof(sme_QosSearchInfo));
+   //set the horenewal field in control block if needed
+   search_key1.index = SME_QOS_SEARCH_KEY_INDEX_3;
+   search_key1.key.reason = SME_QOS_REASON_SETUP;
+   search_key1.sessionId = sessionId;
+   for(ac_index = SME_QOS_EDCA_AC_BE; ac_index < SME_QOS_EDCA_AC_MAX; ac_index++)
+   {
+      pEntry = sme_QosFindInFlowList(search_key1);
+      if(pEntry)
+      {
+         flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+         if(flow_info->ac_type == ac)
+         {
+            pACInfo->hoRenewal = flow_info->hoRenewal;
+            break;
+         }
+      }
+   }
+   vos_mem_zero(&search_key, sizeof(sme_QosSearchInfo));
+   //set the key type & the key to be searched in the Flow List
+   search_key.key.ac_type = ac;
+   search_key.index = SME_QOS_SEARCH_KEY_INDEX_2;
+   search_key.sessionId = sessionId;
+   //notify HDD the success for the requested flow 
+   //notify all the other flows running on the AC that QoS got modified
+   if(!HAL_STATUS_SUCCESS(sme_QosFindAllInFlowList(pMac, search_key, sme_QosAddTsSuccessFnp)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d no match found for ac %d",
+                __FUNCTION__, __LINE__,
+                sessionId, search_key.key.ac_type);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   pACInfo->hoRenewal = VOS_FALSE;
+   vos_mem_zero(&pACInfo->requested_QoSInfo[tspec_pending - 1], 
+                sizeof(sme_QosWmmTspecInfo));
+   //event: EVENT_WLAN_QOS
+#ifdef FEATURE_WLAN_DIAG_SUPPORT          
+   qos.eventId = SME_QOS_DIAG_ADDTS_RSP;
+   qos.reasonCode = SME_QOS_DIAG_ADDTS_ADMISSION_ACCEPTED;
+   WLAN_VOS_DIAG_EVENT_REPORT(&qos, EVENT_WLAN_QOS);
+   WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_tspec_pkt_type, LOG_WLAN_QOS_TSPEC_C);
+   if(log_ptr)
+   {
+      log_ptr->delay_bound = pACInfo->curr_QoSInfo[tspec_pending - 1].delay_bound;
+      log_ptr->inactivity_interval = pACInfo->curr_QoSInfo[tspec_pending - 1].inactivity_interval;
+      log_ptr->max_burst_size = pACInfo->curr_QoSInfo[tspec_pending - 1].max_burst_size;
+      log_ptr->max_service_interval = pACInfo->curr_QoSInfo[tspec_pending - 1].max_service_interval;
+      log_ptr->maximum_msdu_size = pACInfo->curr_QoSInfo[tspec_pending - 1].maximum_msdu_size;
+      log_ptr->mean_data_rate = pACInfo->curr_QoSInfo[tspec_pending - 1].mean_data_rate;
+      log_ptr->medium_time = pACInfo->curr_QoSInfo[tspec_pending - 1].medium_time;
+      log_ptr->min_data_rate = pACInfo->curr_QoSInfo[tspec_pending - 1].min_data_rate;
+      log_ptr->min_phy_rate = pACInfo->curr_QoSInfo[tspec_pending - 1].min_phy_rate;
+      log_ptr->min_service_interval = pACInfo->curr_QoSInfo[tspec_pending - 1].min_service_interval;
+      log_ptr->nominal_msdu_size = pACInfo->curr_QoSInfo[tspec_pending - 1].nominal_msdu_size;
+      log_ptr->peak_data_rate = pACInfo->curr_QoSInfo[tspec_pending - 1].peak_data_rate;
+      log_ptr->surplus_bw_allowance = pACInfo->curr_QoSInfo[tspec_pending - 1].surplus_bw_allowance;
+      log_ptr->suspension_interval = pACInfo->curr_QoSInfo[tspec_pending - 1].surplus_bw_allowance;
+      log_ptr->suspension_interval = pACInfo->curr_QoSInfo[tspec_pending - 1].suspension_interval;
+      log_ptr->svc_start_time = pACInfo->curr_QoSInfo[tspec_pending - 1].svc_start_time;
+      log_ptr->tsinfo[0] = pACInfo->curr_QoSInfo[tspec_pending - 1].ts_info.direction << 5 |
+         pACInfo->curr_QoSInfo[tspec_pending - 1].ts_info.tid << 1;
+      log_ptr->tsinfo[1] = pACInfo->curr_QoSInfo[tspec_pending - 1].ts_info.up << 11 |
+         pACInfo->curr_QoSInfo[tspec_pending - 1].ts_info.psb << 10;
+      log_ptr->tsinfo[2] = 0;
+   }
+   WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+#ifdef FEATURE_WLAN_CCX
+   if (ac == SME_QOS_EDCA_AC_VO)
+   {
+      // Indicate to neighbor roam logic of the new required VO
+      // ac bandwidth requirement.
+      csrNeighborRoamIndicateVoiceBW( pMac, pACInfo->curr_QoSInfo[tspec_pending - 1].peak_data_rate, TRUE );
+   }
+#endif
+   pACInfo->tspec_pending = 0;
+
+   sme_QosStateTransition(sessionId, ac, SME_QOS_QOS_ON);
+
+
+   (void)sme_QosProcessBufferedCmd(sessionId);
+   return eHAL_STATUS_SUCCESS;
+   
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosAggregateParams() - Utiltity function to increament the TSPEC 
+  params per AC. Typical usage while using flow aggregation or deletion of flows
+  
+  \param pInput_Tspec_Info - Pointer to sme_QosWmmTspecInfo which contains the 
+  WMM TSPEC related info with which pCurrent_Tspec_Info will be updated
+  \param pCurrent_Tspec_Info - Pointer to sme_QosWmmTspecInfo which contains 
+  current the WMM TSPEC related info
+
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosAggregateParams(
+   sme_QosWmmTspecInfo * pInput_Tspec_Info,
+   sme_QosWmmTspecInfo * pCurrent_Tspec_Info,
+   sme_QosWmmTspecInfo * pUpdated_Tspec_Info)
+{
+   sme_QosWmmTspecInfo TspecInfo;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked",
+             __FUNCTION__, __LINE__);
+   if(!pInput_Tspec_Info)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: input is NULL, nothing to aggregate",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   if(!pCurrent_Tspec_Info)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Current is NULL, can't aggregate",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_copy(&TspecInfo, pCurrent_Tspec_Info, 
+                sizeof(sme_QosWmmTspecInfo));
+   /*-------------------------------------------------------------------------
+     APSD preference is only meaningful if service interval was set by app
+   -------------------------------------------------------------------------*/
+   if(pCurrent_Tspec_Info->min_service_interval && pInput_Tspec_Info->min_service_interval)
+   {
+      TspecInfo.min_service_interval = VOS_MIN(
+         pCurrent_Tspec_Info->min_service_interval,
+         pInput_Tspec_Info->min_service_interval);
+   }
+   else if(pInput_Tspec_Info->min_service_interval)
+   {
+      TspecInfo.min_service_interval = pInput_Tspec_Info->min_service_interval;
+   }
+   if(pCurrent_Tspec_Info->max_service_interval)
+   {
+      TspecInfo.max_service_interval = VOS_MIN(
+         pCurrent_Tspec_Info->max_service_interval,
+         pInput_Tspec_Info->max_service_interval);
+   }
+   else
+   {
+      TspecInfo.max_service_interval = pInput_Tspec_Info->max_service_interval;
+   }
+   /*-------------------------------------------------------------------------
+     If directions don't match, it must necessarily be both uplink and
+     downlink
+   -------------------------------------------------------------------------*/
+   if(pCurrent_Tspec_Info->ts_info.direction != 
+      pInput_Tspec_Info->ts_info.direction)
+   {
+      TspecInfo.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
+   }
+   /*-------------------------------------------------------------------------
+     Max MSDU size : these sizes are `maxed'
+   -------------------------------------------------------------------------*/
+   TspecInfo.maximum_msdu_size = VOS_MAX(pCurrent_Tspec_Info->maximum_msdu_size,
+                                         pInput_Tspec_Info->maximum_msdu_size);
+
+   /*-------------------------------------------------------------------------
+     Inactivity interval : these sizes are `maxed'
+   -------------------------------------------------------------------------*/
+   TspecInfo.inactivity_interval = VOS_MAX(pCurrent_Tspec_Info->inactivity_interval,
+                                         pInput_Tspec_Info->inactivity_interval);
+
+   /*-------------------------------------------------------------------------
+     Delay bounds: min of all values
+     Check on 0: if 0, it means initial value since delay can never be 0!!
+   -------------------------------------------------------------------------*/
+   if(pCurrent_Tspec_Info->delay_bound)
+   {
+      TspecInfo.delay_bound = VOS_MIN(pCurrent_Tspec_Info->delay_bound,
+                                      pInput_Tspec_Info->delay_bound);
+   }
+   else
+   {
+      TspecInfo.delay_bound = pInput_Tspec_Info->delay_bound;
+   }
+   TspecInfo.max_burst_size = VOS_MAX(pCurrent_Tspec_Info->max_burst_size,
+                                      pInput_Tspec_Info->max_burst_size);
+
+   /*-------------------------------------------------------------------------
+     Nominal MSDU size also has a fixed bit that needs to be `handled' before
+     aggregation
+     This can be handled only if previous size is the same as new or both have
+     the fixed bit set
+     These sizes are not added: but `maxed'
+   -------------------------------------------------------------------------*/
+   TspecInfo.nominal_msdu_size = VOS_MAX(
+      pCurrent_Tspec_Info->nominal_msdu_size & ~SME_QOS_16BIT_MSB,
+      pInput_Tspec_Info->nominal_msdu_size & ~SME_QOS_16BIT_MSB);
+
+   if( ((pCurrent_Tspec_Info->nominal_msdu_size == 0) ||
+        (pCurrent_Tspec_Info->nominal_msdu_size & SME_QOS_16BIT_MSB)) &&
+       ((pInput_Tspec_Info->nominal_msdu_size == 0) ||
+        (pInput_Tspec_Info->nominal_msdu_size & SME_QOS_16BIT_MSB)))
+   {
+     TspecInfo.nominal_msdu_size |= SME_QOS_16BIT_MSB;
+   }
+
+   /*-------------------------------------------------------------------------
+     Data rates: 
+     Add up the rates for aggregation
+   -------------------------------------------------------------------------*/
+   SME_QOS_BOUNDED_U32_ADD_Y_TO_X( TspecInfo.peak_data_rate,
+                                   pInput_Tspec_Info->peak_data_rate );
+   SME_QOS_BOUNDED_U32_ADD_Y_TO_X( TspecInfo.min_data_rate,
+                                   pInput_Tspec_Info->min_data_rate );
+   /* mean data rate = peak data rate: aggregate to be flexible on apps  */
+   SME_QOS_BOUNDED_U32_ADD_Y_TO_X( TspecInfo.mean_data_rate,
+                                   pInput_Tspec_Info->mean_data_rate );
+
+   /*-------------------------------------------------------------------------
+     Suspension interval : this is set to the inactivity interval since per
+     spec it is less than or equal to inactivity interval
+     This is not provided by app since we currently don't support the HCCA
+     mode of operation
+     Currently set it to 0 to avoid confusion: Cisco CCX needs ~0; spec 
+     requires inactivity interval to be > suspension interval: this could
+     be tricky!
+   -------------------------------------------------------------------------*/
+   TspecInfo.suspension_interval = 0;
+   /*-------------------------------------------------------------------------
+     Remaining parameters do not come from app as they are very WLAN
+     air interface specific
+     Set meaningful values here
+   -------------------------------------------------------------------------*/
+   TspecInfo.medium_time = 0;               /* per WMM spec                 */
+   TspecInfo.min_phy_rate = SME_QOS_MIN_PHY_RATE;
+   TspecInfo.svc_start_time = 0;           /* arbitrary                  */
+   TspecInfo.surplus_bw_allowance += pInput_Tspec_Info->surplus_bw_allowance;
+   if(TspecInfo.surplus_bw_allowance > SME_QOS_SURPLUS_BW_ALLOWANCE)
+   {
+      TspecInfo.surplus_bw_allowance = SME_QOS_SURPLUS_BW_ALLOWANCE;
+   }
+   /* Set ack_policy to block ack even if one stream requests block ack policy */
+   if((pInput_Tspec_Info->ts_info.ack_policy == SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK) ||
+      (pCurrent_Tspec_Info->ts_info.ack_policy == SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK))
+   {
+     TspecInfo.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
+   }
+
+   if(pInput_Tspec_Info->ts_info.burst_size_defn || pCurrent_Tspec_Info->ts_info.burst_size_defn )
+   {
+     TspecInfo.ts_info.burst_size_defn = 1;
+   }
+   if(pUpdated_Tspec_Info)
+   {
+      vos_mem_copy(pUpdated_Tspec_Info, &TspecInfo, 
+                   sizeof(sme_QosWmmTspecInfo));
+   }
+   else
+   {
+      vos_mem_copy(pCurrent_Tspec_Info, &TspecInfo, 
+                   sizeof(sme_QosWmmTspecInfo));
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosUpdateParams() - Utiltity function to update the TSPEC 
+  params per AC. Typical usage while deleting flows on AC which is running
+  multiple flows
+  
+  \param sessionId - Session upon which the TSPEC is being updated
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \param tspec_mask - on which tspec per AC, the update is requested
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosUpdateParams(v_U8_t sessionId,
+                                      sme_QosEdcaAcType ac,
+                                      v_U8_t tspec_mask, 
+                                      sme_QosWmmTspecInfo * pTspec_Info)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosWmmTspecInfo Tspec_Info;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: invoked on session %d for AC %d TSPEC %d",
+             __FUNCTION__, __LINE__,
+             sessionId, ac, tspec_mask);
+   if(!pTspec_Info)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: output is NULL, can't aggregate",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_zero(&Tspec_Info, sizeof(sme_QosWmmTspecInfo));
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, nothing to update",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   //init the TS info field
+   Tspec_Info.ts_info.up  = pACInfo->curr_QoSInfo[tspec_mask - 1].ts_info.up;
+   Tspec_Info.ts_info.psb = pACInfo->curr_QoSInfo[tspec_mask - 1].ts_info.psb;
+   Tspec_Info.ts_info.tid = pACInfo->curr_QoSInfo[tspec_mask - 1].ts_info.tid;
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      if((sessionId == flow_info->sessionId) &&
+         (ac == flow_info->ac_type) &&
+         (tspec_mask == flow_info->tspec_mask))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Flow %d matches",
+                   __FUNCTION__, __LINE__,
+                   flow_info->QosFlowID);
+         
+         if((SME_QOS_REASON_RELEASE == flow_info->reason ) ||
+            (SME_QOS_REASON_MODIFY == flow_info->reason))
+         {
+            //msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                      "%s: %d: Skipping Flow %d as it is marked "
+                      "for release/modify",
+                      __FUNCTION__, __LINE__,
+                      flow_info->QosFlowID);
+         }
+         else if(!HAL_STATUS_SUCCESS(sme_QosAggregateParams(&flow_info->QoSInfo, 
+                                                            &Tspec_Info,
+                                                            NULL)))
+         {
+            //err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosAggregateParams() failed",
+                      __FUNCTION__, __LINE__);
+         }
+      }
+      pEntry = pNextEntry;
+   }
+   // return the aggregate
+   *pTspec_Info = Tspec_Info;
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosAcToUp() - Utiltity function to map an AC to UP
+  Note: there is a quantization loss here because 4 ACs are mapped to 8 UPs
+  Mapping is done for consistency
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \return an User Priority
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosWmmUpType sme_QosAcToUp(sme_QosEdcaAcType ac)
+{
+   sme_QosWmmUpType up = SME_QOS_WMM_UP_MAX;
+   if(ac >= 0 && ac < SME_QOS_EDCA_AC_MAX)
+   {
+      up = sme_QosACtoUPMap[ac];
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+             "%s: %d: ac = %d up = %d returned",
+             __FUNCTION__, __LINE__, ac, up);
+   return up;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosUpToAc() - Utiltity function to map an UP to AC
+  \param up - Enumeration of the various User priorities (UP).
+  \return an Access Category
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+sme_QosEdcaAcType sme_QosUpToAc(sme_QosWmmUpType up)
+{
+   sme_QosEdcaAcType ac = SME_QOS_EDCA_AC_MAX;
+   if(up >= 0 && up < SME_QOS_WMM_UP_MAX)
+   {
+      ac = sme_QosUPtoACMap[up];
+   }
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+             "%s: %d: up = %d ac = %d returned",
+             __FUNCTION__, __LINE__, up, ac);
+   return ac;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosStateTransition() - The state transition function per AC. We
+  save the previous state also.
+  \param sessionId - Session upon which the state machine is running
+  \param ac - Enumeration of the various EDCA Access Categories.
+  \param new_state - The state FSM is moving to.
+  
+  \return None
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static void sme_QosStateTransition(v_U8_t sessionId,
+                                   sme_QosEdcaAcType ac,
+                                   sme_QosStates new_state)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   pACInfo->prev_state = pACInfo->curr_state;
+   pACInfo->curr_state = new_state;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: %d: On session %d new state=%d, old state=%d, for AC=%d",
+             __FUNCTION__, __LINE__, 
+             sessionId, pACInfo->curr_state, pACInfo->prev_state, ac );
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosFindInFlowList() - Utility function to find an flow entry from
+  the flow_list.
+  \param search_key -  We can either use the flowID or the ac type to find the 
+  entry in the flow list.
+  A bitmap in sme_QosSearchInfo tells which key to use. Starting from LSB,
+  bit 0 - Flow ID
+  bit 1 - AC type
+  \return the pointer to the entry in the link list
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+tListElem *sme_QosFindInFlowList(sme_QosSearchInfo search_key)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, can't search",
+                __FUNCTION__, __LINE__);
+      return NULL;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      if((search_key.sessionId == flow_info->sessionId) ||
+         (search_key.sessionId == SME_QOS_SEARCH_SESSION_ID_ANY))
+      {
+         if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_1)
+         {
+            if(search_key.key.QosFlowID == flow_info->QosFlowID)
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on flowID, ending search",
+                         __FUNCTION__, __LINE__);
+               break;
+            }
+         }
+         else if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_2)
+         {
+            if(search_key.key.ac_type == flow_info->ac_type)
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on ac, ending search",
+                         __FUNCTION__, __LINE__);
+               break;
+            }
+         }
+         else if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_3)
+         {
+            if(search_key.key.reason == flow_info->reason)
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on reason, ending search",
+                         __FUNCTION__, __LINE__);
+               break;
+            }
+         }
+         else if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_4)
+         {
+            if((search_key.key.ac_type == flow_info->ac_type) && 
+               (search_key.direction == flow_info->QoSInfo.ts_info.direction))
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on reason, ending search",
+                         __FUNCTION__, __LINE__);
+
+               break;
+            }
+         }
+      }
+      pEntry = pNextEntry;
+   }
+   return pEntry;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosFindAllInFlowList() - Utility function to find an flow entry 
+  from the flow_list & act on it.
+  \param search_key -  We can either use the flowID or the ac type to find the 
+  entry in the flow list.
+  A bitmap in sme_QosSearchInfo tells which key to use. Starting from LSB,
+  bit 0 - Flow ID
+  bit 1 - AC type
+  \param fnp - function pointer specifying the action type for the entry found
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosFindAllInFlowList(tpAniSirGlobal pMac,
+                                    sme_QosSearchInfo search_key, 
+                                    sme_QosProcessSearchEntry fnp)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, can't search",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+      if((search_key.sessionId == flow_info->sessionId) ||
+         (search_key.sessionId == SME_QOS_SEARCH_SESSION_ID_ANY))
+      {
+         if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_1)
+         {
+            if(search_key.key.QosFlowID == flow_info->QosFlowID)
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on flowID, ending search",
+                         __FUNCTION__, __LINE__);
+               status = fnp(pMac, pEntry);
+               if(eHAL_STATUS_FAILURE == status)
+               {
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                            "%s: %d: Failed to process entry",
+                            __FUNCTION__, __LINE__);
+                  break;
+               }
+            }
+         }
+         else if(search_key.index & SME_QOS_SEARCH_KEY_INDEX_2)
+         {
+            if(search_key.key.ac_type == flow_info->ac_type)
+            {
+               //msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: match found on ac, ending search",
+                         __FUNCTION__, __LINE__);
+               flow_info->hoRenewal = pSession->ac_info[flow_info->ac_type].hoRenewal;
+               status = fnp(pMac, pEntry);
+               if(eHAL_STATUS_FAILURE == status)
+               {
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                            "%s: %d: Failed to process entry",
+                            __FUNCTION__, __LINE__);
+                  break;
+               }
+            }
+         }
+      }
+      pEntry = pNextEntry;
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosIsACM() - Utility function to check if a particular AC
+  mandates Admission Control.
+  \param ac - Enumeration of the various EDCA Access Categories.
+  
+  \return VOS_TRUE if the AC mandates Admission Control
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_BOOL_t sme_QosIsACM(tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, 
+                      sme_QosEdcaAcType ac, tDot11fBeaconIEs *pIes)
+{
+   v_BOOL_t ret_val = VOS_FALSE;
+   tDot11fBeaconIEs *pIesLocal;
+   if(!pSirBssDesc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: pSirBssDesc is NULL",
+                __FUNCTION__, __LINE__);
+      return VOS_FALSE;
+   }
+
+   if (NULL != pIes)
+   {
+      /* IEs were provided so use them locally */
+      pIesLocal = pIes;
+   }
+   else
+   {
+      /* IEs were not provided so parse them ourselves */
+      if (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal)))
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: csrGetParsedBssDescriptionIEs() failed",
+                   __FUNCTION__, __LINE__);
+         return VOS_FALSE;
+      }
+
+      /* if success then pIesLocal was allocated */
+   }
+
+   if(CSR_IS_QOS_BSS(pIesLocal))
+   {
+       switch(ac)
+       {
+          case SME_QOS_EDCA_AC_BE:
+             if(pIesLocal->WMMParams.acbe_acm) ret_val = VOS_TRUE;
+             break;
+          case SME_QOS_EDCA_AC_BK:
+             if(pIesLocal->WMMParams.acbk_acm) ret_val = VOS_TRUE;
+             break;
+          case SME_QOS_EDCA_AC_VI:
+             if(pIesLocal->WMMParams.acvi_acm) ret_val = VOS_TRUE;
+             break;
+          case SME_QOS_EDCA_AC_VO:
+             if(pIesLocal->WMMParams.acvo_acm) ret_val = VOS_TRUE;
+             break;
+          default:
+             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                       "%s: %d: unknown AC = %d",
+                       __FUNCTION__, __LINE__, ac);
+             //Assert
+             VOS_ASSERT(0);
+             break;
+       }
+   }//IS_QOS_BSS
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: ACM = %d for AC = %d",
+             __FUNCTION__, __LINE__, ret_val, ac );
+   if (NULL == pIes)
+   {
+      /* IEs were allocated locally so free them */
+      vos_mem_free(pIesLocal);
+   }
+   return ret_val;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosBufferExistingFlows() - Utility function to buffer the existing
+  flows in flow_list, so that we can renew them after handoff is done.
+
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosBufferExistingFlows(tpAniSirGlobal pMac,
+                                             v_U8_t sessionId)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosSessionInfo *pSession;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosCmdInfo  cmd;
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, nothing to buffer",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      if (flow_info->sessionId == sessionId)
+      {
+         if((SME_QOS_REASON_REQ_SUCCESS == flow_info->reason )||
+            (SME_QOS_REASON_SETUP == flow_info->reason ))
+         {
+            cmd.command = SME_QOS_SETUP_REQ;
+            cmd.pMac = pMac;
+            cmd.sessionId = sessionId;
+            cmd.u.setupCmdInfo.HDDcontext = flow_info->HDDcontext;
+            cmd.u.setupCmdInfo.QoSInfo = flow_info->QoSInfo;
+            cmd.u.setupCmdInfo.QoSCallback = flow_info->QoSCallback;
+            cmd.u.setupCmdInfo.UPType = SME_QOS_WMM_UP_MAX;//shouldn't be needed
+            cmd.u.setupCmdInfo.QosFlowID = flow_info->QosFlowID;
+            if(SME_QOS_REASON_SETUP == flow_info->reason )
+            {
+               cmd.u.setupCmdInfo.hoRenewal = VOS_FALSE;
+            }
+            else
+            {
+               cmd.u.setupCmdInfo.hoRenewal = VOS_TRUE;//TODO: might need this for modify
+            }
+            if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_TRUE)))
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: couldn't buffer the setup request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: buffered a setup request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+         }
+         else if(SME_QOS_REASON_RELEASE == flow_info->reason ) 
+         {
+            cmd.command = SME_QOS_RELEASE_REQ;
+            cmd.pMac = pMac;
+            cmd.sessionId = sessionId;
+            cmd.u.releaseCmdInfo.QosFlowID = flow_info->QosFlowID;
+            if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_TRUE)))
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: couldn't buffer the release request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: buffered a release request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+         }
+         else if(SME_QOS_REASON_MODIFY_PENDING == flow_info->reason)
+         {
+            cmd.command = SME_QOS_MODIFY_REQ;
+            cmd.pMac = pMac;
+            cmd.sessionId = sessionId;
+            cmd.u.modifyCmdInfo.QosFlowID = flow_info->QosFlowID;
+            cmd.u.modifyCmdInfo.QoSInfo = flow_info->QoSInfo;
+            if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_TRUE)))
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                         "%s: %d: couldn't buffer the modify request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                         "%s: %d: buffered a modify request for "
+                         "flow %d in handoff state",
+                         __FUNCTION__, __LINE__,
+                         flow_info->QosFlowID);
+            }
+         }
+         //delete the entry from Flow List
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                   "%s: %d: Deleting original entry at %p with flowID %d",
+                   __FUNCTION__, __LINE__,
+                   flow_info, flow_info->QosFlowID);
+         csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+         vos_mem_free(flow_info);
+      }
+      pEntry = pNextEntry;
+   }
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pSession->uapsdAlreadyRequested = VOS_FALSE;
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosDeleteExistingFlows() - Utility function to Delete the existing
+  flows in flow_list, if we lost connectivity.
+
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosDeleteExistingFlows(tpAniSirGlobal pMac,
+                                             v_U8_t sessionId)
+{
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_TRUE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                "%s: %d: Flow List empty, nothing to delete",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_TRUE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      if (flow_info->sessionId == sessionId)
+      {
+         if((SME_QOS_REASON_REQ_SUCCESS == flow_info->reason )||
+            (SME_QOS_REASON_SETUP == flow_info->reason )||
+            (SME_QOS_REASON_RELEASE == flow_info->reason )||
+            (SME_QOS_REASON_MODIFY == flow_info->reason ))
+         {
+            flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                   NULL,
+                                   SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
+                                   flow_info->QosFlowID);
+         }
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "%s: %d: Deleting entry at %p with flowID %d",
+                   __FUNCTION__, __LINE__,
+                   flow_info, flow_info->QosFlowID);
+         //delete the entry from Flow List
+         csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+         vos_mem_free(flow_info);
+      }
+      pEntry = pNextEntry;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosBufferCmd() - Utility function to buffer a request (setup/modify/
+  release) from client while processing another one on the same AC.
+  \param pcmd - a pointer to the cmd structure to be saved inside the buffered
+                cmd link list
+                
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosBufferCmd(sme_QosCmdInfo *pcmd, v_BOOL_t insert_head)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosCmdInfoEntry * pentry = NULL;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked",
+             __FUNCTION__, __LINE__);
+   pentry = (sme_QosCmdInfoEntry *) vos_mem_malloc(sizeof(sme_QosCmdInfoEntry));
+   if (!pentry)
+   {
+      //err msg
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Memory allocation failure",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   // copy the entire CmdInfo
+   pentry->cmdInfo = *pcmd;
+ 
+   pSession = &sme_QosCb.sessionInfo[pcmd->sessionId];
+   if(insert_head) 
+   {
+      csrLLInsertHead(&pSession->bufferedCommandList, &pentry->link, VOS_TRUE);
+   }
+   else
+   {
+      csrLLInsertTail(&pSession->bufferedCommandList, &pentry->link, VOS_TRUE);
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessBufferedCmd() - Utility function to process a buffered 
+  request (setup/modify/release) initially came from the client.
+
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosProcessBufferedCmd(v_U8_t sessionId)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosCmdInfoEntry *pcmd = NULL;
+   tListElem *pEntry= NULL;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked on session %d",
+             __FUNCTION__, __LINE__,
+             sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   if(!csrLLIsListEmpty( &pSession->bufferedCommandList, VOS_FALSE ))
+   {
+      pEntry = csrLLRemoveHead( &pSession->bufferedCommandList, VOS_TRUE );
+      if(!pEntry)
+      {
+         //Err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: no more buffered commands on session %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId);
+         pSession->readyForPowerSave = VOS_TRUE;
+         return eHAL_STATUS_FAILURE;
+      }
+      pcmd = GET_BASE_ADDR( pEntry, sme_QosCmdInfoEntry, link );
+      switch(pcmd->cmdInfo.command)
+      {
+      case SME_QOS_SETUP_REQ:
+         hdd_status = sme_QosInternalSetupReq(pcmd->cmdInfo.pMac, 
+                                              pcmd->cmdInfo.sessionId,
+                                              &pcmd->cmdInfo.u.setupCmdInfo.QoSInfo,
+                                              pcmd->cmdInfo.u.setupCmdInfo.QoSCallback, 
+                                              pcmd->cmdInfo.u.setupCmdInfo.HDDcontext, 
+                                              pcmd->cmdInfo.u.setupCmdInfo.UPType, 
+                                              pcmd->cmdInfo.u.setupCmdInfo.QosFlowID, 
+                                              VOS_TRUE,
+                                              pcmd->cmdInfo.u.setupCmdInfo.hoRenewal);
+         if(SME_QOS_STATUS_SETUP_FAILURE_RSP == hdd_status)
+         {
+            //Err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosInternalSetupReq failed on session %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId);
+            halStatus = eHAL_STATUS_FAILURE;
+         }
+         break;
+      case SME_QOS_RELEASE_REQ:
+         hdd_status = sme_QosInternalReleaseReq(pcmd->cmdInfo.pMac, 
+                                                pcmd->cmdInfo.u.releaseCmdInfo.QosFlowID,
+                                                VOS_TRUE);
+         if(SME_QOS_STATUS_RELEASE_FAILURE_RSP == hdd_status)
+         {
+            //Err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosInternalReleaseReq failed on session %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId);
+            halStatus = eHAL_STATUS_FAILURE;
+         }
+         break;
+      case SME_QOS_MODIFY_REQ:
+         hdd_status = sme_QosInternalModifyReq(pcmd->cmdInfo.pMac, 
+                                               &pcmd->cmdInfo.u.modifyCmdInfo.QoSInfo,
+                                               pcmd->cmdInfo.u.modifyCmdInfo.QosFlowID,
+                                               VOS_TRUE);
+         if(SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP == hdd_status)
+         {
+            //Err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosInternalModifyReq failed on session %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId);
+            halStatus = eHAL_STATUS_FAILURE;
+         }
+         break;
+      case SME_QOS_RESEND_REQ:
+         hdd_status = sme_QosReRequestAddTS(pcmd->cmdInfo.pMac, 
+                                            pcmd->cmdInfo.sessionId,
+                                            &pcmd->cmdInfo.u.resendCmdInfo.QoSInfo,
+                                            pcmd->cmdInfo.u.resendCmdInfo.ac,
+                                            pcmd->cmdInfo.u.resendCmdInfo.tspecMask);
+         if(SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP == hdd_status)
+         {
+            //Err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: sme_QosReRequestAddTS failed on session %d",
+                      __FUNCTION__, __LINE__,
+                      sessionId);
+            halStatus = eHAL_STATUS_FAILURE;
+         }
+         break;
+      default:
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: On session %d unknown cmd = %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, pcmd->cmdInfo.command);
+         //ASSERT
+         VOS_ASSERT(0);
+         break;
+      }
+      // buffered command has been processed, reclaim the memory
+      vos_mem_free(pcmd);
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: cmd buffer empty",
+                __FUNCTION__, __LINE__);
+      pSession->readyForPowerSave = VOS_TRUE;
+   }
+   return halStatus;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosDeleteBufferedRequests() - Utility function to Delete the buffered
+  requests in the buffered_cmd_list, if we lost connectivity.
+
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_QosDeleteBufferedRequests(tpAniSirGlobal pMac,
+                                                v_U8_t sessionId)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosCmdInfoEntry *pcmd = NULL;
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Invoked on session %d",
+             __FUNCTION__, __LINE__, sessionId);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pEntry = csrLLPeekHead( &pSession->bufferedCommandList, VOS_TRUE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Buffered List empty, nothing to delete on session %d",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &pSession->bufferedCommandList, pEntry, VOS_TRUE );
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: deleting entry from buffered List",
+                __FUNCTION__, __LINE__);
+      //delete the entry from Flow List
+      csrLLRemoveEntry(&pSession->bufferedCommandList, pEntry, VOS_TRUE );
+      // reclaim the memory
+      pcmd = GET_BASE_ADDR( pEntry, sme_QosCmdInfoEntry, link );
+      vos_mem_free(pcmd);
+      pEntry = pNextEntry;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosSaveAssocInfo() - Utility function to save the assoc info in the
+  CB like BSS descritor of the AP, the profile that HDD sent down with the 
+  connect request, while CSR notifies for assoc/reassoc success.
+  \param pAssoc_info - pointer to the assoc structure to store the BSS descritor 
+                       of the AP, the profile that HDD sent down with the 
+                       connect request
+                       
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosSaveAssocInfo(sme_QosSessionInfo *pSession, sme_QosAssocInfo *pAssoc_info)
+{
+   tSirBssDescription    *pBssDesc = NULL;
+   v_U32_t                bssLen = 0;
+   if(NULL == pAssoc_info)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: pAssoc_info is NULL",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   //clean up the assoc info if already set
+   if(pSession->assocInfo.pBssDesc)
+   {
+      vos_mem_free(pSession->assocInfo.pBssDesc);
+      pSession->assocInfo.pBssDesc = NULL;
+   }
+   bssLen = pAssoc_info->pBssDesc->length + 
+      sizeof(pAssoc_info->pBssDesc->length);
+   //save the bss Descriptor
+   pBssDesc = (tSirBssDescription *)vos_mem_malloc(bssLen);
+   if (!pBssDesc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: couldn't allocate memory for the bss Descriptor",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   vos_mem_copy(pBssDesc, pAssoc_info->pBssDesc, bssLen);
+   pSession->assocInfo.pBssDesc = pBssDesc;
+   //save the apsd info from assoc
+   if(pAssoc_info->pProfile)
+   {
+       pSession->apsdMask |= pAssoc_info->pProfile->uapsd_mask;
+   }
+   // [TODO] Do we need to update the global APSD bitmap?
+   return eHAL_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosSetupFnp() - Utility function (pointer) to notify other entries 
+  in FLOW list on the same AC that qos params got modified
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosSetupFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_MODIFIED_IND;
+   sme_QosEdcaAcType ac;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   if(SME_QOS_REASON_REQ_SUCCESS == flow_info->reason)
+   {
+      //notify HDD, only the other Flows running on the AC 
+      flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                             &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                             hdd_status,
+                             flow_info->QosFlowID);
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Entry with flowID = %d getting notified",
+                __FUNCTION__, __LINE__,
+                flow_info->QosFlowID);
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosModificationNotifyFnp() - Utility function (pointer) to notify 
+  other entries in FLOW list on the same AC that qos params got modified
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosModificationNotifyFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_MODIFIED_IND;
+   sme_QosEdcaAcType ac;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   if(SME_QOS_REASON_REQ_SUCCESS == flow_info->reason)
+   {
+      //notify HDD, only the other Flows running on the AC 
+      flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                             &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                             hdd_status,
+                             flow_info->QosFlowID);
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Entry with flowID = %d getting notified",
+                __FUNCTION__, __LINE__,
+                flow_info->QosFlowID);
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosModifyFnp() - Utility function (pointer) to delete the origianl 
+  entry in FLOW list & add the modified one
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosModifyFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   switch(flow_info->reason)
+   {
+   case SME_QOS_REASON_MODIFY_PENDING:
+      //set the proper reason code for the new (with modified params) entry
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+      break;
+   case SME_QOS_REASON_MODIFY:
+      //delete the original entry from Flow List
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Deleting original entry at %p with flowID %d",
+                __FUNCTION__, __LINE__,
+                flow_info, flow_info->QosFlowID);
+      csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+      // reclaim the memory
+      vos_mem_free(flow_info);
+      break;
+   default:
+      break;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosDelTsIndFnp() - Utility function (pointer) to find all Flows on 
+  the perticular AC & delete them, also send HDD indication through the callback 
+  it registered per request
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosDelTsIndFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   sme_QosEdcaAcType ac;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   //delete the entry from Flow List
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                          &pACInfo->curr_QoSInfo[flow_info->tspec_mask - 1],
+                          SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
+                          flow_info->QosFlowID);
+   pACInfo->num_flows[flow_info->tspec_mask - 1]--;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "%s: %d: Deleting entry at %p with flowID %d",
+             __FUNCTION__, __LINE__,
+             flow_info, flow_info->QosFlowID);
+   csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+   // reclaim the memory
+   vos_mem_free(flow_info);
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosReassocSuccessEvFnp() - Utility function (pointer) to notify HDD 
+  the success for the requested flow & notify all the other flows running on the 
+  same AC that QoS params got modified
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosReassocSuccessEvFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   v_BOOL_t delete_entry = VOS_FALSE;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   sme_QosEdcaAcType ac;
+   eHalStatus pmc_status = eHAL_STATUS_FAILURE;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR(pEntry, sme_QosFlowInfoEntry, link);
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   switch(flow_info->reason)
+   {
+   case SME_QOS_REASON_SETUP:
+      hdd_status = SME_QOS_STATUS_SETUP_SUCCESS_IND;
+      delete_entry = VOS_FALSE;
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+      //check for the case where we had to do reassoc to reset the apsd bit
+      //for the ac - release or modify scenario
+      if(pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0].ts_info.psb)
+      {
+         // notify PMC as App is looking for APSD. If we already requested
+         // then we don't need to do anything.
+         if(!pSession->uapsdAlreadyRequested)
+         {
+            // this is the first flow to detect we need PMC in UAPSD mode
+   
+            pmc_status = pmcStartUapsd(pMac,
+                                       sme_QosPmcStartUapsdCallback,
+                                       pSession);
+            // if PMC doesn't return success right away means it is yet to put
+            // the module in BMPS state & later to UAPSD state
+         
+            if(eHAL_STATUS_FAILURE == pmc_status)
+            {
+               hdd_status = SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED;
+               //we need to always notify this case
+               flow_info->hoRenewal = VOS_FALSE;
+            }
+            else if(eHAL_STATUS_PMC_PENDING == pmc_status)
+            {
+               // let other flows know PMC has been notified
+               pSession->uapsdAlreadyRequested = VOS_TRUE;
+            }
+            // for any other pmc status we declare success
+         }
+      }
+      break;
+   case SME_QOS_REASON_RELEASE:
+      pACInfo->num_flows[SME_QOS_TSPEC_INDEX_0]--;
+      // fall through
+   case SME_QOS_REASON_MODIFY:
+      delete_entry = VOS_TRUE;
+      break;
+   case SME_QOS_REASON_MODIFY_PENDING:
+      hdd_status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND;
+      delete_entry = VOS_FALSE;
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+      if(pACInfo->requested_QoSInfo[SME_QOS_TSPEC_INDEX_0].ts_info.psb)
+      {
+   
+         if(!pSession->uapsdAlreadyRequested)
+         {
+            // this is the first flow to detect we need PMC in UAPSD mode
+            pmc_status = pmcStartUapsd(pMac,
+                                       sme_QosPmcStartUapsdCallback,
+                                       pSession);
+         
+            // if PMC doesn't return success right away means it is yet to put
+            // the module in BMPS state & later to UAPSD state
+            if(eHAL_STATUS_FAILURE == pmc_status)
+            {
+               hdd_status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED;
+               // we need to always notify this case
+               flow_info->hoRenewal = VOS_FALSE;
+            }
+            else if(eHAL_STATUS_PMC_PENDING == pmc_status)
+            {
+               pSession->uapsdAlreadyRequested = VOS_TRUE;
+            }
+            // for any other pmc status we declare success
+         }
+      }
+      break;
+   case SME_QOS_REASON_REQ_SUCCESS:
+      hdd_status = SME_QOS_STATUS_SETUP_MODIFIED_IND;
+      // fall through
+   default:
+      delete_entry = VOS_FALSE;
+      break;
+   }
+   if(!delete_entry)
+   {
+      if(!flow_info->hoRenewal)
+      {
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pACInfo->curr_QoSInfo[SME_QOS_TSPEC_INDEX_0],
+                                hdd_status,
+                                flow_info->QosFlowID);
+      }
+      else
+      {
+         flow_info->hoRenewal = VOS_FALSE;
+      }
+   }
+   else
+   {
+      //delete the entry from Flow List
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Deleting entry at %p with flowID %d",
+                __FUNCTION__, __LINE__,
+                flow_info, flow_info->QosFlowID);
+      csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+      // reclaim the memory
+      vos_mem_free(flow_info);
+   }
+   
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosAddTsFailureFnp() - Utility function (pointer), 
+  if the Addts request was for for an flow setup request, delete the entry from 
+  Flow list & notify HDD 
+  if the Addts request was for downgrading of QoS params because of an flow 
+  release requested on the AC, delete the entry from Flow list & notify HDD 
+  if the Addts request was for change of QoS params because of an flow 
+  modification requested on the AC, delete the new entry from Flow list & notify 
+  HDD 
+
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosAddTsFailureFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   v_BOOL_t inform_hdd = VOS_FALSE;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   sme_QosEdcaAcType ac;
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   switch(flow_info->reason)
+   {
+   case SME_QOS_REASON_SETUP:
+      hdd_status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+      pACInfo->num_flows[pACInfo->tspec_pending - 1]--;
+      inform_hdd = VOS_TRUE;
+      break;
+   case SME_QOS_REASON_RELEASE:
+      hdd_status = SME_QOS_STATUS_RELEASE_FAILURE_RSP;
+      pACInfo->num_flows[pACInfo->tspec_pending - 1]--;
+      inform_hdd = VOS_TRUE;
+      break;
+   case SME_QOS_REASON_MODIFY_PENDING:
+      hdd_status = SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      inform_hdd = VOS_TRUE;
+      break;
+   case SME_QOS_REASON_MODIFY:
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+   case SME_QOS_REASON_REQ_SUCCESS:
+   default:
+      inform_hdd = VOS_FALSE;
+      break;
+   }
+   if(inform_hdd)
+   {
+      //notify HDD, only the requested Flow, other Flows running on the AC stay 
+      // intact
+      if(!flow_info->hoRenewal)
+      {
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1],
+                                hdd_status,
+                                flow_info->QosFlowID);
+      }
+      else
+      {
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1],
+                                SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
+                                flow_info->QosFlowID);
+      }
+      //delete the entry from Flow List
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Deleting entry at %p with flowID %d",
+                __FUNCTION__, __LINE__,
+                flow_info, flow_info->QosFlowID);
+      csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+      // reclaim the memory
+      vos_mem_free(flow_info);
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosAddTsSuccessFnp() - Utility function (pointer), 
+  if the Addts request was for for an flow setup request, notify HDD for success
+  for the flow & notify all the other flows running on the same AC that QoS 
+  params got modified
+  if the Addts request was for downgrading of QoS params because of an flow 
+  release requested on the AC, delete the entry from Flow list & notify HDD 
+  if the Addts request was for change of QoS params because of an flow 
+  modification requested on the AC, delete the old entry from Flow list & notify 
+  HDD for success for the flow & notify all the other flows running on the same 
+  AC that QoS params got modified
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param pEntry - Pointer to an entry in the flow_list(i.e. tListElem structure)
+  
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosAddTsSuccessFnp(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   v_BOOL_t inform_hdd = VOS_FALSE;
+   v_BOOL_t delete_entry = VOS_FALSE;
+   sme_QosStatusType hdd_status = SME_QOS_STATUS_SETUP_FAILURE_RSP;
+   sme_QosEdcaAcType ac;
+   eHalStatus pmc_status = eHAL_STATUS_FAILURE;
+   tCsrRoamModifyProfileFields modifyProfileFields;
+
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Entry is NULL",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+      return eHAL_STATUS_FAILURE;
+   }
+   flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+   ac = flow_info->ac_type;
+   pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   if(flow_info->tspec_mask != pACInfo->tspec_pending)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: No need to notify the HDD, the ADDTS "
+                "success is not for index = %d of the AC = %d",
+                __FUNCTION__, __LINE__,
+                flow_info->tspec_mask, ac);
+      return eHAL_STATUS_SUCCESS;
+   }
+   switch(flow_info->reason)
+   {
+   case SME_QOS_REASON_SETUP:
+      hdd_status = SME_QOS_STATUS_SETUP_SUCCESS_IND;
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+      delete_entry = VOS_FALSE;
+      inform_hdd = VOS_TRUE;
+      // check if App is looking for APSD
+      if(pACInfo->requested_QoSInfo[pACInfo->tspec_pending - 1].ts_info.psb)
+      {
+         // notify PMC as App is looking for APSD. If we already requested
+         // then we don't need to do anything
+         if(!pSession->uapsdAlreadyRequested)
+         {
+            // this is the first flow to detect we need PMC in UAPSD mode
+            pmc_status = pmcStartUapsd(pMac,
+                                       sme_QosPmcStartUapsdCallback,
+                                       pSession);
+            // if PMC doesn't return success right away means it is yet to put
+            // the module in BMPS state & later to UAPSD state
+            if(eHAL_STATUS_FAILURE == pmc_status)
+            {
+               hdd_status = SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED;
+               // we need to always notify this case
+               flow_info->hoRenewal = VOS_FALSE;
+            }
+            else if(eHAL_STATUS_PMC_PENDING == pmc_status)
+            {
+               // let other flows know PMC has been notified
+               pSession->uapsdAlreadyRequested = VOS_TRUE;
+            }
+            // for any other pmc status we declare success
+         }
+      }
+      break;
+   case SME_QOS_REASON_RELEASE:
+      pACInfo->num_flows[pACInfo->tspec_pending - 1]--;
+      hdd_status = SME_QOS_STATUS_RELEASE_SUCCESS_RSP;
+      inform_hdd = VOS_TRUE;
+      delete_entry = VOS_TRUE;
+      break;
+   case SME_QOS_REASON_MODIFY:
+      delete_entry = VOS_TRUE;
+      inform_hdd = VOS_FALSE;
+      break;
+   case SME_QOS_REASON_MODIFY_PENDING:
+      hdd_status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND;
+      delete_entry = VOS_FALSE;
+      flow_info->reason = SME_QOS_REASON_REQ_SUCCESS;
+      inform_hdd = VOS_TRUE;
+      //notify PMC if App is looking for APSD
+      if(pACInfo->requested_QoSInfo[pACInfo->tspec_pending - 1].ts_info.psb)
+      {
+         // notify PMC as App is looking for APSD. If we already requested
+         // then we don't need to do anything.
+         if(!pSession->uapsdAlreadyRequested)
+         {
+            // this is the first flow to detect we need PMC in UAPSD mode
+            pmc_status = pmcStartUapsd(pMac,
+                                       sme_QosPmcStartUapsdCallback,
+                                       pSession);
+            // if PMC doesn't return success right away means it is yet to put
+            // the module in BMPS state & later to UAPSD state
+            if(eHAL_STATUS_FAILURE == pmc_status)
+            {
+               hdd_status = SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED;
+               // we need to always notify this case
+               flow_info->hoRenewal = VOS_FALSE;
+            }
+            else if(eHAL_STATUS_PMC_PENDING == pmc_status)
+            {
+               // let other flows know PMC has been notified
+               pSession->uapsdAlreadyRequested = VOS_TRUE;
+            }
+            // for any other pmc status we declare success
+         }
+      }
+      else
+      {
+        if((pACInfo->num_flows[flow_info->tspec_mask - 1] == 1) && 
+           (SME_QOS_TSPEC_MASK_BIT_1_2_SET != pACInfo->tspec_mask_status))
+        {
+          // this is the only TSPEC active on this AC
+          // so indicate that we no longer require APSD
+          pSession->apsdMask &= ~(1 << (SME_QOS_EDCA_AC_VO - ac));
+          //Also update modifyProfileFields.uapsd_mask in CSR for consistency
+          csrGetModifyProfileFields(pMac, flow_info->sessionId, &modifyProfileFields);
+          modifyProfileFields.uapsd_mask = pSession->apsdMask; 
+          csrSetModifyProfileFields(pMac, flow_info->sessionId, &modifyProfileFields);
+          if(!pSession->apsdMask)
+          {
+             // this session no longer needs UAPSD
+             // do any sessions still require UAPSD?
+             if (!sme_QosIsUapsdActive())
+             {
+                // No sessions require UAPSD so turn it off
+                // (really don't care when PMC stops it)
+                (void)pmcStopUapsd(pMac);
+             }
+          }
+        }
+      }
+      break;
+   case SME_QOS_REASON_REQ_SUCCESS:
+      hdd_status = SME_QOS_STATUS_SETUP_MODIFIED_IND;
+      inform_hdd = VOS_TRUE;
+   default:
+      delete_entry = VOS_FALSE;
+      break;
+   }
+   if(inform_hdd)
+   {
+      if(!flow_info->hoRenewal)
+      {
+      
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1],
+                                hdd_status,
+                                flow_info->QosFlowID);
+      }
+      else
+      {
+         flow_info->hoRenewal = VOS_FALSE;
+      }
+   }
+   if(delete_entry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+                "%s: %d: Deleting entry at %p with flowID %d",
+                __FUNCTION__, __LINE__,
+                flow_info, flow_info->QosFlowID);
+      //delete the entry from Flow List
+      csrLLRemoveEntry(&sme_QosCb.flow_list, pEntry, VOS_TRUE );
+      // reclaim the memory
+      vos_mem_free(flow_info);
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosIsRspPending() - Utility function to check if we are waiting 
+  for an AddTS or reassoc response on some AC other than the given AC
+  
+  \param sessionId - Session we are interted in
+  \param ac - Enumeration of the various EDCA Access Categories.
+  
+  \return boolean
+  TRUE - Response is pending on an AC
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static v_BOOL_t sme_QosIsRspPending(v_U8_t sessionId, sme_QosEdcaAcType ac)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType acIndex;
+   v_BOOL_t status = VOS_FALSE;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   for(acIndex = SME_QOS_EDCA_AC_BE; acIndex < SME_QOS_EDCA_AC_MAX; acIndex++) 
+   {
+      if(acIndex == ac)
+      {
+         continue;
+      }
+      pACInfo = &pSession->ac_info[acIndex];
+      if((pACInfo->tspec_pending) || (pACInfo->reassoc_pending))
+      {
+         status = VOS_TRUE;
+         break;
+      }
+   }
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosIsUapsdActive() - Function which can be called to determine
+  if any sessions require PMC to be in U-APSD mode.
+  \return boolean
+  
+  Returns true if at least one session required PMC to be in U-APSD mode
+  Returns false if no sessions require PMC to be in U-APSD mode
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+static v_BOOL_t sme_QosIsUapsdActive(void)
+{
+   sme_QosSessionInfo *pSession;
+   v_U8_t sessionId;
+   for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId)
+   {
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      if ((pSession->sessionActive) && (pSession->apsdMask))
+      {
+         return VOS_TRUE;
+      }
+   }
+   // no active sessions have U-APSD active
+   return VOS_FALSE;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosPmcFullPowerCallback() - Callback function registered with PMC 
+  to notify SME-QoS when it puts the chip into full power
+  
+  \param callbackContext - The context passed to PMC during pmcRequestFullPower
+  call.
+  \param status - eHalStatus returned by PMC.
+  
+  \return None
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+void sme_QosPmcFullPowerCallback(void *callbackContext, eHalStatus status)
+{
+   sme_QosSessionInfo *pSession = callbackContext;
+   if(HAL_STATUS_SUCCESS(status))
+   {
+      (void)sme_QosProcessBufferedCmd(pSession->sessionId);
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: PMC failed to put the chip in Full power",
+                __FUNCTION__, __LINE__);
+      //ASSERT
+      VOS_ASSERT(0);
+   }
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosPmcStartUAPSDCallback() - Callback function registered with PMC 
+  to notify SME-QoS when it puts the chip into UAPSD mode
+  
+  \param callbackContext - The context passed to PMC during pmcStartUapsd call.
+  \param status - eHalStatus returned by PMC.
+  
+  \return None
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+void sme_QosPmcStartUapsdCallback(void *callbackContext, eHalStatus status)
+{
+   sme_QosSessionInfo *pSession = callbackContext;
+   // NOTE WELL
+   //
+   // In the orignal QoS design the TL module was responsible for
+   // the generation of trigger frames.  When that design was in
+   // use, we had to queue up any flows which were waiting for PMC
+   // since we didn't want to notify HDD until PMC had changed to
+   // UAPSD state.  Otherwise HDD would provide TL with the trigger
+   // frame parameters, and TL would start trigger frame generation
+   // before PMC was ready.  The flows were queued in various places
+   // throughout this module, and they were dequeued here following
+   // a successful transition to the UAPSD state by PMC.
+   //
+   // In the current QoS design the Firmware is responsible for the
+   // generation of trigger frames, but the parameters are still
+   // provided by TL via HDD.  The Firmware will be notified of the
+   // change to UAPSD state directly by PMC, at which time it will be
+   // responsible for the generation of trigger frames. Therefore
+   // where we used to queue up flows waiting for PMC to transition
+   // to the UAPSD state, we now always transition directly to the
+   // "success" state so that HDD will immediately provide the trigger
+   // frame parameters to TL, who will in turn plumb them down to the
+   // Firmware.  That way the Firmware will have the trigger frame
+   // parameters when it needs them
+   // just note that there is no longer an outstanding request
+   pSession->uapsdAlreadyRequested = VOS_FALSE;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosPmcCheckRoutine() - Function registered with PMC to check with 
+  SME-QoS whenever the device is about to enter one of the power 
+  save modes. PMC runs a poll with all the registered modules if device can 
+  enter powersave mode or remain in full power  
+  
+  \param callbackContext - The context passed to PMC during registration through
+  pmcRegisterPowerSaveCheck.
+  \return boolean
+  
+  SME-QOS returns PMC true or false respectively if it wants to vote for 
+  entering power save or not
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_BOOL_t sme_QosPmcCheckRoutine(void *callbackContext)
+{
+   sme_QosSessionInfo *pSession;
+   v_U8_t sessionId;
+   for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId)
+   {
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      if ((pSession->sessionActive) &&
+          (!pSession->readyForPowerSave))
+      {
+         return VOS_FALSE;
+      }
+   }
+   // all active sessions have voted for powersave
+   return VOS_TRUE;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosPmcDeviceStateUpdateInd() - Callback function registered with 
+  PMC to notify SME-QoS when it changes the power state
+  
+  \param callbackContext - The context passed to PMC during registration 
+  through pmcRegisterDeviceStateUpdateInd.
+  \param pmcState - Current power state that PMC moved into.
+  
+  \return None
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+void sme_QosPmcDeviceStateUpdateInd(void *callbackContext, tPmcState pmcState)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( callbackContext );
+   //check all the entries in Flow list for non-zero service interval, which will
+   //tell us if we need to notify HDD when PMC is out of UAPSD mode or going 
+   // back to UAPSD mode
+   switch(pmcState)
+   {
+   case FULL_POWER:
+      status = sme_QosProcessOutOfUapsdMode(pMac);
+      break;
+   case UAPSD:
+      status = sme_QosProcessIntoUapsdMode(pMac);
+      break;
+   default:
+      status = eHAL_STATUS_SUCCESS;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: nothing to process in PMC state %d",
+                __FUNCTION__, __LINE__,
+                pmcState);
+   }
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: ignoring Device(PMC) state change to %d",
+                __FUNCTION__, __LINE__,
+                pmcState);
+   }
+
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessOutOfUapsdMode() - Function to notify HDD when PMC 
+  notifies SME-QoS that it moved out of UAPSD mode to FULL power
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessOutOfUapsdMode(tpAniSirGlobal pMac)
+{
+   sme_QosSessionInfo *pSession;
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+   
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, can't search",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+      //only notify the flows which already successfully setup UAPSD
+      if((flow_info->QoSInfo.max_service_interval ||
+          flow_info->QoSInfo.min_service_interval) &&
+         (SME_QOS_REASON_REQ_SUCCESS == flow_info->reason))
+      {
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pSession->ac_info[flow_info->ac_type].curr_QoSInfo[flow_info->tspec_mask - 1],
+                                SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND,
+                                flow_info->QosFlowID);
+      }
+      pEntry = pNextEntry;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_QosProcessIntoUapsdMode() - Function to notify HDD when PMC 
+  notifies SME-QoS that it is moving into UAPSD mode 
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \return eHalStatus
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_QosProcessIntoUapsdMode(tpAniSirGlobal pMac)
+{
+   sme_QosSessionInfo *pSession;
+   tListElem *pEntry= NULL, *pNextEntry = NULL;
+   sme_QosFlowInfoEntry *flow_info = NULL;
+
+   pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
+   if(!pEntry)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Flow List empty, can't search",
+                __FUNCTION__, __LINE__);
+      return eHAL_STATUS_FAILURE;
+   }
+   while( pEntry )
+   {
+      pNextEntry = csrLLNext( &sme_QosCb.flow_list, pEntry, VOS_FALSE );
+      flow_info = GET_BASE_ADDR( pEntry, sme_QosFlowInfoEntry, link );
+      pSession = &sme_QosCb.sessionInfo[flow_info->sessionId];
+      //only notify the flows which already successfully setup UAPSD
+      if((flow_info->QoSInfo.max_service_interval ||
+          flow_info->QoSInfo.min_service_interval) &&
+         (SME_QOS_REASON_REQ_SUCCESS == flow_info->reason))
+      {
+         flow_info->QoSCallback(pMac, flow_info->HDDcontext, 
+                                &pSession->ac_info[flow_info->ac_type].curr_QoSInfo[flow_info->tspec_mask - 1],
+                                SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND,
+                                flow_info->QosFlowID);
+      }
+      pEntry = pNextEntry;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+
+void sme_QosCleanupCtrlBlkForHandoff(tpAniSirGlobal pMac, v_U8_t sessionId)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosEdcaAcType ac;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      pACInfo = &pSession->ac_info[ac];
+      vos_mem_zero(pACInfo->curr_QoSInfo, 
+                   sizeof(sme_QosWmmTspecInfo) * SME_QOS_TSPEC_INDEX_MAX);
+      vos_mem_zero(pACInfo->requested_QoSInfo, 
+                   sizeof(sme_QosWmmTspecInfo) * SME_QOS_TSPEC_INDEX_MAX);
+      pACInfo->num_flows[0] = 0;
+      pACInfo->num_flows[1] = 0;
+      pACInfo->reassoc_pending = VOS_FALSE;
+      pACInfo->tspec_mask_status = 0;
+      pACInfo->tspec_pending = VOS_FALSE;
+      pACInfo->hoRenewal = VOS_FALSE;
+      pACInfo->prev_state = SME_QOS_LINK_UP;
+   }
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_QosIsTSInfoAckPolicyValid() - The SME QoS API exposed to HDD to 
+  check if TS info ack policy field can be set to "HT-immediate block acknowledgement" 
+  
+  \param pMac - The handle returned by macOpen.
+  \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
+                    related info, provided by HDD
+  \param sessionId - sessionId returned by sme_OpenSession.
+  
+  \return VOS_TRUE - Current Association is HT association and so TS info ack policy
+                     can be set to "HT-immediate block acknowledgement"
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_BOOL_t sme_QosIsTSInfoAckPolicyValid(tpAniSirGlobal pMac,
+    sme_QosWmmTspecInfo * pQoSInfo,
+    v_U8_t sessionId)
+{
+  tDot11fBeaconIEs *pIes = NULL;
+  sme_QosSessionInfo *pSession;
+  eHalStatus hstatus;
+  if( !CSR_IS_SESSION_VALID( pMac, sessionId ) )
+  {
+     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s: %d: Session Id %d is invalid",
+               __FUNCTION__, __LINE__,
+               sessionId);
+     return VOS_FALSE;
+  }
+
+  pSession = &sme_QosCb.sessionInfo[sessionId];
+
+  if( !pSession->sessionActive )
+  {
+     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s: %d: Session %d is inactive",
+               __FUNCTION__, __LINE__,
+               sessionId);
+     return VOS_FALSE;
+  }
+
+  if(!pSession->assocInfo.pBssDesc)
+  {
+     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s: %d: Session %d has an Invalid BSS Descriptor",
+               __FUNCTION__, __LINE__,
+               sessionId);
+     return VOS_FALSE;
+  }
+
+  hstatus = csrGetParsedBssDescriptionIEs(pMac,
+                                          pSession->assocInfo.pBssDesc,
+                                          &pIes);
+  if(!HAL_STATUS_SUCCESS(hstatus))
+  {
+     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+               "%s: %d: On session %d unable to parse BSS IEs",
+               __FUNCTION__, __LINE__,
+               sessionId);
+     return VOS_FALSE;
+  }
+
+  /* success means pIes was allocated */
+
+  if(!pIes->HTCaps.present &&
+     pQoSInfo->ts_info.ack_policy == SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK)
+  {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: On session %d HT Caps aren't present but application set ack policy to HT ",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      
+      vos_mem_free(pIes);
+      return VOS_FALSE;
+  }
+
+  vos_mem_free(pIes);
+  return VOS_TRUE;
+}
+
+v_BOOL_t sme_QosValidateRequestedParams(tpAniSirGlobal pMac,
+    sme_QosWmmTspecInfo * pQoSInfo,
+    v_U8_t sessionId)
+{
+   v_BOOL_t rc = VOS_FALSE;
+
+   do
+   {
+      if(SME_QOS_WMM_TS_DIR_RESV == pQoSInfo->ts_info.direction) break;
+      if(!sme_QosIsTSInfoAckPolicyValid(pMac, pQoSInfo, sessionId)) break;
+
+      rc = VOS_TRUE;
+   }while(0);
+   return rc;
+}
+
+static eHalStatus qosIssueCommand( tpAniSirGlobal pMac, v_U8_t sessionId,
+                                   eSmeCommandType cmdType, sme_QosWmmTspecInfo * pQoSInfo,
+                                   sme_QosEdcaAcType ac, v_U8_t tspec_mask )
+{
+    eHalStatus status = eHAL_STATUS_RESOURCES;
+    tSmeCmd *pCommand = NULL;
+    do
+    {
+        pCommand = smeGetCommandBuffer( pMac );
+        if ( !pCommand )
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                         "%s: %d: fail to get command buffer for command %d",
+                         __FUNCTION__, __LINE__, cmdType);
+            break;
+        }
+        pCommand->command = cmdType;
+        pCommand->sessionId = sessionId;
+        switch ( cmdType )
+        {
+        case eSmeCommandAddTs:
+            if( pQoSInfo )
+            {
+                status = eHAL_STATUS_SUCCESS;
+                pCommand->u.qosCmd.tspecInfo = *pQoSInfo;
+                pCommand->u.qosCmd.ac = ac;
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                         "%s: %d: NULL pointer passed",
+                         __FUNCTION__, __LINE__);
+               status = eHAL_STATUS_INVALID_PARAMETER;
+            }
+            break;
+        case eSmeCommandDelTs:
+            status = eHAL_STATUS_SUCCESS;
+            pCommand->u.qosCmd.ac = ac;
+            pCommand->u.qosCmd.tspec_mask = tspec_mask;
+            break;
+        default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                      "%s: %d: invalid command type %d",
+                      __FUNCTION__, __LINE__, cmdType );
+            status = eHAL_STATUS_INVALID_PARAMETER;
+            break;
+        }
+    } while( 0 );
+    if( HAL_STATUS_SUCCESS( status ) && pCommand )
+    {
+        smePushCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
+    }
+    else if( pCommand )
+    {
+        qosReleaseCommand( pMac, pCommand );
+    }
+    return( status );
+}
+tANI_BOOLEAN qosProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fRemoveCmd = eANI_BOOLEAN_TRUE;
+    do
+    {
+        switch ( pCommand->command )
+        {
+        case eSmeCommandAddTs:
+            status = sme_QosAddTsReq( pMac, (v_U8_t)pCommand->sessionId, &pCommand->u.qosCmd.tspecInfo, pCommand->u.qosCmd.ac);
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                fRemoveCmd = eANI_BOOLEAN_FALSE;
+                status = SME_QOS_STATUS_SETUP_REQ_PENDING_RSP;
+            }
+            break;
+        case eSmeCommandDelTs:
+            status = sme_QosDelTsReq( pMac, (v_U8_t)pCommand->sessionId, pCommand->u.qosCmd.ac, pCommand->u.qosCmd.tspec_mask );
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                fRemoveCmd = eANI_BOOLEAN_FALSE;
+            }
+            break;
+        default:
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                      "%s: %d: invalid command type %d",
+                      __FUNCTION__, __LINE__, pCommand->command );
+            break;
+        }//switch
+    } while(0);
+    return( fRemoveCmd );
+}
+
+/*
+  sme_QosTriggerUapsdChange
+  Invoked by BTC when UAPSD bypass is enabled or disabled
+  We, in turn, must disable or enable UAPSD on all flows as appropriate
+  That may require us to re-add TSPECs or to reassociate
+*/
+sme_QosStatusType sme_QosTriggerUapsdChange( tpAniSirGlobal pMac )
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   v_U8_t ac, tspec1 = 0, tspec2 = 0; 
+   v_U8_t uapsd_mask;
+   tDot11fBeaconIEs *pIesLocal;
+   v_U8_t acm_mask;
+   v_BOOL_t fIsUapsdNeeded;
+   v_U8_t sessionId;
+   v_BOOL_t addtsWhenACMNotSet = CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(pMac);
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: %d: Invoked",
+             __FUNCTION__, __LINE__);
+   for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId)
+   {
+      pSession = &sme_QosCb.sessionInfo[sessionId];
+      if( !pSession->sessionActive )
+      {
+         continue;
+      }
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                "%s: %d: Session %d is active",
+                __FUNCTION__, __LINE__,
+                sessionId);
+      if( HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSession->assocInfo.pBssDesc, &pIesLocal)) )
+      {
+         // get the ACM mask
+         acm_mask = sme_QosGetACMMask(pMac, pSession->assocInfo.pBssDesc, pIesLocal);
+         vos_mem_free(pIesLocal);
+         // get the uapsd mask for this session
+         uapsd_mask = pSession->apsdMask;
+         // unmask the bits with ACM on to avoid reassoc on them 
+         uapsd_mask &= ~acm_mask;
+         // iterate through the ACs to determine if we need to re-add any TSPECs
+         for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++)
+         {
+            pACInfo = &pSession->ac_info[ac];
+            // Does this AC have QoS active?
+            if( SME_QOS_QOS_ON == pACInfo->curr_state )
+            {
+               // Yes, QoS is active on this AC
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                         "%s: %d: On session %d AC %d has QoS active",
+                         __FUNCTION__, __LINE__,
+                         sessionId, ac);
+               // Does this AC require ACM?
+               if(( acm_mask & (1 << (SME_QOS_EDCA_AC_VO - ac)) ) || addtsWhenACMNotSet )
+               {
+                  // Yes, so we need to re-add any TSPECS
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                            "%s: %d: On session %d AC %d has ACM enabled",
+                            __FUNCTION__, __LINE__,
+                            sessionId, ac);
+                  // Are any TSPECs active?
+                  if( pACInfo->tspec_mask_status )
+                  {
+                     // Yes, at least 1 TSPEC is active.  Are they both active?
+                     if( SME_QOS_TSPEC_MASK_BIT_1_2_SET == pACInfo->tspec_mask_status )
+                     {
+                        //both TSPECS are active
+                        tspec1 = SME_QOS_TSPEC_MASK_BIT_1_SET;
+                        tspec2 = SME_QOS_TSPEC_MASK_BIT_2_SET;
+                     }
+                     else
+                     {
+                        // only one TSPEC is active, get its mask
+                        tspec1 = SME_QOS_TSPEC_MASK_BIT_1_2_SET & pACInfo->tspec_mask_status;
+                     }
+                     // Does TSPEC 1 really require UAPSD?
+                     fIsUapsdNeeded = (v_BOOL_t)(pACInfo->curr_QoSInfo[tspec1 - 1].max_service_interval || 
+                                                 pACInfo->curr_QoSInfo[tspec1 - 1].min_service_interval);
+                     //double check whether we need to do anything
+                     if( fIsUapsdNeeded )
+                     {
+                        pACInfo->requested_QoSInfo[tspec1 - 1] = 
+                           pACInfo->curr_QoSInfo[tspec1 - 1];
+                        sme_QosReRequestAddTS( pMac, sessionId,
+                                               &pACInfo->requested_QoSInfo[tspec1 - 1],
+                                               ac,
+                                               tspec1 );
+                     }
+                     // Is TSPEC 2 active?
+                     if( tspec2 )
+                     {
+                        // Does TSPEC 2 really require UAPSD?
+                        fIsUapsdNeeded = (v_BOOL_t)(pACInfo->curr_QoSInfo[tspec2 - 1].max_service_interval || 
+                                                    pACInfo->curr_QoSInfo[tspec2 - 1].min_service_interval);
+                        if( fIsUapsdNeeded )
+                        {
+                           //No need to inform HDD
+                           //pACInfo->hoRenewal = VOS_TRUE;
+                           pACInfo->requested_QoSInfo[tspec2 - 1] = 
+                              pACInfo->curr_QoSInfo[tspec2 - 1];
+                           sme_QosReRequestAddTS( pMac, sessionId,
+                                                  &pACInfo->requested_QoSInfo[tspec2 - 1],
+                                                  ac,
+                                                  tspec2);
+                        }
+                     }
+                  }
+                  else
+                  {
+                     // QoS is set, ACM is on, but no TSPECs -- inconsistent state
+                     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                               "%s: %d: On session %d AC %d has QoS enabled and ACM is set, but no TSPEC",
+                               __FUNCTION__, __LINE__,
+                               sessionId, ac);
+                     VOS_ASSERT(0);
+                  }
+               }
+               else
+               {
+                  //Since ACM bit is not set, there should be only one QoS information for both directions.
+                  fIsUapsdNeeded = (v_BOOL_t)(pACInfo->curr_QoSInfo[0].max_service_interval || 
+                                              pACInfo->curr_QoSInfo[0].min_service_interval);
+                  if(fIsUapsdNeeded)
+                  {
+                     // we need UAPSD on this AC (and we may not currently have it)
+                     uapsd_mask |= 1 << (SME_QOS_EDCA_AC_VO - ac);
+                     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                               "%s: %d: On session %d AC %d has ACM disabled, uapsd mask now 0x%X",
+                               __FUNCTION__, __LINE__,
+                               sessionId, ac, uapsd_mask);
+                  }
+               }
+            }
+         }
+         // do we need to reassociate?
+         if(uapsd_mask)
+         {
+            tCsrRoamModifyProfileFields modifyProfileFields;
+            //we need to do a reassoc on these AC 
+            csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields);
+            if( btcIsReadyForUapsd(pMac) )
+            {
+               modifyProfileFields.uapsd_mask = uapsd_mask;
+            }
+            else
+            {  
+               modifyProfileFields.uapsd_mask = 0;
+            }
+            //Do we need to inform HDD?
+            if(!HAL_STATUS_SUCCESS(sme_QosRequestReassoc(pMac, sessionId, &modifyProfileFields, VOS_TRUE)))
+            {
+               //err msg
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                         "%s: %d: On Session %d Reassoc failed",
+                         __FUNCTION__, __LINE__,
+                         sessionId);
+            }
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                   "%s: %d: On Session %d failed to parse IEs",
+                   __FUNCTION__, __LINE__,
+                   sessionId);
+      }
+   }
+   // return status is ignored by BTC
+   return SME_QOS_STATUS_SETUP_SUCCESS_IND;
+}
+
+/*
+    sme_QosReRequestAddTS to re-send AddTS for the combined QoS request
+*/
+static sme_QosStatusType sme_QosReRequestAddTS(tpAniSirGlobal pMac,
+                                               v_U8_t sessionId,
+                                               sme_QosWmmTspecInfo * pQoSInfo,
+                                               sme_QosEdcaAcType ac,
+                                               v_U8_t tspecMask)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   sme_QosStatusType status = SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+   sme_QosCmdInfo  cmd;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: %d: Invoked on session %d for AC %d TSPEC %d",
+             __FUNCTION__, __LINE__,
+             sessionId, ac, tspecMask);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   pACInfo = &pSession->ac_info[ac];
+   // need to vote off powersave for the duration of this request
+   pSession->readyForPowerSave = VOS_FALSE;
+   //call PMC's request for power function
+   // AND
+   //another check is added considering the flowing scenario
+   //Addts reqest is pending on one AC, while APSD requested on another which 
+   //needs a reassoc. Will buffer a request if Addts is pending on any AC, 
+   //which will safegaurd the above scenario, & also won't confuse PE with back 
+   //to back Addts or Addts followed by Reassoc
+   if(sme_QosIsRspPending(sessionId, ac) || 
+      ( eHAL_STATUS_PMC_PENDING == pmcRequestFullPower(pMac, sme_QosPmcFullPowerCallback, pSession, eSME_REASON_OTHER)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                "%s: %d: On session %d buffering the AddTS request "
+                   "for AC %d in state %d as Addts is pending "
+                "on other AC or waiting for full power",
+                __FUNCTION__, __LINE__,
+                sessionId, ac, pACInfo->curr_state);
+      //buffer cmd
+      cmd.command = SME_QOS_RESEND_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.resendCmdInfo.ac = ac;
+      cmd.u.resendCmdInfo.tspecMask = tspecMask;
+      cmd.u.resendCmdInfo.QoSInfo = *pQoSInfo;
+      if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_FALSE)))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                   "%s: %d: On session %d unable to buffer the AddTS "
+                   "request for AC %d TSPEC %d in state %d",
+                   __FUNCTION__, __LINE__,
+                   sessionId, ac, tspecMask, pACInfo->curr_state);
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      }
+      return SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+   }
+   //get into the stat m/c to see if the request can be granted
+   switch(pACInfo->curr_state)
+   {
+   case SME_QOS_QOS_ON:
+      {
+         //if ACM, send out a new ADDTS
+         pACInfo->hoRenewal = VOS_TRUE;
+         status = sme_QosSetup(pMac, sessionId, pQoSInfo, ac);
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "%s: %d: sme_QosSetup returned in SME_QOS_QOS_ON state on "
+                   "AC %d with status =%d",
+                   __FUNCTION__, __LINE__,
+                   ac, status);
+         if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP != status)
+         {
+            // we aren't waiting for a response from the AP
+            // so vote powersave back on
+            pSession->readyForPowerSave = VOS_TRUE;
+         }
+         if(SME_QOS_STATUS_SETUP_REQ_PENDING_RSP == status) 
+         {
+            status = SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+            pACInfo->tspec_pending = tspecMask;
+         }
+         else if((SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+                 (SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY == status) ||
+                 (SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING == status))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: UAPSD is setup already status = %d "
+                      "returned by sme_QosSetup",
+                      __FUNCTION__, __LINE__,
+                      status);  
+         }
+         else
+         {
+            //err msg
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                      "%s: %d: unexpected status = %d returned by sme_QosSetup",
+                      __FUNCTION__, __LINE__,
+                      status);
+         }
+      }
+      break;
+   case SME_QOS_HANDOFF:
+   case SME_QOS_REQUESTED:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: Re-Add request in state = %d  buffer the request",
+                __FUNCTION__, __LINE__,
+                pACInfo->curr_state);
+      cmd.command = SME_QOS_RESEND_REQ;
+      cmd.pMac = pMac;
+      cmd.sessionId = sessionId;
+      cmd.u.resendCmdInfo.ac = ac;
+      cmd.u.resendCmdInfo.tspecMask = tspecMask;
+      cmd.u.resendCmdInfo.QoSInfo = *pQoSInfo;
+      if(!HAL_STATUS_SUCCESS(sme_QosBufferCmd(&cmd, VOS_FALSE)))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "%s: %d: couldn't buffer the readd request in state = %d",
+                   __FUNCTION__, __LINE__,
+                   pACInfo->curr_state );
+         // unable to buffer the request
+         // nothing is pending so vote powersave back on
+         pSession->readyForPowerSave = VOS_TRUE;
+         return SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP;
+      }
+      status = SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP;
+      break;
+   case SME_QOS_CLOSED:
+   case SME_QOS_INIT:
+   case SME_QOS_LINK_UP:
+   default:
+      //print error msg, 
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                "%s: %d: ReAdd request in unexpected state = %d",
+                __FUNCTION__, __LINE__,
+                pACInfo->curr_state );
+      // unable to service the request
+      // nothing is pending so vote powersave back on
+      pSession->readyForPowerSave = VOS_TRUE;
+      // ASSERT?
+      break;
+   }
+   if((SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP == status) ||
+      (SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY == status)) 
+   {
+      (void)sme_QosProcessBufferedCmd(sessionId);
+   }
+   return (status);
+}
+
+static void sme_QosInitACs(tpAniSirGlobal pMac, v_U8_t sessionId)
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosEdcaAcType ac;
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+   {
+      vos_mem_zero(&pSession->ac_info[ac], sizeof(sme_QosACInfo));
+      sme_QosStateTransition(sessionId, ac, SME_QOS_INIT);
+   }
+}
+static eHalStatus sme_QosRequestReassoc(tpAniSirGlobal pMac, tANI_U8 sessionId,
+                                        tCsrRoamModifyProfileFields *pModFields,
+                                        v_BOOL_t fForce )
+{
+   sme_QosSessionInfo *pSession;
+   sme_QosACInfo *pACInfo;
+   eHalStatus status;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: %d: Invoked on session %d with UAPSD mask 0x%X",
+             __FUNCTION__, __LINE__,
+             sessionId, pModFields->uapsd_mask);
+   pSession = &sme_QosCb.sessionInfo[sessionId];
+   status = csrReassoc(pMac, sessionId, pModFields, &pSession->roamID, fForce);
+   if(HAL_STATUS_SUCCESS(status))
+   {
+      //Update the state to Handoff so subsequent requests are queued until
+      // this one is finished
+      sme_QosEdcaAcType ac;
+      for(ac = SME_QOS_EDCA_AC_BE; ac < SME_QOS_EDCA_AC_MAX; ac++) 
+      {
+         pACInfo = &pSession->ac_info[ac];
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                   "%s: %d: AC[%d] is in state [%d]",
+                   __FUNCTION__, __LINE__,
+                   ac, pACInfo->curr_state );
+         // If it is already in HANDOFF state, don't do anything since we
+         // MUST preserve the previous state and sme_QosStateTransition
+         // will change the previous state
+         if(SME_QOS_HANDOFF != pACInfo->curr_state)
+         {
+            sme_QosStateTransition(sessionId, ac, SME_QOS_HANDOFF);
+         }
+      }
+   }
+   return status;
+}
+static v_U32_t sme_QosAssignFlowId(void)
+{
+   v_U32_t flowId;
+   flowId = sme_QosCb.nextFlowId;
+   if (SME_QOS_MAX_FLOW_ID == flowId)
+   {
+      // The Flow ID wrapped.  This is obviously not a real life scenario
+      // but handle it to keep the software test folks happy
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+                "%s: %d: Software Test made the flow counter wrap, "
+                "QoS may no longer be functional",
+                __FUNCTION__, __LINE__);
+      sme_QosCb.nextFlowId = SME_QOS_MIN_FLOW_ID;
+   }
+   else
+   {
+      sme_QosCb.nextFlowId++;
+   }
+   return flowId;
+}
+
+static v_U8_t sme_QosAssignDialogToken(void)
+{
+   v_U8_t token;
+   token = sme_QosCb.nextDialogToken;
+   if (SME_QOS_MAX_DIALOG_TOKEN == token)
+   {
+      // wrap is ok
+      sme_QosCb.nextDialogToken = SME_QOS_MIN_DIALOG_TOKEN;
+   }
+   else
+   {
+      sme_QosCb.nextDialogToken++;
+   }
+   return token;
+}
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT */
diff --git a/CORE/SME/src/btc/btcApi.c b/CORE/SME/src/btc/btcApi.c
new file mode 100644
index 0000000..36d1fbe
--- /dev/null
+++ b/CORE/SME/src/btc/btcApi.c
@@ -0,0 +1,1941 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  btcApi.c
+*
+* Description: Routines that make up the BTC API.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+#include "wlan_qct_wda.h"
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+#include "aniGlobal.h"
+#include "smsDebug.h"
+#include "btcApi.h"
+#include "cfgApi.h"
+#include "pmc.h"
+#include "smeQosInternal.h"
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+static void btcLogEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent);
+static void btcRestoreHeartBeatMonitoringHandle(void* hHal);
+static void btcUapsdCheck( tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent );
+VOS_STATUS btcCheckHeartBeatMonitoring(tHalHandle hHal, tpSmeBtEvent pBtEvent);
+static void btcPowerStateCB( v_PVOID_t pContext, tPmcState pmcState );
+static VOS_STATUS btcDeferEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent );
+static VOS_STATUS btcDeferDisconnEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent );
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+static void btcDiagEventLog (tHalHandle hHal, tpSmeBtEvent pBtEvent);
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+/* ---------------------------------------------------------------------------
+    \fn btcOpen
+    \brief  API to init the BTC Events Layer
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  success
+            VOS_STATUS_SUCCESS  failure
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcOpen (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   VOS_STATUS vosStatus;
+   /* Initialize BTC configuartion. */
+   pMac->btc.btcConfig.btcExecutionMode = BTC_SMART_COEXISTENCE;
+   pMac->btc.btcConfig.btcConsBtSlotsToBlockDuringDhcp = 0;
+   pMac->btc.btcConfig.btcA2DPBtSubIntervalsDuringDhcp = BTC_MAX_NUM_ACL_BT_SUB_INTS;
+   pMac->btc.btcConfig.btcBtIntervalMode1 = BTC_BT_INTERVAL_MODE1_DEFAULT;
+   pMac->btc.btcConfig.btcWlanIntervalMode1 = BTC_WLAN_INTERVAL_MODE1_DEFAULT;
+   pMac->btc.btcConfig.btcActionOnPmFail = BTC_START_NEXT;
+   pMac->btc.btcReady = VOS_FALSE;
+   pMac->btc.btcEventState = 0;
+   pMac->btc.btcHBActive = VOS_TRUE;
+
+   vosStatus = vos_timer_init( &pMac->btc.restoreHBTimer,
+                      VOS_TIMER_TYPE_SW,
+                      btcRestoreHeartBeatMonitoringHandle,
+                      (void*) hHal);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcOpen: Fail to init timer");
+       return VOS_STATUS_E_FAILURE;
+   }
+   if( !HAL_STATUS_SUCCESS(pmcRegisterDeviceStateUpdateInd( pMac, btcPowerStateCB, pMac )) )
+   {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcOpen: Fail to register PMC callback\n");
+       return VOS_STATUS_E_FAILURE;
+   }
+   return VOS_STATUS_SUCCESS;
+}
+/* ---------------------------------------------------------------------------
+    \fn btcClose
+    \brief  API to exit the BTC Events Layer
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  success
+            VOS_STATUS_SUCCESS  failure
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcClose (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   VOS_STATUS vosStatus;
+   pMac->btc.btcReady = VOS_FALSE;
+   pMac->btc.btcUapsdOk = VOS_FALSE;
+   vos_timer_stop(&pMac->btc.restoreHBTimer);
+   vosStatus = vos_timer_destroy(&pMac->btc.restoreHBTimer);
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcClose: Fail to destroy timer");
+       return VOS_STATUS_E_FAILURE;
+   }
+   if(!HAL_STATUS_SUCCESS(
+      pmcDeregisterDeviceStateUpdateInd(pMac, btcPowerStateCB)))
+   {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+         "%s: %d: cannot deregister with pmcDeregisterDeviceStateUpdateInd()",
+                __FUNCTION__, __LINE__);
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn btcReady
+    \brief  fn to inform BTC that eWNI_SME_SYS_READY_IND has been sent to PE.
+            This acts as a trigger to send a message to HAL to update the BTC
+            related conig to FW. Note that if HDD configures any power BTC
+            related stuff before this API is invoked, BTC will buffer all the
+            configutaion.
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcReady (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    v_U32_t cfgVal = 0;
+    v_U8_t i;
+    pMac->btc.btcReady = VOS_TRUE;
+    pMac->btc.btcUapsdOk = VOS_TRUE;
+    for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+    {
+        pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE;
+    }
+
+    // Read heartbeat threshold CFG and save it.
+    ccmCfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &cfgVal);
+    pMac->btc.btcHBCount = (v_U8_t)cfgVal;
+    if (btcSendCfgMsg(hHal, &(pMac->btc.btcConfig)) != VOS_STATUS_SUCCESS)
+    {
+        return VOS_STATUS_E_FAILURE;
+    }
+    return VOS_STATUS_SUCCESS;
+}
+
+static VOS_STATUS btcSendBTEvent(tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent)
+{
+   vos_msg_t msg;
+   tpSmeBtEvent ptrSmeBtEvent = NULL;
+   switch(pBtEvent->btEventType)
+   {
+      case BT_EVENT_CREATE_SYNC_CONNECTION:
+      case BT_EVENT_SYNC_CONNECTION_UPDATED:
+         if(pBtEvent->uEventParam.btSyncConnection.linkType != BT_SCO &&
+            pBtEvent->uEventParam.btSyncConnection.linkType != BT_eSCO)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+               "Invalid link type %d for Sync Connection. BT event will be dropped ",
+               __FUNCTION__, pBtEvent->uEventParam.btSyncConnection.linkType);
+            return VOS_STATUS_E_FAILURE;
+         }
+         break;
+      case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+         if((pBtEvent->uEventParam.btSyncConnection.status == BT_CONN_STATUS_SUCCESS) &&
+            ((pBtEvent->uEventParam.btSyncConnection.linkType != BT_SCO && pBtEvent->uEventParam.btSyncConnection.linkType != BT_eSCO) ||
+             (pBtEvent->uEventParam.btSyncConnection.connectionHandle == BT_INVALID_CONN_HANDLE)))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+               "Invalid connection handle %d or link type %d for Sync Connection. BT event will be dropped ",
+               __FUNCTION__,
+               pBtEvent->uEventParam.btSyncConnection.connectionHandle,
+               pBtEvent->uEventParam.btSyncConnection.linkType);
+            return VOS_STATUS_E_FAILURE;
+         }
+         break;
+      case BT_EVENT_MODE_CHANGED:
+         if(pBtEvent->uEventParam.btAclModeChange.mode >= BT_ACL_MODE_MAX)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+               "Invalid mode %d for ACL Connection. BT event will be dropped ",
+               __FUNCTION__,
+               pBtEvent->uEventParam.btAclModeChange.mode);
+            return VOS_STATUS_E_FAILURE;
+         }
+         break;
+     case BT_EVENT_DEVICE_SWITCHED_OFF:
+         pMac->btc.btcEventState = 0;
+         break;
+      default:
+         break;
+   }
+   ptrSmeBtEvent = vos_mem_malloc(sizeof(tSmeBtEvent));
+   if (NULL == ptrSmeBtEvent)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+         "Not able to allocate memory for BT event", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   btcLogEvent(pMac, pBtEvent);
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   btcDiagEventLog(pMac, pBtEvent);
+#endif
+   vos_mem_copy(ptrSmeBtEvent, pBtEvent, sizeof(tSmeBtEvent));
+   msg.type = WDA_SIGNAL_BT_EVENT;
+   msg.reserved = 0;
+   msg.bodyptr = ptrSmeBtEvent;
+   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+         "Not able to post WDA_SIGNAL_BT_EVENT message to WDA", __FUNCTION__);
+      vos_mem_free( ptrSmeBtEvent );
+      return VOS_STATUS_E_FAILURE;
+   }
+   // After successfully posting the message, check if heart beat
+   // monitoring needs to be turned off
+   (void)btcCheckHeartBeatMonitoring(pMac, pBtEvent);
+   //Check whether BTC and UAPSD can co-exist
+   btcUapsdCheck( pMac, pBtEvent );
+   return VOS_STATUS_SUCCESS;
+   }
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+/* ---------------------------------------------------------------------------
+    \fn btcSignalBTEvent
+    \brief  API to signal Bluetooth (BT) event to the WLAN driver. Based on the
+            BT event type and the current operating mode of Libra (full power,
+            BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
+            would be employed.
+    \param  hHal - The handle returned by macOpen.
+    \param  pBtEvent -  Pointer to a caller allocated object of type tSmeBtEvent.
+                        Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE – BT Event not passed to HAL. This can happen
+                                   if driver has not yet been initialized or if BTC
+                                   Events Layer has been disabled.
+            VOS_STATUS_SUCCESS   – BT Event passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcSignalBTEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   VOS_STATUS vosStatus;
+   if( NULL == pBtEvent )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+         "Null pointer for SME BT Event", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   if(( BTC_WLAN_ONLY == pMac->btc.btcConfig.btcExecutionMode ) ||
+      ( BTC_PTA_ONLY == pMac->btc.btcConfig.btcExecutionMode ))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+         "BTC execution mode not set to BTC_SMART_COEXISTENCE. BT event will be dropped", __FUNCTION__);
+      return VOS_STATUS_E_FAILURE;
+   }
+   if( pBtEvent->btEventType < 0 || pBtEvent->btEventType >= BT_EVENT_TYPE_MAX )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+         "Invalid BT event %d being passed. BT event will be dropped",
+          __FUNCTION__, pBtEvent->btEventType);
+      return VOS_STATUS_E_FAILURE;
+   }
+   //Check PMC state to make sure whether we need to defer
+   //If we already have deferred events, defer the new one as well, in case PMC is in transition state
+   if( pMac->btc.fReplayBTEvents || !PMC_IS_CHIP_ACCESSIBLE(pmcGetPmcState( pMac )) )
+   {
+       //We need to defer the event
+       vosStatus = btcDeferEvent(pMac, pBtEvent);
+       if( VOS_IS_STATUS_SUCCESS(vosStatus) )
+       {
+           pMac->btc.fReplayBTEvents = VOS_TRUE;
+           return VOS_STATUS_SUCCESS;
+       }
+       else
+       {
+           return vosStatus;
+       }
+   }
+    btcSendBTEvent(pMac, pBtEvent);
+   return VOS_STATUS_SUCCESS;
+}
+#endif
+/* ---------------------------------------------------------------------------
+    \fn btcCheckHeartBeatMonitoring
+    \brief  API to check whether heartbeat monitoring is required to be disabled
+            for specific BT start events which takes significant time to complete
+            during which WLAN misses beacons. To avoid WLAN-MAC from disconnecting
+            for the not enough beacons received we stop the heartbeat timer during
+            this start BT event till the stop of that BT event.
+    \param  hHal - The handle returned by macOpen.
+    \param  pBtEvent -  Pointer to a caller allocated object of type tSmeBtEvent.
+                        Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  Config not passed to HAL.
+            VOS_STATUS_SUCCESS  Config passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcCheckHeartBeatMonitoring(tHalHandle hHal, tpSmeBtEvent pBtEvent)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   VOS_STATUS vosStatus;
+   switch(pBtEvent->btEventType)
+   {
+      // Start events which requires heartbeat monitoring be disabled.
+      case BT_EVENT_INQUIRY_STARTED:
+          pMac->btc.btcEventState |= BT_INQUIRY_STARTED;
+          break;
+      case BT_EVENT_PAGE_STARTED:
+          pMac->btc.btcEventState |= BT_PAGE_STARTED;
+          break;
+      case BT_EVENT_CREATE_ACL_CONNECTION:
+          pMac->btc.btcEventState |= BT_CREATE_ACL_CONNECTION_STARTED;
+          break;
+      case BT_EVENT_CREATE_SYNC_CONNECTION:
+          pMac->btc.btcEventState |= BT_CREATE_SYNC_CONNECTION_STARTED;
+          break;
+      // Stop/done events which indicates heartbeat monitoring can be enabled
+      case BT_EVENT_INQUIRY_STOPPED:
+          pMac->btc.btcEventState &= ~(BT_INQUIRY_STARTED);
+          break;
+      case BT_EVENT_PAGE_STOPPED:
+          pMac->btc.btcEventState &= ~(BT_PAGE_STARTED);
+          break;
+      case BT_EVENT_ACL_CONNECTION_COMPLETE:
+          pMac->btc.btcEventState &= ~(BT_CREATE_ACL_CONNECTION_STARTED);
+          break;
+      case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+          pMac->btc.btcEventState &= ~(BT_CREATE_SYNC_CONNECTION_STARTED);
+          break;
+      default:
+          // Ignore other events
+          return VOS_STATUS_SUCCESS;
+   }
+   // Check if any of the BT start events are active
+   if (pMac->btc.btcEventState) {
+       if (pMac->btc.btcHBActive) {
+           // set heartbeat threshold CFG to zero
+           ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE);
+           pMac->btc.btcHBActive = VOS_FALSE;
+       }
+       // Deactivate and active the restore HB timer
+       vos_timer_stop( &pMac->btc.restoreHBTimer);
+       vosStatus= vos_timer_start( &pMac->btc.restoreHBTimer, BT_MAX_EVENT_DONE_TIMEOUT );
+       if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcCheckHeartBeatMonitoring: Fail to start timer");
+           return VOS_STATUS_E_FAILURE;
+       }
+   } else {
+       // Restore CFG back to the original value only if it was disabled
+       if (!pMac->btc.btcHBActive) {
+           ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE);
+           pMac->btc.btcHBActive = VOS_TRUE;
+       }
+       // Deactivate the timer
+       vosStatus = vos_timer_stop( &pMac->btc.restoreHBTimer);
+       if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcCheckHeartBeatMonitoring: Fail to stop timer");
+           return VOS_STATUS_E_FAILURE;
+       }
+   }
+   return VOS_STATUS_SUCCESS;
+}
+/* ---------------------------------------------------------------------------
+    \fn btcRestoreHeartBeatMonitoringHandle
+    \brief  Timer handler to handlet the timeout condition when a specific BT
+            stop event does not come back, in which case to restore back the
+            heartbeat timer.
+    \param  hHal - The handle returned by macOpen.
+    \return VOID
+  ---------------------------------------------------------------------------*/
+void btcRestoreHeartBeatMonitoringHandle(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    if( !pMac->btc.btcHBActive )
+    {
+        tPmcState pmcState;
+        //Check PMC state to make sure whether we need to defer
+        pmcState = pmcGetPmcState( pMac );
+        if( PMC_IS_CHIP_ACCESSIBLE(pmcState) )
+        {
+            // Restore CFG back to the original value
+            ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE);
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BT event timeout, restoring back HeartBeat timer");
+        }
+        else
+        {
+            //defer it
+            pMac->btc.btcEventReplay.fRestoreHBMonitor = VOS_TRUE;
+        }
+    }
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn btcSetConfig
+    \brief  API to change the current Bluetooth Coexistence (BTC) configuration
+            This function should be invoked only after CFG download has completed.
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtcConfig. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  Config not passed to HAL.
+            VOS_STATUS_SUCCESS  Config passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   //Save a copy in the global BTC config
+   vos_mem_copy(&(pMac->btc.btcConfig), pSmeBtcConfig, sizeof(tSmeBtcConfig));
+   //Send the config down only if SME_HddReady has been invoked. If not ready,
+   //BTC config will plumbed down when btcReady is eventually invoked.
+   if(pMac->btc.btcReady)
+   {
+      if(VOS_STATUS_SUCCESS != btcSendCfgMsg(hHal, pSmeBtcConfig))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+            "Failure to send BTC config down");
+         return VOS_STATUS_E_FAILURE;
+      }
+   }
+   return VOS_STATUS_SUCCESS;
+}
+/* ---------------------------------------------------------------------------
+    \fn btcPostBtcCfgMsg
+    \brief  Private API to post BTC config message to HAL
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtcConfig. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  Config not passed to HAL.
+            VOS_STATUS_SUCCESS  Config passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcSendCfgMsg(tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
+{
+   tpSmeBtcConfig ptrSmeBtcConfig = NULL;
+   vos_msg_t msg;
+   if( NULL == pSmeBtcConfig )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: "
+         "Null pointer for BTC Config");
+      return VOS_STATUS_E_FAILURE;
+   }
+   if( pSmeBtcConfig->btcExecutionMode >= BT_EXEC_MODE_MAX )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: "
+         "Invalid BT execution mode %d being set",
+          pSmeBtcConfig->btcExecutionMode);
+      return VOS_STATUS_E_FAILURE;
+   }
+   ptrSmeBtcConfig = vos_mem_malloc(sizeof(tSmeBtcConfig));
+   if (NULL == ptrSmeBtcConfig)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: "
+         "Not able to allocate memory for SME BTC Config");
+      return VOS_STATUS_E_FAILURE;
+   }
+   vos_mem_copy(ptrSmeBtcConfig, pSmeBtcConfig, sizeof(tSmeBtcConfig));
+   msg.type = WDA_BTC_SET_CFG;
+   msg.reserved = 0;
+   msg.bodyptr = ptrSmeBtcConfig;
+   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: "
+         "Not able to post WDA_BTC_SET_CFG message to WDA");
+      vos_mem_free( ptrSmeBtcConfig );
+      return VOS_STATUS_E_FAILURE;
+   }
+   return VOS_STATUS_SUCCESS;
+}
+/* ---------------------------------------------------------------------------
+    \fn btcGetConfig
+    \brief  API to retrieve the current Bluetooth Coexistence (BTC) configuration
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtcConfig. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS btcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   if( NULL == pSmeBtcConfig )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcGetConfig: "
+         "Null pointer for BTC Config");
+      return VOS_STATUS_E_FAILURE;
+   }
+   vos_mem_copy(pSmeBtcConfig, &(pMac->btc.btcConfig), sizeof(tSmeBtcConfig));
+   return VOS_STATUS_SUCCESS;
+}
+/*
+    btcFindAclEventHist find a suited ACL event buffer
+    Param: bdAddr - NULL meaning not care.
+                    pointer to caller alocated buffer containing the BD address to find a match
+           handle - BT_INVALID_CONN_HANDLE == not care
+                    otherwise, a handle to match
+    NOPTE: Either bdAddr or handle can be valid, if both of them are valid, use bdAddr only. If neither 
+           bdAddr nor handle is valid, return the next free slot.
+*/
+static tpSmeBtAclEventHist btcFindAclEventHist( tpAniSirGlobal pMac, v_U8_t *bdAddr, v_U16_t handle )
+{
+    int i, j;
+    tpSmeBtAclEventHist pRet = NULL;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    for( i = 0; (i < BT_MAX_ACL_SUPPORT) && (NULL == pRet); i++ )
+    {
+        if( NULL != bdAddr )
+        {
+            //try to match addr
+            if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx )
+            {
+                for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++)
+                {
+                    if( vos_mem_compare(pReplay->btcEventHist.btAclConnectionEvent[i].btAclConnection[j].bdAddr,
+                        bdAddr, 6) )
+                    {
+                        //found it
+                        pRet = &pReplay->btcEventHist.btAclConnectionEvent[i];
+                        break;
+                    }
+                }
+            }
+        }
+        else if( BT_INVALID_CONN_HANDLE != handle )
+        {
+            //try to match handle
+            if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx )
+            {
+                for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++)
+                {
+                    if( pReplay->btcEventHist.btAclConnectionEvent[i].btAclConnection[j].connectionHandle ==
+                        handle )
+                    {
+                        //found it
+                        pRet = &pReplay->btcEventHist.btAclConnectionEvent[i];
+                        break;
+                    }
+                }
+            }
+        }
+        else if( 0 == pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx )
+        {
+            pRet = &pReplay->btcEventHist.btAclConnectionEvent[i];
+            break;
+        }
+    }
+    return (pRet);
+}
+
+/*
+    btcFindSyncEventHist find a suited SYNC event buffer
+    Param: bdAddr - NULL meaning not care.
+                    pointer to caller alocated buffer containing the BD address to find a match
+           handle - BT_INVALID_CONN_HANDLE == not care
+                    otherwise, a handle to match
+    NOPTE: Either bdAddr or handle can be valid, if both of them are valid, use bdAddr only. If neither 
+           bdAddr nor handle is valid, return the next free slot.
+*/
+static tpSmeBtSyncEventHist btcFindSyncEventHist( tpAniSirGlobal pMac, v_U8_t *bdAddr, v_U16_t handle )
+{
+    int i, j;
+    tpSmeBtSyncEventHist pRet = NULL;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    for( i = 0; (i < BT_MAX_SCO_SUPPORT) && (NULL == pRet); i++ )
+    {
+        if( NULL != bdAddr )
+        {
+            //try to match addr
+            if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx )
+            {
+                for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++)
+                {
+                    if( vos_mem_compare(pReplay->btcEventHist.btSyncConnectionEvent[i].btSyncConnection[j].bdAddr,
+                        bdAddr, 6) )
+                    {
+                        //found it
+                        pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i];
+                        break;
+                    }
+                }
+            }
+        }
+        else if( BT_INVALID_CONN_HANDLE != handle )
+        {
+            //try to match handle
+            if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx )
+            {
+                for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++)
+                {
+                    if( pReplay->btcEventHist.btSyncConnectionEvent[i].btSyncConnection[j].connectionHandle ==
+                        handle )
+                    {
+                        //found it
+                        pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i];
+                        break;
+                    }
+                }
+            }
+        }
+        else if( !pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx )
+        {
+            pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i];
+            break;
+        }
+    }
+    return (pRet);
+}
+
+/*
+    btcFindDisconnEventHist find a slot for the deferred disconnect event
+    If handle is invlid, it returns a free slot, if any. 
+    If handle is valid, it tries to find a match first in case same disconnect event comes down again.
+*/
+static tpSmeBtDisconnectEventHist btcFindDisconnEventHist( tpAniSirGlobal pMac, v_U16_t handle )
+{
+    tpSmeBtDisconnectEventHist pRet = NULL;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    int i;
+    if( BT_INVALID_CONN_HANDLE != handle )
+    {
+        for(i = 0; i < BT_MAX_DISCONN_SUPPORT; i++)
+        {
+            if( pReplay->btcEventHist.btDisconnectEvent[i].fValid &&
+                (handle == pReplay->btcEventHist.btDisconnectEvent[i].btDisconnect.connectionHandle) )
+            {
+                pRet = &pReplay->btcEventHist.btDisconnectEvent[i];
+                break;
+            }
+        }
+    }
+    if( NULL == pRet )
+    {
+        //Find a free slot
+        for(i = 0; i < BT_MAX_DISCONN_SUPPORT; i++)
+        {
+            if( !pReplay->btcEventHist.btDisconnectEvent[i].fValid )
+            {
+                pRet = &pReplay->btcEventHist.btDisconnectEvent[i];
+                break;
+            }
+        }
+    }
+    return (pRet);
+}
+
+/*
+    btcFindModeChangeEventHist find a slot for the deferred mopde change event
+    If handle is invalid, it returns a free slot, if any. 
+    If handle is valid, it tries to find a match first in case same disconnect event comes down again.
+*/
+tpSmeBtAclModeChangeEventHist btcFindModeChangeEventHist( tpAniSirGlobal pMac, v_U16_t handle )
+{
+    tpSmeBtAclModeChangeEventHist pRet = NULL;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    int i;
+    if( BT_INVALID_CONN_HANDLE != handle )
+    {
+        for(i = 0; i < BT_MAX_ACL_SUPPORT; i++)
+        {
+            if( pReplay->btcEventHist.btAclModeChangeEvent[i].fValid &&
+                (handle == pReplay->btcEventHist.btAclModeChangeEvent[i].btAclModeChange.connectionHandle) )
+            {
+                pRet = &pReplay->btcEventHist.btAclModeChangeEvent[i];
+                break;
+            }
+        }
+    }
+    if( NULL == pRet )
+    {
+        //Find a free slot
+        for(i = 0; i < BT_MAX_ACL_SUPPORT; i++)
+        {
+            if( !pReplay->btcEventHist.btAclModeChangeEvent[i].fValid )
+            {
+                pRet = &pReplay->btcEventHist.btAclModeChangeEvent[i];
+                break;
+            }
+        }
+    }
+    return (pRet);
+}
+
+/*
+    btcFindSyncUpdateEventHist find a slot for the deferred SYNC_UPDATE event
+    If handle is invalid, it returns a free slot, if any. 
+    If handle is valid, it tries to find a match first in case same disconnect event comes down again.
+*/
+tpSmeBtSyncUpdateHist btcFindSyncUpdateEventHist( tpAniSirGlobal pMac, v_U16_t handle )
+{
+    tpSmeBtSyncUpdateHist pRet = NULL;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    int i;
+    if( BT_INVALID_CONN_HANDLE != handle )
+    {
+        for(i = 0; i < BT_MAX_SCO_SUPPORT; i++)
+        {
+            if( pReplay->btcEventHist.btSyncUpdateEvent[i].fValid &&
+                (handle == pReplay->btcEventHist.btSyncUpdateEvent[i].btSyncConnection.connectionHandle) )
+            {
+                pRet = &pReplay->btcEventHist.btSyncUpdateEvent[i];
+                break;
+            }
+        }
+    }
+    if( NULL == pRet )
+    {
+        //Find a free slot
+        for(i = 0; i < BT_MAX_SCO_SUPPORT; i++)
+        {
+            if( !pReplay->btcEventHist.btSyncUpdateEvent[i].fValid )
+            {
+                pRet = &pReplay->btcEventHist.btSyncUpdateEvent[i];
+                break;
+            }
+        }
+    }
+    return (pRet);
+}
+
+/*
+    Call must validate pAclEventHist
+*/
+static void btcReleaseAclEventHist( tpAniSirGlobal pMac, tpSmeBtAclEventHist pAclEventHist )
+{
+    vos_mem_zero( pAclEventHist, sizeof(tSmeBtAclEventHist) );
+}
+
+/*
+    Call must validate pSyncEventHist
+*/
+static void btcReleaseSyncEventHist( tpAniSirGlobal pMac, tpSmeBtSyncEventHist pSyncEventHist )
+{
+    vos_mem_zero( pSyncEventHist, sizeof(tSmeBtSyncEventHist) );
+}
+
+/*To defer a ACL creation event
+    We only support one ACL per BD address.
+    If the last cached event another ACL create event, replace that event with the new event
+    If a completion event with success status code, and the new ACL creation 
+    on same address, defer a new disconnect event(fake one), then cache this ACL creation event.
+    Otherwise, save this create event.
+*/
+static VOS_STATUS btcDeferAclCreate( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtAclEventHist pAclEventHist;
+    tSmeBtAclConnectionParam *pAclEvent;
+    do
+    {
+        //Find a match
+        pAclEventHist = btcFindAclEventHist( pMac, pEvent->uEventParam.btAclConnection.bdAddr, 
+                                    BT_INVALID_CONN_HANDLE );
+        if( NULL == pAclEventHist )
+        {
+            //No cached ACL event on this address
+            //Find a free slot and save it
+            pAclEventHist = btcFindAclEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE );
+            if( NULL != pAclEventHist )
+            {
+                vos_mem_copy(&pAclEventHist->btAclConnection[0], &pEvent->uEventParam.btAclConnection, 
+                                sizeof(tSmeBtAclConnectionParam));
+                pAclEventHist->btEventType[0] = BT_EVENT_CREATE_ACL_CONNECTION;
+                pAclEventHist->bNextEventIdx = 1;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" failed to find ACL event slot\n"));
+                status = VOS_STATUS_E_RESOURCES;
+            }
+            //done
+            break;
+        }
+        else
+        {
+            //There is history on this BD address
+            VOS_ASSERT(pAclEventHist->bNextEventIdx > 0);
+            pAclEvent = &pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx - 1];
+            if(BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[pAclEventHist->bNextEventIdx - 1])
+            {
+                //The last cached event is creation, replace it with the new one
+                vos_mem_copy(pAclEvent, 
+                                &pEvent->uEventParam.btAclConnection, 
+                                sizeof(tSmeBtAclConnectionParam));
+                //done
+                break;
+            }
+            else if(BT_EVENT_ACL_CONNECTION_COMPLETE == 
+                        pAclEventHist->btEventType[pAclEventHist->bNextEventIdx - 1])
+            {
+                //The last cached event is completion, check the status.
+                if(BT_CONN_STATUS_SUCCESS == pAclEvent->status)
+                {
+                    tSmeBtEvent btEvent;
+                    //The last event we have is success completion event. 
+                    //Should not get a creation event before creation.
+                    smsLog(pMac, LOGE, FL("  Missing disconnect event on handle %d\n"), pAclEvent->connectionHandle);
+                    //Fake a disconnect event
+                    btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE;
+                    btEvent.uEventParam.btDisconnect.connectionHandle = pAclEvent->connectionHandle;
+                    btcDeferDisconnEvent(pMac, &btEvent);
+                }
+            }
+            //Need to save the new event
+            if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED)
+            {
+                pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = BT_EVENT_CREATE_ACL_CONNECTION;
+                vos_mem_copy(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx], 
+                                &pEvent->uEventParam.btAclConnection, 
+                                sizeof(tSmeBtAclConnectionParam));
+                pAclEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" ACL event overflow\n"));
+                VOS_ASSERT(0);
+            }
+        }
+    }while(0);
+    return status;
+}
+
+/*Defer a ACL completion event
+  If there is cached event on this BD address, check completion status.
+  If status is fail and last cached event is creation, remove the creation event and drop
+  this completion event. Otherwise, cache this completion event as the latest one.
+*/
+static VOS_STATUS btcDeferAclComplete( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtAclEventHist pAclEventHist;
+    do
+    {
+        //Find a match
+        pAclEventHist = btcFindAclEventHist( pMac, pEvent->uEventParam.btAclConnection.bdAddr, 
+                                    BT_INVALID_CONN_HANDLE );
+        if(pAclEventHist)
+        {
+            VOS_ASSERT(pAclEventHist->bNextEventIdx >0);
+            //Found one
+            if(BT_CONN_STATUS_SUCCESS != pEvent->uEventParam.btAclConnection.status)
+            {
+                //If completion fails, and the last one is creation, remove the creation event
+                if(BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[pAclEventHist->bNextEventIdx-1])
+                {
+                    vos_mem_zero(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx-1], 
+                                    sizeof(tSmeBtAclConnectionParam));
+                    pAclEventHist->bNextEventIdx--;
+                    //Done with this event
+                    break;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, FL(" ACL completion fail but last event(%d) not creation\n"),
+                        pAclEventHist->btEventType[pAclEventHist->bNextEventIdx-1]);
+                }
+            }
+        }
+        if( NULL == pAclEventHist )
+        {
+            pAclEventHist = btcFindAclEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE );
+        }
+        if(pAclEventHist)
+        {
+            if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED)
+            {
+                //Save this event
+                pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = BT_EVENT_ACL_CONNECTION_COMPLETE;
+                vos_mem_copy(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx], 
+                                &pEvent->uEventParam.btAclConnection, 
+                                sizeof(tSmeBtAclConnectionParam));
+                pAclEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" ACL event overflow\n"));
+                VOS_ASSERT(0);
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" cannot find match for failed BT_EVENT_ACL_CONNECTION_COMPLETE of bdAddr (%02X-%02X-%02X-%02X-%02X-%02X)\n"),
+                pEvent->uEventParam.btAclConnection.bdAddr[0],
+                pEvent->uEventParam.btAclConnection.bdAddr[1],
+                pEvent->uEventParam.btAclConnection.bdAddr[2],
+                pEvent->uEventParam.btAclConnection.bdAddr[3],
+                pEvent->uEventParam.btAclConnection.bdAddr[4],
+                pEvent->uEventParam.btAclConnection.bdAddr[5]);
+            status = VOS_STATUS_E_EMPTY;
+        }
+    }while(0);
+    return (status);
+}
+
+/*To defer a SYNC creation event
+    If the last cached event is another SYNC create event, replace 
+    that event with the new event.
+    If there is a completion event with success status code, cache a new 
+    disconnect event(fake) first, then cache this SYNC creation event.
+    Otherwise, cache this create event.
+*/
+static VOS_STATUS btcDeferSyncCreate( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtSyncEventHist pSyncEventHist;
+    tSmeBtSyncConnectionParam *pSyncEvent;
+    do
+    {
+        //Find a match
+        pSyncEventHist = btcFindSyncEventHist( pMac, pEvent->uEventParam.btSyncConnection.bdAddr, 
+                                    BT_INVALID_CONN_HANDLE );
+        if( NULL == pSyncEventHist )
+        {
+            //No cached ACL event on this address
+            //Find a free slot and save it
+            pSyncEventHist = btcFindSyncEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE );
+            if( NULL != pSyncEventHist )
+            {
+                vos_mem_copy(&pSyncEventHist->btSyncConnection[0], &pEvent->uEventParam.btSyncConnection, 
+                                sizeof(tSmeBtSyncConnectionParam));
+                pSyncEventHist->btEventType[0] = BT_EVENT_CREATE_SYNC_CONNECTION;
+                pSyncEventHist->bNextEventIdx = 1;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" failed to find SYNC event slot\n"));
+                status = VOS_STATUS_E_RESOURCES;
+            }
+            //done
+            break;
+        }
+        else
+        {
+            //There is history on this BD address
+            VOS_ASSERT(pSyncEventHist->bNextEventIdx > 0);
+            pSyncEvent = &pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx - 1];
+            if(BT_EVENT_CREATE_SYNC_CONNECTION == 
+                pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx - 1])
+            {
+                //The last cached event is creation, replace it with the new one
+                vos_mem_copy(pSyncEvent, 
+                                &pEvent->uEventParam.btSyncConnection, 
+                                sizeof(tSmeBtSyncConnectionParam));
+                //done
+                break;
+            }
+            else if(BT_EVENT_SYNC_CONNECTION_COMPLETE == 
+                        pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx - 1])
+            {
+                //The last cached event is completion, check the status.
+                if(BT_CONN_STATUS_SUCCESS == pSyncEvent->status)
+                {
+                    tSmeBtEvent btEvent;
+                    //The last event we have is success completion event. 
+                    //Should not get a creation event before creation.
+                    smsLog(pMac, LOGE, FL("  Missing disconnect event on handle %d\n"), pSyncEvent->connectionHandle);
+                    //Fake a disconnect event
+                    btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE;
+                    btEvent.uEventParam.btDisconnect.connectionHandle = pSyncEvent->connectionHandle;
+                    btcDeferDisconnEvent(pMac, &btEvent);
+                }
+            }
+            //Need to save the new event
+            if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_SCO_DEFERRED)
+            {
+                pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = BT_EVENT_CREATE_SYNC_CONNECTION;
+                vos_mem_copy(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx], 
+                                &pEvent->uEventParam.btSyncConnection, 
+                                sizeof(tSmeBtSyncConnectionParam));
+                pSyncEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" SYNC event overflow\n"));
+            }
+        }
+    }while(0);
+    return status;
+}
+
+/*Defer a SYNC completion event
+  If there is cached event on this BD address, check completion status.
+  If status is fail and last cached event is creation, remove te creation event and drop
+  this completion event. 
+  Otherwise, cache this completion event as the latest one.
+*/
+static VOS_STATUS btcDeferSyncComplete( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtSyncEventHist pSyncEventHist;
+    do
+    {
+        //Find a match
+        pSyncEventHist = btcFindSyncEventHist( pMac, pEvent->uEventParam.btSyncConnection.bdAddr, 
+                                    BT_INVALID_CONN_HANDLE );
+        if(pSyncEventHist)
+        {
+            VOS_ASSERT(pSyncEventHist->bNextEventIdx >0);
+            //Found one
+            if(BT_CONN_STATUS_SUCCESS != pEvent->uEventParam.btSyncConnection.status)
+            {
+                //If completion fails, and the last one is creation, remove the creation event
+                if(BT_EVENT_CREATE_SYNC_CONNECTION == pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx-1])
+                {
+                    vos_mem_zero(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx-1], 
+                                    sizeof(tSmeBtSyncConnectionParam));
+                    pSyncEventHist->bNextEventIdx--;
+                    //Done with this event
+                    break;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, FL(" SYNC completion fail but last event(%d) not creation\n"),
+                        pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx-1]);
+                }
+            }
+        }
+        if(NULL == pSyncEventHist)
+        {
+            //In case we don't defer the creation event
+            pSyncEventHist = btcFindSyncEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE );
+        }
+        if(pSyncEventHist)
+        {
+            if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED)
+            {
+                //Save this event
+                pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = BT_EVENT_SYNC_CONNECTION_COMPLETE;
+                vos_mem_copy(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx], 
+                                &pEvent->uEventParam.btSyncConnection, 
+                                sizeof(tSmeBtSyncConnectionParam));
+                pSyncEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" SYNC event overflow\n"));
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_SYNC_CONNECTION_COMPLETE of bdAddr (%02X-%02X-%02X-%02X-%02X-%02X)\n"),
+                pEvent->uEventParam.btSyncConnection.bdAddr[0],
+                pEvent->uEventParam.btSyncConnection.bdAddr[1],
+                pEvent->uEventParam.btSyncConnection.bdAddr[2],
+                pEvent->uEventParam.btSyncConnection.bdAddr[3],
+                pEvent->uEventParam.btSyncConnection.bdAddr[4],
+                pEvent->uEventParam.btSyncConnection.bdAddr[5]);
+            status = VOS_STATUS_E_EMPTY;
+        }
+    }while(0);
+    return (status);
+}
+
+//return VOS_STATUS_E_EXISTS if the event handle cannot be found
+//VOS_STATUS_SUCCESS if the event is processed
+//Other error status meaning it cannot continue due to other errors
+/*
+  Defer a disconnect event for ACL
+  Check if any history on this event handle.
+  If both ACL_CREATION and ACL_COMPLETION is cached, remove both those events and drop
+  this disconnect event.
+  Otherwise save disconnect event in this ACL's bin.
+  If not ACL match on this handle, not to do anything.
+  Either way, remove any cached MODE_CHANGE event matches this disconnect event's handle.
+*/
+static VOS_STATUS btcDeferDisconnectEventForACL( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtAclEventHist pAclEventHist;
+    tpSmeBtAclModeChangeEventHist pModeChangeEventHist;
+    v_BOOL_t fDone = VOS_FALSE;
+    int i;
+    pAclEventHist = btcFindAclEventHist( pMac, NULL, 
+                                pEvent->uEventParam.btDisconnect.connectionHandle );
+    if(pAclEventHist)
+    {
+        if( pAclEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_ACL_DEFERRED)
+        {
+            smsLog(pMac, LOGE, FL(" ACL event history index:%d overflow, resetting to BT_MAX_NUM_EVENT_ACL_DEFERRED\n"), pAclEventHist->bNextEventIdx);
+            pAclEventHist->bNextEventIdx = BT_MAX_NUM_EVENT_ACL_DEFERRED;
+        }
+        //Looking backwords
+        for(i = pAclEventHist->bNextEventIdx - 1; i >= 0; i--)
+        {
+            if( BT_EVENT_ACL_CONNECTION_COMPLETE == pAclEventHist->btEventType[i] )
+            {
+                //make sure we can cancel the link
+                if( (i > 0) && (BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[i - 1]) )
+                {
+                    fDone = VOS_TRUE;
+                    if(i == 1)
+                    {
+                        //All events can be wiped off
+                        btcReleaseAclEventHist(pMac, pAclEventHist);
+                        break;
+                    }
+                    //we have both ACL creation and completion, wipe out all of them
+                    pAclEventHist->bNextEventIdx = (tANI_U8)(i - 1);
+                    vos_mem_zero(&pAclEventHist->btAclConnection[i-1], sizeof(tSmeBtAclConnectionParam));
+                    vos_mem_zero(&pAclEventHist->btAclConnection[i], sizeof(tSmeBtAclConnectionParam));
+                    break;
+                }
+            }
+        }//for loop
+        if(!fDone)
+        {
+            //Save this disconnect event
+            if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED)
+            {
+                pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = 
+                    BT_EVENT_DISCONNECTION_COMPLETE;
+                pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx].connectionHandle =
+                    pEvent->uEventParam.btDisconnect.connectionHandle;
+                pAclEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" ACL event overflow\n"));
+                status = VOS_STATUS_E_FAILURE;
+            }
+        }
+    }
+    else
+    {
+        status = VOS_STATUS_E_EXISTS;
+    }
+    //Wipe out the related mode change event if it is there
+    pModeChangeEventHist = btcFindModeChangeEventHist( pMac,  
+                            pEvent->uEventParam.btDisconnect.connectionHandle );
+    if( pModeChangeEventHist && pModeChangeEventHist->fValid )
+    {
+        pModeChangeEventHist->fValid = VOS_FALSE;
+    }
+    return status;
+}
+
+//This function works the same as btcDeferDisconnectEventForACL except it hanldes SYNC events
+//return VOS_STATUS_E_EXISTS if the event handle cannot be found
+//VOS_STATUS_SUCCESS if the event is processed
+//Other error status meaning it cannot continue due to other errors
+/*
+  Defer a disconnect event for SYNC
+  Check if any SYNC history on this event handle.
+  If yes and if both SYNC_CREATION and SYNC_COMPLETION is cached, remove both those events and drop
+  this disconnect event.
+  Otherwise save disconnect event in this SYNC's bin.
+  If no match found, not to save this event here.
+  Either way, remove any cached SYNC_UPDATE event matches this disconnect event's handle.
+*/
+static VOS_STATUS btcDeferDisconnectEventForSync( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtSyncEventHist pSyncEventHist;
+    tpSmeBtSyncUpdateHist pSyncUpdateHist;
+    v_BOOL_t fDone = VOS_FALSE;
+    int i;
+    pSyncEventHist = btcFindSyncEventHist( pMac, NULL, 
+                                pEvent->uEventParam.btDisconnect.connectionHandle );
+    if(pSyncEventHist)
+    {
+        if( pSyncEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_SCO_DEFERRED)
+        {
+            smsLog(pMac, LOGE, FL(" SYNC event history index:%d overflow, resetting to BT_MAX_NUM_EVENT_SCO_DEFERRED\n"), pSyncEventHist->bNextEventIdx);
+            pSyncEventHist->bNextEventIdx = BT_MAX_NUM_EVENT_SCO_DEFERRED;
+        }
+        //Looking backwords
+        for(i = pSyncEventHist->bNextEventIdx - 1; i >= 0; i--)
+        {
+            //if a mode change event exists, drop it
+            if( BT_EVENT_SYNC_CONNECTION_COMPLETE == pSyncEventHist->btEventType[i] )
+            {
+                //make sure we can cancel the link
+                if( (i > 0) && (BT_EVENT_CREATE_SYNC_CONNECTION == pSyncEventHist->btEventType[i - 1]) )
+                {
+                    fDone = VOS_TRUE;
+                    if(i == 1)
+                    {
+                        //All events can be wiped off
+                        btcReleaseSyncEventHist(pMac, pSyncEventHist);
+                        break;
+                    }
+                    //we have both ACL creation and completion, wipe out all of them
+                    pSyncEventHist->bNextEventIdx = (tANI_U8)(i - 1);
+                    vos_mem_zero(&pSyncEventHist->btSyncConnection[i-1], sizeof(tSmeBtSyncConnectionParam));
+                    vos_mem_zero(&pSyncEventHist->btSyncConnection[i], sizeof(tSmeBtSyncConnectionParam));
+                    break;
+                }
+            }
+        }//for loop
+        if(!fDone)
+        {
+            //Save this disconnect event
+            if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_SCO_DEFERRED)
+            {
+                pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = 
+                    BT_EVENT_DISCONNECTION_COMPLETE;
+                pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx].connectionHandle =
+                    pEvent->uEventParam.btDisconnect.connectionHandle;
+                pSyncEventHist->bNextEventIdx++;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" SYNC event overflow\n"));
+                status = VOS_STATUS_E_FAILURE;
+            }
+        }
+    }
+    else
+    {
+        status = VOS_STATUS_E_EXISTS;
+    }
+    //Wipe out the related mode change event if it is there
+    pSyncUpdateHist = btcFindSyncUpdateEventHist( pMac,  
+                            pEvent->uEventParam.btDisconnect.connectionHandle );
+    if( pSyncUpdateHist && pSyncUpdateHist->fValid )
+    {
+        pSyncUpdateHist->fValid = VOS_FALSE;
+    }
+    return status;
+}
+
+/*
+  Defer a disconnect event.
+  Try to defer it as part of the ACL event first. 
+  If no match is found, try SYNC. 
+  If still no match found, defer it at DISCONNECT event bin.
+*/
+static VOS_STATUS btcDeferDisconnEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtDisconnectEventHist pDisconnEventHist;
+    if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle )
+    {
+        smsLog( pMac, LOGE, FL(" invalid handle\n") );
+        return (VOS_STATUS_E_INVAL);
+    }
+    //Check ACL first
+    status = btcDeferDisconnectEventForACL(pMac, pEvent);
+    if(!VOS_IS_STATUS_SUCCESS(status))
+    {
+        status = btcDeferDisconnectEventForSync(pMac, pEvent);
+    }
+    if( !VOS_IS_STATUS_SUCCESS(status) )
+    {
+        //Save the disconnect event
+        pDisconnEventHist = btcFindDisconnEventHist( pMac, 
+            pEvent->uEventParam.btDisconnect.connectionHandle );
+        if( pDisconnEventHist )
+        {
+            pDisconnEventHist->fValid = VOS_TRUE;
+            vos_mem_copy( &pDisconnEventHist->btDisconnect, &pEvent->uEventParam.btDisconnect,
+                sizeof(tSmeBtDisconnectParam) );
+            status = VOS_STATUS_SUCCESS;
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_DISCONNECTION_COMPLETE of handle (%d)\n"),
+                pEvent->uEventParam.btDisconnect.connectionHandle);
+            status = VOS_STATUS_E_EMPTY;
+        }
+    }
+    return (status);
+}
+
+/*
+    btcDeferEvent save the event for possible replay when chip can be accessed
+    This function is called only when in IMPS/Standby state
+*/
+static VOS_STATUS btcDeferEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpSmeBtSyncUpdateHist pSyncUpdateHist;
+    tpSmeBtAclModeChangeEventHist pModeChangeEventHist;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    switch(pEvent->btEventType)
+    {
+    case BT_EVENT_DEVICE_SWITCHED_ON:
+        //Clear all events first
+        vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) );
+        pReplay->fBTSwitchOn = VOS_TRUE;
+        pReplay->fBTSwitchOff = VOS_FALSE;
+        break;
+    case BT_EVENT_DEVICE_SWITCHED_OFF:
+        //Clear all events first
+        vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) );
+        pReplay->fBTSwitchOff = VOS_TRUE;
+        pReplay->fBTSwitchOn = VOS_FALSE;
+        break;
+    case BT_EVENT_INQUIRY_STARTED:
+        pReplay->btcEventHist.nInquiryEvent++;
+        break;
+    case BT_EVENT_INQUIRY_STOPPED:
+        pReplay->btcEventHist.nInquiryEvent--;
+        break;
+    case BT_EVENT_PAGE_STARTED:
+        pReplay->btcEventHist.nPageEvent++;
+        break;
+    case BT_EVENT_PAGE_STOPPED:
+        pReplay->btcEventHist.nPageEvent--;
+        break;
+    case BT_EVENT_CREATE_ACL_CONNECTION:
+        status = btcDeferAclCreate(pMac, pEvent);
+        break;
+    case BT_EVENT_ACL_CONNECTION_COMPLETE:
+        status = btcDeferAclComplete( pMac, pEvent );
+        break;
+    case BT_EVENT_CREATE_SYNC_CONNECTION:
+        status = btcDeferSyncCreate(pMac, pEvent);
+        break;
+    case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+        status = btcDeferSyncComplete( pMac, pEvent );
+        break;
+    case BT_EVENT_SYNC_CONNECTION_UPDATED:
+        if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle )
+        {
+            smsLog( pMac, LOGE, FL(" invalid handle\n") );
+            status = VOS_STATUS_E_INVAL;
+            break;
+        }
+        //Find a match on handle. If not found, get a free slot.
+        pSyncUpdateHist = btcFindSyncUpdateEventHist( pMac,  
+                                    pEvent->uEventParam.btSyncConnection.connectionHandle );
+        if(pSyncUpdateHist)
+        {
+            pSyncUpdateHist->fValid = VOS_TRUE;
+            vos_mem_copy(&pSyncUpdateHist->btSyncConnection, &pEvent->uEventParam.btSyncConnection, 
+                            sizeof(tSmeBtSyncConnectionParam));
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_SYNC_CONNECTION_UPDATED of handle (%d)\n"),
+                pEvent->uEventParam.btSyncConnection.connectionHandle );
+            status = VOS_STATUS_E_EMPTY;
+        }
+        break;
+    case BT_EVENT_DISCONNECTION_COMPLETE:
+        status = btcDeferDisconnEvent( pMac, pEvent );
+        break;
+    case BT_EVENT_MODE_CHANGED:
+        if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle )
+        {
+            smsLog( pMac, LOGE, FL(" invalid handle\n") );
+            status = VOS_STATUS_E_INVAL;
+            break;
+        }
+        //Find a match on handle, If not found, return a free slot
+        pModeChangeEventHist = btcFindModeChangeEventHist( pMac,  
+                                    pEvent->uEventParam.btAclModeChange.connectionHandle );
+        if(pModeChangeEventHist)
+        {
+            pModeChangeEventHist->fValid = VOS_TRUE;
+            vos_mem_copy( &pModeChangeEventHist->btAclModeChange,
+                            &pEvent->uEventParam.btAclModeChange, sizeof(tSmeBtAclModeChangeParam) );
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_MODE_CHANGED of handle (%d)\n"),
+                pEvent->uEventParam.btAclModeChange.connectionHandle);
+            status = VOS_STATUS_E_EMPTY;
+        }
+        break;
+    case BT_EVENT_A2DP_STREAM_START:
+        pReplay->btcEventHist.fA2DPStarted = VOS_TRUE;
+        pReplay->btcEventHist.fA2DPStopped = VOS_FALSE;
+        break;
+    case BT_EVENT_A2DP_STREAM_STOP:
+        pReplay->btcEventHist.fA2DPStopped = VOS_TRUE;
+        pReplay->btcEventHist.fA2DPStarted = VOS_FALSE;
+        break;
+    default:
+        smsLog( pMac, LOGE, FL(" event (%d) is not deferred\n"), pEvent->btEventType );
+        status = VOS_STATUS_E_NOSUPPORT;
+        break;
+    }
+    return (status);
+}
+
+/*
+    Replay all cached events in the following order
+    1. If BT_SWITCH_OFF event, send it.
+    2. Send INQUIRY event (START or STOP),if available
+    3. Send PAGE event (START or STOP), if available
+    4. Send DISCONNECT events, these DISCONNECT events are not tied to 
+        any ACL/SYNC event that we have cached
+    5. Send ACL events (possible events, CREATION, COMPLETION, DISCONNECT)
+    6. Send MODE_CHANGE events, if available
+    7. Send A2DP event(START or STOP), if available
+    8. Send SYNC events (possible events, CREATION, COMPLETION, DISCONNECT)
+    9. Send SYNC_UPDATE events, if available
+*/
+static void btcReplayEvents( tpAniSirGlobal pMac )
+{
+    int i, j;
+    tSmeBtEvent btEvent;
+    tpSmeBtAclEventHist pAclHist;
+    tpSmeBtSyncEventHist pSyncHist;
+    tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay;
+    //Always turn on HB monitor first. 
+    //It is independent of BT events even though BT event causes this
+    if( pReplay->fRestoreHBMonitor )
+    {
+        pReplay->fRestoreHBMonitor = VOS_FALSE;
+        //Only do it when needed
+        if( !pMac->btc.btcHBActive ) 
+        {
+            ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE);
+            pMac->btc.btcHBActive = VOS_TRUE;
+        }
+    }
+    if( pMac->btc.fReplayBTEvents )
+    {
+        /*Set the flag to false here so btcSignalBTEvent won't defer any further.
+          This works because SME has it global lock*/
+        pMac->btc.fReplayBTEvents = VOS_FALSE;
+        if( pReplay->fBTSwitchOff )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_DEVICE_SWITCHED_OFF;
+            btcSendBTEvent( pMac, &btEvent );
+            pReplay->fBTSwitchOff = VOS_FALSE;
+        }
+        else if( pReplay->fBTSwitchOn )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_DEVICE_SWITCHED_ON;
+            btcSendBTEvent( pMac, &btEvent );
+            pReplay->fBTSwitchOn = VOS_FALSE;
+        }
+        //Do inquire first
+        if( pReplay->btcEventHist.nInquiryEvent > 0 )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_INQUIRY_STARTED;
+            i = pReplay->btcEventHist.nInquiryEvent;
+            while(i--)
+            {
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        else if( pReplay->btcEventHist.nInquiryEvent < 0 )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_INQUIRY_STOPPED;
+            i = pReplay->btcEventHist.nInquiryEvent;
+            while(i++)
+            {
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        //Page
+        if( pReplay->btcEventHist.nPageEvent > 0 )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_PAGE_STARTED;
+            i = pReplay->btcEventHist.nPageEvent;
+            while(i--)
+            {
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        else if( pReplay->btcEventHist.nPageEvent < 0 )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_PAGE_STOPPED;
+            i = pReplay->btcEventHist.nPageEvent;
+            while(i++)
+            {
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        //Replay non-completion disconnect events first
+        //Disconnect
+        for( i = 0; i < BT_MAX_DISCONN_SUPPORT; i++ )
+        {
+            if( pReplay->btcEventHist.btDisconnectEvent[i].fValid )
+            {
+                vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE;
+                vos_mem_copy( &btEvent.uEventParam.btDisconnect, 
+                    &pReplay->btcEventHist.btDisconnectEvent[i].btDisconnect, sizeof(tSmeBtDisconnectParam) );
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        //ACL
+        for( i = 0; i < BT_MAX_ACL_SUPPORT; i++ )
+        {
+            if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx )
+            {
+                pAclHist = &pReplay->btcEventHist.btAclConnectionEvent[i];
+                //Replay all ACL events for this BD address/handle
+                for(j = 0; j < pAclHist->bNextEventIdx; j++)
+                {
+                    vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                    vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                    btEvent.btEventType = pAclHist->btEventType[j];
+                    if(BT_EVENT_DISCONNECTION_COMPLETE != btEvent.btEventType)
+                    {
+                        //It must be CREATE or CONNECTION_COMPLETE
+                       vos_mem_copy( &btEvent.uEventParam.btAclConnection, 
+                                     &pAclHist->btAclConnection[j], sizeof(tSmeBtAclConnectionParam) );
+                    }
+                    else
+                    {
+                       btEvent.uEventParam.btDisconnect.connectionHandle = pAclHist->btAclConnection[j].connectionHandle;
+                    }
+                    btcSendBTEvent( pMac, &btEvent );
+                }
+            }
+        }
+        //Mode change
+        for( i = 0; i < BT_MAX_ACL_SUPPORT; i++ )
+        {
+            if( pReplay->btcEventHist.btAclModeChangeEvent[i].fValid )
+            {
+                vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                btEvent.btEventType = BT_EVENT_MODE_CHANGED;
+                vos_mem_copy( &btEvent.uEventParam.btAclModeChange, 
+                    &pReplay->btcEventHist.btAclModeChangeEvent[i].btAclModeChange, sizeof(tSmeBtAclModeChangeParam) );
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+       //A2DP
+        if( pReplay->btcEventHist.fA2DPStarted )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_A2DP_STREAM_START;
+            btcSendBTEvent( pMac, &btEvent );
+        }
+        else if( pReplay->btcEventHist.fA2DPStopped )
+        {
+            vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+            btEvent.btEventType = BT_EVENT_A2DP_STREAM_STOP;
+            btcSendBTEvent( pMac, &btEvent );
+        }
+        //SCO
+        for( i = 0; i < BT_MAX_SCO_SUPPORT; i++ )
+        {
+            if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx )
+            {
+                pSyncHist = &pReplay->btcEventHist.btSyncConnectionEvent[i];
+                //Replay all SYNC events for this BD address/handle
+                for(j = 0; j < pSyncHist->bNextEventIdx; j++)
+                {
+                    vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                    vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                    btEvent.btEventType = pSyncHist->btEventType[j];
+                    if(BT_EVENT_DISCONNECTION_COMPLETE != btEvent.btEventType)
+                    {
+                        //Must be CREATION or CONNECTION_COMPLETE
+                       vos_mem_copy( &btEvent.uEventParam.btSyncConnection, 
+                                     &pSyncHist->btSyncConnection[j], sizeof(tSmeBtSyncConnectionParam) );
+                    }
+                    else
+                    {
+                        btEvent.uEventParam.btDisconnect.connectionHandle = pSyncHist->btSyncConnection[j].connectionHandle;
+                    }
+                    btcSendBTEvent( pMac, &btEvent );
+                }
+            }
+        }
+        //SYNC update
+        for( i = 0; i < BT_MAX_SCO_SUPPORT; i++ )
+        {
+            if( pReplay->btcEventHist.btSyncUpdateEvent[i].fValid )
+            {
+                vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) );
+                btEvent.btEventType = BT_EVENT_SYNC_CONNECTION_UPDATED;
+                vos_mem_copy( &btEvent.uEventParam.btSyncConnection, 
+                            &pReplay->btcEventHist.btSyncUpdateEvent[i].btSyncConnection, 
+                            sizeof(tSmeBtSyncConnectionParam) );
+                btcSendBTEvent( pMac, &btEvent );
+            }
+        }
+        //Clear all events
+        vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) );
+    }
+}
+
+static void btcPowerStateCB( v_PVOID_t pContext, tPmcState pmcState )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(pContext);
+    if( FULL_POWER == pmcState )
+    {
+        btcReplayEvents( pMac );
+    }
+}
+
+/* ---------------------------------------------------------------------------
+    \fn btcLogEvent
+    \brief  API to log the the current Bluetooth event
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtEvent. Caller owns the memory and is responsible
+                            for freeing it.
+    \return None
+  ---------------------------------------------------------------------------*/
+static void btcLogEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
+{
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+               "Bluetooth Event %d received", __FUNCTION__, pBtEvent->btEventType);
+   switch(pBtEvent->btEventType)
+   {
+      case BT_EVENT_CREATE_SYNC_CONNECTION:
+      case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+      case BT_EVENT_SYNC_CONNECTION_UPDATED:
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "SCO Connection: "
+               "connectionHandle = %d status = %d linkType %d "
+               "scoInterval %d scoWindow %d retransmisisonWindow = %d ",
+               pBtEvent->uEventParam.btSyncConnection.connectionHandle,
+               pBtEvent->uEventParam.btSyncConnection.status,
+               pBtEvent->uEventParam.btSyncConnection.linkType,
+               pBtEvent->uEventParam.btSyncConnection.scoInterval,
+               pBtEvent->uEventParam.btSyncConnection.scoWindow,
+               pBtEvent->uEventParam.btSyncConnection.retransmisisonWindow);
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BD ADDR = "
+               "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[5],
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[4],
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[3],
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[2],
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[1],
+               pBtEvent->uEventParam.btSyncConnection.bdAddr[0]);
+          break;
+      case BT_EVENT_CREATE_ACL_CONNECTION:
+      case BT_EVENT_ACL_CONNECTION_COMPLETE:
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "ACL Connection: "
+               "connectionHandle = %d status = %d ",
+               pBtEvent->uEventParam.btAclConnection.connectionHandle,
+               pBtEvent->uEventParam.btAclConnection.status);
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BD ADDR = "
+               "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+               pBtEvent->uEventParam.btAclConnection.bdAddr[5],
+               pBtEvent->uEventParam.btAclConnection.bdAddr[4],
+               pBtEvent->uEventParam.btAclConnection.bdAddr[3],
+               pBtEvent->uEventParam.btAclConnection.bdAddr[2],
+               pBtEvent->uEventParam.btAclConnection.bdAddr[1],
+               pBtEvent->uEventParam.btAclConnection.bdAddr[0]);
+          break;
+      case BT_EVENT_MODE_CHANGED:
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "ACL Mode change : "
+               "connectionHandle %d mode %d ",
+               pBtEvent->uEventParam.btAclModeChange.connectionHandle,
+               pBtEvent->uEventParam.btAclModeChange.mode);
+          break;
+      case BT_EVENT_DISCONNECTION_COMPLETE:
+          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "Disconnect Event : "
+               "connectionHandle %d ", pBtEvent->uEventParam.btAclModeChange.connectionHandle);
+          break;
+      default:
+         break;
+   }
+ }
+
+/*
+   Caller can check whether BTC's current event allows UAPSD. This doesn't affect
+   BMPS.
+   return:  VOS_TRUE -- BTC is ready for UAPSD
+            VOS_FALSE -- certain BT event is active, cannot enter UAPSD
+*/
+v_BOOL_t btcIsReadyForUapsd( tHalHandle hHal )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    return( pMac->btc.btcUapsdOk );
+}
+
+/*
+    Base on the BT event, this function sets the flag on whether to allow UAPSD
+    At this time, we are only interested in SCO and A2DP.
+    A2DP tracking is through BT_EVENT_A2DP_STREAM_START and BT_EVENT_A2DP_STREAM_STOP
+    SCO is through BT_EVENT_SYNC_CONNECTION_COMPLETE and BT_EVENT_DISCONNECTION_COMPLETE
+    BT_EVENT_DEVICE_SWITCHED_OFF overwrites them all
+*/
+void btcUapsdCheck( tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent )
+{
+   v_U8_t i;
+   v_BOOL_t fLastUapsdState = pMac->btc.btcUapsdOk, fMoreSCO = VOS_FALSE;
+   switch( pBtEvent->btEventType )
+   {
+   case BT_EVENT_DISCONNECTION_COMPLETE:
+       if( (VOS_FALSE == pMac->btc.btcUapsdOk) && 
+           BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btDisconnect.connectionHandle )
+       {
+           //Check whether all SCO connections are gone
+           for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+           {
+               if( (BT_INVALID_CONN_HANDLE != pMac->btc.btcScoHandles[i]) &&
+                   (pMac->btc.btcScoHandles[i] != pBtEvent->uEventParam.btDisconnect.connectionHandle) )
+               {
+                   //We still have outstanding SCO connection
+                   fMoreSCO = VOS_TRUE;
+               }
+               else if( pMac->btc.btcScoHandles[i] == pBtEvent->uEventParam.btDisconnect.connectionHandle )
+               {
+                   pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE;
+               }
+           }
+           if( !fMoreSCO && !pMac->btc.fA2DPUp )
+           {
+               //All SCO is disconnected
+               pMac->btc.btcUapsdOk = VOS_TRUE;
+               smsLog( pMac, LOGE, "BT event (DISCONNECTION) happens, UAPSD-allowed flag (%d) change to TRUE \n", 
+                        pBtEvent->btEventType, pMac->btc.btcUapsdOk );
+           }
+       }
+       break;
+   case BT_EVENT_DEVICE_SWITCHED_OFF:
+       smsLog( pMac, LOGE, "BT event (DEVICE_OFF) happens, UAPSD-allowed flag (%d) change to TRUE \n", 
+                        pBtEvent->btEventType, pMac->btc.btcUapsdOk );
+       //Clean up SCO
+       for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+       {
+           pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE;
+       }
+       pMac->btc.fA2DPUp = VOS_FALSE;
+       pMac->btc.btcUapsdOk = VOS_TRUE;
+       break;
+   case BT_EVENT_A2DP_STREAM_STOP:
+       smsLog( pMac, LOGE, "BT event  (A2DP_STREAM_STOP) happens, UAPSD-allowed flag (%d) \n", 
+            pMac->btc.btcUapsdOk );
+       pMac->btc.fA2DPUp = VOS_FALSE;
+       //Check whether SCO is on
+       for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+       {
+           if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE)
+           {
+              break;
+           }
+       }
+       if( BT_MAX_SCO_SUPPORT == i )
+       {
+            pMac->btc.fA2DPTrafStop = VOS_TRUE;
+           smsLog( pMac, LOGE, "BT_EVENT_A2DP_STREAM_STOP: UAPSD-allowed flag is now %d\n",
+                   pMac->btc.btcUapsdOk );
+       }
+       break;
+
+   case BT_EVENT_MODE_CHANGED:
+       smsLog( pMac, LOGE, "BT event (BT_EVENT_MODE_CHANGED) happens, Mode (%d) UAPSD-allowed flag (%d)\n",
+               pBtEvent->uEventParam.btAclModeChange.mode, pMac->btc.btcUapsdOk );
+       if(pBtEvent->uEventParam.btAclModeChange.mode == BT_ACL_SNIFF)
+       {
+           //Check whether SCO is on
+           for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+           {
+               if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE)
+               {
+                   break;
+               }
+           }
+           if( BT_MAX_SCO_SUPPORT == i )
+           {
+               if(VOS_TRUE == pMac->btc.fA2DPTrafStop)
+               {
+                   pMac->btc.btcUapsdOk = VOS_TRUE;
+                   pMac->btc.fA2DPTrafStop = VOS_FALSE;
+               }
+               smsLog( pMac, LOGE, "BT_EVENT_MODE_CHANGED with Mode:%d UAPSD-allowed flag is now %d\n",
+                       pBtEvent->uEventParam.btAclModeChange.mode,pMac->btc.btcUapsdOk );
+           }
+       }
+       break;
+   case BT_EVENT_CREATE_SYNC_CONNECTION:
+       {
+           pMac->btc.btcUapsdOk = VOS_FALSE;
+           smsLog( pMac, LOGE, "BT_EVENT_CREATE_SYNC_CONNECTION (%d) happens, UAPSD-allowed flag (%d) change to FALSE \n", 
+                   pBtEvent->btEventType, pMac->btc.btcUapsdOk );
+       }
+       break;
+   case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+       //Make sure it is a success
+       if( BT_CONN_STATUS_FAIL != pBtEvent->uEventParam.btSyncConnection.status )
+       {
+           //Save te handle for later use
+           for( i = 0; i < BT_MAX_SCO_SUPPORT; i++)
+           {
+               VOS_ASSERT(BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btSyncConnection.connectionHandle);
+               if( (BT_INVALID_CONN_HANDLE == pMac->btc.btcScoHandles[i]) &&
+                   (BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btSyncConnection.connectionHandle))
+               {
+                   pMac->btc.btcScoHandles[i] = pBtEvent->uEventParam.btSyncConnection.connectionHandle;
+                   break;
+               }
+           }
+
+           if( i >= BT_MAX_SCO_SUPPORT )
+           {
+               smsLog(pMac, LOGE, FL("Too many SCO, ignore this one\n"));
+           }
+       }
+       else
+       {
+            //Check whether SCO is on
+           for(i=0; i < BT_MAX_SCO_SUPPORT; i++)
+           {
+               if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE)
+               {
+                   break;
+               }
+       }
+           /*If No Other Sco/A2DP is ON reenable UAPSD*/
+           if( (BT_MAX_SCO_SUPPORT == i)  && !pMac->btc.fA2DPUp)           
+           {
+               pMac->btc.btcUapsdOk = VOS_TRUE;
+           }
+           smsLog(pMac, LOGE, FL("TSYNC complete failed\n"));
+       }
+       break;
+   case BT_EVENT_A2DP_STREAM_START:
+       smsLog( pMac, LOGE, "BT_EVENT_A2DP_STREAM_START (%d) happens, UAPSD-allowed flag (%d) change to FALSE \n", 
+                pBtEvent->btEventType, pMac->btc.btcUapsdOk );
+       pMac->btc.fA2DPTrafStop = VOS_FALSE;
+       pMac->btc.btcUapsdOk = VOS_FALSE;
+       pMac->btc.fA2DPUp = VOS_TRUE;
+       break;
+   default:
+       //No change for these events
+       smsLog( pMac, LOGE, "BT event (%d) happens, UAPSD-allowed flag (%d) no change \n", 
+                    pBtEvent->btEventType, pMac->btc.btcUapsdOk );
+       break;
+   }
+   if(fLastUapsdState != pMac->btc.btcUapsdOk)
+   {
+      sme_QosTriggerUapsdChange( pMac );
+   }
+}
+
+/* ---------------------------------------------------------------------------
+    \fn btcHandleCoexInd
+    \brief  API to handle Coex indication from WDI
+    \param  pMac - The handle returned by macOpen.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  success
+            eHAL_STATUS_SUCCESS  failure
+  ---------------------------------------------------------------------------*/
+eHalStatus btcHandleCoexInd(tHalHandle hHal, void* pMsg)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg;
+
+   if (NULL == pMsg)
+   {
+      smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+      status = eHAL_STATUS_FAILURE;
+   }
+   else
+   {
+      // DEBUG
+      smsLog(pMac, LOG1, "Coex indication in %s(), type %d",
+             __FUNCTION__, pSmeCoexInd->coexIndType);
+
+     // suspend heartbeat monitoring
+     if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_HB_MONITOR)
+     {
+        // set heartbeat threshold CFG to zero
+        ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE);
+        pMac->btc.btcHBActive = VOS_FALSE;
+     }
+
+     // resume heartbeat monitoring
+     else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_HB_MONITOR)
+     {
+        if (!pMac->btc.btcHBActive) 
+        {
+           ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE);
+           pMac->btc.btcHBActive = VOS_TRUE;
+        }
+     }
+
+     // unknown indication type
+     else
+     {
+        smsLog(pMac, LOGE, "unknown Coex indication type in %s()", __FUNCTION__);
+     }
+   }
+
+   return(status);
+}
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+/* ---------------------------------------------------------------------------
+    \fn btcDiagEventLog
+    \brief  API to log the the current Bluetooth event
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtEvent. Caller owns the memory and is responsible
+                            for freeing it.
+    \return None
+  ---------------------------------------------------------------------------*/
+static void btcDiagEventLog (tHalHandle hHal, tpSmeBtEvent pBtEvent)
+{
+   //vos_event_wlan_btc_type *log_ptr = NULL;
+   WLAN_VOS_DIAG_EVENT_DEF(btDiagEvent, vos_event_wlan_btc_type);
+   {
+       btDiagEvent.eventId = pBtEvent->btEventType;
+       switch(pBtEvent->btEventType)
+       {
+            case BT_EVENT_CREATE_SYNC_CONNECTION:
+            case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+            case BT_EVENT_SYNC_CONNECTION_UPDATED:
+                btDiagEvent.connHandle = pBtEvent->uEventParam.btSyncConnection.connectionHandle;
+                btDiagEvent.connStatus = pBtEvent->uEventParam.btSyncConnection.status;
+                btDiagEvent.linkType   = pBtEvent->uEventParam.btSyncConnection.linkType;
+                btDiagEvent.scoInterval = pBtEvent->uEventParam.btSyncConnection.scoInterval;
+                btDiagEvent.scoWindow  = pBtEvent->uEventParam.btSyncConnection.scoWindow;
+                btDiagEvent.retransWindow = pBtEvent->uEventParam.btSyncConnection.retransmisisonWindow;
+                vos_mem_copy(btDiagEvent.btAddr, pBtEvent->uEventParam.btSyncConnection.bdAddr,
+                              sizeof(btDiagEvent.btAddr));
+                break;
+            case BT_EVENT_CREATE_ACL_CONNECTION:
+            case BT_EVENT_ACL_CONNECTION_COMPLETE:
+                btDiagEvent.connHandle = pBtEvent->uEventParam.btAclConnection.connectionHandle;
+                btDiagEvent.connStatus = pBtEvent->uEventParam.btAclConnection.status;
+                vos_mem_copy(btDiagEvent.btAddr, pBtEvent->uEventParam.btAclConnection.bdAddr,
+                             sizeof(btDiagEvent.btAddr));
+                break;
+            case BT_EVENT_MODE_CHANGED:
+                btDiagEvent.connHandle = pBtEvent->uEventParam.btAclModeChange.connectionHandle;
+                btDiagEvent.mode = pBtEvent->uEventParam.btAclModeChange.mode;
+                break;
+            case BT_EVENT_DISCONNECTION_COMPLETE:
+                btDiagEvent.connHandle = pBtEvent->uEventParam.btAclModeChange.connectionHandle;
+                break;
+            default:
+                break;
+       }
+   }
+   WLAN_VOS_DIAG_EVENT_REPORT(&btDiagEvent, EVENT_WLAN_BTC);
+}
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
diff --git a/CORE/SME/src/ccm/ccmApi.c b/CORE/SME/src/ccm/ccmApi.c
new file mode 100644
index 0000000..ac50aff
--- /dev/null
+++ b/CORE/SME/src/ccm/ccmApi.c
@@ -0,0 +1,1124 @@
+/*
+ * 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.
+ */
+
+#include "palTypes.h"
+#include "wniApi.h"     /* WNI_CFG_SET_REQ */
+#include "sirParams.h"  /* tSirMbMsg */
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halHddApis.h" /* palAllocateMemory */
+#endif
+#include "smsDebug.h"   /* smsLog */
+#include "cfgApi.h"
+#include "ccmApi.h"
+#include "logDump.h"
+
+//#define CCM_DEBUG
+#undef CCM_DEBUG
+
+#define CCM_DEBUG2
+//#undef CCM_DEBUG2
+
+#define CFGOBJ_ALIGNTO          4
+#define CFGOBJ_ALIGN(len)       ( ((len)+CFGOBJ_ALIGNTO-1) & ~(CFGOBJ_ALIGNTO-1) )
+
+#define CFGOBJ_ID_SIZE                  4       /* 4 bytes for cfgId */
+#define CFGOBJ_LEN_SIZE                 4       /* 4 bytes for length */
+#define CFGOBJ_INTEGER_VALUE_SIZE       4       /* 4 bytes for integer value */
+
+#define CFG_UPDATE_MAGIC_DWORD     0xabab
+
+#define halHandle2HddHandle(hHal)  ( (NULL == (hHal)) ? 0 : ((tpAniSirGlobal)(hHal))->hHdd )
+
+static void ccmComplete(tHddHandle hHdd, void *done)
+{
+    if (done)
+    {
+        (void)palSemaphoreGive(hHdd, done);
+    }
+}
+
+static void ccmWaitForCompletion(tHddHandle hHdd, void *done)
+{
+    if (done)
+    {
+        (void)palSemaphoreTake(hHdd, done);
+    }
+}
+
+static tANI_U32 * encodeCfgReq(tHddHandle hHdd, tANI_U32 *pl, tANI_U32 cfgId, tANI_S32 length, void *pBuf, tANI_U32 value, tANI_U32 type)
+{
+    *pl++ = pal_cpu_to_be32(cfgId) ;
+    *pl++ = pal_cpu_to_be32(length) ;
+    if (type == CCM_INTEGER_TYPE)
+    {
+        *pl++ = pal_cpu_to_be32(value) ;
+    }
+    else
+    {
+        palCopyMemory(hHdd, (void *)pl, (void *)pBuf, length);
+        pl += (CFGOBJ_ALIGN(length) / CFGOBJ_ALIGNTO);
+    }
+    return pl ;
+}
+
+/*
+ * CCM_STRING_TYPE                       CCM_INTEGER_TYPE
+ * |<--------  4   ----->|               |<--------  4   ----->|                          
+ * +----------+            <-- msg  -->  +----------+                                 
+ * |type      |                          |type      |           
+ * +----------+                          +----------+           
+ * |msgLen=24 |                          |msgLen=16 |           
+ * +----------+----------+               +----------+----------+
+ * | cfgId               |               | cfgId               |  
+ * +---------------------+               +---------------------+
+ * | length=11           |               | length=4            |  
+ * +---------------------+               +---------------------+
+ * |                     |               | value               |  
+ * |                     |               +---------------------+  
+ * |                     |
+ * |                +----+
+ * |                |////| <- padding to 4-byte boundary
+ * +----------------+----+
+ */
+static eHalStatus sendCfg(tpAniSirGlobal pMac, tHddHandle hHdd, tCfgReq *req, tANI_BOOLEAN fRsp)
+{
+    tSirMbMsg *msg;
+    eHalStatus status;
+    tANI_S16 msgLen = (tANI_U16)(4 +    /* 4 bytes for msg header */
+                                 CFGOBJ_ID_SIZE +
+                                 CFGOBJ_LEN_SIZE +
+                                 CFGOBJ_ALIGN(req->length)) ;
+
+    status = palAllocateMemory(hHdd, (void **)&msg, msgLen);
+    if (status == eHAL_STATUS_SUCCESS)
+    {
+        if( fRsp )
+        {
+            msg->type = pal_cpu_to_be16(WNI_CFG_SET_REQ);
+        }
+        else
+        {
+            msg->type = pal_cpu_to_be16(WNI_CFG_SET_REQ_NO_RSP);
+        }
+        msg->msgLen = pal_cpu_to_be16(msgLen);
+        (void)encodeCfgReq(hHdd, msg->data, req->cfgId, req->length, req->ccmPtr, req->ccmValue, req->type) ;
+
+        status = palSendMBMessage(hHdd, msg) ;
+        if (status != eHAL_STATUS_SUCCESS)
+        {
+            smsLog( pMac, LOGW, FL("palSendMBMessage() failed\n"));
+            //No need to free msg. palSendMBMessage frees it.
+            status = eHAL_STATUS_FAILURE ;
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGW, FL("palAllocateMemory(len=%d)\n"), msgLen );
+    }
+
+    return status ;
+}
+
+static tCfgReq * allocateCfgReq(tHddHandle hHdd, tANI_U32 type, tANI_S32 length)
+{
+    tCfgReq *req ;
+    tANI_S32 alloc_len = sizeof(tCfgReq) ;
+
+    if (type == CCM_STRING_TYPE)
+    {
+        alloc_len += length ;
+    }
+
+    if (palAllocateMemory(hHdd, (void **)&req, alloc_len) != eHAL_STATUS_SUCCESS)
+    {
+        return NULL ;
+    }
+
+    req->ccmPtr = (req+1);
+
+    return req ;
+}
+
+static void freeCfgReq(tHddHandle hHdd, tCfgReq *req)
+{
+    palFreeMemory(hHdd, (void*)req) ;
+}
+
+static void add_req_tail(tCfgReq *req, struct ccmlink *q)
+{
+    if (q->tail)
+    {
+        q->tail->next = req;
+        q->tail = req ;
+    }
+    else
+    {
+        q->head = q->tail = req ;
+    }
+}
+
+static void del_req(tCfgReq *req, struct ccmlink *q)
+{
+    q->head = req->next ;
+    req->next = NULL ;
+    if (q->head == NULL)
+    {
+        q->tail = NULL ;
+    }
+}
+
+static void purgeReqQ(tHalHandle hHal)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tCfgReq *req, *tmp ;
+
+    for (req = pMac->ccm.reqQ.head; req; req = tmp)
+    {
+        /* loop thru reqQ and invoke callback to return failure */
+        smsLog(pMac, LOGW, FL("deleting cfgReq, cfgid=%d\n"), (int)req->cfgId);
+
+        tmp = req->next ;
+
+        if (req->callback)
+        {
+            req->callback(hHal, eHAL_STATUS_FAILURE);
+        }
+        palSpinLockTake(hHdd, pMac->ccm.lock);
+        del_req(req, &pMac->ccm.reqQ);
+        palSpinLockGive(hHdd, pMac->ccm.lock);
+        freeCfgReq(hHdd, req);
+    }
+    return ;
+}
+
+static void sendQueuedReqToMacSw(tpAniSirGlobal pMac, tHddHandle hHdd)
+{
+    tCfgReq *req ;
+
+    /* Send the head req */
+    req = pMac->ccm.reqQ.head ;
+    if (req)
+    {
+        if (req->state == eCCM_REQ_QUEUED)
+        {
+            /* Send WNI_CFG_SET_REQ */
+            req->state = eCCM_REQ_SENT;
+            if (sendCfg(pMac, hHdd, req, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS)
+            {
+                smsLog( pMac, LOGW, FL("sendCfg() failed\n"));
+                palSpinLockTake(hHdd, pMac->ccm.lock);
+                del_req(req, &pMac->ccm.reqQ) ;
+                palSpinLockGive(hHdd, pMac->ccm.lock);
+                if (req->callback)
+                {
+                    req->callback((tHalHandle)pMac, WNI_CFG_OTHER_ERROR) ;
+                }
+
+#ifdef CCM_DEBUG
+                smsLog(pMac, LOGW, FL("ccmComplete(%p)\n"), req->done);
+#endif
+                ccmComplete(hHdd, req->done);
+
+                freeCfgReq(hHdd, req);
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGW, FL("reqState is not eCCM_REQ_QUEUED, is %d\n"), req->state );
+        }
+    }
+
+    return ;
+}
+
+static eHalStatus cfgSetSub(tpAniSirGlobal pMac, tHddHandle hHdd, tANI_U32 cfgId, tANI_U32 type, 
+                            tANI_S32 length, void *ccmPtr, tANI_U32 ccmValue, 
+                            tCcmCfgSetCallback callback, eAniBoolean toBeSaved, void *sem, tCfgReq **r)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCfgReq *req ;
+
+    do
+    {
+        *r = NULL ;
+
+        if (pMac->ccm.state == eCCM_STOPPED)
+        {
+            status = eHAL_STATUS_FAILURE ;
+            break ;
+        }
+
+        req = allocateCfgReq(hHdd, type, length);
+        if (req == NULL)
+        {
+            status = eHAL_STATUS_FAILED_ALLOC ;
+            break ;
+        }
+
+        req->next       = NULL ;
+        req->cfgId      = (tANI_U16)cfgId ;
+        req->type       = (tANI_U8)type ;
+        req->state      = eCCM_REQ_QUEUED ;
+        req->toBeSaved  = !!toBeSaved ;
+        req->length     = length ;
+        req->done       = sem ;
+        req->callback   = callback ;
+        if (type == CCM_INTEGER_TYPE)
+        {
+            req->ccmValue = ccmValue ;
+        }
+        else
+        {
+            palCopyMemory(hHdd, (void*)req->ccmPtr, (void*)ccmPtr, length); 
+        }
+
+        palSpinLockTake(hHdd, pMac->ccm.lock);
+
+        add_req_tail(req, &pMac->ccm.reqQ);
+        /* If this is the first req on the queue, send it to MAC SW */
+        if ((pMac->ccm.replay.started == 0) && (pMac->ccm.reqQ.head == req))
+        {
+            /* Send WNI_CFG_SET_REQ */
+            req->state = eCCM_REQ_SENT;
+            palSpinLockGive(hHdd, pMac->ccm.lock);
+            status = sendCfg(pMac, hHdd, req, eANI_BOOLEAN_TRUE) ;
+            if (status != eHAL_STATUS_SUCCESS)
+            {
+                smsLog( pMac, LOGW, FL("sendCfg() failed\n"));
+                palSpinLockTake(hHdd, pMac->ccm.lock);
+                del_req(req, &pMac->ccm.reqQ);
+                palSpinLockGive(hHdd, pMac->ccm.lock);
+                freeCfgReq(hHdd, req);
+                break ;
+            }
+            else
+            {
+                palSpinLockTake(hHdd, pMac->ccm.lock);
+                if(req != pMac->ccm.reqQ.head)
+                {
+                    //We send the request and it must be done already
+                    req = NULL;
+                }
+                palSpinLockGive(hHdd, pMac->ccm.lock);
+            }
+        }
+        else
+        {
+            palSpinLockGive(hHdd, pMac->ccm.lock);
+        }
+        *r = req ;
+
+    } while(0) ;
+
+    return status;
+}
+
+static eHalStatus cfgSet(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 type, tANI_S32 length, void * ccmPtr, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+    tCfgReq *req ;
+
+    if (pal_in_interrupt())
+    {
+#ifdef CCM_DEBUG2
+        smsLog(pMac, LOGE, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=TRUE\n"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
+#endif
+        status = cfgSetSub(pMac, hHdd, cfgId, type, length, ccmPtr, ccmValue, callback, toBeSaved, NULL, &req);
+    }
+    else
+    {
+        void *sem ;
+
+#ifdef CCM_DEBUG2
+        smsLog(pMac, LOGE, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=FALSE\n"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
+#endif
+        pal_local_bh_disable() ;
+
+        status = palMutexAllocLocked( hHdd, &sem ) ;
+        if (status != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("mutex alloc failed\n"));
+            sem = NULL;
+        }
+        else
+        {
+            status = cfgSetSub(pMac, hHdd, cfgId, type, length, ccmPtr, ccmValue, callback, toBeSaved, sem, &req);
+            if ((status != eHAL_STATUS_SUCCESS) || (req == NULL))
+            {
+                //Either it fails to send or the req is finished already
+                palSemaphoreFree( hHdd, sem );
+                sem = NULL;
+            }
+        }
+
+        pal_local_bh_enable() ;
+
+        if ((status == eHAL_STATUS_SUCCESS) && (sem != NULL))
+        {
+#ifdef CCM_DEBUG
+            smsLog(pMac, LOGW, FL("ccmWaitForCompletion(%p)\n"), req->done);
+#endif
+            ccmWaitForCompletion(hHdd, sem);
+
+#ifdef CCM_DEBUG
+            smsLog(pMac, LOGW, FL("free(%p)\n"), req->done);
+#endif
+            palSemaphoreFree( hHdd, sem ) ;
+        }
+    }
+
+    return status ;
+}
+
+eHalStatus ccmOpen(tHalHandle hHal)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    (void)palZeroMemory(hHdd, &pMac->ccm, sizeof(tCcm)) ;
+    return palSpinLockAlloc(hHdd, &pMac->ccm.lock);
+}
+
+eHalStatus ccmClose(tHalHandle hHal)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U32 i ; 
+    tCfgReq *req ;
+
+    ccmStop(hHal);
+
+    /* Go thru comp[] to free all saved requests */
+    for (i = 0 ; i < CFG_PARAM_MAX_NUM ; ++i)
+    {
+        if ((req = pMac->ccm.comp[i]) != NULL)
+        {
+            freeCfgReq(hHdd, req);
+        }
+    }
+
+    return palSpinLockFree(hHdd, pMac->ccm.lock);
+}
+
+/* This function executes in (Linux) softirq context */
+void ccmCfgCnfMsgHandler(tHalHandle hHal, void *m)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tSirMbMsg *msg = (tSirMbMsg *)m ;
+    tANI_U32 result, cfgId ;
+    tCfgReq *req, *old ;
+
+#if 0
+    if (pMac->ccm.state != eCCM_STARTED)
+    {
+        return ;
+    }
+#endif
+
+    result  = pal_be32_to_cpu(msg->data[0]);
+    cfgId   = pal_be32_to_cpu(msg->data[1]);
+
+    if (pMac->ccm.replay.started && cfgId == CFG_UPDATE_MAGIC_DWORD)
+    {
+        pMac->ccm.replay.in_progress = 1 ;
+        return ;
+    }
+
+    if (pMac->ccm.replay.in_progress)
+    {
+        /* save error code */
+        if (!CCM_IS_RESULT_SUCCESS(result))
+        {
+            pMac->ccm.replay.result = result ;
+        }
+
+        if (--pMac->ccm.replay.nr_param == 0)
+        {
+            pMac->ccm.replay.in_progress = 0 ;
+
+            if (pMac->ccm.replay.callback)
+            {
+                pMac->ccm.replay.callback(hHal, pMac->ccm.replay.result);
+            }
+
+            pMac->ccm.replay.started = 0 ;
+
+            /* Wake up the sleeping process */
+#ifdef CCM_DEBUG
+            smsLog(pMac, LOGW, FL("ccmComplete(%p)\n"), pMac->ccm.replay.done);
+#endif
+            ccmComplete(hHdd, pMac->ccm.replay.done);
+            //Let go with the rest of the set CFGs waiting.
+            sendQueuedReqToMacSw(pMac, hHdd);
+        }
+    }
+    else
+    {
+        /*
+         * Try to match this response with the request.
+         * What if i could not find the req entry ???
+         */
+        req = pMac->ccm.reqQ.head ;
+        if (req)
+        {
+
+            if (req->cfgId == cfgId && req->state == eCCM_REQ_SENT)
+            {
+                palSpinLockTake(hHdd, pMac->ccm.lock);
+                del_req(req, &pMac->ccm.reqQ);
+                palSpinLockGive(hHdd, pMac->ccm.lock);
+                req->state = eCCM_REQ_DONE ;
+
+                if (result == WNI_CFG_NEED_RESTART ||
+                    result == WNI_CFG_NEED_RELOAD)
+                {
+#ifdef CCM_DEBUG
+                    smsLog(pMac, LOGW, FL("need restart/reload, cfgId=%d\n"), req->cfgId) ;
+#endif
+                    //purgeReqQ(hHal);
+                }
+
+                /* invoke callback */
+                if (req->callback)
+                {
+#ifdef CCM_DEBUG
+                    req->callback(hHal, cfgId) ;
+#else
+                    req->callback(hHal, result) ;
+#endif
+                }
+
+                /* Wake up the sleeping process */
+#ifdef CCM_DEBUG
+                smsLog(pMac, LOGW, FL("cfgId=%ld, calling ccmComplete(%p)\n"), cfgId, req->done);
+#endif
+                ccmComplete(hHdd, req->done);
+
+                /* move the completed req from reqQ to comp[] */
+                if (req->toBeSaved && (CCM_IS_RESULT_SUCCESS(result)))
+                {
+                    if ((old = pMac->ccm.comp[cfgId]) != NULL)
+                    {
+                        freeCfgReq(hHdd, old) ;
+                    }
+                    pMac->ccm.comp[cfgId] = req ;
+                }
+                else
+                {
+                    freeCfgReq(hHdd, req) ;
+                }
+                sendQueuedReqToMacSw(pMac, hHdd);
+            }
+            else
+            {
+                smsLog( pMac, LOGW, FL("can not match RSP with REQ, rspcfgid=%d result=%d reqcfgid=%d reqstate=%d\n"),
+                        (int)cfgId, (int)result, req->cfgId, req->state);
+
+#ifdef CCM_DEBUG
+                smsLog(pMac, LOGW, FL("ccmComplete(%p)\n"), req->done);
+#endif
+            }
+
+        }
+    }
+
+    return ;
+}
+
+void ccmStart(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    pMac->ccm.state = eCCM_STARTED ;
+
+#if defined(ANI_LOGDUMP)
+    ccmDumpInit(hHal);
+#endif //#if defined(ANI_LOGDUMP)
+
+    return ;
+}
+
+void ccmStop(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    pMac->ccm.state = eCCM_STOPPED ;
+
+    pal_local_bh_disable() ;
+    purgeReqQ(hHal);
+    pal_local_bh_enable() ;
+
+    return ;
+}
+
+eHalStatus ccmCfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
+{
+    if( callback || toBeSaved)
+    {
+        //we need to sychronous this one
+        return cfgSet(hHal, cfgId, CCM_INTEGER_TYPE, sizeof(tANI_U32), NULL, ccmValue, callback, toBeSaved);
+    }
+    else
+    {
+        //Simply push to CFG and not waiting for the response
+        tCfgReq req;
+        tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+        req.callback = NULL;
+        req.next = NULL;
+        req.cfgId = ( tANI_U16 )cfgId;
+        req.length = sizeof( tANI_U32 );
+        req.type = CCM_INTEGER_TYPE;
+        req.ccmPtr = NULL;
+        req.ccmValue = ccmValue;
+        req.toBeSaved = toBeSaved;
+        req.state = eCCM_REQ_SENT;
+
+        return ( sendCfg( pMac, pMac->hHdd, &req, eANI_BOOLEAN_FALSE ) );
+    }
+}
+
+eHalStatus ccmCfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, tANI_U32 length, tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
+{
+    if( callback || toBeSaved )
+    {
+        //we need to sychronous this one
+        return cfgSet(hHal, cfgId, CCM_STRING_TYPE, length, pStr, 0, callback, toBeSaved);
+    }
+    else
+    {
+        //Simply push to CFG and not waiting for the response
+        tCfgReq req;
+        tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+        req.callback = NULL;
+        req.next = NULL;
+        req.cfgId = ( tANI_U16 )cfgId;
+        req.length = length;
+        req.type = CCM_STRING_TYPE;
+        req.ccmPtr = pStr;
+        req.ccmValue = 0;
+        req.toBeSaved = toBeSaved;
+        req.state = eCCM_REQ_SENT;
+
+        return ( sendCfg( pMac, pMac->hHdd, &req, eANI_BOOLEAN_FALSE ) );
+    }
+}
+
+eHalStatus ccmCfgGetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 *pValue)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_SUCCESS ;
+    tCfgReq *req = pMac->ccm.comp[cfgId] ;
+
+    if (req && req->state == eCCM_REQ_DONE)
+    {
+        *pValue = req->ccmValue ; 
+    }
+    else
+    {
+        if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, pValue) != eSIR_SUCCESS)
+            status = eHAL_STATUS_FAILURE;
+    }
+
+    return status ;
+}
+
+eHalStatus ccmCfgGetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    eHalStatus status = eHAL_STATUS_SUCCESS ;
+    tCfgReq *req = pMac->ccm.comp[cfgId] ;
+
+    if (req && req->state == eCCM_REQ_DONE && (tANI_U32)req->length <= *pLength)
+    {
+        *pLength = req->length ; 
+        palCopyMemory(hHdd, (void*)pBuf, (void*)req->ccmPtr, req->length); 
+    }
+    else
+    {
+        if (wlan_cfgGetStr(pMac, (tANI_U16)cfgId, pBuf, pLength) != eSIR_SUCCESS)
+            status = eHAL_STATUS_FAILURE;
+    }
+
+    return status ;
+}
+
+/*
+ * Loop thru comp[] and form an ANI message which contains all completed cfgIds.
+ * The message begins with an INTEGER parameter (cfgId=CFG_UPDATE_MAGIC_DWORD)     
+ * to mark the start of the message.
+ */ 
+static eHalStatus cfgUpdate(tpAniSirGlobal pMac, tHddHandle hHdd, tCcmCfgSetCallback callback)
+{
+    tANI_U32 i, *pl ;
+    tCfgReq *req ;
+    tSirMbMsg *msg ;
+    eHalStatus status ;
+    tANI_S16 msgLen = 4 +       /* 4 bytes for msg header */ 
+                                /* for CFG_UPDATE_MAGIC_DWORD */ 
+        CFGOBJ_ID_SIZE +
+        CFGOBJ_LEN_SIZE +
+        CFGOBJ_INTEGER_VALUE_SIZE ;
+
+    if (pMac->ccm.state == eCCM_STOPPED || pMac->ccm.replay.started)
+    {
+        status = eHAL_STATUS_FAILURE ;
+        goto end ;
+    }
+
+    palSpinLockTake(hHdd, pMac->ccm.lock);
+
+    pMac->ccm.replay.started    = 1 ;
+    pMac->ccm.replay.nr_param   = 0 ;
+
+    palSpinLockGive(hHdd, pMac->ccm.lock);
+
+    /* Calculate message length */
+    for (i = 0 ; i < CFG_PARAM_MAX_NUM ; ++i)
+    {
+        if ((req = pMac->ccm.comp[i]) != NULL)
+        {
+            msgLen += (tANI_S16)(CFGOBJ_ID_SIZE + CFGOBJ_LEN_SIZE + CFGOBJ_ALIGN(req->length)) ;
+            pMac->ccm.replay.nr_param += 1 ;
+#ifdef CCM_DEBUG
+            smsLog(pMac, LOGW, FL("cfgId=%d\n"), req->cfgId);
+#endif
+        }
+    }
+
+    if (pMac->ccm.replay.nr_param == 0)
+    {
+        if (callback)
+        {
+            callback((tHalHandle)pMac, WNI_CFG_SUCCESS) ;
+        }
+        status = eHAL_STATUS_SUCCESS ;
+        goto end ;
+    }
+
+    pMac->ccm.replay.in_progress = 0 ;
+    pMac->ccm.replay.result      = WNI_CFG_SUCCESS ;
+    pMac->ccm.replay.callback    = callback ;
+    pMac->ccm.replay.done        = NULL ;
+
+    status = palAllocateMemory(hHdd, (void **)&msg, msgLen) ;
+    if (status != eHAL_STATUS_SUCCESS)
+    {
+        pMac->ccm.replay.started = 0 ;
+        goto end ; 
+    }
+
+    msg->type   = pal_cpu_to_be16(WNI_CFG_SET_REQ);
+    msg->msgLen = pal_cpu_to_be16(msgLen);
+
+    /* Encode the starting cfgId */
+    pl = encodeCfgReq(hHdd, msg->data, CFG_UPDATE_MAGIC_DWORD, 4, NULL, 0, CCM_INTEGER_TYPE) ;
+
+    /* Encode the saved cfg requests */
+    for (i = 0 ; i < CFG_PARAM_MAX_NUM ; ++i)
+    {
+        if ((req = pMac->ccm.comp[i]) != NULL)
+        {
+            pl = encodeCfgReq(hHdd, pl, req->cfgId, req->length, req->ccmPtr, req->ccmValue, req->type) ;
+        }
+    }
+
+    status = palSendMBMessage(hHdd, msg) ;
+    if (status != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGW, FL("palSendMBMessage() failed. status=%d\n"), status);
+        pMac->ccm.replay.started = 0 ;
+        //No need to free msg. palSendMBMessage frees it.
+        goto end ;
+    }
+
+ end:
+    return status ;
+}
+
+eHalStatus ccmCfgUpdate(tHalHandle hHal, tCcmCfgSetCallback callback)
+{
+    tHddHandle hHdd = halHandle2HddHandle(hHal);
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status ;
+
+    pal_local_bh_disable() ;
+
+    status = cfgUpdate(pMac, hHdd, callback) ;
+    if (status == eHAL_STATUS_SUCCESS)
+    {
+        if (pMac->ccm.replay.nr_param == 0)
+        {
+            /* there is nothing saved at comp[], so we are done! */
+            pMac->ccm.replay.started = 0 ;
+        }
+        else
+        {
+            /* we have sent update message to MAC SW */
+            void *sem ;
+
+            status = palMutexAllocLocked( hHdd, &sem ) ;
+            if (status != eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGE, FL("mutex alloc failed\n"));
+                pMac->ccm.replay.started = 0 ;
+            }
+            else
+            {
+                pMac->ccm.replay.done = sem ;
+            }
+        }
+    }
+
+    pal_local_bh_enable() ;
+
+    /* Waiting here ... */
+    if (status == eHAL_STATUS_SUCCESS && pMac->ccm.replay.done)
+    {
+#ifdef CCM_DEBUG
+        smsLog(pMac, LOGW, FL("ccmWaitForCompletion(%p)\n"), pMac->ccm.replay.done);
+#endif
+        ccmWaitForCompletion(hHdd, pMac->ccm.replay.done);
+
+#ifdef CCM_DEBUG
+        smsLog(pMac, LOGW, FL("free(%p)\n"), pMac->ccm.replay.done);
+#endif
+        palSemaphoreFree( hHdd, pMac->ccm.replay.done) ;
+    }
+
+    return status ;
+}
+
+#if 0
+///////////////////////////////////////////////////////////////////
+#include <linux/netdevice.h>
+#include <linux/delay.h>
+extern struct net_device * hdd_dev[];
+
+typedef struct pal_netdev_priv_s
+{
+    // pointer to the PCI device structure for this device
+    struct pci_dev  *pci_dev;
+
+    // TAURUS has three BAR registers
+
+    // BAR0 is a fixed window for the PIF registers
+    volatile void *win0_addr;
+    tANI_U32 win0_size;
+
+    // BAR1 is a movable window for all other registers
+    volatile void *win1_addr;
+    tANI_U32 win1_size;
+    tANI_U32 win1_current;
+
+    // BAR2 is a movable window for all other memory
+    volatile void *win2_addr;
+    tANI_U32 win2_size;
+    tANI_U32 win2_current;
+
+
+} pal_netdev_priv_t;
+
+typedef struct hdd_stats_s {
+    /* Stats on the MAC SW messages sent to applications */
+    ulong stats_mac_rx_mbx_tot_cnt;
+    ulong stats_mac_rx_mbx_success_cnt;
+    ulong stats_mac_rx_mbx_drop_cnt;
+
+    /* Stats on messages sent to the MAC SW messages from applications */
+    ulong stats_mac_tx_mbx_tot_cnt;
+    ulong stats_mac_tx_mbx_success_cnt;
+    ulong stats_mac_tx_mbx_drop_cnt;
+} hdd_stats_t;
+
+/* HDD Driver Private Data structure */
+typedef struct hdd_netdev_priv_s
+{
+    tANI_U32 magic_head;
+
+    // chipset-specific private data
+    pal_netdev_priv_t ANI_CHIPSET;
+
+    tHalHandle halHandle;
+
+#ifdef ANI_BUS_TYPE_PCI
+    struct pci_dev  *pci_dev;
+    struct pci_device_id * pPciDevId;
+#endif // ANI_BUS_TYPE_PCI
+
+    // Queued EAPOL frame destination.
+    tANI_U32 eapol_pid;
+
+    unsigned int num_xmit;
+
+    /*
+     * Various frequently used variables that pertain to this
+     * instance of the driver
+     */
+    tANI_U32 rx_buf_sz;           /* Based on MTU+extra headroom needed.*/
+    tANI_U32 td_enqueue_nested;
+
+    /*
+     * Flag set by MAC SW to indicate a TD ring is desired
+     */
+    int td_flush;
+
+    int selectiveFlush;
+
+    spinlock_t lock;
+
+    /* Stats */
+    struct net_device_stats stats;
+    int curr_acc_cat;
+#ifdef LX5280
+    unsigned short rtl_pvid; //VLAN id this Interface belongs to
+    int rtl_extPortNum; //ext port used in RTL865x driver
+    int rtl_linkId[16];//link ID of each interface for RTL865x driver
+    int rtl_wdsActive;
+#endif
+    tANI_U16 lport; /* switch logical port */
+
+    /* management and control */
+    tANI_U32 status;
+    tANI_U32 msg_enable;
+    tANI_U32 radio_id;                  /* Unit # of this device */
+
+    int ap_flag;                        /* 
+                                         * indicates if the Radio is in AP
+                                         *  or BP mode.
+                                         */
+
+    /* NAPI Polling suport */
+    struct timer_list oom_timer;    /* Out of memory timer.    */
+
+    struct timer_list reset_req_timer;/* 
+                                       * Timer started when a Reset
+                                       * request is sent to WSM. Cleared
+                                       * when a subsequent Radio Disable
+                                       * Request is received.
+                                       */
+
+    struct tasklet_struct *rx_tasklet;
+    struct tasklet_struct *tx_tasklet;
+       
+    tANI_U32 learn_mode_frame_cnt;      /*
+                                         * Data Frames forwarded to MAC SW
+                                         * when Polaris is in learn mode 
+                                         */
+
+    tANI_U32 mgmt_ctl_frames;           /* MGMT/CTL Frames forwarded to MAC SW */
+
+    tANI_U32 nir;                       /* total number of times the ISR has
+                                         * been invoked.*/
+    tANI_U32 stats_dummy_pkt_requeue_cnt;
+    tANI_U32 stats_rx_td_dummy_pkt_cnt;/* TD Dummy pkts that were after HIF loopback */
+    tANI_U32 stats_rx_tm_dummy_pkt_cnt;/* TM Dummy pkts that were after HIF loopback */
+    tANI_U32 stats_td_dummy_pkt_cnt;    /* Dummy pkts that were succesfully
+                                         * put on the TD ring and that
+                                         * were picked up by the HIF
+                                         */
+
+    tANI_U32 stats_mac_dummy_pkt_drop_cnt;/* Number of dummy pkts dropped by the HDD
+                                           * due to any reason
+                                           */
+    tANI_U32 stats_wns_l2update_cnt; 
+    tANI_U32 stats_app_hif_wr_pkt_cnt;
+    hdd_stats_t hdd_stats;
+
+    tANI_U32 stats_reset_req_timer_cnt; /*
+                                         * Number of times the 
+                                         * Reset Req Timer expired
+                                         */
+
+#ifdef TCP_PROFILE
+    unsigned int pv_current_ip_proto;
+    unsigned int pv_current_ip_byte;
+    unsigned int pv_current_ack_seq;
+    unsigned int pv_current_seq;
+    unsigned int pv_rtt;
+    unsigned int pv_sent_seq;
+    unsigned int pv_p_ts;
+    unsigned int pv_tfpl_ts;
+#endif
+    tANI_U32 stats_mac_reset_cnt;         /* MAC SW Reset Requests */
+    tANI_U32 stats_mac_reset_eof_sof;
+    tANI_U32 stats_mac_reset_bmu;
+    tANI_U32 stats_mac_reset_pdu_low;
+    tANI_U32 stats_mac_reset_user;
+    tANI_U32 stats_mac_reset_wd_timeout;
+    tANI_U32 stats_mac_reset_unspecified;
+
+    tANI_U32 stats_wd_timeout_cnt;
+    tANI_U32 stats_radio_enable_cnt;
+    tANI_U32 stats_radio_disable_cnt;
+
+#ifdef PLM_EXTRA_STATS
+    tANI_U32 stats_tx_xmit_refilled;         /* Pkts xmit-filled */
+    tANI_U32 stats_tx_queue_stop;
+    tANI_U32 stats_tx_queue_start;
+
+    tANI_U32 stats_alloc_fail;
+    tANI_U32 stats_poll_starts;
+    tANI_U32 stats_poll_pkts;
+    tANI_U32 stats_poll_exit_done;
+    tANI_U32 stats_poll_exit_not_done;
+    tANI_U32 stats_poll_exit_oom;
+    tANI_U32 stats_poll_exit_done_rx_pending;
+    tANI_U32 stats_poll_zero_rx;
+
+#ifdef CONFIG_PROC_FS
+#ifdef ANI_USE_TASKLET
+    struct proc_dir_entry *proc_driver_dir; // for /proc/net/drivers
+#endif
+    struct proc_dir_entry *proc_ent_dir;    // for the directory itself
+
+    struct proc_dir_entry *proc_ent_stats;
+    struct proc_dir_entry *proc_ent_np_dump;
+    struct proc_dir_entry *proc_ent_ring;
+    char proc_fname_stats[32];
+    char proc_fname_np_dump[32];
+    char proc_fname_ring[32];
+
+    /* Setting Debug levels */
+    struct proc_dir_entry * proc_ent_dbg;
+    char proc_fname_dbg[32];
+
+    /* For bypass flags */
+    struct proc_dir_entry * proc_ent_bypass;
+    char proc_fname_bypass[32];
+
+    int sir_dump_cmd;   // Dump SIR command
+    int sir_dump_arg1;  // Dump SIR argument 1
+    int sir_dump_arg2;  // Dump SIR argument 2
+    int sir_dump_arg3;  // Dump SIR argument 3
+    int sir_dump_arg4;  // Dump SIR argument 4
+    struct proc_dir_entry * proc_ent_sir_dump;
+    char proc_fname_sir_dump[32];
+
+    eHalStatus status ;
+    struct proc_dir_entry * proc_ent_eeprom_info;
+    char proc_fname_eeprom_info[32];
+
+#endif  /* ifdef CONFIG_PROC_FS */
+
+    tANI_U32 rx_small_skb_failure;
+
+    unsigned long open_time; /* jiffies for last open */
+#endif /* PLM_EXTRA_STATS */
+
+    int mac_down;
+    tANI_U32 rx_mac_msg_cnt;
+    tANI_U32 tx_mac_msg_cnt;
+
+    int mbx_sent;
+
+    tANI_U32 bypass;                    // Used to various types of bypasses
+                                        // in the driver
+
+    /* 
+     * this table is initialized once for all by poldrv and so is not in 
+     * mac_param struct 
+     */
+    t_mac_block_table * mac_block_table;
+    struct sk_buff_head mac_list;
+#if  defined(ASICDXE_PROFILE) && defined(LX5280)
+    tANI_U32 num_of_reg_switches;
+#endif
+    tANI_U32 magic_tail;
+} hdd_netdev_priv_t;
+
+static void ccm_callback(tHalHandle hHal, tANI_S32 cfgId)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    smsLog(pMac, LOGW, FL("cfgId = %d\n"), cfgId);
+}
+
+static void ccm_callback2(tHalHandle hHal, tANI_S32 result)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    smsLog(pMac, LOGW, FL("result = %d\n"), result);
+}
+
+void ccm_test(void)
+{
+    tHalHandle hHal ;
+    tpAniSirGlobal pMac;
+    eHalStatus status ;
+    struct net_device *dev;
+    hdd_netdev_priv_t *np;
+    char str[80] = {1} ;
+
+    dev  = hdd_dev[0];
+    np = (hdd_netdev_priv_t *)dev->priv;
+    hHal = np->halHandle ;
+    pMac = PMAC_STRUCT( hHal );
+
+    smsLog(pMac, LOGW, "ccmStart()\n");
+    ccmStart(hHal) ;
+
+    status = ccmCfgUpdate(hHal, ccm_callback2) ;
+    smsLog(pMac, LOGW, "ccmCfgUpdate(): status=%d\n", status);
+
+    status = ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, 100, ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetInt(WNI_CFG_FRAGMENTATION_THRESHOLD = %d): status=%d\n",
+           WNI_CFG_FRAGMENTATION_THRESHOLD, status);
+
+    status = ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, 100, ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetInt(WNI_CFG_RTS_THRESHOLD = %d): status=%d\n",
+           WNI_CFG_RTS_THRESHOLD, status);
+
+    /* this cfgid causes reload */
+    status = ccmCfgSetInt(hHal, WNI_CFG_MIMO_ENABLED, 1, ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetInt(WNI_CFG_MIMO_ENABLED = %d): status=%d\n",
+           WNI_CFG_MIMO_ENABLED, status);
+
+    status = ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, 100, ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetInt(WNI_CFG_SHORT_RETRY_LIMIT = %d): status=%d\n",
+           WNI_CFG_SHORT_RETRY_LIMIT, status);
+
+    status = ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, 100, ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetInt(WNI_CFG_LONG_RETRY_LIMIT = %d): status=%d\n",
+           WNI_CFG_LONG_RETRY_LIMIT, status);
+
+    /* this cfgid causes restart */
+    status = ccmCfgSetStr(hHal, WNI_CFG_EDCA_WME_ACVI, str, sizeof(str), ccm_callback, 1) ;
+    smsLog(pMac, LOGW, "ccmCfgSetStr(WNI_CFG_EDCA_WME_ACVI = %d): status=%d\n",
+           WNI_CFG_EDCA_WME_ACVI, status);
+
+    mdelay(100);
+
+    smsLog(pMac, LOGW, "ccmStop()\n");
+    ccmStop(hHal);
+    status = ccmCfgUpdate(hHal, ccm_callback2) ;
+    smsLog(pMac, LOGW, "ccmCfgUpdate(): status=%d\n", status);
+
+    smsLog(pMac, LOGW, "ccmStart()\n");
+    ccmStart(hHal) ;
+    status = ccmCfgUpdate(hHal, ccm_callback2) ;
+    smsLog(pMac, LOGW, "ccmCfgUpdate(): status=%d\n", status);
+}
+#endif
diff --git a/CORE/SME/src/ccm/ccmLogDump.c b/CORE/SME/src/ccm/ccmLogDump.c
new file mode 100644
index 0000000..975bf68
--- /dev/null
+++ b/CORE/SME/src/ccm/ccmLogDump.c
@@ -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.
+ */
+
+/*============================================================================
+ccmLogDump.c
+
+Implements the dump commands specific to the ccm module. 
+
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
+ ============================================================================*/
+
+
+#include "aniGlobal.h"
+#include "logDump.h"
+
+#if defined(ANI_LOGDUMP)
+
+static tDumpFuncEntry ccmMenuDumpTable[] = {
+
+   {0,     "CCM (861-870)",                               NULL},
+    //{861,   "CCM: CCM testing ",                         dump_ccm}
+
+};
+
+void ccmDumpInit(tHalHandle hHal)
+{
+   logDumpRegisterTable( (tpAniSirGlobal) hHal, &ccmMenuDumpTable[0], 
+                         sizeof(ccmMenuDumpTable)/sizeof(ccmMenuDumpTable[0]) );
+}
+
+#endif //#if defined(ANI_LOGDUMP)
+
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
new file mode 100644
index 0000000..e1c81a0
--- /dev/null
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -0,0 +1,15084 @@
+/*
+ * 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 csrApiRoam.c
+  
+    Implementation for the Common Roaming interfaces.
+  
+    Copyright (C) 2008 Qualcomm, Incorporated
+  
+ 
+   ========================================================================== */
+
+/*===========================================================================
+
+                      EDIT HISTORY FOR FILE
+
+
+  This section contains comments describing changes made to the module.
+  Notice that changes are listed in reverse chronological order.
+
+
+
+  when            who                 what, where, why
+----------       ---                --------------------------------------------------------
+06/03/10     js                     Added support to hostapd driven 
+ *                                  deauth/disassoc/mic failure
+
+===========================================================================*/
+
+#include "aniGlobal.h" //for tpAniSirGlobal
+#include "wlan_qct_wda.h"
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "halMsgApi.h" //for HAL_STA_INVALID_IDX.
+#endif
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halPhyApi.h"
+#include "halInternal.h"
+#endif
+
+#include "palApi.h"
+#include "csrInsideApi.h"
+#include "smsDebug.h"
+#include "logDump.h"
+#include "smeQosInternal.h"
+#include "wlan_qct_tl.h"
+#include "smeInside.h"
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+#include "csrApi.h"
+#include "pmc.h"
+#include "vos_nvitem.h"
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#include "csrNeighborRoam.h"
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
+#ifdef FEATURE_WLAN_CCX
+#include "csrCcx.h"
+#endif /* FEATURE_WLAN_CCX */
+
+#define CSR_NUM_IBSS_START_CHANNELS_50      4
+#define CSR_NUM_IBSS_START_CHANNELS_24      3
+#define CSR_DEF_IBSS_START_CHANNEL_50       36
+#define CSR_DEF_IBSS_START_CHANNEL_24       1
+#define CSR_IBSS_JOIN_TIMEOUT_PERIOD        ( 1 *  PAL_TIMER_TO_SEC_UNIT )  // 1 second
+#define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD         ( 50 * PAL_TIMER_TO_SEC_UNIT )  // 50 seconds, for WPA, WPA2, CCKM
+#define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD         ( 120 * PAL_TIMER_TO_SEC_UNIT )  // 120 seconds, for WPS
+/*---------------------------------------------------------------------------
+  OBIWAN recommends [8 10]% : pick 9% 
+---------------------------------------------------------------------------*/
+#define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9
+
+/*---------------------------------------------------------------------------
+  OBIWAN recommends -85dBm 
+---------------------------------------------------------------------------*/
+#define CSR_VCC_RSSI_THRESHOLD 80
+#define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD   500 //ms
+#define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms
+#define CSR_MIN_TL_STAT_QUERY_PERIOD       500 //ms
+#define CSR_DIAG_LOG_STAT_PERIOD           3000 //ms
+
+//We use constatnt 4 here
+//This macro returns true when higher AC parameter is bigger than lower AC for a difference
+//The bigger the number, the less chance of TX
+//It must put lower AC as the first parameter.
+#define SME_DETECT_AC_WEIGHT_DIFF(loAC, hiAC)   (v_BOOL_t)(((hiAC) > (loAC)) ? (((hiAC)-(loAC)) > 4) : 0)
+
+//Flag to send/do not send disassoc frame over the air
+#define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1
+
+#define RSSI_HACK_BMPS (-40)
+/*-------------------------------------------------------------------------- 
+  Static Type declarations
+  ------------------------------------------------------------------------*/
+static tChannelListWithPower csrRoamPowerTableFromEeprom[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+static tChannelListWithPower csrRoamPowerTableFromEeprom40MHz[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+static tCsrRoamSession       csrRoamRoamSession[CSR_ROAM_SESSION_MAX];
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+int diagAuthTypeFromCSRType(eCsrAuthType authType)
+{
+    int n = AUTH_OPEN;
+
+    switch(authType)
+    {
+    case eCSR_AUTH_TYPE_SHARED_KEY:
+        n = AUTH_SHARED;
+        break;
+
+    case eCSR_AUTH_TYPE_WPA:
+        n = AUTH_WPA_EAP;
+        break;
+
+    case eCSR_AUTH_TYPE_WPA_PSK:
+        n = AUTH_WPA_PSK;
+        break;
+
+    case eCSR_AUTH_TYPE_RSN:
+        n = AUTH_WPA2_EAP;
+        break;
+
+    case eCSR_AUTH_TYPE_RSN_PSK:
+        n = AUTH_WPA2_PSK;
+        break;
+#ifdef FEATURE_WLAN_WAPI
+    case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
+        n = AUTH_WAPI_CERT;
+        break;
+
+    case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
+        n = AUTH_WAPI_PSK;
+        break;
+#endif /* FEATURE_WLAN_WAPI */
+
+    default:
+        break;
+    }
+
+    return (n);
+}
+
+int diagEncTypeFromCSRType(eCsrEncryptionType encType)
+{
+    int n = ENC_MODE_OPEN;
+
+    switch(encType)
+    {
+    case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+    case eCSR_ENCRYPT_TYPE_WEP40:
+        n = ENC_MODE_WEP40;
+        break;
+
+    case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+    case eCSR_ENCRYPT_TYPE_WEP104:
+        n = ENC_MODE_WEP104;
+        break;
+
+    case eCSR_ENCRYPT_TYPE_TKIP:
+        n = ENC_MODE_TKIP;
+        break;
+
+    case eCSR_ENCRYPT_TYPE_AES:
+        n = ENC_MODE_AES;
+        break;
+
+#ifdef FEATURE_WLAN_WAPI
+    case eCSR_ENCRYPT_TYPE_WPI:
+        n = ENC_MODE_SMS4;
+        break;
+#endif /* FEATURE_WLAN_WAPI */
+    default:
+        break;
+    }
+
+    return (n);
+}
+
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40,  44,  48}; 
+static const tANI_U8 csrStartIbssChannels24[ CSR_NUM_IBSS_START_CHANNELS_24 ] = { 1, 6, 11 };
+
+static void initConfigParam(tpAniSirGlobal pMac);
+static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand,
+                                       eCsrRoamCompleteResult Result, void *Context );
+static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                    tCsrRoamProfile *pProfile, 
+                                    tANI_BOOLEAN *pfSameIbss );
+static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss );
+static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                     tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes);
+static tAniCBSecondaryMode csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes);
+eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
+static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result );
+eHalStatus csrRoamOpen(tpAniSirGlobal pMac);
+eHalStatus csrRoamClose(tpAniSirGlobal pMac);
+void csrRoamMICErrorTimerHandler(void *pv);
+void csrRoamTKIPCounterMeasureTimerHandler(void *pv);
+tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2);
+ 
+static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval);
+static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId);
+static void csrRoamRoamingTimerHandler(void *pv);
+eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval);
+eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId);
+static void csrRoamIbssJoinTimerHandler(void *pv);
+eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval);
+eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac);
+static void csrRoamWaitForKeyTimeOutHandler(void *pv);
+ 
+static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo);
+static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo );
+eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+           tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, 
+           tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection,
+           tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, 
+           tANI_U8 *pKeyRsc );
+static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                    tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, 
+                                    tCsrRoamProfile *pProfile );
+void csrRoamStatisticsTimerHandler(void *pv);
+void csrRoamStatsGlobalClassDTimerHandler(void *pv);
+
+static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid);
+VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, 
+                                            v_U8_t  rssiNotification, 
+                                            void * context);
+static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId);
+void csrRoamVccTrigger(tpAniSirGlobal pMac);
+eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId);
+/*
+    pStaEntry is no longer invalid upon the return of this function.
+*/
+static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry);
+
+#ifdef WLAN_SOFTAP_FEATURE
+static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand );
+#else
+static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, tANI_U8 operationChn, eCsrBand *pBand );
+#endif
+static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc);
+
+
+tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac,
+                                                     tDblLinkList *pStaList,
+                                                     tCsrStatsClientReqInfo *pStaEntry);
+void csrRoamStatsClientTimerHandler(void *pv);
+tCsrPeStatsReqInfo *  csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask, 
+                                                 tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId);
+void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, 
+                             tCsrStatsCallback callback, tANI_U8 staId, void *pContext);
+void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE tlStats);
+void csrRoamTlStatsTimerHandler(void *pv);
+void csrRoamPeStatsTimerHandler(void *pv);
+tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask);
+void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry);
+tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask);
+eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac);
+static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac );
+static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc );
+static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId );
+static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                             tCsrRoamSetKey *pSetKey, tANI_U32 roamId );
+//static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc);
+void csrRoamReissueRoamCommand(tpAniSirGlobal pMac);
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+void csrRoamJoinRetryTimerHandler(void *pv);
+#endif
+extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
+extern void btampEstablishLogLinkHdlr(void* pMsg);
+
+static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp);
+
+//Initialize global variables
+static void csrRoamInitGlobals(tpAniSirGlobal pMac)
+{
+    if(pMac)
+    {
+        pMac->roam.powerTableFromEeprom      = csrRoamPowerTableFromEeprom;
+        pMac->roam.powerTableFromEeprom40MHz = csrRoamPowerTableFromEeprom40MHz;
+        pMac->roam.roamSession               = csrRoamRoamSession;
+    }
+    return;
+}
+
+
+static void csrRoamDeInitGlobals(tpAniSirGlobal pMac)
+{
+    if(pMac)
+    {
+        pMac->roam.powerTableFromEeprom      = NULL;
+        pMac->roam.powerTableFromEeprom40MHz = NULL;
+        pMac->roam.roamSession               = NULL;
+    }
+    return;
+}
+
+eHalStatus csrOpen(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    static uNvTables nvTables;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+    v_REGDOMAIN_t regId;
+    tANI_U32 i;
+    
+    do
+    {
+        /* Initialize CSR Roam Globals */
+        csrRoamInitGlobals(pMac);
+
+        for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+           csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i);
+
+        initConfigParam(pMac);
+        if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac))))
+            break;
+        if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac))))
+            break;
+        pMac->roam.nextRoamId = 1;  //Must not be 0
+        if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList)))
+           break;
+        if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList)))
+           break;
+        if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList)))
+           break;
+
+        vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
+        if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+            palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, 
+                    nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
+            status = eHAL_STATUS_SUCCESS;
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL("  fail to get NV_FIELD_IMAGE\n") );
+            //hardcoded for now
+            pMac->scan.countryCodeDefault[0] = 'U';
+            pMac->scan.countryCodeDefault[1] = 'S';
+            pMac->scan.countryCodeDefault[2] = 'I';
+            //status = eHAL_STATUS_SUCCESS;
+        }
+        smsLog( pMac, LOGE, FL(" country Code from nvRam %s\n"), pMac->scan.countryCodeDefault );
+
+        csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, &regId);
+
+        WDA_SetRegDomain(pMac, regId);
+        pMac->scan.domainIdDefault = regId;
+        pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
+
+        status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, 
+                         pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN);
+        status = csrInitGetChannels( pMac );
+
+    }while(0);
+    
+    return (status);
+}
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrSetRegInfo(tHalHandle hHal,  tANI_U8 *apCntryCode)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    v_REGDOMAIN_t regId;
+    v_U8_t        cntryCodeLength;
+
+    if(NULL == apCntryCode)
+    {
+       smsLog( pMac, LOGW, FL(" Invalid country Code Pointer\n") );
+       return eHAL_STATUS_FAILURE;
+    }
+
+    smsLog( pMac, LOGW, FL(" country Code %s\n"), apCntryCode );
+
+    /* To get correct Regulatory domain from NV table 
+     * 2 character Country code should be used
+     * 3rd charater is optional for indoor/outdoor setting */
+    cntryCodeLength = strlen(apCntryCode);
+
+    status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, &regId);
+    if (status != eHAL_STATUS_SUCCESS)
+    {
+        smsLog( pMac, LOGE, FL("  fail to get regId for country Code %s\n"), apCntryCode );
+        return status;
+    }
+
+    status = WDA_SetRegDomain(hHal, regId);
+    if (status != eHAL_STATUS_SUCCESS)
+    {
+        smsLog( pMac, LOGE, FL("  fail to get regId for country Code %s\n"), apCntryCode );
+        return status;
+    }
+
+    pMac->scan.domainIdDefault = regId;
+    pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
+
+    /* Clear CC field */
+    palFillMemory( pMac->hHdd,
+                   pMac->scan.countryCodeDefault,
+                   WNI_CFG_COUNTRY_CODE_LEN,
+                   0 );
+    /* Copy 2 or 3 bytes country code */
+    palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, 
+                apCntryCode, cntryCodeLength );
+
+    /* If 2 bytes country code, 3rd byte must be filled with space */
+    if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength)
+    {
+       palFillMemory( pMac->hHdd,
+                      pMac->scan.countryCodeDefault + 2,
+                      1,
+                      0x20 );
+    }
+
+    status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, 
+                               pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN);
+    status = csrInitGetChannels( pMac );
+
+    return status;
+}
+
+eHalStatus csrSetChannels(tHalHandle hHal,  tCsrConfigParam *pParam  )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U8   index = 0;
+
+    palCopyMemory( pMac->hHdd, pParam->Csr11dinfo.countryCode, 
+                   pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN );
+
+    for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++)
+    {
+        pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ];
+        pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ];
+        pParam->Csr11dinfo.ChnPower[index].numChannels = 1;
+        pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr;
+    }
+    pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels;
+    
+    return status;
+}
+#endif
+
+eHalStatus csrClose(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    
+    csrStop(pMac);
+    csrRoamClose(pMac);
+    csrScanClose(pMac);
+    csrLLClose(&pMac->roam.statsClientReqList);
+    csrLLClose(&pMac->roam.peStatsReqList);
+    csrLLClose(&pMac->roam.roamCmdPendingList);
+
+    /* DeInit Globals */
+    csrRoamDeInitGlobals(pMac);
+
+    return (status);
+} 
+
+eHalStatus csrStart(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 i;
+ 
+    do
+    {
+       //save the global vos context
+        pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac);
+        for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+           csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i );
+
+        status = csrRoamStart(pMac);
+        if(!HAL_STATUS_SUCCESS(status)) break;
+        pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE;
+        status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac);
+        if(!HAL_STATUS_SUCCESS(status)) break;
+        pMac->roam.sPendingCommands = 0;
+        csrScanEnable(pMac);
+#if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
+        status = csrNeighborRoamInit(pMac);
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+        pMac->roam.tlStatsReqInfo.numClient = 0;
+        pMac->roam.tlStatsReqInfo.periodicity = 0;
+        pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
+        //init the link quality indication also
+        pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND;
+        if(!HAL_STATUS_SUCCESS(status)) 
+        {
+           smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk \n");
+           break;
+        }
+    }while(0);
+
+#if defined(ANI_LOGDUMP)
+    csrDumpInit(pMac);
+#endif //#if defined(ANI_LOGDUMP)
+
+    return (status);
+}
+
+
+eHalStatus csrStop(tpAniSirGlobal pMac)
+{
+    tANI_U32 sessionId;
+    tANI_U32 i;
+
+    for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+    {
+        csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
+    }
+
+    csrScanDisable(pMac);
+    pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
+    pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
+
+    csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE );
+    
+#if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
+    csrNeighborRoamClose(pMac);
+#endif
+    csrScanFlushResult(pMac); //Do we want to do this?
+
+    // deregister from PMC since we register during csrStart()
+    // (ignore status since there is nothing we can do if it fails)
+    (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady);
+
+    //Reset the domain back to the deault
+    pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
+    csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE);
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+       csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i );
+       pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE;
+    }
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+
+eHalStatus csrReady(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    csrScanGetSupportedChannels( pMac );
+    //WNI_CFG_VALID_CHANNEL_LIST should be set by this time
+    //use it to init the background scan list
+    csrInitBGScanChannelList(pMac);
+    /* HDD issues the init scan */
+    csrScanStartResultAgingTimer(pMac);
+
+    //Store the AC weights in TL for later use
+    WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
+
+    status = csrInitChannelList( pMac );
+    if ( ! HAL_STATUS_SUCCESS( status ) )
+    {
+       smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d\n",
+               status );
+    }
+
+    return (status);
+}
+
+void csrSetDefaultDot11Mode( tpAniSirGlobal pMac )
+{
+    v_U32_t wniDot11mode = 0;
+
+    wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode);
+    ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE);
+}
+
+void csrSetGlobalCfgs( tpAniSirGlobal pMac )
+{
+    ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED,
+                        ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), 
+                        NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE);
+    //Enable channel bonding at init; for 2.4 Ghz we will update this CFG at start BSS or join 
+    ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, WNI_CFG_CHANNEL_BONDING_MODE_ENABLE, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE);
+    
+    //Update the operating mode to configured value during initialization,
+    //So that client can advertise full capabilities in Probe request frame.
+    csrSetDefaultDot11Mode( pMac );    
+}
+
+
+eHalStatus csrRoamOpen(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 i;
+    tCsrRoamSession *pSession;
+
+    do
+    {
+        for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+        {
+            pSession = CSR_GET_SESSION( pMac, i );
+            pSession->roamingTimerInfo.pMac = pMac;
+            pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+        }
+
+        pMac->roam.WaitForKeyTimerInfo.pMac = pMac;
+        pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+        status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, 
+                                &pMac->roam.WaitForKeyTimerInfo);
+      if(!HAL_STATUS_SUCCESS(status))
+      {
+        smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer\n"));
+        break;
+      }
+
+      status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac);
+      if(!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer\n"));
+         return eHAL_STATUS_FAILURE;
+      }
+    }while (0);
+
+    return (status);
+}
+
+
+eHalStatus csrRoamClose(tpAniSirGlobal pMac)
+{
+    tANI_U32 sessionId;
+
+    for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+    {
+        csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
+    }
+
+    palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey);
+    palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey);
+
+    palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
+    palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+
+eHalStatus csrRoamStart(tpAniSirGlobal pMac)
+{
+    (void)pMac;
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+
+void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+   csrRoamStopRoamingTimer(pMac, sessionId);
+   /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/
+   csrRoamDeregStatisticsReq(pMac);
+}
+
+eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if( pState )
+    {
+        status = eHAL_STATUS_SUCCESS;
+        *pState = pMac->roam.roamSession[sessionId].connectState;
+    }    
+    return (status);
+}
+
+
+
+eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tANI_U32 size = 0;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    if(pProfile)
+    {
+        if(pSession->pConnectBssDesc)
+        {
+            do
+            {
+                size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length);
+                if(size)
+                {
+                    status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size);
+                    if(HAL_STATUS_SUCCESS(status))
+                    {
+                        palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size);
+                    }
+                    else
+                        break;
+                }
+                else
+                {
+                    pProfile->pBssDesc = NULL;
+                }
+                pProfile->AuthType = pSession->connectedProfile.AuthType;
+                pProfile->EncryptionType = pSession->connectedProfile.EncryptionType;
+                pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType;
+                pProfile->BSSType = pSession->connectedProfile.BSSType;
+                pProfile->operationChannel = pSession->connectedProfile.operationChannel;
+                pProfile->CBMode = pSession->connectedProfile.CBMode;
+                palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid));
+                palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                if (pSession->connectedProfile.MDID.mdiePresent)
+                {
+                    pProfile->MDID.mdiePresent = 1;
+                    pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain;
+                }
+                else
+                {
+                    pProfile->MDID.mdiePresent = 0;
+                    pProfile->MDID.mobilityDomain = 0;
+                }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+                pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc;
+
+                if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType))
+                {
+                    palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, 
+                        pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN );
+                    pProfile->ccxCckmInfo.reassoc_req_num=
+                        pSession->connectedProfile.ccxCckmInfo.reassoc_req_num;
+                    pProfile->ccxCckmInfo.krk_plumbed = 
+                        pSession->connectedProfile.ccxCckmInfo.krk_plumbed;
+                }
+#endif
+            }while(0);
+        }
+    }
+    
+    return (status);
+}
+
+
+
+eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    
+    if(csrIsConnStateConnected(pMac, sessionId))
+    {
+        if(pProfile)
+        {
+            status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile);
+        }
+    }
+
+    return (status);
+}
+
+eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    
+    if(pProfile->pBssDesc)
+    {
+        palFreeMemory(pMac->hHdd, pProfile->pBssDesc);
+    }
+    palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile));
+    pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN;
+    return (status);
+}
+
+
+static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    if( pConnectedInfo->pbFrames )
+    {
+        palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames );
+        pConnectedInfo->pbFrames = NULL;
+    }
+    pConnectedInfo->nBeaconLength = 0;
+    pConnectedInfo->nAssocReqLength = 0;
+    pConnectedInfo->nAssocRspLength = 0;
+    pConnectedInfo->staId = 0;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    pConnectedInfo->nRICRspLength = 0;
+#endif    
+#ifdef FEATURE_WLAN_CCX
+    pConnectedInfo->nTspecIeLength = 0;
+#endif    
+
+
+    return ( status );
+}
+
+
+    
+                
+void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    csrReinitRoamCmd(pMac, pCommand);
+    csrReleaseCommand( pMac, pCommand );
+}
+
+
+void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    csrReinitScanCmd(pMac, pCommand);
+    csrReleaseCommand( pMac, pCommand );
+}
+
+
+void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    csrReinitWmStatusChangeCmd(pMac, pCommand);
+    csrReleaseCommand( pMac, pCommand );
+}
+
+
+void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd));
+}
+
+
+void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd));
+}
+
+
+void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    csrReinitSetKeyCmd(pMac, pCommand);
+    csrReleaseCommand( pMac, pCommand );
+}
+
+void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    csrReinitRemoveKeyCmd(pMac, pCommand);
+    csrReleaseCommand( pMac, pCommand );
+}
+
+void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
+{
+
+    if( eSmeCsrCommandMask & pCommand->command )
+    {
+        switch (pCommand->command)
+        {
+        case eSmeCommandScan:
+            // We need to inform the requester before droping the scan command
+            smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X\n", 
+                __FUNCTION__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback);
+            if (NULL != pCommand->u.scanCmd.callback)
+            {
+                smsLog( pMac, LOGW, "%s callback scan requester\n", __FUNCTION__);
+                csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT);
+            }
+            csrReleaseCommandScan( pMac, pCommand );
+            break;
+
+        case eSmeCommandRoam:
+            csrReleaseCommandRoam( pMac, pCommand );
+            break;
+
+        case eSmeCommandWmStatusChange:
+            csrReleaseCommandWmStatusChange( pMac, pCommand );
+            break;
+
+        case eSmeCommandSetKey:
+            csrReleaseCommandSetKey( pMac, pCommand );
+            break;
+
+        case eSmeCommandRemoveKey:
+            csrReleaseCommandRemoveKey( pMac, pCommand );
+            break;
+
+    default:
+            smsLog( pMac, LOGW, " CSR abort standard command %d\n", pCommand->command );
+            csrReleaseCommand( pMac, pCommand );
+            break;
+        }
+    }
+}
+
+
+
+void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId)
+{
+    smsLog( pMac, LOG1, "   CSR RoamSubstate: [ %d <== %d ]\n", NewSubstate, pMac->roam.curSubState[sessionId]);
+
+
+    if(pMac->roam.curSubState[sessionId] == NewSubstate)
+    {
+       return;
+                }
+    pMac->roam.curSubState[sessionId] = NewSubstate;
+}
+
+
+eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId)
+{
+    eCsrRoamState PreviousState;
+          
+    smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]\n", NewRoamState, pMac->roam.curState[sessionId]);
+
+    PreviousState = pMac->roam.curState[sessionId];
+    
+    if ( NewRoamState != pMac->roam.curState[sessionId] ) 
+    {
+        // Whenever we transition OUT of the Roaming state, clear the Roaming substate...
+        if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) 
+        {
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId );
+        }
+
+        pMac->roam.curState[sessionId] = NewRoamState;
+    }
+    return( PreviousState );
+}
+
+
+void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset)
+{
+    int i;
+
+    if(catOffset)
+    {
+        pMac->roam.configParam.bCatRssiOffset = catOffset;
+        for(i = 0; i < CSR_NUM_RSSI_CAT; i++)
+        {
+            pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset);
+        }
+    }
+}
+
+
+static void initConfigParam(tpAniSirGlobal pMac)
+{
+    int i;
+
+    pMac->roam.configParam.agingCount = CSR_AGING_COUNT;
+    pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+    pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
+    pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS;
+    pMac->roam.configParam.eBand = eCSR_BAND_ALL;
+    pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
+    pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT;
+    pMac->roam.configParam.HeartbeatThresh24 = 40;
+    pMac->roam.configParam.HeartbeatThresh50 = 40;
+    pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE;
+    pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.RTSThreshold = 2346;
+    pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE;
+    pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto;
+    pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE;
+    pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO;
+    pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL;
+    pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS;  
+    pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS;   
+    pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS;   
+    pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS;   
+    for(i = 0; i < CSR_NUM_RSSI_CAT; i++)
+    {
+        pMac->roam.configParam.BssPreferValue[i] = i;
+    }
+    csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP);
+    pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME;
+    pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE;
+
+    pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE;
+    pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME;
+    pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME;
+    pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME;
+    pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME;
+
+    pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default
+    pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER;
+    pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD;
+    pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200;
+    pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3;
+    pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1;
+    pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6;
+    pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11;
+    pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds
+#endif
+
+    pMac->roam.configParam.addTSWhenACMIsOff = 0;
+    pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE;
+}
+
+eCsrBand csrGetCurrentBand(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    return pMac->roam.configParam.bandCapability;
+}
+
+eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    
+    if (CSR_IS_PHY_MODE_A_ONLY(pMac) &&
+            (eBand == eCSR_BAND_24))
+    {
+        /* DOT11 mode configured to 11a only and received 
+           request to change the band to 2.4 GHz */
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+            "failed to set band cfg80211 = %u, band = %u\n",  
+            pMac->roam.configParam.uCfgDot11Mode, eBand);
+        return eHAL_STATUS_INVALID_PARAMETER;
+    }
+
+    if ((CSR_IS_PHY_MODE_B_ONLY(pMac) ||
+                CSR_IS_PHY_MODE_G_ONLY(pMac)) &&
+            (eBand == eCSR_BAND_5G))
+    {
+        /* DOT11 mode configured to 11b/11g only and received 
+           request to change the band to 5 GHz */
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+            "failed to set band dot11mode = %u, band = %u\n",  
+            pMac->roam.configParam.uCfgDot11Mode, eBand);
+        return eHAL_STATUS_INVALID_PARAMETER;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+            "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)\n", eBand);
+    pMac->roam.configParam.eBand = eBand; 
+    pMac->roam.configParam.bandCapability = eBand; 
+    csrScanGetSupportedChannels( pMac );
+    status = csrInitGetChannels( pMac );
+    if (eHAL_STATUS_SUCCESS == status)
+        csrInitChannelList( hHal );
+    return status;
+}
+
+eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    if(pParam)
+    {
+        pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode;
+        pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled;
+        pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold;
+        pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled;
+        pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled;
+        pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled;
+
+        pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode;
+        pMac->roam.configParam.channelBondingMode24GHz = pParam->channelBondingMode24GHz;
+        pMac->roam.configParam.channelBondingMode5GHz = pParam->channelBondingMode5GHz;
+        pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold;
+        pMac->roam.configParam.phyMode = pParam->phyMode;
+        pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime;
+        pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24;
+        pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50;
+        pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled;
+        pMac->roam.configParam.TxRate = pParam->TxRate;
+        pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24;
+        pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G;
+        pMac->roam.configParam.bandCapability = pParam->bandCapability;
+        pMac->roam.configParam.cbChoice = pParam->cbChoice;
+        pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval;
+
+        //if HDD passed down non zero values then only update,
+        //otherwise keep using the defaults
+        if(pParam->nActiveMaxChnTime)
+        {
+            pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime;
+        }
+        if(pParam->nActiveMinChnTime)
+        {
+            pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime;
+        }
+        if(pParam->nPassiveMaxChnTime)
+        {
+            pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime;
+        }
+        if(pParam->nPassiveMinChnTime)
+        {
+            pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime;
+        }
+        //if upper layer wants to disable idle scan altogether set it to 0
+        if(pParam->impsSleepTime)
+        {
+            //Change the unit from second to microsecond
+            tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT;
+
+            if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime)
+            {
+                pMac->roam.configParam.impsSleepTime = impsSleepTime;
+            }
+        else
+        {
+            pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL;
+        }
+        }
+        else
+        {
+            pMac->roam.configParam.impsSleepTime = 0;
+        }
+        pMac->roam.configParam.eBand = pParam->eBand;
+#ifdef WLAN_SOFTAP_FEATURE
+        pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, 
+                                                    pMac->roam.configParam.ProprietaryRatesEnabled);
+#else
+        pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pMac->roam.configParam.phyMode, 
+                                                    pMac->roam.configParam.ProprietaryRatesEnabled);
+#endif
+        //if HDD passed down non zero values for age params, then only update,
+        //otherwise keep using the defaults
+        if(pParam->nScanResultAgeCount)
+        {
+            pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount;
+        }
+
+        if(pParam->scanAgeTimeNCNPS)
+        {
+            pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS;  
+        }
+
+        if(pParam->scanAgeTimeNCPS)
+        {
+            pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS;   
+        }
+
+        if(pParam->scanAgeTimeCNPS)
+        {
+            pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS;   
+        }
+        if(pParam->scanAgeTimeCPS)
+        {
+            pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS;   
+        }
+        
+        csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset);
+        pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime;
+        pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels;
+        pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority;
+        pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch;
+        pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain;
+
+        pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold;
+        pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold;
+
+        pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled;
+        pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity;
+        pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS;
+        //Assign this before calling CsrInit11dInfo
+        pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap;
+
+        if( csrIs11dSupported( pMac ) )
+        {
+            status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo);
+        }
+        else
+        {
+            pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
+        }
+#ifdef WLAN_FEATURE_VOWIFI_11R 
+        palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) );
+        smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d\n", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); 
+#endif
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+        pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled;
+#endif
+
+#ifdef FEATURE_WLAN_CCX 
+        pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled;
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+        palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) );
+
+        smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod);
+        smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold);  
+        smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold);  
+        smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); 
+        smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime);
+        smsLog( pMac, LOG1, "nMaxNeighborRetries = %d\n", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); 
+        smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); 
+
+        {
+           int i;
+           smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d\n"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); 
+
+           for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++)
+           {
+              smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] );
+           }
+           smsLog( pMac, LOG1, "\n");
+        }
+#endif
+
+        pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff;
+        pMac->scan.fValidateList = pParam->fValidateList;
+        pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d;
+        pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan;
+        pMac->roam.configParam.fScanTwice = pParam->fScanTwice;
+    }
+    
+    return status;
+}
+
+
+eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if(pParam)
+    {
+        pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode;
+        pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled;
+        pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold;
+        pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled;
+        pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal;
+        pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled;
+        pParam->channelBondingMode24GHz = pMac->roam.configParam.channelBondingMode24GHz;
+        pParam->channelBondingMode5GHz = pMac->roam.configParam.channelBondingMode5GHz;
+        pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold;
+        pParam->phyMode = pMac->roam.configParam.phyMode;
+        pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime;
+        pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24;
+        pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50;
+        pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled;
+        pParam->TxRate = pMac->roam.configParam.TxRate;
+        pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24;
+        pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G;
+        pParam->bandCapability = pMac->roam.configParam.bandCapability;
+        pParam->cbChoice = pMac->roam.configParam.cbChoice;
+        pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval;
+
+        pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+        pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime;
+        pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
+        pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+
+        //Change the unit from microsecond to second
+        pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT;
+        pParam->eBand = pMac->roam.configParam.eBand;
+        pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount;
+        pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS;  
+        pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS;   
+        pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS;   
+        pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS;   
+        pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset;
+        pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime;
+        pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels;
+        pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority;
+        pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch;
+        pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain;        
+        pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold;
+        pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold;
+
+        pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled;
+        pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap;
+        pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity;
+        pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS;
+
+        pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff;
+        pParam->fValidateList = pMac->roam.configParam.fValidateList;
+        pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d;
+        pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan;
+        pParam->fScanTwice = pMac->roam.configParam.fScanTwice;
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+        palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) );
+#endif
+
+        csrSetChannels(pMac, pParam);
+
+        status = eHAL_STATUS_SUCCESS;
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE;
+    eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO;
+
+    do
+    {
+        if(eCSR_BAND_24 == eBand)
+        {
+            if(CSR_IS_RADIO_A_ONLY(pMac)) break;
+            if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break;
+        }
+        if(eCSR_BAND_5G == eBand)
+        {
+            if(CSR_IS_RADIO_BG_ONLY(pMac)) break;
+            if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) ||
+                (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) 
+                ) 
+            {
+                break;
+            }
+        }
+        if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
+        {
+            newPhyMode = eCSR_DOT11_MODE_TAURUS;
+        }
+        else if(eCSR_DOT11_MODE_AUTO & phyMode)
+        {
+            newPhyMode = eCSR_DOT11_MODE_AUTO;
+        }
+        else
+        {
+            //Check for dual band and higher capability first
+            if(eCSR_DOT11_MODE_11n_ONLY & phyMode)
+            {
+                if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break;
+                newPhyMode = eCSR_DOT11_MODE_11n_ONLY;
+            }
+            else if(eCSR_DOT11_MODE_11a_ONLY & phyMode)
+            {
+                if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break;
+                if(eCSR_BAND_24 == eBand) break;
+                newPhyMode = eCSR_DOT11_MODE_11a_ONLY;
+                eBand = eCSR_BAND_5G;
+            }
+            else if(eCSR_DOT11_MODE_11g_ONLY & phyMode)
+            {
+                if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break;
+                if(eCSR_BAND_5G == eBand) break;
+                newPhyMode = eCSR_DOT11_MODE_11g_ONLY;
+                eBand = eCSR_BAND_24;
+            }
+            else if(eCSR_DOT11_MODE_11b_ONLY & phyMode)
+            {
+                if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break;
+                if(eCSR_BAND_5G == eBand) break;
+                newPhyMode = eCSR_DOT11_MODE_11b_ONLY;
+                eBand = eCSR_BAND_24;
+            }
+            else if(eCSR_DOT11_MODE_11n & phyMode)
+            {
+                newPhyMode = eCSR_DOT11_MODE_11n;
+            }
+            else if(eCSR_DOT11_MODE_abg & phyMode)
+            {
+                newPhyMode = eCSR_DOT11_MODE_abg;
+            }
+            else if(eCSR_DOT11_MODE_11a & phyMode)
+            {
+                if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode))
+                {
+                    if(eCSR_BAND_ALL == eBand)
+                    {
+                        newPhyMode = eCSR_DOT11_MODE_abg;
+                    }
+                    else
+                    {
+                        //bad setting
+                        break;
+                    }
+                }
+                else
+                {
+                    newPhyMode = eCSR_DOT11_MODE_11a;
+                    eBand = eCSR_BAND_5G;
+                }
+            }
+            else if(eCSR_DOT11_MODE_11g & phyMode)
+            {
+                newPhyMode = eCSR_DOT11_MODE_11g;
+                eBand = eCSR_BAND_24;
+            }
+            else if(eCSR_DOT11_MODE_11b & phyMode)
+            {
+                newPhyMode = eCSR_DOT11_MODE_11b;
+                eBand = eCSR_BAND_24;
+            }
+            else
+            {
+                //We will never be here
+                smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X\n"), phyMode );
+                newPhyMode = eCSR_DOT11_MODE_AUTO;
+            }
+        }
+
+        //Done validating
+        status = eHAL_STATUS_SUCCESS;
+
+        //Now we need to check whether a restart is needed.
+        if(eBand != pMac->roam.configParam.eBand)
+        {
+            fRestartNeeded = eANI_BOOLEAN_TRUE;
+            break;
+        }
+        if(newPhyMode != pMac->roam.configParam.phyMode)
+        {
+            fRestartNeeded = eANI_BOOLEAN_TRUE;
+            break;
+        }
+
+    }while(0);
+
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        pMac->roam.configParam.eBand = eBand;
+        pMac->roam.configParam.phyMode = newPhyMode;
+        if(pfRestartNeeded)
+        {
+            *pfRestartNeeded = fRestartNeeded;
+        }
+    }
+
+    return (status);
+}
+    
+
+void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList )
+{
+    tANI_U8 Index;
+    tANI_U8 cChannels;
+
+    // for dual band NICs, don't need to trim the channel list....
+    if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) )
+    {
+        // 2.4 GHz band operation requires the channel list to be trimmed to
+        // the 2.4 GHz channels only...
+        if ( CSR_IS_24_BAND_ONLY( pMac ) )
+        {
+            for( Index = 0, cChannels = 0; Index < pChannelList->numChannels;
+                 Index++ )
+            {
+                if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) )
+                {
+                    pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ];
+                    cChannels++;
+                }
+            }
+
+            // Cleanup the rest of channels.   Note we only need to clean up the channels if we had
+            // to trim the list.  Calling palZeroMemory() with a 0 size is going to throw asserts on 
+            // the debug builds so let's be a bit smarter about that.  Zero out the reset of the channels
+            // only if we need to.
+            //
+            // The amount of memory to clear is the number of channesl that we trimmed 
+            // (pChannelList->numChannels - cChannels) times the size of a channel in the structure.
+           
+            if ( pChannelList->numChannels > cChannels )
+            {
+                palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ],
+                               sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) );
+                
+            }
+            
+            pChannelList->numChannels = cChannels;
+        }
+        else if ( CSR_IS_5G_BAND_ONLY( pMac ) )
+        {
+            for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ )
+            {
+                if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) )
+                {
+                    pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ];
+                    cChannels++;
+                }
+            }
+
+            // Cleanup the rest of channels.   Note we only need to clean up the channels if we had
+            // to trim the list.  Calling palZeroMemory() with a 0 size is going to throw asserts on 
+            // the debug builds so let's be a bit smarter about that.  Zero out the reset of the channels
+            // only if we need to.
+            //
+            // The amount of memory to clear is the number of channesl that we trimmed 
+            // (pChannelList->numChannels - cChannels) times the size of a channel in the structure.
+            if ( pChannelList->numChannels > cChannels )
+            {
+                palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ],
+                               sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) );
+            }            
+                               
+            pChannelList->numChannels = cChannels;
+        }
+    }
+
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define INFRA_AP_DEFAULT_CHANNEL 6
+eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum)
+{
+    tANI_U8 index= 0;
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++)
+    {
+        if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){
+            status = eHAL_STATUS_SUCCESS;
+            break;
+        }
+    }
+    return status;
+}
+#endif
+
+eHalStatus csrInitGetChannels(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U8 num20MHzChannelsFound = 0;
+    VOS_STATUS vosStatus;
+    tANI_U8 Index = 0;
+    tANI_U8 num40MHzChannelsFound = 0;
+
+    
+    //TODO: this interface changed to include the 40MHz channel list
+    // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation
+    // Read the scan channel list (including the power limit) from EEPROM
+    vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, 
+                        pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound);
+    if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) )
+    {
+        smsLog( pMac, LOGE, FL("failed to get channels \n"));
+        status = eHAL_STATUS_FAILURE;
+    }
+    else
+    {
+        if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN )
+        {
+            num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+        }
+        pMac->scan.numChannelsDefault = num20MHzChannelsFound;
+        // Move the channel list to the global data
+        // structure -- this will be used as the scan list
+        for ( Index = 0; Index < num20MHzChannelsFound; Index++)
+        {
+#ifdef FEATURE_WLAN_INTEGRATED_SOC /* Need to fix this while dealing with NV item */
+            pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId;
+#else
+           pMac->scan.base20MHzChannels.channelList[ Index ] = Index + 1;
+           pMac->scan.defaultPowerTable[Index].chanId = Index + 1;
+           pMac->scan.defaultPowerTable[Index].pwr = 25;
+#endif
+        }
+        pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound;
+        if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN)
+        {
+            num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+        }
+        for ( Index = 0; Index < num40MHzChannelsFound; Index++)
+        {
+            pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId;
+        }
+        pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound;
+    }
+
+    return (status);  
+}
+
+
+eHalStatus csrInitChannelList( tHalHandle hHal )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels);
+    csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels);
+    // Apply the base channel list, power info, and set the Country code...
+    csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent );
+ 
+    return (status);
+}
+
+
+eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, 
+                                 tCsrUpdateConfigParam *pUpdateConfigParam)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tCsr11dinfo *ps11dinfo = NULL;
+
+   ps11dinfo = &pUpdateConfigParam->Csr11dinfo;
+   status = CsrInit11dInfo(pMac, ps11dinfo);
+   return status;
+}
+
+
+static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo)
+{
+  eHalStatus status = eHAL_STATUS_FAILURE;
+  tANI_U8  index;
+  tANI_U32 count=0;
+  tSirMacChanInfo *pChanInfo;
+  tSirMacChanInfo *pChanInfoStart;
+  tANI_BOOLEAN applyConfig = TRUE;
+
+  if(!ps11dinfo)
+  {
+     return (status);
+  }
+
+  if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) 
+  {
+    pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels;
+    status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, 
+                           ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels);
+    if(!HAL_STATUS_SUCCESS(status)) return (status);
+  }
+  else
+  {
+     //No change
+     return (eHAL_STATUS_SUCCESS);
+  }
+
+  //legacy maintenance
+  status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, 
+                         ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN);
+  if(!HAL_STATUS_SUCCESS(status)) return (status);
+
+  //Tush: at csropen get this initialized with default, during csr reset if this 
+  // already set with some value no need initilaize with default again
+  if(0 == pMac->scan.countryCodeCurrent[0])
+  {
+     status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, 
+                         ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN);
+     if(!HAL_STATUS_SUCCESS(status)) return (status);
+  }
+
+  // need to add the max power channel list
+  if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN)))
+  {
+      palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN);
+      pChanInfoStart = pChanInfo;
+
+      for(index = 0; index < ps11dinfo->Channels.numChannels; index++)
+      {
+        pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel;
+        pChanInfo->numChannels  = ps11dinfo->ChnPower[index].numChannels;
+        pChanInfo->maxTxPower   = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap );
+        pChanInfo++;
+        count++;
+      }
+      if(count)
+      {
+          csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart );
+      }
+      palFreeMemory(pMac->hHdd, pChanInfoStart);
+  }
+
+  //Only apply them to CFG when not in STOP state. Otherwise they will be applied later
+  if( HAL_STATUS_SUCCESS(status) )
+  {
+      for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ )
+      {
+          if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index))
+          {
+              applyConfig = FALSE;
+          }
+    }
+
+    if(TRUE == applyConfig)
+    {
+        // Apply the base channel list, power info, and set the Country code...
+        csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent );
+    }
+
+  }
+
+  return (status);
+}
+
+//pCommand may be NULL
+//Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL.
+void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason)
+{
+    tListElem *pEntry, *pNextEntry;
+    tSmeCmd *pDupCommand;
+    tDblLinkList localList;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return;
+    }
+    csrLLLock( &pMac->sme.smeCmdPendingList );
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
+    while( pEntry )
+    {
+        pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
+        pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
+        // Remove the previous command if..
+        // - the new roam command is for the same RoamReason...
+        // - the new roam command is a NewProfileList.
+        // - the new roam command is a Forced Dissoc
+        // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID).
+        if ( 
+            (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) &&
+                ((pCommand->command == pDupCommand->command) &&
+                 (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason ||
+                    eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason ||
+                    eCsrHddIssued == pCommand->u.roamCmd.roamReason))) 
+                ||
+            //below the pCommand is NULL
+            ( (sessionId == pDupCommand->sessionId) && (eCsrRoamCommandRoam == pDupCommand->command) &&
+                 ((eCsrForcedDisassoc == eRoamReason) ||
+                    (eCsrHddIssued == eRoamReason))
+               )
+           )
+        {
+            smsLog(pMac, LOGW, FL("   roamReason = %d\n"), pDupCommand->u.roamCmd.roamReason);
+            // Remove the 'stale' roam command from the pending list...
+            if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ))
+            {
+                csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+            }
+        }
+        pEntry = pNextEntry;
+    }
+    csrLLUnlock( &pMac->sme.smeCmdPendingList );
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        //Tell caller that the command is cancelled
+        csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId,
+                                            eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE);
+        csrReleaseCommandRoam(pMac, pDupCommand);
+    }
+    csrLLClose(&localList);
+}
+
+eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, 
+                               tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type);
+#endif
+    tCsrRoamSession *pSession;
+
+    if( CSR_IS_SESSION_VALID( pMac, sessionId) )
+    {
+        pSession = CSR_GET_SESSION( pMac, sessionId );
+    }
+    else
+    {
+       smsLog(pMac, LOGE, "Session ID:%d is not valid\n", sessionId);
+       VOS_ASSERT(0);
+       return eHAL_STATUS_FAILURE;
+    }
+
+    if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo)
+    {
+        smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d\n", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode);
+    }
+
+    if ( (pSession == NULL) ||
+        (eANI_BOOLEAN_FALSE == pSession->sessionActive) )
+    {
+        smsLog(pMac, LOG1, "Session ID is not valid\n");
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if(NULL != pSession->callback)
+    {
+        if( pRoamInfo )
+        {
+            pRoamInfo->sessionId = (tANI_U8)sessionId;
+        }
+
+        /* avoid holding the global lock when making the roaming callback , original change came 
+        from a raised CR (CR304874).  Since this callback is in HDD a potential deadlock 
+        is possible on other OS ports where the callback may need to take locks to protect 
+        HDD state 
+         UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks
+         that may actually depend on the lock being held */
+        // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme );
+        status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2);
+        // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme );
+    }
+    //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, 
+    //                   eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR    
+    palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type));
+    if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2))
+    {
+       connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT;
+       connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType;
+       if(NULL != pRoamInfo->pBssDesc)
+       {
+          connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1);
+          connectionStatus.channel = pRoamInfo->pBssDesc->channelId;
+       }
+
+       connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection;
+       connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType);
+       connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType);
+       palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6);
+       connectionStatus.reason = eCSR_REASON_UNSPECIFIED;
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
+    }
+
+    if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2))
+    {
+       connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
+       connectionStatus.reason = eCSR_REASON_MIC_ERROR;
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
+    }
+
+    if(eCSR_ROAM_RESULT_FORCED == u2)
+    {
+       connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
+       connectionStatus.reason = eCSR_REASON_USER_REQUESTED;
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
+    }
+
+    if(eCSR_ROAM_RESULT_DISASSOC_IND == u2)
+    {
+       connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
+       connectionStatus.reason = eCSR_REASON_DISASSOC;
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
+    }
+
+    if(eCSR_ROAM_RESULT_DEAUTH_IND == u2)
+    {
+       connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
+       connectionStatus.reason = eCSR_REASON_DEAUTH;
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
+    }
+
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+    
+    return (status);
+}
+
+// Returns whether handoff is currently in progress or not
+tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac)
+{
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    return csrNeighborRoamIsHandoffInProgress(pMac);                    
+#else
+    return eANI_BOOLEAN_FALSE;
+#endif
+
+}
+
+eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure )
+{   
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tANI_U16 reasonCode;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    //Restore AC weight in case we change it 
+    if ( csrIsConnStateConnectedInfra( pMac, sessionId ) )
+    {
+        smsLog(pMac, LOGE, FL(" restore AC weights (%d-%d-%d-%d)\n"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1],
+            pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]);
+        WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
+    }
+    
+    if ( fMICFailure )
+    {
+        reasonCode = eSIR_MAC_MIC_FAILURE_REASON;
+    }
+    else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)
+    {
+        reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON;
+    } else 
+    {
+        reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
+    }    
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if ( (csrRoamIsHandoffInProgress(pMac)) && 
+         (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF))
+    {
+        tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+        palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr));
+
+    } else 
+#endif
+    if(pSession->pConnectBssDesc)
+    {
+        palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
+    }
+
+    
+    smsLog( pMac, LOGE, "CSR Attempting to Disassociate Bssid= %02x-%02x-%02x-%02x-%02x-%02x subState = %d\n", 
+                  bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
+                  bssId[ 3 ], bssId[ 4 ], bssId[ 5 ], NewSubstate );    
+
+    csrRoamSubstateChange( pMac, NewSubstate, sessionId);
+
+    status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode );    
+    
+    if(HAL_STATUS_SUCCESS(status)) 
+    {
+        csrRoamLinkDown(pMac, sessionId);
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+        //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO
+        if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate)
+        {
+            //Tush-QoS: notify QoS module that disassoc happening
+            sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL);
+        }
+#endif
+     }
+
+    return (status);
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamIssueDisassociateStaCmd
+    \brief csr function that HDD calls to disassociate a associated station
+    \param sessionId    - session Id for Soft AP
+    \param pPeerMacAddr - MAC of associated station to delete
+    \param reason - reason code, be one of the tSirMacReasonCodes
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, 
+                                           tANI_U32 sessionId, 
+                                           tANI_U8 *pPeerMacAddr,
+                                           tANI_U32 reason)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+
+    do
+    {
+        pCommand = csrGetCommandBuffer( pMac );
+        if ( !pCommand ) 
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer") );
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta;
+        vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6);
+        pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason;
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    }while(0);
+
+    return status;
+}
+
+
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamIssueDeauthSta
+    \brief csr function that HDD calls to delete a associated station
+    \param sessionId    - session Id for Soft AP
+    \param pPeerMacAddr - MAC of associated station to delete
+    \param reason - reason code, be one of the tSirMacReasonCodes
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, 
+                                     tANI_U32 sessionId, 
+                                     tANI_U8 *pPeerMacAddr,
+                                     tANI_U32 reason)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+
+    do
+    {
+        pCommand = csrGetCommandBuffer( pMac );
+        if ( !pCommand ) 
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer") );
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta;
+        vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6);
+        pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason;
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    }while(0);
+
+    return status;
+}
+
+
+
+eHalStatus
+csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                    tANI_BOOLEAN bEnable )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if (!pSession)
+    {
+        smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found\n");
+        return (status);
+    }
+
+    if (pSession->pConnectBssDesc)
+    {
+        palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
+    }
+    else
+    {
+        smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found\n");
+        return (status);
+    }
+
+    smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d\n", 
+                  bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
+                  bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable);
+
+    status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId );
+    return (status);
+}
+
+eHalStatus
+csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                            VOS_MODULE_ID modId,  void *pUsrContext,
+                            void *pfnSapEventCallback, v_U8_t *pAssocStasBuf )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if (!pSession)
+    {
+        smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found\n");
+        return (status);
+    }
+
+    if(pSession->pConnectBssDesc)
+    {
+        palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) );
+    }
+    else
+    {
+        smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found\n");
+        return (status);
+    }
+
+    smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n",
+                  bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
+                  bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );
+
+    status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
+    return (status);
+}
+
+eHalStatus
+csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                             void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    if (!pSession)
+    {
+        smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found\n");
+        return (status);
+    }
+
+    if(pSession->pConnectBssDesc)
+    {
+        palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) );
+    }
+    else
+    {
+        smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found\n");
+        return (status);
+    }
+
+    smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n",
+                  bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
+                  bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );
+     
+    status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac);            
+            
+    return (status);
+}
+
+#endif
+
+eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate )
+{   
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    if(pSession->pConnectBssDesc)
+    {
+        palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
+    }
+
+    smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", 
+                  bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
+                  bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );    
+
+    csrRoamSubstateChange( pMac, NewSubstate, sessionId);
+    
+    status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DISASSOC_LEAVING_BSS_REASON );    
+    
+    return (status);
+}
+
+
+
+eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tANI_U32 size;
+    
+    // If no BSS description was found in this connection (happens with start IBSS), then 
+    // nix the BSS description that we keep around for the connected BSS) and get out...
+    if(NULL == pBssDesc)
+    {
+        csrFreeConnectBssDesc(pMac, sessionId);
+    }
+    else 
+    {
+        size = pBssDesc->length + sizeof( pBssDesc->length );
+        if(NULL != pSession->pConnectBssDesc)
+        {
+            if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size)
+            {
+                //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside
+                csrFreeConnectBssDesc(pMac, sessionId);
+            }
+        }
+        if(NULL == pSession->pConnectBssDesc)
+        {
+            status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); 
+        }
+        if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) 
+        {
+            palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size );    
+        }
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
+                                    tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig,
+                                    tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    eCsrCfgDot11Mode cfgDot11Mode;
+
+#if defined(VOSS_ENABLED)
+    VOS_ASSERT( pIes != NULL );
+#endif
+    
+    do
+    {
+        palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo));
+        //get qos
+        pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes);
+        //get SSID
+        if(pIes->SSID.present)
+        {
+            palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid);
+            pBssConfig->SSID.length = pIes->SSID.num_ssid;
+        }
+        else
+            pBssConfig->SSID.length = 0;
+        if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length))
+        {
+            smsLog(pMac, LOGW, "  BSS desc SSID is a wildcard\n");
+            //Return failed if profile doesn't have an SSID either.
+            if(pProfile->SSIDs.numOfSSIDs == 0)
+            {
+                smsLog(pMac, LOGW, "  Both BSS desc and profile doesn't have SSID\n");
+                status = eHAL_STATUS_FAILURE;
+                break;
+            }
+        }
+        if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId))
+        {
+            pBssConfig->eBand = eCSR_BAND_5G;
+        }
+        else
+        {
+            pBssConfig->eBand = eCSR_BAND_24;
+        }
+        //phymode
+        if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ))
+        {
+            pBssConfig->uCfgDot11Mode = cfgDot11Mode;
+        }
+        else 
+        {
+            smsLog(pMac, LOGW, "   Can not find match phy mode\n");
+            //force it
+            if(eCSR_BAND_24 == pBssConfig->eBand)
+            {
+                pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+            }
+            else
+            {
+                pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+            }
+        }
+
+        //Qos
+        if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) &&
+                (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos))
+        {
+            //Joining BSS is not 11n capable and WMM is disabled on client.
+            //Disable QoS and WMM
+            pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF;
+        }
+       
+        //auth type
+        switch( pProfile->negotiatedAuthType ) 
+        {
+            default:
+            case eCSR_AUTH_TYPE_WPA:
+            case eCSR_AUTH_TYPE_WPA_PSK:
+            case eCSR_AUTH_TYPE_WPA_NONE:
+            case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+                pBssConfig->authType = eSIR_OPEN_SYSTEM;
+                break;
+
+            case eCSR_AUTH_TYPE_SHARED_KEY:
+                pBssConfig->authType = eSIR_SHARED_KEY;
+                break;
+
+            case eCSR_AUTH_TYPE_AUTOSWITCH:
+                pBssConfig->authType = eSIR_AUTO_SWITCH;
+                break;
+        }
+        //short slot time
+        if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode )
+        {
+            pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime;
+        }
+        else
+        {
+            pBssConfig->uShortSlotTime = 0;
+        }
+        if(pBssConfig->BssCap.ibss)
+        {
+            //We don't support 11h on IBSS
+            pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; 
+        }
+        else
+        {
+            pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled;
+        }
+        //power constraint
+        pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints);
+        //heartbeat
+        if ( CSR_IS_11A_BSS( pBssDesc ) )
+        {
+             pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50;        
+        }
+        else
+        {
+             pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24;
+        }
+        //Join timeout
+        // if we find a BeaconInterval in the BssDescription, then set the Join Timeout to 
+        // be 3 x the BeaconInterval.                          
+        if ( pBssDesc->beaconInterval )
+        {
+            //Make sure it is bigger than the minimal
+            pBssConfig->uJoinTimeOut = CSR_ROAM_MAX(3 * pBssDesc->beaconInterval, CSR_JOIN_FAILURE_TIMEOUT_MIN);
+        }
+        else 
+        {
+            pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT;
+        }
+        //validate CB
+        pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes);
+    }while(0);
+
+    return (status);
+}
+
+
+static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
+                                                     tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U8 operationChannel = 0; 
+    tANI_U8 qAPisEnabled = FALSE;
+    //SSID
+    pBssConfig->SSID.length = 0;
+    if(pProfile->SSIDs.numOfSSIDs)
+    {
+        //only use the first one
+        palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid));
+    }
+    else
+    {
+        //SSID must present
+        return eHAL_STATUS_FAILURE;
+    }
+
+    //Settomg up the capabilities
+    if( csrIsBssTypeIBSS(pProfile->BSSType) )
+    {
+        pBssConfig->BssCap.ibss = 1;
+    }
+    else
+    {
+        pBssConfig->BssCap.ess = 1;
+    }
+    if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] )
+    {
+        pBssConfig->BssCap.privacy = 1;
+    }
+
+    pBssConfig->eBand = pMac->roam.configParam.eBand;
+    //phymode
+    if(pProfile->ChannelInfo.ChannelList)
+    {
+       operationChannel = pProfile->ChannelInfo.ChannelList[0];
+    }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, 
+                                        &pBssConfig->eBand);
+#else
+
+    pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, 
+                                        &pBssConfig->eBand);
+#endif
+    //QOS
+    //Is this correct to always set to this //***
+
+    if ( pBssConfig->BssCap.ess == 1 ) 
+    {
+#ifdef WLAN_SOFTAP_FEATURE
+        /*For Softap case enable WMM*/
+        if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){
+             qAPisEnabled = TRUE;
+        }
+        else
+#endif
+        if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) {
+             qAPisEnabled = TRUE;
+        } else {
+             qAPisEnabled = FALSE;
+        }
+    } else {
+             qAPisEnabled = TRUE;
+    }
+
+    if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) ||
+          (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) ||
+             ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS
+      )
+    {
+        pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP;
+    } else {
+        pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF;
+    }
+    
+    //auth type
+    switch( pProfile->AuthType.authType[0] ) //Take the prefered Auth type.
+    {
+        default:
+        case eCSR_AUTH_TYPE_WPA:
+        case eCSR_AUTH_TYPE_WPA_PSK:
+        case eCSR_AUTH_TYPE_WPA_NONE:
+        case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+            pBssConfig->authType = eSIR_OPEN_SYSTEM;
+            break;
+
+        case eCSR_AUTH_TYPE_SHARED_KEY:
+            pBssConfig->authType = eSIR_SHARED_KEY;
+            break;
+
+        case eCSR_AUTH_TYPE_AUTOSWITCH:
+            pBssConfig->authType = eSIR_AUTO_SWITCH;
+            break;
+    }
+    //short slot time
+    if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode )
+    {
+        pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime;
+    }
+    else
+    {
+        pBssConfig->uShortSlotTime = 0;
+    }
+    //power constraint. We don't support 11h on IBSS
+    pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE;
+    pBssConfig->uPowerLimit = 0;
+    //heartbeat
+    if ( eCSR_BAND_5G == pBssConfig->eBand )
+    {
+        pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50;        
+    }
+    else
+    {
+        pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24;
+    }
+    //Join timeout
+    pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT;
+    
+    return (status);
+}
+
+static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tDot11fBeaconIEs *pIes = NULL;
+   
+  do
+   {
+      if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes)))
+      {
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                   "csrRoamGetQosInfoFromBss() failed\n");
+
+         break;
+      }
+      //check if the AP is QAP & it supports APSD
+      if( CSR_IS_QOS_BSS(pIes) )
+      {
+         return eHAL_STATUS_SUCCESS;
+      }
+   } while (0);
+
+   return status;
+}
+
+
+void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy )
+{
+
+    // !! Note:  the only difference between this function and the csrSetCfgPrivacyFromProfile() is the 
+    // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. 
+    // See !!Note: below in this function...
+    tANI_U32 PrivacyEnabled = 0;
+    tANI_U32 RsnEnabled = 0;
+    tANI_U32 WepDefaultKeyId = 0;
+    tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5;   /* default 40 bits */
+    tANI_U32 Key0Length = 0;
+    tANI_U32 Key1Length = 0;
+    tANI_U32 Key2Length = 0;
+    tANI_U32 Key3Length = 0;
+    
+    // Reserve for the biggest key 
+    tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ];
+    tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ];
+    tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ];
+    tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ];
+    
+    switch ( pProfile->negotiatedUCEncryptionType )
+    {
+        case eCSR_ENCRYPT_TYPE_NONE:
+        
+            // for NO encryption, turn off Privacy and Rsn.
+            PrivacyEnabled = 0;           
+            RsnEnabled = 0;
+            
+            // WEP key length and Wep Default Key ID don't matter in this case....
+            
+            // clear out the WEP keys that may be hanging around.
+            Key0Length = 0;
+            Key1Length = 0;
+            Key2Length = 0;
+            Key3Length = 0;
+            
+            break;
+            
+        case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+            
+            // Privacy is ON.  NO RSN for Wep40 static key.
+            PrivacyEnabled = 1;           
+            RsnEnabled = 0;
+                        
+            // Set the Wep default key ID.
+            WepDefaultKeyId = pProfile->Keys.defaultIndex;
+
+            // Wep key size if 5 bytes (40 bits).
+            WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5;            
+            
+            // set encryption keys in the CFG database or clear those that are not present in this profile.
+            if ( pProfile->Keys.KeyLength[0] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 );
+                Key0Length = WNI_CFG_WEP_KEY_LENGTH_5;
+            }
+            else
+            {
+                Key0Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[1] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 );
+                Key1Length = WNI_CFG_WEP_KEY_LENGTH_5;
+            }
+            else
+            {
+                Key1Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[2] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 );
+                Key2Length = WNI_CFG_WEP_KEY_LENGTH_5;                
+            }
+            else
+            {
+                Key2Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[3] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 );
+                Key3Length = WNI_CFG_WEP_KEY_LENGTH_5;                
+            }
+            else
+            {
+                Key3Length = 0;
+            }      
+
+            break;
+        
+        case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+            
+            // Privacy is ON.  NO RSN for Wep40 static key.
+            PrivacyEnabled = 1;           
+            RsnEnabled = 0;
+            
+            // Set the Wep default key ID.
+            WepDefaultKeyId = pProfile->Keys.defaultIndex;
+           
+            // Wep key size if 13 bytes (104 bits).
+            WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13;
+            
+            // set encryption keys in the CFG database or clear those that are not present in this profile.
+            if ( pProfile->Keys.KeyLength[0] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 );
+                Key0Length = WNI_CFG_WEP_KEY_LENGTH_13;
+            }
+            else
+            {
+                Key0Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[1] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 );
+                Key1Length = WNI_CFG_WEP_KEY_LENGTH_13;
+            }
+            else
+            {
+                Key1Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[2] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 );
+                Key2Length = WNI_CFG_WEP_KEY_LENGTH_13;
+            }
+            else
+            {
+                Key2Length = 0;
+            }
+            
+            if ( pProfile->Keys.KeyLength[3] ) 
+            {
+                palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 );
+                Key3Length = WNI_CFG_WEP_KEY_LENGTH_13;
+            }
+            else
+            {
+                Key3Length = 0;
+            }
+           
+            break;
+        
+        case eCSR_ENCRYPT_TYPE_WEP40:
+        case eCSR_ENCRYPT_TYPE_WEP104:
+        case eCSR_ENCRYPT_TYPE_TKIP:
+        case eCSR_ENCRYPT_TYPE_AES:
+#ifdef FEATURE_WLAN_WAPI
+        case eCSR_ENCRYPT_TYPE_WPI:
+#endif /* FEATURE_WLAN_WAPI */
+            // !! Note:  this is the only difference between this function and the csrSetCfgPrivacyFromProfile()
+            // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ).        
+            PrivacyEnabled = (0 != fPrivacy);
+                         
+            // turn on RSN enabled for WPA associations   
+            RsnEnabled = 1;
+            
+            // WEP key length and Wep Default Key ID don't matter in this case....
+            
+            // clear out the static WEP keys that may be hanging around.
+            Key0Length = 0;
+            Key1Length = 0;
+            Key2Length = 0;
+            Key3Length = 0;        
+          
+            break;     
+
+        default:
+            PrivacyEnabled = 0;
+            RsnEnabled = 0;
+            break;            
+    }           
+    
+    ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE);
+}
+
+
+static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID )
+{
+    tANI_U32 len = 0;
+    if(pSSID->length <= WNI_CFG_SSID_LEN)
+    {
+        len = pSSID->length;
+    }
+    ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE);
+}
+
+
+eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 QoSEnabled;
+    tANI_U32 WmeEnabled;
+
+    // set the CFG enable/disable variables based on the qosType being configured...
+    switch( qosType )
+    {
+
+        case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p:
+            QoSEnabled = FALSE;
+            WmeEnabled = TRUE;
+            break;
+
+        case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP:
+            QoSEnabled = FALSE;
+            WmeEnabled = TRUE;
+            break;
+
+        case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify:
+            QoSEnabled = FALSE;
+            WmeEnabled = TRUE;
+            break;
+
+        case eCSR_MEDIUM_ACCESS_11e_eDCF:
+            QoSEnabled = TRUE;
+            WmeEnabled = FALSE;
+            break;
+
+        case eCSR_MEDIUM_ACCESS_11e_HCF:
+            QoSEnabled = TRUE;
+            WmeEnabled = FALSE;
+            break;
+
+        default:
+        case eCSR_MEDIUM_ACCESS_DCF:
+            QoSEnabled = FALSE;
+            WmeEnabled = FALSE;
+            break;
+
+    }
+    //save the WMM setting for later use
+    pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled;
+
+    status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE);
+    status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE);
+
+    return (status);
+}
+
+static eHalStatus csrGetRateSet( tpAniSirGlobal pMac,  tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc,
+                           tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    int i;
+    eCsrCfgDot11Mode cfgDot11Mode;
+    tANI_U8 *pDstRate;
+
+    palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet));
+    palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet));
+
+#if defined(VOSS_ENABLED)
+    VOS_ASSERT( pIes != NULL );
+#endif
+    
+    if( NULL != pIes )
+    {
+        csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes );
+
+        // Originally, we thought that for 11a networks, the 11a rates are always
+        // in the Operational Rate set & for 11b and 11g networks, the 11b rates
+        // appear in the Operational Rate set.  Consequently, in either case, we
+        // would blindly put the rates we support into our Operational Rate set
+        // (including the basic rates, which we have already verified are
+        // supported earlier in the roaming decision).
+
+        // However, it turns out that this is not always the case.  Some AP's
+        // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set,
+        // too.  Now, we're a little more careful:
+        pDstRate = pOpRateSet->rate;
+        if(pIes->SuppRates.present)
+        {
+            for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) 
+            {
+                if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) 
+                {
+                    *pDstRate++ = pIes->SuppRates.rates[ i ];
+                    pOpRateSet->numRates++;;
+                }
+            }
+        }
+
+        if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || 
+             eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode )
+        {
+            // If there are Extended Rates in the beacon, we will reflect those
+            // extended rates that we support in out Extended Operational Rate
+            // set:
+            pDstRate = pExRateSet->rate;
+            if(pIes->ExtSuppRates.present)
+            {
+                for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) 
+                {
+                    if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) 
+                    {
+                        *pDstRate++ = pIes->ExtSuppRates.rates[ i ];
+                        pExRateSet->numRates++;
+                    }
+                }
+            }
+        }
+    }//Parsing BSSDesc
+    else
+    {
+        smsLog(pMac, LOGE, FL("failed to parse BssDesc\n"));
+    }
+    if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS;
+    return status;
+}
+    
+static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile,
+                              tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
+{
+    int i;
+    tANI_U8 *pDstRate;
+    eCsrCfgDot11Mode cfgDot11Mode;
+    tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ];    // leave enough room for the max number of rates
+    tANI_U32 OperationalRatesLength = 0;
+    tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ];    // leave enough room for the max number of rates
+    tANI_U32 ExtendedOperationalRatesLength = 0;
+    tANI_U8 ProprietaryOperationalRates[ 4 ];    // leave enough room for the max number of proprietary rates
+    tANI_U32 ProprietaryOperationalRatesLength = 0;
+    tANI_U32 PropRatesEnable = 0;
+    tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ];
+    tANI_U32 MCSRateLength = 0;
+
+#if defined(VOSS_ENABLED)
+    VOS_ASSERT( pIes != NULL );
+#endif
+
+    if( NULL != pIes )
+    {
+        csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes );
+
+        // Originally, we thought that for 11a networks, the 11a rates are always
+        // in the Operational Rate set & for 11b and 11g networks, the 11b rates
+        // appear in the Operational Rate set.  Consequently, in either case, we
+        // would blindly put the rates we support into our Operational Rate set
+        // (including the basic rates, which we have already verified are
+        // supported earlier in the roaming decision).
+
+        // However, it turns out that this is not always the case.  Some AP's
+        // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set,
+        // too.  Now, we're a little more careful:
+        pDstRate = OperationalRates;
+        if(pIes->SuppRates.present)
+        {
+            for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) 
+            {
+                if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) &&
+                     ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX ))
+                {
+                    *pDstRate++ = pIes->SuppRates.rates[ i ];
+                    OperationalRatesLength++;
+                }
+            }
+        }
+
+        if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || 
+             eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode )
+        {
+            // If there are Extended Rates in the beacon, we will reflect those
+            // extended rates that we support in out Extended Operational Rate
+            // set:
+            pDstRate = ExtendedOperationalRates;
+            if(pIes->ExtSuppRates.present)
+            {
+                for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) 
+                {
+                    if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) &&
+                     ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ))
+                    {
+                        *pDstRate++ = pIes->ExtSuppRates.rates[ i ];
+                        ExtendedOperationalRatesLength++;
+                    }
+                }
+            }
+        }
+
+        // Enable proprietary MAC features if peer node is Airgo node and STA
+        // user wants to use them
+        if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled )
+        {
+            PropRatesEnable = 1;
+        }
+        else
+        {
+            PropRatesEnable = 0;
+        }
+
+        // For ANI network companions, we need to populate the proprietary rate
+        // set with any proprietary rates we found in the beacon, only if user
+        // allows them...
+        if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present &&
+             ( pIes->Airgo.PropSuppRates.num_rates > 0 )) 
+        {
+            ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates;
+            if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) )
+            {
+               ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates);
+            }
+            palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength );
+        }
+        else {
+            // No proprietary modes...
+            ProprietaryOperationalRatesLength = 0;
+        }
+
+        /* Get MCS Rate */
+        pDstRate = MCSRateIdxSet;
+        if ( pIes->HTCaps.present )
+        {
+           for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ )
+           {
+              if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) )
+              {
+                 MCSRateLength++;
+                 *pDstRate++ = i;
+              }
+           }
+        }
+
+        // Set the operational rate set CFG variables...
+        ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, 
+                        OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+        ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, 
+                            ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+        ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, 
+                        ProprietaryOperationalRates, 
+                        ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+        ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE);
+        ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, 
+                        MCSRateLength, NULL, eANI_BOOLEAN_FALSE);        
+    }//Parsing BSSDesc
+    else
+    {
+        smsLog(pMac, LOGE, FL("failed to parse BssDesc\n"));
+    }
+}
+
+
+static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac,
+                                         tCsrRoamProfile *pProfile  )
+{
+    tSirMacRateSetIE DefaultSupportedRates11a = {  SIR_MAC_RATESET_EID, 
+                                                   { 8, 
+                                                     { SIR_MAC_RATE_6, 
+                                                   SIR_MAC_RATE_9, 
+                                                   SIR_MAC_RATE_12, 
+                                                   SIR_MAC_RATE_18,
+                                                   SIR_MAC_RATE_24,
+                                                   SIR_MAC_RATE_36,
+                                                   SIR_MAC_RATE_48,
+                                                       SIR_MAC_RATE_54  } } };
+
+    tSirMacRateSetIE DefaultSupportedRates11b = {  SIR_MAC_RATESET_EID, 
+                                                   { 4, 
+                                                     { SIR_MAC_RATE_1, 
+                                                   SIR_MAC_RATE_2, 
+                                                   SIR_MAC_RATE_5_5, 
+                                                       SIR_MAC_RATE_11  } } };
+                                                              
+                                                              
+    tSirMacPropRateSet DefaultSupportedPropRates = { 3, 
+                                                     { SIR_MAC_RATE_72,
+                                                     SIR_MAC_RATE_96,
+                                                       SIR_MAC_RATE_108 } };
+    eCsrCfgDot11Mode cfgDot11Mode;
+    eCsrBand eBand;
+    tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ];    // leave enough room for the max number of rates
+    tANI_U32 OperationalRatesLength = 0;
+    tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ];    // leave enough room for the max number of rates
+    tANI_U32 ExtendedOperationalRatesLength = 0;
+    tANI_U8 ProprietaryOperationalRates[ 4 ];    // leave enough room for the max number of proprietary rates
+    tANI_U32 ProprietaryOperationalRatesLength = 0;
+    tANI_U32 PropRatesEnable = 0;
+    tANI_U8 operationChannel = 0; 
+
+    if(pProfile->ChannelInfo.ChannelList)
+    {
+       operationChannel = pProfile->ChannelInfo.ChannelList[0];
+    }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand );
+#else
+    cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand );
+#endif
+    // For 11a networks, the 11a rates go into the Operational Rate set.  For 11b and 11g 
+    // networks, the 11b rates appear in the Operational Rate set.  In either case,
+    // we can blindly put the rates we support into our Operational Rate set 
+    // (including the basic rates, which we have already verified are supported 
+    // earlier in the roaming decision).
+    if ( eCSR_BAND_5G == eBand ) 
+    {       
+        // 11a rates into the Operational Rate Set.                 
+        OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates *
+                                            sizeof(*DefaultSupportedRates11a.supportedRateSet.rate);
+        palCopyMemory( pMac->hHdd, OperationalRates,         
+                        DefaultSupportedRates11a.supportedRateSet.rate, 
+                        OperationalRatesLength );
+                         
+        // Nothing in the Extended rate set.
+        ExtendedOperationalRatesLength = 0;
+
+        // populate proprietary rates if user allows them
+        if ( pMac->roam.configParam.ProprietaryRatesEnabled ) 
+        {
+            ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * 
+                                                            sizeof(*DefaultSupportedPropRates.propRate);         
+            palCopyMemory( pMac->hHdd, ProprietaryOperationalRates,
+                            DefaultSupportedPropRates.propRate, 
+                            ProprietaryOperationalRatesLength );
+        }    
+        else 
+        {       
+            // No proprietary modes
+            ProprietaryOperationalRatesLength = 0;         
+        }    
+    }    
+    else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) 
+    {       
+        // 11b rates into the Operational Rate Set.         
+        OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates *
+                                              sizeof(*DefaultSupportedRates11b.supportedRateSet.rate);
+        palCopyMemory( pMac->hHdd, OperationalRates, 
+                        DefaultSupportedRates11b.supportedRateSet.rate, 
+                        OperationalRatesLength );
+        // Nothing in the Extended rate set.
+        ExtendedOperationalRatesLength = 0;
+        // No proprietary modes
+        ProprietaryOperationalRatesLength = 0;
+    }    
+    else 
+    {       
+        // 11G
+        
+        // 11b rates into the Operational Rate Set.         
+        OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * 
+                                            sizeof(*DefaultSupportedRates11b.supportedRateSet.rate);
+        palCopyMemory( pMac->hHdd, OperationalRates, 
+                        DefaultSupportedRates11b.supportedRateSet.rate, 
+                        OperationalRatesLength );
+        
+        // 11a rates go in the Extended rate set.
+        ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * 
+                                                    sizeof(*DefaultSupportedRates11a.supportedRateSet.rate);
+        palCopyMemory( pMac->hHdd, ExtendedOperationalRates,         
+                        DefaultSupportedRates11a.supportedRateSet.rate, 
+                        ExtendedOperationalRatesLength );
+        
+        // populate proprietary rates if user allows them
+        if ( pMac->roam.configParam.ProprietaryRatesEnabled ) 
+        {
+            ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates *
+                                                            sizeof(*DefaultSupportedPropRates.propRate);         
+            palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, 
+                            DefaultSupportedPropRates.propRate, 
+                            ProprietaryOperationalRatesLength );
+        }  
+        else 
+        {       
+           // No proprietary modes
+            ProprietaryOperationalRatesLength = 0;         
+        }    
+    }  
+
+    // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them
+    if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) 
+    {
+        PropRatesEnable = 1;                
+    }
+    else 
+    {
+        PropRatesEnable = 0;    
+    }
+        
+    // Set the operational rate set CFG variables...
+    ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, 
+                    OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, 
+                        ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, 
+                    ProprietaryOperationalRates, 
+                    ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
+    ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE);
+
+}
+
+void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    tANI_U32 sessionId;
+    tSmeCmd *pCommand = NULL;
+
+    if(NULL == pEntry)
+    {
+        smsLog(pMac, LOGW, "   CFG_CNF with active list empty\n");
+        return;
+    }
+    pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+    sessionId = pCommand->sessionId;
+
+    if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId))
+    {
+        csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result);
+    }
+}
+
+
+//This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE
+tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band)
+{
+    if(eCSR_CFG_DOT11_MODE_11B == dot11Mode)
+    {
+        return (WNI_CFG_PHY_MODE_11B);
+    }
+    else
+    {
+        if(eCSR_BAND_24 == band)
+            return (WNI_CFG_PHY_MODE_11G);
+    }
+
+    return (WNI_CFG_PHY_MODE_11A);
+}
+
+        
+//pIes may be NULL
+eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                          tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig,
+                          tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32   cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+    tANI_U8    channel = 0;
+    //Make sure we have the domain info for the BSS we try to connect to.
+    //Do we need to worry about sequence for OSs that are not Windows??
+    if(pBssDesc)
+    {
+        if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE))
+        {
+            //Make sure the 11d info from this BSSDesc can be applied
+            pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE;
+            csrApplyCountryInformation( pMac, TRUE );
+        }
+    }
+        
+    //Qos
+    csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType );
+    //SSID
+    csrSetCfgSsid(pMac, &pBssConfig->SSID );
+    //fragment threshold
+    //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
+    //RTS threshold
+    //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
+
+    //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE);
+        
+    //Auth type
+    ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE);
+    //encryption type
+    csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy );
+    //short slot time
+    ccmCfgSetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, pBssConfig->uShortSlotTime, NULL, eANI_BOOLEAN_FALSE);
+
+#ifdef WLAN_SOFTAP_FEATURE
+    //11d
+    ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED,
+                        ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d),
+                        NULL, eANI_BOOLEAN_FALSE);
+#endif
+    /*//11h
+    ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE);
+    */
+    ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE);
+    //CB
+    if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile))
+    {
+        channel = pProfile->operationChannel;
+    }
+    else
+    {
+        if(pBssDesc)
+        {
+            channel = pBssDesc->channelId;
+        }
+    }
+    if(0 != channel)
+    {
+        if(CSR_IS_CHANNEL_24GHZ(channel))
+        {//for now if we are on 2.4 Ghz, CB will be always disabled
+            cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+        }
+        else
+        {
+           //cfgCb = pBssConfig->cbMode;
+           cfgCb = pMac->roam.configParam.channelBondingMode5GHz;
+        }
+    }
+    ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE);
+    //Rate
+    //Fixed Rate
+    if(pBssDesc)
+    {
+        csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes);
+    }
+    else
+    {
+        csrSetCfgRateSetFromProfile(pMac, pProfile);
+    }
+    //Make this the last CFG to set. The callback will trigger a join_req
+    //Join time out
+    csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId );
+
+    ccmCfgSetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, pBssConfig->uJoinTimeOut, (tCcmCfgSetCallback)csrRoamCcmCfgSetCallback, eANI_BOOLEAN_FALSE);
+
+    return (status);
+}
+
+
+
+eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                               tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status;
+    tBssConfigParam *pBssConfig;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); 
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam));
+        status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode;
+            //For IBSS, we need to prepare some more information
+            if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile )
+#ifdef WLAN_SOFTAP_FEATURE
+              || CSR_IS_INFRA_AP(pProfile)
+#endif
+            )
+            {
+                csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pIes);
+            }
+            // If we are in an IBSS, then stop the IBSS...
+            ////Not worry about WDS connection for now
+            if ( csrIsConnStateIbss( pMac, sessionId ) ) 
+            {
+                status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING );
+            }
+            else 
+            {
+                // if we are in an Infrastructure association....
+                if ( csrIsConnStateInfra( pMac, sessionId ) ) 
+                {
+                    // and the new Bss is an Ibss OR we are roaming from Infra to Infra
+                    // across SSIDs (roaming to a new SSID)...            //            
+                    //Not worry about WDS connection for now
+                    if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) ||
+                          !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) )   
+                    {
+                        // then we need to disassociate from the Infrastructure network...
+                        status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE );  
+                    }
+                    else 
+                    {  
+                        // In an Infrastucture and going to an Infrastructure network with the same SSID.  This
+                        // calls for a Reassociation sequence.  So issue the CFG sets for this new AP.
+                        if ( pBssDesc ) 
+                        {
+                            // Set parameters for this Bss.    
+                            status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes);
+                        }
+                    }      
+                }
+                else 
+                {
+                    // Neiher in IBSS nor in Infra.  We can go ahead and set the CFG for tne new network...
+                    // Nothing to stop.
+                    if ( pBssDesc || CSR_IS_WDS_AP( pProfile )
+#ifdef WLAN_SOFTAP_FEATURE
+                     || CSR_IS_INFRA_AP(pProfile)
+#endif
+                    ) 
+                    {      
+                        // Set parameters for this Bss.    
+                        status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes);
+                    }  
+                }
+            }
+        }//Success getting BSS config info
+        palFreeMemory(pMac->hHdd, pBssConfig);
+    }//Allocate memory
+    
+    return (status);
+}
+
+
+eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                           tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile )
+{
+    eCsrJoinState eRoamState = eCsrContinueRoaming;
+    eHalStatus status;
+    tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor;
+    tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if( CSR_IS_WDS_STA( pProfile ) )
+    {
+        status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc );
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            eRoamState = eCsrStopRoaming;
+        }
+    }
+    else
+    {
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) )
+        {
+            smsLog(pMac, LOGE, FL(" fail to parse IEs"));
+            return (eCsrStopRoaming);
+        }
+        if ( csrIsInfraBssDesc( pBssDesc ) ) 
+    {
+        // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are
+        // attempting to join the AP we are already connected with.  In that case, see if the Bss or Sta capabilities
+        // have changed and handle the changes (without disturbing the current association).
+                
+        if ( csrIsConnStateConnectedInfra(pMac, sessionId) && 
+             csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) &&
+                 csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal )
+           )               
+        {   
+            // Check to see if the Auth type has changed in the Profile.  If so, we don't want to Reassociate
+            // with Authenticating first.  To force this, stop the current association (Disassociate) and 
+            // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by 
+            // a new Association.
+            if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile))
+            {
+                smsLog(pMac, LOGW, FL("  detect same profile authType = %d encryType = %d\n"), pProfile->AuthType, pProfile->EncryptionType);
+                if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile))
+                {
+                    eRoamState = eCsrReassocToSelfNoCapChange;
+                }
+                else
+                {
+                    tBssConfigParam bssConfig;
+
+                    //The key changes
+                    palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig));
+                    status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal);
+                    if(HAL_STATUS_SUCCESS(status))
+                    {
+                        pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode;
+                        //Reapply the config including Keys so reassoc is happening.
+                        status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal);
+                        if(!HAL_STATUS_SUCCESS(status))
+                        {
+                            eRoamState = eCsrStopRoaming;
+                        }
+                    }
+                    else
+                    {
+                        eRoamState = eCsrStopRoaming;
+                    }
+                }//same profile
+            }
+            else
+            {
+                if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, 
+                                                        eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE )))
+                {
+                    smsLog(pMac, LOGW, FL("  fail to issue disassociate\n"));
+                    eRoamState = eCsrStopRoaming;
+                }                       
+            }
+        }            
+        else 
+        {
+            // note:  we used to pre-auth here with open authentication networks but that was not working so well.
+            // we had a lot of join timeouts when testing at Samsung.  removing this step helped associations 
+            // work much better.
+            //
+            //
+            // stop the existing network before attempting to join the new network...
+                if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal)))
+            {
+                eRoamState = eCsrStopRoaming;
+            }
+        }
+        }//Infra
+    else 
+    {
+            if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal)))
+        {
+            eRoamState = eCsrStopRoaming;
+        }
+    }
+        if( pIesLocal && !pScanResult->pvIes )
+        {
+            palFreeMemory(pMac->hHdd, pIesLocal);
+        }
+    }
+
+    return( eRoamState );
+}
+
+
+eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                             tSirBssDescription *pBssDesc, tANI_U32 roamId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamInfo roamInfo;
+
+    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+    roamInfo.pBssDesc = pBssDesc;
+    status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE);
+    return (status);
+}
+
+//In case no matching BSS is found, use whatever default we can find
+static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    //Need to get all negotiated types in place first
+    //auth type
+    switch( pCommand->u.roamCmd.roamProfile.AuthType.authType[0] ) //Take the prefered Auth type.
+    {
+        default:
+        case eCSR_AUTH_TYPE_WPA:
+        case eCSR_AUTH_TYPE_WPA_PSK:
+        case eCSR_AUTH_TYPE_WPA_NONE:
+        case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+             pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+             break;
+
+        case eCSR_AUTH_TYPE_SHARED_KEY:
+             pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY;
+             break;
+
+        case eCSR_AUTH_TYPE_AUTOSWITCH:
+             pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH;
+             break;
+    }
+    pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = 
+    pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; 
+    //In this case, the multicast encryption needs to follow the uncast ones.
+    pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = 
+    pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0];
+}
+
+static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss )
+{
+    eHalStatus status;
+    tCsrScanResult *pScanResult = NULL;
+    eCsrJoinState eRoamState = eCsrStopRoaming;
+    tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList;
+    tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE;
+    tCsrRoamInfo roamInfo, *pRoamInfo = NULL;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    v_U8_t acm_mask = 0;
+#endif 
+    tANI_U32 sessionId = pCommand->sessionId;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile;
+    tANI_U8  concurrentChannel = 0;
+    
+    do  
+    {
+        // Check for Cardbus eject condition, before trying to Roam to any BSS
+        //***if( !balIsCardPresent(pAdapter) ) break;
+        
+        if(NULL != pBSSList)
+        {
+            // When handling AP's capability change, continue to associate to
+            // same BSS and make sure pRoamBssEntry is not Null.
+            if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL))
+            {
+                if(pCommand->u.roamCmd.pRoamBssEntry == NULL)
+                {
+                    //Try the first BSS
+                    pCommand->u.roamCmd.pLastRoamBss = NULL;
+                    pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK);
+                }
+                else
+                {
+                    pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK);
+                    if(NULL == pCommand->u.roamCmd.pRoamBssEntry)
+                    {
+                        //Done with all the BSSs
+                        //In this case,   will tell HDD the completion
+                        break;
+                    }
+                    else
+                    {
+                        //We need to indicate to HDD that we are done with this one.
+                        palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                        roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss;     //this shall not be NULL
+                        roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                        roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+                        pRoamInfo = &roamInfo;
+                    }
+                }
+                while(pCommand->u.roamCmd.pRoamBssEntry)
+                {
+                    pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+
+                    /*If concurrency enabled take the concurrent connected channel first. */
+                    /* Valid multichannel concurrent sessions exempted */
+                    if (vos_concurrent_sessions_running() && !csrIsValidMcConcurrentSession(pMac, sessionId))
+                    {
+                        concurrentChannel = 
+                            csrGetConcurrentOperationChannel(pMac);
+                        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
+                                " csr Concurrent Channel = %d", __FUNCTION__, concurrentChannel);
+
+                        if ((concurrentChannel) && 
+                                (concurrentChannel == 
+                                 pScanResult->Result.BssDescriptor.channelId))
+                        {
+                            //make this 0 because we do not want the 
+                            //below check to pass as we don't want to 
+                            //connect on other channel
+                            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                                    FL("Concurrent channel match =%d"),
+                                    concurrentChannel);
+                            concurrentChannel = 0; 
+
+                        }
+                    }
+                    if ((vos_concurrent_sessions_running()) && 
+                         csrIsAnySessionInConnectState( pMac ))
+                    {
+                        pMac->roam.configParam.concurrencyEnabled = 1;
+                    }
+
+                    if (!concurrentChannel)
+                    {
+                        
+                        if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac,
+                            sessionId, &pScanResult->Result.BssDescriptor,
+                            pCommand->u.roamCmd.roamId)))
+                        {
+                            //Ok to roam this
+                            break;
+                        }
+                     }
+                    pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK);
+                    if(NULL == pCommand->u.roamCmd.pRoamBssEntry)
+                    {
+                        //Done with all the BSSs
+                        fDone = eANI_BOOLEAN_TRUE;
+                        break;
+                    }
+                }
+                if(fDone)
+                {
+                    break;
+                }
+            }
+        }
+        //We have something to roam, tell HDD when it is infra.
+        //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND
+        //For WDS, the indication is eCSR_ROAM_WDS_IND
+        if( CSR_IS_INFRASTRUCTURE( pProfile ) )
+        {
+            if(pRoamInfo)
+            {
+                pSession->bRefAssocStartCnt--;
+                //Complete the last association attemp because a new one is about to be tried
+                csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_ASSOCIATION_COMPLETION, 
+                                        eCSR_ROAM_RESULT_NOT_ASSOCIATED);
+            }
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo));
+            if(pScanResult)
+            {
+                tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes;
+
+                if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) )
+                {
+                    smsLog(pMac, LOGE, FL(" cannot parse IEs\n"));
+                    fDone = eANI_BOOLEAN_TRUE;
+                    eRoamState = eCsrStopRoaming;
+                    break;
+                }
+                roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor;
+                pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc;
+                //No need to put uapsd_mask in if the BSS doesn't support uAPSD
+                if( pCommand->u.roamCmd.roamProfile.uapsd_mask &&
+                    CSR_IS_QOS_BSS(pIesLocal) &&
+                    CSR_IS_UAPSD_BSS(pIesLocal) )
+                {
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+
+                    acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, 
+                         pIesLocal);
+                    pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask);
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+
+                }
+                else
+                {
+                    pCommand->u.roamCmd.roamProfile.uapsd_mask = 0;
+                }
+                if( pIesLocal && !pScanResult->Result.pvIes)
+                {
+                    palFreeMemory(pMac->hHdd, pIesLocal);
+                }
+            }
+            else
+            {
+                pCommand->u.roamCmd.roamProfile.uapsd_mask = 0;
+            }
+            roamInfo.pProfile = pProfile;
+            pSession->bRefAssocStartCnt++;
+            csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                 eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE );
+        }
+
+        if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) 
+        {
+            // If this is a start IBSS profile, then we need to start the IBSS.
+            if ( CSR_IS_START_IBSS(pProfile) ) 
+            {
+                tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE;
+
+                // Attempt to start this IBSS...
+                csrRoamAssignDefaultParam( pMac, pCommand );
+                status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss );
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    if ( fSameIbss ) 
+                    {
+                        eRoamState = eCsrStartIbssSameIbss;
+                    }
+                    else
+                    {
+                        eRoamState = eCsrContinueRoaming;
+                    }
+                }
+                else
+                {
+                    //it somehow fail need to stop
+                    eRoamState = eCsrStopRoaming;
+                }
+                break;
+            }
+            else if ( (CSR_IS_WDS_AP(pProfile))
+#ifdef WLAN_SOFTAP_FEATURE
+             || (CSR_IS_INFRA_AP(pProfile))
+#endif
+            )
+            {
+                // Attempt to start this WDS...
+                csrRoamAssignDefaultParam( pMac, pCommand );
+                /* For AP WDS, we dont have any BSSDescription */
+                status = csrRoamStartWds( pMac, sessionId, pProfile, NULL );
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    eRoamState = eCsrContinueRoaming;
+                }
+                else 
+                {
+                    //it somehow fail need to stop
+                    eRoamState = eCsrStopRoaming;
+                }
+            }
+            else 
+            {
+                //Nothing we can do
+                smsLog(pMac, LOGW, FL("cannot continue without BSS list\n"));
+                eRoamState = eCsrStopRoaming;
+                break;
+            }
+        } 
+        else //We have BSS 
+        {
+            //Need to assign these value because they are used in csrIsSameProfile
+            pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+            pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result.
+            pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType;
+            pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType;
+            if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) )
+            {
+                if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile))
+                {
+                    eRoamState = eCsrStartIbssSameIbss;
+                    break;
+                } 
+            }
+            if( pCommand->u.roamCmd.fReassocToSelfNoCapChange )
+            {
+                //trying to connect to the one already connected
+                pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE;
+                eRoamState = eCsrReassocToSelfNoCapChange;
+                break;
+            }
+            // Attempt to Join this Bss...
+            eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile );
+            break;
+        }
+        
+    } while( 0 );
+
+    if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) )
+    {
+        //Need to indicate association_completion if association_start has been done
+        if(pSession->bRefAssocStartCnt > 0)
+        {
+            pSession->bRefAssocStartCnt--;
+            //Complete the last association attemp because a new one is about to be tried
+            csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_ASSOCIATION_COMPLETION, 
+                                        eCSR_ROAM_RESULT_NOT_ASSOCIATED);
+        }
+    }
+
+    return( eRoamState );
+}
+
+
+static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    eCsrJoinState RoamState;
+    tANI_U32 sessionId = pCommand->sessionId;
+    
+    smsLog(pMac, LOG2, FL("is called\n"));
+    //***if( hddIsRadioStateOn( pAdapter ) )
+    {
+        // Attept to join a Bss...
+        RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE );
+    
+        // if nothing to join..
+        if ( eCsrStopRoaming == RoamState ) 
+        {
+            tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE;
+
+            // and if connected in Infrastructure mode...
+            if ( csrIsConnStateInfra(pMac, sessionId) ) 
+            {
+                //... then we need to issue a disassociation
+                status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE );
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    smsLog(pMac, LOGW, FL("  failed to issue disassociate, status = %d\n"), status);
+                    //roam command is completed by caller in the failed case
+                    fComplete = eANI_BOOLEAN_TRUE;
+                }
+            }
+            else if( csrIsConnStateIbss(pMac, sessionId) )
+            {
+                status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    smsLog(pMac, LOGW, FL("  failed to issue stop bss, status = %d\n"), status);
+                    //roam command is completed by caller in the failed case
+                    fComplete = eANI_BOOLEAN_TRUE;
+                }
+            }
+#ifdef WLAN_SOFTAP_FEATURE
+            else if (csrIsConnStateConnectedInfraAp(pMac, sessionId))
+            {
+                status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    smsLog(pMac, LOGW, FL("  failed to issue stop bss, status = %d\n"), status);
+                    //roam command is completed by caller in the failed case
+                    fComplete = eANI_BOOLEAN_TRUE;
+                }
+            }
+#endif
+            else
+            {        
+                fComplete = eANI_BOOLEAN_TRUE;
+            }
+            if(fComplete)
+            {
+               // ... otherwise, we can complete the Roam command here.
+               csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+            }    
+       }
+       else if ( eCsrReassocToSelfNoCapChange == RoamState )
+       {
+           csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL );
+       }
+       else if ( eCsrStartIbssSameIbss == RoamState )
+       {
+           csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL );        
+       }
+    }//hddIsRadioStateOn
+    
+    return status;
+}
+
+eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    tANI_U32 sessionId;
+    tCsrRoamSession *pSession;
+    tCsrScanResult *pScanResult = NULL;
+    tSirBssDescription *pBssDesc = NULL;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    sessionId = pCommand->sessionId;
+    pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming)
+    {
+        //the roaming is cancelled. Simply complete the command
+        smsLog(pMac, LOG1, FL("  Roam command cancelled\n"));
+        csrRoamComplete(pMac, eCsrNothingToJoin, NULL); 
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if (pCommand->u.roamCmd.pRoamBssEntry)
+    {
+        pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+        pBssDesc = &pScanResult->Result.BssDescriptor;
+    }
+    else
+    {
+        //the roaming is cancelled. Simply complete the command
+        smsLog(pMac, LOG1, FL("  Roam command cancelled\n"));
+        csrRoamComplete(pMac, eCsrNothingToJoin, NULL); 
+        return eHAL_STATUS_FAILURE;
+    }
+
+    status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, 
+        (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile);
+    return status;
+}
+
+
+eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamInfo roamInfo;
+    tANI_U32 sessionId = pCommand->sessionId;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    switch ( pCommand->u.roamCmd.roamReason )
+    {
+    case eCsrForcedDisassoc:
+        csrFreeRoamProfile(pMac, sessionId);
+        status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE );
+        break;
+
+     case eCsrSmeIssuedDisassocForHandoff:
+        //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect
+#if 0 // TODO : Confirm this change
+        status = csrRoamProcessDisassociate( pMac, pCommand, FALSE );
+#else
+        status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE );
+#endif
+
+        break;
+
+    case eCsrForcedDisassocMICFailure:
+        csrFreeRoamProfile(pMac, sessionId);
+        status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE );
+        break;
+
+    case eCsrForcedDeauth:
+        csrFreeRoamProfile(pMac, sessionId);
+        status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE );
+        break;
+
+    case eCsrHddIssuedReassocToSameAP:
+    case eCsrSmeIssuedReassocToSameAP:
+    {
+        tDot11fBeaconIEs *pIes = NULL;
+
+
+        if( pSession->pConnectBssDesc )
+        {
+            status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes);
+            if(!HAL_STATUS_SUCCESS(status) )
+            {
+                smsLog(pMac, LOGE, FL("  fail to parse IEs\n"));
+            }
+            else
+            {
+                roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged;
+                csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
+                pSession->roamingReason = eCsrReassocRoaming;
+
+                roamInfo.pBssDesc = pSession->pConnectBssDesc;
+                roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile;
+                pSession->bRefAssocStartCnt++;
+                csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                     eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE );
+   
+                smsLog(pMac, LOG1, FL("  calling csrRoamIssueReassociate\n"));
+                csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes,
+                                         &pCommand->u.roamCmd.roamProfile );
+                palFreeMemory(pMac->hHdd, pIes);
+                pIes = NULL;
+            }
+        }
+        break;
+    }
+
+    case eCsrCapsChange:
+        smsLog(pMac, LOGE, FL("received eCsrCapsChange \n"));
+        csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId );
+        status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); 
+        break;
+
+    case eCsrSmeIssuedFTReassoc:
+        smsLog(pMac, LOGE, FL("received FT Reassoc Req \n"));
+        status = csrProcessFTReassocRoamCommand(pMac, pCommand);
+        break;
+    case eCsrStopBss:
+       csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
+       status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+       break;
+
+    case eCsrForcedDisassocSta:
+       csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
+       csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId);
+       status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, 
+                     pCommand->u.roamCmd.reason);
+       break;
+
+    case eCsrForcedDeauthSta:
+       csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
+       csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId);
+       status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, 
+                     pCommand->u.roamCmd.reason);
+       break;
+
+    default:
+        csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId );
+
+        if( pCommand->u.roamCmd.fUpdateCurRoamProfile )
+        {
+            //Remember the roaming profile 
+            csrFreeRoamProfile(pMac, sessionId);
+            if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile))))
+            {
+                palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile));
+                csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile);
+            }
+        }
+ 
+        //At this point, original uapsd_mask is saved in pCurRoamProfile
+        //uapsd_mask in the pCommand may change from this point on.
+ 
+        // Attempt to roam with the new scan results (if we need to..)
+        status = csrRoam( pMac, pCommand );
+        break;
+    }
+
+    return (status);
+}
+
+
+void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) 
+{
+    if(pCommand->u.roamCmd.fReleaseBssList)
+    {
+        csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList);
+        pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE;
+        pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE;
+    }
+    if(pCommand->u.roamCmd.fReleaseProfile)
+    {
+        csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile);
+        pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
+    }
+    pCommand->u.roamCmd.pRoamBssEntry = NULL;
+    //Because u.roamCmd is union and share with scanCmd and StatusChange
+    palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd));
+}
+
+
+void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd));
+}
+
+void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context )
+{
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+    tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE;
+
+    smsLog( pMac, LOG2, "roamQ: Roam Completion ...\n" );
+
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
+        // If the head of the queue is Active and it is a ROAM command, remove
+        // and put this on the Free queue.
+        if ( eSmeCommandRoam == pCommand->command )
+        {
+            //we need to process the result first before removing it from active list because state changes 
+            //still happening insides roamQProcessRoamResults so no other roam command should be issued
+            fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context );
+            if( fReleaseCommand )
+            {
+                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                {
+                    csrReleaseCommandRoam( pMac, pCommand );
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n",
+                        pCommand->u.roamCmd.roamReason );
+                }
+            }
+            else
+            {
+                smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n",
+                    pCommand->u.roamCmd.roamReason );
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ...\n" );
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" );
+    }
+
+    if( fReleaseCommand )
+    {
+        smeProcessPendingQueue( pMac );
+    }
+}
+
+
+void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED );
+    pSession->NumPmkidCandidate = 0;
+}
+
+#ifdef FEATURE_WLAN_WAPI
+void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED );
+    pSession->NumBkidCandidate = 0;
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ];
+
+
+
+static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, 
+                                         tSirBssDescription *pSirBssDesc,
+                                         tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    if((eCSR_AUTH_TYPE_WPA == authType) ||
+        (eCSR_AUTH_TYPE_WPA_PSK == authType) ||
+        (eCSR_AUTH_TYPE_RSN == authType) ||
+        (eCSR_AUTH_TYPE_RSN_PSK == authType)
+#if defined WLAN_FEATURE_VOWIFI_11R
+      ||
+       (eCSR_AUTH_TYPE_FT_RSN == authType) ||
+       (eCSR_AUTH_TYPE_FT_RSN_PSK == authType)
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_WAPI 
+      ||
+       (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) ||
+       (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)
+#endif /* FEATURE_WLAN_WAPI */
+        )
+    {
+
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
+        {
+            smsLog(pMac, LOGE, FL(" cannot parse IEs\n"));
+        }
+        if( pIesLocal )
+        {
+            tANI_U32 nIeLen;
+            tANI_U8 *pIeBuf;
+
+            if((eCSR_AUTH_TYPE_RSN == authType) ||
+#if defined WLAN_FEATURE_VOWIFI_11R
+                (eCSR_AUTH_TYPE_FT_RSN == authType) ||
+                (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) ||
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+                (eCSR_AUTH_TYPE_RSN_PSK == authType))
+            {
+                if(pIesLocal->RSN.present)
+                {
+                    //Calculate the actual length
+                    nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count
+                        + pIesLocal->RSN.pwise_cipher_suite_count * 4    //pwise_cipher_suites
+                        + 2 //akm_suite_count
+                        + pIesLocal->RSN.akm_suite_count * 4 //akm_suites
+                        + 2; //reserved
+                    if( pIesLocal->RSN.pmkid_count )
+                    {
+                        nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4;  //pmkid
+                    }
+                    //nIeLen doesn't count EID and length fields
+                    if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2))))
+                    {
+                        pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN;
+                        pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen;
+                        //copy upto akm_suites
+                        pIeBuf = pSession->pWpaRsnRspIE + 2;
+                        palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, 8);
+                        pIeBuf += 8;
+                        if( pIesLocal->RSN.pwise_cipher_suite_count )
+                        {
+                            //copy pwise_cipher_suites
+                            palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, 
+                                            pIesLocal->RSN.pwise_cipher_suite_count * 4);
+                            pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4;
+                        }
+                        palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2);
+                        pIeBuf += 2;
+                        if( pIesLocal->RSN.akm_suite_count )
+                        {
+                            //copy akm_suites
+                            palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, 
+                                            pIesLocal->RSN.akm_suite_count * 4);
+                            pIeBuf += pIesLocal->RSN.akm_suite_count * 4;
+                        }
+                        //copy the rest
+                        palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + 
+                                        pIesLocal->RSN.akm_suite_count * 4, 
+                                        2 + pIesLocal->RSN.pmkid_count * 4);
+                        pSession->nWpaRsnRspIeLength = nIeLen + 2; 
+                    }
+                }
+            }
+            else if((eCSR_AUTH_TYPE_WPA == authType) ||
+                (eCSR_AUTH_TYPE_WPA_PSK == authType))
+            {
+                if(pIesLocal->WPA.present)
+                {
+                    //Calculate the actual length
+                    nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count
+                        + pIesLocal->WPA.unicast_cipher_count * 4    //unicast_ciphers
+                        + 2 //auth_suite_count
+                        + pIesLocal->WPA.auth_suite_count * 4; //auth_suites
+                    // The WPA capabilities follows the Auth Suite (two octects)--
+                    // this field is optional, and we always "send" zero, so just
+                    // remove it.  This is consistent with our assumptions in the
+                    // frames compiler; c.f. bug 15234:
+                    //nIeLen doesn't count EID and length fields
+                    if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2))))
+                    {
+                        pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA;
+                        pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen;
+                        pIeBuf = pSession->pWpaRsnRspIE + 2;
+                        //Copy WPA OUI
+                        palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4);
+                        pIeBuf += 4;
+                        palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + 
+                                        pIesLocal->WPA.unicast_cipher_count * 4);
+                        pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4;
+                        palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + 
+                                        pIesLocal->WPA.auth_suite_count * 4);
+                        pIeBuf += pIesLocal->WPA.auth_suite_count * 4;
+                        pSession->nWpaRsnRspIeLength = nIeLen + 2; 
+                    }
+                }
+            }
+#ifdef FEATURE_WLAN_WAPI
+          else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) ||
+                  (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType))
+          {
+                if(pIesLocal->WAPI.present)
+                {
+                   //Calculate the actual length
+                   nIeLen = 4 //version + akm_suite_count 
+                      + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites
+                      + 2 //pwise_cipher_suite_count
+                      + pIesLocal->WAPI.unicast_cipher_suite_count * 4    //pwise_cipher_suites
+                      + 6; //gp_cipher_suite + preauth + reserved
+                      if( pIesLocal->WAPI.bkid_count )
+                      {
+                           nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4;  //bkid
+        }
+                      
+                   //nIeLen doesn't count EID and length fields
+                   if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2))))
+                   {
+                      pSession->pWapiRspIE[0] = DOT11F_EID_WAPI;
+                      pSession->pWapiRspIE[1] = (tANI_U8)nIeLen;
+                      pIeBuf = pSession->pWapiRspIE + 2;
+                      //copy upto akm_suite_count
+                      palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 4);
+                      pIeBuf += 4;
+                      if( pIesLocal->WAPI.akm_suite_count )
+                      {
+                         //copy akm_suites
+                         palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, 
+                                        pIesLocal->WAPI.akm_suite_count * 4);
+                         pIeBuf += pIesLocal->WAPI.akm_suite_count * 4;
+    }
+                      palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2);
+                      pIeBuf += 2;
+
+                      if( pIesLocal->WAPI.unicast_cipher_suite_count )
+                      {
+                         //copy pwise_cipher_suites
+                         palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, 
+                                        pIesLocal->WAPI.unicast_cipher_suite_count * 4);
+                         pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4;
+                      }
+                      //gp_cipher_suite + preauth + reserved + bkid_count
+                      palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.multicast_cipher_suite, 8);
+                      pIeBuf += 8;
+                      if( pIesLocal->WAPI.bkid_count )
+                      {
+                         //copy akm_suites
+                         palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4);
+                         pIeBuf += pIesLocal->WAPI.bkid_count * 4;
+                      }
+                      pSession->nWapiRspIeLength = nIeLen + 2; 
+                   }
+
+                }
+          }
+#endif /* FEATURE_WLAN_WAPI */
+            if( !pIes )
+            {
+                //locally allocated
+                palFreeMemory(pMac->hHdd, pIesLocal);
+        }
+    }
+    }
+
+    return (status);
+}
+
+
+
+static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs )
+{
+    v_U8_t bACWeights[WLANTL_MAX_AC];
+    v_U8_t paramBk, paramBe, paramVi, paramVo;
+    v_BOOL_t fWeightChange = VOS_FALSE;
+
+    //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO)
+    //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount
+    //of the higher AC one, make the higher AC has the same weight as the lower AC.
+    //This doesn't address the case where the lower AC needs a real higher weight
+    if( pIEs->WMMParams.present )
+    {
+        //no change to the lowest ones
+        bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK];
+        bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE];
+        bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI];
+        bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO];
+        paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin;
+        paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin;
+        paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin;
+        paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin;
+        if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) )
+        {
+            bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK];
+            fWeightChange = VOS_TRUE;
+        }
+        if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) )
+        {
+            bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK];
+            fWeightChange = VOS_TRUE;
+        }
+        else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) )
+        {
+            bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE];
+            fWeightChange = VOS_TRUE;
+        }
+        if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) )
+        {
+            bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK];
+            fWeightChange = VOS_TRUE;
+        }
+        else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) )
+        {
+            bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE];
+            fWeightChange = VOS_TRUE;
+        }
+        else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) )
+        {
+            bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI];
+            fWeightChange = VOS_TRUE;
+        }
+        if(fWeightChange)
+        {
+            smsLog(pMac, LOGE, FL(" change AC weights (%d-%d-%d-%d)\n"), bACWeights[0], bACWeights[1],
+                bACWeights[2], bACWeights[3]);
+            WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights);
+        }
+    }
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+//Returns whether the current association is a 11r assoc or not
+tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac)
+{
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    return csrNeighborRoamIs11rAssoc(pMac);
+#else
+    return eANI_BOOLEAN_FALSE;
+#endif
+}
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+//Returns whether the current association is a CCX assoc or not
+tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac)
+{
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    return csrNeighborRoamIsCCXAssoc(pMac);
+#else
+    return eANI_BOOLEAN_FALSE;
+#endif
+}
+#endif
+
+//Return true means the command can be release, else not
+static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand,
+                                       eCsrRoamCompleteResult Result, void *Context )
+{
+    tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE;
+    tSirBssDescription *pSirBssDesc = NULL;   
+    tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+    tCsrScanResult *pScanResult = NULL;
+    tCsrRoamInfo roamInfo;
+    sme_QosAssocInfo assocInfo;
+    sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME
+    tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback
+    tDot11fBeaconIEs *pIes = NULL;
+    tANI_U32 sessionId = pCommand->sessionId;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile;
+    eRoamCmdStatus roamStatus;
+    eCsrRoamResult roamResult;
+    eHalStatus status;
+    tANI_U32 key_timeout_interval = 0;
+#ifdef WLAN_SOFTAP_FEATURE
+    tSirSmeStartBssRsp  *pSmeStartBssRsp = NULL;
+#endif
+
+
+    smsLog( pMac, LOG1, FL("Processing ROAM results...\n"));
+
+    switch( Result )
+    {
+        case eCsrJoinSuccess:
+            // reset the IDLE timer
+            // !!
+            // !! fall through to the next CASE statement here is intentional !!
+            // !!
+        case eCsrReassocSuccess:
+            if(eCsrReassocSuccess == Result)
+            {
+                ind_qos = SME_QOS_CSR_REASSOC_COMPLETE;
+            }
+            else
+            {
+                ind_qos = SME_QOS_CSR_ASSOC_COMPLETE;
+            }
+            // Success Join Response from LIM.  Tell NDIS we are connected and save the
+            // Connected state...
+            smsLog(pMac, LOGW, FL("receives association indication\n"));
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo));
+            //always free the memory here
+            if(pSession->pWpaRsnRspIE)
+            {
+                pSession->nWpaRsnRspIeLength = 0;
+                palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE);
+                pSession->pWpaRsnRspIE = NULL;
+            }
+
+#ifdef FEATURE_WLAN_WAPI
+            if(pSession->pWapiRspIE)
+            {
+                pSession->nWapiRspIeLength = 0;
+                palFreeMemory(pMac->hHdd, pSession->pWapiRspIE);
+                pSession->pWapiRspIE = NULL;
+            }
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+            //Reset counter so no join retry is needed.
+            pSession->maxRetryCount = 0;
+            csrRoamStopJoinRetryTimer(pMac, sessionId);
+#endif
+            /* This creates problem since we have not saved the connected profile.
+            So moving this after saving the profile
+            */
+            //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED );
+            if( CSR_IS_INFRASTRUCTURE( pProfile ) )
+            {
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED;
+            }
+            else
+            {
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;
+            }
+
+            //Use the last connected bssdesc for reassoc-ing to the same AP.
+            //NOTE: What to do when reassoc to a different AP???
+            if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ||
+                (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) )
+            {
+                pSirBssDesc = pSession->pConnectBssDesc;
+                if(pSirBssDesc)
+                {
+                    palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid));
+                } 
+            }
+            else
+            {
+     
+                if(pCommand->u.roamCmd.pRoamBssEntry)
+                {
+                    pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+                    if(pScanResult != NULL)
+                    {
+                        pSirBssDesc = &pScanResult->Result.BssDescriptor;
+                        //this can be NULL
+                        pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes );
+                        palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid));
+                    }
+                }
+            }
+            if( pSirBssDesc )
+            {
+
+                roamInfo.staId = HAL_STA_INVALID_IDX;
+
+                csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes);
+                    //Save WPA/RSN IE
+                csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes);
+#ifdef FEATURE_WLAN_CCX
+                roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc;
+#endif
+                
+                // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then
+                // substate change.
+                // Moving even save profile above so that below mentioned conditon is also met.
+                // JEZ100225: Moved to after saving the profile. Fix needed in main/latest
+                csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId );
+
+                // Make sure the Set Context is issued before link indication to NDIS.  After link indication is 
+                // made to NDIS, frames could start flowing.  If we have not set context with LIM, the frames
+                // will be dropped for the security context may not be set properly. 
+                //
+                // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link
+                // indication.  (Link Indication happens in the profFSMSetConnectedInfra call).
+                //
+                // this reordering was done on titan_prod_usb branch and is being replicated here.
+                //
+            
+                if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) &&
+                                        !pProfile->bWPSAssociation)
+                {
+                    // Issue the set Context request to LIM to establish the Unicast STA context
+                    if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId,
+                                                pProfile->negotiatedUCEncryptionType, 
+                                                pSirBssDesc, &(pSirBssDesc->bssId),
+                                                FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter.
+                    {
+                        smsLog( pMac, LOGE, FL("  Set context for unicast fail\n") );
+                        csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId );
+                    }
+                    // Issue the set Context request to LIM to establish the Broadcast STA context
+                    csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType,
+                                               pSirBssDesc, &BroadcastMac,
+                                               FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter.
+                }
+                else
+                {
+                    //Need to wait for supplicant authtication
+                    roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE;
+
+                    //Set the subestate to WaitForKey in case authentiation is needed
+                    csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId );
+
+
+                    if(pProfile->bWPSAssociation)
+                    {
+                        key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD;
+                    }
+                    else
+                    {
+                        key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD;
+                    }
+                    
+                    //Save sessionId in case of timeout
+                    pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId;
+                    //This time should be long enough for the rest of the process plus setting key
+                    if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) )
+                    {
+                        //Reset our state so nothting is blocked.
+                        smsLog( pMac, LOGE, FL("   Failed to start pre-auth timer\n") );
+                        csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId);
+                    }
+                }
+                
+                assocInfo.pBssDesc = pSirBssDesc; //could be NULL
+                assocInfo.pProfile = pProfile;
+
+                if(Context)
+                {
+                    tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context;
+                    tANI_U32 len;
+
+                    csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
+                    len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                    len += pJoinRsp->parsedRicRspLen;
+#endif /* WLAN_FEATURE_VOWIFI_11R */                    
+#ifdef FEATURE_WLAN_CCX
+                    len += pJoinRsp->tspecIeLen;
+#endif
+                    if(len)
+                    {
+                        if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, 
+                                        (void **)&pSession->connectedInfo.pbFrames, len)))
+                        {
+                            if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, 
+                                            pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) ))
+                            {
+                                pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength;
+                                pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength;
+                                pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                                pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen;
+#endif /* WLAN_FEATURE_VOWIFI_11R */                                
+#ifdef FEATURE_WLAN_CCX
+                                pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen;
+#endif
+                                roamInfo.nAssocReqLength = pJoinRsp->assocReqLength;
+                                roamInfo.nAssocRspLength = pJoinRsp->assocRspLength;
+                                roamInfo.nBeaconLength = pJoinRsp->beaconLength;
+                                roamInfo.pbFrames = pSession->connectedInfo.pbFrames;
+                            }
+                            else
+                            {
+                                smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!\n", 
+                                        __FUNCTION__, len);
+                                palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames );
+                                pSession->connectedInfo.pbFrames = NULL;
+                            }
+                        }
+                    }
+                    if(pCommand->u.roamCmd.fReassoc)
+                    {
+                        roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE;
+                    }
+                    pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId;
+                    roamInfo.staId = ( tANI_U8 )pJoinRsp->staId;
+                    roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig;
+                    roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig;
+                }
+                else
+                {
+                   if(pCommand->u.roamCmd.fReassoc)
+                   {
+                       roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE;
+                       roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength;
+                       roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength;
+                       roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength;
+                       roamInfo.pbFrames = pSession->connectedInfo.pbFrames;
+                   }
+                }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                // Indicate SME-QOS with reassoc success event, only after 
+                // copying the frames 
+                sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo);
+#endif
+
+
+                roamInfo.pBssDesc = pSirBssDesc;
+                roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL);
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+                pSession->connectedProfile.acm_mask = acm_mask;
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+                //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame
+                //It may be better to let QoS do this????
+                if( pSession->connectedProfile.modifyProfileFields.uapsd_mask )
+                {
+                    smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now\n",
+                        pSession->connectedProfile.modifyProfileFields.uapsd_mask);
+                    pmcStartUapsd( pMac, NULL, NULL );
+                }
+#endif
+
+                roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
+                if( pSession->bRefAssocStartCnt > 0 )
+                {
+                    pSession->bRefAssocStartCnt--;
+                    csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED);
+                }
+                
+                csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE);
+
+                // reset the PMKID candidate list
+                csrResetPMKIDCandidateList( pMac, sessionId );
+                //Update TL's AC weight base on the current EDCA parameters
+                //These parameters may change in the course of the connection, that sictuation
+                //is not taken care here. This change is mainly to address a WIFI WMM test where
+                //BE has a equal or higher TX priority than VI. 
+                //We only do this for infra link
+                if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes )
+                {
+                    csrCheckAndUpdateACWeight(pMac, pIes);
+                }
+#ifdef FEATURE_WLAN_WAPI
+                // reset the BKID candidate list
+                csrResetBKIDCandidateList( pMac, sessionId );
+#endif /* FEATURE_WLAN_WAPI */
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "  Roam command doesn't have a BSS desc\n");
+            }
+
+            csrScanCancelIdleScan(pMac);
+            //Not to signal link up because keys are yet to be set.
+            //The linkup function will overwrite the sub-state that we need to keep at this point.
+            if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) )
+            {
+                csrRoamLinkUp(pMac, pSession->connectedProfile.bssid);
+            }
+
+            //Check if BMPS is required and start the BMPS retry timer.  Timer period is large
+            //enough to let security and DHCP handshake succeed before entry into BMPS
+            if (pmcShouldBmpsTimerRun(pMac))
+            {
+                if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP)
+                    != eHAL_STATUS_SUCCESS)
+                {
+                    smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer"));
+                }
+                smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started"));
+            }
+
+            break;
+
+
+        case eCsrStartBssSuccess:
+            // on the StartBss Response, LIM is returning the Bss Description that we
+            // are beaconing.  Add this Bss Description to our scan results and
+            // chain the Profile to this Bss Description.  On a Start BSS, there was no
+            // detected Bss description (no partner) so we issued the Start Bss to
+            // start the Ibss without any Bss description.  Lim was kind enough to return
+            // the Bss Description that we start beaconing for the newly started Ibss.
+            smsLog(pMac, LOG2, FL("receives start BSS ok indication\n"));
+            status = eHAL_STATUS_FAILURE;
+#ifdef WLAN_SOFTAP_FEATURE
+            pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context;
+#endif             
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+            if( CSR_IS_IBSS( pProfile ) )
+            {
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED;
+            }
+#ifdef WLAN_SOFTAP_FEATURE
+            else if (CSR_IS_INFRA_AP(pProfile))
+            {
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED;
+            }
+#endif
+            else
+            {
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED;
+            }
+            if( !CSR_IS_WDS_STA( pProfile ) )
+            {
+                csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId );
+#ifdef WLAN_SOFTAP_FEATURE
+                pSirBssDesc = &pSmeStartBssRsp->bssDescription;
+#else
+                pSirBssDesc = (tSirBssDescription *)Context;
+#endif
+                if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) )
+                {
+                    smsLog(pMac, LOG2, FL("cannot parse IBSS IEs\n"));
+                    roamInfo.pBssDesc = pSirBssDesc;
+                    //We need to associate_complete it first, becasue Associate_start already indicated.
+                    csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                            eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED );
+                    break;
+                }
+#ifdef WLAN_SOFTAP_FEATURE
+                if (!CSR_IS_INFRA_AP(pProfile))
+#endif
+                {
+                    pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes );
+                }
+                csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc);
+                csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile);
+                csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
+                if(pSirBssDesc)
+                {
+                    csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes);
+                    palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid));
+                }
+                //We are doen with the IEs so free it
+                palFreeMemory(pMac->hHdd, pIes);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                {
+                    vos_log_ibss_pkt_type *pIbssLog;
+                    tANI_U32 bi;
+    
+                    WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+                    if(pIbssLog)
+                    { 
+                        if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList)
+                        {
+                            //We start the IBSS (didn't find any matched IBSS out there)
+                            pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP;
+                        }
+                        else
+                        {
+                            pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP;
+                        }
+                        if(pSirBssDesc)
+                        {
+                            palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6);
+                            pIbssLog->operatingChannel = pSirBssDesc->channelId;
+                        }
+                        if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi)))
+                        {
+                            //***U8 is not enough for beacon interval
+                            pIbssLog->beaconInterval = (v_U8_t)bi;
+                        }
+                        WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+                    }
+                }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption
+                //is WPA2-PSK so it won't matter.
+
+#ifdef WLAN_SOFTAP_FEATURE
+                if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile ))
+                {
+#else 
+                if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ))
+                {
+#endif
+                    // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss.
+                    csrRoamIssueSetContextReq( pMac, sessionId, 
+                                        pProfile->negotiatedMCEncryptionType, 
+                                        pSirBssDesc, &BroadcastMac,
+                                        FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter.
+                }
+            }
+            else
+            {
+                //Keep the state to eCSR_ROAMING_STATE_JOINING
+                //Need to send join_req.
+                if(pCommand->u.roamCmd.pRoamBssEntry)
+                {
+                    if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link)))
+                    {
+                        pSirBssDesc = &pScanResult->Result.BssDescriptor;
+                        pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes );
+                        // Set the roaming substate to 'join attempt'...
+                        csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId);
+                        status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes );
+                    }
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc\n" );
+                    VOS_ASSERT( 0 );
+                }
+            }
+            //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection
+            //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will 
+            //trigger the connection start indication in Vista
+            if( !CSR_IS_JOIN_TO_IBSS( pProfile ) )
+            {
+                roamStatus = eCSR_ROAM_IBSS_IND;
+                roamResult = eCSR_ROAM_RESULT_IBSS_STARTED;
+                if( CSR_IS_WDS( pProfile ) )
+                {
+                    roamStatus = eCSR_ROAM_WDS_IND;
+                    roamResult = eCSR_ROAM_RESULT_WDS_STARTED;
+                }
+#ifdef WLAN_SOFTAP_FEATURE
+                if( CSR_IS_INFRA_AP( pProfile ) )
+                {
+                    roamStatus = eCSR_ROAM_INFRA_IND;
+                    roamResult = eCSR_ROAM_RESULT_INFRA_STARTED;
+                }
+#endif  
+                 
+                //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection
+                //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will 
+                //trigger the connection start indication in Vista
+                palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+                if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList)
+                {
+                    //We start the IBSS (didn't find any matched IBSS out there)
+                    roamInfo.pBssDesc = pSirBssDesc;
+                }
+#ifdef WLAN_SOFTAP_FEATURE
+                roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId;
+#endif
+                csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult );
+            }
+    
+            csrScanCancelIdleScan(pMac);
+            //Only use this timer for ibss. BAP has its own timer for WDS
+            if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList)
+            {
+              //start the join IBSS timer
+                csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval
+                pSession->ibss_join_pending = TRUE;
+            }
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                //Already sent join_req for the WDS station
+                fReleaseCommand = eANI_BOOLEAN_FALSE;
+            }
+            else if( CSR_IS_WDS_STA( pProfile ) )
+            {
+                //need to send stop BSS because we fail to send join_req
+                csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED );
+                csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED );
+            }
+
+            break;
+
+        case eCsrStartBssFailure:
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+            {
+                vos_log_ibss_pkt_type *pIbssLog;
+
+                WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+                if(pIbssLog)
+                {
+                    pIbssLog->status = WLAN_IBSS_STATUS_FAILURE;
+                    WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+                }
+            }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+            roamStatus = eCSR_ROAM_IBSS_IND;
+            roamResult = eCSR_ROAM_RESULT_IBSS_STARTED;
+            if( CSR_IS_WDS( pProfile ) )
+            {
+                roamStatus = eCSR_ROAM_WDS_IND;
+                roamResult = eCSR_ROAM_RESULT_WDS_STARTED;
+            }
+#ifdef WLAN_SOFTAP_FEATURE
+            if( CSR_IS_INFRA_AP( pProfile ) )
+            {
+                roamStatus = eCSR_ROAM_INFRA_IND;
+                roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED;
+            }
+#endif
+            if(Context)
+            {
+                pSirBssDesc = (tSirBssDescription *)Context;
+            }
+            else
+            {
+                pSirBssDesc = NULL;
+            }
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+            roamInfo.pBssDesc = pSirBssDesc;
+            //We need to associate_complete it first, becasue Associate_start already indicated.
+            csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult );
+            csrSetDefaultDot11Mode( pMac );
+            break;
+
+        case eCsrSilentlyStopRoaming:
+            // We are here because we try to start the same IBSS
+            //No message to PE
+            // return the roaming state to Joined.
+            smsLog(pMac, LOGW, FL("receives silently roaming indication\n"));
+            csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId );
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId );
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+            roamInfo.pBssDesc = pSession->pConnectBssDesc;
+            if( roamInfo.pBssDesc )
+            {
+                palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid));
+            }
+            //Since there is no change in the current state, simply pass back no result otherwise
+            //HDD may be mistakenly mark to disconnected state.
+            csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE );
+
+            break;
+
+        case eCsrSilentlyStopRoamingSaveState:
+            //We are here because we try to connect to the same AP
+            //No message to PE
+            smsLog(pMac, LOGW, FL("receives silently stop roaming indication\n"));
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo));
+            
+            //to aviod resetting the substate to NONE
+            pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED;
+            //No need to change substate to wai_for_key because there is no state change
+            roamInfo.pBssDesc = pSession->pConnectBssDesc;
+            if( roamInfo.pBssDesc )
+            {
+                palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid));
+            }
+
+            roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+            roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+            roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength;
+            roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength;
+            roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength;
+            roamInfo.pbFrames = pSession->connectedInfo.pbFrames;
+            roamInfo.staId = pSession->connectedInfo.staId;
+            roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
+#if defined(VOSS_ENABLED)
+            VOS_ASSERT( roamInfo.staId != 0 );
+#endif
+            pSession->bRefAssocStartCnt--;
+            csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED);
+            csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE);
+            break;
+
+        case eCsrReassocFailure:
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL);
+#endif
+        case eCsrJoinWdsFailure:
+            smsLog(pMac, LOGW, FL("failed to join WDS\n"));
+            csrFreeConnectBssDesc(pMac, sessionId);
+            csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile);
+            csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+            roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss;
+            roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+            roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+            csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                    eCSR_ROAM_WDS_IND, 
+                                    eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED);
+            //Need to issue stop_bss
+            break;
+
+        case eCsrJoinFailure:
+        case eCsrNothingToJoin:
+        default:
+        {
+            smsLog(pMac, LOGW, FL("receives no association indication\n"));
+            if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || 
+                CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) )
+            {
+                //do not free for the other profiles as we need to send down stop BSS later
+                csrFreeConnectBssDesc(pMac, sessionId);
+                csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile);
+                csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
+                csrSetDefaultDot11Mode( pMac );
+            }
+
+            switch( pCommand->u.roamCmd.roamReason )
+            {
+                // If this transition is because of an 802.11 OID, then we transition
+                // back to INIT state so we sit waiting for more OIDs to be issued and
+                // we don't start the IDLE timer.
+                case eCsrSmeIssuedAssocToSimilarAP:
+                case eCsrHddIssued:
+                    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId );
+                    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                    roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss;
+                    roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                    roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+
+                    /* Defeaturize this later if needed */
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+                    /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */
+                    if (csrRoamIsHandoffInProgress(pMac))
+                    {
+                        csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED);
+                        /* Should indicate neighbor roam algorithm about the connect failure here */
+                        csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE);
+                    }
+                    else
+#endif
+                    {
+                        if(pSession->bRefAssocStartCnt > 0)
+                        {
+                            pSession->bRefAssocStartCnt--;
+                            csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                                eCSR_ROAM_ASSOCIATION_COMPLETION, 
+                                                eCSR_ROAM_RESULT_FAILURE);
+                        }
+                    }
+                    smsLog(pMac, LOG1, FL("  roam(reason %d) failed\n"), pCommand->u.roamCmd.roamReason);
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                    sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
+#endif
+                    csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE);
+                    csrScanStartIdleScan(pMac);
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+                    //For WDS STA. To fix the issue where the WDS AP side may be too busy by
+                    //BT activity and not able to recevie WLAN traffic. Retry the join
+                    if( CSR_IS_WDS_STA(pProfile) )
+                    {
+                        csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD);
+                    }
+#endif
+                    break;
+
+                case eCsrHddIssuedReassocToSameAP:
+                case eCsrSmeIssuedReassocToSameAP:
+                    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId);
+
+                    csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED);
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT                                        
+                    sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
+#endif
+                    csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE);
+                    csrScanStartIdleScan(pMac);
+                    break;
+                case eCsrForcedDisassoc:
+                case eCsrForcedDeauth:
+                case eCsrSmeIssuedIbssJoinFailure:
+                    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId);
+
+                    if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason)
+                    {
+                        // Notify HDD that IBSS join failed
+                        csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED);
+                    }
+                    else
+                    {
+                        csrRoamCallCallback(pMac, sessionId, NULL, 
+                                            pCommand->u.roamCmd.roamId, 
+                                            eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED);
+                    }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                    sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
+#endif
+                    csrRoamLinkDown(pMac, sessionId);
+                    csrScanStartIdleScan(pMac);
+                    break;
+                case eCsrForcedIbssLeave:
+                     csrRoamCallCallback(pMac, sessionId, NULL, 
+                                        pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_IBSS_LEAVE,
+                                        eCSR_ROAM_RESULT_IBSS_STOP);
+                    break;
+                case eCsrForcedDisassocMICFailure:
+                    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId );
+
+                    csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE);
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                    sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL);
+#endif
+                    csrScanStartIdleScan(pMac);
+                    break;
+#ifdef WLAN_SOFTAP_FEATURE
+                case eCsrStopBss:
+                    csrRoamCallCallback(pMac, sessionId, NULL, 
+                                        pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_INFRA_IND, 
+                                        eCSR_ROAM_RESULT_INFRA_STOPPED);
+                    break;
+                case eCsrForcedDisassocSta:
+                case eCsrForcedDeauthSta:
+                   csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId);
+                   if( CSR_IS_SESSION_VALID(pMac, sessionId) )
+                   {                    
+                       pSession = CSR_GET_SESSION(pMac, sessionId);
+                       if (!pSession)
+                           break;
+
+                       if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
+                       {
+                           roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
+                           palCopyMemory(pMac->hHdd, roamInfo.peerMac, 
+                              pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr));
+                           roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED;
+                           roamInfo.statusCode = eSIR_SME_SUCCESS;
+                           status = csrRoamCallCallback(pMac, sessionId, 
+                                       &roamInfo, pCommand->u.roamCmd.roamId, 
+                                       eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED);
+                       }
+                   }
+                   break;
+#endif
+                case eCsrLostLink1:
+                    // if lost link roam1 failed, then issue lost link Scan2 ...
+                    csrScanRequestLostLink2(pMac, sessionId);
+                    break;
+                case eCsrLostLink2:
+                    // if lost link roam2 failed, then issue lost link scan3 ...
+                    csrScanRequestLostLink3(pMac, sessionId);
+                    break;
+                case eCsrLostLink3:
+                default:
+                    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId );
+
+                    //We are done with one round of lostlink roaming here
+                    csrScanHandleFailedLostlink3(pMac, sessionId);
+                    break;
+            }
+
+            break;
+        }
+    }
+
+    return ( fReleaseCommand );
+}
+
+
+eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    return (status);
+}
+
+
+eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 size = 0;
+    
+    do
+    {
+        palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile));
+        if(pSrcProfile->BSSIDs.numOfBSSIDs)
+        {
+            size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs;
+            palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size);
+        }
+        if(pSrcProfile->SSIDs.numOfSSIDs)
+        {
+            size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs;
+            palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size);
+        }
+        if(pSrcProfile->nWPAReqIELength)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength;
+            palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength);
+        }
+        if(pSrcProfile->nRSNReqIELength)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength;
+            palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength);
+        }
+#ifdef FEATURE_WLAN_WAPI
+        if(pSrcProfile->nWAPIReqIELength)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength;
+            palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength);
+        }
+#endif /* FEATURE_WLAN_WAPI */
+
+        if(pSrcProfile->nAddIEScanLength)
+        {
+            status = palAllocateMemory(pMac->hHdd,
+                     (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength;
+            palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan,
+                pSrcProfile->nAddIEScanLength);
+        }
+
+        if(pSrcProfile->nAddIEAssocLength)
+        {
+            status = palAllocateMemory(pMac->hHdd,
+                     (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength;
+            palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc,
+                pSrcProfile->nAddIEAssocLength);
+        }
+
+        if(pSrcProfile->ChannelInfo.ChannelList)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels;
+            palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels);
+        }
+
+        pDstProfile->AuthType = pSrcProfile->AuthType;
+        pDstProfile->EncryptionType = pSrcProfile->EncryptionType;
+        pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType;
+        pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType;
+        pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType;
+        pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType;
+        pDstProfile->BSSType = pSrcProfile->BSSType;
+        pDstProfile->phyMode = pSrcProfile->phyMode;
+        pDstProfile->csrPersona = pSrcProfile->csrPersona;
+        
+#ifdef FEATURE_WLAN_WAPI
+        if(csrIsProfileWapi(pSrcProfile))
+        {
+             if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n)
+             {
+                pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n;
+             }
+        }
+#endif /* FEATURE_WLAN_WAPI */
+        pDstProfile->CBMode = pSrcProfile->CBMode;
+        /*Save the WPS info*/
+        pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation;
+        pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask;
+
+        pDstProfile->beaconInterval = pSrcProfile->beaconInterval;
+#ifdef WLAN_SOFTAP_FEATURE
+        pDstProfile->privacy           = pSrcProfile->privacy;
+        pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq;
+        pDstProfile->csr80211AuthType  = pSrcProfile->csr80211AuthType;
+        pDstProfile->dtimPeriod        = pSrcProfile->dtimPeriod;
+        pDstProfile->ApUapsdEnable     = pSrcProfile->ApUapsdEnable;   
+        pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden;
+        pDstProfile->protEnabled       = pSrcProfile->protEnabled;  
+        pDstProfile->obssProtEnabled   = pSrcProfile->obssProtEnabled;  
+        pDstProfile->cfg_protection    = pSrcProfile->cfg_protection;
+        pDstProfile->wps_state         = pSrcProfile->wps_state;
+        pDstProfile->ieee80211d        = pSrcProfile->ieee80211d;
+#endif
+
+        palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys));
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (pSrcProfile->MDID.mdiePresent)
+        {
+            pDstProfile->MDID.mdiePresent = 1;
+            pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain;
+        }
+#endif
+
+    }while(0);
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrReleaseProfile(pMac, pDstProfile);
+        pDstProfile = NULL;
+    }
+    
+    return (status);
+}
+
+eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; 
+    do
+    {
+        palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile));
+        if(pSrcProfile->bssid)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->BSSIDs.numOfBSSIDs = 1;
+            palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid));
+        }
+        if(pSrcProfile->SSID.ssId)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pDstProfile->SSIDs.numOfSSIDs = 1;
+            pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted;
+            pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden;
+            palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid));
+        }
+
+        status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+           break;
+        }
+        pDstProfile->ChannelInfo.numOfChannels = 1;
+        pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel;
+
+        pDstProfile->AuthType.numEntries = 1;
+        pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType;
+        pDstProfile->negotiatedAuthType = pSrcProfile->AuthType;
+        pDstProfile->EncryptionType.numEntries = 1;
+        pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType;
+        pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType;
+        pDstProfile->mcEncryptionType.numEntries = 1;
+        pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType;
+        pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType;
+        pDstProfile->BSSType = pSrcProfile->BSSType;
+        pDstProfile->CBMode = pSrcProfile->CBMode;
+        palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys));
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (pSrcProfile->MDID.mdiePresent)
+        {
+            pDstProfile->MDID.mdiePresent = 1;
+            pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain;
+        }
+#endif
+    
+    }while(0);
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrReleaseProfile(pMac, pDstProfile);
+        pDstProfile = NULL;
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                tScanResultHandle hBSSList, 
+                                eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate,
+                                tANI_BOOLEAN fClearScan)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+    
+    pCommand = csrGetCommandBuffer(pMac);
+    if(NULL == pCommand)
+    {
+        smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+        status = eHAL_STATUS_RESOURCES;
+    }
+    else
+    {
+        if( fClearScan )
+        {
+            csrScanCancelIdleScan(pMac);
+            csrScanAbortMacScanNotForConnect(pMac);
+        }
+        pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
+        if(NULL == pProfile)
+        {
+            //We can roam now
+            //Since pProfile is NULL, we need to build our own profile, set everything to default
+            //We can only support open and no encryption
+            pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; 
+            pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+            pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1;
+            pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+            pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; 
+        }
+        else
+        {
+            //make a copy of the profile
+            status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE;
+            }
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.hBSSList = hBSSList;
+        pCommand->u.roamCmd.roamId = roamId;
+        pCommand->u.roamCmd.roamReason = reason;
+        //We need to free the BssList when the command is done
+        pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE;
+        pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE;
+
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                  FL("CSR PERSONA=%d"),
+                  pCommand->u.roamCmd.roamProfile.csrPersona);
+
+        status = csrQueueSmeCommand(pMac, pCommand, fImediate);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    }
+    
+    return (status);
+}
+
+eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                               tCsrRoamModifyProfileFields *pMmodProfileFields,
+                               eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+    
+    pCommand = csrGetCommandBuffer(pMac);
+    if(NULL == pCommand)
+    {
+        smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+        status = eHAL_STATUS_RESOURCES;
+    }
+    else
+    {
+        csrScanCancelIdleScan(pMac);
+        csrScanAbortMacScanNotForConnect(pMac);
+        if(pProfile)
+        {
+
+           //This is likely trying to reassoc to different profile
+           pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
+           //make a copy of the profile
+           status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile);
+           pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE;
+
+        }
+        else
+        {
+            status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile);
+            //how to update WPA/WPA2 info in roamProfile??
+            pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask;
+
+        }
+
+        if(HAL_STATUS_SUCCESS(status))
+        {
+           pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE;
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.roamId = roamId;
+        pCommand->u.roamCmd.roamReason = reason;
+        //We need to free the BssList when the command is done
+        //For reassoc there is no BSS list, so the boolean set to false
+        pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; 
+        pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE;
+        pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE;
+
+        status = csrQueueSmeCommand(pMac, pCommand, fImediate);
+        if( !HAL_STATUS_SUCCESS( status ) )
+    {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE);
+            csrReleaseCommandRoam( pMac, pCommand );
+    }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                     tScanResultHandle hBssListIn, tANI_U32 *pRoamId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultHandle hBSSList;
+    tANI_U32 roamId = 0;
+
+    status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+        if(pRoamId)
+        {
+            *pRoamId = roamId;
+        }
+        status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, 
+                                        roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("failed to start a join process\n"));
+            csrScanResultPurge(pMac, hBSSList);
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                          tScanResultHandle hBssListIn, tANI_U32 *pRoamId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tScanResultHandle hBSSList;
+    tCsrScanResultFilter *pScanFilter;
+    tANI_U32 roamId = 0;
+    tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if (NULL == pProfile)
+    {
+        smsLog(pMac, LOGP, FL("No profile specified"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    smsLog(pMac, LOG1, FL("called  BSSType = %d authtype = %d  encryType = %d\n"),
+                pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]);
+
+    if( CSR_IS_WDS( pProfile ) && 
+        !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) )
+    {
+        return status;
+    }
+    csrRoamCancelRoaming(pMac, sessionId);
+    csrScanRemoveFreshScanCommand(pMac, sessionId);
+    csrScanCancelIdleScan(pMac);
+    //Only abort the scan if it is not used for other roam/connect purpose
+    csrScanAbortMacScan(pMac);
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan
+    {
+        csrScanDisable(pMac);
+    }
+#endif
+
+    csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued);
+    //Check whether ssid changes
+    if(csrIsConnStateConnected(pMac, sessionId))
+    {
+        if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs))
+        {
+            csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+        }
+    }
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+    pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; 
+#endif
+    if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn)
+    {
+        smsLog(pMac, LOGW, FL("is called with BSSList\n"));
+        status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId);
+        if(pRoamId)
+        {
+            roamId = *pRoamId;
+        }
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            fCallCallback = eANI_BOOLEAN_TRUE;
+        }
+    }
+    else
+    {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            //Try to connect to any BSS
+            if(NULL == pProfile)
+            {
+                //No encryption
+                pScanFilter->EncryptionType.numEntries = 1;
+                pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+            }//we don't have a profile
+            else 
+            {
+                //Here is the profile we need to connect to
+                status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter);
+            }//We have a profile
+            roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+            if(pRoamId)
+            {
+                *pRoamId = roamId;
+            }
+            
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                /*Save the WPS info*/
+                if(NULL != pProfile)
+                {
+                    pScanFilter->bWPSAssociation = pProfile->bWPSAssociation;
+                }
+                else
+                {
+                    pScanFilter->bWPSAssociation = 0;
+                }
+
+                do
+                {
+                    if( (pProfile && CSR_IS_WDS_AP( pProfile ) )
+#ifdef WLAN_SOFTAP_FEATURE
+                     || (pProfile && CSR_IS_INFRA_AP ( pProfile ))
+#endif
+                    )
+                    {
+                        //This can be start right away
+                        status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, 
+                                                    roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+                        if(!HAL_STATUS_SUCCESS(status))
+                        {
+                            fCallCallback = eANI_BOOLEAN_TRUE;
+                        }
+
+                        break;
+                    }
+                    status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+                    smsLog(pMac, LOGE, "************ csrScanGetResult Status ********* %d\n", status);
+                    if(HAL_STATUS_SUCCESS(status))
+                    {
+
+                        status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, 
+                                                    roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+                        if(!HAL_STATUS_SUCCESS(status))
+                        {
+                            csrScanResultPurge(pMac, hBSSList);
+                            fCallCallback = eANI_BOOLEAN_TRUE;
+                        }
+                    }//Have scan result
+                    else if(NULL != pProfile)
+                    {
+                        //Check whether it is for start ibss
+                        if(CSR_IS_START_IBSS(pProfile))
+                        {
+                            status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, 
+                                                        roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+                            if(!HAL_STATUS_SUCCESS(status))
+                            {
+                                smsLog(pMac, LOGE, "   CSR failed to issue startIBSS command with status = 0x%08X\n", status);
+                                fCallCallback = eANI_BOOLEAN_TRUE;
+                            }
+                        }
+                        else
+                        {
+                            //scan for this SSID
+                            status = csrScanForSSID(pMac, sessionId, pProfile, roamId);
+                            if(!HAL_STATUS_SUCCESS(status))
+                            {
+                                fCallCallback = eANI_BOOLEAN_TRUE;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        fCallCallback = eANI_BOOLEAN_TRUE;
+                    }
+                } while (0);
+                if(NULL != pProfile)
+                {
+                    //we need to free memory for filter if profile exists
+                    csrFreeScanFilter(pMac, pScanFilter);
+                }
+            }//Got the scan filter from profile
+            
+            palFreeMemory(pMac->hHdd, pScanFilter);
+        }//allocated memory for pScanFilter
+    }//No Bsslist coming in
+    //tell the caller if we fail to trigger a join request
+    if( fCallCallback )
+    {
+        csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
+    }
+   
+    return (status);
+}                         
+
+eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                          tCsrRoamModifyProfileFields modProfileFields,
+                          tANI_U32 *pRoamId)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE;
+   tANI_U32 roamId = 0;
+   tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+   if (NULL == pProfile)
+   {
+      smsLog(pMac, LOGP, FL("No profile specified"));
+      return eHAL_STATUS_FAILURE;
+   }
+
+   smsLog(pMac, LOG1, FL("called  BSSType = %d authtype = %d  encryType = %d\n"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]);
+   csrRoamCancelRoaming(pMac, sessionId);
+   csrScanRemoveFreshScanCommand(pMac, sessionId);
+   csrScanCancelIdleScan(pMac);
+   csrScanAbortMacScanNotForConnect(pMac);
+   csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP);
+
+   if(csrIsConnStateConnected(pMac, sessionId))
+   {
+      if(pProfile)
+      {
+         if(pProfile->SSIDs.numOfSSIDs && 
+            csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs))
+         {
+            fCallCallback = eANI_BOOLEAN_FALSE;
+         }
+         else
+         {
+            smsLog(pMac, LOG1, FL("Not connected to the same SSID asked in the profile\n"));
+         }
+      }
+      else if(!palEqualMemory(pMac->hHdd, &modProfileFields, 
+                              &pSession->connectedProfile.modifyProfileFields, 
+                              sizeof(tCsrRoamModifyProfileFields)))
+      {
+         fCallCallback = eANI_BOOLEAN_FALSE;
+      }
+      else
+      {
+         smsLog(pMac, LOG1, FL("Either the profile is NULL or none of the fields "
+                               "in tCsrRoamModifyProfileFields got modified\n"));
+      }
+   }
+   else
+   {
+      smsLog(pMac, LOG1, FL("Not connected! No need to reassoc\n"));
+   }
+
+   if(!fCallCallback)
+   {
+      roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+      if(pRoamId)
+      {
+         *pRoamId = roamId;
+      }
+
+
+      status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, 
+                                   eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE);
+
+   }
+   else
+   {
+      status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, 
+                                   eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
+   }
+
+   return status;
+}
+
+eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultHandle hBSSList = NULL;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tANI_U32 roamId;
+    tCsrRoamProfile *pProfile = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do
+    {
+        if(pSession->pCurRoamProfile)
+        {
+            csrScanCancelIdleScan(pMac);
+            csrScanAbortMacScanNotForConnect(pMac);
+            //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect
+            status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile));
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile));
+            status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile);
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+            status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                //we want to put the last connected BSS to the very beginning, if possible
+                csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList);
+                status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, 
+                                                roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    csrScanResultPurge(pMac, hBSSList);
+                    break;
+                }
+            }
+            else
+            {
+                //Do a scan on this profile
+                //scan for this SSID only in case the AP suppresses SSID
+                status = csrScanForSSID(pMac, sessionId, pProfile, roamId);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    break;
+                }
+            }
+        }//We have a profile
+        else
+        {
+            smsLog(pMac, LOGW, FL("cannot find a roaming profile\n"));
+            break;
+        }
+    }while(0);
+    if(pScanFilter)
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+    if(NULL != pProfile)
+    {
+        csrReleaseProfile(pMac, pProfile);
+        palFreeMemory(pMac->hHdd, pProfile);
+    }
+
+    return (status);
+}
+
+eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    if(csrIsConnStateConnected(pMac, sessionId))
+    {
+        status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = csrRoamJoinLastProfile(pMac, sessionId);
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    smsLog(pMac, LOGW, FL("is called\n"));
+    csrRoamCancelRoaming(pMac, sessionId);
+    csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued);
+    if(csrIsConnStateDisconnected(pMac, sessionId))
+    {
+        status = csrRoamJoinLastProfile(pMac, sessionId);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE;
+    eCsrRoamSubState NewSubstate;
+    tANI_U32 sessionId = pCommand->sessionId;
+    
+    // change state to 'Roaming'...
+    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId );
+
+    if ( csrIsConnStateIbss( pMac, sessionId ) )
+    {
+        // If we are in an IBSS, then stop the IBSS...
+        status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+        fComplete = (!HAL_STATUS_SUCCESS(status));
+    }
+    else if ( csrIsConnStateInfra( pMac, sessionId ) )
+    {
+        smsLog(pMac, LOGE, FL(" restore AC weights (%d-%d-%d-%d)\n"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1],
+            pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]);
+        //Restore AC weight in case we change it 
+        WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
+        // in Infrasturcture, we need to disassociate from the Infrastructure network...
+        NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED;
+        if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason)
+        {
+            NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF;
+        }
+        if( fDisassoc )
+        {
+            status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure );
+        }
+        else
+        {
+            status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ );
+        }
+        fComplete = (!HAL_STATUS_SUCCESS(status));
+    }
+    else if ( csrIsConnStateWds( pMac, sessionId ) )
+    {
+        if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) )
+        {
+            status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+            fComplete = (!HAL_STATUS_SUCCESS(status));
+        }
+        //This has to be WDS station
+        else  if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station
+        {
+ 
+            pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE;
+            if( fDisassoc )
+            {
+                status = csrRoamIssueDisassociate( pMac, sessionId, 
+                                eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure );
+                fComplete = (!HAL_STATUS_SUCCESS(status));
+            }
+        }
+    } else {
+        // we got a dis-assoc request while not connected to any peer
+        // just complete the command
+           fComplete = eANI_BOOLEAN_TRUE;
+           status = eHAL_STATUS_FAILURE;
+    }
+    if(fComplete)
+    {
+        csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+    }
+
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        if ( csrIsConnStateInfra( pMac, sessionId ) )
+        {
+            //Set the state to disconnect here 
+            pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+        }
+    }
+    return (status);
+}
+
+
+/* This is been removed from latest code base */
+/*
+static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status;
+    tANI_U32 sessionId = pCommand->sessionId;
+
+    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING );
+    status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+
+    return ( status );
+}
+*/
+
+
+eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+        tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE;
+
+    do
+    {
+        smsLog( pMac, LOGE, FL("  reason = %d\n"), reason );
+        pCommand = csrGetCommandBuffer( pMac );
+        if ( !pCommand ) 
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        //Change the substate in case it is wait-for-key
+        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) )
+        {
+            csrRoamStopWaitForKeyTimer( pMac );
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId);
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        switch ( reason )
+        {
+        case eCSR_DISCONNECT_REASON_MIC_ERROR:
+            pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure;
+            break;
+
+        case eCSR_DISCONNECT_REASON_DEAUTH:
+            pCommand->u.roamCmd.roamReason = eCsrForcedDeauth;
+            break;
+
+        case eCSR_DISCONNECT_REASON_HANDOFF:
+            fHighPriority = eANI_BOOLEAN_TRUE;
+            pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff;
+            break;
+
+        case eCSR_DISCONNECT_REASON_UNSPECIFIED:
+        case eCSR_DISCONNECT_REASON_DISASSOC:
+            pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc;
+            break;
+
+        case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE:
+            pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure;
+            break;
+
+        case eCSR_DISCONNECT_REASON_IBSS_LEAVE:
+            pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave;
+            break;
+
+        default:
+            break;
+        }
+        status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    } while( 0 );
+
+    return( status );
+}
+
+
+eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+
+    pCommand = csrGetCommandBuffer( pMac );
+    if ( NULL != pCommand ) 
+    {
+        //Change the substate in case it is wait-for-key
+        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) )
+        {
+            csrRoamStopWaitForKeyTimer( pMac );
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId);
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.roamReason = eCsrStopBss;
+        status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+        status = eHAL_STATUS_RESOURCES;
+    }
+
+    return ( status );
+}
+
+
+eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+    //Stop te retry
+    pSession->maxRetryCount = 0;
+    csrRoamStopJoinRetryTimer(pMac, sessionId);
+#endif
+    //Not to call cancel roaming here
+    //Only issue disconnect when necessary
+    if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) 
+                || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) 
+                || csrIsRoamCommandWaitingForSession(pMac, sessionId) )
+                
+    {
+        smsLog(pMac, LOG2, FL("called\n"));
+        status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason)
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    csrRoamCancelRoaming(pMac, sessionId);
+    pSession->ibss_join_pending = FALSE;
+    csrRoamStopIbssJoinTimer(pMac, sessionId);
+    csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc);
+    
+    return (csrRoamDisconnectInternal(pMac, sessionId, reason));
+}
+
+
+eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                          tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tDot11fBeaconIEs *pIesTemp = pIes;
+    tANI_U8 index;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile;
+    
+    palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile));
+    pConnectProfile->AuthType = pProfile->negotiatedAuthType;
+        pConnectProfile->AuthInfo = pProfile->AuthType;
+    pConnectProfile->CBMode = pProfile->CBMode;  //*** this may not be valid
+    pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType;
+        pConnectProfile->EncryptionInfo = pProfile->EncryptionType;
+    pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType;
+        pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType;
+    pConnectProfile->BSSType = pProfile->BSSType;
+    pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask;
+    pConnectProfile->operationChannel = pSirBssDesc->channelId;
+    palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys));
+    //Save bssid
+    csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid);
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (pSirBssDesc->mdiePresent)
+    {
+        pConnectProfile->MDID.mdiePresent = 1;
+        pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]);
+    }
+#endif
+#ifdef FEATURE_WLAN_CCX
+    if ((csrIsProfileCCX(pProfile) || ((pIesTemp->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+    {
+        pConnectProfile->isCCXAssoc = 1;
+    }
+#endif
+    //save ssid
+    if( NULL == pIesTemp )
+    {
+        status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp);
+    }
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        if(pIesTemp->SSID.present)
+        {
+            pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid;
+            palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, 
+                            pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid);
+        }
+        
+        //Save the bss desc
+        status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc);
+
+           if( CSR_IS_QOS_BSS(pIesTemp) )
+           {
+              pConnectProfile->qap = TRUE;
+           }
+           else
+           {
+              pConnectProfile->qap = FALSE;
+           }
+
+        if ( NULL == pIes )
+        {
+            //Free memory if it allocated locally
+            palFreeMemory(pMac->hHdd, pIesTemp);
+        }
+    }
+    //Save Qos connection
+    pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection;
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrFreeConnectBssDesc(pMac, sessionId);
+    }
+    for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++)
+    {
+       if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) &&
+          palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, 
+                         pConnectProfile->SSID.ssId, pConnectProfile->SSID.length))
+       {
+          pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted;
+          break;
+       }
+       pConnectProfile->handoffPermitted = FALSE;
+    }
+    
+    return (status);
+}
+
+
+
+static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp )
+{
+   tListElem *pEntry = NULL;
+   tSmeCmd *pCommand = NULL;
+
+   //The head of the active list is the request we sent
+   pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+   if(pEntry)
+   {
+       pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+   }
+
+   if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) 
+   {
+            if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)
+            {
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+               sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL);
+#endif
+            }
+            csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp );
+   }
+   else
+   {
+        tANI_U32 roamId = 0;
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId );
+        
+        //The head of the active list is the request we sent
+        //Try to get back the same profile and roam again
+        if(pCommand)
+        {
+            roamId = pCommand->u.roamCmd.roamId;
+        }
+
+        pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode;
+        pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode;
+        smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode );
+#if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
+        /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */
+        if (csrRoamIsHandoffInProgress(pMac))
+        {
+            csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED);
+            /* Should indicate neighbor roam algorithm about the connect failure here */
+            csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE);
+        }
+#endif
+        if (pCommand)
+        {
+            if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile ))
+            {
+              pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE;
+              pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA;
+              csrRoamReissueRoamCommand(pMac);
+            }
+            else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) )
+            {
+                csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+            }
+            else
+            {
+                csrRoam(pMac, pCommand);
+            }    
+        }    
+        else
+        {
+           csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+        }
+    } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */
+}
+
+
+eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, 
+                             tDot11fBeaconIEs *pIes,
+                             tCsrRoamProfile *pProfile, tANI_U32 roamId )
+{
+    eHalStatus status;
+
+    smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", 
+                  pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ],
+                  pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] );
+    
+    // Set the roaming substate to 'join attempt'...
+    csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId);
+
+    // attempt to Join this BSS...
+    status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes );
+
+    return (status);
+}
+
+
+static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, 
+                              tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile)
+{
+    csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
+
+    // Set the roaming substate to 'join attempt'...
+    csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId );
+
+    smsLog(pMac, LOGE, FL("  calling csrSendSmeReassocReqMsg\n"));
+    
+    // attempt to Join this BSS...
+    return csrSendSmeReassocReqMsg( pMac, sessionId, pSirBssDesc, pIes, pProfile );
+}
+
+
+
+void csrRoamReissueRoamCommand(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+    tCsrRoamInfo roamInfo;
+    tANI_U32 sessionId;
+    tCsrRoamSession *pSession;
+            
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    if(pEntry)
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if ( eSmeCommandRoam == pCommand->command )
+        {
+            sessionId = pCommand->sessionId;
+            pSession = CSR_GET_SESSION( pMac, sessionId );
+            if( pCommand->u.roamCmd.fStopWds )
+            {
+                palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss;
+                roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+#ifdef WLAN_SOFTAP_FEATURE              
+                if (CSR_IS_WDS(&pSession->connectedProfile)){
+#endif
+                pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED;
+                csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
+                                        eCSR_ROAM_WDS_IND, 
+                                        eCSR_ROAM_RESULT_WDS_DISASSOCIATED);
+#ifdef  WLAN_SOFTAP_FEATURE
+                                }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){
+                                        pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED;
+                                        csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId,
+                                                                                eCSR_ROAM_INFRA_IND,
+                                                                                eCSR_ROAM_RESULT_INFRA_DISASSOCIATED);
+                                }  
+ 
+#endif                  
+
+
+                if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) )
+                {
+                    smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated\n");
+                    csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+                }
+            }
+            else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE))
+            {
+                smsLog(pMac, LOGW, " Failed to reissue join command after disassociated\n");
+                csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+            }
+        }
+        else
+        {
+            smsLog(pMac, LOGW, "  Command is not roaming after disassociated\n");
+        }
+    }
+    else 
+    {
+        smsLog(pMac, LOGE, "   Disassoc rsp cannot continue because no command is available\n");
+    }
+}
+
+
+tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry;
+    tSmeCmd *pCommand = NULL;
+
+    //alwasy lock active list before locking pending list
+    csrLLLock( &pMac->sme.smeCmdActiveList );
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
+    if(pEntry)
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) )
+        {
+            fRet = eANI_BOOLEAN_TRUE;
+        }
+    }
+    if(eANI_BOOLEAN_FALSE == fRet)
+    {
+        csrLLLock(&pMac->sme.smeCmdPendingList);
+        pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK);
+        while(pEntry)
+        {
+            pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+            if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) )
+            {
+                fRet = eANI_BOOLEAN_TRUE;
+                break;
+            }
+            pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK);
+        }
+        csrLLUnlock(&pMac->sme.smeCmdPendingList);
+    }
+    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
+    return (fRet);
+}
+
+
+tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tANI_U32 i;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) )
+        {
+            break;
+        }
+    }
+
+    return ( fRet );
+}
+
+
+tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+
+    //alwasy lock active list before locking pending list
+    csrLLLock( &pMac->sme.smeCmdActiveList );
+    fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
+    if(eANI_BOOLEAN_FALSE == fRet)
+    {
+        fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK);
+    }
+    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
+    return (fRet);
+}
+
+
+tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac )
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry;
+    tCsrCmd *pCommand;
+
+    //alwasy lock active list before locking pending list
+    csrLLLock( &pMac->sme.smeCmdActiveList );
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
+    if( pEntry )
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link);
+        if( ( eCsrRoamCommandScan == pCommand->command ) && 
+            ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || 
+              ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) ||
+              ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) )
+        {
+            fRet = eANI_BOOLEAN_TRUE;
+        }
+    }
+    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
+    return (fRet);
+}
+
+eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand = NULL;
+    tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE;
+    tANI_BOOLEAN fRemoveCmd = FALSE;
+    tListElem *pEntry; 
+
+    // Delete the old assoc command. All is setup for reassoc to be serialized
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if ( !pCommand ) 
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+            return eHAL_STATUS_RESOURCES;
+        }
+        if ( eSmeCommandRoam == pCommand->command )
+        {
+            if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP)
+            {
+                fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK );
+            }
+            else 
+            {
+                smsLog( pMac, LOGE, FL(" Unexpected active roam command present \n") );
+            }
+            if (fRemoveCmd == FALSE)
+            {
+                // Implies we did not get the serialized assoc command we
+                // were expecting
+                pCommand = NULL;
+            }
+        }
+    }
+
+    if(NULL == pCommand)
+    {
+        smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command\n") );
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    do 
+    {
+        //Change the substate in case it is wait-for-key
+        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) )
+        {
+            csrRoamStopWaitForKeyTimer( pMac );
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId );
+        }
+        pCommand->command = eSmeCommandRoam;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc;
+
+        status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandRoam( pMac, pCommand );
+        }
+    } while( 0 );
+
+
+    return( status );
+}
+static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result )
+{
+    tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    tCsrScanResult *pScanResult = NULL;
+    tSirBssDescription *pBssDesc = NULL;
+    tSmeCmd *pCommand = NULL;
+    tANI_U32 sessionId;
+    tCsrRoamSession *pSession;
+
+    if(NULL == pEntry)
+    {
+        smsLog(pMac, LOGW, "   CFG_CNF with active list empty\n");
+        return;
+    }
+    pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+    sessionId = pCommand->sessionId;
+    pSession = CSR_GET_SESSION( pMac, sessionId );
+    if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming)
+    {
+        //the roaming is cancelled. Simply complete the command
+        smsLog(pMac, LOGW, FL("  Roam command cancelled\n"));
+        csrRoamComplete(pMac, eCsrNothingToJoin, NULL); 
+    }
+    else
+    {
+        if ( CCM_IS_RESULT_SUCCESS(result) )
+        {
+            smsLog(pMac, LOG2, "Cfg sequence complete\n");
+            // Successfully set the configuration parameters for the new Bss.  Attempt to
+            // join the roaming Bss.
+            if(pCommand->u.roamCmd.pRoamBssEntry)
+            {
+                pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+                pBssDesc = &pScanResult->Result.BssDescriptor;
+            }
+            if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ||
+                 CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) 
+#ifdef WLAN_SOFTAP_FEATURE
+                  || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) 
+#endif
+            )
+            {
+                if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId,
+                                        &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, 
+                                        pBssDesc, pCommand->u.roamCmd.roamId )))
+                {
+                    smsLog(pMac, LOGW, " CSR start BSS failed\n");
+                    //We need to complete the command
+                    csrRoamComplete(pMac, eCsrStartBssFailure, NULL);
+                }
+            }
+            else
+            {
+                if (!pCommand->u.roamCmd.pRoamBssEntry)
+                {
+                    smsLog(pMac, LOGW, " pRoamBssEntry is NULL\n");
+                    //We need to complete the command
+                    csrRoamComplete(pMac, eCsrJoinFailure, NULL);
+                    return;
+                } 
+                // If we are roaming TO an Infrastructure BSS...
+                VOS_ASSERT(pScanResult != NULL); 
+                if ( csrIsInfraBssDesc( pBssDesc ) )
+                {
+                    tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes;
+
+                    if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) )
+                    {
+                    // ..and currently in an Infrastructure connection....
+                    if( csrIsConnStateConnectedInfra( pMac, sessionId ) )
+                    {
+                        // ...and the SSIDs are equal, then we Reassoc.
+                        if (  csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, 
+                                                    pIesLocal ) )
+                        // ..and currently in an infrastructure connection
+                        {
+                            // then issue a Reassoc.
+                            pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE;
+                                csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal,
+                                                        &pCommand->u.roamCmd.roamProfile );
+                        }
+                        else
+                        {
+                                                     
+                            // otherwise, we have to issue a new Join request to LIM because we disassociated from the
+                            // previously associated AP.
+                            if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, 
+                                                                                                            pIesLocal, 
+                                                    &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId )))
+                            {
+                                //try something else
+                                csrRoam( pMac, pCommand );
+                            }
+                        }
+                    }
+                    else
+                    {
+                        eHalStatus  status = eHAL_STATUS_SUCCESS;
+                         
+                        /* We need to come with other way to figure out that this is because of HO in BMP
+                           The below API will be only available for Android as it uses a different HO algorithm */
+                        /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should 
+                         * use join request */
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                        if (csrRoamIsHandoffInProgress(pMac) && 
+                                                csrRoamIs11rAssoc(pMac))
+                        {
+                            status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, 
+                                    (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile);
+                        }
+                        else
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+                        if (csrRoamIsHandoffInProgress(pMac) && 
+                                                csrRoamIsCCXAssoc(pMac))
+                        {
+                            // Now serialize the reassoc command.
+                            status = csrRoamIssueReassociateCmd(pMac, sessionId);
+                        }
+                        else
+#endif
+                        // else we are not connected and attempting to Join.  Issue the
+                        // Join request.
+                        {
+                            status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, 
+                                                (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ),
+                                                &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId );
+                        }
+                        if(!HAL_STATUS_SUCCESS(status))
+                        {
+                            //try something else
+                            csrRoam( pMac, pCommand );
+                        }
+                    }
+                        if( !pScanResult->Result.pvIes )
+                        {
+                            //Locally allocated
+                            palFreeMemory(pMac->hHdd, pIesLocal);
+                        }
+                    }
+                }//if ( csrIsInfraBssDesc( pBssDesc ) )
+                else
+                {
+                    smsLog(pMac, LOGW, FL("  found BSSType mismatching the one in BSS description\n"));
+                }
+            }//else
+        }//if ( WNI_CFG_SUCCESS == result )
+        else
+        {
+            // In the event the configuration failed,  for infra let the roam processor 
+            //attempt to join something else...
+            if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) )
+            {
+            csrRoam(pMac, pCommand);
+            }
+            else
+            {
+                //We need to complete the command
+                if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) )
+                {
+                    csrRoamComplete(pMac, eCsrStartBssFailure, NULL);
+                }
+                else
+                {
+                    csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+                }
+            }
+        }
+    }//we have active entry
+}
+
+
+static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp )
+{
+    //No one is sending eWNI_SME_AUTH_REQ to PE.
+    smsLog(pMac, LOGW, FL("is no-op\n"));
+    if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) 
+    {
+        smsLog( pMac, LOGW, "CSR SmeAuthReq Successful\n" );
+        // Successfully authenticated with a new Bss.  Attempt to stop the current Bss and
+        // join the new one...
+        /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile );
+
+        roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/
+    }
+    else {
+        smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08lX [%d]\n", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode );
+        /***profHandleLostLinkAfterReset(pAdapter);
+        // In the event the authenticate fails, let the roam processor attempt to join something else...
+        roamRoam( pAdapter );***/
+    }
+}
+
+
+static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp )
+{
+    eCsrRoamCompleteResult result;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tCsrRoamInfo roamInfo;
+    tANI_U32 roamId = 0;
+    
+    if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) 
+    {
+        smsLog( pMac, LOGW, "CSR SmeReassocReq Successful\n" );
+        result = eCsrReassocSuccess;
+
+        /* Defeaturize this part later if needed */
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+        /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, 
+         * we need the response contents while processing the result in csrRoamProcessResults() */
+        if (csrRoamIsHandoffInProgress(pMac))
+        {
+            /* Need to dig more on indicating events to SME QoS module */
+            sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL);
+            csrRoamComplete( pMac, result, pSmeJoinRsp);
+        }
+        else
+#endif
+        {
+            csrRoamComplete( pMac, result, NULL );
+        }
+    }
+    /* Should we handle this similar to handling the join failure? Is it ok
+     * to call csrRoamComplete() with state as CsrJoinFailure */
+    else
+    {
+        smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode );
+        result = eCsrReassocFailure;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) ||
+                        (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode))
+        {
+                // Inform HDD to turn off FT flag in HDD 
+                if (pNeighborRoamInfo)
+                {
+                        vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
+                        csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
+                                        &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS);
+                }
+        }
+#endif
+        // In the event that the Reassociation fails, then we need to Disassociate the current association and keep
+        // roaming.  Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a
+        // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc.
+        //The disassoc rsp message will remove the command from active list
+        if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId,
+                        eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE )))
+        {
+            csrRoamComplete( pMac, eCsrJoinFailure, NULL );
+        }
+    }
+}
+
+
+static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp)
+{
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    {
+        vos_log_ibss_pkt_type *pIbssLog;
+
+        WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+        if(pIbssLog)
+        {
+            pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP;
+            if(eSIR_SME_SUCCESS != pSmeRsp->statusCode)
+            {
+                pIbssLog->status = WLAN_IBSS_STATUS_FAILURE;
+            }
+            WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+        }
+    }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+    pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+    if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId))
+    {
+        csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+    }
+    else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId))
+    {
+        csrRoamReissueRoamCommand(pMac);
+    }
+}
+
+
+void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp )
+{
+    tSirResultCodes statusCode;
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+    tScanResultHandle hBSSList;
+    tANI_BOOLEAN fCallCallback, fRemoveCmd;
+    eHalStatus status;
+    tCsrRoamInfo roamInfo;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tANI_U32 roamId = 0;
+    tCsrRoamProfile *pCurRoamProfile = NULL;
+    tListElem *pEntry = NULL;
+    tSmeCmd *pCommand = NULL;
+#endif
+    tANI_U32 sessionId;
+    tCsrRoamSession *pSession;
+    tSirSmeDisassocRsp SmeDisassocRsp;
+
+    csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp);
+    sessionId = SmeDisassocRsp.sessionId;
+    statusCode = SmeDisassocRsp.statusCode;
+
+    smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d\n", sessionId);
+
+    if ( csrIsConnStateInfra( pMac, sessionId ) )
+    {
+        pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+    }
+
+    pSession = CSR_GET_SESSION( pMac, sessionId );
+    if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) )
+    {
+        csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+    }
+    else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) ||
+              CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) )
+    {
+        if ( eSIR_SME_SUCCESS == statusCode )
+        {
+            smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully\n" );
+            //A callback to HDD will be issued from csrRoamComplete so no need to do anything here
+        } 
+        csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+    }
+
+    else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) )
+    {
+       smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO\n" );
+#if   defined (WLAN_FEATURE_NEIGHBOR_ROAMING)
+        pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+        if ( pEntry )
+        {
+            pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
+            // If the head of the queue is Active and it is a ROAM command, remove
+            // and put this on the Free queue.
+            if ( eSmeCommandRoam == pCommand->command )
+            {
+                //we need to process the result first before removing it from active list because state changes 
+                //still happening insides roamQProcessRoamResults so no other roam command should be issued
+                fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK );
+                if(pCommand->u.roamCmd.fReleaseProfile)
+                {
+                    csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile);
+                    pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
+                }
+
+                if( fRemoveCmd )
+                {
+                    csrReleaseCommandRoam( pMac, pCommand );
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, "  ********csrRoamRoamingStateDisassocRspProcessor fail to remove cmd reason %d\n",
+                        pCommand->u.roamCmd.roamReason );
+                }
+            }
+            else
+            {
+                smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ...\n" );
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" );
+        }
+
+        //notify HDD for handoff, providing the BSSID too
+        roamInfo.reasonCode = eCsrRoamReasonBetterAP;
+
+        palCopyMemory(pMac->hHdd, roamInfo.bssid, pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr));
+
+        csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
+
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = csrRoamPrepareFilterFromProfile(pMac, &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                smsLog(pMac, LOGE, FL(" csrRoamPrepareFilterFromProfile fail to create scan filter\n"));
+            }
+        
+            status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                //copy over the connected profile to apply the same for this connection as well
+                if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile))))
+                {
+                    palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile));
+                    csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile);
+                }
+                //make sure to put it at the head of the cmd queue
+                status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, 
+                                             hBSSList, eCsrSmeIssuedAssocToSimilarAP, 
+                                             roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    //msg
+                    fCallCallback = eANI_BOOLEAN_TRUE;
+                }
+                /* Notify sub-modules like QoS etc. that handoff happening         */
+                sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL);
+                palFreeMemory(pMac->hHdd, pCurRoamProfile);
+            }
+            else
+            {
+                //msg
+                smsLog( pMac, LOGE,"csrRoamRoamingStateDisassocRspProcessor: csrScanGetResult failed");
+                // should have asserted, sending up roam complete instead. Let upper layer
+                // decide what to do next
+                csrCallRoamingCompletionCallback(pMac, pSession, &roamInfo, 0, eCSR_ROAM_RESULT_FAILURE);
+            }
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL(" fail to allocate memory for scan filter\n"));
+            csrCallRoamingCompletionCallback(pMac, pSession, &roamInfo, 0, eCSR_ROAM_RESULT_FAILURE);
+        }
+        if( pScanFilter )
+        {
+            csrFreeScanFilter(pMac, pScanFilter);
+            palFreeMemory( pMac->hHdd, pScanFilter );
+        }
+
+
+#endif
+    } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) )
+    else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) )
+    {
+        // Disassoc due to Reassoc failure falls into this codepath....
+        csrRoamComplete( pMac, eCsrJoinFailure, NULL );
+    }
+    else
+    {
+        if ( eSIR_SME_SUCCESS == statusCode )
+        {
+            // Successfully disassociated from the 'old' Bss...
+            //
+            // We get Disassociate response in three conditions.
+            // - First is the case where we are disasociating from an Infra Bss to start an IBSS.
+            // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new
+            // Infrastructure network.
+            // - Third is where we are doing an Infra to Infra roam between networks with different
+            // SSIDs.  In all cases, we set the new Bss configuration here and attempt to join
+            
+            smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully\n" );
+        }
+        else
+        {
+            smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX\n", statusCode );
+        }
+        //We are not done yet. Get the data and continue roaming
+        csrRoamReissueRoamCommand(pMac);
+    }
+
+}
+
+
+static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp )
+{
+    tSirResultCodes statusCode;
+
+    //No one is sending eWNI_SME_DEAUTH_REQ to PE.
+    smsLog(pMac, LOGW, FL("is no-op\n"));
+    statusCode = csrGetDeAuthRspStatusCode( pSmeRsp );
+    if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) )
+    {
+        csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
+    }
+    else
+    {
+        if ( eSIR_SME_SUCCESS == statusCode ) 
+        {
+            // Successfully deauth from the 'old' Bss...
+            //
+            smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully\n" );
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX\n", statusCode );
+        }
+        //We are not done yet. Get the data and continue roaming
+        csrRoamReissueRoamCommand(pMac);
+    }
+}
+
+
+static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp )
+{
+    eCsrRoamCompleteResult result;
+    
+    if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) 
+    {
+        smsLog( pMac, LOGW, "SmeStartBssReq Successful\n" );
+        result = eCsrStartBssSuccess;
+    }
+    else 
+    {
+        smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX\n", pSmeStartBssRsp->statusCode );
+        //Let csrRoamComplete decide what to do
+        result = eCsrStartBssFailure;
+    }
+#ifdef WLAN_SOFTAP_FEATURE
+    csrRoamComplete( pMac, result, pSmeStartBssRsp);
+#else
+    csrRoamComplete( pMac, result, &pSmeStartBssRsp->bssDescription );
+#endif
+}
+
+
+/*
+  We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres.
+  It depends on how the message is constructed. If the message is sent by limSendSmeRsp,
+  the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp.
+  For the messages where sender allocates memory for specific structures, then it can be 
+  cast accordingly.
+*/
+void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf )
+{
+    tSirSmeRsp *pSmeRsp;
+    tSmeIbssPeerInd *pIbssPeerInd;
+    tCsrRoamInfo roamInfo;
+        // TODO Session Id need to be acquired in this function
+        tANI_U32 sessionId = 0;
+
+    pSmeRsp = (tSirSmeRsp *)pMsgBuf;
+
+    smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d\n",
+                pSmeRsp->messageType, pSmeRsp->messageType,
+                pMac->roam.curSubState[pSmeRsp->sessionId] );
+#if defined ANI_PRODUCT_TYPE_AP
+    pSmeRsp->messageType = pal_be16_to_cpu(pSmeRsp->messageType);
+    pSmeRsp->length = pal_be16_to_cpu(pSmeRsp->length);
+    pSmeRsp->statusCode = pal_be32_to_cpu(pSmeRsp->statusCode);
+#else
+    pSmeRsp->messageType = (pSmeRsp->messageType);
+    pSmeRsp->length = (pSmeRsp->length);
+    pSmeRsp->statusCode = (pSmeRsp->statusCode);
+#endif
+    switch (pSmeRsp->messageType) 
+    {
+        
+        case eWNI_SME_JOIN_RSP:      // in Roaming state, process the Join response message...
+            if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId))
+            {
+                //We sent a JOIN_REQ
+                csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp );
+            }
+            break;
+                
+        case eWNI_SME_AUTH_RSP:       // or the Authenticate response message...
+            if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) 
+            {
+                //We sent a AUTH_REQ
+                csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp );
+            }
+            break;
+                
+        case eWNI_SME_REASSOC_RSP:     // or the Reassociation response message...
+            if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) 
+            {
+                csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp );
+            }
+            break;
+                   
+        case eWNI_SME_STOP_BSS_RSP:    // or the Stop Bss response message...
+            {
+                csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp);
+            }
+            break;
+                
+        case eWNI_SME_DISASSOC_RSP:    // or the Disassociate response message...
+            if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId )      ||
+                 CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId )  ||
+                 CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId )      ||
+                 CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId )   ||
+                 CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) ||
+//HO
+                 CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId )         )
+            {
+                smsLog(pMac, LOGE, FL("eWNI_SME_DISASSOC_RSP subState = %d\n"), pMac->roam.curSubState[pSmeRsp->sessionId]);
+                csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp );
+            }
+            break;
+                   
+        case eWNI_SME_DEAUTH_RSP:    // or the Deauthentication response message...
+            if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) 
+            {
+                csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp );
+            }
+            break;
+                   
+        case eWNI_SME_START_BSS_RSP:      // or the Start BSS response message...
+            if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) 
+            {
+                csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp );
+            } 
+            break;
+                   
+        case WNI_CFG_SET_CNF:    // process the Config Confirm messages when we are in 'Config' substate...
+            if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) 
+            {
+                csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus );
+            }
+
+            break;
+
+        //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them
+        case eWNI_SME_IBSS_PEER_DEPARTED_IND:
+            pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp;
+            smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state\n");
+            palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) );
+                        roamInfo.staId = (tANI_U8)pIbssPeerInd->staId;
+            roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig;
+            roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig;
+            palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid));
+            csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, 
+                                eCSR_ROAM_CONNECT_STATUS_UPDATE, 
+                                eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED);
+            break;
+
+        default:
+            smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d\n",
+                      pSmeRsp->messageType, pSmeRsp->messageType,
+                      pMac->roam.curSubState[pSmeRsp->sessionId] );
+
+            //If we are connected, check the link status change 
+                        if(!csrIsConnStateDisconnected(pMac, sessionId))
+                        {
+                                csrRoamCheckForLinkStatusChange( pMac, pSmeRsp );
+                        }
+            break;          
+    }
+}
+
+
+void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf )
+{
+    tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf;
+
+    switch (pSirMsg->messageType) 
+    {
+       case eWNI_SME_GET_STATISTICS_RSP:
+          smsLog( pMac, LOGW, FL("Stats rsp from PE\n"));
+          csrRoamStatsRspProcessor( pMac, pSirMsg );
+          break;
+#ifdef WLAN_SOFTAP_FEATURE
+        case eWNI_SME_UPPER_LAYER_ASSOC_CNF:
+        {
+            tCsrRoamSession  *pSession;
+            tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf;
+            tCsrRoamInfo roamInfo;
+            tCsrRoamInfo *pRoamInfo = NULL;
+            tANI_U32 sessionId;
+            eHalStatus status;
+
+            smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer \n"));
+
+            palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+            pRoamInfo = &roamInfo;
+
+            pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf;
+            status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId );
+            pSession = CSR_GET_SESSION(pMac, sessionId);
+
+            pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success 
+            pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
+            pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid;
+            pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length;
+            pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata;
+
+            pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length;
+            pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata;           
+
+            palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr));
+            palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid));
+
+            pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta;
+
+            if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) )
+            {
+                pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED;
+                pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq;
+                status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF);
+            }
+            if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
+            {
+                vos_sleep( 100 );
+                pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta
+                status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
+            }
+
+
+        }
+        break;
+#endif
+
+       default:
+          csrRoamCheckForLinkStatusChange( pMac, pSirMsg );
+          break;
+    }
+
+}
+
+
+eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, 
+                                     tSirBssDescription *pBssDescription,
+                                tSirMacAddr *bssId, tANI_BOOLEAN addKey,
+                                 tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, 
+                                 tANI_U8 keyId, tANI_U16 keyLength, 
+                                 tANI_U8 *pKey, tANI_U8 paeRole )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tAniEdType edType;
+    
+    if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType)
+    {
+        EncryptType = eCSR_ENCRYPT_TYPE_NONE; //***
+    }
+    
+    edType = csrTranslateEncryptTypeToEdType( EncryptType );
+    
+    // Allow 0 keys to be set for the non-WPA encrypt types...  For WPA encrypt types, the num keys must be non-zero
+    // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted).
+    if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) ||
+           addKey )     
+    {
+        tCsrRoamSetKey setKey;
+
+        setKey.encType = EncryptType;
+        setKey.keyDirection = aniKeyDirection;    //Tx, Rx or Tx-and-Rx
+        palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) );   
+        setKey.paeRole = paeRole;      //0 for supplicant
+        setKey.keyId = keyId;  // Kye index
+        setKey.keyLength = keyLength;  
+        if( keyLength )
+        {
+            palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength );
+        }
+        status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 );
+    }
+
+    return (status);
+}
+
+
+static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                             tCsrRoamSetKey *pSetKey, tANI_U32 roamId )
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tSmeCmd *pCommand = NULL;
+#ifdef FEATURE_WLAN_CCX
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+#endif /* FEATURE_WLAN_CCX */
+ 
+    do
+    {
+        pCommand = csrGetCommandBuffer(pMac);
+        if(NULL == pCommand)
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        pCommand->command = eSmeCommandSetKey;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        // validate the key length,  Adjust if too long...
+        // for static WEP the keys are not set thru' SetContextReq
+        if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || 
+             ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) 
+        {
+            //KeyLength maybe 0 for static WEP
+            if( pSetKey->keyLength )
+            {
+                if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) 
+                {
+                    smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                    break;        
+                }
+                
+                pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN;
+                palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN );
+            }
+        }
+        else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || 
+             ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) 
+        {
+            //KeyLength maybe 0 for static WEP
+            if( pSetKey->keyLength )
+            {
+                if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) 
+                {
+                    smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                    break;        
+                }
+                
+                pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN;
+                palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN );
+            }
+        }
+        else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) 
+        {
+            if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN )
+            {
+                smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                break;
+            }
+            pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN;
+            palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN );
+        }
+        else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) 
+        {
+            if ( pSetKey->keyLength < CSR_AES_KEY_LEN )
+            {
+                smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                break;
+            }
+            pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN;
+            palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN );
+        }
+#ifdef FEATURE_WLAN_WAPI
+        else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) 
+        {
+            if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN )
+            {
+                smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                break;
+            }
+            pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN;
+            palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN );
+        }
+#endif /* FEATURE_WLAN_WAPI */
+#ifdef FEATURE_WLAN_CCX
+        else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) 
+        {
+            if ( pSetKey->keyLength < CSR_KRK_KEY_LEN )
+            {
+                smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                break;
+            }
+            palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN );
+            pSession->ccxCckmInfo.reassoc_req_num=1;
+            pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE;
+            status = eHAL_STATUS_SUCCESS;
+            break;
+        }
+#endif /* FEATURE_WLAN_CCX */
+#ifdef WLAN_FEATURE_11W
+        //Check for 11w BIP
+        else if ( eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType )
+        {
+            tANI_U16 count = 0;
+            if ( pSetKey->keyLength < CSR_AES_KEY_LEN )
+            {
+                smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength );
+                break;
+            }
+            pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN;
+            palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN );
+        }
+#endif
+        status = eHAL_STATUS_SUCCESS;
+        pCommand->u.setKeyCmd.roamId = roamId;
+        pCommand->u.setKeyCmd.encType = pSetKey->encType;
+        pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection;    //Tx, Rx or Tx-and-Rx
+        palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) );   
+        pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole;      //0 for supplicant
+        pCommand->u.setKeyCmd.keyId = pSetKey->keyId;
+        palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN );
+        //Always put set key to the head of the Q because it is the only thing to get executed in case of WT_KEY state
+         
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+        }
+    } while (0);
+
+    // Free the command if there has been a failure, or it is a 
+    // "local" operation like the set CCX CCKM KRK key.
+    if( (!HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand )) 
+#ifdef FEATURE_WLAN_CCX
+            || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) 
+#endif /* FEATURE_WLAN_CCX */
+            )
+    {
+        csrReleaseCommandSetKey( pMac, pCommand );
+    }
+
+    return( status );
+}
+
+
+eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                         tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId )
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tSmeCmd *pCommand = NULL;
+    tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE;
+
+    do
+    {
+        if( !csrIsSetKeyAllowed(pMac, sessionId) ) 
+        {
+            smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") );
+            status = eHAL_STATUS_CSR_WRONG_STATE;
+            break;
+        }
+        pCommand = csrGetCommandBuffer(pMac);
+        if(NULL == pCommand)
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        pCommand->command = eSmeCommandRemoveKey;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.removeKeyCmd.roamId = roamId;
+        pCommand->u.removeKeyCmd.encType = pRemoveKey->encType;
+        palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) );
+        pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId;
+        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) )
+        {
+            //in this case, put it to the end of the Q incase there is a set key pending.
+            fImediate = eANI_BOOLEAN_FALSE;
+        }
+
+        smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x\n"),       
+            pRemoveKey->encType, pRemoveKey->keyId,
+            pCommand->u.removeKeyCmd.peerMac[0],
+            pCommand->u.removeKeyCmd.peerMac[1],
+            pCommand->u.removeKeyCmd.peerMac[2], 
+            pCommand->u.removeKeyCmd.peerMac[3], 
+            pCommand->u.removeKeyCmd.peerMac[4],
+            pCommand->u.removeKeyCmd.peerMac[5]);
+
+        status = csrQueueSmeCommand(pMac, pCommand, fImediate);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            break;
+        }
+    } while (0);
+
+    if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) )
+    {
+        csrReleaseCommandRemoveKey( pMac, pCommand );
+    }
+
+    return (status );
+}
+
+
+eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status;
+    tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0;
+    tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType );
+    tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE;
+    tANI_U32 sessionId = pCommand->sessionId;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type);
+
+    if(eCSR_ENCRYPT_TYPE_NONE != edType)
+    {
+        palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type));
+        if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 )
+        {
+            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ;
+            setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType);
+            setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+        }
+        else
+        {
+            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ;
+            setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType);
+            setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+        }
+        palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 );
+        if(CSR_IS_ENC_TYPE_STATIC(edType))
+        {
+            tANI_U32 defKeyId;
+
+            //It has to be static WEP here
+            if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId)))
+            {
+                setKeyEvent.keyId = (v_U8_t)defKeyId;
+            }
+        }
+        else
+        {
+            setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId;
+        }
+        setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+        WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
+    }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+    if( csrIsSetKeyAllowed(pMac, sessionId) )
+    {
+        status = csrSendMBSetContextReqMsg( pMac, sessionId, 
+                    ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, 
+                                            numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, 
+                                            pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, 
+                    pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, 
+                    pCommand->u.setKeyCmd.keyRsc);
+    }
+    else
+    {
+        smsLog( pMac, LOGW, FL(" cannot process not connected\n") );
+        //Set this status so the error handling take care of the case.
+        status = eHAL_STATUS_CSR_WRONG_STATE;
+    }
+    if( !HAL_STATUS_SUCCESS(status) )
+    {
+        smsLog( pMac, LOGE, FL("  error status %d\n"), status );
+        csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.setKeyCmd.roamId, eCSR_ROAM_SET_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+        if(eCSR_ENCRYPT_TYPE_NONE != edType)
+        {
+            if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 )
+            {
+                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP;
+            }
+            else
+            {
+                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP;
+            }
+            setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;
+            WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
+        }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+    }
+
+    return ( status );
+}
+
+
+eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status;
+    tpSirSmeRemoveKeyReq pMsg = NULL;
+    tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq);
+    tANI_U8 *p;
+    tANI_U32 sessionId = pCommand->sessionId;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type);
+
+    palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type));
+    removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ;
+    removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+    removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+    palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 );
+    removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId;
+    removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+    WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+    if( csrIsSetKeyAllowed(pMac, sessionId) )
+    {
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen );
+    }
+    else
+    {
+        smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") );
+        //Set the error status so error handling kicks in below
+        status = eHAL_STATUS_CSR_WRONG_STATE;
+    }
+    if( HAL_STATUS_SUCCESS( status ) )
+    {
+        palZeroMemory(pMac->hHdd, pMsg, wMsgLen);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ);
+                pMsg->length = pal_cpu_to_be16(wMsgLen);
+
+        pMsg->sessionId = (tANI_U8)sessionId;
+        pMsg->transactionId = 0;
+        p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) +
+            sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId);
+        // bssId - copy from session Info
+        palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) );
+        p += sizeof(tSirMacAddr);
+        // peerMacAddr
+        palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) );
+        p += sizeof(tSirMacAddr);
+        // edType
+        *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType );
+        p++;
+        // weptype
+        if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || 
+            ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) )
+        {
+            *p = (tANI_U8)eSIR_WEP_STATIC;
+        }
+        else
+        {
+            *p = (tANI_U8)eSIR_WEP_DYNAMIC;
+        }
+        p++;
+        //keyid
+        *p = pCommand->u.removeKeyCmd.keyId;
+        p++;
+        *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1;
+
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }
+
+    if( !HAL_STATUS_SUCCESS( status ) )
+    {
+        smsLog( pMac, LOGE, FL(" error status \n"), status );
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+        removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP;
+        removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;;
+        WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+        csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE);
+    }
+
+    return ( status );
+}
+
+
+
+eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId )
+{
+    eHalStatus status;
+ 
+    if( !csrIsSetKeyAllowed(pMac, sessionId) )
+    {
+        status = eHAL_STATUS_CSR_WRONG_STATE;
+    }
+    else
+    {
+        status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId );
+    }
+
+    return ( status );
+}
+
+
+/*
+   Prepare a filter base on a profile for parsing the scan results.
+   Upon successful return, caller MUST call csrFreeScanFilter on 
+   pScanFilter when it is done with the filter.
+*/
+eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
+                                           tCsrScanResultFilter *pScanFilter)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 size = 0;
+    tANI_U8  index = 0;
+    
+    do
+    {
+        if(pProfile->BSSIDs.numOfBSSIDs)
+        {
+            size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs;
+            palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size);
+        }
+        if(pProfile->SSIDs.numOfSSIDs)
+        {
+            if( !CSR_IS_WDS_STA( pProfile ) )
+            {
+                pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs;
+            }
+            else
+            {
+                //For WDS station
+                //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join
+                pScanFilter->SSIDs.numOfSSIDs = 1;
+            }
+            size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size);
+        }
+        if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) )
+        {
+            pScanFilter->ChannelInfo.numOfChannels = 0;
+            pScanFilter->ChannelInfo.ChannelList = NULL;
+        }
+        else if(pProfile->ChannelInfo.numOfChannels)
+        {
+           status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels);
+           pScanFilter->ChannelInfo.numOfChannels = 0;
+            if(HAL_STATUS_SUCCESS(status))
+            {
+              for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++)
+              {
+                 if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index]))
+                 {
+                    pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] 
+                       = pProfile->ChannelInfo.ChannelList[index];
+                    pScanFilter->ChannelInfo.numOfChannels++;
+                 }
+                 else 
+                 {
+                         smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid\n"), pProfile->ChannelInfo.ChannelList[index]);
+                 }
+
+            }
+            }
+            else
+            {
+                break;
+            }
+
+        }
+        else 
+        {
+            smsLog(pMac, LOGW, FL("Channel list empty\n"));
+            status = eHAL_STATUS_FAILURE;
+            break;
+        }
+        pScanFilter->uapsd_mask = pProfile->uapsd_mask;
+        pScanFilter->authType = pProfile->AuthType;
+        pScanFilter->EncryptionType = pProfile->EncryptionType;
+        pScanFilter->mcEncryptionType = pProfile->mcEncryptionType;
+        pScanFilter->BSSType = pProfile->BSSType;
+        pScanFilter->phyMode = pProfile->phyMode;
+#ifdef FEATURE_WLAN_WAPI
+        //check if user asked for WAPI with 11n or auto mode, in that case modify
+        //the phymode to 11g
+        if(csrIsProfileWapi(pProfile))
+        {
+             if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n)
+             {
+                pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n;
+             }
+             if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO)
+             {
+                pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO;
+             }
+             if(!pScanFilter->phyMode)
+             {
+                 pScanFilter->phyMode = eCSR_DOT11_MODE_11g;
+             }
+        }
+#endif /* FEATURE_WLAN_WAPI */
+
+        /*Save the WPS info*/
+        pScanFilter->bWPSAssociation = pProfile->bWPSAssociation;
+
+        if( pProfile->countryCode[0] )
+        {
+            //This causes the matching function to use countryCode as one of the criteria.
+            palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, 
+                        WNI_CFG_COUNTRY_CODE_LEN );
+        }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (pProfile->MDID.mdiePresent)
+        {
+            pScanFilter->MDID.mdiePresent = 1;
+            pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain;
+        }
+#endif
+    
+    }while(0);
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+    }
+    
+    return(status);
+}
+
+
+tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                         eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp )
+{
+    tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE;
+    tSmeCmd *pCommand;
+
+    do
+    {
+        // Validate the type is ok...
+        if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break;
+        pCommand = csrGetCommandBuffer( pMac );
+        if ( !pCommand )
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
+            break;
+        }
+        //Change the substate in case it is waiting for key
+        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) )
+        {
+            csrRoamStopWaitForKeyTimer( pMac );
+            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId);
+        }
+        pCommand->command = eSmeCommandWmStatusChange;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.wmStatusChangeCmd.Type = Type;
+        if ( eCsrDisassociated ==  Type )
+        {
+            palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, 
+                                sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) );
+        }
+        else
+        {
+            palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, 
+                            sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) );
+        }
+        if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) )
+        {
+            fCommandQueued = eANI_BOOLEAN_TRUE;
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message \n") );
+            csrReleaseCommandWmStatusChange( pMac, pCommand );
+        }
+
+
+        /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */
+        csrSetDefaultDot11Mode( pMac );
+
+    } while( 0 );
+
+    return( fCommandQueued );
+}
+
+
+static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg)
+{
+    v_S7_t  rssi = 0;
+    tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg;
+    if(pGetRssiReq)
+    {
+        if(NULL != pGetRssiReq->pVosContext)
+        {
+            WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi);
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL\n"));                
+            return;
+        }
+            
+        if(NULL != pGetRssiReq->rssiCallback)
+        {
+            ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext);
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL\n"));                
+            return;
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGE, FL("pGetRssiReq is NULL\n"));    
+    }
+    return;
+}
+
+void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg )
+{
+    tSirSmeAssocInd *pAssocInd;
+    tSirSmeDisassocInd *pDisassocInd;
+    tSirSmeDeauthInd *pDeauthInd;
+    tSirSmeWmStatusChangeNtf *pStatusChangeMsg;
+    tSirSmeNewBssInfo *pNewBss;
+    tSmeIbssPeerInd *pIbssPeerInd;
+    tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+    tSirSmeApNewCaps *pApNewCaps;
+    eCsrRoamResult result = eCSR_ROAM_RESULT_NONE;
+    eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED;
+    tCsrRoamInfo *pRoamInfo = NULL;
+    tCsrRoamInfo roamInfo;
+    eHalStatus status;
+    tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
+    tCsrRoamSession *pSession = NULL;
+    tpSirSmeSwitchChannelInd pSwitchChnInd;
+    tSmeMaxAssocInd *pSmeMaxAssocInd;
+
+#if defined ANI_PRODUCT_TYPE_AP
+    pSirMsg->messageType = pal_be16_to_cpu(pSirMsg->messageType);
+    pSirMsg->length = pal_be16_to_cpu(pSirMsg->length);
+    pSirMsg->statusCode = pal_be32_to_cpu(pSirMsg->statusCode);
+#else
+    pSirMsg->messageType = (pSirMsg->messageType);
+    pSirMsg->length = (pSirMsg->length);
+    pSirMsg->statusCode = (pSirMsg->statusCode);
+#endif
+
+    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo));
+
+    switch( pSirMsg->messageType ) 
+    {
+        case eWNI_SME_ASSOC_IND:
+            {
+                tCsrRoamSession  *pSession;
+                smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME\n"));
+                pAssocInd = (tSirSmeAssocInd *)pSirMsg;
+                status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId );
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pSession = CSR_GET_SESSION(pMac, sessionId);
+
+                pRoamInfo = &roamInfo;
+
+                // Required for indicating the frames to upper layer
+                pRoamInfo->assocReqLength = pAssocInd->assocReqLength;
+                pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr;
+
+                pRoamInfo->beaconPtr = pAssocInd->beaconPtr;
+                pRoamInfo->beaconLength = pAssocInd->beaconLength;                
+                pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success 
+                pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
+                    pRoamInfo->staId = (tANI_U8)pAssocInd->staId;
+                    pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length;
+                    pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata;
+                
+                pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length;
+                pRoamInfo->paddIE =  pAssocInd->addIE.addIEdata;
+
+                    palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
+                    palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid));
+#ifdef WLAN_SOFTAP_FEATURE
+                    pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta;
+                    if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
+#endif 
+                        status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
+#ifdef WLAN_SOFTAP_FEATURE
+                    if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile))
+                    {
+                        if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType ))
+                        {
+                            csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, 
+                                    pSession->pConnectBssDesc,
+                                    &(pRoamInfo->peerMac),
+                                    FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter.
+                            pRoamInfo->fAuthRequired = FALSE;
+                        }
+                        else
+                        {
+                            pRoamInfo->fAuthRequired = TRUE;
+                        }
+                        status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND);
+                        if (!HAL_STATUS_SUCCESS(status))
+                            pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering 
+                    }
+#endif 
+                    /* Send Association completion message to PE */
+                    status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta
+                    
+                    /* send a message to CSR itself just to avoid the EAPOL frames going
+                     * OTA before association response */
+
+                    if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
+                {
+                    status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId);
+                }
+#ifdef WLAN_SOFTAP_FEATURE
+                else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED))
+                {
+                    pRoamInfo->fReassocReq = pAssocInd->reassocReq;
+                    //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF);
+                    status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId);
+                }
+#endif
+                }
+            }
+            break;
+
+        case eWNI_SME_DISASSOC_IND:
+            smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC\n"));
+
+            // Check if AP dis-associated us because of MIC failure. If so,
+            // then we need to take action immediately and not wait till the
+            // the WmStatusChange requests is pushed and processed
+            pDisassocInd = (tSirSmeDisassocInd *)pSirMsg;
+            status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId );
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                // If we are in neighbor preauth done state then on receiving
+                // disassoc or deauth we dont roam instead we just disassoc
+                // from current ap and then go to disconnected state 
+                // This happens for CCX and 11r FT connections ONLY.
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
+                {
+                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
+                }
+#endif
+#ifdef FEATURE_WLAN_CCX
+                if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
+                {
+                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
+                }
+#endif
+                pSession = CSR_GET_SESSION( pMac, sessionId );
+
+                if ( csrIsConnStateInfra( pMac, sessionId ) )
+                {
+                    pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+                }
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
+#endif
+                csrRoamLinkDown(pMac, sessionId);
+                csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg );
+#ifdef WLAN_SOFTAP_FEATURE
+                if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
+                {
+
+                    pRoamInfo = &roamInfo;
+
+                    pRoamInfo->statusCode = pDisassocInd->statusCode; 
+                    pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
+                    pRoamInfo->staId = (tANI_U8)pDisassocInd->staId;
+
+                    palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr));
+                    palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid));
+
+                    status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND);
+                }
+#endif                
+            }
+            break;
+
+        case eWNI_SME_DEAUTH_IND:
+            smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC\n"));
+            pDeauthInd = (tpSirSmeDeauthInd)pSirMsg;
+            status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId );
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                // If we are in neighbor preauth done state then on receiving
+                // disassoc or deauth we dont roam instead we just disassoc
+                // from current ap and then go to disconnected state 
+                // This happens for CCX and 11r FT connections ONLY.
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
+                {
+                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
+                }
+#endif
+#ifdef FEATURE_WLAN_CCX
+                if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
+                {
+                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
+                }
+#endif
+                pSession = CSR_GET_SESSION( pMac, sessionId );
+
+                if ( csrIsConnStateInfra( pMac, sessionId ) )
+                {
+                    pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+                }
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
+#endif
+                csrRoamLinkDown(pMac, sessionId);
+                csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg );
+#ifdef WLAN_SOFTAP_FEATURE
+                if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
+                {
+
+                    pRoamInfo = &roamInfo;
+
+                    pRoamInfo->statusCode = pDeauthInd->statusCode;
+                    pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
+                    pRoamInfo->staId = (tANI_U8)pDeauthInd->staId;
+
+                    palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr));
+                    palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid));
+
+                    status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND);
+                }
+#endif                
+            }
+            break;
+        
+        case eWNI_SME_SWITCH_CHL_REQ:        // in case of STA, the SWITCH_CHANNEL originates from its AP
+            smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME\n"));
+            pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg;
+            //Update with the new channel id.
+            //The channel id is hidden in the statusCode.
+            status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId );
+            if( HAL_STATUS_SUCCESS( status ) )
+            {
+                pSession = CSR_GET_SESSION( pMac, sessionId );
+                pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId;
+                if(pSession->pConnectBssDesc)
+                {
+                    pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId;
+                }
+            }
+            break;
+                
+        case eWNI_SME_DEAUTH_RSP:
+            smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME\n"));
+#ifdef WLAN_SOFTAP_FEATURE
+            {
+                tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg;
+                sessionId = pDeauthRsp->sessionId;
+                if( CSR_IS_SESSION_VALID(pMac, sessionId) )
+                {                    
+                    pSession = CSR_GET_SESSION(pMac, sessionId);
+
+                    if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
+                    {
+                        pRoamInfo = &roamInfo;
+                        pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+                        palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr));
+                        pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED;
+                        pRoamInfo->statusCode = pDeauthRsp->statusCode;
+                        status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED);
+                    }
+                }
+            }
+#endif
+            break;
+            
+        case eWNI_SME_DISASSOC_RSP:
+            smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME subState = %d\n"), pMac->roam.curSubState[sessionId]);
+#ifdef WLAN_SOFTAP_FEATURE
+            {
+                tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg;
+                sessionId = pDisassocRsp->sessionId;
+                if( CSR_IS_SESSION_VALID(pMac, sessionId) )
+                {                    
+                    pSession = CSR_GET_SESSION(pMac, sessionId);
+
+                    if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
+                    {
+                        pRoamInfo = &roamInfo;
+                        pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+                        palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr));
+                        pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED;
+                        pRoamInfo->statusCode = pDisassocRsp->statusCode;
+                        status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED);
+                    }
+                }
+            }
+#endif
+            break;
+
+        case eWNI_SME_MIC_FAILURE_IND:
+            {
+                tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg;
+                tCsrRoamInfo roamInfo, *pRoamInfo = NULL;
+                eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                {
+                    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+                    WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type);
+                    palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type));
+                    secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR;
+                    secEvent.encryptionModeMulticast = 
+                        (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+                    secEvent.encryptionModeUnicast = 
+                        (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+                    secEvent.authMode = 
+                        (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+                    palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 );
+                    WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY);
+                }
+#endif//FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+                status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId );
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                    roamInfo.u.pMICFailureInfo = &pMicInd->info;
+                    pRoamInfo = &roamInfo;
+                    if(pMicInd->info.multicast)
+                    {
+                        result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP;
+                    }
+                    else
+                    {
+                        result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST;
+                    }
+                    csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result);
+                }
+            }
+            break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+        case eWNI_SME_WPS_PBC_PROBE_REQ_IND:
+            {
+                tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg;
+                tCsrRoamInfo roamInfo;
+
+                smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME\n"));
+           
+                status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId );
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                    roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq;
+                    csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, 
+                        eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND);
+                }
+            }
+            break;        
+#endif
+            
+
+        case eWNI_SME_WM_STATUS_CHANGE_NTF:
+            pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg;
+            switch( pStatusChangeMsg->statusChangeCode ) 
+            {
+                case eSIR_SME_IBSS_ACTIVE:
+                    sessionId = csrFindIbssSession( pMac );
+                    if( CSR_SESSION_ID_INVALID != sessionId )
+                    {
+                        pSession = CSR_GET_SESSION( pMac, sessionId );
+                        pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED;
+                        if(pSession->pConnectBssDesc)
+                        {
+                            palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
+                            roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
+                            pRoamInfo = &roamInfo;
+                        }
+                        else
+                        {
+                            smsLog(pMac, LOGE, "  CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n");
+                        }
+                        result = eCSR_ROAM_RESULT_IBSS_CONNECT;
+                        roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE;
+                    }
+                    break;
+
+                case eSIR_SME_IBSS_INACTIVE:
+                    sessionId = csrFindIbssSession( pMac );
+                    if( CSR_SESSION_ID_INVALID != sessionId )
+                    {
+                        pSession = CSR_GET_SESSION( pMac, sessionId );
+                        pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED;
+                        result = eCSR_ROAM_RESULT_IBSS_INACTIVE;
+                        roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE;
+                    }
+                    break;
+
+                case eSIR_SME_JOINED_NEW_BSS:    // IBSS coalescing.
+                    sessionId = csrFindIbssSession( pMac );
+                    if( CSR_SESSION_ID_INVALID != sessionId )
+                    {
+                        pSession = CSR_GET_SESSION( pMac, sessionId );
+                        // update the connection state information
+                        pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                        {
+                            vos_log_ibss_pkt_type *pIbssLog;
+                            tANI_U32 bi;
+
+                            WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+                            if(pIbssLog)
+                            {
+                                pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING;
+                                if(pNewBss)
+                                {
+                                    palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6);
+                                    if(pNewBss->ssId.length)
+                                    {
+                                        palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length);
+                                    }
+                                    pIbssLog->operatingChannel = pNewBss->channelNumber;
+                                }
+                                if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi)))
+                                {
+                                    //***U8 is not enough for beacon interval
+                                    pIbssLog->beaconInterval = (v_U8_t)bi;
+                                }
+                                WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+                            }
+                        }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+                        csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss );
+                        csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, 
+                                                    pSession->pConnectBssDesc,
+                                                &Broadcastaddr,
+                                                FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 );
+                        result = eCSR_ROAM_RESULT_IBSS_COALESCED;
+                        roamStatus = eCSR_ROAM_IBSS_IND;
+                        palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid));
+                        pRoamInfo = &roamInfo;
+                        //This BSSID is th ereal BSSID, let's save it
+                        if(pSession->pConnectBssDesc)
+                        {
+                            palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid));
+                        }
+                        // Stop the join IBSS timer in case of join, for 
+                        // genuine merge do nothing
+                        if(pSession->ibss_join_pending)
+                        {
+                           pSession->ibss_join_pending = FALSE;
+                           csrRoamStopIbssJoinTimer(pMac, sessionId);
+                           result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS;
+                        }
+                    }
+                    smsLog(pMac, LOGW, "CSR:  eSIR_SME_JOINED_NEW_BSS received from PE\n");
+                    break;
+
+                // detection by LIM that the capabilities of the associated AP have changed.
+                case eSIR_SME_AP_CAPS_CHANGED:
+                    pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps;
+                    smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED\n");
+                    status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId );
+                    if( HAL_STATUS_SUCCESS( status ) )
+                    {
+                    csrScanForCapabilityChange( pMac, pApNewCaps );
+                    result = eCSR_ROAM_RESULT_CAP_CHANGED;
+                    roamStatus = eCSR_ROAM_GEN_INFO;
+                    }
+                    break;
+            
+                default:
+                    roamStatus = eCSR_ROAM_FAILED;
+                    result = eCSR_ROAM_RESULT_NONE;
+                    break;
+
+            }  // end switch on statusChangeCode
+            if(eCSR_ROAM_RESULT_NONE != result)
+            {
+                csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result);
+            }
+            break;
+
+        case eWNI_SME_IBSS_NEW_PEER_IND:
+            pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+            {
+                vos_log_ibss_pkt_type *pIbssLog;
+
+                WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+                if(pIbssLog)
+                {
+                    pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN;
+                    palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6);
+                    WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+                }
+            }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+            sessionId = csrFindIbssSession( pMac );
+            if( CSR_SESSION_ID_INVALID != sessionId )
+            {
+                pSession = CSR_GET_SESSION( pMac, sessionId );
+            // Issue the set Context request to LIM to establish the Unicast STA context for the new peer...
+                if(pSession->pConnectBssDesc)
+                {
+                    palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid));
+                    palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
+                    if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd))
+                    {
+                        status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, 
+                                                (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)));
+                        if(HAL_STATUS_SUCCESS(status))
+                        {
+                            roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd));
+                            palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd),
+                                                roamInfo.nBeaconLength);
+                        }
+                        roamInfo.staId = (tANI_U8)pIbssPeerInd->staId;
+                        roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig;
+                        roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig;
+                        status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, 
+                                                pSession->pConnectBssDesc->length);
+                        if(HAL_STATUS_SUCCESS(status))
+                        {
+                            palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, 
+                                                pSession->pConnectBssDesc->length);
+                        }
+                        if(HAL_STATUS_SUCCESS(status))
+                        {
+                            pRoamInfo = &roamInfo;
+                        }
+                        else
+                        {
+                            if(roamInfo.pbFrames)
+                            {
+                                palFreeMemory(pMac->hHdd, roamInfo.pbFrames);
+                            }
+                            if(roamInfo.pBssDesc)
+                            {
+                                palFreeMemory(pMac->hHdd, roamInfo.pBssDesc);
+                            }
+                        }
+                    }
+                    else
+                    {
+                        pRoamInfo = &roamInfo;
+                    }
+                        csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, 
+                                            pSession->pConnectBssDesc,
+                                            &(pIbssPeerInd->peerAddr),
+                                            FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter.
+                }
+                else
+                {
+                    smsLog(pMac, LOGW, "  CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n");
+                }
+                //send up the sec type for the new peer
+                if (pRoamInfo)
+                {
+                    pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+                }
+                csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, 
+                            eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER);
+                if(pRoamInfo)
+                {
+                    if(roamInfo.pbFrames)
+                    {
+                        palFreeMemory(pMac->hHdd, roamInfo.pbFrames);
+                    }
+                    if(roamInfo.pBssDesc)
+                    {
+                        palFreeMemory(pMac->hHdd, roamInfo.pBssDesc);
+                    }
+                }
+            }
+            break;
+
+        case eWNI_SME_IBSS_PEER_DEPARTED_IND:
+            pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg;
+            sessionId = csrFindIbssSession( pMac );
+            if( CSR_SESSION_ID_INVALID != sessionId )
+            {
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                {
+                    vos_log_ibss_pkt_type *pIbssLog;
+ 
+                    WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+                    if(pIbssLog)
+                    {
+                        pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE;
+                        if(pIbssPeerInd)
+                        {
+                            palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6);
+                        }
+                        WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+                    }
+                }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+                smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM\n");
+                roamInfo.staId = (tANI_U8)pIbssPeerInd->staId;
+                roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig;
+                roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig;
+                palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid));
+                csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, 
+                        eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED);
+            }
+            break;
+
+        case eWNI_SME_SETCONTEXT_RSP:
+            {
+                tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg;
+                tListElem *pEntry;
+                tSmeCmd *pCommand;
+                
+                pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+                if ( pEntry )
+                {
+                    pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+                    if ( eSmeCommandSetKey == pCommand->command )
+                    {                
+                        sessionId = pCommand->sessionId;        
+                        pSession = CSR_GET_SESSION( pMac, sessionId );
+       
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                        if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType)
+                        {
+                            WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type);
+                            palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type));
+                            if( pRsp->peerMacAddr[0] & 0x01 )
+                            {
+                                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP;
+                            }
+                            else
+                            {
+                                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP;
+                            }
+                            setKeyEvent.encryptionModeMulticast = 
+                                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+                            setKeyEvent.encryptionModeUnicast = 
+                                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+                            palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 );
+                            setKeyEvent.authMode = 
+                                (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+                            if( eSIR_SUCCESS != pRsp->statusCode )
+                            {
+                                setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;
+                            }
+                            WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
+                        }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+                        if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) )
+                        {
+                            //We are done with authentication, whethere succeed or not
+                            csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId);
+
+                            csrRoamStopWaitForKeyTimer( pMac );
+                            //We do it here because this linkup function is not called after association 
+                            //when a key needs to be set. 
+                            if( csrIsConnStateConnectedInfra(pMac, sessionId) ) 
+                            {
+                                csrRoamLinkUp(pMac, pSession->connectedProfile.bssid);
+                            }
+                        }
+                        if( eSIR_SUCCESS == pRsp->statusCode )
+                        {
+                            palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) );
+                            //Make sure we install the GTK before indicating to HDD as authenticated
+                            //This is to prevent broadcast packets go out after PTK and before GTK.
+                            if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, 
+                                        sizeof(tSirMacAddr) ) )
+                            {
+                                result = eCSR_ROAM_RESULT_AUTHENTICATED;
+                            }
+                            else
+                            {
+                            result = eCSR_ROAM_RESULT_NONE;
+                            }
+                            pRoamInfo = &roamInfo;
+                        }
+                        else
+                        {
+                            result = eCSR_ROAM_RESULT_FAILURE;
+                            smsLog( pMac, LOGE, "CSR: Roam Completion setkey command failed(%d) PeerMac %02X-%02X-%02X-%02X-%02X-%02X...\n", 
+                                pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2],
+                                pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] );
+                        }
+                        csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, 
+                                            eCSR_ROAM_SET_KEY_COMPLETE, result);
+
+                        // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS
+                        // can go ahead and initiate the TSPEC if any are pending
+                        sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL);
+
+#ifdef FEATURE_WLAN_CCX
+                        //Send Adjacent AP repot to new AP.
+                        if (result == eCSR_ROAM_RESULT_AUTHENTICATED &&
+                            pSession->isPrevApInfoValid && 
+                            pSession->connectedProfile.isCCXAssoc)
+                        {
+#ifdef WLAN_FEATURE_VOWIFI
+                            csrCcxSendAdjacentApRepMsg(pMac, pSession);
+#endif
+                            pSession->isPrevApInfoValid = FALSE;
+                        }
+#endif
+
+                        if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                        {
+                            csrReleaseCommandSetKey( pMac, pCommand );
+                        }
+                    }
+                    else
+                    {
+                        smsLog( pMac, LOGE, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" );
+                    }
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" );
+                }
+
+                smeProcessPendingQueue( pMac );
+            }
+            break;
+
+        case eWNI_SME_REMOVEKEY_RSP:
+            {
+                tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg;
+                tListElem *pEntry;
+                tSmeCmd *pCommand;
+                
+                pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+                if ( pEntry )
+                {
+                    pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+                    if ( eSmeCommandRemoveKey == pCommand->command )
+                    {                
+                        sessionId = pCommand->sessionId;
+                        pSession = CSR_GET_SESSION( pMac, sessionId );
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                        {
+                            WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type);
+                            palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type));
+                            removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP;
+                            removeKeyEvent.encryptionModeMulticast = 
+                                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+                            removeKeyEvent.encryptionModeUnicast = 
+                                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+                            palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 );
+                            removeKeyEvent.authMode = 
+                                (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+                            if( eSIR_SUCCESS != pRsp->statusCode )
+                            {
+                                removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;
+                            }
+                            WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
+                        }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+                        if( eSIR_SUCCESS == pRsp->statusCode )
+                        {
+                            palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) );
+                            result = eCSR_ROAM_RESULT_NONE;
+                            pRoamInfo = &roamInfo;
+                        }
+                        else
+                        {
+                            result = eCSR_ROAM_RESULT_FAILURE;
+                        }
+                        csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, 
+                                            eCSR_ROAM_REMOVE_KEY_COMPLETE, result);
+                        if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                        {
+                            csrReleaseCommandRemoveKey( pMac, pCommand );
+                        }
+                    }
+                    else
+                    {
+                        smsLog( pMac, LOGW, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" );
+                    }
+                }
+                else
+                {
+                    smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" );
+                }
+
+                smeProcessPendingQueue( pMac );
+            }
+            break;
+
+        case eWNI_SME_GET_STATISTICS_RSP:
+            smsLog( pMac, LOGW, FL("Stats rsp from PE\n"));
+            csrRoamStatsRspProcessor( pMac, pSirMsg );
+            break;
+
+        case eWNI_SME_GET_RSSI_REQ:
+            smsLog( pMac, LOGW, FL("GetRssiReq from self\n"));
+            csrUpdateRssi( pMac, pSirMsg );
+            break;
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eWNI_SME_FT_PRE_AUTH_RSP:
+            csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg );
+            break;
+#endif
+
+        case eWNI_SME_MAX_ASSOC_EXCEEDED:
+            pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg;
+            smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted\n"));          
+            sessionId = pSmeMaxAssocInd->sessionId;
+            roamInfo.sessionId = sessionId;
+            palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid));
+            csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, 
+                    eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED);
+            break;
+            
+        case eWNI_SME_BTAMP_LOG_LINK_IND:
+            smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread\n"));
+            btampEstablishLogLinkHdlr( pSirMsg );
+            break;
+
+        default:
+            break;
+
+    }  // end switch on message type
+
+}
+
+
+void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, 
+                                      tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult)
+{
+   if(pSession)
+   {
+      if(pSession->bRefAssocStartCnt)
+      {
+         pSession->bRefAssocStartCnt--;
+         VOS_ASSERT( pSession->bRefAssocStartCnt == 0);
+         //Need to call association_completion because there is an assoc_start pending.
+         csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, 
+                                               eCSR_ROAM_ASSOCIATION_COMPLETION, 
+                                               eCSR_ROAM_RESULT_FAILURE);
+      }
+      csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult);
+   }
+   else
+   {
+      smsLog(pMac, LOGW, FL("  pSession is NULL"));
+   }
+}
+
+
+eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && 
+        (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming))
+    {
+        status = csrScanRequestLostLink1( pMac, sessionId );
+    }
+
+    return(status);
+}
+
+
+//return a boolean to indicate whether roaming completed or continue.
+tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                    tANI_BOOLEAN fForce, eCsrRoamResult roamResult)
+{
+    tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE;
+    tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND);
+    tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    //Check whether time is up
+    if(pSession->fCancelRoaming || fForce || 
+       ((curTime - pSession->roamingStartTime) > roamTime) ||
+       eCsrReassocRoaming == pSession->roamingReason ||
+       eCsrDynamicRoaming == pSession->roamingReason)
+    {
+        smsLog(pMac, LOGW, FL("  indicates roaming completion\n"));
+        if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason))
+        {
+            //roaming is cancelled, tell HDD to indicate disconnect
+            //Because LIM overload deauth_ind for both deauth frame and missed beacon
+            //we need to use this logic to detinguish it. For missed beacon, LIM set reason
+            //to be eSIR_BEACON_MISSED
+            if(eSIR_BEACON_MISSED == pSession->roamingStatusCode)
+            {
+                roamResult = eCSR_ROAM_RESULT_LOSTLINK;
+            }
+            else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason)
+            {
+                roamResult = eCSR_ROAM_RESULT_DISASSOC_IND;
+            }
+            else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason)
+            {
+                roamResult = eCSR_ROAM_RESULT_DEAUTH_IND;
+            }
+            else
+            {
+                roamResult = eCSR_ROAM_RESULT_LOSTLINK;
+            }
+        }
+        csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult);
+        pSession->roamingReason = eCsrNotRoaming;
+    }
+    else
+    {
+        pSession->roamResult = roamResult;
+        if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT)))
+        {
+            csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult);
+            pSession->roamingReason = eCsrNotRoaming;
+        }
+        else
+        {
+            fCompleted = eANI_BOOLEAN_FALSE;
+        }
+    }
+
+    return(fCompleted);
+}
+
+
+void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(CSR_IS_ROAMING(pSession))
+    {
+        smsLog(pMac, LOGW, "   Cancelling roaming\n");
+        pSession->fCancelRoaming = eANI_BOOLEAN_TRUE;
+        if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId))
+        {
+            //No need to do anything in here because the handler takes care of it
+        }
+        else
+        {
+            eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? 
+                                                    eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE;
+            //Roaming is stopped after here 
+            csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult);
+            //Since CSR may be in lostlink roaming situation, abort all roaming related activities
+            csrScanAbortMacScan(pMac);
+            csrRoamStopRoamingTimer(pMac, sessionId);
+        }
+    }
+}
+
+
+void csrRoamRoamingTimerHandler(void *pv)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    tANI_U32 sessionId = pInfo->sessionId;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) 
+    {
+        if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason)))
+        {
+            csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult);
+            pSession->roamingReason = eCsrNotRoaming;
+        }
+    }
+}
+
+
+eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
+{
+    eHalStatus status;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    smsLog(pMac, LOG1, " csrScanStartRoamingTimer \n ");
+    pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId;
+    status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE);
+    
+    return (status);
+}
+
+
+eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming));
+}
+
+
+void csrRoamWaitForKeyTimeOutHandler(void *pv)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+
+    if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) )
+    {
+        smsLog(pMac, LOGW, " SME pre-auth state timeout. \n ");
+        //Change the substate so command queue is unblocked.
+        csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId);
+    }
+    
+}
+
+
+eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval)
+{
+    eHalStatus status;
+    
+    smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer \n ");
+    status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE);
+    
+    return (status);
+}
+
+
+eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac)
+{
+    return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey));
+}
+
+
+void csrRoamIbssJoinTimerHandler(void *pv)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE;
+    tANI_U32 sessionId = pInfo->sessionId;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    pSession->ibss_join_pending = FALSE;
+    // JEZ100225:  As of main/latest "tip", we are no longer doing this. Check on this.
+    //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED);
+    // Send an IBSS stop request to PE
+    csrRoamDisconnectInternal(pMac, sessionId, reason);
+
+}
+
+eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
+{
+    eHalStatus status;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer \n ");
+    pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId;
+    status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE);
+    
+    return (status);
+}
+
+eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining));
+}
+
+void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, 
+                        eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess)
+{
+    eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId);
+    tANI_U32 roamId = 0;
+    
+    if(pCommand)
+    {
+        roamId = pCommand->u.roamCmd.roamId;
+#if defined(VOSS_ENABLED)
+        VOS_ASSERT( sessionId == pCommand->sessionId );
+#endif
+    }
+
+    if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus)
+    {
+        //if success, force roaming completion
+        csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult);
+    }
+    else
+    {
+        VOS_ASSERT((CSR_GET_SESSION( pMac, sessionId ))->bRefAssocStartCnt == 0);
+        smsLog(pMac, LOGW, FL("  indicates association completion. roamResult = %d\n"), roamResult);
+        csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult);
+    }
+}
+
+
+eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeDeauthInd *pDeauthIndMsg = NULL;
+    tSirSmeDisassocInd *pDisassocIndMsg = NULL;
+    eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK;
+    tCsrRoamInfo *pRoamInfo = NULL;
+    tCsrRoamInfo roamInfo;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    //Only need to roam for infra station. In this case P2P client will roam as well
+    tANI_BOOLEAN fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile);
+
+    pSession->fCancelRoaming = eANI_BOOLEAN_FALSE;
+    if ( eWNI_SME_DISASSOC_IND == type )
+    {
+        result = eCSR_ROAM_RESULT_DISASSOC_IND;
+        pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg;
+        pSession->roamingStatusCode = pDisassocIndMsg->statusCode;
+    }
+    else if ( eWNI_SME_DEAUTH_IND == type )
+    {
+        result = eCSR_ROAM_RESULT_DEAUTH_IND;
+        pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg;
+        pSession->roamingStatusCode = pDeauthIndMsg->statusCode;
+    }
+    else
+    {
+        smsLog(pMac, LOGW, FL("gets an unknown type (%d)\n"), type);
+        result = eCSR_ROAM_RESULT_NONE;
+    }
+    
+    // call profile lost link routine here
+#ifdef WLAN_SOFTAP_FEATURE
+    if(!CSR_IS_INFRA_AP(&pSession->connectedProfile))
+#endif
+    {
+        csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result);
+    }
+    
+    if ( eWNI_SME_DISASSOC_IND == type )
+    {
+        status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg);
+    }
+    else if ( eWNI_SME_DEAUTH_IND == type )
+    {
+        status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg);
+    }
+
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+       //If fail to send confirmation to PE, not to trigger roaming
+       fToRoam = eANI_BOOLEAN_FALSE;
+    }
+
+    //tell HDD to disconnect
+    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+    roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode;
+    roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+#ifdef WLAN_SOFTAP_FEATURE
+    if( eWNI_SME_DISASSOC_IND == type)
+    {
+        //staMacAddr
+        palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+        roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId;
+    }
+    else if( eWNI_SME_DEAUTH_IND == type )
+    {
+        //staMacAddr
+        palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+        roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId;
+    }
+#endif
+    smsLog(pMac, LOGW, FL("roamInfo.staId (%d)\n"), roamInfo.staId);
+    csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
+    if(fToRoam)
+    {
+        //Only remove the connected BSS in infrastructure mode
+        csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile);
+        //Not to do anying for lostlink with WDS
+        if( pMac->roam.configParam.nRoamingTime )
+        {
+            if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId,
+                        ( eWNI_SME_DEAUTH_IND == type ) ? 
+                        eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc)))
+            {
+                palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                //For IBSS, we need to give some more info to HDD
+                if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType))
+                {
+                    roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
+                    roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode;
+                    roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+                }
+                else
+                {
+                   roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink;
+                }
+                pRoamInfo = &roamInfo;
+                pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? 
+                        eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc;
+                pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+                csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __FUNCTION__, status);
+                fToRoam = eANI_BOOLEAN_FALSE;
+            }
+        }
+        else
+        {
+            //We are told not to roam, indicate lostlink
+            fToRoam = eANI_BOOLEAN_FALSE;
+        }
+    }
+
+    if(!fToRoam)
+    {
+       if( eWNI_SME_DISASSOC_IND == type)
+       {
+           //staMacAddr
+           palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+           roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId;
+       }
+       else if( eWNI_SME_DEAUTH_IND == type )
+       {
+           //staMacAddr
+            palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+            roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId;
+        }
+        csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
+       
+        /*No need to start idle scan in case of IBSS/SAP 
+         Still enable idle scan for polling in case concurrent sessions are running */
+        if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile))
+        {
+           csrScanStartIdleScan(pMac);
+        }
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry = NULL;
+    tSmeCmd *pCommand = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    pSession->fCancelRoaming =  eANI_BOOLEAN_FALSE;
+
+    //Only remove the connected BSS in infrastructure mode
+    csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile);
+    if(pMac->roam.configParam.nRoamingTime)
+    {
+       if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason)))
+       {
+          //before starting the lost link logic release the roam command for handoff
+          pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+          if(pEntry)
+          {
+              pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+          }
+          if(pCommand)
+          {
+             if (( eSmeCommandRoam == pCommand->command ) &&
+                 ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason))
+             {
+                 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+                 {
+                    csrReleaseCommandRoam( pMac, pCommand );
+                 }
+             }
+          }
+
+          smsLog( pMac, LOGW, "Lost link roaming started ...\n");
+       }
+    }
+    else
+    {
+       //We are told not to roam, indicate lostlink
+       status = eHAL_STATUS_FAILURE;
+    }
+    
+    return (status);
+}
+
+void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac )
+{
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if ( eSmeCommandWmStatusChange == pCommand->command )
+        {
+            // Nothing to process in a Lost Link completion....  It just kicks off a
+            // roaming sequence.
+            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+            {
+                csrReleaseCommandWmStatusChange( pMac, pCommand );            
+            }
+            else
+            {
+                smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command\n");
+            }
+            
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ...\n" );
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ...\n" );
+    }
+
+    smeProcessPendingQueue( pMac );
+}
+
+
+void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tSirSmeRsp *pSirSmeMsg;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId );
+
+    switch ( pCommand->u.wmStatusChangeCmd.Type )
+    {
+        case eCsrDisassociated:
+            pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg;
+            status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg);
+            break;
+
+        case eCsrDeauthenticated:
+            pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg;
+            status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg);
+            break;
+
+        default:
+            smsLog(pMac, LOGW, FL("gets an unknown command %d\n"), pCommand->u.wmStatusChangeCmd.Type);
+            break;
+    }
+    //For WDS, we want to stop BSS as well when it is indicated that it is disconnected.
+    if( CSR_IS_CONN_WDS(&pSession->connectedProfile) )
+    {
+        if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) )
+        {
+            //This is not good
+            smsLog(pMac, LOGE, FL("  failed to issue stopBSS command\n"));
+        }
+    }
+
+    // Lost Link just triggers a roaming sequence.  We can complte the Lost Link
+    // command here since there is nothing else to do.
+    csrRoamWmStatusChangeComplete( pMac );
+}
+
+
+//This function returns band and mode information.
+//The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B
+//instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick.
+#ifdef WLAN_SOFTAP_FEATURE
+static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
+                                                     tANI_U8 operationChn, eCsrBand *pBand )
+#else
+static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, 
+                                                     tANI_U8 operationChn, eCsrBand *pBand )
+#endif
+{
+
+#ifdef WLAN_SOFTAP_FEATURE
+    eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode;
+    eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, 
+                                            pMac->roam.configParam.ProprietaryRatesEnabled);
+#else
+    eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(phyModeIn, 
+                                            pMac->roam.configParam.ProprietaryRatesEnabled);
+#endif
+    eCsrBand eBand;
+    
+    //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile.
+#ifdef WLAN_SOFTAP_FEATURE
+    if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && 
+         ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) ||
+         (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) ||
+        (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) )
+#else
+    if( (eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) ||
+        (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode) ||
+        (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) )
+
+#endif
+    {
+        switch( pMac->roam.configParam.uCfgDot11Mode )
+        {
+            case eCSR_CFG_DOT11_MODE_11A:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+                eBand = eCSR_BAND_5G;
+                break;
+            case eCSR_CFG_DOT11_MODE_11B:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                eBand = eCSR_BAND_24;
+                break;
+            case eCSR_CFG_DOT11_MODE_11G:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+                eBand = eCSR_BAND_24;
+                break;            
+            case eCSR_CFG_DOT11_MODE_11N:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+                eBand = eCSR_BAND_24;
+                break;            
+            //case eCSR_CFG_DOT11_MODE_BEST:
+            //    cfgDot11Mode = eCSR_CFG_DOT11_MODE_BEST;
+            //    eBand = eCSR_BAND_24;
+            //    break;            
+            default:
+                // Global dot11 Mode setting is 11a/b/g.
+                // use the channel number to determine the Mode setting.
+                if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn )
+                {
+                    eBand = pMac->roam.configParam.eBand;
+                    if(eCSR_BAND_24 == eBand)
+                    {
+                        //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B
+                        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                    }
+                    else
+                    {
+                        //prefer 5GHz
+                        eBand = eCSR_BAND_5G;
+                        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+                    }
+                }
+                else if ( CSR_IS_CHANNEL_24GHZ(operationChn) )
+                {
+                    // channel is a 2.4GHz channel.  Set mode to 11g.
+                    //
+                    // !!LAC - WiFi tests require IBSS networks to start in 11b mode without any change to the
+                    // default parameter settings on the adapter.  We use ACU to start an IBSS through creation
+                    // of a startIBSS profile.   this startIBSS profile has Auto MACProtocol and the 
+                    // adapter property setting for dot11Mode is also AUTO.   So in this case, let's start 
+                    // the IBSS network in 11b mode instead of 11g mode.
+                    //
+                    // so this is for Auto=profile->MacProtocol && Auto=Global.dot11Mode && profile->channel is < 14, 
+                    // then start the IBSS in b mode.
+                    // 
+                    // Note:  we used to have this start as an 11g IBSS for best performance... now to specify that
+                    // the user will have to set the do11Mode in the property page to 11g to force it.
+                    cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                    eBand = eCSR_BAND_24;
+                }
+                else 
+                {   
+                    // else, it's a 5.0GHz channel.  Set mode to 11a.
+                    cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+                    eBand = eCSR_BAND_5G;
+                }
+                break;
+        }//switch
+    }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode )
+    else
+    {
+            //dot11 mode is set, lets pick the band
+            if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn )
+            {
+                // channel is Auto also. 
+                eBand = pMac->roam.configParam.eBand;
+                if(eCSR_BAND_ALL == eBand)
+                {
+                    //prefer 5GHz
+                    eBand = eCSR_BAND_5G;
+                }
+            }
+            else if ( CSR_IS_CHANNEL_24GHZ(operationChn) )
+            {
+                eBand = eCSR_BAND_24;
+            }
+            else 
+            {   
+                eBand = eCSR_BAND_5G;
+            }
+        }
+    if(pBand)
+    {
+        *pBand = eBand;
+    }
+    
+   if (operationChn == 14){ 
+     smsLog(pMac, LOGE, FL("  Switching to Dot11B mode \n"));
+     cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+   }
+
+    return( cfgDot11Mode );
+}
+
+
+eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate )
+{
+    eHalStatus status;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    {
+        vos_log_ibss_pkt_type *pIbssLog;
+
+        WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+        if(pIbssLog)
+        {
+            pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ;
+            WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+        }
+    }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+    pSession->ibss_join_pending = FALSE;
+    csrRoamStopIbssJoinTimer(pMac, sessionId );
+    // Set the roaming substate to 'stop Bss request'...
+    csrRoamSubstateChange( pMac, NewSubstate, sessionId );
+
+    // attempt to stop the Bss (reason code is ignored...)
+    status = csrSendMBStopBssReqMsg( pMac, sessionId );
+    
+    return (status);
+}
+
+
+//pNumChan is a caller allocated space with the sizeof pChannels
+eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan)
+{
+   
+    return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+                  (tANI_U8 *)pChannels,
+                  pNumChan));
+}
+
+
+tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel )
+{
+    tANI_BOOLEAN fValid = FALSE;
+    tANI_U32 idxValidChannels;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+    
+    if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len)))
+    {
+        for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ )
+        {
+            if ( channel == pMac->roam.validChannelList[ idxValidChannels ] )
+            {
+                fValid = TRUE;
+                break;
+            }
+        }
+    }    
+    pMac->roam.numValidChannels = len;   
+    return fValid;
+}
+
+
+tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel)
+{
+    tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE;
+    tANI_U8 i;
+
+    for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++)
+    {
+        if(channel == pMac->scan.base40MHzChannels.channelList[i])
+        {
+            fValid = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return (fValid);
+}
+
+
+//This function check and validate whether the NIC can do CB (40MHz)
+static tAniCBSecondaryMode csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes)
+{
+    tAniCBSecondaryMode eRet = eANI_CB_SECONDARY_NONE;
+    tANI_U8 centerChn;
+    tANI_U32 ChannelBondingMode;
+
+    if(CSR_IS_CHANNEL_24GHZ(primaryChn))
+    {
+        ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
+    }
+    else
+    {
+        ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz;
+    }
+    //Figure what the other side's CB mode
+    if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode)
+    {
+        if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet))
+        {
+            if(pIes->HTInfo.present)
+            {
+                if(PHY_DOUBLE_CHANNEL_LOW_PRIMARY == pIes->HTInfo.secondaryChannelOffset)
+                {
+                    eRet = eANI_CB_SECONDARY_UP;
+                    centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET;
+                }
+                else if(PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == pIes->HTInfo.secondaryChannelOffset)
+                {
+                    eRet = eANI_CB_SECONDARY_DOWN;
+                    centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET;
+                }
+                else
+                {
+                    //PHY_SINGLE_CHANNEL_CENTERED
+                    centerChn = primaryChn;
+                    eRet = eANI_CB_SECONDARY_NONE;
+                }
+                if((eANI_CB_SECONDARY_NONE != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn))
+                {
+                    smsLog(pMac, LOGW, "  Invalid center channel (%d), disable 40MHz mode\n", centerChn);
+                    eRet = eANI_CB_SECONDARY_NONE;
+                }
+            }
+        }
+    }
+
+    return eRet;
+}
+
+tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType )
+{
+    tANI_BOOLEAN fFound = FALSE;
+    tANI_U32 idx;
+
+    for( idx = 0; idx < pCipherList->numEntries; idx++ )
+    {
+        if( pCipherList->encryptionType[idx] == encryptionType )
+        {
+            fFound = TRUE;
+            break;
+        }
+    }
+
+    return fFound;
+}
+
+tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType )
+{
+    tANI_BOOLEAN fFound = FALSE;
+    tANI_U32 idx;
+
+    for( idx = 0; idx < pAuthList->numEntries; idx++ )
+    {
+        if( pAuthList->authType[idx] == authType )
+        {
+            fFound = TRUE;
+            break;
+        }
+    }
+
+    return fFound;
+}
+
+tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2)
+{
+    tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    
+    if(pProfile1 && pProfile2)
+    {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                fCheck = eANI_BOOLEAN_FALSE;
+                do
+                {
+                    tANI_U32 i;
+                    for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++)
+                    {
+                        fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, 
+                                                pScanFilter->SSIDs.SSIDList[i].SSID.length,
+                                                pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE );
+                        if ( fCheck ) break;
+                    }
+                    if(!fCheck)
+                    {
+                        break;
+                    }
+                    if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType)
+                        || pProfile2->BSSType != pProfile1->BSSType
+                        || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType )
+                        )
+                    {
+                        fCheck = eANI_BOOLEAN_FALSE;
+                        break;
+                    }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                    if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent)
+                    {
+                        if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain)
+                        {
+                            fCheck = eANI_BOOLEAN_FALSE;
+                            break;
+                        }
+                    }
+#endif
+                    //Match found
+                    fCheck = eANI_BOOLEAN_TRUE;
+                }while(0);
+                csrFreeScanFilter(pMac, pScanFilter);
+            }
+            palFreeMemory(pMac->hHdd, pScanFilter);
+        }
+    }
+    
+    return (fCheck);
+}
+
+
+tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2)
+{
+    tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE;
+    int i;
+
+    do
+    {
+        //Only check for static WEP
+        if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) &&
+            !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY))
+        {
+            fCheck = eANI_BOOLEAN_TRUE;
+            break;
+        }
+        if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break;
+        if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break;
+        for(i = 0; i < CSR_MAX_NUM_KEY; i++)
+        {
+            if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break;
+            if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], 
+                            &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i]))
+            {
+                break;
+            }
+        }
+        if( i == CSR_MAX_NUM_KEY)
+        {
+            fCheck = eANI_BOOLEAN_TRUE;
+        }
+    }while(0);
+
+    return (fCheck);
+}
+
+
+//IBSS
+
+
+tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac )
+{
+    tANI_U8 channel = 0;     
+    tANI_U32 idx;
+    tANI_U32 idxValidChannels;
+    tANI_BOOLEAN fFound = FALSE;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+    
+    if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G)
+    {
+        channel = pMac->roam.configParam.AdHocChannel5G;
+        if(!csrRoamIsChannelValid(pMac, channel))
+        {
+            channel = 0;
+        }
+    }
+    if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len)))
+    {
+        for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) 
+        {
+            for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ )
+            {
+                if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] )
+                {
+                    fFound = TRUE;
+                    channel = csrStartIbssChannels50[ idx ];
+                }
+            }
+        }
+
+        // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found!
+        if (!fFound)    
+        {
+            for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ )
+            {
+                if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) )   // the max channel# in 11g is 14
+                {
+                    channel = csrStartIbssChannels50[ idx ];
+                    break;
+                }
+            }
+        }
+    }//if
+    
+    return( channel );    
+}
+
+
+tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac )
+{
+    tANI_U8 channel = 1;
+    tANI_U32 idx;
+    tANI_U32 idxValidChannels;
+    tANI_BOOLEAN fFound = FALSE;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+    
+    if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24)
+    {
+        channel = pMac->roam.configParam.AdHocChannel24;
+        if(!csrRoamIsChannelValid(pMac, channel))
+        {
+            channel = 0;
+        }
+    }
+    
+    if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len)))
+    {
+        for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) 
+        {
+            for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ )
+            {
+                if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] )
+                {
+                    fFound = TRUE;
+                    channel = csrStartIbssChannels24[ idx ];
+                }
+            }
+        }
+    }
+    
+    return( channel );    
+}
+
+
+static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
+                                      tCsrRoamStartBssParams *pParam )
+{
+    eCsrCfgDot11Mode cfgDot11Mode;
+    eCsrBand eBand;
+    tANI_U8 channel = 0;
+    tSirNwType nwType;
+    tANI_U8 operationChannel = 0; 
+    
+    if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList)
+    {
+       operationChannel = pProfile->ChannelInfo.ChannelList[0];
+    }
+    
+#ifdef WLAN_SOFTAP_FEATURE
+    cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand );
+#else
+    cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand );
+#endif
+    
+#ifdef WLAN_FEATURE_P2P
+    if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) ||
+          (pProfile->csrPersona == VOS_P2P_GO_MODE) )
+     && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B)
+      )
+    {
+        /* This should never happen */
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+              FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B\n"), 
+              pProfile->csrPersona);
+        VOS_ASSERT(0);
+    }
+#endif
+
+    switch( cfgDot11Mode )
+    {
+        case eCSR_CFG_DOT11_MODE_11G:
+            nwType = eSIR_11G_NW_TYPE;
+            break;
+
+        case eCSR_CFG_DOT11_MODE_11B:
+            nwType = eSIR_11B_NW_TYPE;
+            break;   
+
+        case eCSR_CFG_DOT11_MODE_11A:
+            nwType = eSIR_11A_NW_TYPE;
+            break;
+
+        default:
+        case eCSR_CFG_DOT11_MODE_11N:
+        case eCSR_CFG_DOT11_MODE_TAURUS:
+            //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here
+            if(eCSR_BAND_24 == eBand)
+            {
+                nwType = eSIR_11G_NW_TYPE;
+            }
+            else
+            {
+                nwType = eSIR_11A_NW_TYPE;
+            }
+            break;
+    }   
+
+    pParam->extendedRateSet.numRates = 0;
+
+    switch ( nwType )
+    {
+        default:
+            smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)\n"), nwType);
+        case eSIR_11A_NW_TYPE:
+        
+            pParam->operationalRateSet.numRates = 8;
+        
+            pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9;
+            pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18;
+            pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36;
+            pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48;
+            pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54;
+            
+            if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) 
+            {
+                channel = csrRoamGetIbssStartChannelNumber50( pMac );
+                if( 0 == channel &&
+                    CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && 
+                    CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) 
+                    )
+                {
+                    //We could not find a 5G channel by auto pick, let's try 2.4G channels
+                    //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO
+                    nwType = eSIR_11B_NW_TYPE;
+                    channel = csrRoamGetIbssStartChannelNumber24( pMac );
+                   pParam->operationalRateSet.numRates = 4;
+                   pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK;
+                   pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK;
+                   pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK;
+                   pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK;
+                }
+            }
+            else 
+            {
+                channel = operationChannel;
+            }
+            break;
+            
+        case eSIR_11B_NW_TYPE:
+            pParam->operationalRateSet.numRates = 4;
+            pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK;
+
+            if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) 
+            {
+                channel = csrRoamGetIbssStartChannelNumber24( pMac );
+            }
+            else 
+            {
+                channel = operationChannel;
+            }
+            
+            break;     
+
+        case eSIR_11G_NW_TYPE:
+#ifdef WLAN_FEATURE_P2P
+            /* For P2P Client and P2P GO, disable 11b rates */ 
+            if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) ||
+                (pProfile->csrPersona == VOS_P2P_GO_MODE)
+              )
+            {
+                pParam->operationalRateSet.numRates = 8;
+            
+                pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK;
+                pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9;
+                pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK;
+                pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18;
+                pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK;
+                pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36;
+                pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48;
+                pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54;
+            }
+            else
+#endif            
+            {
+            pParam->operationalRateSet.numRates = 4;
+
+            pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK;
+            pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK;
+               
+            pParam->extendedRateSet.numRates = 8;
+
+                        pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6;
+            pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9;
+            pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12;
+            pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18;
+            pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24;
+            pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36;
+            pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48;
+            pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54;
+            }
+            
+            if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) 
+            {
+                channel = csrRoamGetIbssStartChannelNumber24( pMac );
+            }
+            else 
+            {
+                channel = operationChannel;
+            }
+            
+            break;            
+    }
+    pParam->operationChn = channel;
+    pParam->sirNwType = nwType;
+}
+
+
+static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, 
+                                                 tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam )
+{
+    
+    if( pParam )
+    {
+        pParam->sirNwType = pBssDesc->nwType;
+        pParam->cbMode = eANI_CB_SECONDARY_NONE;
+        pParam->operationChn = pBssDesc->channelId;
+        palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) );
+    
+        if( pIes )
+        {
+            if(pIes->SuppRates.present)
+            {
+                pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates;
+                if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX)
+                {
+                    smsLog(pMac, LOGE, FL("num_rates :%d is more than SIR_MAC_RATESET_EID_MAX, resetting to SIR_MAC_RATESET_EID_MAX\n"),
+                      pIes->SuppRates.num_rates);
+                    pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX;
+                }
+                palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, 
+                    sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates);
+            }
+            if( pIes->SSID.present )
+            {
+                pParam->ssId.length = pIes->SSID.num_ssid;
+                palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length);
+            }
+            pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes);
+
+        }
+        else
+        {
+            pParam->ssId.length = 0;
+           pParam->operationalRateSet.numRates = 0;
+        }
+    }
+}
+
+
+static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet )
+{
+    tANI_U8 MaxRate = 0;
+    tANI_U32 i;
+    tANI_U8 *pRate;    
+   
+    pRate = pSirRateSet->rate;
+    for ( i = 0; i < pSirRateSet->numRates; i++ )
+    {
+        MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) );
+    }
+    
+    // Save the max rate in the connected state information...
+    
+    // modify LastRates variable as well
+    
+    return;
+}
+
+
+//this function finds a valid secondary channel for channel bonding with "channel".
+//Param: channel -- primary channel, caller must validate it
+//       cbChoice -- CB directory
+//Return: if 0, no secondary channel is found. Otherwise a valid secondary channel.
+static tANI_U8 csrRoamGetSecondaryChannel(tpAniSirGlobal pMac, tANI_U8 channel, eCsrCBChoice cbChoice)
+{
+    tANI_U8 chnUp = 0, chnDown = 0, chnRet = 0;
+
+    switch (cbChoice)
+    {
+    case eCSR_CB_OFF:
+        chnUp = 0;
+        chnDown = 0;
+        break;
+    case eCSR_CB_DOWN:
+        chnUp = 0;
+        chnDown = channel - CSR_CB_CHANNEL_GAP;
+        break;
+    case eCSR_CB_UP:
+        chnUp = channel + CSR_CB_CHANNEL_GAP;
+        chnDown = 0;
+        break;
+    case eCSR_CB_AUTO:
+    //consider every other value means auto
+    default:
+        chnUp = channel + CSR_CB_CHANNEL_GAP;
+        chnDown = channel - CSR_CB_CHANNEL_GAP;
+        break;
+    }
+
+    //if CB_UP or auto, try channel up first
+    if(chnUp && CSR_IS_SAME_BAND_CHANNELS(chnUp, channel) && csrRoamIsChannelValid(pMac, chnUp))
+    {
+        //found a valid up channel for channel bonding
+        //check whether the center channel is valid
+        if(csrRoamIsValid40MhzChannel(pMac, channel + CSR_CB_CENTER_CHANNEL_OFFSET))
+        {
+            chnRet = chnUp;
+        }
+    }
+    if(chnRet == 0 && chnDown && CSR_IS_SAME_BAND_CHANNELS(chnDown, channel) && csrRoamIsChannelValid(pMac, chnDown))
+    {
+        //found a valid down channel for channel bonding
+        if(csrRoamIsValid40MhzChannel(pMac, channel - CSR_CB_CENTER_CHANNEL_OFFSET))
+        {
+            chnRet = chnDown;
+        }
+    }
+
+    return chnRet;
+}
+
+
+eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, 
+                                 tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    eCsrBand eBand;
+
+    // Set the roaming substate to 'Start BSS attempt'...
+    csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId );
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    //Need to figure out whether we need to log WDS???
+    if( CSR_IS_IBSS( pProfile ) )
+    {
+        vos_log_ibss_pkt_type *pIbssLog;
+
+        WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
+        if(pIbssLog)
+        {
+            if(pBssDesc)
+            {
+                pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ;
+                palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6);
+            }
+            else
+            {
+                pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ;
+            }
+            palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId,
+                pParam->ssId.length);
+            if(pProfile->ChannelInfo.numOfChannels == 0)
+            {
+                pIbssLog->channelSetting = AUTO_PICK;
+            }
+            else
+            {
+                pIbssLog->channelSetting = SPECIFIED;
+            }
+            pIbssLog->operatingChannel = pParam->operationChn;
+            WLAN_VOS_DIAG_LOG_REPORT(pIbssLog);
+        }
+    }
+#endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+    //Put RSN information in for Starting BSS
+    pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength;
+    pParam->pRSNIE = pProfile->pRSNReqIE;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+    pParam->privacy           = pProfile->privacy;
+    pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq;   
+    pParam->authType          = pProfile->csr80211AuthType;
+    pParam->beaconInterval    = pProfile->beaconInterval;
+    pParam->dtimPeriod        = pProfile->dtimPeriod;
+    pParam->ApUapsdEnable     = pProfile->ApUapsdEnable;
+    pParam->ssidHidden        = pProfile->SSIDs.SSIDList[0].ssidHidden;
+    if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0))
+    {
+        if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS)
+        {
+            pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL;                   
+        }  
+    }
+
+    pParam->protEnabled     = pProfile->protEnabled;
+    pParam->obssProtEnabled = pProfile->obssProtEnabled;
+    pParam->ht_protection   = pProfile->cfg_protection;
+    pParam->wps_state       = pProfile->wps_state;
+#endif
+    
+
+#ifdef WLAN_SOFTAP_FEATURE
+    pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, 
+                                        &eBand);
+#else
+    pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile->operationChannel, 
+                                        &eBand);
+#endif
+    pParam->bssPersona = pProfile->csrPersona;
+    // When starting an IBSS, start on the channel from the Profile.
+    status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc );
+
+    return (status);
+}
+
+
+static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                     tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
+{
+    tANI_U8 Channel, SecondChn;
+    tAniCBSecondaryMode cbMode = eANI_CB_SECONDARY_NONE;
+    eCsrCBChoice cbChoice;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if( pBssDesc )
+    {
+        csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams );
+        //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams
+        //The following code has to be do after that.
+        //For WDS station, use selfMac as the self BSSID
+        if( CSR_IS_WDS_STA( pProfile ) )
+        {
+            palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid));
+        }
+    }
+    else
+    {
+        csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams);
+
+        //Use the first SSID
+        if(pProfile->SSIDs.numOfSSIDs)
+        {
+            palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid));
+        }
+        //For WDS station, use selfMac as the self BSSID
+        if( CSR_IS_WDS_STA( pProfile ) )
+        {
+            palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid));
+        }
+        //Use the first BSSID
+        else if( pProfile->BSSIDs.numOfBSSIDs )
+        {
+            palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid));
+        }
+        else
+        {
+            palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) );
+        }
+    }
+    Channel = pSession->bssParams.operationChn;
+
+    //Set operating channel in pProfile which will be used 
+    //in csrRoamSetBssConfigCfg() to determine channel bonding
+    //mode and will be configured in CFG later 
+    pProfile->operationChannel = Channel;
+    
+    if(Channel == 0)
+    {
+        smsLog(pMac, LOGW, "   CSR cannot find a channel to start IBSS\n");
+    }
+    else
+    {
+  
+        csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet );
+
+        if( CSR_IS_START_IBSS( pProfile ) )
+        {
+           //TBH: channel bonding is not supported for Libra
+            if( pProfile->ChannelInfo.ChannelList && eCSR_OPERATING_CHANNEL_AUTO != pProfile->ChannelInfo.ChannelList[0] )
+            {
+                Channel = pProfile->ChannelInfo.ChannelList[0];
+                cbChoice = pProfile->CBMode;
+            }
+            else {
+                cbChoice = pMac->roam.configParam.cbChoice;
+            }
+            pSession->bssParams.operationChn = Channel;
+            //make sure channel is valid
+            if(!csrRoamIsChannelValid(pMac, Channel))
+            {
+                //set Channel to 0 to let lim know this is invalid
+                //We still send this request down to lim even though we know the channel is wrong because
+                //lim will response with error and hdd's eWNI_SME_START_BSS_RSP handler will roam other profile (if any)
+                Channel = 0;
+                pSession->bssParams.operationChn = 0;
+            }
+            else {
+                tANI_U32 ChannelBondingMode;
+
+                if(CSR_IS_CHANNEL_24GHZ(Channel))
+                {
+                    ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
+                }
+                else
+                {
+                    ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz;
+                }
+
+                //now we have a valid channel
+                if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode)
+                {
+                    //let's pick a secondard channel
+                    SecondChn = csrRoamGetSecondaryChannel(pMac, Channel, cbChoice);
+
+                    if(SecondChn > Channel)
+                    {
+                        cbMode = eANI_CB_SECONDARY_UP;
+                    }
+                    else if(SecondChn && SecondChn < Channel)
+                    {
+                        cbMode =eANI_CB_SECONDARY_DOWN;
+                    }
+                    else
+                    {
+                        cbMode = eANI_CB_SECONDARY_NONE;
+                    }
+                    pSession->bssParams.cbMode = cbMode;
+                }
+                else
+                {
+                    pSession->bssParams.cbMode = eANI_CB_SECONDARY_NONE;
+                }
+            }
+        }
+    }
+}
+
+
+
+static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                    tANI_BOOLEAN *pfSameIbss )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fSameIbss = FALSE;
+     
+    if ( csrIsConnStateIbss( pMac, sessionId ) ) 
+    { 
+        // Check if any profile parameter has changed ? If any profile parameter
+        // has changed then stop old BSS and start a new one with new parameters
+        if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) 
+        {
+            fSameIbss = TRUE;
+        }
+        else
+        {
+            status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING );
+        }       
+    }
+    else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) 
+    {
+        // Disassociate from the connected Infrastructure network...
+        status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE );
+    }
+    else 
+    {
+        tBssConfigParam *pBssConfig;
+        
+        status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); 
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam));
+            // there is no Bss description before we start an IBSS so we need to adopt
+            // all Bss configuration parameters from the Profile.
+            status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                //save dotMode
+                pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode;
+                //Prepare some more parameters for this IBSS
+                csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, NULL);
+                status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL);
+            }
+            
+            palFreeMemory(pMac->hHdd, pBssConfig);
+        }//Allocate memory
+    }
+    
+    if(pfSameIbss)
+    {
+        *pfSameIbss = fSameIbss;
+    }
+    return( status );
+}
+
+
+static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                                     tSirSmeNewBssInfo *pNewBss )
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if( pNewBss )
+    {
+        // Set the operating channel.
+        pSession->connectedProfile.operationChannel = pNewBss->channelNumber;
+        // move the BSSId from the BSS description into the connected state information.
+        palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, 
+                      &(pNewBss->bssId), sizeof( tCsrBssid ) );    
+    }
+
+    return;
+}
+
+
+#ifdef FEATURE_WLAN_WAPI
+eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
+                                 tANI_U32 numItems )
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   tCsrRoamSession *pSession;
+
+   if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
+   {
+       smsLog(pMac, LOGE, FL("  Invalid session ID\n"));
+       return status;
+   }
+   smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d\n", numItems);
+   pSession = CSR_GET_SESSION( pMac, sessionId );
+   if(numItems <= CSR_MAX_BKID_ALLOWED)
+   {
+       status = eHAL_STATUS_SUCCESS;
+       //numItems may be 0 to clear the cache
+       pSession->NumBkidCache = (tANI_U16)numItems;
+       if(numItems && pBKIDCache)
+       {
+           status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache,
+                           sizeof(tBkidCacheInfo) * numItems );
+       }
+   }
+
+   return (status);
+}
+
+eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum,
+                                tBkidCacheInfo *pBkidCache)
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   tCsrRoamSession *pSession;
+
+   if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
+   {
+       smsLog(pMac, LOGE, FL("  Invalid session ID\n"));
+       return status;
+   }
+
+   pSession = CSR_GET_SESSION( pMac, sessionId );
+   if(pNum && pBkidCache)
+   {
+       if(pSession->NumBkidCache == 0)
+       {
+           *pNum = 0;
+           status = eHAL_STATUS_SUCCESS;
+       }
+       else if(*pNum >= pSession->NumBkidCache)
+       {
+           if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED)
+           {
+               smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"),
+                 pSession->NumBkidCache);
+               pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED;
+           }
+           palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo,
+                           sizeof(tBkidCacheInfo) * pSession->NumBkidCache );
+           *pNum = pSession->NumBkidCache;
+           status = eHAL_STATUS_SUCCESS;
+       }
+   }
+
+   return (status);
+
+}
+
+tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+   return (pMac->roam.roamSession[sessionId].NumBkidCache);
+
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                 tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems )
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d\n", numItems);
+    if(numItems <= CSR_MAX_PMKID_ALLOWED)
+    {
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+        {
+            WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type);
+            palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type));
+            secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE;
+            secEvent.encryptionModeMulticast = 
+                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+            secEvent.encryptionModeUnicast = 
+                (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+            palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 );
+            secEvent.authMode = 
+                (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+            WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY);
+        }
+#endif//FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+        status = eHAL_STATUS_SUCCESS;
+        //numItems may be 0 to clear the cache
+        pSession->NumPmkidCache = (tANI_U16)numItems;
+        if(numItems && pPMKIDCache)
+        {
+            status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache,
+                            sizeof(tPmkidCacheInfo) * numItems );
+        }
+    }
+
+    return (status);
+}
+
+
+tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    return (pMac->roam.roamSession[sessionId].NumPmkidCache);
+}
+
+
+eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(pNum && pPmkidCache)
+    {
+        if(pSession->NumPmkidCache == 0)
+        {
+            *pNum = 0;
+            status = eHAL_STATUS_SUCCESS;
+        }
+        else if(*pNum >= pSession->NumPmkidCache)
+        {
+            if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED)
+            {
+                smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"),
+                  pSession->NumPmkidCache);
+                pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED;
+            }
+            palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo,
+                            sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache );
+            *pNum = pSession->NumPmkidCache;
+            status = eHAL_STATUS_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 len;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(pLen)
+    {
+        len = *pLen;
+        *pLen = pSession->nWpaRsnReqIeLength;
+        if(pBuf)
+        {
+            if(len >= pSession->nWpaRsnReqIeLength)
+            {
+                status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength);
+            }
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 len;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(pLen)
+    {
+        len = *pLen;
+        *pLen = pSession->nWpaRsnRspIeLength;
+        if(pBuf)
+        {
+            if(len >= pSession->nWpaRsnRspIeLength)
+            {
+                status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength);
+            }
+        }
+    }
+
+    return (status);
+}
+
+#ifdef FEATURE_WLAN_WAPI
+eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 len;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    if(pLen)
+    {
+        len = *pLen;
+        *pLen = pSession->nWapiReqIeLength;
+        if(pBuf)
+        {
+            if(len >= pSession->nWapiReqIeLength)
+            {
+                status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength);
+            }
+        }
+    }
+
+    return (status);
+}
+
+eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 len;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(pLen)
+    {
+        len = *pLen;
+        *pLen = pSession->nWapiRspIeLength;
+        if(pBuf)
+        {
+            if(len >= pSession->nWapiRspIeLength)
+            {
+                status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength);
+            }
+        }
+    }
+
+    return (status);
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    if(CSR_IS_ROAMING(pSession))
+    {
+        retStatus = eCSR_ROAM_ROAMING_COMPLETION;
+        pSession->fRoaming = eANI_BOOLEAN_FALSE;
+    }
+
+    return (retStatus);
+}
+
+
+//This function remove the connected BSS from te cached scan result
+eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac,
+                                                  tCsrRoamConnectedProfile *pConnProfile)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tListElem *pEntry;
+    tCsrScanResult *pResult;
+        tDot11fBeaconIEs *pIes;
+    tANI_BOOLEAN fMatch;
+
+    if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) ||
+            csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid)))
+    {
+        do
+        {
+            //Prepare the filter. Only fill in the necessary fields. Not all fields are needed
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+            if(!HAL_STATUS_SUCCESS(status)) break;
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid));
+            if(!HAL_STATUS_SUCCESS(status)) break;
+            palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid));
+            pScanFilter->BSSIDs.numOfBSSIDs = 1;
+            if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length))
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo));
+                if(!HAL_STATUS_SUCCESS(status)) break;
+                palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid));
+            }
+            pScanFilter->authType.numEntries = 1;
+            pScanFilter->authType.authType[0] = pConnProfile->AuthType;
+            pScanFilter->BSSType = pConnProfile->BSSType;
+            pScanFilter->EncryptionType.numEntries = 1;
+            pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType;
+            pScanFilter->mcEncryptionType.numEntries = 1;
+            pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType;
+            //We ignore the channel for now, BSSID should be enough
+            pScanFilter->ChannelInfo.numOfChannels = 0;
+            //Also ignore the following fields
+            pScanFilter->uapsd_mask = 0;
+            pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE;
+            pScanFilter->countryCode[0] = 0;
+            pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS;
+
+            csrLLLock(&pMac->scan.scanResultList);
+            pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+            while( pEntry ) 
+            {
+                pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+                                pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes );
+                fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, 
+                               pScanFilter, NULL, NULL, NULL, &pIes);
+                //Release the IEs allocated by csrMatchBSS is needed
+                if( !pResult->Result.pvIes )
+                {
+                    //need to free the IEs since it is allocated by csrMatchBSS
+                    palFreeMemory(pMac->hHdd, pIes);
+                }
+                if(fMatch)
+                {
+                    //We found the one
+                    if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) )
+                    {
+                        //Free the memory
+                        csrFreeScanResultEntry( pMac, pResult );
+                    }
+                    break;
+                }
+                pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
+            }//while
+            csrLLUnlock(&pMac->scan.scanResultList);
+        }while(0);
+        if(pScanFilter)
+        {
+            csrFreeScanFilter(pMac, pScanFilter);
+            palFreeMemory(pMac->hHdd, pScanFilter);
+        }
+    }
+    return (status);
+}
+
+
+
+//BT-AMP
+
+eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 sessionId;
+
+    for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) )
+            {
+                //co-exist with IBSS or BT-AMP is not supported
+                smsLog( pMac, LOGW, " BTAMP is not allowed due to IBSS/BT-AMP exist in session %d\n", sessionId );
+                status = eHAL_STATUS_CSR_WRONG_STATE;
+                break;
+            }
+            if( csrIsConnStateInfra( pMac, sessionId ) )
+            {
+                if( chnId && 
+                    ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) )
+                {
+                    smsLog( pMac, LOGW, " BTAMP is not allowed due to channel (%d) diff than infr channel (%d)\n",
+                        chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel );
+                    status = eHAL_STATUS_CSR_WRONG_STATE;
+                    break;
+                }
+            }
+        }
+    }
+
+    return ( status );
+}
+
+
+static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tBssConfigParam bssConfig;
+
+    if ( csrIsConnStateIbss( pMac, sessionId ) ) 
+    { 
+        status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING );
+    }
+    else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) 
+    {
+        // Disassociate from the connected Infrastructure network...
+        status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE );
+    }
+    else
+    {
+#if defined(VOSS_ENABLED)
+        //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. 
+        //Otherwise we need to add code to handle the
+        //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then 
+        //send stop_bss to PE, before we can continue.
+        VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) );
+#endif
+        palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam));
+        /* Assume HDD provide bssid in profile */
+        palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) );
+        // there is no Bss description before we start an WDS so we need
+        // to adopt all Bss configuration parameters from the Profile.
+        status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            //Save profile for late use
+            csrFreeRoamProfile( pMac, sessionId );
+            if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, 
+                                   (void **)&pSession->pCurRoamProfile,
+                                   sizeof(tCsrRoamProfile))))
+            {
+                palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile));
+                csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile);
+            }
+
+            //Prepare some more parameters for this WDS
+            csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, NULL);
+            status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL);
+        }
+    }
+    
+    return( status );
+}
+
+
+////////////////////Mail box
+
+
+//pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length;
+//or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length;
+static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, 
+                                            tSirBssDescription *pBssDescription, 
+                                            tANI_U8 *pBuf, tANI_U8 uapsdMask)
+{
+    tCsrChannelSet channelGroup;
+    tSirMacCapabilityInfo *pAP_capabilityInfo;
+    tAniBool fTmp;
+    tANI_BOOLEAN found = FALSE;
+    tANI_U32 size = 0;
+        tANI_U16 i;
+
+    // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels)
+    *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundPri
+    *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundSecDown
+    *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundSecUp
+
+    // 802.11h
+    //We can do this because it is in HOST CPU order for now.
+    pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo;
+
+        //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a
+        if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType )   
+        {  
+        fTmp = (tAniBool)pal_cpu_to_be32(1);
+    }
+    else
+        fTmp = (tAniBool)0;
+   
+    // corresponds to --- pMsg->spectrumMgtIndicator = ON;
+    palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) );
+    pBuf += sizeof(tAniBool);
+    *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0;
+        found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup);
+
+    // This is required for 11k test VoWiFi Ent: Test 2.
+    // We need the power capabilities for Assoc Req. 
+    // This macro is provided by the halPhyCfg.h. We pick our
+    // max and min capability by the halPhy provided macros
+    *pBuf++ = MAX_STA_PWR_CAP_DBM;
+
+    size = sizeof(pMac->roam.validChannelList);
+    if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size)))
+    { 
+        *pBuf++ = (tANI_U8)size;        //tSirSupChnl->numChnl        
+        for ( i = 0; i < size; i++) 
+        {
+            *pBuf++ = pMac->roam.validChannelList[ i ];   //tSirSupChnl->channelList[ i ]
+             
+        }
+    }
+    else
+    {
+        smsLog(pMac, LOGE, FL("can not find any valid channel\n"));
+        *pBuf++ = 0;  //tSirSupChnl->numChnl
+    }                                                                                                                     
+
+    //Check whether it is ok to enter UAPSD
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    if( btcIsReadyForUapsd(pMac) )
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+    {
+       *pBuf++ = uapsdMask;
+    }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    else
+    {
+        smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)\n"), uapsdMask);
+        *pBuf++ = 0;
+    }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+  
+
+    // move the entire BssDescription into the join request.
+    palCopyMemory( pMac->hHdd, pBuf, pBssDescription, 
+                    pBssDescription->length + sizeof( pBssDescription->length ) );
+
+    pBuf += pBssDescription->length + sizeof( pBssDescription->length );   // update to new location
+}
+
+
+/* 
+  * The communication between HDD and LIM is thru mailbox (MB).
+  * Both sides will access the data structure "tSirSmeJoinReq".
+  *  The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline
+  *  stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed
+  *  with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine
+  *  limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie.
+  */
+eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, 
+                              tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeJoinReq *pMsg;
+    tANI_U8 *pBuf;
+    tANI_U16 msgLen, wTmp, ieLen;
+    tSirMacRateSet OpRateSet;
+    tSirMacRateSet ExRateSet;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tANI_U32 dwTmp;
+    tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];    //RSN MAX is bigger than WPA MAX
+
+    do {
+        pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS;
+        pSession->joinFailStatusCode.reasonCode = 0;
+        // There are a number of variable length fields to consider.  First, the tSirSmeJoinReq
+        // includes a single bssDescription.   bssDescription includes a single tANI_U32 for the 
+        // IE fields, but the length field in the bssDescription needs to be interpreted to 
+        // determine length of the IE fields.
+        //
+        // So, take the size of the JoinReq, subtract the size of the bssDescription and 
+        // add in the length from the bssDescription (then add the size of the 'length' field
+        // itself because that is NOT included in the length field).
+        msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + 
+            pBssDescription->length + sizeof( pBssDescription->length ) +
+            sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build.
+
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_JOIN_REQ);
+        pMsg->length = pal_cpu_to_be16(msgLen);
+        pBuf = &pMsg->sessionId;
+
+        // sessionId
+        *pBuf = (tANI_U8)sessionId;
+        pBuf++;
+
+        // transactionId
+        *pBuf = 0;
+        *( pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+
+        // ssId
+        if( pIes->SSID.present && pIes->SSID.num_ssid )
+        {
+            // ssId len
+            *pBuf = pIes->SSID.num_ssid;
+            pBuf++;
+            palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid );
+            pBuf += pIes->SSID.num_ssid;
+        }
+        else
+        {
+            *pBuf = 0;
+            pBuf++;
+        }
+
+        // selfMacAddr
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+        // bsstype
+        dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) );
+        if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) );
+        pBuf += sizeof(tSirBssType);
+        // dot11mode
+        *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode );
+        pBuf++;
+
+        //Persona
+        *pBuf = (tANI_U8)pProfile->csrPersona;
+        pBuf++;
+
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                  FL("CSR PERSONA=%d"), pProfile->csrPersona);
+        
+        // uapsdPerAcBitmask
+        *pBuf = pProfile->uapsd_mask;
+        pBuf++;
+
+
+    
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)        
+#endif /*(WNI_POLARIS_FW_PACKAGE == ADVANCED)*/
+
+        status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet);
+        if (HAL_STATUS_SUCCESS(status) ) 
+        {
+            // OperationalRateSet
+            if (OpRateSet.numRates) {
+                *pBuf++ = OpRateSet.numRates;
+                palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates);
+                pBuf += OpRateSet.numRates;
+            } else *pBuf++ = 0;
+            // ExtendedRateSet
+            if (ExRateSet.numRates) {
+                *pBuf++ = ExRateSet.numRates;
+                palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates);
+                pBuf += ExRateSet.numRates;
+            } else *pBuf++ = 0;
+        }
+        else
+        {
+            *pBuf++ = 0;
+            *pBuf++ = 0;
+        }
+
+        // rsnIE
+        if ( csrIsProfileWpa( pProfile ) )
+        {
+            // Insert the Wpa IE into the join request
+            ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes,
+                    (tCsrWpaIe *)( wpaRsnIE ) );
+        }
+        else if( csrIsProfileRSN( pProfile ) )
+        {
+            // Insert the RSN IE into the join request
+            ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes,
+                    (tCsrRSNIe *)( wpaRsnIE ) );
+        }
+#ifdef FEATURE_WLAN_WAPI
+        else if( csrIsProfileWapi( pProfile ) )
+        {
+            // Insert the WAPI IE into the join request
+            ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes,
+                    (tCsrWapiIe *)( wpaRsnIE ) );
+        }
+#endif /* FEATURE_WLAN_WAPI */
+
+        else
+        {
+            ieLen = 0;
+        }
+        //remember the IE for future use
+        if( ieLen )
+        {
+            if(ieLen > DOT11F_IE_RSN_MAX_LEN)
+            {
+                smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN);
+                ieLen = DOT11F_IE_RSN_MAX_LEN;
+            }
+#ifdef FEATURE_WLAN_WAPI
+            if( csrIsProfileWapi( pProfile ) )
+            {
+                //Check whether we need to allocate more memory
+                if(ieLen > pSession->nWapiReqIeLength)
+                {
+                    if(pSession->pWapiReqIE && pSession->nWapiReqIeLength)
+                    {
+                        palFreeMemory(pMac->hHdd, pSession->pWapiReqIE);
+                    }
+                    status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen);
+                    if(!HAL_STATUS_SUCCESS(status)) break;
+                }
+                pSession->nWapiReqIeLength = ieLen;
+                palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen);
+                wTmp = pal_cpu_to_be16( ieLen );
+                palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+                pBuf += sizeof(tANI_U16);
+                palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen );
+                pBuf += ieLen;
+            }
+            else//should be WPA/WPA2 otherwise
+#endif /* FEATURE_WLAN_WAPI */
+            {
+                //Check whether we need to allocate more memory
+                if(ieLen > pSession->nWpaRsnReqIeLength)
+                {
+                    if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength)
+                    {
+                        palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE);
+                    }
+                    status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen);
+                    if(!HAL_STATUS_SUCCESS(status)) break;
+                }
+                pSession->nWpaRsnReqIeLength = ieLen;
+                palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen);
+                wTmp = pal_cpu_to_be16( ieLen );
+                palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+                pBuf += sizeof(tANI_U16);
+                palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen );
+                pBuf += ieLen;
+            }
+        }
+        else
+        {
+            //free whatever old info
+            pSession->nWpaRsnReqIeLength = 0;
+            if(pSession->pWpaRsnReqIE)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE);
+                pSession->pWpaRsnReqIE = NULL;
+            }
+#ifdef FEATURE_WLAN_WAPI
+            pSession->nWapiReqIeLength = 0;
+            if(pSession->pWapiReqIE)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pWapiReqIE);
+                pSession->pWapiReqIE = NULL;
+            }
+#endif /* FEATURE_WLAN_WAPI */
+            //length is two bytes
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+
+#ifdef FEATURE_WLAN_CCX
+        // Never include the cckmIE in an Join Request
+        //length is two bytes
+        *pBuf = 0;
+        *(pBuf + 1) = 0;
+        pBuf += 2;
+#endif 
+
+        // addIEScan
+        if(pProfile->nAddIEScanLength && pProfile->pAddIEScan)
+        {
+            ieLen = pProfile->nAddIEScanLength;
+
+            if(ieLen > pSession->nAddIEScanLength)
+            {
+                if(pSession->pAddIEScan && pSession->nAddIEScanLength)
+        {
+                    palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
+                }
+                status = palAllocateMemory(pMac->hHdd, 
+                                 (void **)&pSession->pAddIEScan, ieLen);
+                if(!HAL_STATUS_SUCCESS(status)) break;
+            }
+            pSession->nAddIEScanLength = ieLen;
+            palCopyMemory(pMac->hHdd, pSession->pAddIEScan, 
+                                      pProfile->pAddIEScan, ieLen);
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen );
+            pBuf += ieLen;
+        }
+        else
+        {
+            pSession->nAddIEScanLength = 0;
+            if(pSession->pAddIEScan)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
+                pSession->pAddIEScan = NULL;
+            }
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+
+        // addIEAssoc
+        if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc)
+        {
+            ieLen = pProfile->nAddIEAssocLength;
+
+            if(ieLen > pSession->nAddIEAssocLength)
+            {
+                if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength)
+                {
+                    palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
+                }
+                status = palAllocateMemory(pMac->hHdd, 
+                                 (void **)&pSession->pAddIEAssoc, ieLen);
+                if(!HAL_STATUS_SUCCESS(status)) break;
+            }
+            pSession->nAddIEAssocLength = ieLen;
+            palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, 
+                                      pProfile->pAddIEAssoc, ieLen);
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen );
+            pBuf += ieLen;
+        }
+        else
+        {
+            pSession->nAddIEAssocLength = 0;
+            if(pSession->pAddIEAssoc)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
+                pSession->pAddIEAssoc = NULL;
+            }
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+
+        dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
+        pBuf += sizeof(tANI_U32);        
+
+        dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
+        pBuf += sizeof(tANI_U32);        
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (csrIsProfile11r( pProfile ) )
+        {
+            // is11Rconnection;
+            dwTmp = pal_cpu_to_be32(TRUE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+        else
+        {
+            // is11Rconnection;
+            dwTmp = pal_cpu_to_be32(FALSE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+        /* A profile can not be both CCX and 11R. But an 802.11R AP
+         * may be advertising support for CCX as well. So if we are 
+         * associating Open or explicitly CCX then we will get CCX.
+         * If we are associating explictly 11R only then we will get
+         * 11R.
+         */
+        if ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+        {
+            // isCCXconnection;
+            dwTmp = pal_cpu_to_be32(TRUE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+        else 
+        {
+            //isCCXconnection;
+            dwTmp = pal_cpu_to_be32(FALSE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+        {
+            tCCXTspecInfo ccxTspec;
+            // CCX-Tspec IEs in the ASSOC request is presently not supported
+            // so nullify the TSPEC parameters
+            palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo));
+            palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo));
+            pBuf += sizeof(tCCXTspecInfo);
+        }
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+        // Fill in isFastTransitionEnabled
+        if (pMac->roam.configParam.isFastTransitionEnabled)
+        {
+            dwTmp = pal_cpu_to_be32(TRUE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+        else
+        {
+            dwTmp = pal_cpu_to_be32(FALSE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+#endif
+
+        //BssDesc
+        csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, 
+                (tANI_U8)pProfile->uapsd_mask);
+
+        status = palSendMBMessage(pMac->hHdd, pMsg );    
+        if(!HAL_STATUS_SUCCESS(status)) 
+        {
+            break;
+        }
+        //Tush-QoS: notify QoS module that join happening
+        else
+        {
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL);
+#endif
+        }
+    } while( 0 );
+    return( status );
+}
+
+
+eHalStatus csrSendSmeReassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, 
+                                    tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile )
+{
+    eHalStatus status;
+    tSirSmeReassocReq *pMsg;
+    tANI_U8 *pBuf;
+    v_U8_t acm_mask = 0, uapsd_mask;
+    tANI_U16 msgLen, ieLen, wTmp;
+    tANI_U32 dwTmp;
+    tSirMacRateSet OpRateSet;
+    tSirMacRateSet ExRateSet;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];    //RSN MAX is bigger than WPA MAX
+
+    /* To satisfy klockworks */
+    if (pBssDescription == NULL)
+    {
+        smsLog(pMac, LOGE, FL(" pBssDescription is NULL\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    do {
+        // There are a number of variable length fields to consider.  First, the tSirSmeJoinReq
+        // includes a single bssDescription.   bssDescription includes a single tANI_U32 for the 
+        // IE fields, but the length field in the bssDescription needs to be interpreted to 
+        // determine length of the IE fields.
+        //
+        // So, take the size of the JoinReq, subtract the size of the bssDescription and 
+        // add in the length from the bssDescription (then add the size of the 'length' field
+        // itself because that is NOT included in the length field).
+        msgLen = sizeof( tSirSmeReassocReq ) - sizeof( *pBssDescription ) + 
+                 pBssDescription->length + sizeof( pBssDescription->length ) +
+                 sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build.
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);         
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REASSOC_REQ);
+                pMsg->length = pal_cpu_to_be16(msgLen);
+        pBuf = &pMsg->sessionId;
+        // sessionId
+        *pBuf++ = (tANI_U8)sessionId;
+        // transactionId
+        *pBuf = 0;
+        *(pBuf + 1) = 0;
+        pBuf += sizeof (tANI_U16);
+        // ssId
+        if( pIes->SSID.present && pIes->SSID.num_ssid )
+        {
+            // ssId len
+            *pBuf++ = pIes->SSID.num_ssid;
+            palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid );
+            pBuf += pIes->SSID.num_ssid;
+        } 
+        else
+        {
+            *pBuf++ = 0;
+        }
+        // selfMacAddr
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+        // bsstype
+        dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) );
+        pBuf += sizeof(tSirBssType);
+        // dot11mode
+        *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode );
+        pBuf++;
+
+        //Persona
+        *pBuf = (tANI_U8)pProfile->csrPersona;
+        pBuf++;
+
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, FL("CSR PERSONA=%d\n"), pProfile->csrPersona);
+        
+        // uapsdPerAcBitmask
+        *pBuf = pProfile->uapsd_mask;
+        pBuf++;
+
+
+
+        status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, 
+                        pBssDescription, pIes, &OpRateSet, &ExRateSet);
+        if (HAL_STATUS_SUCCESS(status) ) 
+        {
+            // OperationalRateSet
+            if (OpRateSet.numRates) 
+            {
+                *pBuf++ = OpRateSet.numRates;
+                palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates);
+                pBuf += OpRateSet.numRates;
+            } 
+            else *pBuf++ = 0;
+            // ExtendedRateSet
+            if (ExRateSet.numRates) 
+            {
+                *pBuf++ = ExRateSet.numRates;
+                palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates);
+                pBuf += ExRateSet.numRates;
+            } 
+            else *pBuf++ = 0;
+        }
+        else
+        {
+            *pBuf++ = 0;
+            *pBuf++ = 0;
+        }
+
+                // rsnIE
+        if ( csrIsProfileWpa( pProfile ) )
+                {
+                    // Insert the Wpa IE into the join request
+            ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes,
+                                                   (tCsrWpaIe *)( wpaRsnIE ) );
+                }
+                else if( csrIsProfileRSN( pProfile ) )
+                {
+                    // Insert the RSN IE into the join request
+            ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes,
+                                                    (tCsrRSNIe *)( wpaRsnIE ) );
+        }
+#ifdef FEATURE_WLAN_WAPI
+        else if( csrIsProfileWapi( pProfile ) )
+        {
+            // Insert the WAPI IE into the join request
+            ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes,
+                                                (tCsrWapiIe *)( wpaRsnIE) );
+        }
+#endif /* FEATURE_WLAN_WAPI */
+        else
+        {
+            ieLen = 0;
+        }
+        //remember the IE for future use
+        if( ieLen )
+        {
+            if(ieLen > DOT11F_IE_RSN_MAX_LEN)
+             {
+                 smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN);
+                 ieLen = DOT11F_IE_RSN_MAX_LEN;
+             }
+
+            //Check whether we need to allocate more memory
+            if(ieLen > pSession->nWpaRsnReqIeLength)
+            {
+                if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength)
+                {
+                    palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE);
+                }
+                status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen);
+                if(!HAL_STATUS_SUCCESS(status)) break;
+            }
+            pSession->nWpaRsnReqIeLength = ieLen;
+            palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen);
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen );
+            pBuf += ieLen;
+                }
+                else
+                {
+            //free whatever old info
+            pSession->nWpaRsnReqIeLength = 0;
+            if(pSession->pWpaRsnReqIE)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE);
+                pSession->pWpaRsnReqIE = NULL;
+            }
+            //length is two bytes
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+                }
+
+#ifdef FEATURE_WLAN_CCX
+        // cckmIE
+        if( csrIsProfileCCX( pProfile ) )
+        {
+            // Insert the CCKM IE into the join request
+            ieLen = csrConstructCcxCckmIe( pMac, 
+                                          pSession, 
+                                          pProfile, 
+                                          pBssDescription, 
+                                          pSession->pWpaRsnReqIE, 
+                                          pSession->nWpaRsnReqIeLength,
+                                          (void *)( wpaRsnIE ) );
+        }
+        else
+        {
+            ieLen = 0;
+        }
+        //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer
+        if( ieLen )
+        {
+            //Copy the CCKM IE over from the temp buffer (wpaRsnIE)
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen );
+            pBuf += ieLen;
+        }
+        else
+        {
+            //Indicate you have no CCKM IE
+            //length is two bytes
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+#endif /* FEATURE_WLAN_CCX */
+
+        // addIEScan
+        if(pProfile->nAddIEScanLength && pProfile->pAddIEScan)
+        {
+            ieLen = pProfile->nAddIEScanLength;
+
+            if(ieLen > pSession->nAddIEScanLength)
+            {
+                if(pSession->pAddIEScan && pSession->nAddIEScanLength)
+                {
+                    palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
+                }
+                status = palAllocateMemory(pMac->hHdd, 
+                                 (void **)&pSession->pAddIEScan, ieLen);
+                if(!HAL_STATUS_SUCCESS(status)) break;
+            }
+            pSession->nAddIEScanLength = ieLen;
+            palCopyMemory(pMac->hHdd, pSession->pAddIEScan, 
+                                      pProfile->pAddIEScan, ieLen);
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen );
+            pBuf += ieLen;
+        }
+        else
+        {
+            pSession->nAddIEScanLength = 0;
+            if(pSession->pAddIEScan)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
+                pSession->pAddIEScan = NULL;
+            }
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+
+        // addIEAssoc
+        if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc)
+        {
+            ieLen = pProfile->nAddIEAssocLength;
+
+            if(ieLen > pSession->nAddIEAssocLength)
+            {
+                if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength)
+        {
+                    palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
+        }
+                status = palAllocateMemory(pMac->hHdd, 
+                                 (void **)&pSession->pAddIEAssoc, ieLen);
+                if(!HAL_STATUS_SUCCESS(status)) break;
+        }
+            pSession->nAddIEAssocLength = ieLen;
+            palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, 
+                                      pProfile->pAddIEAssoc, ieLen);
+            wTmp = pal_cpu_to_be16( ieLen );
+            palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+            pBuf += sizeof(tANI_U16);
+            palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen );
+            pBuf += ieLen;
+        }
+        else
+        {
+            pSession->nAddIEAssocLength = 0;
+            if(pSession->pAddIEAssoc)
+            {
+                palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
+                pSession->pAddIEAssoc = NULL;
+            }
+            *pBuf = 0;
+            *(pBuf + 1) = 0;
+            pBuf += 2;
+        }
+
+        //Unmask any AC in reassoc that is ACM-set
+        uapsd_mask = (v_U8_t)pProfile->uapsd_mask;
+        if( uapsd_mask && ( NULL != pBssDescription ) )
+        {
+            if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) )
+            {
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes);
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+                uapsd_mask &= ~(acm_mask);
+            }
+            else
+            {
+                uapsd_mask = 0;
+            }
+        }
+        
+        dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
+        pBuf += sizeof(tANI_U32);        
+        
+        dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
+        pBuf += sizeof(tANI_U32);        
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        // is11Rconnection;
+        dwTmp = csrIsProfile11r( pProfile )?  pal_cpu_to_be32(TRUE) : 0; 
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+        pBuf += sizeof(tAniBool);        
+
+#ifdef FEATURE_WLAN_CCX
+        //isCCXconnection;
+        //CCKM profile, ccxversion ie present, not 11r and ini file has CCX enabled
+        dwTmp = ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) ? pal_cpu_to_be32(TRUE) : 0;
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+        pBuf += sizeof(tAniBool);        
+#endif // FEATURE_WLAN_CCX
+#endif // WLAN_FEATURE_VOWIFI_11R
+
+#ifdef FEATURE_WLAN_CCX
+        if ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+        {
+           tCCXTspecInfo ccxTspec;
+
+           // CCX Tspec information
+           palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo));
+           ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]);
+           *pBuf = ccxTspec.numTspecs;
+           pBuf += sizeof(tANI_U8);
+
+           // Copy the TSPEC information only if present
+           if (ccxTspec.numTspecs) {
+               palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo)));
+           }
+           pBuf += sizeof(ccxTspec.tspec);
+        }
+        else 
+        {
+            {
+                tCCXTspecInfo ccxTspec;
+                // CCX-Tspec IEs in the ASSOC request is presently not supported
+                // so nullify the TSPEC parameters
+                palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo));
+                palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo));
+                pBuf += sizeof(tCCXTspecInfo);
+            }
+        }
+#endif // FEATURE_WLAN_CCX
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
+        // Fill in isFastTransitionEnabled
+        if (pMac->roam.configParam.isFastTransitionEnabled)
+        {
+            dwTmp = pal_cpu_to_be32(TRUE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+        else
+        {
+            dwTmp = pal_cpu_to_be32(FALSE); 
+            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
+            pBuf += sizeof(tAniBool);        
+        }
+#endif
+
+        csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, uapsd_mask);
+        
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+        //Tush-QoS: notify QoS module that reassoc happening
+        sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL);
+#endif
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+    } while( 0 );
+
+    return( status );
+
+}
+
+
+//
+eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeDisassocReq *pMsg;
+    tANI_U8 *pBuf;
+    tANI_U16 wTmp;
+#ifdef WLAN_SOFTAP_FEATURE
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
+        return eHAL_STATUS_FAILURE;
+#endif
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ);
+        pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq ));
+
+        pBuf = &pMsg->sessionId;
+        // sessionId
+        *pBuf++ = (tANI_U8)sessionId;
+        // transactionId
+        *pBuf = 0;
+        *( pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+     
+#ifdef WLAN_SOFTAP_FEATURE        
+        if ( (pSession->pCurRoamProfile != NULL ) && 
+             ( reasonCode == eSIR_MAC_UNSPEC_FAILURE_REASON ) && 
+             ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || (CSR_IS_WDS_AP(pSession->pCurRoamProfile))))
+        {
+            // Set the bssid address before sending the message to LIM
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) );
+            pBuf = pBuf + sizeof ( tSirMacAddr );
+
+            // Set the peer MAC address before sending the message to LIM
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP
+            pBuf = pBuf + sizeof ( tSirMacAddr );
+        }
+        else
+        {
+#endif
+            // Set the peer MAC address before sending the message to LIM
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) );
+            pBuf = pBuf + sizeof ( tSirMacAddr );
+
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) );
+            pBuf = pBuf + sizeof ( tSirMacAddr );
+#ifdef WLAN_SOFTAP_FEATURE
+        }
+#endif
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+
+        // reasonCode
+        wTmp = pal_cpu_to_be16(reasonCode);
+        status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+        pBuf += sizeof(tANI_U16);
+
+        /* The state will be DISASSOC_HANDOFF only when we are doing handoff. 
+                    Here we should not send the disassoc over the air to the AP */
+        if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId)
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                && csrRoamIs11rAssoc(pMac)
+#endif
+           )            
+        {
+            *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR;  /* Set DoNotSendOverTheAir flag to 1 only for handoff case */
+        }
+        pBuf += sizeof(tANI_U8);
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeTkipCntrMeasReq *pMsg;
+    tANI_U8 *pBuf;
+
+    do
+    {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ);
+        pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq ));
+
+        pBuf = &pMsg->sessionId;
+        // sessionId
+        *pBuf++ = (tANI_U8)sessionId;
+        // transactionId
+        *pBuf = 0;
+        *( pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+        // bssid
+        status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) );
+        pBuf = pBuf + sizeof ( tSirMacAddr );
+        // bEnable
+        *pBuf = (tANI_BOOLEAN)bEnable;
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+
+eHalStatus
+csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                    VOS_MODULE_ID modId, tSirMacAddr bssId,
+                                    void *pUsrContext, void *pfnSapEventCallback,
+                                    tANI_U8 *pAssocStasBuf )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeGetAssocSTAsReq *pMsg;
+    tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
+    tANI_U32 dwTmp;
+
+    do
+    {
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) );
+        if (!HAL_STATUS_SUCCESS(status)) break;
+        palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) );
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ASSOC_STAS_REQ);
+
+        pBuf = (tANI_U8 *)&pMsg->bssId;
+        wTmpBuf = pBuf;
+
+        // bssId
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+
+        // modId 
+        dwTmp = pal_cpu_to_be16((tANI_U16)modId);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16));
+        pBuf += sizeof(tANI_U16);
+
+        // pUsrContext
+        dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // pfnSapEventCallback
+        dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // pAssocStasBuf
+        dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+    } while( 0 );
+
+    return( status );
+        }
+
+eHalStatus
+csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                            tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac)
+        {
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeGetWPSPBCSessionsReq *pMsg;
+    tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
+    tANI_U32 dwTmp;
+
+    do
+        {
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) );
+        if (!HAL_STATUS_SUCCESS(status)) break;
+        palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) );
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_WPSPBC_SESSION_REQ);
+
+        pBuf = (tANI_U8 *)&pMsg->pUsrContext;
+        wTmpBuf = pBuf;
+
+        // pUsrContext
+        dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // pSapEventCallback
+        dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // bssId
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+
+        // MAC Address of STA in WPS session
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t));
+        pBuf += sizeof(v_MACADDR_t);
+
+        pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+#endif
+
+eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeDeauthReq *pMsg;
+    tANI_U8 *pBuf;
+    tANI_U16 wTmp;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
+        return eHAL_STATUS_FAILURE;
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq ));
+                pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ);
+                pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq ));
+        //sessionId
+        pBuf = &pMsg->sessionId;
+        *pBuf++ = (tANI_U8)sessionId;
+        
+        //tansactionId
+        *pBuf = 0;
+        *(pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+
+        if ((pSession->pCurRoamProfile != NULL)  && (
+#ifdef WLAN_SOFTAP_FEATURE
+             (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || 
+#endif
+             (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ 
+            // Set the BSSID before sending the message to LIM
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) );
+            pBuf =  pBuf + sizeof(tSirMacAddr);
+        }
+        else
+        {
+            // Set the BSSID before sending the message to LIM
+            status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) );
+            pBuf =  pBuf + sizeof(tSirMacAddr);
+
+        }
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }     
+                // Set the peer MAC address before sending the message to LIM
+        status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) );
+        pBuf =  pBuf + sizeof(tSirMacAddr);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }     
+        wTmp = pal_cpu_to_be16(reasonCode);
+        status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) );
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+
+
+eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeDisassocCnf *pMsg;
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF);
+        pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
+        pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf ));
+        status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); 
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+//To test reconn        
+        status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); 
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+//To test reconn ends
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+
+
+eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeDeauthCnf *pMsg;
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF);
+        pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
+        pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf ));
+        status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); 
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+        status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); 
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            palFreeMemory(pMac->hHdd, pMsg);
+            break;
+        }
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+
+    } while( 0 );
+
+    return( status );
+}
+
+eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeAssocCnf *pMsg;
+    tANI_U8 *pBuf;
+    tSirResultCodes statusCode;
+    tANI_U16 wTmp;
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf ));
+                pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF);
+                pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf ));
+
+        pBuf = (tANI_U8 *)&pMsg->statusCode;
+        if(HAL_STATUS_SUCCESS(Halstatus))
+            statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
+        else
+            statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED);
+        palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) );
+        pBuf += sizeof(tSirResultCodes);
+        // bssId
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr));
+        pBuf += sizeof (tSirMacAddr);
+        // peerMacAddr
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); 
+        pBuf += sizeof (tSirMacAddr);
+        // aid
+        wTmp = pal_cpu_to_be16(pAssocInd->aid);
+        palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+        pBuf += sizeof (tANI_U16);
+        // alternateBssId
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr));
+        pBuf += sizeof (tSirMacAddr);
+        // alternateChannelId
+        *pBuf = 11;
+
+        status = palSendMBMessage( pMac->hHdd, pMsg );
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            //pMsg is freed by palSendMBMessage
+            break;
+        }
+
+    } while( 0 );
+
+    return( status );
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrSendAssocIndToUpperLayerCnfMsg(   tpAniSirGlobal pMac, 
+                                                tpSirSmeAssocInd pAssocInd, 
+                                                eHalStatus Halstatus, 
+                                                tANI_U8 sessionId)
+{
+    tSirMsgQ            msgQ;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeAssocIndToUpperLayerCnf *pMsg;
+    tANI_U8 *pBuf;
+    tSirResultCodes statusCode;
+    tANI_U16 wTmp;
+
+    do {
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF);
+        pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf ));
+
+        pMsg->sessionId = sessionId;
+
+        pBuf = (tANI_U8 *)&pMsg->statusCode;
+        if(HAL_STATUS_SUCCESS(Halstatus))
+            statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
+        else
+            statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED);
+        palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) );
+        pBuf += sizeof(tSirResultCodes);
+        // bssId
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr));
+        pBuf += sizeof (tSirMacAddr);
+        // peerMacAddr
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); 
+        pBuf += sizeof (tSirMacAddr);
+        // StaId
+        wTmp = pal_cpu_to_be16(pAssocInd->staId);
+        palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+        pBuf += sizeof (tANI_U16);
+        // alternateBssId
+        status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr));
+        pBuf += sizeof (tSirMacAddr);
+        // alternateChannelId
+        *pBuf = 11;
+        pBuf += sizeof (tANI_U8);
+
+        // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information
+        //Wmm
+        *pBuf = pAssocInd->wmmEnabledSta;
+        pBuf += sizeof (tANI_U8);
+
+        //RSN IE
+        status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie));
+        pBuf += sizeof (tSirRSNie);
+
+        //Additional IE
+        status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie));
+        pBuf += sizeof (tSirAddie);
+
+        //reassocReq
+        *pBuf = pAssocInd->reassocReq;
+        pBuf += sizeof (tANI_U8);
+
+        msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF;
+        msgQ.bodyptr = pMsg;
+        msgQ.bodyval = 0;
+
+        SysProcessMmhMsg(pMac, &msgQ);
+
+    } while( 0 );
+
+    return( status );
+}
+#endif
+
+
+eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ,
+            tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, 
+            tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection,
+            tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, 
+            tANI_U8 *pKeyRsc )
+{
+    tSirSmeSetContextReq *pMsg;
+    tANI_U16 msgLen;
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tAniEdType tmpEdType;
+    tAniKeyDirection tmpDirection;
+    tANI_U8 *pBuf;
+    tANI_U8 *p;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do {
+
+        if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break;
+
+        // all of these fields appear in every SET_CONTEXT message.  Below we'll add in the size for each 
+        // key set. Since we only support upto one key, we always allocate memory for 1 key
+        msgLen  = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) +
+                  sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) +
+                  sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) +
+                  ( sizeof( pMsg->keyMaterial.key ) );
+                     
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+                pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ);
+                pMsg->length = pal_cpu_to_be16(msgLen);
+
+        //sessionId
+        pBuf = &pMsg->sessionId;
+        *pBuf = (tANI_U8)sessionId;
+        pBuf++;
+        // transactionId
+        *pBuf = 0;
+        *(pBuf + 1) = 0;
+        pBuf += sizeof(tANI_U16);
+        // peerMacAddr
+        palCopyMemory( pMac->hHdd, pBuf, 
+             (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) );
+
+        pBuf += sizeof(tSirMacAddr);
+
+        // bssId
+        palCopyMemory( pMac->hHdd, pBuf, 
+            (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
+
+        pBuf += sizeof(tSirMacAddr);
+
+        p = pBuf;
+
+                // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field
+                // in the tSirKeyMaterial keyMaterial; field).
+                //
+                // !!NOTE:  This keyMaterial.length contains the length of a MAX size key, though the keyLength can be 
+                // shorter than this max size.  Is LIM interpreting this ok ?
+                p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + ( numKeys * sizeof( pMsg->keyMaterial.key ) ) )) );
+
+                // set pMsg->keyMaterial.edType
+        tmpEdType = (tAniEdType)pal_cpu_to_be32(edType);
+        palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) );
+        p += sizeof( pMsg->keyMaterial.edType );
+
+        // set the pMsg->keyMaterial.numKeys field
+        *p = numKeys;
+        p += sizeof( pMsg->keyMaterial.numKeys );   
+
+        // set pSirKey->keyId = keyId;
+        *p = keyId;
+        p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId );
+
+        // set pSirKey->unicast = (tANI_U8)fUnicast;
+        *p = (tANI_U8)fUnicast;
+        p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast );
+
+                // set pSirKey->keyDirection = aniKeyDirection;
+        tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection);
+        palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) );
+        p += sizeof(tAniKeyDirection);
+        //    pSirKey->keyRsc = ;;
+        palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN );
+        p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc );
+
+                // set pSirKey->paeRole
+                *p = paeRole;   // 0 is Supplicant
+                p++;
+
+                // set pSirKey->keyLength = keyLength;
+                p = pal_set_U16( p, pal_cpu_to_be16(keyLength) );
+
+        if ( keyLength && pKey ) 
+        {   
+            palCopyMemory( pMac->hHdd, p, pKey, keyLength ); 
+            if(keyLength == 16)
+            {
+                smsLog(pMac, LOGE, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
+                keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4],
+                pKey[5], pKey[6], pKey[7], pKey[8],
+                pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]);
+            }
+        }
+
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+
+    } while( 0 );
+
+    return( status );
+}
+
+
+
+eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, 
+                                    tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc )
+{
+    eHalStatus status;
+    tSirSmeStartBssReq *pMsg;
+    tANI_U8 *pBuf = NULL;
+    tANI_U8  *wTmpBuf  = NULL;
+    tANI_U16 msgLen, wTmp;
+    tANI_U32 dwTmp;
+    tSirNwType nwType;
+    tAniCBSecondaryMode cbMode;
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U32 authType;
+#endif
+
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    do {
+        pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS;
+        pSession->joinFailStatusCode.reasonCode = 0;
+        msgLen = sizeof(tSirSmeStartBssReq);
+        status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_START_BSS_REQ);
+
+        pBuf = &pMsg->sessionId;
+
+        wTmpBuf = pBuf;
+
+        //sessionId
+        *pBuf = (tANI_U8)sessionId;
+        pBuf++;
+        // transactionId
+        *pBuf = 0;
+        *(pBuf + 1) = 0;
+        pBuf += sizeof(tANI_U16);
+
+        // bssid 
+        palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+        // selfMacAddr
+        palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+        // beaconInterval
+        if( pBssDesc && pBssDesc->beaconInterval )
+        {
+            wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval );
+        }
+#ifdef WLAN_SOFTAP_FEATURE
+        else if(pParam->beaconInterval)
+        {
+            wTmp = pal_cpu_to_be16( pParam->beaconInterval );
+        }
+#endif
+        else
+        {
+            wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF );
+        }
+        palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); 
+        pBuf += sizeof(tANI_U16);
+        // dot11mode
+        *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode );
+        pBuf += 1;
+        // bssType
+        dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) );
+        palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) );
+        pBuf += sizeof(tSirBssType);
+        // ssId
+        if( pParam->ssId.length )
+        {
+            // ssId len
+            *pBuf = pParam->ssId.length;
+            pBuf++;
+            palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length );
+            pBuf += pParam->ssId.length;
+        }
+        else
+        {
+            *pBuf = 0;
+            pBuf++;        
+        }
+
+        // set the channel Id
+        *pBuf = pParam->operationChn;
+        pBuf++;
+        //What should we really do for the cbmode.
+        cbMode = (tAniCBSecondaryMode)pal_cpu_to_be32(pParam->cbMode);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(tAniCBSecondaryMode) );
+        pBuf += sizeof(tAniCBSecondaryMode);
+
+#ifdef WLAN_SOFTAP_FEATURE
+        // Set privacy
+        *pBuf = pParam->privacy;
+        pBuf++;
+ 
+        //Set Uapsd 
+        *pBuf = pParam->ApUapsdEnable;
+        pBuf++;
+
+        //Set SSID hidden
+        *pBuf = pParam->ssidHidden;
+        pBuf++;
+
+        *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq;
+        pBuf++;
+        
+        //Ht protection Enable/Disable
+        *pBuf = (tANI_U8)pParam->protEnabled;
+        pBuf++;
+
+        //Enable Beacons to Receive for OBSS protection Enable/Disable
+        *pBuf = (tANI_U8)pParam->obssProtEnabled;
+        pBuf++;
+
+        //set cfg related to protection
+        wTmp = pal_cpu_to_be16( pParam->ht_protection );
+        palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); 
+        pBuf += sizeof(tANI_U16);
+
+        // Set Auth type
+        authType = pal_cpu_to_be32(pParam->authType);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // Set DTIM
+        dwTmp = pal_cpu_to_be32(pParam->dtimPeriod);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
+        pBuf += sizeof(tANI_U32);
+
+        // Set wps_state
+        *pBuf = pParam->wps_state;
+        pBuf++;
+
+#endif
+        //Persona
+        *pBuf = (tANI_U8)pParam->bssPersona;
+        pBuf++;
+        
+
+        
+        // set RSN IE 
+        if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) )
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+            palFreeMemory( pMac->hHdd, pMsg );
+            break;
+        }
+        wTmp = pal_cpu_to_be16( pParam->nRSNIELength );
+        palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
+        pBuf += sizeof(tANI_U16);
+        if( wTmp )
+        {
+            wTmp = pParam->nRSNIELength;
+            palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp );
+            pBuf += wTmp;
+        }
+        nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) );
+        pBuf += sizeof(tSirNwType);
+
+        *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates
+        pBuf++;
+
+        palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates );
+        pBuf += pParam->operationalRateSet.numRates ;
+        *pBuf++ = pParam->extendedRateSet.numRates;
+        if(0 != pParam->extendedRateSet.numRates)
+        {
+            palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates );
+            pBuf += pParam->extendedRateSet.numRates;
+        }
+
+        msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg
+        pMsg->length = pal_cpu_to_be16(msgLen);
+        
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+
+    } while( 0 );
+
+  return( status );
+}
+
+
+eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tSirSmeStopBssReq *pMsg;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tANI_U8 *pBuf;
+    tANI_U16 msgLen;
+
+    do {
+        status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq ));
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ);
+        pBuf = &pMsg->sessionId;
+        //sessionId
+        *pBuf = (tANI_U8)sessionId;
+        pBuf++;
+        // transactionId
+        *pBuf = 0;
+        pBuf += sizeof(tANI_U16);
+        //reason code
+        *pBuf  = 0;
+        pBuf += sizeof(tSirResultCodes);
+        // bssid 
+        // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile
+        if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) )
+        {
+            palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr,  sizeof(tSirMacAddr) );                
+        }
+        else
+        {
+            palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid,  sizeof(tSirMacAddr) );              
+        }
+       pBuf += sizeof(tSirMacAddr);
+       msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr);
+       pMsg->length =  pal_cpu_to_be16(msgLen);
+
+       status =  palSendMBMessage( pMac->hHdd, pMsg );
+#if 0            
+        status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq));
+        if ( !HAL_STATUS_SUCCESS(status) ) break;
+        palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq ));
+                pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ);
+                pMsg->reasonCode = 0;
+        // bssid
+        // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile
+        if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) )
+        {
+            pbBssid = (tANI_U8 *)&pSession->selfMacAddr;
+        }
+        else
+        {
+            pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid;
+        }
+        palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) );
+        pMsg->transactionId = 0;
+        pMsg->sessionId = (tANI_U8)sessionId;
+                pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq ));
+                status = palSendMBMessage( pMac->hHdd, pMsg );
+#endif                
+        } while( 0 );
+
+    return( status );
+}
+
+
+eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                      tCsrRoamModifyProfileFields *pModProfileFields,
+                      tANI_U32 *pRoamId, v_BOOL_t fForce)
+{
+
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tANI_U32 roamId = 0;
+   tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+   if((csrIsConnStateConnected(pMac, sessionId)) &&
+      (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, 
+                       &pSession->connectedProfile.modifyProfileFields, 
+                       sizeof(tCsrRoamModifyProfileFields)))) )
+   {
+      roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+      if(pRoamId)
+      {
+         *pRoamId = roamId;
+      }
+
+
+      status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, 
+                                   eCsrSmeIssuedReassocToSameAP, roamId, 
+                                   eANI_BOOLEAN_FALSE);
+
+   }
+
+   return status;
+}
+
+static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamInfo roamInfo;
+
+    palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+    status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0,
+                            eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE);
+    return (status);
+}
+
+eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
+{
+   eHalStatus                         status = eHAL_STATUS_SUCCESS;
+   tListElem                          *pEntry = NULL;
+   tSmeCmd                            *pCommand = NULL;
+   tSirSmeAddStaSelfRsp               *pRsp;
+
+   do
+   {
+      if(pMsg == NULL)
+      {
+         smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+         status = eHAL_STATUS_FAILURE;
+         break;
+      }
+
+      pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+      if(pEntry)
+      {
+         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+         if(eSmeCommandAddStaSession == pCommand->command)
+         {
+            pRsp = (tSirSmeAddStaSelfRsp*)pMsg;
+            smsLog( pMac, LOG1, "Add Sta rsp status = %d\n", pRsp->status );
+            //Nothing to be done. May be indicate the self sta addition success by calling session callback (TODO).
+
+            csrRoamSessionOpened(pMac, pCommand->sessionId);
+
+            //Remove this command out of the active list
+            if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK))
+            {
+               //Now put this command back on the avilable command list
+               csrReleaseCommand(pMac, pCommand);
+            }
+            smeProcessPendingQueue( pMac );
+         }
+         else
+         {
+            smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO Add sta session command are ACTIVE ...\n",
+                  __FUNCTION__);
+            status = eHAL_STATUS_FAILURE;
+            break;
+         }
+      }
+      else
+      {
+         smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO commands are ACTIVE ...\n",
+               __FUNCTION__);
+         status = eHAL_STATUS_FAILURE;
+         break;
+      }
+   } while(0);
+
+   return status;
+
+}
+
+eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr )
+{
+   tSirSmeAddStaSelfReq *pMsg;
+   tANI_U16 msgLen;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+
+   do {
+
+      msgLen  = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+
+         sizeof( tSirBssType )*/;
+
+      status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+      if ( !HAL_STATUS_SUCCESS(status) ) break;
+
+      palZeroMemory(pMac->hHdd, pMsg, msgLen);
+
+      pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ);
+      pMsg->mesgLen = pal_cpu_to_be16(msgLen);
+
+      // self station address
+      palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) );
+
+        smsLog( pMac, LOGE, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x\n"),       
+            pMsg->selfMacAddr[0],
+            pMsg->selfMacAddr[1],
+            pMsg->selfMacAddr[2],
+            pMsg->selfMacAddr[3],
+            pMsg->selfMacAddr[4],
+            pMsg->selfMacAddr[5]);
+      status = palSendMBMessage(pMac->hHdd, pMsg);
+
+   } while( 0 );
+
+   return( status );
+}
+
+eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tSmeCmd *pCommand;
+
+   pCommand = csrGetCommandBuffer(pMac);
+   if(NULL == pCommand)
+   {
+      status = eHAL_STATUS_RESOURCES;
+   }
+   else
+   {
+      pCommand->command = eSmeCommandAddStaSession;
+      pCommand->sessionId = (tANI_U8)sessionId;
+      palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) );
+
+      status = csrQueueSmeCommand(pMac, pCommand, TRUE);
+      if( !HAL_STATUS_SUCCESS( status ) )
+      {
+         //Should be panic??
+         smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+      }
+   }
+
+   return (status);
+}
+
+eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+   return csrSendMBAddSelfStaReqMsg( pMac, 
+         pCommand->u.addStaSessionCmd.selfMacAddr );
+}
+
+eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext,
+                          tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 i;
+    tCsrRoamSession *pSession;
+
+    *pbSessionId = CSR_SESSION_ID_INVALID;
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( !CSR_IS_SESSION_VALID( pMac, i ) )
+        {
+            pSession = CSR_GET_SESSION( pMac, i );
+            status = eHAL_STATUS_SUCCESS;
+            pSession->sessionActive = eANI_BOOLEAN_TRUE;
+            pSession->sessionId = (tANI_U8)i;
+                pSession->callback = callback;
+            pSession->pContext = pContext;
+            palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) );
+            *pbSessionId = (tANI_U8)i;
+
+            status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, 
+                                    &pSession->roamingTimerInfo);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer\n"));
+                break;
+            }
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+            status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, 
+                                    &pSession->joinRetryTimerInfo);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer\n"));
+                break;
+            }
+#endif
+            pSession->ibssJoinTimerInfo.pMac = pMac;
+            pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+
+            status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, 
+                                    &pSession->ibssJoinTimerInfo);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer\n"));
+                break;
+            }
+            status = csrIssueAddStaForSessionReq ( pMac, i, pSelfMacAddr );
+            break;
+        }
+    }
+    if( CSR_ROAM_SESSION_MAX == i )
+    {
+        //No session is available
+        status = eHAL_STATUS_RESOURCES;
+    }
+
+    return ( status );
+}
+
+eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
+{
+   eHalStatus                         status = eHAL_STATUS_SUCCESS;
+   tListElem                          *pEntry = NULL;
+   tSmeCmd                            *pCommand = NULL;
+   tSirSmeDelStaSelfRsp               *pRsp;
+
+   do
+   {
+      if(pMsg == NULL)
+      {
+         smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+         status = eHAL_STATUS_FAILURE;
+         break;
+      }
+
+      pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+      if(pEntry)
+      {
+         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+         if(eSmeCommandDelStaSession == pCommand->command)
+         {
+            tANI_U8 sessionId = pCommand->sessionId;
+
+            pRsp = (tSirSmeDelStaSelfRsp*)pMsg;
+            smsLog( pMac, LOG1, "Del Sta rsp status = %d\n", pRsp->status );
+
+            //This session is done.
+            csrCleanupSession(pMac, sessionId);
+
+            if(pCommand->u.delStaSessionCmd.callback)
+            {
+                 
+                status = sme_ReleaseGlobalLock( &pMac->sme );
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pCommand->u.delStaSessionCmd.callback(
+                                      pCommand->u.delStaSessionCmd.pContext);
+                    status = sme_AcquireGlobalLock( &pMac->sme );
+                    if (! HAL_STATUS_SUCCESS( status ) )
+                    {
+                        smsLog(pMac, LOGP, "%s: Failed to Acquire Lock\n", __FUNCTION__);
+                        return status;
+                    }
+                }
+                else {
+                    smsLog(pMac, LOGE, "%s: Failed to Release Lock\n", __FUNCTION__);
+                }
+            } 
+   
+            //Remove this command out of the active list
+            if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK))
+            {
+               //Now put this command back on the avilable command list
+               csrReleaseCommand(pMac, pCommand);
+            }
+            smeProcessPendingQueue( pMac );
+         }
+         else
+         {
+            smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO Del sta session command are ACTIVE ...\n",
+                  __FUNCTION__);
+            status = eHAL_STATUS_FAILURE;
+            break;
+         }
+      }
+      else
+      {
+         smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO commands are ACTIVE ...\n",
+               __FUNCTION__);
+         status = eHAL_STATUS_FAILURE;
+         break;
+      }
+   } while(0);
+
+   return status;
+
+}
+
+eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr )
+{
+   tSirSmeDelStaSelfReq *pMsg;
+   tANI_U16 msgLen;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+
+   do {
+
+      msgLen  = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+
+         sizeof( tSirBssType )*/;
+
+      status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+      if ( !HAL_STATUS_SUCCESS(status) ) break;
+   
+      palZeroMemory(pMac->hHdd, pMsg, msgLen);
+
+      pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ);
+      pMsg->mesgLen = pal_cpu_to_be16(msgLen);
+
+      // self station address
+      palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) );
+
+      status = palSendMBMessage(pMac->hHdd, pMsg);
+
+   } while( 0 );
+
+   return( status );
+}
+
+eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                       tSirMacAddr sessionMacAddr,
+                                       csrRoamSessionCloseCallback callback,
+                                       void *pContext)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+   tSmeCmd *pCommand;
+
+   pCommand = csrGetCommandBuffer(pMac);
+   if(NULL == pCommand)
+   {
+      status = eHAL_STATUS_RESOURCES;
+   }
+   else
+   {
+      pCommand->command = eSmeCommandDelStaSession;
+      pCommand->sessionId = (tANI_U8)sessionId;
+      pCommand->u.delStaSessionCmd.callback = callback;
+      pCommand->u.delStaSessionCmd.pContext = pContext;
+      palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) );
+
+      status = csrQueueSmeCommand(pMac, pCommand, TRUE);
+      if( !HAL_STATUS_SUCCESS( status ) )
+      {
+         //Should be panic??
+         smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+      }
+   }
+
+   return (status);
+}
+
+eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+   return csrSendMBDelSelfStaReqMsg( pMac, 
+         pCommand->u.delStaSessionCmd.selfMacAddr );
+}
+
+static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tDblLinkList *pList = &pMac->roam.roamCmdPendingList;
+    tListElem *pEntry, *pNext;
+    tSmeCmd *pCommand;
+    tDblLinkList localList;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return;
+    }
+
+    csrLLLock(pList);
+    pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
+    while(pEntry != NULL)
+    {
+        pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if(pCommand->sessionId == sessionId)
+        {
+            if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
+            {
+                csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+            }
+        }
+        pEntry = pNext;
+    }
+    csrLLUnlock(pList);
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+    }
+    csrLLClose(&localList);
+}
+
+
+void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+    {
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+        csrRoamStop(pMac, sessionId);
+        csrFreeConnectBssDesc(pMac, sessionId);
+        csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile );
+        csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo);
+        palTimerFree(pMac->hHdd, pSession->hTimerRoaming);
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+        palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry);
+#endif
+        palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining);
+        purgeSmeSessionCmdList(pMac, sessionId);
+        purgeCsrSessionCmdList(pMac, sessionId);
+        csrInitSession(pMac, sessionId);
+    }
+}
+
+
+eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                tANI_BOOLEAN fSync, 
+                                csrRoamSessionCloseCallback callback,
+                                void *pContext )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+    {
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+        if(fSync)
+        {
+            csrCleanupSession(pMac, sessionId);
+        }
+        else
+        { 
+            purgeSmeSessionCmdList(pMac, sessionId);
+            purgeCsrSessionCmdList(pMac, sessionId);
+            status = csrIssueDelStaForSessionReq( pMac, sessionId,
+                                        pSession->selfMacAddr, callback, pContext);
+        }
+    }
+    else
+    {
+        status = eHAL_STATUS_INVALID_PARAMETER;
+    }
+
+    return ( status );
+}
+
+
+static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    pSession->sessionActive = eANI_BOOLEAN_FALSE;
+    pSession->sessionId = CSR_SESSION_ID_INVALID;
+    pSession->callback = NULL;
+    pSession->pContext = NULL;
+    pSession->ibss_join_pending = FALSE;
+    pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
+    // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE;
+    csrFreeRoamProfile( pMac, sessionId );
+    csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile);
+    csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
+    csrFreeConnectBssDesc(pMac, sessionId);
+    csrScanEnable(pMac);
+    palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) );
+    if(pSession->pWpaRsnReqIE)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE);
+        pSession->pWpaRsnReqIE = NULL;
+    }
+    pSession->nWpaRsnReqIeLength = 0;
+    if(pSession->pWpaRsnRspIE)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE);
+        pSession->pWpaRsnRspIE = NULL;
+    }
+    pSession->nWpaRsnRspIeLength = 0;
+#ifdef FEATURE_WLAN_WAPI
+    if(pSession->pWapiReqIE)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pWapiReqIE);
+        pSession->pWapiReqIE = NULL;
+    }
+    pSession->nWapiReqIeLength = 0;
+    if(pSession->pWapiRspIE)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pWapiRspIE);
+        pSession->pWapiRspIE = NULL;
+    }
+    pSession->nWapiRspIeLength = 0;
+#endif /* FEATURE_WLAN_WAPI */
+
+    if(pSession->pAddIEScan)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
+        pSession->pAddIEScan = NULL;
+    }
+    pSession->nAddIEScanLength = 0;
+
+    if(pSession->pAddIEAssoc)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
+        pSession->pAddIEAssoc = NULL;
+}
+    pSession->nAddIEAssocLength = 0;
+
+}
+
+
+eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tANI_U32 i;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) )
+        {
+            if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) )
+            {
+                //Found it
+                status = eHAL_STATUS_SUCCESS;
+                *pSessionId = i;
+                break;
+            }
+        }
+    }
+
+    return( status );
+}
+
+
+//This function assumes that we only support one IBSS session. We cannot use BSSID to identify 
+//session because for IBSS, the bssid changes.
+static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac )
+{
+    tANI_U32 i, nRet = CSR_SESSION_ID_INVALID;
+    tCsrRoamSession *pSession;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) )
+        {
+            pSession = CSR_GET_SESSION( pMac, i );
+            if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) )
+            {
+                //Found it
+                nRet = i;
+                break;
+            }
+        }
+    }
+
+    return (nRet);
+}
+
+static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid)
+{
+   /* Update the current BSS info in ho control block based on connected 
+      profile info from pmac global structure                              */
+   
+
+   smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x\n", 
+          bssid[ 0 ], bssid[ 1 ], bssid[ 2 ],
+          bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] );
+
+   /* Check for user misconfig of RSSI trigger threshold                  */
+   pMac->roam.configParam.vccRssiThreshold =
+      ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? 
+      CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold;
+   pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
+
+    /* Check for user misconfig of UL MAC Loss trigger threshold           */
+   pMac->roam.configParam.vccUlMacLossThreshold =
+      ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? 
+      CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold;
+
+#if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
+    {
+        tANI_U32 sessionId = 0;
+
+        /* Indicate the neighbor roal algorithm about the connect indication */
+        csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId);
+        csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS);
+    }
+#endif
+
+}
+
+
+static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+   tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+   //Only to handle the case for Handover on infra link
+   if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType )
+   {
+      return;
+   }
+
+
+   /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/
+   csrRoamDeregStatisticsReq(pMac);
+   pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
+#if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
+   /* Indicate the neighbor roal algorithm about the disconnect indication */
+   csrNeighborRoamIndicateDisconnect(pMac, sessionId);
+#endif
+   
+}
+
+
+void csrRoamTlStatsTimerHandler(void *pv)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+   eHalStatus status;
+
+   pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
+
+#if 0
+   // TODO Persession .???
+   //req TL for stats
+   if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId))
+   {
+      smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL\n"));
+   }
+   else
+   {
+      //save in SME
+      csrRoamSaveStatsFromTl(pMac, tlStats);
+   }
+#endif
+   if(!pMac->roam.tlStatsReqInfo.timerRunning)
+   {
+      if(pMac->roam.tlStatsReqInfo.periodicity)
+      {
+         //start timer
+         status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, 
+                                pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+         if(!HAL_STATUS_SUCCESS(status))
+         {
+            smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer\n"));
+            return;
+         }
+         pMac->roam.tlStatsReqInfo.timerRunning = TRUE;
+      }
+   }
+}
+
+void csrRoamPeStatsTimerHandler(void *pv)
+{
+   tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv;
+   eHalStatus status;
+   tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac;
+   VOS_STATUS vosStatus;
+   tPmcPowerState powerState;
+
+   pPeStatsReqListEntry->timerRunning = FALSE;
+   if( pPeStatsReqListEntry->timerStopFailed == TRUE )
+   {
+      // If we entered here, meaning the timer could not be successfully 
+      // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here.
+
+      /* Destroy the timer */
+      vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer\n"));
+      }
+
+      // Free the entry
+      palFreeMemory(pMac->hHdd, pPeStatsReqListEntry);
+      pPeStatsReqListEntry = NULL;
+   }
+   else
+   {
+      if(!pPeStatsReqListEntry->rspPending)
+      {
+         status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), 
+                                       pPeStatsReqListEntry->staId);
+         if(!HAL_STATUS_SUCCESS(status))
+         {
+            smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to send down stats req to PE\n"));
+         }
+         else
+         {
+            pPeStatsReqListEntry->rspPending = TRUE;
+         }
+      }
+
+      //send down a req
+      if(pPeStatsReqListEntry->periodicity && 
+         (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer)))
+      {
+         pmcQueryPowerState(pMac, &powerState, NULL, NULL);
+         if(ePMC_FULL_POWER == powerState)
+         {
+            if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity)
+            {
+               pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity;
+            }
+         }
+         else
+         {
+            if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS)
+            {
+               pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS;
+            }
+         }
+         //start timer
+         vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity );
+         if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+         {
+            smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer\n"));
+            return;
+         }
+
+         pPeStatsReqListEntry->timerRunning = TRUE;
+
+      }
+
+   }
+}
+
+void csrRoamStatsClientTimerHandler(void *pv)
+{
+   tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv;
+
+   if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer))
+   {
+#if 0
+       // TODO Stats fix for multisession
+       //start the timer
+       vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity );
+   
+       if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+       {
+          smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n"));
+
+       }
+#endif       
+   }
+#if 0
+   //send up the stats report
+   csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, 
+                           pStaEntry->staId, pStaEntry->pContext);
+#endif
+}
+
+
+
+
+eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId)
+{
+   tAniGetPEStatsReq *pMsg;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq));
+   if ( !HAL_STATUS_SUCCESS(status) ) 
+   {
+      smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req \n");
+      return status;
+   }
+   // need to initiate a stats request to PE
+   pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ);
+   pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq);
+   pMsg->staId = staId;
+   pMsg->statsMask = statsMask;
+
+   status = palSendMBMessage(pMac->hHdd, pMsg );    
+
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req \n");
+   }
+
+   return status;
+}
+
+void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg)
+{
+   tAniGetPEStatsRsp *pSmeStatsRsp;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tListElem *pEntry = NULL;
+   tCsrStatsClientReqInfo *pTempStaEntry = NULL;
+   tCsrPeStatsReqInfo *pPeStaEntry = NULL;
+   tANI_U32  tempMask = 0;
+   tANI_U8 counter = 0;
+   tANI_U8 *pStats = NULL;
+   tANI_U32   length = 0;
+   v_PVOID_t  pvosGCtx;
+   v_S7_t     rssi = 0;
+   tANI_U32   *pRssi = NULL;
+
+   pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg;
+   if(pSmeStatsRsp->rc)
+   {
+      smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure\n"));
+      goto post_update;
+   }
+
+   tempMask = pSmeStatsRsp->statsMask;
+   pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask);
+
+   /* subtract all statistics from this length, and after processing the entire 
+    * 'stat' part of the message, if the length is not zero, then rssi is piggy packed 
+    * in this 'stats' message.
+    */
+   length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp);
+
+   //new stats info from PE, fill up the stats strucutres in PMAC
+   while(tempMask)
+   {
+      if(tempMask & 1)
+      {
+         switch(counter)
+         {
+         case eCsrSummaryStats:
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:summary stats\n"));
+            status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, 
+                                   pStats, sizeof(tCsrSummaryStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats\n"));
+            }
+            pStats += sizeof(tCsrSummaryStatsInfo);
+            length -= sizeof(tCsrSummaryStatsInfo);
+            break;
+
+         case eCsrGlobalClassAStats:
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassA stats\n"));
+            status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, 
+                                   pStats, sizeof(tCsrGlobalClassAStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassAStatsInfo);
+            length -= sizeof(tCsrGlobalClassAStatsInfo);
+            break;
+
+         case eCsrGlobalClassBStats:
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassB stats\n"));
+            status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, 
+                                   pStats, sizeof(tCsrGlobalClassBStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassBStatsInfo);
+            length -= sizeof(tCsrGlobalClassBStatsInfo);
+            break;
+
+         case eCsrGlobalClassCStats:
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassC stats\n"));
+            status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, 
+                                   pStats, sizeof(tCsrGlobalClassCStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassCStatsInfo);
+            length -= sizeof(tCsrGlobalClassCStatsInfo);
+            break;
+
+         case eCsrPerStaStats:
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:PerSta stats\n"));
+            if( CSR_MAX_STA > pSmeStatsRsp->staId )
+            {
+               status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], 
+                                      pStats, sizeof(tCsrPerStaStatsInfo));
+            }
+            else
+            {
+               status = eHAL_STATUS_FAILURE;
+               smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d\n"), pSmeStatsRsp->staId);
+               VOS_ASSERT( 0 );
+            }
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats\n"));
+            }
+            pStats += sizeof(tCsrPerStaStatsInfo);
+            length -= sizeof(tCsrPerStaStatsInfo);
+            break;
+
+         default:
+            smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type\n"));
+            break;
+
+         }
+      }
+
+      tempMask >>=1;
+      counter++;
+   }
+   pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac);
+   if (length != 0)
+   {
+       pRssi = (tANI_U32*)pStats;
+       rssi = (v_S7_t)*pRssi;
+   }
+   else
+   {
+       /* If riva is not sending rssi, continue to use the hack */
+       rssi = RSSI_HACK_BMPS;
+   }
+   WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi);
+
+post_update:   
+   //make sure to update the pe stats req list 
+   pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask);
+   if(pEntry)
+      {
+      pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link );
+      pPeStaEntry->rspPending = FALSE;
+   
+   }
+   //check the one timer cases
+   pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask);
+   if(pEntry)
+   {
+
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
+      if(pTempStaEntry->timerExpired)
+      {
+         //send up the stats report
+         csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, 
+                                 pTempStaEntry->staId, pTempStaEntry->pContext);
+         //also remove from the client list
+         csrRoamRemoveStatListEntry(pMac, pEntry);
+         pTempStaEntry = NULL;
+
+      }
+   }
+
+}
+
+tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask)
+{
+   tListElem *pEntry = NULL;
+   tCsrPeStatsReqInfo *pTempStaEntry = NULL;
+
+   pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK );
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: List empty, no request to PE\n");
+      return NULL;
+   }
+
+   while( pEntry )
+   {
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link );
+
+      if(pTempStaEntry->statsMask == statsMask)
+      {
+         smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: match found\n");
+         break;
+      }
+
+      pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK );
+   }
+
+   return pEntry;
+}
+
+
+tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry,
+                                             tANI_BOOLEAN update)
+{
+   tListElem *pEntry;
+   tCsrStatsClientReqInfo *pTempStaEntry;
+
+   pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: List empty, no request from "
+             "upper layer client(s)\n");
+      return NULL;
+   }
+
+   while( pEntry )
+   {
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
+      if((pTempStaEntry->requesterId == pStaEntry->requesterId) && 
+         (pTempStaEntry->statsMask == pStaEntry->statsMask))
+      {
+         smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: match found\n");
+         if(update)
+         {
+         pTempStaEntry->periodicity = pStaEntry->periodicity;
+         pTempStaEntry->callback = pStaEntry->callback;
+         pTempStaEntry->pContext = pStaEntry->pContext;
+         }
+         break;
+      }
+
+      pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
+   }
+
+   return pEntry;
+}
+
+tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask)
+{
+   tListElem *pEntry;
+   tCsrStatsClientReqInfo *pTempStaEntry;
+
+   pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, "csrRoamCheckClientReqList: List empty, no request from "
+             "upper layer client(s)\n");
+      return NULL;
+   }
+
+   while( pEntry )
+   {
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
+      if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats))  == statsMask)
+      {
+         smsLog(pMac, LOGW, "csrRoamCheckClientReqList: match found\n");
+
+         break;
+      }
+
+      pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
+   }
+
+   return pEntry;
+}
+
+
+eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac,
+                                                 csrRoamLinkQualityIndCallback   callback,  
+                                                 void                           *pContext)
+{
+   pMac->roam.linkQualityIndInfo.callback = callback;
+   pMac->roam.linkQualityIndInfo.context = pContext;
+   if( NULL == callback )
+   {
+     smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered");
+   }
+   else
+   {
+     smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered");
+
+     /* do we need to invoke the callback to notify client of initial value ??  */
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+
+void csrRoamVccTrigger(tpAniSirGlobal pMac)
+{
+   eCsrRoamLinkQualityInd newVccLinkQuality;
+   tANI_U32 ul_mac_loss = 0;
+   tANI_U32 ul_mac_loss_trigger_threshold;
+
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+   /*-------------------------------------------------------------------------
+     Link quality is currently binary based on OBIWAN recommended triggers
+
+     Check for a change in link quality and notify client if necessary
+   -------------------------------------------------------------------------*/
+   ul_mac_loss_trigger_threshold = 
+      pMac->roam.configParam.vccUlMacLossThreshold;
+
+   VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 );
+
+   smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d\n", 
+          ul_mac_loss_trigger_threshold );
+
+   if(ul_mac_loss_trigger_threshold < ul_mac_loss)
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR \n");
+      newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
+   }
+   else
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD\n");
+      newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND;
+   }
+
+   smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ",
+          ul_mac_loss);
+
+   if(newVccLinkQuality != pMac->roam.vccLinkQuality)
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary\n");
+      if(NULL != pMac->roam.linkQualityIndInfo.callback) 
+      {
+         smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d\n",
+                newVccLinkQuality );
+         
+         /* we now invoke the callback once to notify client of initial value   */
+         pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, 
+                                                 pMac->roam.linkQualityIndInfo.context );
+         //event: EVENT_WLAN_VCC
+      }
+   }
+
+   pMac->roam.vccLinkQuality = newVccLinkQuality;
+
+
+}
+
+VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, 
+                                            v_U8_t  rssiNotification, 
+                                            void * context)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( context );
+   eCsrRoamLinkQualityInd newVccLinkQuality;
+        // TODO : Session info unavailable
+        tANI_U32 sessionId = 0;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   /*-------------------------------------------------------------------------
+     Link quality is currently binary based on OBIWAN recommended triggers
+
+     Check for a change in link quality and notify client if necessary
+   -------------------------------------------------------------------------*/
+   smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d\n", 
+          pMac->roam.configParam.vccRssiThreshold);
+   if(!csrIsConnStateConnectedInfra(pMac, sessionId))
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected\n");
+      return VOS_STATUS_SUCCESS;
+   }
+
+   if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification)
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR\n");
+      newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
+   }
+   else if(WLANTL_HO_THRESHOLD_UP == rssiNotification)
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD \n");
+      newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND;
+   }
+   else
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d\n", rssiNotification);
+      //Set to this so the code below won't do anything
+      newVccLinkQuality = pMac->roam.vccLinkQuality;    
+
+      VOS_ASSERT(0);
+   }
+
+
+   if(newVccLinkQuality != pMac->roam.vccLinkQuality)
+   {
+      smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary\n");
+      if(NULL != pMac->roam.linkQualityIndInfo.callback) 
+      {
+         smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d\n",
+                newVccLinkQuality);
+
+        /* we now invoke the callback once to notify client of initial value   */
+        pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, 
+                                                pMac->roam.linkQualityIndInfo.context );
+         //event: EVENT_WLAN_VCC
+      }
+   }
+
+   pMac->roam.vccLinkQuality = newVccLinkQuality;
+
+   return status;
+}
+
+
+tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac,
+                                                     tDblLinkList *pStaList,
+                                                     tCsrStatsClientReqInfo *pStaEntry)
+{
+   tCsrStatsClientReqInfo *pNewStaEntry = NULL;
+
+   eHalStatus  status;
+
+   //if same entity requested for same set of stats with different periodicity & 
+   // callback update it
+   if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE))
+   {
+   
+      status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo));
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the "
+                "entry\n");
+         return NULL;
+      }
+   
+
+      pNewStaEntry->callback = pStaEntry->callback;
+      pNewStaEntry->pContext = pStaEntry->pContext;
+      pNewStaEntry->periodicity = pStaEntry->periodicity;
+      pNewStaEntry->requesterId = pStaEntry->requesterId;
+      pNewStaEntry->statsMask = pStaEntry->statsMask;
+      pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry;
+      pNewStaEntry->pMac = pStaEntry->pMac;
+      pNewStaEntry->staId = pStaEntry->staId;
+      pNewStaEntry->timerExpired = pStaEntry->timerExpired;
+      
+      csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK  );
+   }
+   return pNewStaEntry;
+}
+
+
+tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac,
+                                                           tDblLinkList *pStaList,
+                                                           tCsrPeStatsReqInfo *pStaEntry)
+{
+   tCsrPeStatsReqInfo *pNewStaEntry = NULL;
+
+   eHalStatus  status;
+
+   status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo));
+   if (!HAL_STATUS_SUCCESS(status))
+   {
+      smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the "
+                  "entry\n");
+      return NULL;
+   }
+   
+
+   pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer;
+   pNewStaEntry->numClient = pStaEntry->numClient;
+   pNewStaEntry->periodicity = pStaEntry->periodicity;
+   pNewStaEntry->statsMask = pStaEntry->statsMask;
+   pNewStaEntry->pMac = pStaEntry->pMac;
+   pNewStaEntry->staId = pStaEntry->staId;
+   pNewStaEntry->timerRunning = pStaEntry->timerRunning;
+   pNewStaEntry->rspPending = pStaEntry->rspPending;
+   
+   csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK  );
+
+   return pNewStaEntry;
+}
+
+
+eHalStatus csrGetRssi(tpAniSirGlobal pMac, 
+                            tCsrRssiCallback callback, 
+                            tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext)
+{  
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   vos_msg_t  msg;
+   tANI_U32 sessionId;
+
+   tAniGetRssiReq *pMsg;
+   smsLog(pMac, LOG2, FL("called"));      
+   status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq));
+   if ( !HAL_STATUS_SUCCESS(status) ) 
+   {
+      smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req \n");
+      return status;
+   }
+
+   csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId);
+
+   pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ);
+   pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq);
+   pMsg->sessionId = sessionId;
+   pMsg->staId = staId;
+   pMsg->rssiCallback = callback;
+   pMsg->pDevContext = pContext;
+   pMsg->pVosContext = pVosContext;
+
+   msg.type = eWNI_SME_GET_RSSI_REQ;
+   msg.bodyptr = pMsg;
+   msg.reserved = 0;
+
+   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
+   {
+       smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self \n");   
+       palFreeMemory(pMac->hHdd, (void *)pMsg);
+       status = eHAL_STATUS_FAILURE;
+   }
+   smsLog(pMac, LOG2, FL("returned"));      
+   return status;
+}
+
+eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, 
+                            tANI_U32 statsMask, 
+                            tCsrStatsCallback callback, 
+                            tANI_U32 periodicity, tANI_BOOLEAN cache, 
+                            tANI_U8 staId, void *pContext)
+{  
+   tCsrStatsClientReqInfo staEntry;
+   tCsrStatsClientReqInfo *pStaEntry = NULL;
+   tCsrPeStatsReqInfo *pPeStaEntry = NULL; 
+   tListElem *pEntry = NULL;
+   tANI_BOOLEAN found = FALSE;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tANI_BOOLEAN insertInClientList = FALSE;
+   VOS_STATUS vosStatus;
+
+   if( csrIsAllSessionDisconnected(pMac) )
+   {
+      //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected\n", pMac->roam.curState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   if((!statsMask) && (!callback))
+   {
+      //msg
+      smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   //for the search list method for deregister
+   staEntry.requesterId = requesterId;
+   staEntry.statsMask = statsMask;
+   //requester wants to deregister or just an error
+   if((statsMask) && (!callback))
+   {
+      pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE);
+      if(!pEntry)
+      {
+         //msg
+         smsLog(pMac, LOGW, "csrGetStatistics: callback is empty in the request & couldn't "
+                "find any existing request in statsClientReqList\n");
+         return eHAL_STATUS_FAILURE;
+      }
+      else
+      {
+         //clean up & return
+         pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+         pStaEntry->pPeStaEntry->numClient--;
+         //check if we need to delete the entry from peStatsReqList too
+         if(!pStaEntry->pPeStaEntry->numClient)
+         {
+            csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry);
+         }
+         //check if we need to stop the tl stats timer too 
+         pMac->roam.tlStatsReqInfo.numClient--;
+         if(!pMac->roam.tlStatsReqInfo.numClient)
+         {
+            if(pMac->roam.tlStatsReqInfo.timerRunning)
+            {
+               status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
+               if(!HAL_STATUS_SUCCESS(status))
+               {
+                  smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer\n"));
+                  return eHAL_STATUS_FAILURE;
+               }
+            }
+            pMac->roam.tlStatsReqInfo.periodicity = 0;
+            pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
+         }
+         vos_timer_stop( &pStaEntry->timer );
+
+         // Destroy the vos timer...      
+         vosStatus = vos_timer_destroy( &pStaEntry->timer );
+         if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+         {
+            smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer\n"));
+         }
+
+         csrRoamRemoveStatListEntry(pMac, pEntry);
+         pStaEntry = NULL;
+         return eHAL_STATUS_SUCCESS;
+      }
+   }
+   
+   if(cache && !periodicity)
+   {
+      //return the cached stats
+      csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext);
+   }
+   else
+   {
+      //add the request in the client req list
+      staEntry.callback = callback;
+      staEntry.pContext = pContext;
+      staEntry.periodicity = periodicity;
+      staEntry.pPeStaEntry = NULL;
+      staEntry.staId = staId;
+      staEntry.pMac = pMac;
+      staEntry.timerExpired = FALSE;
+   
+   
+
+      //if periodic report requested with non cached result from PE/TL
+      if(periodicity)
+      {
+      
+         //if looking for stats from PE
+         if(statsMask & ~(1 << eCsrGlobalClassDStats))
+         {
+         
+            //check if same request made already & waiting for rsp
+            pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), 
+                                               periodicity, &found, staId);
+            if(!pPeStaEntry)
+            {
+               //bail out, maxed out on number of req for PE
+               return eHAL_STATUS_FAILURE;
+            }
+            else
+            {
+               staEntry.pPeStaEntry = pPeStaEntry;
+            }
+               
+         }
+         //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed
+         if(statsMask & (1 << eCsrGlobalClassDStats))
+         {
+            if(cache && pMac->roam.tlStatsReqInfo.numClient)
+            {
+               smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL\n"));
+            }
+            else
+            {
+            
+               //update periodicity
+               if(pMac->roam.tlStatsReqInfo.periodicity)
+               {
+                  pMac->roam.tlStatsReqInfo.periodicity = 
+                     CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity);
+               }
+               else
+               {
+                  pMac->roam.tlStatsReqInfo.periodicity = periodicity;
+               }
+               if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD)
+               {
+                  pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD;
+               }
+               
+               if(!pMac->roam.tlStatsReqInfo.timerRunning)
+               {
+#if 0
+                                   // TODO Session Specific info connectedInfo
+                  //req TL for class D stats
+                  if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId))
+                  {
+                     smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
+                  }
+                  else
+                  {
+                     //save in SME
+                     csrRoamSaveStatsFromTl(pMac, tlStats);
+                  }
+#endif
+                  if(pMac->roam.tlStatsReqInfo.periodicity)
+                  {
+                     //start timer
+                     status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, 
+                                            pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+                     if(!HAL_STATUS_SUCCESS(status))
+                     {
+                        smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer\n"));
+                        return eHAL_STATUS_FAILURE;
+                     }
+                     pMac->roam.tlStatsReqInfo.timerRunning = TRUE;
+                  }
+               }
+            }
+            pMac->roam.tlStatsReqInfo.numClient++;
+         }
+   
+         insertInClientList = TRUE;
+      }
+      //if one time report requested with non cached result from PE/TL
+      else if(!cache && !periodicity)
+      {
+         if(statsMask & ~(1 << eCsrGlobalClassDStats))
+         {
+            //send down a req
+            status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog(pMac, LOGE, FL("csrGetStatistics:failed to send down stats req to PE\n"));
+            }
+            //so that when the stats rsp comes back from PE we respond to upper layer
+            //right away
+            staEntry.timerExpired = TRUE;
+            insertInClientList = TRUE;
+
+         }
+         if(statsMask & (1 << eCsrGlobalClassDStats))
+         {
+#if 0
+                         // TODO : Per Session info connectedInfo
+            //req TL for class D stats
+            if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId))
+            {
+               smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
+            }
+            else
+            {
+               //save in SME
+               csrRoamSaveStatsFromTl(pMac, tlStats);
+            }
+#endif
+
+         }
+         //if looking for stats from TL only 
+         if(!insertInClientList)
+         {
+            //return the stats
+            csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext);
+         }
+
+      }
+
+      if(insertInClientList)
+      {
+         pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); 
+         if(!pStaEntry)
+         {
+            //msg
+            smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList\n");
+            return eHAL_STATUS_FAILURE;
+         }
+         //Init & start timer if needed
+         if(periodicity)
+         {
+            vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, 
+                                        csrRoamStatsClientTimerHandler, pStaEntry );
+            if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+            {
+               smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer\n"));
+               return eHAL_STATUS_FAILURE;
+            }
+            vosStatus = vos_timer_start( &pStaEntry->timer, periodicity );
+            if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+            {
+               smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n"));
+               return eHAL_STATUS_FAILURE;
+            }
+
+         }
+
+      }
+
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask, 
+                                                tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId)
+{
+   tANI_BOOLEAN found = FALSE;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tCsrPeStatsReqInfo staEntry;
+   tCsrPeStatsReqInfo *pTempStaEntry = NULL;
+   tListElem *pStaEntry = NULL;
+   VOS_STATUS vosStatus;
+   tPmcPowerState powerState;
+   *pFound = FALSE;
+      
+   pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask);
+   if(pStaEntry)
+   {
+      pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link );
+      if(pTempStaEntry->periodicity)
+      {
+         pTempStaEntry->periodicity = 
+            CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity);
+      }
+      else
+      {
+         pTempStaEntry->periodicity = periodicity;
+      }
+
+      pTempStaEntry->numClient++;
+         found = TRUE;
+   }
+   else
+   {
+      palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo));
+      staEntry.numClient = 1;
+      staEntry.periodicity = periodicity;
+      staEntry.pMac = pMac;
+      staEntry.rspPending = FALSE;
+      staEntry.staId = staId;
+      staEntry.statsMask = statsMask;
+      staEntry.timerRunning = FALSE;
+      pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); 
+      if(!pTempStaEntry)
+      {
+         //msg
+         smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList\n");
+         return NULL;
+      }
+   }
+
+   pmcQueryPowerState(pMac, &powerState, NULL, NULL);
+   if(ePMC_FULL_POWER == powerState)
+   {
+      if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity)
+      {
+         pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity;
+      }
+   }
+   else
+   {
+      if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS)
+      {
+         pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS;
+      }
+   }
+   if(!pTempStaEntry->timerRunning)
+   {
+      //send down a req in case of one time req, for periodic ones wait for timer to expire
+      if(!pTempStaEntry->rspPending && 
+         !pTempStaEntry->periodicity)
+      {
+         status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId);
+         if(!HAL_STATUS_SUCCESS(status))
+         {
+            smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:failed to send down stats req to PE\n"));
+         }
+         else
+         {
+            pTempStaEntry->rspPending = TRUE;
+         }
+      }
+      if(pTempStaEntry->periodicity)
+      {
+         if(!found)
+         {
+            
+            vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, 
+                                        csrRoamPeStatsTimerHandler, pTempStaEntry );
+            if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+            {
+               smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer\n"));
+               return NULL;
+            }
+
+         }
+         //start timer
+         smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d\n", pTempStaEntry->periodicity);
+
+         vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity );
+         if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+         {
+            smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer\n"));
+            return NULL;
+         }
+         pTempStaEntry->timerRunning = TRUE;
+      }
+   }
+
+   *pFound = found;
+   return pTempStaEntry;
+}
+
+
+/*
+    pStaEntry is no longer invalid upon the return of this function.
+*/
+static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry)
+{
+    if(pEntry)
+    {
+        if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK))
+        {
+            palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ));
+        }
+    }
+}
+
+
+void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry)
+{
+   tListElem *pEntry;
+   tCsrPeStatsReqInfo *pTempStaEntry;
+   VOS_STATUS vosStatus;
+   pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK );
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE\n");
+      return;
+   }
+
+   while( pEntry )
+   {
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link );
+
+      if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask)
+      {
+         smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found\n");
+         if(pTempStaEntry->timerRunning)
+         {
+            vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer );
+            /* If we are not able to stop the timer here, just remove 
+             * the entry from the linked list. Destroy the timer object 
+             * and free the memory in the timer CB
+             */
+            if( vosStatus == VOS_STATUS_SUCCESS )
+            {
+               /* the timer is successfully stopped */
+               pTempStaEntry->timerRunning = FALSE;
+
+               /* Destroy the timer */
+               vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer );
+               if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+               {
+                  smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer\n"));
+               }
+            }
+            else
+            {
+               // the timer could not be stopped. Hence destroy and free the 
+               // memory for the PE stat entry in the timer CB.
+               pTempStaEntry->timerStopFailed = TRUE;
+            }
+         }
+
+         if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK))
+         {
+            // Only free the memory if we could stop the timer successfully
+            if(!pTempStaEntry->timerStopFailed)
+            {
+               palFreeMemory(pMac->hHdd, pTempStaEntry);
+               pTempStaEntry = NULL;
+            }
+            break;
+         }
+
+         pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK );
+      }
+   }
+
+   return;
+}
+
+
+void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE tlStats)
+{
+
+   pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = tlStats.rxBcntCRCok;
+   pMac->roam.classDStatsInfo.rx_bc_byte_cnt = tlStats.rxBCBcnt;
+   pMac->roam.classDStatsInfo.rx_bc_frm_cnt = tlStats.rxBCFcnt;
+   pMac->roam.classDStatsInfo.rx_byte_cnt = tlStats.rxBcnt;
+   pMac->roam.classDStatsInfo.rx_mc_byte_cnt = tlStats.rxMCBcnt;
+   pMac->roam.classDStatsInfo.rx_mc_frm_cnt = tlStats.rxMCFcnt;
+   pMac->roam.classDStatsInfo.rx_rate = tlStats.rxRate;
+   //?? need per AC
+   pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = tlStats.rxUCBcnt;
+   pMac->roam.classDStatsInfo.rx_uc_frm_cnt = tlStats.rxUCFcnt;
+   pMac->roam.classDStatsInfo.tx_bc_byte_cnt = tlStats.txBCBcnt;
+   pMac->roam.classDStatsInfo.tx_bc_frm_cnt = tlStats.txBCFcnt;
+   pMac->roam.classDStatsInfo.tx_mc_byte_cnt = tlStats.txMCBcnt;
+   pMac->roam.classDStatsInfo.tx_mc_frm_cnt = tlStats.txMCFcnt;
+   //?? need per AC
+   pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = tlStats.txUCBcnt;
+   pMac->roam.classDStatsInfo.tx_uc_frm_cnt = tlStats.txUCFcnt;
+
+}
+
+
+void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, 
+                             tCsrStatsCallback callback, tANI_U8 staId, void *pContext)
+{
+   tANI_U8 stats[500];
+   tANI_U8 *pStats = NULL;
+   tANI_U32 tempMask = 0;
+   tANI_U8 counter = 0;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+
+   if(!callback)
+   {
+      smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL\n"));
+      return;
+   }
+   if(!statsMask)
+   {
+      smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0\n"));
+      return;
+   }
+
+   pStats = stats;
+
+   tempMask = statsMask;
+
+   while(tempMask)
+   {
+      if(tempMask & 1)
+      {
+         //new stats info from PE, fill up the stats strucutres in PMAC
+         switch(counter)
+         {
+         case eCsrSummaryStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:summary stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, 
+                                   sizeof(tCsrSummaryStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats\n"));
+            }
+            pStats += sizeof(tCsrSummaryStatsInfo);
+            break;
+
+         case eCsrGlobalClassAStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassA stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, 
+                                   sizeof(tCsrGlobalClassAStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassAStatsInfo);
+
+            break;
+
+         case eCsrGlobalClassBStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassB stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, 
+                                   sizeof(tCsrGlobalClassBStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassBStatsInfo);
+
+            break;
+
+         case eCsrGlobalClassCStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassC stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, 
+                                   sizeof(tCsrGlobalClassCStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassCStatsInfo);
+
+            break;
+
+         case eCsrGlobalClassDStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassD stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, 
+                                   sizeof(tCsrGlobalClassDStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats\n"));
+            }
+            pStats += sizeof(tCsrGlobalClassDStatsInfo);
+
+            break;
+
+         case eCsrPerStaStats:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:PerSta stats\n"));
+            status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], 
+                                   sizeof(tCsrPerStaStatsInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats\n"));
+            }
+            pStats += sizeof(tCsrPerStaStatsInfo);
+
+            break;
+
+         default:
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type\n"));
+            break;
+
+         }
+      }
+
+      tempMask >>=1;
+      counter++;
+   }
+
+   callback(stats, pContext );
+
+}
+
+
+
+eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac)
+{
+   tListElem *pEntry = NULL;
+   tListElem *pPrevEntry = NULL;
+   tCsrStatsClientReqInfo *pTempStaEntry = NULL;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   VOS_STATUS vosStatus;
+   pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from "
+             "upper layer client(s)\n");
+      return status;
+   }
+
+   while( pEntry )
+   {
+      if(pPrevEntry)
+      {
+         pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link );
+         //send up the stats report
+         csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, 
+                                 pTempStaEntry->staId, pTempStaEntry->pContext);
+         csrRoamRemoveStatListEntry(pMac, pPrevEntry);
+      }
+
+      pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
+      if (pTempStaEntry->pPeStaEntry)  //pPeStaEntry can be NULL
+      {
+      pTempStaEntry->pPeStaEntry->numClient--;
+      //check if we need to delete the entry from peStatsReqList too
+      if(!pTempStaEntry->pPeStaEntry->numClient)
+      {
+         csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry);
+      }
+      }
+
+      //check if we need to stop the tl stats timer too 
+      pMac->roam.tlStatsReqInfo.numClient--;
+      if(!pMac->roam.tlStatsReqInfo.numClient)
+      {
+         if(pMac->roam.tlStatsReqInfo.timerRunning)
+         {
+            status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+               smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer\n"));
+               //we will continue
+            }
+         }
+         pMac->roam.tlStatsReqInfo.periodicity = 0;
+         pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
+      }
+
+      if (pTempStaEntry->periodicity)
+      {
+          //While creating StaEntry in csrGetStatistics,
+          //Initializing and starting timer only when periodicity is set. 
+          //So Stop and Destroy timer only when periodicity is set.
+          
+
+      vos_timer_stop( &pTempStaEntry->timer );
+
+      // Destroy the vos timer...      
+      vosStatus = vos_timer_destroy( &pTempStaEntry->timer );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer\n"));
+      }
+      }
+
+      
+      pPrevEntry = pEntry;
+      pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
+   }
+   //the last one
+   if(pPrevEntry)
+   {
+      pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link );
+      //send up the stats report
+      csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, 
+                                 pTempStaEntry->staId, pTempStaEntry->pContext);
+      csrRoamRemoveStatListEntry(pMac, pPrevEntry);
+   }
+
+   return status;
+   
+}
+
+
+eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, 
+                                   tRequestFullPowerReason *pReason,
+                                   tANI_BOOLEAN *pfNeedPower )
+{
+    tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE;
+    tRequestFullPowerReason reason = eSME_REASON_OTHER;
+    tPmcState pmcState;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+        // TODO : Session info unavailable
+        tANI_U32 sessionId = 0;
+
+    if( pfNeedPower )
+    {
+        *pfNeedPower = eANI_BOOLEAN_FALSE;
+    }
+        //We only handle CSR commands
+        if( !(eSmeCsrCommandMask & pCommand->command) )
+        {
+                return eHAL_STATUS_SUCCESS;
+        }
+
+    //Check PMC state first
+    pmcState = pmcGetPmcState( pMac );
+
+    switch( pmcState )
+    {
+    case REQUEST_IMPS:
+    case IMPS:
+        if( eSmeCommandScan == pCommand->command )
+        {
+            switch( pCommand->u.scanCmd.reason )
+            {
+            case eCsrScanGetResult:
+            case eCsrScanBGScanAbort:
+            case eCsrScanBGScanEnable:
+            case eCsrScanGetScanChnInfo:
+                //Internal process, no need for full power
+                fNeedFullPower = eANI_BOOLEAN_FALSE;
+                break;
+
+            default:
+                //Other scans are real scan, ask for power
+                fNeedFullPower = eANI_BOOLEAN_TRUE;
+                break;
+            } //switch
+        }
+        else
+        {
+            //ask for power for roam and status change
+            fNeedFullPower = eANI_BOOLEAN_TRUE;
+        }
+        break;
+
+    case REQUEST_BMPS:
+    case BMPS:
+    case REQUEST_START_UAPSD:
+    case UAPSD:
+    //We treat WOWL same as BMPS
+    case REQUEST_ENTER_WOWL:
+    case WOWL:
+        if( eSmeCommandRoam == pCommand->command )
+        {
+            tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList;
+            tCsrScanResult *pScanResult;
+            tListElem *pEntry;
+
+            switch ( pCommand->u.roamCmd.roamReason )
+            {
+            case eCsrForcedDisassoc:
+            case eCsrForcedDisassocMICFailure:
+                reason = eSME_LINK_DISCONNECTED_BY_HDD;
+                fNeedFullPower = eANI_BOOLEAN_TRUE;
+                break;
+                case eCsrSmeIssuedDisassocForHandoff:
+            case eCsrForcedDeauth:
+            case eCsrHddIssuedReassocToSameAP:
+            case eCsrSmeIssuedReassocToSameAP:
+                fNeedFullPower = eANI_BOOLEAN_TRUE;
+                break;
+
+            case eCsrCapsChange:
+                fNeedFullPower = eANI_BOOLEAN_TRUE;
+                break;
+
+            default:
+                //Check whether the profile is already connected. If so, no need for full power
+                //Note: IBSS is ignored for now because we don't support powersave in IBSS
+                if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList )
+                {
+                    //Only need to check the first one
+                    pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK);
+                    if( pEntry )
+                    {
+                        pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link);
+#if 0
+                                                // TODO : Session Specific info pConnectBssDesc
+                        if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) &&
+                            csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, 
+                                            &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) )
+                        {
+                            // Check to see if the Auth type has changed in the Profile.  If so, we don't want to Reassociate
+                            // with Authenticating first.  To force this, stop the current association (Disassociate) and 
+                            // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by 
+                            // a new Association.
+                            if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile))
+                            {
+                                if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile))
+                                {
+                                    //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange;
+                                    //No need for full power
+                                    //Set the flag so the code later can avoid to do the above
+                                    //check again.
+                                    pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE;
+                                    break;
+                                }
+                            }
+                        }
+#endif
+                    }
+                }
+                //If we are here, full power is needed
+                fNeedFullPower = eANI_BOOLEAN_TRUE;
+                break;
+            }
+        }
+        else if( eSmeCommandWmStatusChange == pCommand->command )
+        {
+            //need full power for all
+            fNeedFullPower = eANI_BOOLEAN_TRUE;
+            reason = eSME_LINK_DISCONNECTED_BY_OTHER;
+        }
+        break;
+
+    case REQUEST_STOP_UAPSD:
+    case REQUEST_EXIT_WOWL:
+        if( eSmeCommandRoam == pCommand->command )
+        {
+            fNeedFullPower = eANI_BOOLEAN_TRUE;
+            switch ( pCommand->u.roamCmd.roamReason )
+            {
+                case eCsrForcedDisassoc:
+                case eCsrForcedDisassocMICFailure:
+                    reason = eSME_LINK_DISCONNECTED_BY_HDD;
+                    break;
+                default:
+                    break;
+            }
+                }
+        break;
+
+    case STOPPED:
+    case REQUEST_STANDBY:
+    case STANDBY:
+    case LOW_POWER:
+        //We are not supposed to do anything
+        smsLog( pMac, LOGE, FL( "  cannot process because PMC is in stopped/standby state %d\n" ), pmcState );
+        status = eHAL_STATUS_FAILURE;
+        break;
+
+    case FULL_POWER:
+    case REQUEST_FULL_POWER:
+    default:
+        //No need to ask for full power. This has to be FULL_POWER state
+        break;
+
+    } //switch
+
+    if( pReason )
+    {
+        *pReason = reason;
+    }
+    if( pfNeedPower )
+    {
+        *pfNeedPower = fNeedFullPower;
+    }
+
+    return ( status );
+}
+
+
+static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE;
+    tRequestFullPowerReason reason = eSME_REASON_OTHER;
+
+    status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower );
+
+    if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) )
+    {
+        status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason);
+    }
+
+    return ( status );
+}
+
+
+tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac )
+{
+    tSmeCmd *pCmd = smeGetCommandBuffer( pMac );
+
+    if( pCmd )
+    {
+        pMac->roam.sPendingCommands++;
+    }
+
+    return ( pCmd );
+}
+
+
+void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+   if (pMac->roam.sPendingCommands > 0)
+   {
+       //All command allocated through csrGetCommandBuffer need to
+       //decrement the pending count when releasing.
+       pMac->roam.sPendingCommands--;
+       smeReleaseCommand( pMac, pCommand );
+   }
+   else
+   {
+       smsLog(pMac, LOGE, FL( "no pending commands"));
+       VOS_ASSERT(0);
+   }
+}
+
+
+//Return SUCCESS is the command is queued, failed
+eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority )
+{
+    eHalStatus status;
+
+    if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd )
+    {
+        smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"),
+           pCommand->u.scanCmd.reason);
+        return eHAL_STATUS_CSR_WRONG_STATE;
+    }
+
+    //We can call request full power first before putting the command into pending Q
+    //because we are holding SME lock at this point.
+    status = csrRequestFullPower( pMac, pCommand );
+    if( HAL_STATUS_SUCCESS( status ) )
+    {
+        tANI_BOOLEAN fNoCmdPending;
+
+        //make sure roamCmdPendingList is not empty first
+        fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE );
+        if( fNoCmdPending )
+        {
+            smePushCommand( pMac, pCommand, fHighPriority );
+        }
+        else
+        {
+             //Other commands are waiting for PMC callback, queue the new command to the pending Q
+            //no list lock is needed since SME lock is held
+            if( !fHighPriority )
+            {
+                csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE );
+            }
+            else {
+                csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE );
+            }
+       }
+    }
+    else if( eHAL_STATUS_PMC_PENDING == status )
+    {
+        //no list lock is needed since SME lock is held
+        if( !fHighPriority )
+        {
+            csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE );
+        }
+        else {
+            csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE );
+        }
+        //Let caller know the command is queue
+        status = eHAL_STATUS_SUCCESS;
+    }
+    else
+    {
+        //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it 
+        //release the command.
+        smsLog( pMac, LOGE, FL( "  cannot queue command %d\n" ), pCommand->command );
+    }
+
+    return ( status );
+
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirUpdateAPWPSIEsReq *pMsg;
+    tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
+    
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    if (NULL == pSession)
+    {
+        smsLog( pMac, LOGE, FL( "  Session does not exist for session id %d" ), sessionId);
+        return eHAL_STATUS_FAILURE;
+    }
+
+
+    do
+    {
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) );
+        if (!HAL_STATUS_SUCCESS(status)) break;
+        palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) );
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ);
+
+        pBuf = (tANI_U8 *)&pMsg->transactionId;
+        wTmpBuf = pBuf;
+
+        // transactionId
+        *pBuf = 0;
+        *( pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+
+        // bssId
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+
+        //sessionId
+        *pBuf++ = (tANI_U8)sessionId;
+
+        // APWPSIEs
+        palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs));
+        pBuf += sizeof(tSirAPWPSIEs);
+
+        pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32) + (pBuf - wTmpBuf))); //msg_header + msg
+
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+
+    } while( 0 );
+
+    return ( status );
+}
+
+eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirUpdateAPWPARSNIEsReq *pMsg;
+    tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
+
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    if (NULL == pSession)
+    {
+        smsLog( pMac, LOGE, FL( "  Session does not exist for session id %d" ), sessionId);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    do
+    {
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) );
+        if (!HAL_STATUS_SUCCESS(status)) break;
+        palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) );
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_APWPARSNIEs_REQ);
+
+        pBuf = (tANI_U8 *)&pMsg->transactionId;
+        wTmpBuf = pBuf;
+
+        // transactionId
+        *pBuf = 0;
+        *( pBuf + 1 ) = 0;
+        pBuf += sizeof(tANI_U16);
+ 
+        // bssId
+        palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
+        pBuf += sizeof(tSirMacAddr);
+
+        // sessionId
+        *pBuf++ = (tANI_U8)sessionId;
+    
+        // APWPARSNIEs
+        palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie));
+        pBuf += sizeof(tSirRSNie);
+
+        pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf))); //msg_header + msg
+
+    status = palSendMBMessage(pMac->hHdd, pMsg);
+
+    } while( 0 );
+
+    return ( status );
+}
+
+#endif //#ifdef WLAN_SOFTAP_FEATURE
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+//eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId)
+eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tpSirFTPreAuthReq pftPreAuthReq;
+    tANI_U16 auth_req_len = 0;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    auth_req_len = sizeof(tSirFTPreAuthReq);
+    pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len);
+    if (pftPreAuthReq == NULL)
+    {
+        smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed"));
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    // Save the SME Session ID here. We need it while processing the preauth response
+    pMac->ft.ftSmeContext.smeSessionId = sessionId;
+
+    vos_mem_zero(pftPreAuthReq, auth_req_len);
+
+    pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc(
+            sizeof(pBssDescription->length) + pBssDescription->length);
+
+    pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ);
+
+    pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId;
+
+
+    palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
+
+    palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr));  
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (csrRoamIs11rAssoc(pMac))
+    {
+        pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length;
+        palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, 
+                                pMac->ft.ftSmeContext.auth_ft_ies_length);
+    }
+    else
+#endif
+    {
+        pftPreAuthReq->ft_ies_length = 0; 
+    }
+
+    vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, pBssDescription->length);
+
+    pftPreAuthReq->length = pal_cpu_to_be16(sizeof(tSirFTPreAuthReq) + sizeof(pBssDescription->length) +
+                                                    pBssDescription->length); 
+
+    return palSendMBMessage(pMac->hHdd, pftPreAuthReq);
+}
+
+/*--------------------------------------------------------------------------
+ * This will receive and process the FT Pre Auth Rsp from the current 
+ * associated ap. 
+ * 
+ * This will invoke the hdd call back. This is so that hdd can now
+ * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant.
+  ------------------------------------------------------------------------*/
+void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+    smsLog( pMac, LOGE, FL("Preauth response status code %d"), pFTPreAuthRsp->status); 
+#endif
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING    
+    csrNeighborRoamPreauthRspHandler(pMac, (VOS_STATUS)pFTPreAuthRsp->status);
+#endif
+
+    /* The below function calls/timers should be invoked only if the pre-auth is successful */
+    if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status)
+        return;
+
+    // Implies a success
+    pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE;
+
+    // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs
+    pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp;
+    sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL);
+
+    /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, 
+     * actual transition from the current to handoff AP is triggered */
+    status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer,
+                                                            60 * PAL_TIMER_TO_MS_UNIT,
+                                                            eANI_BOOLEAN_FALSE);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d\n"), status);
+        return;
+    }
+
+    // Save the received response
+    palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid));
+    if (csrRoamIs11rAssoc(pMac))
+       csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, 
+                        eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE);
+
+    // Currently we dont do anything special for CCX connection.
+    
+
+    // Done with it, init it.
+    pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;
+}
+#endif
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+void csrRoamJoinRetryTimerHandler(void *pv)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    tANI_U32 sessionId = pInfo->sessionId;
+    tCsrRoamSession *pSession;
+    
+    if( CSR_IS_SESSION_VALID(pMac, sessionId) )
+    {
+        smsLog( pMac, LOGE, FL( "  retrying the last roam profile on session %d\n" ), sessionId );
+        pSession = CSR_GET_SESSION( pMac, sessionId );
+        if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId))
+        {
+            if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) )
+            {
+               smsLog( pMac, LOGE, FL( "  fail to retry the last roam profile\n" ) );
+            }
+        }
+    }
+}
+
+eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    
+    if(pSession->pCurRoamProfile && pSession->maxRetryCount)
+    {
+        smsLog(pMac, LOGE, FL(" call sessionId %d retry count %d left\n "), sessionId, pSession->maxRetryCount);
+        pSession->maxRetryCount--;
+        pSession->joinRetryTimerInfo.pMac = pMac;
+        pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId;
+        status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL(" fail to start timer status %s \n "), status);
+        }
+    }
+    else
+    {
+        smsLog(pMac, LOGE, FL(" not to start timer due to no profile or reach mac ret (%d)\n "), 
+               pSession->maxRetryCount);
+    }
+    
+    return (status);
+}
+
+eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer \n ");
+    if( CSR_IS_SESSION_VALID(pMac, sessionId) )
+    {
+        return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry));
+    }
+    
+    return eHAL_STATUS_SUCCESS;
+}
+#endif
+
+
+/*
+  pBuf points to the beginning of the message
+  LIM packs disassoc rsp as below,
+      messageType - 2 bytes
+      messageLength - 2 bytes
+      sessionId - 1 byte
+      transactionId - 2 bytes (tANI_U16)
+      reasonCode - 4 bytes (sizeof(tSirResultCodes))
+      peerMacAddr - 6 bytes
+      The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used
+*/
+static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp)
+{
+   if(pBuf && pRsp)
+   {
+      pBuf += 4; //skip type and length
+      pRsp->sessionId  = *pBuf++;
+      pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId );
+      pBuf += 2;
+      pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode );
+      pBuf += 4;
+      vos_mem_copy(pRsp->peerMacAddr, pBuf, 6);
+   }
+}
+
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
new file mode 100644
index 0000000..3241cb4
--- /dev/null
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -0,0 +1,6477 @@
+/*
+ * 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 csrApiScan.c
+  
+    Implementation for the Common Scan interfaces.
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated 
+   ========================================================================== */
+
+#include "aniGlobal.h"
+
+#include "palApi.h"
+#include "csrInsideApi.h"
+#include "smeInside.h"
+#include "smsDebug.h"
+
+#include "csrSupport.h"
+#include "wlan_qct_tl.h"
+
+#include "vos_diag_core_log.h"
+#include "vos_diag_core_event.h"
+
+#include "vos_nvitem.h"
+#include "wlan_qct_wda.h"
+                                                                     
+#define CSR_VALIDATE_LIST  //This portion of code need to be removed once the issue is resolved.
+
+#ifdef CSR_VALIDATE_LIST
+tDblLinkList *g_pchannelPowerInfoList24 = NULL, * g_pchannelPowerInfoList5 = NULL;
+tpAniSirGlobal g_pMac = NULL;
+#endif
+
+/* Purpose of HIDDEN_TIMER 
+** When we remove hidden ssid from the profile i.e., forget the SSID via GUI that SSID shouldn't see in the profile
+** For above requirement we used timer limit, logic is explained below
+** Timer value is initialsed to current time  when it receives corresponding probe response of hidden SSID (The probe request is
+** received regularly till SSID in the profile. Once it is removed from profile probe request is not sent.) when we receive probe response
+** for broadcast probe request, during update SSID with saved SSID we will diff current time with saved SSID time if it is greater than 1 min
+** then we are not updating with old one
+*/
+                                                                     
+#define HIDDEN_TIMER (1*60*1000)                                                                     
+#define CSR_SCAN_RESULT_RSSI_WEIGHT     80 // must be less than 100, represent the persentage of new RSSI
+                                                                     
+/*---------------------------------------------------------------------------
+  PER filter constant fraction: it is a %
+---------------------------------------------------------------------------*/  
+#define CSR_SCAN_PER_FILTER_FRAC 100
+                                                                     
+/*---------------------------------------------------------------------------
+  RSSI filter constant fraction: it is a %
+---------------------------------------------------------------------------*/  
+#define CSR_SCAN_RSSI_FILTER_FRAC 100
+
+/*---------------------------------------------------------------------------
+Convert RSSI into overall score: Since RSSI is in -dBm values, and the 
+overall needs to be weighted inversely (where greater value means better
+system), we convert.
+RSSI *cannot* be more than 0xFF or less than 0 for meaningful WLAN operation
+---------------------------------------------------------------------------*/
+#define CSR_SCAN_MAX_SCORE_VAL 0xFF
+#define CSR_SCAN_MIN_SCORE_VAL 0x0
+#define CSR_SCAN_HANDOFF_DELTA 10
+#define CSR_SCAN_OVERALL_SCORE( rssi ) \
+  ( rssi < CSR_SCAN_MAX_SCORE_VAL )\
+   ? (CSR_SCAN_MAX_SCORE_VAL-rssi) : CSR_SCAN_MIN_SCORE_VAL
+                                                                     
+
+#define CSR_SCAN_IS_OVER_BSS_LIMIT(pMac)  \
+   ( (pMac)->scan.nBssLimit <= (csrLLCount(&(pMac)->scan.scanResultList)) )
+
+//*** This is temporary work around. It need to call CCM api to get to CFG later
+/// Get string parameter value
+extern tSirRetStatus wlan_cfgGetStr(tpAniSirGlobal, tANI_U16, tANI_U8*, tANI_U32*);
+                                                                     
+void csrScanGetResultTimerHandler(void *);
+void csrScanResultAgingTimerHandler(void *pv);
+void csrScanIdleScanTimerHandler(void *);
+#ifdef WLAN_AP_STA_CONCURRENCY
+static void csrStaApConcTimerHandler(void *);
+#endif
+eHalStatus csrScanChannels( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+void csrSetCfgValidChannelList( tpAniSirGlobal pMac, tANI_U8 *pChannelList, tANI_U8 NumChannels );
+void csrSaveTxPowerToCfg( tpAniSirGlobal pMac, tDblLinkList *pList, tANI_U32 cfgId );
+void csrSetCfgCountryCode( tpAniSirGlobal pMac, tANI_U8 *countryCode );
+void csrPurgeChannelPower( tpAniSirGlobal pMac, tDblLinkList *pChannelList );
+//if bgPeriod is 0, background scan is disabled. It is in millisecond units
+eHalStatus csrSetCfgBackgroundScanPeriod(tpAniSirGlobal pMac, tANI_U32 bgPeriod);
+eHalStatus csrProcessSetBGScanParam(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReleaseScanCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus);
+static tANI_BOOLEAN csrScanValidateScanResult( tpAniSirGlobal pMac, tANI_U8 *pChannels, 
+                                               tANI_U8 numChn, tSirBssDescription *pBssDesc, 
+                                               tDot11fBeaconIEs **ppIes );
+eHalStatus csrSetBGScanChannelList( tpAniSirGlobal pMac, tANI_U8 *pAdjustChannels, tANI_U8 NumAdjustChannels);
+void csrReleaseCmdSingle(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+tANI_BOOLEAN csrRoamIsValidChannel( tpAniSirGlobal pMac, tANI_U8 channel );
+
+//pResult is invalid calling this function.
+void csrFreeScanResultEntry( tpAniSirGlobal pMac, tCsrScanResult *pResult )
+{
+    if( NULL != pResult->Result.pvIes )
+    {
+        palFreeMemory( pMac->hHdd, pResult->Result.pvIes );
+    }
+    palFreeMemory(pMac->hHdd, pResult);
+}
+
+
+static eHalStatus csrLLScanPurgeResult(tpAniSirGlobal pMac, tDblLinkList *pList)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry;
+    tCsrScanResult *pBssDesc;
+    
+    csrLLLock(pList);
+    
+    while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_NOLOCK)) != NULL)
+    {
+        pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+        csrFreeScanResultEntry( pMac, pBssDesc );
+    }
+    
+    csrLLUnlock(pList);   
+     
+    return (status);
+}
+
+
+int csrCheckValidateLists(void * dest, const void *src, v_SIZE_t num, int idx)
+{
+#ifdef CSR_VALIDATE_LIST
+
+    int ii = 1;
+
+    if( (NULL == g_pMac) || (!g_pMac->scan.fValidateList ) )
+    {
+        return ii;
+    }
+    if(g_pchannelPowerInfoList24)
+    {
+        //check 2.4 list
+        tListElem *pElem, *pHead;
+        int count;
+        
+        count = (int)(g_pchannelPowerInfoList24->Count);
+        pHead = &g_pchannelPowerInfoList24->ListHead;
+        pElem = pHead->next;
+        if((tANI_U32)(pHead->next) > 0x00010000) //Assuming kernel address is not that low.
+        {
+            //this loop crashes if the pointer is not right
+            while(pElem->next != pHead)
+            {
+                if((tANI_U32)(pElem->next) > 0x00010000)
+                {
+                    pElem = pElem->next;
+                    VOS_ASSERT(count > 0);
+                    count--;
+                }
+                else
+                {
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+                         " %d Detect 1 list(0x%X) error Head(0x%X) next(0x%X) Count %d, dest(0x%X) src(0x%X) numBytes(%d)",
+                         idx, (unsigned int)g_pchannelPowerInfoList24, (unsigned int)pHead, 
+                        (unsigned int)(pHead->next), (int)g_pchannelPowerInfoList24->Count, 
+                        (unsigned int)dest, (unsigned int)src, (int)num);
+                    VOS_ASSERT(0);
+                    ii = 0;
+                    break;
+                }
+            }
+        }
+        else
+        {
+            //Bad list
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, " %d Detect list(0x%X) error Head(0x%X) next(0x%X) Count %d, dest(0x%X) src(0x%X) numBytes(%d)", 
+                idx, (unsigned int)g_pchannelPowerInfoList24, (unsigned int)pHead, 
+                (unsigned int)(pHead->next), (int)g_pchannelPowerInfoList24->Count, 
+                (unsigned int)dest, (unsigned int)src, (int)num);
+            VOS_ASSERT(0);
+            ii = 0;
+        }
+    }
+    else
+    {
+        //list ok
+        ii = 1;
+    }
+
+
+    return ii;
+
+#else
+    return 1;
+#endif //#ifdef CSR_VALIDATE_LIST
+}
+
+
+eHalStatus csrScanOpen( tpAniSirGlobal pMac )
+{
+    eHalStatus status;
+    
+    do
+    {
+        csrLLOpen(pMac->hHdd, &pMac->scan.scanResultList);
+        csrLLOpen(pMac->hHdd, &pMac->scan.tempScanResults);
+        csrLLOpen(pMac->hHdd, &pMac->scan.channelPowerInfoList24);
+        csrLLOpen(pMac->hHdd, &pMac->scan.channelPowerInfoList5G);
+#ifdef WLAN_AP_STA_CONCURRENCY
+        csrLLOpen(pMac->hHdd, &pMac->scan.scanCmdPendingList);
+#endif
+#ifdef CSR_VALIDATE_LIST
+        g_pchannelPowerInfoList5 = &pMac->scan.channelPowerInfoList5G;
+        g_pMac = pMac;
+        g_pchannelPowerInfoList24 = &pMac->scan.channelPowerInfoList24;
+#endif
+        pMac->scan.fFullScanIssued = eANI_BOOLEAN_FALSE;
+        pMac->scan.nBssLimit = CSR_MAX_BSS_SUPPORT;
+        status = palTimerAlloc(pMac->hHdd, &pMac->scan.hTimerGetResult, csrScanGetResultTimerHandler, pMac);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for getResult timer\n"));
+            break;
+        }
+#ifdef WLAN_AP_STA_CONCURRENCY
+        status = palTimerAlloc(pMac->hHdd, &pMac->scan.hTimerStaApConcTimer, csrStaApConcTimerHandler, pMac);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for hTimerStaApConcTimer timer\n"));
+            break;
+        }
+#endif        
+        status = palTimerAlloc(pMac->hHdd, &pMac->scan.hTimerIdleScan, csrScanIdleScanTimerHandler, pMac);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for idleScan timer\n"));
+            break;
+        }
+        status = palTimerAlloc(pMac->hHdd, &pMac->scan.hTimerResultAging, csrScanResultAgingTimerHandler, pMac);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for ResultAging timer\n"));
+            break;
+        }
+    }while(0);
+    
+    return (status);
+}
+
+
+eHalStatus csrScanClose( tpAniSirGlobal pMac )
+{
+#ifdef CSR_VALIDATE_LIST
+    g_pchannelPowerInfoList24 = NULL;
+    g_pchannelPowerInfoList5 = NULL;
+    g_pMac = NULL;
+#endif
+    csrLLScanPurgeResult(pMac, &pMac->scan.tempScanResults);
+    csrLLScanPurgeResult(pMac, &pMac->scan.scanResultList);
+#ifdef WLAN_AP_STA_CONCURRENCY
+    csrLLScanPurgeResult(pMac, &pMac->scan.scanCmdPendingList);
+#endif
+    csrLLClose(&pMac->scan.scanResultList);
+    csrLLClose(&pMac->scan.tempScanResults);
+#ifdef WLAN_AP_STA_CONCURRENCY
+    csrLLClose(&pMac->scan.scanCmdPendingList);
+#endif
+    csrPurgeChannelPower(pMac, &pMac->scan.channelPowerInfoList24);
+    csrPurgeChannelPower(pMac, &pMac->scan.channelPowerInfoList5G);
+    csrLLClose(&pMac->scan.channelPowerInfoList24);
+    csrLLClose(&pMac->scan.channelPowerInfoList5G);
+    csrScanDisable(pMac);
+    palTimerFree(pMac->hHdd, pMac->scan.hTimerResultAging);
+    palTimerFree(pMac->hHdd, pMac->scan.hTimerGetResult);
+#ifdef WLAN_AP_STA_CONCURRENCY
+    palTimerFree(pMac->hHdd, pMac->scan.hTimerStaApConcTimer);
+#endif
+    palTimerFree(pMac->hHdd, pMac->scan.hTimerIdleScan);
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus csrScanEnable( tpAniSirGlobal pMac )
+{
+    
+    pMac->scan.fScanEnable = eANI_BOOLEAN_TRUE;
+    pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+    
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus csrScanDisable( tpAniSirGlobal pMac )
+{
+    
+    csrScanStopTimers(pMac);
+    pMac->scan.fScanEnable = eANI_BOOLEAN_FALSE;
+    
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+//Return SUCCESS is the command is queued, else returns eHAL_STATUS_FAILURE 
+eHalStatus csrQueueScanRequest( tpAniSirGlobal pMac, tSmeCmd *pScanCmd )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    tANI_BOOLEAN fNoCmdPending;
+    tSmeCmd *pQueueScanCmd=NULL;
+    tSmeCmd *pSendScanCmd=NULL;
+
+    if (vos_get_concurrency_mode() == VOS_STA_SAP) //TODO:- Also make sure AP BSS has started
+    {
+
+        tCsrScanRequest scanReq;
+        tANI_U8 numChn = pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
+        tCsrChannelInfo *pChnInfo = &scanReq.ChannelInfo;
+        tANI_U8    channelToScan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+        tANI_U8    i = 0;
+        tANI_BOOLEAN bMemAlloc = eANI_BOOLEAN_FALSE;
+
+        if (numChn == 0)
+        {
+
+            numChn = pMac->scan.baseChannels.numChannels;
+             
+             status = palAllocateMemory( pMac->hHdd, (void **)&pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, numChn );
+             if( !HAL_STATUS_SUCCESS( status ) )
+             {
+                 smsLog( pMac, LOGE, FL(" Failed to get memory for channel list \n") );
+                 return eHAL_STATUS_FAILURE;
+             }
+             bMemAlloc = eANI_BOOLEAN_TRUE;
+             status = palCopyMemory( pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, 
+                         pMac->scan.baseChannels.channelList, numChn );
+             if( !HAL_STATUS_SUCCESS( status ) )
+             {
+                 palFreeMemory( pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList );
+                 pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList = NULL;
+                 smsLog( pMac, LOGE, FL(" Failed to copy memory to channel list \n") );
+                 return eHAL_STATUS_FAILURE;
+             }
+             pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = numChn;
+         }
+
+         //Whenever we get a scan request with multiple channels we break it up into 2 requests
+         //First request  for first channel to scan and second request to scan remaining channels
+         for  (i=0; i < 2; i++)
+         {   //go through max 2 iterations. 
+             //Once for using the existing command when number of channels is 1 
+             //Second to go over the remaining channels after creating a new command
+            
+            if (1 == numChn)
+            {
+                pSendScanCmd = pScanCmd;
+                pSendScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = 1;
+                pSendScanCmd->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+                pSendScanCmd->u.scanCmd.u.scanRequest.maxChnTime = 
+                    CSR_MIN(pSendScanCmd->u.scanCmd.u.scanRequest.maxChnTime,CSR_ACTIVE_MAX_CHANNEL_TIME_CONC);
+                pSendScanCmd->u.scanCmd.u.scanRequest.minChnTime = 
+                    CSR_MIN(pSendScanCmd->u.scanCmd.u.scanRequest.minChnTime, CSR_ACTIVE_MIN_CHANNEL_TIME_CONC);
+                if (i != 0)
+                { //Callback should be NULL for all except last channel So hdd_callback will be called only after last command
+                  //i!=0 then we came here in second iteration 
+                   pSendScanCmd->u.scanCmd.callback = NULL;
+                }
+                break; //break out of this loop in case there is only 1 channel then no need for 2nd iteration
+            
+            } else { //if number of channels > 1 then
+            
+                palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
+
+                pQueueScanCmd = csrGetCommandBuffer(pMac); //optimize this to use 2 command buffer only
+                if (!pQueueScanCmd)
+                {
+                    if (bMemAlloc)
+                    {
+                        palFreeMemory( pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList );
+                        pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList = NULL;
+                 
+                    }
+                    smsLog( pMac, LOGE, FL(" Failed to get Queue command buffer\n") );
+                    return eHAL_STATUS_FAILURE;
+                }
+                pQueueScanCmd->command = pScanCmd->command; 
+                pQueueScanCmd->sessionId = pScanCmd->sessionId;
+                pQueueScanCmd->u.scanCmd.callback = pScanCmd->u.scanCmd.callback;
+                pQueueScanCmd->u.scanCmd.pContext = pScanCmd->u.scanCmd.pContext;
+                pQueueScanCmd->u.scanCmd.reason = pScanCmd->u.scanCmd.reason;
+                pQueueScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+
+                pChnInfo->numOfChannels = pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels - 1;
+
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
+                   FL(" &channelToScan %0x pScanCmd(0x%X) pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList(0x%X)numChn(%d)"),
+                   &channelToScan[0], (unsigned int)pScanCmd, 
+                   (unsigned int)pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, numChn);
+              
+                palCopyMemory(pMac->hHdd, &channelToScan[0], &pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[1], 
+                              pChnInfo->numOfChannels * sizeof(tANI_U8));
+
+                pChnInfo->ChannelList = &channelToScan[0];
+              
+
+                scanReq.BSSType = eCSR_BSS_TYPE_ANY;
+                //Modify callers parameters in case of concurrency
+                scanReq.scanType = eSIR_ACTIVE_SCAN;
+                scanReq.maxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC;
+                scanReq.minChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC;
+
+                status = csrScanCopyRequest(pMac, &pQueueScanCmd->u.scanCmd.u.scanRequest, &scanReq);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    if (bMemAlloc)
+                    {
+                        palFreeMemory( pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList );
+                        pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList = NULL;
+                 
+                    }
+                    smsLog( pMac, LOGE, FL(" Failed to get copy csrScanRequest = %d\n"), status );
+                    return eHAL_STATUS_FAILURE;
+                }       
+                numChn = 1; //make numChn to be 1 for second iteration to create a send command
+            }  
+
+         }
+
+         fNoCmdPending = csrLLIsListEmpty( &pMac->scan.scanCmdPendingList, LL_ACCESS_LOCK );
+
+         //Logic Below is as follows
+         // If the scanCmdPendingList is empty then we directly send that command
+         // to smeCommandQueue else we buffer it in our scanCmdPendingList Queue
+         if( fNoCmdPending )
+         {
+            
+            if (pQueueScanCmd != NULL)
+            {            
+              csrLLInsertTail( &pMac->scan.scanCmdPendingList, &pQueueScanCmd->Link, LL_ACCESS_LOCK );
+            }
+
+            if (pSendScanCmd != NULL)
+            {            
+                return csrQueueSmeCommand(pMac, pSendScanCmd, eANI_BOOLEAN_FALSE);
+            }
+         }
+         else
+         {           
+            if (pSendScanCmd != NULL)
+            {
+                csrLLInsertTail( &pMac->scan.scanCmdPendingList, &pSendScanCmd->Link, LL_ACCESS_LOCK );
+            }
+            if (pQueueScanCmd != NULL)
+            {
+                csrLLInsertTail( &pMac->scan.scanCmdPendingList, &pQueueScanCmd->Link, LL_ACCESS_LOCK );
+            }
+         }
+
+    }
+    else
+    {  //No concurrency case
+        return csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
+    }
+    
+
+
+    return ( status );
+
+}
+#endif
+
+eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, 
+              tCsrScanRequest *pScanRequest, tANI_U32 *pScanRequestID, 
+              csrScanCompleteCallback callback, void *pContext)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tSmeCmd *pScanCmd = NULL;
+    
+    do
+    {
+        if(pMac->scan.fScanEnable)
+        {
+            pScanCmd = csrGetCommandBuffer(pMac);
+            if(pScanCmd)
+            {
+                palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
+                pScanCmd->command = eSmeCommandScan; 
+                pScanCmd->sessionId = sessionId;
+                pScanCmd->u.scanCmd.callback = callback;
+                pScanCmd->u.scanCmd.pContext = pContext;
+                if(eCSR_SCAN_REQUEST_11D_SCAN == pScanRequest->requestType)
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScan11d1;
+                }
+                else if((eCSR_SCAN_REQUEST_FULL_SCAN == pScanRequest->requestType) ||
+                        (eCSR_SCAN_P2P_DISCOVERY == pScanRequest->requestType)
+#ifdef SOFTAP_CHANNEL_RANGE
+                        ||(eCSR_SCAN_SOFTAP_CHANNEL_RANGE == pScanRequest->requestType)
+#endif
+                 )
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScanUserRequest;
+                }
+                else if(eCSR_SCAN_HO_BG_SCAN == pScanRequest->requestType)
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScanBgScan;
+                }
+                else if(eCSR_SCAN_HO_PROBE_SCAN == pScanRequest->requestType)
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScanProbeBss;
+                }
+#if defined WLAN_FEATURE_P2P
+                else if(eCSR_SCAN_P2P_FIND_PEER == pScanRequest->requestType)
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScanP2PFindPeer;
+                }
+#endif                
+                else
+                {
+                    pScanCmd->u.scanCmd.reason = eCsrScanIdleScan;
+                }
+                if(pScanRequest->minChnTime == 0 && pScanRequest->maxChnTime == 0)
+                {
+                    //The caller doesn't set the time correctly. Set it here
+                    if(pScanRequest->scanType == eSIR_ACTIVE_SCAN)
+                    {
+                        pScanRequest->maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+                        pScanRequest->minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+                    }
+                    else
+                    {
+                        pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
+                        pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+                    }
+                }
+                //Need to make the following atomic
+                pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+                
+                if(pScanRequestID)
+                {
+                    *pScanRequestID = pScanCmd->u.scanCmd.scanID; 
+                }
+
+                //Tush : If it is the first scan request from HDD, CSR checks if it is for 11d. 
+                // If it is not, CSR will save the scan request in the pending cmd queue 
+                // & issue an 11d scan request to PE.
+                if(((0 == pScanCmd->u.scanCmd.scanID)
+                   && (eCSR_SCAN_REQUEST_11D_SCAN != pScanRequest->requestType))
+#ifdef SOFTAP_CHANNEL_RANGE
+                   && (eCSR_SCAN_SOFTAP_CHANNEL_RANGE != pScanRequest->requestType)
+#endif                   
+                   && (eANI_BOOLEAN_FALSE == pMac->scan.fEnableBypass11d)
+                   )
+                {
+                    tSmeCmd *p11dScanCmd;
+                    tCsrScanRequest scanReq;
+                    tCsrChannelInfo *pChnInfo = &scanReq.ChannelInfo;
+
+                    palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
+
+                    p11dScanCmd = csrGetCommandBuffer(pMac);
+                    if(p11dScanCmd)
+                    {
+                        tANI_U32 numChn = pMac->scan.baseChannels.numChannels;
+
+                        palZeroMemory(pMac->hHdd, &p11dScanCmd->u.scanCmd, sizeof(tScanCmd));
+                        status = palAllocateMemory( pMac->hHdd, (void **)&pChnInfo->ChannelList, numChn );
+                        if( !HAL_STATUS_SUCCESS( status ) )
+                        {
+                            break;
+                        }
+                        status = palCopyMemory( pMac->hHdd, pChnInfo->ChannelList, 
+                                    pMac->scan.baseChannels.channelList, numChn );
+                        if( !HAL_STATUS_SUCCESS( status ) )
+                        {
+                            palFreeMemory( pMac->hHdd, pChnInfo->ChannelList );
+                            pChnInfo->ChannelList = NULL;
+                            break;
+                        }
+                        pChnInfo->numOfChannels = (tANI_U8)numChn;
+                        p11dScanCmd->command = eSmeCommandScan;
+                        p11dScanCmd->u.scanCmd.callback = NULL;
+                        p11dScanCmd->u.scanCmd.pContext = NULL;
+                        p11dScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++;                
+                        scanReq.BSSType = eCSR_BSS_TYPE_ANY;
+
+                        if ( csrIs11dSupported(pMac) )
+                        {
+                            scanReq.scanType = eSIR_PASSIVE_SCAN;
+                            scanReq.requestType = eCSR_SCAN_REQUEST_11D_SCAN;
+                            p11dScanCmd->u.scanCmd.reason = eCsrScan11d1;
+                            scanReq.maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
+                            scanReq.minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+                        }
+                        else
+                        {
+                            scanReq.scanType = eSIR_ACTIVE_SCAN;
+                            scanReq.requestType = eCSR_SCAN_IDLE_MODE_SCAN;
+                            p11dScanCmd->u.scanCmd.reason = eCsrScanIdleScan;
+                            scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+                            scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+                        }
+                        status = csrScanCopyRequest(pMac, &p11dScanCmd->u.scanCmd.u.scanRequest, &scanReq);
+                        //Free the channel list
+                        palFreeMemory( pMac->hHdd, pChnInfo->ChannelList );
+
+                        if(HAL_STATUS_SUCCESS(status))
+                        {
+                            //Start process the command
+#ifdef WLAN_AP_STA_CONCURRENCY
+                            status = csrQueueScanRequest(pMac, p11dScanCmd);
+#else
+                            status = csrQueueSmeCommand(pMac, p11dScanCmd, eANI_BOOLEAN_FALSE);
+#endif                   
+                            if( !HAL_STATUS_SUCCESS( status ) )
+                            {
+                                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                                break;
+                            }
+                        }
+                        else 
+                        {
+                            break;
+                        }
+                    }
+                    else
+                    {
+                        //error
+                        break;
+                    }
+                }
+                status = csrScanCopyRequest(pMac, &pScanCmd->u.scanCmd.u.scanRequest, pScanRequest);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    //Start process the command
+#ifdef WLAN_AP_STA_CONCURRENCY
+                    status = csrQueueScanRequest(pMac,pScanCmd); 
+#else
+                    status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);                   
+#endif
+                    if( !HAL_STATUS_SUCCESS( status ) )
+                    {
+                        smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                        break;
+                    }
+                }
+                else 
+                {
+                    smsLog( pMac, LOGE, FL(" fail to copy request status = %d\n"), status );
+                    break;
+                }
+            }
+            else 
+            {
+                //log error
+                break;
+            }
+        }
+    } while(0);
+    if(!HAL_STATUS_SUCCESS(status) && pScanCmd)
+    {
+        if( eCsrScanIdleScan == pScanCmd->u.scanCmd.reason )
+        {
+            //Set the flag back for restarting idle scan
+            pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+        }
+        csrReleaseCommandScan(pMac, pScanCmd);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrScanRequestResult(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pScanCmd;
+    
+    if(pMac->scan.fScanEnable)
+    {
+        pScanCmd = csrGetCommandBuffer(pMac);
+        if(pScanCmd)
+        {
+            pScanCmd->command = eSmeCommandScan;
+            palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
+            pScanCmd->u.scanCmd.callback = NULL;
+            pScanCmd->u.scanCmd.pContext = NULL;
+            pScanCmd->u.scanCmd.reason = eCsrScanGetResult;
+            //Need to make the following atomic
+            pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+            status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                csrReleaseCommandScan(pMac, pScanCmd);
+            }
+        }
+        else 
+        {
+            //log error
+            smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
+            status = eHAL_STATUS_RESOURCES;
+        }
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanAllChannels(tpAniSirGlobal pMac, eCsrRequestType reqType)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 scanId;
+    tCsrScanRequest scanReq;
+
+    palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
+    scanReq.BSSType = eCSR_BSS_TYPE_ANY;
+    scanReq.scanType = eSIR_ACTIVE_SCAN;
+    scanReq.requestType = reqType;
+    scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+    scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+    //Scan with invalid sessionId. 
+    //This results in SME using the first available session to scan.
+    status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, 
+                            &scanId, NULL, NULL);
+
+    return (status);
+}
+
+
+
+
+eHalStatus csrIssueRoamAfterLostlinkScan(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamReason reason)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultHandle hBSSList = NULL;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tANI_U32 roamId = 0;
+    tCsrRoamProfile *pProfile = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do
+    {
+        smsLog(pMac, LOG1, " csrIssueRoamAfterLostlinkScan called\n");
+        if(pSession->fCancelRoaming)
+        {
+            smsLog(pMac, LOGW, " lostlink roaming is cancelled\n");
+            csrScanStartIdleScan(pMac);
+            status = eHAL_STATUS_SUCCESS;
+            break;
+        }
+        //Here is the profile we need to connect to
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(!HAL_STATUS_SUCCESS(status))
+            break;
+        palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+        if(NULL == pSession->pCurRoamProfile)
+        {
+            pScanFilter->EncryptionType.numEntries = 1;
+            pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+        }
+        else
+        {
+            //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect
+            status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile));
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile));
+            status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile);
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter);
+        }//We have a profile
+        roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                if(eCsrLostLink1 == reason)
+                {
+                    //we want to put the last connected BSS to the very beginning, if possible
+                    csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList);
+                }
+                status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, reason, 
+                                                roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    csrScanResultPurge(pMac, hBSSList);
+                }
+            }//Have scan result
+        }
+    }while(0);
+    if(pScanFilter)
+    {
+        //we need to free memory for filter if profile exists
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+    if(NULL != pProfile)
+    {
+        csrReleaseProfile(pMac, pProfile);
+        palFreeMemory(pMac->hHdd, (void *)pProfile);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrScanGetScanChnInfo(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pScanCmd;
+    
+    if(pMac->scan.fScanEnable)
+    {
+        pScanCmd = csrGetCommandBuffer(pMac);
+        if(pScanCmd)
+        {
+            pScanCmd->command = eSmeCommandScan;
+            palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
+            pScanCmd->u.scanCmd.callback = NULL;
+            pScanCmd->u.scanCmd.pContext = NULL;
+            pScanCmd->u.scanCmd.reason = eCsrScanGetScanChnInfo;
+            //Need to make the following atomic
+            pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+            status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                csrReleaseCommandScan(pMac, pScanCmd);
+            }
+        }
+        else 
+        {
+            //log error
+            smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
+            status = eHAL_STATUS_RESOURCES;
+        }
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanHandleFailedLostlink1(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "  Lostlink scan 1 failed\n");
+    if(pSession->fCancelRoaming)
+    {
+        csrScanStartIdleScan(pMac);
+    }
+    else if(pSession->pCurRoamProfile)
+    {
+        //We fail lostlink1 but there may be other BSS in the cached result fit the profile. Give it a try first
+        if(pSession->pCurRoamProfile->SSIDs.numOfSSIDs == 0 ||
+            pSession->pCurRoamProfile->SSIDs.numOfSSIDs > 1)
+        {
+            //try lostlink scan2
+            status = csrScanRequestLostLink2(pMac, sessionId);
+        }
+        else if(!pSession->pCurRoamProfile->ChannelInfo.ChannelList || 
+                pSession->pCurRoamProfile->ChannelInfo.ChannelList[0] == 0)
+        {
+            //go straight to lostlink scan3
+            status = csrScanRequestLostLink3(pMac, sessionId);
+        }
+        else
+        {
+            //we are done with lostlink
+            if(csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_FALSE, eCSR_ROAM_RESULT_FAILURE))
+            {
+                csrScanStartIdleScan(pMac);
+            }
+            status = eHAL_STATUS_SUCCESS;
+        }
+    }
+    else
+    {
+        status = csrScanRequestLostLink3(pMac, sessionId);
+    }
+
+    return (status);    
+}
+
+
+
+eHalStatus csrScanHandleFailedLostlink2(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "  Lostlink scan 2 failed\n");
+    if(pSession->fCancelRoaming)
+    {
+        csrScanStartIdleScan(pMac);
+    }
+    else if(!pSession->pCurRoamProfile || !pSession->pCurRoamProfile->ChannelInfo.ChannelList || 
+                pSession->pCurRoamProfile->ChannelInfo.ChannelList[0] == 0)
+    {
+        //try lostlink scan3
+        status = csrScanRequestLostLink3(pMac, sessionId);
+    }
+    else
+    {
+        //we are done with lostlink
+        if(csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_FALSE, eCSR_ROAM_RESULT_FAILURE))
+        {
+            csrScanStartIdleScan(pMac);
+        }
+    }
+
+    return (status);    
+}
+
+
+
+eHalStatus csrScanHandleFailedLostlink3(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    smsLog(pMac, LOGW, "  Lostlink scan 3 failed\n");
+    if(eANI_BOOLEAN_TRUE == csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_FALSE, eCSR_ROAM_RESULT_FAILURE))
+    {
+        //we are done with lostlink
+        csrScanStartIdleScan(pMac);
+    }
+    
+    return (status);    
+}
+
+
+
+
+//Lostlink1 scan is to actively scan the last connected profile's SSID on all matched BSS channels.
+//If no roam profile (it should not), it is like lostlinkscan3
+eHalStatus csrScanRequestLostLink1( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand = NULL;
+    tANI_U8 bAddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tScanResultHandle hBSSList = NULL;
+    tCsrScanResultInfo *pScanResult = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, FL(" called\n"));
+    do
+    {
+        pCommand = csrGetCommandBuffer(pMac);
+        if(!pCommand)
+        {
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+        pCommand->command = eSmeCommandScan;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.scanCmd.reason = eCsrScanLostLink1;
+        pCommand->u.scanCmd.callback = NULL;
+        pCommand->u.scanCmd.pContext = NULL;
+        pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+        pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+        pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        if(pSession->connectedProfile.SSID.length)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.scanRequest.SSIDs.SSIDList, sizeof(tCsrSSIDInfo));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            pCommand->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs = 1;
+            palCopyMemory(pMac->hHdd, &pCommand->u.scanCmd.u.scanRequest.SSIDs.SSIDList[0].SSID, 
+                                &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
+        }
+        else
+        {
+            pCommand->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs = 0;
+        }
+        if(pSession->pCurRoamProfile)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = csrRoamPrepareFilterFromProfile(pMac, pSession->pCurRoamProfile, pScanFilter);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            //Don't change variable status here because whether we can get result or not, the command goes to PE.
+            //The status is also used to indicate whether the command is queued. Not success meaning not queue
+            if(HAL_STATUS_SUCCESS((csrScanGetResult(pMac, pScanFilter, &hBSSList))) && hBSSList)
+            {
+                tANI_U8 i, nChn = 0;
+                status = palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList,
+                            WNI_CFG_VALID_CHANNEL_LIST_LEN);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    break;
+                }
+                while(((pScanResult = csrScanResultGetNext(pMac, hBSSList)) != NULL) &&
+                    nChn < WNI_CFG_VALID_CHANNEL_LIST_LEN)
+                {
+                    for(i = 0; i < nChn; i++)
+                    {
+                        if(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[i] == 
+                                        pScanResult->BssDescriptor.channelId)
+                        {
+                            break;
+                        }
+                    }
+                    if(i == nChn)
+                    {
+                        pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[nChn++] = pScanResult->BssDescriptor.channelId;
+                    }
+                }
+                //Include the last connected BSS' channel
+                if(csrRoamIsChannelValid(pMac, pSession->connectedProfile.operationChannel))
+                {
+                    for(i = 0; i < nChn; i++)
+                    {
+                        if(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[i] == 
+                                        pSession->connectedProfile.operationChannel)
+                        {
+                            break;
+                        }
+                    }
+                    if(i == nChn)
+                    {
+                        pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[nChn++] = pSession->connectedProfile.operationChannel;
+                    }
+                }
+                pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = nChn;
+            }
+            else
+            {
+                if(csrRoamIsChannelValid(pMac, pSession->connectedProfile.operationChannel))
+                {
+                    status = palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList,
+                                1);
+                    //just try the last connected channel
+                    if(HAL_STATUS_SUCCESS(status))
+                    {
+                        pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[0] = pSession->connectedProfile.operationChannel;
+                        pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = 1;
+                    }
+                    else 
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+        palCopyMemory(pMac->hHdd, &pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid));
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            break;
+        }
+    } while( 0 );
+
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        smsLog(pMac, LOGW, " csrScanRequestLostLink1 failed with status %d\n", status);
+        if(pCommand)
+        {
+            csrReleaseCommandScan(pMac, pCommand);
+        }
+        status = csrScanHandleFailedLostlink1( pMac, sessionId );
+    }
+    if(pScanFilter)
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+    if(hBSSList)
+    {
+        csrScanResultPurge(pMac, hBSSList);
+    }
+
+    return( status );
+}
+
+
+//Lostlink2 scan is to actively scan the all SSIDs of the last roaming profile's on all matched BSS channels.
+//Since MAC doesn't support multiple SSID, we scan all SSIDs and filter them afterwards
+eHalStatus csrScanRequestLostLink2( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U8 bAddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tScanResultHandle hBSSList = NULL;
+    tCsrScanResultInfo *pScanResult = NULL;
+    tSmeCmd *pCommand = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, FL(" called\n"));
+    do
+    {
+        pCommand = csrGetCommandBuffer(pMac);
+        if(!pCommand)
+        {
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+        pCommand->command = eSmeCommandScan;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.scanCmd.reason = eCsrScanLostLink2;
+        pCommand->u.scanCmd.callback = NULL;
+        pCommand->u.scanCmd.pContext = NULL;
+        pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+        pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+        pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        if(pSession->pCurRoamProfile)
+        {
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            status = csrRoamPrepareFilterFromProfile(pMac, pSession->pCurRoamProfile, pScanFilter);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                break;
+            }
+            if(hBSSList)
+            {
+                tANI_U8 i, nChn = 0;
+                status = palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList,
+                            WNI_CFG_VALID_CHANNEL_LIST_LEN);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    break;
+                }
+                while(((pScanResult = csrScanResultGetNext(pMac, hBSSList)) != NULL) &&
+                    nChn < WNI_CFG_VALID_CHANNEL_LIST_LEN)
+                {
+                    for(i = 0; i < nChn; i++)
+                    {
+                        if(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[i] == 
+                                        pScanResult->BssDescriptor.channelId)
+                        {
+                            break;
+                        }
+                    }
+                    if(i == nChn)
+                    {
+                        pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[nChn++] = pScanResult->BssDescriptor.channelId;
+                    }
+                }
+                pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = nChn;
+            }
+        }
+        palCopyMemory(pMac->hHdd, &pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid));
+        //Put to the head in pending queue
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            break;
+        }
+    } while( 0 );
+
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        smsLog(pMac, LOGW, " csrScanRequestLostLink2 failed with status %d\n", status);
+        if(pCommand)
+        {
+            csrReleaseCommandScan(pMac, pCommand);
+        }
+        status = csrScanHandleFailedLostlink2( pMac, sessionId );
+    }
+    if(pScanFilter)
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+    if(hBSSList)
+    {
+        csrScanResultPurge(pMac, hBSSList);
+    }
+
+    return( status );
+}
+
+
+//To actively scan all valid channels
+eHalStatus csrScanRequestLostLink3( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand;
+    tANI_U8 bAddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+    smsLog(pMac, LOGW, FL(" called\n"));
+    do
+    {
+        pCommand = csrGetCommandBuffer(pMac);
+        if(!pCommand)
+        {
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+        pCommand->command = eSmeCommandScan;
+        pCommand->sessionId = (tANI_U8)sessionId;
+        pCommand->u.scanCmd.reason = eCsrScanLostLink3;
+        pCommand->u.scanCmd.callback = NULL;
+        pCommand->u.scanCmd.pContext = NULL;
+        pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+        pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+        pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+        palCopyMemory(pMac->hHdd, &pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid));
+        //Put to the head of pending queue
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            break;
+        }
+    } while( 0 );
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        smsLog(pMac, LOGW, " csrScanRequestLostLink3 failed with status %d\n", status);
+        if(csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_FALSE, eCSR_ROAM_RESULT_FAILURE))
+        {
+            csrScanStartIdleScan(pMac);
+        }
+        if(pCommand)
+        {
+            csrReleaseCommandScan(pMac, pCommand);
+        }
+    }
+
+    return( status );
+}
+
+
+eHalStatus csrScanHandleSearchForSSID(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultHandle hBSSList = CSR_INVALID_SCANRESULT_HANDLE;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tCsrRoamProfile *pProfile = pCommand->u.scanCmd.pToRoamProfile;
+    tANI_U32 sessionId = pCommand->sessionId;
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+#endif
+    do
+    {
+        //If there is roam command waiting, ignore this roam because the newer roam command is the one to execute
+        if(csrIsRoamCommandWaitingForSession(pMac, sessionId))
+        {
+            smsLog(pMac, LOGW, FL(" aborts because roam command waiting\n"));
+            break;
+        }
+        if(pProfile == NULL)
+            break;
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(!HAL_STATUS_SUCCESS(status))
+            break;
+        palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+        status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter);
+        if(!HAL_STATUS_SUCCESS(status))
+            break;
+        status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+        if(!HAL_STATUS_SUCCESS(status))
+            break;
+        status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, 
+                                    pCommand->u.scanCmd.roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            break;
+        }
+    }while(0);
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        if(CSR_INVALID_SCANRESULT_HANDLE != hBSSList)
+        {
+            csrScanResultPurge(pMac, hBSSList);
+        }
+        //We haven't done anything to this profile
+        csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.scanCmd.roamId,
+                     eCSR_ROAM_ASSOCIATION_FAILURE, eCSR_ROAM_RESULT_FAILURE);
+        //In case we have nothing else to do, restart idle scan
+        if(csrIsConnStateDisconnected(pMac, sessionId) && !csrIsRoamCommandWaiting(pMac))
+        {
+            status = csrScanStartIdleScan(pMac);
+        }
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+        //In case of WDS station, let it retry.
+        if( CSR_IS_WDS_STA(pProfile) )
+        {
+            //Save the roma profile so we can retry
+            csrFreeRoamProfile( pMac, sessionId );
+            if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, 
+                                  (void **)&pSession->pCurRoamProfile,
+                                  sizeof(tCsrRoamProfile))))
+            {
+                palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile));
+                csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile);
+            }
+            csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD);
+        }
+#endif
+    }
+    if(pScanFilter)
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrScanHandleSearchForSSIDFailure(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 sessionId = pCommand->sessionId;
+    tCsrRoamProfile *pProfile = pCommand->u.scanCmd.pToRoamProfile;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+#if defined(WLAN_DEBUG)
+    if(pCommand->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs == 1)
+    {
+        char str[36];
+        palCopyMemory(pMac->hHdd, str, pCommand->u.scanCmd.u.scanRequest.SSIDs.SSIDList[0].SSID.ssId,
+            pCommand->u.scanCmd.u.scanRequest.SSIDs.SSIDList[0].SSID.length);
+        str[pCommand->u.scanCmd.u.scanRequest.SSIDs.SSIDList[0].SSID.length] = 0;
+        smsLog(pMac, LOGW, FL(" SSID = %s\n"), str);
+    }
+#endif
+    //Check whether it is for start ibss. No need to do anything if it is a JOIN request
+    if(pProfile && CSR_IS_START_IBSS(pProfile))
+    {
+        status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, 
+                                        pCommand->u.scanCmd.roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("failed to issue startIBSS command with status = 0x%08X\n"), status);
+            csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.scanCmd.roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
+        }
+    }
+    else 
+    {
+        eCsrRoamResult roamResult = eCSR_ROAM_RESULT_FAILURE;
+
+        if(csrIsConnStateDisconnected(pMac, sessionId) &&
+          !csrIsRoamCommandWaitingForSession(pMac, sessionId))
+        {
+            status = csrScanStartIdleScan(pMac);
+        }
+        if((NULL == pProfile) || !csrIsBssTypeIBSS(pProfile->BSSType))
+        {
+            //Only indicate assoc_completion if we indicate assoc_start.
+            if(pSession->bRefAssocStartCnt > 0)
+            {
+                tCsrRoamInfo *pRoamInfo = NULL, roamInfo;
+                palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
+                pRoamInfo = &roamInfo;
+                if(pCommand->u.roamCmd.pRoamBssEntry)
+                {
+                    tCsrScanResult *pScanResult = 
+                                GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry,
+                                tCsrScanResult, Link);
+                    roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor;
+                }
+                roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
+                roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+                pSession->bRefAssocStartCnt--;
+                csrRoamCallCallback(pMac, sessionId, pRoamInfo,
+                                    pCommand->u.scanCmd.roamId,
+                                    eCSR_ROAM_ASSOCIATION_COMPLETION,
+                                    eCSR_ROAM_RESULT_FAILURE);
+            }
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+            //In case of WDS station, let it retry.
+            if( CSR_IS_WDS_STA(pProfile) )
+            {
+                //Save the roma profile so we can retry
+                csrFreeRoamProfile( pMac, sessionId );
+                if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, 
+                                      (void **)&pSession->pCurRoamProfile,
+                                      sizeof(tCsrRoamProfile))))
+                {
+                    palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile));
+                    csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile);
+                }
+                csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD);
+            }
+#endif
+        }
+        else
+        {
+            roamResult = eCSR_ROAM_RESULT_IBSS_START_FAILED;
+        }
+        csrRoamCompletion(pMac, sessionId, NULL, pCommand, roamResult, eANI_BOOLEAN_FALSE);
+    }
+
+    return (status);
+}
+
+
+//After scan for cap changes, issue a roaming command to either reconnect to the AP or pick another one to connect
+eHalStatus csrScanHandleCapChangeScanComplete(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultHandle hBSSList = NULL;
+    tCsrScanResultFilter *pScanFilter = NULL;
+    tANI_U32 roamId = 0;
+    tCsrRoamProfile *pProfile = NULL;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do
+    {
+        //Here is the profile we need to connect to
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(!HAL_STATUS_SUCCESS(status))
+            break;
+        palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+        if(NULL == pSession) break;
+        if(NULL == pSession->pCurRoamProfile)
+        {
+            pScanFilter->EncryptionType.numEntries = 1;
+            pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
+        }
+        else
+        {
+            //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect
+            status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile));
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile);
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter);
+        }//We have a profile
+        roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                //we want to put the last connected BSS to the very beginning, if possible
+                csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList);
+                status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, 
+                                            eCsrCapsChange, 0, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    csrScanResultPurge(pMac, hBSSList);
+                }
+            }//Have scan result
+            else
+            {
+                smsLog(pMac, LOGW, FL("cannot find matching BSS of %02X-%02X-%02X-%02X-%02X-%02X\n"), 
+                        pSession->connectedProfile.bssid[0],
+                        pSession->connectedProfile.bssid[1],
+                        pSession->connectedProfile.bssid[2],
+                        pSession->connectedProfile.bssid[3],
+                        pSession->connectedProfile.bssid[4],
+                        pSession->connectedProfile.bssid[5]);
+                //Disconnect
+                csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+            }
+        }
+    }while(0);
+    if(pScanFilter)
+    {
+        csrFreeScanFilter(pMac, pScanFilter);
+        palFreeMemory(pMac->hHdd, pScanFilter);
+    }
+    if(NULL != pProfile)
+    {
+        csrReleaseProfile(pMac, pProfile);
+        palFreeMemory(pMac->hHdd, pProfile);
+    }
+
+    return (status);
+}
+
+
+
+eHalStatus csrScanResultPurge(tpAniSirGlobal pMac, tScanResultHandle hScanList)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tScanResultList *pScanList = (tScanResultList *)hScanList;
+     
+    if(pScanList)
+    {
+        status = csrLLScanPurgeResult(pMac, &pScanList->List);
+        csrLLClose(&pScanList->List);
+        palFreeMemory(pMac->hHdd, pScanList);
+    }
+    return (status);
+}
+
+
+static tANI_U32 csrGetBssPreferValue(tpAniSirGlobal pMac, int rssi)
+{
+    tANI_U32 ret = 0;
+    int i = CSR_NUM_RSSI_CAT - 1;
+
+    while(i >= 0)
+    {
+        if(rssi >= pMac->roam.configParam.RSSICat[i])
+        {
+            ret = pMac->roam.configParam.BssPreferValue[i];
+            break;
+        }
+        i--;
+    };
+
+    return (ret);
+}
+
+
+//Return a CapValue base on the capabilities of a BSS
+static tANI_U32 csrGetBssCapValue(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
+{
+    tANI_U32 ret = CSR_BSS_CAP_VALUE_NONE;
+
+    if( pIes )
+    {
+        //We only care about 11N capability
+        if(pIes->HTCaps.present)
+        {
+            ret += CSR_BSS_CAP_VALUE_HT;
+        }
+        if(CSR_IS_QOS_BSS(pIes))
+        {
+            ret += CSR_BSS_CAP_VALUE_WMM;
+            //Give advantage to UAPSD
+            if(CSR_IS_UAPSD_BSS(pIes))
+            {
+                ret += CSR_BSS_CAP_VALUE_UAPSD;
+            }
+        }
+    }
+
+    return (ret);
+}
+
+
+//To check whther pBss1 is better than pBss2
+static tANI_BOOLEAN csrIsBetterBss(tCsrScanResult *pBss1, tCsrScanResult *pBss2)
+{
+    tANI_BOOLEAN ret;
+
+    if(CSR_IS_BETTER_PREFER_VALUE(pBss1->preferValue, pBss2->preferValue))
+    {
+        ret = eANI_BOOLEAN_TRUE;
+    }
+    else if(CSR_IS_EQUAL_PREFER_VALUE(pBss1->preferValue, pBss2->preferValue))
+    {
+        if(CSR_IS_BETTER_CAP_VALUE(pBss1->capValue, pBss2->capValue))
+        {
+            ret = eANI_BOOLEAN_TRUE;
+        }
+        else
+        {
+            ret = eANI_BOOLEAN_FALSE;
+        }
+    }
+    else
+    {
+        ret = eANI_BOOLEAN_FALSE;
+    }
+
+    return (ret);
+}
+
+
+//Put the BSS into the scan result list
+//pIes can not be NULL
+static void csrScanAddResult(tpAniSirGlobal pMac, tCsrScanResult *pResult, tDot11fBeaconIEs *pIes)
+{
+    pResult->preferValue = csrGetBssPreferValue(pMac, (int)pResult->Result.BssDescriptor.rssi);
+    pResult->capValue = csrGetBssCapValue(pMac, &pResult->Result.BssDescriptor, pIes);
+    csrLLInsertTail( &pMac->scan.scanResultList, &pResult->Link, LL_ACCESS_LOCK );
+}
+
+
+eHalStatus csrScanGetResult(tpAniSirGlobal pMac, tCsrScanResultFilter *pFilter, tScanResultHandle *phResult)
+{
+    eHalStatus status;
+    tScanResultList *pRetList;
+    tCsrScanResult *pResult, *pBssDesc;
+    tANI_U32 count = 0;
+    tListElem *pEntry;
+    tANI_U32 bssLen, allocLen;
+    eCsrEncryptionType uc = eCSR_ENCRYPT_TYPE_NONE, mc = eCSR_ENCRYPT_TYPE_NONE;
+    eCsrAuthType auth = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+    tDot11fBeaconIEs *pIes, *pNewIes;
+    tANI_BOOLEAN fMatch;
+    
+    if(phResult)
+    {
+        *phResult = CSR_INVALID_SCANRESULT_HANDLE;
+    }
+    status = palAllocateMemory(pMac->hHdd, (void **)&pRetList, sizeof(tScanResultList));
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pRetList, sizeof(tScanResultList));
+        csrLLOpen(pMac->hHdd, &pRetList->List);
+        pRetList->pCurEntry = NULL;
+        
+        csrLLLock(&pMac->scan.scanResultList);
+        pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+        while( pEntry ) 
+        {
+            pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+            pIes = (tDot11fBeaconIEs *)( pBssDesc->Result.pvIes );
+            //if pBssDesc->Result.pvIes is NULL, we need to free any memory allocated by csrMatchBSS
+            //for any error condition, otherwiase, it will be freed later.
+            //reset
+            fMatch = eANI_BOOLEAN_FALSE;
+            pNewIes = NULL;
+
+            if(pFilter)
+            {
+                fMatch = csrMatchBSS(pMac, &pBssDesc->Result.BssDescriptor, pFilter, &auth, &uc, &mc, &pIes);
+                if( NULL != pIes )
+                {
+                    //Only save it when matching
+                    if(fMatch)
+                    {
+                        if( !pBssDesc->Result.pvIes )
+                        {
+                            //csrMatchBSS allocates the memory. Simply pass it and it is freed later
+                            pNewIes = pIes;
+                        }
+                        else
+                        {
+                            //The pIes is allocated by someone else. make a copy
+                            //Only to save parsed IEs if caller provides a filter. Most likely the caller
+                            //is using to for association, hence save the parsed IEs
+                            status = palAllocateMemory(pMac->hHdd, (void **)&pNewIes, sizeof(tDot11fBeaconIEs));
+                            if( HAL_STATUS_SUCCESS( status ) )
+                            {
+                                palCopyMemory( pMac->hHdd, pNewIes, pIes, sizeof( tDot11fBeaconIEs ) );
+                            }
+                            else
+                            {
+                                smsLog(pMac, LOGE, FL(" fail to allocate memory for IEs\n"));
+                                //Need to free memory allocated by csrMatchBSS
+                                if( !pBssDesc->Result.pvIes )
+                                {
+                                    palFreeMemory(pMac->hHdd, pIes);
+                                }
+                                break;
+                            }
+                        }
+                    }//fMatch
+                    else if( !pBssDesc->Result.pvIes )
+                    {
+                        palFreeMemory(pMac->hHdd, pIes);
+                    }
+                }
+            }
+            if(NULL == pFilter || fMatch)
+            {
+                bssLen = pBssDesc->Result.BssDescriptor.length + sizeof(pBssDesc->Result.BssDescriptor.length);
+                allocLen = sizeof( tCsrScanResult ) + bssLen;
+                status = palAllocateMemory(pMac->hHdd, (void **)&pResult, allocLen);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    smsLog(pMac, LOGE, FL("  fail to allocate memory for scan result, len=%d\n"), allocLen);
+                    if(pNewIes)
+                    {
+                        palFreeMemory(pMac->hHdd, pNewIes);
+                    }
+                    break;
+                }
+                palZeroMemory(pMac->hHdd, pResult, allocLen);
+                pResult->capValue = pBssDesc->capValue;
+                pResult->preferValue = pBssDesc->preferValue;
+                pResult->ucEncryptionType = uc;
+                pResult->mcEncryptionType = mc;
+                pResult->authType = auth;
+                pResult->Result.ssId = pBssDesc->Result.ssId;
+                pResult->Result.timer = 0;
+                //save the pIes for later use
+                pResult->Result.pvIes = pNewIes;
+                //save bss description
+                status = palCopyMemory(pMac->hHdd, &pResult->Result.BssDescriptor, &pBssDesc->Result.BssDescriptor, bssLen);
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    smsLog(pMac, LOGE, FL("  fail to copy memory for scan result\n"));
+                    palFreeMemory(pMac->hHdd, pResult);
+                    if(pNewIes)
+                    {
+                        palFreeMemory(pMac->hHdd, pNewIes);
+                    }
+                    break;
+                }
+                //No need to lock pRetList because it is locally allocated and no outside can access it at this time
+                if(csrLLIsListEmpty(&pRetList->List, LL_ACCESS_NOLOCK))
+                {
+                    csrLLInsertTail(&pRetList->List, &pResult->Link, LL_ACCESS_NOLOCK);
+                }
+                else
+                {
+                    //To sort the list
+                    tListElem *pTmpEntry;
+                    tCsrScanResult *pTmpResult;
+                    
+                    pTmpEntry = csrLLPeekHead(&pRetList->List, LL_ACCESS_NOLOCK);
+                    while(pTmpEntry)
+                    {
+                        pTmpResult = GET_BASE_ADDR( pTmpEntry, tCsrScanResult, Link );
+                        if(csrIsBetterBss(pResult, pTmpResult))
+                        {
+                            csrLLInsertEntry(&pRetList->List, pTmpEntry, &pResult->Link, LL_ACCESS_NOLOCK);
+                            //To indicate we are done
+                            pResult = NULL;
+                            break;
+                        }
+                        pTmpEntry = csrLLNext(&pRetList->List, pTmpEntry, LL_ACCESS_NOLOCK);
+                    }
+                    if(pResult != NULL)
+                    {
+                        //This one is not better than any one
+                        csrLLInsertTail(&pRetList->List, &pResult->Link, LL_ACCESS_NOLOCK);
+                    }
+                }
+                count++;
+            }
+            pEntry = csrLLNext( &pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK );
+        }//while
+        csrLLUnlock(&pMac->scan.scanResultList);
+        
+        smsLog(pMac, LOG2, FL("return %d BSS\n"), csrLLCount(&pRetList->List));
+        
+        if( !HAL_STATUS_SUCCESS(status) || (phResult == NULL) )
+        {
+            //Fail or No one wants the result.
+            csrScanResultPurge(pMac, (tScanResultHandle)pRetList);
+        }
+        else
+        {
+            if(0 == count)
+            {
+                //We are here meaning the there is no match
+                csrLLClose(&pRetList->List);
+                palFreeMemory(pMac->hHdd, pRetList);
+                status = eHAL_STATUS_E_NULL_VALUE;
+            }
+            else if(phResult)
+            {
+                *phResult = pRetList;
+            }
+        }
+    }//Allocated pRetList
+    
+    return (status);
+}
+
+
+eHalStatus csrScanFlushResult(tpAniSirGlobal pMac)
+{
+    return ( csrLLScanPurgeResult(pMac, &pMac->scan.scanResultList) );
+}
+
+/**
+ * csrCheck11dChannel
+ *
+ *FUNCTION:
+ * This function is called from csrScanFilter11dResult function and
+ * compare channel number with given channel list.
+ *
+ *LOGIC:
+ * Check Scan result channel number with CFG channel list
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param  channelId      channel number
+ * @param  pChannelList   Pointer to channel list
+ * @param  numChannels    Number of channel in channel list
+ *
+ * @return Status
+ */
+
+eHalStatus csrCheck11dChannel(tANI_U8 channelId, tANI_U8 *pChannelList, tANI_U32 numChannels)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tANI_U8 i = 0;
+
+    for (i = 0; i < numChannels; i++)
+    {
+        if(pChannelList[ i ] == channelId)
+        {
+            status = eHAL_STATUS_SUCCESS;
+            break;
+        }
+    }
+    return status;
+}
+
+/**
+ * csrScanFilter11dResult
+ *
+ *FUNCTION:
+ * This function is called from csrApplyCountryInformation function and
+ * filter scan result based on valid channel list number.
+ *
+ *LOGIC:
+ * Get scan result from scan list and Check Scan result channel number
+ * with 11d channel list if channel number is found in 11d channel list
+ * then do not remove scan result entry from scan list
+ *
+ *ASSUMPTIONS:
+ *
+ *
+ *NOTE:
+ *
+ * @param  pMac        Pointer to Global MAC structure
+ *
+ * @return Status
+ */
+
+eHalStatus csrScanFilter11dResult(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry,*pTempEntry;
+    tCsrScanResult *pBssDesc;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+
+    /* Get valid channels list from CFG */
+    if (!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
+                                      pMac->roam.validChannelList, &len)))
+    {
+        smsLog( pMac, LOG1, "Failed to get Channel list from CFG");
+    }
+
+    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
+    while( pEntry )
+    {
+        pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+        pTempEntry = csrLLNext( &pMac->scan.scanResultList, pEntry, 
+                                                            LL_ACCESS_LOCK );
+        if(csrCheck11dChannel(pBssDesc->Result.BssDescriptor.channelId,
+                                              pMac->roam.validChannelList, len))
+        {
+            /* Remove Scan result which does not have 11d channel */
+            if( csrLLRemoveEntry( &pMac->scan.scanResultList, pEntry,
+                                                              LL_ACCESS_LOCK ))
+            {
+                csrFreeScanResultEntry( pMac, pBssDesc );
+            }
+        }
+        pEntry = pTempEntry;
+    }
+    return status;
+}
+
+
+eHalStatus csrScanCopyResultList(tpAniSirGlobal pMac, tScanResultHandle hIn, tScanResultHandle *phResult)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tScanResultList *pRetList, *pInList = (tScanResultList *)hIn;
+    tCsrScanResult *pResult, *pScanResult;
+    tANI_U32 count = 0;
+    tListElem *pEntry;
+    tANI_U32 bssLen, allocLen;
+    
+    if(phResult)
+    {
+        *phResult = CSR_INVALID_SCANRESULT_HANDLE;
+    }
+    status = palAllocateMemory(pMac->hHdd, (void **)&pRetList, sizeof(tScanResultList));
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pRetList, sizeof(tScanResultList));
+        csrLLOpen(pMac->hHdd, &pRetList->List);
+        pRetList->pCurEntry = NULL;
+        csrLLLock(&pMac->scan.scanResultList);
+        csrLLLock(&pInList->List);
+        
+        pEntry = csrLLPeekHead( &pInList->List, LL_ACCESS_NOLOCK );
+        while( pEntry ) 
+        {
+            pScanResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+            bssLen = pScanResult->Result.BssDescriptor.length + sizeof(pScanResult->Result.BssDescriptor.length);
+            allocLen = sizeof( tCsrScanResult ) + bssLen;
+            status = palAllocateMemory(pMac->hHdd, (void **)&pResult, allocLen);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                csrScanResultPurge(pMac, (tScanResultHandle *)pRetList);
+                count = 0;
+                break;
+            }
+            palZeroMemory(pMac->hHdd, pResult, allocLen);
+            status = palCopyMemory(pMac->hHdd, &pResult->Result.BssDescriptor, &pScanResult->Result.BssDescriptor, bssLen);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                csrScanResultPurge(pMac, (tScanResultHandle *)pRetList);
+                count = 0;
+                break;
+            }
+            if( pScanResult->Result.pvIes )
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pResult->Result.pvIes, sizeof( tDot11fBeaconIEs ));
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    //Free the memory we allocate above first
+                    palFreeMemory( pMac->hHdd, pResult );
+                    csrScanResultPurge(pMac, (tScanResultHandle *)pRetList);
+                    count = 0;
+                    break;
+                }
+                status = palCopyMemory(pMac->hHdd, pResult->Result.pvIes, 
+                                pScanResult->Result.pvIes, sizeof( tDot11fBeaconIEs ));
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    //Free the memory we allocate above first
+                    palFreeMemory( pMac->hHdd, pResult );
+                    csrScanResultPurge(pMac, (tScanResultHandle *)pRetList);
+                    count = 0;
+                    break;
+                }
+            }
+            csrLLInsertTail(&pRetList->List, &pResult->Link, LL_ACCESS_LOCK);
+            count++;
+            pEntry = csrLLNext( &pInList->List, pEntry, LL_ACCESS_NOLOCK );
+        }//while
+        csrLLUnlock(&pInList->List);
+        csrLLUnlock(&pMac->scan.scanResultList);
+        
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            if(0 == count)
+            {
+                csrLLClose(&pRetList->List);
+                palFreeMemory(pMac->hHdd, pRetList);
+                status = eHAL_STATUS_E_NULL_VALUE;
+            }
+            else if(phResult)
+            {
+                *phResult = pRetList;
+            }
+        }
+    }//Allocated pRetList
+    
+    return (status);
+}
+
+
+ 
+eHalStatus csrScanningStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirMbMsg *pMsg = (tSirMbMsg *)pMsgBuf;
+
+    if((eWNI_SME_SCAN_RSP == pMsg->type) || (eWNI_SME_GET_SCANNED_CHANNEL_RSP == pMsg->type))
+    {
+        status = csrScanSmeScanResponse( pMac, pMsgBuf );
+    }
+    else
+    {
+        if( csrIsAnySessionInConnectState( pMac ) )
+        {
+            //In case of we are connected, we need to check whether connect status changes
+            //because scan may also run while connected.
+            csrRoamCheckForLinkStatusChange( pMac, ( tSirSmeRsp * )pMsgBuf );
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "Message [0x%04x] received in state, when expecting Scan Response\n", pMsg->type );
+        }
+    }
+
+    return (status);
+}
+
+
+
+void csrCheckNSaveWscIe(tpAniSirGlobal pMac, tSirBssDescription *pNewBssDescr, tSirBssDescription *pOldBssDescr)
+{
+    int idx, len;
+    tANI_U8 *pbIe;
+
+    //If failed to remove, assuming someone else got it.
+    if((pNewBssDescr->fProbeRsp != pOldBssDescr->fProbeRsp) &&
+       (0 == pNewBssDescr->WscIeLen))
+    {
+        idx = 0;
+        len = pOldBssDescr->length - sizeof(tSirBssDescription) + 
+                sizeof(tANI_U16) + sizeof(tANI_U32) - DOT11F_IE_WSCPROBERES_MIN_LEN - 2;
+        pbIe = (tANI_U8 *)pOldBssDescr->ieFields;
+        //Save WPS IE if it exists
+        pNewBssDescr->WscIeLen = 0;
+        while(idx < len)
+        {
+            if((DOT11F_EID_WSCPROBERES == pbIe[0]) &&
+                (0x00 == pbIe[2]) && (0x50 == pbIe[3]) && (0xf2 == pbIe[4]) && (0x04 == pbIe[5]))
+            {
+                //Founrd it
+                if((DOT11F_IE_WSCPROBERES_MAX_LEN - 2) >= pbIe[1])
+                {
+                    palCopyMemory(pMac->hHdd, pNewBssDescr->WscIeProbeRsp,
+                                   pbIe, pbIe[1] + 2);
+                    pNewBssDescr->WscIeLen = pbIe[1] + 2;
+                }
+                break;
+            }
+            idx += pbIe[1] + 2;
+            pbIe += pbIe[1] + 2;
+        }
+    }
+}
+
+
+
+//pIes may be NULL
+tANI_BOOLEAN csrRemoveDupBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDescr,
+                                         tDot11fBeaconIEs *pIes, tAniSSID *pSsid , v_TIME_t *timer ) 
+{
+    tListElem *pEntry;
+
+    tCsrScanResult *pBssDesc;
+    tANI_BOOLEAN fRC = FALSE;
+
+    // Walk through all the chained BssDescriptions.  If we find a chained BssDescription that
+    // matches the BssID of the BssDescription passed in, then these must be duplicate scan
+    // results for this Bss.  In that case, remove the 'old' Bss description from the linked list.
+    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
+
+    while( pEntry ) 
+    {
+        pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+
+        // we have a duplicate scan results only when BSSID, SSID, Channel and NetworkType
+        // matches
+        if ( csrIsDuplicateBssDescription( pMac, &pBssDesc->Result.BssDescriptor, 
+                                                        pSirBssDescr, pIes ) )
+        {
+            pSirBssDescr->rssi = (tANI_S8)( (((tANI_S32)pSirBssDescr->rssi * CSR_SCAN_RESULT_RSSI_WEIGHT ) +
+                                             ((tANI_S32)pBssDesc->Result.BssDescriptor.rssi * (100 - CSR_SCAN_RESULT_RSSI_WEIGHT) )) / 100 );
+            // Remove the 'old' entry from the list....
+            if( csrLLRemoveEntry( &pMac->scan.scanResultList, pEntry, LL_ACCESS_LOCK ) )
+            {
+                // !we need to free the memory associated with this node
+                //If failed to remove, assuming someone else got it.
+                *pSsid = pBssDesc->Result.ssId;
+                *timer = pBssDesc->Result.timer;
+                csrCheckNSaveWscIe(pMac, pSirBssDescr, &pBssDesc->Result.BssDescriptor);
+                
+                csrFreeScanResultEntry( pMac, pBssDesc );
+            }
+            else
+            {
+                smsLog( pMac, LOGW, FL( "  fail to remove entry\n" ) );
+            }
+            fRC = TRUE;
+
+            // If we found a match, we can stop looking through the list.
+            break;
+        }
+
+        pEntry = csrLLNext( &pMac->scan.scanResultList, pEntry, LL_ACCESS_LOCK );
+    }
+
+    return fRC;
+}
+
+
+eHalStatus csrAddPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "csrAddPMKIDCandidateList called pMac->scan.NumPmkidCandidate = %d\n", pSession->NumPmkidCandidate);
+    if( pIes )
+    {
+        // check if this is a RSN BSS
+        if( pIes->RSN.present )
+        {
+            // Check if the BSS is capable of doing pre-authentication
+            if( pSession->NumPmkidCandidate < CSR_MAX_PMKID_ALLOWED )
+            {
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                {
+                    WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type);
+                    palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type));
+                    secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_CANDIDATE_FOUND;
+                    secEvent.encryptionModeMulticast = 
+                        (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
+                    secEvent.encryptionModeUnicast = 
+                        (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
+                    palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 );
+                    secEvent.authMode = 
+                        (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
+                    WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY);
+                }
+#endif//#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+                // if yes, then add to PMKIDCandidateList
+                status = palCopyMemory(pMac->hHdd, pSession->PmkidCandidateInfo[pSession->NumPmkidCandidate].BSSID, 
+                                            pBssDesc->bssId, WNI_CFG_BSSID_LEN);
+            
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    if ( pIes->RSN.preauth )
+                    {
+                        pSession->PmkidCandidateInfo[pSession->NumPmkidCandidate].preAuthSupported = eANI_BOOLEAN_TRUE;
+                    }
+                    else
+                    {
+                        pSession->PmkidCandidateInfo[pSession->NumPmkidCandidate].preAuthSupported = eANI_BOOLEAN_FALSE;
+                    }
+                    pSession->NumPmkidCandidate++;
+                }
+            }
+            else
+            {
+                status = eHAL_STATUS_FAILURE;
+            }
+        }
+    }
+
+    return (status);
+}
+
+//This function checks whether new AP is found for the current connected profile
+//If it is found, it return the sessionId, else it return invalid sessionID
+tANI_U32 csrProcessBSSDescForPMKIDList(tpAniSirGlobal pMac, 
+                                           tSirBssDescription *pBssDesc,
+                                           tDot11fBeaconIEs *pIes)
+{
+    tANI_U32 i, bRet = CSR_SESSION_ID_INVALID;
+    tCsrRoamSession *pSession;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    if( pIesLocal || HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal)) )
+    {
+        for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+        {
+            if( CSR_IS_SESSION_VALID( pMac, i ) )
+            {
+                pSession = CSR_GET_SESSION( pMac, i );
+                if( csrIsConnStateConnectedInfra( pMac, i ) && 
+                    ( eCSR_AUTH_TYPE_RSN == pSession->connectedProfile.AuthType ) )
+                {
+                    if(csrMatchBSSToConnectProfile(pMac, &pSession->connectedProfile, pBssDesc, pIesLocal))
+                    {
+                        //this new BSS fits the current profile connected
+                        if(HAL_STATUS_SUCCESS(csrAddPMKIDCandidateList(pMac, i, pBssDesc, pIesLocal)))
+                        {
+                            bRet = i;
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        if( !pIes )
+        {
+            palFreeMemory(pMac->hHdd, pIesLocal);
+        }
+    }
+
+    return (tANI_U8)bRet;
+}
+
+#ifdef FEATURE_WLAN_WAPI
+eHalStatus csrAddBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                    tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "csrAddBKIDCandidateList called pMac->scan.NumBkidCandidate = %d\n", pSession->NumBkidCandidate);
+    if( pIes )
+    {
+        // check if this is a WAPI BSS
+        if( pIes->WAPI.present )
+        {
+            // Check if the BSS is capable of doing pre-authentication
+            if( pSession->NumBkidCandidate < CSR_MAX_BKID_ALLOWED )
+            {
+
+                // if yes, then add to BKIDCandidateList
+                status = palCopyMemory(pMac->hHdd, pSession->BkidCandidateInfo[pSession->NumBkidCandidate].BSSID, 
+                                            pBssDesc->bssId, WNI_CFG_BSSID_LEN);
+            
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    if ( pIes->WAPI.preauth )
+                    {
+                        pSession->BkidCandidateInfo[pSession->NumBkidCandidate].preAuthSupported = eANI_BOOLEAN_TRUE;
+                    }
+                    else
+                    {
+                        pSession->BkidCandidateInfo[pSession->NumBkidCandidate].preAuthSupported = eANI_BOOLEAN_FALSE;
+                    }
+                    pSession->NumBkidCandidate++;
+                }
+            }
+            else
+            {
+                status = eHAL_STATUS_FAILURE;
+            }
+        }
+    }
+
+    return (status);
+}
+
+//This function checks whether new AP is found for the current connected profile
+//if so add to BKIDCandidateList
+tANI_BOOLEAN csrProcessBSSDescForBKIDList(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc,
+                                          tDot11fBeaconIEs *pIes)
+{
+    tANI_BOOLEAN fRC = FALSE;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+    tANI_U32 sessionId;
+    tCsrRoamSession *pSession;
+
+    if( pIesLocal || HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal)) )
+    {
+        for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
+        {
+            if( CSR_IS_SESSION_VALID( pMac, sessionId) )
+            {
+                pSession = CSR_GET_SESSION( pMac, sessionId );
+                if( csrIsConnStateConnectedInfra( pMac, sessionId ) && 
+                    eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == pSession->connectedProfile.AuthType)
+                {
+                    if(csrMatchBSSToConnectProfile(pMac, &pSession->connectedProfile,pBssDesc, pIesLocal))
+                    {
+                        //this new BSS fits the current profile connected
+                        if(HAL_STATUS_SUCCESS(csrAddBKIDCandidateList(pMac, sessionId, pBssDesc, pIesLocal)))
+                        {
+                            fRC = TRUE;
+                        }
+                    }
+                }
+            }
+        }
+        if(!pIes)
+        {
+            palFreeMemory(pMac->hHdd, pIesLocal);
+        }
+
+    }
+    return fRC;
+}
+
+#endif
+
+
+static void csrMoveTempScanResultsToMainList( tpAniSirGlobal pMac )
+{
+    tListElem *pEntry;
+    tCsrScanResult *pBssDescription;
+    tANI_S8         cand_Bss_rssi;
+    tANI_BOOLEAN    fDupBss;
+#ifdef FEATURE_WLAN_WAPI
+    tANI_BOOLEAN fNewWapiBSSForCurConnection = eANI_BOOLEAN_FALSE;
+#endif /* FEATURE_WLAN_WAPI */
+    tDot11fBeaconIEs *pIesLocal = NULL;
+    tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
+    tAniSSID tmpSsid;
+    v_TIME_t timer=0;
+
+    tmpSsid.length = 0;
+    cand_Bss_rssi = -128; // RSSI coming from PE is -ve
+
+    // remove the BSS descriptions from temporary list
+    while( ( pEntry = csrLLRemoveTail( &pMac->scan.tempScanResults, LL_ACCESS_LOCK ) ) != NULL)
+    {
+        pBssDescription = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+
+        smsLog( pMac, LOGW, "...Bssid= %02x-%02x-%02x-%02x-%02x-%02x chan= %d, rssi = -%d\n",
+                      pBssDescription->Result.BssDescriptor.bssId[ 0 ], pBssDescription->Result.BssDescriptor.bssId[ 1 ],
+                      pBssDescription->Result.BssDescriptor.bssId[ 2 ], pBssDescription->Result.BssDescriptor.bssId[ 3 ],
+                      pBssDescription->Result.BssDescriptor.bssId[ 4 ], pBssDescription->Result.BssDescriptor.bssId[ 5 ],
+                      pBssDescription->Result.BssDescriptor.channelId,
+                pBssDescription->Result.BssDescriptor.rssi * (-1) );
+
+        //At this time, pBssDescription->Result.pvIes may be NULL
+        pIesLocal = (tDot11fBeaconIEs *)( pBssDescription->Result.pvIes );
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pBssDescription->Result.BssDescriptor, &pIesLocal))) )
+        {
+            smsLog(pMac, LOGE, FL("  Cannot pared IEs\n"));
+            csrFreeScanResultEntry(pMac, pBssDescription);
+            continue;
+        }
+        fDupBss = csrRemoveDupBssDescription( pMac, &pBssDescription->Result.BssDescriptor, pIesLocal, &tmpSsid , &timer );
+        //Check whether we have reach out limit
+        if( CSR_SCAN_IS_OVER_BSS_LIMIT(pMac) )
+        {
+            //Limit reach
+            smsLog(pMac, LOGW, FL("  BSS limit reached\n"));
+            //Free the resources
+            if( (pBssDescription->Result.pvIes == NULL) && pIesLocal )
+            {
+                palFreeMemory(pMac->hHdd, pIesLocal);
+            }
+            csrFreeScanResultEntry(pMac, pBssDescription);
+            //Continue because there may be duplicated BSS
+            continue;
+        }
+        // check for duplicate scan results
+        if ( !fDupBss )
+        {
+            //Found a new BSS
+            sessionId = csrProcessBSSDescForPMKIDList(pMac, 
+                             &pBssDescription->Result.BssDescriptor, pIesLocal);
+            if( CSR_SESSION_ID_INVALID != sessionId)
+            {
+                csrRoamCallCallback(pMac, sessionId, NULL, 0, 
+                           eCSR_ROAM_SCAN_FOUND_NEW_BSS, eCSR_ROAM_RESULT_NONE);
+            }
+        }
+        else
+        {
+            //Check if the new one has SSID it it, if not, use the older SSID if it exists.
+            if( (0 == pBssDescription->Result.ssId.length) && tmpSsid.length )
+            {
+                //New BSS has a hidden SSID and old one has the SSID. Keep the SSID only 
+                //if diff of saved SSID time and current time is less than 1 min to avoid
+                //side effect of saving SSID with old one is that if AP changes its SSID while remain
+                //hidden, we may never see it and also to address the requirement of 
+                //When we remove hidden ssid from the profile i.e., forget the SSID via 
+                // GUI that SSID shouldn't see in the profile
+                if( (vos_timer_get_system_time() - timer) <= HIDDEN_TIMER)
+                {
+                   pBssDescription->Result.timer = timer;
+                   pBssDescription->Result.ssId = tmpSsid;
+                }
+            }
+        }
+
+        //Tush: find a good AP for 11d info
+        if( csrIs11dSupported( pMac ) )
+        {
+            if(cand_Bss_rssi < pBssDescription->Result.BssDescriptor.rssi)
+            {
+                // check if country information element is present
+                if(pIesLocal->Country.present)
+                {
+                    cand_Bss_rssi = pBssDescription->Result.BssDescriptor.rssi;
+                    // learn country information
+                    csrLearnCountryInformation( pMac, &pBssDescription->Result.BssDescriptor, 
+                             pIesLocal, eANI_BOOLEAN_FALSE );
+                }
+
+            }
+        }
+
+        // append to main list
+        csrScanAddResult(pMac, pBssDescription, pIesLocal);
+        if( (pBssDescription->Result.pvIes == NULL) && pIesLocal )
+        {
+            palFreeMemory(pMac->hHdd, pIesLocal);
+        }
+    }
+
+    //Tush: If we can find the current 11d info in any of the scan results, or
+    // a good enough AP with the 11d info from the scan results then no need to
+    // get into ambiguous state
+    if(pMac->scan.fAmbiguous11dInfoFound) 
+    {
+      if((pMac->scan.fCurrent11dInfoMatch) || (cand_Bss_rssi != -128))
+      {
+        pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE;
+      }
+    }
+
+#ifdef FEATURE_WLAN_WAPI
+    if(fNewWapiBSSForCurConnection)
+    {
+        //remember it first
+        csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_SCAN_FOUND_NEW_BSS, eCSR_ROAM_RESULT_NEW_WAPI_BSS);
+    }
+#endif /* FEATURE_WLAN_WAPI */
+
+    return;
+}
+
+
+static tCsrScanResult *csrScanSaveBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription,
+                                                  tDot11fBeaconIEs *pIes)
+{
+    tCsrScanResult *pCsrBssDescription = NULL;
+    tANI_U32 cbBSSDesc;
+    tANI_U32 cbAllocated;
+    eHalStatus halStatus;
+
+    // figure out how big the BSS description is (the BSSDesc->length does NOT
+    // include the size of the length field itself).
+    cbBSSDesc = pBSSDescription->length + sizeof( pBSSDescription->length );
+
+    cbAllocated = sizeof( tCsrScanResult ) + cbBSSDesc;
+
+    halStatus = palAllocateMemory( pMac->hHdd, (void **)&pCsrBssDescription, cbAllocated );
+    if ( HAL_STATUS_SUCCESS(halStatus) )
+    {
+        palZeroMemory( pMac->hHdd, pCsrBssDescription, cbAllocated );
+        pCsrBssDescription->AgingCount = (tANI_S32)pMac->roam.configParam.agingCount;
+        palCopyMemory(pMac->hHdd, &pCsrBssDescription->Result.BssDescriptor, pBSSDescription, cbBSSDesc );
+#if defined(VOSS_ENSBALED)
+        VOS_ASSERT( pCsrBssDescription->Result.pvIes == NULL );
+#endif
+        csrScanAddResult(pMac, pCsrBssDescription, pIes);
+    }
+
+    return( pCsrBssDescription );
+}
+
+// Append a Bss Description...
+tCsrScanResult *csrScanAppendBssDescription( tpAniSirGlobal pMac, 
+                                             tSirBssDescription *pSirBssDescription, 
+                                             tDot11fBeaconIEs *pIes )
+{
+    tCsrScanResult *pCsrBssDescription = NULL;
+    tAniSSID tmpSsid;
+    v_TIME_t timer = 0;
+    int result;
+
+    tmpSsid.length = 0;
+    result = csrRemoveDupBssDescription( pMac, pSirBssDescription, pIes, &tmpSsid, &timer );
+    pCsrBssDescription = csrScanSaveBssDescription( pMac, pSirBssDescription, pIes );
+    if (result && (pCsrBssDescription != NULL))
+    {
+        //Check if the new one has SSID it it, if not, use the older SSID if it exists.
+        if( (0 == pCsrBssDescription->Result.ssId.length) && tmpSsid.length )
+        {
+            //New BSS has a hidden SSID and old one has the SSID. Keep the SSID only
+            //if diff of saved SSID time and current time is less than 1 min to avoid
+            //side effect of saving SSID with old one is that if AP changes its SSID while remain
+            //hidden, we may never see it and also to address the requirement of
+            //When we remove hidden ssid from the profile i.e., forget the SSID via
+            // GUI that SSID shouldn't see in the profile
+            if((vos_timer_get_system_time()-timer) <= HIDDEN_TIMER)
+            { 
+              pCsrBssDescription->Result.ssId = tmpSsid;
+              pCsrBssDescription->Result.timer = timer;
+            }
+        }
+    }
+
+
+    return( pCsrBssDescription );
+}
+
+
+
+void csrPurgeChannelPower( tpAniSirGlobal pMac, tDblLinkList *pChannelList )
+{
+    tCsrChannelPowerInfo *pChannelSet;
+    tListElem *pEntry;
+
+    csrLLLock(pChannelList); 
+    // Remove the channel sets from the learned list and put them in the free list
+    while( ( pEntry = csrLLRemoveHead( pChannelList, LL_ACCESS_NOLOCK ) ) != NULL)
+    {
+        pChannelSet = GET_BASE_ADDR( pEntry, tCsrChannelPowerInfo, link );
+        if( pChannelSet )
+        {
+            palFreeMemory( pMac->hHdd, pChannelSet );
+        }
+    }
+    csrLLUnlock(pChannelList);
+    return;
+}
+
+
+/*
+ * Save the channelList into the ultimate storage as the final stage of channel 
+ * Input: pCountryInfo -- the country code (e.g. "USI"), channel list, and power limit are all stored inside this data structure
+ */
+void csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable )
+{
+    tANI_U32 i = tableSize / sizeof( tSirMacChanInfo );
+    tSirMacChanInfo *pChannelInfo;
+    tCsrChannelPowerInfo *pChannelSet;
+    tANI_BOOLEAN f2GHzInfoFound = FALSE;
+    tANI_BOOLEAN f2GListPurged = FALSE, f5GListPurged = FALSE;
+    eHalStatus halStatus;
+
+    pChannelInfo = channelTable;
+    // atleast 3 bytes have to be remaining  -- from "countryString"
+    while ( i-- )
+    {
+        halStatus = palAllocateMemory( pMac->hHdd, (void **)&pChannelSet, sizeof(tCsrChannelPowerInfo) );
+        if ( eHAL_STATUS_SUCCESS == halStatus )
+        {
+            palZeroMemory(pMac->hHdd, pChannelSet, sizeof(tCsrChannelPowerInfo));
+            pChannelSet->firstChannel = pChannelInfo->firstChanNum;
+            pChannelSet->numChannels = pChannelInfo->numChannels;
+
+            // Now set the inter-channel offset based on the frequency band the channel set lies in
+            if( CSR_IS_CHANNEL_24GHZ(pChannelSet->firstChannel) )
+            {
+                pChannelSet->interChannelOffset = 1;
+                f2GHzInfoFound = TRUE;
+            }
+            else
+            {
+                pChannelSet->interChannelOffset = 4;
+                f2GHzInfoFound = FALSE;
+            }
+            pChannelSet->txPower = CSR_ROAM_MIN( pChannelInfo->maxTxPower, pMac->roam.configParam.nTxPowerCap );
+
+            if( f2GHzInfoFound )
+            {
+                if( !f2GListPurged )
+                {
+                    // purge previous results if found new
+                    csrPurgeChannelPower( pMac, &pMac->scan.channelPowerInfoList24 );
+                    f2GListPurged = TRUE;
+                }
+
+                if(CSR_IS_OPERATING_BG_BAND(pMac))
+                {
+                    // add to the list of 2.4 GHz channel sets
+                    csrLLInsertTail( &pMac->scan.channelPowerInfoList24, &pChannelSet->link, LL_ACCESS_LOCK );
+                }
+                else {
+                    smsLog( pMac, LOGW, FL("Adding 11B/G channels in 11A mode -- First Channel is %d"), 
+                                pChannelSet->firstChannel);
+                    palFreeMemory(pMac->hHdd, pChannelSet);
+                }
+            }
+            else
+            {
+                // 5GHz info found
+                if( !f5GListPurged )
+                {
+                    // purge previous results if found new
+                    csrPurgeChannelPower( pMac, &pMac->scan.channelPowerInfoList5G );
+                    f5GListPurged = TRUE;
+                }
+
+                if(CSR_IS_OPERATING_A_BAND(pMac))
+                {
+                    // add to the list of 5GHz channel sets
+                    csrLLInsertTail( &pMac->scan.channelPowerInfoList5G, &pChannelSet->link, LL_ACCESS_LOCK );
+                }
+                else {
+                    smsLog( pMac, LOGW, FL("Adding 11A channels in B/G mode -- First Channel is %d"), 
+                                pChannelSet->firstChannel);
+                    palFreeMemory(pMac->hHdd, pChannelSet);
+                }
+            }
+        }
+
+        pChannelInfo++;                // move to next entry
+    }
+
+    return;
+}
+
+
+
+void csrApplyPower2Current( tpAniSirGlobal pMac )
+{
+    smsLog( pMac, LOG3, FL(" Updating Cfg with power settings\n"));
+    csrSaveTxPowerToCfg( pMac, &pMac->scan.channelPowerInfoList24, WNI_CFG_MAX_TX_POWER_2_4 );
+    csrSaveTxPowerToCfg( pMac, &pMac->scan.channelPowerInfoList5G, WNI_CFG_MAX_TX_POWER_5 );
+}
+
+
+void csrApplyChannelPowerCountryInfo( tpAniSirGlobal pMac, tCsrChannel *pChannelList, tANI_U8 *countryCode)
+{
+    int i;
+    eNVChannelEnabledType channelEnabledType;
+    tANI_U8 numChannels = 0;
+    tANI_U8 tempNumChannels = 0;
+    tCsrChannel ChannelList;
+    if( pChannelList->numChannels )
+    {
+        tempNumChannels = CSR_MIN(pChannelList->numChannels, WNI_CFG_VALID_CHANNEL_LIST_LEN);
+        /* If user doesn't want to scan the DFS channels lets trim them from 
+        the valid channel list*/
+        if(FALSE == pMac->scan.fEnableDFSChnlScan)
+        {
+            for(i = 0; i< tempNumChannels; i++)
+            {
+                 channelEnabledType = 
+                     vos_nv_getChannelEnabledState(pChannelList->channelList[i]);
+                 if( NV_CHANNEL_ENABLE ==  channelEnabledType)
+                 {
+                     ChannelList.channelList[numChannels] =
+                         pChannelList->channelList[i];
+                     numChannels++;
+                 }
+            }
+            ChannelList.numChannels = numChannels;
+        }
+        else
+        {
+            ChannelList.numChannels = tempNumChannels;
+             vos_mem_copy(ChannelList.channelList,
+                          pChannelList->channelList,
+                          ChannelList.numChannels);
+        }
+
+        csrSetCfgValidChannelList(pMac, ChannelList.channelList, ChannelList.numChannels);
+        // extend scan capability
+        csrSetCfgScanControlList(pMac, countryCode, &ChannelList);     //  build a scan list based on the channel list : channel# + active/passive scan
+#ifdef FEATURE_WLAN_SCAN_PNO
+        // Send HAL UpdateScanParams message
+        //pmcUpdateScanParams(pMac, &(pMac->roam.configParam), pChannelList, TRUE);
+#endif // FEATURE_WLAN_SCAN_PNO
+    }
+    else
+    {
+        smsLog( pMac, LOGE, FL("  11D channel list is empty\n"));
+    }
+    csrApplyPower2Current( pMac );     // Store the channel+power info in the global place: Cfg 
+    csrSetCfgCountryCode(pMac, countryCode);
+}
+
+
+void csrResetCountryInformation( tpAniSirGlobal pMac, tANI_BOOLEAN fForce )
+{
+    if( fForce || (csrIs11dSupported( pMac ) && (!pMac->scan.f11dInfoReset)))
+    {
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+    {
+        vos_log_802_11d_pkt_type *p11dLog;
+        int Index;
+
+        WLAN_VOS_DIAG_LOG_ALLOC(p11dLog, vos_log_802_11d_pkt_type, LOG_WLAN_80211D_C);
+        if(p11dLog)
+        {
+            p11dLog->eventId = WLAN_80211D_EVENT_RESET;
+            palCopyMemory(pMac->hHdd, p11dLog->countryCode, pMac->scan.countryCodeCurrent, 3);
+            p11dLog->numChannel = pMac->scan.base20MHzChannels.numChannels;
+            if(p11dLog->numChannel <= VOS_LOG_MAX_NUM_CHANNEL)
+            {
+                palCopyMemory(pMac->hHdd, p11dLog->Channels, pMac->scan.base20MHzChannels.channelList,
+                                p11dLog->numChannel);
+                for (Index=0; Index < pMac->scan.base20MHzChannels.numChannels; Index++)
+                {
+                    p11dLog->TxPwr[Index] = CSR_ROAM_MIN( pMac->scan.defaultPowerTable[Index].pwr, pMac->roam.configParam.nTxPowerCap );
+                }
+            }
+            if(!pMac->roam.configParam.Is11dSupportEnabled)
+            {
+                p11dLog->supportMultipleDomain = WLAN_80211D_DISABLED;
+            }
+            else if(pMac->roam.configParam.fEnforceDefaultDomain)
+            {
+                p11dLog->supportMultipleDomain = WLAN_80211D_NOT_SUPPORT_MULTI_DOMAIN;
+            }
+            else
+            {
+                p11dLog->supportMultipleDomain = WLAN_80211D_SUPPORT_MULTI_DOMAIN;
+            }
+            WLAN_VOS_DIAG_LOG_REPORT(p11dLog);
+        }
+    }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+        // switch to passive scans only when 11d is enabled
+        if( csrIs11dSupported( pMac ) )
+        {
+            pMac->scan.curScanType = eSIR_PASSIVE_SCAN;
+        }
+        csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE);
+        csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
+        // ... and apply the channel list, power settings, and the country code.
+        csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent );
+        // clear the 11d channel list
+        palZeroMemory( pMac->hHdd, &pMac->scan.channels11d, sizeof(pMac->scan.channels11d) );
+        pMac->scan.f11dInfoReset = eANI_BOOLEAN_TRUE;
+        pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE;
+    }
+
+    return;
+}
+
+
+eHalStatus csrResetCountryCodeInformation(tpAniSirGlobal pMac, tANI_BOOLEAN *pfRestartNeeded)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fRestart = eANI_BOOLEAN_FALSE;
+
+    //Use the Country code and domain from EEPROM
+    palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN);
+    csrSetRegulatoryDomain(pMac, pMac->scan.domainIdCurrent, &fRestart);
+    if(eANI_BOOLEAN_FALSE == fRestart || (pfRestartNeeded == NULL))
+    {
+        //Only reset the country info if we don't need to restart
+        csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE);
+    }
+    if(pfRestartNeeded)
+    {
+        *pfRestartNeeded = fRestart;
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrSetCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    v_REGDOMAIN_t domainId;
+
+    if(pCountry)
+    {
+        status = csrGetRegulatoryDomainForCountry(pMac, pCountry, &domainId);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = csrSetRegulatoryDomain(pMac, domainId, pfRestartNeeded);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                //We don't need to check the pMac->roam.configParam.fEnforceDefaultDomain flag here,
+                //csrSetRegulatoryDomain will fail if the country doesn't fit our domain criteria.
+                palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, pCountry, WNI_CFG_COUNTRY_CODE_LEN);
+                if((pfRestartNeeded == NULL) || !(*pfRestartNeeded))
+                {
+                    //Simply set it to cfg. If we need to restart, restart will apply it to the CFG
+                    csrSetCfgCountryCode(pMac, pCountry);
+                }
+            }
+        }
+    }
+
+    return (status);
+}
+
+
+
+//caller allocated memory for pNumChn and pChnPowerInfo
+//As input, *pNumChn has the size of the array of pChnPowerInfo
+//Upon return, *pNumChn has the number of channels assigned.
+void csrGetChannelPowerInfo( tpAniSirGlobal pMac, tDblLinkList *pList,
+                             tANI_U32 *pNumChn, tChannelListWithPower *pChnPowerInfo)
+{
+    tListElem *pEntry;
+    tANI_U32 chnIdx = 0, idx;
+    tCsrChannelPowerInfo *pChannelSet;
+
+    //Get 2.4Ghz first
+    pEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
+    while( pEntry && (chnIdx < *pNumChn) )
+    {
+        pChannelSet = GET_BASE_ADDR( pEntry, tCsrChannelPowerInfo, link );
+        if ( 1 != pChannelSet->interChannelOffset )
+        {
+            for( idx = 0; (idx < pChannelSet->numChannels) && (chnIdx < *pNumChn); idx++ )
+            {
+                pChnPowerInfo[chnIdx].chanId = (tANI_U8)(pChannelSet->firstChannel + ( idx * pChannelSet->interChannelOffset ));
+                pChnPowerInfo[chnIdx++].pwr = pChannelSet->txPower;
+            }
+        }
+        else
+        {
+            for( idx = 0; (idx < pChannelSet->numChannels) && (chnIdx < *pNumChn); idx++ )
+            {
+                pChnPowerInfo[chnIdx].chanId = (tANI_U8)(pChannelSet->firstChannel + idx);
+                pChnPowerInfo[chnIdx++].pwr = pChannelSet->txPower;
+            }
+        }
+
+        pEntry = csrLLNext( pList, pEntry, LL_ACCESS_LOCK );
+    }
+    *pNumChn = chnIdx;
+
+    return ;
+}
+
+
+
+void csrApplyCountryInformation( tpAniSirGlobal pMac, tANI_BOOLEAN fForce )
+{
+    v_REGDOMAIN_t domainId;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    do
+    {
+        if( !csrIs11dSupported( pMac ) || 0 == pMac->scan.channelOf11dInfo) break;
+        if( pMac->scan.fAmbiguous11dInfoFound )
+        {
+            // ambiguous info found
+            //Restore te default domain as well
+            if(HAL_STATUS_SUCCESS(csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent, &domainId )))
+            {
+                pMac->scan.domainIdCurrent = domainId;
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL(" failed to get domain from currentCountryCode %02X%02X\n"), 
+                    pMac->scan.countryCodeCurrent[0], pMac->scan.countryCodeCurrent[1]);
+            }
+            csrResetCountryInformation( pMac, eANI_BOOLEAN_FALSE );
+            break;
+        }
+        if ( pMac->scan.f11dInfoApplied && !fForce ) break;
+        if(HAL_STATUS_SUCCESS(csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCode11d, &domainId )))
+        {
+            //Check whether we need to enforce default domain
+            if( ( !pMac->roam.configParam.fEnforceDefaultDomain ) ||
+                (pMac->scan.domainIdCurrent == domainId) )
+            {
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                {
+                    vos_log_802_11d_pkt_type *p11dLog;
+                    tChannelListWithPower chnPwrInfo[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+                    tANI_U32 nChnInfo = WNI_CFG_VALID_CHANNEL_LIST_LEN, nTmp;
+
+                    WLAN_VOS_DIAG_LOG_ALLOC(p11dLog, vos_log_802_11d_pkt_type, LOG_WLAN_80211D_C);
+                    if(p11dLog)
+                    {
+                        p11dLog->eventId = WLAN_80211D_EVENT_COUNTRY_SET;
+                        palCopyMemory(pMac->hHdd, p11dLog->countryCode, pMac->scan.countryCode11d, 3);
+                        p11dLog->numChannel = pMac->scan.channels11d.numChannels;
+                        if(p11dLog->numChannel <= VOS_LOG_MAX_NUM_CHANNEL)
+                        {
+                            palCopyMemory(pMac->hHdd, p11dLog->Channels, pMac->scan.channels11d.channelList,
+                                            p11dLog->numChannel);
+                            csrGetChannelPowerInfo(pMac, &pMac->scan.channelPowerInfoList24,
+                                                    &nChnInfo, chnPwrInfo);
+                            nTmp = nChnInfo;
+                            nChnInfo = WNI_CFG_VALID_CHANNEL_LIST_LEN - nTmp;
+                            csrGetChannelPowerInfo(pMac, &pMac->scan.channelPowerInfoList5G,
+                                                    &nChnInfo, &chnPwrInfo[nTmp]);
+                            for(nTmp = 0; nTmp < p11dLog->numChannel; nTmp++)
+                            {
+                                for(nChnInfo = 0; nChnInfo < WNI_CFG_VALID_CHANNEL_LIST_LEN; nChnInfo++)
+                                {
+                                    if(p11dLog->Channels[nTmp] == chnPwrInfo[nChnInfo].chanId)
+                                    {
+                                        p11dLog->TxPwr[nTmp] = chnPwrInfo[nChnInfo].pwr;
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                        if(!pMac->roam.configParam.Is11dSupportEnabled)
+                        {
+                            p11dLog->supportMultipleDomain = WLAN_80211D_DISABLED;
+                        }
+                        else if(pMac->roam.configParam.fEnforceDefaultDomain)
+                        {
+                            p11dLog->supportMultipleDomain = WLAN_80211D_NOT_SUPPORT_MULTI_DOMAIN;
+                        }
+                        else
+                        {
+                            p11dLog->supportMultipleDomain = WLAN_80211D_SUPPORT_MULTI_DOMAIN;
+                        }
+                        WLAN_VOS_DIAG_LOG_REPORT(p11dLog);
+                    }
+                }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+                if(pMac->scan.domainIdCurrent != domainId)
+                {
+                   /* Regulatory Domain Changed, Purge Only scan result 
+                    * which does not have channel number belong to 11d 
+                    * channel list
+                    * */
+                   smsLog(pMac, LOGW, FL("Domain Changed Old %d, new %d"),
+                                      pMac->scan.domainIdCurrent, domainId);
+                   csrScanFilter11dResult(pMac);
+                }
+                status = WDA_SetRegDomain(pMac, domainId);
+                if (status != eHAL_STATUS_SUCCESS)
+                {
+                    smsLog( pMac, LOGE, FL("  fail to set regId %d\n"), domainId );
+                }
+                pMac->scan.domainIdCurrent = domainId;
+                csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.channels11d, pMac->scan.countryCode11d );
+                // switch to active scans using this new channel list
+                pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
+                pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
+                pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
+            }
+        }
+
+    } while( 0 );
+
+    return;
+}
+
+
+
+tANI_BOOLEAN csrSave11dCountryString( tpAniSirGlobal pMac, tANI_U8 *pCountryCode,
+                     tANI_BOOLEAN fForce)
+{
+    tANI_BOOLEAN fCountryStringChanged = FALSE, fUnknownCountryCode = FALSE;
+    tANI_U32 i;
+
+    // convert to UPPER here so we are assured the strings are always in upper case.
+    for( i = 0; i < 3; i++ )
+    {
+        pCountryCode[ i ] = (tANI_U8)csrToUpper( pCountryCode[ i ] );
+    }
+
+    // Some of the 'old' Cisco 350 series AP's advertise NA as the country code (for North America ??).
+    // NA is not a valid country code or domain so let's allow this by changing it to the proper
+    // country code (which is US).  We've also seen some NETGEAR AP's that have "XX " as the country code
+    // with valid 2.4 GHz US channel information.  If we cannot find the country code advertised in the
+    // 11d information element, let's default to US.
+    if ( !HAL_STATUS_SUCCESS(csrGetRegulatoryDomainForCountry( pMac, pCountryCode, NULL ) ) )
+    {
+        // Check the enforcement first
+        if( pMac->roam.configParam.fEnforceDefaultDomain || pMac->roam.configParam.fEnforceCountryCodeMatch )
+        {
+            fUnknownCountryCode = TRUE;
+        }
+        else
+        {
+            pCountryCode[ 0 ] = 'U';
+            pCountryCode[ 1 ] = 'S';
+        }
+    }
+
+    // We've seen some of the AP's improperly put a 0 for the third character of the country code.
+    // spec says valid charcters are 'O' (for outdoor), 'I' for Indoor, or ' ' (space; for either).
+    // if we see a 0 in this third character, let's change it to a ' '.
+    if ( 0 == pCountryCode[ 2 ] )
+    {
+        pCountryCode[ 2 ] = ' ';
+    }
+
+    if( !fUnknownCountryCode )
+    {
+        fCountryStringChanged = (!palEqualMemory( pMac->hHdd,
+              pMac->scan.countryCode11d, pCountryCode, 2));
+
+
+        if(( 0 == pMac->scan.countryCode11d[ 0 ] && 0 == pMac->scan.countryCode11d[ 1 ] )
+             || (fForce))
+        {
+            // this is the first .11d information
+            palCopyMemory( pMac->hHdd, pMac->scan.countryCode11d, pCountryCode, sizeof( pMac->scan.countryCode11d ) );
+        }
+    }
+
+    return( fCountryStringChanged );
+}
+
+
+void csrSaveChannelPowerForBand( tpAniSirGlobal pMac, tANI_BOOLEAN fPopulate5GBand )
+{
+    tANI_U32 Index, count=0;
+    tSirMacChanInfo *pChanInfo;
+    tSirMacChanInfo *pChanInfoStart;
+
+    if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN)))
+    {
+        palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN);
+        pChanInfoStart = pChanInfo;
+        for (Index=0; Index < pMac->scan.base20MHzChannels.numChannels; Index++)
+        {
+            if ((fPopulate5GBand && (CSR_IS_CHANNEL_5GHZ(pMac->scan.defaultPowerTable[Index].chanId))) ||
+                (!fPopulate5GBand && (CSR_IS_CHANNEL_24GHZ(pMac->scan.defaultPowerTable[Index].chanId))) )
+            {
+                pChanInfo->firstChanNum = pMac->scan.defaultPowerTable[Index].chanId;
+                pChanInfo->numChannels  = 1;
+                pChanInfo->maxTxPower   = CSR_ROAM_MIN( pMac->scan.defaultPowerTable[Index].pwr, pMac->roam.configParam.nTxPowerCap );
+                pChanInfo++;
+                count++;
+            }
+        }
+        if(count)
+        {
+            csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart );
+        }
+        palFreeMemory(pMac->hHdd, pChanInfoStart);
+    }
+}
+
+
+void csrSetOppositeBandChannelInfo( tpAniSirGlobal pMac )
+{
+    tANI_BOOLEAN fPopulate5GBand = FALSE;
+
+    do 
+    {
+        // if this is not a dual band product, then we don't need to set the opposite
+        // band info.  We only work in one band so no need to look in the other band.
+        if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) break;
+        // if we found channel info on the 5.0 band and...
+        if ( CSR_IS_CHANNEL_5GHZ( pMac->scan.channelOf11dInfo ) )
+        {
+            // and the 2.4 band is empty, then populate the 2.4 channel info
+            if ( !csrLLIsListEmpty( &pMac->scan.channelPowerInfoList24, LL_ACCESS_LOCK ) ) break;
+            fPopulate5GBand = FALSE;
+        }
+        else
+        {
+            // else, we found channel info in the 2.4 GHz band.  If the 5.0 band is empty
+            // set the 5.0 band info from the 2.4 country code.
+            if ( !csrLLIsListEmpty( &pMac->scan.channelPowerInfoList5G, LL_ACCESS_LOCK ) ) break;
+            fPopulate5GBand = TRUE;
+        }
+        csrSaveChannelPowerForBand( pMac, fPopulate5GBand );
+
+    } while( 0 );
+}
+
+
+tANI_BOOLEAN csrIsSupportedChannel(tpAniSirGlobal pMac, tANI_U8 channelId)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tANI_U32 i;
+
+    //Make sure it is a channel that is in our supported list.
+    for ( i = 0; i < pMac->scan.baseChannels.numChannels; i++ )
+    {
+        if ( channelId == pMac->scan.baseChannels.channelList[i] )
+        {
+            fRet = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    //If it is configured to limit a set of the channels
+    if( fRet && pMac->roam.configParam.fEnforce11dChannels )
+    {
+        fRet = eANI_BOOLEAN_FALSE;
+        for ( i = 0; i < pMac->scan.base20MHzChannels.numChannels; i++ )
+        {
+            if ( channelId == pMac->scan.base20MHzChannels.channelList[i] )
+            {
+                fRet = eANI_BOOLEAN_TRUE;
+                break;
+            }
+        }
+    }
+
+    return (fRet);
+}
+
+
+
+//bSize specify the buffer size of pChannelList
+tANI_U8 csrGetChannelListFromChannelSet( tpAniSirGlobal pMac, tANI_U8 *pChannelList, tANI_U8 bSize, tCsrChannelPowerInfo *pChannelSet )
+{
+    tANI_U8 i, j = 0, chnId;
+
+    bSize = CSR_MIN(bSize, pChannelSet->numChannels);
+    for( i = 0; i < bSize; i++ )
+    {
+        chnId = (tANI_U8)(pChannelSet->firstChannel + ( i * pChannelSet->interChannelOffset ));
+        if ( csrIsSupportedChannel( pMac, chnId ) )
+        {
+            pChannelList[j++] = chnId;
+        }
+    }
+
+    return (j);
+}
+
+
+
+//bSize -- specify the buffer size of pChannelList
+void csrConstructCurrentValidChannelList( tpAniSirGlobal pMac, tDblLinkList *pChannelSetList, 
+                                            tANI_U8 *pChannelList, tANI_U8 bSize, tANI_U8 *pNumChannels )
+{
+    tListElem *pEntry;
+    tCsrChannelPowerInfo *pChannelSet;
+    tANI_U8 numChannels;
+    tANI_U8 *pChannels;
+
+    if( pChannelSetList && pChannelList && pNumChannels )
+    {
+        pChannels = pChannelList;
+        *pNumChannels = 0;
+        pEntry = csrLLPeekHead( pChannelSetList, LL_ACCESS_LOCK );
+        while( pEntry )
+        {
+            pChannelSet = GET_BASE_ADDR( pEntry, tCsrChannelPowerInfo, link );
+            numChannels = csrGetChannelListFromChannelSet( pMac, pChannels, bSize, pChannelSet );
+            pChannels += numChannels;
+            *pNumChannels += numChannels;
+            pEntry = csrLLNext( pChannelSetList, pEntry, LL_ACCESS_LOCK );
+        }
+    }
+}
+
+
+/*
+  * 802.11D only: Gather 11d IE via beacon or Probe response and store them in pAdapter->channels11d
+*/
+tANI_BOOLEAN csrLearnCountryInformation( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc,
+                                         tDot11fBeaconIEs *pIes, tANI_BOOLEAN fForce)
+{
+    tANI_U8 Num2GChannels, bMaxNumChn;
+    eHalStatus status;
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    v_REGDOMAIN_t domainId;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if (VOS_STA_SAP_MODE == vos_get_conparam ())
+        return eHAL_STATUS_SUCCESS;
+#endif
+
+    do
+    {
+        // check if .11d support is enabled
+        if( !csrIs11dSupported( pMac ) ) break;
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
+        {
+            break;
+        }
+        // check if country information element is present
+        if(!pIesLocal->Country.present)
+        {
+            //No country info
+            break;
+        }
+
+        if( csrSave11dCountryString( pMac, pIesLocal->Country.country, fForce ) )
+        {
+            // country string changed, this should not happen
+            //Need to check whether we care about this BSS' domain info
+            //If it doesn't match of the connected profile or roaming profile, let's ignore it
+            tANI_U32 i;
+            tCsrRoamSession *pSession;
+
+            for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+            {
+                if( CSR_IS_SESSION_VALID( pMac, i ) )
+                {
+                    pSession = CSR_GET_SESSION( pMac, i );
+                    if(pSession->pCurRoamProfile)
+                    {
+                        tCsrScanResultFilter filter;
+
+                        palZeroMemory(pMac->hHdd, &filter, sizeof(tCsrScanResultFilter));
+                        status = csrRoamPrepareFilterFromProfile(pMac, pSession->pCurRoamProfile, &filter);
+                        if(HAL_STATUS_SUCCESS(status))
+                        {
+                            tANI_BOOLEAN fMatch = csrMatchBSS(pMac, pSirBssDesc, &filter, NULL, NULL, NULL, NULL);
+                            //Free the resource first
+                            csrFreeScanFilter( pMac, &filter );
+                            if(fMatch)
+                            {
+                                smsLog(pMac, LOGW, "   Matching roam profile BSSID %02X-%02X-%02X-%02X-%02X-%02X causing ambiguous domain info\n",
+                                    pSirBssDesc->bssId[0], pSirBssDesc->bssId[1], pSirBssDesc->bssId[2], 
+                                    pSirBssDesc->bssId[3], pSirBssDesc->bssId[4], pSirBssDesc->bssId[5]);
+                                pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_TRUE;
+                                break;
+                            }
+                        }
+                    }
+                    else if( csrIsConnStateConnected(pMac, i))
+                    {
+                        //Reach here only when the currention is base on no profile. 
+                        //User doesn't give profile and just connect to anything.
+                        if(csrMatchBSSToConnectProfile(pMac, &pSession->connectedProfile, pSirBssDesc, pIesLocal))
+                        {
+                            smsLog(pMac, LOGW, "   Matching connect profile BSSID %02X-%02X-%02X-%02X-%02X-%02X causing ambiguous domain info\n",
+                                pSirBssDesc->bssId[0], pSirBssDesc->bssId[1], pSirBssDesc->bssId[2],
+                                pSirBssDesc->bssId[3], pSirBssDesc->bssId[4], pSirBssDesc->bssId[5]);
+                            //Tush
+                            pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_TRUE;
+                            if(csrIsBssidMatch(pMac, (tCsrBssid *)&pSirBssDesc->bssId, 
+                                                &pSession->connectedProfile.bssid))
+                            {
+                                //AP changed the 11d info on the fly, modify cfg
+                                pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE;
+                                fRet = eANI_BOOLEAN_TRUE;
+                            }
+                            break;
+                        }
+                    }
+                } //valid session
+            } //for
+            if ( i == CSR_ROAM_SESSION_MAX ) 
+            {
+                //Check whether we can use this country's 11d information
+                if( !pMac->roam.configParam.fEnforceDefaultDomain )
+                {
+                    pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_TRUE;
+                }
+                else 
+                {
+                    VOS_ASSERT( pMac->scan.domainIdCurrent == pMac->scan.domainIdDefault );
+                    if( HAL_STATUS_SUCCESS(csrGetRegulatoryDomainForCountry( 
+                                pMac, pIesLocal->Country.country, &domainId )) &&
+                                ( domainId == pMac->scan.domainIdCurrent ) )
+                    {
+                        //Two countries in the same domain
+                    }
+                }
+            }
+        }
+        else //Tush
+        {
+            pMac->scan.fCurrent11dInfoMatch = eANI_BOOLEAN_TRUE;
+        }
+
+        //In case that some channels in 5GHz have the same channel number as 2.4GHz (<= 14)
+        if(CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId))
+        {
+            tANI_U8 iC;
+            tSirMacChanInfo* pMacChnSet = (tSirMacChanInfo *)(&pIesLocal->Country.triplets[0]);
+
+            for(iC = 0; iC < pIesLocal->Country.num_triplets; iC++)
+            {
+                if(CSR_IS_CHANNEL_24GHZ(pMacChnSet[iC].firstChanNum))
+                {
+                    pMacChnSet[iC].firstChanNum += 200; //*** Where is this 200 defined?
+                }
+            }
+        }
+        smsLog(pMac, LOGE, FL("  %d sets each one is %d\n"), pIesLocal->Country.num_triplets, sizeof(tSirMacChanInfo));
+        // save the channel/power information from the Channel IE.
+        //sizeof(tSirMacChanInfo) has to be 3
+        csrSaveToChannelPower2G_5G( pMac, pIesLocal->Country.num_triplets * sizeof(tSirMacChanInfo), 
+                                        (tSirMacChanInfo *)(&pIesLocal->Country.triplets[0]) );
+        // set the indicator of the channel where the country IE was found...
+        pMac->scan.channelOf11dInfo = pSirBssDesc->channelId;
+        // Populate both band channel lists based on what we found in the country information...
+        csrSetOppositeBandChannelInfo( pMac );
+        bMaxNumChn = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+        // construct 2GHz channel list first
+        csrConstructCurrentValidChannelList( pMac, &pMac->scan.channelPowerInfoList24, pMac->scan.channels11d.channelList, 
+                                                bMaxNumChn, &Num2GChannels );
+        // construct 5GHz channel list now
+        if(bMaxNumChn > Num2GChannels)
+        {
+            csrConstructCurrentValidChannelList( pMac, &pMac->scan.channelPowerInfoList5G, pMac->scan.channels11d.channelList + Num2GChannels,
+                                                 bMaxNumChn - Num2GChannels,
+                                                 &pMac->scan.channels11d.numChannels );
+        }
+
+        pMac->scan.channels11d.numChannels += Num2GChannels;
+        fRet = eANI_BOOLEAN_TRUE;
+
+    } while( 0 );
+    
+    if( !pIes && pIesLocal )
+    {
+        //locally allocated
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( fRet );
+}
+
+
+static void csrSaveScanResults( tpAniSirGlobal pMac )
+{
+    // initialize this to FALSE. profMoveInterimScanResultsToMainList() routine
+    // will set this to the channel where an .11d beacon is seen
+    pMac->scan.channelOf11dInfo = 0;
+    // if we get any ambiguous .11d information then this will be set to TRUE
+    pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE;
+    //Tush
+    // if we get any ambiguous .11d information, then this will be set to TRUE
+    // only if the applied 11d info could be found in one of the scan results
+    pMac->scan.fCurrent11dInfoMatch = eANI_BOOLEAN_FALSE;
+    // move the scan results from interim list to the main scan list
+    csrMoveTempScanResultsToMainList( pMac );
+
+    // Now check if we gathered any domain/country specific information
+    // If so, we should update channel list and apply Tx power settings
+    csrApplyCountryInformation( pMac, FALSE );
+}
+
+
+void csrReinitScanCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    switch (pCommand->u.scanCmd.reason)
+    {
+    case eCsrScanSetBGScanParam:
+    case eCsrScanAbortBgScan:
+        if(pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList)
+        {
+            palFreeMemory(pMac->hHdd, pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList);
+            pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList = NULL;
+        }
+        break;
+    case eCsrScanBGScanAbort:
+    case eCsrScanBGScanEnable:
+    case eCsrScanGetScanChnInfo:
+        break;
+    case eCsrScanAbortNormalScan:
+    default:
+        csrScanFreeRequest(pMac, &pCommand->u.scanCmd.u.scanRequest);
+        break;
+    }
+    if(pCommand->u.scanCmd.pToRoamProfile)
+    {
+        csrReleaseProfile(pMac, pCommand->u.scanCmd.pToRoamProfile);
+        palFreeMemory(pMac->hHdd, pCommand->u.scanCmd.pToRoamProfile);
+    }
+    palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+}
+
+
+tANI_BOOLEAN csrGetRemainingChannelsFor11dScan( tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U8 *pcChannels )
+{
+    tANI_U32 index11dChannels, index;
+    tANI_U32 indexCurrentChannels;
+    tANI_BOOLEAN fChannelAlreadyScanned;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+
+    *pcChannels = 0;
+    if ( CSR_IS_11D_INFO_FOUND(pMac) && csrRoamIsChannelValid(pMac, pMac->scan.channelOf11dInfo) )
+    {
+        if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len)))
+        {
+            //Find the channel index where we found the 11d info
+            for(index = 0; index < len; index++)
+            {
+                if(pMac->scan.channelOf11dInfo == pMac->roam.validChannelList[index])
+                    break;
+            }
+            //check whether we found the channel index
+            if(index < len)
+            {
+                // Now, look through the 11d channel list and create a list of all channels in the 11d list that are
+                // NOT in the current channel list.  This gives us a list of the new channels that have not been
+                // scanned.  We'll scan this new list so we have a complete set of scan results on all of the domain channels
+                // initially.
+                for ( index11dChannels = 0; index11dChannels < pMac->scan.channels11d.numChannels; index11dChannels++ )
+                {
+                    fChannelAlreadyScanned = eANI_BOOLEAN_FALSE;
+
+                    for( indexCurrentChannels = 0; indexCurrentChannels < index; indexCurrentChannels++ )
+                    {
+                        if ( pMac->roam.validChannelList[ indexCurrentChannels ] == pMac->scan.channels11d.channelList[ index11dChannels ] )
+                        {
+                            fChannelAlreadyScanned = eANI_BOOLEAN_TRUE;
+                            break;
+                        }
+                    }
+
+                    if ( !fChannelAlreadyScanned )
+                    {
+                        pChannels[ *pcChannels ] = pMac->scan.channels11d.channelList[ index11dChannels ];
+                        ( *pcChannels )++;
+                    }
+                }
+            }
+        }//GetCFG
+    }
+    return( *pcChannels );
+}
+
+
+eCsrScanCompleteNextCommand csrScanGetNextCommandState( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fSuccess )
+{
+    eCsrScanCompleteNextCommand NextCommand = eCsrNextScanNothing;
+    
+    switch( pCommand->u.scanCmd.reason )
+    {
+        case eCsrScan11d1:
+            NextCommand = (fSuccess) ? eCsrNext11dScan1Success : eCsrNext11dScan1Failure;
+            break;
+        case eCsrScan11d2:
+            NextCommand = (fSuccess) ? eCsrNext11dScan2Success : eCsrNext11dScan2Failure;
+            break;    
+        case eCsrScan11dDone:
+            NextCommand = eCsrNext11dScanComplete;
+            break;
+        case eCsrScanLostLink1:
+            NextCommand = (fSuccess) ? eCsrNextLostLinkScan1Success : eCsrNextLostLinkScan1Failed;
+            break;
+        case eCsrScanLostLink2:
+            NextCommand = (fSuccess) ? eCsrNextLostLinkScan2Success : eCsrNextLostLinkScan2Failed;
+            break;
+        case eCsrScanLostLink3:
+            NextCommand = (fSuccess) ? eCsrNextLostLinkScan3Success : eCsrNextLostLinkScan3Failed;
+            break;
+        case eCsrScanForSsid:
+            NextCommand = (fSuccess) ? eCsrNexteScanForSsidSuccess : eCsrNexteScanForSsidFailure;
+            break;
+        case eCsrScanForCapsChange:
+            NextCommand = eCsrNextCapChangeScanComplete;    //don't care success or not
+            break;
+        case eCsrScanIdleScan:
+            NextCommand = eCsrNextIdleScanComplete;
+            break;
+        default:
+            NextCommand = eCsrNextScanNothing;
+            break;
+    }
+    return( NextCommand );
+}
+
+
+//Return whether the pCommand is finished.
+tANI_BOOLEAN csrHandleScan11d1Failure(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
+    
+    //Apply back the default setting and passively scan one more time.
+    csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE);
+    pCommand->u.scanCmd.reason = eCsrScan11d2;
+    if(HAL_STATUS_SUCCESS(csrScanChannels(pMac, pCommand)))
+    {
+        fRet = eANI_BOOLEAN_FALSE;
+    }
+    
+    return (fRet);
+}
+
+
+tANI_BOOLEAN csrHandleScan11dSuccess(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
+    tANI_U8 *pChannels;
+    tANI_U8 cChannels;
+    
+    if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChannels, WNI_CFG_VALID_CHANNEL_LIST_LEN)))
+    {
+        palZeroMemory(pMac->hHdd, pChannels, WNI_CFG_VALID_CHANNEL_LIST_LEN);
+        if ( csrGetRemainingChannelsFor11dScan( pMac, pChannels, &cChannels ) )
+        {
+            pCommand->u.scanCmd.reason = eCsrScan11dDone;
+            if(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList)
+            {
+                palFreeMemory(pMac->hHdd, pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList); 
+            }
+            if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, cChannels)))
+            {
+                palCopyMemory(pMac->hHdd, pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, pChannels, cChannels);
+                pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = cChannels;
+                pCommand->u.scanCmd.u.scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+                pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+                if(HAL_STATUS_SUCCESS(csrScanChannels(pMac, pCommand)))
+                {
+                    //Reuse the same command buffer
+                    fRet = eANI_BOOLEAN_FALSE;
+                }
+            }
+        }
+        palFreeMemory(pMac->hHdd, pChannels);
+    }
+    
+    return (fRet);
+}
+
+//Return whether the command should be removed
+tANI_BOOLEAN csrScanComplete( tpAniSirGlobal pMac, tSirSmeScanRsp *pScanRsp )
+{
+    eCsrScanCompleteNextCommand NextCommand = eCsrNextScanNothing;
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+    tANI_BOOLEAN fRemoveCommand = eANI_BOOLEAN_TRUE;
+    tANI_BOOLEAN fSuccess;
+
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
+        // If the head of the queue is Active and it is a SCAN command, remove
+        // and put this on the Free queue.
+        if ( eSmeCommandScan == pCommand->command )
+        {     
+            tANI_U32 sessionId = pCommand->sessionId;
+
+            if(eSIR_SME_SUCCESS != pScanRsp->statusCode)
+            {
+                fSuccess = eANI_BOOLEAN_FALSE;
+            }
+            else
+            {
+                //pMac->scan.tempScanResults is not empty meaning the scan found something
+                //This check only valid here because csrSaveScanresults is not yet called
+                fSuccess = (!csrLLIsListEmpty(&pMac->scan.tempScanResults, LL_ACCESS_LOCK));
+            }
+            csrSaveScanResults(pMac);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+            {
+                vos_log_scan_pkt_type *pScanLog = NULL;
+                tScanResultHandle hScanResult;
+                tCsrScanResultInfo *pScanResult;
+                tDot11fBeaconIEs *pIes;
+                int n = 0, c = 0;
+
+                WLAN_VOS_DIAG_LOG_ALLOC(pScanLog, vos_log_scan_pkt_type, LOG_WLAN_SCAN_C);
+                if(pScanLog)
+                {
+                    if(eCsrScanBgScan == pCommand->u.scanCmd.reason || 
+                        eCsrScanProbeBss == pCommand->u.scanCmd.reason ||
+                        eCsrScanSetBGScanParam == pCommand->u.scanCmd.reason)
+                    {
+                        pScanLog->eventId = WLAN_SCAN_EVENT_HO_SCAN_RSP;
+                    }
+                    else
+                    {
+                        if( eSIR_PASSIVE_SCAN != pMac->scan.curScanType )
+                        {
+                            pScanLog->eventId = WLAN_SCAN_EVENT_ACTIVE_SCAN_RSP;
+                        }
+                        else
+                        {
+                            pScanLog->eventId = WLAN_SCAN_EVENT_PASSIVE_SCAN_RSP;
+                        }
+                    }
+                    if(eSIR_SME_SUCCESS == pScanRsp->statusCode)
+                    {
+                        if(HAL_STATUS_SUCCESS(csrScanGetResult(pMac, NULL, &hScanResult)))
+                        {
+                            while(((pScanResult = csrScanResultGetNext(pMac, hScanResult)) != NULL))
+                            {
+                                if( n < VOS_LOG_MAX_NUM_BSSID )
+                                {
+                                    if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->BssDescriptor, &pIes)))
+                                    {
+                                        smsLog(pMac, LOGE, FL(" fail to parse IEs\n"));
+                                        break;
+                                    }
+                                    palCopyMemory(pMac->hHdd, pScanLog->bssid[n], pScanResult->BssDescriptor.bssId, 6);
+                                    if(pIes && pIes->SSID.present && VOS_LOG_MAX_SSID_SIZE >= pIes->SSID.num_ssid)
+                                    {
+                                        palCopyMemory(pMac->hHdd, pScanLog->ssid[n], 
+                                                pIes->SSID.ssid, pIes->SSID.num_ssid);
+                                    }
+                                    palFreeMemory(pMac->hHdd, pIes);
+                                    n++;
+                                }
+                                c++;
+                            }
+                            pScanLog->numSsid = (v_U8_t)n;
+                            pScanLog->totalSsid = (v_U8_t)c;
+                            csrScanResultPurge(pMac, hScanResult);
+                        }
+                    }
+                    else
+                    {
+                        pScanLog->status = WLAN_SCAN_STATUS_FAILURE;
+                    }
+                    WLAN_VOS_DIAG_LOG_REPORT(pScanLog);
+                }
+            }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+            NextCommand = csrScanGetNextCommandState(pMac, pCommand, fSuccess);
+            //We reuse the command here instead reissue a new command
+            switch(NextCommand)
+            {
+            case eCsrNext11dScan1Success:
+            case eCsrNext11dScan2Success:
+                smsLog( pMac, LOG2, FL("11dScan1/3 produced results.  Reissue Active scan...\n"));
+                // if we found country information, no need to continue scanning further, bail out
+                fRemoveCommand = eANI_BOOLEAN_TRUE;
+                NextCommand = eCsrNext11dScanComplete;
+                break;
+            case eCsrNext11dScan1Failure:
+                //We are not done yet. 11d scan fail once. We will try to reset anything and do it over again
+                //The only meaningful thing for this retry is that we cannot find 11d information after a reset so
+                //we clear the "old" 11d info and give it once more chance
+                fRemoveCommand = csrHandleScan11d1Failure(pMac, pCommand);
+                if(fRemoveCommand)
+                {
+                    NextCommand = eCsrNext11dScanComplete;
+                } 
+                break;
+            case eCsrNextLostLinkScan1Success:
+                if(!HAL_STATUS_SUCCESS(csrIssueRoamAfterLostlinkScan(pMac, sessionId, eCsrLostLink1)))
+                {
+                    csrScanHandleFailedLostlink1(pMac, sessionId);
+                }
+                break;
+            case eCsrNextLostLinkScan2Success:
+                if(!HAL_STATUS_SUCCESS(csrIssueRoamAfterLostlinkScan(pMac, sessionId, eCsrLostLink2)))
+                {
+                    csrScanHandleFailedLostlink2(pMac, sessionId);
+                }
+                break;
+            case eCsrNextLostLinkScan3Success:
+                if(!HAL_STATUS_SUCCESS(csrIssueRoamAfterLostlinkScan(pMac, sessionId, eCsrLostLink3)))
+                {
+                    csrScanHandleFailedLostlink3(pMac, sessionId);
+                }
+                break;
+            case eCsrNextLostLinkScan1Failed:
+                csrScanHandleFailedLostlink1(pMac, sessionId);
+                break;
+            case eCsrNextLostLinkScan2Failed:
+                csrScanHandleFailedLostlink2(pMac, sessionId);
+                break;
+            case eCsrNextLostLinkScan3Failed:
+                csrScanHandleFailedLostlink3(pMac, sessionId);
+                break;    
+            case eCsrNexteScanForSsidSuccess:
+                csrScanHandleSearchForSSID(pMac, pCommand);
+                break;
+            case eCsrNexteScanForSsidFailure:
+                csrScanHandleSearchForSSIDFailure(pMac, pCommand);
+                break;
+            case eCsrNextIdleScanComplete:
+                pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+                break;
+            case eCsrNextCapChangeScanComplete:
+                csrScanHandleCapChangeScanComplete(pMac, sessionId);
+                break;
+            default:
+
+                break;
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGW, FL("Scan Completion called but SCAN command is not ACTIVE ...\n"));
+            fRemoveCommand = eANI_BOOLEAN_FALSE;
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGW, FL("Scan Completion called but NO commands are ACTIVE ...\n"));
+        fRemoveCommand = eANI_BOOLEAN_FALSE;
+    }
+   
+    return( fRemoveCommand );
+}
+
+
+
+static void csrScanRemoveDupBssDescriptionFromInterimList( tpAniSirGlobal pMac, 
+                                                           tSirBssDescription *pSirBssDescr,
+                                                           tDot11fBeaconIEs *pIes)
+{
+    tListElem *pEntry;
+    tCsrScanResult *pCsrBssDescription;
+
+    // Walk through all the chained BssDescriptions.  If we find a chained BssDescription that
+    // matches the BssID of the BssDescription passed in, then these must be duplicate scan
+    // results for this Bss.  In that case, remove the 'old' Bss description from the linked list.
+    pEntry = csrLLPeekHead( &pMac->scan.tempScanResults, LL_ACCESS_LOCK );
+    while( pEntry ) 
+    {
+        pCsrBssDescription = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+
+        // we have a duplicate scan results only when BSSID, SSID, Channel and NetworkType
+        // matches
+
+        if ( csrIsDuplicateBssDescription( pMac, &pCsrBssDescription->Result.BssDescriptor, 
+                                             pSirBssDescr, pIes ) )
+        {
+            pSirBssDescr->rssi = (tANI_S8)( (((tANI_S32)pSirBssDescr->rssi * CSR_SCAN_RESULT_RSSI_WEIGHT ) +
+                                    ((tANI_S32)pCsrBssDescription->Result.BssDescriptor.rssi * (100 - CSR_SCAN_RESULT_RSSI_WEIGHT) )) / 100 );
+
+            // Remove the 'old' entry from the list....
+            if( csrLLRemoveEntry( &pMac->scan.tempScanResults, pEntry, LL_ACCESS_LOCK ) )
+            {
+                csrCheckNSaveWscIe(pMac, pSirBssDescr, &pCsrBssDescription->Result.BssDescriptor);
+                // we need to free the memory associated with this node
+                csrFreeScanResultEntry( pMac, pCsrBssDescription );
+            }
+            
+            // If we found a match, we can stop looking through the list.
+            break;
+        }
+
+        pEntry = csrLLNext( &pMac->scan.tempScanResults, pEntry, LL_ACCESS_LOCK );
+    }
+}
+
+
+
+//Caller allocated memory pfNewBssForConn to return whether new candidate for
+//current connection is found. Cannot be NULL
+tCsrScanResult *csrScanSaveBssDescriptionToInterimList( tpAniSirGlobal pMac, 
+                                                        tSirBssDescription *pBSSDescription,
+                                                        tDot11fBeaconIEs *pIes)
+{
+    tCsrScanResult *pCsrBssDescription = NULL;
+    tANI_U32 cbBSSDesc;
+    tANI_U32 cbAllocated;
+    eHalStatus halStatus;
+    
+    // figure out how big the BSS description is (the BSSDesc->length does NOT
+    // include the size of the length field itself).
+    cbBSSDesc = pBSSDescription->length + sizeof( pBSSDescription->length );
+
+    cbAllocated = sizeof( tCsrScanResult ) + cbBSSDesc;
+
+    halStatus = palAllocateMemory( pMac->hHdd, (void **)&pCsrBssDescription, cbAllocated );
+    if ( HAL_STATUS_SUCCESS(halStatus) )
+    {
+        palZeroMemory(pMac->hHdd, pCsrBssDescription, cbAllocated);
+        pCsrBssDescription->AgingCount = (tANI_S32)pMac->roam.configParam.agingCount;
+        palCopyMemory(pMac->hHdd, &pCsrBssDescription->Result.BssDescriptor, pBSSDescription, cbBSSDesc );
+        //Save SSID separately for later use
+        if( pIes->SSID.present && !csrIsNULLSSID(pIes->SSID.ssid, pIes->SSID.num_ssid) )
+        {
+            //SSID not hidden
+            tANI_U32 len = pIes->SSID.num_ssid;;
+            if (len > SIR_MAC_MAX_SSID_LENGTH)
+            {
+               // truncate to fit in our struct
+               len = SIR_MAC_MAX_SSID_LENGTH;
+            }
+            pCsrBssDescription->Result.ssId.length = len;
+            pCsrBssDescription->Result.timer = vos_timer_get_system_time();
+            palCopyMemory(pMac->hHdd, pCsrBssDescription->Result.ssId.ssId, 
+                pIes->SSID.ssid, len );
+        }
+        csrLLInsertTail( &pMac->scan.tempScanResults, &pCsrBssDescription->Link, LL_ACCESS_LOCK );
+    }
+
+    return( pCsrBssDescription );
+}
+
+
+    
+
+tANI_BOOLEAN csrIsDuplicateBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc1, 
+                                           tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 )
+{
+    tANI_BOOLEAN fMatch = FALSE;
+    tSirMacCapabilityInfo *pCap1, *pCap2;
+    tDot11fBeaconIEs *pIes1 = NULL;
+
+    pCap1 = (tSirMacCapabilityInfo *)&pSirBssDesc1->capabilityInfo;
+    pCap2 = (tSirMacCapabilityInfo *)&pSirBssDesc2->capabilityInfo;
+    if(pCap1->ess == pCap2->ess)
+    {
+        if (pCap1->ess && 
+                csrIsMacAddressEqual( pMac, (tCsrBssid *)pSirBssDesc1->bssId, (tCsrBssid *)pSirBssDesc2->bssId))
+        {
+            fMatch = TRUE;
+        }
+        else if (pCap1->ibss && (pSirBssDesc1->channelId == pSirBssDesc2->channelId))
+        {
+            tDot11fBeaconIEs *pIesTemp = pIes2;
+
+            do
+            {
+                if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc1, &pIes1)))
+                {
+                    break;
+                }
+                if( NULL == pIesTemp )
+                {
+                    if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc2, &pIesTemp)))
+                    {
+                        break;
+                    }
+                }
+                //Same channel cannot have same SSID for different IBSS
+                if(pIes1->SSID.present && pIesTemp->SSID.present)
+                {
+                    fMatch = csrIsSsidMatch(pMac, pIes1->SSID.ssid, pIes1->SSID.num_ssid, 
+                                            pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid, eANI_BOOLEAN_TRUE);
+                }
+            }while(0);
+            if( (NULL == pIes2) && pIesTemp )
+            {
+                //locally allocated
+                palFreeMemory(pMac->hHdd, pIesTemp);
+            }
+        }
+#if defined WLAN_FEATURE_P2P
+        /* In case of P2P devices, ess and ibss will be set to zero */
+        else if (!pCap1->ess && 
+                csrIsMacAddressEqual( pMac, (tCsrBssid *)pSirBssDesc1->bssId, (tCsrBssid *)pSirBssDesc2->bssId))
+        {
+            fMatch = TRUE;
+        }
+#endif
+    }
+
+    if(pIes1)
+    {
+        palFreeMemory(pMac->hHdd, pIes1);
+    }
+
+    return( fMatch );
+}
+
+
+tANI_BOOLEAN csrIsNetworkTypeEqual( tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 )
+{
+    return( pSirBssDesc1->nwType == pSirBssDesc2->nwType );
+}
+
+
+//to check whether the BSS matches the dot11Mode
+static tANI_BOOLEAN csrScanIsBssAllowed(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, 
+                                        tDot11fBeaconIEs *pIes)
+{
+    tANI_BOOLEAN fAllowed = eANI_BOOLEAN_FALSE;
+    eCsrPhyMode phyMode;
+
+    if(HAL_STATUS_SUCCESS(csrGetPhyModeFromBss(pMac, pBssDesc, &phyMode, pIes)))
+    {
+        switch(pMac->roam.configParam.phyMode)
+        {
+        case eCSR_DOT11_MODE_11b:
+            fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11a != phyMode);
+            break;
+        case eCSR_DOT11_MODE_11g:
+            fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11a != phyMode);
+            break;
+        case eCSR_DOT11_MODE_11g_ONLY:
+            fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11g == phyMode);
+            break;
+        case eCSR_DOT11_MODE_11a:
+            fAllowed = (tANI_BOOLEAN)((eCSR_DOT11_MODE_11b != phyMode) && (eCSR_DOT11_MODE_11g != phyMode));
+            break;
+        case eCSR_DOT11_MODE_11n_ONLY:
+            fAllowed = (tANI_BOOLEAN)((eCSR_DOT11_MODE_11n == phyMode) || (eCSR_DOT11_MODE_TAURUS == phyMode));
+            break;
+        case eCSR_DOT11_MODE_11b_ONLY:
+            fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11b == phyMode);
+            break;
+        case eCSR_DOT11_MODE_11a_ONLY:
+            fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11a == phyMode);
+            break;
+        case eCSR_DOT11_MODE_11n:
+        case eCSR_DOT11_MODE_TAURUS:
+        default:
+            fAllowed = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return (fAllowed);
+}
+
+
+
+//Return pIes to caller for future use when returning TRUE.
+static tANI_BOOLEAN csrScanValidateScanResult( tpAniSirGlobal pMac, tANI_U8 *pChannels, 
+                                               tANI_U8 numChn, tSirBssDescription *pBssDesc, 
+                                               tDot11fBeaconIEs **ppIes )
+{
+    tANI_BOOLEAN fValidChannel = FALSE;
+    tDot11fBeaconIEs *pIes = NULL;
+    tANI_U8 index;
+
+    for( index = 0; index < numChn; index++ )
+    {
+        // This check relies on the fact that a single BSS description is returned in each
+        // ScanRsp call, which is the way LIM implemented the scan req/rsp funtions.  We changed 
+        // to this model when we ran with a large number of APs.  If this were to change, then 
+        // this check would have to mess with removing the bssDescription from somewhere in an 
+        // arbitrary index in the bssDescription array.
+        if ( pChannels[ index ] == pBssDesc->channelId ) 
+        {
+           fValidChannel = TRUE;
+           break;
+        }
+    }
+    *ppIes = NULL;
+    if(fValidChannel)
+    {
+        if( HAL_STATUS_SUCCESS( csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes) ) )
+        {
+            fValidChannel = csrScanIsBssAllowed(pMac, pBssDesc, pIes);
+            if( fValidChannel )
+            {
+                *ppIes = pIes;
+            }
+            else
+            {
+                palFreeMemory( pMac->hHdd, pIes );
+            }
+        }
+        else
+        {
+            fValidChannel = FALSE;
+        }
+    }
+
+    return( fValidChannel );   
+}
+
+
+//Return whether last scan result is received
+static tANI_BOOLEAN csrScanProcessScanResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, 
+                                                tSirSmeScanRsp *pScanRsp, tANI_BOOLEAN *pfRemoveCommand )
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE, fRemoveCommand = eANI_BOOLEAN_FALSE;
+    tDot11fBeaconIEs *pIes = NULL;
+    tANI_U32 cbParsed;
+    tSirBssDescription *pSirBssDescription;
+    tANI_U32 cbBssDesc;
+    tANI_U32 cbScanResult = GET_FIELD_OFFSET( tSirSmeScanRsp, bssDescription ) 
+                            + sizeof(tSirBssDescription);    //We need at least one CB
+
+    // don't consider the scan rsp to be valid if the status code is Scan Failure.  Scan Failure
+    // is returned when the scan could not find anything.  so if we get scan failure return that
+    // the scan response is invalid.  Also check the lenght in the scan result for valid scan
+    // BssDescriptions....
+    do
+    {
+        if ( ( cbScanResult <= pScanRsp->length ) && 
+             (( eSIR_SME_SUCCESS == pScanRsp->statusCode ) ||
+              ( eSIR_SME_MORE_SCAN_RESULTS_FOLLOW == pScanRsp->statusCode ) ) )
+        {
+            tANI_U8 *pChannelList = NULL;
+            tANI_U8 cChannels = 0;
+
+            //Different scan type can reach this point, we need to distinguish it
+            if( eCsrScanSetBGScanParam == pCommand->u.scanCmd.reason )
+            {
+                //eCsrScanSetBGScanParam uses different structure
+                tCsrBGScanRequest *pBgScanReq = &pCommand->u.scanCmd.u.bgScanRequest;
+
+                cChannels = pBgScanReq->ChannelInfo.numOfChannels;
+                pChannelList = pBgScanReq->ChannelInfo.ChannelList;
+            }
+            else
+            {
+                //the rest use generic scan request
+                cChannels = pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
+                pChannelList = pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList;
+            }
+
+            // if the scan result is not on one of the channels in the Valid channel list, then it
+            // must have come from an AP on an overlapping channel (in the 2.4GHz band).  In this case,
+            // let's drop the scan result.
+            //
+            // The other situation is where the scan request is for a scan on a particular channel set
+            // and the scan result is from a 
+            
+            // if the NumChannels is 0, then we are supposed to be scanning all channels.  Use the full channel
+            // list as the 'valid' channel list.  Otherwise, use the specific channel list in the scan parms
+            // as the valid channels.
+            if ( 0 == cChannels ) 
+            {
+                tANI_U32 len = sizeof(pMac->roam.validChannelList);
+                
+                if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len)))
+                {
+                    pChannelList = pMac->roam.validChannelList;
+                    cChannels = (tANI_U8)len; 
+                }
+                else
+                {
+                    //Cannot continue
+                    smsLog( pMac, LOGE, "CSR: Processing internal SCAN results...csrGetCfgValidChannels failed\n" );
+                    break;
+                }
+            }
+
+            smsLog( pMac, LOG2, "CSR: Processing internal SCAN results..." );
+            cbParsed = GET_FIELD_OFFSET( tSirSmeScanRsp, bssDescription );
+            pSirBssDescription = pScanRsp->bssDescription;
+            while( cbParsed < pScanRsp->length )
+            {
+                if ( csrScanValidateScanResult( pMac, pChannelList, cChannels, pSirBssDescription, &pIes ) ) 
+                {
+                    csrScanRemoveDupBssDescriptionFromInterimList(pMac, pSirBssDescription, pIes);
+                    csrScanSaveBssDescriptionToInterimList( pMac, pSirBssDescription, pIes );
+                    if( eSIR_PASSIVE_SCAN == pMac->scan.curScanType )
+                    {
+                        if( csrIs11dSupported( pMac) )
+                        {
+                            //Check whether the BSS is acceptable base on 11d info and our configs.
+                            if( csrMatchCountryCode( pMac, NULL, pIes ) )
+                            {
+                                //Double check whether the channel is acceptable by us.
+                                if( csrIsSupportedChannel( pMac, pSirBssDescription->channelId ) )
+                                {
+                                    pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
+                        }
+                    }
+                    //Free the resource
+                    palFreeMemory( pMac->hHdd, pIes );
+                }
+                // skip over the BSS description to the next one...
+                cbBssDesc = pSirBssDescription->length + sizeof( pSirBssDescription->length );
+
+                cbParsed += cbBssDesc;
+                pSirBssDescription = (tSirBssDescription *)((tANI_U8 *)pSirBssDescription + cbBssDesc );
+
+            } //while
+        }
+        else
+        {
+            smsLog( pMac, LOGW, " Scanrsp fail (0x%08X), length = %d\n", pScanRsp->statusCode, pScanRsp->length );
+            //HO bg scan/probe failed no need to try autonomously
+            if(eCsrScanBgScan == pCommand->u.scanCmd.reason ||
+               eCsrScanProbeBss == pCommand->u.scanCmd.reason ||
+               eCsrScanSetBGScanParam == pCommand->u.scanCmd.reason)
+            {
+                fRemoveCommand = eANI_BOOLEAN_TRUE;
+            }
+        }
+    }while(0);
+    if ( eSIR_SME_MORE_SCAN_RESULTS_FOLLOW != pScanRsp->statusCode )
+    {
+        smsLog(pMac, LOG1, " Scan received %d unique BSS scan reason is %d\n", csrLLCount(&pMac->scan.tempScanResults), pCommand->u.scanCmd.reason);
+        fRemoveCommand = csrScanComplete( pMac, pScanRsp );
+        fRet = eANI_BOOLEAN_TRUE;
+    }//if ( eSIR_SME_MORE_SCAN_RESULTS_FOLLOW != pScanRsp->statusCode )
+    if(pfRemoveCommand)
+    {
+        *pfRemoveCommand = fRemoveCommand;
+    }
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+    if (!csrLLIsListEmpty( &pMac->scan.scanCmdPendingList, LL_ACCESS_LOCK ))
+    {
+         palTimerStart(pMac->hHdd, pMac->scan.hTimerStaApConcTimer, 
+                 CSR_SCAN_STAAP_CONC_INTERVAL, eANI_BOOLEAN_FALSE);
+    }
+#endif
+    return (fRet);
+}
+
+
+tANI_BOOLEAN csrScanIsWildCardScan( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0};
+    tANI_BOOLEAN f = palEqualMemory( pMac->hHdd, pCommand->u.scanCmd.u.scanRequest.bssid, 
+        bssid, sizeof(tCsrBssid) );
+
+    //It is not a wild card scan if the bssid is not broadcast and the number of SSID is 1.
+    return ((tANI_BOOLEAN)( (f || (0xff == pCommand->u.scanCmd.u.scanRequest.bssid[0])) &&
+        (pCommand->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs != 1) ));
+}
+
+
+eHalStatus csrScanSmeScanResponse( tpAniSirGlobal pMac, void *pMsgBuf )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+    eCsrScanStatus scanStatus;
+    tSirSmeScanRsp *pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
+    tSmeGetScanChnRsp *pScanChnInfo;
+    tANI_BOOLEAN fRemoveCommand = eANI_BOOLEAN_TRUE;
+    eCsrScanReason reason = eCsrScanOther;
+
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if ( eSmeCommandScan == pCommand->command )
+        {
+            scanStatus = (eSIR_SME_SUCCESS == pScanRsp->statusCode) ? eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
+            reason = pCommand->u.scanCmd.reason;
+            switch(pCommand->u.scanCmd.reason)
+            {
+            case eCsrScanAbortBgScan:
+            case eCsrScanAbortNormalScan:
+            case eCsrScanBGScanAbort:
+            case eCsrScanBGScanEnable:
+                break;
+            case eCsrScanGetScanChnInfo:
+                pScanChnInfo = (tSmeGetScanChnRsp *)pMsgBuf;
+                csrScanAgeResults(pMac, pScanChnInfo);
+                break;
+            case eCsrScanForCapsChange:
+                csrScanProcessScanResults( pMac, pCommand, pScanRsp, &fRemoveCommand );
+                break;
+#if WLAN_FEATURE_P2P
+            case eCsrScanP2PFindPeer:
+              scanStatus = ((eSIR_SME_SUCCESS == pScanRsp->statusCode) && (pScanRsp->length > 50)) ? eCSR_SCAN_FOUND_PEER : eCSR_SCAN_FAILURE;
+              csrScanProcessScanResults( pMac, pCommand, pScanRsp, NULL );
+              break;
+#endif                
+            case eCsrScanSetBGScanParam:
+            default:
+                if(csrScanProcessScanResults( pMac, pCommand, pScanRsp, &fRemoveCommand ))
+                {
+                    //Not to get channel info if the scan is not a wildcard scan because
+                    //it may cause scan results got aged out incorrectly.
+                    if( csrScanIsWildCardScan( pMac, pCommand ) && (!pCommand->u.scanCmd.u.scanRequest.p2pSearch) )
+                    {
+                        //Get the list of channels scanned
+                        csrScanGetScanChnInfo(pMac);
+                    }
+                }
+                break;
+            }//switch
+            if(fRemoveCommand)
+            {
+
+                csrReleaseScanCommand(pMac, pCommand, scanStatus);
+
+            }
+            smeProcessPendingQueue( pMac );
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "CSR: Scan Completion called but SCAN command is not ACTIVE ..." );
+            status = eHAL_STATUS_FAILURE;
+        }
+    }
+    else
+    {
+        smsLog( pMac, LOGW, "CSR: Scan Completion called but NO commands are ACTIVE ..." );
+        status = eHAL_STATUS_FAILURE;
+    }
+    
+    return (status);
+}
+
+
+
+
+tCsrScanResultInfo *csrScanResultGetFirst(tpAniSirGlobal pMac, tScanResultHandle hScanResult)
+{
+    tListElem *pEntry;
+    tCsrScanResult *pResult;
+    tCsrScanResultInfo *pRet = NULL;
+    tScanResultList *pResultList = (tScanResultList *)hScanResult;
+    
+    if(pResultList)
+    {
+        csrLLLock(&pResultList->List);
+        pEntry = csrLLPeekHead(&pResultList->List, LL_ACCESS_NOLOCK);
+        if(pEntry)
+        {
+            pResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link);
+            pRet = &pResult->Result;
+        }
+        pResultList->pCurEntry = pEntry;
+        csrLLUnlock(&pResultList->List);
+    }
+    
+    return pRet;
+}
+
+
+tCsrScanResultInfo *csrScanResultGetNext(tpAniSirGlobal pMac, tScanResultHandle hScanResult)
+{
+    tListElem *pEntry = NULL;
+    tCsrScanResult *pResult = NULL;
+    tCsrScanResultInfo *pRet = NULL;
+    tScanResultList *pResultList = (tScanResultList *)hScanResult;
+    
+    if(pResultList)
+    {
+        csrLLLock(&pResultList->List);
+        if(NULL == pResultList->pCurEntry)
+        {
+            pEntry = csrLLPeekHead(&pResultList->List, LL_ACCESS_NOLOCK);
+        }
+        else
+        {
+            pEntry = csrLLNext(&pResultList->List, pResultList->pCurEntry, LL_ACCESS_NOLOCK);
+        }
+        if(pEntry)
+        {
+            pResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link);
+            pRet = &pResult->Result;
+        }
+        pResultList->pCurEntry = pEntry;
+        csrLLUnlock(&pResultList->List);
+    }
+    
+    return pRet;
+}
+
+
+//This function moves the first BSS that matches the bssid to the head of the result
+eHalStatus csrMoveBssToHeadFromBSSID(tpAniSirGlobal pMac, tCsrBssid *bssid, tScanResultHandle hScanResult)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanResultList *pResultList = (tScanResultList *)hScanResult;
+    tCsrScanResult *pResult = NULL;
+    tListElem *pEntry = NULL;
+   
+    if(pResultList && bssid)
+    {
+        csrLLLock(&pResultList->List);
+        pEntry = csrLLPeekHead(&pResultList->List, LL_ACCESS_NOLOCK);
+        while(pEntry)
+        {
+            pResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link);
+            if(palEqualMemory(pMac->hHdd, bssid, pResult->Result.BssDescriptor.bssId, sizeof(tCsrBssid)))
+            {
+                status = eHAL_STATUS_SUCCESS;
+                csrLLRemoveEntry(&pResultList->List, pEntry, LL_ACCESS_NOLOCK);
+                csrLLInsertHead(&pResultList->List, pEntry, LL_ACCESS_NOLOCK);
+                break;
+            }
+            pEntry = csrLLNext(&pResultList->List, pResultList->pCurEntry, LL_ACCESS_NOLOCK);
+        }
+        csrLLUnlock(&pResultList->List);
+    }
+    
+    return (status);
+}
+
+
+//Remove the BSS if possible.
+//Return -- TRUE == the BSS is remove. False == Fail to remove it
+//This function is called when list lock is held. Be caution what functions it can call.
+tANI_BOOLEAN csrScanAgeOutBss(tpAniSirGlobal pMac, tCsrScanResult *pResult)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tANI_U32 i;
+    tCsrRoamSession *pSession;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) )
+        {
+            pSession = CSR_GET_SESSION( pMac, i );
+            //Not to remove the BSS we are connected to.
+            if(csrIsConnStateDisconnected(pMac, i) || (NULL == pSession->pConnectBssDesc) ||
+              (!csrIsDuplicateBssDescription(pMac, &pResult->Result.BssDescriptor, 
+                                                      pSession->pConnectBssDesc, NULL))
+              )
+            {
+                smsLog(pMac, LOGW, "Aging out BSS %02X-%02X-%02X-%02X-%02X-%02X Channel %d\n",
+                                          pResult->Result.BssDescriptor.bssId[0],
+                                          pResult->Result.BssDescriptor.bssId[1],
+                                          pResult->Result.BssDescriptor.bssId[2],
+                                          pResult->Result.BssDescriptor.bssId[3],
+                                          pResult->Result.BssDescriptor.bssId[4],
+                                          pResult->Result.BssDescriptor.bssId[5],
+                                          pResult->Result.BssDescriptor.channelId);
+                //No need to hold the spin lock because caller should hold the lock for pMac->scan.scanResultList
+                if( csrLLRemoveEntry(&pMac->scan.scanResultList, &pResult->Link, LL_ACCESS_NOLOCK) )
+                {
+                    csrFreeScanResultEntry(pMac, pResult);
+                }
+                fRet = eANI_BOOLEAN_TRUE;
+                break;
+            }
+        } //valid session
+    } //for
+    if( CSR_ROAM_SESSION_MAX == i )
+    {
+        //reset the counter so this won't hapeen too soon
+        pResult->AgingCount = (tANI_S32)pMac->roam.configParam.agingCount;
+        pResult->Result.BssDescriptor.nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+    }
+
+    return (fRet);
+}
+
+
+eHalStatus csrScanAgeResults(tpAniSirGlobal pMac, tSmeGetScanChnRsp *pScanChnInfo)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry, *tmpEntry;
+    tCsrScanResult *pResult;
+    tLimScanChn *pChnInfo;
+    tANI_U8 i;
+
+    csrLLLock(&pMac->scan.scanResultList);
+    for(i = 0; i < pScanChnInfo->numChn; i++)
+    {
+        pChnInfo = &pScanChnInfo->scanChn[i];
+        pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+        while( pEntry ) 
+        {
+            tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
+            pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+            if(pResult->Result.BssDescriptor.channelId == pChnInfo->channelId)
+            {
+                pResult->AgingCount--;
+                if(pResult->AgingCount <= 0)
+                {
+                    smsLog(pMac, LOGW, " age out due to ref count");
+                    csrScanAgeOutBss(pMac, pResult);
+                }
+            }
+            pEntry = tmpEntry;
+        }
+    }
+    csrLLUnlock(&pMac->scan.scanResultList);
+
+    return (status);
+}
+
+
+eHalStatus csrSendMBScanReq( tpAniSirGlobal pMac, tANI_U16 sessionId, 
+                    tCsrScanRequest *pScanReq, tScanReqParam *pScanReqParam )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeScanReq *pMsg;
+    tANI_U16 msgLen;
+    tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0};
+    tSirScanType scanType = pScanReq->scanType;
+    tANI_U32 minChnTime;    //in units of milliseconds
+    tANI_U32 maxChnTime;    //in units of milliseconds
+    tANI_U32 i;
+    tANI_U8 selfMacAddr[WNI_CFG_BSSID_LEN];
+    tANI_U8 *pSelfMac = NULL;
+
+    msgLen = (tANI_U16)(sizeof( tSirSmeScanReq ) - sizeof( pMsg->channelList.channelNumber ) + 
+                        ( sizeof( pMsg->channelList.channelNumber ) * pScanReq->ChannelInfo.numOfChannels )) +
+                   ( pScanReq->uIEFieldLen ) ;
+
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        do
+        {
+            palZeroMemory(pMac->hHdd, pMsg, msgLen);
+            pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SCAN_REQ);
+            pMsg->length = pal_cpu_to_be16(msgLen);
+            //ToDO: Fill in session info when we need to do scan base on session.
+            pMsg->sessionId = 0;
+            pMsg->transactionId = 0;
+            pMsg->dot11mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode ));
+            pMsg->bssType = pal_cpu_to_be32(csrTranslateBsstypeToMacType(pScanReq->BSSType));
+
+            if ( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+            {
+              pSelfMac = (tANI_U8 *)&pMac->roam.roamSession[sessionId].selfMacAddr;
+            }
+            else
+            {
+              // Since we don't have session for the scanning, we find a valid session. In case we fail to
+              // do so, get the WNI_CFG_STA_ID
+              for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+              {
+                if( CSR_IS_SESSION_VALID( pMac, i ) )
+                {
+                  pSelfMac = (tANI_U8 *)&pMac->roam.roamSession[i].selfMacAddr;
+                  break;
+                }
+              }
+              if( CSR_ROAM_SESSION_MAX == i )
+              {
+                tANI_U32 len = WNI_CFG_BSSID_LEN;
+                pSelfMac = selfMacAddr;
+                status = ccmCfgGetStr( pMac, WNI_CFG_STA_ID, pSelfMac, &len );
+                if( !HAL_STATUS_SUCCESS( status ) || 
+                    ( len < WNI_CFG_BSSID_LEN ) )
+                {
+                  smsLog( pMac, LOGE, FL(" Can not get self MAC address from CFG status = %d"), status );
+                  //Force failed status
+                  status = eHAL_STATUS_FAILURE;
+                  break;
+                }
+              }
+            }
+            palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, pSelfMac, sizeof(tSirMacAddr) );
+
+            //sirCopyMacAddr
+            palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->bssId, (tANI_U8 *)&pScanReq->bssid, sizeof(tSirMacAddr) );
+            if( palEqualMemory( pMac->hHdd, pScanReq->bssid, bssid, sizeof(tCsrBssid) ) )
+            {
+                palFillMemory( pMac->hHdd, pMsg->bssId, sizeof(tSirMacAddr), 0xff );
+            }
+            else
+            {
+                palCopyMemory(pMac->hHdd, pMsg->bssId, pScanReq->bssid, WNI_CFG_BSSID_LEN); 
+            }
+            minChnTime = pScanReq->minChnTime;
+            maxChnTime = pScanReq->maxChnTime;
+
+            //Verify the scan type first, if the scan is active scan, we need to make sure we 
+            //are allowed to do so.
+            /* if 11d is enabled & we don't see any beacon around, scan type falls
+               back to passive. But in BT AMP STA mode we need to send out a
+               directed probe*/
+            if( (eSIR_PASSIVE_SCAN != scanType) && (eCSR_SCAN_P2P_DISCOVERY != pScanReq->requestType)
+                && (eCSR_BSS_TYPE_WDS_STA != pScanReq->BSSType)
+                && (eANI_BOOLEAN_FALSE == pMac->scan.fEnableBypass11d))
+            {
+                scanType = pMac->scan.curScanType;
+                if(eSIR_PASSIVE_SCAN == pMac->scan.curScanType)
+                {
+                    if(minChnTime < pMac->roam.configParam.nPassiveMinChnTime) 
+                    {
+                        minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+                    }
+                    if(maxChnTime < pMac->roam.configParam.nPassiveMaxChnTime)
+                    {
+                        maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
+                    }
+                }
+            }
+            pMsg->scanType = pal_cpu_to_be32(scanType);
+
+        pMsg->numSsid = (pScanReq->SSIDs.numOfSSIDs < SIR_SCAN_MAX_NUM_SSID) ? pScanReq->SSIDs.numOfSSIDs :
+                                                        SIR_SCAN_MAX_NUM_SSID;
+            if((pScanReq->SSIDs.numOfSSIDs != 0) && ( eSIR_PASSIVE_SCAN != scanType ))
+            {
+            for (i = 0; i < pMsg->numSsid; i++)
+            {
+                palCopyMemory(pMac->hHdd, &pMsg->ssId[i], &pScanReq->SSIDs.SSIDList[i].SSID, sizeof(tSirMacSSid));
+            }
+            }
+            else
+            {
+                //Otherwise we scan all SSID and let the result filter later
+            for (i = 0; i < SIR_SCAN_MAX_NUM_SSID; i++)
+            {
+                pMsg->ssId[i].length = 0;
+            }
+            }
+
+//TODO: This preprocessor macro should be removed from CSR for production driver
+//This is a temperarory fix for scanning on FPGA.
+#if defined (ANI_CHIPSET_VIRGO) || defined (LIBRA_FPGA)|| defined (VOLANS_FPGA)
+            pMsg->minChannelTime = pal_cpu_to_be32(minChnTime * 8);
+            pMsg->maxChannelTime = pal_cpu_to_be32(maxChnTime * 8);
+#elif defined (ANI_CHIPSET_TAURUS) || defined(ANI_CHIPSET_LIBRA) || defined(ANI_CHIPSET_VOLANS)
+            pMsg->minChannelTime = pal_cpu_to_be32(minChnTime);
+            pMsg->maxChannelTime = pal_cpu_to_be32(maxChnTime);
+#else
+#error unknown chipset
+#endif
+            //hidden SSID option
+            pMsg->hiddenSsid = pScanReqParam->hiddenSsid;
+            //rest time
+            //pMsg->restTime = pScanReq->restTime;
+            pMsg->returnAfterFirstMatch = pScanReqParam->bReturnAfter1stMatch;
+            // All the scan results caching will be done by Roaming
+            // We do not want LIM to do any caching of scan results,
+            // so delete the LIM cache on all scan requests
+            pMsg->returnFreshResults = pScanReqParam->freshScan;
+            //Always ask for unique result
+            pMsg->returnUniqueResults = pScanReqParam->fUniqueResult;
+            pMsg->channelList.numChannels = (tANI_U8)pScanReq->ChannelInfo.numOfChannels;
+            if(pScanReq->ChannelInfo.numOfChannels)
+            {
+                //Assuming the channelNumber is tANI_U8 (1 byte)
+                status = palCopyMemory(pMac->hHdd, pMsg->channelList.channelNumber, pScanReq->ChannelInfo.ChannelList, 
+                                        pScanReq->ChannelInfo.numOfChannels);
+            }
+
+            pMsg->uIEFieldLen = (tANI_U16) pScanReq->uIEFieldLen;
+            pMsg->uIEFieldOffset = (tANI_U16)(sizeof( tSirSmeScanReq ) - sizeof( pMsg->channelList.channelNumber ) + 
+                  ( sizeof( pMsg->channelList.channelNumber ) * pScanReq->ChannelInfo.numOfChannels )) ;
+            if(pScanReq->uIEFieldLen != 0) 
+            {
+                palCopyMemory(pMac->hHdd, (tANI_U8 *)pMsg+pMsg->uIEFieldOffset,
+                                    pScanReq->pIEField, pScanReq->uIEFieldLen );
+            }
+#ifdef WLAN_FEATURE_P2P
+            pMsg->p2pSearch = pScanReq->p2pSearch;
+#endif
+
+        }while(0);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = palSendMBMessage(pMac->hHdd, pMsg);
+        }
+        else {
+            palFreeMemory(pMac->hHdd, pMsg);
+        }
+    }//Success allocated memory
+
+
+    return( status );
+}
+
+eHalStatus csrSendMBScanResultReq( tpAniSirGlobal pMac, tScanReqParam *pScanReqParam )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeScanReq *pMsg;
+    tANI_U16 msgLen;
+
+    msgLen = (tANI_U16)(sizeof( tSirSmeScanReq ));
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SCAN_REQ);
+        pMsg->length = pal_cpu_to_be16(msgLen);
+        pMsg->sessionId = 0;
+        pMsg->returnFreshResults = pScanReqParam->freshScan;
+        //Always ask for unique result
+        pMsg->returnUniqueResults = pScanReqParam->fUniqueResult;
+        pMsg->returnAfterFirstMatch = pScanReqParam->bReturnAfter1stMatch;
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }                             
+
+    return( status );
+}
+
+
+
+eHalStatus csrScanChannels( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanReqParam scanReq;
+    
+    do
+    {    
+        scanReq.freshScan = CSR_SME_SCAN_FLAGS_DELETE_CACHE | TRUE;
+        scanReq.fUniqueResult = TRUE;
+        scanReq.hiddenSsid = SIR_SCAN_NO_HIDDEN_SSID;
+        if(eCsrScanForSsid == pCommand->u.scanCmd.reason)
+        {
+            scanReq.bReturnAfter1stMatch = CSR_SCAN_RETURN_AFTER_FIRST_MATCH;
+        }
+        else
+        {
+            // Basically do scan on all channels even for 11D 1st scan case.
+            scanReq.bReturnAfter1stMatch = CSR_SCAN_RETURN_AFTER_ALL_CHANNELS;
+        }
+        if((eCsrScanBgScan == pCommand->u.scanCmd.reason)||
+           (eCsrScanProbeBss == pCommand->u.scanCmd.reason))
+        {
+            scanReq.hiddenSsid = SIR_SCAN_HIDDEN_SSID_PE_DECISION;
+        }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+        {
+            vos_log_scan_pkt_type *pScanLog = NULL;
+
+            WLAN_VOS_DIAG_LOG_ALLOC(pScanLog, vos_log_scan_pkt_type, LOG_WLAN_SCAN_C);
+            if(pScanLog)
+            {
+                if(eCsrScanBgScan == pCommand->u.scanCmd.reason || 
+                    eCsrScanProbeBss == pCommand->u.scanCmd.reason)
+                {
+                    pScanLog->eventId = WLAN_SCAN_EVENT_HO_SCAN_REQ;
+                }
+                else
+                {
+                    if( (eSIR_PASSIVE_SCAN != pCommand->u.scanCmd.u.scanRequest.scanType) && 
+                        (eSIR_PASSIVE_SCAN != pMac->scan.curScanType) )
+                    {
+                        pScanLog->eventId = WLAN_SCAN_EVENT_ACTIVE_SCAN_REQ;
+                    }
+                    else
+                    {
+                        pScanLog->eventId = WLAN_SCAN_EVENT_PASSIVE_SCAN_REQ;
+                    }
+                }
+                pScanLog->minChnTime = (v_U8_t)pCommand->u.scanCmd.u.scanRequest.minChnTime;
+                pScanLog->maxChnTime = (v_U8_t)pCommand->u.scanCmd.u.scanRequest.maxChnTime;
+                pScanLog->numChannel = (v_U8_t)pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
+                if(pScanLog->numChannel && (pScanLog->numChannel < VOS_LOG_MAX_NUM_CHANNEL))
+                {
+                    palCopyMemory(pMac->hHdd, pScanLog->channels,
+                                  pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList,
+                                  pScanLog->numChannel);
+                }
+                WLAN_VOS_DIAG_LOG_REPORT(pScanLog);
+            }
+        }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+
+        status = csrSendMBScanReq(pMac, pCommand->sessionId,
+                                &pCommand->u.scanCmd.u.scanRequest, &scanReq);
+    }while(0);
+    
+    return( status );
+}
+
+
+eHalStatus csrScanRetrieveResult(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tScanReqParam scanReq;
+    
+    do
+    {    
+        //not a fresh scan
+        scanReq.freshScan = CSR_SME_SCAN_FLAGS_DELETE_CACHE;
+        scanReq.fUniqueResult = TRUE;
+        scanReq.bReturnAfter1stMatch = CSR_SCAN_RETURN_AFTER_ALL_CHANNELS;
+        status = csrSendMBScanResultReq(pMac, &scanReq);
+    }while(0);
+    
+    return (status);
+}
+
+
+
+eHalStatus csrProcessScanCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrChannelInfo newChannelInfo = {0, NULL};
+    int i, j;
+    tANI_U8 *pChannel = NULL;
+    tANI_U32 len = 0;
+
+    // Transition to Scanning state...
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+       if(CSR_IS_SESSION_VALID(pMac, i))
+       {
+      pCommand->u.scanCmd.lastRoamState[i] = csrRoamStateChange( pMac, eCSR_ROAMING_STATE_SCANNING, i);
+      smsLog( pMac, LOG3, "starting SCAN command from %d state.... reason is %d\n", pCommand->u.scanCmd.lastRoamState[i], pCommand->u.scanCmd.reason );
+       }
+    }
+
+    switch(pCommand->u.scanCmd.reason)
+    {
+    case eCsrScanGetResult:
+    case eCsrScanForCapsChange:     //For cap change, LIM already save BSS description
+        status = csrScanRetrieveResult(pMac);
+        break;
+    case eCsrScanSetBGScanParam:
+        status = csrProcessSetBGScanParam(pMac, pCommand);
+        break;
+    case eCsrScanBGScanAbort:
+        status = csrSetCfgBackgroundScanPeriod(pMac, 0);
+        break;
+    case eCsrScanBGScanEnable:
+        status = csrSetCfgBackgroundScanPeriod(pMac, pMac->roam.configParam.bgScanInterval);
+        break;
+    case eCsrScanGetScanChnInfo:
+        status = csrScanGetScanChannelInfo(pMac);
+        break;
+    case eCsrScanUserRequest:
+        if(pMac->roam.configParam.fScanTwice)
+        {
+            //We scan 2.4 channel twice
+            if(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels &&
+               (NULL != pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList))
+            {
+                len = pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
+                //allocate twice the channel
+                newChannelInfo.ChannelList = (tANI_U8 *)vos_mem_malloc(newChannelInfo.numOfChannels * 2);
+                pChannel = pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList;
+            }
+            else
+            {
+                //get the valid channel list to scan all.
+                len = sizeof(pMac->roam.validChannelList);
+
+                if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len)))
+                {
+                    //allocate twice the channel
+                    newChannelInfo.ChannelList = (tANI_U8 *)vos_mem_malloc(len * 2);
+                    pChannel = pMac->roam.validChannelList;
+                }
+            }
+            if(NULL == newChannelInfo.ChannelList)
+            {
+                newChannelInfo.numOfChannels = 0;
+            }
+            else
+            {
+                j = 0;
+                for(i = 0; i < len; i++)
+                {
+                    newChannelInfo.ChannelList[j++] = pChannel[i];
+                    if(CSR_MAX_24GHz_CHANNEL_NUMBER >= pChannel[i])
+                    {
+                        newChannelInfo.ChannelList[j++] = pChannel[i];
+                    }
+                }
+                if(NULL != pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList)
+                {
+                    //pChannel points to the channellist from the command, free it.
+                    vos_mem_free(pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList);
+                }
+                pCommand->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = j;
+                pCommand->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList = newChannelInfo.ChannelList;
+            }
+        } //if(pMac->roam.configParam.fScanTwice)
+
+        status = csrScanChannels(pMac, pCommand);
+
+        break;
+    default:
+        status = csrScanChannels(pMac, pCommand);
+        break;
+    }    
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrReleaseScanCommand(pMac, pCommand, eCSR_SCAN_FAILURE);
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanSetBGScanparams(tpAniSirGlobal pMac, tCsrBGScanRequest *pScanReq)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand = NULL;
+    
+    if(pScanReq)
+    {
+        do
+        {
+            pCommand = csrGetCommandBuffer(pMac);
+            if(!pCommand)
+            {
+                status = eHAL_STATUS_RESOURCES;
+                break;
+            }
+            palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+            pCommand->command = eSmeCommandScan;
+            pCommand->u.scanCmd.reason = eCsrScanSetBGScanParam;
+            pCommand->u.scanCmd.callback = NULL;
+            pCommand->u.scanCmd.pContext = NULL;
+            palCopyMemory(pMac->hHdd, &pCommand->u.scanCmd.u.bgScanRequest, pScanReq, sizeof(tCsrBGScanRequest));
+            //we have to do the follow
+            if(pScanReq->ChannelInfo.numOfChannels == 0)
+            {
+                pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList = NULL;
+            }
+            else
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList,
+                                             pScanReq->ChannelInfo.numOfChannels);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    palCopyMemory(pMac->hHdd, pCommand->u.scanCmd.u.bgScanRequest.ChannelInfo.ChannelList,
+                                    pScanReq->ChannelInfo.ChannelList, pScanReq->ChannelInfo.numOfChannels); 
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, FL("ran out of memory\n"));
+                    csrReleaseCommandScan(pMac, pCommand);
+                    break;
+                }
+            }
+
+            //scan req for SSID
+            if(pScanReq->SSID.length)
+            {
+               palCopyMemory(pMac->hHdd, 
+                             pCommand->u.scanCmd.u.bgScanRequest.SSID.ssId,
+                             pScanReq->SSID.ssId, 
+                             pScanReq->SSID.length);
+               pCommand->u.scanCmd.u.bgScanRequest.SSID.length = pScanReq->SSID.length;
+
+            }
+            pCommand->u.scanCmd.u.bgScanRequest.maxChnTime= pScanReq->maxChnTime;
+            pCommand->u.scanCmd.u.bgScanRequest.minChnTime = pScanReq->minChnTime;
+            pCommand->u.scanCmd.u.bgScanRequest.scanInterval = pScanReq->scanInterval;
+
+
+            status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                csrReleaseCommandScan( pMac, pCommand );
+                break;
+            }
+        }while(0);
+    }
+    
+    return (status);
+}
+
+eHalStatus csrScanBGScanAbort( tpAniSirGlobal pMac )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand = NULL;
+    
+    do
+    {
+        pCommand = csrGetCommandBuffer(pMac);
+        if(!pCommand)
+        {
+            status = eHAL_STATUS_RESOURCES;
+            break;
+        }
+        palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+        pCommand->command = eSmeCommandScan; 
+        pCommand->u.scanCmd.reason = eCsrScanBGScanAbort;
+        pCommand->u.scanCmd.callback = NULL;
+        pCommand->u.scanCmd.pContext = NULL;
+        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+            csrReleaseCommandScan( pMac, pCommand );
+            break;
+        }
+    }while(0);
+    
+    return (status);
+}
+
+
+//This will enable the background scan with the non-zero interval 
+eHalStatus csrScanBGScanEnable(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSmeCmd *pCommand = NULL;
+    
+    if(pMac->roam.configParam.bgScanInterval)
+    {
+        do
+        {
+            pCommand = csrGetCommandBuffer(pMac);
+            if(!pCommand)
+            {
+                status = eHAL_STATUS_RESOURCES;
+                break;
+            }
+            palZeroMemory(pMac->hHdd, &pCommand->u.scanCmd, sizeof(tScanCmd));
+            pCommand->command = eSmeCommandScan; 
+            pCommand->u.scanCmd.reason = eCsrScanBGScanEnable;
+            pCommand->u.scanCmd.callback = NULL;
+            pCommand->u.scanCmd.pContext = NULL;
+            status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                csrReleaseCommandScan( pMac, pCommand );
+                break;
+            }
+        }while(0);
+        //BG scan results are reported automatically by PE to SME once the scan is done.
+        //No need to fetch the results explicitly.
+        //csrScanStartGetResultTimer(pMac);
+        csrScanStartResultAgingTimer(pMac);
+    }
+    else
+    {
+        //We don't have BG scan so stop the aging timer
+        csrScanStopResultAgingTimer(pMac);
+        smsLog(pMac, LOGE, FL("cannot continue because the bgscan interval is 0\n"));
+        status = eHAL_STATUS_INVALID_PARAMETER;
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanCopyRequest(tpAniSirGlobal pMac, tCsrScanRequest *pDstReq, tCsrScanRequest *pSrcReq)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 len = sizeof(pMac->roam.validChannelList);
+    tANI_U32 index = 0;
+    tANI_U32 new_index = 0;
+
+    do
+    {
+        status = csrScanFreeRequest(pMac, pDstReq);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            status = palCopyMemory(pMac->hHdd, pDstReq, pSrcReq, sizeof(tCsrScanRequest));
+            if(pSrcReq->uIEFieldLen == 0)
+            {
+                pDstReq->pIEField = NULL;
+            }
+            else
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pDstReq->pIEField, pSrcReq->uIEFieldLen);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    palCopyMemory(pMac->hHdd, pDstReq->pIEField, pSrcReq->pIEField, pSrcReq->uIEFieldLen);
+                    pDstReq->uIEFieldLen = pSrcReq->uIEFieldLen;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, "No memory for scanning IE fields\n");
+                    break;
+                }
+            }//Allocate memory for IE field
+            {
+                if(pSrcReq->ChannelInfo.numOfChannels == 0)
+                {
+                    pDstReq->ChannelInfo.ChannelList = NULL;
+                        pDstReq->ChannelInfo.numOfChannels = 0;
+                }
+                else
+                {
+                    status = palAllocateMemory(pMac->hHdd, (void **)&pDstReq->ChannelInfo.ChannelList, 
+                                        pSrcReq->ChannelInfo.numOfChannels * sizeof(*pDstReq->ChannelInfo.ChannelList));
+                    if(!HAL_STATUS_SUCCESS(status))
+                    {
+                        pDstReq->ChannelInfo.numOfChannels = 0;
+                        smsLog(pMac, LOGE, "No memory for scanning Channel List\n");
+                        break;
+                    }
+
+                    if((pSrcReq->scanType == eSIR_PASSIVE_SCAN) && (pSrcReq->requestType == eCSR_SCAN_REQUEST_11D_SCAN))
+                    {
+                       for ( index = 0; index < pSrcReq->ChannelInfo.numOfChannels ; index++ )
+                       {
+                          pDstReq->ChannelInfo.ChannelList[new_index] =
+                                             pSrcReq->ChannelInfo.ChannelList[index];
+                          new_index++;
+                    }
+                       pDstReq->ChannelInfo.numOfChannels = new_index;
+                    }
+                    else if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len)))
+                    {
+                        new_index = 0;
+                        pMac->roam.numValidChannels = len;
+                        for ( index = 0; index < pSrcReq->ChannelInfo.numOfChannels ; index++ )
+                        {
+                            if(csrRoamIsValidChannel(pMac, pSrcReq->ChannelInfo.ChannelList[index]))
+                            {
+                                pDstReq->ChannelInfo.ChannelList[new_index] =
+                                    pSrcReq->ChannelInfo.ChannelList[index];
+                                new_index++;
+                            }
+                        }
+                        pDstReq->ChannelInfo.numOfChannels = new_index;
+                    }
+                    else
+                    {
+                        smsLog(pMac, LOGE, "Couldn't get the valid Channel List, keeping requester's list\n");
+                        palCopyMemory(pMac->hHdd, pDstReq->ChannelInfo.ChannelList, pSrcReq->ChannelInfo.ChannelList, 
+                                        pSrcReq->ChannelInfo.numOfChannels * sizeof(*pDstReq->ChannelInfo.ChannelList));
+                        pDstReq->ChannelInfo.numOfChannels = pSrcReq->ChannelInfo.numOfChannels;
+                    }
+                }//Allocate memory for Channel List
+            }
+            if(pSrcReq->SSIDs.numOfSSIDs == 0)
+            {
+                pDstReq->SSIDs.numOfSSIDs = 0;
+                pDstReq->SSIDs.SSIDList = NULL;
+            }
+            else
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pDstReq->SSIDs.SSIDList, 
+                                    pSrcReq->SSIDs.numOfSSIDs * sizeof(*pDstReq->SSIDs.SSIDList));
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    pDstReq->SSIDs.numOfSSIDs = pSrcReq->SSIDs.numOfSSIDs;
+                    palCopyMemory(pMac->hHdd, pDstReq->SSIDs.SSIDList, pSrcReq->SSIDs.SSIDList, 
+                                    pSrcReq->SSIDs.numOfSSIDs * sizeof(*pDstReq->SSIDs.SSIDList));
+                }
+                else
+                {
+                    pDstReq->SSIDs.numOfSSIDs = 0;
+                    smsLog(pMac, LOGE, "No memory for scanning SSID List\n");
+                    break;
+                }
+            }//Allocate memory for SSID List
+#ifdef WLAN_FEATURE_P2P
+            pDstReq->p2pSearch = pSrcReq->p2pSearch;
+#endif
+
+        }
+    }while(0);
+    
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrScanFreeRequest(pMac, pDstReq);
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanFreeRequest(tpAniSirGlobal pMac, tCsrScanRequest *pReq)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    
+    if(pReq->ChannelInfo.ChannelList)
+    {
+        status = palFreeMemory(pMac->hHdd, pReq->ChannelInfo.ChannelList);
+        pReq->ChannelInfo.ChannelList = NULL;
+    }
+    pReq->ChannelInfo.numOfChannels = 0;
+    if(pReq->pIEField)
+    {
+        status = palFreeMemory(pMac->hHdd, pReq->pIEField);
+        pReq->pIEField = NULL;
+    }
+    pReq->uIEFieldLen = 0;
+    if(pReq->SSIDs.SSIDList)
+    {
+        palFreeMemory(pMac->hHdd, pReq->SSIDs.SSIDList);
+        pReq->SSIDs.SSIDList = NULL;
+    }
+    pReq->SSIDs.numOfSSIDs = 0;
+    
+    return (status);
+}
+
+
+void csrScanCallCallback(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus)
+{
+    if(pCommand->u.scanCmd.callback)
+    {
+//        sme_ReleaseGlobalLock( &pMac->sme );
+        pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, pCommand->u.scanCmd.scanID, scanStatus); 
+//        sme_AcquireGlobalLock( &pMac->sme );
+    } else {
+        smsLog( pMac, LOGW, "%s:%d - Callback NULL!!!\n", __FUNCTION__, __LINE__);
+    }
+}
+
+
+void csrScanStopTimers(tpAniSirGlobal pMac)
+{
+    csrScanStopResultAgingTimer(pMac);
+    csrScanStopIdleScanTimer(pMac);
+    csrScanStopGetResultTimer(pMac);
+}
+
+
+eHalStatus csrScanStartGetResultTimer(tpAniSirGlobal pMac)
+{
+    eHalStatus status;
+    
+    if(pMac->scan.fScanEnable)
+    {
+        status = palTimerStart(pMac->hHdd, pMac->scan.hTimerGetResult, CSR_SCAN_GET_RESULT_INTERVAL, eANI_BOOLEAN_TRUE);
+    }
+    else
+    {
+        status = eHAL_STATUS_FAILURE;
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanStopGetResultTimer(tpAniSirGlobal pMac)
+{
+    return (palTimerStop(pMac->hHdd, pMac->scan.hTimerGetResult));
+}
+
+
+void csrScanGetResultTimerHandler(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    
+    csrScanRequestResult(pMac);
+}
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+static void csrStaApConcTimerHandler(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    tListElem *pEntry;
+    tSmeCmd *pScanCmd;
+
+    csrLLLock(&pMac->scan.scanCmdPendingList);
+
+    if ( NULL != ( pEntry = csrLLPeekHead( &pMac->scan.scanCmdPendingList, LL_ACCESS_NOLOCK) ) )
+    {    
+        tCsrScanRequest scanReq;
+        tSmeCmd *pSendScanCmd = NULL;
+        tANI_U8 numChn = 0;
+        tANI_U8 i;
+        tCsrChannelInfo *pChnInfo = &scanReq.ChannelInfo;
+        tANI_U8    channelToScan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+        eHalStatus status;
+       
+
+        pScanCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        numChn = pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
+        if (numChn > 1)
+        {
+             palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
+
+             pSendScanCmd = csrGetCommandBuffer(pMac); //optimize this to use 2 command buffer only
+             if (!pSendScanCmd)
+             {
+                 smsLog( pMac, LOGE, FL(" Failed to get Queue command buffer\n") );
+                 csrLLUnlock(&pMac->scan.scanCmdPendingList);
+                 return;
+             }
+             pSendScanCmd->command = pScanCmd->command; 
+             pSendScanCmd->sessionId = pScanCmd->sessionId;
+             pSendScanCmd->u.scanCmd.callback = NULL;
+             pSendScanCmd->u.scanCmd.pContext = pScanCmd->u.scanCmd.pContext;
+             pSendScanCmd->u.scanCmd.reason = pScanCmd->u.scanCmd.reason;
+             pSendScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+
+             pChnInfo->numOfChannels = 1;
+             palCopyMemory(pMac->hHdd, &channelToScan[0], &pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[0], 
+                          1 * sizeof(tANI_U8)); //just send one channel
+             pChnInfo->ChannelList = &channelToScan[0];
+
+             for (i = 0; i < (numChn-2); i++)
+             {
+                 pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[i] = 
+                 pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[i+1]; //Move all the channels one step
+             }
+          
+             pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = numChn -1; //reduce outstanding # of channels to be scanned
+
+             scanReq.BSSType = eCSR_BSS_TYPE_ANY;
+             //Modify callers parameters in case of concurrency
+             scanReq.scanType = eSIR_ACTIVE_SCAN;
+             scanReq.maxChnTime = CSR_MIN(pScanCmd->u.scanCmd.u.scanRequest.maxChnTime,CSR_ACTIVE_MAX_CHANNEL_TIME_CONC);
+             scanReq.minChnTime =  CSR_MIN(pScanCmd->u.scanCmd.u.scanRequest.minChnTime,CSR_ACTIVE_MIN_CHANNEL_TIME_CONC);
+
+             status = csrScanCopyRequest(pMac, &pSendScanCmd->u.scanCmd.u.scanRequest, &scanReq);
+             if(!HAL_STATUS_SUCCESS(status))
+             {
+                 smsLog( pMac, LOGE, FL(" Failed to get copy csrScanRequest = %d\n"), status );
+                 csrLLUnlock(&pMac->scan.scanCmdPendingList);
+                 return;
+             }       
+        }
+        else
+        {    //numChn ==1 This is the last channel to be scanned
+             //last channel remaining to scan
+             pSendScanCmd = pScanCmd;
+             //remove this command from pending list 
+             if (csrLLRemoveHead( &pMac->scan.scanCmdPendingList, LL_ACCESS_NOLOCK) == NULL)
+             { //In case between PeekHead and here, the entry got removed by another thread.
+                 smsLog( pMac, LOGE, FL(" Failed to remove entry from scanCmdPendingList\n"));
+             }
+            
+        }               
+        csrQueueSmeCommand(pMac, pSendScanCmd, eANI_BOOLEAN_FALSE);
+
+    }
+
+    if (!csrLLIsListEmpty( &pMac->scan.scanCmdPendingList, LL_ACCESS_NOLOCK ))
+    {
+         palTimerStart(pMac->hHdd, pMac->scan.hTimerStaApConcTimer, 
+                 CSR_SCAN_STAAP_CONC_INTERVAL, eANI_BOOLEAN_FALSE);
+    }
+    csrLLUnlock(&pMac->scan.scanCmdPendingList);
+    
+}
+#endif
+
+eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac)
+{
+    eHalStatus status;
+    
+    if(pMac->scan.fScanEnable)
+    {
+        status = palTimerStart(pMac->hHdd, pMac->scan.hTimerResultAging, CSR_SCAN_RESULT_AGING_INTERVAL, eANI_BOOLEAN_TRUE);
+    }
+    else
+    {
+        status = eHAL_STATUS_FAILURE;
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac)
+{
+    return (palTimerStop(pMac->hHdd, pMac->scan.hTimerResultAging));
+}
+
+
+//This function returns the maximum time a BSS is allowed in the scan result.
+//The time varies base on connection and power saving factors.
+//Not connected, No PS
+//Not connected, with PS
+//Connected w/o traffic, No PS
+//Connected w/o traffic, with PS
+//Connected w/ traffic, no PS -- Not supported
+//Connected w/ traffic, with PS -- Not supported
+//the return unit is in seconds. 
+tANI_U32 csrScanGetAgeOutTime(tpAniSirGlobal pMac)
+{
+    tANI_U32 nRet;
+
+    if(pMac->scan.nAgingCountDown)
+    {
+        //Calculate what should be the timeout value for this
+        nRet = pMac->scan.nLastAgeTimeOut * pMac->scan.nAgingCountDown;
+        pMac->scan.nAgingCountDown--;
+    }
+    else
+    {
+        if( csrIsAllSessionDisconnected( pMac ) )
+        {
+            if(pmcIsPowerSaveEnabled(pMac, ePMC_IDLE_MODE_POWER_SAVE))
+            {
+                nRet = pMac->roam.configParam.scanAgeTimeNCPS;
+            }
+            else
+            {
+                nRet = pMac->roam.configParam.scanAgeTimeNCNPS;
+            }
+        }
+        else
+        {
+            if(pmcIsPowerSaveEnabled(pMac, ePMC_BEACON_MODE_POWER_SAVE))
+            {
+                nRet = pMac->roam.configParam.scanAgeTimeCPS;
+            }
+            else
+            {
+                nRet = pMac->roam.configParam.scanAgeTimeCNPS;
+            }
+        }
+        //If state-change causing aging time out change, we want to delay it somewhat to avoid
+        //unnecessary removal of BSS. This is mostly due to transition from connect to disconnect.
+        if(pMac->scan.nLastAgeTimeOut > nRet)
+        {
+            if(nRet)
+            {
+                pMac->scan.nAgingCountDown = (pMac->scan.nLastAgeTimeOut / nRet);
+            }
+            pMac->scan.nLastAgeTimeOut = nRet;
+            nRet *= pMac->scan.nAgingCountDown;
+        }
+        else
+        {
+            pMac->scan.nLastAgeTimeOut = nRet;
+        }
+    }
+
+    return (nRet);
+}
+
+
+void csrScanResultAgingTimerHandler(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    tANI_BOOLEAN fDisconnected = csrIsAllSessionDisconnected(pMac);
+    
+    //no scan, no aging
+    if(pMac->scan.fScanEnable && 
+        (((eANI_BOOLEAN_FALSE == fDisconnected) && pMac->roam.configParam.bgScanInterval)    
+        || (fDisconnected && (pMac->scan.fCancelIdleScan == eANI_BOOLEAN_FALSE)))
+        )
+    {
+        tListElem *pEntry, *tmpEntry;
+        tCsrScanResult *pResult;
+        tANI_TIMESTAMP ageOutTime = (tANI_TIMESTAMP)(csrScanGetAgeOutTime(pMac) * PAL_TICKS_PER_SECOND); //turn it into 10ms units
+        tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+
+        csrLLLock(&pMac->scan.scanResultList);
+        pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+        while( pEntry ) 
+        {
+            tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
+            pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+            if((curTime - pResult->Result.BssDescriptor.nReceivedTime) > ageOutTime)
+            {
+                smsLog(pMac, LOGW, " age out due to time out");
+                csrScanAgeOutBss(pMac, pResult);
+            }
+            pEntry = tmpEntry;
+        }
+        csrLLUnlock(&pMac->scan.scanResultList);
+    }
+}
+
+
+eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval)
+{
+    eHalStatus status;
+    
+    smsLog(pMac, LOG1, " csrScanStartIdleScanTimer \n ");
+    if((pMac->scan.fScanEnable) && (eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan) && interval)
+    {
+        pMac->scan.nIdleScanTimeGap += interval;
+        palTimerStop(pMac->hHdd, pMac->scan.hTimerIdleScan);
+        status = palTimerStart(pMac->hHdd, pMac->scan.hTimerIdleScan, interval, eANI_BOOLEAN_FALSE);
+        if( !HAL_STATUS_SUCCESS(status) )
+        {
+            smsLog(pMac, LOGE, "  Fail to start Idle scan timer. status = %d interval = %d\n", status, interval);
+            //This should not happen but set the flag to restart when ready
+            pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+        }
+    }
+    else
+    {
+        if( pMac->scan.fScanEnable && (eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan) )
+        {
+            pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+        }
+        status = eHAL_STATUS_FAILURE;
+    }
+    
+    return (status);
+}
+
+
+eHalStatus csrScanStopIdleScanTimer(tpAniSirGlobal pMac)
+{
+    return (palTimerStop(pMac->hHdd, pMac->scan.hTimerIdleScan));
+}
+
+
+//Stop CSR from asking for IMPS, This function doesn't disable IMPS from CSR
+void csrScanSuspendIMPS( tpAniSirGlobal pMac )
+{
+    csrScanCancelIdleScan(pMac);
+}
+
+
+//Start CSR from asking for IMPS. This function doesn't trigger CSR to request entering IMPS
+//because IMPS maybe disabled.
+void csrScanResumeIMPS( tpAniSirGlobal pMac )
+{
+    csrScanStartIdleScan( pMac );
+}
+
+
+void csrScanIMPSCallback(void *callbackContext, eHalStatus status)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( callbackContext );
+
+    if(eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
+    {
+        if(pMac->roam.configParam.IsIdleScanEnabled) 
+        {
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                if(csrIsAllSessionDisconnected(pMac) && !csrIsRoamCommandWaiting(pMac))
+                {
+                    smsLog(pMac, LOGW, FL("starts idle mode full scan\n"));
+                    csrScanAllChannels(pMac, eCSR_SCAN_IDLE_MODE_SCAN);
+                }
+                else
+                {
+                    smsLog(pMac, LOGW, FL("cannot start idle mode full scan\n"));
+                    //even though we are in timer handle, calling stop timer will make sure the timer
+                    //doesn't get to restart.
+                    csrScanStopIdleScanTimer(pMac);
+                }
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL("sees not success status (%d)\n"), status);
+            }
+        }
+        else
+        {//we might need another flag to check if CSR needs to request imps at all
+       
+            tANI_U32 nTime = 0;
+
+            pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
+            if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
+            {
+                csrScanStartIdleScanTimer(pMac, nTime);
+            }
+        }
+    }
+}
+
+
+//Param: pTimeInterval -- Caller allocated memory in return, if failed, to specify the nxt time interval for 
+//idle scan timer interval
+//Return: Not success -- meaning it cannot start IMPS, caller needs to start a timer for idle scan
+eHalStatus csrScanTriggerIdleScan(tpAniSirGlobal pMac, tANI_U32 *pTimeInterval)
+{
+    eHalStatus status = eHAL_STATUS_CSR_WRONG_STATE;
+
+    //Do not trigger IMPS in case of concurrency
+    if (vos_concurrent_sessions_running())
+        return (status);
+
+    if(pTimeInterval)
+    {
+        *pTimeInterval = 0;
+    }
+
+    smsLog(pMac, LOGW, FL("called\n"));
+    if( smeCommandPending( pMac ) )
+    {
+        smsLog( pMac, LOGW, FL("  Cannot request IMPS because command pending\n") );
+        //Not to enter IMPS because more work to do
+        if(pTimeInterval)
+        {
+            *pTimeInterval = 0;
+        }
+        //restart when ready
+        pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+
+        return (status);
+    }
+
+    if((pMac->scan.fScanEnable) && (eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan) 
+    /*&& pMac->roam.configParam.impsSleepTime*/)
+    {
+        //Stop get result timer because idle scan gets scan result out of PE
+        csrScanStopGetResultTimer(pMac);
+        if(pTimeInterval)
+        {
+            *pTimeInterval = pMac->roam.configParam.impsSleepTime;
+        }
+        //pmcRequestImps take a period in millisecond unit.
+        status = pmcRequestImps(pMac, pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_MS_UNIT, csrScanIMPSCallback, pMac);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            if(eHAL_STATUS_PMC_ALREADY_IN_IMPS != status)
+            {
+                //Do restart the timer if CSR thinks it cannot do IMPS
+                if( !csrCheckPSReady( pMac ) )
+                {
+                    if(pTimeInterval)
+                    {
+                    *pTimeInterval = 0;
+                }
+                    //Set the restart flag to true because that idle scan 
+                    //can be restarted even though the timer will not be running
+                    pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+                }
+                else
+                {
+                    //For not now, we do a quicker retry
+                    if(pTimeInterval)
+                    {
+                    *pTimeInterval = CSR_IDLE_SCAN_WAIT_TIME;
+                }
+            }
+                smsLog(pMac, LOGW, FL("call pmcRequestImps and it returns status code (%d)\n"), status);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, FL("already in IMPS\n"));
+                //Since CSR is the only module to request for IMPS. If it is already in IMPS, CSR assumes
+                //the callback will be called in the future. Should not happen though.
+                status = eHAL_STATUS_SUCCESS;
+                pMac->scan.nIdleScanTimeGap = 0;
+            }
+        }
+        else
+        {
+            //requested so let's reset the value
+            pMac->scan.nIdleScanTimeGap = 0;
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrScanStartIdleScan(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_CSR_WRONG_STATE;
+    tANI_U32 nTime = 0;
+
+    smsLog(pMac, LOGW, FL("called\n"));
+    if(pMac->roam.configParam.IsIdleScanEnabled)
+    {
+        //stop bg scan first
+        csrScanBGScanAbort(pMac);
+        //Stop get result timer because idle scan gets scan result out of PE
+        csrScanStopGetResultTimer(pMac);
+        //Enable aging timer since idle scan is going on
+        csrScanStartResultAgingTimer(pMac);
+    }
+    pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
+    status = csrScanTriggerIdleScan(pMac, &nTime);
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        csrScanStartIdleScanTimer(pMac, nTime);
+    }
+
+    return (status);
+}
+
+
+void csrScanCancelIdleScan(tpAniSirGlobal pMac)
+{
+    if(eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
+    {
+#ifdef WLAN_SOFTAP_FEATURE
+        if (vos_concurrent_sessions_running()) {
+            return;
+        }
+#endif
+        smsLog(pMac, LOG1, "  csrScanCancelIdleScan\n");
+        pMac->scan.fCancelIdleScan = eANI_BOOLEAN_TRUE;
+        //Set the restart flag in case later on it is uncancelled
+        pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+        csrScanStopIdleScanTimer(pMac);
+        csrScanRemoveNotRoamingScanCommand(pMac);
+    }
+}
+
+
+void csrScanIdleScanTimerHandler(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    eHalStatus status;
+    tANI_U32 nTime = 0;
+
+    smsLog(pMac, LOGW, "  csrScanIdleScanTimerHandler called  ");
+    status = csrScanTriggerIdleScan(pMac, &nTime);
+    if(!HAL_STATUS_SUCCESS(status) && (eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan))
+    {
+        //Check whether it is time to actually do an idle scan
+        if(pMac->scan.nIdleScanTimeGap >= pMac->roam.configParam.impsSleepTime)
+        {
+            pMac->scan.nIdleScanTimeGap = 0;
+            csrScanIMPSCallback(pMac, eHAL_STATUS_SUCCESS);
+        }
+        else
+        {
+            csrScanStartIdleScanTimer(pMac, nTime);
+        }
+    }
+}
+
+
+
+
+tANI_BOOLEAN csrScanRemoveNotRoamingScanCommand(tpAniSirGlobal pMac)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry, *pEntryTmp;
+    tSmeCmd *pCommand;
+    tDblLinkList localList;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return fRet;
+    }
+
+    csrLLLock(&pMac->sme.smeCmdPendingList);
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK);
+    while(pEntry)
+    {
+        pEntryTmp = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK);
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if( eSmeCommandScan == pCommand->command )
+        {
+            switch( pCommand->u.scanCmd.reason )
+            {
+            case eCsrScanIdleScan:
+                if( csrLLRemoveEntry(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK) )
+                {
+                    csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+                }
+                fRet = eANI_BOOLEAN_TRUE;
+                break;
+
+            default:
+                break;
+            } //switch
+        }
+        pEntry = pEntryTmp;
+    }
+
+    csrLLUnlock(&pMac->sme.smeCmdPendingList);
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        csrReleaseCommandScan( pMac, pCommand );
+    }
+
+    csrLLClose(&localList);
+
+    return (fRet);
+}
+
+
+tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry, *pEntryTmp;
+    tSmeCmd *pCommand;
+    tDblLinkList localList;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return fRet;
+    }
+
+    csrLLLock(&pMac->sme.smeCmdPendingList);
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK);
+    while(pEntry)
+    {
+        pEntryTmp = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK);
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if( (eSmeCommandScan == pCommand->command) && (sessionId == pCommand->sessionId) )
+        {
+            switch(pCommand->u.scanCmd.reason)
+            {
+            case eCsrScanGetResult:
+            case eCsrScanSetBGScanParam:
+            case eCsrScanBGScanAbort:
+            case eCsrScanBGScanEnable:
+            case eCsrScanGetScanChnInfo:
+                break;
+            default:
+                 smsLog (pMac, LOGW, "%s: -------- abort scan command reason = %d\n",
+                    __FUNCTION__, pCommand->u.scanCmd.reason);
+                //The rest are fresh scan requests
+                if( csrLLRemoveEntry(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK) )
+                {
+                    csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+                }
+                fRet = eANI_BOOLEAN_TRUE;
+                break;
+            }
+        }
+        pEntry = pEntryTmp;
+    }
+
+    csrLLUnlock(&pMac->sme.smeCmdPendingList);
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if (pCommand->u.scanCmd.callback)
+        {
+            /* User scan request is pending, 
+                                 * send response with status eCSR_SCAN_ABORT*/
+            pCommand->u.scanCmd.callback(pMac, 
+                     pCommand->u.scanCmd.pContext, 
+                     pCommand->u.scanCmd.scanID, 
+                     eCSR_SCAN_ABORT);
+        }
+        csrReleaseCommandScan( pMac, pCommand );
+    }
+    csrLLClose(&localList);
+
+    return (fRet);
+}
+
+
+void csrReleaseScanCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus)
+{
+    eCsrScanReason reason = pCommand->u.scanCmd.reason;
+    tANI_U32 i;
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+       if(CSR_IS_SESSION_VALID(pMac, i))
+           csrRoamStateChange( pMac, pCommand->u.scanCmd.lastRoamState[i], i);
+    }
+
+        csrScanCallCallback(pMac, pCommand, scanStatus);
+
+    smsLog(pMac, LOG3, "   Remove Scan command reason = %d\n", reason);
+    if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_LOCK ) )
+    {
+        csrReleaseCommandScan( pMac, pCommand );
+    }
+    else
+    {
+        smsLog(pMac, LOGE, " ********csrReleaseScanCommand cannot release command reason %d\n", pCommand->u.scanCmd.reason );
+    }
+}
+
+
+eHalStatus csrScanGetPMKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                        tPmkidCandidateInfo *pPmkidList, tANI_U32 *pNumItems )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "  pMac->scan.NumPmkidCandidate = %d\n ", pSession->NumPmkidCandidate);
+    csrResetPMKIDCandidateList(pMac, sessionId);
+    if(csrIsConnStateConnected(pMac, sessionId) && pSession->pCurRoamProfile)
+    {
+        tCsrScanResultFilter *pScanFilter;
+        tCsrScanResultInfo *pScanResult;
+        tScanResultHandle hBSSList;
+        tANI_U32 nItems = *pNumItems;
+
+        *pNumItems = 0;
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            //Here is the profile we need to connect to
+            status = csrRoamPrepareFilterFromProfile(pMac, pSession->pCurRoamProfile, pScanFilter);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    while(((pScanResult = csrScanResultGetNext(pMac, hBSSList)) != NULL) && ( pSession->NumPmkidCandidate < nItems))
+                    {
+                        //NumPmkidCandidate adds up here
+                        csrProcessBSSDescForPMKIDList(pMac, &pScanResult->BssDescriptor, 
+                                                      (tDot11fBeaconIEs *)( pScanResult->pvIes ));
+                    }
+                    if(pSession->NumPmkidCandidate)
+                    {
+                        *pNumItems = pSession->NumPmkidCandidate;
+                        palCopyMemory(pMac->hHdd, pPmkidList, pSession->PmkidCandidateInfo, 
+                                      pSession->NumPmkidCandidate * sizeof(tPmkidCandidateInfo));
+                    }
+                    csrScanResultPurge(pMac, hBSSList);
+                }//Have scan result
+                csrFreeScanFilter(pMac, pScanFilter);
+            }
+            palFreeMemory(pMac->hHdd, pScanFilter);
+        }
+    }
+
+    return (status);
+}
+
+
+
+#ifdef FEATURE_WLAN_WAPI
+eHalStatus csrScanGetBKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                       tBkidCandidateInfo *pBkidList, tANI_U32 *pNumItems )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    smsLog(pMac, LOGW, "  pMac->scan.NumBkidCandidate = %d\n ", pSession->NumBkidCandidate);
+    csrResetBKIDCandidateList(pMac, sessionId);
+    if(csrIsConnStateConnected(pMac, sessionId) && pSession->pCurRoamProfile)
+    {
+        tCsrScanResultFilter *pScanFilter;
+        tCsrScanResultInfo *pScanResult;
+        tScanResultHandle hBSSList;
+        tANI_U32 nItems = *pNumItems;
+        *pNumItems = 0;
+        status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter));
+            //Here is the profile we need to connect to
+            status = csrRoamPrepareFilterFromProfile(pMac, pSession->pCurRoamProfile, pScanFilter);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    while(((pScanResult = csrScanResultGetNext(pMac, hBSSList)) != NULL) && ( pSession->NumBkidCandidate < nItems))
+                    {
+                        //pMac->scan.NumBkidCandidate adds up here
+                        csrProcessBSSDescForBKIDList(pMac, &pScanResult->BssDescriptor,
+                              (tDot11fBeaconIEs *)( pScanResult->pvIes ));
+
+                    }
+                    if(pSession->NumBkidCandidate)
+                    {
+                        *pNumItems = pSession->NumBkidCandidate;
+                        palCopyMemory(pMac->hHdd, pBkidList, pSession->BkidCandidateInfo, pSession->NumBkidCandidate * sizeof(tBkidCandidateInfo));
+                    }
+                    csrScanResultPurge(pMac, hBSSList);
+                }//Have scan result
+            }
+            palFreeMemory(pMac->hHdd, pScanFilter);
+        }
+    }
+
+    return (status);
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+
+
+//This function is usually used for BSSs that suppresses SSID so the profile 
+//shall have one and only one SSID
+eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tANI_U32 roamId)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tSmeCmd *pScanCmd = NULL;
+    tANI_U8 bAddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 
+    tANI_U8  index = 0;
+    tANI_U32 numSsid = pProfile->SSIDs.numOfSSIDs;
+
+    smsLog(pMac, LOG2, FL("called\n"));
+    //For WDS, we use the index 0. There must be at least one in there
+    if( CSR_IS_WDS_STA( pProfile ) && numSsid )
+    {
+        numSsid = 1;
+    }
+    if(pMac->scan.fScanEnable && ( numSsid == 1 ) )
+    {
+        do
+        {
+            pScanCmd = csrGetCommandBuffer(pMac);
+            if(!pScanCmd)
+            {
+                smsLog(pMac, LOGE, FL("failed to allocate command buffer\n"));
+                break;
+            }
+            palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
+            status = palAllocateMemory(pMac->hHdd, (void **)&pScanCmd->u.scanCmd.pToRoamProfile, sizeof(tCsrRoamProfile));
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            status = csrRoamCopyProfile(pMac, pScanCmd->u.scanCmd.pToRoamProfile, pProfile);
+            if(!HAL_STATUS_SUCCESS(status))
+                break;
+            pScanCmd->u.scanCmd.roamId = roamId;
+            pScanCmd->command = eSmeCommandScan;
+            pScanCmd->sessionId = (tANI_U8)sessionId; 
+            pScanCmd->u.scanCmd.callback = NULL;
+            pScanCmd->u.scanCmd.pContext = NULL;
+            pScanCmd->u.scanCmd.reason = eCsrScanForSsid;
+            pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+            palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd.u.scanRequest, sizeof(tCsrScanRequest));
+            pScanCmd->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+            pScanCmd->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+            pScanCmd->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+            pScanCmd->u.scanCmd.u.scanRequest.BSSType = pProfile->BSSType;
+            pScanCmd->u.scanCmd.u.scanRequest.uIEFieldLen = 0;
+            if(pProfile->BSSIDs.numOfBSSIDs == 1)
+            {
+                palCopyMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid));
+            }
+            else
+            {
+                palCopyMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.bssid, bAddr, 6);
+            }
+            if(pProfile->ChannelInfo.numOfChannels)
+            {
+               status = palAllocateMemory(pMac->hHdd, (void **)&pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList, sizeof(*pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels);
+               pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = 0;
+               if(HAL_STATUS_SUCCESS(status))
+                {
+                  csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[0]);
+                  for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++)
+                  {
+                     if(csrRoamIsValidChannel(pMac, pProfile->ChannelInfo.ChannelList[index]))
+                     {
+                        pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.ChannelList[pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels] 
+                           = pProfile->ChannelInfo.ChannelList[index];
+                        pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels++;
+                     }
+                     else 
+                     {
+                         smsLog(pMac, LOGW, FL("process a channel (%d) that is invalid\n"), pProfile->ChannelInfo.ChannelList[index]);
+                     }
+
+                  }
+               }
+               else
+                {
+                    break;
+                }
+
+            }
+            else
+            {
+                pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = 0;
+            }
+            if(pProfile->SSIDs.numOfSSIDs)
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pScanCmd->u.scanCmd.u.scanRequest.SSIDs.SSIDList, 
+                                            pProfile->SSIDs.numOfSSIDs * sizeof(tCsrSSIDInfo)); 
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    break;
+                }
+                pScanCmd->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs = 1;
+                palCopyMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.SSIDs.SSIDList, pProfile->SSIDs.SSIDList,
+                                sizeof(tCsrSSIDInfo));
+            }
+            //Start process the command
+            status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                break;
+            }
+        }while(0);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            if(pScanCmd)
+            {
+                csrReleaseCommandScan(pMac, pScanCmd);
+                //TODO:free the memory that is allocated in this function
+            }
+            csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
+        }
+    }//valid
+    else
+    {
+        smsLog(pMac, LOGE, FL("cannot scan because scanEnable (%d) or numSSID (%d) is invalid\n"),
+                pMac->scan.fScanEnable, pProfile->SSIDs.numOfSSIDs);
+    }
+    
+    return (status);
+}
+
+
+//Issue a scan base on the new capability infomation
+//This should only happen when the associated AP changes its capability.
+//After this scan is done, CSR reroams base on the new scan results
+eHalStatus csrScanForCapabilityChange(tpAniSirGlobal pMac, tSirSmeApNewCaps *pNewCaps)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tSmeCmd *pScanCmd = NULL;
+
+    if(pNewCaps)
+    {
+        do
+        {
+            pScanCmd = csrGetCommandBuffer(pMac);
+            if(!pScanCmd)
+            {
+                smsLog(pMac, LOGE, FL("failed to allocate command buffer\n"));
+                status = eHAL_STATUS_RESOURCES;
+                break;
+            }
+            palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
+            status = eHAL_STATUS_SUCCESS;
+            pScanCmd->u.scanCmd.roamId = 0;
+            pScanCmd->command = eSmeCommandScan; 
+            pScanCmd->u.scanCmd.callback = NULL;
+            pScanCmd->u.scanCmd.pContext = NULL;
+            pScanCmd->u.scanCmd.reason = eCsrScanForCapsChange;
+            pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
+            status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
+                break;
+            }
+        }while(0);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            if(pScanCmd)
+            {
+                csrReleaseCommandScan(pMac, pScanCmd);
+            }
+        }    
+    }
+
+    return (status);
+}
+
+
+
+void csrInitBGScanChannelList(tpAniSirGlobal pMac)
+{
+    tANI_U32 len = CSR_MIN(sizeof(pMac->roam.validChannelList), sizeof(pMac->scan.bgScanChannelList));
+
+    palZeroMemory(pMac->hHdd, pMac->scan.bgScanChannelList, len);
+    pMac->scan.numBGScanChannel = 0;
+
+    if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len)))
+    {
+        pMac->roam.numValidChannels = len;
+        pMac->scan.numBGScanChannel = (tANI_U8)CSR_MIN(len, WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN);
+        palCopyMemory(pMac->hHdd, pMac->scan.bgScanChannelList, pMac->roam.validChannelList, pMac->scan.numBGScanChannel);
+        csrSetBGScanChannelList(pMac, pMac->scan.bgScanChannelList, pMac->scan.numBGScanChannel);
+    }
+}
+
+
+//This function return TRUE if background scan channel list is adjusted. 
+//this function will only shrink the background scan channel list
+tANI_BOOLEAN csrAdjustBGScanChannelList(tpAniSirGlobal pMac, tANI_U8 *pChannelList, tANI_U8 NumChannels,
+                                        tANI_U8 *pAdjustChannels, tANI_U8 *pNumAdjustChannels)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+    tANI_U8 i, j, count = *pNumAdjustChannels;
+
+    i = 0;
+    while(i < count)
+    {
+        for(j = 0; j < NumChannels; j++)
+        {
+            if(pChannelList[j] == pAdjustChannels[i])
+                break;
+        }
+        if(j == NumChannels)
+        {
+            //This channel is not in the list, remove it
+            fRet = eANI_BOOLEAN_TRUE;
+            count--;
+            if(count - i)
+            {
+                palCopyMemory(pMac->hHdd, &pAdjustChannels[i], &pAdjustChannels[i+1], count - i);
+            }
+            else
+            {
+                //already remove the last one. Done.
+                break;
+            }
+        }
+        else
+        {
+            i++;
+        }
+    }//while(i<count)
+    *pNumAdjustChannels = count;
+
+    return (fRet);
+}
+
+
+//Get the list of the base channels to scan for passively 11d info
+eHalStatus csrScanGetSupportedChannels( tpAniSirGlobal pMac )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    int n = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+
+    status = vos_nv_getSupportedChannels( pMac->scan.baseChannels.channelList, &n, NULL, NULL );
+    if( HAL_STATUS_SUCCESS(status) )
+    {
+        pMac->scan.baseChannels.numChannels = (tANI_U8)n;
+    }
+    else
+    {
+        smsLog( pMac, LOGE, FL(" failed\n") );
+        pMac->scan.baseChannels.numChannels = 0;
+    }
+    
+    return ( status );
+}
+
+//This function use the input pChannelList to validate the current saved channel list
+eHalStatus csrSetBGScanChannelList( tpAniSirGlobal pMac, tANI_U8 *pAdjustChannels, tANI_U8 NumAdjustChannels)
+{
+    tANI_U32 dataLen = sizeof( tANI_U8 ) * NumAdjustChannels;
+
+    return (ccmCfgSetStr(pMac, WNI_CFG_BG_SCAN_CHANNEL_LIST, pAdjustChannels, dataLen, NULL, eANI_BOOLEAN_FALSE));
+}
+
+
+void csrSetCfgValidChannelList( tpAniSirGlobal pMac, tANI_U8 *pChannelList, tANI_U8 NumChannels )
+{
+    tANI_U32 dataLen = sizeof( tANI_U8 ) * NumChannels;
+
+
+    ccmCfgSetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, pChannelList, dataLen, NULL, eANI_BOOLEAN_FALSE);
+
+    return;
+}
+
+
+
+/*
+ * The Tx power limits are saved in the cfg for future usage.
+ */
+void csrSaveTxPowerToCfg( tpAniSirGlobal pMac, tDblLinkList *pList, tANI_U32 cfgId )
+{
+    tListElem *pEntry;
+    tANI_U32 cbLen = 0, dataLen;
+    tCsrChannelPowerInfo *pChannelSet;
+    tANI_U32 idx;
+    tSirMacChanInfo *pChannelPowerSet;
+    tANI_U8 *pBuf = NULL;
+
+    //allocate maximum space for all channels
+    dataLen = WNI_CFG_VALID_CHANNEL_LIST_LEN * sizeof(tSirMacChanInfo);
+    if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pBuf, dataLen)))
+    {
+        palZeroMemory(pMac->hHdd, pBuf, dataLen);
+        pChannelPowerSet = (tSirMacChanInfo *)(pBuf);
+
+        pEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
+        // write the tuples (startChan, numChan, txPower) for each channel found in the channel power list.
+        while( pEntry )
+        {
+            pChannelSet = GET_BASE_ADDR( pEntry, tCsrChannelPowerInfo, link );
+            if ( 1 != pChannelSet->interChannelOffset )
+            {
+                // we keep the 5G channel sets internally with an interchannel offset of 4.  Expand these
+                // to the right format... (inter channel offset of 1 is the only option for the triplets
+                // that 11d advertises.
+                if ((cbLen + (pChannelSet->numChannels * sizeof(tSirMacChanInfo))) >= dataLen)
+                {
+                    // expanding this entry will overflow our allocation
+                    smsLog(pMac, LOGE,
+                           "%s: Buffer overflow, start %d, num %d, offset %d",
+                           __FUNCTION__,
+                           pChannelSet->firstChannel,
+                           pChannelSet->numChannels,
+                           pChannelSet->interChannelOffset);
+                    break;
+                }
+
+                for( idx = 0; idx < pChannelSet->numChannels; idx++ )
+                {
+                    pChannelPowerSet->firstChanNum = (tSirMacChanNum)(pChannelSet->firstChannel + ( idx * pChannelSet->interChannelOffset ));
+                    smsLog(pMac, LOG3, " Setting Channel Number %d\n", pChannelPowerSet->firstChanNum);
+                    pChannelPowerSet->numChannels  = 1;
+#ifdef WLAN_SOFTAP_FEATURE
+                    pChannelPowerSet->maxTxPower = CSR_ROAM_MIN( pChannelSet->txPower, pMac->roam.configParam.nTxPowerCap );
+#else
+                    pChannelPowerSet->maxTxPower = pChannelSet->txPower;
+#endif
+                    smsLog(pMac, LOG3, " Setting Max Transmit Power %d\n", pChannelPowerSet->maxTxPower);
+                    cbLen += sizeof( tSirMacChanInfo );
+                    pChannelPowerSet++;
+                }
+            }
+            else
+            {
+                if (cbLen >= dataLen)
+                {
+                    // this entry will overflow our allocation
+                    smsLog(pMac, LOGE,
+                           "%s: Buffer overflow, start %d, num %d, offset %d",
+                           __FUNCTION__,
+                           pChannelSet->firstChannel,
+                           pChannelSet->numChannels,
+                           pChannelSet->interChannelOffset);
+                    break;
+                }
+                pChannelPowerSet->firstChanNum = pChannelSet->firstChannel;
+                smsLog(pMac, LOG3, " Setting Channel Number %d\n", pChannelPowerSet->firstChanNum);
+                pChannelPowerSet->numChannels = pChannelSet->numChannels;
+#ifdef WLAN_SOFTAP_FEATURE
+                pChannelPowerSet->maxTxPower = CSR_ROAM_MIN( pChannelSet->txPower, pMac->roam.configParam.nTxPowerCap );
+#else
+                pChannelPowerSet->maxTxPower = pChannelSet->txPower;
+#endif
+                smsLog(pMac, LOG3, " Setting Max Transmit Power %d, nTxPower %d\n", pChannelPowerSet->maxTxPower,pMac->roam.configParam.nTxPowerCap );
+
+
+                cbLen += sizeof( tSirMacChanInfo );
+                pChannelPowerSet++;
+            }
+
+            pEntry = csrLLNext( pList, pEntry, LL_ACCESS_LOCK );
+        }
+
+        if(cbLen)
+        {
+            ccmCfgSetStr(pMac, cfgId, (tANI_U8 *)pBuf, cbLen, NULL, eANI_BOOLEAN_FALSE); 
+        }
+        palFreeMemory( pMac->hHdd, pBuf );
+    }//Allocate memory
+}
+
+
+void csrSetCfgCountryCode( tpAniSirGlobal pMac, tANI_U8 *countryCode )
+{
+    tANI_U8 cc[WNI_CFG_COUNTRY_CODE_LEN];
+    ///v_REGDOMAIN_t DomainId;
+    
+    smsLog( pMac, LOG3, "Setting Country Code in Cfg from csrSetCfgCountryCode %s\n",countryCode );
+    palCopyMemory( pMac->hHdd, cc, countryCode, WNI_CFG_COUNTRY_CODE_LEN );
+
+    // don't program the bogus country codes that we created for Korea in the MAC.  if we see
+    // the bogus country codes, program the MAC with the right country code.
+    if ( ( 'K'  == countryCode[ 0 ] && '1' == countryCode[ 1 ]  ) ||
+         ( 'K'  == countryCode[ 0 ] && '2' == countryCode[ 1 ]  ) ||
+         ( 'K'  == countryCode[ 0 ] && '3' == countryCode[ 1 ]  ) ||
+         ( 'K'  == countryCode[ 0 ] && '4' == countryCode[ 1 ]  )    )
+    {
+        // replace the alternate Korea country codes, 'K1', 'K2', .. with 'KR' for Korea
+        cc[ 1 ] = 'R';
+    }
+    ccmCfgSetStr(pMac, WNI_CFG_COUNTRY_CODE, cc, WNI_CFG_COUNTRY_CODE_LEN, NULL, eANI_BOOLEAN_FALSE);
+
+    //Need to let HALPHY know about the current domain so it can apply some 
+    //domain-specific settings (TX filter...)
+    /*if(HAL_STATUS_SUCCESS(csrGetRegulatoryDomainForCountry(pMac, cc, &DomainId)))
+    {
+        halPhySetRegDomain(pMac, DomainId);
+    }*/
+}
+
+
+
+eHalStatus csrGetCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *pbLen)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 len;
+
+    if(pBuf && pbLen && (*pbLen >= WNI_CFG_COUNTRY_CODE_LEN))
+    {
+        len = *pbLen;
+        status = ccmCfgGetStr(pMac, WNI_CFG_COUNTRY_CODE, pBuf, &len);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            *pbLen = (tANI_U8)len;
+        }
+    }
+    
+    return (status);
+}
+
+
+void csrSetCfgScanControlList( tpAniSirGlobal pMac, tANI_U8 *countryCode, tCsrChannel *pChannelList  )
+{   
+    tANI_U8 i, j;
+    tANI_BOOLEAN found=FALSE;  
+    tANI_U8 *pControlList = NULL;
+    tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
+
+    if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pControlList, WNI_CFG_SCAN_CONTROL_LIST_LEN)))
+    {
+        palZeroMemory(pMac->hHdd, (void *)pControlList, WNI_CFG_SCAN_CONTROL_LIST_LEN);
+        if(HAL_STATUS_SUCCESS(ccmCfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, pControlList, &len)))
+        {
+            for (i = 0; i < pChannelList->numChannels; i++)
+            {
+                for (j = 0; j < len; j += 2) 
+                {
+                    if (pControlList[j] == pChannelList->channelList[i]) 
+                    {
+                        found = TRUE;
+                        break;
+                    }
+                }
+                   
+                if (found)    // insert a pair(channel#, flag)
+                {
+                    if (CSR_IS_CHANNEL_5GHZ(pControlList[j]))
+                    {
+                        pControlList[j+1] = csrGetScanType(pMac, pControlList[j]);     
+                    }
+                    else  
+                    {
+                        pControlList[j+1]  = eSIR_ACTIVE_SCAN;  
+                    }
+
+                    found = FALSE;  // reset the flag
+                }
+                       
+            }            
+
+            ccmCfgSetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, pControlList, len, NULL, eANI_BOOLEAN_FALSE);
+        }//Successfully getting scan control list
+        palFreeMemory(pMac->hHdd, pControlList);
+    }//AllocateMemory
+}
+
+
+//if bgPeriod is 0, background scan is disabled. It is in millisecond units
+eHalStatus csrSetCfgBackgroundScanPeriod(tpAniSirGlobal pMac, tANI_U32 bgPeriod)
+{
+    return (ccmCfgSetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, bgPeriod, (tCcmCfgSetCallback) csrScanCcmCfgSetCallback, eANI_BOOLEAN_FALSE));
+}
+    
+
+void csrScanCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result)
+{
+    tListElem *pEntry = NULL;
+    tSmeCmd *pCommand = NULL;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+    if ( pEntry )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if ( eSmeCommandScan == pCommand->command )
+        {
+            eCsrScanStatus scanStatus = (CCM_IS_RESULT_SUCCESS(result)) ? eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
+            csrReleaseScanCommand(pMac, pCommand, scanStatus);
+        }
+        else
+        {
+            smsLog( pMac, LOGW, "CSR: Scan Completion called but SCAN command is not ACTIVE ...\n" );
+        }
+    }   
+    smeProcessPendingQueue( pMac );
+}
+
+eHalStatus csrProcessSetBGScanParam(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+{
+    eHalStatus status;
+    tCsrBGScanRequest *pScanReq = &pCommand->u.scanCmd.u.bgScanRequest;
+    tANI_U32 dataLen = sizeof( tANI_U8 ) * pScanReq->ChannelInfo.numOfChannels;
+        
+    //***setcfg for background scan channel list
+    status = ccmCfgSetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME, pScanReq->minChnTime, NULL, eANI_BOOLEAN_FALSE);
+    status = ccmCfgSetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME, pScanReq->maxChnTime, NULL, eANI_BOOLEAN_FALSE);
+    //Not set the background scan interval if not connected because bd scan should not be run if not connected
+    if(!csrIsAllSessionDisconnected(pMac))
+    {
+        //If disbaling BG scan here, we need to stop aging as well
+        if(pScanReq->scanInterval == 0)
+        {
+            //Stop aging because no new result is coming in
+            csrScanStopResultAgingTimer(pMac);
+        }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+        {
+            vos_log_scan_pkt_type *pScanLog = NULL;
+
+            WLAN_VOS_DIAG_LOG_ALLOC(pScanLog, vos_log_scan_pkt_type, LOG_WLAN_SCAN_C);
+            if(pScanLog)
+            {
+                pScanLog->eventId = WLAN_SCAN_EVENT_HO_SCAN_REQ;
+                pScanLog->minChnTime = (v_U8_t)pScanReq->minChnTime;
+                pScanLog->maxChnTime = (v_U8_t)pScanReq->maxChnTime;
+                pScanLog->timeBetweenBgScan = (v_U8_t)pScanReq->scanInterval;
+                pScanLog->numChannel = pScanReq->ChannelInfo.numOfChannels;
+                if(pScanLog->numChannel && (pScanLog->numChannel < VOS_LOG_MAX_NUM_CHANNEL))
+                {
+                    palCopyMemory(pMac->hHdd, pScanLog->channels, pScanReq->ChannelInfo.ChannelList,
+                        pScanLog->numChannel);
+                }
+                WLAN_VOS_DIAG_LOG_REPORT(pScanLog);
+            }
+        }
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+        status = ccmCfgSetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, pScanReq->scanInterval, NULL, eANI_BOOLEAN_FALSE);
+    }
+    else
+    {
+        //No need to stop aging because IDLE scan is still running
+        status = ccmCfgSetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, 0, NULL, eANI_BOOLEAN_FALSE);
+    }
+    
+    if(pScanReq->SSID.length > WNI_CFG_SSID_LEN)
+    {
+        pScanReq->SSID.length = WNI_CFG_SSID_LEN;
+    }
+    
+    status = ccmCfgSetStr(pMac, WNI_CFG_BG_SCAN_CHANNEL_LIST, pScanReq->ChannelInfo.ChannelList, dataLen, NULL, eANI_BOOLEAN_FALSE);
+    status = ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pScanReq->SSID.ssId, pScanReq->SSID.length, NULL, eANI_BOOLEAN_FALSE);
+
+
+
+    return (status);
+}
+
+
+eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirMbMsg *pMsg;
+    tANI_U16 msgLen;
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+    csrLLLock(&pMac->scan.scanCmdPendingList);
+    while( NULL != ( pEntry = csrLLRemoveHead( &pMac->scan.scanCmdPendingList, LL_ACCESS_NOLOCK) ) )
+    {
+
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        csrAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE);
+    }
+    csrLLUnlock(&pMac->scan.scanCmdPendingList);
+#endif
+
+    pMac->scan.fDropScanCmd = eANI_BOOLEAN_TRUE;
+    csrRemoveCmdFromPendingList( pMac, &pMac->roam.roamCmdPendingList, eSmeCommandScan);
+    csrRemoveCmdFromPendingList( pMac, &pMac->sme.smeCmdPendingList, eSmeCommandScan);
+    pMac->scan.fDropScanCmd = eANI_BOOLEAN_FALSE;
+
+    //We need to abort scan only if we are scanning
+    if(NULL != (pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK)))
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if(eSmeCommandScan == pCommand->command)
+        {
+            msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
+            status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+            if(HAL_STATUS_SUCCESS(status))
+            {
+                palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
+                pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_SCAN_ABORT_IND);
+                pMsg->msgLen = pal_cpu_to_be16(msgLen);
+                status = palSendMBMessage(pMac->hHdd, pMsg);
+            }
+        }
+    }
+
+    return( status );
+}
+
+void csrRemoveCmdFromPendingList(tpAniSirGlobal pMac, tDblLinkList *pList,
+                                 eSmeCommandType commandType )
+{
+    tDblLinkList localList;
+    tListElem *pEntry;
+    tSmeCmd   *pCommand;
+    tListElem  *pEntryToRemove;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return;
+    }
+
+    csrLLLock(pList);
+    if( !csrLLIsListEmpty( pList, LL_ACCESS_NOLOCK ) )
+    {
+        pEntry = csrLLPeekHead( pList, LL_ACCESS_NOLOCK);
+
+        // Have to make sure we don't loop back to the head of the list, which will
+        // happen if the entry is NOT on the list...
+        while( pEntry )
+        {
+            pEntryToRemove = pEntry;
+            pEntry = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
+            pCommand = GET_BASE_ADDR( pEntryToRemove, tSmeCmd, Link );
+            if ( pCommand->command == commandType )
+            {
+                // Remove that entry only
+                if(csrLLRemoveEntry( pList, pEntryToRemove, LL_ACCESS_NOLOCK))
+                {
+                    csrLLInsertTail(&localList, pEntryToRemove, LL_ACCESS_NOLOCK);
+                }
+            }
+        }
+
+
+    }
+    csrLLUnlock(pList);
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        csrAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE);
+    }
+    csrLLClose(&localList);
+
+}
+
+
+eHalStatus csrScanAbortMacScanNotForConnect(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    if( !csrIsScanForRoamCommandActive( pMac ) )
+    {
+        //Only abort the scan if it is not used for other roam/connect purpose
+        status = csrScanAbortMacScan(pMac);
+    }
+
+    return (status);
+}
+
+
+eHalStatus csrScanGetScanChannelInfo(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirMbMsg *pMsg;
+    tANI_U16 msgLen;
+
+    msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pMsg, msgLen);
+        pMsg->type = eWNI_SME_GET_SCANNED_CHANNEL_REQ;
+        pMsg->msgLen = msgLen;
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }                             
+
+    return( status );
+}
+
+tANI_BOOLEAN csrRoamIsValidChannel( tpAniSirGlobal pMac, tANI_U8 channel )
+{
+    tANI_BOOLEAN fValid = FALSE;
+    tANI_U32 idxValidChannels;
+    tANI_U32 len = pMac->roam.numValidChannels;
+    
+    for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ )
+    {
+       if ( channel == pMac->roam.validChannelList[ idxValidChannels ] )
+       {
+          fValid = TRUE;
+          break;
+       }
+    }
+        
+    return fValid;
+}
+
+
+
+
diff --git a/CORE/SME/src/csr/csrCmdProcess.c b/CORE/SME/src/csr/csrCmdProcess.c
new file mode 100644
index 0000000..cd99696
--- /dev/null
+++ b/CORE/SME/src/csr/csrCmdProcess.c
@@ -0,0 +1,150 @@
+/*
+ * 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 csrCmdProcess.c
+  
+    Implementation for processing various commands.
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated
+ 
+   ========================================================================== */
+
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h" //Check if the below include of aniGobal.h is sufficient for Volans too.
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "aniGlobal.h"
+#endif
+
+#include "palApi.h"
+#include "csrInsideApi.h"
+#include "smeInside.h"
+#include "smsDebug.h"
+
+
+
+
+eHalStatus csrMsgProcessor( tpAniSirGlobal pMac,  void *pMsgBuf )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirSmeRsp *pSmeRsp = (tSirSmeRsp *)pMsgBuf;
+
+    smsLog( pMac, LOG2, "  Message %d[0x%04X] received in curState %d and substate %d\n",
+                pSmeRsp->messageType, pSmeRsp->messageType, 
+                pMac->roam.curState[pSmeRsp->sessionId],
+                pMac->roam.curSubState[pSmeRsp->sessionId] );
+
+    // Process the message based on the state of the roaming states...
+    
+#if defined( ANI_RTT_DEBUG )
+    if(!pAdapter->fRttModeEnabled)
+    {
+#endif//RTT    
+        switch (pMac->roam.curState[pSmeRsp->sessionId])
+        {
+        case eCSR_ROAMING_STATE_SCANNING: 
+        {
+            //Are we in scan state
+#if defined( ANI_EMUL_ASSOC )
+            emulScanningStateMsgProcessor( pAdapter, pMBBufHdr );
+#else
+            status = csrScanningStateMsgProcessor(pMac, pMsgBuf);
+#endif    
+            break;
+        }
+        
+        case eCSR_ROAMING_STATE_JOINED: 
+        {
+            //are we in joined state
+            csrRoamJoinedStateMsgProcessor( pMac, pMsgBuf );
+            break;
+        }
+        
+        case eCSR_ROAMING_STATE_JOINING:
+        {
+            //are we in roaming states
+#if defined( ANI_EMUL_ASSOC )
+            emulRoamingStateMsgProcessor( pAdapter, pMBBufHdr );
+#endif
+            csrRoamingStateMsgProcessor( pMac, pMsgBuf );
+            break;
+        }
+
+        //For all other messages, we ignore it        
+        default:
+        {
+            /*To work-around an issue where checking for set/remove key base on connection state is no longer 
+            * workable due to failure or finding the condition meets both SAP and infra/IBSS requirement.
+            */
+            if( (eWNI_SME_SETCONTEXT_RSP == pSmeRsp->messageType) ||
+                (eWNI_SME_REMOVEKEY_RSP == pSmeRsp->messageType) )
+            {
+                smsLog(pMac, LOGW, FL(" handling msg 0x%X CSR state is %d\n"), pSmeRsp->messageType, pMac->roam.curState[pSmeRsp->sessionId]);
+                csrRoamCheckForLinkStatusChange(pMac, pSmeRsp);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "  Message 0x%04X is not handled by CSR. CSR state is %d \n", pSmeRsp->messageType, pMac->roam.curState[pSmeRsp->sessionId]);
+            }
+            break;
+        }
+        
+        }//switch
+        
+#if defined( ANI_RTT_DEBUG )
+    }
+#endif//RTT
+
+    return (status);
+}
+
+
+
+tANI_BOOLEAN csrCheckPSReady(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+
+    VOS_ASSERT( pMac->roam.sPendingCommands >= 0 );
+    return (pMac->roam.sPendingCommands == 0);
+}
+
+
+void csrFullPowerCallback(void *pv, eHalStatus status)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+
+    (void)status;
+    
+    while( NULL != ( pEntry = csrLLRemoveHead( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ) ) )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        smePushCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
+    }
+
+}
+
+
diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h
new file mode 100644
index 0000000..526f680
--- /dev/null
+++ b/CORE/SME/src/csr/csrInsideApi.h
@@ -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.
+ */
+
+/** ------------------------------------------------------------------------- * 
+    ------------------------------------------------------------------------- *  
+
+  
+    \file csrInsideApi.h
+  
+    Define interface only used by CSR.
+  
+  
+   Copyright (C) 2006 Airgo Networks, Incorporated 
+   ========================================================================== */
+#ifndef CSR_INSIDE_API_H__
+#define CSR_INSIDE_API_H__
+
+
+#include "csrSupport.h"
+#include "smeInside.h"
+#include "vos_nvitem.h"
+
+#define CSR_PASSIVE_MAX_CHANNEL_TIME   110
+#define CSR_PASSIVE_MIN_CHANNEL_TIME   60
+
+#define CSR_ACTIVE_MAX_CHANNEL_TIME    40
+#define CSR_ACTIVE_MIN_CHANNEL_TIME    20
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+#define CSR_ACTIVE_MAX_CHANNEL_TIME_CONC    27
+#define CSR_ACTIVE_MIN_CHANNEL_TIME_CONC    20
+#endif
+
+#define CSR_MAX_NUM_SUPPORTED_CHANNELS 55
+
+#define CSR_MAX_BSS_SUPPORT            100
+
+//This number minus 1 means the number of times a channel is scanned before a BSS is remvoed from
+//cache scan result
+#define CSR_AGING_COUNT     3   
+//The following defines are used by palTimer
+//This is used for palTimer when request to imps fails
+#define CSR_IDLE_SCAN_WAIT_TIME     (1 * PAL_TIMER_TO_SEC_UNIT)     //1 second 
+//This is used for palTimer when imps ps is disabled
+//This number shall not be smaller than 5-6 seconds in general because a full scan may take 3-4 seconds
+#define CSR_IDLE_SCAN_NO_PS_INTERVAL     (10 * PAL_TIMER_TO_SEC_UNIT)     //10 second 
+#define CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN (5 * PAL_TIMER_TO_SEC_UNIT)
+#define CSR_SCAN_GET_RESULT_INTERVAL    (5 * PAL_TIMER_TO_SEC_UNIT)     //5 seconds
+#ifdef WLAN_AP_STA_CONCURRENCY
+#define CSR_SCAN_STAAP_CONC_INTERVAL    (20 * PAL_TIMER_TO_MS_UNIT)     //20 milliseconds
+#endif
+#define CSR_MIC_ERROR_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
+#define CSR_TKIP_COUNTER_MEASURE_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
+#define CSR_SCAN_RESULT_AGING_INTERVAL    (5 * PAL_TIMER_TO_SEC_UNIT)     //5 seconds
+//the following defines are NOT used by palTimer
+#define CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS 50     //50 seconds
+#define CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS 300     //300 seconds
+#define CSR_SCAN_AGING_TIME_CONNECT_NO_PS 150        //150 seconds
+#define CSR_SCAN_AGING_TIME_CONNECT_W_PS 600         //600 seconds
+#define CSR_JOIN_FAILURE_TIMEOUT_DEFAULT ( 3000 )
+#define CSR_JOIN_FAILURE_TIMEOUT_MIN   (300)  //minimal value
+//These are going against the signed RSSI (tANI_S8) so it is between -+127
+#define CSR_BEST_RSSI_VALUE         (-30)   //RSSI >= this is in CAT4
+#define CSR_DEFAULT_RSSI_DB_GAP     30 //every 30 dbm for one category
+#define CSR_BSS_CAP_VALUE_NONE  0    //not much value
+#define CSR_BSS_CAP_VALUE_HT    2    
+#define CSR_BSS_CAP_VALUE_WMM   1
+#define CSR_BSS_CAP_VALUE_UAPSD 1
+#define CSR_DEFAULT_ROAMING_TIME 10   //10 seconds
+#define CSR_ROAM_MIN(X, Y)  ((X) < (Y) ? (X) : (Y))
+#define CSR_ROAM_MAX(X, Y)  ((X) > (Y) ? (X) : (Y))
+
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+#define CSR_JOIN_MAX_RETRY_COUNT             10
+#define CSR_JOIN_RETRY_TIMEOUT_PERIOD        ( 1 *  PAL_TIMER_TO_SEC_UNIT )  // 1 second
+#endif
+
+typedef enum 
+{
+    eCsrNextScanNothing,
+    eCsrNextLostLinkScan1Success,
+    eCsrNextLostLinkScan1Failed,
+    eCsrNextLostLinkScan2Success,
+    eCsrNextLostLinkScan2Failed,
+    eCsrNextLostLinkScan3Success,
+    eCsrNexteScanForSsidSuccess,
+    eCsrNextLostLinkScan3Failed,
+    eCsrNext11dScan1Failure,
+    eCsrNext11dScan1Success,
+    eCsrNext11dScan2Failure, 
+    eCsrNext11dScan2Success,
+    eCsrNext11dScanComplete,
+    eCsrNexteScanForSsidFailure,
+    eCsrNextIdleScanComplete,
+    eCsrNextCapChangeScanComplete,
+
+}eCsrScanCompleteNextCommand;
+
+typedef enum  
+{
+    eCsrJoinSuccess, 
+    eCsrJoinFailure,
+    eCsrReassocSuccess,
+    eCsrReassocFailure, 
+    eCsrNothingToJoin, 
+    eCsrStartBssSuccess,
+    eCsrStartBssFailure,
+    eCsrSilentlyStopRoaming,
+    eCsrSilentlyStopRoamingSaveState,
+    eCsrJoinWdsFailure,
+    
+}eCsrRoamCompleteResult;
+
+typedef struct tagScanReqParam
+{
+    tANI_U8 bReturnAfter1stMatch;
+    tANI_U8 fUniqueResult;
+    tANI_U8 freshScan;
+    tANI_U8 hiddenSsid;
+    tANI_U8 reserved;
+}tScanReqParam;
+
+typedef struct tagCsrScanResult
+{
+    tListElem Link;
+    tANI_S32 AgingCount;    //This BSS is removed when it reaches 0 or less
+    tANI_U32 preferValue;   //The bigger the number, the better the BSS. This value override capValue
+    tANI_U32 capValue;  //The biggger the better. This value is in use only if we have equal preferValue
+    //This member must be the last in the structure because the end of tSirBssDescription (inside) is an
+    //    array with nonknown size at this time
+    
+    eCsrEncryptionType ucEncryptionType; //Preferred Encryption type that matched with profile.
+    eCsrEncryptionType mcEncryptionType; 
+    eCsrAuthType authType; //Preferred auth type that matched with the profile.
+
+    tCsrScanResultInfo Result;
+}tCsrScanResult;
+
+typedef struct
+{
+    tDblLinkList List;
+    tListElem *pCurEntry;
+}tScanResultList;
+
+
+
+
+#define CSR_IS_ROAM_REASON( pCmd, reason ) ( (reason) == (pCmd)->roamCmd.roamReason )
+#define CSR_IS_BETTER_PREFER_VALUE(v1, v2)   ((v1) > (v2))
+#define CSR_IS_EQUAL_PREFER_VALUE(v1, v2)   ((v1) == (v2))
+#define CSR_IS_BETTER_CAP_VALUE(v1, v2)     ((v1) > (v2))
+#define CSR_IS_ENC_TYPE_STATIC( encType ) ( ( eCSR_ENCRYPT_TYPE_NONE == (encType) ) || \
+                                            ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == (encType) ) || \
+                                            ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == (encType) ) )
+#define CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ( CSR_IS_ROAM_JOINED( pMac, sessionId ) && CSR_IS_ROAM_SUBSTATE_WAITFORKEY( pMac, sessionId ) )
+//WIFI has a test case for not using HT rates with TKIP as encryption
+//We may need to add WEP but for now, TKIP only.
+
+#define CSR_IS_11n_ALLOWED( encType ) (( eCSR_ENCRYPT_TYPE_TKIP != (encType) ) && \
+                                      ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY != (encType) ) && \
+                                      ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY != (encType) ) && \
+                                      ( eCSR_ENCRYPT_TYPE_WEP40 != (encType) ) && \
+                                      ( eCSR_ENCRYPT_TYPE_WEP104 != (encType) ) )
+
+eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId);
+eHalStatus csrScanningStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf );
+void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf );
+void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf );
+tANI_BOOLEAN csrScanComplete( tpAniSirGlobal pMac, tSirSmeScanRsp *pScanRsp );
+void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+//pIes2 can be NULL
+tANI_BOOLEAN csrIsDuplicateBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc1, 
+                                           tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 );
+eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc );
+tANI_BOOLEAN csrIsNetworkTypeEqual( tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 );
+eHalStatus csrScanSmeScanResponse( tpAniSirGlobal pMac, void *pMsgBuf );
+/*
+   Prepare a filter base on a profile for parsing the scan results.
+   Upon successful return, caller MUST call csrFreeScanFilter on 
+   pScanFilter when it is done with the filter.
+*/
+eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tCsrScanResultFilter *pScanFilter);
+eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile);
+eHalStatus csrRoamStart(tpAniSirGlobal pMac);
+void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId);
+void csrRoamStartMICFailureTimer(tpAniSirGlobal pMac);
+void csrRoamStopMICFailureTimer(tpAniSirGlobal pMac);
+void csrRoamStartTKIPCounterMeasureTimer(tpAniSirGlobal pMac);
+void csrRoamStopTKIPCounterMeasureTimer(tpAniSirGlobal pMac);
+
+eHalStatus csrScanOpen(tpAniSirGlobal pMac);
+eHalStatus csrScanClose(tpAniSirGlobal pMac);
+eHalStatus csrScanRequestLostLink1( tpAniSirGlobal pMac, tANI_U32 sessionId );
+eHalStatus csrScanRequestLostLink2( tpAniSirGlobal pMac, tANI_U32 sessionId );
+eHalStatus csrScanRequestLostLink3( tpAniSirGlobal pMac, tANI_U32 sessionId );
+eHalStatus csrScanHandleFailedLostlink1(tpAniSirGlobal pMac, tANI_U32 sessionId);
+eHalStatus csrScanHandleFailedLostlink2(tpAniSirGlobal pMac, tANI_U32 sessionId);
+eHalStatus csrScanHandleFailedLostlink3(tpAniSirGlobal pMac, tANI_U32 sessionId);
+tCsrScanResult *csrScanAppendBssDescription( tpAniSirGlobal pMac, 
+                                             tSirBssDescription *pSirBssDescription,
+                                             tDot11fBeaconIEs *pIes);
+void csrScanCallCallback(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus);
+eHalStatus csrScanCopyRequest(tpAniSirGlobal pMac, tCsrScanRequest *pDstReq, tCsrScanRequest *pSrcReq);
+eHalStatus csrScanFreeRequest(tpAniSirGlobal pMac, tCsrScanRequest *pReq);
+eHalStatus csrScanCopyResultList(tpAniSirGlobal pMac, tScanResultHandle hIn, tScanResultHandle *phResult);
+void csrInitBGScanChannelList(tpAniSirGlobal pMac);
+eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tANI_U32 roamId);
+eHalStatus csrScanForCapabilityChange(tpAniSirGlobal pMac, tSirSmeApNewCaps *pNewCaps);
+eHalStatus csrScanStartGetResultTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStopGetResultTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanBGScanEnable(tpAniSirGlobal pMac);
+eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval);
+eHalStatus csrScanStopIdleScanTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStartIdleScan(tpAniSirGlobal pMac);
+//Param: pTimeInterval -- Caller allocated memory in return, if failed, to specify the nxt time interval for 
+//idle scan timer interval
+//Return: Not success -- meaning it cannot start IMPS, caller needs to start a timer for idle scan
+eHalStatus csrScanTriggerIdleScan(tpAniSirGlobal pMac, tANI_U32 *pTimeInterval);
+void csrScanCancelIdleScan(tpAniSirGlobal pMac);
+void csrScanStopTimers(tpAniSirGlobal pMac);
+//This function will remove scan commands that are not related to association or IBSS
+tANI_BOOLEAN csrScanRemoveNotRoamingScanCommand(tpAniSirGlobal pMac);
+//To remove fresh scan commands from the pending queue
+tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionId);
+eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac);
+void csrRemoveCmdFromPendingList(tpAniSirGlobal pMac, tDblLinkList *pList, 
+                                              eSmeCommandType commandType );
+eHalStatus csrScanAbortMacScanNotForConnect(tpAniSirGlobal pMac);
+eHalStatus csrScanGetScanChannelInfo(tpAniSirGlobal pMac);
+//To age out scan results base. tSmeGetScanChnRsp is a pointer returned by LIM that
+//has the information regarding scanned channels.
+//The logic is that whenever CSR add a BSS to scan result, it set the age count to
+//a value. This function deduct the age count if channelId matches the BSS' channelId
+//The BSS is remove if the count reaches 0.
+eHalStatus csrScanAgeResults(tpAniSirGlobal pMac, tSmeGetScanChnRsp *pScanChnInfo);
+
+//If fForce is TRUE we will save the new String that is learn't.
+//Typically it will be true in case of Join or user initiated ioctl
+tANI_BOOLEAN csrLearnCountryInformation( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc,
+                                         tDot11fBeaconIEs *pIes, tANI_BOOLEAN fForce );
+void csrApplyCountryInformation( tpAniSirGlobal pMac, tANI_BOOLEAN fForce );
+void csrSetCfgScanControlList( tpAniSirGlobal pMac, tANI_U8 *countryCode, tCsrChannel *pChannelList  );
+void csrReinitScanCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+void csrFreeScanResultEntry( tpAniSirGlobal pMac, tCsrScanResult *pResult );
+
+eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, 
+                               tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2);
+eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                               tScanResultHandle hBSSList, 
+                               eCsrRoamReason reason, tANI_U32 roamId, 
+                               tANI_BOOLEAN fImediate, tANI_BOOLEAN fClearScan);
+eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                               tCsrRoamModifyProfileFields *pModProfileFields,
+                               eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate);
+void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context );
+eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, 
+                                     tSirBssDescription *pBssDescription,
+                                tSirMacAddr *bssId, tANI_BOOLEAN addKey,
+                                 tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, 
+                                 tANI_U8 keyId, tANI_U16 keyLength, 
+                                 tANI_U8 *pKey, tANI_U8 paeRole );
+eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, 
+                                         tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure );
+eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                                          tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes);
+void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg );
+void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg);
+eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, 
+                                 tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId );
+eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate );
+tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2);
+tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId);
+tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac );
+eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId);
+//pBand can be NULL if caller doesn't need to get it
+//eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, tANI_U8 operationChn, eCsrBand *pBand );
+eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason );
+eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason);
+//pCommand may be NULL
+void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason);
+                                 
+eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, 
+                              tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes );
+eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode );
+eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode );
+eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd );
+eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd );
+eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus status );
+#ifdef WLAN_SOFTAP_FEATURE
+eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus, tANI_U8 sessionId );
+#endif
+eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, 
+                                    tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc );
+eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId );
+eHalStatus csrSendSmeReassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, 
+                                    tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile );
+
+tANI_BOOLEAN csrIsMacAddressEqual( tpAniSirGlobal pMac, tCsrBssid *pMacAddr1, tCsrBssid *pMacAddr2 );
+//Caller should put the BSS' ssid to fiedl bssSsid when comparing SSID for a BSS.
+tANI_BOOLEAN csrIsSsidMatch( tpAniSirGlobal pMac, tANI_U8 *ssid1, tANI_U8 ssid1Len, tANI_U8 *bssSsid, 
+                            tANI_U8 bssSsidLen, tANI_BOOLEAN fSsidRequired );
+tANI_BOOLEAN csrIsPhyModeMatch( tpAniSirGlobal pMac, tANI_U32 phyMode,
+                                    tSirBssDescription *pSirBssDesc, tCsrRoamProfile *pProfile,
+                                    eCsrCfgDot11Mode *pReturnCfgDot11Mode,
+                                    tDot11fBeaconIEs *pIes);
+tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel );
+
+//pNumChan is a caller allocated space with the sizeof pChannels
+eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan);
+void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result);
+void csrScanCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result);
+
+//To free the last roaming profile
+void csrFreeRoamProfile(tpAniSirGlobal pMac, tANI_U32 sessionId);
+void csrFreeConnectBssDesc(tpAniSirGlobal pMac, tANI_U32 sessionId);
+eHalStatus csrMoveBssToHeadFromBSSID(tpAniSirGlobal pMac, tCsrBssid *bssid, tScanResultHandle hScanResult);
+tANI_BOOLEAN csrCheckPSReady(void *pv);
+void csrFullPowerCallback(void *pv, eHalStatus status);
+//to free memory allocated inside the profile structure
+void csrReleaseProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile);
+//To free memory allocated inside scanFilter
+void csrFreeScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter);
+#ifdef WLAN_SOFTAP_FEATURE
+eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary);
+#else
+eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary);
+#endif
+tANI_U32 csrTranslateToWNICfgDot11Mode(tpAniSirGlobal pMac, eCsrCfgDot11Mode csrDot11Mode);
+void csrSaveChannelPowerForBand( tpAniSirGlobal pMac, tANI_BOOLEAN fPopulate5GBand );
+void csrApplyChannelPowerCountryInfo( tpAniSirGlobal pMac, tCsrChannel *pChannelList, tANI_U8 *countryCode);
+void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset);
+tANI_BOOLEAN csrIsMacAddressZero( tpAniSirGlobal pMac, tCsrBssid *pMacAddr );
+tANI_BOOLEAN csrIsMacAddressBroadcast( tpAniSirGlobal pMac, tCsrBssid *pMacAddr );
+eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile);
+eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason);
+//return a boolean to indicate whether roaming completed or continue.
+tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                    tANI_BOOLEAN fForce, eCsrRoamResult roamResult);
+void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess);
+void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId);
+void csrResetCountryInformation( tpAniSirGlobal pMac, tANI_BOOLEAN fForce );
+void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId );
+#ifdef FEATURE_WLAN_WAPI
+void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId );
+#endif /* FEATURE_WLAN_WAPI */
+void csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable );
+//Get the list of the base channels to scan for passively 11d info
+eHalStatus csrScanGetSupportedChannels( tpAniSirGlobal pMac );
+//To check whether a country code matches the one in the IE
+//Only check the first two characters, ignoring in/outdoor
+//pCountry -- caller allocated buffer contain the country code that is checking against
+//the one in pIes. It can be NULL.
+//caller must provide pIes, it cannot be NULL
+//This function always return TRUE if 11d support is not turned on.
+//pIes cannot be NULL
+tANI_BOOLEAN csrMatchCountryCode( tpAniSirGlobal pMac, tANI_U8 *pCountry, tDot11fBeaconIEs *pIes );
+eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId );
+eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext,
+                          tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId );
+//fSync: TRUE means cleanupneeds to handle synchronously.
+eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                tANI_BOOLEAN fSync, 
+                                csrRoamSessionCloseCallback callback,
+                                void *pContext );
+void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId);
+eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId );
+eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode );
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanEnable
+    \brief Enable the scanning feature of CSR. It must be called before any scan request can be performed.
+    \param tHalHandle - HAL context handle
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanEnable(tpAniSirGlobal);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanDisable
+    \brief Disableing the scanning feature of CSR. After this function return success, no scan is performed until 
+a successfull to csrScanEnable
+    \param tHalHandle - HAL context handle
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanDisable(tpAniSirGlobal);
+/* ---------------------------------------------------------------------------
+    \fn csrScanRequest
+    \brief Request a 11d or full scan.
+    \param pScanRequestID - pointer to an object to get back the request ID
+    \param callback - a callback function that scan calls upon finish, will not be called if csrScanRequest returns error
+    \param pContext - a pointer passed in for the callback
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanRequest(tpAniSirGlobal, tANI_U16, tCsrScanRequest *,
+                   tANI_U32 *pScanRequestID, csrScanCompleteCallback callback,
+                   void *pContext);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanAbort
+    \brief If a scan request is abort, the scan complete callback will be called first before csrScanAbort returns.
+    \param pScanRequestID - The request ID returned from csrScanRequest
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanAbort(tpAniSirGlobal, tANI_U32 scanRequestID);
+
+eHalStatus csrScanSetBGScanparams(tpAniSirGlobal, tCsrBGScanRequest *);
+eHalStatus csrScanBGScanAbort(tpAniSirGlobal);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanGetResult
+    \brief Return scan results.
+    \param pFilter - If pFilter is NULL, all cached results are returned
+    \param phResult - an object for the result.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanGetResult(tpAniSirGlobal, tCsrScanResultFilter *pFilter, tScanResultHandle *phResult);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanFlushResult
+    \brief Clear scan results.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanFlushResult(tpAniSirGlobal);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanBGScanGetParam
+    \brief Returns the current background scan settings.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanBGScanGetParam(tpAniSirGlobal, tCsrBGScanRequest *);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanResultGetFirst
+    \brief Returns the first element of scan result.
+    \param hScanResult - returned from csrScanGetResult
+    \return tCsrScanResultInfo * - NULL if no result     
+  -------------------------------------------------------------------------------*/
+tCsrScanResultInfo *csrScanResultGetFirst(tpAniSirGlobal, tScanResultHandle hScanResult);
+/* ---------------------------------------------------------------------------
+    \fn csrScanResultGetNext
+    \brief Returns the next element of scan result. It can be called without calling csrScanResultGetFirst first
+    \param hScanResult - returned from csrScanGetResult
+    \return Null if no result or reach the end     
+  -------------------------------------------------------------------------------*/
+tCsrScanResultInfo *csrScanResultGetNext(tpAniSirGlobal, tScanResultHandle hScanResult);
+
+/* ---------------------------------------------------------------------------
+    \fn csrGetCountryCode
+    \brief this function is to get the country code current being used
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, this has the country code
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *pbLen);
+
+/* ---------------------------------------------------------------------------
+    \fn csrSetCountryCode
+    \brief this function is to set the country code so channel/power setting matches the countrycode and
+    the domain it belongs to.
+    \param pCountry - Caller allocated buffer with at least 3 bytes specifying the country code
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrSetCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+    \fn csrResetCountryCodeInformation
+    \brief this function is to reset the country code current being used back to EEPROM default
+    this includes channel list and power setting.
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrResetCountryCodeInformation(tpAniSirGlobal pMac, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+    \fn csrGetSupportedCountryCode
+    \brief this function is to get a list of the country code current being supported
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, 
+    this has the country code list. 3 bytes for each country code. This may be NULL if
+    caller wants to know the needed bytes.
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen);
+
+/* ---------------------------------------------------------------------------
+    \fn csrSetRegulatoryDomain
+    \brief this function is to set the current regulatory domain.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    CSR.
+    \param domainId - indicate the domain (defined in the driver) needs to set to.  
+    See eRegDomainId for definition
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether 
+    a restart is needed to apply the change
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrSetRegulatoryDomain(tpAniSirGlobal pMac, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded);
+
+/* ---------------------------------------------------------------------------
+    \fn csrGetCurrentRegulatoryDomain
+    \brief this function is to get the current regulatory domain.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    CSR.
+    \return eRegDomainId     
+  -------------------------------------------------------------------------------*/
+v_REGDOMAIN_t csrGetCurrentRegulatoryDomain(tpAniSirGlobal pMac);
+
+/* ---------------------------------------------------------------------------
+    \fn csrGetRegulatoryDomainForCountry
+    \brief this function is to get the regulatory domain for a country.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    CSR.
+    \param pCountry - Caller allocated buffer with at least 3 bytes specifying the country code
+    \param pDomainId - Caller allocated buffer to get the return domain ID upon success return. Can be NULL.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetRegulatoryDomainForCountry(tpAniSirGlobal pMac, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId);
+
+
+tANI_BOOLEAN csrSave11dCountryString( tpAniSirGlobal pMac, tANI_U8 *pCountryCode, tANI_BOOLEAN fForce );
+
+//some support functions
+tANI_BOOLEAN csrIs11dSupported(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrIs11hSupported(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrIs11eSupported(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrIsWmmSupported(tpAniSirGlobal pMac);
+tANI_BOOLEAN csrIsMCCSupported(tpAniSirGlobal pMac);
+
+//Upper layer to get the list of the base channels to scan for passively 11d info from csr
+eHalStatus csrScanGetBaseChannels( tpAniSirGlobal pMac, tCsrChannelInfo * pChannelInfo );
+//Return SUCCESS is the command is queued, failed
+eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority );
+tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac );
+void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand);
+#ifdef FEATURE_WLAN_WAPI
+tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile );
+#endif /* FEATURE_WLAN_WAPI */
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
+//Security
+#define WLAN_SECURITY_EVENT_SET_PTK_REQ     1
+#define WLAN_SECURITY_EVENT_SET_PTK_RSP     2
+#define WLAN_SECURITY_EVENT_SET_GTK_REQ     3
+#define WLAN_SECURITY_EVENT_SET_GTK_RSP     4
+#define WLAN_SECURITY_EVENT_REMOVE_KEY_REQ  5
+#define WLAN_SECURITY_EVENT_REMOVE_KEY_RSP  6
+#define WLAN_SECURITY_EVENT_PMKID_CANDIDATE_FOUND  7
+#define WLAN_SECURITY_EVENT_PMKID_UPDATE    8
+#define WLAN_SECURITY_EVENT_MIC_ERROR       9   
+
+#define AUTH_OPEN       0
+#define AUTH_SHARED     1
+#define AUTH_WPA_EAP    2
+#define AUTH_WPA_PSK    3
+#define AUTH_WPA2_EAP   4
+#define AUTH_WPA2_PSK   5
+#ifdef FEATURE_WLAN_WAPI
+#define AUTH_WAPI_CERT  6
+#define AUTH_WAPI_PSK   7
+#endif /* FEATURE_WLAN_WAPI */
+
+#define ENC_MODE_OPEN   0
+#define ENC_MODE_WEP40  1
+#define ENC_MODE_WEP104 2
+#define ENC_MODE_TKIP   3
+#define ENC_MODE_AES    4
+#ifdef FEATURE_WLAN_WAPI
+#define ENC_MODE_SMS4   5 //WAPI
+#endif /* FEATURE_WLAN_WAPI */
+
+#define NO_MATCH    0
+#define MATCH       1
+
+#define WLAN_SECURITY_STATUS_SUCCESS        0
+#define WLAN_SECURITY_STATUS_FAILURE        1
+
+//Scan
+#define WLAN_SCAN_EVENT_ACTIVE_SCAN_REQ     1
+#define WLAN_SCAN_EVENT_ACTIVE_SCAN_RSP     2
+#define WLAN_SCAN_EVENT_PASSIVE_SCAN_REQ    3
+#define WLAN_SCAN_EVENT_PASSIVE_SCAN_RSP    4
+#define WLAN_SCAN_EVENT_HO_SCAN_REQ         5
+#define WLAN_SCAN_EVENT_HO_SCAN_RSP         6
+
+#define WLAN_SCAN_STATUS_SUCCESS        0
+#define WLAN_SCAN_STATUS_FAILURE        1
+#define WLAN_SCAN_STATUS_ABORT          2
+
+//Ibss
+#define WLAN_IBSS_EVENT_START_IBSS_REQ      0
+#define WLAN_IBSS_EVENT_START_IBSS_RSP      1
+#define WLAN_IBSS_EVENT_JOIN_IBSS_REQ       2
+#define WLAN_IBSS_EVENT_JOIN_IBSS_RSP       3
+#define WLAN_IBSS_EVENT_COALESCING          4
+#define WLAN_IBSS_EVENT_PEER_JOIN           5
+#define WLAN_IBSS_EVENT_PEER_LEAVE          6
+#define WLAN_IBSS_EVENT_STOP_REQ            7
+#define WLAN_IBSS_EVENT_STOP_RSP            8
+
+#define AUTO_PICK       0
+#define SPECIFIED       1
+
+#define WLAN_IBSS_STATUS_SUCCESS        0
+#define WLAN_IBSS_STATUS_FAILURE        1
+
+//11d
+#define WLAN_80211D_EVENT_COUNTRY_SET   0
+#define WLAN_80211D_EVENT_RESET         1
+
+#define WLAN_80211D_DISABLED         0
+#define WLAN_80211D_SUPPORT_MULTI_DOMAIN     1
+#define WLAN_80211D_NOT_SUPPORT_MULTI_DOMAIN     2
+
+int diagAuthTypeFromCSRType(eCsrAuthType authType);
+int diagEncTypeFromCSRType(eCsrEncryptionType encType);
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+/* ---------------------------------------------------------------------------
+    \fn csrScanResultPurge
+    \brief remove all items(tCsrScanResult) in the list and free memory for each item
+    \param hScanResult - returned from csrScanGetResult. hScanResult is considered gone by 
+    calling this function and even before this function reutrns.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanResultPurge(tpAniSirGlobal pMac, tScanResultHandle hScanResult);
+
+
+///////////////////////////////////////////Common Scan ends
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamConnect
+    \brief To inititiate an association
+    \param pProfile - can be NULL to join to any open ones
+    \param hBssListIn - a list of BSS descriptor to roam to. It is returned from csrScanGetResult
+    \param pRoamId - to get back the request ID
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                          tScanResultHandle hBssListIn, tANI_U32 *pRoamId);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamReassoc
+    \brief To inititiate a re-association
+    \param pProfile - can be NULL to join the currently connected AP. In that 
+    case modProfileFields should carry the modified field(s) which could trigger
+    reassoc  
+    \param modProfileFields - fields which are part of tCsrRoamConnectedProfile 
+    that might need modification dynamically once STA is up & running and this 
+    could trigger a reassoc
+    \param pRoamId - to get back the request ID
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                          tCsrRoamModifyProfileFields modProfileFields,
+                          tANI_U32 *pRoamId);
+
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamReconnect
+    \brief To disconnect and reconnect with the same profile
+    \return eHalStatus. It returns fail if currently not connected     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamSetPMKIDCache
+    \brief return the PMKID candidate list
+    \param pPMKIDCache - caller allocated buffer point to an array of tPmkidCacheInfo
+    \param numItems - a variable that has the number of tPmkidCacheInfo allocated
+    when retruning, this is either the number needed or number of items put into pPMKIDCache
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough and pNumItems
+    has the number of tPmkidCacheInfo.
+    \Note: pNumItems is a number of tPmkidCacheInfo, not sizeof(tPmkidCacheInfo) * something
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems );
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetWpaRsnReqIE
+    \brief return the WPA or RSN IE CSR passes to PE to JOIN request or START_BSS request
+    \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the 
+    needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetWpaRsnRspIE
+    \brief return the WPA or RSN IE from the beacon or probe rsp if connected
+    \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the 
+    needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf);
+
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetNumPMKIDCache
+    \brief return number of PMKID cache entries
+    \return tANI_U32 - the number of PMKID cache entries
+  -------------------------------------------------------------------------------*/
+tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetPMKIDCache
+    \brief return PMKID cache from CSR
+    \param pNum - caller allocated memory that has the space of the number of pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the 
+    needed or actually number in tPmkidCacheInfo.
+    \param pPmkidCache - Caller allocated memory that contains PMKID cache, if any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetConnectProfile
+    \brief To return the current connect profile. Caller must call csrRoamFreeConnectProfile
+           after it is done and before reuse for another csrRoamGetConnectProfile call.
+    \param pProfile - pointer to a caller allocated structure tCsrRoamConnectedProfile
+    \return eHalStatus. Failure if not connected     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, 
+                                    tCsrRoamConnectedProfile *pProfile);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetConnectState
+    \brief To return the current connect state of Roaming
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamFreeConnectProfile
+    \brief To free and reinitialize the profile return previous by csrRoamGetConnectProfile.
+    \param pProfile - pointer to a caller allocated structure tCsrRoamConnectedProfile
+    \return eHalStatus.      
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile);
+
+/* ---------------------------------------------------------------------------
+    \fn csrInitChannelList
+    \brief HDD calls this function to set the WNI_CFG_VALID_CHANNEL_LIST base on the band/mode settings.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    CSR.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrInitChannelList( tHalHandle hHal );
+
+/* ---------------------------------------------------------------------------
+    \fn csrChangeConfigParams
+    \brief The CSR API exposed for HDD to provide config params to CSR during 
+    SMEs stop -> start sequence.
+    If HDD changed the domain that will cause a reset. This function will 
+    provide the new set of 11d information for the new domain. Currrently this
+    API provides info regarding 11d only at reset but we can extend this for
+    other params (PMC, QoS) which needs to be initialized again at reset.
+    \param 
+    hHal - Handle to the HAL. The HAL handle is returned by the HAL after it is 
+           opened (by calling halOpen).
+    pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that 
+                currently provides 11d related information like Country code, 
+                Regulatory domain, valid channel list, Tx power per channel, a 
+                list with active/passive scan allowed per valid channel. 
+
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, 
+                                 tCsrUpdateConfigParam *pUpdateConfigParam);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamConnectToLastProfile
+    \brief To disconnect and reconnect with the same profile
+    \return eHalStatus. It returns fail if currently connected     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamDisconnect
+    \brief To disconnect from a network
+    \param reason -- To indicate the reason for disconnecting. Currently, only eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason);
+
+/* ---------------------------------------------------------------------------
+    \fn csrScanGetPMKIDCandidateList
+    \brief return the PMKID candidate list
+    \param pPmkidList - caller allocated buffer point to an array of tPmkidCandidateInfo
+    \param pNumItems - pointer to a variable that has the number of tPmkidCandidateInfo allocated
+    when retruning, this is either the number needed or number of items put into pPmkidList
+    \return eHalStatus - when fail, it usually means the buffer allocated is not big enough and pNumItems
+    has the number of tPmkidCandidateInfo.
+    \Note: pNumItems is a number of tPmkidCandidateInfo, not sizeof(tPmkidCandidateInfo) * something
+  -------------------------------------------------------------------------------*/
+eHalStatus csrScanGetPMKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                        tPmkidCandidateInfo *pPmkidList, tANI_U32 *pNumItems );
+
+//This function is used to stop a BSS. It is similar of csrRoamIssueDisconnect but this function
+//doesn't have any logic other than blindly trying to stop BSS
+eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority );
+
+void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, 
+                                      tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult);
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+    \fn csrRoamIssueDisassociateStaCmd
+    \brief csr function that HDD calls to disassociate a associated station
+    \param sessionId    - session Id for Soft AP
+    \param pPeerMacAddr - MAC of associated station to delete
+    \param reason - reason code, be one of the tSirMacReasonCodes
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, 
+                                           tANI_U32 sessionId, 
+                                           tANI_U8 *pPeerMacAddr,
+                                           tANI_U32 reason);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamIssueDeauthSta
+    \brief csr function that HDD calls to delete a associated station
+    \param sessionId    - session Id for Soft AP
+    \param pPeerMacAddr - MAC of associated station to delete
+    \param reason - reason code, be one of the tSirMacReasonCodes
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, 
+                                     tANI_U32 sessionId, 
+                                     tANI_U8 *pPeerMacAddr,
+                                     tANI_U32 reason);
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamIssueTkipCounterMeasures
+    \brief csr function that HDD calls to start and stop tkip countermeasures
+    \param sessionId - session Id for Soft AP
+    \param bEnable   - Flag to start/stop countermeasures
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable);
+
+eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessinId, tANI_BOOLEAN bEnable, tSirMacAddr bssId );
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetAssociatedStas
+    \brief csr function that HDD calls to get list of associated stations based on module ID
+    \param sessionId - session Id for Soft AP
+    \param modId - module ID - PE/HAL/TL
+    \param pUsrContext - Opaque HDD context
+    \param pfnSapEventCallback - Sap event callback in HDD
+    \param pAssocStasBuf - Caller allocated memory to be filled with associatd stations info
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, VOS_MODULE_ID modId,
+                                     void *pUsrContext, void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf );
+
+eHalStatus csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, VOS_MODULE_ID modId,  tSirMacAddr bssId,
+                                             void *pUsrContext, void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf );
+
+/* ---------------------------------------------------------------------------
+    \fn csrRoamGetWpsSessionOverlap
+    \brief csr function that HDD calls to get WPS PBC session overlap information
+    \param sessionId - session Id for Soft AP
+    \param pUsrContext - Opaque HDD context
+    \param pfnSapEventCallback - Sap event callback in HDD
+    \param pRemoveMac - pointer to MAC address of session to be removed
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                             void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac );
+                                        
+eHalStatus csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId,
+                            tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac);
+                            
+#endif
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval);
+eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId);
+#endif
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* ---------------------------------------------------------------------------
+    \fn csrRoamFTPreAuthRspProcessor
+    \brief csr function that handles pre auth response from LIM 
+  ---------------------------------------------------------------------------*/
+void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp );
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+void csrCcxSendAdjacentApRepMsg(tpAniSirGlobal pMac, tCsrRoamSession *pSession);
+#endif
+#endif
+
diff --git a/CORE/SME/src/csr/csrLinkList.c b/CORE/SME/src/csr/csrLinkList.c
new file mode 100644
index 0000000..a2b08e8
--- /dev/null
+++ b/CORE/SME/src/csr/csrLinkList.c
@@ -0,0 +1,648 @@
+/*
+ * 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 csrLinkList.c
+  
+    Implementation for the Common link list interfaces.
+  
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated 
+   ========================================================================== */
+
+#include "palApi.h"
+#include "csrLinkList.h"
+#include "vos_lock.h"
+#include "vos_memory.h"
+#include "vos_trace.h"
+
+ANI_INLINE_FUNCTION void csrListInit(tListElem *pList)
+{
+    pList->last = pList->next = pList;
+}
+
+
+ANI_INLINE_FUNCTION void csrListRemoveEntry(tListElem *pEntry)
+{
+    tListElem *pLast;
+    tListElem *pNext;
+    
+    pLast = pEntry->last;
+    pNext = pEntry->next;
+    pLast->next = pNext;
+    pNext->last = pLast;
+}
+
+
+ANI_INLINE_FUNCTION tListElem * csrListRemoveHead(tListElem *pHead)
+{
+    tListElem *pEntry;
+    tListElem *pNext;
+    
+    pEntry = pHead->next;
+    pNext = pEntry->next;
+    pHead->next = pNext;
+    pNext->last = pHead;
+    
+    return (pEntry);
+}
+
+
+
+ANI_INLINE_FUNCTION tListElem * csrListRemoveTail(tListElem *pHead)
+{
+    tListElem *pEntry;
+    tListElem *pLast;
+    
+    pEntry = pHead->last;
+    pLast = pEntry->last;
+    pHead->last = pLast;
+    pLast->next = pHead;
+    
+    return (pEntry);
+}
+
+
+ANI_INLINE_FUNCTION void csrListInsertTail(tListElem *pHead, tListElem *pEntry)
+{
+    tListElem *pLast;
+    
+    pLast = pHead->last;
+    pEntry->last = pLast;
+    pEntry->next = pHead;
+    pLast->next = pEntry;
+    pHead->last = pEntry;
+}
+
+
+ANI_INLINE_FUNCTION void csrListInsertHead(tListElem *pHead, tListElem *pEntry)
+{
+    tListElem *pNext;
+    
+    pNext = pHead->next;
+    pEntry->next = pNext;
+    pEntry->last = pHead;
+    pNext->last = pEntry;
+    pHead->next = pEntry;
+}
+
+
+//Insert pNewEntry before pEntry
+void csrListInsertEntry(tListElem *pEntry, tListElem *pNewEntry)
+{
+    tListElem *pLast;
+    if( !pEntry) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pEntry is Null", __FUNCTION__);
+        return; 
+    }
+       
+    pLast = pEntry->last;
+    pLast->next = pNewEntry;
+    pEntry->last = pNewEntry;
+    pNewEntry->next = pEntry;
+    pNewEntry->last = pLast;
+}
+
+tANI_U32 csrLLCount( tDblLinkList *pList ) 
+{
+    tANI_U32 c = 0; 
+    
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return c; 
+    }
+
+    if ( pList && ( LIST_FLAG_OPEN == pList->Flag ) ) 
+    {
+        c = pList->Count;
+    }
+
+    return( c ); 
+}
+
+
+void csrLLLock( tDblLinkList *pList ) 
+{
+    
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag )
+    {
+        vos_lock_acquire(&pList->Lock);
+    }
+}
+
+
+void csrLLUnlock( tDblLinkList *pList )
+{
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        vos_lock_release(&pList->Lock);
+    }
+}
+
+
+tANI_BOOLEAN csrLLIsListEmpty( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tANI_BOOLEAN fEmpty = eANI_BOOLEAN_TRUE;
+
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return fEmpty ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if(fInterlocked)
+        {
+            csrLLLock(pList);
+        }
+
+        fEmpty = csrIsListEmpty( &pList->ListHead );
+         
+        if(fInterlocked)
+        {
+            csrLLUnlock(pList);
+        }
+    }
+    return( fEmpty );
+}
+
+
+
+tANI_BOOLEAN csrLLFindEntry( tDblLinkList *pList, tListElem *pEntryToFind )
+{
+    tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry;
+
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return fFound ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        pEntry = csrLLPeekHead( pList, LL_ACCESS_NOLOCK);
+
+        // Have to make sure we don't loop back to the head of the list, which will
+        // happen if the entry is NOT on the list...
+    
+        while( pEntry && ( pEntry != &pList->ListHead ) ) 
+        {
+            if ( pEntry == pEntryToFind ) 
+            {
+                fFound = eANI_BOOLEAN_TRUE;
+                break;
+            }
+            pEntry = pEntry->next;
+        }
+        
+    }
+    return( fFound );
+}
+
+
+eHalStatus csrLLOpen( tHddHandle hHdd, tDblLinkList *pList )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus;
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return eHAL_STATUS_FAILURE ; 
+    }
+    
+    if ( LIST_FLAG_OPEN != pList->Flag ) 
+    {
+        pList->Count = 0;
+
+        vosStatus = vos_lock_init(&pList->Lock);
+
+        if(VOS_IS_STATUS_SUCCESS(vosStatus))
+        {
+            csrListInit( &pList->ListHead );
+            pList->Flag = LIST_FLAG_OPEN;
+            pList->hHdd = hHdd;
+        }
+        else
+        {
+           status = eHAL_STATUS_FAILURE;
+        }
+    }
+    return (status);
+}
+
+void csrLLClose( tDblLinkList *pList )
+{
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        // Make sure the list is empty...
+        csrLLPurge( pList, LL_ACCESS_LOCK );
+        vos_lock_destroy( &pList->Lock );
+        pList->Flag = LIST_FLAG_CLOSE;
+    }
+}
+
+void csrLLInsertTail( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked )
+{    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if(fInterlocked)
+        {  
+            csrLLLock(pList);
+        }
+        csrListInsertTail( &pList->ListHead, pEntry );
+        pList->Count++;
+        if(fInterlocked)
+        {  
+            csrLLUnlock(pList);
+        }
+    }
+}
+
+
+
+void csrLLInsertHead( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked )
+{
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if(fInterlocked)
+        {
+            csrLLLock(pList);
+        }
+        csrListInsertHead( &pList->ListHead, pEntry );
+        pList->Count++;
+        if(fInterlocked)
+        {
+            csrLLUnlock(pList);
+        }
+    }
+}
+
+
+void csrLLInsertEntry( tDblLinkList *pList, tListElem *pEntry, tListElem *pNewEntry, tANI_BOOLEAN fInterlocked )
+{    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if(fInterlocked)
+        {
+            csrLLLock(pList);
+        }
+        csrListInsertEntry( pEntry, pNewEntry );
+        pList->Count++;
+        if(fInterlocked)
+        {
+            csrLLUnlock(pList);
+        }
+    }
+}
+
+
+
+tListElem *csrLLRemoveTail( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pEntry = NULL;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pEntry ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) ) 
+        {
+
+            pEntry = csrListRemoveTail( &pList->ListHead );
+            pList->Count--;
+        }
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pEntry );
+}
+
+
+tListElem *csrLLPeekTail( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pEntry = NULL;
+
+    
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pEntry ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {  
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) ) 
+        {
+            pEntry = pList->ListHead.last; 
+        }
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pEntry );
+}
+
+
+
+tListElem *csrLLRemoveHead( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pEntry = NULL;
+    
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pEntry ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {  
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) ) 
+        {
+            pEntry = csrListRemoveHead( &pList->ListHead );
+            pList->Count--;
+        }
+
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pEntry );
+}
+
+
+tListElem *csrLLPeekHead( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pEntry = NULL;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pEntry ; 
+    }
+     
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {  
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) ) 
+        {
+            pEntry = pList->ListHead.next; 
+        }
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pEntry );
+}
+
+
+
+void csrLLPurge( tDblLinkList *pList, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pEntry;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {  
+            csrLLLock( pList );
+        }
+        while( (pEntry = csrLLRemoveHead( pList, LL_ACCESS_NOLOCK )) ) 
+        {
+            // just remove everything from the list until 
+            // nothing left on the list.
+        }
+        if ( fInterlocked ) 
+        {  
+            csrLLUnlock( pList );
+        }
+    }
+}
+
+
+tANI_BOOLEAN csrLLRemoveEntry( tDblLinkList *pList, tListElem *pEntryToRemove, tANI_BOOLEAN fInterlocked )
+{
+    tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
+    tListElem *pEntry;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return fFound; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {
+            csrLLLock( pList );
+        }
+
+        pEntry = csrLLPeekHead( pList, LL_ACCESS_NOLOCK );
+
+        // Have to make sure we don't loop back to the head of the list, which will
+        // happen if the entry is NOT on the list...
+        while( pEntry && ( pEntry != &pList->ListHead ) ) 
+        {
+            if ( pEntry == pEntryToRemove )
+            {
+                csrListRemoveEntry( pEntry );
+                pList->Count--;
+
+                fFound = eANI_BOOLEAN_TRUE;
+                break;
+            }
+
+            pEntry = pEntry->next; 
+        }
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( fFound );
+}
+
+
+
+tListElem *csrLLNext( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pNextEntry = NULL;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pNextEntry ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) && csrLLFindEntry( pList, pEntry ) ) 
+        {
+            pNextEntry = pEntry->next;
+            //Make sure we don't walk past the head
+            if ( pNextEntry == &pList->ListHead ) 
+            {
+                pNextEntry = NULL;
+            }
+        }
+
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pNextEntry );
+}
+
+
+tListElem *csrLLPrevious( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked )
+{
+    tListElem *pNextEntry = NULL;
+
+    if( !pList) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __FUNCTION__);
+        return pNextEntry ; 
+    }
+
+    if ( LIST_FLAG_OPEN == pList->Flag ) 
+    {
+        if ( fInterlocked ) 
+        {
+            csrLLLock( pList );
+        }
+
+        if ( !csrIsListEmpty(&pList->ListHead) && csrLLFindEntry( pList, pEntry ) ) 
+        {
+            pNextEntry = pEntry->last; 
+            //Make sure we don't walk past the head
+            if ( pNextEntry == &pList->ListHead ) 
+            {
+                pNextEntry = NULL;
+            }
+        }  
+
+        if ( fInterlocked ) 
+        {
+            csrLLUnlock( pList );
+        }
+    }
+
+    return( pNextEntry );
+}
+
+
+
+
diff --git a/CORE/SME/src/csr/csrLogDump.c b/CORE/SME/src/csr/csrLogDump.c
new file mode 100644
index 0000000..26fb3eb
--- /dev/null
+++ b/CORE/SME/src/csr/csrLogDump.c
@@ -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.
+ */
+
+/*============================================================================
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
+csrLogDump.c
+Implements the dump commands specific to the csr module. 
+============================================================================*/
+#include "aniGlobal.h"
+#include "csrApi.h"
+#include "btcApi.h"
+#include "logDump.h"
+#include "smsDebug.h"
+#include "smeInside.h"
+#include "csrInsideApi.h"
+#if defined(ANI_LOGDUMP)
+static char *
+dump_csr( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p )
+{
+    static tCsrRoamProfile x;
+    static tSirMacSSid ssid;   //To be allocated for array of SSIDs
+    static tANI_U8 sessionId = 0; // Defined for fixed session ID
+    palZeroMemory(pMac->hHdd, (void*)&x, sizeof(x)); 
+    x.SSIDs.numOfSSIDs=1 ;
+    x.SSIDs.SSIDList[0].SSID = ssid ;
+    ssid.length=6 ;
+    palCopyMemory(pMac->hHdd, ssid.ssId, "AniNet", 6);
+    if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme )))
+    {
+        (void)csrRoamConnect(pMac, sessionId, &x, NULL, NULL);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return p;
+}
+static char *dump_btcSetEvent( tpAniSirGlobal pMac, tANI_U32 arg1, 
+                               tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p )
+{
+    tSmeBtEvent btEvent;
+    if( arg1 < BT_EVENT_TYPE_MAX )
+    {
+        smsLog(pMac, LOGE, FL(" signal BT event (%d) handle (%d) 3rd param(%d)\n"), arg1, arg2, arg3);
+        vos_mem_zero(&btEvent, sizeof(tSmeBtEvent));
+        btEvent.btEventType = arg1;
+        switch( arg1 )
+        {
+        case BT_EVENT_SYNC_CONNECTION_COMPLETE:
+        case BT_EVENT_SYNC_CONNECTION_UPDATED:
+            btEvent.uEventParam.btSyncConnection.connectionHandle = (v_U16_t)arg2;
+            btEvent.uEventParam.btSyncConnection.status = (v_U8_t)arg3;
+            break;
+        case BT_EVENT_DISCONNECTION_COMPLETE:
+            btEvent.uEventParam.btDisconnect.connectionHandle = (v_U16_t)arg2;
+            break;
+        case BT_EVENT_CREATE_ACL_CONNECTION:
+        case BT_EVENT_ACL_CONNECTION_COMPLETE:
+            btEvent.uEventParam.btAclConnection.connectionHandle = (v_U16_t)arg2;
+            btEvent.uEventParam.btAclConnection.status = (v_U8_t)arg3;
+            break;
+        case BT_EVENT_MODE_CHANGED:
+            btEvent.uEventParam.btAclModeChange.connectionHandle = (v_U16_t)arg2;
+            break;
+        default:
+            break;
+        }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+        if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme )))
+        {
+            btcSignalBTEvent(pMac, &btEvent);
+            sme_ReleaseGlobalLock( &pMac->sme );
+        }
+#endif
+    }
+    else
+    {
+        smsLog(pMac, LOGE, FL(" invalid event (%d)\n"), arg1);
+    }
+    return p;
+}
+
+static tDumpFuncEntry csrMenuDumpTable[] = {
+    {0,     "CSR (850-860)",                                    NULL},
+    {851,   "CSR: CSR testing connection to AniNet",            dump_csr},
+    {852,   "BTC: Fake BT events (event, handle)",              dump_btcSetEvent},
+};
+
+void csrDumpInit(tHalHandle hHal)
+{
+    logDumpRegisterTable( (tpAniSirGlobal)hHal, &csrMenuDumpTable[0], 
+                          sizeof(csrMenuDumpTable)/sizeof(csrMenuDumpTable[0]) );
+}
+
+#endif //#if defined(ANI_LOGDUMP)
diff --git a/CORE/SME/src/csr/csrNeighborRoam.c b/CORE/SME/src/csr/csrNeighborRoam.c
new file mode 100644
index 0000000..9ae1066
--- /dev/null
+++ b/CORE/SME/src/csr/csrNeighborRoam.c
@@ -0,0 +1,2842 @@
+/*
+ * 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 csrNeighborRoam.c
+  
+    Implementation for the simple roaming algorithm for 802.11r Fast transitions and Legacy roaming for Android platform.
+  
+    Copyright (C) 2010 Qualcomm, Incorporated
+  
+ 
+   ========================================================================== */
+
+/*===========================================================================
+
+                      EDIT HISTORY FOR FILE
+
+
+  This section contains comments describing changes made to the module.
+  Notice that changes are listed in reverse chronological order.
+
+
+
+  when           who                 what, where, why
+----------       ---                --------------------------------------------------------
+08/01/10          Murali             Created
+
+===========================================================================*/
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+#include "wlan_qct_wda.h"
+#include "palApi.h"
+#include "csrInsideApi.h"
+#include "smsDebug.h"
+#include "logDump.h"
+#include "smeQosInternal.h"
+#include "wlan_qct_tl.h"
+#include "smeInside.h"
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+#include "csrApi.h"
+#include "wlan_qct_tl.h"
+#include "sme_Api.h"
+#include "csrNeighborRoam.h"
+#ifdef FEATURE_WLAN_CCX
+#include "csrCcx.h"
+#endif
+
+#define WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG 1
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG
+#define NEIGHBOR_ROAM_DEBUG smsLog
+#else
+#define NEIGHBOR_ROAM_DEBUG(x...)
+#endif
+
+VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
+                                                                               v_PVOID_t pUserCtxt);
+VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
+                                                                               v_PVOID_t pUserCtxt);
+void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus);
+eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile );
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac);
+VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac);
+#endif
+
+/* State Transition macro */
+#define CSR_NEIGHBOR_ROAM_STATE_TRANSITION(newState)\
+{\
+    pMac->roam.neighborRoamInfo.prevNeighborRoamState = pMac->roam.neighborRoamInfo.neighborRoamState;\
+    pMac->roam.neighborRoamInfo.neighborRoamState = newState;\
+    smsLog(pMac, LOGE, FL("Neighbor Roam Transition from state %d ==> %d"), pMac->roam.neighborRoamInfo.prevNeighborRoamState, newState);\
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamFreeNeighborRoamBSSNode
+
+    \brief  This function frees all the internal pointers CSR NeighborRoam BSS Info 
+            and also frees the node itself
+
+    \param  pMac - The handle returned by macOpen.
+            neighborRoamBSSNode - Neighbor Roam BSS Node to be freed
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamFreeNeighborRoamBSSNode(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo neighborRoamBSSNode)
+{
+    if (neighborRoamBSSNode)
+    {
+        if (neighborRoamBSSNode->pBssDescription)
+        {
+            vos_mem_free(neighborRoamBSSNode->pBssDescription);
+            neighborRoamBSSNode->pBssDescription = NULL;
+        }
+        vos_mem_free(neighborRoamBSSNode);
+        neighborRoamBSSNode = NULL;
+    }
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamRemoveRoamableAPListEntry
+
+    \brief  This function removes a given entry from the given list
+
+    \param  pMac - The handle returned by macOpen.
+            pList - The list from which the entry should be removed
+            pNeighborEntry - Neighbor Roam BSS Node to be removed
+
+    \return TRUE if successfully removed, else FALSE
+
+---------------------------------------------------------------------------*/
+tANI_BOOLEAN csrNeighborRoamRemoveRoamableAPListEntry(tpAniSirGlobal pMac, 
+                                                tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry)
+{
+    if(pList)
+    {
+        return csrLLRemoveEntry(pList, &pNeighborEntry->List, LL_ACCESS_LOCK);
+    }
+
+    smsLog(pMac, LOGE, FL("Removing neighbor BSS node from list failed. Current count = %d\n"), csrLLCount(pList));
+
+    return eANI_BOOLEAN_FALSE;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamGetRoamableAPListNextEntry
+
+    \brief  Gets the entry next to passed entry. If NULL is passed, return the entry in the head of the list
+
+    \param  pMac - The handle returned by macOpen.
+            pList - The list from which the entry should be returned
+            pNeighborEntry - Neighbor Roam BSS Node whose next entry should be returned
+
+    \return Neighbor Roam BSS Node to be returned
+
+---------------------------------------------------------------------------*/
+tpCsrNeighborRoamBSSInfo csrNeighborRoamGetRoamableAPListNextEntry(tpAniSirGlobal pMac, 
+                                        tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry)
+{
+    tListElem *pEntry = NULL;
+    tpCsrNeighborRoamBSSInfo pResult = NULL;
+    
+    if(pList)
+    {
+        if(NULL == pNeighborEntry)
+        {
+            pEntry = csrLLPeekHead(pList, LL_ACCESS_LOCK);
+        }
+        else
+        {
+            pEntry = csrLLNext(pList, &pNeighborEntry->List, LL_ACCESS_LOCK);
+        }
+        if(pEntry)
+        {
+            pResult = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
+        }
+    }
+    
+    return pResult;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamFreeRoamableBSSList
+
+    \brief   Empties and frees all the nodes in the roamable AP list 
+
+    \param  pMac - The handle returned by macOpen.
+            pList - Neighbor Roam BSS List to be emptied
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamFreeRoamableBSSList(tpAniSirGlobal pMac, tDblLinkList *pList)
+{
+    tpCsrNeighborRoamBSSInfo pResult = NULL;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Emptying the BSS list. Current count = %d\n"), csrLLCount(pList));
+
+    /* Pick up the head, remove and free the node till the list becomes empty */
+    while ((pResult = csrNeighborRoamGetRoamableAPListNextEntry(pMac, pList, NULL)) != NULL)
+    {
+        csrNeighborRoamRemoveRoamableAPListEntry(pMac, pList, pResult);
+        csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pResult);
+    }
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamReassocIndCallback
+
+    \brief Reassoc callback invoked by TL on crossing the registered re-assoc threshold.
+           Directly triggere HO in case of non-11r association
+           In case of 11R association, triggers a pre-auth eventually followed by actual HO
+
+    \param  pAdapter - VOS Context
+            trafficStatus - UP/DOWN indication from TL
+            pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamReassocIndCallback(v_PVOID_t pAdapter, 
+                               v_U8_t trafficStatus, 
+                               v_PVOID_t pUserCtxt)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;   
+ 
+    smsLog(pMac, LOG1, FL("Reassoc indication callback called"));
+
+
+    //smsLog(pMac, LOGE, FL("Reassoc indication callback called at state %d"), pNeighborRoamInfo->neighborRoamState);
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+
+
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamNeighborLookupUPCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    /* We dont need to run this timer any more. */
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (pNeighborRoamInfo->is11rAssoc)
+    {
+        if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
+        {
+            csrNeighborRoamIssuePreauthReq(pMac);
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL("11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
+            VOS_ASSERT(0);
+        }
+    }
+    else
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+    if (pNeighborRoamInfo->isCCXAssoc)
+    {
+        if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
+        {
+            csrNeighborRoamIssuePreauthReq(pMac);
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL("CCX Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
+            VOS_ASSERT(0);
+        }
+    }
+    else
+#endif
+    {
+        if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pNeighborRoamInfo->neighborRoamState)
+        {
+            csrNeighborRoamRequestHandoff(pMac);
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL("Non-11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
+            VOS_ASSERT(0);
+        }
+    }
+    return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamResetConnectedStateControlInfo
+
+    \brief  This function will reset the neighbor roam control info data structures. 
+            This function should be invoked whenever we move to CONNECTED state from 
+            any state other than INIT state
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    /* Do not reset the currentNeighborLookup Threshold here. The threshold and multiplier will be set before calling this API */
+    if ((pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == FALSE) &&
+        (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels))
+    {
+        pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
+
+        if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+            vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+    
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+        pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
+    }
+    else 
+    {
+        pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
+        pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
+    }
+
+    csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
+
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+
+    /* Abort any ongoing BG scans */
+    if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
+        csrScanAbortMacScan(pMac);
+
+    pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
+    
+    /* We dont need to run this timer any more. */
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    /* Do not free up the preauth done list here */
+    pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
+    pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
+    pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
+    pNeighborRoamInfo->FTRoamInfo.preauthRspPending = 0;
+    vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer);
+#endif
+
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamResetInitStateControlInfo
+
+    \brief  This function will reset the neighbor roam control info data structures. 
+            This function should be invoked whenever we move to CONNECTED state from 
+            INIT state
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS                    vosStatus = VOS_STATUS_SUCCESS;
+
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
+
+    /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */
+    pNeighborRoamInfo->csrSessionId            =   CSR_SESSION_ID_INVALID;
+    vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    csrNeighborRoamPurgePreauthFailedList(pMac);
+#endif
+#ifdef FEATURE_WLAN_CCX
+    pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->MinQBssLoadRequired = 0;
+#endif
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighborLookup callback with TL. RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+    /* Deregister neighbor lookup callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamNeighborLookupDOWNCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_UP, 
+                                                        csrNeighborRoamNeighborLookupUPCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+    
+    /* Reset currentNeighborLookupThreshold only after deregistering DOWN event from TL */
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
+    pNeighborRoamInfo->currentNeighborLookupThreshold = pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
+
+    return;
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamBssIdScanFilter
+
+    \brief  This API is used to prepare a filter to obtain scan results when 
+            we complete the scan in the REPORT_SCAN state after receiving a 
+            valid neighbor report from AP. This filter includes BSSIDs received from 
+            the neighbor report from the AP in addition to the other filter parameters 
+            created from connected profile
+
+    \param  pMac - The handle returned by macOpen.
+            pScanFilter - Scan filter to be filled and returned
+
+    \return eHAL_STATUS_SUCCESS on succesful filter creation, corresponding error 
+            code otherwise
+
+---------------------------------------------------------------------------*/
+static eHalStatus csrNeighborRoamBssIdScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tANI_U8 i = 0;
+
+    VOS_ASSERT(pScanFilter != NULL);
+    vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
+
+    pScanFilter->BSSIDs.numOfBSSIDs = pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport;
+    pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
+    if (NULL == pScanFilter->BSSIDs.bssid)
+    {
+        smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
+
+    /* Populate the BSSID from Neighbor BSS info received from neighbor report */
+    for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
+    {
+        vos_mem_copy(&pScanFilter->BSSIDs.bssid[i], 
+                pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[i].neighborBssId, sizeof(tSirMacAddr));
+    }
+
+    /* Fill other general scan filter params */
+    return csrNeighborRoamPrepareScanProfileFilter(pMac, pScanFilter);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPurgePreauthFailList
+
+    \brief  This function empties the preauth fail list
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamPurgePreauthFailList(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Purging the preauth fail list"));
+    while (pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
+    {
+        vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress-1],
+                                    sizeof(tSirMacAddr));
+        pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress--;
+    }
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamAddBssIdToPreauthFailList
+
+    \brief  This function adds the given BSSID to the Preauth fail list
+
+    \param  pMac - The handle returned by macOpen.
+            bssId - BSSID to be added to the preauth fail list
+
+    \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamAddBssIdToPreauthFailList(tpAniSirGlobal pMac, tSirMacAddr bssId)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL(" Added BSSID %02x:%02x:%02x:%02x:%02x:%02x to Preauth failed list\n"), 
+                        bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
+
+
+    if ((pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress + 1) >
+            MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS)
+    {
+        smsLog(pMac, LOGE, FL("Preauth fail list already full.. Cannot add new one"));
+        return eHAL_STATUS_FAILURE;
+    }
+    vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress],
+                        bssId, sizeof(tSirMacAddr));
+    pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress++;
+    
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIsPreauthCandidate
+
+    \brief  This function checks whether the given MAC address is already 
+            present in the preauth fail list and returns TRUE/FALSE accordingly
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eANI_BOOLEAN_TRUE if preauth candidate, eANI_BOOLEAN_FALSE otherwise
+
+---------------------------------------------------------------------------*/
+tANI_BOOLEAN csrNeighborRoamIsPreauthCandidate(tpAniSirGlobal pMac, tSirMacAddr bssId)
+{
+    tANI_U8 i = 0;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    if (0 == pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
+        return eANI_BOOLEAN_TRUE;
+    
+    for (i = 0; i < pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress; i++)
+    {
+        if (VOS_TRUE == vos_mem_compare(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[i],
+                                                                        bssId, sizeof(tSirMacAddr)))
+        {
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("BSSID %02x:%02x:%02x:%02x:%02x:%02x already present in preauth fail list"),
+                                                bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
+            return eANI_BOOLEAN_FALSE;
+        }
+    }
+
+    return eANI_BOOLEAN_TRUE;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIssuePreauthReq
+
+    \brief  This function issues preauth request to PE with the 1st AP entry in the 
+            roamable AP list
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
+
+---------------------------------------------------------------------------*/
+static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpCsrNeighborRoamBSSInfo    pNeighborBssNode;
+    
+    /* This must not be true here */
+    VOS_ASSERT(pNeighborRoamInfo->FTRoamInfo.preauthRspPending == eANI_BOOLEAN_FALSE);
+
+    /* Issue Preauth request to PE here */
+    /* Need to issue the preauth request with the BSSID that is there in the head of the roamable AP list */
+    /* Parameters that should be passed are BSSID, Channel number and the neighborScanPeriod(probably) */
+    /* If roamableAPList gets empty, should transition to REPORT_SCAN state */
+    pNeighborBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
+
+    if (NULL == pNeighborBssNode)
+    {
+        smsLog(pMac, LOG1, FL("Roamable AP list is empty.. "));
+        return eHAL_STATUS_FAILURE;
+    }
+    else
+    {
+        status = csrRoamIssueFTPreauthReq(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription); 
+        if (eHAL_STATUS_SUCCESS != status)
+        {
+            smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d\n"), status);
+            return status;
+        }
+    }
+    
+    pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_TRUE;
+
+    /* Increment the preauth retry count */
+    pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries++;
+    
+    /* Transition the state to preauthenticating */
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING)
+    
+    /* Start the preauth rsp timer */
+    status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer, 
+                   CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
+                   eANI_BOOLEAN_FALSE);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Preauth response wait timer start failed with status %d\n"), status);
+        return status;
+    }
+
+    
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPreauthRspHandler
+
+    \brief  This function handle the Preauth response from PE
+            Every preauth is allowed max 3 tries if it fails. If a bssid failed 
+            for more than MAX_TRIES, we will remove it from the list and try 
+            with the next node in the roamable AP list and add the BSSID to pre-auth failed 
+            list. If no more entries present in 
+            roamable AP list, transition to REPORT_SCAN state
+
+    \param  pMac - The handle returned by macOpen.
+            vosStatus - VOS_STATUS_SUCCESS/FAILURE/TIMEOUT status from PE
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+    tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
+
+    // We can receive it in these 2 states.
+    VOS_ASSERT((pNeighborRoamInfo->neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) ||
+        (pNeighborRoamInfo->neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN));
+
+    if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) &&
+        (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN))
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %\n"), 
+            pNeighborRoamInfo->neighborRoamState);
+    }
+
+    if (VOS_STATUS_E_TIMEOUT != vosStatus)
+    {
+        /* This means we got the response from PE. Hence stop the timer */
+        status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer);
+        pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
+    }
+
+    if (VOS_STATUS_SUCCESS == vosStatus)
+    {
+        pPreauthRspNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
+    }
+    if ((VOS_STATUS_SUCCESS == vosStatus) && (NULL != pPreauthRspNode))
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Preauth completed successfully after %d tries\n"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries);
+
+        /* Preauth competer successfully. Insert the preauthenticated node to tail of preAuthDoneList */
+        csrNeighborRoamRemoveRoamableAPListEntry(pMac, &pNeighborRoamInfo->roamableAPList, pPreauthRspNode);
+        csrLLInsertTail(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, &pPreauthRspNode->List, LL_ACCESS_LOCK);
+
+        /* Pre-auth completed successfully. Transition to PREAUTH Done state */
+        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
+        pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
+
+        /* The caller of this function would start a timer and by the time it expires, supplicant should 
+           have provided the updated FTIEs to SME. So, when it expires, handoff will be triggered then */
+    }
+    else
+    {
+        tpCsrNeighborRoamBSSInfo    pNeighborBssNode = NULL;
+        tListElem                   *pEntry;
+
+        smsLog(pMac, LOGE, FL("Preauth failed retry number %d, status = %d\n"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries, vosStatus);
+        
+        /* Preauth failed. Add the bssId to the preAuth failed list MAC Address. Also remove the AP from roamable AP list */
+        if (pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries >=  CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES)
+        {
+            /* We are going to remove the node as it fails for more than MAX tries. Reset this count to 0 */
+            pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
+
+            /* The one in the head of the list should be one with which we issued pre-auth and failed */
+            pEntry = csrLLRemoveHead(&pNeighborRoamInfo->roamableAPList, LL_ACCESS_LOCK);
+            if(pEntry)
+            {
+                pNeighborBssNode = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
+            /* Add the BSSID to pre-auth fail list */
+            status = csrNeighborRoamAddBssIdToPreauthFailList(pMac, pNeighborBssNode->pBssDescription->bssId);
+            /* Now we can free this node */
+            csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode);
+            }
+        }
+
+        /* Issue preauth request for the same/next entry */
+        if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
+            return;
+
+        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
+
+        /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */
+        status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, 
+                        pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, 
+                        eANI_BOOLEAN_FALSE);
+        if (eHAL_STATUS_SUCCESS != status)
+        {
+            smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d\n"), status);
+            return;
+        }
+    }
+}
+#endif  /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPrepareScanProfileFilter
+
+    \brief  This function creates a scan filter based on the currently connected profile.
+            Based on this filter, scan results are obtained
+
+    \param  pMac - The handle returned by macOpen.
+            pScanFilter - Populated scan filter based on the connected profile
+
+    \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tANI_U8 sessionId   = (tANI_U8)pNeighborRoamInfo->csrSessionId;
+    tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
+    tANI_U8 i = 0;
+    
+    VOS_ASSERT(pScanFilter != NULL);
+
+    vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
+
+    /* We dont want to set BSSID based Filter */
+    pScanFilter->BSSIDs.numOfBSSIDs = 0;
+
+    /* Populate all the information from the connected profile */
+    pScanFilter->SSIDs.numOfSSIDs = 1;  
+    pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo));
+    if (NULL == pScanFilter->SSIDs.SSIDList)
+    {
+        smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed"));
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    pScanFilter->SSIDs.SSIDList->handoffPermitted = 1;
+    pScanFilter->SSIDs.SSIDList->ssidHidden = 0;
+    pScanFilter->SSIDs.SSIDList->SSID.length =  pCurProfile->SSID.length;
+    vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length); 
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering for SSID %s from scan results.. SSID Length = %d\n"), 
+                        pScanFilter->SSIDs.SSIDList->SSID.ssId, pScanFilter->SSIDs.SSIDList->SSID.length);
+    pScanFilter->authType.numEntries = 1;
+    pScanFilter->authType.authType[0] = pCurProfile->AuthType;
+
+    pScanFilter->EncryptionType.numEntries = 1; //This must be 1
+    pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
+
+    pScanFilter->mcEncryptionType.numEntries = 1;
+    pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
+
+    pScanFilter->BSSType = pCurProfile->BSSType;
+
+    /* We are intrested only in the scan results on channels that we scanned  */
+    pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
+    pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
+    if (NULL == pScanFilter->ChannelInfo.ChannelList)
+    {
+        smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
+        vos_mem_free(pScanFilter->SSIDs.SSIDList);
+        pScanFilter->SSIDs.SSIDList = NULL;
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
+    {
+        pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
+    }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (pNeighborRoamInfo->is11rAssoc)
+    {
+        /* MDIE should be added as a part of profile. This should be added as a part of filter as well  */
+        pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent;
+        pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain;
+    }
+#endif
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamProcessScanResults
+
+    \brief  This function extracts scan results, sorts on the basis of neighbor score(todo). 
+            Assumed that the results are already sorted by RSSI by csrScanGetResult
+
+    \param  pMac - The handle returned by macOpen.
+            pScanResultList - Scan result result obtained from csrScanGetResult()
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+
+static void csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
+{
+    tCsrScanResultInfo *pScanResult;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tpCsrNeighborRoamBSSInfo    pBssInfo;
+
+    /* Expecting the scan result already to be in the sorted order based on the RSSI */
+    /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
+    /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS.
+       If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */
+    /* For now, let us take the top of the list provided as it is by the CSR Scan result API. This means it is assumed that neighbor score 
+       and rssi score are in the same order. This will be taken care later */
+
+    while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Scan result: BSSID : %02x:%02x:%02x:%02x:%02x:%02x"), 
+                        pScanResult->BssDescriptor.bssId[0],
+                        pScanResult->BssDescriptor.bssId[1],
+                        pScanResult->BssDescriptor.bssId[2],
+                        pScanResult->BssDescriptor.bssId[3],
+                        pScanResult->BssDescriptor.bssId[4],
+                        pScanResult->BssDescriptor.bssId[5]);
+
+        if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, 
+                       pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
+        {
+            //currently associated AP. Do not have this in the roamable AP list
+            continue;
+        }
+
+        if (abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold) < abs(pScanResult->BssDescriptor.rssi))
+        {
+            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                  "%s: [INFOLOG]Current reassoc threshold %d new ap rssi worse=%d\n", __func__,
+                      (int)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                      (int)pScanResult->BssDescriptor.rssi * (-1) );
+            continue;
+        }        
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (pNeighborRoamInfo->is11rAssoc)
+        {
+            if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
+            {
+                smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
+                continue;
+            }
+        }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef FEATURE_WLAN_CCX
+        if (pNeighborRoamInfo->isCCXAssoc)
+        {
+            if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
+            {
+                smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
+                continue;
+            }
+        }
+        if ((pScanResult->BssDescriptor.QBSSLoad_present) &&
+             (pScanResult->BssDescriptor.QBSSLoad_avail))
+        {
+            if (pNeighborRoamInfo->isVOAdmitted)
+            {
+                smsLog(pMac, LOG1, FL("New AP has %x BW available\n"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail);
+                smsLog(pMac, LOG1, FL("We need %x BW available\n"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired);
+                if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired) 
+                {
+                    VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                        "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list\n",
+                        pScanResult->BssDescriptor.bssId[0],
+                        pScanResult->BssDescriptor.bssId[1],
+                        pScanResult->BssDescriptor.bssId[2],
+                        pScanResult->BssDescriptor.bssId[3],
+                        pScanResult->BssDescriptor.bssId[4],
+                        pScanResult->BssDescriptor.bssId[5]);
+                    continue;
+                }
+            }
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL("No QBss %x %x\n"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present);
+            if (pNeighborRoamInfo->isVOAdmitted)
+            {
+                VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                    "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no QBSSLoad IE, ignoring..not adding to roam list\n",
+                    pScanResult->BssDescriptor.bssId[0],
+                    pScanResult->BssDescriptor.bssId[1],
+                    pScanResult->BssDescriptor.bssId[2],
+                    pScanResult->BssDescriptor.bssId[3],
+                    pScanResult->BssDescriptor.bssId[4],
+                    pScanResult->BssDescriptor.bssId[5]);
+                continue;
+            }
+        }
+#endif /* FEATURE_WLAN_CCX */
+
+        /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip 
+         * this result */
+        if (pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
+        {
+            smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp"));
+            continue;
+        }
+
+        pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo));
+        if (NULL == pBssInfo)
+        {
+            smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring"));
+            continue;
+        }
+
+        pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
+        if (pBssInfo->pBssDescription != NULL)
+        {
+            vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor, 
+                    pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
+        }
+        else
+        {
+            smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring"));
+            vos_mem_free(pBssInfo);
+            continue;
+            
+        }
+        pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score
+
+        /* Just add to the end of the list as it is already sorted by RSSI */
+        csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK);
+    }
+
+    /* Now we have all the scan results in our local list. Good time to free up the the list we got as a part of csrGetScanResult */
+    csrScanResultPurge(pMac, *pScanResultList);
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamHandleEmptyScanResult
+
+    \brief      This function will be invoked in CFG_CHAN_LIST_SCAN state when 
+                there are no valid APs in the scan result for roaming. This means 
+                out AP is the best and no other AP is around. No point in scanning 
+                again and again. Performing the following here.
+                1. Deregister the pre-auth callback from TL
+                2. Stop the neighbor scan timer
+                3. Re-register the neighbor lookup callback with increased pre-auth threshold
+                4. Transition the state to CONNECTED state
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
+{
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+
+    /* Stop the neighbor scan timer now */
+    status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGW, FL(" palTimerStop failed with status %d\n"), status);
+    }
+
+    /* Increase the neighbor lookup threshold by a constant factor or 1 */
+    if ((pNeighborRoamInfo->currentNeighborLookupThreshold+3) < pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
+    {
+        pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
+    }
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    /* Clear off the old neighbor report details */
+    vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
+#endif
+
+    /* Reset all the necessary variables before transitioning to the CONNECTED state */
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
+
+    /* Transition to CONNECTED state */
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
+    /* Re-register Neighbor Lookup threshold callback with TL */
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); 
+    vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_DOWN, 
+                                    csrNeighborRoamNeighborLookupDOWNCallback, 
+                                    VOS_MODULE_ID_SME, pMac);
+    
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d\n"), status);
+    }
+    return vosStatus;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamScanRequestCallback
+
+    \brief  This function is the callback function registered in csrScanRequest() to 
+            indicate the completion of scan. If scan is completed for all the channels in 
+            the channel list, this function gets the scan result and starts the refresh results
+            timer to avoid having stale results. If scan is not completed on all the channels,
+            it restarts the neighbor scan timer which on expiry issues scan on the next 
+            channel
+
+    \param  halHandle - The handle returned by macOpen.
+            pContext - not used
+            scanId - not used
+            status - not used
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext,
+                         tANI_U32 scanId, eCsrScanStatus status)
+{
+    tpAniSirGlobal                  pMac = (tpAniSirGlobal) halHandle;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tANI_U8                         currentChanIndex;
+    tCsrScanResultFilter    scanFilter;
+    tScanResultHandle       scanResult;
+    tANI_U32                tempVal = 0;
+
+    pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
+    
+    /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
+    if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
+    {
+        smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */
+    currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0;
+
+    /* Validate inputs */
+    if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) { 
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"), 
+                    pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex);
+    }
+    else
+    {
+        smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event."));
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
+    {
+        /* Scan is completed in the  CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state 
+           just to get the results and perform PREAUTH */
+        /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
+           sort the results based on neighborScore and RSSI and select the best candidate out of the list */
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
+        VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+        /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we 
+           should use the BSSID filter made out of neighbor reports */
+        if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
+        {
+            status = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter);
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R or CCX Association: Prepare scan filter status  with neighbor AP = %d"), status);
+            tempVal = 1;
+        }
+        else
+#endif
+        {
+            status = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter);
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R/CCX/Other Association: Prepare scan to find neighbor AP filter status  = %d"), status);
+        }
+        if (eHAL_STATUS_SUCCESS != status)
+        {
+            smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal);
+            return eHAL_STATUS_FAILURE;
+        }
+        status = csrScanGetResult(pMac, &scanFilter, &scanResult);
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), status);
+        /* Process the scan results and update roamable AP list */
+        csrNeighborRoamProcessScanResults(pMac, &scanResult);
+
+        /* Free the scan filter */
+        csrFreeScanFilter(pMac, &scanFilter);
+
+        tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList);
+
+        switch(pNeighborRoamInfo->neighborRoamState)
+        {
+            case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
+                if (tempVal)
+                {
+#ifdef WLAN_FEATURE_VOWIFI_11R
+                    /* If this is a non-11r association, then we can register the reassoc callback here as we have some 
+                                        APs in the roamable AP list */
+                    if (pNeighborRoamInfo->is11rAssoc)
+                    {
+                        /* Valid APs are found after scan. Now we can initiate pre-authentication */
+                        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
+                    }
+                    else
+#endif
+#ifdef FEATURE_WLAN_CCX
+                    /* If this is a non-11r association, then we can register the reassoc callback here as we have some 
+                                        APs in the roamable AP list */
+                    if (pNeighborRoamInfo->isCCXAssoc)
+                    {
+                        /* Valid APs are found after scan. Now we can initiate pre-authentication */
+                        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
+                    }
+                    else
+#endif
+                    {
+                       
+                        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
+                        /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */
+                        /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we 
+                           need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL 
+                           within certain duration */
+                        
+//                        palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+                    }
+                }
+                else
+                {
+                    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
+                    /* Handle it appropriately */
+                    csrNeighborRoamHandleEmptyScanResult(pMac);
+                }
+                break;
+#ifdef WLAN_FEATURE_VOWIFI_11R                
+            case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
+                if (!tempVal)
+                {
+                    smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
+                    /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */
+                    csrNeighborRoamTransitToCFGChanScan(pMac);
+                }
+                break;
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+            default:
+                // Can come only in INIT state. Where in we are associated, we sent scan and user
+                // in the meantime decides to disassoc, we will be in init state and still received call
+                // back issued. Should not come here in any other state, printing just in case
+                VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                        "%s: [INFOLOG] State %d\n", __func__, (pNeighborRoamInfo->neighborRoamState));
+
+                // Lets just exit out silently.
+                return eHAL_STATUS_SUCCESS;
+        }
+
+        if (tempVal)
+        {
+            VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+
+           /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely 
+            * that the callback getting called immediately and the timer would never be stopped when pre-auth is in progress */
+           if (eHAL_STATUS_SUCCESS != palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, 
+                        pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, 
+                        eANI_BOOLEAN_FALSE))
+            {
+                smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), status);
+                vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+                return VOS_STATUS_E_FAILURE;
+            }
+            
+            NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+            /* Register a reassoc Indication callback */
+            vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                            WLANTL_HO_THRESHOLD_DOWN, 
+                                            csrNeighborRoamReassocIndCallback,
+                                            VOS_MODULE_ID_SME, pMac);
+            
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+               //err msg
+               smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+            }
+ 
+        }
+    }
+    else
+    {
+
+        /* Restart the timer for the next scan sequence as scanning is not over */
+        status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, 
+                    pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, 
+                    eANI_BOOLEAN_FALSE);
+    
+        if (eHAL_STATUS_SUCCESS != status)
+        {
+            /* Timer start failed.. Should we ASSERT here??? */
+            smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
+            vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+            return VOS_STATUS_E_FAILURE;
+        }
+    }
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIssueBgScanRequest
+
+    \brief  This function issues CSR scan request after populating all the BG scan params 
+            passed
+
+    \param  pMac - The handle returned by macOpen.
+            pBgScanParams - Params that need to be populated into csr Scan request
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac, tCsrBGScanRequest *pBgScanParams)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 scanId;
+    tCsrScanRequest scanReq;
+    tANI_U8 channel;
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamIssueBgScanRequest for Channel = %d, ChanIndex = %d"), 
+                    pBgScanParams->ChannelInfo.ChannelList[0], pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
+
+
+    //send down the scan req for 1 channel on the associated SSID
+    palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
+    /* Fill in the SSID Info */
+    scanReq.SSIDs.numOfSSIDs = 1;
+    scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
+    if(NULL == scanReq.SSIDs.SSIDList)
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List\n"));
+       return eHAL_STATUS_FAILURE;
+    }
+    vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
+
+    scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE;
+    scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE;
+    vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID));
+    
+    scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels;
+    
+    channel = pBgScanParams->ChannelInfo.ChannelList[0];
+    scanReq.ChannelInfo.ChannelList = &channel;    
+
+    scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+    scanReq.scanType = eSIR_ACTIVE_SCAN;
+    scanReq.requestType = eCSR_SCAN_HO_BG_SCAN;
+    scanReq.maxChnTime = pBgScanParams->maxChnTime;
+    scanReq.minChnTime = pBgScanParams->minChnTime;
+    status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq,
+                        &scanId, csrNeighborRoamScanRequestCallback, NULL);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status);
+        vos_mem_free(scanReq.SSIDs.SSIDList);
+        return status;
+    }
+    pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE;
+
+    vos_mem_free(scanReq.SSIDs.SSIDList);
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Address = %08x, Actual index = %d"), 
+                    &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0], 
+                    pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPerformBgScan
+
+    \brief  This function is invoked on every expiry of neighborScanTimer till all 
+            the channels in the channel list are scanned. It populates necessary 
+            parameters for BG scan and calls appropriate AP to invoke the CSR scan 
+            request
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac)
+{
+    eHalStatus      status = eHAL_STATUS_SUCCESS;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tCsrBGScanRequest   bgScanParams;
+    tANI_U8             broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+    tANI_U8             channel = 0;
+
+    if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Address = %08x"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]);
+    }
+    else 
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty"));
+        // Go back and restart. Mostly timer start failure has occured.
+        // When timer start is declared a failure, then we delete the list.
+        // Should not happen now as we stop and then only start the scan timer. 
+        // still handle the unlikely case.
+        csrNeighborRoamHandleEmptyScanResult(pMac);
+        return status;
+    }
+    /* Need to perform scan here before getting the list */
+    vos_mem_copy(bgScanParams.bssid, broadcastBssid, sizeof(tCsrBssid));
+    bgScanParams.SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
+    vos_mem_copy(bgScanParams.SSID.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, 
+                                    pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
+
+    channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex];
+    bgScanParams.ChannelInfo.numOfChannels = 1;
+    bgScanParams.ChannelInfo.ChannelList = &channel;
+   
+    bgScanParams.minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime;
+    bgScanParams.maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime;
+
+    status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
+        return status;
+    }
+
+    pNeighborRoamInfo->roamChannelInfo.currentChanIndex++;
+    if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >= 
+            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
+    {      
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"),
+                                            pNeighborRoamInfo->roamChannelInfo.currentChanIndex, 
+                                            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels);
+        /* We have completed scanning all the channels */
+        pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
+        /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results 
+           and select the best AP in the list */
+        if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
+        {
+            pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
+        }
+    }
+
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamNeighborScanTimerCallback
+
+    \brief  This function is the neighbor scan timer callback function. It invokes 
+            the BG scan request based on the current and previous states
+
+    \param  pv - CSR timer context info which includes pMac and session ID
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamNeighborScanTimerCallback(void *pv)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    tANI_U32         sessionId = pInfo->sessionId;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    // check if bg scan is on going, no need to send down the new params if true
+    if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
+    {
+       //msg
+       smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending\n"));
+       return;
+    }
+
+    VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
+
+    switch (pNeighborRoamInfo->neighborRoamState)
+    {
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
+            switch(pNeighborRoamInfo->prevNeighborRoamState)
+            {
+                case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
+                    csrNeighborRoamPerformBgScan(pMac);
+                    break;
+                default:
+                    smsLog(pMac, LOGE, FL("Neighbor scan callback received in state %d, prev state = %d"), 
+                                    pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState);
+                    break;
+            }
+            break;
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+        case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:     
+            csrNeighborRoamPerformBgScan(pMac);
+            break;
+        default:
+            break;
+    }
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamResultsRefreshTimerCallback
+
+    \brief  This function is the timer callback function for results refresh timer.
+            When this is invoked, it is as good as down event received from TL. So, 
+            clear off the roamable AP list and start the scan procedure based on 11R 
+            or non-11R association
+
+    \param  context - CSR timer context info which includes pMac and session ID
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamResultsRefreshTimerCallback(void *context)
+{
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    VOS_STATUS     vosStatus = VOS_STATUS_SUCCESS;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+     
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    /* Reset all the variables just as no scan had happened before */
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
+
+#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
+    if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
+        vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
+        if (VOS_STATUS_SUCCESS != vosStatus)
+        {
+            smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d\n"), vosStatus);
+            return;
+        }
+        /* Increment the neighbor report retry count after sending the neighbor request successfully */
+        pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
+        pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
+        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
+    }
+    else
+#endif      
+    {
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state"));
+        vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
+        if (VOS_STATUS_SUCCESS != vosStatus)
+        {
+            return;
+        }
+    }
+    return;
+}
+
+#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIssueNeighborRptRequest
+
+    \brief  This function is invoked when TL issues a down event and the current assoc 
+            is a 11R association. It invokes SME RRM API to issue the neighbor request to 
+            the currently associated AP with the current SSID
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac)
+{
+    tRrmNeighborRspCallbackInfo callbackInfo;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tRrmNeighborReq neighborReq;
+
+
+    neighborReq.no_ssid = 0;
+
+    /* Fill in the SSID */
+    neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
+    vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, 
+                                    pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
+    
+    callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult;
+    callbackInfo.neighborRspCallbackContext = pMac;
+    callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout;
+
+    return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamCreateChanListFromNeighborReport
+
+    \brief  This function is invoked when neighbor report is received for the 
+            neighbor request. Based on the channels present in the neighbor report, 
+            it generates channel list which will be used in REPORT_SCAN state to
+            scan for these neighbor APs
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac)
+{
+    tpRrmNeighborReportDesc pNeighborBssDesc;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tANI_U8         numChannels = 0, i = 0, j=0;
+    tANI_U8         channelList[MAX_BSS_IN_NEIGHBOR_RPT];
+
+    /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
+    pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
+
+    pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac);
+
+    while (pNeighborBssDesc)
+    {
+        if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break;
+        
+        /* Update the neighbor BSS Info in the 11r FT Roam Info */
+        pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum = 
+                                    pNeighborBssDesc->pNeighborBssDescription->channel;
+        pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore = 
+                                    (tANI_U8)pNeighborBssDesc->roamScore;
+        vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId,
+                                     pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr));
+        pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++;
+
+        /* Saving the channel list non-redundantly */
+        if (numChannels > 0)
+        {
+            for (i = 0; i < numChannels; i++)
+            {
+                if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i])
+                    break;
+            }
+            
+        }
+        if (i == numChannels)
+        {
+            if (pNeighborBssDesc->pNeighborBssDescription->channel)
+            {
+                // Make sure to add only if its the same band
+                if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                    (pNeighborBssDesc->pNeighborBssDescription->channel <= (RF_CHAN_14+1)))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborBssDesc->pNeighborBssDescription->channel);
+                        channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
+                        numChannels++;
+                }
+                else if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                    (pNeighborBssDesc->pNeighborBssDescription->channel >= RF_CHAN_128))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborBssDesc->pNeighborBssDescription->channel);
+                        channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
+                        numChannels++;
+                }
+            }
+        }
+            
+        pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc);
+    }
+
+    if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+    {
+        // Before we free the existing channel list for a safety net make sure
+        // we have a union of the IAPP and the already existing list. 
+        for (i = 0; i < pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; i++)
+        {
+            for (j = 0; j < numChannels; j++)
+            {
+                if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] == channelList[j])
+                    break;
+            }
+            if (j == numChannels)
+            {
+                if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i])
+                {
+                    // Make sure to add only if its the same band
+                    if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                        (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] <= (RF_CHAN_14+1)))
+                    {
+                            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                    "%s: [INFOLOG] Adding extra %d to Neighbor channel list\n", __func__,
+                            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
+                            channelList[numChannels] = 
+                            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
+                            numChannels++;
+                    }
+                    if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                         (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] >= RF_CHAN_128))
+                    {
+                            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                    "%s: [INFOLOG] Adding extra %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
+                            channelList[numChannels] = 
+                                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
+                            numChannels++;
+                    }
+                }
+            }
+        }
+        vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+    }
+
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+    /* Store the obtained channel list to the Neighbor Control data structure */
+    if (numChannels)
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8));
+    if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+    {
+        smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
+        return VOS_STATUS_E_RESOURCES;
+    }
+
+    vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, 
+                                            channelList, (numChannels) * sizeof(tANI_U8));
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels;
+    if (numChannels)
+    {
+        smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected in state %d."), 
+            pNeighborRoamInfo->neighborRoamState);
+        pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE;
+    }
+    pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
+    pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
+    
+    return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamRRMNeighborReportResult
+
+    \brief  This function is the neighbor report callback that will be invoked by 
+            SME RRM on receiving a neighbor report or of neighbor report is not 
+            received after timeout. On receiving a valid report, it generates a 
+            channel list from the neighbor report and starts the 
+            neighbor scan timer
+
+    \param  context - The handle returned by macOpen.
+            vosStatus - Status of the callback(SUCCESS/FAILURE)
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(context);
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+
+    smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d\n"), vosStatus);
+    switch (pNeighborRoamInfo->neighborRoamState)
+    {
+        case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
+            /* Reset the report pending variable */
+            pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
+            if (VOS_STATUS_SUCCESS == vosStatus)
+            {
+                /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */
+                vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac);
+                if (VOS_STATUS_SUCCESS == vosStatus)
+                {
+                    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state\n")); 
+                }
+
+                /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
+                pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+                
+                /* Now ready for neighbor scan based on the channel list created */
+                /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is 
+                   what palTimerStart expects */
+                status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, 
+                                pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, 
+                                eANI_BOOLEAN_FALSE);
+                if (eHAL_STATUS_SUCCESS != status)
+                {
+                    /* Timer start failed.. Should we ASSERT here??? */
+                    smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status);
+                    vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+                    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+                    return;
+                }
+                pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;                
+                /* Neighbor scan timer started. Transition to REPORT_SCAN state */
+                CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
+            }
+            else
+            {
+                /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we 
+                                reach the maxNeighborRetries or receiving a successful neighbor response */
+                smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d\n"), 
+                     pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries);
+                if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >= 
+                        pNeighborRoamInfo->cfgParams.maxNeighborRetries)
+                {
+                    smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. \n"));
+                    vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
+                    if (VOS_STATUS_SUCCESS != vosStatus)
+                    {
+                        smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d \n"), vosStatus);
+                        return;
+                    }
+                    /* We transitioned to different state now. Reset the Neighbor report retry count */
+                    pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
+                }
+                else
+                {
+                    vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
+                    if (VOS_STATUS_SUCCESS != vosStatus)
+                    {
+                        smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d\n"), vosStatus);
+                        return;
+                    }
+                    pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
+                    /* Increment the neighbor report retry count after sending the neighbor request successfully */
+                    pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
+                }
+            }
+            break;
+        default:
+            smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState);
+            break;
+    }
+    return;
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamTransitToCFGChanScan
+
+    \brief  This function is called whenever there is a transition to CFG chan scan 
+            state from any state. It frees up the current channel list and allocates 
+            a new memory for the channels received from CFG item. It then starts the 
+            neighbor scan timer to perform the scan on each channel one by one
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus  status  = eHAL_STATUS_SUCCESS;
+    int i = 0;
+    int numOfChannels = 0;
+    tANI_U8   channelList[MAX_BSS_IN_NEIGHBOR_RPT];
+
+    if (
+#ifdef FEATURE_WLAN_CCX
+        ((pNeighborRoamInfo->isCCXAssoc) && 
+        (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
+        (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || 
+#endif // CCX
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels == 0)
+
+    {
+        smsLog(pMac, LOGW, FL("Falling back to CFG channel list"));
+
+
+        /* Free up the channel list and allocate a new memory. This is because we dont know how much 
+            was allocated last time. If we directly copy more number of bytes than allocated earlier, this might 
+            result in memory corruption */
+        if (NULL != pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+        {
+            vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+        }
+        // Find the right subset of the cfg list based on the current band we are on.
+        for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
+        {
+            if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i])
+            {
+                // Make sure to add only if its the same band
+                if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                    (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i] <= (RF_CHAN_14+1)))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
+                        channelList[numOfChannels] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
+                        numOfChannels++;
+                }
+                if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                    (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i] >= RF_CHAN_128))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
+                        channelList[numOfChannels] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
+                        numOfChannels++;
+                }
+            }
+        }
+
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numOfChannels;
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; 
+        if (numOfChannels)
+            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc(numOfChannels);
+    
+        if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+        {
+            smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
+            return VOS_STATUS_E_RESOURCES;
+        }
+    
+        /* Since this is a legacy case, copy the channel list from CFG here */
+        vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, 
+                                channelList, numOfChannels * sizeof(tANI_U8));
+
+        for (i = 0; i < pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; i++)
+        {
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Channel List from CFG = %d\n", 
+                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
+        }
+    }
+
+    /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
+    pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+    
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+    /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is 
+            what palTimerStart expects */
+    status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, 
+                    pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, 
+                    eANI_BOOLEAN_FALSE);
+    
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        /* Timer start failed..  */
+        smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
+        vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+        return VOS_STATUS_E_FAILURE;
+    }
+    
+    pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
+    pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
+    
+    /* Transition to CFG_CHAN_LIST_SCAN_STATE */
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamNeighborLookupUpEvent
+
+    \brief  This function is called as soon as TL indicates that the current AP's 
+            RSSI is better than the neighbor lookup threshold. Here, we transition to 
+            CONNECTED state and reset all the scan parameters
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS  csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS  vosStatus;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+    /* Deregister the UP event now */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_UP, 
+                                    csrNeighborRoamNeighborLookupUPCallback, 
+                                    VOS_MODULE_ID_SME);
+
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback UP event from TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+    /* Deregister the UP event now */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_DOWN, 
+                                    csrNeighborRoamNeighborLookupDOWNCallback, 
+                                    VOS_MODULE_ID_SME);
+
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback UP event from TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+    /* Deregister reassoc callback. */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+
+    /* RSSI got better than the CFG neighbor lookup threshold. Reset the threshold to older value and set the increment multiplier to 0 */
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
+
+    pNeighborRoamInfo->currentNeighborLookupThreshold = pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
+    
+    /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
+
+    /* Recheck whether the below check is needed. */
+    if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
+        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+    /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
+    vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_DOWN, 
+                                    csrNeighborRoamNeighborLookupDOWNCallback, 
+                                    VOS_MODULE_ID_SME, pMac);
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d\n"), vosStatus);
+    }
+
+
+    return vosStatus;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamNeighborLookupDownEvent
+
+    \brief  This function is called as soon as TL indicates that the current AP's 
+            RSSI falls below the current eighbor lookup threshold. Here, we transition to 
+            REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is 
+            a non-11R association.
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS  csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+
+    switch (pNeighborRoamInfo->neighborRoamState)
+    {
+        case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
+            
+            NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"), 
+                                                            pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+            /* De-register Neighbor Lookup threshold callback with TL */
+            vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                            WLANTL_HO_THRESHOLD_DOWN, 
+                                            csrNeighborRoamNeighborLookupDOWNCallback, 
+                                            VOS_MODULE_ID_SME);
+            
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+               //err msg
+               smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d\n"), status);
+            }
+            
+           
+#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
+            if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
+            {
+               
+                NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
+                vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
+                if (VOS_STATUS_SUCCESS != vosStatus)
+                {
+                    smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d\n"), vosStatus);
+                    return vosStatus;
+                }
+                /* Increment the neighbor report retry count after sending the neighbor request successfully */
+                pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
+                pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
+                CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
+            }
+            else
+#endif      
+            {
+                NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state"));
+
+                vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
+                if (VOS_STATUS_SUCCESS != vosStatus)
+                {
+                    return vosStatus;
+                }
+            }
+            NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering UP event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+            /* Register Neighbor Lookup threshold callback with TL for UP event now */
+            vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                            WLANTL_HO_THRESHOLD_UP, 
+                                            csrNeighborRoamNeighborLookupUPCallback, 
+                                            VOS_MODULE_ID_SME, pMac);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+               //err msg
+               smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d\n"), status);
+            }
+            break;
+        default:
+            smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
+            break;
+            
+    }
+    return vosStatus;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamNeighborLookupUPCallback
+
+    \brief  This function is registered with TL to indicate whenever the RSSI 
+            gets better than the neighborLookup RSSI Threshold
+
+    \param  pAdapter - VOS Context
+            trafficStatus - UP/DOWN indication from TL
+            pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
+                                                                               v_PVOID_t pUserCtxt)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS  vosStatus = eHAL_STATUS_SUCCESS;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Neighbor Lookup UP indication callback called with notification %d"), rssiNotification);
+
+    if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
+    {
+       smsLog(pMac, LOGW, "Ignoring the indication as we are not connected\n");
+       return VOS_STATUS_SUCCESS;
+    }
+
+    VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification);
+    vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac);
+    return vosStatus;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamNeighborLookupDOWNCallback
+
+    \brief  This function is registered with TL to indicate whenever the RSSI 
+            falls below the current neighborLookup RSSI Threshold
+
+    \param  pAdapter - VOS Context
+            trafficStatus - UP/DOWN indication from TL
+            pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
+
+    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
+                                                                               v_PVOID_t pUserCtxt)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS  vosStatus = eHAL_STATUS_SUCCESS;
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Neighbor Lookup DOWN indication callback called with notification %d"), rssiNotification);
+
+    if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
+    {
+       smsLog(pMac, LOGW, "Ignoring the indication as we are not connected\n");
+       return VOS_STATUS_SUCCESS;
+    }
+
+    VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification);
+    vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac);
+
+    return vosStatus;
+}
+
+#ifdef RSSI_HACK
+extern int dumpCmdRSSI;
+#endif
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIndicateDisconnect
+
+    \brief  This function is called by CSR as soon as the station disconnects from 
+            the AP. This function does the necessary cleanup of neighbor roam data 
+            structures. Neighbor roam state transitions to INIT state whenever this 
+            function is called except if the current state is REASSOCIATING
+
+    \param  pMac - The handle returned by macOpen.
+            sessionId - CSR session id that got disconnected
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    smsLog(pMac, LOGE, FL("Disconnect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
+ 
+#ifdef FEATURE_WLAN_CCX
+    {
+      tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId);
+      if (pSession->connectedProfile.isCCXAssoc)
+      {
+          vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
+          vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
+          pSession->prevOpChannel = pSession->connectedProfile.operationChannel;
+          pSession->isPrevApInfoValid = TRUE;
+          pSession->roamTS1 = vos_timer_get_system_time();
+
+      }
+    }
+#endif
+   
+#ifdef RSSI_HACK
+    dumpCmdRSSI = -40;
+#endif
+    switch (pNeighborRoamInfo->neighborRoamState)
+    {
+        case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
+            // Stop scan and neighbor refresh timers.
+            // These are indeed not required when we are in reassociating
+            // state.
+            palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+            palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
+            break;
+
+        case eCSR_NEIGHBOR_ROAM_STATE_INIT:
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Ignoring disconnect event in INIT state"));
+            csrNeighborRoamResetInitStateControlInfo(pMac);
+            break; 
+
+        default:
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState);
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Transitioning to INIT state"));
+            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
+    }
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIndicateConnect
+
+    \brief  This function is called by CSR as soon as the station connects to an AP.
+            This initializes all the necessary data structures related to the 
+            associated AP and transitions the state to CONNECTED state
+
+    \param  pMac - The handle returned by macOpen.
+            sessionId - CSR session id that got connected
+            vosStatus - connect status SUCCESS/FAILURE
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    int  init_ft_flag = FALSE;
+#endif
+
+    smsLog(pMac, LOGE, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
+
+    switch (pNeighborRoamInfo->neighborRoamState)
+    {
+        case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
+            if (VOS_STATUS_SUCCESS != vosStatus)
+            {
+                /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */
+                CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
+                break;
+            }
+            /* Fall through if the status is SUCCESS */
+        case eCSR_NEIGHBOR_ROAM_STATE_INIT:
+            /* Reset all the data structures here */ 
+            csrNeighborRoamResetInitStateControlInfo(pMac);
+
+            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
+
+            pNeighborRoamInfo->csrSessionId = sessionId;
+            vos_mem_copy(pNeighborRoamInfo->currAPbssid, 
+                        pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
+            pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
+            pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+            pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
+            
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+            /* Now we can clear the preauthDone that was saved as we are connected afresh */
+            csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
+#endif
+            
+#ifdef WLAN_FEATURE_VOWIFI_11R
+            // Based on the auth scheme tell if we are 11r
+            if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType ) )
+            {
+                if (pMac->roam.configParam.isFastTransitionEnabled)
+                    init_ft_flag = TRUE;
+                pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE;
+            }
+            else
+                pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+            // Based on the auth scheme tell if we are 11r
+            if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc)
+            {
+                if (pMac->roam.configParam.isFastTransitionEnabled)
+                    init_ft_flag = TRUE;
+                pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE;
+            }
+            else
+                pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("isCCXAssoc is = %d"), pNeighborRoamInfo->isCCXAssoc);
+            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+                        "ccx=%d ft=%d\n", pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
+                            
+#endif
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+            if ( init_ft_flag == TRUE )
+            {
+                /* Initialize all the data structures needed for the 11r FT Preauth */
+                pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.pMac = pMac;
+                pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.sessionId = sessionId;
+                pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
+                csrNeighborRoamPurgePreauthFailedList(pMac);
+
+                NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
+                /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
+                status = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                            WLANTL_HO_THRESHOLD_DOWN, 
+                                            csrNeighborRoamNeighborLookupDOWNCallback, 
+                                            VOS_MODULE_ID_SME, pMac);
+            
+                if(!VOS_IS_STATUS_SUCCESS( status))
+                {
+                   //err msg
+                   smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d\n"), status);
+                }
+            }
+#endif
+
+            
+            break;
+        default:
+            smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
+            break;
+    }
+    return status;
+}
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPreAuthResponseWaitTimerHandler
+
+    \brief  If this function is invoked, that means the preauthentication response 
+            is timed out from the PE. Preauth rsp handler is called with status as 
+            TIMEOUT
+
+    \param  context - CSR Timer info which holds pMac and session ID
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamPreAuthResponseWaitTimerHandler(void *context)
+{
+    tCsrTimerInfo *pTimerInfo = (tCsrTimerInfo *)context;
+    tpAniSirGlobal pMac = (tpAniSirGlobal)pTimerInfo->pMac;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
+
+    csrNeighborRoamPreauthRspHandler(pMac, VOS_STATUS_E_TIMEOUT);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamPurgePreauthFailedList
+
+    \brief  This function purges all the MAC addresses in the pre-auth fail list
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++)
+    {
+        vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr));
+    }
+    pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0;
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamInit11rAssocInfo
+
+    \brief  This function initializes 11r related neighbor roam data structures
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac)
+{
+    eHalStatus  status;
+    tpCsr11rAssocNeighborInfo   pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo;
+
+    pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE;
+    pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries;
+    pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT;
+    pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
+    pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE;
+    pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE;
+    
+    pFTRoamInfo->preAuthRspWaitTimerInfo.pMac = pMac;
+    pFTRoamInfo->preAuthRspWaitTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    status = palTimerAlloc(pMac->hHdd, &pFTRoamInfo->preAuthRspWaitTimer, 
+                    csrNeighborRoamPreAuthResponseWaitTimerHandler, (void *)&pFTRoamInfo->preAuthRspWaitTimerInfo);
+
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Response wait Timer allocation failed"));
+        return eHAL_STATUS_RESOURCES;
+    }
+    
+    pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
+    pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
+    vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, 
+                            sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
+
+    
+    status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed"));
+        palTimerFree(pMac->hHdd, pFTRoamInfo->preAuthRspWaitTimer);
+        return eHAL_STATUS_RESOURCES;
+    }
+    return status;
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamInit
+
+    \brief  This function initializes neighbor roam data structures
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
+
+---------------------------------------------------------------------------*/
+eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac)
+{
+    eHalStatus status;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    pNeighborRoamInfo->neighborRoamState       =   eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
+    pNeighborRoamInfo->prevNeighborRoamState   =   eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
+    pNeighborRoamInfo->csrSessionId            =   CSR_SESSION_ID_INVALID;
+    pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime;
+    pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime;
+    pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0;
+    pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
+    pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold;
+    pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod;
+    pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
+    
+    pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels   =   
+                        pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
+
+    pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = 
+                vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
+
+    if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
+    {
+        smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    /* Update the roam global structure from CFG */
+    palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, 
+                        pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
+                        pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
+
+    vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
+    pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
+    pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
+
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer, 
+                    csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
+
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Response wait Timer allocation failed"));
+        vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
+        pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer, 
+                    csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
+
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Response wait Timer allocation failed"));
+        smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
+        vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
+        pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
+        palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
+        vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
+        pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
+        palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+        palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
+        return eHAL_STATUS_RESOURCES;
+    }
+
+    pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+    pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    status = csrNeighborRoamInit11rAssocInfo(pMac);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
+        vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
+        pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
+        palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+        palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);        
+        csrLLClose(&pNeighborRoamInfo->roamableAPList);
+        return eHAL_STATUS_RESOURCES;
+    }
+#endif
+    /* Initialize this with the current tick count */
+    pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
+    
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamClose
+
+    \brief  This function closes/frees all the neighbor roam data structures
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamClose(tpAniSirGlobal pMac)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+    if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState)
+    {
+        smsLog(pMac, LOGE, FL("Neighbor Roam Algorithm Already Closed\n"));
+        return;
+    }
+
+    if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
+        vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
+   
+    pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
+    
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+    palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
+
+    /* Should free up the nodes in the list before closing the double Linked list */
+    csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
+    csrLLClose(&pNeighborRoamInfo->roamableAPList);
+    
+    if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+    {
+        vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
+    }
+
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+    pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
+    pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+    pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;    
+    pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
+
+    /* Free the profile.. */ 
+    csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
+    palTimerFree(pMac->hHdd, pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthRspWaitTimer);
+    pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthRspWaitTimerInfo.pMac = NULL;
+    pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthRspWaitTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
+    vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, 
+                            sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
+    csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
+    csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED)
+    
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamRequestHandoff
+
+    \brief  This function triggers actual switching from one AP to the new AP.
+            It issues disassociate with reason code as Handoff and CSR as a part of 
+            handling disassoc rsp, issues reassociate to the new AP
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac)
+{
+
+    tCsrRoamInfo roamInfo;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
+    tCsrNeighborRoamBSSInfo     handoffNode;
+    extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp );
+    tANI_U32 roamId = 0;
+
+    if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) 
+    {
+        smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %d state"), 
+            pMac->roam.neighborRoamInfo.neighborRoamState);
+        return;
+    }
+
+    vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
+    csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START, 
+                eSIR_SME_SUCCESS);
+
+    vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING)
+    
+    csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode);
+    smsLog(pMac, LOGE, FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"),
+                                                handoffNode.pBssDescription->bssId[0], 
+                                                handoffNode.pBssDescription->bssId[1], 
+                                                handoffNode.pBssDescription->bssId[2], 
+                                                handoffNode.pBssDescription->bssId[3], 
+                                                handoffNode.pBssDescription->bssId[4], 
+                                                handoffNode.pBssDescription->bssId[5]);
+   
+    /* Free the profile.. Just to make sure we dont leak memory here */ 
+    csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
+    /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number
+        This should happen before issuing disconnect */
+    csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile);
+    vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr));
+    pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId;
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP\n");
+
+    if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF)))
+    {
+        smsLog(pMac, LOGW, "csrRoamHandoffRequested:  fail to issue disassociate\n");
+        return;
+    }                       
+
+    //notify HDD for handoff, providing the BSSID too
+    roamInfo.reasonCode = eCsrRoamReasonBetterAP;
+
+    vos_mem_copy(roamInfo.bssid, 
+                 handoffNode.pBssDescription->bssId, 
+                 sizeof( tCsrBssid ));
+
+    csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
+
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIsHandoffInProgress
+
+    \brief  This function returns whether handoff is in progress or not based on 
+            the current neighbor roam state
+
+    \param  pMac - The handle returned by macOpen.
+            is11rReassoc - Return whether reassoc is of type 802.11r reassoc
+
+    \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
+
+---------------------------------------------------------------------------*/
+tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac)
+{
+    if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState)
+        return eANI_BOOLEAN_TRUE;
+
+    return eANI_BOOLEAN_FALSE;
+}
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamIs11rAssoc
+
+    \brief  This function returns whether the current association is a 11r assoc or not
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise
+
+---------------------------------------------------------------------------*/
+tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac)
+{
+    return pMac->roam.neighborRoamInfo.is11rAssoc;
+}
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn csrNeighborRoamGetHandoffAPInfo
+
+    \brief  This function returns the best possible AP for handoff. For 11R case, it 
+            returns the 1st entry from pre-auth done list. For non-11r case, it returns 
+            the 1st entry from roamable AP list
+
+    \param  pMac - The handle returned by macOpen.
+            pHandoffNode - AP node that is the handoff candidate returned
+
+    \return VOID
+
+---------------------------------------------------------------------------*/
+void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode)
+{
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tpCsrNeighborRoamBSSInfo        pBssNode;
+    
+    VOS_ASSERT(NULL != pHandoffNode); 
+        
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (pNeighborRoamInfo->is11rAssoc)
+    {
+        /* Always the BSS info in the head is the handoff candidate */
+        pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
+        NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
+    }
+    else
+#endif
+#ifdef FEATURE_WLAN_CCX
+    if (pNeighborRoamInfo->isCCXAssoc)
+    {
+        /* Always the BSS info in the head is the handoff candidate */
+        pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
+        NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
+    }
+    else
+#endif
+    {
+        pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
+        NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
+    }
+    vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo));
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+    \brief  This function returns TRUE if preauth is completed 
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return boolean
+
+---------------------------------------------------------------------------*/
+tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac)
+{
+    return (pMac->roam.neighborRoamInfo.neighborRoamState == 
+               eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE);
+}
+
+/* ---------------------------------------------------------------------------
+    \brief  In the event that we are associated with AP1 and we have
+    completed pre auth with AP2. Then we receive a deauth/disassoc from
+    AP1. 
+    At this point neighbor roam is in pre auth done state, pre auth timer
+    is running. We now handle this case by stopping timer and clearing
+    the pre-auth state. We basically clear up and just go to disconnected
+    state. 
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return boolean
+---------------------------------------------------------------------------*/
+void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac)
+{
+    if (pMac->roam.neighborRoamInfo.neighborRoamState != 
+               eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return;
+
+    // Stop timer
+    palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
+
+    // Transition to init state
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
+}
+
+#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
diff --git a/CORE/SME/src/csr/csrUtil.c b/CORE/SME/src/csr/csrUtil.c
new file mode 100644
index 0000000..5910069
--- /dev/null
+++ b/CORE/SME/src/csr/csrUtil.c
@@ -0,0 +1,5846 @@
+/*
+ * 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 csrUtil.c
+
+    Implementation supporting routines for CSR.
+
+
+    Copyright (C) 2006 Airgo Networks, Incorporated
+   ========================================================================== */
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h" //Check if the below include of aniGobal.h is sufficient for Volans too.
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "aniGlobal.h"
+#endif
+
+#include "palApi.h"
+#include "csrSupport.h"
+#include "csrInsideApi.h"
+#include "smsDebug.h"
+#include "smeQosInternal.h"
+#ifdef FEATURE_WLAN_CCX
+#include "vos_utils.h"
+#include "csrCcx.h"
+#endif /* FEATURE_WLAN_CCX */
+
+tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ] = {
+    { 0x00, 0x50, 0xf2, 0x00 },
+    { 0x00, 0x50, 0xf2, 0x01 },
+    { 0x00, 0x50, 0xf2, 0x02 },
+    { 0x00, 0x50, 0xf2, 0x03 },
+    { 0x00, 0x50, 0xf2, 0x04 },
+    { 0x00, 0x50, 0xf2, 0x05 },
+#ifdef FEATURE_WLAN_CCX
+    { 0x00, 0x40, 0x96, 0x00 }, // CCKM
+#endif /* FEATURE_WLAN_CCX */
+};
+
+tANI_U8 csrRSNOui[][ CSR_RSN_OUI_SIZE ] = {
+    { 0x00, 0x0F, 0xAC, 0x00 }, // group cipher
+    { 0x00, 0x0F, 0xAC, 0x01 }, // WEP-40 or RSN
+    { 0x00, 0x0F, 0xAC, 0x02 }, // TKIP or RSN-PSK
+    { 0x00, 0x0F, 0xAC, 0x03 }, // Reserved
+    { 0x00, 0x0F, 0xAC, 0x04 }, // AES-CCMP
+    { 0x00, 0x0F, 0xAC, 0x05 }, // WEP-104
+#ifdef WLAN_FEATURE_11W
+    { 0x00, 0x0F, 0xAC, 0x06 },  // BIP(encryption type) or (RSN-PSK-SHA256(authentication type)
+#endif
+#ifdef FEATURE_WLAN_CCX
+    { 0x00, 0x40, 0x96, 0x00 } // CCKM
+#endif /* FEATURE_WLAN_CCX */
+    
+};
+
+#ifdef FEATURE_WLAN_WAPI
+tANI_U8 csrWapiOui[][ CSR_WAPI_OUI_SIZE ] = {
+    { 0x00, 0x14, 0x72, 0x00 }, // Reserved
+    { 0x00, 0x14, 0x72, 0x01 }, // WAI certificate or SMS4
+    { 0x00, 0x14, 0x72, 0x02 } // WAI PSK
+};
+#endif /* FEATURE_WLAN_WAPI */
+tANI_U8 csrWmeInfoOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
+tANI_U8 csrWmeParmOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
+
+static tCsrIELenInfo gCsrIELengthTable[] = {
+/* 000 */ { SIR_MAC_SSID_EID_MIN, SIR_MAC_SSID_EID_MAX },
+/* 001 */ { SIR_MAC_RATESET_EID_MIN, SIR_MAC_RATESET_EID_MAX },
+/* 002 */ { SIR_MAC_FH_PARAM_SET_EID_MIN, SIR_MAC_FH_PARAM_SET_EID_MAX },
+/* 003 */ { SIR_MAC_DS_PARAM_SET_EID_MIN, SIR_MAC_DS_PARAM_SET_EID_MAX },
+/* 004 */ { SIR_MAC_CF_PARAM_SET_EID_MIN, SIR_MAC_CF_PARAM_SET_EID_MAX },
+/* 005 */ { SIR_MAC_TIM_EID_MIN, SIR_MAC_TIM_EID_MAX },
+/* 006 */ { SIR_MAC_IBSS_PARAM_SET_EID_MIN, SIR_MAC_IBSS_PARAM_SET_EID_MAX },
+/* 007 */ { SIR_MAC_COUNTRY_EID_MIN, SIR_MAC_COUNTRY_EID_MAX },
+/* 008 */ { SIR_MAC_FH_PARAMS_EID_MIN, SIR_MAC_FH_PARAMS_EID_MAX },
+/* 009 */ { SIR_MAC_FH_PATTERN_EID_MIN, SIR_MAC_FH_PATTERN_EID_MAX },
+/* 010 */ { SIR_MAC_REQUEST_EID_MIN, SIR_MAC_REQUEST_EID_MAX },
+/* 011 */ { SIR_MAC_QBSS_LOAD_EID_MIN, SIR_MAC_QBSS_LOAD_EID_MAX },
+/* 012 */ { SIR_MAC_EDCA_PARAM_SET_EID_MIN, SIR_MAC_EDCA_PARAM_SET_EID_MAX },
+/* 013 */ { SIR_MAC_TSPEC_EID_MIN, SIR_MAC_TSPEC_EID_MAX },
+/* 014 */ { SIR_MAC_TCLAS_EID_MIN, SIR_MAC_TCLAS_EID_MAX },
+/* 015 */ { SIR_MAC_QOS_SCHEDULE_EID_MIN, SIR_MAC_QOS_SCHEDULE_EID_MAX },
+/* 016 */ { SIR_MAC_CHALLENGE_TEXT_EID_MIN, SIR_MAC_CHALLENGE_TEXT_EID_MAX },
+/* 017 */ { 0, 255 },
+/* 018 */ { 0, 255 },
+/* 019 */ { 0, 255 },
+/* 020 */ { 0, 255 },
+/* 021 */ { 0, 255 },
+/* 022 */ { 0, 255 },
+/* 023 */ { 0, 255 },
+/* 024 */ { 0, 255 },
+/* 025 */ { 0, 255 },
+/* 026 */ { 0, 255 },
+/* 027 */ { 0, 255 },
+/* 028 */ { 0, 255 },
+/* 029 */ { 0, 255 },
+/* 030 */ { 0, 255 },
+/* 031 */ { 0, 255 },
+/* 032 */ { SIR_MAC_PWR_CONSTRAINT_EID_MIN, SIR_MAC_PWR_CONSTRAINT_EID_MAX },
+/* 033 */ { SIR_MAC_PWR_CAPABILITY_EID_MIN, SIR_MAC_PWR_CAPABILITY_EID_MAX },
+/* 034 */ { SIR_MAC_TPC_REQ_EID_MIN, SIR_MAC_TPC_REQ_EID_MAX },
+/* 035 */ { SIR_MAC_TPC_RPT_EID_MIN, SIR_MAC_TPC_RPT_EID_MAX },
+/* 036 */ { SIR_MAC_SPRTD_CHNLS_EID_MIN, SIR_MAC_SPRTD_CHNLS_EID_MAX },
+/* 037 */ { SIR_MAC_CHNL_SWITCH_ANN_EID_MIN, SIR_MAC_CHNL_SWITCH_ANN_EID_MAX },
+/* 038 */ { SIR_MAC_MEAS_REQ_EID_MIN, SIR_MAC_MEAS_REQ_EID_MAX },
+/* 039 */ { SIR_MAC_MEAS_RPT_EID_MIN, SIR_MAC_MEAS_RPT_EID_MAX },
+/* 040 */ { SIR_MAC_QUIET_EID_MIN, SIR_MAC_QUIET_EID_MAX },
+/* 041 */ { SIR_MAC_IBSS_DFS_EID_MIN, SIR_MAC_IBSS_DFS_EID_MAX },
+/* 042 */ { SIR_MAC_ERP_INFO_EID_MIN, SIR_MAC_ERP_INFO_EID_MAX },
+/* 043 */ { SIR_MAC_TS_DELAY_EID_MIN, SIR_MAC_TS_DELAY_EID_MAX },
+/* 044 */ { SIR_MAC_TCLAS_PROC_EID_MIN, SIR_MAC_TCLAS_PROC_EID_MAX },
+/* 045 */ { SIR_MAC_QOS_ACTION_EID_MIN, SIR_MAC_QOS_ACTION_EID_MAX },
+/* 046 */ { SIR_MAC_QOS_CAPABILITY_EID_MIN, SIR_MAC_QOS_CAPABILITY_EID_MAX },
+/* 047 */ { 0, 255 },
+/* 048 */ { SIR_MAC_RSN_EID_MIN, SIR_MAC_RSN_EID_MAX },
+/* 049 */ { 0, 255 },
+/* 050 */ { SIR_MAC_EXTENDED_RATE_EID_MIN, SIR_MAC_EXTENDED_RATE_EID_MAX },
+/* 051 */ { 0, 255 },
+/* 052 */ { 0, 255 },
+/* 053 */ { 0, 255 },
+/* 054 */ { 0, 255 },
+/* 055 */ { 0, 255 },
+/* 056 */ { 0, 255 },
+/* 057 */ { 0, 255 },
+/* 058 */ { 0, 255 },
+/* 059 */ { 0, 255 },
+/* 060 */ { 0, 255 },
+/* 061 */ { 0, 255 },
+/* 062 */ { 0, 255 },
+/* 063 */ { 0, 255 },
+/* 064 */ { 0, 255 },
+/* 065 */ { 0, 255 },
+/* 066 */ { 0, 255 },
+/* 067 */ { 0, 255 },
+#ifdef FEATURE_WLAN_WAPI
+/* 068 */ { DOT11F_EID_WAPI, DOT11F_IE_WAPI_MAX_LEN },
+#else
+/* 068 */ { 0, 255 },
+#endif /* FEATURE_WLAN_WAPI */
+/* 069 */ { 0, 255 },
+/* 070 */ { 0, 255 },
+/* 071 */ { 0, 255 },
+/* 072 */ { 0, 255 },
+/* 073 */ { 0, 255 },
+/* 074 */ { 0, 255 },
+/* 075 */ { 0, 255 },
+/* 076 */ { 0, 255 },
+/* 077 */ { 0, 255 },
+/* 078 */ { 0, 255 },
+/* 079 */ { 0, 255 },
+/* 080 */ { 0, 255 },
+/* 081 */ { 0, 255 },
+/* 082 */ { 0, 255 },
+/* 083 */ { 0, 255 },
+/* 084 */ { 0, 255 },
+/* 085 */ { 0, 255 },
+/* 086 */ { 0, 255 },
+/* 087 */ { 0, 255 },
+/* 088 */ { 0, 255 },
+/* 089 */ { 0, 255 },
+/* 090 */ { 0, 255 },
+/* 091 */ { 0, 255 },
+/* 092 */ { 0, 255 },
+/* 093 */ { 0, 255 },
+/* 094 */ { 0, 255 },
+/* 095 */ { 0, 255 },
+/* 096 */ { 0, 255 },
+/* 097 */ { 0, 255 },
+/* 098 */ { 0, 255 },
+/* 099 */ { 0, 255 },
+/* 100 */ { 0, 255 },
+/* 101 */ { 0, 255 },
+/* 102 */ { 0, 255 },
+/* 103 */ { 0, 255 },
+/* 104 */ { 0, 255 },
+/* 105 */ { 0, 255 },
+/* 106 */ { 0, 255 },
+/* 107 */ { 0, 255 },
+/* 108 */ { 0, 255 },
+/* 109 */ { 0, 255 },
+/* 110 */ { 0, 255 },
+/* 111 */ { 0, 255 },
+/* 112 */ { 0, 255 },
+/* 113 */ { 0, 255 },
+/* 114 */ { 0, 255 },
+/* 115 */ { 0, 255 },
+/* 116 */ { 0, 255 },
+/* 117 */ { 0, 255 },
+/* 118 */ { 0, 255 },
+/* 119 */ { 0, 255 },
+/* 120 */ { 0, 255 },
+/* 121 */ { 0, 255 },
+/* 122 */ { 0, 255 },
+/* 123 */ { 0, 255 },
+/* 124 */ { 0, 255 },
+/* 125 */ { 0, 255 },
+/* 126 */ { 0, 255 },
+/* 127 */ { 0, 255 },
+/* 128 */ { 0, 255 },
+/* 129 */ { 0, 255 },
+/* 130 */ { 0, 255 },
+/* 131 */ { 0, 255 },
+/* 132 */ { 0, 255 },
+/* 133 */ { 0, 255 },
+/* 134 */ { 0, 255 },
+/* 135 */ { 0, 255 },
+/* 136 */ { 0, 255 },
+/* 137 */ { 0, 255 },
+/* 138 */ { 0, 255 },
+/* 139 */ { 0, 255 },
+/* 140 */ { 0, 255 },
+/* 141 */ { 0, 255 },
+/* 142 */ { 0, 255 },
+/* 143 */ { 0, 255 },
+/* 144 */ { 0, 255 },
+/* 145 */ { 0, 255 },
+/* 146 */ { 0, 255 },
+/* 147 */ { 0, 255 },
+/* 148 */ { 0, 255 },
+/* 149 */ { 0, 255 },
+/* 150 */ { 0, 255 },
+/* 151 */ { 0, 255 },
+/* 152 */ { 0, 255 },
+/* 153 */ { 0, 255 },
+/* 154 */ { 0, 255 },
+/* 155 */ { 0, 255 },
+/* 156 */ { 0, 255 },
+/* 157 */ { 0, 255 },
+/* 158 */ { 0, 255 },
+/* 159 */ { 0, 255 },
+/* 160 */ { 0, 255 },
+/* 161 */ { 0, 255 },
+/* 162 */ { 0, 255 },
+/* 163 */ { 0, 255 },
+/* 164 */ { 0, 255 },
+/* 165 */ { 0, 255 },
+/* 166 */ { 0, 255 },
+/* 167 */ { 0, 255 },
+/* 168 */ { 0, 255 },
+/* 169 */ { 0, 255 },
+/* 170 */ { 0, 255 },
+/* 171 */ { 0, 255 },
+/* 172 */ { 0, 255 },
+/* 173 */ { 0, 255 },
+/* 174 */ { 0, 255 },
+/* 175 */ { 0, 255 },
+/* 176 */ { 0, 255 },
+/* 177 */ { 0, 255 },
+/* 178 */ { 0, 255 },
+/* 179 */ { 0, 255 },
+/* 180 */ { 0, 255 },
+/* 181 */ { 0, 255 },
+/* 182 */ { 0, 255 },
+/* 183 */ { 0, 255 },
+/* 184 */ { 0, 255 },
+/* 185 */ { 0, 255 },
+/* 186 */ { 0, 255 },
+/* 187 */ { 0, 255 },
+/* 188 */ { 0, 255 },
+/* 189 */ { 0, 255 },
+/* 190 */ { 0, 255 },
+/* 191 */ { 0, 255 },
+/* 192 */ { 0, 255 },
+/* 193 */ { 0, 255 },
+/* 194 */ { 0, 255 },
+/* 195 */ { 0, 255 },
+/* 196 */ { 0, 255 },
+/* 197 */ { 0, 255 },
+/* 198 */ { 0, 255 },
+/* 199 */ { 0, 255 },
+/* 200 */ { 0, 255 },
+/* 201 */ { 0, 255 },
+/* 202 */ { 0, 255 },
+/* 203 */ { 0, 255 },
+/* 204 */ { 0, 255 },
+/* 205 */ { 0, 255 },
+/* 206 */ { 0, 255 },
+/* 207 */ { 0, 255 },
+/* 208 */ { 0, 255 },
+/* 209 */ { 0, 255 },
+/* 210 */ { 0, 255 },
+/* 211 */ { 0, 255 },
+/* 212 */ { 0, 255 },
+/* 213 */ { 0, 255 },
+/* 214 */ { 0, 255 },
+/* 215 */ { 0, 255 },
+/* 216 */ { 0, 255 },
+/* 217 */ { 0, 255 },
+/* 218 */ { 0, 255 },
+/* 219 */ { 0, 255 },
+/* 220 */ { 0, 255 },
+/* 221 */ { SIR_MAC_WPA_EID_MIN, SIR_MAC_WPA_EID_MAX },
+/* 222 */ { 0, 255 },
+/* 223 */ { 0, 255 },
+/* 224 */ { 0, 255 },
+/* 225 */ { 0, 255 },
+/* 226 */ { 0, 255 },
+/* 227 */ { 0, 255 },
+/* 228 */ { 0, 255 },
+/* 229 */ { 0, 255 },
+/* 230 */ { 0, 255 },
+/* 231 */ { 0, 255 },
+/* 232 */ { 0, 255 },
+/* 233 */ { 0, 255 },
+/* 234 */ { 0, 255 },
+/* 235 */ { 0, 255 },
+/* 236 */ { 0, 255 },
+/* 237 */ { 0, 255 },
+/* 238 */ { 0, 255 },
+/* 239 */ { 0, 255 },
+/* 240 */ { 0, 255 },
+/* 241 */ { 0, 255 },
+/* 242 */ { 0, 255 },
+/* 243 */ { 0, 255 },
+/* 244 */ { 0, 255 },
+/* 245 */ { 0, 255 },
+/* 246 */ { 0, 255 },
+/* 247 */ { 0, 255 },
+/* 248 */ { 0, 255 },
+/* 249 */ { 0, 255 },
+/* 250 */ { 0, 255 },
+/* 251 */ { 0, 255 },
+/* 252 */ { 0, 255 },
+/* 253 */ { 0, 255 },
+/* 254 */ { 0, 255 },
+/* 255 */ { SIR_MAC_ANI_WORKAROUND_EID_MIN, SIR_MAC_ANI_WORKAROUND_EID_MAX }
+};
+
+#if 0
+//Don't not insert entry into the table, put it to the end. If you have to insert, make sure it is also
+//reflected in eCsrCountryIndex
+static tCsrCountryInfo gCsrCountryInfo[eCSR_NUM_COUNTRY_INDEX] =
+{
+    {REG_DOMAIN_FCC, {'U', 'S', ' '}},       //USA/******The "US" MUST be at index 0*******/
+    {REG_DOMAIN_WORLD, {'A', 'D', ' '}},     //ANDORRA
+    {REG_DOMAIN_WORLD, {'A', 'E', ' '}},       //UAE
+    {REG_DOMAIN_WORLD, {'A', 'F', ' '}},     //AFGHANISTAN
+    {REG_DOMAIN_WORLD, {'A', 'G', ' '}},     //ANTIGUA AND BARBUDA
+    {REG_DOMAIN_WORLD, {'A', 'I', ' '}},     //ANGUILLA
+    {REG_DOMAIN_HI_5GHZ, {'A', 'L', ' '}},     //ALBANIA
+    {REG_DOMAIN_WORLD, {'A', 'M', ' '}},     //ARMENIA
+    {REG_DOMAIN_WORLD, {'A', 'N', ' '}},     //NETHERLANDS ANTILLES
+    {REG_DOMAIN_WORLD, {'A', 'O', ' '}},     //ANGOLA
+    {REG_DOMAIN_WORLD, {'A', 'Q', ' '}},     //ANTARCTICA
+    {REG_DOMAIN_HI_5GHZ, {'A', 'R', ' '}},    //ARGENTINA
+    {REG_DOMAIN_FCC, {'A', 'S', ' '}},     //AMERICAN SOMOA
+    {REG_DOMAIN_ETSI, {'A', 'T', ' '}},      //AUSTRIA
+    {REG_DOMAIN_ETSI, {'A', 'U', ' '}},      //AUSTRALIA
+    {REG_DOMAIN_WORLD, {'A', 'W', ' '}},     //ARUBA
+    {REG_DOMAIN_WORLD, {'A', 'X', ' '}},     //ALAND ISLANDS
+    {REG_DOMAIN_WORLD, {'A', 'Z', ' '}},     //AZERBAIJAN
+    {REG_DOMAIN_WORLD, {'B', 'A', ' '}},     //BOSNIA AND HERZEGOVINA
+    {REG_DOMAIN_WORLD, {'B', 'B', ' '}},     //BARBADOS
+    {REG_DOMAIN_WORLD, {'B', 'D', ' '}},     //BANGLADESH
+    {REG_DOMAIN_ETSI, {'B', 'E', ' '}},      //BELGIUM
+    {REG_DOMAIN_WORLD, {'B', 'F', ' '}},     //BURKINA FASO
+    {REG_DOMAIN_HI_5GHZ, {'B', 'G', ' '}},      //BULGARIA
+    {REG_DOMAIN_WORLD, {'B', 'H', ' '}},     //BAHRAIN
+    {REG_DOMAIN_WORLD, {'B', 'I', ' '}},     //BURUNDI
+    {REG_DOMAIN_WORLD, {'B', 'J', ' '}},     //BENIN
+    {REG_DOMAIN_WORLD, {'B', 'L', ' '}},     //SAINT BARTHELEMY
+    {REG_DOMAIN_ETSI, {'B', 'M', ' '}},     //BERMUDA
+    {REG_DOMAIN_WORLD, {'B', 'N', ' '}},     //BRUNEI DARUSSALAM
+    {REG_DOMAIN_WORLD, {'B', 'O', ' '}},     //BOLIVIA
+    {REG_DOMAIN_WORLD, {'B', 'R', ' '}},       //BRAZIL
+    {REG_DOMAIN_WORLD, {'B', 'S', ' '}},     //BAHAMAS
+    {REG_DOMAIN_WORLD, {'B', 'T', ' '}},     //BHUTAN
+    {REG_DOMAIN_WORLD, {'B', 'V', ' '}},     //BOUVET ISLAND
+    {REG_DOMAIN_WORLD, {'B', 'W', ' '}},     //BOTSWANA
+    {REG_DOMAIN_WORLD, {'B', 'Y', ' '}},     //BELARUS
+    {REG_DOMAIN_WORLD, {'B', 'Z', ' '}},     //BELIZE
+    {REG_DOMAIN_FCC, {'C', 'A', ' '}},       //CANADA
+    {REG_DOMAIN_WORLD, {'C', 'C', ' '}},     //COCOS (KEELING) ISLANDS
+    {REG_DOMAIN_WORLD, {'C', 'D', ' '}},     //CONGO, THE DEMOCRATIC REPUBLIC OF THE
+    {REG_DOMAIN_WORLD, {'C', 'F', ' '}},     //CENTRAL AFRICAN REPUBLIC
+    {REG_DOMAIN_WORLD, {'C', 'G', ' '}},     //CONGO
+    {REG_DOMAIN_ETSI, {'C', 'H', ' '}},      //SWITZERLAND
+    {REG_DOMAIN_WORLD, {'C', 'I', ' '}},     //COTE D'IVOIRE
+    {REG_DOMAIN_WORLD, {'C', 'K', ' '}},     //COOK ISLANDS
+    {REG_DOMAIN_WORLD, {'C', 'L', ' '}},       //CHILE
+    {REG_DOMAIN_WORLD, {'C', 'M', ' '}},     //CAMEROON
+    {REG_DOMAIN_HI_5GHZ, {'C', 'N', ' '}},   //CHINA
+    {REG_DOMAIN_WORLD, {'C', 'O', ' '}},       //COLOMBIA
+    {REG_DOMAIN_WORLD, {'C', 'R', ' '}},       //COSTA RICA
+    {REG_DOMAIN_WORLD, {'C', 'U', ' '}},     //CUBA  
+    {REG_DOMAIN_WORLD, {'C', 'V', ' '}},     //CAPE VERDE
+    {REG_DOMAIN_WORLD, {'C', 'X', ' '}},     //CHRISTMAS ISLAND
+    {REG_DOMAIN_WORLD, {'C', 'Y', ' '}},      //CYPRUS
+    {REG_DOMAIN_HI_5GHZ, {'C', 'Z', ' '}},      //CZECH REPUBLIC
+    {REG_DOMAIN_ETSI, {'D', 'E', ' '}},      //GERMANY
+    {REG_DOMAIN_WORLD, {'D', 'J', ' '}},     //DJIBOUTI
+    {REG_DOMAIN_ETSI, {'D', 'K', ' '}},      //DENMARK
+    {REG_DOMAIN_WORLD, {'D', 'M', ' '}},     //DOMINICA
+    {REG_DOMAIN_WORLD, {'D', 'O', ' '}},       //DOMINICAN REPUBLIC
+    {REG_DOMAIN_WORLD, {'D', 'Z', ' '}},     //ALGERIA
+    {REG_DOMAIN_WORLD, {'E', 'C', ' '}},       //ECUADOR
+    {REG_DOMAIN_HI_5GHZ, {'E', 'E', ' '}},      //ESTONIA
+    {REG_DOMAIN_WORLD, {'E', 'G', ' '}},     //EGYPT
+    {REG_DOMAIN_WORLD, {'E', 'H', ' '}},     //WESTERN SAHARA
+    {REG_DOMAIN_WORLD, {'E', 'R', ' '}},     //ERITREA
+    {REG_DOMAIN_ETSI, {'E', 'S', ' '}},      //SPAIN
+    {REG_DOMAIN_WORLD, {'E', 'T', ' '}},     //ETHIOPIA
+    {REG_DOMAIN_WORLD, {'F', 'I', ' '}},      //FINLAND
+    {REG_DOMAIN_WORLD, {'F', 'J', ' '}},     //FIJI
+    {REG_DOMAIN_WORLD, {'F', 'K', ' '}},     //FALKLAND ISLANDS (MALVINAS)
+    {REG_DOMAIN_WORLD, {'F', 'M', ' '}},     //MICRONESIA, FEDERATED STATES OF
+    {REG_DOMAIN_WORLD, {'F', 'O', ' '}},     //FAROE ISLANDS
+    {REG_DOMAIN_ETSI, {'F', 'R', ' '}},      //FRANCE
+    {REG_DOMAIN_WORLD, {'G', 'A', ' '}},     //GABON
+    {REG_DOMAIN_ETSI, {'G', 'B', ' '}},      //UNITED KINGDOM
+    {REG_DOMAIN_WORLD, {'G', 'D', ' '}},     //GRENADA
+    {REG_DOMAIN_HI_5GHZ, {'G', 'E', ' '}},     //GEORGIA
+    {REG_DOMAIN_WORLD, {'G', 'F', ' '}},     //FRENCH GUIANA
+    {REG_DOMAIN_ETSI, {'G', 'G', ' '}},      //GUERNSEY
+    {REG_DOMAIN_WORLD, {'G', 'H', ' '}},     //GHANA
+    {REG_DOMAIN_WORLD, {'G', 'I', ' '}},      //GIBRALTAR
+    {REG_DOMAIN_WORLD, {'G', 'L', ' '}},     //GREENLAND
+    {REG_DOMAIN_WORLD, {'G', 'M', ' '}},     //GAMBIA
+    {REG_DOMAIN_WORLD, {'G', 'N', ' '}},     //GUINEA
+    {REG_DOMAIN_WORLD, {'G', 'P', ' '}},     //GUADELOUPE
+    {REG_DOMAIN_WORLD, {'G', 'Q', ' '}},     //EQUATORIAL GUINEA
+    {REG_DOMAIN_ETSI, {'G', 'R', ' '}},      //GREECE
+    {REG_DOMAIN_WORLD, {'G', 'S', ' '}},     //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
+    {REG_DOMAIN_WORLD, {'G', 'T', ' '}},       //GUATEMALA
+    {REG_DOMAIN_WORLD, {'G', 'U', ' '}},     //GUAM
+    {REG_DOMAIN_WORLD, {'G', 'W', ' '}},     //GUINEA-BISSAU
+    {REG_DOMAIN_WORLD, {'G', 'Y', ' '}},     //GUYANA
+    {REG_DOMAIN_WORLD, {'H', 'K', ' '}},      //HONGKONG
+    {REG_DOMAIN_WORLD, {'H', 'M', ' '}},     //HEARD ISLAND AND MCDONALD ISLANDS
+    {REG_DOMAIN_WORLD, {'H', 'N', ' '}},       //HONDURAS
+    {REG_DOMAIN_HI_5GHZ, {'H', 'R', ' '}},      //CROATIA
+    {REG_DOMAIN_WORLD, {'H', 'T', ' '}},     //HAITI
+    {REG_DOMAIN_HI_5GHZ, {'H', 'U', ' '}},      //HUNGARY
+    {REG_DOMAIN_APAC, {'I', 'D', ' '}},     //INDONESIA
+    {REG_DOMAIN_ETSI, {'I', 'E', ' '}},     //IRELAND        
+    {REG_DOMAIN_WORLD, {'I', 'L', ' '}},        //ISREAL
+    {REG_DOMAIN_ETSI, {'I', 'M', ' '}},      //ISLE OF MAN
+    {REG_DOMAIN_WORLD, {'I', 'N', ' '}},      //INDIA
+    {REG_DOMAIN_ETSI, {'I', 'O', ' '}},     //BRITISH INDIAN OCEAN TERRITORY
+    {REG_DOMAIN_WORLD, {'I', 'Q', ' '}},     //IRAQ
+    {REG_DOMAIN_WORLD, {'I', 'R', ' '}},     //IRAN, ISLAMIC REPUBLIC OF
+    {REG_DOMAIN_WORLD, {'I', 'S', ' '}},      //ICELAND
+    {REG_DOMAIN_ETSI, {'I', 'T', ' '}},      //ITALY
+    {REG_DOMAIN_ETSI, {'J', 'E', ' '}},      //JERSEY
+    {REG_DOMAIN_WORLD, {'J', 'M', ' '}},     //JAMAICA
+    {REG_DOMAIN_WORLD, {'J', 'O', ' '}},     //JORDAN
+    {REG_DOMAIN_JAPAN, {'J', 'P', ' '}},     //JAPAN
+    {REG_DOMAIN_WORLD, {'K', 'E', ' '}},     //KENYA
+    {REG_DOMAIN_WORLD, {'K', 'G', ' '}},     //KYRGYZSTAN
+    {REG_DOMAIN_WORLD, {'K', 'H', ' '}},     //CAMBODIA
+    {REG_DOMAIN_WORLD, {'K', 'I', ' '}},     //KIRIBATI
+    {REG_DOMAIN_WORLD, {'K', 'M', ' '}},     //COMOROS
+    {REG_DOMAIN_WORLD, {'K', 'N', ' '}},     //SAINT KITTS AND NEVIS
+    {REG_DOMAIN_KOREA, {'K', 'P', ' '}},     //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
+    {REG_DOMAIN_KOREA, {'K', 'R', ' '}},     //KOREA, REPUBLIC OF 
+    {REG_DOMAIN_WORLD, {'K', 'W', ' '}},     //KUWAIT
+    {REG_DOMAIN_WORLD, {'K', 'Y', ' '}},     //CAYMAN ISLANDS
+    {REG_DOMAIN_WORLD, {'K', 'Z', ' '}},     //KAZAKHSTAN
+    {REG_DOMAIN_WORLD, {'L', 'A', ' '}},     //LAO PEOPLE'S DEMOCRATIC REPUBLIC
+    {REG_DOMAIN_WORLD, {'L', 'B', ' '}},     //LEBANON
+    {REG_DOMAIN_WORLD, {'L', 'C', ' '}},     //SAINT LUCIA
+    {REG_DOMAIN_ETSI, {'L', 'I', ' '}},      //LIECHTENSTEIN
+    {REG_DOMAIN_WORLD, {'L', 'K', ' '}},     //SRI LANKA
+    {REG_DOMAIN_WORLD, {'L', 'R', ' '}},     //LIBERIA
+    {REG_DOMAIN_WORLD, {'L', 'S', ' '}},     //LESOTHO
+    {REG_DOMAIN_HI_5GHZ, {'L', 'T', ' '}},      //LITHUANIA
+    {REG_DOMAIN_ETSI, {'L', 'U', ' '}},      //LUXEMBOURG
+    {REG_DOMAIN_HI_5GHZ, {'L', 'V', ' '}},      //LATVIA
+    {REG_DOMAIN_WORLD, {'L', 'Y', ' '}},     //LIBYAN ARAB JAMAHIRIYA
+    {REG_DOMAIN_WORLD, {'M', 'A', ' '}},     //MOROCCO
+    {REG_DOMAIN_ETSI, {'M', 'C', ' '}},      //MONACO
+    {REG_DOMAIN_WORLD, {'M', 'D', ' '}},     //MOLDOVA, REPUBLIC OF
+    {REG_DOMAIN_WORLD, {'M', 'E', ' '}},     //MONTENEGRO
+    {REG_DOMAIN_WORLD, {'M', 'G', ' '}},     //MADAGASCAR
+    {REG_DOMAIN_WORLD, {'M', 'H', ' '}},     //MARSHALL ISLANDS
+    {REG_DOMAIN_WORLD, {'M', 'K', ' '}},     //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
+    {REG_DOMAIN_WORLD, {'M', 'L', ' '}},     //MALI
+    {REG_DOMAIN_WORLD, {'M', 'M', ' '}},     //MYANMAR
+    {REG_DOMAIN_HI_5GHZ, {'M', 'N', ' '}},     //MONGOLIA
+    {REG_DOMAIN_WORLD, {'M', 'O', ' '}},     //MACAO
+    {REG_DOMAIN_WORLD, {'M', 'P', ' '}},     //NORTHERN MARIANA ISLANDS
+    {REG_DOMAIN_WORLD, {'M', 'Q', ' '}},     //MARTINIQUE
+    {REG_DOMAIN_WORLD, {'M', 'R', ' '}},     //MAURITANIA
+    {REG_DOMAIN_WORLD, {'M', 'S', ' '}},     //MONTSERRAT
+    {REG_DOMAIN_WORLD, {'M', 'T', ' '}},      //MALTA     
+    {REG_DOMAIN_WORLD, {'M', 'U', ' '}},     //MAURITIUS
+    {REG_DOMAIN_WORLD, {'M', 'V', ' '}},     //MALDIVES
+    {REG_DOMAIN_WORLD, {'M', 'W', ' '}},     //MALAWI
+    {REG_DOMAIN_WORLD, {'M', 'X', ' '}},       //MEXICO
+    {REG_DOMAIN_HI_5GHZ, {'M', 'Y', ' '}},       //MALAYSIA
+    {REG_DOMAIN_WORLD, {'M', 'Z', ' '}},     //MOZAMBIQUE
+    {REG_DOMAIN_WORLD, {'N', 'A', ' '}},     //NAMIBIA
+    {REG_DOMAIN_WORLD, {'N', 'C', ' '}},     //NEW CALEDONIA
+    {REG_DOMAIN_WORLD, {'N', 'E', ' '}},     //NIGER
+    {REG_DOMAIN_WORLD, {'N', 'F', ' '}},     //NORFOLD ISLAND
+    {REG_DOMAIN_WORLD, {'N', 'G', ' '}},     //NIGERIA
+    {REG_DOMAIN_WORLD, {'N', 'I', ' '}},       //NICARAGUA
+    {REG_DOMAIN_ETSI, {'N', 'L', ' '}},      //NETHERLANDS
+    {REG_DOMAIN_WORLD, {'N', 'O', ' '}},      //NORWAY
+    {REG_DOMAIN_WORLD, {'N', 'P', ' '}},     //NEPAL
+    {REG_DOMAIN_WORLD, {'N', 'R', ' '}},     //NAURU
+    {REG_DOMAIN_WORLD, {'N', 'U', ' '}},     //NIUE
+    {REG_DOMAIN_ETSI, {'N', 'Z', ' '}},      //NEW ZEALAND
+    {REG_DOMAIN_WORLD, {'O', 'M', ' '}},     //OMAN
+    {REG_DOMAIN_WORLD, {'P', 'A', ' '}},       //PANAMA
+    {REG_DOMAIN_WORLD, {'P', 'E', ' '}},       //PERU
+    {REG_DOMAIN_WORLD, {'P', 'F', ' '}},     //FRENCH POLYNESIA
+    {REG_DOMAIN_WORLD, {'P', 'G', ' '}},     //PAPUA NEW GUINEA
+    {REG_DOMAIN_WORLD, {'P', 'H', ' '}},      //PHILIPPINES
+    {REG_DOMAIN_WORLD, {'P', 'K', ' '}},     //PAKISTAN
+    {REG_DOMAIN_WORLD, {'P', 'L', ' '}},      //POLAND
+    {REG_DOMAIN_WORLD, {'P', 'M', ' '}},     //SAINT PIERRE AND MIQUELON
+    {REG_DOMAIN_WORLD, {'P', 'N', ' '}},     //PITCAIRN
+    {REG_DOMAIN_FCC, {'P', 'R', ' '}},       //PUERTO RICO
+    {REG_DOMAIN_WORLD, {'P', 'S', ' '}},        //PALESTINIAN TERRITORY, OCCUPIED
+    {REG_DOMAIN_ETSI, {'P', 'T', ' '}},      //PORTUGAL
+    {REG_DOMAIN_WORLD, {'P', 'W', ' '}},     //PALAU
+    {REG_DOMAIN_WORLD, {'P', 'Y', ' '}},     //PARAGUAY
+    {REG_DOMAIN_WORLD, {'Q', 'A', ' '}},     //QATAR
+    {REG_DOMAIN_WORLD, {'R', 'E', ' '}},     //REUNION
+    {REG_DOMAIN_HI_5GHZ, {'R', 'O', ' '}},      //ROMANIA
+    {REG_DOMAIN_HI_5GHZ, {'R', 'S', ' '}},      //SERBIA
+    {REG_DOMAIN_WORLD, {'R', 'U', ' '}},       //RUSSIA
+    {REG_DOMAIN_WORLD, {'R', 'W', ' '}},     //RWANDA
+    {REG_DOMAIN_WORLD, {'S', 'A', ' '}},      //SAUDI ARABIA
+    {REG_DOMAIN_WORLD, {'S', 'B', ' '}},     //SOLOMON ISLANDS
+    {REG_DOMAIN_ETSI, {'S', 'C', ' '}},      //SEYCHELLES
+    {REG_DOMAIN_WORLD, {'S', 'D', ' '}},     //SUDAN
+    {REG_DOMAIN_ETSI, {'S', 'E', ' '}},      //SWEDEN
+    {REG_DOMAIN_APAC, {'S', 'G', ' '}},      //SINGAPORE
+    {REG_DOMAIN_WORLD, {'S', 'H', ' '}},     //SAINT HELENA
+    {REG_DOMAIN_HI_5GHZ, {'S', 'I', ' '}},      //SLOVENNIA
+    {REG_DOMAIN_WORLD, {'S', 'J', ' '}},     //SVALBARD AND JAN MAYEN
+    {REG_DOMAIN_HI_5GHZ, {'S', 'K', ' '}},      //SLOVAKIA
+    {REG_DOMAIN_WORLD, {'S', 'L', ' '}},     //SIERRA LEONE      
+    {REG_DOMAIN_WORLD, {'S', 'M', ' '}},     //SAN MARINO
+    {REG_DOMAIN_WORLD, {'S', 'N', ' '}},     //SENEGAL
+    {REG_DOMAIN_WORLD, {'S', 'O', ' '}},     //SOMALIA
+    {REG_DOMAIN_WORLD, {'S', 'R', ' '}},     //SURINAME
+    {REG_DOMAIN_WORLD, {'S', 'T', ' '}},     //SAO TOME AND PRINCIPE
+    {REG_DOMAIN_WORLD, {'S', 'V', ' '}},       //EL SALVADOR
+    {REG_DOMAIN_WORLD, {'S', 'Y', ' '}},     //SYRIAN ARAB REPUBLIC
+    {REG_DOMAIN_WORLD, {'S', 'Z', ' '}},     //SWAZILAND
+    {REG_DOMAIN_WORLD, {'T', 'C', ' '}},     //TURKS AND CAICOS ISLANDS
+    {REG_DOMAIN_WORLD, {'T', 'D', ' '}},     //CHAD
+    {REG_DOMAIN_WORLD, {'T', 'F', ' '}},     //FRENCH SOUTHERN TERRITORIES
+    {REG_DOMAIN_WORLD, {'T', 'G', ' '}},     //TOGO
+    {REG_DOMAIN_WORLD, {'T', 'H', ' '}},       //THAILAND
+    {REG_DOMAIN_WORLD, {'T', 'J', ' '}},     //TAJIKISTAN
+    {REG_DOMAIN_WORLD, {'T', 'K', ' '}},     //TOKELAU
+    {REG_DOMAIN_WORLD, {'T', 'L', ' '}},     //TIMOR-LESTE
+    {REG_DOMAIN_WORLD, {'T', 'M', ' '}},     //TURKMENISTAN
+    {REG_DOMAIN_WORLD, {'T', 'N', ' '}},     //TUNISIA
+    {REG_DOMAIN_WORLD, {'T', 'O', ' '}},     //TONGA
+    {REG_DOMAIN_WORLD, {'T', 'R', ' '}},      //TURKEY
+    {REG_DOMAIN_WORLD, {'T', 'T', ' '}},     //TRINIDAD AND TOBAGO
+    {REG_DOMAIN_WORLD, {'T', 'V', ' '}},     //TUVALU
+    {REG_DOMAIN_HI_5GHZ, {'T', 'W', ' '}},       //TAIWAN, PROVINCE OF CHINA
+    {REG_DOMAIN_WORLD, {'T', 'Z', ' '}},     //TANZANIA, UNITED REPUBLIC OF
+    {REG_DOMAIN_HI_5GHZ, {'U', 'A', ' '}},       //UKRAINE
+    {REG_DOMAIN_WORLD, {'U', 'G', ' '}},     //UGANDA
+    {REG_DOMAIN_FCC, {'U', 'M', ' '}},       //UNITED STATES MINOR OUTLYING ISLANDS
+    {REG_DOMAIN_WORLD, {'U', 'Y', ' '}},       //URUGUAY
+    {REG_DOMAIN_HI_5GHZ, {'U', 'Z', ' '}},     //UZBEKISTAN
+    {REG_DOMAIN_ETSI, {'V', 'A', ' '}},      //HOLY SEE (VATICAN CITY STATE)
+    {REG_DOMAIN_WORLD, {'V', 'C', ' '}},     //SAINT VINCENT AND THE GRENADINES
+    {REG_DOMAIN_HI_5GHZ, {'V', 'E', ' '}},       //VENEZUELA
+    {REG_DOMAIN_ETSI, {'V', 'G', ' '}},       //VIRGIN ISLANDS, BRITISH
+    {REG_DOMAIN_FCC, {'V', 'I', ' '}},       //VIRGIN ISLANDS, US
+    {REG_DOMAIN_WORLD, {'V', 'N', ' '}},      //VIET NAM
+    {REG_DOMAIN_WORLD, {'V', 'U', ' '}},     //VANUATU
+    {REG_DOMAIN_WORLD, {'W', 'F', ' '}},     //WALLIS AND FUTUNA
+    {REG_DOMAIN_WORLD, {'W', 'S', ' '}},     //SOMOA
+    {REG_DOMAIN_WORLD, {'Y', 'E', ' '}},     //YEMEN
+    {REG_DOMAIN_WORLD, {'Y', 'T', ' '}},     //MAYOTTE
+    {REG_DOMAIN_WORLD, {'Z', 'A', ' '}},      //SOUTH AFRICA
+    {REG_DOMAIN_WORLD, {'Z', 'M', ' '}},     //ZAMBIA
+    {REG_DOMAIN_WORLD, {'Z', 'W', ' '}},     //ZIMBABWE
+
+    {REG_DOMAIN_KOREA, {'K', '1', ' '}},    //Korea alternate 1
+    {REG_DOMAIN_KOREA, {'K', '2', ' '}},    //Korea alternate 2
+    {REG_DOMAIN_KOREA, {'K', '3', ' '}},    //Korea alternate 3
+    {REG_DOMAIN_KOREA, {'K', '4', ' '}},    //Korea alternate 4
+};
+
+
+//The channels listed here doesn't mean they are valid channels for certain domain. They are here only to present
+//whether they should be passive scanned.
+tCsrDomainChnInfo gCsrDomainChnInfo[NUM_REG_DOMAINS] =
+{
+    //REG_DOMAIN_FCC
+    {
+        REG_DOMAIN_FCC,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_PASSIVE_SCAN},
+            {104, eSIR_PASSIVE_SCAN},
+            {108, eSIR_PASSIVE_SCAN},
+            {112, eSIR_PASSIVE_SCAN},
+            {116, eSIR_PASSIVE_SCAN},
+            {120, eSIR_PASSIVE_SCAN},
+            {124, eSIR_PASSIVE_SCAN},
+            {128, eSIR_PASSIVE_SCAN},
+            {132, eSIR_PASSIVE_SCAN},
+            {136, eSIR_PASSIVE_SCAN},
+            {140, eSIR_PASSIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_ETSI
+    {
+        REG_DOMAIN_ETSI,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_PASSIVE_SCAN},
+            {104, eSIR_PASSIVE_SCAN},
+            {108, eSIR_PASSIVE_SCAN},
+            {112, eSIR_PASSIVE_SCAN},
+            {116, eSIR_PASSIVE_SCAN},
+            {120, eSIR_PASSIVE_SCAN},
+            {124, eSIR_PASSIVE_SCAN},
+            {128, eSIR_PASSIVE_SCAN},
+            {132, eSIR_PASSIVE_SCAN},
+            {136, eSIR_PASSIVE_SCAN},
+            {140, eSIR_PASSIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_JAPAN
+    {
+        REG_DOMAIN_JAPAN,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_PASSIVE_SCAN},
+            {104, eSIR_PASSIVE_SCAN},
+            {108, eSIR_PASSIVE_SCAN},
+            {112, eSIR_PASSIVE_SCAN},
+            {116, eSIR_PASSIVE_SCAN},
+            {120, eSIR_PASSIVE_SCAN},
+            {124, eSIR_PASSIVE_SCAN},
+            {128, eSIR_PASSIVE_SCAN},
+            {132, eSIR_PASSIVE_SCAN},
+            {136, eSIR_PASSIVE_SCAN},
+            {140, eSIR_PASSIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_WORLD
+    {
+        REG_DOMAIN_WORLD,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_ACTIVE_SCAN},
+            {56, eSIR_ACTIVE_SCAN},
+            {60, eSIR_ACTIVE_SCAN},
+            {64, eSIR_ACTIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_ACTIVE_SCAN},
+            {104, eSIR_ACTIVE_SCAN},
+            {108, eSIR_ACTIVE_SCAN},
+            {112, eSIR_ACTIVE_SCAN},
+            {116, eSIR_ACTIVE_SCAN},
+            {120, eSIR_ACTIVE_SCAN},
+            {124, eSIR_ACTIVE_SCAN},
+            {128, eSIR_ACTIVE_SCAN},
+            {132, eSIR_ACTIVE_SCAN},
+            {136, eSIR_ACTIVE_SCAN},
+            {140, eSIR_ACTIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_N_AMER_EXC_FCC
+    {
+        REG_DOMAIN_N_AMER_EXC_FCC,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_ACTIVE_SCAN},
+            {104, eSIR_ACTIVE_SCAN},
+            {108, eSIR_ACTIVE_SCAN},
+            {112, eSIR_ACTIVE_SCAN},
+            {116, eSIR_ACTIVE_SCAN},
+            {120, eSIR_ACTIVE_SCAN},
+            {124, eSIR_ACTIVE_SCAN},
+            {128, eSIR_ACTIVE_SCAN},
+            {132, eSIR_ACTIVE_SCAN},
+            {136, eSIR_ACTIVE_SCAN},
+            {140, eSIR_ACTIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_APAC
+    {
+        REG_DOMAIN_APAC,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_ACTIVE_SCAN},
+            {104, eSIR_ACTIVE_SCAN},
+            {108, eSIR_ACTIVE_SCAN},
+            {112, eSIR_ACTIVE_SCAN},
+            {116, eSIR_ACTIVE_SCAN},
+            {120, eSIR_ACTIVE_SCAN},
+            {124, eSIR_ACTIVE_SCAN},
+            {128, eSIR_ACTIVE_SCAN},
+            {132, eSIR_ACTIVE_SCAN},
+            {136, eSIR_ACTIVE_SCAN},
+            {140, eSIR_ACTIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_KOREA
+    {
+        REG_DOMAIN_KOREA,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_PASSIVE_SCAN},
+            {56, eSIR_PASSIVE_SCAN},
+            {60, eSIR_PASSIVE_SCAN},
+            {64, eSIR_PASSIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_PASSIVE_SCAN},
+            {104, eSIR_PASSIVE_SCAN},
+            {108, eSIR_PASSIVE_SCAN},
+            {112, eSIR_PASSIVE_SCAN},
+            {116, eSIR_PASSIVE_SCAN},
+            {120, eSIR_PASSIVE_SCAN},
+            {124, eSIR_PASSIVE_SCAN},
+            {128, eSIR_PASSIVE_SCAN},
+            {132, eSIR_PASSIVE_SCAN},
+            {136, eSIR_PASSIVE_SCAN},
+            {140, eSIR_PASSIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_HI_5GHZ
+    {
+        REG_DOMAIN_HI_5GHZ,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_ACTIVE_SCAN},
+            {56, eSIR_ACTIVE_SCAN},
+            {60, eSIR_ACTIVE_SCAN},
+            {64, eSIR_ACTIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_ACTIVE_SCAN},
+            {104, eSIR_ACTIVE_SCAN},
+            {108, eSIR_ACTIVE_SCAN},
+            {112, eSIR_ACTIVE_SCAN},
+            {116, eSIR_ACTIVE_SCAN},
+            {120, eSIR_ACTIVE_SCAN},
+            {124, eSIR_ACTIVE_SCAN},
+            {128, eSIR_ACTIVE_SCAN},
+            {132, eSIR_ACTIVE_SCAN},
+            {136, eSIR_ACTIVE_SCAN},
+            {140, eSIR_ACTIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+    //REG_DOMAIN_NO_5GHZ
+    {
+        REG_DOMAIN_NO_5GHZ,
+        45, //Num channels
+        //Channels
+        {
+            //5GHz
+            //5180 - 5240
+            {36, eSIR_ACTIVE_SCAN},
+            {40, eSIR_ACTIVE_SCAN},
+            {44, eSIR_ACTIVE_SCAN},
+            {48, eSIR_ACTIVE_SCAN},
+            //5250 to 5350
+            {52, eSIR_ACTIVE_SCAN},
+            {56, eSIR_ACTIVE_SCAN},
+            {60, eSIR_ACTIVE_SCAN},
+            {64, eSIR_ACTIVE_SCAN},
+            //5470 to 5725
+            {100, eSIR_ACTIVE_SCAN},
+            {104, eSIR_ACTIVE_SCAN},
+            {108, eSIR_ACTIVE_SCAN},
+            {112, eSIR_ACTIVE_SCAN},
+            {116, eSIR_ACTIVE_SCAN},
+            {120, eSIR_ACTIVE_SCAN},
+            {124, eSIR_ACTIVE_SCAN},
+            {128, eSIR_ACTIVE_SCAN},
+            {132, eSIR_ACTIVE_SCAN},
+            {136, eSIR_ACTIVE_SCAN},
+            {140, eSIR_ACTIVE_SCAN},
+            //5745 - 5825
+            {149, eSIR_ACTIVE_SCAN},
+            {153, eSIR_ACTIVE_SCAN},
+            {157, eSIR_ACTIVE_SCAN},
+            {161, eSIR_ACTIVE_SCAN},
+            {165, eSIR_ACTIVE_SCAN},
+            //4.9GHz
+            //4920 - 5080
+            {240, eSIR_ACTIVE_SCAN},
+            {244, eSIR_ACTIVE_SCAN},
+            {248, eSIR_ACTIVE_SCAN},
+            {252, eSIR_ACTIVE_SCAN},
+            {208, eSIR_ACTIVE_SCAN},
+            {212, eSIR_ACTIVE_SCAN},
+            {216, eSIR_ACTIVE_SCAN},
+            //2,4GHz
+            {1, eSIR_ACTIVE_SCAN},
+            {2, eSIR_ACTIVE_SCAN},
+            {3, eSIR_ACTIVE_SCAN},
+            {4, eSIR_ACTIVE_SCAN},
+            {5, eSIR_ACTIVE_SCAN},
+            {6, eSIR_ACTIVE_SCAN},
+            {7, eSIR_ACTIVE_SCAN},
+            {8, eSIR_ACTIVE_SCAN},
+            {9, eSIR_ACTIVE_SCAN},
+            {10, eSIR_ACTIVE_SCAN},
+            {11, eSIR_ACTIVE_SCAN},
+            {12, eSIR_ACTIVE_SCAN},
+            {13, eSIR_ACTIVE_SCAN},
+            {14, eSIR_ACTIVE_SCAN},
+        }
+    },
+};
+#endif
+
+extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
+
+
+////////////////////////////////////////////////////////////////////////
+
+/**
+ * \var gPhyRatesSuppt
+ *
+ * \brief Rate support lookup table
+ *
+ *
+ * This is a  lookup table indexing rates &  configuration parameters to
+ * support.  Given a rate (in  unites of 0.5Mpbs) & three booleans (MIMO
+ * Enabled, Channel  Bonding Enabled, & Concatenation  Enabled), one can
+ * determine  whether  the given  rate  is  supported  by computing  two
+ * indices.  The  first maps  the rate to  table row as  indicated below
+ * (i.e. eHddSuppRate_6Mbps maps to  row zero, eHddSuppRate_9Mbps to row
+ * 1, and so on).  Index two can be computed like so:
+ *
+ * \code
+   idx2 = ( fEsf  ? 0x4 : 0x0 ) |
+          ( fCb   ? 0x2 : 0x0 ) |
+          ( fMimo ? 0x1 : 0x0 );
+ * \endcode
+ *
+ *
+ * Given that:
+ *
+ \code
+   fSupported = gPhyRatesSuppt[idx1][idx2];
+ \endcode
+ *
+ *
+ * This table is based on  the document "PHY Supported Rates.doc".  This
+ * table is  permissive in that a  rate is reflected  as being supported
+ * even  when turning  off an  enabled feature  would be  required.  For
+ * instance, "PHY Supported Rates"  lists 42Mpbs as unsupported when CB,
+ * ESF, &  MIMO are all  on.  However,  if we turn  off either of  CB or
+ * MIMO, it then becomes supported.   Therefore, we mark it as supported
+ * even in index 7 of this table.
+ *
+ *
+ */
+
+static const tANI_BOOLEAN gPhyRatesSuppt[24][8] = {
+
+    // SSF   SSF    SSF    SSF    ESF    ESF    ESF    ESF
+    // SIMO  MIMO   SIMO   MIMO   SIMO   MIMO   SIMO   MIMO
+    // No CB No CB  CB     CB     No CB  No CB  CB     CB
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 6Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 9Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 12Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 18Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, FALSE, TRUE,  TRUE  }, // 20Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 24Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 36Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 40Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 42Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 48Mbps
+    { TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE,  TRUE  }, // 54Mbps
+    { FALSE, TRUE,  TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 72Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 80Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 84Mbps
+    { FALSE, TRUE,  TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 96Mbps
+    { FALSE, TRUE,  TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 108Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 120Mbps
+    { FALSE, FALSE, TRUE,  TRUE,  FALSE, TRUE,  TRUE,  TRUE  }, // 126Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 144Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 160Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 168Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 192Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 216Mbps
+    { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, TRUE  }, // 240Mbps
+
+};
+
+#define CASE_RETURN_STR(n) case (n): return (#n)
+
+const char *
+get_eRoamCmdStatus_str(eRoamCmdStatus val)
+{
+    switch (val)
+    {
+        CASE_RETURN_STR(eCSR_ROAM_CANCELLED);
+        CASE_RETURN_STR(eCSR_ROAM_ROAMING_START);
+        CASE_RETURN_STR(eCSR_ROAM_ROAMING_COMPLETION);
+        CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_START);
+        CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_COMPLETION);
+        CASE_RETURN_STR(eCSR_ROAM_DISASSOCIATED);
+        CASE_RETURN_STR(eCSR_ROAM_SHOULD_ROAM);
+        CASE_RETURN_STR(eCSR_ROAM_SCAN_FOUND_NEW_BSS);
+        CASE_RETURN_STR(eCSR_ROAM_LOSTLINK);
+    default:
+        return "unknown";
+    }
+}
+
+const char *
+get_eCsrRoamResult_str(eCsrRoamResult val)
+{
+    switch (val)
+    {
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_NONE);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_FAILURE);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_ASSOCIATED);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_NOT_ASSOCIATED);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_FAILURE);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_FORCED);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_DISASSOC_IND);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_DEAUTH_IND);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_CAP_CHANGED);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_CONNECT);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_INACTIVE);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_NEW_PEER);
+        CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_COALESCED);
+    default:
+        return "unknown";
+    }
+}
+
+
+
+tANI_BOOLEAN csrGetBssIdBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tCsrBssid *pBssId )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    palCopyMemory( pMac->hHdd, pBssId, &pSirBssDesc->bssId[ 0 ], sizeof(tCsrBssid) );
+    return( TRUE );
+}
+
+
+tANI_BOOLEAN csrIsBssIdEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fEqual = FALSE;
+    tCsrBssid bssId1;
+    tCsrBssid bssId2;
+
+    do {
+        if ( !pSirBssDesc1 ) break;
+        if ( !pSirBssDesc2 ) break;
+
+        if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc1, &bssId1 ) ) break;
+        if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc2, &bssId2 ) ) break;
+
+        //sirCompareMacAddr
+        fEqual = csrIsMacAddressEqual(pMac, &bssId1, &bssId2);
+
+    } while( 0 );
+
+    return( fEqual );
+}
+
+tANI_BOOLEAN csrIsConnStateConnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
+}
+
+tANI_BOOLEAN csrIsConnStateDisconnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
+}
+
+tANI_BOOLEAN csrIsConnStateConnectedInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == pMac->roam.roamSession[sessionId].connectState );
+}
+
+tANI_BOOLEAN csrIsConnStateConnected( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    if( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateConnectedInfra( pMac, sessionId ) || csrIsConnStateConnectedWds( pMac, sessionId) )
+        return TRUE;
+    else
+        return FALSE;
+}
+
+tANI_BOOLEAN csrIsConnStateInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( csrIsConnStateConnectedInfra( pMac, sessionId ) );
+}
+
+tANI_BOOLEAN csrIsConnStateIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateDisconnectedIbss( pMac, sessionId ) );
+}
+
+
+tANI_BOOLEAN csrIsConnStateConnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+tANI_BOOLEAN csrIsConnStateConnectedInfraAp( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == pMac->roam.roamSession[sessionId].connectState) ||
+        (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState ) );
+}
+#endif
+
+tANI_BOOLEAN csrIsConnStateDisconnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
+}
+
+tANI_BOOLEAN csrIsConnStateWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return( csrIsConnStateConnectedWds( pMac, sessionId ) ||
+        csrIsConnStateDisconnectedWds( pMac, sessionId ) );
+}
+
+tANI_BOOLEAN csrIsAnySessionInConnectState( tpAniSirGlobal pMac )
+{
+    tANI_U32 i;
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && 
+            ( csrIsConnStateInfra( pMac, i ) || csrIsConnStateIbss( pMac, i ) ) )
+        {
+            fRc = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return ( fRc );
+}
+
+tANI_S8 csrGetInfraSessionId( tpAniSirGlobal pMac )
+{
+    tANI_U8 i;
+    tANI_S8 sessionid = -1;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateInfra( pMac, i )  )
+        {
+            sessionid = i;
+            break;
+        }
+    }
+
+    return ( sessionid );
+}
+
+tANI_U8 csrGetInfraOperationChannel( tpAniSirGlobal pMac, tANI_U8 sessionId)
+{
+    tANI_U8 channel;
+
+    if( CSR_IS_SESSION_VALID( pMac, sessionId ))
+    {
+        channel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
+    }
+    else
+    {
+        channel = 0;
+    }
+    return channel;
+}
+
+//This routine will return operating channel on FIRST BSS that is active/operating to be used for concurrency mode.
+//If other BSS is not up or not connected it will return 0 
+
+tANI_U8 csrGetConcurrentOperationChannel( tpAniSirGlobal pMac )
+{
+  tCsrRoamSession *pSession = NULL;
+  tANI_U8 i = 0;
+
+  for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+  {
+      if( CSR_IS_SESSION_VALID( pMac, i ) )
+      {
+          pSession = CSR_GET_SESSION( pMac, i );
+
+          if (NULL != pSession->pCurRoamProfile)
+          {
+              if (
+                      (((pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) ||
+                        (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE)) &&
+                       (pSession->connectState == eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)) 
+                      || 
+                      (((pSession->pCurRoamProfile->csrPersona == VOS_P2P_GO_MODE) ||
+                        (pSession->pCurRoamProfile->csrPersona == VOS_STA_SAP_MODE)) &&
+                       (pSession->connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
+                 )
+                  return (pSession->connectedProfile.operationChannel);
+          }
+
+      }
+  }
+  return 0;
+}
+
+tANI_BOOLEAN csrIsAllSessionDisconnected( tpAniSirGlobal pMac )
+{
+    tANI_U32 i;
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_TRUE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
+        {
+            fRc = eANI_BOOLEAN_FALSE;
+            break;
+        }
+    }
+
+    return ( fRc );
+}
+
+
+tANI_BOOLEAN csrIsInfraConnected( tpAniSirGlobal pMac )
+{
+    tANI_U32 i;
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
+        {
+            fRc = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return ( fRc );
+}
+
+tANI_BOOLEAN csrIsConcurrentInfraConnected( tpAniSirGlobal pMac )
+{
+    tANI_U32 i, noOfConnectedInfra = 0;
+
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
+        {
+            ++noOfConnectedInfra;
+        }
+    }
+
+    // More than one Infra Sta Connected
+    if(noOfConnectedInfra > 1)
+    {
+        fRc = eANI_BOOLEAN_TRUE;
+    }
+
+    return ( fRc );
+}
+
+tANI_BOOLEAN csrIsIBSSStarted( tpAniSirGlobal pMac )
+{
+    tANI_U32 i;
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateIbss( pMac, i ) )
+        {
+            fRc = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return ( fRc );
+}
+
+
+tANI_BOOLEAN csrIsBTAMPStarted( tpAniSirGlobal pMac )
+{
+    tANI_U32 i;
+    tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
+
+    for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedWds( pMac, i ) )
+        {
+            fRc = eANI_BOOLEAN_TRUE;
+            break;
+        }
+    }
+
+    return ( fRc );
+}
+
+tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId )
+{
+    return ( csrIsConnStateConnectedWds( pMac, sessionId ) );
+}
+
+
+tANI_BOOLEAN csrIsConnStateDisconnected(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    return (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == pMac->roam.roamSession[sessionId].connectState);
+}
+
+tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tCsrRoamSession *pSession = NULL;
+    tANI_U8 Index = 0, ConnId = 0;
+    tVOS_CON_MODE Mode[CSR_ROAM_SESSION_MAX];
+
+    //Check for MCC support
+    if (!pMac->roam.configParam.fenableMCCMode)
+    {
+        return eANI_BOOLEAN_FALSE;
+    }
+
+    for( Index = 0; Index < CSR_ROAM_SESSION_MAX; Index++ ) 
+        Mode[Index] = VOS_MAX_NO_OF_MODE;
+ 
+    for( Index = 0; Index < CSR_ROAM_SESSION_MAX; Index++ )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, Index ) )
+        {
+            pSession = CSR_GET_SESSION( pMac, Index );
+
+            if (NULL != pSession->pCurRoamProfile)
+            {
+                Mode[ConnId] = pSession->pCurRoamProfile->csrPersona;
+                ConnId++;
+             }
+         }
+    }
+
+    Index  = 0;
+    if (Mode[Index] == VOS_STA_MODE && ConnId > Index)
+    {
+        switch (Mode[Index+1])
+        {
+            case VOS_P2P_CLIENT_MODE :
+              return eANI_BOOLEAN_TRUE;
+            case VOS_MAX_NO_OF_MODE :
+            default :
+                 break;
+        }
+    }
+    else if (Mode[Index] == VOS_P2P_CLIENT_MODE && ConnId > Index)
+    {
+        switch (Mode[Index +1])
+        {
+            case VOS_STA_MODE :
+                return eANI_BOOLEAN_TRUE;
+            case VOS_MAX_NO_OF_MODE :
+            default :
+                break;
+         }
+    }
+
+    return eANI_BOOLEAN_FALSE;
+}
+
+static tSirMacCapabilityInfo csrGetBssCapabilities( tSirBssDescription *pSirBssDesc )
+{
+    tSirMacCapabilityInfo dot11Caps;
+
+    //tSirMacCapabilityInfo is 16-bit
+    pal_get_U16( (tANI_U8 *)&pSirBssDesc->capabilityInfo, (tANI_U16 *)&dot11Caps );
+
+    return( dot11Caps );
+}
+
+tANI_BOOLEAN csrIsInfraBssDesc( tSirBssDescription *pSirBssDesc )
+{
+    tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
+
+    return( (tANI_BOOLEAN)dot11Caps.ess );
+}
+
+
+tANI_BOOLEAN csrIsIbssBssDesc( tSirBssDescription *pSirBssDesc )
+{
+    tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
+
+    return( (tANI_BOOLEAN)dot11Caps.ibss );
+}
+
+tANI_BOOLEAN csrIsQoSBssDesc( tSirBssDescription *pSirBssDesc )
+{
+    tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
+
+    return( (tANI_BOOLEAN)dot11Caps.qos );
+}
+
+tANI_BOOLEAN csrIsPrivacy( tSirBssDescription *pSirBssDesc )
+{
+    tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
+
+    return( (tANI_BOOLEAN)dot11Caps.privacy );
+}
+
+
+tANI_BOOLEAN csrIs11dSupported(tpAniSirGlobal pMac)
+{
+    return(pMac->roam.configParam.Is11dSupportEnabled);
+}
+
+
+tANI_BOOLEAN csrIs11hSupported(tpAniSirGlobal pMac)
+{
+    return(pMac->roam.configParam.Is11hSupportEnabled);
+}
+
+
+tANI_BOOLEAN csrIs11eSupported(tpAniSirGlobal pMac)
+{
+    return(pMac->roam.configParam.Is11eSupportEnabled);
+}
+
+tANI_BOOLEAN csrIsMCCSupported ( tpAniSirGlobal pMac )
+{
+   return(pMac->roam.configParam.fenableMCCMode);
+
+}
+
+tANI_BOOLEAN csrIsWmmSupported(tpAniSirGlobal pMac)
+{
+    if(eCsrRoamWmmNoQos == pMac->roam.configParam.WMMSupportMode)
+    {
+       return eANI_BOOLEAN_FALSE;
+    }
+    else
+    {
+       return eANI_BOOLEAN_TRUE;
+    }
+}
+
+
+
+
+//pIes is the IEs for pSirBssDesc2
+tANI_BOOLEAN csrIsSsidEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, 
+                             tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 )
+{
+    tANI_BOOLEAN fEqual = FALSE;
+    tSirMacSSid Ssid1, Ssid2;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tDot11fBeaconIEs *pIes1 = NULL;
+    tDot11fBeaconIEs *pIesLocal = pIes2;
+
+    do {
+        if( ( NULL == pSirBssDesc1 ) || ( NULL == pSirBssDesc2 ) ) break;
+        if( !pIesLocal && !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc2, &pIesLocal)) )
+        {
+            smsLog(pMac, LOGE, FL("  fail to parse IEs\n"));
+            break;
+        }
+        if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc1, &pIes1)))
+        {
+            break;
+        }
+        if( ( !pIes1->SSID.present ) || ( !pIesLocal->SSID.present ) ) break;
+        if ( pIes1->SSID.num_ssid != pIesLocal->SSID.num_ssid ) break;
+        palCopyMemory(pMac->hHdd, Ssid1.ssId, pIes1->SSID.ssid, pIes1->SSID.num_ssid);
+        palCopyMemory(pMac->hHdd, Ssid2.ssId, pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid);
+
+        fEqual = palEqualMemory(pMac->hHdd, Ssid1.ssId, Ssid2.ssId, pIesLocal->SSID.num_ssid );
+
+    } while( 0 );
+    if(pIes1)
+    {
+        palFreeMemory(pMac->hHdd, pIes1);
+    }
+    if( pIesLocal && !pIes2 )
+    {
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( fEqual );
+}
+
+tANI_BOOLEAN csrIsAniWmeSupported(tDot11fIEAirgo *pIeAirgo)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+
+    if(pIeAirgo && pIeAirgo->present && pIeAirgo->PropCapability.present)
+    {
+        fRet = (tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability ));
+    }
+
+    return fRet;
+}
+
+
+
+
+//pIes can be passed in as NULL if the caller doesn't have one prepared
+tANI_BOOLEAN csrIsBssDescriptionWme( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    // Assume that WME is found...
+    tANI_BOOLEAN fWme = TRUE;
+    tDot11fBeaconIEs *pIesTemp = pIes;
+
+    do
+    {
+        if(pIesTemp == NULL)
+        {
+            if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp)) )
+            {
+                fWme = FALSE;
+                break;
+            }
+        }
+        // if the AirgoProprietary indicator is found, then WME is supported...
+        if ( csrIsAniWmeSupported(&pIesTemp->Airgo) ) break;
+        // if the Wme Info IE is found, then WME is supported...
+        if ( CSR_IS_QOS_BSS(pIesTemp) ) break;
+        // if none of these are found, then WME is NOT supported...
+        fWme = FALSE;
+    } while( 0 );
+    if( !csrIsWmmSupported( pMac ) && fWme)
+    {
+        if( !pIesTemp->HTCaps.present )
+        {
+            fWme = FALSE;
+        }
+    }
+    if( ( pIes == NULL ) && ( NULL != pIesTemp ) )
+    {
+        //we allocate memory here so free it before returning
+        palFreeMemory(pMac->hHdd, pIesTemp);
+    }
+
+    return( fWme );
+}
+
+tANI_BOOLEAN csrIsHcfEnabled( tDot11fIEAirgo *pIeAirgo )
+{
+    tANI_BOOLEAN fHcfSupported = FALSE;
+
+    fHcfSupported = ((tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability )) ||
+        (pIeAirgo->present && pIeAirgo->HCF.present && pIeAirgo->HCF.enabled));
+
+    return( fHcfSupported );
+}
+
+
+eCsrMediaAccessType csrGetQoSFromBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, 
+                                          tDot11fBeaconIEs *pIes )
+{
+    eCsrMediaAccessType qosType = eCSR_MEDIUM_ACCESS_DCF;
+
+#if defined(VOSS_ENABLED)
+    VOS_ASSERT( pIes != NULL );
+#endif
+
+    do
+   {
+        // if we find WMM in the Bss Description, then we let this
+        // override and use WMM.
+        if ( csrIsBssDescriptionWme( hHal, pSirBssDesc, pIes ) )
+        {
+            qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP;
+        }
+        else
+        {
+            // if the QoS bit is on, then the AP is advertising 11E QoS...
+            if ( csrIsQoSBssDesc( pSirBssDesc ) )
+            {
+                // which could be HCF or eDCF.
+                    if ( csrIsHcfEnabled( &pIes->Airgo ) )
+                {
+                    qosType = eCSR_MEDIUM_ACCESS_11e_HCF;
+                }
+                else
+                {
+                    qosType = eCSR_MEDIUM_ACCESS_11e_eDCF;
+                }
+            }
+            else
+            {
+                qosType = eCSR_MEDIUM_ACCESS_DCF;
+            }
+            // scale back based on the types turned on for the adapter...
+            if ( eCSR_MEDIUM_ACCESS_11e_eDCF == qosType && !csrIs11eSupported( hHal ) )
+            {
+                qosType = eCSR_MEDIUM_ACCESS_DCF;
+            }
+        }
+
+    } while(0);
+
+    return( qosType );
+}
+
+
+
+
+//Caller allocates memory for pIEStruct
+eHalStatus csrParseBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIEStruct)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    int ieLen = (int)(pBssDesc->length + sizeof( pBssDesc->length ) - GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
+
+    if(ieLen > 0 && pIEStruct)
+    {
+        if(!DOT11F_FAILED(dot11fUnpackBeaconIEs( pMac, (tANI_U8 *)pBssDesc->ieFields, ieLen, pIEStruct )))
+        {
+            status = eHAL_STATUS_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+
+//This function will allocate memory for the parsed IEs to the caller. Caller must free the memory
+//after it is done with the data only if this function succeeds
+eHalStatus csrGetParsedBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs **ppIEStruct)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if(pBssDesc && ppIEStruct)
+    {
+        status = palAllocateMemory(pMac->hHdd, (void **)ppIEStruct, sizeof(tDot11fBeaconIEs));
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, (void *)*ppIEStruct, sizeof(tDot11fBeaconIEs));
+            status = csrParseBssDescriptionIEs(hHal, pBssDesc, *ppIEStruct);
+            if(!HAL_STATUS_SUCCESS(status))
+            {
+                palFreeMemory(pMac->hHdd, *ppIEStruct);
+                *ppIEStruct = NULL;
+            }
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" failed to allocate memory\n") );
+            VOS_ASSERT( 0 );
+    }
+    }
+
+    return (status);
+}
+
+
+
+
+tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len )
+{
+    tANI_BOOLEAN fNullSsid = FALSE;
+
+    tANI_U32 SsidLength;
+    tANI_U8 *pSsidStr;
+
+    do
+    {
+        if ( 0 == len )
+        {
+            fNullSsid = TRUE;
+            break;
+        }
+
+        //Consider 0 or space for hidden SSID
+        if ( 0 == pBssSsid[0] )
+        {
+             fNullSsid = TRUE;
+             break;
+        }
+
+        SsidLength = len;
+        pSsidStr = pBssSsid;
+
+        while ( SsidLength )
+        {
+            if( *pSsidStr )
+                break;
+
+            pSsidStr++;
+            SsidLength--;
+        }
+
+        if( 0 == SsidLength )
+        {
+            fNullSsid = TRUE;
+            break;
+        }
+    }
+    while( 0 );
+
+    return fNullSsid;
+}
+
+
+tANI_U32 csrGetFragThresh( tHalHandle hHal )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return pMac->roam.configParam.FragmentationThreshold;
+}
+
+tANI_U32 csrGetRTSThresh( tHalHandle hHal )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return pMac->roam.configParam.RTSThreshold;
+}
+
+eCsrPhyMode csrTranslateToPhyModeFromBssDesc( tSirBssDescription *pSirBssDesc )
+{
+    eCsrPhyMode phyMode;
+
+    switch ( pSirBssDesc->nwType )
+    {
+        case eSIR_11A_NW_TYPE:
+            phyMode = eCSR_DOT11_MODE_11a;
+            break;
+
+        case eSIR_11B_NW_TYPE:
+            phyMode = eCSR_DOT11_MODE_11b;
+            break;
+
+        case eSIR_11G_NW_TYPE:
+            phyMode = eCSR_DOT11_MODE_11g;
+            break;
+
+        case eSIR_11N_NW_TYPE:
+        default:
+            phyMode = eCSR_DOT11_MODE_11n;
+            break;
+    }
+
+    return( phyMode );
+}
+
+
+tANI_U32 csrTranslateToWNICfgDot11Mode(tpAniSirGlobal pMac, eCsrCfgDot11Mode csrDot11Mode)
+{
+    tANI_U32 ret;
+
+    switch(csrDot11Mode)
+    {
+    case eCSR_CFG_DOT11_MODE_AUTO:
+        smsLog(pMac, LOGW, FL("  Warning: sees eCSR_CFG_DOT11_MODE_AUTO \n"));
+        //We cannot decide until now.
+        if(pMac->roam.configParam.ProprietaryRatesEnabled)
+        {
+            ret = WNI_CFG_DOT11_MODE_TAURUS;
+        }
+        else
+        {
+            ret = WNI_CFG_DOT11_MODE_11N;
+        }
+        break;
+    case eCSR_CFG_DOT11_MODE_TAURUS:
+        ret = WNI_CFG_DOT11_MODE_TAURUS;
+        break;
+    case eCSR_CFG_DOT11_MODE_11A:
+        ret = WNI_CFG_DOT11_MODE_11A;
+        break;
+    case eCSR_CFG_DOT11_MODE_11B:
+        ret = WNI_CFG_DOT11_MODE_11B;
+        break;
+    case eCSR_CFG_DOT11_MODE_11G:
+        ret = WNI_CFG_DOT11_MODE_11G;
+        break;
+    case eCSR_CFG_DOT11_MODE_11N:
+        ret = WNI_CFG_DOT11_MODE_11N;
+        break;
+    case eCSR_CFG_DOT11_MODE_POLARIS:
+        ret = WNI_CFG_DOT11_MODE_POLARIS;
+        break;
+    case eCSR_CFG_DOT11_MODE_TITAN:
+        ret = WNI_CFG_DOT11_MODE_TITAN;
+        break;
+#ifdef WLAN_SOFTAP_FEATURE
+    case eCSR_CFG_DOT11_MODE_11G_ONLY:
+       ret = WNI_CFG_DOT11_MODE_11G_ONLY;
+       break;
+    case eCSR_CFG_DOT11_MODE_11N_ONLY:
+       ret = WNI_CFG_DOT11_MODE_11N_ONLY;
+       break;
+#endif
+    default:
+        smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode\n"), csrDot11Mode);
+        if(eCSR_BAND_24 == pMac->roam.configParam.eBand)
+        {
+            ret = WNI_CFG_DOT11_MODE_11G;
+        }
+        else
+        {
+            ret = WNI_CFG_DOT11_MODE_11A;
+        }
+        break;
+    }
+
+    return (ret);
+}
+
+
+//This function should only return the super set of supported modes. 11n implies 11b/g/a/n.
+eHalStatus csrGetPhyModeFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription, 
+                                eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    eCsrPhyMode phyMode = csrTranslateToPhyModeFromBssDesc(pBSSDescription);
+
+    if( pIes )
+    {
+        if(pIes->Airgo.present)
+        {
+            if(pIes->Airgo.PropCapability.present)
+            {
+                if( PROP_CAPABILITY_GET( TAURUS, pIes->Airgo.PropCapability.capability ))
+                {
+                    phyMode = eCSR_DOT11_MODE_TAURUS;
+                }
+                }
+                }
+        if(pIes->HTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
+        {
+            phyMode = eCSR_DOT11_MODE_11n;
+        }
+        *pPhyMode = phyMode;
+    }
+
+    return (status);
+
+}
+
+
+//This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes matches
+//bssPhyMode is the mode derived from the BSS description
+//f5GhzBand is derived from the channel id of BSS description
+tANI_BOOLEAN csrGetPhyModeInUse( eCsrPhyMode phyModeIn, eCsrPhyMode bssPhyMode, tANI_BOOLEAN f5GhzBand,
+                                 eCsrCfgDot11Mode *pCfgDot11ModeToUse )
+{
+    tANI_BOOLEAN fMatch = FALSE;
+    eCsrCfgDot11Mode cfgDot11Mode;
+
+    cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; // to suppress compiler warning
+
+    switch( phyModeIn )
+    {
+        case eCSR_DOT11_MODE_abg:   //11a or 11b or 11g
+            if( f5GhzBand )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+            }
+            else if( eCSR_DOT11_MODE_11b == bssPhyMode )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+            }
+            else
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11a:   //11a
+            if( f5GhzBand )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11a_ONLY:   //11a
+            if( eCSR_DOT11_MODE_11a == bssPhyMode )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11g:
+            if(!f5GhzBand)
+            {
+                if( eCSR_DOT11_MODE_11b == bssPhyMode )
+                {
+                    fMatch = TRUE;
+                    cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                }
+                else
+                {
+                    fMatch = TRUE;
+                    cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+                }
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11g_ONLY:
+            if( eCSR_DOT11_MODE_11g == bssPhyMode )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11b:
+            if( !f5GhzBand )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11b_ONLY:
+            if( eCSR_DOT11_MODE_11b == bssPhyMode )
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11n:
+            fMatch = TRUE;
+            switch(bssPhyMode)
+            {
+            case eCSR_DOT11_MODE_11g:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+                break;
+            case eCSR_DOT11_MODE_11b:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                break;
+            case eCSR_DOT11_MODE_11a:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+                break;
+            case eCSR_DOT11_MODE_11n:
+            case eCSR_DOT11_MODE_TAURUS:
+            default:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+                break;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_11n_ONLY:
+            if((eCSR_DOT11_MODE_11n == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
+            {
+                fMatch = TRUE;
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+            }
+            break;
+
+        case eCSR_DOT11_MODE_TAURUS:
+        default:
+            fMatch = TRUE;
+            switch(bssPhyMode)
+            {
+            case eCSR_DOT11_MODE_11g:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+                break;
+            case eCSR_DOT11_MODE_11b:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+                break;
+            case eCSR_DOT11_MODE_11a:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+                break;
+            case eCSR_DOT11_MODE_11n:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+                break;
+            case eCSR_DOT11_MODE_TAURUS:
+            default:
+                cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
+                break;
+            }
+            break;
+
+    }
+
+    if ( fMatch && pCfgDot11ModeToUse )
+    {
+        *pCfgDot11ModeToUse = cfgDot11Mode;
+    }
+
+    return( fMatch );
+}
+
+
+//This function decides whether the one of the bit of phyMode is matching the mode in the BSS and allowed by the user
+//setting, pMac->roam.configParam.uCfgDot11Mode. It returns the mode that fits the criteria.
+tANI_BOOLEAN csrIsPhyModeMatch( tpAniSirGlobal pMac, tANI_U32 phyMode,
+                                tSirBssDescription *pSirBssDesc, tCsrRoamProfile *pProfile,
+                                eCsrCfgDot11Mode *pReturnCfgDot11Mode,
+                                tDot11fBeaconIEs *pIes)
+{
+    tANI_BOOLEAN fMatch = FALSE;
+    eCsrPhyMode phyModeInBssDesc, phyMode2;
+    eCsrCfgDot11Mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_TAURUS;
+    tANI_U32 bitMask, loopCount;
+
+    if(HAL_STATUS_SUCCESS(csrGetPhyModeFromBss(pMac, pSirBssDesc, &phyModeInBssDesc, pIes )))
+    {
+        //In case some change change eCSR_DOT11_MODE_TAURUS to non-0
+        if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
+        {
+            //Taurus means anything
+            if ( eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode )
+            {
+                phyMode = eCSR_DOT11_MODE_abg;
+            }
+            else if(eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode)
+            {
+                if(pMac->roam.configParam.ProprietaryRatesEnabled)
+                {
+                    phyMode = eCSR_DOT11_MODE_TAURUS;
+                }
+                else
+                {
+                    phyMode = eCSR_DOT11_MODE_11n;
+                }
+            }
+            else
+            {
+                //user's pick
+                phyMode = pMac->roam.configParam.phyMode;
+            }
+        }
+        if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode) )
+        {
+            if(0 != phyMode)
+            {
+                if(eCSR_DOT11_MODE_AUTO & phyMode)
+                {
+                    phyMode2 = eCSR_DOT11_MODE_AUTO & phyMode;
+                }
+                else
+                {
+                    phyMode2 = eCSR_DOT11_MODE_TAURUS & phyMode;
+                }
+            }
+            else
+            {
+                phyMode2 = phyMode;
+            }
+            fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
+                                                &cfgDot11ModeToUse );
+        }
+        else
+        {
+            bitMask = 1;
+            loopCount = 0;
+            while(loopCount < eCSR_NUM_PHY_MODE)   
+            {
+                if(0 != ( phyMode2 = (phyMode & (bitMask << loopCount++)) ))
+                {
+                    fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
+                                        &cfgDot11ModeToUse );
+                    if(fMatch) break;
+                }
+            }
+        }
+        if ( fMatch && pReturnCfgDot11Mode )
+        {
+            if( pProfile )
+            {
+                /* IEEE 11n spec (8.4.3): HT STA shall eliminate TKIP as a 
+                 * choice for the pairwise cipher suite if CCMP is advertised 
+                 * by the AP or if the AP included an HT capabilities element 
+                 * in its Beacons and Probe Response.
+                 */
+                if( (!CSR_IS_11n_ALLOWED( pProfile->negotiatedUCEncryptionType )) &&
+                    ((eCSR_CFG_DOT11_MODE_11N == cfgDot11ModeToUse) ||
+                     (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11ModeToUse)) )
+                {
+                    //We cannot do 11n here
+                    if( !CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId) )
+                    {
+                        cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
+                    }
+                    else
+                    {
+                        cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
+                    }
+                }
+            }
+            *pReturnCfgDot11Mode = cfgDot11ModeToUse;
+        }
+    }
+
+    return( fMatch );
+}
+
+
+eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode )
+{
+    eCsrCfgDot11Mode cfgDot11ModeToUse;
+    eCsrBand eBand = pMac->roam.configParam.eBand;
+
+    if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
+    {
+        cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
+    }
+    else
+    {
+        if( ( eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY ) & phyMode )
+        {
+            cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
+        }
+        else if ( eCSR_DOT11_MODE_abg & phyMode )
+        {
+            if( eCSR_BAND_24 != eBand )
+            {
+                cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
+            }
+            else
+            {
+                cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
+            }
+        }
+        else if( ( eCSR_DOT11_MODE_11a | eCSR_DOT11_MODE_11a_ONLY ) & phyMode )
+        {
+            cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
+        }
+        else if( ( eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY ) & phyMode )
+        {
+            cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
+        }
+        else
+        {
+            cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B;
+        }
+    }
+
+    return ( cfgDot11ModeToUse );
+}
+
+
+
+
+tANI_U32 csrGet11hPowerConstraint( tHalHandle hHal, tDot11fIEPowerConstraints *pPowerConstraint )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U32 localPowerConstraint = 0;
+
+    // check if .11h support is enabled, if not, the power constraint is 0.
+    if(pMac->roam.configParam.Is11hSupportEnabled && pPowerConstraint->present)
+    {
+        localPowerConstraint = pPowerConstraint->localPowerConstraints;
+    }
+
+    return( localPowerConstraint );
+}
+
+
+tANI_BOOLEAN csrIsProfileWpa( tCsrRoamProfile *pProfile )
+{
+    tANI_BOOLEAN fWpaProfile = FALSE;
+
+    switch ( pProfile->negotiatedAuthType )
+    {
+        case eCSR_AUTH_TYPE_WPA:
+        case eCSR_AUTH_TYPE_WPA_PSK:
+        case eCSR_AUTH_TYPE_WPA_NONE:
+#ifdef FEATURE_WLAN_CCX
+        case eCSR_AUTH_TYPE_CCKM_WPA:
+#endif
+            fWpaProfile = TRUE;
+            break;
+
+        default:
+            fWpaProfile = FALSE;
+            break;
+    }
+
+    if ( fWpaProfile )
+    {
+        switch ( pProfile->negotiatedUCEncryptionType )
+        {
+            case eCSR_ENCRYPT_TYPE_WEP40:
+            case eCSR_ENCRYPT_TYPE_WEP104:
+            case eCSR_ENCRYPT_TYPE_TKIP:
+            case eCSR_ENCRYPT_TYPE_AES:
+                fWpaProfile = TRUE;
+                break;
+
+            default:
+                fWpaProfile = FALSE;
+                break;
+        }
+    }
+    return( fWpaProfile );
+}
+
+tANI_BOOLEAN csrIsProfileRSN( tCsrRoamProfile *pProfile )
+{
+    tANI_BOOLEAN fRSNProfile = FALSE;
+
+    switch ( pProfile->negotiatedAuthType )
+    {
+        case eCSR_AUTH_TYPE_RSN:
+        case eCSR_AUTH_TYPE_RSN_PSK:
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        case eCSR_AUTH_TYPE_FT_RSN:
+        case eCSR_AUTH_TYPE_FT_RSN_PSK:
+#endif 
+#ifdef FEATURE_WLAN_CCX
+        case eCSR_AUTH_TYPE_CCKM_RSN:
+#endif 
+            fRSNProfile = TRUE;
+            break;
+
+        default:
+            fRSNProfile = FALSE;
+            break;
+    }
+
+    if ( fRSNProfile )
+    {
+        switch ( pProfile->negotiatedUCEncryptionType )
+        {
+            // !!REVIEW - For WPA2, use of RSN IE mandates
+            // use of AES as encryption. Here, we qualify
+            // even if encryption type is WEP or TKIP
+            case eCSR_ENCRYPT_TYPE_WEP40:
+            case eCSR_ENCRYPT_TYPE_WEP104:
+            case eCSR_ENCRYPT_TYPE_TKIP:
+            case eCSR_ENCRYPT_TYPE_AES:
+                fRSNProfile = TRUE;
+                break;
+
+            default:
+                fRSNProfile = FALSE;
+                break;
+        }
+    }
+    return( fRSNProfile );
+}
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/* Function to return TRUE if the authtype is 11r */
+tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType )
+{
+    switch ( AuthType )
+    {
+        case eCSR_AUTH_TYPE_FT_RSN_PSK:
+        case eCSR_AUTH_TYPE_FT_RSN:
+            return TRUE;
+            break;
+        default:
+            break;
+    }
+    return FALSE;
+}
+
+/* Function to return TRUE if the profile is 11r */
+tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile )
+{
+    return csrIsAuthType11r( pProfile->negotiatedAuthType );
+}
+
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+
+/* Function to return TRUE if the authtype is CCX */
+tANI_BOOLEAN csrIsAuthTypeCCX( eCsrAuthType AuthType )
+{
+    switch ( AuthType )
+    {
+        case eCSR_AUTH_TYPE_CCKM_WPA:
+        case eCSR_AUTH_TYPE_CCKM_RSN:
+            return TRUE;
+            break;
+        default:
+            break;
+    }
+    return FALSE;
+}
+
+/* Function to return TRUE if the profile is CCX */
+tANI_BOOLEAN csrIsProfileCCX( tCsrRoamProfile *pProfile )
+{
+    return (csrIsAuthTypeCCX( pProfile->negotiatedAuthType ));
+}
+
+#endif
+
+#ifdef FEATURE_WLAN_WAPI
+tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile )
+{
+    tANI_BOOLEAN fWapiProfile = FALSE;
+
+    switch ( pProfile->negotiatedAuthType )
+    {
+        case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
+        case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
+            fWapiProfile = TRUE;
+            break;
+
+        default:
+            fWapiProfile = FALSE;
+            break;
+    }
+
+    if ( fWapiProfile )
+    {
+        switch ( pProfile->negotiatedUCEncryptionType )
+        {
+            case eCSR_ENCRYPT_TYPE_WPI:
+                fWapiProfile = TRUE;
+                break;
+
+            default:
+                fWapiProfile = FALSE;
+                break;
+        }
+    }
+    return( fWapiProfile );
+}
+
+static tANI_BOOLEAN csrIsWapiOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
+{
+    return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WAPI_OUI_SIZE ) );
+}
+
+static tANI_BOOLEAN csrIsWapiOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
+                                     tANI_U8 cAllCyphers,
+                                     tANI_U8 Cypher[],
+                                     tANI_U8 Oui[] )
+{
+    tANI_BOOLEAN fYes = FALSE;
+    tANI_U8 idx;
+
+    for ( idx = 0; idx < cAllCyphers; idx++ )
+    {
+        if ( csrIsWapiOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
+        {
+            fYes = TRUE;
+            break;
+        }
+    }
+
+    if ( fYes && Oui )
+    {
+        palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WAPI_OUI_SIZE );
+    }
+
+    return( fYes );
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+static tANI_BOOLEAN csrIsWpaOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
+{
+    return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WPA_OUI_SIZE ) );
+}
+
+static tANI_BOOLEAN csrIsOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                     tANI_U8 cAllCyphers,
+                                     tANI_U8 Cypher[],
+                                     tANI_U8 Oui[] )
+{
+    tANI_BOOLEAN fYes = FALSE;
+    tANI_U8 idx;
+
+    for ( idx = 0; idx < cAllCyphers; idx++ )
+    {
+        if ( csrIsWpaOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
+        {
+            fYes = TRUE;
+            break;
+        }
+    }
+
+    if ( fYes && Oui )
+    {
+        palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WPA_OUI_SIZE );
+    }
+
+    return( fYes );
+}
+
+static tANI_BOOLEAN csrMatchRSNOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                            tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
+                                            tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui[ouiIndex], Oui ) );
+
+}
+
+#ifdef FEATURE_WLAN_WAPI
+static tANI_BOOLEAN csrMatchWapiOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
+                                            tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
+                                            tANI_U8 Oui[] )
+{
+    return( csrIsWapiOuiMatch( pMac, AllCyphers, cAllCyphers, csrWapiOui[ouiIndex], Oui ) );
+
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+static tANI_BOOLEAN csrMatchWPAOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                            tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
+                                            tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui[ouiIndex], Oui ) );
+
+}
+
+#if 0
+static tANI_BOOLEAN csrIsRSNUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                            tANI_U8 cAllCyphers,
+                                            tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui00, Oui ) );
+}
+
+static tANI_BOOLEAN csrIsRSNMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                           tANI_U8 cAllCyphers,
+                                           tANI_U8 Oui[] )
+{
+    tANI_BOOLEAN fYes = FALSE;
+
+    // Check Wep 104 first, if fails, then check Wep40.
+    fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui05, Oui );
+
+    if ( !fYes )
+    {
+        // if not Wep-104, check Wep-40
+        fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui01, Oui );
+    }
+
+    return( fYes );
+}
+
+
+static tANI_BOOLEAN csrIsRSNUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                    tANI_U8 cAllCyphers,
+                                    tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
+}
+
+
+static tANI_BOOLEAN csrIsRSNMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                              tANI_U8 cAllCyphers,
+                                              tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
+}
+
+static tANI_BOOLEAN csrIsRSNUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                              tANI_U8 cAllCyphers,
+                                              tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
+}
+
+static tANI_BOOLEAN csrIsRSNMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
+                                              tANI_U8 cAllCyphers,
+                                              tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
+}
+#endif
+#ifdef FEATURE_WLAN_WAPI
+static tANI_BOOLEAN csrIsAuthWapiCert( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
+                                  tANI_U8 cAllSuites,
+                                  tANI_U8 Oui[] )
+{
+    return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[1], Oui ) );
+}
+static tANI_BOOLEAN csrIsAuthWapiPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
+                                      tANI_U8 cAllSuites,
+                                      tANI_U8 Oui[] )
+{
+    return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[2], Oui ) );
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+/* 
+ * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
+ * here. This matches for FT Auth with the 802.1X exchange.
+ *
+ */
+static tANI_BOOLEAN csrIsFTAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
+                                  tANI_U8 cAllSuites,
+                                  tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[03], Oui ) );
+}
+
+/* 
+ * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
+ * here. This matches for FT Auth with the PSK.
+ *
+ */
+static tANI_BOOLEAN csrIsFTAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
+                                      tANI_U8 cAllSuites,
+                                      tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[04], Oui ) );
+}
+
+#endif
+
+#ifdef FEATURE_WLAN_CCX
+
+/* 
+ * Function for CCX CCKM AKM Authentication. We match the CCKM AKM Authentication Key Management suite
+ * here. This matches for CCKM AKM Auth with the 802.1X exchange.
+ *
+ */
+static tANI_BOOLEAN csrIsCcxCckmAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
+                                  tANI_U8 cAllSuites,
+                                  tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
+}
+
+static tANI_BOOLEAN csrIsCcxCckmAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
+                                tANI_U8 cAllSuites,
+                                tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[06], Oui ) );
+}
+
+#endif
+
+static tANI_BOOLEAN csrIsAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
+                                  tANI_U8 cAllSuites,
+                                  tANI_U8 Oui[] )
+{
+#ifdef WLAN_FEATURE_11W
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) ||
+            csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[05], Oui ));
+#else
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) );
+#endif
+}
+static tANI_BOOLEAN csrIsAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
+                                      tANI_U8 cAllSuites,
+                                      tANI_U8 Oui[] )
+{
+#ifdef WLAN_FEATURE_11W
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) ||
+            csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
+#else
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) );
+#endif
+}
+
+static tANI_BOOLEAN csrIsAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
+                                tANI_U8 cAllSuites,
+                                tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[01], Oui ) );
+}
+
+#ifdef NOT_CURRENTLY_USED
+static tANI_BOOLEAN csrIsAuth802_1x( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
+                                tANI_U8 cAllSuites,
+                                tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[00], Oui ) );
+}
+#endif // NOT_CURRENTLY_USED
+
+static tANI_BOOLEAN csrIsAuthWpaPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
+                                tANI_U8 cAllSuites,
+                                tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[02], Oui ) );
+}
+#if 0
+static tANI_BOOLEAN csrIsUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                      tANI_U8 cAllCyphers,
+                                      tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui00, Oui ) );
+}
+
+static tANI_BOOLEAN csrIsUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                      tANI_U8 cAllCyphers,
+                                      tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
+}
+
+static tANI_BOOLEAN csrIsUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                      tANI_U8 cAllCyphers,
+                                      tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
+}
+
+
+static tANI_BOOLEAN csrIsMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                          tANI_U8 cAllCyphers,
+                                          tANI_U8 Oui[] )
+{
+    tANI_BOOLEAN fYes = FALSE;
+
+    // Check Wep 104 first, if fails, then check Wep40.
+    fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui05, Oui );
+
+    if ( !fYes )
+    {
+        // if not Wep-104, check Wep-40
+        fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui01, Oui );
+    }
+
+    return( fYes );
+}
+
+
+static tANI_BOOLEAN csrIsMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                          tANI_U8 cAllCyphers,
+                                          tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
+}
+
+
+static tANI_BOOLEAN csrIsMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
+                                          tANI_U8 cAllCyphers,
+                                          tANI_U8 Oui[] )
+{
+    return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
+}
+
+#endif
+
+tANI_U8 csrGetOUIIndexFromCipher( eCsrEncryptionType enType )
+{
+    tANI_U8 OUIIndex;
+
+        switch ( enType )
+        {
+            case eCSR_ENCRYPT_TYPE_WEP40:
+            case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+                OUIIndex = CSR_OUI_WEP40_OR_1X_INDEX;
+                break;
+            case eCSR_ENCRYPT_TYPE_WEP104:
+            case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+                OUIIndex = CSR_OUI_WEP104_INDEX;
+                break;
+            case eCSR_ENCRYPT_TYPE_TKIP:
+                OUIIndex = CSR_OUI_TKIP_OR_PSK_INDEX;
+                break;
+            case eCSR_ENCRYPT_TYPE_AES:
+                OUIIndex = CSR_OUI_AES_INDEX;
+                break;
+            case eCSR_ENCRYPT_TYPE_NONE:
+                OUIIndex = CSR_OUI_USE_GROUP_CIPHER_INDEX;
+                break;
+#ifdef FEATURE_WLAN_WAPI
+           case eCSR_ENCRYPT_TYPE_WPI:
+               OUIIndex = CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX;
+               break;
+#endif /* FEATURE_WLAN_WAPI */
+            default: //HOWTO handle this?
+                OUIIndex = CSR_OUI_RESERVED_INDEX;
+                break;
+        }//switch
+
+        return OUIIndex;
+}
+
+tANI_BOOLEAN csrGetRSNInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
+                                   tDot11fIERSN *pRSNIe,
+                           tANI_U8 *UnicastCypher,
+                           tANI_U8 *MulticastCypher,
+                           tANI_U8 *AuthSuite,
+                           tCsrRSNCapabilities *Capabilities,
+                           eCsrAuthType *pNegotiatedAuthtype,
+                           eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fAcceptableCyphers = FALSE;
+    tANI_U8 cUnicastCyphers = 0;
+    tANI_U8 cMulticastCyphers = 0;
+    tANI_U8 cAuthSuites = 0, i;
+    tANI_U8 Unicast[ CSR_RSN_OUI_SIZE ];
+    tANI_U8 Multicast[ CSR_RSN_OUI_SIZE ];
+    tANI_U8 AuthSuites[ CSR_RSN_MAX_AUTH_SUITES ][ CSR_RSN_OUI_SIZE ];
+    tANI_U8 Authentication[ CSR_RSN_OUI_SIZE ];
+    tANI_U8 MulticastCyphers[ CSR_RSN_MAX_MULTICAST_CYPHERS ][ CSR_RSN_OUI_SIZE ];
+    eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
+
+    do{
+        if ( pRSNIe->present )
+        {
+            cMulticastCyphers++;
+            palCopyMemory(pMac->hHdd, MulticastCyphers, pRSNIe->gp_cipher_suite, CSR_RSN_OUI_SIZE);
+            cUnicastCyphers = (tANI_U8)(pRSNIe->pwise_cipher_suite_count);
+            cAuthSuites = (tANI_U8)(pRSNIe->akm_suite_count);
+            for(i = 0; i < cAuthSuites && i < CSR_RSN_MAX_AUTH_SUITES; i++)
+            {
+                palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i],
+                        (void *)&pRSNIe->akm_suites[i], CSR_RSN_OUI_SIZE);
+            }
+
+            //Check - Is requested Unicast Cipher supported by the BSS.
+            fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, pRSNIe->pwise_cipher_suites, cUnicastCyphers, 
+                    csrGetOUIIndexFromCipher( enType ), Unicast ); 
+
+            if( !fAcceptableCyphers ) break;
+
+
+            //Unicast is supported. Pick the first matching Group cipher, if any.
+            for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
+            {
+                fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, MulticastCyphers,  cMulticastCyphers, 
+                            csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
+                if(fAcceptableCyphers)
+                {
+                    break;
+                }
+            }
+            if( !fAcceptableCyphers ) break;
+
+            if( pNegotiatedMCCipher )
+                *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
+            
+            /* Initializing with FALSE as it has TRUE value already */
+            fAcceptableCyphers = FALSE;
+            for (i = 0 ; i < pAuthType->numEntries; i++)
+            {
+                //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
+ #ifdef WLAN_FEATURE_VOWIFI_11R
+                /* Changed the AKM suites according to order of preference */
+                if ( csrIsFTAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_FT_RSN == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_FT_RSN;
+                }
+                if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsFTAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_FT_RSN_PSK == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_FT_RSN_PSK;
+                }
+#endif
+#ifdef FEATURE_WLAN_CCX
+                /* CCX only supports 802.1X.  No PSK. */
+                if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_CCKM_RSN == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
+                }
+#endif
+                if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_RSN == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_RSN;
+                }
+                if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_RSN_PSK == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_RSN_PSK;
+                }
+
+                // The 1st auth type in the APs RSN IE, to match stations connecting
+                // profiles auth type will cause us to exit this loop
+                // This is added as some APs advertise multiple akms in the RSN IE.
+                if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
+                {
+                    fAcceptableCyphers = TRUE;
+                    break;
+                }
+            } // for
+        }
+
+    }while (0);
+
+    if ( fAcceptableCyphers )
+    {
+        if ( MulticastCypher )
+        {
+            palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_RSN_OUI_SIZE );
+        }
+
+        if ( UnicastCypher )
+        {
+            palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_RSN_OUI_SIZE );
+        }
+
+        if ( AuthSuite )
+        {
+            palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_RSN_OUI_SIZE );
+        }
+
+        if ( pNegotiatedAuthtype )
+        {
+            *pNegotiatedAuthtype = negAuthType;
+        }
+        if ( Capabilities )
+        {
+            Capabilities->PreAuthSupported = pRSNIe->preauth;
+            Capabilities->NoPairwise = pRSNIe->no_pwise;
+            Capabilities->PTKSAReplayCounter = pRSNIe->PTKSA_replay_counter;
+            Capabilities->GTKSAReplayCounter = pRSNIe->GTKSA_replay_counter;
+            Capabilities->Reserved = pRSNIe->reserved;
+        }
+    }
+    return( fAcceptableCyphers );
+}
+
+
+tANI_BOOLEAN csrIsRSNMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType, 
+                            tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tANI_BOOLEAN fRSNMatch = FALSE;
+
+        // See if the cyphers in the Bss description match with the settings in the profile.
+    fRSNMatch = csrGetRSNInformation( hHal, pAuthType, enType, pEnMcType, &pIes->RSN, NULL, NULL, NULL, NULL, 
+                                      pNegotiatedAuthType, pNegotiatedMCCipher );
+
+    return( fRSNMatch );
+}
+
+
+tANI_BOOLEAN csrLookupPMKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pPMKId )
+{
+    tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
+    tANI_U32 Index;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do
+    {
+        for( Index=0; Index < pSession->NumPmkidCache; Index++ )
+        {
+            smsLog(pMac, LOGW, "match PMKID %02X-%02X-%02X-%02X-%02X-%02X to \n",
+                pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]);
+            if( palEqualMemory( pMac->hHdd, pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) )
+            {
+                // match found
+                fMatchFound = TRUE;
+                break;
+            }
+        }
+
+        if( !fMatchFound ) break;
+
+        palCopyMemory( pMac->hHdd, pPMKId, pSession->PmkidCacheInfo[Index].PMKID, CSR_RSN_PMKID_SIZE );
+
+        fRC = TRUE;
+    }
+    while( 0 );
+    smsLog(pMac, LOGW, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d", 
+        fRC, pSession->NumPmkidCache);
+
+    return fRC;
+}
+
+
+tANI_U8 csrConstructRSNIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                            tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fRSNMatch;
+    tANI_U8 cbRSNIe = 0;
+    tANI_U8 UnicastCypher[ CSR_RSN_OUI_SIZE ];
+    tANI_U8 MulticastCypher[ CSR_RSN_OUI_SIZE ];
+    tANI_U8 AuthSuite[ CSR_RSN_OUI_SIZE ];
+    tCsrRSNAuthIe *pAuthSuite;
+    tCsrRSNCapabilities RSNCapabilities;
+    tCsrRSNPMKIe        *pPMK;
+    tANI_U8 PMKId[CSR_RSN_PMKID_SIZE];
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    do
+    {
+        if ( !csrIsProfileRSN( pProfile ) ) break;
+
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
+        {
+            break;
+        }
+
+        // See if the cyphers in the Bss description match with the settings in the profile.
+        fRSNMatch = csrGetRSNInformation( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, 
+                                            &pProfile->mcEncryptionType, &pIesLocal->RSN,
+                                            UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, NULL, NULL );
+        if ( !fRSNMatch ) break;
+
+        pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID;
+
+        pRSNIe->Version = CSR_RSN_VERSION_SUPPORTED;
+
+        palCopyMemory( pMac->hHdd, pRSNIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) );
+
+        pRSNIe->cUnicastCyphers = 1;
+
+        palCopyMemory( pMac->hHdd, &pRSNIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) );
+
+        pAuthSuite = (tCsrRSNAuthIe *)( &pRSNIe->UnicastOui[ pRSNIe->cUnicastCyphers ] );
+
+        pAuthSuite->cAuthenticationSuites = 1;
+        palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
+
+        // RSN capabilities follows the Auth Suite (two octects)
+        // !!REVIEW - What should STA put in RSN capabilities, currently
+        // just putting back APs capabilities
+        // For one, we shouldn't EVER be sending out "pre-auth supported".  It is an AP only capability
+        RSNCapabilities.PreAuthSupported = 0;
+        *(tANI_U16 *)( &pAuthSuite->AuthOui[ 1 ] ) = *((tANI_U16 *)(&RSNCapabilities));
+
+        pPMK = (tCsrRSNPMKIe *)( ((tANI_U8 *)(&pAuthSuite->AuthOui[ 1 ])) + sizeof(tANI_U16) );
+
+        if( csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) )
+        {
+            pPMK->cPMKIDs = 1;
+
+            palCopyMemory( pMac->hHdd, pPMK->PMKIDList[0].PMKID, PMKId, CSR_RSN_PMKID_SIZE );
+        }
+        else
+        {
+            pPMK->cPMKIDs = 0;
+        }
+
+        // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
+        // Add in the size of the Auth suite (count plus a single OUI)
+        // Add in the RSN caps field.
+        // Add PMKID count and PMKID (if any)
+        pRSNIe->IeHeader.Length = (tANI_U8) (sizeof( *pRSNIe ) - sizeof ( pRSNIe->IeHeader ) +
+                                  sizeof( *pAuthSuite ) +
+                                  sizeof( tCsrRSNCapabilities ));
+        if(pPMK->cPMKIDs)
+        {
+            pRSNIe->IeHeader.Length += (tANI_U8)(sizeof( tANI_U16 ) +
+                                        (pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE));
+        }
+        // return the size of the IE header (total) constructed...
+        cbRSNIe = pRSNIe->IeHeader.Length + sizeof( pRSNIe->IeHeader );
+
+    } while( 0 );
+
+    if( !pIes && pIesLocal )
+    {
+        //locally allocated
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( cbRSNIe );
+}
+
+
+#ifdef FEATURE_WLAN_WAPI
+tANI_BOOLEAN csrGetWapiInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
+                                   tDot11fIEWAPI *pWapiIe,
+                                    tANI_U8 *UnicastCypher,
+                                    tANI_U8 *MulticastCypher,
+                                    tANI_U8 *AuthSuite,
+                                    eCsrAuthType *pNegotiatedAuthtype,
+                                    eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fAcceptableCyphers = FALSE;
+    tANI_U8 cUnicastCyphers = 0;
+    tANI_U8 cMulticastCyphers = 0;
+    tANI_U8 cAuthSuites = 0, i;
+    tANI_U8 Unicast[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 Multicast[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 AuthSuites[ CSR_WAPI_MAX_AUTH_SUITES ][ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 Authentication[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 MulticastCyphers[ CSR_WAPI_MAX_MULTICAST_CYPHERS ][ CSR_WAPI_OUI_SIZE ];
+    eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
+
+    do{
+        if ( pWapiIe->present )
+        {
+            cMulticastCyphers++;
+            palCopyMemory(pMac->hHdd, MulticastCyphers, pWapiIe->multicast_cipher_suite, CSR_WAPI_OUI_SIZE);
+            cUnicastCyphers = (tANI_U8)(pWapiIe->unicast_cipher_suite_count);
+            cAuthSuites = (tANI_U8)(pWapiIe->akm_suite_count);
+            for(i = 0; i < cAuthSuites && i < CSR_WAPI_MAX_AUTH_SUITES; i++)
+            {
+                palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i],
+                        (void *)&pWapiIe->akm_suites[i], CSR_WAPI_OUI_SIZE);
+            }
+
+            //Check - Is requested Unicast Cipher supported by the BSS.
+            fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, pWapiIe->unicast_cipher_suites, cUnicastCyphers, 
+                    csrGetOUIIndexFromCipher( enType ), Unicast ); 
+
+            if( !fAcceptableCyphers ) break;
+
+
+            //Unicast is supported. Pick the first matching Group cipher, if any.
+            for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
+            {
+                fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, MulticastCyphers,  cMulticastCyphers, 
+                csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
+                if(fAcceptableCyphers)
+                {
+                    break;
+                }
+            }
+            if( !fAcceptableCyphers ) break;
+
+            if( pNegotiatedMCCipher )
+                *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
+
+            //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
+            if ( csrIsAuthWapiCert( pMac, AuthSuites, cAuthSuites, Authentication ) )
+            {
+                negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
+            }
+            else if ( csrIsAuthWapiPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
+            {
+                negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
+            }
+            else
+            {
+                fAcceptableCyphers = FALSE;
+                negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
+            }
+            if( ( 0 == pAuthType->numEntries ) || ( FALSE == fAcceptableCyphers ) )
+            {
+                //Caller doesn't care about auth type, or BSS doesn't match
+                break;
+            }
+            fAcceptableCyphers = FALSE;
+            for( i = 0 ; i < pAuthType->numEntries; i++ )
+            {
+                if( pAuthType->authType[i] == negAuthType )
+                {
+                    fAcceptableCyphers = TRUE;
+                    break;
+                }
+            }
+        }
+    }while (0);
+
+    if ( fAcceptableCyphers )
+    {
+        if ( MulticastCypher )
+        {
+            palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_WAPI_OUI_SIZE );
+        }
+
+        if ( UnicastCypher )
+        {
+            palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_WAPI_OUI_SIZE );
+        }
+
+        if ( AuthSuite )
+        {
+            palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_WAPI_OUI_SIZE );
+        }
+
+        if ( pNegotiatedAuthtype )
+        {
+            *pNegotiatedAuthtype = negAuthType;
+        }
+    }
+    return( fAcceptableCyphers );
+}
+
+tANI_BOOLEAN csrIsWapiMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType, 
+                            tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tANI_BOOLEAN fWapiMatch = FALSE;
+
+        // See if the cyphers in the Bss description match with the settings in the profile.
+    fWapiMatch = csrGetWapiInformation( hHal, pAuthType, enType, pEnMcType, &pIes->WAPI, NULL, NULL, NULL, 
+                                      pNegotiatedAuthType, pNegotiatedMCCipher );
+
+    return( fWapiMatch );
+}
+
+tANI_BOOLEAN csrLookupBKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pBKId )
+{
+    tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
+    tANI_U32 Index;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+    do
+    {
+        for( Index=0; Index < pSession->NumBkidCache; Index++ )
+        {
+            smsLog(pMac, LOGW, "match BKID %02X-%02X-%02X-%02X-%02X-%02X to \n",
+                pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]);
+            if( palEqualMemory( pMac->hHdd, pBSSId, pSession->BkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) )
+            {
+                // match found
+                fMatchFound = TRUE;
+                break;
+            }
+        }
+
+        if( !fMatchFound ) break;
+
+        palCopyMemory( pMac->hHdd, pBKId, pSession->BkidCacheInfo[Index].BKID, CSR_WAPI_BKID_SIZE );
+
+        fRC = TRUE;
+    }
+    while( 0 );
+    smsLog(pMac, LOGW, "csrLookupBKID called return match = %d pMac->roam.NumBkidCache = %d", fRC, pSession->NumBkidCache);
+
+    return fRC;
+}
+
+tANI_U8 csrConstructWapiIe( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
+                            tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
+{
+    tANI_BOOLEAN fWapiMatch = FALSE;
+    tANI_U8 cbWapiIe = 0;
+    tANI_U8 UnicastCypher[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 MulticastCypher[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 AuthSuite[ CSR_WAPI_OUI_SIZE ];
+    tANI_U8 BKId[CSR_WAPI_BKID_SIZE];
+    tANI_U8 *pWapi = NULL;
+    tANI_BOOLEAN fBKIDFound = FALSE;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    do
+    {
+        if ( !csrIsProfileWapi( pProfile ) ) break;
+
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
+        {
+            break;
+        }
+
+        // See if the cyphers in the Bss description match with the settings in the profile.
+        fWapiMatch = csrGetWapiInformation( pMac, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, 
+                                            &pProfile->mcEncryptionType, &pIesLocal->WAPI,
+                                            UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
+        if ( !fWapiMatch ) break;
+
+        palZeroMemory(pMac->hHdd, pWapiIe, sizeof(tCsrWapiIe));
+
+        pWapiIe->IeHeader.ElementID = DOT11F_EID_WAPI;
+
+        pWapiIe->Version = CSR_WAPI_VERSION_SUPPORTED;
+
+        pWapiIe->cAuthenticationSuites = 1;
+        palCopyMemory( pMac->hHdd, &pWapiIe->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
+
+        pWapi = (tANI_U8 *) (&pWapiIe->AuthOui[ 1 ]);
+
+        *pWapi = (tANI_U16)1; //cUnicastCyphers
+        pWapi+=2;
+        palCopyMemory( pMac->hHdd, pWapi, UnicastCypher, sizeof( UnicastCypher ) );
+        pWapi += sizeof( UnicastCypher );
+
+        palCopyMemory( pMac->hHdd, pWapi, MulticastCypher, sizeof( MulticastCypher ) );
+        pWapi += sizeof( MulticastCypher );
+
+
+        // WAPI capabilities follows the Auth Suite (two octects)
+        // we shouldn't EVER be sending out "pre-auth supported".  It is an AP only capability
+        // & since we already did a memset pWapiIe to 0, skip these fields
+        pWapi +=2;
+
+        fBKIDFound = csrLookupBKID( pMac, sessionId, pSirBssDesc->bssId, &(BKId[0]) );
+
+
+        if( fBKIDFound )
+        {
+            /* Do we need to change the endianness here */
+            *pWapi = (tANI_U16)1; //cBKIDs
+            pWapi+=2;
+            palCopyMemory( pMac->hHdd, pWapi, BKId, CSR_WAPI_BKID_SIZE );
+        }
+        else
+        {
+            *pWapi = 0;
+            pWapi+=1;
+            *pWapi = 0;
+            pWapi+=1;
+        }
+
+        // Add in the IE fields except the IE header
+        // Add BKID count and BKID (if any)
+        pWapiIe->IeHeader.Length = (tANI_U8) (sizeof( *pWapiIe ) - sizeof ( pWapiIe->IeHeader ));
+
+        /*2 bytes for BKID Count field*/
+        pWapiIe->IeHeader.Length += sizeof( tANI_U16 );
+
+        if(fBKIDFound)
+        {
+            pWapiIe->IeHeader.Length += CSR_WAPI_BKID_SIZE;
+        }
+        // return the size of the IE header (total) constructed...
+        cbWapiIe = pWapiIe->IeHeader.Length + sizeof( pWapiIe->IeHeader );
+
+    } while( 0 );
+
+    if( !pIes && pIesLocal )
+    {
+        //locally allocated
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( cbWapiIe );
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+tANI_BOOLEAN csrGetWpaCyphers( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
+                               tDot11fIEWPA *pWpaIe,
+                           tANI_U8 *UnicastCypher,
+                           tANI_U8 *MulticastCypher,
+                           tANI_U8 *AuthSuite,
+                           eCsrAuthType *pNegotiatedAuthtype,
+                           eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tANI_BOOLEAN fAcceptableCyphers = FALSE;
+    tANI_U8 cUnicastCyphers = 0;
+    tANI_U8 cMulticastCyphers = 0;
+    tANI_U8 cAuthSuites = 0;
+    tANI_U8 Unicast[ CSR_WPA_OUI_SIZE ];
+    tANI_U8 Multicast[ CSR_WPA_OUI_SIZE ];
+    tANI_U8 Authentication[ CSR_WPA_OUI_SIZE ];
+    tANI_U8 MulticastCyphers[ 1 ][ CSR_WPA_OUI_SIZE ];
+    tANI_U8 i;
+    eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
+
+    do
+    {
+        if ( pWpaIe->present )
+        {
+            cMulticastCyphers = 1;
+            palCopyMemory(pMac->hHdd, MulticastCyphers, pWpaIe->multicast_cipher, CSR_WPA_OUI_SIZE);
+            cUnicastCyphers = (tANI_U8)(pWpaIe->unicast_cipher_count);
+            cAuthSuites = (tANI_U8)(pWpaIe->auth_suite_count);
+
+            //Check - Is requested Unicast Cipher supported by the BSS.
+            fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, pWpaIe->unicast_ciphers, cUnicastCyphers, 
+                    csrGetOUIIndexFromCipher( enType ), Unicast );
+
+            if( !fAcceptableCyphers ) break;
+
+
+            //Unicast is supported. Pick the first matching Group cipher, if any.
+            for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
+            {
+                fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, MulticastCyphers,  cMulticastCyphers, 
+                            csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i]), Multicast );
+                if(fAcceptableCyphers)
+                {
+                    break;
+                }
+            }
+            if( !fAcceptableCyphers ) break;
+            
+            if( pNegotiatedMCCipher )
+                *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
+
+                /* Initializing with FALSE as it has TRUE value already */
+            fAcceptableCyphers = FALSE;
+            for (i = 0 ; i < pAuthType->numEntries; i++)
+            {
+            //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
+                if ( csrIsAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_WPA == pAuthType->authType[i])
+                    negAuthType = eCSR_AUTH_TYPE_WPA;
+                }
+                if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthWpaPsk( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_WPA_PSK == pAuthType->authType[i])
+                    negAuthType = eCSR_AUTH_TYPE_WPA_PSK;
+                }
+#ifdef FEATURE_WLAN_CCX
+                if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
+                {
+                    if (eCSR_AUTH_TYPE_CCKM_WPA == pAuthType->authType[i])
+                        negAuthType = eCSR_AUTH_TYPE_CCKM_WPA;
+                }
+#endif /* FEATURE_WLAN_CCX */
+
+                // The 1st auth type in the APs WPA IE, to match stations connecting
+                // profiles auth type will cause us to exit this loop
+                // This is added as some APs advertise multiple akms in the WPA IE.
+                if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
+                {
+                        fAcceptableCyphers = TRUE;
+                        break;
+                    }
+            } // for
+            }
+    }while(0);
+
+    if ( fAcceptableCyphers )
+    {
+        if ( MulticastCypher )
+        {
+            palCopyMemory( pMac->hHdd, (tANI_U8 **)MulticastCypher, Multicast, CSR_WPA_OUI_SIZE );
+        }
+
+        if ( UnicastCypher )
+        {
+            palCopyMemory( pMac->hHdd, (tANI_U8 **)UnicastCypher, Unicast, CSR_WPA_OUI_SIZE );
+        }
+
+        if ( AuthSuite )
+        {
+            palCopyMemory( pMac->hHdd, (tANI_U8 **)AuthSuite, Authentication, CSR_WPA_OUI_SIZE );
+        }
+
+        if( pNegotiatedAuthtype )
+        {
+            *pNegotiatedAuthtype = negAuthType;
+        }
+    }
+
+    return( fAcceptableCyphers );
+}
+
+
+
+tANI_BOOLEAN csrIsWpaEncryptionMatch( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
+                                        tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthtype, eCsrEncryptionType *pNegotiatedMCCipher )
+{
+    tANI_BOOLEAN fWpaMatch = eANI_BOOLEAN_FALSE;
+
+        // See if the cyphers in the Bss description match with the settings in the profile.
+    fWpaMatch = csrGetWpaCyphers( pMac, pAuthType, enType, pEnMcType, &pIes->WPA, NULL, NULL, NULL, pNegotiatedAuthtype, pNegotiatedMCCipher );
+
+    return( fWpaMatch );
+}
+
+
+tANI_U8 csrConstructWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                           tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fWpaMatch;
+    tANI_U8 cbWpaIe = 0;
+    tANI_U8 UnicastCypher[ CSR_WPA_OUI_SIZE ];
+    tANI_U8 MulticastCypher[ CSR_WPA_OUI_SIZE ];
+    tANI_U8 AuthSuite[ CSR_WPA_OUI_SIZE ];
+    tCsrWpaAuthIe *pAuthSuite;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    do
+    {
+        if ( !csrIsProfileWpa( pProfile ) ) break;
+
+        if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
+        {
+            break;
+        }
+        // See if the cyphers in the Bss description match with the settings in the profile.
+        fWpaMatch = csrGetWpaCyphers( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, &pProfile->mcEncryptionType,
+                                      &pIesLocal->WPA, UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
+        if ( !fWpaMatch ) break;
+
+        pWpaIe->IeHeader.ElementID = SIR_MAC_WPA_EID;
+
+        palCopyMemory( pMac->hHdd, pWpaIe->Oui, csrWpaOui[01], sizeof( pWpaIe->Oui ) );
+
+        pWpaIe->Version = CSR_WPA_VERSION_SUPPORTED;
+
+        palCopyMemory( pMac->hHdd, pWpaIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) );
+
+        pWpaIe->cUnicastCyphers = 1;
+
+        palCopyMemory( pMac->hHdd, &pWpaIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) );
+
+        pAuthSuite = (tCsrWpaAuthIe *)( &pWpaIe->UnicastOui[ pWpaIe->cUnicastCyphers ] );
+
+        pAuthSuite->cAuthenticationSuites = 1;
+        palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
+
+        // The WPA capabilities follows the Auth Suite (two octects)--
+        // this field is optional, and we always "send" zero, so just
+        // remove it.  This is consistent with our assumptions in the
+        // frames compiler; c.f. bug 15234:
+        // http://gold.woodsidenet.com/bugzilla/show_bug.cgi?id=15234
+
+        // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
+        // Add in the size of the Auth suite (count plus a single OUI)
+        pWpaIe->IeHeader.Length = sizeof( *pWpaIe ) - sizeof ( pWpaIe->IeHeader ) +
+                                  sizeof( *pAuthSuite );
+
+        // return the size of the IE header (total) constructed...
+        cbWpaIe = pWpaIe->IeHeader.Length + sizeof( pWpaIe->IeHeader );
+
+    } while( 0 );
+
+    if( !pIes && pIesLocal )
+    {
+        //locally allocated
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( cbWpaIe );
+}
+
+
+tANI_BOOLEAN csrGetWpaRsnIe( tHalHandle hHal, tANI_U8 *pIes, tANI_U32 len,
+                             tANI_U8 *pWpaIe, tANI_U8 *pcbWpaIe, tANI_U8 *pRSNIe, tANI_U8 *pcbRSNIe)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tDot11IEHeader *pIEHeader;
+    tSirMacPropIE *pSirMacPropIE;
+    tANI_U32 cbParsed;
+    tANI_U32 cbIE;
+    int cExpectedIEs = 0;
+    int cFoundIEs = 0;
+    int cbPropIETotal;
+
+    pIEHeader = (tDot11IEHeader *)pIes;
+    if(pWpaIe) cExpectedIEs++;
+    if(pRSNIe) cExpectedIEs++;
+
+    // bss description length includes all fields other than the length itself
+    cbParsed  = 0;
+
+    // Loop as long as there is data left in the IE of the Bss Description
+    // and the number of Expected IEs is NOT found yet.
+    while( ( (cbParsed + sizeof( *pIEHeader )) <= len ) && ( cFoundIEs < cExpectedIEs  ) )
+    {
+        cbIE = sizeof( *pIEHeader ) + pIEHeader->Length;
+
+        if ( ( cbIE + cbParsed ) > len ) break;
+
+        if ( ( pIEHeader->Length >= gCsrIELengthTable[ pIEHeader->ElementID ].min ) &&
+             ( pIEHeader->Length <= gCsrIELengthTable[ pIEHeader->ElementID ].max ) )
+        {
+            switch( pIEHeader->ElementID )
+            {
+                // Parse the 221 (0xdd) Proprietary IEs here...
+                // Note that the 221 IE is overloaded, containing the WPA IE, WMM/WME IE, and the
+                // Airgo proprietary IE information.
+                case SIR_MAC_WPA_EID:
+                {
+                    tANI_U32 aniOUI;
+                    tANI_U8 *pOui = (tANI_U8 *)&aniOUI;
+
+                    pOui++;
+                    aniOUI = ANI_OUI;
+                    aniOUI = i_ntohl( aniOUI );
+
+                    pSirMacPropIE = ( tSirMacPropIE *)pIEHeader;
+                    cbPropIETotal = pSirMacPropIE->length;
+
+                    // Validate the ANI OUI is in the OUI field in the proprietary IE...
+                    if ( ( pSirMacPropIE->length >= WNI_CFG_MANUFACTURER_OUI_LEN ) &&
+                          pOui[ 0 ] == pSirMacPropIE->oui[ 0 ] &&
+                          pOui[ 1 ] == pSirMacPropIE->oui[ 1 ] &&
+                          pOui[ 2 ] == pSirMacPropIE->oui[ 2 ]  )
+                    {
+                    }
+                    else
+                    {
+                        tCsrWpaIe     *pIe        = ( tCsrWpaIe *    )pIEHeader;
+
+                        if(!pWpaIe || !pcbWpaIe) break;
+                        // Check if this is a valid WPA IE.  Then check that the
+                        // WPA OUI is in place and the version is one that we support.
+                        if ( ( pIe->IeHeader.Length >= SIR_MAC_WPA_IE_MIN_LENGTH )   &&
+                             ( palEqualMemory(pMac->hHdd, pIe->Oui, (void *)csrWpaOui[1], sizeof( pIe->Oui ) ) ) &&
+                             ( pIe->Version <= CSR_WPA_VERSION_SUPPORTED ) )
+                        {
+                            palCopyMemory(pMac->hHdd, pWpaIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) );
+                            *pcbWpaIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
+                            cFoundIEs++;
+
+                            break;
+                        }
+                    }
+
+                    break;
+                }
+
+                case SIR_MAC_RSN_EID:
+                {
+                    tCsrRSNIe *pIe;
+
+                    if(!pcbRSNIe || !pRSNIe) break;
+                    pIe = (tCsrRSNIe *)pIEHeader;
+
+                    // Check the length of the RSN Ie to assure it is valid.  Then check that the
+                    // version is one that we support.
+
+                    if ( pIe->IeHeader.Length < SIR_MAC_RSN_IE_MIN_LENGTH ) break;
+                    if ( pIe->Version > CSR_RSN_VERSION_SUPPORTED ) break;
+
+                    cFoundIEs++;
+
+                    // if there is enough room in the WpaIE passed in, then copy the Wpa IE into
+                    // the buffer passed in.
+                    if ( *pcbRSNIe < pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ) break;
+                    palCopyMemory(pMac->hHdd, pRSNIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) );
+                    *pcbRSNIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
+
+                    break;
+                }
+
+                // Add support for other IE here...
+                default:
+                    break;
+            }
+        }
+
+        cbParsed += cbIE;
+
+        pIEHeader = (tDot11IEHeader *)( ((tANI_U8 *)pIEHeader) + cbIE );
+
+    }
+
+    // return a BOOL that tells if all of the IEs asked for were found...
+    return( cFoundIEs == cExpectedIEs );
+}
+
+
+//If a WPAIE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
+tANI_U8 csrRetrieveWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                          tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U8 cbWpaIe = 0;
+
+    do
+    {
+        if ( !csrIsProfileWpa( pProfile ) ) break;
+        if(pProfile->nWPAReqIELength && pProfile->pWPAReqIE)
+        {
+            if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nWPAReqIELength)
+            {
+                cbWpaIe = (tANI_U8)pProfile->nWPAReqIELength;
+                palCopyMemory(pMac->hHdd, pWpaIe, pProfile->pWPAReqIE, cbWpaIe);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "  csrRetrieveWpaIe detect invalid WPA IE length (%d) \n", pProfile->nWPAReqIELength);
+            }
+        }
+        else
+        {
+            cbWpaIe = csrConstructWpaIe(pMac, pProfile, pSirBssDesc, pIes, pWpaIe);
+        }
+    }while(0);
+
+    return (cbWpaIe);
+}
+
+
+//If a RSNIE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
+tANI_U8 csrRetrieveRsnIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
+                         tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U8 cbRsnIe = 0;
+
+    do
+    {
+        if ( !csrIsProfileRSN( pProfile ) ) break;
+        if(pProfile->nRSNReqIELength && pProfile->pRSNReqIE)
+        {
+            if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nRSNReqIELength)
+            {
+                cbRsnIe = (tANI_U8)pProfile->nRSNReqIELength;
+                palCopyMemory(pMac->hHdd, pRsnIe, pProfile->pRSNReqIE, cbRsnIe);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "  csrRetrieveRsnIe detect invalid RSN IE length (%d) \n", pProfile->nRSNReqIELength);
+            }
+        }
+        else
+        {
+            cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
+        }
+    }while(0);
+
+    return (cbRsnIe);
+}
+
+
+#ifdef FEATURE_WLAN_WAPI
+//If a WAPI IE exists in the profile, just use it. Or else construct one from the BSS
+//Caller allocated memory for pWapiIe and guarrantee it can contain a max length WAPI IE
+tANI_U8 csrRetrieveWapiIe( tHalHandle hHal, tANI_U32 sessionId, 
+                          tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, 
+                          tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U8 cbWapiIe = 0;
+
+    do
+    {
+        if ( !csrIsProfileWapi( pProfile ) ) break;
+        if(pProfile->nWAPIReqIELength && pProfile->pWAPIReqIE)
+        {
+            if(DOT11F_IE_WAPI_MAX_LEN >= pProfile->nWAPIReqIELength)
+            {
+                cbWapiIe = (tANI_U8)pProfile->nWAPIReqIELength;
+                palCopyMemory(pMac->hHdd, pWapiIe, pProfile->pWAPIReqIE, cbWapiIe);
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "  csrRetrieveWapiIe detect invalid WAPI IE length (%d) \n", pProfile->nWAPIReqIELength);
+            }
+        }
+        else
+        {
+            cbWapiIe = csrConstructWapiIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pWapiIe);
+        }
+    }while(0);
+
+    return (cbWapiIe);
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+tANI_BOOLEAN csrSearchChannelListForTxPower(tHalHandle hHal, tSirBssDescription *pBssDescription, tCsrChannelSet *returnChannelGroup)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tListElem *pEntry;
+    tANI_U16 i;
+    tANI_U16 startingChannel;
+    tANI_BOOLEAN found = FALSE;
+    tCsrChannelSet *pChannelGroup;
+
+    pEntry = csrLLPeekHead( &pMac->roam.channelList5G, LL_ACCESS_LOCK );
+
+    while ( pEntry )
+    {
+        pChannelGroup = GET_BASE_ADDR( pEntry, tCsrChannelSet, channelListLink );
+        startingChannel = pChannelGroup->firstChannel;
+        for ( i = 0; i < pChannelGroup->numChannels; i++ )
+        {
+            if ( startingChannel + i * pChannelGroup->interChannelOffset == pBssDescription->channelId )
+            {
+                found = TRUE;
+                break;
+            }
+        }
+
+        if ( found )
+        {
+            palCopyMemory(pMac->hHdd, returnChannelGroup, pChannelGroup, sizeof(tCsrChannelSet));
+            break;
+        }
+        else
+        {
+            pEntry = csrLLNext( &pMac->roam.channelList5G, pEntry, LL_ACCESS_LOCK );
+        }
+    }
+
+    return( found );
+}
+
+tANI_BOOLEAN csrRatesIsDot11Rate11bSupportedRate( tANI_U8 dot11Rate )
+{
+    tANI_BOOLEAN fSupported = FALSE;
+    tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
+
+    switch ( nonBasicRate )
+    {
+        case eCsrSuppRate_1Mbps:
+        case eCsrSuppRate_2Mbps:
+        case eCsrSuppRate_5_5Mbps:
+        case eCsrSuppRate_11Mbps:
+            fSupported = TRUE;
+            break;
+
+        default:
+            break;
+    }
+
+    return( fSupported );
+}
+
+tANI_BOOLEAN csrRatesIsDot11Rate11aSupportedRate( tANI_U8 dot11Rate )
+{
+    tANI_BOOLEAN fSupported = FALSE;
+    tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
+
+    switch ( nonBasicRate )
+    {
+        case eCsrSuppRate_6Mbps:
+        case eCsrSuppRate_9Mbps:
+        case eCsrSuppRate_12Mbps:
+        case eCsrSuppRate_18Mbps:
+        case eCsrSuppRate_24Mbps:
+        case eCsrSuppRate_36Mbps:
+        case eCsrSuppRate_48Mbps:
+        case eCsrSuppRate_54Mbps:
+            fSupported = TRUE;
+            break;
+
+        default:
+            break;
+    }
+
+    return( fSupported );
+}
+
+
+
+tAniEdType csrTranslateEncryptTypeToEdType( eCsrEncryptionType EncryptType )
+{
+    tAniEdType edType;
+
+    switch ( EncryptType )
+    {
+        default:
+        case eCSR_ENCRYPT_TYPE_NONE:
+            edType = eSIR_ED_NONE;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+        case eCSR_ENCRYPT_TYPE_WEP40:
+            edType = eSIR_ED_WEP40;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+        case eCSR_ENCRYPT_TYPE_WEP104:
+            edType = eSIR_ED_WEP104;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_TKIP:
+            edType = eSIR_ED_TKIP;
+            break;
+
+        case eCSR_ENCRYPT_TYPE_AES:
+            edType = eSIR_ED_CCMP;
+            break;
+#ifdef FEATURE_WLAN_WAPI
+        case eCSR_ENCRYPT_TYPE_WPI:
+            edType = eSIR_ED_WPI;
+#endif
+#ifdef WLAN_FEATURE_11W
+        //11w BIP
+        case eCSR_ENCRYPT_TYPE_AES_CMAC:
+            edType = eSIR_ED_AES_128_CMAC;
+            break;
+#endif
+    }
+
+    return( edType );
+}
+
+
+//pIes can be NULL
+tANI_BOOLEAN csrValidateWep( tpAniSirGlobal pMac, eCsrEncryptionType ucEncryptionType, 
+                             tCsrAuthList *pAuthList, tCsrEncryptionList *pMCEncryptionList, 
+                             eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCEncryption,
+                             tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
+{
+    tANI_U32 idx;
+    tANI_BOOLEAN fMatch = FALSE;
+    eCsrAuthType negotiatedAuth = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+    eCsrEncryptionType negotiatedMCCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
+
+    //This function just checks whether HDD is giving correct values for Multicast cipher and Auth.
+    
+    do
+    {
+        //If privacy bit is not set, consider no match
+        if ( !csrIsPrivacy( pSirBssDesc ) ) break;
+
+        for( idx = 0; idx < pMCEncryptionList->numEntries; idx++ )
+        {
+            switch( pMCEncryptionList->encryptionType[idx] )
+            {
+                case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+                case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+                case eCSR_ENCRYPT_TYPE_WEP40:
+                case eCSR_ENCRYPT_TYPE_WEP104:
+                    /* Multicast list may contain WEP40/WEP104. Check whether it matches UC.
+                    */
+                    if( ucEncryptionType == pMCEncryptionList->encryptionType[idx] )
+                    {
+                        fMatch = TRUE;
+                        negotiatedMCCipher = pMCEncryptionList->encryptionType[idx];
+                    }
+                    break;
+                default:
+                    fMatch = FALSE;
+                    break;
+            }
+            if(fMatch) break; 
+        }
+
+        if(!fMatch) break;
+
+        for( idx = 0; idx < pAuthList->numEntries; idx++ )
+        {
+            switch( pAuthList->authType[idx] )
+            {
+                case eCSR_AUTH_TYPE_OPEN_SYSTEM:
+                case eCSR_AUTH_TYPE_SHARED_KEY:
+                case eCSR_AUTH_TYPE_AUTOSWITCH:
+                    fMatch = TRUE;
+                    negotiatedAuth = pAuthList->authType[idx];
+                    break;
+                default:
+                    fMatch = FALSE;
+            }
+            if (fMatch) break;
+        }
+
+        if(!fMatch) break;
+        //In case of WPA / WPA2, check whether it supports WEP as well
+        if(pIes)
+        {
+            //Prepare the encryption type for WPA/WPA2 functions
+            if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == ucEncryptionType )
+            {
+                ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
+            }
+            else if( eCSR_ENCRYPT_TYPE_WEP104 == ucEncryptionType )
+            {
+                ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
+            }
+            //else we can use the encryption type directly
+            if( pIes->WPA.present )
+            {
+                fMatch = palEqualMemory(pMac->hHdd, pIes->WPA.multicast_cipher, 
+                            csrWpaOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_WPA_OUI_SIZE );
+                if( fMatch ) break;
+            }
+            if( pIes->RSN.present )
+            {
+                fMatch = palEqualMemory(pMac->hHdd, pIes->RSN.gp_cipher_suite, 
+                            csrRSNOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_RSN_OUI_SIZE );
+            }
+        }
+
+    }while(0);
+
+    if( fMatch )
+    {
+        if( pNegotiatedAuthType )
+            *pNegotiatedAuthType = negotiatedAuth;
+
+        if( pNegotiatedMCEncryption )
+            *pNegotiatedMCEncryption = negotiatedMCCipher;
+    }    
+
+
+    return fMatch;
+}
+
+
+//pIes shall contain IEs from pSirBssDesc. It shall be returned from function csrGetParsedBssDescriptionIEs
+tANI_BOOLEAN csrIsSecurityMatch( tHalHandle hHal, tCsrAuthList *authType, tCsrEncryptionList *pUCEncryptionType, tCsrEncryptionList *pMCEncryptionType,
+                                 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, 
+                                 eCsrAuthType *negotiatedAuthtype, eCsrEncryptionType *negotiatedUCCipher, eCsrEncryptionType *negotiatedMCCipher )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fMatch = FALSE;
+    tANI_U8 i,idx;
+    eCsrEncryptionType mcCipher = eCSR_ENCRYPT_TYPE_UNKNOWN, ucCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
+    eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
+
+    for( i = 0 ; ((i < pUCEncryptionType->numEntries) && (!fMatch)) ; i++ )
+    {
+        ucCipher = pUCEncryptionType->encryptionType[i];
+        // If the Bss description shows the Privacy bit is on, then we must have some sort of encryption configured
+        // for the profile to work.  Don't attempt to join networks with Privacy bit set when profiles say NONE for
+        // encryption type.
+        switch ( ucCipher )
+        {
+            case eCSR_ENCRYPT_TYPE_NONE:
+                {
+                    // for NO encryption, if the Bss description has the Privacy bit turned on, then encryption is
+                    // required so we have to reject this Bss.
+                    if ( csrIsPrivacy( pSirBssDesc ) )
+                    {
+                        fMatch = FALSE;
+                    }
+                    else
+                    {
+                        fMatch = TRUE;
+                    }
+
+                    if ( fMatch )
+                    {
+                        fMatch = FALSE;
+                        //Check Multicast cipher requested and Auth type requested.
+                        for( idx = 0 ; idx < pMCEncryptionType->numEntries ; idx++ )
+                        {
+                            if( eCSR_ENCRYPT_TYPE_NONE == pMCEncryptionType->encryptionType[idx] )
+                            {
+                                fMatch = TRUE; //Multicast can only be none.
+                                mcCipher = pMCEncryptionType->encryptionType[idx];
+                                break;
+                            }
+                        }
+                        if (!fMatch) break;
+
+                        fMatch = FALSE;
+                        //Check Auth list. It should contain AuthOpen.
+                        for( idx = 0 ; idx < authType->numEntries ; idx++ )
+                        {
+                            if( eCSR_AUTH_TYPE_OPEN_SYSTEM == authType->authType[idx] )
+                            {
+                               fMatch = TRUE;
+                               negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+                               break;
+                            }
+                        } 
+                        if (!fMatch) break;
+
+                    }
+                    break;
+                }
+
+            case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
+            case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
+                // !! might want to check for WEP keys set in the Profile.... ?
+                // !! don't need to have the privacy bit in the Bss description.  Many AP policies make legacy
+                // encryption 'optional' so we don't know if we can associate or not.  The AP will reject if
+                // encryption is not allowed without the Privacy bit turned on.
+                fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
+
+                break;
+
+                // these are all of the WPA encryption types...
+            case eCSR_ENCRYPT_TYPE_WEP40:
+            case eCSR_ENCRYPT_TYPE_WEP104:
+                fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
+                break;
+
+            case eCSR_ENCRYPT_TYPE_TKIP:
+            case eCSR_ENCRYPT_TYPE_AES:
+                {
+                    if(pIes)
+                    {
+                        // First check if there is a RSN match
+                        fMatch = csrIsRSNMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
+                        if( !fMatch )
+                        {
+                            // If not RSN, then check if there is a WPA match
+                            fMatch = csrIsWpaEncryptionMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes, 
+                                                              &negAuthType, &mcCipher );
+                        }
+                    }
+                    else
+                    {
+                        fMatch = FALSE;
+                    }
+                    break;
+                }
+#ifdef FEATURE_WLAN_WAPI
+           case eCSR_ENCRYPT_TYPE_WPI://WAPI
+               {
+                   if(pIes)
+                   {
+                       fMatch = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
+                   }
+                   else
+                   {
+                       fMatch = FALSE;
+                   }
+                   break;
+               }
+#endif /* FEATURE_WLAN_WAPI */
+            case eCSR_ENCRYPT_TYPE_ANY: 
+            default: 
+            {
+                tANI_BOOLEAN fMatchAny = eANI_BOOLEAN_FALSE;
+
+                fMatch = eANI_BOOLEAN_TRUE;
+                //It is allowed to match anything. Try the more secured ones first.
+                if(pIes)
+                {
+                    //Check AES first
+                    ucCipher = eCSR_ENCRYPT_TYPE_AES;
+                    fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
+                    if(!fMatchAny)
+                    {
+                        //Check TKIP
+                        ucCipher = eCSR_ENCRYPT_TYPE_TKIP;
+                        fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
+                    }
+#ifdef FEATURE_WLAN_WAPI
+                    if(!fMatchAny)
+                    {
+                        //Check WAPI
+                        ucCipher = eCSR_ENCRYPT_TYPE_WPI;
+                        fMatchAny = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
+                    }
+#endif /* FEATURE_WLAN_WAPI */
+                }
+                if(!fMatchAny)
+                {
+                    ucCipher = eCSR_ENCRYPT_TYPE_WEP104;
+                    if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
+                    {
+                        ucCipher = eCSR_ENCRYPT_TYPE_WEP40;
+                        if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
+                        {
+                            ucCipher = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+                            if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
+                            {
+                                ucCipher = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+                                if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
+                                {
+                                    //It must be open and no encryption
+                                    if ( csrIsPrivacy( pSirBssDesc ) )
+                                    {
+                                        //This is not right
+                                        fMatch = eANI_BOOLEAN_FALSE;
+                                    }
+                                    else
+                                    {
+                                        negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
+                                        mcCipher = eCSR_ENCRYPT_TYPE_NONE;
+                                        ucCipher = eCSR_ENCRYPT_TYPE_NONE;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                break;
+            }
+        }
+
+    }
+
+    if( fMatch ) 
+    {
+        if( negotiatedUCCipher )
+            *negotiatedUCCipher = ucCipher;
+   
+        if( negotiatedMCCipher )
+            *negotiatedMCCipher = mcCipher;
+   
+        if( negotiatedAuthtype )
+            *negotiatedAuthtype = negAuthType;
+    }
+
+    return( fMatch );
+}
+
+
+tANI_BOOLEAN csrIsSsidMatch( tpAniSirGlobal pMac, tANI_U8 *ssid1, tANI_U8 ssid1Len, tANI_U8 *bssSsid,
+                            tANI_U8 bssSsidLen, tANI_BOOLEAN fSsidRequired )
+{
+    tANI_BOOLEAN fMatch = FALSE;
+
+    do {
+
+        // There are a few special cases.  If the Bss description has a Broadcast SSID,
+        // then our Profile must have a single SSID without Wildcards so we can program
+        // the SSID.
+        // SSID could be suppressed in beacons. In that case SSID IE has valid length
+        // but the SSID value is all NULL characters. That condition is trated same
+        // as NULL SSID
+        if ( csrIsNULLSSID( bssSsid, bssSsidLen ) )
+        {
+            if ( eANI_BOOLEAN_FALSE == fSsidRequired )
+            {
+                fMatch = TRUE;
+            }
+            break;
+        }
+
+        // Check for the specification of the Broadcast SSID at the beginning of the list.
+        // If specified, then all SSIDs are matches (broadcast SSID means accept all SSIDs).
+        if ( ssid1Len == 0 )
+        {
+            fMatch = TRUE;
+            break;
+        }
+
+        if(ssid1Len != bssSsidLen) break;
+        if(palEqualMemory(pMac->hHdd, bssSsid, ssid1, bssSsidLen))
+        {
+            fMatch = TRUE;
+            break;
+        }
+
+    } while( 0 );
+
+    return( fMatch );
+}
+
+
+//Null ssid means match
+tANI_BOOLEAN csrIsSsidInList( tHalHandle hHal, tSirMacSSid *pSsid, tCsrSSIDs *pSsidList )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fMatch = FALSE;
+    tANI_U32 i;
+
+    if ( pSsidList && pSsid )
+    {
+        for(i = 0; i < pSsidList->numOfSSIDs; i++)
+        {
+            if(csrIsNULLSSID(pSsidList->SSIDList[i].SSID.ssId, pSsidList->SSIDList[i].SSID.length) ||
+                ((pSsidList->SSIDList[i].SSID.length == pSsid->length) &&
+                    palEqualMemory(pMac->hHdd, pSsid->ssId, pSsidList->SSIDList[i].SSID.ssId, pSsid->length)))
+            {
+                fMatch = TRUE;
+                break;
+            }
+        }
+    }
+
+    return (fMatch);
+}
+
+//like to use sirCompareMacAddr
+tANI_BOOLEAN csrIsMacAddressZero( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
+{
+    tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0};
+
+    return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN));
+}
+
+//like to use sirCompareMacAddr
+tANI_BOOLEAN csrIsMacAddressBroadcast( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
+{
+    tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+    return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN));
+}
+
+
+//like to use sirCompareMacAddr
+tANI_BOOLEAN csrIsMacAddressEqual( tpAniSirGlobal pMac, tCsrBssid *pMacAddr1, tCsrBssid *pMacAddr2 )
+{
+    return( palEqualMemory(pMac->hHdd, pMacAddr1, pMacAddr2, sizeof(tCsrBssid)) );
+}
+
+
+tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid )
+{
+    tANI_BOOLEAN fMatch = FALSE;
+    tCsrBssid ProfileBssid;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    // for efficiency of the MAC_ADDRESS functions, move the
+    // Bssid's into MAC_ADDRESS structs.
+    palCopyMemory( pMac->hHdd, &ProfileBssid, pProfBssid, sizeof(tCsrBssid) );
+
+    do {
+
+        // Give the profile the benefit of the doubt... accept either all 0 or
+        // the real broadcast Bssid (all 0xff) as broadcast Bssids (meaning to
+        // match any Bssids).
+        if ( csrIsMacAddressZero( pMac, &ProfileBssid ) ||
+             csrIsMacAddressBroadcast( pMac, &ProfileBssid ) )
+        {
+             fMatch = TRUE;
+             break;
+        }
+
+        if ( csrIsMacAddressEqual( pMac, BssBssid, &ProfileBssid ) )
+        {
+            fMatch = TRUE;
+            break;
+        }
+
+    } while( 0 );
+
+    return( fMatch );
+}
+
+
+tANI_BOOLEAN csrIsBSSTypeMatch(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2)
+{
+    if((eCSR_BSS_TYPE_ANY != bssType1 && eCSR_BSS_TYPE_ANY != bssType2) && (bssType1 != bssType2))
+        return eANI_BOOLEAN_FALSE;
+    else
+        return eANI_BOOLEAN_TRUE;
+}
+
+
+tANI_BOOLEAN csrIsBssTypeIBSS(eCsrRoamBssType bssType)
+{
+    return((tANI_BOOLEAN)(eCSR_BSS_TYPE_START_IBSS == bssType || eCSR_BSS_TYPE_IBSS == bssType));
+}
+
+tANI_BOOLEAN csrIsBssTypeWDS(eCsrRoamBssType bssType)
+{
+    return((tANI_BOOLEAN)(eCSR_BSS_TYPE_WDS_STA == bssType || eCSR_BSS_TYPE_WDS_AP == bssType));
+}
+
+tANI_BOOLEAN csrIsBSSTypeCapsMatch( eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
+{
+    tANI_BOOLEAN fMatch = TRUE;
+
+    do
+    {
+        switch( bssType )
+        {
+            case eCSR_BSS_TYPE_ANY:
+                break;
+
+            case eCSR_BSS_TYPE_INFRASTRUCTURE:
+            case eCSR_BSS_TYPE_WDS_STA:
+                if( !csrIsInfraBssDesc( pSirBssDesc ) )
+                    fMatch = FALSE;
+
+                break;
+
+            case eCSR_BSS_TYPE_IBSS:
+            case eCSR_BSS_TYPE_START_IBSS:
+                if( !csrIsIbssBssDesc( pSirBssDesc ) )
+                    fMatch = FALSE;
+
+                break;
+
+            case eCSR_BSS_TYPE_WDS_AP: //For WDS AP, no need to match anything
+            default:
+                fMatch = FALSE;
+                break;
+        }
+    }
+    while( 0 );
+
+
+    return( fMatch );
+}
+
+static tANI_BOOLEAN csrIsCapabilitiesMatch( tpAniSirGlobal pMac, eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
+{
+  return( csrIsBSSTypeCapsMatch( bssType, pSirBssDesc ) );
+}
+
+
+
+static tANI_BOOLEAN csrIsSpecificChannelMatch( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tANI_U8 Channel )
+{
+    tANI_BOOLEAN fMatch = TRUE;
+
+    do
+    {
+        // if the channel is ANY, then always match...
+        if ( eCSR_OPERATING_CHANNEL_ANY == Channel ) break;
+        if ( Channel == pSirBssDesc->channelId ) break;
+
+        // didn't match anything.. so return NO match
+        fMatch = FALSE;
+
+    } while( 0 );
+
+    return( fMatch );
+}
+
+
+tANI_BOOLEAN csrIsChannelBandMatch( tpAniSirGlobal pMac, tANI_U8 channelId, tSirBssDescription *pSirBssDesc )
+{
+    tANI_BOOLEAN fMatch = TRUE;
+
+    do
+    {
+        // if the profile says Any channel AND the global settings says ANY channel, then we
+        // always match...
+        if ( eCSR_OPERATING_CHANNEL_ANY == channelId ) break;
+
+        if ( eCSR_OPERATING_CHANNEL_ANY != channelId )
+        {
+            fMatch = csrIsSpecificChannelMatch( pMac, pSirBssDesc, channelId );
+        }
+
+    } while( 0 );
+
+    return( fMatch );
+}
+
+
+/**
+ * \brief Enquire as to whether a given rate is supported by the
+ * adapter as currently configured
+ *
+ *
+ * \param nRate A rate in units of 500kbps
+ *
+ * \return TRUE if  the adapter is currently capable  of supporting this
+ * rate, FALSE else
+ *
+ *
+ * The rate encoding  is just as in 802.11  Information Elements, except
+ * that the high bit is \em  not interpreted as indicating a Basic Rate,
+ * and proprietary rates are allowed, too.
+ *
+ * Note  that if the  adapter's dot11Mode  is g,  we don't  restrict the
+ * rates.  According to hwReadEepromParameters, this will happen when:
+ *
+ *   ... the  card is  configured for ALL  bands through  the property
+ *   page.  If this occurs, and the card is not an ABG card ,then this
+ *   code  is  setting the  dot11Mode  to  assume  the mode  that  the
+ *   hardware can support.   For example, if the card  is an 11BG card
+ *   and we  are configured to support  ALL bands, then  we change the
+ *   dot11Mode  to 11g  because  ALL in  this  case is  only what  the
+ *   hardware can support.
+ *
+ *
+ */
+
+static tANI_BOOLEAN csrIsAggregateRateSupported( tpAniSirGlobal pMac, tANI_U16 rate )
+{
+    tANI_BOOLEAN fSupported = eANI_BOOLEAN_FALSE;
+    tANI_U16 idx, newRate;
+
+    //In case basic rate flag is set
+    newRate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
+    if ( eCSR_CFG_DOT11_MODE_11A == pMac->roam.configParam.uCfgDot11Mode )
+    {
+        switch ( newRate )
+        {
+        case eCsrSuppRate_6Mbps:
+        case eCsrSuppRate_9Mbps:
+        case eCsrSuppRate_12Mbps:
+        case eCsrSuppRate_18Mbps:
+        case eCsrSuppRate_24Mbps:
+        case eCsrSuppRate_36Mbps:
+        case eCsrSuppRate_48Mbps:
+        case eCsrSuppRate_54Mbps:
+            fSupported = TRUE;
+            break;
+        default:
+            fSupported = FALSE;
+            break;
+        }
+
+    }
+    else if( eCSR_CFG_DOT11_MODE_11B == pMac->roam.configParam.uCfgDot11Mode )
+    {
+        switch ( newRate )
+        {
+        case eCsrSuppRate_1Mbps:
+        case eCsrSuppRate_2Mbps:
+        case eCsrSuppRate_5_5Mbps:
+        case eCsrSuppRate_11Mbps:
+            fSupported = TRUE;
+            break;
+        default:
+            fSupported = FALSE;
+            break;
+        }
+    }
+    else if ( !pMac->roam.configParam.ProprietaryRatesEnabled )
+    {
+
+        switch ( newRate )
+        {
+        case eCsrSuppRate_1Mbps:
+        case eCsrSuppRate_2Mbps:
+        case eCsrSuppRate_5_5Mbps:
+        case eCsrSuppRate_6Mbps:
+        case eCsrSuppRate_9Mbps:
+        case eCsrSuppRate_11Mbps:
+        case eCsrSuppRate_12Mbps:
+        case eCsrSuppRate_18Mbps:
+        case eCsrSuppRate_24Mbps:
+        case eCsrSuppRate_36Mbps:
+        case eCsrSuppRate_48Mbps:
+        case eCsrSuppRate_54Mbps:
+            fSupported = TRUE;
+            break;
+        default:
+            fSupported = FALSE;
+            break;
+        }
+
+    }
+    else {
+
+        if ( eCsrSuppRate_1Mbps   == newRate ||
+             eCsrSuppRate_2Mbps   == newRate ||
+             eCsrSuppRate_5_5Mbps == newRate ||
+             eCsrSuppRate_11Mbps  == newRate )
+        {
+            fSupported = TRUE;
+        }
+        else {
+            idx = 0x1;
+
+            switch ( newRate )
+            {
+            case eCsrSuppRate_6Mbps:
+                fSupported = gPhyRatesSuppt[0][idx];
+                break;
+            case eCsrSuppRate_9Mbps:
+                fSupported = gPhyRatesSuppt[1][idx];
+                break;
+            case eCsrSuppRate_12Mbps:
+                fSupported = gPhyRatesSuppt[2][idx];
+                break;
+            case eCsrSuppRate_18Mbps:
+                fSupported = gPhyRatesSuppt[3][idx];
+                break;
+            case eCsrSuppRate_20Mbps:
+                fSupported = gPhyRatesSuppt[4][idx];
+                break;
+            case eCsrSuppRate_24Mbps:
+                fSupported = gPhyRatesSuppt[5][idx];
+                break;
+            case eCsrSuppRate_36Mbps:
+                fSupported = gPhyRatesSuppt[6][idx];
+                break;
+            case eCsrSuppRate_40Mbps:
+                fSupported = gPhyRatesSuppt[7][idx];
+                break;
+            case eCsrSuppRate_42Mbps:
+                fSupported = gPhyRatesSuppt[8][idx];
+                break;
+            case eCsrSuppRate_48Mbps:
+                fSupported = gPhyRatesSuppt[9][idx];
+                break;
+            case eCsrSuppRate_54Mbps:
+                fSupported = gPhyRatesSuppt[10][idx];
+                break;
+            case eCsrSuppRate_72Mbps:
+                fSupported = gPhyRatesSuppt[11][idx];
+                break;
+            case eCsrSuppRate_80Mbps:
+                fSupported = gPhyRatesSuppt[12][idx];
+                break;
+            case eCsrSuppRate_84Mbps:
+                fSupported = gPhyRatesSuppt[13][idx];
+                break;
+            case eCsrSuppRate_96Mbps:
+                fSupported = gPhyRatesSuppt[14][idx];
+                break;
+            case eCsrSuppRate_108Mbps:
+                fSupported = gPhyRatesSuppt[15][idx];
+                break;
+            case eCsrSuppRate_120Mbps:
+                fSupported = gPhyRatesSuppt[16][idx];
+                break;
+            case eCsrSuppRate_126Mbps:
+                fSupported = gPhyRatesSuppt[17][idx];
+                break;
+            case eCsrSuppRate_144Mbps:
+                fSupported = gPhyRatesSuppt[18][idx];
+                break;
+            case eCsrSuppRate_160Mbps:
+                fSupported = gPhyRatesSuppt[19][idx];
+                break;
+            case eCsrSuppRate_168Mbps:
+                fSupported = gPhyRatesSuppt[20][idx];
+                break;
+            case eCsrSuppRate_192Mbps:
+                fSupported = gPhyRatesSuppt[21][idx];
+                break;
+            case eCsrSuppRate_216Mbps:
+                fSupported = gPhyRatesSuppt[22][idx];
+                break;
+            case eCsrSuppRate_240Mbps:
+                fSupported = gPhyRatesSuppt[23][idx];
+                break;
+            default:
+                fSupported = FALSE;
+                break;
+            }
+        }
+    }
+
+    return fSupported;
+}
+
+
+
+static tANI_BOOLEAN csrIsRateSetMatch( tpAniSirGlobal pMac,
+                                     tDot11fIESuppRates *pBssSuppRates,
+                                     tDot11fIEExtSuppRates *pBssExtSuppRates )
+{
+    tANI_BOOLEAN fMatch = TRUE;
+    tANI_U32 i;
+
+
+    // Validate that all of the Basic rates advertised in the Bss description are supported.
+    if ( pBssSuppRates )
+    {
+        for( i = 0; i < pBssSuppRates->num_rates; i++ )
+        {
+            if ( CSR_IS_BASIC_RATE( pBssSuppRates->rates[ i ] ) )
+            {
+                if ( !csrIsAggregateRateSupported( pMac, pBssSuppRates->rates[ i ] ) )
+                {
+                    fMatch = FALSE;
+                    break;
+                }
+            }
+        }
+    }
+
+    if ( fMatch && pBssExtSuppRates )
+    {
+        for( i = 0; i < pBssExtSuppRates->num_rates; i++ )
+        {
+            if ( CSR_IS_BASIC_RATE( pBssExtSuppRates->rates[ i ] ) )
+            {
+                if ( !csrIsAggregateRateSupported( pMac, pBssExtSuppRates->rates[ i ] ) )
+                {
+                    fMatch = FALSE;
+                    break;
+                }
+            }
+        }
+    }
+
+    return( fMatch );
+
+}
+
+
+//ppIes can be NULL. If caller want to get the *ppIes allocated by this function, pass in *ppIes = NULL
+tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrScanResultFilter *pFilter, 
+                          eCsrAuthType *pNegAuth, eCsrEncryptionType *pNegUc, eCsrEncryptionType *pNegMc,
+                          tDot11fBeaconIEs **ppIes)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
+    tANI_U32 i;
+    tDot11fBeaconIEs *pIes = NULL;
+    tANI_U8 *pb;
+
+    do {
+        if( ( NULL == ppIes ) || ( *ppIes ) == NULL )
+        {
+            //If no IEs passed in, get our own.
+            if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes)))
+            {
+                break;
+            }
+        }
+        else
+        {
+            //Save the one pass in for local use
+            pIes = *ppIes;
+        }
+        
+        //Check if caller wants P2P
+        fCheck = (!pFilter->p2pResult || pIes->P2PBeaconProbeRes.present);
+        if(!fCheck) break;
+
+        if(pIes->SSID.present)
+        {
+            for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++)
+            {
+                fCheck = csrIsSsidMatch( pMac, pFilter->SSIDs.SSIDList[i].SSID.ssId, pFilter->SSIDs.SSIDList[i].SSID.length,
+                                        pIes->SSID.ssid,
+                                        pIes->SSID.num_ssid, eANI_BOOLEAN_TRUE );
+                if ( fCheck ) break;
+            }
+            if(!fCheck) break;
+        }
+        fCheck = eANI_BOOLEAN_TRUE;
+        for(i = 0; i < pFilter->BSSIDs.numOfBSSIDs; i++)
+        {
+            fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], (tCsrBssid *)pBssDesc->bssId );
+            if ( fCheck ) break;
+
+            if (pFilter->p2pResult && pIes->P2PBeaconProbeRes.present)
+            {
+               fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], 
+                              (tCsrBssid *)pIes->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress );
+
+               if ( fCheck ) break;
+            }
+        }
+        if(!fCheck) break;
+
+        fCheck = eANI_BOOLEAN_TRUE;
+        for(i = 0; i < pFilter->ChannelInfo.numOfChannels; i++)
+        {
+            fCheck = csrIsChannelBandMatch( pMac, pFilter->ChannelInfo.ChannelList[i], pBssDesc );
+            if ( fCheck ) break;
+        }
+        if(!fCheck)
+            break;
+#if defined WLAN_FEATURE_VOWIFI
+        /* If this is for measurement filtering */
+        if( pFilter->fMeasurement )
+        {
+           fRC = eANI_BOOLEAN_TRUE;
+           break;
+        }
+#endif
+        if ( !csrIsPhyModeMatch( pMac, pFilter->phyMode, pBssDesc, NULL, NULL, pIes ) ) break;
+        if ( (!pFilter->bWPSAssociation) &&
+             !csrIsSecurityMatch( pMac, &pFilter->authType, &pFilter->EncryptionType, &pFilter->mcEncryptionType,
+                                 pBssDesc, pIes, pNegAuth, pNegUc, pNegMc ) ) break;
+        if ( !csrIsCapabilitiesMatch( pMac, pFilter->BSSType, pBssDesc ) ) break;
+        if ( !csrIsRateSetMatch( pMac, &pIes->SuppRates, &pIes->ExtSuppRates ) ) break;
+        //Tush-QoS: validate first if asked for APSD or WMM association
+        if ( (eCsrRoamWmmQbssOnly == pMac->roam.configParam.WMMSupportMode) &&
+             !CSR_IS_QOS_BSS(pIes) )
+             break;
+        //Check country. check even when pb is NULL because we may want to make sure
+        //AP has a country code in it if fEnforceCountryCodeMatch is set.
+        pb = ( pFilter->countryCode[0] ) ? ( pFilter->countryCode) : NULL;
+
+        fCheck = csrMatchCountryCode( pMac, pb, pIes );
+        if(!fCheck)
+            break;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+        if (pFilter->MDID.mdiePresent)
+        {
+            if (pBssDesc->mdiePresent)
+            {
+                if (pFilter->MDID.mobilityDomain != (pBssDesc->mdie[1] << 8 | pBssDesc->mdie[0]))
+                    break;
+            }
+            else
+                break;
+        }
+#endif
+        fRC = eANI_BOOLEAN_TRUE;
+
+    } while( 0 );
+    if( ppIes )
+    {
+        *ppIes = pIes;
+    }
+    else if( pIes )
+    {
+        palFreeMemory(pMac->hHdd, pIes);
+    }
+
+    return( fRC );
+}
+
+tANI_BOOLEAN csrMatchConnectedBSSSecurity( tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile, 
+                                           tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
+{
+    tCsrEncryptionList ucEncryptionList, mcEncryptionList;
+    tCsrAuthList authList;
+
+    ucEncryptionList.numEntries = 1;
+    ucEncryptionList.encryptionType[0] = pProfile->EncryptionType;
+
+    mcEncryptionList.numEntries = 1;
+    mcEncryptionList.encryptionType[0] = pProfile->mcEncryptionType;
+
+    authList.numEntries = 1;
+    authList.authType[0] = pProfile->AuthType;
+
+    return( csrIsSecurityMatch( pMac, &authList, &ucEncryptionList, &mcEncryptionList, pBssDesc, pIes, NULL, NULL, NULL ));
+
+}
+
+
+tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile,
+                                          tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
+    tDot11fBeaconIEs *pIesLocal = pIes;
+
+    do {
+        if( !pIes )
+        {
+            if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal)))
+            {
+                break;
+            }
+        }
+        fCheck = eANI_BOOLEAN_TRUE;
+        if(pIesLocal->SSID.present)
+        {
+            tANI_BOOLEAN fCheckSsid = eANI_BOOLEAN_FALSE;
+            if(pProfile->SSID.length)
+            {
+                fCheckSsid = eANI_BOOLEAN_TRUE;
+            }
+            fCheck = csrIsSsidMatch( pMac, pProfile->SSID.ssId, pProfile->SSID.length,
+                                        pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid, fCheckSsid );
+            if(!fCheck) break;
+        }
+        if ( !csrMatchConnectedBSSSecurity( pMac, pProfile, pBssDesc, pIesLocal) ) break;
+        if ( !csrIsCapabilitiesMatch( pMac, pProfile->BSSType, pBssDesc ) ) break;
+        if ( !csrIsRateSetMatch( pMac, &pIesLocal->SuppRates, &pIesLocal->ExtSuppRates ) ) break;
+        fCheck = csrIsChannelBandMatch( pMac, pProfile->operationChannel, pBssDesc );
+        if(!fCheck)
+            break;
+
+        fRC = eANI_BOOLEAN_TRUE;
+
+    } while( 0 );
+
+    if( !pIes && pIesLocal )
+    {
+        //locally allocated
+        palFreeMemory(pMac->hHdd, pIesLocal);
+    }
+
+    return( fRC );
+}
+
+
+
+tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
+
+    return csrIsAggregateRateSupported( pMac, n );
+}
+
+
+tANI_U16 csrRatesMacPropToDot11( tANI_U16 Rate )
+{
+    tANI_U16 ConvertedRate = Rate;
+
+    switch( Rate )
+    {
+        case SIR_MAC_RATE_1:
+            ConvertedRate = 2;
+            break;
+        case SIR_MAC_RATE_2:
+            ConvertedRate = 4;
+            break;
+        case SIR_MAC_RATE_5_5:
+            ConvertedRate = 11;
+            break;
+        case SIR_MAC_RATE_11:
+            ConvertedRate = 22;
+            break;
+
+        case SIR_MAC_RATE_6:
+            ConvertedRate = 12;
+            break;
+        case SIR_MAC_RATE_9:
+            ConvertedRate = 18;
+            break;
+        case SIR_MAC_RATE_12:
+            ConvertedRate = 24;
+            break;
+        case SIR_MAC_RATE_18:
+            ConvertedRate = 36;
+            break;
+        case SIR_MAC_RATE_24:
+            ConvertedRate = 48;
+            break;
+        case SIR_MAC_RATE_36:
+            ConvertedRate = 72;
+            break;
+        case SIR_MAC_RATE_42:
+            ConvertedRate = 84;
+            break;
+        case SIR_MAC_RATE_48:
+            ConvertedRate = 96;
+            break;
+        case SIR_MAC_RATE_54:
+            ConvertedRate = 108;
+            break;
+
+        case SIR_MAC_RATE_72:
+            ConvertedRate = 144;
+            break;
+        case SIR_MAC_RATE_84:
+            ConvertedRate = 168;
+            break;
+        case SIR_MAC_RATE_96:
+            ConvertedRate = 192;
+            break;
+        case SIR_MAC_RATE_108:
+            ConvertedRate = 216;
+            break;
+        case SIR_MAC_RATE_126:
+            ConvertedRate = 252;
+            break;
+        case SIR_MAC_RATE_144:
+            ConvertedRate = 288;
+            break;
+        case SIR_MAC_RATE_168:
+            ConvertedRate = 336;
+            break;
+        case SIR_MAC_RATE_192:
+            ConvertedRate = 384;
+            break;
+        case SIR_MAC_RATE_216:
+            ConvertedRate = 432;
+            break;
+        case SIR_MAC_RATE_240:
+            ConvertedRate = 480;
+            break;
+
+        case 0xff:
+            ConvertedRate = 0;
+            break;
+    }
+
+    return ConvertedRate;
+}
+
+
+tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates )
+{
+    tANI_U8 i;
+    tANI_U16 nBest;
+
+    nBest = pSuppRates->rate[ 0 ] & ( ~CSR_DOT11_BASIC_RATE_MASK );
+
+    if(pSuppRates->numRates > SIR_MAC_RATESET_EID_MAX)
+    {
+        pSuppRates->numRates = SIR_MAC_RATESET_EID_MAX;
+    }
+
+    for ( i = 1U; i < pSuppRates->numRates; ++i )
+    {
+        nBest = (tANI_U16)CSR_MAX( nBest, pSuppRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
+    }
+
+    if ( NULL != pExtRates )
+    {
+        for ( i = 0U; i < pExtRates->numRates; ++i )
+        {
+            nBest = (tANI_U16)CSR_MAX( nBest, pExtRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
+        }
+    }
+
+    if ( NULL != pPropRates )
+    {
+        for ( i = 0U; i < pPropRates->numPropRates; ++i )
+        {
+            nBest = (tANI_U16)CSR_MAX( nBest,  csrRatesMacPropToDot11( pPropRates->propRate[ i ] ) );
+        }
+    }
+
+    return nBest;
+}
+
+
+void csrReleaseProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile)
+{
+    if(pProfile)
+    {
+        if(pProfile->BSSIDs.bssid)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->BSSIDs.bssid);
+            pProfile->BSSIDs.bssid = NULL;
+        }
+        if(pProfile->SSIDs.SSIDList)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->SSIDs.SSIDList);
+            pProfile->SSIDs.SSIDList = NULL;
+        }
+        if(pProfile->pWPAReqIE)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pWPAReqIE);
+            pProfile->pWPAReqIE = NULL;
+        }
+        if(pProfile->pRSNReqIE)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pRSNReqIE);
+            pProfile->pRSNReqIE = NULL;
+        }
+#ifdef FEATURE_WLAN_WAPI
+        if(pProfile->pWAPIReqIE)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pWAPIReqIE);
+            pProfile->pWAPIReqIE = NULL;
+        }
+#endif /* FEATURE_WLAN_WAPI */
+
+        if(pProfile->pAddIEScan)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pAddIEScan);
+            pProfile->pAddIEScan = NULL;
+        }
+
+        if(pProfile->pAddIEAssoc)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc);
+            pProfile->pAddIEAssoc = NULL;
+        }
+        {
+            palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc);
+            pProfile->pAddIEAssoc = NULL;
+        }
+
+        if(pProfile->ChannelInfo.ChannelList)
+        {
+            palFreeMemory(pMac->hHdd, pProfile->ChannelInfo.ChannelList);
+            pProfile->ChannelInfo.ChannelList = NULL;
+        }
+
+    
+        palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile));
+    }
+}
+
+void csrFreeScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
+{
+    if(pScanFilter->BSSIDs.bssid)
+    {
+        palFreeMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid);
+        pScanFilter->BSSIDs.bssid = NULL;
+    }
+    if(pScanFilter->ChannelInfo.ChannelList)
+    {
+        palFreeMemory(pMac->hHdd, pScanFilter->ChannelInfo.ChannelList);
+        pScanFilter->ChannelInfo.ChannelList = NULL;
+    }
+    if(pScanFilter->SSIDs.SSIDList)
+    {
+        palFreeMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList);
+        pScanFilter->SSIDs.SSIDList = NULL;
+    }
+}
+
+
+void csrFreeRoamProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
+
+    if(pSession->pCurRoamProfile)
+    {
+        csrReleaseProfile(pMac, pSession->pCurRoamProfile);
+        palFreeMemory(pMac->hHdd, pSession->pCurRoamProfile);
+        pSession->pCurRoamProfile = NULL;
+    }
+}
+
+
+void csrFreeConnectBssDesc(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
+
+    if(pSession->pConnectBssDesc)
+    {
+        palFreeMemory(pMac->hHdd, pSession->pConnectBssDesc);
+        pSession->pConnectBssDesc = NULL;
+    }
+}
+
+
+
+tSirResultCodes csrGetDisassocRspStatusCode( tSirSmeDisassocRsp *pSmeDisassocRsp )
+{
+    tANI_U8 *pBuffer = (tANI_U8 *)pSmeDisassocRsp;
+    tANI_U32 ret;
+
+    pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr));
+    //tSirResultCodes is an enum, assuming is 32bit
+    //If we cannot make this assumption, use copymemory
+    pal_get_U32( pBuffer, &ret );
+
+    return( ( tSirResultCodes )ret );
+}
+
+
+tSirResultCodes csrGetDeAuthRspStatusCode( tSirSmeDeauthRsp *pSmeRsp )
+{
+    tANI_U8 *pBuffer = (tANI_U8 *)pSmeRsp;
+    tANI_U32 ret;
+
+    pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr));
+    //tSirResultCodes is an enum, assuming is 32bit
+    //If we cannot make this assumption, use copymemory
+    pal_get_U32( pBuffer, &ret );
+
+    return( ( tSirResultCodes )ret );
+}
+
+#if 0
+tSirScanType csrGetScanType(tANI_U8 chnId, eRegDomainId domainId, tANI_U8 *countryCode)
+{
+    tSirScanType scanType = eSIR_PASSIVE_SCAN;
+    tANI_U8 cc = 0;
+
+    while (cc++ < gCsrDomainChnInfo[domainId].numChannels)
+    {
+        if(chnId == gCsrDomainChnInfo[domainId].chnInfo[cc].chnId)
+        {
+            scanType = gCsrDomainChnInfo[domainId].chnInfo[cc].scanType;
+            break;
+        }
+    }
+
+    return (scanType);
+}
+#endif
+
+tSirScanType csrGetScanType(tpAniSirGlobal pMac, tANI_U8 chnId)
+{
+    tSirScanType scanType = eSIR_PASSIVE_SCAN;
+    eNVChannelEnabledType channelEnabledType;
+
+    channelEnabledType = vos_nv_getChannelEnabledState(chnId);
+    if( NV_CHANNEL_ENABLE ==  channelEnabledType)
+    {
+         scanType = eSIR_ACTIVE_SCAN;
+    }
+    return (scanType);
+}
+
+
+tANI_U8 csrToUpper( tANI_U8 ch )
+{
+    tANI_U8 chOut;
+
+    if ( ch >= 'a' && ch <= 'z' )
+    {
+        chOut = ch - 'a' + 'A';
+    }
+    else
+    {
+        chOut = ch;
+    }
+    return( chOut );
+}
+
+
+tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype)
+{
+    tSirBssType ret;
+
+    switch(csrtype)
+    {
+    case eCSR_BSS_TYPE_INFRASTRUCTURE:
+        ret = eSIR_INFRASTRUCTURE_MODE;
+        break;
+    case eCSR_BSS_TYPE_IBSS:
+    case eCSR_BSS_TYPE_START_IBSS:
+        ret = eSIR_IBSS_MODE;
+        break;
+    case eCSR_BSS_TYPE_WDS_AP:
+        ret = eSIR_BTAMP_AP_MODE;
+        break;
+    case eCSR_BSS_TYPE_WDS_STA:
+        ret = eSIR_BTAMP_STA_MODE;
+        break;
+#ifdef WLAN_SOFTAP_FEATURE
+    case eCSR_BSS_TYPE_INFRA_AP:
+        ret = eSIR_INFRA_AP_MODE;
+        break;
+#endif
+    case eCSR_BSS_TYPE_ANY:
+    default:
+        ret = eSIR_AUTO_MODE;
+        break;
+    }
+
+    return (ret);
+}
+
+
+//This function use the parameters to decide the CFG value.
+//CSR never sets WNI_CFG_DOT11_MODE_ALL to the CFG
+//So PE should not see WNI_CFG_DOT11_MODE_ALL when it gets the CFG value
+#ifdef WLAN_SOFTAP_FEATURE
+eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary)
+#else
+eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary)
+#endif
+{
+    tANI_U32 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
+
+    switch(phyMode)
+    {
+    case eCSR_DOT11_MODE_11a:
+    case eCSR_DOT11_MODE_11a_ONLY:
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
+        break;
+    case eCSR_DOT11_MODE_11b:
+    case eCSR_DOT11_MODE_11b_ONLY:
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
+        break;
+    case eCSR_DOT11_MODE_11g:
+    case eCSR_DOT11_MODE_11g_ONLY:
+#ifdef WLAN_SOFTAP_FEATURE
+        if(pProfile && (CSR_IS_INFRA_AP(pProfile)) && (phyMode == eCSR_DOT11_MODE_11g_ONLY))
+            cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G_ONLY;
+        else
+#endif
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
+        break;
+    case eCSR_DOT11_MODE_11n:
+        if(fProprietary)
+        {
+            cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
+        }
+        else
+        {
+            cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+        }
+        break;
+    case eCSR_DOT11_MODE_11n_ONLY:
+#ifdef WLAN_SOFTAP_FEATURE
+       if(pProfile && CSR_IS_INFRA_AP(pProfile))
+           cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N_ONLY;
+       else
+#endif
+       cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
+       break;
+    case eCSR_DOT11_MODE_TAURUS:
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
+        break;
+    case eCSR_DOT11_MODE_abg:
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
+        break;
+    case eCSR_DOT11_MODE_AUTO:
+        cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
+        break;
+    default:
+        //No need to assign anything here
+        break;
+    }
+
+    return (cfgDot11Mode);
+}
+
+
+eHalStatus csrSetRegulatoryDomain(tpAniSirGlobal pMac, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fRestart;
+
+    if(pMac->scan.domainIdCurrent == domainId)
+    {
+        //no change
+        fRestart = eANI_BOOLEAN_FALSE;
+    }
+    else if( !pMac->roam.configParam.fEnforceDefaultDomain )
+    {
+        pMac->scan.domainIdCurrent = domainId;
+        fRestart = eANI_BOOLEAN_TRUE;
+    }
+    else
+    {
+        //We cannot change the domain
+        status = eHAL_STATUS_CSR_WRONG_STATE;
+        fRestart = eANI_BOOLEAN_FALSE;
+    }
+    if(pfRestartNeeded)
+    {
+        *pfRestartNeeded = fRestart;
+    }
+
+    return (status);
+}
+
+
+v_REGDOMAIN_t csrGetCurrentRegulatoryDomain(tpAniSirGlobal pMac)
+{
+    return (pMac->scan.domainIdCurrent);
+}
+
+#if 0
+eHalStatus csrGetRegulatoryDomainForCountry(tpAniSirGlobal pMac, tANI_U8 *pCountry, eRegDomainId *pDomainId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_U32 i, count = sizeof( gCsrCountryInfo ) / sizeof( gCsrCountryInfo[0] );
+
+    if(pCountry)
+    {
+        for(i = 0; i < count; i++)
+        {
+            if(palEqualMemory(pMac->hHdd, gCsrCountryInfo[i].countryCode, pCountry, 2))
+            {
+                if( pDomainId )
+                {
+                    *pDomainId = gCsrCountryInfo[i].domainId;
+                }
+                break;
+            }
+        }
+        if(i == count)
+        {
+            smsLog(pMac, LOGW, FL("  doesn't match country %c%c\n"), pCountry[0], pCountry[1]);
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+    }
+
+    return (status);
+}
+#endif
+
+eHalStatus csrGetRegulatoryDomainForCountry(tpAniSirGlobal pMac, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    VOS_STATUS vosStatus;
+    v_COUNTRYCODE_t countryCode;
+    v_REGDOMAIN_t domainId;
+
+    if(pCountry)
+    {
+        countryCode[0] = pCountry[0];
+        countryCode[1] = pCountry[1];
+        vosStatus = vos_nv_getRegDomainFromCountryCode( &domainId, countryCode );
+        if( VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+            if( pDomainId )
+            {
+                *pDomainId = domainId;
+            }
+            status = eHAL_STATUS_SUCCESS;
+        }
+        else
+        {
+            smsLog(pMac, LOGW, FL("  doesn't match country %c%c\n"), pCountry[0], pCountry[1]);
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+    }
+
+    return (status);
+}
+
+//To check whether a country code matches the one in the IE
+//Only check the first two characters, ignoring in/outdoor
+//pCountry -- caller allocated buffer contain the country code that is checking against
+//the one in pIes. It can be NULL.
+//caller must provide pIes, it cannot be NULL
+//This function always return TRUE if 11d support is not turned on.
+tANI_BOOLEAN csrMatchCountryCode( tpAniSirGlobal pMac, tANI_U8 *pCountry, tDot11fBeaconIEs *pIes )
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
+    v_REGDOMAIN_t domainId = NUM_REG_DOMAINS;   //This is init to invalid value
+    eHalStatus status;
+
+    do
+    {
+        if( !csrIs11dSupported( pMac) )
+        {
+            break;
+        }
+        if( !pIes )
+        {
+            smsLog(pMac, LOGE, FL("  No IEs\n"));
+            break;
+        }
+        //Make sure this country is recognizable
+        if( pIes->Country.present )
+        {
+            status = csrGetRegulatoryDomainForCountry( pMac, pIes->Country.country,(v_REGDOMAIN_t *) &domainId );
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
+            }
+        }
+        //check whether it is needed to enforce to the default regulatory domain first
+        if( pMac->roam.configParam.fEnforceDefaultDomain )
+        {
+            if( domainId != pMac->scan.domainIdCurrent )
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
+            }
+        }
+        if( pMac->roam.configParam.fEnforceCountryCodeMatch )
+        {
+            if( domainId >= NUM_REG_DOMAINS )
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
+            }
+        }
+        if( pCountry )
+        {
+            tANI_U32 i;
+
+            if( !pIes->Country.present )
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            // Convert the CountryCode characters to upper
+            for ( i = 0; i < WNI_CFG_COUNTRY_CODE_LEN - 1; i++ )
+            {
+                pCountry[i] = csrToUpper( pCountry[i] );
+            }
+            if( !palEqualMemory(pMac->hHdd, pIes->Country.country, pCountry, WNI_CFG_COUNTRY_CODE_LEN - 1) )
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
+            }
+        }
+    } while(0);
+
+    return (fRet);
+}
+
+#if 0
+eHalStatus csrSetCountryDomainMapping(tpAniSirGlobal pMac, tCsrCountryDomainMapping *pCountryDomainMapping)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 i, j;
+    tANI_BOOLEAN fDomainChanged = eANI_BOOLEAN_FALSE;
+    tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN];
+
+    i = WNI_CFG_COUNTRY_CODE_LEN;
+    //Get the currently used country code
+    status = ccmCfgGetStr(pMac, WNI_CFG_COUNTRY_CODE, countryCode, &i);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        if(pCountryDomainMapping && pCountryDomainMapping->numEntry)
+        {
+            for(i = 0; i < pCountryDomainMapping->numEntry; i++)
+            {
+                for(j = 0; j < eCSR_NUM_COUNTRY_INDEX; j++)
+                {
+                    if(palEqualMemory(pMac->hHdd, gCsrCountryInfo[j].countryCode, 
+                                    pCountryDomainMapping->pCountryInfo[i].countryCode, 2))
+                    {
+                        if(gCsrCountryInfo[j].domainId != pCountryDomainMapping->pCountryInfo[i].domainId)
+                        {
+                            gCsrCountryInfo[j].domainId = pCountryDomainMapping->pCountryInfo[i].domainId;
+                            //Check whether it matches the currently used country code
+                            //If matching, need to update base on the new domain setting.
+                            if(palEqualMemory(pMac->hHdd, countryCode, 
+                                        pCountryDomainMapping->pCountryInfo[i].countryCode, 2))
+                            {
+                                fDomainChanged = eANI_BOOLEAN_TRUE;
+                            }
+                        }
+                        break;
+                    }
+                }
+            }
+            status = eHAL_STATUS_SUCCESS;
+            if(fDomainChanged)
+            {
+                tCsrChannel *pChannelList;
+
+                if(pMac->scan.f11dInfoApplied)
+                {
+                    //11d info already applied. Let's reapply with the new domain setting
+                    if(pMac->scan.channels11d.numChannels)
+                    {
+                        pChannelList = &pMac->scan.channels11d;
+                    }
+                    else
+                    {
+                        pChannelList = &pMac->scan.base20MHzChannels;
+                    }
+                }
+                else
+                {
+                    //no 11d so we use the base channelist from EEPROM
+                    pChannelList = &pMac->scan.base20MHzChannels;
+                }
+                //set the new domain's scan requirement to CFG
+                csrSetCfgScanControlList(pMac, countryCode, pChannelList);
+            }
+        }
+    }
+
+    return (status);
+}
+
+eHalStatus csrSetDomainScanSetting(tpAniSirGlobal pMac, tCsrDomainFreqInfo *pDomainFreqInfo)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+    tANI_U32 i, j;
+    tANI_U16 freq;
+
+    if(pDomainFreqInfo && pDomainFreqInfo->numEntry && (pDomainFreqInfo->domainId < NUM_REG_DOMAINS))
+    {
+        tCsrDomainChnInfo *pDomainChnInfo = &gCsrDomainChnInfo[pDomainFreqInfo->domainId];
+
+        for(j = 0; j < pDomainChnInfo->numChannels; j++)
+        {
+            if(HAL_STATUS_SUCCESS(halPhyChIdToFreqConversion(pDomainChnInfo->chnInfo[j].chnId, &freq)))
+            {
+                for(i = 0; i < pDomainFreqInfo->numEntry; i++)
+                {
+                    if((pDomainFreqInfo->pCsrScanFreqInfo[i].nStartFreq <= freq) &&
+                        (freq <= pDomainFreqInfo->pCsrScanFreqInfo[i].nEndFreq))
+                    {
+                        pDomainChnInfo->chnInfo[j].scanType = pDomainFreqInfo->pCsrScanFreqInfo[i].scanType;
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                smsLog(pMac, LOGW, "   Failed to get frequency of channel %d", pDomainChnInfo->chnInfo[j].chnId);
+            }
+        }
+        status = eHAL_STATUS_SUCCESS;
+    }
+
+    return (status);
+}
+#endif
+
+eHalStatus csrGetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     tCsrRoamModifyProfileFields *pModifyProfileFields)
+{
+
+   if(!pModifyProfileFields)
+   {
+      return eHAL_STATUS_FAILURE;
+   }
+
+   palCopyMemory( pMac->hHdd, pModifyProfileFields, 
+                  &pMac->roam.roamSession[sessionId].connectedProfile.modifyProfileFields, 
+                  sizeof(tCsrRoamModifyProfileFields) );
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
+                                     tCsrRoamModifyProfileFields *pModifyProfileFields)
+{
+   tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+   palCopyMemory( pMac->hHdd, &pSession->connectedProfile.modifyProfileFields,
+                  pModifyProfileFields,
+                  sizeof(tCsrRoamModifyProfileFields) );
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+#if 0
+/* ---------------------------------------------------------------------------
+    \fn csrGetSupportedCountryCode
+    \brief this function is to get a list of the country code current being supported
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, 
+    this has the country code list. 3 bytes for each country code. This may be NULL if
+    caller wants to know the needed bytes.
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
+{
+    tANI_U32 numOfCountry = sizeof( gCsrCountryInfo ) / sizeof( gCsrCountryInfo[0] );
+    tANI_U32 numBytes = 0;
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if( pbLen )
+    {
+        numBytes = *pbLen;
+        //Consider it ok, at least we can return the number of bytes needed;
+        *pbLen = numOfCountry * WNI_CFG_COUNTRY_CODE_LEN;
+        status = eHAL_STATUS_SUCCESS;
+        if( pBuf && ( numBytes >= *pbLen ) )
+        {
+            //The ugly part starts.
+            //We may need to alter the data structure and find a way to make this faster.
+            tANI_U32 i;
+
+            for( i = 0; i < numOfCountry; i++ )
+            {
+                palCopyMemory( pMac->hHdd, pBuf + ( i * WNI_CFG_COUNTRY_CODE_LEN ),
+                    gCsrCountryInfo[i].countryCode, WNI_CFG_COUNTRY_CODE_LEN );
+            }
+        }
+    }
+
+    return ( status );
+}
+#endif
+
+/* ---------------------------------------------------------------------------
+    \fn csrGetSupportedCountryCode
+    \brief this function is to get a list of the country code current being supported
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, 
+    this has the country code list. 3 bytes for each country code. This may be NULL if
+    caller wants to know the needed bytes.
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf
+    \return eHalStatus     
+  -------------------------------------------------------------------------------*/
+eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus;
+    v_SIZE_t size = (v_SIZE_t)*pbLen;
+
+    vosStatus = vos_nv_getSupportedCountryCode( pBuf, &size, 1 );
+    //eiter way, return the value back
+    *pbLen = (tANI_U32)size;
+
+    //If pBuf is NULL, caller just want to get the size, consider it success
+    if(pBuf)
+    {
+        if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+        {
+            tANI_U32 i, n = *pbLen / 3;
+
+            for( i = 0; i < n; i++ )
+            {
+                pBuf[i*3 + 2] = ' ';
+            }
+        }
+        else
+        {
+            status = eHAL_STATUS_FAILURE;
+        }
+    }
+
+    return (status);
+}
+
+
+
+//Upper layer to get the list of the base channels to scan for passively 11d info from csr
+eHalStatus csrScanGetBaseChannels( tpAniSirGlobal pMac, tCsrChannelInfo * pChannelInfo )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    do
+    {
+    
+       if(!pMac->scan.baseChannels.numChannels || !pChannelInfo)
+       {
+          break;
+       }
+       status = palAllocateMemory( pMac->hHdd, (void **)&pChannelInfo->ChannelList, 
+                                   pMac->scan.baseChannels.numChannels );
+       if( !HAL_STATUS_SUCCESS( status ) )
+       {
+          smsLog( pMac, LOGE, FL("csrScanGetBaseChannels: fail to allocate memory\n") );
+          break;
+       }
+       status = palCopyMemory( pMac->hHdd, pChannelInfo->ChannelList, pMac->scan.baseChannels.channelList, 
+                               pMac->scan.baseChannels.numChannels );
+       if( !HAL_STATUS_SUCCESS( status ) )
+       {
+          break;
+       }
+       pChannelInfo->numOfChannels = pMac->scan.baseChannels.numChannels;
+
+    }while(0);
+
+    return ( status );
+}
+
+
+tANI_BOOLEAN csrIsSetKeyAllowed(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
+#ifdef WLAN_SOFTAP_FEATURE
+    tCsrRoamSession *pSession;
+
+    pSession =CSR_GET_SESSION(pMac, sessionId);
+
+    /*This condition is not working for infra state. When infra is in not-connected state
+    * the pSession->pCurRoamProfile is NULL. And this function returns TRUE, that is incorrect.
+    * Since SAP requires to set key without any BSS started, it needs this condition to be met.
+    * In other words, this function is useless.
+    * The current work-around is to process setcontext_rsp and removekey_rsp no matter what the 
+    * state is.
+    */
+    smsLog( pMac, LOGE, FL(" is not what it intends to. Must be revisit or removed\n") );
+    if( (NULL == pSession) || 
+        ( csrIsConnStateDisconnected( pMac, sessionId ) && 
+        (pSession->pCurRoamProfile != NULL) &&
+        (!(CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) )
+        )
+    {
+        fRet = eANI_BOOLEAN_FALSE;
+    }
+#else
+    fRet = !( csrIsConnStateDisconnected( pMac, sessionId ) );
+#endif
+
+    return ( fRet );
+}
+
+//no need to acquire lock for this basic function
+tANI_U16 sme_ChnToFreq(tANI_U8 chanNum)
+{
+   int i;
+
+   for (i = 0; i < NUM_RF_CHANNELS; i++) 
+   {
+      if (rfChannels[i].channelNum == chanNum) 
+      {
+         return rfChannels[i].targetFreq;
+      }
+   }
+
+   return (0);
+}
+
+/* Disconnect all active sessions by sending disassoc. This is mainly used to disconnect the remaining session when we 
+ * transition from concurrent sessions to a single session. The use case is Infra STA and wifi direct multiple sessions are up and 
+ * P2P session is removed. The Infra STA session remains and should resume BMPS if BMPS is enabled by default. However, there
+ * are some issues seen with BMPS resume during this transition and this is a workaround which will allow the Infra STA session to
+ * disconnect and auto connect back and enter BMPS this giving the same effect as resuming BMPS
+ */
+void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    /* Disconnect all the active sessions */
+    for (i=0; i<CSR_ROAM_SESSION_MAX; i++)
+    {
+        if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
+        {
+            csrRoamDisconnectInternal(pMac, i, eCSR_DISCONNECT_REASON_UNSPECIFIED);
+        }
+    }
+}
diff --git a/CORE/SME/src/meas/measApi.c b/CORE/SME/src/meas/measApi.c
new file mode 100644
index 0000000..1e9b029
--- /dev/null
+++ b/CORE/SME/src/meas/measApi.c
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
diff --git a/CORE/SME/src/p2p/p2p_Api.c b/CORE/SME/src/p2p/p2p_Api.c
new file mode 100644
index 0000000..057f013
--- /dev/null
+++ b/CORE/SME/src/p2p/p2p_Api.c
@@ -0,0 +1,2243 @@
+/*
+ * 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) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary 
+ */
+
+#if defined WLAN_FEATURE_P2P
+
+#include "sme_Api.h"
+#include "smsDebug.h"
+#include "csrInsideApi.h"
+#include "smeInside.h"
+#include "p2p_Api.h"
+#include "limApi.h"
+#include "cfgApi.h"
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+#include "p2p_ie.h"
+#include "p2pFsm.h"
+
+extern tp2pie gP2PIe;
+
+static eHalStatus p2pSendActionFrame(tpAniSirGlobal pMac, tANI_U8 SessionID, eP2PFrameType actionFrameType);
+static eHalStatus p2pListenStateDiscoverableCallback(tHalHandle halHandle, void *pContext, eHalStatus retStatus);
+static eHalStatus p2pRemainOnChannelReadyCallback(tHalHandle halHandle, void *pContext, eHalStatus scan_status);
+static tANI_BOOLEAN p2pIsGOportEnabled(tpAniSirGlobal pMac);
+#endif
+
+eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
+/*------------------------------------------------------------------
+ *
+ * handle SME remain on channel request.
+ *
+ *------------------------------------------------------------------*/
+
+eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tSirRemainOnChnReq* pMsg;
+    tANI_U16 len;
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, p2pRemainonChn->sessionId );
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    tANI_U8 P2PsessionId = getP2PSessionIdFromSMESessionId(pMac, p2pRemainonChn->sessionId);
+    tp2pContext *p2pContext = &pMac->p2pContext[P2PsessionId];
+    tANI_U32 ieLen = 0;
+#endif
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    if( !pSession->sessionActive || (CSR_SESSION_ID_INVALID == P2PsessionId)) 
+    {
+       smsLog(pMac, LOGE, FL("  session %d (P2P session %d) is invalid or listen is disabled "), 
+            p2pRemainonChn->sessionId, P2PsessionId);
+       return eHAL_STATUS_FAILURE;
+    }
+#else
+    if(!pSession->sessionActive) 
+    {
+       smsLog(pMac, LOGE, FL("  session %d is invalid or listen is disabled "), 
+            p2pRemainonChn->sessionId);
+       return eHAL_STATUS_FAILURE;
+    }
+#endif
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    P2P_GetIE(p2pContext, 
+              p2pContext->sessionId, eP2P_PROBE_RSP, 
+              &p2pContext->probeRspIe, &ieLen);
+    p2pContext->probeRspIeLength = ieLen;
+    len = sizeof(tSirRemainOnChnReq) + ieLen;
+#else
+    len = sizeof(tSirRemainOnChnReq) + pMac->p2pContext.probeRspIeLength;
+#endif
+
+    status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s call\n", __FUNCTION__);
+        palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirRemainOnChnReq));
+        pMsg->messageType = eWNI_SME_REMAIN_ON_CHANNEL_REQ;
+        pMsg->length = len;
+        palCopyMemory( pMac, pMsg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr) ); 
+        pMsg->chnNum = p2pRemainonChn->u.remainChlCmd.chn;
+        pMsg->phyMode = p2pRemainonChn->u.remainChlCmd.phyMode;
+        pMsg->duration = p2pRemainonChn->u.remainChlCmd.duration;
+        pMsg->sessionId = p2pRemainonChn->sessionId;
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+        pMsg->sessionId = pSession->sessionId;
+        if( p2pContext->probeRspIeLength )
+        {
+            palCopyMemory(pMac->hHdd, (void *)pMsg->probeRspIe,
+                         (void *)p2pContext->probeRspIe, 
+                         p2pContext->probeRspIeLength);
+        }
+#else
+        if( pMac->p2pContext.probeRspIeLength )
+           palCopyMemory(pMac->hHdd, (void *)pMsg->probeRspIe, (void *)pMac->p2pContext.probeRspIe, pMac->p2pContext.probeRspIeLength);
+#endif
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }
+    
+    return status;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * handle LIM remain on channel rsp: Success/failure.
+ *
+ *------------------------------------------------------------------*/
+
+eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
+{
+    eHalStatus                         status = eHAL_STATUS_SUCCESS;
+    tListElem                          *pEntry = NULL;
+    tSmeCmd                            *pCommand = NULL;
+
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    if( pEntry )
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if( eSmeCommandRemainOnChannel == pCommand->command )
+        {
+            remainOnChanCallback callback = pCommand->u.remainChlCmd.callback;
+            /* process the msg */
+            if( callback )
+                callback(pMac, pCommand->u.remainChlCmd.callbackCtx, 0);
+             
+            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+            {
+                //Now put this command back on the avilable command list
+                smeReleaseCommand(pMac, pCommand);
+            }
+            smeProcessPendingQueue( pMac );
+        }
+    }
+    return status;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * Handle the Mgmt frm ind from LIM and forward to HDD.
+ *
+ *------------------------------------------------------------------*/
+
+eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+    tCsrRoamInfo pRoamInfo = {0};
+#ifndef WLAN_FEATURE_P2P_INTERNAL
+    tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
+#endif
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    tANI_U8 i;
+
+    //For now, only action frames are needed.
+    if(SIR_MAC_MGMT_ACTION == pSmeMgmtFrm->frameType)
+    {
+       pRoamInfo.nFrameLength = pSmeMgmtFrm->mesgLen - sizeof(tSirSmeMgmtFrameInd);
+       pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
+       pRoamInfo.frameType = pSmeMgmtFrm->frameType;
+       pRoamInfo.rxChan   = pSmeMgmtFrm->rxChan;
+
+       //Somehow we don't get the right sessionId.
+       for(i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+       {
+          if( CSR_IS_SESSION_VALID( pMac, i ) )
+          {
+              status = eHAL_STATUS_SUCCESS;
+              /* forward the mgmt frame to all active sessions*/
+              csrRoamCallCallback(pMac, i, &pRoamInfo, 0, eCSR_ROAM_INDICATE_MGMT_FRAME, 0);
+          }
+       }
+    }
+#else
+    pRoamInfo.nFrameLength = pSmeMgmtFrm->mesgLen - sizeof(tSirSmeMgmtFrameInd);
+    pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
+    pRoamInfo.frameType = pSmeMgmtFrm->frameType;
+    pRoamInfo.rxChan   = pSmeMgmtFrm->rxChan;
+
+    /* forward the mgmt frame to HDD */
+    csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_INDICATE_MGMT_FRAME, 0);
+#endif
+
+    return status;
+}
+
+
+/*------------------------------------------------------------------
+ *
+ * Handle the remain on channel ready indication from PE
+ *
+ *------------------------------------------------------------------*/
+
+eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry = NULL;
+    tSmeCmd *pCommand = NULL;
+    tCsrRoamInfo RoamInfo; 
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    tSirSmeRsp *pRsp = (tSirSmeRsp *)pMsg;
+    //pRsp->sessionId is SME's session index
+    tANI_U8  P2PSessionID = getP2PSessionIdFromSMESessionId(pMac, pRsp->sessionId);
+
+    if(CSR_SESSION_ID_INVALID == P2PSessionID)
+    {
+       return eHAL_STATUS_FAILURE;
+    }
+#endif
+
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    if( pEntry )
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+        if( eSmeCommandRemainOnChannel == pCommand->command )
+        {
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+            if (pMac->p2pContext[P2PSessionID].PeerFound)
+            {
+                p2pRemainOnChannelReadyCallback(pMac, &pMac->p2pContext[P2PSessionID], eHAL_STATUS_SUCCESS);
+            }
+#else
+            /* forward the indication to HDD */
+            RoamInfo.pRemainCtx = pCommand->u.remainChlCmd.callbackCtx;
+            csrRoamCallCallback(pMac, ((tSirSmeRsp*)pMsg)->sessionId, &RoamInfo, 
+                                0, eCSR_ROAM_REMAIN_CHAN_READY, 0);
+#endif
+        }
+    }
+  
+    return status;
+}
+
+
+eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   eHalStatus  status = eHAL_STATUS_SUCCESS;
+   tCsrRoamInfo RoamInfo;
+   tSirSmeRsp* pSmeRsp = (tSirSmeRsp*)pMsg;
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+   tSirResultCodes rspStatus = pSmeRsp->statusCode;
+   tANI_U8 HDDsessionId = getP2PSessionIdFromSMESessionId(pMac, pSmeRsp->sessionId);
+   tANI_U8 *pBuf = NULL;
+   tp2pContext *pP2pContext;
+
+   if(CSR_SESSION_ID_INVALID == HDDsessionId)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+         " %s fail to get HDD sessionID (SMESessionID %d)", __FUNCTION__, pSmeRsp->sessionId);
+      return eHAL_STATUS_INVALID_PARAMETER;
+   }
+
+   pP2pContext = &pMac->p2pContext[HDDsessionId];
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s status %d Action Frame %d actionFrameTimeout %d\n", 
+         __FUNCTION__, pSmeRsp->statusCode, pP2pContext->actionFrameType
+         , pP2pContext->actionFrameTimeout);
+   vos_mem_zero(&RoamInfo, sizeof(tCsrRoamInfo));
+
+   if (pSmeRsp->statusCode != eSIR_SME_SUCCESS && !pP2pContext->actionFrameTimeout
+         && pP2pContext->pSentActionFrame)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Action frame:Ack not received. Retransmitting\n", __FUNCTION__);
+
+      if(NULL == pP2pContext->pNextActionFrm)
+      {
+         status = palTimerStart(pMac->hHdd, pP2pContext->retryActionFrameTimer, 
+                        ACTION_FRAME_RETRY_TIMEOUT * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+         if (!HAL_STATUS_SUCCESS(status))
+         {
+            smsLog(pMac, LOGE, " %s fail to start retryActionFrameTimerHandler\n", 
+               __FUNCTION__, pP2pContext->NextActionFrameType);
+         }
+         return status;
+      }
+      //In case if there is new frame to send, finish the current frame
+      else
+      {
+         smsLog(pMac, LOGE, " %s send next action frame type %d Last frame status (%d)",
+            __FUNCTION__, rspStatus);
+         //Force it to be success
+         rspStatus = eSIR_SME_SUCCESS;
+      }
+   }
+
+   if (pP2pContext->actionFrameTimer)
+   {
+      status = palTimerStop(pMac, pP2pContext->actionFrameTimer);
+   }
+
+   if (pP2pContext->retryActionFrameTimer)
+   {
+      status = palTimerStop(pMac, pP2pContext->retryActionFrameTimer);
+   }
+
+   if(pP2pContext->pSentActionFrame)
+   {
+      csrRoamCallCallback((tpAniSirGlobal)pP2pContext->hHal, 
+                     pP2pContext->SMEsessionId, &RoamInfo, 0, 
+                     eCSR_ROAM_SEND_ACTION_CNF, 
+                     ((rspStatus == eSIR_SME_SUCCESS) ? 
+                     eCSR_ROAM_RESULT_NONE: eCSR_ROAM_RESULT_SEND_ACTION_FAIL));
+   }
+
+   if(VOS_IS_STATUS_SUCCESS(vos_spin_lock_acquire(&pP2pContext->lState)))
+   {
+      if(pP2pContext->pSentActionFrame)
+      {
+         pBuf = pP2pContext->pSentActionFrame;
+         pP2pContext->pSentActionFrame = NULL;
+      }
+      vos_spin_lock_release(&pP2pContext->lState);
+
+      if(NULL != pBuf)
+      {
+         vos_mem_free(pBuf);
+         pBuf = NULL;
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, "%s pSentActionFrame is null \n", __FUNCTION__);
+      }
+      if(pP2pContext->pNextActionFrm)
+      {
+         //need to send the next action frame
+         pP2pContext->pSentActionFrame = pP2pContext->pNextActionFrm;
+         pP2pContext->ActionFrameLen = pP2pContext->nNextFrmLen;
+         pP2pContext->actionFrameType = pP2pContext->NextActionFrameType;
+         pP2pContext->pNextActionFrm = NULL;
+         pP2pContext->ActionFrameSendTimeout = pP2pContext->nNextFrameTimeOut;
+      }
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s cannot get lock1", __FUNCTION__);
+   }
+
+   if(NULL != pP2pContext->pSentActionFrame)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, " sending next frame %d type\n", 
+                  pP2pContext->NextActionFrameType);
+      status = palTimerStart(pMac->hHdd, pP2pContext->actionFrameTimer, 
+                        pP2pContext->ActionFrameSendTimeout * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, FL(" %s fail to start timer status %d"), __FUNCTION__, status);
+         //Without the timer we cannot continue
+         csrRoamCallCallback((tpAniSirGlobal)pP2pContext->hHal, 
+                     pP2pContext->SMEsessionId, &RoamInfo, 0, 
+                     eCSR_ROAM_SEND_ACTION_CNF, 
+                     eCSR_ROAM_RESULT_SEND_ACTION_FAIL);
+         vos_spin_lock_acquire(&pP2pContext->lState);
+         pBuf = pP2pContext->pSentActionFrame;
+         pP2pContext->pSentActionFrame = NULL;
+         vos_spin_lock_release(&pP2pContext->lState);
+         vos_mem_free(pBuf);
+         pBuf = NULL;
+         p2pFsm(pP2pContext, eP2P_TRIGGER_DISCONNECTED);
+         return status;
+      }
+      status = p2pSendActionFrame(pMac, pP2pContext->sessionId, pP2pContext->actionFrameType);
+      if(!HAL_STATUS_SUCCESS(status))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, " sending next frame %d type\n", 
+                  pP2pContext->NextActionFrameType);
+         status = palTimerStart(pMac->hHdd, pP2pContext->retryActionFrameTimer, 
+                     ACTION_FRAME_RETRY_TIMEOUT * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+         if (!HAL_STATUS_SUCCESS(status))
+         {
+            smsLog(pMac, LOGE, " %s fail to start retryActionFrameTimerHandler\n", __FUNCTION__);
+         }
+      }
+   }
+   else
+   {
+      p2pFsm(pP2pContext, eP2P_TRIGGER_DISCONNECTED);
+   }
+    
+#else  
+    /* forward the indication to HDD */
+    //RoamInfo can be passed as NULL....todo
+    csrRoamCallCallback(pMac, pSmeRsp->sessionId, &RoamInfo, 0, 
+                        eCSR_ROAM_SEND_ACTION_CNF, 
+                       (pSmeRsp->statusCode == eSIR_SME_SUCCESS) ? 0:
+                        eCSR_ROAM_RESULT_SEND_ACTION_FAIL);
+#endif    
+    return status;
+}
+
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+void p2pResetContext(tp2pContext *pP2pContext)
+{
+   if(NULL != pP2pContext)
+   {
+      tpAniSirGlobal pMac = PMAC_STRUCT(pP2pContext->hHal);
+      int i;
+
+      //When it is resetting a GO or client session, we
+      //need to reset the group capability back to the original one
+      if( (OPERATION_MODE_P2P_GROUP_OWNER == pP2pContext->operatingmode) ||
+         (OPERATION_MODE_P2P_CLIENT == pP2pContext->operatingmode) )
+      {
+         for( i = 0; i < MAX_NO_OF_P2P_SESSIONS; i++ )
+         {
+            if(OPERATION_MODE_P2P_DEVICE == pMac->p2pContext[i].operatingmode)
+            {
+               gP2PIe[i].p2pCapabilityAttrib.groupCapability = pMac->p2pContext[i].OriginalGroupCapability;
+            }
+         }
+      }
+
+      pP2pContext->state = eP2P_STATE_DISCONNECTED;
+      pP2pContext->currentSearchIndex = 0;
+      pP2pContext->listenIndex = 1;
+
+      pP2pContext->actionFrameType = eP2P_INVALID_FRM;
+
+      pP2pContext->dialogToken = 0;
+      pP2pContext->PeerFound = FALSE;
+      pP2pContext->GroupFormationPending = FALSE;
+      pP2pContext->directedDiscovery = FALSE;
+      pP2pContext->listenDiscoverableState = eStateDisabled;
+
+
+      if(pP2pContext->pSentActionFrame)
+      {
+         vos_mem_free(pP2pContext->pSentActionFrame);
+         pP2pContext->pSentActionFrame = NULL;
+      }
+      if(pP2pContext->pNextActionFrm)
+      {
+         vos_mem_free(pP2pContext->pSentActionFrame);
+         pP2pContext->pSentActionFrame = NULL;
+      }      
+      if( pP2pContext->probeRspIe )
+      {
+         vos_mem_free( pP2pContext->probeRspIe );
+         pP2pContext->probeRspIe = NULL;
+         pP2pContext->probeRspIeLength = 0;
+      }
+
+      if( pP2pContext->DiscoverReqIeField )
+      {
+         vos_mem_free(pP2pContext->DiscoverReqIeField );
+         pP2pContext->DiscoverReqIeField = NULL;
+         pP2pContext->DiscoverReqIeLength = 0;
+      }
+
+      if( pP2pContext->GoNegoCnfIeField )
+      {
+         vos_mem_free( pP2pContext->GoNegoCnfIeField);
+         pP2pContext->GoNegoCnfIeField = NULL;
+         pP2pContext->GoNegoCnfIeLength = 0;
+      }
+
+      if( pP2pContext->GoNegoReqIeField )
+      {
+         vos_mem_free( pP2pContext->GoNegoReqIeField );
+         pP2pContext->GoNegoReqIeField = NULL;
+         pP2pContext->GoNegoReqIeLength = 0;
+      }
+
+      if( pP2pContext->GoNegoResIeField )
+      {
+         vos_mem_free( pP2pContext->GoNegoResIeField );
+         pP2pContext->GoNegoResIeField = NULL;
+         pP2pContext->GoNegoResIeLength = 0;
+      }
+
+      if( pP2pContext->ProvDiscReqIeField )
+      {
+         vos_mem_free( pP2pContext->ProvDiscReqIeField );
+         pP2pContext->ProvDiscReqIeField = NULL;
+         pP2pContext->ProvDiscReqIeLength = 0;
+      }
+
+      if( pP2pContext->ProvDiscResIeField )
+      {
+         vos_mem_free( pP2pContext->ProvDiscResIeField );
+         pP2pContext->ProvDiscResIeLength = 0;
+         pP2pContext->ProvDiscResIeField = NULL;
+      }
+
+      if (pP2pContext->actionFrameTimer)
+      {
+         palTimerStop(pMac->hHdd, pP2pContext->actionFrameTimer);
+      }
+
+      if (pP2pContext->discoverTimer)
+      {
+         palTimerStop(pMac->hHdd, pP2pContext->discoverTimer);
+      }
+
+      if (pP2pContext->listenTimerHandler)
+      {
+         palTimerStop(pMac->hHdd, pP2pContext->listenTimerHandler);
+      }
+
+      if (pP2pContext->WPSRegistrarCheckTimerHandler)
+      {
+         palTimerStop(pMac->hHdd, pP2pContext->WPSRegistrarCheckTimerHandler);
+      }
+
+      if (pP2pContext->directedDiscoveryFilter)
+      {
+         pP2pContext->uNumDeviceFilterAllocated = 0;
+         vos_mem_free(pP2pContext->directedDiscoveryFilter);
+         pP2pContext->directedDiscoveryFilter = NULL;
+      }
+
+      vos_mem_zero(pP2pContext->peerMacAddress, P2P_MAC_ADDRESS_LEN);
+   }
+}
+#endif    
+
+
+eHalStatus sme_p2pOpen( tHalHandle hHal )
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+   int i;
+   tp2pContext *pP2pContext;
+
+   for ( i=0; i < MAX_NO_OF_P2P_SESSIONS; i++ ) 
+   {
+      pP2pContext = &pMac->p2pContext[i];
+      pP2pContext->hHal = hHal;
+
+      pP2pContext->socialChannel[0] = 1;
+      pP2pContext->socialChannel[1] = 6;
+      pP2pContext->socialChannel[2] = 11;
+
+      vos_spin_lock_init(&pP2pContext->lState);
+
+      p2pResetContext(pP2pContext);
+
+      status = palTimerAlloc(pMac->hHdd, &pP2pContext->actionFrameTimer, 
+                                    p2pActionFrameTimerHandler, pP2pContext);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, " %s fail to alloc actionFrame timer for session %d\n", __FUNCTION__, i);
+         break;
+      }
+      status = palTimerAlloc(pMac->hHdd, &pP2pContext->listenTimerHandler, 
+                              p2pListenDiscoverTimerHandler, pP2pContext);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, " %s fail to alloc listen timer for session %d\n", __FUNCTION__, i);
+         break;
+      } 
+      status = palTimerAlloc(pMac->hHdd, &pP2pContext->discoverTimer, p2pDiscoverTimerHandler, pP2pContext);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, " %s fail to alloc discover timer for session %d\n", __FUNCTION__, i);
+         break;
+      }
+
+      status = palTimerAlloc(pMac->hHdd, &pP2pContext->retryActionFrameTimer, 
+                     p2pRetryActionFrameTimerHandler, pP2pContext);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, " %s fail to alloc retryActionFrameTimerHandler timer for session %d\n", __FUNCTION__, i);
+         break;
+      }
+
+      p2pCreateDefaultIEs(hHal, i);
+   }
+#else
+   //If static structure is too big, Need to change this function to allocate memory dynamically
+   vos_mem_zero( &pMac->p2pContext, sizeof( tp2pContext ) );
+#endif
+
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      sme_p2pClose(hHal);
+    }
+
+   return status;
+}
+
+
+eHalStatus p2pStop( tHalHandle hHal )
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+   int i;
+
+   for ( i = 0; i < MAX_NO_OF_P2P_SESSIONS; i++ ) 
+   {
+      p2pCloseSession(pMac, i);
+   }
+#else  
+   if( pMac->p2pContext.probeRspIe )
+   {
+      vos_mem_free( pMac->p2pContext.probeRspIe );
+      pMac->p2pContext.probeRspIe = NULL;
+   }
+  
+   pMac->p2pContext.probeRspIeLength = 0;
+#endif
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus sme_p2pClose( tHalHandle hHal )
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+   tp2pContext *pContext;
+   int i;
+
+   p2pStop(hHal);
+
+   for ( i = 0; i < MAX_NO_OF_P2P_SESSIONS; i++ ) 
+   {
+      p2pCloseSession(pMac, i);
+      pContext = &pMac->p2pContext[i];
+      if (pContext->actionFrameTimer)
+      {
+         palTimerFree(hHal, pContext->actionFrameTimer);
+         pContext->actionFrameTimer = NULL;
+      }
+
+      if (pContext->discoverTimer)
+      {
+         palTimerFree(hHal, pContext->discoverTimer);
+         pContext->discoverTimer = NULL;
+      }
+
+      if (pContext->listenTimerHandler)
+      {
+         palTimerFree(hHal, pContext->listenTimerHandler);
+         pContext->listenTimerHandler = NULL;
+      }
+
+      if (pContext->WPSRegistrarCheckTimerHandler)
+      {
+         palTimerFree(hHal, pContext->WPSRegistrarCheckTimerHandler);
+         pContext->WPSRegistrarCheckTimerHandler = NULL;
+      }
+
+      vos_spin_lock_destroy(&pContext->lState);
+   }
+#else  
+    if( pMac->p2pContext.probeRspIe )
+    {
+        vos_mem_free( pMac->p2pContext.probeRspIe );
+        pMac->p2pContext.probeRspIe = NULL;
+    }
+  
+    pMac->p2pContext.probeRspIeLength = 0;
+#endif
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+tSirRFBand GetRFBand(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;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn p2pRemainOnChannel
+    \brief  API to post the remain on channel command.
+    \param  hHal - The handle returned by macOpen.
+    \param  sessinId - HDD session ID.
+    \param  channel - Channel to remain on channel.
+    \param  duration - Duration for which we should remain on channel
+    \param  callback - callback function.
+    \param  pContext - argument to the callback function
+    \return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus p2pRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
+         tANI_U8 channel, tANI_U32 duration,
+        remainOnChanCallback callback, 
+        void *pContext
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+        , eP2PRemainOnChnReason reason
+#endif
+        )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSmeCmd *pRemainChlCmd = NULL;
+    tANI_U32 phyMode;
+  
+    pRemainChlCmd = smeGetCommandBuffer(pMac);
+    if(pRemainChlCmd == NULL)
+        return eHAL_STATUS_FAILURE;
+  
+    if (SIR_BAND_5_GHZ == GetRFBand(channel))
+    {
+       phyMode = WNI_CFG_PHY_MODE_11A;
+    }
+    else
+    {
+       phyMode = WNI_CFG_PHY_MODE_11G;
+    }
+    
+    cfgSetInt(pMac, WNI_CFG_PHY_MODE, phyMode);
+
+    do
+    {
+        /* call set in context */
+        pRemainChlCmd->command = eSmeCommandRemainOnChannel;
+        pRemainChlCmd->sessionId = sessionId;
+        pRemainChlCmd->u.remainChlCmd.chn = channel;
+        pRemainChlCmd->u.remainChlCmd.duration = duration;
+        pRemainChlCmd->u.remainChlCmd.callback = callback;
+        pRemainChlCmd->u.remainChlCmd.callbackCtx = pContext;
+    
+        //Put it at the head of the Q if we just finish finding the peer and ready to send a frame
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+        smePushCommand(pMac, pRemainChlCmd, (eP2PRemainOnChnReasonSendFrame == reason));
+#else
+        csrQueueSmeCommand(pMac, pRemainChlCmd, eANI_BOOLEAN_FALSE);
+#endif
+    } while(0);
+  
+    smsLog(pMac, LOGW, "exiting function %s\n", __FUNCTION__);
+  
+    return(status);
+}
+
+eHalStatus p2pSendAction(tHalHandle hHal, tANI_U8 sessionId,
+         const tANI_U8 *pBuf, tANI_U32 len)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirMbMsgP2p *pMsg;
+    tANI_U16 msgLen;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED,
+       " %s sends action frame", __FUNCTION__);
+    msgLen = (tANI_U16)((sizeof( tSirMbMsg )) + len);
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
+        pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_SEND_ACTION_FRAME_IND);
+        pMsg->msgLen = pal_cpu_to_be16(msgLen);
+        pMsg->sessionId = sessionId;
+        palCopyMemory( pMac->hHdd, pMsg->data, pBuf, len ); 
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }                             
+
+    return( status );
+}
+
+eHalStatus p2pCancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirMbMsg *pMsg;
+    tANI_U16 msgLen;
+
+    //Need to check session ID to support concurrency
+
+    msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
+        pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_ABORT_REMAIN_ON_CHAN_IND);
+        pMsg->msgLen = pal_cpu_to_be16(msgLen);
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }                             
+
+    return( status );
+}
+
+eHalStatus p2pSetPs(tHalHandle hHal, tP2pPsConfig *pNoA)
+{
+    tpP2pPsConfig pNoAParam;
+    tSirMsgQ msg;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = palAllocateMemory(pMac->hHdd, (void**)&pNoAParam, sizeof(tP2pPsConfig));
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pNoAParam, sizeof(tP2pPsConfig));
+        palCopyMemory(pMac->hHdd, pNoAParam, pNoA, sizeof(tP2pPsConfig)); 
+        msg.type = eWNI_SME_UPDATE_NOA;
+        msg.bodyval = 0;
+        msg.bodyptr = pNoAParam;
+        limPostMsgApi(pMac, &msg);
+    }   
+    return status;
+}
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+eHalStatus p2pGetConfigParam(tHalHandle hHal, tP2PConfigParam *pParam)
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   if(pParam)
+   {
+      pParam->P2PListenChannel = pMac->p2pContext[0].P2PListenChannel;
+      pParam->P2POperatingChannel = pMac->p2pContext[0].P2POperatingChannel;
+      pParam->P2POpPSCTWindow = pMac->p2pContext[0].pNoA.ctWindow;
+      pParam->P2PPSSelection = pMac->p2pContext[0].pNoA.psSelection;
+      pParam->P2POpPSCTWindow = pMac->p2pContext[0].pNoA.ctWindow;
+      pParam->P2PNoADuration = pMac->p2pContext[0].pNoA.duration;
+      pParam->P2PNoACount = pMac->p2pContext[0].pNoA.count;
+      pParam->P2PNoAInterval = pMac->p2pContext[0].pNoA.interval;
+
+      status = eHAL_STATUS_SUCCESS;
+   }
+
+   return (status);
+}
+
+eHalStatus p2pChangeDefaultConfigParam(tHalHandle hHal, tP2PConfigParam *pParam)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   int i;
+   tANI_U8 pBuf[P2P_COUNTRY_CODE_LEN];
+   tANI_U8 uBufLen = P2P_COUNTRY_CODE_LEN;
+   tP2P_OperatingChannel p2pChannel;
+
+   status = sme_GetCountryCode( pMac, pBuf, &uBufLen );
+   if ( !HAL_STATUS_SUCCESS( status ) )
+   {
+      status = eHAL_STATUS_FAILURE;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s Cannot get the country code\n", __FUNCTION__);
+   }
+
+   vos_mem_copy(p2pChannel.countryString, pBuf, sizeof(pBuf));
+   p2pChannel.regulatoryClass = 0x51;
+
+   if(pParam)
+   {
+      for ( i=0; i < MAX_NO_OF_P2P_SESSIONS; i++ ) 
+      {
+         if (pParam->P2PListenChannel == 1 || pParam->P2PListenChannel == 6 
+               || pParam->P2PListenChannel == 11)
+         {
+            pMac->p2pContext[i].P2PListenChannel = pParam->P2PListenChannel;
+         }
+         else
+         {
+            pMac->p2pContext[i].P2PListenChannel = P2P_OPERATING_CHANNEL;
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+               "Invalid P2P Listen Channel in config. Switch to default Listen Channel %d\n",
+               __FUNCTION__, P2P_OPERATING_CHANNEL);
+         }
+         
+         if(csrRoamIsChannelValid(pMac, pParam->P2POperatingChannel))
+         {
+            pMac->p2pContext[i].P2POperatingChannel = pParam->P2POperatingChannel;
+         }
+         else
+         {
+            pMac->p2pContext[i].P2POperatingChannel = P2P_OPERATING_CHANNEL;
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+               "Invalid P2P Operating Channel in config. Switch to default Channel %d\n", 
+               __FUNCTION__, P2P_OPERATING_CHANNEL);
+         }
+         pMac->p2pContext[i].pNoA.ctWindow = pParam->P2POpPSCTWindow;
+         pMac->p2pContext[i].pNoA.psSelection = pParam->P2PPSSelection;
+         pMac->p2pContext[i].pNoA.ctWindow = pParam->P2POpPSCTWindow;
+         pMac->p2pContext[i].pNoA.duration = pParam->P2PNoADuration;
+         pMac->p2pContext[i].pNoA.count = pParam->P2PNoACount;
+         pMac->p2pContext[i].pNoA.interval = pParam->P2PNoAInterval;
+
+         p2pChannel.channel = pMac->p2pContext[i].P2POperatingChannel;
+         P2P_UpdateIE(pMac, i, eWFD_OPERATING_CHANNEL, &p2pChannel, 1);
+         p2pChannel.channel = pMac->p2pContext[i].P2PListenChannel;
+         P2P_UpdateIE(pMac, i, eWFD_LISTEN_CHANNEL, &p2pChannel, 1);
+      }
+   }
+
+    return status;
+}
+
+eHalStatus p2pPS(tHalHandle hHal, tANI_U8 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tP2pPsConfig pNoA;
+
+   /* call set in context */
+   pNoA.psSelection = pMac->p2pContext[sessionId].pNoA.psSelection;
+   pNoA.sessionid = sessionId;
+
+   if (pMac->p2pContext[sessionId].pNoA.psSelection == P2P_CLEAR_POWERSAVE)
+   {
+      return status;
+   }
+
+   if (pMac->p2pContext[sessionId].pNoA.psSelection == P2P_OPPORTUNISTIC_PS)
+   {
+      pNoA.opp_ps = TRUE;
+      pNoA.ctWindow = pMac->p2pContext[sessionId].pNoA.ctWindow;
+      pNoA.count = 0;
+      pNoA.duration = 0;
+      pNoA.interval = 0; 
+      pNoA.single_noa_duration = 0;
+   }
+   else if (pMac->p2pContext[sessionId].pNoA.psSelection == P2P_PERIODIC_NOA)
+   {
+      pNoA.opp_ps = 0;
+      pNoA.ctWindow = 0;
+      pNoA.count = pMac->p2pContext[sessionId].pNoA.count;
+      pNoA.duration = pMac->p2pContext[sessionId].pNoA.duration;
+      pNoA.interval = pMac->p2pContext[sessionId].pNoA.interval; 
+      pNoA.single_noa_duration = 0;
+   } 
+   else if(pMac->p2pContext[sessionId].pNoA.psSelection == P2P_SINGLE_NOA)
+   {
+      pNoA.opp_ps = 0;
+      pNoA.ctWindow = 0;
+      pNoA.count = 0;
+      pNoA.duration = 0;
+      pNoA.interval = 0; 
+      pNoA.single_noa_duration = pMac->p2pContext[sessionId].pNoA.duration;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+      " %s HDDSession %d set NoA parameters. Selection %d, opp_ps %d, ctWindow %d, count %d, "
+      "duration %d, interval %d single NoA duration %d",
+      __FUNCTION__, sessionId, pMac->p2pContext[sessionId].pNoA.psSelection,
+      pNoA.opp_ps, pNoA.ctWindow, pNoA.count, pNoA.duration, 
+      pNoA.interval, pNoA.single_noa_duration );
+
+   status = sme_p2pSetPs(pMac, &pNoA);
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      smsLog(pMac, LOGE, FL(" sme_p2pSetPs fail with status %d"), status);
+      return status;
+   }
+
+   return status;
+}
+
+void P2P_UpdateMacHdr(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 *pBuf)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tSirMacMgmtHdr *macHdr = (tSirMacMgmtHdr *)pBuf;
+
+   macHdr->fc.protVer = 0;
+   macHdr->fc.type = 0;
+   macHdr->fc.subType = 13;
+   macHdr->durationLo = 0;
+   macHdr->durationHi = 0;
+   vos_mem_copy(macHdr->da, pMac->p2pContext[SessionID].peerMacAddress, P2P_MAC_ADDRESS_LEN);
+   vos_mem_copy(macHdr->sa, pMac->p2pContext[SessionID].selfMacAddress, P2P_MAC_ADDRESS_LEN);
+   vos_mem_copy(macHdr->bssId, pMac->p2pContext[SessionID].peerMacAddress, P2P_MAC_ADDRESS_LEN);
+
+   return;
+}
+
+static eHalStatus p2pRemainOnChannelReadyCallback(tHalHandle halHandle,
+                     void *pContext,
+                     eHalStatus scan_status)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s GroupFormationPending %d  PeerFound %d\n", 
+               __FUNCTION__, p2pContext->GroupFormationPending, p2pContext->PeerFound);
+
+   if (p2pContext->PeerFound)
+   {
+      p2pContext->PeerFound = FALSE;
+
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Sending actionframe\n", __FUNCTION__);
+      if (p2pContext->pSentActionFrame)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s calling p2pSendAction\n", __FUNCTION__);
+         p2pSendAction(halHandle, p2pContext->SMEsessionId, (tANI_U8 *)p2pContext->pSentActionFrame, p2pContext->ActionFrameLen);
+      }
+   }
+
+   return status;
+}
+
+eHalStatus p2pGrpFormationRemainOnChanRspCallback(tHalHandle halHandle, void *pContext, tANI_U32 scanId, eCsrScanStatus scan_status)
+{
+   return eHAL_STATUS_SUCCESS;
+}
+
+tANI_U8 p2pGetDialogToken(tHalHandle hHal, tANI_U8 SessionID, eP2PFrameType actionFrameType)
+{
+   tANI_U8 dialogToken = 0;
+
+   dialogToken = (tANI_U8) vos_timer_get_system_ticks();
+
+   return(dialogToken);
+}
+
+void p2pRetryActionFrameTimerHandler(void *pContext)
+{
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT( p2pContext->hHal );
+
+   p2pContext->PeerFound = TRUE;
+   smsLog( pMac, LOGE, "%s Calling remain on channel \n", __FUNCTION__);
+   status = p2pRemainOnChannel( pMac, p2pContext->SMEsessionId, p2pContext->P2PListenChannel/*pScanResult->BssDescriptor.channelId*/, P2P_REMAIN_ON_CHAN_TIMEOUT_LOW,
+                                    NULL, NULL, eP2PRemainOnChnReasonSendFrame);
+   if(status != eHAL_STATUS_SUCCESS)
+   {
+      smsLog( pMac, LOGE, "%s remain on channel failed\n", __FUNCTION__);
+   }
+
+   return;
+}
+
+void p2pActionFrameTimerHandler(void *pContext)
+{
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tANI_U8 *pBuf = NULL, *pNextBuf = NULL;
+   tCsrRoamInfo roamInfo;
+
+
+   if(p2pContext->pSentActionFrame)
+   {
+      vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
+      csrRoamCallCallback((tpAniSirGlobal)p2pContext->hHal, p2pContext->SMEsessionId, &roamInfo, 0, 
+                          eCSR_ROAM_SEND_ACTION_CNF, 
+                          eCSR_ROAM_RESULT_SEND_ACTION_FAIL);
+   }
+
+   if(VOS_IS_STATUS_SUCCESS(vos_spin_lock_acquire(&p2pContext->lState)))
+   {
+      if(p2pContext->pSentActionFrame)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
+            " %s actionframe timeout type %d", __FUNCTION__, p2pContext->actionFrameType);
+         pBuf = p2pContext->pSentActionFrame;
+         p2pContext->pSentActionFrame = NULL;
+      }
+      if(p2pContext->pNextActionFrm)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
+            " %s next actionframe timeout type %d", __FUNCTION__, p2pContext->NextActionFrameType);
+         pNextBuf = p2pContext->pNextActionFrm;
+         p2pContext->pNextActionFrm = NULL;
+      }
+      vos_spin_lock_release(&p2pContext->lState);
+
+      if(pBuf)
+      {
+         vos_mem_free(pBuf);
+      }
+      if(pNextBuf)
+      {
+         //Inform the failure of the next frame.
+         p2pContext->pSentActionFrame = pNextBuf;
+         p2pContext->ActionFrameLen = p2pContext->nNextFrmLen;
+         p2pContext->actionFrameType = p2pContext->NextActionFrameType;
+         vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
+         csrRoamCallCallback((tpAniSirGlobal)p2pContext->hHal, p2pContext->SMEsessionId, &roamInfo, 0, 
+                          eCSR_ROAM_SEND_ACTION_CNF, 
+                          eCSR_ROAM_RESULT_SEND_ACTION_FAIL);
+         p2pContext->pSentActionFrame = NULL;
+         vos_mem_free(pNextBuf);
+      }
+   }
+   status = p2pFsm(p2pContext, eP2P_TRIGGER_DISCONNECTED);
+   p2pContext->actionFrameTimeout = TRUE;
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s timedout\n", __FUNCTION__);
+
+   return;
+}
+
+
+eHalStatus p2pCreateActionFrame(tpAniSirGlobal pMac, tANI_U8 SessionID, void *p2pactionframe, 
+                                 eP2PFrameType actionFrameType, tANI_U8 **ppFrm)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tANI_U32 len = 0;
+   tANI_U32 nActionFrmlen = 0, pendingFrameLen;
+   tANI_U8 *pActionFrm = NULL;
+   tANI_U8 *pBuf = NULL, *pLocal = NULL;
+   eP2PFrameType pendingActionFrameType;
+   tp2pContext *pP2pContext = &pMac->p2pContext[SessionID];
+
+   if(NULL == ppFrm)
+   {
+      smsLog(pMac, LOGE, FL("  invalid parameters"));
+      return eHAL_STATUS_FAILURE;
+   }
+
+   csrScanAbortMacScan(pMac);
+
+   switch (actionFrameType)
+   {
+   case eP2P_GONEGO_REQ:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_GO_NEGOTIATION_REQUEST, p2pactionframe, len);
+      break;
+
+   case eP2P_GONEGO_RES:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_GO_NEGOTIATION_RESPONSE, p2pactionframe, len);
+      break;
+
+   case eP2P_GONEGO_CNF:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_GO_NEGOTIATION_CONFIRMATION, p2pactionframe, len);
+      break;
+
+   case eP2P_PROVISION_DISCOVERY_REQUEST:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_PROVISION_DISCOVERY_REQUEST, p2pactionframe, len);
+      break;
+
+   case eP2P_PROVISION_DISCOVERY_RESPONSE:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_PROVISION_DISCOVERY_RESPONSE, p2pactionframe, len);
+      break;
+
+   case eP2P_INVITATION_REQ:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_INVITATION_REQUEST, p2pactionframe, len);
+      break;
+
+   case eP2P_INVITATION_RSP:
+      status = P2P_UpdateIE(pMac, SessionID, eWFD_SEND_INVITATION_RESPONSE, p2pactionframe, len);
+      break;
+   default:
+      return status;
+   }
+
+   status = P2P_GetActionFrame(pMac, SessionID, actionFrameType, &pActionFrm, &nActionFrmlen);
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      smsLog(pMac, LOGE, FL(" P2P_GetActionFrame fail with status %d"), status);
+      return status;
+   }
+
+   P2P_UpdateMacHdr(pMac, SessionID, pActionFrm);
+
+   pBuf = (tANI_U8 *)vos_mem_malloc( nActionFrmlen);
+   if(NULL == pBuf)
+   {
+      smsLog(pMac, LOGE, FL("  fail to allocate memory"));
+      if (pActionFrm) 
+         vos_mem_free(pActionFrm);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   vos_mem_copy(pBuf, pActionFrm, nActionFrmlen);
+   vos_mem_free(pActionFrm);
+
+   if( !VOS_IS_STATUS_SUCCESS(vos_spin_lock_acquire(&pP2pContext->lState)))
+   {
+      smsLog(pMac, LOGE, FL("  fail to acquire spinlock"));
+      vos_mem_free(pBuf);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   if(NULL != pP2pContext->pSentActionFrame)
+   {
+      //If there is one pending frame already. Drop that one and save the new one
+      pLocal = pP2pContext->pNextActionFrm;
+      pendingActionFrameType = pP2pContext->NextActionFrameType;
+      pendingFrameLen = pP2pContext->nNextFrmLen;
+      pP2pContext->pNextActionFrm = pBuf;
+      pP2pContext->nNextFrmLen = nActionFrmlen;
+      pP2pContext->NextActionFrameType = actionFrameType;
+      *ppFrm = NULL;
+   }
+   else
+   {
+      pP2pContext->pSentActionFrame = pBuf;
+      pP2pContext->ActionFrameLen = nActionFrmlen;
+      pP2pContext->actionFrameType = actionFrameType;
+      *ppFrm = pBuf;
+   }
+   vos_spin_lock_release(&pP2pContext->lState);
+
+   if(NULL != pLocal)
+   {
+      smsLog(pMac, LOGE, FL(" Drop a waiting action frame 0x%x, type %d lenth %d"), 
+         pLocal, pendingActionFrameType, pendingFrameLen);
+      vos_mem_free(pLocal);
+   }
+
+   return status;
+}
+
+
+extern eHalStatus p2pGetSSID(tANI_U8 *ssId, tANI_U32 *ssIdLen, tANI_U8 SessionID);
+
+static eHalStatus p2pSendActionFrame(tpAniSirGlobal pMac, tANI_U8 HDDSessionID, eP2PFrameType actionFrameType)
+{
+   tCsrScanResultFilter filter;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tScanResultHandle hScanResult = NULL;
+   tCsrScanResultInfo   *pScanResult   = NULL;
+   tANI_U8 ssId[SIR_MAC_MAX_SSID_LENGTH];
+   tANI_U32 ssIdLen = 0;
+   tp2pContext *pP2pContext = &pMac->p2pContext[HDDSessionID];
+
+   pP2pContext->GroupFormationPending = TRUE;
+   if (actionFrameType == eP2P_GONEGO_REQ || actionFrameType == eP2P_PROVISION_DISCOVERY_REQUEST 
+      || actionFrameType == eP2P_INVITATION_REQ)
+   {
+      vos_mem_zero(&filter, sizeof(filter));
+      filter.BSSIDs.numOfBSSIDs = 1;
+      filter.BSSIDs.bssid = &pP2pContext->peerMacAddress;
+      filter.bWPSAssociation = TRUE;
+      filter.BSSType = eCSR_BSS_TYPE_ANY;
+
+      status = csrScanGetResult(pMac, &filter, &hScanResult);
+
+      if (hScanResult)
+      {
+         pScanResult = csrScanResultGetFirst(pMac, hScanResult );
+         if(pScanResult)
+         {
+
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s found match on channel %d", 
+               __FUNCTION__, pScanResult->BssDescriptor.channelId);
+            pP2pContext->formationReq.targetListenChannel = pScanResult->BssDescriptor.channelId;
+            if(pP2pContext->P2PListenChannel != pScanResult->BssDescriptor.channelId)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+                  "%s adapt listen channel to %d", 
+                  __FUNCTION__, pScanResult->BssDescriptor.channelId);
+               p2pSetListenChannel(pMac, pP2pContext->sessionId, pScanResult->BssDescriptor.channelId);
+            }
+            vos_mem_copy(pP2pContext->formationReq.deviceAddress, pScanResult->BssDescriptor.bssId, P2P_MAC_ADDRESS_LEN);
+         }
+         csrScanResultPurge(pMac, hScanResult);
+      } 
+      else 
+      {
+         vos_mem_zero(&filter, sizeof(filter));
+         filter.bWPSAssociation = TRUE;
+         filter.BSSType = eCSR_BSS_TYPE_ANY;
+         filter.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo));
+         if( filter.SSIDs.SSIDList == NULL )
+         {
+            smsLog( pMac, LOGP, FL("vos_mem_malloc failed:") );
+            pP2pContext->GroupFormationPending = FALSE;
+            return eHAL_STATUS_FAILURE;
+         }
+         vos_mem_zero( filter.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) );
+         p2pGetSSID(ssId, &ssIdLen, HDDSessionID);
+
+         if (ssIdLen)
+         {
+            filter.SSIDs.SSIDList->SSID.length = ssIdLen;
+            vos_mem_copy(&filter.SSIDs.SSIDList[0].SSID.ssId, &ssId, ssIdLen);
+            filter.SSIDs.numOfSSIDs = 1;
+            status = csrScanGetResult(pMac, &filter, &hScanResult);
+            if (hScanResult)
+            {
+               pScanResult = csrScanResultGetFirst(pMac, hScanResult );
+               pP2pContext->formationReq.targetListenChannel = pScanResult->BssDescriptor.channelId;
+               vos_mem_copy(pP2pContext->formationReq.deviceAddress, pScanResult->BssDescriptor.bssId, P2P_MAC_ADDRESS_LEN);
+               csrScanResultPurge(pMac, hScanResult);
+            }
+            else
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s not found match\n", __FUNCTION__);
+               pP2pContext->formationReq.targetListenChannel = 0;
+               vos_mem_copy(pP2pContext->formationReq.deviceAddress, pP2pContext->peerMacAddress, P2P_MAC_ADDRESS_LEN);
+               status = eHAL_STATUS_SUCCESS;
+            }
+            vos_mem_free(filter.SSIDs.SSIDList);
+         }
+         else
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s not found match\n", __FUNCTION__);
+            pP2pContext->formationReq.targetListenChannel = 0;
+            vos_mem_copy(pP2pContext->formationReq.deviceAddress, pP2pContext->peerMacAddress, P2P_MAC_ADDRESS_LEN);
+            status = eHAL_STATUS_SUCCESS;
+         }    
+      }
+      sme_CancelRemainOnChannel(pMac, pP2pContext->SMEsessionId );
+      p2pFsm(pP2pContext, eP2P_TRIGGER_GROUP_FORMATION);     
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, " %s send action frame %d timeout %d\n", 
+               __FUNCTION__, actionFrameType, pP2pContext->ActionFrameSendTimeout);
+   } 
+   else
+   {
+      pP2pContext->PeerFound = TRUE;
+
+      status = p2pSendAction(pMac, pP2pContext->SMEsessionId, (tANI_U8 *)pP2pContext->pSentActionFrame, 
+                              pP2pContext->ActionFrameLen);
+      if(status != eHAL_STATUS_SUCCESS)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,  
+            "%s p2pSendAction failed to send frame type %d\n", __FUNCTION__, actionFrameType);
+         pP2pContext->GroupFormationPending = FALSE;
+         return status;
+      }
+
+      if ( actionFrameType == eP2P_GONEGO_RES )
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Calling p2pRemainOnChannel with duration"
+            "%d on channel %d\n", __FUNCTION__, P2P_REMAIN_ON_CHAN_TIMEOUT, pP2pContext->P2PListenChannel);
+
+         if(p2pRemainOnChannel( pMac, pP2pContext->SMEsessionId, 
+                                      pP2pContext->P2PListenChannel, P2P_REMAIN_ON_CHAN_TIMEOUT_LOW,
+                                      NULL, NULL, eP2PRemainOnChnReasonSendFrame))
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,  "%s remain on channel failed\n", __FUNCTION__);
+         }
+      }
+   }
+
+   return(status);
+}
+
+
+#define WLAN_P2P_DEF_ACTION_FRM_TIMEOUT_VALUE 1000  //1s
+
+eHalStatus p2pCreateSendActionFrame(tHalHandle hHal, tANI_U8 HDDSessionID, 
+   void *p2pactionframe, eP2PFrameType actionFrameType, tANI_U32 timeout)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tANI_U8 *pBuf = NULL;
+   tp2pContext *pP2pContext = &pMac->p2pContext[HDDSessionID];
+   
+   status = p2pCreateActionFrame(pMac, HDDSessionID, p2pactionframe, actionFrameType, &pBuf);
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      smsLog(pMac, LOGE, FL("  fail to create action frame"));
+      return status;
+   }
+      
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, " %s send action frame %d timeout %d\n", 
+                  __FUNCTION__, actionFrameType, timeout);
+
+   if(NULL != pBuf)
+   {
+      if (timeout)
+      {
+         pP2pContext->ActionFrameSendTimeout = timeout;
+      }
+      else
+      {
+         pP2pContext->ActionFrameSendTimeout = WLAN_P2P_DEF_ACTION_FRM_TIMEOUT_VALUE;
+      }
+
+      status = palTimerStart(pMac->hHdd, pP2pContext->actionFrameTimer, 
+                        pP2pContext->ActionFrameSendTimeout * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
+      if (!HAL_STATUS_SUCCESS(status))
+      {
+         tCsrRoamInfo RoamInfo;
+
+         vos_mem_zero(&RoamInfo, sizeof(tCsrRoamInfo));
+         smsLog(pMac, LOGE, FL(" %s fail to start timer status %d"), __FUNCTION__, status);
+         //Without the timer we cannot continue
+         csrRoamCallCallback((tpAniSirGlobal)pP2pContext->hHal, 
+                     pP2pContext->SMEsessionId, &RoamInfo, 0, 
+                     eCSR_ROAM_SEND_ACTION_CNF, 
+                     eCSR_ROAM_RESULT_SEND_ACTION_FAIL);
+         vos_spin_lock_acquire(&pP2pContext->lState);
+         pBuf = pP2pContext->pSentActionFrame;
+         pP2pContext->pSentActionFrame = NULL;
+         vos_spin_lock_release(&pP2pContext->lState);
+         vos_mem_free(pBuf);
+         pBuf = NULL;
+         p2pFsm(pP2pContext, eP2P_TRIGGER_DISCONNECTED);
+         return status;
+      }
+      //We can send this frame now
+      status = p2pSendActionFrame(pMac, HDDSessionID, actionFrameType);
+      if(!HAL_STATUS_SUCCESS(status))
+      {
+         smsLog(pMac, LOGE, FL("  fail to send action frame status %d"), status);
+      }
+      //Let them retry
+      pP2pContext->actionFrameTimeout = FALSE;
+   }
+   else
+   {
+      //An action frame is pedning at lower layer
+      smsLog(pMac, LOGW, FL("  An action frame is pending while trying to send frametype %d"), actionFrameType);
+      if (timeout)
+      {
+         pP2pContext->nNextFrameTimeOut = timeout;
+      }
+      else
+      {
+         pP2pContext->nNextFrameTimeOut = WLAN_P2P_DEF_ACTION_FRM_TIMEOUT_VALUE;
+      }
+   }
+
+   return status;
+}
+
+
+void p2pListenDiscoverTimerHandlerCB(void *pContext)
+{
+}
+
+void p2pListenDiscoverTimerHandler(void *pContext)
+{
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+   if( (eP2P_STATE_DISCONNECTED == p2pContext->state) && 
+       (eStateDisabled != p2pContext->listenDiscoverableState) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Calling RemainOnChannel with duration %d on channel %d\n", 
+             __FUNCTION__, p2pContext->listenDuration, p2pContext->P2PListenChannel);
+      status = p2pRemainOnChannel( p2pContext->hHal, p2pContext->SMEsessionId, p2pContext->P2PListenChannel, p2pContext->listenDuration, 
+                                    p2pListenStateDiscoverableCallback, p2pContext, eP2PRemainOnChnReasonListen);
+   }
+   else
+   {
+      smsLog(((tpAniSirGlobal)p2pContext->hHal), LOGW, FL(" cannot call p2pRemainOnChannel state %d\n"), p2pContext->state);
+   }
+
+   return;
+}
+
+
+static eHalStatus p2pListenStateDiscoverableCallback(tHalHandle halHandle, void *pContext, eHalStatus retStatus)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT(halHandle);
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+
+   if( (eP2P_STATE_DISCONNECTED == p2pContext->state) && 
+       (eStateDisabled != p2pContext->listenDiscoverableState) && 
+       (NULL == p2pContext->p2pDiscoverCBFunc) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s restart listen timer expire time %d\n", 
+                  __FUNCTION__, p2pContext->expire_time);
+      //We can restart the listening
+      status = palTimerStart(pMac->hHdd, p2pContext->listenTimerHandler, p2pContext->expire_time, eANI_BOOLEAN_FALSE);
+      if (eHAL_STATUS_SUCCESS != status)
+      {
+         VOS_ASSERT(status);
+      }
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s not restart listen timer  state (%d)\n", 
+                  __FUNCTION__, p2pContext->state);
+   }
+
+   return status;
+}
+
+
+eHalStatus P2P_ListenStateDiscoverable(tHalHandle hHal, tANI_U8 sessionId,
+                                       ep2pListenStateDiscoverability listenState)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   switch (listenState) 
+   {
+   case P2P_DEVICE_NOT_DISCOVERABLE:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s P2P_NOT_DISCOVERABLE\n", __FUNCTION__);
+      pMac->p2pContext[sessionId].listenDiscoverableState = eStateDisabled;
+      pMac->p2pContext[sessionId].DiscoverableCfg = listenState;
+      if (pMac->p2pContext[sessionId].state == eP2P_STATE_DISCONNECTED)
+      {
+         sme_CancelRemainOnChannel(hHal, sessionId );
+
+         if (pMac->p2pContext[sessionId].listenTimerHandler)
+         {
+            status = palTimerStop(pMac->hHdd, pMac->p2pContext[sessionId].listenTimerHandler);
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Timer Stop status %d\n", 
+                        __FUNCTION__, status);
+         }
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s P2P_NOT_DISCOVERABLE not in right state (%d)",
+            __FUNCTION__, pMac->p2pContext[sessionId].state);
+      }
+      break;
+
+   case P2P_DEVICE_AUTO_AVAILABILITY:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s P2P_AUTO_AVAILABILITY\n",__FUNCTION__);
+      pMac->p2pContext[sessionId].listenDiscoverableState = eStateEnabled;
+      pMac->p2pContext[sessionId].DiscoverableCfg = listenState;
+      pMac->p2pContext[sessionId].expire_time = P2P_LISTEN_TIMEOUT_AUTO * PAL_TIMER_TO_MS_UNIT;
+      pMac->p2pContext[sessionId].listenDuration = P2P_LISTEN_TIMEOUT;
+      if (pMac->p2pContext[sessionId].state == eP2P_STATE_DISCONNECTED)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Calling RemainOnChannel with diration %d on channel %d\n",
+                     __FUNCTION__, pMac->p2pContext[sessionId].listenDuration, pMac->p2pContext[sessionId].P2PListenChannel);
+         p2pRemainOnChannel( pMac, pMac->p2pContext[sessionId].SMEsessionId, pMac->p2pContext[sessionId].P2PListenChannel, 
+                              pMac->p2pContext[sessionId].listenDuration, p2pListenStateDiscoverableCallback, 
+                              &pMac->p2pContext[sessionId], eP2PRemainOnChnReasonListen);
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s P2P_AUTO_DISCOVERABLE not in right state (%d)",
+            __FUNCTION__, pMac->p2pContext[sessionId].state);
+      }
+      break;
+
+   case P2P_DEVICE_HIGH_AVAILABILITY:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s P2P_HIGH_AVAILABILITY\n",__FUNCTION__);
+      pMac->p2pContext[sessionId].listenDiscoverableState = eStateEnabled;
+      pMac->p2pContext[sessionId].DiscoverableCfg = listenState;
+      pMac->p2pContext[sessionId].expire_time = P2P_REMAIN_ON_CHAN_TIMEOUT_LOW * PAL_TIMER_TO_MS_UNIT;
+      pMac->p2pContext[sessionId].listenDuration = P2P_LISTEN_TIMEOUT_HIGH;
+      if (pMac->p2pContext[sessionId].state == eP2P_STATE_DISCONNECTED)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Calling RemainOnChannel with diration %d on channel %d\n",
+                     __FUNCTION__, pMac->p2pContext[sessionId].listenDuration, pMac->p2pContext[sessionId].P2PListenChannel);
+         p2pRemainOnChannel( pMac, pMac->p2pContext[sessionId].SMEsessionId, pMac->p2pContext[sessionId].P2PListenChannel, 
+                              pMac->p2pContext[sessionId].listenDuration, p2pListenStateDiscoverableCallback, 
+                              &pMac->p2pContext[sessionId], eP2PRemainOnChnReasonListen);
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s P2P_HIGH_DISCOVERABLE not in right state (%d)",
+            __FUNCTION__, pMac->p2pContext[sessionId].state);
+      }
+      break;
+
+   case 234: //Not to use this as it enabling GO to be concurrent with P2P device P2P_DEVICE_HIGH_AVAILABILITY:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s P2P_HIGH_AVAILABILITY\n",__FUNCTION__);
+      pMac->p2pContext[sessionId].listenDiscoverableState = eStateEnabled;
+      pMac->p2pContext[sessionId].DiscoverableCfg = listenState;
+
+      if ((pMac->p2pContext[sessionId].P2POperatingChannel != pMac->p2pContext[sessionId].P2PListenChannel)
+           && p2pIsGOportEnabled(pMac))
+      {
+         pMac->p2pContext[sessionId].expire_time = P2P_LISTEN_TIMEOUT_HIGH * PAL_TIMER_TO_MS_UNIT * 5;
+         pMac->p2pContext[sessionId].listenDuration = P2P_REMAIN_ON_CHAN_TIMEOUT_LOW;
+      } 
+      else
+      {
+         pMac->p2pContext[sessionId].expire_time = P2P_LISTEN_TIMEOUT_HIGH * PAL_TIMER_TO_MS_UNIT;
+         pMac->p2pContext[sessionId].listenDuration = P2P_LISTEN_TIMEOUT;
+      }
+
+      if (pMac->p2pContext[sessionId].state == eP2P_STATE_DISCONNECTED)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Calling RemainOnChannel with diration %d on channel %d\n",
+                     __FUNCTION__, pMac->p2pContext[sessionId].listenDuration, pMac->p2pContext[sessionId].P2PListenChannel);
+         p2pRemainOnChannel( pMac, pMac->p2pContext[sessionId].SMEsessionId, pMac->p2pContext[sessionId].P2PListenChannel, 
+                              pMac->p2pContext[sessionId].listenDuration, p2pListenStateDiscoverableCallback, 
+                              &pMac->p2pContext[sessionId], eP2PRemainOnChnReasonListen);
+      }
+      
+      break;
+
+   default:
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+         "%s Unknown listen setting",__FUNCTION__, listenState);
+      break;
+   }
+
+    return( status );
+}
+
+
+void p2pCallDiscoverCallback(tp2pContext *p2pContext, eP2PDiscoverStatus statusCode)
+{
+   if (p2pContext->p2pDiscoverCBFunc)
+   {
+      p2pDiscoverCompleteCallback pcallback = p2pContext->p2pDiscoverCBFunc;
+      p2pContext->p2pDiscoverCBFunc = NULL;
+      pcallback(p2pContext->hHal, p2pContext->pContext, statusCode);
+   }
+   p2pContext->directedDiscovery = FALSE;
+}
+
+
+void p2pDiscoverTimerHandler(void *pContext)
+{
+   tp2pContext *p2pContext = (tp2pContext*) pContext;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s enter", __FUNCTION__);
+   p2pCallDiscoverCallback(p2pContext, 
+         (p2pContext->directedDiscovery) ? eP2P_DIRECTED_DISCOVER : eP2P_DISCOVER_SUCCESS);
+
+   status = p2pFsm(p2pContext, eP2P_TRIGGER_DISCONNECTED);
+
+   return;
+}
+
+
+
+eHalStatus p2pGetResultFilter(tp2pContext *pP2pContext,
+                              tCsrScanResultFilter *pFilter)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   v_U32_t uNumDeviceFilters;
+   tp2pDiscoverDeviceFilter *directedDiscoveryFilter;
+   int i;
+   tCsrBssid *bssid = NULL;
+
+   do
+   {
+      if( (NULL != pP2pContext) && (NULL != pFilter) )
+      {
+         vos_mem_zero(pFilter, sizeof(tCsrScanResultFilter));
+         uNumDeviceFilters = pP2pContext->uNumDeviceFilters;
+         directedDiscoveryFilter = pP2pContext->directedDiscoveryFilter;
+         for(i = 0; i < uNumDeviceFilters; i++)
+         {
+            if (directedDiscoveryFilter->ucBitmask & DISCOVERY_FILTER_BITMASK_DEVICE)
+            {
+               pFilter->BSSIDs.numOfBSSIDs++;
+            }
+            
+            if ((directedDiscoveryFilter->ucBitmask != QCWLAN_P2P_DISCOVER_ANY) 
+               && (directedDiscoveryFilter->ucBitmask & DISCOVERY_FILTER_BITMASK_GO))
+            {
+               //Matching Device ID and GroupSSID
+               pFilter->BSSIDs.numOfBSSIDs++;
+               if(directedDiscoveryFilter->GroupSSID.length)
+               {
+                  pFilter->SSIDs.numOfSSIDs++;
+               }
+            }
+            directedDiscoveryFilter += sizeof(tp2pDiscoverDeviceFilter);
+         }
+
+         directedDiscoveryFilter = pP2pContext->directedDiscoveryFilter;
+         if (pFilter->BSSIDs.numOfBSSIDs)
+         {
+            bssid = ( tCsrBssid *) vos_mem_malloc( sizeof( tCsrBssid ) * pFilter->BSSIDs.numOfBSSIDs );
+            if(NULL == bssid)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                  " %s fail to allocate bssid", __FUNCTION__);
+               status = eHAL_STATUS_RESOURCES;
+               break;
+            }
+
+            pFilter->BSSIDs.bssid = bssid;
+
+            for (i = 0; i < uNumDeviceFilters; i++)
+            {
+               vos_mem_copy(bssid, directedDiscoveryFilter->DeviceID, P2P_MAC_ADDRESS_LEN);
+               bssid += sizeof(tCsrBssid);
+               directedDiscoveryFilter += sizeof(tp2pDiscoverDeviceFilter);
+            }
+         }
+
+         directedDiscoveryFilter = pP2pContext->directedDiscoveryFilter;
+         if (pFilter->SSIDs.numOfSSIDs)
+         {
+            pFilter->SSIDs.SSIDList = (tCsrSSIDInfo *)vos_mem_malloc( sizeof( *pFilter->SSIDs.SSIDList ) *
+                                                      pFilter->SSIDs.numOfSSIDs );
+            if(NULL == pFilter->SSIDs.SSIDList)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                  " %s fail to allocate bssid", __FUNCTION__);
+               status = eHAL_STATUS_RESOURCES;
+               break;
+            }
+
+            if ( pFilter->SSIDs.SSIDList )
+            {
+               for ( i = 0; i < uNumDeviceFilters; i++ )
+               {
+                  if (directedDiscoveryFilter->ucBitmask == DISCOVERY_FILTER_BITMASK_GO)
+                  {
+                     if(directedDiscoveryFilter->GroupSSID.length)
+                     {
+                        pFilter->SSIDs.SSIDList[i].SSID.length = directedDiscoveryFilter->GroupSSID.length;
+                        vos_mem_copy( pFilter->SSIDs.SSIDList[i].SSID.ssId,
+                                       directedDiscoveryFilter->GroupSSID.ssId,
+                                       directedDiscoveryFilter->GroupSSID.length );
+                     }
+                  }
+                  directedDiscoveryFilter += sizeof(tp2pDiscoverDeviceFilter);
+               }
+            }
+         }
+      }
+
+      pFilter->p2pResult = TRUE;
+      pFilter->bWPSAssociation = TRUE;
+      pFilter->BSSType = eCSR_BSS_TYPE_ANY;
+   } while(0);
+
+   if(!HAL_STATUS_SUCCESS(status))
+   {
+      if(pFilter->SSIDs.SSIDList)
+      {
+         vos_mem_free(pFilter->SSIDs.SSIDList);
+         pFilter->SSIDs.SSIDList = NULL;
+      }
+      if( pFilter->BSSIDs.bssid )
+      {
+         vos_mem_free(pFilter->BSSIDs.bssid);
+         pFilter->BSSIDs.bssid = NULL;
+      }
+   }
+
+   return status;
+}
+
+
+/*
+  @breif Function calls P2P_Fsm function to initiate the P2P Discover process
+
+  @param[in] hHal - Handle to MAC structure.
+        [in] sessionID - Session ID returned by sme_OpenSession
+        [in] pDiscoverRequest - pointer to the tp2pDiscoverRequest structure
+             whose parameters are filled in the HDD.
+        [in] callback - HDD callback function to be called when Discover
+             is complete
+        [in] pContext - a pointer passed in for the callback
+
+  @return eHAL_STATUS_FAILURE - If success.
+          eHAL_STATUS_SUCCESS - If failure.
+*/
+eHalStatus P2P_DiscoverRequest(tHalHandle hHal,
+                tANI_U8 SessionID,
+                tP2PDiscoverRequest *pDiscoverRequest,
+                p2pDiscoverCompleteCallback callback,
+                void *pContext)
+{
+   eHalStatus           status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal       pMac = PMAC_STRUCT(hHal);
+   tScanResultHandle    hScanResult = NULL;
+   tCsrScanResultFilter filter;
+   tANI_U32 uNumDeviceFilters;
+   tp2pDiscoverDeviceFilter *pDeviceFilters;
+   tANI_U32 i = 0;
+   tp2pContext *pP2pContext = &pMac->p2pContext[SessionID];
+   tCsrBssid *bssid = NULL;
+   tp2pDiscoverDeviceFilter discoverFilter;
+   tANI_BOOLEAN fDirect = FALSE;
+
+   if (pDiscoverRequest == NULL)
+   {
+      return status;
+   }
+
+   pP2pContext->discoverType      = pDiscoverRequest->discoverType;
+   pP2pContext->scanType          = pDiscoverRequest->scanType;
+   pP2pContext->uDiscoverTimeout  = pDiscoverRequest->uDiscoverTimeout;
+
+   if (pP2pContext->DiscoverReqIeField)
+   {
+      vos_mem_free(pP2pContext->DiscoverReqIeField);
+      pP2pContext->DiscoverReqIeLength = 0;
+      pP2pContext->DiscoverReqIeField = NULL;
+   }
+
+   if (pDiscoverRequest->uIELen)
+   {
+      pP2pContext->DiscoverReqIeField = (tANI_U8 *)vos_mem_malloc(pDiscoverRequest->uIELen);
+      vos_mem_copy((tANI_U8 *)pP2pContext->DiscoverReqIeField, pDiscoverRequest->pIEField, pDiscoverRequest->uIELen);
+      pP2pContext->DiscoverReqIeLength = pDiscoverRequest->uIELen;
+   } 
+   else
+   {
+      pP2pContext->DiscoverReqIeLength = 0;
+   }
+
+   vos_mem_zero(&filter, sizeof(filter));
+
+   do
+   {
+      if (pDiscoverRequest->uNumDeviceFilters)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s directed\n", __FUNCTION__);
+         fDirect = TRUE;
+         uNumDeviceFilters = pDiscoverRequest->uNumDeviceFilters;
+
+         pP2pContext->uDiscoverTimeout = pP2pContext->uDiscoverTimeout;
+         pP2pContext->uNumDeviceFilters = pDiscoverRequest->uNumDeviceFilters;
+         if(pP2pContext->uNumDeviceFilterAllocated < pDiscoverRequest->uNumDeviceFilters)
+         {
+            if(pP2pContext->directedDiscoveryFilter)
+            {
+               pP2pContext->uNumDeviceFilterAllocated = 0;
+               vos_mem_free(pP2pContext->directedDiscoveryFilter);
+               pP2pContext->directedDiscoveryFilter = NULL;
+            }
+            pP2pContext->directedDiscoveryFilter = (tp2pDiscoverDeviceFilter *)
+                  vos_mem_malloc(sizeof(tp2pDiscoverDeviceFilter) * uNumDeviceFilters);
+            if(NULL == pP2pContext->directedDiscoveryFilter)
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                  "%s fail to allocate memory for discoverFilter", __FUNCTION__);
+               status = eHAL_STATUS_RESOURCES;
+               break;
+            }
+            pP2pContext->uNumDeviceFilterAllocated = uNumDeviceFilters;
+         }
+
+         pDeviceFilters = pDiscoverRequest->pDeviceFilters;
+         if(NULL != pDeviceFilters)
+         {
+            vos_mem_copy ( pP2pContext->directedDiscoveryFilter, pDeviceFilters,
+                              sizeof(tp2pDiscoverDeviceFilter) * uNumDeviceFilters);
+
+            if(!HAL_STATUS_SUCCESS(status = p2pGetResultFilter(pP2pContext, &filter)))
+            {
+               VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                  "%s fail to create filter", __FUNCTION__);
+               break;
+            }
+         }//if(NULL != pDeviceFilters)
+
+         status = csrScanGetResult(pMac, &filter, &hScanResult);
+         if (hScanResult)
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s calling p2pDiscoverCompleteCallback\n", __FUNCTION__);
+            if (callback)
+            {
+               callback(hHal, pContext, eP2P_DIRECTED_DISCOVER);
+
+            }       
+            status =  eHAL_STATUS_SUCCESS;
+            break;
+         }
+         else
+         {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               "%s Directed find did not find BSSID in cache\n", __FUNCTION__);
+            pP2pContext->formationReq.targetListenChannel = 0;
+            if (pDiscoverRequest->uNumDeviceFilters == 1 && filter.BSSIDs.numOfBSSIDs == 1)
+            {
+               vos_mem_copy(&pP2pContext->formationReq.deviceAddress, 
+                              pDiscoverRequest->pDeviceFilters->DeviceID, P2P_MAC_ADDRESS_LEN);
+            }
+         }
+      }
+
+      pP2pContext->p2pDiscoverCBFunc = callback;
+      pP2pContext->pContext          = pContext;
+      pP2pContext->directedDiscovery = fDirect;
+      if(!pP2pContext->GroupFormationPending)
+      {
+         p2pFsm(&pMac->p2pContext[SessionID], eP2P_TRIGGER_DEVICE_MODE_DEVICE);
+      }
+      else
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, 
+               "%s while group formation", __FUNCTION__);
+      }
+
+      pP2pContext->uDiscoverTimeout = pDiscoverRequest->uDiscoverTimeout;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED, "%s Start discover", __FUNCTION__);
+      status = palTimerStart(pMac->hHdd, pP2pContext->discoverTimer, 
+                     pP2pContext->uDiscoverTimeout * 1000, eANI_BOOLEAN_FALSE);
+      if(!HAL_STATUS_SUCCESS(status))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+            "%s failt to start discover timer", __FUNCTION__);
+            pP2pContext->p2pDiscoverCBFunc = NULL;
+            pP2pContext->pContext          = NULL;
+            if(callback)
+            {
+               callback(pMac, pContext, eP2P_DISCOVER_FAILURE);
+            }
+      }
+   }while(0);
+
+   if(filter.SSIDs.SSIDList)
+   {
+      vos_mem_free(filter.SSIDs.SSIDList);
+   }
+   if( hScanResult )
+   {
+      sme_ScanResultPurge( pMac, hScanResult );
+   }
+   if( filter.BSSIDs.bssid )
+   {
+      vos_mem_free(filter.BSSIDs.bssid);
+   }
+
+   return status;
+}
+
+eHalStatus p2pScanRequest(tp2pContext *p2pContext, p2pDiscoverCompleteCallback callback, void *pContext)
+{
+   tCsrScanRequest scanRequest;
+   v_U32_t scanId = 0;
+   tANI_U32 len = 0;
+   tCsrSSIDInfo wcSSID = { {P2P_WILDCARD_SSID_LEN, P2P_WILDCARD_SSID}, 0, 0 };
+   tANI_U8 Channel; 
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tP2P_OperatingChannel p2pOperatingChannel;
+   tpAniSirGlobal pMac = PMAC_STRUCT(p2pContext->hHal);
+   tANI_U8 *p2pIe = NULL;
+   tANI_U32 p2pIeLen;
+
+   vos_mem_zero( &scanRequest, sizeof(scanRequest));
+
+   P2P_GetOperatingChannel(p2pContext->hHal, p2pContext->sessionId, &p2pOperatingChannel);
+   Channel = p2pOperatingChannel.channel;
+   
+   if (Channel)
+   {
+      scanRequest.ChannelInfo.numOfChannels = 1;      
+      scanRequest.ChannelInfo.ChannelList = &Channel;
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s Scan on channel %d p2pContext->sessionId %d\n", 
+                  __FUNCTION__, Channel, p2pContext->sessionId);
+   }
+   else
+   {
+       getChannelInfo(p2pContext, &scanRequest.ChannelInfo, WFD_DISCOVER_TYPE_AUTO);
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s Scan on all channels\n", 
+                  __FUNCTION__);
+   }
+
+   /* set the scan type to active */
+   scanRequest.scanType = eSIR_ACTIVE_SCAN;
+
+   vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff );
+
+   scanRequest.requestType = eCSR_SCAN_P2P_FIND_PEER;
+   /* set min and max channel time to zero */
+   scanRequest.minChnTime = 30;
+   scanRequest.maxChnTime = 100;
+
+   /* set BSSType to default type */
+   scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+
+   scanRequest.SSIDs.numOfSSIDs = 1;
+   scanRequest.SSIDs.SSIDList = &wcSSID;
+   scanRequest.p2pSearch = VOS_FALSE;
+       
+   P2P_GetIE(p2pContext, p2pContext->sessionId, eP2P_GROUP_ID, &p2pIe, &p2pIeLen);
+   vos_mem_copy(scanRequest.bssid, ((tP2PGroupId *)p2pIe)->deviceAddress, P2P_MAC_ADDRESS_LEN);
+
+   P2P_GetIE(p2pContext, p2pContext->sessionId, eP2P_PROBE_REQ,  &scanRequest.pIEField, &len);
+
+   scanRequest.uIEFieldLen = len;
+
+   status = csrScanRequest( p2pContext->hHal, p2pContext->SMEsessionId, &scanRequest, &scanId, callback, pContext );
+
+   if(scanRequest.pIEField)
+   {
+      vos_mem_free(scanRequest.pIEField);
+   }
+
+   if(p2pIe)
+   {
+      vos_mem_free(p2pIe);
+   }
+   return status;
+}
+
+tANI_U8 getP2PSessionIdFromSMESessionId(tHalHandle hHal, tANI_U8 SessionID)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tANI_U8 num_session;
+
+   for (num_session = 0; num_session < MAX_NO_OF_P2P_SESSIONS; num_session++)
+   {
+      if(SessionID == pMac->p2pContext[num_session].SMEsessionId)
+      {
+         return pMac->p2pContext[num_session].sessionId;
+      }
+   }
+   
+   return CSR_SESSION_ID_INVALID;
+}
+
+
+/* SessionID is HDD session id, not SME sessionId*/
+eHalStatus p2pCloseSession(tHalHandle hHal, tANI_U8 SessionID)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tp2pContext *pContext = &pMac->p2pContext[SessionID];
+
+   pContext->SMEsessionId = CSR_SESSION_ID_INVALID;
+   p2pResetContext(pContext);
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus p2pSetSessionId(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 SmeSessionId)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   pMac->p2pContext[SessionID].sessionId = SessionID;
+   pMac->p2pContext[SessionID].SMEsessionId = SmeSessionId;
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+static tANI_BOOLEAN p2pIsGOportEnabled(tpAniSirGlobal pMac)
+{
+
+   tANI_U8 num_session = 0;
+
+   for (num_session = 0; num_session < MAX_NO_OF_P2P_SESSIONS ; num_session++)
+   {
+      if (pMac->p2pContext[num_session].operatingmode == OPERATION_MODE_P2P_GROUP_OWNER)
+      {
+         return eANI_BOOLEAN_TRUE;
+      }
+   }
+
+   return eANI_BOOLEAN_FALSE;
+}
+
+tANI_BOOLEAN p2pIsOperatingChannEqualListenChann(tHalHandle hHal, tANI_U8 SessionID)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   if(pMac->p2pContext[SessionID].P2POperatingChannel == pMac->p2pContext[SessionID].P2PListenChannel)
+   {
+      return eANI_BOOLEAN_TRUE;
+   }
+
+   return eANI_BOOLEAN_FALSE;
+}
+
+eHalStatus p2pGetListenChannel(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 *channel)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   *channel = pMac->p2pContext[SessionID].P2PListenChannel;
+  
+   return eHAL_STATUS_SUCCESS;
+}
+
+eHalStatus p2pSetListenChannel(tHalHandle hHal, tANI_U8 SessionID, tANI_U8 channel)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tP2P_OperatingChannel p2pListenChannel;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+   if(csrRoamIsChannelValid(pMac, channel))
+   {
+      pMac->p2pContext[SessionID].P2PListenChannel = channel;
+      p2pGetListenChannelAttrib(pMac, pMac->p2pContext[SessionID].sessionId, &p2pListenChannel);
+      p2pListenChannel.channel = channel;
+      p2pUpdateListenChannelAttrib(pMac, pMac->p2pContext[SessionID].sessionId, &p2pListenChannel);
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+         " %s fail with invalid channel %d", __FUNCTION__, channel);
+      status = eHAL_STATUS_INVALID_PARAMETER;
+   }
+  
+   return status;
+}
+
+
+
+eHalStatus p2pStopDiscovery(tHalHandle hHal, tANI_U8 SessionID)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+
+   status = palTimerStop(pMac->hHdd, pMac->p2pContext[SessionID].discoverTimer);
+   if (status != eHAL_STATUS_SUCCESS)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s Timer Stop status %d\n",  __FUNCTION__, status);
+      return status;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s Timer Stop status %d\n",  __FUNCTION__, status);
+   p2pCallDiscoverCallback(&pMac->p2pContext[SessionID],  eP2P_DIRECTED_DISCOVER);
+
+   status = p2pFsm( &pMac->p2pContext[SessionID], eP2P_TRIGGER_DISCONNECTED );
+
+   return status;
+}
+
+//Purge P2P device/GO from the list
+eHalStatus p2pPurgeDeviceList(tpAniSirGlobal pMac, tDblLinkList *pList)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tListElem *pEntry, *pNext;
+   tCsrScanResult *pBssResult;
+   tDot11fBeaconIEs *pIes;
+    
+   csrLLLock(pList);
+   
+   pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
+   while( NULL != pEntry )
+   {
+      pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
+      pBssResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+      pIes = NULL;
+      if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pBssResult->Result.BssDescriptor, &pIes)))
+      {
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+            " %s fail to parse IEs. pEntry (0x%X)",
+            __FUNCTION__, pEntry);
+         pEntry = pNext;
+         continue;
+      }
+      if( pIes->P2PBeaconProbeRes.present )
+      {
+         //Found a P2P BSS
+         if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK) )
+         {
+            csrFreeScanResultEntry( pMac, pBssResult );
+         }
+      }
+      palFreeMemory(pMac->hHdd, pIes);
+      pEntry = pNext;
+   }
+
+   csrLLUnlock(pList);
+
+   return (status);
+}
+
+
+eHalStatus sme_p2pFlushDeviceList(tHalHandle hHal, tANI_U8 HDDSessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog(pMac, LOG2, FL("enter"));
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = p2pPurgeDeviceList(pMac, &pMac->scan.scanResultList);
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+eHalStatus sme_p2pResetSession(tHalHandle hHal, tANI_U8 HDDSessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog(pMac, LOG2, FL("enter"));
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if(MAX_NO_OF_P2P_SESSIONS > HDDSessionId)
+      {
+         p2pResetContext(&pMac->p2pContext[HDDSessionId]);
+         status = eHAL_STATUS_SUCCESS;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+
+eHalStatus sme_p2pGetResultFilter(tHalHandle hHal, tANI_U8 HDDSessionId,
+                              tCsrScanResultFilter *pFilter)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if(MAX_NO_OF_P2P_SESSIONS > HDDSessionId)
+      {
+         status = p2pGetResultFilter(&pMac->p2pContext[HDDSessionId], pFilter);
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return status;
+}
+
+
+
+#endif //WLAN_FEATURE_P2P_INTERNAL
+
+eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd)
+{
+    tpP2pPsConfig pNoA;
+    tSirMsgQ msg;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    status = palAllocateMemory(pMac->hHdd, (void**)&pNoA, sizeof(tP2pPsConfig));
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, pNoA, sizeof(tP2pPsConfig));
+        pNoA->opp_ps = pNoACmd->u.NoACmd.NoA.opp_ps;
+        pNoA->ctWindow = pNoACmd->u.NoACmd.NoA.ctWindow;
+        pNoA->duration = pNoACmd->u.NoACmd.NoA.duration;
+        pNoA->interval = pNoACmd->u.NoACmd.NoA.interval;
+        pNoA->count = pNoACmd->u.NoACmd.NoA.count;
+        pNoA->single_noa_duration = pNoACmd->u.NoACmd.NoA.single_noa_duration;
+        pNoA->psSelection = pNoACmd->u.NoACmd.NoA.psSelection;
+        pNoA->sessionid = pNoACmd->u.NoACmd.NoA.sessionid;
+        msg.type = eWNI_SME_UPDATE_NOA;
+        msg.bodyval = 0;
+        msg.bodyptr = pNoA;
+        limPostMsgApi(pMac, &msg);
+    }   
+    return status;
+}
+
+
+
+
+#endif //WLAN_FEATURE_P2P
diff --git a/CORE/SME/src/pmc/pmc.c b/CORE/SME/src/pmc/pmc.c
new file mode 100644
index 0000000..5afc0db
--- /dev/null
+++ b/CORE/SME/src/pmc/pmc.c
@@ -0,0 +1,2588 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  pmc.c
+*
+* Description: 
+      Power Management Control (PMC) processing routines.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+*     Qualcomm Confidential and Proprietary.
+*
+*
+******************************************************************************/
+
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "csrLinkList.h"
+#include "csrApi.h"
+#include "smeInside.h"
+#include "sme_Api.h"
+#include "smsDebug.h"
+#include "pmc.h"
+#include "wlan_ps_wow_diag.h"
+#include <vos_power.h>
+#include "csrInsideApi.h"
+
+static void pmcProcessDeferredMsg( tpAniSirGlobal pMac );
+
+/******************************************************************************
+*
+* Name:  pmcEnterLowPowerState
+*
+* Description:
+*    Have the device enter Low Power State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterLowPowerState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcEnterLowPowerState\n"));
+
+    /* If already in Low Power State, just return. */
+    if (pMac->pmc.pmcState == LOW_POWER)
+        return eHAL_STATUS_SUCCESS;
+
+    /* Cancel any running timers. */
+    if (palTimerStop(pMac->hHdd, pMac->pmc.hImpsTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot cancel IMPS timer\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    pmcStopTrafficTimer(hHal);
+
+    if (palTimerStop(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot cancel exit power save mode timer\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Do all the callbacks. */
+    pmcDoCallbacks(hHal, eHAL_STATUS_FAILURE);
+
+    /* Change state. */
+    pMac->pmc.pmcState = LOW_POWER;
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcExitLowPowerState
+*
+* Description:
+*    Have the device exit the Low Power State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcExitLowPowerState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcExitLowPowerState\n"));
+
+    /* Must be in Low Power State if we are going to exit that state. */
+    if (pMac->pmc.pmcState != LOW_POWER)
+    {
+        smsLog(pMac, LOGE, FL("Cannot exit Low Power State if not in that state\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Both WLAN switches much be on to exit Low Power State. */
+    if ((pMac->pmc.hwWlanSwitchState == ePMC_SWITCH_OFF) || (pMac->pmc.swWlanSwitchState == ePMC_SWITCH_OFF))
+        return eHAL_STATUS_SUCCESS;
+
+    /* Change state. */
+    pMac->pmc.pmcState = FULL_POWER;
+    if(pmcShouldBmpsTimerRun(pMac))
+    {
+        if (pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod) != eHAL_STATUS_SUCCESS)
+            return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterFullPowerState
+*
+* Description:
+*    Have the device enter the Full Power State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterFullPowerState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcEnterFullPowerState\n"));
+
+    /* Take action based on the current state. */
+    switch (pMac->pmc.pmcState)
+    {
+
+    /* Already in Full Power State. */
+    case FULL_POWER:
+        break;
+
+    /* Notify everyone that we are going to full power.
+       Change to Full Power State. */
+    case REQUEST_FULL_POWER:
+    case REQUEST_IMPS:
+    case REQUEST_BMPS:
+    case REQUEST_STANDBY:
+
+        /* Change state. */
+        pMac->pmc.pmcState = FULL_POWER;
+        pMac->pmc.requestFullPowerPending = FALSE;
+
+        if(pmcShouldBmpsTimerRun(pMac))
+            (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+
+        pmcProcessDeferredMsg( pMac );
+        /* Do all the callbacks. */
+        pmcDoCallbacks(hHal, eHAL_STATUS_SUCCESS);
+
+        /* Update registerd modules that we are entering Full Power. This is
+           only way to inform modules if PMC exited a power save mode because
+           of error conditions or if som other module requested full power */
+        pmcDoDeviceStateUpdateCallbacks(hHal, FULL_POWER);
+        break;
+
+    /* Cannot go directly to Full Power State from these states. */
+    default:
+        smsLog(pMac, LOGE, FL("Trying to enter Full Power State from state %d\n"), pMac->pmc.pmcState);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    smsLog(pMac, LOGW, "PMC: Enter full power done: Cancel XO Core ON vote\n");
+    if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, "Could not cancel XO Core ON vote. Not returning failure. "
+                                "Power consumed will be high\n");
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestFullPowerState
+*
+* Description:
+*    Have the device enter the Request Full Power State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    fullPowerReason - Reason code for requesting full power
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestFullPowerState (tHalHandle hHal, tRequestFullPowerReason fullPowerReason)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    vos_call_status_type callType;
+    VOS_STATUS status;
+
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestFullPowerState\n"));
+
+    /* Take action based on the current state of the device. */
+    switch (pMac->pmc.pmcState)
+    {
+
+    /* Should not request full power if already there. */
+    case FULL_POWER:
+        smsLog(pMac, LOGE, FL("Requesting Full Power State when already there\n"));
+        return eHAL_STATUS_FAILURE;
+
+    /* Only power events can take device out of Low Power State. */
+    case LOW_POWER:
+        smsLog(pMac, LOGE, FL("Cannot request exit from Low Power State\n"));
+        return eHAL_STATUS_FAILURE;
+
+    /* Cannot go directly to Request Full Power state from these states.
+       Record that this is pending and take care of it later. */
+    case REQUEST_IMPS:
+    case REQUEST_START_UAPSD:
+    case REQUEST_STOP_UAPSD:
+    case REQUEST_STANDBY:
+    case REQUEST_BMPS:
+    case REQUEST_ENTER_WOWL:
+    case REQUEST_EXIT_WOWL:
+        smsLog(pMac, LOGW, FL("Request for full power is being buffered. "
+            "Current state is %d\n"), pMac->pmc.pmcState);
+        //Ignore the new reason if request for full power is already pending
+        if( !pMac->pmc.requestFullPowerPending )
+        {
+            pMac->pmc.requestFullPowerPending = TRUE;
+            pMac->pmc.requestFullPowerReason = fullPowerReason;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+    /* Tell MAC to have device enter full power mode. */
+    case IMPS:
+        if ( pMac->pmc.rfSuppliesVotedOff )
+        {
+            status = vos_chipVoteOnRFSupply(&callType, NULL, NULL);
+            VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+            status = vos_chipVoteOnXOBuffer(&callType, NULL, NULL);
+            VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+            pMac->pmc.rfSuppliesVotedOff = FALSE;
+        }
+
+        if (pmcIssueCommand( pMac, eSmeCommandExitImps, NULL, 0, FALSE ) != eHAL_STATUS_SUCCESS)
+        {
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+    /* Tell MAC to have device enter full power mode. */
+    case BMPS:
+    {
+        tExitBmpsInfo exitBmpsInfo;
+        exitBmpsInfo.exitBmpsReason = fullPowerReason;
+
+        if (pmcIssueCommand(hHal, eSmeCommandExitBmps, &exitBmpsInfo, sizeof(tExitBmpsInfo), FALSE)
+               != eHAL_STATUS_SUCCESS)
+        {
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+    }
+    /* Already in Request Full Power State. */
+    case REQUEST_FULL_POWER:
+        return eHAL_STATUS_SUCCESS;
+
+    /* Tell MAC to have device enter full power mode. */
+    case STANDBY:
+        if ( pMac->pmc.rfSuppliesVotedOff )
+        {
+            status = vos_chipVoteOnXOBuffer(&callType, NULL, NULL);
+            if(VOS_STATUS_SUCCESS != status)
+            {
+                return eHAL_STATUS_FAILURE;
+            }
+            status = vos_chipVoteOnRFSupply(&callType, NULL, NULL);
+            if(VOS_STATUS_SUCCESS != status)
+            {
+                return eHAL_STATUS_FAILURE;
+            }
+
+            pMac->pmc.rfSuppliesVotedOff = FALSE;
+        }
+
+        if (pmcIssueCommand(hHal, eSmeCommandExitImps, NULL, 0, FALSE) !=
+            eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_IMPS_REQ\n");
+            return eHAL_STATUS_FAILURE;
+        }
+        
+        return eHAL_STATUS_SUCCESS;
+
+    /* Tell MAC to have device exit UAPSD mode first */
+    case UAPSD:
+        //Need to save the reason code here in case later on we need to exit BMPS as well
+        if (pmcIssueCommand(hHal, eSmeCommandExitUapsd, &fullPowerReason, sizeof(tRequestFullPowerReason), FALSE) !=
+            eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_UAPSD_REQ\n");
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+    /* Tell MAC to have device exit WOWL mode first */
+    case WOWL:
+        if (pmcIssueCommand(hHal, eSmeCommandExitWowl, &fullPowerReason, sizeof(tRequestFullPowerReason), FALSE) !=
+            eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGP, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_WOWL_REQ\n");
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+    /* Cannot go directly to Request Full Power State from these states. */
+    default:
+        smsLog(pMac, LOGE, FL("Trying to enter Request Full Power State from state %d\n"), pMac->pmc.pmcState);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestImpsState
+*
+* Description:
+*    Have the device enter the Request IMPS State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestImpsState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestImpsState\n"));
+
+    /* Can enter Request IMPS State only from Full Power State. */
+    if (pMac->pmc.pmcState != FULL_POWER)
+    {
+        smsLog(pMac, LOGE, FL("Trying to enter Request IMPS State from state %d\n"), pMac->pmc.pmcState);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Make sure traffic timer that triggers bmps entry is not running */
+    pmcStopTrafficTimer(hHal);
+
+    /* Tell MAC to have device enter IMPS mode. */
+    if (pmcIssueCommand(hHal, eSmeCommandEnterImps, NULL, 0, FALSE) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ\n");
+        pMac->pmc.pmcState = FULL_POWER;
+        if(pmcShouldBmpsTimerRun(pMac))
+            (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+        return eHAL_STATUS_FAILURE;
+     }
+
+    smsLog(pMac, LOGW, FL("eWNI_PMC_ENTER_IMPS_REQ sent to PE\n"));
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterImpsState
+*
+* Description:
+*    Have the device enter the IMPS State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterImpsState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    vos_call_status_type callType;
+    VOS_STATUS status;
+    smsLog(pMac, LOG2, FL("Entering pmcEnterImpsState\n"));
+
+    /* Can enter IMPS State only from Request IMPS State. */
+    if (pMac->pmc.pmcState != REQUEST_IMPS)
+    {
+        smsLog(pMac, LOGE, FL("Trying to enter IMPS State from state %d\n"), pMac->pmc.pmcState);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Change state. */
+    pMac->pmc.pmcState = IMPS;
+
+    /* If we have a reqeust for full power pending then we have to go
+       directly into full power. */
+    if (pMac->pmc.requestFullPowerPending)
+    {
+
+#if defined(ANI_OS_TYPE_WINDOWS) && !defined(GEN6_ONWARDS)
+        /* In Windows we cannot do this now since we are in DPC context and the message to the
+           SoftMAC to put the device into IMPS will be sent at the end of DPC processing.  Instead
+           we set a short timer and start the IMPS exit sequence when the timer fires. */
+        if (palTimerStart(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer, 1000, FALSE) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot start exit power save mode timer\n"));
+            PMC_ABORT;
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+#else
+        /* Start exit IMPS sequence now. */
+        return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+#endif
+    }
+
+    /* Set timer to come out of IMPS.only if impsPeriod is non-Zero*/
+    if(0 != pMac->pmc.impsPeriod)
+    {
+        if (palTimerStart(pMac->hHdd, pMac->pmc.hImpsTimer, pMac->pmc.impsPeriod * 1000, FALSE) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot start IMPS timer\n"));
+            PMC_ABORT;
+            pmcEnterRequestFullPowerState(hHal, eSME_REASON_OTHER);
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+
+    //Vote off RF supplies. Note RF supllies are not voted off if there is a 
+    //pending request for full power already
+    status = vos_chipVoteOffRFSupply(&callType, NULL, NULL);
+    VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+    status = vos_chipVoteOffXOBuffer(&callType, NULL, NULL);
+    VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+    pMac->pmc.rfSuppliesVotedOff= TRUE;
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestBmpsState
+*
+* Description:
+*    Have the device enter the Request BMPS State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestBmpsState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestBmpsState\n"));
+
+    /* Can enter Request BMPS State only from Full Power State. */
+    if (pMac->pmc.pmcState != FULL_POWER)
+    {
+        smsLog(pMac, LOGE, FL("Trying to enter Request BMPS State from state %d\n"), pMac->pmc.pmcState);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Stop Traffic timer if running. Note: timer could have expired because of possible
+       race conditions. So no need to check for errors. Just make sure timer is not running */
+    pmcStopTrafficTimer(hHal);
+
+    /* Tell MAC to have device enter BMPS mode. */
+    if ( !pMac->pmc.bmpsRequestQueued )
+    {
+        pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_TRUE;
+        if(pmcIssueCommand(hHal, eSmeCommandEnterBmps, NULL, 0, FALSE) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ\n");
+            pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
+            pMac->pmc.pmcState = FULL_POWER;
+            if(pmcShouldBmpsTimerRun(pMac))
+            {
+                (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+            }
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+    else
+    {
+        smsLog(pMac, LOGE, "PMC: enter BMPS command already queued\n");
+        //restart the timer if needed
+        if(pmcShouldBmpsTimerRun(pMac))
+        {
+            (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+        }
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    smsLog(pMac, LOGW, FL("eWNI_PMC_ENTER_BMPS_REQ sent to PE\n"));
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterBmpsState
+*
+* Description:
+*    Have the device enter the BMPS State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterBmpsState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcEnterBmpsState\n"));
+
+    /* Can enter BMPS State only from 5 states. */
+    if (pMac->pmc.pmcState != REQUEST_BMPS &&
+        pMac->pmc.pmcState != REQUEST_START_UAPSD &&
+        pMac->pmc.pmcState != REQUEST_STOP_UAPSD &&
+        pMac->pmc.pmcState != REQUEST_ENTER_WOWL &&
+        pMac->pmc.pmcState != REQUEST_EXIT_WOWL)
+    {
+        smsLog(pMac, LOGE, FL("Trying to enter BMPS State from state %d\n"), pMac->pmc.pmcState);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Change state. */
+    pMac->pmc.pmcState = BMPS;
+
+   /* Update registerd modules that we are entering BMPS. This is
+      only way to inform modules if PMC entered BMPS power save mode
+      on its own because of traffic timer */
+    pmcDoDeviceStateUpdateCallbacks(hHal, BMPS);
+
+    /* If we have a reqeust for full power pending then we have to go directly into full power. */
+    if (pMac->pmc.requestFullPowerPending)
+    {
+
+#if defined(ANI_OS_TYPE_WINDOWS) && !defined(GEN6_ONWARDS)
+        /* In Windows, we cannot do this now since we are in DPC context and the message to the
+           SoftMAC to put the device into BMPS will be sent at the end of DPC processing.  Instead
+           we set a short timer and start the BMPS exit sequence when the timer fires. */
+        if (palTimerStart(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer, 1000, FALSE) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot start exit power save mode timer\n"));
+            PMC_ABORT;
+            return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+#else
+        /* Start exit BMPS sequence now. */
+        smsLog(pMac, LOGW, FL("Pending Full Power request found on entering BMPS mode. "
+                  "Start exit BMPS exit sequence\n"));
+        //Note: Reason must have been set when requestFullPowerPending flag was set.
+        pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+        return eHAL_STATUS_SUCCESS;
+#endif
+    }
+
+    /*This should never happen ideally. WOWL and UAPSD not supported at the same time */
+    if (pMac->pmc.wowlModeRequired && pMac->pmc.uapsdSessionRequired)
+    {
+        smsLog(pMac, LOGW, FL("Both UAPSD and WOWL is required on entering BMPS mode. "
+               "UAPSD will be prioritized over WOWL\n"));
+    }
+
+    /* Do we need Uapsd?*/
+    if (pMac->pmc.uapsdSessionRequired)
+    {
+        smsLog(pMac, LOGW, FL("UAPSD session is required on entering BMPS mode. "
+                  "Start UAPSD entry sequence\n"));
+        pmcEnterRequestStartUapsdState(hHal);
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    /* Do we need WOWL?*/
+    if (pMac->pmc.wowlModeRequired)
+    {
+        smsLog(pMac, LOGW, FL("WOWL is required on entering BMPS mode. "
+                  "Start WOWL entry sequence\n"));
+        pmcRequestEnterWowlState(hHal, &(pMac->pmc.wowlEnterParams));
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcPowerSaveCheck
+*
+* Description:
+*    Check if device is allowed to enter a power save mode.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    TRUE - entry is allowed
+*    FALSE - entry is not allowed at this time
+*
+******************************************************************************/
+tANI_BOOLEAN pmcPowerSaveCheck (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tpPowerSaveCheckEntry pPowerSaveCheckEntry;
+    tANI_BOOLEAN (*checkRoutine) (void *checkContext);
+    tANI_BOOLEAN bResult=FALSE;
+
+    smsLog(pMac, LOG2, FL("Entering pmcPowerSaveCheck\n"));
+
+    /* Call the routines in the power save check routine list.  If any
+       return FALSE, then we cannot go into power save mode. */
+    pEntry = csrLLPeekHead(&pMac->pmc.powerSaveCheckList, FALSE);
+    while (pEntry != NULL)
+    {
+        pPowerSaveCheckEntry = GET_BASE_ADDR(pEntry, tPowerSaveCheckEntry, link);
+        checkRoutine = pPowerSaveCheckEntry->checkRoutine;
+
+        /* If the checkRoutine is NULL for a paricular entry, proceed with other entries
+         * in the list */
+        if (NULL != checkRoutine)
+        {
+            if (!checkRoutine(pPowerSaveCheckEntry->checkContext))
+            {
+                smsLog(pMac, LOGE, FL("pmcPowerSaveCheck fail!\n"));
+                bResult = FALSE; 
+                break;
+            }
+            else
+            {
+                bResult = TRUE;
+            }
+        }
+        pEntry = csrLLNext(&pMac->pmc.powerSaveCheckList, pEntry, FALSE);
+    }
+
+    return bResult;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcSendPowerSaveConfigMessage
+*
+* Description:
+*    Send a message to PE/MAC to configure the power saving modes.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - message successfuly sent
+*    eHAL_STATUS_FAILURE - error while sending message
+*
+******************************************************************************/
+eHalStatus pmcSendPowerSaveConfigMessage (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirPowerSaveCfg powerSaveConfig;
+
+    smsLog(pMac, LOG2, FL("Entering pmcSendPowerSaveConfigMessage\n"));
+    
+    palZeroMemory(pMac->hHdd, &(powerSaveConfig), sizeof(tSirPowerSaveCfg));
+
+    switch (pMac->pmc.bmpsConfig.forwardBeacons)
+    {
+    case ePMC_NO_BEACONS:
+        powerSaveConfig.beaconFwd = ePM_BEACON_FWD_NONE;
+        break;
+    case ePMC_BEACONS_WITH_TIM_SET:
+        powerSaveConfig.beaconFwd = ePM_BEACON_FWD_TIM;
+        break;
+    case ePMC_BEACONS_WITH_DTIM_SET:
+        powerSaveConfig.beaconFwd = ePM_BEACON_FWD_DTIM;
+        break;
+    case ePMC_NTH_BEACON:
+        powerSaveConfig.beaconFwd = ePM_BEACON_FWD_NTH;
+        powerSaveConfig.nthBeaconFwd = (tANI_U16)pMac->pmc.bmpsConfig.valueOfN;
+        break;
+    case ePMC_ALL_BEACONS:
+        powerSaveConfig.beaconFwd = ePM_BEACON_FWD_NTH;
+        powerSaveConfig.nthBeaconFwd = 1;
+        break;
+    }
+    powerSaveConfig.fEnablePwrSaveImmediately = pMac->pmc.bmpsConfig.setPmOnLastFrame;
+    powerSaveConfig.fPSPoll = pMac->pmc.bmpsConfig.usePsPoll;
+    powerSaveConfig.fEnableBeaconEarlyTermination = 
+        pMac->pmc.bmpsConfig.enableBeaconEarlyTermination;
+    powerSaveConfig.bcnEarlyTermWakeInterval = 
+        pMac->pmc.bmpsConfig.bcnEarlyTermWakeInterval;
+
+    /* setcfg for listenInterval. Make sure CFG is updated because PE reads this 
+       from CFG at the time of assoc or reassoc */
+    ccmCfgSetInt(pMac, WNI_CFG_LISTEN_INTERVAL, pMac->pmc.bmpsConfig.bmpsPeriod, 
+        NULL, eANI_BOOLEAN_FALSE);
+
+    if( pMac->pmc.pmcState == IMPS || pMac->pmc.pmcState == REQUEST_IMPS )
+    {
+        //Wake up the chip first
+        eHalStatus status = pmcDeferMsg( pMac, eWNI_PMC_PWR_SAVE_CFG, 
+                                    &powerSaveConfig, sizeof(tSirPowerSaveCfg) );
+
+        if( eHAL_STATUS_PMC_PENDING == status )
+        {
+            return eHAL_STATUS_SUCCESS;
+        }
+        else 
+        {
+            //either fail or already in full power
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                return ( status );
+            }
+            //else let it through because it is in full power state
+        }
+    }
+    /* Send a message so that FW System config is also updated and is in sync with
+       the CFG.*/
+    if (pmcSendMessage(hHal, eWNI_PMC_PWR_SAVE_CFG, &powerSaveConfig, sizeof(tSirPowerSaveCfg)) 
+        != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+   
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcSendMessage
+*
+* Description:
+*    Send a message to PE/MAC.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    messageType - message type to send
+*    pMessageData - pointer to message data
+*    messageSize - Size of the message data
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - message successfuly sent
+*    eHAL_STATUS_FAILURE - error while sending message
+*
+******************************************************************************/
+eHalStatus pmcSendMessage (tpAniSirGlobal pMac, tANI_U16 messageType, void *pMessageData, tANI_U32 messageSize)
+{
+    tSirMbMsg *pMsg;
+
+    smsLog(pMac, LOG2, FL("Entering pmcSendMessage, message type %d\n"), messageType);
+
+    /* Allocate and fill in message. */
+    if (palAllocateMemory(pMac->hHdd, (void **)&pMsg, WNI_CFG_MB_HDR_LEN + messageSize) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for message\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+    pMsg->type = messageType;
+    pMsg->msgLen = (tANI_U16) (WNI_CFG_MB_HDR_LEN + messageSize);
+    if (messageSize > 0)
+    {
+        if (palCopyMemory(pMac->hHdd, pMsg->data, pMessageData, messageSize) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot copy message data\n"));
+            PMC_ABORT;
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+
+    /* Send message. */
+    if (palSendMBMessage(pMac->hHdd, pMsg) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot send message\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcDoCallbacks
+*
+* Description:
+*    Call the IMPS callback routine and the routines in the request full
+*    power callback routine list.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackStatus - status to pass to the callback routines
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcDoCallbacks (tHalHandle hHal, eHalStatus callbackStatus)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tpRequestFullPowerEntry pRequestFullPowerEntry;
+
+    smsLog(pMac, LOG2, FL("Entering pmcDoCallbacks\n"));
+
+    /* Call IMPS callback routine. */
+    if (pMac->pmc.impsCallbackRoutine != NULL)
+    {
+        pMac->pmc.impsCallbackRoutine(pMac->pmc.impsCallbackContext, callbackStatus);
+        pMac->pmc.impsCallbackRoutine = NULL;
+    }
+
+    /* Call the routines in the request full power callback routine list. */
+    while (NULL != (pEntry = csrLLRemoveHead(&pMac->pmc.requestFullPowerList, TRUE)))
+    {
+        pRequestFullPowerEntry = GET_BASE_ADDR(pEntry, tRequestFullPowerEntry, link);
+        if (pRequestFullPowerEntry->callbackRoutine)
+           pRequestFullPowerEntry->callbackRoutine(pRequestFullPowerEntry->callbackContext, callbackStatus);
+        if (palFreeMemory(pMac->hHdd, pRequestFullPowerEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free request full power routine list entry\n"));
+            PMC_ABORT;
+        }
+    }
+
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcStartTrafficTimer
+*
+* Description:
+*    Start the timer used in Full Power State to measure traffic
+*    levels and determine when to enter BMPS.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - timer successfuly started
+*    eHAL_STATUS_FAILURE - error while starting timer
+*
+******************************************************************************/
+eHalStatus pmcStartTrafficTimer (tHalHandle hHal, tANI_U32 expirationTime)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    VOS_STATUS vosStatus;
+
+    smsLog(pMac, LOG2, FL("Entering pmcStartTrafficTimer\n"));
+
+    vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, expirationTime);
+    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+    {
+        if( VOS_STATUS_E_ALREADY == vosStatus )
+        {
+            //Consider this ok since the timer is already started.
+            smsLog(pMac, LOGW, FL("  traffic timer is already started\n"));
+        }
+        else
+        {
+            smsLog(pMac, LOGP, FL("Cannot start traffic timer\n"));
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcStopTrafficTimer
+*
+* Description:
+*    Cancels the timer (if running) used in Full Power State to measure traffic
+*    levels and determine when to enter BMPS.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+*
+******************************************************************************/
+void pmcStopTrafficTimer (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    smsLog(pMac, LOG2, FL("Entering pmcStopTrafficTimer\n"));
+    vos_timer_stop(&pMac->pmc.hTrafficTimer);
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcImpsTimerExpired
+*
+* Description:
+*    Called when IMPS timer expires.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcImpsTimerExpired (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcImpsTimerExpired\n"));
+
+    /* If timer expires and we are in a state other than IMPS State then something is wrong. */
+    if (pMac->pmc.pmcState != IMPS)
+    {
+        smsLog(pMac, LOGE, FL("Got IMPS timer expiration in state %d\n"), pMac->pmc.pmcState);
+        PMC_ABORT;
+        return;
+    }
+
+    /* Start on the path of going back to full power. */
+    pmcEnterRequestFullPowerState(hHal, eSME_REASON_OTHER);
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcTrafficTimerExpired
+*
+* Description:
+*    Called when traffic measurement timer expires.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcTrafficTimerExpired (tHalHandle hHal)
+{
+
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    VOS_STATUS vosStatus;
+
+    smsLog(pMac, LOGW, FL("BMPS Traffic timer expired"));
+
+    /* If timer expires and we are in a state other than Full Power State then something is wrong. */
+    if (pMac->pmc.pmcState != FULL_POWER)
+    {
+        smsLog(pMac, LOGE, FL("Got traffic timer expiration in state %d"), pMac->pmc.pmcState);
+        return;
+    }
+
+    /* Untill DHCP is not completed remain in power active */
+    if(pMac->pmc.remainInPowerActiveTillDHCP)
+    {
+        smsLog(pMac, LOGE, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS\n"));
+        pMac->pmc.remainInPowerActiveThreshold++;
+        if( pMac->pmc.remainInPowerActiveThreshold >= DHCP_REMAIN_POWER_ACTIVE_THRESHOLD)
+        {
+           smsLog(pMac, LOGE, FL("Remain in power active DHCP threshold reached FALLBACK to enable enter BMPS\n"));
+           /*FALLBACK: reset the flag to make BMPS entry possible*/
+           pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
+           pMac->pmc.remainInPowerActiveThreshold = 0;
+        }
+        //Activate the Traffic Timer again for entering into BMPS
+        vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) && (VOS_STATUS_E_ALREADY != vosStatus) )
+        {
+            smsLog(pMac, LOGP, FL("Cannot re-start traffic timer\n"));
+        }
+        return;
+    }
+
+    /* Clear remain in power active threshold */
+    pMac->pmc.remainInPowerActiveThreshold = 0;
+
+    /* Check if the timer should be running */
+    if (!pmcShouldBmpsTimerRun(pMac))
+    {
+        smsLog(pMac, LOGE, FL("BMPS timer should not be running"));
+        return;
+    }
+
+    if (pmcPowerSaveCheck(hHal)) 
+    {
+        smsLog(pMac, LOGW, FL("BMPS entry criteria satisfied. Requesting BMPS state"));
+        (void)pmcEnterRequestBmpsState(hHal);    
+    } 
+    else 
+    {
+        /*Some module voted against Power Save. So timer should be restarted again to retry BMPS */
+        smsLog(pMac, LOGE, FL("Power Save check failed. Retry BMPS again later"));
+        //Since hTrafficTimer is a vos_timer now, we need to restart the timer here
+        vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) && (VOS_STATUS_E_ALREADY != vosStatus) )
+        {
+            smsLog(pMac, LOGP, FL("Cannot start traffic timer\n"));
+            return;
+        }
+    }
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcExitPowerSaveTimerExpired
+*
+* Description:
+*    Called when timer used to schedule a deferred power save mode exit expires.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcExitPowerSaveTimerExpired (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcExitPowerSaveTimerExpired\n"));
+
+    /* Make sure process of exiting power save mode might hasn't already been started due to another trigger. */
+    if (pMac->pmc.requestFullPowerPending)
+
+        /* Start on the path of going back to full power. */
+        pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+}
+
+/******************************************************************************
+*
+* Name:  pmcDoBmpsCallbacks
+*
+* Description:
+*    Call the registered BMPS callback routines because device is unable to
+*    enter BMPS state
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackStatus - Success or Failure.
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcDoBmpsCallbacks (tHalHandle hHal, eHalStatus callbackStatus)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tListElem *pEntry;
+   tpRequestBmpsEntry pRequestBmpsEntry;
+
+   smsLog(pMac, LOG2, "PMC: entering pmcDoBmpsCallbacks\n");
+
+   /* Call the routines in the request BMPS callback routine list. */
+   pEntry = csrLLRemoveHead(&pMac->pmc.requestBmpsList, FALSE);
+   while (pEntry != NULL)
+   {
+      pRequestBmpsEntry = GET_BASE_ADDR(pEntry, tRequestBmpsEntry, link);
+      if (pRequestBmpsEntry->callbackRoutine)
+         pRequestBmpsEntry->callbackRoutine(pRequestBmpsEntry->callbackContext,
+         callbackStatus);
+      palFreeMemory(pMac->hHdd, pRequestBmpsEntry);
+      pEntry = csrLLRemoveHead(&pMac->pmc.requestBmpsList, FALSE);
+   }
+}
+
+
+
+
+/******************************************************************************
+*
+* Name:  pmcDoStartUapsdCallbacks
+*
+* Description:
+*    Call the registered UAPSD callback routines because device is unable to
+*    start UAPSD state
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackStatus - Success or Failure. 
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcDoStartUapsdCallbacks (tHalHandle hHal, eHalStatus callbackStatus)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tListElem *pEntry;
+   tpStartUapsdEntry pStartUapsdEntry;
+
+   smsLog(pMac, LOG2, "PMC: entering pmcDoStartUapsdCallbacks\n");
+
+   /* Call the routines in the request start UAPSD callback routine list. */
+   pEntry = csrLLRemoveHead(&pMac->pmc.requestStartUapsdList, FALSE);
+   while (pEntry != NULL)
+   {
+      pStartUapsdEntry = GET_BASE_ADDR(pEntry, tStartUapsdEntry, link);
+      pStartUapsdEntry->callbackRoutine(pStartUapsdEntry->callbackContext,
+         callbackStatus);
+      palFreeMemory(pMac->hHdd, pStartUapsdEntry);
+      pEntry = csrLLRemoveHead(&pMac->pmc.requestStartUapsdList, FALSE);
+   }
+}
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestStartUapsdState
+*
+* Description:
+*    Have the device enter the UAPSD State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestStartUapsdState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   v_BOOL_t fFullPower = VOS_FALSE;     //need to get back to full power state
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStartUapsdState\n");
+
+   /* Can enter UAPSD State only from FULL_POWER or BMPS State. */
+   switch (pMac->pmc.pmcState)
+   {
+      case FULL_POWER:
+         /* Check that entry into a power save mode is allowed at this time. */
+         if (!pmcPowerSaveCheck(hHal))
+         {
+            smsLog(pMac, LOGW, "PMC: Power save check failed. UAPSD request "
+                      "will be accepted and buffered\n");
+            /* UAPSD mode will be attempted when we enter BMPS later */
+            pMac->pmc.uapsdSessionRequired = TRUE;
+            /* Make sure the BMPS retry timer is running */
+            if(pmcShouldBmpsTimerRun(pMac))
+               (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+            break;
+         }
+         else
+         {
+            pMac->pmc.uapsdSessionRequired = TRUE;
+            //Check BTC state
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            if( btcIsReadyForUapsd( pMac ) )
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+            {
+               /* Put device in BMPS mode first. This step should NEVER fail.
+                  That is why no need to buffer the UAPSD request*/
+               if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
+               {
+                   smsLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. "
+                            "UAPSD request will be dropped \n");
+                  return eHAL_STATUS_FAILURE;
+               }
+            }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            else
+            {
+               (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+            }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+         }
+         break;
+
+      case BMPS:
+         //It is already in BMPS mode, check BTC state
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+         if( btcIsReadyForUapsd(pMac) )
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+         {
+            /* Tell MAC to have device enter UAPSD mode. */
+            if (pmcIssueCommand(hHal, eSmeCommandEnterUapsd, NULL, 0, FALSE) !=
+               eHAL_STATUS_SUCCESS)
+            {
+               smsLog(pMac, LOGE, "PMC: failure to send message "
+                  "eWNI_PMC_ENTER_BMPS_REQ\n");
+               return eHAL_STATUS_FAILURE;
+            }
+         }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+         else
+         {
+            //Not ready for UAPSD at this time, save it first and wake up the chip
+            smsLog(pMac, LOGE, " PMC state = %d\n",pMac->pmc.pmcState);
+            pMac->pmc.uapsdSessionRequired = TRUE;
+            /* While BTC traffic is going on, STA can be in BMPS 
+             * and need not go to Full Power */
+            //fFullPower = VOS_TRUE; 
+         }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+         break;
+
+      case REQUEST_START_UAPSD:
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+         if( !btcIsReadyForUapsd(pMac) )
+         {
+            //BTC rejects UAPSD, bring it back to full power
+            fFullPower = VOS_TRUE;
+         }
+#endif
+         break;
+
+      case REQUEST_BMPS:
+        /* Buffer request for UAPSD mode. */
+        pMac->pmc.uapsdSessionRequired = TRUE;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+        if( !btcIsReadyForUapsd(pMac) )
+         {
+            //BTC rejects UAPSD, bring it back to full power
+            fFullPower = VOS_TRUE;
+         }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+        break;
+
+      default:
+         smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d\n",
+            pMac->pmc.pmcState);
+         return eHAL_STATUS_FAILURE;
+   }
+
+   if(fFullPower)
+   {
+      if( eHAL_STATUS_PMC_PENDING != pmcRequestFullPower( pMac, NULL, NULL, eSME_REASON_OTHER ) )
+      {
+         //This is an error
+         smsLog(pMac, LOGE, FL(" fail to request full power because BTC\n"));
+      }
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcEnterUapsdState
+*
+* Description:
+*    Have the device enter the UAPSD State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterUapsdState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterUapsdState\n");
+
+   /* Can enter UAPSD State only from Request UAPSD State. */
+   if (pMac->pmc.pmcState != REQUEST_START_UAPSD )
+   {
+      smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d\n",
+      pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Change state. */
+   pMac->pmc.pmcState = UAPSD;
+
+   /* Update registerd modules that we are entering UAPSD. This is
+      only way to inform modules if PMC resumed UAPSD power save mode
+      on its own after full power mode */
+   pmcDoDeviceStateUpdateCallbacks(hHal, UAPSD);
+   
+   /* If we have a reqeust for full power pending then we have to go
+   directly into full power. */
+   if (pMac->pmc.requestFullPowerPending)
+   {
+      /* Start exit UAPSD sequence now. */
+      return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestStopUapsdState
+*
+* Description:
+*    Have the device Stop the UAPSD State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestStopUapsdState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStopUapsdState\n");
+
+   /* If already in REQUEST_STOP_UAPSD, simply return */
+   if (pMac->pmc.pmcState == REQUEST_STOP_UAPSD)
+   {
+      return eHAL_STATUS_SUCCESS;
+   }
+
+   /* Can enter Request Stop UAPSD State only from UAPSD */
+   if (pMac->pmc.pmcState != UAPSD)
+   {
+      smsLog(pMac, LOGE, "PMC: trying to enter Request Stop UAPSD State from "
+         "state %d\n", pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Tell MAC to have device exit UAPSD mode. */
+   if (pmcIssueCommand(hHal, eSmeCommandExitUapsd, NULL, 0, FALSE) !=
+      eHAL_STATUS_SUCCESS)
+   {
+      smsLog(pMac, LOGE, "PMC: failure to send message "
+         "eWNI_PMC_EXIT_UAPSD_REQ\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcEnterRequestStandbyState
+*
+* Description:
+*    Have the device enter the Request STANDBY State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterRequestStandbyState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStandbyState\n");
+
+   /* Can enter Standby State only from Full Power State. */
+   if (pMac->pmc.pmcState != FULL_POWER)
+   {
+      smsLog(pMac, LOGE, "PMC: trying to enter Standby State from "
+         "state %d\n", pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   // Stop traffic timer. Just making sure timer is not running
+   pmcStopTrafficTimer(hHal);
+
+   /* Tell MAC to have device enter STANDBY mode. We are using the same message
+      as IMPS mode to avoid code changes in layer below (PE/HAL)*/
+   if (pmcIssueCommand(hHal, eSmeCommandEnterStandby, NULL, 0, FALSE) !=
+      eHAL_STATUS_SUCCESS)
+   {
+      smsLog(pMac, LOGE, "PMC: failure to send message "
+         "eWNI_PMC_ENTER_IMPS_REQ\n");
+      pMac->pmc.pmcState = FULL_POWER;
+
+      if(pmcShouldBmpsTimerRun(pMac))
+          (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+      return eHAL_STATUS_FAILURE;
+   }
+   
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcEnterStandbyState
+*
+* Description:
+*    Have the device enter the STANDBY State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterStandbyState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   vos_call_status_type callType;
+   VOS_STATUS status;
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterStandbyState\n");
+
+   /* Can enter STANDBY State only from REQUEST_STANDBY State. */
+   if (pMac->pmc.pmcState != REQUEST_STANDBY)
+   {
+      smsLog(pMac, LOGE, "PMC: trying to enter STANDBY State from state %d\n",
+         pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Change state. */
+   pMac->pmc.pmcState = STANDBY;
+
+   /* If we have a reqeust for full power pending then we have to go
+      directly into full power. */
+   if (pMac->pmc.requestFullPowerPending)
+   {
+      /* Start exit STANDBY sequence now. */
+      return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+   }
+
+   //Note that RF supplies are not voted off if there is already a pending request
+   //for full power
+   status = vos_chipVoteOffRFSupply(&callType, NULL, NULL);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+   status = vos_chipVoteOffXOBuffer(&callType, NULL, NULL);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
+
+   pMac->pmc.rfSuppliesVotedOff= TRUE;
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcDoStandbyCallbacks
+*
+* Description:
+*    Call the registered Standby callback routines 
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackStatus - Success or Failure.
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcDoStandbyCallbacks (tHalHandle hHal, eHalStatus callbackStatus)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+ 
+   smsLog(pMac, LOG2, "PMC: entering pmcDoStandbyCallbacks\n");
+
+   /* Call Standby callback routine. */
+   if (pMac->pmc.standbyCallbackRoutine != NULL)
+      pMac->pmc.standbyCallbackRoutine(pMac->pmc.standbyCallbackContext, callbackStatus);
+   pMac->pmc.standbyCallbackRoutine = NULL;
+   pMac->pmc.standbyCallbackContext = NULL;
+}
+
+/******************************************************************************
+*
+* Name:  pmcGetPmcState
+*
+* Description:
+*    Return the PMC state
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    tPmcState (one of IMPS, REQUEST_IMPS, BMPS, REQUEST_BMPS etc)
+*
+******************************************************************************/
+tPmcState pmcGetPmcState (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    return pMac->pmc.pmcState; 
+}
+
+const char* pmcGetPmcStateStr(tPmcState state)
+{
+    switch(state)
+    {
+        case STOPPED:
+            return "STOPPED";
+        case FULL_POWER:
+            return "FULL_POWER";
+        case LOW_POWER:
+            return "LOW_POWER";
+        case IMPS:
+            return "IMPS";
+        case BMPS:
+            return "BMPS";
+        case UAPSD:
+            return "UAPSD";
+        case STANDBY:
+            return "STANDBY";
+        case REQUEST_IMPS:
+            return "REQUEST_IMPS";
+        case REQUEST_BMPS:
+            return "REQUEST_BMPS";
+        case REQUEST_START_UAPSD:
+            return "REQUEST_START_UAPSD";
+        case REQUEST_STOP_UAPSD:
+            return "REQUEST_STOP_UAPSD";
+        case REQUEST_FULL_POWER:
+            return "REQUEST_FULL_POWER";
+        case REQUEST_STANDBY:
+            return "REQUEST_STANDBY";
+        case REQUEST_ENTER_WOWL:
+            return "REQUEST_ENTER_WOWL";
+        case REQUEST_EXIT_WOWL:
+            return "REQUEST_EXIT_WOWL";
+        case WOWL:
+            return "WOWL";
+        default:
+            break;
+    }
+
+    return "UNKNOWN";
+}
+
+void pmcDoDeviceStateUpdateCallbacks (tHalHandle hHal, tPmcState state)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tpDeviceStateUpdateIndEntry pDeviceStateUpdateIndEntry;
+    void (*callbackRoutine) (void *callbackContext, tPmcState pmcState);
+
+    smsLog(pMac, LOG2, FL("PMC - Update registered modules of new device "
+           "state: %s\n"), pmcGetPmcStateStr(state));
+
+    /* Call the routines in the update device state routine list. */
+    pEntry = csrLLPeekHead(&pMac->pmc.deviceStateUpdateIndList, FALSE);
+    while (pEntry != NULL)
+    {
+        pDeviceStateUpdateIndEntry = GET_BASE_ADDR(pEntry, tDeviceStateUpdateIndEntry, link);
+        callbackRoutine = pDeviceStateUpdateIndEntry->callbackRoutine;
+        callbackRoutine(pDeviceStateUpdateIndEntry->callbackContext, state);
+        pEntry = csrLLNext(&pMac->pmc.deviceStateUpdateIndList, pEntry, FALSE);
+    }
+}
+
+/******************************************************************************
+*
+* Name:  pmcRequestEnterWowlState
+*
+* Description:
+*    Have the device enter the WOWL State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - WOWL mode will be entered
+*    eHAL_STATUS_FAILURE - WOWL mode cannot be entered
+*
+******************************************************************************/
+eHalStatus pmcRequestEnterWowlState(tHalHandle hHal, tpSirSmeWowlEnterParams wowlEnterParams)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   smsLog(pMac, LOG2, "PMC: entering pmcRequestEnterWowlState\n");
+
+   switch (pMac->pmc.pmcState)
+   {
+      case FULL_POWER:
+         /* Put device in BMPS mode first. This step should NEVER fail. */
+         if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
+         {
+            smsLog(pMac, LOGE, "PMC: Device in Full Power. pmcEnterRequestBmpsState failed. "
+                    "Cannot enter WOWL\n");
+            return eHAL_STATUS_FAILURE;
+         }
+         break;
+
+      case REQUEST_BMPS:
+         smsLog(pMac, LOGW, "PMC: BMPS transaction going on. WOWL request "
+                    "will be buffered\n");         
+         break;
+
+      case BMPS:
+      case WOWL:
+         /* Tell MAC to have device enter WOWL mode. Note: We accept WOWL request
+            when we are in WOWL mode. This allows HDD to change WOWL configuration
+            without having to exit WOWL mode */
+         if (pmcIssueCommand(hHal, eSmeCommandEnterWowl, wowlEnterParams, sizeof(tSirSmeWowlEnterParams), FALSE) !=
+            eHAL_STATUS_SUCCESS)
+         {
+            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ\n");
+            return eHAL_STATUS_FAILURE;
+         }
+         break;
+
+      case REQUEST_ENTER_WOWL:
+         //Multiple enter WOWL requests at the same time are not accepted
+         smsLog(pMac, LOGE, "PMC: Enter WOWL transaction already going on. New WOWL request "
+                    "will be rejected\n");
+         return eHAL_STATUS_FAILURE;
+
+      case REQUEST_EXIT_WOWL:
+         smsLog(pMac, LOGW, "PMC: Exit WOWL transaction going on. New WOWL request "
+                   "will be buffered\n");         
+         break;
+
+      default:
+         smsLog(pMac, LOGE, "PMC: Trying to enter WOWL State from state %s\n",
+            pmcGetPmcStateStr(pMac->pmc.pmcState));
+         return eHAL_STATUS_FAILURE;
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcEnterWowlState
+*
+* Description:
+*    Have the device enter the WOWL State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - changing state successful
+*    eHAL_STATUS_FAILURE - changing state not successful
+*
+******************************************************************************/
+eHalStatus pmcEnterWowlState (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterWowlState\n");
+
+   /* Can enter WOWL State only from Request WOWL State. */
+   if (pMac->pmc.pmcState != REQUEST_ENTER_WOWL )
+   {
+      smsLog(pMac, LOGP, "PMC: trying to enter WOWL State from state %d\n",
+        pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Change state. */
+   pMac->pmc.pmcState = WOWL;
+
+   /* Clear the buffered command for WOWL */
+   pMac->pmc.wowlModeRequired = FALSE;
+
+   /* If we have a reqeust for full power pending then we have to go
+   directly into full power. */
+   if (pMac->pmc.requestFullPowerPending)
+   {
+      /* Start exit Wowl sequence now. */
+      return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcRequestExitWowlState
+*
+* Description:
+*    Have the device exit WOWL State.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - Exit WOWL successful
+*    eHAL_STATUS_FAILURE - Exit WOWL unsuccessful
+*
+******************************************************************************/
+eHalStatus pmcRequestExitWowlState(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, "PMC: entering pmcRequestExitWowlState\n");
+
+    switch (pMac->pmc.pmcState)
+    {
+        case WOWL:
+            /* Tell MAC to have device exit WOWL mode. */
+            if (pmcIssueCommand(hHal, eSmeCommandExitWowl, NULL, 0, FALSE) !=
+                eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ\n");
+                return eHAL_STATUS_FAILURE;
+            }
+            break;
+
+        case REQUEST_ENTER_WOWL:
+            smsLog(pMac, LOGP, "PMC: Rcvd exit WOWL even before enter WOWL was completed\n");
+            return eHAL_STATUS_FAILURE;   
+
+        default:
+            smsLog(pMac, LOGW, "PMC: Got exit WOWL in state %s. Nothing to do as already out of WOWL\n",
+            pmcGetPmcStateStr(pMac->pmc.pmcState));
+            break;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcDoEnterWowlCallbacks
+*
+* Description:
+*    Invoke Enter WOWL callbacks
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns: None
+*
+******************************************************************************/
+void pmcDoEnterWowlCallbacks (tHalHandle hHal, eHalStatus callbackStatus)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+ 
+   smsLog(pMac, LOG2, "PMC: entering pmcDoWowlCallbacks\n");
+
+   /* Call Wowl callback routine. */
+   if (pMac->pmc.enterWowlCallbackRoutine != NULL)
+      pMac->pmc.enterWowlCallbackRoutine(pMac->pmc.enterWowlCallbackContext, callbackStatus);
+
+   pMac->pmc.enterWowlCallbackRoutine = NULL;
+   pMac->pmc.enterWowlCallbackContext = NULL;
+}
+
+
+static void pmcProcessDeferredMsg( tpAniSirGlobal pMac )
+{
+    tPmcDeferredMsg *pDeferredMsg;
+    tListElem *pEntry;
+
+    while( NULL != ( pEntry = csrLLRemoveHead( &pMac->pmc.deferredMsgList, eANI_BOOLEAN_TRUE ) ) )
+    {
+        pDeferredMsg = GET_BASE_ADDR( pEntry, tPmcDeferredMsg, link );
+        switch (pDeferredMsg->messageType)
+        {
+        case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
+            VOS_ASSERT( pDeferredMsg->size == sizeof(tSirWowlAddBcastPtrn) );
+            if (pmcSendMessage(pMac, eWNI_PMC_WOWL_ADD_BCAST_PTRN, 
+                    &pDeferredMsg->u.wowlAddPattern, sizeof(tSirWowlAddBcastPtrn))
+                    != eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed\n"));
+            }
+            break;
+
+        case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
+            VOS_ASSERT( pDeferredMsg->size == sizeof(tSirWowlDelBcastPtrn) );
+            if (pmcSendMessage(pMac, eWNI_PMC_WOWL_DEL_BCAST_PTRN, 
+                    &pDeferredMsg->u.wowlDelPattern, sizeof(tSirWowlDelBcastPtrn))
+                    != eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed\n"));
+            }
+            break;
+
+        case eWNI_PMC_PWR_SAVE_CFG:
+            VOS_ASSERT( pDeferredMsg->size == sizeof(tSirPowerSaveCfg) );
+            if (pmcSendMessage(pMac, eWNI_PMC_PWR_SAVE_CFG, 
+                    &pDeferredMsg->u.powerSaveConfig, sizeof(tSirPowerSaveCfg)) 
+                != eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed\n"));
+            }
+            break;
+
+        default:
+            smsLog(pMac, LOGE, FL("unknown message (%d)\n"), pDeferredMsg->messageType);
+            break;
+        }
+        //Need to free the memory here
+        palFreeMemory( pMac->hHdd, pDeferredMsg );
+    } //while
+}
+
+
+eHalStatus pmcDeferMsg( tpAniSirGlobal pMac, tANI_U16 messageType, void *pData, tANI_U32 size)
+{
+    tPmcDeferredMsg *pDeferredMsg;
+    eHalStatus status;
+
+    if( !HAL_STATUS_SUCCESS( palAllocateMemory( pMac->hHdd, (void **)&pDeferredMsg, sizeof(tPmcDeferredMsg) ) ) )
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for callback context\n"));
+        return eHAL_STATUS_RESOURCES;
+    }
+    palZeroMemory( pMac->hHdd, pDeferredMsg, sizeof(tPmcDeferredMsg) );
+    pDeferredMsg->messageType = messageType;
+    pDeferredMsg->size = (tANI_U16)size;
+    if( pData )
+    {
+        if( !HAL_STATUS_SUCCESS( palCopyMemory( pMac->hHdd, &pDeferredMsg->u.data, 
+                                    pData, size ) ) )
+        {
+            smsLog(pMac, LOGE, FL("Cannot copy pattern for callback context\n"));
+            palFreeMemory( pMac->hHdd, pDeferredMsg );
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+    csrLLInsertTail( &pMac->pmc.deferredMsgList, &pDeferredMsg->link, eANI_BOOLEAN_TRUE );
+    //No callback is needed. The messages are put into deferred queue and be processed first 
+    //when enter full power is complete.
+    status = pmcRequestFullPower( pMac, NULL, NULL, eSME_REASON_OTHER );
+    if( eHAL_STATUS_PMC_PENDING != status )
+    {
+        //either fail or already in full power
+        if( csrLLRemoveEntry( &pMac->pmc.deferredMsgList, &pDeferredMsg->link, eANI_BOOLEAN_TRUE ) )
+        {
+            palFreeMemory( pMac->hHdd, pDeferredMsg );
+        }
+        if( !HAL_STATUS_SUCCESS( status ) )
+        {
+            smsLog(pMac, LOGE, FL("failed to request full power status = %d\n"), status);
+        }
+    }
+
+    return (status);
+}
+
+void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    if(!pCommand->u.pmcCmd.fReleaseWhenDone)
+    {
+        //This is a normal command, put it back to the free lsit
+        pCommand->u.pmcCmd.size = 0;
+        smeReleaseCommand( pMac, pCommand );
+    }
+    else
+    {
+        //this is a specially allocated comamnd due to out of command buffer. free it.
+        palFreeMemory(pMac->hHdd, pCommand);
+    }
+}
+
+
+//this function is used to abort a command where the normal processing of the command
+//is terminated without going through the normal path. it is here to take care of callbacks for
+//the command, if applicable.
+void pmcAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
+{
+    if( eSmePmcCommandMask & pCommand->command )
+    {
+        if( !fStopping )
+        {
+            switch( pCommand->command )
+            {
+            case eSmeCommandEnterImps:
+                smsLog(pMac, LOGE, FL("aborting request to enter IMPS\n"));
+                pmcEnterFullPowerState(pMac);
+                break;
+
+            case eSmeCommandExitImps:
+                smsLog(pMac, LOGE, FL("aborting request to exit IMPS \n"));
+                pmcEnterFullPowerState(pMac);
+                break;
+
+            case eSmeCommandEnterBmps:
+                smsLog(pMac, LOGE, FL("aborting request to enter BMPS \n"));
+                pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
+                pmcEnterFullPowerState(pMac);
+                pmcDoBmpsCallbacks(pMac, eHAL_STATUS_FAILURE);
+                break;
+
+            case eSmeCommandExitBmps:
+                smsLog(pMac, LOGE, FL("aborting request to exit BMPS \n"));
+                pmcEnterFullPowerState(pMac);
+                break;
+
+            case eSmeCommandEnterUapsd:
+                smsLog(pMac, LOGE, FL("aborting request to enter UAPSD \n"));
+                //Since there is no retry for UAPSD, tell the requester here we are done with failure
+                pMac->pmc.uapsdSessionRequired = FALSE;
+                pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
+                break;
+
+            case eSmeCommandExitUapsd:
+                smsLog(pMac, LOGE, FL("aborting request to exit UAPSD \n"));
+                break;
+
+            case eSmeCommandEnterWowl:
+                smsLog(pMac, LOGE, FL("aborting request to enter WOWL \n"));
+                pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
+                break;
+
+            case eSmeCommandExitWowl:
+                smsLog(pMac, LOGE, FL("aborting request to exit WOWL \n"));
+                break;
+
+            case eSmeCommandEnterStandby:
+                smsLog(pMac, LOGE, FL("aborting request to enter Standby \n"));
+                pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
+                break;
+
+            default:
+                smsLog(pMac, LOGE, FL("Request for PMC command (%d) is dropped\n"), pCommand->command);
+                break;
+            }
+        }// !stopping
+        pmcReleaseCommand( pMac, pCommand );
+    }
+}
+
+
+
+//These commands are not supposed to fail due to out of command buffer,
+//otherwise other commands are not executed and no command is released. It will be deadlock. 
+#define PMC_IS_COMMAND_CANNOT_FAIL(cmdType)\
+    ( (eSmeCommandEnterStandby == (cmdType )) ||\
+      (eSmeCommandExitImps == (cmdType )) ||\
+      (eSmeCommandExitBmps == (cmdType )) ||\
+      (eSmeCommandExitUapsd == (cmdType )) ||\
+      (eSmeCommandExitWowl == (cmdType )) )
+
+eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam, 
+                            tANI_U32 size, tSmeCmd **ppCmd )
+{
+    eHalStatus status = eHAL_STATUS_RESOURCES;
+    tSmeCmd *pCommand = NULL;
+
+    VOS_ASSERT( ppCmd );
+    do
+    {
+        pCommand = smeGetCommandBuffer( pMac );
+        if ( pCommand )
+        {
+            //Make sure it will be put back to the list
+            pCommand->u.pmcCmd.fReleaseWhenDone = FALSE;
+        }
+        else
+        {
+            smsLog( pMac, LOGE, FL(" fail to get command buffer for command 0x%X curState = %d"), cmdType, pMac->pmc.pmcState );
+            //For certain PMC command, we cannot fail
+            if( PMC_IS_COMMAND_CANNOT_FAIL(cmdType) )
+            {
+                smsLog( pMac, LOGE, FL(" command 0x%X  cannot fail try allocating memory for it"), cmdType );
+                status = palAllocateMemory(pMac->hHdd, (void **)&pCommand, sizeof(tSmeCmd));
+                if(!HAL_STATUS_SUCCESS(status))
+                {
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, "%s fail to allocate memory for command (0x%X)", 
+                        __FUNCTION__, cmdType);
+                    pCommand = NULL;
+                    break;
+                }
+                palZeroMemory(pMac->hHdd, pCommand, sizeof(tSmeCmd));
+                //Make sure it will be free when it is done
+                pCommand->u.pmcCmd.fReleaseWhenDone = TRUE;
+            }
+            else
+        {
+            break;
+        }
+        }
+        pCommand->command = cmdType;
+        pCommand->u.pmcCmd.size = size;
+        //Initialize the reason code here. It may be overwritten later when
+        //a particular reason is needed.
+        pCommand->u.pmcCmd.fullPowerReason = eSME_REASON_OTHER;
+        switch ( cmdType )
+        {
+        case eSmeCommandEnterImps:
+        case eSmeCommandExitImps:
+        case eSmeCommandEnterBmps:
+        case eSmeCommandEnterUapsd:
+        case eSmeCommandEnterStandby:
+            status = eHAL_STATUS_SUCCESS;
+            break;
+
+        case eSmeCommandExitUapsd:
+        case eSmeCommandExitWowl:
+            status = eHAL_STATUS_SUCCESS;
+            if( pvParam )
+            {
+                pCommand->u.pmcCmd.fullPowerReason = *( (tRequestFullPowerReason *)pvParam );
+            }
+            break;
+
+        case eSmeCommandExitBmps:
+            status = eHAL_STATUS_SUCCESS;
+            if( pvParam )
+            {
+                pCommand->u.pmcCmd.u.exitBmpsInfo = *( (tExitBmpsInfo *)pvParam );
+                pCommand->u.pmcCmd.fullPowerReason = pCommand->u.pmcCmd.u.exitBmpsInfo.exitBmpsReason;
+            }
+            else
+            {
+                smsLog( pMac, LOGE, (" exit BMPS must have a reason code\n") );
+            }
+            break;
+
+        case eSmeCommandEnterWowl:
+            status = eHAL_STATUS_SUCCESS;
+            if( pvParam )
+            {
+                pCommand->u.pmcCmd.u.enterWowlInfo = *( ( tSirSmeWowlEnterParams * )pvParam );
+            }
+            break;
+
+        default:
+            smsLog( pMac, LOGE, FL("  invalid command type %d\n"), cmdType );
+            status = eHAL_STATUS_INVALID_PARAMETER;
+            break;
+        }
+
+    } while( 0 );
+
+    if( HAL_STATUS_SUCCESS( status ) && pCommand )
+    {
+        *ppCmd = pCommand;
+    }
+    else if( pCommand )
+    {
+        pmcReleaseCommand( pMac, pCommand );
+    }
+
+    return (status);
+}
+
+
+eHalStatus pmcIssueCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam, 
+                            tANI_U32 size, tANI_BOOLEAN fPutToListHead )
+{
+    eHalStatus status = eHAL_STATUS_RESOURCES;
+    tSmeCmd *pCommand = NULL;
+
+    status = pmcPrepareCommand( pMac, cmdType, pvParam, size, &pCommand );
+    if( HAL_STATUS_SUCCESS( status ) && pCommand )
+    {
+        smePushCommand( pMac, pCommand, fPutToListHead );
+    }
+
+    return( status );
+}
+
+
+
+tANI_BOOLEAN pmcProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tANI_BOOLEAN fRemoveCmd = eANI_BOOLEAN_TRUE;
+
+    do
+    {
+        switch ( pCommand->command )
+        {
+        case eSmeCommandEnterImps:
+            if( FULL_POWER == pMac->pmc.pmcState )
+            {
+                status = pmcEnterImpsCheck( pMac );
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    /* Change state. */
+                    pMac->pmc.pmcState = REQUEST_IMPS;
+                    status = pmcSendMessage(pMac, eWNI_PMC_ENTER_IMPS_REQ, NULL, 0);
+                    if( HAL_STATUS_SUCCESS( status ) )
+                    {
+                        /* If we already went back Full Power State (meaning that request did not
+                           get as far as the device) then we are not successfull. */
+                        if ( FULL_POWER != pMac->pmc.pmcState )
+                        {
+                            fRemoveCmd = eANI_BOOLEAN_FALSE;
+                        }
+                    }
+                }
+                if( !HAL_STATUS_SUCCESS( status ) )
+                {
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ or pmcEnterImpsCheck failed\n");
+                    pmcEnterFullPowerState( pMac );
+                    if(pmcShouldBmpsTimerRun(pMac))
+                        (void)pmcStartTrafficTimer(pMac, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+                }
+            }//full_power
+            break;
+
+        case eSmeCommandExitImps:
+            pMac->pmc.requestFullPowerPending = FALSE;
+            if( ( IMPS == pMac->pmc.pmcState ) || ( STANDBY == pMac->pmc.pmcState ) )
+            {
+                //Check state before sending message. The state may change after that
+                if( STANDBY == pMac->pmc.pmcState )
+                {
+                    //Enable Idle scan in CSR
+                    csrScanResumeIMPS(pMac);
+                }
+
+                status = pmcSendMessage(pMac, eWNI_PMC_EXIT_IMPS_REQ, NULL, 0);
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pMac->pmc.pmcState = REQUEST_FULL_POWER;
+                    smsLog(pMac, LOGW, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE\n")); 
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_IMPS_REQ fail to be sent to PE status %d\n"), status); 
+                    //Callbacks are called with success srarus, do we need to pass in real status??
+                    pmcEnterFullPowerState(pMac);
+                }
+            }
+            break;
+
+        case eSmeCommandEnterBmps:
+            if( FULL_POWER == pMac->pmc.pmcState )
+            {
+                //This function will not return success because the pmc state is not BMPS
+                status = pmcEnterBmpsCheck( pMac );
+                if( HAL_STATUS_SUCCESS( status ) )
+                {
+                    /* Change PMC state */
+                    pMac->pmc.pmcState = REQUEST_BMPS;
+                    smsLog(pMac, LOGW, "PMC: Enter BMPS req done: Force XO Core ON\n");
+                    status = vos_chipVoteXOCore(NULL, NULL, NULL, VOS_TRUE); 
+                    if ( !VOS_IS_STATUS_SUCCESS(status) )
+                    {
+                        smsLog(pMac, LOGE, "Could not turn XO Core ON. Can't go to BMPS\n");
+                    }
+                    else /* XO Core turn ON was successful */
+                    {
+                    /* Tell MAC to have device enter BMPS mode. */
+                    status = pmcSendMessage(pMac, eWNI_PMC_ENTER_BMPS_REQ, NULL, 0);
+                    if ( HAL_STATUS_SUCCESS( status ) )
+                    {
+                        fRemoveCmd = eANI_BOOLEAN_FALSE;
+                    }
+                    else
+                    {
+                        smsLog(pMac, LOGE, "Fail to send enter BMPS msg to PE\n");
+                            /* Cancel the vote for XO Core */
+                            smsLog(pMac, LOGW, "In module init: Cancel the vote for XO CORE ON "
+                                                             "since send enter bmps failed\n");
+                            if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
+                            {
+                                smsLog(pMac, LOGE, "Could not cancel XO Core ON vote."
+                                                   "Not returning failure."
+                                                   "Power consumed will be high\n");
+                            }  
+                            
+                        }
+                    }
+                }
+                if( !HAL_STATUS_SUCCESS( status ) )
+                {
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ status %d\n", status);
+                    pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
+                    pmcEnterFullPowerState(pMac);
+                    //Do not call UAPSD callback here since it may be retried
+                    pmcDoBmpsCallbacks(pMac, eHAL_STATUS_FAILURE);
+                    if(pmcShouldBmpsTimerRun(pMac))
+                        (void)pmcStartTrafficTimer(pMac, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+                }
+            }
+            break;
+
+        case eSmeCommandExitBmps:
+            if( BMPS == pMac->pmc.pmcState )
+            {
+                pMac->pmc.requestFullPowerPending = FALSE;
+
+                status = pmcSendMessage( pMac, eWNI_PMC_EXIT_BMPS_REQ, 
+                            &pCommand->u.pmcCmd.u.exitBmpsInfo, sizeof(tExitBmpsInfo) );
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pMac->pmc.pmcState = REQUEST_FULL_POWER;
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                    smsLog(pMac, LOGW, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE\n"));
+
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_BMPS_REQ fail to be sent to PE status %d\n"), status);
+                    pmcEnterFullPowerState(pMac);
+                }
+            }
+            break;
+
+        case eSmeCommandEnterUapsd:
+            if( BMPS == pMac->pmc.pmcState )
+            {
+                pMac->pmc.uapsdSessionRequired = TRUE;
+                status = pmcSendMessage(pMac, eWNI_PMC_ENTER_UAPSD_REQ, NULL, 0);
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pMac->pmc.pmcState = REQUEST_START_UAPSD;
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, "PMC: failure to send message "
+                       "eWNI_PMC_ENTER_BMPS_REQ\n");
+                    //there is no retry for re-entering UAPSD so tell the requester we are done witgh failure.
+                    pMac->pmc.uapsdSessionRequired = FALSE;
+                    pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
+                }
+            }
+            break;
+
+        case eSmeCommandExitUapsd:
+           if( UAPSD == pMac->pmc.pmcState )
+           {
+               pMac->pmc.requestFullPowerPending = FALSE;
+                /* If already in REQUEST_STOP_UAPSD, simply return */
+               if (pMac->pmc.pmcState == REQUEST_STOP_UAPSD)
+               {
+                   break;
+               }
+
+               /* Tell MAC to have device exit UAPSD mode. */
+               status = pmcSendMessage(pMac, eWNI_PMC_EXIT_UAPSD_REQ, NULL, 0);
+               if ( HAL_STATUS_SUCCESS( status ) )
+               {
+                   /* Change state. Note that device will be put in BMPS state at the
+                      end of REQUEST_STOP_UAPSD state even if response is a failure*/
+                   pMac->pmc.pmcState = REQUEST_STOP_UAPSD;
+                   pMac->pmc.requestFullPowerPending = TRUE;
+                   pMac->pmc.requestFullPowerReason = pCommand->u.pmcCmd.fullPowerReason;
+                   fRemoveCmd = eANI_BOOLEAN_FALSE;
+               }
+               else
+               {
+                   smsLog(pMac, LOGE, "PMC: failure to send message "
+                      "eWNI_PMC_EXIT_UAPSD_REQ\n");
+                   pmcEnterBmpsState(pMac);
+               }
+           }
+
+           break;
+
+        case eSmeCommandEnterWowl:
+            if( ( BMPS == pMac->pmc.pmcState ) || ( WOWL == pMac->pmc.pmcState ) )
+            {
+                status = pmcSendMessage(pMac, eWNI_PMC_ENTER_WOWL_REQ, 
+                        &pCommand->u.pmcCmd.u.enterWowlInfo, sizeof(tSirSmeWowlEnterParams));
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pMac->pmc.pmcState = REQUEST_ENTER_WOWL;
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ\n");
+                    pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
+                }
+            }
+            else
+            {
+                fRemoveCmd = eANI_BOOLEAN_TRUE;
+            }
+            break;
+
+        case eSmeCommandExitWowl:
+            if( WOWL == pMac->pmc.pmcState )
+            {
+                pMac->pmc.requestFullPowerPending = FALSE;
+                pMac->pmc.pmcState = REQUEST_EXIT_WOWL;
+                status = pmcSendMessage(pMac, eWNI_PMC_EXIT_WOWL_REQ, NULL, 0);
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                    pMac->pmc.requestFullPowerPending = TRUE;
+                    pMac->pmc.requestFullPowerReason = pCommand->u.pmcCmd.fullPowerReason;
+                }
+                else
+                {
+                    smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ\n");
+                    pmcEnterBmpsState(pMac);
+                }
+            }
+            break;
+
+        case eSmeCommandEnterStandby:
+            if( FULL_POWER == pMac->pmc.pmcState )
+            {
+               //Disallow standby if concurrent sessions are present. Note that CSR would have
+               //caused the STA to disconnect the Infra session (if not already disconnected) because of 
+               //standby request. But we are now failing the standby request because of concurrent session.
+               //So was the tearing of infra session wasteful if we were going to fail the standby request ? 
+               //Not really. This is beacuse if and when BT-AMP etc sessions are torn down we will transition
+               //to IMPS/standby and still save power.
+               if (csrIsIBSSStarted(pMac) || csrIsBTAMPStarted(pMac))
+               {
+                  VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+                      "WLAN: IBSS or BT-AMP session present. Cannot honor standby request");
+
+                  pmcDoStandbyCallbacks(pMac, eHAL_STATUS_PMC_NOT_NOW);
+                  if(pmcShouldBmpsTimerRun(pMac))
+                      (void)pmcStartTrafficTimer(pMac, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+                  break;
+               }
+ 
+                // Stop traffic timer. Just making sure timer is not running
+                pmcStopTrafficTimer(pMac);
+
+                /* Change state. */
+                pMac->pmc.pmcState = REQUEST_STANDBY;
+
+                /* Tell MAC to have device enter STANDBY mode. We are using the same message
+                  as IMPS mode to avoid code changes in layer below (PE/HAL)*/
+                status = pmcSendMessage(pMac, eWNI_PMC_ENTER_IMPS_REQ, NULL, 0);
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    //Disable Idle scan in CSR
+                    csrScanSuspendIMPS(pMac);
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    smsLog(pMac, LOGE, "PMC: failure to send message "
+                        "eWNI_PMC_ENTER_IMPS_REQ\n");
+                    pmcEnterFullPowerState(pMac);
+                    pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
+                    /* Start the timer only if Auto BMPS feature is enabled or an UAPSD session is
+                     required */
+                    if(pmcShouldBmpsTimerRun(pMac))
+                        (void)pmcStartTrafficTimer(pMac, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+                }
+            }
+            break;
+
+        default:
+            smsLog( pMac, LOGE, FL("  invalid command type %d\n"), pCommand->command );
+            break;
+        }
+
+    } while( 0 );
+
+    return( fRemoveCmd );
+}
+
+eHalStatus pmcEnterImpsCheck( tpAniSirGlobal pMac )
+{
+
+    if( !PMC_IS_READY(pMac) )
+    {
+        smsLog(pMac, LOGE, FL("Requesting IMPS when PMC not ready\n"));
+        smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+            pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Check if IMPS is enabled. */
+    if (!pMac->pmc.impsEnabled)
+    {
+        smsLog(pMac, LOG2, FL("IMPS is disabled\n"));
+        return eHAL_STATUS_PMC_DISABLED;
+    }
+
+    /* Check if IMPS enabled for current power source. */
+    if ((pMac->pmc.powerSource == AC_POWER) && !pMac->pmc.impsConfig.enterOnAc)
+    {
+        smsLog(pMac, LOG2, FL("IMPS is disabled when operating on AC power\n"));
+        return eHAL_STATUS_PMC_AC_POWER;
+    }
+
+    /* Check that entry into a power save mode is allowed at this time. */
+    if (!pmcPowerSaveCheck(pMac))
+    {
+        smsLog(pMac, LOG2, FL("IMPS cannot be entered now\n"));
+        return eHAL_STATUS_PMC_NOT_NOW;
+    }
+
+    /* Check that entry into a power save mode is allowed at this time if all
+       running sessions agree. */
+    if (!pmcAllowImps(pMac))
+    {
+        smsLog(pMac, LOG2, FL("IMPS cannot be entered now\n"));
+        return eHAL_STATUS_PMC_NOT_NOW;
+    }
+    
+    /* Check if already in IMPS. */
+    if ((pMac->pmc.pmcState == REQUEST_IMPS) || (pMac->pmc.pmcState == IMPS) ||
+        (pMac->pmc.pmcState == REQUEST_FULL_POWER))
+    {
+        smsLog(pMac, LOG2, FL("Already in IMPS\n"));
+        return eHAL_STATUS_PMC_ALREADY_IN_IMPS;
+    }
+
+    return ( eHAL_STATUS_SUCCESS );
+}
+
+/* This API detrmines if it is ok to proceed with a Enter BMPS Request or not . Note when
+   device is in BMPS/UAPSD states, this API returns failure because it is not ok to issue
+   a BMPS request */
+eHalStatus pmcEnterBmpsCheck( tpAniSirGlobal pMac )
+{
+
+   /* Check if BMPS is enabled. */
+   if (!pMac->pmc.bmpsEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot initiate BMPS. BMPS is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   if( !PMC_IS_READY(pMac) )
+   {
+       smsLog(pMac, LOGE, FL("Requesting BMPS when PMC not ready\n"));
+       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+           pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+       return eHAL_STATUS_FAILURE;
+   }
+
+   /* Check that we are associated with a single active session. */
+   if (!pmcValidateConnectState( pMac ))
+   {
+      smsLog(pMac, LOGE, "PMC: STA not associated with an AP with single active session. BMPS cannot be entered\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* BMPS can only be requested when device is in Full Power */
+   if (pMac->pmc.pmcState != FULL_POWER)
+   {
+      smsLog(pMac, LOGE, "PMC: Device not in full power. Cannot request BMPS. pmcState %d\n", pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+   /* Check that entry into a power save mode is allowed at this time. */
+   if (!pmcPowerSaveCheck(pMac))
+   {
+      smsLog(pMac, LOGE, "PMC: Power save check failed. BMPS cannot be entered now\n");
+      return eHAL_STATUS_PMC_NOT_NOW;
+   }
+
+   smsLog(pMac, LOG1, FL("concurrency enabled %u\n"), pMac->roam.configParam.concurrencyEnabled);
+   if (pMac->roam.configParam.concurrencyEnabled)
+   {
+      pMac->roam.configParam.concurrencyEnabled = 0;
+      smsLog(pMac, LOG1, FL("reset concurrency to disabled %u\n"), pMac->roam.configParam.concurrencyEnabled);
+      csrDisconnectAllActiveSessions(pMac);
+   }
+   return ( eHAL_STATUS_SUCCESS );
+}
+
+tANI_BOOLEAN pmcShouldBmpsTimerRun( tpAniSirGlobal pMac )
+{
+    /* Check if BMPS is enabled and if Auto BMPS Feature is still enabled 
+     * or there is a pending Uapsd request or HDD requested BMPS or there
+     * is a pending request for WoWL. In all these cases BMPS is required. 
+     * Otherwise just stop the timer and return.
+     */
+    if (!(pMac->pmc.bmpsEnabled && (pMac->pmc.autoBmpsEntryEnabled || 
+          pMac->pmc.uapsdSessionRequired || pMac->pmc.bmpsRequestedByHdd ||
+          pMac->pmc.wowlModeRequired )))
+    {
+        smsLog(pMac, LOG1, FL("BMPS is not enabled or not required"));
+        return eANI_BOOLEAN_FALSE;
+    }
+
+    /* Check if there is an Infra session. BMPS is possible only if there is 
+     * an Infra session */
+    if (!csrIsInfraConnected(pMac))
+    {
+        smsLog(pMac, LOG1, FL("No Infra Session or multiple sessions. BMPS should not be started"));
+        return eANI_BOOLEAN_FALSE;
+    }
+    return eANI_BOOLEAN_TRUE;
+}
+
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT 
+
+#define PMC_DIAG_EVT_TIMER_INTERVAL ( 5000 )
+
+void pmcDiagEvtTimerExpired (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_PMC_CURRENT_STATE;
+    psRequest.pmc_current_state = pMac->pmc.pmcState;
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+
+    smsLog(pMac, LOGW, FL("DIAG event timer expired\n"));
+
+    /* re-arm timer */
+    if (pmcStartDiagEvtTimer(hHal) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGP, FL("Cannot re-arm DIAG evt timer\n"));
+    }
+}
+
+eHalStatus pmcStartDiagEvtTimer (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcStartDiagEvtTimer\n"));
+
+    if (palTimerStart(pMac->hHdd, pMac->pmc.hDiagEvtTimer, PMC_DIAG_EVT_TIMER_INTERVAL *
+                          1000, TRUE) != eHAL_STATUS_SUCCESS)
+    {
+       smsLog(pMac, LOGP, FL("Cannot start DIAG evt timer\n"));
+       return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+void pmcStopDiagEvtTimer (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    smsLog(pMac, LOG2, FL("Entering pmcStopDiagEvtTimer\n"));
+    (void)palTimerStop(pMac->hHdd, pMac->pmc.hDiagEvtTimer);
+}
+#endif
diff --git a/CORE/SME/src/pmc/pmcApi.c b/CORE/SME/src/pmc/pmcApi.c
new file mode 100644
index 0000000..ac4a73e
--- /dev/null
+++ b/CORE/SME/src/pmc/pmcApi.c
@@ -0,0 +1,3122 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  pmcApi.c
+*
+* Description: Routines that make up the Power Management Control (PMC) API.
+*
+* Copyright 2008 (c) Qualcomm, Incorporated.  
+* All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "palTimer.h"
+#include "csrLinkList.h"
+#include "smsDebug.h"
+#include "pmcApi.h"
+#include "pmc.h"
+#include "cfgApi.h"
+#include "smeInside.h"
+#include "csrInsideApi.h"
+#include "wlan_ps_wow_diag.h"
+#include "wlan_qct_wda.h"
+#include "limSessionUtils.h"
+#include "csrInsideApi.h"
+
+extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+
+void pmcCloseDeferredMsgList(tpAniSirGlobal pMac);
+void pmcCloseDeviceStateUpdateList(tpAniSirGlobal pMac);
+void pmcCloseRequestStartUapsdList(tpAniSirGlobal pMac);
+void pmcCloseRequestBmpsList(tpAniSirGlobal pMac);
+void pmcCloseRequestFullPowerList(tpAniSirGlobal pMac);
+void pmcClosePowerSaveCheckList(tpAniSirGlobal pMac);
+
+/******************************************************************************
+*
+* Name:  pmcOpen
+*
+* Description:
+*    Does a PMC open operation on the device.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - open successful
+*    eHAL_STATUS_FAILURE - open not successful
+*
+******************************************************************************/
+eHalStatus pmcOpen (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcOpen\n"));
+
+    /* Initialize basic PMC information about device. */
+    pMac->pmc.powerSource = BATTERY_POWER;
+    pMac->pmc.pmcState = STOPPED;
+    pMac->pmc.pmcReady = FALSE;
+
+    /* Initialize Power Save Modes */
+    pMac->pmc.impsEnabled = FALSE;
+    pMac->pmc.autoBmpsEntryEnabled = FALSE;
+    pMac->pmc.smpsEnabled = FALSE;
+    pMac->pmc.uapsdEnabled = TRUE;
+    pMac->pmc.bmpsEnabled = TRUE;
+    pMac->pmc.standbyEnabled = TRUE;
+    pMac->pmc.wowlEnabled = TRUE;
+    pMac->pmc.rfSuppliesVotedOff= FALSE;
+
+    palZeroMemory(pMac->hHdd, &(pMac->pmc.bmpsConfig), sizeof(tPmcBmpsConfigParams));
+    palZeroMemory(pMac->hHdd, &(pMac->pmc.impsConfig), sizeof(tPmcImpsConfigParams));
+    palZeroMemory(pMac->hHdd, &(pMac->pmc.smpsConfig), sizeof(tPmcSmpsConfigParams));
+
+    /* Allocate a timer to use with IMPS. */
+    if (palTimerAlloc(pMac->hHdd, &pMac->pmc.hImpsTimer, pmcImpsTimerExpired, hHal) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate timer for IMPS\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Allocate a timer used in Full Power State to measure traffic
+       levels and determine when to enter BMPS. */
+    if (!VOS_IS_STATUS_SUCCESS(vos_timer_init(&pMac->pmc.hTrafficTimer, 
+                                VOS_TIMER_TYPE_SW, pmcTrafficTimerExpired, hHal)))
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate timer for traffic measurement\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    /* Allocate a timer used to report current PMC state through periodic DIAG event */
+    if (palTimerAlloc(pMac->hHdd, &pMac->pmc.hDiagEvtTimer, pmcDiagEvtTimerExpired, hHal) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate timer for diag event reporting\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+#endif
+
+    //Initialize the default value for Bmps related config. 
+    pMac->pmc.bmpsConfig.trafficMeasurePeriod = BMPS_TRAFFIC_TIMER_DEFAULT;
+    pMac->pmc.bmpsConfig.bmpsPeriod = WNI_CFG_LISTEN_INTERVAL_STADEF;
+
+    /* Allocate a timer used to schedule a deferred power save mode exit. */
+    if (palTimerAlloc(pMac->hHdd, &pMac->pmc.hExitPowerSaveTimer,
+                      pmcExitPowerSaveTimerExpired, hHal) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate exit power save mode timer\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+    
+    /* Initialize lists for power save check routines and request full power callback routines. */
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.powerSaveCheckList) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot initialize power save check routine list\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.requestFullPowerList) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot initialize request full power callback routine list\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Initialize lists for request BMPS callback routines. */
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.requestBmpsList) !=
+      eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, "PMC: cannot initialize request BMPS callback routine list\n");
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Initialize lists for request start UAPSD callback routines. */
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.requestStartUapsdList) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, "PMC: cannot initialize request start UAPSD callback routine list\n");
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Initialize lists for device state update indication callback routines. */
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.deviceStateUpdateIndList) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, "PMC: cannot initialize device state update indication callback list\n");
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if (csrLLOpen(pMac->hHdd, &pMac->pmc.deferredMsgList) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot initialize deferred msg list\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcStart
+*
+* Description:
+*    Does a PMC start operation on the device.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - start successful
+*    eHAL_STATUS_FAILURE - start not successful
+*
+******************************************************************************/
+eHalStatus pmcStart (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirMacHTMIMOPowerSaveState  htMimoPowerSaveState;
+
+    smsLog(pMac, LOG2, FL("Entering pmcStart\n"));
+
+    /* Initialize basic PMC information about device. */
+    pMac->pmc.pmcState = FULL_POWER;
+    pMac->pmc.requestFullPowerPending = FALSE;
+    pMac->pmc.uapsdSessionRequired = FALSE;
+    pMac->pmc.wowlModeRequired = FALSE;
+    pMac->pmc.bmpsRequestedByHdd = FALSE;
+    pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
+    pMac->pmc.remainInPowerActiveThreshold = 0;
+
+    /* WLAN Switch initial states. */
+    pMac->pmc.hwWlanSwitchState = ePMC_SWITCH_ON;
+    pMac->pmc.swWlanSwitchState = ePMC_SWITCH_ON;
+
+    /* No IMPS callback routine yet. */
+    pMac->pmc.impsCallbackRoutine = NULL;
+
+    /* No STANDBY callback routine yet. */
+    pMac->pmc.standbyCallbackRoutine = NULL;
+
+    /* No WOWL callback routine yet. */
+    pMac->pmc.enterWowlCallbackRoutine = NULL;
+
+    /* Initialize BMPS traffic counts. */
+    pMac->pmc.cLastTxUnicastFrames = 0;
+    pMac->pmc.cLastRxUnicastFrames = 0;
+
+    /* Configure SMPS. */
+    if (pMac->pmc.smpsEnabled && (pMac->pmc.powerSource != AC_POWER || pMac->pmc.smpsConfig.enterOnAc))
+    {
+        if (pMac->pmc.smpsConfig.mode == ePMC_DYNAMIC_SMPS)
+            htMimoPowerSaveState = eSIR_HT_MIMO_PS_DYNAMIC;
+        if (pMac->pmc.smpsConfig.mode == ePMC_STATIC_SMPS)
+            htMimoPowerSaveState = eSIR_HT_MIMO_PS_STATIC;
+    }
+    else
+        htMimoPowerSaveState = eSIR_HT_MIMO_PS_NO_LIMIT;
+    
+    if (pmcSendMessage(hHal, eWNI_PMC_SMPS_STATE_IND, &htMimoPowerSaveState,
+                       sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)
+        return eHAL_STATUS_FAILURE;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT 
+    if (pmcStartDiagEvtTimer(hHal) != eHAL_STATUS_SUCCESS)
+    {
+       return eHAL_STATUS_FAILURE;
+    }
+#endif
+
+#if defined(ANI_LOGDUMP)
+    pmcDumpInit(hHal);
+#endif
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcStop
+*
+* Description:
+*    Does a PMC stop operation on the device.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - stop successful
+*    eHAL_STATUS_FAILURE - stop not successful
+*
+******************************************************************************/
+eHalStatus pmcStop (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tPmcDeferredMsg *pDeferredMsg;
+
+    smsLog(pMac, LOG2, FL("Entering pmcStop\n"));
+
+    /* Cancel any running timers. */
+    if (palTimerStop(pMac->hHdd, pMac->pmc.hImpsTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot cancel IMPS timer\n"));
+    }
+
+    pmcStopTrafficTimer(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    pmcStopDiagEvtTimer(hHal);
+#endif
+
+    if (palTimerStop(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot cancel exit power save mode timer\n"));
+    }
+
+    /* Do all the callbacks. */
+    pmcDoCallbacks(hHal, eHAL_STATUS_FAILURE);
+    pmcDoBmpsCallbacks(hHal, eHAL_STATUS_FAILURE);
+    pMac->pmc.uapsdSessionRequired = FALSE;
+    pmcDoStartUapsdCallbacks(hHal, eHAL_STATUS_FAILURE);
+    pmcDoStandbyCallbacks(hHal, eHAL_STATUS_FAILURE);
+
+    //purge the deferred msg list
+    csrLLLock( &pMac->pmc.deferredMsgList );
+    while( NULL != ( pEntry = csrLLRemoveHead( &pMac->pmc.deferredMsgList, eANI_BOOLEAN_FALSE ) ) )
+    {
+        pDeferredMsg = GET_BASE_ADDR( pEntry, tPmcDeferredMsg, link );
+        palFreeMemory( pMac->hHdd, pDeferredMsg );
+    }
+    csrLLUnlock( &pMac->pmc.deferredMsgList );
+
+    /* PMC is stopped. */
+    pMac->pmc.pmcState = STOPPED;
+    pMac->pmc.pmcReady = FALSE;
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcClose
+*
+* Description:
+*    Does a PMC close operation on the device.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - close successful
+*    eHAL_STATUS_FAILURE - close not successful
+*
+******************************************************************************/
+eHalStatus pmcClose (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcClose\n"));
+
+    /* Free up allocated resources. */
+    if (palTimerFree(pMac->hHdd, pMac->pmc.hImpsTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot deallocate IMPS timer\n"));
+    }
+    if (!VOS_IS_STATUS_SUCCESS(vos_timer_destroy(&pMac->pmc.hTrafficTimer)))
+    {
+        smsLog(pMac, LOGE, FL("Cannot deallocate traffic timer\n"));
+    }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    if (palTimerFree(pMac->hHdd, pMac->pmc.hDiagEvtTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot deallocate timer for diag event reporting\n"));
+    }
+#endif
+    if (palTimerFree(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot deallocate exit power save mode timer\n"));
+    }
+
+    /*
+        The following list's entries are dynamically allocated so they need their own 
+        cleanup function
+    */
+    pmcClosePowerSaveCheckList(pMac);
+    pmcCloseRequestFullPowerList(pMac);
+    pmcCloseRequestBmpsList(pMac);
+    pmcCloseRequestStartUapsdList(pMac);
+    pmcCloseDeviceStateUpdateList(pMac);
+    pmcCloseDeferredMsgList(pMac);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcSignalPowerEvent
+*
+* Description:
+*    Signals to PMC that a power event has occurred.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    event - the event that has occurred
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - signaling successful
+*    eHAL_STATUS_FAILURE - signaling not successful
+*
+******************************************************************************/
+eHalStatus pmcSignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+#ifndef GEN6_ONWARDS
+    tSirMacHTMIMOPowerSaveState  htMimoPowerSaveState;
+#endif
+
+    smsLog(pMac, LOG2, FL("Entering pmcSignalPowerEvent, event %d\n"), event);
+
+    /* Take action based on the event being signaled. */
+    switch (event)
+    {
+#ifndef GEN6_ONWARDS
+    case ePMC_SYSTEM_HIBERNATE:
+        return pmcEnterLowPowerState(hHal);
+
+    case ePMC_SYSTEM_RESUME:
+        return pmcExitLowPowerState(hHal);
+
+    case ePMC_HW_WLAN_SWITCH_OFF:
+        pMac->pmc.hwWlanSwitchState = ePMC_SWITCH_OFF;
+        return pmcEnterLowPowerState(hHal);
+
+    case ePMC_HW_WLAN_SWITCH_ON:
+        pMac->pmc.hwWlanSwitchState = ePMC_SWITCH_ON;
+        return pmcExitLowPowerState(hHal);
+
+    case ePMC_SW_WLAN_SWITCH_OFF:
+        pMac->pmc.swWlanSwitchState = ePMC_SWITCH_OFF;
+        return pmcEnterLowPowerState(hHal);
+
+    case ePMC_SW_WLAN_SWITCH_ON:
+        pMac->pmc.swWlanSwitchState = ePMC_SWITCH_ON;
+        return pmcExitLowPowerState(hHal);
+
+    case ePMC_BATTERY_OPERATION:
+        pMac->pmc.powerSource = BATTERY_POWER;
+
+        /* Turn on SMPS. */
+        if (pMac->pmc.smpsEnabled)
+        {
+            if (pMac->pmc.smpsConfig.mode == ePMC_DYNAMIC_SMPS)
+                htMimoPowerSaveState = eSIR_HT_MIMO_PS_DYNAMIC;
+            if (pMac->pmc.smpsConfig.mode == ePMC_STATIC_SMPS)
+                htMimoPowerSaveState = eSIR_HT_MIMO_PS_STATIC;
+            if (pmcSendMessage(hHal, eWNI_PMC_SMPS_STATE_IND, &htMimoPowerSaveState,
+                               sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)   
+                return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+
+    case ePMC_AC_OPERATION:
+        pMac->pmc.powerSource = AC_POWER;
+
+        /* Turn off SMPS. */
+        if (!pMac->pmc.smpsConfig.enterOnAc)
+        {
+            htMimoPowerSaveState = eSIR_HT_MIMO_PS_NO_LIMIT;
+            if (pmcSendMessage(hHal, eWNI_PMC_SMPS_STATE_IND, &htMimoPowerSaveState,
+                               sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)
+                return eHAL_STATUS_FAILURE;
+        }
+        return eHAL_STATUS_SUCCESS;
+#endif //GEN6_ONWARDS
+    default:
+        smsLog(pMac, LOGE, FL("Invalid event %d\n"), event);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcSetConfigPowerSave
+*
+* Description:
+*    Configures one of the power saving modes.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    psMode - the power saving mode to configure
+*    pConfigParams - pointer to configuration parameters specific to the
+*                    power saving mode
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - configuration successful
+*    eHAL_STATUS_FAILURE - configuration not successful
+*
+******************************************************************************/
+eHalStatus pmcSetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+#endif
+
+    smsLog(pMac, LOG2, FL("Entering pmcSetConfigPowerSave, power save mode %d\n"), psMode);
+
+    /* Configure the specified power saving mode. */
+    switch (psMode)
+    {
+    
+    case ePMC_IDLE_MODE_POWER_SAVE:
+        pMac->pmc.impsConfig = *(tpPmcImpsConfigParams)pConfigParams;
+        smsLog(pMac, LOG3, FL("IMPS configuration"));
+        smsLog(pMac, LOG3, "          enter on AC: %d\n",
+               pMac->pmc.impsConfig.enterOnAc);
+        break;
+
+    case ePMC_BEACON_MODE_POWER_SAVE:
+        pMac->pmc.bmpsConfig = *(tpPmcBmpsConfigParams)pConfigParams;
+        smsLog(pMac, LOG3, FL("BMPS configuration"));
+        smsLog(pMac, LOG3, "          enter on AC: %d\n",
+               pMac->pmc.bmpsConfig.enterOnAc);
+        smsLog(pMac, LOG3, "          TX threshold: %d\n",
+               pMac->pmc.bmpsConfig.txThreshold);
+        smsLog(pMac, LOG3, "          RX threshold: %d\n",
+               pMac->pmc.bmpsConfig.rxThreshold);
+        smsLog(pMac, LOG3, "          traffic measurement period (ms): %d\n",
+               pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+        smsLog(pMac, LOG3, "          BMPS period: %d\n",
+               pMac->pmc.bmpsConfig.bmpsPeriod);
+        smsLog(pMac, LOG3, "          beacons to forward code: %d\n",
+               pMac->pmc.bmpsConfig.forwardBeacons);
+        smsLog(pMac, LOG3, "          value of N: %d\n",
+               pMac->pmc.bmpsConfig.valueOfN);
+        smsLog(pMac, LOG3, "          use PS poll: %d\n",
+               pMac->pmc.bmpsConfig.usePsPoll);
+        smsLog(pMac, LOG3, "          set PM on last frame: %d\n",
+               pMac->pmc.bmpsConfig.setPmOnLastFrame);
+        smsLog(pMac, LOG3, "          value of enableBeaconEarlyTermination: %d\n",
+               pMac->pmc.bmpsConfig.enableBeaconEarlyTermination);
+        smsLog(pMac, LOG3, "          value of bcnEarlyTermWakeInterval: %d\n",
+               pMac->pmc.bmpsConfig.bcnEarlyTermWakeInterval);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+        vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+        psRequest.event_subtype = WLAN_BMPS_SET_CONFIG;
+        /* possible loss of data due to mismatch but expectation is that
+        values can reasonably be expected to fit in target widths */
+        psRequest.bmps_auto_timer_duration = (v_U16_t)pMac->pmc.bmpsConfig.trafficMeasurePeriod;
+        psRequest.bmps_period = (v_U16_t)pMac->pmc.bmpsConfig.bmpsPeriod; 
+
+        WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+
+        break;
+
+    case ePMC_SPATIAL_MULTIPLEX_POWER_SAVE:
+        pMac->pmc.smpsConfig = *(tpPmcSmpsConfigParams)pConfigParams;
+        smsLog(pMac, LOG3, FL("SMPS configuration"));
+        smsLog(pMac, LOG3, "          mode: %d\n", pMac->pmc.smpsConfig.mode);
+        smsLog(pMac, LOG3, "          enter on AC: %d\n",
+               pMac->pmc.smpsConfig.enterOnAc);
+        break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid power save mode %d\n"), psMode);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    //Send the power save config down to PE/HAL/FW if BMPS mode is being configured
+    //and pmcReady has been invoked
+    if(PMC_IS_READY(pMac) && psMode == ePMC_BEACON_MODE_POWER_SAVE)
+    {
+       if (pmcSendPowerSaveConfigMessage(hHal) != eHAL_STATUS_SUCCESS)
+           return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcGetConfigPowerSave
+*
+* Description:
+*    Get the config for the specified power save mode
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    psMode - the power saving mode to configure
+*    pConfigParams - pointer to configuration parameters specific to the
+*                    power saving mode
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - configuration successful
+*    eHAL_STATUS_FAILURE - configuration not successful
+*
+******************************************************************************/
+eHalStatus pmcGetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcGetConfigPowerSave, power save mode %d\n"), psMode);
+
+    /* Configure the specified power saving mode. */
+    switch (psMode)
+    {
+    
+    case ePMC_IDLE_MODE_POWER_SAVE:
+        *(tpPmcImpsConfigParams)pConfigParams = pMac->pmc.impsConfig;
+        break;
+
+    case ePMC_BEACON_MODE_POWER_SAVE:
+        *(tpPmcBmpsConfigParams)pConfigParams = pMac->pmc.bmpsConfig;
+        break;
+
+    case ePMC_SPATIAL_MULTIPLEX_POWER_SAVE:
+        *(tpPmcSmpsConfigParams)pConfigParams = pMac->pmc.smpsConfig;
+        break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid power save mode %d\n"), psMode);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+/******************************************************************************
+*
+* Name:  pmcEnablePowerSave
+*
+* Description:
+*    Enables one of the power saving modes.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    psMode - the power saving mode to enable
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - successfully enabled
+*    eHAL_STATUS_FAILURE - not successfully enabled
+*
+******************************************************************************/
+eHalStatus pmcEnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirMacHTMIMOPowerSaveState  htMimoPowerSaveState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_PS_MODE_ENABLE_REQ;
+    psRequest.enable_disable_powersave_mode = psMode;
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+    
+    smsLog(pMac, LOG2, FL("Entering pmcEnablePowerSave, power save mode %d\n"), psMode);
+
+    /* Enable the specified power saving mode. */
+    switch (psMode)
+    {
+
+    case ePMC_IDLE_MODE_POWER_SAVE:
+        pMac->pmc.impsEnabled = TRUE;
+        break;
+
+    case ePMC_BEACON_MODE_POWER_SAVE:
+        pMac->pmc.bmpsEnabled = TRUE;
+        break;
+
+    case ePMC_SPATIAL_MULTIPLEX_POWER_SAVE:
+        pMac->pmc.smpsEnabled = TRUE;
+
+        /* If PMC already started, then turn on SMPS. */
+        if (pMac->pmc.pmcState != STOPPED)
+            if (pMac->pmc.powerSource != AC_POWER ||
+                pMac->pmc.smpsConfig.enterOnAc)
+            {
+                if (pMac->pmc.smpsConfig.mode == ePMC_DYNAMIC_SMPS)
+                    htMimoPowerSaveState = eSIR_HT_MIMO_PS_DYNAMIC;
+                if (pMac->pmc.smpsConfig.mode == ePMC_STATIC_SMPS)
+                    htMimoPowerSaveState = eSIR_HT_MIMO_PS_STATIC;
+                if (pmcSendMessage(hHal, eWNI_PMC_SMPS_STATE_IND, &htMimoPowerSaveState,
+                                   sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)
+                    return eHAL_STATUS_FAILURE;
+            }
+        break;
+
+    case ePMC_UAPSD_MODE_POWER_SAVE:
+        pMac->pmc.uapsdEnabled = TRUE;
+        break;
+
+    case ePMC_STANDBY_MODE_POWER_SAVE:
+        pMac->pmc.standbyEnabled = TRUE;
+        break;
+
+    case ePMC_WOWL_MODE_POWER_SAVE:
+        pMac->pmc.wowlEnabled = TRUE;
+        break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid power save mode %d\n"), psMode);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+/* ---------------------------------------------------------------------------
+    \fn pmcStartAutoBmpsTimer
+    \brief  Starts a timer that periodically polls all the registered
+            module for entry into Bmps mode. This timer is started only if BMPS is
+            enabled and whenever the device is in full power.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcStartAutoBmpsTimer (tHalHandle hHal) 
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_START_BMPS_AUTO_TIMER_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, FL("Entering pmcStartAutoBmpsTimer\n"));
+
+   /* Check if BMPS is enabled. */
+   if (!pMac->pmc.bmpsEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enable BMPS timer. BMPS is disabled\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   pMac->pmc.autoBmpsEntryEnabled = TRUE;
+
+   /* Check if there is an Infra session. If there is no Infra session, timer will be started 
+         when STA associates to AP */
+
+   if (pmcShouldBmpsTimerRun(pMac))
+   {
+      if (pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod) != eHAL_STATUS_SUCCESS)
+         return eHAL_STATUS_FAILURE;
+   }
+
+
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcStopAutoBmpsTimer
+    \brief  Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
+            Stopping the timer does not cause a device state change. Only the timer
+            is stopped. If "Full Power" is desired, use the pmcRequestFullPower API
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcStopAutoBmpsTimer (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_STOP_BMPS_AUTO_TIMER_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, FL("Entering pmcStopAutoBmpsTimer\n"));
+
+   pMac->pmc.autoBmpsEntryEnabled = FALSE;
+   /* If uapsd session is not required or HDD has not requested BMPS, stop the auto bmps timer.*/
+   if (!pMac->pmc.uapsdSessionRequired && !pMac->pmc.bmpsRequestedByHdd)
+      pmcStopTrafficTimer(hHal);
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/******************************************************************************
+*
+* Name:  pmcDisablePowerSave
+*
+* Description:
+*    Disables one of the power saving modes.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    psMode - the power saving mode to disable
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - successfully disabled
+*    eHAL_STATUS_FAILURE - not successfully disabled
+*
+******************************************************************************/
+eHalStatus pmcDisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tSirMacHTMIMOPowerSaveState  htMimoPowerSaveState;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_PS_MODE_DISABLE_REQ;
+    psRequest.enable_disable_powersave_mode = psMode;
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+    smsLog(pMac, LOG2, FL("Entering pmcDisablePowerSave, power save mode %d\n"), psMode);
+
+    /* Disable the specified power saving mode. */
+    switch (psMode)
+    {
+
+    case ePMC_IDLE_MODE_POWER_SAVE:
+        pMac->pmc.impsEnabled = FALSE;
+        break;
+
+    case ePMC_BEACON_MODE_POWER_SAVE:
+        pMac->pmc.bmpsEnabled = FALSE;
+        break;
+
+    case ePMC_SPATIAL_MULTIPLEX_POWER_SAVE:
+        pMac->pmc.smpsEnabled = FALSE;
+
+        /* Turn off SMPS. */
+        htMimoPowerSaveState = eSIR_HT_MIMO_PS_NO_LIMIT;
+        if (pmcSendMessage(hHal, eWNI_PMC_SMPS_STATE_IND, &htMimoPowerSaveState,
+                           sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)
+            return eHAL_STATUS_FAILURE;
+        break;
+
+    case ePMC_UAPSD_MODE_POWER_SAVE:
+        pMac->pmc.uapsdEnabled = FALSE;
+        break;
+
+    case ePMC_STANDBY_MODE_POWER_SAVE:
+        pMac->pmc.standbyEnabled = FALSE;
+        break;
+
+    case ePMC_WOWL_MODE_POWER_SAVE:
+        pMac->pmc.wowlEnabled = FALSE;
+        break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid power save mode %d\n"), psMode);
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcQueryPowerState
+*
+* Description:
+*    Returns the current power state of the device.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    pPowerState - pointer to location to return power state
+*    pHwWlanSwitchState - pointer to location to return Hardware WLAN
+*                         Switch state
+*    pSwWlanSwitchState - pointer to location to return Software WLAN
+*                         Switch state
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - power state successfully returned
+*    eHAL_STATUS_FAILURE - power state not successfully returned
+*
+******************************************************************************/
+eHalStatus pmcQueryPowerState (tHalHandle hHal, tPmcPowerState *pPowerState,
+                               tPmcSwitchState *pHwWlanSwitchState, tPmcSwitchState *pSwWlanSwitchState)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcQueryPowerState\n"));
+
+    /* Return current power state based on PMC state. */
+    if(pPowerState != NULL)
+    {
+        /* Return current power state based on PMC state. */
+        switch (pMac->pmc.pmcState)
+        {
+    
+        case FULL_POWER:
+            *pPowerState = ePMC_FULL_POWER;
+            break;
+
+        default:
+            *pPowerState = ePMC_LOW_POWER;
+            break;
+        }
+    }
+
+    /* Return current switch settings. */
+    if(pHwWlanSwitchState != NULL)
+       *pHwWlanSwitchState = pMac->pmc.hwWlanSwitchState;
+    if(pSwWlanSwitchState != NULL)
+       *pSwWlanSwitchState = pMac->pmc.swWlanSwitchState;
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcIsPowerSaveEnabled
+*
+* Description:
+*    Checks if the device is able to enter one of the power save modes.
+*    "Able to enter" means the power save mode is enabled for the device
+*    and the host is using the correct power source for entry into the
+*    power save mode.  This routine does not indicate whether the device
+*    is actually in the power save mode at a particular point in time.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    psMode - the power saving mode
+*
+* Returns:
+*    TRUE if device is able to enter the power save mode, FALSE otherwise
+*
+******************************************************************************/
+tANI_BOOLEAN pmcIsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcIsPowerSaveEnabled, power save mode %d\n"), psMode);
+
+    /* Check ability to enter based on the specified power saving mode. */
+    switch (psMode)
+    {
+    
+    case ePMC_IDLE_MODE_POWER_SAVE:
+        return pMac->pmc.impsEnabled && (pMac->pmc.powerSource != AC_POWER || pMac->pmc.impsConfig.enterOnAc);
+
+    case ePMC_BEACON_MODE_POWER_SAVE:
+        return pMac->pmc.bmpsEnabled;
+
+    case ePMC_SPATIAL_MULTIPLEX_POWER_SAVE:
+        return pMac->pmc.smpsEnabled && (pMac->pmc.powerSource != AC_POWER || pMac->pmc.smpsConfig.enterOnAc);
+
+    case ePMC_UAPSD_MODE_POWER_SAVE:
+        return pMac->pmc.uapsdEnabled;
+
+    case ePMC_STANDBY_MODE_POWER_SAVE:
+        return pMac->pmc.standbyEnabled;
+
+    case ePMC_WOWL_MODE_POWER_SAVE:
+        return pMac->pmc.wowlEnabled;
+        break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid power save mode %d\n"), psMode);
+        PMC_ABORT;
+        return FALSE;
+    }
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcRequestFullPower
+*
+* Description:
+*    Request that the device be brought to full power state.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackRoutine - routine to call when device actually achieves full
+*                      power state if "eHAL_STATUS_PMC_PENDING" is returned
+*    callbackContext - value to be passed as parameter to routine specified
+*                      above
+*    fullPowerReason -  Reason for requesting full power mode. This is used
+*                       by PE to decide whether data null should be sent to
+*                       AP when exiting BMPS mode. Caller should use the
+*                       eSME_LINK_DISCONNECTED reason if link is disconnected
+*                       and there is no need to tell the AP that we are going
+*                       out of power save.
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - device brought to full power state
+*    eHAL_STATUS_FAILURE - device cannot be brought to full power state
+*    eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
+*                              callbackRoutine will be called when completed
+*
+******************************************************************************/
+eHalStatus pmcRequestFullPower (tHalHandle hHal, void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+                                void *callbackContext, tRequestFullPowerReason fullPowerReason)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tpRequestFullPowerEntry pEntry;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_ENTER_FULL_POWER_REQ;
+    psRequest.full_power_request_reason = fullPowerReason;
+ 
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+    smsLog(pMac, LOG2, FL("Entering pmcRequestFullPower"));
+
+    if( !PMC_IS_READY(pMac) )
+    {
+        smsLog(pMac, LOGE, FL("Requesting Full Power when PMC not ready\n"));
+        smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+            pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* If HDD is requesting full power, clear any buffered requests for WOWL and BMPS that were
+       requested by HDD previously */
+    if(SIR_IS_FULL_POWER_NEEDED_BY_HDD(fullPowerReason))
+    {
+        pMac->pmc.bmpsRequestedByHdd = FALSE;
+        pMac->pmc.wowlModeRequired = FALSE;
+    }
+
+    /* If already in full power, just return. */
+    if (pMac->pmc.pmcState == FULL_POWER)
+        return eHAL_STATUS_SUCCESS;
+
+    /* If in IMPS State, then cancel the timer. */
+    if (pMac->pmc.pmcState == IMPS)
+        if (palTimerStop(pMac->hHdd, pMac->pmc.hImpsTimer) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot cancel IMPS timer\n"));
+            return eHAL_STATUS_FAILURE;
+        }
+
+    /* Enter Request Full Power State. */
+    if (pmcEnterRequestFullPowerState(hHal, fullPowerReason) != eHAL_STATUS_SUCCESS)
+        return eHAL_STATUS_FAILURE;
+
+    /* If able to enter Request Full Power State, then request is pending.
+       Allocate entry for request full power callback routine list. */
+    //If caller doesn't need a callback, simply waits up the chip.
+    if( callbackRoutine )
+    {
+        if (palAllocateMemory(pMac->hHdd, (void **)&pEntry, sizeof(tRequestFullPowerEntry)) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot allocate memory for request full power routine list entry\n"));
+            PMC_ABORT;
+            return eHAL_STATUS_FAILURE;
+        }
+
+        /* Store routine and context in entry. */
+        pEntry->callbackRoutine = callbackRoutine;
+        pEntry->callbackContext = callbackContext;
+
+        /* Add entry to list. */
+        csrLLInsertTail(&pMac->pmc.requestFullPowerList, &pEntry->link, TRUE);
+    }
+
+    return eHAL_STATUS_PMC_PENDING;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcRequestImps
+*
+* Description:
+*    Request that the device be placed in Idle Mode Power Save (IMPS).
+*    The Common Scan/Roam Module makes this request.  The device will be
+*    placed into IMPS for the specified amount of time, and then returned
+*    to full power.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    impsPeriod - amount of time to remain in IMPS (milliseconds)
+*    callbackRoutine - routine to call when IMPS period has finished and
+*                      the device has been brought to full power
+*    callbackContext - value to be passed as parameter to routine specified
+*                      above
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - device will enter IMPS
+*    eHAL_STATUS_PMC_DISABLED - IMPS is disabled
+*    eHAL_STATUS_PMC_NOT_NOW - another module is prohibiting entering IMPS
+*                              at this time
+*    eHAL_STATUS_PMC_AC_POWER - IMPS is disabled when host operating from
+*                               AC power
+*    eHAL_STATUS_PMC_ALREADY_IN_IMPS - device is already in IMPS
+*    eHAL_STATUS_PMC_SYS_ERROR - system error that prohibits entering IMPS
+*
+******************************************************************************/
+eHalStatus pmcRequestImps (tHalHandle hHal, tANI_U32 impsPeriod,
+                           void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+                           void *callbackContext)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    eHalStatus status;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_IMPS_ENTER_REQ;
+    psRequest.imps_period = impsPeriod;
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+
+    smsLog(pMac, LOG2, FL("Entering pmcRequestImps"));
+
+    status = pmcEnterImpsCheck( pMac );
+    if( HAL_STATUS_SUCCESS( status ) )
+    {
+        /* Enter Request IMPS State. */
+        status = pmcEnterRequestImpsState( hHal );
+        if (HAL_STATUS_SUCCESS( status ))
+    {
+            /* Save the period and callback routine for when we need it. */
+            pMac->pmc.impsPeriod = impsPeriod;
+            pMac->pmc.impsCallbackRoutine = callbackRoutine;
+            pMac->pmc.impsCallbackContext = callbackContext;
+
+    }
+        else
+    {
+            status = eHAL_STATUS_PMC_SYS_ERROR;
+    }
+    }
+
+    return status;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcRegisterPowerSaveCheck
+*
+* Description:
+*    Allows a routine to be registered so that the routine is called whenever
+*    the device is about to enter one of the power save modes.  This routine
+*    will say whether the device is allowed to enter the power save mode at
+*    the time of the call.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    checkRoutine - routine to call before entering a power save mode, should
+*                   return TRUE if the device is allowed to enter the power
+*                   save mode, FALSE otherwise
+*    checkContext - value to be passed as parameter to routine specified above
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - successfully registered
+*    eHAL_STATUS_FAILURE - not successfully registered
+*
+******************************************************************************/
+eHalStatus pmcRegisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext),
+                                      void *checkContext)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tpPowerSaveCheckEntry pEntry;
+
+    smsLog(pMac, LOG2, FL("Entering pmcRegisterPowerSaveCheck"));
+
+    /* Allocate entry for power save check routine list. */
+    if (palAllocateMemory(pMac->hHdd, (void **)&pEntry, sizeof(tPowerSaveCheckEntry)) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for power save check routine list entry\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Store routine and context in entry. */
+    pEntry->checkRoutine = checkRoutine;
+    pEntry->checkContext = checkContext;
+
+    /* Add entry to list. */
+    csrLLInsertTail(&pMac->pmc.powerSaveCheckList, &pEntry->link, FALSE);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcDeregisterPowerSaveCheck
+*
+* Description:
+*    Reregisters a routine that was previously registered with
+*    pmcRegisterPowerSaveCheck.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    checkRoutine - routine to deregister
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - successfully deregistered
+*    eHAL_STATUS_FAILURE - not successfully deregistered
+*
+******************************************************************************/
+eHalStatus pmcDeregisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext))
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tpPowerSaveCheckEntry pPowerSaveCheckEntry;
+
+    smsLog(pMac, LOG2, FL("Entering pmcDeregisterPowerSaveCheck"));
+
+    /* Find entry in the power save check routine list that matches
+       the specified routine and remove it. */
+    pEntry = csrLLPeekHead(&pMac->pmc.powerSaveCheckList, FALSE);
+    while (pEntry != NULL)
+    {
+        pPowerSaveCheckEntry = GET_BASE_ADDR(pEntry, tPowerSaveCheckEntry, link);
+        if (pPowerSaveCheckEntry->checkRoutine == checkRoutine)
+        {
+            if (csrLLRemoveEntry(&pMac->pmc.powerSaveCheckList, pEntry, FALSE))
+            {
+                if (palFreeMemory(pMac->hHdd, pPowerSaveCheckEntry) != eHAL_STATUS_SUCCESS)
+                {
+                    smsLog(pMac, LOGE, FL("Cannot free memory for power save check routine list entry\n"));
+                    PMC_ABORT;
+                    return eHAL_STATUS_FAILURE;
+                }
+            }
+            else
+            {
+                smsLog(pMac, LOGE, FL("Cannot remove power save check routine list entry\n"));
+                return eHAL_STATUS_FAILURE;
+            }
+            return eHAL_STATUS_SUCCESS;
+        }
+        pEntry = csrLLNext(&pMac->pmc.powerSaveCheckList, pEntry, FALSE);
+    }
+
+    /* Could not find matching entry. */
+    return eHAL_STATUS_FAILURE;
+}
+
+
+static void pmcProcessResponse( tpAniSirGlobal pMac, tSirSmeRsp *pMsg )
+{
+    tListElem *pEntry = NULL;
+    tSmeCmd *pCommand = NULL;
+    tANI_BOOLEAN fRemoveCommand = eANI_BOOLEAN_TRUE;
+
+    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+    if(pEntry)
+    {
+        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+
+        smsLog(pMac, LOG1, FL("process message = %d\n"), pMsg->messageType);
+
+    /* Process each different type of message. */
+    switch (pMsg->messageType)
+    {
+
+    /* We got a response to our IMPS request.  */
+    case eWNI_PMC_ENTER_IMPS_RSP:
+        smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_IMPS_RSP with status = %d\n"), pMsg->statusCode);
+            if( (eSmeCommandEnterImps != pCommand->command) && (eSmeCommandEnterStandby != pCommand->command) )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_IMPS_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+        if(pMac->pmc.pmcState == REQUEST_IMPS)
+        {
+            /* Enter IMPS State if response indicates success. */
+            if (pMsg->statusCode == eSIR_SME_SUCCESS)
+            {
+                    pmcEnterImpsState(pMac);
+            }
+
+            /* If response is failure, then we stay in Full Power State and tell everyone that we aren't going into IMPS. */
+            else {
+                smsLog(pMac, LOGE, FL("Response message to request to enter IMPS indicates failure, status %x\n"),
+                       pMsg->statusCode);
+                    pmcEnterFullPowerState(pMac);
+            }
+        }
+        else if (pMac->pmc.pmcState == REQUEST_STANDBY)
+        {
+            /* Enter STANDBY State if response indicates success. */
+            if (pMsg->statusCode == eSIR_SME_SUCCESS)
+            {
+                    pmcEnterStandbyState(pMac);
+                    pmcDoStandbyCallbacks(pMac, eHAL_STATUS_SUCCESS);
+            }
+
+            /* If response is failure, then we stay in Full Power State
+               and tell everyone that we aren't going into STANDBY. */
+            else
+            {
+                smsLog(pMac, LOGE, "PMC: response message to request to enter "
+                       "standby indicates failure, status %x\n", pMsg->statusCode);
+                    pmcEnterFullPowerState(pMac);
+                    pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
+            }
+        }
+        else
+        {
+            smsLog(pMac, LOGE, "PMC: Enter IMPS rsp rcvd when device is "
+               "in %d state\n", pMac->pmc.pmcState);
+        }
+        break;
+
+    /* We got a response to our wake from IMPS request. */
+    case eWNI_PMC_EXIT_IMPS_RSP:
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_IMPS_RSP with status = %d\n"), pMsg->statusCode);
+            if( eSmeCommandExitImps != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_IMPS_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_FULL_POWER)
+            {
+                smsLog(pMac, LOGE, FL("Got Exit IMPS Response Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+            /* Enter Full Power State. */
+            if (pMsg->statusCode != eSIR_SME_SUCCESS)
+            {
+                smsLog(pMac, LOGP, FL("Response message to request to exit IMPS indicates failure, status %x\n"),
+                       pMsg->statusCode);
+            }
+            pmcEnterFullPowerState(pMac);
+        break;
+
+    /* We got a response to our BMPS request.  */
+    case eWNI_PMC_ENTER_BMPS_RSP:
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_BMPS_RSP with status = %d\n"), pMsg->statusCode);
+            if( eSmeCommandEnterBmps != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_BMPS_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_BMPS)
+            {
+                smsLog(pMac, LOGE, FL("Got Enter BMPS Response Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+        /* Enter BMPS State if response indicates success. */
+        if (pMsg->statusCode == eSIR_SME_SUCCESS)
+        {
+                pmcEnterBmpsState(pMac);
+            /* Note: If BMPS was requested because of start UAPSD,
+               there will no entries for BMPS callback routines and
+               pmcDoBmpsCallbacks will be a No-Op*/
+                pmcDoBmpsCallbacks(pMac, eHAL_STATUS_SUCCESS);
+         }
+        /* If response is failure, then we stay in Full Power State and tell everyone that we aren't going into BMPS. */
+        else
+        {
+                smsLog(pMac, LOGE, FL("Response message to request to enter BMPS indicates failure, status %x\n"),
+                   pMsg->statusCode);
+                pmcEnterFullPowerState(pMac);
+                //Do not call UAPSD callback here since it may be re-entered
+                pmcDoBmpsCallbacks(pMac, eHAL_STATUS_FAILURE);
+        }
+        break;
+
+    /* We got a response to our wake from BMPS request. */
+    case eWNI_PMC_EXIT_BMPS_RSP:
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_BMPS_RSP with status = %d\n"), pMsg->statusCode);
+            if( eSmeCommandExitBmps != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_BMPS_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_FULL_POWER)
+            {
+                smsLog(pMac, LOGE, FL("Got Exit BMPS Response Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+            /* Enter Full Power State. */
+            if (pMsg->statusCode != eSIR_SME_SUCCESS)
+            {
+                smsLog(pMac, LOGP, FL("Response message to request to exit BMPS indicates failure, status %x\n"),
+                       pMsg->statusCode);
+            }
+            pmcEnterFullPowerState(pMac);
+        break;
+
+        /* We got a response to our Start UAPSD request.  */
+        case eWNI_PMC_ENTER_UAPSD_RSP:
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
+            if( eSmeCommandEnterUapsd != pCommand->command )
+        {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_START_UAPSD)
+            {
+                smsLog(pMac, LOGE, FL("Got Enter Uapsd rsp Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+         /* Enter UAPSD State if response indicates success. */
+            if (pMsg->statusCode == eSIR_SME_SUCCESS) 
+            {
+                pmcEnterUapsdState(pMac);
+                pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_SUCCESS);
+         }
+         /* If response is failure, then we try to put the chip back in
+            BMPS mode*/
+            else {
+                smsLog(pMac, LOGE, "PMC: response message to request to enter "
+                   "UAPSD indicates failure, status %x\n", pMsg->statusCode);
+                //Need to reset the UAPSD flag so pmcEnterBmpsState won't try to enter UAPSD.
+                pMac->pmc.uapsdSessionRequired = FALSE;
+                pmcEnterBmpsState(pMac);
+                //UAPSD will not be retied in this case so tell requester we are done with failure
+                pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
+         }
+         break;
+
+      /* We got a response to our Stop UAPSD request.  */
+      case eWNI_PMC_EXIT_UAPSD_RSP:
+         smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
+            if( eSmeCommandExitUapsd != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_UAPSD_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_STOP_UAPSD)
+            {
+                smsLog(pMac, LOGE, FL("Got Exit Uapsd rsp Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+         /* Enter BMPS State */
+         if (pMsg->statusCode != eSIR_SME_SUCCESS) {
+            smsLog(pMac, LOGP, "PMC: response message to request to exit "
+               "UAPSD indicates failure, status %x\n", pMsg->statusCode);
+         }
+            pmcEnterBmpsState(pMac);
+         break;
+
+      /* We got a response to our enter WOWL request.  */
+      case eWNI_PMC_ENTER_WOWL_RSP:
+
+            if( eSmeCommandEnterWowl != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_WOWL_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_ENTER_WOWL)
+            {
+                smsLog(pMac, LOGE, FL("Got eWNI_PMC_ENTER_WOWL_RSP while in state %s\n"), 
+                    pmcGetPmcStateStr(pMac->pmc.pmcState));
+                break;
+            }
+
+         /* Enter WOWL State if response indicates success. */
+         if (pMsg->statusCode == eSIR_SME_SUCCESS) {
+                pmcEnterWowlState(pMac);
+                pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_SUCCESS);
+         }
+
+         /* If response is failure, then we try to put the chip back in
+            BMPS mode*/
+         else {
+            smsLog(pMac, LOGE, "PMC: response message to request to enter "
+               "WOWL indicates failure, status %x\n", pMsg->statusCode);
+                pmcEnterBmpsState(pMac);
+                pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
+         }
+         break;
+
+      /* We got a response to our exit WOWL request.  */
+      case eWNI_PMC_EXIT_WOWL_RSP:
+
+            if( eSmeCommandExitWowl != pCommand->command )
+            {
+                smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_WOWL_RSP without request\n"));
+                fRemoveCommand = eANI_BOOLEAN_FALSE;
+                break;
+            }
+            /* Check that we are in the correct state for this message. */
+            if (pMac->pmc.pmcState != REQUEST_EXIT_WOWL)
+            {
+                smsLog(pMac, LOGE, FL("Got Exit WOWL rsp Message while in state %d\n"), pMac->pmc.pmcState);
+                break;
+            }
+
+         /* Enter BMPS State */
+         if (pMsg->statusCode != eSIR_SME_SUCCESS) {
+            smsLog(pMac, LOGP, "PMC: response message to request to exit "
+               "WOWL indicates failure, status %x\n", pMsg->statusCode);
+         }
+            pmcEnterBmpsState(pMac);
+         break;
+
+    default:
+        smsLog(pMac, LOGE, FL("Invalid message type %d received\n"), pMsg->messageType);
+        PMC_ABORT;
+        break;
+        }//switch
+
+        if( fRemoveCommand )
+        {
+            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
+            {
+                pmcReleaseCommand( pMac, pCommand );
+                smeProcessPendingQueue( pMac );
+            }
+        }
+    }
+    else
+    {
+        smsLog(pMac, LOGE, FL("message type %d received but no request is found\n"), pMsg->messageType);
+    }
+}
+
+
+/******************************************************************************
+*
+* Name:  pmcMessageProcessor
+*
+* Description:
+*    Process a message received by PMC.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    pMsg - pointer to received message
+*
+* Returns:
+*    nothing
+*
+******************************************************************************/
+void pmcMessageProcessor (tHalHandle hHal, tSirSmeRsp *pMsg)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcMessageProcessor, message type %d\n"), pMsg->messageType);
+
+    switch( pMsg->messageType )
+    {
+    case eWNI_PMC_EXIT_BMPS_IND:
+    //When PMC needs to handle more indication from PE, they need to be added here.
+    {
+        /* Device left BMPS on its own. */
+        smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_BMPS_IND with status = %d\n"), pMsg->statusCode);
+        /* Check that we are in the correct state for this message. */
+        switch(pMac->pmc.pmcState)
+        {
+        case BMPS:
+        case REQUEST_START_UAPSD:
+        case UAPSD:
+        case REQUEST_STOP_UAPSD:
+        case REQUEST_ENTER_WOWL:
+        case WOWL:
+        case REQUEST_EXIT_WOWL:
+        case REQUEST_FULL_POWER:
+            smsLog(pMac, LOGW, FL("Got eWNI_PMC_EXIT_BMPS_IND while in state %d\n"), pMac->pmc.pmcState);
+            break;
+        default:
+            smsLog(pMac, LOGE, FL("Got eWNI_PMC_EXIT_BMPS_IND while in state %d\n"), pMac->pmc.pmcState);
+            PMC_ABORT;
+            break;
+        }
+
+        /* Enter Full Power State. */
+        if (pMsg->statusCode != eSIR_SME_SUCCESS)
+        {
+            smsLog(pMac, LOGP, FL("Exit BMPS indication indicates failure, status %x\n"), pMsg->statusCode);
+        }
+        else
+        {
+            tpSirSmeExitBmpsInd pExitBmpsInd = (tpSirSmeExitBmpsInd)pMsg;
+            pmcEnterRequestFullPowerState(hHal, pExitBmpsInd->exitBmpsReason);
+        }
+        break;
+    }
+
+    default:
+        pmcProcessResponse( pMac, pMsg );
+        break;
+    }
+
+}
+
+
+tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal )
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+   if ( !csrIsInfraConnected( pMac ) )
+   {
+      smsLog(pMac, LOGW, "PMC: STA not associated. BMPS cannot be entered\n");
+      return eANI_BOOLEAN_FALSE;
+   }
+
+   //Cannot have other session
+   if ( csrIsIBSSStarted( pMac ) )
+   {
+      smsLog(pMac, LOGW, "PMC: IBSS started. BMPS cannot be entered\n");
+      return eANI_BOOLEAN_FALSE;
+   }
+   if ( csrIsBTAMPStarted( pMac ) )
+   {
+      smsLog(pMac, LOGW, "PMC: BT-AMP exists. BMPS cannot be entered\n");
+      return eANI_BOOLEAN_FALSE;
+   }
+   if ((vos_concurrent_sessions_running()) && 
+        csrIsConcurrentInfraConnected( pMac ))
+   {
+      smsLog(pMac, LOGW, "PMC: Multiple active sessions exists. BMPS cannot be entered\n");
+      return eANI_BOOLEAN_FALSE;
+   }
+   return eANI_BOOLEAN_TRUE;
+}
+
+tANI_BOOLEAN pmcAllowImps( tHalHandle hHal )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    //Cannot have other session like IBSS or BT AMP running
+    if ( csrIsIBSSStarted( pMac ) )
+    {
+       smsLog(pMac, LOGW, "PMC: IBSS started. IMPS cannot be entered\n");
+       return eANI_BOOLEAN_FALSE;
+    }
+    if ( csrIsBTAMPStarted( pMac ) )
+    {
+       smsLog(pMac, LOGW, "PMC: BT-AMP exists. IMPS cannot be entered\n");
+       return eANI_BOOLEAN_FALSE;
+    }
+
+    //All sessions must be disconnected to allow IMPS
+    if ( !csrIsAllSessionDisconnected( pMac ) )
+    {
+       smsLog(pMac, LOGW, "PMC: Atleast one connected session. IMPS cannot be entered\n");
+       return eANI_BOOLEAN_FALSE;
+    }
+
+    return eANI_BOOLEAN_TRUE;
+}
+
+/******************************************************************************
+*
+* Name:  pmcRequestBmps
+*
+* Description:
+*    Request that the device be put in BMPS state.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackRoutine - Callback routine invoked in case of success/failure
+*    callbackContext - value to be passed as parameter to routine specified
+*                      above
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - device is in BMPS state
+*    eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
+*    eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state,
+*
+******************************************************************************/
+eHalStatus pmcRequestBmps (
+    tHalHandle hHal,
+    void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+    void *callbackContext)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tpRequestBmpsEntry pEntry;
+   eHalStatus status;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_BMPS_ENTER_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcRequestBmps");
+
+   /* If already in BMPS, just return. */
+   if (pMac->pmc.pmcState == BMPS || REQUEST_START_UAPSD == pMac->pmc.pmcState || UAPSD == pMac->pmc.pmcState)
+   {
+      smsLog(pMac, LOG2, "PMC: Device already in BMPS pmcState %d", pMac->pmc.pmcState);
+      pMac->pmc.bmpsRequestedByHdd = TRUE;
+      return eHAL_STATUS_SUCCESS;
+   }
+   
+   status = pmcEnterBmpsCheck( pMac );
+   if(HAL_STATUS_SUCCESS( status ))
+   {
+      status = pmcEnterRequestBmpsState(hHal);
+      /* Enter Request BMPS State. */
+      if ( HAL_STATUS_SUCCESS( status ) )
+      {
+         /* Remember that HDD requested BMPS. This flag will be used to put the
+            device back into BMPS if any module other than HDD (e.g. CSR, QoS, or BAP)
+            requests full power for any reason */
+         pMac->pmc.bmpsRequestedByHdd = TRUE;
+
+         /* If able to enter Request BMPS State, then request is pending.
+            Allocate entry for request BMPS callback routine list. */
+         if (palAllocateMemory(
+               pMac->hHdd, (void **)&pEntry,
+               sizeof(tRequestBmpsEntry)) != eHAL_STATUS_SUCCESS)
+         {
+            smsLog(pMac, LOGE, "PMC: cannot allocate memory for request "
+                  "BMPS routine list entry\n");
+            return eHAL_STATUS_FAILURE;
+         }
+
+         /* Store routine and context in entry. */
+         pEntry->callbackRoutine = callbackRoutine;
+         pEntry->callbackContext = callbackContext;
+
+         /* Add entry to list. */
+         csrLLInsertTail(&pMac->pmc.requestBmpsList, &pEntry->link, FALSE);
+
+         status = eHAL_STATUS_PMC_PENDING;
+      }
+      else
+      {
+         status = eHAL_STATUS_FAILURE;
+      }
+   }
+
+   return status;
+}
+
+/******************************************************************************
+*
+* Name:  pmcStartUapsd
+*
+* Description:
+*    Request that the device be put in UAPSD state.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    callbackRoutine - Callback routine invoked in case of success/failure
+*    callbackContext - value to be passed as parameter to routine specified
+*                      above
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - device is in UAPSD state
+*    eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
+*    eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
+*    eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
+*
+******************************************************************************/
+eHalStatus pmcStartUapsd (
+    tHalHandle hHal,
+    void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+    void *callbackContext)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   tpStartUapsdEntry pEntry;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_UAPSD_START_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcStartUapsd");
+
+   if( !PMC_IS_READY(pMac) )
+   {
+       smsLog(pMac, LOGE, FL("Requesting UAPSD when PMC not ready\n"));
+       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+           pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+       return eHAL_STATUS_FAILURE;
+   }
+
+   /* Check if BMPS is enabled. */
+   if (!pMac->pmc.bmpsEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enter UAPSD. BMPS is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   /* Check if UAPSD is enabled. */
+   if (!pMac->pmc.uapsdEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enter UAPSD. UAPSD is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   /* If already in UAPSD, just return. */
+   if (pMac->pmc.pmcState == UAPSD)
+      return eHAL_STATUS_SUCCESS;
+
+   /* Check that we are associated. */
+   if (!pmcValidateConnectState( pMac ))
+   {
+      smsLog(pMac, LOGE, "PMC: STA not associated with an AP. UAPSD cannot be entered\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Enter REQUEST_START_UAPSD State. */
+   if (pmcEnterRequestStartUapsdState(hHal) != eHAL_STATUS_SUCCESS)
+      return eHAL_STATUS_FAILURE;
+
+   if( NULL != callbackRoutine )
+   {
+      /* If success then request is pending. Allocate entry for callback routine list. */
+      if (palAllocateMemory(pMac->hHdd, (void **)&pEntry,
+            sizeof(tStartUapsdEntry)) != eHAL_STATUS_SUCCESS)
+      {
+         smsLog(pMac, LOGE, "PMC: cannot allocate memory for request "
+            "start UAPSD routine list entry\n");
+         return eHAL_STATUS_FAILURE;
+      }
+
+      /* Store routine and context in entry. */
+      pEntry->callbackRoutine = callbackRoutine;
+      pEntry->callbackContext = callbackContext;
+
+      /* Add entry to list. */
+      csrLLInsertTail(&pMac->pmc.requestStartUapsdList, &pEntry->link, FALSE);
+   }
+
+   return eHAL_STATUS_PMC_PENDING;
+}
+
+/******************************************************************************
+*
+* Name:  pmcStopUapsd
+*
+* Description:
+*    Request that the device be put out of UAPSD state.
+*
+* Parameters:
+*    hHal - HAL handle for device
+*
+* Returns:
+*    eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
+*    eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
+*
+******************************************************************************/
+eHalStatus pmcStopUapsd (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_UAPSD_STOP_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcStopUapsd");
+
+   /* Clear any buffered command for entering UAPSD */
+   pMac->pmc.uapsdSessionRequired = FALSE;
+
+   /* Nothing to be done if we are already out of UAPSD. This can happen if
+      some other module (HDD, BT-AMP) requested Full Power.*/
+   if (pMac->pmc.pmcState != UAPSD && pMac->pmc.pmcState != REQUEST_STOP_UAPSD)
+   {
+      smsLog(pMac, LOGW, "PMC: Device is already out of UAPSD "
+         "state. Current state is %d\n", pMac->pmc.pmcState);
+      return eHAL_STATUS_SUCCESS;
+   }
+
+   /* Enter REQUEST_STOP_UAPSD State*/
+   if (pmcEnterRequestStopUapsdState(hHal) != eHAL_STATUS_SUCCESS)
+      return eHAL_STATUS_FAILURE;
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcRequestStandby
+    \brief  Request that the device be put in standby.
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine - Callback routine invoked in case of success/failure
+    \param  callbackContext - value to be passed as parameter to callback
+    \return eHalStatus  
+      eHAL_STATUS_SUCCESS - device is in Standby mode
+      eHAL_STATUS_FAILURE - device cannot be put in standby mode
+      eHAL_STATUS_PMC_PENDING - device is being put in standby mode
+  ---------------------------------------------------------------------------*/
+extern eHalStatus pmcRequestStandby (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+   vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+   psRequest.event_subtype = WLAN_ENTER_STANDBY_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcRequestStandby");
+
+   /* Check if standby is enabled. */
+   if (!pMac->pmc.standbyEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enter standby. Standby is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   if( !PMC_IS_READY(pMac) )
+   {
+       smsLog(pMac, LOGE, FL("Requesting standby when PMC not ready\n"));
+       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+           pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+       return eHAL_STATUS_FAILURE;
+   }
+
+   /* If already in STANDBY, just return. */
+   if (pMac->pmc.pmcState == STANDBY)
+      return eHAL_STATUS_SUCCESS;
+
+   
+   if (csrIsIBSSStarted(pMac) || csrIsBTAMPStarted(pMac))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+          "WLAN: IBSS or BT-AMP session present. Cannot honor standby request");
+      return eHAL_STATUS_PMC_NOT_NOW;
+   }
+
+   /* Enter Request Standby State. */
+   if (pmcEnterRequestStandbyState(hHal) != eHAL_STATUS_SUCCESS)
+      return eHAL_STATUS_FAILURE;
+
+   /* Save the callback routine for when we need it. */
+   pMac->pmc.standbyCallbackRoutine = callbackRoutine;
+   pMac->pmc.standbyCallbackContext = callbackContext;
+
+   return eHAL_STATUS_PMC_PENDING;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcRegisterDeviceStateUpdateInd
+    \brief  Register a callback routine that is called whenever
+            the device enters a new device state (Full Power, BMPS, UAPSD)
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be registered
+    \param  callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully registered
+            eHAL_STATUS_FAILURE - not successfully registered  
+  ---------------------------------------------------------------------------*/
+extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal, 
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
+   void *callbackContext)
+{
+
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tpDeviceStateUpdateIndEntry pEntry;
+
+    smsLog(pMac, LOG2, FL("Entering pmcRegisterDeviceStateUpdateInd"));
+
+    /* Allocate entry for device power state update indication. */
+    if (palAllocateMemory(pMac->hHdd, (void **)&pEntry, sizeof(tDeviceStateUpdateIndEntry)) != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for device power state update indication\n"));
+        PMC_ABORT;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Store routine in entry. */
+    pEntry->callbackRoutine = callbackRoutine;
+    pEntry->callbackContext = callbackContext;
+
+    /* Add entry to list. */
+    csrLLInsertTail(&pMac->pmc.deviceStateUpdateIndList, &pEntry->link, FALSE);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcDeregisterDeviceStateUpdateInd
+    \brief  Deregister a routine that was registered for device state changes
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be deregistered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully deregistered
+            eHAL_STATUS_FAILURE - not successfully deregistered  
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal, 
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tListElem *pEntry;
+    tpDeviceStateUpdateIndEntry pDeviceStateUpdateIndEntry;
+
+    smsLog(pMac, LOG2, FL("Entering pmcDeregisterDeviceStateUpdateInd"));
+
+    /* Find entry in the power save update routine list that matches
+       the specified routine and remove it. */
+    pEntry = csrLLPeekHead(&pMac->pmc.deviceStateUpdateIndList, FALSE);
+    while (pEntry != NULL)
+    {
+        pDeviceStateUpdateIndEntry = GET_BASE_ADDR(pEntry, tDeviceStateUpdateIndEntry, link);
+        if (pDeviceStateUpdateIndEntry->callbackRoutine == callbackRoutine)
+        {
+            if (!csrLLRemoveEntry(&pMac->pmc.deviceStateUpdateIndList, pEntry, FALSE))
+            {
+                smsLog(pMac, LOGE, FL("Cannot remove device state update ind entry from list\n"));
+                return eHAL_STATUS_FAILURE;
+            }
+            if (palFreeMemory(pMac->hHdd, pDeviceStateUpdateIndEntry) != eHAL_STATUS_SUCCESS)
+            {
+                smsLog(pMac, LOGE, FL("Cannot free memory for device state update ind routine list entry\n"));
+                PMC_ABORT;
+                return eHAL_STATUS_FAILURE;
+            }
+            return eHAL_STATUS_SUCCESS;
+        }
+        pEntry = csrLLNext(&pMac->pmc.deviceStateUpdateIndList, pEntry, FALSE);
+    }
+
+    /* Could not find matching entry. */
+    return eHAL_STATUS_FAILURE;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcReady
+    \brief  fn to inform PMC that eWNI_SME_SYS_READY_IND has been sent to PE.
+            This acts as a trigger to send a message to PE to update the power
+            save related conig to FW. Note that if HDD configures any power save
+            related stuff before this API is invoked, PMC will buffer all the 
+            configutaion.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcReady(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    smsLog(pMac, LOG2, FL("Entering pmcReady"));
+
+    if(pMac->pmc.pmcState == STOPPED)
+    {
+        smsLog(pMac, LOGP, FL("pmcReady is invoked even before pmcStart"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    pMac->pmc.pmcReady = TRUE;
+    if (pmcSendPowerSaveConfigMessage(hHal) != eHAL_STATUS_SUCCESS)
+    {
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcWowlAddBcastPattern
+    \brief  Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
+            do a pattern match on these patterns when Wowl is enabled during BMPS
+            mode. Note that Firmware performs the pattern matching only on 
+            broadcast frames and while Libra is in BMPS mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pointer to the pattern to be added
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot add pattern
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcWowlAddBcastPattern (
+    tHalHandle hHal, 
+    tpSirWowlAddBcastPtrn pattern)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+    vos_log_powersave_wow_add_ptrn_pkt_type *log_ptr = NULL;
+    WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_powersave_wow_add_ptrn_pkt_type, LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C);
+#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT
+
+    smsLog(pMac, LOG2, "PMC: entering pmcWowlAddBcastPattern");
+
+    if(pattern == NULL)
+    {
+        smsLog(pMac, LOGE, FL("Null broadcast pattern being passed\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+    if( log_ptr )
+    {
+       log_ptr->pattern_id = pattern->ucPatternId;
+       log_ptr->pattern_byte_offset = pattern->ucPatternByteOffset;
+       log_ptr->pattern_size = pattern->ucPatternSize;
+       log_ptr->pattern_mask_size = pattern->ucPatternMaskSize;
+
+       vos_mem_copy(log_ptr->pattern, pattern->ucPattern, SIR_WOWL_BCAST_PATTERN_MAX_SIZE);
+       /* 1 bit in the pattern mask denotes 1 byte of pattern hence pattern mask size is 1/8 */
+       vos_mem_copy(log_ptr->pattern_mask, pattern->ucPatternMask, SIR_WOWL_BCAST_PATTERN_MAX_SIZE >> 3);
+    }
+
+    WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
+#endif
+
+
+    if(pattern->ucPatternId >= SIR_WOWL_BCAST_MAX_NUM_PATTERNS )
+    {
+        smsLog(pMac, LOGE, FL("Pattern Id must range from 0 to %d\n"), SIR_WOWL_BCAST_MAX_NUM_PATTERNS-1);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if( pMac->pmc.pmcState == STANDBY || pMac->pmc.pmcState == REQUEST_STANDBY )
+    {
+        smsLog(pMac, LOGE, FL("Cannot add WoWL Pattern as chip is in %s state\n"),
+           pmcGetPmcStateStr(pMac->pmc.pmcState));
+        return eHAL_STATUS_FAILURE;
+    }
+    if( pMac->pmc.pmcState == IMPS || pMac->pmc.pmcState == REQUEST_IMPS )
+    {
+        //Wake up the chip first
+        eHalStatus status = pmcDeferMsg( pMac, eWNI_PMC_WOWL_ADD_BCAST_PTRN, 
+                                    pattern, sizeof(tSirWowlAddBcastPtrn) );
+
+        if( eHAL_STATUS_PMC_PENDING == status )
+        {
+            return eHAL_STATUS_SUCCESS;
+        }
+        else 
+        {
+            //either fail or already in full power
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                return ( status );
+            }
+            //else let it through because it is in full power state
+        }
+    }
+
+    if (pmcSendMessage(hHal, eWNI_PMC_WOWL_ADD_BCAST_PTRN, pattern, sizeof(tSirWowlAddBcastPtrn))
+        != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcWowlDelBcastPattern
+    \brief  Delete a pattern that was added for Pattern Byte Matching.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pattern to be deleted
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot delete pattern
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcWowlDelBcastPattern (
+    tHalHandle hHal, 
+    tpSirWowlDelBcastPtrn pattern)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    WLAN_VOS_DIAG_EVENT_DEF(wowRequest, vos_event_wlan_powersave_wow_payload_type);
+
+    vos_mem_zero(&wowRequest, sizeof(vos_event_wlan_powersave_wow_payload_type));
+    wowRequest.event_subtype = WLAN_WOW_DEL_PTRN_REQ;
+    wowRequest.wow_del_ptrn_id = pattern->ucPatternId; 
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&wowRequest, EVENT_WLAN_POWERSAVE_WOW);
+#endif
+
+    smsLog(pMac, LOG2, "PMC: entering pmcWowlDelBcastPattern");
+
+    if(pattern->ucPatternId >= SIR_WOWL_BCAST_MAX_NUM_PATTERNS )
+    {
+        smsLog(pMac, LOGE, FL("Pattern Id must range from 0 to %d\n"), 
+            SIR_WOWL_BCAST_MAX_NUM_PATTERNS-1);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if(pMac->pmc.pmcState == STANDBY || pMac->pmc.pmcState == REQUEST_STANDBY)
+    {
+        smsLog(pMac, LOGE, FL("Cannot delete WoWL Pattern as chip is in %s state\n"),
+           pmcGetPmcStateStr(pMac->pmc.pmcState));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if( pMac->pmc.pmcState == IMPS || pMac->pmc.pmcState == REQUEST_IMPS )
+    {
+        //Wake up the chip first
+        eHalStatus status = pmcDeferMsg( pMac, eWNI_PMC_WOWL_DEL_BCAST_PTRN, 
+                                    pattern, sizeof(tSirWowlDelBcastPtrn) );
+
+        if( eHAL_STATUS_PMC_PENDING == status )
+        {
+            return eHAL_STATUS_SUCCESS;
+        }
+        else 
+        {
+            //either fail or already in full power
+            if( !HAL_STATUS_SUCCESS( status ) )
+            {
+                return ( status );
+            }
+            //else let it through because it is in full power state
+        }
+    }
+
+    if (pmcSendMessage(hHal, eWNI_PMC_WOWL_DEL_BCAST_PTRN, pattern, sizeof(tSirWowlDelBcastPtrn))
+        != eHAL_STATUS_SUCCESS)
+    {
+        smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_DEL_BCAST_PTRN to PE failed\n"));
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcEnterWowl
+    \brief  Request that the device be brought to full power state.
+            Note 1: If "fullPowerReason" specificied in this API is set to
+            eSME_FULL_PWR_NEEDED_BY_HDD, PMC will clear any "buffered wowl" requests
+            and also clear any "buffered BMPS requests by HDD". Assumption is that since
+            HDD is requesting full power, we need to undo any previous HDD requests for 
+            BMPS (using sme_RequestBmps) or WoWL (using sme_EnterWoWL). If the reason is
+            specified anything other than above, the buffered requests for BMPS and WoWL
+            will not be cleared.
+            Note 2: Requesting full power (no matter what the fullPowerReason is) doesn't
+            disable the "auto bmps timer" (if it is enabled) or clear any "buffered uapsd
+            request".
+            Note 3: When the device finally enters Full Power PMC will start a timer 
+            if any of the following holds true:
+            - Auto BMPS mode is enabled
+            - Uapsd request is pending
+            - HDD's request for BMPS is pending
+            - HDD's request for WoWL is pending
+            On timer expiry PMC will attempt to put the device in BMPS mode if following 
+            (in addition to those listed above) holds true:
+            - Polling of all modules through the Power Save Check routine passes
+            - STA is associated to an access point
+    \param  hHal - The handle returned by macOpen.
+    \param  - enterWowlCallbackRoutine Callback routine invoked in case of success/failure
+    \param  - enterWowlCallbackContext -  Cookie to be passed back during callback
+    \param  - wakeReasonIndCB Callback routine invoked for Wake Reason Indication
+    \param  - wakeReasonIndCBContext -  Cookie to be passed back during callback
+    \param  - fullPowerReason - Reason why this API is being invoked. SME needs to
+              distinguish between BAP and HDD requests
+    \return eHalStatus - status 
+     eHAL_STATUS_SUCCESS - device brought to full power state
+     eHAL_STATUS_FAILURE - device cannot be brought to full power state
+     eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcEnterWowl ( 
+    tHalHandle hHal, 
+    void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
+    void *enterWowlCallbackContext,
+#ifdef WLAN_WAKEUP_EVENTS
+    void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
+    void *wakeReasonIndCBContext,
+#endif // WLAN_WAKEUP_EVENTS
+    tpSirSmeWowlEnterParams wowlEnterParams)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(wowRequest, vos_event_wlan_powersave_wow_payload_type);
+
+   vos_mem_zero(&wowRequest, sizeof(vos_event_wlan_powersave_wow_payload_type));
+   wowRequest.event_subtype = WLAN_WOW_ENTER_REQ;
+   wowRequest.wow_type = 0;
+
+   if(wowlEnterParams->ucMagicPktEnable)
+   {
+       wowRequest.wow_type |= 1;
+       vos_mem_copy(wowRequest.wow_magic_pattern, (tANI_U8 *)wowlEnterParams->magicPtrn, 6);
+   }
+
+   if(wowlEnterParams->ucPatternFilteringEnable)
+   {
+       wowRequest.wow_type |= 2;
+   }
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&wowRequest, EVENT_WLAN_POWERSAVE_WOW);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterWowl\n");
+
+   if( !PMC_IS_READY(pMac) )
+   {
+       smsLog(pMac, LOGE, FL("Requesting WoWL when PMC not ready\n"));
+       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"), 
+           pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
+       return eHAL_STATUS_FAILURE;
+   }
+
+   /* Check if BMPS is enabled. */
+   if (!pMac->pmc.bmpsEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enter WoWL. BMPS is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   /* Check if WoWL is enabled. */
+   if (!pMac->pmc.wowlEnabled)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enter WoWL. WoWL is disabled\n");
+      return eHAL_STATUS_PMC_DISABLED;
+   }
+
+   /* Check that we are associated with single Session. */
+   if (!pmcValidateConnectState( pMac ))
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot enable WOWL. STA not associated "
+             "with an Access Point in Infra Mode with single active session\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Is there a pending UAPSD request? HDD should have triggered QoS
+      module to do the necessary cleanup before triggring WOWL*/
+   if(pMac->pmc.uapsdSessionRequired)
+   {
+      smsLog(pMac, LOGE, "PMC: Cannot request WOWL. Pending UAPSD request\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   /* Check that entry into a power save mode is allowed at this time. */
+   if (pMac->pmc.pmcState == FULL_POWER && !pmcPowerSaveCheck(hHal))
+   {
+      smsLog(pMac, LOGE, "PMC: Power save check failed. WOWL request "
+             "will not be accepted\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   // To avoid race condition, set callback routines before sending message.
+   /* cache the WOWL information */
+   pMac->pmc.wowlEnterParams = *wowlEnterParams;
+   pMac->pmc.enterWowlCallbackRoutine = enterWowlCallbackRoutine;
+   pMac->pmc.enterWowlCallbackContext = enterWowlCallbackContext;
+#ifdef WLAN_WAKEUP_EVENTS
+   /* Cache the Wake Reason Indication callback information */
+   pMac->pmc.wakeReasonIndCB = wakeReasonIndCB;
+   pMac->pmc.wakeReasonIndCBContext = wakeReasonIndCBContext;
+#endif // WLAN_WAKEUP_EVENTS
+
+   /* Enter Request WOWL State. */
+   if (pmcRequestEnterWowlState(hHal, wowlEnterParams) != eHAL_STATUS_SUCCESS)
+      return eHAL_STATUS_FAILURE;
+
+   pMac->pmc.wowlModeRequired = TRUE;
+
+   return eHAL_STATUS_PMC_PENDING;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcExitWowl
+    \brief  This is the SME API exposed to HDD to request exit from WoWLAN mode. 
+            SME will initiate exit from WoWLAN mode and device will be put in BMPS 
+            mode.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Device cannot exit WoWLAN mode.
+            eHAL_STATUS_SUCCESS  Request accepted to exit WoWLAN mode. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcExitWowl (tHalHandle hHal)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+   WLAN_VOS_DIAG_EVENT_DEF(wowRequest, vos_event_wlan_powersave_wow_payload_type);
+
+   vos_mem_zero(&wowRequest, sizeof(vos_event_wlan_powersave_wow_payload_type));
+   wowRequest.event_subtype = WLAN_WOW_EXIT_REQ;
+
+   WLAN_VOS_DIAG_EVENT_REPORT(&wowRequest, EVENT_WLAN_POWERSAVE_WOW);
+#endif
+
+   smsLog(pMac, LOG2, "PMC: entering pmcExitWowl");
+
+   /* Clear any buffered command for entering WOWL */
+   pMac->pmc.wowlModeRequired = FALSE;
+
+   /* Enter REQUEST_EXIT_WOWL State*/
+   if (pmcRequestExitWowlState(hHal) != eHAL_STATUS_SUCCESS)
+      return eHAL_STATUS_FAILURE;
+
+   /* Clear the callback routines */
+   pMac->pmc.enterWowlCallbackRoutine = NULL;
+   pMac->pmc.enterWowlCallbackContext = NULL;
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+
+
+/* ---------------------------------------------------------------------------
+    \fn pmcSetHostOffload
+    \brief  Set the host offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest - Pointer to the offload request.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
+{
+    tpSirHostOffloadReq pRequestBuf;
+    vos_msg_t msg;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: IP address = %d.%d.%d.%d", __FUNCTION__,
+        pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1],
+        pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirHostOffloadReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for host offload request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirHostOffloadReq));
+
+    msg.type = WDA_SET_HOST_OFFLOAD;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_HOST_OFFLOAD message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcSetKeepAlive
+    \brief  Set the Keep Alive feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest - Pointer to the Keep Alive.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the keepalive.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest)
+{
+    tpSirKeepAliveReq pRequestBuf;
+    vos_msg_t msg;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_LOW, "%s: "
+                  "WDA_SET_KEEP_ALIVE message", __FUNCTION__);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirKeepAliveReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+                  "Not able to allocate memory for keep alive request",
+                  __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirKeepAliveReq));
+    
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_LOW, "buff TP %d "
+              "input TP %d ", pRequestBuf->timePeriod, pRequest->timePeriod);
+
+    msg.type = WDA_SET_KEEP_ALIVE;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+                  "Not able to post WDA_SET_KEEP_ALIVE message to WDA",
+                  __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+#ifdef WLAN_NS_OFFLOAD
+
+/* ---------------------------------------------------------------------------
+    \fn pmcSetNSOffload
+    \brief  Set the host offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest - Pointer to the offload request.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
+{
+    tpSirHostOffloadReq pRequestBuf;
+    vos_msg_t msg;
+    int i;
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirHostOffloadReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for NS offload request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirHostOffloadReq));
+
+    msg.type = WDA_SET_NS_OFFLOAD;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post SIR_HAL_SET_HOST_OFFLOAD message to HAL", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+#endif //WLAN_NS_OFFLOAD
+
+
+void pmcClosePowerSaveCheckList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tpPowerSaveCheckEntry pPowerSaveCheckEntry;
+
+    csrLLLock(&pMac->pmc.powerSaveCheckList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.powerSaveCheckList, FALSE)) )
+    {
+        pPowerSaveCheckEntry = GET_BASE_ADDR(pEntry, tPowerSaveCheckEntry, link);
+        if (palFreeMemory(pMac->hHdd, pPowerSaveCheckEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.powerSaveCheckList);
+    csrLLClose(&pMac->pmc.powerSaveCheckList);
+}
+
+
+void pmcCloseRequestFullPowerList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tpRequestFullPowerEntry pRequestFullPowerEntry;
+
+    csrLLLock(&pMac->pmc.requestFullPowerList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.requestFullPowerList, FALSE)) )
+    {
+        pRequestFullPowerEntry = GET_BASE_ADDR(pEntry, tRequestFullPowerEntry, link);
+        if (palFreeMemory(pMac->hHdd, pRequestFullPowerEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.requestFullPowerList);
+    csrLLClose(&pMac->pmc.requestFullPowerList);
+}
+
+
+void pmcCloseRequestBmpsList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tpRequestBmpsEntry pRequestBmpsEntry;
+
+    csrLLLock(&pMac->pmc.requestBmpsList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.requestBmpsList, FALSE)) )
+    {
+        pRequestBmpsEntry = GET_BASE_ADDR(pEntry, tRequestBmpsEntry, link);
+        if (palFreeMemory(pMac->hHdd, pRequestBmpsEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.requestBmpsList);
+    csrLLClose(&pMac->pmc.requestBmpsList);
+}
+
+
+void pmcCloseRequestStartUapsdList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tpStartUapsdEntry pStartUapsdEntry;
+
+    csrLLLock(&pMac->pmc.requestStartUapsdList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.requestStartUapsdList, FALSE)) )
+    {
+        pStartUapsdEntry = GET_BASE_ADDR(pEntry, tStartUapsdEntry, link);
+        if (palFreeMemory(pMac->hHdd, pStartUapsdEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.requestStartUapsdList);
+    csrLLClose(&pMac->pmc.requestStartUapsdList);
+}
+
+
+void pmcCloseDeviceStateUpdateList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tpDeviceStateUpdateIndEntry pDeviceStateUpdateIndEntry;
+
+    csrLLLock(&pMac->pmc.deviceStateUpdateIndList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.deviceStateUpdateIndList, FALSE)) )
+    {
+        pDeviceStateUpdateIndEntry = GET_BASE_ADDR(pEntry, tDeviceStateUpdateIndEntry, link);
+        if (palFreeMemory(pMac->hHdd, pDeviceStateUpdateIndEntry) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.deviceStateUpdateIndList);
+    csrLLClose(&pMac->pmc.deviceStateUpdateIndList);
+}
+
+
+void pmcCloseDeferredMsgList(tpAniSirGlobal pMac)
+{
+    tListElem *pEntry;
+    tPmcDeferredMsg *pDeferredMsg;
+
+    csrLLLock(&pMac->pmc.deferredMsgList);
+    while ( (pEntry = csrLLRemoveHead(&pMac->pmc.deferredMsgList, FALSE)) )
+    {
+        pDeferredMsg = GET_BASE_ADDR(pEntry, tPmcDeferredMsg, link);
+        if (palFreeMemory(pMac->hHdd, pDeferredMsg) != eHAL_STATUS_SUCCESS)
+        {
+            smsLog(pMac, LOGE, FL("Cannot free memory \n"));
+            PMC_ABORT;
+            break;
+        }
+    }
+    csrLLUnlock(&pMac->pmc.deferredMsgList);
+    csrLLClose(&pMac->pmc.deferredMsgList);
+}
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+
+static tSirRetStatus 
+pmcPopulateMacHeader( 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 ));
+
+    sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
+
+    // Prepare Address 3
+    palCopyMemory( pMac->hHdd,
+                   (tANI_U8 *) pMacHdr->bssId,
+                   (tANI_U8 *) peerAddr,
+                   sizeof( tSirMacAddr ));
+    return statusCode;
+} /*** pmcPopulateMacHeader() ***/
+
+
+static tSirRetStatus
+pmcPrepareProbeReqTemplate(tpAniSirGlobal pMac,
+                           tANI_U8        nChannelNum,
+                           tANI_U32       dot11mode,
+                           tSirMacAddr    selfMacAddr,
+                           tANI_U8        *pFrame,
+                           tANI_U16       *pusLen)
+{
+    tDot11fProbeRequest pr;
+    tANI_U32            nStatus, nBytes, nPayload;
+    tSirRetStatus       nSirStatus;
+    /*Bcast tx*/
+    tSirMacAddr         bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+    // 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 ) );
+
+    PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL);
+
+    if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
+    {
+        PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
+    }
+
+    
+    if (IS_DOT11_MODE_HT(dot11mode))
+    {
+       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 ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                  "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 ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                  "There were warnings while calculating"
+                  "the packed size for a Probe Request ("
+                  "0x%08x).\n", nStatus );
+    }
+
+    nBytes = nPayload + sizeof( tSirMacMgmtHdr );
+  
+    /* Prepare outgoing frame*/
+    palZeroMemory( pMac->hHdd, pFrame, nBytes );
+
+    // Next, we fill out the buffer descriptor:
+    nSirStatus = pmcPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
+                                SIR_MAC_MGMT_PROBE_REQ, bssId ,selfMacAddr);
+
+    if ( eSIR_SUCCESS != nSirStatus )
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+        "Failed to populate the buffer descriptor for a Probe Request (%d).\n",
+                nSirStatus );
+        return nSirStatus;      // allocated!
+    }
+
+    // That done, pack the Probe Request:
+    nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
+                                      sizeof( tSirMacMgmtHdr ),
+                                      nPayload, &nPayload );
+    if ( DOT11F_FAILED( nStatus ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                  "Failed to pack a Probe Request (0x%08x).\n", nStatus );
+        return eSIR_FAILURE;    // allocated!
+    }
+    else if ( DOT11F_WARNED( nStatus ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+            "There were warnings while packing a Probe Request (0x%08x).\n" );
+    }
+
+    *pusLen = nPayload + sizeof(tSirMacMgmtHdr); 
+    return eSIR_SUCCESS;
+} // End pmcPrepareProbeReqTemplate.
+
+
+eHalStatus pmcSetPreferredNetworkList
+(
+    tHalHandle hHal, 
+    tpSirPNOScanReq pRequest, 
+    tANI_U8 sessionId, 
+    preferredNetworkFoundIndCallback callbackRoutine, 
+    void *callbackContext
+)
+{
+    tpSirPNOScanReq pRequestBuf;
+    vos_msg_t msg;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+    tANI_U8 ucDot11Mode; 
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: SSID = %s, %s", __FUNCTION__,
+        pRequest->aNetworks[0].ssId.ssId, pRequest->aNetworks[1].ssId.ssId);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for PNO request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirPNOScanReq));
+
+    /*Must translate the mode first*/
+    ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, 
+                                       csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode ));
+
+    /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/
+    pmcPrepareProbeReqTemplate(pMac,SIR_PNO_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, 
+                               pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); 
+
+    pmcPrepareProbeReqTemplate(pMac,SIR_PNO_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, 
+                               pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); 
+
+
+    msg.type     = WDA_SET_PNO_REQ;
+    msg.reserved = 0;
+    msg.bodyptr  = pRequestBuf;
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_PNO_REQ message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    /* Cache the Preferred Network Found Indication callback information */
+    pMac->pmc.prefNetwFoundCB = callbackRoutine;
+    pMac->pmc.preferredNetworkFoundIndCallbackContext = callbackContext;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __FUNCTION__);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+eHalStatus pmcSetRssiFilter(tHalHandle hHal,   v_U8_t        rssiThreshold)
+{
+    tpSirSetRSSIFilterReq pRequestBuf;
+    vos_msg_t msg;
+
+
+    pRequestBuf = vos_mem_malloc(sizeof(tpSirSetRSSIFilterReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for PNO request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+
+    pRequestBuf->rssiThreshold = rssiThreshold; 
+
+    msg.type = WDA_SET_RSSI_FILTER_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_PNO_REQ message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+
+eHalStatus pmcUpdateScanParams(tHalHandle hHal, tCsrConfig *pRequest, tCsrChannel *pChannelList, tANI_U8 b11dResolved)
+{
+    tpSirUpdateScanParams pRequestBuf;
+    vos_msg_t msg;
+    int i;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s started", __FUNCTION__);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirUpdateScanParams));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for UpdateScanParams request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    // 
+    // Fill pRequestBuf structure from pRequest
+    //
+    pRequestBuf->b11dEnabled    = pRequest->Is11eSupportEnabled;
+    pRequestBuf->b11dResolved   = b11dResolved;
+    pRequestBuf->ucChannelCount = 
+        ( pChannelList->numChannels < SIR_PNO_MAX_NETW_CHANNELS )?
+        pChannelList->numChannels:SIR_PNO_MAX_NETW_CHANNELS;
+
+    for (i=0; i < pChannelList->numChannels; i++)
+    {    
+        pRequestBuf->aChannels[i] = pChannelList->channelList[i];
+    }
+    pRequestBuf->usPassiveMinChTime = pRequest->nPassiveMinChnTime;
+    pRequestBuf->usPassiveMaxChTime = pRequest->nPassiveMaxChnTime;
+    pRequestBuf->usActiveMinChTime  = pRequest->nActiveMinChnTime;
+    pRequestBuf->usActiveMaxChTime  = pRequest->nActiveMaxChnTime; 
+    pRequestBuf->ucCBState          = PHY_SINGLE_CHANNEL_CENTERED;
+
+    msg.type = WDA_UPDATE_SCAN_PARAMS_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_UPDATE_SCAN_PARAMS message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+#endif // FEATURE_WLAN_SCAN_PNO
+
+eHalStatus pmcSetPowerParams(tHalHandle hHal,   tSirSetPowerParamsReq*  pwParams)
+{
+    tSirSetPowerParamsReq* pRequestBuf;
+    vos_msg_t msg;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tpPESession     psessionEntry;
+
+    if((psessionEntry = peGetValidPowerSaveSession(pMac))== NULL)
+    {
+        return eHAL_STATUS_NOT_INITIALIZED;
+    }
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirSetPowerParamsReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for Power Paramrequest", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+
+    vos_mem_copy(pRequestBuf, pwParams, sizeof(*pRequestBuf)); 
+
+
+    msg.type = WDA_SET_POWER_PARAMS_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_POWER_PARAMS_REQ message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+eHalStatus pmcGetFilterMatchCount
+(
+    tHalHandle hHal, 
+    FilterMatchCountCallback callbackRoutine, 
+    void *callbackContext
+)
+{
+    tpSirRcvFltPktMatchRsp  pRequestBuf;
+    vos_msg_t               msg;
+    tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+        "%s: filterId = %d", __FUNCTION__);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktMatchRsp));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                  "%s: Not able to allocate "
+                  "memory for Get PC Filter Match Count request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    msg.type = WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+
+    /* Cache the Packet Coalescing Filter Match Count callback information */
+    if (NULL != pMac->pmc.FilterMatchCountCB)
+    {
+        // Do we need to check if the callback is in use? 
+        // Because we are not sending the same message again when it is pending,
+        // the only case when the callback is not NULL is that the previous message 
+        //was timed out or failed.
+        // So, it will be safe to set the callback in this case.
+    }
+
+    pMac->pmc.FilterMatchCountCB = callbackRoutine;
+    pMac->pmc.FilterMatchCountCBContext = callbackContext;
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+            "%s: Not able to post WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ "
+            "message to WDA", __FUNCTION__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/* ---------------------------------------------------------------------------
+    \fn pmcSetGTKOffload
+    \brief  Set GTK offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pGtkOffload - Pointer to the GTK offload request.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload)
+{
+    tpSirGtkOffloadParams pRequestBuf;
+    vos_msg_t msg;
+    int i;
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: KeyReplayCounter: %d", 
+                __FUNCTION__, pGtkOffload->ullKeyReplayCounter);
+
+    pRequestBuf = (tpSirGtkOffloadParams)vos_mem_malloc(sizeof(tSirGtkOffloadParams));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate "
+                  "memory for GTK offload request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    vos_mem_copy(pRequestBuf, pGtkOffload, sizeof(tSirGtkOffloadParams));
+        
+    msg.type = WDA_GTK_OFFLOAD_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
+                  "SIR_HAL_SET_GTK_OFFLOAD message to HAL", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn pmcGetGTKOffload
+    \brief  Get GTK offload information.
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot set the offload.
+            eHAL_STATUS_SUCCESS  Request accepted. 
+  ---------------------------------------------------------------------------*/
+eHalStatus pmcGetGTKOffload(tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext)
+{
+    tpSirGtkOffloadGetInfoRspParams  pRequestBuf;
+    vos_msg_t               msg;
+    tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", 
+                __FUNCTION__);
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirGtkOffloadGetInfoRspParams));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate "
+                  "memory for Get GTK Offload request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    msg.type = WDA_GTK_OFFLOAD_GETINFO_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+
+    /* Cache the Get GTK Offload callback information */
+    if (NULL != pMac->pmc.GtkOffloadGetInfoCB)
+    {
+        // Do we need to check if the callback is in use? 
+        // Because we are not sending the same message again when it is pending,
+        // the only case when the callback is not NULL is that the previous message was timed out or failed.
+        // So, it will be safe to set the callback in this case.
+    }
+
+    pMac->pmc.GtkOffloadGetInfoCB = callbackRoutine;
+    pMac->pmc.GtkOffloadGetInfoCBContext = callbackContext;
+
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_GTK_OFFLOAD_GETINFO_REQ message to WDA", 
+                    __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+#endif // WLAN_FEATURE_GTK_OFFLOAD
diff --git a/CORE/SME/src/pmc/pmcLogDump.c b/CORE/SME/src/pmc/pmcLogDump.c
new file mode 100644
index 0000000..463ea21
--- /dev/null
+++ b/CORE/SME/src/pmc/pmcLogDump.c
@@ -0,0 +1,387 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+*
+* Name:  pmcLogDump.c
+*
+* Description: Implements the dump commands specific to PMC module
+*
+* Copyright 2008 (c) Qualcomm, Incorporated.
+* All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
+*
+******************************************************************************/
+
+#include "palTypes.h"
+#include "aniGlobal.h"
+#include "pmcApi.h"
+#include "pmc.h"
+#include "logDump.h"
+#include "smsDebug.h"
+#include "sme_Api.h"
+#include "cfgApi.h"
+
+#if defined(ANI_LOGDUMP)
+
+void dump_pmc_callbackRoutine (void *callbackContext, eHalStatus status)
+{
+    tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
+    smsLog(pMac, LOGW, "*********Received callback from PMC with status = %d\n*********",status);
+}
+
+#ifdef WLAN_WAKEUP_EVENTS
+void dump_pmc_callbackRoutine2 (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd)
+{
+    tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
+    smsLog(pMac, LOGW, "*********Received callback from PMC with reason = %d\n*********",pWakeReasonInd->ulReason);
+}
+#endif // WLAN_WAKEUP_EVENTS
+
+void dump_pmc_deviceUpdateRoutine (void *callbackContext, tPmcState pmcState)
+{
+    tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
+    smsLog(pMac, LOGW, "*********Received msg from PMC: Device is in %s state\n*********", pmcGetPmcStateStr(pmcState));
+}
+
+static char *
+dump_pmc_state( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    char *ptr = p;
+
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+
+    p += log_sprintf( pMac,p, "********  PMC State & Configuration ******** \n");
+    p += log_sprintf( pMac,p, " PMC: IMPS Enabled? %d\n", pMac->pmc.impsEnabled);
+    p += log_sprintf( pMac,p, " PMC: Auto BMPS Timer Enabled? %d\n", pMac->pmc.autoBmpsEntryEnabled);
+    p += log_sprintf( pMac,p, " PMC: BMPS Enabled? %d\n", pMac->pmc.bmpsEnabled);
+    p += log_sprintf( pMac,p, " PMC: UAPSD Enabled? %d\n", pMac->pmc.uapsdEnabled);
+    p += log_sprintf( pMac,p, " PMC: WoWL Enabled? %d\n", pMac->pmc.wowlEnabled);
+    p += log_sprintf( pMac,p, " PMC: Standby Enabled? %d\n", pMac->pmc.standbyEnabled);
+    p += log_sprintf( pMac,p, " PMC: Auto BMPS timer period (ms): %d\n", pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+    p += log_sprintf( pMac,p, " PMC: BMPS Listen Interval (Beacon intervals): %d\n", pMac->pmc.bmpsConfig.bmpsPeriod);
+    p += log_sprintf( pMac,p, " PMC: Device State = %s\n", pmcGetPmcStateStr(pMac->pmc.pmcState));
+    p += log_sprintf( pMac,p, " PMC: RequestFullPowerPending = %d\n", pMac->pmc.requestFullPowerPending);
+    p += log_sprintf( pMac,p, " PMC: UapsdSessionRequired = %d\n", pMac->pmc.uapsdSessionRequired);
+    p += log_sprintf( pMac,p, " PMC: wowlModeRequired = %d\n\n", pMac->pmc.wowlModeRequired);
+
+    smsLog(pMac, LOGW, "\n%s", ptr);
+
+    return p;
+}
+
+static char *
+dump_pmc_enable_imps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcEnablePowerSave(pMac, ePMC_IDLE_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_disable_imps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcDisablePowerSave(pMac, ePMC_IDLE_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_request_imps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg2; (void) arg3; (void) arg4;
+    pMac->pmc.impsEnabled = TRUE;
+    (void)pmcRequestImps(pMac, arg1, dump_pmc_callbackRoutine, pMac);
+    return p;
+}
+
+static char *
+dump_pmc_start_auto_bmps_timer( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    pMac->pmc.bmpsEnabled = TRUE;
+    (void)pmcStartAutoBmpsTimer(pMac);
+    return p;
+}
+
+static char *
+dump_pmc_stop_auto_bmps_timer( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcStopAutoBmpsTimer(pMac);
+    return p;
+}
+
+static char *
+dump_pmc_enable_bmps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcEnablePowerSave(pMac, ePMC_BEACON_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_disable_bmps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcDisablePowerSave(pMac, ePMC_BEACON_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_request_bmps( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    pMac->pmc.bmpsEnabled = TRUE;
+    (void)sme_RequestBmps(pMac, dump_pmc_callbackRoutine, pMac);
+    return p;
+}
+
+static char *
+dump_pmc_enable_uapsd( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcEnablePowerSave(pMac, ePMC_UAPSD_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_disable_uapsd( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcDisablePowerSave(pMac, ePMC_UAPSD_MODE_POWER_SAVE);
+    return p;
+}
+
+static char *
+dump_pmc_start_uapsd( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    pMac->pmc.bmpsEnabled = TRUE;
+    pMac->pmc.uapsdEnabled = TRUE;
+    (void)pmcStartUapsd(pMac, dump_pmc_callbackRoutine, pMac);
+    return p;
+}
+
+static char *
+dump_pmc_stop_uapsd( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)pmcStopUapsd(pMac);
+    return p;
+}
+
+static char *
+dump_pmc_request_standby( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    pMac->pmc.standbyEnabled = TRUE;
+    (void)pmcRequestStandby(pMac, dump_pmc_callbackRoutine, pMac);
+    return p;
+}
+
+static char *
+dump_pmc_request_full_power( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)sme_RequestFullPower(pMac, dump_pmc_callbackRoutine, pMac, eSME_FULL_PWR_NEEDED_BY_HDD);
+    return p;
+}
+
+static char *
+dump_pmc_enter_wowl( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tSirSmeWowlEnterParams wowlEnterParams;
+    tSirRetStatus status;
+    tANI_U32 length;
+    (void) arg3; (void) arg4;
+    
+    palZeroMemory(pMac->hHdd, &wowlEnterParams, sizeof(tSirSmeWowlEnterParams));
+
+    if (arg1 == 0 && arg2 == 0)
+    {
+        smsLog(pMac, LOGE, "Requesting WoWL but neither magic pkt and ptrn byte matching is being enabled\n");
+        return p;
+    }
+    if(arg1 == 1)
+    {
+        wowlEnterParams.ucMagicPktEnable = 1;
+        /* magic packet */
+        length = SIR_MAC_ADDR_LENGTH;
+        status = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *)wowlEnterParams.magicPtrn, &length); 
+        if (eSIR_SUCCESS != status)
+        {
+            smsLog(pMac, LOGE, "Reading of WNI_CFG_STA_ID from CFG failed. Using hardcoded STA MAC Addr\n");
+            wowlEnterParams.magicPtrn[0] = 0x00;
+            wowlEnterParams.magicPtrn[1] = 0x0a;
+            wowlEnterParams.magicPtrn[2] = 0xf5;
+            wowlEnterParams.magicPtrn[3] = 0x04;
+            wowlEnterParams.magicPtrn[4] = 0x05;
+            wowlEnterParams.magicPtrn[5] = 0x06;
+        }
+    }
+    if(arg2 == 1)
+    {
+      wowlEnterParams.ucPatternFilteringEnable = 1;
+    }
+
+    pMac->pmc.bmpsEnabled = TRUE;
+    pMac->pmc.wowlEnabled = TRUE;
+#ifdef WLAN_WAKEUP_EVENTS
+    (void)sme_EnterWowl(pMac, dump_pmc_callbackRoutine, pMac, dump_pmc_callbackRoutine2, pMac, &wowlEnterParams);
+#else // WLAN_WAKEUP_EVENTS
+    (void)sme_EnterWowl(pMac, dump_pmc_callbackRoutine, pMac, &wowlEnterParams);
+#endif // WLAN_WAKEUP_EVENTS
+    return p;
+}
+
+static char *
+dump_pmc_exit_wowl( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    (void)sme_ExitWowl(pMac);
+    return p;
+}
+
+static char *
+dump_pmc_remove_ptrn( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tSirWowlDelBcastPtrn delPattern;
+    (void) arg2; (void) arg3; (void) arg4;
+
+    palZeroMemory(pMac->hHdd, &delPattern, sizeof(tSirWowlDelBcastPtrn));
+
+    if(arg1 <= 7)
+    {
+        delPattern.ucPatternId = (tANI_U8)arg1;
+    }
+    else
+    {
+        smsLog(pMac, LOGE, "dump_pmc_remove_ptrn: Invalid pattern Id %d\n",arg1);
+        return p;
+    }
+
+    (void)pmcWowlDelBcastPattern(pMac, &delPattern);
+    return p;
+}
+
+static char *
+dump_pmc_test_uapsd( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tSirSmeRsp smeRsp;
+    smeRsp.statusCode = eSIR_SME_SUCCESS;
+
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+
+    pMac->pmc.uapsdEnabled = TRUE;
+    pMac->pmc.pmcState = BMPS;
+
+    pmcRegisterDeviceStateUpdateInd(pMac, dump_pmc_deviceUpdateRoutine, pMac);
+
+    pmcStartUapsd(pMac, dump_pmc_callbackRoutine, pMac);
+    smeRsp.messageType = eWNI_PMC_ENTER_UAPSD_RSP;
+    pmcMessageProcessor(pMac, &smeRsp);
+    pmcStopUapsd(pMac);
+    smeRsp.messageType = eWNI_PMC_EXIT_UAPSD_RSP;
+    pmcMessageProcessor(pMac, &smeRsp);
+    pmcDeregisterDeviceStateUpdateInd(pMac, dump_pmc_deviceUpdateRoutine);
+    return p;
+}
+
+static char *
+dump_pmc_test_Wowl( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tSirSmeRsp smeRsp;
+    tSirWowlAddBcastPtrn addPattern;
+    tSirWowlDelBcastPtrn delPattern;
+    tSirSmeWowlEnterParams wowlEnterParams;
+
+    smeRsp.statusCode = eSIR_SME_SUCCESS;
+    palZeroMemory(pMac->hHdd, &addPattern, sizeof(tSirWowlAddBcastPtrn));
+    palZeroMemory(pMac->hHdd, &delPattern, sizeof(tSirWowlDelBcastPtrn));
+    palZeroMemory(pMac->hHdd, &wowlEnterParams, sizeof(tSirSmeWowlEnterParams));
+
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+
+    //Add pattern
+    sme_WowlAddBcastPattern(pMac, &addPattern);
+
+    //Delete pattern
+    sme_WowlDelBcastPattern(pMac, &delPattern);
+
+    //Force the device into BMPS
+    pMac->pmc.pmcState = BMPS;
+
+    //Enter Wowl
+#ifdef WLAN_WAKEUP_EVENTS
+    sme_EnterWowl(pMac, dump_pmc_callbackRoutine, pMac, dump_pmc_callbackRoutine2, pMac, &wowlEnterParams);
+#else // WLAN_WAKEUP_EVENTS
+    sme_EnterWowl(pMac, dump_pmc_callbackRoutine, pMac, &wowlEnterParams);
+#endif // WLAN_WAKEUP_EVENTS
+    smeRsp.messageType = eWNI_PMC_ENTER_WOWL_RSP;
+    pmcMessageProcessor(pMac, &smeRsp);
+
+    //Exit Wowl
+    sme_ExitWowl(pMac);
+    smeRsp.messageType = eWNI_PMC_EXIT_WOWL_RSP;
+    pmcMessageProcessor(pMac, &smeRsp);
+    return p;
+}
+
+static tDumpFuncEntry pmcMenuDumpTable[] = {
+    {0,     "PMC (900-925)",           NULL},
+    // General
+    {900,   "PMC: Dump State + config", dump_pmc_state},
+    // IMPS Related
+    {901,   "PMC: Enable IMPS",         dump_pmc_enable_imps},
+    {902,   "PMC: Disable IMPS",        dump_pmc_disable_imps},
+    {903,   "PMC: Request IMPS: Syntax: dump 903 <imps_period_ms>", dump_pmc_request_imps},
+    // BMPS Related
+    {904,   "PMC: Start Auto BMPS Timer",  dump_pmc_start_auto_bmps_timer},
+    {905,   "PMC: Stop Auto BMPS Timer", dump_pmc_stop_auto_bmps_timer},
+    {906,   "PMC: Request BMPS",        dump_pmc_request_bmps},
+    // UAPSD Related
+    {907,   "PMC: Enable UAPSD",        dump_pmc_enable_uapsd},
+    {908,   "PMC: Disable UAPSD",       dump_pmc_disable_uapsd},
+    {909,   "PMC: Start UAPSD",         dump_pmc_start_uapsd},
+    {910,   "PMC: Stop UAPSD",          dump_pmc_stop_uapsd},
+    // Standby Related
+    {911,   "PMC: Request Standby",     dump_pmc_request_standby},
+    // Full Power Related
+    {912,   "PMC: Request Full Power",  dump_pmc_request_full_power},
+    //Unit Test Related
+    {913,   "PMC: Test UAPSD",          dump_pmc_test_uapsd},
+    {914,   "PMC: Test WOWL",           dump_pmc_test_Wowl},
+    // WoWL Related
+    {915,   "PMC: Enter WoWL: Syntax: dump 915 <enable_magic_pkt> <enable_ptrn_match>",  dump_pmc_enter_wowl},
+    {916,   "PMC: Exit WoWL",  dump_pmc_exit_wowl},
+    {917,   "PMC: Remove a pattern: Syntax: dump 917 <pattern_id(0-7)>",  dump_pmc_remove_ptrn},
+    {918,   "PMC: Enable BMPS",         dump_pmc_enable_bmps},
+    {919,   "PMC: Disable BMPS",        dump_pmc_disable_bmps}
+};
+
+void pmcDumpInit(tHalHandle hHal)
+{
+    logDumpRegisterTable( (tpAniSirGlobal)hHal, &pmcMenuDumpTable[0],
+                          sizeof(pmcMenuDumpTable)/sizeof(pmcMenuDumpTable[0]) );
+}
+
+#endif //#if defined(ANI_LOGDUMP)
diff --git a/CORE/SME/src/rrm/sme_rrm.c b/CORE/SME/src/rrm/sme_rrm.c
new file mode 100644
index 0000000..3ce9c0f
--- /dev/null
+++ b/CORE/SME/src/rrm/sme_rrm.c
@@ -0,0 +1,1296 @@
+/*
+ * 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  sme_Rrm.c
+  
+  \brief implementation for SME RRM APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+#if defined WLAN_FEATURE_VOWIFI
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h"
+#endif
+#include "aniGlobal.h"
+#include "smeInside.h"
+#include "sme_Api.h"
+#include "smsDebug.h"
+#include "cfgApi.h"
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include "vos_diag_core_event.h"
+#include "vos_diag_core_log.h"
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+#include "csrInsideApi.h"
+
+#include "rrmGlobal.h"
+
+#ifdef FEATURE_WLAN_CCX
+#include "csrCcx.h"
+#endif
+
+/* Roam score for a neighbor AP will be calculated based on the below definitions.
+    The calculated roam score will be used to select the roamable candidate from neighbor AP list */
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_REACHABILITY             0   /* When we support 11r over the DS, this should have a non-zero value */
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_SECURITY                 10
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_KEY_SCOPE                20
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_SPECTRUM_MGMT 0   /* Not used */
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_QOS           5
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_APSD          3
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_RRM           8
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_DELAYED_BA    0   /* We dont support delayed BA */
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_IMMEDIATE_BA  3
+#define RRM_ROAM_SCORE_NEIGHBOR_REPORT_MOBILITY_DOMAIN          30
+
+#ifdef FEATURE_WLAN_CCX
+#define RRM_ROAM_SCORE_NEIGHBOR_IAPP_LIST                       30
+#endif
+/**---------------------------------------------------------------------------
+  
+  \brief rrmLLPurgeNeighborCache() - 
+    This function purges all the entries in the neighbor cache and frees up all the internal nodes   
+
+  \param  - pMac  - Pointer to the Hal Handle.
+          - pList - Pointer the List that should be purged.
+  \return - void
+  
+  --------------------------------------------------------------------------*/
+static void rrmLLPurgeNeighborCache(tpAniSirGlobal pMac, tDblLinkList *pList)
+{
+    tListElem *pEntry;
+    tRrmNeighborReportDesc *pNeighborReportDesc;
+    
+    csrLLLock(pList);
+    
+    while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_NOLOCK)) != NULL)
+    {
+        pNeighborReportDesc = GET_BASE_ADDR( pEntry, tRrmNeighborReportDesc, List );
+        vos_mem_free(pNeighborReportDesc->pNeighborBssDescription);
+        vos_mem_free(pNeighborReportDesc);
+    }
+    
+    csrLLUnlock(pList);   
+     
+    return;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief rrmIndicateNeighborReportResult() - 
+        This function calls the callback register by the caller while requesting for 
+        neighbor report. This function gets invoked if a neighbor report is received from an AP
+        or neighbor response wait timer expires.
+
+  \param  - pMac - Pointer to the Hal Handle.
+          - vosStatus - VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE based on whether a valid report is 
+            received or neighbor timer expired
+  \return - void
+  
+  --------------------------------------------------------------------------*/
+void rrmIndicateNeighborReportResult(tpAniSirGlobal pMac, VOS_STATUS vosStatus)
+{
+    NeighborReportRspCallback callback;
+    void                      *callbackContext;
+
+    /* Reset the neighbor response pending status */
+    pMac->rrm.rrmSmeContext.neighborReqControlInfo.isNeighborRspPending = eANI_BOOLEAN_FALSE;
+
+    /* Stop the timer if it is already running. The timer should be running only in the SUCCESS case. */
+    if (VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(&pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspWaitTimer))
+    {
+        VOS_ASSERT(VOS_STATUS_SUCCESS == vosStatus);
+        vos_timer_stop(&pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspWaitTimer);
+    }
+    callback = pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallback;
+    callbackContext = pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallbackContext;
+    
+    /* Reset the callback and the callback context before calling the callback. It is very likely that there may be a registration in 
+            callback itself. */
+    pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallback = NULL;
+    pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallbackContext = NULL;
+    
+    /* Call the callback with the status received from caller */
+    if (callback)
+        callback(callbackContext, vosStatus);
+#ifdef FEATURE_WLAN_CCX
+    // We came here with IAPP AP List
+    // Make sure we inform CSR of the neighbor list
+    // for CCX Associations. First clear the cache.
+    else
+    if (csrNeighborRoamIsCCXAssoc(pMac))
+    {
+        ProcessIAPPNeighborAPList(pMac);
+    }
+#endif
+
+    return;
+
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief sme_RrmBeaconReportXmitInd() - 
+
+   Create and send the beacon report Xmit ind message to PE.
+
+  \param  - pMac - Pointer to the Hal Handle.
+              - pResult - scan result.
+              - measurementDone - flag to indicate that the measurement is done.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_RrmSendBeaconReportXmitInd( tpAniSirGlobal pMac, tCsrScanResultInfo **pResultArr, tANI_U8 measurementDone )
+{
+   tpSirBssDescription pBssDesc = NULL;
+   tpSirBeaconReportXmitInd pBeaconRep;
+   tANI_U16 length, ie_len;
+   tANI_U8 bssCounter=0, msgCounter=0;
+   tCsrScanResultInfo *pCurResult=NULL;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Beacon report xmit Ind to PE\n");
+#endif
+
+   if( NULL == pResultArr && !measurementDone )
+   {
+      smsLog( pMac, LOGE, "Beacon report xmit Ind to PE Failed\n");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   if (pResultArr)
+       pCurResult=pResultArr[bssCounter];
+
+   do 
+   {
+       length = sizeof(tSirBeaconReportXmitInd);
+       pBeaconRep = vos_mem_malloc ( length );
+       if ( NULL == pBeaconRep )
+       {
+          smsLog( pMac, LOGP, "Unable to allocate memory for beacon report");
+          return eHAL_STATUS_FAILED_ALLOC;
+       }
+       vos_mem_zero( pBeaconRep, length );
+#if defined WLAN_VOWIFI_DEBUG
+       smsLog( pMac, LOGE, FL("Allocated memory for pBeaconRep\n"));
+#endif
+       pBeaconRep->messageType = eWNI_SME_BEACON_REPORT_RESP_XMIT_IND;
+       pBeaconRep->length = length;
+       pBeaconRep->uDialogToken = pSmeRrmContext->token;
+       pBeaconRep->duration = pSmeRrmContext->duration;
+       pBeaconRep->regClass = pSmeRrmContext->regClass;
+       vos_mem_copy( pBeaconRep->bssId, pSmeRrmContext->sessionBssId, sizeof(tSirMacAddr) );
+
+       msgCounter=0;
+       while (pCurResult) 
+       {
+           pBssDesc = &pCurResult->BssDescriptor;
+           ie_len = GET_IE_LEN_IN_BSS( pBssDesc->length );
+           pBeaconRep->pBssDescription[msgCounter] = vos_mem_malloc ( ie_len+sizeof(tSirBssDescription) );
+           vos_mem_copy( pBeaconRep->pBssDescription[msgCounter], pBssDesc, sizeof(tSirBssDescription) );
+           vos_mem_copy( &pBeaconRep->pBssDescription[msgCounter]->ieFields[0], pBssDesc->ieFields, ie_len  );
+
+           pBeaconRep->numBssDesc++;
+
+           if (++msgCounter >= SIR_BCN_REPORT_MAX_BSS_DESC)
+               break;
+
+           if (csrRoamIs11rAssoc(pMac)) {
+               break;
+           }
+
+           pCurResult = pResultArr[msgCounter];
+       }
+
+       bssCounter+=msgCounter; 
+       if (!pResultArr || !pCurResult || (bssCounter>=SIR_BCN_REPORT_MAX_BSS_DESC))
+            pCurResult = NULL;
+       else
+            pCurResult = pResultArr[bssCounter];
+
+       pBeaconRep->fMeasureDone = (pCurResult)?false:measurementDone;
+
+       status = palSendMBMessage(pMac->hHdd, pBeaconRep);
+
+       smsLog( pMac, LOGW, "SME Sent BcnRepXmit to PE numBss %d\n", pBeaconRep->numBssDesc);
+
+   } while (pCurResult);
+
+   return status;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief sme_RrmSendScanRequest() - 
+
+   This function is called to get the scan result from CSR and send the beacon report
+   xmit ind message to PE.
+
+  \param  - pMac - Pointer to the Hal Handle.
+              - num_chan - number of channels.
+              - channel list - list of channels to fetch the result from.
+              - measurementDone - flag to indicate that the measurement is done.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+static eHalStatus sme_RrmSendScanResult( tpAniSirGlobal pMac, tANI_U8 num_chan, tANI_U8* chanList, tANI_U8 measurementDone )
+{
+   tCsrScanResultFilter filter;
+   tScanResultHandle pResult;
+   tCsrScanResultInfo *pScanResult, *pNextResult;
+   tCsrScanResultInfo *pScanResultsArr[SIR_BCN_REPORT_MAX_BSS_DESC];
+   eHalStatus status;
+   tANI_U8 counter=0;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   tANI_U32 sessionId;
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Send scan result to PE \n");
+#endif
+
+   vos_mem_zero( &filter, sizeof(filter) );
+   vos_mem_zero( pScanResultsArr, sizeof(pNextResult)*SIR_BCN_REPORT_MAX_BSS_DESC );
+
+   filter.BSSIDs.numOfBSSIDs = 1;
+   filter.BSSIDs.bssid = &pSmeRrmContext->bssId;
+
+   if( pSmeRrmContext->ssId.length )
+   {
+      filter.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo));
+      if( filter.SSIDs.SSIDList == NULL )
+      {
+         smsLog( pMac, LOGP, FL("vos_mem_malloc failed:") );
+         return eHAL_STATUS_FAILURE;
+      }
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Allocated memory for SSIDList\n"));
+#endif
+      vos_mem_zero( filter.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) );
+
+      filter.SSIDs.SSIDList->SSID.length = pSmeRrmContext->ssId.length;
+      vos_mem_copy(filter.SSIDs.SSIDList->SSID.ssId, pSmeRrmContext->ssId.ssId, pSmeRrmContext->ssId.length);
+      filter.SSIDs.numOfSSIDs = 1;
+   }
+   else
+   {
+      filter.SSIDs.numOfSSIDs = 0;
+   }
+
+   filter.ChannelInfo.numOfChannels = num_chan;
+   filter.ChannelInfo.ChannelList = chanList; 
+
+   filter.fMeasurement = TRUE; 
+
+   csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid*)pSmeRrmContext->sessionBssId, &sessionId );
+   status = sme_ScanGetResult(pMac, (tANI_U8)sessionId, &filter, &pResult);
+
+   if( filter.SSIDs.SSIDList )
+   {
+      //Free the memory allocated for SSIDList.
+      vos_mem_free( filter.SSIDs.SSIDList );
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Free memory for SSIDList\n") );
+#endif
+   }
+
+   if (NULL == pResult)
+   {
+      // no scan results
+      //
+      // Spec. doesnt say anything about such condition. 
+      // Since section 7.4.6.2 (IEEE802.11k-2008) says-rrm report frame should contain
+      // one or more report IEs. It probably means dont send any respose if no matching
+      // BSS found. Moreover, there is no flag or field in measurement report IE(7.3.2.22)
+      // OR beacon report IE(7.3.2.22.6) that can be set to indicate no BSS found on a given channel.
+      //
+      // If we finished measurement on all the channels, we still need to
+      // send a xmit indication with moreToFollow set to MEASURMENT_DONE
+      // so that PE can clean any context allocated.
+      if( measurementDone )
+         status = sme_RrmSendBeaconReportXmitInd( pMac, NULL, measurementDone );
+      return status;
+   }
+
+   pScanResult = sme_ScanResultGetFirst(pMac, pResult);
+
+   if( NULL == pScanResult && measurementDone )
+      status = sme_RrmSendBeaconReportXmitInd( pMac, NULL, measurementDone );
+
+   counter=0;
+   while (pScanResult)
+   {
+      pNextResult = sme_ScanResultGetNext(pMac, pResult);
+      pScanResultsArr[counter++] = pScanResult;
+      pScanResult = pNextResult; //sme_ScanResultGetNext(hHal, pResult);
+      if (counter >= SIR_BCN_REPORT_MAX_BSS_DESC)
+         break;
+      }
+
+   if (counter)
+       status = sme_RrmSendBeaconReportXmitInd( pMac, pScanResultsArr, measurementDone);
+
+   sme_ScanResultPurge(pMac, pResult); 
+
+   return status;
+}
+/**---------------------------------------------------------------------------
+  
+  \brief sme_RrmScanRequestCallback() - 
+
+   The sme module calls this callback function once it finish the scan request
+   and this function send the beacon report xmit to PE and starts a timer of
+   random interval to issue next request.
+
+  \param  - halHandle - Pointer to the Hal Handle.
+              - pContext - Pointer to the data context.
+              - scanId - Scan ID.
+              - status - CSR Status.        
+  \return - 0 for success, non zero for failure
+  
+  --------------------------------------------------------------------------*/
+
+static eHalStatus sme_RrmScanRequestCallback(tHalHandle halHandle, void *pContext,
+                         tANI_U32 scanId, eCsrScanStatus status)
+{
+
+   tANI_U16 interval;
+   tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   tANI_U32 time_tick; 
+
+
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Scan Request callback \n");
+#endif
+   //if any more channels are pending, start a timer of a random value within randomization interval.
+   //
+   //
+   if( (pSmeRrmContext->currentIndex + 1) < pSmeRrmContext->channelList.numOfChannels )
+   {
+      sme_RrmSendScanResult( pMac, 1, &pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->currentIndex], false );
+
+      pSmeRrmContext->currentIndex++; //Advance the current index.
+      //start the timer to issue next request. 
+      //From timer tick get a random number within 10ms and max randmization interval.
+      time_tick = vos_timer_get_system_ticks();
+      interval = time_tick % (pSmeRrmContext->randnIntvl - 10 + 1) + 10;
+
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, "Set timer for interval %d \n", interval);
+#endif
+      vos_timer_start( &pSmeRrmContext->IterMeasTimer, interval );
+
+   }
+   else
+   {
+      //Done with the measurement. Clean up all context and send a message to PE with measurement done flag set.
+      sme_RrmSendScanResult( pMac, 1, &pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->currentIndex], true );
+      vos_mem_free( pSmeRrmContext->channelList.ChannelList );
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Free memory for ChannelList\n") );
+#endif
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_RrmIssueScanReq() - This is called to send a scan request as part 
+         of beacon report request .
+  
+  \param 
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_RrmIssueScanReq( tpAniSirGlobal pMac )
+{
+   //Issue scan request.
+   tCsrScanRequest scanRequest;
+   v_U32_t scanId = 0;
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   tANI_U32 sessionId;
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Issue scan request \n" );
+#endif
+
+   vos_mem_zero( &scanRequest, sizeof(scanRequest));
+
+   /* set scanType, active or passive */
+
+   scanRequest.scanType = pSmeRrmContext->measMode;
+
+   vos_mem_copy(scanRequest.bssid,
+         pSmeRrmContext->bssId, sizeof(scanRequest.bssid) );
+
+   if( pSmeRrmContext->ssId.length )
+   {
+      scanRequest.SSIDs.numOfSSIDs = 1;
+      scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo));
+      if( scanRequest.SSIDs.SSIDList == NULL )
+      {
+         smsLog( pMac, LOGP, FL("vos_mem_malloc failed:") );
+         return eHAL_STATUS_FAILURE;
+      }
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Allocated memory for pSSIDList\n"));
+#endif
+      vos_mem_zero( scanRequest.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) );
+      scanRequest.SSIDs.SSIDList->SSID.length = pSmeRrmContext->ssId.length;
+      vos_mem_copy(scanRequest.SSIDs.SSIDList->SSID.ssId, pSmeRrmContext->ssId.ssId, pSmeRrmContext->ssId.length);
+   }
+
+   /* set min and max channel time */
+   scanRequest.minChnTime = 0; //pSmeRrmContext->duration; Dont use min timeout.
+   scanRequest.maxChnTime = pSmeRrmContext->duration;
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "For Duration %d \n", pSmeRrmContext->duration );
+#endif
+
+   /* set BSSType to default type */
+   scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
+
+   /*Scan all the channels */
+   scanRequest.ChannelInfo.numOfChannels = 1;
+
+   scanRequest.ChannelInfo.ChannelList = &pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->currentIndex];
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "On channel %d \n", pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->currentIndex] );
+#endif
+
+   /* set requestType to full scan */
+   scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
+
+   csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid*)pSmeRrmContext->sessionBssId, &sessionId );
+   status = sme_ScanRequest( pMac, (tANI_U8)sessionId, &scanRequest, &scanId, &sme_RrmScanRequestCallback, NULL ); 
+
+   if ( pSmeRrmContext->ssId.length )
+   {
+      vos_mem_free(scanRequest.SSIDs.SSIDList);
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Free memory for SSIDList\n"));
+#endif
+   }
+
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_RrmProcessBeaconReportReqInd() - This is called to process the Beacon 
+         report request from peer AP forwarded through PE .
+  
+  \param pMsgBuf - a pointer to a buffer that maps to various structures base 
+                   on the message type.
+                   The beginning of the buffer can always map to tSirSmeRsp.
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+void sme_RrmProcessBeaconReportReqInd(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+   tpSirBeaconReportReqInd pBeaconReq = (tpSirBeaconReportReqInd) pMsgBuf;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   tANI_U32 len,i;  
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Received Beacon report request ind Channel = %d\n", pBeaconReq->channelInfo.channelNum );
+#endif
+   //section 11.10.8.1 (IEEE Std 802.11k-2008) 
+   //channel 0 and 255 has special meaning.
+   if( (pBeaconReq->channelInfo.channelNum == 0)  || 
+       ((pBeaconReq->channelInfo.channelNum == 255) && (pBeaconReq->channelList.numChannels == 0) ) ) 
+   {
+      //Add all the channel in the regulatory domain.
+      wlan_cfgGetStrLen( pMac, WNI_CFG_VALID_CHANNEL_LIST, &len );
+      pSmeRrmContext->channelList.ChannelList = vos_mem_malloc( len );
+      if( pSmeRrmContext->channelList.ChannelList == NULL )
+      {
+         smsLog( pMac, LOGP, FL("vos_mem_malloc failed:") );
+         return;
+      }
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Allocated memory for ChannelList\n") );
+#endif
+      csrGetCfgValidChannels( pMac, pSmeRrmContext->channelList.ChannelList, &len );
+      pSmeRrmContext->channelList.numOfChannels = (tANI_U8)len;
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, "channel == 0 perfoming on all channels \n");
+#endif
+   }
+   else
+   { 
+      len = 0;
+      pSmeRrmContext->channelList.numOfChannels = 0;
+
+      //If valid channel is present. We firt Measure on the given channel. and
+      //if there are additional channels present in APchannelreport, measure on these also.
+      if ( pBeaconReq->channelInfo.channelNum != 255 )
+         len = 1;
+#if defined WLAN_VOWIFI_DEBUG
+      else
+         smsLog( pMac, LOGE, "channel == 255  \n");
+#endif
+
+      len += pBeaconReq->channelList.numChannels;
+
+      pSmeRrmContext->channelList.ChannelList = vos_mem_malloc( len );
+      if( pSmeRrmContext->channelList.ChannelList == NULL )
+      {
+         smsLog( pMac, LOGP, FL("vos_mem_malloc failed") );
+         return;
+      }
+#if defined WLAN_VOWIFI_DEBUG
+      smsLog( pMac, LOGE, FL("Allocated memory for ChannelList\n") );
+#endif
+
+      if ( pBeaconReq->channelInfo.channelNum != 255 )
+      {
+#if defined WLAN_VOWIFI_DEBUG
+         smsLog( pMac, LOGE, "channel == %d  \n", pBeaconReq->channelInfo.channelNum );
+#endif
+         if(csrRoamIsChannelValid( pMac, pBeaconReq->channelInfo.channelNum ))
+            pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->channelList.numOfChannels++] = pBeaconReq->channelInfo.channelNum;
+#if defined WLAN_VOWIFI_DEBUG
+         else
+            smsLog( pMac, LOGE, "is Invalid channel, Ignoring this channel\n" ); 
+#endif
+      }
+
+      for ( i = 0 ; i < pBeaconReq->channelList.numChannels; i++ )
+      {
+         if(csrRoamIsChannelValid( pMac, pBeaconReq->channelList.channelNumber[i] ))
+         {
+            pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->channelList.numOfChannels] = pBeaconReq->channelList.channelNumber[i];
+            pSmeRrmContext->channelList.numOfChannels++;
+         }
+      }
+   }
+
+   //Copy session bssid
+   vos_mem_copy( pSmeRrmContext->sessionBssId, pBeaconReq->bssId, sizeof(tSirMacAddr) );
+
+   //copy measurement bssid
+   vos_mem_copy( pSmeRrmContext->bssId, pBeaconReq->macaddrBssid, sizeof(tSirMacAddr) );
+
+   //Copy ssid
+   vos_mem_copy( &pSmeRrmContext->ssId, &pBeaconReq->ssId, sizeof(tAniSSID) ); 
+
+   pSmeRrmContext->token = pBeaconReq->uDialogToken;
+   pSmeRrmContext->regClass = pBeaconReq->channelInfo.regulatoryClass;
+
+   switch( pBeaconReq->fMeasurementtype )
+   {
+      case 0: //Passive
+      case 1: //Active
+         pSmeRrmContext->measMode = pBeaconReq->fMeasurementtype? eSIR_ACTIVE_SCAN : eSIR_PASSIVE_SCAN ;
+         pSmeRrmContext->duration = pBeaconReq->measurementDuration;
+         pSmeRrmContext->randnIntvl = VOS_MAX( pBeaconReq->randomizationInterval, pSmeRrmContext->rrmConfig.maxRandnInterval );
+         pSmeRrmContext->currentIndex = 0;
+#if defined WLAN_VOWIFI_DEBUG
+         smsLog( pMac, LOGE, "Send beacon report after scan \n" );
+#endif
+         sme_RrmIssueScanReq( pMac ); 
+         break;
+      case 2: //Table
+         //Get the current scan results for the given channel and send it.
+#if defined WLAN_VOWIFI_DEBUG
+         smsLog( pMac, LOGE, "Send beacon report from table \n" );
+#endif
+         sme_RrmSendScanResult( pMac, pSmeRrmContext->channelList.numOfChannels, pSmeRrmContext->channelList.ChannelList, true );
+         vos_mem_free( pSmeRrmContext->channelList.ChannelList );
+#if defined WLAN_VOWIFI_DEBUG
+         smsLog( pMac, LOGE, FL("Free memory for ChannelList\n") );
+#endif
+         break;
+      default:
+#if defined WLAN_VOWIFI_DEBUG
+         smsLog( pMac, LOGE, "Unknown beacon report request mode\n");
+#endif
+         /* Indicate measurement completion to PE */
+         /* If this is not done, pCurrentReq pointer will not be freed and 
+            PE will not handle subsequent Beacon requests */
+         sme_RrmSendBeaconReportXmitInd(pMac, NULL, true);
+         break;
+
+   }
+
+   return;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_RrmNeighborReportRequest() - This is API can be used to trigger a 
+         Neighbor report from the peer.
+  
+  \param sessionId - session identifier on which the request should be made.       
+  \param pNeighborReq - a pointer to a neighbor report request.
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS sme_RrmNeighborReportRequest(tpAniSirGlobal pMac, tANI_U8 sessionId, 
+                                    tpRrmNeighborReq pNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpSirNeighborReportReqInd pMsg;
+   tCsrRoamSession *pSession;
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, FL("Request to send Neighbor report request received \n"));
+#endif
+   if( !CSR_IS_SESSION_VALID( pMac, sessionId ) )
+   {  
+      smsLog( pMac, LOGE, FL("Invalid session %d\n"), sessionId );
+      return VOS_STATUS_E_INVAL;
+   }
+   pSession = CSR_GET_SESSION( pMac, sessionId );
+
+   /* If already a report is pending, return failure */
+   if (eANI_BOOLEAN_TRUE == pMac->rrm.rrmSmeContext.neighborReqControlInfo.isNeighborRspPending)
+   {
+       smsLog( pMac, LOGE, FL("Neighbor request already pending.. Not allowed"));
+       return VOS_STATUS_E_AGAIN;
+   }
+   
+   pMsg = vos_mem_malloc ( sizeof(tSirNeighborReportReqInd) );
+   if ( NULL == pMsg )
+   {
+      smsLog( pMac, LOGE, "Unable to allocate memory for Neighbor request");
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   
+   vos_mem_zero( pMsg, sizeof(tSirNeighborReportReqInd) );
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, FL(" Allocated memory for Neighbor request\n") );
+#endif
+
+   rrmLLPurgeNeighborCache(pMac, &pMac->rrm.rrmSmeContext.neighborReportCache);
+
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, FL("Purged the neighbor cache before sending Neighbor request: Status = %d\n"), status );
+#endif
+
+   pMsg->messageType = eWNI_SME_NEIGHBOR_REPORT_REQ_IND;
+   pMsg->length = sizeof( tSirNeighborReportReqInd );
+   vos_mem_copy( &pMsg->bssId, &pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
+   pMsg->noSSID = pNeighborReq->no_ssid;
+   vos_mem_copy( &pMsg->ucSSID, &pNeighborReq->ssid, sizeof(tSirMacSSid));
+
+   status = palSendMBMessage(pMac->hHdd, pMsg);
+   if( status != eHAL_STATUS_SUCCESS )
+      return VOS_STATUS_E_FAILURE;
+
+   /* Neighbor report request message sent successfully to PE. Now register the callbacks */
+   pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallback = 
+                                                            callbackInfo->neighborRspCallback;
+   pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspCallbackInfo.neighborRspCallbackContext = 
+                                                            callbackInfo->neighborRspCallbackContext;
+   pMac->rrm.rrmSmeContext.neighborReqControlInfo.isNeighborRspPending = eANI_BOOLEAN_TRUE;
+
+   /* Start neighbor response wait timer now */
+   vos_timer_start(&pMac->rrm.rrmSmeContext.neighborReqControlInfo.neighborRspWaitTimer, callbackInfo->timeout);
+   
+   return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  \brief rrmCalculateNeighborAPRoamScore() - This API is called while handling 
+                individual neighbor reports from the APs neighbor AP report to 
+                calculate the cumulative roam score before storing it in neighbor 
+                cache.
+  
+  \param pNeighborReportDesc - Neighbor BSS Descriptor node for which roam score 
+                                should be calculated
+  
+  \return void.
+--------------------------------------------------------------------------*/
+static void rrmCalculateNeighborAPRoamScore(tpAniSirGlobal pMac, tpRrmNeighborReportDesc pNeighborReportDesc)
+{
+    tpSirNeighborBssDescripton  pNeighborBssDesc;
+    tANI_U32    roamScore = 0;
+    
+    VOS_ASSERT(pNeighborReportDesc != NULL);
+    VOS_ASSERT(pNeighborReportDesc->pNeighborBssDescription != NULL);
+
+    pNeighborBssDesc = pNeighborReportDesc->pNeighborBssDescription;
+
+    if (pNeighborBssDesc->bssidInfo.rrmInfo.fMobilityDomain)
+    {
+        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_MOBILITY_DOMAIN;
+        if (pNeighborBssDesc->bssidInfo.rrmInfo.fSameSecurityMode)
+        {
+            roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_SECURITY;
+            if (pNeighborBssDesc->bssidInfo.rrmInfo.fSameAuthenticator)
+            {
+                roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_KEY_SCOPE;
+                if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapRadioMeasurement)
+                {
+                    roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_RRM;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapSpectrumMeasurement)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_SPECTRUM_MGMT;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapQos)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_QOS;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapApsd)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_APSD;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapDelayedBlockAck)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_DELAYED_BA;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fCapImmediateBlockAck)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_CAPABILITY_IMMEDIATE_BA;
+                    if (pNeighborBssDesc->bssidInfo.rrmInfo.fApPreauthReachable)
+                        roamScore += RRM_ROAM_SCORE_NEIGHBOR_REPORT_REACHABILITY;
+                }
+            }
+        }
+    }
+#ifdef FEATURE_WLAN_CCX
+    // It has come in the report so its the best score
+    if (csrNeighborRoamIs11rAssoc(pMac) == FALSE)
+    {
+        // IAPP Route so lets make use of this info
+        // save all AP, as the list does not come all the time
+        // Save and reuse till the next AP List comes to us.
+        // Even save our own MAC address. Will be useful next time around.
+        roamScore += RRM_ROAM_SCORE_NEIGHBOR_IAPP_LIST;
+    }
+#endif
+    pNeighborReportDesc->roamScore = roamScore;
+
+    return;
+}
+
+/*--------------------------------------------------------------------------
+  \brief rrmStoreNeighborRptByRoamScore() - This API is called to store a given 
+                        Neighbor BSS descriptor to the neighbor cache. This function 
+                        stores the neighbor BSS descriptors in such a way that descriptors 
+                        are sorted by roamScore in descending order
+
+  \param pNeighborReportDesc - Neighbor BSS Descriptor node to be stored in cache
+  
+  \return void.
+--------------------------------------------------------------------------*/
+void rrmStoreNeighborRptByRoamScore(tpAniSirGlobal pMac, tpRrmNeighborReportDesc pNeighborReportDesc)
+{
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   tListElem       *pEntry;
+   tRrmNeighborReportDesc  *pTempNeighborReportDesc;
+
+   VOS_ASSERT(pNeighborReportDesc != NULL);
+   VOS_ASSERT(pNeighborReportDesc->pNeighborBssDescription != NULL);
+
+   if (csrLLIsListEmpty(&pSmeRrmContext->neighborReportCache, LL_ACCESS_LOCK))
+   {
+       smsLog(pMac, LOGE, FL("Neighbor report cache is empty.. Adding a entry now\n"));
+        /* Neighbor list cache is empty. Insert this entry in the tail */
+       csrLLInsertTail(&pSmeRrmContext->neighborReportCache, &pNeighborReportDesc->List, LL_ACCESS_LOCK);
+       return;
+   }
+   else
+   {
+       /* Should store the neighbor BSS description in the order sorted by roamScore in descending
+              order. APs with highest roamScore should be the 1st entry in the list */
+        pEntry = csrLLPeekHead(&pSmeRrmContext->neighborReportCache, LL_ACCESS_LOCK);
+        while (pEntry != NULL)
+        {
+            pTempNeighborReportDesc = GET_BASE_ADDR( pEntry, tRrmNeighborReportDesc, List );
+            if (pTempNeighborReportDesc->roamScore < pNeighborReportDesc->roamScore)
+                break;
+            pEntry = csrLLNext(&pSmeRrmContext->neighborReportCache, pEntry, LL_ACCESS_LOCK);
+        } 
+
+        if (pEntry)
+            /* This BSS roamscore is better than something in the list. Insert this before that one */
+            csrLLInsertEntry(&pSmeRrmContext->neighborReportCache, pEntry, &pNeighborReportDesc->List, LL_ACCESS_LOCK);
+        else
+            /* All the entries in the list has a better roam Score than this one. Insert this at the last */
+            csrLLInsertTail(&pSmeRrmContext->neighborReportCache, &pNeighborReportDesc->List, LL_ACCESS_LOCK);
+   }
+   return;
+}
+
+/*--------------------------------------------------------------------------
+  \brief sme_RrmProcessNeighborReport() - This is called to process the Neighbor 
+         report received from PE.
+  
+  \param pMsgBuf - a pointer to a buffer that maps to various structures base 
+                   on the message type.
+                   The beginning of the buffer can always map to tSirSmeRsp.
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_RrmProcessNeighborReport(tpAniSirGlobal pMac, void *pMsgBuf)
+{
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tpSirNeighborReportInd pNeighborRpt = (tpSirNeighborReportInd) pMsgBuf;
+   tpRrmNeighborReportDesc  pNeighborReportDesc;
+   tANI_U8 i = 0;
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+#ifdef FEATURE_WLAN_CCX
+   // Clear the cache for CCX.
+   if (csrNeighborRoamIsCCXAssoc(pMac))
+   {
+       rrmLLPurgeNeighborCache(pMac, 
+           &pMac->rrm.rrmSmeContext.neighborReportCache);
+   }
+#endif
+
+   for (i = 0; i < pNeighborRpt->numNeighborReports; i++)
+   {
+       pNeighborReportDesc = vos_mem_malloc(sizeof(tRrmNeighborReportDesc));
+       if (NULL == pNeighborReportDesc)
+       {
+           smsLog( pMac, LOGE, "Failed to allocate memory for RRM Neighbor report desc\n");
+           status = eHAL_STATUS_FAILED_ALLOC;
+           goto end;
+            
+       }
+
+       vos_mem_zero(pNeighborReportDesc, sizeof(tRrmNeighborReportDesc));
+       pNeighborReportDesc->pNeighborBssDescription = vos_mem_malloc(sizeof(tSirNeighborBssDescription));
+       if (NULL == pNeighborReportDesc->pNeighborBssDescription)
+       {
+           smsLog( pMac, LOGE, "Failed to allocate memory for RRM Neighbor report BSS Description\n");
+           status = eHAL_STATUS_FAILED_ALLOC;
+           goto end;
+       }
+       vos_mem_zero(pNeighborReportDesc->pNeighborBssDescription, sizeof(tSirNeighborBssDescription));
+       vos_mem_copy(pNeighborReportDesc->pNeighborBssDescription, &pNeighborRpt->sNeighborBssDescription[i], 
+                                                sizeof(tSirNeighborBssDescription));
+
+#if defined WLAN_VOWIFI_DEBUG
+       smsLog( pMac, LOGE, "Received neighbor report with Neighbor BSSID: %02x:%02x:%02x:%02x:%02x:%02x \n",
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[0], 
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[1], 
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[2], 
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[3], 
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[4], 
+                    pNeighborRpt->sNeighborBssDescription[i].bssId[5]);
+#endif
+
+       /* Calculate the roam score based on the BSS Capability in the BSSID Information and store it in Neighbor report Desc */
+       rrmCalculateNeighborAPRoamScore(pMac, pNeighborReportDesc);
+
+       /* Store the Neighbor report Desc in the cache based on the roam score */
+       if ( pNeighborReportDesc->roamScore > 0)
+       {
+          rrmStoreNeighborRptByRoamScore(pMac, pNeighborReportDesc);
+       }
+       else
+       {
+           smsLog(pMac, LOGE, FL("Roam score of BSSID  %02x:%02x:%02x:%02x:%02x:%02x is 0, Ignoring.."), 
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[0],
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[1],
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[2],
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[3],
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[4],
+                        pNeighborRpt->sNeighborBssDescription[i].bssId[5]);
+
+           vos_mem_free(pNeighborReportDesc->pNeighborBssDescription);
+           vos_mem_free(pNeighborReportDesc);
+       }
+   }
+end:  
+   
+   if (!csrLLCount(&pMac->rrm.rrmSmeContext.neighborReportCache))
+      vosStatus = VOS_STATUS_E_FAILURE;
+ 
+   /* Received a report from AP. Indicate SUCCESS to the caller if there are some valid reports */
+   rrmIndicateNeighborReportResult(pMac, vosStatus);
+
+   return status;
+}
+/*--------------------------------------------------------------------------
+  \brief sme_RrmMsgProcessor() - sme_ProcessMsg() calls this function for the 
+  messages that are handled by SME RRM module.
+  
+  \param pMac - Pointer to the global MAC parameter structure.
+  \param msg_type - the type of msg passed by PE as defined in wniApi.h
+  \param pMsgBuf - a pointer to a buffer that maps to various structures base 
+                   on the message type.
+                   The beginning of the buffer can always map to tSirSmeRsp.
+  
+  \return eHAL_STATUS_SUCCESS - Validation is successful.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+eHalStatus sme_RrmMsgProcessor( tpAniSirGlobal pMac,  v_U16_t msg_type, 
+                                void *pMsgBuf)
+{
+   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+         FL(" Msg = %d for RRM measurement\n") , msg_type );
+
+   //switch on the msg type & make the state transition accordingly
+   switch(msg_type)
+   {
+      case eWNI_SME_NEIGHBOR_REPORT_IND:
+         sme_RrmProcessNeighborReport( pMac, pMsgBuf );
+         break;
+
+      case eWNI_SME_BEACON_REPORT_REQ_IND:
+         sme_RrmProcessBeaconReportReqInd( pMac, pMsgBuf );
+         break;
+
+      default:
+         //err msg
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+               FL("sme_RrmMsgProcessor:unknown msg type = %d\n"), msg_type);
+
+         break;
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn rrmIterMeasTimerHandle
+
+    \brief  Timer handler to handlet the timeout condition when a specific BT
+
+            stop event does not come back, in which case to restore back the
+
+            heartbeat timer.
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOID
+
+  ---------------------------------------------------------------------------*/
+
+void rrmIterMeasTimerHandle( v_PVOID_t userData )
+{
+   tpAniSirGlobal pMac = (tpAniSirGlobal) userData;
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Randomization timer expired...send on next channel \n");
+#endif
+    //Issue a scan req for next channel.
+    sme_RrmIssueScanReq( pMac ); 
+}
+
+/* ---------------------------------------------------------------------------
+    
+    \fn rrmNeighborRspTimeoutHandler
+    
+    \brief  Timer handler to handle the timeout condition when a neighbor request is sent 
+                    and no neighbor response is received from the AP
+    
+    \param  pMac - The handle returned by macOpen.
+    
+    \return VOID
+    
+---------------------------------------------------------------------------*/
+    
+void rrmNeighborRspTimeoutHandler
+( v_PVOID_t userData )
+{
+   tpAniSirGlobal pMac = (tpAniSirGlobal) userData;
+#if defined WLAN_VOWIFI_DEBUG
+   smsLog( pMac, LOGE, "Neighbor Response timed out \n");
+#endif
+    rrmIndicateNeighborReportResult(pMac, VOS_STATUS_E_FAILURE);
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn rrmOpen
+
+    \brief  
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS
+
+            VOS_STATUS_E_FAILURE  success
+
+            VOS_STATUS_SUCCESS  failure
+
+  ---------------------------------------------------------------------------*/
+
+VOS_STATUS rrmOpen (tpAniSirGlobal pMac)
+
+{
+
+   VOS_STATUS vosStatus;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+   eHalStatus   halStatus = eHAL_STATUS_SUCCESS;
+
+   pSmeRrmContext->rrmConfig.maxRandnInterval = 50; //ms
+
+   vosStatus = vos_timer_init( &pSmeRrmContext->IterMeasTimer,
+
+                      VOS_TIMER_TYPE_SW,
+
+                      rrmIterMeasTimerHandle,
+
+                      (void*) pMac);
+
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "rrmOpen: Fail to init timer");
+
+       return VOS_STATUS_E_FAILURE;
+   }
+
+   vosStatus = vos_timer_init( &pSmeRrmContext->neighborReqControlInfo.neighborRspWaitTimer,
+
+                      VOS_TIMER_TYPE_SW,
+
+                      rrmNeighborRspTimeoutHandler,
+
+                      (void*) pMac);
+
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "rrmOpen: Fail to init timer");
+
+       return VOS_STATUS_E_FAILURE;
+   }
+
+   pSmeRrmContext->neighborReqControlInfo.isNeighborRspPending = eANI_BOOLEAN_FALSE;
+
+   halStatus = csrLLOpen(pMac->hHdd, &pSmeRrmContext->neighborReportCache);
+   if (eHAL_STATUS_SUCCESS != halStatus)
+   {
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "rrmOpen: Fail to open neighbor cache result");
+       return VOS_STATUS_E_FAILURE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn rrmClose
+
+    \brief  
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS
+
+            VOS_STATUS_E_FAILURE  success
+
+            VOS_STATUS_SUCCESS  failure
+
+  ---------------------------------------------------------------------------*/
+
+VOS_STATUS rrmClose (tpAniSirGlobal pMac)
+
+{
+
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+
+   if( VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState( &pSmeRrmContext->IterMeasTimer ) )
+   {
+      vosStatus = vos_timer_stop( &pSmeRrmContext->IterMeasTimer );
+      if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+      { 
+         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("Timer stop fail") );
+      }
+   } 
+
+   vosStatus = vos_timer_destroy( &pSmeRrmContext->IterMeasTimer ); 
+   if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
+
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("Fail to destroy timer") );
+
+   }
+
+   rrmLLPurgeNeighborCache(pMac, &pSmeRrmContext->neighborReportCache);
+      
+   csrLLClose(&pSmeRrmContext->neighborReportCache);
+
+   return vosStatus;
+
+}
+
+
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn rrmReady
+
+    \brief  fn
+
+    \param  pMac - The handle returned by macOpen.
+
+    \return VOS_STATUS
+
+  ---------------------------------------------------------------------------*/
+
+VOS_STATUS rrmReady (tpAniSirGlobal pMac)
+
+{
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn rrmChangeDefaultConfigParam
+    \brief  fn
+
+    \param  pMac - The handle returned by macOpen.
+    \param  pRrmConfig - pointer to new rrm configs.
+
+    \return VOS_STATUS
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS rrmChangeDefaultConfigParam(tpAniSirGlobal pMac, tpRrmConfigParam pRrmConfig)
+{
+   vos_mem_copy( &pMac->rrm.rrmSmeContext.rrmConfig, pRrmConfig, sizeof( tRrmConfigParam ) ); 
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+    
+    \fn smeRrmGetFirstBssEntryFromNeighborCache()
+    
+    \brief  This function returns the first entry from the neighbor cache to the caller
+
+    \param  pMac - The handle returned by macOpen.
+    
+    \return VOID
+    
+---------------------------------------------------------------------------*/
+tRrmNeighborReportDesc* smeRrmGetFirstBssEntryFromNeighborCache( tpAniSirGlobal pMac)
+{
+   tListElem *pEntry;
+   tRrmNeighborReportDesc *pTempBssEntry = NULL;
+   tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
+
+
+   pEntry = csrLLPeekHead( &pSmeRrmContext->neighborReportCache, LL_ACCESS_LOCK );
+
+   if(!pEntry || !csrLLCount(&pSmeRrmContext->neighborReportCache))
+   {
+      //list empty
+      smsLog(pMac, LOGW, FL("List empty\n"));
+      return NULL;
+   }
+
+   pTempBssEntry = GET_BASE_ADDR( pEntry, tRrmNeighborReportDesc, List );
+
+   return pTempBssEntry;
+}
+
+/* ---------------------------------------------------------------------------
+    
+    \fn smeRrmGetNextBssEntryFromNeighborCache()
+    
+    \brief  This function returns the entry next to the given entry from the 
+                neighbor cache to the caller
+
+    \param  pMac - The handle returned by macOpen.
+    
+    \return VOID
+    
+---------------------------------------------------------------------------*/
+tRrmNeighborReportDesc* smeRrmGetNextBssEntryFromNeighborCache( tpAniSirGlobal pMac, 
+                                                        tpRrmNeighborReportDesc pBssEntry)
+{
+   tListElem *pEntry;
+   tRrmNeighborReportDesc *pTempBssEntry = NULL;
+
+   pEntry = csrLLNext(&pMac->rrm.rrmSmeContext.neighborReportCache, &pBssEntry->List, LL_ACCESS_LOCK);
+
+   if(!pEntry)
+   {
+      //list empty
+      smsLog(pMac, LOGW, FL("List empty\n"));
+      return NULL;
+   }
+
+   pTempBssEntry = GET_BASE_ADDR( pEntry, tRrmNeighborReportDesc, List );
+
+   return pTempBssEntry;
+}
+
+#ifdef FEATURE_WLAN_CCX
+void csrCcxSendAdjacentApRepMsg(tpAniSirGlobal pMac, tCsrRoamSession *pSession)
+{
+   tpSirAdjacentApRepInd pAdjRep;
+   tANI_U16 length;
+   tANI_U32 roamTS2;
+   
+   smsLog( pMac, LOG1, "Adjacent AP Report Msg to PE\n");
+
+   length = sizeof(tSirAdjacentApRepInd );
+   pAdjRep = vos_mem_malloc ( length );
+
+   if ( NULL == pAdjRep )
+   {
+       smsLog( pMac, LOGP, "Unable to allocate memory for Adjacent AP report");
+       return;
+   }
+
+   vos_mem_zero( pAdjRep, length );
+   pAdjRep->messageType = eWNI_SME_CCX_ADJACENT_AP_REPORT;
+   pAdjRep->length = length;
+   pAdjRep->channelNum = pSession->prevOpChannel;
+   vos_mem_copy( pAdjRep->bssid, &pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
+   vos_mem_copy( pAdjRep->prevApMacAddr, &pSession->prevApBssid, sizeof(tSirMacAddr) );
+   vos_mem_copy( &pAdjRep->prevApSSID, &pSession->prevApSSID, sizeof(tSirMacSSid) );
+   roamTS2 = vos_timer_get_system_time();
+   pAdjRep->tsmRoamdelay = roamTS2 - pSession->roamTS1;
+   pAdjRep->roamReason =SIR_CCX_ASSOC_REASON_UNSPECIFIED;
+   pAdjRep->clientDissSecs =(pAdjRep->tsmRoamdelay/1000);
+
+   palSendMBMessage(pMac->hHdd, pAdjRep);
+
+   return;
+}
+#endif   /* FEATURE_WLAN_CCX */
+#endif
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
new file mode 100644
index 0000000..642e8f0
--- /dev/null
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -0,0 +1,6353 @@
+/*
+ * 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  smeApi.c
+
+  \brief Definitions for SME APIs
+
+   Copyright 2008 (c) 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.
+
+
+
+  when           who                 what, where, why
+----------       ---                --------------------------------------------------------
+06/03/10     js                     Added support to hostapd driven
+ *                                  deauth/disassoc/mic failure
+
+===========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h"
+#endif
+
+#include "smsDebug.h"
+#include "sme_Api.h"
+#include "csrInsideApi.h"
+#include "smeInside.h"
+#include "csrInternal.h"
+#include "wlan_qct_wda.h"
+#include "halMsgApi.h"
+
+#ifdef WLAN_SOFTAP_FEATURE
+#include "sapApi.h"
+#endif
+
+
+
+#if !defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
+
+#include <wlan_qct_pal_api.h>
+#endif
+
+// TxMB Functions
+extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
+                            tANI_U32 size, tSmeCmd **ppCmd );
+extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
+#if defined WLAN_FEATURE_P2P
+extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
+extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
+extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
+extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
+extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
+extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
+#endif
+
+static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
+static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
+
+eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
+
+eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac,  void *pMsgBuf);
+
+eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
+
+eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
+
+//Internal SME APIs
+eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if(psSme)
+    {
+        if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
+        {
+            status = eHAL_STATUS_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+
+eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if(psSme)
+    {
+        if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
+        {
+            status = eHAL_STATUS_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+
+
+static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
+{
+    eHalStatus status;
+    tSmeCmd *pCmd;
+
+    pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
+    if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
+    {
+        if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
+        {
+            if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
+            {
+                status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
+                if(HAL_STATUS_SUCCESS(status))
+                {
+                    tANI_U32 c;
+
+                    palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
+                    pMac->sme.pSmeCmdBufAddr = pCmd;
+                    for(c = 0; c < pMac->sme.totalSmeCmd; c++)
+                    {
+                        csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
+                    }
+                }
+            }
+        }
+    }
+
+    return (status);
+}
+
+
+void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
+{
+    pCmd->command = eSmeNoCommand;
+    csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
+}
+
+
+
+static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
+{
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+
+    while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
+    {
+        //TODO: base on command type to call release functions
+        //reinitialize different command types so they can be reused
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+    }
+}
+
+static void purgeSmeCmdList(tpAniSirGlobal pMac)
+{
+    //release any out standing commands back to free command list
+    smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
+    smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
+}
+
+void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+    //release any out standing commands back to free command list
+    tListElem *pEntry, *pNext;
+    tSmeCmd *pCommand;
+    tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
+    tDblLinkList localList;
+
+    vos_mem_zero(&localList, sizeof(tDblLinkList));
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    {
+        smsLog(pMac, LOGE, FL(" failed to open list"));
+        return;
+    }
+
+    csrLLLock(pList);
+    pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
+    while(pEntry != NULL)
+    {
+        pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        if(pCommand->sessionId == sessionId)
+        {
+            if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
+            {
+                csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+            }
+        }
+        pEntry = pNext;
+    }
+    csrLLUnlock(pList);
+
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
+    {
+        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+    }
+    csrLLClose(&localList);
+
+}
+
+
+static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+
+    purgeSmeCmdList(pMac);
+    csrLLClose(&pMac->sme.smeCmdPendingList);
+    csrLLClose(&pMac->sme.smeCmdActiveList);
+    csrLLClose(&pMac->sme.smeCmdFreeList);
+
+    if(NULL != pMac->sme.pSmeCmdBufAddr)
+    {
+        status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
+        pMac->sme.pSmeCmdBufAddr = NULL;
+    }
+
+    return (status);
+}
+
+
+void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
+{
+#ifdef WLAN_DEBUG
+    switch( pCmd->command )
+    {
+    case eSmeCommandScan:
+        smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
+        break;
+
+    case eSmeCommandRoam:
+        smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
+        break;
+
+    case eSmeCommandWmStatusChange:
+        smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
+        break;
+
+    case eSmeCommandSetKey:
+        smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)", 
+                        pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
+        break;
+
+    case eSmeCommandRemoveKey:
+        smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)", 
+                        pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
+        break;
+
+    default:
+        break;
+    }
+#endif  //#ifdef WLAN_DEBUG
+}
+
+tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
+{
+    tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
+    tListElem *pEntry;
+
+    pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
+
+    // If we can get another MS Msg buffer, then we are ok.  Just link
+    // the entry onto the linked list.  (We are using the linked list
+    // to keep track of tfhe message buffers).
+    if ( pEntry )
+    {
+        pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+    }
+    else {
+        int idx = 1;
+
+        //Cannot change pRetCmd here since it needs to return later.
+        pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
+        if( pEntry )
+        {
+           pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        }
+        smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck\n", 
+           (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
+        if(pTempCmd)
+        {
+            if( eSmeCsrCommandMask & pTempCmd->command )
+            {
+                //CSR command is stuck. See what the reason code is for that command
+                dumpCsrCommandInfo(pMac, pTempCmd);
+            }
+        } //if(pTempCmd)
+
+        //dump what is in the pending queue
+        csrLLLock(&pMac->sme.smeCmdPendingList);
+        pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
+        while(pEntry)
+        {
+            pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+            smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)\n",
+                    idx++, pTempCmd->command );
+            if( eSmeCsrCommandMask & pTempCmd->command )
+            {
+                //CSR command is stuck. See what the reason code is for that command
+                dumpCsrCommandInfo(pMac, pTempCmd);
+            }
+            pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
+        }
+        csrLLUnlock(&pMac->sme.smeCmdPendingList);
+
+        //There may be some more command in CSR's own pending queue
+        csrLLLock(&pMac->roam.roamCmdPendingList);
+        pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
+        while(pEntry)
+        {
+            pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+            smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)\n",
+                    idx++, pTempCmd->command );
+            dumpCsrCommandInfo(pMac, pTempCmd);
+            pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
+        }
+        csrLLUnlock(&pMac->roam.roamCmdPendingList);
+    }
+
+    return( pRetCmd );
+}
+
+
+void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
+{
+    if ( fHighPriority )
+    {
+        csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
+    }
+    else
+    {
+        csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
+    }
+
+    // process the command queue...
+    smeProcessPendingQueue( pMac );
+
+    return;
+}
+
+
+static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
+{
+    eSmeCommandType pmcCommand = eSmeNoCommand;
+    tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
+    tPmcState pmcState;
+    eHalStatus status;
+
+    do
+    {
+        pmcState = pmcGetPmcState(pMac);
+
+        status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
+        if( !HAL_STATUS_SUCCESS(status) )
+        {
+            //PMC state is not right for the command, drop it
+            return ( eSmeDropCommand );
+        }
+        if( fFullPowerNeeded  ) break;
+        fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
+                    ( eSmeCommandDelTs ==  pCommand->command ) );
+        if( fFullPowerNeeded ) break;
+#ifdef WLAN_FEATURE_P2P
+        fFullPowerNeeded = (pmcState == IMPS && 
+                            eSmeCommandRemainOnChannel == pCommand->command);
+        if(fFullPowerNeeded) break;
+#endif
+    } while(0);
+
+    if( fFullPowerNeeded )
+    {
+        switch( pmcState )
+        {
+        case IMPS:
+        case STANDBY:
+            pmcCommand = eSmeCommandExitImps;
+            break;
+
+        case BMPS:
+            pmcCommand = eSmeCommandExitBmps;
+            break;
+
+        case UAPSD:
+            pmcCommand = eSmeCommandExitUapsd;
+            break;
+
+        case WOWL:
+            pmcCommand = eSmeCommandExitWowl;
+            break;
+
+        default:
+            break;
+        }
+    }
+
+    return ( pmcCommand );
+}
+
+
+//For commands that need to do extra cleanup.
+static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
+{
+    if( eSmePmcCommandMask & pCommand->command )
+    {
+        pmcAbortCommand( pMac, pCommand, fStopping );
+    }
+    else if ( eSmeCsrCommandMask & pCommand->command )
+    {
+        csrAbortCommand( pMac, pCommand, fStopping );
+    }
+    else
+    {
+        switch( pCommand->command )
+        {
+#ifdef WLAN_FEATURE_P2P
+            case eSmeCommandRemainOnChannel:
+                if (NULL != pCommand->u.remainChlCmd.callback)
+                {
+                    remainOnChanCallback callback = 
+                                            pCommand->u.remainChlCmd.callback;
+                    /* process the msg */
+                    if( callback )
+                    {
+                        callback(pMac, pCommand->u.remainChlCmd.callbackCtx, 
+                                            eCSR_SCAN_ABORT );
+                    }
+                }
+                smeReleaseCommand( pMac, pCommand );
+                break;
+#endif
+            default:
+                smeReleaseCommand( pMac, pCommand );
+                break;
+        }
+    }
+}
+
+
+
+tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
+{
+    tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tListElem *pEntry;
+    tSmeCmd *pCommand;
+    eSmeCommandType pmcCommand = eSmeNoCommand;
+
+    // if the ActiveList is empty, then nothing is active so we can process a
+    // pending command...
+    //alwasy lock active list before locking pending list
+    csrLLLock( &pMac->sme.smeCmdActiveList );
+    if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
+    {
+        if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
+        {
+            //Peek the command
+            pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
+            if( pEntry )
+            {
+                pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+                //We cannot execute any command in wait-for-key state until setKey is through.
+                if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
+                {
+                    if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
+                    {
+                        csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                        smsLog(pMac, LOGE, "  Cannot process command(%d) while waiting for key\n", pCommand->command);
+                        return ( eANI_BOOLEAN_FALSE );
+                    }
+                }
+                pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
+                if( eSmeDropCommand == pmcCommand )
+                {
+                    //This command is not ok for current PMC state
+                    if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
+                    {
+                        smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
+                    }
+                    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                    //tell caller to continue
+                    return (eANI_BOOLEAN_TRUE);
+                }
+                else if( eSmeNoCommand != pmcCommand )
+                {
+                    tExitBmpsInfo exitBmpsInfo;
+                    void *pv = NULL;
+                    tANI_U32 size = 0;
+                    tSmeCmd *pPmcCmd = NULL;
+
+                    if( eSmeCommandExitBmps == pmcCommand )
+                    {
+                        exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
+                        pv = (void *)&exitBmpsInfo;
+                        size = sizeof(tExitBmpsInfo);
+                    }
+                    //pmcCommand has to be one of the exit power save command
+                    status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
+                    if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
+                    {
+                        //Force this command to wake up the chip
+                        csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
+                        csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                        fContinue = pmcProcessCommand( pMac, pPmcCmd );
+                        if( fContinue )
+                        {
+                            //The command failed, remove it
+                            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
+                            {
+                                pmcReleaseCommand( pMac, pPmcCmd );
+                            }
+                        }
+                    }
+                    else
+                    {
+                        csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                        smsLog( pMac, LOGE, FL(  "Cannot issue command(0x%X) to wake up the chip. Status = %d\n"), pmcCommand, status );
+                        //Let it retry
+                        fContinue = eANI_BOOLEAN_TRUE;
+                    }
+                    return fContinue;
+                }
+                if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
+                {
+                    // we can reuse the pCommand
+
+                    // Insert the command onto the ActiveList...
+                    csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
+
+                    // .... and process the command.
+
+                    switch ( pCommand->command )
+                    {
+
+                        case eSmeCommandScan:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            status = csrProcessScanCommand( pMac, pCommand );
+                            break;
+
+                        case eSmeCommandRoam:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            status  = csrRoamProcessCommand( pMac, pCommand );
+                            break;
+
+                        case eSmeCommandWmStatusChange:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
+                            break;
+
+                        case eSmeCommandSetKey:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            status = csrRoamProcessSetKeyCommand( pMac, pCommand );
+                            if(!HAL_STATUS_SUCCESS(status))
+                            {
+                                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, 
+                                            &pCommand->Link, LL_ACCESS_LOCK ) )
+                                {
+                                    csrReleaseCommandSetKey( pMac, pCommand );
+                                }
+                            }
+                            break;
+
+                        case eSmeCommandRemoveKey:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
+                            if(!HAL_STATUS_SUCCESS(status))
+                            {
+                                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, 
+                                            &pCommand->Link, LL_ACCESS_LOCK ) )
+                                {
+                                    csrReleaseCommandRemoveKey( pMac, pCommand );
+                                }
+                            }
+                            break;
+
+                        case eSmeCommandAddStaSession:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            csrProcessAddStaSessionCommand( pMac, pCommand );
+                            break;
+                        case eSmeCommandDelStaSession:    
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            csrProcessDelStaSessionCommand( pMac, pCommand );
+                            break;
+
+#if defined WLAN_FEATURE_P2P
+                        case eSmeCommandRemainOnChannel:
+                            csrLLUnlock(&pMac->sme.smeCmdActiveList);
+                            p2pProcessRemainOnChannelCmd(pMac, pCommand);
+                            break;
+                        case eSmeCommandNoAUpdate:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            p2pProcessNoAReq(pMac,pCommand);
+#endif
+                        case eSmeCommandEnterImps:
+                        case eSmeCommandExitImps:
+                        case eSmeCommandEnterBmps:
+                        case eSmeCommandExitBmps:
+                        case eSmeCommandEnterUapsd:
+                        case eSmeCommandExitUapsd:
+                        case eSmeCommandEnterWowl:
+                        case eSmeCommandExitWowl:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            fContinue = pmcProcessCommand( pMac, pCommand );
+                            if( fContinue )
+                            {
+                                //The command failed, remove it
+                                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
+                                            &pCommand->Link, LL_ACCESS_LOCK ) )
+                                {
+                                    pmcReleaseCommand( pMac, pCommand );
+                                }
+                            }
+                            break;
+
+                        //Treat standby differently here because caller may not be able to handle
+                        //the failure so we do our best here
+                        case eSmeCommandEnterStandby:
+                            if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
+                            {
+                                //It can continue
+                                csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                                fContinue = pmcProcessCommand( pMac, pCommand );
+                                if( fContinue )
+                                {
+                                    //The command failed, remove it
+                                    if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
+                                                &pCommand->Link, LL_ACCESS_LOCK ) )
+                                    {
+                                        pmcReleaseCommand( pMac, pCommand );
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                //Need to issue a disconnect first before processing this command
+                                tSmeCmd *pNewCmd;
+
+                                //We need to re-run the command
+                                fContinue = eANI_BOOLEAN_TRUE;
+                                //Pull off the standby command first
+                                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
+                                                &pCommand->Link, LL_ACCESS_NOLOCK ) )
+                                {
+                                    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                                    //Need to call CSR function here because the disconnect command
+                                    //is handled by CSR
+                                    pNewCmd = csrGetCommandBuffer( pMac );
+                                    if( NULL != pNewCmd )
+                                    {
+                                        //Put the standby command to the head of the pending list first
+                                        csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
+                                                        LL_ACCESS_LOCK );
+                                        pNewCmd->command = eSmeCommandRoam;
+                                        pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
+                                        //Put the disassoc command before the standby command
+                                        csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
+                                                        LL_ACCESS_LOCK );
+                                    }
+                                    else
+                                    {
+                                        //Continue the command here
+                                        fContinue = pmcProcessCommand( pMac, pCommand );
+                                        if( fContinue )
+                                        {
+                                            //The command failed, remove it
+                                            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
+                                                        &pCommand->Link, LL_ACCESS_LOCK ) )
+                                            {
+                                                pmcReleaseCommand( pMac, pCommand );
+                                            }
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                                    smsLog( pMac, LOGE, FL(" failed to remove standby command\n") );
+                                    VOS_ASSERT(0);
+                                }
+                            }
+                            break;
+
+                        case eSmeCommandAddTs:
+                        case eSmeCommandDelTs:
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                            fContinue = qosProcessCommand( pMac, pCommand );
+                            if( fContinue )
+                            {
+                                //The command failed, remove it
+                                if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
+                                            &pCommand->Link, LL_ACCESS_NOLOCK ) )
+                                {
+//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                                    qosReleaseCommand( pMac, pCommand );
+//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+                                }
+                            }
+#endif
+                            break;
+
+                        default:
+                            //something is wrong
+                            //remove it from the active list
+                            smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d\n", pCommand->command);
+                            pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
+                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                            pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+                            smeReleaseCommand( pMac, pCommand );
+                            status = eHAL_STATUS_FAILURE;
+                            break;
+                    }
+                    if(!HAL_STATUS_SUCCESS(status))
+                    {
+                        fContinue = eANI_BOOLEAN_TRUE;
+                    }
+                }//if(pEntry)
+                else
+                {
+                    //This is odd. Some one else pull off the command.
+                    csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                }
+            }
+            else
+            {
+                csrLLUnlock( &pMac->sme.smeCmdActiveList );
+            }
+        }
+        else
+        {
+            //No command waiting
+            csrLLUnlock( &pMac->sme.smeCmdActiveList );
+            //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
+            if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
+            {
+                tANI_U32 nTime = 0;
+
+                pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
+                if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
+                {
+                    csrScanStartIdleScanTimer(pMac, nTime);
+                }
+            }
+        }
+    }
+    else {
+        csrLLUnlock( &pMac->sme.smeCmdActiveList );
+    }
+
+    return ( fContinue );
+}
+
+void smeProcessPendingQueue( tpAniSirGlobal pMac )
+{
+    while( smeProcessCommand( pMac ) );
+}
+
+
+tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
+{
+    return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
+        !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
+}
+
+
+
+//Global APIs
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_Open() - Initialze all SME modules and put them at idle state
+
+  The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
+  successfully return, all modules are at idle state ready to start.
+
+  smeOpen must be called before any other SME APIs can be involved.
+  smeOpen must be called after macOpen.
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen.
+
+  \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
+
+          Other status means SME is failed to be initialized
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Open(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   do {
+      pMac->sme.state = SME_STATE_STOP;
+      if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
+      {
+          smsLog( pMac, LOGE, "sme_Open failed init lock\n" );
+          status = eHAL_STATUS_FAILURE;
+          break;
+      }
+
+      status = ccmOpen(hHal);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "ccmOpen failed during initialization with status=%d", status );
+         break;
+      }
+
+      status = csrOpen(pMac);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "csrOpen failed during initialization with status=%d", status );
+         break;
+      }
+
+      status = pmcOpen(hHal);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "pmcOpen failed during initialization with status=%d", status );
+         break;
+      }
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+      status = sme_QosOpen(pMac);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "Qos open failed during initialization with status=%d", status );
+         break;
+      }
+
+      status = btcOpen(pMac);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "btcOpen open failed during initialization with status=%d", status );
+         break;
+      }
+#endif
+
+      if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
+          break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+      {
+         v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
+         if ( NULL == pvosGCtx ){
+            smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
+            status = eHAL_STATUS_FAILURE;
+            break;
+         }
+
+         status = WLANSAP_Open( pvosGCtx );
+         if ( ! HAL_STATUS_SUCCESS( status ) ) {
+             smsLog( pMac, LOGE,
+                     "WLANSAP_Open open failed during initialization with status=%d", status );
+             break;
+         }
+      }
+#endif
+#if defined WLAN_FEATURE_VOWIFI
+      status = rrmOpen(pMac);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE,
+                 "rrmOpen open failed during initialization with status=%d", status );
+         break;
+      }
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+      sme_FTOpen(pMac);
+#endif
+#if defined WLAN_FEATURE_P2P
+      sme_p2pOpen(pMac);
+#endif
+
+   }while (0);
+
+   return status;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*--------------------------------------------------------------------------
+
+  \brief sme_set11dinfo() - Set the 11d information about valid channels
+   and there power using information from nvRAM
+   This function is called only for AP.
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by macOpen.
+  \Param pSmeConfigParams - a pointer to a caller allocated object of
+  typedef struct _smeConfigParams.
+
+  \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
+
+          Other status means SME is failed to update the config parameters.
+  \sa
+--------------------------------------------------------------------------*/
+
+eHalStatus sme_set11dinfo(tHalHandle hHal,  tpSmeConfigParams pSmeConfigParams)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == pSmeConfigParams ) {
+      smsLog( pMac, LOGE,
+              "Empty config param structure for SME, nothing to update");
+      return status;
+   }
+
+   status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d\n",
+              status );
+   }
+    return status;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by HostapdAdapter.
+  \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
+
+  \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
+
+          Other status means, failed to get the current regulatory domain.
+  \sa
+--------------------------------------------------------------------------*/
+
+eHalStatus sme_getSoftApDomain(tHalHandle hHal,  v_REGDOMAIN_t *domainIdSoftAp)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == domainIdSoftAp ) {
+      smsLog( pMac, LOGE, "Uninitialized domain Id");
+      return status;
+   }    
+
+   *domainIdSoftAp = pMac->scan.domainIdCurrent;
+   status = eHAL_STATUS_SUCCESS;
+    
+   return status;
+}
+
+
+eHalStatus sme_setRegInfo(tHalHandle hHal,  tANI_U8 *apCntryCode)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == apCntryCode ) {
+      smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
+      return status;
+   }
+
+   status = csrSetRegInfo(hHal, apCntryCode );
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d\n",
+              status );
+   }
+    return status;
+}
+
+#endif
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*--------------------------------------------------------------------------
+
+  \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
+ 
+  It is used at driver start up to inform RIVA of the default channel 
+  configuration. 
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by macOpen.
+  
+  \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
+
+          Other status means SME is failed to update the channel config.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
+{
+  tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+  pmcUpdateScanParams( pMac, &(pMac->roam.configParam), 
+                      &pMac->scan.base20MHzChannels, FALSE);
+  return eHAL_STATUS_SUCCESS;
+}
+#endif // FEATURE_WLAN_SCAN_PNLO
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_UpdateConfig() - Change configurations for all SME moduels
+
+  The function updates some configuration for modules in SME, CCM, CSR, etc
+  during SMEs close open sequence.
+
+  Modules inside SME apply the new configuration at the next transaction.
+
+  This is a synchronuous call
+
+  \param hHal - The handle returned by macOpen.
+  \Param pSmeConfigParams - a pointer to a caller allocated object of
+  typedef struct _smeConfigParams.
+
+  \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
+
+          Other status means SME is failed to update the config parameters.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == pSmeConfigParams ) {
+      smsLog( pMac, LOGE,
+              "Empty config param structure for SME, nothing to update");
+      return status;
+   }
+
+   status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
+
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d\n",
+              status );
+   }
+#if defined WLAN_FEATURE_P2P_INTERNAL
+   status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
+
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d\n",
+              status );
+   }
+#endif
+#if defined WLAN_FEATURE_VOWIFI
+   status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
+
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d\n",
+              status );
+   }
+#endif
+   //For SOC, CFG is set before start
+   //We don't want to apply global CFG in connect state because that may cause some side affect
+   if(
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+      //For the new init sequence, CFGs need to apply before vos_start is call
+      //No need to wait for ready state.
+      SME_IS_READY(pMac) && 
+#endif
+      csrIsAllSessionDisconnected( pMac) )
+   {
+       csrSetGlobalCfgs(pMac);
+   }
+
+   return status;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ChangeConfigParams
+    \brief The SME API exposed for HDD to provide config params to SME during
+    SMEs stop -> start sequence.
+
+    If HDD changed the domain that will cause a reset. This function will
+    provide the new set of 11d information for the new domain. Currrently this
+    API provides info regarding 11d only at reset but we can extend this for
+    other params (PMC, QoS) which needs to be initialized again at reset.
+
+    This is a synchronuous call
+
+    \param hHal - The handle returned by macOpen.
+
+    \Param
+    pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
+                currently provides 11d related information like Country code,
+                Regulatory domain, valid channel list, Tx power per channel, a
+                list with active/passive scan allowed per valid channel.
+
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
+                                 tCsrUpdateConfigParam *pUpdateConfigParam)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == pUpdateConfigParam ) {
+      smsLog( pMac, LOGE,
+              "Empty config param structure for SME, nothing to reset\n");
+      return status;
+   }
+
+   status = csrChangeConfigParams(pMac, pUpdateConfigParam);
+
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d\n",
+              status );
+   }
+
+   return status;
+
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
+  that the NIC is ready tio run.
+
+  The function is called by HDD at the end of initialization stage so PE/HAL can
+  enable the NIC to running state.
+
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen.
+
+  \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
+                                successfully.
+
+          Other status means SME failed to send the message to PE.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_HDDReadyInd(tHalHandle hHal)
+{
+   tSirSmeReadyReq Msg;
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tPmcPowerState powerState;
+   tPmcSwitchState hwWlanSwitchState;
+   tPmcSwitchState swWlanSwitchState;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   do
+   {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+      csrSetGlobalCfgs( pMac );
+#endif
+
+      Msg.messageType = eWNI_SME_SYS_READY_IND;
+      Msg.length      = sizeof( tSirSmeReadyReq );
+
+      if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
+      {
+         status = eHAL_STATUS_SUCCESS;
+      }
+      else
+      {
+         smsLog( pMac, LOGE,
+                 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
+         break;
+      }
+
+      status = pmcQueryPowerState( hHal, &powerState,
+                                &hwWlanSwitchState, &swWlanSwitchState );
+      if ( ! HAL_STATUS_SUCCESS( status ) )
+      {
+         smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d\n",
+                 status );
+         break;
+      }
+
+      if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
+           (ePMC_SWITCH_OFF != swWlanSwitchState) )
+      {
+         status = csrReady(pMac);
+         if ( ! HAL_STATUS_SUCCESS( status ) )
+         {
+            smsLog( pMac, LOGE, "csrReady failed with status=%d\n", status );
+            break;
+         }
+         status = pmcReady(hHal);
+         if ( ! HAL_STATUS_SUCCESS( status ) )
+         {
+             smsLog( pMac, LOGE, "pmcReady failed with status=%d\n", status );
+             break;
+         }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+         if(VOS_STATUS_SUCCESS != btcReady(hHal))
+         {
+             status = eHAL_STATUS_FAILURE;
+             smsLog( pMac, LOGE, "btcReady failed\n");
+             break;
+         }
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+         if(VOS_STATUS_SUCCESS != rrmReady(hHal))
+         {
+             status = eHAL_STATUS_FAILURE;
+             smsLog( pMac, LOGE, "rrmReady failed\n");
+             break;
+         }
+#endif
+      }
+      pMac->sme.state = SME_STATE_READY;
+   } while( 0 );
+
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_Start() - Put all SME modules at ready state.
+
+  The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
+  successfully return, all modules are ready to run.
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen.
+
+  \return eHAL_STATUS_SUCCESS - SME is ready.
+
+          Other status means SME is failed to start
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Start(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   do
+   {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC 
+      ccmStart(hHal);
+#endif
+      status = csrStart(pMac);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d\n",
+                 status );
+         break;
+      }
+
+      status = pmcStart(hHal);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d\n",
+                 status );
+         break;
+      }
+
+#ifdef WLAN_SOFTAP_FEATURE
+      status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d\n",
+                 status );
+         break;
+      }
+#endif
+      pMac->sme.state = SME_STATE_START;
+   }while (0);
+
+   return status;
+}
+
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/******************************************************************************
+*
+* Name: sme_PCFilterMatchCountResponseHandler
+*
+* Description:
+*    Invoke Packet Coalescing Filter Match Count callback routine
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    pMsg - Pointer to tRcvFltPktMatchRsp structure
+*
+* Returns: eHalStatus
+*
+******************************************************************************/
+eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
+
+    if (NULL == pMsg)
+    {
+        smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+        status = eHAL_STATUS_FAILURE;
+    }
+    else
+    {
+        smsLog(pMac, LOG2, "SME: entering "
+            "sme_FilterMatchCountResponseHandler\n");
+
+        /* Call Packet Coalescing Filter Match Count callback routine. */
+        if (pMac->pmc.FilterMatchCountCB != NULL)
+           pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
+                                          pRcvFltPktMatchRsp);
+
+        smsLog(pMac, LOG1, "%s: status=0x%x", __FUNCTION__,
+               pRcvFltPktMatchRsp->status);
+
+        pMac->pmc.FilterMatchCountCB = NULL;
+        pMac->pmc.FilterMatchCountCBContext = NULL;
+    }
+
+    return(status);
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_ProcessMsg() - The main message processor for SME.
+
+  The function is called by a message dispatcher when to process a message
+  targeted for SME.
+
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen.
+  \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
+
+  \return eHAL_STATUS_SUCCESS - SME successfully process the message.
+
+          Other status means SME failed to process the message to HAL.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (pMsg == NULL) {
+      smsLog( pMac, LOGE, "Empty message for SME, nothing to process\n");
+      return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( SME_IS_START(pMac) )
+      {
+          switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
+          case eWNI_PMC_ENTER_BMPS_RSP:
+          case eWNI_PMC_EXIT_BMPS_RSP:
+          case eWNI_PMC_EXIT_BMPS_IND:
+          case eWNI_PMC_ENTER_IMPS_RSP:
+          case eWNI_PMC_EXIT_IMPS_RSP:
+          case eWNI_PMC_SMPS_STATE_IND:
+          case eWNI_PMC_ENTER_UAPSD_RSP:
+          case eWNI_PMC_EXIT_UAPSD_RSP:
+          case eWNI_PMC_ENTER_WOWL_RSP:
+          case eWNI_PMC_EXIT_WOWL_RSP:
+             //PMC
+             if (pMsg->bodyptr)
+             {
+                pmcMessageProcessor(hHal, pMsg->bodyptr);
+                status = eHAL_STATUS_SUCCESS;
+                vos_mem_free( pMsg->bodyptr );
+             } else {
+                smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process\n");
+             }
+             break;
+
+          case WNI_CFG_SET_CNF:
+          case WNI_CFG_DNLD_CNF:
+          case WNI_CFG_GET_RSP:
+          case WNI_CFG_ADD_GRP_ADDR_CNF:
+          case WNI_CFG_DEL_GRP_ADDR_CNF:
+             //CCM
+             if (pMsg->bodyptr)
+             {
+                ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
+                status = eHAL_STATUS_SUCCESS;
+                vos_mem_free( pMsg->bodyptr );
+             } else {
+                smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process\n");
+             }
+             break;
+
+          case eWNI_SME_ADDTS_RSP:
+          case eWNI_SME_DELTS_RSP:
+          case eWNI_SME_DELTS_IND:
+#ifdef WLAN_FEATURE_VOWIFI_11R
+          case eWNI_SME_FT_AGGR_QOS_RSP:
+#endif             
+             //QoS
+             if (pMsg->bodyptr)
+             {
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+                status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
+                vos_mem_free( pMsg->bodyptr );
+#endif
+             } else {
+                smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process\n");
+             }
+             break;
+#if defined WLAN_FEATURE_VOWIFI
+          case eWNI_SME_NEIGHBOR_REPORT_IND:
+          case eWNI_SME_BEACON_REPORT_REQ_IND:
+#if defined WLAN_VOWIFI_DEBUG
+             smsLog( pMac, LOGE, "Received RRM message. Message Id = %d\n", pMsg->type );
+#endif
+             if ( pMsg->bodyptr )
+             {
+                status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
+                vos_mem_free( pMsg->bodyptr );
+             }
+             else
+             {
+                smsLog( pMac, LOGE, "Empty message for RRM, nothing to process\n");
+             }
+             break;
+#endif
+
+
+          case eWNI_SME_ADD_STA_SELF_RSP:
+                if(pMsg->bodyptr)
+                {
+                   status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process\n");
+                }
+                break;
+          case eWNI_SME_DEL_STA_SELF_RSP:
+                if(pMsg->bodyptr)
+                {
+                   status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process\n");
+                }
+                break;
+#ifdef WLAN_FEATURE_P2P
+          //Handle the eWNI_SME_INNAV_MEAS_RSP:
+          case eWNI_SME_REMAIN_ON_CHN_RSP:
+                if(pMsg->bodyptr)
+                {
+                    status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
+                    vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process\n");
+                }
+                break;
+          case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
+                if(pMsg->bodyptr)
+                {
+                    status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
+                    vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process\n");
+                }
+                break;
+           case eWNI_SME_MGMT_FRM_IND:
+                if(pMsg->bodyptr)
+                {
+                    sme_mgmtFrmInd(pMac, pMsg->bodyptr);
+                    vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                { 
+                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process\n");
+                }
+                break;
+           case eWNI_SME_ACTION_FRAME_SEND_CNF:
+                if(pMsg->bodyptr)
+                {
+                    status = sme_sendActionCnf(pMac, pMsg->bodyptr);
+                    vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process\n");
+                }
+                break;
+#endif
+          case eWNI_SME_COEX_IND:
+                if(pMsg->bodyptr)
+                {
+                   status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process\n");
+                }
+                break;    
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+          case eWNI_SME_PREF_NETWORK_FOUND_IND:
+                if(pMsg->bodyptr)
+                {
+                   status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process\n");
+                }
+                break;
+#endif // FEATURE_WLAN_SCAN_PNO
+          
+          case eWNI_SME_TX_PER_HIT_IND:
+                if (pMac->sme.pTxPerHitCallback)
+                {
+                   pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
+                }
+                break;
+
+          case eWNI_SME_CHANGE_COUNTRY_CODE:
+                if(pMsg->bodyptr)
+                {
+                   status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process\n");
+                }
+                break;
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+          case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
+                if(pMsg->bodyptr)
+                {
+                   status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog(pMac, LOGE, "Empty rsp message for meas "
+                          "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process\n");
+                }
+                break;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+          case eWNI_SME_PRE_SWITCH_CHL_IND:
+             {
+                status = sme_HandlePreChannelSwitchInd(pMac);
+                break;
+             }
+                
+          case eWNI_SME_POST_SWITCH_CHL_IND:
+             {
+                status = sme_HandlePostChannelSwitchInd(pMac);
+                break;
+             }
+
+#ifdef WLAN_WAKEUP_EVENTS
+          case eWNI_SME_WAKE_REASON_IND:
+                if(pMsg->bodyptr)
+                {
+                   status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
+                   vos_mem_free(pMsg->bodyptr);
+                }
+                else
+                {
+                   smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process\n");
+                }
+                break;
+#endif // WLAN_WAKEUP_EVENTS
+
+          default:
+
+             if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
+                  &&  ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
+             {
+                //CSR
+                if (pMsg->bodyptr)
+                {
+                   status = csrMsgProcessor(hHal, pMsg->bodyptr);
+                   vos_mem_free( pMsg->bodyptr );
+                }
+                else
+                {
+                   smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process\n");
+                }
+             }
+             else
+             {
+                smsLog( pMac, LOGW, "Unknown message type %d, nothing to process\n",
+                        pMsg->type);
+                if (pMsg->bodyptr)
+                {
+                   vos_mem_free( pMsg->bodyptr );
+                }
+             }
+          }//switch
+      } //SME_IS_START
+      else
+      {
+         smsLog( pMac, LOGW, "message type %d in stop state ignored\n", pMsg->type);
+         if (pMsg->bodyptr)
+         {
+            vos_mem_free( pMsg->bodyptr );
+         }
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+   else
+   {
+      smsLog( pMac, LOGW, "Locking failed, bailing out\n");
+      if (pMsg->bodyptr)
+      {
+          vos_mem_free( pMsg->bodyptr );
+      }
+   }
+
+   return status;
+}
+
+
+//No need to hold the global lock here because this function can only be called
+//after sme_Stop.
+v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
+{
+   if( pMsg )
+   {
+      if (pMsg->bodyptr)
+      {
+         vos_mem_free( pMsg->bodyptr );
+      }
+   }
+
+}
+
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_Stop() - Stop all SME modules and put them at idle state
+
+  The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
+  return, all modules are at idle state ready to start.
+
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen
+
+  \return eHAL_STATUS_SUCCESS - SME is stopped.
+
+          Other status means SME is failed to stop but caller should still
+          consider SME is stopped.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   eHalStatus fail_status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+#ifdef WLAN_SOFTAP_FEATURE
+   status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d\n",
+                          status );
+      fail_status = status;
+   }
+#endif
+
+   p2pStop(hHal);
+
+   if(pmcFlag)
+   {
+      status = pmcStop(hHal);
+      if ( ! HAL_STATUS_SUCCESS( status ) ) {
+         smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d\n",
+                 status );
+         fail_status = status;
+      }
+   }
+
+   status = csrStop(pMac);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d\n",
+              status );
+      fail_status = status;
+   }
+
+   ccmStop(hHal);
+
+   purgeSmeCmdList(pMac);
+
+   if (!HAL_STATUS_SUCCESS( fail_status )) {
+      status = fail_status;
+   }
+
+   pMac->sme.state = SME_STATE_STOP;
+
+   return status;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_Close() - Release all SME modules and their resources.
+
+  The function release each module in SME, PMC, CCM, CSR, etc. . Upon
+  return, all modules are at closed state.
+
+  No SME APIs can be involved after smeClose except smeOpen.
+  smeClose must be called before macClose.
+  This is a synchronuous call
+  \param hHal - The handle returned by macOpen
+
+  \return eHAL_STATUS_SUCCESS - SME is successfully close.
+
+          Other status means SME is failed to be closed but caller still cannot
+          call any other SME functions except smeOpen.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_Close(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   eHalStatus fail_status = eHAL_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = csrClose(pMac);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+
+#ifdef WLAN_SOFTAP_FEATURE
+   status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+#endif
+
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+   status = btcClose(hHal);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+
+   status = sme_QosClose(pMac);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+#endif
+
+   status = ccmClose(hHal);
+         if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d\n",
+                 status );
+             fail_status = status;
+         }
+
+   status = pmcClose(hHal);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+#if defined WLAN_FEATURE_VOWIFI
+   status = rrmClose(hHal);
+   if ( ! HAL_STATUS_SUCCESS( status ) ) {
+      smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d\n",
+              status );
+      fail_status = status;
+   }
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+   sme_FTClose(hHal);
+#endif
+#if defined WLAN_FEATURE_P2P
+   sme_p2pClose(hHal);
+#endif
+
+   freeSmeCmdList(pMac);
+
+   if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
+   {
+       fail_status = eHAL_STATUS_FAILURE;
+   }
+
+   if (!HAL_STATUS_SUCCESS( fail_status )) {
+      status = fail_status;
+   }
+
+   pMac->sme.state = SME_STATE_STOP;
+
+   return status;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanRequest
+    \brief a wrapper function to Request a 11d or full scan from CSR.
+    This is an asynchronuous call
+    \param pScanRequestID - pointer to an object to get back the request ID
+    \param callback - a callback function that scan calls upon finish, will not
+                      be called if csrScanRequest returns error
+    \param pContext - a pointer passed in for the callback
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq, 
+                           tANI_U32 *pScanRequestID, 
+                           csrScanCompleteCallback callback, void *pContext)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    smsLog(pMac, LOG2, FL("enter"));
+    do
+    {
+        if(pMac->scan.fScanEnable)
+        {
+            status = sme_AcquireGlobalLock( &pMac->sme );
+            if ( HAL_STATUS_SUCCESS( status ) )
+            {
+                {
+                    status = csrScanRequest( hHal, sessionId, pscanReq,
+                                     pScanRequestID, callback, pContext );
+                }
+                  
+                sme_ReleaseGlobalLock( &pMac->sme );
+            } //sme_AcquireGlobalLock success
+        } //if(pMac->scan.fScanEnable)
+    } while( 0 );
+
+    return (status);
+
+
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetResult
+    \brief a wrapper function to request scan results from CSR.
+    This is a synchronuous call
+    \param pFilter - If pFilter is NULL, all cached results are returned
+    \param phResult - an object for the result.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
+                            tScanResultHandle *phResult)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog(pMac, LOG2, FL("enter"));
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrScanGetResult( hHal, pFilter, phResult );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+   smsLog(pMac, LOG2, FL("exit status %d"), status);
+
+   return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanFlushResult
+    \brief a wrapper function to request CSR to clear scan results.
+    This is a synchronuous call
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrScanFlushResult( hHal );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultGetFirst
+    \brief a wrapper function to request CSR to returns the first element of
+           scan result.
+    This is a synchronuous call
+    \param hScanResult - returned from csrScanGetResult
+    \return tCsrScanResultInfo * - NULL if no result
+  ---------------------------------------------------------------------------*/
+tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
+                                          tScanResultHandle hScanResult)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tCsrScanResultInfo *pRet = NULL;
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       pRet = csrScanResultGetFirst( pMac, hScanResult );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (pRet);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultGetNext
+    \brief a wrapper function to request CSR to returns the next element of
+           scan result. It can be called without calling csrScanResultGetFirst
+           first
+    This is a synchronuous call
+    \param hScanResult - returned from csrScanGetResult
+    \return Null if no result or reach the end
+  ---------------------------------------------------------------------------*/
+tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
+                                          tScanResultHandle hScanResult)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tCsrScanResultInfo *pRet = NULL;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        pRet = csrScanResultGetNext( pMac, hScanResult );
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (pRet);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanSetBGScanparams
+    \brief a wrapper function to request CSR to set BG scan params in PE
+    This is a synchronuous call
+    \param pScanReq - BG scan request structure
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if( NULL != pScanReq )
+    {
+        status = sme_AcquireGlobalLock( &pMac->sme );
+        if ( HAL_STATUS_SUCCESS( status ) )
+        {
+            status = csrScanSetBGScanparams( hHal, pScanReq );
+            sme_ReleaseGlobalLock( &pMac->sme );
+        }
+    }
+
+    return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanResultPurge
+    \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
+           in the list and free memory for each item
+    This is a synchronuous call
+    \param hScanResult - returned from csrScanGetResult. hScanResult is
+                         considered gone by
+    calling this function and even before this function reutrns.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrScanResultPurge( hHal, hScanResult );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetPMKIDCandidateList
+    \brief a wrapper function to return the PMKID candidate list
+    This is a synchronuous call
+    \param pPmkidList - caller allocated buffer point to an array of
+                        tPmkidCandidateInfo
+    \param pNumItems - pointer to a variable that has the number of
+                       tPmkidCandidateInfo allocated when retruning, this is
+                       either the number needed or number of items put into
+                       pPmkidList
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough and pNumItems
+    has the number of tPmkidCandidateInfo.
+    \Note: pNumItems is a number of tPmkidCandidateInfo,
+           not sizeof(tPmkidCandidateInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
+                                        tPmkidCandidateInfo *pPmkidList, 
+                                        tANI_U32 *pNumItems )
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/*----------------------------------------------------------------------------
+  \fn sme_RoamRegisterLinkQualityIndCallback
+
+  \brief
+  a wrapper function to allow HDD to register a callback handler with CSR for
+  link quality indications.
+
+  Only one callback may be registered at any time.
+  In order to deregister the callback, a NULL cback may be provided.
+
+  Registration happens in the task context of the caller.
+
+  \param callback - Call back being registered
+  \param pContext - user data
+
+  DEPENDENCIES: After CSR open
+
+  \return eHalStatus
+-----------------------------------------------------------------------------*/
+eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
+                                                  csrRoamLinkQualityIndCallback   callback,
+                                                  void                           *pContext)
+{
+   return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamRegisterCallback
+    \brief a wrapper function to allow HDD to register a callback with CSR.
+           Unlike scan, roam has one callback for all the roam requests
+    \param callback - a callback function that roam calls upon when state changes
+    \param pContext - a pointer passed in for the callback
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
+                                    csrRoamCompleteCallback callback,
+                                    void *pContext)
+{
+   return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
+}
+
+eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    return pMac->roam.configParam.phyMode;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamConnect
+    \brief a wrapper function to request CSR to inititiate an association
+    This is an asynchronuous call.
+    \param sessionId - the sessionId returned by sme_OpenSession.
+    \param pProfile - description of the network to which to connect
+    \param hBssListIn - a list of BSS descriptor to roam to. It is returned
+                        from csrScanGetResult
+    \param pRoamId - to get back the request ID
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
+                           tANI_U32 *pRoamId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    smsLog(pMac, LOG2, FL("enter"));
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamReassoc
+    \brief a wrapper function to request CSR to inititiate a re-association
+    \param pProfile - can be NULL to join the currently connected AP. In that
+    case modProfileFields should carry the modified field(s) which could trigger
+    reassoc
+    \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
+    that might need modification dynamically once STA is up & running and this
+    could trigger a reassoc
+    \param pRoamId - to get back the request ID
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
+                          tCsrRoamModifyProfileFields modProfileFields,
+                          tANI_U32 *pRoamId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    smsLog(pMac, LOG2, FL("enter"));
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamConnectToLastProfile
+    \brief a wrapper function to request CSR to disconnect and reconnect with
+           the same profile
+    This is an asynchronuous call.
+    \return eHalStatus. It returns fail if currently connected
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamConnectToLastProfile( pMac, sessionId );
+      }
+      else
+      {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDisconnect
+    \brief a wrapper function to request CSR to disconnect from a network
+    This is an asynchronuous call.
+    \param reason -- To indicate the reason for disconnecting. Currently, only
+                     eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog(pMac, LOG2, FL("enter"));
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamDisconnect( pMac, sessionId, reason );
+      }
+      else
+      {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamStopBss
+    \brief To stop BSS for Soft AP. This is an asynchronous API.
+    \param hHal - Global structure
+    \param sessionId - sessionId of SoftAP
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog(pMac, LOG2, FL("enter"));
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_TRUE );
+      }
+      else
+      {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDisconnectSta
+    \brief To disassociate a station. This is an asynchronous API.
+    \param hHal - Global structure
+    \param sessionId - sessionId of SoftAP
+    \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
+                                tANI_U8 *pPeerMacAddr)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if ( NULL == pMac )
+   {
+     VOS_ASSERT(0);
+     return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr, 
+                                                  eSIR_MAC_UNSPEC_FAILURE_REASON);
+      }
+      else
+      {
+         status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamDeauthSta
+    \brief To disassociate a station. This is an asynchronous API.
+    \param hHal - Global structure
+    \param sessionId - sessionId of SoftAP
+    \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
+    \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
+                                tANI_U8 *pPeerMacAddr)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if ( NULL == pMac )
+   {
+     VOS_ASSERT(0);
+     return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr, 
+                     eSIR_MAC_UNSPEC_FAILURE_REASON);
+      }
+      else
+      {
+         status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamTKIPCounterMeasures
+    \brief To start or stop TKIP counter measures. This is an asynchronous API.
+    \param sessionId - sessionId of SoftAP
+    \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
+                                        tANI_BOOLEAN bEnable)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if ( NULL == pMac )
+   {
+     VOS_ASSERT(0);
+     return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetAssociatedStas
+    \brief To probe the list of associated stations from various modules of CORE stack.
+    \This is an asynchronous API.
+    \param sessionId    - sessionId of SoftAP
+    \param modId        - Module from whom list of associtated stations is to be probed.
+                          If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
+    \param pUsrContext  - Opaque HDD context
+    \param pfnSapEventCallback  - Sap event callback in HDD
+    \param pAssocBuf    - Caller allocated memory to be filled with associatd stations info
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
+                                        VOS_MODULE_ID modId, void *pUsrContext,
+                                        void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if ( NULL == pMac )
+   {
+     VOS_ASSERT(0);
+     return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetWpsSessionOverlap
+    \brief To get the WPS PBC session overlap information.
+    \This is an asynchronous API.
+    \param sessionId    - sessionId of SoftAP
+    \param pUsrContext  - Opaque HDD context
+    \param pfnSapEventCallback  - Sap event callback in HDD
+    \pRemoveMac - pointer to Mac address which needs to be removed from session
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
+                                        void *pUsrContext, void 
+                                        *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if ( NULL == pMac )
+   {
+     VOS_ASSERT(0);
+     return status;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+            status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+#endif
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetConnectState
+    \brief a wrapper function to request CSR to return the current connect state
+           of Roaming
+    This is a synchronuous call.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+       {
+          status = csrRoamGetConnectState( pMac, sessionId, pState );
+       }
+       else
+       {
+           status = eHAL_STATUS_INVALID_PARAMETER;
+       }
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetConnectProfile
+    \brief a wrapper function to request CSR to return the current connect
+           profile. Caller must call csrRoamFreeConnectProfile after it is done
+           and before reuse for another csrRoamGetConnectProfile call.
+    This is a synchronuous call.
+    \param pProfile - pointer to a caller allocated structure
+                      tCsrRoamConnectedProfile
+    \return eHalStatus. Failure if not connected
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
+                                     tCsrRoamConnectedProfile *pProfile)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
+      }
+      else
+      {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamFreeConnectProfile
+    \brief a wrapper function to request CSR to free and reinitialize the
+           profile returned previously by csrRoamGetConnectProfile.
+    This is a synchronuous call.
+    \param pProfile - pointer to a caller allocated structure
+                      tCsrRoamConnectedProfile
+    \return eHalStatus.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
+                                      tCsrRoamConnectedProfile *pProfile)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrRoamFreeConnectProfile( pMac, pProfile );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamSetPMKIDCache
+    \brief a wrapper function to request CSR to return the PMKID candidate list
+    This is a synchronuous call.
+    \param pPMKIDCache - caller allocated buffer point to an array of
+                         tPmkidCacheInfo
+    \param numItems - a variable that has the number of tPmkidCacheInfo
+                      allocated when retruning, this is either the number needed
+                      or number of items put into pPMKIDCache
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough and pNumItems has the number of
+                         tPmkidCacheInfo.
+    \Note: pNumItems is a number of tPmkidCacheInfo,
+           not sizeof(tPmkidCacheInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
+                                  tANI_U32 numItems )
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+      {
+         status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
+      }
+      else
+      {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+      }
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetSecurityReqIE
+    \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
+           passes to PE to JOIN request or START_BSS request
+    This is a synchronuous call.
+    \param pLen - caller allocated memory that has the length of pBuf as input.
+                  Upon returned, *pLen has the needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any,
+                  upon return
+    \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
+                                  tANI_U8 *pBuf, eCsrSecurityType secType)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+           status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
+        }
+        else
+        {
+           status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetSecurityRspIE
+    \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
+           the beacon or probe rsp if connected
+    This is a synchronuous call.
+    \param pLen - caller allocated memory that has the length of pBuf as input.
+                  Upon returned, *pLen has the needed or IE length in pBuf.
+    \param pBuf - Caller allocated memory that contain the IE field, if any,
+                  upon return
+    \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
+                                  tANI_U8 *pBuf, eCsrSecurityType secType)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+           status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
+        }
+        else
+        {
+           status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetNumPMKIDCache
+    \brief a wrapper function to request CSR to return number of PMKID cache
+           entries
+    This is a synchronuous call.
+    \return tANI_U32 - the number of PMKID cache entries
+  ---------------------------------------------------------------------------*/
+tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tANI_U32 numPmkidCache = 0;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+        {
+           numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
+           status = eHAL_STATUS_SUCCESS;
+        }
+        else
+        {
+           status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (numPmkidCache);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetPMKIDCache
+    \brief a wrapper function to request CSR to return PMKID cache from CSR
+    This is a synchronuous call.
+    \param pNum - caller allocated memory that has the space of the number of
+                  pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
+                  needed or actually number in tPmkidCacheInfo.
+    \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
+                         any, upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
+                                 tPmkidCacheInfo *pPmkidCache)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+       {
+          status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
+       }
+       else
+       {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+       }
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetConfigParam
+    \brief a wrapper function that HDD calls to get the global settings
+           currently maintained by CSR.
+    This is a synchronuous call.
+    \param pParam - caller allocated memory
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = csrGetConfigParam(pMac, &pParam->csrConfig);
+      if (status != eHAL_STATUS_SUCCESS)
+      {
+         smsLog( pMac, LOGE, "%s csrGetConfigParam failed\n", __FUNCTION__);
+         sme_ReleaseGlobalLock( &pMac->sme );
+         return status;
+      }
+#if defined WLAN_FEATURE_P2P_INTERNAL
+      status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
+      if (status != eHAL_STATUS_SUCCESS)
+      {
+         smsLog( pMac, LOGE, "%s p2pGetConfigParam failed\n", __FUNCTION__);
+         sme_ReleaseGlobalLock( &pMac->sme );
+         return status;
+      }
+#endif
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_CfgSetInt
+    \brief a wrapper function that HDD calls to set parameters in CFG.
+    This is a synchronuous call.
+    \param cfgId - Configuration Parameter ID (type) for STA.
+    \param ccmValue - The information related to Configuration Parameter ID
+                      which needs to be saved in CFG
+    \param callback - To be registered by CSR with CCM. Once the CFG done with
+                      saving the information in the database, it notifies CCM &
+                      then the callback will be invoked to notify.
+    \param toBeSaved - To save the request for future reference
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
+                         tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
+{
+   return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_CfgSetStr
+    \brief a wrapper function that HDD calls to set parameters in CFG.
+    This is a synchronuous call.
+    \param cfgId - Configuration Parameter ID (type) for STA.
+    \param pStr - Pointer to the byte array which carries the information needs
+                  to be saved in CFG
+    \param length - Length of the data to be saved
+    \param callback - To be registered by CSR with CCM. Once the CFG done with
+                      saving the information in the database, it notifies CCM &
+                      then the callback will be invoked to notify.
+    \param toBeSaved - To save the request for future reference
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
+                         tANI_U32 length, tCcmCfgSetCallback callback,
+                         eAniBoolean toBeSaved)
+{
+   return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetModifyProfileFields
+    \brief HDD or SME - QOS calls this function to get the current values of
+    connected profile fields, changing which can cause reassoc.
+    This function must be called after CFG is downloaded and STA is in connected
+    state. Also, make sure to call this function to get the current profile
+    fields before calling the reassoc. So that pModifyProfileFields will have
+    all the latest values plus the one(s) has been updated as part of reassoc
+    request.
+    \param pModifyProfileFields - pointer to the connected profile fields
+    changing which can cause reassoc
+
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
+                                     tCsrRoamModifyProfileFields * pModifyProfileFields)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
+       {
+          status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
+       }
+       else
+       {
+          status = eHAL_STATUS_INVALID_PARAMETER;
+       }
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/*--------------------------------------------------------------------------
+    \fn sme_SetConfigPowerSave
+    \brief  Wrapper fn to change power save configuration in SME (PMC) module.
+            For BMPS related configuration, this function also updates the CFG
+            and sends a message to FW to pick up the new values. Note: Calling
+            this function only updates the configuration and does not enable
+            the specified power save mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - Power Saving mode being modified
+    \param  pConfigParams - a pointer to a caller allocated object of type
+            tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
+    \return eHalStatus
+  --------------------------------------------------------------------------*/
+eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
+                                  void *pConfigParams)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == pConfigParams ) {
+      smsLog( pMac, LOGE, "Empty config param structure for PMC, "
+              "nothing to update");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/*--------------------------------------------------------------------------
+    \fn sme_GetConfigPowerSave
+    \brief  Wrapper fn to retrieve power save configuration in SME (PMC) module
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - Power Saving mode
+    \param  pConfigParams - a pointer to a caller allocated object of type
+            tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
+    \return eHalStatus
+  --------------------------------------------------------------------------*/
+eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
+                                  void *pConfigParams)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if (NULL == pConfigParams ) {
+      smsLog( pMac, LOGE, "Empty config param structure for PMC, "
+              "nothing to update");
+      return eHAL_STATUS_FAILURE;
+   }
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SignalPowerEvent
+    \brief  Signals to PMC that a power event has occurred. Used for putting
+            the chip into deep sleep mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  event - the event that has occurred
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcSignalPowerEvent(hHal, event);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_EnablePowerSave
+    \brief  Enables one of the power saving modes.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - The power saving mode to enable. If BMPS mode is enabled
+                     while the chip is operating in Full Power, PMC will start
+                     a timer that will try to put the chip in BMPS mode after
+                     expiry.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status =  pmcEnablePowerSave(hHal, psMode);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DisablePowerSave
+    \brief   Disables one of the power saving modes.
+    \param  hHal - The handle returned by macOpen.
+    \param  psMode - The power saving mode to disable. Disabling does not imply
+                     that device will be brought out of the current PS mode. This
+                     is purely a configuration API.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcDisablePowerSave(hHal, psMode);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+ }
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StartAutoBmpsTimer
+    \brief  Starts a timer that periodically polls all the registered
+            module for entry into Bmps mode. This timer is started only if BMPS is
+            enabled and whenever the device is in full power.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcStartAutoBmpsTimer(hHal);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+/* ---------------------------------------------------------------------------
+    \fn sme_StopAutoBmpsTimer
+    \brief  Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
+            Stopping the timer does not cause a device state change. Only the timer
+            is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcStopAutoBmpsTimer(hHal);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+/* ---------------------------------------------------------------------------
+    \fn sme_QueryPowerState
+    \brief  Returns the current power state of the device.
+    \param  hHal - The handle returned by macOpen.
+    \param pPowerState - pointer to location to return power state (LOW or HIGH)
+    \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_QueryPowerState (
+   tHalHandle hHal,
+   tPmcPowerState *pPowerState,
+   tPmcSwitchState *pSwWlanSwitchState)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_IsPowerSaveEnabled
+    \brief  Checks if the device is able to enter a particular power save mode
+            This does not imply that the device is in a particular PS mode
+    \param  hHal - The handle returned by macOpen.
+    \param psMode - the power saving mode
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tANI_BOOLEAN result = false;
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       result = pmcIsPowerSaveEnabled(hHal, psMode);
+       sme_ReleaseGlobalLock( &pMac->sme );
+       return result;
+   }
+
+   return false;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestFullPower
+    \brief  Request that the device be brought to full power state. When the
+            device enters Full Power PMC will start a BMPS timer if BMPS PS mode
+            is enabled. On timer expiry PMC will attempt to put the device in
+            BMPS mode if following holds true:
+            - BMPS mode is enabled
+            - Polling of all modules through the Power Save Check routine passes
+            - STA is associated to an access point
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \return eHalStatus - status
+     eHAL_STATUS_SUCCESS - device brought to full power state
+     eHAL_STATUS_FAILURE - device cannot be brought to full power state
+     eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RequestFullPower (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext,
+   tRequestFullPowerReason fullPowerReason)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestBmps
+    \brief  Request that the device be put in BMPS state. Request will be
+            accepted only if BMPS mode is enabled and power save check routine
+            passes.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \return eHalStatus
+      eHAL_STATUS_SUCCESS - device is in BMPS state
+      eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
+      eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RequestBmps (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn  sme_SetDHCPTillPowerActiveFlag
+    \brief  Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS 
+            entry by PMC 
+    \param  hHal - The handle returned by macOpen.
+  ---------------------------------------------------------------------------*/
+void  sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
+   pMac->pmc.remainInPowerActiveTillDHCP = flag;
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StartUapsd
+    \brief  Request that the device be put in UAPSD state. If the device is in
+            Full Power it will be put in BMPS mode first and then into UAPSD
+            mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+      eHAL_STATUS_SUCCESS - device is in UAPSD state
+      eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
+      eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
+      eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_StartUapsd (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+ }
+
+/* ---------------------------------------------------------------------------
+    \fn sme_StopUapsd
+    \brief  Request that the device be put out of UAPSD state. Device will be
+            put in in BMPS state after stop UAPSD completes.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+      eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
+      eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_StopUapsd (tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcStopUapsd(hHal);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RequestStandby
+    \brief  Request that the device be put in standby. It is HDD's responsibility
+            to bring the chip to full power and do a disassoc before calling
+            this API.
+    \param  hHal - The handle returned by macOpen.
+    \param  - callbackRoutine Callback routine invoked in case of success/failure
+    \return eHalStatus
+      eHAL_STATUS_SUCCESS - device is in Standby mode
+      eHAL_STATUS_FAILURE - device cannot be put in standby mode
+      eHAL_STATUS_PMC_PENDING - device is being put in standby mode
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RequestStandby (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, eHalStatus status),
+   void *callbackContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   smsLog( pMac, LOG1, FL("") );
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RegisterPowerSaveCheck
+    \brief  Register a power save check routine that is called whenever
+            the device is about to enter one of the power save modes.
+    \param  hHal - The handle returned by macOpen.
+    \param  checkRoutine -  Power save check routine to be registered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully registered
+            eHAL_STATUS_FAILURE - not successfully registered
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RegisterPowerSaveCheck (
+   tHalHandle hHal,
+   tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DeregisterPowerSaveCheck
+    \brief  Deregister a power save check routine
+    \param  hHal - The handle returned by macOpen.
+    \param  checkRoutine -  Power save check routine to be deregistered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully deregistered
+            eHAL_STATUS_FAILURE - not successfully deregistered
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_DeregisterPowerSaveCheck (
+   tHalHandle hHal,
+   tANI_BOOLEAN (*checkRoutine) (void *checkContext))
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RegisterDeviceStateUpdateInd
+    \brief  Register a callback routine that is called whenever
+            the device enters a new device state (Full Power, BMPS, UAPSD)
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be registered
+    \param  callbackContext -  Cookie to be passed back during callback
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully registered
+            eHAL_STATUS_FAILURE - not successfully registered
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RegisterDeviceStateUpdateInd (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
+   void *callbackContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_DeregisterDeviceStateUpdateInd
+    \brief  Deregister a routine that was registered for device state changes
+    \param  hHal - The handle returned by macOpen.
+    \param  callbackRoutine -  Callback routine to be deregistered
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS - successfully deregistered
+            eHAL_STATUS_FAILURE - not successfully deregistered
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_DeregisterDeviceStateUpdateInd (
+   tHalHandle hHal,
+   void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_WowlAddBcastPattern
+    \brief  Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
+            do a pattern match on these patterns when Wowl is enabled during BMPS
+            mode. Note that Firmware performs the pattern matching only on
+            broadcast frames and while Libra is in BMPS mode.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pattern to be added
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot add pattern
+            eHAL_STATUS_SUCCESS  Request accepted.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_WowlAddBcastPattern (
+   tHalHandle hHal,
+   tpSirWowlAddBcastPtrn pattern)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       status = pmcWowlAddBcastPattern (hHal, pattern);
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_WowlDelBcastPattern
+    \brief  Delete a pattern that was added for Pattern Byte Matching.
+    \param  hHal - The handle returned by macOpen.
+    \param  pattern -  Pattern to be deleted
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Cannot delete pattern
+            eHAL_STATUS_SUCCESS  Request accepted.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_WowlDelBcastPattern (
+   tHalHandle hHal,
+   tpSirWowlDelBcastPtrn pattern)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       status = pmcWowlDelBcastPattern (hHal, pattern);
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_EnterWowl
+    \brief  This is the SME API exposed to HDD to request enabling of WOWL mode.
+            WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
+            SME will will cache the information that WOWL has been enabled and
+            attempt to put the device in BMPS. On entry into BMPS, SME will
+            enable the WOWL mode.
+            Note 1: If we exit BMPS mode (someone requests full power), we
+            will NOT resume WOWL when we go back to BMPS again. Request for full
+            power (while in WOWL mode) means disable WOWL and go to full power.
+            Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
+            will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
+            are required. Currently there is no requirement or use case to support
+            UAPSD and WOWL at the same time.
+
+    \param  hHal - The handle returned by macOpen.
+    \param  enterWowlCallbackRoutine -  Callback routine provided by HDD.
+                               Used for success/failure notification by SME
+    \param  enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
+                              at the time of callback.
+    \param  wakeReasonIndCB -  Callback routine provided by HDD.
+                               Used for Wake Reason Indication by SME
+    \param  wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
+                              at the time of callback.
+    \return eHalStatus
+            eHAL_STATUS_SUCCESS  Device is already in WoWLAN mode
+            eHAL_STATUS_FAILURE  Device cannot enter WoWLAN mode.
+            eHAL_STATUS_PMC_PENDING  Request accepted. SME will enable WOWL after
+                                      BMPS mode is entered.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_EnterWowl (
+    tHalHandle hHal,
+    void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
+    void *enterWowlCallbackContext,
+#ifdef WLAN_WAKEUP_EVENTS
+    void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
+    void *wakeIndicationCBContext,
+#endif // WLAN_WAKEUP_EVENTS
+    tpSirSmeWowlEnterParams wowlEnterParams)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext, 
+#ifdef WLAN_WAKEUP_EVENTS
+                              wakeIndicationCB, wakeIndicationCBContext, 
+#endif // WLAN_WAKEUP_EVENTS
+                              wowlEnterParams);
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+/* ---------------------------------------------------------------------------
+    \fn sme_ExitWowl
+    \brief  This is the SME API exposed to HDD to request exit from WoWLAN mode.
+            SME will initiate exit from WoWLAN mode and device will be put in BMPS
+            mode.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+            eHAL_STATUS_FAILURE  Device cannot exit WoWLAN mode.
+            eHAL_STATUS_SUCCESS  Request accepted to exit WoWLAN mode.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ExitWowl (tHalHandle hHal)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       status = pmcExitWowl (hHal);
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamSetKey
+
+    \brief To set encryption key. This function should be called only when connected
+    This is an asynchronous API.
+
+    \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
+
+    \param pRoamId  Upon success return, this is the id caller can use to identify the request in roamcallback
+
+    \return eHalStatus  SUCCESS  Roam callback will be called indicate actually results
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tANI_U32 roamId;
+#ifdef WLAN_SOFTAP_FEATURE
+   tANI_U32 i;
+   tCsrRoamSession *pSession = NULL;
+#endif
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+      if(pRoamId)
+      {
+         *pRoamId = roamId;
+      }
+
+#ifdef WLAN_SOFTAP_FEATURE
+      smsLog(pMac, LOG2, FL("keyLength\n"), pSetKey->keyLength);
+
+      for(i=0; i<pSetKey->keyLength; i++)
+          smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]); 
+
+      smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d\n", sessionId, roamId);       
+
+      pSession = CSR_GET_SESSION(pMac, sessionId);
+
+      if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
+      {
+         if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
+         {
+            if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
+                 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
+            {
+               pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
+            }
+            if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
+                 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
+            {
+               pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
+            }
+         }
+      }
+#endif
+
+      status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamRemoveKey
+
+    \brief To set encryption key. This is an asynchronous API.
+
+    \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
+
+    \param pRoamId  Upon success return, this is the id caller can use to identify the request in roamcallback
+
+    \return eHalStatus  SUCCESS  Roam callback will be called indicate actually results
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
+                             tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tANI_U32 roamId;
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      roamId = GET_NEXT_ROAM_ID(&pMac->roam);
+      if(pRoamId)
+      {
+         *pRoamId = roamId;
+      }
+      status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetRssi
+    \brief a wrapper function that client calls to register a callback to get RSSI
+
+    \param callback - SME sends back the requested stats using the callback
+    \param staId - The station ID for which the stats is requested for
+    \param pContext - user context to be passed back along with the callback
+    \param pVosContext - vos context
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetRssi(tHalHandle hHal,
+                             tCsrRssiCallback callback,
+                             tANI_U8 staId, tCsrBssid bssId, 
+                             void *pContext, void* pVosContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = csrGetRssi( pMac, callback,
+                                 staId, bssId, pContext, pVosContext);
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetStatistics
+    \brief a wrapper function that client calls to register a callback to get
+    different PHY level statistics from CSR.
+
+    \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
+    \param statsMask - The different category/categories of stats requester is looking for
+    \param callback - SME sends back the requested stats using the callback
+    \param periodicity - If requester needs periodic update in millisec, 0 means
+                         it's an one time request
+    \param cache - If requester is happy with cached stats
+    \param staId - The station ID for which the stats is requested for
+    \param pContext - user context to be passed back along with the callback
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
+                             tANI_U32 statsMask,
+                             tCsrStatsCallback callback,
+                             tANI_U32 periodicity, tANI_BOOLEAN cache,
+                             tANI_U8 staId, void *pContext)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = csrGetStatistics( pMac, requesterId , statsMask, callback,
+                                 periodicity, cache, staId, pContext);
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetCountryCode
+
+    \brief To return the current country code. If no country code is applied, default country code is
+    used to fill the buffer.
+    If 11d supported is turned off, an error is return and the last applied/default country code is used.
+    This is a synchronous API.
+
+    \param pBuf - pointer to a caller allocated buffer for returned country code.
+
+    \param pbLen  For input, this parameter indicates how big is the buffer.
+                   Upon return, this parameter has the number of bytes for country. If pBuf
+                   doesn't have enough space, this function returns
+                   fail status and this parameter contains the number that is needed.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetCountryCode
+
+    \brief To change the current/default country code.
+    If 11d supported is turned off, an error is return.
+    This is a synchronous API.
+
+    \param pCountry - pointer to a caller allocated buffer for the country code.
+
+    \param pfRestartNeeded  A pointer to caller allocated memory, upon successful return, it indicates
+    whether a reset is required.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ResetCountryCodeInformation
+    \brief this function is to reset the country code current being used back to EEPROM default
+    this includes channel list and power setting. This is a synchronous API.
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
+    a restart is needed to apply the change
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetSupportedCountryCode
+    \brief this function is to get a list of the country code current being supported
+    \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
+    this has the country code list. 3 bytes for each country code. This may be NULL if
+    caller wants to know the needed byte count.
+    \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
+    this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetCurrentRegulatoryDomain
+    \brief this function is to get the current regulatory domain. This is a synchronous API.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    SME. The function fails if 11d support is turned off.
+    \param pDomain - Caller allocated buffer to return the current domain.
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    if( pDomain )
+    {
+        if( csrIs11dSupported( pMac ) )
+        {
+            *pDomain = csrGetCurrentRegulatoryDomain( pMac );
+            status = eHAL_STATUS_SUCCESS;
+        }
+        else
+        {
+            status = eHAL_STATUS_FAILURE;
+        }
+    }
+
+    return ( status );
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetRegulatoryDomain
+    \brief this function is to set the current regulatory domain.
+    This function must be called after CFG is downloaded and all the band/mode setting already passed into
+    SME. This is a synchronous API.
+    \param domainId - indicate the domain (defined in the driver) needs to set to.
+    See v_REGDOMAIN_t for definition
+    \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
+    a restart is needed to apply the change
+    \return eHalStatus
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
+}
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetRegulatoryDomainForCountry
+
+    \brief To return a regulatory domain base on a country code. This is a synchronous API.
+
+    \param pCountry - pointer to a caller allocated buffer for input country code.
+
+    \param pDomainId  Upon successful return, it is the domain that country belongs to.
+    If it is NULL, returning success means that the country code is known.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
+}
+
+
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetSupportedRegulatoryDomains
+
+    \brief To return a list of supported regulatory domains. This is a synchronous API.
+
+    \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
+
+    \param pNumDomains  For input, this parameter indicates howm many domains pDomains can hold.
+                         Upon return, this parameter has the number for supported domains. If pDomains
+                         doesn't have enough space for all the supported domains, this function returns
+                         fail status and this parameter contains the number that is needed.
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
+{
+    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
+    //We support all domains for now
+    if( pNumDomains )
+    {
+        if( NUM_REG_DOMAINS <= *pNumDomains )
+        {
+            status = eHAL_STATUS_SUCCESS;
+        }
+        *pNumDomains = NUM_REG_DOMAINS;
+    }
+    if( HAL_STATUS_SUCCESS( status ) )
+    {
+        if( pDomains )
+        {
+            pDomains[0] = REGDOMAIN_FCC;
+            pDomains[1] = REGDOMAIN_ETSI;
+            pDomains[2] = REGDOMAIN_JAPAN;
+            pDomains[3] = REGDOMAIN_WORLD;
+            pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
+            pDomains[5] = REGDOMAIN_APAC;
+            pDomains[6] = REGDOMAIN_KOREA;
+            pDomains[7] = REGDOMAIN_HI_5GHZ;
+            pDomains[8] = REGDOMAIN_NO_5GHZ;
+        }
+        else
+        {
+            status = eHAL_STATUS_INVALID_PARAMETER;
+        }
+    }
+
+    return ( status );
+}
+
+
+//some support functions
+tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrIs11dSupported( pMac ) );
+}
+
+
+tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrIs11hSupported( pMac ) );
+}
+
+
+tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    return ( csrIsWmmSupported( pMac ) );
+}
+
+//Upper layer to get the list of the base channels to scan for passively 11d info from csr
+eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   return(csrScanGetBaseChannels(pMac,pChannelInfo) );
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_ChangeCountryCode
+
+    \brief Change Country code from upperlayer during WLAN driver operation.
+           This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+
+    \param pCountry New Country Code String
+
+    \return eHalStatus  SUCCESS.
+
+                         FAILURE or RESOURCES  The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
+                                          tSmeChangeCountryCallback callback,
+                                          tANI_U8 *pCountry,
+                                          void *pContext,
+                                          void* pVosContext )
+{
+   eHalStatus                status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal            pMac = PMAC_STRUCT( hHal );
+   vos_msg_t                 msg;
+   tAniChangeCountryCodeReq *pMsg;
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      smsLog(pMac, LOG1, FL(" called\n"));      
+      status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
+      if ( !HAL_STATUS_SUCCESS(status) ) 
+      {
+         smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req \n");
+         return status;
+      }
+
+      pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
+      pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
+      palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
+      pMsg->changeCCCallback = callback;
+      pMsg->pDevContext = pContext;
+      pMsg->pVosContext = pVosContext;
+
+      msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
+      msg.bodyptr = pMsg;
+      msg.reserved = 0;
+
+      if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
+      {
+          smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self \n");   
+          palFreeMemory(pMac->hHdd, (void *)pMsg);
+          status = eHAL_STATUS_FAILURE;
+      }
+      smsLog(pMac, LOG1, FL(" returned\n"));      
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcSignalBtEvent
+    \brief  API to signal Bluetooth (BT) event to the WLAN driver. Based on the
+            BT event type and the current operating mode of Libra (full power,
+            BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
+            would be employed.
+    \param  hHal - The handle returned by macOpen.
+    \param  pBtEvent -  Pointer to a caller allocated object of type tSmeBtEvent
+                        Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  BT Event not passed to HAL. This can happen
+                                   if BTC execution mode is set to BTC_WLAN_ONLY
+                                   or BTC_PTA_ONLY.
+            VOS_STATUS_SUCCESS    BT Event passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
+{
+    VOS_STATUS status = VOS_STATUS_E_FAILURE;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        status = btcSignalBTEvent (hHal, pBtEvent);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+#endif
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcSetConfig
+    \brief  API to change the current Bluetooth Coexistence (BTC) configuration
+            This function should be invoked only after CFG download has completed.
+            Calling it after sme_HDDReadyInd is recommended.
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
+                            Caller owns the memory and is responsible for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE  Config not passed to HAL.
+            VOS_STATUS_SUCCESS  Config passed to HAL
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
+{
+    VOS_STATUS status = VOS_STATUS_E_FAILURE;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        status = btcSetConfig (hHal, pSmeBtcConfig);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+#endif
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_BtcGetConfig
+    \brief  API to retrieve the current Bluetooth Coexistence (BTC) configuration
+    \param  hHal - The handle returned by macOpen.
+    \param  pSmeBtcConfig - Pointer to a caller allocated object of type
+                            tSmeBtcConfig. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
+{
+    VOS_STATUS status = VOS_STATUS_E_FAILURE;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        status = btcGetConfig (hHal, pSmeBtcConfig);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+#endif
+    return (status);
+}
+/* ---------------------------------------------------------------------------
+    \fn sme_SetCfgPrivacy
+    \brief  API to set configure privacy parameters
+    \param  hHal - The handle returned by macOpen.
+    \param  pProfile - Pointer CSR Roam profile.
+    \param  fPrivacy - This parameter indicates status of privacy 
+
+    \return void
+  ---------------------------------------------------------------------------*/
+void sme_SetCfgPrivacy( tHalHandle hHal,
+                        tCsrRoamProfile *pProfile,
+                        tANI_BOOLEAN fPrivacy
+                        )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+}
+
+#if defined WLAN_FEATURE_VOWIFI
+/* ---------------------------------------------------------------------------
+    \fn sme_NeighborReportRequest
+    \brief  API to request neighbor report.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRrmNeighborReq - Pointer to a caller allocated object of type
+                            tRrmNeighborReq. Caller owns the memory and is responsible
+                            for freeing it.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
+                                    tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
+{
+    VOS_STATUS status = VOS_STATUS_E_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+#endif
+
+//The following are debug APIs to support direct read/write register/memory
+//They are placed in SME because HW cannot be access when in LOW_POWER state
+//AND not connected. The knowledge and synchronization is done in SME
+
+//sme_DbgReadRegister
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
+{
+   VOS_STATUS   status = VOS_STATUS_E_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+   tHddHandle     hHdd = pMac->hHdd;
+#endif
+   tPmcPowerState PowerState;
+   tANI_U32  sessionId = 0;
+
+   /* 1) To make Quarky work in FTM mode **************************************/
+
+   if(eDRIVER_TYPE_MFG == pMac->gDriverType)
+   {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+      if (HAL_STATUS_SUCCESS(palReadRegister(hHdd, regAddr, pRegValue)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+      if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
+#endif
+      {
+         return VOS_STATUS_SUCCESS;
+      }
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* 2) NON FTM mode driver *************************************************/
+
+   /* Acquire SME global lock */
+   if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
+   {
+      /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
+      if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
+      {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+         if (HAL_STATUS_SUCCESS(palReadRegister(hHdd, regAddr, pRegValue )))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+         if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
+#endif
+         {
+            status = VOS_STATUS_SUCCESS;
+         }
+         else
+         {  
+            status = VOS_STATUS_E_FAILURE;
+         }
+      }
+      else
+      {
+         status = VOS_STATUS_E_FAILURE;
+      }
+   }
+
+   /* This is a hack for Qualky/pttWniSocket
+      Current implementation doesn't allow pttWniSocket to inform Qualky an error */
+   if ( VOS_STATUS_SUCCESS != status )
+   {
+      *pRegValue = 0xDEADBEEF;
+       status = VOS_STATUS_SUCCESS;
+   }
+        
+   /* Release SME global lock */
+   sme_ReleaseGlobalLock(&pMac->sme);
+    
+   return (status);
+}
+
+
+//sme_DbgWriteRegister
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
+{
+   VOS_STATUS    status = VOS_STATUS_E_FAILURE;
+   tpAniSirGlobal  pMac = PMAC_STRUCT(hHal);
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+   tHddHandle      hHdd = pMac->hHdd;
+#endif
+   tPmcPowerState PowerState;
+   tANI_U32   sessionId = 0;
+
+   /* 1) To make Quarky work in FTM mode **************************************/
+
+   if(eDRIVER_TYPE_MFG == pMac->gDriverType)
+   {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+      if (HAL_STATUS_SUCCESS(palWriteRegister(hHdd, regAddr, regValue)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+      if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
+#endif
+      {
+         return VOS_STATUS_SUCCESS;
+      }
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* 2) NON FTM mode driver *************************************************/
+
+   /* Acquire SME global lock */
+   if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
+   {
+      /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
+      if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
+      {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+         if (HAL_STATUS_SUCCESS(palWriteRegister(hHdd, regAddr, regValue)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+         if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
+#endif
+         {
+            status = VOS_STATUS_SUCCESS;
+         }
+         else
+         {
+            status = VOS_STATUS_E_FAILURE;
+         }
+      }
+      else
+      {
+         status = VOS_STATUS_E_FAILURE;
+      }
+   }
+        
+   /* Release SME global lock */
+   sme_ReleaseGlobalLock(&pMac->sme);
+    
+   return (status);
+}
+
+
+
+//sme_DbgReadMemory
+//Caller needs to validate the input values
+//pBuf caller allocated buffer has the length of nLen
+VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
+{
+   VOS_STATUS  status  = VOS_STATUS_E_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+   v_PVOID_t  pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *)hHal);
+   tHddHandle     hHdd = pMac->hHdd;
+#endif
+   tPmcPowerState PowerState;
+   tANI_U32 sessionId  = 0;
+
+   /* 1) To make Quarky work in FTM mode **************************************/
+
+   if(eDRIVER_TYPE_MFG == pMac->gDriverType)
+   {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+      if (HAL_STATUS_SUCCESS(palReadDeviceMemory(hHdd, memAddr, (void *)pBuf, nLen)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+      if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadMemory(memAddr, (void *)pBuf, nLen))
+#endif
+      {
+         return VOS_STATUS_SUCCESS;
+      }
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* 2) NON FTM mode driver *************************************************/
+
+   /* Acquire SME global lock */
+   if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
+   {
+      /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
+      if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
+      {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+         if (HAL_STATUS_SUCCESS(palReadDeviceMemory(pvosGCTx, memAddr, (void *)pBuf, nLen)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+         if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadMemory(memAddr, (void *)pBuf, nLen)) 
+#endif
+         {
+            status = VOS_STATUS_SUCCESS;
+         }
+         else
+         {
+            status = VOS_STATUS_E_FAILURE;
+         }
+      }
+      else
+      {
+         status = VOS_STATUS_E_FAILURE;
+      }
+   }
+
+   /* This is a hack for Qualky/pttWniSocket
+      Current implementation doesn't allow pttWniSocket to inform Qualky an error */
+   if (VOS_STATUS_SUCCESS != status)
+   {
+      vos_mem_set(pBuf, nLen, 0xCD);
+      status = VOS_STATUS_SUCCESS;
+      smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware\n"));
+   }
+
+   /* Release SME lock */
+   sme_ReleaseGlobalLock(&pMac->sme);
+    
+   return (status);
+}
+
+
+//sme_DbgWriteMemory
+//Caller needs to validate the input values
+VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
+{
+   VOS_STATUS    status = VOS_STATUS_E_FAILURE;
+   tpAniSirGlobal  pMac = PMAC_STRUCT(hHal);
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+   tHddHandle      hHdd = pMac->hHdd;
+#endif
+   tPmcPowerState PowerState;
+   tANI_U32   sessionId = 0;
+
+   /* 1) To make Quarky work in FTM mode **************************************/
+
+   if(eDRIVER_TYPE_MFG == pMac->gDriverType)
+   {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+      if (HAL_STATUS_SUCCESS(palWriteDeviceMemory(hHdd, memAddr, (void *)pBuf, nLen)))
+#elif defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+      if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory( memAddr, (void *)pBuf, nLen))
+#endif
+      {
+         return VOS_STATUS_SUCCESS;
+      }
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* 2) NON FTM mode driver *************************************************/
+
+   /* Acquire SME global lock */
+   if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
+   {
+      /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
+      if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
+      {
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+         if (HAL_STATUS_SUCCESS(palWriteDeviceMemory(hHdd, memAddr, (void *)pBuf, nLen)))
+#elif defined(FEATURE_WLAN_INTEGRATED_SOC)
+         if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
+#endif
+         {
+            status = VOS_STATUS_SUCCESS;
+         }
+         else
+         {
+            status = VOS_STATUS_E_FAILURE;
+         }
+      }
+      else
+      {
+         status = VOS_STATUS_E_FAILURE;
+      }
+   }
+
+   /* Release Global lock */
+   sme_ReleaseGlobalLock(&pMac->sme);
+    
+   return (status);
+}
+
+
+void smsLog(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_SMS_MODULE_ID )] )
+        return;
+    else
+    {
+        va_list marker;
+
+        va_start( marker, pString );     /* Initialize variable arguments. */
+
+        logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
+
+        va_end( marker );              /* Reset variable arguments.      */
+    }
+#endif
+}
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC  
+/* ---------------------------------------------------------------------------
+    \fn sme_GetFwVersion
+    \brief  This API returns the firmware version.
+    \param  hHal - The handle returned by macOpen.
+    \param  version - Points to the FwVersionInfo structure.
+    \return VOS_STATUS
+            VOS_STATUS_E_INVAL - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_GetFwVersion (tHalHandle hHal,FwVersionInfo *pVersion)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        if( pVersion != NULL ) {
+            vos_mem_copy((v_VOID_t*)pVersion,(v_VOID_t*)&pMac->hal.FwParam.fwVersion, sizeof(FwVersionInfo));
+        }
+        else {
+            status = VOS_STATUS_E_INVAL;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/* ---------------------------------------------------------------------------
+    \fn sme_GetWcnssWlanCompiledVersion
+    \brief  This API returns the version of the WCNSS WLAN API with
+            which the HOST driver was built
+    \param  hHal - The handle returned by macOpen.
+    \param  pVersion - Points to the Version structure to be filled
+    \return VOS_STATUS
+            VOS_STATUS_E_INVAL - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
+                                           tSirVersionType *pVersion)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        if( pVersion != NULL )
+        {
+            status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
+        }
+        else
+        {
+            status = VOS_STATUS_E_INVAL;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetWcnssWlanReportedVersion
+    \brief  This API returns the version of the WCNSS WLAN API with
+            which the WCNSS driver reports it was built
+    \param  hHal - The handle returned by macOpen.
+    \param  pVersion - Points to the Version structure to be filled
+    \return VOS_STATUS
+            VOS_STATUS_E_INVAL - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
+                                           tSirVersionType *pVersion)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        if( pVersion != NULL )
+        {
+            status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
+        }
+        else
+        {
+            status = VOS_STATUS_E_INVAL;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetWcnssSoftwareVersion
+    \brief  This API returns the version string of the WCNSS driver
+    \param  hHal - The handle returned by macOpen.
+    \param  pVersion - Points to the Version string buffer to be filled
+    \param  versionBufferSize - THe size of the Version string buffer
+    \return VOS_STATUS
+            VOS_STATUS_E_INVAL - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        if( pVersion != NULL )
+        {
+            status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
+                                                 versionBufferSize);
+        }
+        else
+        {
+            status = VOS_STATUS_E_INVAL;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetWcnssHardwareVersion
+    \brief  This API returns the version string of the WCNSS hardware
+    \param  hHal - The handle returned by macOpen.
+    \param  pVersion - Points to the Version string buffer to be filled
+    \param  versionBufferSize - THe size of the Version string buffer
+    \return VOS_STATUS
+            VOS_STATUS_E_INVAL - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        if( pVersion != NULL )
+        {
+            status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
+                                                 versionBufferSize);
+        }
+        else
+        {
+            status = VOS_STATUS_E_INVAL;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+#endif
+
+#ifdef FEATURE_WLAN_WAPI
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamSetBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
+    candidate list.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
+    it is opened (by calling halOpen).
+    \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
+    \param numItems - a variable that has the number of tBkidCacheInfo allocated
+    when retruning, this is the number of items put into pBKIDCache
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+    big enough and pNumItems has the number of tBkidCacheInfo.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
+                                 tANI_U32 numItems )
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to request SME to return its
+    BKID cache.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
+    it is opened (by calling halOpen).
+    \param pNum - caller allocated memory that has the space of the number of
+    tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
+    in SME cache.
+    \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
+    upon return
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+    big enough.
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
+                                tBkidCacheInfo *pBkidCache)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded\n"));
+       status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RoamGetNumBKIDCache
+    \brief The SME API exposed to HDD to allow HDD to request SME to return the
+    number of BKID cache entries.
+    \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
+    it is opened (by calling halOpen).
+    \return tANI_U32 - the number of BKID cache entries.
+  ---------------------------------------------------------------------------*/
+tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tANI_U32 numBkidCache = 0;
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (numBkidCache);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ScanGetBKIDCandidateList
+    \brief a wrapper function to return the BKID candidate list
+    \param pBkidList - caller allocated buffer point to an array of
+                        tBkidCandidateInfo
+    \param pNumItems - pointer to a variable that has the number of
+                       tBkidCandidateInfo allocated when retruning, this is
+                       either the number needed or number of items put into
+                       pPmkidList
+    \return eHalStatus - when fail, it usually means the buffer allocated is not
+                         big enough and pNumItems
+    has the number of tBkidCandidateInfo.
+    \Note: pNumItems is a number of tBkidCandidateInfo,
+           not sizeof(tBkidCandidateInfo) * something
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
+                                        tBkidCandidateInfo *pBkidList,
+                                        tANI_U32 *pNumItems )
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+#endif /* FEATURE_WLAN_WAPI */
+
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_OpenSession() - Open a session for scan/roam operation.
+
+  This is a synchronous API.
+
+
+  \param hHal - The handle returned by macOpen.
+  \param callback - A pointer to the function caller specifies for roam/connect status indication
+  \param pContext - The context passed with callback
+  \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
+  \param pbSessionId - pointer to a caller allocated buffer for returned session ID
+
+  \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
+
+          Other status means SME is failed to open the session.
+          eHAL_STATUS_RESOURCES - no more session available.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
+                           tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
+{
+   eHalStatus status;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   if( NULL == pbSessionId )
+   {
+      status = eHAL_STATUS_INVALID_PARAMETER;
+   }
+   else
+   {
+      status = sme_AcquireGlobalLock( &pMac->sme );
+      if ( HAL_STATUS_SUCCESS( status ) )
+      {
+         status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
+
+         sme_ReleaseGlobalLock( &pMac->sme );
+      }
+   }
+
+   return ( status );
+}
+
+
+/*--------------------------------------------------------------------------
+
+  \brief sme_CloseSession() - Open a session for scan/roam operation.
+
+  This is a synchronous API.
+
+
+  \param hHal - The handle returned by macOpen.
+
+  \param sessionId - A previous opened session's ID.
+
+  \return eHAL_STATUS_SUCCESS - session is closed.
+
+          Other status means SME is failed to open the session.
+          eHAL_STATUS_INVALID_PARAMETER - session is not opened.
+  \sa
+
+  --------------------------------------------------------------------------*/
+eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
+                          csrRoamSessionCloseCallback callback, void *pContext)
+{
+   eHalStatus status;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = csrRoamCloseSession( pMac, sessionId, FALSE, 
+                                    callback, pContext );
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return ( status );
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamUpdateAPWPSIE
+
+    \brief To update AP's WPS IE. This function should be called after SME AP session is created
+    This is an asynchronous API.
+
+    \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
+
+    \return eHalStatus – SUCCESS –
+
+                         FAILURE or RESOURCES – The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
+{
+
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RoamUpdateAPWPARSNIEs
+
+    \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
+    This is an asynchronous API.
+
+    \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
+
+    \return eHalStatus – SUCCESS –
+
+                         FAILURE or RESOURCES – The API finished and failed.
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
+{
+
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+#endif
+
+
+/*-------------------------------------------------------------------------------*
+
+  \fn sme_sendBTAmpEvent
+
+  \brief to receive the coex priorty request from BT-AMP PAL
+  and send the BT_AMP link state to HAL
+
+  \param btAmpEvent - btAmpEvent
+
+  \return eHalStatus: SUCESS : BTAmp event successfully sent to HAL
+
+                      FAILURE: API failed
+
+-------------------------------------------------------------------------------*/
+
+eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
+{
+  vos_msg_t msg;
+  tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
+  eHalStatus status = eHAL_STATUS_FAILURE;
+
+  ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
+  if (NULL == ptrSmeBtAmpEvent)
+     {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+           "Not able to allocate memory for BTAmp event", __FUNCTION__);
+        return status;
+   }
+
+  vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
+  msg.type = WDA_SIGNAL_BTAMP_EVENT;
+  msg.reserved = 0;
+  msg.bodyptr = ptrSmeBtAmpEvent;
+
+  //status = halFW_SendBTAmpEventMesg(pMac, event);
+
+  if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+  {
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+           "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __FUNCTION__);
+    vos_mem_free(ptrSmeBtAmpEvent);
+    return status;
+  }
+
+  return eHAL_STATUS_SUCCESS;
+
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetHostOffload
+    \brief  API to set the host offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+#ifdef WLAN_NS_OFFLOAD
+        if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
+        {
+            status = pmcSetNSOffload( hHal, pRequest );
+        }
+        else
+#endif //WLAN_NS_OFFLOAD
+        {
+            status = pmcSetHostOffload (hHal, pRequest);
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/* ---------------------------------------------------------------------------
+    \fn sme_SetGTKOffload
+    \brief  API to set GTK offload information.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the GTK offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        status = pmcSetGTKOffload( hHal, pRequest );
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetGTKOffload
+    \brief  API to get GTK offload information.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the GTK offload response.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        pmcGetGTKOffload(hHal, callbackRoutine, callbackContext);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetKeepAlive
+    \brief  API to set the Keep Alive feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the Keep Alive request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
+           "setting Keep alive in SME TP %d", __FUNCTION__,pRequest->timePeriod);
+
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        status = pmcSetKeepAlive (hHal, pRequest);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/* ---------------------------------------------------------------------------
+    \fn sme_SetPreferredNetworkList
+    \brief  API to set the Preferred Network List Offload feature.
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  Pointer to the offload request.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        pmcSetRssiFilter(hHal, rssiThreshold);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+#endif // FEATURE_WLAN_SCAN_PNO
+
+eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        pmcSetPowerParams(hHal, pwParams);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_AbortMacScan
+    \brief  API to cancel MAC scan.
+    \param  hHal - The handle returned by macOpen.
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_AbortMacScan(tHalHandle hHal)
+{
+    eHalStatus status;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+       status = csrScanAbortMacScan(pMac);
+    
+       sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    
+    return ( status );
+}
+
+/* ----------------------------------------------------------------------------
+        \fn sme_GetOperationChannel
+        \brief API to get current channel on which STA is parked
+        this function gives channel information only of infra station or IBSS station
+        \param hHal and poiter to memory location
+        \returns eHAL_STATUS_SUCCESS
+                eHAL_STATUS_FAILURE
+-------------------------------------------------------------------------------*/
+eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel)
+{
+    tANI_U32 sessionId;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tCsrRoamSession *pSession;
+
+    for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX ; sessionId++)
+    {
+       if (CSR_IS_SESSION_VALID( pMac, sessionId ))
+       {
+          pSession = CSR_GET_SESSION( pMac, sessionId );
+
+          if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) || 
+             ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
+             ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
+          {
+              *pChannel =pSession->connectedProfile.operationChannel;
+              return eHAL_STATUS_SUCCESS;
+          }
+       }
+    }
+    return eHAL_STATUS_FAILURE;
+}// sme_GetOperationChannel ends here
+
+#ifdef WLAN_FEATURE_P2P
+/* ---------------------------------------------------------------------------
+
+    \fn sme_RegisterMgtFrame
+
+    \brief To register managment frame of specified type and subtype. 
+    \param frameType - type of the frame that needs to be passed to HDD.
+    \param matchData - data which needs to be matched before passing frame 
+                       to HDD. 
+    \param matchDataLen - Length of matched data.
+    \return eHalStatus 
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, 
+                     tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        tSirRegisterMgmtFrame *pMsg;
+        tANI_U16 len;
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+        
+        if( !pSession->sessionActive )
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                        "%s Invalid Sessionid", __FUNCTION__);
+            sme_ReleaseGlobalLock( &pMac->sme );
+            return eHAL_STATUS_FAILURE;
+        }
+        
+        len = sizeof(tSirRegisterMgmtFrame) + matchLen;
+        
+        status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pMsg, len);
+            pMsg->messageType     = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
+            pMsg->length          = len;
+            pMsg->sessionId       = sessionId;
+            pMsg->registerFrame   = VOS_TRUE;
+            pMsg->frameType       = frameType;
+            pMsg->matchLen        = matchLen;
+            palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); 
+            status = palSendMBMessage(pMac->hHdd, pMsg);
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_DeregisterMgtFrame
+
+    \brief To De-register managment frame of specified type and subtype. 
+    \param frameType - type of the frame that needs to be passed to HDD.
+    \param matchData - data which needs to be matched before passing frame 
+                       to HDD. 
+    \param matchDataLen - Length of matched data.
+    \return eHalStatus 
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, 
+                     tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        tSirRegisterMgmtFrame *pMsg;
+        tANI_U16 len;
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+        
+        if( !pSession->sessionActive ) 
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                        "%s Invalid Sessionid", __FUNCTION__);
+            sme_ReleaseGlobalLock( &pMac->sme );
+            return eHAL_STATUS_FAILURE;
+        }
+
+        len = sizeof(tSirRegisterMgmtFrame) + matchLen;
+        
+        status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pMsg, len);
+            pMsg->messageType     = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
+            pMsg->length          = len; 
+            pMsg->registerFrame   = VOS_FALSE;
+            pMsg->frameType       = frameType;
+            pMsg->matchLen        = matchLen;
+            palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); 
+            status = palSendMBMessage(pMac->hHdd, pMsg);
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_RemainOnChannel
+    \brief  API to request remain on channel for 'x' duration. used in p2p in listen state
+    \param  hHal - The handle returned by macOpen.
+    \param  pRequest -  channel
+    \param  duration - duration in ms
+    \param callback - HDD registered callback to process reaminOnChannelRsp
+    \param context - HDD Callback param
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+
+eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
+                               tANI_U8 channel, tANI_U32 duration,
+                               remainOnChanCallback callback, 
+                               void *pContext)
+{
+  eHalStatus status = eHAL_STATUS_SUCCESS;
+  tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+  if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+  {
+    status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+                                , eP2PRemainOnChnReasonUnknown
+#endif
+                                );
+    sme_ReleaseGlobalLock( &pMac->sme );
+  }
+  return(status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_ReportProbeReq
+    \brief  API to enable/disable forwarding of probeReq to apps in p2p.
+    \param  hHal - The handle returned by macOpen.
+    \param  falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+
+#ifndef WLAN_FEATURE_CONCURRENT_P2P
+eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    do
+    {
+        //acquire the lock for the sme object
+        status = sme_AcquireGlobalLock(&pMac->sme);
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            /* call set in context */
+            pMac->p2pContext.probeReqForwarding = flag;
+            //release the lock for the sme object
+            sme_ReleaseGlobalLock( &pMac->sme );
+        }
+    } while(0);
+
+    smsLog(pMac, LOGW, "exiting function %s\n", __FUNCTION__);
+
+    return(status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_updateP2pIe
+    \brief  API to set the P2p Ie in p2p context
+    \param  hHal - The handle returned by macOpen.
+    \param  p2pIe -  Ptr to p2pIe from HDD.
+    \param p2pIeLength: length of p2pIe
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+
+eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    //acquire the lock for the sme object
+    status = sme_AcquireGlobalLock(&pMac->sme);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        if(NULL != pMac->p2pContext.probeRspIe){
+            vos_mem_free(pMac->p2pContext.probeRspIe);
+            pMac->p2pContext.probeRspIeLength = 0;
+        }
+
+        pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
+        if (NULL == pMac->p2pContext.probeRspIe)
+        {
+            smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __FUNCTION__);
+            pMac->p2pContext.probeRspIeLength = 0;
+            status = eHAL_STATUS_FAILURE;
+        }
+        else
+        {
+            pMac->p2pContext.probeRspIeLength = p2pIeLength;
+
+            sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
+                        pMac->p2pContext.probeRspIe,
+                        pMac->p2pContext.probeRspIeLength ); 
+            vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
+                         p2pIeLength);
+        }
+
+        //release the lock for the sme object
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+   
+    smsLog(pMac, LOG2, "exiting function %s\n", __FUNCTION__);
+
+    return(status);
+}
+#endif
+
+/* ---------------------------------------------------------------------------
+    \fn sme_sendAction
+    \brief  API to send action frame from supplicant.
+    \param  hHal - The handle returned by macOpen.
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+
+eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
+                          const tANI_U8 *pBuf, tANI_U32 len)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    //acquire the lock for the sme object
+    status = sme_AcquireGlobalLock(&pMac->sme);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        p2pSendAction(hHal, sessionId, pBuf, len);
+        //release the lock for the sme object
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    smsLog(pMac, LOGW, "exiting function %s\n", __FUNCTION__);
+
+    return(status);
+}
+
+eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
+{
+  eHalStatus status = eHAL_STATUS_SUCCESS;
+  tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+  if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+  {
+    status = p2pCancelRemainOnChannel (hHal, sessionId);
+    sme_ReleaseGlobalLock( &pMac->sme );
+  }
+  return(status);
+}
+
+//Power Save Related
+eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
+{
+  eHalStatus status = eHAL_STATUS_SUCCESS;
+  tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+  if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+  {
+    status = p2pSetPs (hHal, data);
+    sme_ReleaseGlobalLock( &pMac->sme );
+  }
+  return(status);
+}
+
+#endif
+
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureRxpFilter
+
+  \brief 
+    SME will pass this request to lower mac to set/reset the filter on RXP for
+    multicast & broadcast traffic.
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
+    Basically to enable/disable the filter (to filter "all" mcbc traffic) based
+    on this param. In future we can use this as a mask to set various types of
+    filters as suggested below:
+    FILTER_ALL_MULTICAST:
+    FILTER_ALL_BROADCAST:
+    FILTER_ALL_MULTICAST_BROADCAST:
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal, 
+                            tpSirWlanSetRxpFilters  wlanRxpFilterParam)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    vos_msg_t       vosMessage;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        /* serialize the req through MC thread */
+        vosMessage.bodyptr = wlanRxpFilterParam;
+        vosMessage.type         = WDA_CFG_RXP_FILTER_REQ;
+        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+           status = eHAL_STATUS_FAILURE;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return(status);
+}
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureSuspendInd
+
+  \brief 
+    SME will pass this request to lower mac to Indicate that the wlan needs to 
+    be suspended
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    wlanSuspendParam- Depicts the wlan suspend params
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal, 
+                          tpSirWlanSuspendParam  wlanSuspendParam)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    vos_msg_t       vosMessage;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        /* serialize the req through MC thread */
+        vosMessage.bodyptr = wlanSuspendParam;
+        vosMessage.type    = WDA_WLAN_SUSPEND_IND;
+        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+           status = eHAL_STATUS_FAILURE;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return(status);
+}
+
+/* ---------------------------------------------------------------------------
+
+  \fn    sme_ConfigureResumeReq
+
+  \brief 
+    SME will pass this request to lower mac to Indicate that the wlan needs to 
+    be Resumed
+
+  \param 
+
+    hHal - The handle returned by macOpen. 
+ 
+    wlanResumeParam- Depicts the wlan resume params
+
+   
+  \return eHalStatus    
+  
+  
+--------------------------------------------------------------------------- */
+eHalStatus sme_ConfigureResumeReq( tHalHandle hHal, 
+                             tpSirWlanResumeParam  wlanResumeParam)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    vos_msg_t       vosMessage;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        /* serialize the req through MC thread */
+        vosMessage.bodyptr = wlanResumeParam;
+        vosMessage.type    = WDA_WLAN_RESUME_REQ;
+        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+           status = eHAL_STATUS_FAILURE;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return(status);
+}
+
+#endif
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetInfraSessionId
+
+    \brief To get the session ID for infra session, if connected
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+
+    \return sessionid, -1 if infra session is not connected
+
+  -------------------------------------------------------------------------------*/
+tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tANI_S8 sessionid = -1;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+                   
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      sessionid = csrGetInfraSessionId( pMac);
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (sessionid);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_GetInfraOperationChannel
+
+    \brief To get the operating channel for infra session, if connected
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+    \param sessionId - the sessionId returned by sme_OpenSession.
+
+    \return operating channel, 0 if infra session is not connected
+
+  -------------------------------------------------------------------------------*/
+tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   tANI_U8 channel = 0;
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      channel = csrGetInfraOperationChannel( pMac, sessionId);
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (channel);
+}
+
+//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
+//If other BSS is not up or not connected it will return 0 
+tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );   
+   tANI_U8 channel = 0;
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      channel = csrGetConcurrentOperationChannel( pMac );
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
+           " Other Concurrent Channel = %d", __FUNCTION__,channel);
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (channel);
+}
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/******************************************************************************
+*
+* Name: sme_PreferredNetworkFoundInd
+*
+* Description:
+*    Invoke Preferred Network Found Indication 
+*
+* Parameters:
+*    hHal - HAL handle for device
+*    pMsg - found network description
+*
+* Returns: eHalStatus
+*
+******************************************************************************/
+eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
+
+   if (NULL == pMsg)
+   {
+      smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+      status = eHAL_STATUS_FAILURE;
+   }
+   else
+   {
+      if (pPrefNetworkFoundInd->ssId.length > 0)
+      {
+          smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s", 
+                 __FUNCTION__, pPrefNetworkFoundInd->ssId.ssId);
+
+
+         /* Call Preferred Netowrk Found Indication callback routine. */
+         if (pMac->pmc.prefNetwFoundCB != NULL)
+         {    
+               pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd);
+         }
+
+      }
+      else
+      {
+         smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL\n", __FUNCTION__);
+         status = eHAL_STATUS_FAILURE;
+      }
+   }
+
+
+   return(status);
+}
+
+#endif // FEATURE_WLAN_SCAN_PNO
+
+
+eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+           
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if ( HAL_STATUS_SUCCESS( status ) )
+    {
+        status = csrGetCfgValidChannels(pMac, aValidChannels, len);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    
+    return (status);
+}
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetTxPerTracking
+
+    \brief Set Tx PER tracking configuration parameters
+
+    \param hHal - The handle returned by macOpen.
+    \param pTxPerTrackingConf - Tx PER configuration parameters
+
+    \return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetTxPerTracking(tHalHandle hHal, 
+                                void (*pCallbackfn) (void *pCallbackContext), 
+                                void *pCallbackContext,
+                                tpSirTxPerTrackingParam pTxPerTrackingParam)
+{
+    vos_msg_t msg;
+    tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
+    {
+        pMac->sme.pTxPerHitCallback = pCallbackfn;
+        pMac->sme.pTxPerHitCbContext = pCallbackContext;
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    
+    // free this memory in failure case or WDA request callback function
+    pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
+    if (NULL == pTxPerTrackingParamReq)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for tSirTxPerTrackingParam", __FUNCTION__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
+    msg.type = WDA_SET_TX_PER_TRACKING_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pTxPerTrackingParamReq;
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_TX_PER_TRACKING_REQ message to WDA", __FUNCTION__);
+        vos_mem_free(pTxPerTrackingParamReq);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_HandleChangeCountryCode
+
+    \brief Change Country code, Reg Domain and channel list
+
+    \details Country Code Priority
+    0 = 11D > Configured Country > NV
+    1 = Configured Country > 11D > NV
+    If Supplicant country code is priority than 11d is disabled.
+    If 11D is enabled, we update the country code after every scan.
+    Hence when Supplicant country code is priority, we don't need 11D info.
+    Country code from Supplicant is set as current courtry code.
+    User can send reset command XX (instead of country code) to reset the
+    country code to default values which is read from NV.
+    In case of reset, 11D is enabled and default NV code is Set as current country code
+    If 11D is priority,
+    Than Supplicant country code code is set to default code. But 11D code is set as current country code
+
+    \param pMac - The handle returned by macOpen.
+    \param pMsgBuf - MSG Buffer
+
+    \return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac,  void *pMsgBuf)
+{
+   eHalStatus  status = eHAL_STATUS_SUCCESS;
+   tAniChangeCountryCodeReq *pMsg;
+   v_REGDOMAIN_t domainIdIoctl; 
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   static uNvTables nvTables;
+   pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
+
+
+   /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
+   if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
+   {
+       pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
+
+       vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
+
+       /* read the country code from NV and use it */
+       if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
+       {
+           palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
+       }
+       else
+       {
+           status = eHAL_STATUS_FAILURE;
+           return status;
+       }
+   }
+   else
+   {
+       /* if Supplicant country code has priority, disable 11d */
+       if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
+       {
+           pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
+       }
+   }
+
+   /* WEXT set country code means
+    * 11D should be supported?
+    * 11D Channel should be enforced?
+    * 11D Country code should be matched?
+    * 11D Reg Domian should be matched?
+    * Country string changed */
+   if(pMac->roam.configParam.Is11dSupportEnabled &&
+      pMac->roam.configParam.fEnforce11dChannels &&
+      pMac->roam.configParam.fEnforceCountryCodeMatch &&
+      pMac->roam.configParam.fEnforceDefaultDomain &&
+      !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
+   {
+      /* All 11D related options are already enabled
+       * Country string is not changed
+       * Do not need do anything for country code change request */
+      return eHAL_STATUS_SUCCESS;
+   }
+
+   /* Set Current Country code and Current Regulatory domain */
+   status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
+   if(eHAL_STATUS_SUCCESS != status)
+   {
+       /* Supplicant country code failed. So give 11D priority */
+       pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
+       smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
+       return status;  
+   }
+
+   /* purge current scan results
+    if i don't do this than I still get old ap's (of different country code) as available (even if they are powered off). 
+    Looks like a bug in current scan sequence. 
+   */
+   csrScanFlushResult(pMac);
+
+   /* overwrite the defualt country code */
+   palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
+
+   /* Get Domain ID from country code */
+   status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
+   if ( status != eHAL_STATUS_SUCCESS )
+   {
+       smsLog( pMac, LOGE, FL("  fail to get regId %d\n"), domainIdIoctl );
+       return status;
+   }
+
+   status = WDA_SetRegDomain(pMac, domainIdIoctl);
+
+   if ( status != eHAL_STATUS_SUCCESS )
+   {
+       smsLog( pMac, LOGE, FL("  fail to set regId %d\n"), domainIdIoctl );
+       return status;
+   }
+
+   /* set to default domain ID */
+   pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
+
+   /* get the channels based on new cc */
+   status = csrInitGetChannels( pMac );
+
+   if ( status != eHAL_STATUS_SUCCESS )
+   {
+       smsLog( pMac, LOGE, FL("  fail to get Channels \n"));
+       return status;
+   }
+
+   /* reset info based on new cc, and we are done */
+   csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE);
+   if( pMsg->changeCCCallback )
+   {
+      ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
+   }
+
+   return eHAL_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+eHalStatus sme_8023MulticastList (tHalHandle hHal, tpSirRcvFltMcAddrList pMulticastAddrs)
+{
+    tpSirRcvFltMcAddrList   pRequestBuf;
+    vos_msg_t               msg;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
+               "ulMulticastAddrCnt=%d, multicastAddr[0]=%d", __FUNCTION__,
+               pMulticastAddrs->ulMulticastAddrCnt,
+               pMulticastAddrs->multicastAddr[0]);
+  
+    pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
+            "allocate memory for 8023 Multicast List request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
+
+    msg.type = WDA_8023_MULTICAST_LIST_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
+            "post WDA_8023_MULTICAST_LIST message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg)
+{
+    tpSirRcvPktFilterCfgType    pRequestBuf;
+    v_SINT_t                allocSize;
+    vos_msg_t               msg;
+    /*tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);*/
+    v_U8_t   idx=0;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
+               "filterId = %d", __FUNCTION__,
+               pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
+  
+    allocSize = sizeof(tSirRcvPktFilterCfgType) + 
+                      ((pRcvPktFilterCfg->numFieldParams - 1) * 
+                      sizeof(tSirRcvPktFilterFieldParams));
+    pRequestBuf = vos_mem_malloc(allocSize);
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
+            "allocate memory for Receive Filter Set Filter request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
+
+    msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
+           "FT %d FID %d ", 
+           pRequestBuf->filterType, pRequestBuf->filterId);    
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
+           "params %d CT %d", 
+           pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);    
+
+    for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
+    {
+
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+           "Proto %d Comp Flag %d \n",
+           pRequestBuf->paramsData[idx].protocolLayer,
+           pRequestBuf->paramsData[idx].cmpFlag);
+
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+           "Data Offset %d Data Len %d\n",
+           pRequestBuf->paramsData[idx].dataOffset,
+           pRequestBuf->paramsData[idx].dataLength);
+
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+          "CData: %d:%d:%d:%d:%d:%d\n",
+           pRequestBuf->paramsData[idx].compareData[0],
+           pRequestBuf->paramsData[idx].compareData[1], 
+           pRequestBuf->paramsData[idx].compareData[2],
+           pRequestBuf->paramsData[idx].compareData[3],
+           pRequestBuf->paramsData[idx].compareData[4],
+           pRequestBuf->paramsData[idx].compareData[5]);
+
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+           "MData: %d:%d:%d:%d:%d:%d\n",
+           pRequestBuf->paramsData[idx].dataMask[0],
+           pRequestBuf->paramsData[idx].dataMask[1], 
+           pRequestBuf->paramsData[idx].dataMask[2],
+           pRequestBuf->paramsData[idx].dataMask[3],
+           pRequestBuf->paramsData[idx].dataMask[4],
+           pRequestBuf->paramsData[idx].dataMask[5]);
+
+    }
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
+            "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+eHalStatus sme_GetFilterMatchCount(tHalHandle hHal, 
+                                   FilterMatchCountCallback callbackRoutine,
+                                   void *callbackContext )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __FUNCTION__);
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
+    {
+        pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext);
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __FUNCTION__);
+
+    return (status);
+}
+
+eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam)
+{
+    tpSirRcvFltPktClearParam pRequestBuf;
+    vos_msg_t               msg;
+
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __FUNCTION__,
+               pRcvFltPktClearParam->filterId);
+  
+    pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+            "%s: Not able to allocate memory for Receive Filter "
+            "Clear Filter request", __FUNCTION__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+    vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
+
+    msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pRequestBuf;
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
+            "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __FUNCTION__);
+        vos_mem_free(pRequestBuf);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+/* ---------------------------------------------------------------------------
+    \fn sme_PreChannelSwitchIndFullPowerCB
+    \brief  call back function for the PMC full power request because of pre 
+             channel switch.
+    \param callbackContext
+    \param status
+  ---------------------------------------------------------------------------*/
+void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext, 
+                eHalStatus status)
+{
+    tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
+    tSirMbMsg *pMsg;
+    tANI_U16 msgLen;
+
+    msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if(HAL_STATUS_SUCCESS(status))
+    {
+        palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
+        pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
+        pMsg->msgLen = pal_cpu_to_be16(msgLen);
+        status = palSendMBMessage(pMac->hHdd, pMsg);
+    }                             
+
+    return;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_HandlePreChannelSwitchInd
+    \brief  Processes the indcation from PE for pre-channel switch.
+    \param hHal
+    \- The handle returned by macOpen. return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB, 
+                            pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH); 
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_HandlePostChannelSwitchInd
+    \brief  Processes the indcation from PE for post-channel switch.
+    \param hHal
+    \- The handle returned by macOpen. return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+       status = pmcRequestBmps(hHal, NULL, NULL);
+       sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (status);
+}
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_IsChannelValid
+
+    \brief To check if the channel is valid for currently established domain
+    This is a synchronous API.
+
+    \param hHal - The handle returned by macOpen.
+    \param channel - channel to verify
+
+    \return TRUE/FALSE, TRUE if channel is valid
+
+  -------------------------------------------------------------------------------*/
+tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tANI_BOOLEAN valid = FALSE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+                   
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+
+      valid = csrRoamIsChannelValid( pMac, channel);
+
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+
+   return (valid);
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_SetFreqBand
+    \brief  Used to set frequency band.
+    \param  hHal
+    \eBand  band value to be configured
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      status = csrSetBand(hHal, eBand);
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+   return status;
+}
+
+/* ---------------------------------------------------------------------------
+    \fn sme_GetFreqBand
+    \brief  Used to get the current band settings.
+    \param  hHal
+    \pBand  pointer to hold band value
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
+{
+   eHalStatus status = eHAL_STATUS_FAILURE;
+   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
+   {
+      *pBand = csrGetCurrentBand( hHal );
+      sme_ReleaseGlobalLock( &pMac->sme );
+   }
+   return status;
+}
+
+#ifdef WLAN_WAKEUP_EVENTS
+/******************************************************************************
+  \fn sme_WakeReasonIndCallback
+
+  \brief
+  a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
+
+  \param hHal - HAL handle for device
+  \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
+
+  \return eHalStatus  
+******************************************************************************/
+eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
+{
+   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   eHalStatus status = eHAL_STATUS_SUCCESS;
+   tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
+
+   if (NULL == pMsg)
+   {
+      smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__);
+      status = eHAL_STATUS_FAILURE;
+   }
+   else
+   {
+      smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback\n");
+
+      /* Call Wake Reason Indication callback routine. */
+      if (pMac->pmc.wakeReasonIndCB != NULL)
+          pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
+        
+      pMac->pmc.wakeReasonIndCB = NULL;
+      pMac->pmc.wakeReasonIndCBContext = NULL;
+
+      smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __FUNCTION__, pWakeReasonInd->ulReason);
+   }
+
+   return(status);
+}
+#endif // WLAN_WAKEUP_EVENTS
+
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetMaxTxPower
+
+    \brief Set the Maximum Transmit Power dynamically. Note: this setting will
+    not persist over reboots.
+
+    \param  hHal
+    \param pBssid  BSSID to set the power cap for
+    \param pBssid  pSelfMacAddress self MAC Address
+    \param pBssid  power to set in dB
+    \- return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid, 
+                             tSirMacAddr pSelfMacAddress, v_S7_t dB)
+{
+    vos_msg_t msg;
+    tpMaxTxPowerParams pMaxTxParams = NULL;
+
+    pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
+    if (NULL == pMaxTxParams)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __FUNCTION__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
+    vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress, 
+                 SIR_MAC_ADDR_LENGTH);
+    pMaxTxParams->power = dB;
+
+    msg.type = WDA_SET_MAX_TX_POWER_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pMaxTxParams;
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA", __FUNCTION__);
+        vos_mem_free(pMaxTxParams);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* ---------------------------------------------------------------------------
+
+    \fn sme_HideSSID
+
+    \brief hide/show SSID dynamically. Note: this setting will
+    not persist over reboots.
+
+    \param hHal
+    \param sessionId
+    \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
+    \- return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
+{
+    eHalStatus status   = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tANI_U16 len;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        tpSirUpdateParams pMsg;
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+        
+        if( !pSession->sessionActive ) 
+            VOS_ASSERT(0);
+
+        /* Create the message and send to lim */
+        len = sizeof(tSirUpdateParams); 
+        status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
+        if(HAL_STATUS_SUCCESS(status))
+        {
+            palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
+            pMsg->messageType     = eWNI_SME_HIDE_SSID_REQ;
+            pMsg->length          = len;
+            /* Data starts from here */
+            pMsg->sessionId       = sessionId;
+            pMsg->ssidHidden      = ssidHidden; 
+            status = palSendMBMessage(pMac->hHdd, pMsg);
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+   return status;
+}
+#endif
+
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetTmLevel
+    \brief  Set Thermal Mitigation Level to RIVA
+    \param  hHal - The handle returned by macOpen.
+    \param  newTMLevel - new Thermal Mitigation Level
+    \param  tmMode - Thermal Mitigation handle mode, default 0
+    \return eHalStatus     
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
+{
+    eHalStatus          status    = eHAL_STATUS_SUCCESS;
+    VOS_STATUS          vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
+    vos_msg_t           vosMessage;
+    tAniSetTmLevelReq  *setTmLevelReq = NULL;
+
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
+    {
+        setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
+        if(NULL == setTmLevelReq)
+        {
+           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Not able to allocate memory for sme_SetTmLevel", __FUNCTION__);
+           return eHAL_STATUS_FAILURE;
+        }
+
+        setTmLevelReq->tmMode     = tmMode;
+        setTmLevelReq->newTmLevel = newTMLevel;
+
+        /* serialize the req through MC thread */
+        vosMessage.bodyptr = setTmLevelReq;
+        vosMessage.type    = WDA_SET_TM_LEVEL_REQ;
+        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
+        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+        {
+           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Post Set TM Level MSG fail", __FUNCTION__);
+           vos_mem_free(setTmLevelReq);
+           status = eHAL_STATUS_FAILURE;
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return(status);
+}
+
+/*---------------------------------------------------------------------------
+
+  \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
+  Host and FW.
+
+  \param  hHal - HAL handle for device
+
+  \return NONE
+
+---------------------------------------------------------------------------*/
+void sme_featureCapsExchange( tHalHandle hHal)
+{
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
+    WDA_featureCapsExchange(vosContext);
+}
diff --git a/CORE/SME/src/sme_common/sme_FTApi.c b/CORE/SME/src/sme_common/sme_FTApi.c
new file mode 100644
index 0000000..ce76b7e
--- /dev/null
+++ b/CORE/SME/src/sme_common/sme_FTApi.c
@@ -0,0 +1,486 @@
+/*
+ * 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 Definitions for SME FT APIs
+
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <smsDebug.h>
+#include <csrInsideApi.h>
+#include <csrNeighborRoam.h>
+
+/*--------------------------------------------------------------------------
+  Initialize the FT context. 
+  ------------------------------------------------------------------------*/
+void sme_FTOpen(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus     status = eHAL_STATUS_SUCCESS;
+
+    pMac->ft.ftSmeContext.auth_ft_ies = NULL;                        
+    pMac->ft.ftSmeContext.auth_ft_ies_length = 0;                        
+
+    pMac->ft.ftSmeContext.reassoc_ft_ies = NULL;                        
+    pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0;       
+
+    status = palTimerAlloc(pMac->hHdd, &pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, 
+                            sme_PreauthReassocIntvlTimerCallback, (void *)pMac);
+
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE, FL("Preauth Reassoc interval Timer allocation failed"));
+        return;
+    }                 
+
+    pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;                        
+
+    pMac->ft.ftSmeContext.FTState = eFT_START_READY;
+}
+
+/*--------------------------------------------------------------------------
+  Cleanup the SME FT Global context. 
+  ------------------------------------------------------------------------*/
+void sme_FTClose(tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+    if (pMac->ft.ftSmeContext.auth_ft_ies != NULL)
+    {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+        smsLog( pMac, LOGE, FL(" Freeing %p and setting to NULL\n"), 
+            pMac->ft.ftSmeContext.auth_ft_ies);
+#endif
+        vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies);
+        pMac->ft.ftSmeContext.auth_ft_ies = NULL;
+    }
+    pMac->ft.ftSmeContext.auth_ft_ies_length = 0;                        
+
+    if (pMac->ft.ftSmeContext.reassoc_ft_ies != NULL)
+    {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+        smsLog( pMac, LOGE, FL(" Freeing %p and setting to NULL\n"), 
+            pMac->ft.ftSmeContext.reassoc_ft_ies);
+#endif
+        vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies);
+        pMac->ft.ftSmeContext.reassoc_ft_ies = NULL;                        
+    }
+    pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0;                        
+
+    pMac->ft.ftSmeContext.FTState = eFT_START_READY;
+    vos_mem_zero(pMac->ft.ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE);
+
+    if (pMac->ft.ftSmeContext.psavedFTPreAuthRsp != NULL)
+    {
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+        smsLog( pMac, LOGE, FL("%s: Freeing %p and setting to NULL\n"), 
+            pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
+#endif
+        vos_mem_free(pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
+        pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;                        
+    }
+
+    palTimerFree(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
+}
+
+
+/*--------------------------------------------------------------------------
+  Each time the supplicant sends down the FT IEs to the driver.
+  This function is called in SME. This fucntion packages and sends
+  the FT IEs to PE.
+  ------------------------------------------------------------------------*/
+void sme_SetFTIEs( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *ft_ies, 
+        tANI_U16 ft_ies_length )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if (!( HAL_STATUS_SUCCESS( status ))) return;
+
+    if (ft_ies == NULL) 
+    {
+        smsLog( pMac, LOGE, FL(" ft ies is NULL\n"));
+        sme_ReleaseGlobalLock( &pMac->sme );
+        return; 
+    }
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+    smsLog( pMac, LOGE, "FT IEs Req is received in state %d\n", 
+        pMac->ft.ftSmeContext.FTState);
+#endif
+
+    // Global Station FT State
+    switch(pMac->ft.ftSmeContext.FTState)
+    {
+        case eFT_START_READY:
+        case eFT_AUTH_REQ_READY:
+            if ((pMac->ft.ftSmeContext.auth_ft_ies) && 
+                    (pMac->ft.ftSmeContext.auth_ft_ies_length))
+            {
+                // Free the one we received last from the supplicant
+                vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies);
+                pMac->ft.ftSmeContext.auth_ft_ies_length = 0; 
+            }
+
+            // Save the FT IEs
+            pMac->ft.ftSmeContext.auth_ft_ies = vos_mem_malloc(ft_ies_length);
+            if(pMac->ft.ftSmeContext.auth_ft_ies == NULL)
+            {
+               smsLog( pMac, LOGE, FL("Memory allocation failed for "
+                                      "auth_ft_ies\n"));
+               sme_ReleaseGlobalLock( &pMac->sme );
+               return;
+            }
+            pMac->ft.ftSmeContext.auth_ft_ies_length = ft_ies_length;
+            vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.auth_ft_ies, ft_ies,
+                ft_ies_length);
+                
+            pMac->ft.ftSmeContext.FTState = eFT_AUTH_REQ_READY;
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+            smsLog( pMac, LOGE, "ft_ies_length=%d\n", ft_ies_length);
+            /*
+            smsLog( pMac, LOGE, "%d: New Auth ft_ies_length=%02x%02x%02x\n", 
+                current->pid, pMac->ft.ftSmeContext.auth_ft_ies[0],
+                pMac->ft.ftSmeContext.auth_ft_ies[1],
+                pMac->ft.ftSmeContext.auth_ft_ies[2]);
+                */
+#endif
+            break;
+
+        case eFT_AUTH_COMPLETE:
+            // We will need to re-start preauth. If we received FT IEs in
+            // eFT_PRE_AUTH_DONE state, it implies there was a rekey in 
+            // our pre-auth state. Hence this implies we need Pre-auth again.
+
+            // OK now inform SME we have no pre-auth list.
+            // Delete the pre-auth node locally. Set your self back to restart pre-auth
+            // TBD
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+            smsLog( pMac, LOGE, 
+                "Pre-auth done and now receiving---> AUTH REQ <---- in state %d\n", 
+                pMac->ft.ftSmeContext.FTState);
+            smsLog( pMac, LOGE, "Unhandled reception of FT IES in state %d\n", 
+                pMac->ft.ftSmeContext.FTState);
+#endif
+            break;
+
+        case eFT_REASSOC_REQ_WAIT:
+            // We are done with pre-auth, hence now waiting for
+            // reassoc req. This is the new FT Roaming in place
+
+            // At this juncture we are ready to start sending Re-Assoc Req.
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+            smsLog( pMac, LOGE, "New Reassoc Req=%p in state %d\n", 
+                ft_ies, pMac->ft.ftSmeContext.FTState);
+#endif
+            if ((pMac->ft.ftSmeContext.reassoc_ft_ies) && 
+                (pMac->ft.ftSmeContext.reassoc_ft_ies_length))
+            {
+                // Free the one we received last from the supplicant
+                vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies);
+                pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0; 
+            }
+
+            // Save the FT IEs
+            pMac->ft.ftSmeContext.reassoc_ft_ies = vos_mem_malloc(ft_ies_length);
+            if(pMac->ft.ftSmeContext.reassoc_ft_ies == NULL)
+            {
+               smsLog( pMac, LOGE, FL("Memory allocation failed for "
+                                      "reassoc_ft_ies\n"));
+               sme_ReleaseGlobalLock( &pMac->sme );
+               return;
+            }
+            pMac->ft.ftSmeContext.reassoc_ft_ies_length = ft_ies_length;
+            vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.reassoc_ft_ies, ft_ies,
+                ft_ies_length);
+                
+            pMac->ft.ftSmeContext.FTState = eFT_SET_KEY_WAIT;
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+            smsLog( pMac, LOGE, "ft_ies_length=%d state=%d\n", ft_ies_length,
+                pMac->ft.ftSmeContext.FTState);
+            /*
+            smsLog( pMac, LOGE, "%d: New Auth ft_ies_length=%02x%02x%02x\n", 
+                current->pid, pMac->ft.ftSmeContext.reassoc_ft_ies[0],
+                pMac->ft.ftSmeContext.reassoc_ft_ies[1],
+                pMac->ft.ftSmeContext.reassoc_ft_ies[2]);
+                */
+#endif
+            
+            break;
+
+        default:
+            smsLog( pMac, LOGE, FL(" Unhandled state=%d\n"),
+                pMac->ft.ftSmeContext.FTState);
+            break;
+    }
+    sme_ReleaseGlobalLock( &pMac->sme );
+}
+            
+eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo)
+{
+    tSirFTUpdateKeyInfo *pMsg;
+    tANI_U16 msgLen;
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    tAniEdType tmpEdType;
+    tAniKeyDirection tmpDirection;
+    //tANI_U8 *pBuf;
+    tANI_U8 *p = NULL;
+    tAniEdType edType;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    int i = 0;
+
+    smsLog(pMac, LOGE, FL("keyLength %d\n"), pFTKeyInfo->keyLength);
+
+      for(i=0; i<pFTKeyInfo->keyLength; i++)
+          smsLog(pMac, LOGE, FL("%02x"), pFTKeyInfo->Key[i]); 
+
+    msgLen  = sizeof( tANI_U16) + sizeof( tANI_U16 ) + 
+       sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + 
+       sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key );
+                     
+    status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
+    if ( !HAL_STATUS_SUCCESS(status) )
+    {
+       return eHAL_STATUS_FAILURE;
+    }
+
+    palZeroMemory(pMac->hHdd, pMsg, msgLen);
+    pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY);
+    pMsg->length = pal_cpu_to_be16(msgLen);
+
+    p = (tANI_U8 *)&pMsg->keyMaterial;
+
+    // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field
+    // in the tSirKeyMaterial keyMaterial; field).
+    //
+    // !!NOTE:  This keyMaterial.length contains the length of a MAX size key, though the keyLength can be 
+    // shorter than this max size.  Is LIM interpreting this ok ?
+    p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + 
+                                                    ( pMsg->keyMaterial.numKeys * sizeof( pMsg->keyMaterial.key ) ) )) );
+
+    // set pMsg->keyMaterial.edType
+    edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType );
+    tmpEdType = pal_cpu_to_be32(edType);
+    palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) );
+    p += sizeof( pMsg->keyMaterial.edType );
+
+    // set the pMsg->keyMaterial.numKeys field
+    *p = pMsg->keyMaterial.numKeys;
+    p += sizeof( pMsg->keyMaterial.numKeys );   
+
+    // set pSirKey->keyId = keyId;
+    *p = pMsg->keyMaterial.key[ 0 ].keyId;
+    p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId );
+
+    // set pSirKey->unicast = (tANI_U8)fUnicast;
+    *p = (tANI_U8)eANI_BOOLEAN_TRUE;
+    p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast );
+
+    // set pSirKey->keyDirection = aniKeyDirection;
+    tmpDirection = pal_cpu_to_be32(pFTKeyInfo->keyDirection);
+    palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) );
+    p += sizeof(tAniKeyDirection);
+    //    pSirKey->keyRsc = ;;
+    palCopyMemory( pMac->hHdd, p, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN );
+    p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc );
+
+    // set pSirKey->paeRole
+    *p = pFTKeyInfo->paeRole;   // 0 is Supplicant
+    p++;
+
+    // set pSirKey->keyLength = keyLength;
+    p = pal_set_U16( p, pal_cpu_to_be16(pFTKeyInfo->keyLength) );
+
+    if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) 
+    {   
+        palCopyMemory( pMac->hHdd, p, pFTKeyInfo->Key, pFTKeyInfo->keyLength ); 
+        if(pFTKeyInfo->keyLength == 16)
+        {
+            smsLog(pMac, LOGE, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
+            pFTKeyInfo->keyId, edType, pFTKeyInfo->Key[0], pFTKeyInfo->Key[1], pFTKeyInfo->Key[2], pFTKeyInfo->Key[3], pFTKeyInfo->Key[4],
+            pFTKeyInfo->Key[5], pFTKeyInfo->Key[6], pFTKeyInfo->Key[7], pFTKeyInfo->Key[8],
+            pFTKeyInfo->Key[9], pFTKeyInfo->Key[10], pFTKeyInfo->Key[11], pFTKeyInfo->Key[12], pFTKeyInfo->Key[13], pFTKeyInfo->Key[14], pFTKeyInfo->Key[15]);
+        }
+    }
+
+    status = palSendMBMessage(pMac->hHdd, pMsg);
+
+    return( status );
+}
+
+eHalStatus sme_FTUpdateKey( tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if (!( HAL_STATUS_SUCCESS( status )))
+    {
+       return eHAL_STATUS_FAILURE;
+    }
+
+    if (pFTKeyInfo == NULL) 
+    {
+        smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL\n", __FUNCTION__);
+        sme_ReleaseGlobalLock( &pMac->sme );
+        return eHAL_STATUS_FAILURE; 
+    }
+
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+    smsLog( pMac, LOGE, "sme_FTUpdateKey is received in state %d\n", 
+        pMac->ft.ftSmeContext.FTState);
+#endif
+
+    // Global Station FT State
+    switch(pMac->ft.ftSmeContext.FTState)
+    {
+    case eFT_SET_KEY_WAIT:
+       status = sme_FTSendUpdateKeyInd( hHal, pFTKeyInfo );
+       pMac->ft.ftSmeContext.FTState = eFT_START_READY;
+       break;
+          
+    default:
+       smsLog( pMac, LOGE, "%s: Unhandled state=%d\n", __FUNCTION__,
+               pMac->ft.ftSmeContext.FTState);
+       status = eHAL_STATUS_FAILURE;
+       break;
+    }
+    sme_ReleaseGlobalLock( &pMac->sme );
+
+    return status;
+}
+/*--------------------------------------------------------------------------
+ *
+ * HDD Interface to SME. SME now sends the Auth 2 and RIC IEs up to the supplicant.
+ * The supplicant will then proceed to send down the
+ * Reassoc Req.
+ *
+ *------------------------------------------------------------------------*/
+void sme_GetFTPreAuthResponse( tHalHandle hHal, tANI_U8 *ft_ies, 
+                               tANI_U32 ft_ies_ip_len, tANI_U16 *ft_ies_length )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    *ft_ies_length = 0;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if (!( HAL_STATUS_SUCCESS( status ))) 
+       return;
+
+    /* All or nothing - proceed only if both BSSID and FT IE fit */
+    if((ANI_MAC_ADDR_SIZE + 
+       pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ft_ies_length) > ft_ies_ip_len) 
+    {
+       sme_ReleaseGlobalLock( &pMac->sme );
+       return;
+    }
+
+    // hdd needs to pack the bssid also along with the 
+    // auth response to supplicant
+    vos_mem_copy(ft_ies, pMac->ft.ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE);
+    
+    // Copy the auth resp FTIEs
+    vos_mem_copy(&(ft_ies[ANI_MAC_ADDR_SIZE]), 
+                 pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ft_ies, 
+                 pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ft_ies_length);
+
+    *ft_ies_length = ANI_MAC_ADDR_SIZE + 
+       pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ft_ies_length;
+
+    pMac->ft.ftSmeContext.FTState = eFT_REASSOC_REQ_WAIT;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+    smsLog( pMac, LOGE, FL(" Filled auth resp = %d\n"), *ft_ies_length);
+#endif
+    sme_ReleaseGlobalLock( &pMac->sme );
+    return;
+}
+
+/*--------------------------------------------------------------------------
+ *
+ * SME now sends the RIC IEs up to the supplicant.
+ * The supplicant will then proceed to send down the
+ * Reassoc Req.
+ *
+ *------------------------------------------------------------------------*/
+void sme_GetRICIEs( tHalHandle hHal, tANI_U8 *ric_ies, tANI_U32 ric_ies_ip_len,
+                    tANI_U32 *ric_ies_length )
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    *ric_ies_length = 0;
+
+    status = sme_AcquireGlobalLock( &pMac->sme );
+    if (!( HAL_STATUS_SUCCESS( status ))) 
+       return;
+
+    /* All or nothing */
+    if (pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length > 
+        ric_ies_ip_len)
+    {
+       sme_ReleaseGlobalLock( &pMac->sme );
+       return;
+    }
+
+    vos_mem_copy(ric_ies, pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies, 
+                 pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length);
+
+    *ric_ies_length = pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+    smsLog( pMac, LOGE, FL(" Filled ric ies = %d\n"), *ric_ies_length);
+#endif
+
+    sme_ReleaseGlobalLock( &pMac->sme );
+    return;
+}
+
+/*--------------------------------------------------------------------------
+ *
+ * Timer callback for the timer that is started between the preauth completion and 
+ * reassoc request to the PE. In this interval, it is expected that the pre-auth response 
+ * and RIC IEs are passed up to the WPA supplicant and received back the necessary FTIEs 
+ * required to be sent in the reassoc request
+ *
+ *------------------------------------------------------------------------*/
+void sme_PreauthReassocIntvlTimerCallback(void *context)
+{
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
+    tpAniSirGlobal pMac = (tpAniSirGlobal )context;
+    csrNeighborRoamRequestHandoff(pMac);
+#endif
+    return;
+}
+/* End of File */
+#endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/CORE/SVC/external/wlan_nlink_common.h b/CORE/SVC/external/wlan_nlink_common.h
new file mode 100644
index 0000000..89c0745
--- /dev/null
+++ b/CORE/SVC/external/wlan_nlink_common.h
@@ -0,0 +1,111 @@
+/*
+ * 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 wlan_nlink_common.h
+  
+  Exports and types for the Netlink Service interface. This header file contains
+  message types and definitions that is shared between the user space service
+  (e.g. BTC service) and WLAN kernel module.
+
+  Copyright (c) 2009 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
+
+===========================================================================*/
+
+#ifndef WLAN_NLINK_COMMON_H__
+#define WLAN_NLINK_COMMON_H__
+
+#include <linux/netlink.h>
+
+/*---------------------------------------------------------------------------
+ * External Functions
+ *-------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ *-------------------------------------------------------------------------*/
+#define WLAN_NL_MAX_PAYLOAD   256     /* maximum size for netlink message*/
+#define WLAN_NLINK_PROTO_FAMILY  NETLINK_USERSOCK
+#define WLAN_NLINK_MCAST_GRP_ID  0x01 
+
+/*---------------------------------------------------------------------------
+ * Type Declarations
+ *-------------------------------------------------------------------------*/
+
+/* 
+ * The following enum defines the target service within WLAN driver for which the
+ * message is intended for. Each service along with its counterpart 
+ * in the user space, define a set of messages they recognize.
+ * Each of this message will have an header of type tAniMsgHdr defined below.
+ * Each Netlink message to/from a kernel module will contain only one
+ * message which is preceded by a tAniMsgHdr. The maximun size (in bytes) of
+ * a netlink message is assumed to be MAX_PAYLOAD bytes.
+ *
+ *         +------------+-------+----------+----------+
+ *         |Netlink hdr | Align |tAniMsgHdr| msg body |
+ *         +------------+-------+----------|----------+
+ */
+
+// Message Types 
+#define WLAN_BTC_QUERY_STATE_REQ    0x01  // BTC  --> WLAN
+#define WLAN_BTC_BT_EVENT_IND       0x02  // BTC  --> WLAN
+#define WLAN_BTC_QUERY_STATE_RSP    0x03  // WLAN -->  BTC
+#define WLAN_MODULE_UP_IND          0x04  // WLAN -->  BTC
+#define WLAN_MODULE_DOWN_IND        0x05  // WLAN -->  BTC
+#define WLAN_STA_ASSOC_DONE_IND     0x06  // WLAN -->  BTC
+#define WLAN_STA_DISASSOC_DONE_IND  0x07  // WLAN -->  BTC
+
+// Special Message Type used by AMP, intercepted by send_btc_nlink_msg() and
+// replaced by WLAN_STA_ASSOC_DONE_IND or WLAN_STA_DISASSOC_DONE_IND
+#define WLAN_AMP_ASSOC_DONE_IND     0x10
+
+// Special Message Type used by SoftAP, intercepted by send_btc_nlink_msg() and
+// replaced by WLAN_STA_ASSOC_DONE_IND
+#define WLAN_BTC_SOFTAP_BSS_START      0x11
+
+
+// Event data for WLAN_BTC_QUERY_STATE_RSP & WLAN_STA_ASSOC_DONE_IND
+typedef struct
+{
+   unsigned char channel;  // 0 implies STA not associated to AP
+} tWlanAssocData;
+
+#define ANI_NL_MSG_BASE     0x10    /* Some arbitrary base */
+
+typedef enum eAniNlModuleTypes {
+   ANI_NL_MSG_PUMAC = ANI_NL_MSG_BASE + 0x01,// PTT Socket App
+   ANI_NL_MSG_PTT   = ANI_NL_MSG_BASE + 0x07,// Quarky GUI
+   WLAN_NL_MSG_BTC,
+   ANI_NL_MSG_MAX  
+} tAniNlModTypes, tWlanNlModTypes;
+
+#define WLAN_NL_MSG_BASE ANI_NL_MSG_BASE
+#define WLAN_NL_MSG_MAX  ANI_NL_MSG_MAX
+
+//All Netlink messages must contain this header
+typedef struct sAniHdr {
+   unsigned short type;
+   unsigned short length;
+} tAniHdr, tAniMsgHdr;
+
+#endif //WLAN_NLINK_COMMON_H__
diff --git a/CORE/SVC/inc/wlan_btc_svc.h b/CORE/SVC/inc/wlan_btc_svc.h
new file mode 100644
index 0000000..620cb22
--- /dev/null
+++ b/CORE/SVC/inc/wlan_btc_svc.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+ * wlan_btc_svc.h
+ *
+ ******************************************************************************/
+
+#ifndef WLAN_BTC_SVC_H
+#define WLAN_BTC_SVC_H 
+
+void send_btc_nlink_msg (int type, int dest_pid);
+int btc_activate_service(void *pAdapter);
+
+#endif
diff --git a/CORE/SVC/inc/wlan_nlink_srv.h b/CORE/SVC/inc/wlan_nlink_srv.h
new file mode 100644
index 0000000..788ffb3
--- /dev/null
+++ b/CORE/SVC/inc/wlan_nlink_srv.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.
+ */
+
+/******************************************************************************
+ * wlan_nlink_srv.h
+ *
+ * wlan_nlink_srv is used to RX/TX Netlink messages from user space to kernel
+ * modules and vice versa. Kernel modules must register a message handler for a
+ * message type so that the wlan_nlink_srv can invoke the corresponding msg handler
+ * whenever a Netlink message of a particular type has been received from an
+ * application.  In the opposite direction, wlan_nlink_srv provides a mechanism  
+ * which kernel modules can use to send Netlink messages to applications.
+ *
+ ******************************************************************************/
+
+#ifndef WLAN_NLINK_SRV_H
+#define WLAN_NLINK_SRV_H 
+
+#include <linux/skbuff.h>
+#include <linux/netlink.h>
+#include <wlan_nlink_common.h>
+
+#define NLINK_MAX_CALLBACKS (WLAN_NL_MSG_MAX - WLAN_NL_MSG_BASE)
+
+typedef int (* nl_srv_msg_callback)(struct sk_buff * skb);
+
+int nl_srv_init(void);
+void nl_srv_exit(void);
+int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler);
+int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler);
+int nl_srv_ucast(struct sk_buff * skb, int dst_pid);
+int nl_srv_bcast(struct sk_buff * skb);
+
+#endif
diff --git a/CORE/SVC/inc/wlan_ptt_sock_svc.h b/CORE/SVC/inc/wlan_ptt_sock_svc.h
new file mode 100644
index 0000000..cca58d5
--- /dev/null
+++ b/CORE/SVC/inc/wlan_ptt_sock_svc.h
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+ * wlan_ptt_sock_svc.c
+ *
+ ******************************************************************************/
+#ifndef PTT_SOCK_SVC_H
+#define PTT_SOCK_SVC_H
+#include <wlan_nlink_srv.h>
+#include <halTypes.h>
+#include <vos_status.h>
+#include <wlan_hdd_includes.h>
+#include <vos_trace.h>
+#include <wlan_nlink_common.h>
+/*
+ * Quarky Message Format:
+ * The following is the messaging protocol between Quarky and PTT Socket App.
+ * The totalMsgLen is the length from Radio till msgBody. The value of Radio
+ * is always defaulted to 0. The MsgLen is the length from msgId till msgBody.
+ * The length of the msgBody varies with respect to the MsgId. Buffer space
+ * for MsgBody is already allocated in the received buffer. So in case of READ
+ * we just need to populate the values in the received message and send it
+ * back
+ * +------------+-------+-------+--------+-------+---------+
+ * |TotalMsgLen | Radio | MsgId | MsgLen |Status |MsgBody  |
+ * +------------+-------+-------|--------+-------+---------+
+ * <------4----><--4---><---2--><---2---><---4--><--------->
+ */
+// PTT Socket App Message Ids
+#define PTT_MSG_READ_REGISTER       0x3040
+#define PTT_MSG_WRITE_REGISTER      0x3041
+#define PTT_MSG_READ_MEMORY         0x3044
+#define PTT_MSG_WRITE_MEMORY        0x3045
+#define PTT_MSG_LOG_DUMP_DBG        0x32A1
+#ifdef ANI_MANF_DIAG
+#define PTT_MSG_FTM_CMDS_TYPE           0x4040
+#endif
+#define ANI_DRIVER_MSG_START         0x0001
+#define ANI_MSG_APP_REG_REQ         (ANI_DRIVER_MSG_START + 0)
+#define ANI_MSG_APP_REG_RSP         (ANI_DRIVER_MSG_START + 1)
+#define ANI_MAX_RADIOS      3
+#define ANI_NL_MSG_OK       0
+#define ANI_NL_MSG_ERROR    -1
+#define ANI_NL_MSG_OVERHEAD (NLMSG_SPACE(tAniHdr + 4))
+/*
+ * Packet Format for READ_REGISTER & WRITE_REGISTER:
+ * TotalMsgLen : 4 bytes  [value=20 bytes]
+ * Radio       : 4 bytes
+ * MsgId       : 2 bytes
+ * MsgLen      : 2 bytes
+ * Status      : 4 bytes
+ * Address     : 4 bytes
+ * Payload     : 4 bytes
+*/
+/*
+ * Packet Format for READ_MEMORY & WRITE_MEMORY :
+ * TotalMsgLen : 4 bytes [value= 20+LEN_PAYLOAD bytes]
+ * Radio       : 4 bytes
+ * MsgId       : 2 bytes
+ * MsgLen      : 2 bytes
+ * Status      : 4 bytes
+ * Address     : 4 bytes
+ * Length      : 4 bytes [LEN_PAYLOAD]
+ * Payload     : LEN_PAYLOAD bytes
+*/
+int ptt_sock_activate_svc(void *pAdapter);
+int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid);
+
+/*
+ * Format of message exchanged between the PTT Socket App in userspace and the
+ * WLAN Driver, in either direction. Each msg will begin with this header and
+ * will followed by the Quarky message
+ */
+typedef struct sAniNlMsg {
+    struct  nlmsghdr nlh;             // Netlink Header
+    int radio;                        // unit number of the radio
+    tAniHdr wmsg;                     // Airgo Message Header
+} tAniNlHdr;
+typedef struct sAniAppRegReq {
+    tAniNlModTypes type;              // module id
+    int pid;                          // process id
+} tAniNlAppRegReq;
+typedef struct sAniNlAppRegRsp {
+    struct nlmsghdr nlh;              // NetLink Msg Header
+    int radio;                        // Radio unit
+    tAniHdr wniHdr;                   // Generic WNI msg header
+    tAniNlAppRegReq regReq;           // The original request msg
+    int ret;                          // Return code
+} tAniNlAppRegRsp;
+#endif
diff --git a/CORE/SVC/src/btc/wlan_btc_svc.c b/CORE/SVC/src/btc/wlan_btc_svc.c
new file mode 100644
index 0000000..6643fab
--- /dev/null
+++ b/CORE/SVC/src/btc/wlan_btc_svc.c
@@ -0,0 +1,246 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+ * wlan_btc_svc.c
+ *
+ ******************************************************************************/
+#include <wlan_nlink_srv.h>
+#include <wlan_btc_svc.h>
+#include <halTypes.h>
+#include <vos_status.h>
+#include <btcApi.h>
+#include <wlan_hdd_includes.h>
+#include <vos_trace.h>
+// Global variables
+static struct hdd_context_s *pHddCtx = NULL;
+
+static int gWiFiChannel = 0;  /* WiFi associated channel 1-13, or 0 (none) */
+static int gAmpChannel = 0;   /* AMP associated channel 1-13, or 0 (none) */
+static int gBtcDriverMode = WLAN_HDD_INFRA_STATION;  /* Driver mode in BTC */
+
+
+// Forward declrarion
+static int btc_msg_callback (struct sk_buff * skb);
+/*
+ * Send a netlink message to the user space. 
+ * Destination pid as zero implies broadcast
+ */
+void send_btc_nlink_msg (int type, int dest_pid)
+{
+   struct sk_buff *skb;
+   struct nlmsghdr *nlh;
+   tAniMsgHdr *aniHdr;
+   tWlanAssocData *assocData;
+   skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
+   if(skb == NULL) {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "BTC: alloc_skb failed\n");
+      return;
+   }   
+   nlh = (struct nlmsghdr *)skb->data;
+   nlh->nlmsg_pid = 0;  /* from kernel */
+   nlh->nlmsg_flags = 0;
+   nlh->nlmsg_seq = 0;
+   nlh->nlmsg_type = WLAN_NL_MSG_BTC;
+   aniHdr = NLMSG_DATA(nlh);
+   aniHdr->type = type;
+
+  /* Set BTC driver mode correctly based on received events type */
+  if(type == WLAN_BTC_SOFTAP_BSS_START)
+  {
+     /* Event is SoftAP BSS Start set BTC driver mode to SoftAP */
+     gBtcDriverMode = WLAN_HDD_SOFTAP;
+  }
+  if(type == WLAN_STA_ASSOC_DONE_IND)
+  {
+     /* Event is STA Assoc done set BTC driver mode to INFRA STA*/
+     gBtcDriverMode = WLAN_HDD_INFRA_STATION;
+  }
+
+   switch( type )
+   {
+      case WLAN_STA_DISASSOC_DONE_IND:
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                    "WiFi unassociated; gAmpChannel %d gWiFiChannel %d", gAmpChannel, gWiFiChannel);
+
+         /* If AMP is using a channel (non-zero), no message sent.
+            Or, if WiFi wasn't using a channel before, no message sent.
+            Logic presumes same channel has to be used for WiFi and AMP if both are active.
+            In any case, track the WiFi channel in use (none) */
+         if((gAmpChannel != 0) || (gWiFiChannel == 0))
+         {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                      "No msg for AFH will be sent");
+            gWiFiChannel = 0;
+            kfree_skb(skb);
+            return;
+         }
+         gWiFiChannel = 0;
+
+         /* No Break: Fall into next cases */
+
+      case WLAN_MODULE_UP_IND:
+      case WLAN_MODULE_DOWN_IND:
+         aniHdr->length = 0; 
+         nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr)));
+         skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr)));
+         break;
+      case WLAN_BTC_SOFTAP_BSS_START:
+      case WLAN_BTC_QUERY_STATE_RSP:
+      case WLAN_STA_ASSOC_DONE_IND:
+         aniHdr->length = sizeof(tWlanAssocData);
+         nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + sizeof(tWlanAssocData)));
+         assocData = ( tWlanAssocData *)((char*)aniHdr + sizeof(tAniMsgHdr));
+         
+         assocData->channel = hdd_get_operating_channel( pHddCtx, gBtcDriverMode );
+
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                    "New WiFi channel %d gAmpChannel %d gWiFiChannel %d",
+                    assocData->channel, gAmpChannel, gWiFiChannel);
+
+         /* If WiFi has finished associating */
+         if(type == WLAN_STA_ASSOC_DONE_IND)
+         {
+           /* If AMP is using a channel (non-zero), no message sent.
+              Or, if the WiFi channel did not change, no message sent.
+              Logic presumes same channel has to be used for WiFi and AMP if both are active.
+              In any case, track the WiFi channel in use (1-13 or none, in assocData->channel) */
+           if((gAmpChannel != 0) || (assocData->channel == gWiFiChannel))
+           {
+             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                        "No msg for AFH will be sent");
+             gWiFiChannel = assocData->channel;
+             kfree_skb(skb);
+             return;
+           }
+         }
+         if(type == WLAN_BTC_SOFTAP_BSS_START)
+         {
+             /*Replace WLAN_BTC_SOFTAP_BSS_START by WLAN_STA_ASSOC_DONE_IND*/
+             aniHdr->type = WLAN_STA_ASSOC_DONE_IND;
+         }
+         gWiFiChannel = assocData->channel;
+         skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr)+ sizeof(tWlanAssocData))));
+         break;
+
+      case WLAN_AMP_ASSOC_DONE_IND:
+
+         /* This is an overloaded type. It means that AMP is connected (dest_pid is channel 1-13),
+            or it means AMP is now disconnected (dest_pid is 0) */
+
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                    "New AMP channel %d gAmpChannel %d gWiFiChannel %d", dest_pid, gAmpChannel, gWiFiChannel);
+         /* If WiFi is using a channel (non-zero), no message sent.
+            Or, if the AMP channel did not change, no message sent.
+            Logic presumes same channel has to be used for WiFi and AMP if both are active.
+            In any case, track the AMP channel in use (1-13 or none, in dest_pid) */
+         if((gWiFiChannel != 0) || (dest_pid == gAmpChannel))
+         {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
+                      "No msg for AFH will be sent");
+            gAmpChannel = dest_pid;
+            kfree_skb(skb);
+            return;
+         }
+
+         gAmpChannel = dest_pid;
+
+         /* Fix overloaded parameters and finish message formatting */
+         if(dest_pid != 0)
+         {
+           aniHdr->type = WLAN_STA_ASSOC_DONE_IND;
+           aniHdr->length = sizeof(tWlanAssocData);
+           nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + sizeof(tWlanAssocData)));
+           assocData = ( tWlanAssocData *)((char*)aniHdr + sizeof(tAniMsgHdr));
+           assocData->channel = dest_pid;
+           skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr)+ sizeof(tWlanAssocData))));
+         }
+         else
+         {
+           aniHdr->type = WLAN_STA_DISASSOC_DONE_IND;
+           aniHdr->length = 0;
+           nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr)));
+           skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr)));
+         }
+         dest_pid = 0;
+         break;
+
+      default:
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+            "BTC: Attempt to send unknown nlink message %d\n", type);
+         return;
+   }
+   if(dest_pid == 0)
+      (void)nl_srv_bcast(skb);
+   else
+      (void)nl_srv_ucast(skb, dest_pid);
+}
+/*
+ * Activate BTC handler. This will register a handler to receive
+ * netlink messages addressed to WLAN_NL_MSG_BTC from user space
+ */
+int btc_activate_service(void *pAdapter)
+{
+   pHddCtx = (struct hdd_context_s*)pAdapter;  
+
+   //Register the msg handler for msgs addressed to ANI_NL_MSG_BTC
+   nl_srv_register(WLAN_NL_MSG_BTC, btc_msg_callback);
+   return 0;
+}
+/*
+ * Callback function invoked by Netlink service for all netlink
+ * messages (from user space) addressed to WLAN_NL_MSG_BTC
+ */
+int btc_msg_callback (struct sk_buff * skb)
+{
+   struct nlmsghdr *nlh;
+   tAniMsgHdr *msg_hdr;
+   tSmeBtEvent *btEvent = NULL;
+   nlh = (struct nlmsghdr *)skb->data;
+   msg_hdr = NLMSG_DATA(nlh);
+   
+   /* Continue with parsing payload. */
+   switch(msg_hdr->type)
+   {
+      case WLAN_BTC_QUERY_STATE_REQ:
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+            "BTC: Received probe from BTC Service\n");
+         send_btc_nlink_msg(WLAN_BTC_QUERY_STATE_RSP, nlh->nlmsg_pid);
+         break;
+      case WLAN_BTC_BT_EVENT_IND:
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+            "BTC: Received Bluetooth event indication\n");
+         if(msg_hdr->length != sizeof(tSmeBtEvent)) {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               "BTC: Size mismatch in BT event data\n");
+            break;
+         }
+         btEvent = (tSmeBtEvent*)((char*)msg_hdr + sizeof(tAniMsgHdr));
+         (void)sme_BtcSignalBtEvent(pHddCtx->hHal, btEvent);
+         break;
+      default:
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+            "BTC: Received Invalid Msg type [%d]\n", msg_hdr->type);
+         break;
+   }
+   return 0;
+}
diff --git a/CORE/SVC/src/nlink/wlan_nlink_srv.c b/CORE/SVC/src/nlink/wlan_nlink_srv.c
new file mode 100644
index 0000000..b2951f2
--- /dev/null
+++ b/CORE/SVC/src/nlink/wlan_nlink_srv.c
@@ -0,0 +1,253 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+* wlan_nlink_srv.c
+*
+* This file contains the definitions specific to the wlan_nlink_srv
+*
+******************************************************************************/
+
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/netdevice.h>
+#include <linux/netlink.h>
+#include <linux/skbuff.h>
+#include <net/sock.h>
+#include <wlan_nlink_srv.h>
+#include <vos_trace.h>
+
+//Global variables
+static DEFINE_MUTEX(nl_srv_sem);
+static struct sock *nl_srv_sock = NULL;
+static nl_srv_msg_callback nl_srv_msg_handler[NLINK_MAX_CALLBACKS];
+
+//Forward declaration
+static void nl_srv_rcv (struct sk_buff *sk);
+static void nl_srv_rcv_skb (struct sk_buff *skb);
+static void nl_srv_rcv_msg (struct sk_buff *skb, struct nlmsghdr *nlh);
+
+/*
+ * Initialize the netlink service.
+ * Netlink service is usable after this.
+ */
+int nl_srv_init(void)
+{
+   int retcode = 0;
+   nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY,
+      WLAN_NLINK_MCAST_GRP_ID, nl_srv_rcv, NULL, THIS_MODULE);
+
+   if (nl_srv_sock != NULL) {
+      memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler));
+   } else {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "NLINK: netlink_kernel_create failed");
+      retcode = -ECONNREFUSED;
+   }
+   return retcode;
+}
+
+/*
+ * Deinit the netlink service.
+ * Netlink service is unusable after this.
+ */
+void nl_srv_exit(void)
+{
+   netlink_kernel_release(nl_srv_sock);
+}
+
+/*
+ * Register a message handler for a specified module.
+ * Each module (e.g. WLAN_NL_MSG_BTC )will register a
+ * handler to handle messages addressed to it.
+ */
+int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
+{
+   int retcode = 0;
+
+   if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
+        msg_handler != NULL)
+   {
+      nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler;
+   }
+   else {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: nl_srv_register failed for msg_type %d", msg_type);
+      retcode = -EINVAL;
+   }
+
+   return retcode;
+}
+/*
+ * Unregister the message handler for a specified module.
+ */
+int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
+{
+   int retcode = 0;
+
+   if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
+       (nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] == msg_handler))
+   {
+      nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = NULL;
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: nl_srv_unregister failed for msg_type %d", msg_type);
+      retcode = -EINVAL;
+   }
+
+   return retcode;
+}
+
+/*
+ * Unicast the message to the process in user space identfied
+ * by the dst-pid
+ */
+int nl_srv_ucast(struct sk_buff *skb, int dst_pid)
+{
+   int err;
+
+   NETLINK_CB(skb).pid = 0; //sender's pid
+   NETLINK_CB(skb).dst_group = 0; //not multicast
+
+   err = netlink_unicast(nl_srv_sock, skb, dst_pid, MSG_DONTWAIT);
+
+   if (err < 0)
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+      "NLINK: netlink_unicast to pid[%d] failed, ret[0x%X]", dst_pid, err);
+
+   return err;
+}
+
+/*
+ *  Broadcast the message. Broadcast will return an error if
+ *  there are no listeners
+ */
+int nl_srv_bcast(struct sk_buff *skb)
+{
+   int err;
+
+   NETLINK_CB(skb).pid = 0; //sender's pid
+   NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID; //destination group
+
+   err = netlink_broadcast(nl_srv_sock, skb, 0, WLAN_NLINK_MCAST_GRP_ID, GFP_KERNEL);
+
+   if (err < 0)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: netlink_broadcast failed err = %d", err);
+   }
+   return err;
+}
+
+/*
+ *  Processes the Netlink socket input queue.
+ *  Dequeue skb's from the socket input queue and process
+ *  all the netlink messages in that skb, before moving
+ *  to the next skb.
+ */
+static void nl_srv_rcv (struct sk_buff *sk)
+{
+   mutex_lock(&nl_srv_sem);
+   nl_srv_rcv_skb(sk);
+   mutex_unlock(&nl_srv_sem);
+}
+
+/*
+ * Each skb could contain multiple Netlink messages. Process all the
+ * messages in one skb and discard malformed skb's silently.
+ */
+static void nl_srv_rcv_skb (struct sk_buff *skb)
+{
+   struct nlmsghdr * nlh;
+
+   while (skb->len >= NLMSG_SPACE(0)) {
+      u32 rlen;
+
+      nlh = (struct nlmsghdr *)skb->data;
+
+      if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "NLINK: Invalid "
+            "Netlink message: skb[0x%X], len[%d], nlhdr[0x%X], nlmsg_len[%d]",
+            (u32)skb, skb->len, (u32)nlh, nlh->nlmsg_len);
+         return;
+      }
+
+      rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+      if (rlen > skb->len)
+         rlen = skb->len;
+      nl_srv_rcv_msg(skb, nlh);
+      skb_pull(skb, rlen);
+   }
+}
+
+/*
+ * Process a netlink message.
+ * Each netlink message will have a message of type tAniMsgHdr inside.
+ */
+static void nl_srv_rcv_msg (struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+   int type;
+
+   /* Only requests are handled by kernel now */
+   if (!(nlh->nlmsg_flags & NLM_F_REQUEST)) {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: Received Invalid NL Req type [%x]", nlh->nlmsg_flags);
+      return;
+   }
+
+   type = nlh->nlmsg_type;
+
+   /* Unknown message */
+   if (type < WLAN_NL_MSG_BASE || type >= WLAN_NL_MSG_MAX) {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: Received Invalid NL Msg type [%x]", type);
+      return;
+   }
+
+   /*
+   * All the messages must at least carry the tAniMsgHdr
+   * Drop any message with invalid length
+   */
+   if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(tAniMsgHdr))) {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: Received NL Msg with invalid len[%x]", nlh->nlmsg_len);
+      return;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+      "NLINK: Received NL msg type [%d]", type);
+
+   // turn type into dispatch table offset
+   type -= WLAN_NL_MSG_BASE;
+
+   // dispatch to handler
+   if (nl_srv_msg_handler[type] != NULL) {
+      (nl_srv_msg_handler[type])(skb);
+   } else {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: No handler for Netlink Msg [0x%X]", type);
+   }
+}
+
diff --git a/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c b/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
new file mode 100644
index 0000000..a63d473
--- /dev/null
+++ b/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
@@ -0,0 +1,303 @@
+/*
+ * 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.
+ */
+
+/******************************************************************************
+ * wlan_ptt_sock_svc.c
+ *
+ ******************************************************************************/
+#ifdef PTT_SOCK_SVC_ENABLE
+#include <wlan_nlink_srv.h>
+#include <halTypes.h>
+#include <vos_status.h>
+#include <wlan_hdd_includes.h>
+#include <vos_trace.h>
+#include <wlan_nlink_common.h>
+#include <wlan_ptt_sock_svc.h>
+#include <vos_types.h>
+#include <vos_trace.h>
+#ifdef ANI_MANF_DIAG
+#include <wlan_hdd_ftm.h>
+#endif
+
+#define PTT_SOCK_DEBUG
+#ifdef PTT_SOCK_DEBUG
+#define PTT_TRACE(level, args...) VOS_TRACE( VOS_MODULE_ID_HDD, level, ## args)
+#else
+#define PTT_TRACE(level, args...)
+#endif
+// Global variables
+static struct hdd_context_s *pAdapterHandle = NULL;
+//Utility function to perform endianess swap
+static void ptt_sock_swap_32(void *pBuffer, unsigned int len)
+{
+    v_U32_t *pBuf32, data;
+    v_U8_t *pBuf8;
+    unsigned int i;
+    len &= ~(sizeof(v_U32_t)-1);
+    pBuf32 = (v_U32_t *) pBuffer;
+    pBuf8 = (v_U8_t *) pBuffer;
+    for (i = 0; i < len; i += 4, ++pBuf32, pBuf8 += 4) {
+        data = *pBuf32;
+        pBuf8[0] = (v_U8_t) ((data >> 24) & 0xff);
+        pBuf8[1] = (v_U8_t) ((data >> 16) & 0xff);
+        pBuf8[2] = (v_U8_t) ((data >> 8) & 0xff);
+        pBuf8[3] = (v_U8_t) ((data >> 0) & 0xff);
+    }
+}
+#ifdef PTT_SOCK_DEBUG_VERBOSE
+//Utility function to perform a hex dump
+static void ptt_sock_dump_buf(const unsigned char * pbuf, int cnt)
+{
+    int i;
+    for (i = 0; i < cnt ; i++) {
+        if ((i%16)==0)
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"\n%p:", pbuf);
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO," %02X", *pbuf);
+        pbuf++;
+    }
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"\n");
+}
+#endif
+//Utility function to send a netlink message to an application in user space
+int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid)
+{
+   int err = -1;
+   int payload_len;
+   int tot_msg_len;
+   tAniNlHdr *wnl;
+   struct sk_buff *skb;
+   struct nlmsghdr *nlh;
+   int wmsg_length = be16_to_cpu(wmsg->length);
+   static int nlmsg_seq = 0;
+   if (radio < 0 || radio > ANI_MAX_RADIOS) {
+      PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: invalid radio id [%d]\n",
+         __FUNCTION__, radio);
+      return -1;
+   }
+   payload_len = wmsg_length + 4;  // 4 extra bytes for the radio idx
+   tot_msg_len = NLMSG_SPACE(payload_len);
+   if ((skb = dev_alloc_skb(tot_msg_len)) == NULL) {
+      PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: dev_alloc_skb() failed for msg size[%d]\n",
+         __FUNCTION__, tot_msg_len);
+      return -1;
+   }
+   nlh = NLMSG_PUT(skb, pid, nlmsg_seq++, src_mod, payload_len);
+   nlh->nlmsg_flags = NLM_F_REQUEST;
+   wnl = (tAniNlHdr *) nlh;
+   wnl->radio = radio;
+   memcpy(&wnl->wmsg, wmsg, wmsg_length);
+   PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Sending Msg Type [0x%X] to pid[%d]\n",
+      __FUNCTION__, be16_to_cpu(wmsg->type), pid);
+#ifdef PTT_SOCK_DEBUG_VERBOSE
+   ptt_sock_dump_buf((const unsigned char *)skb->data, skb->len);
+#endif
+   err = nl_srv_ucast(skb, pid);
+nlmsg_failure:
+   return err;
+}
+/*
+ * Process tregisteration request and send registration response messages
+ * to the PTT Socket App in user space
+ */
+static void ptt_sock_proc_reg_req(tAniHdr *wmsg, int radio)
+{
+   tAniNlAppRegReq *reg_req;
+   tAniNlAppRegRsp rspmsg;
+   reg_req = (tAniNlAppRegReq *)(wmsg + 1);
+   memset((char *)&rspmsg, 0, sizeof(rspmsg));
+   //send reg response message to the application
+   rspmsg.ret = ANI_NL_MSG_OK;
+   rspmsg.regReq.type = reg_req->type;
+   /*Save the pid*/    
+   pAdapterHandle->ptt_pid = reg_req->pid;   
+   rspmsg.regReq.pid= reg_req->pid;
+   rspmsg.wniHdr.type = cpu_to_be16(ANI_MSG_APP_REG_RSP);
+   rspmsg.wniHdr.length = cpu_to_be16(sizeof(rspmsg));
+   if (ptt_sock_send_msg_to_app((tAniHdr *)&rspmsg.wniHdr, radio,
+      ANI_NL_MSG_PUMAC, reg_req->pid) < 0)
+   {
+      PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Error sending ANI_MSG_APP_REG_RSP to pid[%d]\n",
+         __FUNCTION__, reg_req->pid);
+   }
+}
+/*
+ * Process all the messages from the PTT Socket App in user space
+ */
+static void ptt_proc_pumac_msg(struct sk_buff * skb, tAniHdr *wmsg, int radio)
+{
+   u16 ani_msg_type = be16_to_cpu(wmsg->type);
+   switch(ani_msg_type)
+   {
+      case ANI_MSG_APP_REG_REQ:
+         PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Received ANI_MSG_APP_REG_REQ [0x%X]\n",
+            __FUNCTION__, ani_msg_type);
+         ptt_sock_proc_reg_req(wmsg, radio);
+         break;
+      default:
+         PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Received Unknown Msg Type[0x%X]\n",
+            __FUNCTION__, ani_msg_type);
+         break;
+   }
+}
+/*
+ * Process all the messages from the Quarky Client
+ */
+static void ptt_proc_quarky_msg(tAniNlHdr *wnl, tAniHdr *wmsg, int radio)
+{
+   u16 ani_msg_type = be16_to_cpu(wmsg->type);
+   v_U32_t reg_addr;
+   v_U32_t reg_val;
+   v_U32_t len_payload;
+   v_U8_t* buf;
+   unsigned int arg1, arg2, arg3, arg4, cmd;
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   if (radio < 0 || radio > ANI_MAX_RADIOS) {
+      PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: ANI Msg [0x%X] invalid radio id [%d]\n",
+         __FUNCTION__, ani_msg_type, radio);
+      return;
+   }
+   if(ani_msg_type == ANI_MSG_APP_REG_REQ)
+   {
+      ptt_sock_proc_reg_req(wmsg, radio);
+   }
+   else
+   {
+      switch (ani_msg_type)
+      {
+         case PTT_MSG_READ_REGISTER:
+            reg_addr = *(v_U32_t*) ((char*)wmsg + 8);
+            PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: PTT_MSG_READ_REGISTER [0x%08lX]\n",
+               __FUNCTION__, reg_addr);
+            vosStatus = sme_DbgReadRegister(pAdapterHandle->hHal, reg_addr, &reg_val);
+            *(v_U32_t*) ((char*)wmsg + 12) = reg_val;
+            if(vosStatus != VOS_STATUS_SUCCESS)
+               PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Read Register [0x%08lX] failed!!\n",
+               __FUNCTION__, reg_addr);
+            ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, wnl->nlh.nlmsg_pid);
+            break;
+         case PTT_MSG_WRITE_REGISTER:
+            reg_addr = *(v_U32_t*) ((const unsigned char*)wmsg + 8);
+            reg_val = *(v_U32_t*)((const unsigned char*)wmsg + 12);
+            PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: PTT_MSG_WRITE_REGISTER Addr [0x%08lX] value [0x%08lX]\n",
+               __FUNCTION__, reg_addr, reg_val);
+            vosStatus = sme_DbgWriteRegister(pAdapterHandle->hHal, reg_addr, reg_val);
+            if(vosStatus != VOS_STATUS_SUCCESS)
+            {
+               PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Write Register [0x%08lX] value [0x%08lX] failed!!\n",
+                  __FUNCTION__, reg_addr, reg_val);
+            }
+            //send message to the app
+            ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, wnl->nlh.nlmsg_pid);
+            break;
+         case PTT_MSG_READ_MEMORY:
+            reg_addr = *(v_U32_t*) ((char*)wmsg + 8);
+            len_payload = *(v_U32_t*) ((char*)wmsg + 12);
+            PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: PTT_MSG_READ_MEMORY addr [0x%08lX] bytes [0x%08lX]\n",
+               __FUNCTION__, reg_addr, len_payload);
+            buf = (v_U8_t*)wmsg + 16;
+            vosStatus = sme_DbgReadMemory(pAdapterHandle->hHal, reg_addr, buf, len_payload);
+            if(vosStatus != VOS_STATUS_SUCCESS) {
+               PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Memory read failed for [0x%08lX]!!\n",
+                  __FUNCTION__, reg_addr);
+            }
+            ptt_sock_swap_32(buf, len_payload);
+            //send message to the app
+            ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, wnl->nlh.nlmsg_pid);
+            break;
+         case PTT_MSG_WRITE_MEMORY:
+            reg_addr = *(v_U32_t*) ((char*)wmsg + 8);
+            len_payload = *(v_U32_t*) ((char*)wmsg + 12);
+            PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: PTT_MSG_DBG_WRITE_MEMORY addr [0x%08lX] bytes [0x%08lX]\n",
+               __FUNCTION__, reg_addr, len_payload);
+            buf = (v_U8_t*)wmsg + 16;
+            ptt_sock_swap_32(buf, len_payload);
+            vosStatus = sme_DbgWriteMemory(pAdapterHandle->hHal, reg_addr, buf, len_payload);
+            if(vosStatus != VOS_STATUS_SUCCESS)
+            {
+               PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Memory write failed for addr [0x%08lX]!!\n",
+                  __FUNCTION__, reg_addr);
+            }
+            //send message to the app
+            ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, wnl->nlh.nlmsg_pid);
+            break;
+         case PTT_MSG_LOG_DUMP_DBG:
+            cmd = *(unsigned int *) ((char *)wmsg + 8);
+            arg1 = *(unsigned int *) ((char *)wmsg + 12);
+            arg2 = *(unsigned int *) ((char *)wmsg + 16);
+            arg3 = *(unsigned int *) ((char *)wmsg + 20);
+            arg4 = *(unsigned int *) ((char *)wmsg + 24);
+            PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: PTT_MSG_LOG_DUMP_DBG %d arg1 %d arg2 %d arg3 %d arg4 %d\n",
+               __FUNCTION__, cmd, arg1, arg2, arg3, arg4);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+            // FIXME_PRIMA -- need logDump() replacement
+            logPrintf(pAdapterHandle->hHal, cmd, arg1, arg2, arg3, arg4);
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+            //send message to the app
+            ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, wnl->nlh.nlmsg_pid);
+            break;
+#ifdef ANI_MANF_DIAG
+         case PTT_MSG_FTM_CMDS_TYPE:
+            wlan_hdd_process_ftm_cmd(pAdapterHandle,wnl);
+            break;
+#endif
+         default:
+            PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Unknown ANI Msg [0x%X], length [0x%X]\n",
+               __FUNCTION__, ani_msg_type, be16_to_cpu(wmsg->length ));
+            break;
+      }
+   }
+}
+/*
+ * Process all the Netlink messages from PTT Socket app in user space
+ */
+static int ptt_sock_rx_nlink_msg (struct sk_buff * skb)
+{
+   tAniNlHdr *wnl;
+   int radio;
+   int type;
+   wnl = (tAniNlHdr *) skb->data;
+   radio = wnl->radio;
+   type = wnl->nlh.nlmsg_type;
+   switch (type) {
+      case ANI_NL_MSG_PUMAC:  //Message from the PTT socket APP
+         PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Received ANI_NL_MSG_PUMAC Msg [0x%X]\n",
+            __func__, type, radio);
+         ptt_proc_pumac_msg(skb, &wnl->wmsg, radio);
+         break;
+      case ANI_NL_MSG_PTT: //Message from Quarky GUI
+         PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Received ANI_NL_MSG_PTT Msg [0x%X]\n",
+            __func__, type, radio);
+         ptt_proc_quarky_msg(wnl, &wnl->wmsg, radio);
+         break;
+      default:
+         PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Unknown NL Msg [0x%X]\n",__func__, type);
+         break;
+   }
+   return 0;
+}
+int ptt_sock_activate_svc(void *pAdapter)
+{
+   pAdapterHandle = (struct hdd_context_s*)pAdapter;
+   nl_srv_register(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg);
+   nl_srv_register(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg);
+   return 0;
+}
+#endif //PTT_SOCK_SVC_ENABLE
diff --git a/CORE/SYS/common/inc/wlan_qct_sys.h b/CORE/SYS/common/inc/wlan_qct_sys.h
new file mode 100644
index 0000000..b5800d9
--- /dev/null
+++ b/CORE/SYS/common/inc/wlan_qct_sys.h
@@ -0,0 +1,424 @@
+/*
+ * 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_QCT_SYS_H__ )
+#define WLAN_QCT_SYS_H__
+
+/**===========================================================================
+
+  \file  wlan_qct_sys.h
+
+  \brief System module API
+
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+
+  ==========================================================================*/
+
+/* $HEADER$ */
+
+/*---------------------------------------------------------------------------
+  Include files
+  -------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+#include <vos_mq.h>
+
+/*---------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------
+  Type declarations
+  -------------------------------------------------------------------------*/
+
+  /*----------------------------------------------------------------------------
+
+  \brief sysResponseCback() - SYS async resonse callback
+
+  This is a protype for the callback function that SYS makes to various
+  modules in the system.
+
+  \param  pUserData - user data that is passed to the Callback function
+                      when it is invoked.
+
+  \return Nothing
+
+  \sa sysMcStart(), sysMcThreadProbe(), sysTxThreadProbe()
+
+  --------------------------------------------------------------------------*/
+typedef v_VOID_t ( * sysResponseCback ) ( v_VOID_t *pUserData );
+
+
+
+typedef enum
+{
+   SYS_MSG_ID_MC_START,
+   SYS_MSG_ID_MC_THR_PROBE,
+   SYS_MSG_ID_MC_TIMER,
+
+   SYS_MSG_ID_TX_THR_PROBE,
+   SYS_MSG_ID_TX_TIMER,
+
+   SYS_MSG_ID_RX_TIMER,
+
+   SYS_MSG_ID_MC_STOP,
+
+} SYS_MSG_ID;
+
+/*---------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  -------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  Function declarations and documenation
+  -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  \brief sysBuildMessageHeader() - Build / initialize a SYS message header
+
+  This function will initialize the SYS message header with the message type
+  and any internal fields needed for a new SYS message.  This function sets
+  all but the message body, which is up to the caller to setup based on the
+  specific message being built.
+
+  \note There are internal / reserved items in a SYS message that must be
+        set correctly for the message to be recognized as a SYS message by
+        the SYS message handlers.  It is important for every SYS message to
+        be setup / built / initialized through this function.
+
+  \param sysMsgId - a valid message ID for a SYS message.  See the
+         SYS_MSG_ID enum for all the valid SYS message IDs.
+
+  \param pMsg - pointer to the message structure to be setup.
+
+  \return
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysBuildMessageHeader( SYS_MSG_ID sysMsgId, vos_msg_t *pMsg );
+
+/*----------------------------------------------------------------------------
+
+  \brief sysOpen() - Open (initialize) the SYS module.
+
+  This function opens the SYS modules.  All SYS resources are allocated
+  as a result of this open call.
+
+  \param pVosContext - pointer to the VOS Context (from which all other
+         context entities can be derived).
+
+  \return VOS_STATUS_SUCCESS - the SYS module is open.  All resources needed
+          for operation of the SYS modules are allocated and initialized.
+
+          VOS_STATUS_E_RESOURCES - the SYS module open failed because needed
+          system resources are not available.
+
+          VOS_STATUS_E_FAILURE - the SYS module open failed due to some
+          unknown reason.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysOpen( v_CONTEXT_t pVosContext );
+
+
+/*----------------------------------------------------------------------------
+
+  \brief sysMcStart() - start the system Main Controller thread.
+
+  This function starts the SYS (Main Controller) module.  Starting this
+  module triggers the CFG download to the 'legacy' MAC software.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param userCallback - this is a callback that is called when the SYS
+         has completed the 'start' funciton.
+
+  \param pUserData - pointer to some user data entity that is passed to
+         the callback function as a parameter when invoked.
+
+  \return VOS_STATUS_SUCCESS -
+
+  \todo:  We have not 'status' on the callback.  How do we notify the
+          callback that there is a failure ?
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysMcStart( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
+                       v_VOID_t *pUserData );
+
+
+/*----------------------------------------------------------------------------
+
+  \brief sysStop() - Stop the SYS module.
+
+  This function stops the SYS module.
+
+  \todo: What else do we need to do on sysStop()?
+
+  \param pVosContext - pointer to the VOS Context
+
+  \return VOS_STATUS_SUCCESS - the SYS module is stopped.
+
+          VOS_STATUS_E_FAILURE - the SYS module open failed to stop.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysStop( v_CONTEXT_t pVosContext );
+
+
+/*----------------------------------------------------------------------------
+
+  \brief sysClose() - Close the SYS module.
+
+  This function closes the SYS module.  All resources allocated during
+  sysOpen() are free'd and returned to the system.  The Sys module is unable
+  to operate until opened again through a call to sysOpen().
+
+  \param pVosContext - pointer to the VOS Context
+
+  \return VOS_STATUS_SUCCESS - the SYS module is closed.
+
+          VOS_STATUS_E_FAILURE - the SYS module open failed to close
+
+  \sa sysOpen(), sysMcStart()
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysClose( v_CONTEXT_t pVosContext );
+
+
+/*----------------------------------------------------------------------------
+
+  \brief sysMcThreadProbe() - Probe the SYS Main Controller thread
+
+  This function is called during initialization to 'probe' the Main Controller
+  thread.  Probing means a specific message is posted to the SYS module to
+  assure the Main Controller thread is operating and processing messages
+  correctly.
+
+  Following the successful 'probe' of the Main Controller thread, the
+  callback specified on this function is called to notify another entity
+  that the Main Controller is operational.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param userCallback - this is a callback that is called when the SYS
+         has completed probing the Main Controller thread.
+
+  \param pUserData - pointer to some user data entity that is passed to
+         the callback function as a parameter when invoked.
+
+  \return VOS_STATUS_SUCCESS -
+          \todo: how do we tell the callback there is a failure?
+
+  \sa sysOpen(), sysMcStart()
+
+  --------------------------------------------------------------------------*/
+v_VOID_t sysMcThreadProbe( v_CONTEXT_t pVosContex, sysResponseCback userCallback,
+                           v_VOID_t *pUserData );
+
+/*----------------------------------------------------------------------------
+
+  \brief sysTxThreadProbe() - Probe the Tx thread
+
+  This function is called during initialization to 'probe' the Tx
+  thread.  Probing means a specific message is posted to the SYS module to
+  assure the Tx is operating and processing messages correctly.
+
+  Following the successful 'probe' of the Tx, the callback specified
+  on this function is called to notify another entity that the Tx thread
+  is operational.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param userCallback - this is a callback that is called when the SYS
+         has completed probing the Tx thread.
+
+  \param pUserData - pointer to some user data entity that is passed to
+         the callback function as a parameter when invoked.
+
+  \return VOS_STATUS_SUCCESS -
+          \todo: how do we tell the callback there is a failure?
+
+  \sa sysOpen(), sysMcStart()
+
+  --------------------------------------------------------------------------*/
+v_VOID_t sysTxThreadProbe( v_CONTEXT_t pVosContex, sysResponseCback userCallback,
+                           v_VOID_t *pUserData );
+
+/*----------------------------------------------------------------------------
+
+  \brief sysMcProcessMsg() - process SYS messages on the Main Controller thread
+
+  This function processes SYS Messages on the Main Controller thread.
+  SYS messages consist of all 'legacy' messages (messages bound for legacy
+  modules like LIM, HAL, PE, etc.) as well as newly defined SYS message
+  types.
+
+  SYS messages are identified by their type (in the SYS_MESSAGES enum) as
+  well as a 'cookie' that is in the reserved field of the message structure.
+  This 'cookie' is introduced to prevent any message type/ID conflicts with
+  the 'legacy' message types.
+
+  Any module attempting to post a message to the SYS module must set the
+  message type to one of the types in the SYS_MESSAGE enum *and* must also
+  set the Reserved field in the message body to SYS_MSG_COOKIE.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param pMsg - pointer to the message to be processed.
+
+  \return - VOS_STATUS_SUCCESS - the message was processed successfully.
+
+            VOS_STATUS_E_BADMSG - a bad (unknown type) message was received
+            and subsequently not processed.
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysMcProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t* pMsg );
+
+/*----------------------------------------------------------------------------
+
+  \brief sysTxProcessMsg() - process SYS messages on the Tx thread
+
+  This function processes SYS Messages on the Tx thread.
+  SYS messages consist of all 'legacy' messages (messages bound for legacy
+  modules like LIM, HAL, PE, etc.) as well as newly defined SYS message
+  types.
+
+  SYS messages are identified by their type (in the SYS_MESSAGES enum) as
+  well as a 'cookie' that is in the reserved field of the message structure.
+  This 'cookie' is introduced to prevent any message type/ID conflicts with
+  the 'legacy' message types.
+
+  Any module attempting to post a message to the SYS module must set the
+  message type to one of the types in the SYS_MESSAGE enum *and* must also
+  set the Reserved field in the message body to SYS_MSG_COOKIE.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param pMsg - pointer to the message to be processed.
+
+  \return - VOS_STATUS_SUCCESS - the message was processed successfully.
+
+            VOS_STATUS_E_BADMSG - a bad (unknown type) message was received
+            and subsequently not processed.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysTxProcessMsg( v_CONTEXT_t pVContext, vos_msg_t* pMsg );
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*----------------------------------------------------------------------------
+
+  \brief sysTxProcessMsg() - process SYS messages on the Rx thread
+
+  This function processes SYS Messages on the Rx thread.
+  SYS messages consist of all 'legacy' messages (messages bound for legacy
+  modules like LIM, HAL, PE, etc.) as well as newly defined SYS message
+  types.
+
+  SYS messages are identified by their type (in the SYS_MESSAGES enum) as
+  well as a 'cookie' that is in the reserved field of the message structure.
+  This 'cookie' is introduced to prevent any message type/ID conflicts with
+  the 'legacy' message types.
+
+  Any module attempting to post a message to the SYS module must set the
+  message type to one of the types in the SYS_MESSAGE enum *and* must also
+  set the Reserved field in the message body to SYS_MSG_COOKIE.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param pMsg - pointer to the message to be processed.
+
+  \return - VOS_STATUS_SUCCESS - the message was processed successfully.
+
+            VOS_STATUS_E_BADMSG - a bad (unknown type) message was received
+            and subsequently not processed.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS sysRxProcessMsg( v_CONTEXT_t pVContext, vos_msg_t* pMsg );
+#endif
+
+/*----------------------------------------------------------------------------
+
+  \brief sysMcFreeMsg() - free a message queue'd to the Main Controller thread
+
+  This fnction will free a SYS Message that is pending in the main controller
+  thread queue.  These messages are free'd when the message queue needs to be
+  purged, for example during a Reset of Shutdown of the system.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param pMsg - the message to be free'd
+
+  \return Nothing.
+
+  --------------------------------------------------------------------------*/
+v_VOID_t sysMcFreeMsg( v_CONTEXT_t pVosContext, vos_msg_t* pMsg );
+
+/*----------------------------------------------------------------------------
+
+  \brief sysTxFreeMsg() - free a message queue'd to the Tx thread
+
+  This fnction will free a SYS Message that is pending in the Tx
+  thread queue.  These messages are free'd when the message queue needs to be
+  purged, for example during a Reset of Shutdown of the system.
+
+  \param pVosContext - pointer to the VOS Context
+
+  \param pMsg - the message to be free'd
+
+  \return Nothing.
+
+  --------------------------------------------------------------------------*/
+v_VOID_t sysTxFreeMsg( v_CONTEXT_t pVContext, vos_msg_t* pMsg );
+
+/*----------------------------------------------------------------------------
+
+  \brief wlan_sys_ftm() - FTM Cmd Response from halPhy
+
+  This fnction is called by halPhy and carried the FTM command response.
+  This message is handled by SYS thread and finally the message will be convyed to used space
+
+
+  \param pttMsgBuffer - pointer to the pttMsgBuffer
+
+
+  \return Nothing.
+
+  --------------------------------------------------------------------------*/
+
+void wlan_sys_ftm(void *pMsgPtr);
+
+
+#endif  // WLAN_QCT_SYS_H__
+
diff --git a/CORE/SYS/common/src/wlan_qct_sys.c b/CORE/SYS/common/src/wlan_qct_sys.c
new file mode 100644
index 0000000..9479442
--- /dev/null
+++ b/CORE/SYS/common/src/wlan_qct_sys.c
@@ -0,0 +1,1242 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+               W L A N   S Y S T E M   M O D U L E
+
+
+DESCRIPTION
+  This file contains the system module that implements the 'exectution model'
+  in the Gen6 host software.
+
+
+  Copyright (c) 2008 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
+--------    ---         -----------------------------------------------------
+12/15/08    sho         Resolved AMSS compiler errors and warnings when this
+                        is being ported from WM
+07/02/08    lac         Added support for eWNI_SME_START_REQ/RSP in init seq
+06/26/08    hba         Added implementation of mbReceiveMBMsg()
+06/26/08    lac         Created module.
+
+===========================================================================*/
+
+
+#include <wlan_qct_sys.h>
+#include <vos_api.h>
+
+#include <sirTypes.h>   // needed for tSirRetStatus
+#include <sirParams.h>  // needed for tSirMbMsg
+#include <sirApi.h>     // needed for SIR_... message types
+#include <wniApi.h>     // needed for WNI_... message types
+#include "aniGlobal.h"
+#include "wlan_qct_wda.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include <halCommonApi.h>  // needed for halMmhPostMsgApi()
+#endif
+#include "sme_Api.h"
+#include "macInitApi.h"
+
+#ifndef WLAN_FTM_STUB
+VOS_STATUS WLANFTM_McProcessMsg (v_VOID_t *message);
+
+#endif
+
+
+// Cookie for SYS messages.  Note that anyone posting a SYS Message has to
+// write the COOKIE in the reserved field of the message.  The SYS Module
+// relies on this COOKIE
+#ifndef WLAN_FTM_STUB
+#define SYS_MSG_ID_FTM_RSP      11
+#define FTM_SYS_MSG_COOKIE      0xFACE
+#endif
+
+#define SYS_MSG_COOKIE ( 0xFACE )
+
+// need to define FIELD_OFFSET for non-WM platforms
+#ifndef FIELD_OFFSET
+#define FIELD_OFFSET(x,y) offsetof(x,y)
+#endif
+
+VOS_STATUS sys_SendSmeStartReq( v_CONTEXT_t pVosContext );
+
+// add this to the sys Context data... ?
+typedef struct
+{
+   sysResponseCback mcStartCB;
+   v_VOID_t *       mcStartUserData;
+
+} sysContextData;
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+// keep some static global sys context for the time being... Should we move this
+// into 'context' data?  Probably not, it doesn't need to be persistent except
+// during this messaging sequence.
+static sysContextData gSysContext;
+#endif
+
+static vos_event_t gStopEvt;
+
+VOS_STATUS sysBuildMessageHeader( SYS_MSG_ID sysMsgId, vos_msg_t *pMsg )
+{
+   pMsg->type     = sysMsgId;
+   pMsg->reserved = SYS_MSG_COOKIE;
+
+   return( VOS_STATUS_SUCCESS );
+}
+
+
+VOS_STATUS sysOpen( v_CONTEXT_t pVosContext )
+{
+   return( VOS_STATUS_SUCCESS );
+}
+
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+VOS_STATUS sysMcStart( v_CONTEXT_t pVosContext, sysResponseCback userCallback, v_VOID_t *pUserData )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t sysMsg;
+
+   sysBuildMessageHeader( SYS_MSG_ID_MC_START, &sysMsg );
+
+   // Save the user callback and user data to callback in the body pointer
+   // and body data portion of the message.
+   // finished.
+   sysMsg.bodyptr = (void *)userCallback;
+   sysMsg.bodyval = (v_U32_t)pUserData;
+
+   // post the message..
+   vosStatus = vos_mq_post_message( VOS_MQ_ID_SYS, &sysMsg );
+   if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+   return( vosStatus );
+}
+#endif  /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+v_VOID_t sysStopCompleteCb
+(
+  v_VOID_t *pUserData
+)
+{
+  vos_event_t* pStopEvt = (vos_event_t *) pUserData;
+  VOS_STATUS vosStatus;
+/*-------------------------------------------------------------------------*/
+
+  vosStatus = vos_event_set( pStopEvt );
+  VOS_ASSERT( VOS_IS_STATUS_SUCCESS ( vosStatus ) );
+
+} /* vos_sys_stop_complete_cback() */
+
+VOS_STATUS sysStop( v_CONTEXT_t pVosContext )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t sysMsg;
+   v_U8_t evtIndex;
+
+   /* Initialize the stop event */
+   vosStatus = vos_event_init( &gStopEvt );
+
+   if(! VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      return vosStatus;
+   }
+
+   /* post a message to SYS module in MC to stop SME and MAC */
+   sysBuildMessageHeader( SYS_MSG_ID_MC_STOP, &sysMsg );
+
+   // Save the user callback and user data to callback in the body pointer
+   // and body data portion of the message.
+   // finished.
+   sysMsg.bodyptr = (void *)sysStopCompleteCb;
+   sysMsg.bodyval = (v_U32_t) &gStopEvt;
+
+   // post the message..
+   vosStatus = vos_mq_post_message( VOS_MQ_ID_SYS, &sysMsg );
+   if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+   vosStatus = vos_wait_events( &gStopEvt, 1, 0, &evtIndex );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS ( vosStatus ) );
+
+   vosStatus = vos_event_destroy( &gStopEvt );
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS ( vosStatus ) );
+
+   return( vosStatus );
+}
+
+
+VOS_STATUS sysClose( v_CONTEXT_t pVosContext )
+{
+   return( VOS_STATUS_SUCCESS );
+}
+
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+static VOS_STATUS sys_PostMcThreadProbeMsg( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
+                                          v_VOID_t *pUserData, SYS_MSG_ID sysMsgId )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t sysMsg;
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+ /*----------------------------------------------------------------------------------------*/
+
+   sysBuildMessageHeader( sysMsgId, &sysMsg );
+
+
+   // Save the user callback and user data to callback in the body pointer
+   // and body data portion of the message.
+   sysMsg.bodyptr = (void *)userCallback;
+   sysMsg.bodyval = (v_U32_t)pUserData;
+
+   // Post the message...
+   vosStatus = vos_mq_post_message( VOS_MQ_ID_SYS, &sysMsg );
+
+   if ( eSIR_SUCCESS != sirStatus )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+   return( vosStatus );
+}
+
+
+static VOS_STATUS sys_PostTxThreadProbeMsg( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
+                                          v_VOID_t *pUserData, SYS_MSG_ID sysMsgId )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t sysMsg;
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+ /*----------------------------------------------------------------------------------------*/
+
+   sysBuildMessageHeader( sysMsgId, &sysMsg );
+
+
+   // Save the user callback and user data to callback in the body pointer
+   // and body data portion of the message.
+   sysMsg.bodyptr = (void *)userCallback;
+   sysMsg.bodyval = (v_U32_t)pUserData;
+
+   // Post the message...
+   vosStatus = vos_tx_mq_serialize( VOS_MQ_ID_SYS, &sysMsg );
+
+   if ( eSIR_SUCCESS != sirStatus )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+   return( vosStatus );
+}
+
+
+v_VOID_t sysMcThreadProbe( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
+                           v_VOID_t *pUserData )
+{
+   VOS_STATUS vosStatus;
+
+   vosStatus = sys_PostMcThreadProbeMsg( pVosContext, userCallback, pUserData,
+                                       SYS_MSG_ID_MC_THR_PROBE );
+
+   if (VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      // we could have place the above condition within VOS_ASSERT, but
+      // unfortunately that would cause a compiler warning
+      VOS_ASSERT( 1 );
+   }
+   // !! no way to fail ??
+}
+
+
+v_VOID_t sysTxThreadProbe( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
+                           v_VOID_t *pUserData )
+{
+   VOS_STATUS vosStatus;
+
+   vosStatus = sys_PostTxThreadProbeMsg( pVosContext, userCallback, pUserData,
+                                       SYS_MSG_ID_TX_THR_PROBE );
+
+   if (VOS_IS_STATUS_SUCCESS( vosStatus ))
+   {
+      // we could have place the above condition within VOS_ASSERT, but
+      // unfortunately that would cause a compiler warning
+      VOS_ASSERT( 1 );
+   }
+   // !! no way to fail ??
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+static VOS_STATUS sys_SendHalInitStartReqMsg( v_CONTEXT_t pVosContext )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   tSirMbMsg msg;
+
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+   tSirMbMsg *pMsg = &msg;
+   v_VOID_t *hHal;
+
+   do
+   {
+      // get the HAL context...
+      hHal = vos_get_context( VOS_MODULE_ID_HAL, pVosContext );
+      if ( NULL == hHal ) break;
+
+     // format the Init start request message.  This message has
+     // the hal handle in the 'data' portion of the message.
+     pMsg->type = WDA_INIT_START_REQ;
+     pMsg->data[0] = (tANI_U32)hHal;
+
+     // message length is 4 greater than the config data size
+     // need to add in an extra 4 for the message header.
+     pMsg->msgLen = sizeof( tHalHandle ) + FIELD_OFFSET( tSirMbMsg, data );
+
+     // Send the HAL Init Start Request message...
+     sirStatus = uMacPostCtrlMsg( hHal, pMsg );
+     if ( eSIR_SUCCESS != sirStatus )
+     {
+        vosStatus = VOS_STATUS_E_FAILURE;
+     }
+
+  } while( 0 );
+
+   return( vosStatus );
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+#if defined(__ANI_COMPILER_PRAGMA_PACK_STACK)
+#pragma pack( push )
+#pragma pack( 1 )
+#elif defined(__ANI_COMPILER_PRAGMA_PACK)
+#pragma pack( 1 )
+#endif
+
+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;
+
+#if defined(__ANI_COMPILER_PRAGMA_PACK_STACK)
+#pragma pack( pop )
+#endif
+
+
+static 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 ) );
+}
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+static v_BOOL_t sys_validateStaConfig( void *pImage, unsigned long cbFile,
+   void **ppStaConfig, v_SIZE_t *pcbStaConfig )
+#else
+v_BOOL_t sys_validateStaConfig( void *pImage, unsigned long cbFile,
+   void **ppStaConfig, v_SIZE_t *pcbStaConfig )
+#endif
+{
+   v_BOOL_t fFound = VOS_FALSE;
+   tPolFileHeader   *pFileHeader = NULL;
+   tPolFileDirEntry *pDirEntry = NULL;
+   v_U32_t idx;
+
+   do
+   {
+      // Compute the checksum before bothering to copy...
+      if ( polFileChkSum( ( v_U16_t *)pImage, cbFile / sizeof( v_U16_t ) ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to validate the checksum for CFG binary"  );
+         break;
+      }
+
+      pFileHeader = (tPolFileHeader *)pImage;
+
+      *ppStaConfig = NULL;
+      *pcbStaConfig = 0;
+
+      pDirEntry = ( tPolFileDirEntry* ) ( pFileHeader + 1 );
+
+      for ( idx = 0; idx < pFileHeader->NumDirectoryEntries; ++idx )
+      {
+         if ( ePOL_DIR_TYPE_STA_CONFIG == pDirEntry[ idx ].DirEntryType )
+         {
+            *ppStaConfig = pDirEntry[ idx ].DirEntryFileOffset + ( v_U8_t * )pFileHeader;
+
+            *pcbStaConfig = pDirEntry[ idx ].DirEntryLength;
+
+            break;
+         }
+
+      } // End iteration over the header's entries
+
+      if ( NULL != *ppStaConfig  )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO_LOW,
+                    "Found the Station CFG in the CFG binary!!" );
+
+         fFound = VOS_TRUE;
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to find Station CFG in the CFG binary" );
+      }
+
+   } while( 0 );
+
+   VOS_ASSERT( VOS_TRUE == fFound );
+
+   return( fFound );
+}
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+static v_U8_t _vImageArray[15000];
+
+static VOS_STATUS sys_getCfgBinaryMsgBuffer( tSirMbMsg **ppMsg, v_SIZE_t *pcbCfgBinary )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+
+   v_VOID_t *pFileImage = NULL;
+   v_SIZE_t cbFileImage = 0;
+
+   v_VOID_t *pCfgBinary = NULL;
+   v_SIZE_t cbCfgBinary = 0;
+
+   v_BOOL_t bStatus = VOS_FALSE;
+
+   do
+   {
+      // get the number of bytes in the CFG Binary...
+      vosStatus = vos_get_binary_blob( VOS_BINARY_ID_CONFIG, NULL, &cbFileImage );
+      if ( VOS_STATUS_E_NOMEM != vosStatus )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Error obtaining binary size" );
+         break;
+      }
+
+      // malloc a buffer to read in the Configuration binary file.
+      //pFileImage = vos_mem_malloc( cbFileImage );
+      pFileImage = (v_VOID_t*)_vImageArray;
+
+      if ( NULL == pFileImage )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Unable to allocate memory for the CFG binary [size= %d bytes]",
+                    cbFileImage );
+
+         vosStatus = VOS_STATUS_E_NOMEM;
+         break;
+      }
+
+      // Get the entire CFG file image...
+      vosStatus = vos_get_binary_blob( VOS_BINARY_ID_CONFIG, pFileImage, &cbFileImage );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Error: Cannot retrieve CFG fine image from vOSS. [size= %d bytes]",
+                    cbFileImage );
+         break;
+      }
+
+      // Validate the binary image.  This function will return a pointer and length
+      // where the CFG binary is located within the binary image file.
+      bStatus = sys_validateStaConfig( pFileImage, cbFileImage,
+                                      &pCfgBinary, &cbCfgBinary );
+      if ( VOS_FALSE == bStatus )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Error: Cannot find STA CFG in binary image fileze" );
+         vosStatus = VOS_STATUS_E_FAILURE;
+         break;
+      }
+
+      // caller wants to know the size of the cfg Binary.  Return it.
+      *pcbCfgBinary = cbCfgBinary;
+
+      // To build the CFG download message, we need build a buffer that includes the
+      // tSirMbMsg header followed by the CFG data.  So allocate enough space for the
+      // CFG binary plus the message header.
+      //
+      // This buffer (the tSir message) is returned to the caller...
+      *ppMsg = vos_mem_malloc( cbCfgBinary + FIELD_OFFSET( tSirMbMsg, data ) );
+      if ( NULL == *ppMsg )
+      {
+         VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                    "Unable to allocate memory for the CFG download message "
+                    "buffer [size= %d bytes]",
+                    cbCfgBinary + FIELD_OFFSET( tSirMbMsg, data ) );
+
+         vosStatus = VOS_STATUS_E_NOMEM;
+         break;
+      }
+
+      // copy the CFG binary data into the CFG download message buffer...
+      vos_mem_copy( (v_VOID_t *)( ( *ppMsg )->data ), pCfgBinary , cbCfgBinary );
+
+      // if we get here, we have succeeded!
+      vosStatus = VOS_STATUS_SUCCESS;
+
+   } while( 0 );
+
+   // Always need to free the buffer where the binary image file was
+   // temporarily read...
+   if ( NULL == pFileImage )
+   {
+     // vos_mem_free( pFileImage );
+   }
+
+   // If failed and we have already allocated the memory for the CFG
+   // binary download message, need to free that memory.  If succeeded,
+   // the caller is going to free this memory when it is done sending
+   // the message.
+   if ( ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) && ( NULL != *ppMsg ) )
+   {
+      vos_mem_free( *ppMsg );
+      *ppMsg = NULL;
+      *pcbCfgBinary = 0;
+   }
+
+   return( vosStatus );
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+
+
+
+
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+static VOS_STATUS sys_SendWniCfgDnldMsg( v_CONTEXT_t pVosContext )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+   tSirMbMsg *pMsg = NULL;
+   v_VOID_t *hHal  = NULL;
+
+   v_SIZE_t cbCfgBinary = 0;
+
+   do
+   {
+      hHal = vos_get_context( VOS_MODULE_ID_HAL, pVosContext );
+      if ( NULL == hHal ) break;
+
+      vosStatus = sys_getCfgBinaryMsgBuffer( &pMsg, &cbCfgBinary );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) break;
+
+      pMsg->type = WNI_CFG_DNLD_RSP;
+
+      // message length is 4 greater than the config data size
+      // need to add in an extra 4 for the message header.
+      pMsg->msgLen = (tANI_U16)( cbCfgBinary + FIELD_OFFSET( tSirMbMsg, data ) );
+
+      sirStatus = halMmhForwardMBmsg( hHal, pMsg );
+      if ( eSIR_SUCCESS != sirStatus )
+      {
+         vosStatus = VOS_STATUS_E_FAILURE;
+      }
+      vos_mem_free(pMsg);
+   } while( 0 );
+
+   return( vosStatus );
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+VOS_STATUS sys_SendSmeStartReq( v_CONTEXT_t pVosContext )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   tSirSmeStartReq msg;
+
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+   tSirSmeStartReq *pMsg = &msg;
+   v_VOID_t *hHal;
+
+   do
+   {
+      // get the HAL context...
+      hHal = vos_get_context( VOS_MODULE_ID_HAL, pVosContext );
+      if ( NULL == hHal ) break;
+
+      // format the Sme Start Request message.  This message has
+      // the hal handle in the 'data' portion of the message.
+      pMsg->messageType      = eWNI_SME_START_REQ;
+      pMsg->length           = sizeof( msg );
+      pMsg->roamingAtPolaris = 0;
+      pMsg->sendNewBssInd    = 0;
+
+     // Send the HAL Init Start Request message...
+     sirStatus = halMmhForwardMBmsg( hHal, (tSirMbMsg *)pMsg );
+     if ( eSIR_SUCCESS != sirStatus )
+     {
+        vosStatus = VOS_STATUS_E_FAILURE;
+     }
+
+  } while( 0 );
+
+   return( vosStatus );
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+VOS_STATUS sysMcProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   v_VOID_t *hHal;
+
+   VOS_ASSERT( pMsg );
+
+   // All 'new' SYS messages are identified by a cookie in the reserved
+   // field of the message as well as the message type.  This prevents
+   // the possibility of overlap in the message types defined for new
+   // SYS messages with the 'legacy' message types.  The legacy messages
+   // will not have this cookie in the reserved field
+   if ( SYS_MSG_COOKIE == pMsg->reserved )
+   {
+      // Process all the new SYS messages..
+      switch( pMsg->type )
+      {
+         case SYS_MSG_ID_MC_START:
+         {
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+            // save the callback pointer and user data in the context
+            // data
+            gSysContext.mcStartCB = (sysResponseCback)pMsg->bodyptr;
+            gSysContext.mcStartUserData= (v_VOID_t *)pMsg->bodyval;
+
+            // Trigger the CFG download sequence by sending the
+            // SIR_HAL_INIT_START_REQ message to the mac module.
+            vosStatus = sys_SendHalInitStartReqMsg( pVosContext );
+#else
+            /* Handling for this message is not needed now so adding 
+             *debug print and VOS_ASSERT*/
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       " Received SYS_MSG_ID_MC_START message msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            VOS_ASSERT(0);
+#endif
+            break;
+         }
+
+         case SYS_MSG_ID_MC_STOP:
+         {
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                       "Processing SYS MC STOP" );
+
+            // get the HAL context...
+            hHal = vos_get_context( VOS_MODULE_ID_PE, pVosContext );
+            if (NULL == hHal)
+            {
+               VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                          "%s: Invalid hHal", __FUNCTION__ );
+            }
+            else
+            {
+               vosStatus = sme_Stop( hHal, TRUE );
+               VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+               vosStatus = macStop( hHal, HAL_STOP_TYPE_SYS_DEEP_SLEEP );
+               VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+
+               ((sysResponseCback)pMsg->bodyptr)((v_VOID_t *)pMsg->bodyval);
+
+               vosStatus = VOS_STATUS_SUCCESS;
+            }
+            break;
+         }
+
+         // Process MC thread probe.  Just callback to the
+         // function that is in the message.
+         case SYS_MSG_ID_MC_THR_PROBE:
+         {
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+            sysResponseCback callback;
+
+            // Make a callback to the function based on the info
+            // in the message (callback is in bodyptr and user
+            // data is in bodyval)
+            callback = (sysResponseCback)pMsg->bodyptr;
+
+            callback( (v_VOID_t *)pMsg->bodyval );
+#else
+            /* Handling for this message is not needed now so adding 
+             *debug print and VOS_ASSERT*/
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       " Received SYS_MSG_ID_MC_THR_PROBE message msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            VOS_ASSERT(0);
+#endif
+            break;
+         }
+
+         case SYS_MSG_ID_MC_TIMER:
+         {
+            vos_timer_callback_t timerCB;
+            // hummmm... note says...
+            // invoke the timer callback and the user data stick
+            // into the bodyval; no body to free.    I think this is
+            // what that means.
+            timerCB = (vos_timer_callback_t)pMsg->bodyptr;
+
+            // make the callback to the timer routine...
+            timerCB( (v_VOID_t *)pMsg->bodyval );
+
+            break;
+         }
+#ifndef WLAN_FTM_STUB
+         case SYS_MSG_ID_FTM_RSP:
+         {
+             WLANFTM_McProcessMsg((v_VOID_t *)pMsg->bodyptr);
+             break;
+         }
+#endif
+
+         default:
+         {
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       "Unknown message type in sysMcProcessMsg() msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            break;
+        }
+
+      }   // end switch on message type
+
+   }   // end if cookie set
+   else
+   {
+      // Process all 'legacy' messages
+      switch( pMsg->type )
+      {
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+         /* Handling for these messages are not needed now. If a request comes for 
+            these messages they will goto default and give VOS_ASSERT*/
+         case WDA_APP_SETUP_NTF:
+         {
+            // we get this message after we send SIR_HAL_INIT_START_REQ but
+            // we have nothing to do.  This one is safely ignored.  Following
+            // this message we will get the WNI_CFG_DNLD_REQ from where we need
+            // to give the Configuration data back.
+            break;
+         }
+
+         case WNI_CFG_DNLD_REQ:
+         {
+            // This is the request from the MAC to download the configuration
+            // data.  Format and send the Cfg Download to the MAC.
+            vosStatus = sys_SendWniCfgDnldMsg( pVosContext );
+            if (pMsg->bodyptr) 
+               vos_mem_free(pMsg->bodyptr); 
+            break;
+         }
+
+         case WNI_CFG_DNLD_CNF:
+         {
+            tSirMbMsg *pSirMsg = (tSirMbMsg *)pMsg->bodyptr;
+
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                       "WNI_CFG_DNLD_CNF message received with status code= %d [0x%08lX]",
+                       pSirMsg->data[0], pSirMsg->data[0] );
+
+            // Config download confirm contains a tANI_U32 status in the 'data' field
+            // of the WNI message.  Not sure we can do anything with this since we
+            // don't have a way to send a status to the waiting thread.
+
+            if ( WNI_CFG_SUCCESS == pSirMsg->data[ 0 ] )
+            {
+               VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                          "WNI_CFG_DNLD_CNF received with successful status" );
+            }
+            else
+            {
+               // What to do if the CFG Download fails?  We have the MC thread
+               // blocked waiting for a calback to unblock but we don't have
+               // a way to convey success / failure to the MC thread??
+               VOS_ASSERT( 0 );
+
+               VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                          "WNI_CFG_DNLD_CNF received with status= %d [0x%08lX]",
+                          pSirMsg->data[ 0 ], pSirMsg->data[ 0 ] );
+            }
+            if (pMsg->bodyptr) 
+               vos_mem_free(pMsg->bodyptr); 
+            break;
+         }
+
+         case WDA_NIC_OPER_NTF:
+         {
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                       "WDA_NIC_OPER_NTF message received" );
+
+            // This is the NIC Operational Notify message that comes to the
+            // SYS module from HAL after the Configuration download is complete.
+            // This message comes *after* the WNI_CFG_DNLD_CNF message
+            // comes to SYS from the CFG module, also at the end of CFG
+            // download.  In response to this message, SYS has to respond with
+            // request from the MAC to download the configuration
+            // data.  Format and send the Cfg Download to the MAC.
+            vosStatus = sys_SendSmeStartReq( pVosContext );
+            if (pMsg->bodyptr) 
+                vos_mem_free(pMsg->bodyptr); 
+            break;
+         }
+
+         case eWNI_SME_START_RSP:
+         {
+            tSirSmeRsp *pSirSmeRspMsg = (tSirSmeRsp *)pMsg->bodyptr;
+#ifdef WLAN_DEBUG
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+                       "eWNI_SME_START_RSP received with status code= %d [0x%08lX]",
+                       pSirSmeRspMsg->statusCode, pSirSmeRspMsg->statusCode );
+#endif
+            // Make a callback to the Main Controller start callback routine when
+            // the CFG sequence is finished... (this is the confirmation message
+            // from the MAC that the CFG sequence is completed).
+            if ( gSysContext.mcStartCB )
+            {
+               gSysContext.mcStartCB( gSysContext.mcStartUserData );
+            }
+            if (pMsg->bodyptr) 
+                vos_mem_free(pMsg->bodyptr); 
+            break;
+         }
+#endif  /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+         default:
+         {
+            VOS_ASSERT( 0 );
+
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       "Received SYS message cookie with unidentified "
+                       "MC message type= %d [0x%08lX]", pMsg->type, pMsg->type );
+
+            vosStatus = VOS_STATUS_E_BADMSG;
+            if (pMsg->bodyptr) 
+               vos_mem_free(pMsg->bodyptr);
+            break;
+         }
+      }   // end switch on pMsg->type
+   }   // end else
+
+   return( vosStatus );
+}
+
+
+
+
+VOS_STATUS sysTxProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   VOS_ASSERT( pMsg );
+
+   // All 'new' SYS messages are identified by a cookie in the reserved
+   // field of the message as well as the message type.  This prevents
+   // the possibility of overlap in the message types defined for new
+   // SYS messages with the 'legacy' message types.  The legacy messages
+   // will not have this cookie in the reserved field
+   if ( SYS_MSG_COOKIE == pMsg->reserved )
+   {
+      // Process all the new SYS messages..
+      switch( pMsg->type )
+      {
+         // Process TX thread probe.  Just callback to the
+         // function that is in the message.
+         case SYS_MSG_ID_TX_THR_PROBE:
+         {
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+            sysResponseCback callback;
+
+            // Make a callback to the function based on the info
+            // in the message (callback is in bodyptr and user
+            // data is in bodyval)
+            callback = (sysResponseCback)pMsg->bodyptr;
+
+            callback( (v_VOID_t *)pMsg->bodyval );
+#else
+           /* Handling for this message is not needed now so adding 
+            * debug print and VOS_ASSERT*/
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       " Received SYS_MSG_ID_TX_THR_PROBE message msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            VOS_ASSERT(0);
+
+#endif
+            break;
+         }
+
+         case SYS_MSG_ID_TX_TIMER:
+         {
+            vos_timer_callback_t timerCB;
+
+            // hummmm... note says...
+            // invoke the timer callback and the user data stick
+            // into the bodyval; no body to free.    I think this is
+            // what that means.
+            timerCB = (vos_timer_callback_t)pMsg->bodyptr;
+
+            // make the callback to the timer routine...
+            timerCB( (v_VOID_t *)pMsg->bodyval );
+
+            break;
+         }
+
+         default:
+         {
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       "Unknown message type in sysTxProcessMsg() msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            break;
+        }
+
+      }   // end switch on message type
+   }   // end if cookie set
+   else
+   {
+      VOS_ASSERT( 0 );
+
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Received SYS message cookie with unidentified TX message "
+                 " type= %d [0x%08lX]", pMsg->type, pMsg->type );
+
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }   // end else
+
+   return( vosStatus );
+}
+
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+VOS_STATUS sysRxProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   VOS_ASSERT( pMsg );
+
+   // All 'new' SYS messages are identified by a cookie in the reserved
+   // field of the message as well as the message type.  This prevents
+   // the possibility of overlap in the message types defined for new
+   // SYS messages with the 'legacy' message types.  The legacy messages
+   // will not have this cookie in the reserved field
+   if ( SYS_MSG_COOKIE == pMsg->reserved )
+   {
+      // Process all the new SYS messages..
+      switch( pMsg->type )
+      {
+         case SYS_MSG_ID_RX_TIMER:
+         {
+            vos_timer_callback_t timerCB;
+
+            // hummmm... note says...
+            // invoke the timer callback and the user data stick
+            // into the bodyval; no body to free.    I think this is
+            // what that means.
+            timerCB = (vos_timer_callback_t)pMsg->bodyptr;
+
+            // make the callback to the timer routine...
+            timerCB( (v_VOID_t *)pMsg->bodyval );
+
+            break;
+         }
+
+         default:
+         {
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       "Unknown message type in sysRxProcessMsg() msgType= %d [0x%08lx]",
+                       pMsg->type, pMsg->type );
+            break;
+        }
+
+      }   // end switch on message type
+   }   // end if cookie set
+   else
+   {
+      VOS_ASSERT( 0 );
+
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Received SYS message cookie with unidentified RX message "
+                 " type= %d [0x%08lX]", pMsg->type, pMsg->type );
+
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }   // end else
+
+   return( vosStatus );
+}
+
+#endif
+
+v_VOID_t sysMcFreeMsg( v_CONTEXT_t pVContext, vos_msg_t* pMsg )
+{
+   return;
+}
+
+
+v_VOID_t sysTxFreeMsg( v_CONTEXT_t pVContext, vos_msg_t* pMsg )
+{
+   return;
+}
+
+
+void
+SysProcessMmhMsg
+(
+  tpAniSirGlobal pMac,
+  tSirMsgQ* pMsg
+)
+{
+  VOS_MQ_ID   targetMQ = VOS_MQ_ID_SYS;
+/*-------------------------------------------------------------------------*/
+  /*
+  ** The body of this pMsg is a tSirMbMsg
+  ** Contrary to Gen4, we cannot free it here!
+  ** It is up to the callee to free it
+  */
+
+  VOS_ASSERT(NULL != pMsg);
+
+
+  switch (pMsg->type)
+  {
+    /*
+    ** Following messages are routed to SYS
+    */
+    case WNI_CFG_DNLD_REQ:
+    case WNI_CFG_DNLD_CNF:
+    case WDA_APP_SETUP_NTF:
+    case WDA_NIC_OPER_NTF:
+    case WDA_RESET_REQ:
+    case eWNI_SME_START_RSP:
+    {
+      /* Forward this message to the SYS module */
+      targetMQ = VOS_MQ_ID_SYS;
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Handling for the Message ID %d is removed in SYS\r\n",
+                 pMsg->type);
+
+      VOS_ASSERT(0);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+      break;
+    }
+
+
+    /*
+    ** Following messages are routed to HAL
+    */
+    case WNI_CFG_DNLD_RSP:
+    case WDA_INIT_START_REQ:
+    {
+      /* Forward this message to the HAL module */
+      targetMQ = VOS_MQ_ID_WDA;
+
+#if defined ( FEATURE_WLAN_INTEGRATED_SOC )
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Handling for the Message ID %d is removed as there is no HAL \r\n",
+                 pMsg->type);
+
+      VOS_ASSERT(0);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+      break;
+    }
+
+    case eWNI_SME_START_REQ:
+    case WNI_CFG_GET_REQ:
+    case WNI_CFG_SET_REQ:
+    case WNI_CFG_SET_REQ_NO_RSP:
+    case eWNI_SME_SYS_READY_IND:
+    {
+       /* Forward this message to the PE module */
+      targetMQ = VOS_MQ_ID_PE;
+      break;
+    }
+
+
+    case WNI_CFG_GET_RSP:
+    case WNI_CFG_SET_CNF:
+/*   case eWNI_SME_DISASSOC_RSP:
+    case eWNI_SME_STA_STAT_RSP:
+    case eWNI_SME_AGGR_STAT_RSP:
+    case eWNI_SME_GLOBAL_STAT_RSP:
+    case eWNI_SME_STAT_SUMM_RSP:
+    case eWNI_PMC_ENTER_BMPS_RSP:
+    case eWNI_PMC_EXIT_BMPS_RSP:
+    case eWNI_PMC_EXIT_BMPS_IND:
+    case eWNI_PMC_ENTER_IMPS_RSP:
+    case eWNI_PMC_EXIT_IMPS_RSP:
+    case eWNI_PMC_ENTER_UAPSD_RSP:
+    case eWNI_PMC_EXIT_UAPSD_RSP:
+    case eWNI_PMC_ENTER_WOWL_RSP:
+    case eWNI_PMC_EXIT_WOWL_RSP:
+    case eWNI_SME_SWITCH_CHL_REQ: */ //Taken care by the check in default case
+    {
+       /* Forward this message to the SME module */
+      targetMQ = VOS_MQ_ID_SME;
+      break;
+    }
+
+    default:
+    {
+
+      if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )  &&  ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
+      {
+         targetMQ = VOS_MQ_ID_SME;
+         break;
+      }
+
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Message of ID %d is not yet handled by SYS\r\n",
+                 pMsg->type);
+
+      VOS_ASSERT(0);
+    }
+
+  }
+
+
+  /*
+  ** Post now the message to the appropriate module for handling
+  */
+  if(VOS_STATUS_SUCCESS != vos_mq_post_message(targetMQ, (vos_msg_t*)pMsg))
+  {
+    //Caller doesn't allocate memory for the pMsg. It allocate memory for bodyptr
+    /* free the mem and return */
+    if(pMsg->bodyptr)
+    {
+      palFreeMemory( pMac->hHdd, pMsg->bodyptr);
+    }
+  }
+
+} /* SysProcessMmhMsg() */
+
+#ifndef WLAN_FTM_STUB
+/*==========================================================================
+  FUNCTION    WLAN_FTM_SYS_FTM
+
+  DESCRIPTION
+    Called by VOSS to free a given FTM message on the Main thread when there
+    are messages pending in the queue when the whole system is been reset.
+
+  DEPENDENCIES
+     FTM  must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to FTM's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:
+
+  SIDE EFFECTS
+      NONE
+============================================================================*/
+
+void wlan_sys_ftm(void *pMsgPtr)
+{
+    vos_msg_t  vosMessage;
+
+
+
+    vosMessage.reserved = FTM_SYS_MSG_COOKIE;
+    vosMessage.type     = SYS_MSG_ID_FTM_RSP;
+    vosMessage.bodyptr  = pMsgPtr;
+
+    vos_mq_post_message(VOS_MQ_ID_SYS, &vosMessage);
+
+    return;
+}
+
+#endif /* ANI_MANF_DIAG */
+
+
diff --git a/CORE/SYS/legacy/src/pal/inc/palApi.h b/CORE/SYS/legacy/src/pal/inc/palApi.h
new file mode 100644
index 0000000..f3e4edf
--- /dev/null
+++ b/CORE/SYS/legacy/src/pal/inc/palApi.h
@@ -0,0 +1,759 @@
+/*
+ * 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 palApi.h
+  
+    \brief Exports and types for the Platform Abstraction Layer interfaces.
+  
+    $Id$ 
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated
+    This file contains all the interfaces for thge Platform Abstration Layer
+    functions.  It is intended to be included in all modules that are using 
+    the PAL interfaces.
+  
+   ========================================================================== */
+#ifndef PALAPI_H__
+#define PALAPI_H__
+
+#include "halTypes.h"
+#include "palPipes.h"
+//#include "palErrIsr.h"
+//#include "halFrameInfo.h"
+
+/**
+    \mainpage Platform Abstraction Layer (PAL)
+    
+    \section intro Introduction
+    
+    palApi is the Platform Abstration Layer.
+    
+    This is the latest attempt to abstract the entire Platform, including the 
+    hardware, chip, OS and Bus into a generic API.  We are doing this to give 
+    the MAC the ability to call
+    generic APIs that will allow the MAC to function in an abstract manner 
+    with any Airgo chipset, on any supported OS (Windows and Linux for now)
+    across any system bus interface (PCI, PCIe, Cardbus, USB, etc.).
+    
+    \todo
+    - palReadRegister:  register read 
+        -# add an Open/Close abstraction to accomodate the PAL before the entire MAC is loaded.
+        -# Review with Linux folks to see this basic scructure works for them.
+        -# Figure out how to organize the directory structure
+    - palMemory: memory read/write
+    - include async versions of read/write register
+    - palTx: an abstraction for transmit frames that manages the Td and Tm rings
+    - palRx: an abstracion for receiving frames from a chip across any of the supported buses
+    - palInterrupt: abstract the interrupts into the HAL
+    
+    
+    \section impl_notes Implementation Notes
+    
+    \subsection subsection_codeStructure Code strucure
+
+ */
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palReadRegister
+
+    \brief chip and bus agnostic funtion to read a register value
+    
+    \param hHdd - HDD context handle
+    
+    \param regAddress - address (offset) of the register to be read from the start
+    of register space.
+    
+    \param pRegValue - pointer to the memory where the register contents are written
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palReadRegister( tHddHandle hHdd, tANI_U32 regAddress, tANI_U32 *pRegValue );
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palWriteRegister
+
+    \brief chip and bus agnostic funtion to write a register value
+    
+    \param hHdd - HDD context handle
+    
+    \param regAddress - address (offset) of the register to be read from the start
+    of register space.
+    
+    \param pRegValue - pointer to the value being written into the register
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palWriteRegister( tHddHandle hHdd, tANI_U32 regAddress, tANI_U32 regValue );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palAsyncWriteRegister
+
+    \brief chip and bus agnostic async funtion to write a register value
+    
+    \param hHdd - HDD context handle
+    
+    \param regAddress - address (offset) of the register to be written from the start
+    of register space.
+    
+    \param regValue - value being written into the register
+    
+    \return eHalStatus - status of the register write.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+
+eHalStatus palAsyncWriteRegister( tHddHandle hHdd, tANI_U32 regAddress, tANI_U32 regValue );
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palReadDeviceMemory
+
+    \brief chip and bus agnostic funtion to read memory from the chip
+    
+    \param hHdd - HDD context handle
+    
+    \param memOffset - address (offset) of the memory from the top of the 
+    memory map (as exposed to the host) where the memory will be read from.
+    
+    \param pBuffer - pointer to a buffer where the memory will be placed in host
+    memory space after retreived from the chip.
+    
+    \param numBytes - the number of bytes to be read.
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palReadDeviceMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U8 *pBuffer, tANI_U32 numBytes );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palWriteDeviceMemory
+
+    \brief chip and bus agnostic funtion to write memory to the chip
+    
+    \param hHdd - HDD context handle
+    
+    \param memOffset - address (offset) of the memory from the top of the on-chip 
+    memory that will be written.
+    
+    \param pBuffer - pointer to a buffer that has the source data that will be 
+    written to the chip.
+    
+    \param numBytes - the number of bytes to be written.
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palWriteDeviceMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U8 *pBuffer, tANI_U32 numBytes );  
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palAllocateMemory
+
+    \brief OS agnostic funtion to allocate host memory.   
+    
+    \note  Host memory that needs to be shared between the host and the 
+    device needs to be allocated with the palAllocateSharedMemory()
+    and free'd with palFreeSharedMemory() functions.
+        
+    \param hHdd - HDD context handle
+    
+    \param ppMemory - pointer to a void pointer where the address of the 
+    memory allocated will be placed upon return from this function.
+    
+    \param numBytes - the number of bytes to allocate.
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In the case of a failure, a non-successful return code will be 
+    returned and no memory will be allocated (the *ppMemory will be NULL so don't
+    try to use it unless the status returns success).
+    
+  -------------------------------------------------------------------------------*/
+#ifdef MEMORY_DEBUG
+#define palAllocateMemory(hHdd, ppMemory, numBytes) palAllocateMemory_debug(hHdd, ppMemory, numBytes, __FILE__, __LINE__)
+eHalStatus palAllocateMemory_debug( tHddHandle hHdd, void **ppMemory, tANI_U32 numBytes, char* fileName, tANI_U32 lineNum );
+#else
+eHalStatus palAllocateMemory( tHddHandle hHdd, void **ppMemory, tANI_U32 numBytes );
+#endif
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palFreeMemory
+
+    \brief OS agnostic funtion to free host memory that was allocated with 
+    palAllcoateMemory() calls.
+    
+    \note  Host memory that needs to be shared between the host and the 
+    device needs to be allocated with the palAllocateSharedMemory()
+    and free'd with palFreeSharedMemory() functions.
+        
+    \param hHdd - HDD context handle
+    
+    \param pMemory - pointer to memory that will be free'd.
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In the case of a failure, a non-successful return code will be 
+    returned and no memory will be allocated (the *ppMemory will be NULL so don't
+    try to use it unless the status returns success).
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palFreeMemory( tHddHandle hHdd, void *pMemory );
+
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palFillMemory
+
+    \brief OS agnostic funtion to fill host memory with a specified byte value
+    
+    \param hHdd - HDD context handle
+    
+    \param pMemory - pointer to memory that will be filled.
+    
+    \param numBytes - the number of bytes to be filled.
+    
+    \param fillValue - the byte to be written to fill the memory with.
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In the case of a failure, a non-successful return code will be 
+    returned and no memory will be allocated (the *ppMemory will be NULL so don't
+    try to use it unless the status returns success).
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palFillMemory( tHddHandle hHdd, void *pMemory, tANI_U32 numBytes, tANI_BYTE fillValue );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palCopyMemory
+
+    \brief OS agnostic funtion to copy host memory from one location to another
+    
+    \param hHdd - HDD context handle
+    
+    \param pSrc - pointer to source memory location (to copy from)
+
+    \param pSrc - pointer to destination memory location (to copy to)
+    
+    \param numBytes - the number of bytes to be be copied.
+    
+    \return eHalStatus - status of the memory copy 
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palCopyMemory( tHddHandle hHdd, void *pDst, const void *pSrc, tANI_U32 numBytes );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palFillMemory
+
+    \brief OS agnostic funtion to fill host memory with a specified byte value
+    
+    \param hHdd - HDD context handle
+    
+    \param pMemory - pointer to memory that will be filled.
+    
+    \param numBytes - the number of bytes to be filled.
+    
+    \param fillValue - the byte to be written to fill the memory with.
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail.  In the case of a failure, a non-successful return code will be 
+    returned and no memory will be allocated (the *ppMemory will be NULL so don't
+    try to use it unless the status returns success).
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION
+eHalStatus palZeroMemory( tHddHandle hHdd, void *pMemory, tANI_U32 numBytes )
+{
+    return( palFillMemory( hHdd, pMemory, numBytes, 0 ) );
+} 
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palEqualMemory
+
+    \brief OS agnostic funtion to compare two pieces of memory, similar to 
+    memcmp function in standard C.
+        
+    \param hHdd - HDD context handle
+    
+    \param pMemory1 - pointer to one location in memory to compare.
+
+    \param pMemory2 - pointer to second location in memory to compare.
+    
+    \param numBytes - the number of bytes to compare.
+    
+    \return tANI_BOOLEAN - returns a boolean value that tells if the memory
+    locations are equal or now equal. 
+    
+  -------------------------------------------------------------------------------*/
+tANI_BOOLEAN palEqualMemory( tHddHandle hHdd, void *pMemory1, void *pMemory2, tANI_U32 numBytes ); 
+
+/** ---------------------------------------------------------------------------
+
+    \fn palFillDeviceMemory
+
+    \brief OS agnostic funtion to fill device memory with a specified 
+    32bit value
+    
+    \param hHdd - HDD context handle
+    
+    \param memOffset - offset of the memory on the device to fill.
+    
+    \param numBytes - the number of bytes to be filled.
+    
+    \param fillValue - the byte pattern to fill into memory on the device
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail. 
+    
+    eHAL_STATUS_DEVICE_MEMORY_LENGTH_ERROR - length of the device memory is not 
+    a multiple of 4 bytes.
+    
+    eHAL_STATUS_DEVICE_MEMORY_MISALIGNED - memory address is not aligned on a 
+    4 byte boundary.
+    
+    \note return failure if the memOffset is not 32bit aligned and not a 
+    multiple of 4 bytes (the device does not support anything else).
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palFillDeviceMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U32 numBytes, tANI_BYTE fillValue );
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palZeroDeviceMemory
+
+    \brief OS agnostic funtion to fill device memory with a specified byte value
+    
+    \param hHdd - HDD context handle
+    
+    \param memOffset - offset of the memory on the device to fill.
+    
+    \param numBytes - the number of bytes to be filled.
+    
+    \param fillValue - the 32bit pattern to fill the memory with.
+    
+    \return eHalStatus - status of the register read.  Note that this function 
+    can fail. 
+    
+    eHAL_STATUS_DEVICE_MEMORY_LENGTH_ERROR - length of the device memory is not 
+    a multiple of 4 bytes.
+    
+    eHAL_STATUS_DEVICE_MEMORY_MISALIGNED - memory address is not aligned on a 
+    4 byte boundary.
+    
+    \note return failure if the memOffset is not 32bit aligned and not a 
+    multiple of 4 bytes (the device does not support anything else).
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION
+eHalStatus palZeroDeviceMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U32 numBytes )
+{
+    return( palFillDeviceMemory( hHdd, memOffset, numBytes, 0 ) );
+} 
+
+/*----------------------------------------------------------------------------------
+
+    Allocate a packet for sending through the Tx APIs.
+
+    \param hHdd - HDD context handle
+    
+    \param frmType - Frame type
+    
+    \param size
+
+    \param data -
+
+    \param ppPacket  - 
+
+    \return eHalStatus -     
+----------------------------------------------------------------------------------*/
+eHalStatus palPktAlloc(tHddHandle hHdd, eFrameType frmType, tANI_U16 size, void **data, void **ppPacket) ;
+
+
+// This should return Ssome sort of status.....
+void palPktFree( tHddHandle hHdd, eFrameType frmType, void* buf, void *pPacket);
+
+
+
+//PAL lock functions
+//pHandle -- pointer to a caller allocated tPalSpinLockHandle object
+eHalStatus palSpinLockAlloc( tHddHandle hHdd, tPalSpinLockHandle *pHandle );
+//hSpinLock -- a handle returned by palSpinLockAlloc
+eHalStatus palSpinLockFree( tHddHandle hHdd, tPalSpinLockHandle hSpinLock );
+//hSpinLock -- a handle returned by palSpinLockAlloc
+eHalStatus palSpinLockTake( tHddHandle hHdd, tPalSpinLockHandle hSpinLock );
+//hSpinLock -- a handle returned by palSpinLockAlloc
+eHalStatus palSpinLockGive( tHddHandle hHdd, tPalSpinLockHandle hSpinLock );
+//PAL lock functions end
+
+
+//This function send a message to MAC, 
+//pMsgBuf is a buffer allocated by caller. The actual structure varies base on message type
+//The beginning of the buffer can always map to tSirMbMsg
+//This function must take care of padding if it is required for the OS
+eHalStatus palSendMBMessage(tHddHandle hHdd, void *pBuf);
+
+extern void palGetUnicastStats(tHddHandle hHdd, tANI_U32 *tx, tANI_U32 *rx);
+
+
+/*----------------------------------------------------------------------------------
+    this function is to return a tick count (one tick = ~10ms). It is used to calculate
+    time difference.
+
+    \param hHdd - HDD context handle
+    
+    \return tick count. 
+----------------------------------------------------------------------------------*/
+tANI_U32 palGetTickCount(tHddHandle hHdd);
+
+/** ---------------------------------------------------------------------------
+
+    \fn palReadRegMemory
+
+    \brief chip and bus agnostic function to read memory from the PHY register space as memory
+    i.e. to read more than 4 bytes from the contiguous register space
+    
+    \param hHdd - HDD context handle
+    
+    \param memOffset - address (offset) of the memory from the top of the 
+    memory map (as exposed to the host) where the memory will be read from.
+    
+    \param pBuffer - pointer to a buffer where the memory will be placed in host
+    memory space after retreived from the chip.
+    
+    \param numBytes - the number of bytes to be read.
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palReadRegMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U8 *pBuffer, tANI_U32 numBytes );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palAsyncWriteRegMemory
+
+    \brief chip and bus agnostic function to write memory to the PHY register space as memory
+    i.e. to write more than 4 bytes from the contiguous register space. In USB interface, this
+    API does the write asynchronously.
+
+    \param hHdd - HDD context handle
+    
+    \param memOffset - address (offset) of the memory from the top of the on-chip 
+    memory that will be written.
+    
+    \param pBuffer - pointer to a buffer that has the source data that will be 
+    written to the chip.
+    
+    \param numBytes - the number of bytes to be written.
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palAsyncWriteRegMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U8 *pBuffer, tANI_U32 numBytes );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palWriteRegMemory
+    \brief chip and bus agnostic function to write memory to the PHY register space as memory
+    i.e. to write more than 4 bytes from the contiguous register space. The difference from the
+    above routine is, in USB interface, this routine performs the write synchronously where as 
+    the above routine performs it asynchronously.
+
+    \param hHdd - HDD context handle
+    
+    \param memOffset - address (offset) of the memory from the top of the on-chip 
+    memory that will be written.
+    
+    \param pBuffer - pointer to a buffer that has the source data that will be 
+    written to the chip.
+    
+    \param numBytes - the number of bytes to be written.
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palWriteRegMemory( tHddHandle hHdd, tANI_U32 memOffset, tANI_U8 *pBuffer, tANI_U32 numBytes );
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn palWaitRegVal
+
+    \brief is a blocking function which reads the register and waits for the given number of iterations 
+    until the read value matches the waitRegVal. The delay between is perIterWaitInNanoSec(in nanoseconds)
+    
+    \param hHdd - HDD context handle
+    
+    \param reg - address of the register to be read
+    
+    \param mask - mask to be applied for the read value
+    
+    \param waitRegVal - expected value from the register after applying the mask.
+
+    \param perIterWaitInNanoSec - delay between the two iterations in nanoseconds
+
+    \param numIter - max number of reads before the timeout
+
+    \param pReadRegVal - the value read from the register
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palWaitRegVal( tHddHandle hHdd, tANI_U32 reg, tANI_U32 mask, 
+                             tANI_U32 waitRegVal, tANI_U32 perIterWaitInNanoSec, 
+                             tANI_U32 numIter, tANI_U32 *pReadRegVal );
+
+/** ---------------------------------------------------------------------------
+
+    \fn palReadModifyWriteReg
+
+    \brief chip and bus agnostic function to read a PHY register apply the given masks(AND and OR masks)
+    and writes back the new value to the register
+
+    \param hHdd - HDD context handle
+    
+    \param reg - address of the register to be modified.
+    
+    \param andMask - The value read will be ANDed with this mask
+
+    \parma orMask - The value after applying the andMask will be ORed with this value
+    
+    \return eHalStatus - status of the memory read.  Note that this function 
+    can fail.  In particular, when the card is removed, this function will return 
+    a failure.
+    
+  -------------------------------------------------------------------------------*/
+eHalStatus palReadModifyWriteReg( tHddHandle hHdd, tANI_U32 reg, tANI_U32 andMask, tANI_U32 orMask );
+
+//PAL semaphore functions
+eHalStatus palSemaphoreAlloc( tHddHandle hHdd, tPalSemaphoreHandle *pHandle, tANI_S32 count );
+eHalStatus palSemaphoreFree( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore );
+eHalStatus palSemaphoreTake( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore );
+eHalStatus palSemaphoreGive( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore );
+eHalStatus palMutexAlloc( tHddHandle hHdd, tPalSemaphoreHandle *pHandle) ;
+eHalStatus palMutexAllocLocked( tHddHandle hHdd, tPalSemaphoreHandle *pHandle) ;
+
+//PAL irq/softirq
+eAniBoolean pal_in_interrupt(void) ;
+void pal_local_bh_disable(void) ;
+void pal_local_bh_enable(void) ;
+
+//PAL byte swap
+tANI_U32 pal_be32_to_cpu(tANI_U32 x) ;
+tANI_U32 pal_cpu_to_be32(tANI_U32 x) ;
+tANI_U16 pal_be16_to_cpu(tANI_U16 x) ;
+tANI_U16 pal_cpu_to_be16(tANI_U16 x) ;
+
+
+#if defined( ANI_LITTLE_BYTE_ENDIAN )
+
+// Need to eliminate these and use the ani_cpu_to_le, etc. macros....
+ANI_INLINE_FUNCTION unsigned long i_htonl( unsigned long ul ) 
+{
+  return( ( ( ul & 0x000000ff ) << 24 ) |
+          ( ( ul & 0x0000ff00 ) <<  8 ) |
+          ( ( ul & 0x00ff0000 ) >>  8 ) |
+          ( ( ul & 0xff000000 ) >> 24 )   );
+}
+
+ANI_INLINE_FUNCTION unsigned short i_htons( unsigned short us )
+{
+  return( ( ( us >> 8 ) & 0x00ff ) + ( ( us << 8 ) & 0xff00 ) );
+}
+
+ANI_INLINE_FUNCTION unsigned short i_ntohs( unsigned short us )
+{
+  return( i_htons( us ) );
+}
+
+ANI_INLINE_FUNCTION unsigned long i_ntohl( unsigned long ul )
+{
+  return( i_htonl( ul ) );
+}
+
+#endif //#if defined( ANI_LITTLE_BYTE_ENDIAN )
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn pal_set_U32
+
+    \brief Assign 32-bit unsigned value to a byte array base on CPU's endianness.
+
+    \note Caller must validate the byte array has enough space to hold the vlaue
+        
+    \param ptr - Starting address of a byte array
+    
+    \param value - The value to assign to the byte array
+    
+    \return - The address to the byte after the assignment. This may or may not 
+    be valid. Caller to verify.
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION tANI_U8 * pal_set_U32(tANI_U8 *ptr, tANI_U32 value)
+{
+#if defined( ANI_BIG_BYTE_ENDIAN )
+     *(ptr) = ( tANI_U8 )( value >> 24 );
+     *(ptr + 1) = ( tANI_U8 )( value >> 16 );
+     *(ptr + 2) = ( tANI_U8 )( value >> 8 );
+     *(ptr + 3) = ( tANI_U8 )( value );
+#else
+    *(ptr + 3) = ( tANI_U8 )( value >> 24 );
+    *(ptr + 2) = ( tANI_U8 )( value >> 16 );
+    *(ptr + 1) = ( tANI_U8 )( value >> 8 );
+    *(ptr) = ( tANI_U8 )( value );
+#endif
+
+    return (ptr + 4);
+}
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn pal_set_U16
+
+    \brief Assign 16-bit unsigned value to a byte array base on CPU's endianness.
+
+    \note Caller must validate the byte array has enough space to hold the vlaue
+        
+    \param ptr - Starting address of a byte array
+    
+    \param value - The value to assign to the byte array
+    
+    \return - The address to the byte after the assignment. This may or may not 
+    be valid. Caller to verify.
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION tANI_U8 * pal_set_U16(tANI_U8 *ptr, tANI_U16 value)
+{
+#if defined( ANI_BIG_BYTE_ENDIAN )
+     *(ptr) = ( tANI_U8 )( value >> 8 );
+     *(ptr + 1) = ( tANI_U8 )( value );
+#else
+    *(ptr + 1) = ( tANI_U8 )( value >> 8 );
+    *(ptr) = ( tANI_U8 )( value );
+#endif
+
+    return (ptr + 2);
+}
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn pal_get_U16
+
+    \brief Retrieve a 16-bit unsigned value from a byte array base on CPU's endianness.
+
+    \note Caller must validate the byte array has enough space to hold the vlaue
+        
+    \param ptr - Starting address of a byte array
+    
+    \param pValue - Pointer to a caller allocated buffer for 16 bit value. Value is to assign 
+    to this location.
+    
+    \return - The address to the byte after the assignment. This may or may not 
+    be valid. Caller to verify.
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION tANI_U8 * pal_get_U16(tANI_U8 *ptr, tANI_U16 *pValue)
+{
+#if defined( ANI_BIG_BYTE_ENDIAN )
+    *pValue = (((tANI_U16) (*ptr << 8)) |
+            ((tANI_U16) (*(ptr+1))));
+#else
+    *pValue = (((tANI_U16) (*(ptr+1) << 8)) |
+            ((tANI_U16) (*ptr)));
+#endif
+
+    return (ptr + 2);
+}
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn pal_get_U32
+
+    \brief Retrieve a 32-bit unsigned value from a byte array base on CPU's endianness.
+
+    \note Caller must validate the byte array has enough space to hold the vlaue
+        
+    \param ptr - Starting address of a byte array
+    
+    \param pValue - Pointer to a caller allocated buffer for 32 bit value. Value is to assign 
+    to this location.
+    
+    \return - The address to the byte after the assignment. This may or may not 
+    be valid. Caller to verify.
+    
+  -------------------------------------------------------------------------------*/
+ANI_INLINE_FUNCTION tANI_U8 * pal_get_U32(tANI_U8 *ptr, tANI_U32 *pValue)
+{
+#if defined( ANI_BIG_BYTE_ENDIAN )
+    *pValue = ( (tANI_U32)(*(ptr) << 24) |
+             (tANI_U32)(*(ptr+1) << 16) |
+             (tANI_U32)(*(ptr+2) << 8) |
+             (tANI_U32)(*(ptr+3)) );
+#else
+    *pValue = ( (tANI_U32)(*(ptr+3) << 24) |
+             (tANI_U32)(*(ptr+2) << 16) |
+             (tANI_U32)(*(ptr+1) << 8) |
+             (tANI_U32)(*(ptr)) );
+#endif
+
+    return (ptr + 4);
+}
+
+
+#endif
diff --git a/CORE/SYS/legacy/src/pal/inc/palPipes.h b/CORE/SYS/legacy/src/pal/inc/palPipes.h
new file mode 100644
index 0000000..363d9b2
--- /dev/null
+++ b/CORE/SYS/legacy/src/pal/inc/palPipes.h
@@ -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.
+ */
+
+/** ------------------------------------------------------------------------- *
+    ------------------------------------------------------------------------- *
+
+
+    \file palPipes.h
+
+    \brief Defines Pal pipes to transfer frames/memory to/from the device
+
+    $Id$
+
+
+    Copyright (C) 2006 Airgo Networks, Incorporated
+
+   ========================================================================== */
+
+#ifndef PALPIPES_H
+#define PALPIPES_H
+
+#include "halTypes.h"
+
+
+typedef enum
+{
+    CSR_PIPE =  0,  //CSR Endpoint for USB and non-DXE transfer for PCI/PCIe
+
+    PIPE_TX_1 = 1,  //lowest priority
+    PIPE_TX_2 = 2,
+    PIPE_TX_3 = 3,
+    PIPE_TX_4 = 4,
+    PIPE_TX_5 = 5,
+    PIPE_TX_6 = 6,
+    PIPE_TX_7 = 7,
+
+    PIPE_RX_1 = 8,  //lowest priority
+    PIPE_RX_2 = 9,
+    PIPE_RX_3 = 10,
+    PIPE_RX_4 = 11,
+    PIPE_RX_5 = 12,
+    PIPE_RX_6 = 13,
+    PIPE_RX_7 = 14,
+
+    MAX_PIPE = PIPE_RX_7,
+    ANY_PIPE
+}ePipes;
+
+
+/* sHddMemSegment defines the structure that the HDD will use to transfer frames
+    down through the hal to the pal layer.
+*/
+typedef struct tagHddMemSegment
+{
+    struct tagHddMemSegment *next;      //linked list, NULL=no more segments linked
+    void *hddContext;                   //provides a place for the HDD layer to record information
+    void *addr;                         //either virtual or physical memory address. PCI will likely be physical addresses, USB will be virtual addresses
+                                        //pal layer will convert virtual memory addresses to physical for transfer with DXE.
+    tANI_U32 length;                    //number of bytes contained in segment for transfer.
+}sHddMemSegment;
+
+
+
+/* sTxFrameTransfer defines the structure that Hal's transmit queueing will use to
+    keep frames in queues, ready for transfer to the pal layer.
+*/
+typedef struct tagTxFrameTransfer
+{
+    struct tagTxFrameTransfer *next;   //used by hal to queue transmit frames, Pal does nothing with this
+    sHddMemSegment *bd;                //if NULL, the BD should be created during DXE transfer to asic
+    sHddMemSegment *segment;           //all segments associated with an inidividual frame
+    tANI_U32 descCount;                 //number of descriptors needed to transfer
+}sTxFrameTransfer;
+
+
+
+
+#define PAL_RX_BUFFER_SIZE  (16 * 1024)
+typedef tANI_U8 *tRxBuffer;
+
+typedef struct
+{
+    tANI_U32 nBytes;                    //number of bytes transferred to the buffer
+    tRxBuffer pBbuffer;                 //rxBuffer virtual pointer
+    tANI_BUFFER_ADDR physAddr;               //rxBuffer physical address
+                                        //it is assumed that the BD is present and we know how to interpret the whole buffer
+}sRxFrame;
+
+
+
+/* sRxFrameTransfer defines the structure that Hal's receive queuing will use to
+    keep frames in receive queues.
+*/
+typedef struct tagRxFrameTransfer
+{
+    struct tagRxFrameTransfer *next;    //used by hal to queue transmit frames, Pal does nothing with this
+    ePipes pipe;                        //pipe the frame was received on - need to free the correct resources quickly
+    sRxFrame *rxFrame;                  //virtual memory pointer to raw frame data
+}sRxFrameTransfer;
+
+
+
+typedef union
+{
+    sTxFrameTransfer txFrame;
+    sRxFrameTransfer rxFrame;
+}uFrameTransfer;
+
+
+typedef eHalStatus (*palXfrCompleteFPtr)(tHalHandle hHal, ePipes pipe, uFrameTransfer *frame);
+
+
+typedef struct
+{
+    tANI_U32 nDescs;                    //number of URBs for USB or descriptors for DXE that can be queued for transfer at one time
+    tANI_U32 nRxBuffers;                //maximum number of receive buffers from physical memory to use for this pipe
+    tANI_BOOLEAN preferCircular;        //1 = use circular descriptor handling if available, linear otherwise
+    tANI_BOOLEAN bdPresent;             //1 = BD attached to frames for this pipe
+    palXfrCompleteFPtr callback;        //callback when transfer is complete, if not NULL
+    palXfrCompleteFPtr rxCallback;      //Rx callback when transfer type is H2H, if not NULL
+    tANI_U32 refWQ;             // Reference WQ - for H2B and B2H only
+    tANI_U32 xfrType;           // H2B(Tx), B2H(Rx), H2H(SRAM<->HostMem R/W)
+    tANI_U32 chPriority;        // Channel Priority 7(Highest) - 0(Lowest)
+    tANI_BOOLEAN bCfged;        //whether the pipe has been configured
+    tANI_U32 indexEP;     //This is for USB only, it is the index of TX/RX endpoint, TX_DATA_PIPE_OUT...
+    tANI_U32 bmuThreshold; //BMU threshold 
+    // For PAL's internal use
+    void *pReserved1;
+    void *pReserved2;
+
+    tANI_BOOLEAN use_lower_4g;  /**< Added for Gen5 Prefetch */
+    tANI_BOOLEAN use_short_desc_fmt;
+}sPipeCfg;
+
+
+
+
+#define PIPE_MEM_XFR_LIMIT  (16 * 1024)   //maximum single transfer size
+
+
+
+
+// palPipes Functions....
+#define palIsPipeCfg(hHdd, pipeNum) ((hHdd)->PipeCfgInfo[(pipeNum)].bCfged)
+eHalStatus palPipeCfg(tHddHandle, ePipes pipe, sPipeCfg *pPipeCfg);
+eHalStatus palWriteFrame(tHddHandle, ePipes pipe, sTxFrameTransfer *frame);
+eHalStatus palFreeRxFrame(tHddHandle, sRxFrameTransfer *frame);
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInterrupts.h"
+eHalStatus palTxPipeIsr(tHalHandle hHal, eHalIntSources intSource);
+eHalStatus palRxPipeIsr(tHalHandle hHal, eHalIntSources intSource);
+#endif
+
+#endif
diff --git a/CORE/SYS/legacy/src/pal/inc/palTimer.h b/CORE/SYS/legacy/src/pal/inc/palTimer.h
new file mode 100644
index 0000000..984684e
--- /dev/null
+++ b/CORE/SYS/legacy/src/pal/inc/palTimer.h
@@ -0,0 +1,83 @@
+/*
+ * 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 palTimer.h
+  
+    \brief Define data structure and ptototype for PAL timer.
+  
+    $Id$ 
+  
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated
+    ... description...
+  
+   ========================================================================== */
+
+#if !defined( PALTIMER_H__ )
+#define PALTIMER_H__
+
+
+/*
+PAL TIMER
+  This timer can be used for every module in Windows side. 
+  On Linus side, this can only be used by timer for HDD. Not for timers used in rtlib, hence it doesn't replace TX_TIMER
+*/
+
+typedef void * tPalTimerHandle;
+
+#define PAL_INVALID_TIMER_HANDLE (NULL)
+
+typedef void (*palTimerCallback)(void *);
+
+#define PAL_TIMER_TO_MS_UNIT      1000
+#define PAL_TIMER_TO_SEC_UNIT     1000000
+
+
+//PAL timer functions
+//pPalTimer is a pointer to a caller allocated tPalTimer object
+//pContext is a pointer to an object that will be passed in when callback is called
+//fRestart to set whether the timer is restart after callback returns
+#ifdef TIMER_MANAGER
+#define palTimerAlloc(hHdd, phPalTimer, pCallback, pContext) \
+              palTimerAlloc_debug(hHdd, phPalTimer, pCallback, pContext, __FILE__, __LINE__)
+eHalStatus palTimerAlloc_debug( tHddHandle hHdd, tPalTimerHandle *phPalTimer, 
+                          palTimerCallback pCallback, void *pContext, char* fileName, v_U32_t lineNum  );              
+#else
+eHalStatus palTimerAlloc(tHddHandle hHdd, tPalTimerHandle *phPalTimer, palTimerCallback pCallback, void *pContext);
+#endif
+//This function will free the timer
+//On Windows platform, it can only be called when device is unloading.
+eHalStatus palTimerFree(tHddHandle, tPalTimerHandle);
+//To start a timer
+//uExpireTime is the timer lapse before timer fires. If the timer is in running state and the fRestart is true,
+//uExpireTime is set so that it is the new interval, in units of microseconds
+eHalStatus palTimerStart(tHddHandle, tPalTimerHandle, tANI_U32 uExpireTime, tANI_BOOLEAN fRestart);
+//palTimerStop will cancel the timer but doesn't guarrantee the callback will not called afterwards
+//For Windows, if the driver is halting, the callback is not called after this function returns. 
+eHalStatus palTimerStop(tHddHandle, tPalTimerHandle); 
+
+
+#endif
diff --git a/CORE/SYS/legacy/src/pal/src/palApiComm.c b/CORE/SYS/legacy/src/pal/src/palApiComm.c
new file mode 100644
index 0000000..1a21e3a
--- /dev/null
+++ b/CORE/SYS/legacy/src/pal/src/palApiComm.c
@@ -0,0 +1,400 @@
+/*
+ * 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.
+ */
+
+#include <palApi.h>
+#include <sirTypes.h>   // needed for tSirRetStatus
+#include <vos_api.h>
+
+#include <sirParams.h>  // needed for tSirMbMsg
+#include "wlan_qct_wda.h"
+
+
+// its not worth the time trying to get all the includes in place to get to
+// halMmhForwardMBmsg.  if I inlude halMnt.h, I get all kids of compile errros
+// for things missing from palPipes.h (asicDxe.h is looking for these).  palPipes
+// is used only in Gen4 DVT code so why we would have it or need it is puzzling.
+//#include <halMnt.h>
+
+
+
+#ifdef MEMORY_DEBUG
+eHalStatus palAllocateMemory_debug( tHddHandle hHdd, void **ppMemory, tANI_U32 numBytes, char* fileName, tANI_U32 lineNum )
+{
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   
+   *ppMemory = vos_mem_malloc_debug( numBytes, fileName, lineNum );
+   
+   if ( NULL == *ppMemory ) 
+   {
+      halStatus = eHAL_STATUS_FAILURE;
+   }
+   
+   return( halStatus );
+}
+#else
+eHalStatus palAllocateMemory( tHddHandle hHdd, void **ppMemory, tANI_U32 numBytes )
+{
+   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+   
+   *ppMemory = vos_mem_malloc( numBytes );
+   
+   if ( NULL == *ppMemory ) 
+   {
+      halStatus = eHAL_STATUS_FAILURE;
+   }
+   
+   return( halStatus );
+}
+#endif
+
+
+eHalStatus palFreeMemory( tHddHandle hHdd, void *pMemory )
+{
+   vos_mem_free( pMemory );
+   
+   return( eHAL_STATUS_SUCCESS );
+}
+
+eHalStatus palFillMemory( tHddHandle hHdd, void *pMemory, tANI_U32 numBytes, tANI_BYTE fillValue )
+{
+   vos_mem_set( pMemory, numBytes, fillValue );
+   
+   return( eHAL_STATUS_SUCCESS );
+}
+
+
+eHalStatus palCopyMemory( tHddHandle hHdd, void *pDst, const void *pSrc, tANI_U32 numBytes )
+{
+   vos_mem_copy( pDst, pSrc, numBytes );
+   
+   return( eHAL_STATUS_SUCCESS );
+}
+
+
+
+tANI_BOOLEAN palEqualMemory( tHddHandle hHdd, void *pMemory1, void *pMemory2, tANI_U32 numBytes )
+{
+   return( vos_mem_compare( pMemory1, pMemory2, numBytes ) );
+}   
+
+
+eHalStatus palPktAlloc(tHddHandle hHdd, eFrameType frmType, tANI_U16 size, void **data, void **ppPacket)
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   VOS_STATUS vosStatus;
+   
+   vos_pkt_t *pVosPacket;
+   
+   do 
+   {
+      // we are only handling the 802_11_MGMT frame type for PE/LIM.  All other frame types should be 
+      // ported to use the VOSS APIs directly and should not be using this palPktAlloc API.
+      VOS_ASSERT( HAL_TXRX_FRM_802_11_MGMT == frmType );
+    
+      if ( HAL_TXRX_FRM_802_11_MGMT != frmType ) break;
+   
+      // allocate one 802_11_MGMT VOS packet, zero the packet and fail the call if nothing is available.
+      // if we cannot get this vos packet, fail.
+      vosStatus = vos_pkt_get_packet( &pVosPacket, VOS_PKT_TYPE_TX_802_11_MGMT, size, 1, VOS_TRUE, NULL, NULL );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) break;
+      
+      // Reserve the space at the head of the packet for the caller.  If we cannot reserve the space
+      // then we have to fail (return the packet to voss first!)
+      vosStatus = vos_pkt_reserve_head( pVosPacket, data, size );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+      {
+         vos_pkt_return_packet( pVosPacket );
+         break;
+      }
+      
+      // Everything went well if we get here.  Return the packet pointer to the caller and indicate
+      // success to the caller.
+      *ppPacket = (void *)pVosPacket;
+      
+      halStatus = eHAL_STATUS_SUCCESS;
+   
+   } while( 0 );
+   
+   return( halStatus );
+}
+
+
+
+void palPktFree( tHddHandle hHdd, eFrameType frmType, void* buf, void *pPacket)
+{
+   vos_pkt_t *pVosPacket = (vos_pkt_t *)pPacket;
+   VOS_STATUS vosStatus;
+      
+   do 
+   {
+      VOS_ASSERT( pVosPacket );
+      
+      if ( !pVosPacket ) break;
+      
+      // we are only handling the 802_11_MGMT frame type for PE/LIM.  All other frame types should be 
+      // ported to use the VOSS APIs directly and should not be using this palPktAlloc API.
+      VOS_ASSERT( HAL_TXRX_FRM_802_11_MGMT == frmType );
+      if ( HAL_TXRX_FRM_802_11_MGMT != frmType ) break;
+      
+      // return the vos packet to Voss.  Nothing to do if this fails since the palPktFree does not 
+      // have a return code.
+      vosStatus = vos_pkt_return_packet( pVosPacket );
+      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+      
+   } while( 0 );
+   
+   return;
+}
+   
+
+
+tANI_U32 palGetTickCount(tHddHandle hHdd)
+{
+   return( vos_timer_get_system_ticks() );
+}
+
+
+tANI_U32 pal_be32_to_cpu(tANI_U32 x)
+{
+   return( x );
+}
+
+tANI_U32 pal_cpu_to_be32(tANI_U32 x)
+{
+   return(( x ) );
+}   
+
+tANI_U16 pal_be16_to_cpu(tANI_U16 x)
+{
+   return( ( x ) );
+}   
+   
+tANI_U16 pal_cpu_to_be16(tANI_U16 x)
+{
+   return( ( x ) );
+}   
+
+
+
+eHalStatus palSpinLockAlloc( tHddHandle hHdd, tPalSpinLockHandle *pHandle )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   VOS_STATUS vosStatus;
+   vos_lock_t *pLock;
+   
+   do
+   {
+      pLock = vos_mem_malloc( sizeof( vos_lock_t ) );
+   
+      if ( NULL == pLock ) break;
+      
+      vosStatus = vos_lock_init( pLock );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         vos_mem_free( pLock );
+         break;
+      }
+      
+      *pHandle = (tPalSpinLockHandle)pLock;
+      halStatus = eHAL_STATUS_SUCCESS;
+      
+   } while( 0 );
+   
+   return( halStatus );   
+}
+
+
+eHalStatus palSpinLockFree( tHddHandle hHdd, tPalSpinLockHandle hSpinLock )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   vos_lock_t *pLock = (vos_lock_t *)hSpinLock;
+   VOS_STATUS vosStatus;
+   
+   vosStatus = vos_lock_destroy( pLock );
+   if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      // if we successfully destroy the lock, free
+      // the memory and indicate success to the caller.
+      vos_mem_free( pLock );
+      
+      halStatus = eHAL_STATUS_SUCCESS;
+   }
+   return( halStatus );
+}
+
+
+eHalStatus palSpinLockTake( tHddHandle hHdd, tPalSpinLockHandle hSpinLock )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   vos_lock_t *pLock = (vos_lock_t *)hSpinLock;
+   VOS_STATUS vosStatus;
+   
+   vosStatus = vos_lock_acquire( pLock );
+   if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      // if successfully acquire the lock, indicate success
+      // to the caller.
+      halStatus = eHAL_STATUS_SUCCESS;
+   }
+   
+   return( halStatus );
+}   
+   
+
+
+
+
+eHalStatus palSpinLockGive( tHddHandle hHdd, tPalSpinLockHandle hSpinLock )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   vos_lock_t *pLock = (vos_lock_t *)hSpinLock;
+   VOS_STATUS vosStatus;
+   
+   vosStatus = vos_lock_release( pLock );
+   if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      // if successfully acquire the lock, indicate success
+      // to the caller.
+      halStatus = eHAL_STATUS_SUCCESS;
+   }
+
+   return( halStatus );
+} 
+
+
+// Caller of this function MUST dynamically allocate memory for pBuf
+// because this funciton will free the memory.
+eHalStatus palSendMBMessage(tHddHandle hHdd, void *pBuf)
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   tSirRetStatus sirStatus;
+   v_CONTEXT_t vosContext;
+   v_VOID_t *hHal;
+
+   vosContext = vos_get_global_context( VOS_MODULE_ID_HDD, hHdd );
+   if (NULL == vosContext)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                "%s: invalid vosContext", __FUNCTION__);
+   }
+   else
+   {
+      hHal = vos_get_context( VOS_MODULE_ID_SME, vosContext );
+      if (NULL == hHal)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: invalid hHal", __FUNCTION__);
+      }
+      else
+      {
+         sirStatus = uMacPostCtrlMsg( hHal, pBuf );
+         if ( eSIR_SUCCESS == sirStatus )
+         {
+            halStatus = eHAL_STATUS_SUCCESS;
+         }
+      }
+   }
+
+   palFreeMemory( hHdd, pBuf );
+
+   return( halStatus );
+}
+  
+
+
+//All semophore functions are no-op here
+//PAL semaphore functions
+//All functions MUST return success. If change needs to be made, please check all callers' logic
+eHalStatus palSemaphoreAlloc( tHddHandle hHdd, tPalSemaphoreHandle *pHandle, tANI_S32 count )
+{
+    (void)hHdd;
+    (void)pHandle;
+    (void)count;
+    if(pHandle)
+    {
+        *pHandle = NULL;
+    }
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+eHalStatus palSemaphoreFree( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore )
+{
+    (void)hHdd;
+    (void)hSemaphore;
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+eHalStatus palSemaphoreTake( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore )
+{
+    (void)hHdd;
+    (void)hSemaphore;
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+eHalStatus palSemaphoreGive( tHddHandle hHdd, tPalSemaphoreHandle hSemaphore )
+{
+    (void)hHdd;
+    (void)hSemaphore;
+
+    return (eHAL_STATUS_SUCCESS);
+}
+
+eHalStatus palMutexAlloc( tHddHandle hHdd, tPalSemaphoreHandle *pHandle) 
+{
+    (void)hHdd;
+    (void)pHandle;
+
+    if(pHandle)
+    {
+        *pHandle = NULL;
+    }
+    return (eHAL_STATUS_SUCCESS);
+}
+
+eHalStatus palMutexAllocLocked( tHddHandle hHdd, tPalSemaphoreHandle *pHandle)
+{
+    (void)hHdd;
+    (void)pHandle;
+
+    if(pHandle)
+    {
+        *pHandle = NULL;
+    }
+    return (eHAL_STATUS_SUCCESS);
+}
+
+
+eAniBoolean pal_in_interrupt(void)
+{
+    return (eANI_BOOLEAN_FALSE);
+}
+
+void pal_local_bh_disable(void)
+{
+}
+
+void pal_local_bh_enable(void)
+{
+}
+
diff --git a/CORE/SYS/legacy/src/pal/src/palTimer.c b/CORE/SYS/legacy/src/pal/src/palTimer.c
new file mode 100644
index 0000000..72bb084
--- /dev/null
+++ b/CORE/SYS/legacy/src/pal/src/palTimer.c
@@ -0,0 +1,241 @@
+/*
+ * 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 palTimer.c
+  
+    \brief Implemenation of the Platform Abstracion Layer timer functions
+  
+    $Id$ 
+  
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated
+  
+    This file contains function implementations for the Platform Abstration Layer.    
+  
+ */
+
+#include <halTypes.h>
+#include <palTimer.h>
+#include <vos_timer.h>
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include <vos_memory.h>
+#endif
+
+typedef struct sPalTimer
+{   
+    palTimerCallback timerCallback;
+    void *pContext;
+    tHddHandle hHdd;         // not really needed when mapping to vos timers   
+    tANI_U32 uTimerInterval; //meaningful only is fRestart is true
+    tANI_BOOLEAN fRestart;
+    
+    vos_timer_t vosTimer;
+    
+} tPalTimer, *tpPalTimer;
+
+
+
+v_VOID_t internalTimerCallback( v_PVOID_t userData )
+{
+    tPalTimer *pPalTimer = (tPalTimer *)userData;
+    
+    if ( pPalTimer )
+    {
+        if ( pPalTimer->timerCallback )
+        {
+            pPalTimer->timerCallback( pPalTimer->pContext );
+        }
+        
+        if ( pPalTimer->fRestart )
+        {
+            palTimerStart( pPalTimer->hHdd, pPalTimer, pPalTimer->uTimerInterval, eANI_BOOLEAN_TRUE );
+        }
+    }
+}
+
+#ifdef TIMER_MANAGER
+eHalStatus palTimerAlloc_debug( tHddHandle hHdd, tPalTimerHandle *phPalTimer, 
+                          palTimerCallback pCallback, void *pContext, char* fileName, v_U32_t lineNum  )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   tPalTimer *pPalTimer = NULL;
+   VOS_STATUS vosStatus;
+    
+   do
+   {
+      // allocate the internal timer structure.
+      pPalTimer = vos_mem_malloc( sizeof( tPalTimer ) );
+      if ( NULL == pPalTimer ) break;
+       
+      // initialize the vos Timer that underlies the pal Timer.
+      vosStatus = vos_timer_init_debug( &pPalTimer->vosTimer, VOS_TIMER_TYPE_SW, 
+                                   internalTimerCallback, pPalTimer, fileName, lineNum );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         // if fail to init the vos timer, free the memory and bail out.
+         vos_mem_free( pPalTimer );
+         break;
+      }
+      
+      // initialize the info in the internal palTimer struct so we can 
+      pPalTimer->timerCallback = pCallback;
+      pPalTimer->pContext      = pContext;
+      pPalTimer->hHdd          = hHdd;
+      
+      // return a 'handle' to the caller.
+      *phPalTimer = pPalTimer;
+      
+      halStatus = eHAL_STATUS_SUCCESS;
+      
+   } while( 0 );   
+       
+    return( halStatus );
+}
+#else
+eHalStatus palTimerAlloc( tHddHandle hHdd, tPalTimerHandle *phPalTimer, 
+                          palTimerCallback pCallback, void *pContext )
+{
+   eHalStatus halStatus = eHAL_STATUS_FAILURE;
+   tPalTimer *pPalTimer = NULL;
+   VOS_STATUS vosStatus;
+    
+   do
+   {
+      // allocate the internal timer structure.
+      pPalTimer = vos_mem_malloc( sizeof( tPalTimer ) );
+      if ( NULL == pPalTimer ) break;
+       
+      // initialize the vos Timer that underlies the pal Timer.
+      vosStatus = vos_timer_init( &pPalTimer->vosTimer, VOS_TIMER_TYPE_SW, 
+                                   internalTimerCallback, pPalTimer );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         // if fail to init the vos timer, free the memory and bail out.
+         vos_mem_free( pPalTimer );
+         break;
+      }
+      
+      // initialize the info in the internal palTimer struct so we can 
+      pPalTimer->timerCallback = pCallback;
+      pPalTimer->pContext      = pContext;
+      pPalTimer->hHdd          = hHdd;
+      
+      // return a 'handle' to the caller.
+      *phPalTimer = pPalTimer;
+      
+      halStatus = eHAL_STATUS_SUCCESS;
+      
+   } while( 0 );   
+       
+    return( halStatus );
+}
+#endif
+
+
+eHalStatus palTimerFree( tHddHandle hHdd, tPalTimerHandle hPalTimer )
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   VOS_STATUS vosStatus;
+   tPalTimer *pPalTimer = (tPalTimer *)hPalTimer;
+    
+   do
+   {
+      if ( NULL == pPalTimer ) break;
+   
+      // Destroy the vos timer...      
+      vosStatus = vos_timer_destroy( &pPalTimer->vosTimer );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) break;
+      
+      // Free the memory for the intrnal timer struct...
+      vos_mem_free( pPalTimer );
+      
+      status = eHAL_STATUS_SUCCESS;
+      
+   } while( 0 );
+    
+   return( status );
+}
+
+
+eHalStatus palTimerStart(tHddHandle hHdd, tPalTimerHandle hPalTimer, tANI_U32 uExpireTime, tANI_BOOLEAN fRestart)
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   VOS_STATUS vosStatus;
+   tANI_U32 expireTimeInMS = 0;
+   
+   tPalTimer *pPalTimer = (tPalTimer *)hPalTimer;
+    
+   do 
+   {
+      if ( NULL == pPalTimer ) break;
+       
+      pPalTimer->fRestart = fRestart;
+      pPalTimer->uTimerInterval = uExpireTime;
+      
+      // vos Timer takes expiration time in milliseconds.  palTimerStart and 
+      // the uTimerIntervl in tPalTimer struct have expiration tiem in
+      // microseconds.  Make and adjustment from microseconds to milliseconds
+      // before calling the vos_timer_start().
+      expireTimeInMS = uExpireTime / 1000;
+      vosStatus = vos_timer_start( &pPalTimer->vosTimer, expireTimeInMS );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
+      {
+         status = eHAL_STATUS_FAILURE;
+         break;
+      }
+      
+      status = eHAL_STATUS_SUCCESS;   
+      
+   } while( 0 );
+    
+   return( status );
+}
+
+
+eHalStatus palTimerStop(tHddHandle hHdd, tPalTimerHandle hPalTimer)
+{
+   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+   
+   tPalTimer *pPalTimer = (tPalTimer *)hPalTimer;
+    
+   do 
+   {
+      if ( NULL == pPalTimer ) break;
+
+      vos_timer_stop( &pPalTimer->vosTimer );
+     
+      // make sure the timer is not re-started.
+      pPalTimer->fRestart = eANI_BOOLEAN_FALSE;
+
+      status = eHAL_STATUS_SUCCESS;
+
+   } while( 0 );   
+   
+   return( status );
+}   
+
+
+
+
+
+
diff --git a/CORE/SYS/legacy/src/platform/inc/VossWrapper.h b/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
new file mode 100644
index 0000000..b5ef51a
--- /dev/null
+++ b/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
@@ -0,0 +1,262 @@
+/*
+ * 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 __VOSS_WRAPPER_H
+#define __VOSS_WRAPPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+  @file VossWrapper.h
+
+  @brief This header file contains the various structure definitions and 
+  function prototypes for the RTOS abstraction layer, implemented for VOSS
+
+  Copyright (c) 2008 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 
+  --------    ---    --------------------------------------------------------
+  12/15/08    sho    Resolved warnings and errors from AMSS compiler when
+                     this is ported to WM
+  11/20/08    sho    Renamed this to VossWrapper.h; remove all dependencies
+                     on WM platform and allow this to work on all VOSS enabled
+                     platforms
+  06/24/08    tbh    Modified the file to remove the dependecy on HDD files as 
+                     part of Gen6 bring up process. 
+  10/29/02 Neelay Das Created file. 
+     
+===========================================================================*/ 
+
+/*---------------------------------------------------------------------------
+ * Include Files
+ * ------------------------------------------------------------------------*/
+
+#include "sirTypes.h"
+#include "sirParams.h"
+#include "sysDef.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#include "aniDbgTest.h"
+#include "vos_timer.h"
+#include "palApi.h"
+#include "vos_types.h"
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "vos_trace.h"
+#include "vos_memory.h"
+#endif
+
+/* Interlocked Compare Exchange related definitions */
+
+
+
+/* Define basic constants for the ThreadX kernel.  */
+
+#define TX_NO_WAIT          0
+#define TX_WAIT_FOREVER     0xFFFFFFFFUL
+#define TX_AUTO_ACTIVATE    1
+#define TX_NO_ACTIVATE      0
+
+
+
+/* API return values.  */
+#define TX_SUCCESS          0x00
+#define TX_QUEUE_FULL    0x01
+// ...
+#define TX_NO_INSTANCE      0x0D
+// ...
+#define TX_TIMER_ERROR      0x15
+#define TX_TICK_ERROR       0x16
+// ...
+
+
+#ifndef true
+#define true                1
+#endif
+
+#ifndef false
+#define false               0
+#endif
+
+/* Following macro specifies the number of milliseconds which constitute 1 ThreadX timer tick. Used
+   for mimicking the ThreadX timer behaviour on VOSS. */
+// Use the same MACRO used by firmware modules to calculate TICKs from mSec
+// Mismatch would cause worng timer value to be programmed
+#define TX_MSECS_IN_1_TICK  SYS_TICK_DUR_MS
+
+// Signature with which the TX_TIMER struct is initialized, when the timer is created
+#define TX_AIRGO_TMR_SIGNATURE   0xDEADBEEF
+
+
+/* Just #define out the thread and queue specific threadX calls, since the plan is to keep
+   the Windows port of the MAC non-threaded */
+
+#define  tx_thread_create(a, b, c, d, e, f, g, h, i)
+#define  tx_thread_delete(a)
+#define  tx_thread_resume(a)
+
+// Please note that for the Windows implementation for this routine the time is specified in terms of
+// microseconds and not timer ticks. Also, the DDK recommends that this routine should not be called with
+// sleep durations of more than 50 usecs.
+#define  tx_thread_sleep(uSecs)
+
+#define  tx_thread_suspend(a)
+#define  tx_thread_terminate(a)
+#define  tx_thread_identify() NULL
+
+#define  tx_queue_create(a, b, c, d, e) TX_SUCCESS
+#define  tx_queue_delete(a) TX_SUCCESS
+#define  tx_queue_get_ptr(a)    TX_SUCCESS
+#define  tx_queue_flush(a)  TX_SUCCESS
+#define  tx_queue_receive(a, b, c)  TX_SUCCESS
+#define  tx_queue_send(a, b, c) TX_SUCCESS
+
+#define  tx_disable_intr()
+#define  tx_enable_intr() 
+
+
+#define TX_DISABLE_INTR tx_disable_intr()
+#define TX_ENABLE_INTR  tx_enable_intr()
+
+#ifdef TIMER_MANAGER
+#define  tx_timer_create(a, b, c, d, e, f, g)   tx_timer_create_intern_debug((v_PVOID_t)pMac, a, b, c, d, e, f, g, __FILE__, __LINE__)
+#else
+#define  tx_timer_create(a, b, c, d, e, f, g)   tx_timer_create_intern((v_PVOID_t)pMac, a, b, c, d, e, f, g)
+#endif
+
+
+/*-------------------------------------------------------------------------*/
+/*  ThreadX structures are not mapped to Windows structures for the        */
+/*  following reasons:                                                     */
+/*      - Windows structures are written in C and they are not C++ aware.  */
+/*      - There should not be any dependency between MAC FW include tree   */
+/*        and Windows include tree.                                        */
+/*                                                                         */
+/*  Instead, ThreadX structures are defined here as void*.  This will be   */
+/*  used by the wrapper functions to save the pointer of the actual Windows*/
+/*  structure.  Windows structure is allocated in ?                        */
+/*-------------------------------------------------------------------------*/
+
+typedef v_PVOID_t TX_THREAD;
+typedef v_PVOID_t TX_QUEUE;
+typedef v_PVOID_t TX_MUTEX;
+
+/*--------------------------------------------------------------------*/
+/* Semaphore structure                                                */
+/* This structure is used to mimic the binary semaphore functionality */
+/* available on ThreadX.                                              */
+/*--------------------------------------------------------------------*/
+typedef v_SLONG_t TX_SEMAPHORE;
+
+/*--------------------------------------------------------------------*/
+/* Timer structure                                                    */
+/* This structure is used to implement ThreadX timer facility.  Just  */
+/* like ThreadX, timer expiration handler executes at the highest     */
+/* possible priority level, i.e. DISPATCH_LEVEL.                      */
+/*--------------------------------------------------------------------*/
+typedef struct TX_TIMER_STRUCT
+{
+#ifdef WLAN_DEBUG
+#define TIMER_MAX_NAME_LEN 50
+    char timerName[TIMER_MAX_NAME_LEN];
+#endif
+    v_ULONG_t  tmrSignature;
+    v_VOID_t   (*pExpireFunc)(v_PVOID_t, tANI_U32);
+    tANI_U32   expireInput;
+    v_ULONG_t  initScheduleTimeInMsecs;
+    v_ULONG_t  rescheduleTimeInMsecs;
+    vos_timer_t vosTimer;
+
+    // Pointer to the MAC global structure, which stores the context for the NIC,
+    // for which this timer is supposed to operate.
+    v_PVOID_t  pMac;
+    tANI_U8 sessionId;
+
+} TX_TIMER;
+
+#define TX_TIMER_VALID(timer) (timer.pMac != 0)
+
+typedef struct sAniSirTxWrapper
+{
+    // Back pointer to the pAdapter structure, needed for some of the internal routines
+    v_PVOID_t  pAdapter;
+
+} tAniSirTxWrapper, *tpAniSirTxWrapper;
+
+
+
+extern v_ULONG_t tx_time_get(v_VOID_t);
+extern v_UINT_t  tx_timer_activate(TX_TIMER*);
+extern v_UINT_t  tx_timer_change(TX_TIMER*, v_ULONG_t, v_ULONG_t);
+extern v_UINT_t  tx_timer_change_context(TX_TIMER*, tANI_U32);
+#ifdef TIMER_MANAGER
+extern v_UINT_t  tx_timer_create_intern_debug(v_PVOID_t, TX_TIMER*, char *, v_VOID_t(*)(v_PVOID_t, tANI_U32), 
+               tANI_U32, v_ULONG_t, v_ULONG_t, v_ULONG_t, char* fileName, v_U32_t lineNum );
+#else
+extern v_UINT_t  tx_timer_create_intern(v_PVOID_t, TX_TIMER*, char *, v_VOID_t(*)(v_PVOID_t, tANI_U32), tANI_U32, v_ULONG_t, v_ULONG_t, v_ULONG_t);
+#endif
+extern v_UINT_t  tx_timer_deactivate(TX_TIMER*);
+extern v_UINT_t  tx_timer_delete(TX_TIMER*);
+extern v_BOOL_t  tx_timer_running(TX_TIMER*);
+
+
+
+// Routines needed to initialize and cleanup the Windows wrapper
+extern v_VOID_t tx_voss_wrapper_init(v_PVOID_t, v_PVOID_t);
+
+#define schAddDphActivityQueueWin( a, b, c )
+
+// Debug display related globals
+extern v_ULONG_t gDbgLevel;
+extern v_ULONG_t gDbgMask;
+extern int gHalBufCnt;
+
+/* forward declaration From HDDUtil.h used by some internal files */
+
+extern v_U64_t utilGetCurrentTime(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+
+
diff --git a/CORE/SYS/legacy/src/platform/src/VossWrapper.c b/CORE/SYS/legacy/src/platform/src/VossWrapper.c
new file mode 100644
index 0000000..25a6d44
--- /dev/null
+++ b/CORE/SYS/legacy/src/platform/src/VossWrapper.c
@@ -0,0 +1,544 @@
+/*
+ * 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 VossWrapper.c
+
+  @brief This source file contains the various function definitions for the 
+  RTOS abstraction layer, implemented for VOSS
+
+  Copyright (c) 2008 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 
+  --------    ---    --------------------------------------------------------
+  03/31/09    sho    Remove the use of vosTimerIsActive flag as it is not
+                     thread-safe
+  02/17/08    sho    Fix the timer callback function to work when it is called
+                     after the timer has stopped due to a race condition.
+  02/10/08    sho    Refactor the TX timer to use VOS timer directly instead
+                     of using VOS utility timer
+  12/15/08    sho    Resolved errors and warnings from the AMSS compiler when
+                     this is ported from WM
+  11/20/08    sho    Renamed this to VosWrapper.c; remove all dependencies on
+                     WM platform and allow this to work on all VOSS enabled
+                     platform
+  06/24/08    tbh    Modified the file to remove the dependecy on HDD files as 
+                     part of Gen6 bring up process. 
+  10/29/02 Neelay Das Created file. 
+     
+===========================================================================*/ 
+
+/*---------------------------------------------------------------------------
+ * Include Files
+ * ------------------------------------------------------------------------*/
+#include "VossWrapper.h"
+
+#ifdef WLAN_DEBUG
+#define TIMER_NAME timer_ptr->timerName 
+#else
+#define TIMER_NAME "N/A"
+#endif
+
+// Routine used to retrieve the Winwrapper context pointer from the pMac structure
+extern tpAniSirTxWrapper sysGetTxWrapperContext(v_PVOID_t pMac);
+
+
+ 
+ /**---------------------------------------------------------------------
+ * tx_voss_wrapper_init() 
+ *
+ * FUNCTION:  Initialize the VOSS wrapper 
+ *
+ * LOGIC:
+ *       - Just allocate the spinlock used for critical section implementation.
+ *
+ * ASSUMPTIONS:
+ *        - None.
+ *
+ * NOTE:
+ *
+ * @param  None.
+ *
+ * @return None.
+ *
+ */
+v_VOID_t tx_voss_wrapper_init(v_PVOID_t pMacGlobal, v_PVOID_t pAdapter)
+{
+    tpAniSirTxWrapper pTxWrapper = sysGetTxWrapperContext(pMacGlobal);
+
+    // if already allocated, then don't allcoate again...
+    if ( !pTxWrapper->pAdapter )
+    {
+        // Store the pointer to the MAC globals structure, in the Tx wrapper context
+        pTxWrapper->pAdapter = pAdapter;
+
+    }
+}
+
+
+
+/**---------------------------------------------------------------------
+ * tx_time_get() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return current system time in units of miliseconds
+ *
+ */ 
+v_ULONG_t tx_time_get( void )
+{
+   return(vos_timer_get_system_ticks());
+
+} //* tx_time_get()
+
+
+/**---------------------------------------------------------------------
+ * tx_timer_activate() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return TX_SUCCESS.
+ *
+ */
+v_UINT_t tx_timer_activate(TX_TIMER *timer_ptr)
+{
+   VOS_STATUS status;
+  
+    // Uncomment the asserts, if the intention is to debug the occurence of the
+    // following anomalous cnditions.
+
+    // Assert that the timer structure pointer passed, is not NULL
+    //dbgAssert(NULL != timer_ptr);
+
+    // If the NIC is halting just spoof a successful timer activation, so that all
+    // the timers can be cleaned up.
+
+    if(NULL == timer_ptr)
+        return TX_TIMER_ERROR;
+
+    // Put a check for the free builds
+    if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature) {
+        VOS_ASSERT( timer_ptr->tmrSignature == 0 );
+
+        return TX_TIMER_ERROR;
+
+    }
+
+    // Check for an uninitialized timer
+    VOS_ASSERT(0 != strlen(TIMER_NAME));
+
+    VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+            "Timer %s being activated\n", TIMER_NAME);
+
+    status = vos_timer_start( &timer_ptr->vosTimer, 
+         timer_ptr->initScheduleTimeInMsecs );
+
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+            "Timer %s now activated\n", TIMER_NAME);
+      return TX_SUCCESS;
+   }
+   else if (VOS_STATUS_E_ALREADY == status)
+   {
+      // starting timer fails because timer is already started; this is okay
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+            "Timer %s is already running\n", TIMER_NAME);
+      return TX_SUCCESS;
+   }
+   else
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, 
+            "Timer %s fails to activate\n", TIMER_NAME);
+      return TX_TIMER_ERROR;
+   }
+} /*** tx_timer_activate() ***/
+
+
+/**---------------------------------------------------------------------
+ * tx_timer_change() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return TX_SUCCESS.
+ *
+ */
+v_UINT_t tx_timer_change(TX_TIMER *timer_ptr, 
+      v_ULONG_t initScheduleTimeInTicks, v_ULONG_t rescheduleTimeInTicks)
+{
+   // Put a check for the free builds
+   if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature) {
+       VOS_ASSERT( timer_ptr->tmrSignature == 0 );
+
+       return TX_TIMER_ERROR;      
+   }
+
+    // changes cannot be applied until timer stops running
+    if (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&timer_ptr->vosTimer))
+    {
+       timer_ptr->initScheduleTimeInMsecs = TX_MSECS_IN_1_TICK * initScheduleTimeInTicks;
+       timer_ptr->rescheduleTimeInMsecs = TX_MSECS_IN_1_TICK * rescheduleTimeInTicks;
+       return TX_SUCCESS;
+    }
+    else
+    {
+       return TX_TIMER_ERROR;
+    }
+} /*** tx_timer_change() ***/
+
+/**---------------------------------------------------------------------
+ * tx_timer_change_context() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return TX_SUCCESS.
+ *
+ */
+v_UINT_t tx_timer_change_context(TX_TIMER *timer_ptr, tANI_U32 expiration_input)
+{
+
+    // Put a check for the free builds
+    if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature) {
+       VOS_ASSERT( timer_ptr->tmrSignature == 0 );
+
+       return TX_TIMER_ERROR;      
+    }
+
+    // changes cannot be applied until timer stops running
+    if (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&timer_ptr->vosTimer))
+    {
+       timer_ptr->expireInput = expiration_input;
+       return TX_SUCCESS;
+    }
+    else
+    {
+       return TX_TIMER_ERROR;
+    }
+} /*** tx_timer_change() ***/
+
+
+/**---------------------------------------------------------------------
+ * tx_main_timer_func() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return None.
+ *
+ */
+static v_VOID_t tx_main_timer_func( v_PVOID_t functionContext )
+{
+   TX_TIMER *timer_ptr = (TX_TIMER *)functionContext;
+
+   VOS_ASSERT(NULL != timer_ptr);
+
+   VOS_ASSERT(NULL != timer_ptr->pExpireFunc);
+
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+             "Timer %s triggered\n", TIMER_NAME);
+
+   // Now call the actual timer function, taking the function pointer,
+   // from the timer structure.
+   (* timer_ptr->pExpireFunc)( timer_ptr->pMac, timer_ptr->expireInput );
+
+   // check if this needs to be rescheduled
+   if (0 != timer_ptr->rescheduleTimeInMsecs)
+   {
+      VOS_STATUS status;
+      status = vos_timer_start( &timer_ptr->vosTimer, 
+                                timer_ptr->rescheduleTimeInMsecs );
+      timer_ptr->rescheduleTimeInMsecs = 0;
+
+      if (VOS_STATUS_SUCCESS != status)
+      {
+         VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN, 
+             "Unable to reschedule timer %s; status=%d\n", TIMER_NAME, status);
+      }
+   }
+} /*** tx_timer_change() ***/
+
+#ifdef TIMER_MANAGER
+v_UINT_t tx_timer_create_intern_debug( v_PVOID_t pMacGlobal, TX_TIMER *timer_ptr,
+   char *name_ptr, 
+   v_VOID_t ( *expiration_function )( v_PVOID_t, tANI_U32 ),
+   tANI_U32 expiration_input, v_ULONG_t initScheduleTimeInTicks, 
+   v_ULONG_t rescheduleTimeInTicks, v_ULONG_t auto_activate, 
+   char* fileName, v_U32_t lineNum)
+{
+    VOS_STATUS status;
+
+    VOS_ASSERT((NULL != expiration_function) && (NULL != name_ptr));
+
+    if (!initScheduleTimeInTicks)
+        return TX_TICK_ERROR;
+
+    if (!timer_ptr)
+        return TX_TIMER_ERROR;
+
+    // Initialize timer structure
+    timer_ptr->pExpireFunc = expiration_function;
+    timer_ptr->expireInput = expiration_input;
+    timer_ptr->initScheduleTimeInMsecs =
+        TX_MSECS_IN_1_TICK * initScheduleTimeInTicks;
+    timer_ptr->rescheduleTimeInMsecs =
+        TX_MSECS_IN_1_TICK * rescheduleTimeInTicks;
+    timer_ptr->pMac = pMacGlobal;
+
+    // Set the flag indicating that the timer was created
+    timer_ptr->tmrSignature = TX_AIRGO_TMR_SIGNATURE;
+
+#ifdef WLAN_DEBUG
+    // Store the timer name
+    strlcpy(timer_ptr->timerName, name_ptr, sizeof(timer_ptr->timerName));
+#endif // Store the timer name, for Debug build only
+
+    status = vos_timer_init_debug( &timer_ptr->vosTimer, VOS_TIMER_TYPE_SW, 
+          tx_main_timer_func, (v_PVOID_t)timer_ptr, fileName, lineNum);
+    if (VOS_STATUS_SUCCESS != status)
+    {
+       VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+             "Cannot create timer for %s\n", TIMER_NAME);
+       return TX_TIMER_ERROR;
+    }
+
+    if(0 != rescheduleTimeInTicks)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+                  "Creating periodic timer for %s\n", TIMER_NAME);
+    }
+
+    // Activate this timer if required
+    if (auto_activate)
+    {
+        tx_timer_activate(timer_ptr);
+    }
+
+    return TX_SUCCESS;
+
+} //** tx_timer_create() ***/
+#else
+v_UINT_t tx_timer_create_intern( v_PVOID_t pMacGlobal, TX_TIMER *timer_ptr,
+   char *name_ptr, 
+   v_VOID_t ( *expiration_function )( v_PVOID_t, tANI_U32 ),
+   tANI_U32 expiration_input, v_ULONG_t initScheduleTimeInTicks, 
+   v_ULONG_t rescheduleTimeInTicks, v_ULONG_t auto_activate )
+{
+    VOS_STATUS status;
+
+    VOS_ASSERT((NULL != expiration_function) && (NULL != name_ptr));
+    if((NULL == name_ptr) || (NULL == expiration_function))
+        return TX_TIMER_ERROR;
+
+    if (!initScheduleTimeInTicks)
+        return TX_TICK_ERROR;
+
+    if (!timer_ptr)
+        return TX_TIMER_ERROR;
+
+    // Initialize timer structure
+    timer_ptr->pExpireFunc = expiration_function;
+    timer_ptr->expireInput = expiration_input;
+    timer_ptr->initScheduleTimeInMsecs =
+        TX_MSECS_IN_1_TICK * initScheduleTimeInTicks;
+    timer_ptr->rescheduleTimeInMsecs =
+        TX_MSECS_IN_1_TICK * rescheduleTimeInTicks;
+    timer_ptr->pMac = pMacGlobal;
+
+    // Set the flag indicating that the timer was created
+    timer_ptr->tmrSignature = TX_AIRGO_TMR_SIGNATURE;
+
+#ifdef WLAN_DEBUG
+    // Store the timer name
+    vos_mem_copy(timer_ptr->timerName, name_ptr, sizeof(timer_ptr->timerName));
+#endif // Store the timer name, for Debug build only
+
+    status = vos_timer_init( &timer_ptr->vosTimer, VOS_TIMER_TYPE_SW, 
+          tx_main_timer_func, (v_PVOID_t)timer_ptr );
+    if (VOS_STATUS_SUCCESS != status)
+    {
+       VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+             "Cannot create timer for %s\n", TIMER_NAME);
+       return TX_TIMER_ERROR;
+    }
+
+    if(0 != rescheduleTimeInTicks)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+                  "Creating periodic timer for %s\n", TIMER_NAME);
+    }
+
+    // Activate this timer if required
+    if (auto_activate)
+    {
+        tx_timer_activate(timer_ptr);
+    }
+
+    return TX_SUCCESS;
+
+} //** tx_timer_create() ***/
+#endif
+
+
+/**---------------------------------------------------------------------
+ * tx_timer_deactivate() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return TX_SUCCESS.
+ *
+ */
+v_UINT_t tx_timer_deactivate(TX_TIMER *timer_ptr)
+{
+   VOS_STATUS vStatus;
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+             "tx_timer_deactivate() called for timer %s\n", TIMER_NAME);
+
+   // Put a check for the free builds
+   if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature)
+   {
+      return TX_TIMER_ERROR;      
+   }
+
+   // if the timer is not running then we do not need to do anything here
+   vStatus = vos_timer_stop( &timer_ptr->vosTimer );
+   if (VOS_STATUS_SUCCESS != vStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN, 
+                "Unable to stop timer %s; status =%d\n", 
+                TIMER_NAME, vStatus);
+   }
+
+   return TX_SUCCESS;
+
+} /*** tx_timer_deactivate() ***/
+
+v_UINT_t tx_timer_delete( TX_TIMER *timer_ptr )
+{
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+             "tx_timer_delete() called for timer %s\n", TIMER_NAME);
+
+   // Put a check for the free builds
+   if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature)
+   {
+      return TX_TIMER_ERROR;      
+   }
+
+   vos_timer_destroy( &timer_ptr->vosTimer );
+   return TX_SUCCESS;     
+} /*** tx_timer_delete() ***/
+
+
+
+/**---------------------------------------------------------------------
+ * tx_timer_running() 
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param  
+ *
+ * @return TX_SUCCESS.
+ *
+ */
+v_BOOL_t tx_timer_running(TX_TIMER *timer_ptr)
+{
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
+             "tx_timer_running() called for timer %s\n", TIMER_NAME);
+
+   // Put a check for the free builds
+   if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature)
+      return VOS_FALSE;      
+
+   if (VOS_TIMER_STATE_RUNNING == 
+       vos_timer_getCurrentState( &timer_ptr->vosTimer ))
+   {
+       return VOS_TRUE;
+   }
+   return VOS_FALSE;
+
+} /*** tx_timer_running() ***/
diff --git a/CORE/SYS/legacy/src/system/inc/sysDebug.h b/CORE/SYS/legacy/src/system/inc/sysDebug.h
new file mode 100644
index 0000000..6ac7143
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/inc/sysDebug.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.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file sysGlobal.h contains the logDump utility for system module.
+ * Author:      V. K. Kandarpa
+ * Date:        01/24/2002
+ * History:-
+ * Date         Modified by    Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __SYS_DEBUG_H__
+#define __SYS_DEBUG_H__
+
+#include <stdarg.h>
+# include "utilsApi.h"
+# include "sirDebug.h"
+# include "sirParams.h"
+
+void sysLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...);
+
+#endif // __SYS_DEBUG_H__
diff --git a/CORE/SYS/legacy/src/system/inc/sysDef.h b/CORE/SYS/legacy/src/system/inc/sysDef.h
new file mode 100644
index 0000000..fdb9c08
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/inc/sysDef.h
@@ -0,0 +1,191 @@
+/*
+ * 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 sysDef.h contains the common definitions used to bring up
+ * Sirius system.
+ * Author:      V. K. Kandarpa
+ * Date:        04/13/2002
+ * History:-
+ * Date         Modified by    Modification Information
+ * --------------------------------------------------------------------
+ */
+
+#ifndef __SYSDEF_H
+#define __SYSDEF_H
+
+/// Sirius system level defitions
+// NOTE: Do not program system timer tick duration to less than 1msec
+
+/// System timer tick duration in nanoseconds
+#if defined ANI_OS_TYPE_LINUX
+#ifdef ANI_AP_SDK
+#define SYS_TICK_DUR_NS     10000000    // 10ms
+#define SYS_TICK_TO_MICRO_SECOND   10000
+#else
+#define SYS_TICK_DUR_NS     1000000    // 1ms
+#define SYS_TICK_TO_MICRO_SECOND   1000
+#endif
+#elif defined ANI_OS_TYPE_OSX
+#define SYS_TICK_DUR_NS     10000000    // 10ms
+#define SYS_TICK_TO_MICRO_SECOND   10000
+#elif defined ANI_OS_TYPE_WINDOWS
+#define SYS_TICK_DUR_NS     20000000    // 20ms
+#define SYS_TICK_TO_MICRO_SECOND   20000
+#else
+#define SYS_TICK_DUR_NS     10000000    // 10ms
+#define SYS_TICK_TO_MICRO_SECOND   10000
+#endif
+
+/// System timer tick duration in miliseconds
+#define SYS_TICK_DUR_MS     (SYS_TICK_DUR_NS/1000000)
+
+/// Clocks in a milisecond
+#define SYS_CLOCKS_PER_MS   120000 // 120 MHz 
+
+// In Milliseconds
+#define SYS_ADD_BA_RSP_DUR   1000
+
+/// System timer tick duration in clocks
+#define SYS_TICK_DUR_CLK    (SYS_TICK_DUR_MS * SYS_CLOCKS_PER_MS)
+
+/// Number of timer ticks in a second
+#define SYS_TICKS_PER_SECOND (1000/SYS_TICK_DUR_MS)
+
+/// Macro to convert MS to Ticks
+#define SYS_MS_TO_TICKS(x)   ((x) / SYS_TICK_DUR_MS)
+
+/// Macro to convert Seconds to Ticks
+#define SYS_SEC_TO_TICKS(x)  ((x) * SYS_TICKS_PER_SECOND)
+
+/// Macro to convert Minutes to Ticks
+#define SYS_MIN_TO_TICKS(x)  (((x) * 60) * SYS_TICKS_PER_SECOND)
+
+/// MNT task processing interval in seconds
+#define SYS_MNT_INTERVAL     60
+
+/// MS to Time Units
+#define SYS_MS_TO_TU(x)      (x * 1000) >> 10;
+
+/// TU to MS
+#define SYS_TU_TO_MS(x)      ((x << 10) / 1000)
+
+// ---------  End of Windows & RTAI -----------
+
+/// Message queue definitions
+
+/// gHalMsgQ
+# define SYS_HAL_Q_SIZE     200        // Holds up to 25 messages
+
+/// gMMHhiPriorityMsgQ
+# define SYS_MMH_HI_PRI_Q_SIZE      200        // Holds up to 25 messages
+
+/// gMMHprotocolMsgQ
+# define SYS_MMH_PROT_Q_SIZE     400          // Holds up to 50 messages
+
+/// gMMHdebugMsgQ
+# define SYS_MMH_DEBUG_Q_SIZE    800          // Holds up to 100 messages
+
+/// gMAINTmsgQ
+# define SYS_MNT_Q_SIZE          200          // Holds up to 25 messages
+
+/// LIM Message Queue
+# define SYS_LIM_Q_SIZE          400          // Holds up to 50 messages
+
+/// Scheduler Message Queue
+# define SYS_SCH_Q_SIZE          800          // Holds up to 25 messages
+
+/// PMM Message Queue
+# define SYS_PMM_Q_SIZE          800          // Holds up to 100 messages
+
+/// TX Message Queue
+# define SYS_TX_Q_SIZE           2048    // Holds up to 400 messages
+
+/// RX Message Queue
+# define SYS_RX_Q_SIZE           2048   // Holds up to 400 messages
+
+/// PTT  Message Queue
+# define SYS_NIM_PTT_Q_SIZE   200             // Holds up to 25 messages
+
+/// Semaphore definitions
+// Data Semaphore
+
+# define SYS_DPH_SEM_INITIAL_CNT 0
+
+// Transport Semaphore
+
+# define SYS_BBT_SEM_INITIAL_CNT 0
+
+/// Thread definitions
+// tHAL
+
+# define SYS_HAL_THREAD_ENTRY_FUNCTION halEntry
+# define SYS_HAL_STACK_SIZE            8192
+# define SYS_HAL_THREAD_PRIORITY       2
+
+// tDPH
+
+# define SYS_DPH_THREAD_ENTRY_FUNCTION dphEntry
+# define SYS_DPH_STACK_SIZE            8192
+# define SYS_DPH_THREAD_PRIORITY       15
+
+// tBBT
+
+# define SYS_BBT_THREAD_ENTRY_FUNCTION bbtEntry
+# define SYS_BBT_STACK_SIZE            8192
+# define SYS_BBT_THREAD_PRIORITY       16
+
+// tSCH
+
+# define SYS_SCH_STACK_SIZE            8192
+# define SYS_SCH_THREAD_PRIORITY       17
+
+// tPMM
+
+# define SYS_PMM_STACK_SIZE            8192
+# define SYS_PMM_THREAD_PRIORITY       17
+
+// tLIM
+
+# define SYS_LIM_THREAD_ENTRY_FUNCTION limEntry
+# define SYS_LIM_STACK_SIZE            8192
+# define SYS_LIM_THREAD_PRIORITY       18
+
+// tMAINT
+
+# define SYS_MNT_THREAD_ENTRY_FUNCTION mntEntry
+# define SYS_MNT_STACK_SIZE            8192
+# define SYS_MNT_THREAD_PRIORITY       25
+
+// tMMH
+
+# define SYS_MMH_THREAD_ENTRY_FUNCTION mmhEntry
+# define SYS_MMH_STACK_SIZE            8192
+# define SYS_MMH_THREAD_PRIORITY        10
+
+// tNIM_MNT_PKT_GEN
+
+# define SYS_NIM_PTT_THREAD_STACK_SIZE 8192
+# define SYS_NIM_PTT_THREAD_PRIORITY   28
+
+#endif // __SYSDEF_H
diff --git a/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h b/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h
new file mode 100644
index 0000000..aed10ec
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/inc/sysEntryFunc.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.
+ * This file sysEntryFunc.h contains module entry functions definitions
+ * Author:      V. K. Kandarpa
+ * Date:        04/13/2002
+ * History:-
+ * Date         Modified by    Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef __SYS_ENTRY_FUNC_H
+#define __SYS_ENTRY_FUNC_H
+
+#include "aniGlobal.h"
+
+extern tSirRetStatus sysInitGlobals(tpAniSirGlobal);
+extern void sysBbtEntry(tANI_U32 dummy);
+extern void sysSchEntry(tANI_U32 dummy);
+extern void sysPmmEntry(tANI_U32 dummy);
+extern void sysDphEntry(tANI_U32 dummy);
+extern void sysLimEntry(tANI_U32 dummy);
+extern void sysMmhEntry(tANI_U32 dummy);
+extern void sysMntEntry(tANI_U32 dummy);
+extern void sysHalEntry(tANI_U32 dummy);
+extern void sysNimPttEntry(tANI_U32 dummy);
+
+#endif // __SYS_ENTRY_FUNC_H
diff --git a/CORE/SYS/legacy/src/system/inc/sysStartup.h b/CORE/SYS/legacy/src/system/inc/sysStartup.h
new file mode 100644
index 0000000..1f1558f
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/inc/sysStartup.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.
+ */
+
+
+/*
+ *
+ * Woodside Networks, Inc proprietary. All rights reserved
+ * sysStartup.h: System startup header file.
+ * Author:  V. K. Kandarpa
+ * Date:    01/29/2002
+ *
+ * History:-
+ * Date     Modified by         Modification Information
+ * --------------------------------------------------------------------------
+ *
+ */
+
+# ifndef __SYSSTARTUP_H
+# define __SYSSTARTUP_H
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDataStruct.h"
+#endif
+#include "sirParams.h"
+
+/* Defines */
+
+/* Function */
+
+extern void sysMACCleanup(void *);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+extern void sysBbtProcessMessage( tHalHandle hHal, tpHalBufDesc pBD );
+#endif
+extern tSirRetStatus sysBbtProcessMessageCore(struct sAniSirGlobal *, tpSirMsgQ,
+                                               tANI_U32, tANI_U32);
+
+
+# endif /* __SYSSTARTUP_H */
diff --git a/CORE/SYS/legacy/src/system/src/macInitApi.c b/CORE/SYS/legacy/src/system/src/macInitApi.c
new file mode 100644
index 0000000..dd1648a
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/src/macInitApi.c
@@ -0,0 +1,508 @@
+/*
+ * 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 - This file has all the mac level init functions
+ *                   for all the defined threads at system level.
+ * Author:    Dinesh Upadhyay
+ * Date:      04/23/2007
+ * History:-
+ * Date: 04/08/2008       Modified by: Santosh Mandiganal
+ * Modification Information: Code to allocate and free the  memory for DumpTable entry.
+ * --------------------------------------------------------------------------
+ *
+ */
+/* Standard include files */
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+
+/* Application Specific include files */
+#include "halInternal.h"
+#include "halHddApis.h"
+#include "halDebug.h"
+#include "halMTU.h"
+#include "halRxp.h"
+#include "halPhyApi.h"
+
+//#ifdef ANI_OS_TYPE_LINUX
+#include "halCommonApi.h"   // halCleanup
+#endif
+#include "cfgApi.h"         // cfgCleanup
+#include "limApi.h"         // limCleanup
+#include "sirTypes.h"
+#include "sysDebug.h"
+#include "sysEntryFunc.h"
+#include "macInitApi.h"
+#if defined(ANI_LOGDUMP)
+#include "logDump.h"
+#endif //#if defined(ANI_LOGDUMP)
+
+#ifdef TRACE_RECORD
+#include "macTrace.h"
+#endif
+
+extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac);
+extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac);
+
+
+
+
+tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+tSirRetStatus macPreStart(tHalHandle hHal)
+{
+   tSirRetStatus status = eSIR_SUCCESS;
+   tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;
+   tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+   tANI_U8 i;
+
+   for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
+   {
+      if(palAllocateMemory(pMac->hHdd, ((void *)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry))
+          != eHAL_STATUS_SUCCESS)
+      {
+         memAllocFailed = eANI_BOOLEAN_TRUE;
+         break;
+      }
+      else
+      {
+         palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg));
+      }
+   }
+   if( memAllocFailed )
+   {
+      while(i>0)
+      {
+         i--;
+         palFreeMemory(pMac, pMac->dumpTableEntry[i]);
+      }
+      sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
+      status = eSIR_FAILURE;
+   }
+
+#if defined(ANI_LOGDUMP)
+   //logDumpInit must be called before any module starts
+   logDumpInit(pMac);
+#endif //#if defined(ANI_LOGDUMP)
+
+   return status;
+}
+
+tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
+{
+   tSirRetStatus status = eSIR_SUCCESS;
+   tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+
+   if (NULL == pMac)
+   {
+      VOS_ASSERT(0);
+      status = eSIR_FAILURE;
+      return status;
+   }
+
+   pMac->gDriverType = ((tHalMacStartParameters*)pHalMacStartParams)->driverType;
+
+   sysLog(pMac, LOG2, FL("called\n"));
+
+   do
+   {
+
+#if defined(TRACE_RECORD)
+      //Enable Tracing
+      macTraceInit(pMac);
+#endif
+
+      if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void *)&pMac->pResetMsg), sizeof(tSirMbMsg))))
+      {
+         sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n"));
+         status = eSIR_FAILURE;
+         break;
+      }
+      else
+      {
+         palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg));
+      }
+
+      if (pMac->gDriverType != eDRIVER_TYPE_MFG)
+      {
+         status = peStart(pMac);
+      }
+
+   } while(0);
+   pMac->sys.abort = false;
+
+   return status;
+}
+
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
+{
+    tANI_U8 i;
+    tSirRetStatus status = eSIR_SUCCESS;
+    eHalStatus             halStatus;
+    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+    tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;
+
+    if(NULL == pMac)
+    {
+        VOS_ASSERT(0);
+        status = eSIR_FAILURE;
+        return status;
+    }
+
+    pMac->gDriverType = ((tHalMacStartParameters *)pHalMacStartParams)->driverType;
+
+    sysLog(pMac, LOG2, FL("called\n"));
+
+    do
+    {
+        for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
+        {
+            if(palAllocateMemory(pMac->hHdd, ((void **)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry))
+                != eHAL_STATUS_SUCCESS)
+            {
+                memAllocFailed = eANI_BOOLEAN_TRUE;
+                break;
+            }
+            else
+            {
+                palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg));
+            }
+        }
+        if( memAllocFailed )
+        {
+            while(i>0)
+            {
+                i--;
+                palFreeMemory(pMac, pMac->dumpTableEntry[i]);
+            }
+            sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
+            status = eSIR_FAILURE;
+            break;
+        }
+        else
+        {
+#if defined(ANI_LOGDUMP)
+            logDumpInit(pMac);
+#endif //#if defined(ANI_LOGDUMP)
+        }
+
+#if defined(TRACE_RECORD)
+        //Enable Tracing
+        macTraceInit(pMac);
+#endif
+        if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void **)&pMac->pResetMsg), sizeof(tSirMbMsg))))
+        {
+            sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n"));
+            status = eSIR_FAILURE;
+            break;
+        }
+        else
+        {
+            palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg));
+        }
+
+        halStatus = halStart(hHal, (tHalMacStartParameters*)pHalMacStartParams );
+
+        if ( !HAL_STATUS_SUCCESS(halStatus) )
+        {
+            sysLog(pMac,LOGE, FL("halStart failed with error code = %d\n"), halStatus);
+            status = eSIR_FAILURE;
+        }
+        else if(pMac->gDriverType != eDRIVER_TYPE_MFG)
+        {
+            peStart(pMac);
+        }
+
+    }while(0);
+    pMac->sys.abort = false;
+
+    return status;
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/** -------------------------------------------------------------
+\fn macStop
+\brief this function will be called from HDD to stop MAC. This function will stop all the mac modules.
+\       memory with global context will only be initialized not freed here.
+\param   tHalHandle hHal
+\param tHalStopType
+\return tSirRetStatus
+  -------------------------------------------------------------*/
+
+tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType)
+{
+    tANI_U8 i;
+    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    halStop(hHal, stopType);
+#endif
+    peStop(pMac);
+    cfgCleanup( pMac );
+    // need to free memory if not called in reset context.
+    // in reset context this memory will be freed by HDD.
+    if(false == pMac->sys.abort)
+    {
+        palFreeMemory(pMac->hHdd, pMac->pResetMsg);
+        pMac->pResetMsg = NULL;
+    }
+    /* Free the DumpTableEntry */
+    for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
+    {
+        palFreeMemory(pMac, pMac->dumpTableEntry[i]);
+    }
+
+    return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn macOpen
+\brief this function will be called during init. This function is suppose to allocate all the
+\       memory with the global context will be allocated here.
+\param   tHalHandle pHalHandle
+\param   tHddHandle hHdd
+\param   tHalOpenParameters* pHalOpenParams
+\return tSirRetStatus
+  -------------------------------------------------------------*/
+
+tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms)
+{
+    tpAniSirGlobal pMac = NULL;
+
+    if(pHalHandle == NULL)
+        return eSIR_FAILURE;
+
+    /*
+     * Make sure this adapter is not already opened. (Compare pAdaptor pointer in already
+     * allocated pMac structures.)
+     * If it is opened just return pointer to previously allocated pMac pointer.
+     * Or should this result in error?
+     */
+
+    /* Allocate pMac */
+    if (palAllocateMemory(hHdd, ((void **)&pMac), sizeof(tAniSirGlobal)) != eHAL_STATUS_SUCCESS)
+        return eSIR_FAILURE;
+
+    /* Initialize the pMac structure */
+    palZeroMemory(hHdd, pMac, sizeof(tAniSirGlobal));
+
+    /** Store the Driver type in pMac Global.*/
+    //pMac->gDriverType = pMacOpenParms->driverType;
+
+#ifndef GEN6_ONWARDS
+#ifdef RTL8652
+    {
+        //Leverage 8651c's on-chip data scratchpad memory to lock all HAL DxE data there
+        extern void * rtlglue_alloc_data_scratchpad_memory(unsigned int size, char *);
+        pMac->hal.pHalDxe = (tpAniHalDxe) rtlglue_alloc_data_scratchpad_memory(sizeof(tAniHalDxe),  "halDxe");
+    }
+    if(pMac->hal.pHalDxe){
+        ;
+    }else
+#endif
+    /* Allocate HalDxe */
+    if (palAllocateMemory(hHdd, ((void **)&pMac->hal.pHalDxe), sizeof(tAniHalDxe)) != eHAL_STATUS_SUCCESS){
+        palFreeMemory(hHdd, pMac);
+        return eSIR_FAILURE;
+    }
+    /* Initialize the HalDxe structure */
+    palZeroMemory(hHdd, pMac->hal.pHalDxe, sizeof(tAniHalDxe));
+#endif //GEN6_ONWARDS
+
+    /*
+     * Set various global fields of pMac here
+     * (Could be platform dependant as some variables in pMac are platform
+     * dependant)
+     */
+    pMac->hHdd      = hHdd;
+    pMac->pAdapter  = hHdd; //This line wil be removed
+    *pHalHandle     = (tHalHandle)pMac;
+
+    {
+        /* Call various PE (and other layer init here) */
+        if( eHAL_STATUS_SUCCESS != logInit(pMac))
+           return eSIR_FAILURE;
+            
+        /* Call routine to initialize CFG data structures */
+        if( eSIR_SUCCESS != cfgInit(pMac) )
+            return eSIR_FAILURE;
+
+        sysInitGlobals(pMac);
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+        // This decides whether HW needs to translate the 802.3 frames
+        // from the host OS to the 802.11 frames. When set HW does the
+        // translation from 802.3 to 802.11 and vice versa
+        if(pMacOpenParms->frameTransRequired) {
+            pMac->hal.halMac.frameTransEnabled = 1;
+        } else {
+            pMac->hal.halMac.frameTransEnabled = 0;
+        }
+#endif
+
+        //Need to do it here in case halOpen fails later on.
+#if defined( VOSS_ENABLED )
+        tx_voss_wrapper_init(pMac, hHdd);
+#endif
+    }
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    if (eHAL_STATUS_SUCCESS != halOpen(pMac, pHalHandle, hHdd, pMacOpenParms))
+        return eSIR_FAILURE;
+#endif
+
+    return peOpen(pMac, pMacOpenParms);
+}
+
+/** -------------------------------------------------------------
+\fn macClose
+\brief this function will be called in shutdown sequence from HDD. All the
+\       allocated memory with global context will be freed here.
+\param   tpAniSirGlobal pMac
+\return none
+  -------------------------------------------------------------*/
+
+tSirRetStatus macClose(tHalHandle hHal)
+{
+
+    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
+
+#ifndef GEN6_ONWARDS
+    if(pMac->hal.pHalDxe){
+#ifdef RTL8652
+        extern void * rtlglue_is_data_scratchpad_memory(void *);
+        if(rtlglue_is_data_scratchpad_memory(pMac->hal.pHalDxe))
+            ;
+        else
+#endif
+            palFreeMemory(pMac, pMac->hal.pHalDxe);
+    }
+#endif //GEN6_ONWARDS
+
+    peClose(pMac);
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    halClose(hHal);
+#endif
+
+    /* Call routine to free-up all CFG data structures */
+    cfgDeInit(pMac);
+
+    logDeinit(pMac);
+
+    // Finally, de-allocate the global MAC datastructure:
+    palFreeMemory( pMac->hHdd, pMac );
+
+    return eSIR_SUCCESS;
+}
+
+/** -------------------------------------------------------------
+\fn macReset
+\brief this function is called to send Reset message to HDD. Then HDD will start the reset process.
+\param   tpAniSirGlobal pMac
+\param   tANI_U32 rc
+\return    tSirRetStatus.
+  -------------------------------------------------------------*/
+
+tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc)
+{
+    tSirRetStatus status = eSIR_SUCCESS;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    if(eHAL_STATUS_SUCCESS != halReset((tHalHandle)pMac, rc))
+          status = eSIR_FAILURE;
+#else
+    sysLog(pMac, LOGE, FL("*************No-op. Need to call WDA reset function \n"));
+#endif
+    return status;
+}
+
+// ----------------------------------------------------------------------
+/**
+ * macSysResetReq
+ *
+ * FUNCTION:
+ *   All MAC modules use this interface in case of an exception.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @param tANI_U32 reset reason code
+ * @return tANI_U16 - returs the status.
+ */
+
+void
+macSysResetReq(tpAniSirGlobal pMac, tANI_U32 rc)
+{
+    sysLog(pMac, LOGE, FL("Reason Code = 0x%X\n"),rc);
+
+    switch (rc)
+    {
+        case eSIR_STOP_BSS:
+        case eSIR_SME_BSS_RESTART:
+        case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
+        case eSIR_CFB_FLAG_STUCK_EXCEPTION:
+                // FIXME
+                //macReset(pMac, rc);
+                break;
+
+        case eSIR_EOF_SOF_EXCEPTION:
+        case eSIR_BMU_EXCEPTION:
+        case eSIR_CP_EXCEPTION:
+        case eSIR_LOW_PDU_EXCEPTION:
+        case eSIR_USER_TRIG_RESET:
+        case eSIR_AHB_HANG_EXCEPTION:
+        default:
+             macReset(pMac, rc);
+            break;
+
+    }
+}
+
+// -------------------------------------------------------------
+/**
+ * macSysResetReqFromHDD
+ *
+ * FUNCTION:
+ *   This reset function gets invoked from the HDD to request a reset.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @return tANI_U16 - returs the status.
+ */
+
+void
+macSysResetReqFromHDD(void *pMac, tANI_U32 rc)
+{
+    macSysResetReq( (tpAniSirGlobal)pMac, rc );
+}
+
diff --git a/CORE/SYS/legacy/src/system/src/sysEntryFunc.c b/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
new file mode 100644
index 0000000..7e215e2
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
@@ -0,0 +1,733 @@
+/*
+ * 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
+ * sysEntryFunc.cc - This file has all the system level entry functions
+ *                   for all the defined threads at system level.
+ * Author:    V. K. Kandarpa
+ * Date:      01/16/2002
+ * History:-
+ * Date       Modified by            Modification Information
+ * --------------------------------------------------------------------------
+ *
+ */
+/* Standard include files */
+
+/* Application Specific include files */
+#include "sirCommon.h"
+#include "aniGlobal.h"
+
+
+#include "limApi.h"
+#include "schApi.h"
+#include "utilsApi.h"
+#include "pmmApi.h"
+
+#include "sysDebug.h"
+#include "sysDef.h"
+#include "sysEntryFunc.h"
+#include "sysStartup.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halMacSecurityApi.h"
+#endif
+#include "limTrace.h"
+#include "wlan_qct_wda.h"
+
+#ifndef WLAN_FTM_STUB
+tSirRetStatus
+postPTTMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
+#endif
+
+#ifdef VOSS_ENABLED
+#include "vos_types.h"
+#include "vos_packet.h"
+#endif
+
+// ---------------------------------------------------------------------------
+/**
+ * sysInitGlobals
+ *
+ * FUNCTION:
+ *    Initializes system level global parameters
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal Sirius software parameter struct pointer
+ * @return None
+ */
+
+tSirRetStatus
+sysInitGlobals(tpAniSirGlobal pMac)
+{
+
+    palZeroMemory(pMac->hHdd, (tANI_U8 *) &pMac->sys, sizeof(pMac->sys));
+
+#if defined(ANI_DEBUG)
+    //FIXME : right now we want the reset to happen even in diag debug build.
+    // later on we need to set this to true.
+    //pMac->sys.debugOnReset = true;
+    pMac->sys.debugOnReset = false;
+#else
+    pMac->sys.debugOnReset = false;
+#endif
+
+    pMac->sys.gSysEnableScanMode        = 1;
+    pMac->sys.gSysEnableLinkMonitorMode = 0;
+    pMac->sys.fTestRadar                = false;
+    pMac->sys.radarDetected             = false;
+    pMac->sys.gSysdropLimPkts           = false;
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    if(eHAL_STATUS_SUCCESS != halGlobalInit(pMac))
+        return eSIR_FAILURE;
+#endif
+    schInitGlobals(pMac);
+
+    return eSIR_SUCCESS;
+}
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+
+
+// ---------------------------------------------------------------------------
+/**
+ * sysIsLearnScanModeFrame
+ *
+ * FUNCTION:
+ * Determine whether the received frame was received in learn/scan mode
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pFrame
+ * @return true if frame was received in learn/scan mode
+ *         false otherwise
+ */
+
+static inline tANI_U8
+sysIsLearnScanModeFrame(tpHalBufDesc pBd)
+{
+    if( SIR_MAC_BD_TO_SCAN_LEARN(pBd) )
+         return 1;
+    else
+        return 0;
+}
+#endif
+// ---------------------------------------------------------------------------
+/**
+ * sysBbtProcessMessageCore
+ *
+ * FUNCTION:
+ * Process BBT messages
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal A pointer to MAC params instance
+ * @param pMsg message pointer
+ * @param tANI_U32 type
+ * @param tANI_U32 sub type
+ * @return None
+ */
+tSirRetStatus
+sysBbtProcessMessageCore(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tANI_U32 type,
+                         tANI_U32 subType)
+{
+    tSirRetStatus ret;
+    void*         pBd;
+    tMgmtFrmDropReason dropReason;
+    vos_pkt_t  *pVosPkt = (vos_pkt_t *)pMsg->bodyptr;
+    VOS_STATUS  vosStatus =
+              WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&pBd, VOS_FALSE );
+    pMac->sys.gSysBbtReceived++;
+
+    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+    {
+        goto fail;
+    }
+
+    PELOGW(sysLog(pMac, LOGW, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
+    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
+    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));)
+
+    pMac->sys.gSysFrameCount[type][subType]++;
+
+    if(type == SIR_MAC_MGMT_FRAME)
+    {
+
+            if( (dropReason = limIsPktCandidateForDrop(pMac, pBd, subType)) != eMGMT_DROP_NO_DROP)
+            {
+                PELOG1(sysLog(pMac, LOG1, FL("Mgmt Frame %d being dropped, reason: %d\n"), subType, dropReason);)
+                MTRACE(macTrace(pMac,   TRACE_CODE_RX_MGMT_DROP, 0, dropReason);)
+                goto fail;
+            }
+            //Post the message to PE Queue
+            ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg);
+            if (ret != eSIR_SUCCESS)
+            {
+                PELOGE(sysLog(pMac, LOGE, FL("posting to LIM2 failed, ret %d\n"), ret);)
+                goto fail;
+            }
+            pMac->sys.gSysBbtPostedToLim++;
+    }
+#ifdef FEATURE_WLAN_CCX
+    else if (type == SIR_MAC_DATA_FRAME)
+    {
+        PELOGW(sysLog(pMac, LOGW, FL("IAPP Frame...\n")););
+        //Post the message to PE Queue
+        ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg);
+        if (ret != eSIR_SUCCESS)
+        {
+            PELOGE(sysLog(pMac, LOGE, FL("posting to LIM2 failed, ret %d\n"), ret);)
+            goto fail;
+        }
+        pMac->sys.gSysBbtPostedToLim++;
+    }
+#endif
+    else
+    {
+        PELOGE(sysLog(pMac, LOGE, "BBT received Invalid type %d subType %d "
+                   "LIM state %X. BD dump is:\n",
+                   type, subType, limGetSmeState(pMac));
+        sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGE,
+                       (tANI_U8 *) pBd, WLANHAL_RX_BD_HEADER_SIZE);)
+
+        goto fail;
+    }
+
+    return eSIR_SUCCESS;
+
+fail:
+
+    pMac->sys.gSysBbtDropped++;
+    return eSIR_FAILURE;
+}
+
+
+void sysLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
+{
+    // Verify against current log level
+    if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SYS_MODULE_ID )] )
+        return;
+    else
+    {
+        va_list marker;
+
+        va_start( marker, pString );     /* Initialize variable arguments. */
+
+        logDebug(pMac, SIR_SYS_MODULE_ID, loglevel, pString, marker);
+
+        va_end( marker );              /* Reset variable arguments.      */
+    }
+}
+
+
+
+#if defined( ANI_OS_TYPE_WINDOWS )
+// ---------------------------------------------------------------------------
+/**
+ * sysBbtProcessMessage
+ *
+ * FUNCTION:
+ *    Process BBT messages
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param pBD Buffer descriptor pointer
+ * @return None
+ */
+void sysBbtProcessMessage( tHalHandle hHal, void *pBD )
+{
+    tpAniSirGlobal  pMac = PMAC_STRUCT( hHal );
+    tpSirMacMgmtHdr mHdr;
+    tSirMsgQ        msg;
+
+    //
+    //  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(pBD);
+
+    // Dump received packet
+    /*
+    if(pBD->swBdType != SMAC_SWBD_TYPE_CTLMSG)
+        sysLog( pMac, LOG3,
+            FL( "%s: RX Mesg Type %d, subType %d, MPDU Len %d, RXP Flags 0x%x\n" ),
+            __FUNCTION__,
+            mHdr->fc.type,
+            mHdr->fc.subType,
+            pBD->mpduLength,
+            pBD->rxpFlags );
+    */
+    //sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, SIR_MAC_BD_TO_MPDUDATA(pBD), SIR_MAC_BD_TO_PAYLOAD_LEN(pBD));
+
+    // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
+    msg.type = SIR_BB_XPORT_MGMT_MSG;
+    msg.bodyptr = pBD;
+    msg.bodyval = 0;
+
+    if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
+                                                  &msg,
+                                                  mHdr->fc.type,
+                                                  mHdr->fc.subType ))
+    {
+        sysLog( pMac, LOGW,
+                FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
+
+        // TODO - Will the caller (HDD) free the received packet?
+    }
+}
+#endif // #if defined( ANI_OS_TYPE_WINDOWS )
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+#ifndef WLAN_FTM_STUB
+#include "pttModuleApi.h"
+#endif // eDRIVER_TYPE_MFG
+
+// ---------------------------------------------------------------------
+/**
+ * sysMmhEntry
+ *
+ * FUNCTION:
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy Dummy parameter
+ * @return None
+ */
+void
+sysMmhEntry(tANI_U32 dummy)
+{
+    tSirMbMsg  *pMbMsg;
+    tSirMsgQ    msg;
+    tpAniSirGlobal pMac;
+
+    pMac = getPMac();
+
+    sysLog(pMac, LOG4, "MMH task started\n");
+
+    while (1)
+    {
+        // Blocks waiting for messages from HDD
+
+        tx_queue_receive(&pMac->sys.gSirTxMsgQ, (void*)&pMbMsg,
+                         TX_WAIT_FOREVER);
+        // Compose inter-module message and send it off to the receiver
+        msg.type = sirReadU16N((tANI_U8*)&(pMbMsg->type));
+        msg.bodyptr = pMbMsg;
+        msg.bodyval = 0;
+        sysLog(pMac, LOG4, "<MMH> HDD message received id=0x%x\n", msg.type);
+        if (pMac->sys.abort==1)
+        {
+            if (msg.type==eWNI_SME_STOP_BSS_REQ)
+            {
+                sirStoreU16N((tANI_U8*)(&(pMbMsg->type)), eWNI_SME_STOP_BSS_RSP);
+                pMbMsg->data[0] = 0;
+                halMmhPostMsgApi(pMac, &msg,  ePROT);
+            }
+            else
+            {
+                // we should free buffer, but only if it is an skbuff
+            }
+            continue;
+        }
+
+        switch (msg.type & 0xFF00)
+        {
+            case SIR_HAL_MSG_TYPES_BEGIN:
+                if (halPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
+                    sysLog(pMac, LOGP, "sysMmhEntry: halPostMsgApi Failed!\n");
+                else
+                {
+                    sysLog(pMac, LOG4, "<MMH> Message forwarded to HAL\n");
+                }
+
+                break;
+
+            case SIR_LIM_MSG_TYPES_BEGIN:
+                limPostMsgApi(pMac, &msg);
+                break;
+
+            case SIR_MNT_MSG_TYPES_BEGIN:
+
+                if (halMntPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
+                    sysLog(pMac, LOGP, "sysMmhEntry: halMntPostMsgApi Failed!\n");
+                else
+                {
+                    sysLog(pMac, LOG4, "<MMH> Message forwarded to MNT type (%X)\n",
+                           msg.type);
+                }
+
+                break;
+
+            case SIR_PMM_MSG_TYPES_BEGIN:
+
+                // Shall have its API call here; Once API is added, remove the
+                // following release memory call.
+                break;
+
+            case SIR_CFG_MSG_TYPES_BEGIN:
+
+                if (halMntPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
+                    sysLog(pMac, LOGP,
+                           "sysMmhEntry: cfg msg: halMntPostMsgApi Failed!\n");
+                else
+                {
+                    sysLog(pMac, LOG4,
+                           "sysMmhEntry: cfg msg: halMntPostMsgApi!\n");
+                }
+
+                break;
+
+#ifndef WLAN_FTM_STUB
+            case PTT_MSG_TYPES_BEGIN_30: /*PTT_MSG_TYPES_BEGIN:*/
+            case PTT_MSG_TYPES_BEGIN_31:
+            case PTT_MSG_TYPES_BEGIN_32:
+                if (postPTTMsgApi(pMac, &msg) != eSIR_SUCCESS)
+                    sysLog(pMac, LOGP,
+                           "sysMmhEntry: RD msg: postPTTMsgApi Failed!\n");
+                else
+                {
+                    sysLog(pMac, LOG4,
+                           "sysMmhEntry: RD msg: postPTTMsgApi!\n");
+                }
+                break;
+#endif
+
+            default:
+                sysLog(pMac, LOGW, "sysMmhEntry Unknown destination \n");
+                // Unknown destination.  Just drop it
+                palFreeMemory( pMac->hHdd, (void*)pMbMsg);
+        }
+    }
+
+} /*** sysMmhEntry() ***/
+
+#endif // #if defined(ANI_OS_TYPE_RTAI_LINUX)
+
+#if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
+
+// ---------------------------------------------------------------------------
+/**
+ * sysSchEntry
+ *
+ * FUNCTION:
+ *         SCH thread entry function.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy At present there is no need of any entry input. Default=0
+ * @return None
+ */
+void
+sysSchEntry(tANI_U32 i)
+{
+    tpAniSirGlobal pMac;
+    pMac = getPMac();
+    while (1)
+{
+        schProcessMessageQueue(pMac);
+    }
+} // sysSchEntry()
+
+
+// ---------------------------------------------------------------------------
+/**
+ * sysPmmEntry
+ *
+ * FUNCTION:
+ *         PMM thread entry function.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy At present there is no need of any entry input. Default=0
+ * @return None
+ */
+void
+sysPmmEntry(tANI_U32 i)
+{
+    tpAniSirGlobal pMac;
+    pMac = getPMac();
+    while (1)
+    {
+        pmmProcessMessageQueue(pMac);
+    }
+} // sysPmmEntry()
+
+
+// ---------------------------------------------------------------------
+/**
+ * sysLimEntry
+ *
+ * FUNCTION:
+ *   LIM thread entry point
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy Dummy parameter
+ * @return None
+ */
+
+void
+sysLimEntry(tANI_U32 dummy)
+{
+    tpAniSirGlobal pMac;
+    pMac = getPMac();
+    limInitialize(pMac);
+
+    while (1)
+    {
+        limProcessMessageQueue(pMac);
+    } // while(1)
+} // limEntry()
+
+
+
+// ---------------------------------------------------------------------
+/**
+ * sysMntEntry
+ *
+ * FUNCTION:
+ *    MNT thread entry point
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy Dummy parameter
+ * @return None
+ */
+
+void
+sysMntEntry(tANI_U32 dummy)
+{
+    tANI_U32      status;
+    tSirMsgQ msg;
+    tpAniSirGlobal pMac;
+    pMac = getPMac();
+    sysLog(pMac, LOG4, "<MNT> MNT task started\n");
+
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+    tANI_U32      interval;
+    interval = SYS_MNT_INTERVAL * SYS_TICKS_PER_SECOND;
+#endif
+
+    while (1)
+    {
+#if defined(ANI_OS_TYPE_RTAI_LINUX)
+        status = tx_queue_receive(&pMac->sys.gSirMntMsgQ, &msg, interval);
+#else
+        status = tx_queue_receive(&pMac->sys.gSirMntMsgQ, &msg,
+                                  TX_WAIT_FOREVER);
+#endif
+
+        // this routine only dequeues the message from queue
+        // processing is done by sysMntProcessMsg
+        if (status == TX_SUCCESS)
+        {
+            if (halMntProcessMsgs(pMac, &msg) != eSIR_SUCCESS)
+            {
+                sysLog(pMac, LOGP, "sysMntEntry: halMntProcessMsgs call "
+                       "failed!\n");
+            }
+        }
+    }
+} // sysMntEntry()
+
+// ---------------------------------------------------------------------
+/**
+ * sysHalEntry
+ *
+ * FUNCTION:
+ *   HAL thread entry point
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ * NOTE:
+ *
+ * @param dummy Dummy parameter
+ * @return None
+ */
+
+void
+sysHalEntry(tANI_U32 dummy)
+{
+    tANI_U32 status;
+    tSirMsgQ msg;
+    tpAniSirGlobal pMac;
+
+    pMac = getPMac();
+    sysLog(pMac, LOG4, "<HAL> HAL task started\n");
+
+    while (1)
+    {
+
+        status = tx_queue_receive(&pMac->sys.gSirHalMsgQ, &msg,
+                                  TX_WAIT_FOREVER);
+        // this routine only dequeues the message from queue
+        if (status == TX_SUCCESS)
+        {
+            if (halProcessMsg(pMac, &msg) != eSIR_SUCCESS)
+            {
+                sysLog(pMac, LOGP, "sysHalEntry: halProcessMsgQ call failed!\n");
+            }
+        }
+    } // while(1)
+} // sysHalEntry
+
+#ifndef WLAN_FTM_STUB
+#include "pttModuleApi.h"
+// ---------------------------------------------------------------------
+// ---------------------------------------------------------------------
+/**
+  * sysNimPttEntry
+  *
+  * FUNCTION:
+  *   NIM PTT thread entry point
+  * LOGIC:
+  *
+  * ASSUMPTIONS:
+  *
+  * NOTE:
+  *
+  * @param dummy Dummy parameter
+  * @return None
+  */
+
+void
+sysNimPttEntry(tANI_U32 dummy)
+{
+    tANI_U32 status;
+    tSirMsgQ msg;
+    tpAniSirGlobal pMac;
+    pMac = getPMac();
+
+    sysLog(pMac, LOGW, "<NIM> PTT task started\n");
+
+    while (1)
+    {
+        status = tx_queue_receive(&pMac->sys.gSirNimRDMsgQ, &msg,
+                                  TX_WAIT_FOREVER);
+
+        // this routine only dequeues the message from queue
+        if (status == TX_SUCCESS)
+        {
+            pttProcessMsg(pMac, (tPttMsgbuffer *)msg.bodyptr);
+            //TODO: the resonse is now packaged in ((tPttMsgbuffer *)&msg->body)->msgResponse and needs to be sent back to the application
+        }
+     } // while(1)
+} // sysNimPttEntry
+
+// ---------------------------------------------------------------------
+
+// -------------------------------------------------------------
+/**
+ * postPTTMsgApi
+ *
+ * FUNCTION:
+ *     Posts NIM messages to gNIM thread
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:pl
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @param pMsg pointer with message
+ * @return Success or Failure
+ */
+
+tSirRetStatus
+postPTTMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+    tSirRetStatus rc = eSIR_SUCCESS;
+    tPttMsgbuffer *pPttMsg;
+    ePttMsgId msgId;
+    uPttMsgs *msgBody;
+    tANI_U8 *pReq = (tANI_U8*) pMsg->bodyptr;
+
+    pPttMsg = (tPttMsgbuffer *)pReq;
+#if (defined(ANI_OS_TYPE_RTAI_LINUX) && defined(ANI_LITTLE_BYTE_ENDIAN))
+    pPttMsg->msgId = sirReadU16N((tANI_U8 *)&(pPttMsg->msgId));
+#endif
+    msgId = (ePttMsgId)(pPttMsg->msgId);
+    msgBody = (uPttMsgs *)&(pPttMsg->msgBody);
+    do
+    {
+#if defined ANI_OS_TYPE_LINUX || defined ANI_OS_TYPE_OSX
+        // Posts message to the queue
+        if (tx_queue_send(&pMac->sys.gSirHalMsgQ, pMsg,
+                          TX_NO_WAIT) != TX_SUCCESS)
+        {
+            rc = eSIR_FAILURE;
+            break;
+        }
+#else
+        // For Windows based MAC, instead of posting message to different
+        // queues, we will call the handler routines directly
+
+        //pttProcessMsg(pMac, pMsg);
+        rc = eSIR_SUCCESS;
+#endif
+    }
+    while (0);
+
+    return rc;
+} // postPTTMsgApi()
+
+
+#endif // eDRIVER_TYPE_MFG
+
+#endif // #if defined ANI_OS_TYPE_LINUX || defined ANI_OS_TYPE_OSX
+
diff --git a/CORE/SYS/legacy/src/system/src/sysWinStartup.c b/CORE/SYS/legacy/src/system/src/sysWinStartup.c
new file mode 100644
index 0000000..dcd14b8
--- /dev/null
+++ b/CORE/SYS/legacy/src/system/src/sysWinStartup.c
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ * sysWinStartup.cpp: System startup file for Windows platform.
+ * Author:         Rajesh Bhagwat
+ * Date:           11/01/02
+ * History:-
+ * 11/01/02        Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "limApi.h"
+
+#include "utilsApi.h"
+#include "sysEntryFunc.h"
+#include "sysStartup.h"
+#include "cfgApi.h"
+
+// Routine used to retrieve the Winwrapper context pointer from the pMac structure
+extern tpAniSirTxWrapper sysGetTxWrapperContext(void *);
+
+
+tpAniSirTxWrapper
+sysGetTxWrapperContext(void *pMac)
+{
+    return &((tpAniSirGlobal)(pMac))->txWrapper;
+}
diff --git a/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h b/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h
new file mode 100644
index 0000000..845c967
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h
@@ -0,0 +1,95 @@
+/*
+ * 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 DOT11FDEFS_H_82A7B72E_C36C_465D_82A7_139EA5322582
+#define DOT11FDEFS_H_82A7B72E_C36C_465D_82A7_139EA5322582
+/**
+ * \file dot11fdefs.h
+ *
+ * \brief C defines customizing our framesc-generated code
+ *
+ *
+ *
+ * Copyright (C) 2006 Airgo Networks, Incorporated
+ *
+ * 'framesc' generates code written in terms of a number of macros
+ * intended for customization.
+ *
+ *
+ */
+
+#include "parserApi.h"
+
+// This controls how the "dot11f" code copies memory
+#define DOT11F_MEMCPY(ctx, dst, src, len) \
+    palCopyMemory( ( ctx )->hHdd, ( tANI_U8* )( dst ), ( tANI_U8* )( src ), ( len ) )
+
+// This controls how the "dot11f" code compares memory
+#define DOT11F_MEMCMP(ctx, lhs, rhs, len) \
+    ( ! palEqualMemory( ( ctx )->hHdd, ( tANI_U8* )( lhs ), ( tANI_U8* )( rhs ), ( len ) ) )
+
+#   if defined ( DBG ) && ( DBG != 0 )
+
+#       //define DOT11F_ENABLE_LOGGING
+#       //define DOT11F_DUMP_FRAMES
+#       define DOT11F_LOG_GATE ( 4 )
+#       define FRAMES_SEV_FOR_FRAME(ctx, sig) \
+            ( DOT11F_ASSOCREQUEST == (sig) ? 3 : 5 )
+
+        #if defined( DOT11F_ENABLE_LOGGING )
+
+#       define DOT11F_HAVE_LOG_MACROS
+
+#       define FRAMES_LOG0(ctx, sev, fmt) \
+            dot11fLog((ctx), (sev), (fmt));
+
+#       define FRAMES_LOG1(ctx, sev, fmt, p1) \
+            dot11fLog((ctx), (sev), (fmt), (p1));
+
+#       define FRAMES_LOG2(ctx, sev, fmt, p1, p2) \
+            dot11fLog((ctx), (sev), (fmt), (p1), (p2));
+
+#       define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3) \
+            dot11fLog((ctx), (sev), (fmt), (p1), (p2), (p3));
+
+#       define FRAMES_DUMP(ctx, sev, p, n) \
+            sirDumpBuf((pCtx), SIR_DBG_MODULE_ID, (sev), (p), (n));
+
+        #endif //#if defined( DOT11F_ENABLE_LOGGING )
+
+#   else
+
+#       undef DOT11F_ENABLE_LOGGING
+#       undef DOT11F_DUMP_FRAMES
+#       define DOT11F_LOG_GATE ( 1 )
+
+#   endif
+
+
+// #define DOT11F_ENABLE_DBG_BREAK ( 1 )
+
+// Local Variables:
+// fill-column: 72
+// indent-tabs-mode: nil
+// show-trailing-whitespace: t
+// End:
+
+#endif // DOT11FDEFS_H_82A7B72E_C36C_465D_82A7_139EA5322582
diff --git a/CORE/SYS/legacy/src/utils/inc/utilsParser.h b/CORE/SYS/legacy/src/utils/inc/utilsParser.h
new file mode 100644
index 0000000..c9c29d6
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/inc/utilsParser.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.
+ */
+
+/*
+ *
+ * Airgo Networks, Inc proprietary. All rights reserved.
+ * This file utilsParser.h contains the utility function protos
+ * used internally by the parser
+ * Author:        Chandra Modumudi
+ * Date:          02/11/02
+ * History:-
+ * Date           Modified by    Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+#ifndef __UTILS_PARSE_H__
+#define __UTILS_PARSE_H__
+
+#include <stdarg.h>
+#include "sirApi.h"
+#include "dot11f.h"
+#include "utilsApi.h"
+
+void          ConvertSSID           (tpAniSirGlobal, tSirMacSSid*,               tDot11fIESSID*);
+void          ConvertSuppRates      (tpAniSirGlobal, tSirMacRateSet*,            tDot11fIESuppRates*);
+void          ConvertExtSuppRates   (tpAniSirGlobal, tSirMacRateSet*,            tDot11fIEExtSuppRates*);
+void          ConvertQOSCaps        (tpAniSirGlobal, tSirMacQosCapabilityIE*,    tDot11fIEQOSCapsAp*);
+void          ConvertQOSCapsStation (tpAniSirGlobal, tSirMacQosCapabilityStaIE*, tDot11fIEQOSCapsStation*);
+tSirRetStatus ConvertWPA            (tpAniSirGlobal, tSirMacWpaInfo*,            tDot11fIEWPA*);
+tSirRetStatus ConvertWPAOpaque      (tpAniSirGlobal, tSirMacWpaInfo*,            tDot11fIEWPAOpaque*);
+tSirRetStatus ConvertRSN            (tpAniSirGlobal, tSirMacRsnInfo*,            tDot11fIERSN*);
+tSirRetStatus ConvertRSNOpaque      (tpAniSirGlobal, tSirMacRsnInfo*,            tDot11fIERSNOpaque*);
+void          ConvertPowerCaps      (tpAniSirGlobal, tSirMacPowerCapabilityIE*,  tDot11fIEPowerCaps*);
+void          ConvertSuppChannels   (tpAniSirGlobal, tSirMacSupportedChannelIE*, tDot11fIESuppChannels*);
+void          ConvertCFParams       (tpAniSirGlobal, tSirMacCfParamSet*,         tDot11fIECFParams*);
+void          ConvertTIM            (tpAniSirGlobal, tSirMacTim*,                tDot11fIETIM*);
+void          ConvertCountry        (tpAniSirGlobal, tSirCountryInformation*,    tDot11fIECountry*);
+void          ConvertWMMParams      (tpAniSirGlobal, tSirMacEdcaParamSetIE*,     tDot11fIEWMMParams*);
+void          ConvertERPInfo        (tpAniSirGlobal, tSirMacErpInfo*,            tDot11fIEERPInfo*);
+void          ConvertEDCAParam      (tpAniSirGlobal, tSirMacEdcaParamSetIE*,     tDot11fIEEDCAParamSet*);
+void          ConvertTSPEC          (tpAniSirGlobal, tSirMacTspecIE*,            tDot11fIETSPEC*);
+tSirRetStatus ConvertTCLAS          (tpAniSirGlobal, tSirTclasInfo*,             tDot11fIETCLAS*);
+void          ConvertWMMTSPEC       (tpAniSirGlobal, tSirMacTspecIE*,            tDot11fIEWMMTSPEC*);
+tSirRetStatus ConvertWMMTCLAS       (tpAniSirGlobal, tSirTclasInfo*,             tDot11fIEWMMTCLAS*);
+void          ConvertTSDelay        (tpAniSirGlobal, tSirMacTsDelayIE*,          tDot11fIETSDelay*);
+void          ConvertSchedule       (tpAniSirGlobal, tSirMacScheduleIE*,         tDot11fIESchedule*);
+void          ConvertWMMSchedule    (tpAniSirGlobal, tSirMacScheduleIE*,         tDot11fIEWMMSchedule*);
+tSirRetStatus ConvertWscOpaque      (tpAniSirGlobal, tSirAddie*,                 tDot11fIEWscIEOpaque*);
+#ifdef WLAN_FEATURE_P2P
+tSirRetStatus ConvertP2POpaque      (tpAniSirGlobal, tSirAddie*,                 tDot11fIEP2PIEOpaque*);
+#endif
+
+
+#endif
diff --git a/CORE/SYS/legacy/src/utils/src/dot11f.c b/CORE/SYS/legacy/src/utils/src/dot11f.c
new file mode 100644
index 0000000..9d18626
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/dot11f.c
@@ -0,0 +1,38651 @@
+/*
+ * 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 dot11f.c
+  *
+  * \brief Structures, functions & 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!
+  *
+  *
+  */
+
+#if !defined  ANI_OS_TYPE_OSX && !defined ANI_OS_TYPE_LINUX && !defined ANI_OS_TYPE_ANDROID
+#include <memory.h> /* For memcpy */
+#include <stdio.h>  /* For _vsnprintf */
+#include <stddef.h> /* For offsetof */
+#endif
+
+#include <aniGlobal.h>
+#include <utilsApi.h>
+#include "dot11fdefs.h"
+#include "dot11f.h"
+
+#if defined ( _MSC_VER )
+#   pragma warning (disable: 4244)
+#   pragma warning (disable: 4505)
+#   pragma warning (disable: 4702)
+#   pragma warning (disable: 4996) /* ... was declared deprecated */
+#endif /* Microsoft C/C++ */
+
+typedef unsigned char tFRAMES_BOOL;
+typedef void (*pfnGeneric_t)(void);
+
+typedef struct sFFDefn {
+    const char  *name;
+    tANI_U32 offset;
+    tANI_U16 sig;
+    tANI_U8  size;
+} tFFDefn;
+
+typedef struct sIEDefn {
+    tANI_U32  offset;
+    tANI_U32  presenceOffset;
+    tANI_U32  countOffset;
+    const char   *name;
+    tANI_U16  arraybound;
+    tANI_U16  minSize;
+    tANI_U16  maxSize;
+    tANI_U16  sig;
+    unsigned char oui[5];
+    unsigned char noui;
+    tANI_U8   eid;
+    tFRAMES_BOOL  fMandatory;
+} tIEDefn;
+
+#if !defined(countof)
+#define countof(x) ( sizeof( (x) ) / sizeof( (x)[0] ) )
+#endif
+
+#if ! defined(DOT11F_MEMCPY)
+#   define DOT11F_MEMCPY(ctx, dst, src, len) \
+        memcpy( (dst), (src), (len) )        \
+
+#endif
+
+#if ! defined(DOT11F_MEMCMP)
+#   define DOT11F_MEMCMP(ctx, lhs, rhs, len) \
+        memcmp( (lhs), (rhs), (len) )        \
+
+#endif
+
+#ifndef DOT11F_HAVE_LOG_SEVERITIES
+#   define FRLOG_OFF ( 0 )
+#   define FRLOGP    ( 1 )
+#   define FRLOGE    ( 2 )
+#   define FRLOGW    ( 3 )
+#   define FRLOG1    ( 4 )
+#   define FRLOG2    ( 5 )
+#   define FRLOG3    ( 6 )
+#   define FRLOG4    ( 7 )
+#endif
+
+#define FRFL(x) x
+
+#ifdef DOT11F_ENABLE_LOGGING
+
+#ifndef DOT11F_HAVE_LOG_MACROS
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifndef DOT11F_LOG_GATE
+#   define DOT11F_LOG_GATE FRLOGW
+#endif // DOT11F_LOG_GATE
+
+#ifdef WIN32
+
+#if defined ( _CONSOLE ) || defined ( _WINDOWS ) || defined ( _DLL ) || defined ( _LIB )
+#include <windows.h>
+#define DBGPRINT OutputDebugStringA
+#else  /* Not User mode */
+#define DBGPRINT DbgPrint
+#endif /* User mode */
+
+static void framesLog(tpAniSirGlobal pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{
+#ifdef WLAN_DEBUG
+    va_list val;
+    char buffer[1024];
+    (void)pCtx;
+    if ( nSev <= DOT11F_LOG_GATE )
+    {
+        va_start(val, lpszFormat);
+        _vsnprintf(buffer, 1024, lpszFormat, val);
+        va_end(val);
+        DBGPRINT(buffer);
+    }
+#endif
+}
+static void framesDump(tpAniSirGlobal pCtx, int nSev, tANI_U8 *pBuf, int nBuf)
+{
+#ifdef WLAN_DEBUG
+    char buffer[35];
+    int i, offset;
+    pCtx;
+    offset = 0;
+    if ( nSev > DOT11F_LOG_GATE ) return;
+    for (i = 0; i < nBuf/8; ++i)
+    {
+        _snprintf(buffer, 35, "%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7));
+        pBuf += 8; offset += 8;
+        DBGPRINT(buffer);
+    }
+    _snprintf(buffer, 35, "%08x: ", offset);
+    DBGPRINT(buffer);
+    for (i = 0; i < nBuf % 8; ++i)
+    {
+        _snprintf(buffer, 35, "%02x ", *pBuf);
+        ++pBuf;
+        DBGPRINT(buffer);
+    }
+    DBGPRINT("\n");
+#endif
+}
+
+#elif defined OS_X /* Not WIN32 */
+static void framesLog(tpAniSirGlobal pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{// To fill in when needed using IOLog
+
+}
+
+static void framesDump(tpAniSirGlobal pCtx, int nSev, tANI_U8 *pBuf, int nBuf)
+{
+}
+
+#elif defined LINUX
+
+static void framesLog(tpAniSirGlobal pCtx, int nSev,
+                      const char *lpszFormat, ...)
+{
+#ifdef WLAN_DEBUG
+    va_list marker;
+    (void)pCtx;
+    if ( nSev <= DOT11F_LOG_GATE )
+    {
+        va_start( marker, lpszFormat );
+        vprintf(lpszFormat, marker);
+        va_end( marker );
+    }
+#endif
+}
+
+static void framesDump(tpAniSirGlobal pCtx, int nSev, tANI_U8 *pBuf, int nBuf)
+{
+#ifdef WLAN_DEBUG
+    char buffer[35];
+    int i, offset;
+    (void)pCtx;
+    offset = 0;
+    if ( nSev > DOT11F_LOG_GATE ) return;
+    for (i = 0; i < nBuf/8; ++i)
+    {
+        printf("%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7));
+        pBuf += 8; offset += 8;
+    }
+    printf("%08x: ", offset);
+    for (i = 0; i < nBuf % 8; ++i)
+    {
+        printf("%02x ", *pBuf);
+        ++pBuf;
+    }
+    printf("\n");
+#endif
+}
+
+#endif /* WIN32 */
+
+#define FRAMES_LOG0(ctx, sev, fmt) \
+     framesLog((ctx), (sev), (fmt));
+#define FRAMES_LOG1(ctx, sev, fmt, p1) \
+     framesLog((ctx), (sev), (fmt), (p1));
+#define FRAMES_LOG2(ctx, sev, fmt, p1, p2) \
+     framesLog((ctx), (sev), (fmt), (p1), (p2));
+#define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3) \
+     framesLog((ctx), (sev), (fmt), (p1), (p2), (p3));
+#define FRAMES_DUMP(ctx, sev, p, n) \
+     framesDump((ctx), (sev), (p), (n));
+#ifndef FRAMES_SEV_FOR_FRAME
+#   define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3
+#endif
+
+#endif /* End DOT11F_HAVE_LOG_MACROS */
+
+#else  // ! DOT11F_ENABLE_LOGGING
+#   define FRAMES_LOG0(ctx, sev, fmt)
+#   define FRAMES_LOG1(ctx, sev, fmt, p1)
+#   define FRAMES_LOG2(ctx, sev, fmt, p1, p2)
+#   define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3)
+#   define FRAMES_DUMP(ctx, sev, p, n)
+#   ifndef FRAMES_SEV_FOR_FRAME
+#       define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3
+#   endif
+#endif // DOT11F_ENABLE_LOGGING
+
+#if defined( DOT11F_ENABLE_DBG_BREAK ) && defined ( WIN32 )
+#   define FRAMES_DBG_BREAK() { _asm int 3 }
+#else
+#   define FRAMES_DBG_BREAK()
+#endif
+
+#if ! defined(DOT11F_PARAMETER_CHECK)
+#   if defined (DOT11F_HAVE_WIN32_API)
+
+#       define DOT11F_PARAMETER_CHECK(pBuf, nBuf, pFrm, nFrm) \
+        if (!pBuf || IsBadReadPtr(pBuf, nBuf)) return DOT11F_BAD_INPUT_BUFFER; \
+        if (!pFrm || IsBadWritePtr(pFrm, nFrm)) return DOT11F_BAD_OUTPUT_BUFFER \
+
+#       define DOT11F_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) \
+        if (!pSrc || IsBadReadPtr(pSrc, 4)) return DOT11F_BAD_INPUT_BUFFER; \
+        if (!pBuf || IsBadWritePtr(pBuf, nBuf)) return DOT11F_BAD_OUTPUT_BUFFER; \
+        if (!nBuf) return DOT11F_BAD_OUTPUT_BUFFER; \
+        if (IsBadWritePtr(pnConsumed, 4)) return DOT11F_BAD_OUTPUT_BUFFER \
+
+#   else
+
+#       define DOT11F_PARAMETER_CHECK(pBuf, nBuf, pFrm, nFrm) \
+        if (!pBuf) return DOT11F_BAD_INPUT_BUFFER; \
+        if (!pFrm) return DOT11F_BAD_OUTPUT_BUFFER \
+
+#       define DOT11F_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) \
+        if (!pSrc) return DOT11F_BAD_INPUT_BUFFER; \
+        if (!pBuf) return DOT11F_BAD_OUTPUT_BUFFER; \
+        if (!nBuf) return DOT11F_BAD_OUTPUT_BUFFER; \
+        if (!pnConsumed) return DOT11F_BAD_OUTPUT_BUFFER \
+
+#   endif
+#endif
+
+static void framesntohs(tpAniSirGlobal    pCtx,
+                        tANI_U16 *pOut,
+                        tANI_U8  *pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        DOT11F_MEMCPY(pCtx, ( tANI_U16* )pOut, pIn, 2);
+    }
+    else
+    {
+        *pOut = ( tANI_U16 )( *pIn << 8 ) | *( pIn + 1 );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut = ( tANI_U16 )( *pIn | ( *( pIn + 1 ) << 8 ) );
+    }
+    else
+    {
+        DOT11F_MEMCPY(pCtx, ( tANI_U16* )pOut, pIn, 2);
+    }
+#   endif
+}
+
+static void framesntohl(tpAniSirGlobal    pCtx,
+                        tANI_U32 *pOut,
+                        tANI_U8  *pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        DOT11F_MEMCPY(pCtx, ( tANI_U32* )pOut, pIn, 4);
+    }
+    else
+    {
+        *pOut = ( tANI_U32 )( *pIn         << 24 ) |
+                ( *( pIn + 1 ) << 16 ) |
+                ( *( pIn + 2 ) <<  8 ) |
+                ( *( pIn + 3 ) );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut = ( tANI_U32 )( *( pIn + 3 ) << 24 ) |
+                                ( *( pIn + 2 ) << 16 ) |
+                                ( *( pIn + 1 ) <<  8 ) |
+                                ( *( pIn ) );
+    }
+    else
+    {
+        *pOut = * ( tANI_U32* )pIn;
+    }
+#   endif
+}
+
+static void framesntohq(tpAniSirGlobal    pCtx,
+                        tDOT11F_U64 *pOut,
+                        tANI_U8  *pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    framesntohl( pCtx, &((*pOut)[0]), pIn, fMsb);
+    framesntohl( pCtx, &((*pOut)[1]), pIn + 4, fMsb);
+#   else
+    framesntohl( pCtx, &((*pOut)[1]), pIn, fMsb);
+    framesntohl( pCtx, &((*pOut)[0]), pIn + 4, fMsb);
+#   endif
+}
+
+static void frameshtons(tpAniSirGlobal    pCtx
+,                        tANI_U8  *pOut,
+                        tANI_U16  pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
+    }
+    else
+    {
+        *pOut         = ( pIn & 0xff00 ) >> 8;
+        *( pOut + 1 ) = pIn & 0xff;
+    }
+#   else
+    if ( !fMsb )
+    {
+        *pOut         = pIn & 0xff;
+        *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
+    }
+    else
+    {
+        DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
+    }
+#   endif
+}
+
+static void frameshtonl(tpAniSirGlobal    pCtx,
+                        tANI_U8  *pOut,
+                        tANI_U32  pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+    (void)pCtx;
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    if ( !fMsb )
+    {
+        DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
+    }
+    else
+    {
+        *pOut         = ( pIn & 0xff000000 ) >> 24;
+        *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
+        *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >>  8;
+        *( pOut + 3 ) = ( pIn & 0x000000ff );
+    }
+#   else
+    if ( !fMsb )
+    {
+        *( pOut     ) = ( pIn & 0x000000ff );
+        *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >>  8;
+        *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
+        *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
+    }
+    else
+    {
+        DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
+    }
+#   endif
+}
+
+static void frameshtonq(tpAniSirGlobal    pCtx,
+                        tANI_U8  *pOut,
+                        tDOT11F_U64  pIn,
+                        tFRAMES_BOOL  fMsb)
+{
+#   if defined ( DOT11F_LITTLE_ENDIAN_HOST )
+    frameshtonl( pCtx, pOut, pIn[0], fMsb);
+    frameshtonl( pCtx, pOut + 4, pIn[1], fMsb);
+#   else
+    frameshtonl( pCtx, pOut + 4, pIn[1], fMsb);
+    frameshtonl( pCtx, pOut, pIn[0], fMsb);
+#   endif
+}
+static const tIEDefn* FindIEDefn(tpAniSirGlobal pCtx,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           const tIEDefn  IEs[])
+{
+    const tIEDefn *pIe;
+
+    (void)pCtx;
+
+    pIe = &(IEs[0]);
+    while (0xff != pIe->eid)
+    {
+        if (*pBuf == pIe->eid)
+        {
+            if (0 == pIe->noui) return pIe;
+
+            if ( ( nBuf > (tANI_U32)(pIe->noui + 2) ) &&
+                 ( !DOT11F_MEMCMP(pCtx, pBuf + 2, pIe->oui, pIe->noui) ) )
+                return pIe;
+        }
+
+        ++pIe;
+    }
+
+    return NULL;
+}
+
+static tANI_U32 GetContainerIesLen(tpAniSirGlobal pCtx,
+                             tANI_U8 *pBuf,
+                             tANI_U32  nBuf,
+                             tANI_U8 *pnConsumed,
+                             const tIEDefn  IEs[])
+{
+    const tIEDefn *pIe, *pIeFirst;
+    tANI_U8 *pBufRemaining = pBuf;
+    tANI_U8 len = 0;
+
+    (void)pCtx;
+
+    pIeFirst = &(IEs[0]);
+
+    if( *pBufRemaining != pIeFirst->eid )
+         return DOT11F_INTERNAL_ERROR;
+    len += *(pBufRemaining+1);
+    pBufRemaining += len + 2;
+    while ( len < nBuf )
+    {
+        if( NULL == (pIe =  FindIEDefn(pCtx, pBufRemaining, nBuf + len, IEs)))
+             break;
+        if( pIe->eid == pIeFirst->eid )
+             break;
+        len += *(pBufRemaining + 1) + 2;
+        pBufRemaining += *(pBufRemaining + 1) + 2;
+    }
+
+    *pnConsumed = len;
+    return DOT11F_PARSE_SUCCESS;
+   
+}
+
+
+
+static tANI_U32 UnpackCore(tpAniSirGlobal pCtx,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           const tFFDefn  FFs[],
+                           const tIEDefn  IEs[],
+                           tANI_U8 *pFrm,
+                           size_t   nFrm);
+static tANI_U32 PackCore(tpAniSirGlobal pCtx,
+                             tANI_U8 *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32  nBuf,
+                             tANI_U32 *pnConsumed,
+                             const tFFDefn  FFs[],
+                             const tIEDefn  IEs[]);
+static tANI_U32 GetPackedSizeCore(tpAniSirGlobal pCtx,
+                                      tANI_U8 *pFrm,
+                                      tANI_U32 *pnNeeded,
+                                      const tIEDefn  IEs[]);
+
+
+tANI_U32 dot11fUnpackTlvCommonFunc(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tANI_U8 *pDstPresent, tANI_U8 *pDstField)
+{
+   tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)tlvlen; /* Shutup the compiler */
+
+    *pDstPresent = 1;
+    *pDstField = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvCommonFunc. */
+
+tANI_U32 dot11fUnpackTlvCommonFunc2(tpAniSirGlobal  pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tANI_U8 *pDstPresent, tANI_U16 *pDstState)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)tlvlen; /* Shutup the compiler */
+
+    *pDstPresent = 1;
+    framesntohs(pCtx, pDstState, pBuf, 1);
+    (void)pCtx;
+    return status;
+
+} /* End dot11fUnpackTlvCommonFunc2. */
+                                           
+void dot11fUnpackFfCommonFunc(tpAniSirGlobal pCtx,
+                            tANI_U8 *pBuf, tANI_U16 *pDstField)
+{
+    framesntohs(pCtx, pDstField, pBuf, 0);
+    (void)pCtx;
+} /* End dot11fUnpackFfCommonFunc. */
+
+tANI_U32 dot11fUnpackIeCommonFunc(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen,
+                                         tANI_U8 *pDstPresent , tANI_U8 *pDstField)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)ielen;
+    (void)pBuf; 
+    if ((*pDstPresent)) status = DOT11F_DUPLICATE_IE;
+    *pDstPresent = 1;
+    *pDstField = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeComonFunc. */
+typedef struct sTLVDefn {
+    tANI_U32   offset;
+    tANI_U32   presenceOffset;
+    const char *   name;
+    tANI_U16   sig;
+    tANI_U32   id;
+    tANI_U32   pec;
+    tANI_U32   minSize;
+    tANI_U32   maxSize;
+    tANI_U8    fMandatory;
+    tANI_U8    sType;
+    tANI_U8    sLen;
+    tANI_U8    fMsb;
+} tTLVDefn;
+
+static const tTLVDefn* FindTLVDefn( tpAniSirGlobal    pCtx,
+                              tANI_U8  *pBuf,
+                              tANI_U32  nBuf,
+                              const tTLVDefn      TLVs[ ] )
+{
+    const tTLVDefn *pTlv;
+    tANI_U32   pec;
+    tANI_U16   id;
+
+    pTlv = &( TLVs[ 0 ] );
+    (void)pCtx;
+    if ( pTlv->sType == 2 )
+       framesntohs( pCtx, &id, pBuf, 1 );
+    else
+       id = *pBuf;
+
+    while ( 0xffff != pTlv->id )
+    {
+        if ( id == pTlv->id )
+        {
+            if ( 0 == pTlv->pec ) return pTlv;
+
+            if( nBuf > 5 )
+            {
+                pec =  ( ( * ( pBuf + 4 ) ) << 16 ) |
+                       ( ( * ( pBuf + 5 ) ) <<  8 ) |
+                           * ( pBuf + 6 );
+                if ( pec == pTlv->pec )
+                {
+                    return pTlv;
+                }
+            }
+        }
+
+        ++pTlv;
+    }
+
+    return NULL;
+}
+
+static tANI_U32 UnpackTlvCore( tpAniSirGlobal   pCtx,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            const tTLVDefn     TLVs[ ],
+                            tANI_U8 *pFrm,
+                            size_t       nFrm );
+static tANI_U32 PackTlvCore(tpAniSirGlobal pCtx,
+                                tANI_U8 *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32  nBuf,
+                                tANI_U32 *pnConsumed,
+                                const tTLVDefn  TLVs[],
+                                tANI_U32 *pidx);
+static tANI_U32 GetPackedSizeTlvCore(tpAniSirGlobal pCtx,
+                                         tANI_U8 *pFrm,
+                                         tANI_U32 *pnNeeded,
+                                         const tTLVDefn  TLVs[]);
+
+#define SigFfAID ( 0x0001 )
+
+void dot11fUnpackFfAction(tpAniSirGlobal pCtx,
+                          tANI_U8 *pBuf,
+                          tDot11fFfAction *pDst)
+{
+    pDst->action = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfAction. */
+
+#define SigFfAction ( 0x0002 )
+
+void dot11fUnpackFfAddBAParameterSet(tpAniSirGlobal pCtx,
+                                     tANI_U8 *pBuf,
+                                     tDot11fFfAddBAParameterSet *pDst)
+{
+    tANI_U16 tmp0__;
+    framesntohs(pCtx, &tmp0__, pBuf, 0);
+    pDst->amsduSupported = tmp0__ >> 0 & 0x1;
+    pDst->policy = tmp0__ >> 1 & 0x1;
+    pDst->tid = tmp0__ >> 2 & 0xf;
+    pDst->bufferSize = tmp0__ >> 6 & 0x3ff;
+    (void)pCtx;
+} /* End dot11fUnpackFfAddBAParameterSet. */
+
+#define SigFfAddBAParameterSet ( 0x0003 )
+
+#define SigFfAuthAlgo ( 0x0004 )
+
+#define SigFfAuthSeqNo ( 0x0005 )
+
+void dot11fUnpackFfBAStartingSequenceControl(tpAniSirGlobal pCtx,
+                                             tANI_U8 *pBuf,
+                                             tDot11fFfBAStartingSequenceControl *pDst)
+{
+    tANI_U16 tmp1__;
+    framesntohs(pCtx, &tmp1__, pBuf, 0);
+    pDst->fragNumber = tmp1__ >> 0 & 0xf;
+    pDst->ssn = tmp1__ >> 4 & 0xfff;
+    (void)pCtx;
+} /* End dot11fUnpackFfBAStartingSequenceControl. */
+
+#define SigFfBAStartingSequenceControl ( 0x0006 )
+
+#define SigFfBATimeout ( 0x0007 )
+
+#define SigFfBeaconInterval ( 0x0008 )
+
+void dot11fUnpackFfCapabilities(tpAniSirGlobal pCtx,
+                                tANI_U8 *pBuf,
+                                tDot11fFfCapabilities *pDst)
+{
+    tANI_U16 tmp2__;
+    framesntohs(pCtx, &tmp2__, pBuf, 0);
+    pDst->ess = tmp2__ >> 0 & 0x1;
+    pDst->ibss = tmp2__ >> 1 & 0x1;
+    pDst->cfPollable = tmp2__ >> 2 & 0x1;
+    pDst->cfPollReq = tmp2__ >> 3 & 0x1;
+    pDst->privacy = tmp2__ >> 4 & 0x1;
+    pDst->shortPreamble = tmp2__ >> 5 & 0x1;
+    pDst->pbcc = tmp2__ >> 6 & 0x1;
+    pDst->channelAgility = tmp2__ >> 7 & 0x1;
+    pDst->spectrumMgt = tmp2__ >> 8 & 0x1;
+    pDst->qos = tmp2__ >> 9 & 0x1;
+    pDst->shortSlotTime = tmp2__ >> 10 & 0x1;
+    pDst->apsd = tmp2__ >> 11 & 0x1;
+    pDst->rrm = tmp2__ >> 12 & 0x1;
+    pDst->dsssOfdm = tmp2__ >> 13 & 0x1;
+    pDst->delayedBA = tmp2__ >> 14 & 0x1;
+    pDst->immediateBA = tmp2__ >> 15 & 0x1;
+    (void)pCtx;
+} /* End dot11fUnpackFfCapabilities. */
+
+#define SigFfCapabilities ( 0x0009 )
+
+void dot11fUnpackFfCategory(tpAniSirGlobal pCtx,
+                            tANI_U8 *pBuf,
+                            tDot11fFfCategory *pDst)
+{
+    pDst->category = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfCategory. */
+
+#define SigFfCategory ( 0x000a )
+
+void dot11fUnpackFfCurrentAPAddress(tpAniSirGlobal pCtx,
+                                    tANI_U8 *pBuf,
+                                    tDot11fFfCurrentAPAddress *pDst)
+{
+    DOT11F_MEMCPY(pCtx, pDst->mac, pBuf, 6);
+    (void)pCtx;
+} /* End dot11fUnpackFfCurrentAPAddress. */
+
+#define SigFfCurrentAPAddress ( 0x000b )
+
+void dot11fUnpackFfDelBAParameterSet(tpAniSirGlobal pCtx,
+                                     tANI_U8 *pBuf,
+                                     tDot11fFfDelBAParameterSet *pDst)
+{
+    tANI_U16 tmp3__;
+    framesntohs(pCtx, &tmp3__, pBuf, 0);
+    pDst->reserved = tmp3__ >> 0 & 0x7ff;
+    pDst->initiator = tmp3__ >> 11 & 0x1;
+    pDst->tid = tmp3__ >> 12 & 0xf;
+    (void)pCtx;
+} /* End dot11fUnpackFfDelBAParameterSet. */
+
+#define SigFfDelBAParameterSet ( 0x000c )
+
+void dot11fUnpackFfDialogToken(tpAniSirGlobal pCtx,
+                               tANI_U8 *pBuf,
+                               tDot11fFfDialogToken *pDst)
+{
+    pDst->token = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfDialogToken. */
+
+#define SigFfDialogToken ( 0x000d )
+
+void dot11fUnpackFfLinkMargin(tpAniSirGlobal pCtx,
+                              tANI_U8 *pBuf,
+                              tDot11fFfLinkMargin *pDst)
+{
+    pDst->linkMargin = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfLinkMargin. */
+
+#define SigFfLinkMargin ( 0x000e )
+
+#define SigFfListenInterval ( 0x000f )
+
+void dot11fUnpackFfMaxTxPower(tpAniSirGlobal pCtx,
+                              tANI_U8 *pBuf,
+                              tDot11fFfMaxTxPower *pDst)
+{
+    pDst->maxTxPower = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfMaxTxPower. */
+
+#define SigFfMaxTxPower ( 0x0010 )
+
+void dot11fUnpackFfNumOfRepetitions(tpAniSirGlobal pCtx,
+                                    tANI_U8 *pBuf,
+                                    tDot11fFfNumOfRepetitions *pDst)
+{
+    framesntohs(pCtx, &pDst->repetitions, pBuf, 0);
+    (void)pCtx;
+} /* End dot11fUnpackFfNumOfRepetitions. */
+
+#define SigFfNumOfRepetitions ( 0x0011 )
+
+void dot11fUnpackFfP2POUI(tpAniSirGlobal pCtx,
+                          tANI_U8 *pBuf,
+                          tDot11fFfP2POUI *pDst)
+{
+    framesntohl(pCtx, &pDst->oui, pBuf, 0);
+    (void)pCtx;
+} /* End dot11fUnpackFfP2POUI. */
+
+#define SigFfP2POUI ( 0x0012 )
+
+void dot11fUnpackFfP2POUISubType(tpAniSirGlobal pCtx,
+                                 tANI_U8 *pBuf,
+                                 tDot11fFfP2POUISubType *pDst)
+{
+    pDst->ouiSubtype = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfP2POUISubType. */
+
+#define SigFfP2POUISubType ( 0x0013 )
+
+void dot11fUnpackFfRCPI(tpAniSirGlobal pCtx,
+                        tANI_U8 *pBuf,
+                        tDot11fFfRCPI *pDst)
+{
+    pDst->rcpi = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfRCPI. */
+
+#define SigFfRCPI ( 0x0014 )
+
+void dot11fUnpackFfRSNI(tpAniSirGlobal pCtx,
+                        tANI_U8 *pBuf,
+                        tDot11fFfRSNI *pDst)
+{
+    pDst->rsni = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfRSNI. */
+
+#define SigFfRSNI ( 0x0015 )
+
+#define SigFfReason ( 0x0016 )
+
+void dot11fUnpackFfRxAntennaId(tpAniSirGlobal pCtx,
+                               tANI_U8 *pBuf,
+                               tDot11fFfRxAntennaId *pDst)
+{
+    pDst->antennaId = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfRxAntennaId. */
+
+#define SigFfRxAntennaId ( 0x0017 )
+
+void dot11fUnpackFfSMPowerModeSet(tpAniSirGlobal pCtx,
+                                  tANI_U8 *pBuf,
+                                  tDot11fFfSMPowerModeSet *pDst)
+{
+    tANI_U8 tmp4__;
+    tmp4__ = *pBuf;
+    pDst->PowerSave_En = tmp4__ >> 0 & 0x1;
+    pDst->Mode = tmp4__ >> 1 & 0x1;
+    pDst->reserved = tmp4__ >> 2 & 0x3f;
+    (void)pCtx;
+} /* End dot11fUnpackFfSMPowerModeSet. */
+
+#define SigFfSMPowerModeSet ( 0x0018 )
+
+#define SigFfStatus ( 0x0019 )
+
+void dot11fUnpackFfStatusCode(tpAniSirGlobal pCtx,
+                              tANI_U8 *pBuf,
+                              tDot11fFfStatusCode *pDst)
+{
+    pDst->statusCode = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfStatusCode. */
+
+#define SigFfStatusCode ( 0x001a )
+
+void dot11fUnpackFfTPCEleID(tpAniSirGlobal pCtx,
+                            tANI_U8 *pBuf,
+                            tDot11fFfTPCEleID *pDst)
+{
+    pDst->TPCId = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfTPCEleID. */
+
+#define SigFfTPCEleID ( 0x001b )
+
+void dot11fUnpackFfTPCEleLen(tpAniSirGlobal pCtx,
+                             tANI_U8 *pBuf,
+                             tDot11fFfTPCEleLen *pDst)
+{
+    pDst->TPCLen = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfTPCEleLen. */
+
+#define SigFfTPCEleLen ( 0x001c )
+
+void dot11fUnpackFfTSInfo(tpAniSirGlobal pCtx,
+                          tANI_U8 *pBuf,
+                          tDot11fFfTSInfo *pDst)
+{
+    tANI_U32 tmp5__;
+    framesntohl(pCtx, &tmp5__, pBuf, 0);
+    pDst->traffic_type = tmp5__ >> 0 & 0x1;
+    pDst->tsid = tmp5__ >> 1 & 0xf;
+    pDst->direction = tmp5__ >> 5 & 0x3;
+    pDst->access_policy = tmp5__ >> 7 & 0x3;
+    pDst->aggregation = tmp5__ >> 9 & 0x1;
+    pDst->psb = tmp5__ >> 10 & 0x1;
+    pDst->user_priority = tmp5__ >> 11 & 0x7;
+    pDst->tsinfo_ack_pol = tmp5__ >> 14 & 0x3;
+    pDst->schedule = tmp5__ >> 16 & 0x1;
+    pDst->unused = tmp5__ >> 17 & 0x7fff;
+    (void)pCtx;
+} /* End dot11fUnpackFfTSInfo. */
+
+#define SigFfTSInfo ( 0x001d )
+
+void dot11fUnpackFfTimeStamp(tpAniSirGlobal pCtx,
+                             tANI_U8 *pBuf,
+                             tDot11fFfTimeStamp *pDst)
+{
+    framesntohq(pCtx, &pDst->timestamp, pBuf, 0);
+    (void)pCtx;
+} /* End dot11fUnpackFfTimeStamp. */
+
+#define SigFfTimeStamp ( 0x001e )
+
+void dot11fUnpackFfTxAntennaId(tpAniSirGlobal pCtx,
+                               tANI_U8 *pBuf,
+                               tDot11fFfTxAntennaId *pDst)
+{
+    pDst->antennaId = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfTxAntennaId. */
+
+#define SigFfTxAntennaId ( 0x001f )
+
+void dot11fUnpackFfTxPower(tpAniSirGlobal pCtx,
+                           tANI_U8 *pBuf,
+                           tDot11fFfTxPower *pDst)
+{
+    pDst->txPower = *pBuf;
+    (void)pCtx;
+} /* End dot11fUnpackFfTxPower. */
+
+#define SigFfTxPower ( 0x0020 )
+
+tANI_U32 dot11fUnpackTlvAuthorizedMACs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVAuthorizedMACs *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->mac, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvAuthorizedMACs. */
+
+#define SigTlvAuthorizedMACs ( 0x0001 )
+
+
+#define SigTlvRequestToEnroll ( 0x0002 )
+
+
+tANI_U32 dot11fUnpackTlvVersion2(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVVersion2 *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp6__;
+    pDst->present = 1;
+    tmp6__ = *pBuf;
+    pBuf += 1;
+    tlvlen -= 1;
+    pDst->minor = tmp6__ >> 0 & 0xf;
+    pDst->major = tmp6__ >> 4 & 0xf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvVersion2. */
+
+#define SigTlvVersion2 ( 0x0003 )
+
+
+#define SigTlvAPSetupLocked ( 0x0004 )
+
+
+#define SigTlvAssociationState ( 0x0005 )
+
+
+tANI_U32 dot11fUnpackTlvChannelList(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVChannelList *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->countryString, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (tANI_U8)3;
+    pDst->num_channelList = (tANI_U8)( tlvlen );
+    if (tlvlen > 251){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->channelList, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvChannelList. */
+
+#define SigTlvChannelList ( 0x0006 )
+
+
+#define SigTlvConfigMethods ( 0x0007 )
+
+
+#define SigTlvConfigurationError ( 0x0008 )
+
+
+tANI_U32 dot11fUnpackTlvConfigurationTimeout(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVConfigurationTimeout *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->GOConfigTimeout = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->CLConfigTimeout = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvConfigurationTimeout. */
+
+#define SigTlvConfigurationTimeout ( 0x0009 )
+
+
+tANI_U32 dot11fUnpackTlvDeviceName(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVDeviceName *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_text = (tANI_U8)( tlvlen );
+    if (tlvlen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->text, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvDeviceName. */
+
+#define SigTlvDeviceName ( 0x000a )
+
+
+#define SigTlvDevicePasswordID ( 0x000b )
+
+
+tANI_U32 dot11fUnpackTlvExtendedListenTiming(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVExtendedListenTiming *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->availibilityPeriod, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->availibilityInterval, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvExtendedListenTiming. */
+
+#define SigTlvExtendedListenTiming ( 0x000c )
+
+
+#define SigTlvGOIntent ( 0x000d )
+
+
+tANI_U32 dot11fUnpackTlvIntendedP2PInterfaceAddress(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVIntendedP2PInterfaceAddress *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->P2PInterfaceAddress, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvIntendedP2PInterfaceAddress. */
+
+#define SigTlvIntendedP2PInterfaceAddress ( 0x000e )
+
+
+#define SigTlvInvitationFlags ( 0x000f )
+
+
+tANI_U32 dot11fUnpackTlvListenChannel(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVListenChannel *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->countryString, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (tANI_U8)3;
+    pDst->regulatoryClass = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->channel = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvListenChannel. */
+
+#define SigTlvListenChannel ( 0x0010 )
+
+
+tANI_U32 dot11fUnpackTlvManufacturer(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVManufacturer *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_name = (tANI_U8)( tlvlen );
+    if (tlvlen > 64){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->name, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvManufacturer. */
+
+#define SigTlvManufacturer ( 0x0011 )
+
+
+#define SigTlvMinorReasonCode ( 0x0012 )
+
+
+tANI_U32 dot11fUnpackTlvModelName(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVModelName *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_text = (tANI_U8)( tlvlen );
+    if (tlvlen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->text, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvModelName. */
+
+#define SigTlvModelName ( 0x0013 )
+
+
+tANI_U32 dot11fUnpackTlvModelNumber(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVModelNumber *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_text = (tANI_U8)( tlvlen );
+    if (tlvlen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->text, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvModelNumber. */
+
+#define SigTlvModelNumber ( 0x0014 )
+
+
+tANI_U32 dot11fUnpackTlvNoticeOfAbsence(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVNoticeOfAbsence *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->index = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->CTSWindowOppPS = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->num_NoADesc = (tANI_U8)( tlvlen );
+    if (tlvlen > 36){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->NoADesc, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvNoticeOfAbsence. */
+
+#define SigTlvNoticeOfAbsence ( 0x0015 )
+
+
+tANI_U32 dot11fUnpackTlvOperatingChannel(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVOperatingChannel *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->countryString, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (tANI_U8)3;
+    pDst->regulatoryClass = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->channel = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvOperatingChannel. */
+
+#define SigTlvOperatingChannel ( 0x0016 )
+
+
+tANI_U32 dot11fUnpackTlvP2PCapability(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PCapability *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->deviceCapability = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    pDst->groupCapability = *pBuf;
+    pBuf += 1;
+    tlvlen -= (tANI_U8)1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PCapability. */
+
+#define SigTlvP2PCapability ( 0x0017 )
+
+
+tANI_U32 dot11fUnpackTlvP2PDeviceId(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PDeviceId *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->P2PDeviceAddress, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PDeviceId. */
+
+#define SigTlvP2PDeviceId ( 0x0018 )
+
+
+    static const tTLVDefn TLVS_P2PDeviceInfo[] = {
+        {offsetof(tDot11fTLVP2PDeviceInfo, DeviceName), offsetof(tDot11fTLVDeviceName, present), "DeviceName", SigTlvDeviceName, DOT11F_TLV_DEVICENAME, 0, 4, 36, 1, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackTlvP2PDeviceInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PDeviceInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->P2PDeviceAddress, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    framesntohs(pCtx, &pDst->configMethod, pBuf, 0);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    DOT11F_MEMCPY(pCtx, pDst->primaryDeviceType, pBuf, 8);
+    pBuf += 8;
+    tlvlen -= (tANI_U8)8;
+    (void)pCtx;
+    status |= UnpackTlvCore(pCtx,
+                        pBuf,
+                        tlvlen,
+                        TLVS_P2PDeviceInfo,
+                        ( tANI_U8* )pDst,
+                        sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackTlvP2PDeviceInfo. */
+
+#define SigTlvP2PDeviceInfo ( 0x0019 )
+
+
+tANI_U32 dot11fUnpackTlvP2PGroupBssid(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PGroupBssid *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->P2PGroupBssid, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PGroupBssid. */
+
+#define SigTlvP2PGroupBssid ( 0x001a )
+
+
+tANI_U32 dot11fUnpackTlvP2PGroupId(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PGroupId *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->deviceAddress, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    pDst->num_ssid = (tANI_U8)( tlvlen );
+    if (tlvlen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->ssid, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PGroupId. */
+
+#define SigTlvP2PGroupId ( 0x001b )
+
+
+tANI_U32 dot11fUnpackTlvP2PGroupInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PGroupInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_P2PClientInfoDesc = (tANI_U8)( tlvlen );
+    DOT11F_MEMCPY(pCtx, pDst->P2PClientInfoDesc, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PGroupInfo. */
+
+#define SigTlvP2PGroupInfo ( 0x001c )
+
+
+#define SigTlvP2PStatus ( 0x001d )
+
+
+tANI_U32 dot11fUnpackTlvPrimaryDeviceType(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVPrimaryDeviceType *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)tlvlen; /* Shutup the compiler */
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->primary_category, pBuf, 1);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    DOT11F_MEMCPY(pCtx, pDst->oui, pBuf, 4);
+    pBuf += 4;
+    tlvlen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->sub_category, pBuf, 1);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvPrimaryDeviceType. */
+
+#define SigTlvPrimaryDeviceType ( 0x001e )
+
+
+#define SigTlvRFBands ( 0x001f )
+
+
+tANI_U32 dot11fUnpackTlvRequestDeviceType(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVRequestDeviceType *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->primary_category, pBuf, 1);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    DOT11F_MEMCPY(pCtx, pDst->oui, pBuf, 4);
+    pBuf += 4;
+    tlvlen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->sub_category, pBuf, 1);
+    pBuf += 2;
+    tlvlen -= (tANI_U8)2;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvRequestDeviceType. */
+
+#define SigTlvRequestDeviceType ( 0x0020 )
+
+
+#define SigTlvRequestType ( 0x0021 )
+
+
+#define SigTlvResponseType ( 0x0022 )
+
+
+#define SigTlvSelectedRegistrar ( 0x0023 )
+
+
+#define SigTlvSelectedRegistrarConfigMethods ( 0x0024 )
+
+
+tANI_U32 dot11fUnpackTlvSerialNumber(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVSerialNumber *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    pDst->num_text = (tANI_U8)( tlvlen );
+    if (tlvlen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->text, pBuf, ( tlvlen ) );
+    pBuf += ( tlvlen );
+    tlvlen -= ( tlvlen );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvSerialNumber. */
+
+#define SigTlvSerialNumber ( 0x0025 )
+
+
+tANI_U32 dot11fUnpackTlvUUID_E(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVUUID_E *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->uuid, pBuf, 16);
+    pBuf += 16;
+    tlvlen -= (tANI_U8)16;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvUUID_E. */
+
+#define SigTlvUUID_E ( 0x0026 )
+
+
+tANI_U32 dot11fUnpackTlvUUID_R(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVUUID_R *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->uuid, pBuf, 16);
+    pBuf += 16;
+    tlvlen -= (tANI_U8)16;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvUUID_R. */
+
+#define SigTlvUUID_R ( 0x0027 )
+
+
+    static const tTLVDefn TLVS_VendorExtension[] = {
+        {offsetof(tDot11fTLVVendorExtension, Version2), offsetof(tDot11fTLVVersion2, present), "Version2", SigTlvVersion2, DOT11F_TLV_VERSION2, 0, 3, 3, 0, 1, 1, 1, },
+        {offsetof(tDot11fTLVVendorExtension, AuthorizedMACs), offsetof(tDot11fTLVAuthorizedMACs, present), "AuthorizedMACs", SigTlvAuthorizedMACs, DOT11F_TLV_AUTHORIZEDMACS, 0, 8, 8, 0, 1, 1, 1, },
+        {offsetof(tDot11fTLVVendorExtension, RequestToEnroll), offsetof(tDot11fTLVRequestToEnroll, present), "RequestToEnroll", SigTlvRequestToEnroll, DOT11F_TLV_REQUESTTOENROLL, 0, 3, 3, 0, 1, 1, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackTlvVendorExtension(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVVendorExtension *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->vendorId, pBuf, 3);
+    pBuf += 3;
+    tlvlen -= (tANI_U8)3;
+    (void)pCtx;
+    status |= UnpackTlvCore(pCtx,
+                        pBuf,
+                        tlvlen,
+                        TLVS_VendorExtension,
+                        ( tANI_U8* )pDst,
+                        sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackTlvVendorExtension. */
+
+#define SigTlvVendorExtension ( 0x0028 )
+
+
+tANI_U32 dot11fUnpackTlvVersion(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVVersion *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp7__;
+    pDst->present = 1;
+    tmp7__ = *pBuf;
+    pBuf += 1;
+    tlvlen -= 1;
+    pDst->minor = tmp7__ >> 0 & 0xf;
+    pDst->major = tmp7__ >> 4 & 0xf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvVersion. */
+
+#define SigTlvVersion ( 0x0029 )
+
+
+#define SigTlvWPSState ( 0x002a )
+
+
+tANI_U32 dot11fUnpackTlvP2PInterface(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVP2PInterface *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->P2PDeviceAddress, pBuf, 6);
+    pBuf += 6;
+    tlvlen -= (tANI_U8)6;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackTlvP2PInterface. */
+
+#define SigTlvP2PInterface ( 0x002b )
+
+
+#define SigTlvP2PManageability ( 0x002c )
+
+
+tANI_U32 dot11fUnpackIeAPName(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEAPName *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_name = (tANI_U8)( ielen );
+    if (ielen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->name, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeAPName. */
+
+#define SigIeAPName ( 0x0001 )
+
+
+tANI_U32 dot11fUnpackIeBPIndicator(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEBPIndicator *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->indicator = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->type = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeBPIndicator. */
+
+#define SigIeBPIndicator ( 0x0002 )
+
+
+tANI_U32 dot11fUnpackIeCondensedCountryStr(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECondensedCountryStr *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->countryStr, pBuf, 2);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCondensedCountryStr. */
+
+#define SigIeCondensedCountryStr ( 0x0003 )
+
+
+tANI_U32 dot11fUnpackIeGTK(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEGTK *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp8__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &tmp8__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->keyId = tmp8__ >> 0 & 0x3;
+    pDst->reserved = tmp8__ >> 2 & 0x3feb;
+    pDst->keyLength = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    DOT11F_MEMCPY(pCtx, pDst->RSC, pBuf, 8);
+    pBuf += 8;
+    ielen -= (tANI_U8)8;
+    pDst->num_key = (tANI_U8)( ielen );
+    if (ielen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->key, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeGTK. */
+
+#define SigIeGTK ( 0x0004 )
+
+
+#define SigIeHCF ( 0x0005 )
+
+
+tANI_U32 dot11fUnpackIeLLAttr(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIELLAttr *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohl(pCtx, &pDst->defer_threshold, pBuf, 1);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeLLAttr. */
+
+#define SigIeLLAttr ( 0x0006 )
+
+
+tANI_U32 dot11fUnpackIeLoadBalance(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIELoadBalance *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->bssid, pBuf, 6);
+    pBuf += 6;
+    ielen -= (tANI_U8)6;
+    pDst->channel = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeLoadBalance. */
+
+#define SigIeLoadBalance ( 0x0007 )
+
+
+tANI_U32 dot11fUnpackIeLoadInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIELoadInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->num_stas, pBuf, 1);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->channel_util, pBuf, 1);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeLoadInfo. */
+
+#define SigIeLoadInfo ( 0x0008 )
+
+
+#define SigIePropAssocType ( 0x0009 )
+
+
+tANI_U32 dot11fUnpackIePropCapability(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPropCapability *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->capability, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePropCapability. */
+
+#define SigIePropCapability ( 0x000a )
+
+
+tANI_U32 dot11fUnpackIePropChannSwitchAnn(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPropChannSwitchAnn *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->mode = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->primary_channel = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->sub_band = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->channel_switch_count = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePropChannSwitchAnn. */
+
+#define SigIePropChannSwitchAnn ( 0x000b )
+
+
+tANI_U32 dot11fUnpackIePropEDCAParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPropEDCAParams *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp9__;
+    tANI_U8 tmp10__;
+    tANI_U8 tmp11__;
+    tANI_U8 tmp12__;
+    tANI_U8 tmp13__;
+    tANI_U8 tmp14__;
+    tANI_U8 tmp15__;
+    tANI_U8 tmp16__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->qos = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->reserved = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp9__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_aifsn = tmp9__ >> 0 & 0xf;
+    pDst->acbe_acm = tmp9__ >> 4 & 0x1;
+    pDst->acbe_aci = tmp9__ >> 5 & 0x3;
+    pDst->unused1 = tmp9__ >> 7 & 0x1;
+    tmp10__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_min = tmp10__ >> 0 & 0xf;
+    pDst->acbe_max = tmp10__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbe_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp11__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_aifsn = tmp11__ >> 0 & 0xf;
+    pDst->acbk_acm = tmp11__ >> 4 & 0x1;
+    pDst->acbk_aci = tmp11__ >> 5 & 0x3;
+    pDst->unused2 = tmp11__ >> 7 & 0x1;
+    tmp12__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_min = tmp12__ >> 0 & 0xf;
+    pDst->acbk_max = tmp12__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbk_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp13__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_aifsn = tmp13__ >> 0 & 0xf;
+    pDst->acvi_acm = tmp13__ >> 4 & 0x1;
+    pDst->acvi_aci = tmp13__ >> 5 & 0x3;
+    pDst->unused3 = tmp13__ >> 7 & 0x1;
+    tmp14__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_min = tmp14__ >> 0 & 0xf;
+    pDst->acvi_max = tmp14__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvi_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp15__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_aifsn = tmp15__ >> 0 & 0xf;
+    pDst->acvo_acm = tmp15__ >> 4 & 0x1;
+    pDst->acvo_aci = tmp15__ >> 5 & 0x3;
+    pDst->unused4 = tmp15__ >> 7 & 0x1;
+    tmp16__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_min = tmp16__ >> 0 & 0xf;
+    pDst->acvo_max = tmp16__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvo_txoplimit, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePropEDCAParams. */
+
+#define SigIePropEDCAParams ( 0x000c )
+
+
+tANI_U32 dot11fUnpackIePropQuietBSS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPropQuietBSS *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->quiet_count = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->quiet_period = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->quiet_duration, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->quiet_offset, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePropQuietBSS. */
+
+#define SigIePropQuietBSS ( 0x000d )
+
+
+tANI_U32 dot11fUnpackIePropSuppRates(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPropSuppRates *pDst)
+{
+    tANI_U8 i;
+    tANI_U8 rate_indx = 0;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    for (i = 0; i < ielen; i++) {
+        if ((DOT11F_IS_BG_RATE(pBuf[i] & 0x7F)) && 
+            (rate_indx < 12)) {
+            pDst->rates[rate_indx++] = pBuf[i];
+        }
+    }
+
+    if(rate_indx == 0) {
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    pDst->num_rates = rate_indx;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePropSuppRates. */
+
+#define SigIePropSuppRates ( 0x000e )
+
+
+tANI_U32 dot11fUnpackIeR0KH_ID(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIER0KH_ID *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_PMK_R0_ID = (tANI_U8)( ielen );
+    if (ielen > 48){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->PMK_R0_ID, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeR0KH_ID. */
+
+#define SigIeR0KH_ID ( 0x000f )
+
+
+tANI_U32 dot11fUnpackIeR1KH_ID(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIER1KH_ID *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->PMK_R1_ID, pBuf, 6);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeR1KH_ID. */
+
+#define SigIeR1KH_ID ( 0x0010 )
+
+
+tANI_U32 dot11fUnpackIeTSFInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETSFInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->TsfOffset, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->BeaconIntvl, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTSFInfo. */
+
+#define SigIeTSFInfo ( 0x0011 )
+
+
+tANI_U32 dot11fUnpackIeTaurus(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETaurus *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp17__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->baTIDBitmap, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->baPolicy, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &tmp17__, pBuf, 0);
+    pDst->baBufferSize = tmp17__ >> 0 & 0xfff;
+    pDst->rsvd = tmp17__ >> 12 & 0xf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTaurus. */
+
+#define SigIeTaurus ( 0x0012 )
+
+
+tANI_U32 dot11fUnpackIeTitan(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETitan *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->concat_tcid_bitmap = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->compression_tcid_bitmap = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->cb_state = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->rev_fcs_state = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTitan. */
+
+#define SigIeTitan ( 0x0013 )
+
+
+#define SigIeTriggerStaBgScan ( 0x0014 )
+
+
+tANI_U32 dot11fUnpackIeVersion(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEVersion *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohl(pCtx, &pDst->chip_rev, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    pDst->card_type = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_build_version = (tANI_U8)( ielen );
+    if (ielen > 20){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->build_version, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeVersion. */
+
+#define SigIeVersion ( 0x0015 )
+
+
+tANI_U32 dot11fUnpackIeWDS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWDS *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_wdsData = (tANI_U8)( ielen );
+    if (ielen > 64){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->wdsData, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWDS. */
+
+#define SigIeWDS ( 0x0016 )
+
+
+tANI_U32 dot11fUnpackIeAPChannelReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEAPChannelReport *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->regulatoryClass = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_channelList = (tANI_U8)( ielen );
+    if (ielen > 50){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->channelList, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeAPChannelReport. */
+
+#define SigIeAPChannelReport ( 0x0017 )
+
+
+tANI_U32 dot11fUnpackIeBcnReportingDetail(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEBcnReportingDetail *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->reportingDetail = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeBcnReportingDetail. */
+
+#define SigIeBcnReportingDetail ( 0x0018 )
+
+
+tANI_U32 dot11fUnpackIeBeaconReportFrmBody(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEBeaconReportFrmBody *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_reportedFields = (tANI_U8)( ielen );
+    if (ielen > 224){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->reportedFields, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeBeaconReportFrmBody. */
+
+#define SigIeBeaconReportFrmBody ( 0x0019 )
+
+
+tANI_U32 dot11fUnpackIeBeaconReporting(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEBeaconReporting *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->reportingCondition = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->threshold = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeBeaconReporting. */
+
+#define SigIeBeaconReporting ( 0x001a )
+
+
+tANI_U32 dot11fUnpackIeMeasurementPilot(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEMeasurementPilot *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->measurementPilot = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_vendorSpecific = (tANI_U8)( ielen );
+    DOT11F_MEMCPY(pCtx, pDst->vendorSpecific, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeMeasurementPilot. */
+
+#define SigIeMeasurementPilot ( 0x001b )
+
+
+tANI_U32 dot11fUnpackIeMultiBssid(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEMultiBssid *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->maxBSSIDIndicator = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_vendorSpecific = (tANI_U8)( ielen );
+    DOT11F_MEMCPY(pCtx, pDst->vendorSpecific, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeMultiBssid. */
+
+#define SigIeMultiBssid ( 0x001c )
+
+
+tANI_U32 dot11fUnpackIeRICData(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERICData *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->Identifier = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->resourceDescCount = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->statusCode, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRICData. */
+
+#define SigIeRICData ( 0x001d )
+
+
+tANI_U32 dot11fUnpackIeRICDescriptor(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERICDescriptor *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->resourceType = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_variableData = (tANI_U8)( ielen );
+    DOT11F_MEMCPY(pCtx, pDst->variableData, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRICDescriptor. */
+
+#define SigIeRICDescriptor ( 0x001e )
+
+
+tANI_U32 dot11fUnpackIeRRMEnabledCap(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERRMEnabledCap *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp18__;
+    tANI_U8 tmp19__;
+    tANI_U8 tmp20__;
+    tANI_U8 tmp21__;
+    tANI_U8 tmp22__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    tmp18__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->LinkMeasurement = tmp18__ >> 0 & 0x1;
+    pDst->NeighborRpt = tmp18__ >> 1 & 0x1;
+    pDst->parallel = tmp18__ >> 2 & 0x1;
+    pDst->repeated = tmp18__ >> 3 & 0x1;
+    pDst->BeaconPassive = tmp18__ >> 4 & 0x1;
+    pDst->BeaconActive = tmp18__ >> 5 & 0x1;
+    pDst->BeaconTable = tmp18__ >> 6 & 0x1;
+    pDst->BeaconRepCond = tmp18__ >> 7 & 0x1;
+    tmp19__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->FrameMeasurement = tmp19__ >> 0 & 0x1;
+    pDst->ChannelLoad = tmp19__ >> 1 & 0x1;
+    pDst->NoiseHistogram = tmp19__ >> 2 & 0x1;
+    pDst->statistics = tmp19__ >> 3 & 0x1;
+    pDst->LCIMeasurement = tmp19__ >> 4 & 0x1;
+    pDst->LCIAzimuth = tmp19__ >> 5 & 0x1;
+    pDst->TCMCapability = tmp19__ >> 6 & 0x1;
+    pDst->triggeredTCM = tmp19__ >> 7 & 0x1;
+    tmp20__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->APChanReport = tmp20__ >> 0 & 0x1;
+    pDst->RRMMIBEnabled = tmp20__ >> 1 & 0x1;
+    pDst->operatingChanMax = tmp20__ >> 2 & 0x7;
+    pDst->nonOperatinChanMax = tmp20__ >> 5 & 0x7;
+    tmp21__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->MeasurementPilot = tmp21__ >> 0 & 0x7;
+    pDst->MeasurementPilotEnabled = tmp21__ >> 3 & 0x1;
+    pDst->NeighborTSFOffset = tmp21__ >> 4 & 0x1;
+    pDst->RCPIMeasurement = tmp21__ >> 5 & 0x1;
+    pDst->RSNIMeasurement = tmp21__ >> 6 & 0x1;
+    pDst->BssAvgAccessDelay = tmp21__ >> 7 & 0x1;
+    tmp22__ = *pBuf;
+    pDst->BSSAvailAdmission = tmp22__ >> 0 & 0x1;
+    pDst->AntennaInformation = tmp22__ >> 1 & 0x1;
+    pDst->reserved = tmp22__ >> 2 & 0x3f;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRRMEnabledCap. */
+
+#define SigIeRRMEnabledCap ( 0x001f )
+
+
+tANI_U32 dot11fUnpackIeRequestedInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERequestedInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_requested_eids = (tANI_U8)( ielen );
+    DOT11F_MEMCPY(pCtx, pDst->requested_eids, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRequestedInfo. */
+
+#define SigIeRequestedInfo ( 0x0020 )
+
+
+tANI_U32 dot11fUnpackIeSSID(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIESSID *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present)
+    {
+        status = DOT11F_DUPLICATE_IE;
+        return status;
+    }
+    pDst->present = 1;
+    pDst->num_ssid = (tANI_U8)( ielen );
+    if (ielen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->ssid, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeSSID. */
+
+#define SigIeSSID ( 0x0021 )
+
+
+tANI_U32 dot11fUnpackIeSchedule(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIESchedule *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp23__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &tmp23__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->aggregation = tmp23__ >> 0 & 0x1;
+    pDst->tsid = tmp23__ >> 1 & 0xf;
+    pDst->direction = tmp23__ >> 5 & 0x3;
+    pDst->reserved = tmp23__ >> 7 & 0x1ff;
+    framesntohl(pCtx, &pDst->service_start_time, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->service_interval, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->max_service_dur, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->spec_interval, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeSchedule. */
+
+#define SigIeSchedule ( 0x0022 )
+
+
+tANI_U32 dot11fUnpackIeTCLAS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETCLAS *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->user_priority = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->classifier_type = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->classifier_mask = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    switch (pDst->classifier_type)
+    {
+        case 0:
+            DOT11F_MEMCPY(pCtx, pDst->info.EthParams.source, pBuf, 6);
+            pBuf += 6;
+            ielen -= (tANI_U8)6;
+            DOT11F_MEMCPY(pCtx, pDst->info.EthParams.dest, pBuf, 6);
+            pBuf += 6;
+            ielen -= (tANI_U8)6;
+            framesntohs(pCtx, &pDst->info.EthParams.type, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+        case 1:
+            pDst->info.IpParams.version = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            switch (pDst->info.IpParams.version)
+            {
+                case 4:
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV4Params.source, pBuf, 4);
+                    pBuf += 4;
+                    ielen -= (tANI_U8)4;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV4Params.dest, pBuf, 4);
+                    pBuf += 4;
+                    ielen -= (tANI_U8)4;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV4Params.src_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV4Params.dest_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    pDst->info.IpParams.params.IpV4Params.DSCP = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                    pDst->info.IpParams.params.IpV4Params.proto = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                    pDst->info.IpParams.params.IpV4Params.reserved = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                break;
+                case 6:
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.source, pBuf, 16);
+                    pBuf += 16;
+                    ielen -= (tANI_U8)16;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.dest, pBuf, 16);
+                    pBuf += 16;
+                    ielen -= (tANI_U8)16;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV6Params.src_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV6Params.dest_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.flow_label, pBuf, 3);
+                    pBuf += 3;
+                    ielen -= (tANI_U8)3;
+                break;
+            }
+        break;
+        case 2:
+            framesntohs(pCtx, &pDst->info.Params8021dq.tag_type, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTCLAS. */
+
+#define SigIeTCLAS ( 0x0023 )
+
+
+#define SigIeTCLASSPROC ( 0x0024 )
+
+
+tANI_U32 dot11fUnpackIeTSDelay(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETSDelay *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohl(pCtx, &pDst->delay, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTSDelay. */
+
+#define SigIeTSDelay ( 0x0025 )
+
+
+tANI_U32 dot11fUnpackIeTSPEC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETSPEC *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp24__;
+    tANI_U8 tmp25__;
+    tANI_U16 tmp26__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &tmp24__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->traffic_type = tmp24__ >> 0 & 0x1;
+    pDst->tsid = tmp24__ >> 1 & 0xf;
+    pDst->direction = tmp24__ >> 5 & 0x3;
+    pDst->access_policy = tmp24__ >> 7 & 0x3;
+    pDst->aggregation = tmp24__ >> 9 & 0x1;
+    pDst->psb = tmp24__ >> 10 & 0x1;
+    pDst->user_priority = tmp24__ >> 11 & 0x7;
+    pDst->tsinfo_ack_pol = tmp24__ >> 14 & 0x3;
+    tmp25__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->schedule = tmp25__ >> 0 & 0x1;
+    pDst->unused = tmp25__ >> 1 & 0x7f;
+    framesntohs(pCtx, &tmp26__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->size = tmp26__ >> 0 & 0x7fff;
+    pDst->fixed = tmp26__ >> 15 & 0x1;
+    framesntohs(pCtx, &pDst->max_msdu_size, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohl(pCtx, &pDst->min_service_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->max_service_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->inactivity_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->suspension_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->service_start_time, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->min_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->mean_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->peak_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->burst_size, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->delay_bound, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->min_phy_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->surplus_bw_allowance, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->medium_time, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTSPEC. */
+
+#define SigIeTSPEC ( 0x0026 )
+
+
+tANI_U32 dot11fUnpackIeWMMSchedule(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMSchedule *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp27__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    framesntohs(pCtx, &tmp27__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->aggregation = tmp27__ >> 0 & 0x1;
+    pDst->tsid = tmp27__ >> 1 & 0xf;
+    pDst->direction = tmp27__ >> 5 & 0x3;
+    pDst->reserved = tmp27__ >> 7 & 0x1ff;
+    framesntohl(pCtx, &pDst->service_start_time, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->service_interval, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->max_service_dur, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->spec_interval, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMSchedule. */
+
+#define SigIeWMMSchedule ( 0x0027 )
+
+
+tANI_U32 dot11fUnpackIeWMMTCLAS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMTCLAS *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    pDst->user_priority = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->classifier_type = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->classifier_mask = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    switch (pDst->classifier_type)
+    {
+        case 0:
+            DOT11F_MEMCPY(pCtx, pDst->info.EthParams.source, pBuf, 6);
+            pBuf += 6;
+            ielen -= (tANI_U8)6;
+            DOT11F_MEMCPY(pCtx, pDst->info.EthParams.dest, pBuf, 6);
+            pBuf += 6;
+            ielen -= (tANI_U8)6;
+            framesntohs(pCtx, &pDst->info.EthParams.type, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+        case 1:
+            pDst->info.IpParams.version = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            switch (pDst->info.IpParams.version)
+            {
+                case 4:
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV4Params.source, pBuf, 4);
+                    pBuf += 4;
+                    ielen -= (tANI_U8)4;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV4Params.dest, pBuf, 4);
+                    pBuf += 4;
+                    ielen -= (tANI_U8)4;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV4Params.src_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV4Params.dest_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    pDst->info.IpParams.params.IpV4Params.DSCP = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                    pDst->info.IpParams.params.IpV4Params.proto = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                    pDst->info.IpParams.params.IpV4Params.reserved = *pBuf;
+                    pBuf += 1;
+                    ielen -= (tANI_U8)1;
+                break;
+                case 6:
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.source, pBuf, 16);
+                    pBuf += 16;
+                    ielen -= (tANI_U8)16;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.dest, pBuf, 16);
+                    pBuf += 16;
+                    ielen -= (tANI_U8)16;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV6Params.src_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    framesntohs(pCtx, &pDst->info.IpParams.params.IpV6Params.dest_port, pBuf, 0);
+                    pBuf += 2;
+                    ielen -= (tANI_U8)2;
+                    DOT11F_MEMCPY(pCtx, pDst->info.IpParams.params.IpV6Params.flow_label, pBuf, 3);
+                    pBuf += 3;
+                    ielen -= (tANI_U8)3;
+                break;
+            }
+        break;
+        case 2:
+            framesntohs(pCtx, &pDst->info.Params8021dq.tag_type, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMTCLAS. */
+
+#define SigIeWMMTCLAS ( 0x0028 )
+
+
+tANI_U32 dot11fUnpackIeWMMTCLASPROC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMTCLASPROC *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    pDst->processing = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMTCLASPROC. */
+
+#define SigIeWMMTCLASPROC ( 0x0029 )
+
+
+tANI_U32 dot11fUnpackIeWMMTSDelay(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMTSDelay *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    framesntohl(pCtx, &pDst->delay, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMTSDelay. */
+
+#define SigIeWMMTSDelay ( 0x002a )
+
+
+tANI_U32 dot11fUnpackIeWMMTSPEC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMTSPEC *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp28__;
+    tANI_U8 tmp29__;
+    tANI_U16 tmp30__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    framesntohs(pCtx, &tmp28__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->traffic_type = tmp28__ >> 0 & 0x1;
+    pDst->tsid = tmp28__ >> 1 & 0xf;
+    pDst->direction = tmp28__ >> 5 & 0x3;
+    pDst->access_policy = tmp28__ >> 7 & 0x3;
+    pDst->aggregation = tmp28__ >> 9 & 0x1;
+    pDst->psb = tmp28__ >> 10 & 0x1;
+    pDst->user_priority = tmp28__ >> 11 & 0x7;
+    pDst->tsinfo_ack_pol = tmp28__ >> 14 & 0x3;
+    tmp29__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->tsinfo_rsvd = tmp29__ >> 0 & 0x7f;
+    pDst->burst_size_defn = tmp29__ >> 7 & 0x1;
+    framesntohs(pCtx, &tmp30__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->size = tmp30__ >> 0 & 0x7fff;
+    pDst->fixed = tmp30__ >> 15 & 0x1;
+    framesntohs(pCtx, &pDst->max_msdu_size, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohl(pCtx, &pDst->min_service_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->max_service_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->inactivity_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->suspension_int, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->service_start_time, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->min_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->mean_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->peak_data_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->burst_size, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->delay_bound, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohl(pCtx, &pDst->min_phy_rate, pBuf, 0);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohs(pCtx, &pDst->surplus_bw_allowance, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->medium_time, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMTSPEC. */
+
+#define SigIeWMMTSPEC ( 0x002b )
+
+
+    static const tFFDefn FFS_Airgo[ ] = {
+        { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Airgo[ ] = {
+        {offsetof(tDot11fIEAirgo, PropSuppRates), offsetof(tDot11fIEPropSuppRates, present), 0, "PropSuppRates" , 0, 3, 14, SigIePropSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPSUPPRATES, 0, },
+        {offsetof(tDot11fIEAirgo, APName), offsetof(tDot11fIEAPName, present), 0, "APName" , 0, 3, 34, SigIeAPName, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APNAME, 0, },
+        {offsetof(tDot11fIEAirgo, HCF), offsetof(tDot11fIEHCF, present), 0, "HCF" , 0, 3, 3, SigIeHCF, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HCF, 0, },
+        {offsetof(tDot11fIEAirgo, WDS), offsetof(tDot11fIEWDS, present), 0, "WDS" , 0, 2, 66, SigIeWDS, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WDS, 0, },
+        {offsetof(tDot11fIEAirgo, BPIndicator), offsetof(tDot11fIEBPIndicator, present), 0, "BPIndicator" , 0, 4, 4, SigIeBPIndicator, {0, 0, 0, 0, 0}, 0, DOT11F_EID_BPINDICATOR, 0, },
+        {offsetof(tDot11fIEAirgo, LoadInfo), offsetof(tDot11fIELoadInfo, present), 0, "LoadInfo" , 0, 6, 6, SigIeLoadInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_LOADINFO, 0, },
+        {offsetof(tDot11fIEAirgo, LoadBalance), offsetof(tDot11fIELoadBalance, present), 0, "LoadBalance" , 0, 9, 9, SigIeLoadBalance, {0, 0, 0, 0, 0}, 0, DOT11F_EID_LOADBALANCE, 0, },
+        {offsetof(tDot11fIEAirgo, PropAssocType), offsetof(tDot11fIEPropAssocType, present), 0, "PropAssocType" , 0, 3, 3, SigIePropAssocType, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPASSOCTYPE, 0, },
+        {offsetof(tDot11fIEAirgo, LLAttr), offsetof(tDot11fIELLAttr, present), 0, "LLAttr" , 0, 6, 6, SigIeLLAttr, {0, 0, 0, 0, 0}, 0, DOT11F_EID_LLATTR, 0, },
+        {offsetof(tDot11fIEAirgo, PropCapability), offsetof(tDot11fIEPropCapability, present), 0, "PropCapability" , 0, 4, 4, SigIePropCapability, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPCAPABILITY, 0, },
+        {offsetof(tDot11fIEAirgo, Version), offsetof(tDot11fIEVersion, present), 0, "Version" , 0, 7, 27, SigIeVersion, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VERSION, 0, },
+        {offsetof(tDot11fIEAirgo, PropEDCAParams), offsetof(tDot11fIEPropEDCAParams, present), 0, "PropEDCAParams" , 0, 20, 20, SigIePropEDCAParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPEDCAPARAMS, 0, },
+        {offsetof(tDot11fIEAirgo, Titan), offsetof(tDot11fIETitan, present), 0, "Titan" , 0, 6, 6, SigIeTitan, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TITAN, 0, },
+        {offsetof(tDot11fIEAirgo, PropChannSwitchAnn), offsetof(tDot11fIEPropChannSwitchAnn, present), 0, "PropChannSwitchAnn" , 0, 6, 6, SigIePropChannSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPCHANNSWITCHANN, 0, },
+        {offsetof(tDot11fIEAirgo, PropQuietBSS), offsetof(tDot11fIEPropQuietBSS, present), 0, "PropQuietBSS" , 0, 8, 8, SigIePropQuietBSS, {0, 0, 0, 0, 0}, 0, DOT11F_EID_PROPQUIETBSS, 0, },
+        {offsetof(tDot11fIEAirgo, TriggerStaBgScan), offsetof(tDot11fIETriggerStaBgScan, present), 0, "TriggerStaBgScan" , 0, 3, 3, SigIeTriggerStaBgScan, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TRIGGERSTABGSCAN, 0, },
+        {offsetof(tDot11fIEAirgo, Taurus), offsetof(tDot11fIETaurus, present), 0, "Taurus" , 0, 8, 8, SigIeTaurus, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TAURUS, 0, },
+        {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+    };
+
+tANI_U32 dot11fUnpackIeAirgo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEAirgo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    (void)pCtx;
+    status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_Airgo,
+                     IES_Airgo,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeAirgo. */
+
+#define SigIeAirgo ( 0x002c )
+
+
+tANI_U32 dot11fUnpackIeCCXCckmOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXCckmOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 20){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXCckmOpaque. */
+
+#define SigIeCCXCckmOpaque ( 0x002d )
+
+
+tANI_U32 dot11fUnpackIeCCXRadMgmtCap(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXRadMgmtCap *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp31__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->mgmt_state = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp31__ = *pBuf;
+    pDst->mbssid_mask = tmp31__ >> 0 & 0x7;
+    pDst->reserved = tmp31__ >> 3 & 0x1f;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXRadMgmtCap. */
+
+#define SigIeCCXRadMgmtCap ( 0x002e )
+
+
+tANI_U32 dot11fUnpackIeCCXTrafStrmMet(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXTrafStrmMet *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->tsid = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->state = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->msmt_interval, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXTrafStrmMet. */
+
+#define SigIeCCXTrafStrmMet ( 0x002f )
+
+
+tANI_U32 dot11fUnpackIeCCXTrafStrmRateSet(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXTrafStrmRateSet *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->tsid = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_tsrates = (tANI_U8)( ielen );
+    if (ielen > 8){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->tsrates, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXTrafStrmRateSet. */
+
+#define SigIeCCXTrafStrmRateSet ( 0x0030 )
+
+
+tANI_U32 dot11fUnpackIeCCXTxmitPower(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXTxmitPower *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->power_limit = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->reserved = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXTxmitPower. */
+
+#define SigIeCCXTxmitPower ( 0x0031 )
+
+
+tANI_U32 dot11fUnpackIeCCXVersion(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECCXVersion *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCCXVersion. */
+
+#define SigIeCCXVersion ( 0x0032 )
+
+
+tANI_U32 dot11fUnpackIeCFParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECFParams *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->cfp_count = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->cfp_period = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->cfp_maxduration, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->cfp_durremaining, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCFParams. */
+
+#define SigIeCFParams ( 0x0033 )
+
+
+tANI_U32 dot11fUnpackIeChallengeText(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEChallengeText *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_text = (tANI_U8)( ielen );
+    if (ielen > 253){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->text, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeChallengeText. */
+
+#define SigIeChallengeText ( 0x0034 )
+
+
+tANI_U32 dot11fUnpackIeChanSwitchAnn(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEChanSwitchAnn *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->switchMode = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->newChannel = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->switchCount = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeChanSwitchAnn. */
+
+#define SigIeChanSwitchAnn ( 0x0035 )
+
+
+tANI_U32 dot11fUnpackIeCountry(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIECountry *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->country, pBuf, 3);
+    pBuf += 3;
+    ielen -= (tANI_U8)3;
+    if ( ! ielen )
+    {
+        pDst->num_triplets = 0U;
+        return 0U;
+    }
+    else
+    {
+        pDst->num_triplets = (tANI_U8)( ielen / 3 );
+        if (ielen / 3 > 84){
+                pDst->present = 0;
+                return DOT11F_SKIPPED_BAD_IE;
+        }
+
+        DOT11F_MEMCPY(pCtx, pDst->triplets, pBuf, ( ielen ) );
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeCountry. */
+
+#define SigIeCountry ( 0x0036 )
+
+
+#define SigIeDSParams ( 0x0037 )
+
+
+tANI_U32 dot11fUnpackIeEDCAParamSet(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEEDCAParamSet *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp32__;
+    tANI_U8 tmp33__;
+    tANI_U8 tmp34__;
+    tANI_U8 tmp35__;
+    tANI_U8 tmp36__;
+    tANI_U8 tmp37__;
+    tANI_U8 tmp38__;
+    tANI_U8 tmp39__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->qos = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->reserved = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp32__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_aifsn = tmp32__ >> 0 & 0xf;
+    pDst->acbe_acm = tmp32__ >> 4 & 0x1;
+    pDst->acbe_aci = tmp32__ >> 5 & 0x3;
+    pDst->unused1 = tmp32__ >> 7 & 0x1;
+    tmp33__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_acwmin = tmp33__ >> 0 & 0xf;
+    pDst->acbe_acwmax = tmp33__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbe_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp34__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_aifsn = tmp34__ >> 0 & 0xf;
+    pDst->acbk_acm = tmp34__ >> 4 & 0x1;
+    pDst->acbk_aci = tmp34__ >> 5 & 0x3;
+    pDst->unused2 = tmp34__ >> 7 & 0x1;
+    tmp35__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_acwmin = tmp35__ >> 0 & 0xf;
+    pDst->acbk_acwmax = tmp35__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbk_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp36__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_aifsn = tmp36__ >> 0 & 0xf;
+    pDst->acvi_acm = tmp36__ >> 4 & 0x1;
+    pDst->acvi_aci = tmp36__ >> 5 & 0x3;
+    pDst->unused3 = tmp36__ >> 7 & 0x1;
+    tmp37__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_acwmin = tmp37__ >> 0 & 0xf;
+    pDst->acvi_acwmax = tmp37__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvi_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp38__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_aifsn = tmp38__ >> 0 & 0xf;
+    pDst->acvo_acm = tmp38__ >> 4 & 0x1;
+    pDst->acvo_aci = tmp38__ >> 5 & 0x3;
+    pDst->unused4 = tmp38__ >> 7 & 0x1;
+    tmp39__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_acwmin = tmp39__ >> 0 & 0xf;
+    pDst->acvo_acwmax = tmp39__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvo_txoplimit, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeEDCAParamSet. */
+
+#define SigIeEDCAParamSet ( 0x0038 )
+
+
+tANI_U32 dot11fUnpackIeERPInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEERPInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp40__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    tmp40__ = *pBuf;
+    pDst->non_erp_present = tmp40__ >> 0 & 0x1;
+    pDst->use_prot = tmp40__ >> 1 & 0x1;
+    pDst->barker_preamble = tmp40__ >> 2 & 0x1;
+    pDst->unused = tmp40__ >> 3 & 0x1f;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeERPInfo. */
+
+#define SigIeERPInfo ( 0x0039 )
+
+
+#define SigIeExtChanSwitchAnn ( 0x003a )
+
+
+tANI_U32 dot11fUnpackIeExtSuppRates(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEExtSuppRates *pDst)
+{
+    tANI_U8 i;
+    tANI_U8 rate_indx = 0;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    for (i = 0; i < ielen; i++) {
+        if ((DOT11F_IS_BG_RATE(pBuf[i] & 0x7F)) && 
+            (rate_indx < 12)) {
+            pDst->rates[rate_indx++] = pBuf[i];
+        }
+    }
+
+    if(rate_indx == 0) {
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    pDst->num_rates = rate_indx;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeExtSuppRates. */
+
+#define SigIeExtSuppRates ( 0x003b )
+
+
+tANI_U32 dot11fUnpackIeFHParamSet(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEFHParamSet *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->dwell_time, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    pDst->hop_set = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->hop_pattern = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->hop_index = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeFHParamSet. */
+
+#define SigIeFHParamSet ( 0x003c )
+
+
+tANI_U32 dot11fUnpackIeFHParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEFHParams *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->radix = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->nchannels = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeFHParams. */
+
+#define SigIeFHParams ( 0x003d )
+
+
+tANI_U32 dot11fUnpackIeFHPattTable(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEFHPattTable *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->flag = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->nsets = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->modulus = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->offset = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_randtable = (tANI_U8)( ielen );
+    if (ielen > 251){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->randtable, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeFHPattTable. */
+
+#define SigIeFHPattTable ( 0x003e )
+
+
+    static const tFFDefn FFS_FTInfo[ ] = {
+        { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_FTInfo[ ] = {
+        {offsetof(tDot11fIEFTInfo, R1KH_ID), offsetof(tDot11fIER1KH_ID, present), 0, "R1KH_ID" , 0, 8, 8, SigIeR1KH_ID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_R1KH_ID, 0, },
+        {offsetof(tDot11fIEFTInfo, GTK), offsetof(tDot11fIEGTK, present), 0, "GTK" , 0, 18, 45, SigIeGTK, {0, 0, 0, 0, 0}, 0, DOT11F_EID_GTK, 0, },
+        {offsetof(tDot11fIEFTInfo, R0KH_ID), offsetof(tDot11fIER0KH_ID, present), 0, "R0KH_ID" , 0, 3, 50, SigIeR0KH_ID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_R0KH_ID, 0, },
+        {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+    };
+
+tANI_U32 dot11fUnpackIeFTInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEFTInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp41__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &tmp41__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->reserved = tmp41__ >> 0 & 0xff;
+    pDst->IECount = tmp41__ >> 8 & 0xff;
+    DOT11F_MEMCPY(pCtx, pDst->MIC, pBuf, 16);
+    pBuf += 16;
+    ielen -= (tANI_U8)16;
+    DOT11F_MEMCPY(pCtx, pDst->Anonce, pBuf, 32);
+    pBuf += 32;
+    ielen -= (tANI_U8)32;
+    DOT11F_MEMCPY(pCtx, pDst->Snonce, pBuf, 32);
+    pBuf += 32;
+    ielen -= (tANI_U8)32;
+    (void)pCtx;
+    status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_FTInfo,
+                     IES_FTInfo,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeFTInfo. */
+
+#define SigIeFTInfo ( 0x003f )
+
+
+tANI_U32 dot11fUnpackIeFTTimeoutInterval(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEFTTimeoutInterval *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->timeoutType = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohl(pCtx, &pDst->timeoutValue, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeFTTimeoutInterval. */
+
+#define SigIeFTTimeoutInterval ( 0x0040 )
+
+
+tANI_U32 dot11fUnpackIeHTCaps(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEHTCaps *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp42__;
+    tANI_U8 tmp43__;
+    tANI_U16 tmp44__;
+    tANI_U32 tmp45__;
+    tANI_U8 tmp46__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &tmp42__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->advCodingCap = tmp42__ >> 0 & 0x1;
+    pDst->supportedChannelWidthSet = tmp42__ >> 1 & 0x1;
+    pDst->mimoPowerSave = tmp42__ >> 2 & 0x3;
+    pDst->greenField = tmp42__ >> 4 & 0x1;
+    pDst->shortGI20MHz = tmp42__ >> 5 & 0x1;
+    pDst->shortGI40MHz = tmp42__ >> 6 & 0x1;
+    pDst->txSTBC = tmp42__ >> 7 & 0x1;
+    pDst->rxSTBC = tmp42__ >> 8 & 0x3;
+    pDst->delayedBA = tmp42__ >> 10 & 0x1;
+    pDst->maximalAMSDUsize = tmp42__ >> 11 & 0x1;
+    pDst->dsssCckMode40MHz = tmp42__ >> 12 & 0x1;
+    pDst->psmp = tmp42__ >> 13 & 0x1;
+    pDst->stbcControlFrame = tmp42__ >> 14 & 0x1;
+    pDst->lsigTXOPProtection = tmp42__ >> 15 & 0x1;
+    tmp43__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->maxRxAMPDUFactor = tmp43__ >> 0 & 0x3;
+    pDst->mpduDensity = tmp43__ >> 2 & 0x7;
+    pDst->reserved1 = tmp43__ >> 5 & 0x7;
+    DOT11F_MEMCPY(pCtx, pDst->supportedMCSSet, pBuf, 16);
+    pBuf += 16;
+    ielen -= (tANI_U8)16;
+    framesntohs(pCtx, &tmp44__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->pco = tmp44__ >> 0 & 0x1;
+    pDst->transitionTime = tmp44__ >> 1 & 0x3;
+    pDst->reserved2 = tmp44__ >> 3 & 0x1f;
+    pDst->mcsFeedback = tmp44__ >> 8 & 0x3;
+    pDst->reserved3 = tmp44__ >> 10 & 0x3f;
+    framesntohl(pCtx, &tmp45__, pBuf, 0);
+    pBuf += 4;
+    ielen -= 4;
+    pDst->txBF = tmp45__ >> 0 & 0x1;
+    pDst->rxStaggeredSounding = tmp45__ >> 1 & 0x1;
+    pDst->txStaggeredSounding = tmp45__ >> 2 & 0x1;
+    pDst->rxZLF = tmp45__ >> 3 & 0x1;
+    pDst->txZLF = tmp45__ >> 4 & 0x1;
+    pDst->implicitTxBF = tmp45__ >> 5 & 0x1;
+    pDst->calibration = tmp45__ >> 6 & 0x3;
+    pDst->explicitCSITxBF = tmp45__ >> 8 & 0x1;
+    pDst->explicitUncompressedSteeringMatrix = tmp45__ >> 9 & 0x1;
+    pDst->explicitBFCSIFeedback = tmp45__ >> 10 & 0x7;
+    pDst->explicitUncompressedSteeringMatrixFeedback = tmp45__ >> 13 & 0x7;
+    pDst->explicitCompressedSteeringMatrixFeedback = tmp45__ >> 16 & 0x7;
+    pDst->csiNumBFAntennae = tmp45__ >> 19 & 0x3;
+    pDst->uncompressedSteeringMatrixBFAntennae = tmp45__ >> 21 & 0x3;
+    pDst->compressedSteeringMatrixBFAntennae = tmp45__ >> 23 & 0x3;
+    pDst->reserved4 = tmp45__ >> 25 & 0x7f;
+    tmp46__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->antennaSelection = tmp46__ >> 0 & 0x1;
+    pDst->explicitCSIFeedbackTx = tmp46__ >> 1 & 0x1;
+    pDst->antennaIndicesFeedbackTx = tmp46__ >> 2 & 0x1;
+    pDst->explicitCSIFeedback = tmp46__ >> 3 & 0x1;
+    pDst->antennaIndicesFeedback = tmp46__ >> 4 & 0x1;
+    pDst->rxAS = tmp46__ >> 5 & 0x1;
+    pDst->txSoundingPPDUs = tmp46__ >> 6 & 0x1;
+    pDst->reserved5 = tmp46__ >> 7 & 0x1;
+    pDst->num_rsvd = (tANI_U8)( ielen );
+    if (ielen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->rsvd, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeHTCaps. */
+
+#define SigIeHTCaps ( 0x0041 )
+
+
+tANI_U32 dot11fUnpackIeHTInfo(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEHTInfo *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp47__;
+    tANI_U16 tmp48__;
+    tANI_U16 tmp49__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->primaryChannel = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp47__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->secondaryChannelOffset = tmp47__ >> 0 & 0x3;
+    pDst->recommendedTxWidthSet = tmp47__ >> 2 & 0x1;
+    pDst->rifsMode = tmp47__ >> 3 & 0x1;
+    pDst->controlledAccessOnly = tmp47__ >> 4 & 0x1;
+    pDst->serviceIntervalGranularity = tmp47__ >> 5 & 0x7;
+    framesntohs(pCtx, &tmp48__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->opMode = tmp48__ >> 0 & 0x3;
+    pDst->nonGFDevicesPresent = tmp48__ >> 2 & 0x1;
+    pDst->transmitBurstLimit = tmp48__ >> 3 & 0x1;
+    pDst->obssNonHTStaPresent = tmp48__ >> 4 & 0x1;
+    pDst->reserved = tmp48__ >> 5 & 0x7ff;
+    framesntohs(pCtx, &tmp49__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->basicSTBCMCS = tmp49__ >> 0 & 0x7f;
+    pDst->dualCTSProtection = tmp49__ >> 7 & 0x1;
+    pDst->secondaryBeacon = tmp49__ >> 8 & 0x1;
+    pDst->lsigTXOPProtectionFullSupport = tmp49__ >> 9 & 0x1;
+    pDst->pcoActive = tmp49__ >> 10 & 0x1;
+    pDst->pcoPhase = tmp49__ >> 11 & 0x1;
+    pDst->reserved2 = tmp49__ >> 12 & 0xf;
+    DOT11F_MEMCPY(pCtx, pDst->basicMCSSet, pBuf, 16);
+    pBuf += 16;
+    ielen -= (tANI_U8)16;
+    pDst->num_rsvd = (tANI_U8)( ielen );
+    if (ielen > 32){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->rsvd, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeHTInfo. */
+
+#define SigIeHTInfo ( 0x0042 )
+
+
+tANI_U32 dot11fUnpackIeIBSSParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEIBSSParams *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->atim, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeIBSSParams. */
+
+#define SigIeIBSSParams ( 0x0043 )
+
+
+static const tFFDefn FFS_reportBeacon[ ] = {
+{ NULL, 0, 0, 0,},
+};
+
+static const tIEDefn IES_reportBeacon[ ] = {
+        {offsetof(tDot11fIEMeasurementReport, report.Beacon.BeaconReportFrmBody), offsetof(tDot11fIEBeaconReportFrmBody, present), 0, "BeaconReportFrmBody" , 0, 2, 226, SigIeBeaconReportFrmBody, {0, 0, 0, 0, 0}, 0, DOT11F_EID_BEACONREPORTFRMBODY, 0, },
+{0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+};
+
+tANI_U32 dot11fUnpackIeMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEMeasurementReport *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp50__;
+    tANI_U8 tmp51__;
+    tANI_U8 tmp52__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->token = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp50__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->late = tmp50__ >> 0 & 0x1;
+    pDst->incapable = tmp50__ >> 1 & 0x1;
+    pDst->refused = tmp50__ >> 2 & 0x1;
+    pDst->unused = tmp50__ >> 3 & 0x1f;
+    pDst->type = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if ( ! ielen )
+    {
+        return 0U;
+    }
+    else
+    {
+        switch (pDst->type)
+        {
+            case 0:
+                pDst->report.Basic.channel = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                framesntohq(pCtx, &pDst->report.Basic.meas_start_time, pBuf, 0);
+                pBuf += 8;
+                ielen -= (tANI_U8)8;
+                framesntohs(pCtx, &pDst->report.Basic.meas_duration, pBuf, 0);
+                pBuf += 2;
+                ielen -= (tANI_U8)2;
+                tmp51__ = *pBuf;
+                pBuf += 1;
+                ielen -= 1;
+                pDst->report.Basic.bss = tmp51__ >> 0 & 0x1;
+                pDst->report.Basic.ofdm_preamble = tmp51__ >> 1 & 0x1;
+                pDst->report.Basic.unid_signal = tmp51__ >> 2 & 0x1;
+                pDst->report.Basic.rader = tmp51__ >> 3 & 0x1;
+                pDst->report.Basic.unmeasured = tmp51__ >> 4 & 0x1;
+                pDst->report.Basic.unused = tmp51__ >> 5 & 0x7;
+            break;
+            case 1:
+                pDst->report.CCA.channel = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                framesntohq(pCtx, &pDst->report.CCA.meas_start_time, pBuf, 0);
+                pBuf += 8;
+                ielen -= (tANI_U8)8;
+                framesntohs(pCtx, &pDst->report.CCA.meas_duration, pBuf, 0);
+                pBuf += 2;
+                ielen -= (tANI_U8)2;
+                pDst->report.CCA.cca_busy_fraction = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+            break;
+            case 2:
+                pDst->report.RPIHistogram.channel = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                framesntohq(pCtx, &pDst->report.RPIHistogram.meas_start_time, pBuf, 0);
+                pBuf += 8;
+                ielen -= (tANI_U8)8;
+                framesntohs(pCtx, &pDst->report.RPIHistogram.meas_duration, pBuf, 0);
+                pBuf += 2;
+                ielen -= (tANI_U8)2;
+                pDst->report.RPIHistogram.rpi0_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi1_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi2_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi3_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi4_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi5_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi6_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.RPIHistogram.rpi7_density = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+            break;
+            case 5:
+                pDst->report.Beacon.regClass = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.Beacon.channel = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                framesntohq(pCtx, &pDst->report.Beacon.meas_start_time, pBuf, 0);
+                pBuf += 8;
+                ielen -= (tANI_U8)8;
+                framesntohs(pCtx, &pDst->report.Beacon.meas_duration, pBuf, 0);
+                pBuf += 2;
+                ielen -= (tANI_U8)2;
+                tmp52__ = *pBuf;
+                pBuf += 1;
+                ielen -= 1;
+                pDst->report.Beacon.condensed_PHY = tmp52__ >> 0 & 0x7f;
+                pDst->report.Beacon.reported_frame_type = tmp52__ >> 7 & 0x1;
+                pDst->report.Beacon.RCPI = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                pDst->report.Beacon.RSNI = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                DOT11F_MEMCPY(pCtx, pDst->report.Beacon.BSSID, pBuf, 6);
+                pBuf += 6;
+                ielen -= (tANI_U8)6;
+                pDst->report.Beacon.antenna_id = *pBuf;
+                pBuf += 1;
+                ielen -= (tANI_U8)1;
+                framesntohl(pCtx, &pDst->report.Beacon.parent_TSF, pBuf, 0);
+                pBuf += 4;
+                ielen -= (tANI_U8)4;
+            status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_reportBeacon,
+                     IES_reportBeacon,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+            break;
+        }
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeMeasurementReport. */
+
+#define SigIeMeasurementReport ( 0x0044 )
+
+
+static const tFFDefn FFS_measurement_requestBeacon[ ] = {
+{ NULL, 0, 0, 0,},
+};
+
+static const tIEDefn IES_measurement_requestBeacon[ ] = {
+        {offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 0, },
+        {offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.BeaconReporting), offsetof(tDot11fIEBeaconReporting, present), 0, "BeaconReporting" , 0, 4, 4, SigIeBeaconReporting, {0, 0, 0, 0, 0}, 0, DOT11F_EID_BEACONREPORTING, 0, },
+        {offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.BcnReportingDetail), offsetof(tDot11fIEBcnReportingDetail, present), 0, "BcnReportingDetail" , 0, 3, 3, SigIeBcnReportingDetail, {0, 0, 0, 0, 0}, 0, DOT11F_EID_BCNREPORTINGDETAIL, 0, },
+        {offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.RequestedInfo), offsetof(tDot11fIERequestedInfo, present), 0, "RequestedInfo" , 0, 2, 257, SigIeRequestedInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_REQUESTEDINFO, 0, },
+        {offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.APChannelReport), offsetof(tDot11fIEAPChannelReport, present), offsetof(tDot11fIEMeasurementRequest, measurement_request.Beacon.num_APChannelReport), "APChannelReport" , 2, 3, 53, SigIeAPChannelReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APCHANNELREPORT, 0, },
+{0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+};
+
+tANI_U32 dot11fUnpackIeMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEMeasurementRequest *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp53__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->measurement_token = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp53__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->parallel = tmp53__ >> 0 & 0x1;
+    pDst->enable = tmp53__ >> 1 & 0x1;
+    pDst->request = tmp53__ >> 2 & 0x1;
+    pDst->report = tmp53__ >> 3 & 0x1;
+    pDst->durationMandatory = tmp53__ >> 4 & 0x1;
+    pDst->unused = tmp53__ >> 5 & 0x7;
+    pDst->measurement_type = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    switch (pDst->measurement_type)
+    {
+        case 0:
+            pDst->measurement_request.Basic.channel_no = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            DOT11F_MEMCPY(pCtx, pDst->measurement_request.Basic.meas_start_time, pBuf, 8);
+            pBuf += 8;
+            ielen -= (tANI_U8)8;
+            framesntohs(pCtx, &pDst->measurement_request.Basic.meas_duration, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+        case 1:
+            pDst->measurement_request.CCA.channel_no = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            DOT11F_MEMCPY(pCtx, pDst->measurement_request.CCA.meas_start_time, pBuf, 8);
+            pBuf += 8;
+            ielen -= (tANI_U8)8;
+            framesntohs(pCtx, &pDst->measurement_request.CCA.meas_duration, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+        case 2:
+            pDst->measurement_request.RPIHistogram.channel_no = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            DOT11F_MEMCPY(pCtx, pDst->measurement_request.RPIHistogram.meas_start_time, pBuf, 8);
+            pBuf += 8;
+            ielen -= (tANI_U8)8;
+            framesntohs(pCtx, &pDst->measurement_request.RPIHistogram.meas_duration, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+        break;
+        case 5:
+            pDst->measurement_request.Beacon.regClass = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            pDst->measurement_request.Beacon.channel = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            framesntohs(pCtx, &pDst->measurement_request.Beacon.randomization, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+            framesntohs(pCtx, &pDst->measurement_request.Beacon.meas_duration, pBuf, 0);
+            pBuf += 2;
+            ielen -= (tANI_U8)2;
+            pDst->measurement_request.Beacon.meas_mode = *pBuf;
+            pBuf += 1;
+            ielen -= (tANI_U8)1;
+            DOT11F_MEMCPY(pCtx, pDst->measurement_request.Beacon.BSSID, pBuf, 6);
+            pBuf += 6;
+            ielen -= (tANI_U8)6;
+        status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_measurement_requestBeacon,
+                     IES_measurement_requestBeacon,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+        break;
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeMeasurementRequest. */
+
+#define SigIeMeasurementRequest ( 0x0045 )
+
+
+tANI_U32 dot11fUnpackIeMobilityDomain(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEMobilityDomain *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp54__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->MDID, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp54__ = *pBuf;
+    pDst->overDSCap = tmp54__ >> 0 & 0x1;
+    pDst->resourceReqCap = tmp54__ >> 1 & 0x1;
+    pDst->reserved = tmp54__ >> 2 & 0x3f;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeMobilityDomain. */
+
+#define SigIeMobilityDomain ( 0x0046 )
+
+
+    static const tFFDefn FFS_NeighborReport[ ] = {
+        { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_NeighborReport[ ] = {
+        {offsetof(tDot11fIENeighborReport, TSFInfo), offsetof(tDot11fIETSFInfo, present), 0, "TSFInfo" , 0, 6, 6, SigIeTSFInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSFINFO, 0, },
+        {offsetof(tDot11fIENeighborReport, CondensedCountryStr), offsetof(tDot11fIECondensedCountryStr, present), 0, "CondensedCountryStr" , 0, 4, 4, SigIeCondensedCountryStr, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CONDENSEDCOUNTRYSTR, 0, },
+        {offsetof(tDot11fIENeighborReport, MeasurementPilot), offsetof(tDot11fIEMeasurementPilot, present), 0, "MeasurementPilot" , 0, 3, 258, SigIeMeasurementPilot, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTPILOT, 0, },
+        {offsetof(tDot11fIENeighborReport, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fIENeighborReport, MultiBssid), offsetof(tDot11fIEMultiBssid, present), 0, "MultiBssid" , 0, 3, 258, SigIeMultiBssid, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MULTIBSSID, 0, },
+        {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+    };
+
+tANI_U32 dot11fUnpackIeNeighborReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIENeighborReport *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp55__;
+    tANI_U8 tmp56__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    DOT11F_MEMCPY(pCtx, pDst->bssid, pBuf, 6);
+    pBuf += 6;
+    ielen -= (tANI_U8)6;
+    tmp55__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->APReachability = tmp55__ >> 0 & 0x3;
+    pDst->Security = tmp55__ >> 2 & 0x1;
+    pDst->KeyScope = tmp55__ >> 3 & 0x1;
+    pDst->SpecMgmtCap = tmp55__ >> 4 & 0x1;
+    pDst->QosCap = tmp55__ >> 5 & 0x1;
+    pDst->apsd = tmp55__ >> 6 & 0x1;
+    pDst->rrm = tmp55__ >> 7 & 0x1;
+    tmp56__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->DelayedBA = tmp56__ >> 0 & 0x1;
+    pDst->ImmBA = tmp56__ >> 1 & 0x1;
+    pDst->MobilityDomain = tmp56__ >> 2 & 0x1;
+    pDst->reserved = tmp56__ >> 3 & 0x1f;
+    framesntohs(pCtx, &pDst->reserved1, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    pDst->regulatoryClass = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->channel = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->PhyType = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    (void)pCtx;
+    status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_NeighborReport,
+                     IES_NeighborReport,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeNeighborReport. */
+
+#define SigIeNeighborReport ( 0x0047 )
+
+
+    static const tTLVDefn TLVS_P2PAssocReq[ ] = {
+        {offsetof(tDot11fIEP2PAssocReq, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PAssocReq, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PAssocReq, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PAssocReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PAssocReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PAssocReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PAssocReq. */
+
+#define SigIeP2PAssocReq ( 0x0048 )
+
+
+    static const tTLVDefn TLVS_P2PAssocRes[ ] = {
+        {offsetof(tDot11fIEP2PAssocRes, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PAssocRes, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PAssocRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PAssocRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PAssocRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PAssocRes. */
+
+#define SigIeP2PAssocRes ( 0x0049 )
+
+
+    static const tTLVDefn TLVS_P2PBeacon[ ] = {
+        {offsetof(tDot11fIEP2PBeacon, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeacon, P2PDeviceId), offsetof(tDot11fTLVP2PDeviceId, present), "P2PDeviceId", SigTlvP2PDeviceId, DOT11F_TLV_P2PDEVICEID, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeacon, NoticeOfAbsence), offsetof(tDot11fTLVNoticeOfAbsence, present), "NoticeOfAbsence", SigTlvNoticeOfAbsence, DOT11F_TLV_NOTICEOFABSENCE, 0, 5, 41, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PBeacon(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PBeacon *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PBeacon,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PBeacon. */
+
+#define SigIeP2PBeacon ( 0x004a )
+
+
+    static const tTLVDefn TLVS_P2PBeaconProbeRes[ ] = {
+        {offsetof(tDot11fIEP2PBeaconProbeRes, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeaconProbeRes, P2PDeviceId), offsetof(tDot11fTLVP2PDeviceId, present), "P2PDeviceId", SigTlvP2PDeviceId, DOT11F_TLV_P2PDEVICEID, 0, 9, 9, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeaconProbeRes, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeaconProbeRes, NoticeOfAbsence), offsetof(tDot11fTLVNoticeOfAbsence, present), "NoticeOfAbsence", SigTlvNoticeOfAbsence, DOT11F_TLV_NOTICEOFABSENCE, 0, 5, 41, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeaconProbeRes, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PBeaconProbeRes, P2PGroupInfo), offsetof(tDot11fTLVP2PGroupInfo, present), "P2PGroupInfo", SigTlvP2PGroupInfo, DOT11F_TLV_P2PGROUPINFO, 0, 3, 1027, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PBeaconProbeRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PBeaconProbeRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PBeaconProbeRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PBeaconProbeRes. */
+
+#define SigIeP2PBeaconProbeRes ( 0x004b )
+
+
+    static const tTLVDefn TLVS_P2PDeAuth[ ] = {
+        {offsetof(tDot11fIEP2PDeAuth, MinorReasonCode), offsetof(tDot11fTLVMinorReasonCode, present), "MinorReasonCode", SigTlvMinorReasonCode, DOT11F_TLV_MINORREASONCODE, 0, 4, 4, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PDeAuth(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PDeAuth *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PDeAuth,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PDeAuth. */
+
+#define SigIeP2PDeAuth ( 0x004c )
+
+
+    static const tTLVDefn TLVS_P2PDeviceDiscoverabilityReq[ ] = {
+        {offsetof(tDot11fIEP2PDeviceDiscoverabilityReq, P2PDeviceId), offsetof(tDot11fTLVP2PDeviceId, present), "P2PDeviceId", SigTlvP2PDeviceId, DOT11F_TLV_P2PDEVICEID, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PDeviceDiscoverabilityReq, P2PGroupId), offsetof(tDot11fTLVP2PGroupId, present), "P2PGroupId", SigTlvP2PGroupId, DOT11F_TLV_P2PGROUPID, 0, 9, 41, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PDeviceDiscoverabilityReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PDeviceDiscoverabilityReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PDeviceDiscoverabilityReq. */
+
+#define SigIeP2PDeviceDiscoverabilityReq ( 0x004d )
+
+
+    static const tTLVDefn TLVS_P2PDeviceDiscoverabilityRes[ ] = {
+        {offsetof(tDot11fIEP2PDeviceDiscoverabilityRes, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PDeviceDiscoverabilityRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PDeviceDiscoverabilityRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PDeviceDiscoverabilityRes. */
+
+#define SigIeP2PDeviceDiscoverabilityRes ( 0x004e )
+
+
+    static const tTLVDefn TLVS_P2PDisAssoc[ ] = {
+        {offsetof(tDot11fIEP2PDisAssoc, MinorReasonCode), offsetof(tDot11fTLVMinorReasonCode, present), "MinorReasonCode", SigTlvMinorReasonCode, DOT11F_TLV_MINORREASONCODE, 0, 4, 4, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PDisAssoc(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PDisAssoc *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PDisAssoc,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PDisAssoc. */
+
+#define SigIeP2PDisAssoc ( 0x004f )
+
+
+    static const tTLVDefn TLVS_P2PGONegCnf[ ] = {
+        {offsetof(tDot11fIEP2PGONegCnf, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegCnf, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegCnf, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegCnf, ChannelList), offsetof(tDot11fTLVChannelList, present), "ChannelList", SigTlvChannelList, DOT11F_TLV_CHANNELLIST, 0, 6, 257, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegCnf, P2PGroupId), offsetof(tDot11fTLVP2PGroupId, present), "P2PGroupId", SigTlvP2PGroupId, DOT11F_TLV_P2PGROUPID, 0, 9, 41, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PGONegCnf(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PGONegCnf *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PGONegCnf,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PGONegCnf. */
+
+#define SigIeP2PGONegCnf ( 0x0050 )
+
+
+    static const tTLVDefn TLVS_P2PGONegReq[ ] = {
+        {offsetof(tDot11fIEP2PGONegReq, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, GOIntent), offsetof(tDot11fTLVGOIntent, present), "GOIntent", SigTlvGOIntent, DOT11F_TLV_GOINTENT, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, ConfigurationTimeout), offsetof(tDot11fTLVConfigurationTimeout, present), "ConfigurationTimeout", SigTlvConfigurationTimeout, DOT11F_TLV_CONFIGURATIONTIMEOUT, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, ListenChannel), offsetof(tDot11fTLVListenChannel, present), "ListenChannel", SigTlvListenChannel, DOT11F_TLV_LISTENCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, IntendedP2PInterfaceAddress), offsetof(tDot11fTLVIntendedP2PInterfaceAddress, present), "IntendedP2PInterfaceAddress", SigTlvIntendedP2PInterfaceAddress, DOT11F_TLV_INTENDEDP2PINTERFACEADDRESS, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, ChannelList), offsetof(tDot11fTLVChannelList, present), "ChannelList", SigTlvChannelList, DOT11F_TLV_CHANNELLIST, 0, 6, 257, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegReq, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PGONegReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PGONegReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PGONegReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PGONegReq. */
+
+#define SigIeP2PGONegReq ( 0x0051 )
+
+
+    static const tTLVDefn TLVS_P2PGONegRes[ ] = {
+        {offsetof(tDot11fIEP2PGONegRes, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, GOIntent), offsetof(tDot11fTLVGOIntent, present), "GOIntent", SigTlvGOIntent, DOT11F_TLV_GOINTENT, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, ConfigurationTimeout), offsetof(tDot11fTLVConfigurationTimeout, present), "ConfigurationTimeout", SigTlvConfigurationTimeout, DOT11F_TLV_CONFIGURATIONTIMEOUT, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, IntendedP2PInterfaceAddress), offsetof(tDot11fTLVIntendedP2PInterfaceAddress, present), "IntendedP2PInterfaceAddress", SigTlvIntendedP2PInterfaceAddress, DOT11F_TLV_INTENDEDP2PINTERFACEADDRESS, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, ChannelList), offsetof(tDot11fTLVChannelList, present), "ChannelList", SigTlvChannelList, DOT11F_TLV_CHANNELLIST, 0, 6, 257, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PGONegRes, P2PGroupId), offsetof(tDot11fTLVP2PGroupId, present), "P2PGroupId", SigTlvP2PGroupId, DOT11F_TLV_P2PGROUPID, 0, 9, 41, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PGONegRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PGONegRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PGONegRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PGONegRes. */
+
+#define SigIeP2PGONegRes ( 0x0052 )
+
+
+    static const tTLVDefn TLVS_P2PGONegWPS[ ] = {
+        {offsetof(tDot11fIEP2PGONegWPS, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEP2PGONegWPS, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 1, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PGONegWPS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PGONegWPS *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PGONegWPS,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PGONegWPS. */
+
+#define SigIeP2PGONegWPS ( 0x0053 )
+
+
+tANI_U32 dot11fUnpackIeP2PIEOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PIEOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 249){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeP2PIEOpaque. */
+
+#define SigIeP2PIEOpaque ( 0x0054 )
+
+
+    static const tTLVDefn TLVS_P2PInvitationReq[ ] = {
+        {offsetof(tDot11fIEP2PInvitationReq, ConfigurationTimeout), offsetof(tDot11fTLVConfigurationTimeout, present), "ConfigurationTimeout", SigTlvConfigurationTimeout, DOT11F_TLV_CONFIGURATIONTIMEOUT, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, InvitationFlags), offsetof(tDot11fTLVInvitationFlags, present), "InvitationFlags", SigTlvInvitationFlags, DOT11F_TLV_INVITATIONFLAGS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, P2PGroupBssid), offsetof(tDot11fTLVP2PGroupBssid, present), "P2PGroupBssid", SigTlvP2PGroupBssid, DOT11F_TLV_P2PGROUPBSSID, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, ChannelList), offsetof(tDot11fTLVChannelList, present), "ChannelList", SigTlvChannelList, DOT11F_TLV_CHANNELLIST, 0, 6, 257, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, P2PGroupId), offsetof(tDot11fTLVP2PGroupId, present), "P2PGroupId", SigTlvP2PGroupId, DOT11F_TLV_P2PGROUPID, 0, 9, 41, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationReq, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PInvitationReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PInvitationReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PInvitationReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PInvitationReq. */
+
+#define SigIeP2PInvitationReq ( 0x0055 )
+
+
+    static const tTLVDefn TLVS_P2PInvitationRes[ ] = {
+        {offsetof(tDot11fIEP2PInvitationRes, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationRes, ConfigurationTimeout), offsetof(tDot11fTLVConfigurationTimeout, present), "ConfigurationTimeout", SigTlvConfigurationTimeout, DOT11F_TLV_CONFIGURATIONTIMEOUT, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationRes, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationRes, P2PGroupBssid), offsetof(tDot11fTLVP2PGroupBssid, present), "P2PGroupBssid", SigTlvP2PGroupBssid, DOT11F_TLV_P2PGROUPBSSID, 0, 9, 9, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PInvitationRes, ChannelList), offsetof(tDot11fTLVChannelList, present), "ChannelList", SigTlvChannelList, DOT11F_TLV_CHANNELLIST, 0, 6, 257, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PInvitationRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PInvitationRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PInvitationRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PInvitationRes. */
+
+#define SigIeP2PInvitationRes ( 0x0056 )
+
+
+    static const tTLVDefn TLVS_P2PNoticeOfAbsence[ ] = {
+        {offsetof(tDot11fIEP2PNoticeOfAbsence, NoticeOfAbsence), offsetof(tDot11fTLVNoticeOfAbsence, present), "NoticeOfAbsence", SigTlvNoticeOfAbsence, DOT11F_TLV_NOTICEOFABSENCE, 0, 5, 41, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PNoticeOfAbsence(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PNoticeOfAbsence *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PNoticeOfAbsence,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PNoticeOfAbsence. */
+
+#define SigIeP2PNoticeOfAbsence ( 0x0057 )
+
+
+    static const tTLVDefn TLVS_P2PPresenceResponse[ ] = {
+        {offsetof(tDot11fIEP2PPresenceResponse, P2PStatus), offsetof(tDot11fTLVP2PStatus, present), "P2PStatus", SigTlvP2PStatus, DOT11F_TLV_P2PSTATUS, 0, 4, 4, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PPresenceResponse, NoticeOfAbsence), offsetof(tDot11fTLVNoticeOfAbsence, present), "NoticeOfAbsence", SigTlvNoticeOfAbsence, DOT11F_TLV_NOTICEOFABSENCE, 0, 5, 41, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PPresenceResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PPresenceResponse *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PPresenceResponse,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PPresenceResponse. */
+
+#define SigIeP2PPresenceResponse ( 0x0058 )
+
+
+    static const tTLVDefn TLVS_P2PProbeReq[ ] = {
+        {offsetof(tDot11fIEP2PProbeReq, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeReq, P2PDeviceId), offsetof(tDot11fTLVP2PDeviceId, present), "P2PDeviceId", SigTlvP2PDeviceId, DOT11F_TLV_P2PDEVICEID, 0, 9, 9, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeReq, ListenChannel), offsetof(tDot11fTLVListenChannel, present), "ListenChannel", SigTlvListenChannel, DOT11F_TLV_LISTENCHANNEL, 0, 8, 8, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeReq, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeReq, OperatingChannel), offsetof(tDot11fTLVOperatingChannel, present), "OperatingChannel", SigTlvOperatingChannel, DOT11F_TLV_OPERATINGCHANNEL, 0, 8, 8, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PProbeReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PProbeReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PProbeReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PProbeReq. */
+
+#define SigIeP2PProbeReq ( 0x0059 )
+
+
+    static const tTLVDefn TLVS_P2PProbeRes[ ] = {
+        {offsetof(tDot11fIEP2PProbeRes, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeRes, ExtendedListenTiming), offsetof(tDot11fTLVExtendedListenTiming, present), "ExtendedListenTiming", SigTlvExtendedListenTiming, DOT11F_TLV_EXTENDEDLISTENTIMING, 0, 7, 7, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeRes, NoticeOfAbsence), offsetof(tDot11fTLVNoticeOfAbsence, present), "NoticeOfAbsence", SigTlvNoticeOfAbsence, DOT11F_TLV_NOTICEOFABSENCE, 0, 5, 41, 0, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeRes, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProbeRes, P2PGroupInfo), offsetof(tDot11fTLVP2PGroupInfo, present), "P2PGroupInfo", SigTlvP2PGroupInfo, DOT11F_TLV_P2PGROUPINFO, 0, 3, 1027, 0, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PProbeRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PProbeRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PProbeRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PProbeRes. */
+
+#define SigIeP2PProbeRes ( 0x005a )
+
+
+    static const tTLVDefn TLVS_P2PProvisionDiscoveryReq[ ] = {
+        {offsetof(tDot11fIEP2PProvisionDiscoveryReq, P2PCapability), offsetof(tDot11fTLVP2PCapability, present), "P2PCapability", SigTlvP2PCapability, DOT11F_TLV_P2PCAPABILITY, 0, 5, 5, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProvisionDiscoveryReq, P2PDeviceInfo), offsetof(tDot11fTLVP2PDeviceInfo, present), "P2PDeviceInfo", SigTlvP2PDeviceInfo, DOT11F_TLV_P2PDEVICEINFO, 0, 19, 55, 1, 1, 2, 0, },
+        {offsetof(tDot11fIEP2PProvisionDiscoveryReq, P2PGroupId), offsetof(tDot11fTLVP2PGroupId, present), "P2PGroupId", SigTlvP2PGroupId, DOT11F_TLV_P2PGROUPID, 0, 9, 41, 1, 1, 2, 0, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PProvisionDiscoveryReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PProvisionDiscoveryReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PProvisionDiscoveryReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PProvisionDiscoveryReq. */
+
+#define SigIeP2PProvisionDiscoveryReq ( 0x005b )
+
+
+    static const tTLVDefn TLVS_P2PWSCProvisionDiscoveryRes[ ] = {
+        {offsetof(tDot11fIEP2PWSCProvisionDiscoveryRes, ConfigMethods), offsetof(tDot11fTLVConfigMethods, present), "ConfigMethods", SigTlvConfigMethods, DOT11F_TLV_CONFIGMETHODS, 0, 6, 6, 1, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeP2PWSCProvisionDiscoveryRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEP2PWSCProvisionDiscoveryRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_P2PWSCProvisionDiscoveryRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeP2PWSCProvisionDiscoveryRes. */
+
+#define SigIeP2PWSCProvisionDiscoveryRes ( 0x005c )
+
+
+tANI_U32 dot11fUnpackIePowerCaps(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPowerCaps *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->minTxPower = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->maxTxPower = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePowerCaps. */
+
+#define SigIePowerCaps ( 0x005d )
+
+
+tANI_U32 dot11fUnpackIePowerConstraints(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEPowerConstraints *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->localPowerConstraints = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIePowerConstraints. */
+
+#define SigIePowerConstraints ( 0x005e )
+
+
+tANI_U32 dot11fUnpackIeQBSSLoad(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEQBSSLoad *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->stacount, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    pDst->chautil = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->avail, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeQBSSLoad. */
+
+#define SigIeQBSSLoad ( 0x005f )
+
+
+tANI_U32 dot11fUnpackIeQOSCapsAp(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEQOSCapsAp *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp57__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    tmp57__ = *pBuf;
+    pDst->reserved = tmp57__ >> 0 & 0x1;
+    pDst->txopreq = tmp57__ >> 1 & 0x1;
+    pDst->qreq = tmp57__ >> 2 & 0x1;
+    pDst->qack = tmp57__ >> 3 & 0x1;
+    pDst->count = tmp57__ >> 4 & 0xf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeQOSCapsAp. */
+
+#define SigIeQOSCapsAp ( 0x0060 )
+
+
+tANI_U32 dot11fUnpackIeQOSCapsStation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEQOSCapsStation *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp58__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    tmp58__ = *pBuf;
+    pDst->more_data_ack = tmp58__ >> 0 & 0x1;
+    pDst->max_sp_length = tmp58__ >> 1 & 0x3;
+    pDst->qack = tmp58__ >> 3 & 0x1;
+    pDst->acbe_uapsd = tmp58__ >> 4 & 0x1;
+    pDst->acbk_uapsd = tmp58__ >> 5 & 0x1;
+    pDst->acvi_uapsd = tmp58__ >> 6 & 0x1;
+    pDst->acvo_uapsd = tmp58__ >> 7 & 0x1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeQOSCapsStation. */
+
+#define SigIeQOSCapsStation ( 0x0061 )
+
+
+tANI_U32 dot11fUnpackIeQuiet(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEQuiet *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->count = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->period = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    framesntohs(pCtx, &pDst->duration, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    framesntohs(pCtx, &pDst->offset, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeQuiet. */
+
+#define SigIeQuiet ( 0x0062 )
+
+
+tANI_U32 dot11fUnpackIeRCPIIE(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERCPIIE *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->rcpi = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRCPIIE. */
+
+#define SigIeRCPIIE ( 0x0063 )
+
+
+    static const tFFDefn FFS_RICDataDesc[ ] = {
+        { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_RICDataDesc[ ] = {
+        {offsetof(tDot11fIERICDataDesc, RICData), offsetof(tDot11fIERICData, present), 0, "RICData" , 0, 6, 6, SigIeRICData, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDATA, 1, },
+        {offsetof(tDot11fIERICDataDesc, RICDescriptor), offsetof(tDot11fIERICDescriptor, present), 0, "RICDescriptor" , 0, 3, 258, SigIeRICDescriptor, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDESCRIPTOR, 0, },
+        {offsetof(tDot11fIERICDataDesc, TSPEC), offsetof(tDot11fIETSPEC, present), 0, "TSPEC" , 0, 57, 57, SigIeTSPEC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSPEC, 0, },
+        {offsetof(tDot11fIERICDataDesc, TCLAS), offsetof(tDot11fIETCLAS, present), offsetof(tDot11fIERICDataDesc, num_TCLAS), "TCLAS" , 2, 7, 45, SigIeTCLAS, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLAS, 0, },
+        {offsetof(tDot11fIERICDataDesc, TCLASSPROC), offsetof(tDot11fIETCLASSPROC, present), 0, "TCLASSPROC" , 0, 3, 3, SigIeTCLASSPROC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLASSPROC, 0, },
+        {offsetof(tDot11fIERICDataDesc, TSDelay), offsetof(tDot11fIETSDelay, present), 0, "TSDelay" , 0, 6, 6, SigIeTSDelay, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSDELAY, 0, },
+        {offsetof(tDot11fIERICDataDesc, Schedule), offsetof(tDot11fIESchedule, present), 0, "Schedule" , 0, 16, 16, SigIeSchedule, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SCHEDULE, 0, },
+        {offsetof(tDot11fIERICDataDesc, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fIERICDataDesc, WMMTCLAS), offsetof(tDot11fIEWMMTCLAS, present), offsetof(tDot11fIERICDataDesc, num_WMMTCLAS), "WMMTCLAS" , 2, 13, 51, SigIeWMMTCLAS, {0, 80, 242, 2, 6}, 5, DOT11F_EID_WMMTCLAS, 0, },
+        {offsetof(tDot11fIERICDataDesc, WMMTCLASPROC), offsetof(tDot11fIEWMMTCLASPROC, present), 0, "WMMTCLASPROC" , 0, 9, 9, SigIeWMMTCLASPROC, {0, 80, 242, 2, 7}, 5, DOT11F_EID_WMMTCLASPROC, 0, },
+        {offsetof(tDot11fIERICDataDesc, WMMTSDelay), offsetof(tDot11fIEWMMTSDelay, present), 0, "WMMTSDelay" , 0, 12, 12, SigIeWMMTSDelay, {0, 80, 242, 2, 8}, 5, DOT11F_EID_WMMTSDELAY, 0, },
+        {offsetof(tDot11fIERICDataDesc, WMMSchedule), offsetof(tDot11fIEWMMSchedule, present), 0, "WMMSchedule" , 0, 22, 22, SigIeWMMSchedule, {0, 80, 242, 2, 9}, 5, DOT11F_EID_WMMSCHEDULE, 0, },
+        {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },
+    };
+
+tANI_U32 dot11fUnpackIeRICDataDesc(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERICDataDesc *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    (void)pCtx;
+    status |= UnpackCore(pCtx,
+                     pBuf,
+                     ielen,
+                     FFS_RICDataDesc,
+                     IES_RICDataDesc,
+                     ( tANI_U8* )pDst,
+                     sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeRICDataDesc. */
+
+#define SigIeRICDataDesc ( 0x0064 )
+
+
+tANI_U32 dot11fUnpackIeRSN(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERSN *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp59__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->version, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    DOT11F_MEMCPY(pCtx, pDst->gp_cipher_suite, pBuf, 4);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    if ( ! ielen )
+    {
+        pDst->pwise_cipher_suite_count = 0U;
+        pDst->akm_suite_count = 0U;
+        pDst->pmkid_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->pwise_cipher_suite_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->pwise_cipher_suite_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->pwise_cipher_suites, pBuf, ( pDst->pwise_cipher_suite_count * 4 ) );
+    pBuf += ( pDst->pwise_cipher_suite_count * 4 );
+    ielen -= ( pDst->pwise_cipher_suite_count * 4 );
+    if ( ! ielen )
+    {
+        pDst->akm_suite_count = 0U;
+        pDst->pmkid_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->akm_suite_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->akm_suite_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->akm_suites, pBuf, ( pDst->akm_suite_count * 4 ) );
+    pBuf += ( pDst->akm_suite_count * 4 );
+    ielen -= ( pDst->akm_suite_count * 4 );
+    framesntohs(pCtx, &tmp59__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->preauth = tmp59__ >> 0 & 0x1;
+    pDst->no_pwise = tmp59__ >> 1 & 0x1;
+    pDst->PTKSA_replay_counter = tmp59__ >> 2 & 0x3;
+    pDst->GTKSA_replay_counter = tmp59__ >> 4 & 0x3;
+    pDst->reserved = tmp59__ >> 6 & 0x3ff;
+    if ( ! ielen )
+    {
+        pDst->pmkid_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->pmkid_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->pmkid_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->pmkid, pBuf, ( pDst->pmkid_count * 16 ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRSN. */
+
+#define SigIeRSN ( 0x0065 )
+
+
+tANI_U32 dot11fUnpackIeRSNIIE(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERSNIIE *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->rsni = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRSNIIE. */
+
+#define SigIeRSNIIE ( 0x0066 )
+
+
+tANI_U32 dot11fUnpackIeRSNOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIERSNOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 253){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeRSNOpaque. */
+
+#define SigIeRSNOpaque ( 0x0067 )
+
+
+tANI_U32 dot11fUnpackIeSuppChannels(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIESuppChannels *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_bands = (tANI_U8)( ielen / 2 );
+    if (ielen / 2 > 48){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->bands, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeSuppChannels. */
+
+#define SigIeSuppChannels ( 0x0068 )
+
+
+tANI_U32 dot11fUnpackIeSuppRates(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIESuppRates *pDst)
+{
+    tANI_U8 i;
+    tANI_U8 rate_indx = 0;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    for (i = 0; i < ielen; i++) {
+        if ((DOT11F_IS_BG_RATE(pBuf[i] & 0x7F)) && 
+            (rate_indx < 12)) {
+            pDst->rates[rate_indx++] = pBuf[i];
+        }
+    }
+
+    if(rate_indx == 0) {
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    pDst->num_rates = rate_indx;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeSuppRates. */
+
+#define SigIeSuppRates ( 0x0069 )
+
+
+tANI_U32 dot11fUnpackIeTIM(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETIM *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->dtim_count = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->dtim_period = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->bmpctl = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->num_vbmp = (tANI_U8)( ielen );
+    if (ielen > 251){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->vbmp, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTIM. */
+
+#define SigIeTIM ( 0x006a )
+
+
+tANI_U32 dot11fUnpackIeTPCReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETPCReport *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->tx_power = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->link_margin = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTPCReport. */
+
+#define SigIeTPCReport ( 0x006b )
+
+
+tANI_U32 dot11fUnpackIeTPCRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIETPCRequest *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeTPCRequest. */
+
+#define SigIeTPCRequest ( 0x006c )
+
+
+tANI_U32 dot11fUnpackIeWAPI(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWAPI *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U16 tmp60__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->version, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    framesntohs(pCtx, &pDst->akm_suite_count, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    if (pDst->akm_suite_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->akm_suites, pBuf, ( pDst->akm_suite_count * 4 ) );
+    pBuf += ( pDst->akm_suite_count * 4 );
+    ielen -= ( pDst->akm_suite_count * 4 );
+    framesntohs(pCtx, &pDst->unicast_cipher_suite_count, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    if (pDst->unicast_cipher_suite_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->unicast_cipher_suites, pBuf, ( pDst->unicast_cipher_suite_count * 4 ) );
+    pBuf += ( pDst->unicast_cipher_suite_count * 4 );
+    ielen -= ( pDst->unicast_cipher_suite_count * 4 );
+    DOT11F_MEMCPY(pCtx, pDst->multicast_cipher_suite, pBuf, 4);
+    pBuf += 4;
+    ielen -= (tANI_U8)4;
+    framesntohs(pCtx, &tmp60__, pBuf, 0);
+    pBuf += 2;
+    ielen -= 2;
+    pDst->preauth = tmp60__ >> 0 & 0x1;
+    pDst->reserved = tmp60__ >> 1 & 0x7fff;
+    if ( ! ielen )
+    {
+        pDst->bkid_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->bkid_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->bkid_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->bkid, pBuf, ( pDst->bkid_count * 16 ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWAPI. */
+
+#define SigIeWAPI ( 0x006d )
+
+
+tANI_U32 dot11fUnpackIeWAPIOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWAPIOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 253){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWAPIOpaque. */
+
+#define SigIeWAPIOpaque ( 0x006e )
+
+
+tANI_U32 dot11fUnpackIeWFATPC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWFATPC *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->txPower = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->linkMargin = *pBuf;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWFATPC. */
+
+#define SigIeWFATPC ( 0x006f )
+
+
+tANI_U32 dot11fUnpackIeWMMCaps(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMCaps *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp61__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    tmp61__ = *pBuf;
+    pDst->reserved = tmp61__ >> 0 & 0xf;
+    pDst->qack = tmp61__ >> 4 & 0x1;
+    pDst->queue_request = tmp61__ >> 5 & 0x1;
+    pDst->txop_request = tmp61__ >> 6 & 0x1;
+    pDst->more_ack = tmp61__ >> 7 & 0x1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMCaps. */
+
+#define SigIeWMMCaps ( 0x0070 )
+
+
+tANI_U32 dot11fUnpackIeWMMInfoAp(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMInfoAp *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp62__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp62__ = *pBuf;
+    pDst->param_set_count = tmp62__ >> 0 & 0xf;
+    pDst->reserved = tmp62__ >> 4 & 0x7;
+    pDst->uapsd = tmp62__ >> 7 & 0x1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMInfoAp. */
+
+#define SigIeWMMInfoAp ( 0x0071 )
+
+
+tANI_U32 dot11fUnpackIeWMMInfoStation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMInfoStation *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp63__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp63__ = *pBuf;
+    pDst->acvo_uapsd = tmp63__ >> 0 & 0x1;
+    pDst->acvi_uapsd = tmp63__ >> 1 & 0x1;
+    pDst->acbk_uapsd = tmp63__ >> 2 & 0x1;
+    pDst->acbe_uapsd = tmp63__ >> 3 & 0x1;
+    pDst->reserved1 = tmp63__ >> 4 & 0x1;
+    pDst->max_sp_length = tmp63__ >> 5 & 0x3;
+    pDst->reserved2 = tmp63__ >> 7 & 0x1;
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMInfoStation. */
+
+#define SigIeWMMInfoStation ( 0x0072 )
+
+
+tANI_U32 dot11fUnpackIeWMMParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMParams *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp64__;
+    tANI_U8 tmp65__;
+    tANI_U8 tmp66__;
+    tANI_U8 tmp67__;
+    tANI_U8 tmp68__;
+    tANI_U8 tmp69__;
+    tANI_U8 tmp70__;
+    tANI_U8 tmp71__;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->version = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    pDst->qosInfo = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    pDst->reserved2 = *pBuf;
+    pBuf += 1;
+    ielen -= (tANI_U8)1;
+    tmp64__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_aifsn = tmp64__ >> 0 & 0xf;
+    pDst->acbe_acm = tmp64__ >> 4 & 0x1;
+    pDst->acbe_aci = tmp64__ >> 5 & 0x3;
+    pDst->unused1 = tmp64__ >> 7 & 0x1;
+    tmp65__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbe_acwmin = tmp65__ >> 0 & 0xf;
+    pDst->acbe_acwmax = tmp65__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbe_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp66__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_aifsn = tmp66__ >> 0 & 0xf;
+    pDst->acbk_acm = tmp66__ >> 4 & 0x1;
+    pDst->acbk_aci = tmp66__ >> 5 & 0x3;
+    pDst->unused2 = tmp66__ >> 7 & 0x1;
+    tmp67__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acbk_acwmin = tmp67__ >> 0 & 0xf;
+    pDst->acbk_acwmax = tmp67__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acbk_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp68__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_aifsn = tmp68__ >> 0 & 0xf;
+    pDst->acvi_acm = tmp68__ >> 4 & 0x1;
+    pDst->acvi_aci = tmp68__ >> 5 & 0x3;
+    pDst->unused3 = tmp68__ >> 7 & 0x1;
+    tmp69__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvi_acwmin = tmp69__ >> 0 & 0xf;
+    pDst->acvi_acwmax = tmp69__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvi_txoplimit, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    tmp70__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_aifsn = tmp70__ >> 0 & 0xf;
+    pDst->acvo_acm = tmp70__ >> 4 & 0x1;
+    pDst->acvo_aci = tmp70__ >> 5 & 0x3;
+    pDst->unused4 = tmp70__ >> 7 & 0x1;
+    tmp71__ = *pBuf;
+    pBuf += 1;
+    ielen -= 1;
+    pDst->acvo_acwmin = tmp71__ >> 0 & 0xf;
+    pDst->acvo_acwmax = tmp71__ >> 4 & 0xf;
+    framesntohs(pCtx, &pDst->acvo_txoplimit, pBuf, 0);
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWMMParams. */
+
+#define SigIeWMMParams ( 0x0073 )
+
+
+tANI_U32 dot11fUnpackIeWPA(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWPA *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    framesntohs(pCtx, &pDst->version, pBuf, 0);
+    pBuf += 2;
+    ielen -= (tANI_U8)2;
+    if (pDst->version != 0x1)
+    {
+            pDst->present = 0;
+            return ( status | DOT11F_BAD_FIXED_VALUE );
+    }
+    if ( ! ielen )
+    {
+        pDst->multicast_cipher_present = 0U;
+        pDst->unicast_cipher_count = 0U;
+        pDst->auth_suite_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        pDst->multicast_cipher_present = 1U;
+        DOT11F_MEMCPY(pCtx, pDst->multicast_cipher, pBuf, 4);
+        pBuf += 4;
+        ielen -= (tANI_U8)4;
+    }
+    if ( ! ielen )
+    {
+        pDst->unicast_cipher_count = 0U;
+        pDst->auth_suite_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->unicast_cipher_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->unicast_cipher_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->unicast_ciphers, pBuf, ( pDst->unicast_cipher_count * 4 ) );
+    pBuf += ( pDst->unicast_cipher_count * 4 );
+    ielen -= ( pDst->unicast_cipher_count * 4 );
+    if ( ! ielen )
+    {
+        pDst->auth_suite_count = 0U;
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->auth_suite_count, pBuf, 0);
+        pBuf += 2;
+        ielen -= (tANI_U8)2;
+    }
+    if (pDst->auth_suite_count > 4){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->auth_suites, pBuf, ( pDst->auth_suite_count * 4 ) );
+    pBuf += ( pDst->auth_suite_count * 4 );
+    ielen -= ( pDst->auth_suite_count * 4 );
+    if ( ! ielen )
+    {
+        return 0U;
+    }
+    else
+    {
+        framesntohs(pCtx, &pDst->caps, pBuf, 0);
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWPA. */
+
+#define SigIeWPA ( 0x0074 )
+
+
+tANI_U32 dot11fUnpackIeWPAOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWPAOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 249){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWPAOpaque. */
+
+#define SigIeWPAOpaque ( 0x0075 )
+
+
+    static const tTLVDefn TLVS_WSC[ ] = {
+        {offsetof(tDot11fIEWSC, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, WPSState), offsetof(tDot11fTLVWPSState, present), "WPSState", SigTlvWPSState, DOT11F_TLV_WPSSTATE, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, APSetupLocked), offsetof(tDot11fTLVAPSetupLocked, present), "APSetupLocked", SigTlvAPSetupLocked, DOT11F_TLV_APSETUPLOCKED, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, SelectedRegistrarConfigMethods), offsetof(tDot11fTLVSelectedRegistrarConfigMethods, present), "SelectedRegistrarConfigMethods", SigTlvSelectedRegistrarConfigMethods, DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, UUID_E), offsetof(tDot11fTLVUUID_E, present), "UUID_E", SigTlvUUID_E, DOT11F_TLV_UUID_E, 0, 20, 20, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, UUID_R), offsetof(tDot11fTLVUUID_R, present), "UUID_R", SigTlvUUID_R, DOT11F_TLV_UUID_R, 0, 20, 20, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, RFBands), offsetof(tDot11fTLVRFBands, present), "RFBands", SigTlvRFBands, DOT11F_TLV_RFBANDS, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, SelectedRegistrar), offsetof(tDot11fTLVSelectedRegistrar, present), "SelectedRegistrar", SigTlvSelectedRegistrar, DOT11F_TLV_SELECTEDREGISTRAR, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, ConfigMethods), offsetof(tDot11fTLVConfigMethods, present), "ConfigMethods", SigTlvConfigMethods, DOT11F_TLV_CONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, AssociationState), offsetof(tDot11fTLVAssociationState, present), "AssociationState", SigTlvAssociationState, DOT11F_TLV_ASSOCIATIONSTATE, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, ConfigurationError), offsetof(tDot11fTLVConfigurationError, present), "ConfigurationError", SigTlvConfigurationError, DOT11F_TLV_CONFIGURATIONERROR, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, Manufacturer), offsetof(tDot11fTLVManufacturer, present), "Manufacturer", SigTlvManufacturer, DOT11F_TLV_MANUFACTURER, 0, 4, 68, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, ModelName), offsetof(tDot11fTLVModelName, present), "ModelName", SigTlvModelName, DOT11F_TLV_MODELNAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, ModelNumber), offsetof(tDot11fTLVModelNumber, present), "ModelNumber", SigTlvModelNumber, DOT11F_TLV_MODELNUMBER, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, SerialNumber), offsetof(tDot11fTLVSerialNumber, present), "SerialNumber", SigTlvSerialNumber, DOT11F_TLV_SERIALNUMBER, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, DeviceName), offsetof(tDot11fTLVDeviceName, present), "DeviceName", SigTlvDeviceName, DOT11F_TLV_DEVICENAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, PrimaryDeviceType), offsetof(tDot11fTLVPrimaryDeviceType, present), "PrimaryDeviceType", SigTlvPrimaryDeviceType, DOT11F_TLV_PRIMARYDEVICETYPE, 0, 12, 12, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, RequestType), offsetof(tDot11fTLVRequestType, present), "RequestType", SigTlvRequestType, DOT11F_TLV_REQUESTTYPE, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, ResponseType), offsetof(tDot11fTLVResponseType, present), "ResponseType", SigTlvResponseType, DOT11F_TLV_RESPONSETYPE, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWSC, RequestDeviceType), offsetof(tDot11fTLVRequestDeviceType, present), "RequestDeviceType", SigTlvRequestDeviceType, DOT11F_TLV_REQUESTDEVICETYPE, 0, 12, 12, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWSC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWSC *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WSC,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWSC. */
+
+#define SigIeWSC ( 0x0076 )
+
+
+    static const tTLVDefn TLVS_WscAssocReq[ ] = {
+        {offsetof(tDot11fIEWscAssocReq, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscAssocReq, RequestType), offsetof(tDot11fTLVRequestType, present), "RequestType", SigTlvRequestType, DOT11F_TLV_REQUESTTYPE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscAssocReq, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscAssocReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscAssocReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscAssocReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscAssocReq. */
+
+#define SigIeWscAssocReq ( 0x0077 )
+
+
+    static const tTLVDefn TLVS_WscAssocRes[ ] = {
+        {offsetof(tDot11fIEWscAssocRes, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscAssocRes, ResponseType), offsetof(tDot11fTLVResponseType, present), "ResponseType", SigTlvResponseType, DOT11F_TLV_RESPONSETYPE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscAssocRes, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscAssocRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscAssocRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscAssocRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscAssocRes. */
+
+#define SigIeWscAssocRes ( 0x0078 )
+
+
+    static const tTLVDefn TLVS_WscBeacon[ ] = {
+        {offsetof(tDot11fIEWscBeacon, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, WPSState), offsetof(tDot11fTLVWPSState, present), "WPSState", SigTlvWPSState, DOT11F_TLV_WPSSTATE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, APSetupLocked), offsetof(tDot11fTLVAPSetupLocked, present), "APSetupLocked", SigTlvAPSetupLocked, DOT11F_TLV_APSETUPLOCKED, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, SelectedRegistrar), offsetof(tDot11fTLVSelectedRegistrar, present), "SelectedRegistrar", SigTlvSelectedRegistrar, DOT11F_TLV_SELECTEDREGISTRAR, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, SelectedRegistrarConfigMethods), offsetof(tDot11fTLVSelectedRegistrarConfigMethods, present), "SelectedRegistrarConfigMethods", SigTlvSelectedRegistrarConfigMethods, DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, UUID_E), offsetof(tDot11fTLVUUID_E, present), "UUID_E", SigTlvUUID_E, DOT11F_TLV_UUID_E, 0, 20, 20, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, RFBands), offsetof(tDot11fTLVRFBands, present), "RFBands", SigTlvRFBands, DOT11F_TLV_RFBANDS, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeacon, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscBeacon(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscBeacon *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscBeacon,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscBeacon. */
+
+#define SigIeWscBeacon ( 0x0079 )
+
+
+    static const tTLVDefn TLVS_WscBeaconProbeRes[ ] = {
+        {offsetof(tDot11fIEWscBeaconProbeRes, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, WPSState), offsetof(tDot11fTLVWPSState, present), "WPSState", SigTlvWPSState, DOT11F_TLV_WPSSTATE, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, APSetupLocked), offsetof(tDot11fTLVAPSetupLocked, present), "APSetupLocked", SigTlvAPSetupLocked, DOT11F_TLV_APSETUPLOCKED, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, SelectedRegistrar), offsetof(tDot11fTLVSelectedRegistrar, present), "SelectedRegistrar", SigTlvSelectedRegistrar, DOT11F_TLV_SELECTEDREGISTRAR, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, SelectedRegistrarConfigMethods), offsetof(tDot11fTLVSelectedRegistrarConfigMethods, present), "SelectedRegistrarConfigMethods", SigTlvSelectedRegistrarConfigMethods, DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, ResponseType), offsetof(tDot11fTLVResponseType, present), "ResponseType", SigTlvResponseType, DOT11F_TLV_RESPONSETYPE, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, UUID_E), offsetof(tDot11fTLVUUID_E, present), "UUID_E", SigTlvUUID_E, DOT11F_TLV_UUID_E, 0, 20, 20, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, Manufacturer), offsetof(tDot11fTLVManufacturer, present), "Manufacturer", SigTlvManufacturer, DOT11F_TLV_MANUFACTURER, 0, 4, 68, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, ModelName), offsetof(tDot11fTLVModelName, present), "ModelName", SigTlvModelName, DOT11F_TLV_MODELNAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, ModelNumber), offsetof(tDot11fTLVModelNumber, present), "ModelNumber", SigTlvModelNumber, DOT11F_TLV_MODELNUMBER, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, SerialNumber), offsetof(tDot11fTLVSerialNumber, present), "SerialNumber", SigTlvSerialNumber, DOT11F_TLV_SERIALNUMBER, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, PrimaryDeviceType), offsetof(tDot11fTLVPrimaryDeviceType, present), "PrimaryDeviceType", SigTlvPrimaryDeviceType, DOT11F_TLV_PRIMARYDEVICETYPE, 0, 12, 12, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, DeviceName), offsetof(tDot11fTLVDeviceName, present), "DeviceName", SigTlvDeviceName, DOT11F_TLV_DEVICENAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, ConfigMethods), offsetof(tDot11fTLVConfigMethods, present), "ConfigMethods", SigTlvConfigMethods, DOT11F_TLV_CONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, RFBands), offsetof(tDot11fTLVRFBands, present), "RFBands", SigTlvRFBands, DOT11F_TLV_RFBANDS, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscBeaconProbeRes, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscBeaconProbeRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscBeaconProbeRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscBeaconProbeRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscBeaconProbeRes. */
+
+#define SigIeWscBeaconProbeRes ( 0x007a )
+
+
+tANI_U32 dot11fUnpackIeWscIEOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscIEOpaque *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void) pBuf; (void)ielen; /* Shutup the compiler */
+    if (pDst->present) status = DOT11F_DUPLICATE_IE;
+    pDst->present = 1;
+    pDst->num_data = (tANI_U8)( ielen );
+    if (ielen > 249){
+        pDst->present = 0;
+        return DOT11F_SKIPPED_BAD_IE;
+    }
+
+    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
+    (void)pCtx;
+    return status;
+} /* End dot11fUnpackIeWscIEOpaque. */
+
+#define SigIeWscIEOpaque ( 0x007b )
+
+
+    static const tTLVDefn TLVS_WscProbeReq[ ] = {
+        {offsetof(tDot11fIEWscProbeReq, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, RequestType), offsetof(tDot11fTLVRequestType, present), "RequestType", SigTlvRequestType, DOT11F_TLV_REQUESTTYPE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, ConfigMethods), offsetof(tDot11fTLVConfigMethods, present), "ConfigMethods", SigTlvConfigMethods, DOT11F_TLV_CONFIGMETHODS, 0, 6, 6, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, UUID_E), offsetof(tDot11fTLVUUID_E, present), "UUID_E", SigTlvUUID_E, DOT11F_TLV_UUID_E, 0, 20, 20, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, PrimaryDeviceType), offsetof(tDot11fTLVPrimaryDeviceType, present), "PrimaryDeviceType", SigTlvPrimaryDeviceType, DOT11F_TLV_PRIMARYDEVICETYPE, 0, 12, 12, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, RFBands), offsetof(tDot11fTLVRFBands, present), "RFBands", SigTlvRFBands, DOT11F_TLV_RFBANDS, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, AssociationState), offsetof(tDot11fTLVAssociationState, present), "AssociationState", SigTlvAssociationState, DOT11F_TLV_ASSOCIATIONSTATE, 0, 6, 6, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, ConfigurationError), offsetof(tDot11fTLVConfigurationError, present), "ConfigurationError", SigTlvConfigurationError, DOT11F_TLV_CONFIGURATIONERROR, 0, 6, 6, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, Manufacturer), offsetof(tDot11fTLVManufacturer, present), "Manufacturer", SigTlvManufacturer, DOT11F_TLV_MANUFACTURER, 0, 4, 68, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, ModelName), offsetof(tDot11fTLVModelName, present), "ModelName", SigTlvModelName, DOT11F_TLV_MODELNAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, ModelNumber), offsetof(tDot11fTLVModelNumber, present), "ModelNumber", SigTlvModelNumber, DOT11F_TLV_MODELNUMBER, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, DeviceName), offsetof(tDot11fTLVDeviceName, present), "DeviceName", SigTlvDeviceName, DOT11F_TLV_DEVICENAME, 0, 4, 36, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeReq, RequestDeviceType), offsetof(tDot11fTLVRequestDeviceType, present), "RequestDeviceType", SigTlvRequestDeviceType, DOT11F_TLV_REQUESTDEVICETYPE, 0, 12, 12, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscProbeReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscProbeReq *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscProbeReq,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscProbeReq. */
+
+#define SigIeWscProbeReq ( 0x007c )
+
+
+    static const tTLVDefn TLVS_WscProbeRes[ ] = {
+        {offsetof(tDot11fIEWscProbeRes, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, WPSState), offsetof(tDot11fTLVWPSState, present), "WPSState", SigTlvWPSState, DOT11F_TLV_WPSSTATE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, APSetupLocked), offsetof(tDot11fTLVAPSetupLocked, present), "APSetupLocked", SigTlvAPSetupLocked, DOT11F_TLV_APSETUPLOCKED, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, SelectedRegistrar), offsetof(tDot11fTLVSelectedRegistrar, present), "SelectedRegistrar", SigTlvSelectedRegistrar, DOT11F_TLV_SELECTEDREGISTRAR, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, DevicePasswordID), offsetof(tDot11fTLVDevicePasswordID, present), "DevicePasswordID", SigTlvDevicePasswordID, DOT11F_TLV_DEVICEPASSWORDID, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, SelectedRegistrarConfigMethods), offsetof(tDot11fTLVSelectedRegistrarConfigMethods, present), "SelectedRegistrarConfigMethods", SigTlvSelectedRegistrarConfigMethods, DOT11F_TLV_SELECTEDREGISTRARCONFIGMETHODS, 0, 6, 6, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, ResponseType), offsetof(tDot11fTLVResponseType, present), "ResponseType", SigTlvResponseType, DOT11F_TLV_RESPONSETYPE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, UUID_E), offsetof(tDot11fTLVUUID_E, present), "UUID_E", SigTlvUUID_E, DOT11F_TLV_UUID_E, 0, 20, 20, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, Manufacturer), offsetof(tDot11fTLVManufacturer, present), "Manufacturer", SigTlvManufacturer, DOT11F_TLV_MANUFACTURER, 0, 4, 68, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, ModelName), offsetof(tDot11fTLVModelName, present), "ModelName", SigTlvModelName, DOT11F_TLV_MODELNAME, 0, 4, 36, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, ModelNumber), offsetof(tDot11fTLVModelNumber, present), "ModelNumber", SigTlvModelNumber, DOT11F_TLV_MODELNUMBER, 0, 4, 36, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, SerialNumber), offsetof(tDot11fTLVSerialNumber, present), "SerialNumber", SigTlvSerialNumber, DOT11F_TLV_SERIALNUMBER, 0, 4, 36, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, PrimaryDeviceType), offsetof(tDot11fTLVPrimaryDeviceType, present), "PrimaryDeviceType", SigTlvPrimaryDeviceType, DOT11F_TLV_PRIMARYDEVICETYPE, 0, 12, 12, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, DeviceName), offsetof(tDot11fTLVDeviceName, present), "DeviceName", SigTlvDeviceName, DOT11F_TLV_DEVICENAME, 0, 4, 36, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, ConfigMethods), offsetof(tDot11fTLVConfigMethods, present), "ConfigMethods", SigTlvConfigMethods, DOT11F_TLV_CONFIGMETHODS, 0, 6, 6, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, RFBands), offsetof(tDot11fTLVRFBands, present), "RFBands", SigTlvRFBands, DOT11F_TLV_RFBANDS, 0, 5, 5, 0, 2, 2, 1, },
+        {offsetof(tDot11fIEWscProbeRes, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscProbeRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscProbeRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscProbeRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscProbeRes. */
+
+#define SigIeWscProbeRes ( 0x007d )
+
+
+    static const tTLVDefn TLVS_WscReassocRes[ ] = {
+        {offsetof(tDot11fIEWscReassocRes, Version), offsetof(tDot11fTLVVersion, present), "Version", SigTlvVersion, DOT11F_TLV_VERSION, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscReassocRes, ResponseType), offsetof(tDot11fTLVResponseType, present), "ResponseType", SigTlvResponseType, DOT11F_TLV_RESPONSETYPE, 0, 5, 5, 1, 2, 2, 1, },
+        {offsetof(tDot11fIEWscReassocRes, VendorExtension), offsetof(tDot11fTLVVendorExtension, present), "VendorExtension", SigTlvVendorExtension, DOT11F_TLV_VENDOREXTENSION, 0, 7, 21, 0, 2, 2, 1, },
+        {0, 0, NULL, 0, 0xffff, 0, 0, 0, 0, 0, 0},
+    };
+
+tANI_U32 dot11fUnpackIeWscReassocRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscReassocRes *pDst)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pBuf; (void)ielen; /* Shutup the compiler */
+    pDst->present = 1;
+    status = UnpackTlvCore(pCtx,pBuf,ielen,TLVS_WscReassocRes,(tANI_U8*)pDst,sizeof(*pDst));
+    return status;
+} /* End dot11fUnpackIeWscReassocRes. */
+
+#define SigIeWscReassocRes ( 0x007e )
+
+
+    static const tFFDefn FFS_AddBAReq[] = {
+        { "Category", offsetof(tDot11fAddBAReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fAddBAReq, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fAddBAReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "AddBAParameterSet", offsetof(tDot11fAddBAReq, AddBAParameterSet), SigFfAddBAParameterSet , DOT11F_FF_ADDBAPARAMETERSET_LEN, },
+        { "BATimeout", offsetof(tDot11fAddBAReq, BATimeout), SigFfBATimeout , DOT11F_FF_BATIMEOUT_LEN, },
+        { "BAStartingSequenceControl", offsetof(tDot11fAddBAReq, BAStartingSequenceControl), SigFfBAStartingSequenceControl , DOT11F_FF_BASTARTINGSEQUENCECONTROL_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AddBAReq[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAddBAReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddBAReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AddBAReq, IES_AddBAReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Unpacked the AddBAReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("AddBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("amsduSupported (1): %d\n"), pFrm->AddBAParameterSet.amsduSupported);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("policy (1): %d\n"), pFrm->AddBAParameterSet.policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("tid (4): %d\n"), pFrm->AddBAParameterSet.tid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("bufferSize (10): %d\n"), pFrm->AddBAParameterSet.bufferSize);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("BATimeout:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->BATimeout.timeout, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("BAStartingSequenceControl:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("fragNumber (4): %d\n"), pFrm->BAStartingSequenceControl.fragNumber);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("ssn (12): %d\n"), pFrm->BAStartingSequenceControl.ssn);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddBAReq. */
+
+    static const tFFDefn FFS_AddBARsp[] = {
+        { "Category", offsetof(tDot11fAddBARsp, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fAddBARsp, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fAddBARsp, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "Status", offsetof(tDot11fAddBARsp, Status), SigFfStatus , DOT11F_FF_STATUS_LEN, },
+        { "AddBAParameterSet", offsetof(tDot11fAddBARsp, AddBAParameterSet), SigFfAddBAParameterSet , DOT11F_FF_ADDBAPARAMETERSET_LEN, },
+        { "BATimeout", offsetof(tDot11fAddBARsp, BATimeout), SigFfBATimeout , DOT11F_FF_BATIMEOUT_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AddBARsp[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAddBARsp(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddBARsp *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AddBARsp, IES_AddBARsp, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Unpacked the AddBARsp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("AddBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("amsduSupported (1): %d\n"), pFrm->AddBAParameterSet.amsduSupported);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("policy (1): %d\n"), pFrm->AddBAParameterSet.policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("tid (4): %d\n"), pFrm->AddBAParameterSet.tid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("bufferSize (10): %d\n"), pFrm->AddBAParameterSet.bufferSize);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("BATimeout:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->BATimeout.timeout, 2);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddBARsp. */
+
+    static const tFFDefn FFS_AddTSRequest[] = {
+        { "Category", offsetof(tDot11fAddTSRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fAddTSRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fAddTSRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AddTSRequest[] = {
+        {offsetof(tDot11fAddTSRequest, TSPEC), offsetof(tDot11fIETSPEC, present), 0, "TSPEC" , 0, 57, 57, SigIeTSPEC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSPEC, 1, },
+        {offsetof(tDot11fAddTSRequest, TCLAS), offsetof(tDot11fIETCLAS, present), offsetof(tDot11fAddTSRequest, num_TCLAS), "TCLAS" , 2, 7, 45, SigIeTCLAS, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLAS, 0, },
+        {offsetof(tDot11fAddTSRequest, TCLASSPROC), offsetof(tDot11fIETCLASSPROC, present), 0, "TCLASSPROC" , 0, 3, 3, SigIeTCLASSPROC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLASSPROC, 0, },
+        {offsetof(tDot11fAddTSRequest, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fAddTSRequest, WMMTCLAS), offsetof(tDot11fIEWMMTCLAS, present), offsetof(tDot11fAddTSRequest, num_WMMTCLAS), "WMMTCLAS" , 2, 13, 51, SigIeWMMTCLAS, {0, 80, 242, 2, 6}, 5, DOT11F_EID_WMMTCLAS, 0, },
+        {offsetof(tDot11fAddTSRequest, WMMTCLASPROC), offsetof(tDot11fIEWMMTCLASPROC, present), 0, "WMMTCLASPROC" , 0, 9, 9, SigIeWMMTCLASPROC, {0, 80, 242, 2, 7}, 5, DOT11F_EID_WMMTCLASPROC, 0, },
+        {offsetof(tDot11fAddTSRequest, CCXTrafStrmRateSet), offsetof(tDot11fIECCXTrafStrmRateSet, present), 0, "CCXTrafStrmRateSet" , 0, 7, 15, SigIeCCXTrafStrmRateSet, {0, 64, 150, 8, 0}, 4, DOT11F_EID_CCXTRAFSTRMRATESET, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAddTSRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddTSRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AddTSRequest, IES_AddTSRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Unpacked the AddTSRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TSPEC:\n"));
+        if (!pFrm->TSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->TSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->TSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->TSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->TSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->TSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->TSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->TSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("schedule (1): %d\n"), pFrm->TSPEC.schedule);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("unused (7): %d\n"), pFrm->TSPEC.unused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->TSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->TSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_TCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TCLAS[%d]:\n"), i);
+            if (!pFrm->TCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].classifier_mask, 1);
+                switch (pFrm->TCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->TCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TCLASSPROC:\n"));
+        if (!pFrm->TCLASSPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLASSPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_WMMTCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTCLAS[%d]:\n"), i);
+            if (!pFrm->WMMTCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].version, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_mask, 1);
+                switch (pFrm->WMMTCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->WMMTCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTCLASPROC:\n"));
+        if (!pFrm->WMMTCLASPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLASPROC.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLASPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddTSRequest. */
+
+    static const tFFDefn FFS_AddTSResponse[] = {
+        { "Category", offsetof(tDot11fAddTSResponse, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fAddTSResponse, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fAddTSResponse, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "Status", offsetof(tDot11fAddTSResponse, Status), SigFfStatus , DOT11F_FF_STATUS_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AddTSResponse[] = {
+        {offsetof(tDot11fAddTSResponse, TSDelay), offsetof(tDot11fIETSDelay, present), 0, "TSDelay" , 0, 6, 6, SigIeTSDelay, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSDELAY, 1, },
+        {offsetof(tDot11fAddTSResponse, TSPEC), offsetof(tDot11fIETSPEC, present), 0, "TSPEC" , 0, 57, 57, SigIeTSPEC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TSPEC, 1, },
+        {offsetof(tDot11fAddTSResponse, TCLAS), offsetof(tDot11fIETCLAS, present), offsetof(tDot11fAddTSResponse, num_TCLAS), "TCLAS" , 2, 7, 45, SigIeTCLAS, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLAS, 0, },
+        {offsetof(tDot11fAddTSResponse, TCLASSPROC), offsetof(tDot11fIETCLASSPROC, present), 0, "TCLASSPROC" , 0, 3, 3, SigIeTCLASSPROC, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TCLASSPROC, 0, },
+        {offsetof(tDot11fAddTSResponse, Schedule), offsetof(tDot11fIESchedule, present), 0, "Schedule" , 0, 16, 16, SigIeSchedule, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SCHEDULE, 0, },
+        {offsetof(tDot11fAddTSResponse, WMMTSDelay), offsetof(tDot11fIEWMMTSDelay, present), 0, "WMMTSDelay" , 0, 12, 12, SigIeWMMTSDelay, {0, 80, 242, 2, 8}, 5, DOT11F_EID_WMMTSDELAY, 0, },
+        {offsetof(tDot11fAddTSResponse, WMMSchedule), offsetof(tDot11fIEWMMSchedule, present), 0, "WMMSchedule" , 0, 22, 22, SigIeWMMSchedule, {0, 80, 242, 2, 9}, 5, DOT11F_EID_WMMSCHEDULE, 0, },
+        {offsetof(tDot11fAddTSResponse, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fAddTSResponse, WMMTCLAS), offsetof(tDot11fIEWMMTCLAS, present), offsetof(tDot11fAddTSResponse, num_WMMTCLAS), "WMMTCLAS" , 2, 13, 51, SigIeWMMTCLAS, {0, 80, 242, 2, 6}, 5, DOT11F_EID_WMMTCLAS, 0, },
+        {offsetof(tDot11fAddTSResponse, WMMTCLASPROC), offsetof(tDot11fIEWMMTCLASPROC, present), 0, "WMMTCLASPROC" , 0, 9, 9, SigIeWMMTCLASPROC, {0, 80, 242, 2, 7}, 5, DOT11F_EID_WMMTCLASPROC, 0, },
+        {offsetof(tDot11fAddTSResponse, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAddTSResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAddTSResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AddTSResponse, IES_AddTSResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Unpacked the AddTSResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TSDelay:\n"));
+        if (!pFrm->TSDelay.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSDelay.delay, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TSPEC:\n"));
+        if (!pFrm->TSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->TSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->TSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->TSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->TSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->TSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->TSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->TSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("schedule (1): %d\n"), pFrm->TSPEC.schedule);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("unused (7): %d\n"), pFrm->TSPEC.unused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->TSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->TSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_TCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+            if (!pFrm->TCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].classifier_mask, 1);
+                switch (pFrm->TCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->TCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TCLASSPROC:\n"));
+        if (!pFrm->TCLASSPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLASSPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Schedule:\n"));
+        if (!pFrm->Schedule.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->Schedule.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->Schedule.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->Schedule.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("reserved (9): %d\n"), pFrm->Schedule.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.service_interval, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.max_service_dur, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.spec_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTSDelay:\n"));
+        if (!pFrm->WMMTSDelay.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSDelay.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSDelay.delay, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMSchedule:\n"));
+        if (!pFrm->WMMSchedule.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMSchedule.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMSchedule.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMSchedule.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("reserved (9): %d\n"), pFrm->WMMSchedule.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.service_interval, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.max_service_dur, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.spec_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_WMMTCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+            if (!pFrm->WMMTCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].version, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_mask, 1);
+                switch (pFrm->WMMTCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->WMMTCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTCLASPROC:\n"));
+        if (!pFrm->WMMTCLASPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLASPROC.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLASPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddTSResponse. */
+
+    static const tFFDefn FFS_AssocRequest[] = {
+        { "Capabilities", offsetof(tDot11fAssocRequest, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+        { "ListenInterval", offsetof(tDot11fAssocRequest, ListenInterval), SigFfListenInterval , DOT11F_FF_LISTENINTERVAL_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AssocRequest[] = {
+        {offsetof(tDot11fAssocRequest, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fAssocRequest, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fAssocRequest, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fAssocRequest, PowerCaps), offsetof(tDot11fIEPowerCaps, present), 0, "PowerCaps" , 0, 4, 4, SigIePowerCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCAPS, 0, },
+        {offsetof(tDot11fAssocRequest, SuppChannels), offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels" , 0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPCHANNELS, 0, },
+        {offsetof(tDot11fAssocRequest, RSNOpaque), offsetof(tDot11fIERSNOpaque, present), 0, "RSNOpaque" , 0, 8, 255, SigIeRSNOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNOPAQUE, 0, },
+        {offsetof(tDot11fAssocRequest, QOSCapsStation), offsetof(tDot11fIEQOSCapsStation, present), 0, "QOSCapsStation" , 0, 3, 3, SigIeQOSCapsStation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QOSCAPSSTATION, 0, },
+        {offsetof(tDot11fAssocRequest, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fAssocRequest, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fAssocRequest, WPAOpaque), offsetof(tDot11fIEWPAOpaque, present), 0, "WPAOpaque" , 0, 8, 255, SigIeWPAOpaque, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPAOPAQUE, 0, },
+        {offsetof(tDot11fAssocRequest, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fAssocRequest, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fAssocRequest, WMMInfoStation), offsetof(tDot11fIEWMMInfoStation, present), 0, "WMMInfoStation" , 0, 9, 9, SigIeWMMInfoStation, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOSTATION, 0, },
+        {offsetof(tDot11fAssocRequest, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fAssocRequest, WscIEOpaque), offsetof(tDot11fIEWscIEOpaque, present), 0, "WscIEOpaque" , 0, 8, 255, SigIeWscIEOpaque, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCIEOPAQUE, 0, },
+        {offsetof(tDot11fAssocRequest, WAPIOpaque), offsetof(tDot11fIEWAPIOpaque, present), 0, "WAPIOpaque" , 0, 8, 255, SigIeWAPIOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPIOPAQUE, 0, },
+        {offsetof(tDot11fAssocRequest, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fAssocRequest, CCXVersion), offsetof(tDot11fIECCXVersion, present), 0, "CCXVersion" , 0, 7, 7, SigIeCCXVersion, {0, 64, 150, 3, 0}, 4, DOT11F_EID_CCXVERSION, 0, },
+        {offsetof(tDot11fAssocRequest, P2PIEOpaque), offsetof(tDot11fIEP2PIEOpaque, present), 0, "P2PIEOpaque" , 0, 8, 255, SigIeP2PIEOpaque, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PIEOPAQUE, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AssocRequest, IES_AssocRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Unpacked the AssocRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ListenInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->ListenInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PowerCaps:\n"));
+        if (!pFrm->PowerCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.minTxPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.maxTxPower, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SuppChannels:\n"));
+        if (!pFrm->SuppChannels.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_bands: %d.\n"), pFrm->SuppChannels.num_bands);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SuppChannels.bands, 2 * pFrm->SuppChannels.num_bands);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("QOSCapsStation:\n"));
+        if (!pFrm->QOSCapsStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("more_data_ack (1): %d\n"), pFrm->QOSCapsStation.more_data_ack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->QOSCapsStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->QOSCapsStation.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvo_uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WPAOpaque:\n"));
+        if (!pFrm->WPAOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WPAOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WPAOpaque.data, pFrm->WPAOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WMMInfoStation:\n"));
+        if (!pFrm->WMMInfoStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->WMMInfoStation.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvo_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (1): %d\n"), pFrm->WMMInfoStation.reserved1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->WMMInfoStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (1): %d\n"), pFrm->WMMInfoStation.reserved2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WscIEOpaque:\n"));
+        if (!pFrm->WscIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WscIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WscIEOpaque.data, pFrm->WscIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WAPIOpaque:\n"));
+        if (!pFrm->WAPIOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WAPIOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WAPIOpaque.data, pFrm->WAPIOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("P2PIEOpaque:\n"));
+        if (!pFrm->P2PIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAssocRequest. */
+
+    static const tFFDefn FFS_AssocResponse[] = {
+        { "Capabilities", offsetof(tDot11fAssocResponse, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+        { "Status", offsetof(tDot11fAssocResponse, Status), SigFfStatus , DOT11F_FF_STATUS_LEN, },
+        { "AID", offsetof(tDot11fAssocResponse, AID), SigFfAID , DOT11F_FF_AID_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_AssocResponse[] = {
+        {offsetof(tDot11fAssocResponse, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fAssocResponse, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fAssocResponse, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fAssocResponse, RCPIIE), offsetof(tDot11fIERCPIIE, present), 0, "RCPIIE" , 0, 3, 3, SigIeRCPIIE, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RCPIIE, 0, },
+        {offsetof(tDot11fAssocResponse, RSNIIE), offsetof(tDot11fIERSNIIE, present), 0, "RSNIIE" , 0, 3, 3, SigIeRSNIIE, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNIIE, 0, },
+        {offsetof(tDot11fAssocResponse, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fAssocResponse, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fAssocResponse, FTInfo), offsetof(tDot11fIEFTInfo, present), 0, "FTInfo" , 0, 84, 187, SigIeFTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FTINFO, 0, },
+        {offsetof(tDot11fAssocResponse, RICDataDesc), offsetof(tDot11fIERICDataDesc, present), offsetof(tDot11fAssocResponse, num_RICDataDesc), "RICDataDesc" , 2, 2, 550, SigIeRICDataDesc, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDATADESC, 0, },
+        {offsetof(tDot11fAssocResponse, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fAssocResponse, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fAssocResponse, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fAssocResponse, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fAssocResponse, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fAssocResponse, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fAssocResponse, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fAssocResponse, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fAssocResponse, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), offsetof(tDot11fAssocResponse, num_WMMTSPEC), "WMMTSPEC" , 4, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fAssocResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fAssocResponse, WscAssocRes), offsetof(tDot11fIEWscAssocRes, present), 0, "WscAssocRes" , 0, 6, 37, SigIeWscAssocRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCASSOCRES, 0, },
+        {offsetof(tDot11fAssocResponse, P2PAssocRes), offsetof(tDot11fIEP2PAssocRes, present), 0, "P2PAssocRes" , 0, 6, 17, SigIeP2PAssocRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PASSOCRES, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_AssocResponse, IES_AssocResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Unpacked the AssocResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->AID.associd, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RCPIIE:\n"));
+        if (!pFrm->RCPIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RCPIIE.rcpi, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RSNIIE:\n"));
+        if (!pFrm->RSNIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RSNIIE.rsni, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WscAssocRes:\n"));
+        if (!pFrm->WscAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscAssocRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscAssocRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscAssocRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscAssocRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscAssocRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscAssocRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscAssocRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("P2PAssocRes:\n"));
+        if (!pFrm->P2PAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PAssocRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PAssocRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAssocResponse. */
+
+    static const tFFDefn FFS_Authentication[] = {
+        { "AuthAlgo", offsetof(tDot11fAuthentication, AuthAlgo), SigFfAuthAlgo , DOT11F_FF_AUTHALGO_LEN, },
+        { "AuthSeqNo", offsetof(tDot11fAuthentication, AuthSeqNo), SigFfAuthSeqNo , DOT11F_FF_AUTHSEQNO_LEN, },
+        { "Status", offsetof(tDot11fAuthentication, Status), SigFfStatus , DOT11F_FF_STATUS_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Authentication[] = {
+        {offsetof(tDot11fAuthentication, ChallengeText), offsetof(tDot11fIEChallengeText, present), 0, "ChallengeText" , 0, 3, 255, SigIeChallengeText, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHALLENGETEXT, 0, },
+        {offsetof(tDot11fAuthentication, RSNOpaque), offsetof(tDot11fIERSNOpaque, present), 0, "RSNOpaque" , 0, 8, 255, SigIeRSNOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNOPAQUE, 0, },
+        {offsetof(tDot11fAuthentication, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fAuthentication, FTInfo), offsetof(tDot11fIEFTInfo, present), 0, "FTInfo" , 0, 84, 187, SigIeFTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FTINFO, 0, },
+        {offsetof(tDot11fAuthentication, FTTimeoutInterval), offsetof(tDot11fIEFTTimeoutInterval, present), 0, "FTTimeoutInterval" , 0, 7, 7, SigIeFTTimeoutInterval, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FTTIMEOUTINTERVAL, 0, },
+        {offsetof(tDot11fAuthentication, RICDataDesc), offsetof(tDot11fIERICDataDesc, present), offsetof(tDot11fAuthentication, num_RICDataDesc), "RICDataDesc" , 2, 2, 550, SigIeRICDataDesc, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDATADESC, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackAuthentication(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAuthentication *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_Authentication, IES_Authentication, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Unpacked the Authentication:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("AuthAlgo:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->AuthAlgo.algo, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("AuthSeqNo:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->AuthSeqNo.no, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("ChallengeText:\n"));
+        if (!pFrm->ChallengeText.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_text: %d.\n"), pFrm->ChallengeText.num_text);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->ChallengeText.text, pFrm->ChallengeText.num_text);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("FTTimeoutInterval:\n"));
+        if (!pFrm->FTTimeoutInterval.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTTimeoutInterval.timeoutType, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTTimeoutInterval.timeoutValue, 4);
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAuthentication. */
+
+    static const tFFDefn FFS_Beacon[] = {
+        { "TimeStamp", offsetof(tDot11fBeacon, TimeStamp), SigFfTimeStamp , DOT11F_FF_TIMESTAMP_LEN, },
+        { "BeaconInterval", offsetof(tDot11fBeacon, BeaconInterval), SigFfBeaconInterval , DOT11F_FF_BEACONINTERVAL_LEN, },
+        { "Capabilities", offsetof(tDot11fBeacon, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Beacon[] = {
+        {offsetof(tDot11fBeacon, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fBeacon, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fBeacon, FHParamSet), offsetof(tDot11fIEFHParamSet, present), 0, "FHParamSet" , 0, 7, 7, SigIeFHParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMSET, 0, },
+        {offsetof(tDot11fBeacon, DSParams), offsetof(tDot11fIEDSParams, present), 0, "DSParams" , 0, 3, 3, SigIeDSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_DSPARAMS, 0, },
+        {offsetof(tDot11fBeacon, CFParams), offsetof(tDot11fIECFParams, present), 0, "CFParams" , 0, 8, 8, SigIeCFParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CFPARAMS, 0, },
+        {offsetof(tDot11fBeacon, IBSSParams), offsetof(tDot11fIEIBSSParams, present), 0, "IBSSParams" , 0, 4, 4, SigIeIBSSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_IBSSPARAMS, 0, },
+        {offsetof(tDot11fBeacon, TIM), offsetof(tDot11fIETIM, present), 0, "TIM" , 0, 6, 256, SigIeTIM, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TIM, 0, },
+        {offsetof(tDot11fBeacon, Country), offsetof(tDot11fIECountry, present), 0, "Country" , 0, 5, 257, SigIeCountry, {0, 0, 0, 0, 0}, 0, DOT11F_EID_COUNTRY, 0, },
+        {offsetof(tDot11fBeacon, FHParams), offsetof(tDot11fIEFHParams, present), 0, "FHParams" , 0, 4, 4, SigIeFHParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMS, 0, },
+        {offsetof(tDot11fBeacon, FHPattTable), offsetof(tDot11fIEFHPattTable, present), 0, "FHPattTable" , 0, 6, 257, SigIeFHPattTable, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPATTTABLE, 0, },
+        {offsetof(tDot11fBeacon, PowerConstraints), offsetof(tDot11fIEPowerConstraints, present), 0, "PowerConstraints" , 0, 3, 3, SigIePowerConstraints, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCONSTRAINTS, 0, },
+        {offsetof(tDot11fBeacon, ChanSwitchAnn), offsetof(tDot11fIEChanSwitchAnn, present), 0, "ChanSwitchAnn" , 0, 5, 5, SigIeChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeacon, Quiet), offsetof(tDot11fIEQuiet, present), 0, "Quiet" , 0, 8, 8, SigIeQuiet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QUIET, 0, },
+        {offsetof(tDot11fBeacon, TPCReport), offsetof(tDot11fIETPCReport, present), 0, "TPCReport" , 0, 4, 4, SigIeTPCReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREPORT, 0, },
+        {offsetof(tDot11fBeacon, ERPInfo), offsetof(tDot11fIEERPInfo, present), 0, "ERPInfo" , 0, 3, 3, SigIeERPInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_ERPINFO, 0, },
+        {offsetof(tDot11fBeacon, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fBeacon, RSN), offsetof(tDot11fIERSN, present), 0, "RSN" , 0, 8, 112, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, },
+        {offsetof(tDot11fBeacon, QBSSLoad), offsetof(tDot11fIEQBSSLoad, present), 0, "QBSSLoad" , 0, 7, 7, SigIeQBSSLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QBSSLOAD, 0, },
+        {offsetof(tDot11fBeacon, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fBeacon, QOSCapsAp), offsetof(tDot11fIEQOSCapsAp, present), 0, "QOSCapsAp" , 0, 3, 3, SigIeQOSCapsAp, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QOSCAPSAP, 0, },
+        {offsetof(tDot11fBeacon, APChannelReport), offsetof(tDot11fIEAPChannelReport, present), 0, "APChannelReport" , 0, 3, 53, SigIeAPChannelReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APCHANNELREPORT, 0, },
+        {offsetof(tDot11fBeacon, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fBeacon, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fBeacon, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fBeacon, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fBeacon, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fBeacon, ExtChanSwitchAnn), offsetof(tDot11fIEExtChanSwitchAnn, present), 0, "ExtChanSwitchAnn" , 0, 3, 3, SigIeExtChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTCHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeacon, WMMInfoAp), offsetof(tDot11fIEWMMInfoAp, present), 0, "WMMInfoAp" , 0, 9, 9, SigIeWMMInfoAp, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOAP, 0, },
+        {offsetof(tDot11fBeacon, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fBeacon, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fBeacon, WAPI), offsetof(tDot11fIEWAPI, present), 0, "WAPI" , 0, 14, 112, SigIeWAPI, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPI, 0, },
+        {offsetof(tDot11fBeacon, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fBeacon, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fBeacon, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fBeacon, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fBeacon, WscBeacon), offsetof(tDot11fIEWscBeacon, present), 0, "WscBeacon" , 0, 6, 84, SigIeWscBeacon, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCBEACON, 0, },
+        {offsetof(tDot11fBeacon, P2PBeacon), offsetof(tDot11fIEP2PBeacon, present), 0, "P2PBeacon" , 0, 6, 61, SigIeP2PBeacon, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACON, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackBeacon(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_Beacon, IES_Beacon, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Unpacked the Beacon:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TIM:\n"));
+        if (!pFrm->TIM.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.dtim_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.dtim_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.bmpctl, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_vbmp: %d.\n"), pFrm->TIM.num_vbmp);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->TIM.vbmp, pFrm->TIM.num_vbmp);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("QOSCapsAp:\n"));
+        if (!pFrm->QOSCapsAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (1): %d\n"), pFrm->QOSCapsAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txopreq (1): %d\n"), pFrm->QOSCapsAp.txopreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qreq (1): %d\n"), pFrm->QOSCapsAp.qreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qack (1): %d\n"), pFrm->QOSCapsAp.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("count (4): %d\n"), pFrm->QOSCapsAp.count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WscBeacon:\n"));
+        if (!pFrm->WscBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version:\n"));
+            if (!pFrm->WscBeacon.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("minor (4): %d\n"), pFrm->WscBeacon.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("major (4): %d\n"), pFrm->WscBeacon.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeacon.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeacon.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeacon.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeacon.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeacon.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeacon.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version2:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("minor (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("major (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PBeacon:\n"));
+        if (!pFrm->P2PBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeacon.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeacon.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeacon.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon. */
+
+    static const tFFDefn FFS_Beacon1[] = {
+        { "TimeStamp", offsetof(tDot11fBeacon1, TimeStamp), SigFfTimeStamp , DOT11F_FF_TIMESTAMP_LEN, },
+        { "BeaconInterval", offsetof(tDot11fBeacon1, BeaconInterval), SigFfBeaconInterval , DOT11F_FF_BEACONINTERVAL_LEN, },
+        { "Capabilities", offsetof(tDot11fBeacon1, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Beacon1[] = {
+        {offsetof(tDot11fBeacon1, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fBeacon1, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fBeacon1, DSParams), offsetof(tDot11fIEDSParams, present), 0, "DSParams" , 0, 3, 3, SigIeDSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_DSPARAMS, 0, },
+        {offsetof(tDot11fBeacon1, IBSSParams), offsetof(tDot11fIEIBSSParams, present), 0, "IBSSParams" , 0, 4, 4, SigIeIBSSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_IBSSPARAMS, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackBeacon1(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon1 *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_Beacon1, IES_Beacon1, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Unpacked the Beacon1:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon1. */
+
+    static const tFFDefn FFS_Beacon2[] = {
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Beacon2[] = {
+        {offsetof(tDot11fBeacon2, Country), offsetof(tDot11fIECountry, present), 0, "Country" , 0, 5, 257, SigIeCountry, {0, 0, 0, 0, 0}, 0, DOT11F_EID_COUNTRY, 0, },
+        {offsetof(tDot11fBeacon2, PowerConstraints), offsetof(tDot11fIEPowerConstraints, present), 0, "PowerConstraints" , 0, 3, 3, SigIePowerConstraints, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCONSTRAINTS, 0, },
+        {offsetof(tDot11fBeacon2, ChanSwitchAnn), offsetof(tDot11fIEChanSwitchAnn, present), 0, "ChanSwitchAnn" , 0, 5, 5, SigIeChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeacon2, Quiet), offsetof(tDot11fIEQuiet, present), 0, "Quiet" , 0, 8, 8, SigIeQuiet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QUIET, 0, },
+        {offsetof(tDot11fBeacon2, TPCReport), offsetof(tDot11fIETPCReport, present), 0, "TPCReport" , 0, 4, 4, SigIeTPCReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREPORT, 0, },
+        {offsetof(tDot11fBeacon2, ERPInfo), offsetof(tDot11fIEERPInfo, present), 0, "ERPInfo" , 0, 3, 3, SigIeERPInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_ERPINFO, 0, },
+        {offsetof(tDot11fBeacon2, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fBeacon2, RSN), offsetof(tDot11fIERSN, present), 0, "RSN" , 0, 8, 112, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, },
+        {offsetof(tDot11fBeacon2, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fBeacon2, APChannelReport), offsetof(tDot11fIEAPChannelReport, present), 0, "APChannelReport" , 0, 3, 53, SigIeAPChannelReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APCHANNELREPORT, 0, },
+        {offsetof(tDot11fBeacon2, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fBeacon2, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fBeacon2, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fBeacon2, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fBeacon2, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fBeacon2, ExtChanSwitchAnn), offsetof(tDot11fIEExtChanSwitchAnn, present), 0, "ExtChanSwitchAnn" , 0, 3, 3, SigIeExtChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTCHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeacon2, WMMInfoAp), offsetof(tDot11fIEWMMInfoAp, present), 0, "WMMInfoAp" , 0, 9, 9, SigIeWMMInfoAp, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOAP, 0, },
+        {offsetof(tDot11fBeacon2, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fBeacon2, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fBeacon2, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fBeacon2, WscBeacon), offsetof(tDot11fIEWscBeacon, present), 0, "WscBeacon" , 0, 6, 84, SigIeWscBeacon, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCBEACON, 0, },
+        {offsetof(tDot11fBeacon2, WAPI), offsetof(tDot11fIEWAPI, present), 0, "WAPI" , 0, 14, 112, SigIeWAPI, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPI, 0, },
+        {offsetof(tDot11fBeacon2, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fBeacon2, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fBeacon2, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fBeacon2, P2PBeacon), offsetof(tDot11fIEP2PBeacon, present), 0, "P2PBeacon" , 0, 6, 61, SigIeP2PBeacon, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACON, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackBeacon2(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon2 *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_Beacon2, IES_Beacon2, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Unpacked the Beacon2:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WscBeacon:\n"));
+        if (!pFrm->WscBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version:\n"));
+            if (!pFrm->WscBeacon.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("minor (4): %d\n"), pFrm->WscBeacon.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("major (4): %d\n"), pFrm->WscBeacon.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeacon.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeacon.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeacon.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeacon.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeacon.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeacon.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version2:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("minor (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("major (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PBeacon:\n"));
+        if (!pFrm->P2PBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeacon.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeacon.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeacon.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon2. */
+
+    static const tFFDefn FFS_BeaconIEs[] = {
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_BeaconIEs[] = {
+        {offsetof(tDot11fBeaconIEs, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fBeaconIEs, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fBeaconIEs, FHParamSet), offsetof(tDot11fIEFHParamSet, present), 0, "FHParamSet" , 0, 7, 7, SigIeFHParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMSET, 0, },
+        {offsetof(tDot11fBeaconIEs, DSParams), offsetof(tDot11fIEDSParams, present), 0, "DSParams" , 0, 3, 3, SigIeDSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_DSPARAMS, 0, },
+        {offsetof(tDot11fBeaconIEs, CFParams), offsetof(tDot11fIECFParams, present), 0, "CFParams" , 0, 8, 8, SigIeCFParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CFPARAMS, 0, },
+        {offsetof(tDot11fBeaconIEs, IBSSParams), offsetof(tDot11fIEIBSSParams, present), 0, "IBSSParams" , 0, 4, 4, SigIeIBSSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_IBSSPARAMS, 0, },
+        {offsetof(tDot11fBeaconIEs, TIM), offsetof(tDot11fIETIM, present), 0, "TIM" , 0, 6, 256, SigIeTIM, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TIM, 0, },
+        {offsetof(tDot11fBeaconIEs, Country), offsetof(tDot11fIECountry, present), 0, "Country" , 0, 5, 257, SigIeCountry, {0, 0, 0, 0, 0}, 0, DOT11F_EID_COUNTRY, 0, },
+        {offsetof(tDot11fBeaconIEs, FHParams), offsetof(tDot11fIEFHParams, present), 0, "FHParams" , 0, 4, 4, SigIeFHParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMS, 0, },
+        {offsetof(tDot11fBeaconIEs, FHPattTable), offsetof(tDot11fIEFHPattTable, present), 0, "FHPattTable" , 0, 6, 257, SigIeFHPattTable, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPATTTABLE, 0, },
+        {offsetof(tDot11fBeaconIEs, PowerConstraints), offsetof(tDot11fIEPowerConstraints, present), 0, "PowerConstraints" , 0, 3, 3, SigIePowerConstraints, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCONSTRAINTS, 0, },
+        {offsetof(tDot11fBeaconIEs, ChanSwitchAnn), offsetof(tDot11fIEChanSwitchAnn, present), 0, "ChanSwitchAnn" , 0, 5, 5, SigIeChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeaconIEs, Quiet), offsetof(tDot11fIEQuiet, present), 0, "Quiet" , 0, 8, 8, SigIeQuiet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QUIET, 0, },
+        {offsetof(tDot11fBeaconIEs, TPCReport), offsetof(tDot11fIETPCReport, present), 0, "TPCReport" , 0, 4, 4, SigIeTPCReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREPORT, 0, },
+        {offsetof(tDot11fBeaconIEs, ERPInfo), offsetof(tDot11fIEERPInfo, present), 0, "ERPInfo" , 0, 3, 3, SigIeERPInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_ERPINFO, 0, },
+        {offsetof(tDot11fBeaconIEs, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fBeaconIEs, RSN), offsetof(tDot11fIERSN, present), 0, "RSN" , 0, 8, 112, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, },
+        {offsetof(tDot11fBeaconIEs, QBSSLoad), offsetof(tDot11fIEQBSSLoad, present), 0, "QBSSLoad" , 0, 7, 7, SigIeQBSSLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QBSSLOAD, 0, },
+        {offsetof(tDot11fBeaconIEs, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fBeaconIEs, QOSCapsAp), offsetof(tDot11fIEQOSCapsAp, present), 0, "QOSCapsAp" , 0, 3, 3, SigIeQOSCapsAp, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QOSCAPSAP, 0, },
+        {offsetof(tDot11fBeaconIEs, APChannelReport), offsetof(tDot11fIEAPChannelReport, present), 0, "APChannelReport" , 0, 3, 53, SigIeAPChannelReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APCHANNELREPORT, 0, },
+        {offsetof(tDot11fBeaconIEs, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fBeaconIEs, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fBeaconIEs, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fBeaconIEs, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fBeaconIEs, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fBeaconIEs, ExtChanSwitchAnn), offsetof(tDot11fIEExtChanSwitchAnn, present), 0, "ExtChanSwitchAnn" , 0, 3, 3, SigIeExtChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTCHANSWITCHANN, 0, },
+        {offsetof(tDot11fBeaconIEs, WMMInfoAp), offsetof(tDot11fIEWMMInfoAp, present), 0, "WMMInfoAp" , 0, 9, 9, SigIeWMMInfoAp, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOAP, 0, },
+        {offsetof(tDot11fBeaconIEs, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fBeaconIEs, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fBeaconIEs, WAPI), offsetof(tDot11fIEWAPI, present), 0, "WAPI" , 0, 14, 112, SigIeWAPI, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPI, 0, },
+        {offsetof(tDot11fBeaconIEs, CCXVersion), offsetof(tDot11fIECCXVersion, present), 0, "CCXVersion" , 0, 7, 7, SigIeCCXVersion, {0, 64, 150, 3, 0}, 4, DOT11F_EID_CCXVERSION, 0, },
+        {offsetof(tDot11fBeaconIEs, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fBeaconIEs, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fBeaconIEs, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fBeaconIEs, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fBeaconIEs, WscBeaconProbeRes), offsetof(tDot11fIEWscBeaconProbeRes, present), 0, "WscBeaconProbeRes" , 0, 6, 319, SigIeWscBeaconProbeRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCBEACONPROBERES, 0, },
+        {offsetof(tDot11fBeaconIEs, P2PBeaconProbeRes), offsetof(tDot11fIEP2PBeaconProbeRes, present), 0, "P2PBeaconProbeRes" , 0, 6, 1150, SigIeP2PBeaconProbeRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACONPROBERES, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackBeaconIEs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeaconIEs *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_BeaconIEs, IES_BeaconIEs, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Unpacked the BeaconIEs:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TIM:\n"));
+        if (!pFrm->TIM.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.dtim_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.dtim_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.bmpctl, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_vbmp: %d.\n"), pFrm->TIM.num_vbmp);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->TIM.vbmp, pFrm->TIM.num_vbmp);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("QOSCapsAp:\n"));
+        if (!pFrm->QOSCapsAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (1): %d\n"), pFrm->QOSCapsAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txopreq (1): %d\n"), pFrm->QOSCapsAp.txopreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qreq (1): %d\n"), pFrm->QOSCapsAp.qreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qack (1): %d\n"), pFrm->QOSCapsAp.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("count (4): %d\n"), pFrm->QOSCapsAp.count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WscBeaconProbeRes:\n"));
+        if (!pFrm->WscBeaconProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version:\n"));
+            if (!pFrm->WscBeaconProbeRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("minor (4): %d\n"), pFrm->WscBeaconProbeRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("major (4): %d\n"), pFrm->WscBeaconProbeRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeaconProbeRes.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeaconProbeRes.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeaconProbeRes.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeaconProbeRes.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeaconProbeRes.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ResponseType:\n"));
+            if (!pFrm->WscBeaconProbeRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeaconProbeRes.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscBeaconProbeRes.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_name: %d.\n"), pFrm->WscBeaconProbeRes.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.Manufacturer.name, pFrm->WscBeaconProbeRes.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ModelName:\n"));
+            if (!pFrm->WscBeaconProbeRes.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.ModelName.text, pFrm->WscBeaconProbeRes.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscBeaconProbeRes.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.ModelNumber.text, pFrm->WscBeaconProbeRes.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SerialNumber:\n"));
+            if (!pFrm->WscBeaconProbeRes.SerialNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.SerialNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.SerialNumber.text, pFrm->WscBeaconProbeRes.SerialNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscBeaconProbeRes.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DeviceName:\n"));
+            if (!pFrm->WscBeaconProbeRes.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.DeviceName.text, pFrm->WscBeaconProbeRes.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscBeaconProbeRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeaconProbeRes.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeaconProbeRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version2:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("minor (4): %d\n"), pFrm->WscBeaconProbeRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("major (4): %d\n"), pFrm->WscBeaconProbeRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PBeaconProbeRes:\n"));
+        if (!pFrm->P2PBeaconProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PBeaconProbeRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeaconProbeRes.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeaconProbeRes.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.NoticeOfAbsence.NoADesc, pFrm->P2PBeaconProbeRes.NoticeOfAbsence.num_NoADesc);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PGroupInfo:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PGroupInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_P2PClientInfoDesc: %d.\n"), pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeaconIEs. */
+
+    static const tFFDefn FFS_ChannelSwitch[] = {
+        { "Category", offsetof(tDot11fChannelSwitch, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fChannelSwitch, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ChannelSwitch[] = {
+        {offsetof(tDot11fChannelSwitch, ChanSwitchAnn), offsetof(tDot11fIEChanSwitchAnn, present), 0, "ChanSwitchAnn" , 0, 5, 5, SigIeChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANSWITCHANN, 1, },
+        {offsetof(tDot11fChannelSwitch, ExtChanSwitchAnn), offsetof(tDot11fIEExtChanSwitchAnn, present), 0, "ExtChanSwitchAnn" , 0, 3, 3, SigIeExtChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTCHANSWITCHANN, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackChannelSwitch(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fChannelSwitch *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ChannelSwitch, IES_ChannelSwitch, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Unpacked the ChannelSwitch:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackChannelSwitch. */
+
+    static const tFFDefn FFS_DeAuth[] = {
+        { "Reason", offsetof(tDot11fDeAuth, Reason), SigFfReason , DOT11F_FF_REASON_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_DeAuth[] = {
+        {offsetof(tDot11fDeAuth, P2PDeAuth), offsetof(tDot11fIEP2PDeAuth, present), 0, "P2PDeAuth" , 0, 6, 10, SigIeP2PDeAuth, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PDEAUTH, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDeAuth(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeAuth *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_DeAuth, IES_DeAuth, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Unpacked the DeAuth:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("P2PDeAuth:\n"));
+        if (!pFrm->P2PDeAuth.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("MinorReasonCode:\n"));
+            if (!pFrm->P2PDeAuth.MinorReasonCode.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), ( tANI_U8* )&pFrm->P2PDeAuth.MinorReasonCode.minorReasonCode, 1);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeAuth. */
+
+    static const tFFDefn FFS_DelBAInd[] = {
+        { "Category", offsetof(tDot11fDelBAInd, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fDelBAInd, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DelBAParameterSet", offsetof(tDot11fDelBAInd, DelBAParameterSet), SigFfDelBAParameterSet , DOT11F_FF_DELBAPARAMETERSET_LEN, },
+        { "Reason", offsetof(tDot11fDelBAInd, Reason), SigFfReason , DOT11F_FF_REASON_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_DelBAInd[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDelBAInd(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDelBAInd *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_DelBAInd, IES_DelBAInd, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Unpacked the DelBAInd:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("DelBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("reserved (11): %d\n"), pFrm->DelBAParameterSet.reserved);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("initiator (1): %d\n"), pFrm->DelBAParameterSet.initiator);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("tid (4): %d\n"), pFrm->DelBAParameterSet.tid);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Reason.code, 2);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDelBAInd. */
+
+    static const tFFDefn FFS_DelTS[] = {
+        { "Category", offsetof(tDot11fDelTS, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fDelTS, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "TSInfo", offsetof(tDot11fDelTS, TSInfo), SigFfTSInfo , DOT11F_FF_TSINFO_LEN, },
+        { "Reason", offsetof(tDot11fDelTS, Reason), SigFfReason , DOT11F_FF_REASON_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_DelTS[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDelTS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDelTS *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_DelTS, IES_DelTS, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Unpacked the DelTS:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("TSInfo:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("traffic_type (1): %d\n"), pFrm->TSInfo.traffic_type);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("tsid (4): %d\n"), pFrm->TSInfo.tsid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("direction (2): %d\n"), pFrm->TSInfo.direction);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("access_policy (2): %d\n"), pFrm->TSInfo.access_policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("aggregation (1): %d\n"), pFrm->TSInfo.aggregation);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("psb (1): %d\n"), pFrm->TSInfo.psb);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("user_priority (3): %d\n"), pFrm->TSInfo.user_priority);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSInfo.tsinfo_ack_pol);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("schedule (1): %d\n"), pFrm->TSInfo.schedule);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("unused (15): %d\n"), pFrm->TSInfo.unused);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Reason.code, 2);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDelTS. */
+
+    static const tFFDefn FFS_DeviceDiscoverabilityReq[] = {
+        { "Category", offsetof(tDot11fDeviceDiscoverabilityReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fDeviceDiscoverabilityReq, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fDeviceDiscoverabilityReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fDeviceDiscoverabilityReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fDeviceDiscoverabilityReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_DeviceDiscoverabilityReq[] = {
+        {offsetof(tDot11fDeviceDiscoverabilityReq, P2PDeviceDiscoverabilityReq), offsetof(tDot11fIEP2PDeviceDiscoverabilityReq, present), 0, "P2PDeviceDiscoverabilityReq" , 0, 6, 56, SigIeP2PDeviceDiscoverabilityReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PDEVICEDISCOVERABILITYREQ, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeviceDiscoverabilityReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_DeviceDiscoverabilityReq, IES_DeviceDiscoverabilityReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Unpacked the DeviceDiscoverabilityReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PDeviceDiscoverabilityReq:\n"));
+        if (!pFrm->P2PDeviceDiscoverabilityReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityReq.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityReq.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* ) pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.ssid, pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.num_ssid);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeviceDiscoverabilityReq. */
+
+    static const tFFDefn FFS_DeviceDiscoverabilityRes[] = {
+        { "Category", offsetof(tDot11fDeviceDiscoverabilityRes, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fDeviceDiscoverabilityRes, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fDeviceDiscoverabilityRes, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fDeviceDiscoverabilityRes, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fDeviceDiscoverabilityRes, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_DeviceDiscoverabilityRes[] = {
+        {offsetof(tDot11fDeviceDiscoverabilityRes, P2PDeviceDiscoverabilityRes), offsetof(tDot11fIEP2PDeviceDiscoverabilityRes, present), 0, "P2PDeviceDiscoverabilityRes" , 0, 6, 10, SigIeP2PDeviceDiscoverabilityRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PDEVICEDISCOVERABILITYRES, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDeviceDiscoverabilityRes *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_DeviceDiscoverabilityRes, IES_DeviceDiscoverabilityRes, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Unpacked the DeviceDiscoverabilityRes:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2PDeviceDiscoverabilityRes:\n"));
+        if (!pFrm->P2PDeviceDiscoverabilityRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityRes.P2PStatus.status, 1);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeviceDiscoverabilityRes. */
+
+    static const tFFDefn FFS_Disassociation[] = {
+        { "Reason", offsetof(tDot11fDisassociation, Reason), SigFfReason , DOT11F_FF_REASON_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_Disassociation[] = {
+        {offsetof(tDot11fDisassociation, P2PDisAssoc), offsetof(tDot11fIEP2PDisAssoc, present), 0, "P2PDisAssoc" , 0, 6, 10, SigIeP2PDisAssoc, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PDISASSOC, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackDisassociation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fDisassociation *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_Disassociation, IES_Disassociation, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Unpacked the Disassociation:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("P2PDisAssoc:\n"));
+        if (!pFrm->P2PDisAssoc.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("MinorReasonCode:\n"));
+            if (!pFrm->P2PDisAssoc.MinorReasonCode.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), ( tANI_U8* )&pFrm->P2PDisAssoc.MinorReasonCode.minorReasonCode, 1);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDisassociation. */
+
+    static const tFFDefn FFS_GODiscoverabilityReq[] = {
+        { "Category", offsetof(tDot11fGODiscoverabilityReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "P2POUI", offsetof(tDot11fGODiscoverabilityReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fGODiscoverabilityReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fGODiscoverabilityReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_GODiscoverabilityReq[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackGODiscoverabilityReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGODiscoverabilityReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_GODiscoverabilityReq, IES_GODiscoverabilityReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("Unpacked the GODiscoverabilityReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGODiscoverabilityReq. */
+
+    static const tFFDefn FFS_GONegCnf[] = {
+        { "Category", offsetof(tDot11fGONegCnf, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fGONegCnf, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fGONegCnf, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fGONegCnf, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fGONegCnf, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_GONegCnf[] = {
+        {offsetof(tDot11fGONegCnf, P2PGONegCnf), offsetof(tDot11fIEP2PGONegCnf, present), 0, "P2PGONegCnf" , 0, 6, 321, SigIeP2PGONegCnf, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PGONEGCNF, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackGONegCnf(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegCnf *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_GONegCnf, IES_GONegCnf, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Unpacked the GONegCnf:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PGONegCnf:\n"));
+        if (!pFrm->P2PGONegCnf.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PGONegCnf.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegCnf.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegCnf.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegCnf.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegCnf.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* ) pFrm->P2PGONegCnf.ChannelList.channelList, pFrm->P2PGONegCnf.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PGONegCnf.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("num_ssid: %d.\n"), pFrm->P2PGONegCnf.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* ) pFrm->P2PGONegCnf.P2PGroupId.ssid, pFrm->P2PGONegCnf.P2PGroupId.num_ssid);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegCnf. */
+
+    static const tFFDefn FFS_GONegReq[] = {
+        { "Category", offsetof(tDot11fGONegReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fGONegReq, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fGONegReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fGONegReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fGONegReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_GONegReq[] = {
+        {offsetof(tDot11fGONegReq, P2PGONegWPS), offsetof(tDot11fIEP2PGONegWPS, present), 0, "P2PGONegWPS" , 0, 6, 17, SigIeP2PGONegWPS, {0, 80, 242, 4, 0}, 4, DOT11F_EID_P2PGONEGWPS, 1, },
+        {offsetof(tDot11fGONegReq, P2PGONegReq), offsetof(tDot11fIEP2PGONegReq, present), 0, "P2PGONegReq" , 0, 6, 364, SigIeP2PGONegReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PGONEGREQ, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackGONegReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_GONegReq, IES_GONegReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Unpacked the GONegReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PGONegWPS:\n"));
+        if (!pFrm->P2PGONegWPS.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Version:\n"));
+            if (!pFrm->P2PGONegWPS.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("minor (4): %d\n"), pFrm->P2PGONegWPS.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("major (4): %d\n"), pFrm->P2PGONegWPS.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->P2PGONegWPS.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegWPS.DevicePasswordID.id, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PGONegReq:\n"));
+        if (!pFrm->P2PGONegReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("GOIntent:\n"));
+            if (!pFrm->P2PGONegReq.GOIntent.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.GOIntent.GOIntent, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PGONegReq.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ListenChannel:\n"));
+            if (!pFrm->P2PGONegReq.ListenChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PGONegReq.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("IntendedP2PInterfaceAddress:\n"));
+            if (!pFrm->P2PGONegReq.IntendedP2PInterfaceAddress.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.IntendedP2PInterfaceAddress.P2PInterfaceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegReq.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegReq.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* ) pFrm->P2PGONegReq.ChannelList.channelList, pFrm->P2PGONegReq.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PGONegReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("num_text: %d.\n"), pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* ) pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.channel, 1);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegReq. */
+
+    static const tFFDefn FFS_GONegRes[] = {
+        { "Category", offsetof(tDot11fGONegRes, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fGONegRes, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fGONegRes, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fGONegRes, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fGONegRes, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_GONegRes[] = {
+        {offsetof(tDot11fGONegRes, P2PGONegWPS), offsetof(tDot11fIEP2PGONegWPS, present), 0, "P2PGONegWPS" , 0, 6, 17, SigIeP2PGONegWPS, {0, 80, 242, 4, 0}, 4, DOT11F_EID_P2PGONEGWPS, 1, },
+        {offsetof(tDot11fGONegRes, P2PGONegRes), offsetof(tDot11fIEP2PGONegRes, present), 0, "P2PGONegRes" , 0, 6, 394, SigIeP2PGONegRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PGONEGRES, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackGONegRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fGONegRes *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_GONegRes, IES_GONegRes, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Unpacked the GONegRes:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGONegWPS:\n"));
+        if (!pFrm->P2PGONegWPS.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Version:\n"));
+            if (!pFrm->P2PGONegWPS.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("minor (4): %d\n"), pFrm->P2PGONegWPS.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("major (4): %d\n"), pFrm->P2PGONegWPS.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->P2PGONegWPS.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegWPS.DevicePasswordID.id, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGONegRes:\n"));
+        if (!pFrm->P2PGONegRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PGONegRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("GOIntent:\n"));
+            if (!pFrm->P2PGONegRes.GOIntent.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.GOIntent.GOIntent, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PGONegRes.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegRes.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("IntendedP2PInterfaceAddress:\n"));
+            if (!pFrm->P2PGONegRes.IntendedP2PInterfaceAddress.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.IntendedP2PInterfaceAddress.P2PInterfaceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegRes.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegRes.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.ChannelList.channelList, pFrm->P2PGONegRes.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PGONegRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_text: %d.\n"), pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PGONegRes.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_ssid: %d.\n"), pFrm->P2PGONegRes.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.P2PGroupId.ssid, pFrm->P2PGONegRes.P2PGroupId.num_ssid);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegRes. */
+
+    static const tFFDefn FFS_InvitationReq[] = {
+        { "Category", offsetof(tDot11fInvitationReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fInvitationReq, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fInvitationReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fInvitationReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fInvitationReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_InvitationReq[] = {
+        {offsetof(tDot11fInvitationReq, P2PInvitationReq), offsetof(tDot11fIEP2PInvitationReq, present), 0, "P2PInvitationReq" , 0, 6, 385, SigIeP2PInvitationReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PINVITATIONREQ, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackInvitationReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fInvitationReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_InvitationReq, IES_InvitationReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Unpacked the InvitationReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PInvitationReq:\n"));
+        if (!pFrm->P2PInvitationReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PInvitationReq.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("InvitationFlags:\n"));
+            if (!pFrm->P2PInvitationReq.InvitationFlags.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.InvitationFlags.invitationFlags, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PInvitationReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PGroupBssid:\n"));
+            if (!pFrm->P2PInvitationReq.P2PGroupBssid.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PGroupBssid.P2PGroupBssid, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PInvitationReq.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_channelList: %d.\n"), pFrm->P2PInvitationReq.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.ChannelList.channelList, pFrm->P2PInvitationReq.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PInvitationReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PInvitationReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.P2PGroupId.ssid, pFrm->P2PInvitationReq.P2PGroupId.num_ssid);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PInvitationReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_text: %d.\n"), pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackInvitationReq. */
+
+    static const tFFDefn FFS_InvitationRes[] = {
+        { "Category", offsetof(tDot11fInvitationRes, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fInvitationRes, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fInvitationRes, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fInvitationRes, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fInvitationRes, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_InvitationRes[] = {
+        {offsetof(tDot11fInvitationRes, P2PInvitationRes), offsetof(tDot11fIEP2PInvitationRes, present), 0, "P2PInvitationRes" , 0, 6, 289, SigIeP2PInvitationRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PINVITATIONRES, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackInvitationRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fInvitationRes *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_InvitationRes, IES_InvitationRes, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Unpacked the InvitationRes:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PInvitationRes:\n"));
+        if (!pFrm->P2PInvitationRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PInvitationRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PInvitationRes.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PInvitationRes.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PGroupBssid:\n"));
+            if (!pFrm->P2PInvitationRes.P2PGroupBssid.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.P2PGroupBssid.P2PGroupBssid, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PInvitationRes.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("num_channelList: %d.\n"), pFrm->P2PInvitationRes.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* ) pFrm->P2PInvitationRes.ChannelList.channelList, pFrm->P2PInvitationRes.ChannelList.num_channelList);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackInvitationRes. */
+
+    static const tFFDefn FFS_LinkMeasurementReport[] = {
+        { "Category", offsetof(tDot11fLinkMeasurementReport, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fLinkMeasurementReport, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fLinkMeasurementReport, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "TPCEleID", offsetof(tDot11fLinkMeasurementReport, TPCEleID), SigFfTPCEleID , DOT11F_FF_TPCELEID_LEN, },
+        { "TPCEleLen", offsetof(tDot11fLinkMeasurementReport, TPCEleLen), SigFfTPCEleLen , DOT11F_FF_TPCELELEN_LEN, },
+        { "TxPower", offsetof(tDot11fLinkMeasurementReport, TxPower), SigFfTxPower , DOT11F_FF_TXPOWER_LEN, },
+        { "LinkMargin", offsetof(tDot11fLinkMeasurementReport, LinkMargin), SigFfLinkMargin , DOT11F_FF_LINKMARGIN_LEN, },
+        { "RxAntennaId", offsetof(tDot11fLinkMeasurementReport, RxAntennaId), SigFfRxAntennaId , DOT11F_FF_RXANTENNAID_LEN, },
+        { "TxAntennaId", offsetof(tDot11fLinkMeasurementReport, TxAntennaId), SigFfTxAntennaId , DOT11F_FF_TXANTENNAID_LEN, },
+        { "RCPI", offsetof(tDot11fLinkMeasurementReport, RCPI), SigFfRCPI , DOT11F_FF_RCPI_LEN, },
+        { "RSNI", offsetof(tDot11fLinkMeasurementReport, RSNI), SigFfRSNI , DOT11F_FF_RSNI_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_LinkMeasurementReport[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackLinkMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fLinkMeasurementReport *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_LinkMeasurementReport, IES_LinkMeasurementReport, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Unpacked the LinkMeasurementReport:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TPCEleID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TPCEleID.TPCId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TPCEleLen:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TPCEleLen.TPCLen, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TxPower.txPower, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("LinkMargin:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->LinkMargin.linkMargin, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RxAntennaId:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RxAntennaId.antennaId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TxAntennaId:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TxAntennaId.antennaId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RCPI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RCPI.rcpi, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RSNI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RSNI.rsni, 1);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackLinkMeasurementReport. */
+
+    static const tFFDefn FFS_LinkMeasurementRequest[] = {
+        { "Category", offsetof(tDot11fLinkMeasurementRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fLinkMeasurementRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fLinkMeasurementRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "TxPower", offsetof(tDot11fLinkMeasurementRequest, TxPower), SigFfTxPower , DOT11F_FF_TXPOWER_LEN, },
+        { "MaxTxPower", offsetof(tDot11fLinkMeasurementRequest, MaxTxPower), SigFfMaxTxPower , DOT11F_FF_MAXTXPOWER_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_LinkMeasurementRequest[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackLinkMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fLinkMeasurementRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_LinkMeasurementRequest, IES_LinkMeasurementRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Unpacked the LinkMeasurementRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("TxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->TxPower.txPower, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("MaxTxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MaxTxPower.maxTxPower, 1);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackLinkMeasurementRequest. */
+
+    static const tFFDefn FFS_MeasurementReport[] = {
+        { "Category", offsetof(tDot11fMeasurementReport, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fMeasurementReport, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fMeasurementReport, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_MeasurementReport[] = {
+        {offsetof(tDot11fMeasurementReport, MeasurementReport), offsetof(tDot11fIEMeasurementReport, present), 0, "MeasurementReport" , 0, 5, 31, SigIeMeasurementReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTREPORT, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fMeasurementReport *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_MeasurementReport, IES_MeasurementReport, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Unpacked the MeasurementReport:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("MeasurementReport:\n"));
+        if (!pFrm->MeasurementReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.token, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("late (1): %d\n"), pFrm->MeasurementReport.late);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("incapable (1): %d\n"), pFrm->MeasurementReport.incapable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("refused (1): %d\n"), pFrm->MeasurementReport.refused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unused (5): %d\n"), pFrm->MeasurementReport.unused);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.type, 1);
+            switch (pFrm->MeasurementReport.type)
+            {
+                case 0:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.meas_duration, 2);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("bss (1): %d\n"), pFrm->MeasurementReport.report.Basic.bss);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("ofdm_preamble (1): %d\n"), pFrm->MeasurementReport.report.Basic.ofdm_preamble);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unid_signal (1): %d\n"), pFrm->MeasurementReport.report.Basic.unid_signal);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("rader (1): %d\n"), pFrm->MeasurementReport.report.Basic.rader);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unmeasured (1): %d\n"), pFrm->MeasurementReport.report.Basic.unmeasured);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unused (3): %d\n"), pFrm->MeasurementReport.report.Basic.unused);
+                break;
+                case 1:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.meas_duration, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.cca_busy_fraction, 1);
+                break;
+                case 2:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.meas_duration, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi0_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi1_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi2_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi3_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi4_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi5_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi6_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi7_density, 1);
+                break;
+                case 5:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.regClass, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.meas_duration, 2);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("condensed_PHY (7): %d\n"), pFrm->MeasurementReport.report.Beacon.condensed_PHY);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("reported_frame_type (1): %d\n"), pFrm->MeasurementReport.report.Beacon.reported_frame_type);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.RCPI, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.RSNI, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.BSSID, 6);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.antenna_id, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.parent_TSF, 4);
+                break;
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackMeasurementReport. */
+
+    static const tFFDefn FFS_MeasurementRequest[] = {
+        { "Category", offsetof(tDot11fMeasurementRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fMeasurementRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fMeasurementRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_MeasurementRequest[] = {
+        {offsetof(tDot11fMeasurementRequest, MeasurementRequest), offsetof(tDot11fIEMeasurementRequest, present), offsetof(tDot11fMeasurementRequest, num_MeasurementRequest), "MeasurementRequest" , 4, 16, 18, SigIeMeasurementRequest, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTREQUEST, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fMeasurementRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_MeasurementRequest, IES_MeasurementRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Unpacked the MeasurementRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_MeasurementRequest; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("MeasurementRequest[%d]:\n"), i);
+            if (!pFrm->MeasurementRequest[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("parallel (1): %d\n"), pFrm->MeasurementRequest[i].parallel);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("enable (1): %d\n"), pFrm->MeasurementRequest[i].enable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("request (1): %d\n"), pFrm->MeasurementRequest[i].request);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("report (1): %d\n"), pFrm->MeasurementRequest[i].report);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("durationMandatory (1): %d\n"), pFrm->MeasurementRequest[i].durationMandatory);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("unused (3): %d\n"), pFrm->MeasurementRequest[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_type, 1);
+                switch (pFrm->MeasurementRequest[i].measurement_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_duration, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_duration, 2);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_duration, 2);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.randomization, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_mode, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.BSSID, 6);
+                    break;
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackMeasurementRequest. */
+
+    static const tFFDefn FFS_NeighborReportRequest[] = {
+        { "Category", offsetof(tDot11fNeighborReportRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fNeighborReportRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fNeighborReportRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_NeighborReportRequest[] = {
+        {offsetof(tDot11fNeighborReportRequest, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackNeighborReportRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNeighborReportRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_NeighborReportRequest, IES_NeighborReportRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Unpacked the NeighborReportRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNeighborReportRequest. */
+
+    static const tFFDefn FFS_NeighborReportResponse[] = {
+        { "Category", offsetof(tDot11fNeighborReportResponse, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fNeighborReportResponse, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fNeighborReportResponse, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_NeighborReportResponse[] = {
+        {offsetof(tDot11fNeighborReportResponse, NeighborReport), offsetof(tDot11fIENeighborReport, present), offsetof(tDot11fNeighborReportResponse, num_NeighborReport), "NeighborReport" , 4, 15, 548, SigIeNeighborReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_NEIGHBORREPORT, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackNeighborReportResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNeighborReportResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_NeighborReportResponse, IES_NeighborReportResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Unpacked the NeighborReportResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_NeighborReport; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborReport[%d]:\n"), i);
+            if (!pFrm->NeighborReport[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].bssid, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("APReachability (2): %d\n"), pFrm->NeighborReport[i].APReachability);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Security (1): %d\n"), pFrm->NeighborReport[i].Security);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("KeyScope (1): %d\n"), pFrm->NeighborReport[i].KeyScope);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("SpecMgmtCap (1): %d\n"), pFrm->NeighborReport[i].SpecMgmtCap);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("QosCap (1): %d\n"), pFrm->NeighborReport[i].QosCap);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("apsd (1): %d\n"), pFrm->NeighborReport[i].apsd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("rrm (1): %d\n"), pFrm->NeighborReport[i].rrm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("DelayedBA (1): %d\n"), pFrm->NeighborReport[i].DelayedBA);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("ImmBA (1): %d\n"), pFrm->NeighborReport[i].ImmBA);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MobilityDomain (1): %d\n"), pFrm->NeighborReport[i].MobilityDomain);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("reserved (5): %d\n"), pFrm->NeighborReport[i].reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].reserved1, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].PhyType, 1);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("TSFInfo:\n"));
+                if (!pFrm->NeighborReport[i].TSFInfo.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].TSFInfo.TsfOffset, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].TSFInfo.BeaconIntvl, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("CondensedCountryStr:\n"));
+                if (!pFrm->NeighborReport[i].CondensedCountryStr.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].CondensedCountryStr.countryStr, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilot:\n"));
+                if (!pFrm->NeighborReport[i].MeasurementPilot.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].MeasurementPilot.measurementPilot, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("num_vendorSpecific: %d.\n"), pFrm->NeighborReport[i].MeasurementPilot.num_vendorSpecific);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* ) pFrm->NeighborReport[i].MeasurementPilot.vendorSpecific, pFrm->NeighborReport[i].MeasurementPilot.num_vendorSpecific);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RRMEnabledCap:\n"));
+                if (!pFrm->NeighborReport[i].RRMEnabledCap.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LinkMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NeighborRpt);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("parallel (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.parallel);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("repeated (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.repeated);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconPassive);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconActive);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconTable);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconRepCond);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.FrameMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.ChannelLoad);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NoiseHistogram);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("statistics (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.statistics);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LCIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LCIAzimuth);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.TCMCapability);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.triggeredTCM);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.APChanReport);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RRMMIBEnabled);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.operatingChanMax);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.nonOperatinChanMax);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.MeasurementPilot);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.MeasurementPilotEnabled);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NeighborTSFOffset);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RCPIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RSNIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BssAvgAccessDelay);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BSSAvailAdmission);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.AntennaInformation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("reserved (6): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.reserved);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MultiBssid:\n"));
+                if (!pFrm->NeighborReport[i].MultiBssid.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].MultiBssid.maxBSSIDIndicator, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("num_vendorSpecific: %d.\n"), pFrm->NeighborReport[i].MultiBssid.num_vendorSpecific);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* ) pFrm->NeighborReport[i].MultiBssid.vendorSpecific, pFrm->NeighborReport[i].MultiBssid.num_vendorSpecific);
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNeighborReportResponse. */
+
+    static const tFFDefn FFS_NoticeOfAbs[] = {
+        { "Category", offsetof(tDot11fNoticeOfAbs, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "P2POUI", offsetof(tDot11fNoticeOfAbs, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fNoticeOfAbs, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fNoticeOfAbs, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_NoticeOfAbs[] = {
+        {offsetof(tDot11fNoticeOfAbs, P2PNoticeOfAbsence), offsetof(tDot11fIEP2PNoticeOfAbsence, present), 0, "P2PNoticeOfAbsence" , 0, 6, 47, SigIeP2PNoticeOfAbsence, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PNOTICEOFABSENCE, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackNoticeOfAbs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fNoticeOfAbs *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_NoticeOfAbs, IES_NoticeOfAbs, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Unpacked the NoticeOfAbs:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2PNoticeOfAbsence:\n"));
+        if (!pFrm->P2PNoticeOfAbsence.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("num_NoADesc: %d.\n"), pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* ) pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.NoADesc, pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNoticeOfAbs. */
+
+    static const tFFDefn FFS_PresenceReq[] = {
+        { "Category", offsetof(tDot11fPresenceReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "P2POUI", offsetof(tDot11fPresenceReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fPresenceReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fPresenceReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_PresenceReq[] = {
+        {offsetof(tDot11fPresenceReq, P2PNoticeOfAbsence), offsetof(tDot11fIEP2PNoticeOfAbsence, present), 0, "P2PNoticeOfAbsence" , 0, 6, 47, SigIeP2PNoticeOfAbsence, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PNOTICEOFABSENCE, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackPresenceReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fPresenceReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_PresenceReq, IES_PresenceReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Unpacked the PresenceReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2PNoticeOfAbsence:\n"));
+        if (!pFrm->P2PNoticeOfAbsence.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("num_NoADesc: %d.\n"), pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* ) pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.NoADesc, pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackPresenceReq. */
+
+    static const tFFDefn FFS_PresenceRes[] = {
+        { "Category", offsetof(tDot11fPresenceRes, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "P2POUI", offsetof(tDot11fPresenceRes, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fPresenceRes, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fPresenceRes, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_PresenceRes[] = {
+        {offsetof(tDot11fPresenceRes, P2PPresenceResponse), offsetof(tDot11fIEP2PPresenceResponse, present), 0, "P2PPresenceResponse" , 0, 6, 51, SigIeP2PPresenceResponse, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPRESENCERESPONSE, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackPresenceRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fPresenceRes *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_PresenceRes, IES_PresenceRes, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Unpacked the PresenceRes:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2PPresenceResponse:\n"));
+        if (!pFrm->P2PPresenceResponse.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PPresenceResponse.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PPresenceResponse.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("num_NoADesc: %d.\n"), pFrm->P2PPresenceResponse.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* ) pFrm->P2PPresenceResponse.NoticeOfAbsence.NoADesc, pFrm->P2PPresenceResponse.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackPresenceRes. */
+
+    static const tFFDefn FFS_ProbeRequest[] = {
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ProbeRequest[] = {
+        {offsetof(tDot11fProbeRequest, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fProbeRequest, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fProbeRequest, RequestedInfo), offsetof(tDot11fIERequestedInfo, present), 0, "RequestedInfo" , 0, 2, 257, SigIeRequestedInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_REQUESTEDINFO, 0, },
+        {offsetof(tDot11fProbeRequest, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fProbeRequest, DSParams), offsetof(tDot11fIEDSParams, present), 0, "DSParams" , 0, 3, 3, SigIeDSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_DSPARAMS, 0, },
+        {offsetof(tDot11fProbeRequest, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fProbeRequest, WscProbeReq), offsetof(tDot11fIEWscProbeReq, present), 0, "WscProbeReq" , 0, 6, 286, SigIeWscProbeReq, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCPROBEREQ, 0, },
+        {offsetof(tDot11fProbeRequest, WFATPC), offsetof(tDot11fIEWFATPC, present), 0, "WFATPC" , 0, 9, 9, SigIeWFATPC, {0, 80, 242, 8, 0}, 5, DOT11F_EID_WFATPC, 0, },
+        {offsetof(tDot11fProbeRequest, P2PProbeReq), offsetof(tDot11fIEP2PProbeReq, present), 0, "P2PProbeReq" , 0, 6, 43, SigIeP2PProbeReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPROBEREQ, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackProbeRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ProbeRequest, IES_ProbeRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Unpacked the ProbeRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestedInfo:\n"));
+        if (!pFrm->RequestedInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_requested_eids: %d.\n"), pFrm->RequestedInfo.num_requested_eids);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->RequestedInfo.requested_eids, pFrm->RequestedInfo.num_requested_eids);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("WscProbeReq:\n"));
+        if (!pFrm->WscProbeReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Version:\n"));
+            if (!pFrm->WscProbeReq.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("minor (4): %d\n"), pFrm->WscProbeReq.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("major (4): %d\n"), pFrm->WscProbeReq.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestType:\n"));
+            if (!pFrm->WscProbeReq.RequestType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestType.reqType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscProbeReq.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("UUID_E:\n"));
+            if (!pFrm->WscProbeReq.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscProbeReq.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RFBands:\n"));
+            if (!pFrm->WscProbeReq.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("AssociationState:\n"));
+            if (!pFrm->WscProbeReq.AssociationState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.AssociationState.state, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ConfigurationError:\n"));
+            if (!pFrm->WscProbeReq.ConfigurationError.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.ConfigurationError.error, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscProbeReq.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscProbeReq.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_name: %d.\n"), pFrm->WscProbeReq.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.Manufacturer.name, pFrm->WscProbeReq.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ModelName:\n"));
+            if (!pFrm->WscProbeReq.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.ModelName.text, pFrm->WscProbeReq.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscProbeReq.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.ModelNumber.text, pFrm->WscProbeReq.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DeviceName:\n"));
+            if (!pFrm->WscProbeReq.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.DeviceName.text, pFrm->WscProbeReq.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscProbeReq.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Version2:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("minor (4): %d\n"), pFrm->WscProbeReq.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("major (4): %d\n"), pFrm->WscProbeReq.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestDeviceType:\n"));
+            if (!pFrm->WscProbeReq.RequestDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.sub_category, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("WFATPC:\n"));
+        if (!pFrm->WFATPC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WFATPC.txPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WFATPC.linkMargin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PProbeReq:\n"));
+        if (!pFrm->P2PProbeReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProbeReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PProbeReq.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ListenChannel:\n"));
+            if (!pFrm->P2PProbeReq.ListenChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PProbeReq.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PProbeReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.channel, 1);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProbeRequest. */
+
+    static const tFFDefn FFS_ProbeResponse[] = {
+        { "TimeStamp", offsetof(tDot11fProbeResponse, TimeStamp), SigFfTimeStamp , DOT11F_FF_TIMESTAMP_LEN, },
+        { "BeaconInterval", offsetof(tDot11fProbeResponse, BeaconInterval), SigFfBeaconInterval , DOT11F_FF_BEACONINTERVAL_LEN, },
+        { "Capabilities", offsetof(tDot11fProbeResponse, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ProbeResponse[] = {
+        {offsetof(tDot11fProbeResponse, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fProbeResponse, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fProbeResponse, FHParamSet), offsetof(tDot11fIEFHParamSet, present), 0, "FHParamSet" , 0, 7, 7, SigIeFHParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMSET, 0, },
+        {offsetof(tDot11fProbeResponse, DSParams), offsetof(tDot11fIEDSParams, present), 0, "DSParams" , 0, 3, 3, SigIeDSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_DSPARAMS, 0, },
+        {offsetof(tDot11fProbeResponse, CFParams), offsetof(tDot11fIECFParams, present), 0, "CFParams" , 0, 8, 8, SigIeCFParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CFPARAMS, 0, },
+        {offsetof(tDot11fProbeResponse, IBSSParams), offsetof(tDot11fIEIBSSParams, present), 0, "IBSSParams" , 0, 4, 4, SigIeIBSSParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_IBSSPARAMS, 0, },
+        {offsetof(tDot11fProbeResponse, Country), offsetof(tDot11fIECountry, present), 0, "Country" , 0, 5, 257, SigIeCountry, {0, 0, 0, 0, 0}, 0, DOT11F_EID_COUNTRY, 0, },
+        {offsetof(tDot11fProbeResponse, FHParams), offsetof(tDot11fIEFHParams, present), 0, "FHParams" , 0, 4, 4, SigIeFHParams, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPARAMS, 0, },
+        {offsetof(tDot11fProbeResponse, FHPattTable), offsetof(tDot11fIEFHPattTable, present), 0, "FHPattTable" , 0, 6, 257, SigIeFHPattTable, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FHPATTTABLE, 0, },
+        {offsetof(tDot11fProbeResponse, PowerConstraints), offsetof(tDot11fIEPowerConstraints, present), 0, "PowerConstraints" , 0, 3, 3, SigIePowerConstraints, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCONSTRAINTS, 0, },
+        {offsetof(tDot11fProbeResponse, ChanSwitchAnn), offsetof(tDot11fIEChanSwitchAnn, present), 0, "ChanSwitchAnn" , 0, 5, 5, SigIeChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANSWITCHANN, 0, },
+        {offsetof(tDot11fProbeResponse, Quiet), offsetof(tDot11fIEQuiet, present), 0, "Quiet" , 0, 8, 8, SigIeQuiet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QUIET, 0, },
+        {offsetof(tDot11fProbeResponse, TPCReport), offsetof(tDot11fIETPCReport, present), 0, "TPCReport" , 0, 4, 4, SigIeTPCReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREPORT, 0, },
+        {offsetof(tDot11fProbeResponse, ERPInfo), offsetof(tDot11fIEERPInfo, present), 0, "ERPInfo" , 0, 3, 3, SigIeERPInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_ERPINFO, 0, },
+        {offsetof(tDot11fProbeResponse, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fProbeResponse, RSN), offsetof(tDot11fIERSN, present), 0, "RSN" , 0, 8, 112, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, },
+        {offsetof(tDot11fProbeResponse, QBSSLoad), offsetof(tDot11fIEQBSSLoad, present), 0, "QBSSLoad" , 0, 7, 7, SigIeQBSSLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QBSSLOAD, 0, },
+        {offsetof(tDot11fProbeResponse, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fProbeResponse, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fProbeResponse, APChannelReport), offsetof(tDot11fIEAPChannelReport, present), 0, "APChannelReport" , 0, 3, 53, SigIeAPChannelReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_APCHANNELREPORT, 0, },
+        {offsetof(tDot11fProbeResponse, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fProbeResponse, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fProbeResponse, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fProbeResponse, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fProbeResponse, ExtChanSwitchAnn), offsetof(tDot11fIEExtChanSwitchAnn, present), 0, "ExtChanSwitchAnn" , 0, 3, 3, SigIeExtChanSwitchAnn, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTCHANSWITCHANN, 0, },
+        {offsetof(tDot11fProbeResponse, WMMInfoAp), offsetof(tDot11fIEWMMInfoAp, present), 0, "WMMInfoAp" , 0, 9, 9, SigIeWMMInfoAp, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOAP, 0, },
+        {offsetof(tDot11fProbeResponse, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fProbeResponse, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fProbeResponse, WAPI), offsetof(tDot11fIEWAPI, present), 0, "WAPI" , 0, 14, 112, SigIeWAPI, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPI, 0, },
+        {offsetof(tDot11fProbeResponse, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fProbeResponse, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fProbeResponse, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fProbeResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fProbeResponse, WscProbeRes), offsetof(tDot11fIEWscProbeRes, present), 0, "WscProbeRes" , 0, 6, 319, SigIeWscProbeRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCPROBERES, 0, },
+        {offsetof(tDot11fProbeResponse, P2PProbeRes), offsetof(tDot11fIEP2PProbeRes, present), 0, "P2PProbeRes" , 0, 6, 1141, SigIeP2PProbeRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPROBERES, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackProbeResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ProbeResponse, IES_ProbeResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Unpacked the ProbeResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WscProbeRes:\n"));
+        if (!pFrm->WscProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscProbeRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("minor (4): %d\n"), pFrm->WscProbeRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("major (4): %d\n"), pFrm->WscProbeRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WPSState:\n"));
+            if (!pFrm->WscProbeRes.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscProbeRes.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscProbeRes.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscProbeRes.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscProbeRes.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscProbeRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("UUID_E:\n"));
+            if (!pFrm->WscProbeRes.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscProbeRes.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_name: %d.\n"), pFrm->WscProbeRes.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.Manufacturer.name, pFrm->WscProbeRes.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ModelName:\n"));
+            if (!pFrm->WscProbeRes.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.ModelName.text, pFrm->WscProbeRes.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscProbeRes.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.ModelNumber.text, pFrm->WscProbeRes.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SerialNumber:\n"));
+            if (!pFrm->WscProbeRes.SerialNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.SerialNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.SerialNumber.text, pFrm->WscProbeRes.SerialNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscProbeRes.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DeviceName:\n"));
+            if (!pFrm->WscProbeRes.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.DeviceName.text, pFrm->WscProbeRes.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscProbeRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RFBands:\n"));
+            if (!pFrm->WscProbeRes.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscProbeRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("minor (4): %d\n"), pFrm->WscProbeRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("major (4): %d\n"), pFrm->WscProbeRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PProbeRes:\n"));
+        if (!pFrm->P2PProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProbeRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PProbeRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PProbeRes.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_NoADesc: %d.\n"), pFrm->P2PProbeRes.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.NoticeOfAbsence.NoADesc, pFrm->P2PProbeRes.NoticeOfAbsence.num_NoADesc);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PProbeRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PGroupInfo:\n"));
+            if (!pFrm->P2PProbeRes.P2PGroupInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_P2PClientInfoDesc: %d.\n"), pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProbeResponse. */
+
+    static const tFFDefn FFS_ProvisionDiscoveryReq[] = {
+        { "Category", offsetof(tDot11fProvisionDiscoveryReq, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fProvisionDiscoveryReq, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fProvisionDiscoveryReq, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fProvisionDiscoveryReq, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fProvisionDiscoveryReq, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ProvisionDiscoveryReq[] = {
+        {offsetof(tDot11fProvisionDiscoveryReq, P2PProvisionDiscoveryReq), offsetof(tDot11fIEP2PProvisionDiscoveryReq, present), 0, "P2PProvisionDiscoveryReq" , 0, 6, 107, SigIeP2PProvisionDiscoveryReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPROVISIONDISCOVERYREQ, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackProvisionDiscoveryReq(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProvisionDiscoveryReq *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ProvisionDiscoveryReq, IES_ProvisionDiscoveryReq, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Unpacked the ProvisionDiscoveryReq:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PProvisionDiscoveryReq:\n"));
+        if (!pFrm->P2PProvisionDiscoveryReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("num_text: %d.\n"), pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* ) pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PProvisionDiscoveryReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* ) pFrm->P2PProvisionDiscoveryReq.P2PGroupId.ssid, pFrm->P2PProvisionDiscoveryReq.P2PGroupId.num_ssid);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProvisionDiscoveryReq. */
+
+    static const tFFDefn FFS_ProvisionDiscoveryRes[] = {
+        { "Category", offsetof(tDot11fProvisionDiscoveryRes, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fProvisionDiscoveryRes, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "P2POUI", offsetof(tDot11fProvisionDiscoveryRes, P2POUI), SigFfP2POUI , DOT11F_FF_P2POUI_LEN, },
+        { "P2POUISubType", offsetof(tDot11fProvisionDiscoveryRes, P2POUISubType), SigFfP2POUISubType , DOT11F_FF_P2POUISUBTYPE_LEN, },
+        { "DialogToken", offsetof(tDot11fProvisionDiscoveryRes, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ProvisionDiscoveryRes[] = {
+        {offsetof(tDot11fProvisionDiscoveryRes, P2PWSCProvisionDiscoveryRes), offsetof(tDot11fIEP2PWSCProvisionDiscoveryRes, present), 0, "P2PWSCProvisionDiscoveryRes" , 0, 6, 12, SigIeP2PWSCProvisionDiscoveryRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_P2PWSCPROVISIONDISCOVERYRES, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackProvisionDiscoveryRes(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProvisionDiscoveryRes *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ProvisionDiscoveryRes, IES_ProvisionDiscoveryRes, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Unpacked the ProvisionDiscoveryRes:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2PWSCProvisionDiscoveryRes:\n"));
+        if (!pFrm->P2PWSCProvisionDiscoveryRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("ConfigMethods:\n"));
+            if (!pFrm->P2PWSCProvisionDiscoveryRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2PWSCProvisionDiscoveryRes.ConfigMethods.methods, 2);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProvisionDiscoveryRes. */
+
+    static const tFFDefn FFS_RadioMeasurementReport[] = {
+        { "Category", offsetof(tDot11fRadioMeasurementReport, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fRadioMeasurementReport, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fRadioMeasurementReport, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_RadioMeasurementReport[] = {
+        {offsetof(tDot11fRadioMeasurementReport, MeasurementReport), offsetof(tDot11fIEMeasurementReport, present), offsetof(tDot11fRadioMeasurementReport, num_MeasurementReport), "MeasurementReport" , 4, 5, 31, SigIeMeasurementReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTREPORT, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackRadioMeasurementReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRadioMeasurementReport *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_RadioMeasurementReport, IES_RadioMeasurementReport, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Unpacked the RadioMeasurementReport:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_MeasurementReport; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("MeasurementReport[%d]:\n"), i);
+            if (!pFrm->MeasurementReport[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("late (1): %d\n"), pFrm->MeasurementReport[i].late);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("incapable (1): %d\n"), pFrm->MeasurementReport[i].incapable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("refused (1): %d\n"), pFrm->MeasurementReport[i].refused);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unused (5): %d\n"), pFrm->MeasurementReport[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].type, 1);
+                switch (pFrm->MeasurementReport[i].type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.meas_duration, 2);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("bss (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.bss);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("ofdm_preamble (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.ofdm_preamble);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unid_signal (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.unid_signal);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("rader (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.rader);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unmeasured (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.unmeasured);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unused (3): %d\n"), pFrm->MeasurementReport[i].report.Basic.unused);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.cca_busy_fraction, 1);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi0_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi1_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi2_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi3_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi4_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi5_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi6_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi7_density, 1);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.meas_duration, 2);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("condensed_PHY (7): %d\n"), pFrm->MeasurementReport[i].report.Beacon.condensed_PHY);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("reported_frame_type (1): %d\n"), pFrm->MeasurementReport[i].report.Beacon.reported_frame_type);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.RCPI, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.RSNI, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.BSSID, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.antenna_id, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.parent_TSF, 4);
+                    break;
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackRadioMeasurementReport. */
+
+    static const tFFDefn FFS_RadioMeasurementRequest[] = {
+        { "Category", offsetof(tDot11fRadioMeasurementRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fRadioMeasurementRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fRadioMeasurementRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "NumOfRepetitions", offsetof(tDot11fRadioMeasurementRequest, NumOfRepetitions), SigFfNumOfRepetitions , DOT11F_FF_NUMOFREPETITIONS_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_RadioMeasurementRequest[] = {
+        {offsetof(tDot11fRadioMeasurementRequest, MeasurementRequest), offsetof(tDot11fIEMeasurementRequest, present), offsetof(tDot11fRadioMeasurementRequest, num_MeasurementRequest), "MeasurementRequest" , 2, 16, 18, SigIeMeasurementRequest, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTREQUEST, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackRadioMeasurementRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRadioMeasurementRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_RadioMeasurementRequest, IES_RadioMeasurementRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Unpacked the RadioMeasurementRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("NumOfRepetitions:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->NumOfRepetitions.repetitions, 2);
+        for (i = 0; i < pFrm->num_MeasurementRequest; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("MeasurementRequest[%d]:\n"), i);
+            if (!pFrm->MeasurementRequest[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("parallel (1): %d\n"), pFrm->MeasurementRequest[i].parallel);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("enable (1): %d\n"), pFrm->MeasurementRequest[i].enable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("request (1): %d\n"), pFrm->MeasurementRequest[i].request);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("report (1): %d\n"), pFrm->MeasurementRequest[i].report);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("durationMandatory (1): %d\n"), pFrm->MeasurementRequest[i].durationMandatory);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("unused (3): %d\n"), pFrm->MeasurementRequest[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_type, 1);
+                switch (pFrm->MeasurementRequest[i].measurement_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_duration, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_duration, 2);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_duration, 2);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.randomization, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_mode, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.BSSID, 6);
+                    break;
+                }
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackRadioMeasurementRequest. */
+
+    static const tFFDefn FFS_ReAssocRequest[] = {
+        { "Capabilities", offsetof(tDot11fReAssocRequest, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+        { "ListenInterval", offsetof(tDot11fReAssocRequest, ListenInterval), SigFfListenInterval , DOT11F_FF_LISTENINTERVAL_LEN, },
+        { "CurrentAPAddress", offsetof(tDot11fReAssocRequest, CurrentAPAddress), SigFfCurrentAPAddress , DOT11F_FF_CURRENTAPADDRESS_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ReAssocRequest[] = {
+        {offsetof(tDot11fReAssocRequest, SSID), offsetof(tDot11fIESSID, present), 0, "SSID" , 0, 2, 34, SigIeSSID, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SSID, 1, },
+        {offsetof(tDot11fReAssocRequest, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fReAssocRequest, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fReAssocRequest, PowerCaps), offsetof(tDot11fIEPowerCaps, present), 0, "PowerCaps" , 0, 4, 4, SigIePowerCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_POWERCAPS, 0, },
+        {offsetof(tDot11fReAssocRequest, SuppChannels), offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels" , 0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPCHANNELS, 0, },
+        {offsetof(tDot11fReAssocRequest, RSNOpaque), offsetof(tDot11fIERSNOpaque, present), 0, "RSNOpaque" , 0, 8, 255, SigIeRSNOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNOPAQUE, 0, },
+        {offsetof(tDot11fReAssocRequest, QOSCapsStation), offsetof(tDot11fIEQOSCapsStation, present), 0, "QOSCapsStation" , 0, 3, 3, SigIeQOSCapsStation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_QOSCAPSSTATION, 0, },
+        {offsetof(tDot11fReAssocRequest, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fReAssocRequest, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fReAssocRequest, FTInfo), offsetof(tDot11fIEFTInfo, present), 0, "FTInfo" , 0, 84, 187, SigIeFTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FTINFO, 0, },
+        {offsetof(tDot11fReAssocRequest, RICDataDesc), offsetof(tDot11fIERICDataDesc, present), offsetof(tDot11fReAssocRequest, num_RICDataDesc), "RICDataDesc" , 2, 2, 550, SigIeRICDataDesc, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDATADESC, 0, },
+        {offsetof(tDot11fReAssocRequest, WPAOpaque), offsetof(tDot11fIEWPAOpaque, present), 0, "WPAOpaque" , 0, 8, 255, SigIeWPAOpaque, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPAOPAQUE, 0, },
+        {offsetof(tDot11fReAssocRequest, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fReAssocRequest, WMMCaps), offsetof(tDot11fIEWMMCaps, present), 0, "WMMCaps" , 0, 9, 9, SigIeWMMCaps, {0, 80, 242, 2, 5}, 5, DOT11F_EID_WMMCAPS, 0, },
+        {offsetof(tDot11fReAssocRequest, WMMInfoStation), offsetof(tDot11fIEWMMInfoStation, present), 0, "WMMInfoStation" , 0, 9, 9, SigIeWMMInfoStation, {0, 80, 242, 2, 0}, 5, DOT11F_EID_WMMINFOSTATION, 0, },
+        {offsetof(tDot11fReAssocRequest, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fReAssocRequest, WscIEOpaque), offsetof(tDot11fIEWscIEOpaque, present), 0, "WscIEOpaque" , 0, 8, 255, SigIeWscIEOpaque, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCIEOPAQUE, 0, },
+        {offsetof(tDot11fReAssocRequest, WAPIOpaque), offsetof(tDot11fIEWAPIOpaque, present), 0, "WAPIOpaque" , 0, 8, 255, SigIeWAPIOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_WAPIOPAQUE, 0, },
+        {offsetof(tDot11fReAssocRequest, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fReAssocRequest, CCXVersion), offsetof(tDot11fIECCXVersion, present), 0, "CCXVersion" , 0, 7, 7, SigIeCCXVersion, {0, 64, 150, 3, 0}, 4, DOT11F_EID_CCXVERSION, 0, },
+        {offsetof(tDot11fReAssocRequest, CCXCckmOpaque), offsetof(tDot11fIECCXCckmOpaque, present), 0, "CCXCckmOpaque" , 0, 12, 26, SigIeCCXCckmOpaque, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXCCKMOPAQUE, 0, },
+        {offsetof(tDot11fReAssocRequest, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), offsetof(tDot11fReAssocRequest, num_WMMTSPEC), "WMMTSPEC" , 4, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fReAssocRequest, CCXTrafStrmRateSet), offsetof(tDot11fIECCXTrafStrmRateSet, present), 0, "CCXTrafStrmRateSet" , 0, 7, 15, SigIeCCXTrafStrmRateSet, {0, 64, 150, 8, 0}, 4, DOT11F_EID_CCXTRAFSTRMRATESET, 0, },
+        {offsetof(tDot11fReAssocRequest, P2PIEOpaque), offsetof(tDot11fIEP2PIEOpaque, present), 0, "P2PIEOpaque" , 0, 8, 255, SigIeP2PIEOpaque, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PIEOPAQUE, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackReAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ReAssocRequest, IES_ReAssocRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Unpacked the ReAssocRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ListenInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->ListenInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CurrentAPAddress:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CurrentAPAddress.mac, 6);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PowerCaps:\n"));
+        if (!pFrm->PowerCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.minTxPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.maxTxPower, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SuppChannels:\n"));
+        if (!pFrm->SuppChannels.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_bands: %d.\n"), pFrm->SuppChannels.num_bands);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SuppChannels.bands, 2 * pFrm->SuppChannels.num_bands);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("QOSCapsStation:\n"));
+        if (!pFrm->QOSCapsStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("more_data_ack (1): %d\n"), pFrm->QOSCapsStation.more_data_ack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->QOSCapsStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->QOSCapsStation.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvo_uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WPAOpaque:\n"));
+        if (!pFrm->WPAOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WPAOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WPAOpaque.data, pFrm->WPAOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMInfoStation:\n"));
+        if (!pFrm->WMMInfoStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMInfoStation.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvo_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (1): %d\n"), pFrm->WMMInfoStation.reserved1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->WMMInfoStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (1): %d\n"), pFrm->WMMInfoStation.reserved2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WscIEOpaque:\n"));
+        if (!pFrm->WscIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WscIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WscIEOpaque.data, pFrm->WscIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WAPIOpaque:\n"));
+        if (!pFrm->WAPIOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WAPIOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WAPIOpaque.data, pFrm->WAPIOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXCckmOpaque:\n"));
+        if (!pFrm->CCXCckmOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->CCXCckmOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->CCXCckmOpaque.data, pFrm->CCXCckmOpaque.num_data);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("P2PIEOpaque:\n"));
+        if (!pFrm->P2PIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackReAssocRequest. */
+
+    static const tFFDefn FFS_ReAssocResponse[] = {
+        { "Capabilities", offsetof(tDot11fReAssocResponse, Capabilities), SigFfCapabilities , DOT11F_FF_CAPABILITIES_LEN, },
+        { "Status", offsetof(tDot11fReAssocResponse, Status), SigFfStatus , DOT11F_FF_STATUS_LEN, },
+        { "AID", offsetof(tDot11fReAssocResponse, AID), SigFfAID , DOT11F_FF_AID_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_ReAssocResponse[] = {
+        {offsetof(tDot11fReAssocResponse, SuppRates), offsetof(tDot11fIESuppRates, present), 0, "SuppRates" , 0, 2, 14, SigIeSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_SUPPRATES, 1, },
+        {offsetof(tDot11fReAssocResponse, ExtSuppRates), offsetof(tDot11fIEExtSuppRates, present), 0, "ExtSuppRates" , 0, 3, 14, SigIeExtSuppRates, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EXTSUPPRATES, 0, },
+        {offsetof(tDot11fReAssocResponse, EDCAParamSet), offsetof(tDot11fIEEDCAParamSet, present), 0, "EDCAParamSet" , 0, 20, 20, SigIeEDCAParamSet, {0, 0, 0, 0, 0}, 0, DOT11F_EID_EDCAPARAMSET, 0, },
+        {offsetof(tDot11fReAssocResponse, RCPIIE), offsetof(tDot11fIERCPIIE, present), 0, "RCPIIE" , 0, 3, 3, SigIeRCPIIE, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RCPIIE, 0, },
+        {offsetof(tDot11fReAssocResponse, RSNIIE), offsetof(tDot11fIERSNIIE, present), 0, "RSNIIE" , 0, 3, 3, SigIeRSNIIE, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNIIE, 0, },
+        {offsetof(tDot11fReAssocResponse, RRMEnabledCap), offsetof(tDot11fIERRMEnabledCap, present), 0, "RRMEnabledCap" , 0, 7, 7, SigIeRRMEnabledCap, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RRMENABLEDCAP, 0, },
+        {offsetof(tDot11fReAssocResponse, RSNOpaque), offsetof(tDot11fIERSNOpaque, present), 0, "RSNOpaque" , 0, 8, 255, SigIeRSNOpaque, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSNOPAQUE, 0, },
+        {offsetof(tDot11fReAssocResponse, MobilityDomain), offsetof(tDot11fIEMobilityDomain, present), 0, "MobilityDomain" , 0, 5, 5, SigIeMobilityDomain, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MOBILITYDOMAIN, 0, },
+        {offsetof(tDot11fReAssocResponse, FTInfo), offsetof(tDot11fIEFTInfo, present), 0, "FTInfo" , 0, 84, 187, SigIeFTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_FTINFO, 0, },
+        {offsetof(tDot11fReAssocResponse, RICDataDesc), offsetof(tDot11fIERICDataDesc, present), offsetof(tDot11fReAssocResponse, num_RICDataDesc), "RICDataDesc" , 2, 2, 550, SigIeRICDataDesc, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RICDATADESC, 0, },
+        {offsetof(tDot11fReAssocResponse, WPA), offsetof(tDot11fIEWPA, present), 0, "WPA" , 0, 8, 50, SigIeWPA, {0, 80, 242, 1, 0}, 4, DOT11F_EID_WPA, 0, },
+        {offsetof(tDot11fReAssocResponse, HTCaps), offsetof(tDot11fIEHTCaps, present), 0, "HTCaps" , 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTCAPS, 0, },
+        {offsetof(tDot11fReAssocResponse, HTInfo), offsetof(tDot11fIEHTInfo, present), 0, "HTInfo" , 0, 24, 56, SigIeHTInfo, {0, 0, 0, 0, 0}, 0, DOT11F_EID_HTINFO, 0, },
+        {offsetof(tDot11fReAssocResponse, WMMParams), offsetof(tDot11fIEWMMParams, present), 0, "WMMParams" , 0, 26, 26, SigIeWMMParams, {0, 80, 242, 2, 1}, 5, DOT11F_EID_WMMPARAMS, 0, },
+        {offsetof(tDot11fReAssocResponse, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
+        {offsetof(tDot11fReAssocResponse, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+        {offsetof(tDot11fReAssocResponse, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
+        {offsetof(tDot11fReAssocResponse, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), offsetof(tDot11fReAssocResponse, num_WMMTSPEC), "WMMTSPEC" , 4, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fReAssocResponse, CCXTrafStrmRateSet), offsetof(tDot11fIECCXTrafStrmRateSet, present), 0, "CCXTrafStrmRateSet" , 0, 7, 15, SigIeCCXTrafStrmRateSet, {0, 64, 150, 8, 0}, 4, DOT11F_EID_CCXTRAFSTRMRATESET, 0, },
+        {offsetof(tDot11fReAssocResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
+        {offsetof(tDot11fReAssocResponse, WscReassocRes), offsetof(tDot11fIEWscReassocRes, present), 0, "WscReassocRes" , 0, 6, 37, SigIeWscReassocRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCREASSOCRES, 0, },
+        {offsetof(tDot11fReAssocResponse, P2PAssocRes), offsetof(tDot11fIEP2PAssocRes, present), 0, "P2PAssocRes" , 0, 6, 17, SigIeP2PAssocRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PASSOCRES, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackReAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_ReAssocResponse, IES_ReAssocResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Unpacked the ReAssocResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->AID.associd, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RCPIIE:\n"));
+        if (!pFrm->RCPIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RCPIIE.rcpi, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNIIE:\n"));
+        if (!pFrm->RSNIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RSNIIE.rsni, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WscReassocRes:\n"));
+        if (!pFrm->WscReassocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscReassocRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscReassocRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscReassocRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscReassocRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscReassocRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscReassocRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscReassocRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("P2PAssocRes:\n"));
+        if (!pFrm->P2PAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PAssocRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PAssocRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackReAssocResponse. */
+
+    static const tFFDefn FFS_SMPowerSave[] = {
+        { "Category", offsetof(tDot11fSMPowerSave, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fSMPowerSave, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "SMPowerModeSet", offsetof(tDot11fSMPowerSave, SMPowerModeSet), SigFfSMPowerModeSet , DOT11F_FF_SMPOWERMODESET_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_SMPowerSave[] = {
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackSMPowerSave(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fSMPowerSave *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_SMPowerSave, IES_SMPowerSave, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Unpacked the SMPowerSave:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("SMPowerModeSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("PowerSave_En (1): %d\n"), pFrm->SMPowerModeSet.PowerSave_En);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Mode (1): %d\n"), pFrm->SMPowerModeSet.Mode);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("reserved (6): %d\n"), pFrm->SMPowerModeSet.reserved);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackSMPowerSave. */
+
+    static const tFFDefn FFS_TPCReport[] = {
+        { "Category", offsetof(tDot11fTPCReport, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fTPCReport, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fTPCReport, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_TPCReport[] = {
+        {offsetof(tDot11fTPCReport, TPCReport), offsetof(tDot11fIETPCReport, present), 0, "TPCReport" , 0, 4, 4, SigIeTPCReport, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREPORT, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackTPCReport(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fTPCReport *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_TPCReport, IES_TPCReport, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Unpacked the TPCReport:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackTPCReport. */
+
+    static const tFFDefn FFS_TPCRequest[] = {
+        { "Category", offsetof(tDot11fTPCRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fTPCRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fTPCRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_TPCRequest[] = {
+        {offsetof(tDot11fTPCRequest, TPCRequest), offsetof(tDot11fIETPCRequest, present), 0, "TPCRequest" , 0, 2, 2, SigIeTPCRequest, {0, 0, 0, 0, 0}, 0, DOT11F_EID_TPCREQUEST, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackTPCRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fTPCRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_TPCRequest, IES_TPCRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Unpacked the TPCRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("TPCRequest:\n"));
+        if (!pFrm->TPCRequest.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackTPCRequest. */
+
+    static const tFFDefn FFS_WMMAddTSRequest[] = {
+        { "Category", offsetof(tDot11fWMMAddTSRequest, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fWMMAddTSRequest, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fWMMAddTSRequest, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "StatusCode", offsetof(tDot11fWMMAddTSRequest, StatusCode), SigFfStatusCode , DOT11F_FF_STATUSCODE_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_WMMAddTSRequest[] = {
+        {offsetof(tDot11fWMMAddTSRequest, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 1, },
+        {offsetof(tDot11fWMMAddTSRequest, CCXTrafStrmRateSet), offsetof(tDot11fIECCXTrafStrmRateSet, present), 0, "CCXTrafStrmRateSet" , 0, 7, 15, SigIeCCXTrafStrmRateSet, {0, 64, 150, 8, 0}, 4, DOT11F_EID_CCXTRAFSTRMRATESET, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackWMMAddTSRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMAddTSRequest *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_WMMAddTSRequest, IES_WMMAddTSRequest, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Unpacked the WMMAddTSRequest:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMAddTSRequest. */
+
+    static const tFFDefn FFS_WMMAddTSResponse[] = {
+        { "Category", offsetof(tDot11fWMMAddTSResponse, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fWMMAddTSResponse, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fWMMAddTSResponse, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "StatusCode", offsetof(tDot11fWMMAddTSResponse, StatusCode), SigFfStatusCode , DOT11F_FF_STATUSCODE_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_WMMAddTSResponse[] = {
+        {offsetof(tDot11fWMMAddTSResponse, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
+        {offsetof(tDot11fWMMAddTSResponse, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackWMMAddTSResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMAddTSResponse *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_WMMAddTSResponse, IES_WMMAddTSResponse, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Unpacked the WMMAddTSResponse:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMAddTSResponse. */
+
+    static const tFFDefn FFS_WMMDelTS[] = {
+        { "Category", offsetof(tDot11fWMMDelTS, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
+        { "Action", offsetof(tDot11fWMMDelTS, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
+        { "DialogToken", offsetof(tDot11fWMMDelTS, DialogToken), SigFfDialogToken , DOT11F_FF_DIALOGTOKEN_LEN, },
+        { "StatusCode", offsetof(tDot11fWMMDelTS, StatusCode), SigFfStatusCode , DOT11F_FF_STATUSCODE_LEN, },
+    { NULL, 0, 0, 0,},
+    };
+
+    static const tIEDefn IES_WMMDelTS[] = {
+        {offsetof(tDot11fWMMDelTS, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), 0, "WMMTSPEC" , 0, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 1, },
+    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
+
+tANI_U32 dot11fUnpackWMMDelTS(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fWMMDelTS *pFrm)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    status = UnpackCore(pCtx, pBuf, nBuf, FFS_WMMDelTS, IES_WMMDelTS, ( tANI_U8* )pFrm, sizeof(*pFrm));
+
+    (void)i;
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Unpacked the WMMDelTS:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), pBuf, nBuf);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("to:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMDelTS. */
+
+static tANI_U32 UnpackCore(tpAniSirGlobal pCtx,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           const tFFDefn  FFs[],
+                           const tIEDefn  IEs[],
+                           tANI_U8 *pFrm,
+                           size_t   nFrm)
+{
+    const tFFDefn *pFf;
+    const tIEDefn *pIe;
+    tANI_U8   *pBufRemaining;
+    tANI_U32  nBufRemaining, status;
+    tANI_U8   eid, len;
+    tFRAMES_BOOL  *pfFound;
+    tANI_U32  countOffset = 0;
+
+    DOT11F_PARAMETER_CHECK(pBuf, nBuf, pFrm, nFrm);
+    (void)nFrm;
+
+    (void)pCtx;
+    status = DOT11F_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+
+    pIe = &IEs[0];
+    while (0xff != pIe->eid)
+    {
+        pfFound = (tFRAMES_BOOL*)(pFrm + pIe->offset + 
+                                  pIe->presenceOffset);
+        *pfFound = 0U;
+        if (pIe->countOffset)
+        {
+            *( tANI_U16* )(pFrm + pIe->countOffset) = 0U;
+        }
+        ++pIe;
+    }
+
+    pFf = &FFs[0];
+    while (pFf->size)
+    {
+        if (pFf->size > nBufRemaining)
+        {
+            FRAMES_LOG3(pCtx, FRLOGE, FRFL("Fixed field %s is %d b"
+                "ytes in size, but there are only %d bytes left i"
+                "n this frame.\n"), pFf->name, pFf->size,
+                 nBufRemaining);
+            FRAMES_DBG_BREAK();
+            return DOT11F_MISSING_FIXED_FIELD;
+        }
+
+        switch (pFf->sig)
+        {
+
+        case SigFfAID:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfAID* )(pFrm + pFf->offset ))->associd));
+            break;
+        case SigFfAction:
+            dot11fUnpackFfAction(pCtx, pBufRemaining, ( tDot11fFfAction* )(pFrm + pFf->offset ));
+            break;
+        case SigFfAddBAParameterSet:
+            dot11fUnpackFfAddBAParameterSet(pCtx, pBufRemaining, ( tDot11fFfAddBAParameterSet* )(pFrm + pFf->offset ));
+            break;
+        case SigFfAuthAlgo:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfAuthAlgo* )(pFrm + pFf->offset ))->algo));
+            break;
+        case SigFfAuthSeqNo:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfAuthSeqNo* )(pFrm + pFf->offset ))->no));
+            break;
+        case SigFfBAStartingSequenceControl:
+            dot11fUnpackFfBAStartingSequenceControl(pCtx, pBufRemaining, ( tDot11fFfBAStartingSequenceControl* )(pFrm + pFf->offset ));
+            break;
+        case SigFfBATimeout:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfBATimeout* )(pFrm + pFf->offset ))->timeout));
+            break;
+        case SigFfBeaconInterval:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfBeaconInterval* )(pFrm + pFf->offset ))->interval));
+            break;
+        case SigFfCapabilities:
+            dot11fUnpackFfCapabilities(pCtx, pBufRemaining, ( tDot11fFfCapabilities* )(pFrm + pFf->offset ));
+            break;
+        case SigFfCategory:
+            dot11fUnpackFfCategory(pCtx, pBufRemaining, ( tDot11fFfCategory* )(pFrm + pFf->offset ));
+            break;
+        case SigFfCurrentAPAddress:
+            dot11fUnpackFfCurrentAPAddress(pCtx, pBufRemaining, ( tDot11fFfCurrentAPAddress* )(pFrm + pFf->offset ));
+            break;
+        case SigFfDelBAParameterSet:
+            dot11fUnpackFfDelBAParameterSet(pCtx, pBufRemaining, ( tDot11fFfDelBAParameterSet* )(pFrm + pFf->offset ));
+            break;
+        case SigFfDialogToken:
+            dot11fUnpackFfDialogToken(pCtx, pBufRemaining, ( tDot11fFfDialogToken* )(pFrm + pFf->offset ));
+            break;
+        case SigFfLinkMargin:
+            dot11fUnpackFfLinkMargin(pCtx, pBufRemaining, ( tDot11fFfLinkMargin* )(pFrm + pFf->offset ));
+            break;
+        case SigFfListenInterval:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfListenInterval* )(pFrm + pFf->offset ))->interval));
+            break;
+        case SigFfMaxTxPower:
+            dot11fUnpackFfMaxTxPower(pCtx, pBufRemaining, ( tDot11fFfMaxTxPower* )(pFrm + pFf->offset ));
+            break;
+        case SigFfNumOfRepetitions:
+            dot11fUnpackFfNumOfRepetitions(pCtx, pBufRemaining, ( tDot11fFfNumOfRepetitions* )(pFrm + pFf->offset ));
+            break;
+        case SigFfP2POUI:
+            dot11fUnpackFfP2POUI(pCtx, pBufRemaining, ( tDot11fFfP2POUI* )(pFrm + pFf->offset ));
+            break;
+        case SigFfP2POUISubType:
+            dot11fUnpackFfP2POUISubType(pCtx, pBufRemaining, ( tDot11fFfP2POUISubType* )(pFrm + pFf->offset ));
+            break;
+        case SigFfRCPI:
+            dot11fUnpackFfRCPI(pCtx, pBufRemaining, ( tDot11fFfRCPI* )(pFrm + pFf->offset ));
+            break;
+        case SigFfRSNI:
+            dot11fUnpackFfRSNI(pCtx, pBufRemaining, ( tDot11fFfRSNI* )(pFrm + pFf->offset ));
+            break;
+        case SigFfReason:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfReason* )(pFrm + pFf->offset ))->code));
+            break;
+        case SigFfRxAntennaId:
+            dot11fUnpackFfRxAntennaId(pCtx, pBufRemaining, ( tDot11fFfRxAntennaId* )(pFrm + pFf->offset ));
+            break;
+        case SigFfSMPowerModeSet:
+            dot11fUnpackFfSMPowerModeSet(pCtx, pBufRemaining, ( tDot11fFfSMPowerModeSet* )(pFrm + pFf->offset ));
+            break;
+        case SigFfStatus:
+            dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfStatus* )(pFrm + pFf->offset ))->status));
+            break;
+        case SigFfStatusCode:
+            dot11fUnpackFfStatusCode(pCtx, pBufRemaining, ( tDot11fFfStatusCode* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTPCEleID:
+            dot11fUnpackFfTPCEleID(pCtx, pBufRemaining, ( tDot11fFfTPCEleID* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTPCEleLen:
+            dot11fUnpackFfTPCEleLen(pCtx, pBufRemaining, ( tDot11fFfTPCEleLen* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTSInfo:
+            dot11fUnpackFfTSInfo(pCtx, pBufRemaining, ( tDot11fFfTSInfo* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTimeStamp:
+            dot11fUnpackFfTimeStamp(pCtx, pBufRemaining, ( tDot11fFfTimeStamp* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTxAntennaId:
+            dot11fUnpackFfTxAntennaId(pCtx, pBufRemaining, ( tDot11fFfTxAntennaId* )(pFrm + pFf->offset ));
+            break;
+        case SigFfTxPower:
+            dot11fUnpackFfTxPower(pCtx, pBufRemaining, ( tDot11fFfTxPower* )(pFrm + pFf->offset ));
+            break;
+        default:
+            FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR: I don'"
+                "t know about the FF signature %d-- this is most "
+                "likely a 'framesc' bug.\n"), pFf->sig);
+            return DOT11F_INTERNAL_ERROR;
+        }
+
+        pBufRemaining += pFf->size;
+        nBufRemaining -= pFf->size;
+        ++pFf;
+    }
+
+    while (nBufRemaining)
+    {
+        if (1 == nBufRemaining)
+        {
+            FRAMES_LOG0(pCtx, FRLOGE, FRFL("This frame reports "
+                "only one byte remaining after it's fixed fields.\n"));
+            status |= DOT11F_INCOMPLETE_IE;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        pIe = FindIEDefn(pCtx, pBufRemaining, nBufRemaining, IEs);
+
+        eid = *pBufRemaining++; --nBufRemaining;
+        len = *pBufRemaining++; --nBufRemaining;
+
+        if (pIe && pIe->noui)
+        {
+            if (pIe->noui > nBufRemaining)
+            {
+                FRAMES_LOG3(pCtx, FRLOGW, FRFL("IE %d reports "
+                    "length %d, but it has an OUI of %d bytes.\n"),
+                    eid, len, pIe->noui);
+                FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+                FRAMES_LOG2(pCtx, FRLOG1, FRFL("We've parsed %d by"
+                    "tes of this buffer, and show %d left.\n"),                    pBufRemaining - pBuf, nBufRemaining);
+                status |= DOT11F_INCOMPLETE_IE;
+                FRAMES_DBG_BREAK();
+                goto MandatoryCheck;
+            }
+            pBufRemaining += pIe->noui;
+            nBufRemaining -= pIe->noui;
+            len           -= pIe->noui;
+        }
+
+        if (len > nBufRemaining)
+        {
+            FRAMES_LOG3(pCtx, FRLOGW, FRFL("IE %d reports length %"
+                "d, but there are only %d bytes remaining in this"
+                " frame.\n"), eid, len, nBufRemaining);
+            FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+            FRAMES_LOG2(pCtx, FRLOG1, FRFL("We've parsed %d by"
+                "tes of this buffer, and show %d left.\n"),                pBufRemaining - pBuf, nBufRemaining);
+            status |= DOT11F_INCOMPLETE_IE;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        if (pIe)
+        {
+            if (nBufRemaining < pIe->minSize - pIe->noui - 2U)
+            {
+                FRAMES_LOG3(pCtx, FRLOGW, FRFL("The IE %s must be "
+                    "at least %d bytes in size, but there are onl"
+                    "y %d bytes remaining in this frame.\n"),
+                    pIe->name, pIe->minSize, nBufRemaining);
+                FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+                status |= DOT11F_INCOMPLETE_IE;
+                FRAMES_DBG_BREAK();
+                goto MandatoryCheck;
+            }
+            else
+            {
+                if (len > pIe->maxSize - pIe->noui - 2U){
+                FRAMES_LOG1(pCtx, FRLOGW, FRFL("The IE %s reports "
+                    "an unexpectedly large size; it is presumably "
+                    "more up-to-date than this parser, but this wa"
+                    "rning may also indicate a corrupt frame.\n"),
+                    pIe->name);
+                FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+                }
+
+        countOffset = ( (0 != pIe->arraybound) * ( *(tANI_U16* )(pFrm + pIe->countOffset)));
+                switch (pIe->sig)
+                {
+                case SigIeAPName:
+                        status |= dot11fUnpackIeAPName(pCtx, pBufRemaining, len, ( tDot11fIEAPName* )(pFrm + pIe->offset + sizeof(tDot11fIEAPName)*countOffset) );
+                            break;
+                case SigIeBPIndicator:
+                        status |= dot11fUnpackIeBPIndicator(pCtx, pBufRemaining, len, ( tDot11fIEBPIndicator* )(pFrm + pIe->offset + sizeof(tDot11fIEBPIndicator)*countOffset) );
+                            break;
+                case SigIeCondensedCountryStr:
+                        status |= dot11fUnpackIeCondensedCountryStr(pCtx, pBufRemaining, len, ( tDot11fIECondensedCountryStr* )(pFrm + pIe->offset + sizeof(tDot11fIECondensedCountryStr)*countOffset) );
+                            break;
+                case SigIeGTK:
+                        status |= dot11fUnpackIeGTK(pCtx, pBufRemaining, len, ( tDot11fIEGTK* )(pFrm + pIe->offset + sizeof(tDot11fIEGTK)*countOffset) );
+                            break;
+                case SigIeHCF:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIEHCF* )(pFrm + pIe->offset + sizeof( tDot11fIEHCF)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIEHCF* )(pFrm + pIe->offset + sizeof(tDot11fIEHCF)*countOffset ) )->enabled) );
+                            break;
+                case SigIeLLAttr:
+                        status |= dot11fUnpackIeLLAttr(pCtx, pBufRemaining, len, ( tDot11fIELLAttr* )(pFrm + pIe->offset + sizeof(tDot11fIELLAttr)*countOffset) );
+                            break;
+                case SigIeLoadBalance:
+                        status |= dot11fUnpackIeLoadBalance(pCtx, pBufRemaining, len, ( tDot11fIELoadBalance* )(pFrm + pIe->offset + sizeof(tDot11fIELoadBalance)*countOffset) );
+                            break;
+                case SigIeLoadInfo:
+                        status |= dot11fUnpackIeLoadInfo(pCtx, pBufRemaining, len, ( tDot11fIELoadInfo* )(pFrm + pIe->offset + sizeof(tDot11fIELoadInfo)*countOffset) );
+                            break;
+                case SigIePropAssocType:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIEPropAssocType* )(pFrm + pIe->offset + sizeof( tDot11fIEPropAssocType)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIEPropAssocType* )(pFrm + pIe->offset + sizeof(tDot11fIEPropAssocType)*countOffset ) )->type) );
+                            break;
+                case SigIePropCapability:
+                        status |= dot11fUnpackIePropCapability(pCtx, pBufRemaining, len, ( tDot11fIEPropCapability* )(pFrm + pIe->offset + sizeof(tDot11fIEPropCapability)*countOffset) );
+                            break;
+                case SigIePropChannSwitchAnn:
+                        status |= dot11fUnpackIePropChannSwitchAnn(pCtx, pBufRemaining, len, ( tDot11fIEPropChannSwitchAnn* )(pFrm + pIe->offset + sizeof(tDot11fIEPropChannSwitchAnn)*countOffset) );
+                            break;
+                case SigIePropEDCAParams:
+                        status |= dot11fUnpackIePropEDCAParams(pCtx, pBufRemaining, len, ( tDot11fIEPropEDCAParams* )(pFrm + pIe->offset + sizeof(tDot11fIEPropEDCAParams)*countOffset) );
+                            break;
+                case SigIePropQuietBSS:
+                        status |= dot11fUnpackIePropQuietBSS(pCtx, pBufRemaining, len, ( tDot11fIEPropQuietBSS* )(pFrm + pIe->offset + sizeof(tDot11fIEPropQuietBSS)*countOffset) );
+                            break;
+                case SigIePropSuppRates:
+                        status |= dot11fUnpackIePropSuppRates(pCtx, pBufRemaining, len, ( tDot11fIEPropSuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIEPropSuppRates)*countOffset) );
+                            break;
+                case SigIeR0KH_ID:
+                        status |= dot11fUnpackIeR0KH_ID(pCtx, pBufRemaining, len, ( tDot11fIER0KH_ID* )(pFrm + pIe->offset + sizeof(tDot11fIER0KH_ID)*countOffset) );
+                            break;
+                case SigIeR1KH_ID:
+                        status |= dot11fUnpackIeR1KH_ID(pCtx, pBufRemaining, len, ( tDot11fIER1KH_ID* )(pFrm + pIe->offset + sizeof(tDot11fIER1KH_ID)*countOffset) );
+                            break;
+                case SigIeTSFInfo:
+                        status |= dot11fUnpackIeTSFInfo(pCtx, pBufRemaining, len, ( tDot11fIETSFInfo* )(pFrm + pIe->offset + sizeof(tDot11fIETSFInfo)*countOffset) );
+                            break;
+                case SigIeTaurus:
+                        status |= dot11fUnpackIeTaurus(pCtx, pBufRemaining, len, ( tDot11fIETaurus* )(pFrm + pIe->offset + sizeof(tDot11fIETaurus)*countOffset) );
+                            break;
+                case SigIeTitan:
+                        status |= dot11fUnpackIeTitan(pCtx, pBufRemaining, len, ( tDot11fIETitan* )(pFrm + pIe->offset + sizeof(tDot11fIETitan)*countOffset) );
+                            break;
+                case SigIeTriggerStaBgScan:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIETriggerStaBgScan* )(pFrm + pIe->offset + sizeof( tDot11fIETriggerStaBgScan)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIETriggerStaBgScan* )(pFrm + pIe->offset + sizeof(tDot11fIETriggerStaBgScan)*countOffset ) )->enable) );
+                            break;
+                case SigIeVersion:
+                        status |= dot11fUnpackIeVersion(pCtx, pBufRemaining, len, ( tDot11fIEVersion* )(pFrm + pIe->offset + sizeof(tDot11fIEVersion)*countOffset) );
+                            break;
+                case SigIeWDS:
+                        status |= dot11fUnpackIeWDS(pCtx, pBufRemaining, len, ( tDot11fIEWDS* )(pFrm + pIe->offset + sizeof(tDot11fIEWDS)*countOffset) );
+                            break;
+                case SigIeAPChannelReport:
+                        status |= dot11fUnpackIeAPChannelReport(pCtx, pBufRemaining, len, ( tDot11fIEAPChannelReport* )(pFrm + pIe->offset + sizeof(tDot11fIEAPChannelReport)*countOffset) );
+                            break;
+                case SigIeBcnReportingDetail:
+                        status |= dot11fUnpackIeBcnReportingDetail(pCtx, pBufRemaining, len, ( tDot11fIEBcnReportingDetail* )(pFrm + pIe->offset + sizeof(tDot11fIEBcnReportingDetail)*countOffset) );
+                            break;
+                case SigIeBeaconReportFrmBody:
+                        status |= dot11fUnpackIeBeaconReportFrmBody(pCtx, pBufRemaining, len, ( tDot11fIEBeaconReportFrmBody* )(pFrm + pIe->offset + sizeof(tDot11fIEBeaconReportFrmBody)*countOffset) );
+                            break;
+                case SigIeBeaconReporting:
+                        status |= dot11fUnpackIeBeaconReporting(pCtx, pBufRemaining, len, ( tDot11fIEBeaconReporting* )(pFrm + pIe->offset + sizeof(tDot11fIEBeaconReporting)*countOffset) );
+                            break;
+                case SigIeMeasurementPilot:
+                        status |= dot11fUnpackIeMeasurementPilot(pCtx, pBufRemaining, len, ( tDot11fIEMeasurementPilot* )(pFrm + pIe->offset + sizeof(tDot11fIEMeasurementPilot)*countOffset) );
+                            break;
+                case SigIeMultiBssid:
+                        status |= dot11fUnpackIeMultiBssid(pCtx, pBufRemaining, len, ( tDot11fIEMultiBssid* )(pFrm + pIe->offset + sizeof(tDot11fIEMultiBssid)*countOffset) );
+                            break;
+                case SigIeRICData:
+                        status |= dot11fUnpackIeRICData(pCtx, pBufRemaining, len, ( tDot11fIERICData* )(pFrm + pIe->offset + sizeof(tDot11fIERICData)*countOffset) );
+                            break;
+                case SigIeRICDescriptor:
+                        status |= dot11fUnpackIeRICDescriptor(pCtx, pBufRemaining, len, ( tDot11fIERICDescriptor* )(pFrm + pIe->offset + sizeof(tDot11fIERICDescriptor)*countOffset) );
+                            break;
+                case SigIeRRMEnabledCap:
+                        status |= dot11fUnpackIeRRMEnabledCap(pCtx, pBufRemaining, len, ( tDot11fIERRMEnabledCap* )(pFrm + pIe->offset + sizeof(tDot11fIERRMEnabledCap)*countOffset) );
+                            break;
+                case SigIeRequestedInfo:
+                        status |= dot11fUnpackIeRequestedInfo(pCtx, pBufRemaining, len, ( tDot11fIERequestedInfo* )(pFrm + pIe->offset + sizeof(tDot11fIERequestedInfo)*countOffset) );
+                            break;
+                case SigIeSSID:
+                        status |= dot11fUnpackIeSSID(pCtx, pBufRemaining, len, ( tDot11fIESSID* )(pFrm + pIe->offset + sizeof(tDot11fIESSID)*countOffset) );
+                            break;
+                case SigIeSchedule:
+                        status |= dot11fUnpackIeSchedule(pCtx, pBufRemaining, len, ( tDot11fIESchedule* )(pFrm + pIe->offset + sizeof(tDot11fIESchedule)*countOffset) );
+                            break;
+                case SigIeTCLAS:
+                        status |= dot11fUnpackIeTCLAS(pCtx, pBufRemaining, len, ( tDot11fIETCLAS* )(pFrm + pIe->offset + sizeof(tDot11fIETCLAS)*countOffset) );
+                            break;
+                case SigIeTCLASSPROC:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIETCLASSPROC* )(pFrm + pIe->offset + sizeof( tDot11fIETCLASSPROC)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIETCLASSPROC* )(pFrm + pIe->offset + sizeof(tDot11fIETCLASSPROC)*countOffset ) )->processing) );
+                            break;
+                case SigIeTSDelay:
+                        status |= dot11fUnpackIeTSDelay(pCtx, pBufRemaining, len, ( tDot11fIETSDelay* )(pFrm + pIe->offset + sizeof(tDot11fIETSDelay)*countOffset) );
+                            break;
+                case SigIeTSPEC:
+                        status |= dot11fUnpackIeTSPEC(pCtx, pBufRemaining, len, ( tDot11fIETSPEC* )(pFrm + pIe->offset + sizeof(tDot11fIETSPEC)*countOffset) );
+                            break;
+                case SigIeWMMSchedule:
+                        status |= dot11fUnpackIeWMMSchedule(pCtx, pBufRemaining, len, ( tDot11fIEWMMSchedule* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMSchedule)*countOffset) );
+                            break;
+                case SigIeWMMTCLAS:
+                        status |= dot11fUnpackIeWMMTCLAS(pCtx, pBufRemaining, len, ( tDot11fIEWMMTCLAS* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMTCLAS)*countOffset) );
+                            break;
+                case SigIeWMMTCLASPROC:
+                        status |= dot11fUnpackIeWMMTCLASPROC(pCtx, pBufRemaining, len, ( tDot11fIEWMMTCLASPROC* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMTCLASPROC)*countOffset) );
+                            break;
+                case SigIeWMMTSDelay:
+                        status |= dot11fUnpackIeWMMTSDelay(pCtx, pBufRemaining, len, ( tDot11fIEWMMTSDelay* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMTSDelay)*countOffset) );
+                            break;
+                case SigIeWMMTSPEC:
+                        status |= dot11fUnpackIeWMMTSPEC(pCtx, pBufRemaining, len, ( tDot11fIEWMMTSPEC* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMTSPEC)*countOffset) );
+                            break;
+                case SigIeAirgo:
+                        status |= dot11fUnpackIeAirgo(pCtx, pBufRemaining, len, ( tDot11fIEAirgo* )(pFrm + pIe->offset + sizeof(tDot11fIEAirgo)*countOffset) );
+                            break;
+                case SigIeCCXCckmOpaque:
+                        status |= dot11fUnpackIeCCXCckmOpaque(pCtx, pBufRemaining, len, ( tDot11fIECCXCckmOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIECCXCckmOpaque)*countOffset) );
+                            break;
+                case SigIeCCXRadMgmtCap:
+                        status |= dot11fUnpackIeCCXRadMgmtCap(pCtx, pBufRemaining, len, ( tDot11fIECCXRadMgmtCap* )(pFrm + pIe->offset + sizeof(tDot11fIECCXRadMgmtCap)*countOffset) );
+                            break;
+                case SigIeCCXTrafStrmMet:
+                        status |= dot11fUnpackIeCCXTrafStrmMet(pCtx, pBufRemaining, len, ( tDot11fIECCXTrafStrmMet* )(pFrm + pIe->offset + sizeof(tDot11fIECCXTrafStrmMet)*countOffset) );
+                            break;
+                case SigIeCCXTrafStrmRateSet:
+                        status |= dot11fUnpackIeCCXTrafStrmRateSet(pCtx, pBufRemaining, len, ( tDot11fIECCXTrafStrmRateSet* )(pFrm + pIe->offset + sizeof(tDot11fIECCXTrafStrmRateSet)*countOffset) );
+                            break;
+                case SigIeCCXTxmitPower:
+                        status |= dot11fUnpackIeCCXTxmitPower(pCtx, pBufRemaining, len, ( tDot11fIECCXTxmitPower* )(pFrm + pIe->offset + sizeof(tDot11fIECCXTxmitPower)*countOffset) );
+                            break;
+                case SigIeCCXVersion:
+                        status |= dot11fUnpackIeCCXVersion(pCtx, pBufRemaining, len, ( tDot11fIECCXVersion* )(pFrm + pIe->offset + sizeof(tDot11fIECCXVersion)*countOffset) );
+                            break;
+                case SigIeCFParams:
+                        status |= dot11fUnpackIeCFParams(pCtx, pBufRemaining, len, ( tDot11fIECFParams* )(pFrm + pIe->offset + sizeof(tDot11fIECFParams)*countOffset) );
+                            break;
+                case SigIeChallengeText:
+                        status |= dot11fUnpackIeChallengeText(pCtx, pBufRemaining, len, ( tDot11fIEChallengeText* )(pFrm + pIe->offset + sizeof(tDot11fIEChallengeText)*countOffset) );
+                            break;
+                case SigIeChanSwitchAnn:
+                        status |= dot11fUnpackIeChanSwitchAnn(pCtx, pBufRemaining, len, ( tDot11fIEChanSwitchAnn* )(pFrm + pIe->offset + sizeof(tDot11fIEChanSwitchAnn)*countOffset) );
+                            break;
+                case SigIeCountry:
+                        status |= dot11fUnpackIeCountry(pCtx, pBufRemaining, len, ( tDot11fIECountry* )(pFrm + pIe->offset + sizeof(tDot11fIECountry)*countOffset) );
+                            break;
+                case SigIeDSParams:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIEDSParams* )(pFrm + pIe->offset + sizeof( tDot11fIEDSParams)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIEDSParams* )(pFrm + pIe->offset + sizeof(tDot11fIEDSParams)*countOffset ) )->curr_channel) );
+                            break;
+                case SigIeEDCAParamSet:
+                        status |= dot11fUnpackIeEDCAParamSet(pCtx, pBufRemaining, len, ( tDot11fIEEDCAParamSet* )(pFrm + pIe->offset + sizeof(tDot11fIEEDCAParamSet)*countOffset) );
+                            break;
+                case SigIeERPInfo:
+                        status |= dot11fUnpackIeERPInfo(pCtx, pBufRemaining, len, ( tDot11fIEERPInfo* )(pFrm + pIe->offset + sizeof(tDot11fIEERPInfo)*countOffset) );
+                            break;
+                case SigIeExtChanSwitchAnn:
+                        status |= dot11fUnpackIeCommonFunc(pCtx, pBufRemaining, len,
+                                                (tANI_U8*) &(((  tDot11fIEExtChanSwitchAnn* )(pFrm + pIe->offset + sizeof( tDot11fIEExtChanSwitchAnn)*countOffset ) )->present),
+                                                (tANI_U8*) &((( tDot11fIEExtChanSwitchAnn* )(pFrm + pIe->offset + sizeof(tDot11fIEExtChanSwitchAnn)*countOffset ) )->secondaryChannelOffset) );
+                            break;
+                case SigIeExtSuppRates:
+                        status |= dot11fUnpackIeExtSuppRates(pCtx, pBufRemaining, len, ( tDot11fIEExtSuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIEExtSuppRates)*countOffset) );
+                            break;
+                case SigIeFHParamSet:
+                        status |= dot11fUnpackIeFHParamSet(pCtx, pBufRemaining, len, ( tDot11fIEFHParamSet* )(pFrm + pIe->offset + sizeof(tDot11fIEFHParamSet)*countOffset) );
+                            break;
+                case SigIeFHParams:
+                        status |= dot11fUnpackIeFHParams(pCtx, pBufRemaining, len, ( tDot11fIEFHParams* )(pFrm + pIe->offset + sizeof(tDot11fIEFHParams)*countOffset) );
+                            break;
+                case SigIeFHPattTable:
+                        status |= dot11fUnpackIeFHPattTable(pCtx, pBufRemaining, len, ( tDot11fIEFHPattTable* )(pFrm + pIe->offset + sizeof(tDot11fIEFHPattTable)*countOffset) );
+                            break;
+                case SigIeFTInfo:
+                        status |= dot11fUnpackIeFTInfo(pCtx, pBufRemaining, len, ( tDot11fIEFTInfo* )(pFrm + pIe->offset + sizeof(tDot11fIEFTInfo)*countOffset) );
+                            break;
+                case SigIeFTTimeoutInterval:
+                        status |= dot11fUnpackIeFTTimeoutInterval(pCtx, pBufRemaining, len, ( tDot11fIEFTTimeoutInterval* )(pFrm + pIe->offset + sizeof(tDot11fIEFTTimeoutInterval)*countOffset) );
+                            break;
+                case SigIeHTCaps:
+                        status |= dot11fUnpackIeHTCaps(pCtx, pBufRemaining, len, ( tDot11fIEHTCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEHTCaps)*countOffset) );
+                            break;
+                case SigIeHTInfo:
+                        status |= dot11fUnpackIeHTInfo(pCtx, pBufRemaining, len, ( tDot11fIEHTInfo* )(pFrm + pIe->offset + sizeof(tDot11fIEHTInfo)*countOffset) );
+                            break;
+                case SigIeIBSSParams:
+                        status |= dot11fUnpackIeIBSSParams(pCtx, pBufRemaining, len, ( tDot11fIEIBSSParams* )(pFrm + pIe->offset + sizeof(tDot11fIEIBSSParams)*countOffset) );
+                            break;
+                case SigIeMeasurementReport:
+                        status |= dot11fUnpackIeMeasurementReport(pCtx, pBufRemaining, len, ( tDot11fIEMeasurementReport* )(pFrm + pIe->offset + sizeof(tDot11fIEMeasurementReport)*countOffset) );
+                            break;
+                case SigIeMeasurementRequest:
+                        status |= dot11fUnpackIeMeasurementRequest(pCtx, pBufRemaining, len, ( tDot11fIEMeasurementRequest* )(pFrm + pIe->offset + sizeof(tDot11fIEMeasurementRequest)*countOffset) );
+                            break;
+                case SigIeMobilityDomain:
+                        status |= dot11fUnpackIeMobilityDomain(pCtx, pBufRemaining, len, ( tDot11fIEMobilityDomain* )(pFrm + pIe->offset + sizeof(tDot11fIEMobilityDomain)*countOffset) );
+                            break;
+                case SigIeNeighborReport:
+                        status |= dot11fUnpackIeNeighborReport(pCtx, pBufRemaining, len, ( tDot11fIENeighborReport* )(pFrm + pIe->offset + sizeof(tDot11fIENeighborReport)*countOffset) );
+                            break;
+                case SigIeP2PAssocReq:
+                        status |= dot11fUnpackIeP2PAssocReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PAssocReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PAssocReq)*countOffset) );
+                            break;
+                case SigIeP2PAssocRes:
+                        status |= dot11fUnpackIeP2PAssocRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PAssocRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PAssocRes)*countOffset) );
+                            break;
+                case SigIeP2PBeacon:
+                        status |= dot11fUnpackIeP2PBeacon(pCtx, pBufRemaining, len, ( tDot11fIEP2PBeacon* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PBeacon)*countOffset) );
+                            break;
+                case SigIeP2PBeaconProbeRes:
+                        status |= dot11fUnpackIeP2PBeaconProbeRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PBeaconProbeRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PBeaconProbeRes)*countOffset) );
+                            break;
+                case SigIeP2PDeAuth:
+                        status |= dot11fUnpackIeP2PDeAuth(pCtx, pBufRemaining, len, ( tDot11fIEP2PDeAuth* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PDeAuth)*countOffset) );
+                            break;
+                case SigIeP2PDeviceDiscoverabilityReq:
+                        status |= dot11fUnpackIeP2PDeviceDiscoverabilityReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PDeviceDiscoverabilityReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PDeviceDiscoverabilityReq)*countOffset) );
+                            break;
+                case SigIeP2PDeviceDiscoverabilityRes:
+                        status |= dot11fUnpackIeP2PDeviceDiscoverabilityRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PDeviceDiscoverabilityRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PDeviceDiscoverabilityRes)*countOffset) );
+                            break;
+                case SigIeP2PDisAssoc:
+                        status |= dot11fUnpackIeP2PDisAssoc(pCtx, pBufRemaining, len, ( tDot11fIEP2PDisAssoc* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PDisAssoc)*countOffset) );
+                            break;
+                case SigIeP2PGONegCnf:
+                        status |= dot11fUnpackIeP2PGONegCnf(pCtx, pBufRemaining, len, ( tDot11fIEP2PGONegCnf* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PGONegCnf)*countOffset) );
+                            break;
+                case SigIeP2PGONegReq:
+                        status |= dot11fUnpackIeP2PGONegReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PGONegReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PGONegReq)*countOffset) );
+                            break;
+                case SigIeP2PGONegRes:
+                        status |= dot11fUnpackIeP2PGONegRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PGONegRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PGONegRes)*countOffset) );
+                            break;
+                case SigIeP2PGONegWPS:
+                        status |= dot11fUnpackIeP2PGONegWPS(pCtx, pBufRemaining, len, ( tDot11fIEP2PGONegWPS* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PGONegWPS)*countOffset) );
+                            break;
+                case SigIeP2PIEOpaque:
+                        status |= dot11fUnpackIeP2PIEOpaque(pCtx, pBufRemaining, len, ( tDot11fIEP2PIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PIEOpaque)*countOffset) );
+                            break;
+                case SigIeP2PInvitationReq:
+                        status |= dot11fUnpackIeP2PInvitationReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PInvitationReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PInvitationReq)*countOffset) );
+                            break;
+                case SigIeP2PInvitationRes:
+                        status |= dot11fUnpackIeP2PInvitationRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PInvitationRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PInvitationRes)*countOffset) );
+                            break;
+                case SigIeP2PNoticeOfAbsence:
+                        status |= dot11fUnpackIeP2PNoticeOfAbsence(pCtx, pBufRemaining, len, ( tDot11fIEP2PNoticeOfAbsence* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PNoticeOfAbsence)*countOffset) );
+                            break;
+                case SigIeP2PPresenceResponse:
+                        status |= dot11fUnpackIeP2PPresenceResponse(pCtx, pBufRemaining, len, ( tDot11fIEP2PPresenceResponse* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PPresenceResponse)*countOffset) );
+                            break;
+                case SigIeP2PProbeReq:
+                        status |= dot11fUnpackIeP2PProbeReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PProbeReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PProbeReq)*countOffset) );
+                            break;
+                case SigIeP2PProbeRes:
+                        status |= dot11fUnpackIeP2PProbeRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PProbeRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PProbeRes)*countOffset) );
+                            break;
+                case SigIeP2PProvisionDiscoveryReq:
+                        status |= dot11fUnpackIeP2PProvisionDiscoveryReq(pCtx, pBufRemaining, len, ( tDot11fIEP2PProvisionDiscoveryReq* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PProvisionDiscoveryReq)*countOffset) );
+                            break;
+                case SigIeP2PWSCProvisionDiscoveryRes:
+                        status |= dot11fUnpackIeP2PWSCProvisionDiscoveryRes(pCtx, pBufRemaining, len, ( tDot11fIEP2PWSCProvisionDiscoveryRes* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PWSCProvisionDiscoveryRes)*countOffset) );
+                            break;
+                case SigIePowerCaps:
+                        status |= dot11fUnpackIePowerCaps(pCtx, pBufRemaining, len, ( tDot11fIEPowerCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEPowerCaps)*countOffset) );
+                            break;
+                case SigIePowerConstraints:
+                        status |= dot11fUnpackIePowerConstraints(pCtx, pBufRemaining, len, ( tDot11fIEPowerConstraints* )(pFrm + pIe->offset + sizeof(tDot11fIEPowerConstraints)*countOffset) );
+                            break;
+                case SigIeQBSSLoad:
+                        status |= dot11fUnpackIeQBSSLoad(pCtx, pBufRemaining, len, ( tDot11fIEQBSSLoad* )(pFrm + pIe->offset + sizeof(tDot11fIEQBSSLoad)*countOffset) );
+                            break;
+                case SigIeQOSCapsAp:
+                        status |= dot11fUnpackIeQOSCapsAp(pCtx, pBufRemaining, len, ( tDot11fIEQOSCapsAp* )(pFrm + pIe->offset + sizeof(tDot11fIEQOSCapsAp)*countOffset) );
+                            break;
+                case SigIeQOSCapsStation:
+                        status |= dot11fUnpackIeQOSCapsStation(pCtx, pBufRemaining, len, ( tDot11fIEQOSCapsStation* )(pFrm + pIe->offset + sizeof(tDot11fIEQOSCapsStation)*countOffset) );
+                            break;
+                case SigIeQuiet:
+                        status |= dot11fUnpackIeQuiet(pCtx, pBufRemaining, len, ( tDot11fIEQuiet* )(pFrm + pIe->offset + sizeof(tDot11fIEQuiet)*countOffset) );
+                            break;
+                case SigIeRCPIIE:
+                        status |= dot11fUnpackIeRCPIIE(pCtx, pBufRemaining, len, ( tDot11fIERCPIIE* )(pFrm + pIe->offset + sizeof(tDot11fIERCPIIE)*countOffset) );
+                            break;
+                case SigIeRICDataDesc:
+                        //reset the pointers back since this is a container IE and it doesnt have its own EID and Len.
+                        *pBufRemaining -= 2; nBufRemaining += 2;
+                        if ( pIe && pIe->noui ) 
+                            { 
+                                pBufRemaining -= pIe->noui;
+                                nBufRemaining += pIe->noui;
+                                len += pIe->noui;
+                            } 
+                        status |= GetContainerIesLen(pCtx, pBufRemaining, nBufRemaining, &len, IES_RICDataDesc);
+                        if (status != DOT11F_PARSE_SUCCESS ) break;
+                        status |= dot11fUnpackIeRICDataDesc(pCtx, pBufRemaining, len, ( tDot11fIERICDataDesc* )(pFrm + pIe->offset + sizeof(tDot11fIERICDataDesc)*countOffset) );
+                            break;
+                case SigIeRSN:
+                        status |= dot11fUnpackIeRSN(pCtx, pBufRemaining, len, ( tDot11fIERSN* )(pFrm + pIe->offset + sizeof(tDot11fIERSN)*countOffset) );
+                            break;
+                case SigIeRSNIIE:
+                        status |= dot11fUnpackIeRSNIIE(pCtx, pBufRemaining, len, ( tDot11fIERSNIIE* )(pFrm + pIe->offset + sizeof(tDot11fIERSNIIE)*countOffset) );
+                            break;
+                case SigIeRSNOpaque:
+                        status |= dot11fUnpackIeRSNOpaque(pCtx, pBufRemaining, len, ( tDot11fIERSNOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIERSNOpaque)*countOffset) );
+                            break;
+                case SigIeSuppChannels:
+                        status |= dot11fUnpackIeSuppChannels(pCtx, pBufRemaining, len, ( tDot11fIESuppChannels* )(pFrm + pIe->offset + sizeof(tDot11fIESuppChannels)*countOffset) );
+                            break;
+                case SigIeSuppRates:
+                        status |= dot11fUnpackIeSuppRates(pCtx, pBufRemaining, len, ( tDot11fIESuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIESuppRates)*countOffset) );
+                            break;
+                case SigIeTIM:
+                        status |= dot11fUnpackIeTIM(pCtx, pBufRemaining, len, ( tDot11fIETIM* )(pFrm + pIe->offset + sizeof(tDot11fIETIM)*countOffset) );
+                            break;
+                case SigIeTPCReport:
+                        status |= dot11fUnpackIeTPCReport(pCtx, pBufRemaining, len, ( tDot11fIETPCReport* )(pFrm + pIe->offset + sizeof(tDot11fIETPCReport)*countOffset) );
+                            break;
+                case SigIeTPCRequest:
+                        status |= dot11fUnpackIeTPCRequest(pCtx, pBufRemaining, len, ( tDot11fIETPCRequest* )(pFrm + pIe->offset + sizeof(tDot11fIETPCRequest)*countOffset) );
+                            break;
+                case SigIeWAPI:
+                        status |= dot11fUnpackIeWAPI(pCtx, pBufRemaining, len, ( tDot11fIEWAPI* )(pFrm + pIe->offset + sizeof(tDot11fIEWAPI)*countOffset) );
+                            break;
+                case SigIeWAPIOpaque:
+                        status |= dot11fUnpackIeWAPIOpaque(pCtx, pBufRemaining, len, ( tDot11fIEWAPIOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWAPIOpaque)*countOffset) );
+                            break;
+                case SigIeWFATPC:
+                        status |= dot11fUnpackIeWFATPC(pCtx, pBufRemaining, len, ( tDot11fIEWFATPC* )(pFrm + pIe->offset + sizeof(tDot11fIEWFATPC)*countOffset) );
+                            break;
+                case SigIeWMMCaps:
+                        status |= dot11fUnpackIeWMMCaps(pCtx, pBufRemaining, len, ( tDot11fIEWMMCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMCaps)*countOffset) );
+                            break;
+                case SigIeWMMInfoAp:
+                        status |= dot11fUnpackIeWMMInfoAp(pCtx, pBufRemaining, len, ( tDot11fIEWMMInfoAp* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMInfoAp)*countOffset) );
+                            break;
+                case SigIeWMMInfoStation:
+                        status |= dot11fUnpackIeWMMInfoStation(pCtx, pBufRemaining, len, ( tDot11fIEWMMInfoStation* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMInfoStation)*countOffset) );
+                            break;
+                case SigIeWMMParams:
+                        status |= dot11fUnpackIeWMMParams(pCtx, pBufRemaining, len, ( tDot11fIEWMMParams* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMParams)*countOffset) );
+                            break;
+                case SigIeWPA:
+                        status |= dot11fUnpackIeWPA(pCtx, pBufRemaining, len, ( tDot11fIEWPA* )(pFrm + pIe->offset + sizeof(tDot11fIEWPA)*countOffset) );
+                            break;
+                case SigIeWPAOpaque:
+                        status |= dot11fUnpackIeWPAOpaque(pCtx, pBufRemaining, len, ( tDot11fIEWPAOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWPAOpaque)*countOffset) );
+                            break;
+                case SigIeWSC:
+                        status |= dot11fUnpackIeWSC(pCtx, pBufRemaining, len, ( tDot11fIEWSC* )(pFrm + pIe->offset + sizeof(tDot11fIEWSC)*countOffset) );
+                            break;
+                case SigIeWscAssocReq:
+                        status |= dot11fUnpackIeWscAssocReq(pCtx, pBufRemaining, len, ( tDot11fIEWscAssocReq* )(pFrm + pIe->offset + sizeof(tDot11fIEWscAssocReq)*countOffset) );
+                            break;
+                case SigIeWscAssocRes:
+                        status |= dot11fUnpackIeWscAssocRes(pCtx, pBufRemaining, len, ( tDot11fIEWscAssocRes* )(pFrm + pIe->offset + sizeof(tDot11fIEWscAssocRes)*countOffset) );
+                            break;
+                case SigIeWscBeacon:
+                        status |= dot11fUnpackIeWscBeacon(pCtx, pBufRemaining, len, ( tDot11fIEWscBeacon* )(pFrm + pIe->offset + sizeof(tDot11fIEWscBeacon)*countOffset) );
+                            break;
+                case SigIeWscBeaconProbeRes:
+                        status |= dot11fUnpackIeWscBeaconProbeRes(pCtx, pBufRemaining, len, ( tDot11fIEWscBeaconProbeRes* )(pFrm + pIe->offset + sizeof(tDot11fIEWscBeaconProbeRes)*countOffset) );
+                            break;
+                case SigIeWscIEOpaque:
+                        status |= dot11fUnpackIeWscIEOpaque(pCtx, pBufRemaining, len, ( tDot11fIEWscIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWscIEOpaque)*countOffset) );
+                            break;
+                case SigIeWscProbeReq:
+                        status |= dot11fUnpackIeWscProbeReq(pCtx, pBufRemaining, len, ( tDot11fIEWscProbeReq* )(pFrm + pIe->offset + sizeof(tDot11fIEWscProbeReq)*countOffset) );
+                            break;
+                case SigIeWscProbeRes:
+                        status |= dot11fUnpackIeWscProbeRes(pCtx, pBufRemaining, len, ( tDot11fIEWscProbeRes* )(pFrm + pIe->offset + sizeof(tDot11fIEWscProbeRes)*countOffset) );
+                            break;
+                case SigIeWscReassocRes:
+                        status |= dot11fUnpackIeWscReassocRes(pCtx, pBufRemaining, len, ( tDot11fIEWscReassocRes* )(pFrm + pIe->offset + sizeof(tDot11fIEWscReassocRes)*countOffset) );
+                            break;
+                default:
+                    FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR"
+                        ": I don't know about the IE signature %d"
+                        "-- this is most likely a 'framesc' bug.\n"),
+                        pIe->sig);
+                FRAMES_DBG_BREAK();
+                    return DOT11F_INTERNAL_ERROR;
+                }
+            if (pIe->arraybound) (++( *(tANI_U16*)(pFrm + pIe->countOffset) ));
+            }
+
+
+        }
+        else
+        {
+            FRAMES_LOG2(pCtx, FRLOG3, FRFL("Skipping unknown IE %d"
+                " (length %d)\n"), eid, len);
+            FRAMES_DUMP(pCtx, FRLOG3, pBufRemaining - 2, len);
+            status |= DOT11F_UNKNOWN_IES;
+        }
+
+        pBufRemaining += len;
+
+         if (len > nBufRemaining)
+         {
+             FRAMES_LOG0(pCtx, FRLOGW, FRFL("This IE extends past "
+                 "the buffer as it was defined to us.  This could"
+                 "mean a corrupt frame, or just an incorrect leng"
+                 "th parameter.\n"));
+             FRAMES_DBG_BREAK();
+             status |= DOT11F_LAST_IE_TOO_LONG;
+             goto MandatoryCheck;
+         }
+
+        nBufRemaining -= len;
+
+    }
+
+MandatoryCheck:
+    pIe = &IEs[0];
+    while (0xff != pIe->eid)
+    {
+        if (pIe->fMandatory)
+        {
+            pfFound = (tFRAMES_BOOL*)(pFrm + pIe->offset + 
+                                      pIe->presenceOffset);
+            if (!*pfFound)
+            {
+                FRAMES_LOG1(pCtx, FRLOGW, FRFL("ERROR: The mandato"
+                    "ry IE %s wasn't seen.\n"),
+                    pIe->name);
+                FRAMES_DBG_BREAK();
+                status |= DOT11F_MANDATORY_IE_MISSING;
+            }
+
+        }
+        ++pIe;
+    }
+
+    return status;
+} /* End UnpackCore. */
+
+static tANI_U32 UnpackTlvCore( tpAniSirGlobal   pCtx,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            const tTLVDefn     TLVs[ ],
+                            tANI_U8 *pFrm,
+                            size_t       nFrm )
+{
+    const tTLVDefn *pTlv;
+    tANI_U32      nBufRemaining, status, npec;
+    tANI_U16      id, len;
+    tANI_U8      *pBufRemaining, *pfFound;
+
+    (void)pCtx;                 // Shutup the compiler
+    (void)nFrm;
+    status = DOT11F_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+
+    // While we have data...
+    while ( nBufRemaining )
+    {
+        if ( 3 > nBufRemaining )
+        {
+            FRAMES_LOG0( pCtx, FRLOGE, FRFL( "This frame reports "
+                         "fewer three byte(s) remaining.\n" ) );
+            status |= DOT11F_INCOMPLETE_TLV;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        npec = 0U;
+
+        // Look for a matching TLV definition,
+        pTlv = FindTLVDefn( pCtx, pBufRemaining, nBufRemaining, TLVs );
+        // consume the type,
+        if ( pTlv ) 
+        { 
+           if ( pTlv->sType == 2)
+           {
+              framesntohs(pCtx, &id, pBufRemaining, pTlv->fMsb);
+              pBufRemaining += 2;
+              nBufRemaining -= 2;
+           }else
+           {
+              id = *pBufRemaining;
+              pBufRemaining += 1;
+              nBufRemaining -= 1;
+           }
+           // & length,
+           if ( pTlv->sLen == 2)
+           {
+              framesntohs(pCtx, &len, pBufRemaining, pTlv->fMsb);
+              pBufRemaining += 2;
+              nBufRemaining -= 2;
+           }else
+           {
+              len = *pBufRemaining;
+              pBufRemaining += 1;
+              nBufRemaining -= 1;
+           }
+        }
+        else 
+        { 
+           pBufRemaining += TLVs[0].sType;
+           nBufRemaining -= TLVs[0].sType;
+           framesntohs(pCtx, &len, pBufRemaining, (TLVs[0].sType == 2));
+           pBufRemaining += 2;
+           nBufRemaining -= 2;
+        } 
+
+        if ( pTlv && pTlv->pec )
+        {
+            npec = 3U;
+            if ( 3 > nBufRemaining )
+            {
+                FRAMES_LOG2(pCtx, FRLOGW, FRFL("TLV %d reports length"
+                    "%d, but it has a Private Enterprise Code (3 byte"
+                    "s.\n"), id, len);
+                FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
+                FRAMES_LOG2(pCtx, FRLOG1, FRFL("We've parsed %d bytes"
+                    "of this buffer, and show %d left.\n"),
+                pBufRemaining - pBuf, nBufRemaining);
+                status |= DOT11F_INCOMPLETE_TLV;
+                FRAMES_DBG_BREAK();
+                goto MandatoryCheck;
+            }
+            pBufRemaining += 3;
+            nBufRemaining -= 3;
+            len           -= 3;
+        }
+
+        // Whether we found a hit or not, we can validate the reported
+        // length of this TLV:
+        if ( len > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGW, FRFL("TLV %d reports length %"
+                "d, but there are only %d bytes remaining in this f"
+                "rame.\n"), id, len, nBufRemaining );
+            FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+            FRAMES_LOG2( pCtx, FRLOG1, FRFL( "We've parsed %d bytes"
+                " of this buffer, and show %d left.\n"),
+                pBufRemaining - pBuf, nBufRemaining);
+            status |= DOT11F_INCOMPLETE_TLV;
+            FRAMES_DBG_BREAK();
+            goto MandatoryCheck;
+        }
+
+        // Now, *if* we found a hit...
+        if ( pTlv )
+        {
+            if ( nBufRemaining < pTlv->minSize - npec - (pTlv->sType + pTlv->sLen) )
+            {
+                FRAMES_LOG3( pCtx, FRLOGW, FRFL("The IE %s must be "
+                    "at least %d bytes in size, but there are only "
+                    "%d bytes remaining in this frame.\n"),
+                     pTlv->name, pTlv->minSize, nBufRemaining );
+                FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+                status |= DOT11F_INCOMPLETE_TLV;
+                FRAMES_DBG_BREAK( );
+                goto MandatoryCheck;
+            }
+            else if ( len > pTlv->maxSize - npec - (pTlv->sType + pTlv->sLen) )
+            {
+                FRAMES_LOG1( pCtx, FRLOGW, FRFL("The TLV %s reports "
+                    "an illegally large size; this TLV is presumably"
+                    "corrupt or otherwise invalid & will be skipped "
+                    "ipped.\n"), pTlv->name );
+                FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf );
+                FRAMES_LOG2( pCtx, FRLOG1, FRFL("We've parsed %d by"
+                    "tes of this buffer, and show %d left.\n"),
+                    pBufRemaining - pBuf, nBufRemaining);
+                FRAMES_DBG_BREAK();
+                status |= DOT11F_SKIPPED_BAD_TLV;
+            }
+            else
+            {
+                switch (pTlv->sig)
+                {
+                case SigTlvAuthorizedMACs:
+                        status |= dot11fUnpackTlvAuthorizedMACs(pCtx, pBufRemaining, len, ( tDot11fTLVAuthorizedMACs* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvRequestToEnroll:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVRequestToEnroll* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVRequestToEnroll*)(pFrm + pTlv->offset ))->req));
+                    break;
+                case SigTlvVersion2:
+                        status |= dot11fUnpackTlvVersion2(pCtx, pBufRemaining, len, ( tDot11fTLVVersion2* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvAPSetupLocked:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVAPSetupLocked* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVAPSetupLocked*)(pFrm + pTlv->offset ))->fLocked));
+                    break;
+                case SigTlvAssociationState:
+                        status |= dot11fUnpackTlvCommonFunc2(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVAssociationState* )(pFrm + pTlv->offset ))->present), (tANI_U16*)&((( tDot11fTLVAssociationState*)(pFrm + pTlv->offset ))->state));
+                    break;
+                case SigTlvChannelList:
+                        status |= dot11fUnpackTlvChannelList(pCtx, pBufRemaining, len, ( tDot11fTLVChannelList* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvConfigMethods:
+                        status |= dot11fUnpackTlvCommonFunc2(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVConfigMethods* )(pFrm + pTlv->offset ))->present), (tANI_U16*)&((( tDot11fTLVConfigMethods*)(pFrm + pTlv->offset ))->methods));
+                    break;
+                case SigTlvConfigurationError:
+                        status |= dot11fUnpackTlvCommonFunc2(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVConfigurationError* )(pFrm + pTlv->offset ))->present), (tANI_U16*)&((( tDot11fTLVConfigurationError*)(pFrm + pTlv->offset ))->error));
+                    break;
+                case SigTlvConfigurationTimeout:
+                        status |= dot11fUnpackTlvConfigurationTimeout(pCtx, pBufRemaining, len, ( tDot11fTLVConfigurationTimeout* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvDeviceName:
+                        status |= dot11fUnpackTlvDeviceName(pCtx, pBufRemaining, len, ( tDot11fTLVDeviceName* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvDevicePasswordID:
+                        status |= dot11fUnpackTlvCommonFunc2(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVDevicePasswordID* )(pFrm + pTlv->offset ))->present), (tANI_U16*)&((( tDot11fTLVDevicePasswordID*)(pFrm + pTlv->offset ))->id));
+                    break;
+                case SigTlvExtendedListenTiming:
+                        status |= dot11fUnpackTlvExtendedListenTiming(pCtx, pBufRemaining, len, ( tDot11fTLVExtendedListenTiming* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvGOIntent:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVGOIntent* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVGOIntent*)(pFrm + pTlv->offset ))->GOIntent));
+                    break;
+                case SigTlvIntendedP2PInterfaceAddress:
+                        status |= dot11fUnpackTlvIntendedP2PInterfaceAddress(pCtx, pBufRemaining, len, ( tDot11fTLVIntendedP2PInterfaceAddress* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvInvitationFlags:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVInvitationFlags* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVInvitationFlags*)(pFrm + pTlv->offset ))->invitationFlags));
+                    break;
+                case SigTlvListenChannel:
+                        status |= dot11fUnpackTlvListenChannel(pCtx, pBufRemaining, len, ( tDot11fTLVListenChannel* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvManufacturer:
+                        status |= dot11fUnpackTlvManufacturer(pCtx, pBufRemaining, len, ( tDot11fTLVManufacturer* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvMinorReasonCode:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVMinorReasonCode* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVMinorReasonCode*)(pFrm + pTlv->offset ))->minorReasonCode));
+                    break;
+                case SigTlvModelName:
+                        status |= dot11fUnpackTlvModelName(pCtx, pBufRemaining, len, ( tDot11fTLVModelName* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvModelNumber:
+                        status |= dot11fUnpackTlvModelNumber(pCtx, pBufRemaining, len, ( tDot11fTLVModelNumber* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvNoticeOfAbsence:
+                        status |= dot11fUnpackTlvNoticeOfAbsence(pCtx, pBufRemaining, len, ( tDot11fTLVNoticeOfAbsence* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvOperatingChannel:
+                        status |= dot11fUnpackTlvOperatingChannel(pCtx, pBufRemaining, len, ( tDot11fTLVOperatingChannel* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PCapability:
+                        status |= dot11fUnpackTlvP2PCapability(pCtx, pBufRemaining, len, ( tDot11fTLVP2PCapability* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PDeviceId:
+                        status |= dot11fUnpackTlvP2PDeviceId(pCtx, pBufRemaining, len, ( tDot11fTLVP2PDeviceId* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PDeviceInfo:
+                        status |= dot11fUnpackTlvP2PDeviceInfo(pCtx, pBufRemaining, len, ( tDot11fTLVP2PDeviceInfo* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PGroupBssid:
+                        status |= dot11fUnpackTlvP2PGroupBssid(pCtx, pBufRemaining, len, ( tDot11fTLVP2PGroupBssid* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PGroupId:
+                        status |= dot11fUnpackTlvP2PGroupId(pCtx, pBufRemaining, len, ( tDot11fTLVP2PGroupId* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PGroupInfo:
+                        status |= dot11fUnpackTlvP2PGroupInfo(pCtx, pBufRemaining, len, ( tDot11fTLVP2PGroupInfo* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PStatus:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVP2PStatus* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVP2PStatus*)(pFrm + pTlv->offset ))->status));
+                    break;
+                case SigTlvPrimaryDeviceType:
+                        status |= dot11fUnpackTlvPrimaryDeviceType(pCtx, pBufRemaining, len, ( tDot11fTLVPrimaryDeviceType* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvRFBands:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVRFBands* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVRFBands*)(pFrm + pTlv->offset ))->bands));
+                    break;
+                case SigTlvRequestDeviceType:
+                        status |= dot11fUnpackTlvRequestDeviceType(pCtx, pBufRemaining, len, ( tDot11fTLVRequestDeviceType* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvRequestType:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVRequestType* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVRequestType*)(pFrm + pTlv->offset ))->reqType));
+                    break;
+                case SigTlvResponseType:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVResponseType* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVResponseType*)(pFrm + pTlv->offset ))->resType));
+                    break;
+                case SigTlvSelectedRegistrar:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVSelectedRegistrar* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVSelectedRegistrar*)(pFrm + pTlv->offset ))->selected));
+                    break;
+                case SigTlvSelectedRegistrarConfigMethods:
+                        status |= dot11fUnpackTlvCommonFunc2(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVSelectedRegistrarConfigMethods* )(pFrm + pTlv->offset ))->present), (tANI_U16*)&((( tDot11fTLVSelectedRegistrarConfigMethods*)(pFrm + pTlv->offset ))->methods));
+                    break;
+                case SigTlvSerialNumber:
+                        status |= dot11fUnpackTlvSerialNumber(pCtx, pBufRemaining, len, ( tDot11fTLVSerialNumber* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvUUID_E:
+                        status |= dot11fUnpackTlvUUID_E(pCtx, pBufRemaining, len, ( tDot11fTLVUUID_E* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvUUID_R:
+                        status |= dot11fUnpackTlvUUID_R(pCtx, pBufRemaining, len, ( tDot11fTLVUUID_R* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvVendorExtension:
+                        status |= dot11fUnpackTlvVendorExtension(pCtx, pBufRemaining, len, ( tDot11fTLVVendorExtension* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvVersion:
+                        status |= dot11fUnpackTlvVersion(pCtx, pBufRemaining, len, ( tDot11fTLVVersion* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvWPSState:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVWPSState* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVWPSState*)(pFrm + pTlv->offset ))->state));
+                    break;
+                case SigTlvP2PInterface:
+                        status |= dot11fUnpackTlvP2PInterface(pCtx, pBufRemaining, len, ( tDot11fTLVP2PInterface* )(pFrm + pTlv->offset ));
+                    break;
+                case SigTlvP2PManageability:
+                        status |= dot11fUnpackTlvCommonFunc(pCtx, pBufRemaining, len, (tANI_U8*)&((( tDot11fTLVP2PManageability* )(pFrm + pTlv->offset ))->present), (tANI_U8*)&((( tDot11fTLVP2PManageability*)(pFrm + pTlv->offset ))->manageability));
+                    break;
+                default:
+                    FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR: I"
+                        " don't know about the TLV signature %d-- thi"
+                        "s is most likely a 'framesc' bug.\n"),
+                        pTlv->sig);
+                    FRAMES_DBG_BREAK();
+                    return DOT11F_INTERNAL_ERROR;
+                } // End switch on sig.
+            } // End if on length check.
+
+        }
+        else
+        {
+            FRAMES_LOG2(pCtx, FRLOG3, FRFL("Skipping unknown TLV %d ("
+                "length %d)\n"), id, len);
+            FRAMES_DUMP(pCtx, FRLOG3, pBufRemaining - (pTlv->sType + pTlv->sLen), len);
+            status |= DOT11F_UNKNOWN_TLVS;
+        }
+
+        // Advance to the next TLV
+        pBufRemaining += len;
+
+        if (len > nBufRemaining)
+         {
+             FRAMES_LOG0(pCtx, FRLOGW, FRFL("This TLV extends past th"
+                 "e buffer as it was defined to us.  This could mean "
+                 "a corrupt frame, or just an incorrect length parame"
+                 "ter.\n"));
+             FRAMES_DBG_BREAK();
+             status |= DOT11F_LAST_TLV_TOO_LONG;
+             goto MandatoryCheck;
+         }
+
+        nBufRemaining -= len;
+
+    } // End iteration over TLVs.
+
+MandatoryCheck:
+    pTlv = &TLVs[0];
+    while (0xffff != pTlv->id)
+    {
+        if (pTlv->fMandatory)
+        {
+            pfFound = (tANI_U8*)(pFrm + pTlv->offset +
+                             pTlv->presenceOffset);
+            if (!*pfFound)
+            {
+                FRAMES_LOG1(pCtx, FRLOGW, FRFL("ERROR: The mandatory "
+                    "TLV %s wasn't seen.\n"),
+                    pTlv->name);
+                FRAMES_DBG_BREAK();
+                status |= DOT11F_MANDATORY_TLV_MISSING;
+            }
+
+        }
+        ++pTlv;
+    }
+
+    return status;
+} /* End UnpacTlvkCore. */
+tANI_U32 dot11fGetPackedIETCLAS(tpAniSirGlobal pCtx, tDot11fIETCLAS *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        switch (pIe->classifier_type)
+        {
+            case 0:
+                *pnNeeded += 6;
+                *pnNeeded += 6;
+                *pnNeeded += 2;
+            break;
+            case 1:
+                *pnNeeded += 1;
+                switch (pIe->info.IpParams.version)
+                {
+                    case 4:
+                        *pnNeeded += 4;
+                        *pnNeeded += 4;
+                        *pnNeeded += 2;
+                        *pnNeeded += 2;
+                        *pnNeeded += 1;
+                        *pnNeeded += 1;
+                        *pnNeeded += 1;
+                    break;
+                    case 6:
+                        *pnNeeded += 16;
+                        *pnNeeded += 16;
+                        *pnNeeded += 2;
+                        *pnNeeded += 2;
+                        *pnNeeded += 3;
+                    break;
+                }
+            break;
+            case 2:
+                *pnNeeded += 2;
+            break;
+        }
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIETCLAS. */
+
+tANI_U32 dot11fGetPackedIEWMMTCLAS(tpAniSirGlobal pCtx, tDot11fIEWMMTCLAS *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        switch (pIe->classifier_type)
+        {
+            case 0:
+                *pnNeeded += 6;
+                *pnNeeded += 6;
+                *pnNeeded += 2;
+            break;
+            case 1:
+                *pnNeeded += 1;
+                switch (pIe->info.IpParams.version)
+                {
+                    case 4:
+                        *pnNeeded += 4;
+                        *pnNeeded += 4;
+                        *pnNeeded += 2;
+                        *pnNeeded += 2;
+                        *pnNeeded += 1;
+                        *pnNeeded += 1;
+                        *pnNeeded += 1;
+                    break;
+                    case 6:
+                        *pnNeeded += 16;
+                        *pnNeeded += 16;
+                        *pnNeeded += 2;
+                        *pnNeeded += 2;
+                        *pnNeeded += 3;
+                    break;
+                }
+            break;
+            case 2:
+                *pnNeeded += 2;
+            break;
+        }
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWMMTCLAS. */
+
+tANI_U32 dot11fGetPackedIEAirgo(tpAniSirGlobal pCtx, tDot11fIEAirgo *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_Airgo);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEAirgo. */
+
+tANI_U32 dot11fGetPackedIECountry(tpAniSirGlobal pCtx, tDot11fIECountry *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 3;
+        if ( pIe->num_triplets )
+        {
+            *pnNeeded += ( pIe->num_triplets * 3 );
+        }
+        else break;
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIECountry. */
+
+tANI_U32 dot11fGetPackedIEFTInfo(tpAniSirGlobal pCtx, tDot11fIEFTInfo *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 16;
+        *pnNeeded += 32;
+        *pnNeeded += 32;
+        status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_FTInfo);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEFTInfo. */
+
+tANI_U32 dot11fGetPackedIEMeasurementReport(tpAniSirGlobal pCtx, tDot11fIEMeasurementReport *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        if ( pIe->type )
+        {
+            switch (pIe->type)
+            {
+                case 0:
+                    *pnNeeded += 1;
+                    *pnNeeded += 8;
+                    *pnNeeded += 2;
+                    *pnNeeded += 1;
+                break;
+                case 1:
+                    *pnNeeded += 1;
+                    *pnNeeded += 8;
+                    *pnNeeded += 2;
+                    *pnNeeded += 1;
+                break;
+                case 2:
+                    *pnNeeded += 1;
+                    *pnNeeded += 8;
+                    *pnNeeded += 2;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                break;
+                case 5:
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 8;
+                    *pnNeeded += 2;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 1;
+                    *pnNeeded += 6;
+                    *pnNeeded += 1;
+                    *pnNeeded += 4;
+                status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_reportBeacon);
+                break;
+            }
+        }
+        else break;
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEMeasurementReport. */
+
+tANI_U32 dot11fGetPackedIEMeasurementRequest(tpAniSirGlobal pCtx, tDot11fIEMeasurementRequest *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        switch (pIe->measurement_type)
+        {
+            case 0:
+                *pnNeeded += 1;
+                *pnNeeded += 8;
+                *pnNeeded += 2;
+            break;
+            case 1:
+                *pnNeeded += 1;
+                *pnNeeded += 8;
+                *pnNeeded += 2;
+            break;
+            case 2:
+                *pnNeeded += 1;
+                *pnNeeded += 8;
+                *pnNeeded += 2;
+            break;
+            case 5:
+                *pnNeeded += 1;
+                *pnNeeded += 1;
+                *pnNeeded += 2;
+                *pnNeeded += 2;
+                *pnNeeded += 1;
+                *pnNeeded += 6;
+            status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_measurement_requestBeacon);
+            break;
+        }
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEMeasurementRequest. */
+
+tANI_U32 dot11fGetPackedIENeighborReport(tpAniSirGlobal pCtx, tDot11fIENeighborReport *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 6;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 2;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        *pnNeeded += 1;
+        status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_NeighborReport);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIENeighborReport. */
+
+tANI_U32 dot11fGetPackedIEP2PAssocReq(tpAniSirGlobal pCtx, tDot11fIEP2PAssocReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PAssocReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PAssocReq. */
+
+tANI_U32 dot11fGetPackedIEP2PAssocRes(tpAniSirGlobal pCtx, tDot11fIEP2PAssocRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PAssocRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PAssocRes. */
+
+tANI_U32 dot11fGetPackedIEP2PBeacon(tpAniSirGlobal pCtx, tDot11fIEP2PBeacon *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PBeacon);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PBeacon. */
+
+tANI_U32 dot11fGetPackedIEP2PBeaconProbeRes(tpAniSirGlobal pCtx, tDot11fIEP2PBeaconProbeRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PBeaconProbeRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PBeaconProbeRes. */
+
+tANI_U32 dot11fGetPackedIEP2PDeAuth(tpAniSirGlobal pCtx, tDot11fIEP2PDeAuth *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PDeAuth);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PDeAuth. */
+
+tANI_U32 dot11fGetPackedIEP2PDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tDot11fIEP2PDeviceDiscoverabilityReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PDeviceDiscoverabilityReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PDeviceDiscoverabilityReq. */
+
+tANI_U32 dot11fGetPackedIEP2PDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tDot11fIEP2PDeviceDiscoverabilityRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PDeviceDiscoverabilityRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PDeviceDiscoverabilityRes. */
+
+tANI_U32 dot11fGetPackedIEP2PDisAssoc(tpAniSirGlobal pCtx, tDot11fIEP2PDisAssoc *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PDisAssoc);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PDisAssoc. */
+
+tANI_U32 dot11fGetPackedIEP2PGONegCnf(tpAniSirGlobal pCtx, tDot11fIEP2PGONegCnf *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PGONegCnf);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PGONegCnf. */
+
+tANI_U32 dot11fGetPackedIEP2PGONegReq(tpAniSirGlobal pCtx, tDot11fIEP2PGONegReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PGONegReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PGONegReq. */
+
+tANI_U32 dot11fGetPackedIEP2PGONegRes(tpAniSirGlobal pCtx, tDot11fIEP2PGONegRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PGONegRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PGONegRes. */
+
+tANI_U32 dot11fGetPackedIEP2PGONegWPS(tpAniSirGlobal pCtx, tDot11fIEP2PGONegWPS *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PGONegWPS);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PGONegWPS. */
+
+tANI_U32 dot11fGetPackedIEP2PInvitationReq(tpAniSirGlobal pCtx, tDot11fIEP2PInvitationReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PInvitationReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PInvitationReq. */
+
+tANI_U32 dot11fGetPackedIEP2PInvitationRes(tpAniSirGlobal pCtx, tDot11fIEP2PInvitationRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PInvitationRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PInvitationRes. */
+
+tANI_U32 dot11fGetPackedIEP2PNoticeOfAbsence(tpAniSirGlobal pCtx, tDot11fIEP2PNoticeOfAbsence *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PNoticeOfAbsence);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PNoticeOfAbsence. */
+
+tANI_U32 dot11fGetPackedIEP2PPresenceResponse(tpAniSirGlobal pCtx, tDot11fIEP2PPresenceResponse *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PPresenceResponse);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PPresenceResponse. */
+
+tANI_U32 dot11fGetPackedIEP2PProbeReq(tpAniSirGlobal pCtx, tDot11fIEP2PProbeReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PProbeReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PProbeReq. */
+
+tANI_U32 dot11fGetPackedIEP2PProbeRes(tpAniSirGlobal pCtx, tDot11fIEP2PProbeRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PProbeRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PProbeRes. */
+
+tANI_U32 dot11fGetPackedIEP2PProvisionDiscoveryReq(tpAniSirGlobal pCtx, tDot11fIEP2PProvisionDiscoveryReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PProvisionDiscoveryReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PProvisionDiscoveryReq. */
+
+tANI_U32 dot11fGetPackedIEP2PWSCProvisionDiscoveryRes(tpAniSirGlobal pCtx, tDot11fIEP2PWSCProvisionDiscoveryRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_P2PWSCProvisionDiscoveryRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEP2PWSCProvisionDiscoveryRes. */
+
+tANI_U32 dot11fGetPackedIERICDataDesc(tpAniSirGlobal pCtx, tDot11fIERICDataDesc *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        status = GetPackedSizeCore(pCtx, ( tANI_U8* )pIe, pnNeeded, IES_RICDataDesc);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIERICDataDesc. */
+
+tANI_U32 dot11fGetPackedIERSN(tpAniSirGlobal pCtx, tDot11fIERSN *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 4;
+        if ( pIe->pwise_cipher_suite_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->pwise_cipher_suite_count * 4 );
+        if ( pIe->akm_suite_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->akm_suite_count * 4 );
+        *pnNeeded += 2;
+        if ( pIe->pmkid_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->pmkid_count * 16 );
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIERSN. */
+
+tANI_U32 dot11fGetPackedIEWAPI(tpAniSirGlobal pCtx, tDot11fIEWAPI *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 2;
+        *pnNeeded += 2;
+        *pnNeeded += ( pIe->akm_suite_count * 4 );
+        *pnNeeded += 2;
+        *pnNeeded += ( pIe->unicast_cipher_suite_count * 4 );
+        *pnNeeded += 4;
+        *pnNeeded += 2;
+        if ( pIe->bkid_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->bkid_count * 16 );
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWAPI. */
+
+tANI_U32 dot11fGetPackedIEWPA(tpAniSirGlobal pCtx, tDot11fIEWPA *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+        *pnNeeded += 2;
+        if ( pIe->multicast_cipher_present )
+        {
+            *pnNeeded += 4;
+        }
+        else break;
+        if ( pIe->unicast_cipher_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->unicast_cipher_count * 4 );
+        if ( pIe->auth_suite_count )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        *pnNeeded += ( pIe->auth_suite_count * 4 );
+        if ( pIe->caps )
+        {
+            *pnNeeded += 2;
+        }
+        else break;
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWPA. */
+
+tANI_U32 dot11fGetPackedIEWSC(tpAniSirGlobal pCtx, tDot11fIEWSC *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WSC);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWSC. */
+
+tANI_U32 dot11fGetPackedIEWscAssocReq(tpAniSirGlobal pCtx, tDot11fIEWscAssocReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscAssocReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscAssocReq. */
+
+tANI_U32 dot11fGetPackedIEWscAssocRes(tpAniSirGlobal pCtx, tDot11fIEWscAssocRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscAssocRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscAssocRes. */
+
+tANI_U32 dot11fGetPackedIEWscBeacon(tpAniSirGlobal pCtx, tDot11fIEWscBeacon *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscBeacon);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscBeacon. */
+
+tANI_U32 dot11fGetPackedIEWscBeaconProbeRes(tpAniSirGlobal pCtx, tDot11fIEWscBeaconProbeRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscBeaconProbeRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscBeaconProbeRes. */
+
+tANI_U32 dot11fGetPackedIEWscProbeReq(tpAniSirGlobal pCtx, tDot11fIEWscProbeReq *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscProbeReq);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscProbeReq. */
+
+tANI_U32 dot11fGetPackedIEWscProbeRes(tpAniSirGlobal pCtx, tDot11fIEWscProbeRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscProbeRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscProbeRes. */
+
+tANI_U32 dot11fGetPackedIEWscReassocRes(tpAniSirGlobal pCtx, tDot11fIEWscReassocRes *pIe, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    (void)pCtx;
+    while ( pIe->present )
+    {
+    status = GetPackedSizeTlvCore(pCtx,(tANI_U8*)pIe,pnNeeded,TLVS_WscReassocRes);
+        break;
+    }
+    return status;
+} /* End dot11fGetPackedIEWscReassocRes. */
+
+tANI_U32 dot11fGetPackedAddBAReqSize(tpAniSirGlobal pCtx, tDot11fAddBAReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 9;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AddBAReq);
+    return status;
+} /* End dot11fGetPackedAddBAReqSize. */
+
+tANI_U32 dot11fGetPackedAddBARspSize(tpAniSirGlobal pCtx, tDot11fAddBARsp *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 9;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AddBARsp);
+    return status;
+} /* End dot11fGetPackedAddBARspSize. */
+
+tANI_U32 dot11fGetPackedAddTSRequestSize(tpAniSirGlobal pCtx, tDot11fAddTSRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AddTSRequest);
+    return status;
+} /* End dot11fGetPackedAddTSRequestSize. */
+
+tANI_U32 dot11fGetPackedAddTSResponseSize(tpAniSirGlobal pCtx, tDot11fAddTSResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 5;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AddTSResponse);
+    return status;
+} /* End dot11fGetPackedAddTSResponseSize. */
+
+tANI_U32 dot11fGetPackedAssocRequestSize(tpAniSirGlobal pCtx, tDot11fAssocRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 4;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AssocRequest);
+    return status;
+} /* End dot11fGetPackedAssocRequestSize. */
+
+tANI_U32 dot11fGetPackedAssocResponseSize(tpAniSirGlobal pCtx, tDot11fAssocResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 6;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_AssocResponse);
+    return status;
+} /* End dot11fGetPackedAssocResponseSize. */
+
+tANI_U32 dot11fGetPackedAuthenticationSize(tpAniSirGlobal pCtx, tDot11fAuthentication *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 6;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_Authentication);
+    return status;
+} /* End dot11fGetPackedAuthenticationSize. */
+
+tANI_U32 dot11fGetPackedBeaconSize(tpAniSirGlobal pCtx, tDot11fBeacon *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 12;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_Beacon);
+    return status;
+} /* End dot11fGetPackedBeaconSize. */
+
+tANI_U32 dot11fGetPackedBeacon1Size(tpAniSirGlobal pCtx, tDot11fBeacon1 *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 12;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_Beacon1);
+    return status;
+} /* End dot11fGetPackedBeacon1Size. */
+
+tANI_U32 dot11fGetPackedBeacon2Size(tpAniSirGlobal pCtx, tDot11fBeacon2 *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 0;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_Beacon2);
+    return status;
+} /* End dot11fGetPackedBeacon2Size. */
+
+tANI_U32 dot11fGetPackedBeaconIEsSize(tpAniSirGlobal pCtx, tDot11fBeaconIEs *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 0;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_BeaconIEs);
+    return status;
+} /* End dot11fGetPackedBeaconIEsSize. */
+
+tANI_U32 dot11fGetPackedChannelSwitchSize(tpAniSirGlobal pCtx, tDot11fChannelSwitch *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 2;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ChannelSwitch);
+    return status;
+} /* End dot11fGetPackedChannelSwitchSize. */
+
+tANI_U32 dot11fGetPackedDeAuthSize(tpAniSirGlobal pCtx, tDot11fDeAuth *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 2;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_DeAuth);
+    return status;
+} /* End dot11fGetPackedDeAuthSize. */
+
+tANI_U32 dot11fGetPackedDelBAIndSize(tpAniSirGlobal pCtx, tDot11fDelBAInd *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 6;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_DelBAInd);
+    return status;
+} /* End dot11fGetPackedDelBAIndSize. */
+
+tANI_U32 dot11fGetPackedDelTSSize(tpAniSirGlobal pCtx, tDot11fDelTS *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 7;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_DelTS);
+    return status;
+} /* End dot11fGetPackedDelTSSize. */
+
+tANI_U32 dot11fGetPackedDeviceDiscoverabilityReqSize(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_DeviceDiscoverabilityReq);
+    return status;
+} /* End dot11fGetPackedDeviceDiscoverabilityReqSize. */
+
+tANI_U32 dot11fGetPackedDeviceDiscoverabilityResSize(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityRes *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_DeviceDiscoverabilityRes);
+    return status;
+} /* End dot11fGetPackedDeviceDiscoverabilityResSize. */
+
+tANI_U32 dot11fGetPackedDisassociationSize(tpAniSirGlobal pCtx, tDot11fDisassociation *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 2;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_Disassociation);
+    return status;
+} /* End dot11fGetPackedDisassociationSize. */
+
+tANI_U32 dot11fGetPackedGODiscoverabilityReqSize(tpAniSirGlobal pCtx, tDot11fGODiscoverabilityReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 7;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_GODiscoverabilityReq);
+    return status;
+} /* End dot11fGetPackedGODiscoverabilityReqSize. */
+
+tANI_U32 dot11fGetPackedGONegCnfSize(tpAniSirGlobal pCtx, tDot11fGONegCnf *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_GONegCnf);
+    return status;
+} /* End dot11fGetPackedGONegCnfSize. */
+
+tANI_U32 dot11fGetPackedGONegReqSize(tpAniSirGlobal pCtx, tDot11fGONegReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_GONegReq);
+    return status;
+} /* End dot11fGetPackedGONegReqSize. */
+
+tANI_U32 dot11fGetPackedGONegResSize(tpAniSirGlobal pCtx, tDot11fGONegRes *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_GONegRes);
+    return status;
+} /* End dot11fGetPackedGONegResSize. */
+
+tANI_U32 dot11fGetPackedInvitationReqSize(tpAniSirGlobal pCtx, tDot11fInvitationReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_InvitationReq);
+    return status;
+} /* End dot11fGetPackedInvitationReqSize. */
+
+tANI_U32 dot11fGetPackedInvitationResSize(tpAniSirGlobal pCtx, tDot11fInvitationRes *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_InvitationRes);
+    return status;
+} /* End dot11fGetPackedInvitationResSize. */
+
+tANI_U32 dot11fGetPackedLinkMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fLinkMeasurementReport *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 11;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_LinkMeasurementReport);
+    return status;
+} /* End dot11fGetPackedLinkMeasurementReportSize. */
+
+tANI_U32 dot11fGetPackedLinkMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fLinkMeasurementRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 5;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_LinkMeasurementRequest);
+    return status;
+} /* End dot11fGetPackedLinkMeasurementRequestSize. */
+
+tANI_U32 dot11fGetPackedMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fMeasurementReport *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_MeasurementReport);
+    return status;
+} /* End dot11fGetPackedMeasurementReportSize. */
+
+tANI_U32 dot11fGetPackedMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fMeasurementRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_MeasurementRequest);
+    return status;
+} /* End dot11fGetPackedMeasurementRequestSize. */
+
+tANI_U32 dot11fGetPackedNeighborReportRequestSize(tpAniSirGlobal pCtx, tDot11fNeighborReportRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_NeighborReportRequest);
+    return status;
+} /* End dot11fGetPackedNeighborReportRequestSize. */
+
+tANI_U32 dot11fGetPackedNeighborReportResponseSize(tpAniSirGlobal pCtx, tDot11fNeighborReportResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_NeighborReportResponse);
+    return status;
+} /* End dot11fGetPackedNeighborReportResponseSize. */
+
+tANI_U32 dot11fGetPackedNoticeOfAbsSize(tpAniSirGlobal pCtx, tDot11fNoticeOfAbs *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 7;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_NoticeOfAbs);
+    return status;
+} /* End dot11fGetPackedNoticeOfAbsSize. */
+
+tANI_U32 dot11fGetPackedPresenceReqSize(tpAniSirGlobal pCtx, tDot11fPresenceReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 7;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_PresenceReq);
+    return status;
+} /* End dot11fGetPackedPresenceReqSize. */
+
+tANI_U32 dot11fGetPackedPresenceResSize(tpAniSirGlobal pCtx, tDot11fPresenceRes *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 7;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_PresenceRes);
+    return status;
+} /* End dot11fGetPackedPresenceResSize. */
+
+tANI_U32 dot11fGetPackedProbeRequestSize(tpAniSirGlobal pCtx, tDot11fProbeRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 0;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ProbeRequest);
+    return status;
+} /* End dot11fGetPackedProbeRequestSize. */
+
+tANI_U32 dot11fGetPackedProbeResponseSize(tpAniSirGlobal pCtx, tDot11fProbeResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 12;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ProbeResponse);
+    return status;
+} /* End dot11fGetPackedProbeResponseSize. */
+
+tANI_U32 dot11fGetPackedProvisionDiscoveryReqSize(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryReq *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ProvisionDiscoveryReq);
+    return status;
+} /* End dot11fGetPackedProvisionDiscoveryReqSize. */
+
+tANI_U32 dot11fGetPackedProvisionDiscoveryResSize(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryRes *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 8;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ProvisionDiscoveryRes);
+    return status;
+} /* End dot11fGetPackedProvisionDiscoveryResSize. */
+
+tANI_U32 dot11fGetPackedRadioMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_RadioMeasurementReport);
+    return status;
+} /* End dot11fGetPackedRadioMeasurementReportSize. */
+
+tANI_U32 dot11fGetPackedRadioMeasurementRequestSize(tpAniSirGlobal pCtx, tDot11fRadioMeasurementRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 5;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_RadioMeasurementRequest);
+    return status;
+} /* End dot11fGetPackedRadioMeasurementRequestSize. */
+
+tANI_U32 dot11fGetPackedReAssocRequestSize(tpAniSirGlobal pCtx, tDot11fReAssocRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 10;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ReAssocRequest);
+    return status;
+} /* End dot11fGetPackedReAssocRequestSize. */
+
+tANI_U32 dot11fGetPackedReAssocResponseSize(tpAniSirGlobal pCtx, tDot11fReAssocResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 6;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_ReAssocResponse);
+    return status;
+} /* End dot11fGetPackedReAssocResponseSize. */
+
+tANI_U32 dot11fGetPackedSMPowerSaveSize(tpAniSirGlobal pCtx, tDot11fSMPowerSave *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_SMPowerSave);
+    return status;
+} /* End dot11fGetPackedSMPowerSaveSize. */
+
+tANI_U32 dot11fGetPackedTPCReportSize(tpAniSirGlobal pCtx, tDot11fTPCReport *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_TPCReport);
+    return status;
+} /* End dot11fGetPackedTPCReportSize. */
+
+tANI_U32 dot11fGetPackedTPCRequestSize(tpAniSirGlobal pCtx, tDot11fTPCRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 3;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_TPCRequest);
+    return status;
+} /* End dot11fGetPackedTPCRequestSize. */
+
+tANI_U32 dot11fGetPackedWMMAddTSRequestSize(tpAniSirGlobal pCtx, tDot11fWMMAddTSRequest *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 4;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_WMMAddTSRequest);
+    return status;
+} /* End dot11fGetPackedWMMAddTSRequestSize. */
+
+tANI_U32 dot11fGetPackedWMMAddTSResponseSize(tpAniSirGlobal pCtx, tDot11fWMMAddTSResponse *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 4;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_WMMAddTSResponse);
+    return status;
+} /* End dot11fGetPackedWMMAddTSResponseSize. */
+
+tANI_U32 dot11fGetPackedWMMDelTSSize(tpAniSirGlobal pCtx, tDot11fWMMDelTS *pFrm, tANI_U32 *pnNeeded)
+{
+    tANI_U32 status = 0;
+    *pnNeeded = 4;
+    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_WMMDelTS);
+    return status;
+} /* End dot11fGetPackedWMMDelTSSize. */
+
+static tANI_U32 GetPackedSizeCore(tpAniSirGlobal pCtx,
+                                      tANI_U8 *pFrm,
+                                      tANI_U32 *pnNeeded,
+                                      const tIEDefn  IEs[])
+{
+    const tIEDefn *pIe;
+    tANI_U16  i, n;
+    tANI_U32  status;
+    tFRAMES_BOOL *pfFound;
+    tANI_U32 countOffset = 0;
+    tANI_U32 byteCount = 0;
+    tANI_U8  pIePresent = 0;
+    tANI_U32 offset = 0;
+    
+    status = DOT11F_PARSE_SUCCESS;
+
+    (void)pCtx; /* Shutup the compiler if we have no FFs nor IEs... */
+    i=0; n=0;
+    pIe = &( IEs[0] );
+    while ( 0xff != pIe->eid )
+    {
+        pfFound = (tFRAMES_BOOL*)(pFrm + pIe->offset +
+                                  pIe->presenceOffset);
+        if ( *pfFound )
+        {
+            countOffset = ((0 == pIe->arraybound) ? 1 : (*( tANI_U16* )(pFrm + pIe->countOffset)) );
+            for (i = 0U; i < countOffset; ++i)
+            {
+               *pnNeeded += 2U + pIe->noui;
+               byteCount = 0;
+               switch (pIe->sig)
+               {
+                case SigIeAPName:
+                            offset = sizeof(tDot11fIEAPName);
+                            byteCount = ((tDot11fIEAPName* )(pFrm + pIe->offset + sizeof(tDot11fIEAPName) * i ))->num_name;
+                            pIePresent = ( (tDot11fIEAPName* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeBPIndicator:
+                            offset = sizeof(tDot11fIEBPIndicator);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEBPIndicator* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCondensedCountryStr:
+                            offset = sizeof(tDot11fIECondensedCountryStr);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIECondensedCountryStr* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeGTK:
+                            offset = sizeof(tDot11fIEGTK);
+                            byteCount = ((tDot11fIEGTK* )(pFrm + pIe->offset + sizeof(tDot11fIEGTK) * i ))->num_key + 11;
+                            pIePresent = ( (tDot11fIEGTK* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeHCF:
+                            offset = sizeof(tDot11fIEHCF);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEHCF* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeLLAttr:
+                            offset = sizeof(tDot11fIELLAttr);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIELLAttr* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeLoadBalance:
+                            offset = sizeof(tDot11fIELoadBalance);
+                            byteCount = 7;
+                            pIePresent = ( (tDot11fIELoadBalance* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeLoadInfo:
+                            offset = sizeof(tDot11fIELoadInfo);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIELoadInfo* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropAssocType:
+                            offset = sizeof(tDot11fIEPropAssocType);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEPropAssocType* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropCapability:
+                            offset = sizeof(tDot11fIEPropCapability);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEPropCapability* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropChannSwitchAnn:
+                            offset = sizeof(tDot11fIEPropChannSwitchAnn);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIEPropChannSwitchAnn* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropEDCAParams:
+                            offset = sizeof(tDot11fIEPropEDCAParams);
+                            byteCount = 18;
+                            pIePresent = ( (tDot11fIEPropEDCAParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropQuietBSS:
+                            offset = sizeof(tDot11fIEPropQuietBSS);
+                            byteCount = 6;
+                            pIePresent = ( (tDot11fIEPropQuietBSS* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePropSuppRates:
+                            offset = sizeof(tDot11fIEPropSuppRates);
+                            byteCount = ((tDot11fIEPropSuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIEPropSuppRates) * i ))->num_rates;
+                            pIePresent = ( (tDot11fIEPropSuppRates* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeR0KH_ID:
+                            offset = sizeof(tDot11fIER0KH_ID);
+                            byteCount = ((tDot11fIER0KH_ID* )(pFrm + pIe->offset + sizeof(tDot11fIER0KH_ID) * i ))->num_PMK_R0_ID;
+                            pIePresent = ( (tDot11fIER0KH_ID* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeR1KH_ID:
+                            offset = sizeof(tDot11fIER1KH_ID);
+                            byteCount = 6;
+                            pIePresent = ( (tDot11fIER1KH_ID* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTSFInfo:
+                            offset = sizeof(tDot11fIETSFInfo);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIETSFInfo* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTaurus:
+                            offset = sizeof(tDot11fIETaurus);
+                            byteCount = 6;
+                            pIePresent = ( (tDot11fIETaurus* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTitan:
+                            offset = sizeof(tDot11fIETitan);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIETitan* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTriggerStaBgScan:
+                            offset = sizeof(tDot11fIETriggerStaBgScan);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIETriggerStaBgScan* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeVersion:
+                            offset = sizeof(tDot11fIEVersion);
+                            byteCount = ((tDot11fIEVersion* )(pFrm + pIe->offset + sizeof(tDot11fIEVersion) * i ))->num_build_version + 5;
+                            pIePresent = ( (tDot11fIEVersion* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWDS:
+                            offset = sizeof(tDot11fIEWDS);
+                            byteCount = ((tDot11fIEWDS* )(pFrm + pIe->offset + sizeof(tDot11fIEWDS) * i ))->num_wdsData;
+                            pIePresent = ( (tDot11fIEWDS* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeAPChannelReport:
+                            offset = sizeof(tDot11fIEAPChannelReport);
+                            byteCount = ((tDot11fIEAPChannelReport* )(pFrm + pIe->offset + sizeof(tDot11fIEAPChannelReport) * i ))->num_channelList + 1;
+                            pIePresent = ( (tDot11fIEAPChannelReport* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeBcnReportingDetail:
+                            offset = sizeof(tDot11fIEBcnReportingDetail);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEBcnReportingDetail* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeBeaconReportFrmBody:
+                            offset = sizeof(tDot11fIEBeaconReportFrmBody);
+                            byteCount = ((tDot11fIEBeaconReportFrmBody* )(pFrm + pIe->offset + sizeof(tDot11fIEBeaconReportFrmBody) * i ))->num_reportedFields;
+                            pIePresent = ( (tDot11fIEBeaconReportFrmBody* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeBeaconReporting:
+                            offset = sizeof(tDot11fIEBeaconReporting);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEBeaconReporting* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeMeasurementPilot:
+                            offset = sizeof(tDot11fIEMeasurementPilot);
+                            byteCount = ((tDot11fIEMeasurementPilot* )(pFrm + pIe->offset + sizeof(tDot11fIEMeasurementPilot) * i ))->num_vendorSpecific + 1;
+                            pIePresent = ( (tDot11fIEMeasurementPilot* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeMultiBssid:
+                            offset = sizeof(tDot11fIEMultiBssid);
+                            byteCount = ((tDot11fIEMultiBssid* )(pFrm + pIe->offset + sizeof(tDot11fIEMultiBssid) * i ))->num_vendorSpecific + 1;
+                            pIePresent = ( (tDot11fIEMultiBssid* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRICData:
+                            offset = sizeof(tDot11fIERICData);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIERICData* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRICDescriptor:
+                            offset = sizeof(tDot11fIERICDescriptor);
+                            byteCount = ((tDot11fIERICDescriptor* )(pFrm + pIe->offset + sizeof(tDot11fIERICDescriptor) * i ))->num_variableData + 1;
+                            pIePresent = ( (tDot11fIERICDescriptor* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRRMEnabledCap:
+                            offset = sizeof(tDot11fIERRMEnabledCap);
+                            byteCount = 5;
+                            pIePresent = ( (tDot11fIERRMEnabledCap* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRequestedInfo:
+                            offset = sizeof(tDot11fIERequestedInfo);
+                            byteCount = ((tDot11fIERequestedInfo* )(pFrm + pIe->offset + sizeof(tDot11fIERequestedInfo) * i ))->num_requested_eids;
+                            pIePresent = ( (tDot11fIERequestedInfo* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeSSID:
+                            offset = sizeof(tDot11fIESSID);
+                            byteCount = ((tDot11fIESSID* )(pFrm + pIe->offset + sizeof(tDot11fIESSID) * i ))->num_ssid;
+                            pIePresent = ( (tDot11fIESSID* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeSchedule:
+                            offset = sizeof(tDot11fIESchedule);
+                            byteCount = 14;
+                            pIePresent = ( (tDot11fIESchedule* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTCLAS:
+                            offset = sizeof(tDot11fIETCLAS);
+                            status |= dot11fGetPackedIETCLAS(pCtx, ( tDot11fIETCLAS* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeTCLASSPROC:
+                            offset = sizeof(tDot11fIETCLASSPROC);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIETCLASSPROC* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTSDelay:
+                            offset = sizeof(tDot11fIETSDelay);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIETSDelay* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTSPEC:
+                            offset = sizeof(tDot11fIETSPEC);
+                            byteCount = 55;
+                            pIePresent = ( (tDot11fIETSPEC* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMSchedule:
+                            offset = sizeof(tDot11fIEWMMSchedule);
+                            byteCount = 15;
+                            pIePresent = ( (tDot11fIEWMMSchedule* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMTCLAS:
+                            offset = sizeof(tDot11fIEWMMTCLAS);
+                            status |= dot11fGetPackedIEWMMTCLAS(pCtx, ( tDot11fIEWMMTCLAS* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWMMTCLASPROC:
+                            offset = sizeof(tDot11fIEWMMTCLASPROC);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEWMMTCLASPROC* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMTSDelay:
+                            offset = sizeof(tDot11fIEWMMTSDelay);
+                            byteCount = 5;
+                            pIePresent = ( (tDot11fIEWMMTSDelay* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMTSPEC:
+                            offset = sizeof(tDot11fIEWMMTSPEC);
+                            byteCount = 56;
+                            pIePresent = ( (tDot11fIEWMMTSPEC* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeAirgo:
+                            offset = sizeof(tDot11fIEAirgo);
+                            status |= dot11fGetPackedIEAirgo(pCtx, ( tDot11fIEAirgo* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeCCXCckmOpaque:
+                            offset = sizeof(tDot11fIECCXCckmOpaque);
+                            byteCount = ((tDot11fIECCXCckmOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIECCXCckmOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIECCXCckmOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCCXRadMgmtCap:
+                            offset = sizeof(tDot11fIECCXRadMgmtCap);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIECCXRadMgmtCap* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCCXTrafStrmMet:
+                            offset = sizeof(tDot11fIECCXTrafStrmMet);
+                            byteCount = 4;
+                            pIePresent = ( (tDot11fIECCXTrafStrmMet* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCCXTrafStrmRateSet:
+                            offset = sizeof(tDot11fIECCXTrafStrmRateSet);
+                            byteCount = ((tDot11fIECCXTrafStrmRateSet* )(pFrm + pIe->offset + sizeof(tDot11fIECCXTrafStrmRateSet) * i ))->num_tsrates + 1;
+                            pIePresent = ( (tDot11fIECCXTrafStrmRateSet* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCCXTxmitPower:
+                            offset = sizeof(tDot11fIECCXTxmitPower);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIECCXTxmitPower* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCCXVersion:
+                            offset = sizeof(tDot11fIECCXVersion);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIECCXVersion* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCFParams:
+                            offset = sizeof(tDot11fIECFParams);
+                            byteCount = 6;
+                            pIePresent = ( (tDot11fIECFParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeChallengeText:
+                            offset = sizeof(tDot11fIEChallengeText);
+                            byteCount = ((tDot11fIEChallengeText* )(pFrm + pIe->offset + sizeof(tDot11fIEChallengeText) * i ))->num_text;
+                            pIePresent = ( (tDot11fIEChallengeText* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeChanSwitchAnn:
+                            offset = sizeof(tDot11fIEChanSwitchAnn);
+                            byteCount = 3;
+                            pIePresent = ( (tDot11fIEChanSwitchAnn* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeCountry:
+                            offset = sizeof(tDot11fIECountry);
+                            status |= dot11fGetPackedIECountry(pCtx, ( tDot11fIECountry* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeDSParams:
+                            offset = sizeof(tDot11fIEDSParams);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEDSParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeEDCAParamSet:
+                            offset = sizeof(tDot11fIEEDCAParamSet);
+                            byteCount = 18;
+                            pIePresent = ( (tDot11fIEEDCAParamSet* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeERPInfo:
+                            offset = sizeof(tDot11fIEERPInfo);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEERPInfo* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeExtChanSwitchAnn:
+                            offset = sizeof(tDot11fIEExtChanSwitchAnn);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEExtChanSwitchAnn* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeExtSuppRates:
+                            offset = sizeof(tDot11fIEExtSuppRates);
+                            byteCount = ((tDot11fIEExtSuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIEExtSuppRates) * i ))->num_rates;
+                            pIePresent = ( (tDot11fIEExtSuppRates* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeFHParamSet:
+                            offset = sizeof(tDot11fIEFHParamSet);
+                            byteCount = 5;
+                            pIePresent = ( (tDot11fIEFHParamSet* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeFHParams:
+                            offset = sizeof(tDot11fIEFHParams);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEFHParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeFHPattTable:
+                            offset = sizeof(tDot11fIEFHPattTable);
+                            byteCount = ((tDot11fIEFHPattTable* )(pFrm + pIe->offset + sizeof(tDot11fIEFHPattTable) * i ))->num_randtable + 4;
+                            pIePresent = ( (tDot11fIEFHPattTable* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeFTInfo:
+                            offset = sizeof(tDot11fIEFTInfo);
+                            status |= dot11fGetPackedIEFTInfo(pCtx, ( tDot11fIEFTInfo* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeFTTimeoutInterval:
+                            offset = sizeof(tDot11fIEFTTimeoutInterval);
+                            byteCount = 5;
+                            pIePresent = ( (tDot11fIEFTTimeoutInterval* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeHTCaps:
+                            offset = sizeof(tDot11fIEHTCaps);
+                            byteCount = ((tDot11fIEHTCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEHTCaps) * i ))->num_rsvd + 26;
+                            pIePresent = ( (tDot11fIEHTCaps* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeHTInfo:
+                            offset = sizeof(tDot11fIEHTInfo);
+                            byteCount = ((tDot11fIEHTInfo* )(pFrm + pIe->offset + sizeof(tDot11fIEHTInfo) * i ))->num_rsvd + 22;
+                            pIePresent = ( (tDot11fIEHTInfo* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeIBSSParams:
+                            offset = sizeof(tDot11fIEIBSSParams);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEIBSSParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeMeasurementReport:
+                            offset = sizeof(tDot11fIEMeasurementReport);
+                            status |= dot11fGetPackedIEMeasurementReport(pCtx, ( tDot11fIEMeasurementReport* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeMeasurementRequest:
+                            offset = sizeof(tDot11fIEMeasurementRequest);
+                            status |= dot11fGetPackedIEMeasurementRequest(pCtx, ( tDot11fIEMeasurementRequest* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeMobilityDomain:
+                            offset = sizeof(tDot11fIEMobilityDomain);
+                            byteCount = 3;
+                            pIePresent = ( (tDot11fIEMobilityDomain* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeNeighborReport:
+                            offset = sizeof(tDot11fIENeighborReport);
+                            status |= dot11fGetPackedIENeighborReport(pCtx, ( tDot11fIENeighborReport* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PAssocReq:
+                            offset = sizeof(tDot11fIEP2PAssocReq);
+                            status |= dot11fGetPackedIEP2PAssocReq(pCtx, ( tDot11fIEP2PAssocReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PAssocRes:
+                            offset = sizeof(tDot11fIEP2PAssocRes);
+                            status |= dot11fGetPackedIEP2PAssocRes(pCtx, ( tDot11fIEP2PAssocRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PBeacon:
+                            offset = sizeof(tDot11fIEP2PBeacon);
+                            status |= dot11fGetPackedIEP2PBeacon(pCtx, ( tDot11fIEP2PBeacon* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PBeaconProbeRes:
+                            offset = sizeof(tDot11fIEP2PBeaconProbeRes);
+                            status |= dot11fGetPackedIEP2PBeaconProbeRes(pCtx, ( tDot11fIEP2PBeaconProbeRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PDeAuth:
+                            offset = sizeof(tDot11fIEP2PDeAuth);
+                            status |= dot11fGetPackedIEP2PDeAuth(pCtx, ( tDot11fIEP2PDeAuth* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PDeviceDiscoverabilityReq:
+                            offset = sizeof(tDot11fIEP2PDeviceDiscoverabilityReq);
+                            status |= dot11fGetPackedIEP2PDeviceDiscoverabilityReq(pCtx, ( tDot11fIEP2PDeviceDiscoverabilityReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PDeviceDiscoverabilityRes:
+                            offset = sizeof(tDot11fIEP2PDeviceDiscoverabilityRes);
+                            status |= dot11fGetPackedIEP2PDeviceDiscoverabilityRes(pCtx, ( tDot11fIEP2PDeviceDiscoverabilityRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PDisAssoc:
+                            offset = sizeof(tDot11fIEP2PDisAssoc);
+                            status |= dot11fGetPackedIEP2PDisAssoc(pCtx, ( tDot11fIEP2PDisAssoc* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PGONegCnf:
+                            offset = sizeof(tDot11fIEP2PGONegCnf);
+                            status |= dot11fGetPackedIEP2PGONegCnf(pCtx, ( tDot11fIEP2PGONegCnf* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PGONegReq:
+                            offset = sizeof(tDot11fIEP2PGONegReq);
+                            status |= dot11fGetPackedIEP2PGONegReq(pCtx, ( tDot11fIEP2PGONegReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PGONegRes:
+                            offset = sizeof(tDot11fIEP2PGONegRes);
+                            status |= dot11fGetPackedIEP2PGONegRes(pCtx, ( tDot11fIEP2PGONegRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PGONegWPS:
+                            offset = sizeof(tDot11fIEP2PGONegWPS);
+                            status |= dot11fGetPackedIEP2PGONegWPS(pCtx, ( tDot11fIEP2PGONegWPS* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PIEOpaque:
+                            offset = sizeof(tDot11fIEP2PIEOpaque);
+                            byteCount = ((tDot11fIEP2PIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEP2PIEOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIEP2PIEOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeP2PInvitationReq:
+                            offset = sizeof(tDot11fIEP2PInvitationReq);
+                            status |= dot11fGetPackedIEP2PInvitationReq(pCtx, ( tDot11fIEP2PInvitationReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PInvitationRes:
+                            offset = sizeof(tDot11fIEP2PInvitationRes);
+                            status |= dot11fGetPackedIEP2PInvitationRes(pCtx, ( tDot11fIEP2PInvitationRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PNoticeOfAbsence:
+                            offset = sizeof(tDot11fIEP2PNoticeOfAbsence);
+                            status |= dot11fGetPackedIEP2PNoticeOfAbsence(pCtx, ( tDot11fIEP2PNoticeOfAbsence* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PPresenceResponse:
+                            offset = sizeof(tDot11fIEP2PPresenceResponse);
+                            status |= dot11fGetPackedIEP2PPresenceResponse(pCtx, ( tDot11fIEP2PPresenceResponse* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PProbeReq:
+                            offset = sizeof(tDot11fIEP2PProbeReq);
+                            status |= dot11fGetPackedIEP2PProbeReq(pCtx, ( tDot11fIEP2PProbeReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PProbeRes:
+                            offset = sizeof(tDot11fIEP2PProbeRes);
+                            status |= dot11fGetPackedIEP2PProbeRes(pCtx, ( tDot11fIEP2PProbeRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PProvisionDiscoveryReq:
+                            offset = sizeof(tDot11fIEP2PProvisionDiscoveryReq);
+                            status |= dot11fGetPackedIEP2PProvisionDiscoveryReq(pCtx, ( tDot11fIEP2PProvisionDiscoveryReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeP2PWSCProvisionDiscoveryRes:
+                            offset = sizeof(tDot11fIEP2PWSCProvisionDiscoveryRes);
+                            status |= dot11fGetPackedIEP2PWSCProvisionDiscoveryRes(pCtx, ( tDot11fIEP2PWSCProvisionDiscoveryRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIePowerCaps:
+                            offset = sizeof(tDot11fIEPowerCaps);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEPowerCaps* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIePowerConstraints:
+                            offset = sizeof(tDot11fIEPowerConstraints);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEPowerConstraints* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeQBSSLoad:
+                            offset = sizeof(tDot11fIEQBSSLoad);
+                            byteCount = 5;
+                            pIePresent = ( (tDot11fIEQBSSLoad* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeQOSCapsAp:
+                            offset = sizeof(tDot11fIEQOSCapsAp);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEQOSCapsAp* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeQOSCapsStation:
+                            offset = sizeof(tDot11fIEQOSCapsStation);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIEQOSCapsStation* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeQuiet:
+                            offset = sizeof(tDot11fIEQuiet);
+                            byteCount = 6;
+                            pIePresent = ( (tDot11fIEQuiet* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRCPIIE:
+                            offset = sizeof(tDot11fIERCPIIE);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIERCPIIE* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRICDataDesc:
+                            offset = sizeof(tDot11fIERICDataDesc);
+                            pnNeeded -= 2  ; //Subtract the length and Oui as this is our container IE to group Ies and it doesnt have its own length and OUI.
+                            status |= dot11fGetPackedIERICDataDesc(pCtx, ( tDot11fIERICDataDesc* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeRSN:
+                            offset = sizeof(tDot11fIERSN);
+                            status |= dot11fGetPackedIERSN(pCtx, ( tDot11fIERSN* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeRSNIIE:
+                            offset = sizeof(tDot11fIERSNIIE);
+                            byteCount = 1;
+                            pIePresent = ( (tDot11fIERSNIIE* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeRSNOpaque:
+                            offset = sizeof(tDot11fIERSNOpaque);
+                            byteCount = ((tDot11fIERSNOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIERSNOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIERSNOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeSuppChannels:
+                            offset = sizeof(tDot11fIESuppChannels);
+                            byteCount = ((tDot11fIESuppChannels* )(pFrm + pIe->offset + sizeof(tDot11fIESuppChannels) * i ))->num_bands * 2;
+                            pIePresent = ( (tDot11fIESuppChannels* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeSuppRates:
+                            offset = sizeof(tDot11fIESuppRates);
+                            byteCount = ((tDot11fIESuppRates* )(pFrm + pIe->offset + sizeof(tDot11fIESuppRates) * i ))->num_rates;
+                            pIePresent = ( (tDot11fIESuppRates* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTIM:
+                            offset = sizeof(tDot11fIETIM);
+                            byteCount = ((tDot11fIETIM* )(pFrm + pIe->offset + sizeof(tDot11fIETIM) * i ))->num_vbmp + 3;
+                            pIePresent = ( (tDot11fIETIM* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTPCReport:
+                            offset = sizeof(tDot11fIETPCReport);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIETPCReport* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeTPCRequest:
+                            offset = sizeof(tDot11fIETPCRequest);
+                            byteCount = 0;
+                            pIePresent = ( (tDot11fIETPCRequest* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWAPI:
+                            offset = sizeof(tDot11fIEWAPI);
+                            status |= dot11fGetPackedIEWAPI(pCtx, ( tDot11fIEWAPI* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWAPIOpaque:
+                            offset = sizeof(tDot11fIEWAPIOpaque);
+                            byteCount = ((tDot11fIEWAPIOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWAPIOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIEWAPIOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWFATPC:
+                            offset = sizeof(tDot11fIEWFATPC);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEWFATPC* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMCaps:
+                            offset = sizeof(tDot11fIEWMMCaps);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEWMMCaps* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMInfoAp:
+                            offset = sizeof(tDot11fIEWMMInfoAp);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEWMMInfoAp* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMInfoStation:
+                            offset = sizeof(tDot11fIEWMMInfoStation);
+                            byteCount = 2;
+                            pIePresent = ( (tDot11fIEWMMInfoStation* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWMMParams:
+                            offset = sizeof(tDot11fIEWMMParams);
+                            byteCount = 19;
+                            pIePresent = ( (tDot11fIEWMMParams* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWPA:
+                            offset = sizeof(tDot11fIEWPA);
+                            status |= dot11fGetPackedIEWPA(pCtx, ( tDot11fIEWPA* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWPAOpaque:
+                            offset = sizeof(tDot11fIEWPAOpaque);
+                            byteCount = ((tDot11fIEWPAOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWPAOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIEWPAOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWSC:
+                            offset = sizeof(tDot11fIEWSC);
+                            status |= dot11fGetPackedIEWSC(pCtx, ( tDot11fIEWSC* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscAssocReq:
+                            offset = sizeof(tDot11fIEWscAssocReq);
+                            status |= dot11fGetPackedIEWscAssocReq(pCtx, ( tDot11fIEWscAssocReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscAssocRes:
+                            offset = sizeof(tDot11fIEWscAssocRes);
+                            status |= dot11fGetPackedIEWscAssocRes(pCtx, ( tDot11fIEWscAssocRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscBeacon:
+                            offset = sizeof(tDot11fIEWscBeacon);
+                            status |= dot11fGetPackedIEWscBeacon(pCtx, ( tDot11fIEWscBeacon* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscBeaconProbeRes:
+                            offset = sizeof(tDot11fIEWscBeaconProbeRes);
+                            status |= dot11fGetPackedIEWscBeaconProbeRes(pCtx, ( tDot11fIEWscBeaconProbeRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscIEOpaque:
+                            offset = sizeof(tDot11fIEWscIEOpaque);
+                            byteCount = ((tDot11fIEWscIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWscIEOpaque) * i ))->num_data;
+                            pIePresent = ( (tDot11fIEWscIEOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
+                            break;
+                case SigIeWscProbeReq:
+                            offset = sizeof(tDot11fIEWscProbeReq);
+                            status |= dot11fGetPackedIEWscProbeReq(pCtx, ( tDot11fIEWscProbeReq* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscProbeRes:
+                            offset = sizeof(tDot11fIEWscProbeRes);
+                            status |= dot11fGetPackedIEWscProbeRes(pCtx, ( tDot11fIEWscProbeRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+                case SigIeWscReassocRes:
+                            offset = sizeof(tDot11fIEWscReassocRes);
+                            status |= dot11fGetPackedIEWscReassocRes(pCtx, ( tDot11fIEWscReassocRes* )(pFrm + pIe->offset + offset * i ), pnNeeded);
+                            break;
+               default:
+                   FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don"
+                       "'t know about the IE signature %d; this is most l"
+                       "ikely a bug in 'framesc'.\n"), pIe->sig);
+                   return DOT11F_INTERNAL_ERROR;
+               }/*End of switch Case*/
+               if( byteCount && pIePresent )
+                 *pnNeeded += byteCount;
+           } /*End of for loop*/
+        }
+        ++pIe;
+    }
+    return status;
+
+}
+
+static tANI_U32 GetPackedSizeTlvCore(tpAniSirGlobal pCtx,
+                                 tANI_U8 *pFrm,
+                                 tANI_U32 *pnNeeded,
+                                 const tTLVDefn  TLVs[])
+{
+    const tTLVDefn *pTlv;
+    tANI_U32   status;
+    tFRAMES_BOOL   *pfFound;
+    tANI_U32   byteCount = 0;
+    tANI_U8    pTlvPresent = 0;
+
+    status = DOT11F_PARSE_SUCCESS;
+
+    pTlv = &( TLVs[0] );
+    while ( 0xffff != pTlv->id )
+    {
+        pfFound = (tFRAMES_BOOL*)(pFrm + pTlv->offset +
+                                  pTlv->presenceOffset);
+        if ( *pfFound )
+        {
+            *pnNeeded += (pTlv->sType + pTlv->sLen);
+            if ( pTlv->pec ) *pnNeeded += 3U;
+            switch (pTlv->sig)
+            {
+                case SigTlvAuthorizedMACs:
+                    byteCount = 6;
+                        pTlvPresent = (( tDot11fTLVAuthorizedMACs* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvRequestToEnroll:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVRequestToEnroll* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvVersion2:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVVersion2* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvAPSetupLocked:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVAPSetupLocked* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvAssociationState:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVAssociationState* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvChannelList:
+                    byteCount = ((tDot11fTLVChannelList*)(pFrm + pTlv->offset))->num_channelList+3;
+                        pTlvPresent = (( tDot11fTLVChannelList* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvConfigMethods:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVConfigMethods* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvConfigurationError:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVConfigurationError* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvConfigurationTimeout:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVConfigurationTimeout* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvDeviceName:
+                    byteCount = ((tDot11fTLVDeviceName*)(pFrm + pTlv->offset))->num_text;
+                        pTlvPresent = (( tDot11fTLVDeviceName* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvDevicePasswordID:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVDevicePasswordID* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvExtendedListenTiming:
+                    byteCount = 4;
+                        pTlvPresent = (( tDot11fTLVExtendedListenTiming* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvGOIntent:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVGOIntent* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvIntendedP2PInterfaceAddress:
+                    byteCount = 6;
+                        pTlvPresent = (( tDot11fTLVIntendedP2PInterfaceAddress* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvInvitationFlags:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVInvitationFlags* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvListenChannel:
+                    byteCount = 5;
+                        pTlvPresent = (( tDot11fTLVListenChannel* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvManufacturer:
+                    byteCount = ((tDot11fTLVManufacturer*)(pFrm + pTlv->offset))->num_name;
+                        pTlvPresent = (( tDot11fTLVManufacturer* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvMinorReasonCode:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVMinorReasonCode* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvModelName:
+                    byteCount = ((tDot11fTLVModelName*)(pFrm + pTlv->offset))->num_text;
+                        pTlvPresent = (( tDot11fTLVModelName* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvModelNumber:
+                    byteCount = ((tDot11fTLVModelNumber*)(pFrm + pTlv->offset))->num_text;
+                        pTlvPresent = (( tDot11fTLVModelNumber* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvNoticeOfAbsence:
+                    byteCount = ((tDot11fTLVNoticeOfAbsence*)(pFrm + pTlv->offset))->num_NoADesc+2;
+                        pTlvPresent = (( tDot11fTLVNoticeOfAbsence* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvOperatingChannel:
+                    byteCount = 5;
+                        pTlvPresent = (( tDot11fTLVOperatingChannel* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PCapability:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVP2PCapability* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PDeviceId:
+                    byteCount = 6;
+                        pTlvPresent = (( tDot11fTLVP2PDeviceId* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PDeviceInfo:
+        status = GetPackedSizeTlvCore(pCtx, ( tANI_U8* )pFrm + pTlv->offset, pnNeeded, TLVS_P2PDeviceInfo);
+                    byteCount = 16;
+                        pTlvPresent = (( tDot11fTLVP2PDeviceInfo* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PGroupBssid:
+                    byteCount = 6;
+                        pTlvPresent = (( tDot11fTLVP2PGroupBssid* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PGroupId:
+                    byteCount = ((tDot11fTLVP2PGroupId*)(pFrm + pTlv->offset))->num_ssid+6;
+                        pTlvPresent = (( tDot11fTLVP2PGroupId* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PGroupInfo:
+                    byteCount = ((tDot11fTLVP2PGroupInfo*)(pFrm + pTlv->offset))->num_P2PClientInfoDesc;
+                        pTlvPresent = (( tDot11fTLVP2PGroupInfo* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PStatus:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVP2PStatus* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvPrimaryDeviceType:
+                    byteCount = 8;
+                        pTlvPresent = (( tDot11fTLVPrimaryDeviceType* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvRFBands:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVRFBands* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvRequestDeviceType:
+                    byteCount = 8;
+                        pTlvPresent = (( tDot11fTLVRequestDeviceType* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvRequestType:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVRequestType* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvResponseType:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVResponseType* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvSelectedRegistrar:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVSelectedRegistrar* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvSelectedRegistrarConfigMethods:
+                    byteCount = 2;
+                        pTlvPresent = (( tDot11fTLVSelectedRegistrarConfigMethods* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvSerialNumber:
+                    byteCount = ((tDot11fTLVSerialNumber*)(pFrm + pTlv->offset))->num_text;
+                        pTlvPresent = (( tDot11fTLVSerialNumber* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvUUID_E:
+                    byteCount = 16;
+                        pTlvPresent = (( tDot11fTLVUUID_E* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvUUID_R:
+                    byteCount = 16;
+                        pTlvPresent = (( tDot11fTLVUUID_R* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvVendorExtension:
+        status = GetPackedSizeTlvCore(pCtx, ( tANI_U8* )pFrm + pTlv->offset, pnNeeded, TLVS_VendorExtension);
+                    byteCount = 3;
+                        pTlvPresent = (( tDot11fTLVVendorExtension* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvVersion:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVVersion* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvWPSState:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVWPSState* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PInterface:
+                    byteCount = 6;
+                        pTlvPresent = (( tDot11fTLVP2PInterface* )(pFrm + pTlv->offset))->present;
+                    break;
+                case SigTlvP2PManageability:
+                    byteCount = 1;
+                        pTlvPresent = (( tDot11fTLVP2PManageability* )(pFrm + pTlv->offset))->present;
+                    break;
+            default:
+                FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don"
+                    "'t know about the TLV signature %d; this is most l"
+                    "ikely a bug in 'framesc'.\n"), pTlv->sig);
+                return DOT11F_INTERNAL_ERROR;
+            }
+            if(pTlvPresent) {
+              *pnNeeded += byteCount;
+            }
+        }
+        ++pTlv;
+    }
+    return status;
+}
+void dot11fPackFfAID(tpAniSirGlobal pCtx,
+                     tDot11fFfAID *pSrc,
+                     tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->associd, 0);
+    (void)pCtx;
+} /* End dot11fPackFfAID. */
+
+void dot11fPackFfAction(tpAniSirGlobal pCtx,
+                        tDot11fFfAction *pSrc,
+                        tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->action;
+    (void)pCtx;
+} /* End dot11fPackFfAction. */
+
+void dot11fPackFfAddBAParameterSet(tpAniSirGlobal pCtx,
+                                   tDot11fFfAddBAParameterSet *pSrc,
+                                   tANI_U8 *pBuf)
+{
+    tANI_U16 tmp72__;
+    tmp72__ = 0U;
+    tmp72__ |= ( pSrc->amsduSupported << 0 );
+    tmp72__ |= ( pSrc->policy << 1 );
+    tmp72__ |= ( pSrc->tid << 2 );
+    tmp72__ |= ( pSrc->bufferSize << 6 );
+    frameshtons(pCtx, pBuf, tmp72__, 0);
+    (void)pCtx;
+} /* End dot11fPackFfAddBAParameterSet. */
+
+void dot11fPackFfAuthAlgo(tpAniSirGlobal pCtx,
+                          tDot11fFfAuthAlgo *pSrc,
+                          tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->algo, 0);
+    (void)pCtx;
+} /* End dot11fPackFfAuthAlgo. */
+
+void dot11fPackFfAuthSeqNo(tpAniSirGlobal pCtx,
+                           tDot11fFfAuthSeqNo *pSrc,
+                           tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->no, 0);
+    (void)pCtx;
+} /* End dot11fPackFfAuthSeqNo. */
+
+void dot11fPackFfBAStartingSequenceControl(tpAniSirGlobal pCtx,
+                                           tDot11fFfBAStartingSequenceControl *pSrc,
+                                           tANI_U8 *pBuf)
+{
+    tANI_U16 tmp73__;
+    tmp73__ = 0U;
+    tmp73__ |= ( pSrc->fragNumber << 0 );
+    tmp73__ |= ( pSrc->ssn << 4 );
+    frameshtons(pCtx, pBuf, tmp73__, 0);
+    (void)pCtx;
+} /* End dot11fPackFfBAStartingSequenceControl. */
+
+void dot11fPackFfBATimeout(tpAniSirGlobal pCtx,
+                           tDot11fFfBATimeout *pSrc,
+                           tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->timeout, 0);
+    (void)pCtx;
+} /* End dot11fPackFfBATimeout. */
+
+void dot11fPackFfBeaconInterval(tpAniSirGlobal pCtx,
+                                tDot11fFfBeaconInterval *pSrc,
+                                tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->interval, 0);
+    (void)pCtx;
+} /* End dot11fPackFfBeaconInterval. */
+
+void dot11fPackFfCapabilities(tpAniSirGlobal pCtx,
+                              tDot11fFfCapabilities *pSrc,
+                              tANI_U8 *pBuf)
+{
+    tANI_U16 tmp74__;
+    tmp74__ = 0U;
+    tmp74__ |= ( pSrc->ess << 0 );
+    tmp74__ |= ( pSrc->ibss << 1 );
+    tmp74__ |= ( pSrc->cfPollable << 2 );
+    tmp74__ |= ( pSrc->cfPollReq << 3 );
+    tmp74__ |= ( pSrc->privacy << 4 );
+    tmp74__ |= ( pSrc->shortPreamble << 5 );
+    tmp74__ |= ( pSrc->pbcc << 6 );
+    tmp74__ |= ( pSrc->channelAgility << 7 );
+    tmp74__ |= ( pSrc->spectrumMgt << 8 );
+    tmp74__ |= ( pSrc->qos << 9 );
+    tmp74__ |= ( pSrc->shortSlotTime << 10 );
+    tmp74__ |= ( pSrc->apsd << 11 );
+    tmp74__ |= ( pSrc->rrm << 12 );
+    tmp74__ |= ( pSrc->dsssOfdm << 13 );
+    tmp74__ |= ( pSrc->delayedBA << 14 );
+    tmp74__ |= ( pSrc->immediateBA << 15 );
+    frameshtons(pCtx, pBuf, tmp74__, 0);
+    (void)pCtx;
+} /* End dot11fPackFfCapabilities. */
+
+void dot11fPackFfCategory(tpAniSirGlobal pCtx,
+                          tDot11fFfCategory *pSrc,
+                          tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->category;
+    (void)pCtx;
+} /* End dot11fPackFfCategory. */
+
+void dot11fPackFfCurrentAPAddress(tpAniSirGlobal pCtx,
+                                  tDot11fFfCurrentAPAddress *pSrc,
+                                  tANI_U8 *pBuf)
+{
+    DOT11F_MEMCPY(pCtx, pBuf, pSrc->mac, 6);
+    (void)pCtx;
+} /* End dot11fPackFfCurrentAPAddress. */
+
+void dot11fPackFfDelBAParameterSet(tpAniSirGlobal pCtx,
+                                   tDot11fFfDelBAParameterSet *pSrc,
+                                   tANI_U8 *pBuf)
+{
+    tANI_U16 tmp75__;
+    tmp75__ = 0U;
+    tmp75__ |= ( pSrc->reserved << 0 );
+    tmp75__ |= ( pSrc->initiator << 11 );
+    tmp75__ |= ( pSrc->tid << 12 );
+    frameshtons(pCtx, pBuf, tmp75__, 0);
+    (void)pCtx;
+} /* End dot11fPackFfDelBAParameterSet. */
+
+void dot11fPackFfDialogToken(tpAniSirGlobal pCtx,
+                             tDot11fFfDialogToken *pSrc,
+                             tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->token;
+    (void)pCtx;
+} /* End dot11fPackFfDialogToken. */
+
+void dot11fPackFfLinkMargin(tpAniSirGlobal pCtx,
+                            tDot11fFfLinkMargin *pSrc,
+                            tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->linkMargin;
+    (void)pCtx;
+} /* End dot11fPackFfLinkMargin. */
+
+void dot11fPackFfListenInterval(tpAniSirGlobal pCtx,
+                                tDot11fFfListenInterval *pSrc,
+                                tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->interval, 0);
+    (void)pCtx;
+} /* End dot11fPackFfListenInterval. */
+
+void dot11fPackFfMaxTxPower(tpAniSirGlobal pCtx,
+                            tDot11fFfMaxTxPower *pSrc,
+                            tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->maxTxPower;
+    (void)pCtx;
+} /* End dot11fPackFfMaxTxPower. */
+
+void dot11fPackFfNumOfRepetitions(tpAniSirGlobal pCtx,
+                                  tDot11fFfNumOfRepetitions *pSrc,
+                                  tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->repetitions, 0);
+    (void)pCtx;
+} /* End dot11fPackFfNumOfRepetitions. */
+
+void dot11fPackFfP2POUI(tpAniSirGlobal pCtx,
+                        tDot11fFfP2POUI *pSrc,
+                        tANI_U8 *pBuf)
+{
+    frameshtonl(pCtx, pBuf, pSrc->oui, 0);
+    (void)pCtx;
+} /* End dot11fPackFfP2POUI. */
+
+void dot11fPackFfP2POUISubType(tpAniSirGlobal pCtx,
+                               tDot11fFfP2POUISubType *pSrc,
+                               tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->ouiSubtype;
+    (void)pCtx;
+} /* End dot11fPackFfP2POUISubType. */
+
+void dot11fPackFfRCPI(tpAniSirGlobal pCtx,
+                      tDot11fFfRCPI *pSrc,
+                      tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->rcpi;
+    (void)pCtx;
+} /* End dot11fPackFfRCPI. */
+
+void dot11fPackFfRSNI(tpAniSirGlobal pCtx,
+                      tDot11fFfRSNI *pSrc,
+                      tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->rsni;
+    (void)pCtx;
+} /* End dot11fPackFfRSNI. */
+
+void dot11fPackFfReason(tpAniSirGlobal pCtx,
+                        tDot11fFfReason *pSrc,
+                        tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->code, 0);
+    (void)pCtx;
+} /* End dot11fPackFfReason. */
+
+void dot11fPackFfRxAntennaId(tpAniSirGlobal pCtx,
+                             tDot11fFfRxAntennaId *pSrc,
+                             tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->antennaId;
+    (void)pCtx;
+} /* End dot11fPackFfRxAntennaId. */
+
+void dot11fPackFfSMPowerModeSet(tpAniSirGlobal pCtx,
+                                tDot11fFfSMPowerModeSet *pSrc,
+                                tANI_U8 *pBuf)
+{
+    tANI_U8 tmp76__;
+    tmp76__ = 0U;
+    tmp76__ |= ( pSrc->PowerSave_En << 0 );
+    tmp76__ |= ( pSrc->Mode << 1 );
+    tmp76__ |= ( pSrc->reserved << 2 );
+    *pBuf = tmp76__;
+    (void)pCtx;
+} /* End dot11fPackFfSMPowerModeSet. */
+
+void dot11fPackFfStatus(tpAniSirGlobal pCtx,
+                        tDot11fFfStatus *pSrc,
+                        tANI_U8 *pBuf)
+{
+    frameshtons(pCtx, pBuf, pSrc->status, 0);
+    (void)pCtx;
+} /* End dot11fPackFfStatus. */
+
+void dot11fPackFfStatusCode(tpAniSirGlobal pCtx,
+                            tDot11fFfStatusCode *pSrc,
+                            tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->statusCode;
+    (void)pCtx;
+} /* End dot11fPackFfStatusCode. */
+
+void dot11fPackFfTPCEleID(tpAniSirGlobal pCtx,
+                          tDot11fFfTPCEleID *pSrc,
+                          tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->TPCId;
+    (void)pCtx;
+} /* End dot11fPackFfTPCEleID. */
+
+void dot11fPackFfTPCEleLen(tpAniSirGlobal pCtx,
+                           tDot11fFfTPCEleLen *pSrc,
+                           tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->TPCLen;
+    (void)pCtx;
+} /* End dot11fPackFfTPCEleLen. */
+
+void dot11fPackFfTSInfo(tpAniSirGlobal pCtx,
+                        tDot11fFfTSInfo *pSrc,
+                        tANI_U8 *pBuf)
+{
+    tANI_U32 tmp77__;
+    tmp77__ = 0U;
+    tmp77__ |= ( pSrc->traffic_type << 0 );
+    tmp77__ |= ( pSrc->tsid << 1 );
+    tmp77__ |= ( pSrc->direction << 5 );
+    tmp77__ |= ( pSrc->access_policy << 7 );
+    tmp77__ |= ( pSrc->aggregation << 9 );
+    tmp77__ |= ( pSrc->psb << 10 );
+    tmp77__ |= ( pSrc->user_priority << 11 );
+    tmp77__ |= ( pSrc->tsinfo_ack_pol << 14 );
+    tmp77__ |= ( pSrc->schedule << 16 );
+    tmp77__ |= ( pSrc->unused << 17 );
+    frameshtonl(pCtx, pBuf, tmp77__, 0);
+    (void)pCtx;
+} /* End dot11fPackFfTSInfo. */
+
+void dot11fPackFfTimeStamp(tpAniSirGlobal pCtx,
+                           tDot11fFfTimeStamp *pSrc,
+                           tANI_U8 *pBuf)
+{
+    frameshtonq(pCtx, pBuf, pSrc->timestamp, 0);
+    (void)pCtx;
+} /* End dot11fPackFfTimeStamp. */
+
+void dot11fPackFfTxAntennaId(tpAniSirGlobal pCtx,
+                             tDot11fFfTxAntennaId *pSrc,
+                             tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->antennaId;
+    (void)pCtx;
+} /* End dot11fPackFfTxAntennaId. */
+
+void dot11fPackFfTxPower(tpAniSirGlobal pCtx,
+                         tDot11fFfTxPower *pSrc,
+                         tANI_U8 *pBuf)
+{
+    *pBuf = pSrc->txPower;
+    (void)pCtx;
+} /* End dot11fPackFfTxPower. */
+
+tANI_U32 dot11fPackTlvAuthorizedMACs(tpAniSirGlobal pCtx,
+                                     tDot11fTLVAuthorizedMACs *pSrc,
+                                     tANI_U8 *pBuf,
+                                     tANI_U32 nBuf,
+                                     tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 8;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 1;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 1; *pnConsumed += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->mac, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        *pTlvLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvAuthorizedMACs. */
+
+tANI_U32 dot11fPackTlvRequestToEnroll(tpAniSirGlobal pCtx,
+                                      tDot11fTLVRequestToEnroll *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 3;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 3;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 1; *pnConsumed += 1;
+        *pBuf = pSrc->req;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        *pTlvLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvRequestToEnroll. */
+
+tANI_U32 dot11fPackTlvVersion2(tpAniSirGlobal pCtx,
+                               tDot11fTLVVersion2 *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp78__;
+    nNeeded += 3;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 0;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 1; *pnConsumed += 1;
+        tmp78__ = 0U;
+        tmp78__ |= ( pSrc->minor << 0 );
+        tmp78__ |= ( pSrc->major << 4 );
+        *pBuf = tmp78__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        *pTlvLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvVersion2. */
+
+tANI_U32 dot11fPackTlvAPSetupLocked(tpAniSirGlobal pCtx,
+                                    tDot11fTLVAPSetupLocked *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4183, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->fLocked;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvAPSetupLocked. */
+
+tANI_U32 dot11fPackTlvAssociationState(tpAniSirGlobal pCtx,
+                                       tDot11fTLVAssociationState *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 6;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4098, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->state, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvAssociationState. */
+
+tANI_U32 dot11fPackTlvChannelList(tpAniSirGlobal pCtx,
+                                  tDot11fTLVChannelList *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_channelList + 6) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 11;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->countryString, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->channelList ), pSrc->num_channelList);
+        *pnConsumed += pSrc->num_channelList;
+        pBuf += pSrc->num_channelList;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvChannelList. */
+
+tANI_U32 dot11fPackTlvConfigMethods(tpAniSirGlobal pCtx,
+                                    tDot11fTLVConfigMethods *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 6;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4104, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->methods, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvConfigMethods. */
+
+tANI_U32 dot11fPackTlvConfigurationError(tpAniSirGlobal pCtx,
+                                         tDot11fTLVConfigurationError *pSrc,
+                                         tANI_U8 *pBuf,
+                                         tANI_U32 nBuf,
+                                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 6;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4105, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->error, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvConfigurationError. */
+
+tANI_U32 dot11fPackTlvConfigurationTimeout(tpAniSirGlobal pCtx,
+                                           tDot11fTLVConfigurationTimeout *pSrc,
+                                           tANI_U8 *pBuf,
+                                           tANI_U32 nBuf,
+                                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 5;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->GOConfigTimeout;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->CLConfigTimeout;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvConfigurationTimeout. */
+
+tANI_U32 dot11fPackTlvDeviceName(tpAniSirGlobal pCtx,
+                                 tDot11fTLVDeviceName *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_text + 4) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4113, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->text ), pSrc->num_text);
+        *pnConsumed += pSrc->num_text;
+        pBuf += pSrc->num_text;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvDeviceName. */
+
+tANI_U32 dot11fPackTlvDevicePasswordID(tpAniSirGlobal pCtx,
+                                       tDot11fTLVDevicePasswordID *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 6;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4114, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->id, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvDevicePasswordID. */
+
+tANI_U32 dot11fPackTlvExtendedListenTiming(tpAniSirGlobal pCtx,
+                                           tDot11fTLVExtendedListenTiming *pSrc,
+                                           tANI_U8 *pBuf,
+                                           tANI_U32 nBuf,
+                                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 7;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 8;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->availibilityPeriod, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->availibilityInterval, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvExtendedListenTiming. */
+
+tANI_U32 dot11fPackTlvGOIntent(tpAniSirGlobal pCtx,
+                               tDot11fTLVGOIntent *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 4;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 4;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->GOIntent;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvGOIntent. */
+
+tANI_U32 dot11fPackTlvIntendedP2PInterfaceAddress(tpAniSirGlobal pCtx,
+                                                  tDot11fTLVIntendedP2PInterfaceAddress *pSrc,
+                                                  tANI_U8 *pBuf,
+                                                  tANI_U32 nBuf,
+                                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 9;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 9;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->P2PInterfaceAddress, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvIntendedP2PInterfaceAddress. */
+
+tANI_U32 dot11fPackTlvInvitationFlags(tpAniSirGlobal pCtx,
+                                      tDot11fTLVInvitationFlags *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 4;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 18;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->invitationFlags;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvInvitationFlags. */
+
+tANI_U32 dot11fPackTlvListenChannel(tpAniSirGlobal pCtx,
+                                    tDot11fTLVListenChannel *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 8;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 6;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->countryString, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        *pBuf = pSrc->regulatoryClass;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->channel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvListenChannel. */
+
+tANI_U32 dot11fPackTlvManufacturer(tpAniSirGlobal pCtx,
+                                   tDot11fTLVManufacturer *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_name + 4) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4129, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->name ), pSrc->num_name);
+        *pnConsumed += pSrc->num_name;
+        pBuf += pSrc->num_name;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvManufacturer. */
+
+tANI_U32 dot11fPackTlvMinorReasonCode(tpAniSirGlobal pCtx,
+                                      tDot11fTLVMinorReasonCode *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 4;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 1;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->minorReasonCode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvMinorReasonCode. */
+
+tANI_U32 dot11fPackTlvModelName(tpAniSirGlobal pCtx,
+                                tDot11fTLVModelName *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_text + 4) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4131, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->text ), pSrc->num_text);
+        *pnConsumed += pSrc->num_text;
+        pBuf += pSrc->num_text;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvModelName. */
+
+tANI_U32 dot11fPackTlvModelNumber(tpAniSirGlobal pCtx,
+                                  tDot11fTLVModelNumber *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_text + 4) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4132, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->text ), pSrc->num_text);
+        *pnConsumed += pSrc->num_text;
+        pBuf += pSrc->num_text;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvModelNumber. */
+
+tANI_U32 dot11fPackTlvNoticeOfAbsence(tpAniSirGlobal pCtx,
+                                      tDot11fTLVNoticeOfAbsence *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_NoADesc + 5) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 12;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->index;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->CTSWindowOppPS;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->NoADesc ), pSrc->num_NoADesc);
+        *pnConsumed += pSrc->num_NoADesc;
+        pBuf += pSrc->num_NoADesc;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvNoticeOfAbsence. */
+
+tANI_U32 dot11fPackTlvOperatingChannel(tpAniSirGlobal pCtx,
+                                       tDot11fTLVOperatingChannel *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 8;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 17;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->countryString, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        *pBuf = pSrc->regulatoryClass;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->channel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvOperatingChannel. */
+
+tANI_U32 dot11fPackTlvP2PCapability(tpAniSirGlobal pCtx,
+                                    tDot11fTLVP2PCapability *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 2;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->deviceCapability;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->groupCapability;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PCapability. */
+
+tANI_U32 dot11fPackTlvP2PDeviceId(tpAniSirGlobal pCtx,
+                                  tDot11fTLVP2PDeviceId *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 9;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 3;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->P2PDeviceAddress, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PDeviceId. */
+
+tANI_U32 dot11fPackTlvP2PDeviceInfo(tpAniSirGlobal pCtx,
+                                    tDot11fTLVP2PDeviceInfo *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 idx = 0;
+    nNeeded += 19;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 13;
+        pBuf += 1; nBuf -= 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; nBuf -= 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->P2PDeviceAddress, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        frameshtons(pCtx, pBuf, pSrc->configMethod, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->primaryDeviceType, 8);
+        *pnConsumed += 8;
+        pBuf += 8;
+        status |= PackTlvCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          TLVS_P2PDeviceInfo, &idx);
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return status;
+} /* End dot11fPackTlvP2PDeviceInfo. */
+
+tANI_U32 dot11fPackTlvP2PGroupBssid(tpAniSirGlobal pCtx,
+                                    tDot11fTLVP2PGroupBssid *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 9;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 7;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->P2PGroupBssid, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PGroupBssid. */
+
+tANI_U32 dot11fPackTlvP2PGroupId(tpAniSirGlobal pCtx,
+                                 tDot11fTLVP2PGroupId *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_ssid + 9) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 15;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->deviceAddress, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->ssid ), pSrc->num_ssid);
+        *pnConsumed += pSrc->num_ssid;
+        pBuf += pSrc->num_ssid;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PGroupId. */
+
+tANI_U32 dot11fPackTlvP2PGroupInfo(tpAniSirGlobal pCtx,
+                                   tDot11fTLVP2PGroupInfo *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_P2PClientInfoDesc + 3) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 14;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->P2PClientInfoDesc ), pSrc->num_P2PClientInfoDesc);
+        *pnConsumed += pSrc->num_P2PClientInfoDesc;
+        pBuf += pSrc->num_P2PClientInfoDesc;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PGroupInfo. */
+
+tANI_U32 dot11fPackTlvP2PStatus(tpAniSirGlobal pCtx,
+                                tDot11fTLVP2PStatus *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 4;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 0;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->status;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PStatus. */
+
+tANI_U32 dot11fPackTlvPrimaryDeviceType(tpAniSirGlobal pCtx,
+                                        tDot11fTLVPrimaryDeviceType *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 12;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4180, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->primary_category, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->oui, 4);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->sub_category, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvPrimaryDeviceType. */
+
+tANI_U32 dot11fPackTlvRFBands(tpAniSirGlobal pCtx,
+                              tDot11fTLVRFBands *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4156, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->bands;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvRFBands. */
+
+tANI_U32 dot11fPackTlvRequestDeviceType(tpAniSirGlobal pCtx,
+                                        tDot11fTLVRequestDeviceType *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 12;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4202, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->primary_category, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->oui, 4);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->sub_category, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvRequestDeviceType. */
+
+tANI_U32 dot11fPackTlvRequestType(tpAniSirGlobal pCtx,
+                                  tDot11fTLVRequestType *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4154, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->reqType;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvRequestType. */
+
+tANI_U32 dot11fPackTlvResponseType(tpAniSirGlobal pCtx,
+                                   tDot11fTLVResponseType *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4155, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->resType;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvResponseType. */
+
+tANI_U32 dot11fPackTlvSelectedRegistrar(tpAniSirGlobal pCtx,
+                                        tDot11fTLVSelectedRegistrar *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4161, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->selected;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvSelectedRegistrar. */
+
+tANI_U32 dot11fPackTlvSelectedRegistrarConfigMethods(tpAniSirGlobal pCtx,
+                                                     tDot11fTLVSelectedRegistrarConfigMethods *pSrc,
+                                                     tANI_U8 *pBuf,
+                                                     tANI_U32 nBuf,
+                                                     tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 6;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4179, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        frameshtons(pCtx, pBuf, pSrc->methods, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvSelectedRegistrarConfigMethods. */
+
+tANI_U32 dot11fPackTlvSerialNumber(tpAniSirGlobal pCtx,
+                                   tDot11fTLVSerialNumber *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += ( pSrc->num_text + 4) ;
+
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4162, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->text ), pSrc->num_text);
+        *pnConsumed += pSrc->num_text;
+        pBuf += pSrc->num_text;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvSerialNumber. */
+
+tANI_U32 dot11fPackTlvUUID_E(tpAniSirGlobal pCtx,
+                             tDot11fTLVUUID_E *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 20;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4167, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->uuid, 16);
+        *pnConsumed += 16;
+        pBuf += 16;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvUUID_E. */
+
+tANI_U32 dot11fPackTlvUUID_R(tpAniSirGlobal pCtx,
+                             tDot11fTLVUUID_R *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 20;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4168, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->uuid, 16);
+        *pnConsumed += 16;
+        pBuf += 16;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvUUID_R. */
+
+tANI_U32 dot11fPackTlvVendorExtension(tpAniSirGlobal pCtx,
+                                      tDot11fTLVVendorExtension *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 idx = 0;
+    nNeeded += 7;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4169, 1);
+        pBuf += 2; nBuf -= 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; nBuf -= 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->vendorId, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        status |= PackTlvCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          TLVS_VendorExtension, &idx);
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return status;
+} /* End dot11fPackTlvVendorExtension. */
+
+tANI_U32 dot11fPackTlvVersion(tpAniSirGlobal pCtx,
+                              tDot11fTLVVersion *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp79__;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4170, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        tmp79__ = 0U;
+        tmp79__ |= ( pSrc->minor << 0 );
+        tmp79__ |= ( pSrc->major << 4 );
+        *pBuf = tmp79__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvVersion. */
+
+tANI_U32 dot11fPackTlvWPSState(tpAniSirGlobal pCtx,
+                               tDot11fTLVWPSState *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 5;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        frameshtons( pCtx, pBuf, 4164, 1);
+        pBuf += 2; *pnConsumed += 2;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->state;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 4, 1);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvWPSState. */
+
+tANI_U32 dot11fPackTlvP2PInterface(tpAniSirGlobal pCtx,
+                                   tDot11fTLVP2PInterface *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 9;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 16;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->P2PDeviceAddress, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PInterface. */
+
+tANI_U32 dot11fPackTlvP2PManageability(tpAniSirGlobal pCtx,
+                                       tDot11fTLVP2PManageability *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pTlvLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded += 4;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    while ( pSrc->present )
+    {
+        *pBuf = 10;
+        pBuf += 1; *pnConsumed += 1;
+        pTlvLen = pBuf;
+        pBuf += 2; *pnConsumed += 2;
+        *pBuf = pSrc->manageability;
+        *pnConsumed += 1;
+        pBuf += 1;
+        break;
+    }
+    (void)pCtx;
+    if (pTlvLen)
+    {
+        frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - 3, 0);
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackTlvP2PManageability. */
+
+tANI_U32 dot11fPackIeAPName(tpAniSirGlobal pCtx,
+                            tDot11fIEAPName *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_name;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->name ), pSrc->num_name);
+        *pnConsumed += pSrc->num_name;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeAPName. */
+
+tANI_U32 dot11fPackIeBPIndicator(tpAniSirGlobal pCtx,
+                                 tDot11fIEBPIndicator *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 4;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->indicator;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->type;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeBPIndicator. */
+
+tANI_U32 dot11fPackIeCondensedCountryStr(tpAniSirGlobal pCtx,
+                                         tDot11fIECondensedCountryStr *pSrc,
+                                         tANI_U8 *pBuf,
+                                         tANI_U32 nBuf,
+                                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 2;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->countryStr, 2);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCondensedCountryStr. */
+
+tANI_U32 dot11fPackIeGTK(tpAniSirGlobal pCtx,
+                         tDot11fIEGTK *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp80__;
+    nNeeded  +=  (pSrc->num_key + 11);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 2;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp80__ = 0U;
+        tmp80__ |= ( pSrc->keyId << 0 );
+        tmp80__ |= ( pSrc->reserved << 2 );
+        frameshtons(pCtx, pBuf, tmp80__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        *pBuf = pSrc->keyLength;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->RSC, 8);
+        *pnConsumed += 8;
+        pBuf += 8;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->key ), pSrc->num_key);
+        *pnConsumed += pSrc->num_key;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeGTK. */
+
+tANI_U32 dot11fPackIeHCF(tpAniSirGlobal pCtx,
+                         tDot11fIEHCF *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 2;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->enabled;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeHCF. */
+
+tANI_U32 dot11fPackIeLLAttr(tpAniSirGlobal pCtx,
+                            tDot11fIELLAttr *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 9;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtonl(pCtx, pBuf, pSrc->defer_threshold, 1);
+        *pnConsumed += 4;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeLLAttr. */
+
+tANI_U32 dot11fPackIeLoadBalance(tpAniSirGlobal pCtx,
+                                 tDot11fIELoadBalance *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 7;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 8;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->bssid, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        *pBuf = pSrc->channel;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeLoadBalance. */
+
+tANI_U32 dot11fPackIeLoadInfo(tpAniSirGlobal pCtx,
+                              tDot11fIELoadInfo *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 6;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->num_stas, 1);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->channel_util, 1);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeLoadInfo. */
+
+tANI_U32 dot11fPackIePropAssocType(tpAniSirGlobal pCtx,
+                                   tDot11fIEPropAssocType *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 7;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->type;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropAssocType. */
+
+tANI_U32 dot11fPackIePropCapability(tpAniSirGlobal pCtx,
+                                    tDot11fIEPropCapability *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 10;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->capability, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropCapability. */
+
+tANI_U32 dot11fPackIePropChannSwitchAnn(tpAniSirGlobal pCtx,
+                                        tDot11fIEPropChannSwitchAnn *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 15;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->mode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->primary_channel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->sub_band;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->channel_switch_count;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropChannSwitchAnn. */
+
+tANI_U32 dot11fPackIePropEDCAParams(tpAniSirGlobal pCtx,
+                                    tDot11fIEPropEDCAParams *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp81__;
+    tANI_U8 tmp82__;
+    tANI_U8 tmp83__;
+    tANI_U8 tmp84__;
+    tANI_U8 tmp85__;
+    tANI_U8 tmp86__;
+    tANI_U8 tmp87__;
+    tANI_U8 tmp88__;
+    nNeeded  += 18;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 12;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->qos;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->reserved;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp81__ = 0U;
+        tmp81__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp81__ |= ( pSrc->acbe_acm << 4 );
+        tmp81__ |= ( pSrc->acbe_aci << 5 );
+        tmp81__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp81__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp82__ = 0U;
+        tmp82__ |= ( pSrc->acbe_min << 0 );
+        tmp82__ |= ( pSrc->acbe_max << 4 );
+        *pBuf = tmp82__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp83__ = 0U;
+        tmp83__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp83__ |= ( pSrc->acbk_acm << 4 );
+        tmp83__ |= ( pSrc->acbk_aci << 5 );
+        tmp83__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp83__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp84__ = 0U;
+        tmp84__ |= ( pSrc->acbk_min << 0 );
+        tmp84__ |= ( pSrc->acbk_max << 4 );
+        *pBuf = tmp84__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp85__ = 0U;
+        tmp85__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp85__ |= ( pSrc->acvi_acm << 4 );
+        tmp85__ |= ( pSrc->acvi_aci << 5 );
+        tmp85__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp85__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp86__ = 0U;
+        tmp86__ |= ( pSrc->acvi_min << 0 );
+        tmp86__ |= ( pSrc->acvi_max << 4 );
+        *pBuf = tmp86__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp87__ = 0U;
+        tmp87__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp87__ |= ( pSrc->acvo_acm << 4 );
+        tmp87__ |= ( pSrc->acvo_aci << 5 );
+        tmp87__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp87__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp88__ = 0U;
+        tmp88__ |= ( pSrc->acvo_min << 0 );
+        tmp88__ |= ( pSrc->acvo_max << 4 );
+        *pBuf = tmp88__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvo_txoplimit, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropEDCAParams. */
+
+tANI_U32 dot11fPackIePropQuietBSS(tpAniSirGlobal pCtx,
+                                  tDot11fIEPropQuietBSS *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 6;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 16;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->quiet_count;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->quiet_period;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->quiet_duration, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->quiet_offset, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropQuietBSS. */
+
+tANI_U32 dot11fPackIePropSuppRates(tpAniSirGlobal pCtx,
+                                   tDot11fIEPropSuppRates *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_rates;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 0;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->rates ), pSrc->num_rates);
+        *pnConsumed += pSrc->num_rates;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePropSuppRates. */
+
+tANI_U32 dot11fPackIeR0KH_ID(tpAniSirGlobal pCtx,
+                             tDot11fIER0KH_ID *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_PMK_R0_ID;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 3;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->PMK_R0_ID ), pSrc->num_PMK_R0_ID);
+        *pnConsumed += pSrc->num_PMK_R0_ID;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeR0KH_ID. */
+
+tANI_U32 dot11fPackIeR1KH_ID(tpAniSirGlobal pCtx,
+                             tDot11fIER1KH_ID *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 6;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->PMK_R1_ID, 6);
+        *pnConsumed += 6;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeR1KH_ID. */
+
+tANI_U32 dot11fPackIeTSFInfo(tpAniSirGlobal pCtx,
+                             tDot11fIETSFInfo *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->TsfOffset, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->BeaconIntvl, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTSFInfo. */
+
+tANI_U32 dot11fPackIeTaurus(tpAniSirGlobal pCtx,
+                            tDot11fIETaurus *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp89__;
+    nNeeded  += 6;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 18;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->baTIDBitmap, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->baPolicy, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp89__ = 0U;
+        tmp89__ |= ( pSrc->baBufferSize << 0 );
+        tmp89__ |= ( pSrc->rsvd << 12 );
+        frameshtons(pCtx, pBuf, tmp89__, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag  = 1 
+        nBuf -=  2 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTaurus. */
+
+tANI_U32 dot11fPackIeTitan(tpAniSirGlobal pCtx,
+                           tDot11fIETitan *pSrc,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 14;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->concat_tcid_bitmap;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->compression_tcid_bitmap;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->cb_state;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->rev_fcs_state;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTitan. */
+
+tANI_U32 dot11fPackIeTriggerStaBgScan(tpAniSirGlobal pCtx,
+                                      tDot11fIETriggerStaBgScan *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 17;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->enable;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTriggerStaBgScan. */
+
+tANI_U32 dot11fPackIeVersion(tpAniSirGlobal pCtx,
+                             tDot11fIEVersion *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_build_version + 5);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 11;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtonl(pCtx, pBuf, pSrc->chip_rev, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        *pBuf = pSrc->card_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->build_version ), pSrc->num_build_version);
+        *pnConsumed += pSrc->num_build_version;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeVersion. */
+
+tANI_U32 dot11fPackIeWDS(tpAniSirGlobal pCtx,
+                         tDot11fIEWDS *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_wdsData;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 3;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->wdsData ), pSrc->num_wdsData);
+        *pnConsumed += pSrc->num_wdsData;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWDS. */
+
+tANI_U32 dot11fPackIeAPChannelReport(tpAniSirGlobal pCtx,
+                                     tDot11fIEAPChannelReport *pSrc,
+                                     tANI_U8 *pBuf,
+                                     tANI_U32 nBuf,
+                                     tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_channelList + 1);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 51;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->regulatoryClass;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->channelList ), pSrc->num_channelList);
+        *pnConsumed += pSrc->num_channelList;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeAPChannelReport. */
+
+tANI_U32 dot11fPackIeBcnReportingDetail(tpAniSirGlobal pCtx,
+                                        tDot11fIEBcnReportingDetail *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 2;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->reportingDetail;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeBcnReportingDetail. */
+
+tANI_U32 dot11fPackIeBeaconReportFrmBody(tpAniSirGlobal pCtx,
+                                         tDot11fIEBeaconReportFrmBody *pSrc,
+                                         tANI_U8 *pBuf,
+                                         tANI_U32 nBuf,
+                                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_reportedFields;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->reportedFields ), pSrc->num_reportedFields);
+        *pnConsumed += pSrc->num_reportedFields;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeBeaconReportFrmBody. */
+
+tANI_U32 dot11fPackIeBeaconReporting(tpAniSirGlobal pCtx,
+                                     tDot11fIEBeaconReporting *pSrc,
+                                     tANI_U8 *pBuf,
+                                     tANI_U32 nBuf,
+                                     tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->reportingCondition;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->threshold;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeBeaconReporting. */
+
+tANI_U32 dot11fPackIeMeasurementPilot(tpAniSirGlobal pCtx,
+                                      tDot11fIEMeasurementPilot *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_vendorSpecific + 1);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 66;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->measurementPilot;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->vendorSpecific ), pSrc->num_vendorSpecific);
+        *pnConsumed += pSrc->num_vendorSpecific;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeMeasurementPilot. */
+
+tANI_U32 dot11fPackIeMultiBssid(tpAniSirGlobal pCtx,
+                                tDot11fIEMultiBssid *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_vendorSpecific + 1);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 71;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->maxBSSIDIndicator;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->vendorSpecific ), pSrc->num_vendorSpecific);
+        *pnConsumed += pSrc->num_vendorSpecific;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeMultiBssid. */
+
+tANI_U32 dot11fPackIeRICData(tpAniSirGlobal pCtx,
+                             tDot11fIERICData *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 57;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->Identifier;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->resourceDescCount;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->statusCode, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRICData. */
+
+tANI_U32 dot11fPackIeRICDescriptor(tpAniSirGlobal pCtx,
+                                   tDot11fIERICDescriptor *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_variableData + 1);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 75;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->resourceType;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->variableData ), pSrc->num_variableData);
+        *pnConsumed += pSrc->num_variableData;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRICDescriptor. */
+
+tANI_U32 dot11fPackIeRRMEnabledCap(tpAniSirGlobal pCtx,
+                                   tDot11fIERRMEnabledCap *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp90__;
+    tANI_U8 tmp91__;
+    tANI_U8 tmp92__;
+    tANI_U8 tmp93__;
+    tANI_U8 tmp94__;
+    nNeeded  += 5;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 70;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp90__ = 0U;
+        tmp90__ |= ( pSrc->LinkMeasurement << 0 );
+        tmp90__ |= ( pSrc->NeighborRpt << 1 );
+        tmp90__ |= ( pSrc->parallel << 2 );
+        tmp90__ |= ( pSrc->repeated << 3 );
+        tmp90__ |= ( pSrc->BeaconPassive << 4 );
+        tmp90__ |= ( pSrc->BeaconActive << 5 );
+        tmp90__ |= ( pSrc->BeaconTable << 6 );
+        tmp90__ |= ( pSrc->BeaconRepCond << 7 );
+        *pBuf = tmp90__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp91__ = 0U;
+        tmp91__ |= ( pSrc->FrameMeasurement << 0 );
+        tmp91__ |= ( pSrc->ChannelLoad << 1 );
+        tmp91__ |= ( pSrc->NoiseHistogram << 2 );
+        tmp91__ |= ( pSrc->statistics << 3 );
+        tmp91__ |= ( pSrc->LCIMeasurement << 4 );
+        tmp91__ |= ( pSrc->LCIAzimuth << 5 );
+        tmp91__ |= ( pSrc->TCMCapability << 6 );
+        tmp91__ |= ( pSrc->triggeredTCM << 7 );
+        *pBuf = tmp91__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp92__ = 0U;
+        tmp92__ |= ( pSrc->APChanReport << 0 );
+        tmp92__ |= ( pSrc->RRMMIBEnabled << 1 );
+        tmp92__ |= ( pSrc->operatingChanMax << 2 );
+        tmp92__ |= ( pSrc->nonOperatinChanMax << 5 );
+        *pBuf = tmp92__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp93__ = 0U;
+        tmp93__ |= ( pSrc->MeasurementPilot << 0 );
+        tmp93__ |= ( pSrc->MeasurementPilotEnabled << 3 );
+        tmp93__ |= ( pSrc->NeighborTSFOffset << 4 );
+        tmp93__ |= ( pSrc->RCPIMeasurement << 5 );
+        tmp93__ |= ( pSrc->RSNIMeasurement << 6 );
+        tmp93__ |= ( pSrc->BssAvgAccessDelay << 7 );
+        *pBuf = tmp93__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp94__ = 0U;
+        tmp94__ |= ( pSrc->BSSAvailAdmission << 0 );
+        tmp94__ |= ( pSrc->AntennaInformation << 1 );
+        tmp94__ |= ( pSrc->reserved << 2 );
+        *pBuf = tmp94__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRRMEnabledCap. */
+
+tANI_U32 dot11fPackIeRequestedInfo(tpAniSirGlobal pCtx,
+                                   tDot11fIERequestedInfo *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_requested_eids;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 10;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->requested_eids ), pSrc->num_requested_eids);
+        *pnConsumed += pSrc->num_requested_eids;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRequestedInfo. */
+
+tANI_U32 dot11fPackIeSSID(tpAniSirGlobal pCtx,
+                          tDot11fIESSID *pSrc,
+                          tANI_U8 *pBuf,
+                          tANI_U32 nBuf,
+                          tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_ssid;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 0;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->ssid ), pSrc->num_ssid);
+        *pnConsumed += pSrc->num_ssid;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeSSID. */
+
+tANI_U32 dot11fPackIeSchedule(tpAniSirGlobal pCtx,
+                              tDot11fIESchedule *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp95__;
+    nNeeded  += 14;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 15;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp95__ = 0U;
+        tmp95__ |= ( pSrc->aggregation << 0 );
+        tmp95__ |= ( pSrc->tsid << 1 );
+        tmp95__ |= ( pSrc->direction << 5 );
+        tmp95__ |= ( pSrc->reserved << 7 );
+        frameshtons(pCtx, pBuf, tmp95__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        frameshtonl(pCtx, pBuf, pSrc->service_start_time, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->service_interval, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->max_service_dur, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->spec_interval, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeSchedule. */
+
+tANI_U32 dot11fPackIeTCLAS(tpAniSirGlobal pCtx,
+                           tDot11fIETCLAS *pSrc,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIETCLAS(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 14;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->user_priority;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->classifier_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->classifier_mask;
+        *pnConsumed += 1;
+        pBuf += 1;
+        switch (pSrc->classifier_type)
+        {
+            case 0:
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.EthParams.source, 6);
+                *pnConsumed += 6;
+                pBuf += 6;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.EthParams.dest, 6);
+                *pnConsumed += 6;
+                pBuf += 6;
+                frameshtons(pCtx, pBuf, pSrc->info.EthParams.type, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+            case 1:
+                *pBuf = pSrc->info.IpParams.version;
+                *pnConsumed += 1;
+                pBuf += 1;
+                switch (pSrc->info.IpParams.version)
+                {
+                    case 4:
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.source, 4);
+                        *pnConsumed += 4;
+                        pBuf += 4;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.dest, 4);
+                        *pnConsumed += 4;
+                        pBuf += 4;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.src_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.dest_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.DSCP;
+                        *pnConsumed += 1;
+                        pBuf += 1;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.proto;
+                        *pnConsumed += 1;
+                        pBuf += 1;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.reserved;
+                        *pnConsumed += 1;
+                        // fieldsEndFlag = 1 
+                    break;
+                    case 6:
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.source, 16);
+                        *pnConsumed += 16;
+                        pBuf += 16;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.dest, 16);
+                        *pnConsumed += 16;
+                        pBuf += 16;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.src_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.dest_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.flow_label, 3);
+                        *pnConsumed += 3;
+                        // fieldsEndFlag = 1 
+                    break;
+                }
+            break;
+            case 2:
+                frameshtons(pCtx, pBuf, pSrc->info.Params8021dq.tag_type, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+        }
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeTCLAS. */
+
+tANI_U32 dot11fPackIeTCLASSPROC(tpAniSirGlobal pCtx,
+                                tDot11fIETCLASSPROC *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 44;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->processing;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTCLASSPROC. */
+
+tANI_U32 dot11fPackIeTSDelay(tpAniSirGlobal pCtx,
+                             tDot11fIETSDelay *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 43;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtonl(pCtx, pBuf, pSrc->delay, 0);
+        *pnConsumed += 4;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTSDelay. */
+
+tANI_U32 dot11fPackIeTSPEC(tpAniSirGlobal pCtx,
+                           tDot11fIETSPEC *pSrc,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp96__;
+    tANI_U8 tmp97__;
+    tANI_U16 tmp98__;
+    nNeeded  += 55;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 13;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp96__ = 0U;
+        tmp96__ |= ( pSrc->traffic_type << 0 );
+        tmp96__ |= ( pSrc->tsid << 1 );
+        tmp96__ |= ( pSrc->direction << 5 );
+        tmp96__ |= ( pSrc->access_policy << 7 );
+        tmp96__ |= ( pSrc->aggregation << 9 );
+        tmp96__ |= ( pSrc->psb << 10 );
+        tmp96__ |= ( pSrc->user_priority << 11 );
+        tmp96__ |= ( pSrc->tsinfo_ack_pol << 14 );
+        frameshtons(pCtx, pBuf, tmp96__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        tmp97__ = 0U;
+        tmp97__ |= ( pSrc->schedule << 0 );
+        tmp97__ |= ( pSrc->unused << 1 );
+        *pBuf = tmp97__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp98__ = 0U;
+        tmp98__ |= ( pSrc->size << 0 );
+        tmp98__ |= ( pSrc->fixed << 15 );
+        frameshtons(pCtx, pBuf, tmp98__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        frameshtons(pCtx, pBuf, pSrc->max_msdu_size, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtonl(pCtx, pBuf, pSrc->min_service_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->max_service_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->inactivity_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->suspension_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->service_start_time, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->min_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->mean_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->peak_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->burst_size, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->delay_bound, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->min_phy_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->surplus_bw_allowance, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->medium_time, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTSPEC. */
+
+tANI_U32 dot11fPackIeWMMSchedule(tpAniSirGlobal pCtx,
+                                 tDot11fIEWMMSchedule *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp99__;
+    nNeeded  += 15;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x9;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp99__ = 0U;
+        tmp99__ |= ( pSrc->aggregation << 0 );
+        tmp99__ |= ( pSrc->tsid << 1 );
+        tmp99__ |= ( pSrc->direction << 5 );
+        tmp99__ |= ( pSrc->reserved << 7 );
+        frameshtons(pCtx, pBuf, tmp99__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        frameshtonl(pCtx, pBuf, pSrc->service_start_time, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->service_interval, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->max_service_dur, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->spec_interval, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMSchedule. */
+
+tANI_U32 dot11fPackIeWMMTCLAS(tpAniSirGlobal pCtx,
+                              tDot11fIEWMMTCLAS *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEWMMTCLAS(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x6;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->user_priority;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->classifier_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->classifier_mask;
+        *pnConsumed += 1;
+        pBuf += 1;
+        switch (pSrc->classifier_type)
+        {
+            case 0:
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.EthParams.source, 6);
+                *pnConsumed += 6;
+                pBuf += 6;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.EthParams.dest, 6);
+                *pnConsumed += 6;
+                pBuf += 6;
+                frameshtons(pCtx, pBuf, pSrc->info.EthParams.type, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+            case 1:
+                *pBuf = pSrc->info.IpParams.version;
+                *pnConsumed += 1;
+                pBuf += 1;
+                switch (pSrc->info.IpParams.version)
+                {
+                    case 4:
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.source, 4);
+                        *pnConsumed += 4;
+                        pBuf += 4;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.dest, 4);
+                        *pnConsumed += 4;
+                        pBuf += 4;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.src_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV4Params.dest_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.DSCP;
+                        *pnConsumed += 1;
+                        pBuf += 1;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.proto;
+                        *pnConsumed += 1;
+                        pBuf += 1;
+                        *pBuf = pSrc->info.IpParams.params.IpV4Params.reserved;
+                        *pnConsumed += 1;
+                        // fieldsEndFlag = 1 
+                    break;
+                    case 6:
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.source, 10);
+                        *pnConsumed += 10;
+                        pBuf += 10;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.dest, 10);
+                        *pnConsumed += 10;
+                        pBuf += 10;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.src_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        frameshtons(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.dest_port, 0);
+                        *pnConsumed += 2;
+                        pBuf += 2;
+                        DOT11F_MEMCPY(pCtx, pBuf, pSrc->info.IpParams.params.IpV6Params.flow_label, 3);
+                        *pnConsumed += 3;
+                        // fieldsEndFlag = 1 
+                    break;
+                }
+            break;
+            case 2:
+                frameshtons(pCtx, pBuf, pSrc->info.Params8021dq.tag_type, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+        }
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeWMMTCLAS. */
+
+tANI_U32 dot11fPackIeWMMTCLASPROC(tpAniSirGlobal pCtx,
+                                  tDot11fIEWMMTCLASPROC *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x7;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->processing;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMTCLASPROC. */
+
+tANI_U32 dot11fPackIeWMMTSDelay(tpAniSirGlobal pCtx,
+                                tDot11fIEWMMTSDelay *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 5;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x8;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtonl(pCtx, pBuf, pSrc->delay, 0);
+        *pnConsumed += 4;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMTSDelay. */
+
+tANI_U32 dot11fPackIeWMMTSPEC(tpAniSirGlobal pCtx,
+                              tDot11fIEWMMTSPEC *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp100__;
+    tANI_U8 tmp101__;
+    tANI_U16 tmp102__;
+    nNeeded  += 38;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp100__ = 0U;
+        tmp100__ |= ( pSrc->traffic_type << 0 );
+        tmp100__ |= ( pSrc->tsid << 1 );
+        tmp100__ |= ( pSrc->direction << 5 );
+        tmp100__ |= ( pSrc->access_policy << 7 );
+        tmp100__ |= ( pSrc->aggregation << 9 );
+        tmp100__ |= ( pSrc->psb << 10 );
+        tmp100__ |= ( pSrc->user_priority << 11 );
+        tmp100__ |= ( pSrc->tsinfo_ack_pol << 14 );
+        frameshtons(pCtx, pBuf, tmp100__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        tmp101__ = 0U;
+        tmp101__ |= ( pSrc->tsinfo_rsvd << 0 );
+        tmp101__ |= ( pSrc->burst_size_defn << 7 );
+        *pBuf = tmp101__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp102__ = 0U;
+        tmp102__ |= ( pSrc->size << 0 );
+        tmp102__ |= ( pSrc->fixed << 15 );
+        frameshtons(pCtx, pBuf, tmp102__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        frameshtons(pCtx, pBuf, pSrc->max_msdu_size, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtonl(pCtx, pBuf, pSrc->min_service_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->max_service_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->inactivity_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->suspension_int, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->service_start_time, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->min_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->mean_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->peak_data_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->burst_size, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->delay_bound, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtonl(pCtx, pBuf, pSrc->min_phy_rate, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        frameshtons(pCtx, pBuf, pSrc->surplus_bw_allowance, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->medium_time, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMTSPEC. */
+
+tANI_U32 dot11fPackIeAirgo(tpAniSirGlobal pCtx,
+                           tDot11fIEAirgo *pSrc,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEAirgo(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        *pBuf = 0xa;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        *pBuf = 0xf5;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_Airgo,
+          IES_Airgo);
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeAirgo. */
+
+tANI_U32 dot11fPackIeCCXCckmOpaque(tpAniSirGlobal pCtx,
+                                   tDot11fIECCXCckmOpaque *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 156;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXCckmOpaque. */
+
+tANI_U32 dot11fPackIeCCXRadMgmtCap(tpAniSirGlobal pCtx,
+                                   tDot11fIECCXRadMgmtCap *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp103__;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x1;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->mgmt_state;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp103__ = 0U;
+        tmp103__ |= ( pSrc->mbssid_mask << 0 );
+        tmp103__ |= ( pSrc->reserved << 3 );
+        *pBuf = tmp103__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXRadMgmtCap. */
+
+tANI_U32 dot11fPackIeCCXTrafStrmMet(tpAniSirGlobal pCtx,
+                                    tDot11fIECCXTrafStrmMet *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 4;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x7;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->tsid;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->state;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->msmt_interval, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXTrafStrmMet. */
+
+tANI_U32 dot11fPackIeCCXTrafStrmRateSet(tpAniSirGlobal pCtx,
+                                        tDot11fIECCXTrafStrmRateSet *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_tsrates + 1);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x8;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->tsid;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->tsrates ), pSrc->num_tsrates);
+        *pnConsumed += pSrc->num_tsrates;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXTrafStrmRateSet. */
+
+tANI_U32 dot11fPackIeCCXTxmitPower(tpAniSirGlobal pCtx,
+                                   tDot11fIECCXTxmitPower *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 150;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->power_limit;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->reserved;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXTxmitPower. */
+
+tANI_U32 dot11fPackIeCCXVersion(tpAniSirGlobal pCtx,
+                                tDot11fIECCXVersion *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x40;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x96;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x3;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCCXVersion. */
+
+tANI_U32 dot11fPackIeCFParams(tpAniSirGlobal pCtx,
+                              tDot11fIECFParams *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 6;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 4;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->cfp_count;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->cfp_period;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->cfp_maxduration, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->cfp_durremaining, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeCFParams. */
+
+tANI_U32 dot11fPackIeChallengeText(tpAniSirGlobal pCtx,
+                                   tDot11fIEChallengeText *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_text;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 16;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->text ), pSrc->num_text);
+        *pnConsumed += pSrc->num_text;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeChallengeText. */
+
+tANI_U32 dot11fPackIeChanSwitchAnn(tpAniSirGlobal pCtx,
+                                   tDot11fIEChanSwitchAnn *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 3;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 37;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->switchMode;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->newChannel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->switchCount;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeChanSwitchAnn. */
+
+tANI_U32 dot11fPackIeCountry(tpAniSirGlobal pCtx,
+                             tDot11fIECountry *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIECountry(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 7;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->country, 3);
+        *pnConsumed += 3;
+        pBuf += 3;
+        if ( pSrc->num_triplets )        {
+            DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->triplets ), ( pSrc->num_triplets * 3 ));
+            *pnConsumed += ( pSrc->num_triplets * 3 );
+            // fieldsEndFlag = 1 
+        }
+        else break;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeCountry. */
+
+tANI_U32 dot11fPackIeDSParams(tpAniSirGlobal pCtx,
+                              tDot11fIEDSParams *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 3;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->curr_channel;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeDSParams. */
+
+tANI_U32 dot11fPackIeEDCAParamSet(tpAniSirGlobal pCtx,
+                                  tDot11fIEEDCAParamSet *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp104__;
+    tANI_U8 tmp105__;
+    tANI_U8 tmp106__;
+    tANI_U8 tmp107__;
+    tANI_U8 tmp108__;
+    tANI_U8 tmp109__;
+    tANI_U8 tmp110__;
+    tANI_U8 tmp111__;
+    nNeeded  += 18;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 12;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->qos;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->reserved;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp104__ = 0U;
+        tmp104__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp104__ |= ( pSrc->acbe_acm << 4 );
+        tmp104__ |= ( pSrc->acbe_aci << 5 );
+        tmp104__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp104__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp105__ = 0U;
+        tmp105__ |= ( pSrc->acbe_acwmin << 0 );
+        tmp105__ |= ( pSrc->acbe_acwmax << 4 );
+        *pBuf = tmp105__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp106__ = 0U;
+        tmp106__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp106__ |= ( pSrc->acbk_acm << 4 );
+        tmp106__ |= ( pSrc->acbk_aci << 5 );
+        tmp106__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp106__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp107__ = 0U;
+        tmp107__ |= ( pSrc->acbk_acwmin << 0 );
+        tmp107__ |= ( pSrc->acbk_acwmax << 4 );
+        *pBuf = tmp107__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp108__ = 0U;
+        tmp108__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp108__ |= ( pSrc->acvi_acm << 4 );
+        tmp108__ |= ( pSrc->acvi_aci << 5 );
+        tmp108__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp108__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp109__ = 0U;
+        tmp109__ |= ( pSrc->acvi_acwmin << 0 );
+        tmp109__ |= ( pSrc->acvi_acwmax << 4 );
+        *pBuf = tmp109__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp110__ = 0U;
+        tmp110__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp110__ |= ( pSrc->acvo_acm << 4 );
+        tmp110__ |= ( pSrc->acvo_aci << 5 );
+        tmp110__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp110__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp111__ = 0U;
+        tmp111__ |= ( pSrc->acvo_acwmin << 0 );
+        tmp111__ |= ( pSrc->acvo_acwmax << 4 );
+        *pBuf = tmp111__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvo_txoplimit, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeEDCAParamSet. */
+
+tANI_U32 dot11fPackIeERPInfo(tpAniSirGlobal pCtx,
+                             tDot11fIEERPInfo *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp112__;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 42;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp112__ = 0U;
+        tmp112__ |= ( pSrc->non_erp_present << 0 );
+        tmp112__ |= ( pSrc->use_prot << 1 );
+        tmp112__ |= ( pSrc->barker_preamble << 2 );
+        tmp112__ |= ( pSrc->unused << 3 );
+        *pBuf = tmp112__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeERPInfo. */
+
+tANI_U32 dot11fPackIeExtChanSwitchAnn(tpAniSirGlobal pCtx,
+                                      tDot11fIEExtChanSwitchAnn *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 62;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->secondaryChannelOffset;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeExtChanSwitchAnn. */
+
+tANI_U32 dot11fPackIeExtSuppRates(tpAniSirGlobal pCtx,
+                                  tDot11fIEExtSuppRates *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_rates;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 50;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->rates ), pSrc->num_rates);
+        *pnConsumed += pSrc->num_rates;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeExtSuppRates. */
+
+tANI_U32 dot11fPackIeFHParamSet(tpAniSirGlobal pCtx,
+                                tDot11fIEFHParamSet *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 5;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 2;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->dwell_time, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        *pBuf = pSrc->hop_set;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->hop_pattern;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->hop_index;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeFHParamSet. */
+
+tANI_U32 dot11fPackIeFHParams(tpAniSirGlobal pCtx,
+                              tDot11fIEFHParams *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 8;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->radix;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->nchannels;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeFHParams. */
+
+tANI_U32 dot11fPackIeFHPattTable(tpAniSirGlobal pCtx,
+                                 tDot11fIEFHPattTable *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_randtable + 4);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 9;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->flag;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->nsets;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->modulus;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->offset;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->randtable ), pSrc->num_randtable);
+        *pnConsumed += pSrc->num_randtable;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeFHPattTable. */
+
+tANI_U32 dot11fPackIeFTInfo(tpAniSirGlobal pCtx,
+                            tDot11fIEFTInfo *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp113__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEFTInfo(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 55;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        tmp113__ = 0U;
+        tmp113__ |= ( pSrc->reserved << 0 );
+        tmp113__ |= ( pSrc->IECount << 8 );
+        frameshtons(pCtx, pBuf, tmp113__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->MIC, 16);
+        *pnConsumed += 16;
+        pBuf += 16;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->Anonce, 32);
+        *pnConsumed += 32;
+        pBuf += 32;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->Snonce, 32);
+        *pnConsumed += 32;
+        pBuf += 32;
+        status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_FTInfo,
+          IES_FTInfo);
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeFTInfo. */
+
+tANI_U32 dot11fPackIeFTTimeoutInterval(tpAniSirGlobal pCtx,
+                                       tDot11fIEFTTimeoutInterval *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 5;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 56;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->timeoutType;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtonl(pCtx, pBuf, pSrc->timeoutValue, 0);
+        *pnConsumed += 4;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeFTTimeoutInterval. */
+
+tANI_U32 dot11fPackIeHTCaps(tpAniSirGlobal pCtx,
+                            tDot11fIEHTCaps *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp114__;
+    tANI_U8 tmp115__;
+    tANI_U16 tmp116__;
+    tANI_U32 tmp117__;
+    tANI_U8 tmp118__;
+    nNeeded  +=  (pSrc->num_rsvd + 26);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 45;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp114__ = 0U;
+        tmp114__ |= ( pSrc->advCodingCap << 0 );
+        tmp114__ |= ( pSrc->supportedChannelWidthSet << 1 );
+        tmp114__ |= ( pSrc->mimoPowerSave << 2 );
+        tmp114__ |= ( pSrc->greenField << 4 );
+        tmp114__ |= ( pSrc->shortGI20MHz << 5 );
+        tmp114__ |= ( pSrc->shortGI40MHz << 6 );
+        tmp114__ |= ( pSrc->txSTBC << 7 );
+        tmp114__ |= ( pSrc->rxSTBC << 8 );
+        tmp114__ |= ( pSrc->delayedBA << 10 );
+        tmp114__ |= ( pSrc->maximalAMSDUsize << 11 );
+        tmp114__ |= ( pSrc->dsssCckMode40MHz << 12 );
+        tmp114__ |= ( pSrc->psmp << 13 );
+        tmp114__ |= ( pSrc->stbcControlFrame << 14 );
+        tmp114__ |= ( pSrc->lsigTXOPProtection << 15 );
+        frameshtons(pCtx, pBuf, tmp114__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        tmp115__ = 0U;
+        tmp115__ |= ( pSrc->maxRxAMPDUFactor << 0 );
+        tmp115__ |= ( pSrc->mpduDensity << 2 );
+        tmp115__ |= ( pSrc->reserved1 << 5 );
+        *pBuf = tmp115__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->supportedMCSSet, 16);
+        *pnConsumed += 16;
+        pBuf += 16;
+        tmp116__ = 0U;
+        tmp116__ |= ( pSrc->pco << 0 );
+        tmp116__ |= ( pSrc->transitionTime << 1 );
+        tmp116__ |= ( pSrc->reserved2 << 3 );
+        tmp116__ |= ( pSrc->mcsFeedback << 8 );
+        tmp116__ |= ( pSrc->reserved3 << 10 );
+        frameshtons(pCtx, pBuf, tmp116__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        tmp117__ = 0U;
+        tmp117__ |= ( pSrc->txBF << 0 );
+        tmp117__ |= ( pSrc->rxStaggeredSounding << 1 );
+        tmp117__ |= ( pSrc->txStaggeredSounding << 2 );
+        tmp117__ |= ( pSrc->rxZLF << 3 );
+        tmp117__ |= ( pSrc->txZLF << 4 );
+        tmp117__ |= ( pSrc->implicitTxBF << 5 );
+        tmp117__ |= ( pSrc->calibration << 6 );
+        tmp117__ |= ( pSrc->explicitCSITxBF << 8 );
+        tmp117__ |= ( pSrc->explicitUncompressedSteeringMatrix << 9 );
+        tmp117__ |= ( pSrc->explicitBFCSIFeedback << 10 );
+        tmp117__ |= ( pSrc->explicitUncompressedSteeringMatrixFeedback << 13 );
+        tmp117__ |= ( pSrc->explicitCompressedSteeringMatrixFeedback << 16 );
+        tmp117__ |= ( pSrc->csiNumBFAntennae << 19 );
+        tmp117__ |= ( pSrc->uncompressedSteeringMatrixBFAntennae << 21 );
+        tmp117__ |= ( pSrc->compressedSteeringMatrixBFAntennae << 23 );
+        tmp117__ |= ( pSrc->reserved4 << 25 );
+        frameshtonl(pCtx, pBuf, tmp117__, 0);
+        *pnConsumed += 4;
+        pBuf += 4;
+        nBuf -=  4 ;
+        tmp118__ = 0U;
+        tmp118__ |= ( pSrc->antennaSelection << 0 );
+        tmp118__ |= ( pSrc->explicitCSIFeedbackTx << 1 );
+        tmp118__ |= ( pSrc->antennaIndicesFeedbackTx << 2 );
+        tmp118__ |= ( pSrc->explicitCSIFeedback << 3 );
+        tmp118__ |= ( pSrc->antennaIndicesFeedback << 4 );
+        tmp118__ |= ( pSrc->rxAS << 5 );
+        tmp118__ |= ( pSrc->txSoundingPPDUs << 6 );
+        tmp118__ |= ( pSrc->reserved5 << 7 );
+        *pBuf = tmp118__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->rsvd ), pSrc->num_rsvd);
+        *pnConsumed += pSrc->num_rsvd;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeHTCaps. */
+
+tANI_U32 dot11fPackIeHTInfo(tpAniSirGlobal pCtx,
+                            tDot11fIEHTInfo *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp119__;
+    tANI_U16 tmp120__;
+    tANI_U16 tmp121__;
+    nNeeded  +=  (pSrc->num_rsvd + 22);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 61;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->primaryChannel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp119__ = 0U;
+        tmp119__ |= ( pSrc->secondaryChannelOffset << 0 );
+        tmp119__ |= ( pSrc->recommendedTxWidthSet << 2 );
+        tmp119__ |= ( pSrc->rifsMode << 3 );
+        tmp119__ |= ( pSrc->controlledAccessOnly << 4 );
+        tmp119__ |= ( pSrc->serviceIntervalGranularity << 5 );
+        *pBuf = tmp119__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp120__ = 0U;
+        tmp120__ |= ( pSrc->opMode << 0 );
+        tmp120__ |= ( pSrc->nonGFDevicesPresent << 2 );
+        tmp120__ |= ( pSrc->transmitBurstLimit << 3 );
+        tmp120__ |= ( pSrc->obssNonHTStaPresent << 4 );
+        tmp120__ |= ( pSrc->reserved << 5 );
+        frameshtons(pCtx, pBuf, tmp120__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        tmp121__ = 0U;
+        tmp121__ |= ( pSrc->basicSTBCMCS << 0 );
+        tmp121__ |= ( pSrc->dualCTSProtection << 7 );
+        tmp121__ |= ( pSrc->secondaryBeacon << 8 );
+        tmp121__ |= ( pSrc->lsigTXOPProtectionFullSupport << 9 );
+        tmp121__ |= ( pSrc->pcoActive << 10 );
+        tmp121__ |= ( pSrc->pcoPhase << 11 );
+        tmp121__ |= ( pSrc->reserved2 << 12 );
+        frameshtons(pCtx, pBuf, tmp121__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->basicMCSSet, 16);
+        *pnConsumed += 16;
+        pBuf += 16;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->rsvd ), pSrc->num_rsvd);
+        *pnConsumed += pSrc->num_rsvd;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeHTInfo. */
+
+tANI_U32 dot11fPackIeIBSSParams(tpAniSirGlobal pCtx,
+                                tDot11fIEIBSSParams *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 6;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->atim, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeIBSSParams. */
+
+tANI_U32 dot11fPackIeMeasurementReport(tpAniSirGlobal pCtx,
+                                       tDot11fIEMeasurementReport *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp122__;
+    tANI_U8 tmp123__;
+    tANI_U8 tmp124__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEMeasurementReport(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 39;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->token;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp122__ = 0U;
+        tmp122__ |= ( pSrc->late << 0 );
+        tmp122__ |= ( pSrc->incapable << 1 );
+        tmp122__ |= ( pSrc->refused << 2 );
+        tmp122__ |= ( pSrc->unused << 3 );
+        *pBuf = tmp122__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        *pBuf = pSrc->type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        if ( pSrc->type )        {
+            switch (pSrc->type)
+            {
+                case 0:
+                    *pBuf = pSrc->report.Basic.channel;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    frameshtonq(pCtx, pBuf, pSrc->report.Basic.meas_start_time, 0);
+                    *pnConsumed += 8;
+                    pBuf += 8;
+                    frameshtons(pCtx, pBuf, pSrc->report.Basic.meas_duration, 0);
+                    *pnConsumed += 2;
+                    pBuf += 2;
+                    tmp123__ = 0U;
+                    tmp123__ |= ( pSrc->report.Basic.bss << 0 );
+                    tmp123__ |= ( pSrc->report.Basic.ofdm_preamble << 1 );
+                    tmp123__ |= ( pSrc->report.Basic.unid_signal << 2 );
+                    tmp123__ |= ( pSrc->report.Basic.rader << 3 );
+                    tmp123__ |= ( pSrc->report.Basic.unmeasured << 4 );
+                    tmp123__ |= ( pSrc->report.Basic.unused << 5 );
+                    *pBuf = tmp123__;
+                    *pnConsumed += 1;
+                    // fieldsEndFlag  = 1 
+                    nBuf -=  1 ;
+                break;
+                case 1:
+                    *pBuf = pSrc->report.CCA.channel;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    frameshtonq(pCtx, pBuf, pSrc->report.CCA.meas_start_time, 0);
+                    *pnConsumed += 8;
+                    pBuf += 8;
+                    frameshtons(pCtx, pBuf, pSrc->report.CCA.meas_duration, 0);
+                    *pnConsumed += 2;
+                    pBuf += 2;
+                    *pBuf = pSrc->report.CCA.cca_busy_fraction;
+                    *pnConsumed += 1;
+                    // fieldsEndFlag = 1 
+                break;
+                case 2:
+                    *pBuf = pSrc->report.RPIHistogram.channel;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    frameshtonq(pCtx, pBuf, pSrc->report.RPIHistogram.meas_start_time, 0);
+                    *pnConsumed += 8;
+                    pBuf += 8;
+                    frameshtons(pCtx, pBuf, pSrc->report.RPIHistogram.meas_duration, 0);
+                    *pnConsumed += 2;
+                    pBuf += 2;
+                    *pBuf = pSrc->report.RPIHistogram.rpi0_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi1_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi2_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi3_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi4_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi5_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi6_density;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.RPIHistogram.rpi7_density;
+                    *pnConsumed += 1;
+                    // fieldsEndFlag = 1 
+                break;
+                case 5:
+                    *pBuf = pSrc->report.Beacon.regClass;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.Beacon.channel;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    frameshtonq(pCtx, pBuf, pSrc->report.Beacon.meas_start_time, 0);
+                    *pnConsumed += 8;
+                    pBuf += 8;
+                    frameshtons(pCtx, pBuf, pSrc->report.Beacon.meas_duration, 0);
+                    *pnConsumed += 2;
+                    pBuf += 2;
+                    tmp124__ = 0U;
+                    tmp124__ |= ( pSrc->report.Beacon.condensed_PHY << 0 );
+                    tmp124__ |= ( pSrc->report.Beacon.reported_frame_type << 7 );
+                    *pBuf = tmp124__;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    nBuf -=  1 ;
+                    *pBuf = pSrc->report.Beacon.RCPI;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    *pBuf = pSrc->report.Beacon.RSNI;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    DOT11F_MEMCPY(pCtx, pBuf, pSrc->report.Beacon.BSSID, 6);
+                    *pnConsumed += 6;
+                    pBuf += 6;
+                    *pBuf = pSrc->report.Beacon.antenna_id;
+                    *pnConsumed += 1;
+                    pBuf += 1;
+                    frameshtonl(pCtx, pBuf, pSrc->report.Beacon.parent_TSF, 0);
+                    *pnConsumed += 4;
+                    pBuf += 4;
+                status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_reportBeacon,
+          IES_reportBeacon);
+                break;
+            }
+        }
+        else break;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeMeasurementReport. */
+
+tANI_U32 dot11fPackIeMeasurementRequest(tpAniSirGlobal pCtx,
+                                        tDot11fIEMeasurementRequest *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp125__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEMeasurementRequest(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 38;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->measurement_token;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp125__ = 0U;
+        tmp125__ |= ( pSrc->parallel << 0 );
+        tmp125__ |= ( pSrc->enable << 1 );
+        tmp125__ |= ( pSrc->request << 2 );
+        tmp125__ |= ( pSrc->report << 3 );
+        tmp125__ |= ( pSrc->durationMandatory << 4 );
+        tmp125__ |= ( pSrc->unused << 5 );
+        *pBuf = tmp125__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        *pBuf = pSrc->measurement_type;
+        *pnConsumed += 1;
+        pBuf += 1;
+        switch (pSrc->measurement_type)
+        {
+            case 0:
+                *pBuf = pSrc->measurement_request.Basic.channel_no;
+                *pnConsumed += 1;
+                pBuf += 1;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->measurement_request.Basic.meas_start_time, 8);
+                *pnConsumed += 8;
+                pBuf += 8;
+                frameshtons(pCtx, pBuf, pSrc->measurement_request.Basic.meas_duration, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+            case 1:
+                *pBuf = pSrc->measurement_request.CCA.channel_no;
+                *pnConsumed += 1;
+                pBuf += 1;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->measurement_request.CCA.meas_start_time, 8);
+                *pnConsumed += 8;
+                pBuf += 8;
+                frameshtons(pCtx, pBuf, pSrc->measurement_request.CCA.meas_duration, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+            case 2:
+                *pBuf = pSrc->measurement_request.RPIHistogram.channel_no;
+                *pnConsumed += 1;
+                pBuf += 1;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->measurement_request.RPIHistogram.meas_start_time, 8);
+                *pnConsumed += 8;
+                pBuf += 8;
+                frameshtons(pCtx, pBuf, pSrc->measurement_request.RPIHistogram.meas_duration, 0);
+                *pnConsumed += 2;
+                // fieldsEndFlag = 1 
+            break;
+            case 5:
+                *pBuf = pSrc->measurement_request.Beacon.regClass;
+                *pnConsumed += 1;
+                pBuf += 1;
+                *pBuf = pSrc->measurement_request.Beacon.channel;
+                *pnConsumed += 1;
+                pBuf += 1;
+                frameshtons(pCtx, pBuf, pSrc->measurement_request.Beacon.randomization, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                frameshtons(pCtx, pBuf, pSrc->measurement_request.Beacon.meas_duration, 0);
+                *pnConsumed += 2;
+                pBuf += 2;
+                *pBuf = pSrc->measurement_request.Beacon.meas_mode;
+                *pnConsumed += 1;
+                pBuf += 1;
+                DOT11F_MEMCPY(pCtx, pBuf, pSrc->measurement_request.Beacon.BSSID, 6);
+                *pnConsumed += 6;
+                pBuf += 6;
+            status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_measurement_requestBeacon,
+          IES_measurement_requestBeacon);
+            break;
+        }
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeMeasurementRequest. */
+
+tANI_U32 dot11fPackIeMobilityDomain(tpAniSirGlobal pCtx,
+                                    tDot11fIEMobilityDomain *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp126__;
+    nNeeded  += 3;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 54;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->MDID, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp126__ = 0U;
+        tmp126__ |= ( pSrc->overDSCap << 0 );
+        tmp126__ |= ( pSrc->resourceReqCap << 1 );
+        tmp126__ |= ( pSrc->reserved << 2 );
+        *pBuf = tmp126__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeMobilityDomain. */
+
+tANI_U32 dot11fPackIeNeighborReport(tpAniSirGlobal pCtx,
+                                    tDot11fIENeighborReport *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp127__;
+    tANI_U8 tmp128__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIENeighborReport(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 52;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; --nBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->bssid, 6);
+        *pnConsumed += 6;
+        pBuf += 6;
+        tmp127__ = 0U;
+        tmp127__ |= ( pSrc->APReachability << 0 );
+        tmp127__ |= ( pSrc->Security << 2 );
+        tmp127__ |= ( pSrc->KeyScope << 3 );
+        tmp127__ |= ( pSrc->SpecMgmtCap << 4 );
+        tmp127__ |= ( pSrc->QosCap << 5 );
+        tmp127__ |= ( pSrc->apsd << 6 );
+        tmp127__ |= ( pSrc->rrm << 7 );
+        *pBuf = tmp127__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp128__ = 0U;
+        tmp128__ |= ( pSrc->DelayedBA << 0 );
+        tmp128__ |= ( pSrc->ImmBA << 1 );
+        tmp128__ |= ( pSrc->MobilityDomain << 2 );
+        tmp128__ |= ( pSrc->reserved << 3 );
+        *pBuf = tmp128__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->reserved1, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        *pBuf = pSrc->regulatoryClass;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->channel;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->PhyType;
+        *pnConsumed += 1;
+        pBuf += 1;
+        status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_NeighborReport,
+          IES_NeighborReport);
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeNeighborReport. */
+
+tANI_U32 dot11fPackIeP2PAssocReq(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PAssocReq *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PAssocReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PAssocReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PAssocReq. */
+
+tANI_U32 dot11fPackIeP2PAssocRes(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PAssocRes *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PAssocRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PAssocRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PAssocRes. */
+
+tANI_U32 dot11fPackIeP2PBeacon(tpAniSirGlobal pCtx,
+                               tDot11fIEP2PBeacon *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PBeacon(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PBeacon+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PBeacon. */
+
+tANI_U32 dot11fPackIeP2PBeaconProbeRes(tpAniSirGlobal pCtx,
+                                       tDot11fIEP2PBeaconProbeRes *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PBeaconProbeRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PBeaconProbeRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PBeaconProbeRes. */
+
+tANI_U32 dot11fPackIeP2PDeAuth(tpAniSirGlobal pCtx,
+                               tDot11fIEP2PDeAuth *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PDeAuth(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PDeAuth+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PDeAuth. */
+
+tANI_U32 dot11fPackIeP2PDeviceDiscoverabilityReq(tpAniSirGlobal pCtx,
+                                                 tDot11fIEP2PDeviceDiscoverabilityReq *pSrc,
+                                                 tANI_U8 *pBuf,
+                                                 tANI_U32 nBuf,
+                                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PDeviceDiscoverabilityReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PDeviceDiscoverabilityReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PDeviceDiscoverabilityReq. */
+
+tANI_U32 dot11fPackIeP2PDeviceDiscoverabilityRes(tpAniSirGlobal pCtx,
+                                                 tDot11fIEP2PDeviceDiscoverabilityRes *pSrc,
+                                                 tANI_U8 *pBuf,
+                                                 tANI_U32 nBuf,
+                                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PDeviceDiscoverabilityRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PDeviceDiscoverabilityRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PDeviceDiscoverabilityRes. */
+
+tANI_U32 dot11fPackIeP2PDisAssoc(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PDisAssoc *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PDisAssoc(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PDisAssoc+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PDisAssoc. */
+
+tANI_U32 dot11fPackIeP2PGONegCnf(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PGONegCnf *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PGONegCnf(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PGONegCnf+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PGONegCnf. */
+
+tANI_U32 dot11fPackIeP2PGONegReq(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PGONegReq *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PGONegReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PGONegReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PGONegReq. */
+
+tANI_U32 dot11fPackIeP2PGONegRes(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PGONegRes *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PGONegRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PGONegRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PGONegRes. */
+
+tANI_U32 dot11fPackIeP2PGONegWPS(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PGONegWPS *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PGONegWPS(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PGONegWPS+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PGONegWPS. */
+
+tANI_U32 dot11fPackIeP2PIEOpaque(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PIEOpaque *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x6f;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x9a;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x9;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeP2PIEOpaque. */
+
+tANI_U32 dot11fPackIeP2PInvitationReq(tpAniSirGlobal pCtx,
+                                      tDot11fIEP2PInvitationReq *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PInvitationReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PInvitationReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PInvitationReq. */
+
+tANI_U32 dot11fPackIeP2PInvitationRes(tpAniSirGlobal pCtx,
+                                      tDot11fIEP2PInvitationRes *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PInvitationRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PInvitationRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PInvitationRes. */
+
+tANI_U32 dot11fPackIeP2PNoticeOfAbsence(tpAniSirGlobal pCtx,
+                                        tDot11fIEP2PNoticeOfAbsence *pSrc,
+                                        tANI_U8 *pBuf,
+                                        tANI_U32 nBuf,
+                                        tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PNoticeOfAbsence(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PNoticeOfAbsence+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PNoticeOfAbsence. */
+
+tANI_U32 dot11fPackIeP2PPresenceResponse(tpAniSirGlobal pCtx,
+                                         tDot11fIEP2PPresenceResponse *pSrc,
+                                         tANI_U8 *pBuf,
+                                         tANI_U32 nBuf,
+                                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PPresenceResponse(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PPresenceResponse+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PPresenceResponse. */
+
+tANI_U32 dot11fPackIeP2PProbeReq(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PProbeReq *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PProbeReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PProbeReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PProbeReq. */
+
+tANI_U32 dot11fPackIeP2PProbeRes(tpAniSirGlobal pCtx,
+                                 tDot11fIEP2PProbeRes *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PProbeRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PProbeRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PProbeRes. */
+
+tANI_U32 dot11fPackIeP2PProvisionDiscoveryReq(tpAniSirGlobal pCtx,
+                                              tDot11fIEP2PProvisionDiscoveryReq *pSrc,
+                                              tANI_U8 *pBuf,
+                                              tANI_U32 nBuf,
+                                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PProvisionDiscoveryReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x6f;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9a;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x9;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PProvisionDiscoveryReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PProvisionDiscoveryReq. */
+
+tANI_U32 dot11fPackIeP2PWSCProvisionDiscoveryRes(tpAniSirGlobal pCtx,
+                                                 tDot11fIEP2PWSCProvisionDiscoveryRes *pSrc,
+                                                 tANI_U8 *pBuf,
+                                                 tANI_U32 nBuf,
+                                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEP2PWSCProvisionDiscoveryRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_P2PWSCProvisionDiscoveryRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeP2PWSCProvisionDiscoveryRes. */
+
+tANI_U32 dot11fPackIePowerCaps(tpAniSirGlobal pCtx,
+                               tDot11fIEPowerCaps *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 33;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->minTxPower;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->maxTxPower;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePowerCaps. */
+
+tANI_U32 dot11fPackIePowerConstraints(tpAniSirGlobal pCtx,
+                                      tDot11fIEPowerConstraints *pSrc,
+                                      tANI_U8 *pBuf,
+                                      tANI_U32 nBuf,
+                                      tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 32;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->localPowerConstraints;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIePowerConstraints. */
+
+tANI_U32 dot11fPackIeQBSSLoad(tpAniSirGlobal pCtx,
+                              tDot11fIEQBSSLoad *pSrc,
+                              tANI_U8 *pBuf,
+                              tANI_U32 nBuf,
+                              tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 5;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 11;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->stacount, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        *pBuf = pSrc->chautil;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->avail, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeQBSSLoad. */
+
+tANI_U32 dot11fPackIeQOSCapsAp(tpAniSirGlobal pCtx,
+                               tDot11fIEQOSCapsAp *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp129__;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 46;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp129__ = 0U;
+        tmp129__ |= ( pSrc->reserved << 0 );
+        tmp129__ |= ( pSrc->txopreq << 1 );
+        tmp129__ |= ( pSrc->qreq << 2 );
+        tmp129__ |= ( pSrc->qack << 3 );
+        tmp129__ |= ( pSrc->count << 4 );
+        *pBuf = tmp129__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeQOSCapsAp. */
+
+tANI_U32 dot11fPackIeQOSCapsStation(tpAniSirGlobal pCtx,
+                                    tDot11fIEQOSCapsStation *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp130__;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 46;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        tmp130__ = 0U;
+        tmp130__ |= ( pSrc->more_data_ack << 0 );
+        tmp130__ |= ( pSrc->max_sp_length << 1 );
+        tmp130__ |= ( pSrc->qack << 3 );
+        tmp130__ |= ( pSrc->acbe_uapsd << 4 );
+        tmp130__ |= ( pSrc->acbk_uapsd << 5 );
+        tmp130__ |= ( pSrc->acvi_uapsd << 6 );
+        tmp130__ |= ( pSrc->acvo_uapsd << 7 );
+        *pBuf = tmp130__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeQOSCapsStation. */
+
+tANI_U32 dot11fPackIeQuiet(tpAniSirGlobal pCtx,
+                           tDot11fIEQuiet *pSrc,
+                           tANI_U8 *pBuf,
+                           tANI_U32 nBuf,
+                           tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 6;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 40;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->count;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->period;
+        *pnConsumed += 1;
+        pBuf += 1;
+        frameshtons(pCtx, pBuf, pSrc->duration, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->offset, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeQuiet. */
+
+tANI_U32 dot11fPackIeRCPIIE(tpAniSirGlobal pCtx,
+                            tDot11fIERCPIIE *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 53;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->rcpi;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRCPIIE. */
+
+tANI_U32 dot11fPackIeRICDataDesc(tpAniSirGlobal pCtx,
+                                 tDot11fIERICDataDesc *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIERICDataDesc(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        status = PackCore(pCtx,
+          (tANI_U8*)pSrc,
+          pBuf,
+          nBuf,
+          pnConsumed,
+          FFS_RICDataDesc,
+          IES_RICDataDesc);
+        break;
+    }
+    (void)pCtx;
+    return status;
+} /* End dot11fPackIeRICDataDesc. */
+
+tANI_U32 dot11fPackIeRSN(tpAniSirGlobal pCtx,
+                         tDot11fIERSN *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp131__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIERSN(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 48;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->version, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->gp_cipher_suite, 4);
+        *pnConsumed += 4;
+        pBuf += 4;
+        if ( pSrc->pwise_cipher_suite_count )        {
+            frameshtons(pCtx, pBuf, pSrc->pwise_cipher_suite_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->pwise_cipher_suites ), ( pSrc->pwise_cipher_suite_count * 4 ));
+        *pnConsumed += ( pSrc->pwise_cipher_suite_count * 4 );
+        pBuf += ( pSrc->pwise_cipher_suite_count * 4 );
+        if ( pSrc->akm_suite_count )        {
+            frameshtons(pCtx, pBuf, pSrc->akm_suite_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->akm_suites ), ( pSrc->akm_suite_count * 4 ));
+        *pnConsumed += ( pSrc->akm_suite_count * 4 );
+        pBuf += ( pSrc->akm_suite_count * 4 );
+        tmp131__ = 0U;
+        tmp131__ |= ( pSrc->preauth << 0 );
+        tmp131__ |= ( pSrc->no_pwise << 1 );
+        tmp131__ |= ( pSrc->PTKSA_replay_counter << 2 );
+        tmp131__ |= ( pSrc->GTKSA_replay_counter << 4 );
+        tmp131__ |= ( pSrc->reserved << 6 );
+        frameshtons(pCtx, pBuf, tmp131__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        if ( pSrc->pmkid_count )        {
+            frameshtons(pCtx, pBuf, pSrc->pmkid_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->pmkid ), ( pSrc->pmkid_count * 16 ));
+        *pnConsumed += ( pSrc->pmkid_count * 16 );
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeRSN. */
+
+tANI_U32 dot11fPackIeRSNIIE(tpAniSirGlobal pCtx,
+                            tDot11fIERSNIIE *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 1;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 65;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->rsni;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRSNIIE. */
+
+tANI_U32 dot11fPackIeRSNOpaque(tpAniSirGlobal pCtx,
+                               tDot11fIERSNOpaque *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 48;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeRSNOpaque. */
+
+tANI_U32 dot11fPackIeSuppChannels(tpAniSirGlobal pCtx,
+                                  tDot11fIESuppChannels *pSrc,
+                                  tANI_U8 *pBuf,
+                                  tANI_U32 nBuf,
+                                  tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_bands * 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 36;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->bands ), ( pSrc->num_bands * 2 ));
+        *pnConsumed += ( pSrc->num_bands * 2 );
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeSuppChannels. */
+
+tANI_U32 dot11fPackIeSuppRates(tpAniSirGlobal pCtx,
+                               tDot11fIESuppRates *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_rates;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 1;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->rates ), pSrc->num_rates);
+        *pnConsumed += pSrc->num_rates;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeSuppRates. */
+
+tANI_U32 dot11fPackIeTIM(tpAniSirGlobal pCtx,
+                         tDot11fIETIM *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  (pSrc->num_vbmp + 3);
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 5;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->dtim_count;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->dtim_period;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->bmpctl;
+        *pnConsumed += 1;
+        pBuf += 1;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->vbmp ), pSrc->num_vbmp);
+        *pnConsumed += pSrc->num_vbmp;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTIM. */
+
+tANI_U32 dot11fPackIeTPCReport(tpAniSirGlobal pCtx,
+                               tDot11fIETPCReport *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 35;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->tx_power;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->link_margin;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTPCReport. */
+
+tANI_U32 dot11fPackIeTPCRequest(tpAniSirGlobal pCtx,
+                                tDot11fIETPCRequest *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 0;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 34;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeTPCRequest. */
+
+tANI_U32 dot11fPackIeWAPI(tpAniSirGlobal pCtx,
+                          tDot11fIEWAPI *pSrc,
+                          tANI_U8 *pBuf,
+                          tANI_U32 nBuf,
+                          tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U16 tmp132__;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEWAPI(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 68;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->version, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        frameshtons(pCtx, pBuf, pSrc->akm_suite_count, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->akm_suites ), ( pSrc->akm_suite_count * 4 ));
+        *pnConsumed += ( pSrc->akm_suite_count * 4 );
+        pBuf += ( pSrc->akm_suite_count * 4 );
+        frameshtons(pCtx, pBuf, pSrc->unicast_cipher_suite_count, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->unicast_cipher_suites ), ( pSrc->unicast_cipher_suite_count * 4 ));
+        *pnConsumed += ( pSrc->unicast_cipher_suite_count * 4 );
+        pBuf += ( pSrc->unicast_cipher_suite_count * 4 );
+        DOT11F_MEMCPY(pCtx, pBuf, pSrc->multicast_cipher_suite, 4);
+        *pnConsumed += 4;
+        pBuf += 4;
+        tmp132__ = 0U;
+        tmp132__ |= ( pSrc->preauth << 0 );
+        tmp132__ |= ( pSrc->reserved << 1 );
+        frameshtons(pCtx, pBuf, tmp132__, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        nBuf -=  2 ;
+        if ( pSrc->bkid_count )        {
+            frameshtons(pCtx, pBuf, pSrc->bkid_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->bkid ), ( pSrc->bkid_count * 16 ));
+        *pnConsumed += ( pSrc->bkid_count * 16 );
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeWAPI. */
+
+tANI_U32 dot11fPackIeWAPIOpaque(tpAniSirGlobal pCtx,
+                                tDot11fIEWAPIOpaque *pSrc,
+                                tANI_U8 *pBuf,
+                                tANI_U32 nBuf,
+                                tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 68;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWAPIOpaque. */
+
+tANI_U32 dot11fPackIeWFATPC(tpAniSirGlobal pCtx,
+                            tDot11fIEWFATPC *pSrc,
+                            tANI_U8 *pBuf,
+                            tANI_U32 nBuf,
+                            tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x8;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->txPower;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->linkMargin;
+        *pnConsumed += 1;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWFATPC. */
+
+tANI_U32 dot11fPackIeWMMCaps(tpAniSirGlobal pCtx,
+                             tDot11fIEWMMCaps *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32 nBuf,
+                             tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp133__;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x5;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp133__ = 0U;
+        tmp133__ |= ( pSrc->reserved << 0 );
+        tmp133__ |= ( pSrc->qack << 4 );
+        tmp133__ |= ( pSrc->queue_request << 5 );
+        tmp133__ |= ( pSrc->txop_request << 6 );
+        tmp133__ |= ( pSrc->more_ack << 7 );
+        *pBuf = tmp133__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMCaps. */
+
+tANI_U32 dot11fPackIeWMMInfoAp(tpAniSirGlobal pCtx,
+                               tDot11fIEWMMInfoAp *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp134__;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp134__ = 0U;
+        tmp134__ |= ( pSrc->param_set_count << 0 );
+        tmp134__ |= ( pSrc->reserved << 4 );
+        tmp134__ |= ( pSrc->uapsd << 7 );
+        *pBuf = tmp134__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMInfoAp. */
+
+tANI_U32 dot11fPackIeWMMInfoStation(tpAniSirGlobal pCtx,
+                                    tDot11fIEWMMInfoStation *pSrc,
+                                    tANI_U8 *pBuf,
+                                    tANI_U32 nBuf,
+                                    tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp135__;
+    nNeeded  += 2;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp135__ = 0U;
+        tmp135__ |= ( pSrc->acvo_uapsd << 0 );
+        tmp135__ |= ( pSrc->acvi_uapsd << 1 );
+        tmp135__ |= ( pSrc->acbk_uapsd << 2 );
+        tmp135__ |= ( pSrc->acbe_uapsd << 3 );
+        tmp135__ |= ( pSrc->reserved1 << 4 );
+        tmp135__ |= ( pSrc->max_sp_length << 5 );
+        tmp135__ |= ( pSrc->reserved2 << 7 );
+        *pBuf = tmp135__;
+        *pnConsumed += 1;
+        // fieldsEndFlag  = 1 
+        nBuf -=  1 ;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMInfoStation. */
+
+tANI_U32 dot11fPackIeWMMParams(tpAniSirGlobal pCtx,
+                               tDot11fIEWMMParams *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp136__;
+    tANI_U8 tmp137__;
+    tANI_U8 tmp138__;
+    tANI_U8 tmp139__;
+    tANI_U8 tmp140__;
+    tANI_U8 tmp141__;
+    tANI_U8 tmp142__;
+    tANI_U8 tmp143__;
+    nNeeded  += 19;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x1;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = pSrc->version;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->qosInfo;
+        *pnConsumed += 1;
+        pBuf += 1;
+        *pBuf = pSrc->reserved2;
+        *pnConsumed += 1;
+        pBuf += 1;
+        tmp136__ = 0U;
+        tmp136__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp136__ |= ( pSrc->acbe_acm << 4 );
+        tmp136__ |= ( pSrc->acbe_aci << 5 );
+        tmp136__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp136__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp137__ = 0U;
+        tmp137__ |= ( pSrc->acbe_acwmin << 0 );
+        tmp137__ |= ( pSrc->acbe_acwmax << 4 );
+        *pBuf = tmp137__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp138__ = 0U;
+        tmp138__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp138__ |= ( pSrc->acbk_acm << 4 );
+        tmp138__ |= ( pSrc->acbk_aci << 5 );
+        tmp138__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp138__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp139__ = 0U;
+        tmp139__ |= ( pSrc->acbk_acwmin << 0 );
+        tmp139__ |= ( pSrc->acbk_acwmax << 4 );
+        *pBuf = tmp139__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp140__ = 0U;
+        tmp140__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp140__ |= ( pSrc->acvi_acm << 4 );
+        tmp140__ |= ( pSrc->acvi_aci << 5 );
+        tmp140__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp140__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp141__ = 0U;
+        tmp141__ |= ( pSrc->acvi_acwmin << 0 );
+        tmp141__ |= ( pSrc->acvi_acwmax << 4 );
+        *pBuf = tmp141__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        tmp142__ = 0U;
+        tmp142__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp142__ |= ( pSrc->acvo_acm << 4 );
+        tmp142__ |= ( pSrc->acvo_aci << 5 );
+        tmp142__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp142__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp143__ = 0U;
+        tmp143__ |= ( pSrc->acvo_acwmin << 0 );
+        tmp143__ |= ( pSrc->acvo_acwmax << 4 );
+        *pBuf = tmp143__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        frameshtons(pCtx, pBuf, pSrc->acvo_txoplimit, 0);
+        *pnConsumed += 2;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWMMParams. */
+
+tANI_U32 dot11fPackIeWPA(tpAniSirGlobal pCtx,
+                         tDot11fIEWPA *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    status = dot11fGetPackedIEWPA(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x1;
+        ++pBuf; ++(*pnConsumed);
+        frameshtons(pCtx, pBuf, pSrc->version, 0);
+        *pnConsumed += 2;
+        pBuf += 2;
+        if ( pSrc->multicast_cipher_present )        {
+            DOT11F_MEMCPY(pCtx, pBuf, pSrc->multicast_cipher, 4);
+            *pnConsumed += 4;
+            pBuf += 4;
+        }
+        else break;
+        if ( pSrc->unicast_cipher_count )        {
+            frameshtons(pCtx, pBuf, pSrc->unicast_cipher_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->unicast_ciphers ), ( pSrc->unicast_cipher_count * 4 ));
+        *pnConsumed += ( pSrc->unicast_cipher_count * 4 );
+        pBuf += ( pSrc->unicast_cipher_count * 4 );
+        if ( pSrc->auth_suite_count )        {
+            frameshtons(pCtx, pBuf, pSrc->auth_suite_count, 0);
+            *pnConsumed += 2;
+            pBuf += 2;
+        }
+        else break;
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->auth_suites ), ( pSrc->auth_suite_count * 4 ));
+        *pnConsumed += ( pSrc->auth_suite_count * 4 );
+        pBuf += ( pSrc->auth_suite_count * 4 );
+        if ( pSrc->caps )        {
+            frameshtons(pCtx, pBuf, pSrc->caps, 0);
+            *pnConsumed += 2;
+            // fieldsEndFlag = 1 
+        }
+        else break;
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return status;
+} /* End dot11fPackIeWPA. */
+
+tANI_U32 dot11fPackIeWPAOpaque(tpAniSirGlobal pCtx,
+                               tDot11fIEWPAOpaque *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x1;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWPAOpaque. */
+
+tANI_U32 dot11fPackIeWSC(tpAniSirGlobal pCtx,
+                         tDot11fIEWSC *pSrc,
+                         tANI_U8 *pBuf,
+                         tANI_U32 nBuf,
+                         tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWSC(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WSC+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWSC. */
+
+tANI_U32 dot11fPackIeWscAssocReq(tpAniSirGlobal pCtx,
+                                 tDot11fIEWscAssocReq *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscAssocReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscAssocReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscAssocReq. */
+
+tANI_U32 dot11fPackIeWscAssocRes(tpAniSirGlobal pCtx,
+                                 tDot11fIEWscAssocRes *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscAssocRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscAssocRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscAssocRes. */
+
+tANI_U32 dot11fPackIeWscBeacon(tpAniSirGlobal pCtx,
+                               tDot11fIEWscBeacon *pSrc,
+                               tANI_U8 *pBuf,
+                               tANI_U32 nBuf,
+                               tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscBeacon(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscBeacon+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscBeacon. */
+
+tANI_U32 dot11fPackIeWscBeaconProbeRes(tpAniSirGlobal pCtx,
+                                       tDot11fIEWscBeaconProbeRes *pSrc,
+                                       tANI_U8 *pBuf,
+                                       tANI_U32 nBuf,
+                                       tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscBeaconProbeRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscBeaconProbeRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscBeaconProbeRes. */
+
+tANI_U32 dot11fPackIeWscIEOpaque(tpAniSirGlobal pCtx,
+                                 tDot11fIEWscIEOpaque *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 nConsumedOnEntry = *pnConsumed;
+    tANI_U32 nNeeded = 0U;
+    nNeeded  +=  pSrc->num_data;
+    while ( pSrc->present )
+    {
+        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+        *pBuf = 221;
+        ++pBuf; ++(*pnConsumed);
+        pIeLen = pBuf;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x0;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x50;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0xf2;
+        ++pBuf; ++(*pnConsumed);
+        *pBuf = 0x4;
+        ++pBuf; ++(*pnConsumed);
+        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
+        *pnConsumed += pSrc->num_data;
+        // fieldsEndFlag = 1 
+        break;
+    }
+    (void)pCtx;
+    if (pIeLen)
+    {
+        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
+    }
+    return DOT11F_PARSE_SUCCESS;
+} /* End dot11fPackIeWscIEOpaque. */
+
+tANI_U32 dot11fPackIeWscProbeReq(tpAniSirGlobal pCtx,
+                                 tDot11fIEWscProbeReq *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscProbeReq(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscProbeReq+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscProbeReq. */
+
+tANI_U32 dot11fPackIeWscProbeRes(tpAniSirGlobal pCtx,
+                                 tDot11fIEWscProbeRes *pSrc,
+                                 tANI_U8 *pBuf,
+                                 tANI_U32 nBuf,
+                                 tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscProbeRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscProbeRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscProbeRes. */
+
+tANI_U32 dot11fPackIeWscReassocRes(tpAniSirGlobal pCtx,
+                                   tDot11fIEWscReassocRes *pSrc,
+                                   tANI_U8 *pBuf,
+                                   tANI_U32 nBuf,
+                                   tANI_U32 *pnConsumed)
+{
+    tANI_U8* pIeLen = 0;
+    tANI_U32 n, idx = 0,idxlast;
+    tANI_U32 nConsumedSoFar, nConsumedNow;
+    tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U32 nNeeded = 0U;
+    status = dot11fGetPackedIEWscReassocRes(pCtx, pSrc, &nNeeded);
+    if ( ! DOT11F_SUCCEEDED( status ) ) return status;
+    if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
+    (void)pCtx;
+    if (pSrc->present) {
+        do {
+        nConsumedSoFar=*pnConsumed;
+            *pBuf = 221;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            pIeLen = pBuf;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x0;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x50;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0xf2;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            *pBuf = 0x4;
+            ++pBuf; --nBuf; ++(*pnConsumed);
+            n = ( 255 - 4) < nBuf ? ( 255 - 4) : nBuf;
+            nConsumedNow=*pnConsumed;
+            idxlast=idx;
+            status = PackTlvCore(pCtx,(tANI_U8*)pSrc,pBuf,n,pnConsumed,TLVS_WscReassocRes+idx,&idx);
+            nConsumedNow=*pnConsumed-nConsumedNow;
+            *pIeLen = *pnConsumed - nConsumedSoFar - 2;
+            pBuf+=nConsumedNow;
+            nBuf-=nConsumedNow;
+        } while (DOT11F_BUFFER_OVERFLOW == status && idxlast != idx);
+    }
+    return status;
+} /* End dot11fPackIeWscReassocRes. */
+
+tANI_U32 dot11fPackAddBAReq(tpAniSirGlobal pCtx, tDot11fAddBAReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AddBAReq, IES_AddBAReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Packed the AddBAReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("AddBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("amsduSupported (1): %d\n"), pFrm->AddBAParameterSet.amsduSupported);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("policy (1): %d\n"), pFrm->AddBAParameterSet.policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("tid (4): %d\n"), pFrm->AddBAParameterSet.tid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("bufferSize (10): %d\n"), pFrm->AddBAParameterSet.bufferSize);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("BATimeout:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), ( tANI_U8* )&pFrm->BATimeout.timeout, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("BAStartingSequenceControl:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("fragNumber (4): %d\n"), pFrm->BAStartingSequenceControl.fragNumber);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("ssn (12): %d\n"), pFrm->BAStartingSequenceControl.ssn);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBAREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddBAReq. */
+
+tANI_U32 dot11fPackAddBARsp(tpAniSirGlobal pCtx, tDot11fAddBARsp *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AddBARsp, IES_AddBARsp);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Packed the AddBARsp:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("AddBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("amsduSupported (1): %d\n"), pFrm->AddBAParameterSet.amsduSupported);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("policy (1): %d\n"), pFrm->AddBAParameterSet.policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("tid (4): %d\n"), pFrm->AddBAParameterSet.tid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("bufferSize (10): %d\n"), pFrm->AddBAParameterSet.bufferSize);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("BATimeout:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), ( tANI_U8* )&pFrm->BATimeout.timeout, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDBARSP), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddBARsp. */
+
+tANI_U32 dot11fPackAddTSRequest(tpAniSirGlobal pCtx, tDot11fAddTSRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AddTSRequest, IES_AddTSRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Packed the AddTSRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TSPEC:\n"));
+        if (!pFrm->TSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->TSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->TSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->TSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->TSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->TSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->TSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->TSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("schedule (1): %d\n"), pFrm->TSPEC.schedule);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("unused (7): %d\n"), pFrm->TSPEC.unused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->TSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->TSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_TCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TCLAS[%d]:\n"), i);
+            if (!pFrm->TCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].classifier_mask, 1);
+                switch (pFrm->TCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->TCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("TCLASSPROC:\n"));
+        if (!pFrm->TCLASSPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->TCLASSPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_WMMTCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTCLAS[%d]:\n"), i);
+            if (!pFrm->WMMTCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].version, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_mask, 1);
+                switch (pFrm->WMMTCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->WMMTCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("WMMTCLASPROC:\n"));
+        if (!pFrm->WMMTCLASPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLASPROC.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTCLASPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddTSRequest. */
+
+tANI_U32 dot11fPackAddTSResponse(tpAniSirGlobal pCtx, tDot11fAddTSResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AddTSResponse, IES_AddTSResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Packed the AddTSResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TSDelay:\n"));
+        if (!pFrm->TSDelay.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSDelay.delay, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TSPEC:\n"));
+        if (!pFrm->TSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->TSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->TSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->TSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->TSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->TSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->TSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->TSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("schedule (1): %d\n"), pFrm->TSPEC.schedule);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("unused (7): %d\n"), pFrm->TSPEC.unused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->TSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->TSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_TCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+            if (!pFrm->TCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].classifier_mask, 1);
+                switch (pFrm->TCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->TCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("TCLASSPROC:\n"));
+        if (!pFrm->TCLASSPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->TCLASSPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Schedule:\n"));
+        if (!pFrm->Schedule.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->Schedule.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->Schedule.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->Schedule.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("reserved (9): %d\n"), pFrm->Schedule.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.service_interval, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.max_service_dur, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->Schedule.spec_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTSDelay:\n"));
+        if (!pFrm->WMMTSDelay.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSDelay.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSDelay.delay, 4);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMSchedule:\n"));
+        if (!pFrm->WMMSchedule.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMSchedule.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMSchedule.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMSchedule.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("reserved (9): %d\n"), pFrm->WMMSchedule.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.service_interval, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.max_service_dur, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMSchedule.spec_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        for (i = 0; i < pFrm->num_WMMTCLAS; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+            if (!pFrm->WMMTCLAS[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].version, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].user_priority, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_type, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].classifier_mask, 1);
+                switch (pFrm->WMMTCLAS[i].classifier_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.source, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.dest, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.EthParams.type, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.version, 1);
+                        switch (pFrm->WMMTCLAS[i].info.IpParams.version)
+                        {
+                            case 4:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                            break;
+                            case 6:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                            break;
+                        }
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("WMMTCLASPROC:\n"));
+        if (!pFrm->WMMTCLASPROC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLASPROC.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTCLASPROC.processing, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ADDTSRESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAddTSResponse. */
+
+tANI_U32 dot11fPackAssocRequest(tpAniSirGlobal pCtx, tDot11fAssocRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AssocRequest, IES_AssocRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Packed the AssocRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ListenInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->ListenInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PowerCaps:\n"));
+        if (!pFrm->PowerCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.minTxPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.maxTxPower, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("SuppChannels:\n"));
+        if (!pFrm->SuppChannels.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_bands: %d.\n"), pFrm->SuppChannels.num_bands);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->SuppChannels.bands, 2 * pFrm->SuppChannels.num_bands);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("QOSCapsStation:\n"));
+        if (!pFrm->QOSCapsStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("more_data_ack (1): %d\n"), pFrm->QOSCapsStation.more_data_ack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->QOSCapsStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->QOSCapsStation.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvo_uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WPAOpaque:\n"));
+        if (!pFrm->WPAOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WPAOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WPAOpaque.data, pFrm->WPAOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WMMInfoStation:\n"));
+        if (!pFrm->WMMInfoStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->WMMInfoStation.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvo_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (1): %d\n"), pFrm->WMMInfoStation.reserved1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->WMMInfoStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (1): %d\n"), pFrm->WMMInfoStation.reserved2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WscIEOpaque:\n"));
+        if (!pFrm->WscIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WscIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WscIEOpaque.data, pFrm->WscIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WAPIOpaque:\n"));
+        if (!pFrm->WAPIOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WAPIOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WAPIOpaque.data, pFrm->WAPIOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("P2PIEOpaque:\n"));
+        if (!pFrm->P2PIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAssocRequest. */
+
+tANI_U32 dot11fPackAssocResponse(tpAniSirGlobal pCtx, tDot11fAssocResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_AssocResponse, IES_AssocResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Packed the AssocResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->AID.associd, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RCPIIE:\n"));
+        if (!pFrm->RCPIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RCPIIE.rcpi, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RSNIIE:\n"));
+        if (!pFrm->RSNIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RSNIIE.rsni, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("WscAssocRes:\n"));
+        if (!pFrm->WscAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscAssocRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscAssocRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscAssocRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscAssocRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscAssocRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscAssocRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscAssocRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscAssocRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->WscAssocRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("P2PAssocRes:\n"));
+        if (!pFrm->P2PAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PAssocRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PAssocRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAssocResponse. */
+
+tANI_U32 dot11fPackAuthentication(tpAniSirGlobal pCtx, tDot11fAuthentication *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_Authentication, IES_Authentication);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Packed the Authentication:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("AuthAlgo:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->AuthAlgo.algo, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("AuthSeqNo:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->AuthSeqNo.no, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("ChallengeText:\n"));
+        if (!pFrm->ChallengeText.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_text: %d.\n"), pFrm->ChallengeText.num_text);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->ChallengeText.text, pFrm->ChallengeText.num_text);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("FTTimeoutInterval:\n"));
+        if (!pFrm->FTTimeoutInterval.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTTimeoutInterval.timeoutType, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->FTTimeoutInterval.timeoutValue, 4);
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_AUTHENTICATION), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackAuthentication. */
+
+tANI_U32 dot11fPackBeacon(tpAniSirGlobal pCtx, tDot11fBeacon *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_Beacon, IES_Beacon);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Packed the Beacon:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TIM:\n"));
+        if (!pFrm->TIM.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.dtim_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.dtim_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TIM.bmpctl, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_vbmp: %d.\n"), pFrm->TIM.num_vbmp);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->TIM.vbmp, pFrm->TIM.num_vbmp);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("QOSCapsAp:\n"));
+        if (!pFrm->QOSCapsAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (1): %d\n"), pFrm->QOSCapsAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txopreq (1): %d\n"), pFrm->QOSCapsAp.txopreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qreq (1): %d\n"), pFrm->QOSCapsAp.qreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qack (1): %d\n"), pFrm->QOSCapsAp.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("count (4): %d\n"), pFrm->QOSCapsAp.count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WscBeacon:\n"));
+        if (!pFrm->WscBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version:\n"));
+            if (!pFrm->WscBeacon.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("minor (4): %d\n"), pFrm->WscBeacon.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("major (4): %d\n"), pFrm->WscBeacon.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeacon.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeacon.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeacon.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeacon.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeacon.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeacon.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Version2:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("minor (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("major (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PBeacon:\n"));
+        if (!pFrm->P2PBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeacon.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeacon.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeacon.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon. */
+
+tANI_U32 dot11fPackBeacon1(tpAniSirGlobal pCtx, tDot11fBeacon1 *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_Beacon1, IES_Beacon1);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Packed the Beacon1:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON1), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon1. */
+
+tANI_U32 dot11fPackBeacon2(tpAniSirGlobal pCtx, tDot11fBeacon2 *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_Beacon2, IES_Beacon2);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Packed the Beacon2:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WscBeacon:\n"));
+        if (!pFrm->WscBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version:\n"));
+            if (!pFrm->WscBeacon.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("minor (4): %d\n"), pFrm->WscBeacon.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("major (4): %d\n"), pFrm->WscBeacon.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeacon.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeacon.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeacon.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeacon.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeacon.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeacon.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeacon.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Version2:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("minor (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("major (4): %d\n"), pFrm->WscBeacon.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeacon.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WscBeacon.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PBeacon:\n"));
+        if (!pFrm->P2PBeacon.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeacon.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeacon.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeacon.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->P2PBeacon.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeacon2. */
+
+tANI_U32 dot11fPackBeaconIEs(tpAniSirGlobal pCtx, tDot11fBeaconIEs *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_BeaconIEs, IES_BeaconIEs);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Packed the BeaconIEs:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TIM:\n"));
+        if (!pFrm->TIM.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.dtim_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.dtim_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TIM.bmpctl, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_vbmp: %d.\n"), pFrm->TIM.num_vbmp);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->TIM.vbmp, pFrm->TIM.num_vbmp);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("QOSCapsAp:\n"));
+        if (!pFrm->QOSCapsAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (1): %d\n"), pFrm->QOSCapsAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txopreq (1): %d\n"), pFrm->QOSCapsAp.txopreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qreq (1): %d\n"), pFrm->QOSCapsAp.qreq);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qack (1): %d\n"), pFrm->QOSCapsAp.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("count (4): %d\n"), pFrm->QOSCapsAp.count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WscBeaconProbeRes:\n"));
+        if (!pFrm->WscBeaconProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version:\n"));
+            if (!pFrm->WscBeaconProbeRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("minor (4): %d\n"), pFrm->WscBeaconProbeRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("major (4): %d\n"), pFrm->WscBeaconProbeRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("WPSState:\n"));
+            if (!pFrm->WscBeaconProbeRes.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscBeaconProbeRes.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscBeaconProbeRes.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscBeaconProbeRes.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscBeaconProbeRes.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ResponseType:\n"));
+            if (!pFrm->WscBeaconProbeRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("UUID_E:\n"));
+            if (!pFrm->WscBeaconProbeRes.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscBeaconProbeRes.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_name: %d.\n"), pFrm->WscBeaconProbeRes.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.Manufacturer.name, pFrm->WscBeaconProbeRes.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ModelName:\n"));
+            if (!pFrm->WscBeaconProbeRes.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.ModelName.text, pFrm->WscBeaconProbeRes.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscBeaconProbeRes.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.ModelNumber.text, pFrm->WscBeaconProbeRes.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("SerialNumber:\n"));
+            if (!pFrm->WscBeaconProbeRes.SerialNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.SerialNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.SerialNumber.text, pFrm->WscBeaconProbeRes.SerialNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscBeaconProbeRes.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DeviceName:\n"));
+            if (!pFrm->WscBeaconProbeRes.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->WscBeaconProbeRes.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->WscBeaconProbeRes.DeviceName.text, pFrm->WscBeaconProbeRes.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscBeaconProbeRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RFBands:\n"));
+            if (!pFrm->WscBeaconProbeRes.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscBeaconProbeRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Version2:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("minor (4): %d\n"), pFrm->WscBeaconProbeRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("major (4): %d\n"), pFrm->WscBeaconProbeRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscBeaconProbeRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->WscBeaconProbeRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PBeaconProbeRes:\n"));
+        if (!pFrm->P2PBeaconProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PBeaconProbeRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PBeaconProbeRes.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_NoADesc: %d.\n"), pFrm->P2PBeaconProbeRes.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.NoticeOfAbsence.NoADesc, pFrm->P2PBeaconProbeRes.NoticeOfAbsence.num_NoADesc);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->P2PBeaconProbeRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_text: %d.\n"), pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PBeaconProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("P2PGroupInfo:\n"));
+            if (!pFrm->P2PBeaconProbeRes.P2PGroupInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("num_P2PClientInfoDesc: %d.\n"), pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackBeaconIEs. */
+
+tANI_U32 dot11fPackChannelSwitch(tpAniSirGlobal pCtx, tDot11fChannelSwitch *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ChannelSwitch, IES_ChannelSwitch);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Packed the ChannelSwitch:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_CHANNELSWITCH), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackChannelSwitch. */
+
+tANI_U32 dot11fPackDeAuth(tpAniSirGlobal pCtx, tDot11fDeAuth *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_DeAuth, IES_DeAuth);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Packed the DeAuth:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("P2PDeAuth:\n"));
+        if (!pFrm->P2PDeAuth.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("MinorReasonCode:\n"));
+            if (!pFrm->P2PDeAuth.MinorReasonCode.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), ( tANI_U8* )&pFrm->P2PDeAuth.MinorReasonCode.minorReasonCode, 1);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEAUTH), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeAuth. */
+
+tANI_U32 dot11fPackDelBAInd(tpAniSirGlobal pCtx, tDot11fDelBAInd *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_DelBAInd, IES_DelBAInd);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Packed the DelBAInd:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("DelBAParameterSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("reserved (11): %d\n"), pFrm->DelBAParameterSet.reserved);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("initiator (1): %d\n"), pFrm->DelBAParameterSet.initiator);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("tid (4): %d\n"), pFrm->DelBAParameterSet.tid);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELBAIND), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDelBAInd. */
+
+tANI_U32 dot11fPackDelTS(tpAniSirGlobal pCtx, tDot11fDelTS *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_DelTS, IES_DelTS);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Packed the DelTS:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("TSInfo:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("traffic_type (1): %d\n"), pFrm->TSInfo.traffic_type);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("tsid (4): %d\n"), pFrm->TSInfo.tsid);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("direction (2): %d\n"), pFrm->TSInfo.direction);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("access_policy (2): %d\n"), pFrm->TSInfo.access_policy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("aggregation (1): %d\n"), pFrm->TSInfo.aggregation);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("psb (1): %d\n"), pFrm->TSInfo.psb);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("user_priority (3): %d\n"), pFrm->TSInfo.user_priority);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->TSInfo.tsinfo_ack_pol);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("schedule (1): %d\n"), pFrm->TSInfo.schedule);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("unused (15): %d\n"), pFrm->TSInfo.unused);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DELTS), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDelTS. */
+
+tANI_U32 dot11fPackDeviceDiscoverabilityReq(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_DeviceDiscoverabilityReq, IES_DeviceDiscoverabilityReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Packed the DeviceDiscoverabilityReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PDeviceDiscoverabilityReq:\n"));
+        if (!pFrm->P2PDeviceDiscoverabilityReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityReq.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityReq.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), ( tANI_U8* ) pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.ssid, pFrm->P2PDeviceDiscoverabilityReq.P2PGroupId.num_ssid);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeviceDiscoverabilityReq. */
+
+tANI_U32 dot11fPackDeviceDiscoverabilityRes(tpAniSirGlobal pCtx, tDot11fDeviceDiscoverabilityRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_DeviceDiscoverabilityRes, IES_DeviceDiscoverabilityRes);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Packed the DeviceDiscoverabilityRes:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2PDeviceDiscoverabilityRes:\n"));
+        if (!pFrm->P2PDeviceDiscoverabilityRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PDeviceDiscoverabilityRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), ( tANI_U8* )&pFrm->P2PDeviceDiscoverabilityRes.P2PStatus.status, 1);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DEVICEDISCOVERABILITYRES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDeviceDiscoverabilityRes. */
+
+tANI_U32 dot11fPackDisassociation(tpAniSirGlobal pCtx, tDot11fDisassociation *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_Disassociation, IES_Disassociation);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Packed the Disassociation:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Reason:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), ( tANI_U8* )&pFrm->Reason.code, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("P2PDisAssoc:\n"));
+        if (!pFrm->P2PDisAssoc.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("MinorReasonCode:\n"));
+            if (!pFrm->P2PDisAssoc.MinorReasonCode.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), ( tANI_U8* )&pFrm->P2PDisAssoc.MinorReasonCode.minorReasonCode, 1);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_DISASSOCIATION), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackDisassociation. */
+
+tANI_U32 dot11fPackGODiscoverabilityReq(tpAniSirGlobal pCtx, tDot11fGODiscoverabilityReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_GODiscoverabilityReq, IES_GODiscoverabilityReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("Packed the GODiscoverabilityReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GODISCOVERABILITYREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGODiscoverabilityReq. */
+
+tANI_U32 dot11fPackGONegCnf(tpAniSirGlobal pCtx, tDot11fGONegCnf *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_GONegCnf, IES_GONegCnf);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Packed the GONegCnf:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PGONegCnf:\n"));
+        if (!pFrm->P2PGONegCnf.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PGONegCnf.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegCnf.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegCnf.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegCnf.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegCnf.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* ) pFrm->P2PGONegCnf.ChannelList.channelList, pFrm->P2PGONegCnf.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PGONegCnf.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* )&pFrm->P2PGONegCnf.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("num_ssid: %d.\n"), pFrm->P2PGONegCnf.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), ( tANI_U8* ) pFrm->P2PGONegCnf.P2PGroupId.ssid, pFrm->P2PGONegCnf.P2PGroupId.num_ssid);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGCNF), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegCnf. */
+
+tANI_U32 dot11fPackGONegReq(tpAniSirGlobal pCtx, tDot11fGONegReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_GONegReq, IES_GONegReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Packed the GONegReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PGONegWPS:\n"));
+        if (!pFrm->P2PGONegWPS.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Version:\n"));
+            if (!pFrm->P2PGONegWPS.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("minor (4): %d\n"), pFrm->P2PGONegWPS.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("major (4): %d\n"), pFrm->P2PGONegWPS.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->P2PGONegWPS.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegWPS.DevicePasswordID.id, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PGONegReq:\n"));
+        if (!pFrm->P2PGONegReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("GOIntent:\n"));
+            if (!pFrm->P2PGONegReq.GOIntent.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.GOIntent.GOIntent, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PGONegReq.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ListenChannel:\n"));
+            if (!pFrm->P2PGONegReq.ListenChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ListenChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PGONegReq.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("IntendedP2PInterfaceAddress:\n"));
+            if (!pFrm->P2PGONegReq.IntendedP2PInterfaceAddress.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.IntendedP2PInterfaceAddress.P2PInterfaceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegReq.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegReq.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* ) pFrm->P2PGONegReq.ChannelList.channelList, pFrm->P2PGONegReq.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PGONegReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("num_text: %d.\n"), pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* ) pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PGONegReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), ( tANI_U8* )&pFrm->P2PGONegReq.OperatingChannel.channel, 1);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegReq. */
+
+tANI_U32 dot11fPackGONegRes(tpAniSirGlobal pCtx, tDot11fGONegRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_GONegRes, IES_GONegRes);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Packed the GONegRes:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGONegWPS:\n"));
+        if (!pFrm->P2PGONegWPS.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Version:\n"));
+            if (!pFrm->P2PGONegWPS.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("minor (4): %d\n"), pFrm->P2PGONegWPS.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("major (4): %d\n"), pFrm->P2PGONegWPS.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->P2PGONegWPS.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegWPS.DevicePasswordID.id, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGONegRes:\n"));
+        if (!pFrm->P2PGONegRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PGONegRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PGONegRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("GOIntent:\n"));
+            if (!pFrm->P2PGONegRes.GOIntent.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.GOIntent.GOIntent, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PGONegRes.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PGONegRes.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("IntendedP2PInterfaceAddress:\n"));
+            if (!pFrm->P2PGONegRes.IntendedP2PInterfaceAddress.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.IntendedP2PInterfaceAddress.P2PInterfaceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PGONegRes.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_channelList: %d.\n"), pFrm->P2PGONegRes.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.ChannelList.channelList, pFrm->P2PGONegRes.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PGONegRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_text: %d.\n"), pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PGONegRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PGONegRes.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* )&pFrm->P2PGONegRes.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("num_ssid: %d.\n"), pFrm->P2PGONegRes.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), ( tANI_U8* ) pFrm->P2PGONegRes.P2PGroupId.ssid, pFrm->P2PGONegRes.P2PGroupId.num_ssid);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_GONEGRES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackGONegRes. */
+
+tANI_U32 dot11fPackInvitationReq(tpAniSirGlobal pCtx, tDot11fInvitationReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_InvitationReq, IES_InvitationReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Packed the InvitationReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PInvitationReq:\n"));
+        if (!pFrm->P2PInvitationReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PInvitationReq.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("InvitationFlags:\n"));
+            if (!pFrm->P2PInvitationReq.InvitationFlags.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.InvitationFlags.invitationFlags, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PInvitationReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PGroupBssid:\n"));
+            if (!pFrm->P2PInvitationReq.P2PGroupBssid.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PGroupBssid.P2PGroupBssid, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PInvitationReq.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_channelList: %d.\n"), pFrm->P2PInvitationReq.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.ChannelList.channelList, pFrm->P2PInvitationReq.ChannelList.num_channelList);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PInvitationReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PInvitationReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.P2PGroupId.ssid, pFrm->P2PInvitationReq.P2PGroupId.num_ssid);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PInvitationReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* )&pFrm->P2PInvitationReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("num_text: %d.\n"), pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), ( tANI_U8* ) pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PInvitationReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackInvitationReq. */
+
+tANI_U32 dot11fPackInvitationRes(tpAniSirGlobal pCtx, tDot11fInvitationRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_InvitationRes, IES_InvitationRes);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Packed the InvitationRes:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PInvitationRes:\n"));
+        if (!pFrm->P2PInvitationRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PInvitationRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("ConfigurationTimeout:\n"));
+            if (!pFrm->P2PInvitationRes.ConfigurationTimeout.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ConfigurationTimeout.GOConfigTimeout, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ConfigurationTimeout.CLConfigTimeout, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PInvitationRes.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.OperatingChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("P2PGroupBssid:\n"));
+            if (!pFrm->P2PInvitationRes.P2PGroupBssid.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.P2PGroupBssid.P2PGroupBssid, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("ChannelList:\n"));
+            if (!pFrm->P2PInvitationRes.ChannelList.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* )&pFrm->P2PInvitationRes.ChannelList.countryString, 3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("num_channelList: %d.\n"), pFrm->P2PInvitationRes.ChannelList.num_channelList);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), ( tANI_U8* ) pFrm->P2PInvitationRes.ChannelList.channelList, pFrm->P2PInvitationRes.ChannelList.num_channelList);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_INVITATIONRES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackInvitationRes. */
+
+tANI_U32 dot11fPackLinkMeasurementReport(tpAniSirGlobal pCtx, tDot11fLinkMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_LinkMeasurementReport, IES_LinkMeasurementReport);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Packed the LinkMeasurementReport:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TPCEleID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TPCEleID.TPCId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TPCEleLen:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TPCEleLen.TPCLen, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TxPower.txPower, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("LinkMargin:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->LinkMargin.linkMargin, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RxAntennaId:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RxAntennaId.antennaId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("TxAntennaId:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->TxAntennaId.antennaId, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RCPI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RCPI.rcpi, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("RSNI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), ( tANI_U8* )&pFrm->RSNI.rsni, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREPORT), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackLinkMeasurementReport. */
+
+tANI_U32 dot11fPackLinkMeasurementRequest(tpAniSirGlobal pCtx, tDot11fLinkMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_LinkMeasurementRequest, IES_LinkMeasurementRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Packed the LinkMeasurementRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("TxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->TxPower.txPower, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("MaxTxPower:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MaxTxPower.maxTxPower, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_LINKMEASUREMENTREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackLinkMeasurementRequest. */
+
+tANI_U32 dot11fPackMeasurementReport(tpAniSirGlobal pCtx, tDot11fMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_MeasurementReport, IES_MeasurementReport);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Packed the MeasurementReport:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("MeasurementReport:\n"));
+        if (!pFrm->MeasurementReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.token, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("late (1): %d\n"), pFrm->MeasurementReport.late);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("incapable (1): %d\n"), pFrm->MeasurementReport.incapable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("refused (1): %d\n"), pFrm->MeasurementReport.refused);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unused (5): %d\n"), pFrm->MeasurementReport.unused);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.type, 1);
+            switch (pFrm->MeasurementReport.type)
+            {
+                case 0:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Basic.meas_duration, 2);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("bss (1): %d\n"), pFrm->MeasurementReport.report.Basic.bss);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("ofdm_preamble (1): %d\n"), pFrm->MeasurementReport.report.Basic.ofdm_preamble);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unid_signal (1): %d\n"), pFrm->MeasurementReport.report.Basic.unid_signal);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("rader (1): %d\n"), pFrm->MeasurementReport.report.Basic.rader);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unmeasured (1): %d\n"), pFrm->MeasurementReport.report.Basic.unmeasured);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("unused (3): %d\n"), pFrm->MeasurementReport.report.Basic.unused);
+                break;
+                case 1:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.meas_duration, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.CCA.cca_busy_fraction, 1);
+                break;
+                case 2:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.meas_duration, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi0_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi1_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi2_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi3_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi4_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi5_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi6_density, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.RPIHistogram.rpi7_density, 1);
+                break;
+                case 5:
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.regClass, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.channel, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.meas_start_time, 8);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.meas_duration, 2);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("condensed_PHY (7): %d\n"), pFrm->MeasurementReport.report.Beacon.condensed_PHY);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("reported_frame_type (1): %d\n"), pFrm->MeasurementReport.report.Beacon.reported_frame_type);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.RCPI, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.RSNI, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.BSSID, 6);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.antenna_id, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport.report.Beacon.parent_TSF, 4);
+                break;
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREPORT), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackMeasurementReport. */
+
+tANI_U32 dot11fPackMeasurementRequest(tpAniSirGlobal pCtx, tDot11fMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_MeasurementRequest, IES_MeasurementRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Packed the MeasurementRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_MeasurementRequest; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("MeasurementRequest[%d]:\n"), i);
+            if (!pFrm->MeasurementRequest[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("parallel (1): %d\n"), pFrm->MeasurementRequest[i].parallel);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("enable (1): %d\n"), pFrm->MeasurementRequest[i].enable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("request (1): %d\n"), pFrm->MeasurementRequest[i].request);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("report (1): %d\n"), pFrm->MeasurementRequest[i].report);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("durationMandatory (1): %d\n"), pFrm->MeasurementRequest[i].durationMandatory);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("unused (3): %d\n"), pFrm->MeasurementRequest[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_type, 1);
+                switch (pFrm->MeasurementRequest[i].measurement_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_duration, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_duration, 2);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_duration, 2);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.randomization, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_mode, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.BSSID, 6);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_MEASUREMENTREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackMeasurementRequest. */
+
+tANI_U32 dot11fPackNeighborReportRequest(tpAniSirGlobal pCtx, tDot11fNeighborReportRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_NeighborReportRequest, IES_NeighborReportRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Packed the NeighborReportRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNeighborReportRequest. */
+
+tANI_U32 dot11fPackNeighborReportResponse(tpAniSirGlobal pCtx, tDot11fNeighborReportResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_NeighborReportResponse, IES_NeighborReportResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Packed the NeighborReportResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_NeighborReport; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborReport[%d]:\n"), i);
+            if (!pFrm->NeighborReport[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].bssid, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("APReachability (2): %d\n"), pFrm->NeighborReport[i].APReachability);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Security (1): %d\n"), pFrm->NeighborReport[i].Security);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("KeyScope (1): %d\n"), pFrm->NeighborReport[i].KeyScope);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("SpecMgmtCap (1): %d\n"), pFrm->NeighborReport[i].SpecMgmtCap);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("QosCap (1): %d\n"), pFrm->NeighborReport[i].QosCap);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("apsd (1): %d\n"), pFrm->NeighborReport[i].apsd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("rrm (1): %d\n"), pFrm->NeighborReport[i].rrm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("DelayedBA (1): %d\n"), pFrm->NeighborReport[i].DelayedBA);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("ImmBA (1): %d\n"), pFrm->NeighborReport[i].ImmBA);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MobilityDomain (1): %d\n"), pFrm->NeighborReport[i].MobilityDomain);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("reserved (5): %d\n"), pFrm->NeighborReport[i].reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].reserved1, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].PhyType, 1);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("TSFInfo:\n"));
+                if (!pFrm->NeighborReport[i].TSFInfo.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].TSFInfo.TsfOffset, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].TSFInfo.BeaconIntvl, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("CondensedCountryStr:\n"));
+                if (!pFrm->NeighborReport[i].CondensedCountryStr.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].CondensedCountryStr.countryStr, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilot:\n"));
+                if (!pFrm->NeighborReport[i].MeasurementPilot.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].MeasurementPilot.measurementPilot, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("num_vendorSpecific: %d.\n"), pFrm->NeighborReport[i].MeasurementPilot.num_vendorSpecific);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* ) pFrm->NeighborReport[i].MeasurementPilot.vendorSpecific, pFrm->NeighborReport[i].MeasurementPilot.num_vendorSpecific);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RRMEnabledCap:\n"));
+                if (!pFrm->NeighborReport[i].RRMEnabledCap.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LinkMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NeighborRpt);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("parallel (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.parallel);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("repeated (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.repeated);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconPassive);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconActive);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconTable);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BeaconRepCond);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.FrameMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.ChannelLoad);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NoiseHistogram);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("statistics (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.statistics);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LCIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.LCIAzimuth);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.TCMCapability);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.triggeredTCM);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.APChanReport);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RRMMIBEnabled);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.operatingChanMax);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.nonOperatinChanMax);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.MeasurementPilot);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.MeasurementPilotEnabled);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.NeighborTSFOffset);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RCPIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.RSNIMeasurement);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BssAvgAccessDelay);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.BSSAvailAdmission);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.AntennaInformation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("reserved (6): %d\n"), pFrm->NeighborReport[i].RRMEnabledCap.reserved);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("MultiBssid:\n"));
+                if (!pFrm->NeighborReport[i].MultiBssid.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* )&pFrm->NeighborReport[i].MultiBssid.maxBSSIDIndicator, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("num_vendorSpecific: %d.\n"), pFrm->NeighborReport[i].MultiBssid.num_vendorSpecific);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), ( tANI_U8* ) pFrm->NeighborReport[i].MultiBssid.vendorSpecific, pFrm->NeighborReport[i].MultiBssid.num_vendorSpecific);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NEIGHBORREPORTRESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNeighborReportResponse. */
+
+tANI_U32 dot11fPackNoticeOfAbs(tpAniSirGlobal pCtx, tDot11fNoticeOfAbs *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_NoticeOfAbs, IES_NoticeOfAbs);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Packed the NoticeOfAbs:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("P2PNoticeOfAbsence:\n"));
+        if (!pFrm->P2PNoticeOfAbsence.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("num_NoADesc: %d.\n"), pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), ( tANI_U8* ) pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.NoADesc, pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_NOTICEOFABS), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackNoticeOfAbs. */
+
+tANI_U32 dot11fPackPresenceReq(tpAniSirGlobal pCtx, tDot11fPresenceReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_PresenceReq, IES_PresenceReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Packed the PresenceReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("P2PNoticeOfAbsence:\n"));
+        if (!pFrm->P2PNoticeOfAbsence.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* )&pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("num_NoADesc: %d.\n"), pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), ( tANI_U8* ) pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.NoADesc, pFrm->P2PNoticeOfAbsence.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCEREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackPresenceReq. */
+
+tANI_U32 dot11fPackPresenceRes(tpAniSirGlobal pCtx, tDot11fPresenceRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_PresenceRes, IES_PresenceRes);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Packed the PresenceRes:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2PPresenceResponse:\n"));
+        if (!pFrm->P2PPresenceResponse.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PPresenceResponse.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PPresenceResponse.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* )&pFrm->P2PPresenceResponse.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("num_NoADesc: %d.\n"), pFrm->P2PPresenceResponse.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), ( tANI_U8* ) pFrm->P2PPresenceResponse.NoticeOfAbsence.NoADesc, pFrm->P2PPresenceResponse.NoticeOfAbsence.num_NoADesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PRESENCERES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackPresenceRes. */
+
+tANI_U32 dot11fPackProbeRequest(tpAniSirGlobal pCtx, tDot11fProbeRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ProbeRequest, IES_ProbeRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Packed the ProbeRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestedInfo:\n"));
+        if (!pFrm->RequestedInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_requested_eids: %d.\n"), pFrm->RequestedInfo.num_requested_eids);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->RequestedInfo.requested_eids, pFrm->RequestedInfo.num_requested_eids);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("WscProbeReq:\n"));
+        if (!pFrm->WscProbeReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Version:\n"));
+            if (!pFrm->WscProbeReq.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("minor (4): %d\n"), pFrm->WscProbeReq.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("major (4): %d\n"), pFrm->WscProbeReq.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestType:\n"));
+            if (!pFrm->WscProbeReq.RequestType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestType.reqType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscProbeReq.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("UUID_E:\n"));
+            if (!pFrm->WscProbeReq.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscProbeReq.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RFBands:\n"));
+            if (!pFrm->WscProbeReq.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("AssociationState:\n"));
+            if (!pFrm->WscProbeReq.AssociationState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.AssociationState.state, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ConfigurationError:\n"));
+            if (!pFrm->WscProbeReq.ConfigurationError.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.ConfigurationError.error, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscProbeReq.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscProbeReq.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_name: %d.\n"), pFrm->WscProbeReq.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.Manufacturer.name, pFrm->WscProbeReq.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ModelName:\n"));
+            if (!pFrm->WscProbeReq.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.ModelName.text, pFrm->WscProbeReq.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscProbeReq.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.ModelNumber.text, pFrm->WscProbeReq.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("DeviceName:\n"));
+            if (!pFrm->WscProbeReq.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("num_text: %d.\n"), pFrm->WscProbeReq.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* ) pFrm->WscProbeReq.DeviceName.text, pFrm->WscProbeReq.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscProbeReq.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Version2:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("minor (4): %d\n"), pFrm->WscProbeReq.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("major (4): %d\n"), pFrm->WscProbeReq.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscProbeReq.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("RequestDeviceType:\n"));
+            if (!pFrm->WscProbeReq.RequestDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WscProbeReq.RequestDeviceType.sub_category, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("WFATPC:\n"));
+        if (!pFrm->WFATPC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WFATPC.txPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->WFATPC.linkMargin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PProbeReq:\n"));
+        if (!pFrm->P2PProbeReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProbeReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("P2PDeviceId:\n"));
+            if (!pFrm->P2PProbeReq.P2PDeviceId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.P2PDeviceId.P2PDeviceAddress, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ListenChannel:\n"));
+            if (!pFrm->P2PProbeReq.ListenChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ListenChannel.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PProbeReq.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("OperatingChannel:\n"));
+            if (!pFrm->P2PProbeReq.OperatingChannel.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.countryString, 3);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.regulatoryClass, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.channel, 1);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProbeRequest. */
+
+tANI_U32 dot11fPackProbeResponse(tpAniSirGlobal pCtx, tDot11fProbeResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ProbeResponse, IES_ProbeResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Packed the ProbeResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TimeStamp:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TimeStamp.timestamp, 8);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->BeaconInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHParamSet:\n"));
+        if (!pFrm->FHParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.dwell_time, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_set, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_pattern, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParamSet.hop_index, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DSParams:\n"));
+        if (!pFrm->DSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->DSParams.curr_channel, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CFParams:\n"));
+        if (!pFrm->CFParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_maxduration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CFParams.cfp_durremaining, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("IBSSParams:\n"));
+        if (!pFrm->IBSSParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->IBSSParams.atim, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Country:\n"));
+        if (!pFrm->Country.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Country.country, 3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_triplets: %d.\n"), pFrm->Country.num_triplets);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Country.triplets, 3 * pFrm->Country.num_triplets);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHParams:\n"));
+        if (!pFrm->FHParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParams.radix, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHParams.nchannels, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FHPattTable:\n"));
+        if (!pFrm->FHPattTable.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.flag, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.nsets, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.modulus, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->FHPattTable.offset, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_randtable: %d.\n"), pFrm->FHPattTable.num_randtable);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->FHPattTable.randtable, pFrm->FHPattTable.num_randtable);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PowerConstraints:\n"));
+        if (!pFrm->PowerConstraints.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->PowerConstraints.localPowerConstraints, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ChanSwitchAnn:\n"));
+        if (!pFrm->ChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchMode, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.newChannel, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ChanSwitchAnn.switchCount, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Quiet:\n"));
+        if (!pFrm->Quiet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.count, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.period, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.duration, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Quiet.offset, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ERPInfo:\n"));
+        if (!pFrm->ERPInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("non_erp_present (1): %d\n"), pFrm->ERPInfo.non_erp_present);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("use_prot (1): %d\n"), pFrm->ERPInfo.use_prot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("barker_preamble (1): %d\n"), pFrm->ERPInfo.barker_preamble);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused (5): %d\n"), pFrm->ERPInfo.unused);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RSN:\n"));
+        if (!pFrm->RSN.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.gp_cipher_suite, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.pwise_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.pwise_cipher_suites, 4 * pFrm->RSN.pwise_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.akm_suites, 4 * pFrm->RSN.akm_suite_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("preauth (1): %d\n"), pFrm->RSN.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("no_pwise (1): %d\n"), pFrm->RSN.no_pwise);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PTKSA_replay_counter (2): %d\n"), pFrm->RSN.PTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("GTKSA_replay_counter (2): %d\n"), pFrm->RSN.GTKSA_replay_counter);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (10): %d\n"), pFrm->RSN.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->RSN.pmkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->RSN.pmkid, 16 * pFrm->RSN.pmkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("QBSSLoad:\n"));
+        if (!pFrm->QBSSLoad.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.stacount, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.chautil, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->QBSSLoad.avail, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APChannelReport:\n"));
+        if (!pFrm->APChannelReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->APChannelReport.regulatoryClass, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_channelList: %d.\n"), pFrm->APChannelReport.num_channelList);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->APChannelReport.channelList, pFrm->APChannelReport.num_channelList);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtChanSwitchAnn:\n"));
+        if (!pFrm->ExtChanSwitchAnn.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->ExtChanSwitchAnn.secondaryChannelOffset, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMInfoAp:\n"));
+        if (!pFrm->WMMInfoAp.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMInfoAp.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("param_set_count (4): %d\n"), pFrm->WMMInfoAp.param_set_count);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (3): %d\n"), pFrm->WMMInfoAp.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("uapsd (1): %d\n"), pFrm->WMMInfoAp.uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WAPI:\n"));
+        if (!pFrm->WAPI.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.akm_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.akm_suites, 4 * pFrm->WAPI.akm_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.unicast_cipher_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.unicast_cipher_suites, 4 * pFrm->WAPI.unicast_cipher_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.multicast_cipher_suite, 4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("preauth (1): %d\n"), pFrm->WAPI.preauth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (15): %d\n"), pFrm->WAPI.reserved);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WAPI.bkid_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WAPI.bkid, 16 * pFrm->WAPI.bkid_count);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WscProbeRes:\n"));
+        if (!pFrm->WscProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscProbeRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("minor (4): %d\n"), pFrm->WscProbeRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("major (4): %d\n"), pFrm->WscProbeRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("WPSState:\n"));
+            if (!pFrm->WscProbeRes.WPSState.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.WPSState.state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("APSetupLocked:\n"));
+            if (!pFrm->WscProbeRes.APSetupLocked.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.APSetupLocked.fLocked, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SelectedRegistrar:\n"));
+            if (!pFrm->WscProbeRes.SelectedRegistrar.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.SelectedRegistrar.selected, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DevicePasswordID:\n"));
+            if (!pFrm->WscProbeRes.DevicePasswordID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.DevicePasswordID.id, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SelectedRegistrarConfigMethods:\n"));
+            if (!pFrm->WscProbeRes.SelectedRegistrarConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.SelectedRegistrarConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscProbeRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("UUID_E:\n"));
+            if (!pFrm->WscProbeRes.UUID_E.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.UUID_E.uuid, 16);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Manufacturer:\n"));
+            if (!pFrm->WscProbeRes.Manufacturer.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_name: %d.\n"), pFrm->WscProbeRes.Manufacturer.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.Manufacturer.name, pFrm->WscProbeRes.Manufacturer.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ModelName:\n"));
+            if (!pFrm->WscProbeRes.ModelName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.ModelName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.ModelName.text, pFrm->WscProbeRes.ModelName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ModelNumber:\n"));
+            if (!pFrm->WscProbeRes.ModelNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.ModelNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.ModelNumber.text, pFrm->WscProbeRes.ModelNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("SerialNumber:\n"));
+            if (!pFrm->WscProbeRes.SerialNumber.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.SerialNumber.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.SerialNumber.text, pFrm->WscProbeRes.SerialNumber.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("PrimaryDeviceType:\n"));
+            if (!pFrm->WscProbeRes.PrimaryDeviceType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.primary_category, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.oui, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.PrimaryDeviceType.sub_category, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DeviceName:\n"));
+            if (!pFrm->WscProbeRes.DeviceName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->WscProbeRes.DeviceName.num_text);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->WscProbeRes.DeviceName.text, pFrm->WscProbeRes.DeviceName.num_text);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ConfigMethods:\n"));
+            if (!pFrm->WscProbeRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.ConfigMethods.methods, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RFBands:\n"));
+            if (!pFrm->WscProbeRes.RFBands.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.RFBands.bands, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscProbeRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("minor (4): %d\n"), pFrm->WscProbeRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("major (4): %d\n"), pFrm->WscProbeRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscProbeRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->WscProbeRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PProbeRes:\n"));
+        if (!pFrm->P2PProbeRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProbeRes.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PProbeRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("NoticeOfAbsence:\n"));
+            if (!pFrm->P2PProbeRes.NoticeOfAbsence.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.NoticeOfAbsence.index, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.NoticeOfAbsence.CTSWindowOppPS, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_NoADesc: %d.\n"), pFrm->P2PProbeRes.NoticeOfAbsence.num_NoADesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.NoticeOfAbsence.NoADesc, pFrm->P2PProbeRes.NoticeOfAbsence.num_NoADesc);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PProbeRes.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->P2PProbeRes.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_text: %d.\n"), pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.text, pFrm->P2PProbeRes.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("P2PGroupInfo:\n"));
+            if (!pFrm->P2PProbeRes.P2PGroupInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("num_P2PClientInfoDesc: %d.\n"), pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProbeResponse. */
+
+tANI_U32 dot11fPackProvisionDiscoveryReq(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryReq *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ProvisionDiscoveryReq, IES_ProvisionDiscoveryReq);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Packed the ProvisionDiscoveryReq:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PProvisionDiscoveryReq:\n"));
+        if (!pFrm->P2PProvisionDiscoveryReq.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PCapability:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PCapability.deviceCapability, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PCapability.groupCapability, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PDeviceInfo:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.P2PDeviceAddress, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.configMethod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.primaryDeviceType, 8);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("DeviceName:\n"));
+                if (!pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("num_text: %d.\n"), pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.num_text);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* ) pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.text, pFrm->P2PProvisionDiscoveryReq.P2PDeviceInfo.DeviceName.num_text);
+                }
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("P2PGroupId:\n"));
+            if (!pFrm->P2PProvisionDiscoveryReq.P2PGroupId.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* )&pFrm->P2PProvisionDiscoveryReq.P2PGroupId.deviceAddress, 6);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("num_ssid: %d.\n"), pFrm->P2PProvisionDiscoveryReq.P2PGroupId.num_ssid);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), ( tANI_U8* ) pFrm->P2PProvisionDiscoveryReq.P2PGroupId.ssid, pFrm->P2PProvisionDiscoveryReq.P2PGroupId.num_ssid);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYREQ), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProvisionDiscoveryReq. */
+
+tANI_U32 dot11fPackProvisionDiscoveryRes(tpAniSirGlobal pCtx, tDot11fProvisionDiscoveryRes *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ProvisionDiscoveryRes, IES_ProvisionDiscoveryRes);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Packed the ProvisionDiscoveryRes:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2POUI:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2POUI.oui, 4);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2POUISubType:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2POUISubType.ouiSubtype, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("P2PWSCProvisionDiscoveryRes:\n"));
+        if (!pFrm->P2PWSCProvisionDiscoveryRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("ConfigMethods:\n"));
+            if (!pFrm->P2PWSCProvisionDiscoveryRes.ConfigMethods.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), ( tANI_U8* )&pFrm->P2PWSCProvisionDiscoveryRes.ConfigMethods.methods, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROVISIONDISCOVERYRES), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackProvisionDiscoveryRes. */
+
+tANI_U32 dot11fPackRadioMeasurementReport(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_RadioMeasurementReport, IES_RadioMeasurementReport);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Packed the RadioMeasurementReport:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        for (i = 0; i < pFrm->num_MeasurementReport; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("MeasurementReport[%d]:\n"), i);
+            if (!pFrm->MeasurementReport[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("late (1): %d\n"), pFrm->MeasurementReport[i].late);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("incapable (1): %d\n"), pFrm->MeasurementReport[i].incapable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("refused (1): %d\n"), pFrm->MeasurementReport[i].refused);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unused (5): %d\n"), pFrm->MeasurementReport[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].type, 1);
+                switch (pFrm->MeasurementReport[i].type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Basic.meas_duration, 2);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("bss (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.bss);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("ofdm_preamble (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.ofdm_preamble);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unid_signal (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.unid_signal);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("rader (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.rader);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unmeasured (1): %d\n"), pFrm->MeasurementReport[i].report.Basic.unmeasured);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("unused (3): %d\n"), pFrm->MeasurementReport[i].report.Basic.unused);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.CCA.cca_busy_fraction, 1);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi0_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi1_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi2_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi3_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi4_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi5_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi6_density, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.RPIHistogram.rpi7_density, 1);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.meas_duration, 2);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("condensed_PHY (7): %d\n"), pFrm->MeasurementReport[i].report.Beacon.condensed_PHY);
+                        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("reported_frame_type (1): %d\n"), pFrm->MeasurementReport[i].report.Beacon.reported_frame_type);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.RCPI, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.RSNI, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.BSSID, 6);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.antenna_id, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), ( tANI_U8* )&pFrm->MeasurementReport[i].report.Beacon.parent_TSF, 4);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREPORT), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackRadioMeasurementReport. */
+
+tANI_U32 dot11fPackRadioMeasurementRequest(tpAniSirGlobal pCtx, tDot11fRadioMeasurementRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_RadioMeasurementRequest, IES_RadioMeasurementRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Packed the RadioMeasurementRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("NumOfRepetitions:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->NumOfRepetitions.repetitions, 2);
+        for (i = 0; i < pFrm->num_MeasurementRequest; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("MeasurementRequest[%d]:\n"), i);
+            if (!pFrm->MeasurementRequest[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_token, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("parallel (1): %d\n"), pFrm->MeasurementRequest[i].parallel);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("enable (1): %d\n"), pFrm->MeasurementRequest[i].enable);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("request (1): %d\n"), pFrm->MeasurementRequest[i].request);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("report (1): %d\n"), pFrm->MeasurementRequest[i].report);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("durationMandatory (1): %d\n"), pFrm->MeasurementRequest[i].durationMandatory);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("unused (3): %d\n"), pFrm->MeasurementRequest[i].unused);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_type, 1);
+                switch (pFrm->MeasurementRequest[i].measurement_type)
+                {
+                    case 0:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Basic.meas_duration, 2);
+                    break;
+                    case 1:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.CCA.meas_duration, 2);
+                    break;
+                    case 2:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.channel_no, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_start_time, 8);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.RPIHistogram.meas_duration, 2);
+                    break;
+                    case 5:
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.regClass, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.channel, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.randomization, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_duration, 2);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.meas_mode, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), ( tANI_U8* )&pFrm->MeasurementRequest[i].measurement_request.Beacon.BSSID, 6);
+                    break;
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RADIOMEASUREMENTREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackRadioMeasurementRequest. */
+
+tANI_U32 dot11fPackReAssocRequest(tpAniSirGlobal pCtx, tDot11fReAssocRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ReAssocRequest, IES_ReAssocRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Packed the ReAssocRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ListenInterval:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->ListenInterval.interval, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CurrentAPAddress:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CurrentAPAddress.mac, 6);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SSID:\n"));
+        if (!pFrm->SSID.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_ssid: %d.\n"), pFrm->SSID.num_ssid);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SSID.ssid, pFrm->SSID.num_ssid);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PowerCaps:\n"));
+        if (!pFrm->PowerCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.minTxPower, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->PowerCaps.maxTxPower, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("SuppChannels:\n"));
+        if (!pFrm->SuppChannels.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_bands: %d.\n"), pFrm->SuppChannels.num_bands);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->SuppChannels.bands, 2 * pFrm->SuppChannels.num_bands);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("QOSCapsStation:\n"));
+        if (!pFrm->QOSCapsStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("more_data_ack (1): %d\n"), pFrm->QOSCapsStation.more_data_ack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->QOSCapsStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->QOSCapsStation.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->QOSCapsStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->QOSCapsStation.acvo_uapsd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WPAOpaque:\n"));
+        if (!pFrm->WPAOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WPAOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WPAOpaque.data, pFrm->WPAOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMCaps:\n"));
+        if (!pFrm->WMMCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMCaps.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (4): %d\n"), pFrm->WMMCaps.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("qack (1): %d\n"), pFrm->WMMCaps.qack);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("queue_request (1): %d\n"), pFrm->WMMCaps.queue_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txop_request (1): %d\n"), pFrm->WMMCaps.txop_request);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("more_ack (1): %d\n"), pFrm->WMMCaps.more_ack);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMInfoStation:\n"));
+        if (!pFrm->WMMInfoStation.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMInfoStation.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvo_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_uapsd (1): %d\n"), pFrm->WMMInfoStation.acvi_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbk_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_uapsd (1): %d\n"), pFrm->WMMInfoStation.acbe_uapsd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (1): %d\n"), pFrm->WMMInfoStation.reserved1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("max_sp_length (2): %d\n"), pFrm->WMMInfoStation.max_sp_length);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (1): %d\n"), pFrm->WMMInfoStation.reserved2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WscIEOpaque:\n"));
+        if (!pFrm->WscIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WscIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WscIEOpaque.data, pFrm->WscIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WAPIOpaque:\n"));
+        if (!pFrm->WAPIOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WAPIOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WAPIOpaque.data, pFrm->WAPIOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXVersion:\n"));
+        if (!pFrm->CCXVersion.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXVersion.version, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXCckmOpaque:\n"));
+        if (!pFrm->CCXCckmOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->CCXCckmOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->CCXCckmOpaque.data, pFrm->CCXCckmOpaque.num_data);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("P2PIEOpaque:\n"));
+        if (!pFrm->P2PIEOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackReAssocRequest. */
+
+tANI_U32 dot11fPackReAssocResponse(tpAniSirGlobal pCtx, tDot11fReAssocResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_ReAssocResponse, IES_ReAssocResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Packed the ReAssocResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Capabilities:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ess (1): %d\n"), pFrm->Capabilities.ess);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ibss (1): %d\n"), pFrm->Capabilities.ibss);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("cfPollable (1): %d\n"), pFrm->Capabilities.cfPollable);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("cfPollReq (1): %d\n"), pFrm->Capabilities.cfPollReq);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("privacy (1): %d\n"), pFrm->Capabilities.privacy);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortPreamble (1): %d\n"), pFrm->Capabilities.shortPreamble);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pbcc (1): %d\n"), pFrm->Capabilities.pbcc);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("channelAgility (1): %d\n"), pFrm->Capabilities.channelAgility);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("spectrumMgt (1): %d\n"), pFrm->Capabilities.spectrumMgt);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("qos (1): %d\n"), pFrm->Capabilities.qos);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortSlotTime (1): %d\n"), pFrm->Capabilities.shortSlotTime);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("apsd (1): %d\n"), pFrm->Capabilities.apsd);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rrm (1): %d\n"), pFrm->Capabilities.rrm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dsssOfdm (1): %d\n"), pFrm->Capabilities.dsssOfdm);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->Capabilities.delayedBA);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("immediateBA (1): %d\n"), pFrm->Capabilities.immediateBA);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Status:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Status.status, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AID:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->AID.associd, 2);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("SuppRates:\n"));
+        if (!pFrm->SuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->SuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->SuppRates.rates, pFrm->SuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ExtSuppRates:\n"));
+        if (!pFrm->ExtSuppRates.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->ExtSuppRates.num_rates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->ExtSuppRates.rates, pFrm->ExtSuppRates.num_rates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("EDCAParamSet:\n"));
+        if (!pFrm->EDCAParamSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.qos, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.reserved, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->EDCAParamSet.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->EDCAParamSet.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->EDCAParamSet.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->EDCAParamSet.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->EDCAParamSet.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->EDCAParamSet.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->EDCAParamSet.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->EDCAParamSet.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->EDCAParamSet.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->EDCAParamSet.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->EDCAParamSet.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->EDCAParamSet.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->EDCAParamSet.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->EDCAParamSet.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->EDCAParamSet.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->EDCAParamSet.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->EDCAParamSet.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RCPIIE:\n"));
+        if (!pFrm->RCPIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RCPIIE.rcpi, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNIIE:\n"));
+        if (!pFrm->RSNIIE.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RSNIIE.rsni, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RRMEnabledCap:\n"));
+        if (!pFrm->RRMEnabledCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LinkMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LinkMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NeighborRpt (1): %d\n"), pFrm->RRMEnabledCap.NeighborRpt);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("parallel (1): %d\n"), pFrm->RRMEnabledCap.parallel);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("repeated (1): %d\n"), pFrm->RRMEnabledCap.repeated);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconPassive (1): %d\n"), pFrm->RRMEnabledCap.BeaconPassive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconActive (1): %d\n"), pFrm->RRMEnabledCap.BeaconActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconTable (1): %d\n"), pFrm->RRMEnabledCap.BeaconTable);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BeaconRepCond (1): %d\n"), pFrm->RRMEnabledCap.BeaconRepCond);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("FrameMeasurement (1): %d\n"), pFrm->RRMEnabledCap.FrameMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ChannelLoad (1): %d\n"), pFrm->RRMEnabledCap.ChannelLoad);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NoiseHistogram (1): %d\n"), pFrm->RRMEnabledCap.NoiseHistogram);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("statistics (1): %d\n"), pFrm->RRMEnabledCap.statistics);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LCIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.LCIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LCIAzimuth (1): %d\n"), pFrm->RRMEnabledCap.LCIAzimuth);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCMCapability (1): %d\n"), pFrm->RRMEnabledCap.TCMCapability);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("triggeredTCM (1): %d\n"), pFrm->RRMEnabledCap.triggeredTCM);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("APChanReport (1): %d\n"), pFrm->RRMEnabledCap.APChanReport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RRMMIBEnabled (1): %d\n"), pFrm->RRMEnabledCap.RRMMIBEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("operatingChanMax (3): %d\n"), pFrm->RRMEnabledCap.operatingChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("nonOperatinChanMax (3): %d\n"), pFrm->RRMEnabledCap.nonOperatinChanMax);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MeasurementPilot (3): %d\n"), pFrm->RRMEnabledCap.MeasurementPilot);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MeasurementPilotEnabled (1): %d\n"), pFrm->RRMEnabledCap.MeasurementPilotEnabled);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("NeighborTSFOffset (1): %d\n"), pFrm->RRMEnabledCap.NeighborTSFOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RCPIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RCPIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNIMeasurement (1): %d\n"), pFrm->RRMEnabledCap.RSNIMeasurement);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BssAvgAccessDelay (1): %d\n"), pFrm->RRMEnabledCap.BssAvgAccessDelay);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BSSAvailAdmission (1): %d\n"), pFrm->RRMEnabledCap.BSSAvailAdmission);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AntennaInformation (1): %d\n"), pFrm->RRMEnabledCap.AntennaInformation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->RRMEnabledCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RSNOpaque:\n"));
+        if (!pFrm->RSNOpaque.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_data: %d.\n"), pFrm->RSNOpaque.num_data);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->RSNOpaque.data, pFrm->RSNOpaque.num_data);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("MobilityDomain:\n"));
+        if (!pFrm->MobilityDomain.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->MobilityDomain.MDID, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("overDSCap (1): %d\n"), pFrm->MobilityDomain.overDSCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("resourceReqCap (1): %d\n"), pFrm->MobilityDomain.resourceReqCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (6): %d\n"), pFrm->MobilityDomain.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("FTInfo:\n"));
+        if (!pFrm->FTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (8): %d\n"), pFrm->FTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("IECount (8): %d\n"), pFrm->FTInfo.IECount);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.MIC, 16);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Anonce, 32);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.Snonce, 32);
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("R1KH_ID:\n"));
+            if (!pFrm->FTInfo.R1KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.R1KH_ID.PMK_R1_ID, 6);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("GTK:\n"));
+            if (!pFrm->FTInfo.GTK.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("keyId (2): %d\n"), pFrm->FTInfo.GTK.keyId);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (14): %d\n"), pFrm->FTInfo.GTK.reserved);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.keyLength, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->FTInfo.GTK.RSC, 8);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_key: %d.\n"), pFrm->FTInfo.GTK.num_key);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.GTK.key, pFrm->FTInfo.GTK.num_key);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("R0KH_ID:\n"));
+            if (!pFrm->FTInfo.R0KH_ID.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_PMK_R0_ID: %d.\n"), pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->FTInfo.R0KH_ID.PMK_R0_ID, pFrm->FTInfo.R0KH_ID.num_PMK_R0_ID);
+            }
+        }
+        for (i = 0; i < pFrm->num_RICDataDesc; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICDataDesc[%d]:\n"), i);
+            if (!pFrm->RICDataDesc[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICData:\n"));
+                if (!pFrm->RICDataDesc[i].RICData.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.Identifier, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.resourceDescCount, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICData.statusCode, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RICDescriptor:\n"));
+                if (!pFrm->RICDataDesc[i].RICDescriptor.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].RICDescriptor.resourceType, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_variableData: %d.\n"), pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->RICDataDesc[i].RICDescriptor.variableData, pFrm->RICDataDesc[i].RICDescriptor.num_variableData);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].TSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].TSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].TSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("schedule (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.schedule);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused (7): %d\n"), pFrm->RICDataDesc[i].TSPEC.unused);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].TSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].TSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_TCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].TCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].TCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TCLASSPROC:\n"));
+                if (!pFrm->RICDataDesc[i].TCLASSPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TCLASSPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].TSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].TSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Schedule:\n"));
+                if (!pFrm->RICDataDesc[i].Schedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].Schedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].Schedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].Schedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].Schedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].Schedule.spec_interval, 2);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSPEC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSPEC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.traffic_type);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.access_policy);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.psb);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.user_priority);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_ack_pol);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.tsinfo_rsvd);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.burst_size_defn);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.size);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->RICDataDesc[i].WMMTSPEC.fixed);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_msdu_size, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.max_service_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.inactivity_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.suspension_int, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.mean_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.peak_data_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.burst_size, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.delay_bound, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.min_phy_rate, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.surplus_bw_allowance, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSPEC.medium_time, 2);
+                }
+                for (i = 0; i < pFrm->RICDataDesc[i].num_WMMTCLAS; ++i)
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTCLAS[%d]:\n"), i);
+                    if (!pFrm->RICDataDesc[i].WMMTCLAS[i].present)
+                    {
+                        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                    }
+                    else
+                    {
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].version, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].user_priority, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type, 1);
+                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_mask, 1);
+                        switch (pFrm->RICDataDesc[i].WMMTCLAS[i].classifier_type)
+                        {
+                            case 0:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.source, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.dest, 6);
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.EthParams.type, 2);
+                            break;
+                            case 1:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version, 1);
+                                switch (pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.version)
+                                {
+                                    case 4:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.source, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest, 4);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.DSCP, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.proto, 1);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV4Params.reserved, 1);
+                                    break;
+                                    case 6:
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.source, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest, 16);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.src_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.dest_port, 2);
+                                        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.IpParams.params.IpV6Params.flow_label, 3);
+                                    break;
+                                }
+                            break;
+                            case 2:
+                                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLAS[i].info.Params8021dq.tag_type, 2);
+                            break;
+                        }
+                    }
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTCLASPROC:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTCLASPROC.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTCLASPROC.processing, 1);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSDelay:\n"));
+                if (!pFrm->RICDataDesc[i].WMMTSDelay.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.version, 1);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMTSDelay.delay, 4);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMSchedule:\n"));
+                if (!pFrm->RICDataDesc[i].WMMSchedule.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.version, 1);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.aggregation);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.tsid);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.direction);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (9): %d\n"), pFrm->RICDataDesc[i].WMMSchedule.reserved);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_start_time, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.service_interval, 4);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.max_service_dur, 2);
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->RICDataDesc[i].WMMSchedule.spec_interval, 2);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WPA:\n"));
+        if (!pFrm->WPA.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.version, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.multicast_cipher, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.unicast_cipher_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.unicast_ciphers, 4 * pFrm->WPA.unicast_cipher_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.auth_suite_count, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->WPA.auth_suites, 4 * pFrm->WPA.auth_suite_count);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WPA.caps, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HTCaps:\n"));
+        if (!pFrm->HTCaps.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("advCodingCap (1): %d\n"), pFrm->HTCaps.advCodingCap);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("supportedChannelWidthSet (1): %d\n"), pFrm->HTCaps.supportedChannelWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mimoPowerSave (2): %d\n"), pFrm->HTCaps.mimoPowerSave);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("greenField (1): %d\n"), pFrm->HTCaps.greenField);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI20MHz (1): %d\n"), pFrm->HTCaps.shortGI20MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI40MHz (1): %d\n"), pFrm->HTCaps.shortGI40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->HTCaps.txSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxSTBC (2): %d\n"), pFrm->HTCaps.rxSTBC);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("delayedBA (1): %d\n"), pFrm->HTCaps.delayedBA);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maximalAMSDUsize (1): %d\n"), pFrm->HTCaps.maximalAMSDUsize);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dsssCckMode40MHz (1): %d\n"), pFrm->HTCaps.dsssCckMode40MHz);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psmp (1): %d\n"), pFrm->HTCaps.psmp);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("stbcControlFrame (1): %d\n"), pFrm->HTCaps.stbcControlFrame);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("lsigTXOPProtection (1): %d\n"), pFrm->HTCaps.lsigTXOPProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxRxAMPDUFactor (2): %d\n"), pFrm->HTCaps.maxRxAMPDUFactor);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mpduDensity (3): %d\n"), pFrm->HTCaps.mpduDensity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved1 (3): %d\n"), pFrm->HTCaps.reserved1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTCaps.supportedMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pco (1): %d\n"), pFrm->HTCaps.pco);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("transitionTime (2): %d\n"), pFrm->HTCaps.transitionTime);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (5): %d\n"), pFrm->HTCaps.reserved2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mcsFeedback (2): %d\n"), pFrm->HTCaps.mcsFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved3 (6): %d\n"), pFrm->HTCaps.reserved3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txBF (1): %d\n"), pFrm->HTCaps.txBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxStaggeredSounding (1): %d\n"), pFrm->HTCaps.rxStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txStaggeredSounding (1): %d\n"), pFrm->HTCaps.txStaggeredSounding);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxZLF (1): %d\n"), pFrm->HTCaps.rxZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txZLF (1): %d\n"), pFrm->HTCaps.txZLF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("implicitTxBF (1): %d\n"), pFrm->HTCaps.implicitTxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("calibration (2): %d\n"), pFrm->HTCaps.calibration);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSITxBF (1): %d\n"), pFrm->HTCaps.explicitCSITxBF);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrix (1): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrix);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitBFCSIFeedback (3): %d\n"), pFrm->HTCaps.explicitBFCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitUncompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitUncompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCompressedSteeringMatrixFeedback (3): %d\n"), pFrm->HTCaps.explicitCompressedSteeringMatrixFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("csiNumBFAntennae (2): %d\n"), pFrm->HTCaps.csiNumBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("uncompressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.uncompressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("compressedSteeringMatrixBFAntennae (2): %d\n"), pFrm->HTCaps.compressedSteeringMatrixBFAntennae);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved4 (7): %d\n"), pFrm->HTCaps.reserved4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaSelection (1): %d\n"), pFrm->HTCaps.antennaSelection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSIFeedbackTx (1): %d\n"), pFrm->HTCaps.explicitCSIFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaIndicesFeedbackTx (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedbackTx);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("explicitCSIFeedback (1): %d\n"), pFrm->HTCaps.explicitCSIFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("antennaIndicesFeedback (1): %d\n"), pFrm->HTCaps.antennaIndicesFeedback);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxAS (1): %d\n"), pFrm->HTCaps.rxAS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSoundingPPDUs (1): %d\n"), pFrm->HTCaps.txSoundingPPDUs);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved5 (1): %d\n"), pFrm->HTCaps.reserved5);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTCaps.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->HTCaps.rsvd, pFrm->HTCaps.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HTInfo:\n"));
+        if (!pFrm->HTInfo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.primaryChannel, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("secondaryChannelOffset (2): %d\n"), pFrm->HTInfo.secondaryChannelOffset);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("recommendedTxWidthSet (1): %d\n"), pFrm->HTInfo.recommendedTxWidthSet);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rifsMode (1): %d\n"), pFrm->HTInfo.rifsMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("controlledAccessOnly (1): %d\n"), pFrm->HTInfo.controlledAccessOnly);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("serviceIntervalGranularity (3): %d\n"), pFrm->HTInfo.serviceIntervalGranularity);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("opMode (2): %d\n"), pFrm->HTInfo.opMode);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("nonGFDevicesPresent (1): %d\n"), pFrm->HTInfo.nonGFDevicesPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("transmitBurstLimit (1): %d\n"), pFrm->HTInfo.transmitBurstLimit);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("obssNonHTStaPresent (1): %d\n"), pFrm->HTInfo.obssNonHTStaPresent);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (11): %d\n"), pFrm->HTInfo.reserved);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("basicSTBCMCS (7): %d\n"), pFrm->HTInfo.basicSTBCMCS);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("dualCTSProtection (1): %d\n"), pFrm->HTInfo.dualCTSProtection);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("secondaryBeacon (1): %d\n"), pFrm->HTInfo.secondaryBeacon);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("lsigTXOPProtectionFullSupport (1): %d\n"), pFrm->HTInfo.lsigTXOPProtectionFullSupport);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pcoActive (1): %d\n"), pFrm->HTInfo.pcoActive);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("pcoPhase (1): %d\n"), pFrm->HTInfo.pcoPhase);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (4): %d\n"), pFrm->HTInfo.reserved2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->HTInfo.basicMCSSet, 16);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rsvd: %d.\n"), pFrm->HTInfo.num_rsvd);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->HTInfo.rsvd, pFrm->HTInfo.num_rsvd);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMParams:\n"));
+        if (!pFrm->WMMParams.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.version, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.qosInfo, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.reserved2, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->WMMParams.acbe_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->WMMParams.acbe_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->WMMParams.acbe_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->WMMParams.unused1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmin (4): %d\n"), pFrm->WMMParams.acbe_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acwmax (4): %d\n"), pFrm->WMMParams.acbe_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbe_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->WMMParams.acbk_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->WMMParams.acbk_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->WMMParams.acbk_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->WMMParams.unused2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmin (4): %d\n"), pFrm->WMMParams.acbk_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acwmax (4): %d\n"), pFrm->WMMParams.acbk_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acbk_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->WMMParams.acvi_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->WMMParams.acvi_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->WMMParams.acvi_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->WMMParams.unused3);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmin (4): %d\n"), pFrm->WMMParams.acvi_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acwmax (4): %d\n"), pFrm->WMMParams.acvi_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvi_txoplimit, 2);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->WMMParams.acvo_aifsn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->WMMParams.acvo_acm);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->WMMParams.acvo_aci);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->WMMParams.unused4);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmin (4): %d\n"), pFrm->WMMParams.acvo_acwmin);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acwmax (4): %d\n"), pFrm->WMMParams.acvo_acwmax);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMParams.acvo_txoplimit, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXRadMgmtCap:\n"));
+        if (!pFrm->CCXRadMgmtCap.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXRadMgmtCap.mgmt_state, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("mbssid_mask (3): %d\n"), pFrm->CCXRadMgmtCap.mbssid_mask);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved (5): %d\n"), pFrm->CCXRadMgmtCap.reserved);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTxmitPower:\n"));
+        if (!pFrm->CCXTxmitPower.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.power_limit, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTxmitPower.reserved, 1);
+        }
+        for (i = 0; i < pFrm->num_WMMTSPEC; ++i)
+        {
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WMMTSPEC[%d]:\n"), i);
+            if (!pFrm->WMMTSPEC[i].present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].version, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC[i].traffic_type);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC[i].tsid);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC[i].direction);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC[i].access_policy);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC[i].aggregation);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC[i].psb);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC[i].user_priority);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC[i].tsinfo_ack_pol);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC[i].tsinfo_rsvd);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC[i].burst_size_defn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC[i].size);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC[i].fixed);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_msdu_size, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].max_service_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].inactivity_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].suspension_int, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].service_start_time, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].mean_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].peak_data_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].burst_size, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].delay_bound, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].min_phy_rate, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].surplus_bw_allowance, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC[i].medium_time, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Airgo:\n"));
+        if (!pFrm->Airgo.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropSuppRates:\n"));
+            if (!pFrm->Airgo.PropSuppRates.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_rates: %d.\n"), pFrm->Airgo.PropSuppRates.num_rates);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.PropSuppRates.rates, pFrm->Airgo.PropSuppRates.num_rates);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("APName:\n"));
+            if (!pFrm->Airgo.APName.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_name: %d.\n"), pFrm->Airgo.APName.num_name);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.APName.name, pFrm->Airgo.APName.num_name);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("HCF:\n"));
+            if (!pFrm->Airgo.HCF.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.HCF.enabled, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WDS:\n"));
+            if (!pFrm->Airgo.WDS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_wdsData: %d.\n"), pFrm->Airgo.WDS.num_wdsData);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.WDS.wdsData, pFrm->Airgo.WDS.num_wdsData);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("BPIndicator:\n"));
+            if (!pFrm->Airgo.BPIndicator.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.indicator, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.BPIndicator.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LoadInfo:\n"));
+            if (!pFrm->Airgo.LoadInfo.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.num_stas, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadInfo.channel_util, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LoadBalance:\n"));
+            if (!pFrm->Airgo.LoadBalance.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.bssid, 6);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LoadBalance.channel, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropAssocType:\n"));
+            if (!pFrm->Airgo.PropAssocType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropAssocType.type, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("LLAttr:\n"));
+            if (!pFrm->Airgo.LLAttr.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.LLAttr.defer_threshold, 4);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropCapability:\n"));
+            if (!pFrm->Airgo.PropCapability.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropCapability.capability, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->Airgo.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.chip_rev, 4);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Version.card_type, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("num_build_version: %d.\n"), pFrm->Airgo.Version.num_build_version);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* ) pFrm->Airgo.Version.build_version, pFrm->Airgo.Version.num_build_version);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropEDCAParams:\n"));
+            if (!pFrm->Airgo.PropEDCAParams.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.qos, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.reserved, 1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused1 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused1);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbe_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbe_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbe_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused2 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acbk_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acbk_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acbk_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused3 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused3);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvi_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvi_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvi_txoplimit, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aifsn (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aifsn);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_acm (1): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_acm);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_aci (2): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_aci);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("unused4 (1): %d\n"), pFrm->Airgo.PropEDCAParams.unused4);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_min (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_min);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("acvo_max (4): %d\n"), pFrm->Airgo.PropEDCAParams.acvo_max);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropEDCAParams.acvo_txoplimit, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Titan:\n"));
+            if (!pFrm->Airgo.Titan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.concat_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.compression_tcid_bitmap, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.cb_state, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Titan.rev_fcs_state, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropChannSwitchAnn:\n"));
+            if (!pFrm->Airgo.PropChannSwitchAnn.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.mode, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.primary_channel, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.sub_band, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropChannSwitchAnn.channel_switch_count, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("PropQuietBSS:\n"));
+            if (!pFrm->Airgo.PropQuietBSS.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_count, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_period, 1);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_duration, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.PropQuietBSS.quiet_offset, 2);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("TriggerStaBgScan:\n"));
+            if (!pFrm->Airgo.TriggerStaBgScan.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.TriggerStaBgScan.enable, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Taurus:\n"));
+            if (!pFrm->Airgo.Taurus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baTIDBitmap, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->Airgo.Taurus.baPolicy, 2);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("baBufferSize (12): %d\n"), pFrm->Airgo.Taurus.baBufferSize);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rsvd (4): %d\n"), pFrm->Airgo.Taurus.rsvd);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("WscReassocRes:\n"));
+        if (!pFrm->WscReassocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version:\n"));
+            if (!pFrm->WscReassocRes.Version.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscReassocRes.Version.minor);
+                FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscReassocRes.Version.major);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ResponseType:\n"));
+            if (!pFrm->WscReassocRes.ResponseType.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.ResponseType.resType, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VendorExtension:\n"));
+            if (!pFrm->WscReassocRes.VendorExtension.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.vendorId, 3);
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Version2:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.Version2.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("minor (4): %d\n"), pFrm->WscReassocRes.VendorExtension.Version2.minor);
+                    FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("major (4): %d\n"), pFrm->WscReassocRes.VendorExtension.Version2.major);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("AuthorizedMACs:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.AuthorizedMACs.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.AuthorizedMACs.mac, 6);
+                }
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("RequestToEnroll:\n"));
+                if (!pFrm->WscReassocRes.VendorExtension.RequestToEnroll.present)
+                {
+                    FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+                }
+                else
+                {
+                    FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->WscReassocRes.VendorExtension.RequestToEnroll.req, 1);
+                }
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("P2PAssocRes:\n"));
+        if (!pFrm->P2PAssocRes.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("P2PStatus:\n"));
+            if (!pFrm->P2PAssocRes.P2PStatus.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.P2PStatus.status, 1);
+            }
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ExtendedListenTiming:\n"));
+            if (!pFrm->P2PAssocRes.ExtendedListenTiming.present)
+            {
+                FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
+            }
+            else
+            {
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityPeriod, 2);
+                FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
+            }
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackReAssocResponse. */
+
+tANI_U32 dot11fPackSMPowerSave(tpAniSirGlobal pCtx, tDot11fSMPowerSave *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_SMPowerSave, IES_SMPowerSave);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Packed the SMPowerSave:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("SMPowerModeSet:\n"));
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("PowerSave_En (1): %d\n"), pFrm->SMPowerModeSet.PowerSave_En);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("Mode (1): %d\n"), pFrm->SMPowerModeSet.Mode);
+        FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("reserved (6): %d\n"), pFrm->SMPowerModeSet.reserved);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_SMPOWERSAVE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackSMPowerSave. */
+
+tANI_U32 dot11fPackTPCReport(tpAniSirGlobal pCtx, tDot11fTPCReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_TPCReport, IES_TPCReport);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Packed the TPCReport:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("TPCReport:\n"));
+        if (!pFrm->TPCReport.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->TPCReport.tx_power, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), ( tANI_U8* )&pFrm->TPCReport.link_margin, 1);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREPORT), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackTPCReport. */
+
+tANI_U32 dot11fPackTPCRequest(tpAniSirGlobal pCtx, tDot11fTPCRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_TPCRequest, IES_TPCRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Packed the TPCRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("TPCRequest:\n"));
+        if (!pFrm->TPCRequest.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_TPCREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackTPCRequest. */
+
+tANI_U32 dot11fPackWMMAddTSRequest(tpAniSirGlobal pCtx, tDot11fWMMAddTSRequest *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_WMMAddTSRequest, IES_WMMAddTSRequest);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Packed the WMMAddTSRequest:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("CCXTrafStrmRateSet:\n"));
+        if (!pFrm->CCXTrafStrmRateSet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* )&pFrm->CCXTrafStrmRateSet.tsid, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("num_tsrates: %d.\n"), pFrm->CCXTrafStrmRateSet.num_tsrates);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), ( tANI_U8* ) pFrm->CCXTrafStrmRateSet.tsrates, pFrm->CCXTrafStrmRateSet.num_tsrates);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSREQUEST), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMAddTSRequest. */
+
+tANI_U32 dot11fPackWMMAddTSResponse(tpAniSirGlobal pCtx, tDot11fWMMAddTSResponse *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_WMMAddTSResponse, IES_WMMAddTSResponse);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Packed the WMMAddTSResponse:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("CCXTrafStrmMet:\n"));
+        if (!pFrm->CCXTrafStrmMet.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.tsid, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.state, 1);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), ( tANI_U8* )&pFrm->CCXTrafStrmMet.msmt_interval, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMADDTSRESPONSE), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMAddTSResponse. */
+
+tANI_U32 dot11fPackWMMDelTS(tpAniSirGlobal pCtx, tDot11fWMMDelTS *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
+{
+    tANI_U32 i = 0;
+    tANI_U32 status = 0;
+    (void)i;
+    *pnConsumed = 0U;
+    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_WMMDelTS, IES_WMMDelTS);
+
+#   ifdef DOT11F_DUMP_FRAMES
+    if (!DOT11F_FAILED(status))
+    {
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Packed the WMMDelTS:\n"));
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Category:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->Category.category, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Action:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->Action.action, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("DialogToken:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->DialogToken.token, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("StatusCode:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->StatusCode.statusCode, 1);
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("WMMTSPEC:\n"));
+        if (!pFrm->WMMTSPEC.present)
+        {
+            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("Not present.\n"));
+        }
+        else
+        {
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.version, 1);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("traffic_type (1): %d\n"), pFrm->WMMTSPEC.traffic_type);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsid (4): %d\n"), pFrm->WMMTSPEC.tsid);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("direction (2): %d\n"), pFrm->WMMTSPEC.direction);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("access_policy (2): %d\n"), pFrm->WMMTSPEC.access_policy);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("aggregation (1): %d\n"), pFrm->WMMTSPEC.aggregation);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("psb (1): %d\n"), pFrm->WMMTSPEC.psb);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("user_priority (3): %d\n"), pFrm->WMMTSPEC.user_priority);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsinfo_ack_pol (2): %d\n"), pFrm->WMMTSPEC.tsinfo_ack_pol);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("tsinfo_rsvd (7): %d\n"), pFrm->WMMTSPEC.tsinfo_rsvd);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("burst_size_defn (1): %d\n"), pFrm->WMMTSPEC.burst_size_defn);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("size (15): %d\n"), pFrm->WMMTSPEC.size);
+            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("fixed (1): %d\n"), pFrm->WMMTSPEC.fixed);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.max_msdu_size, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.max_service_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.inactivity_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.suspension_int, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.service_start_time, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.mean_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.peak_data_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.burst_size, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.delay_bound, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.min_phy_rate, 4);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.surplus_bw_allowance, 2);
+            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), ( tANI_U8* )&pFrm->WMMTSPEC.medium_time, 2);
+        }
+        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), FRFL("to:\n"));
+        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_WMMDELTS), pBuf, nBuf);
+    }
+#   endif // DOT11F_DUMP_FRAMES
+    return status;
+
+} /* End dot11fUnpackWMMDelTS. */
+
+static tANI_U32 PackCore(tpAniSirGlobal pCtx,
+                             tANI_U8 *pSrc,
+                             tANI_U8 *pBuf,
+                             tANI_U32  nBuf,
+                             tANI_U32 *pnConsumed,
+                             const tFFDefn  FFs[],
+                             const tIEDefn  IEs[])
+{
+    const tFFDefn *pFf;
+    const tIEDefn *pIe;
+    tFRAMES_BOOL  *pfFound;
+    tANI_U8   *pBufRemaining;
+    tANI_U16  i;
+    tANI_U32  nBufRemaining, status, len;
+    tANI_U32  countOffset = 0;
+
+    (void)pCtx; /* Shutup the compiler if we have no FFs nor IEs... */
+    i=0;
+
+    DOT11F_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed);
+
+    status = DOT11F_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+
+    pFf = &( FFs[0] );
+    while ( pFf->size )
+    {
+        if ( pFf->size > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGE, FRFL("The Fixed Field %s req"
+                "uires %d bytes, but there are only %d remaining.\n"),
+                pFf->name, pFf->size, nBufRemaining);
+            return DOT11F_BUFFER_OVERFLOW;
+        }
+
+        switch ( pFf->sig )
+        {
+            case SigFfAID:
+                dot11fPackFfAID(pCtx, (tDot11fFfAID* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfAction:
+                dot11fPackFfAction(pCtx, (tDot11fFfAction* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfAddBAParameterSet:
+                dot11fPackFfAddBAParameterSet(pCtx, (tDot11fFfAddBAParameterSet* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfAuthAlgo:
+                dot11fPackFfAuthAlgo(pCtx, (tDot11fFfAuthAlgo* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfAuthSeqNo:
+                dot11fPackFfAuthSeqNo(pCtx, (tDot11fFfAuthSeqNo* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfBAStartingSequenceControl:
+                dot11fPackFfBAStartingSequenceControl(pCtx, (tDot11fFfBAStartingSequenceControl* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfBATimeout:
+                dot11fPackFfBATimeout(pCtx, (tDot11fFfBATimeout* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfBeaconInterval:
+                dot11fPackFfBeaconInterval(pCtx, (tDot11fFfBeaconInterval* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfCapabilities:
+                dot11fPackFfCapabilities(pCtx, (tDot11fFfCapabilities* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfCategory:
+                dot11fPackFfCategory(pCtx, (tDot11fFfCategory* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfCurrentAPAddress:
+                dot11fPackFfCurrentAPAddress(pCtx, (tDot11fFfCurrentAPAddress* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfDelBAParameterSet:
+                dot11fPackFfDelBAParameterSet(pCtx, (tDot11fFfDelBAParameterSet* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfDialogToken:
+                dot11fPackFfDialogToken(pCtx, (tDot11fFfDialogToken* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfLinkMargin:
+                dot11fPackFfLinkMargin(pCtx, (tDot11fFfLinkMargin* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfListenInterval:
+                dot11fPackFfListenInterval(pCtx, (tDot11fFfListenInterval* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfMaxTxPower:
+                dot11fPackFfMaxTxPower(pCtx, (tDot11fFfMaxTxPower* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfNumOfRepetitions:
+                dot11fPackFfNumOfRepetitions(pCtx, (tDot11fFfNumOfRepetitions* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfP2POUI:
+                dot11fPackFfP2POUI(pCtx, (tDot11fFfP2POUI* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfP2POUISubType:
+                dot11fPackFfP2POUISubType(pCtx, (tDot11fFfP2POUISubType* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfRCPI:
+                dot11fPackFfRCPI(pCtx, (tDot11fFfRCPI* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfRSNI:
+                dot11fPackFfRSNI(pCtx, (tDot11fFfRSNI* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfReason:
+                dot11fPackFfReason(pCtx, (tDot11fFfReason* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfRxAntennaId:
+                dot11fPackFfRxAntennaId(pCtx, (tDot11fFfRxAntennaId* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfSMPowerModeSet:
+                dot11fPackFfSMPowerModeSet(pCtx, (tDot11fFfSMPowerModeSet* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfStatus:
+                dot11fPackFfStatus(pCtx, (tDot11fFfStatus* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfStatusCode:
+                dot11fPackFfStatusCode(pCtx, (tDot11fFfStatusCode* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTPCEleID:
+                dot11fPackFfTPCEleID(pCtx, (tDot11fFfTPCEleID* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTPCEleLen:
+                dot11fPackFfTPCEleLen(pCtx, (tDot11fFfTPCEleLen* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTSInfo:
+                dot11fPackFfTSInfo(pCtx, (tDot11fFfTSInfo* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTimeStamp:
+                dot11fPackFfTimeStamp(pCtx, (tDot11fFfTimeStamp* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTxAntennaId:
+                dot11fPackFfTxAntennaId(pCtx, (tDot11fFfTxAntennaId* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+            case SigFfTxPower:
+                dot11fPackFfTxPower(pCtx, (tDot11fFfTxPower* )(pSrc + pFf->offset), pBufRemaining);
+                break;
+        default:
+            FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don"
+                "'t know about the Fixed Field %d; this is most l"
+                "ikely a bug in 'framesg'.\n"), pFf->sig);
+            return DOT11F_INTERNAL_ERROR;
+        }
+
+        pBufRemaining += pFf->size;
+        nBufRemaining -= pFf->size;
+        *pnConsumed   += pFf->size;
+        ++pFf;
+
+    }
+
+    pIe = &( IEs[0] );
+    while ( 0xff != pIe->eid )
+    {
+        pfFound = (tFRAMES_BOOL*)(pSrc + pIe->offset + 
+                                  pIe->presenceOffset);
+        if ( *pfFound && pIe->minSize > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGE, FRFL("The IE %s takes at le"
+                "ast %d bytes, but there are only %d left in the b"
+                "uffer.\n"), pIe->name, pIe->minSize, nBufRemaining);
+            return DOT11F_BUFFER_OVERFLOW;
+        }
+
+
+        countOffset = ( (0 == pIe->arraybound) ?  1: *(tANI_U16* )(pSrc + pIe->countOffset) );
+           for (i = 0; i < countOffset; ++i)
+           {
+               len = 0U;
+               switch ( pIe->sig )
+               {
+                    case SigIeAPName:
+                        status |= dot11fPackIeAPName(pCtx, ( tDot11fIEAPName* )(pSrc + pIe->offset + sizeof(tDot11fIEAPName) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeBPIndicator:
+                        status |= dot11fPackIeBPIndicator(pCtx, ( tDot11fIEBPIndicator* )(pSrc + pIe->offset + sizeof(tDot11fIEBPIndicator) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCondensedCountryStr:
+                        status |= dot11fPackIeCondensedCountryStr(pCtx, ( tDot11fIECondensedCountryStr* )(pSrc + pIe->offset + sizeof(tDot11fIECondensedCountryStr) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeGTK:
+                        status |= dot11fPackIeGTK(pCtx, ( tDot11fIEGTK* )(pSrc + pIe->offset + sizeof(tDot11fIEGTK) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeHCF:
+                        status |= dot11fPackIeHCF(pCtx, ( tDot11fIEHCF* )(pSrc + pIe->offset + sizeof(tDot11fIEHCF) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeLLAttr:
+                        status |= dot11fPackIeLLAttr(pCtx, ( tDot11fIELLAttr* )(pSrc + pIe->offset + sizeof(tDot11fIELLAttr) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeLoadBalance:
+                        status |= dot11fPackIeLoadBalance(pCtx, ( tDot11fIELoadBalance* )(pSrc + pIe->offset + sizeof(tDot11fIELoadBalance) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeLoadInfo:
+                        status |= dot11fPackIeLoadInfo(pCtx, ( tDot11fIELoadInfo* )(pSrc + pIe->offset + sizeof(tDot11fIELoadInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropAssocType:
+                        status |= dot11fPackIePropAssocType(pCtx, ( tDot11fIEPropAssocType* )(pSrc + pIe->offset + sizeof(tDot11fIEPropAssocType) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropCapability:
+                        status |= dot11fPackIePropCapability(pCtx, ( tDot11fIEPropCapability* )(pSrc + pIe->offset + sizeof(tDot11fIEPropCapability) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropChannSwitchAnn:
+                        status |= dot11fPackIePropChannSwitchAnn(pCtx, ( tDot11fIEPropChannSwitchAnn* )(pSrc + pIe->offset + sizeof(tDot11fIEPropChannSwitchAnn) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropEDCAParams:
+                        status |= dot11fPackIePropEDCAParams(pCtx, ( tDot11fIEPropEDCAParams* )(pSrc + pIe->offset + sizeof(tDot11fIEPropEDCAParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropQuietBSS:
+                        status |= dot11fPackIePropQuietBSS(pCtx, ( tDot11fIEPropQuietBSS* )(pSrc + pIe->offset + sizeof(tDot11fIEPropQuietBSS) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePropSuppRates:
+                        status |= dot11fPackIePropSuppRates(pCtx, ( tDot11fIEPropSuppRates* )(pSrc + pIe->offset + sizeof(tDot11fIEPropSuppRates) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeR0KH_ID:
+                        status |= dot11fPackIeR0KH_ID(pCtx, ( tDot11fIER0KH_ID* )(pSrc + pIe->offset + sizeof(tDot11fIER0KH_ID) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeR1KH_ID:
+                        status |= dot11fPackIeR1KH_ID(pCtx, ( tDot11fIER1KH_ID* )(pSrc + pIe->offset + sizeof(tDot11fIER1KH_ID) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTSFInfo:
+                        status |= dot11fPackIeTSFInfo(pCtx, ( tDot11fIETSFInfo* )(pSrc + pIe->offset + sizeof(tDot11fIETSFInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTaurus:
+                        status |= dot11fPackIeTaurus(pCtx, ( tDot11fIETaurus* )(pSrc + pIe->offset + sizeof(tDot11fIETaurus) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTitan:
+                        status |= dot11fPackIeTitan(pCtx, ( tDot11fIETitan* )(pSrc + pIe->offset + sizeof(tDot11fIETitan) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTriggerStaBgScan:
+                        status |= dot11fPackIeTriggerStaBgScan(pCtx, ( tDot11fIETriggerStaBgScan* )(pSrc + pIe->offset + sizeof(tDot11fIETriggerStaBgScan) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeVersion:
+                        status |= dot11fPackIeVersion(pCtx, ( tDot11fIEVersion* )(pSrc + pIe->offset + sizeof(tDot11fIEVersion) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWDS:
+                        status |= dot11fPackIeWDS(pCtx, ( tDot11fIEWDS* )(pSrc + pIe->offset + sizeof(tDot11fIEWDS) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeAPChannelReport:
+                        status |= dot11fPackIeAPChannelReport(pCtx, ( tDot11fIEAPChannelReport* )(pSrc + pIe->offset + sizeof(tDot11fIEAPChannelReport) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeBcnReportingDetail:
+                        status |= dot11fPackIeBcnReportingDetail(pCtx, ( tDot11fIEBcnReportingDetail* )(pSrc + pIe->offset + sizeof(tDot11fIEBcnReportingDetail) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeBeaconReportFrmBody:
+                        status |= dot11fPackIeBeaconReportFrmBody(pCtx, ( tDot11fIEBeaconReportFrmBody* )(pSrc + pIe->offset + sizeof(tDot11fIEBeaconReportFrmBody) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeBeaconReporting:
+                        status |= dot11fPackIeBeaconReporting(pCtx, ( tDot11fIEBeaconReporting* )(pSrc + pIe->offset + sizeof(tDot11fIEBeaconReporting) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeMeasurementPilot:
+                        status |= dot11fPackIeMeasurementPilot(pCtx, ( tDot11fIEMeasurementPilot* )(pSrc + pIe->offset + sizeof(tDot11fIEMeasurementPilot) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeMultiBssid:
+                        status |= dot11fPackIeMultiBssid(pCtx, ( tDot11fIEMultiBssid* )(pSrc + pIe->offset + sizeof(tDot11fIEMultiBssid) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRICData:
+                        status |= dot11fPackIeRICData(pCtx, ( tDot11fIERICData* )(pSrc + pIe->offset + sizeof(tDot11fIERICData) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRICDescriptor:
+                        status |= dot11fPackIeRICDescriptor(pCtx, ( tDot11fIERICDescriptor* )(pSrc + pIe->offset + sizeof(tDot11fIERICDescriptor) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRRMEnabledCap:
+                        status |= dot11fPackIeRRMEnabledCap(pCtx, ( tDot11fIERRMEnabledCap* )(pSrc + pIe->offset + sizeof(tDot11fIERRMEnabledCap) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRequestedInfo:
+                        status |= dot11fPackIeRequestedInfo(pCtx, ( tDot11fIERequestedInfo* )(pSrc + pIe->offset + sizeof(tDot11fIERequestedInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeSSID:
+                        status |= dot11fPackIeSSID(pCtx, ( tDot11fIESSID* )(pSrc + pIe->offset + sizeof(tDot11fIESSID) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeSchedule:
+                        status |= dot11fPackIeSchedule(pCtx, ( tDot11fIESchedule* )(pSrc + pIe->offset + sizeof(tDot11fIESchedule) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTCLAS:
+                        status |= dot11fPackIeTCLAS(pCtx, ( tDot11fIETCLAS* )(pSrc + pIe->offset + sizeof(tDot11fIETCLAS) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTCLASSPROC:
+                        status |= dot11fPackIeTCLASSPROC(pCtx, ( tDot11fIETCLASSPROC* )(pSrc + pIe->offset + sizeof(tDot11fIETCLASSPROC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTSDelay:
+                        status |= dot11fPackIeTSDelay(pCtx, ( tDot11fIETSDelay* )(pSrc + pIe->offset + sizeof(tDot11fIETSDelay) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTSPEC:
+                        status |= dot11fPackIeTSPEC(pCtx, ( tDot11fIETSPEC* )(pSrc + pIe->offset + sizeof(tDot11fIETSPEC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMSchedule:
+                        status |= dot11fPackIeWMMSchedule(pCtx, ( tDot11fIEWMMSchedule* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMSchedule) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMTCLAS:
+                        status |= dot11fPackIeWMMTCLAS(pCtx, ( tDot11fIEWMMTCLAS* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMTCLAS) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMTCLASPROC:
+                        status |= dot11fPackIeWMMTCLASPROC(pCtx, ( tDot11fIEWMMTCLASPROC* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMTCLASPROC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMTSDelay:
+                        status |= dot11fPackIeWMMTSDelay(pCtx, ( tDot11fIEWMMTSDelay* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMTSDelay) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMTSPEC:
+                        status |= dot11fPackIeWMMTSPEC(pCtx, ( tDot11fIEWMMTSPEC* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMTSPEC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeAirgo:
+                        status |= dot11fPackIeAirgo(pCtx, ( tDot11fIEAirgo* )(pSrc + pIe->offset + sizeof(tDot11fIEAirgo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXCckmOpaque:
+                        status |= dot11fPackIeCCXCckmOpaque(pCtx, ( tDot11fIECCXCckmOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIECCXCckmOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXRadMgmtCap:
+                        status |= dot11fPackIeCCXRadMgmtCap(pCtx, ( tDot11fIECCXRadMgmtCap* )(pSrc + pIe->offset + sizeof(tDot11fIECCXRadMgmtCap) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXTrafStrmMet:
+                        status |= dot11fPackIeCCXTrafStrmMet(pCtx, ( tDot11fIECCXTrafStrmMet* )(pSrc + pIe->offset + sizeof(tDot11fIECCXTrafStrmMet) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXTrafStrmRateSet:
+                        status |= dot11fPackIeCCXTrafStrmRateSet(pCtx, ( tDot11fIECCXTrafStrmRateSet* )(pSrc + pIe->offset + sizeof(tDot11fIECCXTrafStrmRateSet) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXTxmitPower:
+                        status |= dot11fPackIeCCXTxmitPower(pCtx, ( tDot11fIECCXTxmitPower* )(pSrc + pIe->offset + sizeof(tDot11fIECCXTxmitPower) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCCXVersion:
+                        status |= dot11fPackIeCCXVersion(pCtx, ( tDot11fIECCXVersion* )(pSrc + pIe->offset + sizeof(tDot11fIECCXVersion) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCFParams:
+                        status |= dot11fPackIeCFParams(pCtx, ( tDot11fIECFParams* )(pSrc + pIe->offset + sizeof(tDot11fIECFParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeChallengeText:
+                        status |= dot11fPackIeChallengeText(pCtx, ( tDot11fIEChallengeText* )(pSrc + pIe->offset + sizeof(tDot11fIEChallengeText) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeChanSwitchAnn:
+                        status |= dot11fPackIeChanSwitchAnn(pCtx, ( tDot11fIEChanSwitchAnn* )(pSrc + pIe->offset + sizeof(tDot11fIEChanSwitchAnn) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeCountry:
+                        status |= dot11fPackIeCountry(pCtx, ( tDot11fIECountry* )(pSrc + pIe->offset + sizeof(tDot11fIECountry) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeDSParams:
+                        status |= dot11fPackIeDSParams(pCtx, ( tDot11fIEDSParams* )(pSrc + pIe->offset + sizeof(tDot11fIEDSParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeEDCAParamSet:
+                        status |= dot11fPackIeEDCAParamSet(pCtx, ( tDot11fIEEDCAParamSet* )(pSrc + pIe->offset + sizeof(tDot11fIEEDCAParamSet) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeERPInfo:
+                        status |= dot11fPackIeERPInfo(pCtx, ( tDot11fIEERPInfo* )(pSrc + pIe->offset + sizeof(tDot11fIEERPInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeExtChanSwitchAnn:
+                        status |= dot11fPackIeExtChanSwitchAnn(pCtx, ( tDot11fIEExtChanSwitchAnn* )(pSrc + pIe->offset + sizeof(tDot11fIEExtChanSwitchAnn) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeExtSuppRates:
+                        status |= dot11fPackIeExtSuppRates(pCtx, ( tDot11fIEExtSuppRates* )(pSrc + pIe->offset + sizeof(tDot11fIEExtSuppRates) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeFHParamSet:
+                        status |= dot11fPackIeFHParamSet(pCtx, ( tDot11fIEFHParamSet* )(pSrc + pIe->offset + sizeof(tDot11fIEFHParamSet) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeFHParams:
+                        status |= dot11fPackIeFHParams(pCtx, ( tDot11fIEFHParams* )(pSrc + pIe->offset + sizeof(tDot11fIEFHParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeFHPattTable:
+                        status |= dot11fPackIeFHPattTable(pCtx, ( tDot11fIEFHPattTable* )(pSrc + pIe->offset + sizeof(tDot11fIEFHPattTable) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeFTInfo:
+                        status |= dot11fPackIeFTInfo(pCtx, ( tDot11fIEFTInfo* )(pSrc + pIe->offset + sizeof(tDot11fIEFTInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeFTTimeoutInterval:
+                        status |= dot11fPackIeFTTimeoutInterval(pCtx, ( tDot11fIEFTTimeoutInterval* )(pSrc + pIe->offset + sizeof(tDot11fIEFTTimeoutInterval) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeHTCaps:
+                        status |= dot11fPackIeHTCaps(pCtx, ( tDot11fIEHTCaps* )(pSrc + pIe->offset + sizeof(tDot11fIEHTCaps) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeHTInfo:
+                        status |= dot11fPackIeHTInfo(pCtx, ( tDot11fIEHTInfo* )(pSrc + pIe->offset + sizeof(tDot11fIEHTInfo) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeIBSSParams:
+                        status |= dot11fPackIeIBSSParams(pCtx, ( tDot11fIEIBSSParams* )(pSrc + pIe->offset + sizeof(tDot11fIEIBSSParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeMeasurementReport:
+                        status |= dot11fPackIeMeasurementReport(pCtx, ( tDot11fIEMeasurementReport* )(pSrc + pIe->offset + sizeof(tDot11fIEMeasurementReport) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeMeasurementRequest:
+                        status |= dot11fPackIeMeasurementRequest(pCtx, ( tDot11fIEMeasurementRequest* )(pSrc + pIe->offset + sizeof(tDot11fIEMeasurementRequest) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeMobilityDomain:
+                        status |= dot11fPackIeMobilityDomain(pCtx, ( tDot11fIEMobilityDomain* )(pSrc + pIe->offset + sizeof(tDot11fIEMobilityDomain) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeNeighborReport:
+                        status |= dot11fPackIeNeighborReport(pCtx, ( tDot11fIENeighborReport* )(pSrc + pIe->offset + sizeof(tDot11fIENeighborReport) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PAssocReq:
+                        status |= dot11fPackIeP2PAssocReq(pCtx, ( tDot11fIEP2PAssocReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PAssocReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PAssocRes:
+                        status |= dot11fPackIeP2PAssocRes(pCtx, ( tDot11fIEP2PAssocRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PAssocRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PBeacon:
+                        status |= dot11fPackIeP2PBeacon(pCtx, ( tDot11fIEP2PBeacon* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PBeacon) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PBeaconProbeRes:
+                        status |= dot11fPackIeP2PBeaconProbeRes(pCtx, ( tDot11fIEP2PBeaconProbeRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PBeaconProbeRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PDeAuth:
+                        status |= dot11fPackIeP2PDeAuth(pCtx, ( tDot11fIEP2PDeAuth* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PDeAuth) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PDeviceDiscoverabilityReq:
+                        status |= dot11fPackIeP2PDeviceDiscoverabilityReq(pCtx, ( tDot11fIEP2PDeviceDiscoverabilityReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PDeviceDiscoverabilityReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PDeviceDiscoverabilityRes:
+                        status |= dot11fPackIeP2PDeviceDiscoverabilityRes(pCtx, ( tDot11fIEP2PDeviceDiscoverabilityRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PDeviceDiscoverabilityRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PDisAssoc:
+                        status |= dot11fPackIeP2PDisAssoc(pCtx, ( tDot11fIEP2PDisAssoc* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PDisAssoc) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PGONegCnf:
+                        status |= dot11fPackIeP2PGONegCnf(pCtx, ( tDot11fIEP2PGONegCnf* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PGONegCnf) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PGONegReq:
+                        status |= dot11fPackIeP2PGONegReq(pCtx, ( tDot11fIEP2PGONegReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PGONegReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PGONegRes:
+                        status |= dot11fPackIeP2PGONegRes(pCtx, ( tDot11fIEP2PGONegRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PGONegRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PGONegWPS:
+                        status |= dot11fPackIeP2PGONegWPS(pCtx, ( tDot11fIEP2PGONegWPS* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PGONegWPS) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PIEOpaque:
+                        status |= dot11fPackIeP2PIEOpaque(pCtx, ( tDot11fIEP2PIEOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PIEOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PInvitationReq:
+                        status |= dot11fPackIeP2PInvitationReq(pCtx, ( tDot11fIEP2PInvitationReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PInvitationReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PInvitationRes:
+                        status |= dot11fPackIeP2PInvitationRes(pCtx, ( tDot11fIEP2PInvitationRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PInvitationRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PNoticeOfAbsence:
+                        status |= dot11fPackIeP2PNoticeOfAbsence(pCtx, ( tDot11fIEP2PNoticeOfAbsence* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PNoticeOfAbsence) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PPresenceResponse:
+                        status |= dot11fPackIeP2PPresenceResponse(pCtx, ( tDot11fIEP2PPresenceResponse* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PPresenceResponse) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PProbeReq:
+                        status |= dot11fPackIeP2PProbeReq(pCtx, ( tDot11fIEP2PProbeReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PProbeReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PProbeRes:
+                        status |= dot11fPackIeP2PProbeRes(pCtx, ( tDot11fIEP2PProbeRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PProbeRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PProvisionDiscoveryReq:
+                        status |= dot11fPackIeP2PProvisionDiscoveryReq(pCtx, ( tDot11fIEP2PProvisionDiscoveryReq* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PProvisionDiscoveryReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeP2PWSCProvisionDiscoveryRes:
+                        status |= dot11fPackIeP2PWSCProvisionDiscoveryRes(pCtx, ( tDot11fIEP2PWSCProvisionDiscoveryRes* )(pSrc + pIe->offset + sizeof(tDot11fIEP2PWSCProvisionDiscoveryRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePowerCaps:
+                        status |= dot11fPackIePowerCaps(pCtx, ( tDot11fIEPowerCaps* )(pSrc + pIe->offset + sizeof(tDot11fIEPowerCaps) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIePowerConstraints:
+                        status |= dot11fPackIePowerConstraints(pCtx, ( tDot11fIEPowerConstraints* )(pSrc + pIe->offset + sizeof(tDot11fIEPowerConstraints) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeQBSSLoad:
+                        status |= dot11fPackIeQBSSLoad(pCtx, ( tDot11fIEQBSSLoad* )(pSrc + pIe->offset + sizeof(tDot11fIEQBSSLoad) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeQOSCapsAp:
+                        status |= dot11fPackIeQOSCapsAp(pCtx, ( tDot11fIEQOSCapsAp* )(pSrc + pIe->offset + sizeof(tDot11fIEQOSCapsAp) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeQOSCapsStation:
+                        status |= dot11fPackIeQOSCapsStation(pCtx, ( tDot11fIEQOSCapsStation* )(pSrc + pIe->offset + sizeof(tDot11fIEQOSCapsStation) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeQuiet:
+                        status |= dot11fPackIeQuiet(pCtx, ( tDot11fIEQuiet* )(pSrc + pIe->offset + sizeof(tDot11fIEQuiet) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRCPIIE:
+                        status |= dot11fPackIeRCPIIE(pCtx, ( tDot11fIERCPIIE* )(pSrc + pIe->offset + sizeof(tDot11fIERCPIIE) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRICDataDesc:
+                        status |= dot11fPackIeRICDataDesc(pCtx, ( tDot11fIERICDataDesc* )(pSrc + pIe->offset + sizeof(tDot11fIERICDataDesc) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRSN:
+                        status |= dot11fPackIeRSN(pCtx, ( tDot11fIERSN* )(pSrc + pIe->offset + sizeof(tDot11fIERSN) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRSNIIE:
+                        status |= dot11fPackIeRSNIIE(pCtx, ( tDot11fIERSNIIE* )(pSrc + pIe->offset + sizeof(tDot11fIERSNIIE) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeRSNOpaque:
+                        status |= dot11fPackIeRSNOpaque(pCtx, ( tDot11fIERSNOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIERSNOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeSuppChannels:
+                        status |= dot11fPackIeSuppChannels(pCtx, ( tDot11fIESuppChannels* )(pSrc + pIe->offset + sizeof(tDot11fIESuppChannels) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeSuppRates:
+                        status |= dot11fPackIeSuppRates(pCtx, ( tDot11fIESuppRates* )(pSrc + pIe->offset + sizeof(tDot11fIESuppRates) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTIM:
+                        status |= dot11fPackIeTIM(pCtx, ( tDot11fIETIM* )(pSrc + pIe->offset + sizeof(tDot11fIETIM) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTPCReport:
+                        status |= dot11fPackIeTPCReport(pCtx, ( tDot11fIETPCReport* )(pSrc + pIe->offset + sizeof(tDot11fIETPCReport) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeTPCRequest:
+                        status |= dot11fPackIeTPCRequest(pCtx, ( tDot11fIETPCRequest* )(pSrc + pIe->offset + sizeof(tDot11fIETPCRequest) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWAPI:
+                        status |= dot11fPackIeWAPI(pCtx, ( tDot11fIEWAPI* )(pSrc + pIe->offset + sizeof(tDot11fIEWAPI) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWAPIOpaque:
+                        status |= dot11fPackIeWAPIOpaque(pCtx, ( tDot11fIEWAPIOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIEWAPIOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWFATPC:
+                        status |= dot11fPackIeWFATPC(pCtx, ( tDot11fIEWFATPC* )(pSrc + pIe->offset + sizeof(tDot11fIEWFATPC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMCaps:
+                        status |= dot11fPackIeWMMCaps(pCtx, ( tDot11fIEWMMCaps* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMCaps) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMInfoAp:
+                        status |= dot11fPackIeWMMInfoAp(pCtx, ( tDot11fIEWMMInfoAp* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMInfoAp) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMInfoStation:
+                        status |= dot11fPackIeWMMInfoStation(pCtx, ( tDot11fIEWMMInfoStation* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMInfoStation) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWMMParams:
+                        status |= dot11fPackIeWMMParams(pCtx, ( tDot11fIEWMMParams* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMParams) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWPA:
+                        status |= dot11fPackIeWPA(pCtx, ( tDot11fIEWPA* )(pSrc + pIe->offset + sizeof(tDot11fIEWPA) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWPAOpaque:
+                        status |= dot11fPackIeWPAOpaque(pCtx, ( tDot11fIEWPAOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIEWPAOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWSC:
+                        status |= dot11fPackIeWSC(pCtx, ( tDot11fIEWSC* )(pSrc + pIe->offset + sizeof(tDot11fIEWSC) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscAssocReq:
+                        status |= dot11fPackIeWscAssocReq(pCtx, ( tDot11fIEWscAssocReq* )(pSrc + pIe->offset + sizeof(tDot11fIEWscAssocReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscAssocRes:
+                        status |= dot11fPackIeWscAssocRes(pCtx, ( tDot11fIEWscAssocRes* )(pSrc + pIe->offset + sizeof(tDot11fIEWscAssocRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscBeacon:
+                        status |= dot11fPackIeWscBeacon(pCtx, ( tDot11fIEWscBeacon* )(pSrc + pIe->offset + sizeof(tDot11fIEWscBeacon) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscBeaconProbeRes:
+                        status |= dot11fPackIeWscBeaconProbeRes(pCtx, ( tDot11fIEWscBeaconProbeRes* )(pSrc + pIe->offset + sizeof(tDot11fIEWscBeaconProbeRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscIEOpaque:
+                        status |= dot11fPackIeWscIEOpaque(pCtx, ( tDot11fIEWscIEOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIEWscIEOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscProbeReq:
+                        status |= dot11fPackIeWscProbeReq(pCtx, ( tDot11fIEWscProbeReq* )(pSrc + pIe->offset + sizeof(tDot11fIEWscProbeReq) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscProbeRes:
+                        status |= dot11fPackIeWscProbeRes(pCtx, ( tDot11fIEWscProbeRes* )(pSrc + pIe->offset + sizeof(tDot11fIEWscProbeRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+                    case SigIeWscReassocRes:
+                        status |= dot11fPackIeWscReassocRes(pCtx, ( tDot11fIEWscReassocRes* )(pSrc + pIe->offset + sizeof(tDot11fIEWscReassocRes) * i ),  pBufRemaining, nBufRemaining, &len);
+                        break;
+               default:
+                   FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don"
+                   "'t know about the IE %d; this is most likely a b"
+                   "ug in 'framesc'.\n"), pFf->sig);
+                   return DOT11F_INTERNAL_ERROR;
+           }
+
+        pBufRemaining += len;
+        nBufRemaining -= len;
+        *pnConsumed   += len;
+    }
+
+    ++pIe;
+
+    }
+
+    return status;
+
+}
+
+static tANI_U32 PackTlvCore(tpAniSirGlobal pCtx,
+                        tANI_U8 *pSrc,
+                        tANI_U8 *pBuf,
+                        tANI_U32  nBuf,
+                        tANI_U32 *pnConsumed,
+                        const tTLVDefn  TLVs[],
+                        tANI_U32 *pidx)
+{
+    const tTLVDefn *pTlv;
+    tFRAMES_BOOL   *pfFound;
+    tANI_U8    *pBufRemaining;
+    tANI_U32   nBufRemaining, status, len;
+
+    DOT11F_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed);
+
+    (void)pCtx;
+    status = DOT11F_PARSE_SUCCESS;
+    pBufRemaining = pBuf;
+    nBufRemaining = nBuf;
+
+    pTlv = &( TLVs[0] );
+    while ( 0xffff != pTlv->id )
+    {
+        pfFound = (tFRAMES_BOOL*)(pSrc + pTlv->offset +
+                                  pTlv->presenceOffset);
+        if ( *pfFound && pTlv->minSize > nBufRemaining )
+        {
+            FRAMES_LOG3(pCtx, FRLOGE, FRFL("The TLV %s takes at least"
+                " %d bytes, but there are only %d left in the buffer."
+                "\n"), pTlv->name, pTlv->minSize, nBufRemaining);
+            return DOT11F_BUFFER_OVERFLOW;
+        }
+
+        len = 0U;
+
+        if ( *pfFound ) {
+        switch ( pTlv->sig )
+        {
+                case SigTlvAuthorizedMACs:
+                        status |= dot11fPackTlvAuthorizedMACs(pCtx, ( tDot11fTLVAuthorizedMACs* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvRequestToEnroll:
+                        status |= dot11fPackTlvRequestToEnroll(pCtx, ( tDot11fTLVRequestToEnroll* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvVersion2:
+                        status |= dot11fPackTlvVersion2(pCtx, ( tDot11fTLVVersion2* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvAPSetupLocked:
+                        status |= dot11fPackTlvAPSetupLocked(pCtx, ( tDot11fTLVAPSetupLocked* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvAssociationState:
+                        status |= dot11fPackTlvAssociationState(pCtx, ( tDot11fTLVAssociationState* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvChannelList:
+                        status |= dot11fPackTlvChannelList(pCtx, ( tDot11fTLVChannelList* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvConfigMethods:
+                        status |= dot11fPackTlvConfigMethods(pCtx, ( tDot11fTLVConfigMethods* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvConfigurationError:
+                        status |= dot11fPackTlvConfigurationError(pCtx, ( tDot11fTLVConfigurationError* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvConfigurationTimeout:
+                        status |= dot11fPackTlvConfigurationTimeout(pCtx, ( tDot11fTLVConfigurationTimeout* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvDeviceName:
+                        status |= dot11fPackTlvDeviceName(pCtx, ( tDot11fTLVDeviceName* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvDevicePasswordID:
+                        status |= dot11fPackTlvDevicePasswordID(pCtx, ( tDot11fTLVDevicePasswordID* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvExtendedListenTiming:
+                        status |= dot11fPackTlvExtendedListenTiming(pCtx, ( tDot11fTLVExtendedListenTiming* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvGOIntent:
+                        status |= dot11fPackTlvGOIntent(pCtx, ( tDot11fTLVGOIntent* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvIntendedP2PInterfaceAddress:
+                        status |= dot11fPackTlvIntendedP2PInterfaceAddress(pCtx, ( tDot11fTLVIntendedP2PInterfaceAddress* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvInvitationFlags:
+                        status |= dot11fPackTlvInvitationFlags(pCtx, ( tDot11fTLVInvitationFlags* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvListenChannel:
+                        status |= dot11fPackTlvListenChannel(pCtx, ( tDot11fTLVListenChannel* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvManufacturer:
+                        status |= dot11fPackTlvManufacturer(pCtx, ( tDot11fTLVManufacturer* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvMinorReasonCode:
+                        status |= dot11fPackTlvMinorReasonCode(pCtx, ( tDot11fTLVMinorReasonCode* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvModelName:
+                        status |= dot11fPackTlvModelName(pCtx, ( tDot11fTLVModelName* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvModelNumber:
+                        status |= dot11fPackTlvModelNumber(pCtx, ( tDot11fTLVModelNumber* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvNoticeOfAbsence:
+                        status |= dot11fPackTlvNoticeOfAbsence(pCtx, ( tDot11fTLVNoticeOfAbsence* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvOperatingChannel:
+                        status |= dot11fPackTlvOperatingChannel(pCtx, ( tDot11fTLVOperatingChannel* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PCapability:
+                        status |= dot11fPackTlvP2PCapability(pCtx, ( tDot11fTLVP2PCapability* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PDeviceId:
+                        status |= dot11fPackTlvP2PDeviceId(pCtx, ( tDot11fTLVP2PDeviceId* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PDeviceInfo:
+                        status |= dot11fPackTlvP2PDeviceInfo(pCtx, ( tDot11fTLVP2PDeviceInfo* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PGroupBssid:
+                        status |= dot11fPackTlvP2PGroupBssid(pCtx, ( tDot11fTLVP2PGroupBssid* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PGroupId:
+                        status |= dot11fPackTlvP2PGroupId(pCtx, ( tDot11fTLVP2PGroupId* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PGroupInfo:
+                        status |= dot11fPackTlvP2PGroupInfo(pCtx, ( tDot11fTLVP2PGroupInfo* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PStatus:
+                        status |= dot11fPackTlvP2PStatus(pCtx, ( tDot11fTLVP2PStatus* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvPrimaryDeviceType:
+                        status |= dot11fPackTlvPrimaryDeviceType(pCtx, ( tDot11fTLVPrimaryDeviceType* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvRFBands:
+                        status |= dot11fPackTlvRFBands(pCtx, ( tDot11fTLVRFBands* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvRequestDeviceType:
+                        status |= dot11fPackTlvRequestDeviceType(pCtx, ( tDot11fTLVRequestDeviceType* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvRequestType:
+                        status |= dot11fPackTlvRequestType(pCtx, ( tDot11fTLVRequestType* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvResponseType:
+                        status |= dot11fPackTlvResponseType(pCtx, ( tDot11fTLVResponseType* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvSelectedRegistrar:
+                        status |= dot11fPackTlvSelectedRegistrar(pCtx, ( tDot11fTLVSelectedRegistrar* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvSelectedRegistrarConfigMethods:
+                        status |= dot11fPackTlvSelectedRegistrarConfigMethods(pCtx, ( tDot11fTLVSelectedRegistrarConfigMethods* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvSerialNumber:
+                        status |= dot11fPackTlvSerialNumber(pCtx, ( tDot11fTLVSerialNumber* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvUUID_E:
+                        status |= dot11fPackTlvUUID_E(pCtx, ( tDot11fTLVUUID_E* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvUUID_R:
+                        status |= dot11fPackTlvUUID_R(pCtx, ( tDot11fTLVUUID_R* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvVendorExtension:
+                        status |= dot11fPackTlvVendorExtension(pCtx, ( tDot11fTLVVendorExtension* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvVersion:
+                        status |= dot11fPackTlvVersion(pCtx, ( tDot11fTLVVersion* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvWPSState:
+                        status |= dot11fPackTlvWPSState(pCtx, ( tDot11fTLVWPSState* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PInterface:
+                        status |= dot11fPackTlvP2PInterface(pCtx, ( tDot11fTLVP2PInterface* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+                case SigTlvP2PManageability:
+                        status |= dot11fPackTlvP2PManageability(pCtx, ( tDot11fTLVP2PManageability* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len);
+                    break;
+        default:
+            FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don't "
+                "know about the TLV %d; this is most likely a bug in "
+                "'framesc'.\n"), pTlv->sig);
+            return DOT11F_INTERNAL_ERROR;
+        }
+
+        } /* End if on *pfFound */
+        pBufRemaining += len;
+        nBufRemaining -= len;
+        *pnConsumed   += len;
+        ++pTlv;
+        if(len) ++*pidx;
+    }
+
+    return status;
+
+}
diff --git a/CORE/SYS/legacy/src/utils/src/logApi.c b/CORE/SYS/legacy/src/utils/src/logApi.c
new file mode 100644
index 0000000..48e9fd3
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/logApi.c
@@ -0,0 +1,251 @@
+/*
+ * 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.
+ * logApi.cc - Handles log messages for all the modules.
+ * Author:        Kevin Nguyen    
+ * Date:          02/27/02
+ * History:-
+ * 02/11/02       Created.
+ * 03/12/02       Rearrange logDebug parameter list and add more params.
+ * --------------------------------------------------------------------
+ * 
+ */
+#define WNI_PRINT_DEBUG
+
+#include <sirCommon.h>
+#include <sirDebug.h>
+#include <utilsApi.h>
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+#include <halCommonApi.h>
+#endif
+#include <wlan_qct_wda.h>
+
+#include <stdarg.h>
+#include "sirWrapper.h"
+#include "utilsGlobal.h"
+#include "macInitApi.h"
+#include "palApi.h"
+
+#include "vos_trace.h"
+
+#ifdef ANI_OS_TYPE_ANDROID
+#include <linux/kernel.h>
+#endif
+
+
+//This is not right here. Need to find a better place. 
+//_vsnprintf is a function in Windows
+//Temporary workaround.
+#ifndef ANI_OS_TYPE_WINDOWS
+#ifndef _vsnprintf
+#define _vsnprintf vsnprintf
+#endif
+#endif // not Windows
+
+#define dbgTraceInfo(_Mask, _InParams)                 \
+  {                                                      \
+    KdPrint (_InParams) ;                                 \
+  }
+
+#define utilLogLogDebugMessage(HddAdapter, _LogBuffer)   \
+  {                                                      \
+    VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,   \
+              _LogBuffer);                               \
+  }
+  
+
+// ---------------------------------------------------------------------
+/**
+ * logInit() 
+ *
+ * FUNCTION:
+ * This function is called to prepare the logging utility.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal Sirius software parameter strucutre pointer
+ * @return None
+ */
+tSirRetStatus 
+logInit(tpAniSirGlobal pMac)
+{
+    tANI_U32    i;
+
+    // Add code to initialize debug level from CFG module
+    // For now, enable all logging
+    for (i = 0; i < LOG_ENTRY_NUM; i++)
+    {
+#ifdef SIR_DEBUG
+        pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = LOG1;
+#else
+#ifdef LX5280
+        pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = LOGE;
+#else
+        pMac->utils.gLogEvtLevel[i] = pMac->utils.gLogDbgLevel[i] = LOGW;
+#endif
+#endif
+    }
+    return eSIR_SUCCESS;
+
+} /*** logInit() ***/
+
+void
+logDeinit(tpAniSirGlobal pMac)
+{
+    return;
+}
+
+/**
+ * logDbg() 
+ *
+ *FUNCTION:
+ * This function is called to log a debug message.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * None.
+ *
+ *NOTE:
+ *
+ * @param tpAniSirGlobal Sirius software parameter strucutre pointer
+ * @param ModId        8-bit modID
+ * @param debugLevel   debugging level for this message
+ * @param pStr         string parameter pointer
+ * @return None
+ */
+
+#if defined(ANI_OS_TYPE_OSX)
+#if defined ANI_FIREWIRE_LOG
+#include <IOKit/firewire/FireLog.h>
+#define printk          FireLog
+#else
+#define printk          printf
+#endif
+#define tx_time_get()   (0)
+#endif
+
+void logDbg(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 debugLevel, const char *pStr,...)
+{
+#ifdef WLAN_DEBUG
+    if ( debugLevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( modId )] )
+        return;
+    else
+    {
+        va_list marker;
+
+        va_start( marker, pStr );     /* Initialize variable arguments. */
+
+        logDebug(pMac, modId, debugLevel, pStr, marker);
+        
+        va_end( marker );              /* Reset variable arguments.      */
+    }      
+#endif
+}
+
+#ifdef VOSS_ENABLED
+static inline VOS_TRACE_LEVEL getVosDebugLevel(tANI_U32 debugLevel)
+{   
+    switch(debugLevel)
+    {
+        case LOGP:
+            return VOS_TRACE_LEVEL_FATAL;
+        case LOGE:
+            return VOS_TRACE_LEVEL_ERROR;
+        case LOGW:
+            return VOS_TRACE_LEVEL_WARN;
+        case LOG4:
+            return VOS_TRACE_LEVEL_INFO;
+        case LOG3:
+            return VOS_TRACE_LEVEL_INFO_HIGH;
+        case LOG2:
+            return VOS_TRACE_LEVEL_INFO_MED;
+        case LOG1:
+            return VOS_TRACE_LEVEL_INFO_LOW;
+        default:
+            return VOS_TRACE_LEVEL_INFO_LOW;
+    }
+}
+
+static inline VOS_MODULE_ID getVosModuleId(tANI_U8 modId)
+{
+    switch(modId)
+    {
+        case SIR_HAL_MODULE_ID:
+        case SIR_PHY_MODULE_ID:
+            return VOS_MODULE_ID_WDA;
+
+        case SIR_LIM_MODULE_ID:
+        case SIR_SCH_MODULE_ID:
+        case SIR_PMM_MODULE_ID:
+        case SIR_CFG_MODULE_ID:
+        case SIR_MNT_MODULE_ID:
+        case SIR_DPH_MODULE_ID:
+        case SIR_DBG_MODULE_ID:
+            return VOS_MODULE_ID_PE;
+
+        case SIR_SYS_MODULE_ID:
+            return VOS_MODULE_ID_SYS;
+    
+        case SIR_SMS_MODULE_ID:
+            return VOS_MODULE_ID_SME;
+
+        default:
+            return VOS_MODULE_ID_SYS;
+    }
+}
+#endif // VOSS_ENABLED
+
+#define LOG_SIZE 256
+void logDebug(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 debugLevel, const char *pStr, va_list marker)
+{
+    VOS_TRACE_LEVEL  vosDebugLevel;
+    VOS_MODULE_ID    vosModuleId;
+    char             logBuffer[LOG_SIZE];
+
+    vosDebugLevel = getVosDebugLevel(debugLevel);
+    vosModuleId = getVosModuleId(modId);
+
+#ifdef ANI_OS_TYPE_ANDROID
+    vsnprintf(logBuffer, LOG_SIZE - 1, pStr, marker);
+#else
+
+#ifdef WINDOWS_DT
+    RtlStringCbVPrintfA( &logBuffer[ 0 ], LOG_SIZE - 1, pStr, marker );
+#else
+    _vsnprintf(logBuffer, LOG_SIZE - 1, (char *)pStr, marker);
+#endif
+
+#endif
+    VOS_TRACE(vosModuleId, vosDebugLevel, "%s", logBuffer);
+
+    // The caller must check loglevel
+    VOS_ASSERT( ( debugLevel <= pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( modId )] ) && ( LOGP != debugLevel ) );
+} /*** end logDebug() ***/
diff --git a/CORE/SYS/legacy/src/utils/src/logDump.c b/CORE/SYS/legacy/src/utils/src/logDump.c
new file mode 100644
index 0000000..af10944
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/logDump.c
@@ -0,0 +1,731 @@
+/*
+ * 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.c
+*/
+
+/*
+ * Woodside Networks, Inc proprietary. All rights reserved.
+ * This file contains the utility functions to dump various
+ * MAC states and to enable/disable certain features during
+ * debugging.
+ * Author:        Sandesh Goel
+ * Date:          02/27/02
+ * History:-
+ * 02/11/02       Created.
+ * --------------------------------------------------------------------
+ *
+ */
+
+/* 
+ * @note : Bytes is to print overflow message information.
+ */
+
+#include "palTypes.h"
+
+#ifdef ANI_LOGDUMP
+
+#define MAX_OVERFLOW_MSG    400
+#if defined(ANI_OS_TYPE_WINDOWS)
+#define MAX_LOGDUMP_SIZE    ((4*1024) - MAX_OVERFLOW_MSG)
+#else
+#define MAX_LOGDUMP_SIZE    ((4*1024) - MAX_OVERFLOW_MSG)
+#endif
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halDebug.h"
+#include "halInterrupts.h"
+#endif
+#if defined (ANI_OS_TYPE_LINUX)
+
+#include <sysDebug.h>
+
+#elif defined(ANI_OS_TYPE_WINDOWS)
+
+#include "stdarg.h"
+#include "sirTypes.h"
+
+
+#ifdef ANI_DVT_DEBUG
+#include "dvtModuleApi.h"
+#endif
+
+#include "pmmApi.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halInternal.h"
+#endif
+#include "csrApi.h"
+
+#elif defined(ANI_OS_TYPE_OSX)
+
+#include "stdarg.h"
+
+#elif defined(ANI_OS_TYPE_AMSS)
+
+#include "comdef.h"
+#include "string.h"
+
+#include "AEEstd.h"
+
+#include "sirTypes.h"
+#include "halInterrupts.h"
+
+#include "pmmApi.h"
+#include "halInternal.h"
+#include "csrApi.h"
+
+#elif defined(ANI_OS_TYPE_ANDROID)
+
+#include <linux/kernel.h>
+
+#endif
+
+
+#include "palApi.h"
+#include "aniGlobal.h"
+#include "sirCommon.h"
+#include <sirDebug.h>
+#include <utilsApi.h>
+
+#include <limApi.h>
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include <halCommonApi.h>
+#endif
+#include <cfgApi.h>
+#include <utilsGlobal.h>
+#include <dphGlobal.h>
+#include <limGlobal.h>
+#include "limUtils.h"
+#include "schApi.h"
+
+#include "pmmApi.h"
+#include "limSerDesUtils.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halLogDump.h"
+//#include "testHalMsgApi.h"
+#include "halMailbox.h"
+#include "halRxp.h"
+#include "halMTU.h"
+#include "halPhyApi.h"
+#endif
+#include "limAssocUtils.h"
+#include "limSendMessages.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halUtils.h"
+#endif
+#include "limSecurityUtils.h"
+//#include "halRadar.h"
+#include "logDump.h"
+#include "sysDebug.h"
+#include "wlan_qct_wda.h"
+
+#define HAL_LOG_DUMP_CMD_START 0
+#define HAL_LOG_DUMP_CMD_END 299
+
+static int debug = 0;
+
+    void
+logPrintf(tpAniSirGlobal pMac, tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4)
+{
+    static tANI_U8 buf[MAX_LOGDUMP_SIZE + MAX_OVERFLOW_MSG];
+    tANI_U16 bufLen;
+    pMac->gCurrentLogSize = 0;
+
+    bufLen = (tANI_U16)logRtaiDump(pMac, cmd, arg1, arg2, arg3, arg4, buf);
+}
+
+/**
+  @brief: This function is used to Aggregate the formated buffer, this
+  also check the overflow condition and adds the overflow message
+  to the end of the log Dump buffer reserved of MAX_OVERFLOW_MSG size.
+  @param: tpAniSirGlobal pMac
+  @param: char *pBuf
+  @param: variable arguments...
+  @return: Returns the number of bytes added to the buffer.
+  Returns 0 incase of overflow.
+
+  @note: Currently in windows we do not print the Aggregated buffer as there
+  is a limitation on the number of bytes that can be displayed by DbgPrint
+  So we print the buffer immediately and we would also aggregate where
+  the TestDbg might use this buffer to print out at the application level.
+  */
+int log_sprintf(tpAniSirGlobal pMac, char *pBuf, char *fmt, ...)
+{
+    tANI_S32 ret = 0;
+#ifdef WLAN_DEBUG
+
+#if defined(ANI_OS_TYPE_AMSS)
+    AEEVaList args;
+    AEEVA_START(args, fmt);
+#else
+    va_list args;
+    va_start(args, fmt);
+#endif
+
+    if (pMac->gCurrentLogSize >= MAX_LOGDUMP_SIZE)
+        return 0;
+
+#if defined (ANI_OS_TYPE_WINDOWS)
+    ret = _vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
+#elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID))
+    ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
+#elif defined (ANI_OS_TYPE_OSX)
+    ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
+    /* BSD kernel has a bug that vsnprintf() always return 0.
+     * See bsd/kern/subr_prf.c 
+     * Need to verify ...
+     */
+    if (ret >= 0)
+        ret = strlen(pBuf);
+#elif defined (ANI_OS_TYPE_AMSS)
+    ret = std_vstrlprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
+#endif
+
+#if defined(ANI_OS_TYPE_AMSS)
+    AEEVA_END(args);
+#else
+    va_end(args);
+#endif
+
+    /* If an output error is encountered, a negative value is returned by vsnprintf */
+    if (ret < 0)
+        return 0;
+
+
+    if ((tANI_U32) ret > (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize)) {
+        pBuf += (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize);
+        pMac->gCurrentLogSize = MAX_LOGDUMP_SIZE;
+
+#if defined (ANI_OS_TYPE_WINDOWS)
+        ret = _snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
+                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
+#elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID))
+        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
+                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
+#elif defined (ANI_OS_TYPE_OSX)
+        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
+                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
+        /* BSD kernel has a bug that snprintf() always return 0.
+         * See bsd/kern/subr_prf.c 
+         * but NEED TO VERIFY ...
+         */
+        if (ret >= 0)
+            ret = strlen(pBuf);
+#elif defined (ANI_OS_TYPE_AMSS)
+        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
+                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
+#endif
+        /* If an output error is encountered, a negative value is returned by snprintf */
+        if (ret < 0)
+            return 0;
+
+        if (ret > MAX_OVERFLOW_MSG)
+            ret = MAX_OVERFLOW_MSG;
+    }
+
+    pMac->gCurrentLogSize += ret;
+
+
+#if defined (ANI_OS_TYPE_WINDOWS)
+    //DbgPrint("%s", pBuf);
+    sysLog(pMac, LOGE, FL("%s"), pBuf);
+#endif
+#endif //for #ifdef WLAN_DEBUG
+    return ret;
+}
+
+
+char* dumpLOG( tpAniSirGlobal pMac, char *p )
+{
+    tANI_U32 i;
+
+    for( i = SIR_FIRST_MODULE_ID; i <= SIR_LAST_MODULE_ID; i++ ) {
+        p += log_sprintf(pMac, p, "[0x%2x]", i);
+        switch (i)
+        {
+            case SIR_HAL_MODULE_ID: p += log_sprintf( pMac, p, "HAL "); break;
+            case SIR_CFG_MODULE_ID: p += log_sprintf( pMac, p, "CFG "); break;
+            case SIR_LIM_MODULE_ID: p += log_sprintf( pMac, p, "LIM "); break;
+            case SIR_ARQ_MODULE_ID: p += log_sprintf( pMac, p, "ARQ "); break;
+            case SIR_SCH_MODULE_ID: p += log_sprintf( pMac, p, "SCH "); break;
+            case SIR_PMM_MODULE_ID: p += log_sprintf( pMac, p, "PMM "); break;
+            case SIR_MNT_MODULE_ID: p += log_sprintf( pMac, p, "MNT "); break;
+            case SIR_DBG_MODULE_ID: p += log_sprintf( pMac, p, "DBG "); break;
+            case SIR_DPH_MODULE_ID: p += log_sprintf( pMac, p, "DPH "); break;
+            case SIR_SYS_MODULE_ID: p += log_sprintf( pMac, p, "SYS "); break;
+            case SIR_PHY_MODULE_ID: p += log_sprintf( pMac, p, "PHY "); break;
+            case SIR_DVT_MODULE_ID: p += log_sprintf( pMac, p, "DVT "); break;
+            case SIR_SMS_MODULE_ID: p += log_sprintf( pMac, p, "SMS "); break;
+            default: p += log_sprintf( pMac, p, "UNK ", i); break;
+        }
+
+        p += log_sprintf( pMac, p,
+                ": debug level is [0x%x] ",
+                pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID]);
+
+        switch( pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID] )
+        {
+            case LOGOFF: p += log_sprintf( pMac, p, "LOG disabled\n"); break;
+            case LOGP: p += log_sprintf( pMac, p, "LOGP(Panic only)\n"); break;
+            case LOGE: p += log_sprintf( pMac, p, "LOGE(Errors only)\n"); break;
+            case LOGW: p += log_sprintf( pMac, p, "LOGW(Warnings)\n"); break;
+            case LOG1: p += log_sprintf( pMac, p, "LOG1(Minimal debug)\n"); break;
+            case LOG2: p += log_sprintf( pMac, p, "LOG2(Verbose)\n"); break;
+            case LOG3: p += log_sprintf( pMac, p, "LOG3(Very Verbose)\n"); break;
+            case LOG4: p += log_sprintf( pMac, p, "LOG4(Very Very Verbose)\n"); break;
+            default: p += log_sprintf( pMac, p, "Unknown\n"); break;
+        }
+    }
+
+    return p;
+}
+
+char* setLOGLevel( tpAniSirGlobal pMac, char *p, tANI_U32 module, tANI_U32 level )
+{
+    tANI_U32 i;
+
+    if((module > SIR_LAST_MODULE_ID || module < SIR_FIRST_MODULE_ID) && module != 0xff ) {
+        p += log_sprintf( pMac, p, "Invalid module id 0x%x\n", module );
+        return p;
+    }
+
+    if( 0xff == module ) {
+        for( i = SIR_FIRST_MODULE_ID; i <= SIR_LAST_MODULE_ID; i++ )
+            pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID] = level;
+    } else {
+        pMac->utils.gLogDbgLevel[module - SIR_FIRST_MODULE_ID] = level;
+    }
+
+#ifdef ANI_PHY_DEBUG
+    if (module == 0xff || module == SIR_PHY_MODULE_ID) {
+        pMac->hphy.phy.phyDebugLogLevel = level;
+    }
+#endif
+
+    return dumpLOG( pMac, p );
+}
+
+static void Log_getCfg(tpAniSirGlobal pMac, tANI_U16 cfgId)
+{
+#define CFG_CTL_INT           0x00080000
+    if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0)
+    {
+        tANI_U32  val;
+
+        // Get integer parameter
+        if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, &val) != eHAL_STATUS_SUCCESS)
+        {
+            sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId);
+        }
+        else
+        {
+            sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d  0x%x) = %ld\n"),  gCfgParamName[cfgId], cfgId, cfgId, val );
+        }
+    }
+    else
+    {
+        tANI_U8 buf[CFG_MAX_STR_LEN] = {0} ;
+        tANI_U32 valueLen ;
+
+        // Get string parameter
+        valueLen = CFG_MAX_STR_LEN ;
+        if (wlan_cfgGetStr(pMac, cfgId, buf, &valueLen) != eSIR_SUCCESS)
+        {
+            sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId);
+        }
+        else
+        {
+            sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d  0x%x) len=%ld\n"),  gCfgParamName[cfgId], cfgId, cfgId, valueLen );
+            sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOGW, buf, valueLen) ;
+        }
+    }
+
+    return;
+}
+
+static void Log_setCfg(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 val)
+{
+    sysLog(pMac, LOGE, FL("Set %s(0x%x) to value 0x%x\n"),
+           gCfgParamName[cfgId], cfgId, val);
+
+    if (cfgSetInt(pMac, (tANI_U16)cfgId, val) != eHAL_STATUS_SUCCESS)
+        sysLog(pMac, LOGE, FL("setting cfgId 0x%x to value 0x%x failed \n"),
+               cfgId, val);
+     return;
+}
+
+
+char * dump_cfg_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg2; (void) arg3; (void) arg4;
+    Log_getCfg(pMac, (tANI_U16) arg1);
+    return p;
+}
+
+char * dump_cfg_group_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tANI_U32 i, startId, endId;
+
+    (void) arg3; (void) arg4;
+
+    if (arg1 < CFG_PARAM_MAX_NUM) {
+        startId = arg1;
+    } else {
+        p += log_sprintf( pMac, p, "Start CFGID must be less than %d\n", CFG_PARAM_MAX_NUM);
+        return p;
+    }
+
+    if ((arg2 == 0) || (arg2 > CFG_PARAM_MAX_NUM))
+        arg2 = 30;
+
+    endId = ((startId + arg2) < CFG_PARAM_MAX_NUM) ? (startId + arg2) : CFG_PARAM_MAX_NUM;
+
+    for (i=startId; i < endId; i++)
+        Log_getCfg(pMac, (tANI_U16) i);
+
+    return p;
+}
+char * dump_cfg_set( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    (void) arg3; (void) arg4;
+    Log_setCfg(pMac, (tANI_U16) arg1, arg2);
+    return p;
+}
+
+char * dump_log_level_set( 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 = setLOGLevel( pMac, p, arg1, arg2 );
+    return p;
+}
+
+#ifdef WLAN_DEBUG    
+static tLogdRegList dataType[] =
+{
+    {SIR_MAC_DATA_DATA, "DATA "},
+    {SIR_MAC_DATA_DATA_ACK, "D+A  "},
+    {SIR_MAC_DATA_DATA_POLL, "D+P  "},
+    {SIR_MAC_DATA_DATA_ACK_POLL, "D+A+P"},
+    {SIR_MAC_DATA_NULL, "NULL "},
+    {SIR_MAC_DATA_NULL_ACK, "ACK  "},
+    {SIR_MAC_DATA_NULL_POLL, "POLL "},
+    {SIR_MAC_DATA_NULL_ACK_POLL, "A+P  "},
+    {SIR_MAC_DATA_QOS_DATA, "QDATA"},
+    {SIR_MAC_DATA_QOS_DATA_ACK, "QD+A "},
+    {SIR_MAC_DATA_QOS_DATA_POLL, "QD+P "},
+    {SIR_MAC_DATA_QOS_DATA_ACK_POLL, "QD+AP"},
+    {SIR_MAC_DATA_QOS_NULL, "QNULL"},
+    {SIR_MAC_DATA_QOS_NULL_POLL, "QACK "},
+    {SIR_MAC_DATA_QOS_NULL_ACK_POLL, "Q+A+P"}
+};
+
+static tLogdRegList mgmtType[] = {
+    {SIR_MAC_MGMT_BEACON, "BEACON   "},
+    {SIR_MAC_MGMT_ASSOC_REQ, "ASSOCREQ "},
+    {SIR_MAC_MGMT_ASSOC_RSP, "ASSOCRSP "},
+    {SIR_MAC_MGMT_REASSOC_RSP, "REASSRSP "},
+    {SIR_MAC_MGMT_REASSOC_REQ, "REASSREQ "},
+    {SIR_MAC_MGMT_PROBE_REQ, "PROBEREQ "},
+    {SIR_MAC_MGMT_PROBE_RSP, "PROBERSP "},
+    {SIR_MAC_MGMT_AUTH, "AUTH     "},
+    {SIR_MAC_MGMT_DEAUTH, "DEAUTH   "},
+    {SIR_MAC_MGMT_DISASSOC, "DISASSOC "},
+    {SIR_MAC_MGMT_ACTION, "ACTION   "}
+};
+
+static tLogdRegList ctlType[] = {
+    {SIR_MAC_CTRL_RTS, "RTS(CTL) "},
+    {SIR_MAC_CTRL_CTS, "CTS(CTL) "},
+    {SIR_MAC_CTRL_ACK, "ACK(CTL) "},
+    {SIR_MAC_CTRL_PS_POLL, "PS-POLL  "},
+    {SIR_MAC_CTRL_BAR, "BAR      "},
+    {SIR_MAC_CTRL_BA,  "BA       "},
+    {SIR_MAC_CTRL_CF_END,"CF-END   "},
+    {SIR_MAC_CTRL_CF_END_ACK,"CFE+ACK  "}
+};
+
+static char * printMesgName(tpAniSirGlobal pMac, char *p, tANI_U32 type, tANI_U32 subType, tANI_U32 tcId)
+{
+    tLogdRegList *pEntry = NULL;
+    tANI_U32 nEntries, i;
+
+    switch (type)
+    {
+        case SIR_MAC_DATA_FRAME:
+            pEntry   = &dataType[0];
+            nEntries = sizeof(dataType)/sizeof(dataType[0]);
+            break;
+        case SIR_MAC_MGMT_FRAME:
+            pEntry   = &mgmtType[0];
+            nEntries = sizeof(mgmtType)/sizeof(mgmtType[0]);
+            break;
+        case SIR_MAC_CTRL_FRAME:
+            pEntry   = &ctlType[0];
+            nEntries = sizeof(ctlType)/sizeof(ctlType[0]);
+            break;
+        default:
+            p += log_sprintf( pMac, p, "RESERVED ");
+            return p;
+    }
+
+    for (i=0; i < nEntries; i++, pEntry++) {
+        if (pEntry->addr == subType) {
+            p += log_sprintf( pMac, p, "%s", pEntry->name);
+            break;
+        }
+    }
+
+    if (i >= nEntries)
+        p += log_sprintf( pMac, p, "RESERVED ");
+
+    if (type == SIR_MAC_DATA_FRAME)
+        p += log_sprintf( pMac, p, "(%d) ", tcId);
+    return p;
+}
+
+char * dump_thread_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tANI_U32 i, j;
+
+    p += log_sprintf( pMac, p, "\n**** BBT RECEIVE **** \n");
+    p += log_sprintf( pMac, p, "\nBBT CRC errors received   : %d\n",
+            pMac->sys.gSysBbtCrcFail);
+    p += log_sprintf( pMac, p, "BBT duplicates received   : %d\n",
+            pMac->sys.gSysBbtDuplicates);
+    p += log_sprintf( pMac, p, "BBT total frames received : %d\n",
+            pMac->sys.gSysBbtReceived);
+    p += log_sprintf( pMac, p, "\tPosted to LIM : %d\n",
+            pMac->sys.gSysBbtPostedToLim);
+    p += log_sprintf( pMac, p, "\tPosted to SCH : %d\n",
+            pMac->sys.gSysBbtPostedToSch);
+    p += log_sprintf( pMac, p, "\tPosted to PMM : %d\n",
+            pMac->sys.gSysBbtPostedToPmm);
+    p += log_sprintf( pMac, p, "\tPosted to HAL : %d\n",
+            pMac->sys.gSysBbtPostedToHal);
+    p += log_sprintf( pMac, p, "\tDropped       : %d\n",
+            pMac->sys.gSysBbtDropped);
+    p += log_sprintf( pMac, p, "\t\tLearn mode frame out of learn mode : %d\n",
+            pMac->sys.gSysBbtLearnFrameInv);
+    p += log_sprintf( pMac, p, "\t\tNon-learn mode frame in learn mode : %d\n",
+            pMac->sys.gSysBbtNonLearnFrameInv);
+
+    p += log_sprintf( pMac, p, "\nMGMT RX frame counts\n");
+    for (i = 0; i < 16; i++) {
+        if (pMac->sys.gSysFrameCount[0][i]) {
+            p += log_sprintf( pMac, p, "\t");
+            p = printMesgName( pMac, p, 0, i, 0);
+            p += log_sprintf( pMac, p, "[%d] %d\n", i, pMac->sys.gSysFrameCount[0][i]);
+        }
+    }
+
+    p += log_sprintf( pMac, p, "CTRL RX frame counts\n");
+
+    for (i = 0; i < 16; i++) {
+        if (pMac->sys.gSysFrameCount[1][i]) {
+            p += log_sprintf( pMac, p, "\t");
+            p = printMesgName(pMac, p, 1, i, 0);
+            p += log_sprintf( pMac, p, "[%d] %d\n", i, pMac->sys.gSysFrameCount[1][i]);
+        }
+    }
+
+    p += log_sprintf( pMac, p, "DATA RX frame counts\n");
+    for (i = 0; i < 16; i++) {
+        if (pMac->sys.gSysFrameCount[2][i]) {
+            p += log_sprintf( pMac, p, "\t");
+            p = printMesgName(pMac, p, 2, i, 0);
+            p += log_sprintf( pMac, p, "[%d] %d\n", i,
+                    pMac->sys.gSysFrameCount[2][i]);
+        }
+    }
+
+    if (pMac->sch.gSchBBXportRcvCnt) {
+        p += log_sprintf( pMac, p, "\nSCH processed messages : %d\n",
+                pMac->sch.gSchBBXportRcvCnt);
+        p += log_sprintf( pMac, p, "\tBeacons  : %d\n", pMac->sch.gSchBcnRcvCnt);
+        p += log_sprintf( pMac, p, "\t\tignored  : %d\n", pMac->sch.gSchBcnIgnored);
+        p += log_sprintf( pMac, p, "\t\tin error : %d\n", pMac->sch.gSchBcnParseErrorCnt);
+        p += log_sprintf( pMac, p, "\tQoS null : %d\n", pMac->sch.gSchRRRcvCnt);
+        p += log_sprintf( pMac, p, "\tDropped  : %d\n", pMac->sch.gSchUnknownRcvCnt);
+    }
+
+
+    p += log_sprintf( pMac, p, "\nLIM processed messages : %d\n", pMac->lim.numTot);
+    if (pMac->lim.numTot) {
+        p += log_sprintf( pMac, p, "\tSME Messages (HDD) : %d\n", pMac->lim.numSme);
+        p += log_sprintf( pMac, p, "\tMAC Messages (BBT) : %d\n", pMac->lim.numBbt);
+        p += log_sprintf( pMac, p, "\t\tBad Protocol\t: %d\n", pMac->lim.numProtErr);
+        p += log_sprintf( pMac, p, "\t\tIn Learn mode\t: %d (ignored %d)\n",
+                pMac->lim.numLearn, pMac->lim.numLearnIgnore);
+
+        for (i=0; i<4; i++) {
+            for (j=0; j<16; j++) {
+                if (pMac->lim.numMAC[i][j]) {
+                    p += log_sprintf( pMac, p, "\t\t");
+                    p = printMesgName(pMac, p, i, j, 0);
+                    p += log_sprintf( pMac, p, "\t: %d\n", pMac->lim.numMAC[i][j]);
+                }
+            }
+        }
+
+        p += log_sprintf( pMac, p, "\tBeacons received : %d\n", pMac->lim.gLimNumBeaconsRcvd);
+        p += log_sprintf( pMac, p, "\t\tIgnored : %d\n", pMac->lim.gLimNumBeaconsIgnored);
+    }
+
+    if (pMac->sys.gSysFrameCount[SIR_MAC_MGMT_FRAME][SIR_MAC_MGMT_PROBE_REQ]) {
+        p += log_sprintf( pMac, p, "\nProbe Requests Received: %d\n",
+                pMac->sys.gSysFrameCount[SIR_MAC_MGMT_FRAME][SIR_MAC_MGMT_PROBE_REQ]);
+        p += log_sprintf( pMac, p, "\tIgnored  \t: %d\n", pMac->sys.probeIgnore);
+        p += log_sprintf( pMac, p, "\tSSID miss\t: %d\n", pMac->sys.probeBadSsid);
+        p += log_sprintf( pMac, p, "\tParse err\t: %d\n", pMac->sys.probeError);
+        p += log_sprintf( pMac, p, "\tResponded\t: %d\n", pMac->sys.probeRespond);
+    }
+
+    return p;
+}
+#endif
+
+/* Initialize the index */
+void logDumpInit(tpAniSirGlobal pMac)
+{
+    pMac->dumpTablecurrentId = 0;
+
+}
+
+void logDumpRegisterTable( tpAniSirGlobal pMac, tDumpFuncEntry *pEntry, tANI_U32   nItems )
+{
+
+    pMac->dumpTableEntry[pMac->dumpTablecurrentId]->nItems = nItems;
+    pMac->dumpTableEntry[pMac->dumpTablecurrentId]->mindumpid = pEntry->id;
+    pMac->dumpTableEntry[pMac->dumpTablecurrentId]->maxdumpid = (pEntry + (nItems-1))->id;
+    pMac->dumpTableEntry[pMac->dumpTablecurrentId]->dumpTable = pEntry;
+    pMac->dumpTablecurrentId++;
+}
+
+
+/*
+ * print nItems from the menu list ponted to by m
+ */
+static tANI_U32 print_menu(tpAniSirGlobal pMac, char  *p, tANI_U32 startId)
+{
+    tANI_U32 currentId = 0;
+    tANI_U32 i, j;
+    tANI_S32 ret = 0;
+    tDumpFuncEntry *pEntry = NULL;
+    tANI_U32 nItems = 0;
+
+    for(i = 0; i < pMac->dumpTablecurrentId; i++) {
+        pEntry = pMac->dumpTableEntry[i]->dumpTable;
+        nItems = pMac->dumpTableEntry[i]->nItems;
+
+        for (j = 0; j < nItems; j++, pEntry++) {
+            if (pEntry->description == NULL) 
+                continue;
+
+            if (pEntry->id == 0) {
+                ret = log_sprintf( pMac,p, "---- %s\n", pEntry->description); 
+
+                if (ret <= 0)
+                    break;
+
+                p += ret;
+                continue;
+            }
+
+            if (pEntry->id < startId)
+                continue;
+
+            ret = log_sprintf(pMac, p, "%4d\t%s\n", pEntry->id, pEntry->description);
+
+            if (ret <= 0)
+                break;
+
+            currentId = pEntry->id;
+            p += ret;
+        }
+
+        if (ret <= 0)
+            break;
+    }
+
+    return currentId;
+}
+
+int logRtaiDump( tpAniSirGlobal pMac, tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, tANI_U8 *pBuf)
+{
+    char *p = (char *)pBuf;
+    tANI_U32 i;
+    tANI_U32 nItems = 0;
+    tDumpFuncEntry *pEntry = NULL;
+
+    pMac->gCurrentLogSize = 0;
+    if (debug) {
+        p += log_sprintf( pMac,p, "Cmd = %d Args (0x%x,0x%x,0x%x,0x%x)\n\n",
+                cmd, arg1, arg2, arg3, arg4);
+    }
+
+    if( cmd == MAX_DUMP_CMD || cmd == 0 ) {
+        pMac->menuCurrent = print_menu(pMac, p, pMac->menuCurrent);
+        return pMac->gCurrentLogSize;
+    }
+    if(cmd <= HAL_LOG_DUMP_CMD_END)
+    {
+       WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, p);
+    }
+    else
+    {
+       for(i = 0; i < pMac->dumpTablecurrentId; i++) {
+           if( (cmd > pMac->dumpTableEntry[i]->mindumpid) && (cmd <= pMac->dumpTableEntry[i]->maxdumpid)) {
+               pEntry = pMac->dumpTableEntry[i]->dumpTable;
+               nItems = pMac->dumpTableEntry[i]->nItems;
+               break;
+           } else {
+               continue;
+           }
+       }
+       
+       if((nItems > 0) && (pEntry != NULL)) {
+           for (i = 0; i < nItems; i++, pEntry++) {
+               if( cmd == pEntry->id ) {
+                   if ( pEntry->func != NULL ) {
+                       pEntry->func(pMac, arg1, arg2, arg3, arg4, p);
+                   } else {
+                       p += log_sprintf( pMac,p, "Cmd not supported\n");
+                   }
+                   break;
+               }
+           }
+       } else {
+           p += log_sprintf( pMac,p, "Cmd not found \n");
+       }
+    }
+    if (debug)
+        p += log_sprintf( pMac,p, "Returned %d bytes\n", pMac->gCurrentLogSize);
+
+    return pMac->gCurrentLogSize;
+
+}
+
+#endif
diff --git a/CORE/SYS/legacy/src/utils/src/macTrace.c b/CORE/SYS/legacy/src/utils/src/macTrace.c
new file mode 100644
index 0000000..96f4885
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/macTrace.c
@@ -0,0 +1,669 @@
+/*
+ * 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.c
+
+  \brief implementation for trace related APIs
+
+  \author Sunit Bhatia
+
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+#include "macTrace.h"
+
+
+#ifdef TRACE_RECORD
+static tTraceRecord gTraceTbl[MAX_TRACE_RECORDS];
+static tTraceData gTraceData;
+static tpTraceCb traceCBTable[VOS_MODULE_ID_MAX];
+
+
+
+
+
+tANI_U8* macTraceGetSmeMsgString( tANI_U16 smeMsg )
+{
+    switch( smeMsg )
+    {
+        CASE_RETURN_STRING(eWNI_SME_START_REQ);
+        CASE_RETURN_STRING(eWNI_SME_START_RSP);
+        CASE_RETURN_STRING(eWNI_SME_SYS_READY_IND);
+        CASE_RETURN_STRING(eWNI_SME_SCAN_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SCAN_ABORT_IND);
+        CASE_RETURN_STRING(eWNI_SME_SCAN_RSP);
+        CASE_RETURN_STRING(eWNI_SME_JOIN_REQ);
+        CASE_RETURN_STRING(eWNI_SME_JOIN_RSP);
+        CASE_RETURN_STRING(eWNI_SME_SETCONTEXT_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SETCONTEXT_RSP);
+        CASE_RETURN_STRING(eWNI_SME_REASSOC_REQ);
+        CASE_RETURN_STRING(eWNI_SME_REASSOC_RSP);
+        CASE_RETURN_STRING(eWNI_SME_AUTH_REQ);
+        CASE_RETURN_STRING(eWNI_SME_AUTH_RSP);
+        CASE_RETURN_STRING(eWNI_SME_DISASSOC_REQ);
+        CASE_RETURN_STRING(eWNI_SME_DISASSOC_RSP);
+        CASE_RETURN_STRING(eWNI_SME_DISASSOC_IND);
+        CASE_RETURN_STRING(eWNI_SME_DISASSOC_CNF);
+        CASE_RETURN_STRING(eWNI_SME_DEAUTH_REQ);
+        CASE_RETURN_STRING(eWNI_SME_DEAUTH_RSP);
+        CASE_RETURN_STRING(eWNI_SME_DEAUTH_IND);
+        CASE_RETURN_STRING(eWNI_SME_WM_STATUS_CHANGE_NTF);
+        CASE_RETURN_STRING(eWNI_SME_IBSS_NEW_PEER_IND);
+        CASE_RETURN_STRING(eWNI_SME_IBSS_PEER_DEPARTED_IND);
+        CASE_RETURN_STRING(eWNI_SME_START_BSS_REQ);
+        CASE_RETURN_STRING(eWNI_SME_START_BSS_RSP);
+        CASE_RETURN_STRING(eWNI_SME_AUTH_IND);
+        CASE_RETURN_STRING(eWNI_SME_ASSOC_IND);
+        CASE_RETURN_STRING(eWNI_SME_ASSOC_CNF);
+        CASE_RETURN_STRING(eWNI_SME_REASSOC_IND);
+        CASE_RETURN_STRING(eWNI_SME_REASSOC_CNF);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_RSP);
+        CASE_RETURN_STRING(eWNI_SME_STOP_BSS_REQ);
+        CASE_RETURN_STRING(eWNI_SME_STOP_BSS_RSP);
+        CASE_RETURN_STRING(eWNI_SME_DEL_BA_PEER_IND);
+        CASE_RETURN_STRING(eWNI_SME_PROMISCUOUS_MODE_REQ);
+        CASE_RETURN_STRING(eWNI_SME_PROMISCUOUS_MODE_RSP);
+        CASE_RETURN_STRING(eWNI_SME_NEIGHBOR_BSS_IND);
+        CASE_RETURN_STRING(eWNI_SME_MEASUREMENT_REQ);
+        CASE_RETURN_STRING(eWNI_SME_MEASUREMENT_RSP);
+        CASE_RETURN_STRING(eWNI_SME_MEASUREMENT_IND);
+        CASE_RETURN_STRING(eWNI_SME_SET_WDS_INFO_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SET_WDS_INFO_RSP);
+        CASE_RETURN_STRING(eWNI_SME_WDS_INFO_IND);
+        CASE_RETURN_STRING(eWNI_SME_DEAUTH_CNF);
+        CASE_RETURN_STRING(eWNI_SME_MIC_FAILURE_IND);
+        CASE_RETURN_STRING(eWNI_SME_ADDTS_REQ);
+        CASE_RETURN_STRING(eWNI_SME_ADDTS_RSP);
+        CASE_RETURN_STRING(eWNI_SME_ADDTS_CNF);
+        CASE_RETURN_STRING(eWNI_SME_ADDTS_IND);
+        CASE_RETURN_STRING(eWNI_SME_DELTS_REQ);
+        CASE_RETURN_STRING(eWNI_SME_DELTS_RSP);
+        CASE_RETURN_STRING(eWNI_SME_DELTS_IND);
+        CASE_RETURN_STRING(eWNI_SME_SET_BACKGROUND_SCAN_MODE_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_CB_PRIMARY_RSP);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SWITCH_CHL_CB_SECONDARY_RSP);
+        CASE_RETURN_STRING(eWNI_SME_PROBE_REQ);
+        CASE_RETURN_STRING(eWNI_SME_STA_STAT_REQ);
+        CASE_RETURN_STRING(eWNI_SME_STA_STAT_RSP);
+        CASE_RETURN_STRING(eWNI_SME_AGGR_STAT_REQ);
+        CASE_RETURN_STRING(eWNI_SME_AGGR_STAT_RSP);
+        CASE_RETURN_STRING(eWNI_SME_GLOBAL_STAT_REQ);
+        CASE_RETURN_STRING(eWNI_SME_GLOBAL_STAT_RSP);
+        CASE_RETURN_STRING(eWNI_SME_STAT_SUMM_REQ);
+        CASE_RETURN_STRING(eWNI_SME_STAT_SUMM_RSP);
+        CASE_RETURN_STRING(eWNI_SME_REMOVEKEY_REQ);
+        CASE_RETURN_STRING(eWNI_SME_REMOVEKEY_RSP);
+        CASE_RETURN_STRING(eWNI_SME_GET_SCANNED_CHANNEL_REQ);
+        CASE_RETURN_STRING(eWNI_SME_GET_SCANNED_CHANNEL_RSP);
+        CASE_RETURN_STRING(eWNI_SME_SET_TX_POWER_REQ);
+        CASE_RETURN_STRING(eWNI_SME_SET_TX_POWER_RSP);
+        CASE_RETURN_STRING(eWNI_SME_GET_TX_POWER_REQ);
+        CASE_RETURN_STRING(eWNI_SME_GET_TX_POWER_RSP);
+        CASE_RETURN_STRING(eWNI_SME_GET_NOISE_REQ);
+        CASE_RETURN_STRING(eWNI_SME_GET_NOISE_RSP);
+        CASE_RETURN_STRING(eWNI_SME_LOW_RSSI_IND);
+        CASE_RETURN_STRING(eWNI_SME_GET_STATISTICS_REQ);
+        CASE_RETURN_STRING(eWNI_SME_GET_STATISTICS_RSP);        
+
+        CASE_RETURN_STRING(eWNI_SME_MSG_TYPES_END);
+
+        //General Power Save Messages
+        CASE_RETURN_STRING(eWNI_PMC_PWR_SAVE_CFG);
+
+        //BMPS Messages
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_BMPS_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_BMPS_RSP);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_BMPS_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_BMPS_RSP);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_BMPS_IND);
+
+        //IMPS Messages.
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_IMPS_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_IMPS_RSP);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_IMPS_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_IMPS_RSP);
+
+        //UAPSD Messages
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_UAPSD_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_ENTER_UAPSD_RSP);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_UAPSD_REQ);
+        CASE_RETURN_STRING(eWNI_PMC_EXIT_UAPSD_RSP);
+
+        CASE_RETURN_STRING(eWNI_PMC_SMPS_STATE_IND);
+
+        default:
+            return( (tANI_U8*)"UNKNOWN" );
+            break;
+    }
+}
+
+
+tANI_U8* macTraceGetHalMsgString( tANI_U16 halMsg )
+{
+    switch( halMsg )
+    {
+
+        CASE_RETURN_STRING(SIR_HAL_RADAR_DETECTED_IND);
+        CASE_RETURN_STRING(SIR_HAL_WDT_KAM_RSP                );
+        CASE_RETURN_STRING(SIR_HAL_TIMER_TEMP_MEAS_REQ        );
+        CASE_RETURN_STRING(SIR_HAL_TIMER_PERIODIC_STATS_COLLECT_REQ   );
+        CASE_RETURN_STRING(SIR_HAL_CAL_REQ_NTF                );
+        CASE_RETURN_STRING(SIR_HAL_MNT_OPEN_TPC_TEMP_MEAS_REQ );
+        CASE_RETURN_STRING(SIR_HAL_CCA_MONITOR_INTERVAL_TO    );
+        CASE_RETURN_STRING(SIR_HAL_CCA_MONITOR_DURATION_TO    );
+        CASE_RETURN_STRING(SIR_HAL_CCA_MONITOR_START          );
+        CASE_RETURN_STRING(SIR_HAL_CCA_MONITOR_STOP           );
+        CASE_RETURN_STRING(SIR_HAL_CCA_CHANGE_MODE            );
+
+        CASE_RETURN_STRING(SIR_HAL_ADD_STA_REQ                );
+        CASE_RETURN_STRING(SIR_HAL_ADD_STA_RSP                );
+        CASE_RETURN_STRING(SIR_HAL_DELETE_STA_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_DELETE_STA_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_ADD_BSS_REQ                );
+        CASE_RETURN_STRING(SIR_HAL_ADD_BSS_RSP                );
+        CASE_RETURN_STRING(SIR_HAL_DELETE_BSS_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_DELETE_BSS_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_INIT_SCAN_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_INIT_SCAN_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_START_SCAN_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_START_SCAN_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_END_SCAN_REQ               );
+        CASE_RETURN_STRING(SIR_HAL_END_SCAN_RSP               );
+        CASE_RETURN_STRING(SIR_HAL_FINISH_SCAN_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_FINISH_SCAN_RSP            );
+        CASE_RETURN_STRING(SIR_HAL_SEND_BEACON_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_SEND_BEACON_RSP            );
+
+        CASE_RETURN_STRING(SIR_HAL_INIT_CFG_REQ               );
+        CASE_RETURN_STRING(SIR_HAL_INIT_CFG_RSP               );
+
+        CASE_RETURN_STRING(SIR_HAL_INIT_WM_CFG_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_INIT_WM_CFG_RSP            );
+
+        CASE_RETURN_STRING(SIR_HAL_SET_BSSKEY_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_SET_BSSKEY_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_SET_STAKEY_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_SET_STAKEY_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_DPU_STATS_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_DPU_STATS_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_GET_DPUINFO_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_GET_DPUINFO_RSP            );
+
+        CASE_RETURN_STRING(SIR_HAL_UPDATE_EDCA_PROFILE_IND    );
+
+        CASE_RETURN_STRING(SIR_HAL_UPDATE_STARATEINFO_REQ     );
+        CASE_RETURN_STRING(SIR_HAL_UPDATE_STARATEINFO_RSP     );
+
+        CASE_RETURN_STRING(SIR_HAL_UPDATE_BEACON_IND          );
+        CASE_RETURN_STRING(SIR_HAL_UPDATE_CF_IND              );
+        CASE_RETURN_STRING(SIR_HAL_CHNL_SWITCH_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_SWITCH_CHANNEL_RSP         );
+        CASE_RETURN_STRING(SIR_HAL_ADD_TS_REQ                 );
+        CASE_RETURN_STRING(SIR_HAL_DEL_TS_REQ                 );
+        CASE_RETURN_STRING(SIR_HAL_ADD_TS_RSP);
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_TXSTAT_REPORT      );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_BMPS_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_BMPS_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_BMPS_IND              );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_BMPS_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_BMPS_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_BMPS_STATUS_IND            );
+        CASE_RETURN_STRING(SIR_HAL_MISSED_BEACON_IND          );
+
+        CASE_RETURN_STRING(SIR_HAL_PWR_SAVE_CFG               );
+
+        CASE_RETURN_STRING(SIR_HAL_REGISTER_PE_CALLBACK       );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_MEM_READREQUEST    );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_MEM_WRITEREQUEST   );
+
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_MEM_READRESPONSE   );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_BULKREGWRITE_CONFIRM      );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_BULKREGREAD_RESPONSE      );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_HOSTMESG_MSGPROCESSRESULT );
+
+        CASE_RETURN_STRING(SIR_HAL_ADDBA_REQ                  );
+        CASE_RETURN_STRING(SIR_HAL_ADDBA_RSP                  );
+        CASE_RETURN_STRING(SIR_HAL_DELBA_IND                  );
+
+        CASE_RETURN_STRING(SIR_HAL_DELBA_REQ                  );
+        CASE_RETURN_STRING(SIR_HAL_IBSS_STA_ADD               );
+        CASE_RETURN_STRING(SIR_HAL_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND   );
+        CASE_RETURN_STRING(SIR_HAL_SET_LINK_STATE             );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_IMPS_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_IMPS_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_IMPS_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_IMPS_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_SOFTMAC_HOSTMESG_PS_STATUS_IND  );
+        CASE_RETURN_STRING(SIR_HAL_POSTPONE_ENTER_IMPS_RSP    );
+        CASE_RETURN_STRING(SIR_HAL_STA_STAT_REQ               );
+        CASE_RETURN_STRING(SIR_HAL_GLOBAL_STAT_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_AGGR_STAT_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_STA_STAT_RSP               );
+        CASE_RETURN_STRING(SIR_HAL_GLOBAL_STAT_RSP            );
+        CASE_RETURN_STRING(SIR_HAL_AGGR_STAT_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_STAT_SUMM_REQ              );
+        CASE_RETURN_STRING(SIR_HAL_STAT_SUMM_RSP              );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_BSSKEY_REQ          );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_BSSKEY_RSP          );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_STAKEY_REQ          );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_STAKEY_RSP          );
+        CASE_RETURN_STRING(SIR_HAL_SET_STA_BCASTKEY_REQ       );
+        CASE_RETURN_STRING(SIR_HAL_SET_STA_BCASTKEY_RSP       );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_STA_BCASTKEY_REQ    );
+        CASE_RETURN_STRING(SIR_HAL_REMOVE_STA_BCASTKEY_RSP    );
+
+        CASE_RETURN_STRING(SIR_HAL_DPU_MIC_ERROR              );
+
+        CASE_RETURN_STRING(SIR_HAL_TIMER_BA_ACTIVITY_REQ      );
+        CASE_RETURN_STRING(SIR_HAL_TIMER_CHIP_MONITOR_TIMEOUT );
+        CASE_RETURN_STRING(SIR_HAL_TIMER_TRAFFIC_ACTIVITY_REQ );
+        CASE_RETURN_STRING(SIR_HAL_SET_MIMOPS_REQ                      );
+        CASE_RETURN_STRING(SIR_HAL_SET_MIMOPS_RSP                      );
+        CASE_RETURN_STRING(SIR_HAL_SYS_READY_IND                       );
+        CASE_RETURN_STRING(SIR_HAL_SET_TX_POWER_REQ                    );
+        CASE_RETURN_STRING(SIR_HAL_SET_TX_POWER_RSP                    );
+        CASE_RETURN_STRING(SIR_HAL_GET_TX_POWER_REQ                    );
+        CASE_RETURN_STRING(SIR_HAL_GET_TX_POWER_RSP                    );
+        CASE_RETURN_STRING(SIR_HAL_GET_NOISE_REQ                       );
+        CASE_RETURN_STRING(SIR_HAL_GET_NOISE_RSP                       );
+
+        CASE_RETURN_STRING(SIR_HAL_TRANSMISSION_CONTROL_IND            );
+        CASE_RETURN_STRING(SIR_HAL_INIT_RADAR_IND                      );
+
+        CASE_RETURN_STRING(SIR_HAL_BEACON_PRE_IND             );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_UAPSD_REQ            );
+        CASE_RETURN_STRING(SIR_HAL_ENTER_UAPSD_RSP            );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_UAPSD_REQ             );
+        CASE_RETURN_STRING(SIR_HAL_EXIT_UAPSD_RSP             );
+        CASE_RETURN_STRING(SIR_HAL_LOW_RSSI_IND               );
+        CASE_RETURN_STRING(SIR_HAL_GET_STATISTICS_RSP         );
+
+#ifdef SUPPORT_BEACON_FILTER
+        CASE_RETURN_STRING(SIR_HAL_BEACON_FILTER_IND   );
+#endif //SUPPORT_BEACON_FILTER
+        default:
+            return((tANI_U8*) "UNKNOWN" );
+            break;
+    }
+}
+
+
+
+tANI_U8* macTraceGetLimMsgString( tANI_U16 limMsg )
+{
+    switch( limMsg )
+    {
+         CASE_RETURN_STRING(SIR_LIM_RESUME_ACTIVITY_NTF);
+        CASE_RETURN_STRING(SIR_LIM_SUSPEND_ACTIVITY_REQ );
+        CASE_RETURN_STRING(SIR_HAL_SUSPEND_ACTIVITY_RSP );
+        CASE_RETURN_STRING(SIR_LIM_RETRY_INTERRUPT_MSG);
+        CASE_RETURN_STRING(SIR_BB_XPORT_MGMT_MSG );
+        CASE_RETURN_STRING(SIR_LIM_INV_KEY_INTERRUPT_MSG );
+        CASE_RETURN_STRING(SIR_LIM_KEY_ID_INTERRUPT_MSG );
+        CASE_RETURN_STRING(SIR_LIM_REPLAY_THRES_INTERRUPT_MSG );
+        CASE_RETURN_STRING(SIR_LIM_TD_DUMMY_CALLBACK_MSG );
+        CASE_RETURN_STRING(SIR_LIM_SCH_CLEAN_MSG  );
+        CASE_RETURN_STRING(SIR_LIM_RADAR_DETECT_IND);
+        CASE_RETURN_STRING(SIR_LIM_DEL_TS_IND);
+        CASE_RETURN_STRING(SIR_LIM_ADD_BA_IND );
+        CASE_RETURN_STRING(SIR_LIM_DEL_BA_ALL_IND);
+        CASE_RETURN_STRING(SIR_LIM_DELETE_STA_CONTEXT_IND);
+        CASE_RETURN_STRING(SIR_LIM_DEL_BA_IND );
+        CASE_RETURN_STRING(SIR_LIM_MIN_CHANNEL_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_MAX_CHANNEL_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_JOIN_FAIL_TIMEOUT );
+        CASE_RETURN_STRING(SIR_LIM_AUTH_FAIL_TIMEOUT );
+        CASE_RETURN_STRING(SIR_LIM_AUTH_RSP_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_ASSOC_FAIL_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_REASSOC_FAIL_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_HEART_BEAT_TIMEOUT);
+#if (WNI_POLARIS_FW_PRODUCT == AP)
+        CASE_RETURN_STRING(SIR_LIM_PREAUTH_CLNUP_TIMEOUT);
+#endif
+        CASE_RETURN_STRING(SIR_LIM_CHANNEL_SCAN_TIMEOUT );
+        CASE_RETURN_STRING(SIR_LIM_PROBE_HB_FAILURE_TIMEOUT);
+        CASE_RETURN_STRING(SIR_LIM_ADDTS_RSP_TIMEOUT );
+#if (WNI_POLARIS_FW_PRODUCT == AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+        CASE_RETURN_STRING(SIR_LIM_MEASUREMENT_IND_TIMEOUT  );
+        CASE_RETURN_STRING(SIR_LIM_LEARN_INTERVAL_TIMEOUT   );
+        CASE_RETURN_STRING(SIR_LIM_LEARN_DURATION_TIMEOUT   );
+#endif
+        CASE_RETURN_STRING(SIR_LIM_LINK_TEST_DURATION_TIMEOUT );
+        CASE_RETURN_STRING(SIR_LIM_HASH_MISS_THRES_TIMEOUT  );
+        CASE_RETURN_STRING(SIR_LIM_CNF_WAIT_TIMEOUT         );
+        CASE_RETURN_STRING(SIR_LIM_KEEPALIVE_TIMEOUT        );
+        CASE_RETURN_STRING(SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT );
+        CASE_RETURN_STRING(SIR_LIM_CHANNEL_SWITCH_TIMEOUT   );
+        CASE_RETURN_STRING(SIR_LIM_QUIET_TIMEOUT            );
+        CASE_RETURN_STRING(SIR_LIM_QUIET_BSS_TIMEOUT      );
+#ifdef WMM_APSD
+        CASE_RETURN_STRING(SIR_LIM_WMM_APSD_SP_START_MSG_TYPE );
+        CASE_RETURN_STRING(SIR_LIM_WMM_APSD_SP_END_MSG_TYPE );
+#endif
+        CASE_RETURN_STRING(SIR_LIM_BEACON_GEN_IND );
+        CASE_RETURN_STRING(SIR_LIM_MSG_TYPES_END);
+
+        default:
+            return( (tANI_U8*)"UNKNOWN" );
+            break;
+    }
+}
+
+
+
+
+tANI_U8* macTraceGetCfgMsgString( tANI_U16 cfgMsg )
+{
+    switch( cfgMsg )
+    {
+        CASE_RETURN_STRING(WNI_CFG_PARAM_UPDATE_IND);
+        CASE_RETURN_STRING(WNI_CFG_DNLD_REQ);
+        CASE_RETURN_STRING(WNI_CFG_DNLD_CNF);
+        CASE_RETURN_STRING(WNI_CFG_GET_RSP);
+        CASE_RETURN_STRING(WNI_CFG_SET_CNF);
+        CASE_RETURN_STRING(SIR_CFG_PARAM_UPDATE_IND);
+        CASE_RETURN_STRING(SIR_CFG_DOWNLOAD_COMPLETE_IND);
+
+        CASE_RETURN_STRING(WNI_CFG_SET_REQ_NO_RSP);
+        default:
+            return( (tANI_U8*)"UNKNOWN" );
+            break;
+    }
+}
+
+
+tANI_U8* macTraceGetModuleString( tANI_U8 moduleId  )
+{
+    return ((tANI_U8*)"PE");
+    //return gVosTraceInfo[moduleId].moduleNameStr;
+}
+
+
+
+
+
+
+
+
+
+
+void macTraceInit(tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+    gTraceData.head = INVALID_TRACE_ADDR;
+    gTraceData.tail = INVALID_TRACE_ADDR;
+    gTraceData.num = 0;
+    gTraceData.enable = TRUE;
+    gTraceData.dumpCount = DEFAULT_TRACE_DUMP_COUNT;
+    gTraceData.numSinceLastDump = 0;
+
+    for(i=0; i<VOS_MODULE_ID_MAX; i++)
+        traceCBTable[i] = NULL;
+
+}
+
+
+
+
+
+void macTraceReset(tpAniSirGlobal pMac)
+{
+}
+
+
+void macTrace(tpAniSirGlobal pMac,  tANI_U8 code, tANI_U8 session, tANI_U32 data)
+{
+    //Today macTrace is being invoked by PE only, need to remove this function once PE is migrated to using new trace API.
+    macTraceNew(pMac, VOS_MODULE_ID_PE, code, session, data);
+
+#if 0
+    tpTraceRecord rec = NULL;
+
+    //limLog(pMac, LOGE, "mac Trace code: %d, data: %x, head: %d, tail: %d\n",  code, data, gTraceData.head, gTraceData.tail);
+
+    if(!gTraceData.enable)
+        return;
+    gTraceData.num++;
+
+    if (gTraceData.head == INVALID_TRACE_ADDR)
+    {
+        /* first record */
+        gTraceData.head = 0;
+        gTraceData.tail = 0;
+    }
+    else
+    {
+        /* queue is not empty */
+        tANI_U32 tail = gTraceData.tail + 1;
+
+        if (tail == MAX_TRACE_RECORDS)
+            tail = 0;
+
+        if (gTraceData.head == tail)
+        {
+            /* full */
+            if (++gTraceData.head == MAX_TRACE_RECORDS)
+                gTraceData.head = 0;
+        }
+
+        gTraceData.tail = tail;
+    }
+
+    rec = &gTraceTbl[gTraceData.tail];
+    rec->code = code;
+    rec->session = session;
+    rec->data = data;
+    rec->time = vos_timer_get_system_time();
+    rec->module =  VOS_MODULE_ID_PE;
+    gTraceData.numSinceLastDump ++;
+
+    if(gTraceData.numSinceLastDump == gTraceData.dumpCount)
+        {
+            limLog(pMac, LOGE, "Trace Dump last %d traces\n",  gTraceData.dumpCount);
+            macTraceDumpAll(pMac, 0, 0, gTraceData.dumpCount);
+            gTraceData.numSinceLastDump = 0;
+        }
+    #endif
+
+}
+
+
+
+void macTraceNew(tpAniSirGlobal pMac, tANI_U8 module, tANI_U8 code, tANI_U8 session, tANI_U32 data)
+{
+    tpTraceRecord rec = NULL;
+
+    //limLog(pMac, LOGE, "mac Trace code: %d, data: %x, head: %d, tail: %d\n",  code, data, gTraceData.head, gTraceData.tail);
+
+    if(!gTraceData.enable)
+        return;
+    //If module is not registered, don't record for that module.
+    if(traceCBTable[module] == NULL)
+        return;
+
+    
+    gTraceData.num++;
+
+    if (gTraceData.head == INVALID_TRACE_ADDR)
+    {
+        /* first record */
+        gTraceData.head = 0;
+        gTraceData.tail = 0;
+    }
+    else
+    {
+        /* queue is not empty */
+        tANI_U32 tail = gTraceData.tail + 1;
+
+        if (tail == MAX_TRACE_RECORDS)
+            tail = 0;
+
+        if (gTraceData.head == tail)
+        {
+            /* full */
+            if (++gTraceData.head == MAX_TRACE_RECORDS)
+                gTraceData.head = 0;
+        }
+
+        gTraceData.tail = tail;
+    }
+
+    rec = &gTraceTbl[gTraceData.tail];
+    rec->code = code;
+    rec->session = session;
+    rec->data = data;
+    rec->time = (tANI_U16)vos_timer_get_system_time();
+    rec->module =  module;
+    gTraceData.numSinceLastDump ++;
+
+    if(gTraceData.numSinceLastDump == gTraceData.dumpCount)
+        {
+             VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "Trace Dump last %d traces\n",  gTraceData.dumpCount);
+              macTraceDumpAll(pMac, 0, 0, gTraceData.dumpCount);
+              gTraceData.numSinceLastDump = 0;
+        }
+
+}
+
+
+
+
+
+
+
+tANI_U8* macTraceMsgString(tpAniSirGlobal pMac, tANI_U32 msgType)
+{
+    tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(msgType);
+    tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(msgType);
+
+    switch(moduleId)
+    {
+        case SIR_LIM_MODULE_ID:
+            if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN)
+                return macTraceGetLimMsgString((tANI_U16)msgType);
+            else
+                return macTraceGetSmeMsgString((tANI_U16)msgType);
+            break;
+        case SIR_HAL_MODULE_ID:
+                return macTraceGetHalMsgString((tANI_U16)msgType);
+        case SIR_CFG_MODULE_ID:
+                return macTraceGetCfgMsgString((tANI_U16)msgType);
+        default:
+                return ((tANI_U8*)"Unknown MsgType");
+    }
+}
+
+
+
+
+
+
+void macTraceDumpAll(tpAniSirGlobal pMac, tANI_U8 code, tANI_U8 session, tANI_U32 count)
+{
+    tpTraceRecord pRecord;
+    tANI_S32 i, tail;
+
+
+    if(!gTraceData.enable)
+    {
+        VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "Tracing Disabled \n");
+        return;
+    }
+
+    VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, 
+                            "Total Records: %d, Head: %d, Tail: %d\n", gTraceData.num, gTraceData.head, gTraceData.tail);
+
+    if (gTraceData.head != INVALID_TRACE_ADDR)
+    {
+
+        i = gTraceData.head;
+        tail = gTraceData.tail;
+
+        if (count)
+        {
+            if (count > gTraceData.num)
+                count = gTraceData.num;
+            if (count > MAX_TRACE_RECORDS)
+                count = MAX_TRACE_RECORDS;
+            if(tail >= (count + 1))
+            {
+                i = tail - count + 1;
+            }
+            else
+            {
+                i = MAX_TRACE_RECORDS - ((count + 1) - tail);
+            }
+        }
+
+        pRecord = &gTraceTbl[i];
+
+        for (;;)
+        {
+            if (   (code == 0 || (code == pRecord->code)) &&
+                    (traceCBTable[pRecord->module] != NULL))
+                traceCBTable[pRecord->module](pMac, pRecord, (tANI_U16)i);
+
+            if (i == tail)
+                break;
+            i += 1;
+
+            if (i == MAX_TRACE_RECORDS)
+            {
+                i = 0;
+                pRecord = &gTraceTbl[0];
+            }
+            else
+                pRecord += 1;
+        }
+        gTraceData.numSinceLastDump = 0;
+ 
+    }
+
+}
+
+
+void macTraceCfg(tpAniSirGlobal pMac, tANI_U32 enable, tANI_U32 dumpCount, tANI_U32 code, tANI_U32 session)
+{
+    gTraceData.enable = (tANI_U8)enable;
+    gTraceData.dumpCount= (tANI_U16)dumpCount;
+    gTraceData.numSinceLastDump = 0;
+}
+
+void macTraceRegister( tpAniSirGlobal pMac, VOS_MODULE_ID moduleId,    tpTraceCb traceCb)
+{
+    traceCBTable[moduleId] = traceCb;
+}
+
+
+#endif
diff --git a/CORE/SYS/legacy/src/utils/src/parserApi.c b/CORE/SYS/legacy/src/utils/src/parserApi.c
new file mode 100644
index 0000000..16d2730
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/parserApi.c
@@ -0,0 +1,4455 @@
+/*
+ * 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.cc contains the code for parsing
+ * 802.11 messages.
+ * Author:        Pierre Vandwalle
+ * Date:          03/18/02
+ * History:-
+ * Date           Modified by    Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "sirApi.h"
+#include "aniGlobal.h"
+#include "parserApi.h"
+#include "cfgApi.h"
+#include "limUtils.h"
+#include "utilsParser.h"
+#include "limSerDesUtils.h"
+#include "schApi.h"
+#include "palApi.h"
+#include "wmmApsd.h"
+#if defined WLAN_FEATURE_VOWIFI
+#include "rrmApi.h"
+#endif
+
+
+
+////////////////////////////////////////////////////////////////////////
+void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...) 
+{
+#ifdef WLAN_DEBUG
+    if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
+    {
+        return;
+    }
+    else
+    {
+        va_list         marker;
+
+        va_start( marker, pString );     /* Initialize variable arguments. */
+
+        logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
+
+        va_end( marker );              /* Reset variable arguments.      */
+    }
+#endif
+}
+
+void
+swapBitField16(tANI_U16 in, tANI_U16 *out)
+{
+#   ifdef ANI_LITTLE_BIT_ENDIAN
+    *out = in;
+#   else // Big-Endian...
+    *out = ( ( in & 0x8000 ) >> 15 ) |
+           ( ( in & 0x4000 ) >> 13 ) |
+           ( ( in & 0x2000 ) >> 11 ) |
+           ( ( in & 0x1000 ) >>  9 ) |
+           ( ( in & 0x0800 ) >>  7 ) |
+           ( ( in & 0x0400 ) >>  5 ) |
+           ( ( in & 0x0200 ) >>  3 ) |
+           ( ( in & 0x0100 ) >>  1 ) |
+           ( ( in & 0x0080 ) <<  1 ) |
+           ( ( in & 0x0040 ) <<  3 ) |
+           ( ( in & 0x0020 ) <<  5 ) |
+           ( ( in & 0x0010 ) <<  7 ) |
+           ( ( in & 0x0008 ) <<  9 ) |
+           ( ( in & 0x0004 ) << 11 ) |
+           ( ( in & 0x0002 ) << 13 ) |
+           ( ( in & 0x0001 ) << 15 );
+#   endif // ANI_LITTLE_BIT_ENDIAN
+}
+
+void
+swapBitField32(tANI_U32 in, tANI_U32 *out)
+{
+#   ifdef ANI_LITTLE_BIT_ENDIAN
+    *out = in;
+#   else // Big-Endian...
+    *out = ( ( in & 0x80000000 ) >> 31 ) |
+           ( ( in & 0x40000000 ) >> 29 ) |
+           ( ( in & 0x20000000 ) >> 27 ) |
+           ( ( in & 0x10000000 ) >> 25 ) |
+           ( ( in & 0x08000000 ) >> 23 ) |
+           ( ( in & 0x04000000 ) >> 21 ) |
+           ( ( in & 0x02000000 ) >> 19 ) |
+           ( ( in & 0x01000000 ) >> 17 ) |
+           ( ( in & 0x00800000 ) >> 15 ) |
+           ( ( in & 0x00400000 ) >> 13 ) |
+           ( ( in & 0x00200000 ) >> 11 ) |
+           ( ( in & 0x00100000 ) >>  9 ) |
+           ( ( in & 0x00080000 ) >>  7 ) |
+           ( ( in & 0x00040000 ) >>  5 ) |
+           ( ( in & 0x00020000 ) >>  3 ) |
+           ( ( in & 0x00010000 ) >>  1 ) |
+           ( ( in & 0x00008000 ) <<  1 ) |
+           ( ( in & 0x00004000 ) <<  3 ) |
+           ( ( in & 0x00002000 ) <<  5 ) |
+           ( ( in & 0x00001000 ) <<  7 ) |
+           ( ( in & 0x00000800 ) <<  9 ) |
+           ( ( in & 0x00000400 ) << 11 ) |
+           ( ( in & 0x00000200 ) << 13 ) |
+           ( ( in & 0x00000100 ) << 15 ) |
+           ( ( in & 0x00000080 ) << 17 ) |
+           ( ( in & 0x00000040 ) << 19 ) |
+           ( ( in & 0x00000020 ) << 21 ) |
+           ( ( in & 0x00000010 ) << 23 ) |
+           ( ( in & 0x00000008 ) << 25 ) |
+           ( ( in & 0x00000004 ) << 27 ) |
+           ( ( in & 0x00000002 ) << 29 ) |
+           ( ( in & 0x00000001 ) << 31 );
+#   endif // ANI_LITTLE_BIT_ENDIAN
+}
+
+inline static void __printWMMParams(tpAniSirGlobal  pMac, tDot11fIEWMMParams *pWmm)
+{
+    limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
+    limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
+           pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
+
+    limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
+           pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
+
+    limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
+           pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
+
+    limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
+           pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
+
+    return;
+}
+
+////////////////////////////////////////////////////////////////////////
+// Functions for populating "dot11f" style IEs
+
+
+// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
+//         < 0, cannot find
+int FindIELocation( tpAniSirGlobal pMac,
+                           tpSirRSNie pRsnIe,
+                           tANI_U8 EID)
+{
+    int idx, ieLen, bytesLeft;
+
+    // Here's what's going on: 'rsnIe' looks like this:
+
+    //     typedef struct sSirRSNie
+    //     {
+    //         tANI_U16       length;
+    //         tANI_U8        rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
+    //     } tSirRSNie, *tpSirRSNie;
+
+    // other code records both the WPA & RSN IEs (including their EIDs &
+    // lengths) into the array 'rsnIEdata'.  We may have:
+
+    //     With WAPI support, there may be 3 IEs here
+    //     It can be only WPA IE, or only RSN IE or only WAPI IE
+    //     Or two or all three of them with no particular ordering
+
+    // The if/then/else statements that follow are here to figure out
+    // whether we have the WPA IE, and where it is if we *do* have it.
+
+    //Save the first IE length 
+    ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
+    idx = 0;
+    bytesLeft = pRsnIe->length;
+
+    while( 1 )
+    {
+        if ( EID == pRsnIe->rsnIEdata[ idx ] )
+        {
+            //Found it
+            return (idx);
+        }
+        else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
+             // & if no more IE, 
+             bytesLeft <= (tANI_U16)( ieLen ) )
+        {
+            dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
+            return (-1);
+        }
+        bytesLeft -= ieLen;
+        ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
+        idx += ieLen;
+    }
+
+    return (-1);
+}
+
+
+tSirRetStatus
+PopulateDot11fCapabilities(tpAniSirGlobal         pMac,
+                           tDot11fFfCapabilities *pDot11f,
+                           tpPESession            psessionEntry)
+{
+    tANI_U16           cfg;
+    tSirRetStatus nSirStatus;
+
+    nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
+    if ( eSIR_SUCCESS != nSirStatus )
+    {
+        dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
+                               "itfield from CFG (%d).\n"), nSirStatus );
+        return nSirStatus;
+    }
+
+#if 0
+    if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
+    {
+        SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
+    }
+#endif
+    swapBitField16( cfg, ( tANI_U16* )pDot11f );
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fCapabilities.
+
+tSirRetStatus
+PopulateDot11fCapabilities2(tpAniSirGlobal         pMac,
+                            tDot11fFfCapabilities *pDot11f,
+                            tpDphHashNode          pSta, 
+                            tpPESession            psessionEntry)
+{
+    tANI_U16           cfg;
+    tSirRetStatus nSirStatus;
+    nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
+    if ( eSIR_SUCCESS != nSirStatus )
+    {
+        dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
+                               "itfield from CFG (%d).\n"), nSirStatus );
+        return nSirStatus;
+    }
+
+    if ( ( NULL != pSta ) && pSta->aniPeer &&
+         PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
+    {
+        SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
+    }
+
+    swapBitField16( cfg, ( tANI_U16* )pDot11f );
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fCapabilities2.
+
+void
+PopulateDot11fChanSwitchAnn(tpAniSirGlobal          pMac,
+                            tDot11fIEChanSwitchAnn *pDot11f)
+{
+    pDot11f->switchMode = pMac->lim.gLimChannelSwitch.switchMode;
+    pDot11f->newChannel = pMac->lim.gLimChannelSwitch.primaryChannel;
+    pDot11f->switchCount = ( tANI_U8 ) pMac->lim.gLimChannelSwitch.switchCount;
+
+    pDot11f->present = 1;
+} // End PopulateDot11fChanSwitchAnn.
+
+void
+PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
+                               tDot11fIEExtChanSwitchAnn *pDot11f)
+{
+    //Has to be updated on the cb state basis
+    pDot11f->secondaryChannelOffset = 
+             limGetHTCBState(pMac->lim.gLimChannelSwitch.secondarySubBand);
+
+    pDot11f->present = 1;
+}
+
+tSirRetStatus
+PopulateDot11fCountry(tpAniSirGlobal    pMac,
+                      tDot11fIECountry *pDot11f,
+                      tpPESession psessionEntry)
+{
+    tANI_U32           len, maxlen, codelen;
+    tANI_U16           item;
+    tSirRetStatus nSirStatus;
+    tSirRFBand         rfBand;
+    tANI_U8            temp[CFG_MAX_STR_LEN], code[3];
+
+    if (psessionEntry->lim11dEnabled )
+    {
+        limGetRfBand(pMac, &rfBand, psessionEntry);
+        if (rfBand == SIR_BAND_5_GHZ)
+        {
+            item   = WNI_CFG_MAX_TX_POWER_5;
+            maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
+        }
+        else
+        {
+            item   = WNI_CFG_MAX_TX_POWER_2_4;
+            maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
+        }
+
+        CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
+
+        if ( 3 > len )
+        {
+            // no limit on tx power, cannot include the IE because at least
+            // one (channel,num,tx power) must be present
+            return eSIR_SUCCESS;
+        }
+
+        CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
+                     code, codelen, 3 );
+
+        palCopyMemory( pMac->hHdd, pDot11f->country, code, codelen );
+
+        if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
+        {
+            dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
+            len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
+        }
+
+        pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )pDot11f->triplets, temp, len );
+
+        pDot11f->present = 1;
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fCountry.
+
+tSirRetStatus
+PopulateDot11fDSParams(tpAniSirGlobal     pMac,
+                       tDot11fIEDSParams *pDot11f, tANI_U8 channel,
+                       tpPESession psessionEntry)
+{
+//    tSirRetStatus       nSirStatus;
+    tANI_U32            nPhyMode;
+
+    // Get PHY mode and based on that add DS Parameter Set IE
+    limGetPhyMode(pMac, &nPhyMode, psessionEntry);
+
+    if ( WNI_CFG_PHY_MODE_11A != nPhyMode )
+    {
+        // .11b/g mode PHY => Include the DS Parameter Set IE:
+        #if 0
+        CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, cfg );
+        #endif //TO SUPPORT BT-AMP
+        pDot11f->curr_channel = channel;
+        pDot11f->present = 1;
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fDSParams.
+
+#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
+
+
+void
+PopulateDot11fEDCAParamSet(tpAniSirGlobal         pMac,
+                           tDot11fIEEDCAParamSet *pDot11f, 
+                           tpPESession psessionEntry)
+{
+
+    if (  psessionEntry->limQosEnabled )
+    {
+        //change to bitwise operation, after this is fixed in frames.
+        pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
+
+        // Fill each EDCA parameter set in order: be, bk, vi, vo
+        pDot11f->acbe_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
+        pDot11f->acbe_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
+        pDot11f->acbe_aci       = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
+        pDot11f->acbe_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
+        pDot11f->acbe_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
+        pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
+
+        pDot11f->acbk_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
+        pDot11f->acbk_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
+        pDot11f->acbk_aci       = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
+        pDot11f->acbk_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
+        pDot11f->acbk_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
+        pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
+
+        pDot11f->acvi_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
+        pDot11f->acvi_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
+        pDot11f->acvi_aci       = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
+        pDot11f->acvi_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
+        pDot11f->acvi_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
+        pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
+
+        pDot11f->acvo_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
+        pDot11f->acvo_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
+        pDot11f->acvo_aci       = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
+        pDot11f->acvo_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
+        pDot11f->acvo_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
+        pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
+
+        pDot11f->present = 1;
+    }
+
+} // End PopluateDot11fEDCAParamSet.
+
+tSirRetStatus
+PopulateDot11fERPInfo(tpAniSirGlobal    pMac,
+                      tDot11fIEERPInfo *pDot11f,
+                      tpPESession    psessionEntry)
+{
+    tSirRetStatus nSirStatus;
+    tANI_U32            val;
+    tSirRFBand          rfBand = SIR_BAND_UNKNOWN;
+
+    limGetRfBand(pMac, &rfBand, psessionEntry);
+    if(SIR_BAND_2_4_GHZ == rfBand)
+    {
+        pDot11f->present = 1;
+
+        val  = psessionEntry->cfgProtection.fromllb;
+        if(!val ){
+            dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
+            return eSIR_SUCCESS;
+        }
+
+        if (psessionEntry->gLim11bParams.protectionEnabled)
+        {
+            pDot11f->non_erp_present = 1;
+            pDot11f->use_prot        = 1;
+        }
+
+        if ( psessionEntry->gLimOlbcParams.protectionEnabled )
+        {
+            //FIXME_PROTECTION: we should be setting non_erp present also.
+            //check the test plan first.
+            pDot11f->use_prot = 1;
+        }
+
+
+        if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta) 
+                 || !psessionEntry->beaconParams.fShortPreamble){ 
+                pDot11f->barker_preamble = 1;
+         
+        }
+        // if protection always flag is set, advertise protection enabled
+        // regardless of legacy stations presence
+        CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
+
+        if ( val )
+        {
+            pDot11f->use_prot = 1;
+        }
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fERPInfo.
+
+tSirRetStatus
+PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
+                           tDot11fIEExtSuppRates *pDot11f, 
+                           tpPESession psessionEntry)
+{
+    tSirRetStatus nSirStatus;
+    tANI_U32           nRates = 0;
+    tANI_U8            rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
+
+   /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
+       else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
+       sending mgmt frames (lile probe req) which need to go out before any session is present.
+   */
+    if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
+    {
+        if(psessionEntry != NULL)
+        {
+            nRates = psessionEntry->extRateSet.numRates;
+            palCopyMemory(pMac->hHdd, rates, psessionEntry->extRateSet.rate, 
+                          nRates);
+        }
+        else
+        {
+            dot11fLog( pMac, LOGE, FL("no session context exists while"
+                        " populating Operational Rate Set\n"));
+        }
+    }
+    else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
+    {
+        CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
+                     rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
+    }
+
+    if ( 0 != nRates )
+    {
+        pDot11f->num_rates = ( tANI_U8 )nRates;
+        palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
+        pDot11f->present   = 1;
+    }
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fExtSuppRates.
+
+tSirRetStatus
+PopulateDot11fExtSuppRates1(tpAniSirGlobal         pMac,
+                            tANI_U8                     nChannelNum,
+                            tDot11fIEExtSuppRates *pDot11f)
+{
+    tANI_U32           nRates;
+    tSirRetStatus nSirStatus;
+    tANI_U8            rates[SIR_MAC_MAX_NUMBER_OF_RATES];
+
+    if ( 14 < nChannelNum )
+    {
+        pDot11f->present = 0;
+        return eSIR_SUCCESS;
+    }
+
+    // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
+    // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
+    // previously & I'm afraid to change it!
+    CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
+                 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
+
+    if ( 0 != nRates )
+    {
+        pDot11f->num_rates = ( tANI_U8 ) nRates;
+        palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
+        pDot11f->present   = 1;
+    }
+
+    return eSIR_SUCCESS;
+} // PopulateDot11fExtSuppRates1.
+
+tSirRetStatus
+PopulateDot11fHTCaps(tpAniSirGlobal           pMac,
+                             tDot11fIEHTCaps *pDot11f)
+{
+    tANI_U32                         nCfgValue, nCfgLen;
+    tANI_U8                          nCfgValue8;
+    tSirRetStatus                    nSirStatus;
+    tSirMacHTParametersInfo         *pHTParametersInfo;
+#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    union {
+        tANI_U16                        nCfgValue16;
+        tSirMacHTCapabilityInfo         htCapInfo;
+        tSirMacExtendedHTCapabilityInfo extHtCapInfo;
+    } uHTCapabilityInfo;
+#else
+    tANI_U16                         nCfgValue16;
+    tSirMacHTCapabilityInfo         *pHTCapabilityInfo;
+    tSirMacExtendedHTCapabilityInfo *pExtendedHTCapabilityInfo;
+#endif
+
+    tSirMacTxBFCapabilityInfo       *pTxBFCapabilityInfo;
+    tSirMacASCapabilityInfo         *pASCapabilityInfo;
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
+#else
+    nCfgValue16 = ( tANI_U16 ) nCfgValue;
+    pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &nCfgValue16;
+#endif
+
+    dot11fLog( pMac, LOG1, FL( "HT Caps: %x\n" ), nCfgValue);
+
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    pDot11f->advCodingCap             = uHTCapabilityInfo.htCapInfo.advCodingCap;
+    pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
+    pDot11f->mimoPowerSave            = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
+    pDot11f->greenField               = uHTCapabilityInfo.htCapInfo.greenField;
+    pDot11f->shortGI20MHz             = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
+    pDot11f->shortGI40MHz             = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
+    pDot11f->txSTBC                   = uHTCapabilityInfo.htCapInfo.txSTBC;
+    pDot11f->rxSTBC                   = uHTCapabilityInfo.htCapInfo.rxSTBC;
+    pDot11f->delayedBA                = uHTCapabilityInfo.htCapInfo.delayedBA;
+    pDot11f->maximalAMSDUsize         = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
+    pDot11f->dsssCckMode40MHz         = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
+    pDot11f->psmp                     = uHTCapabilityInfo.htCapInfo.psmp;
+    pDot11f->stbcControlFrame         = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
+    pDot11f->lsigTXOPProtection       = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
+#else
+    pDot11f->advCodingCap             = pHTCapabilityInfo->advCodingCap;
+    pDot11f->supportedChannelWidthSet = pHTCapabilityInfo->supportedChannelWidthSet;
+    pDot11f->mimoPowerSave            = pHTCapabilityInfo->mimoPowerSave;
+    pDot11f->greenField               = pHTCapabilityInfo->greenField;
+    pDot11f->shortGI20MHz             = pHTCapabilityInfo->shortGI20MHz;
+    pDot11f->shortGI40MHz             = pHTCapabilityInfo->shortGI40MHz;
+    pDot11f->txSTBC                   = pHTCapabilityInfo->txSTBC;
+    pDot11f->rxSTBC                   = pHTCapabilityInfo->rxSTBC;
+    pDot11f->delayedBA                = pHTCapabilityInfo->delayedBA;
+    pDot11f->maximalAMSDUsize         = pHTCapabilityInfo->maximalAMSDUsize;
+    pDot11f->dsssCckMode40MHz         = pHTCapabilityInfo->dsssCckMode40MHz;
+    pDot11f->psmp                     = pHTCapabilityInfo->psmp;
+    pDot11f->stbcControlFrame         = pHTCapabilityInfo->stbcControlFrame;
+    pDot11f->lsigTXOPProtection       = pHTCapabilityInfo->lsigTXOPProtection;
+#endif
+
+    /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
+       eHT_CHANNEL_WIDTH_20MHZ */
+    if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
+    {
+       pDot11f->shortGI40MHz = 0;
+    }
+
+    dot11fLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
+                                            pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave,  pDot11f->greenField,
+                                            pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
+
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
+
+    nCfgValue8 = ( tANI_U8 ) nCfgValue;
+    pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
+
+    pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
+    pDot11f->mpduDensity      = pHTParametersInfo->mpduDensity;
+    pDot11f->reserved1        = pHTParametersInfo->reserved;
+
+    dot11fLog( pMac, LOG1, FL( "AMPDU Param: %x\n" ), nCfgValue);
+
+
+    CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
+                 pDot11f->supportedMCSSet, nCfgLen,
+                 SIZE_OF_SUPPORTED_MCS_SET );
+
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
+
+    pDot11f->pco            = uHTCapabilityInfo.extHtCapInfo.pco;
+    pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
+    pDot11f->mcsFeedback    = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
+
+#else
+    nCfgValue16 = ( tANI_U16 ) nCfgValue ;
+    pExtendedHTCapabilityInfo = ( tSirMacExtendedHTCapabilityInfo* ) &nCfgValue16;
+    pDot11f->pco            = pExtendedHTCapabilityInfo->pco;
+    pDot11f->transitionTime = pExtendedHTCapabilityInfo->transitionTime;
+    pDot11f->mcsFeedback    = pExtendedHTCapabilityInfo->mcsFeedback;
+#endif
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
+
+    pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
+    pDot11f->txBF                                       = pTxBFCapabilityInfo->txBF;
+    pDot11f->rxStaggeredSounding                        = pTxBFCapabilityInfo->rxStaggeredSounding;
+    pDot11f->txStaggeredSounding                        = pTxBFCapabilityInfo->txStaggeredSounding;
+    pDot11f->rxZLF                                      = pTxBFCapabilityInfo->rxZLF;
+    pDot11f->txZLF                                      = pTxBFCapabilityInfo->txZLF;
+    pDot11f->implicitTxBF                               = pTxBFCapabilityInfo->implicitTxBF;
+    pDot11f->calibration                                = pTxBFCapabilityInfo->calibration;
+    pDot11f->explicitCSITxBF                            = pTxBFCapabilityInfo->explicitCSITxBF;
+    pDot11f->explicitUncompressedSteeringMatrix         = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
+    pDot11f->explicitBFCSIFeedback                      = pTxBFCapabilityInfo->explicitBFCSIFeedback;
+    pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
+    pDot11f->explicitCompressedSteeringMatrixFeedback   = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
+    pDot11f->csiNumBFAntennae                           = pTxBFCapabilityInfo->csiNumBFAntennae;
+    pDot11f->uncompressedSteeringMatrixBFAntennae       = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
+    pDot11f->compressedSteeringMatrixBFAntennae         = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
+
+    nCfgValue8 = ( tANI_U8 ) nCfgValue;
+
+    pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
+    pDot11f->antennaSelection         = pASCapabilityInfo->antennaSelection;
+    pDot11f->explicitCSIFeedbackTx    = pASCapabilityInfo->explicitCSIFeedbackTx;
+    pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
+    pDot11f->explicitCSIFeedback      = pASCapabilityInfo->explicitCSIFeedback;
+    pDot11f->antennaIndicesFeedback   = pASCapabilityInfo->antennaIndicesFeedback;
+    pDot11f->rxAS                     = pASCapabilityInfo->rxAS;
+    pDot11f->txSoundingPPDUs          = pASCapabilityInfo->txSoundingPPDUs;
+
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fHTCaps.
+
+#ifdef WLAN_SOFTAP_FEATURE
+tSirRetStatus
+PopulateDot11fHTInfo(tpAniSirGlobal   pMac,
+                     tDot11fIEHTInfo *pDot11f,
+                     tpPESession      psessionEntry )
+#else
+tSirRetStatus
+PopulateDot11fHTInfo(tpAniSirGlobal   pMac,
+                     tDot11fIEHTInfo *pDot11f)
+#endif
+{
+    tANI_U32             nCfgValue, nCfgLen;
+    tANI_U8              htInfoField1;
+    tANI_U16            htInfoField2;
+    tSirRetStatus        nSirStatus;
+    tSirMacHTInfoField1 *pHTInfoField1;
+    tSirMacHTInfoField2 *pHTInfoField2;
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    union {
+        tANI_U16         nCfgValue16;
+        tSirMacHTInfoField3 infoField3;
+    }uHTInfoField;
+    union {
+        tANI_U16         nCfgValue16;
+        tSirMacHTInfoField2 infoField2;
+    }uHTInfoField2={0};
+#else
+    tANI_U16            htInfoField3;
+    tSirMacHTInfoField3 *pHTInfoField3;
+#endif
+
+#ifndef WLAN_SOFTAP_FEATURE
+    tpPESession         psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH HOW TO GET sessionEntry?????
+#endif
+
+    #if 0
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
+    #endif // TO SUPPORT BT-AMP
+    
+    pDot11f->primaryChannel = psessionEntry->currentOperChannel;
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
+
+    htInfoField1 = ( tANI_U8 ) nCfgValue;
+
+    pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
+    pHTInfoField1->secondaryChannelOffset     = pMac->lim.gHTSecondaryChannelOffset;
+    pHTInfoField1->recommendedTxWidthSet      = pMac->lim.gHTRecommendedTxWidthSet;
+    pHTInfoField1->rifsMode                   = psessionEntry->beaconParams.fRIFSMode;
+    pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
+
+    uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
+
+    uHTInfoField2.infoField2.opMode   =  psessionEntry->htOperMode;
+    uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
+    uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode;   /*added for Obss  */
+
+    uHTInfoField2.infoField2.reserved = 0;
+
+   }else{
+#endif
+        CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
+
+        htInfoField2 = ( tANI_U16 ) nCfgValue;
+
+        pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
+        pHTInfoField2->opMode   = pMac->lim.gHTOperMode;
+        pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
+        pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode;   /*added for Obss  */
+
+        pHTInfoField2->reserved = 0;
+#ifdef WLAN_SOFTAP_FEATURE
+    }
+#endif
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
+
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
+
+
+    uHTInfoField.infoField3.basicSTBCMCS                  = pMac->lim.gHTSTBCBasicMCS;
+    uHTInfoField.infoField3.dualCTSProtection             = pMac->lim.gHTDualCTSProtection;
+    uHTInfoField.infoField3.secondaryBeacon               = pMac->lim.gHTSecondaryBeacon;
+    uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
+    uHTInfoField.infoField3.pcoActive                     = pMac->lim.gHTPCOActive;
+    uHTInfoField.infoField3.pcoPhase                      = pMac->lim.gHTPCOPhase;
+    uHTInfoField.infoField3.reserved                      = 0;
+
+#else
+    htInfoField3 = (tANI_U16) nCfgValue;
+
+    pHTInfoField3 = ( tSirMacHTInfoField3* ) &htInfoField3;
+    pHTInfoField3->basicSTBCMCS                  = pMac->lim.gHTSTBCBasicMCS;
+    pHTInfoField3->dualCTSProtection             = pMac->lim.gHTDualCTSProtection;
+    pHTInfoField3->secondaryBeacon               = pMac->lim.gHTSecondaryBeacon;
+    pHTInfoField3->lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
+    pHTInfoField3->pcoActive                     = pMac->lim.gHTPCOActive;
+    pHTInfoField3->pcoPhase                      = pMac->lim.gHTPCOPhase;
+    pHTInfoField3->reserved                      = 0;
+#endif
+
+    pDot11f->secondaryChannelOffset        = pHTInfoField1->secondaryChannelOffset;
+    pDot11f->recommendedTxWidthSet         = pHTInfoField1->recommendedTxWidthSet;
+    pDot11f->rifsMode                      = pHTInfoField1->rifsMode;
+    pDot11f->controlledAccessOnly          = pHTInfoField1->controlledAccessOnly;
+    pDot11f->serviceIntervalGranularity    = pHTInfoField1->serviceIntervalGranularity;
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    pDot11f->opMode                        = uHTInfoField2.infoField2.opMode;
+    pDot11f->nonGFDevicesPresent           = uHTInfoField2.infoField2.nonGFDevicesPresent;
+    pDot11f->obssNonHTStaPresent           = uHTInfoField2.infoField2.obssNonHTStaPresent;
+    pDot11f->reserved                      = uHTInfoField2.infoField2.reserved;
+
+#else
+    pDot11f->opMode                        = pHTInfoField2->opMode;
+    pDot11f->nonGFDevicesPresent           = pHTInfoField2->nonGFDevicesPresent;
+    pDot11f->obssNonHTStaPresent           = pHTInfoField2->obssNonHTStaPresent;
+    pDot11f->reserved                      = pHTInfoField2->reserved;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
+    pDot11f->basicSTBCMCS                  = uHTInfoField.infoField3.basicSTBCMCS;
+    pDot11f->dualCTSProtection             = uHTInfoField.infoField3.dualCTSProtection;
+    pDot11f->secondaryBeacon               = uHTInfoField.infoField3.secondaryBeacon;
+    pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
+    pDot11f->pcoActive                     = uHTInfoField.infoField3.pcoActive;
+    pDot11f->pcoPhase                      = uHTInfoField.infoField3.pcoPhase;
+    pDot11f->reserved2                     = uHTInfoField.infoField3.reserved;
+#else
+    pDot11f->basicSTBCMCS                  = pHTInfoField3->basicSTBCMCS;
+    pDot11f->dualCTSProtection             = pHTInfoField3->dualCTSProtection;
+    pDot11f->secondaryBeacon               = pHTInfoField3->secondaryBeacon;
+    pDot11f->lsigTXOPProtectionFullSupport = pHTInfoField3->lsigTXOPProtectionFullSupport;
+    pDot11f->pcoActive                     = pHTInfoField3->pcoActive;
+    pDot11f->pcoPhase                      = pHTInfoField3->pcoPhase;
+    pDot11f->reserved2                     = pHTInfoField3->reserved;
+#endif
+    CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
+                 pDot11f->basicMCSSet, nCfgLen,
+                 SIZE_OF_BASIC_MCS_SET );
+
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fHTInfo.
+
+void
+PopulateDot11fIBSSParams(tpAniSirGlobal       pMac,
+       tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
+{
+    if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
+    {
+        pDot11f->present = 1;
+        // ATIM duration is always set to 0
+        pDot11f->atim = 0;
+    }
+
+} // End PopulateDot11fIBSSParams.
+
+
+#ifdef ANI_SUPPORT_11H
+tSirRetStatus
+PopulateDot11fMeasurementReport0(tpAniSirGlobal              pMac,
+                                 tpSirMacMeasReqActionFrame  pReq,
+                                 tDot11fIEMeasurementReport *pDot11f)
+{
+    pDot11f->token     = pReq->measReqIE.measToken;
+    pDot11f->late      = 0;
+    pDot11f->incapable = 0;
+    pDot11f->refused   = 1;
+    pDot11f->type      = SIR_MAC_BASIC_MEASUREMENT_TYPE;
+
+    pDot11f->present   = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulatedDot11fMeasurementReport0.
+
+tSirRetStatus
+PopulateDot11fMeasurementReport1(tpAniSirGlobal              pMac,
+                                  tpSirMacMeasReqActionFrame  pReq,
+                                  tDot11fIEMeasurementReport *pDot11f)
+{
+    pDot11f->token     = pReq->measReqIE.measToken;
+    pDot11f->late      = 0;
+    pDot11f->incapable = 0;
+    pDot11f->refused   = 1;
+    pDot11f->type      = SIR_MAC_CCA_MEASUREMENT_TYPE;
+
+    pDot11f->present   = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulatedDot11fMeasurementReport1.
+
+tSirRetStatus
+PopulateDot11fMeasurementReport2(tpAniSirGlobal              pMac,
+                                 tpSirMacMeasReqActionFrame  pReq,
+                                 tDot11fIEMeasurementReport *pDot11f)
+{
+    pDot11f->token     = pReq->measReqIE.measToken;
+    pDot11f->late      = 0;
+    pDot11f->incapable = 0;
+    pDot11f->refused   = 1;
+    pDot11f->type      = SIR_MAC_RPI_MEASUREMENT_TYPE;
+
+    pDot11f->present   = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulatedDot11fMeasurementReport2.
+#endif
+
+void
+PopulateDot11fPowerCaps(tpAniSirGlobal      pMac,
+                        tDot11fIEPowerCaps *pCaps,
+                        tANI_U8 nAssocType,
+                        tpPESession psessionEntry)
+{
+    if (nAssocType == LIM_REASSOC)
+    {
+        pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
+        pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
+    }else
+    {
+        pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
+        pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
+
+    }
+    
+    pCaps->present    = 1;
+} // End PopulateDot11fPowerCaps.
+
+tSirRetStatus
+PopulateDot11fPowerConstraints(tpAniSirGlobal             pMac,
+                               tDot11fIEPowerConstraints *pDot11f)
+{
+    tANI_U32           cfg;
+    tSirRetStatus nSirStatus;
+
+    CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
+
+    pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fPowerConstraints.
+
+void
+PopulateDot11fQOSCapsAp(tpAniSirGlobal      pMac,
+                        tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
+{
+    pDot11f->count    = psessionEntry->gLimEdcaParamSetCount;
+    pDot11f->reserved = 0;
+    pDot11f->txopreq  = 0;
+    pDot11f->qreq     = 0;
+    pDot11f->qack     = 0;
+    pDot11f->present  = 1;
+} // End PopulatedDot11fQOSCaps.
+
+void
+PopulateDot11fQOSCapsStation(tpAniSirGlobal    pMac,
+                      tDot11fIEQOSCapsStation *pDot11f)
+{
+    tANI_U32  val = 0;
+
+    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
+        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
+   
+    pDot11f->more_data_ack = 0;
+    pDot11f->max_sp_length = (tANI_U8)val;
+    pDot11f->qack    = 0;
+
+    if (pMac->lim.gUapsdEnable)
+    {
+        pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
+        pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
+        pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
+        pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
+    }   
+    pDot11f->present = 1;
+} // End PopulatedDot11fQOSCaps.
+
+tSirRetStatus
+PopulateDot11fRSN(tpAniSirGlobal  pMac,
+                  tpSirRSNie      pRsnIe,
+                  tDot11fIERSN   *pDot11f)
+{
+    tANI_U32        status;
+    int  idx;
+
+    if ( pRsnIe->length )
+    {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
+            {
+        status = dot11fUnpackIeRSN( pMac,
+                                    pRsnIe->rsnIEdata + idx + 2, //EID, length
+                                    pRsnIe->rsnIEdata[ idx + 1 ],
+                                    pDot11f );
+        if ( DOT11F_FAILED( status ) )
+        {
+            dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
+                                   "N (0x%08x).\n"),
+                    status );
+            return eSIR_FAILURE;
+        }
+        dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
+                               "PopulateDot11fRSN.\n"), status );
+        }
+
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fRSN.
+
+tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal      pMac,
+                                       tpSirRSNie          pRsnIe,
+                                       tDot11fIERSNOpaque *pDot11f )
+{
+    int idx;
+
+    if ( pRsnIe->length )
+    {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
+        {
+            pDot11f->present  = 1;
+            pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
+            palCopyMemory( pMac->hHdd, pDot11f->data,
+                           pRsnIe->rsnIEdata + idx + 2,    // EID, len
+                           pRsnIe->rsnIEdata[ idx + 1 ] );
+        }
+    }
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fRSNOpaque.
+
+
+
+#if defined(FEATURE_WLAN_WAPI)
+
+tSirRetStatus
+PopulateDot11fWAPI(tpAniSirGlobal  pMac,
+                  tpSirRSNie      pRsnIe,
+                  tDot11fIEWAPI   *pDot11f)
+        {
+    tANI_U32        status;
+    int  idx;
+
+    if ( pRsnIe->length )
+        {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
+        {
+            status = dot11fUnpackIeWAPI( pMac,
+                                        pRsnIe->rsnIEdata + idx + 2, //EID, length
+                                        pRsnIe->rsnIEdata[ idx + 1 ],
+                                        pDot11f );
+            if ( DOT11F_FAILED( status ) )
+            {
+                dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
+                        status );
+                return eSIR_FAILURE;
+            }
+            dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
+                               "PopulateDot11fWAPI.\n"), status );
+        }
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fWAPI.
+
+tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal      pMac,
+                                       tpSirRSNie          pRsnIe,
+                                       tDot11fIEWAPIOpaque *pDot11f )
+{
+    int idx;
+
+    if ( pRsnIe->length )
+    {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
+        {
+        pDot11f->present  = 1;
+        pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
+        palCopyMemory( pMac->hHdd, pDot11f->data,
+                       pRsnIe->rsnIEdata + idx + 2,    // EID, len
+                       pRsnIe->rsnIEdata[ idx + 1 ] );
+    }
+    }
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fWAPIOpaque.
+
+
+#endif //defined(FEATURE_WLAN_WAPI)
+
+void
+PopulateDot11fSSID(tpAniSirGlobal pMac,
+                   tSirMacSSid   *pInternal,
+                   tDot11fIESSID *pDot11f)
+{
+    pDot11f->present = 1;
+    pDot11f->num_ssid = pInternal->length;
+    if ( pInternal->length )
+    {
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
+                       pInternal->length );
+    }
+} // End PopulateDot11fSSID.
+
+tSirRetStatus
+PopulateDot11fSSID2(tpAniSirGlobal pMac,
+                    tDot11fIESSID *pDot11f)
+{
+    tANI_U32           nCfg;
+    tSirRetStatus nSirStatus;
+
+    CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
+    pDot11f->num_ssid = ( tANI_U8 )nCfg;
+    pDot11f->present  = 1;
+    return eSIR_SUCCESS;
+} // End PopulateDot11fSSID2.
+
+void
+PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
+                       tDot11fIESchedule *pDot11f)
+{
+    pDot11f->aggregation        = pSchedule->info.aggregation;
+    pDot11f->tsid               = pSchedule->info.tsid;
+    pDot11f->direction          = pSchedule->info.direction;
+    pDot11f->reserved           = pSchedule->info.rsvd;
+    pDot11f->service_start_time = pSchedule->svcStartTime;
+    pDot11f->service_interval   = pSchedule->svcInterval;
+    pDot11f->max_service_dur    = pSchedule->maxSvcDuration;
+    pDot11f->spec_interval      = pSchedule->specInterval;
+
+    pDot11f->present = 1;
+} // End PopulateDot11fSchedule.
+
+void
+PopulateDot11fSuppChannels(tpAniSirGlobal         pMac,
+                           tDot11fIESuppChannels *pDot11f,
+                           tANI_U8 nAssocType,
+                           tpPESession psessionEntry)
+{
+    tANI_U8  i;
+    tANI_U8 *p;
+
+    if (nAssocType == LIM_REASSOC)
+    {
+        p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
+        pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
+    }else
+    {
+        p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
+        pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
+    }
+    for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
+    {
+        pDot11f->bands[i][0] = *p;
+        pDot11f->bands[i][1] = 1;
+    }
+
+    pDot11f->present = 1;
+
+} // End PopulateDot11fSuppChannels.
+
+tSirRetStatus
+PopulateDot11fSuppRates(tpAniSirGlobal      pMac,
+                        tANI_U8                  nChannelNum,
+                        tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
+{
+    tSirRetStatus nSirStatus;
+    tANI_U32           nRates;
+    tANI_U8            rates[SIR_MAC_MAX_NUMBER_OF_RATES];
+
+   /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
+       else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
+       sending mgmt frames (lile probe req) which need to go out before any session is present.
+   */
+    if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
+    {
+        #if 0
+        CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
+                     rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
+        #endif //TO SUPPORT BT-AMP
+        if(psessionEntry != NULL)
+        {
+            nRates = psessionEntry->rateSet.numRates;
+            palCopyMemory(pMac->hHdd, rates, psessionEntry->rateSet.rate, 
+                          nRates);
+        }
+        else
+        {
+            dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
+            nRates = 0;
+        }
+    }
+    else if ( 14 >= nChannelNum )
+    {
+        CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
+                     rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
+    }
+    else
+    {
+        CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
+                     rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
+    }
+
+    if ( 0 != nRates )
+    {
+        pDot11f->num_rates = ( tANI_U8 )nRates;
+        palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
+        pDot11f->present   = 1;
+    }
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fSuppRates.
+
+tSirRetStatus
+PopulateDot11fTPCReport(tpAniSirGlobal      pMac,
+                        tDot11fIETPCReport *pDot11f,
+                        tpPESession psessionEntry)
+{
+    tANI_U16 staid, txPower;
+    tSirRetStatus nSirStatus;
+
+    nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
+    if ( eSIR_SUCCESS != nSirStatus )
+    {
+        dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
+                                  "eDot11fTPCReport; limGetMgmtStaid "
+                                  "returned status %d.\n"),
+                   nSirStatus );
+        return eSIR_FAILURE;
+    }
+
+    // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
+    // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
+    txPower = 0;
+    pDot11f->tx_power    = ( tANI_U8 )txPower;
+    pDot11f->link_margin = 0;
+    pDot11f->present     = 1;
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fTPCReport.
+
+
+void PopulateDot11fTSInfo(tSirMacTSInfo   *pInfo,
+                          tDot11fFfTSInfo *pDot11f)
+{
+    pDot11f->traffic_type   = pInfo->traffic.trafficType;
+    pDot11f->tsid           = pInfo->traffic.tsid;
+    pDot11f->direction      = pInfo->traffic.direction;
+    pDot11f->access_policy  = pInfo->traffic.accessPolicy;
+    pDot11f->aggregation    = pInfo->traffic.aggregation;
+    pDot11f->psb            = pInfo->traffic.psb;
+    pDot11f->user_priority  = pInfo->traffic.userPrio;
+    pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
+    pDot11f->schedule       = pInfo->schedule.schedule;
+} // End PopulatedDot11fTSInfo.
+
+void PopulateDot11fWMM(tpAniSirGlobal      pMac,
+                       tDot11fIEWMMInfoAp  *pInfo,
+                       tDot11fIEWMMParams *pParams,
+                       tDot11fIEWMMCaps   *pCaps,
+                       tpPESession        psessionEntry)
+{
+    if ( psessionEntry->limWmeEnabled )
+    {
+        if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
+        {
+            //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
+            {
+                PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
+            }
+        }
+        else
+        {
+            {
+                PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
+            }
+
+           if ( psessionEntry->limWsmEnabled )
+            {
+                PopulateDot11fWMMCaps( pCaps );
+            }
+        }
+    }
+} // End PopulateDot11fWMM.
+
+void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
+{
+    pCaps->version       = SIR_MAC_OUI_VERSION_1;
+    pCaps->qack          = 0;
+    pCaps->queue_request = 1;
+    pCaps->txop_request  = 0;
+    pCaps->more_ack      = 0;
+    pCaps->present       = 1;
+} // End PopulateDot11fWmmCaps.
+
+#ifdef FEATURE_WLAN_CCX
+void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
+{
+    tANI_U8 numTspecs = 0, idx;
+    tTspecInfo *pTspec = NULL;
+
+    numTspecs = psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs;
+    pTspec = &psessionEntry->pLimReAssocReq->ccxTspecInfo.tspec[0];
+    pReassoc->num_WMMTSPEC = numTspecs;
+    if (numTspecs) {
+        for (idx=0; idx<numTspecs; idx++) {
+            PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
+            pTspec++;
+        }
+    }
+}
+#endif 
+
+void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo, 
+                             tpPESession psessionEntry)
+{
+    pInfo->version = SIR_MAC_OUI_VERSION_1;
+
+    /* WMM Specification 3.1.3, 3.2.3
+     * An IBSS staion shall always use its default WMM parameters.
+     */
+    if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
+    {
+        pInfo->param_set_count = 0;
+        pInfo->uapsd = 0;
+    }
+    else
+    {
+        pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
+#ifdef WLAN_SOFTAP_FEATURE
+        if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
+            pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
+        }
+        else
+#endif
+            pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
+    }
+    pInfo->present = 1;
+}
+
+void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
+{
+    tANI_U32  val = 0;
+
+    pInfo->version = SIR_MAC_OUI_VERSION_1;
+    pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
+    pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
+    pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
+    pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
+
+    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
+        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
+
+    pInfo->max_sp_length = (tANI_U8)val;
+    pInfo->present = 1;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+void PopulateDot11fWMMParams(tpAniSirGlobal      pMac,
+                             tDot11fIEWMMParams *pParams,
+                             tpPESession        psessionEntry)
+#else
+void PopulateDot11fWMMParams(tpAniSirGlobal      pMac,
+                             tDot11fIEWMMParams *pParams)
+#endif
+{
+    pParams->version = SIR_MAC_OUI_VERSION_1;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
+       pParams->qosInfo =
+           (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
+    else 
+#endif
+       pParams->qosInfo =
+           (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
+
+    // Fill each EDCA parameter set in order: be, bk, vi, vo
+    pParams->acbe_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
+    pParams->acbe_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
+    pParams->acbe_aci       = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
+    pParams->acbe_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
+    pParams->acbe_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
+    pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
+
+    pParams->acbk_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
+    pParams->acbk_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
+    pParams->acbk_aci       = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
+    pParams->acbk_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
+    pParams->acbk_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
+    pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
+        pParams->acvi_aifsn     = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
+    else
+#endif 
+        pParams->acvi_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
+
+
+
+    pParams->acvi_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
+    pParams->acvi_aci       = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
+    pParams->acvi_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
+    pParams->acvi_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
+    pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
+        pParams->acvo_aifsn     = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
+    else
+#endif
+        pParams->acvo_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
+
+    pParams->acvo_acm       = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
+    pParams->acvo_aci       = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
+    pParams->acvo_acwmin    = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
+    pParams->acvo_acwmax    = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
+    pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
+
+    pParams->present = 1;
+
+} // End PopulateDot11fWMMParams.
+
+void PopulateDot11fWMMSchedule(tSirMacScheduleIE    *pSchedule,
+                               tDot11fIEWMMSchedule *pDot11f)
+{
+    pDot11f->version            = 1;
+    pDot11f->aggregation        = pSchedule->info.aggregation;
+    pDot11f->tsid               = pSchedule->info.tsid;
+    pDot11f->direction          = pSchedule->info.direction;
+    pDot11f->reserved           = pSchedule->info.rsvd;
+    pDot11f->service_start_time = pSchedule->svcStartTime;
+    pDot11f->service_interval   = pSchedule->svcInterval;
+    pDot11f->max_service_dur    = pSchedule->maxSvcDuration;
+    pDot11f->spec_interval      = pSchedule->specInterval;
+
+    pDot11f->present = 1;
+} // End PopulateDot11fWMMSchedule.
+
+tSirRetStatus
+PopulateDot11fWPA(tpAniSirGlobal  pMac,
+                  tpSirRSNie      pRsnIe,
+                  tDot11fIEWPA   *pDot11f)
+{
+    tANI_U32        status;
+    int idx;
+
+    if ( pRsnIe->length )
+    {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
+        {
+        status = dot11fUnpackIeWPA( pMac,
+                                    pRsnIe->rsnIEdata + idx + 2 + 4,  // EID, length, OUI
+                                    pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
+                                    pDot11f );
+        if ( DOT11F_FAILED( status ) )
+        {
+            dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
+                                   "A (0x%08x).\n"),
+                    status );
+            return eSIR_FAILURE;
+        }
+    }
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fWPA.
+
+
+
+tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal      pMac,
+                                       tpSirRSNie          pRsnIe,
+                                       tDot11fIEWPAOpaque *pDot11f )
+{
+    int idx;
+
+    if ( pRsnIe->length )
+    {
+        if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
+        {
+        pDot11f->present  = 1;
+        pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
+        palCopyMemory( pMac->hHdd, pDot11f->data,
+                       pRsnIe->rsnIEdata + idx + 2 + 4,    // EID, len, OUI
+                       pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
+    }
+    }
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fWPAOpaque.
+
+////////////////////////////////////////////////////////////////////////
+
+tSirRetStatus
+sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
+{
+#if 0
+    tANI_U32 val;
+
+    *caps = 0;
+    if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
+        != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
+        return eSIR_FAILURE;
+    }
+    if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
+        return eSIR_FAILURE;
+    }
+
+    *caps = (tANI_U16) val;
+#endif
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus
+sirConvertProbeReqFrame2Struct(tpAniSirGlobal  pMac,
+                               tANI_U8             *pFrame,
+                               tANI_U32             nFrame,
+                               tpSirProbeReq   pProbeReq)
+{
+    tANI_U32 status;
+    tDot11fProbeRequest pr;
+
+    // Ok, zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, (tANI_U8*)pProbeReq, sizeof(tSirProbeReq));
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
+    if ( ! pr.SSID.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
+    }
+    else
+    {
+        pProbeReq->ssidPresent = 1;
+        ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
+    }
+
+    if ( ! pr.SuppRates.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
+        return eSIR_FAILURE;
+    }
+    else
+    {
+        pProbeReq->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
+    }
+
+    if ( pr.ExtSuppRates.present )
+    {
+        pProbeReq->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
+    }
+
+    if ( pr.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( pr.WscProbeReq.present )
+    {
+        pProbeReq->wscIePresent = 1;
+        memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
+    }
+
+    if ( pr.P2PProbeReq.present )
+    {
+        pProbeReq->p2pIePresent = 1;
+    }
+    return eSIR_SUCCESS;
+
+} // End sirConvertProbeReqFrame2Struct.
+
+tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal       pMac,
+                                          tANI_U8             *pFrame,
+                                          tANI_U32             nFrame,
+                                          tpSirProbeRespBeacon pProbeResp)
+{
+    tANI_U32             status;
+    tDot11fProbeResponse pr;
+
+    // Ok, zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof(tDot11fProbeResponse) );
+
+    
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, &pr );
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
+
+    // Timestamp
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr.TimeStamp, sizeof(tSirMacTimeStamp) );
+
+    // Beacon Interval
+    pProbeResp->beaconInterval = pr.BeaconInterval.interval;
+
+    // Capabilities
+    pProbeResp->capabilityInfo.ess            = pr.Capabilities.ess;
+    pProbeResp->capabilityInfo.ibss           = pr.Capabilities.ibss;
+    pProbeResp->capabilityInfo.cfPollable     = pr.Capabilities.cfPollable;
+    pProbeResp->capabilityInfo.cfPollReq      = pr.Capabilities.cfPollReq;
+    pProbeResp->capabilityInfo.privacy        = pr.Capabilities.privacy;
+    pProbeResp->capabilityInfo.shortPreamble  = pr.Capabilities.shortPreamble;
+    pProbeResp->capabilityInfo.pbcc           = pr.Capabilities.pbcc;
+    pProbeResp->capabilityInfo.channelAgility = pr.Capabilities.channelAgility;
+    pProbeResp->capabilityInfo.spectrumMgt    = pr.Capabilities.spectrumMgt;
+    pProbeResp->capabilityInfo.qos            = pr.Capabilities.qos;
+    pProbeResp->capabilityInfo.shortSlotTime  = pr.Capabilities.shortSlotTime;
+    pProbeResp->capabilityInfo.apsd           = pr.Capabilities.apsd;
+    pProbeResp->capabilityInfo.rrm            = pr.Capabilities.rrm;
+    pProbeResp->capabilityInfo.dsssOfdm       = pr.Capabilities.dsssOfdm;
+    pProbeResp->capabilityInfo.delayedBA       = pr.Capabilities.delayedBA;
+    pProbeResp->capabilityInfo.immediateBA    = pr.Capabilities.immediateBA;
+
+    if ( ! pr.SSID.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
+    }
+    else
+    {
+        pProbeResp->ssidPresent = 1;
+        ConvertSSID( pMac, &pProbeResp->ssId, &pr.SSID );
+    }
+
+    if ( ! pr.SuppRates.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
+    }
+    else
+    {
+        pProbeResp->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr.SuppRates );
+    }
+
+    if ( pr.ExtSuppRates.present )
+    {
+        pProbeResp->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr.ExtSuppRates );
+    }
+
+
+    if ( pr.CFParams.present )
+    {
+        pProbeResp->cfPresent = 1;
+        ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr.CFParams );
+    }
+
+    if ( pr.Country.present )
+    {
+        pProbeResp->countryInfoPresent = 1;
+        ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr.Country );
+    }
+
+    if ( pr.EDCAParamSet.present )
+    {
+        pProbeResp->edcaPresent = 1;
+        ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr.EDCAParamSet );
+    }
+
+    if ( pr.ChanSwitchAnn.present )
+    {
+        pProbeResp->channelSwitchPresent = 1;
+        palCopyMemory( pMac, &pProbeResp->channelSwitchIE, &pr.ChanSwitchAnn,
+                       sizeof(tDot11fIEExtChanSwitchAnn) );
+    }
+
+       if ( pr.ExtChanSwitchAnn.present )
+    {
+        pProbeResp->extChannelSwitchPresent = 1;
+        palCopyMemory( pMac, &pProbeResp->extChannelSwitchIE, &pr.ExtChanSwitchAnn,
+                       sizeof(tDot11fIEExtChanSwitchAnn) );
+    }
+
+    if( pr.TPCReport.present)
+    {
+        pProbeResp->tpcReportPresent = 1;
+        palCopyMemory(pMac->hHdd, &pProbeResp->tpcReport, &pr.TPCReport, sizeof(tDot11fIETPCReport));
+    }
+
+    if( pr.PowerConstraints.present)
+    {
+        pProbeResp->powerConstraintPresent = 1;
+        palCopyMemory(pMac->hHdd, &pProbeResp->localPowerConstraint, &pr.PowerConstraints, sizeof(tDot11fIEPowerConstraints));
+    }
+
+    if ( pr.Quiet.present )
+    {
+        pProbeResp->quietIEPresent = 1;
+        palCopyMemory( pMac, &pProbeResp->quietIE, &pr.Quiet, sizeof(tDot11fIEQuiet) );
+    }
+
+    if ( pr.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pProbeResp->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( pr.HTInfo.present )
+    {
+        palCopyMemory( pMac, &pProbeResp->HTInfo, &pr.HTInfo, sizeof( tDot11fIEHTInfo ) );
+    }
+
+    if ( pr.DSParams.present )
+    {
+        pProbeResp->dsParamsPresent = 1;
+        pProbeResp->channelNumber = pr.DSParams.curr_channel;
+    }
+    else if(pr.HTInfo.present)
+    {
+        pProbeResp->channelNumber = pr.HTInfo.primaryChannel;
+    }
+
+    if ( pr.RSN.present )
+    {
+        pProbeResp->rsnPresent = 1;
+        ConvertRSN( pMac, &pProbeResp->rsn, &pr.RSN );
+    }
+
+    if ( pr.WPA.present )
+    {
+        pProbeResp->wpaPresent = 1;
+        ConvertWPA( pMac, &pProbeResp->wpa, &pr.WPA );
+    }
+
+    if ( pr.WMMParams.present )
+    {
+        pProbeResp->wmeEdcaPresent = 1;
+        ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr.WMMParams );
+        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
+                                __printWMMParams(pMac, &pr.WMMParams);)
+    }
+
+    if ( pr.WMMInfoAp.present )
+    {
+        pProbeResp->wmeInfoPresent = 1;
+        PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
+    }
+
+    if ( pr.WMMCaps.present )
+    {
+        pProbeResp->wsmCapablePresent = 1;
+    }
+
+
+    if ( pr.ERPInfo.present )
+    {
+        pProbeResp->erpPresent = 1;
+        ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr.ERPInfo );
+    }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (pr.MobilityDomain.present)
+    {
+        // MobilityDomain
+        pProbeResp->mdiePresent = 1;
+        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr.MobilityDomain.MDID), sizeof(tANI_U16) );
+        pProbeResp->mdie[2] = ((pr.MobilityDomain.overDSCap << 0) | (pr.MobilityDomain.resourceReqCap << 1));
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+        limLog(pMac, LOGE, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
+               (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
+#endif
+    }
+#endif
+
+#if defined FEATURE_WLAN_CCX
+    if (pr.QBSSLoad.present)
+    {
+        palCopyMemory(pMac->hHdd, &pProbeResp->QBSSLoad, &pr.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
+    }
+#endif
+#ifdef WLAN_FEATURE_P2P
+    if (pr.P2PProbeRes.present)
+    {
+       palCopyMemory( pMac, &pProbeResp->P2PProbeRes, &pr.P2PProbeRes,
+                                                sizeof(tDot11fIEP2PProbeRes) );
+    }
+#endif
+    return eSIR_SUCCESS;
+
+} // End sirConvertProbeFrame2Struct.
+
+tSirRetStatus
+sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
+                               tANI_U8            *pFrame,
+                               tANI_U32            nFrame,
+                               tpSirAssocReq  pAssocReq)
+{
+    tDot11fAssocRequest ar;
+    tANI_U32                 status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&ar, sizeof( tDot11fAssocRequest ) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, &ar );
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
+
+    // make sure this is seen as an assoc request
+    pAssocReq->reassocRequest = 0;
+
+    // Capabilities
+    pAssocReq->capabilityInfo.ess            = ar.Capabilities.ess;
+    pAssocReq->capabilityInfo.ibss           = ar.Capabilities.ibss;
+    pAssocReq->capabilityInfo.cfPollable     = ar.Capabilities.cfPollable;
+    pAssocReq->capabilityInfo.cfPollReq      = ar.Capabilities.cfPollReq;
+    pAssocReq->capabilityInfo.privacy        = ar.Capabilities.privacy;
+    pAssocReq->capabilityInfo.shortPreamble  = ar.Capabilities.shortPreamble;
+    pAssocReq->capabilityInfo.pbcc           = ar.Capabilities.pbcc;
+    pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
+    pAssocReq->capabilityInfo.spectrumMgt    = ar.Capabilities.spectrumMgt;
+    pAssocReq->capabilityInfo.qos            = ar.Capabilities.qos;
+    pAssocReq->capabilityInfo.shortSlotTime  = ar.Capabilities.shortSlotTime;
+    pAssocReq->capabilityInfo.apsd           = ar.Capabilities.apsd;
+    pAssocReq->capabilityInfo.rrm            = ar.Capabilities.rrm;
+    pAssocReq->capabilityInfo.dsssOfdm       = ar.Capabilities.dsssOfdm;
+    pAssocReq->capabilityInfo.delayedBA       = ar.Capabilities.delayedBA;
+    pAssocReq->capabilityInfo.immediateBA    = ar.Capabilities.immediateBA;
+
+    // Listen Interval
+    pAssocReq->listenInterval = ar.ListenInterval.interval;
+
+    // SSID
+    if ( ar.SSID.present )
+    {
+        pAssocReq->ssidPresent = 1;
+        ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
+    }
+
+    // Supported Rates
+    if ( ar.SuppRates.present )
+    {
+        pAssocReq->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
+    }
+
+    // Extended Supported Rates
+    if ( ar.ExtSuppRates.present )
+    {
+        pAssocReq->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar.ExtSuppRates );
+    }
+
+    // QOS Capabilities:
+    if ( ar.QOSCapsStation.present )
+    {
+        pAssocReq->qosCapabilityPresent = 1;
+        ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
+    }
+
+    // WPA
+    if ( ar.WPAOpaque.present )
+    {
+        pAssocReq->wpaPresent = 1;
+        ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
+    }
+
+    // RSN
+    if ( ar.RSNOpaque.present )
+    {
+        pAssocReq->rsnPresent = 1;
+        ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
+    }
+
+    // WSC IE
+    if (ar.WscIEOpaque.present) 
+    {
+        pAssocReq->addIEPresent = 1;
+        ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
+    }
+    
+
+#ifdef WLAN_FEATURE_P2P
+    if(ar.P2PIEOpaque.present)
+    {
+        pAssocReq->addIEPresent = 1;
+        ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
+    }
+#endif
+
+    // Power Capabilities
+    if ( ar.PowerCaps.present )
+    {
+        pAssocReq->powerCapabilityPresent     = 1;
+        ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
+    }
+
+    // Supported Channels
+    if ( ar.SuppChannels.present )
+    {
+        pAssocReq->supportedChannelsPresent = 1;
+        ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
+    }
+
+    if ( ar.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( ar.WMMInfoStation.present )
+    {
+        pAssocReq->wmeInfoPresent = 1;
+#ifdef WLAN_SOFTAP_FEATURE
+        palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar.WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
+#endif
+
+    }
+
+
+    if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
+
+    if ( ! pAssocReq->ssidPresent )
+    {
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
+        return eSIR_FAILURE;
+    }
+
+    if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
+    {
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
+        return eSIR_FAILURE;
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertAssocReqFrame2Struct.
+
+tSirRetStatus
+sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
+                                tANI_U8            *pFrame,
+                                tANI_U32            nFrame,
+                                tpSirAssocRsp  pAssocRsp)
+{
+    static tDot11fAssocResponse ar;
+    tANI_U32                  status;
+    tANI_U8  cnt =0;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
+                   status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
+
+    // Capabilities
+    pAssocRsp->capabilityInfo.ess            = ar.Capabilities.ess;
+    pAssocRsp->capabilityInfo.ibss           = ar.Capabilities.ibss;
+    pAssocRsp->capabilityInfo.cfPollable     = ar.Capabilities.cfPollable;
+    pAssocRsp->capabilityInfo.cfPollReq      = ar.Capabilities.cfPollReq;
+    pAssocRsp->capabilityInfo.privacy        = ar.Capabilities.privacy;
+    pAssocRsp->capabilityInfo.shortPreamble  = ar.Capabilities.shortPreamble;
+    pAssocRsp->capabilityInfo.pbcc           = ar.Capabilities.pbcc;
+    pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
+    pAssocRsp->capabilityInfo.spectrumMgt    = ar.Capabilities.spectrumMgt;
+    pAssocRsp->capabilityInfo.qos            = ar.Capabilities.qos;
+    pAssocRsp->capabilityInfo.shortSlotTime  = ar.Capabilities.shortSlotTime;
+    pAssocRsp->capabilityInfo.apsd           = ar.Capabilities.apsd;
+    pAssocRsp->capabilityInfo.rrm            = ar.Capabilities.rrm;
+    pAssocRsp->capabilityInfo.dsssOfdm       = ar.Capabilities.dsssOfdm;
+    pAssocRsp->capabilityInfo.delayedBA       = ar.Capabilities.delayedBA;
+    pAssocRsp->capabilityInfo.immediateBA    = ar.Capabilities.immediateBA;
+
+    pAssocRsp->statusCode = ar.Status.status;
+    pAssocRsp->aid        = ar.AID.associd;
+
+    if ( ! ar.SuppRates.present )
+    {
+        pAssocRsp->suppRatesPresent = 0;
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
+    }
+    else
+    {
+        pAssocRsp->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
+    }
+
+    if ( ar.ExtSuppRates.present )
+    {
+        pAssocRsp->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
+    }
+
+    if ( ar.EDCAParamSet.present )
+    {
+        pAssocRsp->edcaPresent = 1;
+        ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
+    }
+
+
+    if ( ar.WMMParams.present )
+    {
+        pAssocRsp->wmeEdcaPresent = 1;
+        ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
+        limLog(pMac, LOGE, FL("WMM Parameter Element present in Association Response Frame!\n"));
+        __printWMMParams(pMac, &ar.WMMParams);
+    }
+
+    if ( ar.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( ar.HTInfo.present )
+    {
+        palCopyMemory( pMac, &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
+    }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (ar.MobilityDomain.present)
+    {
+        // MobilityDomain
+        pAssocRsp->mdiePresent = 1;
+        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID), sizeof(tANI_U16) );
+        pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+        limLog(pMac, LOGE, FL("new mdie=%02x%02x%02x\n"), (unsigned int)pAssocRsp->mdie[0],
+               (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
+#endif
+    }
+
+    if ( ar.FTInfo.present )
+    {
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+        limLog(pMac, LOGE, FL("FT Info present %d %d %d\n"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
+                ar.FTInfo.R0KH_ID.present,
+                ar.FTInfo.R1KH_ID.present);
+#endif
+        pAssocRsp->ftinfoPresent = 1;
+        palCopyMemory( pMac, &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
+    }
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (ar.num_RICDataDesc) {
+        for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
+            if (ar.RICDataDesc[cnt].present) {
+                palCopyMemory(pMac, &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt], sizeof(tDot11fIERICDataDesc));
+            }
+        }
+        pAssocRsp->num_RICData = ar.num_RICDataDesc;
+        pAssocRsp->ricPresent = TRUE;
+    }
+#endif    
+
+#ifdef FEATURE_WLAN_CCX
+    if (ar.num_WMMTSPEC) {
+        pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
+        for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
+            palCopyMemory(pMac, &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt], (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
+        }
+        pAssocRsp->tspecPresent = TRUE;
+    }
+   
+    if(ar.CCXTrafStrmMet.present)
+    {
+        pAssocRsp->tsmPresent = 1;
+        palCopyMemory(pMac->hHdd,&pAssocRsp->tsmIE.tsid,
+                &ar.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
+    }    
+#endif
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertAssocRespFrame2Struct.
+
+tSirRetStatus
+sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
+                                 tANI_U8            *pFrame,
+                                 tANI_U32            nFrame,
+                                 tpSirAssocReq  pAssocReq)
+{
+    static tDot11fReAssocRequest ar;
+    tANI_U32                   status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
+
+    // make sure this is seen as a re-assoc request
+    pAssocReq->reassocRequest = 1;
+
+    // Capabilities
+    pAssocReq->capabilityInfo.ess            = ar.Capabilities.ess;
+    pAssocReq->capabilityInfo.ibss           = ar.Capabilities.ibss;
+    pAssocReq->capabilityInfo.cfPollable     = ar.Capabilities.cfPollable;
+    pAssocReq->capabilityInfo.cfPollReq      = ar.Capabilities.cfPollReq;
+    pAssocReq->capabilityInfo.privacy        = ar.Capabilities.privacy;
+    pAssocReq->capabilityInfo.shortPreamble  = ar.Capabilities.shortPreamble;
+    pAssocReq->capabilityInfo.pbcc           = ar.Capabilities.pbcc;
+    pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
+    pAssocReq->capabilityInfo.spectrumMgt    = ar.Capabilities.spectrumMgt;
+    pAssocReq->capabilityInfo.qos            = ar.Capabilities.qos;
+    pAssocReq->capabilityInfo.shortSlotTime  = ar.Capabilities.shortSlotTime;
+    pAssocReq->capabilityInfo.apsd           = ar.Capabilities.apsd;
+    pAssocReq->capabilityInfo.rrm            = ar.Capabilities.rrm;
+    pAssocReq->capabilityInfo.dsssOfdm      = ar.Capabilities.dsssOfdm;
+    pAssocReq->capabilityInfo.delayedBA       = ar.Capabilities.delayedBA;
+    pAssocReq->capabilityInfo.immediateBA    = ar.Capabilities.immediateBA;
+
+    // Listen Interval
+    pAssocReq->listenInterval = ar.ListenInterval.interval;
+
+    // SSID
+    if ( ar.SSID.present )
+    {
+        pAssocReq->ssidPresent = 1;
+        ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
+    }
+
+    // Supported Rates
+    if ( ar.SuppRates.present )
+    {
+        pAssocReq->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
+    }
+
+    // Extended Supported Rates
+    if ( ar.ExtSuppRates.present )
+    {
+        pAssocReq->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
+                             &ar.ExtSuppRates );
+    }
+
+    // QOS Capabilities:
+    if ( ar.QOSCapsStation.present )
+    {
+        pAssocReq->qosCapabilityPresent = 1;
+        ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
+    }
+
+    // WPA
+    if ( ar.WPAOpaque.present )
+    {
+        pAssocReq->wpaPresent = 1;
+        ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
+    }
+
+    // RSN
+    if ( ar.RSNOpaque.present )
+    {
+        pAssocReq->rsnPresent = 1;
+        ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
+    }
+
+
+    // Power Capabilities
+    if ( ar.PowerCaps.present )
+    {
+        pAssocReq->powerCapabilityPresent     = 1;
+        ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
+    }
+
+    // Supported Channels
+    if ( ar.SuppChannels.present )
+    {
+        pAssocReq->supportedChannelsPresent = 1;
+        ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
+    }
+
+    if ( ar.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( ar.WMMInfoStation.present )
+    {
+        pAssocReq->wmeInfoPresent = 1;
+#ifdef WLAN_SOFTAP_FEATURE
+        palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar.WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
+#endif
+
+    }
+
+    if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
+
+    if ( ! pAssocReq->ssidPresent )
+    {
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
+        return eSIR_FAILURE;
+    }
+
+    if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
+    {
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
+        return eSIR_FAILURE;
+    }
+
+    // Why no call to 'updateAssocReqFromPropCapability' here, like
+    // there is in 'sirConvertAssocReqFrame2Struct'?
+
+    // WSC IE
+    if (ar.WscIEOpaque.present) 
+    {
+        pAssocReq->addIEPresent = 1;
+        ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
+    }
+    
+#ifdef WLAN_FEATURE_P2P
+    if(ar.P2PIEOpaque.present)
+    {
+        pAssocReq->addIEPresent = 1;
+        ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
+    }
+#endif
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertReassocReqFrame2Struct.
+
+tSirRetStatus
+sirParseBeaconIE(tpAniSirGlobal        pMac,
+                 tpSirProbeRespBeacon  pBeaconStruct,
+                 tANI_U8                   *pPayload,
+                 tANI_U32                   nPayload)
+{
+    tDot11fBeaconIEs *pBies;
+    tANI_U32              status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon) );
+
+    status = palAllocateMemory(pMac->hHdd, (void **)&pBies, sizeof(tDot11fBeaconIEs));
+    if(!HAL_STATUS_SUCCESS(status))
+    {
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
+        return eSIR_FAILURE;
+    }
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
+                  status, nPayload);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
+        palFreeMemory(pMac->hHdd, pBies);
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
+                 status, nPayload );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
+    }
+
+    // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
+    if ( ! pBies->SSID.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
+    }
+    else
+    {
+        pBeaconStruct->ssidPresent = 1;
+        ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
+    }
+
+    if ( ! pBies->SuppRates.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
+    }
+    else
+    {
+        pBeaconStruct->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
+    }
+
+    if ( pBies->ExtSuppRates.present )
+    {
+        pBeaconStruct->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
+    }
+
+    if ( pBies->CFParams.present )
+    {
+        pBeaconStruct->cfPresent = 1;
+        ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
+    }
+
+    if ( pBies->TIM.present )
+    {
+        pBeaconStruct->timPresent = 1;
+        ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
+    }
+
+    if ( pBies->Country.present )
+    {
+        pBeaconStruct->countryInfoPresent = 1;
+        ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
+    }
+
+    // 11h IEs
+    if(pBies->TPCReport.present)
+    {
+        pBeaconStruct->tpcReportPresent = 1;
+        palCopyMemory(pMac,
+                      &pBeaconStruct->tpcReport,
+                      &pBies->TPCReport,
+                      sizeof( tDot11fIETPCReport));
+    }
+
+    if(pBies->PowerConstraints.present)
+    {
+        pBeaconStruct->powerConstraintPresent = 1;
+        palCopyMemory(pMac,
+                      &pBeaconStruct->localPowerConstraint,
+                      &pBies->PowerConstraints,
+                      sizeof(tDot11fIEPowerConstraints));
+    }
+#ifdef FEATURE_WLAN_CCX
+    if(pBies->CCXTxmitPower.present)
+    {
+        pBeaconStruct->ccxTxPwr.present = 1;
+        pBeaconStruct->ccxTxPwr.power_limit = pBies->CCXTxmitPower.power_limit;
+    }
+    if (pBies->QBSSLoad.present)
+    {
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
+    }
+#endif
+
+    if ( pBies->EDCAParamSet.present )
+    {
+        pBeaconStruct->edcaPresent = 1;
+        ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
+    }
+
+    // QOS Capabilities:
+    if ( pBies->QOSCapsAp.present )
+    {
+        pBeaconStruct->qosCapabilityPresent = 1;
+        ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
+    }
+
+
+
+    if ( pBies->ChanSwitchAnn.present )
+    {
+        pBeaconStruct->channelSwitchPresent = 1;
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
+                      sizeof(tDot11fIEChanSwitchAnn));
+    }
+
+    if ( pBies->ExtChanSwitchAnn.present)
+    {
+        pBeaconStruct->extChannelSwitchPresent= 1;
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
+                      sizeof(tDot11fIEExtChanSwitchAnn));
+    }
+
+    if ( pBies->Quiet.present )
+    {
+        pBeaconStruct->quietIEPresent = 1;
+        palCopyMemory( pMac, &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
+    }
+
+    if ( pBies->HTCaps.present )
+    {
+        palCopyMemory( pMac, &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( pBies->HTInfo.present )
+    {
+        palCopyMemory( pMac, &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
+    }
+
+    if ( pBies->DSParams.present )
+    {
+        pBeaconStruct->dsParamsPresent = 1;
+        pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
+    }
+    else if(pBies->HTInfo.present)
+    {
+        pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
+    }
+    
+    if ( pBies->RSN.present )
+    {
+        pBeaconStruct->rsnPresent = 1;
+        ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
+    }
+
+    if ( pBies->WPA.present )
+    {
+        pBeaconStruct->wpaPresent = 1;
+        ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
+    }
+
+    if ( pBies->WMMParams.present )
+    {
+        pBeaconStruct->wmeEdcaPresent = 1;
+        ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
+    }
+
+    if ( pBies->WMMInfoAp.present )
+    {
+        pBeaconStruct->wmeInfoPresent = 1;
+    }
+
+    if ( pBies->WMMCaps.present )
+    {
+        pBeaconStruct->wsmCapablePresent = 1;
+    }
+
+
+    if ( pBies->ERPInfo.present )
+    {
+        pBeaconStruct->erpPresent = 1;
+        ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
+    }
+
+    palFreeMemory(pMac->hHdd, pBies);
+
+    return eSIR_SUCCESS;
+
+} // End sirParseBeaconIE.
+
+tSirRetStatus
+sirConvertBeaconFrame2Struct(tpAniSirGlobal       pMac,
+                             tANI_U8             *pFrame,
+                             tpSirProbeRespBeacon pBeaconStruct)
+{
+    tDot11fBeacon   beacon;
+    tANI_U32        status, nPayload;
+    tANI_U8        *pPayload;
+    tpSirMacMgmtHdr pHdr;
+    tANI_U8         mappedRXCh;
+
+    pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
+    nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
+    pHdr     = WDA_GET_RX_MAC_HEADER( pFrame );
+    mappedRXCh = WDA_GET_RX_CH( pFrame );
+    
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&beacon, sizeof(tDot11fBeacon) );
+
+    // get the MAC address out of the BD,
+    palCopyMemory( pMac->hHdd, pBeaconStruct->bssid, pHdr->sa, 6 );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackBeacon( pMac, pPayload, nPayload, &beacon );
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
+                  status, nPayload);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
+                 status, nPayload );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
+    }
+
+    // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
+    // Timestamp
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&beacon.TimeStamp, sizeof(tSirMacTimeStamp) );
+
+    // Beacon Interval
+    pBeaconStruct->beaconInterval = beacon.BeaconInterval.interval;
+
+    // Capabilities
+    pBeaconStruct->capabilityInfo.ess            = beacon.Capabilities.ess;
+    pBeaconStruct->capabilityInfo.ibss           = beacon.Capabilities.ibss;
+    pBeaconStruct->capabilityInfo.cfPollable     = beacon.Capabilities.cfPollable;
+    pBeaconStruct->capabilityInfo.cfPollReq      = beacon.Capabilities.cfPollReq;
+    pBeaconStruct->capabilityInfo.privacy        = beacon.Capabilities.privacy;
+    pBeaconStruct->capabilityInfo.shortPreamble  = beacon.Capabilities.shortPreamble;
+    pBeaconStruct->capabilityInfo.pbcc           = beacon.Capabilities.pbcc;
+    pBeaconStruct->capabilityInfo.channelAgility = beacon.Capabilities.channelAgility;
+    pBeaconStruct->capabilityInfo.spectrumMgt    = beacon.Capabilities.spectrumMgt;
+    pBeaconStruct->capabilityInfo.qos            = beacon.Capabilities.qos;
+    pBeaconStruct->capabilityInfo.shortSlotTime  = beacon.Capabilities.shortSlotTime;
+    pBeaconStruct->capabilityInfo.apsd           = beacon.Capabilities.apsd;
+    pBeaconStruct->capabilityInfo.rrm            = beacon.Capabilities.rrm;
+    pBeaconStruct->capabilityInfo.dsssOfdm      = beacon.Capabilities.dsssOfdm;
+    pBeaconStruct->capabilityInfo.delayedBA     = beacon.Capabilities.delayedBA;
+    pBeaconStruct->capabilityInfo.immediateBA    = beacon.Capabilities.immediateBA;
+ 
+    if ( ! beacon.SSID.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
+    }
+    else
+    {
+        pBeaconStruct->ssidPresent = 1;
+        ConvertSSID( pMac, &pBeaconStruct->ssId, &beacon.SSID );
+    }
+
+    if ( ! beacon.SuppRates.present )
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
+    }
+    else
+    {
+        pBeaconStruct->suppRatesPresent = 1;
+        ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &beacon.SuppRates );
+    }
+
+    if ( beacon.ExtSuppRates.present )
+    {
+        pBeaconStruct->extendedRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &beacon.ExtSuppRates );
+    }
+
+
+    if ( beacon.CFParams.present )
+    {
+        pBeaconStruct->cfPresent = 1;
+        ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &beacon.CFParams );
+    }
+
+    if ( beacon.TIM.present )
+    {
+        pBeaconStruct->timPresent = 1;
+        ConvertTIM( pMac, &pBeaconStruct->tim, &beacon.TIM );
+    }
+
+    if ( beacon.Country.present )
+    {
+        pBeaconStruct->countryInfoPresent = 1;
+        ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &beacon.Country );
+    }
+
+    // QOS Capabilities:
+    if ( beacon.QOSCapsAp.present )
+    {
+        pBeaconStruct->qosCapabilityPresent = 1;
+        ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &beacon.QOSCapsAp );
+    }
+
+    if ( beacon.EDCAParamSet.present )
+    {
+        pBeaconStruct->edcaPresent = 1;
+        ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &beacon.EDCAParamSet );
+    }
+
+    if ( beacon.ChanSwitchAnn.present )
+    {
+        pBeaconStruct->channelSwitchPresent = 1;
+        palCopyMemory( pMac, &pBeaconStruct->channelSwitchIE, &beacon.ChanSwitchAnn,
+                                                       sizeof(tDot11fIEChanSwitchAnn) );
+    }
+
+    if ( beacon.ExtChanSwitchAnn.present )
+    {
+        pBeaconStruct->extChannelSwitchPresent = 1;
+        palCopyMemory( pMac, &pBeaconStruct->extChannelSwitchIE, &beacon.ExtChanSwitchAnn,
+                                                       sizeof(tDot11fIEExtChanSwitchAnn) );
+    }
+
+    if( beacon.TPCReport.present)
+    {
+        pBeaconStruct->tpcReportPresent = 1;
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->tpcReport, &beacon.TPCReport,
+                                                     sizeof(tDot11fIETPCReport));
+    }
+
+    if( beacon.PowerConstraints.present)
+    {
+        pBeaconStruct->powerConstraintPresent = 1;
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->localPowerConstraint, &beacon.PowerConstraints,
+                                                               sizeof(tDot11fIEPowerConstraints));
+    }
+#if defined FEATURE_WLAN_CCX
+    if (beacon.CCXTxmitPower.present)
+    {
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->ccxTxPwr, &beacon.CCXTxmitPower,
+                                                               sizeof(tDot11fIECCXTxmitPower));
+    }
+    if (beacon.QBSSLoad.present)
+    {
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->QBSSLoad, &beacon.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
+    }
+#endif
+    if ( beacon.Quiet.present )
+    {
+        pBeaconStruct->quietIEPresent = 1;
+        palCopyMemory( pMac, &pBeaconStruct->quietIE, &beacon.Quiet, sizeof(tDot11fIEQuiet));
+    }
+
+    if ( beacon.HTCaps.present )
+    {
+        palCopyMemory( pMac, &pBeaconStruct->HTCaps, &beacon.HTCaps, sizeof( tDot11fIEHTCaps ) );
+    }
+
+    if ( beacon.HTInfo.present )
+    {
+        palCopyMemory( pMac, &pBeaconStruct->HTInfo, &beacon.HTInfo, sizeof( tDot11fIEHTInfo) );
+
+    }
+
+    if ( beacon.DSParams.present )
+    {
+        pBeaconStruct->dsParamsPresent = 1;
+        pBeaconStruct->channelNumber = beacon.DSParams.curr_channel;
+    }
+    else if(beacon.HTInfo.present)
+    {
+        pBeaconStruct->channelNumber = beacon.HTInfo.primaryChannel;
+    }
+    else
+    {
+        pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
+    }
+
+    if ( beacon.RSN.present )
+    {
+        pBeaconStruct->rsnPresent = 1;
+        ConvertRSN( pMac, &pBeaconStruct->rsn, &beacon.RSN );
+    }
+
+    if ( beacon.WPA.present )
+    {
+        pBeaconStruct->wpaPresent = 1;
+        ConvertWPA( pMac, &pBeaconStruct->wpa, &beacon.WPA );
+    }
+
+    if ( beacon.WMMParams.present )
+    {
+        pBeaconStruct->wmeEdcaPresent = 1;
+        ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &beacon.WMMParams );
+        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
+        __printWMMParams(pMac, &beacon.WMMParams); )
+    }
+
+    if ( beacon.WMMInfoAp.present )
+    {
+        pBeaconStruct->wmeInfoPresent = 1;
+        PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
+    }
+
+    if ( beacon.WMMCaps.present )
+    {
+        pBeaconStruct->wsmCapablePresent = 1;
+    }
+
+    if ( beacon.ERPInfo.present )
+    {
+        pBeaconStruct->erpPresent = 1;
+        ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &beacon.ERPInfo );
+    }
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    if (beacon.MobilityDomain.present)
+    {
+        // MobilityDomain
+        pBeaconStruct->mdiePresent = 1;
+        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pBeaconStruct->mdie[0]), (tANI_U8 *)&(beacon.MobilityDomain.MDID), sizeof(tANI_U16) );
+        pBeaconStruct->mdie[2] = ((beacon.MobilityDomain.overDSCap << 0) | (beacon.MobilityDomain.resourceReqCap << 1));
+
+    }
+#endif
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertBeaconFrame2Struct.
+
+tSirRetStatus
+sirConvertAuthFrame2Struct(tpAniSirGlobal        pMac,
+                           tANI_U8                   *pFrame,
+                           tANI_U32                   nFrame,
+                           tpSirMacAuthFrameBody pAuth)
+{
+    static tDot11fAuthentication auth;
+    tANI_U32                   status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
+    pAuth->authAlgoNumber           = auth.AuthAlgo.algo;
+    pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
+    pAuth->authStatusCode           = auth.Status.status;
+
+    if ( auth.ChallengeText.present )
+    {
+        pAuth->type   = SIR_MAC_CHALLENGE_TEXT_EID;
+        pAuth->length = auth.ChallengeText.num_text;
+        palCopyMemory( pMac->hHdd, pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertAuthFrame2Struct.
+
+tSirRetStatus
+sirConvertAddtsReq2Struct(tpAniSirGlobal    pMac,
+                          tANI_U8               *pFrame,
+                          tANI_U32               nFrame,
+                          tSirAddtsReqInfo *pAddTs)
+{
+    tDot11fAddTSRequest    addts = {{0}};
+    tDot11fWMMAddTSRequest wmmaddts = {{0}};
+    tANI_U8                     j;
+    tANI_U16                    i;
+    tANI_U32                    status;
+
+    if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
+    {
+        limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
+                                  "with an Action of %d; this is not "
+                                  "supported & is probably an error."),
+                   *( pFrame + 1 ) );
+        return eSIR_FAILURE;
+    }
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo) );
+
+    // delegate to the framesc-generated code,
+    switch ( *pFrame )
+    {
+    case SIR_MAC_ACTION_QOS_MGMT:
+        status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
+        break;
+    case SIR_MAC_ACTION_WME:
+        status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
+        break;
+    default:
+        limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
+                                  "with a Category of %d; this is not"
+                                  " supported & is probably an error."),
+                   *pFrame );
+        return eSIR_FAILURE;
+    }
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
+                                 "rame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpackin"
+                                  "g an Add TS Request frame (0x%08x,"
+                                  "%d bytes):\n"),
+                   status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fAddTSRequest' or a
+    // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
+    if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
+    {
+        pAddTs->dialogToken = addts.DialogToken.token;
+
+        if ( addts.TSPEC.present )
+        {
+            ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
+        }
+        else
+        {
+            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
+            return eSIR_FAILURE;
+        }
+
+        if ( addts.num_TCLAS )
+        {
+            pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
+
+            for ( i = 0U; i < addts.num_TCLAS; ++i )
+            {
+                if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
+                {
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
+                    return eSIR_FAILURE;
+                }
+            }
+        }
+
+        if ( addts.TCLASSPROC.present )
+        {
+            pAddTs->tclasProcPresent = 1;
+            pAddTs->tclasProc = addts.TCLASSPROC.processing;
+        }
+
+        if ( addts.WMMTSPEC.present )
+        {
+            pAddTs->wsmTspecPresent = 1;
+            ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
+        }
+
+        if ( addts.num_WMMTCLAS )
+        {
+            j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
+            if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
+
+            for ( i = pAddTs->numTclas; i < j; ++i )
+            {
+                if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
+                {
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
+                    return eSIR_FAILURE;
+                }
+            }
+        }
+
+        if ( addts.WMMTCLASPROC.present )
+        {
+            pAddTs->tclasProcPresent = 1;
+            pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
+        }
+
+        if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
+        {
+            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
+                       pAddTs->numTclas );
+            return eSIR_FAILURE;
+        }
+    }
+    else
+    {
+        pAddTs->dialogToken = wmmaddts.DialogToken.token;
+
+        if ( wmmaddts.WMMTSPEC.present )
+        {
+            pAddTs->wmeTspecPresent = 1;
+            ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
+        }
+        else
+        {
+            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
+            return eSIR_FAILURE;
+        }
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertAddtsReq2Struct.
+
+tSirRetStatus
+sirConvertAddtsRsp2Struct(tpAniSirGlobal    pMac,
+                          tANI_U8               *pFrame,
+                          tANI_U32               nFrame,
+                          tSirAddtsRspInfo *pAddTs)
+{
+    tDot11fAddTSResponse    addts = {{0}};
+    tDot11fWMMAddTSResponse wmmaddts = {{0}};
+    tANI_U8                      j;
+    tANI_U16                     i;
+    tANI_U32                     status;
+
+    if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
+    {
+        limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
+                                  "with an Action of %d; this is not "
+                                  "supported & is probably an error."),
+                   *( pFrame + 1 ) );
+        return eSIR_FAILURE;
+    }
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse) );
+
+
+    // delegate to the framesc-generated code,
+    switch ( *pFrame )
+    {
+    case SIR_MAC_ACTION_QOS_MGMT:
+        status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
+        break;
+    case SIR_MAC_ACTION_WME:
+        status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
+        break;
+    default:
+        limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
+                                  "with a Category of %d; this is not"
+                                  " supported & is probably an error."),
+                   *pFrame );
+        return eSIR_FAILURE;
+    }
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
+                                 "rame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpackin"
+                                  "g an Add TS Response frame (0x%08x,"
+                                  "%d bytes):\n"),
+                   status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fAddTSResponse' or a
+    // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
+    if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
+    {
+        pAddTs->dialogToken = addts.DialogToken.token;
+        pAddTs->status      = ( tSirMacStatusCodes )addts.Status.status;
+
+        if ( addts.TSDelay.present )
+        {
+            ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
+        }
+
+        // TS Delay is present iff status indicates its presence
+        if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
+        {
+            limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
+        }
+
+        if ( addts.TSPEC.present )
+        {
+            ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
+        }
+        else
+        {
+            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
+            return eSIR_FAILURE;
+        }
+
+        if ( addts.num_TCLAS )
+        {
+            pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
+
+            for ( i = 0U; i < addts.num_TCLAS; ++i )
+            {
+                if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
+                {
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
+                    return eSIR_FAILURE;
+                }
+            }
+        }
+
+        if ( addts.TCLASSPROC.present )
+        {
+            pAddTs->tclasProcPresent = 1;
+            pAddTs->tclasProc = addts.TCLASSPROC.processing;
+        }
+#ifdef FEATURE_WLAN_CCX
+        if(addts.CCXTrafStrmMet.present)
+        {
+            pAddTs->tsmPresent = 1;
+            palCopyMemory(pMac->hHdd,&pAddTs->tsmIE.tsid,
+                      &addts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
+        }
+#endif
+        if ( addts.Schedule.present )
+        {
+            pAddTs->schedulePresent = 1;
+            ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
+        }
+
+        if ( addts.WMMSchedule.present )
+        {
+            pAddTs->schedulePresent = 1;
+            ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
+        }
+
+        if ( addts.WMMTSPEC.present )
+        {
+            pAddTs->wsmTspecPresent = 1;
+            ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
+        }
+
+        if ( addts.num_WMMTCLAS )
+        {
+            j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
+            if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
+
+            for ( i = pAddTs->numTclas; i < j; ++i )
+            {
+                if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
+                {
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
+                    return eSIR_FAILURE;
+                }
+            }
+        }
+
+        if ( addts.WMMTCLASPROC.present )
+        {
+            pAddTs->tclasProcPresent = 1;
+            pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
+        }
+
+        if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
+        {
+            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
+                       pAddTs->numTclas );
+            return eSIR_FAILURE;
+        }
+    }
+    else
+    {
+        pAddTs->dialogToken = wmmaddts.DialogToken.token;
+        pAddTs->status      = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
+
+        if ( wmmaddts.WMMTSPEC.present )
+        {
+            pAddTs->wmeTspecPresent = 1;
+            ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
+        }
+        else
+        {
+            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
+            return eSIR_FAILURE;
+        }
+
+#ifdef FEATURE_WLAN_CCX
+        if(wmmaddts.CCXTrafStrmMet.present)
+        {
+            pAddTs->tsmPresent = 1;
+            palCopyMemory(pMac->hHdd,&pAddTs->tsmIE.tsid,
+                         &wmmaddts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
+        }
+#endif
+
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertAddtsRsp2Struct.
+
+tSirRetStatus
+sirConvertDeltsReq2Struct(tpAniSirGlobal    pMac,
+                          tANI_U8               *pFrame,
+                          tANI_U32               nFrame,
+                          tSirDeltsReqInfo *pDelTs)
+{
+    tDot11fDelTS    delts = {{0}};
+    tDot11fWMMDelTS wmmdelts = {{0}};
+    tANI_U32             status;
+
+    if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
+    {
+        limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
+                                  "with an Action of %d; this is not "
+                                  "supported & is probably an error."),
+                   *( pFrame + 1 ) );
+        return eSIR_FAILURE;
+    }
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo) );
+
+    // delegate to the framesc-generated code,
+    switch ( *pFrame )
+    {
+    case SIR_MAC_ACTION_QOS_MGMT:
+        status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
+        break;
+    case SIR_MAC_ACTION_WME:
+        status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
+        break;
+    default:
+        limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
+                                  "with a Category of %d; this is not"
+                                  " supported & is probably an error."),
+                   *pFrame );
+        return eSIR_FAILURE;
+    }
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
+                                 "rame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
+                                  "g an Del TS Request frame (0x%08x,"
+                                  "%d bytes):\n"),
+                   status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fDelTSResponse' or a
+    // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
+    if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
+    {
+        pDelTs->tsinfo.traffic.trafficType  = (tANI_U16)delts.TSInfo.traffic_type;
+        pDelTs->tsinfo.traffic.tsid         = (tANI_U16)delts.TSInfo.tsid;
+        pDelTs->tsinfo.traffic.direction    = (tANI_U16)delts.TSInfo.direction;
+        pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
+        pDelTs->tsinfo.traffic.aggregation  = (tANI_U16)delts.TSInfo.aggregation;
+        pDelTs->tsinfo.traffic.psb          = (tANI_U16)delts.TSInfo.psb;
+        pDelTs->tsinfo.traffic.userPrio     = (tANI_U16)delts.TSInfo.user_priority;
+        pDelTs->tsinfo.traffic.ackPolicy    = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
+
+        pDelTs->tsinfo.schedule.schedule    = (tANI_U8)delts.TSInfo.schedule;
+    }
+    else
+    {
+        if ( wmmdelts.WMMTSPEC.present )
+        {
+            pDelTs->wmeTspecPresent = 1;
+            ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
+        }
+        else
+        {
+            dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
+            return eSIR_FAILURE;
+        }
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertDeltsReq2Struct.
+
+
+#ifdef ANI_SUPPORT_11H
+tSirRetStatus
+sirConvertTpcReqFrame2Struct(tpAniSirGlobal            pMac,
+                             tANI_U8                       *pFrame,
+                             tpSirMacTpcReqActionFrame pTpcReqFrame,
+                             tANI_U32                       nFrame)
+{
+    tDot11fTPCRequest     req;
+    tANI_U32                   status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
+    if ( DOT11F_FAILED( status ) )
+    {
+        dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fTPCRequest' to a
+    // 'tSirMacTpcReqActionFrame'...
+    pTpcReqFrame->actionHeader.category    = req.Category.category;
+    pTpcReqFrame->actionHeader.actionID    = req.Action.action;
+    pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
+    if ( req.TPCRequest.present )
+    {
+        pTpcReqFrame->type   = DOT11F_EID_TPCREQUEST;
+        pTpcReqFrame->length = 0;
+    }
+    else
+    {
+        dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
+        return eSIR_FAILURE;
+    }
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertTpcReqFrame2Struct.
+
+
+tSirRetStatus
+sirConvertMeasReqFrame2Struct(tpAniSirGlobal             pMac,
+                              tANI_U8                        *pFrame,
+                              tpSirMacMeasReqActionFrame pMeasReqFrame,
+                              tANI_U32                        nFrame)
+{
+    tDot11fMeasurementRequest mr;
+    tANI_U32                       status;
+
+    // Zero-init our [out] parameter,
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame) );
+
+    // delegate to the framesc-generated code,
+    status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
+    if ( DOT11F_FAILED( status ) )
+    {
+        dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
+                  status, nFrame);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
+                 status, nFrame );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+
+    // & "transliterate" from a 'tDot11fMeasurementRequest' to a
+    // 'tpSirMacMeasReqActionFrame'...
+    pMeasReqFrame->actionHeader.category    = mr.Category.category;
+    pMeasReqFrame->actionHeader.actionID    = mr.Action.action;
+    pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
+
+    if ( 0 == mr.num_MeasurementRequest )
+    {
+        dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
+        return eSIR_FAILURE;
+    }
+    else if ( 1 < mr.num_MeasurementRequest )
+    {
+        limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
+    }
+
+    pMeasReqFrame->measReqIE.type        = DOT11F_EID_MEASUREMENTREQUEST;
+    pMeasReqFrame->measReqIE.length      = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
+    pMeasReqFrame->measReqIE.measToken   = mr.MeasurementRequest[0].measurement_token;
+    pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
+                                           ( mr.MeasurementRequest[0].enable   << 2 ) |
+                                           ( mr.MeasurementRequest[0].request  << 1 ) |
+                                           ( mr.MeasurementRequest[0].report /*<< 0*/ );
+    pMeasReqFrame->measReqIE.measType    = mr.MeasurementRequest[0].measurement_type;
+
+    pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
+
+    palCopyMemory( pMac->hHdd, pMeasReqFrame->measReqIE.measReqField.measStartTime,
+                   mr.MeasurementRequest[0].meas_start_time, 8 );
+
+    pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
+
+    return eSIR_SUCCESS;
+
+} // End sirConvertMeasReqFrame2Struct.
+#endif
+
+
+void
+PopulateDot11fTSPEC(tSirMacTspecIE  *pOld,
+                    tDot11fIETSPEC  *pDot11f)
+{
+    pDot11f->traffic_type         = pOld->tsinfo.traffic.trafficType;
+    pDot11f->tsid                 = pOld->tsinfo.traffic.tsid;
+    pDot11f->direction            = pOld->tsinfo.traffic.direction;
+    pDot11f->access_policy        = pOld->tsinfo.traffic.accessPolicy;
+    pDot11f->aggregation          = pOld->tsinfo.traffic.aggregation;
+    pDot11f->psb                  = pOld->tsinfo.traffic.psb;
+    pDot11f->user_priority        = pOld->tsinfo.traffic.userPrio;
+    pDot11f->tsinfo_ack_pol       = pOld->tsinfo.traffic.ackPolicy;
+    pDot11f->schedule             = pOld->tsinfo.schedule.schedule;
+    /* As defined in IEEE 802.11-2007, section 7.3.2.30
+     * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
+     */
+    pDot11f->size                 = ( pOld->nomMsduSz & 0x7fff );
+    pDot11f->fixed                = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
+    pDot11f->max_msdu_size        = pOld->maxMsduSz;
+    pDot11f->min_service_int      = pOld->minSvcInterval;
+    pDot11f->max_service_int      = pOld->maxSvcInterval;
+    pDot11f->inactivity_int       = pOld->inactInterval;
+    pDot11f->suspension_int       = pOld->suspendInterval;
+    pDot11f->service_start_time   = pOld->svcStartTime;
+    pDot11f->min_data_rate        = pOld->minDataRate;
+    pDot11f->mean_data_rate       = pOld->meanDataRate;
+    pDot11f->peak_data_rate       = pOld->peakDataRate;
+    pDot11f->burst_size           = pOld->maxBurstSz;
+    pDot11f->delay_bound          = pOld->delayBound;
+    pDot11f->min_phy_rate         = pOld->minPhyRate;
+    pDot11f->surplus_bw_allowance = pOld->surplusBw;
+    pDot11f->medium_time          = pOld->mediumTime;
+
+    pDot11f->present = 1;
+
+} // End PopulateDot11fTSPEC.
+
+void
+PopulateDot11fWMMTSPEC(tSirMacTspecIE     *pOld,
+                       tDot11fIEWMMTSPEC  *pDot11f)
+{
+    pDot11f->traffic_type         = pOld->tsinfo.traffic.trafficType;
+    pDot11f->tsid                 = pOld->tsinfo.traffic.tsid;
+    pDot11f->direction            = pOld->tsinfo.traffic.direction;
+    pDot11f->access_policy        = pOld->tsinfo.traffic.accessPolicy;
+    pDot11f->aggregation          = pOld->tsinfo.traffic.aggregation;
+    pDot11f->psb                  = pOld->tsinfo.traffic.psb;
+    pDot11f->user_priority        = pOld->tsinfo.traffic.userPrio;
+    pDot11f->tsinfo_ack_pol       = pOld->tsinfo.traffic.ackPolicy;
+    pDot11f->burst_size_defn      = pOld->tsinfo.traffic.burstSizeDefn;
+    /* As defined in IEEE 802.11-2007, section 7.3.2.30
+     * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
+     */
+    pDot11f->size                 = ( pOld->nomMsduSz & 0x7fff );
+    pDot11f->fixed                = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
+    pDot11f->max_msdu_size        = pOld->maxMsduSz;
+    pDot11f->min_service_int      = pOld->minSvcInterval;
+    pDot11f->max_service_int      = pOld->maxSvcInterval;
+    pDot11f->inactivity_int       = pOld->inactInterval;
+    pDot11f->suspension_int       = pOld->suspendInterval;
+    pDot11f->service_start_time   = pOld->svcStartTime;
+    pDot11f->min_data_rate        = pOld->minDataRate;
+    pDot11f->mean_data_rate       = pOld->meanDataRate;
+    pDot11f->peak_data_rate       = pOld->peakDataRate;
+    pDot11f->burst_size           = pOld->maxBurstSz;
+    pDot11f->delay_bound          = pOld->delayBound;
+    pDot11f->min_phy_rate         = pOld->minPhyRate;
+    pDot11f->surplus_bw_allowance = pOld->surplusBw;
+    pDot11f->medium_time          = pOld->mediumTime;
+
+    pDot11f->version = 1;
+    pDot11f->present = 1;
+
+} // End PopulateDot11fWMMTSPEC.
+
+#ifdef FEATURE_WLAN_CCX
+void PopulateDot11TSRSIE(tpAniSirGlobal  pMac,
+                               tSirMacCCXTSRSIE     *pOld,
+                               tDot11fIECCXTrafStrmRateSet  *pDot11f,
+                               tANI_U8 rate_length)
+{
+    pDot11f->tsid = pOld->tsid;
+    palCopyMemory(pMac->hHdd,pDot11f->tsrates, pOld->rates,rate_length);
+    pDot11f->num_tsrates = rate_length;
+    pDot11f->present = 1;
+}
+#endif
+
+
+tSirRetStatus
+PopulateDot11fTCLAS(tpAniSirGlobal  pMac,
+                    tSirTclasInfo  *pOld,
+                    tDot11fIETCLAS *pDot11f)
+{
+    pDot11f->user_priority   = pOld->tclas.userPrio;
+    pDot11f->classifier_type = pOld->tclas.classifierType;
+    pDot11f->classifier_mask = pOld->tclas.classifierMask;
+
+    switch ( pDot11f->classifier_type )
+    {
+    case SIR_MAC_TCLASTYPE_ETHERNET:
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.source,
+                       ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.dest,
+                       ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
+        pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
+        break;
+    case SIR_MAC_TCLASTYPE_TCPUDPIP:
+        pDot11f->info.IpParams.version = pOld->version;
+        if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
+        {
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV4Params.source,
+                           ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV4Params.dest,
+                           ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
+            pDot11f->info.IpParams.params.IpV4Params.src_port  =
+              pOld->tclasParams.ipv4.srcPort;
+            pDot11f->info.IpParams.params.IpV4Params.dest_port =
+              pOld->tclasParams.ipv4.dstPort;
+            pDot11f->info.IpParams.params.IpV4Params.DSCP      =
+              pOld->tclasParams.ipv4.dscp;
+            pDot11f->info.IpParams.params.IpV4Params.proto     =
+              pOld->tclasParams.ipv4.protocol;
+            pDot11f->info.IpParams.params.IpV4Params.reserved  =
+              pOld->tclasParams.ipv4.rsvd;
+        }
+        else
+        {
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.source,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.dest,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
+            pDot11f->info.IpParams.params.IpV6Params.src_port  =
+              pOld->tclasParams.ipv6.srcPort;
+            pDot11f->info.IpParams.params.IpV6Params.dest_port =
+              pOld->tclasParams.ipv6.dstPort;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.flow_label,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
+        }
+        break;
+    case SIR_MAC_TCLASTYPE_8021DQ:
+        pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
+        break;
+    default:
+        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
+                pDot11f->classifier_type );
+        return eSIR_FAILURE;
+    }
+
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fTCLAS.
+
+tSirRetStatus
+PopulateDot11fWMMTCLAS(tpAniSirGlobal     pMac,
+                       tSirTclasInfo     *pOld,
+                       tDot11fIEWMMTCLAS *pDot11f)
+{
+    pDot11f->version         = 1;
+    pDot11f->user_priority   = pOld->tclas.userPrio;
+    pDot11f->classifier_type = pOld->tclas.classifierType;
+    pDot11f->classifier_mask = pOld->tclas.classifierMask;
+
+    switch ( pDot11f->classifier_type )
+    {
+    case SIR_MAC_TCLASTYPE_ETHERNET:
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.source,
+                       ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
+        palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.dest,
+                       ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
+        pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
+        break;
+    case SIR_MAC_TCLASTYPE_TCPUDPIP:
+        pDot11f->info.IpParams.version = pOld->version;
+        if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
+        {
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV4Params.source,
+                           ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV4Params.dest,
+                           ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
+            pDot11f->info.IpParams.params.IpV4Params.src_port  =
+              pOld->tclasParams.ipv4.srcPort;
+            pDot11f->info.IpParams.params.IpV4Params.dest_port =
+              pOld->tclasParams.ipv4.dstPort;
+            pDot11f->info.IpParams.params.IpV4Params.DSCP      =
+              pOld->tclasParams.ipv4.dscp;
+            pDot11f->info.IpParams.params.IpV4Params.proto     =
+              pOld->tclasParams.ipv4.protocol;
+            pDot11f->info.IpParams.params.IpV4Params.reserved  =
+              pOld->tclasParams.ipv4.rsvd;
+        }
+        else
+        {
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.source,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.dest,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
+            pDot11f->info.IpParams.params.IpV6Params.src_port  =
+              pOld->tclasParams.ipv6.srcPort;
+            pDot11f->info.IpParams.params.IpV6Params.dest_port =
+              pOld->tclasParams.ipv6.dstPort;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
+                           IpV6Params.flow_label,
+                           ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
+        }
+        break;
+    case SIR_MAC_TCLASTYPE_8021DQ:
+        pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
+        break;
+    default:
+        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
+                pDot11f->classifier_type );
+        return eSIR_FAILURE;
+    }
+
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+
+} // End PopulateDot11fWMMTCLAS.
+
+#if ( WNI_POLARIS_FW_PRODUCT == AP )
+
+tSirRetStatus
+PopulateDot11fCFParams(tpAniSirGlobal         pMac,
+                       tDot11fFfCapabilities *pCaps,
+                       tDot11fIECFParams     *pDot11f)
+{
+    tANI_U32           cfg;
+    tSirRetStatus nSirStatus;
+
+    if ( pCaps->cfPollable || pCaps->cfPollReq )
+    {
+        pDot11f->cfp_count = schGetCFPCount( pMac );
+
+        CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CFP_PERIOD, cfg );
+        pDot11f->cfp_period = ( cfg & 0x000000ff );
+
+        CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CFP_MAX_DURATION, cfg );
+        pDot11f->cfp_maxduration = ( cfg & 0x0000ffff );
+
+        pDot11f->cfp_durremaining = schGetCFPDurRemaining( pMac );
+
+        pDot11f->present = 1;
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fCFParams.
+
+void
+PopulateDot11fQuiet(tpAniSirGlobal  pMac,
+                    tDot11fIEQuiet *pDot11f)
+{
+    // Quiet Count - Num TBTTs until start of quiet interval
+    pDot11f->count = (tANI_U8) pMac->lim.gLimSpecMgmt.quietCount;
+    // Quiet Period
+    pDot11f->period = 0;
+    // Quiet Duration (in TU's)
+    pDot11f->duration = ( tANI_U16 ) pMac->lim.gLimSpecMgmt.quietDuration_TU;
+    // Quiet Offset
+    pDot11f->offset = 0;
+
+    dot11fLog( pMac, LOG2,
+               FL("Filling QuietBSS IE: %d, Len %d, QC %1d, QP 0, QD "
+                  "%2d(TU)/%2d(TICKS), QO 0\n"),
+               SIR_MAC_QUIET_EID, DOT11F_IE_QUIET_MIN_LEN,
+               pMac->lim.gLimSpecMgmt.quietCount,
+               pMac->lim.gLimSpecMgmt.quietDuration_TU,
+               pMac->lim.gLimSpecMgmt.quietDuration );
+
+    pDot11f->present = 1;
+
+} // End PopulateDot11fQuiet.
+
+tSirRetStatus
+PopulateDot11fAPName(tpAniSirGlobal   pMac,
+                     tANI_U32              capEnable,
+                     tDot11fIEAPName *pDot11f)
+{
+    tANI_U32           nName;
+    tSirRetStatus nSirStatus;
+
+    CFG_GET_STR( nSirStatus, pMac, WNI_CFG_AP_NODE_NAME, pDot11f->name,
+                 nName, SIR_MAC_MAX_SSID_LENGTH );
+    pDot11f->num_name = ( tANI_U8 ) nName;
+    pDot11f->present = 1;
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fAPName.
+
+void
+PopulateDot11fPropQuietBSS(tpAniSirGlobal         pMac,
+                           tANI_U32                    capsEnable,
+                           tDot11fIEPropQuietBSS *pDot11f)
+{
+    // Populate Proprietary Quiet BSS IE, ONLY IF 11H is NOT enabled!  If 11H
+    // IS enabled, then the Quiet IE will be appropriately sent as per the
+    // 11H spec and hence need NOT be sent in the Proprietary IE as well
+    if ( ( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState ) &&
+         !pMac->lim.gLim11hEnable  &&
+         PROP_CAPABILITY_GET( TITAN, capsEnable ) )
+    {
+        // Quiet Count - Num TBTTs until start of quiet interval
+        pDot11f->quiet_count = pMac->lim.gLimSpecMgmt.quietCount;
+        // Quiet Period
+        pDot11f->quiet_period = 0;
+        // Quiet Duration (in TU's)
+        pDot11f->quiet_duration = ( tANI_U16 ) pMac->lim.gLimSpecMgmt.quietDuration_TU;
+        // Quiet Offset
+        pDot11f->quiet_offset = 0;
+
+        pDot11f->present = 1;
+    }
+} // End PopulateDot11fPropQuietBSS.
+
+void
+PopulateDot11fTrigStaBkScan(tpAniSirGlobal             pMac,
+                            tANI_U32                        capsEnable,
+                            tDot11fIETriggerStaBgScan *pDot11f)
+{
+    if ( PROP_CAPABILITY_GET( TITAN, capsEnable ) )
+    {
+        pDot11f->enable = pMac->lim.gLimTriggerBackgroundScanDuringQuietBss;
+        pDot11f->present = 1;
+    }
+} // End PopulateDot11fTrigStaBkScan.
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+
+tSirRetStatus
+PopulateDot11fWDS(tpAniSirGlobal  pMac,
+                  tANI_U32             capEnable,
+                  tDot11fIEWDS   *pDot11f )
+{
+    tpPESession psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH HOW TO GET sessionEntry?????
+
+    if ( psessionEntry->pLimStartBssReq->wdsInfo.wdsLength )
+    {
+        if ( psessionEntry->pLimStartBssReq->wdsInfo.wdsLength > 64)
+        {
+            limLog( pMac, LOG3, FL("WDS Length overflow in PopulateDot11fWDS.") );
+            return eSIR_FAILURE;
+        }
+
+        pDot11f->num_wdsData = psessionEntry->pLimStartBssReq->wdsInfo.wdsLength;
+        palCopyMemory( pMac->hHdd, pDot11f->wdsData,
+                       psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes,
+                       pDot11f->num_wdsData );
+        pDot11f->present = 1;
+    }
+
+    return eSIR_SUCCESS;
+} // End PopulateDot11fWDS.
+
+#endif // WNI_POLARIS_FW_PACKAGE == ADVANCED
+
+#endif // WNI_POLARIS_FW_PRODUCT == AP
+
+tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
+                                tDot11fIEWscBeacon *pDot11f)
+{
+
+    tANI_U32 wpsState;
+
+    pDot11f->Version.present = 1;
+    pDot11f->Version.major = 0x01;
+    pDot11f->Version.minor = 0x00;
+
+    if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
+
+    pDot11f->WPSState.present = 1;
+    pDot11f->WPSState.state = (tANI_U8) wpsState;
+
+    pDot11f->APSetupLocked.present = 0;
+
+    pDot11f->SelectedRegistrar.present = 0;
+
+    pDot11f->DevicePasswordID.present = 0;
+
+    pDot11f->SelectedRegistrarConfigMethods.present = 0;
+
+    pDot11f->UUID_E.present = 0;
+
+    pDot11f->RFBands.present = 0;
+
+    pDot11f->present = 1;
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
+                                             tDot11fIEWscBeacon *pDot11f)
+{
+    const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
+    tANI_U32 devicepasswdId;
+
+
+    pDot11f->APSetupLocked.present = 1;
+    pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
+
+    pDot11f->SelectedRegistrar.present = 1;
+    pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
+
+    if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
+
+    pDot11f->DevicePasswordID.present = 1;
+    pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
+
+    pDot11f->SelectedRegistrarConfigMethods.present = 1;
+    pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
+
+    // UUID_E and RF Bands are applicable only for dual band AP
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
+                                               tDot11fIEWscBeacon *pDot11f)
+{
+    pDot11f->APSetupLocked.present = 0;
+    pDot11f->SelectedRegistrar.present = 0;
+    pDot11f->DevicePasswordID.present = 0;
+    pDot11f->SelectedRegistrarConfigMethods.present = 0;
+
+    return eSIR_SUCCESS;
+}
+#ifdef WLAN_SOFTAP_FEATURE
+tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
+{
+ 
+   tSirWPSProbeRspIE *pSirWPSProbeRspIE;
+
+   pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
+   
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
+    {
+        pDot11f->present = 1;
+        pDot11f->Version.present = 1;
+        pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
+        pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
+    }
+    else
+    {
+        pDot11f->present = 0;
+        pDot11f->Version.present = 0;
+    }
+
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
+    {
+        
+        pDot11f->WPSState.present = 1;
+        pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
+    }
+    else
+        pDot11f->WPSState.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
+    {
+        pDot11f->APSetupLocked.present = 1;
+        pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
+    }
+    else
+        pDot11f->APSetupLocked.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
+    {
+        pDot11f->SelectedRegistrar.present = 1;
+        pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
+    }
+    else
+         pDot11f->SelectedRegistrar.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
+    {
+        pDot11f->DevicePasswordID.present = 1;
+        pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
+    }
+    else
+        pDot11f->DevicePasswordID.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
+    {
+        pDot11f->SelectedRegistrarConfigMethods.present = 1;
+        pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
+    }
+    else
+        pDot11f->SelectedRegistrarConfigMethods.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
+    {
+        pDot11f->ResponseType.present = 1;
+        pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
+    }
+    else
+        pDot11f->ResponseType.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
+    {
+        pDot11f->UUID_E.present = 1;
+        palCopyMemory(pMac->hHdd, pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
+    }
+    else
+        pDot11f->UUID_E.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
+    {
+        pDot11f->Manufacturer.present = 1;
+        pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
+        palCopyMemory(pMac->hHdd, pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name, pSirWPSProbeRspIE->Manufacture.num_name);
+    } 
+    else
+        pDot11f->Manufacturer.present = 0;
+        
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
+    {
+        pDot11f->ModelName.present = 1;
+        pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
+        palCopyMemory(pMac->hHdd, pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text, pDot11f->ModelName.num_text);
+    }
+    else
+      pDot11f->ModelName.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
+    {
+        pDot11f->ModelNumber.present = 1;
+        pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
+        palCopyMemory(pMac->hHdd, pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text, pDot11f->ModelNumber.num_text);
+    }
+    else
+        pDot11f->ModelNumber.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
+    {
+        pDot11f->SerialNumber.present = 1;
+        pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
+        palCopyMemory(pMac->hHdd, pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text, pDot11f->SerialNumber.num_text);
+    }
+    else
+        pDot11f->SerialNumber.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
+    {
+        pDot11f->PrimaryDeviceType.present = 1;
+        palCopyMemory(pMac->hHdd, pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI, sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI)); 
+        pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
+        pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
+    }
+    else
+        pDot11f->PrimaryDeviceType.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
+    {
+        pDot11f->DeviceName.present = 1;
+        pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
+        palCopyMemory(pMac->hHdd, pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text, pDot11f->DeviceName.num_text);
+    }
+    else
+        pDot11f->DeviceName.present = 0;
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
+    {
+        pDot11f->ConfigMethods.present = 1;
+        pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
+    }
+    else
+        pDot11f->ConfigMethods.present = 0;
+    
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
+    {
+        pDot11f->RFBands.present = 1;
+        pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
+    }
+    else
+       pDot11f->RFBands.present = 0;      
+       
+    return eSIR_SUCCESS;
+}
+tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
+{
+   tSirWPSProbeRspIE *pSirWPSProbeRspIE;
+
+   pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
+   
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
+    {
+        pDot11f->present = 1;
+        pDot11f->Version.present = 1;
+        pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
+        pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
+    }
+    else
+    {
+        pDot11f->present = 0;
+        pDot11f->Version.present = 0;
+    }
+    
+    if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
+    {
+        pDot11f->ResponseType.present = 1;
+        pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
+    }
+    else
+        pDot11f->ResponseType.present = 0;    
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
+{
+ 
+   tSirWPSBeaconIE *pSirWPSBeaconIE;
+
+   pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
+   
+    
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
+    {
+        pDot11f->present = 1;
+        pDot11f->Version.present = 1;
+        pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
+        pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
+    }
+    else
+    {
+        pDot11f->present = 0;
+        pDot11f->Version.present = 0;
+    }
+    
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
+    {
+        
+        pDot11f->WPSState.present = 1;
+        pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
+    }
+    else
+        pDot11f->WPSState.present = 0;
+        
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
+    {
+        pDot11f->APSetupLocked.present = 1;
+        pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
+    }
+    else
+        pDot11f->APSetupLocked.present = 0;
+        
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
+    {
+        pDot11f->SelectedRegistrar.present = 1;
+        pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
+    }
+    else
+         pDot11f->SelectedRegistrar.present = 0;
+    
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
+    {
+        pDot11f->DevicePasswordID.present = 1;
+        pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
+    }
+    else
+        pDot11f->DevicePasswordID.present = 0;
+        
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
+    {
+        pDot11f->SelectedRegistrarConfigMethods.present = 1;
+        pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
+    }
+    else
+        pDot11f->SelectedRegistrarConfigMethods.present = 0;
+        
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
+    {
+        pDot11f->UUID_E.present = 1;
+        palCopyMemory(pMac->hHdd, pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
+    }
+    else
+        pDot11f->UUID_E.present = 0;
+    
+       
+    if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
+    {
+        pDot11f->RFBands.present = 1;
+        pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
+    }
+    else
+       pDot11f->RFBands.present = 0;      
+       
+    return eSIR_SUCCESS;
+}
+#endif
+tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
+                                          tDot11fIEWscProbeRes *pDot11f)
+{
+    tANI_U32 cfgMethods;
+    tANI_U32 cfgStrLen;
+    tANI_U32 val;
+    tANI_U32 wpsVersion, wpsState;
+
+
+    if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
+
+    pDot11f->Version.present = 1;
+    pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
+    pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
+
+    if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
+
+    pDot11f->WPSState.present = 1;
+    pDot11f->WPSState.state = (tANI_U8) wpsState;
+
+    pDot11f->APSetupLocked.present = 0;
+
+    pDot11f->SelectedRegistrar.present = 0;
+
+    pDot11f->DevicePasswordID.present = 0;
+
+    pDot11f->SelectedRegistrarConfigMethods.present = 0;
+
+    pDot11f->ResponseType.present = 1;
+    if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
+        (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
+        pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
+    }
+    else{
+         pDot11f->ResponseType.resType = RESP_TYPE_AP;
+    }
+
+    /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
+    pDot11f->UUID_E.present = 1;
+    cfgStrLen = WNI_CFG_WPS_UUID_LEN;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_WPS_UUID,
+                  pDot11f->UUID_E.uuid,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        *(pDot11f->UUID_E.uuid) = '\0';
+    }
+
+    pDot11f->Manufacturer.present = 1;
+    cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_MANUFACTURER_NAME,
+                  pDot11f->Manufacturer.name,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        pDot11f->Manufacturer.num_name = 0;
+        *(pDot11f->Manufacturer.name) = '\0';
+    }
+    else
+    {
+        pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
+        pDot11f->Manufacturer.name[cfgStrLen] = '\0';
+    }
+
+    pDot11f->ModelName.present = 1;
+    cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_MODEL_NAME,
+                  pDot11f->ModelName.text,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        pDot11f->ModelName.num_text = 0;
+        *(pDot11f->ModelName.text) = '\0';
+    }
+    else
+    {
+        pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
+        pDot11f->ModelName.text[cfgStrLen] = '\0';
+    }
+
+    pDot11f->ModelNumber.present = 1;
+    cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_MODEL_NUMBER,
+                  pDot11f->ModelNumber.text,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        pDot11f->ModelNumber.num_text = 0;
+        *(pDot11f->ModelNumber.text) = '\0';
+    }
+    else
+    {
+        pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
+        pDot11f->ModelNumber.text[cfgStrLen] = '\0';
+    }
+
+    pDot11f->SerialNumber.present = 1;
+    cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
+                  pDot11f->SerialNumber.text,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        pDot11f->SerialNumber.num_text = 0;
+        *(pDot11f->SerialNumber.text) = '\0';
+    }
+    else
+    {
+        pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
+        pDot11f->SerialNumber.text[cfgStrLen] = '\0';
+    }
+
+    pDot11f->PrimaryDeviceType.present = 1;
+
+    if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
+    {
+       limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
+    }
+    else
+       pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
+
+    if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
+    {
+       limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
+    }
+    else
+    {
+       *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
+       *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
+       *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
+       *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
+    }
+
+    if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
+    {
+       limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
+    }
+    else
+       pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
+
+    pDot11f->DeviceName.present = 1;
+    cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
+    if (wlan_cfgGetStr(pMac,
+                  WNI_CFG_MANUFACTURER_PRODUCT_NAME,
+                  pDot11f->DeviceName.text,
+                  &cfgStrLen) != eSIR_SUCCESS)
+    {
+        pDot11f->DeviceName.num_text = 0;
+        *(pDot11f->DeviceName.text) = '\0';
+    }
+    else
+    {
+        pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
+        pDot11f->DeviceName.text[cfgStrLen] = '\0';
+    }
+
+    if (wlan_cfgGetInt(pMac,
+                  WNI_CFG_WPS_CFG_METHOD,
+                  &cfgMethods) != eSIR_SUCCESS)
+    {
+        pDot11f->ConfigMethods.present = 0;
+        pDot11f->ConfigMethods.methods = 0;
+    }
+    else
+    {
+        pDot11f->ConfigMethods.present = 1;
+        pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
+    }
+
+    pDot11f->RFBands.present = 0;
+
+    pDot11f->present = 1;
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
+                                                       tDot11fIEWscProbeRes *pDot11f)
+{
+    const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
+    tANI_U32 devicepasswdId;
+
+    pDot11f->APSetupLocked.present = 1;
+    pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
+
+    pDot11f->SelectedRegistrar.present = 1;
+    pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
+
+    if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
+       limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
+
+    pDot11f->DevicePasswordID.present = 1;
+    pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
+
+    pDot11f->SelectedRegistrarConfigMethods.present = 1;
+    pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
+
+    // UUID_E and RF Bands are applicable only for dual band AP
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
+                                                         tDot11fIEWscProbeRes *pDot11f)
+{
+    pDot11f->APSetupLocked.present = 0;
+    pDot11f->SelectedRegistrar.present = 0;
+    pDot11f->DevicePasswordID.present = 0;
+    pDot11f->SelectedRegistrarConfigMethods.present = 0;
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac, 
+                                          tDot11fIEWscAssocRes *pDot11f, 
+                                          tpSirAssocReq pRcvdAssocReq)
+{
+    tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
+    tANI_U8         *wscIe;
+    
+
+    wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
+    if(wscIe != NULL)
+    {
+        // retreive WSC IE from given AssocReq 
+        dot11fUnpackIeWscAssocReq( pMac,
+                                    wscIe + 2 + 4,  // EID, length, OUI
+                                    wscIe[ 1 ] - 4, // length without OUI
+                                    &parsedWscAssocReq );
+        pDot11f->present = 1;
+        // version has to be 0x10
+        pDot11f->Version.present = 1;
+        pDot11f->Version.major = 0x1;
+        pDot11f->Version.minor = 0x0;
+
+        pDot11f->ResponseType.present = 1;
+        
+        if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
+            (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
+        {
+            pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
+        }
+        else
+        {
+             pDot11f->ResponseType.resType = RESP_TYPE_AP;
+        }
+        // Version infomration should be taken from our capability as well as peers
+        // TODO: currently it takes from peers only
+        if(parsedWscAssocReq.VendorExtension.present &&
+           parsedWscAssocReq.VendorExtension.Version2.present)
+        {   
+            pDot11f->VendorExtension.present = 1;
+            pDot11f->VendorExtension.vendorId[0] = 0x00;
+            pDot11f->VendorExtension.vendorId[1] = 0x37;
+            pDot11f->VendorExtension.vendorId[2] = 0x2A;
+            pDot11f->VendorExtension.Version2.present = 1;
+            pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
+            pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
+        }
+    }
+    return eSIR_SUCCESS;
+}
+
+#ifdef WLAN_FEATURE_P2P
+tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac, 
+                                       tDot11fIEP2PAssocRes *pDot11f, 
+                                       tpSirAssocReq pRcvdAssocReq)
+{
+    tANI_U8         *p2pIe;
+
+    p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
+    if(p2pIe != NULL)
+    {
+        pDot11f->present = 1;
+        pDot11f->P2PStatus.present = 1;
+        pDot11f->P2PStatus.status = eSIR_SUCCESS;
+        pDot11f->ExtendedListenTiming.present = 0;
+    }
+    return eSIR_SUCCESS;
+}
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI
+
+tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal        pMac,
+                                    tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
+{
+     pDot11f->txPower = txPower;
+     pDot11f->linkMargin = linkMargin;
+     pDot11f->present = 1;
+
+     return eSIR_SUCCESS;
+}
+
+tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
+{
+
+     pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
+     pDot11f->report.Beacon.channel = pBeaconReport->channel;
+     palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime, sizeof(pDot11f->report.Beacon.meas_start_time) );
+     pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
+     pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
+     pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
+     pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
+     pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
+     palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
+     pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
+     pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
+
+     if( pBeaconReport->numIes )
+     {
+          pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
+          palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields, pBeaconReport->Ies, pBeaconReport->numIes );
+          pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
+     }
+
+     return eSIR_SUCCESS;
+
+}
+
+tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession    psessionEntry )
+{  
+   tpRRMCaps pRrmCaps;
+
+   pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
+
+   pDot11f->LinkMeasurement         = pRrmCaps->LinkMeasurement ;
+   pDot11f->NeighborRpt             = pRrmCaps->NeighborRpt ;
+   pDot11f->parallel                = pRrmCaps->parallel ;
+   pDot11f->repeated                = pRrmCaps->repeated ;
+   pDot11f->BeaconPassive           = pRrmCaps->BeaconPassive ;
+   pDot11f->BeaconActive            = pRrmCaps->BeaconActive ;
+   pDot11f->BeaconTable             = pRrmCaps->BeaconTable ;
+   pDot11f->BeaconRepCond           = pRrmCaps->BeaconRepCond ;
+   pDot11f->FrameMeasurement        = pRrmCaps->FrameMeasurement ;
+   pDot11f->ChannelLoad             = pRrmCaps->ChannelLoad ;
+   pDot11f->NoiseHistogram          = pRrmCaps->NoiseHistogram ;
+   pDot11f->statistics              = pRrmCaps->statistics ;
+   pDot11f->LCIMeasurement          = pRrmCaps->LCIMeasurement ;
+   pDot11f->LCIAzimuth              = pRrmCaps->LCIAzimuth ;
+   pDot11f->TCMCapability           = pRrmCaps->TCMCapability ;
+   pDot11f->triggeredTCM            = pRrmCaps->triggeredTCM ;
+   pDot11f->APChanReport            = pRrmCaps->APChanReport ;
+   pDot11f->RRMMIBEnabled           = pRrmCaps->RRMMIBEnabled ;
+   pDot11f->operatingChanMax        = pRrmCaps->operatingChanMax ;
+   pDot11f->nonOperatinChanMax      = pRrmCaps->nonOperatingChanMax ;
+   pDot11f->MeasurementPilot        = pRrmCaps->MeasurementPilot ;
+   pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
+   pDot11f->NeighborTSFOffset       = pRrmCaps->NeighborTSFOffset ;
+   pDot11f->RCPIMeasurement         = pRrmCaps->RCPIMeasurement ;
+   pDot11f->RSNIMeasurement         = pRrmCaps->RSNIMeasurement ;
+   pDot11f->BssAvgAccessDelay       = pRrmCaps->BssAvgAccessDelay ;
+   pDot11f->BSSAvailAdmission       = pRrmCaps->BSSAvailAdmission ;
+   pDot11f->AntennaInformation      = pRrmCaps->AntennaInformation ;
+
+   pDot11f->present = 1;
+   return eSIR_SUCCESS;
+}
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+void PopulateMDIE( tpAniSirGlobal        pMac,
+                   tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
+{
+   pDot11f->present = 1;
+   pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
+
+   // Plugfest fix
+   pDot11f->overDSCap =   (mdie[2] & 0x01);
+   pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
+   
+}
+
+void PopulateFTInfo( tpAniSirGlobal      pMac,
+                     tDot11fIEFTInfo     *pDot11f )
+{
+   pDot11f->present = 1;
+   pDot11f->IECount = 0; //TODO: put valid data during reassoc.
+   //All other info is zero.
+
+}
+#endif
+
+void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp, 
+      tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
+{
+  tANI_U8 num_supp = 0, num_ext = 0;
+  tANI_U8 i,j;
+
+  for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
+  {
+      pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
+  }  
+  for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
+  {
+     if( num_supp < 8 )
+         pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
+     else
+         pExt->rates[num_ext++] =  (tANI_U8)_11aRates[j]; 
+  }  
+
+  if( num_supp )
+  {
+      pSupp->num_rates = num_supp;
+      pSupp->present = 1;
+  }
+  if( num_ext )
+  {
+     pExt->num_rates = num_ext;
+     pExt->present = 1;
+  }
+} 
+// parserApi.c ends here.
diff --git a/CORE/SYS/legacy/src/utils/src/utilsApi.c b/CORE/SYS/legacy/src/utils/src/utilsApi.c
new file mode 100644
index 0000000..a78345d
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/utilsApi.c
@@ -0,0 +1,132 @@
+/*
+ * 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:         utilsApi.cc
+//
+//  Description:  Implemention of a few utility routines. 
+//
+//  Author:       Neelay Das
+//
+//  Copyright 2003, Woodside Networks, Inc. All rights reserved.
+//
+//  Change gHistory:
+//  12/15/2003 - NDA - Initial version.
+//
+//===================================================================
+
+
+#include "utilsApi.h"
+
+#if defined (ANI_OS_TYPE_WINDOWS)
+
+/**---------------------------------------------------------------------
+ * sirBusyWaitIntern() 
+ *
+ * FUNCTION:
+ * This function is called to put processor in a busy loop for
+ * a given amount of duration
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ * None.
+ *
+ * NOTE:
+ * 1. Argument to this function should be in nano second units
+ * 2. OS specific calls used if available. Otherwise this need
+ *    to be enhanced.
+ *
+ * @param  duration    Duration to be busy slept
+ * @return None
+ */
+
+void
+sirBusyWaitIntern(void *pMacGlobal, tANI_U32 duration)
+{
+        NdisStallExecution((duration+999)/1000); // This routine takes the duration in uSecs.
+} // sirBusyWaitIntern()
+
+#endif // (WNI_POLARIS_FW_OS == SIR_WINDOWS)
+
+
+
+#if !defined ANI_OS_TYPE_OSX
+
+// -------------------------------------------------------------------
+/**
+ * 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)
+{
+    tANI_U32 i;
+
+    if (level > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE(modId)])
+        return;
+
+    logDbg(pMac, modId, level, FL("Dumping %d bytes in host order\n"), size);
+
+    for (i=0; (i+7)<size; i+=8)
+    {
+        logDbg(pMac, modId, level,
+                 "%02x %02x %02x %02x %02x %02x %02x %02x \n",
+                 buf[i],
+                 buf[i+1],
+                 buf[i+2],
+                 buf[i+3],
+                 buf[i+4],
+                 buf[i+5],
+                 buf[i+6],
+                 buf[i+7]);
+    }
+
+    // Dump the bytes in the last line
+    for (; i < size; i++)
+    {
+        logDbg(pMac, modId, level, "%02x ", buf[i]);
+
+        if((i+1) == size)
+            logDbg(pMac, modId, level, "\n");
+    }
+
+}/*** end sirDumpBuf() ***/
+#else
+void
+sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size)
+{
+    (void)pMac; (void)modId; (void)level; (void)buf; (void)size;
+}
+#endif
diff --git a/CORE/SYS/legacy/src/utils/src/utilsParser.c b/CORE/SYS/legacy/src/utils/src/utilsParser.c
new file mode 100644
index 0000000..5d9568e
--- /dev/null
+++ b/CORE/SYS/legacy/src/utils/src/utilsParser.c
@@ -0,0 +1,745 @@
+/*
+ * 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 utilsParser.cc contains the code for parsing
+ * 802.11 messages.
+ * Author:        Pierre Vandwalle
+ * Date:          03/18/02
+ * History:-
+ * Date           Modified by    Modification Information
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include "aniGlobal.h"
+#include "utilsParser.h"
+#include "limSerDesUtils.h"
+
+void ConvertSSID(tpAniSirGlobal pMac,
+                       tSirMacSSid   *pOld,
+                       tDot11fIESSID    *pNew)
+{
+    pOld->length = pNew->num_ssid;
+    palCopyMemory( pMac->hHdd, pOld->ssId, pNew->ssid, pNew->num_ssid );
+}
+
+void ConvertSuppRates(tpAniSirGlobal   pMac,
+                            tSirMacRateSet  *pOld,
+                            tDot11fIESuppRates *pNew)
+{
+    pOld->numRates = pNew->num_rates;
+    palCopyMemory( pMac->hHdd, pOld->rate, pNew->rates, pNew->num_rates );
+}
+
+void ConvertExtSuppRates(tpAniSirGlobal      pMac,
+                               tSirMacRateSet     *pOld,
+                               tDot11fIEExtSuppRates *pNew)
+{
+    pOld->numRates = pNew->num_rates;
+    palCopyMemory( pMac->hHdd, pOld->rate, pNew->rates, pNew->num_rates );
+}
+
+
+void ConvertQOSCaps(tpAniSirGlobal                pMac,
+                          tSirMacQosCapabilityIE *pOld,
+                          tDot11fIEQOSCapsAp     *pNew)
+{
+    pOld->type    = 46;
+    pOld->length  = 1;
+
+    pOld->qosInfo.count   = pNew->count;   
+}
+
+
+void ConvertQOSCapsStation(tpAniSirGlobal              pMac,
+                           tSirMacQosCapabilityStaIE  *pOld,
+                           tDot11fIEQOSCapsStation    *pNew)
+{
+    pOld->type    = 46;
+    pOld->length  = 1;
+
+    pOld->qosInfo.moreDataAck = pNew->more_data_ack;
+    pOld->qosInfo.maxSpLen    = pNew->max_sp_length;
+    pOld->qosInfo.qack        = pNew->qack;
+    pOld->qosInfo.acbe_uapsd  = pNew->acbe_uapsd;
+    pOld->qosInfo.acbk_uapsd  = pNew->acbk_uapsd;
+    pOld->qosInfo.acvi_uapsd  = pNew->acvi_uapsd;
+    pOld->qosInfo.acvo_uapsd  = pNew->acvo_uapsd;    
+}
+
+tSirRetStatus ConvertWPA(tpAniSirGlobal  pMac,
+                               tSirMacWpaInfo *pOld,
+                               tDot11fIEWPA      *pNew)
+{
+    // This is awful, I know, but the old code just rammed the IE into an
+    // array...
+    tANI_U8 buffer[257];
+    tANI_U32 status, written = 0, nbuffer = 257;
+    status = dot11fPackIeWPA( pMac, pNew, buffer, nbuffer, &written );
+    if ( DOT11F_FAILED( status ) )
+    {
+        dot11fLog(pMac, LOG2, FL("Failed to re-pack the WPA IE (0x%0x"
+                                 "8).\n"), status);
+        return eSIR_FAILURE;
+    }
+
+    pOld->length = (tANI_U8)written - 2;
+    palCopyMemory( pMac->hHdd, pOld->info, buffer + 2, pOld->length );
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus ConvertWPAOpaque( tpAniSirGlobal      pMac,
+                                tSirMacWpaInfo     *pOld,
+                                tDot11fIEWPAOpaque *pNew )
+{
+    // This is awful, I know, but the old code just rammed the IE into
+    // an opaque array.  Note that we need to explicitly add the OUI!
+    pOld->length    = pNew->num_data + 4;
+    pOld->info[ 0 ] = 0x00;
+    pOld->info[ 1 ] = 0x50;
+    pOld->info[ 2 ] = 0xf2;
+    pOld->info[ 3 ] = 0x01;
+    palCopyMemory( pMac->hHdd, pOld->info + 4, pNew->data, pNew->num_data );
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus ConvertWscOpaque( tpAniSirGlobal      pMac,
+                                tSirAddie           *pOld,
+                                tDot11fIEWscIEOpaque *pNew )
+{
+    // This is awful, I know, but the old code just rammed the IE into
+    // an opaque array.  Note that we need to explicitly add the vendorIE and OUI !
+    tANI_U8 curAddIELen = pOld->length; 
+
+    pOld->length    = curAddIELen + pNew->num_data + 6;
+    pOld->addIEdata[ curAddIELen++ ] = 0xdd;
+    pOld->addIEdata[ curAddIELen++ ] = pNew->num_data + 4;
+    pOld->addIEdata[ curAddIELen++ ] = 0x00;
+    pOld->addIEdata[ curAddIELen++ ] = 0x50;
+    pOld->addIEdata[ curAddIELen++ ] = 0xf2;
+    pOld->addIEdata[ curAddIELen++ ] = 0x04;
+    palCopyMemory( pMac->hHdd, pOld->addIEdata + curAddIELen, pNew->data, pNew->num_data );
+
+    return eSIR_SUCCESS;
+}
+
+#ifdef WLAN_FEATURE_P2P
+tSirRetStatus ConvertP2POpaque( tpAniSirGlobal      pMac,
+                                tSirAddie           *pOld,
+                                tDot11fIEP2PIEOpaque *pNew )
+{
+    // This is awful, I know, but the old code just rammed the IE into
+    // an opaque array.  Note that we need to explicitly add the vendorIE and OUI !
+    tANI_U8 curAddIELen = pOld->length; 
+
+    pOld->length    = curAddIELen + pNew->num_data + 6;
+    pOld->addIEdata[ curAddIELen++ ] = 0xdd;
+    pOld->addIEdata[ curAddIELen++ ] = pNew->num_data + 4;
+    pOld->addIEdata[ curAddIELen++ ] = 0x50;
+    pOld->addIEdata[ curAddIELen++ ] = 0x6f;
+    pOld->addIEdata[ curAddIELen++ ] = 0x9A;
+    pOld->addIEdata[ curAddIELen++ ] = 0x09;
+    palCopyMemory( pMac->hHdd, pOld->addIEdata + curAddIELen, pNew->data, pNew->num_data );
+
+    return eSIR_SUCCESS;
+}
+#endif
+
+tSirRetStatus ConvertRSN(tpAniSirGlobal  pMac,
+                               tSirMacRsnInfo *pOld,
+                               tDot11fIERSN      *pNew)
+{
+    tANI_U8 buffer[257];
+    tANI_U32 status, written = 0, nbuffer = 257;
+    status = dot11fPackIeRSN( pMac, pNew, buffer, nbuffer, &written );
+    if ( DOT11F_FAILED( status ) )
+    {
+        dot11fLog(pMac, LOG2, FL("Failed to re-pack the RSN IE (0x%0x"
+                                 "8).\n"), status);
+        return eSIR_FAILURE;
+    }
+
+    pOld->length = (tANI_U8)written - 2;
+    palCopyMemory( pMac->hHdd, pOld->info, buffer + 2, pOld->length );
+
+    return eSIR_SUCCESS;
+}
+
+tSirRetStatus ConvertRSNOpaque( tpAniSirGlobal      pMac,
+                                tSirMacRsnInfo     *pOld,
+                                tDot11fIERSNOpaque *pNew )
+{
+    // This is awful, I know, but the old code just rammed the IE into
+    // an opaque array.
+    pOld->length = pNew->num_data;
+    palCopyMemory( pMac->hHdd, pOld->info, pNew->data, pOld->length );
+
+    return eSIR_SUCCESS;
+}
+
+void ConvertPowerCaps(tpAniSirGlobal            pMac,
+                            tSirMacPowerCapabilityIE *pOld,
+                            tDot11fIEPowerCaps          *pNew)
+{
+    pOld->type       = 33;
+    pOld->length     = 2;
+    pOld->minTxPower = pNew->minTxPower;
+    pOld->maxTxPower = pNew->maxTxPower;
+}
+
+void ConvertSuppChannels(tpAniSirGlobal             pMac,
+                               tSirMacSupportedChannelIE *pOld,
+                               tDot11fIESuppChannels        *pNew)
+{
+    pOld->type   = 36;
+    pOld->length = ( pNew->num_bands * 2 );
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->supportedChannels, ( tANI_U8* )pNew->bands, pOld->length );
+}
+
+void ConvertCFParams(tpAniSirGlobal     pMac,
+                           tSirMacCfParamSet *pOld,
+                           tDot11fIECFParams    *pNew)
+{
+    pOld->cfpCount        = pNew->cfp_count;
+    pOld->cfpPeriod       = pNew->cfp_period;
+    pOld->cfpMaxDuration  = pNew->cfp_maxduration;
+    pOld->cfpDurRemaining = pNew->cfp_durremaining;
+}
+
+void ConvertTIM(tpAniSirGlobal pMac,
+                      tSirMacTim    *pOld,
+                      tDot11fIETIM     *pNew)
+{
+    pOld->dtimCount     = pNew->dtim_count;
+    pOld->dtimPeriod    = pNew->dtim_period;
+    pOld->bitmapControl = pNew->bmpctl;
+    pOld->bitmapLength  = pNew->num_vbmp;
+
+    palCopyMemory( pMac->hHdd, pOld->bitmap, pNew->vbmp, pNew->num_vbmp );
+}
+
+void ConvertCountry(tpAniSirGlobal          pMac,
+                          tSirCountryInformation *pOld,
+                          tDot11fIECountry          *pNew)
+{
+    int i;
+
+    palCopyMemory( pMac->hHdd, pOld->countryString, pNew->country, COUNTRY_STRING_LENGTH );
+
+    pOld->numIntervals = pNew->num_triplets;
+
+    for (i = 0; i < pNew->num_triplets; ++i)
+    {
+        pOld->channelTransmitPower[i].channelNumber    = pNew->triplets[i][0];
+        pOld->channelTransmitPower[i].numChannel       = pNew->triplets[i][1];
+        pOld->channelTransmitPower[i].maxTransmitPower = pNew->triplets[i][2];
+    }
+}
+
+void ConvertWMMParams(tpAniSirGlobal         pMac,
+                            tSirMacEdcaParamSetIE *pOld,
+                            tDot11fIEWMMParams       *pNew)
+{
+    pOld->type = 221;
+    pOld->length = 24;
+
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->qosInfo, ( tANI_U8* )&pNew->qosInfo, 1 );
+
+    pOld->acbe.aci.aifsn  = pNew->acbe_aifsn;
+    pOld->acbe.aci.acm    = pNew->acbe_acm;
+    pOld->acbe.aci.aci    = pNew->acbe_aci;
+    pOld->acbe.cw.min     = pNew->acbe_acwmin;
+    pOld->acbe.cw.max     = pNew->acbe_acwmax;
+    pOld->acbe.txoplimit  = pNew->acbe_txoplimit;
+
+    pOld->acbk.aci.aifsn  = pNew->acbk_aifsn;
+    pOld->acbk.aci.acm    = pNew->acbk_acm;
+    pOld->acbk.aci.aci    = pNew->acbk_aci;
+    pOld->acbk.cw.min     = pNew->acbk_acwmin;
+    pOld->acbk.cw.max     = pNew->acbk_acwmax;
+    pOld->acbk.txoplimit  = pNew->acbk_txoplimit;
+
+    pOld->acvi.aci.aifsn  = pNew->acvi_aifsn;
+    pOld->acvi.aci.acm    = pNew->acvi_acm;
+    pOld->acvi.aci.aci    = pNew->acvi_aci;
+    pOld->acvi.cw.min     = pNew->acvi_acwmin;
+    pOld->acvi.cw.max     = pNew->acvi_acwmax;
+    pOld->acvi.txoplimit  = pNew->acvi_txoplimit;
+
+    pOld->acvo.aci.aifsn  = pNew->acvo_aifsn;
+    pOld->acvo.aci.acm    = pNew->acvo_acm;
+    pOld->acvo.aci.aci    = pNew->acvo_aci;
+    pOld->acvo.cw.min     = pNew->acvo_acwmin;
+    pOld->acvo.cw.max     = pNew->acvo_acwmax;
+    pOld->acvo.txoplimit  = pNew->acvo_txoplimit;
+}
+
+void ConvertERPInfo(tpAniSirGlobal    pMac,
+                          tSirMacErpInfo   *pOld,
+                          tDot11fIEERPInfo    *pNew)
+{
+    pOld->nonErpPresent = pNew->non_erp_present;
+    pOld->useProtection = pNew->use_prot;
+    pOld->barkerPreambleMode = pNew->barker_preamble;
+}
+
+void ConvertEDCAParam(tpAniSirGlobal         pMac,
+                            tSirMacEdcaParamSetIE *pOld,
+                            tDot11fIEEDCAParamSet    *pNew)
+{
+    pOld->type   = 12;
+    pOld->length = 20;
+
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->qosInfo, ( tANI_U8* )&pNew->qos, 1 );
+
+    pOld->acbe.aci.aifsn  = pNew->acbe_aifsn;
+    pOld->acbe.aci.acm    = pNew->acbe_acm;
+    pOld->acbe.aci.aci    = pNew->acbe_aci;
+    pOld->acbe.cw.min     = pNew->acbe_acwmin;
+    pOld->acbe.cw.max     = pNew->acbe_acwmax;
+    pOld->acbe.txoplimit  = pNew->acbe_txoplimit;
+
+    pOld->acbk.aci.aifsn  = pNew->acbk_aifsn;
+    pOld->acbk.aci.acm    = pNew->acbk_acm;
+    pOld->acbk.aci.aci    = pNew->acbk_aci;
+    pOld->acbk.cw.min     = pNew->acbk_acwmin;
+    pOld->acbk.cw.max     = pNew->acbk_acwmax;
+    pOld->acbk.txoplimit  = pNew->acbk_txoplimit;
+
+    pOld->acvi.aci.aifsn  = pNew->acvi_aifsn;
+    pOld->acvi.aci.acm    = pNew->acvi_acm;
+    pOld->acvi.aci.aci    = pNew->acvi_aci;
+    pOld->acvi.cw.min     = pNew->acvi_acwmin;
+    pOld->acvi.cw.max     = pNew->acvi_acwmax;
+    pOld->acvi.txoplimit  = pNew->acvi_txoplimit;
+
+    pOld->acvo.aci.aifsn  = pNew->acvo_aifsn;
+    pOld->acvo.aci.acm    = pNew->acvo_acm;
+    pOld->acvo.aci.aci    = pNew->acvo_aci;
+    pOld->acvo.cw.min     = pNew->acvo_acwmin;
+    pOld->acvo.cw.max     = pNew->acvo_acwmax;
+    pOld->acvo.txoplimit  = pNew->acvo_txoplimit;
+
+}
+
+void ConvertTSPEC(tpAniSirGlobal  pMac,
+                        tSirMacTspecIE *pOld,
+                        tDot11fIETSPEC *pNew)
+{
+    pOld->tsinfo.traffic.trafficType  = (tANI_U16)pNew->traffic_type;
+    pOld->tsinfo.traffic.tsid         = (tANI_U16)pNew->tsid;
+    pOld->tsinfo.traffic.direction    = (tANI_U16)pNew->direction;
+    pOld->tsinfo.traffic.accessPolicy = (tANI_U16)pNew->access_policy;
+    pOld->tsinfo.traffic.aggregation  = (tANI_U16)pNew->aggregation;
+    pOld->tsinfo.traffic.psb          = (tANI_U16)pNew->psb;
+    pOld->tsinfo.traffic.userPrio     = (tANI_U16)pNew->user_priority;
+    pOld->tsinfo.traffic.ackPolicy    = (tANI_U16)pNew->tsinfo_ack_pol;
+
+    pOld->tsinfo.schedule.schedule    = (tANI_U8)pNew->schedule;
+
+    pOld->nomMsduSz                   = pNew->size;
+    pOld->maxMsduSz                   = pNew->max_msdu_size;
+    pOld->minSvcInterval              = pNew->min_service_int;
+    pOld->maxSvcInterval              = pNew->max_service_int;
+    pOld->inactInterval               = pNew->inactivity_int;
+    pOld->suspendInterval             = pNew->suspension_int;
+    pOld->svcStartTime                = pNew->service_start_time;
+    pOld->minDataRate                 = pNew->min_data_rate;
+    pOld->meanDataRate                = pNew->mean_data_rate;
+    pOld->peakDataRate                = pNew->peak_data_rate;
+    pOld->maxBurstSz                  = pNew->burst_size;
+    pOld->delayBound                  = pNew->delay_bound;
+    pOld->minPhyRate                  = pNew->min_phy_rate;
+    pOld->surplusBw                   = pNew->surplus_bw_allowance;
+    pOld->mediumTime                  = pNew->medium_time;
+}
+
+tSirRetStatus ConvertTCLAS(tpAniSirGlobal  pMac,
+                                 tSirTclasInfo  *pOld,
+                                 tDot11fIETCLAS *pNew)
+{
+    tANI_U32 length;
+
+    if ( DOT11F_FAILED( dot11fGetPackedIETCLAS( pMac, pNew, &length ) ) )
+    {
+        return eSIR_FAILURE;
+    }
+
+    pOld->tclas.type           = DOT11F_EID_TCLAS;
+    pOld->tclas.length         = (tANI_U8)length;
+    pOld->tclas.userPrio       = pNew->user_priority;
+    pOld->tclas.classifierType = pNew->classifier_type;
+    pOld->tclas.classifierMask = pNew->classifier_mask;
+
+    switch ( pNew->classifier_type )
+    {
+    case 0:
+        palCopyMemory( pMac->hHdd, pOld->tclasParams.eth.srcAddr, pNew->info.EthParams.source, 6 );
+        palCopyMemory( pMac->hHdd, pOld->tclasParams.eth.dstAddr, pNew->info.EthParams.dest, 6 );
+        pOld->tclasParams.eth.type = pNew->info.EthParams.type;
+        break;
+    case 1:
+        pOld->version = pNew->info.IpParams.version;
+        if ( 4 == pNew->info.IpParams.version )
+        {
+            pOld->tclasParams.ipv4.version = 4;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->tclasParams.ipv4.srcIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV4Params.source, 4 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->tclasParams.ipv4.dstIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV4Params.dest, 4 );
+            pOld->tclasParams.ipv4.srcPort  = pNew->info.IpParams.params.IpV4Params.src_port;
+            pOld->tclasParams.ipv4.dstPort  = pNew->info.IpParams.params.IpV4Params.dest_port;
+            pOld->tclasParams.ipv4.dscp     = pNew->info.IpParams.params.IpV4Params.DSCP;
+            pOld->tclasParams.ipv4.protocol = pNew->info.IpParams.params.IpV4Params.proto;
+            pOld->tclasParams.ipv4.rsvd     = pNew->info.IpParams.params.IpV4Params.reserved;
+        }
+        else if ( 6 == pNew->info.IpParams.version )
+        {
+            pOld->tclasParams.ipv6.version = 6;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.source, 16 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.dest, 16 );
+            pOld->tclasParams.ipv6.srcPort  = pNew->info.IpParams.params.IpV6Params.src_port;
+            pOld->tclasParams.ipv6.dstPort  = pNew->info.IpParams.params.IpV6Params.dest_port;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.flow_label, 3 );
+        }
+        else
+        {
+            return eSIR_FAILURE;
+        }
+        break;
+    case 2:
+        pOld->tclasParams.t8021dq.tag = pNew->info.Params8021dq.tag_type;
+        break;
+    default:
+        return eSIR_FAILURE;
+    }
+
+    return eSIR_SUCCESS;
+}
+
+void ConvertWMMTSPEC(tpAniSirGlobal     pMac,
+                           tSirMacTspecIE    *pOld,
+                           tDot11fIEWMMTSPEC *pNew)
+{
+    pOld->tsinfo.traffic.trafficType  = (tANI_U16)pNew->traffic_type;
+    pOld->tsinfo.traffic.tsid         = (tANI_U16)pNew->tsid;
+    pOld->tsinfo.traffic.direction    = (tANI_U16)pNew->direction;
+    pOld->tsinfo.traffic.accessPolicy = (tANI_U16)pNew->access_policy;
+    pOld->tsinfo.traffic.aggregation  = (tANI_U16)pNew->aggregation;
+    pOld->tsinfo.traffic.psb          = (tANI_U16)pNew->psb;
+    pOld->tsinfo.traffic.userPrio     = (tANI_U16)pNew->user_priority;
+    pOld->tsinfo.traffic.ackPolicy    = (tANI_U16)pNew->tsinfo_ack_pol;
+    pOld->nomMsduSz                   = pNew->size;
+    pOld->maxMsduSz                   = pNew->max_msdu_size;
+    pOld->minSvcInterval              = pNew->min_service_int;
+    pOld->maxSvcInterval              = pNew->max_service_int;
+    pOld->inactInterval               = pNew->inactivity_int;
+    pOld->suspendInterval             = pNew->suspension_int;
+    pOld->svcStartTime                = pNew->service_start_time;
+    pOld->minDataRate                 = pNew->min_data_rate;
+    pOld->meanDataRate                = pNew->mean_data_rate;
+    pOld->peakDataRate                = pNew->peak_data_rate;
+    pOld->maxBurstSz                  = pNew->burst_size;
+    pOld->delayBound                  = pNew->delay_bound;
+    pOld->minPhyRate                  = pNew->min_phy_rate;
+    pOld->surplusBw                   = pNew->surplus_bw_allowance;
+    pOld->mediumTime                  = pNew->medium_time;
+}
+
+tSirRetStatus ConvertWMMTCLAS(tpAniSirGlobal    pMac,
+                                    tSirTclasInfo     *pOld,
+                                    tDot11fIEWMMTCLAS *pNew)
+{
+    tANI_U32 length;
+
+    if ( DOT11F_FAILED( dot11fGetPackedIEWMMTCLAS( pMac, pNew, &length ) ) )
+    {
+        return eSIR_FAILURE;
+    }
+
+    pOld->tclas.type           = DOT11F_EID_WMMTCLAS;
+    pOld->tclas.length         = (tANI_U8)length;
+    pOld->tclas.userPrio       = pNew->user_priority;
+    pOld->tclas.classifierType = pNew->classifier_type;
+    pOld->tclas.classifierMask = pNew->classifier_mask;
+
+    switch ( pNew->classifier_type )
+    {
+    case 0:
+        palCopyMemory( pMac->hHdd, pOld->tclasParams.eth.srcAddr, pNew->info.EthParams.source, 6 );
+        palCopyMemory( pMac->hHdd, pOld->tclasParams.eth.dstAddr, pNew->info.EthParams.dest, 6 );
+        pOld->tclasParams.eth.type = pNew->info.EthParams.type;
+        break;
+    case 1:
+        pOld->version = pNew->info.IpParams.version;
+        if ( 4 == pNew->info.IpParams.version )
+        {
+            pOld->tclasParams.ipv4.version = 4;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->tclasParams.ipv4.srcIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV4Params.source, 4 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )&pOld->tclasParams.ipv4.dstIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV4Params.dest, 4 );
+            pOld->tclasParams.ipv4.srcPort  = pNew->info.IpParams.params.IpV4Params.src_port;
+            pOld->tclasParams.ipv4.dstPort  = pNew->info.IpParams.params.IpV4Params.dest_port;
+            pOld->tclasParams.ipv4.dscp     = pNew->info.IpParams.params.IpV4Params.DSCP;
+            pOld->tclasParams.ipv4.protocol = pNew->info.IpParams.params.IpV4Params.proto;
+            pOld->tclasParams.ipv4.rsvd     = pNew->info.IpParams.params.IpV4Params.reserved;
+        }
+        else if ( 6 == pNew->info.IpParams.version )
+        {
+            pOld->tclasParams.ipv6.version = 6;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.source, 16 );
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.dest, 16 );
+            pOld->tclasParams.ipv6.srcPort  = pNew->info.IpParams.params.IpV6Params.src_port;
+            pOld->tclasParams.ipv6.dstPort  = pNew->info.IpParams.params.IpV6Params.dest_port;
+            palCopyMemory( pMac->hHdd, ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, ( tANI_U8* )pNew->info.IpParams.params.IpV6Params.flow_label, 3 );
+        }
+        else
+        {
+            return eSIR_FAILURE;
+        }
+        break;
+    case 2:
+        pOld->tclasParams.t8021dq.tag = pNew->info.Params8021dq.tag_type;
+        break;
+    default:
+        return eSIR_FAILURE;
+    }
+
+    return eSIR_SUCCESS;
+}
+
+void ConvertTSDelay(tpAniSirGlobal    pMac,
+                          tSirMacTsDelayIE *pOld,
+                          tDot11fIETSDelay *pNew)
+{
+    pOld->type   = DOT11F_EID_TSDELAY;
+    pOld->length = 4U;
+    pOld->delay  = pNew->delay;
+}
+
+void ConvertSchedule(tpAniSirGlobal     pMac,
+                           tSirMacScheduleIE *pOld,
+                           tDot11fIESchedule *pNew)
+{
+    pOld->type             = DOT11F_EID_SCHEDULE;
+    pOld->length           = DOT11F_IE_SCHEDULE_MIN_LEN;
+
+    pOld->info.aggregation = pNew->aggregation;
+    pOld->info.tsid        = pNew->tsid;
+    pOld->info.direction   = pNew->direction;
+
+    pOld->svcStartTime     = pNew->service_start_time;
+    pOld->svcInterval      = pNew->service_interval;
+    pOld->specInterval     = pNew->spec_interval;
+}
+
+void ConvertWMMSchedule(tpAniSirGlobal        pMac,
+                              tSirMacScheduleIE    *pOld,
+                              tDot11fIEWMMSchedule *pNew)
+{
+    pOld->type             = DOT11F_EID_WMMSCHEDULE;
+    pOld->length           = DOT11F_IE_WMMSCHEDULE_MIN_LEN;
+
+    pOld->info.aggregation = pNew->aggregation;
+    pOld->info.tsid        = pNew->tsid;
+    pOld->info.direction   = pNew->direction;
+
+    pOld->svcStartTime     = pNew->service_start_time;
+    pOld->svcInterval      = pNew->service_interval;
+    pOld->specInterval     = pNew->spec_interval;
+}
+
+/**
+    @brief   :    This functions converts the given buffer till given size to Big endian format assuming the 
+                     bus is 32 bit. The size should be four byte aligned.
+    @param :    ptr to be converted, size
+    @return  :    void
+*/
+
+void ConverttoBigEndian(void *ptr, tANI_U16    size)
+{
+    tANI_U8        *temp_ptr;
+    tANI_U32    *dest_ptr;
+
+    dest_ptr  = (tANI_U32 *)ptr;
+    while(size)
+    {
+        temp_ptr = (tANI_U8 *) dest_ptr;
+        *dest_ptr = (temp_ptr[0] << 24) | (temp_ptr[1] << 16) | (temp_ptr[2] << 8) | temp_ptr[3];
+        dest_ptr++;
+        size -= 4;
+    }
+}
+
+
+void CreateScanDataNullFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr,
+                  tANI_U8 pwrMgmt, tSirMacAddr bssid, tSirMacAddr selfMacAddr)
+{
+
+    macMgmtHdr->fc.type = SIR_MAC_DATA_FRAME;
+    macMgmtHdr->fc.subType = SIR_MAC_DATA_NULL;
+    macMgmtHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
+    macMgmtHdr->fc.order = 0;
+    macMgmtHdr->fc.wep = 0;
+    macMgmtHdr->fc.moreData =0;
+    macMgmtHdr->fc.powerMgmt = pwrMgmt;
+    macMgmtHdr->fc.retry = 0;
+    macMgmtHdr->fc.moreFrag = 0;
+    macMgmtHdr->fc.fromDS = 0;
+    macMgmtHdr->fc.toDS = 0;
+    macMgmtHdr->durationLo = (tANI_U8) (SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff);
+    macMgmtHdr->durationHi = (tANI_U8) ((SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff00) >> 8);
+    macMgmtHdr->seqControl.fragNum = 0;
+    macMgmtHdr->seqControl.seqNumLo = 0;
+    macMgmtHdr->seqControl.seqNumHi = 2;
+    palCopyMemory(pMac->hHdd, (void *)&macMgmtHdr->da,
+                              (void *)bssid, sizeof(tSirMacAddr));
+    palCopyMemory(pMac->hHdd, (void *)&macMgmtHdr->sa,
+                              (void *)selfMacAddr, sizeof(tSirMacAddr));
+    palCopyMemory(pMac->hHdd, (void *)&macMgmtHdr->bssId,
+                              (void *)bssid, sizeof(tSirMacAddr));
+    
+    return;
+}
+
+
+void CreateScanCtsFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tSirMacAddr selfMac)
+{
+    macMgmtHdr->fc.type = SIR_MAC_CTRL_FRAME;
+    macMgmtHdr->fc.subType = SIR_MAC_CTRL_CTS;
+    macMgmtHdr->fc.order = 0;
+    macMgmtHdr->fc.wep = 0;
+    macMgmtHdr->fc.moreData =0;
+    macMgmtHdr->fc.powerMgmt = 0;  
+    macMgmtHdr->fc.retry = 0;
+    macMgmtHdr->fc.moreFrag = 0;
+    macMgmtHdr->fc.fromDS = 0;
+    macMgmtHdr->fc.toDS = 0;
+    macMgmtHdr->durationLo = (tANI_U8) (SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff);
+    macMgmtHdr->durationHi = (tANI_U8) ((SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff00) >> 8);
+    palCopyMemory(pMac->hHdd, (void *)macMgmtHdr->da, (void *)selfMac, sizeof(tSirMacAddr));
+            
+    return;
+}
+
+
+
+
+
+
+
+/**
+    @brief    :    This functions creates a DATA_NULL/CTS2SELF frame in Big endian format 
+    @param    :    Global MAC structure, pointer to return the created packet, role which is Station/AP
+    @return    :    void
+*/
+
+void CreateInitScanRawFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tBssSystemRole role)
+{
+#if 0
+    tpStaStruct pSta = (tpStaStruct) pMac->hal.halMac.staTable;
+    
+    if (role == eSYSTEM_STA_ROLE)
+    {
+        macMgmtHdr->fc.type = SIR_MAC_DATA_FRAME;
+        macMgmtHdr->fc.subType = SIR_MAC_DATA_NULL;
+        macMgmtHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
+        macMgmtHdr->fc.order = 0;
+        macMgmtHdr->fc.wep = 0;
+        macMgmtHdr->fc.moreData =0;
+        macMgmtHdr->fc.powerMgmt = 1;  // Needed for station
+        macMgmtHdr->fc.retry = 0;
+        macMgmtHdr->fc.moreFrag = 0;
+        macMgmtHdr->fc.fromDS = 0;
+        macMgmtHdr->fc.toDS = 1;
+        macMgmtHdr->durationLo = (tANI_U8) (SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff);
+        macMgmtHdr->durationHi = (tANI_U8) ((SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff00) >> 8);
+        macMgmtHdr->seqControl.fragNum = 0;
+        macMgmtHdr->seqControl.seqNumLo = 0;
+        macMgmtHdr->seqControl.seqNumHi = 2;
+        palCopyMemory(pMac->hHdd, (void *)&macMgmtHdr->da, (void *)pSta[0].bssId, 6);
+        palCopyMemory(pMac->hHdd, &macMgmtHdr->sa, pSta[0].staAddr, 6);
+        palCopyMemory(pMac->hHdd, (void *)&macMgmtHdr->bssId, (void *)pSta[0].bssId, 6);
+    }
+    else if (role == eSYSTEM_AP_ROLE || role == eSYSTEM_STA_IN_IBSS_ROLE)
+    {
+        macMgmtHdr->fc.type = SIR_MAC_CTRL_FRAME;
+        macMgmtHdr->fc.subType = SIR_MAC_CTRL_CTS;
+        macMgmtHdr->fc.order = 0;
+        macMgmtHdr->fc.wep = 0;
+        macMgmtHdr->fc.moreData =0;
+        macMgmtHdr->fc.powerMgmt = 0;  // Needed for station
+        macMgmtHdr->fc.retry = 0;
+        macMgmtHdr->fc.moreFrag = 0;
+        macMgmtHdr->fc.fromDS = 0;
+        macMgmtHdr->fc.toDS = 0;
+        macMgmtHdr->durationLo = (tANI_U8) (SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff);
+        macMgmtHdr->durationHi = (tANI_U8) ((SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff00) >> 8);
+        palCopyMemory(pMac->hHdd, (void *)macMgmtHdr->da, (void *)pSta[0].staAddr, 6);
+    }
+    return;
+#endif
+}
+
+/**
+    @brief    :    This functions creates a DATA_NULL frame in Big endian format 
+    @param    :    Global MAC structure, pointer to return the created packet, role which is Station/AP
+    @return    :    void
+*/
+
+
+void CreateFinishScanRawFrame(tpAniSirGlobal pMac, tSirMacMgmtHdr *macMgmtHdr, tBssSystemRole role)
+{
+#if 0
+    tpStaStruct pSta = (tpStaStruct) pMac->hal.halMac.staTable;
+
+    if (role == eSYSTEM_STA_ROLE)
+    {
+        macMgmtHdr->fc.type = SIR_MAC_DATA_FRAME;
+        macMgmtHdr->fc.subType = SIR_MAC_DATA_NULL;
+        macMgmtHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
+        macMgmtHdr->fc.order = 0;
+        macMgmtHdr->fc.wep = 0;
+        macMgmtHdr->fc.moreData =0;
+        macMgmtHdr->fc.powerMgmt = 0;     // Needed for station
+        macMgmtHdr->fc.retry = 0;
+        macMgmtHdr->fc.moreFrag = 0;
+        macMgmtHdr->fc.fromDS = 0;
+        macMgmtHdr->fc.toDS = 1;
+        macMgmtHdr->durationLo = (tANI_U8) (SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff);
+        macMgmtHdr->durationHi = (tANI_U8) ((SIR_MAC_MAX_DURATION_MICRO_SECONDS & 0xff00) >> 8);
+        macMgmtHdr->seqControl.fragNum = 0;
+        macMgmtHdr->seqControl.seqNumLo = 0;
+        macMgmtHdr->seqControl.seqNumHi = 2;
+        palCopyMemory(pMac->hHdd, (void *)macMgmtHdr->da, (void *)pSta[0].bssId, 6);
+        palCopyMemory(pMac->hHdd, macMgmtHdr->sa, pSta[0].staAddr, 6);
+        palCopyMemory(pMac->hHdd, (void *)macMgmtHdr->bssId, (void *)pSta[0].bssId, 6);
+
+    }
+    
+    return;
+#endif
+}
+
+
+// utilsParser.c ends here.
diff --git a/CORE/TL/inc/tlDebug.h b/CORE/TL/inc/tlDebug.h
new file mode 100644
index 0000000..b99646e
--- /dev/null
+++ b/CORE/TL/inc/tlDebug.h
@@ -0,0 +1,80 @@
+/*
+ * 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 __TL_DEBUG_H__
+#define __TL_DEBUG_H__
+#if (!defined ANI_OS_TYPE_OSX && !defined (ANI_OS_TYPE_ANDROID))
+#include <stdio.h>
+#endif
+#include <stdarg.h>
+#include "vos_trace.h"
+#ifdef WLAN_DEBUG
+#ifdef WLAN_MDM_DATAPATH_OPT
+#define TLLOGP(x0)  x0
+#define TLLOGE(x0)  x0
+#define TLLOGW(x0)  x0
+#define TLLOG1(x)  {}
+#define TLLOG2(x)  {}
+#define TLLOG3(x)  {}
+#define TLLOG4(x)  {}
+
+#else /*WLAN_MDM_DATAPATH_OPT*/
+
+#define TLLOGP(x0)  x0
+#define TLLOGE(x0)  x0
+#define TLLOGW(x0)  x0
+#define TLLOG1(x0)  x0
+
+#ifdef TL_DEBUG_LOG2
+#define TLLOG2(x0)  x0
+#else
+ #define TLLOG2(x0)
+#endif
+
+#ifdef TL_DEBUG_LOG3
+#define TLLOG3(x0)  x0
+#else
+ #define TLLOG3(x0)
+#endif
+
+#ifdef TL_DEBUG_LOG4
+#define TLLOG4(x0)  x0
+#else
+ #define TLLOG4(x0)
+#endif
+
+
+#endif /*WLAN_MDM_DATAPATH_OPT*/
+
+#else /* WLAN DEBUG */
+
+#define TLLOGP(x)  x
+#define TLLOGE(x)  {}
+#define TLLOGW(x)  {}
+#define TLLOG1(x)  {}
+#define TLLOG2(x)  {}
+#define TLLOG3(x)  {}
+#define TLLOG4(x)  {}
+#endif /* WLAN DEBUG */
+
+
+#endif // __TL_DEBUG_H__
+
diff --git a/CORE/TL/inc/wlan_qct_tl.h b/CORE/TL/inc/wlan_qct_tl.h
new file mode 100644
index 0000000..610408c
--- /dev/null
+++ b/CORE/TL/inc/wlan_qct_tl.h
@@ -0,0 +1,2446 @@
+/*
+ * 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 WLAN_QCT_WLANTL_H
+#define WLAN_QCT_WLANTL_H
+
+/*===========================================================================
+
+               W L A N   T R A N S P O R T   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan transport layer 
+  module.
+  
+      
+  Copyright (c) 2008 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
+--------    ---    ----------------------------------------------------------
+01/08/10    lti     Added TL Data Caching 
+10/15/09    rnair   Modifying STADescType struct
+10/06/09    rnair   Adding support for WAPI 
+09/22/09    lti     Add deregistration API for management client
+02/02/09    sch     Add Handoff support
+12/09/08    lti     Fixes for AMSS compilation 
+09/05/08    lti     Fixes after QOS unit testing 
+08/06/08    lti     Added QOS support 
+05/01/08    lti     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_api.h" 
+#include "vos_packet.h" 
+#include "sirApi.h"
+#ifdef WLAN_SOFTAP_FEATURE
+#include "csrApi.h"
+#include "sapApi.h"
+#endif
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+ 
+/*Offset of the OUI field inside the LLC/SNAP header*/
+#define WLANTL_LLC_OUI_OFFSET                 3
+
+/*Size of the OUI type field inside the LLC/SNAP header*/
+#define WLANTL_LLC_OUI_SIZE                   3
+
+/*Offset of the LLC/SNAP header*/
+#define WLANTL_LLC_SNAP_OFFSET                0
+
+/*Size of the LLC/SNAP header*/
+#define WLANTL_LLC_SNAP_SIZE                   8
+
+/*============================================================================
+ *     GENERIC STRUCTURES - not belonging to TL 
+ *     TO BE MOVED TO A GLOBAL HEADER
+ ============================================================================*/
+/*Maximum number of ACs */
+#define WLANTL_MAX_AC                         4
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/* Bit Mask to represent All Stations */
+#define WLAN_ALL_STA                         0xFF
+
+/* Maximum number of station supported by TL, including BC. */
+#define WLAN_MAX_STA_COUNT  (HAL_NUM_STA)
+
+/* The symbolic station ID return to HDD to specify the packet is bc/mc */
+#define WLAN_RX_BCMC_STA_ID (WLAN_MAX_STA_COUNT + 1)
+
+/* The symbolic station ID return to HDD to specify the packet is to soft-AP itself */
+#define WLAN_RX_SAP_SELF_STA_ID (WLAN_MAX_STA_COUNT + 2)
+
+/* Used by HDS systme. This station ID is used by TL to tell upper layer that
+   this packet is for WDS and not for a loopback for an associated station. */
+#define WLANTL_RX_WDS_STAID WLAN_MAX_STA_COUNT
+
+/* Station ID used for BC traffic. This value will be used when upper layer registers
+   the broadcast client or allocate station strcuture to keep per-station info.*/
+//#define WLANTL_BC_STA_ID  0x00
+
+#endif
+
+#ifdef ANI_CHIPSET_VOLANS
+#define WLANTL_MAX_TID                        15
+#endif
+/*--------------------------------------------------------------------------
+  Access category enum used by TL
+  - order must be kept as these values are used to setup the AC mask
+ --------------------------------------------------------------------------*/
+typedef enum
+{
+  WLANTL_AC_BK = 0,
+  WLANTL_AC_BE = 1,
+  WLANTL_AC_VI = 2,
+  WLANTL_AC_VO = 3
+}WLANTL_ACEnumType; 
+
+/*---------------------------------------------------------------------------
+  STA Type
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /* Indicates a link to an AP*/
+  WLAN_STA_INFRA  = 0,  
+
+  /* AD-hoc link*/
+  WLAN_STA_IBSS,   
+
+  /* BT-AMP link*/
+  WLAN_STA_BT_AMP,
+
+#ifdef WLAN_SOFTAP_FEATURE
+  /* SoftAP station */
+  WLAN_STA_SOFTAP,
+#endif
+
+  /* Invalid link*/
+  WLAN_STA_MAX
+
+}WLAN_STAType;
+
+/*---------------------------------------------------------------------------
+  BAP Management frame type
+---------------------------------------------------------------------------*/
+typedef enum
+{
+    /* BT-AMP packet of type data */
+    WLANTL_BT_AMP_TYPE_DATA = 0x0001,
+
+    /* BT-AMP packet of type activity report */
+    WLANTL_BT_AMP_TYPE_AR = 0x0002,
+
+    /* BT-AMP packet of type security frame */
+    WLANTL_BT_AMP_TYPE_SEC = 0x0003,
+
+    /* BT-AMP packet of type Link Supervision request frame */
+    WLANTL_BT_AMP_TYPE_LS_REQ = 0x0004,
+
+    /* BT-AMP packet of type Link Supervision reply frame */
+    WLANTL_BT_AMP_TYPE_LS_REP = 0x0005,
+
+    /* Invalid Frame */
+    WLANTL_BAP_INVALID_FRAME
+
+} WLANTL_BAPFrameEnumType;
+
+#ifdef WLAN_SOFTAP_FEATURE
+/* Type used to specify LWM threshold unit */
+typedef enum  {
+    WLAN_LWM_THRESHOLD_BYTE = 0,
+
+    WLAN_LWM_THRESHOLD_PACKET
+} WLAN_LWM_Threshold_Type;
+#endif
+
+/*---------------------------------------------------------------------------
+  TL States
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /* Transition in this state made upon creation*/
+  WLANTL_STA_INIT = 0,
+
+  /* Transition happens after Assoc success if second level authentication
+     is needed*/
+  WLANTL_STA_CONNECTED,
+
+  /* Transition happens when second level auth is successful and keys are
+     properly installed */
+  WLANTL_STA_AUTHENTICATED,
+
+  /* Transition happens when connectivity is lost*/
+  WLANTL_STA_DISCONNECTED,
+
+  WLANTL_STA_MAX_STATE
+}WLANTL_STAStateType;
+
+
+/*---------------------------------------------------------------------------
+  STA Descriptor Type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA unique identifier, originating from HAL*/
+  v_U8_t         ucSTAId; 
+
+  /*STA MAC Address*/
+  v_MACADDR_t    vSTAMACAddress; 
+
+  /*BSSID for IBSS*/
+  v_MACADDR_t    vBSSIDforIBSS; 
+
+  /*Self MAC Address*/
+  v_MACADDR_t    vSelfMACAddress;
+
+  /*Type of the STA*/
+  WLAN_STAType   wSTAType; 
+
+  /*flag for setting the state of the QOS for the link*/
+  v_U8_t         ucQosEnabled;
+
+  /*enable FT in TL */
+  v_U8_t         ucSwFrameTXXlation; 
+  v_U8_t         ucSwFrameRXXlation;
+
+  /*Flag for signaling TL if LLC header needs to be added for outgoing 
+    packets*/
+  v_U8_t         ucAddRmvLLC;
+
+ /*Flag for signaling if the privacy bit needs to be set*/
+  v_U8_t         ucProtectedFrame;
+
+ /*DPU Signature used for unicast data - used for data caching*/
+  v_U8_t              ucUcastSig;
+ /*Flag to indicate if STA is a WAPI STA*/
+  v_U8_t         ucIsWapiSta;
+
+#ifdef FEATURE_WLAN_CCX
+ /*Flag to indicate if STA is a CCX STA*/
+  v_U8_t         ucIsCcxSta;
+#endif
+
+  /*DPU Signature used for broadcast data - used for data caching*/
+  v_U8_t              ucBcastSig;
+
+  /*Initial state at which the STA should be brought up to*/
+  WLANTL_STAStateType ucInitState;
+#ifdef ANI_CHIPSET_VOLANS
+ /* 1 means replay check is needed for the station,
+    0 means replay check is not needed for the station*/ 
+  v_BOOL_t      ucIsReplayCheckValid; 
+#endif
+}WLAN_STADescType;
+
+/*---------------------------------------------------------------------------
+  TL Configuration
+---------------------------------------------------------------------------*/      
+typedef struct
+{
+  /*AC weight for WFQ*/
+  v_U8_t   ucAcWeights[WLANTL_MAX_AC]; 
+
+  /*Delayed trigger frame timmer: - used by TL to send trigger frames less 
+    often when it has established that the App is suspended*/
+  v_U32_t  uDelayedTriggerFrmInt;  
+
+#ifdef WLAN_SOFTAP_FEATURE
+  /* Min Threshold for Processing Frames in TL */
+  v_U8_t   uMinFramesProcThres;
+#endif
+}WLANTL_ConfigInfoType;
+
+/*---------------------------------------------------------------------------
+  TSPEC Direction Enum Type
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /* uplink */
+  WLANTL_TX_DIR = 0,
+
+  /* downlink */
+  WLANTL_RX_DIR = 1,
+
+  /*bidirectional*/
+  WLANTL_BI_DIR = 2,
+}WLANTL_TSDirType;
+
+/*============================================================================
+ *     GENERIC STRUCTURES - END
+ ============================================================================*/
+
+
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  TL Error Type 
+---------------------------------------------------------------------------*/      
+typedef enum
+{
+  /* Generic error */
+  WLANTL_ERROR = 0,      
+
+  /* No rx callback registered for data path */
+  WLANTL_NO_RX_DATA_CB,  
+
+  /* No rx callback registered for management path*/
+  WLANTL_NO_RX_MGMT_CB,  
+
+  /* Generic memory error*/
+  WLANTL_MEM_ERROR,      
+
+  /* Bus error notified by BAL */
+  WLANTL_BUS_ERROR       
+
+}WLANTL_ErrorType;
+
+/*---------------------------------------------------------------------------
+  STA priority type
+---------------------------------------------------------------------------*/      
+typedef enum 
+{
+  /* STA gets to tx every second round*/
+  WLANTL_STA_PRI_VERY_LOW  = -2, 
+
+  /* STA gets to tx every other round*/
+  WLANTL_STA_PRI_LOW       = -1, 
+
+  /* STA gets to tx each time */
+  WLANTL_STA_PRI_NORMAL    =  0, 
+
+  /* STA gets to tx twice each time*/ 
+  WLANTL_STA_PRI_HIGH      =  1, 
+
+  /* STA gets to tx three times each time*/
+  WLANTL_STA_PRI_VERY_HIGH =  2  
+
+}WLANTL_STAPriorityType;
+
+/*---------------------------------------------------------------------------
+  Meta information requested from HDD by TL 
+---------------------------------------------------------------------------*/      
+typedef struct
+{
+  /* TID of the packet being sent */
+  v_U8_t    ucTID;
+
+  /* UP of the packet being sent */
+  v_U8_t    ucUP;
+
+  /* notifying TL if this is an EAPOL frame or not */
+  v_U8_t    ucIsEapol;
+#ifdef FEATURE_WLAN_WAPI
+  /* notifying TL if this is a WAI frame or not */
+  v_U8_t    ucIsWai;
+#endif
+  /* frame is 802.11 and it does not need translation */
+  v_U8_t    ucDisableFrmXtl;
+
+  /* frame is broadcast */
+  v_U8_t    ucBcast;
+
+  /* frame is multicast */
+  v_U8_t    ucMcast;
+
+  /* frame type */
+  v_U8_t    ucType;
+
+  /* timestamp */
+  v_U16_t   usTimeStamp;
+
+  /* STA has more packets to send */
+  v_BOOL_t  bMorePackets;
+}WLANTL_MetaInfoType;
+
+/*---------------------------------------------------------------------------
+  Meta information provided by TL to HDD on rx path  
+---------------------------------------------------------------------------*/      
+typedef struct
+{
+  /* UP of the packet being sent */
+  v_U8_t    ucUP;
+  /* Address 3 Index of the received packet */
+  v_U16_t   ucDesSTAId;
+}WLANTL_RxMetaInfoType;
+
+
+/*---------------------------------------------------------------------------
+  Handoff support and statistics defines and enum types
+---------------------------------------------------------------------------*/
+/* Threshold crossed event type definitions */
+#define WLANTL_HO_THRESHOLD_NA    0x00
+#define WLANTL_HO_THRESHOLD_DOWN  0x01
+#define WLANTL_HO_THRESHOLD_UP    0x02
+#define WLANTL_HO_THRESHOLD_CROSS 0x04
+
+/* Realtime traffic status */
+typedef enum
+{
+   WLANTL_HO_RT_TRAFFIC_STATUS_OFF,
+   WLANTL_HO_RT_TRAFFIC_STATUS_ON
+} WLANTL_HO_RT_TRAFFIC_STATUS_TYPE;
+
+/* Non-Realtime traffic status */
+typedef enum
+{
+   WLANTL_HO_NRT_TRAFFIC_STATUS_OFF,
+   WLANTL_HO_NRT_TRAFFIC_STATUS_ON
+} WLANTL_HO_NRT_TRAFFIC_STATUS_TYPE;
+
+/* Statistics type TL supported */
+typedef enum
+{
+   WLANTL_STATIC_TX_UC_FCNT,
+   WLANTL_STATIC_TX_MC_FCNT,
+   WLANTL_STATIC_TX_BC_FCNT,
+   WLANTL_STATIC_TX_UC_BCNT,
+   WLANTL_STATIC_TX_MC_BCNT,
+   WLANTL_STATIC_TX_BC_BCNT,
+   WLANTL_STATIC_RX_UC_FCNT,
+   WLANTL_STATIC_RX_MC_FCNT,
+   WLANTL_STATIC_RX_BC_FCNT,
+   WLANTL_STATIC_RX_UC_BCNT,
+   WLANTL_STATIC_RX_MC_BCNT,
+   WLANTL_STATIC_RX_BC_BCNT,
+   WLANTL_STATIC_RX_BCNT,
+   WLANTL_STATIC_RX_BCNT_CRC_OK,
+   WLANTL_STATIC_RX_RATE
+} WLANTL_TRANSFER_STATIC_TYPE;
+
+/*---------------------------------------------------------------------------
+  Handoff support and statistics structures
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   WLANTL_HO_RT_TRAFFIC_STATUS_TYPE   rtTrafficStatus;
+   WLANTL_HO_NRT_TRAFFIC_STATUS_TYPE  nrtTrafficStatus;
+} WLANTL_HO_TRAFFIC_STATUS_TYPE;
+
+#ifdef WLAN_SOFTAP_FEATURE
+typedef tSap_SoftapStats WLANTL_TRANSFER_STA_TYPE;
+#else
+typedef struct
+{
+   v_U32_t txUCFcnt;
+   v_U32_t txMCFcnt;
+   v_U32_t txBCFcnt;
+   v_U32_t txUCBcnt;
+   v_U32_t txMCBcnt;
+   v_U32_t txBCBcnt;
+   v_U32_t rxUCFcnt;
+   v_U32_t rxMCFcnt;
+   v_U32_t rxBCFcnt;
+   v_U32_t rxUCBcnt;
+   v_U32_t rxMCBcnt;
+   v_U32_t rxBCBcnt;
+   v_U32_t rxBcnt;
+   v_U32_t rxBcntCRCok;
+   v_U32_t rxRate;
+}WLANTL_TRANSFER_STA_TYPE;
+#endif
+
+/* Under here not public items, just use for internal */
+/* 3 SME 1 HDD */
+#define WLANTL_MAX_AVAIL_THRESHOLD   5
+#define WLANTL_HS_NUM_CLIENT         2
+#define WLANTL_SINGLE_CLNT_THRESHOLD 4
+
+/*----------------------------------------------------------------------------
+ *   TL callback types
+ *--------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Type of the tx complete callback registered with TL. 
+    
+    TL will call this to notify the client when a transmission for a 
+    packet  has ended. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL/HAL/PE/BAP/HDD control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    wTxSTAtus:      status of the transmission 
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_TxCompCBType)( v_PVOID_t      pvosGCtx,
+                                           vos_pkt_t*     pFrameDataBuff,
+                                           VOS_STATUS     wTxSTAtus );
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HDD
+ ---------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Type of the fetch packet callback registered with TL. 
+    
+    It is called by the TL when the scheduling algorithms allows for 
+    transmission of another packet to the module. 
+    It will be called in the context of the BAL fetch transmit packet 
+    function, initiated by the bus lower layer. 
+
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle 
+                    to TL's or HDD's control block can be extracted 
+                    from its context 
+
+    IN/OUT
+    pucSTAId:       the Id of the station for which TL is requesting a 
+                    packet, in case HDD does not maintain per station 
+                    queues it can give the next packet in its queue 
+                    and put in the right value for the 
+    pucAC:          access category requested by TL, if HDD does not have 
+                    packets on this AC it can choose to service another AC 
+                    queue in the order of priority
+
+    OUT
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted 
+    tlMetaInfo:    meta info related to the data frame
+
+
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_STAFetchPktCBType)( 
+                                            v_PVOID_t             pvosGCtx,
+                                            v_U8_t*               pucSTAId,
+                                            WLANTL_ACEnumType     ucAC,
+                                            vos_pkt_t**           vosDataBuff,
+                                            WLANTL_MetaInfoType*  tlMetaInfo);
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Type of the receive callback registered with TL. 
+    
+    TL will call this to notify the client when a packet was received 
+    for a registered STA.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to 
+                    TL's or HDD's control block can be extracted from 
+                    its context 
+    vosDataBuff:   pointer to the VOSS data buffer that was received
+                    (it may be a linked list) 
+    ucSTAId:        station id
+    pRxMetaInfo:   meta info for the received packet(s) 
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_STARxCBType)( v_PVOID_t              pvosGCtx,
+                                          vos_pkt_t*             vosDataBuff,
+                                          v_U8_t                 ucSTAId,
+                                          WLANTL_RxMetaInfoType* pRxMetaInfo);
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH BAP
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Type of the receive callback registered with TL for BAP. 
+    
+    The registered reception callback is being triggered by TL whenever a 
+    frame was received and it was filtered as a non-data BT AMP packet. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:      pointer to the global vos context; a handle to TL's 
+                   or SME's control block can be extracted from its context 
+    vosDataBuff:   pointer to the vOSS buffer containing the received packet; 
+                   no chaining will be done on this path
+    frameType:     type of the frame to be indicated to BAP.
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_BAPRxCBType)( v_PVOID_t               pvosGCtx,
+                                          vos_pkt_t*              vosDataBuff,
+                                          WLANTL_BAPFrameEnumType frameType);
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Callback registered with TL for BAP, this is required inorder for
+    TL to inform BAP, that the flush operation requested has been completed. 
+    
+    The registered reception callback is being triggered by TL whenever a 
+    frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL.
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    vosDataBuff:   pointer to the vOSS buffer containing the received packet; 
+                    no chaining will be done on this path 
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_FlushOpCompCBType)( v_PVOID_t     pvosGCtx,
+                                                v_U8_t        ucStaId,
+                                                v_U8_t        ucTID, 
+                                                v_U8_t        status);
+/*----------------------------------------------------------------------------
+    INTERACTION WITH PE
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION   
+    Type of the receive callback registered with TL for PE. 
+    
+    Upon receipt of a management frame TL will call the registered receive 
+    callback and forward this frame to the interested module, in our case PE. 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    vosFrmBuf:     pointer to a vOSS buffer containing the management frame 
+                    received
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_MgmtFrmRxCBType)( v_PVOID_t  pvosGCtx, 
+                                              v_PVOID_t  vosBuff);
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HAL
+ ---------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+
+  DESCRIPTION 
+    Type of the fetch packet callback registered with TL. 
+    
+    HAL calls this API when it wishes to suspend transmission for a 
+    particular STA.
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station for which the request is made; 
+                    a value of 0 assumes suspend on all active station
+    pfnSuspendTxCB: pointer to the suspend result notification in case the 
+                    call is asynchronous
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+  
+----------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_SuspendCBType)( v_PVOID_t      pvosGCtx,
+                                            v_U8_t*        ucSTAId,
+                                            VOS_STATUS     vosStatus);
+
+
+/*==========================================================================
+
+  DESCRIPTION 
+    Traffic status changed callback function
+    Should be registered to let client know that traffic status is changed
+    REF WLANTL_RegGetTrafficStatus
+
+  PARAMETERS 
+    pAdapter       Global handle pointer
+    trafficStatus  RT and NRT current traffic status
+    pUserCtxt      pre registered client context
+   
+  RETURN VALUE
+    VOS_STATUS
+
+  SIDE EFFECTS 
+    NONE
+ 
+============================================================================*/
+/* IF traffic status is changed, send notification to SME */
+typedef VOS_STATUS (*WLANTL_TrafficStatusChangedCBType)
+(
+   v_PVOID_t                     pAdapter,
+   WLANTL_HO_TRAFFIC_STATUS_TYPE trafficStatus,
+   v_PVOID_t                     pUserCtxt
+);
+
+/*==========================================================================
+
+  DESCRIPTION 
+    RSSI threshold crossed notification callback function
+    REF WLANTL_RegRSSIIndicationCB
+
+  PARAMETERS 
+    pAdapter          Global handle pointer
+    rssiNotification  Notification event type
+    pUserCtxt         pre registered client context
+
+  RETURN VALUE
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+/* If RSSI realm is changed, send notification to Clients, SME, HDD */
+typedef VOS_STATUS (*WLANTL_RSSICrossThresholdCBType)
+(
+   v_PVOID_t                       pAdapter,
+   v_U8_t                          rssiNotification,
+   v_PVOID_t                       pUserCtxt
+);
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Open
+
+  DESCRIPTION 
+    Called by HDD at driver initialization. TL will initialize all its 
+    internal resources and will wait for the call to start to register 
+    with the other modules. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    pTLConfig:      TL Configuration 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANTL_Open
+( 
+  v_PVOID_t               pvosGCtx,
+  WLANTL_ConfigInfoType*  pTLConfig
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Start
+
+  DESCRIPTION 
+    Called by HDD as part of the overall start procedure. TL will use this 
+    call to register with BAL as a transport layer entity. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other codes can be returned as a result of a BAL failure; see BAL API 
+    for more info
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANTL_Start
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Stop
+
+  DESCRIPTION 
+    Called by HDD to stop operation in TL, before close. TL will suspend all 
+    frame transfer operation and will wait for the close request to clean up 
+    its resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANTL_Stop
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Close
+
+  DESCRIPTION 
+    Called by HDD during general driver close procedure. TL will clean up 
+    all the internal resources. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page 
+                         fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANTL_Close
+( 
+  v_PVOID_t  pvosGCtx 
+);
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HDD
+ ---------------------------------------------------------------------------*/
+/*==========================================================================
+
+  FUNCTION    WLANTL_ConfigureSwFrameTXXlationForAll
+
+  DESCRIPTION
+     Function to disable/enable frame translation for all association stations.
+
+  DEPENDENCIES
+
+  PARAMETERS
+   IN
+    pvosGCtx:           VOS context 
+    EnableFrameXlation TRUE means enable SW translation for all stations.
+    .
+
+  RETURN VALUE
+
+   void.
+
+============================================================================*/
+void
+WLANTL_ConfigureSwFrameTXXlationForAll
+(
+  v_PVOID_t pvosGCtx, 
+  v_BOOL_t enableFrameXlation
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_RegisterSTAClient
+
+  DESCRIPTION 
+
+    This function is used by HDD to register as a client for data services 
+    with TL. HDD will call this API for each new station that it adds, 
+    thus having the flexibility of registering different callback for each 
+    STA it services. 
+
+  DEPENDENCIES 
+
+    TL must have been initialized before this gets called.
+     
+    Restriction: 
+      Main thread will have higher priority that Tx and Rx threads thus 
+      guaranteeing that a station will be added before any data can be 
+      received for it. (This enables TL to be lock free) 
+
+  PARAMETERS 
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   pfnStARx:        function pointer to the receive packet handler from HDD
+   pfnSTATxComp:    function pointer to the transmit complete confirmation 
+                    handler from HDD 
+   pfnSTAFetchPkt:  function pointer to the packet retrieval routine in HDD 
+   wSTADescType:    STA Descriptor, contains information related to the 
+                    new added STA
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL: Input parameters are invalid 
+    VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to 
+                        TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: Station was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_RegisterSTAClient 
+( 
+  v_PVOID_t                 pvosGCtx,
+  WLANTL_STARxCBType        pfnSTARx,  
+  WLANTL_TxCompCBType       pfnSTATxComp,  
+  WLANTL_STAFetchPktCBType  pfnSTAFetchPkt,
+  WLAN_STADescType*         wSTADescType ,
+  v_S7_t                    rssi
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_ClearSTAClient
+
+  DESCRIPTION 
+
+    HDD will call this API when it no longer needs data services for the 
+    particular station. 
+
+  DEPENDENCIES 
+
+    A station must have been registered before the clear registration is 
+    called. 
+
+  PARAMETERS 
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   ucSTAId:         identifier for the STA to be cleared
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to 
+                        TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: Station was not registered 
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_ClearSTAClient 
+( 
+  v_PVOID_t        pvosGCtx,
+  v_U8_t           ucSTAId 
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_ChangeSTAState
+
+  DESCRIPTION 
+
+    HDD will make this notification whenever a change occurs in the 
+    connectivity state of a particular STA. 
+
+  DEPENDENCIES 
+
+    A station must have been registered before the change state can be
+    called.
+
+    RESTRICTION: A station is being notified as authenticated before the 
+                 keys are installed in HW. This way if a frame is received 
+                 before the keys are installed DPU will drop that frame. 
+
+    Main thread has higher priority that Tx and Rx threads thus guaranteeing 
+    the following: 
+        - a station will be in assoc state in TL before TL receives any data 
+          for it 
+
+  PARAMETERS 
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+   ucSTAId:         identifier for the STA that is pending transmission
+   tlSTAState:     the new state of the connection to the given station
+
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer to 
+                         TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: Station was not registered 
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_ChangeSTAState 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  WLANTL_STAStateType   tlSTAState 
+);
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_STAPktPending
+
+  DESCRIPTION 
+
+    HDD will call this API when a packet is pending transmission in its 
+    queues. 
+
+  DEPENDENCIES 
+
+    A station must have been registered before the packet pending 
+    notification can be sent.
+
+    RESTRICTION: TL will not count packets for pending notification. 
+                 HDD is expected to send the notification only when 
+                 non-empty event gets triggered. Worst case scenario 
+                 is that TL might end up making a call when Hdds 
+                 queues are actually empty. 
+
+  PARAMETERS 
+
+    pvosGCtx:    pointer to the global vos context; a handle to TL's 
+                 control block can be extracted from its context 
+    ucSTAId:     identifier for the STA that is pending transmission
+    ucAC:        access category of the non-empty queue
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer 
+                         to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: Station was not registered 
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_STAPktPending 
+( 
+  v_PVOID_t            pvosGCtx,
+  v_U8_t               ucSTAId,
+  WLANTL_ACEnumType    ucAc
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_SetSTAPriority
+
+  DESCRIPTION 
+
+    TL exposes this API to allow upper layers a rough control over the 
+    priority of transmission for a given station when supporting multiple 
+    connections.
+
+  DEPENDENCIES 
+
+    A station must have been registered before the change in priority can be 
+    called.
+
+  PARAMETERS 
+
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier for the STA that has to change priority
+   
+  RETURN VALUE
+
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer 
+                         to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: Station was not registered 
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_SetSTAPriority 
+( 
+  v_PVOID_t                pvosGCtx,
+  v_U8_t                   ucSTAId,
+  WLANTL_STAPriorityType   tlSTAPri
+);
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH BAP
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RegisterBAPClient
+
+  DESCRIPTION 
+    Called by SME to register itself as client for non-data BT-AMP packets. 
+
+  DEPENDENCIES 
+    TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    pfnTlBAPRxFrm:  pointer to the receive processing routine for non-data 
+                    BT-AMP packets
+    pfnFlushOpCompleteCb: 
+                    pointer to the function that will inform BAP that the 
+                    flush operation is complete.
+   
+  RETURN VALUE
+  
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer 
+                         to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: BAL client was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_RegisterBAPClient 
+( 
+  v_PVOID_t                   pvosGCtx,
+  WLANTL_BAPRxCBType          pfnTlBAPRx,
+  WLANTL_FlushOpCompCBType    pfnFlushOpCompleteCb
+);
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxBAPFrm
+
+  DESCRIPTION 
+    BAP calls this when it wants to send a frame to the module
+
+  DEPENDENCIES 
+    BAP must be registered with TL before this function can be called. 
+
+    RESTRICTION: BAP CANNOT push any packets to TL until it did not receive 
+                 a tx complete from the previous packet, that means BAP
+                 sends one packet, wait for tx complete and then 
+                 sends another one
+
+                 If BAP sends another packet before TL manages to process the
+                 previously sent packet call will end in failure   
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or BAP's control block can be extracted from its context 
+    vosDataBuff:   pointer to the vOSS buffer containing the packet to be 
+                    transmitted
+    pMetaInfo:      meta information about the packet 
+    pfnTlBAPTxComp: pointer to a transmit complete routine for notifying 
+                    the result of the operation over the bus
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_E_EXISTS: BAL client was not yet registered
+    VOS_STATUS_E_BUSY:   The previous BT-AMP packet was not yet transmitted
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other failure messages may be returned from the BD header handling 
+    routines, please check apropriate API for more info. 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_TxBAPFrm 
+( 
+  v_PVOID_t               pvosGCtx,
+  vos_pkt_t*              vosDataBuff,  
+  WLANTL_MetaInfoType*    pMetaInfo,   
+  WLANTL_TxCompCBType     pfnTlBAPTxComp
+);
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH SME
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetRssi
+
+  DESCRIPTION 
+    TL will extract the RSSI information from every data packet from the 
+    ongoing traffic and will store it. It will provide the result to SME 
+    upon request.
+
+  DEPENDENCIES 
+
+    WARNING: the read and write of this value will not be protected 
+             by locks, therefore the information obtained after a read 
+             might not always be consistent.  
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    ucSTAId:        station identifier for the requested value
+
+    OUT
+    puRssi:         the average value of the RSSI
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer 
+                         to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: STA was not yet registered
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_GetRssi 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  v_S7_t*               puRssi
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetLinkQuality
+
+  DESCRIPTION 
+    TL will extract the LinkQuality information from every data packet from the 
+    ongoing traffic and will store it. It will provide the result to SME 
+    upon request.
+
+  DEPENDENCIES 
+
+    WARNING: the read and write of this value will not be protected 
+             by locks, therefore the information obtained after a read 
+             might not always be consistent.  
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    ucSTAId:        station identifier for the requested value
+
+    OUT
+    puLinkQuality:         the average value of the LinkQuality
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer 
+                         to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS: STA was not yet registered
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_GetLinkQuality 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  v_U32_t*              puLinkQuality
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_FlushStaTID
+
+  DESCRIPTION 
+    TL provides this API as an interface to SME (BAP) layer. TL inturn posts a 
+    message to HAL. This API is called by the SME inorder to perform a flush 
+    operation.
+
+  DEPENDENCIES 
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    ucSTAId:        station identifier for the requested value
+    ucTid:          Tspec ID for the new BA session
+
+    OUT
+    The response for this post is received in the main thread, via a response 
+    message from HAL to TL. 
+   
+  RETURN VALUE
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+============================================================================*/
+VOS_STATUS  
+WLANTL_FlushStaTID 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  v_U8_t                ucTid
+);
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH PE
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RegisterMgmtFrmClient
+
+  DESCRIPTION 
+    Called by PE to register as a client for management frames delivery. 
+
+  DEPENDENCIES 
+    TL must be initialized before this API can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:           pointer to the global vos context; a handle to 
+                        TL's control block can be extracted from its context 
+    pfnTlMgmtFrmRx:     pointer to the receive processing routine for 
+                        management frames
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS  
+WLANTL_RegisterMgmtFrmClient
+( 
+  v_PVOID_t               pvosGCtx,
+  WLANTL_MgmtFrmRxCBType  pfnTlMgmtFrmRx
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_DeRegisterMgmtFrmClient
+
+  DESCRIPTION
+    Called by PE to deregister as a client for management frames delivery.
+
+  DEPENDENCIES
+    TL must be initialized before this API can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:           pointer to the global vos context; a handle to
+                        TL's control block can be extracted from its context
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_DeRegisterMgmtFrmClient
+(
+  v_PVOID_t               pvosGCtx
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxMgmtFrm
+
+  DESCRIPTION 
+    Called by PE when it want to send out a management frame. 
+    HAL will also use this API for the few frames it sends out, they are not 
+    management frames howevere it is accepted that an exception will be 
+    allowed ONLY for the usage of HAL. 
+    Generic data frames SHOULD NOT travel through this function. 
+
+  DEPENDENCIES 
+    TL must be initialized before this API can be called. 
+
+    RESTRICTION: If PE sends another packet before TL manages to process the
+                 previously sent packet call will end in failure   
+
+                 Frames comming through here must be 802.11 frames, frame 
+                 translation in UMA will be automatically disabled. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context;a handle to TL's 
+                    control block can be extracted from its context 
+    vosFrmBuf:      pointer to a vOSS buffer containing the management  
+                    frame to be transmitted
+    usFrmLen:       the length of the frame to be transmitted; information 
+                    is already included in the vOSS buffer
+    wFrmType:       the type of the frame being transmitted
+    tid:            tid used to transmit this frame
+    pfnCompTxFunc:  function pointer to the transmit complete routine
+    pvBDHeader:     pointer to the BD header, if NULL it means it was not 
+                    yet constructed and it lies within TL's responsibility  
+                    to do so; if not NULL it is expected that it was 
+                    already packed inside the vos packet 
+    ucAckResponse:  flag notifying it an interrupt is needed for the 
+                    acknowledgement received when the frame is sent out 
+                    the air and ; the interrupt will be processed by HAL, 
+                    only one such frame can be pending in the system at 
+                    one time. 
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid 
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered
+    VOS_STATUS_E_BUSY:   The previous Mgmt packet was not yet transmitted
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+
+    Other failure messages may be returned from the BD header handling 
+    routines, please check apropriate API for more info. 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WLANTL_TxMgmtFrm
+( 
+  v_PVOID_t            pvosGCtx,  
+  vos_pkt_t*           vosFrmBuf,
+  v_U16_t              usFrmLen,
+  v_U8_t               ucFrmType, 
+  v_U8_t               tid,
+  WLANTL_TxCompCBType  pfnCompTxFunc,
+  v_PVOID_t            voosBDHeader,
+  v_U8_t               ucAckResponse
+);
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HAL
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ResetNotification
+
+  DESCRIPTION 
+    HAL notifies TL when the module is being reset.
+    Currently not used.
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a 
+                         page fault  
+    VOS_STATUS_SUCCESS:  Everything is good :) 
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_ResetNotification
+( 
+  v_PVOID_t   pvosGCtx 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_SuspendDataTx
+
+  DESCRIPTION 
+    HAL calls this API when it wishes to suspend transmission for a 
+    particular STA.
+    
+  DEPENDENCIES 
+    The STA for which the request is made must be first registered with 
+    TL by HDD. 
+
+    RESTRICTION:  In case of a suspend, the flag write and read will not be 
+                  locked: worst case scenario one more packet can get 
+                  through before the flag gets updated (we can make this 
+                  write atomic as well to guarantee consistency)
+
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    pucSTAId:       identifier of the station for which the request is made; 
+                    a value of NULL assumes suspend on all active station
+    pfnSuspendTxCB: pointer to the suspend result notification in case the 
+                    call is asynchronous
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer 
+                          to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:  Station was not registered 
+    VOS_STATUS_SUCCESS:   Everything is good :)
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_SuspendDataTx
+( 
+  v_PVOID_t               pvosGCtx,
+  v_U8_t*                 ucSTAId,
+  WLANTL_SuspendCBType    pfnSuspendTx
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ResumeDataTx
+
+  DESCRIPTION 
+    Called by HAL to resume data transmission for a given STA. 
+
+    WARNING: If a station was individually suspended a global resume will 
+             not resume that station
+             
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    pucSTAId:       identifier of the station which is being resumed; NULL
+                    translates into global resume
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer 
+                          to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:  Station was not registered 
+    VOS_STATUS_SUCCESS:   Everything is good :)
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_ResumeDataTx
+( 
+  v_PVOID_t      pvosGCtx,
+  v_U8_t*        pucSTAId 
+);
+
+
+/*----------------------------------------------------------------------------
+    CLIENT INDEPENDENT INTERFACE
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetTxPktCount
+
+  DESCRIPTION 
+    TL will provide the number of transmitted packets counted per 
+    STA per TID. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station 
+    ucTid:          identifier of the tspec 
+
+    OUT
+    puTxPktCount:   the number of packets tx packet for this STA and TID
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+    
+    VOS_STATUS_E_INVAL:   Input parameters are invalid 
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer 
+                          to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:  Station was not registered 
+    VOS_STATUS_SUCCESS:   Everything is good :)
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_GetTxPktCount
+( 
+  v_PVOID_t      pvosGCtx,
+  v_U8_t         ucSTAId,
+  v_U8_t         ucTid,
+  v_U32_t*       puTxPktCount
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetRxPktCount
+
+  DESCRIPTION 
+    TL will provide the number of received packets counted per 
+    STA per TID. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station 
+    ucTid:          identifier of the tspec 
+   
+   OUT
+    puTxPktCount:   the number of packets rx packet for this STA and TID
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid 
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer 
+                          to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:  Station was not registered 
+    VOS_STATUS_SUCCESS:   Everything is good :)
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_GetRxPktCount
+( 
+  v_PVOID_t      pvosGCtx,
+  v_U8_t         ucSTAId,
+  v_U8_t         ucTid,
+  v_U32_t*       puRxPktCount
+);
+
+/*==========================================================================
+    VOSS SCHEDULER INTERACTION
+  ==========================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_McProcessMsg
+
+  DESCRIPTION 
+    Called by VOSS when a message was serialized for TL through the
+    main thread/task. 
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    message:        type and content of the message 
+                    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a 
+                          page fault  
+    VOS_STATUS_SUCCESS:   Everything is good :)
+   
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_McProcessMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_McFreeMsg
+
+  DESCRIPTION 
+    Called by VOSS to free a given TL message on the Main thread when there 
+    are messages pending in the queue when the whole system is been reset. 
+    For now, TL does not allocate any body so this function shout translate 
+    into a NOOP
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    message:        type and content of the message 
+                    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_McFreeMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_TxProcessMsg
+
+  DESCRIPTION 
+    Called by VOSS when a message was serialized for TL through the
+    tx thread/task. 
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    message:        type and content of the message 
+                    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a 
+                          page fault  
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  Other values can be returned as a result of a function call, please check 
+  corresponding API for more info. 
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_TxProcessMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_McFreeMsg
+
+  DESCRIPTION 
+    Called by VOSS to free a given TL message on the Main thread when there 
+    are messages pending in the queue when the whole system is been reset. 
+    For now, TL does not allocate any body so this function shout translate 
+    into a NOOP
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    message:        type and content of the message 
+                    
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_TxFreeMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+);
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_EnableUAPSDForAC
+
+  DESCRIPTION 
+   Called by HDD to enable UAPSD in TL. TL is in charge for sending trigger 
+   frames. 
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        station Id 
+    ucACId:         AC for which U-APSD is being enabled  
+    ucTid           TSpec Id     
+    uServiceInt:    service interval used by TL to send trigger frames
+    uSuspendInt:    suspend interval used by TL to determine that an 
+                    app is idle and should start sending trigg frms less often
+    wTSDir:         direction of TSpec 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_EnableUAPSDForAC
+(
+  v_PVOID_t          pvosGCtx,
+  v_U8_t             ucSTAId,
+  WLANTL_ACEnumType  ucACId,
+  v_U8_t             ucTid,
+  v_U8_t             ucUP,
+  v_U32_t            uServiceInt,
+  v_U32_t            uSuspendInt,
+  WLANTL_TSDirType   wTSDir
+);
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_DisableUAPSDForAC
+
+  DESCRIPTION 
+   Called by HDD to disable UAPSD in TL. TL will stop sending trigger 
+   frames. 
+
+  DEPENDENCIES 
+    The TL must be initialized before this function can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        station Id 
+    ucACId:         AC for which U-APSD is being enabled       
+   
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_DisableUAPSDForAC
+(
+  v_PVOID_t          pvosGCtx,
+  v_U8_t             ucSTAId,
+  WLANTL_ACEnumType  ucACId
+);
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+/*==========================================================================
+  FUNCTION     WLANTL_RegRSSIIndicationCB
+
+  DESCRIPTION  Registration function to get notification if RSSI cross
+               threshold.
+               Client should register threshold, direction, and notification
+               callback function pointer
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in rssiValue - RSSI threshold value
+               in triggerEvent - Cross direction should be notified
+                                 UP, DOWN, and CROSS
+               in crossCBFunction - Notification CB Function
+               in usrCtxt - user context
+
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_RegRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID,
+   v_PVOID_t                       usrCtxt
+);
+
+/*==========================================================================
+  FUNCTION     WLANTL_DeregRSSIIndicationCB
+
+  DESCRIPTION  Remove specific threshold from list
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in rssiValue - RSSI threshold value
+               in triggerEvent - Cross direction should be notified
+                                 UP, DOWN, and CROSS
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_DeregRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification
+(
+   v_PVOID_t             pAdapter,
+   tpSirRSSINotification pRSSINotification
+);
+
+/*==========================================================================
+  FUNCTION     WLANTL_SetAlpha
+
+  DESCRIPTION  ALPLA is weight value to calculate AVG RSSI
+               avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI)
+               avgRSSI has (ALPHA * 10)% of history RSSI weight and
+               (10 - ALPHA)% of newRSSI weight
+               This portion is dynamically configurable.
+               Default is ?
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in valueAlpah - ALPHA
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_SetAlpha
+(
+   v_PVOID_t pAdapter,
+   v_U8_t    valueAlpha
+);
+
+/*==========================================================================
+  FUNCTION     WLANTL_RegGetTrafficStatus
+
+  DESCRIPTION  Registration function for traffic status monitoring
+               During measure period count data frames.
+               If frame count is larger then IDLE threshold set as traffic ON
+               or OFF.
+               And traffic status is changed send report to client with
+               registered callback function
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in idleThreshold - Traffic on or off threshold
+               in measurePeriod - Traffic state check period
+               in trfficStatusCB - traffic status changed notification
+                                   CB function
+               in usrCtxt - user context
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_RegGetTrafficStatus
+(
+   v_PVOID_t                          pAdapter,
+   v_U32_t                            idleThreshold,
+   v_U32_t                            measurePeriod,
+   WLANTL_TrafficStatusChangedCBType  trfficStatusCB,
+   v_PVOID_t                          usrCtxt
+);
+#endif
+/*==========================================================================
+  FUNCTION      WLANTL_GetStatistics
+
+  DESCRIPTION   Get traffic statistics for identified station 
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                out statBuffer - traffic statistics buffer
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_GetStatistics
+(
+   v_PVOID_t                  pAdapter,
+   WLANTL_TRANSFER_STA_TYPE  *statBuffer,
+   v_U8_t                     STAid
+);
+
+/*==========================================================================
+  FUNCTION      WLANTL_ResetStatistics
+
+  DESCRIPTION   Reset statistics structure for identified station ID
+                Reset means set values as 0
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_ResetStatistics
+(
+   v_PVOID_t                  pAdapter,
+   v_U8_t                     STAid
+);
+
+/*==========================================================================
+  FUNCTION      WLANTL_GetSpecStatistic
+
+  DESCRIPTION   Get specific field within statistics structure for
+                identified station ID 
+
+  DEPENDENCIES  NONE
+
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                in STAid    - Station ID
+                out buffer  - Statistic value
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_GetSpecStatistic
+(
+   v_PVOID_t                    pAdapter,
+   WLANTL_TRANSFER_STATIC_TYPE  statType,
+   v_U32_t                     *buffer,
+   v_U8_t                       STAid
+);
+
+/*==========================================================================
+  FUNCTION      WLANTL_ResetSpecStatistic
+
+  DESCRIPTION   Reset specific field within statistics structure for
+                identified station ID
+                Reset means set as 0
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                in STAid    - Station ID
+
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_ResetSpecStatistic
+(
+   v_PVOID_t                    pAdapter,
+   WLANTL_TRANSFER_STATIC_TYPE  statType,
+   v_U8_t                       STAid
+);
+#ifdef ANI_CHIPSET_VOLANS
+/*===============================================================================
+  FUNCTION      WLANTL_IsReplayPacket
+   
+  DESCRIPTION   This function does replay check for valid stations
+
+  DEPENDENCIES  Validity of replay check must be done before the function 
+                is called
+                           
+  PARAMETERS    currentReplayCounter    current replay counter taken from RX BD 
+                previousReplayCounter   previous replay counter taken from TL CB
+                                          
+  RETRUN        VOS_TRUE    packet is a replay packet
+                VOS_FALSE   packet is not a replay packet
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+v_BOOL_t WLANTL_IsReplayPacket
+(
+    v_U64_t    currentReplayCounter,
+    v_U64_t    previousReplayCounter
+);
+
+/*===============================================================================
+  FUNCTION      WLANTL_GetReplayCounterFromRxBD
+     
+  DESCRIPTION   This function extracts 48-bit replay packet number from RX BD 
+ 
+  DEPENDENCIES  Validity of replay check must be done before the function 
+                is called
+                          
+  PARAMETERS    pucRxHeader pointer to RX BD header
+                                       
+  RETRUN        v_U64_t    Packet number extarcted from RX BD
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+v_U64_t
+WLANTL_GetReplayCounterFromRxBD
+(
+   v_U8_t *pucRxBDHeader
+);
+#endif /*End of #ifdef ANI_CHIPSET_VOLANS*/
+
+
+
+/*
+ DESCRIPTION 
+    TL returns the weight currently maintained in TL.
+ IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+
+ OUT
+    pACWeights:     Caller allocated memory for filling in weights
+
+ RETURN VALUE  VOS_STATUS
+*/
+VOS_STATUS  
+WLANTL_GetACWeights 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pACWeights
+);
+
+
+/*
+ DESCRIPTION 
+    Change the weight currently maintained by TL.
+ IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    pACWeights:     Caller allocated memory contain the weights to use
+
+
+ RETURN VALUE  VOS_STATUS
+*/
+VOS_STATUS  
+WLANTL_SetACWeights 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pACWeights
+);
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+  FUNCTION      WLANTL_GetSoftAPStatistics
+
+  DESCRIPTION   Collect the cumulative statistics for all Softap stations
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pvosGCtx  - Pointer to the global vos context
+                   bReset    - If set TL statistics will be cleared after reading
+                out statsSum - pointer to collected statistics
+
+  RETURN VALUE  VOS_STATUS_SUCCESS : if the Statistics are successfully extracted
+
+  SIDE EFFECTS  NONE
+
+============================================================================*/
+VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset);
+#endif
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+ /*===========================================================================
+
+  FUNCTION    WLANTL_AssocFailed
+
+  DESCRIPTION
+
+    This function is used by PE to notify TL that cache needs to flushed
+    when association is not successfully completed 
+
+    Internally, TL post a message to TX_Thread to serialize the request to 
+    keep lock-free mechanism.
+
+   
+  DEPENDENCIES
+
+    TL must have been initialized before this gets called.
+
+   
+  PARAMETERS
+
+   ucSTAId:   station id 
+
+  RETURN VALUE
+
+   none
+   
+  SIDE EFFECTS
+   There may be race condition that PE call this API and send another association
+   request immediately with same staId before TX_thread can process the message.
+
+   To avoid this, we might need PE to wait for TX_thread process the message,
+   but this is not currently implemented. 
+   
+============================================================================*/
+void WLANTL_AssocFailed(v_U8_t staId);
+
+
+/*===============================================================================
+  FUNCTION      WLANTL_PostResNeeded
+     
+  DESCRIPTION   This function posts message to TL to reserve BD/PDU memory
+ 
+  DEPENDENCIES  None
+                          
+  PARAMETERS    pvosGCtx
+                                       
+  RETURN        None
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+
+void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx);
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_Finish_ULA
+
+  DESCRIPTION
+     This function is used by HDD to notify TL to finish Upper layer authentication
+     incase the last EAPOL packet is pending in the TL queue. 
+     To avoid the race condition between sme set key and the last EAPOL packet 
+     the HDD module calls this function just before calling the sme_RoamSetKey.
+   
+  DEPENDENCIES
+
+    TL must have been initialized before this gets called.
+
+   
+  PARAMETERS
+
+   callbackRoutine:   HDD Callback function.
+   callbackContext : HDD userdata context.
+
+  RETURN VALUE
+
+   VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
+   
+  SIDE EFFECTS
+   
+============================================================================*/
+
+VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
+                              void *callbackContext);
+
+/*===============================================================================
+  FUNCTION       WLANTL_UpdateRssiBmps
+
+  DESCRIPTION    This function updates the TL's RSSI (in BMPS mode)
+
+  DEPENDENCIES   None
+
+  PARAMETERS
+
+    pvosGCtx         VOS context          VOS Global context
+    staId            Station ID           Station ID
+    rssi             RSSI (BMPS mode)     RSSI in BMPS mode
+
+  RETURN         None
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+
+void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi);
+
+#endif /* #ifndef WLAN_QCT_WLANTL_H */
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
new file mode 100644
index 0000000..1295f80
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -0,0 +1,10690 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+
+                       W L A N _ Q C T _ T L . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Transport Layer.
+
+  The functions externalized by this module are to be called ONLY by other
+  WLAN modules that properly register with the Transport Layer initially.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 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
+----------    ---    --------------------------------------------------------
+2010-07-13    c_shinde Fixed an issue where WAPI rekeying was failing because 
+                      WAI frame sent out during rekeying had the protected bit
+                      set to 1.
+2010-05-06    rnair   Changed name of variable from usLlcType to usEtherType
+                      Changed function name from GetLLCType to GetEtherType
+                      Fixed 802.3 to 802.11 frame translation issue where two 
+                      bytes of the LLC header was getting overwritten in the
+                      non-Qos path
+2010-05-06    rnair   RxAuth path fix for modifying the header before ether
+                      type is retreived (Detected while testing rekeying
+                      in WAPI Volans)
+2010-02-19    bad     Fixed 802.11 to 802.3 ft issues with WAPI
+2010-02-19    rnair   WAPI: If frame is a WAI frame in TxConn and TxAuth, TL 
+                      does frame translation. 
+2010-02-01    rnair   WAPI: Fixed a bug where the value of ucIsWapiSta was not       
+                      being set in the TL control block in the RegisterSTA func. 
+2010-01-08    lti     Added TL Data Caching 
+2009-11-04    rnair   WAPI: Moving common functionality to a seperate function
+                      called WLANTL_GetLLCType
+2009-10-15    rnair   WAPI: Featurizing WAPI code
+2009-10-09    rnair   WAPI: Modifications to authenticated state handling of Rx data
+2009-10-06    rnair   Adding support for WAPI 
+2009-09-22    lti     Add deregistration API for management client
+2009-07-16    rnair   Temporary fix to let TL fetch packets when multiple 
+                      peers exist in an IBSS
+2009-06-10    lti     Fix for checking TID value of meta info on TX - prevent
+                      memory overwrite 
+                      Fix for properly checking the sta id for resuming trigger
+                      frame generation
+2009-05-14    lti     Fix for sending out trigger frames
+2009-05-15    lti     Addr3 filtering 
+2009-04-13    lti     Assert if packet larger then allowed
+                      Drop packet that fails flatten
+2009-04-02    lti     Performance fixes for TL 
+2009-02-19    lti     Added fix for LLC management on Rx Connect 
+2009-01-16    lti     Replaced peek data with extract data for non BD opertions
+                      Extracted frame control in Tl and pass to HAL for frame 
+                      type evaluation
+2009-02-02    sch     Add handoff support
+2008-12-09    lti     Fixes for AMSS compilation 
+                      Removed assert on receive when there is no station
+2008-12-02    lti     Fix fo trigger frame generation 
+2008-10-31    lti     Fix fo TL tx suspend
+2008-10-01    lti     Merged in fixes from reordering
+                      Disabled part of UAPSD functionality in TL
+                      (will be re-enabled once UAPSD is tested)
+                      Fix for UAPSD multiple enable
+2008-08-10    lti     Fixes following UAPSD testing
+                      Fixed infinite loop on mask computation when STA no reg
+2008-08-06    lti     Fixes after QOS unit testing
+2008-08-06    lti     Added QOS support
+2008-07-23    lti     Fix for vos packet draining
+2008-07-17    lti     Fix for data type value
+                      Added frame translation code in TL
+                      Avoid returning failure to PE in case previous frame is
+                      still pending; fail previous and cache new one for tx
+                      Get frames returning boolean true if more frames are pending
+2008-07-03    lti     Fixes following pre-integration testing
+2008-06-26    lti     Fixes following unit testing
+                      Added alloc and free for TL context
+                      Using atomic set u8 instead of u32
+2008-05-16    lti     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_tl.h" 
+#include "wlan_qct_wda.h" 
+#include "wlan_qct_tli.h" 
+#include "wlan_qct_tli_ba.h" 
+#include "wlan_qct_tl_hosupport.h"
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC )
+#include "wlan_qct_ssc.h"
+#endif
+#include "tlDebug.h"
+#ifdef FEATURE_WLAN_WAPI
+/*Included to access WDI_RxBdType */
+#include "wlan_qct_wdi_bd.h"
+#endif
+/*Enables debugging behavior in TL*/
+#define TL_DEBUG
+//#define WLAN_SOFTAP_FLOWCTRL_EN
+
+//#define BTAMP_TEST
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+/*LLC header value*/
+static v_U8_t WLANTL_LLC_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
+
+#ifdef FEATURE_WLAN_CCX
+/*Aironet SNAP header value*/
+static v_U8_t WLANTL_AIRONET_SNAP_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 };
+#endif //FEATURE_WLAN_CCX
+
+/*BT-AMP packet LLC OUI value*/
+const v_U8_t WLANTL_BT_AMP_OUI[] =  {0x00, 0x19, 0x58 };
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#define WLANTL_BD_PDU_RESERVE_THRESHOLD           80
+#endif
+
+#ifdef VOLANS_PERF
+#define WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD  120
+#define WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD  120
+
+/* TL BD/PDU threshold to enable interrupt */
+int bdPduInterruptEnableThreshold = WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD;
+int bdPduInterruptGetThreshold = WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD;
+#endif /* VOLANS_PERF */
+
+/*-----------------------------------*
+ |   Type(2b)   |     Sub-type(4b)   |
+ *-----------------------------------*/
+#define WLANTL_IS_DATA_FRAME(_type_sub)                               \
+                     ( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 ))
+
+#define WLANTL_IS_QOS_DATA_FRAME(_type_sub)                                      \
+                     (( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 )) &&     \
+                      ( WLANTL_80211_DATA_QOS_SUBTYPE == ( (_type_sub) & 0xF ))) 
+
+#define WLANTL_IS_MGMT_FRAME(_type_sub)                                     \
+                     ( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 ))
+
+#define WLANTL_IS_CTRL_FRAME(_type_sub)                                     \
+                     ( WLANTL_CTRL_FRAME_TYPE == ( (_type_sub) & 0x30 ))
+
+/*MAX Allowed len processed by TL - MAx MTU + 802.3 header + BD+DXE+XTL*/
+#define WLANTL_MAX_ALLOWED_LEN    1514 + 100
+
+#define WLANTL_MASK_AC  0x03
+
+#ifdef WLAN_SOFTAP_FEATURE
+//some flow_control define
+//LWM mode will be enabled for this station if the egress/ingress falls below this ratio
+#define WLANTL_LWM_EGRESS_INGRESS_THRESHOLD (0.75)
+
+//Get enough sample to do the LWM related calculation
+#define WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD (64)
+
+//Maximal on-fly packet per station in LWM mode
+#define WLANTL_STA_BMU_THRESHOLD_MAX (256)
+
+#define WLANTL_AC_MASK (0x7)
+#define WLANTL_STAID_OFFSET (0x4)
+#endif
+
+/* UINT32 type endian swap */
+#define SWAP_ENDIAN_UINT32(a)          ((a) = ((a) >> 0x18 ) |(((a) & 0xFF0000) >> 0x08) | \
+                                            (((a) & 0xFF00) << 0x08)  | (((a) & 0xFF) << 0x18))
+
+
+
+/*--------------------------------------------------------------------------
+   TID to AC mapping in TL
+ --------------------------------------------------------------------------*/
+const v_U8_t  WLANTL_TID_2_AC[WLAN_MAX_TID] = {   WLANTL_AC_BE,
+                                                  WLANTL_AC_BK,
+                                                  WLANTL_AC_BK,
+                                                  WLANTL_AC_BE,
+                                                  WLANTL_AC_VI,
+                                                  WLANTL_AC_VI,
+                                                  WLANTL_AC_VO,
+                                                  WLANTL_AC_VO };
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+#define TL_LITTLE_BIT_ENDIAN
+
+typedef struct
+{
+
+#ifndef TL_LITTLE_BIT_ENDIAN
+
+   v_U8_t subType :4;
+   v_U8_t type :2;
+   v_U8_t protVer :2;
+
+   v_U8_t order :1;
+   v_U8_t wep :1;
+   v_U8_t moreData :1;
+   v_U8_t powerMgmt :1;
+   v_U8_t retry :1;
+   v_U8_t moreFrag :1;
+   v_U8_t fromDS :1;
+   v_U8_t toDS :1;
+
+#else
+
+   v_U8_t protVer :2;
+   v_U8_t type :2;
+   v_U8_t subType :4;
+
+   v_U8_t toDS :1;
+   v_U8_t fromDS :1;
+   v_U8_t moreFrag :1;
+   v_U8_t retry :1;
+   v_U8_t powerMgmt :1;
+   v_U8_t moreData :1;
+   v_U8_t wep :1;
+   v_U8_t order :1;
+
+#endif
+
+} WLANTL_MACFCType;
+
+/* 802.11 header */
+typedef struct
+{
+ /* Frame control field */
+ WLANTL_MACFCType  wFrmCtrl;
+
+ /* Duration ID */
+ v_U16_t  usDurationId;
+
+ /* Address 1 field  */
+ v_U8_t   vA1[VOS_MAC_ADDR_SIZE];
+
+ /* Address 2 field */
+ v_U8_t   vA2[VOS_MAC_ADDR_SIZE];
+
+ /* Address 3 field */
+ v_U8_t   vA3[VOS_MAC_ADDR_SIZE];
+
+ /* Sequence control field */
+ v_U16_t  usSeqCtrl;
+
+ // Find the size of the mandatory header size.
+#define WLAN80211_MANDATORY_HEADER_SIZE \
+    (sizeof(WLANTL_MACFCType) + sizeof(v_U16_t) + \
+    (3 * (sizeof(v_U8_t) * VOS_MAC_ADDR_SIZE))  + \
+    sizeof(v_U16_t))
+
+ /* Optional A4 address */
+ v_U8_t   optvA4[VOS_MAC_ADDR_SIZE];
+
+ /* Optional QOS control field */
+ v_U16_t  usQosCtrl;
+}WLANTL_80211HeaderType;
+
+/* 802.3 header */
+typedef struct
+{
+ /* Destination address field */
+ v_U8_t   vDA[VOS_MAC_ADDR_SIZE];
+
+ /* Source address field */
+ v_U8_t   vSA[VOS_MAC_ADDR_SIZE];
+
+ /* Length field */
+ v_U16_t  usLenType;
+}WLANTL_8023HeaderType;
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+#define WLAN_TL_INVALID_U_SIG 255
+#define WLAN_TL_INVALID_B_SIG 255
+
+#define WLAN_TL_AC_ARRAY_2_MASK( _pSTA, _ucACMask, i ) \
+  do\
+  {\
+    _ucACMask = 0; \
+    for ( i = 0; i < WLANTL_MAX_AC; i++ ) \
+    { \
+      if ( 0 != (_pSTA)->aucACMask[i] ) \
+      { \
+        _ucACMask |= ( 1 << i ); \
+      } \
+    } \
+  } while (0);
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+static VOS_STATUS 
+WLANTL_GetEtherType
+(
+  v_U8_t               * aucBDHeader,
+  vos_pkt_t            * vosDataBuff,
+  v_U8_t                 ucMPDUHLen,
+  v_U16_t              * usEtherType
+);
+
+#ifdef FEATURE_WLAN_WAPI
+/*---------------------------------------------------------------------------
+ * Adding a global variable to be used when doing frame translation in TxAuth
+ * state so as to not set the protected bit to 1 in the case of WAI frames
+ *---------------------------------------------------------------------------*/
+v_U8_t gUcIsWai = 0;
+#endif
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+* -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Function Declarations and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Open
+
+  DESCRIPTION
+    Called by HDD at driver initialization. TL will initialize all its
+    internal resources and will wait for the call to start to register
+    with the other modules.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    pTLConfig:      TL Configuration
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page
+                         fault
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Open
+(
+  v_PVOID_t               pvosGCtx,
+  WLANTL_ConfigInfoType*  pTLConfig
+)
+{
+  WLANTL_CbType*  pTLCb = NULL; 
+  v_U8_t          ucIndex; 
+  tHalHandle      smeContext;
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+  VOS_STATUS      status = VOS_STATUS_SUCCESS;
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  vos_alloc_context( pvosGCtx, VOS_MODULE_ID_TL, 
+                    (void*)&pTLCb, sizeof(WLANTL_CbType));
+
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if (( NULL == pTLCb ) || ( NULL == pTLConfig ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Invalid input pointer on WLANTL_Open TL %x Config %x", pTLCb, pTLConfig ));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
+  if ( NULL == smeContext )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid smeContext", __FUNCTION__));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /* Zero out the memory so we are OK, when CleanCB is called.*/
+  vos_mem_zero((v_VOID_t *)pTLCb, sizeof(WLANTL_CbType));
+
+  /*------------------------------------------------------------------------
+    Clean up TL control block, initialize all values
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:WLANTL_Open"));
+
+  pTLCb->atlSTAClients = vos_mem_malloc(sizeof(WLANTL_STAClientType) * WLAN_MAX_STA_COUNT);
+  if (NULL == pTLCb->atlSTAClients)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: StaClients allocation failed\n"));
+    vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
+    return VOS_STATUS_E_FAULT;
+  }
+
+  vos_mem_zero((v_VOID_t *)pTLCb->atlSTAClients, sizeof(WLANTL_STAClientType) * WLAN_MAX_STA_COUNT);
+
+  pTLCb->reorderBufferPool = vos_mem_malloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
+  if (NULL == pTLCb->reorderBufferPool)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: Reorder buffer allocation failed\n"));
+    vos_mem_free(pTLCb->atlSTAClients);
+    vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
+    return VOS_STATUS_E_FAULT;
+         
+  }
+
+  vos_mem_zero((v_VOID_t *)pTLCb->reorderBufferPool, sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
+
+  WLANTL_CleanCB(pTLCb, 0 /*do not empty*/);
+
+  for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
+  {
+    pTLCb->tlConfigInfo.ucAcWeights[ucIndex] =
+                pTLConfig->ucAcWeights[ucIndex];
+  }
+
+#ifdef WLAN_SOFTAP_FEATURE
+  // scheduling init to be the last one of previous round
+  pTLCb->uCurServedAC = WLANTL_AC_BK;
+  pTLCb->ucCurLeftWeight = 1;
+  pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT-1;
+
+#if 0
+  //flow control field init
+  vos_mem_zero(&pTLCb->tlFCInfo, sizeof(tFcTxParams_type));
+  //bit 0: set (Bd/pdu count) bit 1: set (request station PS change notification)
+  pTLCb->tlFCInfo.fcConfig = 0x1;
+#endif
+
+  pTLCb->vosTxFCBuf = NULL;
+  pTLCb->tlConfigInfo.uMinFramesProcThres =
+                pTLConfig->uMinFramesProcThres;
+#endif
+
+  pTLCb->tlConfigInfo.uDelayedTriggerFrmInt =
+                pTLConfig->uDelayedTriggerFrmInt;
+
+  /*------------------------------------------------------------------------
+    Allocate internal resources
+   ------------------------------------------------------------------------*/
+  vos_pkt_get_packet(&pTLCb->vosDummyBuf, VOS_PKT_TYPE_RX_RAW, 1, 1,
+                     1/*true*/,NULL, NULL);
+
+  WLANTL_InitBAReorderBuffer(pvosGCtx);
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+   /* Initialize Handoff support modue
+    * RSSI measure and Traffic state monitoring */
+  status = WLANTL_HSInit(pvosGCtx);
+  if(!VOS_IS_STATUS_SUCCESS(status))
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "Handoff support module init fail"));
+    vos_mem_free(pTLCb->atlSTAClients);
+    vos_mem_free(pTLCb->reorderBufferPool);
+    vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
+    return status;
+  }
+#endif
+
+  pTLCb->isBMPS = VOS_FALSE;
+  pmcRegisterDeviceStateUpdateInd( smeContext,
+                                   WLANTL_PowerStateChangedCB, pvosGCtx );
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_Open */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Start
+
+  DESCRIPTION
+    Called by HDD as part of the overall start procedure. TL will use this
+    call to register with BAL as a transport layer entity.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page
+                         fault
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+    Other codes can be returned as a result of a BAL failure; see BAL API
+    for more info
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Start
+(
+  v_PVOID_t  pvosGCtx
+)
+{
+  WLANTL_CbType*      pTLCb      = NULL;
+  v_U32_t             uResCount = WDA_TLI_MIN_RES_DATA;
+  VOS_STATUS          vosStatus;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_Start"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Register with WDA as transport layer client
+    Request resources for tx from bus
+  ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:WLAN TL:WLANTL_Start"));
+
+  vosStatus = WDA_DS_Register( pvosGCtx, 
+                          WLANTL_TxComp, 
+                          WLANTL_RxFrames,
+                          WLANTL_GetFrames, 
+                          WLANTL_ResourceCB,
+                          WDA_TLI_MIN_RES_DATA, 
+                          pvosGCtx, 
+                          &uResCount ); 
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, 
+               "WLAN TL:TL failed to register with BAL/WDA, Err: %d",
+               vosStatus));
+    return vosStatus;
+  }
+
+  /* Enable transmission */
+  vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
+
+  pTLCb->uResCount = uResCount;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_Start */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Stop
+
+  DESCRIPTION
+    Called by HDD to stop operation in TL, before close. TL will suspend all
+    frame transfer operation and will wait for the close request to clean up
+    its resources.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page
+                         fault
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Stop
+(
+  v_PVOID_t  pvosGCtx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  v_U8_t      ucIndex;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Stop TL and empty Station list
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:WLANTL_Stop"));
+
+  /* Disable transmission */
+  vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
+
+  if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
+  {
+    vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
+    pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
+  }
+
+  if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
+  {
+    vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
+    pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
+  }
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+  if(VOS_STATUS_SUCCESS != WLANTL_HSStop(pvosGCtx))
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+               "Handoff Support module stop fail"));
+  }
+#endif
+
+  /*-------------------------------------------------------------------------
+    Clean client stations
+   -------------------------------------------------------------------------*/
+  for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
+  {
+    WLANTL_CleanSTA(&pTLCb->atlSTAClients[ucIndex], 1 /*empty all queues*/);
+  }
+
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_Stop */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_Close
+
+  DESCRIPTION
+    Called by HDD during general driver close procedure. TL will clean up
+    all the internal resources.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a page
+                         fault
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Close
+(
+  v_PVOID_t  pvosGCtx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  tHalHandle smeContext;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+  /*------------------------------------------------------------------------
+    Deregister from PMC
+   ------------------------------------------------------------------------*/
+  smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
+  if ( NULL == smeContext )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid smeContext", __FUNCTION__));
+    // continue so that we can cleanup as much as possible
+  }
+  else
+  {
+    pmcDeregisterDeviceStateUpdateInd( smeContext, WLANTL_PowerStateChangedCB );
+  }
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+  if(VOS_STATUS_SUCCESS != WLANTL_HSDeInit(pvosGCtx))
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+               "Handoff Support module DeInit fail"));
+  }
+#endif
+
+  /*------------------------------------------------------------------------
+    Cleanup TL control block.
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL: WLANTL_Close"));
+  WLANTL_CleanCB(pTLCb, 1 /* empty queues/lists/pkts if any*/);
+
+  vos_mem_free(pTLCb->atlSTAClients);
+  vos_mem_free(pTLCb->reorderBufferPool);
+
+  /*------------------------------------------------------------------------
+    Free TL context from VOSS global
+   ------------------------------------------------------------------------*/
+  vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_Close */
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HDD
+ ---------------------------------------------------------------------------*/
+/*==========================================================================
+
+  FUNCTION    WLANTL_ConfigureSwFrameTXXlationForAll
+
+  DESCRIPTION
+     Function to disable/enable frame translation for all association stations.
+
+  DEPENDENCIES
+
+  PARAMETERS
+   IN
+    pvosGCtx: VOS context 
+    EnableFrameXlation TRUE means enable SW translation for all stations.
+    .
+
+  RETURN VALUE
+
+   void.
+
+============================================================================*/
+void
+WLANTL_ConfigureSwFrameTXXlationForAll
+(
+  v_PVOID_t pvosGCtx, 
+  v_BOOL_t enableFrameXlation
+)
+{
+  v_U8_t ucIndex;
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
+
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+           "WLAN TL:Invalid TL pointer from pvosGCtx on "
+           "WLANTL_ConfigureSwFrameTXXlationForAll"));
+    return;
+  }
+
+  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+     "WLANTL_ConfigureSwFrameTXXlationForAll: Configure SW frameXlation %d", 
+      enableFrameXlation));
+
+  for ( ucIndex = 0; ucIndex < WLAN_MAX_TID; ucIndex++) 
+  {
+    if ( 0 != pTLCb->atlSTAClients[ucIndex].ucExists )
+    {
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+      // if this station was not allocated resources to perform HW-based
+      // TX frame translation then force SW-based TX frame translation
+      // otherwise use the frame translation supplied by the client
+      if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, ucIndex))
+      {
+        pTLCb->atlSTAClients[ucIndex].wSTADesc.ucSwFrameTXXlation = 1;
+      }
+      else
+#endif
+        pTLCb->atlSTAClients[ucIndex].wSTADesc.ucSwFrameTXXlation
+                                             = enableFrameXlation;
+    }
+  }
+}
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_StartForwarding
+
+  DESCRIPTION
+
+    This function is used to ask serialization through TX thread of the   
+    cached frame forwarding (if statation has been registered in the mean while) 
+    or flushing (if station has not been registered by the time)
+
+    In case of forwarding, upper layer is only required to call WLANTL_RegisterSTAClient()
+    and doesn't need to call this function explicitly. TL will handle this inside 
+    WLANTL_RegisterSTAClient(). 
+    
+    In case of flushing, upper layer is required to call this function explicitly
+    
+  DEPENDENCIES
+
+    TL must have been initialized before this gets called.
+
+   
+  PARAMETERS
+
+   ucSTAId:   station id 
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+    Please check return values of vos_tx_mq_serialize.
+
+  SIDE EFFECTS
+    If TL was asked to perform WLANTL_CacheSTAFrame() in WLANTL_RxFrames(), 
+    either WLANTL_RegisterSTAClient() or this function must be called 
+    within reasonable time. Otherwise, TL will keep cached vos buffer until
+    one of this function is called, and may end up with system buffer exhasution. 
+
+    It's an upper layer's responsibility to call this function in case of
+    flushing
+
+============================================================================*/
+
+VOS_STATUS 
+WLANTL_StartForwarding
+(
+  v_U8_t ucSTAId,
+  v_U8_t ucUcastSig, 
+  v_U8_t ucBcastSig 
+)
+{
+  vos_msg_t      sMessage;
+  v_U32_t        uData;             
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /* Signal the OS to serialize our event */
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+             "Serializing TL Start Forwarding Cached for control STA %d", 
+              ucSTAId );
+
+  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
+
+  uData = ucSTAId | (ucUcastSig << 8 ) | (ucBcastSig << 16); 
+  sMessage.bodyptr = (v_PVOID_t)uData;
+  sMessage.type    = WLANTL_TX_FWD_CACHED;
+
+  return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
+
+} /* WLANTL_StartForwarding() */
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_AssocFailed
+
+  DESCRIPTION
+
+    This function is used by PE to notify TL that cache needs to flushed' 
+    when association is not successfully completed 
+
+    Internally, TL post a message to TX_Thread to serialize the request to 
+    keep lock-free mechanism.
+
+   
+  DEPENDENCIES
+
+    TL must have been initialized before this gets called.
+
+   
+  PARAMETERS
+
+   ucSTAId:   station id 
+
+  RETURN VALUE
+
+   none
+   
+  SIDE EFFECTS
+   There may be race condition that PE call this API and send another association
+   request immediately with same staId before TX_thread can process the message.
+
+   To avoid this, we might need PE to wait for TX_thread process the message,
+   but this is not currently implemented. 
+   
+============================================================================*/
+void WLANTL_AssocFailed(v_U8_t staId)
+{
+  // flushing frames and forwarding frames uses the same message
+  // the only difference is what happens when the message is processed
+  // if the STA exist, the frames will be forwarded
+  // and if it doesn't exist, the frames will be flushed
+  // in this case we know it won't exist so the DPU index signature values don't matter
+  if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding(staId,0,0)))
+  {
+    VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+       " %s fails to start forwarding", __FUNCTION__);
+  }
+}
+  
+  /*===========================================================================
+
+  FUNCTION  WLANTL_Finish_ULA
+
+  DESCRIPTION
+     This function is used by HDD to notify TL to finish Upper layer authentication
+     incase the last EAPOL packet is pending in the TL queue. 
+     To avoid the race condition between sme set key and the last EAPOL packet 
+     the HDD module calls this function just before calling the sme_RoamSetKey.
+
+  DEPENDENCIES
+
+     TL must have been initialized before this gets called.
+  
+  PARAMETERS
+
+   callbackRoutine:   HDD Callback function.
+   callbackContext : HDD userdata context.
+  
+   RETURN VALUE
+
+   VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
+   
+  SIDE EFFECTS
+   
+============================================================================*/
+
+VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
+                              void *callbackContext)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+   return WDA_DS_FinishULA( callbackRoutine, callbackContext); 
+#else
+   vos_msg_t  vosMsg;   
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   vosMsg.reserved = 0;
+   vosMsg.bodyval  = (v_U32_t)callbackContext;
+   vosMsg.bodyptr = callbackRoutine;
+   vosMsg.type    = WLANSSC_FINISH_ULA;
+   vosStatus = vos_tx_mq_serialize( VOS_MQ_ID_SSC, &vosMsg);
+   return vosStatus;
+#endif
+}
+
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_RegisterSTAClient
+
+  DESCRIPTION
+
+    This function is used by HDD to register as a client for data services
+    with TL. HDD will call this API for each new station that it adds,
+    thus having the flexibility of registering different callback for each
+    STA it services.
+
+  DEPENDENCIES
+
+    TL must have been initialized before this gets called.
+
+    Restriction:
+      Main thread will have higher priority that Tx and Rx threads thus
+      guaranteeing that a station will be added before any data can be
+      received for it. (This enables TL to be lock free)
+
+  PARAMETERS
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+   pfnStARx:        function pointer to the receive packet handler from HDD
+   pfnSTATxComp:    function pointer to the transmit complete confirmation
+                    handler from HDD
+   pfnSTAFetchPkt:  function pointer to the packet retrieval routine in HDD
+   wSTADescType:    STA Descriptor, contains information related to the
+                    new added STA
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL: Input parameters are invalid
+    VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
+                        TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: Station was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RegisterSTAClient
+(
+  v_PVOID_t                 pvosGCtx,
+  WLANTL_STARxCBType        pfnSTARx,
+  WLANTL_TxCompCBType       pfnSTATxComp,
+  WLANTL_STAFetchPktCBType  pfnSTAFetchPkt,
+  WLAN_STADescType*         pwSTADescType,
+  v_S7_t                    rssi
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+#ifdef ANI_CHIPSET_VOLANS
+  v_U8_t    ucTid = 0;/*Local variable to clear previous replay counters of STA on all TIDs*/
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == pwSTADescType ) || ( NULL == pfnSTARx ) ||
+      ( NULL == pfnSTAFetchPkt ))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_RegisterSTAClient"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( pwSTADescType->ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid station id requested on WLANTL_RegisterSTAClient"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 != pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucExists )
+  {
+    pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucExists++;
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Station was already registered on WLANTL_RegisterSTAClient"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Register station with TL
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Registering STA Client ID: %d", pwSTADescType->ucSTAId ));
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].pfnSTARx       = pfnSTARx;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].pfnSTAFetchPkt = pfnSTAFetchPkt;
+
+  /* Only register if different from NULL - TL default Tx Comp Cb will
+    release the vos packet */
+  if ( NULL != pfnSTATxComp )
+  {
+    pTLCb->atlSTAClients[pwSTADescType->ucSTAId].pfnSTATxComp   = pfnSTATxComp;
+  }
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].tlState  = WLANTL_STA_INIT;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].tlPri    =
+                                                    WLANTL_STA_PRI_NORMAL;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucSTAId  =
+    pwSTADescType->ucSTAId;
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d", 
+             pwSTADescType->ucSTAId, 
+              pwSTADescType->ucUcastSig, pwSTADescType->ucBcastSig));
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.wSTAType =
+    pwSTADescType->wSTAType;
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucQosEnabled =
+    pwSTADescType->ucQosEnabled;
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucAddRmvLLC =
+    pwSTADescType->ucAddRmvLLC;
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucProtectedFrame =
+    pwSTADescType->ucProtectedFrame;
+
+#ifdef FEATURE_WLAN_CCX
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucIsCcxSta =
+    pwSTADescType->ucIsCcxSta;
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d CcxSta %d", 
+             pwSTADescType->ucSTAId, 
+             pwSTADescType->ucQosEnabled,
+             pwSTADescType->ucAddRmvLLC,
+             pwSTADescType->ucProtectedFrame,
+             pwSTADescType->ucIsCcxSta));
+#else
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d", 
+             pwSTADescType->ucSTAId, 
+             pwSTADescType->ucQosEnabled,
+             pwSTADescType->ucAddRmvLLC,
+             pwSTADescType->ucProtectedFrame));
+
+#endif //FEATURE_WLAN_CCX
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+  // if this station was not allocated resources to perform HW-based
+  // TX frame translation then force SW-based TX frame translation
+  // otherwise use the frame translation supplied by the client
+
+  if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, pwSTADescType->ucSTAId)
+      || ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType))
+  {
+      pwSTADescType->ucSwFrameTXXlation = 1;
+  }
+#endif
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucSwFrameTXXlation =
+    pwSTADescType->ucSwFrameTXXlation;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucSwFrameRXXlation =
+    pwSTADescType->ucSwFrameRXXlation;
+
+#ifdef FEATURE_WLAN_WAPI
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wSTADesc.ucIsWapiSta =
+    pwSTADescType->ucIsWapiSta;
+#endif /* FEATURE_WLAN_WAPI */
+
+  vos_copy_macaddr( &pTLCb->atlSTAClients[pwSTADescType->ucSTAId].
+                      wSTADesc.vSTAMACAddress, &pwSTADescType->vSTAMACAddress);
+
+  vos_copy_macaddr( &pTLCb->atlSTAClients[pwSTADescType->ucSTAId].
+                      wSTADesc.vBSSIDforIBSS, &pwSTADescType->vBSSIDforIBSS);
+
+  vos_copy_macaddr( &pTLCb->atlSTAClients[pwSTADescType->ucSTAId].
+                 wSTADesc.vSelfMACAddress, &pwSTADescType->vSelfMACAddress);
+
+#ifdef ANI_CHIPSET_VOLANS
+  /* In volans release L replay check is done at TL */
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucIsReplayCheckValid = 
+    pwSTADescType-> ucIsReplayCheckValid;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ulTotalReplayPacketsDetected =  0;
+/*Clear replay counters of the STA on all TIDs*/
+  for(ucTid = 0; ucTid < WLANTL_MAX_TID ; ucTid++)
+  {
+    pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ullReplayCounter[ucTid] =  0;
+  }
+#endif
+
+  /*--------------------------------------------------------------------
+      Set the AC for the registered station to the highest priority AC
+      Even if this AC is not supported by the station, correction will be
+      made in the main TL loop after the supported mask is properly
+      updated in the pending packets call
+    --------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucCurrentAC     = WLANTL_AC_VO;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucCurrentWeight = 0;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucServicedAC    = WLANTL_AC_BK;
+  
+  vos_mem_zero( pTLCb->atlSTAClients[pwSTADescType->ucSTAId].aucACMask,
+                sizeof(pTLCb->atlSTAClients[pwSTADescType->ucSTAId].aucACMask)); 
+
+  vos_mem_zero( &pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wUAPSDInfo,
+           sizeof(pTLCb->atlSTAClients[pwSTADescType->ucSTAId].wUAPSDInfo));
+
+  /*--------------------------------------------------------------------
+    Reordering info and AMSDU de-aggregation
+    --------------------------------------------------------------------*/
+  vos_mem_zero( pTLCb->atlSTAClients[pwSTADescType->ucSTAId].atlBAReorderInfo,
+     sizeof(pTLCb->atlSTAClients[pwSTADescType->ucSTAId].atlBAReorderInfo[0])*
+     WLAN_MAX_TID);
+
+  vos_mem_zero( pTLCb->atlSTAClients[pwSTADescType->ucSTAId].aucMPDUHeader,
+                WLANTL_MPDU_HEADER_LEN);
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucMPDUHeaderLen   = 0;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].vosAMSDUChain     = NULL;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].vosAMSDUChainRoot = NULL;
+
+
+  /*--------------------------------------------------------------------
+    Stats info
+    --------------------------------------------------------------------*/
+  vos_mem_zero( pTLCb->atlSTAClients[pwSTADescType->ucSTAId].auRxCount,
+      sizeof(pTLCb->atlSTAClients[pwSTADescType->ucSTAId].auRxCount[0])*
+      WLAN_MAX_TID);
+
+  vos_mem_zero( pTLCb->atlSTAClients[pwSTADescType->ucSTAId].auTxCount,
+      sizeof(pTLCb->atlSTAClients[pwSTADescType->ucSTAId].auRxCount[0])*
+      WLAN_MAX_TID);
+  /* Initial RSSI is always reported as zero because TL doesnt have enough
+     data to calculate RSSI. So to avoid reporting zero, we are initializing
+     RSSI with RSSI saved in BssDescription during scanning. */
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].rssiAvg = rssi;
+
+  /*Tx not suspended and station fully registered*/
+  vos_atomic_set_U8(
+        &pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucTxSuspended, 0);
+
+  /* Used until multiple station support will be added*/
+  pTLCb->ucRegisteredStaId = pwSTADescType->ucSTAId;
+
+  /* Save the BAP station ID for future usage */
+  if ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType )
+  {
+    pTLCb->tlBAPClient.ucBAPSTAId = pwSTADescType->ucSTAId;
+  }
+
+  /*------------------------------------------------------------------------
+    Statistics info 
+    -----------------------------------------------------------------------*/
+  memset(&pTLCb->atlSTAClients[pwSTADescType->ucSTAId].trafficStatistics,
+         0, sizeof(WLANTL_TRANSFER_STA_TYPE));
+
+
+  /*------------------------------------------------------------------------
+    Start with the state suggested by client caller
+    -----------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].tlState = 
+    pwSTADescType->ucInitState;
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucRxBlocked = 1; 
+  /*-----------------------------------------------------------------------
+    After all the init is complete we can mark the existance flag 
+    ----------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucExists++;
+
+#ifdef WLAN_SOFTAP_FEATURE
+  //flow control fields init
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucLwmModeEnabled = FALSE;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].ucLwmEventReported = FALSE;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].bmuMemConsumed = 0;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].uIngress_length = 0;
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX;
+
+  pTLCb->atlSTAClients[pwSTADescType->ucSTAId].uLwmThreshold = WLANTL_STA_BMU_THRESHOLD_MAX / 3;
+
+  //@@@ HDDSOFTAP does not queue unregistered packet for now
+  if ( WLAN_STA_SOFTAP != pwSTADescType->wSTAType )
+  { 
+#endif
+    /*------------------------------------------------------------------------
+      Forward received frames while STA was not yet registered 
+    -  ----------------------------------------------------------------------*/
+    if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding( pwSTADescType->ucSTAId, 
+                              pwSTADescType->ucUcastSig, 
+                              pwSTADescType->ucBcastSig)))
+    {
+      VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         " %s fails to start forwarding", __FUNCTION__);
+    }
+#ifdef WLAN_SOFTAP_FEATURE
+  }
+#endif
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RegisterSTAClient */
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_ClearSTAClient
+
+  DESCRIPTION
+
+    HDD will call this API when it no longer needs data services for the
+    particular station.
+
+  DEPENDENCIES
+
+    A station must have been registered before the clear registration is
+    called.
+
+  PARAMETERS
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+   ucSTAId:         identifier for the STA to be cleared
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
+                        TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: Station was not registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ClearSTAClient
+(
+  v_PVOID_t         pvosGCtx,
+  v_U8_t            ucSTAId
+)
+{
+  WLANTL_CbType*  pTLCb = NULL; 
+  v_U8_t  ucIndex;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+           "WLAN TL:Invalid station id requested on WLANTL_ClearSTAClient"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+       "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ClearSTAClient"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Station was not previously registered on WLANTL_ClearSTAClient"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /* Delete BA sessions on all TID's */
+  for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++) 
+  {
+     WLANTL_BaSessionDel (pvosGCtx, ucSTAId, ucIndex);
+  }
+
+  /*------------------------------------------------------------------------
+    Clear station
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Clearing STA Client ID: %d", ucSTAId ));
+  WLANTL_CleanSTA(&pTLCb->atlSTAClients[ucSTAId], 1 /*empty packets*/);
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Clearing STA Reset History RSSI and Region number"));
+  pTLCb->hoSupport.currentHOState.historyRSSI = 0;
+  pTLCb->hoSupport.currentHOState.regionNumber = 0;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ClearSTAClient */
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_ChangeSTAState
+
+  DESCRIPTION
+
+    HDD will make this notification whenever a change occurs in the
+    connectivity state of a particular STA.
+
+  DEPENDENCIES
+
+    A station must have been registered before the change state can be
+    called.
+
+    RESTRICTION: A station is being notified as authenticated before the
+                 keys are installed in HW. This way if a frame is received
+                 before the keys are installed DPU will drop that frame.
+
+    Main thread has higher priority that Tx and Rx threads thus guaranteeing
+    the following:
+        - a station will be in assoc state in TL before TL receives any data
+          for it
+
+  PARAMETERS
+
+   pvosGCtx:        pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+   ucSTAId:         identifier for the STA that is pending transmission
+   tlSTAState:     the new state of the connection to the given station
+
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer to
+                         TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: Station was not registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ChangeSTAState
+(
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  WLANTL_STAStateType   tlSTAState
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( tlSTAState >= WLANTL_STA_MAX_STATE )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+     "WLAN TL:Station was not previously registered on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Change STA state
+    No need to lock this operation, see restrictions above
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Changing state for STA Client ID: %d from %d to %d",
+             ucSTAId, pTLCb->atlSTAClients[ucSTAId].tlState, tlSTAState));
+
+  pTLCb->atlSTAClients[ucSTAId].tlState = tlSTAState;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ChangeSTAState */
+
+/*===========================================================================
+
+  FUNCTION    WLANTL_STAPktPending
+
+  DESCRIPTION
+
+    HDD will call this API when a packet is pending transmission in its
+    queues.
+
+  DEPENDENCIES
+
+    A station must have been registered before the packet pending
+    notification can be sent.
+
+    RESTRICTION: TL will not count packets for pending notification.
+                 HDD is expected to send the notification only when
+                 non-empty event gets triggered. Worst case scenario
+                 is that TL might end up making a call when Hdds
+                 queues are actually empty.
+
+  PARAMETERS
+
+    pvosGCtx:    pointer to the global vos context; a handle to TL's
+                 control block can be extracted from its context
+    ucSTAId:     identifier for the STA that is pending transmission
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer
+                         to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: Station was not registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STAPktPending
+(
+  v_PVOID_t            pvosGCtx,
+  v_U8_t               ucSTAId,
+  WLANTL_ACEnumType    ucAc
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+#ifdef WLAN_SOFTAP_FEATURE
+  vos_msg_t      vosMsg;
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+      "WLAN TL:Packet pending indication for STA: %d AC: %d", ucSTAId, ucAc);
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid station id requested on WLANTL_STAPktPending"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Station was not previously registered on WLANTL_STAPktPending"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*---------------------------------------------------------------------
+    Temporary fix to enable TL to fetch packets when multiple peers join
+    an IBSS. To fix CR177301. Needs to go away when the actual fix of
+    going through all STA's in round robin fashion gets merged in from
+    BT AMP branch.
+    --------------------------------------------------------------------*/
+  pTLCb->ucRegisteredStaId = ucSTAId;
+
+  /*-----------------------------------------------------------------------
+    Enable this AC in the AC mask in order for TL to start servicing it
+    Set packet pending flag 
+    To avoid race condition, serialize the updation of AC and AC mask 
+    through WLANTL_TX_STAID_AC_IND message.
+  -----------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+    if (WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType)
+    {
+#endif
+
+      pTLCb->atlSTAClients[ucSTAId].aucACMask[ucAc] = 1; 
+
+      vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
+
+      /*------------------------------------------------------------------------
+        Check if there are enough resources for transmission and tx is not
+        suspended.
+        ------------------------------------------------------------------------*/
+       if (( pTLCb->uResCount >=  WDA_TLI_MIN_RES_DATA ) &&
+          ( 0 == pTLCb->ucTxSuspended ))
+      {
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "Issuing Xmit start request to BAL"));
+           WDA_DS_StartXmit(pvosGCtx);
+      }
+      else
+      {
+        /*---------------------------------------------------------------------
+          No error code is sent because TL will resume tx autonomously if
+          resources become available or tx gets resumed
+          ---------------------------------------------------------------------*/
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d",
+              pTLCb->uResCount, pTLCb->ucTxSuspended ));
+      }
+#ifdef WLAN_SOFTAP_FEATURE
+    }
+    else
+    {
+      vosMsg.reserved = 0;
+      vosMsg.bodyval  = 0;
+      vosMsg.bodyval = (ucAc | (ucSTAId << WLANTL_STAID_OFFSET));
+      vosMsg.type     = WLANTL_TX_STAID_AC_IND;
+      return vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg);
+    }
+#endif
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STAPktPending */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_SetSTAPriority
+
+  DESCRIPTION
+
+    TL exposes this API to allow upper layers a rough control over the
+    priority of transmission for a given station when supporting multiple
+    connections.
+
+  DEPENDENCIES
+
+    A station must have been registered before the change in priority can be
+    called.
+
+  PARAMETERS
+
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucSTAId:        identifier for the STA that has to change priority
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer
+                         to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: Station was not registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_SetSTAPriority
+(
+  v_PVOID_t            pvosGCtx,
+  v_U8_t               ucSTAId,
+  WLANTL_STAPriorityType   tlSTAPri
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid station id requested on WLANTL_SetSTAPriority"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SetSTAPriority"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Station was not previously registered on WLANTL_SetSTAPriority"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Re-analize if lock is needed when adding multiple stations
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Changing state for STA Pri ID: %d from %d to %d",
+             ucSTAId, pTLCb->atlSTAClients[ucSTAId].tlPri, tlSTAPri));
+  pTLCb->atlSTAClients[ucSTAId].tlPri = tlSTAPri;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_SetSTAPriority */
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH BAP
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RegisterBAPClient
+
+  DESCRIPTION
+    Called by SME to register itself as client for non-data BT-AMP packets.
+
+  DEPENDENCIES
+    TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or SME's control block can be extracted from its context
+    pfnTlBAPRxFrm:  pointer to the receive processing routine for non-data
+                    BT-AMP packets
+    pfnFlushOpCompleteCb:
+                    pointer to the call back function, for the Flush operation
+                    completion.
+
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer
+                         to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: BAL client was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RegisterBAPClient
+(
+  v_PVOID_t              pvosGCtx,
+  WLANTL_BAPRxCBType     pfnTlBAPRxFrm,
+  WLANTL_FlushOpCompCBType  pfnFlushOpCompleteCb
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pfnTlBAPRxFrm )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_RegisterBAPClient"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( NULL == pfnFlushOpCompleteCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "Invalid Flush Complete Cb parameter sent on WLANTL_RegisterBAPClient"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterBAPClient"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Make sure this is the first registration attempt
+   ------------------------------------------------------------------------*/
+  if ( 0 != pTLCb->tlBAPClient.ucExists )
+  {
+    pTLCb->tlBAPClient.ucExists++;
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:BAP client was already registered"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Register station with TL
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Registering BAP Client" ));
+
+  pTLCb->tlBAPClient.ucExists++;
+
+  if ( NULL != pfnTlBAPRxFrm ) 
+  {
+    pTLCb->tlBAPClient.pfnTlBAPRx             = pfnTlBAPRxFrm;
+  }
+
+  pTLCb->tlBAPClient.pfnFlushOpCompleteCb   = pfnFlushOpCompleteCb;
+
+  pTLCb->tlBAPClient.vosPendingDataBuff     = NULL;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RegisterBAPClient */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxBAPFrm
+
+  DESCRIPTION
+    BAP calls this when it wants to send a frame to the module
+
+  DEPENDENCIES
+    BAP must be registered with TL before this function can be called.
+
+    RESTRICTION: BAP CANNOT push any packets to TL until it did not receive
+                 a tx complete from the previous packet, that means BAP
+                 sends one packet, wait for tx complete and then
+                 sends another one
+
+                 If BAP sends another packet before TL manages to process the
+                 previously sent packet call will end in failure
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or BAP's control block can be extracted from its context
+    vosDataBuff:   pointer to the vOSS buffer containing the packet to be
+                    transmitted
+    pMetaInfo:      meta information about the packet
+    pfnTlBAPTxComp: pointer to a transmit complete routine for notifying
+                    the result of the operation over the bus
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_E_EXISTS: BAL client was not yet registered
+    VOS_STATUS_E_BUSY:   The previous BT-AMP packet was not yet transmitted
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+    Other failure messages may be returned from the BD header handling
+    routines, please check apropriate API for more info.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxBAPFrm
+(
+  v_PVOID_t               pvosGCtx,
+  vos_pkt_t*              vosDataBuff,
+  WLANTL_MetaInfoType*    pMetaInfo,
+  WLANTL_TxCompCBType     pfnTlBAPTxComp
+)
+{
+  WLANTL_CbType*  pTLCb      = NULL;
+  VOS_STATUS      vosStatus  = VOS_STATUS_SUCCESS;
+  v_MACADDR_t     vDestMacAddr;
+  v_U16_t         usPktLen;
+  v_U8_t          ucStaId = 0;
+  v_U8_t          extraHeadSpace = 0;
+  v_U8_t          ucWDSEnabled = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxBAPFrm"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Ensure that BAP client was registered previously
+   ------------------------------------------------------------------------*/
+  if (( 0 == pTLCb->tlBAPClient.ucExists ) ||
+      ( WLANTL_STA_ID_INVALID(pTLCb->tlBAPClient.ucBAPSTAId) ))
+  {
+    pTLCb->tlBAPClient.ucExists++;
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:BAP client not register on WLANTL_TxBAPFrm"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+   Check if any BT-AMP Frm is pending
+  ------------------------------------------------------------------------*/
+  if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:BT-AMP Frame already pending tx in TL on WLANTL_TxBAPFrm"));
+    return VOS_STATUS_E_BUSY;
+  }
+
+  /*------------------------------------------------------------------------
+    Save buffer and notify BAL; no lock is needed if the above restriction
+    is met
+    Save the tx complete fnct pointer as tl specific data in the vos buffer
+   ------------------------------------------------------------------------*/
+
+  /*------------------------------------------------------------------------
+    Translate 802.3 frame to 802.11
+   ------------------------------------------------------------------------*/
+  ucStaId = pTLCb->tlBAPClient.ucBAPSTAId;
+  if (( 0 == pMetaInfo->ucDisableFrmXtl ) &&
+      ( 0 != pTLCb->atlSTAClients[ucStaId].wSTADesc.ucSwFrameTXXlation ))
+  {
+    vosStatus = WLANTL_Translate8023To80211Header(vosDataBuff, &vosStatus,
+                                                  pTLCb, ucStaId,
+                                                  pMetaInfo->ucUP, &ucWDSEnabled, &extraHeadSpace);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Error when translating header WLANTL_TxBAPFrm"));
+
+      return vosStatus;
+    }
+
+    pMetaInfo->ucDisableFrmXtl = 1;
+  }
+
+  /*-------------------------------------------------------------------------
+    Call HAL to fill BD header
+   -------------------------------------------------------------------------*/
+
+  /* Adding Type, SubType which was missing for EAPOL from BAP */
+  pMetaInfo->ucType |= (WLANTL_80211_DATA_TYPE << 4);
+  pMetaInfo->ucType |= (WLANTL_80211_DATA_QOS_SUBTYPE);
+
+  vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , 
+                    &vDestMacAddr, pMetaInfo->ucDisableFrmXtl, 
+                    &usPktLen, pTLCb->atlSTAClients[ucStaId].wSTADesc.ucQosEnabled, 
+                    ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType,
+                            &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSelfMACAddress,
+                    pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp,
+                    pMetaInfo->ucIsEapol, pMetaInfo->ucUP );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Failed while building TX header %d", vosStatus));
+    return vosStatus;
+  }
+
+  if ( NULL != pfnTlBAPTxComp )
+  {
+    vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)pfnTlBAPTxComp);
+  }
+  else
+  {
+    vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)WLANTL_TxCompDefaultCb);
+
+  }
+
+  vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
+                      (v_U32_t)vosDataBuff);
+
+  /*------------------------------------------------------------------------
+    Check if thre are enough resources for transmission and tx is not
+    suspended.
+   ------------------------------------------------------------------------*/
+  if (( pTLCb->uResCount >=  WDA_TLI_MIN_RES_BAP ) &&
+      ( 0 == pTLCb->ucTxSuspended ))
+  {
+    WDA_DS_StartXmit(pvosGCtx);
+  }
+  else
+  {
+    /*---------------------------------------------------------------------
+      No error code is sent because TL will resume tx autonomously if
+      resources become available or tx gets resumed
+     ---------------------------------------------------------------------*/
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+          "WLAN TL:Request to send from BAP but condition not met.Res: %d,"
+                 "Suspend: %d", pTLCb->uResCount, pTLCb->ucTxSuspended ));
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_TxBAPFrm */
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH SME
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetRssi
+
+  DESCRIPTION
+    TL will extract the RSSI information from every data packet from the
+    ongoing traffic and will store it. It will provide the result to SME
+    upon request.
+
+  DEPENDENCIES
+
+    WARNING: the read and write of this value will not be protected
+             by locks, therefore the information obtained after a read
+             might not always be consistent.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or SME's control block can be extracted from its context
+    ucSTAId:        station identifier for the requested value
+
+    OUT
+    puRssi:         the average value of the RSSI
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer
+                         to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: STA was not yet registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetRssi
+(
+  v_PVOID_t        pvosGCtx,
+  v_U8_t           ucSTAId,
+  v_S7_t*          pRssi
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pRssi )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_GetRssi"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid station id requested on WLANTL_GetRssi"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRssi"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Station was not previously registered on WLANTL_GetRssi"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Copy will not be locked; please read restriction
+   ------------------------------------------------------------------------*/
+  if(pTLCb->isBMPS)
+  {
+    *pRssi = pTLCb->atlSTAClients[ucSTAId].rssiAvgBmps;
+    /* Check If RSSI is zero because we are reading rssAvgBmps updated by HAL in 
+    previous GetStatsRequest. It may be updated as zero by Hal because EnterBmps 
+    might not have happend by that time. Hence reading the most recent Rssi 
+    calcluated by TL*/
+    if(0 == *pRssi)
+    {
+      *pRssi = pTLCb->atlSTAClients[ucSTAId].rssiAvg;
+    }
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                                 "WLAN TL:bmpsRssi %d \n",*pRssi));
+  }
+  else
+  {
+    *pRssi = pTLCb->atlSTAClients[ucSTAId].rssiAvg;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d", ucSTAId, *puRssi));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_GetRssi */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetLinkQuality
+
+  DESCRIPTION
+    TL will extract the SNR information from every data packet from the
+    ongoing traffic and will store it. It will provide the result to SME
+    upon request.
+
+  DEPENDENCIES
+
+    WARNING: the read and write of this value will not be protected
+             by locks, therefore the information obtained after a read
+             might not always be consistent.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or SME's control block can be extracted from its context
+    ucSTAId:        station identifier for the requested value
+
+    OUT
+    puLinkQuality:         the average value of the SNR
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer
+                         to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS: STA was not yet registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetLinkQuality
+(
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  v_U32_t*              puLinkQuality
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == puLinkQuality )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid parameter sent on WLANTL_GetLinkQuality"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid station id requested on WLANTL_GetLinkQuality"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid TL pointer from pvosGCtx on WLANTL_GetLinkQuality"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Station was not previously registered on WLANTL_GetLinkQuality"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Copy will not be locked; please read restriction
+   ------------------------------------------------------------------------*/
+  *puLinkQuality = pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg;
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLANTL_GetLinkQuality for STA: %d LinkQuality: %d", ucSTAId, *puLinkQuality));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_GetLinkQuality */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_FlushStaTID
+
+  DESCRIPTION
+    TL provides this API as an interface to SME (BAP) layer. TL inturn posts a
+    message to HAL. This API is called by the SME inorder to perform a flush
+    operation.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or SME's control block can be extracted from its context
+    ucSTAId:        station identifier for the requested value
+    ucTid:          Tspec ID for the new BA session
+
+    OUT
+    The response for this post is received in the main thread, via a response
+    message from HAL to TL.
+
+  RETURN VALUE
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+WLANTL_FlushStaTID
+(
+  v_PVOID_t             pvosGCtx,
+  v_U8_t                ucSTAId,
+  v_U8_t                ucTid
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  tpFlushACReq FlushACReqPtr = NULL;
+  vos_msg_t vosMessage;
+
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid station id requested on WLANTL_FlushStaTID"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Invalid TL pointer from pvosGCtx on WLANTL_FlushStaTID"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "Station was not previously registered on WLANTL_FlushStaTID"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+  We need to post a message with the STA, TID value to HAL. HAL performs the flush
+  ------------------------------------------------------------------------*/
+  FlushACReqPtr = vos_mem_malloc(sizeof(tFlushACReq));
+
+  if ( NULL == FlushACReqPtr )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL: fatal failure, cannot allocate Flush Req structure"));
+    VOS_ASSERT(0);
+    return VOS_STATUS_E_NOMEM;
+  }
+
+  // Start constructing the message for HAL
+  FlushACReqPtr->mesgType    = SIR_TL_HAL_FLUSH_AC_REQ;
+  FlushACReqPtr->mesgLen     = sizeof(tFlushACReq);
+  FlushACReqPtr->mesgLen     = sizeof(tFlushACReq);
+  FlushACReqPtr->ucSTAId = ucSTAId;
+  FlushACReqPtr->ucTid = ucTid;
+
+  vosMessage.type            = WDA_TL_FLUSH_AC_REQ;
+  vosMessage.bodyptr = (void *)FlushACReqPtr;
+
+  vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
+  return VOS_STATUS_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH PE
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RegisterMgmtFrmClient
+
+  DESCRIPTION
+    Called by PE to register as a client for management frames delivery.
+
+  DEPENDENCIES
+    TL must be initialized before this API can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:           pointer to the global vos context; a handle to
+                        TL's control block can be extracted from its context
+    pfnTlMgmtFrmRx:     pointer to the receive processing routine for
+                        management frames
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RegisterMgmtFrmClient
+(
+  v_PVOID_t               pvosGCtx,
+  WLANTL_MgmtFrmRxCBType  pfnTlMgmtFrmRx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pfnTlMgmtFrmRx )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+           "WLAN TL:Invalid parameter sent on WLANTL_RegisterMgmtFrmClient"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Make sure this is the first registration attempt
+   ------------------------------------------------------------------------*/
+  if ( 0 != pTLCb->tlMgmtFrmClient.ucExists )
+  {
+    pTLCb->tlMgmtFrmClient.ucExists++;
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Management frame client was already registered"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Register station with TL
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN TL:Registering Management Frame Client" ));
+
+  pTLCb->tlMgmtFrmClient.ucExists++;
+
+  if ( NULL != pfnTlMgmtFrmRx )
+  {
+    pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = pfnTlMgmtFrmRx;
+  }
+
+  pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RegisterMgmtFrmClient */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_DeRegisterMgmtFrmClient
+
+  DESCRIPTION
+    Called by PE to deregister as a client for management frames delivery.
+
+  DEPENDENCIES
+    TL must be initialized before this API can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:           pointer to the global vos context; a handle to
+                        TL's control block can be extracted from its context
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_DeRegisterMgmtFrmClient
+(
+  v_PVOID_t               pvosGCtx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Make sure this is the first registration attempt
+   ------------------------------------------------------------------------*/
+  if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Management frame client was never registered"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Clear registration with TL
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN TL:Deregistering Management Frame Client" ));
+
+  pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
+  if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff)
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+              "WLAN TL:Management cache buffer not empty on deregistering"
+               " - dropping packet" ));
+    vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
+
+    pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL; 
+  }
+
+  pTLCb->tlMgmtFrmClient.ucExists = 0;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RegisterMgmtFrmClient */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxMgmtFrm
+
+  DESCRIPTION
+    Called by PE when it want to send out a management frame.
+    HAL will also use this API for the few frames it sends out, they are not
+    management frames howevere it is accepted that an exception will be
+    allowed ONLY for the usage of HAL.
+    Generic data frames SHOULD NOT travel through this function.
+
+  DEPENDENCIES
+    TL must be initialized before this API can be called.
+
+    RESTRICTION: If PE sends another packet before TL manages to process the
+                 previously sent packet call will end in failure
+
+                 Frames comming through here must be 802.11 frames, frame
+                 translation in UMA will be automatically disabled.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context;a handle to TL's
+                    control block can be extracted from its context
+    vosFrmBuf:      pointer to a vOSS buffer containing the management
+                    frame to be transmitted
+    usFrmLen:       the length of the frame to be transmitted; information
+                    is already included in the vOSS buffer
+    wFrmType:       the type of the frame being transmitted
+    tid:            tid used to transmit this frame
+    pfnCompTxFunc:  function pointer to the transmit complete routine
+    pvBDHeader:     pointer to the BD header, if NULL it means it was not
+                    yet constructed and it lies within TL's responsibility
+                    to do so; if not NULL it is expected that it was
+                    already packed inside the vos packet
+    ucAckResponse:  flag notifying it an interrupt is needed for the
+                    acknowledgement received when the frame is sent out
+                    the air and ; the interrupt will be processed by HAL,
+                    only one such frame can be pending in the system at
+                    one time.
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:  Input parameters are invalid
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered
+    VOS_STATUS_E_BUSY:   The previous Mgmt packet was not yet transmitted
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+    Other failure messages may be returned from the BD header handling
+    routines, please check apropriate API for more info.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxMgmtFrm
+(
+  v_PVOID_t            pvosGCtx,
+  vos_pkt_t*           vosFrmBuf,
+  v_U16_t              usFrmLen,
+  v_U8_t               wFrmType,
+  v_U8_t               ucTid,
+  WLANTL_TxCompCBType  pfnCompTxFunc,
+  v_PVOID_t            pvBDHeader,
+  v_U8_t               ucAckResponse
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  v_MACADDR_t     vDestMacAddr;
+  VOS_STATUS      vosStatus = VOS_STATUS_SUCCESS;
+  v_U16_t         usPktLen;
+  v_U32_t         usTimeStamp = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == vosFrmBuf )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_TxMgmtFrm"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxMgmtFrm"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Ensure that management frame client was previously registered
+   ------------------------------------------------------------------------*/
+  if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
+  {
+    pTLCb->tlMgmtFrmClient.ucExists++;
+    TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+          "WLAN TL:Management Frame client not register on WLANTL_TxMgmtFrm"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+   /*------------------------------------------------------------------------
+    Check if any Mgmt Frm is pending
+   ------------------------------------------------------------------------*/
+  //vosTempBuff = pTLCb->tlMgmtFrmClient.vosPendingDataBuff;
+  if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
+  {
+
+    TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+        "WLAN TL:Management Frame already pending tx in TL: failing old one"));
+
+
+    /*Failing the tx for the previous packet enqued by PE*/
+    //vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
+    //                    (v_U32_t)NULL);
+
+    //vos_pkt_get_user_data_ptr( vosTempBuff, VOS_PKT_USER_DATA_ID_TL,
+    //                           (v_PVOID_t)&pfnTxComp);
+
+    /*it should never be NULL - default handler should be registered if none*/
+    //if ( NULL == pfnTxComp )
+    //{
+    //  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    //            "NULL pointer to Tx Complete on WLANTL_TxMgmtFrm");
+    //  VOS_ASSERT(0);
+    //  return VOS_STATUS_E_FAULT;
+    //}
+
+    //pfnTxComp( pvosGCtx, vosTempBuff, VOS_STATUS_E_RESOURCES );
+    //return VOS_STATUS_E_BUSY;
+
+
+    //pfnCompTxFunc( pvosGCtx, vosFrmBuf, VOS_STATUS_E_RESOURCES);
+    return VOS_STATUS_E_RESOURCES;
+  }
+
+
+  /*------------------------------------------------------------------------
+    Check if BD header was build, if not construct
+   ------------------------------------------------------------------------*/
+  if ( NULL == pvBDHeader )
+  {
+     v_MACADDR_t*     pvAddr2MacAddr;
+     v_U8_t   uQosHdr = VOS_FALSE;
+
+     /* Get address 2 of Mangement Frame to give to WLANHAL_FillTxBd */
+     vosStatus = vos_pkt_peek_data( vosFrmBuf, 
+                                    WLANTL_MAC_ADDR_ALIGN(1) + VOS_MAC_ADDR_SIZE,
+                                    (v_PVOID_t)&pvAddr2MacAddr, VOS_MAC_ADDR_SIZE);
+
+     if ( VOS_STATUS_SUCCESS != vosStatus )
+     {
+       TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+                "WLAN TL:Failed while attempting to get addr2 %d", vosStatus));
+       return vosStatus;
+     }
+#ifdef FEATURE_WLAN_CCX
+    /* CCX IAPP Frame which are data frames but technically used
+     * for management functionality comes through route.
+     */
+    if (WLANTL_IS_QOS_DATA_FRAME(wFrmType))                                      \
+    {
+        uQosHdr = VOS_TRUE;
+    }
+#endif
+    /*----------------------------------------------------------------------
+      Call WDA to build TX header
+     ----------------------------------------------------------------------*/
+    vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr, 
+                   1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/, 
+                   0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid, 
+                   ucAckResponse, usTimeStamp, 0, 0 );
+
+
+    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+    {
+      TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+                "WLAN TL:Failed while attempting to build TX header %d", vosStatus));
+      return vosStatus;
+    }
+   }/* if BD header not present */
+
+  /*------------------------------------------------------------------------
+    Save buffer and notify BAL; no lock is needed if the above restriction
+    is met
+    Save the tx complete fnct pointer as tl specific data in the vos buffer
+   ------------------------------------------------------------------------*/
+  if ( NULL != pfnCompTxFunc )
+  {
+    vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)pfnCompTxFunc);
+  }
+  else
+  {
+    vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)WLANTL_TxCompDefaultCb);
+
+  }
+
+  vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
+                      (v_U32_t)vosFrmBuf);
+
+  /*------------------------------------------------------------------------
+    Check if thre are enough resources for transmission and tx is not
+    suspended.
+   ------------------------------------------------------------------------*/
+  if ( pTLCb->uResCount >=  WDA_TLI_MIN_RES_MF )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:Issuing Xmit start request to BAL for MGMT"));
+    vosStatus = WDA_DS_StartXmit(pvosGCtx);
+    if(VOS_STATUS_SUCCESS != vosStatus)
+    {
+       TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+              "WLAN TL:WDA_DS_StartXmit fails. vosStatus %d", vosStatus));
+       vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,0); 
+    }
+    return vosStatus;
+    
+  }
+  else
+  {
+    /*---------------------------------------------------------------------
+      No error code is sent because TL will resume tx autonomously if
+      resources become available or tx gets resumed
+     ---------------------------------------------------------------------*/
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+       "WLAN TL:Request to send for Mgmt Frm but condition not met. Res: %d",
+               pTLCb->uResCount));
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_TxMgmtFrm */
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH HAL
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ResetNotification
+
+  DESCRIPTION
+    HAL notifies TL when the module is being reset.
+    Currently not used.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
+                         page fault
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ResetNotification
+(
+  v_PVOID_t   pvosGCtx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResetNotification"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  WLANTL_CleanCB(pTLCb, 1 /*empty all queues and pending packets*/);
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ResetNotification */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_SuspendDataTx
+
+  DESCRIPTION
+    HAL calls this API when it wishes to suspend transmission for a
+    particular STA.
+
+  DEPENDENCIES
+    The STA for which the request is made must be first registered with
+    TL by HDD.
+
+    RESTRICTION:  In case of a suspend, the flag write and read will not be
+                  locked: worst case scenario one more packet can get
+                  through before the flag gets updated (we can make this
+                  write atomic as well to guarantee consistency)
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    pucSTAId:       identifier of the station for which the request is made;
+                    a value of NULL assumes suspend on all active station
+    pfnSuspendTxCB: pointer to the suspend result notification in case the
+                    call is asynchronous
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer
+                          to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS:  Station was not registered
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+WLANTL_SuspendDataTx
+(
+  v_PVOID_t              pvosGCtx,
+  v_U8_t*                pucSTAId,
+  WLANTL_SuspendCBType   pfnSuspendTx
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  vos_msg_t       vosMsg;
+  v_U8_t          ucTxSuspendReq, ucTxSuspended;
+  v_U32_t         STAId = 0;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb || NULL == pucSTAId )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Check the type of request: generic suspend, or per station suspend
+   ------------------------------------------------------------------------*/
+  /* Station IDs for Suspend request are received as bitmap                  */
+  ucTxSuspendReq = *pucSTAId;
+  ucTxSuspended = pTLCb->ucTxSuspended;
+
+  if (WLAN_ALL_STA == ucTxSuspended)
+  {
+    /* All Stations are in Suspend mode. Nothing to do */
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:All stations already suspended"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  if (WLAN_ALL_STA == *pucSTAId)
+  {
+    /* General Suspend Request received */
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:General suspend requested"));
+    vos_atomic_set_U8( &pTLCb->ucTxSuspended, WLAN_ALL_STA);
+    vosMsg.reserved = WLAN_MAX_STA_COUNT;
+  }
+  else
+  {
+    /* Station specific Suspend Request received */
+    /* Update Station Id Bit map for suspend request */
+    do
+    {
+       /* If Bit set for this station with STAId */
+      if (ucTxSuspendReq >> (STAId +1) )
+      {
+        /* If it is Not a valid station ID */
+        if ( WLANTL_STA_ID_INVALID( STAId ) )
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Invalid station id requested on WLANTL_SuspendDataTx"));
+          STAId++;
+          continue;
+        }
+        /* If this station is Not registered with TL */
+        if ( 0 == pTLCb->atlSTAClients[STAId].ucExists )
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Station was not previously registered on WLANTL_SuspendDataTx"));
+          STAId++;
+          continue;
+        }
+
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Suspend request for station: %d", STAId));
+        vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId].ucTxSuspended, 1);
+      }
+      STAId++;
+    } while ( STAId < WLAN_MAX_STA_COUNT );
+    vosMsg.reserved = *pucSTAId;
+  }
+
+  /*------------------------------------------------------------------------
+    Serialize request through TX thread
+   ------------------------------------------------------------------------*/
+  vosMsg.type     = WLANTL_TX_SIG_SUSPEND;
+  vosMsg.bodyptr     = (v_PVOID_t)pfnSuspendTx;
+
+  if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
+  {
+    VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+       " %s fails to post message", __FUNCTION__);
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_SuspendDataTx */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ResumeDataTx
+
+  DESCRIPTION
+    Called by HAL to resume data transmission for a given STA.
+
+    WARNING: If a station was individually suspended a global resume will
+             not resume that station
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    pucSTAId:       identifier of the station which is being resumed; NULL
+                    translates into global resume
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer
+                          to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS:  Station was not registered
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+WLANTL_ResumeDataTx
+(
+  v_PVOID_t      pvosGCtx,
+  v_U8_t*        pucSTAId
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  v_U8_t          ucTxResumeReq;
+  v_U32_t         STAId = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb || NULL == pucSTAId)
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+           "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResumeDataTx"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  ucTxResumeReq = *pucSTAId;
+  /*------------------------------------------------------------------------
+    Check to see the type of resume
+   ------------------------------------------------------------------------*/
+  if ( WLAN_ALL_STA == *pucSTAId)
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:General resume requested"));
+    vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
+
+    /* Set to Resume for all stations */
+    for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
+         vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId].ucTxSuspended, 0);
+  }
+  else
+  {
+    do
+    {
+      /* If Bit Set for this station with STAId */
+      if (ucTxResumeReq >> (STAId + 1))
+      {
+        /* If it is Not a valid station ID */
+        if ( WLANTL_STA_ID_INVALID( STAId ))
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Invalid station id requested on WLANTL_ResumeDataTx"));
+          STAId++;
+          continue;
+        }
+        /* If this station is Not registered with TL */
+        if ( 0 == pTLCb->atlSTAClients[STAId].ucExists )
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Station was not previously registered on WLANTL_ResumeDataTx"));
+          STAId++;
+          continue;
+        }
+
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Resume request for station: %d", STAId));
+        vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId].ucTxSuspended, 0);
+      }
+      STAId++;
+    } while ( STAId < WLAN_MAX_STA_COUNT );
+  }
+
+  /*------------------------------------------------------------------------
+    Resuming transmission
+   ------------------------------------------------------------------------*/
+  if ( pTLCb->uResCount >=  WDA_TLI_MIN_RES_MF )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Resuming transmission"));
+    return WDA_DS_StartXmit(pvosGCtx);
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ResumeDataTx */
+
+/*==========================================================================
+  FUNCTION    WLANTL_SuspendCB
+
+  DESCRIPTION
+    Callback function for serializing Suspend signal through Tx thread
+
+  DEPENDENCIES
+    Just notify HAL that suspend in TL is complete.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   pUserData:      user data sent with the callback
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_SuspendCB
+(
+  v_PVOID_t             pvosGCtx,
+  WLANTL_SuspendCBType  pfnSuspendCB,
+  v_U16_t               usReserved
+)
+{
+  WLANTL_CbType*  pTLCb   = NULL;
+  v_U8_t          ucSTAId = (v_U8_t)usReserved;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pfnSuspendCB )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL: No Call back processing requested WLANTL_SuspendCB"));
+    return VOS_STATUS_SUCCESS;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendCB"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    pfnSuspendCB(pvosGCtx, NULL, VOS_STATUS_SUCCESS);
+  }
+  else
+  {
+    pfnSuspendCB(pvosGCtx, &ucSTAId, VOS_STATUS_SUCCESS);
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/*WLANTL_SuspendCB*/
+
+
+/*----------------------------------------------------------------------------
+    CLIENT INDEPENDENT INTERFACE
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetTxPktCount
+
+  DESCRIPTION
+    TL will provide the number of transmitted packets counted per
+    STA per TID.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucSTAId:        identifier of the station
+    ucTid:          identifier of the tspec
+
+    OUT
+    puTxPktCount:   the number of packets tx packet for this STA and TID
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer
+                          to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS:  Station was not registered
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetTxPktCount
+(
+  v_PVOID_t      pvosGCtx,
+  v_U8_t         ucSTAId,
+  v_U8_t         ucTid,
+  v_U32_t*       puTxPktCount
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == puTxPktCount )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_GetTxPktCount"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetTxPktCount",
+            ucSTAId, ucTid));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check if station exists
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetTxPktCount"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Station was not previously registered on WLANTL_GetTxPktCount %d",
+     ucSTAId));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Return data
+   ------------------------------------------------------------------------*/
+  //VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
+    //         "WLAN TL:Requested tx packet count for STA: %d, TID: %d", 
+      //         ucSTAId, ucTid);
+
+  *puTxPktCount = pTLCb->atlSTAClients[ucSTAId].auTxCount[ucTid];
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_GetTxPktCount */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetRxPktCount
+
+  DESCRIPTION
+    TL will provide the number of received packets counted per
+    STA per TID.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucSTAId:        identifier of the station
+    ucTid:          identifier of the tspec
+
+   OUT
+    puTxPktCount:   the number of packets rx packet for this STA and TID
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   Station ID is outside array boundaries or pointer
+                          to TL cb is NULL ; access would cause a page fault
+    VOS_STATUS_E_EXISTS:  Station was not registered
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetRxPktCount
+(
+  v_PVOID_t      pvosGCtx,
+  v_U8_t         ucSTAId,
+  v_U8_t         ucTid,
+  v_U32_t*       puRxPktCount
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == puRxPktCount )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_GetRxPktCount"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetRxPktCount",
+             ucSTAId, ucTid));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRxPktCount"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Station was not previously registered on WLANTL_GetRxPktCount"));
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Return data
+   ------------------------------------------------------------------------*/
+  TLLOG3(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
+            "WLAN TL:Requested rx packet count for STA: %d, TID: %d",
+             ucSTAId, ucTid));
+
+  *puRxPktCount = pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid];
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_GetRxPktCount */
+
+#ifdef WLAN_SOFTAP_FEATURE
+VOS_STATUS
+WLANTL_TxFCFrame
+(
+  v_PVOID_t       pvosGCtx
+);
+#endif
+/*============================================================================
+                      TL INTERNAL API DEFINITION
+============================================================================*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetFrames
+
+  DESCRIPTION
+
+    BAL calls this function at the request of the lower bus interface.
+    When this request is being received TL will retrieve packets from HDD
+    in accordance with the priority rules and the count supplied by BAL.
+
+  DEPENDENCIES
+
+    HDD must have registered with TL at least one STA before this function
+    can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+    uSize:          maximum size accepted by the lower layer
+    uFlowMask       TX flow control mask for Prima. Each bit is defined as 
+                    WDA_TXFlowEnumType
+
+    OUT
+    vosDataBuff:   it will contain a pointer to the first buffer supplied
+                    by TL, if there is more than one packet supplied, TL
+                    will chain them through vOSS buffers
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    1 or more: number of required resources if there are still frames to fetch
+    0 : error or HDD queues are drained
+
+  SIDE EFFECTS
+
+  NOTE
+    
+    Featurized uFlowMask. If we want to remove featurization, we need to change
+    BAL on Volans.
+
+============================================================================*/
+v_U32_t
+WLANTL_GetFrames
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t     **ppFrameDataBuff,
+  v_U32_t         uSize,
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  v_U8_t          uFlowMask,
+#endif
+  v_BOOL_t*       pbUrgent
+)
+{
+   vos_pkt_t**         pvosDataBuff = (vos_pkt_t**)ppFrameDataBuff;
+   WLANTL_CbType*      pTLCb = NULL;
+   v_U32_t             uRemaining = uSize;
+   vos_pkt_t*          vosRoot;
+   vos_pkt_t*          vosTempBuf;
+   WLANTL_STAFuncType  pfnSTAFsm;
+   v_U16_t             usPktLen;
+   v_U32_t             uResLen;
+   v_U8_t              ucSTAId;
+   v_U8_t              ucAC;
+   vos_pkt_t*          vosDataBuff;
+   v_U32_t             uTotalPktLen;
+   v_U32_t             i=0;
+   v_U32_t             ucResult = 0;
+   VOS_STATUS          vosStatus;
+   WLANTL_STAEventType   wSTAEvent;
+   tBssSystemRole       systemRole;
+   tpAniSirGlobal pMac;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return ucResult;
+  }
+
+  pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
+  if ( NULL == pMac )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid pMac", __FUNCTION__));
+    return ucResult;
+  }
+
+  vosDataBuff = pTLCb->vosDummyBuf; /* Just to avoid checking for NULL at
+                                         each iteration */
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  pTLCb->uResCount = uSize;
+#endif
+
+  /*-----------------------------------------------------------------------
+    Save the root as we will walk this chain as we fill it
+   -----------------------------------------------------------------------*/
+  vosRoot = vosDataBuff;
+ 
+  /*-----------------------------------------------------------------------
+    There is still data - until FSM function says otherwise
+   -----------------------------------------------------------------------*/
+  pTLCb->bUrgent      = FALSE;
+
+#ifdef WLAN_SOFTAP_FEATURE
+  while (( pTLCb->tlConfigInfo.uMinFramesProcThres < pTLCb->uResCount ) &&
+         ( 0 < uRemaining ))
+#else
+  while (( 0 < pTLCb->uResCount ) &&
+         ( 0 < uRemaining ))
+#endif
+  {
+    systemRole = wdaGetGlobalSystemRole(pMac);
+#ifdef WLAN_SOFTAP_FEATURE
+#ifdef WLAN_SOFTAP_FLOWCTRL_EN
+/* FIXME: The code has been disabled since it is creating issues in power save */
+    if (eSYSTEM_AP_ROLE == systemRole)
+    {
+       if (pTLCb->done_once == 0 && NULL == pTLCb->vosTxFCBuf)
+       {
+          WLANTL_TxFCFrame (pvosGCtx);
+          pTLCb->done_once ++;
+       }
+    } 
+    if ( NULL != pTLCb->vosTxFCBuf )
+    {
+       //there is flow control packet waiting to be sent
+       WDA_TLI_PROCESS_FRAME_LEN( pTLCb->vosTxFCBuf, usPktLen, uResLen, uTotalPktLen);
+    
+       if ( ( pTLCb->uResCount > uResLen ) &&
+           ( uRemaining > uTotalPktLen )
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+           && ( uFlowMask & ( 1 << WDA_TXFLOW_FC ) )
+#endif
+          )
+       {
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "WLAN TL:Chaining FC frame first on GetFrame"));
+
+          vos_pkt_chain_packet( vosDataBuff, pTLCb->vosTxFCBuf, 1 /*true*/ );
+
+          vos_atomic_set_U32( (v_U32_t*)&pTLCb->vosTxFCBuf, (v_U32_t)NULL);
+
+          /*FC frames cannot be delayed*/
+          pTLCb->bUrgent      = TRUE;
+
+          /*Update remaining len from SSC */
+          uRemaining        -= (usPktLen + WDA_DXE_HEADER_SIZE);
+
+          /*Update resource count */
+          pTLCb->uResCount -= uResLen;
+       }
+       else
+       {
+          TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                "WLAN TL:send fc out of source %s", __FUNCTION__));
+          ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
+          break; /* Out of resources or reached max len */
+       }
+   }
+   else 
+#endif //WLAN_SOFTAP_FLOWCTRL_EN
+#endif //#ifdef WLAN_SOFTAP_FEATURE
+
+    if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
+    {
+      WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
+                          usPktLen, uResLen, uTotalPktLen);
+
+      VOS_ASSERT(usPktLen <= WLANTL_MAX_ALLOWED_LEN);
+
+      if ( ( pTLCb->uResCount > uResLen ) &&
+           ( uRemaining > uTotalPktLen )
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+           && ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) )
+#endif
+         )
+      {
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "WLAN TL:Chaining management frame on GetFrame"));
+
+        vos_pkt_chain_packet( vosDataBuff,
+                              pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
+                              1 /*true*/ );
+
+        vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.
+                                  vosPendingDataBuff, (v_U32_t)NULL);
+
+        /*management frames cannot be delayed*/
+        pTLCb->bUrgent      = TRUE;
+
+        /*Update remaining len from SSC */
+        uRemaining        -= (usPktLen + WDA_DXE_HEADER_SIZE);
+
+        /*Update resource count */
+        pTLCb->uResCount -= uResLen;
+      }
+      else
+      {
+        ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
+        break; /* Out of resources or reached max len */
+      }
+    }
+    else if (( pTLCb->tlBAPClient.vosPendingDataBuff ) &&
+             ( WDA_TLI_MIN_RES_BAP <= pTLCb->uResCount ) &&
+             ( 0 == pTLCb->ucTxSuspended )
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+           && ( uFlowMask & ( 1 << WDA_TXFLOW_BAP ) )
+#endif
+          )
+    {
+      WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlBAPClient.vosPendingDataBuff,
+                          usPktLen, uResLen, uTotalPktLen);
+
+      VOS_ASSERT(usPktLen <= WLANTL_MAX_ALLOWED_LEN);
+
+      if ( ( pTLCb->uResCount > (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
+           ( uRemaining > uTotalPktLen ))
+      {
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "WLAN TL:Chaining BT-AMP frame on GetFrame"));
+
+        vos_pkt_chain_packet( vosDataBuff,
+                              pTLCb->tlBAPClient.vosPendingDataBuff,
+                              1 /*true*/ );
+
+        /*BAP frames cannot be delayed*/
+        pTLCb->bUrgent      = TRUE;
+
+        vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
+                            (v_U32_t)NULL);
+
+        /*Update remaining len from SSC */
+        uRemaining        -=  (usPktLen + WDA_DXE_HEADER_SIZE);
+
+        /*Update resource count */
+        pTLCb->uResCount  -= uResLen;
+      }
+      else
+      {
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+        ucResult = uResLen + WDA_TLI_MIN_RES_MF;
+#else
+        ucResult = ( pTLCb->uResCount > ( uResLen + WDA_TLI_MIN_RES_MF ) )?
+                     VOS_TRUE:VOS_FALSE;
+#endif
+        break; /* Out of resources or reached max len */
+      }
+    }
+    else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount )&&
+             ( 0 == pTLCb->ucTxSuspended )
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+           && (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) || 
+               ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
+               ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || 
+               ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) ))
+#endif
+          )
+    {
+      /*---------------------------------------------------------------------
+        Check to see if there was any packet left behind previously due to
+        size constraints
+       ---------------------------------------------------------------------*/
+      vosTempBuf = NULL;
+
+      if ( NULL != pTLCb->vosTempBuf ) 
+      {
+        vosTempBuf          = pTLCb->vosTempBuf;
+        pTLCb->vosTempBuf   = NULL;
+        ucSTAId             = pTLCb->ucCachedSTAId; 
+        ucAC                = pTLCb->ucCachedAC;
+        pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 0;
+
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "WLAN TL:Chaining cached data frame on GetFrame"));
+      }
+      else
+      {
+        WLAN_TLGetNextTxIds( pvosGCtx, &ucSTAId);
+        if (ucSTAId >= WLAN_MAX_STA_COUNT)
+        {
+         /* Packets start coming in even after insmod Without *
+            starting Hostapd or Interface being up            *
+            During which cases STAID is invaled and hence 
+            the check. HalMsg_ScnaComplete Triggers */
+
+            break;
+        }
+        /* ucCurrentAC should have correct AC to be served by calling
+           WLAN_TLGetNextTxIds */
+        ucAC = pTLCb->atlSTAClients[ucSTAId].ucCurrentAC;
+
+        pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
+        TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                   "WLAN TL: %s get one data frame, station ID %d ", __FUNCTION__, ucSTAId));
+        /*-------------------------------------------------------------------
+        Check to see that STA is valid and tx is not suspended
+         -------------------------------------------------------------------*/
+        if ( ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) &&
+           ( 0 == pTLCb->atlSTAClients[ucSTAId].ucTxSuspended ) &&
+           ( 0 == pTLCb->atlSTAClients[ucSTAId].fcStaTxDisabled) )
+        {
+          TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                   "WLAN TL: %s sta id valid and not suspended ",__FUNCTION__));
+          wSTAEvent = WLANTL_TX_EVENT;
+
+          pfnSTAFsm = tlSTAFsm[pTLCb->atlSTAClients[ucSTAId].tlState].
+                        pfnSTATbl[wSTAEvent];
+
+          if ( NULL != pfnSTAFsm )
+          {
+            pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 0;
+            vosStatus  = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf);
+
+            if (( VOS_STATUS_SUCCESS != vosStatus ) &&
+                ( NULL != vosTempBuf ))
+            {
+                 pTLCb->atlSTAClients[ucSTAId].pfnSTATxComp( pvosGCtx,
+                                                             vosTempBuf,
+                                                             vosStatus );
+                 vosTempBuf = NULL;
+            }/* status success*/
+          }/*NULL function state*/
+        }/* valid STA id and ! suspended*/
+        else
+        {
+           if ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) 
+           {
+                TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL:Not fetching frame because suspended for sta ID %d", 
+                   ucSTAId));
+           }
+        }
+      }/* data */
+
+      if ( NULL != vosTempBuf )
+      {
+        WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
+
+        VOS_ASSERT( usPktLen <= WLANTL_MAX_ALLOWED_LEN);
+
+        TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                  "WLAN TL:Resources needed by frame: %d", uResLen));
+
+        if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) &&
+           ( uRemaining > uTotalPktLen )
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+           && ( uFlowMask & ( 1 << ucAC ) )
+#endif
+           )
+        {
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "WLAN TL:Chaining data frame on GetFrame"));
+
+          vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
+          vosTempBuf =  NULL;
+
+          /*Update remaining len from SSC */
+          uRemaining        -= (usPktLen + WDA_DXE_HEADER_SIZE);
+
+           /*Update resource count */
+          pTLCb->uResCount  -= uResLen;
+
+#ifdef WLAN_SOFTAP_FEATURE
+          //fow control update
+          pTLCb->atlSTAClients[ucSTAId].uIngress_length += uResLen;
+          pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax = (pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax >= uResLen) ?
+            (pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax - uResLen) : 0;
+#endif
+
+        }
+        else
+        {
+          /* Store this for later tx - already fetched from HDD */
+          pTLCb->vosTempBuf = vosTempBuf;
+          pTLCb->ucCachedSTAId = ucSTAId;
+          pTLCb->ucCachedAC    = ucAC;
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+          ucResult = uResLen + WDA_TLI_MIN_RES_BAP;
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "min %d res required by TL.", ucResult ));
+#else
+          ucResult = ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ))?
+                       VOS_TRUE:VOS_FALSE;
+#endif
+          break; /* Out of resources or reached max len */
+        }
+      }
+      else
+      {
+           for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
+           {
+              if ((pTLCb->atlSTAClients[i].ucExists) && 
+                  (pTLCb->atlSTAClients[i].ucPktPending))
+              {
+                  /* There is station to be Served */
+                  break;
+              }
+           }
+           if (i >= WLAN_MAX_STA_COUNT)
+           {
+              /* No More to Serve Exit Get Frames */
+              break;
+           }
+           else
+           {
+              /* More to be Served */
+              continue;
+           }
+        } 
+      }
+    else
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Returning from GetFrame: resources = %d suspended = %d",
+                 pTLCb->uResCount, pTLCb->ucTxSuspended));
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+      /* TL is starving even when DXE is not in low resource condition 
+         Return min resource number required and Let DXE deceide what to do */
+      if(( 0 == pTLCb->ucTxSuspended ) && 
+         (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) || 
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || 
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "WLAN TL:Returning from GetFrame: resources = %d",
+                 pTLCb->uResCount));
+         ucResult = WDA_TLI_MIN_RES_DATA;
+      }
+#endif
+       break; /*out of min data resources*/
+    }
+
+    pTLCb->usPendingTxCompleteCount++;
+    /* Move data buffer up one packet */
+    vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 0/*false*/ );
+  }
+
+  /*----------------------------------------------------------------------
+    Packet chain starts at root + 1
+   ----------------------------------------------------------------------*/
+  vos_pkt_walk_packet_chain( vosRoot, &vosDataBuff, 1/*true*/ );
+
+  *pvosDataBuff = vosDataBuff;
+  VOS_ASSERT( pbUrgent );
+  *pbUrgent     = pTLCb->bUrgent;
+  return ucResult;
+}/* WLANTL_GetFrames */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxComp
+
+  DESCRIPTION
+    It is being called by BAL upon asynchronous notification of the packet
+    or packets  being sent over the bus.
+
+  DEPENDENCIES
+    Tx complete cannot be called without a previous transmit.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+    vosDataBuff:   it will contain a pointer to the first buffer for which
+                    the BAL report is being made, if there is more then one
+                    packet they will be chained using vOSS buffers.
+    wTxStatus:      the status of the transmitted packet, see above chapter
+                    on HDD interaction for a list of possible values
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_E_EXISTS:  Station was not registered
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxComp
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t      *pFrameDataBuff,
+  VOS_STATUS      wTxStatus
+)
+{
+  vos_pkt_t*           vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
+  WLANTL_CbType*       pTLCb     = NULL;
+  WLANTL_TxCompCBType  pfnTxComp = NULL;
+  VOS_STATUS           vosStatus = VOS_STATUS_SUCCESS;
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC )
+  vos_msg_t            vosMsg;
+#endif
+  vos_pkt_t*           vosTempTx = NULL;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == vosDataBuff )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Extraneous NULL data pointer on WLANTL_TxComp"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+   Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxComp"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  while ((0 < pTLCb->usPendingTxCompleteCount) &&
+         ( VOS_STATUS_SUCCESS == vosStatus ) &&
+         ( NULL !=  vosDataBuff))
+  {
+    vos_pkt_get_user_data_ptr(  vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)&pfnTxComp);
+
+    /*it should never be NULL - default handler should be registered if none*/
+    if ( NULL == pfnTxComp )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:NULL pointer to Tx Complete on WLANTL_TxComp"));
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+    }
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Calling Tx complete for pkt %x in function %x",
+               vosDataBuff, pfnTxComp));
+
+    vosTempTx = vosDataBuff;
+    vosStatus = vos_pkt_walk_packet_chain( vosDataBuff,
+                                           &vosDataBuff, 1/*true*/);
+
+    pfnTxComp( pvosGCtx, vosTempTx, wTxStatus );
+
+    pTLCb->usPendingTxCompleteCount--;
+  }
+
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC ) 
+  if (( 0 == pTLCb->usPendingTxCompleteCount ) &&
+      ( pTLCb->uResCount <= WDA_TLI_BD_PDU_RESERVE_THRESHOLD ))
+  {
+    vosMsg.reserved = 0;
+    vosMsg.bodyptr  = NULL;
+    vosMsg.type     = WLANTL_TX_RES_NEEDED;
+    vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg);
+  }
+#endif
+ 
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "WLAN TL: current TL values are: resources = %d "
+            "pTLCb->usPendingTxCompleteCount = %d",
+              pTLCb->uResCount, pTLCb->usPendingTxCompleteCount));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_TxComp */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_CacheSTAFrame
+
+  DESCRIPTION
+    Internal utility function for for caching incoming data frames that do 
+    not have a registered station yet. 
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    In order to benefit from thsi caching, the components must ensure that
+    they will only register with TL at the moment when they are fully setup
+    and ready to receive incoming data 
+   
+  PARAMETERS
+
+    IN
+    
+    pTLCb:                  TL control block
+    ucSTAId:                station id
+    vosTempBuff:            the data packet
+    uDPUSig:                DPU signature of the incoming packet
+    bBcast:                 true if packet had the MC/BC bit set 
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL or STA Id invalid ; access
+                          would cause a page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+static VOS_STATUS
+WLANTL_CacheSTAFrame
+(
+  WLANTL_CbType*    pTLCb,
+  v_U8_t            ucSTAId,
+  vos_pkt_t*        vosTempBuff,
+  v_U32_t           uDPUSig,
+  v_U8_t            bBcast,
+  v_U8_t            ucFrmType
+)
+{
+  v_U8_t    ucUcastSig;
+  v_U8_t    ucBcastSig;
+  v_BOOL_t  bOldSTAPkt;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------  
+     Sanity check 
+   -------------------------------------------------------------------------*/ 
+  if (( NULL == pTLCb ) || ( NULL == vosTempBuff ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Invalid input pointer on WLANTL_CacheSTAFrame TL %x"
+               " Packet %x", pTLCb, vosTempBuff ));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid station id requested on WLANTL_CacheSTAFrame"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Attempting to cache pkt for STA %d, BD DPU Sig: %d with sig UC: %d, BC: %d", 
+             ucSTAId, uDPUSig,
+             pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig,
+             pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig));
+
+  if(WLANTL_IS_CTRL_FRAME(ucFrmType))
+  {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL: No need to cache CTRL frame. Dropping"));
+      vos_pkt_return_packet(vosTempBuff); 
+      return VOS_STATUS_SUCCESS;
+  }
+
+  /*-------------------------------------------------------------------------
+    Check if the packet that we are trying to cache belongs to the old
+    registered station (if any) or the new (potentially)upcoming station
+    
+    - If the STA with this Id was never registered with TL - the signature
+    will be invalid;
+    - If the STA was previously registered TL will have cached the former
+    set of DPU signatures
+  -------------------------------------------------------------------------*/
+  if ( bBcast )
+  {
+    ucBcastSig = (v_U8_t)uDPUSig;
+    bOldSTAPkt = (( WLAN_TL_INVALID_B_SIG != 
+                  pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig ) &&
+      ( ucBcastSig == pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig ));
+  }
+  else
+  {
+    ucUcastSig = (v_U8_t)uDPUSig;
+    bOldSTAPkt = (( WLAN_TL_INVALID_U_SIG != 
+                    pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig ) &&
+        ( ucUcastSig == pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig ));
+  }
+
+  /*------------------------------------------------------------------------
+    If the value of the DPU SIG matches the old, this packet will not
+    be cached as it belonged to the former association
+    In case the SIG does not match - this is a packet for a potentially new
+    associated station 
+  -------------------------------------------------------------------------*/
+  if ( bOldSTAPkt )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Data packet matches old sig for sig DPU: %d UC: %d, "
+               "BC: %d - dropping", 
+               uDPUSig, 
+               pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig, 
+               pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig));
+    vos_pkt_return_packet(vosTempBuff); 
+  }
+  else
+  {
+    if ( NULL == pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame ) 
+    {
+      /*this is the first frame that we are caching */
+      pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame = vosTempBuff;   
+    }
+    else
+    {
+      /*this is a subsequent frame that we are caching: chain to the end */
+      vos_pkt_chain_packet(pTLCb->atlSTAClients[ucSTAId].vosEndCachedFrame, 
+                           vosTempBuff, VOS_TRUE);
+    }
+    pTLCb->atlSTAClients[ucSTAId].vosEndCachedFrame = vosTempBuff; 
+  }/*else new packet*/
+
+  return VOS_STATUS_SUCCESS; 
+}/*WLANTL_CacheSTAFrame*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_FlushCachedFrames
+
+  DESCRIPTION
+    Internal utility function used by TL to flush the station cache
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    
+  PARAMETERS
+
+    IN
+
+    vosDataBuff:   it will contain a pointer to the first cached buffer
+                   received,
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+  NOTE
+    This function doesn't re-initialize vosDataBuff to NULL. It's caller's 
+    responsibility to do so, if required, after this function call.
+    Because of this restriction, we decide to make this function to static
+    so that upper layer doesn't need to be aware of this restriction. 
+    
+============================================================================*/
+static VOS_STATUS
+WLANTL_FlushCachedFrames
+(
+  vos_pkt_t*      vosDataBuff
+)
+{
+  /*----------------------------------------------------------------------
+    Return the entire chain to vos if there are indeed cache frames 
+  ----------------------------------------------------------------------*/
+  if ( NULL != vosDataBuff )
+  {
+    vos_pkt_return_packet(vosDataBuff);
+  }
+
+  return VOS_STATUS_SUCCESS;  
+}/*WLANTL_FlushCachedFrames*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ForwardSTAFrames
+
+  DESCRIPTION
+    Internal utility function for either forwarding cached data to the station after
+    the station has been registered, or flushing cached data if the station has not 
+    been registered. 
+     
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+   
+  PARAMETERS
+
+    IN
+    
+    pTLCb:                  TL control block
+    ucSTAId:                station id
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+    This function doesn't re-initialize vosDataBuff to NULL. It's caller's 
+    responsibility to do so, if required, after this function call.
+    Because of this restriction, we decide to make this function to static
+    so that upper layer doesn't need to be aware of this restriction. 
+
+============================================================================*/
+static VOS_STATUS
+WLANTL_ForwardSTAFrames
+(
+  void*             pvosGCtx,
+  v_U8_t            ucSTAId,
+  v_U8_t            ucUcastSig,
+  v_U8_t            ucBcastSig
+)
+{
+  WLANTL_CbType*  pTLCb = NULL; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------  
+     Sanity check 
+   -------------------------------------------------------------------------*/ 
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL: Invalid input pointer on WLANTL_ForwardSTAFrames TL %x",
+         pTLCb ));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid station id requested on WLANTL_ForwardSTAFrames"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  //WLAN_TL_LOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]); 
+
+  /*------------------------------------------------------------------------
+     Check if station has not been registered in the mean while
+     if not registered, flush cached frames.
+   ------------------------------------------------------------------------*/ 
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+       "WLAN TL:Station has been deleted for STA %d - flushing cache", ucSTAId));
+    WLANTL_FlushCachedFrames(pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame);
+    goto done; 
+  }
+
+  /*------------------------------------------------------------------------
+    Forwarding cache frames received while the station was in the process   
+    of being registered with the rest of the SW components   
+
+    Access to the cache must be locked; similarly updating the signature and   
+    the existence flag must be synchronized because these values are checked   
+    during cached  
+  ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+       "WLAN TL:Preparing to fwd packets for STA %d", ucSTAId));
+
+  /*-----------------------------------------------------------------------
+    Save the new signature values
+  ------------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig  = ucUcastSig;
+  pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig  = ucBcastSig;
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+       "WLAN TL:Fwd-ing packets for STA %d UC %d BC %d",
+       ucSTAId, ucUcastSig, ucBcastSig));
+
+  /*-------------------------------------------------------------------------  
+     Check to see if we have any cached data to forward 
+   -------------------------------------------------------------------------*/ 
+  if ( NULL != pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame ) 
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL: Fwd-ing Cached packets for station %d", ucSTAId ));
+
+    WLANTL_RxCachedFrames( pTLCb, 
+                           ucSTAId, 
+                           pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame);
+  }
+  else
+  {
+     TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL: NO cached packets for station %d", ucSTAId ));
+  }
+
+done:
+  /*-------------------------------------------------------------------------  
+   Clear the station cache 
+   -------------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].vosBegCachedFrame = NULL;   
+  pTLCb->atlSTAClients[ucSTAId].vosEndCachedFrame = NULL; 
+
+    /*-----------------------------------------------------------------------
+    After all the init is complete we can mark the existance flag 
+    ----------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].ucRxBlocked = 0;
+
+  //WLAN_TL_UNLOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]); 
+  return VOS_STATUS_SUCCESS; 
+
+}/*WLANTL_ForwardSTAFrames*/
+
+
+#ifdef FEATURE_WLAN_CCX
+/*==========================================================================
+
+  FUNCTION    WLANTL_IsIAPPFrame
+
+  DESCRIPTION
+    Internal utility function for detecting incoming CCX IAPP frames
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    
+    pvBDHeader:             pointer to the BD header
+    vosTempBuff:            the data packet
+
+    IN/OUT
+    pFirstDataPktArrived:   static from caller function; used for rssi 
+                            computation
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_TRUE:   It is a IAPP frame
+    VOS_FALSE:  It is NOT IAPP frame
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_BOOL_t
+WLANTL_IsIAPPFrame
+(
+  v_PVOID_t         pvBDHeader,
+  vos_pkt_t*        vosTempBuff
+)
+{
+  v_U16_t             usMPDUDOffset;
+  v_U8_t              ucOffset;
+  v_U8_t              ucSnapHdr[WLANTL_LLC_SNAP_SIZE];
+  v_SIZE_t            usSnapHdrSize = WLANTL_LLC_SNAP_SIZE;
+  VOS_STATUS          vosStatus;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Check if OUI field is present.
+  -------------------------------------------------------------------------*/
+  if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
+  {
+      TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                  "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
+                  "dropping pkt"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      return VOS_TRUE;
+  }
+  usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
+  ucOffset      = (v_U8_t)usMPDUDOffset + WLANTL_LLC_SNAP_OFFSET;
+
+  vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
+                                (v_PVOID_t)ucSnapHdr, &usSnapHdrSize);
+
+  if (( VOS_STATUS_SUCCESS != vosStatus)) 
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                "Unable to extract Snap Hdr of data  packet -"
+                "dropping pkt"));
+    return VOS_FALSE;
+  }
+
+ /*------------------------------------------------------------------------
+    Check if this is IAPP frame by matching Aironet Snap hdr.
+  -------------------------------------------------------------------------*/
+  // Compare returns 1 if values are same and 0
+  // if not the same.
+  if (( WLANTL_LLC_SNAP_SIZE != usSnapHdrSize ) ||
+     ( 0 == vos_mem_compare(ucSnapHdr, (v_PVOID_t)WLANTL_AIRONET_SNAP_HEADER,
+                            WLANTL_LLC_SNAP_SIZE ) ))
+  {
+    return VOS_FALSE;
+  }
+
+  return VOS_TRUE;
+
+}
+#endif //FEATURE_WLAN_CCX
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ProcessBAPFrame
+
+  DESCRIPTION
+    Internal utility function for processing incoming BT-AMP frames
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    Bothe the BT-AMP station and the BAP Ctrl path must have been previously 
+    registered with TL.
+
+  PARAMETERS
+
+    IN
+    
+    pvBDHeader:             pointer to the BD header
+    vosTempBuff:            the data packet
+    pTLCb:                  TL control block
+    ucSTAId:                station id
+
+    IN/OUT
+    pFirstDataPktArrived:   static from caller function; used for rssi 
+                            computation
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_BOOL_t
+WLANTL_ProcessBAPFrame
+(
+  v_PVOID_t         pvBDHeader,
+  vos_pkt_t*        vosTempBuff,
+  WLANTL_CbType*    pTLCb,
+  v_U8_t*           pFirstDataPktArrived,
+  v_U8_t            ucSTAId
+)
+{
+  v_U16_t             usMPDUDOffset;
+  v_U8_t              ucOffset;
+  v_U8_t              ucOUI[WLANTL_LLC_OUI_SIZE];
+  v_SIZE_t            usOUISize = WLANTL_LLC_OUI_SIZE;
+  VOS_STATUS          vosStatus;
+  v_U16_t             usType;
+  v_SIZE_t            usTypeLen = sizeof(usType);
+  v_U8_t              ucMPDUHOffset;
+  v_U8_t              ucMPDUHLen = 0;
+  v_U16_t             usActualHLen = 0;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Extract OUI and type from LLC and validate; if non-data send to BAP
+  -------------------------------------------------------------------------*/
+  if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+          "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
+              "dropping pkt"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosTempBuff);
+    return VOS_TRUE; 
+  }
+
+  usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
+  ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pvBDHeader);
+  ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
+  ucOffset      = (v_U8_t)usMPDUDOffset + WLANTL_LLC_OUI_OFFSET;
+
+  vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
+                                (v_PVOID_t)ucOUI, &usOUISize);
+
+#if 0
+  // Compare returns 1 if values are same and 0
+  // if not the same.
+  if (( WLANTL_LLC_OUI_SIZE != usOUISize ) ||
+     ( 0 == vos_mem_compare(ucOUI, (v_PVOID_t)WLANTL_BT_AMP_OUI,
+                            WLANTL_LLC_OUI_SIZE ) ))
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                "LLC header points to diff OUI in BT-AMP station -"
+                "dropping pkt"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosTempBuff);
+    return VOS_TRUE;
+  }
+#endif
+  /*------------------------------------------------------------------------
+    Extract LLC OUI and ensure that this is indeed a BT-AMP frame
+   ------------------------------------------------------------------------*/
+  vosStatus = vos_pkt_extract_data( vosTempBuff,
+                                 ucOffset + WLANTL_LLC_OUI_SIZE,
+                                (v_PVOID_t)&usType, &usTypeLen);
+
+  if (( VOS_STATUS_SUCCESS != vosStatus) ||
+      ( sizeof(usType) != usTypeLen ))
+  {
+    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                "Unable to extract type on incoming BAP packet -"
+                "dropping pkt"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosTempBuff);
+    return VOS_TRUE;
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this is BT-AMP data or ctrl packet(RSN, LinkSvision, ActivityR)
+   ------------------------------------------------------------------------*/
+  usType = vos_be16_to_cpu(usType);
+
+  if (WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType))
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      "WLAN TL:Non-data packet received over BT-AMP link: %d, => BAP",
+               usType));
+
+    /*Flatten packet as BAP expects to be able to peek*/
+    if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
+    {
+      TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                 "WLAN TL:Cannot flatten BT-AMP packet - dropping"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      return VOS_TRUE;
+    }
+
+    /* Send packet to BAP client*/
+
+    VOS_ASSERT(pTLCb->tlBAPClient.pfnTlBAPRx != NULL);
+
+    if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosTempBuff ) )
+    {
+      TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+        "WLAN TL:BD header corrupted - dropping packet"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      return VOS_TRUE;
+    }
+
+    if ( 0 == WDA_GET_RX_FT_DONE(pvBDHeader) )
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+          "Non-data packet received over BT-AMP link: Sending it for "
+          "frame Translation"));
+
+      if (usMPDUDOffset > ucMPDUHOffset)
+      {
+        usActualHLen = usMPDUDOffset - ucMPDUHOffset;
+      }
+
+      /* software frame translation for BTAMP WDS.*/
+      WLANTL_Translate80211To8023Header( vosTempBuff, &vosStatus, usActualHLen,
+                                         ucMPDUHLen, pTLCb,ucSTAId );
+      
+    }
+    if (pTLCb->tlBAPClient.pfnTlBAPRx)
+        pTLCb->tlBAPClient.pfnTlBAPRx( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
+                                       vosTempBuff,
+                                       (WLANTL_BAPFrameEnumType)usType );
+
+    return VOS_TRUE;
+  }
+  else
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      "WLAN TL: BAP DATA packet received over BT-AMP link: %d, => BAP",
+               usType));
+   /*!!!FIX ME!!*/
+ #if 0
+    /*--------------------------------------------------------------------
+     For data packet collect phy stats RSSI and Link Quality
+     Calculate the RSSI average and save it. Continuous average is done.
+    --------------------------------------------------------------------*/
+    if ( *pFirstDataPktArrived == 0)
+    {
+      pTLCb->atlSTAClients[ucSTAId].rssiAvg =
+         WLANHAL_GET_RSSI_AVERAGE( pvBDHeader );
+      pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg = 
+        WLANHAL_RX_BD_GET_SNR( pvBDHeader );
+
+      // Rcvd 1st pkt, start average from next time
+      *pFirstDataPktArrived = 1;
+    }
+    else
+    {
+      pTLCb->atlSTAClients[ucSTAId].rssiAvg =
+          (WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ) + 
+           pTLCb->atlSTAClients[ucSTAId].rssiAvg)/2;
+      pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
+          (WLANHAL_RX_BD_GET_SNR( pvBDHeader ) +  
+           pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg)/2;
+    }/*Else, first data packet*/
+ #endif
+  }/*BT-AMP data packet*/
+
+  return VOS_FALSE; 
+}/*WLANTL_ProcessBAPFrame*/
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ProcessFCFrame
+
+  DESCRIPTION
+    Internal utility function for processing incoming Flow Control frames. Enable
+    or disable LWM mode based on the information.
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    FW sends up special flow control frame.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx                pointer to vos global context
+    pvBDHeader:             pointer to the BD header
+    pTLCb:                  TL control block
+    pvBDHeader              pointer to BD header.
+
+    IN/OUT
+    pFirstDataPktArrived:   static from caller function; used for rssi 
+                            computation
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input frame are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+    The ingress and egress of each station will be updated. If needed, LWM mode will
+    be enabled or disabled based on the flow control algorithm.
+
+============================================================================*/
+v_BOOL_t
+WLANTL_ProcessFCFrame
+(
+  v_PVOID_t         pvosGCtx,
+  vos_pkt_t*        pvosDataBuff,
+  v_PVOID_t         pvBDHeader
+)
+{
+#if 1 //enable processing of only fcStaTxDisabled bitmap for now. the else part is old better qos code.
+      // need to revisit the old code for full implementation.
+  v_U8_t               ucTxSuspended = 0, ucTxSuspendReq = 0, ucTxResumeReq = 0;
+  WLANTL_CbType*       pTLCb = NULL;
+
+  /*------------------------------------------------------------------------
+     Extract TL control block
+  ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /* Existing Stations with Tx suspended */
+  ucTxSuspended = pTLCb->ucTxSuspended;
+
+  /* Suspend Request Received */
+  ucTxSuspendReq = (v_U8_t) WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pvBDHeader);
+  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLANTL_ProcessFCFrame called for Stations:: Current: %x Requested: %x ", ucTxSuspended, ucTxSuspendReq));
+
+  ucTxResumeReq = ucTxSuspendReq ^ ( ucTxSuspended | ucTxSuspendReq );
+  ucTxSuspendReq = ucTxSuspendReq ^ ( ucTxSuspended & ucTxSuspendReq );
+  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "Station Suspend request processed :: Suspend: %x :Resume: %x ", ucTxSuspendReq, ucTxResumeReq));
+
+  if ( 0 != ucTxSuspendReq )
+  {
+    WLANTL_SuspendDataTx(pvosGCtx, &ucTxSuspendReq, NULL);
+  }
+  if ( 0 != ucTxResumeReq )
+  {
+    WLANTL_ResumeDataTx(pvosGCtx, &ucTxResumeReq);
+  }
+
+#else
+  VOS_STATUS          vosStatus;
+  tpHalFcRxBd         pvFcRxBd = NULL;
+  v_U8_t              ucBitCheck = 0x1;
+  v_U8_t              ucStaValid = 0;
+  v_U8_t              ucSTAId = 0;
+
+      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+                 "Received FC Response");
+  if ( (NULL == pTLCb) || (NULL == pvosDataBuff))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid pointer in %s \n", __FUNCTION__));
+    return VOS_STATUS_E_FAULT;
+  }
+  vosStatus = vos_pkt_peek_data( pvosDataBuff, 0, (v_PVOID_t)&pvFcRxBd,
+                                   sizeof(tHalFcRxBd));
+
+  if ( (VOS_STATUS_SUCCESS != vosStatus) || (NULL == pvFcRxBd) )
+  {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:wrong FC Rx packet"));
+      return VOS_STATUS_E_INVAL;
+  }
+  
+  // need to swap bytes in the FC contents.  
+  WLANHAL_SwapFcRxBd(&pvFcRxBd->fcSTATxQLen[0]);
+
+  //logic to enable/disable LWM mode for each station
+  for( ucStaValid = (v_U8_t)pvFcRxBd->fcSTAValidMask; ucStaValid; ucStaValid >>= 1, ucBitCheck <<= 1, ucSTAId ++)
+  {
+    if ( (0 == (ucStaValid & 0x1)) || (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) )
+    {
+      continue;
+    }
+
+    if ( pvFcRxBd->fcSTAThreshIndMask & ucBitCheck )
+    {
+      //LWM event is reported by FW. Able to fetch more packet
+      if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
+      {
+        //Now memory usage is below LWM. Station can send more packets.
+        pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = TRUE;
+      }
+      else
+      {
+        TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                 "WLAN TL: FW report LWM event but the station %d is not in LWM mode \n", ucSTAId));
+      }
+    }
+
+    //calculate uEgress_length/uIngress_length only after receiving enough packets
+    if (WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
+    {
+      //check memory usage info to see whether LWM mode should be enabled for the station
+      v_U32_t uEgress_length = pTLCb->atlSTAClients[ucSTAId].uIngress_length + 
+        pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed - pvFcRxBd->fcSTATxQLen[ucSTAId];
+
+      //if ((float)uEgress_length/(float)pTLCb->atlSTAClients[ucSTAId].uIngress_length 
+      //      <= WLANTL_LWM_EGRESS_INGRESS_THRESHOLD)
+      if ( (pTLCb->atlSTAClients[ucSTAId].uIngress_length > uEgress_length) &&
+           ((pTLCb->atlSTAClients[ucSTAId].uIngress_length - uEgress_length ) >= 
+            (pTLCb->atlSTAClients[ucSTAId].uIngress_length >> 2))
+         )
+      {   
+         TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "WLAN TL:Enable LWM mode for station %d\n", ucSTAId));
+         pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = TRUE;
+      }
+      else
+      {
+        if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
+        {
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "WLAN TL:Disable LWM mode for station %d\n", ucSTAId));
+          pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = FALSE;
+        }
+
+      }
+
+      //remember memory usage in FW starting from this round
+      pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed = pvFcRxBd->fcSTATxQLen[ucSTAId];
+      pTLCb->atlSTAClients[ucSTAId].uIngress_length = 0;
+    } //(WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
+
+    if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
+    {
+      //always update current maximum allowed memeory usage
+      pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax =  WLANTL_STA_BMU_THRESHOLD_MAX -
+        pvFcRxBd->fcSTATxQLen[ucSTAId];
+    }
+
+  }
+#endif
+
+  return VOS_STATUS_SUCCESS;
+}
+#endif
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RxFrames
+
+  DESCRIPTION
+    Callback registered by TL and called by BAL when a packet is received
+    over the bus. Upon the call of this function TL will make the necessary
+    decision with regards to the forwarding or queuing of this packet and
+    the layer it needs to be delivered to.
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    If the frame carried is a data frame then the station for which it is
+    destined to must have been previously registered with TL.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+
+    vosDataBuff:   it will contain a pointer to the first buffer received,
+                    if there is more then one packet they will be chained
+                    using vOSS buffers.
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RxFrames
+(
+  v_PVOID_t      pvosGCtx,
+  vos_pkt_t     *pFrameDataBuff
+)
+{
+  vos_pkt_t*          vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
+  WLANTL_CbType*      pTLCb = NULL;
+  WLANTL_STAFuncType  pfnSTAFsm;
+  vos_pkt_t*          vosTempBuff;
+  v_U8_t              ucSTAId;
+  VOS_STATUS          vosStatus;
+  v_U8_t              ucFrmType;
+  v_PVOID_t           pvBDHeader = NULL;
+  WLANTL_STAEventType wSTAEvent  = WLANTL_RX_EVENT;
+  v_U8_t              ucTid      = 0;
+  v_BOOL_t            broadcast  = VOS_FALSE;
+  v_BOOL_t            selfBcastLoopback = VOS_FALSE;
+  static v_U8_t       first_data_pkt_arrived = 0;
+  v_U32_t             uDPUSig; 
+#ifdef WLAN_SOFTAP_FEATURE
+  v_U16_t             usPktLen;
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:TL Receive Frames called"));
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    ------------------------------------------------------------------------*/
+  if ( NULL == vosDataBuff )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*---------------------------------------------------------------------
+    Save the initial buffer - this is the first received buffer
+   ---------------------------------------------------------------------*/
+  vosTempBuff = vosDataBuff;
+
+  while ( NULL != vosTempBuff )
+  {
+    vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
+
+    /*---------------------------------------------------------------------
+      Peek at BD header - do not remove
+      !!! Optimize me: only part of header is needed; not entire one
+     ---------------------------------------------------------------------*/
+    vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ );
+
+    if ( NULL == pvBDHeader )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Cannot extract BD header"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      vosTempBuff = vosDataBuff;
+      continue;
+    }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    /*---------------------------------------------------------------------
+      Check if FC frame reported from FW
+    ---------------------------------------------------------------------*/
+    if(WDA_IS_RX_FC(pvBDHeader))
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL:receive one FC frame"));
+
+      WLANTL_ProcessFCFrame(pvosGCtx, vosTempBuff, pvBDHeader);
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      vosTempBuff = vosDataBuff;
+      continue;
+    }
+#endif
+
+    /* AMSDU HW bug fix
+     * After 2nd AMSDU subframe HW could not handle BD correctly
+     * HAL workaround is needed */
+    if(WDA_GET_RX_ASF(pvBDHeader))
+    {
+      WDA_DS_RxAmsduBdFix(pvosGCtx, pvBDHeader);
+    }
+
+    /*---------------------------------------------------------------------
+      Extract frame control field from 802.11 header if present 
+      (frame translation not done) 
+    ---------------------------------------------------------------------*/
+
+    vosStatus = WDA_DS_GetFrameTypeSubType( pvosGCtx, vosTempBuff,
+                         pvBDHeader, &ucFrmType );
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                   "WLAN TL:Cannot extract Frame Control Field"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosTempBuff);
+      vosTempBuff = vosDataBuff;
+      continue;
+    }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    vos_pkt_get_packet_length(vosTempBuff, &usPktLen);
+#endif
+
+    /*---------------------------------------------------------------------
+      Check if management and send to PE
+    ---------------------------------------------------------------------*/
+
+    if ( WLANTL_IS_MGMT_FRAME(ucFrmType) )
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL:Sending packet to management client"));
+      if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
+      {
+        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                   "WLAN TL:Cannot flatten packet - dropping"));
+        /* Drop packet */
+        vos_pkt_return_packet(vosTempBuff);
+        vosTempBuff = vosDataBuff;
+        continue;
+      }
+      ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
+      /* Read RSSI and update */
+      if(!WLANTL_STA_ID_INVALID(ucSTAId))
+      {
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+        /* Read RSSI and update */
+        vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
+                                           WLANTL_MGMT_FRAME_TYPE,
+                                           pvBDHeader,
+                                           ucSTAId,
+                                           VOS_FALSE,
+                                           NULL);
+#else
+        vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
+#endif
+      }
+
+      if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+      {
+        TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+          "Handle RX Management Frame fail within Handoff support module"));
+        /* Do Not Drop packet at here 
+         * Revisit why HO module return fail
+        vos_pkt_return_packet(vosTempBuff);
+        vosTempBuff = vosDataBuff;
+        continue;
+         */
+      }
+      pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff); 
+    }
+    else /* Data Frame */
+    {
+      ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
+      ucTid   = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
+
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL:Data packet received for STA %d", ucSTAId));
+
+      /*------------------------------------------------------------------
+        This should be corrected when multipe sta support is added !!!
+        for now bcast frames will be sent to the last registered STA
+       ------------------------------------------------------------------*/
+      if ( WDA_IS_RX_BCAST(pvBDHeader))
+      {
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "WLAN TL:TL rx Bcast frame - sending to last registered station"));
+        broadcast = VOS_TRUE;
+        
+        /*-------------------------------------------------------------------
+          If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
+          pkt we sent  looping back to us. To be dropped if we are non BTAMP  
+         -------------------------------------------------------------------*/ 
+        if( WLANHAL_RX_BD_ADDR3_SELF_IDX == 
+            (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader )) 
+        {
+          selfBcastLoopback = VOS_TRUE; 
+        }
+      }/*if bcast*/
+
+      if ( WLANTL_STA_ID_INVALID(ucSTAId) )
+      {
+        TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+                   "WLAN TL:STA ID invalid - dropping pkt"));
+        /* Drop packet */
+        vos_pkt_return_packet(vosTempBuff);
+        vosTempBuff = vosDataBuff;
+        continue;
+      }
+
+      /*----------------------------------------------------------------------
+        No need to lock cache access because cache manipulation only happens
+        in the transport thread/task context
+        - These frames are to be forwarded to the station upon registration
+          which happens in the main thread context
+          The caching here can happen in either Tx or Rx thread depending
+          on the current SSC scheduling
+        - also we need to make sure that the frames in the cache are fwd-ed to
+          the station before the new incoming ones 
+      -----------------------------------------------------------------------*/
+      if ((( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists ) ||
+          ( (0 != pTLCb->atlSTAClients[ucSTAId].ucRxBlocked)
+#ifdef WLAN_SOFTAP_FEATURE
+            ///@@@: xg: no checking in SOFTAP for now, will revisit later
+            && (WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType)
+#endif
+          ) ||
+          ( WLANTL_STA_DISCONNECTED == pTLCb->atlSTAClients[ucSTAId].tlState)) &&
+            /*Dont buffer Broadcast/Multicast frames. If AP transmits bursts of Broadcast/Multicast data frames, 
+             * libra buffers all Broadcast/Multicast packets after authentication with AP, 
+             * So it will lead to low resource condition in Rx Data Path.*/
+          ((WDA_IS_RX_BCAST(pvBDHeader) == 0)))
+      {
+        uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
+          //Station has not yet been registered with TL - cache the frame
+        WLANTL_CacheSTAFrame( pTLCb, ucSTAId, vosTempBuff, uDPUSig, broadcast, ucFrmType);
+        vosTempBuff = vosDataBuff;
+        continue;
+      }
+
+
+#ifdef FEATURE_WLAN_CCX
+      if ((pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucIsCcxSta)|| broadcast)
+      {
+        /*--------------------------------------------------------------------
+          Filter the IAPP frames for CCX connection; 
+          if data it will return false and it 
+          will be routed through the regular data path
+        --------------------------------------------------------------------*/
+        if ( WLANTL_IsIAPPFrame(pvBDHeader,
+                                vosTempBuff))
+        {
+            if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
+            {
+               TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                        "WLAN TL:Cannot flatten packet - dropping"));
+               /* Drop packet */
+               vos_pkt_return_packet(vosTempBuff);
+            } else {
+
+               TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+                        "WLAN TL: Received CCX IAPP Frame"));
+
+               pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff); 
+            }
+            vosTempBuff = vosDataBuff;
+            continue;
+        }
+      }
+#endif
+
+      if ( WLAN_STA_BT_AMP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType )
+      {
+        /*--------------------------------------------------------------------
+          Process the ctrl BAP frame; if data it will return false and it 
+          will be routed through the regular data path
+        --------------------------------------------------------------------*/
+        if ( WLANTL_ProcessBAPFrame( pvBDHeader,
+                                     vosTempBuff,
+                                     pTLCb,
+                                    &first_data_pkt_arrived,
+                                     ucSTAId))
+        {
+          vosTempBuff = vosDataBuff;
+          continue;
+        }
+      }/*if BT-AMP station*/
+      else if(selfBcastLoopback == VOS_TRUE)
+      { 
+        /* Drop packet */ 
+        vos_pkt_return_packet(vosTempBuff); 
+        vosTempBuff = vosDataBuff; 
+        continue; 
+      } 
+      
+      /*---------------------------------------------------------------------
+        Data packet received, send to state machine
+      ---------------------------------------------------------------------*/
+      wSTAEvent = WLANTL_RX_EVENT;
+
+      pfnSTAFsm = tlSTAFsm[pTLCb->atlSTAClients[ucSTAId].tlState].
+                      pfnSTATbl[wSTAEvent];
+
+      if ( NULL != pfnSTAFsm )
+      {
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+        /* Read RSSI and update */
+        vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
+                                           WLANTL_DATA_FRAME_TYPE,
+                                           pvBDHeader,
+                                           ucSTAId,
+                                           broadcast,
+                                           vosTempBuff);
+        broadcast = VOS_FALSE;
+#else
+        vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
+#endif /*FEATURE_WLAN_GEN6_ROAMING*/
+        if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+        {
+          TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+            "Handle RX Data Frame fail within Handoff support module"));
+          /* Do Not Drop packet at here 
+           * Revisit why HO module return fail
+          vos_pkt_return_packet(vosTempBuff);
+          vosTempBuff = vosDataBuff;
+          continue;
+           */
+        }
+        pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuff);
+      }
+      else
+        {
+          TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+            "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
+                   ucSTAId, pTLCb->atlSTAClients[ucSTAId].tlState));
+          /* Drop packet */
+          vos_pkt_return_packet(vosTempBuff);
+          vosTempBuff = vosDataBuff;
+          continue;
+        }
+
+#ifdef WLAN_SOFTAP_FEATURE
+    /* RX Statistics Data */
+      /* This is RX UC data frame */
+      pTLCb->atlSTAClients[ucSTAId].trafficStatistics.rxUCFcnt++;
+      pTLCb->atlSTAClients[ucSTAId].trafficStatistics.rxUCBcnt += usPktLen;
+#endif
+
+    }/* else data frame*/
+
+    vosTempBuff = vosDataBuff;
+  }/*while chain*/
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RxFrames */
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RxCachedFrames
+
+  DESCRIPTION
+    Utility function used by TL to forward the cached frames to a particular
+    station; 
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    If the frame carried is a data frame then the station for which it is
+    destined to must have been previously registered with TL.
+
+  PARAMETERS
+
+    IN
+    pTLCb:   pointer to TL handle 
+   
+    ucSTAId:    station for which we need to forward the packets
+
+    vosDataBuff:   it will contain a pointer to the first cached buffer
+                   received, if there is more then one packet they will be
+                   chained using vOSS buffers.
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RxCachedFrames
+(
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucSTAId,
+  vos_pkt_t*      vosDataBuff
+)
+{
+  WLANTL_STAFuncType  pfnSTAFsm;
+  vos_pkt_t*          vosTempBuff;
+  VOS_STATUS          vosStatus;
+  v_PVOID_t           pvBDHeader = NULL;
+  WLANTL_STAEventType wSTAEvent  = WLANTL_RX_EVENT;
+  v_U8_t              ucTid      = 0;
+  v_BOOL_t            broadcast  = VOS_FALSE;
+  v_BOOL_t            bSigMatch  = VOS_FALSE; 
+  v_BOOL_t            selfBcastLoopback = VOS_FALSE;
+  static v_U8_t       first_data_pkt_arrived = 0;
+  v_U32_t             uDPUSig; 
+  v_U8_t              ucUcastSig; 
+  v_U8_t              ucBcastSig; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:TL Receive Cached Frames called"));
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    ------------------------------------------------------------------------*/
+  if ( NULL == vosDataBuff )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*---------------------------------------------------------------------
+    Save the initial buffer - this is the first received buffer
+   ---------------------------------------------------------------------*/
+  vosTempBuff = vosDataBuff;
+
+  while ( NULL != vosTempBuff )
+  {
+    vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
+
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Sending new cached packet to station %d", ucSTAId));
+    /*---------------------------------------------------------------------
+      Peek at BD header - do not remove
+      !!! Optimize me: only part of header is needed; not entire one
+     ---------------------------------------------------------------------*/
+    vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 0 );
+
+    if ( NULL == pvBDHeader )
+          {
+            TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Cannot extract BD header"));
+          /* Drop packet */
+          vos_pkt_return_packet(vosTempBuff);
+          vosTempBuff = vosDataBuff;
+          continue;
+        }
+
+    uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
+
+    /* AMSDU HW bug fix
+     * After 2nd AMSDU subframe HW could not handle BD correctly
+     * HAL workaround is needed */
+    if(WDA_GET_RX_ASF(pvBDHeader))
+    {
+      WDA_DS_RxAmsduBdFix(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), 
+                           pvBDHeader);
+    }
+
+    ucTid   = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
+
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Data packet cached for STA %d", ucSTAId);
+
+    /*------------------------------------------------------------------
+      This should be corrected when multipe sta support is added !!!
+      for now bcast frames will be sent to the last registered STA
+     ------------------------------------------------------------------*/
+    if ( WDA_IS_RX_BCAST(pvBDHeader))
+    {
+          TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL:TL rx Bcast frame "));
+      broadcast = VOS_TRUE;
+
+      /* If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast 
+       * pkt we sent looping back to us. To be dropped if we are non BTAMP  
+       */ 
+      if( WLANHAL_RX_BD_ADDR3_SELF_IDX == 
+          (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader )) 
+      {
+        selfBcastLoopback = VOS_TRUE; 
+      }
+    }/*if bcast*/
+
+     /*-------------------------------------------------------------------------
+      Check if the packet that we cached matches the DPU signature of the
+      newly added station 
+    -------------------------------------------------------------------------*/
+    if ( broadcast )
+    {
+      ucBcastSig = (v_U8_t)uDPUSig;
+      bSigMatch = (( WLAN_TL_INVALID_B_SIG != 
+                    pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig ) &&
+        ( ucBcastSig == pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucBcastSig ));
+    }
+    else
+    {
+      ucUcastSig = (v_U8_t)uDPUSig;
+      bSigMatch = (( WLAN_TL_INVALID_U_SIG != 
+                      pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig ) &&
+          ( ucUcastSig == pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig ));
+    }
+
+    /*-------------------------------------------------------------------------
+      If the packet doesn't match - drop it 
+    -------------------------------------------------------------------------*/
+    if ( !bSigMatch )
+    {
+            TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL: Cached packet does not match DPU Sig of the new STA - drop "
+        " DPU Sig %d  UC %d BC %d B %d",
+        uDPUSig,
+        pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig,
+        pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucUcastSig,
+        broadcast));
+
+      /* Drop packet */ 
+      vos_pkt_return_packet(vosTempBuff); 
+      vosTempBuff = vosDataBuff; 
+      continue; 
+
+    }/*if signature mismatch*/
+
+    /*------------------------------------------------------------------------
+      Check if BT-AMP frame:
+      - additional processing needed in this case to separate BT-AMP date
+        from BT-AMP Ctrl path 
+    ------------------------------------------------------------------------*/
+    if ( WLAN_STA_BT_AMP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType )
+    {
+      /*--------------------------------------------------------------------
+        Process the ctrl BAP frame; if data it will return false and it 
+        will be routed through the regular data path
+      --------------------------------------------------------------------*/
+      if ( WLANTL_ProcessBAPFrame( pvBDHeader,
+                                   vosTempBuff,
+                                   pTLCb,
+                                  &first_data_pkt_arrived,
+                                   ucSTAId))
+      {
+          vosTempBuff = vosDataBuff;
+          continue;
+        }
+      }/*if BT-AMP station*/
+      else if(selfBcastLoopback == VOS_TRUE)
+      { 
+        /* Drop packet */ 
+        vos_pkt_return_packet(vosTempBuff); 
+        vosTempBuff = vosDataBuff; 
+        continue; 
+      } 
+      
+      /*---------------------------------------------------------------------
+        Data packet received, send to state machine
+      ---------------------------------------------------------------------*/
+      wSTAEvent = WLANTL_RX_EVENT;
+
+      pfnSTAFsm = tlSTAFsm[pTLCb->atlSTAClients[ucSTAId].tlState].
+                      pfnSTATbl[wSTAEvent];
+
+      if ( NULL != pfnSTAFsm )
+      {
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+        /* Read RSSI and update */
+        vosStatus = WLANTL_HSHandleRXFrame(vos_get_global_context(
+                                         VOS_MODULE_ID_TL,pTLCb),
+                                           WLANTL_DATA_FRAME_TYPE,
+                                           pvBDHeader,
+                                           ucSTAId,
+                                           broadcast,
+                                           vosTempBuff);
+        broadcast = VOS_FALSE;
+#else
+        vosStatus = WLANTL_ReadRSSI(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), pvBDHeader, ucSTAId);
+#endif /*FEATURE_WLAN_GEN6_ROAMING*/
+        if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+        {
+          TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "Handle RX Data Frame fail within Handoff support module"));
+          /* Do Not Drop packet at here 
+           * Revisit why HO module return fail
+          vos_pkt_return_packet(vosTempBuff);
+          vosTempBuff = vosDataBuff;
+          continue;
+           */
+        }
+        pfnSTAFsm( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), ucSTAId, 
+                 &vosTempBuff);
+      }
+      else
+      {
+        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
+                   ucSTAId, pTLCb->atlSTAClients[ucSTAId].tlState));
+        /* Drop packet */
+        vos_pkt_return_packet(vosTempBuff);
+        vosTempBuff = vosDataBuff;
+        continue;
+      }
+
+    vosTempBuff = vosDataBuff;
+  }/*while chain*/
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_RxCachedFrames */
+
+/*==========================================================================
+  FUNCTION    WLANTL_ResourceCB
+
+  DESCRIPTION
+    Called by the TL when it has packets available for transmission.
+
+  DEPENDENCIES
+    The TL must be registered with BAL before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ResourceCB
+(
+  v_PVOID_t       pvosGCtx,
+  v_U32_t         uCount
+)
+{
+   WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  pTLCb->uResCount = uCount;
+
+
+  /*-----------------------------------------------------------------------
+    Resume Tx if enough res and not suspended
+   -----------------------------------------------------------------------*/
+  if (( pTLCb->uResCount >=  WDA_TLI_MIN_RES_MF ) &&
+      ( 0 == pTLCb->ucTxSuspended ))
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+         "WLAN TL:Issuing Xmit start request to BAL for avail res ASYNC"));
+    return WDA_DS_StartXmit(pvosGCtx);
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ResourceCB */
+
+
+
+/*============================================================================
+                           TL STATE MACHINE
+============================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_STATxConn
+
+  DESCRIPTION
+    Transmit in connected state - only EAPOL and WAI packets allowed
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the tx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+   Other return values are possible coming from the called functions.
+   Please check API for additional info.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STATxConn
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+   v_U16_t              usPktLen;
+   VOS_STATUS           vosStatus;
+   v_MACADDR_t          vDestMacAddr;
+   vos_pkt_t*           vosDataBuff = NULL;
+   WLANTL_CbType*       pTLCb       = NULL;
+   WLANTL_MetaInfoType  tlMetaInfo;
+   v_U8_t               ucTypeSubtype = 0;
+   v_U8_t               ucTid;
+   v_U8_t               extraHeadSpace = 0;
+   v_U8_t               ucWDSEnabled = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+   TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn"));
+   *pvosDataBuff = NULL;
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*-------------------------------------------------------------------
+      Disable AC temporary - if successfull retrieve re-enable
+      The order is justified because of the possible scenario
+       - TL tryes to fetch packet for AC and it returns NULL
+       - TL analyzes the data it has received to see if there are
+       any more pkts available for AC -> if not TL will disable AC
+       - however it is possible that while analyzing results TL got
+       preempted by a pending indication where the mask was again set
+       TL will not check again and as a result when it resumes
+       execution it will disable AC
+       To prevent this the AC will be disabled here and if retrieve
+       is successfull it will be re-enabled
+  -------------------------------------------------------------------*/
+
+  pTLCb->atlSTAClients[ucSTAId].
+     aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0; 
+
+    /*You make an initial assumption that HDD has no more data and if the 
+      assumption was wrong you reset the flags to their original state
+     This will prevent from exposing a race condition between checking with HDD 
+     for packets and setting the flags to false*/
+  vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
+  pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
+
+  /*------------------------------------------------------------------------
+    Fetch tx packet from HDD
+   ------------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+  if (WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType && 
+     (!vos_concurrent_sessions_running()))
+  {
+#endif
+    // don't set 0. 
+    //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
+    vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTAFetchPkt( pvosGCtx,
+                                  &ucSTAId,
+                                  pTLCb->atlSTAClients[ucSTAId].ucCurrentAC,
+                                  &vosDataBuff, &tlMetaInfo );
+#ifdef WLAN_SOFTAP_FEATURE
+  }
+  else
+  {
+    //softap case
+    WLANTL_ACEnumType ucAC = pTLCb->uCurServedAC;
+    vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTAFetchPkt( pvosGCtx, 
+                               &ucSTAId,
+                               ucAC,
+                                                &vosDataBuff, &tlMetaInfo );
+  }
+#endif
+
+  if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:No more data at HDD status %d", vosStatus));
+    *pvosDataBuff = NULL;
+
+    /*--------------------------------------------------------------------
+    Reset AC for the serviced station to the highest priority AC
+    -> due to no more data at the station
+    Even if this AC is not supported by the station, correction will be
+    made in the main TL loop
+    --------------------------------------------------------------------*/
+    pTLCb->atlSTAClients[ucSTAId].ucCurrentAC     = WLANTL_AC_VO;
+    pTLCb->atlSTAClients[ucSTAId].ucCurrentWeight = 0;
+
+    return vosStatus;
+  }
+
+  /*There are still packets in HDD - set back the pending packets and 
+   the no more data assumption*/
+  vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
+  pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 0;
+
+   pTLCb->atlSTAClients[ucSTAId].
+     aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 1; 
+#ifdef WLAN_PERF 
+  vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, 
+                             (v_PVOID_t)0);
+
+#endif /*WLAN_PERF*/
+
+
+#ifdef FEATURE_WLAN_WAPI
+   /*------------------------------------------------------------------------
+    If the packet is neither an Eapol packet nor a WAI packet then drop it
+   ------------------------------------------------------------------------*/
+   if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai )
+   {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Only EAPOL or WAI packets allowed before authentication"));
+
+     /* Fail tx for packet */
+     pTLCb->atlSTAClients[ucSTAId].pfnSTATxComp( pvosGCtx, vosDataBuff,
+                                                VOS_STATUS_E_BADMSG);
+     vosDataBuff = NULL;
+     *pvosDataBuff = NULL;
+     return VOS_STATUS_SUCCESS;
+  }
+#else
+   if ( 0 == tlMetaInfo.ucIsEapol )
+  {
+     TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL:Received non EAPOL packet before authentication"));
+
+    /* Fail tx for packet */
+    pTLCb->atlSTAClients[ucSTAId].pfnSTATxComp( pvosGCtx, vosDataBuff,
+                                                VOS_STATUS_E_BADMSG);
+    vosDataBuff = NULL;
+    *pvosDataBuff = NULL;
+    return VOS_STATUS_SUCCESS;
+  }
+#endif /* FEATURE_WLAN_WAPI */
+
+  /*-------------------------------------------------------------------------
+   Check TID
+  -------------------------------------------------------------------------*/
+  ucTid     = tlMetaInfo.ucTID;
+
+  /*Make sure TID is valid*/
+  if ( WLANTL_TID_INVALID(ucTid)) 
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)", 
+             ucTid));
+     ucTid = 0; 
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Attaching BD header to pkt on WLANTL_STATxConn"));
+
+#ifdef FEATURE_WLAN_WAPI
+  /*------------------------------------------------------------------------
+    Translate 802.3 frame to 802.11 if Frame translation is enabled or if 
+    frame is a WAI frame.
+   ------------------------------------------------------------------------*/
+  if ( ( 1 == tlMetaInfo.ucIsWai ) ||
+       ( 0 == tlMetaInfo.ucDisableFrmXtl ) )
+#else
+  /*------------------------------------------------------------------------
+    Translate 802.3 frame to 802.11 if Frame translation is enabled 
+   ------------------------------------------------------------------------*/
+  if ( ( 0 == tlMetaInfo.ucDisableFrmXtl ) &&
+      ( 0 != pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucSwFrameTXXlation) )
+#endif //#ifdef FEATURE_WLAN_WAPI
+  {
+    vosStatus =  WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
+                                                    pTLCb, ucSTAId,
+                                                    tlMetaInfo.ucUP, &ucWDSEnabled, &extraHeadSpace);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Error when translating header WLANTL_STATxConn"));
+
+      return vosStatus;
+    }
+
+    tlMetaInfo.ucDisableFrmXtl = 1;
+  }
+
+  /*-------------------------------------------------------------------------
+    Call HAL to fill BD header
+   -------------------------------------------------------------------------*/
+  ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
+
+  if ( pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucQosEnabled )
+  {
+    ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
+  }
+
+
+  vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , &vDestMacAddr,
+                          tlMetaInfo.ucDisableFrmXtl, &usPktLen,
+                          pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucQosEnabled, ucWDSEnabled, 
+                          extraHeadSpace,
+                          ucTypeSubtype, &pTLCb->atlSTAClients[ucSTAId].wSTADesc.vSelfMACAddress,
+                          ucTid, HAL_TX_NO_ENCRYPTION_MASK,
+                          tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
+    *pvosDataBuff = NULL;
+    return vosStatus;
+  }
+
+  /*-----------------------------------------------------------------------
+    Update tx counter for BA session query for tx side
+    !1 - should this be done for EAPOL frames?
+    -----------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].auTxCount[ucTid]++;
+
+  vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+               (v_PVOID_t)pTLCb->atlSTAClients[ucSTAId].pfnSTATxComp );
+
+  /*------------------------------------------------------------------------
+    Save data to input pointer for TL core
+  ------------------------------------------------------------------------*/
+  *pvosDataBuff = vosDataBuff;
+  /*security frames cannot be delayed*/
+  pTLCb->bUrgent      = TRUE;
+
+#ifdef WLAN_SOFTAP_FEATURE
+  /* TX Statistics */
+  if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
+  {
+    /* This is TX UC frame */
+    pTLCb->atlSTAClients[ucSTAId].trafficStatistics.txUCFcnt++;
+    pTLCb->atlSTAClients[ucSTAId].trafficStatistics.txUCBcnt += usPktLen;
+  }
+#endif
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STATxConn */
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_STATxAuth
+
+  DESCRIPTION
+    Transmit in authenticated state - all data allowed
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the tx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+   Other return values are possible coming from the called functions.
+   Please check API for additional info.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STATxAuth
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+   v_U16_t               usPktLen;
+   VOS_STATUS            vosStatus;
+   v_MACADDR_t           vDestMacAddr;
+   vos_pkt_t*            vosDataBuff = NULL;
+   WLANTL_CbType*        pTLCb       = NULL;
+   WLANTL_MetaInfoType   tlMetaInfo;
+   v_U8_t                ucTypeSubtype = 0;
+   WLANTL_ACEnumType     ucAC;
+   WLANTL_ACEnumType     ucNextAC;
+   v_U8_t                ucTid;
+   v_U8_t                ucSwFrmXtl = 0;
+   v_U8_t                extraHeadSpace = 0;
+   WLANTL_STAClientType *pStaClient;
+   v_U8_t                ucWDSEnabled = 0;
+   v_U8_t                ucTxFlag   = 0; 
+   v_U8_t                ucACMask, i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid input params on WLANTL_STATxAuth TL %x DB %x",
+             pTLCb, pvosDataBuff));
+    if (NULL != pvosDataBuff)
+    {
+        *pvosDataBuff = NULL;
+    }
+    if(NULL != pTLCb)
+    {
+        pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
+    }
+    return VOS_STATUS_E_FAULT;
+  }
+
+  pStaClient = &pTLCb->atlSTAClients[ucSTAId];
+
+  vos_mem_zero(&tlMetaInfo, sizeof(tlMetaInfo));
+  /*------------------------------------------------------------------------
+    Fetch packet from HDD
+   ------------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+  if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
+      (!vos_concurrent_sessions_running()))
+  {
+#endif
+  ucAC = pStaClient->ucCurrentAC;
+
+  /*-------------------------------------------------------------------
+      Disable AC temporary - if successfull retrieve re-enable
+      The order is justified because of the possible scenario
+       - TL tryes to fetch packet for AC and it returns NULL
+       - TL analyzes the data it has received to see if there are
+       any more pkts available for AC -> if not TL will disable AC
+       - however it is possible that while analyzing results TL got
+       preempted by a pending indication where the mask was again set
+       TL will not check again and as a result when it resumes
+       execution it will disable AC
+       To prevent this the AC will be disabled here and if retrieve
+       is successfull it will be re-enabled
+  -------------------------------------------------------------------*/
+  pStaClient->aucACMask[pStaClient->ucCurrentAC] = 0; 
+
+  // don't reset it, as other AC queues in HDD may have packets
+  //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
+#ifdef WLAN_SOFTAP_FEATURE
+  }
+  else
+  {
+    //softap case
+    ucAC = pTLCb->uCurServedAC;
+    pStaClient->aucACMask[ucAC] = 0; 
+
+    //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
+  }
+#endif
+
+  WLAN_TL_AC_ARRAY_2_MASK( pStaClient, ucACMask, i); 
+#ifdef WLAN_SOFTAP_FEATURE
+    /*You make an initial assumption that HDD has no more data and if the 
+      assumption was wrong you reset the flags to their original state
+     This will prevent from exposing a race condition between checking with HDD 
+     for packets and setting the flags to false*/
+  if ( 0 == ucACMask )
+  {
+    vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
+    pStaClient->ucNoMoreData = 1;
+  }
+#endif
+
+  vosStatus = pStaClient->pfnSTAFetchPkt( pvosGCtx, 
+                               &ucSTAId,
+                               ucAC,
+                               &vosDataBuff, &tlMetaInfo );
+
+
+  if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
+  {
+
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL:Failed while attempting to fetch pkt from HDD %d",
+                   vosStatus);
+    *pvosDataBuff = NULL;
+    /*--------------------------------------------------------------------
+      Reset AC for the serviced station to the highest priority AC
+      -> due to no more data at the station
+      Even if this AC is not supported by the station, correction will be
+      made in the main TL loop
+    --------------------------------------------------------------------*/
+    pStaClient->ucCurrentAC     = WLANTL_AC_VO;
+    pStaClient->ucCurrentWeight = 0;
+
+    return vosStatus;
+  }
+
+#ifdef WLAN_SOFTAP_FEATURE
+  /*There are still packets in HDD - set back the pending packets and 
+   the no more data assumption*/
+  vos_atomic_set_U8( &pStaClient->ucPktPending, 1);
+  pStaClient->ucNoMoreData = 0;
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+  if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
+  {
+#endif
+  // don't need to set it, as we don't reset it in this function.
+  //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
+#ifdef WLAN_SOFTAP_FEATURE
+  }
+#endif
+
+#ifdef WLAN_PERF 
+   vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, 
+                       (v_PVOID_t)0);
+#endif /*WLAN_PERF*/
+
+   /*-------------------------------------------------------------------------
+    Check TID
+   -------------------------------------------------------------------------*/
+   ucTid     = tlMetaInfo.ucTID;
+
+  /*Make sure TID is valid*/
+  if ( WLANTL_TID_INVALID(ucTid)) 
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)", 
+             ucTid));
+     ucTid = 0; 
+  }
+
+  /*Save for UAPSD timer consideration*/
+  pStaClient->ucServicedAC = ucAC; 
+
+  if ( ucAC == pStaClient->ucCurrentAC ) 
+  {
+    pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
+    pStaClient->ucCurrentWeight--;
+  }
+  else
+  {
+    pStaClient->ucCurrentAC     = ucAC;
+    pStaClient->ucCurrentWeight = 
+                         pTLCb->tlConfigInfo.ucAcWeights[ucAC] - 1;
+
+    pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
+
+  }
+
+#ifdef WLAN_SOFTAP_FEATURE
+  if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
+  {
+#endif
+  if ( 0 == pStaClient->ucCurrentWeight ) 
+  {
+    WLANTL_ACEnumType tempAC = ucAC;
+    /*-----------------------------------------------------------------------
+       Choose next AC - !!! optimize me
+    -----------------------------------------------------------------------*/
+    while ( 0 != ucACMask ) 
+    {
+      ucNextAC = (WLANTL_ACEnumType)(( tempAC - 1 ) & WLANTL_MASK_AC); 
+      if ( 0 != pStaClient->aucACMask[ucNextAC] )
+      {
+         pStaClient->ucCurrentAC     = ucNextAC;
+         pStaClient->ucCurrentWeight = 
+                         pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
+
+         TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "WLAN TL: Changing serviced AC to: %d with Weight: %d",
+                    pStaClient->ucCurrentAC , 
+                    pStaClient->ucCurrentWeight));
+         break;
+      }
+      tempAC = ucNextAC;
+    }
+  }
+#ifdef WLAN_SOFTAP_FEATURE
+  }
+#endif
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Attaching BD header to pkt on WLANTL_STATxAuth"));
+
+  /*------------------------------------------------------------------------
+    Translate 802.3 frame to 802.11
+   ------------------------------------------------------------------------*/
+  if ( 0 == tlMetaInfo.ucDisableFrmXtl )
+  {
+     /* Needs frame translation */
+     // if the client has not enabled SW-only frame translation
+     // and if the frame is a unicast frame
+     //   (HW frame translation does not support multiple broadcast domains
+     //    so we use SW frame translation for broadcast/multicast frames)
+#ifdef FEATURE_WLAN_WAPI
+     // and if the frame is not a WAPI frame
+#endif
+     // then use HW_based frame translation
+
+     if ( ( 0 == pStaClient->wSTADesc.ucSwFrameTXXlation ) &&
+          ( 0 == tlMetaInfo.ucBcast ) &&
+          ( 0 == tlMetaInfo.ucMcast )
+#ifdef FEATURE_WLAN_WAPI
+          && ( tlMetaInfo.ucIsWai != 1 )
+#endif
+        )
+     {
+#ifdef WLAN_PERF 
+        v_U32_t uFastFwdOK = 0;
+
+        /* HW based translation. See if the frame could be fast forwarded */
+        WDA_TLI_FastHwFwdDataFrame( pvosGCtx, vosDataBuff , &vosStatus, 
+                                   &uFastFwdOK, &tlMetaInfo, &pStaClient->wSTADesc);
+
+        if( VOS_STATUS_SUCCESS == vosStatus )
+        {
+            if(uFastFwdOK)
+            {
+                /* Packet could be fast forwarded now */
+                vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, 
+                               (v_PVOID_t)pStaClient->pfnSTATxComp );
+
+                *pvosDataBuff = vosDataBuff;
+
+                /* TODO: Do we really need to update WLANTL_HSHandleTXFrame() 
+                   stats for every pkt? */
+                pStaClient->auTxCount[tlMetaInfo.ucTID]++;
+                return vosStatus;
+             }
+             /* can't be fast forwarded, fall through normal (slow) path. */
+        }
+        else
+        {
+
+            TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                       "WLAN TL:Failed while attempting to fastFwd BD %d", vosStatus));
+            *pvosDataBuff = NULL;
+            return vosStatus;
+        }
+#endif /*WLAN_PERF*/
+     }
+     else
+     {
+        /* SW based translation */
+
+#ifdef FEATURE_WLAN_WAPI
+       gUcIsWai = tlMetaInfo.ucIsWai,
+#endif
+
+       vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
+                                                   pTLCb, ucSTAId,
+                                                   tlMetaInfo.ucUP, &ucWDSEnabled, &extraHeadSpace);
+       if ( VOS_STATUS_SUCCESS != vosStatus )
+       {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                    "WLAN TL:Error when translating header WLANTL_STATxAuth"));
+          return vosStatus;
+       }
+
+       TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                    "WLAN TL software translation success \n"));
+       ucSwFrmXtl = 1;
+       tlMetaInfo.ucDisableFrmXtl = 1;
+    }
+  }
+
+  /*-------------------------------------------------------------------------
+    Call HAL to fill BD header
+   -------------------------------------------------------------------------*/
+  ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
+
+  if ( pStaClient->wSTADesc.ucQosEnabled ) 
+  {
+    ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
+  }
+
+  ucTxFlag  = (0 != pStaClient->wUAPSDInfo[ucAC].ucSet)?
+              HAL_TRIGGER_ENABLED_AC_MASK:0;
+
+#ifdef FEATURE_WLAN_WAPI
+  if ( pStaClient->wSTADesc.ucIsWapiSta == 1 )
+  {
+#ifdef LIBRA_WAPI_SUPPORT
+    ucTxFlag = ucTxFlag | HAL_WAPI_STA_MASK;
+#endif //LIBRA_WAPI_SUPPORT
+    if ( tlMetaInfo.ucIsWai == 1 ) 
+    {
+      ucTxFlag = ucTxFlag | HAL_TX_NO_ENCRYPTION_MASK;
+    }
+  }
+#endif /* FEATURE_WLAN_WAPI */
+
+  vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, 
+                     vosDataBuff , &vDestMacAddr,
+                     tlMetaInfo.ucDisableFrmXtl, &usPktLen,
+                     pStaClient->wSTADesc.ucQosEnabled, ucWDSEnabled, 
+                     extraHeadSpace,
+                     ucTypeSubtype, &pTLCb->atlSTAClients[ucSTAId].wSTADesc.vSelfMACAddress,
+                     ucTid, ucTxFlag, tlMetaInfo.usTimeStamp, 
+                     tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP );
+
+  if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "Fill TX BD Error status %d", vosStatus));
+
+    return vosStatus;
+  }
+
+#ifdef WLAN_SOFTAP_FEATURE
+  /* TX Statistics */
+  if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
+  {
+    /* This is TX UC frame */
+    pStaClient->trafficStatistics.txUCFcnt++;
+    pStaClient->trafficStatistics.txUCBcnt += usPktLen;
+  }
+#endif
+
+  /*-----------------------------------------------------------------------
+    Update tx counter for BA session query for tx side
+    -----------------------------------------------------------------------*/
+  pStaClient->auTxCount[ucTid]++;
+
+  /* This code is to send traffic with lower priority AC when we does not 
+     get admitted to send it. Today HAL does not downgrade AC so this code 
+     does not get executed.(In other words, HAL doesn’t change tid. The if 
+     statement is always false.)
+     NOTE: In the case of LA downgrade occurs in HDD (that was the change 
+     Phani made during WMM-AC plugfest). If WM & BMP also took this approach, 
+     then there will be no need for any AC downgrade logic in TL/WDI.   */
+#if 0
+  if (( ucTid != tlMetaInfo.ucTID ) &&
+      ( 0 != pStaClient->wSTADesc.ucQosEnabled ) && 
+      ( 0 != ucSwFrmXtl ))
+  {
+    /*---------------------------------------------------------------------
+      !! FIX me: Once downgrading is clear put in the proper change
+    ---------------------------------------------------------------------*/
+    ucQCOffset = WLANHAL_TX_BD_HEADER_SIZE + WLANTL_802_11_HEADER_LEN;
+
+    //!!!Fix this replace peek with extract 
+    vos_pkt_peek_data( vosDataBuff, ucQCOffset,(v_PVOID_t)&pucQosCtrl,
+                       sizeof(*pucQosCtrl));
+    *pucQosCtrl = ucTid; //? proper byte order
+  }
+#endif
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
+    *pvosDataBuff = NULL;
+    return vosStatus;
+  }
+
+  vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                   (v_PVOID_t)pStaClient->pfnSTATxComp );
+
+  *pvosDataBuff = vosDataBuff;
+
+  /*BE & BK can be delayed, VO and VI not frames cannot be delayed*/
+  if ( pStaClient->ucServicedAC > WLANTL_AC_BE ) 
+  {
+    pTLCb->bUrgent= TRUE;
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STATxAuth */
+
+/*==========================================================================
+  FUNCTION    WLANTL_STATxDisc
+
+  DESCRIPTION
+    Transmit in disconnected state - no data allowed
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the tx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STATxDisc
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+   WLANTL_CbType*        pTLCb       = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxAuth"));
+    *pvosDataBuff = NULL;
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Error
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+    "WLAN TL:Packet should not be transmitted in state disconnected ignoring"
+            " request"));
+
+  *pvosDataBuff = NULL;
+   pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
+   
+   //Should not be anything pending in disconnect state
+   vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STATxDisc */
+
+/*==========================================================================
+  FUNCTION    WLANTL_STARxConn
+
+  DESCRIPTION
+    Receive in connected state - only EAPOL
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the tx/rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STARxConn
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+   WLANTL_CbType*           pTLCb = NULL;
+   v_U16_t                  usEtherType = 0;
+   v_U16_t                  usPktLen;
+   v_U8_t                   ucMPDUHOffset;
+   v_U16_t                  usMPDUDOffset;
+   v_U16_t                  usMPDULen;
+   v_U8_t                   ucMPDUHLen;
+   v_U16_t                  usActualHLen = 0;
+   VOS_STATUS               vosStatus  = VOS_STATUS_SUCCESS;
+   vos_pkt_t*               vosDataBuff;
+   v_PVOID_t                aucBDHeader;
+   v_U8_t                   ucTid;
+   WLANTL_RxMetaInfoType    wRxMetaInfo;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_STARxConn"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract BD header and check if valid
+   ------------------------------------------------------------------------*/
+  vosStatus = WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
+
+  if ( NULL == aucBDHeader )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Cannot extract BD header"));
+    VOS_ASSERT( 0 );
+    return VOS_STATUS_E_FAULT;
+  }
+
+
+  ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
+  usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
+  usMPDULen     = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
+  ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
+  ucTid         = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
+
+  vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d",
+             ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen));
+
+    /*It will cut out the 802.11 header if not used*/
+  if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:BD header corrupted - dropping packet"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosDataBuff);
+    return VOS_STATUS_SUCCESS;
+  }
+
+  vosStatus = WLANTL_GetEtherType(aucBDHeader,vosDataBuff,ucMPDUHLen,&usEtherType);
+  
+  if( VOS_IS_STATUS_SUCCESS(vosStatus) )
+  {
+#ifdef FEATURE_WLAN_WAPI
+    /* If frame is neither an EAPOL frame nor a WAI frame then we drop the frame*/
+    /* TODO: Do we need a check to see if we are in WAPI mode? If not is it possible */
+    /* that we get an EAPOL packet in WAPI mode or vice versa? */
+    if ( WLANTL_LLC_8021X_TYPE  != usEtherType && WLANTL_LLC_WAI_TYPE  != usEtherType )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Frame not EAPOL or WAI - dropping"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosDataBuff);
+    }
+#else
+    if ( WLANTL_LLC_8021X_TYPE  != usEtherType )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Frame not EAPOL - dropping"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosDataBuff);
+    }
+#endif /* FEATURE_WLAN_WAPI */
+    else /* Frame is an EAPOL frame or a WAI frame*/  
+    {
+      if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
+         ( 0 != pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucSwFrameRXXlation))
+      {
+      if (usMPDUDOffset > ucMPDUHOffset)
+      {
+         usActualHLen = usMPDUDOffset - ucMPDUHOffset;
+      }
+
+      vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen, 
+                      ucMPDUHLen, pTLCb, ucSTAId);
+
+        if ( VOS_STATUS_SUCCESS != vosStatus ) 
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
+          /* Drop packet */
+          vos_pkt_return_packet(vosDataBuff);
+          return vosStatus;
+        }
+      }
+      /*-------------------------------------------------------------------
+      Increment receive counter
+      -------------------------------------------------------------------*/
+      pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
+
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid));
+
+      /*-------------------------------------------------------------------
+      !!!Assuming TID = UP mapping 
+      -------------------------------------------------------------------*/
+      wRxMetaInfo.ucUP = ucTid;
+
+#ifdef WLAN_SOFTAP_FEATURE
+      TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+               "WLAN TL %s:Sending data chain to station \n", __FUNCTION__));
+      if ( WLAN_STA_SOFTAP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType )
+      {
+        wRxMetaInfo.ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
+        pTLCb->atlSTAClients[ucSTAId].pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
+                                            &wRxMetaInfo );
+      }
+      else
+#endif
+      pTLCb->atlSTAClients[ucSTAId].pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
+                                            &wRxMetaInfo );
+    }/*EAPOL frame or WAI frame*/
+  }/*vos status success*/
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STARxConn */
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+  FUNCTION    WLANTL_FwdPktToHDD
+
+  DESCRIPTION
+    Determine the Destation Station ID and route the Frame to Upper Layer
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+WLANTL_FwdPktToHDD
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t*     pvosDataBuff,
+  v_U8_t          ucSTAId
+)
+{
+   v_MACADDR_t DestMacAddress;
+   v_MACADDR_t *pDestMacAddress = &DestMacAddress;
+   v_SIZE_t usMacAddSize = VOS_MAC_ADDR_SIZE;
+   WLANTL_CbType*           pTLCb = NULL;
+   vos_pkt_t*               vosDataBuff ;
+   VOS_STATUS               vosStatus = VOS_STATUS_SUCCESS;
+   v_U32_t                 STAMetaInfo;
+   vos_pkt_t*              vosNextDataBuff ;
+   v_U8_t                  ucDesSTAId;
+   WLANTL_RxMetaInfoType    wRxMetaInfo;
+
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = pvosDataBuff )))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_FwdPktToHdd"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_FwdPktToHdd"));
+    return VOS_STATUS_E_FAULT;
+  }
+   /* This the change required for SoftAp to handle Reordered Buffer. Since a STA
+      may have packets destined to multiple destinations we have to process each packet
+      at a time and determine its Destination. So the Voschain provided by Reorder code
+      is unchain and forwarded to Upper Layer after Determining the Destination */
+
+   vosDataBuff = pvosDataBuff;
+   while (vosDataBuff != NULL)
+   {
+      vos_pkt_walk_packet_chain( vosDataBuff, &vosNextDataBuff, 1/*true*/ );
+      vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                                 (v_PVOID_t *)&STAMetaInfo );
+      wRxMetaInfo.ucUP = (v_U8_t)(STAMetaInfo & WLANTL_AC_MASK);
+      ucDesSTAId = ((v_U8_t)STAMetaInfo) >> WLANTL_STAID_OFFSET; 
+       
+      vosStatus = vos_pkt_extract_data( vosDataBuff, 0, (v_VOID_t *)pDestMacAddress, &usMacAddSize);
+      if ( VOS_STATUS_SUCCESS != vosStatus )
+      {
+         TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL: recv corrupted data packet\n"));
+         vos_pkt_return_packet(vosDataBuff);
+         return vosStatus;
+      }
+
+      TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"station mac 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x \n",
+                       pDestMacAddress->bytes[0], pDestMacAddress->bytes[1], pDestMacAddress->bytes[2],
+                       pDestMacAddress->bytes[3], pDestMacAddress->bytes[4], pDestMacAddress->bytes[5]));
+
+      if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
+      {
+          // destination is mc/bc station
+          ucDesSTAId = WLAN_RX_BCMC_STA_ID;
+          TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
+                    "%s: BC/MC packet, id %d\n", __FUNCTION__, WLAN_RX_BCMC_STA_ID));
+      }
+      else
+      {
+         if (vos_is_macaddr_equal(pDestMacAddress, &pTLCb->atlSTAClients[ucSTAId].wSTADesc.vSelfMACAddress))
+         {
+            // destination is AP itself
+            ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
+            TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
+                     "%s: packet to AP itself, id %d\n", __FUNCTION__, WLAN_RX_SAP_SELF_STA_ID));
+         }
+         else if ( WLAN_MAX_STA_COUNT <= ucDesSTAId )
+         {
+            // destination station is something else
+            TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
+                 "%s: get an station index larger than WLAN_MAX_STA_COUNT %d\n", __FUNCTION__, ucDesSTAId));
+            ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
+         }
+
+         
+         //loopback unicast station comes here
+      }
+
+      wRxMetaInfo.ucUP = (v_U8_t)(STAMetaInfo & WLANTL_AC_MASK);
+      wRxMetaInfo.ucDesSTAId = ucDesSTAId;
+     
+   vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTARx( pvosGCtx, vosDataBuff, ucDesSTAId,
+                                            &wRxMetaInfo );
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL: failed to send pkt to HDD \n"));
+     vos_pkt_return_packet(vosDataBuff);
+     return vosStatus;
+   }
+      vosDataBuff = vosNextDataBuff;
+   }
+   return VOS_STATUS_SUCCESS;
+}
+#endif /* WLANTL_SOFTAP_FEATURE */ 
+
+/*==========================================================================
+  FUNCTION    WLANTL_STARxAuth
+
+  DESCRIPTION
+    Receive in authenticated state - all data allowed
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STARxAuth
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+   WLANTL_CbType*           pTLCb = NULL;
+   v_U8_t                   ucAsf; /* AMSDU sub frame */
+   v_U16_t                  usMPDUDOffset;
+   v_U8_t                   ucMPDUHOffset;
+   v_U16_t                  usMPDULen;
+   v_U8_t                   ucMPDUHLen;
+   v_U16_t                  usActualHLen = 0;   
+   v_U8_t                   ucTid;
+#ifdef FEATURE_WLAN_WAPI
+   v_U16_t                  usEtherType;
+#endif
+   v_U16_t                  usPktLen;
+   vos_pkt_t*               vosDataBuff ;
+   v_PVOID_t                aucBDHeader;
+   VOS_STATUS               vosStatus;
+   WLANTL_RxMetaInfoType    wRxMetaInfo;
+   static v_U8_t            ucPMPDUHLen = 0;
+#ifdef WLAN_SOFTAP_FEATURE
+   v_U8_t*                  STAMetaInfoPtr;
+#endif
+#ifdef ANI_CHIPSET_VOLANS
+   v_U8_t                   ucEsf=0; /* first subframe of AMSDU flag */
+   v_U64_t                  ullcurrentReplayCounter=0; /*current replay counter*/
+   v_U64_t                  ullpreviousReplayCounter=0; /*previous replay counter*/
+   v_U16_t                  ucUnicastBroadcastType=0; /*It denotes whether received frame is UC or BC*/
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_STARxAuth"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STARxAuth"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract BD header and check if valid
+   ------------------------------------------------------------------------*/
+  WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
+
+  ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
+  usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
+  usMPDULen     = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
+  ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
+  ucTid         = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
+
+#ifdef ANI_CHIPSET_VOLANS
+  /*Host based replay check is needed for unicast data frames*/
+  ucUnicastBroadcastType  = (v_U16_t)WDA_IS_RX_BCAST(aucBDHeader);
+#endif
+  if(0 != ucMPDUHLen)
+  {
+    ucPMPDUHLen = ucMPDUHLen;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
+             " Tid %d BD %d",
+             ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
+             WLANHAL_RX_BD_HEADER_SIZE));
+
+  vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
+
+  if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
+  {
+    if((WDA_GET_RX_ASF(aucBDHeader) && !WDA_GET_RX_ESF(aucBDHeader)))
+  {
+    /* AMSDU case, ucMPDUHOffset = 0
+     * it should be hancdled seperatly */
+    if(( usMPDUDOffset >  ucMPDUHOffset ) &&
+       ( usMPDULen     >= ucMPDUHLen ) && ( usPktLen >= usMPDULen ) &&
+       ( !WLANTL_TID_INVALID(ucTid) ))
+    {
+        ucMPDUHOffset = usMPDUDOffset - WLANTL_MPDU_HEADER_LEN; 
+    }
+    else
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL:BD header corrupted - dropping packet"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosDataBuff);
+      return VOS_STATUS_SUCCESS;
+    }
+  }
+  else
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+              "WLAN TL:BD header corrupted - dropping packet"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosDataBuff);
+    return VOS_STATUS_SUCCESS;
+  }
+  }
+
+#ifdef FEATURE_WLAN_WAPI
+  if ( pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucIsWapiSta )
+  {
+    vosStatus = WLANTL_GetEtherType(aucBDHeader, vosDataBuff, ucMPDUHLen, &usEtherType);
+    if( VOS_IS_STATUS_SUCCESS(vosStatus) )
+    {
+      if ( WLANTL_LLC_WAI_TYPE  == usEtherType )
+      {        
+        if ( !( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader)) )
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                     "WLAN TL:WAI frame was received encrypted - dropping"));
+          /* Drop packet */
+          /*Temporary fix added to fix wapi rekey issue*/
+          //vos_pkt_return_packet(vosDataBuff);
+          //return vosStatus; //returning success
+        }
+      }
+      else
+      {
+        if (  WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader) ) 
+        {
+          TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                     "WLAN TL:Non-WAI frame was received unencrypted - dropping"));
+          /* Drop packet */
+          vos_pkt_return_packet(vosDataBuff); 
+          return vosStatus; //returning success
+        }
+      }
+    }
+    else //could not extract EtherType - this should not happen
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Could not extract EtherType -dropping frame"));
+      /* Drop packet */
+      vos_pkt_return_packet(vosDataBuff); 
+      return vosStatus; //returning failure
+        
+    }
+  }
+#endif /* FEATURE_WLAN_WAPI */
+
+  /*----------------------------------------------------------------------
+    Increment receive counter
+    !! not sure this is the best place to increase this - pkt might be
+    dropped below or delayed in TL's queues
+    - will leave it here for now
+   ------------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
+
+  /*------------------------------------------------------------------------
+    Check if AMSDU and send for processing if so
+   ------------------------------------------------------------------------*/
+  ucAsf = (v_U8_t)WDA_GET_RX_ASF(aucBDHeader);
+
+  if ( 0 != ucAsf )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Packet is AMSDU sub frame - sending for completion"));
+    vosStatus = WLANTL_AMSDUProcess( pvosGCtx, &vosDataBuff, aucBDHeader, ucSTAId,
+                         ucMPDUHLen, usMPDULen );
+    if(NULL == vosDataBuff)
+    {
+       //Packet is alrady freed
+       return VOS_STATUS_SUCCESS;
+    }
+  }
+  /* After AMSDU header handled
+   * AMSDU frame just same with normal frames */
+    /*-------------------------------------------------------------------
+      Translating header if necesary
+       !! Fix me: rmv comments below
+    ----------------------------------------------------------------------*/
+  if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
+      ( 0 != pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucSwFrameRXXlation) &&
+      ( WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)) ))
+  {
+    if(0 == ucMPDUHLen)
+    {
+      ucMPDUHLen = ucPMPDUHLen;
+    }
+    if (usMPDUDOffset > ucMPDUHOffset)
+    {
+      usActualHLen = usMPDUDOffset - ucMPDUHOffset;
+    }
+    vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen, 
+                        ucMPDUHLen, pTLCb, ucSTAId);
+
+      if ( VOS_STATUS_SUCCESS != vosStatus )
+      {
+        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
+        /* Drop packet */
+        vos_pkt_return_packet(vosDataBuff);
+        return vosStatus;
+      }
+    }
+    /* Softap requires additional Info such as Destination STAID and Access
+       Category. Voschain or Buffer returned by BA would be unchain and this
+       Meta Data would help in routing the packets to appropriate Destination */
+#ifdef WLAN_SOFTAP_FEATURE
+    if( WLAN_STA_SOFTAP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType)
+    {
+       STAMetaInfoPtr = (v_U8_t *)(ucTid | (WDA_GET_RX_ADDR3_IDX(aucBDHeader) << WLANTL_STAID_OFFSET));
+       vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
+                                 (v_PVOID_t)STAMetaInfoPtr);
+    }
+#endif
+
+  /*------------------------------------------------------------------------
+    Check to see if re-ordering session is in place
+   ------------------------------------------------------------------------*/
+  if ( 0 != pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists )
+  {
+    WLANTL_MSDUReorder( pTLCb, &vosDataBuff, aucBDHeader, ucSTAId, ucTid );
+  }
+
+#ifdef ANI_CHIPSET_VOLANS
+if(0 == ucUnicastBroadcastType
+#ifdef FEATURE_ON_CHIP_REORDERING
+   && (WLANHAL_IsOnChipReorderingEnabledForTID(pvosGCtx, ucSTAId, ucTid) != TRUE)
+#endif
+)
+{
+  /* replay check code : check whether replay check is needed or not */
+  if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+  {
+      /* replay check is needed for the station */
+
+      /* check whether frame is AMSDU frame */
+      if ( 0 != ucAsf )
+      {
+          /* Since virgo can't send AMSDU frames this leg of the code 
+             was not tested properly, it needs to be tested properly*/
+          /* Frame is AMSDU frame. As per 802.11n only first
+             subframe will have replay counter */
+          ucEsf =  WDA_GET_RX_ESF( aucBDHeader );
+          if( 0 != ucEsf )
+          {
+              v_BOOL_t status;
+              /* Getting 48-bit replay counter from the RX BD */
+              ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
+ 
+              VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL: AMSDU currentReplayCounter [0x%llX]\n",ullcurrentReplayCounter);
+              
+              /* Getting 48-bit previous replay counter from TL control  block */
+              ullpreviousReplayCounter = pTLCb->atlSTAClients[ucSTAId].ullReplayCounter[ucTid];
+
+              VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL: AMSDU previousReplayCounter [0x%llX]\n",ullpreviousReplayCounter);
+
+              /* It is first subframe of AMSDU thus it
+                 conatains replay counter perform the
+                 replay check for this first subframe*/
+              status =  WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
+              if(VOS_FALSE == status)
+              {
+                   /* Not a replay paket, update previous replay counter in TL CB */    
+                   pTLCb->atlSTAClients[ucSTAId].ullReplayCounter[ucTid] = ullcurrentReplayCounter;
+              }
+              else
+              {
+                  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: AMSDU Drop the replay packet with PN : [0x%llX]\n",ullcurrentReplayCounter);
+
+                  pTLCb->atlSTAClients[ucSTAId].ulTotalReplayPacketsDetected++;
+                  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: AMSDU total dropped replay packets on STA ID  %X is [0x%lX]\n",
+                  ucSTAId,  pTLCb->atlSTAClients[ucSTAId].ulTotalReplayPacketsDetected);
+
+                  /* Drop the packet */
+                  vos_pkt_return_packet(vosDataBuff);
+                  return VOS_STATUS_SUCCESS;
+              }
+          }
+      }
+      else
+      {
+           v_BOOL_t status;
+
+           /* Getting 48-bit replay counter from the RX BD */
+           ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
+
+           VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+             "WLAN TL: Non-AMSDU currentReplayCounter [0x%llX]\n",ullcurrentReplayCounter);
+
+           /* Getting 48-bit previous replay counter from TL control  block */
+           ullpreviousReplayCounter = pTLCb->atlSTAClients[ucSTAId].ullReplayCounter[ucTid];
+
+           VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL: Non-AMSDU previousReplayCounter [0x%llX]\n",ullpreviousReplayCounter);
+
+           /* It is not AMSDU frame so perform 
+              reaply check for each packet, as
+              each packet contains valid replay counter*/ 
+           status =  WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
+           if(VOS_FALSE == status)
+           {
+                /* Not a replay paket, update previous replay counter in TL CB */    
+                pTLCb->atlSTAClients[ucSTAId].ullReplayCounter[ucTid] = ullcurrentReplayCounter;
+           }
+           else
+           {
+              VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Non-AMSDU Drop the replay packet with PN : [0x%llX]\n",ullcurrentReplayCounter);
+
+               pTLCb->atlSTAClients[ucSTAId].ulTotalReplayPacketsDetected++;
+               VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL: Non-AMSDU total dropped replay packets on STA ID %X is [0x%lX]\n",
+                ucSTAId, pTLCb->atlSTAClients[ucSTAId].ulTotalReplayPacketsDetected);
+
+               /* Repaly packet, drop the packet */
+               vos_pkt_return_packet(vosDataBuff);
+               return VOS_STATUS_SUCCESS;
+           }
+      }
+  }
+}
+/*It is a broadast packet DPU has already done replay check for 
+  broadcast packets no need to do replay check of these packets*/
+#endif /*End of #ifdef ANI_CHIPSET_VOLANS*/
+
+  if ( NULL != vosDataBuff )
+  {
+#ifdef WLAN_SOFTAP_FEATURE
+    if( WLAN_STA_SOFTAP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType)
+    {
+      WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId );
+    }
+    else
+#endif
+    {
+      wRxMetaInfo.ucUP = ucTid;
+      pTLCb->atlSTAClients[ucSTAId].pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
+                                            &wRxMetaInfo );
+    }
+  }/* if not NULL */
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STARxAuth */
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_STARxDisc
+
+  DESCRIPTION
+    Receive in disconnected state - no data allowed
+
+  DEPENDENCIES
+    The STA must be registered with TL before this function can be called.
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STARxDisc
+(
+  v_PVOID_t     pvosGCtx,
+  v_U8_t        ucSTAId,
+  vos_pkt_t**   pvosDataBuff
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == pvosDataBuff ) || ( NULL ==  *pvosDataBuff ))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_STARxDisc"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Error - drop packet
+   ------------------------------------------------------------------------*/
+  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "WLAN TL:Packet should not be received in state disconnected"
+             " - dropping"));
+  vos_pkt_return_packet(*pvosDataBuff);
+  *pvosDataBuff = NULL;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_STARxDisc */
+
+/*==========================================================================
+      Processing main loops for MAIN and TX threads
+  ==========================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_McProcessMsg
+
+  DESCRIPTION
+    Called by VOSS when a message was serialized for TL through the
+    main thread/task.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_McProcessMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+)
+{
+   WLANTL_CbType*  pTLCb = NULL;
+   tAddBAInd*      ptAddBaInd = NULL;
+   tDelBAInd*      ptDelBaInd = NULL;
+   tAddBARsp*      ptAddBaRsp = NULL;
+   vos_msg_t       vosMessage;
+   VOS_STATUS      vosStatus;
+   tpFlushACRsp FlushACRspPtr;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == message )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_ProcessMainMessage"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+     "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ProcessMainMessage"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "WLAN TL:Received message: %d through main flow", message->type));
+
+  switch( message->type )
+  {
+  case WDA_TL_FLUSH_AC_RSP:
+    // Extract the message from the message body
+    FlushACRspPtr = (tpFlushACRsp)(message->bodyptr);
+    // Make sure the call back function is not null.
+    VOS_ASSERT(pTLCb->tlBAPClient.pfnFlushOpCompleteCb != NULL);
+
+    TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "Received message:  Flush complete received by TL"));
+
+    // Since we have the response back from HAL, just call the BAP client
+    // registered call back from TL. There is only 1 possible
+    // BAP client. So directly reference tlBAPClient
+    pTLCb->tlBAPClient.pfnFlushOpCompleteCb( pvosGCtx,
+            FlushACRspPtr->ucSTAId,
+            FlushACRspPtr->ucTid, FlushACRspPtr->status );
+
+    // Free the PAL memory, we are done with it.
+    TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "Flush complete received by TL: Freeing %p", FlushACRspPtr));
+    vos_mem_free((v_VOID_t *)FlushACRspPtr);
+    break;
+
+  case WDA_HDD_ADDBA_REQ:
+   ptAddBaInd = (tAddBAInd*)(message->bodyptr);
+    vosStatus = WLANTL_BaSessionAdd( pvosGCtx,
+                                 ptAddBaInd->baSession.baSessionID,
+                                     ptAddBaInd->baSession.STAID,
+                                     ptAddBaInd->baSession.baTID,
+                                 (v_U32_t)ptAddBaInd->baSession.baBufferSize,
+                                 ptAddBaInd->baSession.winSize,
+                                 ptAddBaInd->baSession.SSN);
+    ptAddBaRsp = vos_mem_malloc(sizeof(*ptAddBaRsp));
+
+    if ( NULL == ptAddBaRsp )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL: fatal failure, cannot allocate BA Rsp structure"));
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+    }
+
+    if ( VOS_STATUS_SUCCESS == vosStatus )
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL: Sending success indication to HAL for ADD BA"));
+      /*Send success*/
+      ptAddBaRsp->mesgType    = WDA_HDD_ADDBA_RSP;
+      vosMessage.type         = WDA_HDD_ADDBA_RSP;
+    }
+    else
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL: Sending failure indication to HAL for ADD BA"));
+
+      /*Send failure*/
+      ptAddBaRsp->mesgType    = WDA_BA_FAIL_IND;
+      vosMessage.type         = WDA_BA_FAIL_IND;
+    }
+
+    ptAddBaRsp->mesgLen     = sizeof(tAddBARsp);
+    ptAddBaRsp->baSessionID = ptAddBaInd->baSession.baSessionID;
+      /* This is default, reply win size has to be handled BA module, FIX THIS */
+      ptAddBaRsp->replyWinSize = WLANTL_MAX_WINSIZE;
+    vosMessage.bodyptr = ptAddBaRsp;
+
+    vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
+    WLANTL_McFreeMsg (pvosGCtx, message);
+  break;
+  case WDA_DELETEBA_IND:
+    ptDelBaInd = (tDelBAInd*)(message->bodyptr);
+    vosStatus  = WLANTL_BaSessionDel(pvosGCtx,
+                                 ptDelBaInd->staIdx,
+                                 ptDelBaInd->baTID);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL: Failed to del BA session STA:%d TID:%d Status :%d",
+               ptDelBaInd->staIdx,
+               ptDelBaInd->baTID,
+               vosStatus));
+    }
+    WLANTL_McFreeMsg (pvosGCtx, message);
+    break;
+  default:
+    /*no processing for now*/
+    break;
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_ProcessMainMessage */
+
+/*==========================================================================
+  FUNCTION    WLANTL_McFreeMsg
+
+  DESCRIPTION
+    Called by VOSS to free a given TL message on the Main thread when there
+    are messages pending in the queue when the whole system is been reset.
+    For now, TL does not allocate any body so this function shout translate
+    into a NOOP
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_McFreeMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+)
+{
+  WLANTL_CbType*  pTLCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == message )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_McFreeMsg"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+     "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_McFreeMsg"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "WLAN TL:Received message: %d through main free", message->type));
+
+  switch( message->type )
+  {
+  case WDA_HDD_ADDBA_REQ:
+  case WDA_DELETEBA_IND:
+    /*vos free body pointer*/
+    vos_mem_free(message->bodyptr);
+    message->bodyptr = NULL;
+    break;
+  default:
+    /*no processing for now*/
+    break;
+  }
+
+  return VOS_STATUS_SUCCESS;
+}/*WLANTL_McFreeMsg*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_TxProcessMsg
+
+  DESCRIPTION
+    Called by VOSS when a message was serialized for TL through the
+    tx thread/task.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  Other values can be returned as a result of a function call, please check
+  corresponding API for more info.
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxProcessMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+)
+{
+   VOS_STATUS      vosStatus = VOS_STATUS_SUCCESS;
+   v_U32_t         uData;
+   v_U8_t          ucSTAId; 
+   v_U8_t          ucUcastSig;
+   v_U8_t          ucBcastSig;
+#ifdef WLAN_SOFTAP_FEATURE
+   WLANTL_CbType*  pTLCb = NULL;
+   WLANTL_ACEnumType    ucAC;
+#endif
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+   void (*callbackRoutine) (void *callbackContext);
+   void *callbackContext;
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == message )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_ProcessTxMessage"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Process message
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Received message: %d through tx flow", message->type));
+
+  switch( message->type )
+  {
+  case WLANTL_TX_SIG_SUSPEND:
+    vosStatus = WLANTL_SuspendCB( pvosGCtx,
+                                 (WLANTL_SuspendCBType)message->bodyptr,
+                                 message->reserved);
+    break;
+  case WLANTL_TX_RES_NEEDED:
+    vosStatus = WLANTL_GetTxResourcesCB( pvosGCtx );
+     break;
+  
+  case WLANTL_TX_FWD_CACHED:
+    /*---------------------------------------------------------------------
+     The data sent with the message has the following structure: 
+       | 00 | ucBcastSignature | ucUcastSignature | ucSTAID |
+       each field above is one byte
+    ---------------------------------------------------------------------*/
+    uData       = (v_U32_t)message->bodyptr; 
+    ucSTAId     = ( uData & 0x000000FF); 
+    ucUcastSig  = ( uData & 0x0000FF00)>>8; 
+    ucBcastSig  = (v_U8_t)(( uData & 0x00FF0000)>>16); 
+    vosStatus   = WLANTL_ForwardSTAFrames( pvosGCtx, ucSTAId, 
+                                           ucUcastSig, ucBcastSig);
+    break;
+#ifdef WLAN_SOFTAP_FEATURE
+  case WLANTL_TX_STAID_AC_IND:
+      pTLCb = VOS_GET_TL_CB(pvosGCtx);
+      if ( NULL == pTLCb )
+      {
+         TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending"));
+         return VOS_STATUS_E_FAULT;
+      }
+
+      ucAC = message->bodyval &  WLANTL_AC_MASK;
+      ucSTAId = (v_U8_t)message->bodyval >> WLANTL_STAID_OFFSET;  
+      pTLCb->atlSTAClients[ucSTAId].aucACMask[ucAC] = 1; 
+
+      vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
+      vosStatus = WDA_DS_StartXmit(pvosGCtx);
+      break;
+#endif 
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  case WDA_DS_TX_START_XMIT:
+
+    vosStatus = WDA_DS_TxFrames( pvosGCtx );
+
+      break;
+
+  case WDA_DS_FINISH_ULA:
+    callbackContext = (void *)message->bodyval;
+   
+    callbackRoutine = message->bodyptr;
+    callbackRoutine(callbackContext);
+    break;
+#endif
+
+  default:
+    /*no processing for now*/
+    break;
+  }
+
+  return vosStatus;
+}/* WLANTL_TxProcessMsg */
+
+/*==========================================================================
+  FUNCTION    WLANTL_McFreeMsg
+
+  DESCRIPTION
+    Called by VOSS to free a given TL message on the Main thread when there
+    are messages pending in the queue when the whole system is been reset.
+    For now, TL does not allocate any body so this function shout translate
+    into a NOOP
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxFreeMsg
+(
+  v_PVOID_t        pvosGCtx,
+  vos_msg_t*       message
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*Nothing to do for now!!!*/
+  return VOS_STATUS_SUCCESS;
+}/*WLANTL_TxFreeMsg*/
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxFCFrame
+
+  DESCRIPTION
+    Internal utility function to send FC frame. Enable
+    or disable LWM mode based on the information.
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    FW sends up special flow control frame.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input pointers are NULL.
+    VOS_STATUS_E_FAULT:   Something is wrong.
+    VOS_STATUS_SUCCESS:   Everything is good.
+
+  SIDE EFFECTS
+    Newly formed FC frame is generated and waits to be transmitted. Previously unsent frame will
+    be released.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxFCFrame
+(
+  v_PVOID_t       pvosGCtx
+)
+{
+#if 0
+  WLANTL_CbType*      pTLCb = NULL;
+  VOS_STATUS          vosStatus;
+  tpHalFcTxBd         pvFcTxBd = NULL;
+  vos_pkt_t *         pPacket = NULL;
+  v_U8_t              ucSTAId = 0;
+  v_U8_t              ucBitCheck = 1;
+
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+               "WLAN TL: Send FC frame %s", __FUNCTION__);
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    ------------------------------------------------------------------------*/
+  if ( NULL == pvosGCtx )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter %s", __FUNCTION__));
+    return VOS_STATUS_E_INVAL;
+  }
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+
+  if (NULL == pTLCb)
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid pointer in %s \n", __FUNCTION__));
+    return VOS_STATUS_E_INVAL;
+  }
+  
+  //Get one voss packet
+  vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, sizeof(tHalFcTxBd), 1, 
+                                    VOS_FALSE, NULL, NULL );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    return VOS_STATUS_E_INVAL;
+  }
+
+  vosStatus = vos_pkt_reserve_head( pPacket, (void *)&pvFcTxBd, sizeof(tHalFcTxBd));
+
+  if( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "%s: failed to reserve FC TX BD %d\n",__FUNCTION__, sizeof(tHalFcTxBd)));
+    vos_pkt_return_packet( pPacket );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  //Generate most recent tlFCInfo. Most fields are correct.
+  pTLCb->tlFCInfo.fcSTAThreshEnabledMask = 0;
+  pTLCb->tlFCInfo.fcSTATxMoreDataMask = 0;
+  for( ucSTAId = 0, ucBitCheck = 1 ; ucSTAId < WLAN_MAX_STA_COUNT; ucBitCheck <<= 1, ucSTAId ++)
+  {
+    if (0 == pTLCb->atlSTAClients[ucSTAId].ucExists)
+    {
+      continue;
+    }
+
+    if (pTLCb->atlSTAClients[ucSTAId].ucPktPending)
+    {
+      pTLCb->tlFCInfo.fcSTATxMoreDataMask |= ucBitCheck;
+    }
+
+    if ( (pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled) &&
+         (pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed > pTLCb->atlSTAClients[ucSTAId].uLwmThreshold))
+    {
+      pTLCb->tlFCInfo.fcSTAThreshEnabledMask |= ucBitCheck;
+
+      pTLCb->tlFCInfo.fcSTAThresh[ucSTAId] = (tANI_U8)pTLCb->atlSTAClients[ucSTAId].uLwmThreshold;
+
+      pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = FALSE;
+    }
+
+  }
+  
+  //request immediate feedback
+  pTLCb->tlFCInfo.fcConfig |= 0x4;                               
+
+  //fill in BD to sent
+  vosStatus = WLANHAL_FillFcTxBd(pvosGCtx, &pTLCb->tlFCInfo, (void *)pvFcTxBd);
+
+  if( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Fill FC TX BD unsuccessful\n", __FUNCTION__));
+    vos_pkt_return_packet( pPacket );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if (NULL != pTLCb->vosTxFCBuf)
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "%s: Previous FC TX BD not sent\n", __FUNCTION__));
+    vos_pkt_return_packet(pTLCb->vosTxFCBuf);
+  }
+
+  pTLCb->vosTxFCBuf = pPacket;
+
+  vos_pkt_set_user_data_ptr( pPacket, VOS_PKT_USER_DATA_ID_TL,
+                               (v_PVOID_t)WLANTL_TxCompDefaultCb);
+  vosStatus = WDA_DS_StartXmit(pvosGCtx);
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL: send FC frame leave %s", __FUNCTION__));
+#endif
+  return VOS_STATUS_SUCCESS;
+}
+
+#endif
+
+/*==========================================================================
+  FUNCTION    WLANTL_GetTxResourcesCB
+
+  DESCRIPTION
+    Processing function for Resource needed signal. A request will be issued
+    to BAL to get more tx resources.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  Other values can be returned as a result of a function call, please check
+  corresponding API for more info.
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetTxResourcesCB
+(
+  v_PVOID_t        pvosGCtx
+)
+{
+  WLANTL_CbType*  pTLCb      = NULL;
+  v_U32_t         uResCount  = WDA_TLI_MIN_RES_DATA;
+  VOS_STATUS      vosStatus  = VOS_STATUS_SUCCESS;
+  v_U8_t          ucMgmt     = 0;
+  v_U8_t          ucBAP      = 0;
+  v_U8_t          ucData     = 0;
+#ifdef WLAN_SOFTAP_FEATURE
+#ifdef WLAN_SOFTAP_FLOWCTRL_EN
+  tBssSystemRole systemRole;
+  tpAniSirGlobal pMac;
+#endif
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+  /*------------------------------------------------------------------------
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid TL pointer from pvosGCtx on"
+               " WLANTL_ProcessTxMessage"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Get tx resources from BAL
+   ------------------------------------------------------------------------*/
+  vosStatus = WDA_DS_GetTxResources( pvosGCtx, &uResCount );
+
+  if ( (VOS_STATUS_SUCCESS != vosStatus) && (VOS_STATUS_E_RESOURCES != vosStatus))
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:TL failed to get resources from BAL, Err: %d",
+               vosStatus));
+    return vosStatus;
+  }
+
+  /* Currently only Linux BAL returns the E_RESOURCES error code when it is running 
+     out of BD/PDUs. To make use of this interrupt for throughput enhancement, similar
+     changes should be done in BAL code of AMSS and WM */
+  if (VOS_STATUS_E_RESOURCES == vosStatus)
+  {
+#ifdef VOLANS_PERF
+     WLANHAL_EnableIdleBdPduInterrupt(pvosGCtx, (tANI_U8)bdPduInterruptGetThreshold);
+     VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL: Enabling Idle BD/PDU interrupt, Current resources = %d", uResCount);
+#else
+    return VOS_STATUS_E_FAILURE;
+#endif
+  }
+
+  pTLCb->uResCount = uResCount;
+  
+
+#ifdef WLAN_SOFTAP_FEATURE
+#ifdef WLAN_SOFTAP_FLOWCTRL_EN
+  /* FIXME: disabled since creating issues in power-save, needs to be addressed */ 
+  pTLCb->sendFCFrame ++;
+  pMac = vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx);
+  systemRole = wdaGetGlobalSystemRole(pMac);
+  if (eSYSTEM_AP_ROLE == systemRole)
+  {
+     if (pTLCb->sendFCFrame % 16 == 0)
+     {
+         TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "Transmit FC"));
+         WLANTL_TxFCFrame (pvosGCtx);
+     } 
+  }
+#endif //WLAN_SOFTAP_FLOWCTRL_EN 
+#endif //WLAN_SOFTAP_FEATURE
+
+  ucData = ( pTLCb->uResCount >=  WDA_TLI_MIN_RES_DATA );
+  ucBAP  = ( pTLCb->uResCount >=  WDA_TLI_MIN_RES_BAP ) &&
+           ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff );
+  ucMgmt = ( pTLCb->uResCount >=  WDA_TLI_MIN_RES_MF ) &&
+           ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff );
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL: Eval Resume tx Res: %d DATA: %d BAP: %d MGMT: %d",
+             pTLCb->uResCount, ucData, ucBAP, ucMgmt));
+
+  if (( 0 == pTLCb->ucTxSuspended ) &&
+      (( 0 != ucData ) || ( 0 != ucMgmt ) || ( 0 != ucBAP ) ) )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "Issuing Xmit start request to BAL for avail res SYNC"));
+    vosStatus =WDA_DS_StartXmit(pvosGCtx);
+  }
+  return vosStatus;
+}/*WLANTL_GetTxResourcesCB*/
+
+/*==========================================================================
+      Utility functions
+  ==========================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_Translate8023To80211Header
+
+  DESCRIPTION
+    Inline function for translating and 802.11 header into an 802.3 header.
+
+  DEPENDENCIES
+
+
+  PARAMETERS
+
+   IN
+    pTLCb:            TL control block
+    ucStaId:          station ID
+
+   IN/OUT
+    vosDataBuff:      vos data buffer, will contain the new header on output
+
+   OUT
+    pvosStatus:       status of the operation
+
+  RETURN VALUE
+
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+    Other error codes might be returned from the vos api used in the function
+    please check those return values.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Translate8023To80211Header
+(
+  vos_pkt_t*      vosDataBuff,
+  VOS_STATUS*     pvosStatus,
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucStaId,
+  v_U8_t          ucUP,
+  v_U8_t          *ucWDSEnabled,
+  v_U8_t          *extraHeadSpace
+)
+{
+  WLANTL_8023HeaderType  w8023Header;
+  WLANTL_80211HeaderType *pw80211Header; // Allocate an aligned BD and then fill it. 
+  VOS_STATUS             vosStatus;
+  v_U8_t                 MandatoryucHeaderSize = WLAN80211_MANDATORY_HEADER_SIZE;
+  v_U8_t                 ucHeaderSize = 0;
+  v_VOID_t               *ppvBDHeader = NULL;
+#ifdef WLAN_SOFTAP_FEATURE
+  v_U8_t                 ucQoSOffset = WLAN80211_MANDATORY_HEADER_SIZE;
+#endif
+
+  *ucWDSEnabled = 0; // default WDS off.
+  vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header,
+                                sizeof(w8023Header));
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+     "WLAN TL: Packet pop header fails on WLANTL_Translate8023To80211Header"));
+     return vosStatus;
+  }
+
+
+  if ( 0 != pTLCb->atlSTAClients[ucStaId].wSTADesc.ucAddRmvLLC )
+  {
+    /* Push the length */
+    vosStatus = vos_pkt_push_head(vosDataBuff,
+                    &w8023Header.usLenType, sizeof(w8023Header.usLenType));
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: Packet push ether type fails on"
+                  " WLANTL_Translate8023To80211Header"));
+       return vosStatus;
+    }
+
+#ifdef BTAMP_TEST
+    // The STA side will execute this, a hack to test BTAMP by using the
+    // infra setup. On real BTAMP this will come from BAP itself.
+    {
+    static v_U8_t WLANTL_BT_AMP_LLC_HEADER[] =  {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 };
+    vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_BT_AMP_LLC_HEADER,
+                       sizeof(WLANTL_BT_AMP_LLC_HEADER));
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL: Packet push LLC header fails on"
+                  " WLANTL_Translate8023To80211Header"));
+       return vosStatus;
+    }
+    }
+#else
+    vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_LLC_HEADER,
+                       sizeof(WLANTL_LLC_HEADER));
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL: Packet push LLC header fails on"
+                  " WLANTL_Translate8023To80211Header"));
+       return vosStatus;
+    }
+#endif
+  }/*If add LLC is enabled*/
+  else
+  {
+       TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL: STA Client registered to not remove LLC"
+                  " WLANTL_Translate8023To80211Header"));
+  }
+
+#ifdef BTAMP_TEST
+  pTLCb->atlSTAClients[ucStaId].wSTADesc.wSTAType = WLAN_STA_BT_AMP;
+#endif
+
+  // Find the space required for the 802.11 header format
+  // based on the frame control fields.
+  ucHeaderSize = MandatoryucHeaderSize;
+  if (pTLCb->atlSTAClients[ucStaId].wSTADesc.ucQosEnabled)
+  {  
+    ucHeaderSize += sizeof(pw80211Header->usQosCtrl);
+  }
+  if (pTLCb->atlSTAClients[ucStaId].wSTADesc.wSTAType == WLAN_STA_BT_AMP)
+  {  
+    ucHeaderSize += sizeof(pw80211Header->optvA4);
+#ifdef WLAN_SOFTAP_FEATURE
+    ucQoSOffset += sizeof(pw80211Header->optvA4);
+#endif
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      " WLANTL_Translate8023To80211Header : Header size = %d ", ucHeaderSize));
+
+  vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, ucHeaderSize );
+  if ( NULL == ppvBDHeader )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:VOSS packet corrupted "));
+    *pvosStatus = VOS_STATUS_E_INVAL;
+    return *pvosStatus;
+  }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /* Check for alignment */
+  *extraHeadSpace = (v_U8_t)((((v_U32_t)(ppvBDHeader)) & 0x7) % 0x4);
+  if (*extraHeadSpace)
+  {
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL:VOSS reserving extra header space = %d", *extraHeadSpace));
+    vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, *extraHeadSpace );
+    if ( NULL == ppvBDHeader )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL:VOSS packet corrupted on Attach BD header while reserving extra header space"));
+      *pvosStatus = VOS_STATUS_E_INVAL;
+      return *pvosStatus;
+    }
+  }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+  // OK now we have the space. Fill the 80211 header
+  /* Fill A2 */
+  pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
+  // only clear the required space.
+  vos_mem_set( pw80211Header, ucHeaderSize, 0 );
+  vos_mem_copy( pw80211Header->vA2, w8023Header.vSA,  VOS_MAC_ADDR_SIZE);
+
+
+#ifdef FEATURE_WLAN_WAPI
+  if ( WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucStaId].tlState && gUcIsWai != 1 )
+#else
+  if ( WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucStaId].tlState )
+#endif
+  {
+    pw80211Header->wFrmCtrl.wep =
+                 pTLCb->atlSTAClients[ucStaId].wSTADesc.ucProtectedFrame;
+  }
+
+  pw80211Header->usDurationId = 0;
+  pw80211Header->usSeqCtrl    = 0;
+
+  pw80211Header->wFrmCtrl.type     = WLANTL_80211_DATA_TYPE;
+
+
+
+  if(pTLCb->atlSTAClients[ucStaId].wSTADesc.ucQosEnabled)
+  {
+      pw80211Header->wFrmCtrl.subType  = WLANTL_80211_DATA_QOS_SUBTYPE;
+
+#ifdef WLAN_SOFTAP_FEATURE
+      *((v_U16_t *)((v_U8_t *)ppvBDHeader + ucQoSOffset)) = ucUP;
+#else
+      pw80211Header->usQosCtrl = ucUP;
+#endif
+
+  }
+  else
+  {
+      pw80211Header->wFrmCtrl.subType  = 0;
+
+  // NO NO NO - there is not enough memory allocated to write the QOS ctrl  
+  // field, it will overwrite the first 2 bytes of the data packet(LLC header)
+  // pw80211Header->usQosCtrl         = 0;
+  }
+
+
+  switch( pTLCb->atlSTAClients[ucStaId].wSTADesc.wSTAType )
+  {
+      case WLAN_STA_IBSS:
+        pw80211Header->wFrmCtrl.toDS          = 0;
+        pw80211Header->wFrmCtrl.fromDS        = 0;
+        /*Fix me*/
+        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSTAMACAddress);
+        vos_mem_copy( pw80211Header->vA3,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vBSSIDforIBSS ,
+              VOS_MAC_ADDR_SIZE);
+        break;
+
+      case WLAN_STA_BT_AMP:
+        *ucWDSEnabled = 1; // WDS on.
+        pw80211Header->wFrmCtrl.toDS          = 1;
+        pw80211Header->wFrmCtrl.fromDS        = 1;
+        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSTAMACAddress);
+        vos_mem_copy( pw80211Header->vA2,
+                w8023Header.vSA, VOS_MAC_ADDR_SIZE);
+        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA3,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSTAMACAddress);
+        /* fill the optional A4 header */
+        vos_mem_copy( pw80211Header->optvA4,
+                w8023Header.vSA, VOS_MAC_ADDR_SIZE);
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "BTAMP CASE NOW ---------staid=%d\n",
+            ucStaId));
+        break;
+
+#ifdef WLAN_SOFTAP_FEATURE
+      case WLAN_STA_SOFTAP:
+        *ucWDSEnabled = 0; // WDS off.
+        pw80211Header->wFrmCtrl.toDS          = 0;
+        pw80211Header->wFrmCtrl.fromDS        = 1;
+        /*Copy the DA to A1*/
+        vos_mem_copy( pw80211Header->vA1, w8023Header.vDA , VOS_MAC_ADDR_SIZE);   
+        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA2,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSelfMACAddress);
+        vos_mem_copy( pw80211Header->vA3,
+                w8023Header.vSA, VOS_MAC_ADDR_SIZE);
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "sw 802 to 80211 softap case  ---------staid=%d\n",
+            ucStaId));
+        break;
+#endif
+
+      case WLAN_STA_INFRA:
+      default:
+        pw80211Header->wFrmCtrl.toDS          = 1;
+        pw80211Header->wFrmCtrl.fromDS        = 0;
+        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
+              &pTLCb->atlSTAClients[ucStaId].wSTADesc.vSTAMACAddress);
+        vos_mem_copy( pw80211Header->vA3, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+            "REGULAR INFRA LINK CASE---------staid=%d\n",
+            ucStaId));
+        break;
+  }
+  // OK now we have the space. Fill the 80211 header
+  /* Fill A2 */
+  pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
+  return VOS_STATUS_SUCCESS;
+}/*WLANTL_Translate8023To80211Header*/
+
+
+/*=============================================================================
+   BEGIN LOG FUNCTION    !!! Remove me or clean me
+=============================================================================*/
+#ifdef WLANTL_DEBUG 
+
+#define WLANTL_DEBUG_FRAME_BYTE_PER_LINE    16
+#define WLANTL_DEBUG_FRAME_BYTE_PER_BYTE    4
+
+static v_VOID_t WLANTL_DebugFrame
+(
+   v_PVOID_t   dataPointer,
+   v_U32_t     dataSize
+)
+{
+   v_U8_t   lineBuffer[WLANTL_DEBUG_FRAME_BYTE_PER_LINE];
+   v_U32_t  numLines;
+   v_U32_t  numBytes;
+   v_U32_t  idx;
+   v_U8_t   *linePointer;
+
+   numLines = dataSize / WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
+   numBytes = dataSize % WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
+   linePointer = (v_U8_t *)dataPointer;
+
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Frame Debug Frame Size %d, Pointer 0x%p", dataSize, dataPointer));
+   for(idx = 0; idx < numLines; idx++)
+   {
+      memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
+      memcpy(lineBuffer, linePointer, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x",
+                 lineBuffer[0], lineBuffer[1], lineBuffer[2], lineBuffer[3], lineBuffer[4], lineBuffer[5], lineBuffer[6], lineBuffer[7],
+                 lineBuffer[8], lineBuffer[9], lineBuffer[10], lineBuffer[11], lineBuffer[12], lineBuffer[13], lineBuffer[14], lineBuffer[15]));
+      linePointer += WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
+   }
+
+   if(0 == numBytes)
+      return;
+
+   memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
+   memcpy(lineBuffer, linePointer, numBytes);
+   for(idx = 0; idx < WLANTL_DEBUG_FRAME_BYTE_PER_LINE / WLANTL_DEBUG_FRAME_BYTE_PER_BYTE; idx++)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x",
+                lineBuffer[idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[1 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE],
+                lineBuffer[2 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[3 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE]));
+      if(((idx + 1) * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE) >= numBytes)
+         break;
+   }
+
+   return;
+}
+#endif
+
+/*=============================================================================
+   END LOG FUNCTION
+=============================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_Translate80211To8023Header
+
+  DESCRIPTION
+    Inline function for translating and 802.11 header into an 802.3 header.
+
+  DEPENDENCIES
+
+
+  PARAMETERS
+
+   IN
+    pTLCb:            TL control block
+    ucStaId:          station ID
+    ucHeaderLen:      Length of the header from BD
+    ucActualHLen:     Length of header including padding or any other trailers
+
+   IN/OUT
+    vosDataBuff:      vos data buffer, will contain the new header on output
+
+   OUT
+    pvosStatus:       status of the operation
+
+   RETURN VALUE
+
+    The result code associated with performing the operation
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Translate80211To8023Header
+(
+  vos_pkt_t*      vosDataBuff,
+  VOS_STATUS*     pvosStatus,
+  v_U16_t         usActualHLen,
+  v_U8_t          ucHeaderLen,
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucSTAId
+)
+{
+  WLANTL_8023HeaderType  w8023Header;
+  WLANTL_80211HeaderType w80211Header;
+  v_U8_t                 aucLLCHeader[WLANTL_LLC_HEADER_LEN];
+  VOS_STATUS             vosStatus;
+  v_U16_t                usDataStartOffset = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  if ( sizeof(w80211Header) < ucHeaderLen )
+  {
+     TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+       "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
+       sizeof(w80211Header), ucHeaderLen));
+     ucHeaderLen = sizeof(w80211Header);
+  }
+
+  // This will take care of headers of all sizes, 3 address, 3 addr QOS,
+  // WDS non-QOS and WDS QoS etc. We have space for all in the 802.11 header structure.
+  vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucHeaderLen);
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL: Failed to pop 80211 header from packet %d",
+                vosStatus));
+
+     return vosStatus;
+  }
+
+  switch ( w80211Header.wFrmCtrl.fromDS )
+  {
+  case 0:
+#ifdef WLAN_SOFTAP_FEATURE
+    if ( w80211Header.wFrmCtrl.toDS )
+    {
+      //SoftAP AP mode
+      vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
+      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "WLAN TL SoftAP: 802 3 DA %08x SA %08x \n",
+                  w8023Header.vDA, w8023Header.vSA));
+    }
+    else 
+    {
+      /* IBSS */
+      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
+      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
+    }
+#else
+    /* IBSS */
+    vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
+    vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
+#endif
+    break;
+  case 1:
+    if ( w80211Header.wFrmCtrl.toDS )
+    {
+      /* BT-AMP case */
+      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
+      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
+    }
+    else
+    { /* Infra */
+      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
+      vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
+    }
+    break;
+  }
+
+  if( usActualHLen > ucHeaderLen )
+  {
+     usDataStartOffset = usActualHLen - ucHeaderLen;
+  }
+
+  if ( 0 < usDataStartOffset )
+  {
+    vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: Failed to trim header from packet %d",
+                  vosStatus));
+      return vosStatus;
+    }
+  }
+
+  if ( 0 != pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucAddRmvLLC )
+  {
+    // Extract the LLC header
+    vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
+                                  WLANTL_LLC_HEADER_LEN);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: Failed to pop LLC header from packet %d",
+                  vosStatus));
+
+       return vosStatus;
+    }
+
+    //Extract the length
+    vos_mem_copy(&w8023Header.usLenType,
+      &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
+      sizeof(w8023Header.usLenType) );
+  }
+  else
+  {
+    vosStatus = vos_pkt_get_packet_length(vosDataBuff,
+                                        &w8023Header.usLenType);
+
+    if ( VOS_STATUS_SUCCESS != vosStatus )
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL: Failed to get packet length %d",
+                  vosStatus));
+
+       return vosStatus;
+    }
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "WLAN TL: BTAMP len (ethertype) fld = %d",
+        w8023Header.usLenType));
+    w8023Header.usLenType = vos_cpu_to_be16(w8023Header.usLenType);
+  }
+
+  vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
+
+#ifdef BTAMP_TEST
+  {
+  // AP side will execute this.
+  v_U8_t *temp_w8023Header = NULL;
+  vosStatus = vos_pkt_peek_data( vosDataBuff, 0,
+    &temp_w8023Header, sizeof(w8023Header) );
+  }
+#endif
+#if 0 /*TL_DEBUG*/
+  vos_pkt_get_packet_length(vosDataBuff, &usLen);
+  vos_pkt_pop_head( vosDataBuff, aucData, usLen);
+
+  WLANTL_DebugFrame(aucData, usLen);
+
+  vos_pkt_push_head(vosDataBuff, aucData, usLen);
+
+#endif
+
+  *pvosStatus = VOS_STATUS_SUCCESS;
+
+  return VOS_STATUS_SUCCESS;
+}/*WLANTL_Translate80211To8023Header*/
+
+#if 0
+#ifdef WLAN_PERF 
+/*==========================================================================
+  FUNCTION    WLANTL_FastHwFwdDataFrame
+
+  DESCRIPTION 
+    Fast path function to quickly forward a data frame if HAL determines BD 
+    signature computed here matches the signature inside current VOSS packet. 
+    If there is a match, HAL and TL fills in the swapped packet length into 
+    BD header and DxE header, respectively. Otherwise, packet goes back to 
+    normal (slow) path and a new BD signature would be tagged into BD in this
+    VOSS packet later by the WLANHAL_FillTxBd() function.
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+        vosDataBuff Ptr to VOSS packet
+        pMetaInfo   For getting frame's TID
+        pStaInfo    For checking STA type
+    
+   OUT
+        pvosStatus  returned status
+        puFastFwdOK Flag to indicate whether frame could be fast forwarded
+   
+  RETURN VALUE
+    No return.   
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+static void
+WLANTL_FastHwFwdDataFrame
+( 
+  v_PVOID_t     pvosGCtx,
+  vos_pkt_t*    vosDataBuff,
+  VOS_STATUS*   pvosStatus,
+  v_U32_t*       puFastFwdOK,
+  WLANTL_MetaInfoType*  pMetaInfo,
+  WLAN_STADescType*  pStaInfo
+ 
+)
+{
+    v_PVOID_t   pvPeekData;
+    v_U8_t      ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType); 
+    v_U8_t      ucIsUnicast;
+    WLANBAL_sDXEHeaderType  *pDxEHeader;
+    v_PVOID_t   pvBDHeader;
+    v_PVOID_t   pucBuffPtr;
+    v_U16_t      usPktLen;
+
+   /*-----------------------------------------------------------------------
+    Extract packet length
+    -----------------------------------------------------------------------*/
+
+    vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
+
+   /*-----------------------------------------------------------------------
+    Extract MAC address
+    -----------------------------------------------------------------------*/
+    *pvosStatus = vos_pkt_peek_data( vosDataBuff, 
+                                 WLANTL_MAC_ADDR_ALIGN(0), 
+                                 (v_PVOID_t)&pvPeekData, 
+                                 VOS_MAC_ADDR_SIZE );
+
+    if ( VOS_STATUS_SUCCESS != *pvosStatus ) 
+    {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                  "WLAN TL:Failed while attempting to extract MAC Addr %d", 
+                  *pvosStatus));
+       *pvosStatus = VOS_STATUS_E_INVAL;
+       return;
+    }
+
+   /*-----------------------------------------------------------------------
+    Reserve head room for DxE header, BD, and WLAN header
+    -----------------------------------------------------------------------*/
+
+    vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr, 
+                        ucDxEBDWLANHeaderLen );
+    if ( NULL == pucBuffPtr )
+    {
+        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                    "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff));
+       *pvosStatus = VOS_STATUS_E_INVAL;
+        return;
+    }
+    pDxEHeader = (WLANBAL_sDXEHeaderType  *)pucBuffPtr;
+    pvBDHeader = (v_PVOID_t) &pDxEHeader[1];
+
+    /* UMA Tx acceleration is enabled. 
+     * UMA would help convert frames to 802.11, fill partial BD fields and 
+     * construct LLC header. To further accelerate this kind of frames,
+     * HAL would attempt to reuse the BD descriptor if the BD signature 
+     * matches to the saved BD descriptor.
+     */
+     if(pStaInfo->wSTAType == WLAN_STA_IBSS)
+        ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01);
+     else
+        ucIsUnicast = 1;
+ 
+     *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen );
+    
+      /* Can't be fast forwarded. Trim the VOS head back to original location. */
+      if(! *puFastFwdOK){
+          vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen);
+      }else{
+        /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped
+         */
+        v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen;
+        vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, 
+                       (v_PVOID_t)uPacketSize);
+        pDxEHeader->size  = SWAP_ENDIAN_UINT32(uPacketSize);
+      }
+     *pvosStatus = VOS_STATUS_SUCCESS;
+      return;
+}
+#endif /*WLAN_PERF*/
+#endif
+
+#if 0
+/*==========================================================================
+   FUNCTION    WLANTL_PrepareBDHeader
+
+  DESCRIPTION
+    Inline function for preparing BD header before HAL processing.
+
+  DEPENDENCIES
+    Just notify HAL that suspend in TL is complete.
+
+  PARAMETERS
+
+   IN
+    vosDataBuff:      vos data buffer
+    ucDisableFrmXtl:  is frame xtl disabled
+
+   OUT
+    ppvBDHeader:      it will contain the BD header
+    pvDestMacAdddr:   it will contain the destination MAC address
+    pvosStatus:       status of the combined processing
+    pusPktLen:        packet len.
+
+  RETURN VALUE
+    No return.
+
+  SIDE EFFECTS
+
+============================================================================*/
+void
+WLANTL_PrepareBDHeader
+(
+  vos_pkt_t*      vosDataBuff,
+  v_PVOID_t*      ppvBDHeader,
+  v_MACADDR_t*    pvDestMacAdddr,
+  v_U8_t          ucDisableFrmXtl,
+  VOS_STATUS*     pvosStatus,
+  v_U16_t*        pusPktLen,
+  v_U8_t          ucQosEnabled,
+  v_U8_t          ucWDSEnabled,
+  v_U8_t          extraHeadSpace
+)
+{
+  v_U8_t      ucHeaderOffset;
+  v_U8_t      ucHeaderLen;
+#ifndef WLAN_SOFTAP_FEATURE
+  v_PVOID_t   pvPeekData;
+#endif
+  v_U8_t      ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl);
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+  /*-------------------------------------------------------------------------
+    Get header pointer from VOSS
+    !!! make sure reserve head zeros out the memory
+   -------------------------------------------------------------------------*/
+  vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
+
+  if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Length of the packet smaller than expected network"
+               " header %d", *pusPktLen ));
+
+    *pvosStatus = VOS_STATUS_E_INVAL;
+    return;
+  }
+
+  vos_pkt_reserve_head( vosDataBuff, ppvBDHeader,
+                        ucBDHeaderLen );
+  if ( NULL == *ppvBDHeader )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:VOSS packet corrupted on Attach BD header"));
+    *pvosStatus = VOS_STATUS_E_INVAL;
+    return;
+  }
+
+  /*-----------------------------------------------------------------------
+    Extract MAC address
+   -----------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+  {
+   v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE;
+   *pvosStatus = vos_pkt_extract_data( vosDataBuff,
+                                     ucBDHeaderLen +
+                                     WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
+                                     (v_PVOID_t)pvDestMacAdddr,
+                                     &usMacAddrSize );
+  }
+#else
+  *pvosStatus = vos_pkt_peek_data( vosDataBuff,
+                                     ucBDHeaderLen +
+                                     WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
+                                     (v_PVOID_t)&pvPeekData,
+                                     VOS_MAC_ADDR_SIZE );
+
+  /*Fix me*/
+  vos_copy_macaddr(pvDestMacAdddr, (v_MACADDR_t*)pvPeekData);
+#endif
+  if ( VOS_STATUS_SUCCESS != *pvosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Failed while attempting to extract MAC Addr %d",
+                *pvosStatus));
+  }
+  else
+  {
+    /*---------------------------------------------------------------------
+        Fill MPDU info fields:
+          - MPDU data start offset
+          - MPDU header start offset
+          - MPDU header length
+          - MPDU length - this is a 16b field - needs swapping
+    --------------------------------------------------------------------*/
+    ucHeaderOffset = ucBDHeaderLen;
+    ucHeaderLen    = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl);
+
+    if ( 0 != ucDisableFrmXtl )
+    {
+      if ( 0 != ucQosEnabled )
+      {
+        ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL;
+      }
+
+      // Similar to Qos we need something for WDS format !
+      if ( ucWDSEnabled != 0 )
+      {
+        // If we have frame translation enabled
+        ucHeaderLen    += WLANTL_802_11_HEADER_ADDR4_LEN;
+      }
+      if ( extraHeadSpace != 0 )
+      {
+        // Decrease the packet length with the extra padding after the header
+        *pusPktLen = *pusPktLen - extraHeadSpace;
+      }
+    }
+
+    WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen);
+    WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset);
+    WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader,
+                                          ucHeaderOffset + ucHeaderLen + extraHeadSpace);
+    WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen);
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
+                ucHeaderLen, ucHeaderOffset, 
+                (ucHeaderOffset + ucHeaderLen + extraHeadSpace), 
+                *pusPktLen, extraHeadSpace));
+  }/* if peek MAC success*/
+
+}/* WLANTL_PrepareBDHeader */
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+//THIS IS A HACK AND NEEDS TO BE FIXED FOR CONCURRENCY
+/*==========================================================================
+  FUNCTION    WLAN_TLGetNextTxIds
+
+  DESCRIPTION
+    Gets the next station and next AC in the list that should be served by the TL.
+
+    Multiple Station Scheduling and TL queue management. 
+
+    4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used
+    in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field.
+    Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic
+    or not.
+      
+    Stations are served in a round-robin fashion from highest priority to lowest priority.
+    The number of round-robin times of each prioirty equals to the WFQ weights and differetiates
+    the traffic of different prioirty. As such, stations can not provide low priority packets if
+    high priority packets are all served.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:     pointer to the global vos context; a handle to TL's
+                 control block can be extracted from its context
+
+   OUT
+   pucSTAId:    Station ID
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good
+
+  SIDE EFFECTS
+   
+   TL context contains currently served station ID in ucCurrentSTA field, currently served AC
+   in uCurServedAC field, and unserved weights of current AC in uCurLeftWeight.
+   When existing from the function, these three fields are changed accordingly.
+
+============================================================================*/
+VOS_STATUS
+WLAN_TLAPGetNextTxIds
+(
+  v_PVOID_t    pvosGCtx,
+  v_U8_t*      pucSTAId
+)
+{
+  WLANTL_CbType*  pTLCb;
+  v_U8_t          ucACFilter = 1;
+  v_U8_t          ucNextSTA ; 
+  v_BOOL_t        isServed = TRUE;  //current round has find a packet or not
+  v_U8_t          ucACLoopNum = WLANTL_AC_VO + 1; //number of loop to go
+  v_U8_t          uFlowMask; // TX FlowMask from WDA
+  uint8           ucACMask; 
+  uint8           i; 
+  /*------------------------------------------------------------------------
+    Extract TL control block
+  ------------------------------------------------------------------------*/
+  //ENTER();
+
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLAPGetNextTxIds"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Failed to retrieve Flow control mask from WDA"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  ucNextSTA = pTLCb->ucCurrentSTA;
+
+  ++ucNextSTA;
+
+  if ( WLAN_MAX_STA_COUNT <= ucNextSTA )
+  {
+    //one round is done.
+    ucNextSTA = 0;
+    pTLCb->ucCurLeftWeight--;
+    isServed = FALSE;
+    if ( 0 == pTLCb->ucCurLeftWeight )
+    {
+      //current prioirty is done
+      if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC )
+      {
+        //end of current VO, VI, BE, BK loop. Reset priority.
+        pTLCb->uCurServedAC = WLANTL_AC_VO;
+      }
+      else 
+      {
+        pTLCb->uCurServedAC --;
+      }
+
+      pTLCb->ucCurLeftWeight =  pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
+ 
+    } // (0 == pTLCb->ucCurLeftWeight)
+  } //( WLAN_MAX_STA_COUNT == ucNextSTA )
+
+  //decide how many loops to go. if current loop is partial, do one extra to make sure
+  //we cover every station
+  if ((1 == pTLCb->ucCurLeftWeight) && (ucNextSTA != 0))
+  {
+    ucACLoopNum ++; // now is 5 loops
+  }
+
+  /* Start with highest priority. ucNextSTA, pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight
+     all have previous values.*/
+  for (; ucACLoopNum > 0;  ucACLoopNum--)
+  {
+
+    ucACFilter = 1 << pTLCb->uCurServedAC;
+
+    // pTLCb->ucCurLeftWeight keeps previous results.
+    for (; (pTLCb->ucCurLeftWeight > 0) && (uFlowMask & ucACFilter); pTLCb->ucCurLeftWeight-- )
+    {
+
+      for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ )
+      {
+        WLAN_TL_AC_ARRAY_2_MASK (&pTLCb->atlSTAClients[ucNextSTA], ucACMask, i); 
+
+        if ( (0 == pTLCb->atlSTAClients[ucNextSTA].ucExists) ||
+             ((0 == pTLCb->atlSTAClients[ucNextSTA].ucPktPending) && !(ucACMask)) ||
+             (0 == (ucACMask & ucACFilter)) )
+
+        {
+          //current statioin does not exist or have any packet to serve.
+          continue;
+        }
+
+        //go to next station if current station can't send due to flow control
+        //Station is allowed to send when it is not in LWM mode. When station is in LWM mode,
+        //station is allowed to send only after FW reports FW memory is below threshold and on-fly
+        //packets are less then allowed value
+        if ( (TRUE == pTLCb->atlSTAClients[ucNextSTA].ucLwmModeEnabled) && 
+             ((FALSE == pTLCb->atlSTAClients[ucNextSTA].ucLwmEventReported) || 
+                 (0 < pTLCb->atlSTAClients[ucNextSTA].uBuffThresholdMax))
+           )
+        {
+          continue;
+        }
+
+
+        // Find a station. Weight is updated already.
+        *pucSTAId = ucNextSTA;
+        pTLCb->ucCurrentSTA = ucNextSTA;
+        pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC = pTLCb->uCurServedAC;
+  
+        TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+                   " TL serve one station AC: %d  W: %d StaId: %d",
+                   pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
+      
+        return VOS_STATUS_SUCCESS;
+      } //STA loop
+
+      ucNextSTA = 0;
+      if ( FALSE == isServed )
+      {
+        //current loop finds no packet.no need to repeat for the same priority
+        break;
+      }
+      //current loop is partial loop. go for one more loop.
+      isServed = FALSE;
+
+    } //Weight loop
+
+    if (WLANTL_AC_BK == pTLCb->uCurServedAC)
+    {
+      pTLCb->uCurServedAC = WLANTL_AC_VO;
+    }
+    else
+    {
+      pTLCb->uCurServedAC--;
+    }
+    pTLCb->ucCurLeftWeight =  pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
+
+  }// AC loop
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                   " TL can't find one station to serve \n" ));
+
+  pTLCb->uCurServedAC = WLANTL_AC_BK;
+  pTLCb->ucCurLeftWeight = 1;
+  //invalid number will be captured by caller
+  pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; 
+
+  *pucSTAId = pTLCb->ucCurrentSTA;
+  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC = pTLCb->uCurServedAC;
+  return VOS_STATUS_E_FAULT;
+}
+
+
+/*==========================================================================
+  FUNCTION    WLAN_TLGetNextTxIds
+
+  DESCRIPTION
+    Gets the next station and next AC in the list
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:     pointer to the global vos context; a handle to TL's
+                 control block can be extracted from its context
+
+   OUT
+   pucSTAId:    Station ID
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLAN_TLGetNextTxIds
+(
+  v_PVOID_t    pvosGCtx,
+  v_U8_t*      pucSTAId
+)
+{
+  WLANTL_CbType*  pTLCb;
+  v_U8_t          ucNextAC;
+  v_U8_t          ucNextSTA; 
+  v_U8_t          ucCount; 
+  v_U8_t          uFlowMask; // TX FlowMask from WDA
+  v_U8_t          ucACMask = 0;
+  v_U8_t          i = 0; 
+
+  tBssSystemRole systemRole; //RG HACK to be removed
+  tpAniSirGlobal pMac;
+
+  pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
+  if ( NULL == pMac )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid pMac", __FUNCTION__));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  systemRole = wdaGetGlobalSystemRole(pMac);
+  if ((eSYSTEM_AP_ROLE == systemRole) || (vos_concurrent_sessions_running()))
+  {
+    return WLAN_TLAPGetNextTxIds(pvosGCtx,pucSTAId);
+  }
+
+  
+  /*------------------------------------------------------------------------
+    Extract TL control block
+  ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Failed to retrieve Flow control mask from WDA"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*STA id - no priority yet implemented */
+  /*-----------------------------------------------------------------------
+    Choose the next STA for tx - for now go in a round robin fashion
+    through all the stations that have pending packets     
+  -------------------------------------------------------------------------*/
+  ucNextSTA = pTLCb->ucCurrentSTA;
+  
+  pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; 
+  for ( ucCount = 0; 
+        ucCount < WLAN_MAX_STA_COUNT;
+        ucCount++ )
+  {
+    ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1);
+    
+    if (( pTLCb->atlSTAClients[ucNextSTA].ucExists ) &&
+        ( pTLCb->atlSTAClients[ucNextSTA].ucPktPending ))
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
+      pTLCb->ucCurrentSTA = ucNextSTA; 
+      break;
+    }
+  }
+
+  *pucSTAId = pTLCb->ucCurrentSTA;
+
+  if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      "WLAN TL:No station registered with TL at this point"));
+
+    return VOS_STATUS_E_FAULT;
+
+  }
+
+  /*Convert the array to a mask for easier operation*/
+  WLAN_TL_AC_ARRAY_2_MASK( &pTLCb->atlSTAClients[*pucSTAId], ucACMask, i); 
+  
+  if ( 0 == ucACMask )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL: Mask 0 "
+      "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
+
+     /*setting STA id to invalid if mask is 0*/
+     *pucSTAId = WLAN_MAX_STA_COUNT;
+
+     return VOS_STATUS_E_FAULT;
+  }
+
+  /*-----------------------------------------------------------------------
+    AC is updated whenever a packet is fetched from HDD -> the current
+    weight of such an AC cannot be 0 -> in this case TL is expected to
+    exit this function at this point during the main Tx loop
+  -----------------------------------------------------------------------*/
+  if ( 0 < pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight  )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "WLAN TL: Maintaining serviced AC to: %d for Weight: %d",
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC ,
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+    return VOS_STATUS_SUCCESS;
+  }
+
+  /*-----------------------------------------------------------------------
+     Choose highest priority AC - !!! optimize me
+  -----------------------------------------------------------------------*/
+  ucNextAC = pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC;
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "Next AC: %d", ucNextAC));
+
+  while ( 0 != ucACMask )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             " AC Mask: %d Next: %d Res : %d",
+               ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
+
+    if ( 0 != ( ucACMask & ( 1 << ucNextAC ) & uFlowMask ))
+    {
+       pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC     = 
+                                   (WLANTL_ACEnumType)ucNextAC;
+       pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight =
+                       pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
+
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "WLAN TL: Switching serviced AC to: %d with Weight: %d",
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC ,
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+       break;
+    }
+
+    ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC;
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "Next AC %d", ucNextAC));
+
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             " C AC: %d C W: %d",
+             pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC,
+             pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLAN_TLGetNextTxIds */
+
+#else
+
+/*==========================================================================
+  FUNCTION    WLAN_TLGetNextTxIds
+
+  DESCRIPTION
+    Gets the next station and next AC in the list
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:     pointer to the global vos context; a handle to TL's
+                 control block can be extracted from its context
+
+   OUT
+   pucSTAId:    Station ID
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLAN_TLGetNextTxIds
+(
+  v_PVOID_t    pvosGCtx,
+  v_U8_t*      pucSTAId
+)
+{
+  WLANTL_CbType*  pTLCb;
+  v_U8_t          ucNextAC;
+  v_U8_t          ucNextSTA; 
+  v_U8_t          ucCount; 
+  /*------------------------------------------------------------------------
+    Extract TL control block
+  ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*STA id - no priority yet implemented */
+  /*-----------------------------------------------------------------------
+    Choose the next STA for tx - for now go in a round robin fashion
+    through all the stations that have pending packets     
+  -------------------------------------------------------------------------*/
+  ucNextSTA = pTLCb->ucCurrentSTA;
+  
+  pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; 
+  for ( ucCount = 0; 
+        ucCount < WLAN_MAX_STA_COUNT;
+        ucCount++ )
+  {
+    ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1);
+    
+    if (( pTLCb->atlSTAClients[ucNextSTA].ucExists ) &&
+        ( pTLCb->atlSTAClients[ucNextSTA].ucPktPending ))
+    {
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+      "WLAN TL:No station registered with TL at this point or Mask 0"
+      "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
+      pTLCb->ucCurrentSTA = ucNextSTA; 
+      break;
+    }
+  }
+
+  *pucSTAId = pTLCb->ucCurrentSTA;
+
+   if ( ( WLANTL_STA_ID_INVALID( *pucSTAId ) ) ||
+        ( 0 == ucACMask ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+      "WLAN TL:No station registered with TL at this point or Mask 0"
+      "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
+
+     /*setting STA id to invalid if mask is 0*/
+     *pucSTAId = WLAN_MAX_STA_COUNT;
+
+     return VOS_STATUS_E_FAULT;
+  }
+
+  /*-----------------------------------------------------------------------
+    AC is updated whenever a packet is fetched from HDD -> the current
+    weight of such an AC cannot be 0 -> in this case TL is expected to
+    exit this function at this point during the main Tx loop
+  -----------------------------------------------------------------------*/
+  if ( 0 < pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight  )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "WLAN TL: Maintaining serviced AC to: %d for Weight: %d",
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC ,
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+    return VOS_STATUS_SUCCESS;
+  }
+
+  /*-----------------------------------------------------------------------
+     Choose highest priority AC - !!! optimize me
+  -----------------------------------------------------------------------*/
+  ucNextAC = pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC;
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "Next AC: %d", ucNextAC));
+
+  while ( 0 != ucACMask )
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             " AC Mask: %d Next: %d Res : %d",
+               ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
+
+    if ( 0 !=  pTLCb->atlSTAClients[*pucSTAId].aucACMask[ucNextAC] )
+    {
+       pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC     = 
+                                   (WLANTL_ACEnumType)ucNextAC;
+       pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight =
+                       pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
+
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                  "WLAN TL: Switching serviced AC to: %d with Weight: %d",
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC ,
+                  pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+       break;
+    }
+
+    ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC;
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "Next AC %d", ucNextAC));
+
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             " C AC: %d C W: %d",
+             pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC,
+             pTLCb->atlSTAClients[*pucSTAId].ucCurrentWeight));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLAN_TLGetNextTxIds */
+#endif //WLAN_SOFTAP_FEATURE
+
+
+/*==========================================================================
+      DEFAULT HANDLERS: Registered at initialization with TL
+  ==========================================================================*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_MgmtFrmRxDefaultCb
+
+  DESCRIPTION
+    Default Mgmt Frm rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for Mgmt Frm.
+
+  DEPENDENCIES
+
+  PARAMETERS
+    Not used.
+
+  RETURN VALUE
+
+   VOS_STATUS_E_FAILURE: Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_MgmtFrmRxDefaultCb
+(
+  v_PVOID_t  pvosGCtx,
+  v_PVOID_t  vosBuff
+)
+{
+  if ( NULL != vosBuff )
+  {
+    TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+             "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX"));
+    /* Drop packet */
+    vos_pkt_return_packet((vos_pkt_t *)vosBuff);
+  }
+
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC )
+  if(!vos_is_load_unload_in_progress(VOS_MODULE_ID_TL, NULL))
+  {
+      TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+                 "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX"));
+      VOS_ASSERT(0);
+  }
+  else
+  {
+#endif
+      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                 "WLAN TL: No registered Mgmt Frm client on pkt RX. Load/Unload in progress, Ignore"));
+#if !defined( FEATURE_WLAN_INTEGRATED_SOC )
+  }
+#endif
+
+  return VOS_STATUS_E_FAILURE;
+}/*WLANTL_MgmtFrmRxDefaultCb*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STARxDefaultCb
+
+  DESCRIPTION
+    Default BAP rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for BAP.
+
+  DEPENDENCIES
+
+  PARAMETERS
+    Not used.
+
+  RETURN VALUE
+
+   VOS_STATUS_E_FAILURE: Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_BAPRxDefaultCb
+(
+  v_PVOID_t  pvosGCtx,
+  vos_pkt_t*       vosDataBuff,
+  WLANTL_BAPFrameEnumType frameType
+)
+{
+  TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+             "WLAN TL:Fatal failure: No registered BAP client on BAP pkt RX"));
+#ifndef BTAMP_TEST
+  VOS_ASSERT(0);
+#endif
+  return VOS_STATUS_E_FAILURE;
+}/*WLANTL_MgmtFrmRxDefaultCb*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STARxDefaultCb
+
+  DESCRIPTION
+    Default STA rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for station.
+    (Mem corruption most likely, it should never happen)
+
+  DEPENDENCIES
+
+  PARAMETERS
+    Not used.
+
+  RETURN VALUE
+
+    VOS_STATUS_E_FAILURE: Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STARxDefaultCb
+(
+  v_PVOID_t               pvosGCtx,
+  vos_pkt_t*              vosDataBuff,
+  v_U8_t                  ucSTAId,
+  WLANTL_RxMetaInfoType*  pRxMetaInfo
+)
+{
+  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+       "WLAN TL: No registered STA client rx cb for STAID: %d dropping pkt",
+               ucSTAId));
+  vos_pkt_return_packet(vosDataBuff);
+  return VOS_STATUS_E_FAILURE;
+}/*WLANTL_MgmtFrmRxDefaultCb*/
+
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STAFetchPktDefaultCb
+
+  DESCRIPTION
+    Default fetch callback: asserts all the time. If this function gets
+    called  it means there is no registered fetch cb pointer for station.
+    (Mem corruption most likely, it should never happen)
+
+  DEPENDENCIES
+
+  PARAMETERS
+    Not used.
+
+  RETURN VALUE
+
+    VOS_STATUS_E_FAILURE: Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STAFetchPktDefaultCb
+(
+  v_PVOID_t              pvosGCtx,
+  v_U8_t*                pucSTAId,
+  WLANTL_ACEnumType      ucAC,
+  vos_pkt_t**            vosDataBuff,
+  WLANTL_MetaInfoType*   tlMetaInfo
+)
+{
+  TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+             "WLAN TL:Fatal failure: No registered STA client on data pkt RX"));
+  VOS_ASSERT(0);
+  return VOS_STATUS_E_FAILURE;
+}/*WLANTL_MgmtFrmRxDefaultCb*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxCompDefaultCb
+
+  DESCRIPTION
+    Default tx complete handler. It will release the completed pkt to
+    prevent memory leaks.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to
+                    TL/HAL/PE/BAP/HDD control block can be extracted from
+                    its context
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted
+    wTxSTAtus:      status of the transmission
+
+
+  RETURN VALUE
+    The result code associated with performing the operation; please
+    check vos_pkt_return_packet for possible error codes.
+
+    Please check  vos_pkt_return_packet API for possible return values.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxCompDefaultCb
+(
+ v_PVOID_t      pvosGCtx,
+ vos_pkt_t*     vosDataBuff,
+ VOS_STATUS     wTxSTAtus
+)
+{
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+         "WLAN TL:TXComp not registered, releasing pkt to prevent mem leak"));
+  return vos_pkt_return_packet(vosDataBuff);
+}/*WLANTL_TxCompDefaultCb*/
+
+
+/*==========================================================================
+      Cleanup functions
+  ==========================================================================*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_CleanCB
+
+  DESCRIPTION
+    Cleans TL control block
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pTLCb:       pointer to TL's control block
+    ucEmpty:     set if TL has to clean up the queues and release pedning pkts
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+     VOS_STATUS_E_INVAL:   invalid input parameters
+     VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_CleanCB
+(
+  WLANTL_CbType*  pTLCb,
+  v_U8_t      ucEmpty
+)
+{
+  v_U8_t ucIndex;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    Sanity check
+   -------------------------------------------------------------------------*/
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_CleanCB"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /* number of packets sent to BAL waiting for tx complete confirmation */
+  pTLCb->usPendingTxCompleteCount = 0;
+
+  /* global suspend flag */
+   vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
+
+  /* resource flag */
+  pTLCb->uResCount = 0;
+
+
+  /*-------------------------------------------------------------------------
+    Client stations
+   -------------------------------------------------------------------------*/
+  for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
+  {
+    WLANTL_CleanSTA( &pTLCb->atlSTAClients[ucIndex], ucEmpty);
+  }
+
+  /*-------------------------------------------------------------------------
+    Management Frame client
+   -------------------------------------------------------------------------*/
+  pTLCb->tlMgmtFrmClient.ucExists = 0;
+
+  if ( ( 0 != ucEmpty) &&
+       ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ))
+  {
+    vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
+  }
+
+  pTLCb->tlMgmtFrmClient.vosPendingDataBuff  = NULL;
+
+  /* set to a default cb in order to prevent constant checking for NULL */
+  pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
+
+  /*-------------------------------------------------------------------------
+    BT AMP client
+   -------------------------------------------------------------------------*/
+  pTLCb->tlBAPClient.ucExists = 0;
+
+  if (( 0 != ucEmpty) &&
+      ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ))
+  {
+    vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
+  }
+  
+  if (( 0 != ucEmpty) &&
+      ( NULL != pTLCb->vosDummyBuf ))
+  {
+    vos_pkt_return_packet(pTLCb->vosDummyBuf);
+  }
+
+  pTLCb->tlBAPClient.vosPendingDataBuff  = NULL;
+
+  pTLCb->vosDummyBuf = NULL;
+  pTLCb->vosTempBuf  = NULL;
+  pTLCb->ucCachedSTAId = WLAN_MAX_STA_COUNT;
+
+  /* set to a default cb in order to prevent constant checking for NULL */
+  pTLCb->tlBAPClient.pfnTlBAPRx = WLANTL_BAPRxDefaultCb;
+
+  pTLCb->ucRegisteredStaId = WLAN_MAX_STA_COUNT;
+
+  return VOS_STATUS_SUCCESS;
+
+}/* WLANTL_CleanCB*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_CleanSTA
+
+  DESCRIPTION
+    Cleans a station control block.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucEmpty:        if set the queues and pending pkts will be emptyed
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_CleanSTA
+(
+  WLANTL_STAClientType*  ptlSTAClient,
+  v_U8_t             ucEmpty
+)
+{
+  v_U8_t  ucIndex;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    Sanity check
+   -------------------------------------------------------------------------*/
+  if ( NULL == ptlSTAClient )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_CleanSTA"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Clear station from TL
+   ------------------------------------------------------------------------*/
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL: Clearing STA Client ID: %d, Empty flag: %d",
+             ptlSTAClient->wSTADesc.ucSTAId, ucEmpty ));
+
+  ptlSTAClient->pfnSTARx          = WLANTL_STARxDefaultCb;
+  ptlSTAClient->pfnSTATxComp      = WLANTL_TxCompDefaultCb;
+  ptlSTAClient->pfnSTAFetchPkt    = WLANTL_STAFetchPktDefaultCb;
+
+  ptlSTAClient->tlState           = WLANTL_STA_INIT;
+  ptlSTAClient->tlPri             = WLANTL_STA_PRI_NORMAL;
+
+  vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSTAMACAddress );
+  vos_zero_macaddr( &ptlSTAClient->wSTADesc.vBSSIDforIBSS );
+  vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSelfMACAddress );
+
+  ptlSTAClient->wSTADesc.ucSTAId  = 0;
+  ptlSTAClient->wSTADesc.wSTAType = WLAN_STA_MAX;
+
+  ptlSTAClient->wSTADesc.ucQosEnabled     = 0;
+  ptlSTAClient->wSTADesc.ucAddRmvLLC      = 0;
+  ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0;
+  ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0;
+  ptlSTAClient->wSTADesc.ucProtectedFrame = 0;
+
+  /*-------------------------------------------------------------------------
+    AMSDU information for the STA
+   -------------------------------------------------------------------------*/
+  if ( ( 0 != ucEmpty ) &&
+       ( NULL != ptlSTAClient->vosAMSDUChainRoot ))
+  {
+    vos_pkt_return_packet(ptlSTAClient->vosAMSDUChainRoot);
+  }
+
+  ptlSTAClient->vosAMSDUChain     = NULL;
+  ptlSTAClient->vosAMSDUChainRoot = NULL;
+
+  vos_mem_zero( (v_PVOID_t)ptlSTAClient->aucMPDUHeader,
+                 WLANTL_MPDU_HEADER_LEN);
+  ptlSTAClient->ucMPDUHeaderLen    = 0;
+
+  /*-------------------------------------------------------------------------
+    Reordering information for the STA
+   -------------------------------------------------------------------------*/
+  for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
+  {
+    if(0 == ptlSTAClient->atlBAReorderInfo[ucIndex].ucExists)
+    {
+      continue;
+    }
+    if(NULL != ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer)
+    {
+      ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->isAvailable = VOS_TRUE;
+      memset(&ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->arrayBuffer[0], 0, WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
+    }
+    vos_timer_destroy(&ptlSTAClient->atlBAReorderInfo[ucIndex].agingTimer);
+    memset(&ptlSTAClient->atlBAReorderInfo[ucIndex], 0, sizeof(WLANTL_BAReorderType));
+  }
+
+  /*-------------------------------------------------------------------------
+     QOS information for the STA
+    -------------------------------------------------------------------------*/
+   ptlSTAClient->ucCurrentAC     = WLANTL_AC_VO;
+   ptlSTAClient->ucCurrentWeight = 0;
+   ptlSTAClient->ucServicedAC    = WLANTL_AC_BK;
+
+   vos_mem_zero( ptlSTAClient->aucACMask, sizeof(ptlSTAClient->aucACMask));
+   vos_mem_zero( &ptlSTAClient->wUAPSDInfo, sizeof(ptlSTAClient->wUAPSDInfo));
+
+
+  /*--------------------------------------------------------------------
+    Stats info
+    --------------------------------------------------------------------*/
+   vos_mem_zero( ptlSTAClient->auRxCount,
+                 sizeof(ptlSTAClient->auRxCount[0])* WLAN_MAX_TID);
+   vos_mem_zero( ptlSTAClient->auTxCount,
+                 sizeof(ptlSTAClient->auTxCount[0])* WLAN_MAX_TID);
+   ptlSTAClient->rssiAvg = 0;
+
+   /*Tx not suspended and station fully registered*/
+   vos_atomic_set_U8( &ptlSTAClient->ucTxSuspended, 0);
+   vos_atomic_set_U8( &ptlSTAClient->ucNoMoreData, 1);
+
+  if ( 0 == ucEmpty )
+  {
+    ptlSTAClient->wSTADesc.ucUcastSig       = WLAN_TL_INVALID_U_SIG;
+    ptlSTAClient->wSTADesc.ucBcastSig       = WLAN_TL_INVALID_B_SIG;
+  }
+
+  ptlSTAClient->ucExists       = 0;
+
+  /*--------------------------------------------------------------------
+    Statistics info 
+    --------------------------------------------------------------------*/
+  memset(&ptlSTAClient->trafficStatistics,
+         0,
+         sizeof(WLANTL_TRANSFER_STA_TYPE));
+
+  /*fix me!!: add new values from the TL Cb for cleanup */
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_CleanSTA */
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_EnableUAPSDForAC
+
+  DESCRIPTION
+   Called by HDD to enable UAPSD. TL in turn calls WDA API to enable the
+   logic in FW/SLM to start sending trigger frames. Previously TL had the
+   trigger frame logic which later moved down to FW. Hence
+   HDD -> TL -> WDA -> FW call flow.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucSTAId:        station Id
+    ucAC:           AC for which U-APSD is being enabled
+    ucTid:          TID for which U-APSD is setup
+    ucUP:           used to place in the trigger frame generation
+    ucServiceInt:   service interval used by TL to send trigger frames
+    ucSuspendInt:   suspend interval used by TL to determine that an
+                    app is idle and should start sending trigg frms less often
+    wTSDir:         direction of TSpec
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_EnableUAPSDForAC
+(
+  v_PVOID_t          pvosGCtx,
+  v_U8_t             ucSTAId,
+  WLANTL_ACEnumType  ucAC,
+  v_U8_t             ucTid,
+  v_U8_t             ucUP,
+  v_U32_t            uServiceInt,
+  v_U32_t            uSuspendInt,
+  WLANTL_TSDirType   wTSDir
+)
+{
+
+  WLANTL_CbType*      pTLCb      = NULL;
+  VOS_STATUS          vosStatus   = VOS_STATUS_SUCCESS;
+  tUapsdInfo          halUAPSDInfo; 
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
+      ||   WLANTL_AC_INVALID(ucAC) || ( 0 == uServiceInt ) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid input params on WLANTL_EnableUAPSDForAC"
+               " TL: %x  STA: %d  AC: %d SI: %d", 
+               pTLCb, ucSTAId, ucAC, uServiceInt ));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Set this flag in order to remember that this is a trigger enabled AC*/
+  pTLCb->atlSTAClients[ucSTAId].wUAPSDInfo[ucAC].ucSet = 1; 
+  
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Enabling U-APSD in FW for STA: %d AC: %d SI: %d SPI: %d "
+             "DI: %d",
+             ucSTAId, ucAC, uServiceInt, uSuspendInt,
+             pTLCb->tlConfigInfo.uDelayedTriggerFrmInt));
+
+  /*Save all info for HAL*/
+  halUAPSDInfo.staidx         = ucSTAId; 
+  halUAPSDInfo.ac             = ucAC;   
+  halUAPSDInfo.up             = ucUP;   
+  halUAPSDInfo.srvInterval    = uServiceInt;  
+  halUAPSDInfo.susInterval    = uSuspendInt;
+  halUAPSDInfo.delayInterval  = pTLCb->tlConfigInfo.uDelayedTriggerFrmInt; 
+
+  /*Notify HAL*/
+  vosStatus = WDA_EnableUapsdAcParams(pvosGCtx, ucSTAId, &halUAPSDInfo);
+
+  return vosStatus;
+
+}/*WLANTL_EnableUAPSDForAC*/
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_DisableUAPSDForAC
+
+  DESCRIPTION
+   Called by HDD to disable UAPSD. TL in turn calls WDA API to disable the
+   logic in FW/SLM to stop sending trigger frames. Previously TL had the
+   trigger frame logic which later moved down to FW. Hence
+   HDD -> TL -> WDA -> FW call flow.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+    ucSTAId:        station Id
+    ucAC:         AC for which U-APSD is being enabled
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_DisableUAPSDForAC
+(
+  v_PVOID_t          pvosGCtx,
+  v_U8_t             ucSTAId,
+  WLANTL_ACEnumType  ucAC
+)
+{
+  WLANTL_CbType* pTLCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
+      ||   WLANTL_AC_INVALID(ucAC) )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid input params on WLANTL_DisableUAPSDForAC"
+               " TL: %x  STA: %d  AC: %d", pTLCb, ucSTAId, ucAC ));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*Reset this flag as this is no longer a trigger enabled AC*/
+  pTLCb->atlSTAClients[ucSTAId].wUAPSDInfo[ucAC].ucSet = 1; 
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:Disabling U-APSD in FW for STA: %d AC: %d ",
+             ucSTAId, ucAC));
+
+  /*Notify HAL*/
+  WDA_DisableUapsdAcParams(pvosGCtx, ucSTAId, ucAC);
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_DisableUAPSDForAC */
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+/*==========================================================================
+  FUNCTION     WLANTL_RegRSSIIndicationCB
+
+  DESCRIPTION  Registration function to get notification if RSSI cross
+               threshold.
+               Client should register threshold, direction, and notification
+               callback function pointer
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in rssiValue - RSSI threshold value
+               in triggerEvent - Cross direction should be notified
+                                 UP, DOWN, and CROSS
+               in crossCBFunction - Notification CB Function
+               in usrCtxt - user context
+
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_RegRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID,
+   v_PVOID_t                       usrCtxt
+)
+{
+   VOS_STATUS                     status = VOS_STATUS_SUCCESS;
+
+   status = WLANTL_HSRegRSSIIndicationCB(pAdapter,
+                                         rssiValue,
+                                         triggerEvent,
+                                         crossCBFunction,
+                                         moduleID,
+                                         usrCtxt);
+
+   return status;
+}
+
+/*==========================================================================
+  FUNCTION     WLANTL_DeregRSSIIndicationCB
+
+  DESCRIPTION  Remove specific threshold from list
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in rssiValue - RSSI threshold value
+               in triggerEvent - Cross direction should be notified
+                                 UP, DOWN, and CROSS
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_DeregRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID
+)
+{
+   VOS_STATUS                     status = VOS_STATUS_SUCCESS;
+
+   status = WLANTL_HSDeregRSSIIndicationCB(pAdapter,
+                                           rssiValue,
+                                           triggerEvent,
+                                           crossCBFunction,
+                                           moduleID);
+   return status;
+}
+
+/*==========================================================================
+  FUNCTION     WLANTL_SetAlpha
+
+  DESCRIPTION  ALPLA is weight value to calculate AVG RSSI
+               avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI)
+               avgRSSI has (ALPHA * 10)% of history RSSI weight and
+               (10 - ALPHA)% of newRSSI weight
+               This portion is dynamically configurable.
+               Default is ?
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in valueAlpah - ALPHA
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_SetAlpha
+(
+   v_PVOID_t pAdapter,
+   v_U8_t    valueAlpha
+)
+{
+   VOS_STATUS                     status = VOS_STATUS_SUCCESS;
+
+   status = WLANTL_HSSetAlpha(pAdapter, valueAlpha);
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification
+(
+   v_PVOID_t             pAdapter,
+   tpSirRSSINotification pRSSINotification
+)
+{
+   VOS_STATUS                     status = VOS_STATUS_SUCCESS;
+
+   status = WLANTL_HSBMPSRSSIRegionChangedNotification(pAdapter, pRSSINotification);
+   return status;
+}
+
+/*==========================================================================
+  FUNCTION     WLANTL_RegGetTrafficStatus
+
+  DESCRIPTION  Registration function for traffic status monitoring
+               During measure period count data frames.
+               If frame count is larger then IDLE threshold set as traffic ON
+               or OFF.
+               And traffic status is changed send report to client with
+               registered callback function
+
+  DEPENDENCIES NONE
+    
+  PARAMETERS   in pAdapter - Global handle
+               in idleThreshold - Traffic on or off threshold
+               in measurePeriod - Traffic state check period
+               in trfficStatusCB - traffic status changed notification
+                                   CB function
+               in usrCtxt - user context
+   
+  RETURN VALUE VOS_STATUS
+
+  SIDE EFFECTS NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_RegGetTrafficStatus
+(
+   v_PVOID_t                          pAdapter,
+   v_U32_t                            idleThreshold,
+   v_U32_t                            measurePeriod,
+   WLANTL_TrafficStatusChangedCBType  trfficStatusCB,
+   v_PVOID_t                          usrCtxt
+)
+{
+   VOS_STATUS                     status = VOS_STATUS_SUCCESS;
+
+   status = WLANTL_HSRegGetTrafficStatus(pAdapter,
+                                idleThreshold,
+                                measurePeriod,
+                                trfficStatusCB,
+                                usrCtxt);
+   return status;
+}
+#endif
+/*==========================================================================
+  FUNCTION      WLANTL_GetStatistics
+
+  DESCRIPTION   Get traffic statistics for identified station 
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                out statBuffer - traffic statistics buffer
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_GetStatistics
+(
+   v_PVOID_t                  pAdapter,
+   WLANTL_TRANSFER_STA_TYPE  *statBuffer,
+   v_U8_t                     STAid
+)
+{
+  WLANTL_CbType            *pTLCb  = VOS_GET_TL_CB(pAdapter);
+  VOS_STATUS                status = VOS_STATUS_SUCCESS;
+  WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block 
+   ------------------------------------------------------------------------*/
+  if (NULL == pTLCb) 
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if(0 == pTLCb->atlSTAClients[STAid].ucExists)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL: %d STA ID does not exist", STAid));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if(NULL == statBuffer)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Invalid TL statistics buffer pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  statistics = &pTLCb->atlSTAClients[STAid].trafficStatistics;
+  memcpy(statBuffer, statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
+
+  return status;
+}
+
+/*==========================================================================
+  FUNCTION      WLANTL_ResetStatistics
+
+  DESCRIPTION   Reset statistics structure for identified station ID
+                Reset means set values as 0
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_ResetStatistics
+(
+   v_PVOID_t                  pAdapter,
+   v_U8_t                     STAid
+)
+{
+  WLANTL_CbType            *pTLCb  = VOS_GET_TL_CB(pAdapter);
+  VOS_STATUS                status = VOS_STATUS_SUCCESS;
+  WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block 
+   ------------------------------------------------------------------------*/
+  if (NULL == pTLCb) 
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if(0 == pTLCb->atlSTAClients[STAid].ucExists)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL: %d STA ID does not exist", STAid));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  statistics = &pTLCb->atlSTAClients[STAid].trafficStatistics;
+  vos_mem_zero((v_VOID_t *)statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
+
+  return status;
+}
+
+/*==========================================================================
+  FUNCTION      WLANTL_GetSpecStatistic
+
+  DESCRIPTION   Get specific field within statistics structure for
+                identified station ID 
+
+  DEPENDENCIES  NONE
+
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                in STAid    - Station ID
+                out buffer  - Statistic value
+   
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_GetSpecStatistic
+(
+   v_PVOID_t                    pAdapter,
+   WLANTL_TRANSFER_STATIC_TYPE  statType,
+   v_U32_t                     *buffer,
+   v_U8_t                       STAid
+)
+{
+  WLANTL_CbType            *pTLCb  = VOS_GET_TL_CB(pAdapter);
+  VOS_STATUS                status = VOS_STATUS_SUCCESS;
+  WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block 
+   ------------------------------------------------------------------------*/
+  if (NULL == pTLCb) 
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if(0 == pTLCb->atlSTAClients[STAid].ucExists)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL: %d STA ID does not exist", STAid));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if(NULL == buffer)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL:Invalid TL statistic buffer pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  statistics = &pTLCb->atlSTAClients[STAid].trafficStatistics;
+  switch(statType)
+  {
+    case WLANTL_STATIC_TX_UC_FCNT:
+      *buffer = statistics->txUCFcnt;
+      break;
+
+    case WLANTL_STATIC_TX_MC_FCNT:
+      *buffer = statistics->txMCFcnt;
+      break;
+
+    case WLANTL_STATIC_TX_BC_FCNT:
+      *buffer = statistics->txBCFcnt;
+      break;
+
+    case WLANTL_STATIC_TX_UC_BCNT:
+      *buffer = statistics->txUCBcnt;
+      break;
+
+    case WLANTL_STATIC_TX_MC_BCNT:
+      *buffer = statistics->txMCBcnt;
+      break;
+
+    case WLANTL_STATIC_TX_BC_BCNT:
+      *buffer = statistics->txBCBcnt;
+      break;
+
+    case WLANTL_STATIC_RX_UC_FCNT:
+      *buffer = statistics->rxUCFcnt;
+      break;
+
+    case WLANTL_STATIC_RX_MC_FCNT:
+      *buffer = statistics->rxMCFcnt;
+      break;
+
+    case WLANTL_STATIC_RX_BC_FCNT:
+      *buffer = statistics->rxBCFcnt;
+      break;
+
+    case WLANTL_STATIC_RX_UC_BCNT:
+      *buffer = statistics->rxUCBcnt;
+      break;
+
+    case WLANTL_STATIC_RX_MC_BCNT:
+      *buffer = statistics->rxMCBcnt;
+      break;
+
+    case WLANTL_STATIC_RX_BC_BCNT:
+      *buffer = statistics->rxBCBcnt;
+      break;
+
+    case WLANTL_STATIC_RX_BCNT:
+      *buffer = statistics->rxBcnt;
+      break;
+
+    case WLANTL_STATIC_RX_BCNT_CRC_OK:
+      *buffer = statistics->rxBcntCRCok;
+      break;
+
+    case WLANTL_STATIC_RX_RATE:
+      *buffer = statistics->rxRate;
+      break;
+
+    default:
+      *buffer = 0;
+      status = VOS_STATUS_E_INVAL;
+      break;
+  }
+
+
+  return status;
+}
+
+/*==========================================================================
+  FUNCTION      WLANTL_ResetSpecStatistic
+
+  DESCRIPTION   Reset specific field within statistics structure for
+                identified station ID
+                Reset means set as 0
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pAdapter - Global handle
+                in statType - specific statistics field to reset
+                in STAid    - Station ID
+
+  RETURN VALUE  VOS_STATUS
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+VOS_STATUS WLANTL_ResetSpecStatistic
+(
+   v_PVOID_t                    pAdapter,
+   WLANTL_TRANSFER_STATIC_TYPE  statType,
+   v_U8_t                       STAid
+)
+{
+  WLANTL_CbType            *pTLCb  = VOS_GET_TL_CB(pAdapter);
+  VOS_STATUS                status = VOS_STATUS_SUCCESS;
+  WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block 
+   ------------------------------------------------------------------------*/
+  if (NULL == pTLCb) 
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if(0 == pTLCb->atlSTAClients[STAid].ucExists)
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+    "WLAN TL: %d STA ID does not exist", STAid));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  statistics = &pTLCb->atlSTAClients[STAid].trafficStatistics;
+  switch(statType)
+  {
+    case WLANTL_STATIC_TX_UC_FCNT:
+      statistics->txUCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_TX_MC_FCNT:
+      statistics->txMCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_TX_BC_FCNT:
+      statistics->txBCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_TX_UC_BCNT:
+      statistics->txUCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_TX_MC_BCNT:
+      statistics->txMCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_TX_BC_BCNT:
+      statistics->txBCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_UC_FCNT:
+      statistics->rxUCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_MC_FCNT:
+      statistics->rxMCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_BC_FCNT:
+      statistics->rxBCFcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_UC_BCNT:
+      statistics->rxUCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_MC_BCNT:
+      statistics->rxMCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_BC_BCNT:
+      statistics->rxBCBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_BCNT:
+      statistics->rxBcnt = 0;
+      break;
+
+    case WLANTL_STATIC_RX_BCNT_CRC_OK:
+      statistics->rxBcntCRCok = 0;
+      break;
+
+    case WLANTL_STATIC_RX_RATE:
+      statistics->rxRate = 0;
+      break;
+
+    default:
+      status = VOS_STATUS_E_INVAL;
+      break;
+  }
+
+  return status;
+}
+
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION   Read RSSI value out of a RX BD
+    
+   PARAMETERS:  Caller must validate all parameters 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_ReadRSSI
+(
+   v_PVOID_t        pAdapter,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   v_S7_t           currentRSSI, currentRSSI0, currentRSSI1;
+
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "%s Invalid TL handle", __FUNCTION__));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
+   currentRSSI1 = WLANTL_GETRSSI1(pBDHeader);
+   currentRSSI  = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
+
+   tlCtxt->atlSTAClients[STAid].rssiAvg = currentRSSI;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*
+ DESCRIPTION 
+    TL returns the weight currently maintained in TL.
+ IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+
+ OUT
+    pACWeights:     Caller allocated memory for filling in weights
+
+ RETURN VALUE  VOS_STATUS
+*/
+VOS_STATUS  
+WLANTL_GetACWeights 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pACWeights
+)
+{
+   WLANTL_CbType*  pTLCb = NULL;
+   v_U8_t          ucIndex; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pACWeights )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
+    return VOS_STATUS_E_FAULT;
+  }
+  for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
+  {
+    pACWeights[ucIndex] = pTLCb->tlConfigInfo.ucAcWeights[ucIndex];
+  }
+
+  return VOS_STATUS_SUCCESS;
+}
+
+
+
+/*
+ DESCRIPTION 
+    Change the weight currently maintained by TL.
+ IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    or SME's control block can be extracted from its context 
+    pACWeights:     Caller allocated memory contain the weights to use
+
+
+ RETURN VALUE  VOS_STATUS
+*/
+VOS_STATUS  
+WLANTL_SetACWeights 
+( 
+  v_PVOID_t             pvosGCtx,
+  v_U8_t*               pACWeights
+)
+{
+   WLANTL_CbType*  pTLCb = NULL;
+   v_U8_t          ucIndex; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pACWeights )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
+    return VOS_STATUS_E_INVAL;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
+    return VOS_STATUS_E_FAULT;
+  }
+  for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
+  {
+    pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex];
+  }
+
+  return VOS_STATUS_SUCCESS;
+}
+
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+void WLANTL_PowerStateChangedCB
+(
+   v_PVOID_t pAdapter,
+   tPmcState newState
+)
+{
+   WLANTL_CbType                *tlCtxt = VOS_GET_TL_CB(pAdapter);
+
+   if (NULL == tlCtxt)
+   {
+     VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "Invalid TL Control Block", __FUNCTION__ );
+     return;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Power state changed, new state is %d", newState );
+   switch(newState)
+   {
+      case FULL_POWER:
+         tlCtxt->isBMPS = VOS_FALSE;
+         break;
+
+      case BMPS:
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+         WLANTL_SetFWRSSIThresholds(pAdapter);
+#endif
+
+         tlCtxt->isBMPS = VOS_TRUE;
+         break;
+
+      case IMPS:
+      case LOW_POWER:
+      case REQUEST_BMPS:
+      case REQUEST_FULL_POWER:
+      case REQUEST_IMPS:
+      case STOPPED:
+      case REQUEST_START_UAPSD:
+      case REQUEST_STOP_UAPSD:
+      case UAPSD:
+      case REQUEST_STANDBY:
+      case STANDBY:
+      case REQUEST_ENTER_WOWL:
+      case REQUEST_EXIT_WOWL:
+      case WOWL:
+         TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, "Not handle this events %d", newState ));
+         break;
+
+      default:
+         TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "Not a valid event %d", newState ));
+         break;
+   }
+
+   return;
+}
+/*==========================================================================
+  FUNCTION      WLANTL_GetEtherType
+
+  DESCRIPTION   Extract Ether type information from the BD
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in aucBDHeader - BD header
+                in vosDataBuff - data buffer
+                in ucMPDUHLen  - MPDU header length
+                out pUsEtherType - pointer to Ethertype
+
+  RETURN VALUE  VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
+                VOS_STATUS_FAILURE : if the EtherType extraction failed and
+                                     the packet was dropped
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+static VOS_STATUS WLANTL_GetEtherType
+(
+   v_U8_t               * aucBDHeader,
+   vos_pkt_t            * vosDataBuff,
+   v_U8_t                 ucMPDUHLen,
+   v_U16_t              * pUsEtherType
+)
+{
+  v_U8_t                   ucOffset;
+  v_U16_t                  usEtherType = *pUsEtherType;
+  v_SIZE_t                 usLLCSize = sizeof(usEtherType);
+  VOS_STATUS               vosStatus  = VOS_STATUS_SUCCESS;
+  
+  /*------------------------------------------------------------------------
+    Check if LLC is present - if not, TL is unable to determine type
+   ------------------------------------------------------------------------*/
+  if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT( aucBDHeader ) )
+  {
+    ucOffset = WLANTL_802_3_HEADER_LEN - sizeof(usEtherType); 
+  }
+  else
+  {
+    ucOffset = ucMPDUHLen + WLANTL_LLC_PROTO_TYPE_OFFSET;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract LLC type 
+  ------------------------------------------------------------------------*/
+  vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset, 
+                                    (v_PVOID_t)&usEtherType, &usLLCSize); 
+
+  if (( VOS_STATUS_SUCCESS != vosStatus ) || 
+      ( sizeof(usEtherType) != usLLCSize ))
+      
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Error extracting Ether type from data packet"));
+    /* Drop packet */
+    vos_pkt_return_packet(vosDataBuff);
+    vosStatus = VOS_STATUS_E_FAILURE;
+  }
+  else
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Ether type retrieved before endianess conv: %d", 
+               usEtherType));
+
+    usEtherType = vos_be16_to_cpu(usEtherType);
+    *pUsEtherType = usEtherType;
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Ether type retrieved: %d", usEtherType));
+  }
+  
+  return vosStatus;
+}
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+  FUNCTION      WLANTL_GetSoftAPStatistics
+
+  DESCRIPTION   Collect the cumulative statistics for all Softap stations
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in pvosGCtx  - Pointer to the global vos context
+                   bReset    - If set TL statistics will be cleared after reading
+                out statsSum - pointer to collected statistics
+
+  RETURN VALUE  VOS_STATUS_SUCCESS : if the Statistics are successfully extracted
+
+  SIDE EFFECTS  NONE
+
+============================================================================*/
+VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset)
+{
+    v_U8_t i = 0;
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
+    WLANTL_CbType *pTLCb  = VOS_GET_TL_CB(pAdapter);
+    WLANTL_TRANSFER_STA_TYPE statBufferTemp;
+    vos_mem_zero((v_VOID_t *)&statBufferTemp, sizeof(WLANTL_TRANSFER_STA_TYPE));
+    vos_mem_zero((v_VOID_t *)statsSum, sizeof(WLANTL_TRANSFER_STA_TYPE));
+
+
+    if ( NULL == pTLCb )
+    {
+       return VOS_STATUS_E_FAULT;
+    } 
+
+    // Sum up all the statistics for stations of Soft AP from TL
+    for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
+    {
+        if (pTLCb->atlSTAClients[i].wSTADesc.wSTAType == WLAN_STA_SOFTAP)
+        {
+           vosStatus = WLANTL_GetStatistics(pAdapter, &statBufferTemp, i);// Can include staId 1 because statistics not collected for it
+
+           if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+                return VOS_STATUS_E_FAULT;
+
+            // Add to the counters
+           statsSum->txUCFcnt += statBufferTemp.txUCFcnt;
+           statsSum->txMCFcnt += statBufferTemp.txMCFcnt;
+           statsSum->txBCFcnt += statBufferTemp.txBCFcnt;
+           statsSum->txUCBcnt += statBufferTemp.txUCBcnt;
+           statsSum->txMCBcnt += statBufferTemp.txMCBcnt;
+           statsSum->txBCBcnt += statBufferTemp.txBCBcnt;
+           statsSum->rxUCFcnt += statBufferTemp.rxUCFcnt;
+           statsSum->rxMCFcnt += statBufferTemp.rxMCFcnt;
+           statsSum->rxBCFcnt += statBufferTemp.rxBCFcnt;
+           statsSum->rxUCBcnt += statBufferTemp.rxUCBcnt;
+           statsSum->rxMCBcnt += statBufferTemp.rxMCBcnt;
+           statsSum->rxBCBcnt += statBufferTemp.rxBCBcnt;
+
+           if (bReset)
+           {
+              vosStatus = WLANTL_ResetStatistics(pAdapter, i);
+              if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+                return VOS_STATUS_E_FAULT;               
+          }
+        }
+    }
+
+    return vosStatus;
+}
+#endif
+#ifdef ANI_CHIPSET_VOLANS
+/*===============================================================================
+  FUNCTION      WLANTL_IsReplayPacket
+     
+  DESCRIPTION   This function does replay check for valid stations
+ 
+  DEPENDENCIES  Validity of replay check must be done before the function 
+                is called
+                          
+  PARAMETERS    currentReplayCounter    current replay counter taken from RX BD 
+                previousReplayCounter   previous replay counter taken from TL CB
+                                       
+  RETRUN        VOS_TRUE    packet is a replay packet
+                VOS_FALSE   packet is not a replay packet
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+v_BOOL_t
+WLANTL_IsReplayPacket
+(
+  v_U64_t    ullcurrentReplayCounter,
+  v_U64_t    ullpreviousReplayCounter
+)
+{
+   /* Do the replay check by comparing previous received replay counter with
+      current received replay counter*/
+    if(ullpreviousReplayCounter < ullcurrentReplayCounter)
+    {
+        /* Valid packet not replay */
+        return VOS_FALSE;
+    }
+    else
+    {
+
+        /* Current packet number is less than or equal to previuos received 
+           packet no, this means current packet is replay packet */
+        VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL: Replay packet found with replay counter :[0x%llX]",ullcurrentReplayCounter);
+           
+        return VOS_TRUE;
+    }
+}
+
+#if 0
+/*===============================================================================
+  FUNCTION      WLANTL_GetReplayCounterFromRxBD
+     
+  DESCRIPTION   This function extracts 48-bit replay packet number from RX BD 
+ 
+  DEPENDENCIES  Validity of replay check must be done before the function 
+                is called
+                          
+  PARAMETERS    pucRxHeader pointer to RX BD header
+                                       
+  RETRUN        v_U64_t    Packet number extarcted from RX BD
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+v_U64_t
+WLANTL_GetReplayCounterFromRxBD
+(
+   v_U8_t *pucRxBDHeader
+)
+{
+/* 48-bit replay counter is created as follows
+   from RX BD 6 byte PMI command:
+   Addr : AES/TKIP
+   0x38 : pn3/tsc3
+   0x39 : pn2/tsc2
+   0x3a : pn1/tsc1
+   0x3b : pn0/tsc0
+
+   0x3c : pn5/tsc5
+   0x3d : pn4/tsc4 */
+
+#ifdef ANI_BIG_BYTE_ENDIAN
+    v_U64_t ullcurrentReplayCounter = 0;
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    ullcurrentReplayCounter <<= 16;
+    ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
+    return ullcurrentReplayCounter;
+#else
+    v_U64_t ullcurrentReplayCounter = 0;
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF); 
+    ullcurrentReplayCounter <<= 32; 
+    ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    return ullcurrentReplayCounter;
+#endif
+}
+#endif
+#endif
+
+/*===============================================================================
+  FUNCTION      WLANTL_PostResNeeded
+     
+  DESCRIPTION   This function posts message to TL to reserve BD/PDU memory
+ 
+  DEPENDENCIES  None
+                          
+  PARAMETERS    pvosGCtx
+                                       
+  RETURN        None
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+
+void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx)
+{
+  vos_msg_t            vosMsg;
+
+  vosMsg.reserved = 0;
+  vosMsg.bodyptr  = NULL;
+  vosMsg.type     = WLANTL_TX_RES_NEEDED;
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        "WLAN TL: BD/PDU available interrupt received, Posting message to TL");
+  if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
+  {
+    VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+       " %s fails to post message", __FUNCTION__);
+  }
+}
+
+/*===============================================================================
+  FUNCTION       WLANTL_UpdateRssiBmps
+
+  DESCRIPTION    This function updates the TL's RSSI (in BMPS mode)
+
+  DEPENDENCIES   None
+
+  PARAMETERS
+
+    pvosGCtx         VOS context          VOS Global context
+    staId            Station ID           Station ID
+    rssi             RSSI (BMPS mode)     RSSI in BMPS mode
+
+  RETURN         None
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+
+void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi)
+{
+  WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
+
+  if (NULL != pTLCb)
+  {
+    pTLCb->atlSTAClients[staId].rssiAvgBmps = rssi;
+  }
+}
diff --git a/CORE/TL/src/wlan_qct_tl_ba.c b/CORE/TL/src/wlan_qct_tl_ba.c
new file mode 100644
index 0000000..f70264f
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tl_ba.c
@@ -0,0 +1,1763 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ T L _ B A. C
+                                               
+  OVERVIEW:
+  
+  This software unit holds the implementation of the WLAN Transport Layer
+  Block Ack session support. Also included are the AMSDU de-aggregation 
+  completion and MSDU re-ordering functionality. 
+  
+  The functions externalized by this module are to be called ONLY by the main
+  TL module or the HAL layer.
+
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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
+----------    ---    --------------------------------------------------------
+2010-10-xx    dli     Change ucCIndex to point to the slot the next frame to be expected to fwd
+2008-08-22    sch     Update based on unit test
+2008-07-31    lti     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_tl.h" 
+#include "wlan_qct_wda.h" 
+#include "wlan_qct_tli.h" 
+#include "wlan_qct_tli_ba.h" 
+#include "wlan_qct_hal.h" 
+#include "vos_list.h"
+#include "vos_lock.h"
+#include "tlDebug.h"
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+//#define WLANTL_REORDER_DEBUG_MSG_ENABLE
+#define WLANTL_BA_REORDERING_AGING_TIMER   30   /* 30 millisec */
+#define WLANTL_BA_MIN_FREE_RX_VOS_BUFFER   0    /* RX VOS buffer low threshold */
+
+
+/*==========================================================================
+
+   FUNCTION    tlReorderingAgingTimerExpierCB
+
+   DESCRIPTION 
+      After aging timer expiered, all Qed frames have to be routed to upper
+      layer. Otherwise, there is possibilitied that ahng some frames
+    
+   PARAMETERS 
+      v_PVOID_t  timerUdata    Timer callback user data
+                               Has information about where frames should be
+                               routed
+   
+   RETURN VALUE
+      VOS_STATUS_SUCCESS       General success
+      VOS_STATUS_E_INVAL       Invalid frame handle
+  
+============================================================================*/
+v_VOID_t WLANTL_ReorderingAgingTimerExpierCB
+(
+   v_PVOID_t  timerUdata
+)
+{
+   WLANTL_TIMER_EXPIER_UDATA_T *expireHandle;
+   WLANTL_BAReorderType        *ReorderInfo;
+   WLANTL_CbType               *pTLHandle;
+   vos_pkt_t                   *vosDataBuff;
+   VOS_STATUS                   status = VOS_STATUS_SUCCESS;
+   v_U8_t                       ucSTAID;
+   v_U8_t                       ucTID;
+   v_U8_t                       opCode;
+   WLANTL_RxMetaInfoType        wRxMetaInfo;
+   v_U32_t                      fwIdx = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   if(NULL == timerUdata)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer Callback User data NULL"));
+      return;
+   }
+
+   expireHandle = (WLANTL_TIMER_EXPIER_UDATA_T *)timerUdata;
+   ucSTAID      = (v_U8_t)expireHandle->STAID;
+   ucTID        = expireHandle->TID;
+   if(WLANTL_STA_ID_INVALID(ucSTAID) || WLANTL_TID_INVALID(ucTID))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"SID %d or TID %d is not valid",
+                  ucSTAID, ucTID));
+      return;
+   }
+
+   pTLHandle    = (WLANTL_CbType *)expireHandle->pTLHandle;
+   if(NULL == pTLHandle)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"TL Control block NULL"));
+      return;
+   }
+
+   ReorderInfo = &pTLHandle->atlSTAClients[ucSTAID].atlBAReorderInfo[ucTID];
+   if(NULL == ReorderInfo)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reorder data NULL, this could not happen SID %d, TID %d", 
+                  ucSTAID, ucTID));
+      return;
+   }
+
+   if(0 == pTLHandle->atlSTAClients[ucSTAID].atlBAReorderInfo[ucTID].ucExists)
+   {
+       TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reorder session doesn't exist SID %d, TID %d", 
+                   ucSTAID, ucTID));
+       return;
+   }
+
+   if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&ReorderInfo->reorderLock)))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Get LOCK Fail"));
+      return;
+   }
+
+   if( pTLHandle->atlSTAClients[ucSTAID].atlBAReorderInfo[ucTID].ucExists == 0 )
+   {
+      vos_lock_release(&ReorderInfo->reorderLock);
+      return;
+   }
+
+   opCode      = WLANTL_OPCODE_FWDALL_DROPCUR;
+   vosDataBuff = NULL;
+
+
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"BA timeout with %d pending frames, curIdx %d", ReorderInfo->pendingFramesCount, ReorderInfo->ucCIndex));
+
+   if(ReorderInfo->pendingFramesCount == 0)
+   {
+      if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
+      }
+      return;
+   }
+
+   if(0 == ReorderInfo->ucCIndex)
+   {
+      fwIdx = ReorderInfo->winSize;
+   }
+   else
+   {
+      fwIdx = ReorderInfo->ucCIndex - 1;
+   }
+
+#ifdef ANI_CHIPSET_VOLANS
+   /* Do replay check before giving packets to upper layer 
+      replay check code : check whether replay check is needed or not */
+   if(VOS_TRUE == pTLHandle->atlSTAClients[ucSTAID].ucIsReplayCheckValid)
+   {
+       v_U64_t    ullpreviousReplayCounter = 0;
+       v_U64_t    ullcurrentReplayCounter = 0;
+       v_U8_t     ucloopCounter = 0;
+       v_BOOL_t   status = 0;
+
+       /*Do replay check for all packets which are in Reorder buffer */
+       for(ucloopCounter = 0; ucloopCounter < WLANTL_MAX_WINSIZE; ucloopCounter++)
+       {
+         /*Get previous reply counter*/
+         ullpreviousReplayCounter = pTLHandle->atlSTAClients[ucSTAID].ullReplayCounter[ucTID];
+
+         /*Get current replay counter of packet in reorder buffer*/
+         ullcurrentReplayCounter = ReorderInfo->reorderBuffer->ullReplayCounter[ucloopCounter];
+
+         /*Check for holes, if a hole is found in Reorder buffer then
+           no need to do replay check on it, skip the current
+           hole and do replay check on other packets*/
+         if(NULL != (ReorderInfo->reorderBuffer->arrayBuffer[ucloopCounter]))
+         {
+           status = WLANTL_IsReplayPacket(ullcurrentReplayCounter, ullpreviousReplayCounter); 
+           if(VOS_TRUE == status)
+           {
+               /*Increment the debug counter*/
+               pTLHandle->atlSTAClients[ucSTAID].ulTotalReplayPacketsDetected++;
+
+               /*A replay packet found*/
+               VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLANTL_ReorderingAgingTimerExpierCB: total dropped replay packets on STA ID %X is [0x%lX]\n",
+                ucSTAID, pTLHandle->atlSTAClients[ucSTAID].ulTotalReplayPacketsDetected);
+
+               VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLANTL_ReorderingAgingTimerExpierCB: replay packet found with PN : [0x%llX]\n",
+                ullcurrentReplayCounter);
+
+               VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLANTL_ReorderingAgingTimerExpierCB: Drop the replay packet with PN : [0x%llX]\n",
+                ullcurrentReplayCounter);
+
+               ReorderInfo->reorderBuffer->arrayBuffer[ucloopCounter] = NULL;
+               ReorderInfo->reorderBuffer->ullReplayCounter[ucloopCounter] = 0;
+           }
+           else
+           {
+              /*Not a replay packet update previous replay counter*/
+              pTLHandle->atlSTAClients[ucSTAID].ullReplayCounter[ucTID] = ullcurrentReplayCounter;
+           }
+         }
+         else
+         {
+              /* A hole detected in Reorder buffer*/
+              //BAMSGERROR("WLANTL_ReorderingAgingTimerExpierCB,hole detected\n",0,0,0);
+               
+         }
+       } 
+   }
+#endif
+
+   status = WLANTL_ChainFrontPkts(fwIdx, opCode, 
+                                  &vosDataBuff, ReorderInfo, NULL);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make packet chain fail with Qed frames %d", status));
+      if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
+      }
+      return;
+   }
+
+   if(NULL == pTLHandle->atlSTAClients[ucSTAID].pfnSTARx)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Callback function NULL with STAID %d", ucSTAID));
+      if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
+      }
+      return;
+   }
+
+   if(NULL == vosDataBuff)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"No pending frames, why triggered timer? "));
+      if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
+      }
+      return;
+   }
+
+#ifdef WLAN_SOFTAP_FEATURE  
+   if( WLAN_STA_SOFTAP == pTLHandle->atlSTAClients[ucSTAID].wSTADesc.wSTAType)
+   {
+      WLANTL_FwdPktToHDD( expireHandle->pAdapter, vosDataBuff, ucSTAID);
+   }
+   else
+#endif
+   {
+      wRxMetaInfo.ucUP = ucTID;
+      pTLHandle->atlSTAClients[ucSTAID].pfnSTARx(expireHandle->pAdapter,
+                                           vosDataBuff, ucSTAID, &wRxMetaInfo);
+   }
+   if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
+   }
+   return;
+}/*WLANTL_ReorderingAgingTimerExpierCB*/
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH TL Main
+ ---------------------------------------------------------------------------*/
+/*==========================================================================
+
+   FUNCTION    WLANTL_InitBAReorderBuffer
+
+   DESCRIPTION 
+      Init Reorder buffer array
+    
+   PARAMETERS 
+      v_PVOID_t   pvosGCtx Global context
+
+   RETURN VALUE
+      NONE
+  
+============================================================================*/
+
+void WLANTL_InitBAReorderBuffer
+(
+   v_PVOID_t   pvosGCtx
+)
+{
+   WLANTL_CbType        *pTLCb;
+   v_U32_t              idx;
+   v_U32_t              pIdx;
+
+   pTLCb = VOS_GET_TL_CB(pvosGCtx);
+   if (NULL == pTLCb)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid TL Control Block", __FUNCTION__));
+      return;
+   }
+
+   for(idx = 0; idx < WLANTL_MAX_BA_SESSION; idx++)
+   {
+      pTLCb->reorderBufferPool[idx].isAvailable = VOS_TRUE;
+      for(pIdx = 0; pIdx < WLANTL_MAX_WINSIZE; pIdx++)
+      {
+         pTLCb->reorderBufferPool[idx].arrayBuffer[pIdx] = NULL;
+#ifdef ANI_CHIPSET_VOLANS
+         pTLCb->reorderBufferPool[idx].ullReplayCounter[pIdx] = 0; 
+#endif
+      }
+   }
+
+   TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"BA reorder buffer init"));
+   return;
+}
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_BaSessionAdd
+
+  DESCRIPTION 
+    HAL notifies TL when a new Block Ack session is being added. 
+    
+  DEPENDENCIES 
+    A BA session on Rx needs to be added in TL before the response is 
+    being sent out 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station for which requested the BA 
+                    session
+    ucTid:          Tspec ID for the new BA session
+    uSize:          size of the reordering window
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:      Input parameters are invalid 
+    VOS_STATUS_E_FAULT:      Station ID is outside array boundaries or pointer 
+                             to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:     Station was not registered or BA session already
+                             exists
+    VOS_STATUS_E_NOSUPPORT:  Not yet supported
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_BaSessionAdd 
+( 
+  v_PVOID_t   pvosGCtx, 
+  v_U16_t     sessionID,
+  v_U32_t     ucSTAId,
+  v_U8_t      ucTid, 
+  v_U32_t     uBufferSize,
+  v_U32_t     winSize,
+  v_U32_t     SSN
+)
+{
+  WLANTL_CbType        *pTLCb = NULL; 
+  WLANTL_BAReorderType *reorderInfo;
+  v_U32_t               idx;
+  VOS_STATUS            status = VOS_STATUS_SUCCESS;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( WLANTL_TID_INVALID(ucTid))
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_BaSessionAdd");
+    return VOS_STATUS_E_INVAL;
+  }
+
+  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid station id requested on WLANTL_BaSessionAdd");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_BaSessionAdd");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Station was not yet registered on WLANTL_BaSessionAdd");
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Verify that BA session was not already added
+   ------------------------------------------------------------------------*/
+  if ( 0 != pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists ) 
+  {
+    pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists++;
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:BA session already exists on WLANTL_BaSessionAdd");
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  /*------------------------------------------------------------------------
+    Initialize new BA session 
+   ------------------------------------------------------------------------*/
+  reorderInfo = &pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid];
+
+  for(idx = 0; idx < WLANTL_MAX_BA_SESSION; idx++)
+  {
+    if(VOS_TRUE == pTLCb->reorderBufferPool[idx].isAvailable)
+    {
+      pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].reorderBuffer =
+                                            &(pTLCb->reorderBufferPool[idx]);
+      pTLCb->reorderBufferPool[idx].isAvailable = VOS_FALSE;
+      TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"%dth buffer available, buffer PTR 0x%p",
+                  idx,
+                  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].reorderBuffer
+                  ));
+      break;
+    }
+  }
+
+#ifdef WLAN_SOFTAP_FEATURE  
+  
+  if( WLAN_STA_SOFTAP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType)
+  {
+      if( WLANTL_MAX_BA_SESSION == idx) 
+      {
+          VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "Number of Add BA request received more than allowed \n");
+          return VOS_STATUS_E_NOSUPPORT;
+      }
+  }
+#endif
+  reorderInfo->timerUdata.pAdapter     = pvosGCtx;
+  reorderInfo->timerUdata.pTLHandle    = (v_PVOID_t)pTLCb;
+  reorderInfo->timerUdata.STAID        = ucSTAId;
+  reorderInfo->timerUdata.TID          = ucTid;
+
+  /* BA aging timer */
+  status = vos_timer_init(&reorderInfo->agingTimer,
+                          VOS_TIMER_TYPE_SW,
+                          WLANTL_ReorderingAgingTimerExpierCB,
+                          (v_PVOID_t)(&reorderInfo->timerUdata));
+  if(!VOS_IS_STATUS_SUCCESS(status))
+  {
+     TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer Init Fail"));
+     return status;
+  }
+
+  /* Reorder LOCK
+   * During handle normal RX frame, if timer sxpier, abnormal race condition happen
+   * Frames should be protected from double handle */
+  status = vos_lock_init(&reorderInfo->reorderLock);
+  if(!VOS_IS_STATUS_SUCCESS(status))
+  {
+     TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Lock Init Fail"));
+     return status;
+  }
+
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists++;
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].usCount   = 0;
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucCIndex  = 0;
+  if(0 == winSize)
+  {
+    pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].winSize =
+                                                   WLANTL_MAX_WINSIZE;
+  }
+  else
+  {
+    pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].winSize   = winSize;
+  }
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].SSN       = SSN;
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].sessionID = sessionID;
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].pendingFramesCount = 0;
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL:New BA session added for STA: %d TID: %d",
+             ucSTAId, ucTid));
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_BaSessionAdd */
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_BaSessionDel
+
+  DESCRIPTION 
+    HAL notifies TL when a new Block Ack session is being deleted. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station for which requested the BA 
+                    session
+    ucTid:          Tspec ID for the new BA session
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:      Input parameters are invalid 
+    VOS_STATUS_E_FAULT:      Station ID is outside array boundaries or pointer 
+                             to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:     Station was not registered or BA session already
+                             exists
+    VOS_STATUS_E_NOSUPPORT:  Not yet supported
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_BaSessionDel 
+( 
+  v_PVOID_t      pvosGCtx, 
+  v_U16_t        ucSTAId,
+  v_U8_t         ucTid
+)
+{
+  WLANTL_CbType*          pTLCb       = NULL; 
+  vos_pkt_t*              vosDataBuff = NULL;
+  VOS_STATUS              vosStatus   = VOS_STATUS_E_FAILURE;
+  VOS_STATUS              lockStatus = VOS_STATUS_E_FAILURE;  
+  WLANTL_BAReorderType*   reOrderInfo = NULL;
+  WLANTL_RxMetaInfoType   wRxMetaInfo;
+  v_U32_t                 fwIdx = 0;
+  tANI_U8                 lockRetryCnt = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( WLANTL_TID_INVALID(ucTid))
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid parameter sent on WLANTL_BaSessionDel");
+    return VOS_STATUS_E_INVAL;
+  }
+
+   if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+              "WLAN TL:Invalid station id requested on WLANTL_BaSessionDel");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TL control block and check existance
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_BaSessionDel");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  if (( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists ) &&
+      ( 0 == pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "WLAN TL:Station was not yet registered on WLANTL_BaSessionDel");
+    return VOS_STATUS_E_EXISTS;
+  }
+  else if(( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists ) &&
+          ( 0 != pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+          "STA was deleted but BA info is still there, just remove BA info");
+
+    reOrderInfo = &pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid];
+    reOrderInfo->reorderBuffer->isAvailable = VOS_TRUE;
+    memset(&reOrderInfo->reorderBuffer->arrayBuffer[0],
+           0,
+           WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
+    vos_timer_destroy(&reOrderInfo->agingTimer);
+    memset(reOrderInfo, 0, sizeof(WLANTL_BAReorderType));
+
+    return VOS_STATUS_SUCCESS;
+  }
+
+  /*------------------------------------------------------------------------
+    Verify that BA session was added
+   ------------------------------------------------------------------------*/
+  if ( 0 == pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:BA session does not exists on WLANTL_BaSessionDel");
+    return VOS_STATUS_E_EXISTS;
+  }
+
+  
+  /*------------------------------------------------------------------------
+     Send all pending packets to HDD 
+   ------------------------------------------------------------------------*/
+  reOrderInfo = &pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid];
+
+  /*------------------------------------------------------------------------
+     Invalidate reorder info here. This ensures that no packets are 
+     bufferd after  reorder buffer is cleaned.
+   */
+  lockStatus = vos_lock_acquire(&reOrderInfo->reorderLock);
+  if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+          "Unable to acquire reorder vos lock in %s\n", __FUNCTION__));
+    return lockStatus;
+  }
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists = 0;
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL: Fwd all packets to HDD on WLANTL_BaSessionDel"));
+
+  if(0 == reOrderInfo->ucCIndex)
+  {
+     fwIdx = reOrderInfo->winSize;
+  }
+  else
+  {
+     fwIdx = reOrderInfo->ucCIndex - 1;
+  }
+
+  if(0 != reOrderInfo->pendingFramesCount)
+  {
+    vosStatus = WLANTL_ChainFrontPkts(fwIdx,
+                                      WLANTL_OPCODE_FWDALL_DROPCUR,
+                                      &vosDataBuff, reOrderInfo, pTLCb);
+  }
+
+  if ((VOS_STATUS_SUCCESS == vosStatus) && (NULL != vosDataBuff))
+  {
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL: Chaining was successful sending all pkts to HDD : %x",
+              vosDataBuff ));
+
+#ifdef WLAN_SOFTAP_FEATURE
+    if ( WLAN_STA_SOFTAP == pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType )
+    {
+      WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId);
+    }
+    else
+#endif
+    {
+      wRxMetaInfo.ucUP = ucTid;
+      pTLCb->atlSTAClients[ucSTAId].pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
+                                            &wRxMetaInfo );
+    }
+  }
+
+  vos_lock_release(&reOrderInfo->reorderLock);
+
+  /*------------------------------------------------------------------------
+     Delete reordering timer
+   ------------------------------------------------------------------------*/
+  if(VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(&reOrderInfo->agingTimer))
+  {
+    vosStatus = vos_timer_stop(&reOrderInfo->agingTimer);
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    { 
+       TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer stop fail", vosStatus));
+       return vosStatus;
+    }
+  }
+
+  if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&reOrderInfo->agingTimer))
+  {
+     vosStatus = vos_timer_destroy(&reOrderInfo->agingTimer);
+  }
+  else
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer is not stopped state current state is %d",
+                vos_timer_getCurrentState(&reOrderInfo->agingTimer)));
+  }
+  if ( VOS_STATUS_SUCCESS != vosStatus ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
+              "WLAN TL:Failed to destroy reorder timer on WLANTL_BaSessionAdd");
+  }
+
+  /*------------------------------------------------------------------------
+    Delete session 
+   ------------------------------------------------------------------------*/
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].usCount  = 0;
+  pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucCIndex = 0;
+  reOrderInfo->winSize   = 0;
+  reOrderInfo->SSN       = 0;
+  reOrderInfo->sessionID = 0;
+
+  while (vos_lock_destroy(&reOrderInfo->reorderLock) == VOS_STATUS_E_BUSY)
+  {
+    if( lockRetryCnt > 2)
+    {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "Unable to destroy reorderLock\n"));
+      break;
+    }
+    vos_sleep(1);
+    lockRetryCnt++;
+  }
+
+  TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN TL: BA session deleted for STA: %d TID: %d",
+             ucSTAId, ucTid));
+
+  memset((v_U8_t *)(&reOrderInfo->reorderBuffer->arrayBuffer[0]),
+                    0,
+                    WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
+  reOrderInfo->reorderBuffer->isAvailable = VOS_TRUE;
+
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_BaSessionDel */
+
+
+/*----------------------------------------------------------------------------
+    INTERACTION WITH TL main module
+ ---------------------------------------------------------------------------*/
+
+/*==========================================================================
+      AMSDU sub-frame processing module
+  ==========================================================================*/
+/*==========================================================================
+  FUNCTION    WLANTL_AMSDUProcess
+
+  DESCRIPTION 
+    Process A-MSDU sub-frame. Start of chain if marked as first frame. 
+    Linked at the end of the existing AMSDU chain. 
+
+  DEPENDENCIES 
+         
+  PARAMETERS 
+
+   IN/OUT:
+   vosDataBuff: vos packet for the received data
+                 outgoing contains the root of the chain for the rx 
+                 aggregated MSDU if the frame is marked as last; otherwise 
+                 NULL
+   
+   IN
+   pvosGCtx:     pointer to the global vos context; a handle to TL's 
+                 control block can be extracted from its context 
+   pvBDHeader:   pointer to the BD header
+   ucSTAId:      Station ID 
+   ucMPDUHLen:   length of the MPDU header
+   usMPDULen:    length of the MPDU 
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a 
+                          page fault  
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  Other values can be returned as a result of a function call, please check 
+  corresponding API for more info. 
+  
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_AMSDUProcess
+( 
+  v_PVOID_t   pvosGCtx,
+  vos_pkt_t** ppVosDataBuff, 
+  v_PVOID_t   pvBDHeader,
+  v_U8_t      ucSTAId,
+  v_U8_t      ucMPDUHLen,
+  v_U16_t     usMPDULen
+)
+{
+  v_U8_t          ucFsf; /* First AMSDU sub frame */
+  v_U8_t          ucAef; /* Error in AMSDU sub frame */
+  WLANTL_CbType*  pTLCb = NULL; 
+  v_U8_t          MPDUHeaderAMSDUHeader[WLANTL_MPDU_HEADER_LEN + TL_AMSDU_SUBFRM_HEADER_LEN];
+  v_U16_t         subFrameLength;
+  v_U16_t         paddingSize;
+  VOS_STATUS      vStatus = VOS_STATUS_SUCCESS;
+  v_U16_t         MPDUDataOffset;
+  v_U16_t         packetLength; 
+  static v_U32_t  numAMSDUFrames = 0;
+  vos_pkt_t*      vosDataBuff;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (( NULL == ppVosDataBuff ) || (NULL == *ppVosDataBuff) || ( NULL == pvBDHeader ) || 
+      ( WLANTL_STA_ID_INVALID(ucSTAId)) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Invalid parameter sent on WLANTL_AMSDUProcess");
+    return VOS_STATUS_E_INVAL;
+  }
+
+  vosDataBuff = *ppVosDataBuff;
+  /*------------------------------------------------------------------------
+    Extract TL control block 
+   ------------------------------------------------------------------------*/
+  pTLCb = VOS_GET_TL_CB(pvosGCtx);
+  if ( NULL == pTLCb ) 
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_AMSDUProcess");
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Check frame
+   ------------------------------------------------------------------------*/
+  ucAef =  (v_U8_t)WDA_GET_RX_AEF( pvBDHeader );
+  ucFsf =  (v_U8_t)WDA_GET_RX_ESF( pvBDHeader );
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  MPDUDataOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader) - WLANHAL_RX_BD_HEADER_SIZE;
+#else
+  /* On Prima, MPDU data offset not includes BD header size */
+  MPDUDataOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+  if ( WLANHAL_RX_BD_AEF_SET == ucAef ) 
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Error in AMSDU - dropping entire chain"));
+
+    vos_pkt_return_packet(vosDataBuff);
+    *ppVosDataBuff = NULL;
+    return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+  }
+
+  if((0 != ucMPDUHLen) && ucFsf)
+  {
+    /*
+     * This is first AMSDU sub frame
+     * AMSDU Header should be removed
+     * MPDU header should be stored into context to recover next frames
+     */
+    vStatus = vos_pkt_pop_head(vosDataBuff, MPDUHeaderAMSDUHeader, ucMPDUHLen + TL_AMSDU_SUBFRM_HEADER_LEN);
+    if(!VOS_IS_STATUS_SUCCESS(vStatus))
+    {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Pop MPDU AMSDU Header fail"));
+      vos_pkt_return_packet(vosDataBuff);
+      *ppVosDataBuff = NULL;
+      return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+    }
+    pTLCb->atlSTAClients[ucSTAId].ucMPDUHeaderLen = ucMPDUHLen;
+    memcpy(pTLCb->atlSTAClients[ucSTAId].aucMPDUHeader, MPDUHeaderAMSDUHeader, ucMPDUHLen);
+    /* AMSDU header stored to handle gabage data within next frame */
+  }
+  else
+  {
+    /* Trim gabage, size is frameLoop */
+    if(MPDUDataOffset > 0)
+    {
+      vStatus = vos_pkt_trim_head(vosDataBuff, MPDUDataOffset);
+    }
+    if(!VOS_IS_STATUS_SUCCESS(vStatus))
+    {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trim Garbage Data fail"));
+      vos_pkt_return_packet(vosDataBuff);
+      *ppVosDataBuff = NULL;
+      return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+    }
+
+    /* Remove MPDU header and AMSDU header from the packet */
+    vStatus = vos_pkt_pop_head(vosDataBuff, MPDUHeaderAMSDUHeader, ucMPDUHLen + TL_AMSDU_SUBFRM_HEADER_LEN);
+    if(!VOS_IS_STATUS_SUCCESS(vStatus))
+    {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"AMSDU Header Pop fail"));
+      vos_pkt_return_packet(vosDataBuff);
+      *ppVosDataBuff = NULL;
+      return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+    }
+  } /* End of henalding not first sub frame specific */
+
+  /* Put in MPDU header into all the frame */
+  vStatus = vos_pkt_push_head(vosDataBuff, pTLCb->atlSTAClients[ucSTAId].aucMPDUHeader, pTLCb->atlSTAClients[ucSTAId].ucMPDUHeaderLen);
+  if(!VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"MPDU Header Push back fail"));
+    vos_pkt_return_packet(vosDataBuff);
+    *ppVosDataBuff = NULL;
+    return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+  }
+
+  /* Find Padding and remove */
+  memcpy(&subFrameLength, MPDUHeaderAMSDUHeader + ucMPDUHLen + WLANTL_AMSDU_SUBFRAME_LEN_OFFSET, sizeof(v_U16_t));
+  subFrameLength = vos_be16_to_cpu(subFrameLength);
+  paddingSize = usMPDULen - ucMPDUHLen - subFrameLength - TL_AMSDU_SUBFRM_HEADER_LEN;
+
+  vos_pkt_get_packet_length(vosDataBuff, &packetLength);
+  if((paddingSize > 0) && (paddingSize < packetLength))
+  {
+    /* There is padding bits, remove it */
+    vos_pkt_trim_tail(vosDataBuff, paddingSize);
+  }
+  else if(0 == paddingSize)
+  {
+    /* No Padding bits */
+    /* Do Nothing */
+  }
+  else
+  {
+    /* Padding size is larger than Frame size, Actually negative */
+    /* Not a valid case, not a valid frame, drop it */
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Padding Size is negative, no possible %d", paddingSize));
+    vos_pkt_return_packet(vosDataBuff);
+    *ppVosDataBuff = NULL;
+    return VOS_STATUS_SUCCESS; /*Not a transport error*/ 
+  }
+
+  numAMSDUFrames++;
+  if(0 == (numAMSDUFrames % 5000))
+  {
+    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%lu AMSDU frames arrived", numAMSDUFrames));
+  }
+  return VOS_STATUS_SUCCESS;
+}/* WLANTL_AMSDUProcess */
+
+/*==========================================================================
+      Re-ordering module
+  ==========================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_MSDUReorder
+
+  DESCRIPTION 
+    MSDU reordering 
+
+  DEPENDENCIES 
+         
+  PARAMETERS 
+
+   IN
+   
+   vosDataBuff: vos packet for the received data
+   pvBDHeader: pointer to the BD header
+   ucSTAId:    Station ID 
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANTL_MSDUReorder
+( 
+   WLANTL_CbType    *pTLCb,
+   vos_pkt_t        **vosDataBuff, 
+   v_PVOID_t        pvBDHeader,
+   v_U8_t           ucSTAId,
+   v_U8_t           ucTid
+)
+{
+   WLANTL_BAReorderType *currentReorderInfo;
+   vos_pkt_t            *vosPktIdx;
+   v_U8_t               ucOpCode; 
+   v_U8_t               ucSlotIdx;
+   v_U8_t               ucFwdIdx;
+   v_U16_t              CSN;
+   v_U32_t              ucCIndexOrig;
+   VOS_STATUS           status      = VOS_STATUS_SUCCESS;
+   VOS_STATUS           lockStatus  = VOS_STATUS_SUCCESS; 
+   VOS_STATUS           timerStatus = VOS_STATUS_SUCCESS; 
+   VOS_TIMER_STATE      timerState;
+   v_SIZE_t             rxFree;
+#ifdef ANI_CHIPSET_VOLANS
+   v_U64_t              ullreplayCounter = 0; /* 48-bit replay counter */
+#endif
+   if((NULL == pTLCb) || (*vosDataBuff == NULL))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid ARG pTLCb 0x%p, vosDataBuff 0x%p",
+                  pTLCb, *vosDataBuff));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   currentReorderInfo = &pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid];
+
+   lockStatus = vos_lock_acquire(&currentReorderInfo->reorderLock);
+   if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+      return lockStatus;
+   }
+
+   if( pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists == 0 )
+   {
+     vos_lock_release(&currentReorderInfo->reorderLock);
+     return VOS_STATUS_E_INVAL;
+   }
+   ucOpCode  = (v_U8_t)WDA_GET_RX_REORDER_OPCODE(pvBDHeader);
+   ucSlotIdx = (v_U8_t)WDA_GET_RX_REORDER_SLOT_IDX(pvBDHeader);
+   ucFwdIdx  = (v_U8_t)WDA_GET_RX_REORDER_FWD_IDX(pvBDHeader);
+   CSN       = (v_U16_t)WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO(pvBDHeader);
+
+
+
+#ifdef WLANTL_HAL_VOLANS
+   /* Replay check code : check whether replay check is needed or not */
+   if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+   {
+           /* Getting 48-bit replay counter from the RX BD */
+           ullreplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
+   }
+#endif 
+
+#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"opCode %d SI %d, FI %d, CI %d seqNo %d", ucOpCode, ucSlotIdx, ucFwdIdx, currentReorderInfo->ucCIndex, CSN));
+#else
+   TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"opCode %d SI %d, FI %d, CI %d seqNo %d", ucOpCode, ucSlotIdx, ucFwdIdx, currentReorderInfo->ucCIndex, CSN));
+#endif
+
+   // remember our current CI so that later we can tell if it advanced
+   ucCIndexOrig = currentReorderInfo->ucCIndex;
+
+   switch(ucOpCode) 
+   {
+      case WLANTL_OPCODE_INVALID:
+         /* Do nothing just pass through current frame */
+         break;
+
+      case WLANTL_OPCODE_QCUR_FWDBUF:
+         if(0 == currentReorderInfo->pendingFramesCount)
+         {
+            //This frame will be fwd'ed to the OS. The next slot is the one we expect next
+            currentReorderInfo->ucCIndex = (ucSlotIdx + 1) % currentReorderInfo->winSize;
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+         status = WLANTL_QueueCurrent(currentReorderInfo,
+                                      vosDataBuff,
+                                      ucSlotIdx);
+#ifdef ANI_CHIPSET_VOLANS
+         if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+         {
+             WLANTL_FillReplayCounter(currentReorderInfo,
+                               ullreplayCounter, ucSlotIdx);
+         }
+#endif
+         if(VOS_STATUS_E_RESOURCES == status)
+         {
+            /* This is the case slot index is already cycle one route, route all the frames Qed */
+            vosPktIdx = NULL;
+            status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                           WLANTL_OPCODE_FWDALL_QCUR, 
+                                           &vosPktIdx,
+                                           currentReorderInfo,
+                                           pTLCb);
+            if(!VOS_IS_STATUS_SUCCESS(status))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+               lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+               if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+                  return lockStatus;
+               }
+               return status;
+            }
+            status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
+            *vosDataBuff = vosPktIdx;
+            currentReorderInfo->pendingFramesCount = 0;
+         }
+         else
+         {
+            vosPktIdx = NULL;
+            status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                           WLANTL_OPCODE_QCUR_FWDBUF, 
+                                           &vosPktIdx,
+                                           currentReorderInfo,
+                                           pTLCb);
+            if(!VOS_IS_STATUS_SUCCESS(status))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+               lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+               if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+                  return lockStatus;
+               }
+               return status;
+            }
+            *vosDataBuff = vosPktIdx;
+         }
+         break;
+
+      case WLANTL_OPCODE_FWDBUF_FWDCUR:
+         vosPktIdx = NULL;
+         status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                        WLANTL_OPCODE_FWDBUF_FWDCUR, 
+                                        &vosPktIdx,
+                                        currentReorderInfo,
+                                        pTLCb);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+
+         if(NULL == vosPktIdx)
+         {
+            TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Nothing to chain, just send current frame\n"));
+         }
+         else
+         {
+            status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
+            if(!VOS_IS_STATUS_SUCCESS(status))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain with CUR frame fail %d",
+                           status));
+               lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+               if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+                  return lockStatus;
+               }
+               return status;
+            }
+            *vosDataBuff = vosPktIdx;
+         }
+         //ucFwdIdx is the slot this packet supposes to take but there is a hole there
+         //It looks that the chip will put the next packet into the slot ucFwdIdx.
+         currentReorderInfo->ucCIndex = ucFwdIdx;
+         break;
+
+      case WLANTL_OPCODE_QCUR:
+         status = WLANTL_QueueCurrent(currentReorderInfo,
+                                      vosDataBuff,
+                                      ucSlotIdx);
+#ifdef ANI_CHIPSET_VOLANS
+           if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+           {
+               WLANTL_FillReplayCounter(currentReorderInfo,
+                                 ullreplayCounter, ucSlotIdx);
+           }
+#endif
+         if(VOS_STATUS_E_RESOURCES == status)
+         {
+            /* This is the case slot index is already cycle one route, route all the frames Qed */
+            vosPktIdx = NULL;
+            status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                           WLANTL_OPCODE_FWDALL_QCUR, 
+                                           &vosPktIdx,
+                                           currentReorderInfo,
+                                           pTLCb);
+            if(!VOS_IS_STATUS_SUCCESS(status))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+               lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+               if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+                  return lockStatus;
+               }
+               return status;
+            }
+            status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
+            *vosDataBuff = vosPktIdx;
+            currentReorderInfo->pendingFramesCount = 0;
+         }
+         else
+         {
+            /* Since current Frame is Qed, no frame will be routed */
+            *vosDataBuff = NULL; 
+         }
+         break;
+
+      case WLANTL_OPCODE_FWDBUF_QUEUECUR:
+         vosPktIdx = NULL;
+         status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                        WLANTL_OPCODE_FWDBUF_QUEUECUR, 
+                                        &vosPktIdx,
+                                        currentReorderInfo,
+                                        pTLCb);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+         //This opCode means the window shift. Enforce the current Index
+         currentReorderInfo->ucCIndex = ucFwdIdx;
+
+         status = WLANTL_QueueCurrent(currentReorderInfo,
+                                      vosDataBuff,
+                                      ucSlotIdx);
+#ifdef ANI_CHIPSET_VOLANS
+           if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+           {
+               WLANTL_FillReplayCounter(currentReorderInfo,
+                                 ullreplayCounter, ucSlotIdx);
+           }
+#endif
+         if(VOS_STATUS_E_RESOURCES == status)
+         {
+            vos_pkt_return_packet(vosPktIdx); 
+            /* This is the case slot index is already cycle one route, route all the frames Qed */
+            vosPktIdx = NULL;
+            status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                           WLANTL_OPCODE_FWDALL_QCUR, 
+                                           &vosPktIdx,
+                                           currentReorderInfo,
+                                           pTLCb);
+            if(!VOS_IS_STATUS_SUCCESS(status))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+               lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+               if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+                  return lockStatus;
+               }
+               return status;
+            }
+            status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
+            *vosDataBuff = vosPktIdx;
+            currentReorderInfo->pendingFramesCount = 0;
+         }
+         *vosDataBuff = vosPktIdx;
+         break;
+
+      case WLANTL_OPCODE_FWDBUF_DROPCUR:
+         vosPktIdx = NULL;
+         status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                        WLANTL_OPCODE_FWDBUF_DROPCUR, 
+                                        &vosPktIdx,
+                                        currentReorderInfo,
+                                        pTLCb);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+
+         //Since BAR frame received, set the index to the right location
+         currentReorderInfo->ucCIndex = ucFwdIdx;
+
+         /* Current frame has to be dropped, BAR frame */
+         status = vos_pkt_return_packet(*vosDataBuff);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Drop BAR frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+         *vosDataBuff = vosPktIdx;
+         break;
+ 
+      case WLANTL_OPCODE_FWDALL_DROPCUR:
+         vosPktIdx = NULL;
+         status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                        WLANTL_OPCODE_FWDALL_DROPCUR, 
+                                        &vosPktIdx,
+                                        currentReorderInfo,
+                                        pTLCb);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+
+         //Since BAR frame received and beyond cur window, set the index to the right location
+         currentReorderInfo->ucCIndex = 0;
+
+         status = vos_pkt_return_packet(*vosDataBuff);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Drop BAR frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+
+         *vosDataBuff = vosPktIdx;
+         break;
+
+      case WLANTL_OPCODE_FWDALL_QCUR:
+         vosPktIdx = NULL;
+         status = WLANTL_ChainFrontPkts(currentReorderInfo->winSize,
+                                        WLANTL_OPCODE_FWDALL_DROPCUR, 
+                                        &vosPktIdx,
+                                        currentReorderInfo,
+                                        pTLCb);
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+         status = WLANTL_QueueCurrent(currentReorderInfo,
+                                      vosDataBuff,
+                                      ucSlotIdx);
+#ifdef ANI_CHIPSET_VOLANS
+           if(VOS_TRUE == pTLCb->atlSTAClients[ucSTAId].ucIsReplayCheckValid)
+           {
+               WLANTL_FillReplayCounter(currentReorderInfo,
+                                 ullreplayCounter, ucSlotIdx);
+           }
+#endif
+         if(!VOS_IS_STATUS_SUCCESS(status))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Q Current frame fail %d",
+                        status));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return status;
+         }
+         currentReorderInfo->ucCIndex = ucSlotIdx;
+         *vosDataBuff = vosPktIdx;
+         break;
+
+      case WLANTL_OPCODE_TEARDOWN:
+         // do we have a procedure in place to teardown BA?
+
+         // fall through to drop the current packet
+      case WLANTL_OPCODE_DROPCUR:
+         vos_pkt_return_packet(*vosDataBuff);
+         *vosDataBuff = NULL;
+         break;
+
+      default:
+         break;
+   }
+
+   /* Check the available VOS RX buffer size
+    * If remaining VOS RX buffer is too few, have to make space
+    * Route all the Qed frames upper layer
+    * Otherwise, RX thread could be stall */
+   vos_pkt_get_available_buffer_pool(VOS_PKT_TYPE_RX_RAW, &rxFree);
+   if(WLANTL_BA_MIN_FREE_RX_VOS_BUFFER > rxFree)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"RX Free", rxFree));
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"RX free buffer count is too low, Pending frame count is %d",
+                  currentReorderInfo->pendingFramesCount));
+      vosPktIdx = NULL;
+      status = WLANTL_ChainFrontPkts(ucFwdIdx,
+                                     WLANTL_OPCODE_FWDALL_DROPCUR, 
+                                     &vosPktIdx,
+                                     currentReorderInfo,
+                                     pTLCb);
+      if(!VOS_IS_STATUS_SUCCESS(status))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
+         lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+         if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+            return lockStatus;
+         }
+         return status;
+      }
+      if(NULL != *vosDataBuff)
+      {
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Already something, Chain it"));
+         vos_pkt_chain_packet(*vosDataBuff, vosPktIdx, 1);
+      }
+      else
+      {
+         *vosDataBuff = vosPktIdx;
+      }
+      currentReorderInfo->pendingFramesCount = 0;
+   }
+
+   /*
+    * Current aging timer logic:
+    * 1) if we forwarded any packets and the timer is running:
+    *    stop the timer
+    * 2) if there are packets queued and the timer is not running:
+    *    start the timer
+    */
+   timerState = vos_timer_getCurrentState(&currentReorderInfo->agingTimer);
+   if ((VOS_TIMER_STATE_RUNNING == timerState) &&
+       (ucCIndexOrig != currentReorderInfo->ucCIndex))
+   {
+      TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"HOLE filled, Pending Frames Count %d",
+                 currentReorderInfo->pendingFramesCount));
+
+      // we forwarded some packets so stop aging the current hole
+      timerStatus = vos_timer_stop(&currentReorderInfo->agingTimer);
+      timerState = VOS_TIMER_STATE_STOPPED;
+
+      // ignore the returned status since there is a race condition
+      // whereby between the time we called getCurrentState() and the
+      // time we call stop() the timer could have fired.  In that case
+      // stop() will return an error, but we don't care since the
+      // timer has stopped
+   }
+
+   if (currentReorderInfo->pendingFramesCount > 0)
+   {
+      if (VOS_TIMER_STATE_STOPPED == timerState)
+      {
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is a new HOLE, Pending Frames Count %d",
+                    currentReorderInfo->pendingFramesCount));
+         timerStatus = vos_timer_start(&currentReorderInfo->agingTimer,
+                                       WLANTL_BA_REORDERING_AGING_TIMER);
+         if(!VOS_IS_STATUS_SUCCESS(timerStatus))
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer start fail", timerStatus));
+            lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+            if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+               return lockStatus;
+            }
+            return timerStatus;
+         }
+      }
+      else
+      {
+         // we didn't forward any packets and the timer was already
+         // running so we're still aging the same hole
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Still HOLE, Pending Frames Count %d",
+                    currentReorderInfo->pendingFramesCount));
+      }
+   }
+
+   lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
+   if(!VOS_IS_STATUS_SUCCESS(lockStatus))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
+      return lockStatus;
+   }
+   return VOS_STATUS_SUCCESS;
+}/* WLANTL_MSDUReorder */
+
+
+/*==========================================================================
+     Utility functions 
+  ==========================================================================*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_QueueCurrent
+
+  DESCRIPTION 
+    It will queue a packet at a given slot index in the MSDU reordering list. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pwBaReorder:   pointer to the BA reordering session info 
+    vosDataBuff:   data buffer to be queued
+    ucSlotIndex:   slot index 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:     Everything is OK
+
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANTL_QueueCurrent
+(
+   WLANTL_BAReorderType*  pwBaReorder,
+   vos_pkt_t**            vosDataBuff,
+   v_U8_t                 ucSlotIndex
+)
+{
+   VOS_STATUS  status = VOS_STATUS_SUCCESS;
+
+   TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"vos Packet has to be Qed 0x%p",
+               *vosDataBuff));
+   if(NULL != pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex])
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"One Cycle rounded, lost many frames already, not in Q %d\n",
+                  pwBaReorder->pendingFramesCount));
+      return VOS_STATUS_E_RESOURCES;
+   }
+
+   pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex] =
+                                           (v_PVOID_t)(*vosDataBuff);
+   pwBaReorder->pendingFramesCount++;
+   TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Assigned, Pending Frames %d at slot %d, dataPtr 0x%x",
+               pwBaReorder->pendingFramesCount,
+               ucSlotIndex,
+               pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex]));
+
+   return status;
+}/*WLANTL_QueueCurrent*/
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ChainFrontPkts
+
+  DESCRIPTION 
+    It will remove all the packets from the front of a vos list and chain 
+    them to a vos pkt . 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    ucCount:       number of packets to extract
+    pwBaReorder:   pointer to the BA reordering session info 
+
+    OUT
+    vosDataBuff:   data buffer containing the extracted chain of packets
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_SUCCESS:     Everything is OK
+
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANTL_ChainFrontPkts
+( 
+   v_U32_t                fwdIndex,
+   v_U8_t                 opCode,
+   vos_pkt_t              **vosDataBuff,
+   WLANTL_BAReorderType   *pwBaReorder,
+   WLANTL_CbType          *pTLCb
+)
+{
+   VOS_STATUS          status = VOS_STATUS_SUCCESS;
+   v_U32_t             idx; 
+   v_PVOID_t           currentDataPtr = NULL;
+   int                 negDetect;
+#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
+#define WLANTL_OUT_OF_WINDOW_IDX    65
+   v_U32_t frameIdx[2] = {0, 0}, ffidx = fwdIndex, idx2 = WLANTL_OUT_OF_WINDOW_IDX;
+   int pending = pwBaReorder->pendingFramesCount, start = WLANTL_OUT_OF_WINDOW_IDX, end;
+#endif
+
+   if(pwBaReorder->ucCIndex >= fwdIndex)
+   {
+      fwdIndex += pwBaReorder->winSize;
+   }
+
+   if((WLANTL_OPCODE_FWDALL_DROPCUR == opCode) ||
+      (WLANTL_OPCODE_FWDALL_QCUR == opCode))
+   {
+      fwdIndex = pwBaReorder->ucCIndex + pwBaReorder->winSize;
+   }
+
+   TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Current Index %d, FWD Index %d, reorderBuffer 0x%p",
+               pwBaReorder->ucCIndex % pwBaReorder->winSize,
+               fwdIndex % pwBaReorder->winSize,
+               pwBaReorder->reorderBuffer));
+
+   negDetect = pwBaReorder->pendingFramesCount;
+   for(idx = pwBaReorder->ucCIndex; idx <= fwdIndex; idx++)
+   {
+      currentDataPtr = 
+      pwBaReorder->reorderBuffer->arrayBuffer[idx % pwBaReorder->winSize];
+      if(NULL != currentDataPtr)
+      {
+#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
+         idx2 = (idx >=  pwBaReorder->winSize) ? (idx -  pwBaReorder->winSize) : idx;
+         frameIdx[idx2 / 32] |= 1 << (idx2 % 32);
+         if(start == WLANTL_OUT_OF_WINDOW_IDX) start = idx2;
+#endif
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is buffered frame %d",
+                     idx % pwBaReorder->winSize));
+         if(NULL == *vosDataBuff)
+         {
+            *vosDataBuff = (vos_pkt_t *)currentDataPtr;
+            TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"This is new head %d",
+                        idx % pwBaReorder->winSize));
+         }
+         else
+         {
+            TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is bufered Just add %d",
+                        idx % pwBaReorder->winSize));
+            vos_pkt_chain_packet(*vosDataBuff,
+                                 (vos_pkt_t *)currentDataPtr,
+                                 VOS_TRUE);
+         }
+         pwBaReorder->reorderBuffer->arrayBuffer[idx  % pwBaReorder->winSize]
+                                                                       = NULL;
+         pwBaReorder->pendingFramesCount--;
+         negDetect--;
+         if(negDetect < 0)
+         {
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"This is not possible, some balance has problem\n"));
+            VOS_ASSERT(0);
+            return VOS_STATUS_E_FAULT;
+         }
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Slot Index %d, set as NULL, Pending Frames %d",
+                     idx  % pwBaReorder->winSize,
+                     pwBaReorder->pendingFramesCount
+                     ));
+         pwBaReorder->ucCIndex = (idx + 1) % pwBaReorder->winSize;
+      }
+      else
+      {
+         TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Empty Array %d",
+                     idx % pwBaReorder->winSize));
+      }
+      TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Current Index %d, winSize %d",
+                  pwBaReorder->ucCIndex,
+                  pwBaReorder->winSize
+                  ));
+   }
+
+#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
+   end = idx2;
+
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Fwd 0x%08X-%08X opCode %d fwdIdx %d windowSize %d pending frame %d fw no. %d from idx %d to %d",
+                     frameIdx[1], frameIdx[0], opCode, ffidx, pwBaReorder->winSize, pending, pending - negDetect, start, end));
+#endif
+
+   return status; 
+}/*WLANTL_ChainFrontPkts*/
+#ifdef ANI_CHIPSET_VOLANS
+/*==========================================================================
+ 
+  FUNCTION    WLANTL_FillReplayCounter
+ 
+  DESCRIPTION 
+    It will fill repaly counter at a given slot index in the MSDU reordering list. 
+            
+  DEPENDENCIES 
+                    
+  PARAMETERS 
+
+  IN
+      pwBaReorder  :   pointer to the BA reordering session info 
+      replayCounter:   replay counter to be filled
+      ucSlotIndex  :   slot index 
+                                      
+  RETURN VALUE
+     NONE 
+
+                                                 
+  SIDE EFFECTS 
+     NONE
+        
+ ============================================================================*/
+void WLANTL_FillReplayCounter
+(
+   WLANTL_BAReorderType*  pwBaReorder,
+   v_U64_t                ullreplayCounter,
+   v_U8_t                 ucSlotIndex
+)
+{
+
+   //BAMSGDEBUG("replay counter to be filled in Qed frames %llu",
+               //replayCounter, 0, 0);
+
+   pwBaReorder->reorderBuffer->ullReplayCounter[ucSlotIndex] = ullreplayCounter;
+   //BAMSGDEBUG("Assigned, replay counter Pending Frames %d at slot %d, replay counter[0x%llX]\n",
+               //pwBaReorder->pendingFramesCount,
+               //ucSlotIndex,
+               //pwBaReorder->reorderBuffer->ullReplayCounter);
+   return;
+}/*WLANTL_FillReplayCounter*/
+#endif /*End of #ifdef WLANTL_HAL_VOLANS*/
+
diff --git a/CORE/TL/src/wlan_qct_tl_hosupport.c b/CORE/TL/src/wlan_qct_tl_hosupport.c
new file mode 100644
index 0000000..3c80984
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tl_hosupport.c
@@ -0,0 +1,1799 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ T L _ HOSUPPORT. C
+                                               
+  OVERVIEW:
+  
+  DEPENDENCIES: 
+
+  Are listed for each API below. 
+  
+  
+  Copyright (c) 2008 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
+----------    ---    --------------------------------------------------------
+02/19/09      lti     Vos trace fix
+02/06/09      sch     Dereg Bug fix
+12/11/08      sch     Initial creation
+
+===========================================================================*/
+#include "wlan_qct_tl.h" 
+#include "wlan_qct_wda.h"
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_tl_hosupport.h"
+#include "wlan_qct_tli.h"
+#include "tlDebug.h"
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+//#define WLANTL_HO_DEBUG_MSG
+//#define WLANTL_HO_UTEST
+
+#define WLANTL_HO_DEFAULT_RSSI      0xFF
+#define WLANTL_HO_DEFAULT_ALPHA     5
+#define WLANTL_HO_INVALID_RSSI      -100
+/* RSSI sampling period, usec based
+ * To reduce performance overhead
+ * Current default 500msec */
+#define WLANTL_HO_SAMPLING_PERIOD   500000
+
+
+
+/* Get and release lock */
+#define THSGETLOCK(a, b)                                      \
+        do                                                    \
+        {                                                     \
+           if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(b)))    \
+           {                                                  \
+              TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%s Get Lock Fail", a));      \
+              return VOS_STATUS_E_FAILURE;                    \
+           }                                                  \
+        }while(0)
+
+#define THSRELEASELOCK(a, b)                                  \
+        do                                                    \
+        {                                                     \
+           if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(b)))    \
+           {                                                  \
+              TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%s Release Lock Fail", a));  \
+              return VOS_STATUS_E_FAILURE;                    \
+           }                                                  \
+        }while(0)
+
+const v_U8_t  WLANTL_HO_TID_2_AC[WLAN_MAX_TID] = {WLANTL_AC_BE, 
+                                                  WLANTL_AC_BK,
+                                                  WLANTL_AC_BK, 
+                                                  WLANTL_AC_BE,
+                                                  WLANTL_AC_VI, 
+                                                  WLANTL_AC_VI,
+                                                  WLANTL_AC_VO,
+                                                  WLANTL_AC_VO};
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+/* Temporary threshold store place for BMPS */
+typedef struct
+{
+   v_S7_t  rssi;
+   v_U8_t  event;
+} WLANTL_HSTempPSIndType;
+
+#ifdef RSSI_HACK
+/* This is a dummy averaged RSSI value that can be controlled using dump commands 
+ * to trigger TL to issue handoff related events. We will be using dump 362 <average RSSI> 
+ * value to change its value */
+int  dumpCmdRSSI = -48;
+#endif
+
+#ifdef WLANTL_HO_UTEST
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+static v_S7_t   rssi;
+static v_S7_t   direction;
+void TLHS_UtestHandleNewRSSI(v_S7_t *newRSSI, v_PVOID_t pAdapter)
+{
+   if(0 == rssi)
+   {
+      direction = -1;
+   }
+   else if(-90 == rssi)
+   {
+      direction = 1;
+   }
+
+   *newRSSI = rssi;
+   rssi += direction;
+
+   return;
+}
+#endif /* WLANTL_HO_UTEST */
+
+#ifdef WLANTL_HO_DEBUG_MSG
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+void WLANTL_StatDebugDisplay
+(
+   v_U8_t                    STAid,
+   WLANTL_TRANSFER_STA_TYPE *statistics
+)
+{
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"================================================="));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Statistics for STA %d", STAid));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX UC Fcnt %5d, MC Fcnt %5d, BC Fcnt %5d",
+                statistics->rxUCFcnt, statistics->rxMCFcnt, statistics->rxBCFcnt));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX UC Bcnt %5d, MC Bcnt %5d, BC Bcnt %5d",
+                statistics->rxUCBcnt, statistics->rxMCBcnt, statistics->rxBCBcnt));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX UC Fcnt %5d, MC Fcnt %5d, BC Fcnt %5d",
+                statistics->txUCFcnt, statistics->txMCFcnt, statistics->txBCFcnt));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX UC Bcnt %5d, MC Bcnt %5d, BC Bcnt %5d",
+                statistics->txUCBcnt, statistics->txMCBcnt, statistics->txBCBcnt));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TRX Bcnt %5d, CRCOK Bcnt %5d, RXRate %5d",
+                statistics->rxBcnt, statistics->rxBcntCRCok, statistics->rxRate));
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"================================================="));
+   return;
+}
+#endif /* WLANTL_HO_DEBUG_MSG */
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+void WLANTL_HSDebugDisplay
+(
+   v_PVOID_t pAdapter
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   v_U8_t                          idx, sIdx;
+   v_BOOL_t                        regionFound = VOS_FALSE;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+
+   if (NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Invalid TL Context",
+                       __FUNCTION__));
+      return;
+   }
+
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+
+
+   for(idx = 0; idx < currentHO->numThreshold; idx++)
+   {
+      if(idx == currentHO->regionNumber)
+      {
+         regionFound = VOS_TRUE;
+         if(VOS_TRUE == tlCtxt->isBMPS)
+         {
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
+                         currentHO->regionNumber, currentHO->alpha));
+         }
+         else
+         {
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI %d, Alpha %d",
+                         currentHO->regionNumber,
+                         currentHO->historyRSSI,
+                         currentHO->alpha));
+         }
+      }
+      for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+      {
+         if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+         {
+            if(VOS_MODULE_ID_HDD == hoSupport->registeredInd[idx].whoIsClient[sIdx])
+            {
+               TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Client HDD pCB %p, triggerEvt %d, RSSI %d",
+                   hoSupport->registeredInd[idx].crossCBFunction[sIdx],
+                             hoSupport->registeredInd[idx].triggerEvent[sIdx],
+                             hoSupport->registeredInd[idx].rssiValue));
+            }
+            else
+            {
+               TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Client SME pCB %p, triggerEvt %d, RSSI %d",
+                             hoSupport->registeredInd[idx].crossCBFunction[sIdx],
+                             hoSupport->registeredInd[idx].triggerEvent[sIdx],
+                             hoSupport->registeredInd[idx].rssiValue));
+            }
+         }
+      }
+   }
+
+   if(VOS_FALSE == regionFound)
+   {
+      if(VOS_TRUE == tlCtxt->isBMPS)
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
+                      currentHO->regionNumber, currentHO->alpha));
+      }
+      else
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI %d, Alpha %d",
+                      currentHO->regionNumber,
+                      currentHO->historyRSSI,
+                      currentHO->alpha));
+      }
+   }
+
+   return;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_SetFWRSSIThresholds
+(
+   v_PVOID_t                       pAdapter
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   tSirRSSIThresholds              bmpsThresholds;
+   WLANTL_HSTempPSIndType          tempIndSet[WLANTL_SINGLE_CLNT_THRESHOLD];
+   v_U8_t                          bmpsLoop;
+   v_U8_t                          bmpsInd;
+   v_U8_t                          clientLoop;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   WLANTL_HSDebugDisplay(pAdapter);
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+
+   memset((v_U8_t *)&tempIndSet[0], 0, WLANTL_SINGLE_CLNT_THRESHOLD * sizeof(WLANTL_HSTempPSIndType));
+   memset(&bmpsThresholds, 0, sizeof(tSirRSSIThresholds));
+
+   bmpsInd = 0;
+   for(bmpsLoop = 0; bmpsLoop < WLANTL_MAX_AVAIL_THRESHOLD; bmpsLoop++)
+   {
+      for(clientLoop = 0; clientLoop < WLANTL_HS_NUM_CLIENT; clientLoop++)
+      {
+         if(0 != hoSupport->registeredInd[bmpsLoop].triggerEvent[clientLoop])
+         {
+            if(bmpsInd == WLANTL_SINGLE_CLNT_THRESHOLD)
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Single Client Threshold should be less than %d", WLANTL_SINGLE_CLNT_THRESHOLD));
+               break;
+            }
+            tempIndSet[bmpsInd].rssi  = hoSupport->registeredInd[bmpsLoop].rssiValue;
+            tempIndSet[bmpsInd].event = hoSupport->registeredInd[bmpsLoop].triggerEvent[clientLoop];
+            bmpsInd++;
+            break;
+         }
+      }
+   }
+
+   bmpsThresholds.ucRssiThreshold1 = tempIndSet[0].rssi;
+   if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[0].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[0].event))
+   {
+      bmpsThresholds.bRssiThres1NegNotify = 1;
+   }
+   if((WLANTL_HO_THRESHOLD_UP == tempIndSet[0].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[0].event))
+   {
+      bmpsThresholds.bRssiThres1PosNotify = 1;
+   }
+
+   bmpsThresholds.ucRssiThreshold2 = tempIndSet[1].rssi;
+   if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[1].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[1].event))
+   {
+      bmpsThresholds.bRssiThres2NegNotify = 1;
+   }
+   if((WLANTL_HO_THRESHOLD_UP == tempIndSet[1].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[1].event))
+   {
+      bmpsThresholds.bRssiThres2PosNotify = 1;
+   }
+
+   bmpsThresholds.ucRssiThreshold3 = tempIndSet[2].rssi;
+   if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[2].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[2].event))
+   {
+      bmpsThresholds.bRssiThres3NegNotify = 1;
+   }
+   if((WLANTL_HO_THRESHOLD_UP == tempIndSet[2].event) ||
+      (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[2].event))
+   {
+      bmpsThresholds.bRssiThres3PosNotify = 1;
+   }
+
+   WDA_SetRSSIThresholds(hoSupport->macCtxt, &bmpsThresholds);
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_StatHandleRXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid,
+   v_BOOL_t         isBroadcast,
+   vos_pkt_t       *dataBuffer   
+)
+{
+   WLANTL_CbType            *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                status = VOS_STATUS_SUCCESS;
+   WLANTL_TRANSFER_STA_TYPE *statistics;
+   v_U16_t                   packetSize;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if(NULL == dataBuffer)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Management Frame, not need to handle with Stat"));
+      return status;
+   }
+
+   if(0 == tlCtxt->atlSTAClients[STAid].ucExists)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: %d STA ID is not exist", STAid));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   /* TODO : BC/MC/UC have to be determined by MAC address */
+   statistics = &tlCtxt->atlSTAClients[STAid].trafficStatistics;
+   vos_pkt_get_packet_length(dataBuffer, &packetSize);
+   if(WDA_IS_RX_BCAST(pBDHeader))
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX BC/MC frame"));
+      if(VOS_FALSE == isBroadcast)
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX BC frame"));
+         statistics->rxBCFcnt++;
+         statistics->rxBCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+      }
+      else
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX MC frame"));
+         statistics->rxMCFcnt++;
+         statistics->rxMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+      }
+   }
+   else
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX UC frame"));
+      statistics->rxUCFcnt++;
+      statistics->rxUCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+   }
+
+   /* TODO caculation is needed, dimension of 500kbps */
+   statistics->rxRate = WDA_GET_RX_MAC_RATE_IDX(pBDHeader);
+   statistics->rxBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+
+#ifdef WLANTL_HO_DEBUG_MSG
+   WLANTL_StatDebugDisplay(STAid, statistics);
+#endif /* WLANTL_HO_DEBUG_MSG */
+
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_StatHandleTXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_U8_t           STAid,
+   vos_pkt_t       *dataBuffer,
+   v_PVOID_t        pBDHeader
+)
+{
+   WLANTL_CbType            *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                status = VOS_STATUS_SUCCESS;
+   WLANTL_TRANSFER_STA_TYPE *statistics;
+   v_U16_t                   packetSize;
+
+   if((NULL == tlCtxt) || (NULL == dataBuffer))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if(0 == tlCtxt->atlSTAClients[STAid].ucExists)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: %d STA ID is not exist", STAid));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   /* TODO : BC/MC/UC have to be determined by MAC address */
+   statistics = &tlCtxt->atlSTAClients[STAid].trafficStatistics;
+   vos_pkt_get_packet_length(dataBuffer, &packetSize);
+   if(WLANTL_STA_ID_BCAST == STAid)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC frame"));
+      statistics->txBCFcnt++;
+      statistics->txBCBcnt += (packetSize - WLANHAL_TX_BD_HEADER_SIZE);
+   }
+/*
+   if(WLANHAL_TX_BD_GET_UB(pBDHeader))
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC/MC frame"));
+      if(WLANTL_STA_ID_BCAST == STAid)
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC frame"));
+         statistics->txBCFcnt++;
+         statistics->txBCBcnt += (packetSize - WLANHAL_TX_BD_HEADER_SIZE);
+      }
+      else
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is MC frame"));
+         statistics->txMCFcnt++;
+         statistics->txMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+      }
+   }
+*/
+   else
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is TX UC frame"));
+      statistics->txUCFcnt++;
+      statistics->txUCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+   }
+
+#ifdef WLANTL_HO_DEBUG_MSG
+   WLANTL_StatDebugDisplay(STAid, statistics);
+#endif /* WLANTL_HO_DEBUG_MSG */
+
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION  WLANTL_HSTrafficStatusTimerExpired
+
+   DESCRIPTION  If traffic status monitoring timer is expiered,
+                Count how may frames have sent and received during 
+                measure period and if traffic status is changed
+                send notification to Client(SME)
+    
+   PARAMETERS pAdapter
+              Global handle
+
+   RETURN VALUE
+
+============================================================================*/
+v_VOID_t WLANTL_HSTrafficStatusTimerExpired
+(
+   v_PVOID_t pAdapter
+)
+{
+   WLANTL_CbType                        *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   WLANTL_HO_TRAFFIC_STATUS_HANDLE_TYPE *trafficHandle = NULL;
+   WLANTL_HO_TRAFFIC_STATUS_TYPE         newTraffic;
+   v_U32_t                               rtFrameCount;
+   v_U32_t                               nrtFrameCount;
+   v_BOOL_t                              trafficStatusChanged = VOS_FALSE;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return;
+   }
+
+   /* Get rt and nrt frame count sum */
+   trafficHandle = &tlCtxt->hoSupport.currentTraffic;
+   rtFrameCount  = trafficHandle->rtRXFrameCount + trafficHandle->rtTXFrameCount;
+   nrtFrameCount = trafficHandle->nrtRXFrameCount + trafficHandle->nrtTXFrameCount;
+
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Traffic status timer expired RT FC %d, NRT FC %d", rtFrameCount, nrtFrameCount));
+
+   /* Get current traffic status */
+   if(rtFrameCount > trafficHandle->idleThreshold)
+   {
+      newTraffic.rtTrafficStatus = WLANTL_HO_RT_TRAFFIC_STATUS_ON;
+   }
+   else
+   {
+      newTraffic.rtTrafficStatus = WLANTL_HO_RT_TRAFFIC_STATUS_OFF;
+   }
+
+   if(nrtFrameCount > trafficHandle->idleThreshold)
+   {
+      newTraffic.nrtTrafficStatus = WLANTL_HO_NRT_TRAFFIC_STATUS_ON;
+   }
+   else
+   {
+      newTraffic.nrtTrafficStatus = WLANTL_HO_NRT_TRAFFIC_STATUS_OFF;
+   }
+
+   /* Differentiate with old traffic status */
+   if(trafficHandle->trafficStatus.rtTrafficStatus != newTraffic.rtTrafficStatus)
+   {
+      TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"RT Traffic status changed from %d to %d",
+                   trafficHandle->trafficStatus.rtTrafficStatus,
+                   newTraffic.rtTrafficStatus));
+      trafficStatusChanged = VOS_TRUE;
+   }
+   if(trafficHandle->trafficStatus.nrtTrafficStatus != newTraffic.nrtTrafficStatus)
+   {
+      TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"NRT Traffic status changed from %d to %d",
+                   trafficHandle->trafficStatus.nrtTrafficStatus,
+                   newTraffic.nrtTrafficStatus));
+      trafficStatusChanged = VOS_TRUE;
+   }
+
+   /* If traffic status is changed send notification to client */
+   if((VOS_TRUE == trafficStatusChanged) && (NULL != trafficHandle->trafficCB))
+   {
+      trafficHandle->trafficCB(pAdapter, newTraffic, trafficHandle->usrCtxt);
+      trafficHandle->trafficStatus.rtTrafficStatus = newTraffic.rtTrafficStatus;
+      trafficHandle->trafficStatus.nrtTrafficStatus = newTraffic.nrtTrafficStatus;
+   }
+   else if((VOS_TRUE == trafficStatusChanged) && (NULL == trafficHandle->trafficCB))
+   {
+      TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"Traffic status is changed but not need to report"));
+   }
+
+   /* Reset frame counters */
+   trafficHandle->rtRXFrameCount = 0;
+   trafficHandle->rtTXFrameCount = 0;
+   trafficHandle->nrtRXFrameCount = 0;
+   trafficHandle->nrtTXFrameCount = 0;
+
+   if(NULL != trafficHandle->trafficCB)
+   {
+      /* restart timer  only when the callback is not NULL */
+      vos_timer_start(&trafficHandle->trafficTimer, trafficHandle->measurePeriod);
+   }
+   
+   return;
+}
+
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSGetRSSI
+(
+   v_PVOID_t        pAdapter,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid,
+   v_S7_t          *currentAvgRSSI
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+   v_S7_t           currentRSSI, currentRSSI0, currentRSSI1;
+   WLANTL_CURRENT_HO_STATE_TYPE *currentHO = NULL;
+
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   /* 
+      Compute RSSI only for the last MPDU of an AMPDU.
+      Only last MPDU carries the Phy Stats Values 
+   */
+    if (WDA_IS_RX_AN_AMPDU (pBDHeader)) {
+       if (!WDA_IS_RX_LAST_MPDU(pBDHeader)) {
+           return VOS_STATUS_E_FAILURE;
+          }
+    }
+
+   currentHO = &tlCtxt->hoSupport.currentHOState;
+
+   currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
+   currentRSSI1 = WLANTL_GETRSSI0(pBDHeader);
+   currentRSSI  = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
+
+   if (0 == currentRSSI)
+      return VOS_STATUS_E_INVAL;
+
+#ifdef WLANTL_HO_UTEST
+   TLHS_UtestHandleNewRSSI(&currentRSSI, pAdapter);
+#endif /* WLANTL_HO_UTEST */
+
+/* Commenting this part of the code as this may not be necessarity true in all cases */
+#if 0
+   if(WLANTL_HO_INVALID_RSSI == currentRSSI)
+   {
+      return status;
+   }
+#endif
+
+   if(0 == currentHO->historyRSSI)
+   {
+      *currentAvgRSSI = currentRSSI;
+   }
+   else
+   {
+      *currentAvgRSSI = ((currentHO->historyRSSI * currentHO->alpha) +
+                         (currentRSSI * (10 - currentHO->alpha))) / 10;
+   }
+#ifdef RSSI_HACK
+   *currentAvgRSSI = (v_S7_t)dumpCmdRSSI;
+#endif
+
+
+   tlCtxt->atlSTAClients[STAid].rssiAvg = *currentAvgRSSI;
+
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current new RSSI is %d, averaged RSSI is %d", currentRSSI, *currentAvgRSSI));
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSBMPSRSSIRegionChangedNotification
+(
+   v_PVOID_t             pAdapter,
+   tpSirRSSINotification pRSSINotification
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+   WLANTL_RSSICrossThresholdCBType cbFunction = NULL;
+   v_PVOID_t                       usrCtxt = NULL;
+   v_U8_t                          evtType = WLANTL_HO_THRESHOLD_NA;
+   v_U32_t                         preFWNotification = 0;
+   v_U32_t                         curFWNotification = 0;
+   v_U8_t                          newRegionNumber = 0;
+   v_U8_t                          pRegionNumber = 0, nRegionNumber = 0;
+   v_U32_t                         isSet;
+   v_U8_t                          idx, sIdx;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if(NULL == pRSSINotification)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid FW RSSI Notification"));
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+   preFWNotification = currentHO->fwNotification;
+
+   isSet = pRSSINotification->bRssiThres1PosCross;
+   curFWNotification |= isSet << 5;
+   isSet = pRSSINotification->bRssiThres2PosCross;
+   curFWNotification |= isSet << 4;
+   isSet = pRSSINotification->bRssiThres3PosCross;
+   curFWNotification |= isSet << 3;
+   isSet = pRSSINotification->bRssiThres1NegCross;
+   curFWNotification |= isSet << 2;
+   isSet = pRSSINotification->bRssiThres2NegCross;
+   curFWNotification |= isSet << 1;
+   isSet = pRSSINotification->bRssiThres3NegCross;
+   curFWNotification |= isSet;
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current FW Notification is 0x%x", (v_U32_t)curFWNotification ));
+
+   currentHO->fwNotification = curFWNotification;
+
+   if(0 == preFWNotification)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is the first time notification from FW Value is 0x%x", curFWNotification));
+      preFWNotification = curFWNotification;
+   }
+   else if(preFWNotification == curFWNotification)
+   {
+      return status;
+   }
+
+   if(1 == pRSSINotification->bRssiThres1PosCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 0"));
+      pRegionNumber = 0;
+   }
+   else if(1 == pRSSINotification->bRssiThres2PosCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 1"));
+      pRegionNumber = 1;
+   }
+   else if(1 == pRSSINotification->bRssiThres3PosCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 2"));
+      pRegionNumber = 2;
+   }
+
+   if(1 == pRSSINotification->bRssiThres3NegCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 3"));
+      nRegionNumber = 3;
+   }
+   else if(1 == pRSSINotification->bRssiThres2NegCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 2"));
+      nRegionNumber = 2;
+   }
+   else if(1 == pRSSINotification->bRssiThres1NegCross)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 1"));
+      nRegionNumber = 1;
+   }
+
+
+   newRegionNumber = (nRegionNumber > pRegionNumber) ? nRegionNumber : pRegionNumber;
+   if((currentHO->regionNumber) && (newRegionNumber == currentHO->regionNumber))
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"No Region Change with BMPS mode"));
+      preFWNotification = curFWNotification;
+      return status;
+   }
+   else if(newRegionNumber > currentHO->regionNumber)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Region Increase Worse RSSI"));
+      for(idx = currentHO->regionNumber; idx < newRegionNumber; idx++)
+      {
+         for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+         {
+            if((WLANTL_HO_THRESHOLD_DOWN == hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
+               (WLANTL_HO_THRESHOLD_CROSS == hoSupport->registeredInd[idx].triggerEvent[sIdx]))
+            {
+               if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+               {
+                  cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
+                  usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
+                  evtType = WLANTL_HO_THRESHOLD_DOWN;
+                  TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
+                  currentHO->regionNumber = newRegionNumber;
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
+               }
+            }
+         }
+      }
+   }
+   else
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Region Decrease Better RSSI"));
+      idx = (currentHO->regionNumber)?(currentHO->regionNumber-1):0;
+      while (idx >= newRegionNumber)
+      {
+         for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+         {
+            if((WLANTL_HO_THRESHOLD_UP & hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
+               (WLANTL_HO_THRESHOLD_CROSS & hoSupport->registeredInd[idx].triggerEvent[sIdx]))
+            {
+               if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+               {
+                  cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
+                  usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
+                  evtType = WLANTL_HO_THRESHOLD_UP;
+                  TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
+                  currentHO->regionNumber = newRegionNumber;
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
+               }
+            }
+         }
+         if (!idx--)
+             break;
+      }
+   }
+
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"BMPS State, MSG from FW, Trigger Event %d, region index %d",
+                 evtType, currentHO->regionNumber));
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSHandleRSSIChange
+(
+   v_PVOID_t   pAdapter,
+   v_S7_t      currentRSSI
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+   v_U8_t                          currentRegion = 0;
+   v_U8_t                          idx, sIdx;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+   WLANTL_RSSICrossThresholdCBType cbFunction = NULL;
+   v_PVOID_t                       usrCtxt = NULL;
+   v_U8_t                          evtType = WLANTL_HO_THRESHOLD_NA;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"CRegion %d, NThreshold %d, HRSSI %d",
+                currentHO->regionNumber,
+                currentHO->numThreshold,
+                currentHO->historyRSSI));
+
+   /* Find where is current region */
+   for(idx = 0; idx < currentHO->numThreshold; idx++)
+   {
+      if(hoSupport->registeredInd[idx].rssiValue < currentRSSI)
+      {
+         currentRegion = idx;
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found region %d, not bottom", currentRegion));
+         break;
+      }
+   }
+
+   /* If could not find then new RSSI is belong to bottom region */
+   if(idx == currentHO->numThreshold)
+   {
+      currentRegion = idx;
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current region is bottom %d", idx));
+   }
+
+   /* This is a hack. Actual assignment was happening after the below checks. This hack is needed till TL
+      posts message and nothing else in the callback indicating UP/DOWN event to the registered module */
+   currentHO->historyRSSI = currentRSSI;
+   
+   if(currentRegion == currentHO->regionNumber)
+   {
+      currentHO->historyRSSI = currentRSSI;
+      return status;
+   }
+   else if(currentRegion > currentHO->regionNumber)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Region Increase Worse RSSI"));
+      for(idx = currentHO->regionNumber; idx < currentRegion; idx++)
+      {
+         for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+         {
+            if((WLANTL_HO_THRESHOLD_DOWN == hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
+               (WLANTL_HO_THRESHOLD_CROSS == hoSupport->registeredInd[idx].triggerEvent[sIdx]))
+            {
+               if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+               {
+                  cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
+                  usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
+                  evtType = WLANTL_HO_THRESHOLD_DOWN;
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
+               }
+            }
+         }
+      }
+   }
+   else
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Region Decrease Better RSSI"));
+      for(idx = currentHO->regionNumber; idx > currentRegion; idx--)
+      {
+         for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+         {
+            if((WLANTL_HO_THRESHOLD_UP & hoSupport->registeredInd[idx - 1].triggerEvent[sIdx]) ||
+               (WLANTL_HO_THRESHOLD_CROSS & hoSupport->registeredInd[idx - 1].triggerEvent[sIdx]))
+            {
+               if(NULL != hoSupport->registeredInd[idx - 1].crossCBFunction[sIdx])
+               {
+                  cbFunction = hoSupport->registeredInd[idx - 1].crossCBFunction[sIdx];
+                  usrCtxt = hoSupport->registeredInd[idx - 1].usrCtxt[sIdx];
+                  evtType = WLANTL_HO_THRESHOLD_UP;
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx - 1].triggerEvent[sIdx], idx - 1));
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
+               }
+            }
+         }
+      }
+   }
+
+   currentHO->historyRSSI = currentRSSI;
+   currentHO->regionNumber = currentRegion;
+   WLANTL_HSDebugDisplay(pAdapter);
+
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Client fail to handle region change in normal mode %d", status));
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSHandleRXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_U8_t           frameType,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid,
+   v_BOOL_t         isBroadcast,
+   vos_pkt_t       *dataBuffer
+)
+{
+   WLANTL_CURRENT_HO_STATE_TYPE *currentHO = NULL;
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+   v_S7_t           currentAvgRSSI = 0;
+   v_U8_t           ac;
+   v_U32_t          currentTimestamp;
+   v_U8_t           tid;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   WLANTL_StatHandleRXFrame(pAdapter, pBDHeader, STAid, isBroadcast, dataBuffer);
+
+   /* If this frame is not management frame increase frame count */
+   if((0 != tlCtxt->hoSupport.currentTraffic.idleThreshold) &&
+      (WLANTL_MGMT_FRAME_TYPE != frameType))
+   {
+      tid = WDA_GET_RX_TID( pBDHeader );
+      ac = WLANTL_HO_TID_2_AC[(v_U8_t)tid];
+
+      /* Only Voice traffic is handled as real time traffic */
+      if(WLANTL_AC_VO == ac)
+      {
+         tlCtxt->hoSupport.currentTraffic.rtRXFrameCount++;
+      }
+      else
+      {
+         tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount++;
+      }
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX frame AC %d, RT Frame Count %d, NRT Frame Count %d",
+                   ac,
+                   tlCtxt->hoSupport.currentTraffic.rtRXFrameCount,
+                   tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount));
+   }
+
+   currentHO = &tlCtxt->hoSupport.currentHOState;
+   if(VOS_TRUE == tlCtxt->isBMPS)
+   {
+      WLANTL_HSGetRSSI(pAdapter, pBDHeader, STAid, &currentAvgRSSI);
+      return status;
+   }
+
+   currentTimestamp = WDA_GET_RX_TIMESTAMP(pBDHeader);
+   if((currentTimestamp - currentHO->sampleTime) < WLANTL_HO_SAMPLING_PERIOD)
+   {
+      return status;
+   }
+   currentHO->sampleTime = currentTimestamp;
+
+   /* If any threshold is not registerd, DO NOTHING! */
+   if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"There is no thresholds pass"));
+   }
+   else
+   {
+      /* Get Current RSSI from BD Heaser */
+      status = WLANTL_HSGetRSSI(pAdapter, pBDHeader, STAid, &currentAvgRSSI);
+      if(!VOS_IS_STATUS_SUCCESS(status))
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Get RSSI Fail"));
+         return status;
+      }
+      /* Handle current RSSI value, region, notification, etc */
+      status = WLANTL_HSHandleRSSIChange(pAdapter, currentAvgRSSI);
+      if(!VOS_IS_STATUS_SUCCESS(status))
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Handle new RSSI fail"));
+         return status;
+      }
+   }
+
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSHandleTXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_U8_t           ac,
+   v_U8_t           STAid,
+   vos_pkt_t       *dataBuffer,
+   v_PVOID_t        bdHeader
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   /* Traffic status report is not registered, JUST DO NOTHING */
+   if(0 == tlCtxt->hoSupport.currentTraffic.idleThreshold)
+   {
+      return VOS_STATUS_SUCCESS;
+   }
+
+   WLANTL_StatHandleTXFrame(pAdapter, STAid, dataBuffer, bdHeader);
+
+   /* Only Voice traffic is handled as real time traffic */
+   if(WLANTL_AC_VO == ac)
+   {
+      tlCtxt->hoSupport.currentTraffic.rtTXFrameCount++;
+   }
+   else
+   {
+      tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount++;
+   }
+   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX frame AC %d, RT Frame Count %d, NRT Frame Count %d",
+                ac,
+                tlCtxt->hoSupport.currentTraffic.rtTXFrameCount,
+                tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount));
+
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSRegRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID,
+   v_PVOID_t                       usrCtxt
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+   v_U8_t                          idx, sIdx;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   v_U8_t                          clientOrder = 0;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if((-1 < rssiValue) || (NULL == crossCBFunction))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reg Invalid Argument"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   THSGETLOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make Registration Module %d, Event %d, RSSI %d", moduleID, triggerEvent, rssiValue));
+
+   if((WLANTL_MAX_AVAIL_THRESHOLD < currentHO->numThreshold) ||
+      (WLANTL_MAX_AVAIL_THRESHOLD == currentHO->numThreshold))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"No more available slot, please DEL first %d",
+                    currentHO->numThreshold));
+      THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+      return VOS_STATUS_E_RESOURCES;
+   }
+
+   if(0 == currentHO->numThreshold)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"First Registration"));
+      hoSupport->registeredInd[0].rssiValue    = rssiValue;
+      hoSupport->registeredInd[0].triggerEvent[0]    = triggerEvent;
+      hoSupport->registeredInd[0].crossCBFunction[0] = crossCBFunction;
+      hoSupport->registeredInd[0].usrCtxt[0]         = usrCtxt;
+      hoSupport->registeredInd[0].whoIsClient[0]     = moduleID;
+      hoSupport->registeredInd[0].numClient++;
+   }
+   else
+   {
+      for(idx = 0; idx < currentHO->numThreshold; idx++)
+      {
+         if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
+         {
+            for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reg CB P 0x%x, registered CB P 0x%x",
+                             crossCBFunction,
+                             hoSupport->registeredInd[idx].crossCBFunction[sIdx]));
+               if(crossCBFunction == hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+               {
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Same RSSI %d, Same CB 0x%x already registered",
+                               rssiValue, crossCBFunction));
+                  WLANTL_HSDebugDisplay(pAdapter);
+                  THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+                  return status;
+               }
+            }
+
+            for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+            {
+               if(NULL == hoSupport->registeredInd[idx].crossCBFunction[sIdx])
+               {
+                  clientOrder = sIdx;
+                  break;
+               }
+            }
+            hoSupport->registeredInd[idx].triggerEvent[clientOrder]    = triggerEvent;
+            hoSupport->registeredInd[idx].crossCBFunction[clientOrder] = crossCBFunction;
+            hoSupport->registeredInd[idx].usrCtxt[clientOrder]         = usrCtxt;
+            hoSupport->registeredInd[idx].whoIsClient[clientOrder]     = moduleID;
+            hoSupport->registeredInd[idx].numClient++;
+            WLANTL_HSDebugDisplay(pAdapter);
+            THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+            return status;
+         }
+      }
+      for(idx = 0; idx < currentHO->numThreshold; idx++)
+      {
+         if(rssiValue > hoSupport->registeredInd[idx].rssiValue)
+         {
+            for(sIdx = (currentHO->numThreshold - 1); (sIdx > idx) || (sIdx == idx); sIdx--)
+            {
+               TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Shift %d array to %d", sIdx, sIdx + 1));
+               memcpy(&hoSupport->registeredInd[sIdx + 1], &hoSupport->registeredInd[sIdx], sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
+               memset(&hoSupport->registeredInd[sIdx], 0, sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
+               if(0 == sIdx)
+               {
+                  break;
+               }
+            }
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Put in Here %d", idx));
+            hoSupport->registeredInd[idx].rssiValue    = rssiValue;
+            hoSupport->registeredInd[idx].triggerEvent[0]    = triggerEvent;
+            hoSupport->registeredInd[idx].crossCBFunction[0] = crossCBFunction;
+            hoSupport->registeredInd[idx].usrCtxt[0]         = usrCtxt;
+            hoSupport->registeredInd[idx].whoIsClient[0]     = moduleID;
+            hoSupport->registeredInd[idx].numClient++;
+            break;
+         }
+      }
+      if(currentHO->numThreshold == idx)
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "New threshold put in bottom"));
+
+         hoSupport->registeredInd[currentHO->numThreshold].rssiValue    = rssiValue;
+         hoSupport->registeredInd[currentHO->numThreshold].triggerEvent[0] = triggerEvent;
+         hoSupport->registeredInd[currentHO->numThreshold].crossCBFunction[0] = crossCBFunction;
+         hoSupport->registeredInd[currentHO->numThreshold].usrCtxt[0] = usrCtxt;
+         hoSupport->registeredInd[currentHO->numThreshold].whoIsClient[0]     = moduleID;
+         hoSupport->registeredInd[currentHO->numThreshold].numClient++;
+      }
+   }
+
+   currentHO->numThreshold++;
+   if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue > currentHO->historyRSSI))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Added Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
+      if(4 > currentHO->regionNumber)
+      {
+         currentHO->regionNumber++;
+      }
+      else
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Current region number is max %d, cannot increase anymore", currentHO->regionNumber));
+      }
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"increase region number without notification %d", currentHO->regionNumber));
+   }
+   else if(VOS_TRUE == tlCtxt->isBMPS)
+   {
+      if(0 != currentHO->regionNumber)
+      {
+         if(hoSupport->registeredInd[currentHO->regionNumber].rssiValue < rssiValue)
+         {
+            currentHO->regionNumber++;
+            if((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
+               crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt);
+            }
+         }
+         else if((currentHO->regionNumber < (currentHO->numThreshold - 1)) &&
+                 (hoSupport->registeredInd[currentHO->regionNumber + 1].rssiValue > rssiValue))
+         {
+            if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI"));
+            }
+         }
+      }
+      else
+      {
+         if(hoSupport->registeredInd[currentHO->regionNumber].rssiValue > rssiValue)
+         {
+            if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
+            {
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI"));
+            }
+         }
+      }
+   }
+
+   if((VOS_FALSE == tlCtxt->isBMPS) &&
+      (rssiValue >= currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
+      ((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
+      crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt);
+   }
+   else if((VOS_FALSE == tlCtxt->isBMPS) &&
+           (rssiValue < currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
+           ((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI, and UP event, Send Notification"));
+      crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_UP, usrCtxt);
+   }
+
+   if(VOS_TRUE == tlCtxt->isBMPS)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Register into FW, now BMPS"));
+      /* this function holds the lock across a downstream WDA function call, this is violates some lock
+         ordering checks done on some HLOS see CR323221*/
+      THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+      WLANTL_SetFWRSSIThresholds(pAdapter);
+      THSGETLOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+   }
+
+   WLANTL_HSDebugDisplay(pAdapter);
+   THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSDeregRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID
+)
+{
+   WLANTL_CbType                  *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS                      status = VOS_STATUS_SUCCESS;
+   v_U8_t                          idx, sIdx;
+   WLANTL_HO_SUPPORT_TYPE         *hoSupport;
+   WLANTL_CURRENT_HO_STATE_TYPE   *currentHO;
+   v_BOOL_t                        bmpsAbove = VOS_FALSE;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Empty list, can not remove"));
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   THSGETLOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+   currentHO = &(tlCtxt->hoSupport.currentHOState);
+   hoSupport = &(tlCtxt->hoSupport);
+
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"DEL target RSSI %d, event %d", rssiValue, triggerEvent));
+
+   if((VOS_TRUE == tlCtxt->isBMPS) && (0 < currentHO->regionNumber))
+   {
+      if(rssiValue >= hoSupport->registeredInd[currentHO->regionNumber - 1].rssiValue)
+      {
+         bmpsAbove = VOS_TRUE;
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Remove Threshold larger than current region"));
+      }
+   }
+
+   for(idx = 0; idx < currentHO->numThreshold; idx++)
+   {
+      if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
+      {
+         for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+         {
+            if(crossCBFunction == tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx])
+            {
+               tlCtxt->hoSupport.registeredInd[idx].triggerEvent[sIdx]    = 0;
+               tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx] = NULL;
+               tlCtxt->hoSupport.registeredInd[idx].usrCtxt[sIdx]         = NULL;
+               tlCtxt->hoSupport.registeredInd[idx].whoIsClient[sIdx]     = 0;
+               tlCtxt->hoSupport.registeredInd[idx].numClient--;
+            }
+         }
+         if(0 != tlCtxt->hoSupport.registeredInd[idx].numClient)
+         {
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found Multiple idx is %d", idx));
+            WLANTL_HSDebugDisplay(pAdapter);
+            THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+            return status;
+         }
+         else
+         {
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found Single idx is %d", idx));
+            break;
+         }
+      }
+   }
+   if(idx == currentHO->numThreshold)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Could not find entry, maybe invalid arg"));
+      THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   for(idx = 0; idx < currentHO->numThreshold; idx++)
+   {
+      if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
+      {
+         if((currentHO->numThreshold - 1) == idx)
+         {
+            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Remove target is last one"));
+            /* Does not need move any element, just remove last array entry */
+         }
+         else
+         {
+            for(sIdx = idx; sIdx < (currentHO->numThreshold - 1); sIdx++)
+            {
+               TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Shift up from %d to %d", sIdx + 1, sIdx));
+               memcpy(&hoSupport->registeredInd[sIdx], &hoSupport->registeredInd[sIdx + 1], sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
+            }
+         }
+         break;
+      }
+   }
+   /* Common remove last array entry */
+   tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].rssiValue    = WLANTL_HO_DEFAULT_RSSI;
+   for(idx = 0; idx < WLANTL_HS_NUM_CLIENT; idx++)
+   {
+      tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].triggerEvent[idx]    = WLANTL_HO_THRESHOLD_NA;
+      tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].crossCBFunction[idx] = NULL;
+      tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].usrCtxt[idx]         = NULL;
+      tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].whoIsClient[idx]     = 0;
+      tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].numClient            = 0;
+   }
+
+   if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue >= currentHO->historyRSSI))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Removed Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
+      if(0 < currentHO->regionNumber)
+      {
+         currentHO->regionNumber--;
+      }
+      else
+      {
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Current Region number is 0, cannot decrease anymore"));
+      }
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Decrease region number without notification %d", currentHO->regionNumber));
+   }
+   else if((VOS_TRUE == tlCtxt->isBMPS) && (VOS_TRUE == bmpsAbove))
+   {
+      currentHO->regionNumber--;
+   }
+   /* Decrease number of thresholds */
+   tlCtxt->hoSupport.currentHOState.numThreshold--;
+   /*Reset the FW notification*/
+   tlCtxt->hoSupport.currentHOState.fwNotification=0;
+
+   if(VOS_TRUE == tlCtxt->isBMPS)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Register into FW, now BMPS"));
+       /* this function holds the lock across a downstream WDA function call, this is violates some lock
+         ordering checks done on some HLOS see CR323221*/
+      THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+      WLANTL_SetFWRSSIThresholds(pAdapter); 
+      THSGETLOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+   }
+
+   /* Based on new threshold set recalculated current RSSI status */
+   if(0 < tlCtxt->hoSupport.currentHOState.numThreshold)
+   {
+   }
+   else if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
+   {
+      currentHO->regionNumber = 0;
+      TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"No registered Threshold"));
+      /* What should do? */
+   }
+
+   WLANTL_HSDebugDisplay(pAdapter);
+   THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSSetAlpha
+(
+   v_PVOID_t pAdapter,
+   int       valueAlpha
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   THSGETLOCK("WLANTL_HSSetAlpha", &tlCtxt->hoSupport.hosLock);
+   tlCtxt->hoSupport.currentHOState.alpha = (v_U8_t)valueAlpha;
+   THSRELEASELOCK("WLANTL_HSSetAlpha", &tlCtxt->hoSupport.hosLock);
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSRegGetTrafficStatus
+(
+   v_PVOID_t                          pAdapter,
+   v_U32_t                            idleThreshold,
+   v_U32_t                            period,
+   WLANTL_TrafficStatusChangedCBType  trfficStatusCB,
+   v_PVOID_t                          usrCtxt
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if((0 == idleThreshold) || (0 == period) || (NULL == trfficStatusCB))
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid Argument Passed from SME"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   tlCtxt->hoSupport.currentTraffic.idleThreshold = idleThreshold;
+   tlCtxt->hoSupport.currentTraffic.measurePeriod = period;
+   tlCtxt->hoSupport.currentTraffic.trafficCB     = trfficStatusCB;
+   tlCtxt->hoSupport.currentTraffic.usrCtxt       = usrCtxt;
+
+   vos_timer_start(&tlCtxt->hoSupport.currentTraffic.trafficTimer,
+                   tlCtxt->hoSupport.currentTraffic.measurePeriod);
+
+   return status;
+}
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSInit
+(
+   v_PVOID_t   pAdapter
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+   v_U8_t           idx, sIdx;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+#ifdef WLANTL_HO_UTEST
+   rssi = 0;
+   direction = -1;
+#endif /* WLANTL_HO_UTEST */
+
+   /* set default current HO status */
+   tlCtxt->hoSupport.currentHOState.alpha        = WLANTL_HO_DEFAULT_ALPHA;
+   tlCtxt->hoSupport.currentHOState.historyRSSI  = 0;
+   tlCtxt->hoSupport.currentHOState.numThreshold = 0;
+   tlCtxt->hoSupport.currentHOState.regionNumber = 0;
+   tlCtxt->hoSupport.currentHOState.sampleTime   = 0;
+
+   /* set default current traffic status */
+   tlCtxt->hoSupport.currentTraffic.trafficStatus.rtTrafficStatus
+                                                    = WLANTL_HO_RT_TRAFFIC_STATUS_OFF;
+   tlCtxt->hoSupport.currentTraffic.trafficStatus.nrtTrafficStatus
+                                                    = WLANTL_HO_NRT_TRAFFIC_STATUS_OFF;
+   tlCtxt->hoSupport.currentTraffic.idleThreshold   = 0;
+   tlCtxt->hoSupport.currentTraffic.measurePeriod   = 0;
+   tlCtxt->hoSupport.currentTraffic.rtRXFrameCount  = 0;
+   tlCtxt->hoSupport.currentTraffic.rtTXFrameCount  = 0;
+   tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount = 0;
+   tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount = 0;
+   tlCtxt->hoSupport.currentTraffic.trafficCB       = NULL;
+
+   /* Initialize indication array */
+   for(idx = 0; idx < WLANTL_MAX_AVAIL_THRESHOLD; idx++)
+   {
+      for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
+      {
+         tlCtxt->hoSupport.registeredInd[idx].triggerEvent[sIdx]    = WLANTL_HO_THRESHOLD_NA;
+         tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx] = NULL;
+         tlCtxt->hoSupport.registeredInd[idx].usrCtxt[sIdx]         = NULL;
+         tlCtxt->hoSupport.registeredInd[idx].whoIsClient[sIdx]     = 0;
+      }
+      tlCtxt->hoSupport.registeredInd[idx].rssiValue          = WLANTL_HO_DEFAULT_RSSI;
+      tlCtxt->hoSupport.registeredInd[idx].numClient          = 0;
+   }
+
+   vos_timer_init(&tlCtxt->hoSupport.currentTraffic.trafficTimer,
+                  VOS_TIMER_TYPE_SW,
+                  WLANTL_HSTrafficStatusTimerExpired,
+                  pAdapter);
+
+
+   vos_lock_init(&tlCtxt->hoSupport.hosLock);
+   tlCtxt->hoSupport.macCtxt = vos_get_context(VOS_MODULE_ID_SME, pAdapter);
+
+   return status;
+}
+
+
+/*==========================================================================
+
+   FUNCTION    WLANTL_HSDeInit
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+
+VOS_STATUS WLANTL_HSDeInit
+(
+   v_PVOID_t   pAdapter
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Destroy the timer...      
+   status = vos_timer_destroy( &tlCtxt->hoSupport.currentTraffic.trafficTimer );
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_HSStop: Timer Destroy Fail Status %d", status));
+   }
+   return status;   
+}
+
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSStop
+(
+   v_PVOID_t   pAdapter
+)
+{
+   WLANTL_CbType   *tlCtxt = VOS_GET_TL_CB(pAdapter);
+   VOS_STATUS       status = VOS_STATUS_SUCCESS;
+   VOS_TIMER_STATE  timerState;
+
+   if(NULL == tlCtxt)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   timerState = vos_timer_getCurrentState(&tlCtxt->hoSupport.currentTraffic.trafficTimer);
+   if(VOS_TIMER_STATE_RUNNING == timerState)
+   {
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Stop Traffic status monitoring timer"));
+      status = vos_timer_stop(&tlCtxt->hoSupport.currentTraffic.trafficTimer);
+   }
+   if(VOS_STATUS_SUCCESS != status)
+   {
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer Stop Failed, Status %d", status));
+   }
+
+   //Deregister the traffic Status
+   tlCtxt->hoSupport.currentTraffic.idleThreshold = 0;
+   tlCtxt->hoSupport.currentTraffic.measurePeriod = 0;
+   tlCtxt->hoSupport.currentTraffic.trafficCB     = NULL;
+   tlCtxt->hoSupport.currentTraffic.usrCtxt       = NULL;
+
+   return status;   
+}
+#endif //FEATURE_WLAN_GEN6_ROAMING
diff --git a/CORE/TL/src/wlan_qct_tl_hosupport.h b/CORE/TL/src/wlan_qct_tl_hosupport.h
new file mode 100644
index 0000000..437fec1
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tl_hosupport.h
@@ -0,0 +1,264 @@
+/*
+ * 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 WLAN_QCT_TL_HOSUPPORT_H
+#define WLAN_QCT_TL_HOSUPPORT_H
+
+/*===========================================================================
+
+               W L A N   T R A N S P O R T   L A Y E R 
+               HO SUPPORT    I N T E R N A L  A P I
+                
+                   
+DESCRIPTION
+        
+  Copyright (c) 2008 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
+--------    ---    ----------------------------------------------------------
+12/11/08      sch     Initial creation
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+#include "wlan_qct_tl.h" 
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSHandleRXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_U8_t           frameType,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid,
+   v_BOOL_t         isBroadcast,
+   vos_pkt_t       *dataBuffer
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSHandleTXFrame
+(
+   v_PVOID_t        pAdapter,
+   v_U8_t           ac,
+   v_U8_t           STAid,
+   vos_pkt_t       *dataBuffer,
+   v_PVOID_t        bdHeader
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSRegRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID,
+   v_PVOID_t                       usrCtxt
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSDeregRSSIIndicationCB
+(
+   v_PVOID_t                       pAdapter,
+   v_S7_t                          rssiValue,
+   v_U8_t                          triggerEvent,
+   WLANTL_RSSICrossThresholdCBType crossCBFunction,
+   VOS_MODULE_ID                   moduleID
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSBMPSRSSIRegionChangedNotification
+(
+   v_PVOID_t             pAdapter,
+   tpSirRSSINotification pRSSINotification
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSSetAlpha
+(
+   v_PVOID_t pAdapter,
+   int       valueAlpha
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSRegGetTrafficStatus
+(
+   v_PVOID_t                          pAdapter,
+   v_U32_t                            idleThreshold,
+   v_U32_t                            period,
+   WLANTL_TrafficStatusChangedCBType  trfficStatusCB,
+   v_PVOID_t                          usrCtxt
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSInit
+(
+   v_PVOID_t   pAdapter
+);
+
+
+/*==========================================================================
+
+   FUNCTION    WLANTL_HSDeInit
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+
+VOS_STATUS WLANTL_HSDeInit
+(
+   v_PVOID_t   pAdapter
+);
+
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION 
+    
+   PARAMETERS 
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_HSStop
+(
+   v_PVOID_t   pAdapter
+);
+
+VOS_STATUS WLANTL_SetFWRSSIThresholds
+(
+   v_PVOID_t                       pAdapter
+);
+
+
+#endif //FEATURE_WLAN_GEN6_ROAMING
+
+#endif /* WLAN_QCT_TL_HOSUPPORT_H */
diff --git a/CORE/TL/src/wlan_qct_tli.h b/CORE/TL/src/wlan_qct_tli.h
new file mode 100644
index 0000000..4845331
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tli.h
@@ -0,0 +1,1595 @@
+/*
+ * 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 WLAN_QCT_TLI_H
+#define WLAN_QCT_TLI_H
+
+/*===========================================================================
+
+               W L A N   T R A N S P O R T   L A Y E R
+                     I N T E R N A L   A P I
+
+
+DESCRIPTION
+  This file contains the internal declarations used within wlan transport
+  layer module.
+
+  Copyright (c) 2008 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
+--------    ---    ----------------------------------------------------------
+02/19/10    bad     Fixed 802.11 to 802.3 ft issues with WAPI
+01/14/10    rnair   Fixed the byte order for the WAI packet type.
+01/08/10    lti     Added TL Data Caching
+10/09/09    rnair   Add support for WAPI
+02/02/09    sch     Add Handoff support
+12/09/08    lti     Fixes for AMSS compilation
+12/02/08    lti     Fix fo trigger frame generation
+10/31/08    lti     Fix fo TL tx suspend
+10/01/08    lti     Merged in fixes from reordering
+09/05/08    lti     Fixes following QOS unit testing
+08/06/08    lti     Added QOS support
+07/18/08    lti     Fixes following integration
+                    Added frame translation
+06/26/08    lti     Fixes following unit testing
+05/05/08    lti     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_packet.h"
+#include "vos_api.h"
+#include "vos_timer.h"
+#include "vos_mq.h"
+#include "vos_list.h"
+#include "wlan_qct_tl.h"
+#include "pmcApi.h"
+#include "wlan_qct_hal.h"
+
+
+#define STATIC  static
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*Maximum number of TIDs */
+#define WLAN_MAX_TID                          8
+
+/** The define is moved to external header file to be used by HDD */
+#ifndef WLAN_SOFTAP_FEATURE
+/*Maximum number of supported stations */
+#define WLAN_MAX_STA_COUNT                    5
+#endif
+
+/*Offset of the OUI field inside the LLC/SNAP header*/
+#define WLANTL_LLC_OUI_OFFSET                 3
+
+/*Size of the OUI type field inside the LLC/SNAP header*/
+#define WLANTL_LLC_OUI_SIZE                   3
+
+/*Offset of the protocol type field inside the LLC/SNAP header*/
+#define WLANTL_LLC_PROTO_TYPE_OFFSET  WLANTL_LLC_OUI_OFFSET +  WLANTL_LLC_OUI_SIZE
+
+/*Size of the protocol type field inside the LLC/SNAP header*/
+#define WLANTL_LLC_PROTO_TYPE_SIZE            2
+
+/*802.1x protocol type */
+#define WLANTL_LLC_8021X_TYPE            0x888E
+
+/*WAPI protocol type */
+#define WLANTL_LLC_WAI_TYPE              0x88b4
+
+/*Length offset inside the AMSDU sub-frame header*/
+#define WLANTL_AMSDU_SUBFRAME_LEN_OFFSET     12
+
+/*802.3 header definitions*/
+#define  WLANTL_802_3_HEADER_LEN             14
+
+/* Offset of DA field in a 802.3 header*/
+#define  WLANTL_802_3_HEADER_DA_OFFSET        0
+
+/*802.11 header definitions - header len without QOS ctrl field*/
+#define  WLANTL_802_11_HEADER_LEN            24
+
+/*802.11 header length + QOS ctrl field*/
+#define  WLANTL_MPDU_HEADER_LEN              32
+
+/*802.11 header definitions*/
+#define  WLANTL_802_11_MAX_HEADER_LEN        40
+
+/*802.11 header definitions - qos ctrl field len*/
+#define  WLANTL_802_11_HEADER_QOS_CTL         2
+
+/*802.11 header definitions - ht ctrl field len*/
+#define  WLANTL_802_11_HEADER_HT_CTL          4
+
+/* Offset of Addr1 field in a 802.11 header*/
+#define  WLANTL_802_11_HEADER_ADDR1_OFFSET    4
+
+/*802.11 ADDR4 MAC addr field len */
+#define  WLANTL_802_11_HEADER_ADDR4_LEN       VOS_MAC_ADDR_SIZE
+
+/* Length of an AMSDU sub-frame */
+#define TL_AMSDU_SUBFRM_HEADER_LEN           14
+
+/* Length of the LLC header*/
+#define WLANTL_LLC_HEADER_LEN   8
+
+/*As per 802.11 spec */
+#define WLANTL_MGMT_FRAME_TYPE       0x00
+#define WLANTL_CTRL_FRAME_TYPE       0x10
+#define WLANTL_DATA_FRAME_TYPE       0x20
+
+/*Value of the data type field in the 802.11 frame */
+#define WLANTL_80211_DATA_TYPE         0x02
+#define WLANTL_80211_DATA_QOS_SUBTYPE  0x08
+#define WLANTL_80211_NULL_QOS_SUBTYPE  0x0C
+
+
+/*-------------------------------------------------------------------------
+  BT-AMP related definition - !!! should probably be moved to BT-AMP header
+---------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+  Helper macros
+---------------------------------------------------------------------------*/
+ /*Checks STA index validity*/
+#define WLANTL_STA_ID_INVALID( _staid )( _staid >= WLAN_MAX_STA_COUNT )
+
+/*As per Libra behavior */
+#define WLANTL_STA_ID_BCAST     0xFF
+
+/*Checks TID validity*/
+#define WLANTL_TID_INVALID( _tid )     ( _tid >= WLAN_MAX_TID )
+
+/*Checks AC validity*/
+#define WLANTL_AC_INVALID( _tid )     ( _tid >= WLANTL_MAX_AC )
+
+/*Determines the addr field offset based on the frame xtl bit*/
+#define WLANTL_MAC_ADDR_ALIGN( _dxtl )                                    \
+      ( ( 0 == _dxtl ) ?                              \
+        WLANTL_802_3_HEADER_DA_OFFSET: WLANTL_802_11_HEADER_ADDR1_OFFSET )
+
+/*Determines the header len based on the disable xtl field*/
+#define WLANTL_MAC_HEADER_LEN( _dxtl)                                     \
+      ( ( 0 == _dxtl )?                               \
+         WLANTL_802_3_HEADER_LEN:WLANTL_802_11_HEADER_LEN )
+
+/*Determines the necesary length of the BD header - in case
+  UMA translation is enabled enough room needs to be left in front of the
+  packet for the 802.11 header to be inserted*/
+#define WLANTL_BD_HEADER_LEN( _dxtl )                                    \
+      ( ( 0 == _dxtl )?                               \
+         (WLANHAL_TX_BD_HEADER_SIZE+WLANTL_802_11_MAX_HEADER_LEN): WLANHAL_TX_BD_HEADER_SIZE )
+
+
+#define WLAN_TL_CEIL( _a, _b)  (( 0 != (_a)%(_b))? (_a)/(_b) + 1: (_a)/(_b))
+
+/*get TL control block from vos global context */
+#define VOS_GET_TL_CB(_pvosGCtx) \
+        (WLANTL_CbType*)vos_get_context( VOS_MODULE_ID_TL, _pvosGCtx)
+
+/* Check whether Rx frame is LS or EAPOL packet (other than data) */
+#define WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType) \
+        (WLANTL_BT_AMP_TYPE_AR == usType) || (WLANTL_BT_AMP_TYPE_SEC == usType) || \
+        (WLANTL_BT_AMP_TYPE_LS_REQ == usType) || (WLANTL_BT_AMP_TYPE_LS_REP == usType)
+
+/*get RSSI0 from a RX BD*/
+/* 7 bits in phystats represent -100dBm to +27dBm */
+#define WLAN_TL_RSSI_CORRECTION 100
+#define WLANTL_GETRSSI0(pBD)    (WDA_GETRSSI0(pBD) - WLAN_TL_RSSI_CORRECTION)
+
+/*get RSSI1 from a RX BD*/
+#define WLANTL_GETRSSI1(pBD)    (WDA_GETRSSI1(pBD) - WLAN_TL_RSSI_CORRECTION)
+
+/* Check whether Rx frame is LS or EAPOL packet (other than data) */
+#define WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType) \
+        (WLANTL_BT_AMP_TYPE_AR == usType) || (WLANTL_BT_AMP_TYPE_SEC == usType) || \
+        (WLANTL_BT_AMP_TYPE_LS_REQ == usType) || (WLANTL_BT_AMP_TYPE_LS_REP == usType)
+
+/*---------------------------------------------------------------------------
+  TL signals for TX thread
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*Suspend signal - following serialization of a HAL suspend request*/
+  WLANTL_TX_SIG_SUSPEND = 0,
+
+  /*Res need signal - triggered when all pending TxComp have been received
+   and TL is low on resources*/
+  WLANTL_TX_RES_NEEDED  = 1,
+
+  /* Forwarding RX cached frames */
+  WLANTL_TX_FWD_CACHED  = 2,
+
+  /* Serialized STAID AC Indication */
+  WLANTL_TX_STAID_AC_IND = 3,
+
+  /* Serialzie TX transmit request */
+  WLANTL_TX_START_XMIT = 4,
+
+  /* Serialzie Finish UL Authentication request */
+  WLANTL_FINISH_ULA   = 5,
+
+  WLANTL_TX_MAX
+}WLANTL_TxSignalsType;
+
+/*---------------------------------------------------------------------------
+  STA Event type
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /* Transmit frame event */
+  WLANTL_TX_EVENT = 0,
+
+  /* Receive frame event */
+  WLANTL_RX_EVENT = 1,
+
+  WLANTL_MAX_EVENT
+}WLANTL_STAEventType;
+
+/*---------------------------------------------------------------------------
+
+  DESCRIPTION
+    State machine used by transport layer for receiving or transmitting
+    packets.
+
+  PARAMETERS
+
+   IN
+   pAdapter:        pointer to the global adapter context; a handle to TL's
+                    control block can be extracted from its context
+   ucSTAId:         identifier of the station being processed
+   vosDataBuff:    pointer to the tx/rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+---------------------------------------------------------------------------*/
+typedef VOS_STATUS (*WLANTL_STAFuncType)( v_PVOID_t     pAdapter,
+                                          v_U8_t        ucSTAId,
+                                          vos_pkt_t**   pvosDataBuff);
+
+/*---------------------------------------------------------------------------
+  STA FSM Entry type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  WLANTL_STAFuncType  pfnSTATbl[WLANTL_MAX_EVENT];
+} WLANTL_STAFsmEntryType;
+
+/* Receive in connected state - only EAPOL or WAI*/
+VOS_STATUS WLANTL_STARxConn( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* Transmit in connected state - only EAPOL or WAI*/
+VOS_STATUS WLANTL_STATxConn( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* Receive in authenticated state - all data allowed*/
+VOS_STATUS WLANTL_STARxAuth( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* Transmit in authenticated state - all data allowed*/
+VOS_STATUS WLANTL_STATxAuth( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* Receive in disconnected state - no data allowed*/
+VOS_STATUS WLANTL_STARxDisc( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* Transmit in disconnected state - no data allowed*/
+VOS_STATUS WLANTL_STATxDisc( v_PVOID_t     pAdapter,
+                             v_U8_t        ucSTAId,
+                             vos_pkt_t**   pvosDataBuff );
+
+/* TL State Machine */
+STATIC const WLANTL_STAFsmEntryType tlSTAFsm[WLANTL_STA_MAX_STATE] =
+{
+  /* WLANTL_STA_INIT */
+  { {
+    NULL,      /* WLANTL_TX_EVENT - no packets should get transmitted*/
+    NULL,      /* WLANTL_RX_EVENT - no packets should be received - drop*/
+  } },
+
+  /* WLANTL_STA_CONNECTED */
+  { {
+    WLANTL_STATxConn,      /* WLANTL_TX_EVENT - only EAPoL or WAI frames are allowed*/
+    WLANTL_STARxConn,      /* WLANTL_RX_EVENT - only EAPoL or WAI frames can be rx*/
+  } },
+
+  /* WLANTL_STA_AUTHENTICATED */
+  { {
+    WLANTL_STATxAuth,      /* WLANTL_TX_EVENT - all data frames allowed*/
+    WLANTL_STARxAuth,      /* WLANTL_RX_EVENT - all data frames can be rx */
+  } },
+
+  /* WLANTL_STA_DISCONNECTED */
+  { {
+    WLANTL_STATxDisc,      /* WLANTL_TX_EVENT - do nothing */
+    WLANTL_STARxDisc,      /* WLANTL_RX_EVENT - frames will still be fwd-ed*/
+  } }
+};
+
+/*---------------------------------------------------------------------------
+  Reordering information
+---------------------------------------------------------------------------*/
+
+#define WLANTL_MAX_WINSIZE      64
+#define WLANTL_MAX_BA_SESSION   40
+
+typedef struct
+{
+   v_BOOL_t     isAvailable;
+#ifdef ANI_CHIPSET_VOLANS
+   v_U64_t      ullReplayCounter[WLANTL_MAX_WINSIZE];
+#endif
+   v_PVOID_t    arrayBuffer[WLANTL_MAX_WINSIZE];
+} WLANTL_REORDER_BUFFER_T;
+
+
+/* To handle Frame Q aging, timer is needed
+ * After timer expired, Qed frames have to be routed to upper layer
+ * WLANTL_TIMER_EXPIER_UDATA_T is user data type for timer callback
+ */
+typedef struct
+{
+   /* Global contect, HAL, HDD need this */
+   v_PVOID_t          pAdapter;
+
+   /* TL context handle */
+   v_PVOID_t          pTLHandle;
+
+   /* Current STAID, to know STA context */
+   v_U32_t            STAID;
+
+   v_U8_t             TID;
+} WLANTL_TIMER_EXPIER_UDATA_T;
+
+typedef struct
+{
+  /*specifies if re-order session exists*/
+  v_U8_t             ucExists;
+
+  /* Current Index */
+  v_U32_t             ucCIndex;
+
+  /* Count of the total packets in list*/
+  v_U16_t            usCount;
+
+  /* vos ttimer to handle Qed frames aging */
+  vos_timer_t        agingTimer;
+
+  /* Q windoe size */
+  v_U32_t            winSize;
+
+  /* Available RX frame buffer size */
+  v_U32_t            bufferSize;
+
+  /* Start Sequence number */
+  v_U32_t            SSN;
+
+  /* BA session ID, generate by HAL */
+  v_U32_t            sessionID;
+
+  v_U32_t            currentESN;
+
+  v_U32_t            pendingFramesCount;
+
+  vos_lock_t         reorderLock;
+
+  /* Aging timer callback user data */
+  WLANTL_TIMER_EXPIER_UDATA_T timerUdata;
+
+  WLANTL_REORDER_BUFFER_T     *reorderBuffer;
+}WLANTL_BAReorderType;
+
+
+/*---------------------------------------------------------------------------
+  UAPSD information
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* flag set when a UAPSD session with triggers generated in fw is being set*/
+  v_U8_t              ucSet;
+}WLANTL_UAPSDInfoType;
+
+/*---------------------------------------------------------------------------
+  STA Client type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* Flag that keeps track of registration; only one STA with unique
+     ID allowed */
+  v_U8_t                        ucExists;
+
+  /*The flag controls the Rx path for the station - as long as there are
+    packets at sta level that need to be fwd-ed the Rx path will be blocked,
+    it will become unblocked only when the cached frames were fwd-ed;
+    while the rx path is blocked all rx-ed frames for that STA will be cached
+    */
+  v_U8_t                        ucRxBlocked;
+
+  /* Function pointer to the receive packet handler from HDD */
+  WLANTL_STARxCBType            pfnSTARx;
+
+  /* Function pointer to the transmit complete confirmation handler
+    from HDD */
+  WLANTL_TxCompCBType           pfnSTATxComp;
+
+  /* Function pointer to the packet retrieval routine in HDD */
+  WLANTL_STAFetchPktCBType      pfnSTAFetchPkt;
+
+  /* Reordering information for the STA */
+  WLANTL_BAReorderType          atlBAReorderInfo[WLAN_MAX_TID];
+
+  /* STA Descriptor, contains information related to the new added STA */
+  WLAN_STADescType              wSTADesc;
+
+  /* Current connectivity state of the STA */
+  WLANTL_STAStateType           tlState;
+
+  /* Station priority */
+  WLANTL_STAPriorityType        tlPri;
+
+  /* Value of the averaged RSSI for this station */
+  v_S7_t                        rssiAvg;
+
+  /* Value of the averaged RSSI for this station in BMPS */
+  v_S7_t                        rssiAvgBmps;
+
+  /* Value of the averaged RSSI for this station */
+  v_U32_t                       uLinkQualityAvg;
+
+  /* Tx packet count per station per TID */
+  v_U32_t                       auTxCount[WLAN_MAX_TID];
+
+  /* Rx packet count per station per TID */
+  v_U32_t                       auRxCount[WLAN_MAX_TID];
+
+  /* Suspend flag */
+  v_U8_t                        ucTxSuspended;
+
+  /* Pointer to the AMSDU chain maintained by the AMSDU de-aggregation
+     completion sub-module */
+  vos_pkt_t*                    vosAMSDUChainRoot;
+
+  /* Pointer to the root of the chain */
+  vos_pkt_t*                    vosAMSDUChain;
+
+  /* Used for saving/restoring frame header for 802.3/11 AMSDU sub-frames */
+  v_U8_t                        aucMPDUHeader[WLANTL_MPDU_HEADER_LEN];
+
+  /* length of the header */
+  v_U8_t                        ucMPDUHeaderLen;
+
+  /* Enabled ACs currently serviced by TL (automatic setup in TL)*/
+  v_U8_t                        aucACMask[WLANTL_MAX_AC];
+
+  /* Current AC to be retrieved */
+  WLANTL_ACEnumType             ucCurrentAC;
+
+  /*Packet pending flag - set if tx is pending for the station*/
+  v_U8_t                        ucPktPending;
+  
+  /*used on tx packet to signal when there is no more data to tx for the 
+   moment=> packets can be passed to BAL */
+  v_U8_t                    ucNoMoreData;
+
+  /* Last serviced AC to be retrieved */
+  WLANTL_ACEnumType             ucServicedAC;
+
+   /* Current weight for the AC */
+  v_U8_t                        ucCurrentWeight;
+
+  /* Info used for UAPSD trigger frame generation  */
+  WLANTL_UAPSDInfoType          wUAPSDInfo[WLANTL_MAX_AC];
+
+  /* flag to signal if a trigger frames is pending */
+  v_U8_t                        ucPendingTrigFrm;
+
+  WLANTL_TRANSFER_STA_TYPE      trafficStatistics;
+
+  /*Members needed for packet caching in TL*/
+  /*Begining of the cached packets chain*/
+  vos_pkt_t*                 vosBegCachedFrame;
+
+  /*Begining of the cached packets chain*/
+  vos_pkt_t*                 vosEndCachedFrame;
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+  /* LWM related fields */
+
+  //current station is slow. LWM mode is enabled.
+  v_BOOL_t ucLwmModeEnabled;
+  //LWM events is reported when LWM mode is on. Able to send more traffic
+  //under the constraints of uBuffThresholdMax
+  v_BOOL_t ucLwmEventReported;
+
+  //v_U8_t uLwmEventReported;
+
+  /* Flow control fields */
+  //memory used in previous round
+  v_U8_t bmuMemConsumed;
+
+  //the number packets injected in this round
+  v_U32_t uIngress_length;
+
+  //number of packets allowed in current round beforing receiving new FW memory updates
+  v_U32_t uBuffThresholdMax;
+
+
+  // v_U32_t uEgress_length;
+
+  // v_U32_t uIngress_length;
+
+  // v_U32_t uBuffThresholdMax;
+
+  // v_U32_t uBuffThresholdUsed;
+
+  /* Value used to set LWM in FW. Initialized to 1/3* WLAN_STA_BMU_THRESHOLD_MAX
+     In the future, it can be dynamically adjusted if we find the reason to implement
+     such algorithm. */
+  v_U32_t uLwmThreshold;
+
+  //tx disable forced by Riva software
+  v_U16_t fcStaTxDisabled;
+
+  /** HDD buffer status for packet scheduling. Once HDD
+   *  stores a new packet in a previously empty queue, it
+   *  will call TL interface to set the fields. The fields
+   *  will be cleaned by TL when TL can't fetch more packets
+   *  from the queue. */
+  // the fields are ucPktPending and ucACMask;
+
+  /* Queue to keep unicast station management frame */
+  vos_list_t pStaManageQ;
+#endif
+
+#ifdef ANI_CHIPSET_VOLANS
+ /* 1 means replay check is needed for the station,
+  * 0 means replay check is not needed for the station*/
+  v_BOOL_t      ucIsReplayCheckValid;
+
+ /* It contains 48-bit replay counter per TID*/
+  v_U64_t       ullReplayCounter[WLANTL_MAX_TID];
+
+ /* It contains no of replay packets found per STA.
+    It is for debugging purpose only.*/
+  v_U32_t       ulTotalReplayPacketsDetected;
+#endif
+
+}WLANTL_STAClientType;
+
+/*---------------------------------------------------------------------------
+  BAP Client type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* flag that keeps track of registration; only one non-data BT-AMP client
+     allowed */
+  v_U8_t                    ucExists;
+
+  /* pointer to the receive processing routine for non-data BT-AMP frames */
+  WLANTL_BAPRxCBType        pfnTlBAPRx;
+
+  /* pointer to the flush call back complete function */
+  WLANTL_FlushOpCompCBType    pfnFlushOpCompleteCb;
+
+  /* pointer to the non-data BT-AMP frame pending transmission */
+  vos_pkt_t*                vosPendingDataBuff;
+
+  /* BAP station ID */
+  v_U8_t                    ucBAPSTAId;
+}WLANTL_BAPClientType;
+
+
+/*---------------------------------------------------------------------------
+  Management Frame Client type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* flag that keeps track of registration; only one management frame
+     client allowed */
+  v_U8_t                       ucExists;
+
+  /* pointer to the receive processing routine for management frames */
+  WLANTL_MgmtFrmRxCBType       pfnTlMgmtFrmRx;
+
+  /* pointer to the management frame pending transmission */
+  vos_pkt_t*                   vosPendingDataBuff;
+}WLANTL_MgmtFrmClientType;
+
+typedef struct
+{
+   WLANTL_TrafficStatusChangedCBType  trafficCB;
+   WLANTL_HO_TRAFFIC_STATUS_TYPE      trafficStatus;
+   v_U32_t                            idleThreshold;
+   v_U32_t                            measurePeriod;
+   v_U32_t                            rtRXFrameCount;
+   v_U32_t                            rtTXFrameCount;
+   v_U32_t                            nrtRXFrameCount;
+   v_U32_t                            nrtTXFrameCount;
+   vos_timer_t                        trafficTimer;
+   v_PVOID_t                          usrCtxt;
+} WLANTL_HO_TRAFFIC_STATUS_HANDLE_TYPE;
+
+typedef struct
+{
+   v_S7_t                          rssiValue;
+   v_U8_t                          triggerEvent[WLANTL_HS_NUM_CLIENT];
+   v_PVOID_t                       usrCtxt[WLANTL_HS_NUM_CLIENT];
+   v_U8_t                          whoIsClient[WLANTL_HS_NUM_CLIENT];
+   WLANTL_RSSICrossThresholdCBType crossCBFunction[WLANTL_HS_NUM_CLIENT];
+   v_U8_t                          numClient;
+} WLANTL_HO_RSSI_INDICATION_TYPE;
+
+typedef struct
+{
+   v_U8_t                             numThreshold;
+   v_U8_t                             regionNumber;
+   v_S7_t                             historyRSSI;
+   v_U8_t                             alpha;
+   v_U32_t                            sampleTime;
+   v_U32_t                            fwNotification;
+} WLANTL_CURRENT_HO_STATE_TYPE;
+
+typedef struct
+{
+   WLANTL_HO_RSSI_INDICATION_TYPE       registeredInd[WLANTL_MAX_AVAIL_THRESHOLD];
+   WLANTL_CURRENT_HO_STATE_TYPE         currentHOState;
+   WLANTL_HO_TRAFFIC_STATUS_HANDLE_TYPE currentTraffic;
+   v_PVOID_t                            macCtxt;
+   vos_lock_t                           hosLock;
+} WLANTL_HO_SUPPORT_TYPE;
+
+/*---------------------------------------------------------------------------
+  TL control block type
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* TL configuration information */
+  WLANTL_ConfigInfoType     tlConfigInfo;
+
+  /* list of the active stations */
+  WLANTL_STAClientType      *atlSTAClients; /*Allocate memory [WLAN_MAX_STA_COUNT] of station */
+
+  /* information on the management frame client */
+  WLANTL_MgmtFrmClientType  tlMgmtFrmClient;
+
+  /* information on the BT AMP client */
+  WLANTL_BAPClientType      tlBAPClient;
+
+  /* number of packets sent to BAL waiting for tx complete confirmation */
+  v_U16_t                   usPendingTxCompleteCount;
+
+  /* global suspend flag */
+  v_U8_t                    ucTxSuspended;
+
+  /* resource flag */
+  v_U32_t                   uResCount;
+
+  /* dummy vos buffer - used for chains */
+  vos_pkt_t*                vosDummyBuf;
+
+  /* temporary buffer for storing the packet that no longer fits */
+  vos_pkt_t*                vosTempBuf;
+
+  /* The value of the station id and AC for the cached buffer */
+  v_U8_t                    ucCachedSTAId;
+  v_U8_t                    ucCachedAC;
+
+  /* Last registered STA - until multiple sta support is added this will
+     be used always for tx */
+  v_U8_t                    ucRegisteredStaId;
+
+  /*Current TL STA used for TX*/
+  v_U8_t                    ucCurrentSTA;
+
+  WLANTL_REORDER_BUFFER_T   *reorderBufferPool; /* Allocate memory for [WLANTL_MAX_BA_SESSION] sessions */
+
+  WLANTL_HO_SUPPORT_TYPE    hoSupport;
+
+  v_BOOL_t                  bUrgent;
+
+#ifdef WLAN_SOFTAP_FEATURE
+
+  /* resource flag */
+  v_U32_t bd_pduResCount;
+
+  /* time interval to evaluate LWM mode*/
+  //vos_timer_t tThresholdSamplingTimer;
+
+#if 0
+  //information fields for flow control
+  tFcTxParams_type tlFCInfo;
+#endif
+
+  vos_pkt_t*                vosTxFCBuf;
+
+  /* LWM mode is enabled or not for each station. Bit-wise operation.32 station maximum. */
+  //  v_U32_t uStaLwmMask;
+
+  /* LWM event is reported by FW. */
+  //  v_U32_t uStaLwmEventReported;
+
+  /** Multiple Station Scheduling and TL queue management.
+      4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used
+      in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field.
+      Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic
+      or not.
+
+      Stations are served in a round-robin fashion from highest priority to lowest priority.
+      The number of round-robin times of each prioirty equals to the WFQ weights and differetiates
+      the traffic of different prioirty. As such, stations can not provide low priority packets if
+      high priority packets are all served.
+      */
+
+  /* Currently served station id. Reuse ucCurrentSTA field. */
+  //v_U8_t uCurStaId;
+
+  /* Current served station ID in round-robin method to traverse all stations.*/
+  WLANTL_ACEnumType uCurServedAC;
+
+  /* How many weights have not been served in current AC. */
+  v_U8_t ucCurLeftWeight;
+
+  /* BC/MC management queue. Current implementation uses queue size 1. Will check whether
+    size N is supported. */
+  vos_list_t pMCBCManageQ;
+
+  v_U32_t sendFCFrame;
+
+  v_U8_t done_once;
+  v_U8_t uFramesProcThres;
+#endif
+  /*whether we are in BMPS/UAPSD/WOWL mode, since the latter 2 need to be BMPS first*/
+  v_BOOL_t                  isBMPS;
+}WLANTL_CbType;
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_GetFrames
+
+  DESCRIPTION
+
+    BAL calls this function at the request of the lower bus interface.
+    When this request is being received TL will retrieve packets from HDD
+    in accordance with the priority rules and the count supplied by BAL.
+
+  DEPENDENCIES
+
+    HDD must have registered with TL at least one STA before this function
+    can be called.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+    uSize:          maximum size accepted by the lower layer
+    uFlowMask       TX flow control mask. Each bit is defined as 
+                    WDA_TXFlowEnumType
+
+    OUT
+    vosDataBuff:   it will contain a pointer to the first buffer supplied
+                    by TL, if there is more than one packet supplied, TL
+                    will chain them through vOSS buffers
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+
+    1 or more: number of required resources if there are still frames to fetch
+               For Volans, it's BD/PDU numbers. For Prima, it's free DXE descriptors.
+    0 : error or HDD queues are drained
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_U32_t
+WLANTL_GetFrames
+(
+  v_PVOID_t       pAdapter,
+  vos_pkt_t     **ppFrameDataBuff,
+  v_U32_t         uSize,
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  v_U8_t          uFlowMask,
+#endif
+  v_BOOL_t*       pbUrgent
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxComp
+
+  DESCRIPTION
+    It is being called by BAL upon asynchronous notification of the packet
+    or packets  being sent over the bus.
+
+  DEPENDENCIES
+    Tx complete cannot be called without a previous transmit.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+    vosDataBuff:   it will contain a pointer to the first buffer for which
+                    the BAL report is being made, if there is more then one
+                    packet they will be chained using vOSS buffers.
+    wTxSTAtus:      the status of the transmitted packet, see above chapter
+                    on HDD interaction for a list of possible values
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxComp
+(
+  v_PVOID_t      pAdapter,
+  vos_pkt_t     *pFrameDataBuff,
+  VOS_STATUS     wTxStatus
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RxFrames
+
+  DESCRIPTION
+    Callback registered by TL and called by BAL when a packet is received
+    over the bus. Upon the call of this function TL will make the necessary
+    decision with regards to the forwarding or queuing of this packet and
+    the layer it needs to be delivered to.
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    If the frame carried is a data frame then the station for which it is
+    destined to must have been previously registered with TL.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+
+    vosDataBuff:   it will contain a pointer to the first buffer received,
+                    if there is more then one packet they will be chained
+                    using vOSS buffers.
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RxFrames
+(
+  v_PVOID_t      pAdapter,
+  vos_pkt_t     *pFrameDataBuff
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_RxCachedFrames
+
+  DESCRIPTION
+    Utility function used by TL to forward the cached frames to a particular
+    station;
+
+  DEPENDENCIES
+    TL must be initiailized before this function gets called.
+    If the frame carried is a data frame then the station for which it is
+    destined to must have been previously registered with TL.
+
+  PARAMETERS
+
+    IN
+    pTLCb:   pointer to TL handle
+
+    ucSTAId:    station for which we need to forward the packets
+
+    vosDataBuff:   it will contain a pointer to the first cached buffer
+                   received, if there is more then one packet they will be
+                   chained using vOSS buffers.
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   Input parameters are invalid
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_RxCachedFrames
+(
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucSTAId,
+  vos_pkt_t*      vosDataBuff
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_ResourceCB
+
+  DESCRIPTION
+    Called by the TL when it has packets available for transmission.
+
+  DEPENDENCIES
+    The TL must be registered with BAL before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    or BAL's control block can be extracted from its context
+    uCount:         avail resource count obtained from hw
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ResourceCB
+(
+  v_PVOID_t       pAdapter,
+  v_U32_t         uCount
+);
+
+
+/*==========================================================================
+  FUNCTION    WLANTL_ProcessMainMessage
+
+  DESCRIPTION
+    Called by VOSS when a message was serialized for TL through the
+    main thread/task.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ProcessMainMessage
+(
+  v_PVOID_t        pAdapter,
+  vos_msg_t*       message
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_ProcessTxMessage
+
+  DESCRIPTION
+    Called by VOSS when a message was serialized for TL through the
+    tx thread/task.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    control block can be extracted from its context
+    message:        type and content of the message
+
+
+  RETURN VALUE
+
+    The result code associated with performing the operation
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_ProcessTxMessage
+(
+  v_PVOID_t        pAdapter,
+  vos_msg_t*       message
+);
+
+/*==========================================================================
+  FUNCTION    WLAN_TLGetNextTxIds
+
+  DESCRIPTION
+    Gets the next station and next AC in the list
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   OUT
+   pucSTAId:    STAtion ID
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLAN_TLGetNextTxIds
+(
+  v_PVOID_t    pAdapter,
+  v_U8_t*      pucSTAId
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_CleanCb
+
+  DESCRIPTION
+    Cleans TL control block
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pTLCb:       pointer to TL's control block
+    ucEmpty:     set if TL has to clean up the queues and release pedning pkts
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_CleanCB
+(
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucEmpty
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_CleanSTA
+
+  DESCRIPTION
+    Cleans a station control block.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to TL's
+                    control block can be extracted from its context
+    ucEmpty:        if set the queues and pending pkts will be emptyed
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_CleanSTA
+(
+  WLANTL_STAClientType*  ptlSTAClient,
+  v_U8_t                 ucEmpty
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_GetTxResourcesCB
+
+  DESCRIPTION
+    Processing function for Resource needed signal. A request will be issued
+    to BAL to get mor tx resources.
+
+  DEPENDENCIES
+    The TL must be initialized before this function can be called.
+
+  PARAMETERS
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's
+                    control block can be extracted from its context
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  Other values can be returned as a result of a function call, please check
+  corresponding API for more info.
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_GetTxResourcesCB
+(
+  v_PVOID_t        pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_PrepareBDHeader
+
+  DESCRIPTION
+    Callback function for serializing Suspend signal through Tx thread
+
+  DEPENDENCIES
+    Just notify HAL that suspend in TL is complete.
+
+  PARAMETERS
+
+   IN
+   pAdapter:       pointer to the global adapter context; a handle to TL's
+                   control block can be extracted from its context
+   pUserData:      user data sent with the callback
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+void
+WLANTL_PrepareBDHeader
+(
+  vos_pkt_t*      vosDataBuff,
+  v_PVOID_t*      ppvBDHeader,
+  v_MACADDR_t*    pvDestMacAdddr,
+  v_U8_t          ucDisableFrmXtl,
+  VOS_STATUS*     pvosSTAtus,
+  v_U16_t*        usPktLen,
+  v_U8_t          ucQosEnabled,
+  v_U8_t          ucWDSEnabled,
+  v_U8_t          extraHeadSpace
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_Translate8023To80211Header
+
+  DESCRIPTION
+    Inline function for translating and 802.3 header into an 802.11 header.
+
+  DEPENDENCIES
+
+
+  PARAMETERS
+
+   IN
+    pTLCb:            TL control block
+    ucStaId:          station ID
+
+   IN/OUT
+    vosDataBuff:      vos data buffer, will contain the new header on output
+
+   OUT
+    pvosStatus:       status of the operation
+
+  RETURN VALUE
+    No return.
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Translate8023To80211Header
+(
+  vos_pkt_t*      vosDataBuff,
+  VOS_STATUS*     pvosStatus,
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucStaId,
+  v_U8_t          ucUP,
+  v_U8_t          *ucWDSEnabled,
+  v_U8_t          *extraHeadSpace
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_Translate80211To8023Header
+
+  DESCRIPTION
+    Inline function for translating and 802.11 header into an 802.3 header.
+
+  DEPENDENCIES
+
+
+  PARAMETERS
+
+   IN
+    pTLCb:            TL control block
+    ucStaId:          station ID
+    ucHeaderLen:      Length of the header from BD
+    ucActualHLen:     Length of header including padding or any other trailers
+
+   IN/OUT
+    vosDataBuff:      vos data buffer, will contain the new header on output
+
+   OUT
+    pvosStatus:       status of the operation
+
+  RETURN VALUE
+    Status of the operation
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_Translate80211To8023Header
+(
+  vos_pkt_t*      vosDataBuff,
+  VOS_STATUS*     pvosStatus,
+  v_U16_t         usActualHLen,  
+  v_U8_t          ucHeaderLen,
+  WLANTL_CbType*  pTLCb,
+  v_U8_t          ucSTAId
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_MgmtFrmRxDefaultCb
+
+  DESCRIPTION
+    Default Mgmt Frm rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for Mgmt Frm.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    Not used.
+
+  RETURN VALUE
+   Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_MgmtFrmRxDefaultCb
+(
+  v_PVOID_t  pAdapter,
+  v_PVOID_t  vosBuff
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STARxDefaultCb
+
+  DESCRIPTION
+    Default BAP rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for BAP.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    Not used.
+
+  RETURN VALUE
+   Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_BAPRxDefaultCb
+(
+  v_PVOID_t    pAdapter,
+  vos_pkt_t*   vosDataBuff,
+  WLANTL_BAPFrameEnumType frameType
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STARxDefaultCb
+
+  DESCRIPTION
+    Default STA rx callback: asserts all the time. If this function gets
+    called  it means there is no registered rx cb pointer for station.
+    (Mem corruption most likely, it should never happen)
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    Not used.
+
+  RETURN VALUE
+   Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STARxDefaultCb
+(
+  v_PVOID_t               pAdapter,
+  vos_pkt_t*              vosDataBuff,
+  v_U8_t                  ucSTAId,
+  WLANTL_RxMetaInfoType*  pRxMetaInfo
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_STAFetchPktDefaultCb
+
+  DESCRIPTION
+    Default fetch callback: asserts all the time. If this function gets
+    called  it means there is no registered fetch cb pointer for station.
+    (Mem corruption most likely, it should never happen)
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+    Not used.
+
+  RETURN VALUE
+   Always FAILURE.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_STAFetchPktDefaultCb
+(
+  v_PVOID_t              pAdapter,
+  v_U8_t*                pucSTAId,
+  WLANTL_ACEnumType      ucAC,
+  vos_pkt_t**            vosDataBuff,
+  WLANTL_MetaInfoType*   tlMetaInfo
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxCompDefaultCb
+
+  DESCRIPTION
+    Default tx complete handler. It will release the completed pkt to
+    prevent memory leaks.
+
+  PARAMETERS
+
+    IN
+    pAdapter:       pointer to the global adapter context; a handle to
+                    TL/HAL/PE/BAP/HDD control block can be extracted from
+                    its context
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted
+    wTxSTAtus:      status of the transmission
+
+
+  RETURN VALUE
+    The result code associated with performing the operation; please
+    check vos_pkt_return_pkt for possible error codes.
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxCompDefaultCb
+(
+ v_PVOID_t      pAdapter,
+ vos_pkt_t*     vosDataBuff,
+ VOS_STATUS     wTxSTAtus
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_PackUpTriggerFrame
+
+  DESCRIPTION
+    Packs up a trigger frame and places it in TL's cache for tx and notifies
+    BAL
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+  IN
+    pTLCb:         pointer to the TL control block
+    pfnSTATxComp:  Tx Complete Cb to be used when frame is received
+    ucSTAId:       station id
+    ucAC:          access category
+
+  RETURN VALUE
+    None
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WLANTL_PackUpTriggerFrame
+(
+  WLANTL_CbType*            pTLCb,
+  WLANTL_TxCompCBType       pfnSTATxComp,
+  v_U8_t                    ucSTAId,
+  WLANTL_ACEnumType         ucAC
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxCompTriggFrameSI
+
+  DESCRIPTION
+    Tx complete handler for the service interval trigger frame.
+    It will restart the SI timer.
+
+  PARAMETERS
+
+   IN
+    pvosGCtx:       pointer to the global vos context; a handle to
+                    TL/HAL/PE/BAP/HDD control block can be extracted from
+                    its context
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted
+    wTxSTAtus:      status of the transmission
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+ ============================================================================*/
+VOS_STATUS
+WLANTL_TxCompTriggFrameSI
+(
+  v_PVOID_t      pvosGCtx,
+  vos_pkt_t*     vosDataBuff,
+  VOS_STATUS     wTxSTAtus
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_TxCompTriggFrameSI
+
+  DESCRIPTION
+    Tx complete handler for the service interval trigger frame.
+    It will restart the SI timer.
+
+  PARAMETERS
+
+   IN
+    pvosGCtx:       pointer to the global vos context; a handle to
+                    TL/HAL/PE/BAP/HDD control block can be extracted from
+                    its context
+    vosDataBuff:   pointer to the VOSS data buffer that was transmitted
+    wTxSTAtus:      status of the transmission
+
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+============================================================================*/
+VOS_STATUS
+WLANTL_TxCompTriggFrameDI
+(
+ v_PVOID_t      pvosGCtx,
+ vos_pkt_t*     vosDataBuff,
+ VOS_STATUS     wTxSTAtus
+);
+
+/*==========================================================================
+
+   FUNCTION
+
+   DESCRIPTION   Read RSSI value out of a RX BD
+
+   PARAMETERS: Caller must validate all parameters
+
+   RETURN VALUE
+
+============================================================================*/
+VOS_STATUS WLANTL_ReadRSSI
+(
+   v_PVOID_t        pAdapter,
+   v_PVOID_t        pBDHeader,
+   v_U8_t           STAid
+);
+
+
+
+void WLANTL_PowerStateChangedCB
+(
+   v_PVOID_t pAdapter,
+   tPmcState newState
+);
+
+#ifdef WLAN_SOFTAP_FEATURE
+/*==========================================================================
+  FUNCTION   WLANTL_FwdPktToHDD 
+
+  DESCRIPTION
+    Determine the Destation Station ID and route the Frame to Upper Layer
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+   pvosGCtx:       pointer to the global vos context; a handle to TL's
+                   control block can be extracted from its context
+   ucSTAId:        identifier of the station being processed
+   vosDataBuff:   pointer to the rx vos buffer
+
+  RETURN VALUE
+    The result code associated with performing the operation
+
+    VOS_STATUS_E_INVAL:   invalid input parameters
+    VOS_STATUS_E_FAULT:   pointer to TL cb is NULL ; access would cause a
+                          page fault
+    VOS_STATUS_SUCCESS:   Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+WLANTL_FwdPktToHDD
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t*     pvosDataBuff,
+  v_U8_t          ucSTAId
+);
+
+#endif /* #ifdef WLANTL_SOFTAP_FEATURE */
+#endif /* #ifndef WLAN_QCT_TLI_H */
diff --git a/CORE/TL/src/wlan_qct_tli_ba.h b/CORE/TL/src/wlan_qct_tli_ba.h
new file mode 100644
index 0000000..bdd6e0d
--- /dev/null
+++ b/CORE/TL/src/wlan_qct_tli_ba.h
@@ -0,0 +1,395 @@
+/*
+ * 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 WLAN_QCT_TLI_BA_H
+#define WLAN_QCT_TLI_BA_H
+
+/*===========================================================================
+
+               W L A N   T R A N S P O R T   L A Y E R 
+               B L O C K   A C K    I N T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the internal declarations used within wlan transport 
+  layer module for BA session support, AMSDU de-aggregation and 
+  MSDU reordering.
+        
+  Copyright (c) 2008 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
+--------    ---    ----------------------------------------------------------
+08/22/08    sch     Update based on unit test
+07/31/08    lti     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_tli.h" 
+
+/*---------------------------------------------------------------------------
+   Re-order opcode filled in by RPE 
+   !!! fix me: (check with RPE doc if the codes are correct)
+ ---------------------------------------------------------------------------*/
+typedef enum
+{
+  WLANTL_OPCODE_INVALID         = 0,
+  WLANTL_OPCODE_QCUR_FWDBUF     = 1,
+  WLANTL_OPCODE_FWDBUF_FWDCUR   = 2,
+  WLANTL_OPCODE_QCUR            = 3,
+  WLANTL_OPCODE_FWDBUF_QUEUECUR = 4,
+  WLANTL_OPCODE_FWDBUF_DROPCUR  = 5,
+  WLANTL_OPCODE_FWDALL_DROPCUR  = 6,
+  WLANTL_OPCODE_FWDALL_QCUR     = 7,
+  WLANTL_OPCODE_TEARDOWN        = 8,
+  WLANTL_OPCODE_DROPCUR         = 9,
+  WLANTL_OPCODE_MAX
+}WLANTL_OpCodeEnumType;
+
+void WLANTL_InitBAReorderBuffer
+(
+   v_PVOID_t   pvosGCtx
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_BaSessionAdd
+
+  DESCRIPTION 
+    HAL notifies TL when a new Block Ack session is being added. 
+    
+  DEPENDENCIES 
+    A BA session on Rx needs to be added in TL before the response is 
+    being sent out 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station for which requested the BA 
+                    session
+    ucTid:          Tspec ID for the new BA session
+    uSize:          size of the reordering window
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:      Input parameters are invalid 
+    VOS_STATUS_E_FAULT:      Station ID is outside array boundaries or pointer 
+                             to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:     Station was not registered or BA session already
+                             exists
+    VOS_STATUS_E_NOSUPPORT:  Not yet supported
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_BaSessionAdd 
+( 
+  v_PVOID_t   pvosGCtx, 
+  v_U16_t     sessionID,
+  v_U32_t     ucSTAId,
+  v_U8_t      ucTid, 
+  v_U32_t     uBufferSize,
+  v_U32_t     winSize,
+  v_U32_t     SSN 
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_BaSessionDel
+
+  DESCRIPTION 
+    HAL notifies TL when a new Block Ack session is being deleted. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pvosGCtx:       pointer to the global vos context; a handle to TL's 
+                    control block can be extracted from its context 
+    ucSTAId:        identifier of the station for which requested the BA 
+                    session
+    ucTid:          Tspec ID for the new BA session
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_INVAL:      Input parameters are invalid 
+    VOS_STATUS_E_FAULT:      Station ID is outside array boundaries or pointer 
+                             to TL cb is NULL ; access would cause a page fault  
+    VOS_STATUS_E_EXISTS:     Station was not registered or BA session already
+                             exists
+    VOS_STATUS_E_NOSUPPORT:  Not yet supported
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_BaSessionDel 
+( 
+  v_PVOID_t           pvosGCtx, 
+  v_U16_t             ucSTAId,
+  v_U8_t              ucTid
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_AMSDUProcess
+
+  DESCRIPTION 
+    Process A-MSDU sub-frame. Start of chain if marked as first frame. 
+    Linked at the end of the existing AMSDU chain. 
+    
+
+  DEPENDENCIES 
+         
+  PARAMETERS 
+
+   IN/OUT:
+   vosDataBuff: vos packet for the received data
+                 outgoing contains the root of the chain for the rx 
+                 aggregated MSDU if the frame is marked as last; otherwise 
+                 NULL
+   
+   IN
+   pAdapter:     pointer to the global adapter context; a handle to TL's 
+                 control block can be extracted from its context 
+   pvBDHeader:   pointer to the BD header
+   ucSTAId:      STAtion ID 
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_AMSDUProcess
+( 
+  v_PVOID_t   pvosGCtx,
+  vos_pkt_t** ppVosDataBuff, 
+  v_PVOID_t   pvBDHeader,
+  v_U8_t      ucSTAId,
+  v_U8_t      ucMPDUHLen,
+  v_U16_t     usMPDULen
+);
+
+/*==========================================================================
+  FUNCTION    WLANTL_MSDUReorder
+
+  DESCRIPTION 
+    MSDU reordering 
+
+  DEPENDENCIES 
+         
+  PARAMETERS 
+
+   IN
+   
+   vosDataBuff: vos packet for the received data
+   pvBDHeader: pointer to the BD header
+   ucSTAId:    STAtion ID 
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_MSDUReorder
+( 
+   WLANTL_CbType    *pTLCb,
+   vos_pkt_t        **vosDataBuff, 
+   v_PVOID_t        pvBDHeader,
+   v_U8_t           ucSTAId,
+   v_U8_t           ucTid
+);
+
+
+/*==========================================================================
+    Utility functions
+  ==========================================================================*/
+
+/*==========================================================================
+  FUNCTION    WLANTL_AMSDUCompleteFrame
+
+  DESCRIPTION 
+    Complete AMSDU de-aggregation
+
+  DEPENDENCIES 
+         
+  PARAMETERS 
+
+   IN/OUT:
+   vosDataBuff: vos packet for the received data
+   
+   IN
+   pvBDHeader: pointer to the BD header
+   ucSTAId:    STAtion ID 
+      
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_AMSDUCompleteFrame
+( 
+  vos_pkt_t*  vosDataBuff,
+  v_U8_t      ucMPDUHLen,
+  v_U16_t     usMPDULen
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_QueueCurrent
+
+  DESCRIPTION 
+    It will queue a packet at a given slot index in the MSDU reordering list. 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    pwBaReorder:   pointer to the BA reordering session info 
+    vosDataBuff:   data buffer to be queued
+    ucSlotIndex:   slot index 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_SUCCESS:     Everything is OK
+
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WLANTL_QueueCurrent
+(
+  WLANTL_BAReorderType*  pwBaReorder,
+  vos_pkt_t**            vosDataBuff,
+  v_U8_t                 ucSlotIndex
+);
+
+/*==========================================================================
+
+  FUNCTION    WLANTL_ChainFrontPkts
+
+  DESCRIPTION 
+    It will remove all the packets from the front of a vos list and chain 
+    them to a vos pkt . 
+    
+  DEPENDENCIES 
+    
+  PARAMETERS 
+
+    IN
+    ucCount:       number of packets to extract
+    pwBaReorder:   pointer to the BA reordering session info 
+
+    OUT
+    vosDataBuff:   data buffer containing the extracted chain of packets
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+    VOS_STATUS_E_SUCCESS:     Everything is OK
+
+    
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANTL_ChainFrontPkts
+( 
+   v_U32_t                fwdIndex,
+   v_U8_t                 opCode,
+   vos_pkt_t              **vosDataBuff,
+   WLANTL_BAReorderType   *pwBaReorder,
+   WLANTL_CbType          *pTLCb
+);
+
+#ifdef ANI_CHIPSET_VOLANS
+/*==========================================================================
+ 
+   FUNCTION    WLANTL_FillReplayCounter
+ 
+   DESCRIPTION 
+    It will fill repaly counter at a given slot index in the MSDU reordering list. 
+              
+   DEPENDENCIES 
+                
+   PARAMETERS 
+
+   IN
+   pwBaReorder  :   pointer to the BA reordering session info 
+   replayCounter:   replay counter to be filled
+   ucSlotIndex  :   slot index 
+                 
+   RETURN VALUE
+   NONE 
+ 
+                                             
+   SIDE EFFECTS 
+   NONE
+                                                   
+ ============================================================================*/
+void WLANTL_FillReplayCounter
+(
+   WLANTL_BAReorderType*  pwBaReorder,
+   v_U64_t                replayCounter,
+   v_U8_t                 ucSlotIndex
+);
+#endif /*ANI_CHIPSET_VOLANS*/
+
+#endif /* #ifndef WLAN_QCT_TLI_H */
diff --git a/CORE/VOSS/inc/event_defs.h b/CORE/VOSS/inc/event_defs.h
new file mode 100644
index 0000000..5c16138
--- /dev/null
+++ b/CORE/VOSS/inc/event_defs.h
@@ -0,0 +1,1908 @@
+/*
+ * 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 EVENT_DEFS_H
+#define EVENT_DEFS_H
+
+
+typedef enum
+{
+  EVENT_DROP_ID = 0,
+
+  EVENT_BAND_CLASS_CHANGE = 0x0100,   /* Includes band class as payload */
+  EVENT_CDMA_CH_CHANGE,               /* Includes cdma channel as payload */
+  EVENT_BS_P_REV_CHANGE,              /* Includes BS p_rev as payload */
+  EVENT_P_REV_IN_USE_CHANGE,          /* Includes p_rev_in_use as payload */
+  EVENT_SID_CHANGE,                   /* Includes SID as payload */
+  EVENT_NID_CHANGE,                   /* Includes NID as payload */
+  EVENT_PZID_CHANGE,                  /* Includes PZID as payload */
+  EVENT_PDE_SESSION_END,              /* No payload */
+  EVENT_OP_MODE_CHANGE,               /* Includes operation mode as payload */
+  EVENT_MESSAGE_RECEIVED,             /* Includes channel and message ID as 
+                                         payload */
+  EVENT_MESSAGE_TRANSMITTED,          /* Includes channel and message ID as 
+                                         payload */
+  EVENT_TIMER_EXPIRED,                /* Includes timer ID as payload */
+  EVENT_COUNTER_THRESHOLD,            /* Includes counter ID as payload */
+  EVENT_CALL_PROCESSING_STATE_CHANGE, /* Includes new state and old state as
+                                         payload */ 
+  EVENT_CALL_CONTROL_INSTANTIATED,    /* Includes con_ref as payload */
+  EVENT_CALL_CONTROL_STATE_CHANGE,    /* Includes con_ref, old substate and
+                                         new substate as payload */
+  EVENT_CALL_CONTROL_TERMINATED,      /* Includes con_ref as payload */
+  EVENT_REG_ZONE_CHANGE,              /* Includes reg_zone as payload */ 
+  EVENT_SLOTTED_MODE_OPERATION,       /* Includes enter/exit bit as payload */
+  EVENT_QPCH_IN_USE,                  /* Includes enable/disable bit as payload */
+  EVENT_IDLE_HANDOFF,                 /* Includes pn_offset as payload */
+  EVENT_ACCESS_HANDOFF,               /* Includes pn_offset as payload */
+  EVENT_ACCESS_PROBE_HANDOFF,         /* Includes pn_offset as payload */
+  EVENT_SOFT_HANDOFF,   
+    /* Includes pn_offsets of each BS in aset and indicators whether BS in SCH 
+       aset*/ 
+  EVENT_HARD_HANDOFF_FREQ_CHANGE, 
+    /* Includes pn_offsets of each BS in aset and indicators whether BS in SCH 
+       aset*/ 
+  EVENT_HARD_HANDOFF_FRAME_OFFSET_CHANGE, 
+    /* Includes pn_offsets of each BS in aset and indicators whether BS in SCH 
+       aset*/ 
+  EVENT_HARD_HANDOFF_DISJOINT_ASET,
+    /* Includes pn_offsets of each BS in aset and indicators whether BS in SCH 
+       aset*/ 
+  EVENT_UNSUCCESSFUL_HARD_HANDOFF,    /* No payload */
+  EVENT_TMSI_ASSIGNED,                /* Includes TMSI as payload */
+  EVENT_SERVICE_NEGOTIATION_COMPLETED,/* No payload */
+  EVENT_SO_NEGOTIATION_COMPLETED,     /* No payload */
+  EVENT_ENTER_CONTROL_HOLD_MODE,      /* No payload */
+  EVENT_EXIT_CONTROL_HOLD_MODE,       /* No payload */
+  EVENT_START_FWD_SUPP_BURST_ASSGN,   /* Includes SCH rate as payload */
+  EVENT_END_FWD_SUPP_BURST_ASSGN,     /* No payload */
+  EVENT_START_REV_SUPP_BURST_ASSGN,   /* Includes SCH rate as payload */
+  EVENT_END_REV_SUPP_BURST_ASSGN,     /* No payload */
+  EVENT_DTX,                          /* No payload */
+  EVENT_T_ADD_ABORT,                  /* No payload */
+  EVENT_CH_IND_CHANGE,                /* Include ch_ind as payload */
+  EVENT_TRANSMITTER_DISABLED,         /* No payload */
+  EVENT_TRANSMITTER_ENABLED,          /* No payload */
+  EVENT_SMS_RECEIVED,                 /* No payload */
+  EVENT_SMS_SENT,                     /* No payload */
+  EVENT_INACTIVITY_TIMER_EXPIRED,     /* No payload */
+  EVENT_DORMANT_TIMER_EXPIRED,        /* No payload */
+  EVENT_ACCESS_ATTEMPT_FAIL_MAX_PROBES_SENT, /* No payload */
+  EVENT_ACCESS_ATTEMPT_FAIL_LOSS_OF_PC_OR_FCCC, /* No payload */
+  EVENT_PCH_ACQUIRED,                 /* Includes pagech and pn_offset
+                                         as payload */
+  EVENT_BCCH_ACQUIRED,                /* Includes walsh code for BCCH and 
+                                         pn_offset as payload */
+  EVENT_FFCH_ACQUIRED,                /* Payload: 14 bytes */
+  EVENT_FDCCH_ACQUIRED,               /* Payload: 14 bytes */
+  EVENT_FFCH_PLUS_DCCH_ACQUIRED,      /* No payload */
+  EVENT_REGISTRATION_PERFORMED,       /* Includes reg_type as payload */ 
+  EVENT_NEW_SYSTEM_IDLE_HANDOFF,      /* No payload */
+  EVENT_SYSTEM_RESELECTION,           /* Includes ecio and ps as payload */
+  EVENT_RESCAN,                       /* No payload */
+  EVENT_PROTOCOL_MISMATCH,            /* No payload */
+  EVENT_LOCK,                         /* No payload */
+  EVENT_UNLOCK,                       /* No payload */
+  EVENT_ACCESS_DENIED,                /* No payload */
+  EVENT_NDSS_OFF,                     /* No payload */
+  EVENT_RELEASE,                      /* Payload: 1 byte */
+  EVENT_ERROR,                        /* No payload */
+  EVENT_REDIRECTION,                  /* No payload */
+  EVENT_REGISTRATION_REJECTED,        /* No payload */
+  EVENT_WRONG_SYSTEM,                 /* No payload */
+  EVENT_WRONG_NETWORK,                /* No payload */
+  EVENT_LOSS_OF_ACQ_AFTER_SLEEP,      /* No payload */
+  EVENT_POWER_DOWN,                   /* No payload */
+  EVENT_CALL_RELEASE_REQUEST,         /* No payload */
+  EVENT_SERVICE_INACTIVE,             /* No payload */
+  EVENT_EXTENDED_RELEASE,             /* No payload */
+
+  EVENT_HDR_MSG_RX,                   /* protocol, msg- 3 bytes */
+  EVENT_HDR_RXMSG_IGNORED_STATE,      /* protocol, msg- 3 bytes */
+  EVENT_HDR_RXMSG_IGNORED_SEQ,        /* protocol, msg- 3 bytes */
+  EVENT_HDR_TXMSG_ACKED,              /* protocol, msg- 3 bytes */
+  EVENT_HDR_TXMSG_DROPPED,            /* protocol, msg- 3 bytes */      
+  EVENT_HDR_STATE_CHANGE,             /* protocol, from, to - 5 bytes */
+  EVENT_HDR_ALMP_OBEYING_REDIRECTION, /* No payload */
+  EVENT_HDR_ALMP_CONNECTION_CLOSED,   /* No payload */
+  EVENT_HDR_ALMP_T_SD_RESELECT,       /* No payload */
+  EVENT_HDR_ALMP_CONNECTION_OPENED,   /* No payload */
+  EVENT_HDR_HMP_QUEUED_MSG,           /* protocol, msg- 3 bytes */
+  EVENT_HDR_HMP_SENT_MSG,             /* protocol, msg, chan, is_reliable - 5 bytes */
+  EVENT_HDR_HMP_ABORTING_ACMAC_ACTIVATION, /* No payload */
+  EVENT_HDR_IDLE_T_CONFIG_RSP,        /* No payload */
+  EVENT_HDR_IDLE_T_AT_SETUP,          /* No payload */
+  EVENT_HDR_IDLE_T_SUSPEND,           /* No payload */
+  EVENT_HDR_IDLE_CONNECTION_DENIED,   /* No payload */
+  EVENT_HDR_INIT_T_SYNC_ACQ,          /* No payload */
+  EVENT_HDR_INIT_PROTOCOL_MISMATCH,   /* No payload */
+  EVENT_HDR_OVHD_INFO_CURRENT,        /* No payload */
+  EVENT_HDR_OVHD_T_QC_SUPERVISION,    /* No payload */
+  EVENT_HDR_OVHD_T_SP_SUPERVISION,    /* No payload */
+  EVENT_HDR_OVHD_T_AP_SUPERVISION,    /* No payload */
+  EVENT_HDR_OVHD_IGNORED_MSG_UNEXPECTED_LINK, /* msg, exp_link.chan_num,
+                                              exp_link.pilot, rx_link.chan_num,
+                                              rx_link.pilot - 10 bytes */
+  EVENT_HDR_OVHD_IGNORED_SP_MSG_DIFF_SEC_SIG, /* exp_sig, rx_sig - 8 bytes */
+  EVENT_HDR_OVHD_IGNORED_AP_MSG_DIFF_ACC_SIG, /* exp_sig, rx_sig - 8 bytes */
+  EVENT_HDR_OVHD_IGNORED_SP_MSG_DIFF_SEC_ID,  /* No payload */
+  EVENT_HDR_OVHD_SP_MSG_RX,           /* No payload */
+  EVENT_HDR_OVHD_AP_MSG_RX,           /* No payload */
+  EVENT_HDR_RUP_T_CONNECTION_SETUP,   /* No payload */
+  EVENT_HDR_SLP_MAX_RETRIES,          /* msg - 2 bytes */
+  EVENT_HDR_LMAC_ACQ_FAIL_PILOT,      /* No payload */
+  EVENT_HDR_LMAC_ACQ_SUCCESS,         /* No payload */
+  EVENT_HDR_LMAC_NETWORK_LOST,        /* No payload */
+  EVENT_HDR_LMAC_IDLE_HO,             /* new_pilot - 2 bytes */
+  EVENT_HDR_LMAC_CHAN_CHANGE_COMPLETE, /* No payload */
+  EVENT_HDR_LMAC_ACCESS_HO_NEEDED,    /* suggested_pilot - 2 bytes */
+  EVENT_HDR_LMAC_ACCESS_HO_COMPLETE,  /* new_pilot - 2 bytes */
+  EVENT_HDR_LMAC_ACQUIRE,             /* channel 2 bytes */
+  EVENT_HDR_LMAC_CHANGING_CC_HASH,    /* cc_hash - 1 byte */
+  EVENT_HDR_LMAC_IDLE_CHAN_CHANGE,    /* channel - 2 bytes */
+  EVENT_HDR_CMAC_T_SUPERVISION,       /* No payload */
+  EVENT_HDR_AMAC_START_ACCESS,        /* No payload */
+  EVENT_HDR_AMAC_PROBING_STOPPED,     /* No payload */
+  EVENT_HDR_AMAC_ACCESS_COMPLETE,     /* No payload */
+  EVENT_HDR_AMAC_ACCESS_ABORTED,      /* No payload */
+  EVENT_HDR_AMAC_MAX_PROBES,          /* No payload */
+  EVENT_HDR_FMAC_DROP_PKT,            /* No payload */
+  EVENT_HDR_RMAC_T_RATE_LIMIT,        /* No payload */
+  EVENT_HDR_RMAC_TX_STARTED,          /* No payload */
+  EVENT_HDR_RMAC_TX_STOPPED,          /* No payload */
+  EVENT_HDR_SMP_T_KEEP_ALIVE,         /* No payload */
+  EVENT_HDR_AMP_ASSIGN_MSG_IGNORED_FRESH, /* No payload */
+  EVENT_HDR_AMP_T_AT_RESPONSE,        /* No payload */
+  EVENT_HDR_AMP_T_DUAL_ADDRESS,       /* No payload */
+  EVENT_HDR_SCP_BEGIN_CONFIGURATION,  /* No payload */
+  EVENT_HDR_SCP_T_CONFIG_RSP,         /* No payload */
+  EVENT_HDR_SCP_T_AN_INIT_STATE,      /* No payload */
+
+  EVENT_WCDMA_L1_STATE,               /* l1_state - 1 byte */
+  EVENT_WCDMA_IMSI,                   /* IMSI - 9 bytes */
+  EVENT_GSM_L1_STATE,                 /* GSM l1_state - 1 byte */
+  EVENT_RANDOM_ACCESS_REQUEST,        /* GSM Random Access Request - 4 bytes */
+  EVENT_HIGH_LEVEL_CALL_PROCESSING_STATE_CHANGE, /* Puma requested event */
+                                                 /* (same payload as CALL_PROCESSING_STATE_CHANGE) */
+  EVENT_ENCRYPTION_FAILURE,                  /* Puma event, no payload */
+  EVENT_ACCT_BLOCKED,                        /* Puma event, no payload */
+  EVENT_COMMON_CHANNEL_MONITORED,            /* Puma event, 1 byte payload */
+  EVENT_SOFT_HANDOFF_V2,                     /* Puma event, 14 byte payload */
+  EVENT_HARD_HANDOFF_FREQ_CHANGE_V2,         /* Puma event, 14 byte payload */
+  EVENT_HARD_HANDOFF_FRAME_OFFSET_CHANGE_V2, /* Puma event, 14 byte payload */
+  EVENT_HARD_HANDOFF_DISJOINT_ASET_V2,       /* Puma event, 14 byte payload */
+  EVENT_WCDMA_NEW_REFERENCE_CELL,
+  EVENT_CALL_CONTROL_CONREF_CHANGE,          /* Puma event, 2 byte payload */
+
+  EVENT_GPS_SESSION_BEGIN,
+  EVENT_GPS_SESSION_END,
+  EVENT_GPS_WAITING_ON_SA,
+  EVENT_GPS_PPM_START,
+  EVENT_GPS_PPM_RESULTS,
+  EVENT_GPS_PPM_END,
+  EVENT_GPS_VISIT_BEGIN,
+  EVENT_GPS_VISIT_END,
+  EVENT_GPS_CDMA_RESUMED_AFTER_GPS_VISIT,
+  EVENT_GPS_PD_SESSION_BEGIN,
+  EVENT_GPS_PD_SESSION_END,                  /* Payload: 1 byte PDSM substate */
+  EVENT_GPS_IS801_RX,                        /* Payload, 1 byte msg_type */
+  EVENT_GPS_IS801_TX,                        /* Payload: 1 byte msg_type */
+  EVENT_POWERUP,
+  EVENT_WCDMA_ASET,
+  EVENT_CM_CALL_STATE,                       /* (1 byte payload: overall call state) */
+  EVENT_CM_OPERATIONAL_MODE,                 /* (1 byte payload: op mode) */
+  EVENT_CM_SYSTEM_MODE,                      /* (1 byte payload: sys_mode) */
+
+  EVENT_DEEP_SLEEP,                          /* no payload */
+  EVENT_WAKEUP,                              /* unsigned long (4 bytes) payload */
+  EVENT_ACQUISITION_MODE,                    /* unsigned char (1 byte) payload */
+  EVENT_ACQUISITION_TYPE,                    /* unsigned char (1 byte) payload */
+  EVENT_ACP_EXIT,                            /* unsigned char (1 byte) payload */
+  EVENT_CDMA_EXIT,                           /* unsigned char (1 byte) payload */
+
+  EVENT_HDR_HYBRID_POWER_SAVE,               /* No payload */
+  EVENT_HDR_DEEP_SLEEP,                      /* No payload */
+  EVENT_HDR_RESELECTION,                     /* No payload */
+  EVENT_SAM_LOCK_GRANTED,                    /* <NewOwner (1 byte) <Duration (2 bytes) */
+  EVENT_SAM_LOCK_RELEASED,                   /* <OldOwner (1 byte) */
+
+  EVENT_GSM_HANDOVER_START,
+  EVENT_GSM_HANDOVER_END,
+  EVENT_GSM_LINK_FAILURE,
+  EVENT_GSM_RESELECT_START,
+  EVENT_GSM_RESELECT_END,
+  EVENT_GSM_CAMP_ATTEMPT_START,
+  EVENT_GSM_RR_IN_SERVICE,
+  EVENT_GSM_RR_OUT_OF_SERVICE,
+  EVENT_GSM_PAGE_RECEIVED,
+  EVENT_GSM_CAMP_ATTEMPT_END,
+  EVENT_GPS_IS801_TIMEOUT,
+  EVENT_GPS_IS801_DISCARD,                   /* Payload: 1 byte msg type */
+  EVENT_GSM_CELL_SELECTION_START,            /* Payload: 1 byte cell_selection_reason */
+  EVENT_GSM_CELL_SELECTION_END,              /* Payload: 1 byte end_status success/failure reason */
+  EVENT_GSM_POWER_SCAN_STATUS,               /* Payload: 1 byte status (started or completed) */
+  EVENT_GSM_PLMN_LIST_START,                 /* Payload: 1 byte */
+  EVENT_GSM_PLMN_LIST_END,
+  EVENT_WCDMA_INTER_RAT_HANDOVER_START,      /* Payload: 4 bytes handover type, BCCH ARFCN, BSIC */
+  EVENT_WCDMA_INTER_RAT_HANDOVER_END,        /* Payload: 2 bytes success, failure reason */
+
+  EVENT_GSM_MESSAGE_SENT,                    /* Payload: 2 bytes indicating identity of the message */
+  EVENT_GSM_MESSAGE_RECEIVED,                /* Payload: 2 bytes indicating identity of the message */
+  EVENT_GSM_TIMER_EXPIRED,                   /* Payload: 2 bytes indicating identity of the message */
+  EVENT_GSM_COUNTER_EXPIRED,                 /* Payload: 2 bytes indicating identity of the message */
+
+  EVENT_NAS_MESSAGE_SENT,
+  EVENT_NAS_MESSAGE_RECEIVED,
+  EVENT_RRC_MESSAGE_SENT,
+  EVENT_RRC_MESSAGE_RECEIVED,
+                                    /* Camera events: No Payload */
+  EVENT_CAMERA_CANNOT_CAPTURE,      /* Cannot capture, transition to ready */
+  EVENT_CAMERA_CANNOT_CONFIG_JPEG,  /* Cannot config JPEG, transition to ready */
+  EVENT_CAMERA_CANNOT_CONFIG_VFE,   /* Cannot config VFE, transition to ready */
+  EVENT_CAMERA_CANNOT_ENCODE,       /* Cannot encode, transition to ready */
+  EVENT_CAMERA_CANNOT_IDLE_DSP,     /* Cannot idle DSP, transition to ready */
+  EVENT_CAMERA_CANNOT_LOAD_DSP,     /* Cannot load DSP, transition to ready */
+  EVENT_CAMERA_DSP_FATAL,           /* DSP fatal error, transition to ready */
+  EVENT_CAMERA_DSP_REQ_ILLEGAL,     /* DSP request illegal, transition to ready */
+  EVENT_CAMERA_EFS_FAILED,          /* EFS failed, transition to ready */
+  EVENT_CAMERA_EXIT,                /* Stop, transition to ready */
+  EVENT_CAMERA_FORMAT_NOT_SUPPORTED,/* Format not supported */
+  EVENT_CAMERA_FUNCTION_REJECTED,   /* Function rejected, transition to ready */
+  EVENT_CAMERA_IMAGE_CORRUPT,       /* Image corrupted, reconfig */
+  EVENT_CAMERA_INVALID_CONFIG_PARM, /* Invalid config parm, to ready */
+  EVENT_CAMERA_INVALID_SET_ID,      /* Invalid set param ID type */
+  EVENT_CAMERA_INVALID_STATE,       /* Invalid state */
+  EVENT_CAMERA_JPEG_ENCODED,        /* JPEG encoded */
+  EVENT_CAMERA_NO_MEMORY,           /* No memory, transition to ready */
+  EVENT_CAMERA_NO_PICTURE,          /* Picture not ready */
+  EVENT_CAMERA_PICTURE_SAVED,       /* Picture saved, transition to ready */
+  EVENT_CAMERA_PICTURE_TAKEN,       /* Picture taken, transition to ready */
+  EVENT_CAMERA_PREVIEW,             /* Enter preview */
+  EVENT_CAMERA_RECORD,              /* Enter recording */
+  EVENT_CAMERA_SAVE_PICTURE,        /* Enter save picture */
+  EVENT_CAMERA_SET_FAILED,          /* Set failed */
+  EVENT_CAMERA_SET_SUCCEEDED,       /* Set succeeded */
+  EVENT_CAMERA_START,               /* Start, transition to ready */
+  EVENT_CAMERA_STOP,                /* Stop, transition to init */
+  EVENT_CAMERA_TAKE_PICTURE,        /* Enter take picture */
+
+  EVENT_DIAG_STRESS_TEST_NO_PAYLOAD,
+  EVENT_DIAG_STRESS_TEST_WITH_PAYLOAD,
+
+  EVENT_CM_CALL_ORIG_START_P1,      /* Payload: 5 single bytes */
+  EVENT_CM_CALL_ORIG_START_P2,      /* Payload: 3 single bytes */
+  EVENT_CM_CALL_ORIG_START_P3,      /* Payload: 3 single bytes */
+  EVENT_CM_CALL_ORIG_SWITCH_TO_HDR, /* No payload */
+  EVENT_CM_CALL_ORIG_REDIAL,        /* Payload: 4 bytes */
+  EVENT_CM_CALL_ORIG_SEND_HDR_ORIG, /* No payload */
+  EVENT_CM_CALL_ORIG_SEND_MC_ORIG,  /* No payload */
+  EVENT_CM_CALL_ORIG_END,           /* Payload: 2 bytes */
+  EVENT_CM_CALL_ORIG_CONNECTED,     /* Payload: 3 bytes */
+
+  EVENT_MT_SMS_NOTIFY,              /* Payload: 1 byte mem_type, 4 byte msg_index */
+  EVENT_SMS_SLOT_WAKEUP,            /* Payload: 1 byte slot_mask */
+  EVENT_MO_SMS_STATUS,              /* Payload: 4 byte transaction_id, 1 byte mem_type,
+                                                4 byte msg_index, 1 byte report_status, 
+                                                1 byte case_code */
+  EVENT_GPRS_SURROUND_SEARCH_START,
+  EVENT_GPRS_SURROUND_SEARCH_END,
+  EVENT_GPRS_MAC_RESELECT_IND,
+  EVENT_GPRS_PAGE_RECEIVED,
+  EVENT_GPRS_LINK_FAILURE,
+  EVENT_GPRS_CELL_UPDATE_START,
+  EVENT_GPRS_CELL_UPDATE_END,
+  EVENT_GPRS_EARLY_CAMPING,
+  EVENT_PACKET_RANDOM_ACCESS_REQ,
+  EVENT_GPRS_MAC_MSG_SENT,          /* Payload: 3 bytes giving message identity and channel */
+  EVENT_GPRS_MAC_MSG_RECEIVED,      /* Payload: 3 bytes giving message identity and channel */
+  EVENT_GPRS_SMGMM_MSG_SENT,        /* Payload: 3 bytes giving message identity and channel */
+  EVENT_GPRS_SMGMM_MSG_RECEIVED,    /* Payload: 3 bytes giving message identity and channel */
+
+  EVENT_CP_MATCHED_MSG,             /* Payload: 1 byte */
+  EVENT_PREF_SYS_RESEL,             /* Payload: none */ 
+
+  EVENT_WCDMA_LAYER1_PRACH,         /* Payload: 4 bytes */
+  EVENT_WCDMA_LAYER1_MEASUREMENT,   /* Payload: Unspecified */
+
+  EVENT_MOBILITY_MANAGEMENT_STATE_CHANGE, /* Payload: 1 byte old state, 1 byte new state */
+
+  EVENT_LSM_STATE_CHANGE,           /* Payload: 1 byte */
+  EVENT_RLP,                        /* Payload: 2 bytes */
+
+  EVENT_CM_MODE_PREF,               /* Payload: 4 bytes */
+  EVENT_CM_BAND_PREF,               /* Payload: 4 bytes */
+  EVENT_CM_ROAM_PREF,               /* Payload: 4 bytes */
+  EVENT_CM_SRV_DOMAIN_PREF,         /* Payload: 4 bytes */
+  EVENT_CM_GW_ACQ_ORDER_PREF,       /* Payload: 4 bytes */
+  EVENT_CM_HYBRID_PREF,             /* Payload: 4 bytes */
+  EVENT_CM_NETWORK_SEL_MODE_PREF,   /* Payload: 4 bytes */
+
+  EVENT_WCDMA_L1_SUSPEND,                 /* Payload: 3 bytes */
+  EVENT_WCDMA_L1_RESUME,                  /* Payload: 5 bytes */
+  EVENT_WCDMA_L1_STOPPED,                 /* Payload: 4 bytes */
+  EVENT_WCDMA_TO_WCDMA_RESELECTION_START, /* Payload: 6 bytes */
+  EVENT_WCDMA_TO_GSM_RESELECTION_START,   /* Payload: 4 bytes */
+  EVENT_WCDMA_TO_GSM_RESELECTION_END,     /* Payload: 2 bytes */
+  EVENT_WCDMA_TO_WCDMA_RESELECTION_END,   /* Payload: 4 bytes */
+  EVENT_WCDMA_RACH_ATTEMPT,               /* Payload: 3 bytes */
+
+  EVENT_START_FWD_SUPP_BURST_ASSIGN,      /* Payload: 3 bytes */
+  EVENT_START_REV_SUPP_BURST_ASSIGN,      /* Payload: 3 bytes */
+  EVENT_REV_FCH_GATING_IN_USE,            /* Payload: 1 byte  */
+  EVENT_PPP,                              /* Payload: 7 bytes */
+  EVENT_MIP,                              /* Payload: 2 bytes */
+  EVENT_TCP,                              /* Payload: 5 bytes */
+  EVENT_CAMERA_EXIF_FAILED,               /* EXIF encoding failed */
+  EVENT_CAMERA_VIDEO_FAILED,              /* Video encoding failed */
+  EVENT_CAMERA_NO_SENSOR,                 /* No sensor */
+  EVENT_CAMERA_ABORT,                     /* Operation aborted */
+
+  EVENT_CM_BLOCK_HDR_ORIG_DURING_GPS,     /* No payload */
+  EVENT_CM_ALLOW_HDR_ORIG_DURING_GPS,     /* No payload */
+
+  EVENT_GSM_AMR_STATE_CHANGE,             /* 2 bytes payload */
+  EVENT_GSM_RATSCCH_IN_DTX,               /* No Payload */
+  EVENT_GSM_FACCH_IN_DTX,                 /* No Payload */
+  EVENT_GSM_FACCH_AND_RATSCCH_COLLISION,  /* No Payload */
+  EVENT_GSM_FACCH_AND_SID_UPDATE_COLLISION,  /* No Payload */
+  EVENT_GSM_RATSCCH_AND_SID_UPDATE_COLLISION,/* No Payload */
+  EVENT_GSM_RATSCCH_CMI_PHASE_CHANGE,     /* 2 bytes payload */
+  EVENT_GSM_RATSCCH_REQ_ACT_TIMER_EXPIRY, /* 8 bytes payload */
+  EVENT_GSM_RATSCCH_ACK_ACT_TIMER_EXPIRY, /* 2 bytes payload */
+  EVENT_GSM_AMR_CMC_TURNAROUND_TIME,      /* 2 bytes payload */
+  EVENT_CM_PLMN_FOUND,                    /* 12 bytes */
+  EVENT_CM_SERVICE_CONFIRMED,             /* 12 bytes */
+
+  EVENT_GPRS_MAC_CAMPED_ON_CELL,          /* Event Id : 559, No payload */
+  EVENT_GPRS_LLC_READY_TIMER_START,       /* Event Id : 560, No payload */
+  EVENT_GPRS_LLC_READY_TIMER_END,         /* Event Id : 561, No payload */
+
+  EVENT_WCDMA_PHYCHAN_ESTABLISHED,        /* Payload TBD */
+  EVENT_HS_DISPLAY_BMP_CAPTURE_STATUS,    /* Payload 4 bytes */
+
+  EVENT_WCDMA_CELL_SELECTED,              /* 4 byte Payload */
+  EVENT_WCDMA_PAGE_RECEIVED,              /* 2 byte Payload */
+  EVENT_WCDMA_SEND_KEY,                   /* Payload TBD */
+  EVENT_WCDMA_RL_FAILURE,                 /* No Payload */
+  EVENT_WCDMA_MAX_RESET,                  /* 2 byte Payload */
+  EVENT_WCDMA_CALL_SETUP,                 /* Payload TBD */
+  EVENT_WCDMA_CALL_DROPPED,               /* Payload TBD */
+  EVENT_WCDMA_RRC_STATE,                  /* 3 byte Payload */
+  EVENT_GPS_PD_CONNECTION_TIMEOUT,        /* No Payload */
+  EVENT_GPS_PD_DISCONNECTION_COMPLETE,    /* No Payload */
+
+  EVENT_MEDIA_PLAYER_START,               /* media player starts playing a clip, no payload */
+  EVENT_MEDIA_PLAYER_STOP,                /* media player stopped playing a clip, no payload */
+  EVENT_MEDIA_PLAYER_SEEK,                /* media player repositioned itself, no payload */
+
+  EVENT_GPS_SRCH_START,             /* Payload: session_type (1 byte) */
+
+  EVENT_GPS_SRCH_END,               /* No Payload */
+  EVENT_GPS_PPM_PAUSE,              /* Payload: pause_reason (1 byte) */
+  EVENT_GPS_PPM_RESUME,             /* No Payload */
+  EVENT_GPS_SA_RECEIVED,            /* Payload: REF_BIT_NUM (2 bytes), 
+                                                DR_SIZE     (1byte) 
+                                    */
+  EVENT_GPS_CLK_ON,                 /* No Payload */
+  EVENT_GPS_CLK_OFF,                /* No Payload */
+  EVENT_GPS_VISIT_REQUEST,          /* No Payload */ 
+  EVENT_GPS_VISIT_RESPONSE,         /* Payload: response_result (1 byte)
+                                    */ 
+  EVENT_GPS_TA_START,               /* No Payload */
+  EVENT_GPS_DSP_READY,              /* No Payload */
+  EVENT_GPS_DSP_CHANNEL_START,      /* Payload: SV_ID         (1 byte), 
+                                                SRCH_MODE     (1 byte), 
+                                                CHANNEL_NUM   (1 byte),
+                                                RESERVED      (1 byte)
+                                    */
+  EVENT_GPS_DSP_CHANNEL_DONE,       /* Payload: channel_num (1 byte) */
+  EVENT_GPS_DSP_STOP,               /* No Payload */
+  EVENT_GPS_DSP_DONE,               /* No Payload */
+  EVENT_GPS_TB_END,                 /* No Payload */
+  EVENT_GPS_SRCH_LARGE_DOPP_WIN,    /* Payload: sv_prn_num (1 byte),
+                                                srch_mode (1 byte),
+                                                dopp_wind (2 byte)
+                                    */ 
+  EVENT_GPS_SRCH_EXCEPTION,         /* Payload: grid_log_id (2 byte),
+                                                exception_type (1 byte)
+                                    */
+  EVENT_GPS_SRCH_HW_POLLING1,       /* Payload: agc_val (2 byte),
+                                                dci_off (2 byte),
+                                                dcq_off (2 byte),
+                                                trk_lo (2 byte),
+                                                lo_bias (2 byte)
+                                    */
+
+  EVENT_GPS_SRCH_HW_POLLING2,       /* Payload: sync80 (2 byte)
+                                    */
+  EVENT_GPS_PGI_ACTION_PROCESS,     /* Payload: pgi_substate (1 byte),
+                                                pgi_cmd (1 byte)
+                                    */
+  EVENT_GPS_GSC_ACTION_PROCESS,     /* Payload: gsc_substate (1 byte),
+                                                gsc_cmd (1 byte)
+                                    */
+  EVENT_GPS_PGI_ABORT,              /* Payload: pgi_subsate (1 byte) */
+  EVENT_GPS_GSC_ABORT,              /* Payload: gsc_subsate (1 byte) */
+
+
+
+  EVENT_GPS_PD_FIX_START,                /* Payload: event_log_cnt  (2 byte), 
+                                                operation_mode (1 byte)
+                                         */
+  EVENT_GPS_PD_FIX_END,                  /* Payload: end_status     (1 byte)  */
+  EVENT_GPS_DATA_DOWNLOAD_START,         /* Payload: data_type   (1 byte),
+                                                     sv_mask     (4 byte)     */
+  EVENT_GPS_DATA_DOWNLOAD_END,           /* Payload: end_status      (1 byte) */
+  EVENT_GPS_PD_SESSION_START,            /* Payload: start_source    (4 bit)
+                                                     operation_mode  (4 bit)
+                                                     session_type    (4 bit)
+                                                     privacy         (4 bit)
+                                                     num_fixed       (2 byte)
+                                                     fix_period      (2 byte)
+                                                     nav_data_dl     (4 bit)
+                                                     prq             (1 byte)
+                                                     threshold       (2 byte)
+                                                     transport_type  (4 bit)  */
+  EVENT_GPS_DORMANCY_BEGIN,               /* No Payload */
+  EVENT_GPS_DORMANCY_END,                 /* No Payload */
+  EVENT_GPS_PRQ_TIMEOUT,                  /* No Payload */
+  EVENT_GPS_PD_CONNECTION_START,          /* No Payload */
+  EVENT_GPS_PD_CONNECTION_ESTABLISHED,    /* No Payload */
+  EVENT_GPS_PD_DISCONNECTION_START,       /* No Payload */
+  EVENT_GPS_FTEST_FIX_START,              /* Payload: reserved (4 byte) */
+  EVENT_GPS_FTEST_FIX_END,                /* Payload: reserved (4 byte) */
+  EVENT_GPS_PD_POSITION,                  /* No Payload */
+  EVENT_GPS_E911_START,                   /* No Payload */
+  EVENT_GPS_E911_END,                     /* No Payload */
+  EVENT_GPS_DBM_SEND_FAILURE,             /* No Payload */
+  EVENT_GPS_UAPDMS_STATE_CHANGE,          /* Payload: new_state (1 byte)
+                                                      reason    (1 byte) */
+  EVENT_WCDMA_OUT_OF_SERVICE,             /* No Payload */
+  EVENT_GSM_L1_SUBSTATE,                  /* 2 bytes payload */
+  EVENT_SD_EVENT_ACTION,                  /* 8 byte payload */
+  EVENT_SD_EVENT_ACTION_HYBR,             /* 8 byte payload */
+
+  EVENT_UMTS_CALLS_STATISTICS,            /* 1 byte payload */
+  EVENT_PZID_HAT_STARTED,                 /* No payload */
+  EVENT_WCDMA_DRX_CYCLE,                  /* 3 byte payload */
+  EVENT_WCDMA_RE_ACQUISITION_FAIL,        /* No payload */
+  EVENT_WCDMA_RRC_RB0_SETUP_FAILURE,      /* No payload */
+  EVENT_WCDMA_RRC_PHYCHAN_EST_FAILURE,    /* No payload */
+  EVENT_CM_CALL_EVENT_ORIG,               /* 3 byte payload */
+  EVENT_CM_CALL_EVENT_CONNECT,            /* 3 byte payload */
+  EVENT_CM_CALL_EVENT_END,                /* 2 byte payload */
+  EVENT_CM_ENTER_EMERGENCY_CB,            /* No payload */
+  EVENT_CM_EXIT_EMERGENCY_CB,             /* No payload */
+  EVENT_PZID_HAT_EXPIRED,                 /* No payload */
+  EVENT_HDR_SMP_SESSION_CLOSED,           /* 1 byte payload */
+  EVENT_WCDMA_MEMORY_LEAK,                /* No payload */
+  EVENT_PZID_HT_STARTED,                  /* 1 byte payload */
+  EVENT_PZID_HT_EXPIRED,                  /* 1 byte payload */
+  EVENT_ACCESS_ENTRY_HANDOFF,             /* 2 byte payload */
+
+  EVENT_BREW_APP_START,                   /* 8 byte payload */
+  EVENT_BREW_APP_STOP,                    /* 8 byte payload */
+  EVENT_BREW_APP_PAUSE,                   /* 8 byte payload */
+  EVENT_BREW_APP_RESUME,                  /* 8 byte payload */
+  EVENT_BREW_EXT_MODULE_START,            /* 8 byte payload */
+  EVENT_BREW_EXT_MODULE_STOP,             /* 8 byte payload */
+  EVENT_BREW_ERROR,                       /* 8 byte payload */
+  EVENT_BREW_RESERVED_647,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_648,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_649,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_650,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_651,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_652,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_653,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_654,                /* BREW internal use only */
+  EVENT_BREW_RESERVED_655,                /* BREW internal use only */
+  EVENT_BREW_USER_656,                    /* Start of BREW user events */
+  EVENT_BREW_GENERIC,                     /* 8 byte payload: clsid + data */
+  EVENT_BREW_MEDIAPLAYER_SELECT_FILE,     /* no payload */
+  EVENT_BREW_MEDIAPLAYER_CONTROL,         /* no payload */
+  EVENT_BREW_APP_FORMITEM_STACK_CHANGE,   /* 1 byte payload */
+  EVENT_BREW_CATAPP_RECV_PROACTIVE_CMD,   /* No payload */
+  EVENT_BREW_CATAPP_TERMINAL_RSP,         /* No payload */
+  EVENT_BREW_CATAPP_NO_DISPLAY,           /* No payload */
+  EVENT_BREW_SIRIUS_EMAIL_DELETE,                  /* No payload */
+  EVENT_BREW_SIRIUS_EMAIL_OPERATION_COMPLETE,      /* 8 byte payload */
+  EVENT_BREW_SIRIUS_EMAIL_NEW_EMAIL_NOTIFICATION,  /* No payload */
+  EVENT_BREW_UNDEFINED_667,
+  EVENT_BREW_UNDEFINED_668,
+  EVENT_BREW_UNDEFINED_669,
+  EVENT_BREW_UNDEFINED_670,
+  EVENT_BREW_UNDEFINED_671,
+  EVENT_BREW_UNDEFINED_672,
+  EVENT_BREW_UNDEFINED_673,
+  EVENT_BREW_UNDEFINED_674,
+  EVENT_BREW_UNDEFINED_675,
+  EVENT_BREW_UNDEFINED_676,
+  EVENT_BREW_UNDEFINED_677,
+  EVENT_BREW_UNDEFINED_678,
+  EVENT_BREW_UNDEFINED_679,
+  EVENT_BREW_UNDEFINED_680,
+  EVENT_BREW_UNDEFINED_681,
+  EVENT_BREW_UNDEFINED_682,
+  EVENT_BREW_UNDEFINED_683,
+  EVENT_BREW_UNDEFINED_684,
+  EVENT_BREW_UNDEFINED_685,
+  EVENT_BREW_UNDEFINED_686,
+  EVENT_BREW_UNDEFINED_687,
+  EVENT_BREW_UNDEFINED_688,
+  EVENT_BREW_UNDEFINED_689,
+  EVENT_BREW_UNDEFINED_690,
+  EVENT_BREW_UNDEFINED_691,
+  EVENT_BREW_UNDEFINED_692,
+  EVENT_BREW_UNDEFINED_693,
+  EVENT_BREW_UNDEFINED_694,
+  EVENT_BREW_UNDEFINED_695,
+  EVENT_BREW_UNDEFINED_696,
+  EVENT_BREW_UNDEFINED_697,
+  EVENT_BREW_UNDEFINED_698,
+  EVENT_BREW_UNDEFINED_699,
+  EVENT_BREW_UNDEFINED_700,
+  EVENT_BREW_UNDEFINED_701,
+  EVENT_BREW_UNDEFINED_702,
+  EVENT_BREW_UNDEFINED_703,
+  EVENT_BREW_UNDEFINED_704,
+  EVENT_BREW_UNDEFINED_705,
+  EVENT_BREW_UNDEFINED_706,
+  EVENT_BREW_UNDEFINED_707,
+  EVENT_BREW_UNDEFINED_708,
+  EVENT_BREW_UNDEFINED_709,
+  EVENT_BREW_UNDEFINED_710,
+  EVENT_BREW_UNDEFINED_711,
+  EVENT_BREW_UNDEFINED_712,
+  EVENT_BREW_UNDEFINED_713,
+  EVENT_BREW_UNDEFINED_714,
+  EVENT_BREW_UNDEFINED_715,
+  EVENT_BREW_UNDEFINED_716,
+  EVENT_BREW_UNDEFINED_717,
+  EVENT_BREW_UNDEFINED_718,
+  EVENT_BREW_UNDEFINED_719,
+  EVENT_BREW_UNDEFINED_720,
+  EVENT_BREW_UNDEFINED_721,
+  EVENT_BREW_UNDEFINED_722,
+  EVENT_BREW_UNDEFINED_723,
+  EVENT_BREW_UNDEFINED_724,
+  EVENT_BREW_UNDEFINED_725,
+  EVENT_BREW_UNDEFINED_726,
+  EVENT_BREW_UNDEFINED_727,
+  EVENT_BREW_UNDEFINED_728,
+  EVENT_BREW_UNDEFINED_729,
+  EVENT_BREW_UNDEFINED_730,
+  EVENT_BREW_UNDEFINED_731,
+  EVENT_BREW_UNDEFINED_732,
+  EVENT_BREW_UNDEFINED_733,
+  EVENT_BREW_UNDEFINED_734,
+  EVENT_BREW_UNDEFINED_735,
+  EVENT_BREW_UNDEFINED_736,
+  EVENT_BREW_UNDEFINED_737,
+  EVENT_BREW_UNDEFINED_738,
+  EVENT_BREW_UNDEFINED_739,
+  EVENT_BREW_UNDEFINED_740,
+  EVENT_BREW_UNDEFINED_741,
+  EVENT_BREW_UNDEFINED_742,
+  EVENT_BREW_UNDEFINED_743,
+  EVENT_BREW_UNDEFINED_744,
+  EVENT_BREW_UNDEFINED_745,
+  EVENT_BREW_UNDEFINED_746,
+  EVENT_BREW_UNDEFINED_747,
+  EVENT_BREW_UNDEFINED_748,
+  EVENT_BREW_UNDEFINED_749,
+  EVENT_BREW_UNDEFINED_750,
+  EVENT_BREW_UNDEFINED_751,
+  EVENT_BREW_UNDEFINED_752,
+  EVENT_BREW_UNDEFINED_753,
+  EVENT_BREW_UNDEFINED_754,
+  EVENT_BREW_UNDEFINED_755,
+  EVENT_BREW_UNDEFINED_756,
+  EVENT_BREW_UNDEFINED_757,
+  EVENT_BREW_UNDEFINED_758,
+  EVENT_BREW_UNDEFINED_759,
+  EVENT_BREW_UNDEFINED_760,
+  EVENT_BREW_UNDEFINED_761,
+  EVENT_BREW_UNDEFINED_762,
+  EVENT_BREW_UNDEFINED_763,
+  EVENT_BREW_UNDEFINED_764,
+  EVENT_BREW_UNDEFINED_765,
+  EVENT_BREW_UNDEFINED_766,
+  EVENT_BREW_UNDEFINED_767,
+  EVENT_BREW_UNDEFINED_768,
+  EVENT_BREW_UNDEFINED_769,
+  EVENT_BREW_UNDEFINED_770,
+  EVENT_BREW_UNDEFINED_771,
+  EVENT_BREW_UNDEFINED_772,
+  EVENT_BREW_UNDEFINED_773,
+  EVENT_BREW_UNDEFINED_774,
+  EVENT_BREW_UNDEFINED_775,
+  EVENT_BREW_UNDEFINED_776,
+  EVENT_BREW_UNDEFINED_777,
+  EVENT_BREW_UNDEFINED_778,
+  EVENT_BREW_UNDEFINED_779,
+  EVENT_BREW_UNDEFINED_780,
+  EVENT_BREW_UNDEFINED_781,
+  EVENT_BREW_UNDEFINED_782,
+  EVENT_BREW_UNDEFINED_783,
+  EVENT_BREW_UNDEFINED_784,
+  EVENT_BREW_UNDEFINED_785,
+  EVENT_BREW_UNDEFINED_786,
+  EVENT_BREW_UNDEFINED_787,
+  EVENT_BREW_UNDEFINED_788,
+  EVENT_BREW_UNDEFINED_789,
+  EVENT_BREW_UNDEFINED_790,
+  EVENT_BREW_UNDEFINED_791,
+  EVENT_BREW_UNDEFINED_792,
+  EVENT_BREW_UNDEFINED_793,
+  EVENT_BREW_UNDEFINED_794,
+  EVENT_BREW_UNDEFINED_795,
+  EVENT_BREW_UNDEFINED_796,
+  EVENT_BREW_UNDEFINED_797,
+  EVENT_BREW_UNDEFINED_798,
+  EVENT_BREW_UNDEFINED_799,
+  EVENT_BREW_UNDEFINED_800,
+  EVENT_BREW_UNDEFINED_801,
+  EVENT_BREW_UNDEFINED_802,
+  EVENT_BREW_UNDEFINED_803,
+  EVENT_BREW_UNDEFINED_804,
+  EVENT_BREW_UNDEFINED_805,
+  EVENT_BREW_UNDEFINED_806,
+  EVENT_BREW_UNDEFINED_807,
+  EVENT_BREW_UNDEFINED_808,
+  EVENT_BREW_UNDEFINED_809,
+  EVENT_BREW_UNDEFINED_810,
+  EVENT_BREW_UNDEFINED_811,
+  EVENT_BREW_UNDEFINED_812,
+  EVENT_BREW_UNDEFINED_813,
+  EVENT_BREW_UNDEFINED_814,
+  EVENT_BREW_UNDEFINED_815,
+  EVENT_BREW_UNDEFINED_816,
+  EVENT_BREW_UNDEFINED_817,
+  EVENT_BREW_UNDEFINED_818,
+  EVENT_BREW_UNDEFINED_819,
+  EVENT_BREW_UNDEFINED_820,
+  EVENT_BREW_UNDEFINED_821,
+  EVENT_BREW_UNDEFINED_822,
+  EVENT_BREW_UNDEFINED_823,
+  EVENT_BREW_UNDEFINED_824,
+  EVENT_BREW_UNDEFINED_825,
+  EVENT_BREW_UNDEFINED_826,
+  EVENT_BREW_UNDEFINED_827,
+  EVENT_BREW_UNDEFINED_828,
+  EVENT_BREW_UNDEFINED_829,
+  EVENT_BREW_UNDEFINED_830,
+  EVENT_BREW_UNDEFINED_831,
+  EVENT_BREW_UNDEFINED_832,
+  EVENT_BREW_UNDEFINED_833,
+  EVENT_BREW_UNDEFINED_834,
+  EVENT_BREW_UNDEFINED_835,
+  EVENT_BREW_UNDEFINED_836,
+  EVENT_BREW_UNDEFINED_837,
+  EVENT_BREW_UNDEFINED_838,
+  EVENT_BREW_UNDEFINED_839,
+  EVENT_BREW_UNDEFINED_840,
+  EVENT_BREW_UNDEFINED_841,
+  EVENT_BREW_UNDEFINED_842,
+  EVENT_BREW_UNDEFINED_843,
+  EVENT_BREW_UNDEFINED_844,
+  EVENT_BREW_UNDEFINED_845,
+  EVENT_BREW_UNDEFINED_846,
+  EVENT_BREW_UNDEFINED_847,
+  EVENT_BREW_UNDEFINED_848,
+  EVENT_BREW_UNDEFINED_849,
+  EVENT_BREW_UNDEFINED_850,
+  EVENT_BREW_UNDEFINED_851,
+  EVENT_BREW_UNDEFINED_852,
+  EVENT_BREW_UNDEFINED_853,
+  EVENT_BREW_UNDEFINED_854,
+  EVENT_BREW_UNDEFINED_855,
+  EVENT_BREW_UNDEFINED_856,
+  EVENT_BREW_UNDEFINED_857,
+  EVENT_BREW_UNDEFINED_858,
+  EVENT_BREW_UNDEFINED_859,
+  EVENT_BREW_UNDEFINED_860,
+  EVENT_BREW_UNDEFINED_861,
+  EVENT_BREW_UNDEFINED_862,
+  EVENT_BREW_UNDEFINED_863,
+  EVENT_BREW_UNDEFINED_864,
+  EVENT_BREW_UNDEFINED_865,
+  EVENT_BREW_UNDEFINED_866,
+  EVENT_BREW_UNDEFINED_867,
+  EVENT_BREW_UNDEFINED_868,
+  EVENT_BREW_UNDEFINED_869,
+  EVENT_BREW_UNDEFINED_870,
+  EVENT_BREW_UNDEFINED_871,
+  EVENT_BREW_UNDEFINED_872,
+  EVENT_BREW_UNDEFINED_873,
+  EVENT_BREW_UNDEFINED_874,
+  EVENT_BREW_UNDEFINED_875,
+  EVENT_BREW_UNDEFINED_876,
+  EVENT_BREW_UNDEFINED_877,
+  EVENT_BREW_UNDEFINED_878,
+  EVENT_BREW_UNDEFINED_879,
+  EVENT_BREW_UNDEFINED_880,
+  EVENT_BREW_UNDEFINED_881,
+  EVENT_BREW_UNDEFINED_882,
+  EVENT_BREW_UNDEFINED_883,
+  EVENT_BREW_UNDEFINED_884,
+  EVENT_BREW_UNDEFINED_885,
+  EVENT_BREW_UNDEFINED_886,
+  EVENT_BREW_UNDEFINED_887,
+  EVENT_BREW_UNDEFINED_888,
+  EVENT_BREW_UNDEFINED_889,
+  EVENT_BREW_UNDEFINED_890,
+  EVENT_BREW_UNDEFINED_891,
+  EVENT_BREW_UNDEFINED_892,
+  EVENT_BREW_UNDEFINED_893,
+  EVENT_BREW_UNDEFINED_894,
+  EVENT_BREW_UNDEFINED_895,
+
+  EVENT_WCDMA_PS_DATA_RATE,                  /* 2 byte payload */
+  EVENT_GSM_TO_WCDMA_RESELECT_END,           /* 5 byte payload */
+  EVENT_PZID_HAI_ENABLED,                    /* No payload*/
+  EVENT_PZID_HAI_DISABLED,                   /* No payload*/
+  EVENT_GSM_TO_WCDMA_HANDOVER_START,         /* 4 byte payload */
+  EVENT_WCDMA_RRC_MODE,                      /* 1 byte payload */
+  EVENT_WCDMA_L1_ACQ_SUBSTATE,               /* 1 byte payload */
+  EVENT_WCDMA_PHYCHAN_CFG_CHANGED,           /* 1 byte payload */
+
+  EVENT_QTV_CLIP_STARTED,                    /* 7 byte payload */
+  EVENT_QTV_CLIP_ENDED,                      /* 5 byte payload */
+  EVENT_QTV_SDP_PARSER_REJECT,               /* No payload */
+  EVENT_QTV_CLIP_PAUSE,                      /* 4 byte payload */
+  EVENT_QTV_CLIP_REPOSITIONING,              /* 4 byte payload */
+  EVENT_QTV_CLIP_ZOOM_IN,                    /* No payload */
+  EVENT_QTV_CLIP_ZOOM_OUT,                   /* No payload */
+  EVENT_QTV_CLIP_ROTATE,                     /* 4 byte payload */
+  EVENT_QTV_CLIP_PAUSE_RESUME,               /* 4 byte payload */
+  EVENT_QTV_CLIP_REPOSITION_RESUME,          /* 4 byte payload */
+  EVENT_QTV_DSP_INIT,                        /* No payload */
+  EVENT_QTV_STREAMING_SERVER_URL,            /* 22 byte payload */
+  EVENT_QTV_SERVER_PORTS_USED,               /* 4 byte payload */
+  EVENT_QTV_USING_PROXY_SERVER,              /* 6 byte payload */
+  EVENT_QTV_STREAMER_STATE_IDLE,             /* No payload */
+  EVENT_QTV_STREAMER_STATE_CONNECTING,       /* No payload */
+  EVENT_QTV_STREAMER_STATE_SETTING_TRACKS,   /* No payload */
+  EVENT_QTV_STREAMER_STATE_STREAMING,        /* No payload */
+  EVENT_QTV_STREAMER_STATE_PAUSED,           /* No payload */
+  EVENT_QTV_STREAMER_STATE_SUSPENDED,        /* No payload */
+  EVENT_QTV_STREAMER_CONNECTED,              /* No payload */
+  EVENT_QTV_STREAMER_INITSTREAM_FAIL,        /* No payload */
+  EVENT_QTV_BUFFERING_STARTED,               /* 5 byte payload */
+  EVENT_QTV_BUFFERING_ENDED,                 /* 5 byte payload */
+  EVENT_QTV_CLIP_FULLSCREEN,                 /* No payload */
+  EVENT_QTV_PS_DOWNLOAD_STARTED,             /* 8 byte payload */
+  EVENT_QTV_PSEUDO_STREAM_STARTED,           /* No Payload */
+  EVENT_QTV_PS_PLAYER_STATE_PSEUDO_PAUSE,    /* No payload */
+  EVENT_QTV_PS_PLAYER_STATE_PSEUDO_RESUME,   /* 4 byte payload */
+  EVENT_QTV_PARSER_STATE_READY,              /* 14 byte payload */
+  EVENT_QTV_FRAGMENT_PLAYBACK_BEGIN,         /* 2 byte payload */
+  EVENT_QTV_FRAGMENT_PLAYBACK_COMPLETE,      /* 2 byte payload */
+  EVENT_QTV_PARSER_STATE_PSEUDO_PAUSE,       /* No payload */
+  EVENT_QTV_PLAYER_STATE_PSEUDO_PAUSE,       /* No payload */
+  EVENT_QTV_PARSER_STATE_PSEUDO_RESUME,      /* 4 byte payload */
+  EVENT_QTV_PLAYER_STATE_PSEUDO_RESUME,      /* 4 byte payload */
+  EVENT_QTV_FRAGMENTED_FILE_DECODE_START,    /* 2 byte payload */
+  EVENT_QTV_FRAGMENTED_FILE_END_SUCCESS,     /* 2 byte payload */
+  EVENT_QTV_DOWNLOAD_DATA_REPORT,            /* 4 byte payload */
+  EVENT_QTV_VDEC_DIAG_DECODE_CALLBACK,       /* 5 byte payload */
+  EVENT_QTV_URL_PLAYED_IS_MULTICAST,         /* No payload */
+  EVENT_QTV_VDEC_DIAG_STATUS,                /* 4 byte payload */
+  EVENT_QTV_STREAMING_URL_OPEN,              /* 4 byte payload */
+  EVENT_QTV_STREAMING_URL_OPENING,           /* No payload */
+  EVENT_QTV_CLIP_ENDED_VER2,                 /* 13 byte payload */
+  EVENT_QTV_SILENCE_INSERTION_STARTED,       /* No payload */
+  EVENT_QTV_SILENCE_INSERTION_ENDED,         /* 8 byte payload */
+  EVENT_QTV_AUDIO_CHANNEL_SWITCH_FRAME,      /* 8 byte payload */
+  EVENT_QTV_FIRST_VIDEO_FRAME_RENDERED,      /* No payload */
+  EVENT_QTV_FIRST_VIDEO_I_FRAME_RENDERED,    /* No payload */
+  EVENT_QTV_SDP_SELECTED,                    /* No payload */
+  EVENT_QTV_DIAG_PLAYER_STATUS,              /* 12 byte payload */
+  EVENT_QTV_SILENCE_INSERTION_DURATION,      /* 4 byte payload */
+  EVENT_QTV_UNDEFINED_957,
+  EVENT_QTV_UNDEFINED_958,
+  EVENT_QTV_UNDEFINED_959,
+  EVENT_QTV_UNDEFINED_960,
+  EVENT_QTV_UNDEFINED_961,
+  EVENT_QTV_UNDEFINED_962,
+  EVENT_QTV_UNDEFINED_963,
+  EVENT_QTV_UNDEFINED_964,
+  EVENT_QTV_UNDEFINED_965,
+  EVENT_QTV_UNDEFINED_966,
+  EVENT_QTV_UNDEFINED_967,
+
+  EVENT_DS_SETS_ARM_CLOCK_FASTER,      /* No payload */
+  EVENT_DS_SETS_ARM_CLOCK_SLOWER,      /* No payload */
+
+  EVENT_SMS_STATISTICS,                /* 2 byte payload */
+  EVENT_SM_PDP_STATE,                  /* 4 byte payload */
+  EVENT_MVS_STATE,                     /* 2 byte payload */
+
+  EVENT_SECSSL,                        /* 16 byte payload */
+  EVENT_SECTEST,                       /* 16 byte payload */
+  EVENT_SECVPN,                        /* 16 byte payload */
+  EVENT_SECCRYPT,                      /* 16 byte payload */
+  EVENT_SECCRYPT_CMD,                  /* 16 byte payload */
+
+  EVENT_SEC_RESERVED_978,              /* unknown payload */
+  EVENT_SEC_RESERVED_979,              /* unknown payload */
+  EVENT_SEC_RESERVED_980,              /* unknown payload */
+  EVENT_SEC_RESERVED_981,              /* unknown payload */
+
+  EVENT_ARM_CLK_FREQUENCY_CHANGE,      /* 12 byte payload */
+  EVENT_ADSP_CLK_FREQUENCY_CHANGE,     /* 4 byte payload */
+  EVENT_MDSP_CLK_FREQUENCY_CHANGE,     /* 4 byte payload */
+
+  EVENT_CELL_CHANGE_INDICATION,        /* 1 byte payload */
+  EVENT_CB_STATE_CHANGE,               /* 4 byte payload */
+  EVENT_SMSCB_L1_STATE_CHANGE,         /* 3 byte payload */
+  EVENT_SMSCB_L1_COLLISION,            /* 1 byte payload */
+  EVENT_WMS_SEARCH_REQUEST,            /* 1 byte payload */
+  EVENT_CM_GET_PASSWORD_IND,           /* 2 byte payload */
+  EVENT_CM_PASSWORD_AUTHENTICATION_STATUS, /* 2 byte payload */
+  EVENT_CM_USS_RESPONSE_NOTIFY_IND,    /* 3 byte payload */
+  EVENT_CM_USS_CONF,                   /* 4 byte payload */
+  EVENT_CM_RELEASE_USS_IND,            /* 4 byte payload */
+  EVENT_CM_FWD_AOC_IND,                /* 1 byte payload */
+  EVENT_PZID_ID,                       /* 2 byte payload */
+  EVENT_PZID_HT_VALUE,                 /* 9 byte payload */
+  EVENT_PZID_EXISTS_IN_LIST,           /* 1 byte payload */
+  EVENT_GSDI_GET_FILE_ATTRIBUTES,      /* 6 byte payload */
+  EVENT_GSDI_SIM_READ,                 /* 6 byte payload */
+  EVENT_GSDI_SIM_WRITE,                /* 6 byte payload */
+  EVENT_GSDI_GET_PIN_STATUS,           /* 8 byte payload */
+  EVENT_GSDI_VERIFY_PIN,               /* 7 byte payload */
+  EVENT_GSDI_UNBLOCK_PIN,              /* 7 byte payload */
+  EVENT_GSDI_DISABLE_PIN,              /* 7 byte payload */
+  EVENT_GSDI_ENABLE_PIN,               /* 7 byte payload */
+  EVENT_GSDI_SIM_INCREASE,             /* 6 byte payload */
+  EVENT_GSDI_EXECUTE_APDU_REQ,         /* 6 byte payload */
+  EVENT_SEG_UPM_ADDR_MISMATCH,         /* 2 byte payload */
+  EVENT_WCDMA_PRACH,                   /* 3 byte payload */
+  EVENT_GSDI_SELECT,                   /* 6 byte payload */
+  EVENT_WCDMA_RAB_RATE_RECONFIG,       /* 2 byte payload */
+  EVENT_WCDMA_RLC_RESETS,              /* 3 byte payload */
+  EVENT_WCDMA_RLC_OPEN_CLOSE,          /* 2 byte payload */
+  EVENT_WCDMA_RLC_MRW,                 /* 3 byte payload */
+  EVENT_QVP_APP_PROCESS_EVENT,         /* 2 byte payload */
+  EVENT_QVP_APP_STATE_CHANGED_EVENT,   /* 2 byte payload */
+  EVENT_QVP_APP_CALL_CONNECTED_EVENT,  /* 1 byte payload */
+  EVENT_GSDI_CARD_EVENT_NOTIFICATION,  /* 4 byte payload */
+  EVENT_CM_DATA_AVAILABLE,             /* 1 byte payload */
+  EVENT_CM_DS_INTERRAT_STATE,          /* 2 byte payload */
+  EVENT_MM_STATE,                      /* 2 byte payload */
+  EVENT_GMM_STATE,                     /* 2 byte payload */
+  EVENT_PLMN_INFORMATION,              /* 8 byte payload */
+  EVENT_COREAPP_SET_VOICE_PRIVACY,     /* 5 byte payload */
+  EVENT_COREAPP_GET_VOICE_PRIVACY,     /* 5 byte payload */
+  EVENT_HARD_HANDOFF_LONG_CODE_MASK_CHANGE, /* 14 byte payload */
+  EVENT_VCTCXO_FREEZE,                 /* payload */
+  EVENT_VCTCXO_UNFREEZE,               /* payload */
+  EVENT_SMS_SLOT_WAKEUP_V2,            /* 2 byte payload */
+  EVENT_QVP_RCVD_FIRST_VIDEO_FRAME,    /* no payload */
+  EVENT_QVP_CALL_RELEASED,             /* 8 byte payload */
+  EVENT_CB_SMS_NOTIFY,                 /* 10 byte payload */
+  EVENT_GPS_PDSM_EVENT_REPORT,         /* 6 byte payload */
+  EVENT_LONG_CODE_MASK_CHANGED,        /* 2 byte payload */
+  EVENT_DS707,                         /* 5 byte payload */
+
+  EVENT_GSDI_ACTIVATE_FEATURE_IND,     /* 8 byte payload */
+  EVENT_GSDI_DEACTIVATE_FEATURE_IND,   /* 8 byte payload */
+  EVENT_GSDI_GET_FEATURE_IND,          /* 11 byte payload */
+  EVENT_GSDI_SET_FEATURE_DATA,         /* 6 byte payload */
+  EVENT_GSDI_UNBLOCK_FEATURE_IND,      /* 8 byte payload */
+  EVENT_GSDI_GET_CONTROL_KEY,          /* 6 byte payload */
+  EVENT_GSDI_OTA_DEPERSO,              /* 26 byte payload */
+  EVENT_GSDI_GET_PERM_FEATURE_IND,     /* 11 byte payload */
+  EVENT_GSDI_PERM_DISBALE_FEATURE_IND, /* 8 byte payload */
+  EVENT_GSM_L1_VOCODER_INITIALIZE,     /* TBD */
+  EVENT_GSM_L1_ALIGN_VFR,              /* TBD */
+  EVENT_GSM_L1_VOCODER_ENABLED,        /* TBD */
+  EVENT_HDR_AMAC_PERSISTENCE_FAILED,   /* no payload */
+  EVENT_HDR_AMAC_PERSISTENCE_PASSED,   /* no payload */
+
+  /* 20 events reserved for MediaFLO */
+  EVENT_MFLO_STREAM_STATE,                /* 12 byte payload */
+  EVENT_MFLO_CONTROL_CHANNEL_STATE_CHANGE,/* 12 byte payload */
+  EVENT_MFLO_SLEEP_STATE_CHANGE,          /* 12 byte payload */
+  EVENT_MFLO_NETWORK_STATE_CHANGE,        /* 20 byte payload */
+  EVENT_MFLO_TRANS_STATE,                 /* 12 byte payload */
+  EVENT_MFLO_OIS_STATE,                   /* 16 byte payload */
+  EVENT_MFLO_RXD_STATE,                   /* 12 byte payload */
+  EVENT_MFLO_HIPRI_STATE_CHANGE,          /* 8  byte payload */
+  EVENT_MFLO_CAS_STATE,                   /* 12 byte payload */
+  EVENT_MFLO_ACQ_STATE,                   /* 8  byte payload */
+  EVENT_MFLO_OSCAR_FRAME_DECODED,         /* 8  byte payload */
+  EVENT_MFLO_CHAN_SWITCH_RENDERED,        /* 16 byte payload */
+  EVENT_MFLO_OSCAR_DEC_EXCEPTION_DETECTED,/* 4  byte payload */
+  EVENT_MFLO_MFN_SUBSTATE,                /* 8  byte payload */
+  EVENT_MFLO_MFN_STATE,                   /* 12  byte payload */
+  EVENT_MFLO_MFN_VERTICAL_HANDOFF,        /* 16  byte payload */
+  EVENT_MFLO_MFN_ACQ_STATE,               /* 10  byte payload */
+  EVENT_MFLO_FLOW_STATUS,                 /* 12  byte payload */
+  EVENT_MFLO_NETWORK_STATUS,              /* 12  byte payload */
+  EVENT_MFLO_UNDEFINED_1070,
+
+  EVENT_CM_LCS_MOLR_CONF,                 /* 1 byte payload */
+  EVENT_PPP_NETMODEL,                     /* 7 byte payload */
+  EVENT_CAMERA_PROFILING,                 /* 1 byte payload */
+  EVENT_MAC_HS_T1_EXPIRY,                 /* 2 byte payload */
+  EVENT_ASYNC_DS707,                      /* 4 byte payload */
+  EVENT_PKT_DS707,                        /* 4 byte payload */
+  EVENT_GPRS_TIMER_EXPIRY,                /* 1 byte payload */
+  EVENT_GPRS_MAC_IDLE_IND,                /* no payload */
+  EVENT_GPRS_PACKET_CHANNEL_REQUEST,      /* 1 byte payload */
+  EVENT_GPRS_ACCESS_REJECT,               /* 1 byte payload */
+  EVENT_GPRS_PACKET_RESOURCE_REQUEST,     /* 1 byte payload */
+  EVENT_GPRS_PACKET_UPLINK_ASSIGNMENT,    /* 2 byte payload */
+  EVENT_GPRS_PACKET_DOWNLINK_ASSIGNMENT,  /* 2 byte payload */
+  EVENT_PACKET_TIMESLOT_RECONFIGURE,      /* 3 byte payload */
+  EVENT_GPRS_TBF_RELEASE,                 /* 1 byte payload */
+  EVENT_GPRS_CELL_CHANGE_ORDER,           /* 1 byte payload */
+  EVENT_GPRS_CELL_CHANGE_FAILURE,         /* 1 byte payload */
+  EVENT_GSM_AMR_RATSCCH_REQ,              /* 1 byte payload */
+  EVENT_GSM_AMR_RATSCCH_RSP,              /* 1 byte payload */
+  EVENT_SD_SRV_IND_HYBR_WLAN,
+  EVENT_SD_EVENT_ACTION_HYBR_WLAN,
+  EVENT_GPS_PD_DEMOD_SESS_START,          /* 5 byte payload */
+  EVENT_GPS_PD_DEMOD_SESS_END,            /* 1 byte payload */
+  EVENT_GPS_SV_ACQUIRED,                  /* 4 byte payload */
+  EVENT_GPS_SV_BIT_EDGE_FOUND,            /* 4 byte payload */
+  EVENT_GPS_DEMOD_STARTED,                /* 4 byte payload */
+  EVENT_GPS_DEMOD_OUT_OF_LOCK,            /* 3 byte payload */
+  EVENT_GPS_DEMOD_STOPPED,                /* 3 byte payload */
+  EVENT_GPS_DEMOD_PREAMBLE_FOUND,         /* 3 byte payload */
+  EVENT_GPS_DEMOD_FRAME_SYNC_STATUS,      /* 4 byte payload */
+  EVENT_GPS_DEMOD_SUBFRAME,               /* 6 byte payload */
+  EVENT_GPS_DEMOD_EPHEMERIS_COMPLETE,     /* 1 byte payload */
+  EVENT_GPS_DEMOD_ALMANAC_COMPLETE,       /* 1 byte payload */
+  EVENT_GPS_DEMOD_BIT_EDGE_STATUS,        /* 4 byte payload */
+  EVENT_RAT_CHANGE,                       /* 1 byte payload */
+  EVENT_REGISTRATION_SUPPRESSED,          /* 1 byte payload */
+  EVENT_HDR_RUP_DIST_BASED_REG,           /* 3 byte payload */
+  EVENT_GPS_DIAG_APP_TRACKING_START,      /* 4 byte payload */
+  EVENT_GPS_DIAG_APP_TRACKING_END,        /* 12 byte payload */
+  EVENT_GPS_DIAG_APP_POSITION_SUCCESS,    /* 16 byte payload */
+  EVENT_GPS_DIAG_APP_POSITION_FAILURE,    /* 6 byte payload */
+  EVENT_GSM_AMR_MULTIRATE_IE,             /* 9 byte payload */
+  EVENT_EPZID_HYSTERESIS_ENABLED,         /* no payload */
+  EVENT_EPZID_HYSTERESIS_DISABLED,        /* no payload */
+  EVENT_EPZID_HT_STARTED,                 /* 10 byte payload */
+  EVENT_EPZID_HT_EXPIRED,                 /* 10 byte payload */
+  EVENT_HDR_BCMCS_FLOW_STATE_CHANGE,      /* 6 byte payload */
+  EVENT_HDR_LMAC_UPDATE_BC_STATUS,        /* 1 byte payload */
+  EVENT_DS_CAM_TIMER,                     /* 5 byte payload */
+  EVENT_DS_RDUD_TIMER,                    /* 5 byte payload */
+  EVENT_DS_CTA_TIMER,                     /* 8 bytes payload */
+  EVENT_DS_FALLBACK,                      /* 1 byte payload */
+  EVENT_DS3G_CAM_FLOW_CTRL_TIMER,         /* 5 byte payload */
+  EVENT_GPS_JAMMER_DETECTION_TEST_PASS,   /* no payload */
+  EVENT_GPS_JAMMER_DETECTION_TEST_FAILURE,/* 8 byte payload */
+  EVENT_JAMMER_DETECT_NOISE_STATS,        /* 8 byte payload */
+  EVENT_GPS_GET_PARAM,                    /* 8 byte payload */
+  EVENT_GPS_GET_PARAM_BS_INFO,            /* 18 byte payload */
+  EVENT_HS_SERVING_CELL_CHANGE,           /* 8 byte payload */
+  EVENT_HS_DSCH_STATUS,                   /* 1 byte payload */
+  EVENT_SMGMM_REQUEST_SENT,               /* 2 byte payload */
+  EVENT_SMGMM_REJECT_RECEIVED,            /* 2 byte payload */
+  EVENT_LINUX_APP_STOP,                   /* 8 byte payload */
+  EVENT_GPS_PD_CME_SESSION_START,         /* 1 byte payload */
+  EVENT_GPS_PD_CME_SESSION_END,           /* 1 byte payload */
+
+  /* 20 events reserved for QVideoPhone */
+  EVENT_SIP_REGISTER_START,               /* 4 byte payload */
+  EVENT_SIP_REGISTER_DONE,                /* 1 byte payload */
+  EVENT_SIP_CALL_SETUP_START,             /* 5 byte payload */
+  EVENT_SIP_CALL_SETUP_DONE,              /* No payload */
+  EVENT_SIP_CALL_RELEASE_START,           /* 5 byte payload */
+  EVENT_SIP_CALL_RELEASE_DONE,            /* No payload */
+  EVENT_AUDIO_FRAME_SENT_TO_DECODER,      /* 12 byte payload */
+  EVENT_VIDEO_FRAME_SENT_TO_DECODER,      /* 12 byte payload */
+  EVENT_DEC_RENDER_FRAME,                 /* 8 byte payload */
+  EVENT_DEC_RENDER_DONE,                  /* No payload */
+  EVENT_DEC_START_DECODING,               /* 4 byte payload */
+  EVENT_DEC_FRAME_DECODED,                /* 4 byte payload */
+  EVENT_V_ENCODED,                        /* 13 byte payload */
+  EVENT_DEC_START_DECODING_EXT,           /* 8 byte payload */
+  EVENT_DEC_FRAME_DECODED_EXT,            /* 8 byte payload */
+  EVENT_QVIDEOPHONE_UNDEFINED_1151,
+  EVENT_QVIDEOPHONE_UNDEFINED_1152,
+  EVENT_QVIDEOPHONE_UNDEFINED_1153,
+  EVENT_QVIDEOPHONE_UNDEFINED_1154,
+  EVENT_QVIDEOPHONE_UNDEFINED_1155,
+
+  EVENT_GPS_CME_POS_REQ,                  /* no payload */
+  EVENT_GPS_CME_FIX_START,                /* no payload */
+  EVENT_GPS_CME_FIX_END,                  /* no payload */
+  EVENT_GPS_SEED_CLM,                     /* 12 byte payload */
+  EVENT_GPS_SEED_SID,                     /* 10 byte payload */
+  EVENT_GPS_SEED_SL,                      /* 11 byte payload */
+  EVENT_GPS_SEED_GET,                     /* 13 byte payload */
+
+  EVENT_HDR_OVHD_BC_MSG_RX,               /* no payload */
+  EVENT_HDR_OVHD_T_BC_SUPERVISION,        /* no payload */
+  EVENT_HDR_LMAC_SET_BCMCS_PAGE_CYCLE,    /* 1 byte payload */
+  EVENT_HDR_HMP_SESSION_CLOSED,           /* 2 byte payload */
+
+  EVENT_WLAN_CP,                          /* 15 byte payload */
+  EVENT_ARP,                              /* 12 byte payload */
+  EVENT_DHCP,                             /* 10 byte payload */
+  EVENT_WLAN_WPA,                         /* 7 byte payload */
+  EVENT_EAP,                              /* 7 byte payload */
+  EVENT_LAN_1X,                           /* 7 byte payload */
+
+  EVENT_CAMERA_SVCS_START,                /* no payload */
+  EVENT_CAMERA_SVCS_STOP,                 /* no payload */
+
+  EVENT_BCMCS_SRVC_AVAILABLE,             /* 1 byte payload */
+  EVENT_BCMCS_SRVC_LOST,                  /* 1 byte payload */
+  EVENT_BCMCS_FLOW_REGISTERED,            /* 18 byte payload */
+  EVENT_BCMCS_FLOW_DEREGISTERED,          /* 18 byte payload */
+  EVENT_BCMCS_FLOW_STATUS_CHANGED,        /* 19 byte payload */
+
+  EVENT_CAMERA_SVCS_X,                    /* 2 byte payload */
+  EVENT_CM_CALL_EVENT_ORIG_THR,           /* 3 byte payload */
+
+  EVENT_VFE_MSG_CONFIG_COMPLETE,          /* No payload */
+  EVENT_VFE_MSG_IDLE_COMPLETE,            /* No payload */
+  EVENT_VFE_MSG_UPDATE_COMPLETE,          /* No payload */
+  EVENT_VFE_MSG_AE_AWB_STATS,             /* No payload */
+  EVENT_DSP_VIDEO_ENC_DOWNLOAD_DONE,      /* No payload */
+  EVENT_DSP_VIDEO_ENC_SELECTION_DONE,     /* No payload */
+  EVENT_DSP_VIDEO_ENC_CONFIG_DONE,        /* No payload */
+  EVENT_DSP_VIDEO_ENC_FRAME_DONE,         /* No payload */
+
+  EVENT_HDR_OVHD_BCMCS_CHAN_CHANGE,       /* 6 byte payload */
+
+  EVENT_QVS_REGISTER_START,               /* 4 byte payload */
+  EVENT_QVS_REGISTER_DONE,                /* 4 byte payload */
+  EVENT_QVS_REGISTER_FAILED,              /* No payload */
+  EVENT_QVS_CALL_SETUP_START,             /* 5 byte payload */
+  EVENT_QVS_CALL_SETUP_DONE,              /* No payload */
+  EVENT_QVS_CALL_SETUP_FAILED,            /* No payload */
+  EVENT_QVS_CALL_RELEASE_START,           /* 5 byte payload */
+  EVENT_QVS_CALL_RELEASE_DONE,            /* No payload */
+  EVENT_QVS_CALL_RELEASE_FAILED,          /* No payload */
+
+  EVENT_CAMCORDER_START_RECORD,           /* 9 byte payload */
+  EVENT_CAMCORDER_START_TRANSCODE,        /* 6 byte payload */
+  EVENT_CAMCORDER_FRAME_DROP,             /* No payload */
+  EVENT_CAMCORDER_AUDIODUB,               /* 2 byte payload */
+
+  EVENT_PSMM_SENT,                        /* 16 byte payload */
+  EVENT_GPS_PD_FALLBACK_MODE,             /* 3 byte payload */
+
+  EVENT_PEAP,                             /* 4 byte payload */
+  EVENT_TTLS,                             /* 3 byte payload */
+  EVENT_TLS,                              /* 2 byte payload */
+
+  EVENT_WCDMA_TO_WCDMA_RESELECTION_VER2_START, /* 7 byte payload */
+
+  EVENT_EUL_RECONFIG_OR_ASU,              /* 10 byte payload */
+  EVENT_EUL_SERVING_CELL_CHANGE,          /* 4 byte payload */
+  EVENT_EUL_PHYSICAL_LAYER_RECONFIG,      /* 10 byte payload */
+
+  EVENT_DRM_ROAP_TRIGGER_RECIEVED,        /* 1 byte payload */
+  EVENT_DRM_ROAP_PROTOCOL_START,          /* 1 byte payload */
+  EVENT_DRM_ROAP_REQUEST,                 /* 1 byte payload */
+  EVENT_DRM_ROAP_REQUEST_EXTENSION,       /* 2 byte payload */
+  EVENT_DRM_ROAP_RESPONSE,                /* 2 byte payload */
+  EVENT_DRM_ROAP_RESPONSE_EXTENSION,      /* 2 byte payload */
+  EVENT_DRM_ROAP_RI_CONTEXT,              /* 1 byte payload */
+  EVENT_DRM_ROAP_ERROR,                   /* 1 byte payload */
+  EVENT_DRM_ROAP_RSP_VALIDATION,          /* 3 byte payload */
+  EVENT_DRM_ROAP_PROTOCOL_END,            /* 2 byte payload */
+
+  EVENT_DS_WMK_ALLOCATED,                 /* 16 byte payload */
+  EVENT_DS_WMK_DEALLOCATED,               /* 8  byte payload */
+  EVENT_DS_WMK_FLUSHED,                   /* 12 byte payload */
+  EVENT_DS_WMK_FLOW_ENABLED,              /* 12 byte payload */
+  EVENT_DS_WMK_FLOW_DISABLED,             /* 12 byte payload */
+
+  EVENT_HDR_IDLE_SET_SLEEP_DURATION,      /* 2 byte payload */
+  EVENT_HDR_SCM_SESSION_CHANGED,          /* 1 byte payload */
+
+  EVENT_UMTS_TO_CDMA_DATA_HANDOVER,       /* No payload */ 
+  EVENT_UMTS_TO_CDMA_VOICE_HANDOVER,      /* 18 byte payload */ 
+
+  EVENT_MO_SMS_RETRY_ATTEMPT,             /* 14 byte payload */ 
+
+  EVENT_HDR_LMAC_UPDATE_QSM_STATUS,       /* 1 byte payload */ 
+
+  EVENT_CM_CELL_SRV_IND,                  /* 5 byte payload */ 
+
+  EVENT_RLP_NAK_ABORT,                    /* 9 byte payload */ 
+
+  EVENT_DRM_RIGHTS_OPERATION,             /* 2 byte payload */
+
+  EVENT_DS_RESV_MSG_SENT_REV_FLOWS,       /* 15 byte payload */
+  EVENT_DS_RESV_MSG_SENT_FWD_FLOWS,       /* 15 byte payload */
+  EVENT_DS_RESV_RESP_SUCCESS_RECD,        /* 4 byte payload */
+  EVENT_DS_RESV_RESP_FAILURE_RECD,        /* 4 byte payload */
+
+  EVENT_GPS_PD_COMM_FAILURE,              /* 2 byte payload */
+  EVENT_GPS_PD_COMM_DONE,                 /* No payload */
+  EVENT_GPS_PD_EVENT_END,                 /* 1 byte payload */
+  EVENT_GPS_PA_EVENT_CALLBACK,            /* 1 byte payload */
+  EVENT_GPS_PD_CMD_ERR_CALLBACK,          /* 2 byte payload */
+  EVENT_GPS_PA_CMD_ERR_CALLBACK,          /* 2 byte payload */
+
+  EVENT_GPS_LM_ENTER_SA_RF_VERIF,         /* 1 byte payload */
+  EVENT_GPS_LM_EXIT_SA_RF_VERIF,          /* 1 byte payload */
+  EVENT_GPS_LM_ERROR_SA_RF_VERIF,         /* 1 byte payload */
+  EVENT_GPS_LM_PD_COMPLETE,               /* No payload */
+  EVENT_GPS_LM_IQ_TEST_COMPLETE,          /* No payload */
+
+  EVENT_PM_APP_OTG_INIT,                  /* No payload */
+  EVENT_PM_APP_OTG_RESET,                 /* No payload */
+  EVENT_PM_APP_OTG_ACQUIRE_BUS_REQ,                         /* 2 byte payload */
+  EVENT_PM_APP_OTG_RELINQUISH_BUS_REQ,                      /* No payload */
+  EVENT_PM_APP_OTG_SUSPEND,                           /* No payload */
+  EVENT_PM_APP_OTG_RESUME,                              /* No payload */
+  EVENT_PM_APP_OTG_DEVICE_ATTACHED,                            /* 1 byTe payload */
+  EVENT_PM_APP_OTG_DEVICE_DETACHED,                        /* No payload */
+  EVENT_PM_APP_OTG_HOST_MODE_REM_PERI_DIS,                     /* No payload */
+  EVENT_PM_APP_OTG_PERI_MODE_PREPARE_FOR_REM_HOST_WAKEUP_SIG,  /* No payload */
+  EVENT_PM_APP_OTG_PERI_MODE_REM_HOST_WAKEUP_SIG_DONE,   /* No payload */
+  EVENT_PM_APP_OTG_SET_REM_WAKEUP_CAPABILITY,              /* 1 byte payload */
+  EVENT_PM_APP_OTG_OPERATIONAL_ERROR,                          /* 1 byte Payload */
+  EVENT_PM_APP_OTG_CONFIGURE_USB_POWER_CONSUMER,         /* No payload */
+  EVENT_PM_APP_OTG_SET_USB_POWER_CONSUMPTION_REQUIREMENT,      /* 1 byte payload */
+  EVENT_PM_APP_OTG_PERI_MODE_PROCESS_USB_POWER_LINE_CONT_REQ,  /* 1 byte payload */
+  EVENT_PM_APP_OTG_PERI_MODE_SET_REM_A_DEV_INFO,               /* 3 byte payload */
+  EVENT_PM_APP_OTG_STATE_TRANSITION,                           /* 2 byte payload */
+
+  EVENT_DTV_TABLE_ACQ_SUCCESS,                                 /* 10 byte payload */  
+  EVENT_DTV_TABLE_ACQ_FAIL,                                    /* 5 byte payload */  
+  EVENT_DTV_DVBH_SEL_PLTFM_REQ_RCVD,                           /* 4 byte payload */
+  EVENT_DTV_DVBH_PLTFM_ACQ_SUCCESS,                            /* 4 byte payload */
+  EVENT_DTV_DVBH_PLTFM_ACQ_FAIL,                               /* 4 byte payload */  
+  EVENT_DTV_DVBH_TBL_MGR_STATE_CHANGED,                        /* 2 byte payload */
+  EVENT_DTV_DVBH_CE_STATE_CHANGED,                             /* 2 byte payload */
+  EVENT_DTV_DVBH_MCAST_JOIN_REQ_RCVD,                          /* 18 byte payload */
+  EVENT_DTV_DVBH_MCAST_LEAVE_REQ_RCVD,                         /* 18 byte payload */
+  EVENT_DTV_DVBH_INIT_REQ_RCVD,                                /* No payload */
+  EVENT_DTV_DVBH_MCAST_JOIN_SUCCESS,                           /* 18 byte payload */
+  EVENT_DTV_DVBH_MCAST_JOIN_FAILURE,                           /* 18 byte payload */
+  EVENT_DTV_DVBH_MCAST_LEAVE_SUCCESS,                          /* 18 byte payload */
+  EVENT_DTV_DVBH_MCAST_LEAVE_FAILURE,                          /* 18 byte payload */
+  EVENT_DTV_DVBH_INIT_SUCCESS,                                 /* No payload */
+  EVENT_DTV_DVBH_INIT_FAILURE,                                 /* No payload */
+
+  EVENT_GPS_LM_SESSION_START,             /* 1 byte payload */
+  EVENT_GPS_LM_SESSION_END,               /* No payload */
+  EVENT_GPS_LM_FIX_REQUEST_START,         /* No payload */
+  EVENT_GPS_LM_FIX_REQUEST_END,           /* No payload */
+  EVENT_GPS_LM_PRM_REQUEST_START,         /* No payload */
+  EVENT_GPS_LM_PRM_REQUEST_END,           /* No payload */
+  EVENT_GPS_LM_SESSION_CONTINUE,          /* 1 byte payload */
+  EVENT_GPS_LM_FIX_REQUEST_CONTINUE,      /* No payload */
+  EVENT_GPS_LM_PRM_REQUEST_CONTINUE,      /* No payload */
+  EVENT_GPS_LM_PPM_REQUEST_CONTINUE,      /* No payload */
+  EVENT_GPS_LM_AIDING_DATA_RECEIVED,      /* 1 byte payload */
+  EVENT_GPS_LM_RC_ON_TIMER_TIMEOUT,       /* No payload */
+  EVENT_GPS_LM_SHUT_OFF_TIMER_TIMEOUT,    /* No payload */
+  EVENT_GPS_LM_MGP_ON,                    /* No payload */
+  EVENT_GPS_LM_MGP_IDLE,                  /* No payload */
+  EVENT_GPS_LM_MGP_OFF,                   /* No payload */
+
+  EVENT_DRM_RO_CONSUMPTION_VALIDATION,    /* 2 byte payload */
+  EVENT_DRM_RO_INSTALLATION_VALIDATION,   /* 2 byte payload */
+
+  EVENT_FLUTE_FDT_INST_RCVD,              /* 8 byte payload */
+  EVENT_FLUTE_FDT_INST_RCV_FAIL,          /* 9 byte payload */
+  EVENT_FLUTE_FDT_INST_EXPIRED,           /* 8 byte payload */
+  EVENT_FLUTE_JOIN_SESSION_REQ_RCVD,      /* 24 byte payload */
+  EVENT_FLUTE_LEAVE_SESSION_REQ_RCVD,     /* 4 byte payload */
+  EVENT_FLUTE_SESSION_CLOSED,             /* 5 byte payload */ 
+  EVENT_FLUTE_SESSION_CLOSED_BY_APP,      /* 4 byte payload */ 
+  EVENT_FLUTE_B_FLAG_RCVD,                /* 8 byte payload */ 
+  EVENT_FLUTE_GET_FILE_REQUEST_RCVD,      /* 8 byte payload */ 
+  EVENT_FLUTE_JOIN_SESSION_RSP,           /* 6 byte payload */ 
+  EVENT_FLUTE_FILE_STATUS_RSP,            /* 16 byte payload */ 
+  EVENT_FLUTE_CANCEL_FILE_REQ_RCVD,       /* 8 byte payload */
+
+  EVENT_DTV_DVBH_DEINIT_REQ_RCVD,         /* No payload */
+  EVENT_DTV_DVBH_DEINIT_SUCCESS,          /* No payload */
+  EVENT_DTV_DVBH_DEINIT_FAILURE,          /* No payload */
+
+  EVENT_CONTENT_INSTALL_BEGIN,            /* No payload */
+  EVENT_CONTENT_INSTALL_COMPLETE,         /* 2 byte payload */
+  EVENT_CONTENT_RETRIEVAL_BEGIN ,         /* No payload */
+  EVENT_CONTENT_RETRIEVAL_COMPLETE,       /* 4 byte payload */
+  EVENT_CONTENT_BACKUP_BEGIN,             /* No payload */
+  EVENT_CONTENT_BACKUP_COMPLETE,          /* 2 byte payload */
+  EVENT_CONTENT_FWD_BEGIN,                /* No payload */
+  EVENT_CONTENT_FWD_COMPLETE,             /* 2 byte payload */
+
+  EVENT_HARD_HANDOFF_VOIP_TO_CDMA,        /* 14 byte payload */
+
+  EVENT_EAP_SIM_AKA,                      /* 14 byte payload */
+  EVENT_WLAN_CP_MEAS,                     /* 16 byte payload */
+  EVENT_WLAN_CP_HO,                       /* 13 byte payload */
+  EVENT_WLAN_CP_11D,                      /* 9  byte payload */
+  EVENT_WLAN_MC,                          /* 2  byte payload */
+
+  EVENT_SVG_CONTENT_SET,                  /* 2  byte payload */
+  EVENT_SVG_CONTENT_PLAY,                 /* 2  byte payload */
+  EVENT_SVG_CONTENT_RESUME,               /* 1  byte payload */
+  EVENT_SVG_CONTENT_PAUSE,                /* 1  byte payload */
+  EVENT_SVG_CONTENT_STOP,                 /* 1  byte payload */
+  EVENT_SVG_CONTENT_USEREVENT,            /* 10 byte payload */
+  EVENT_SVG_CONTENT_GETURIDATA,           /* 3  byte payload */
+  EVENT_SVG_CONTENT_TRANSFORM,            /* 10 byte payload */
+  EVENT_SVG_GET_PARAM,                    /* 3  byte payload */
+  EVENT_SVG_SET_PARAM,                    /* 3  byte payload */
+
+  EVENT_WLAN_WPA2,                        /* 5 byte payload */
+
+  EVENT_WCDMA_PSC_SCANNER_STOP,           /* 1 byte payload */
+
+  EVENT_MEDIA_PLAYER_KEYPRESS,            /* 4 byte payload */
+
+  EVENT_WLAN_MC_QOS,                      /* 5 byte payload */
+
+  EVENT_WCDMA_PSC_SCANNER_STATE,          /* 1 byte payload */
+
+  EVENT_WLAN_CP_ADHOC,                    /* 16 byte payload */
+
+  EVENT_DMB_STACK_SHUTDOWN,               /* 4 byte payload */
+  EVENT_DMB_TUNE_DONE_SUCCESS,            /* 4 byte payload */
+  EVENT_DMB_TUNE_DONE_FAILURE,            /* 4 byte payload */
+  EVENT_DMB_SEARCH_DONE,                  /* 4 byte payload */
+  EVENT_DMB_SCAN_DONE,                    /* 4 byte payload */
+  EVENT_DMB_RECEPTION_INFO_CHANGED,       /* 4 byte payload */
+  EVENT_DMB_DMB_GUIDE_CHANGED,            /* 4 byte payload */
+  EVENT_DMB_LOCATION_INFO_CHANGED,        /* 4 byte payload */
+  EVENT_DMB_LOST_ENSEMBLE,                /* 4 byte payload */
+  EVENT_DMB_STREAM_TERMINATED,            /* 4 byte payload */
+  EVENT_DMB_STREAM_DATA_AVAILABLE,        /* 4 byte payload */
+  EVENT_DMB_RESERVED1,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED2,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED3,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED4,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED5,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED6,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED7,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED8,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED9,                    /* 4 byte payload */
+  EVENT_DMB_RESERVED10,                   /* 4 byte payload */
+
+  EVENT_MOBILEVIEW_RESERVED1,             /* TBD */
+  EVENT_MOBILEVIEW_RESERVED2,             /* TBD */
+  EVENT_MOBILEVIEW_RESERVED3,             /* TBD */
+  EVENT_MOBILEVIEW_RESERVED4,             /* TBD */
+  EVENT_MOBILEVIEW_RESERVED5,             /* TBD */
+
+  EVENT_HDR_DOS_MO_DOS_STATUS,            /* 3 byte payload */ 
+
+  EVENT_GPSONEXTRA_START_DOWNLOAD,        /* 4 byte payload */
+  EVENT_GPSONEXTRA_END_DOWNLOAD,          /* 4 byte payload */
+
+  EVENT_SNSD_GENERIC,                     /* 8 byte payload */
+  EVENT_SNSD_DEVICE_INIT,                 /* 8 byte payload */
+  EVENT_SNSD_DEVICE_CONFIGURED,           /* 8 byte payload */
+  EVENT_SNSD_EVENT_DATA_READY,            /* 8 byte payload */
+  EVENT_SNSD_EVENT_COND_MET,              /* 8 byte payload */
+  EVENT_SNSD_DEVICE_DOWN,                 /* 8 byte payload */
+  EVENT_SNSD_ERROR,                       /* 8 byte payload */
+  
+  EVENT_CM_COUNTRY_SELECTED,              /* 2 byte payload */
+  EVENT_CM_SELECT_COUNTRY,                /* 7 byte payload */
+
+  EVENT_GPS_DCME_NEW_SV_ADDED_IN_AA,      /* 1 byte payload */
+  EVENT_GPS_DCME_SV_REMOVED_FROM_AA,      /* 1 byte payload */
+
+  EVENT_ESG_GET_PROV_LIST_REQ_RCVD,       /* No payload */
+  EVENT_ESG_GET_PROV_LIST_REQ_FAIL,       /* No payload */
+  EVENT_ESG_PROV_LIST_AVAILABLE,          /* No payload */
+  EVENT_ESG_ACQ_REQ_RCVD,                 /* 2 byte payload */
+  EVENT_ESG_ACQ_REQ_FAIL,                 /* 2 byte payload */
+  EVENT_ESG_STOP_REQ_RCVD,                /* No payload */
+  EVENT_ESG_STOP_REQ_FAIL,                /* No payload */
+  EVENT_ESG_STOP_COMPLETE,                /* 1 byte payload */
+
+  EVENT_ADC_ONDIE_THERM_READ,             /* 2 byte payload */
+
+  EVENT_CONTENT_NO_VALID_OR_EXPIRED_RIGHTS, /* No Payload */
+
+  EVENT_MOBILEVIEW_RESERVED30,            /* EVENT TO BE REPLACED */
+  EVENT_MOBILEVIEW_RESERVED31,            /* EVENT TO BE REPLACED */
+  EVENT_MOBILEVIEW_RESERVED32,            /* EVENT TO BE REPLACED */
+
+  EVENT_GPS_DCME_MEAS_CYCLE_START,        /* No payload */ 
+  EVENT_GPS_DCME_MEAS_CYCLE_END,          /* No payload */ 
+  EVENT_GPS_CME_ENGAGED,                  /* No payload */ 
+  EVENT_GPS_CME_NOT_ENGAGED,              /* No payload */ 
+  EVENT_GPS_DCME_ENGAGED,                 /* No payload */ 
+  EVENT_GPS_DCME_NOT_ENGAGED,             /* No payload */ 
+
+  EVENT_HS_USB_DEVICE_ATTACHED,           /* No payload */
+  EVENT_HS_USB_HID_DISCONECT,             /* No payload */
+  EVENT_HS_USB_HID_CONNECT,               /* 2 byte payload */
+  EVENT_HS_USB_MSD_CONNECT,               /* No payload */
+  EVENT_HS_USB_MSD_DISCONECT,             /* No payload */
+  EVENT_HS_USB_STACK_SUSPENDED,           /* 1 byte payload */
+  EVENT_HS_USB_STACK_RESUMED,             /* 1 byte payload */
+  EVENT_HS_USB_ENTER_HOST_MODE,           /* No payload */
+  EVENT_HS_USB_OPERATIONAL_ERROR,         /* 2 byte payload */
+
+  EVENT_DTV_L1_ACQ_DONE,                  /* 5 byte payload */
+  EVENT_DTV_L1_SCAN,                      /* 4 byte payload */
+  EVENT_DTV_L1_ONLINE,                    /* 1 byte payload */
+  EVENT_DTV_L1_SNOOZE,                    /* No payload */
+  EVENT_DTV_L1_SLEEP,                     /* No payload */
+  EVENT_DTV_L1_HANDOFF,                   /* 5 byte payload */
+  EVENT_DTV_L1_SIGNAL_LOST,               /* No payload */
+
+  EVENT_IMS_SIP_REGISTRATION_START,       /* 4 byte payload */
+  EVENT_IMS_SIP_REGISTER_END,             /* 4 byte payload */
+  EVENT_IMS_SIP_DEREGISTER_START,         /* 4 byte payload */
+  EVENT_IMS_SIP_DEREGISTER_END,           /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_START,            /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_RINGING,          /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_ESTABLISHED,      /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_TERMINATED,       /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_CANCEL,           /* 4 byte payload */
+  EVENT_IMS_SIP_SESSION_FAILURE,          /* 4 byte payload */
+  EVENT_IMS_SIP_RESPONSE_RECV,            /* 4 byte payload */
+  EVENT_IMS_SIP_REQUEST_RECV,             /* 4 byte payload */
+  EVENT_IMS_SIP_RESPONSE_SEND,            /* 4 byte payload */
+  EVENT_IMS_SIP_REQUEST_SEND,             /* 4 byte payload */
+
+  EVENT_WLAN_TKIP_COUNTER_MEAS,           /* 2 byte payload */
+
+  EVENT_GPS_BLANKING_OFF,                 /* No payload */
+  EVENT_GPS_BLANKING_ON,                  /* No payload */
+
+  EVENT_MMGSDI_EVENT,                     /* 16 byte payload */
+
+  EVENT_WLAN_CP_SYS_MGR_STATE_TRANS,      /* 3 byte payload */
+
+  EVENT_GPS_OPTIMISTIC_PUNC_START,        /* 4 byte payload */
+  EVENT_GPS_OPTIMISTIC_PUNC_END,          /* 4 byte payload */
+
+  EVENT_QVP_SEND_RTP_PACKET,              /* 7 byte payload */
+  EVENT_QVP_RECV_RTP_PACKET,              /* 7 byte payload */
+
+  EVENT_HDR_IDLE_REACQ_FAIL_DDARF,        /* 3 byte payload */
+
+  EVENT_BCAST_SEC_STKM_PARSE_STATUS,      /* 2 byte payload */
+  EVENT_BCAST_SEC_STKM_RECEIVED,          /* No payload */
+  EVENT_BCAST_SEC_SDP_PARSE_STATUS,       /* 2 byte payload */
+
+  EVENT_CGPS_ME_DPO_STATUS,               /* 1 byte payload */
+  EVENT_GPS_SV_SEARCH_STATE,              /* 6 byte payload */
+  EVENT_GPS_TM_ON_DEMAND_MODE_CHANGE,     /* 3 byte payload */
+  EVENT_GPS_TM_ON_DEMAND_BEGIN,           /* 6 byte payload */
+  EVENT_GPS_TM_ON_DEMAND_DONE,            /* 1 byte payload */
+
+  EVENT_RMAC_CARRIER_STATE_CHANGED,       /* 6 byte payload */
+
+  EVENT_GPS_SBAS_DEMOD_REPORT,            /* 9 byte payload */
+  EVENT_GPS_EXTERN_COARSE_POS_INJ_START,  /* No payload */
+  EVENT_GPS_EXTERN_COARSE_POS_INJ_END,    /* 1 byte payload */
+  EVENT_GPS_EPH_REREQUEST_TIME,           /* 2 byte payload */
+
+  EVENT_WLAN_QOS_PSTREAM,                 /* 3 byte payload */
+  EVENT_WLAN_CP_VCC,                      /* 9 byte payload */
+
+  EVENT_CGPS_DIAG_FIRST_SUCCESSFUL_FIX,   /* No payload */
+
+  EVENT_EUL_RECONFIG_OR_ASU_OR_TTI_RECFG, /* 12 byte payload */
+
+  EVENT_DS707_PKT_LN_UPDATE,              /* 3 byte payload */
+  EVENT_DS707_PKT_IDM_CHANGE,             /* 2 byte payload */
+
+  EVENT_RLP_QN_ADD,                       /* 3 byte payload */
+  EVENT_RLP_QN_DROP,                      /* 3 byte payload */
+  EVENT_RLP_MULTILINK_NAK,                /* 9 byte payload */
+  EVENT_RLP_REV_LINK_NAK,                 /* 9 byte payload */
+  EVENT_GSTK_EVENT,                       /* 16 byte payload */
+
+  EVENT_GAN_REGISTRATION_REQUEST,         /* 1 byte payload */
+  EVENT_GAN_REGISTER_ACCEPT,              /* 1 byte payload */
+  EVENT_CALL_RINGING_ALERT,               /* 1 byte payload */
+  EVENT_GAN_PAGING_RECEIVED,              /* 1 byte payload */
+  EVENT_GAN_CALL_DISCONNECT,              /* 1 byte payload */
+  EVENT_GAN_CALL_RELEASE_COMPLETE,        /* 1 byte payload */
+  EVENT_GAN_HANDIN_COMMAND,               /* 1 byte payload */
+  EVENT_GAN_HANDIN_COMPLETE,              /* 1 byte payload */
+  EVENT_GAN_HANDOUT_COMMAND,              /* 1 byte payload */
+  EVENT_GAN_HANDOUT_COMPLETE,             /* 1 byte payload */
+  EVENT_GAN_SMS_START,                    /* 1 byte payload */
+  EVENT_GAN_SMS_ACK,                      /* 1 byte payload */
+  EVENT_GAN_QDJ_ENQUEUE,                  /* No payload */
+  EVENT_GAN_QDJ_DEQUEUE,                  /* No payload */
+  EVENT_GAN_ACTIVATE_DATA_CHANNEL,        /* 1 byte payload */
+  EVENT_GAN_DATA_CHANNEL_CONNECTED,       /* 1 byte payload */
+  EVENT_GAN_RLP_SUSPEND,                  /* 1 byte payload */
+  EVENT_GAN_RLP_RESUME,                   /* 1 byte payload */
+  EVENT_GAN_WAKEUP_REQ,                   /* No payload */
+  EVENT_GAN_WAKEUP_CNF,                   /* No payload */
+  EVENT_GAN_HIBERNATION_REQ,              /* No payload */
+  EVENT_GAN_HIBERNATION_CNF,              /* No payload */
+
+  EVENT_WCDMA_UL_AMR_RATE,                /* 11 byte payload */
+  EVENT_EUL_TTI_RECONFIG,                 /* 1 byte payload */
+  EVENT_WCDMA_CONN_REL_CAUSE,             /* 1 byte payload */
+  EVENT_WCDMA_CONN_REQ_CAUSE,             /* 1 byte payload */
+
+  EVENT_LTE_TIMING_ADVANCE,               /* 3 byte payload */
+  EVENT_LTE_UL_OUT_OF_SYNC,               /* No payload */
+  EVENT_LTE_SPS_DEACTIVATED,              /* 1 byte payload */
+  EVENT_LTE_RACH_ACCESS_START,            /* 2 byte payload */
+  EVENT_LTE_RACH_RAID_MATCH,              /* 1 byte payload */
+  EVENT_LTE_RACH_ACCESS_RESULT,           /* 1 byte payload */
+
+  EVENT_DTV_L1_POWERUP,                   /* 2 byte payload */
+  EVENT_DTV_L1_POWERDOWN,                 /* 2 byte payload */
+  EVENT_DTV_L1_SOFT_RESET,                /* 2 byte payload */
+  EVENT_DTV_L1_STATE_CHANGE,              /* 8 byte payload */
+  EVENT_DTV_L1_ACQ_TUNE_STATUS,           /* 9 byte payload */
+  EVENT_DTV_L1_ACQ_DONE_STATUS,           /* 9 byte payload */
+  EVENT_DTV_L1_ACQ_FAIL,                  /* 3 byte payload */
+  EVENT_DTV_L1_TRAFFIC_STARTED,           /* 2 byte payload */
+  EVENT_DTV_L1_BAD_FRAME_RECEIVED,        /* 6 byte payload */
+  EVENT_DTV_L1_TMCC_FAILURE,              /* 4 byte payload */
+  EVENT_DTV_L1_RECOVERY_STATUS,           /* 5 byte payload */
+  EVENT_DTV_L1_INTERRUPT_LOG_RECEIVED,    /* 2 byte payload */
+  EVENT_DTV_L1_L3_API_COMMAND,            /* 4 byte payload */
+  EVENT_DTV_L1_MODEM_FAILURE,             /* 6 byte payload */
+
+  EVENT_GSM_CALL_DROP,                    /* 2 byte payload */
+  EVENT_GSM_ACCESS_FAILURE,               /* 3 byte payload */
+
+  EVENT_DTV_ISDB_ACTIVATE,                /* 9 byte payload */
+  EVENT_DTV_ISDB_DEACTIVATE,              /* 9 byte payload */
+  EVENT_DTV_ISDB_TUNE,                    /* 13 byte payload */
+  EVENT_DTV_ISDB_UNTUNE,                  /* 9 byte payload */
+  EVENT_DTV_ISDB_SELECT_SERVICE,          /* 11 byte payload */
+  EVENT_DTV_ISDB_SERVICE_AVAILABLE,       /* 6 byte payload */
+  EVENT_DTV_ISDB_TRAFFIC_LOST,            /* 4 byte payload */
+  EVENT_DTV_ISDB_TABLE_UPDATE,            /* 7 byte payload */
+  EVENT_DTV_ISDB_TRACKS_SELECTED,         /* 13 byte payload */
+  EVENT_DTV_ISDB_PES_BUFFER_OVERFLOW,     /* 5 byte payload */
+  EVENT_DTV_ISDB_PES_BUFFER_UNDERFLOW,    /* 5 byte payload */
+  EVENT_DTV_ISDB_ACQUIRE_DATA_COMPONENT,  /* 10 byte payload */
+  EVENT_DTV_ISDB_STOP_COMPONENT_ACQUISITION, /* 10 byte payload */
+  EVENT_DTV_ISDB_DII_CHANGED,             /* 5 byte payload */
+  EVENT_DTV_ISDB_DATA_EVENT_MESSAGE,      /* 5 byte payload */
+  EVENT_DTV_ISDB_MODULE_CONSTRUCTION,     /* 13 byte payload */
+  EVENT_DTV_ISDB_PARSING_ERROR,           /* 13 byte payload */
+
+  EVENT_HDR_SLP_SLPQH_TIMER_STARTED,      /* No payload */
+  EVENT_HDR_SLP_SLPQH_TIMER_STOPPED,      /* 1 byte payload */
+  EVENT_HDR_SLP_SLPQH_NUM_PENDING_MSGS,   /* 1 byte payload */
+  EVENT_HDR_OVHD_FIND_CACHED_MSG,         /* 1 byte payload */
+
+  EVENT_WCDMA_RRC_TIMER_EXPIRED,          /* 1 byte payload */
+  EVENT_WCDMA_UOOS_TIMER_USED,            /* 4 byte payload */
+  EVENT_WCDMA_UOOS_TIMER_START,           /* 1 byte payload */
+  EVENT_WCDMA_UOOS_TIMER_STOP,            /* 1 byte payload */
+  EVENT_WCDMA_UOOS_TIME_REMAINING,        /* 6 byte payload */
+  EVENT_WCDMA_RRCCSP_SCAN_START,          /* 1 byte payload */
+  EVENT_WCDMA_ACQUISITON_SUCCESS,         /* 5 byte payload */
+  EVENT_WCDMA_CELL_SELECTION_FAIL,        /* 1 byte payload */
+  EVENT_WCDMA_BPLMN_START,                /* 1 byte payload */
+  EVENT_WCDMA_BPLMN_END,                  /* 1 byte payload */
+  EVENT_WCDMA_BPLMN_SCAN_START,           /* 1 byte payload */
+  EVENT_WCDMA_BPLMN_SCAN_END,             /* 1 byte payload */
+
+  EVENT_MSG_HIGH,                         /* 32 byte payload */
+  EVENT_MSG_MED,                          /* 32 byte payload */
+  EVENT_MSG_LOW,                          /* 32 byte payload */
+  EVENT_MSG_ERROR,                        /* 32 byte payload */
+  EVENT_MSG_FATAL,                        /* 32 byte payload */
+
+  EVENT_GAN_START_TU3910,                 /* No payload */
+  EVENT_GAN_STOP_TU3910,                  /* No payload */ 
+  EVENT_GAN_EXPIRY_TU3910,                /* No payload */
+  EVENT_GAN_START_TU3920,                 /* No payload */
+  EVENT_GAN_STOP_TU3920,                  /* No payload */
+  EVENT_GAN_EXPIRY_TU3920,                /* No payload */
+  EVENT_GAN_START_TU3906,                 /* No payload */ 
+  EVENT_GAN_STOP_TU3906,                  /* No payload */ 
+  EVENT_GAN_EXPIRY_TU3906,                /* No payload */
+  EVENT_GAN_URR_REGISTER_UPDATE,          /* 1 byte payload */
+
+  EVENT_IPSEC_IKE_SA_INIT_SENT,            /* 8 bytes payload */
+  EVENT_IPSEC_IKE_SA_INIT_RECV,            /* 16 bytes payload */
+  EVENT_IPSEC_IKE_SA_ESTABLISHED,          /* 16 bytes payload */
+  EVENT_IPSEC_IKE_AUTH_SENT,               /* 16 bytes payload */
+  EVENT_IPSEC_IKE_AUTH_RECV,               /* 16 bytes payload */
+  EVENT_IPSEC_IKE_EAP_START,               /* No payload */
+  EVENT_IPSEC_IKE_EAP_FINISH,              /* 1 byte payload */
+  EVENT_IPSEC_CHILD_SA_ESTABLISHED,        /* 8 bytes payload */
+  EVENT_IPSEC_IKE_INFO_MSG_SENT,           /* 16 bytes payload */ 
+  EVENT_IPSEC_IKE_INFO_MSG_RECV,           /* 16 bytes payload */
+  EVENT_IPSEC_CREATE_CHILD_SA_SENT,        /* 16 bytes payload */
+  EVENT_IPSEC_CREATE_CHILD_SA_RECV,        /* 16 bytes payload */
+  EVENT_IPSEC_IKE_SA_DELETE_START,         /* 16 bytes payload */
+  EVENT_IPSEC_IKE_SA_DELETE_DONE,          /* 16 bytes payload */
+  EVENT_IPSEC_CHILD_SA_DELETE_START,       /* 8 bytes payload */
+  EVENT_IPSEC_CHILD_SA_DELETE_DONE,        /* 8 bytes payload */
+  EVENT_IPSEC_IKE_SA_REKEY_START,          /* 16 bytes payload */
+  EVENT_IPSEC_IKE_SA_REKEY_DONE,           /* 16 bytes payload */
+  EVENT_IPSEC_CHILD_SA_REKEY_START,        /* 8 bytes payload */
+  EVENT_IPSEC_CHILD_SA_REKEY_DONE,         /* 8 bytes payload */
+  EVENT_IPSEC_IKE_MESG_RETRANSMIT,         /* 4 bytes payload */
+  EVENT_IPSEC_IKE_NAT_DETECTED,            /* No payload */
+  EVENT_IPSEC_IKE_NAT_KEEPALIVE_SENT,      /* 16 bytes payload */
+  EVENT_IPSEC_IKE_DPD_SENT,                /* 16 bytes payload */
+  EVENT_IPSEC_IKE_ERR_NOTIFY_SENT,         /* 4 bytes payload */
+  EVENT_IPSEC_IKE_ERR_NOTIFY_RECV,         /* 4 bytes payload */
+
+  EVENT_GAN_ROVEIN_CNF,                    /* No payload */
+  EVENT_GAN_ROVEOUT_CNF,                   /* No payload */
+  EVENT_GAN_RRC_ROVEIN_CNF,                /* No payload */
+  EVENT_GAN_RRC_ROVEIN_REJ,                /* 1 byte payload */
+  EVENT_GAN_RRC_ROVEOUT_CNF,               /* No payload */
+  EVENT_GAN_RRC_ROVEOUT_REJ,               /* 1 byte payload */
+
+  EVENT_GPSXTRA_T_SESS_BEGIN,              /* 1 byte payload */
+  EVENT_GPSXTRA_T_SESS_DATA,               /* 8 byte payload */
+  EVENT_GPSXTRA_T_SESS_DONE,               /* 1 byte payload */
+  EVENT_GPSXTRA_T_SESS_END,                /* 4 byte payload */
+
+  EVENT_DS_GO_NULL_TIMER,                  /* 5 byte payload */
+
+  EVENT_LTE_RRC_TIMER_STATUS,              /* 6 byte payload */
+  EVENT_LTE_RRC_STATE_CHANGE,              /* 1 byte payload */
+  EVENT_LTE_RRC_OUT_OF_SERVICE,            /* 2 byte payload */
+  EVENT_LTE_RRC_RADIO_LINK_FAILURE,        /* 2 byte payload */
+  EVENT_LTE_RRC_DL_MSG,                    /* 2 byte payload */ 
+  EVENT_LTE_RRC_UL_MSG,                    /* 2 byte payload */
+  EVENT_LTE_RRC_NEW_CELL_IND,              /* 5 byte payload */
+  EVENT_LTE_RRC_CELL_RESEL_FAILURE,        /* 5 byte payload */
+  EVENT_LTE_RRC_HO_FAILURE,                /* 5 byte payload */
+  EVENT_LTE_RRC_PAGING_DRX_CYCLE,          /* 2 byte payload */
+  EVENT_LTE_RRC_IRAT_HO_FROM_EUTRAN,       /* 1 byte payload */
+  EVENT_LTE_RRC_IRAT_HO_FROM_EUTRAN_FAILURE, /* 1 byte payload */
+  EVENT_LTE_RRC_IRAT_RESEL_FROM_EUTRAN,            /* 1 byte payload */
+  EVENT_LTE_RRC_IRAT_RESEL_FROM_EUTRAN_FAILURE, /* 1 byte payload */
+  EVENT_LTE_RRC_SIB_READ_FAILURE,          /* 6 byte payload */
+
+  EVENT_GAN_ROVEIN_REQ,                    /* No payload */
+  EVENT_GAN_ROVEOUT_REQ,                   /* No payload */
+
+  EVENT_MBP_RF_ANALOG_JD_MODE_CHANGE,      /* 7 byte payload */
+  EVENT_MBP_RF_ANALOG_JD_INT,              /* 4 byte payload */
+
+  EVENT_CGPS_QWIP_SYSD_TRANSITION,         /* 4 byte payload */
+  
+  EVENT_HPLMN_TIMER_EXPIRED,               /* No Payload */
+
+  EVENT_GSDI_GET_FEATURE_INDICATOR_DATA,   /* 6 byte payload */
+
+  EVENT_LTE_CM_INCOMING_MSG,               /* 1 byte payload */
+  EVENT_LTE_CM_OUTGOING_MSG,               /* 1 byte payload */
+  EVENT_LTE_EMM_INCOMING_MSG,              /* 1 byte payload */
+  EVENT_LTE_EMM_OUTGOING_MSG,              /* 1 byte payload */
+  EVENT_LTE_EMM_TIMER_START,               /* 1 byte payload */
+  EVENT_LTE_EMM_TIMER_EXPIRY,              /* 1 byte payload */
+
+  EVENT_LTE_REG_INCOMING_MSG,              /* 1 byte payload */
+  EVENT_LTE_REG_OUTGOING_MSG,              /* 1 byte payload */
+  EVENT_LTE_ESM_INCOMING_MSG,              /* 1 byte payload */
+  EVENT_LTE_ESM_OUTGOING_MSG,              /* 1 byte payload */
+  EVENT_LTE_ESM_TIMER_START,               /* 1 byte payload */
+  EVENT_LTE_ESM_TIMER_EXPIRY,              /* 1 byte payload */
+
+  EVENT_SNS_CONTEXT_OPEN,                  /* 4 byte payload */
+  EVENT_SNS_CONTEXT_CLOSE,                 /* 4 byte payload */
+  EVENT_SNS_COND_SET,                      /* 8 byte payload */
+  EVENT_SNS_COND_CANCEL,                   /* 8 byte payload */
+  EVENT_SNS_COND_MET,                      /* 8 byte payload */
+  EVENT_SNS_DATA_START,                    /* 12 byte payload */
+  EVENT_SNS_DATA_STOP,                     /* 8 byte payload */
+
+  EVENT_WCDMA_RLC_CONFIG,                  /* 4 byte payload */
+
+  EVENT_HSPA_PLUS_CFG,                     /* 6 byte payload */
+
+  EVENT_SNS_DRIVER_STATE_CHANGE,           /* 9 byte payload */
+
+  EVENT_WCDMA_TIMER_DISCARD_EXPIRY,        /* 3 byte payload */  
+
+  EVENT_NAS_CB_PAGE_RECEIVED,              /* 5 byte payload */  
+
+  EVENT_WCDMA_RLC_RESET,                   /* 1 byte payload */  
+
+  EVENT_HDR_MRLP_EHRPD_PERSONALITY_IS_ACTIVE, /* 1 byte payload */  
+  
+  EVENT_WLAN_SECURITY,                     /* 13 byte payload */
+  EVENT_WLAN_STATUS,                       /* 15 byte payload */
+  EVENT_WLAN_HANDOFF,                      /* 15 byte payload */
+  EVENT_WLAN_VCC,                          /* 8 byte payload */
+  EVENT_WLAN_QOS,                          /* 2 byte payload */
+  EVENT_WLAN_PE,                           /* 16 byte payload */
+  EVENT_WLAN_ADD_BLOCK_ACK_SUCCESS,        /* 11 byte payload */
+  EVENT_WLAN_ADD_BLOCK_ACK_FAILED,         /* 9 byte payload */
+  EVENT_WLAN_DELETE_BLOCK_ACK_SUCCESS,     /* 8 byte payload */
+  EVENT_WLAN_DELETE_BLOCK_ACK_FAILED,      /* 8 byte payload */
+  EVENT_WLAN_BSS_PROTECTION,               /* 2 byte payload */
+  EVENT_WLAN_BRINGUP_STATUS,               /* 12 byte payload */
+  EVENT_WLAN_POWERSAVE_GENERIC,            /* 16 byte payload */
+  EVENT_WLAN_POWERSAVE_WOW,                /* 11 byte payload */
+  EVENT_WLAN_WCM,                          /* 17 byte payload */
+  EVENT_WLAN_WPS_SCAN_START,               /* 16 byte payload */
+  EVENT_WLAN_WPS_SCAN_COMPLETE,            /* 2 byte payload */
+  EVENT_WLAN_WPS_CONNECT_REQUEST,          /* 9 byte payload */
+  EVENT_WLAN_WPS_CONNECT_RESPONSE,         /* 6 byte payload */
+  EVENT_WLAN_WPS_PBC_SESSION_OVERLAP,      /* 16 byte payload */
+  EVENT_WLAN_WPS_PBC_WALK_TIMER_START,     /* No payload */
+  EVENT_WLAN_WPS_PBC_WALK_TIMER_STOP,      /* No payload */
+  EVENT_WLAN_WPS_PBC_AP_DETECTED,          /* 14 byte payload */
+  EVENT_WLAN_WPS_REGISTRATION_START,       /* 1 byte payload */
+  EVENT_WLAN_WPS_WSC_MESSAGE,              /* 1 byte payload */
+  EVENT_WLAN_WPS_DISCOVERY,                /* 7 byte payload */
+  EVENT_WLAN_WPS_REGISTRATION_COMPLETE,    /* 1 byte payload */
+  EVENT_WLAN_WPS_DISCONNECT,               /* No payload */
+  EVENT_WLAN_BTC,                          /* 15 byte payload */
+
+  EVENT_IPV6_SM_EVENT,                     /* 4 byte payload */
+  EVENT_IPV6_SM_TRANSITION,                /* 5 byte payload */
+  EVENT_IPV6_PREFIX_UPDATE,                /* 13 byte payload */
+
+  EVENT_LTE_ML1_STATE_CHANGE,              /* 2 byte payload */
+
+  EVENT_AUTH_PROTO,                        /* 2 byte payload */
+  EVENT_VSNCP,                             /* 2 byte payload */
+  EVENT_IID,                               /* 2 byte payload */
+
+  EVENT_IMS_VIDEOSHARE_REGISTRATION_SUCCESS,   /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_INVITE_SENT,            /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_INCOMING_INVITE,        /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ACCEPT_REJECT_INVITE,   /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ACCEPTING_SESSION,      /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_SESSION_ESTABLISHED,    /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_END_SESSION,            /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_PREVIEW_VIDEO_FRAME,    /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_DECODED_VIDEO_FRAME,    /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_RECEIVING,              /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_START_APPLICATION,      /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_END_APPLICATION,        /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_CAPABILITY_SUCCESS,     /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_MEDIA_RECORDING_RESOURCE_ACQUIRED,   /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_MEDIA_RECORDING_RESOURCE_RELEASED,   /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_SENDING,                             /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_INCOMING_OPTION_RECEIVED,            /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_INCOMING_OPTION_RESPONDED,           /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_CALL_FAILED,                     /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_REGISTRATION_FAILED,             /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_RECORDER_ERROR,                  /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_PLAYER_ERROR,                    /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_MEDIA_SESSION_FAILURE,           /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_CAPABILITY_FAILURE,              /* 4 byte payload */
+  EVENT_IMS_VIDEOSHARE_ERR_MEDIA_RECORDING_FAILED,          /* 4 byte payload */
+
+  EVENT_WLAN_PE_FRAME,                     /* 16 byte payload */
+
+  EVENT_SNS_VCPS_HEADING_COMPUTED,         /* 12 byte payload */ 
+  EVENT_SNS_VCPS_TRACKED_CAL_SET_SAVED,    /* 22 byte payload */ 
+
+  EVENT_GNSS_PRESC_DWELL_COMPLETE,         /* 2 byte payload */ 
+
+  EVENT_LTE_MAC_RESET,                     /* 1 byte payload */ 
+  EVENT_LTE_BSR_SR_REQUEST,                /* 1 byte payload */ 
+  EVENT_LTE_MAC_TIMER,                     /* 2 byte payload */ 
+
+  EVENT_CM_DS_OPERATIONAL_MODE,            /* 2 byte payload */
+  EVENT_CM_DS_MODE_PREF,                   /* 5 byte payload */
+  EVENT_CM_DS_GW_ACQ_ORDER_PREF,           /* 5 byte payload */
+  EVENT_CM_DS_SRV_DOMAIN_PREF,             /* 5 byte payload */
+  EVENT_CM_DS_BAND_PREF,                   /* 5 byte payload */
+  EVENT_CM_DS_ROAM_PREF,                   /* 5 byte payload */
+  EVENT_CM_DS_HYBRID_PREF,                 /* 5 byte payload */
+  EVENT_CM_DS_NETWORK_SEL_MODE_PREF,       /* 5 byte payload */
+  EVENT_CM_DS_CALL_EVENT_ORIG,             /* 4 byte payload */
+  EVENT_CM_DS_CALL_EVENT_CONNECT,          /* 4 byte payload */
+  EVENT_CM_DS_CALL_EVENT_END,              /* 3 byte payload */
+  EVENT_CM_DS_ENTER_EMERGENCY_CB,          /* 1 byte payload */
+  EVENT_CM_DS_EXIT_EMERGENCY_CB,           /* 1 byte payload */
+  EVENT_CM_DS_CALL_STATE,                  /* 2 byte payload */
+  EVENT_CM_DS_DS_INTERRAT_STATE,           /* 3 byte payload */
+  EVENT_CM_DS_CELL_SRV_IND,                /* 6 byte payload */
+  EVENT_CM_DS_COUNTRY_SELECTED,            /* 3 byte payload */
+  EVENT_CM_DS_DATA_AVAILABLE,              /* 2 byte payload */
+  EVENT_CM_DS_SELECT_COUNTRY,              /* 8 byte payload */
+  EVENT_CM_DS_CALL_EVENT_ORIG_THR,         /* 4 byte payload */
+  EVENT_CM_DS_PLMN_FOUND,                  /* 13 byte payload */
+  EVENT_CM_DS_SERVICE_CONFIRMED,           /* 13 byte payload */
+  EVENT_CM_DS_GET_PASSWORD_IND,            /* 3 byte payload */
+  EVENT_CM_DS_PASSWORD_AUTHENTICATION_STATUS, /* 3 byte payload */
+  EVENT_CM_DS_USS_RESPONSE_NOTIFY_IND,     /* 4 byte payload */
+  EVENT_CM_DS_LCS_MOLR_CONF,               /* 2 byte payload */
+
+  EVENT_DS_NAS_MESSAGE_SENT,               /* 5 byte payload */ 
+  EVENT_DS_NAS_MESSAGE_RECEIVED,           /* 5 byte payload */  
+  EVENT_DS_MM_STATE,                       /* 3 byte payload */ 
+  EVENT_DS_GMM_STATE,                      /* 3 byte payload */ 
+  EVENT_DS_PLMN_INFORMATION,               /* 10 byte payload */ 
+
+  EVENT_DIAG_STRESS_TEST_COMPLETED,        /* 4 byte payload */ 
+
+  EVENT_GNSS_CC_STATUS,                    /* 2 byte payload */ 
+
+  EVENT_SNS_USER_STATE_CHANGE,             /* 6 byte payload */ 
+
+  EVENT_DS_HPLMN_TIMER_EXPIRED,            /* 1 byte payload */  
+  EVENT_DS_RAT_CHANGE,                     /* 2 byte payload */ 
+
+  EVENT_DTV_CMMB_API_CALL_ACTIVATE,               /*9 byte payload*/ /*ID=1757*/ 
+  EVENT_DTV_CMMB_API_CALL_DEACTIVATE,           /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_TUNE,                     /*13 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_SELECT_SERVICE,     /*11 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_DESELECT_SERVICE,  /*11 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_SIGNAL_PARAMETERS,      /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_NIT,                /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_CMCT,             /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_SMCT,             /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_CSCT,             /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_SSCT,             /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_EADT,             /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_REQUEST_CA_CARD_NUMBER,   /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_REQUEST_CAS_ID,                 /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_REGISTER_FOR_CONTROL_NOTIFICATIONS,         /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_DEREGISTER_FROM_CONTROL_NOTIFICATIONS,   /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_ACTIVATE,               /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_DEACTIVATE,           /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_TUNE,      /*13 byte payload*/ 
+  EVENT_DTV_CMMB_API_NOTIFICATION_SELECT_SERVICE,     /*11 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_DESELECT_SERVICE,  /*11 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_TABLE_UPDATE,        /*6 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_SIGNAL_PARAMETERS,/*14 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_AUTHORIZATION_FAILURE,                 /*11 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_REGISTER_FOR_CONTROL_NOTIFICATIONS_COMPLETE,      /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_DEREGISTER_FROM_CONTROL_NOTIFICATIONS_COMPLETE, /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_CA_CARD_NUMBER,   /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_CAS_ID,                 /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_EMERGENCY_BROADCASTING_TRIGGER, /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_EMERGENCY_BROADCASTING_MESSAGE,/*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_REGISTER_FOR_ESG_NOTIFICATIONS,                /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_DEREGISTER_FROM_ESG_NOTIFICATIONS,          /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_GET_BASIC_DESCRIPTION_INFORMATION,          /*9 byte payload*/
+  EVENT_DTV_CMMB_API_CALL_SET_OUTPUT_PATH,/*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_ESG_DATA_INFORMATION,                  /*6 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_ESG_DATA_INFORMATION_DOWNLOAD_COMPLETE,         /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_ESG_PROGRAM_INDICATION_INFORMATION,                   /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_REGISTER_FOR_ESG_NOTIFICATIONS_COMPLETE,           /*9 byte payload*/
+  EVENT_DTV_CMMB_API_NOTIFICATION_DEREGISTER_FROM_ESG_NOTIFICATIONS_COMPLETE,     /*9 byte payload*/
+  EVENT_DTV_CMMB_CAS_INITIALIZED,                 /*9 byte payload*/
+  EVENT_DTV_CMMB_CAS_EMM_RECEIVED_AND_PROCESSED,    /*9 byte payload*/
+  EVENT_DTV_CMMB_CAS_ECM_RECEIVED_AND_PROCESSED,    /*11 byte payload*/ /*ID=1798*/
+  
+  EVENT_ECALL_START,                                      /*3 byte payload*/ 
+  EVENT_ECALL_STOP,                                       /*1 byte payload*/ 
+  EVENT_ECALL_SESSION_START,                        /*1 byte payload*/
+  EVENT_ECALL_SESSION_FAILURE,                      /*1 byte payload*/
+  EVENT_ECALL_SESSION_COMPLETE,                   /*3 byte payload*/
+  EVENT_ECALL_SESSION_RESET,                        /*1 byte payload*/
+  EVENT_ECALL_PSAP_MSD_DECODE_SUCCESS,     /*2 byte payload*/
+  EVENT_ECALL_PSAP_LOST_SYNC,                     /*1 byte payload*/ /*ID = 1806*/
+
+  EVENT_LTE_RRC_IRAT_REDIR_FROM_EUTRAN_START, /*1 byte payload */
+  EVENT_LTE_RRC_IRAT_REDIR_FROM_EUTRAN_END,    /* 2 byte payload */ /*ID = 1808*/
+
+  EVENT_GPRS_DS_CELL_CHANGE_ORDER,            /* 2 byte payload */ /*1809*/
+  EVENT_GSM_DS_CELL_SELECTION_END,            /* 2 byte payload */ /*1810*/
+  EVENT_GSM_DS_L1_STATE,                      /* 2 byte payload */ /*1811*/
+  EVENT_GSM_DS_PLMN_LIST_START,               /* 2 byte payload */ /*1812*/
+  EVENT_GSM_DS_PLMN_LIST_END,                 /* 1 byte payload */ /*1813*/
+  EVENT_GSM_DS_POWER_SCAN_STATUS,             /* 2 byte payload */ /*1814*/
+  EVENT_GSM_DS_RESELECT_START,                /* 2 byte payload */ /*1815*/
+  EVENT_GSM_DS_RR_IN_SERVICE,                 /* 1 byte payload */ /*1816*/
+  EVENT_GSM_DS_RR_OUT_OF_SERVICE,             /* 1 byte payload */ /*1817*/
+  EVENT_GSM_DS_TIMER_EXPIRED,                 /* 3 byte payload */ /*1818*/
+  EVENT_GSM_DS_TO_WCDMA_RESELECT_END,         /* 6 byte payload */ /*1819*/
+
+  EVENT_CM_DS_SYSTEM_MODE,                    /*2 byte payload*/ /*1820*/
+  EVENT_SD_DS_EVENT_ACTION,                   /*9 byte payload*/ /*1821*/
+  EVENT_SMGMM_DS_REQUEST_SENT,                /*3 byte payload*/ /*1822*/
+
+  EVENT_IFACE,                                /*4 byte payload*/ /*1823*/
+  EVENTS_DS_GSM_L1_ALIGN_VFR = 0x720,
+  EVENTS_DS_GSM_L1_STATE = 0x721,
+  EVENTS_DS_GSM_RATSCCH_IN_DTX = 0x722,
+  EVENTS_DS_GSM_FACCH_IN_DTX = 0x723,
+  EVENTS_DS_GSM_FACCH_AND_RATSCCH_COLLISION = 0x724,
+  EVENTS_DS_GSM_FACCH_AND_SID_UPDATE_COLLISION = 0x725,
+  EVENTS_DS_GSM_RATSCCH_AND_SID_UPDATE_COLLISION = 0x726,
+  EVENTS_DS_GSM_AMR_STATE_CHANGE = 0x727,
+  EVENTS_DS_GSM_RATSCCH_CMI_PHASE_CHANGE = 0x728,
+  EVENTS_DS_GSM_RATSCCH_REQ_ACT_TIMER_EXPIRY = 0x729,
+  EVENTS_DS_GSM_RATSCCH_ACK_ACT_TIMER_EXPIRY = 0x72a,
+  EVENTS_DS_GSM_AMR_RATSCCH_REQ = 0x72b,
+  EVENTS_DS_GSM_AMR_RATSCCH_RSP = 0x72c,
+  EVENTS_DS_GSM_AMR_CMC_TURNAROUND_TIME = 0x72d,
+  EVENTS_DS_GPRS_SMGMM_MSG_RECEIVED = 0x72e,
+  EVENTS_DS_GPRS_SMGMM_MSG_SENT = 0x72f,
+  EVENTS_DS_GPRS_LLC_READY_TIMER_START = 0x730,
+  EVENTS_DS_GPRS_LLC_READY_TIMER_END = 0x731,
+  EVENTS_DS_PACKET_TIMESLOT_RECONFIGURE = 0x732,
+  EVENTS_DS_GPRS_MAC_MSG_RECEIVED = 0x733,
+  EVENTS_DS_GPRS_MAC_MSG_SENT = 0x734,
+  EVENTS_DS_GPRS_MAC_CAMPED_ON_CELL = 0x735,
+  EVENTS_DS_GPRS_CELL_CHANGE_FAILURE = 0x736,
+  EVENTS_DS_GPRS_PACKET_CHANNEL_REQUEST = 0x737,
+  EVENTS_DS_GPRS_PACKET_UPLINK_ASSIGNMENT = 0x738,
+  EVENTS_DS_GPRS_PACKET_DOWNLINK_ASSIGNMENT = 0x739,
+  EVENTS_DS_GPRS_TBF_RELEASE = 0x73a,
+  EVENTS_DS_GPRS_TIMER_EXPIRY = 0x73b,
+  EVENTS_DS_GPRS_PACKET_RESOURCE_REQUEST = 0x73c,
+  EVENTS_DS_RANDOM_ACCESS_REQUEST = 0x73d,
+  EVENTS_DS_GSM_HANDOVER_START = 0x73e,
+  EVENTS_DS_GSM_HANDOVER_END = 0x73f,
+  EVENTS_DS_GSM_RESELECT_START = 0x740,
+  EVENTS_DS_GSM_RESELECT_END = 0x741,
+  EVENTS_DS_GSM_TO_WCDMA_RESELECT_END = 0x742,
+  EVENTS_DS_GSM_MESSAGE_RECEIVED = 0x743,
+  EVENTS_DS_GSM_RR_IN_SERVICE = 0x744,
+  EVENTS_DS_GSM_RR_OUT_OF_SERVICE = 0x745,
+  EVENTS_DS_GSM_PAGE_RECEIVED = 0x746,
+  EVENTS_DS_GSM_CAMP_ATTEMPT_START = 0x747,
+  EVENTS_DS_GSM_CAMP_ATTEMPT_END = 0x748,
+  EVENTS_DS_GSM_CALL_DROP = 0x749,
+  EVENTS_DS_GSM_ACCESS_FAILURE = 0x74a,
+  EVENTS_DS_GSM_CELL_SELECTION_START = 0x74b,
+  EVENTS_DS_GSM_CELL_SELECTION_END = 0x74c,
+  EVENTS_DS_GSM_POWER_SCAN_STATUS = 0x74d,
+  EVENTS_DS_GSM_PLMN_LIST_START = 0x74e,
+  EVENTS_DS_GSM_PLMN_LIST_END = 0x74f,
+  EVENTS_DS_GSM_AMR_MULTIRATE_IE = 0x750,
+  EVENTS_DS_GPRS_LINK_FAILURE = 0x751,
+  EVENTS_DS_GPRS_PAGE_RECEIVED = 0x752,
+  EVENTS_DS_GPRS_SURROUND_SEARCH_START = 0x753,
+  EVENTS_DS_GPRS_SURROUND_SEARCH_END = 0x754,
+  EVENTS_DS_GPRS_EARLY_CAMPING = 0x755,
+  EVENTS_DS_GSM_LINK_FAILURE = 0x756,
+
+
+  EVENT_MTP_FILE_DELETED = 0x757,
+  EVENT_MTP_PLAYLIST_REMOVED_OBJECT = 0x758,
+  EVENT_MTP_SYNC_STARTED = 0x759,
+  EVENT_MTP_SYNC_FINISHED = 0x75a,
+  EVENT_MTP_SAVE_ALBUMART_STARTED = 0x75b,
+  EVENT_MTP_SAVE_ALBUMART_FINISHED = 0x75c,
+  EVENT_MTP_FORMAT_STORE_STARTED = 0x75d,
+  EVENT_MTP_FORMAT_STORE_DONE = 0x75e,
+  EVENT_MTP_FORMAT_STORE_ERROR = 0x75f,
+  EVENT_LTE_RRC_SECURITY_CONFIG = 0x760,
+  EVENT_LTE_RRC_IRAT_RESEL_FROM_EUTRAN_START = 0x761,
+  EVENT_LTE_RRC_IRAT_RESEL_FROM_EUTRAN_END = 0x762,
+  EVENT_SNS_REST_DETECT_ACCEL_ACTIVE_TS = 0x763,
+  EVENT_SNS_REST_DETECT_ACCEL_STOP_TS = 0x764,
+  EVENT_CPC_CONFIG_ACTION = 0x765,
+  EVENT_FDPCH_CONFIG_ACTION = 0x766,
+  EVENT_SNS_DRV_MOTION_DETECT_SIG = 0x767,
+  EVENT_SNS_DRV_OPMODE_CHANGE = 0x768,
+
+  EVENT_NEXT_UNUSED_EVENT,
+  EVENT_RSVD_START = 0x0800,
+  EVENT_RSVD_END   = 0x083F,
+  EVENT_LAST_ID    = 0x083F,
+
+  EVENT_MAX_ID     = 0x0FFF
+} event_id_enum_type;
+
+
+#endif /* EVENT_DEFS_H */
diff --git a/CORE/VOSS/inc/i_vos_diag_core_event.h b/CORE/VOSS/inc/i_vos_diag_core_event.h
new file mode 100644
index 0000000..0085505
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_diag_core_event.h
@@ -0,0 +1,92 @@
+/*
+ * 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( __I_VOS_DIAG_CORE_EVENT_H )
+#define __I_VOS_DIAG_CORE_EVENT_H
+
+/**=========================================================================
+  
+  \file  i_vos_diag_core_event.h
+  
+  \brief Android specific definitions for vOSS DIAG events
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include <event_defs.h>
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+
+void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPayload);
+/*---------------------------------------------------------------------------
+  Allocate an event payload holder
+---------------------------------------------------------------------------*/
+#define WLAN_VOS_DIAG_EVENT_DEF( payload_name, payload_type ) \
+           payload_type(payload_name)                         
+
+/*---------------------------------------------------------------------------
+  Report the event
+---------------------------------------------------------------------------*/
+#define WLAN_VOS_DIAG_EVENT_REPORT( payload_ptr, ev_id ) \
+   do                                                    \
+   {                                                     \
+       vos_event_report_payload( ev_id,                  \
+                              sizeof( *(payload_ptr) ),  \
+                              (void *)(payload_ptr) );   \
+                                                       \
+   } while (0)
+
+#else /* FEATURE_WLAN_DIAG_SUPPORT */
+
+#define WLAN_VOS_DIAG_EVENT_DEF( payload_name, payload_type ) 
+#define WLAN_VOS_DIAG_EVENT_REPORT( payload_ptr, ev_id ) 
+
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_DIAG_CORE_EVENT_H
diff --git a/CORE/VOSS/inc/i_vos_diag_core_log.h b/CORE/VOSS/inc/i_vos_diag_core_log.h
new file mode 100644
index 0000000..90ac438
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_diag_core_log.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.
+ */
+
+#if !defined( __I_VOS_DIAG_CORE_LOG_H )
+#define __I_VOS_DIAG_CORE_LOG_H
+
+/**=========================================================================
+  
+  \file  i_vos_diag_core_event.h
+  
+  \brief android-specific definitions for vOSS DIAG logs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_memory.h>
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+#include <log_codes.h>
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+//FIXME To be removed when DIAG support is added. This definiton should be
+//picked from log.h file above. 
+typedef struct
+{
+  /* Specifies the length, in bytes of the entry, including this header. */
+    v_U16_t len;
+  
+  /* Specifies the log code for the entry*/
+    v_U16_t code; 
+
+  /*Time Stamp lo*/
+    v_U32_t ts_lo;
+  
+   /*Time Stamp hi*/
+    v_U32_t ts_hi;
+}__attribute__((packed)) log_hdr_type;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+void vos_log_set_code (v_VOID_t *ptr, v_U16_t code);
+void vos_log_set_length (v_VOID_t *ptr, v_U16_t length);
+void vos_log_set_timestamp (v_VOID_t *plog_hdr_ptr);
+void vos_log_submit(v_VOID_t *plog_hdr_ptr);
+
+/*---------------------------------------------------------------------------
+  Allocate an event payload holder
+---------------------------------------------------------------------------*/
+
+#define WLAN_VOS_DIAG_LOG_ALLOC( payload_ptr, payload_type, log_code ) \
+           do \
+           {  \
+              payload_ptr = ( payload_type *)vos_mem_malloc(sizeof(payload_type));\
+                                                                              \
+              if( payload_ptr )                                                \
+              {                                                                \
+                 vos_mem_zero(payload_ptr, sizeof(payload_type));              \
+                 vos_log_set_code(payload_ptr, log_code);                      \
+                 vos_log_set_length(payload_ptr, sizeof(payload_type));        \
+              }                                                                \
+           } while (0)
+
+/*---------------------------------------------------------------------------
+  Report the event
+---------------------------------------------------------------------------*/
+#define WLAN_VOS_DIAG_LOG_REPORT( payload_ptr ) \
+    do                                          \
+    {                               \
+       if( payload_ptr)              \
+       {                             \
+          vos_log_submit( payload_ptr);  \
+          vos_mem_free(payload_ptr); \
+       }                             \
+    } while (0)
+    
+/*---------------------------------------------------------------------------
+  Free the payload
+---------------------------------------------------------------------------*/
+#define WLAN_VOS_DIAG_LOG_FREE( payload_ptr ) \
+    do                                          \
+    {                               \
+       if( payload_ptr)              \
+       {                             \
+          vos_mem_free(payload_ptr); \
+       }                             \
+    } while (0)
+    
+
+#else /* FEATURE_WLAN_DIAG_SUPPORT */
+
+#define WLAN_VOS_DIAG_LOG_ALLOC( payload_ptr, payload_type, log_code ) 
+#define WLAN_VOS_DIAG_LOG_REPORT( payload_ptr ) 
+#define WLAN_VOS_DIAG_LOG_FREE( payload_ptr )
+
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_DIAG_CORE_LOG_H
diff --git a/CORE/VOSS/inc/i_vos_event.h b/CORE/VOSS/inc/i_vos_event.h
new file mode 100644
index 0000000..a51d407
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_event.h
@@ -0,0 +1,71 @@
+/*
+ * 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( __I_VOS_EVENT_H )
+#define __I_VOS_EVENT_H
+
+/**=========================================================================
+
+  \file  i_vos_event.h
+
+  \brief Linux-specific definitions for vOSS Events
+
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <linux/completion.h>
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#define LINUX_EVENT_COOKIE 0x12341234
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*--------------------------------------------------------------------------
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+typedef struct evt
+{
+   struct completion complete;
+   v_U32_t  cookie;
+} vos_event_t;
+
+/*-------------------------------------------------------------------------
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_EVENT_H
diff --git a/CORE/VOSS/inc/i_vos_list.h b/CORE/VOSS/inc/i_vos_list.h
new file mode 100644
index 0000000..603d323
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_list.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.
+ */
+
+#if !defined( __I_VOS_LIST_H )
+#define __I_VOS_LIST_H
+
+/**=========================================================================
+  
+  \file  i_vos_list.h
+  
+  \brief Linux-specific definitions for vOSS lists 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+#include <vos_packet.h>
+#include <linux/list.h>
+#include <linux/mutex.h>
+#include <linux/kernel.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+typedef struct vos_linux_list_s
+{
+   struct list_head anchor;
+   v_SIZE_t count;
+   struct mutex lock;
+   v_U32_t cookie;
+} vos_list_t;
+
+typedef struct list_head vos_list_node_t;
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_LIST_H
diff --git a/CORE/VOSS/inc/i_vos_lock.h b/CORE/VOSS/inc/i_vos_lock.h
new file mode 100644
index 0000000..a596c3c
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_lock.h
@@ -0,0 +1,76 @@
+/*
+ * 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( __I_VOS_LOCK_H )
+#define __I_VOS_LOCK_H
+
+/**=========================================================================
+  
+  \file  i_vos_lock.h
+  
+  \brief Linux-specific definitions for vOSS Locks
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <linux/mutex.h>
+#include <linux/spinlock.h>
+#include <linux/sched.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+typedef struct vos_lock_s
+{
+   struct mutex m_lock;
+   v_U32_t cookie;
+   int processID;
+   v_U32_t state;
+   v_U8_t  refcount;
+} vos_lock_t;
+
+typedef spinlock_t vos_spin_lock_t;
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_LOCK_H
diff --git a/CORE/VOSS/inc/i_vos_packet.h b/CORE/VOSS/inc/i_vos_packet.h
new file mode 100644
index 0000000..68251de
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_packet.h
@@ -0,0 +1,263 @@
+/*
+ * 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( __I_VOS_PACKET_H )
+#define __I_VOS_PACKET_H
+
+/**=========================================================================
+
+  \file        i_vos_packet.h
+
+  \brief       virtual Operating System Servies (vOSS)
+
+   Network Protocol packet/buffer internal include file
+
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_list.h>
+#include <linux/skbuff.h>
+#include <linux/list.h>
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include <wlan_qct_pal_packet.h>
+#include <wlan_qct_wdi_ds.h>
+#endif
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+// Definitions for the various VOS packet pools.  Following are defines
+// for the SIZE and the NUMBER of vos packets in the vos packet pools.
+// Note that all of the code is written to allocate and manage the vos
+// packet pools based on these #defines only.  For example, if you want to
+// change the number of RX_RAW packets, simply change the #define that
+// defines the number of RX_RAW packets and rebuild VOSS.
+
+// the number of Receive vos packets used exclusively for vos packet
+// allocations of type VOS_PKT_TYPE_RX_RAW
+#define VPKT_NUM_RX_RAW_PACKETS (  512 )
+
+// the number of Transmit Management vos packets, used exclusively for
+// vos packet allocations of type VOS_PKT_TYPE_TX_802_11_MGMT
+#define VPKT_NUM_TX_MGMT_PACKETS (  6 )
+
+// the number of Transmit Data vos packets, used exclusively for
+// vos packet allocations of type VOS_PKT_TYPE_TX_802_3_DATA or
+// VOS_PKT_TYPE_TX_802_11_DATA
+#define VPKT_NUM_TX_DATA_PACKETS ( 128 )
+
+// the number of VOS Packets we need.  This is the memory we need to
+// allocate for the vos Packet structures themselves.  We need vos
+// packet structures for all of the packet types (RX_RAW, TX_MGMT, and
+// TX_DATA).
+#define VPKT_NUM_VOS_PKT_BUFFERS \
+                ( VPKT_NUM_RX_RAW_PACKETS \
+                + VPKT_NUM_TX_MGMT_PACKETS \
+                + VPKT_NUM_TX_DATA_PACKETS )
+
+// the number of Receive vos packets that we accumulate in the
+// replenish pool before we attempt to replenish them
+#define VPKT_RX_REPLENISH_THRESHOLD (  VPKT_NUM_RX_RAW_PACKETS >> 2 )
+
+// magic number which can be used to verify that a structure pointer being
+// dereferenced is really referencing a struct vos_pkt_t
+#define VPKT_MAGIC_NUMBER 0x56504B54  /* VPKT in ASCII */
+
+/*--------------------------------------------------------------------------
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+
+
+/// implementation specific vos packet type
+struct vos_pkt_t
+{
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+
+   //palPacket MUST be the first member of vos_pkt_t
+   wpt_packet palPacket;
+#endif
+
+   // Node for linking vos packets into a free list
+   struct list_head node;
+
+   // Node for chaining vos packets into a packet chain
+   struct vos_pkt_t *pNext;
+
+   // pointer to an OS specific packet descriptor
+   struct sk_buff *pSkb;
+
+   // packet type
+   VOS_PKT_TYPE packetType;
+
+   // timestamp
+   v_TIME_t timestamp;
+
+   // user data pointers
+   v_VOID_t *pvUserData[ VOS_PKT_USER_DATA_ID_MAX ];
+
+   // magic number for verifying this is really a struct vos_pkt_t
+   v_U32_t magic;
+};
+
+
+// Parameters from the vos_pkt_get_packet() call that needs
+// to be saved in 'low resource' conditions.  We need all the
+// parameters from the original call to vos_pkt_get_packet()
+// to resolve the packet request when one become available.
+typedef struct
+{
+   vos_pkt_get_packet_callback callback;
+
+   v_VOID_t *userData;
+
+   v_SIZE_t dataSize;
+   v_SIZE_t numPackets;
+   v_BOOL_t zeroBuffer;
+
+} vos_pkt_low_resource_info;
+
+
+
+// vOSS Packet Context - all context / internal data needed for the
+// vOSS pPacket module.  This consiste of:
+// - memory for the vos Packet structures
+// - memory for the vos Packet Head / Tail buffers
+// - memory for the Rx Raw data buffers
+// - memory for the Tx Mgmt data buffers.
+typedef struct vos_pkt_context_s
+{
+   // place to save the vos Context
+   v_CONTEXT_t vosContext;
+
+   // the memory for the vos Packet structures....
+   struct vos_pkt_t vosPktBuffers[ VPKT_NUM_VOS_PKT_BUFFERS ];
+
+   // These are the lists to keep the constructed VOS packets that are
+   // available for allocation.  There are separate free vos packet
+   // pools for RX_RAW without attached skb, RX_RAW with attached skb,
+   // TX_DATA, and TX_MGMT.
+   struct list_head rxReplenishList;
+   struct list_head rxRawFreeList;
+   struct list_head txDataFreeList;
+   struct list_head txMgmtFreeList;
+
+#ifdef WLAN_SOFTAP_FEATURE
+   //Existing list_size opearation traverse the list. Too slow for data path.
+   //Add the field to enable faster flow control on tx path
+   v_U32_t uctxDataFreeListCount;
+#endif
+
+   // We keep a separate count of the number of RX_RAW packets
+   // waiting to be replenished
+   v_SIZE_t rxReplenishListCount;
+
+   // These are the structs to keep low-resource callback information.
+   // There are separate low-resource callback information blocks for
+   // RX_RAW, TX_DATA, and TX_MGMT.
+   vos_pkt_low_resource_info rxRawLowResourceInfo;
+   vos_pkt_low_resource_info txDataLowResourceInfo;
+   vos_pkt_low_resource_info txMgmtLowResourceInfo;   
+
+   struct mutex mlock;
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /*Meta Information to be transported with the packet*/
+   WDI_DS_TxMetaInfoType txMgmtMetaInfo[VPKT_NUM_TX_MGMT_PACKETS];
+   WDI_DS_TxMetaInfoType txDataMetaInfo[VPKT_NUM_TX_DATA_PACKETS];
+   WDI_DS_RxMetaInfoType rxMetaInfo[VPKT_NUM_RX_RAW_PACKETS];
+#endif
+
+} vos_pkt_context_t;
+
+
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_packet_open() - initialize the vOSS Packet module
+
+  The \a vos_packet_open() function initializes the vOSS Packet
+  module.
+
+  \param  pVosContext - pointer to the global vOSS Context
+
+  \param  pVosPacketContext - pointer to a previously allocated
+          buffer big enough to hold the vos Packet context.
+
+  \param  vosPacketContextSize - the size allocated for the vos
+          packet context.
+
+  \return VOS_STATUS_SUCCESS - vos Packet module was successfully
+          initialized and is ready to be used.
+
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the vos Packet module
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize
+          the vos packet module
+
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the vos open
+          function
+
+          VOS_STATUS_E_FAILURE - Failure to initialize the vos packet
+          module
+
+  \sa vos_packet_close()
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_packet_open( v_VOID_t *pVosContext,
+                            vos_pkt_context_t *pVosPacketContext,
+                            v_SIZE_t vosPacketContextSize );
+
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_packet_close() - Close the vOSS Packet module
+
+  The \a vos_packet_close() function closes the vOSS Packet module
+  Upon successful close all resources allocated from the OS will be
+  relinquished.
+
+  \param  pVosContext - pointer to the global vOSS Context
+
+  \return VOS_STATUS_SUCCESS - Packet module was successfully closed.
+
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the packet
+          close function
+
+          VOS_STATUS_E_FAILURE - Failure to close the vos Packet module
+
+  \sa vos_packet_open()
+
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_packet_close( v_PVOID_t pVosContext );
+
+#endif  // !defined( __I_VOS_PACKET_H )
diff --git a/CORE/VOSS/inc/i_vos_timer.h b/CORE/VOSS/inc/i_vos_timer.h
new file mode 100644
index 0000000..8388bfe
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_timer.h
@@ -0,0 +1,78 @@
+/*
+ * 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( __I_VOS_TIMER_H )
+#define __I_VOS_TIMER_H
+
+/**=========================================================================
+  
+  \file  i_vos_timer.h
+  
+  \brief Linux-specific definitions for vOSS packets
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_timer.h>
+#include <vos_types.h>
+#include <linux/timer.h>
+#include <linux/time.h>
+#include <linux/jiffies.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+typedef struct vos_timer_platform_s
+{
+   struct timer_list Timer;
+   int threadID; 
+   v_U32_t cookie;
+   spinlock_t  spinlock;
+
+} vos_timer_platform_t;
+
+/*
+ * TODOs: Need to add deferred timer implementation 
+ *
+*/ 
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __I_VOS_TIMER_H
diff --git a/CORE/VOSS/inc/i_vos_trace.h b/CORE/VOSS/inc/i_vos_trace.h
new file mode 100644
index 0000000..35d7301
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_trace.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.
+ */
+
+
+#if !defined( __I_VOS_TRACE_H )
+#define __I_VOS_TRACE_H
+
+/**=========================================================================
+  
+  \file  i_vos_trace.h
+  
+  \brief Linux-specific definitions for VOSS trace
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+/**----------------------------------------------------------------------------
+  
+ \brief VOS_TRACE() / vos_trace_msg() - Trace / logging API
+   
+ Users wishing to add tracing information to their code should use 
+ VOS_TRACE.  VOS_TRACE() will compile into a call to vos_trace_msg() when
+ tracing is enabled.
+  
+ \param module - module identifier.   A member of the VOS_MODULE_ID
+                 enumeration that identifies the module issuing the trace message.
+         
+ \param level - trace level.   A member of the VOS_TRACE_LEVEL 
+                enumeration indicating the severity of the condition causing the
+                trace message to be issued.   More severe conditions are more 
+                likely to be logged.
+         
+   \param strFormat - format string.  The message to be logged.  This format
+                      string contains printf-like replacement parameters, which follow
+                      this parameter in the variable argument list.                    
+  
+   \return  nothing
+    
+  --------------------------------------------------------------------------*/
+void vos_trace_msg( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, char *strFormat, ... );
+
+void vos_trace_display(void);
+
+void vos_trace_setValue( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, v_U8_t on );
+
+
+// VOS_TRACE is the macro invoked to add trace messages to code.  See the 
+// documenation for vos_trace_msg() for the parameters etc. for this function.
+// 
+// NOTE:  Code VOS_TRACE() macros into the source code.  Do not code directly
+// to the vos_trace_msg() function.
+//
+// NOTE 2:  vos tracing is totally turned off if WLAN_DEBUG is *not* defined.
+// This allows us to build 'performance' builds where we can measure performance
+// without being bogged down by all the tracing in the code.
+#if defined( WLAN_DEBUG )
+#define VOS_TRACE vos_trace_msg
+#else
+#define VOS_TRACE(arg...) 
+#endif
+
+
+void vos_snprintf(char *strBuffer, unsigned  int size, char *strFormat, ...);
+#define VOS_SNPRINTF vos_snprintf
+
+#ifdef VOS_ENABLE_TRACING
+
+
+#define VOS_ASSERT( _condition )                          \
+if ( ! ( _condition ) )                                   \
+{                                                         \
+   printk(KERN_CRIT "VOS ASSERT in %s Line %d\n", __FUNCTION__, __LINE__); \
+   WARN_ON(1); \
+}
+
+#else 
+
+
+  // This code will be used for compilation if tracing is to be compiled out
+  // of the code so these functions/macros are 'do nothing'
+  VOS_INLINE_FN void vos_trace_msg( VOS_MODULE_ID module, ... ){}
+  
+  #define VOS_ASSERT( _condition )
+
+#endif
+
+#ifdef PANIC_ON_BUG
+
+#define VOS_BUG( _condition ) \
+if ( ! ( _condition ) )       \
+{                             \
+   printk(KERN_CRIT "VOS BUG in %s Line %d\n", __FUNCTION__, __LINE__); \
+   BUG_ON(1); \
+}
+
+#else
+
+#define VOS_BUG( _condition ) \
+if ( ! ( _condition ) )       \
+{                             \
+   printk(KERN_CRIT "VOS BUG in %s Line %d\n", __FUNCTION__, __LINE__); \
+   WARN_ON(1); \
+}
+
+#endif
+
+#endif
diff --git a/CORE/VOSS/inc/i_vos_types.h b/CORE/VOSS/inc/i_vos_types.h
new file mode 100644
index 0000000..a039b58
--- /dev/null
+++ b/CORE/VOSS/inc/i_vos_types.h
@@ -0,0 +1,208 @@
+/*
+ * 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( __I_VOS_TYPES_H )
+#define __I_VOS_TYPES_H
+#include <linux/list.h>
+#include <linux/mutex.h>
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/completion.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <asm/div64.h>
+
+/**=========================================================================
+  
+  \file  i_vos_Types.h
+  
+  \brief virtual Operating System Servies (vOSS) Types
+               
+   Linux specific basic type definitions 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+/*
+ * 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, ...)
+ *
+ */
+   
+// MACROs to help with compiler and OS specifics.  
+// \note: may need to get a little more sophisticated than this and define
+// these to specific 'VERSIONS' of the compiler and OS.  Until we have a 
+// need for that, lets go with this.
+#if defined( _MSC_VER )
+
+#define VOS_COMPILER_MSC
+#define VOS_OS_WINMOBILE    // assuming that if we build with MSC, OS is WinMobile
+
+#elif defined( __GNUC__ )
+
+#define VOS_COMPILER_GNUC
+#define VOS_OS_LINUX       // assuming if building with GNUC, OS is Linux
+
+#endif
+
+
+// VOS definitions (compiler specific) for Packing structures.  Note that the 
+// Windows compiler defines a way to pack a 'range' of code in a file.  To 
+// accomodate this, we have to include a file that has the packing #pragmas
+// These files are called
+// vos_pack_range_n_start.h where "n" is the packing aligment.  For example,
+// vos_pack_range_2_start.h is included in the file where you want to 
+// start packing on a 2 byte alignment.  vos_pack_range_end.h is included
+// in the file where you want to stop the packing.
+//
+// Other compilers allow packing individual strucutres so we have a series
+// of macros that are added to the structure to define the packing attributes.
+// For example, VOS_PACK_STRUCT_2 will add the attributes to pack an 
+// individual structure on a 2 byte boundary.  
+//
+// So what does a coder have to do to properly pack a structure for all the
+// supported compilers?  You have to add two includes around *all* the 
+// structures you want packed the same way and you also have to add the 
+// VOS_PACK_STRUCT_n macros to the individual structures.  
+//
+// For example to properly pack myStruct on a 2 byte boundary for all 
+// voss supported compilers, the following needs coded...
+//
+//
+// #include <vos_pack_range_2_start.h>
+//
+// typedef struct
+// {
+//   unsigned char c;
+//   long int i;
+// } myStruct VOS_PACK_STRUCT_2;
+//
+//
+// note... you can include other structure definitions in here that have the 
+// same 2 byte packing
+//
+// #include <vos_pack_range_end.h>
+
+
+// /todo: not sure what the flag is to identify the Microsoft compiler for WinMobile
+// Let's leave this out for now and just include the defintions for WinMobile.  Need
+// to address this when we move to support other operating systems.  Probably best to
+// define some of our own 'types' or preprocessor flags like VOS_COMPILER_TYPE, 
+// VOS_OS_TYPE, etc. and then all our code can base on those flags/types independent
+// of the operating system, compiler, etc.
+#if defined( VOS_COMPILER_MSC )
+
+
+#define VOS_INLINE_FN  __inline
+
+// does nothing on Windows.  packing individual structs is not 
+// supported on the Windows compiler.
+#define VOS_PACK_STRUCT_1
+#define VOS_PACK_STRUCT_2
+#define VOS_PACK_STRUCT_4
+#define VOS_PACK_STRUCT_8
+#define VOS_PACK_STRUCT_16
+
+#elif defined( VOS_COMPILER_GNUC )
+
+#define VOS_INLINE_FN  static inline
+
+#define VOS_PACK_STRUCT_1  __attribute__ ((aligned(1), packed))
+#define VOS_PACK_STRUCT_2  __attribute__ ((aligned(2), packed))
+#define VOS_PACK_STRUCT_4  __attribute__ ((aligned(4), packed))
+#define VOS_PACK_STRUCT_8  __attribute__ ((aligned(8), packed))
+#define VOS_PACK_STRUCT_16 __attribute__ ((aligned(16), packed))
+
+#else
+#error "Compiling with an unknown compiler!!"
+#endif
+
+ 
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/// unsigned 8-bit types
+typedef unsigned char v_U8_t;
+typedef unsigned char v_UCHAR_t;
+typedef unsigned char v_BYTE_t;
+
+/// unsigned 16-bit types
+typedef unsigned short v_U16_t;
+typedef unsigned short v_USHORT_t;
+
+/// unsigned 32-bit types
+typedef unsigned long  v_U32_t;
+// typedef atomic_t v_U32AT_t;
+typedef unsigned long  v_ULONG_t;
+
+/// unsigned 64-bit types
+typedef long long v_U64_t;
+
+/// unsigned integer types
+typedef unsigned int  v_UINT_t;
+
+/// signed 8-bit types
+typedef signed char  v_S7_t;
+typedef signed char  v_SCHAR_t;
+
+/// signed 16-bit types
+typedef signed short v_S15_t;
+typedef signed short v_SSHORT_t;
+
+/// signed 32-bit types
+typedef signed long v_S31_t;
+typedef signed long v_SLONG_t;
+
+/// signed integer types
+typedef signed int   v_SINT_t;
+                              
+/// Boolean types
+typedef unsigned char v_BOOL_t;
+
+/// void type
+#define v_VOID_t void
+
+#endif // __I_VOSS_TYPES_H
diff --git a/CORE/VOSS/inc/log_codes.h b/CORE/VOSS/inc/log_codes.h
new file mode 100644
index 0000000..2ee2a58
--- /dev/null
+++ b/CORE/VOSS/inc/log_codes.h
@@ -0,0 +1,2073 @@
+/*
+ * 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 LOG_CODES_H
+#define LOG_CODES_H
+
+/*===========================================================================
+
+                         Log Code Definitions
+
+General Description
+  This file contains log code definitions and is shared with the tools.
+
+Copyright (c) 1991-2010 by QUALCOMM, Inc.  All Rights Reserved.
+===========================================================================*/
+
+/* DO NOT MODIFY THIS FILE WITHOUT PRIOR APPROVAL
+**
+** Log codes, by design, are a tightly controlled set of values.  
+** Developers may not create log codes at will.
+**
+** Request new logs using the following process:
+**
+** 1. Send email to asw.diag.request requesting log codassignments.
+** 2. Identify the log needed by name.
+** 3. Provide a brief description for the log.
+**
+*/
+
+/*===========================================================================
+
+                             Edit History
+
+$Header: //source/qcom/qct/core/services/diag/api/inc/main/latest/log_codes.h#9 $
+   
+when       who     what, where, why
+--------   ---     ----------------------------------------------------------
+07/30/09   dhao    Consolidate log_codes_apps.h
+07/30/09   dhao    Add Last log code definition for Equip ID 11 
+06/26/09   dhao    Update format the macro
+06/24/09   sar     Reverted last change.
+06/24/09   sar     Added log code for LOG_MC_STM_C.
+11/02/01   sfh     Featurize common NAS log codes for UMTS.
+10/30/01   sfh     Added log code for LOG_GPS_FATPATH_INFO_C.
+10/24/01   sfh     Added updates for UMTS equipment ID and log codes.
+06/27/01   lad     Added multiple equipment ID support.
+05/22/01   sfh     Reserved log codes 158 - 168.
+05/21/01   sfh     Keep confusing XXX_BASE_C names for backwards compatibility.
+05/16/01   sfh     Reserved log code 155.
+05/08/01   sfh     Reserved log codes 150 - 154.
+04/06/01   lad     Added definitions of base IDs (such as LOG_WCDMA_BASE_C).
+                   This is currently using temporary ID values in the 0x1000 
+                   range.
+02/23/01   lad     Created file from DMSS log.h.  Log codes only
+
+===========================================================================*/
+#include <vos_types.h>
+
+/* -------------------------------------------------------------------------
+ * Data Declarations
+ * ------------------------------------------------------------------------- */
+
+/* -------------------------------------------------------------------------
+ * Log equipment IDs.
+ * The most significant 4 bits of the 16 bit log code is the equipment ID.
+ * Orignally, the mobile was to have an ID, and base stations and other 
+ * IDs.  As QCT technology diversifies, new equipment IDs are assigned to new
+ * technology areas.  0x2000 and 0x3000 are reserved for legacy reasons, so 
+ * the first 
+ * addition starts at 0x4000.
+ * ------------------------------------------------------------------------- */
+
+#define LOG_1X_BASE_C    ((v_U16_t) 0x1000)
+#define LOG_WCDMA_BASE_C ((v_U16_t) 0x4000)
+#define LOG_GSM_BASE_C   ((v_U16_t) 0x5000)
+#define LOG_LBS_BASE_C   ((v_U16_t) 0x6000)
+#define LOG_UMTS_BASE_C  ((v_U16_t) 0x7000)
+#define LOG_TDMA_BASE_C  ((v_U16_t) 0x8000)
+#define LOG_DTV_BASE_C   ((v_U16_t) 0xA000)
+#define LOG_APPS_BASE_C  ((v_U16_t) 0xB000)
+#define LOG_LTE_BASE_C   ((v_U16_t) (0xB000 + 0x0010))
+#define LOG_LTE_LAST_C   ((v_U16_t) 0xB1FF)
+#define LOG_WIMAX_BASE_C ((v_U16_t) 0xB400)
+#define LOG_DSP_BASE_C   ((v_U16_t) 0xC000)
+
+#define LOG_TOOLS_BASE_C ((v_U16_t) 0xF000)
+
+/* LOG_BASE_C is what was used before expanding the use of the equipment ID. 
+ * TODO: Once all targets are using the "core" diag system, this should be
+ * ommitted. */
+#define LOG_BASE_C LOG_1X_BASE_C 
+
+/* -------------------------------------------------------------------------
+ * Log Codes
+ *   These codes identify the kind of information contained in a log entry. 
+ *   They are used in conjunction with the 'code' field of the log entry 
+ *   header.  The data types associated with each code are defined below.
+ * ------------------------------------------------------------------------- */
+
+/* The upper 4 bits of the 16 bit log entry code specify which type
+ * of equipment created the log entry. */
+
+/* 0 Mobile Station temporal analyzer entry */
+#define LOG_TA_C                                       (0x0 + LOG_1X_BASE_C)
+
+/* 1 AGC values and closed loop power control entry */
+#define LOG_AGC_PCTL_C                                 (0x1 + LOG_1X_BASE_C)
+
+/* 2 Forward link frame rates and types entry */
+#define LOG_F_MUX1_C                                   (0x2 + LOG_1X_BASE_C)
+
+/* 3 Reverse link frame rates and types entry */
+#define LOG_R_MUX1_C                                   (0x3 + LOG_1X_BASE_C)
+
+/* 4 Access channel message entry */
+#define LOG_AC_MSG_C                                   (0x4 + LOG_1X_BASE_C)
+
+/* 5 Reverse link traffic channel message entry */
+#define LOG_R_TC_MSG_C                                 (0x5 + LOG_1X_BASE_C)
+                               
+/* 6 Sync channel message entry */
+#define LOG_SC_MSG_C                                   (0x6 + LOG_1X_BASE_C)
+
+/* 7 Paging channel message entry */ 
+#define LOG_PC_MSG_C                                   (0x7 + LOG_1X_BASE_C)
+
+/* 8 Forward link traffic channel message entry */
+#define LOG_F_TC_MSG_C                                 (0x8 + LOG_1X_BASE_C)
+
+/* 9 Forward link vocoder packet entry */
+#define LOG_VOC_FOR_C                                  (0x9 + LOG_1X_BASE_C)
+
+/* 10 Reverse link vocoder packet entry */
+#define LOG_VOC_REV_C                                  (0xA + LOG_1X_BASE_C)
+
+/* 11 Temporal analyzer finger info only */
+#define LOG_FING_C                                     (0xB + LOG_1X_BASE_C)
+
+/* 12 Searcher pathlog info (Reused old SRCH logtype) */
+#define LOG_SRCH_C                                     (0xC + LOG_1X_BASE_C)
+
+/* 13 Position and speed information read from ETAK */
+#define LOG_ETAK_C                                     (0xD + LOG_1X_BASE_C)
+
+/* 14 Markov frame statistics */
+#define LOG_MAR_C                                      (0xE + LOG_1X_BASE_C)
+
+/* 15 New and improved temporal analyzer searcher info */
+#define LOG_SRCH2_C                                    (0xF + LOG_1X_BASE_C)
+
+/* 16 The Fujitsu handset information */
+#define LOG_HANDSET_C                                  (0x10 + LOG_1X_BASE_C)
+
+/* 17 Vocoder bit error rate mask */
+#define LOG_ERRMASK_C                                  (0x11 + LOG_1X_BASE_C)
+
+/* 18 Analog voice channel information */
+#define LOG_ANALOG_INFO_C                              (0x12 + LOG_1X_BASE_C)
+
+/* 19 Access probe information */
+#define LOG_ACC_INFO_C                                 (0x13 + LOG_1X_BASE_C)
+
+/* 20 Position & speed info read from GPS receiver */
+#define LOG_GPS_C                                      (0x14 + LOG_1X_BASE_C)
+
+/* 21 Test Command information */
+#define LOG_TEST_CMD_C                                 (0x15 + LOG_1X_BASE_C)
+
+/* 22 Sparse (20ms) AGC / closed loop power control entry */
+#define LOG_S_AGC_PCTL_C                               (0x16 + LOG_1X_BASE_C)
+  
+/* 23 Notification of a band class change */
+#define LOG_BAND_CHANGE_C                              (0x17 + LOG_1X_BASE_C)
+
+/* 24 DM debug messages, if being logged via log services */
+#define LOG_DBG_MSG_C                                  (0x18 + LOG_1X_BASE_C)
+
+/* 25 General temporal analyzer entry */
+#define LOG_GENRL_TA_C                                 (0x19 + LOG_1X_BASE_C)
+
+/* 26 General temporal analyzer w/supplemental channels */
+#define LOG_GENRL_TA_SUP_CH_C                          (0x1A + LOG_1X_BASE_C)
+
+/* Featurization Removal requested by CMI 
+#ifdef FEATURE_PLT 
+*/
+
+/* 27 Decoder raw bits logging */
+#define LOG_PLT_C                                      (0x1B + LOG_1X_BASE_C)
+
+/* Featurization Removal requested by CMI
+#else
+27 EFS Usage Info - No implementation as yet 
+#define LOG_EFS_INFO_C                                 (0x1B + LOG_1X_BASE_C)
+#endif   
+*/
+
+/* 28 Analog Forward Channel */
+#define LOG_ANALOG_FORW_C                              (0x1C + LOG_1X_BASE_C)
+
+/* 29 Analog Reverse Channel */
+#define LOG_ANALOG_REVS_C                              (0x1D + LOG_1X_BASE_C)
+
+/* 30 Analog Handoff Entry */
+#define LOG_ANALOG_HANDOFF_C                           (0x1E + LOG_1X_BASE_C)
+
+/* 31 FM Slot Statistis entry */
+#define LOG_ANALOG_FMSLOT_C                            (0x1F + LOG_1X_BASE_C)
+  
+/* 32 FOCC Word Sync Count entry */
+#define LOG_ANALOG_WS_COUNT_C                          (0x20 + LOG_1X_BASE_C)
+
+/* 33 */
+#define LOG_RLP_PACKET_C                               (0x21 + LOG_1X_BASE_C)
+
+/* 34 */
+#define LOG_ASYNC_TCP_SEG_C                            (0x22 + LOG_1X_BASE_C)
+
+/* 35 */
+#define LOG_PACKET_DATA_IP_PACKETS_C                   (0x23 + LOG_1X_BASE_C)
+
+/* 36 */
+#define LOG_FNBDT_MESSAGE_LOG_C                        (0x24 + LOG_1X_BASE_C)
+
+/* Begin IS-2000 LOG features */
+ 
+/* 37 RLP RX Frames logging */ 
+#define LOG_RLP_RX_FRAMES_C                            (0x25 + LOG_1X_BASE_C)
+  
+/* 38 RLP TX Frames logging */
+#define LOG_RLP_TX_FRAMES_C                            (0x26 + LOG_1X_BASE_C)
+
+/* 39 Reserved for additions to RLP frames */
+#define LOG_RLP_RSVD1_C                                (0x27 + LOG_1X_BASE_C)
+
+/* 40 Reserved for additions to RLP frames */
+#define LOG_RLP_RSVD2_C                                (0x28 + LOG_1X_BASE_C)
+
+/* 41 Forward Link Frame Types logging */
+#define LOG_FWD_FRAME_TYPES_C                          (0x29 + LOG_1X_BASE_C)
+  
+/* 42 Reverse Link Frame Types logging */
+#define LOG_REV_FRAME_TYPES_C                          (0x2A + LOG_1X_BASE_C)
+  
+/* 43 Fast Forward Power Control Parameters logging */
+#define LOG_FFWD_PCTRL_C                               (0x2B + LOG_1X_BASE_C)
+
+/* 44 Reverse Power Control Parameters logging */
+#define LOG_REV_PCTRL_C                                (0x2C + LOG_1X_BASE_C)
+
+/* 45 Searcher and Finger Information logging */
+#define LOG_SRCH_FING_INFO_C                           (0x2D + LOG_1X_BASE_C)
+  
+/* 46 Service Configuration logging */
+#define LOG_SVC_CONFIG_C                               (0x2E + LOG_1X_BASE_C)
+  
+/* 47 Active Set Configuration logging */
+#define LOG_ASET_CONFIG_C                              (0x2F + LOG_1X_BASE_C)
+
+/* 48 Quick Paging Channel logging */
+#define LOG_QPCH_C                                     (0x30 + LOG_1X_BASE_C)
+
+/* 49 RLP Statistics logging */
+#define LOG_RLP_STAT_C                                 (0x31 + LOG_1X_BASE_C)
+
+/* 50 Simple Test Data Service Option logging */
+#define LOG_STDSO_C                                    (0x32 + LOG_1X_BASE_C)
+
+/* 51 Pilot Phase Measurement results logging */
+#define LOG_SRCH_PPM_RES_C                             (0x33 + LOG_1X_BASE_C)
+
+/* 52 Pilot Phase Measurement Data Base logging */
+#define LOG_SRCH_PPM_DB_C                              (0x34 + LOG_1X_BASE_C)
+
+/* 53 Pilot Phase Measurement search results logging */
+#define LOG_SRCH_PPM_C                                 (0x35 + LOG_1X_BASE_C)
+
+/* 54 IS-801 forward link message */
+#define LOG_GPS_FWD_MSG_C                              (0x36 + LOG_1X_BASE_C)
+
+/* 55 IS-801 reverse link message */
+#define LOG_GPS_REV_MSG_C                              (0x37 + LOG_1X_BASE_C)
+
+/* 56 GPS search session statistics */
+#define LOG_GPS_STATS_MSG_C                            (0x38 + LOG_1X_BASE_C)
+
+/* 57 GPS search results */
+#define LOG_GPS_SRCH_PEAKS_MSG_C                       (0x39 + LOG_1X_BASE_C)
+
+/* 58 Factory Testmode logging */
+#define LOG_FTM_C                                      (0x3A + LOG_1X_BASE_C)
+
+/* 59 Multiple Peak Logging */
+#define LOG_SRCH_GPS_MULTI_PEAKS_INFO_C                (0x3B + LOG_1X_BASE_C)
+
+/* 60 Post processed search results logs */
+#define LOG_SRCH_GPS_POST_PROC_C                       (0x3C + LOG_1X_BASE_C)
+
+/* 61 FULL Test Data Service Option logging */
+#define LOG_FTDSO_C                                    (0x3D + LOG_1X_BASE_C)
+
+/* 62 Bluetooth logging */
+#define LOG_BT_RESERVED_CODES_BASE_C                   (0x3E + LOG_1X_BASE_C)
+/* Keep confusing name for backwards compatibility.  */
+#define LOG_BT_BASE_C LOG_BT_RESERVED_CODES_BASE_C
+
+/* 92 Bluetooth's last log code */
+#define LOG_BT_LAST_C                                  (30 + LOG_BT_RESERVED_CODES_BASE_C)
+
+/* 93 HDR log codes */
+#define LOG_HDR_RESERVED_CODES_BASE_C                  (0x5D + LOG_1X_BASE_C)
+/* Keep confusing name for backwards compatibility.  */
+#define LOG_HDR_BASE_C LOG_HDR_RESERVED_CODES_BASE_C
+
+/* 143 is HDR's last log code */
+#define LOG_HDR_LAST_C                                 (50 + LOG_HDR_RESERVED_CODES_BASE_C)
+
+/* 144 IS2000 DCCH Forward link channel */
+#define LOG_FOR_DCCH_MSG_C                             (0x90 + LOG_1X_BASE_C)
+#define LOG_DCCH_FWD_C                                 LOG_FOR_DCCH_MSG_C
+  
+/* 145 IS2000 DCCH Forward link channel */
+#define LOG_REV_DCCH_MSG_C                             (0x91 + LOG_1X_BASE_C)
+#define LOG_DCCH_REV_C                                 LOG_REV_DCCH_MSG_C
+
+/* 146 IS2000 DCCH Forward link channel */
+#define LOG_ZREX_C                                     (0x92 + LOG_1X_BASE_C)
+
+/* 147 Active set info logging, similar to ASET_CONFIG, but simpler.  */
+#define LOG_ASET_INFO_C                                (0x93 + LOG_1X_BASE_C)
+
+/* 148 Pilot Phase Measurement four-shoulder-search resutlts logging */
+#define LOG_SRCH_PPM_4SHOULDER_RES_C                   (0x94 + LOG_1X_BASE_C)
+
+/* 149 Extended Pilot Phase Measurement Data Base logging */
+#define LOG_SRCH_EXT_PPM_DB_C                          (0x95 + LOG_1X_BASE_C)
+
+/* 150 GPS Visit Parameters */
+#define LOG_GPS_VISIT_PARAMETERS_C                     (0x96 + LOG_1X_BASE_C)
+
+/* 151 GPS Measurement */
+#define LOG_GPS_MEASUREMENT_C                          (0x97 + LOG_1X_BASE_C)
+
+/* 152 UIM Data */
+#define LOG_UIM_DATA_C                                 (0x98 + LOG_1X_BASE_C)
+
+/* 153 STDSO plus P2 */
+#define LOG_STDSO_P2_C                                 (0x99 + LOG_1X_BASE_C)
+
+/* 154 FTDSO plus P2 */
+#define LOG_FTDSO_P2_C                                 (0x9A + LOG_1X_BASE_C)
+
+/* 155 Search PPM Statistics */
+#define LOG_SRCH_PPM_STATS_C                           (0x9B + LOG_1X_BASE_C)
+
+/* 156 PPP Tx Frames */
+#define LOG_PPP_TX_FRAMES_C                            (0x9C + LOG_1X_BASE_C)
+
+/* 157 PPP Rx Frames */
+#define LOG_PPP_RX_FRAMES_C                            (0x9D + LOG_1X_BASE_C)
+
+/* 158-187 SSL reserved log codes */
+#define LOG_SSL_RESERVED_CODES_BASE_C                  (0x9E + LOG_1X_BASE_C)
+#define LOG_SSL_LAST_C                                 (29 + LOG_SSL_RESERVED_CODES_BASE_C)
+
+/* 188-199 Puma reserved log codes */
+/* 188 QPCH, version 2 */
+#define LOG_QPCH_VER_2_C                               (0xBC + LOG_1X_BASE_C)
+
+/* 189 Enhanced Access Probe */
+#define LOG_EA_PROBE_C                                 (0xBD + LOG_1X_BASE_C)
+
+/* 190 BCCH Frame Information */
+#define LOG_BCCH_FRAME_INFO_C                          (0xBE + LOG_1X_BASE_C)
+
+/* 191 FCCCH Frame Information */
+#define LOG_FCCCH_FRAME_INFO_C                         (0xBF + LOG_1X_BASE_C)
+
+/* 192 FDCH Frame Information */
+#define LOG_FDCH_FRAME_INFO_C                          (0xC0 + LOG_1X_BASE_C)
+
+/* 193 RDCH Frame Information */
+#define LOG_RDCH_FRAME_INFO_C                          (0xC1 + LOG_1X_BASE_C)
+
+/* 194 FFPC Information */
+#define LOG_FFPC_INFO_C                                (0xC2 + LOG_1X_BASE_C)
+
+/* 195 RPC Information */
+#define LOG_RPC_INFO_C                                 (0xC3 + LOG_1X_BASE_C)
+
+/* 196 Searcher and Finger Information */
+#define LOG_SRCH_FING_INFO_VER_2_C                     (0xC4 + LOG_1X_BASE_C)
+
+/* 197 Service Configuration, version 2 */
+#define LOG_SRV_CONFIG_VER_2_C                         (0xC5 + LOG_1X_BASE_C)
+
+/* 198 Active Set Information, version 2 */
+#define LOG_ASET_INFO_VER_2_C                          (0xC6 + LOG_1X_BASE_C)
+
+/* 199 Reduced Active Set */
+#define LOG_REDUCED_ASET_INFO_C                        (0xC7 + LOG_1X_BASE_C)
+
+/* 200 Search Triage Info */
+#define LOG_SRCH_TRIAGE_INFO_C                         (0xC8 + LOG_1X_BASE_C)
+
+/* 201 RDA Frame Information */
+#define LOG_RDA_FRAME_INFO_C                           (0xC9 + LOG_1X_BASE_C)
+
+/* 202 gpsOne fatpath information */
+#define LOG_GPS_FATPATH_INFO_C                         (0xCA + LOG_1X_BASE_C)
+
+/* 203 Extended AGC */
+#define LOG_EXTENDED_AGC_C                             (0xCB + LOG_1X_BASE_C)
+
+/* 204 Transmit AGC */
+#define LOG_TRANSMIT_AGC_C                             (0xCC + LOG_1X_BASE_C)
+
+/* 205 I/Q Offset registers */
+#define LOG_IQ_OFFSET_REGISTERS_C                      (0xCD + LOG_1X_BASE_C)
+
+/* 206 DACC I/Q Accumulator registers */
+#define LOG_DACC_IQ_ACCUMULATOR_C                      (0xCE + LOG_1X_BASE_C)
+
+/* 207 Register polling results */
+#define LOG_REGISTER_POLLING_RESULTS_C                 (0xCF + LOG_1X_BASE_C)
+
+/* 208 System arbitration module */
+#define LOG_AT_SAM_C                                   (0xD0 + LOG_1X_BASE_C)
+
+/* 209 Diablo searcher finger log */
+#define LOG_DIABLO_SRCH_FING_INFO_C                    (0xD1 + LOG_1X_BASE_C)
+
+/* 210 log reserved for dandrus */
+#define LOG_SD20_LAST_ACTION_C                         (0xD2 + LOG_1X_BASE_C)
+
+/* 211 log reserved for dandrus */
+#define LOG_SD20_LAST_ACTION_HYBRID_C                  (0xD3 + LOG_1X_BASE_C)
+
+/* 212 log reserved for dandrus */
+#define LOG_SD20_SS_OBJECT_C                           (0xD4 + LOG_1X_BASE_C)
+
+/* 213 log reserved for dandrus */
+#define LOG_SD20_SS_OBJECT_HYBRID_C                    (0xD5 + LOG_1X_BASE_C)
+
+/* 214 log reserved for jpinos */
+#define LOG_BCCH_SIGNALING_C                           (0xD6 + LOG_1X_BASE_C)
+
+/* 215 log reserved for jpinos */
+#define LOG_REACH_SIGNALING_C                          (0xD7 + LOG_1X_BASE_C)
+
+/* 216 log reserved for jpinos */
+#define LOG_FCCCH_SIGNALING_C                          (0xD8 + LOG_1X_BASE_C)
+
+/* 217 RDA Frame Information 2 */
+#define LOG_RDA_FRAME_INFO_2_C                         (0xD9 + LOG_1X_BASE_C)
+
+/* 218 */
+#define LOG_GPS_BIT_EDGE_RESULTS_C                     (0xDA + LOG_1X_BASE_C)
+
+/* 219 */
+#define LOG_PE_DATA_C                                  (0xDB + LOG_1X_BASE_C)
+
+/* 220 */
+#define LOG_PE_PARTIAL_DATA_C                          (0xDC + LOG_1X_BASE_C)
+
+/* 221 */
+#define LOG_GPS_SINGLE_PEAK_SRCH_RESULTS_C             (0xDD + LOG_1X_BASE_C)
+
+/* 222 */
+#define LOG_SRCH4_SAMPRAM_C                            (0xDE + LOG_1X_BASE_C)
+
+/* 223 */
+#define HDR_AN_PPP_TX_FRAMES                           (0xDF + LOG_1X_BASE_C)
+
+/* 224 */
+#define HDR_AN_PPP_RX_FRAMES                           (0xE0 + LOG_1X_BASE_C)
+
+/* 225 */
+#define LOG_GPS_SCHEDULER_TRACE_C                      (0xE1 + LOG_1X_BASE_C)
+
+/* 226 */
+#define LOG_MPEG4_YUV_FRAME_C                          (0xE2 + LOG_1X_BASE_C)
+
+/* 227 */
+#define LOG_MPEG4_CLIP_STATS_C                         (0xE3 + LOG_1X_BASE_C)
+
+/* 228 */
+#define LOG_MPEG4_CLIP_STATS_VER2_C                    (0xE4 + LOG_1X_BASE_C)
+
+/* 226-241 MMEG reserved. */
+#define LOG_MPEG_RESERVED_CODES_BASE_C                 (0xF1 + LOG_1X_BASE_C)
+
+/* 242-274 BREW reserved log range */
+#define LOG_BREW_RESERVED_CODES_BASE_C                 (0xF2 + LOG_1X_BASE_C)
+#define LOG_BREW_LAST_C                                (32 + LOG_BREW_RESERVED_CODES_BASE_C)
+
+/* 275-339 PPP Extended Frames */
+#define LOG_PPP_FRAMES_RESERVED_CODES_BASE_C           (0x113 + LOG_1X_BASE_C)
+#define LOG_PPP_FRAMES_LAST_C                          (64 + LOG_PPP_FRAMES_RESERVED_CODES_BASE_C)
+
+#define LOG_PPP_EXT_FRAMED_RX_UM_C                     (0x113 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_FRAMED_RX_RM_C                     (0x114 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_FRAMED_RX_AN_C                     (0x115 + LOG_1X_BASE_C)
+
+#define LOG_PPP_EXT_FRAMED_TX_UM_C                     (0x123 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_FRAMED_TX_RM_C                     (0x124 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_FRAMED_TX_AN_C                     (0x125 + LOG_1X_BASE_C)
+
+#define LOG_PPP_EXT_UNFRAMED_RX_UM_C                   (0x133 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_UNFRAMED_RX_RM_C                   (0x134 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_UNFRAMED_RX_AN_C                   (0x135 + LOG_1X_BASE_C)
+
+#define LOG_PPP_EXT_UNFRAMED_TX_UM_C                   (0x143 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_UNFRAMED_TX_RM_C                   (0x144 + LOG_1X_BASE_C)
+#define LOG_PPP_EXT_UNFRAMED_TX_AN_C                   (0x145 + LOG_1X_BASE_C)
+
+/* 340 LOG_PE_DATA_EXT_C */
+#define LOG_PE_DATA_EXT_C                              (0x154 + LOG_1X_BASE_C)
+
+/* REX Subsystem logs */
+#define LOG_MEMDEBUG_C                                 (0x155 + LOG_1X_BASE_C)
+#define LOG_SYSPROFILE_C                               (0x156 + LOG_1X_BASE_C)
+#define LOG_TASKPROFILE_C                              (0x157 + LOG_1X_BASE_C)
+#define LOG_COREDUMP_C                                 (0x158 + LOG_1X_BASE_C)
+
+/* 341-349 REX subsystem logs */
+#define LOG_REX_RESERVED_CODES_BASE_C                  (0x155 + LOG_1X_BASE_C)
+#define LOG_REX_LAST_C                                 (8 + LOG_REX_RESERVED_CODES_BASE_C)
+
+/* 350 LOG_PE_PARTIAL_DATA_EXT_C */
+#define LOG_PE_PARTIAL_DATA_EXT_C                      (0x15E + LOG_1X_BASE_C)
+
+/* 351 LOG_DIAG_STRESS_TEST_C */
+#define LOG_DIAG_STRESS_TEST_C                         (0x15F + LOG_1X_BASE_C)
+
+/* 352  LOG_WMS_READ_C */
+#define LOG_WMS_READ_C                                 (0x160 + LOG_1X_BASE_C)
+
+/* 353 Search Triage Info Version 2 */
+#define LOG_SRCH_TRIAGE_INFO2_C                         (0x161 + LOG_1X_BASE_C)
+
+/* 354 RLP Rx FDCH Frames */
+#define LOG_RLP_RX_FDCH_FRAMES_C                        (0x162 + LOG_1X_BASE_C)
+
+
+/* 355 RLP Tx FDCH Frames */
+#define LOG_RLP_TX_FDCH_FRAMES_C                        (0x163 + LOG_1X_BASE_C)
+
+/* 356-371 QTV subsystem logs */
+#define LOG_QTV_RESERVED_CODES_BASE_C                   (0x164 + LOG_1X_BASE_C)
+#define LOG_QTV_LAST_C                                  (15 + LOG_QTV_RESERVED_CODES_BASE_C)
+
+/* 372 Searcher 4 1X */
+#define LOG_SRCH4_1X_C                                  (0x174 + LOG_1X_BASE_C)
+
+/* 373 Searcher sleep statistics */
+#define LOG_SRCH_SLEEP_STATS_C                          (0x175 + LOG_1X_BASE_C)
+
+/* 374 Service Configuration, version 3 */
+#define LOG_SRV_CONFIG_VER_3_C                          (0x176 + LOG_1X_BASE_C)
+
+/* 375 Searcher 4 HDR */
+#define LOG_SRCH4_HDR_C                                 (0x177 + LOG_1X_BASE_C)
+
+/* 376 Searcher 4 AFLT */
+#define LOG_SRCH4_AFLT_C                                (0x178 + LOG_1X_BASE_C)
+
+/* 377 Enhanced Finger Information */
+#define LOG_ENH_FING_INFO_C                             (0x179 + LOG_1X_BASE_C)
+
+/* 378 DV Information */
+#define LOG_DV_INFO_C                                   (0x17A + LOG_1X_BASE_C)
+
+/* 379 WMS set routes information */
+#define LOG_WMS_SET_ROUTES_C                            (0x17B + LOG_1X_BASE_C)
+
+/* 380 FTM Version 2 Logs */
+#define LOG_FTM_VER_2_C                                 (0x17C + LOG_1X_BASE_C)
+
+/* 381 GPS Multipeak logging */
+#define LOG_SRCH_GPS_MULTI_PEAKS_SIMPLIFIED_INFO_C      (0x17D + LOG_1X_BASE_C)
+
+/* 382 GPS Multipeak logging */
+#define LOG_SRCH_GPS_MULTI_PEAKS_VERBOSE_INFO_C         (0x17E + LOG_1X_BASE_C)
+
+/* 383-403 HDR reserved logs */
+#define LOG_HDR_RESERVED_CODES_BASE_2_C                 (0x17F + LOG_1X_BASE_C)
+#define LOG_HDR_LAST_2_C                                (20 + LOG_HDR_RESERVED_CODES_BASE_2_C)
+
+/* RLP Rx - PDCH partial MuxPDU5 frames */
+#define LOG_RLP_RX_PDCH_PARTIAL_MUXPDU5_FRAMES_C        (0x194 + LOG_1X_BASE_C)
+
+/* RLP Tx - PDCH partial MuxPDU5 frames */
+#define LOG_RLP_TX_PDCH_PARTIAL_MUXPDU5_FRAMES_C        (0x195 + LOG_1X_BASE_C)
+
+/* RLP Rx internal details */
+#define LOG_RLP_RX_INTERNAL_DETAILS_C                   (0x196 + LOG_1X_BASE_C)
+
+/* RLP Tx internal details */
+#define LOG_RLP_TX_INTERNAL_DETAILS_C                   (0x197 + LOG_1X_BASE_C)
+
+/* MPEG4 Clip Statistics version 3 */
+#define LOG_MPEG4_CLIP_STATS_VER3_C                     (0x198 + LOG_1X_BASE_C)
+
+/* Mobile IP Performance */
+#define LOG_MOBILE_IP_PERFORMANCE_C                     (0x199 + LOG_1X_BASE_C)
+
+/* 410-430 Searcher reserved logs */
+#define LOG_SEARCHER_RESERVED_CODES_BASE_C              (0x19A + LOG_1X_BASE_C)
+#define LOG_SEARCHER_LAST_2_C                           (21 + LOG_SEARCHER_RESERVED_CODES_BASE_C)
+
+/* 432-480 QTV reserved logs */
+#define LOG_QTV2_RESERVED_CODES_BASE_C                  (0x1B0 + LOG_1X_BASE_C)
+#define LOG_QTV2_LAST_C                                 (48 + LOG_QTV2_RESERVED_CODES_BASE_C)
+
+#define LOG_QTV_PDS2_STATS                              (0x1B6 + LOG_1X_BASE_C)
+#define LOG_QTV_PDS2_GET_REQUEST                        (0x1B7 + LOG_1X_BASE_C)
+#define LOG_QTV_PDS2_GET_RESP_HEADER                    (0x1B8 + LOG_1X_BASE_C)
+#define LOG_QTV_PDS2_GET_RESP_PCKT                      (0x1B9 + LOG_1X_BASE_C)
+#define LOG_QTV_CMX_AUDIO_INPUT_DATA_C                  (0x1BA + LOG_1X_BASE_C)
+#define LOG_QTV_RTSP_OPTIONS_C                          (0x1BB + LOG_1X_BASE_C)
+#define LOG_QTV_RTSP_GET_PARAMETER_C                    (0x1BC + LOG_1X_BASE_C)
+#define LOG_QTV_RTSP_SET_PARAMETER_C                    (0x1BD + LOG_1X_BASE_C)
+#define LOG_QTV_VIDEO_BITSTREAM                         (0x1BE + LOG_1X_BASE_C)
+#define LOG_ARM_VIDEO_DECODE_STATS                      (0x1BF + LOG_1X_BASE_C)
+#define LOG_QTV_DSP_SLICE_BUFFER_C                      (0x1C0 + LOG_1X_BASE_C)
+#define LOG_QTV_CMD_LOGGING_C                           (0x1C1 + LOG_1X_BASE_C)
+#define LOG_QTV_AUDIO_FRAME_PTS_INFO_C                  (0x1C2 + LOG_1X_BASE_C)
+#define LOG_QTV_VIDEO_FRAME_DECODE_INFO_C               (0x1C3 + LOG_1X_BASE_C)
+#define LOG_QTV_RTCP_COMPOUND_RR_C                      (0x1C4 + LOG_1X_BASE_C)
+#define LOG_QTV_FRAME_BUFFER_RELEASE_REASON_C           (0x1C5 + LOG_1X_BASE_C)
+#define LOG_QTV_AUDIO_CHANNEL_SWITCH_FRAME_C            (0x1C6 + LOG_1X_BASE_C)
+#define LOG_QTV_RTP_DECRYPTED_PKT_C                     (0x1C7 + LOG_1X_BASE_C)
+#define LOG_QTV_PCR_DRIFT_RATE_C                        (0x1C8 + LOG_1X_BASE_C)
+
+/* GPS PDSM logs */
+#define LOG_PDSM_POSITION_REPORT_CALLBACK_C             (0x1E1 + LOG_1X_BASE_C)
+#define LOG_PDSM_PD_EVENT_CALLBACK_C                    (0x1E2 + LOG_1X_BASE_C)
+#define LOG_PDSM_PA_EVENT_CALLBACK_C                    (0x1E3 + LOG_1X_BASE_C)
+#define LOG_PDSM_NOTIFY_VERIFY_REQUEST_C                (0x1E4 + LOG_1X_BASE_C)
+#define LOG_PDSM_RESERVED1_C                            (0x1E5 + LOG_1X_BASE_C)
+#define LOG_PDSM_RESERVED2_C                            (0x1E6 + LOG_1X_BASE_C)
+
+/* Searcher Demodulation Status log */
+#define LOG_SRCH_DEMOD_STATUS_C                         (0x1E7 + LOG_1X_BASE_C)
+
+/* Searcher Call Statistics log */
+#define LOG_SRCH_CALL_STATISTICS_C                      (0x1E8 + LOG_1X_BASE_C)
+
+/* GPS MS-MPC Forward link */
+#define LOG_MS_MPC_FWD_LINK_C                           (0x1E9 + LOG_1X_BASE_C)
+
+/* GPS MS-MPC Reverse link */
+#define LOG_MS_MPC_REV_LINK_C                           (0x1EA + LOG_1X_BASE_C)
+
+/* Protocol Services Data */
+#define LOG_DATA_PROTOCOL_LOGGING_C                     (0x1EB + LOG_1X_BASE_C)
+
+/* MediaFLO reserved log codes */
+#define LOG_MFLO_RESERVED_CODES_BASE_C                  (0x1EC + LOG_1X_BASE_C)
+#define LOG_MFLO_LAST_C                                 (99 + LOG_MFLO_RESERVED_CODES_BASE_C)
+
+/* GPS demodulation tracking header info */
+#define LOG_GPS_DEMOD_TRACKING_HEADER_C                 (0x250 + LOG_1X_BASE_C)
+
+/* GPS demodulation tracking results */
+#define LOG_GPS_DEMOD_TRACKING_C                        (0x251 + LOG_1X_BASE_C)
+
+/* GPS bit edge logs from demod tracking */
+#define LOG_GPS_DEMOD_BIT_EDGE_C                        (0x252 + LOG_1X_BASE_C)
+
+/* GPS demodulation soft decisions */
+#define LOG_GPS_DEMOD_SOFT_DECISIONS_C                  (0x253 + LOG_1X_BASE_C)
+
+/* GPS post-processed demod tracking results */
+#define LOG_GPS_DEMOD_TRACKING_POST_PROC_C              (0x254 + LOG_1X_BASE_C)
+
+/* GPS subframe log */
+#define LOG_GPS_DEMOD_SUBFRAME_C                        (0x255 + LOG_1X_BASE_C)
+
+/* F-CPCCH Quality Information */
+#define LOG_F_CPCCH_QUALITY_INFO_C                      (0x256 + LOG_1X_BASE_C)
+
+/* Reverse PDCCH/PDCH Frame Information */
+#define LOG_R_PDCCH_R_PDCH_FRAME_INFO_C                 (0x257 + LOG_1X_BASE_C)
+
+/* Forward G Channel Information */
+#define LOG_F_GCH_INFO_C                                (0x258 + LOG_1X_BASE_C)
+
+/* Forward G Channel Frame Information */
+#define LOG_F_GCH_FRAME_INFO_C                          (0x259 + LOG_1X_BASE_C)
+
+/* Forward RC Channel Information */
+#define LOG_F_RCCH_INFO_C                               (0x25A + LOG_1X_BASE_C)
+
+/* Forward ACK Channel Information */
+#define LOG_F_ACKCH_INFO_C                              (0x25B + LOG_1X_BASE_C)
+
+/* Forward ACK Channel ACKDA Information */
+#define LOG_F_ACKCH_ACKDA_C                             (0x25C + LOG_1X_BASE_C)
+
+/* Reverse REQ Channel Information */
+#define LOG_R_REQCH_INFO_C                              (0x25D + LOG_1X_BASE_C)
+
+/* Sleep Task Statistics */
+#define LOG_SLEEP_STATS_C                               (0x25E + LOG_1X_BASE_C)
+
+/* Sleep controller statistics 1X */
+#define LOG_1X_SLEEP_CONTROLLER_STATS_C                 (0x25F + LOG_1X_BASE_C)
+
+/* Sleep controller statistics HDR */
+#define LOG_HDR_SLEEP_CONTROLLER_STATS_C                (0x260 + LOG_1X_BASE_C)
+
+/* Sleep controller statistics GSM */
+#define LOG_GSM_SLEEP_CONTROLLER_STATS_C                (0x261 + LOG_1X_BASE_C)
+
+/* Sleep controller statistics WCDMA */
+#define LOG_WCDMA_SLEEP_CONTROLLER_STATS_C              (0x262 + LOG_1X_BASE_C)
+
+/* Sleep task and controller reserved logs */
+#define LOG_SLEEP_APPS_STATS_C                          (0x263 + LOG_1X_BASE_C)
+#define LOG_SLEEP_STATS_RESERVED2_C                     (0x264 + LOG_1X_BASE_C)
+#define LOG_SLEEP_STATS_RESERVED3_C                     (0x265 + LOG_1X_BASE_C)
+
+/* DV Information placeholder channel logs */
+#define LOG_PDCCH_LO_SELECTED_C                         (0x266 + LOG_1X_BASE_C)
+#define LOG_PDCCH_HI_SELECTED_C                         (0x267 + LOG_1X_BASE_C)
+#define LOG_WALSH_SELECTED_C                            (0x268 + LOG_1X_BASE_C)
+#define LOG_PDCH_BE_SELECTED_C                          (0x269 + LOG_1X_BASE_C)
+#define LOG_PDCCH_LLR_SELECTED_C                        (0x26A + LOG_1X_BASE_C)
+#define LOG_CQI_ACK_LO_SELECTED_C                       (0x26B + LOG_1X_BASE_C)
+#define LOG_CQI_ACK_HI_SELECTED_C                       (0x26C + LOG_1X_BASE_C)
+#define LOG_RL_GAIN_SELECTED_C                          (0x26D + LOG_1X_BASE_C)
+#define LOG_PDCCH0_SNDA_SELECTED_C                      (0x26E + LOG_1X_BASE_C)
+#define LOG_PDCCH1_SNDA_SELECTED_C                      (0x26F + LOG_1X_BASE_C)
+
+/* 624 WMS Message List */
+#define LOG_WMS_MESSAGE_LIST_C                          (0x270 + LOG_1X_BASE_C)
+
+/* 625 Multimode Generic SIM Driver Interface */
+#define LOG_MM_GENERIC_SIM_DRIVER_C                     (0x271 + LOG_1X_BASE_C)
+
+/* 626 Generic SIM Toolkit Task */
+#define LOG_GENERIC_SIM_TOOLKIT_TASK_C                  (0x272 + LOG_1X_BASE_C)
+
+/* 627 Call Manager Phone events log */
+#define LOG_CM_PH_EVENT_C                               (0x273 + LOG_1X_BASE_C)
+
+/* 628 WMS Set Message List */
+#define LOG_WMS_SET_MESSAGE_LIST_C                      (0x274 + LOG_1X_BASE_C)
+
+/* 629-704 HDR reserved logs */
+#define LOG_HDR_RESERVED_CODES_BASE_3_C                 (0x275 + LOG_1X_BASE_C)
+#define LOG_HDR_LAST_3_C                                (75 + LOG_HDR_RESERVED_CODES_BASE_3_C)
+
+/* 705 Call Manager call event log */
+#define LOG_CM_CALL_EVENT_C                             (0x2C1 + LOG_1X_BASE_C)
+
+/* 706-738 QVP reserved logs */
+#define LOG_QVP_RESERVED_CODES_BASE_C                   (0x2C2 + LOG_1X_BASE_C)
+#define LOG_QVP_LAST_C                                  (32 + LOG_QVP_RESERVED_CODES_BASE_C)
+
+/* 739 GPS PE Position Report log */
+#define LOG_GPS_PE_POSITION_REPORT_C                    (0x2E3 + LOG_1X_BASE_C)
+
+/* 740 GPS PE Position Report Extended log */
+#define LOG_GPS_PE_POSITION_REPORT_EXT_C                (0x2E4 + LOG_1X_BASE_C)
+
+/* 741 log */
+#define LOG_MDDI_HOST_STATS_C                           (0x2E5 + LOG_1X_BASE_C)
+
+/* GPS Decoded Ephemeris */
+#define LOG_GPS_DECODED_EPHEMERIS_C                     (0x2E6 + LOG_1X_BASE_C)
+ 
+/* GPS Decoded Almanac */
+#define LOG_GPS_DECODED_ALMANAC_C                       (0x2E7 + LOG_1X_BASE_C)
+
+/* Transceiver Resource Manager */
+#define LOG_TRANSCEIVER_RESOURCE_MGR_C                  (0x2E8 + LOG_1X_BASE_C)
+
+/* GPS Position Engine Info */
+#define LOG_GPS_POSITION_ENGINE_INFO_C                  (0x2E9 + LOG_1X_BASE_C)
+
+/* 746-810 RAPTOR reserved log range */
+#define LOG_RAPTOR_RESERVED_CODES_BASE_C                (0x2EA + LOG_1X_BASE_C)
+#define LOG_RAPTOR_LAST_C                               (64 + LOG_RAPTOR_RESERVED_CODES_BASE_C)
+
+/* QOS Specification Logging */
+
+/* QOS Requested Log */
+#define LOG_QOS_REQUESTED_C                             (0x32B + LOG_1X_BASE_C)
+
+/* QOS Granted Log */
+#define LOG_QOS_GRANTED_C                               (0x32C + LOG_1X_BASE_C)
+
+/* QOS State Log */
+#define LOG_QOS_STATE_C                                 (0x32D + LOG_1X_BASE_C)
+
+#define LOG_QOS_MODIFIED_C                              (0x32E + LOG_1X_BASE_C)
+
+#define LOG_QDJ_ENQUEUE_C                               (0x32F + LOG_1X_BASE_C)
+#define LOG_QDJ_DEQUEUE_C                               (0x330 + LOG_1X_BASE_C)
+#define LOG_QDJ_UPDATE_C                                (0x331 + LOG_1X_BASE_C)
+#define LOG_QDTX_ENCODER_C                              (0x332 + LOG_1X_BASE_C)
+#define LOG_QDTX_DECODER_C                              (0x333 + LOG_1X_BASE_C)
+
+#define LOG_PORT_ASSIGNMENT_STATUS_C                    (0x334 + LOG_1X_BASE_C)
+
+/* Protocol Services reserved log codes */
+#define LOG_PS_RESERVED_CODES_BASE_C                    (0x335 + LOG_1X_BASE_C)
+#define LOG_PS_LAST_C                                   (25 + LOG_PS_RESERVED_C)
+
+#define LOG_PS_STAT_IP_C                                (0x335 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_IPV4_C                       (0x335 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_IPV6_C                       (0x336 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_ICMPV4_C                     (0x337 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_ICMPV6_C                     (0x338 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_TCP_C                        (0x339 + LOG_1X_BASE_C)
+#define LOG_PS_STAT_GLOBAL_UDP_C                        (0x33A + LOG_1X_BASE_C)
+
+/* Protocol Services describe all TCP instances */
+#define LOG_PS_STAT_DESC_ALL_TCP_INST_C                 (0x33B + LOG_1X_BASE_C)
+
+/* Protocol Services describe all memory pool instances */
+#define LOG_PS_STAT_DESC_ALL_MEM_POOL_INST_C            (0x33C + LOG_1X_BASE_C)
+
+/* Protocol Services describe all IFACE instances */
+#define LOG_PS_STAT_DESC_ALL_IFACE_INST_C               (0x33D + LOG_1X_BASE_C)
+
+/* Protocol Services describe all PPP instances */
+#define LOG_PS_STAT_DESC_ALL_PPP_INST_C                 (0x33E + LOG_1X_BASE_C)
+
+/* Protocol Services describe all ARP instances */
+#define LOG_PS_STAT_DESC_ALL_ARP_INST_C                 (0x33F + LOG_1X_BASE_C)
+
+/* Protocol Services describe delta instance */
+#define LOG_PS_STAT_DESC_DELTA_INST_C                   (0x340 + LOG_1X_BASE_C)
+
+/* Protocol Services instance TCP statistics */
+#define LOG_PS_STAT_TCP_INST_C                          (0x341 + LOG_1X_BASE_C)
+
+/* Protocol Services instance UDP statistics */
+#define LOG_PS_STAT_UDP_INST_C                          (0x342 + LOG_1X_BASE_C)
+
+/* Protocol Services instance PPP statistics */
+#define LOG_PS_STAT_PPP_INST_C                          (0x343 + LOG_1X_BASE_C)
+
+/* Protocol Services instance IFACE statistics */
+#define LOG_PS_STAT_IFACE_INST_C                        (0x344 + LOG_1X_BASE_C)
+
+/* Protocol Services instance memory statistics */
+#define LOG_PS_STAT_MEM_INST_C                          (0x345 + LOG_1X_BASE_C)
+
+/* Protocol Services instance flow statistics */
+#define LOG_PS_STAT_FLOW_INST_C                         (0x346 + LOG_1X_BASE_C)
+
+/* Protocol Services instance physical link statistics */
+#define LOG_PS_STAT_PHYS_LINK_INST_C                    (0x347 + LOG_1X_BASE_C)
+
+/* Protocol Services instance ARP statistics */
+#define LOG_PS_STAT_ARP_INST_C                          (0x348 + LOG_1X_BASE_C)
+
+/* Protocol Services instance LLC statistics */
+#define LOG_PS_STAT_LLC_INST_C                          (0x349 + LOG_1X_BASE_C)
+
+/* Protocol Services instance IPHC statistics */
+#define LOG_PS_STAT_IPHC_INST_C                         (0x34A + LOG_1X_BASE_C)
+
+/* Protocol Services instance ROHC statistics */
+#define LOG_PS_STAT_ROHC_INST_C                         (0x34B + LOG_1X_BASE_C)
+
+/* Protocol Services instance RSVP statistics */
+#define LOG_PS_STAT_RSVP_INST_C                         (0x34C + LOG_1X_BASE_C)
+
+/* Protocol Services describe all LLC instances */
+#define LOG_PS_STAT_DESC_ALL_LLC_INST_C                 (0x34D + LOG_1X_BASE_C)
+
+/* Protocol Services describe all RSVP instances */
+#define LOG_PS_STAT_DESC_ALL_RSVP_INST_C                (0x34E + LOG_1X_BASE_C)
+
+/* Call Manager Serving System event log */
+#define LOG_CM_SS_EVENT_C                               (0x34F + LOG_1X_BASE_C)
+
+/* VcTcxo manager’s automatic frequency control log */
+#define LOG_TCXOMGR_AFC_DATA_C                          (0x350 + LOG_1X_BASE_C)
+
+/* Clock transactions and general clocks status log */
+#define LOG_CLOCK_C                                     (0x351 + LOG_1X_BASE_C)
+
+/* GPS search processed peak results and their associated search parameters */
+#define LOG_GPS_PROCESSED_PEAK_C                        (0x352 + LOG_1X_BASE_C)
+
+#define LOG_MDSP_LOG_CHUNKS_C                           (0x353 + LOG_1X_BASE_C)
+
+/* Periodic RSSI update log */
+#define LOG_WLAN_RSSI_UPDATE_C                          (0x354 + LOG_1X_BASE_C)
+
+/* Periodic Link Layer statistics log */
+#define LOG_WLAN_LL_STAT_C                              (0x355 + LOG_1X_BASE_C)
+
+/* QOS Extended State Log */
+#define LOG_QOS_STATE_EX_C                              (0x356 + LOG_1X_BASE_C)
+
+/* Bluetooth host HCI transmitted data */
+#define LOG_BT_HOST_HCI_TX_C                            (0x357 + LOG_1X_BASE_C)
+
+/* Bluetooth host HCI received data */
+#define LOG_BT_HOST_HCI_RX_C                            (0x358 + LOG_1X_BASE_C)
+
+/* Internal - GPS PE Position Report Part 3 */
+#define LOG_GPS_PE_POSITION_REPORT_PART3_C              (0x359 + LOG_1X_BASE_C)
+
+/* Extended log code which logs requested QoS */
+#define LOG_QOS_REQUESTED_EX_C                          (0x35A + LOG_1X_BASE_C)
+
+/* Extended log code which logs granted QoS */
+#define LOG_QOS_GRANTED_EX_C                            (0x35B + LOG_1X_BASE_C)
+
+/* Extended log code which logs modified QoS */
+#define LOG_QOS_MODIFIED_EX_C                           (0x35C + LOG_1X_BASE_C)
+
+/* Bus Monitor Profiling Info */
+#define LOG_BUS_MON_PROF_INFO_C                         (0x35D + LOG_1X_BASE_C)
+
+/* Pilot Phase Measurement Search results */
+#define LOG_SRCH_PPM_RES_VER_2_C                        (0x35E + LOG_1X_BASE_C)
+
+/* Pilot Phase Measurement Data Base */
+#define LOG_SRCH_PPM_DB_VER_2_C                         (0x35F + LOG_1X_BASE_C)
+
+/* Pilot Phase Measurement state machine */
+#define LOG_PPM_SM_C                                    (0x360 + LOG_1X_BASE_C)
+
+/* Robust Header Compression - Compressor */
+#define LOG_ROHC_COMPRESSOR_C                           (0x361 + LOG_1X_BASE_C)
+
+/* Robust Header Compression - Decompressor */
+#define LOG_ROHC_DECOMPRESSOR_C                         (0x362 + LOG_1X_BASE_C)
+
+/* Robust Header Compression - Feedback Compressor */
+#define LOG_ROHC_FEEDBACK_COMPRESSOR_C                  (0x363 + LOG_1X_BASE_C)
+
+/* Robust Header Compression - Feedback Decompressor */
+#define LOG_ROHC_FEEDBACK_DECOMPRESSOR_C                (0x364 + LOG_1X_BASE_C)
+
+/* Bluetooth HCI commands */
+#define LOG_BT_HCI_CMD_C                                (0x365 + LOG_1X_BASE_C)
+
+/* Bluetooth HCI events */
+#define LOG_BT_HCI_EV_C                                 (0x366 + LOG_1X_BASE_C)
+
+/* Bluetooth HCI Transmitted ACL data */
+#define LOG_BT_HCI_TX_ACL_C                             (0x367 + LOG_1X_BASE_C)
+
+/* Bluetooth HCI Received ACL data */
+#define LOG_BT_HCI_RX_ACL_C                             (0x368 + LOG_1X_BASE_C)
+
+/* Bluetooth SOC H4 Deep Sleep */
+#define LOG_BT_SOC_H4DS_C                               (0x369 + LOG_1X_BASE_C)
+
+/* UMTS to CDMA Handover Message */
+#define LOG_UMTS_TO_CDMA_HANDOVER_MSG_C                 (0x36A + LOG_1X_BASE_C)
+
+/* Graphic Event Data */
+#define LOG_PROFILER_GRAPHIC_DATA_C                     (0x36B + LOG_1X_BASE_C)
+
+/* Audio Event Data */
+#define LOG_PROFILER_AUDIO_DATA_C                       (0x36C + LOG_1X_BASE_C)
+
+/* GPS Spectral Information */
+#define LOG_GPS_SPECTRAL_INFO_C                         (0x36D + LOG_1X_BASE_C)
+
+/* AHB Performance Monitor LOG data */
+#define LOG_APM_C                                       (0x36E + LOG_1X_BASE_C)
+
+/* GPS Clock Report */
+#define LOG_CONVERGED_GPS_CLOCK_REPORT_C                (0x36F + LOG_1X_BASE_C)
+
+/* GPS Position Report */
+#define LOG_CONVERGED_GPS_POSITION_REPORT_C             (0x370 + LOG_1X_BASE_C)
+
+/* GPS Measurement Report */
+#define LOG_CONVERGED_GPS_MEASUREMENT_REPORT_C          (0x371 + LOG_1X_BASE_C)
+
+/* GPS RF Status Report */
+#define LOG_CONVERGED_GPS_RF_STATUS_REPORT_C            (0x372 + LOG_1X_BASE_C)
+
+/* VOIP To CDMA Handover Message - Obsoleted by 0x138B - 0x138D */
+#define LOG_VOIP_TO_CDMA_HANDOVER_MSG_C                 (0x373 + LOG_1X_BASE_C)
+
+/* GPS Prescribed Dwell Result */
+#define LOG_GPS_PRESCRIBED_DWELL_RESULT_C               (0x374 + LOG_1X_BASE_C)
+
+/* CGPS IPC Data */
+#define LOG_CGPS_IPC_DATA_C                             (0x375 + LOG_1X_BASE_C)
+
+/* CGPS Non IPC Data */
+#define LOG_CGPS_NON_IPC_DATA_C                         (0x376 + LOG_1X_BASE_C)
+
+/* CGPS Session Report */
+#define LOG_CGPS_REP_EVT_LOG_PACKET_C                   (0x377 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Get Position */
+#define LOG_CGPS_PDSM_GET_POSITION_C                    (0x378 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Set Parameters */
+#define LOG_CGPS_PDSM_SET_PARAMETERS_C                  (0x379 + LOG_1X_BASE_C)
+
+/* CGPS PDSM End Session */
+#define LOG_CGPS_PDSM_END_SESSION_C                     (0x37A + LOG_1X_BASE_C)
+
+/* CGPS PDSM Notify Verify Response */
+#define LOG_CGPS_PDSM_NOTIFY_VERIFY_RESP_C              (0x37B + LOG_1X_BASE_C)
+
+/* CGPS PDSM Position Report Callback */
+#define LOG_CGPS_PDSM_POSITION_REPORT_CALLBACK_C        (0x37C + LOG_1X_BASE_C)
+
+/* CGPS PDSM PD Event Callback */
+#define LOG_CGPS_PDSM_PD_EVENT_CALLBACK_C               (0x37D + LOG_1X_BASE_C)
+
+/* CGPS PDSM PA Event Callback */
+#define LOG_CGPS_PDSM_PA_EVENT_CALLBACK_C               (0x37E + LOG_1X_BASE_C)
+
+/* CGPS PDSM Notify Verify Request Callback */
+#define LOG_CGPS_PDSM_NOTIFY_VERIFY_REQUEST_C           (0x37F + LOG_1X_BASE_C)
+
+/* CGPS PDSM PD Command Error Callback */
+#define LOG_CGPS_PDSM_PD_CMD_ERR_CALLBACK_C             (0x380 + LOG_1X_BASE_C)
+
+/* CGPS PDSM PA Command Error Callback */
+#define LOG_CGPS_PDSM_PA_CMD_ERR_CALLBACK_C             (0x381 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Position Error */
+#define LOG_CGPS_PDSM_POS_ERROR_C                       (0x382 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Extended Status Position Report */
+#define LOG_CGPS_PDSM_EXT_STATUS_POS_REPORT_C           (0x383 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Extended Status NMEA Report */
+#define LOG_CGPS_PDSM_EXT_STATUS_NMEA_REPORT_C          (0x384 + LOG_1X_BASE_C)
+
+/* CGPS PDSM Extended Status Measurement Report */
+#define LOG_CGPS_PDSM_EXT_STATUS_MEAS_REPORT_C          (0x385 + LOG_1X_BASE_C)
+
+/* CGPS Report Server TX Packet */
+#define LOG_CGPS_REP_SVR_TX_LOG_PACKET_C                (0x386 + LOG_1X_BASE_C)
+
+/* CGPS Report Server RX Packet */
+#define LOG_CGPS_REP_SVR_RX_LOG_PACKET_C                (0x387 + LOG_1X_BASE_C)
+
+/* UMTS To CDMA Handover Paging Channel Message */
+#define LOG_UMTS_TO_CDMA_HANDOVER_PCH_MSG_C             (0x388 + LOG_1X_BASE_C)
+
+/* UMTS To CDMA Handover Traffic Channel Message */
+#define LOG_UMTS_TO_CDMA_HANDOVER_TCH_MSG_C             (0x389 + LOG_1X_BASE_C)
+
+/* Converged GPS IQ Report */
+#define LOG_CONVERGED_GPS_IQ_REPORT_C                   (0x38A + LOG_1X_BASE_C)
+
+/* VOIP To CDMA Paging Channel Handover Message */
+#define LOG_VOIP_TO_CDMA_PCH_HANDOVER_MSG_C             (0x38B + LOG_1X_BASE_C)
+
+/* VOIP To CDMA Access Channel Handover Message */
+#define LOG_VOIP_TO_CDMA_ACH_HANDOVER_MSG_C             (0x38C + LOG_1X_BASE_C)
+
+/* VOIP To CDMA Forward Traffic Channel Handover Message */
+#define LOG_VOIP_TO_CDMA_FTC_HANDOVER_MSG_C             (0x38D + LOG_1X_BASE_C)
+
+/* QMI reserved logs */
+#define LOG_QMI_RESERVED_CODES_BASE_C                   (0x38E + LOG_1X_BASE_C)
+#define LOG_QMI_LAST_C                                  (32 + LOG_QMI_RESERVED_CODES_BASE_C)
+
+/* QOS Info Code Update Log */
+#define LOG_QOS_INFO_CODE_UPDATE_C                      (0x3AF + LOG_1X_BASE_C)
+
+/* Transmit(Uplink) Vocoder PCM Packet Log */
+#define LOG_TX_PCM_PACKET_C                             (0x3B0 + LOG_1X_BASE_C)
+
+/* Audio Vocoder Data Paths */
+#define LOG_AUDVOC_DATA_PATHS_PACKET_C                  (0x3B0 + LOG_1X_BASE_C)
+
+/* Receive(Downlink) Vocoder PCM Packet Log */
+#define LOG_RX_PCM_PACKET_C                             (0x3B1 + LOG_1X_BASE_C)
+
+/* CRC of YUV frame log */
+#define LOG_DEC_CRC_FRAME_C                             (0x3B2 + LOG_1X_BASE_C)
+
+/* FLUTE Session Information */
+#define LOG_FLUTE_SESSION_INFO_C                        (0x3B3 + LOG_1X_BASE_C)
+
+/* FLUTE ADP File Information */
+#define LOG_FLUTE_ADP_FILE_INFO_C                       (0x3B4 + LOG_1X_BASE_C)
+
+/* FLUTE File Request Information */
+#define LOG_FLUTE_FILE_REQ_INFO_C                       (0x3B5 + LOG_1X_BASE_C)
+
+/* FLUTE FDT Instance Information */
+#define LOG_FLUTE_FDT_INST_C                            (0x3B6 + LOG_1X_BASE_C)
+
+/* FLUTE FDT Information */
+#define LOG_FLUTE_FDT_INFO_C                            (0x3B7 + LOG_1X_BASE_C)
+
+/* FLUTE File Log Packet Information */
+#define LOG_FLUTE_FILE_INFO_C                           (0x3B8 + LOG_1X_BASE_C)
+
+/* 3G 1X Parameter Overhead Information */
+#define LOG_VOIP_TO_CDMA_3G1X_PARAMETERS_C              (0x3B9 + LOG_1X_BASE_C)
+
+/* CGPS ME Job Info */
+#define LOG_CGPS_ME_JOB_INFO_C                          (0x3BA + LOG_1X_BASE_C)
+
+/* CGPS ME SV Lists */
+#define LOG_CPGS_ME_SV_LISTS_C                          (0x3BB + LOG_1X_BASE_C)
+
+/* Flexible Profiling Status */
+#define LOG_PROFDIAG_GEN_STATUS_C                       (0x3BC + LOG_1X_BASE_C)
+
+/* Flexible Profiling Results */
+#define LOG_PROFDIAG_GEN_PROF_C                         (0x3BD + LOG_1X_BASE_C)
+
+/* FLUTE ADP File Content Log Packet Information */
+#define LOG_FLUTE_ADP_FILE_C                            (0x3BE + LOG_1X_BASE_C)
+
+/* FLUTE FDT Instance File Content Log Packet Information */
+#define LOG_FLUTE_FDT_INST_FILE_C                       (0x3BF + LOG_1X_BASE_C)
+
+/* FLUTE FDT Entries Information */
+#define LOG_FLUTE_FDT_ENTRIES_INFO_C                    (0x3C0 + LOG_1X_BASE_C)
+
+/* FLUTE File Contents Log Packet Information */
+#define LOG_FLUTE_FILE_C                                (0x3C1 + LOG_1X_BASE_C)
+
+/* CGPS ME Time-Transfer Info */
+#define LOG_CGPS_ME_TIME_TRANSFER_INFO_C                (0x3C2 + LOG_1X_BASE_C)
+
+/* CGPS ME UMTS Time-Tagging Info */
+#define LOG_CGPS_ME_UMTS_TIME_TAGGING_INFO_C            (0x3C3 + LOG_1X_BASE_C)
+
+/* CGPS ME Generic Time Estimate Put lnfo */
+#define LOG_CGPS_ME_TIME_EST_PUT_INFO_C                 (0x3C4 + LOG_1X_BASE_C)
+
+/* CGPS ME Generic Freq Estimate Put lnfo */
+#define LOG_CGPS_ME_FREQ_EST_PUT_INFO_C                 (0x3C5 + LOG_1X_BASE_C)
+
+/* CGPS Slow Clock Report */
+#define LOG_CGPS_SLOW_CLOCK_REPORT_C                    (0x3C6 + LOG_1X_BASE_C)
+
+/* Converged GPS Medium Grid */
+#define LOG_CONVERGED_GPS_MEDIUM_GRID_C                 (0x3C7 + LOG_1X_BASE_C)
+
+/* Static information about the driver or device */
+#define LOG_SNSD_INFO_C                                 (0x3C8 + LOG_1X_BASE_C)
+
+/* Dynamic state information about the device or driver */
+#define LOG_SNSD_STATE_C                                (0x3C9 + LOG_1X_BASE_C)
+
+/* Data from a driver */
+#define LOG_SNSD_DATA                                   (0x3CA + LOG_1X_BASE_C)
+#define LOG_SNSD_DATA_C                                 (0x3CA + LOG_1X_BASE_C)
+
+/* CGPS Cell DB Cell Change Info */
+#define LOG_CGPS_CELLDB_CELL_CHANGE_INFO_C              (0x3CB + LOG_1X_BASE_C)
+
+/* xScalar YUV frame log */
+#define LOG_DEC_XSCALE_YUV_FRAME_C                      (0x3CC + LOG_1X_BASE_C)
+
+/* CRC of xScaled YUV frame log */
+#define LOG_DEC_XSCALE_CRC_FRAME_C                      (0x3CD + LOG_1X_BASE_C)
+
+/* CGPS Frequency Estimate Report */
+#define LOG_CGPS_FREQ_EST_REPORT_C                      (0x3CE + LOG_1X_BASE_C)
+
+/* GPS DCME Srch Job Completed */
+#define LOG_GPS_DCME_SRCH_JOB_COMPLETED_C               (0x3CF + LOG_1X_BASE_C)
+
+/* CGPS ME Fastscan results  */
+#define LOG_CGPS_ME_FASTSCAN_RESULTS_C                  (0x3D0 + LOG_1X_BASE_C)
+
+/* XO frequency Estimation log */
+#define LOG_XO_FREQ_EST_C                               (0x3D1 + LOG_1X_BASE_C)
+
+/* Tcxomgr field calibration data  */
+#define LOG_TCXOMGR_FIELD_CAL_C                         (0x3D2 + LOG_1X_BASE_C)
+
+/* UMB Call Processing Connection Attempt */
+#define LOG_UMBCP_CONNECTION_ATTEMPT_C                  (0x3D3 + LOG_1X_BASE_C)
+
+/* UMB Call Processing Connection Release */
+#define LOG_UMBCP_CONNECTION_RELEASE_C                  (0x3D4 + LOG_1X_BASE_C)
+
+/* UMB Call Processing Page Message */
+#define LOG_UMBCP_PAGE_MESSAGE_C                        (0x3D5 + LOG_1X_BASE_C)
+
+/* UMB Call Processing OVHD Information */
+#define LOG_UMBCP_OVHD_INFO_C                           (0x3D6 + LOG_1X_BASE_C)
+
+/* UMB Call Processing Session Attempt */
+#define LOG_UMBCP_SESSION_ATTEMPT_C                     (0x3D7 + LOG_1X_BASE_C)
+
+/* UMB Call Processing Route Information */
+#define LOG_UMBCP_ROUTE_INFO_C                          (0x3D8 + LOG_1X_BASE_C)
+
+/* UMB Call Processing State Information */
+#define LOG_UMBCP_STATE_INFO_C                          (0x3D9 + LOG_1X_BASE_C)
+
+/* UMB Call Processing SNP */
+#define LOG_UMBCP_SNP_C                                 (0x3DA + LOG_1X_BASE_C)
+
+/* CGPS Session Early Exit Decision */
+#define LOG_CGPS_SESSION_EARLY_EXIT_DECISION_C          (0x3DB + LOG_1X_BASE_C)
+
+/* GPS RF Linearity Status */
+#define LOG_CGPS_ME_RF_LINEARITY_INFO_C                 (0x3DC + LOG_1X_BASE_C)
+
+/* CGPS ME 5ms IQ Sums */
+#define LOG_CGPS_ME_5MS_IQ_SUMS_C                       (0x3DD + LOG_1X_BASE_C)
+
+/* CGPS ME 20ms IQ Sums */
+#define LOG_CPGS_ME_20MS_IQ_SUMS_C                      (0x3DE + LOG_1X_BASE_C)
+
+/* ROHC Compressor Statistics */
+#define LOG_ROHC_COMPRESSOR_STATS_C                     (0x3DF + LOG_1X_BASE_C)
+
+/* ROHC Decompressor Statistics */
+#define LOG_ROHC_DECOMPRESSOR_STATS_C                   (0x3E0 + LOG_1X_BASE_C)
+
+/* Sensors - Kalman filter information */
+#define LOG_SENSOR_KF_INFO_C                            (0x3E1 + LOG_1X_BASE_C)
+
+/* Sensors - Integrated measurements */
+#define LOG_SENSOR_INT_MEAS_C                           (0x3E2 + LOG_1X_BASE_C)
+
+/* Sensors - Bias calibration values */
+#define LOG_SENSOR_BIAS_CALIBRATION_C                   (0x3E3 + LOG_1X_BASE_C)
+
+/* Log codes 0x13E4-0x13E7 are not following standard log naming convention */
+
+/* DTV ISDB-T Transport Stream Packets */
+#define LOG_DTV_ISDB_TS_PACKETS                         (0x3E4 + LOG_1X_BASE_C)
+
+/* DTV ISDB-T PES Packets */
+#define LOG_DTV_ISDB_PES_PACKETS                        (0x3E5 + LOG_1X_BASE_C)
+
+/* DTV ISDB-T Sections */
+#define LOG_DTV_ISDB_SECTIONS                           (0x3E6 + LOG_1X_BASE_C)
+
+/* DTV ISDB-T Buffering */
+#define LOG_DTV_ISDB_BUFFERING                          (0x3E7 + LOG_1X_BASE_C)
+
+/* WLAN System Acquisition and Handoff */
+#define LOG_WLAN_SYS_ACQ_HO_C                           (0x3E8 + LOG_1X_BASE_C)
+
+/* WLAN General Configurable Parameters */
+#define LOG_WLAN_GEN_CONFIG_PARAMS_C                    (0x3E9 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Channel and Interference Estimation */
+#define LOG_UMB_PHY_RX_DPICH_CIE_C                      (0x3EA + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MMSE/MRC Demodulated Data Symbols (Low) */
+#define LOG_UMB_PHY_RX_DATA_DEMOD_LOW_C                 (0x3EB + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MMSE/MRC Demodulated Data Symbols (High) */
+#define LOG_UMB_PHY_RX_DATA_DEMOD_HIGH_C                (0x3EC + LOG_1X_BASE_C)
+
+/* UMB Physical Layer DCH Decoder */
+#define LOG_UMB_PHY_RX_DCH_DECODER_C                    (0x3ED + LOG_1X_BASE_C)
+
+/* UMB Physical Layer DCH Statistics */
+#define LOG_UMB_PHY_DCH_STATISTICS_C                    (0x3EE + LOG_1X_BASE_C)
+
+/* UMB Physical Layer CqiPich Processing */
+#define LOG_UMB_PHY_RX_CQIPICH_C                        (0x3EF + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MIMO/SIMO in CqiPich (High) */
+#define LOG_UMB_PHY_RX_CQIPICH_CHANTAPS_HIGH_C          (0x3F0 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MIMO/SIMO in CquiPich (Low) */
+#define LOG_UMB_PHY_RX_CQIPICH_CHANTAPS_LOW_C           (0x3F1 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Time-Domain Channel Taps (High) */
+#define LOG_UMB_PHY_RX_PPICH_CHAN_EST_HIGH_C            (0x3F2 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Time-Domain Channel Taps (Low) */
+#define LOG_UMB_PHY_RX_PPICH_CHAN_EST_LOW_C             (0x3F3 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator */
+#define LOG_UMB_PHY_TX_PICH_CONFIG_C                    (0x3F4 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-ACK (High) */
+#define LOG_UMB_PHY_TX_ACK_HIGH_C                       (0x3F5 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-ACK (Low) */
+#define LOG_UMB_PHY_TX_ACK_LOW_C                        (0x3F6 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-PICH */
+#define LOG_UMB_PHY_TX_PICH_C                           (0x3F7 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-ACH (Access) */
+#define LOG_UMB_PHY_TX_ACH_C                            (0x3F8 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-ODDCCH (High) */
+#define LOG_UMB_PHY_TX_ODCCH_HIGH_C                     (0x3F9 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-ODDCCH (Low) */
+#define LOG_UMB_PHY_TX_ODCCH_LOW_C                      (0x3FA + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-CDCCH */
+#define LOG_UMB_PHY_TX_RCDCCH_CONFIG_C                  (0x3FB + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for CQI sent on RCDCCH */
+#define LOG_UMB_PHY_TX_NONFLSS_CQICH_C                  (0x3FC + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for CQI sent on RCDCCH */
+#define LOG_UMB_PHY_TX_FLSS_CQICH_C                     (0x3FD + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for PACH sent on RCDCCH */
+#define LOG_UMB_PHY_TX_PAHCH_C                          (0x3FE + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for REQ sent on RCDCCH */
+#define LOG_UMB_PHY_TX_REQCH_C                          (0x3FF + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for PSD sent on RCDCCH */
+#define LOG_UMB_PHY_TX_PSDCH_C                          (0x400 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer AT Modulator for R-DCH */
+#define LOG_UMB_PHY_TX_DCH_C                            (0x401 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Time/Frequency/RxPower Estimate */
+#define LOG_UMB_PHY_RX_TIME_FREQ_POWER_ESTIMATE_C       (0x402 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer FLCS Processing */
+#define LOG_UMB_PHY_RX_FLCS_PROCESSING_C                (0x403 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer PBCCH Processing */
+#define LOG_UMB_PHY_RX_PBCCH_PROCESSING_C               (0x404 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer SBCCH Processing */
+#define LOG_UMB_PHY_RX_SBCCH_PROCESSING_C               (0x405 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer QPCH Processing */
+#define LOG_UMB_PHY_RX_QPCH_PROCESSING_C                (0x406 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MRC Demodulated Data Symbols (Preamble SBCCH/QPCH) */
+#define LOG_UMB_PHY_RX_SBCCH_DEMOD_C                    (0x407 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer MRC Demodulated Data Symbols (Preamble PBCCH) */
+#define LOG_UMB_PHY_RX_PBCCH_DEMOD_C                    (0x408 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer VCQI */
+#define LOG_UMB_PHY_RX_VCQI_C                           (0x409 + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Acquisition Algorithm */
+#define LOG_UMB_PHY_RX_INITIAL_ACQUISITION_C            (0x40A + LOG_1X_BASE_C)
+
+/* UMB Physical Layer Handoff Search Algorithm */
+#define LOG_UMB_PHY_RX_HANDOFF_SEARCH_C                 (0x40B + LOG_1X_BASE_C)
+
+/* UMB RF RFFE Configuration Info */
+#define LOG_UMB_AT_RFFE_CONFG_C                         (0x40C + LOG_1X_BASE_C)
+
+/* UMB RF Calibrated Values After Powerup */
+#define LOG_UMB_AT_RFFE_RX_CALIB_C                      (0x40D + LOG_1X_BASE_C)
+
+/* UMB RF AGC Block in Acquisition Mode */
+#define LOG_UMB_AT_RFFE_RX_ACQ_C                        (0x40E + LOG_1X_BASE_C)
+
+/* UMB RF AGC Block in Idle Mode */
+#define LOG_UMB_AT_RFFE_RX_IDLE_C                       (0x40F + LOG_1X_BASE_C)
+
+/* UMB RF AGC Block in Connected Mode */
+#define LOG_UMB_AT_RFFE_RX_CONNECTED_C                  (0x410 + LOG_1X_BASE_C)
+
+/* UMB RF AGC Block in Connected Mode (FTM) */
+#define LOG_UMB_AT_RFFE_RX_CONNECTED_FTM_C              (0x411 + LOG_1X_BASE_C)
+
+/* UMB RF Jammer Detector Functionality */
+#define LOG_UMB_AT_RFFE_RX_JAMMER_DETECTOR_FUNCTIONALITY_C  (0x412 + LOG_1X_BASE_C)
+
+/* UMB RF Jammer Detector Response */
+#define LOG_UMB_AT_RFFE_RX_JAMMER_DETECTOR_RESPONSE_C   (0x413 + LOG_1X_BASE_C)
+
+/* UMB RF RFFE TX Power Control */
+#define LOG_UMB_AT_RFFE_TX_BETA_SCALING_C               (0x414 + LOG_1X_BASE_C)
+
+/* UMB Searcher Dump */
+#define LOG_UMB_SEARCHER_DUMP_C                         (0x415 + LOG_1X_BASE_C)
+
+/* UMB System Acquire */
+#define LOG_UMB_SYSTEM_ACQUIRE_C                        (0x416 + LOG_1X_BASE_C)
+
+/* UMB Set Maintenance */
+#define LOG_UMB_SET_MAINTENANCE_C                       (0x417 + LOG_1X_BASE_C)
+
+/* UMB QPCH */
+#define LOG_UMB_QPCH_C                                  (0x418 + LOG_1X_BASE_C)
+
+/* UMB RLL Forward Partial RP Packet */
+#define LOG_UMB_RLL_FORWARD_PARTIAL_RP_C                (0x419 + LOG_1X_BASE_C)
+
+/* UMB RLL Reverse Partial RP Packet */
+#define LOG_UMB_RLL_REVERSE_PARTIAL_RP_C                (0x41A + LOG_1X_BASE_C)
+
+/* UMB RLL Forward Signal Packet */
+#define LOG_UMB_RLL_FORWARD_SIGNAL_C                    (0x41B + LOG_1X_BASE_C)
+
+/* UMB RLL Reverse Signal Packet */
+#define LOG_UMB_RLL_REVERSE_SIGNAL_C                    (0x41C + LOG_1X_BASE_C)
+
+/* UMB RLL Forward Statistics */
+#define LOG_UMB_RLL_FORWARD_STATS_C                     (0x41D + LOG_1X_BASE_C)
+
+/* UMB RLL Reverse Statistics */
+#define LOG_UMB_RLL_REVERSE_STATS_C                     (0x41E + LOG_1X_BASE_C)
+
+/* UMB RLL IRTP */
+#define LOG_UMB_RLL_IRTP_C                              (0x41F + LOG_1X_BASE_C)
+
+/* UMB AP Forward Link MAC Packets */
+#define LOG_UMB_AP_FL_MAC_PACKET_C                      (0x420 + LOG_1X_BASE_C)
+
+/* UMB AP Reverse Link MAC Packets */
+#define LOG_UMB_AP_RL_MAC_PACKET_C                      (0x421 + LOG_1X_BASE_C)
+
+/* GPS Performance Statistics log */
+#define LOG_CGPS_PERFORMANCE_STATS_C                    (0x422 + LOG_1X_BASE_C)
+
+/* UMB Searcher General Status */
+#define LOG_UMB_SRCH_GENERAL_STATUS_C                   (0x423 + LOG_1X_BASE_C)
+
+/* UMB Superframe Scheduler */
+#define LOG_UMB_SUPERFRAME_SCHEDULER_C                  (0x424 + LOG_1X_BASE_C)
+
+/* UMB Sector List */
+#define LOG_UMB_SECTOR_LIST_C                           (0x425 + LOG_1X_BASE_C)
+
+/* UMB MAC Access Attempt Command */
+#define LOG_UMB_MAC_ACCESS_ATTEMPT_CMD_C                (0x426 + LOG_1X_BASE_C)
+
+/* UMB MAC Access Probe Information */
+#define LOG_UMB_MAC_ACCESS_PROBE_INFO_C                 (0x427 + LOG_1X_BASE_C)
+
+/* UMB MAC RTCMAC Package Information */
+#define LOG_UMB_MAC_RTCMAC_PKG_INFO_C                   (0x428 + LOG_1X_BASE_C)
+
+/* UMB MAC Super Frame Information */
+#define LOG_UMB_MAC_SI_INFO_C                           (0x429 + LOG_1X_BASE_C)
+
+/* UMB MAC Quick Channel Information */
+#define LOG_UMB_MAC_QCI_INFO_C                          (0x42A + LOG_1X_BASE_C)
+
+/* UMB MAC Paging Id List */
+#define LOG_UMB_MAC_PAGING_ID_LIST_C                    (0x42B + LOG_1X_BASE_C)
+
+/* UMB MAC Quick Paging Channel Information */
+#define LOG_UMB_MAC_QPCH_INFO_C                         (0x42C + LOG_1X_BASE_C)
+
+/* UMB MAC FTCMAC Information */
+#define LOG_UMB_MAC_FTCMAC_PKG_INFO_C                   (0x42D + LOG_1X_BASE_C)
+
+/* UMB MAC Access Grant Receiving */
+#define LOG_UMB_MAC_ACCESS_GRANT_C                      (0x42E + LOG_1X_BASE_C)
+
+/* UMB MAC Generic Debug Log */
+#define LOG_UMB_MAC_GEN_DEBUG_LOG_PKG_C                 (0x42F + LOG_1X_BASE_C)
+
+/* CGPS Frequency Bias Estimate */
+#define LOG_CGPS_MC_FREQ_BIAS_EST_C                     (0x430 + LOG_1X_BASE_C)
+
+/* UMB MAC Request Report Information Log */
+#define LOG_UMB_MAC_REQCH_REPORT_INFO_C                 (0x431 + LOG_1X_BASE_C)
+
+/* UMB MAC Reverse Link QoS Token Bucket Information Log */
+#define LOG_UMB_MAC_RLQOS_TOKEN_BUCKET_INFO_C           (0x432 + LOG_1X_BASE_C)
+
+/* UMB MAC Reverse Link QoS Stream Information Log */
+#define LOG_UMB_MAC_RLQOS_STREAM_INFO_C                 (0x433 + LOG_1X_BASE_C)
+
+/* UMB MAC Reverse Link QoS Allotment Information Log */
+#define LOG_UMB_MAC_RLQOS_ALLOTMENT_INFO_C              (0x434 + LOG_1X_BASE_C)
+
+/* UMB Searcher Recent State Machine Transactions */
+#define LOG_UMB_SRCH_STM_ACTIVITY_C                     (0x435 + LOG_1X_BASE_C)
+
+/* Performance Counters on ARM11 Profiling Information */
+#define LOG_ARM11_PERF_CNT_INFO_C                       (0x436 + LOG_1X_BASE_C)
+
+/* Protocol Services describe all flow instances */
+#define LOG_PS_STAT_DESC_ALL_FLOW_INST_C                (0x437 + LOG_1X_BASE_C)
+
+/* Protocol Services describe all physical link instances */
+#define LOG_PS_STAT_DESC_ALL_PHYS_LINK_INST_C           (0x438 + LOG_1X_BASE_C)
+
+/* Protocol Services describe all UDP instances */
+#define LOG_PS_STAT_DESC_ALL_UDP_INST_C                 (0x439 + LOG_1X_BASE_C)
+
+/* Searcher 4 Multi-Carrier HDR */
+#define LOG_SRCH4_MC_HDR_C                              (0x43A + LOG_1X_BASE_C)
+
+/* Protocol Services describe all IPHC instances */
+#define LOG_PS_STAT_DESC_ALL_IPHC_INST_C                (0x43B + LOG_1X_BASE_C)
+
+/* Protocol Services describe all ROHC instances */
+#define LOG_PS_STAT_DESC_ALL_ROHC_INST_C                (0x43C + LOG_1X_BASE_C)
+
+/* BCast security add program information */
+#define LOG_BCAST_SEC_ADD_PROGRAM_INFO_C                (0x43D + LOG_1X_BASE_C)
+
+/* BCast security add program complete */
+#define LOG_BCAST_SEC_ADD_PROGRAM_COMPLETE_C            (0x43E + LOG_1X_BASE_C)
+
+/* BCast security SDP parse */
+#define LOG_BCAST_SEC_SDP_PARSE_C                       (0x43F + LOG_1X_BASE_C)
+
+/* CGPS ME dynamic power optimization status */
+#define LOG_CGPS_ME_DPO_STATUS_C                        (0x440 + LOG_1X_BASE_C)
+
+/* CGPS PDSM on demand session start */
+#define LOG_CGPS_PDSM_ON_DEMAND_SESSION_START_C         (0x441 + LOG_1X_BASE_C)
+
+/* CGPS PDSM on demand session stop */
+#define LOG_CGPS_PDSM_ON_DEMAND_SESSION_STOP_C          (0x442 + LOG_1X_BASE_C)
+
+/* CGPS PDSM on demand session not started */
+#define LOG_CGPS_PDSM_ON_DEMAND_SESSION_NOT_STARTED_C   (0x443 + LOG_1X_BASE_C)
+
+/* CGPS PDSM extern coarse position inject start */
+#define LOG_CGPS_PDSM_EXTERN_COARSE_POS_INJ_START_C     (0x444 + LOG_1X_BASE_C)
+
+/* DTV ISDB-T TMCC information */
+#define LOG_DTV_ISDB_TMCC_C                             (0x445 + LOG_1X_BASE_C)
+
+/* RF development */
+#define LOG_RF_DEV_C                                    (0x446 + LOG_1X_BASE_C)
+
+/* RF RFM API */
+#define LOG_RF_RFM_API_C                                (0x447 + LOG_1X_BASE_C)
+
+/* RF RFM state */
+#define LOG_RF_RFM_STATE_C                              (0x448 + LOG_1X_BASE_C)
+
+/* 1X RF Warmup */
+#define LOG_1X_RF_WARMUP_C                              (0x449 + LOG_1X_BASE_C)
+
+/* 1X RF power limiting */
+#define LOG_1X_RF_PWR_LMT_C                             (0x44A + LOG_1X_BASE_C)
+
+/* 1X RF state */
+#define LOG_1X_RF_STATE_C                               (0x44B + LOG_1X_BASE_C)
+
+/* 1X RF sleep */
+#define LOG_1X_RF_SLEEP_C                               (0x44C + LOG_1X_BASE_C)
+
+/* 1X RF TX state */
+#define LOG_1X_RF_TX_STATE_C                            (0x44D + LOG_1X_BASE_C)
+
+/* 1X RF IntelliCeiver state */
+#define LOG_1X_RF_INT_STATE_C                           (0x44E + LOG_1X_BASE_C)
+
+/* 1X RF RX ADC clock */
+#define LOG_1X_RF_RX_ADC_CLK_C                          (0x44F + LOG_1X_BASE_C)
+
+/* 1X RF LNA switch point */
+#define LOG_1X_RF_LNA_SWITCHP_C                         (0x450 + LOG_1X_BASE_C)
+
+/* 1X RF RX calibration */
+#define LOG_1X_RF_RX_CAL_C                              (0x451 + LOG_1X_BASE_C)
+
+/* 1X RF API */
+#define LOG_1X_RF_API_C                                 (0x452 + LOG_1X_BASE_C)
+
+/* 1X RF RX PLL locking status */
+#define LOG_1X_RF_RX_PLL_LOCK_C                         (0x453 + LOG_1X_BASE_C)
+
+/* 1X RF voltage regulator */
+#define LOG_1X_RF_VREG_C                                (0x454 + LOG_1X_BASE_C)
+
+/* CGPS DIAG successful fix count */
+#define LOG_CGPS_DIAG_SUCCESSFUL_FIX_COUNT_C            (0x455 + LOG_1X_BASE_C)
+
+/* CGPS MC track dynamic power optimization status */
+#define LOG_CGPS_MC_TRACK_DPO_STATUS_C                  (0x456 + LOG_1X_BASE_C)
+
+/* CGPS MC SBAS demodulated bits */
+#define LOG_CGPS_MC_SBAS_DEMOD_BITS_C                   (0x457 + LOG_1X_BASE_C)
+
+/* CGPS MC SBAS demodulated soft symbols */
+#define LOG_CGPS_MC_SBAS_DEMOD_SOFT_SYMBOLS_C           (0x458 + LOG_1X_BASE_C)
+
+/* Data Services PPP configuration */
+#define LOG_DS_PPP_CONFIG_PARAMS_C                      (0x459 + LOG_1X_BASE_C)
+
+/* Data Services physical link configuration */
+#define LOG_DS_PHYS_LINK_CONFIG_PARAMS_C                (0x45A + LOG_1X_BASE_C)
+
+/* Data Services PPP device configuration */
+#define LOG_PS_PPP_DEV_CONFIG_PARAMS_C                  (0x45B + LOG_1X_BASE_C)
+
+/* CGPS PDSM GPS state information */
+#define LOG_CGPS_PDSM_GPS_STATE_INFO_C                  (0x45C + LOG_1X_BASE_C)
+
+/* CGPS PDSM EXT status GPS state information */
+#define LOG_CGPS_PDSM_EXT_STATUS_GPS_STATE_INFO_C       (0x45D + LOG_1X_BASE_C)
+
+/* CGPS ME Rapid Search Report */
+#define LOG_CGPS_ME_RAPID_SEARCH_REPORT_C               (0x45E + LOG_1X_BASE_C)
+
+/* CGPS PDSM XTRA-T session */
+#define LOG_CGPS_PDSM_XTRA_T_SESSION_C                  (0x45F + LOG_1X_BASE_C)
+
+/* CGPS PDSM XTRA-T upload */
+#define LOG_CGPS_PDSM_XTRA_T_UPLOAD_C                   (0x460 + LOG_1X_BASE_C)
+
+/* CGPS Wiper Position Report */
+#define LOG_CGPS_WIPER_POSITION_REPORT_C                (0x461 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard HTTP Digest Request Info */
+#define LOG_DTV_DVBH_SEC_SC_HTTP_DIGEST_REQ_C           (0x462 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard HTTP Digest Response Info */
+#define LOG_DTV_DVBH_SEC_SC_HTTP_DIGEST_RSP_C           (0x463 + LOG_1X_BASE_C) 
+
+/* DTV DVBH Security SmartCard Services Registration Request Info */
+#define LOG_DTV_DVBH_SEC_SC_SVC_REG_REQ_C               (0x464 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard Services Registration Complete Info */
+#define LOG_DTV_DVBH_SEC_SC_SVC_REG_COMPLETE_C          (0x465 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard Services Deregistration Request Info */
+#define LOG_DTV_DVBH_SEC_SC_SVC_DEREG_REQ_C             (0x466 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard Services Deregistration Complete Info */
+#define LOG_DTV_DVBH_SEC_SC_SVC_DEREG_COMPLETE_C        (0x467 + LOG_1X_BASE_C) 
+
+/* DTV DVBH Security SmartCard LTKM Request Info */
+#define LOG_DTV_DVBH_SEC_SC_LTKM_REQ_C                  (0x468 + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard LTKM Request Complete Info */
+#define LOG_DTV_DVBH_SEC_SC_LTKM_REQ_COMPLETE_C         (0x469 + LOG_1X_BASE_C) 
+
+/* DTV DVBH Security SmartCard Program Selection Info */
+#define LOG_DTV_DVBH_SEC_SC_PROG_SEL_C                  (0x46A + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard Program Selection Complete Info */
+#define LOG_DTV_DVBH_SEC_SC_PROG_SEL_COMPLETE_C         (0x46B + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard LTKM */
+#define LOG_DTV_DVBH_SEC_SC_LTKM_C                      (0x46C + LOG_1X_BASE_C)  
+
+/* DTV DVBH Security SmartCard LTKM Verification Message */
+#define LOG_DTV_DVBH_SEC_SC_LTKM_VERIFICATION_C         (0x46D + LOG_1X_BASE_C) 
+
+/* DTV DVBH Security SmartCard Parental Control Message */
+#define LOG_DTV_DVBH_SEC_SC_PARENTAL_CTRL_C             (0x46E + LOG_1X_BASE_C)
+
+/* DTV DVBH Security SmartCard STKM */
+#define LOG_DTV_DVBH_SEC_SC_STKM_C                      (0x46F + LOG_1X_BASE_C)
+
+/* Protocol Services Statistics Global Socket */
+#define LOG_PS_STAT_GLOBAL_SOCK_C                       (0x470 + LOG_1X_BASE_C)
+
+/* MCS Application Manager */
+#define LOG_MCS_APPMGR_C                                (0x471 + LOG_1X_BASE_C)
+
+/* MCS MSGR */
+#define LOG_MCS_MSGR_C                                  (0x472 + LOG_1X_BASE_C)
+
+/* MCS QTF  */
+#define LOG_MCS_QTF_C                                   (0x473 + LOG_1X_BASE_C)
+
+/* Sensors Stationary Detector Output */
+#define LOG_STATIONARY_DETECTOR_OUTPUT_C                (0x474 + LOG_1X_BASE_C)  
+
+/* Print out the ppm data portion  */
+#define LOG_CGPS_PDSM_EXT_STATUS_MEAS_REPORT_PPM_C      (0x475 + LOG_1X_BASE_C)  
+
+/* GNSS Position Report */
+#define LOG_GNSS_POSITION_REPORT_C                      (0x476 + LOG_1X_BASE_C)  
+
+/* GNSS GPS Measurement Report */
+#define LOG_GNSS_GPS_MEASUREMENT_REPORT_C               (0x477 + LOG_1X_BASE_C)  
+
+/* GNSS Clock Report */
+#define LOG_GNSS_CLOCK_REPORT_C                         (0x478 + LOG_1X_BASE_C)  
+
+/* GNSS Demod Soft Decision */
+#define LOG_GNSS_DEMOD_SOFT_DECISIONS_C                 (0x479 + LOG_1X_BASE_C)  
+
+/* GNSS ME 5MS IQ sum */
+#define LOG_GNSS_ME_5MS_IQ_SUMS_C                       (0x47A + LOG_1X_BASE_C)  
+
+/* GNSS CD DB report */
+#define LOG_GNSS_CD_DB_REPORT_C                         (0x47B + LOG_1X_BASE_C) 
+
+/* GNSS PE WLS position report */
+#define LOG_GNSS_PE_WLS_POSITION_REPORT_C               (0x47C + LOG_1X_BASE_C) 
+
+/* GNSS PE KF position report */
+#define LOG_GNSS_PE_KF_POSITION_REPORT_C                (0x47D + LOG_1X_BASE_C) 
+
+/* GNSS PRX RF HW status report */
+#define LOG_GNSS_PRX_RF_HW_STATUS_REPORT_C              (0x47E + LOG_1X_BASE_C) 
+
+/* GNSS DRX RF HW status report */
+#define LOG_GNSS_DRX_RF_HW_STATUS_REPORT_C              (0x47F + LOG_1X_BASE_C) 
+
+/* GNSS Glonass Measurement report */
+#define LOG_GNSS_GLONASS_MEASUREMENT_REPORT_C           (0x480 + LOG_1X_BASE_C) 
+
+/* GNSS GPS HBW RXD measurement */
+#define LOG_GNSS_GPS_HBW_RXD_MEASUREMENT_C              (0x481 + LOG_1X_BASE_C) 
+
+/* GNSS PDSM position report callback */
+#define LOG_GNSS_PDSM_POSITION_REPORT_CALLBACK_C        (0x482 + LOG_1X_BASE_C)
+
+/* ISense Request String  */
+#define LOG_ISENSE_REQUEST_STR_C                        (0x483 + LOG_1X_BASE_C) 
+
+/* ISense Response String */
+#define LOG_ISENSE_RESPONSE_STR_C                       (0x484 + LOG_1X_BASE_C)
+
+/* Bluetooth SOC General Log Packet*/
+#define LOG_BT_SOC_GENERAL_C                            (0x485 + LOG_1X_BASE_C)
+
+/* QCRil Call Flow */
+#define LOG_QCRIL_CALL_FLOW_C                           (0x486 + LOG_1X_BASE_C)
+
+/* CGPS Wideband FFT stats */
+#define LOG_CGPS_WB_FFT_STATS_C                         (0x487 + LOG_1X_BASE_C)
+
+/* CGPS Slow Clock Calibration Report*/
+#define LOG_CGPS_SLOW_CLOCK_CALIB_REPORT_C              (0x488 + LOG_1X_BASE_C)
+
+/* SNS GPS TIMESTAMP */
+#define LOG_SNS_GPS_TIMESTAMP_C                         (0x489 + LOG_1X_BASE_C)
+
+/* GNSS Search Strategy Task Allocation */
+#define LOG_GNSS_SEARCH_STRATEGY_TASK_ALLOCATION_C      (0x48A + LOG_1X_BASE_C)
+
+/* RF MC STM state */
+#define LOG_1XHDR_MC_STATE_C                            (0x48B + LOG_1X_BASE_C)
+
+/* Record in the Sparse Network DB */
+#define LOG_CGPS_SNDB_RECORD_C                          (0x48C + LOG_1X_BASE_C)
+
+/* Record removed from the DB */
+#define LOG_CGPS_SNDB_REMOVE_C                          (0x48D + LOG_1X_BASE_C)
+
+/* CGPS Reserved */
+#define LOG_GNSS_CC_PERFORMANCE_STATS_C                 (0x48E + LOG_1X_BASE_C)
+
+/* GNSS PDSM Set Paramerters */
+#define LOG_GNSS_PDSM_SET_PARAMETERS_C                  (0x48F + LOG_1X_BASE_C)
+
+/* GNSS PDSM PD Event Callback */
+#define LOG_GNSS_PDSM_PD_EVENT_CALLBACK_C               (0x490 + LOG_1X_BASE_C)
+
+/* GNSS PDSM PA Event Callback */
+#define LOG_GNSS_PDSM_PA_EVENT_CALLBACK_C               (0x491 + LOG_1X_BASE_C)
+
+/* CGPS Reserved */
+#define LOG_CGPS_RESERVED2_C                            (0x492 + LOG_1X_BASE_C)
+
+/* CGPS Reserved */
+#define LOG_CGPS_RESERVED3_C                            (0x493 + LOG_1X_BASE_C)
+
+/* GNSS PDSM EXT Status MEAS Report */
+#define LOG_GNSS_PDSM_EXT_STATUS_MEAS_REPORT_C          (0x494 + LOG_1X_BASE_C)
+
+/* GNSS SM Error */
+#define LOG_GNSS_SM_ERROR_C                             (0x495 + LOG_1X_BASE_C)
+
+/* WLAN Scan */
+#define LOG_WLAN_SCAN_C                                 (0x496 + LOG_1X_BASE_C)
+
+/* WLAN IBSS */
+#define LOG_WLAN_IBSS_C                                 (0x497 + LOG_1X_BASE_C)
+
+/* WLAN 802.11d*/
+#define LOG_WLAN_80211D_C                               (0x498 + LOG_1X_BASE_C)
+
+/* WLAN Handoff */
+#define LOG_WLAN_HANDOFF_C                              (0x499 + LOG_1X_BASE_C)
+
+/* WLAN QoS EDCA */
+#define LOG_WLAN_QOS_EDCA_C                             (0x49A + LOG_1X_BASE_C)
+
+/* WLAN Beacon Update */
+#define LOG_WLAN_BEACON_UPDATE_C                        (0x49B + LOG_1X_BASE_C)
+
+/* WLAN Power save wow add pattern */
+#define LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C               (0x49C + LOG_1X_BASE_C)
+
+/* WLAN WCM link metrics */
+#define LOG_WLAN_WCM_LINKMETRICS_C                      (0x49D + LOG_1X_BASE_C)
+
+/* WLAN wps scan complete*/
+#define LOG_WLAN_WPS_SCAN_COMPLETE_C                    (0x49E + LOG_1X_BASE_C)
+
+/* WLAN WPS WSC Message */
+#define LOG_WLAN_WPS_WSC_MESSAGE_C                      (0x49F + LOG_1X_BASE_C)
+
+/* WLAN WPS credentials */
+#define LOG_WLAN_WPS_CREDENTIALS_C                      (0x4A0 + LOG_1X_BASE_C)
+
+/* WLAN Linklayer stat*/
+#define LOG_WLAN_LINKLAYER_STAT_C                       (0x4A1 + LOG_1X_BASE_C)
+
+/* WLAN Qos TSpec*/
+#define LOG_WLAN_QOS_TSPEC_C                            (0x4A2 + LOG_1X_BASE_C)
+
+/* PMIC Vreg Control */
+#define LOG_PM_VREG_CONTROL_C                           (0x4A3 + LOG_1X_BASE_C)
+
+/* PMIC Vreg Level */
+#define LOG_PM_VREG_LEVEL_C                             (0x4A4 + LOG_1X_BASE_C)
+ 
+/* PMIC Vreg State */
+#define LOG_PM_VREG_STATE_C                             (0x4A5 + LOG_1X_BASE_C)
+
+/* CGPS SM EPH Randomization info */
+#define LOG_CGPS_SM_EPH_RANDOMIZATION_INFO_C            (0x4A6 + LOG_1X_BASE_C)
+
+/* Audio calibration data */
+#define LOG_QACT_DATA_C                                 (0x4A7 + LOG_1X_BASE_C)
+
+/* Compass 2D Tracked Calibration Set */
+#define LOG_SNS_VCPS_2D_TRACKED_CAL_SET                 (0x4A8 + LOG_1X_BASE_C)
+
+/* Compass 3D Tracked Calibration Set  */
+#define LOG_SNS_VCPS_3D_TRACKED_CAL_SET                 (0x4A9 + LOG_1X_BASE_C)
+
+/* Calibration metric */
+#define LOG_SNS_VCPS_CAL_METRIC                         (0x4AA + LOG_1X_BASE_C)
+
+/* Accelerometer distance */
+#define LOG_SNS_VCPS_ACCEL_DIST                         (0x4AB + LOG_1X_BASE_C)
+
+/* Plane update */
+#define LOG_SNS_VCPS_PLANE_UPDATE                       (0x4AC + LOG_1X_BASE_C)
+
+/* Location report  */
+#define LOG_SNS_VCPS_LOC_REPORT                         (0x4AD + LOG_1X_BASE_C)
+
+/* CM Active subscription */
+#define LOG_CM_PH_EVENT_SUBSCRIPTION_PREF_INFO_C        (0x4AE + LOG_1X_BASE_C)
+
+/* DSDS version of CM call event */
+#define LOG_CM_DS_CALL_EVENT_C                          (0x4AF + LOG_1X_BASE_C)
+
+/* Sensors ?MobiSens Output */
+#define LOG_MOBISENS_OUTPUT_C                           (0x4B0 + LOG_1X_BASE_C)
+
+/* Accelerometer Data   */
+#define LOG_ACCEL_DATA_C                                (0x4B1 + LOG_1X_BASE_C)
+
+/* Accelerometer Compensated Data  */
+#define LOG_ACCEL_COMP_DATA_C                           (0x4B2 + LOG_1X_BASE_C)
+
+/* Motion State Data  */
+#define LOG_MOTION_STATE_DATA_C                         (0x4B3 + LOG_1X_BASE_C)
+
+/* Stationary Position Indicator  */
+#define LOG_STAT_POS_IND_C                              (0x4B4 + LOG_1X_BASE_C)
+
+/* Motion State Features   */
+#define LOG_MOTION_STATE_FEATURES_C                     (0x4B5 + LOG_1X_BASE_C)
+
+/* Motion State Hard Decision */
+#define LOG_MOTION_STATE_HARD_DECISION_C                (0x4B6 + LOG_1X_BASE_C)
+  
+/* Motion State Soft Decision */
+#define LOG_MOTION_STATE_SOFT_DECISION_C                (0x4B7 + LOG_1X_BASE_C)
+
+/* Sensors Software Version */
+#define LOG_SENSORS_SOFTWARE_VERSION_C                  (0x4B8 + LOG_1X_BASE_C)
+
+/* MobiSens Stationary Position Indicator Log Packet */
+#define LOG_MOBISENS_SPI_C                              (0x4B9 + LOG_1X_BASE_C)
+
+/* XO calibration raw IQ data */
+#define LOG_XO_IQ_DATA_C                                (0x4BA + LOG_1X_BASE_C)
+
+/*DTV CMMB Control Tabl Updated*/
+#define LOG_DTV_CMMB_CONTROL_TABLE_UPDATE                  ((0x4BB) + LOG_1X_BASE_C)
+
+/*DTV CMMB Media API Buffering Status*/
+#define LOG_DTV_CMMB_MEDIA_BUFFERING_STATUS                ((0x4BC) + LOG_1X_BASE_C)
+
+/*DTV CMMB *Emergency Broadcast Data*/
+#define LOG_DTV_CMMB_CONTROL_EMERGENCY_BCAST             ((0x4BD) + LOG_1X_BASE_C)
+
+/*DTV CMMB EMM/ECM Data*/
+#define LOG_DTV_CMMB_CAS_EMM_ECM                                 ((0x4BE) + LOG_1X_BASE_C)
+
+/*DTV CMMB HW Status*/
+#define LOG_DTV_CMMB_HW_PERFORMANCE                            ((0x4BF) + LOG_1X_BASE_C)
+
+/*DTV CMMB ESSG Program Indication Information*/
+#define LOG_DTV_CMMB_ESG_PROGRAM_INDICATION_INFORMATION    ((0x4C0) + LOG_1X_BASE_C)
+
+/* Sensors ¨C binary output of converted sensor data */
+#define LOG_CONVERTED_SENSOR_DATA_C                             ((0x4C1) + LOG_1X_BASE_C)
+
+/* CM Subscription event */
+#define LOG_CM_SUBSCRIPTION_EVENT_C                             ((0x4C2) + LOG_1X_BASE_C)
+
+/* Sensor Ambient Light Data */
+#define LOG_SNS_ALS_DATA_C                                           ((0x4C3) + LOG_1X_BASE_C)
+
+/*Sensor Ambient Light Adaptive Data */
+#define LOG_SNS_ALS_DATA_ADAPTIVE_C                           ((0x4C4) + LOG_1X_BASE_C)
+
+/*Sensor Proximity Distance Data */
+#define LOG_SNS_PRX_DIST_DATA_C                                  ((0x4C5) + LOG_1X_BASE_C)
+
+/*Sensor Proximity Data */
+#define LOG_SNS_PRX_DATA_C                                          ((0x4C6) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_SBAS_REPORT_C                                      ((0x4C7) + LOG_1X_BASE_C)
+
+#define LOG_CPU_MONITOR_MODEM_C                                     ((0x4C8) + LOG_1X_BASE_C)
+
+#define LOG_CPU_MONITOR_APPS_C                                      ((0x4C9) + LOG_1X_BASE_C)
+
+#define LOG_BLAST_TASKPROFILE_C                                     ((0x4CA) + LOG_1X_BASE_C)
+
+#define LOG_BLAST_SYSPROFILE_C                                      ((0x4CB) + LOG_1X_BASE_C)
+
+#define LOG_FM_RADIO_FTM_C                                          ((0x4CC) + LOG_1X_BASE_C)
+
+#define LOG_FM_RADIO_C                                              ((0x4CD) + LOG_1X_BASE_C)
+
+#define LOG_UIM_DS_DATA_C                                           ((0x4CE) + LOG_1X_BASE_C)
+
+#define LOG_QMI_CALL_FLOW_C                                         ((0x4CF) + LOG_1X_BASE_C)
+
+#define LOG_APR_MODEM_C                                             ((0x4D0) + LOG_1X_BASE_C)
+
+#define LOG_APR_APPS_C                                              ((0x4D1) + LOG_1X_BASE_C)
+
+#define LOG_APR_ADSP_C                                              ((0x4D2) + LOG_1X_BASE_C)
+
+#define LOG_DATA_MUX_RX_RAW_PACKET_C                                ((0x4D3) + LOG_1X_BASE_C)
+
+#define LOG_DATA_MUX_TX_RAW_PACKET_C                                ((0x4D4) + LOG_1X_BASE_C)
+
+#define LOG_DATA_MUX_RX_FRAME_PACKET_C                              ((0x4D5) + LOG_1X_BASE_C)
+
+#define LOG_DATA_MUX_TX_FRAME_PACKET_C                              ((0x4D6) + LOG_1X_BASE_C)
+
+#define LOG_CGPS_PDSM_EXT_STATUS_POS_INJ_REQ_INFO_C                 ((0x4D7) + LOG_1X_BASE_C)
+
+#define LOG_TEMPERATURE_MONITOR_C                                   ((0x4D8) + LOG_1X_BASE_C)
+
+#define LOG_SNS_GESTURES_REST_DETECT_C                              ((0x4D9) + LOG_1X_BASE_C)
+
+#define LOG_SNS_GESTURES_ORIENTATION_C                              ((0x4DA) + LOG_1X_BASE_C)
+
+#define LOG_SNS_GESTURES_FACING_C                                   ((0x4DB) + LOG_1X_BASE_C)
+
+#define LOG_SNS_GESTURES_BASIC_C                                    ((0x4DC) + LOG_1X_BASE_C)
+
+#define LOG_SNS_GESTURES_HINBYE_C                                   ((0x4DD) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_OEMDRE_MEASUREMENT_REPORT_C                        ((0x4DE) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_OEMDRE_POSITION_REPORT_C                           ((0x4E0) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_OEMDRE_SVPOLY_REPORT_C                             ((0x4E1) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_OEMDRSYNC_C                                        ((0x4E2) + LOG_1X_BASE_C)
+
+#define LOG_SNS_MGR_EVENT_NOTIFY_C                                  ((0x4E3) + LOG_1X_BASE_C)
+
+#define LOG_SNS_MGR_EVENT_REGISTER_C                                ((0x4E4) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_PDSM_PPM_SESSION_BEGIN_C                           ((0x4E5) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_PDSM_PPM_SESSION_PPM_SUSPEND_C                     ((0x4E6) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_PDSM_PPM_REPORT_THROTTLED_C                        ((0x4E7) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_PDSM_PPM_REPORT_FIRED_C                            ((0x4E8) + LOG_1X_BASE_C)
+
+#define LOG_GNSS_PDSM_PPM_SESSION_END_C                             ((0x4E9) + LOG_1X_BASE_C)
+
+/* The last defined DMSS log code */
+#define LOG_1X_LAST_C                                   ((0x4E9) + LOG_1X_BASE_C)
+
+
+/* This is only here for old (pre equipment ID update) logging code */
+#define LOG_LAST_C                                      ( LOG_1X_LAST_C & 0xFFF )
+
+
+/* -------------------------------------------------------------------------
+ * APPS LOG definition:
+ * The max number of 16 log codes is assigned for Apps.
+ * The last apps log code could be 0xB00F.
+ * Below definition is consolidated from log_codes_apps.h
+ * ------------------------------------------------------------------------- */
+
+/* ========================   APPS Profiling  ======================== */
+#define LOG_APPS_SYSPROFILE_C                       (0x01  + LOG_APPS_BASE_C)
+#define LOG_APPS_TASKPROFILE_C                      (0x02  + LOG_APPS_BASE_C)
+
+/* The last defined APPS log code */
+/* Change it to (0x02 + LOG_LTE_LAST_C) to allow LTE log codes */
+#define LOG_APPS_LAST_C                             (0x02 + LOG_LTE_LAST_C)
+
+/* -------------------------------------------------------------------------
+ * Log Equipment IDs.
+ * The number is represented by 4 bits.
+ * ------------------------------------------------------------------------- */
+typedef enum {
+  LOG_EQUIP_ID_OEM   = 0, /* 3rd party OEM (licensee) use */
+  LOG_EQUIP_ID_1X    = 1, /* Traditional 1X line of products */
+  LOG_EQUIP_ID_RSVD2 = 2,
+  LOG_EQUIP_ID_RSVD3 = 3,
+  LOG_EQUIP_ID_WCDMA = 4,
+  LOG_EQUIP_ID_GSM   = 5,
+  LOG_EQUIP_ID_LBS   = 6,
+  LOG_EQUIP_ID_UMTS  = 7,
+  LOG_EQUIP_ID_TDMA  = 8,
+  LOG_EQUIP_ID_BOA   = 9,
+  LOG_EQUIP_ID_DTV   = 10,
+  LOG_EQUIP_ID_APPS  = 11,
+  LOG_EQUIP_ID_DSP   = 12,
+
+  LOG_EQUIP_ID_LAST_DEFAULT = LOG_EQUIP_ID_DSP
+
+} log_equip_id_enum_type;
+
+#define LOG_EQUIP_ID_MAX 0xF /* The equipment ID is 4 bits */
+
+/* Note that these are the official values and are used by default in 
+   diagtune.h.
+*/
+#define LOG_EQUIP_ID_0_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_1_LAST_CODE_DEFAULT LOG_1X_LAST_C
+#define LOG_EQUIP_ID_2_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_3_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_4_LAST_CODE_DEFAULT 0
+#define LOG_EQUIP_ID_5_LAST_CODE_DEFAULT 0
+#define LOG_EQUIP_ID_6_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_7_LAST_CODE_DEFAULT 0
+#define LOG_EQUIP_ID_8_LAST_CODE_DEFAULT 0
+#define LOG_EQUIP_ID_9_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_10_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_11_LAST_CODE_DEFAULT LOG_LTE_LAST_C 
+#define LOG_EQUIP_ID_12_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_13_LAST_CODE_DEFAULT 0 
+#define LOG_EQUIP_ID_14_LAST_CODE_DEFAULT 0
+#define LOG_EQUIP_ID_15_LAST_CODE_DEFAULT 0
+
+#endif /* LOG_CODES_H */
diff --git a/CORE/VOSS/inc/vos_api.h b/CORE/VOSS/inc/vos_api.h
new file mode 100644
index 0000000..df78f32
--- /dev/null
+++ b/CORE/VOSS/inc/vos_api.h
@@ -0,0 +1,289 @@
+/*
+ * 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( __VOS_API_H )
+#define __VOS_API_H
+
+/**=========================================================================
+  
+  \file  vos_Api.h
+  
+  \brief virtual Operating System Services (vOSS) API
+               
+   Header file that inludes all the vOSS API definitions.
+  
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  06/23/08    hba     Added vos_preOpen()
+  05/18/08    lac     Created module. 
+===========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+// one stop shopping.  This brings in the entire vOSS API.
+#include <vos_types.h>
+#include <vos_status.h>
+#include <vos_memory.h>
+#include <vos_list.h>
+#include <vos_getBin.h>
+#include <vos_trace.h>
+#include <vos_event.h>
+#include <vos_lock.h>
+#include <vos_mq.h>
+#include <vos_nvitem.h>
+#include <vos_packet.h>
+#include <vos_threads.h>
+#include <vos_timer.h>
+#include <vos_pack_align.h>
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_preOpen() - PreOpen the vOSS Module  
+    
+  The \a vos_preOpen() function allocates the Vos Context, but do not      
+  initialize all the members. This overal initialization will happen
+  at vos_Open().
+  The reason why we need vos_preOpen() is to get a minimum context 
+  where to store BAL and SAL relative data, which happens before
+  vos_Open() is called.
+  
+  \param  pVosContext: A pointer to where to store the VOS Context 
+ 
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+              
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_open()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext );
+
+VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext );
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+
+VOS_STATUS vos_preStart( v_CONTEXT_t vosContext );
+
+#endif
+
+VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, v_SIZE_t hddContextSize );
+
+
+
+VOS_STATUS vos_start( v_CONTEXT_t vosContext ); 
+
+VOS_STATUS vos_stop( v_CONTEXT_t vosContext );
+
+VOS_STATUS vos_close( v_CONTEXT_t vosContext );
+
+/* vos shutdown will not close control transport and will not handshake with Riva */
+VOS_STATUS vos_shutdown( v_CONTEXT_t vosContext );
+
+/* the wda interface to shutdown */
+VOS_STATUS vos_wda_shutdown( v_CONTEXT_t vosContext );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_get_context() - get context data area
+  
+  Each module in the system has a context / data area that is allocated
+  and maanged by voss.  This API allows any user to get a pointer to its 
+  allocated context data area from the VOSS global context.  
+
+  \param vosContext - the VOSS Global Context.  
+  
+  \param moduleId - the module ID, who's context data are is being retrived.
+                      
+  \return - pointer to the context data area.
+  
+          - NULL if the context data is not allocated for the module ID
+            specified 
+              
+  --------------------------------------------------------------------------*/
+v_VOID_t *vos_get_context( VOS_MODULE_ID moduleId, 
+                           v_CONTEXT_t vosContext );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_get_global_context() - get VOSS global Context
+  
+  This API allows any user to get the VOS Global Context pointer from a
+  module context data area.  
+  
+  \param moduleContext - the input module context pointer
+  
+  \param moduleId - the module ID who's context pointer is input in 
+         moduleContext.
+                      
+  \return - pointer to the VOSS global context
+  
+          - NULL if the function is unable to retreive the VOSS context. 
+              
+  --------------------------------------------------------------------------*/
+v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, 
+                                    v_VOID_t *moduleContext );
+
+v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
+void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
+v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
+void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_alloc_context() - allocate a context within the VOSS global Context
+  
+  This API allows any user to allocate a user context area within the 
+  VOS Global Context.  
+  
+  \param pVosContext - pointer to the global Vos context
+  
+  \param moduleId - the module ID who's context area is being allocated.
+  
+  \param ppModuleContext - pointer to location where the pointer to the 
+                           allocated context is returned.  Note this 
+                           output pointer is valid only if the API
+                           returns VOS_STATUS_SUCCESS
+  
+  \param size - the size of the context area to be allocated.
+                      
+  \return - VOS_STATUS_SUCCESS - the context for the module ID has been 
+            allocated successfully.  The pointer to the context area
+            can be found in *ppModuleContext.  
+            \note This function returns VOS_STATUS_SUCCESS if the 
+            module context was already allocated and the size 
+            allocated matches the size on this call.
+
+            VOS_STATUS_E_INVAL - the moduleId is not a valid or does 
+            not identify a module that can have a context allocated.
+
+            VOS_STATUS_E_EXISTS - vos could allocate the requested context 
+            because a context for this module ID already exists and it is
+            a *different* size that specified on this call.
+            
+            VOS_STATUS_E_NOMEM - vos could not allocate memory for the 
+            requested context area.  
+              
+  \sa vos_get_context(), vos_free_context()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, 
+                              v_VOID_t **ppModuleContext, v_SIZE_t size );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_free_context() - free an allocated a context within the 
+                               VOSS global Context
+  
+  This API allows a user to free the user context area within the 
+  VOS Global Context.  
+  
+  \param pVosContext - pointer to the global Vos context
+  
+  \param moduleId - the module ID who's context area is being free
+  
+  \param pModuleContext - pointer to module context area to be free'd.
+                      
+  \return - VOS_STATUS_SUCCESS - the context for the module ID has been 
+            free'd.  The pointer to the context area is not longer 
+            available.
+            
+            VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not 
+            valid pointers.
+                                 
+            VOS_STATUS_E_INVAL - the moduleId is not a valid or does 
+            not identify a module that can have a context free'd.
+            
+            VOS_STATUS_E_EXISTS - vos could not free the requested 
+            context area because a context for this module ID does not
+            exist in the global vos context.
+              
+  \sa vos_get_context()              
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
+                             v_VOID_t *pModuleContext );
+                             
+v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx);
+void vos_abort_mac_scan(void);
+
+/**
+  @brief vos_wlanShutdown() - This API will shutdown WLAN driver
+
+  This function is called when Riva subsystem crashes.  There are two
+  methods (or operations) in WLAN driver to handle Riva crash,
+    1. shutdown: Called when Riva goes down, this will shutdown WLAN
+                 driver without handshaking with Riva.
+    2. re-init:  Next API
+
+  @param
+       NONE
+  @return
+       VOS_STATUS_SUCCESS   - Operation completed successfully.
+       VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_wlanShutdown(void);
+
+/**
+  @brief vos_wlanReInit() - This API will re-init WLAN driver
+
+  This function is called when Riva subsystem reboots.  There are two
+  methods (or operations) in WLAN driver to handle Riva crash,
+    1. shutdown: Previous API
+    2. re-init:  Called when Riva comes back after the crash. This will
+                 re-initialize WLAN driver. In some cases re-open may be
+                 referred instead of re-init.
+  @param
+       NONE
+  @return
+       VOS_STATUS_SUCCESS   - Operation completed successfully.
+       VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_wlanReInit(void);
+
+#endif // if !defined __VOS_NVITEM_H
diff --git a/CORE/VOSS/inc/vos_diag_core_event.h b/CORE/VOSS/inc/vos_diag_core_event.h
new file mode 100644
index 0000000..959a264
--- /dev/null
+++ b/CORE/VOSS/inc/vos_diag_core_event.h
@@ -0,0 +1,255 @@
+/*
+ * 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( __VOS_DIAG_CORE_EVENT_H )
+#define __VOS_DIAG_CORE_EVENT_H
+
+/**=========================================================================
+  
+  \file  vos_event.h
+  
+  \brief virtual Operating System Services (vOSS) DIAG Events
+               
+   Definitions for vOSS Events
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_types.h"
+#include "vos_pack_align.h"
+#include "i_vos_diag_core_event.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_SECURITY
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t eventId;
+   v_U8_t authMode;
+   v_U8_t encryptionModeUnicast;
+   v_U8_t encryptionModeMulticast;
+   v_U8_t pmkIDMatch;
+   v_U8_t bssid[6];
+   v_U8_t keyId;
+   v_U8_t status;
+} vos_event_wlan_security_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_STATUS
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t eventId;
+   v_U8_t ssid[6];
+   v_U8_t bssType;
+   v_U8_t rssi;
+   v_U8_t channel;
+   v_U8_t qosCapability;
+   v_U8_t authType;
+   v_U8_t encryptionType;
+   v_U8_t reason;
+   v_U8_t reasonDisconnect;
+} vos_event_wlan_status_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_HANDOFF
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t eventId;
+   v_U8_t currentApBssid[6];
+   v_U8_t currentApRssi;
+   v_U8_t candidateApBssid[6];
+   v_U8_t candidateApRssi;
+} vos_event_wlan_handoff_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_VCC
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t eventId;
+   v_U8_t rssi;
+   v_U8_t txPer;
+   v_U8_t rxPer;
+   int    linkQuality;
+} vos_event_wlan_vcc_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_QOS
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t eventId;
+   v_U8_t reasonCode;
+} vos_event_wlan_qos_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_PE
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   char       bssid[6];
+   v_U16_t    event_type;
+   v_U16_t    sme_state;
+   v_U16_t    mlm_state;
+   v_U16_t    status;
+   v_U16_t    reason_code;   
+} vos_event_wlan_pe_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_ADD_BLOCK_ACK_SUCCESS
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+  char        ucBaPeerMac[6];
+  v_U8_t      ucBaTid;
+  v_U8_t      ucBaBufferSize;
+  v_U16_t     usBaSSN;
+  v_U8_t      fInitiator; 
+} vos_event_wlan_add_block_ack_success_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_ADD_BLOCK_ACK_FAILED
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+  char        ucBaPeerMac[6]; 
+  v_U8_t      ucBaTid;
+  v_U8_t      ucReasonCode;
+  v_U8_t      fInitiator; 
+} vos_event_wlan_add_block_ack_failed_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_DELETE_BLOCK_ACK_SUCCESS
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+  char        ucBaPeerMac[6]; 
+  v_U8_t      ucBaTid;
+  v_U8_t      ucDeleteReasonCode; 
+} vos_event_wlan_add_block_ack_deleted_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_DELETE_BLOCK_ACK_FAILED
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+  char        ucBaPeerMac[6]; 
+  v_U8_t      ucBaTid;
+  v_U8_t      ucDeleteReasonCode; 
+  v_U8_t      ucFailReasonCode;
+} vos_event_wlan_add_block_ack_delete_failed_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_BSS_PROTECTION
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+  v_U8_t      event_type;
+  v_U8_t      prot_type; 
+} vos_event_wlan_bss_prot_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_BRINGUP_STATUS
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U16_t  wlanStatus;
+   char     driverVersion[10];
+} vos_event_wlan_bringup_status_payload_type;
+
+VOS_PACK_START
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_POWERSAVE_GENERIC
+  ------------------------------------------------------------------------*/
+typedef VOS_PACK_PRE struct
+{
+   v_U8_t   event_subtype;
+   v_U32_t  imps_period;
+   v_U8_t   full_power_request_reason;
+   v_U8_t   pmc_current_state;
+   v_U8_t   enable_disable_powersave_mode;
+   v_U8_t   winmob_d_power_state;
+   v_U8_t   dtim_period;
+   v_U16_t  final_listen_intv;
+   v_U16_t  bmps_auto_timer_duration;
+   v_U16_t  bmps_period;
+} VOS_PACK_POST vos_event_wlan_powersave_payload_type;
+
+VOS_PACK_END
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_POWERSAVE_WOW
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t   event_subtype;
+   v_U8_t   wow_type;
+   v_U8_t   wow_magic_pattern[6];
+   v_U8_t   wow_del_ptrn_id;
+   v_U8_t   wow_wakeup_cause;
+   v_U8_t   wow_wakeup_cause_pbm_ptrn_id;
+} vos_event_wlan_powersave_wow_payload_type;
+
+/*------------------------------------------------------------------------- 
+  Event ID: EVENT_WLAN_BTC
+  ------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U8_t  eventId;
+   v_U8_t  btAddr[6];
+   v_U16_t connHandle;
+   v_U8_t  connStatus;
+   v_U8_t  linkType;
+   v_U8_t  scoInterval;
+   v_U8_t  scoWindow;
+   v_U8_t  retransWindow;
+   v_U8_t  mode;
+} vos_event_wlan_btc_type;
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __VOS_DIAG_CORE_EVENT_H
diff --git a/CORE/VOSS/inc/vos_diag_core_log.h b/CORE/VOSS/inc/vos_diag_core_log.h
new file mode 100644
index 0000000..21435b9
--- /dev/null
+++ b/CORE/VOSS/inc/vos_diag_core_log.h
@@ -0,0 +1,339 @@
+/*
+ * 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( __VOS_DIAG_CORE_LOG_H )
+#define __VOS_DIAG_CORE_LOG_H
+
+/**=========================================================================
+  
+  \file  vos_event.h
+  
+  \brief virtual Operating System Services (vOSS) DIAG logs
+               
+   Definitions for vOSS Events
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_types.h"
+#include "i_vos_diag_core_log.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#define VOS_LOG_MAX_NUM_SSID                                21
+#define VOS_LOG_MAX_NUM_BSSID                               21
+#define VOS_LOG_MAX_SSID_SIZE                               32
+#define VOS_LOG_MAX_BSSID_SIZE                              6
+#define VOS_LOG_MAX_NUM_CHANNEL                             64
+#define VOS_LOG_MAX_NUM_HO_CANDIDATE_APS                    20
+#define VOS_LOG_MAX_WOW_PTRN_SIZE                           128
+#define VOS_LOG_MAX_WOW_PTRN_MASK_SIZE                      16
+
+/*---------------------------------------------------------------------------
+   This packet contains the scan results of the recent scan operation 
+   LOG_WLAN_SCAN_C                                 0x1496 
+---------------------------------------------------------------------------*/   
+typedef struct
+{
+   log_hdr_type  hdr;
+   v_U8_t  eventId;
+   v_U8_t  numSsid;
+   v_U8_t  ssid[VOS_LOG_MAX_NUM_SSID][VOS_LOG_MAX_SSID_SIZE];
+   v_U8_t  bssid[VOS_LOG_MAX_NUM_BSSID][VOS_LOG_MAX_BSSID_SIZE];
+   v_U8_t  totalSsid;
+   v_U8_t  minChnTime;
+   v_U8_t  maxChnTime;
+   v_U16_t timeBetweenBgScan;
+   v_U8_t  BSSMode;
+   v_U8_t  numChannel;
+   v_U8_t  channels[VOS_LOG_MAX_NUM_CHANNEL];
+   v_U16_t status;
+} vos_log_scan_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the information related to IBSS connection setup  
+   LOG_WLAN_IBSS_C                                 0x1497 
+---------------------------------------------------------------------------*/   
+typedef struct 
+{
+   log_hdr_type  hdr;
+   v_U8_t eventId;
+   v_U8_t channelSetting;
+   v_U8_t bssid[VOS_LOG_MAX_BSSID_SIZE];
+   v_U8_t peerMacAddr[VOS_LOG_MAX_BSSID_SIZE];
+   v_U8_t ssid[VOS_LOG_MAX_SSID_SIZE];
+   v_U8_t operatingChannel;
+   v_U8_t beaconInterval;
+   v_U8_t status;
+} vos_log_ibss_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the information related to 802.11D   
+   LOG_WLAN_80211D_C                               0x1498 
+---------------------------------------------------------------------------*/   
+typedef struct
+{
+   log_hdr_type  hdr;
+   v_U8_t eventId;
+   v_U8_t numChannel;
+   v_U8_t Channels[VOS_LOG_MAX_NUM_CHANNEL];
+   v_U8_t TxPwr[VOS_LOG_MAX_NUM_CHANNEL];
+   v_U8_t countryCode[3];
+   v_U8_t supportMultipleDomain;
+} vos_log_802_11d_pkt_type;
+
+/*---------------------------------------------------------------------------
+This is a log packet which contains below handoff information:
+- Current AP + RSSI (if already associated)
+- Candidate AP + RSSI (before association and when the list is updated)
+- For each BSSID in candidate list, provide RSSI, QoS and security compatibility
+LOG_WLAN_HANDOFF_C                              0x1499
+---------------------------------------------------------------------------*/   
+typedef struct
+{
+  v_U8_t        ssid[9];
+  v_U8_t        bssid[VOS_LOG_MAX_BSSID_SIZE];
+  v_U8_t        channel_id;
+  v_U32_t       qos_score;
+  v_U32_t       sec_score;
+  v_U32_t       rssi_score;
+  v_U32_t       overall_score;
+  v_U32_t       tx_per;     /* represented as a %      */
+  v_U32_t       rx_per;     /* represented as a %      */
+
+} vos_log_ho_ap_info;
+
+typedef struct
+{
+  log_hdr_type       hdr;
+  v_U32_t            num_aps;
+  vos_log_ho_ap_info current_ap_info;
+  vos_log_ho_ap_info candidate_ap_info[VOS_LOG_MAX_NUM_HO_CANDIDATE_APS];
+} vos_log_ho_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the information related to the EDCA parameters 
+   advertised by the AP
+   LOG_WLAN_QOS_EDCA_C                             0x149A
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  log_hdr_type       hdr;
+  v_U8_t             aci_be;
+  v_U8_t             cw_be;
+  v_U16_t            txoplimit_be;
+  v_U8_t             aci_bk;
+  v_U8_t             cw_bk;
+  v_U16_t            txoplimit_bk;
+  v_U8_t             aci_vi;
+  v_U8_t             cw_vi;
+  v_U16_t            txoplimit_vi;
+  v_U8_t             aci_vo;
+  v_U8_t             cw_vo;
+  v_U16_t            txoplimit_vo;
+} vos_log_qos_edca_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the total number of beacon received value    
+   LOG_WLAN_BEACON_UPDATE_C                        0x149B
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  log_hdr_type       hdr;
+  v_U32_t            bcn_rx_cnt;
+} vos_log_beacon_update_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the information related to a WoW patern value when set
+   LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C               0x149C 
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  log_hdr_type       hdr;
+  v_U8_t             pattern_id;
+  v_U8_t             pattern_byte_offset;
+  v_U8_t             pattern_size;
+  v_U8_t             pattern[VOS_LOG_MAX_WOW_PTRN_SIZE];
+  v_U8_t             pattern_mask_size;
+  v_U8_t             pattern_mask[VOS_LOG_MAX_WOW_PTRN_MASK_SIZE];
+} vos_log_powersave_wow_add_ptrn_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the PHY & MAC layer statistics sent by lower layer
+   _WLAN_LINKLAYER_STAT_C                       0x14A1
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   v_U32_t retry_cnt[4];
+   v_U32_t multiple_retry_cnt[4];
+   v_U32_t tx_frm_cnt[4];
+   v_U32_t rx_frm_cnt;
+   v_U32_t frm_dup_cnt;
+   v_U32_t fail_cnt[4];
+   v_U32_t rts_fail_cnt;
+   v_U32_t ack_fail_cnt;
+   v_U32_t rts_succ_cnt;
+   v_U32_t rx_discard_cnt;
+   v_U32_t rx_error_cnt;
+   v_U32_t tx_byte_cnt;
+
+} summaryStatsInfo;
+
+typedef struct
+{
+   v_U32_t rx_frag_cnt;
+   v_U32_t promiscuous_rx_frag_cnt;
+   v_U32_t rx_input_sensitivity;
+   v_U32_t max_pwr;
+   v_U32_t sync_fail_cnt;
+   v_U32_t tx_rate;
+
+} globalClassAStatsInfo;
+
+typedef struct
+{
+   v_U32_t uc_rx_wep_unencrypted_frm_cnt;
+   v_U32_t uc_rx_mic_fail_cnt;
+   v_U32_t uc_tkip_icv_err;
+   v_U32_t uc_aes_ccmp_format_err;
+   v_U32_t uc_aes_ccmp_replay_cnt;
+   v_U32_t uc_aes_ccmp_decrpt_err;
+   v_U32_t uc_wep_undecryptable_cnt;
+   v_U32_t uc_wep_icv_err;
+   v_U32_t uc_rx_decrypt_succ_cnt;
+   v_U32_t uc_rx_decrypt_fail_cnt;
+   v_U32_t mcbc_rx_wep_unencrypted_frm_cnt;
+   v_U32_t mcbc_rx_mic_fail_cnt;
+   v_U32_t mcbc_tkip_icv_err;
+   v_U32_t mcbc_aes_ccmp_format_err;
+   v_U32_t mcbc_aes_ccmp_replay_cnt;
+   v_U32_t mcbc_aes_ccmp_decrpt_err;
+   v_U32_t mcbc_wep_undecryptable_cnt;
+   v_U32_t mcbc_wep_icv_err;
+   v_U32_t mcbc_rx_decrypt_succ_cnt;
+   v_U32_t mcbc_rx_decrypt_fail_cnt;
+
+} globalClassBStatsInfo;
+
+typedef struct
+{
+   v_U32_t rx_amsdu_cnt;
+   v_U32_t rx_ampdu_cnt;
+   v_U32_t tx_20_frm_cnt;
+   v_U32_t rx_20_frm_cnt;
+   v_U32_t rx_mpdu_in_ampdu_cnt;
+   v_U32_t ampdu_delimiter_crc_err;
+
+} globalClassCStatsInfo;
+
+typedef struct
+{
+   v_U32_t tx_uc_frm_cnt;
+   v_U32_t tx_mc_frm_cnt;
+   v_U32_t tx_bc_frm_cnt;
+   v_U32_t rx_uc_frm_cnt;
+   v_U32_t rx_mc_frm_cnt;
+   v_U32_t rx_bc_frm_cnt;
+   v_U32_t tx_uc_byte_cnt[4];
+   v_U32_t tx_mc_byte_cnt;
+   v_U32_t tx_bc_byte_cnt;
+   v_U32_t rx_uc_byte_cnt[4];
+   v_U32_t rx_mc_byte_cnt;
+   v_U32_t rx_bc_byte_cnt;
+   v_U32_t rx_byte_cnt;
+   v_U32_t num_rx_bytes_crc_ok;
+   v_U32_t rx_rate;
+
+} globalClassDStatsInfo;
+
+typedef struct
+{
+   v_U32_t tx_frag_cnt[4];
+   v_U32_t tx_ampdu_cnt;
+   v_U32_t tx_mpdu_in_ampdu_cnt;
+} perStaStatsInfo;
+
+typedef struct
+{
+  log_hdr_type             hdr;
+  v_U8_t                   version;
+  v_U8_t                   reserved[3];
+  v_U32_t                  stat_mask;
+  summaryStatsInfo         summaryStats;
+  globalClassAStatsInfo    globalClassAStats;
+  globalClassBStatsInfo    globalClassBStats;
+  globalClassCStatsInfo    globalClassCStats;
+  globalClassDStatsInfo    globalClassDStats;
+  perStaStatsInfo          perStaStats;
+} vos_log_statistics_pkt_type;
+
+/*---------------------------------------------------------------------------
+   This packet contains the Tspec info negotiated with the AP for the 
+   specific AC 
+   LOG_WLAN_QOS_TSPEC_C                            0x14A2 
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  log_hdr_type    hdr;
+  v_U8_t          tsinfo[3];
+  v_U16_t         nominal_msdu_size;
+  v_U16_t         maximum_msdu_size;
+  v_U32_t         min_service_interval;
+  v_U32_t         max_service_interval;
+  v_U32_t         inactivity_interval;
+  v_U32_t         suspension_interval;
+  v_U32_t         svc_start_time;
+  v_U32_t         min_data_rate;
+  v_U32_t         mean_data_rate;
+  v_U32_t         peak_data_rate;
+  v_U32_t         max_burst_size;
+  v_U32_t         delay_bound;
+  v_U32_t         min_phy_rate;
+  v_U16_t         surplus_bw_allowance;
+  v_U16_t         medium_time;
+} vos_log_qos_tspec_pkt_type;
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __VOS_DIAG_CORE_LOG_H
diff --git a/CORE/VOSS/inc/vos_event.h b/CORE/VOSS/inc/vos_event.h
new file mode 100644
index 0000000..515cefa
--- /dev/null
+++ b/CORE/VOSS/inc/vos_event.h
@@ -0,0 +1,270 @@
+/*
+ * 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( __VOS_EVENT_H )
+#define __VOS_EVENT_H
+
+/**=========================================================================
+  
+  \file  vos_event.h
+  
+  \brief virtual Operating System Services (vOSS) Events
+               
+   Definitions for vOSS Events
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_status.h"
+#include "vos_types.h"
+#include "i_vos_event.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+  
+  \brief vos_event_init() - initialize a vOSS event
+  
+  The \a vos_lock_event() function initializes the specified event. Upon 
+  successful initialization, the state of the event becomes initialized 
+  and not 'signaled.
+
+  An event must be initialized before it may be used in any other lock 
+  functions. 
+  
+  Attempting to initialize an already initialized event results in 
+  a failure.
+ 
+  \param lock - pointer to the opaque event object to initialize
+  
+  \return VOS_STATUS_SUCCESS - event was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the event
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the event
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to reinitialize the object referenced by event, a previously 
+          initialized, but not yet destroyed, event.
+
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.     
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_init( vos_event_t *event );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_event_set() - set a vOSS event
+
+  The state of the specified event is set to 'signalled by calling 
+  \a vos_event_set().  The state of the event remains signalled until an 
+  explicit call to vos_event_reset().  
+  
+  Any threads waiting on the event as a result of a vos_event_wait() will 
+  be unblocked and available to be scheduled for execution when the event
+  is signaled by a call to \a vos_event_set().  
+    
+  \param event - the event to set to the signalled state
+  
+  \return VOS_STATUS_SUCCESS - the event was successfully signalled.
+  
+          VOS_STATUS_E_INVAL - The value specified by event does not refer 
+          to an initialized event object.
+          
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.     
+          
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_set( vos_event_t * event );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_event_reset() - reset a vOSS event
+
+  The state of the specified event is set to 'NOT signalled' by calling 
+  \a vos_event_reset().  The state of the event remains NOT signalled until an 
+  explicit call to vos_event_set().  
+  
+  This function sets the event to a NOT signalled state even if the event was 
+  signalled multiple times before being signaled.
+  
+  \param event - the event to set to the NOT signalled state
+  
+  \return VOS_STATUS_SUCCESS - the event state was successfully change to 
+          NOT signalled.
+  
+          VOS_STATUS_E_INVAL - The value specified by event does not refer 
+          to an initialized event object.
+          
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.     
+          
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_reset( vos_event_t * event );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_event_destroy() - Destroy a vOSS event
+
+  The \a vos_event_destroy() function shall destroy the event object 
+  referenced by event.  After a successful return from \a vos_event_destroy()
+  the event object becomes, in effect, uninitialized.
+   
+  A destroyed event object can be reinitialized using vos_event_init(); 
+  the results of otherwise referencing the object after it has been destroyed 
+  are undefined.  Calls to vOSS event functions to manipulate the lock such
+  as vos_event_set() will fail if the event is destroyed.  Therefore, 
+  don't use the event after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param event - the event object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - event was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by event while it is still being
+          referenced (there are threads waiting on this event) 
+
+          VOS_STATUS_E_INVAL - The value specified by event is invalid.
+          
+          VOS_STATUS_E_FAULT - event is an invalid pointer.     
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_destroy( vos_event_t *event );
+
+// TODO: this is being removed and a stub exists currently to avoid 
+// compiler errors
+VOS_STATUS vos_wait_events( vos_event_t *events, v_U8_t numEvents,
+                            v_U32_t timeout, v_U8_t *pEventIndex );
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_wait_single_event() - Waits for a single event to be set.
+
+   This API waits for the event to be set.
+   
+  \param pEvent - pointer to an event to wait on.
+  
+  \param timeout - Timeout value (in milliseconds).  This function returns
+         if this interval elapses, regardless if any of the events have 
+         been set.  An input value of 0 for this timeout parameter means 
+         to wait infinitely, meaning a timeout will never occur.
+  
+  \return VOS_STATUS_SUCCESS - the wait was satisifed by the event being
+          set.  
+                               
+          VOS_STATUS_E_TIMEOUT - the timeout interval elapsed before the
+          event was set.
+                                 
+          VOS_STATUS_E_INVAL - The value specified by event is invalid.
+          
+          VOS_STATUS_E_FAULT - pEvent is an invalid pointer.     
+                                 
+  \sa vos_wait_multiple_events()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_wait_single_event( vos_event_t *pEvent, v_U32_t timeout );
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_wait_multiple_events() - Waits for event(s) to be set.
+
+   This API waits for any event in the input array of events to be
+   set.  The caller is blocked waiting any event in the array to be 
+   set or for the timeout to occur. 
+   
+   If multiple events in the array are set, only one event is identified
+   in the return from this call as satisfying the wait condition.  The
+   caller is responsible for calling \a vos_wait_events() again to find
+   the other events that are set.
+  
+  \param pEventList - pointer to an array of event pointers
+  
+  \param numEvents - Number of events
+  
+  \param timeout - Timeout value (in milliseconds).  This function returns
+         if this interval elapses, regardless if any of the events have 
+         been set.  An input value of 0 for this timeout parameter means 
+         to wait infinitely, meaning a timeout will never occur.
+  
+  \param pEventIndex - This is a pointer to the location where the index of 
+         the event in the event array that satisfied the wait because 
+         the event was set.  
+  
+  \return VOS_STATUS_SUCCESS - the wait was satisifed by one of the events
+          in the event array being set.  The index into the event arry 
+          that satisfied the wait can be found at *pEventIndex.
+                               
+          VOS_STATUS_E_TIMEOUT - the timeout interval elapsed before any of 
+          the events were set.
+                                 
+          VOS_STATUS_E_INVAL - At least one of the values specified in the 
+          event array refers to an uninitialized event object.  The invalid
+          event is identified by the index in *pEventIndex.  Note that only
+          the first uninitialized event is detected when this error is 
+          returned.
+          
+          VOS_STATUS_E_EMPTY - the events array is empty.  This condition
+          is detected by numEvents being 0 on input.
+           
+          VOS_STATUS_E_FAULT - event or pEventIndex is an invalid pointer.     
+                                 
+  \sa vos_wait_single_events()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_wait_multiple_events( vos_event_t **pEventList, v_U8_t numEvents,
+   v_U32_t timeout, v_U8_t *pEventIndex );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // __VOSS_EVENT_H
diff --git a/CORE/VOSS/inc/vos_getBin.h b/CORE/VOSS/inc/vos_getBin.h
new file mode 100644
index 0000000..a9854a2
--- /dev/null
+++ b/CORE/VOSS/inc/vos_getBin.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.
+ */
+
+#if !defined( __VOS_GETBIN_H )
+#define __VOS_GETBIN_H
+
+/**=========================================================================
+  
+  \file  vos_getBin.h
+  
+  \brief virtual Operating System Services (vOSS) binary APIs
+               
+   Binary retrieval definitions and APIs.  
+   
+   These APIs allow components to retrieve binary contents (firmware, 
+   configuration data, etc.) from a storage medium on the platform.
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+/// Binary IDs  
+typedef enum
+{
+  /// Binary ID for firmware
+  VOS_BINARY_ID_FIRMWARE,
+  
+  /// Binary ID for Configuration data
+  VOS_BINARY_ID_CONFIG,
+
+  /// Binary ID for country code to regulatory domain mapping
+  VOS_BINARY_ID_COUNTRY_INFO,
+
+  /// Binary ID for Handoff Configuration data
+  VOS_BINARY_ID_HO_CONFIG
+
+  
+} VOS_BINARY_ID;
+
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+  
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_get_binary_blob() - get binary data from platform
+
+  This API allows components to get binary data from the platform independent
+  of where the data is stored on the device.
+  
+  <ul>
+    <li> Firmware
+    <li> Configuration Data
+  </ul> 
+  
+  \param binaryId - identifies the binary data to return to the caller.
+         
+  \param pBuffer - a pointer to the buffer where the binary data will be 
+         retrieved.  Memory for this buffer is allocated by the caller 
+         and free'd by the caller. vOSS will fill this buffer with 
+         raw binary data and update the *pBufferSize with the exact
+         size of the data that has been retreived.
+         
+         Input value of NULL is valid and will cause the API to return 
+         the size of the binary data in *pBufferSize.
+         
+  \param pBufferSize - pointer to a variable that upon input contains the 
+         size of the data buffer available at pBuffer.  Upon success, this
+         variable is updated with the size of the binary data that was 
+         retreived and written to the buffer at pBuffer.
+         
+         Input value of 0 is valid and will cause the API to return
+         the size of the binary data in *pBufferSize.
+         
+  \return VOS_STATUS_SUCCESS - the binary data has been successfully 
+          retreived and written to the buffer.
+          
+          VOS_STATUS_E_INVAL - The value specified by binaryId does not 
+          refer to a valid VOS Binary ID.
+          
+          VOS_STATUS_E_FAULT - pBufferSize is not a valid pointer to a 
+          variable that the API can write to.
+          
+          VOS_STATUS_E_NOMEM - the memory referred to by pBuffer and 
+          *pBufferSize is not big enough to contain the binary.
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_get_binary_blob( VOS_BINARY_ID binaryId, 
+                                v_VOID_t *pBuffer, v_SIZE_t *pBufferSize );
+
+#ifdef WLAN_SOFTAP_FEATURE
+/**----------------------------------------------------------------------------
+   \brief vos_get_conparam()- function to read the insmod parameters
+-----------------------------------------------------------------------------*/
+tVOS_CON_MODE vos_get_conparam( void );
+#endif
+tVOS_CONCURRENCY_MODE vos_get_concurrency_mode( void );
+v_BOOL_t vos_concurrent_sessions_running(void);
+
+#endif // !defined __VOS_GETBIN_H
diff --git a/CORE/VOSS/inc/vos_list.h b/CORE/VOSS/inc/vos_list.h
new file mode 100644
index 0000000..17e3f0a
--- /dev/null
+++ b/CORE/VOSS/inc/vos_list.h
@@ -0,0 +1,582 @@
+/*
+ * 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( __VOS_LIST_H )
+#define __VOS_LIST_H
+
+/**=========================================================================
+  
+  \file  vos_list.h
+  
+  \brief virtual Operating System Services (vOSS) List APIs
+               
+   Definitions for vOSS Linked Lists API
+   
+   Lists are implemented as a doubly linked list. An item in a list can 
+   be of any type as long as the datatype contains a field of type 
+   vos_link_t.
+
+   In general, a list is a doubly linked list of items with a pointer 
+   to the front of the list and a pointer to the end of the list.  The
+   list items contain a forward and back link.
+            
+     List                            Nodes
+   =============          ===========================
+   +-------+
+   | Front |------------->+---------+     +---------+
+   +-------+              | Next    |---->| Next    |---->NULL
+   | Back  |-+            +---------+     +---------+
+   +-------+ |   NULL<----| Prev    |<----| Prev    |
+             |            +---------+     +---------+
+             |            |User Data|     |User Data|
+             |            +---------+     +---------+
+             |                                 ^
+             |                                 |
+             +---------------------------------+
+
+   This linked list API is implemented with appropriate locking
+   mechanisms to assure operations on the list are thread safe.
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+#include <i_vos_list.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+  
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_init() - initialize a vOS Linked List  
+    
+  The \a vos_list_init() function initializes the specified linked list
+  'object'.  Upon successful initialization, the state of the list 
+  becomes initialized and available for use through the other vos_list_xxx
+  APIs.
+
+  A list must be initialized by calling vos_list_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized list results in 
+  a failure.
+ 
+  \param pList - pointer to the opaque list object to initialize
+  
+  \return VOS_STATUS_SUCCESS - list was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the list
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the list
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to reinitialize the object referenced by list, a previously 
+          initialized, but not yet destroyed, list.
+
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer.     
+          
+  \sa vos_list_destroy()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_init( vos_list_t *pList );
+
+
+/**-------------------------------------------------------------------------
+  
+  \brief vos_list_destroy() - Destroy a vOSS List
+
+  The \a vos_list_destroy() function shall destroy the list object 
+  referenced by pList.  After a successful return from \a vos_list_destroy()
+  the list object becomes, in effect, uninitialized.
+   
+  A destroyed lock object can be reinitialized using vos_list_init(); 
+  the results of otherwise referencing the object after it has been destroyed 
+  are undefined.  Calls to vOSS list functions to manipulate the list such
+  will fail if the list or has not been initialized or is destroyed.  
+  Therefore, don't use the list after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param pLlist - pointer to the list object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - list was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by pList that is still has
+          nodes.  The list must be empty before it can be destroyed. 
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer.     
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_list_destroy( vos_list_t *pList );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_list_lock() - Lock a vOSS List
+
+  The \a vos_list_lock() function shall lock the list object to prevent
+  other tasks from operating on this list.  The list remains locked until
+  a call to vos_list_unlock() is made.
+  
+  Each list function already operate within a critical section.  
+  However it is sometimes necessary to lock a list over a series of list 
+  function calls.  
+  
+  For example, when one needs to search a node on a list and insert another 
+  node after it, one would want to lock this list for the entire process 
+  in case another task attempts to manipulate this list.
+
+  \param pLlist - pointer to the list object to be locked.
+  
+  \return VOS_STATUS_SUCCESS - list was successfully locked.
+  
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer.     
+
+  \sa vos_list_unlock()
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_list_lock( vos_list_t *pList );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_list_unlock() - Unlock a vOSS List
+
+  The \a vos_list_unlock() function shall unlock the list object to allow 
+  other tasks to use this list.  This function is only called when 
+  the vos_list_lock() is previously called in the current task. 
+  
+  \param pLlist - pointer to the list object to be unlocked.
+  
+  \return VOS_STATUS_SUCCESS - list was successfully unlocked.
+  
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer.     
+
+  \sa vos_list_lock()
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_list_unlock( vos_list_t *pList );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_insert_front() - insert node at front of a linked list 
+
+  The vos_list_insert_front() API will insert a node at the front of
+  a properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNode - Pointer to the list node to be inserted into the list.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer or pNode is an
+          invalid pointer.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_front( vos_list_t *pList, vos_list_node_t *pNode );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_insert_back() - insert node at back of a linked list 
+
+  The vos_list_insert_back() API will insert a node at the back of
+  a properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNode - Pointer to the list node to be inserted into the list.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto 
+          the back of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer or pNode is an
+          invalid pointer.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_back( vos_list_t *pList, vos_list_node_t *pNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_insert_back_size() - insert node at back of a linked list and
+  return the size AFTER the enqueue. This size is determined in a race free 
+  manner i.e. while the list is locked for the enqueue operation
+
+  The vos_list_insert_back_size() API will insert a node at the back of
+  a properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNode - Pointer to the list node to be inserted into the list.
+
+  \param pSize - Pointer to a size variable, where the size of the 
+                 list will be returned.
+ 
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto 
+          the back of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer or pNode is an
+          invalid pointer.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_back_size( vos_list_t *pList, vos_list_node_t *pNode, v_SIZE_t *pSize );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_remove_front() - remove node at front of a linked list 
+
+  The vos_list_remove_front() API will remove a node at the front of
+  a properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to a pointer to the list node to be removed 
+  from the list.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully removed from 
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+         
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer or ppNode is an
+          invalid pointer.
+    
+  \sa vos_list_remove_back()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_remove_front( vos_list_t *pList, vos_list_node_t **ppNode );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_remove_back() - remove node at back of a linked list 
+
+  The vos_list_remove_back() API will remove a node at the back of
+  a properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to a pointer to the list node to be removed 
+  from the list.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully removed from 
+          the back of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          VOS_STATUS_E_FAULT  - pList is an invalid pointer or ppNode is an
+          invalid pointer.
+    
+  \sa vos_list_remove_back()
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_remove_back( vos_list_t *pList, vos_list_node_t **ppNode );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_list_size() - return the size of of a linked list 
+
+  The vos_list_size() API will return the number of nodes on the 
+  given vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be counted
+  
+  \param pSize - Pointer to a size variable, where the size of the 
+                 list will be returned.
+  
+  \return VOS_STATUS_SUCCESS - list size of the properly initialized 
+          vos list object has been returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList or pSize are not valid pointers
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_size( vos_list_t *pList, v_SIZE_t *pSize );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_peek_front() - peek at the node at front of a linked list 
+
+  The vos_list_peek_front() API will return a pointer to the node at the 
+  front of a properly initialized vOS List object.  The node will *not* be
+  removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the front of the list.
+  
+  \return VOS_STATUS_SUCCESS - list node at the front of the list was 
+          successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          VOS_STATUS_E_FAULT  - pList or or ppNode is an invalid pointer.
+    
+  \sa vos_list_remove_back()
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_peek_front( vos_list_t *pList, vos_list_node_t **ppNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_peek_back() - peek at the node at back of a linked list 
+
+  The vos_list_peek_back() API will return a pointer to the node at the 
+  back of a properly initialized vOS List object.  The node will *not* be
+  removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the back of the list.
+  
+  \return VOS_STATUS_SUCCESS - list node at the back of the list was 
+          successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          VOS_STATUS_E_FAULT  - pList or or ppNode is an invalid pointer.
+    
+  \sa vos_list_peek_back(), vos_list_remove_back(), vos_list_peek_front(), 
+      vos_list_remove_front()
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_peek_back( vos_list_t *pList, vos_list_node_t **ppNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_peek_next() - peek at the node after the specified node 
+
+  The vos_list_peek_next() API will return a pointer to the node following the
+  specified node on a properly initialized vOS List object.  The node will 
+  *not* be removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param pNode - Pointer to the node that is being 'peeked'
+  
+  \param ppNode - Pointer to a pointer to the list node that follows the
+  pNode node on the list.
+  
+  \return VOS_STATUS_SUCCESS - list node following pNode on the properly 
+          initialized list is successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          VOS_STATUS_E_FAULT  - pList, pNode or ppNode is an invalid pointer.
+    
+  \sa vos_list_remove_back()
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_peek_next( vos_list_t *pList, vos_list_node_t *pNode, 
+                               vos_list_node_t **ppNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_peek_prev() - peek at the node before the specified node 
+
+  The vos_list_peek_prev() API will return a pointer to the node before the
+  specified node on a properly initialized vOS List object.  The node will 
+  *not* be removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param pNode - Pointer to the node that is being 'peeked'
+  
+  \param ppNode - Pointer to a pointer to the list node before the
+  pNode node on the list.
+  
+  \return VOS_STATUS_SUCCESS - list node before pNode on the properly 
+          initialized list is successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          VOS_STATUS_E_FAULT  - pList, pNode or ppNode is an invalid pointer.
+    
+  \sa vos_list_remove_back()
+  
+  --------------------------------------------------------------------------*/                                 
+VOS_STATUS vos_list_peek_prev( vos_list_t *pList, vos_list_node_t *pNode, 
+                               vos_list_node_t **ppNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_insert_before() - insert node at front of a specified
+  list node 
+
+  The vos_list_insert_before() API will insert a node onto a properly 
+  initialized vOS List object in front of the specified list node.
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+  
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  in front of.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList, pNodeToInsert, or pNode are
+          invalid pointer(s)
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_before( vos_list_t *pList, vos_list_node_t *pNodeToInsert, 
+                                   vos_list_node_t *pNode );
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_insert_after() - insert node behind a specified list node 
+
+  The vos_list_insert_after() API will insert a node onto a properly 
+  initialized vOS List object after the specified list node.
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+  
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  after.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_FAULT  - pList, pNodeToInsert, or pNode are
+          invalid pointer(s)
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/                                   
+VOS_STATUS vos_list_insert_after( vos_list_t *pList, vos_list_node_t *pNodeToInsert, 
+                                  vos_list_node_t *pNode );         
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_list_remove_node() - remove specified node from vOS list list 
+
+  The vos_list_remove_node() API will remove a specified node from the 
+  properly initialized vOS List object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to the node to be removed from the list.
+  
+  \return VOS_STATUS_SUCCESS - list node was successfully removed from 
+          the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+          
+          
+          VOS_STATUS_E_FAULT  - pList or pNodeToRemove is not a valid pointer
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/  
+VOS_STATUS vos_list_remove_node( vos_list_t *pList, vos_list_node_t *pNodeToRemove );
+
+
+
+#endif // __VOS_LIST_H
diff --git a/CORE/VOSS/inc/vos_lock.h b/CORE/VOSS/inc/vos_lock.h
new file mode 100644
index 0000000..3bfb3e3
--- /dev/null
+++ b/CORE/VOSS/inc/vos_lock.h
@@ -0,0 +1,249 @@
+/*
+ * 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( __VOS_LOCK_H )
+#define __VOS_LOCK_H
+
+/**=========================================================================
+  
+  \file  vos_lock.h
+  
+  \brief virtual Operating System Servies (vOS) Locks
+               
+   Definitions for vOSS Locks
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_status.h"
+#include "i_vos_lock.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_init() - initialize a vOSS lock
+  
+  The \a vos_lock_init() function initializes the specified lock. Upon 
+  successful initialization, the state of the lock becomes initialized 
+  and unlocked.
+
+  A lock must be initialized by calling vos_lock_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized lock results in 
+  a failure.
+ 
+  \param lock - pointer to the opaque lock object to initialize
+  
+  \return VOS_STATUS_SUCCESS - lock was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the lock
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the lock
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to reinitialize the object referenced by lock, a previously 
+          initialized, but not yet destroyed, lock.
+
+          VOS_STATUS_E_FAULT  - lock is an invalid pointer.     
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_init( vos_lock_t *lock );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_acquire() - acquire a lock
+
+  A lock object is acquired by calling \a vos_lock_acquire().  If the lock 
+  is already locked, the calling thread shall block until the lock becomes 
+  available. This operation shall return with the lock object referenced by 
+  lock in the locked state with the calling thread as its owner. 
+  
+  \param lock - the lock object to acquire
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully acquired by 
+          the calling thread.
+  
+          VOS_STATUS_E_INVAL - The value specified by lock does not refer 
+          to an initialized lock object.
+          
+          VOS_STATUS_E_FAULT - lock is an invalid pointer.     
+          
+  \sa
+  
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_acquire( vos_lock_t * lock );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_release() - release a lock
+
+  The \a vos_lock_release() function shall release the lock object 
+  referenced by 'lock'.  
+
+  If a thread attempts to release a lock that it unlocked or is not
+  initialized, an error is returned. 
+
+  \param lock - the lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+          VOS_STATUS_E_INVAL - The value specified by lock does not refer 
+          to an initialized lock object.
+                   
+          VOS_STATUS_E_FAULT - The value specified by lock does not refer 
+          to an initialized lock object.
+                   
+          VOS_STATUS_E_PERM - Operation is not permitted.  The calling 
+          thread does not own the lock. 
+    
+  \sa
+  
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_release( vos_lock_t *lock );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_destroy() - Destroy a vOSS Lock
+
+  The \a vos_lock_destroy() function shall destroy the lock object 
+  referenced by lock.  After a successful return from \a vos_lock_destroy()
+  the lock object becomes, in effect, uninitialized.
+   
+  A destroyed lock object can be reinitialized using vos_lock_init(); 
+  the results of otherwise referencing the object after it has been destroyed 
+  are undefined.  Calls to vOSS lock functions to manipulate the lock such
+  as vos_lock_acquire() will fail if the lock is destroyed.  Therefore, 
+  don't use the lock after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param lock - the lock object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - lock was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by lock while it is locked 
+          or still referenced. 
+
+          VOS_STATUS_E_INVAL - The value specified by lock is invalid.
+          
+          VOS_STATUS_E_FAULT  - lock is an invalid pointer.     
+  \sa
+  
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_destroy( vos_lock_t *lock );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_init() - initializes a vOSS spin lock
+  
+  The vos_spin_lock_init() function initializes the specified spin lock. Upon 
+  successful initialization, the state of the lock becomes initialized 
+  and unlocked.
+
+  A lock must be initialized by calling vos_spin_lock_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized lock results in 
+  a failure.
+ 
+  \param pLock - pointer to the opaque lock object to initialize
+  
+  \return VOS_STATUS_SUCCESS - spin lock was successfully initialized and 
+          is ready to be used.
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_init(vos_spin_lock_t *pLock);
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_acquire() - acquires a spin lock
+
+  A lock object is acquired by calling \a vos_spin_lock_acquire().  If the lock 
+  is already locked, the calling thread shall spin until the lock becomes 
+  available. This operation shall return with the lock object referenced by 
+  lock in the locked state with the calling thread as its owner. 
+  
+  \param pLock - the lock object to acquire
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully acquired by 
+          the calling thread.
+      
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_acquire(vos_spin_lock_t *pLock);
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_release() - releases a lock
+
+  The \a vos_lock_release() function shall release the spin lock object 
+  referenced by 'lock'.  
+
+  If a thread attempts to release a lock that it unlocked or is not
+  initialized, an error is returned. 
+
+  \param pLock - the lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_release(vos_spin_lock_t *pLock);
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_destroy() - releases resource of a lock
+
+  \param pLock - pointer to a lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_destroy(vos_spin_lock_t *pLock);
+
+
+#endif // __VOSS_LOCK_H
diff --git a/CORE/VOSS/inc/vos_memory.h b/CORE/VOSS/inc/vos_memory.h
new file mode 100644
index 0000000..d599a87
--- /dev/null
+++ b/CORE/VOSS/inc/vos_memory.h
@@ -0,0 +1,301 @@
+/*
+ * 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( __VOS_MEMORY_H )
+#define __VOS_MEMORY_H
+ 
+/**=========================================================================
+  
+  \file  vos_memory.h
+  
+  \brief virtual Operating System Servies (vOSS)
+               
+   Memory management functions
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#ifdef MEMORY_DEBUG
+v_VOID_t vos_mem_init(v_VOID_t);
+v_VOID_t vos_mem_exit(v_VOID_t);
+void vos_mem_clean(void);
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_malloc() - vOSS Memory Allocation
+
+  This function will dynamicallly allocate the specified number of bytes of 
+  memory.
+  
+  \param size - the number of bytes of memory to allocate.  
+  
+  \return Upon successful allocate, returns a non-NULL pointer to the 
+  allocated memory.  If this function is unable to allocate the amount of 
+  memory specified (for any reason) it returns NULL.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+#ifdef MEMORY_DEBUG
+#define vos_mem_malloc(size) vos_mem_malloc_debug(size, __FILE__, __LINE__)
+v_VOID_t * vos_mem_malloc_debug( v_SIZE_t size, char* fileName, v_U32_t lineNum);
+#else
+v_VOID_t * vos_mem_malloc( v_SIZE_t size );
+#endif
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_free() - vOSS Free Memory
+
+  This function will free the memory pointed to by 'ptr'.
+  
+  \param ptr - pointer to the starting address of the memory to be 
+               free'd.  
+  
+  \return Nothing
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_free( v_VOID_t *ptr );
+
+
+/*----------------------------------------------------------------------------
+
+  \fn vos_mem_set() - set (fill) memory with a specified byte value.
+  
+  \param pMemory - pointer to memory that will be set
+    
+  \param numBytes - the number of bytes to be set
+    
+  \param value - the byte set in memory
+    
+  \return - Nothing.  
+  
+  \sa vos_mem_zero()
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_set( v_VOID_t *ptr, v_SIZE_t numBytes, v_BYTE_t value );
+
+
+/*----------------------------------------------------------------------------
+
+  \fn vos_mem_zero() - zero out memory
+  
+  This function sets the memory location to all zeros, essentially clearing
+  the memory.
+  
+  \param pMemory - pointer to memory that will be set to zero
+    
+  \param numBytes - the number of bytes zero
+    
+  \param value - the byte set in memory
+    
+  \return - Nothing.  
+  
+  \sa vos_mem_set()
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_zero( v_VOID_t *ptr, v_SIZE_t numBytes );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_copy() - Copy memory
+
+  Copy host memory from one location to another, similar to memcpy in 
+  standard C.  Note this function does not specifically handle overlapping
+  source and destination memory locations.  Calling this function with
+  overlapping source and destination memory locations will result in
+  unpredictable results.  Use vos_mem_move() if the memory locations
+  for the source and destination are overlapping (or could be overlapping!)
+
+  \param pDst - pointer to destination memory location (to copy to)
+  
+  \param pSrc - pointer to source memory location (to copy from)
+  
+  \param numBytes - number of bytes to copy.
+  
+  \return - Nothing
+    
+  \sa vos_mem_move()
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_copy( v_VOID_t *pDst, const v_VOID_t *pSrc, v_SIZE_t numBytes );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_move() - Move memory
+
+  Move host memory from one location to another, similar to memmove in 
+  standard C.  Note this function *does* handle overlapping
+  source and destination memory locations.
+
+  \param pDst - pointer to destination memory location (to move to)
+  
+  \param pSrc - pointer to source memory location (to move from)
+  
+  \param numBytes - number of bytes to move.
+  
+  \return - Nothing
+    
+  \sa vos_mem_move()
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_move( v_VOID_t *pDst, const v_VOID_t *pSrc, v_SIZE_t numBytes );
+
+/** ---------------------------------------------------------------------------
+
+    \fn vos_mem_compare()
+
+    \brief vos_mem_compare() - Memory compare
+    
+    Function to compare two pieces of memory, similar to memcmp function 
+    in standard C.
+    
+    \param pMemory1 - pointer to one location in memory to compare.
+
+    \param pMemory2 - pointer to second location in memory to compare.
+    
+    \param numBytes - the number of bytes to compare.
+    
+    \return v_BOOL_t - returns a boolean value that tells if the memory
+                       locations are equal or not equal. 
+    
+  -------------------------------------------------------------------------------*/
+v_BOOL_t vos_mem_compare( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes ); 
+
+
+/** ---------------------------------------------------------------------------
+
+    \fn vos_mem_compare2()
+
+    \brief vos_mem_compare2() - Memory compare
+    
+    Function to compare two pieces of memory, similar to memcmp function 
+    in standard C.
+
+    \param pMemory1 - pointer to one location in memory to compare.
+
+    \param pMemory2 - pointer to second location in memory to compare.
+    
+    \param numBytes - the number of bytes to compare.
+    
+    \return v_SINT_t - returns a boolean value that tells if the memory
+                       locations are equal or not equal. 
+                       0 -- equal
+                       < 0 -- *pMemory1 is less than *pMemory2
+                       > 0 -- *pMemory1 is bigger than *pMemory2
+    
+  -------------------------------------------------------------------------------*/
+v_SINT_t vos_mem_compare2( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_dma_malloc() - vOSS DMA Memory Allocation
+
+  This function will dynamicallly allocate the specified number of bytes of 
+  memory. This memory will have special attributes making it DMA friendly i.e.
+  it will exist in contiguous, 32-byte aligned uncached memory. A normal 
+  vos_mem_malloc does not yield memory with these attributes. 
+
+  NOTE: the special DMA friendly memory is very scarce and this API must be
+  used sparingly
+  
+  \param size - the number of bytes of memory to allocate.  
+  
+  \return Upon successful allocate, returns a non-NULL pointer to the 
+  allocated memory.  If this function is unable to allocate the amount of 
+  memory specified (for any reason) it returns NULL.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+#ifdef MEMORY_DEBUG
+#define vos_mem_dma_malloc(size) vos_mem_dma_malloc_debug(size, __FILE__, __LINE__)
+v_VOID_t * vos_mem_dma_malloc_debug( v_SIZE_t size, char* fileName, v_U32_t lineNum);
+#else
+v_VOID_t * vos_mem_dma_malloc( v_SIZE_t size );
+#endif
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_dma_free() - vOSS DMA Free Memory
+
+  This function will free special DMA friendly memory pointed to by 'ptr'.
+  
+  \param ptr - pointer to the starting address of the memory to be 
+               free'd.  
+  
+  \return Nothing
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_dma_free( v_VOID_t *ptr );
+
+#ifdef DMA_DIRECT_ACCESS
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_set_dma_ptr() - vOSS DMA memory poiter set by SAL
+
+  This function will set DMA Physical memory pointer.
+
+  
+  \param dmaBuffer - pointer to the starting address of the memory to be 
+               free'd.  
+  
+  \return Nothing
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_set_dma_ptr(unsigned char *dmaBuffer);
+#endif /* DMA_DIRECT_ACCESS */
+#endif // __VOSS_LOCK_H
diff --git a/CORE/VOSS/inc/vos_mq.h b/CORE/VOSS/inc/vos_mq.h
new file mode 100644
index 0000000..5d997d4
--- /dev/null
+++ b/CORE/VOSS/inc/vos_mq.h
@@ -0,0 +1,246 @@
+/*
+ * 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( __VOS_MQ_H )
+#define __VOS_MQ_H
+
+/**=========================================================================
+  
+  \file  vos_mq.h
+  
+  \brief virtual Operating System Services (vOSS) message queue APIs
+               
+   Message Queue Definitions and API
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+  
+/// vos Message Type.  
+/// This represnets a message that can be posted to another module through
+/// the voss Message Queues.  
+///
+/// \note This is mapped directly to the tSirMsgQ for backward
+///       compatibility with the legacy MAC code.  
+
+typedef struct vos_msg_s
+{
+    v_U16_t type;
+    /*
+     * This field can be used as sequence number/dialog token for matching
+     * requests and responses.
+     */
+    v_U16_t 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;
+    
+    v_U32_t bodyval;    
+    
+} vos_msg_t;
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+  
+/// Message Queue IDs  
+typedef enum
+{
+  /// Message Queue ID for messages bound for SME
+  VOS_MQ_ID_SME = VOS_MODULE_ID_SME,
+  
+  /// Message Queue ID for messages bound for PE
+  VOS_MQ_ID_PE = VOS_MODULE_ID_PE, 
+  
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /// Message Queue ID for messages bound for HAL
+  VOS_MQ_ID_HAL = VOS_MODULE_ID_HAL,
+#else
+  /// Message Queue ID for messages bound for WDA
+  VOS_MQ_ID_WDA = VOS_MODULE_ID_WDA,
+#endif
+
+  /// Message Queue ID for messages bound for TL
+  VOS_MQ_ID_TL = VOS_MODULE_ID_TL,
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /// Message Queue ID for messages bound for SSC
+  VOS_MQ_ID_SSC = VOS_MODULE_ID_SSC,
+#endif
+  
+  /// Message Queue ID for messages bound for the SYS module
+  VOS_MQ_ID_SYS = VOS_MODULE_ID_SYS,
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /// Message Queue ID for SDIO Interrupt Handle in SAL
+  VOS_MQ_ID_SAL = VOS_MODULE_ID_SAL
+#else
+  /// Message Queue ID for messages bound for WDA
+  VOS_MQ_ID_WDI = VOS_MODULE_ID_WDI,
+#endif
+  
+} VOS_MQ_ID;
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_mq_post_message() - post a message to a message queue
+
+  This API allows messages to be posted to a specific message queue.  Messages
+  can be posted to the following message queues:
+  
+  <ul>
+    <li> SME
+    <li> PE
+    <li> HAL
+    <li> TL
+  </ul> 
+  
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+         
+  \param message - a pointer to a message buffer.  Memory for this message 
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is posted to the message queue.  If the consumer of the 
+         message needs anything in this message, it needs to copy the contents
+         before returning from the message queue handler.
+  
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+          
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not 
+          refer to a valid Message Queue Id.
+          
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.     
+          
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *message );
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
+
+  This API allows messages to be posted to a specific message queue in the 
+  Tx excution flow.  Messages for the Tx execution flow can be posted only 
+  to the following queue.
+  
+  <ul>
+    <li> TL
+    <li> WDI/SSC
+  </ul>
+  
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+         
+  \param message - a pointer to a message buffer.  Body memory for this message 
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is dispacthed to the appropriate component.  If the consumer 
+         of the message needs to keep anything in the body, it needs to copy 
+         the contents before returning from the message handler.
+  
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+          
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not 
+          refer to a valid Message Queue Id.
+          
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.     
+          
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *message );
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**---------------------------------------------------------------------------
+
+  \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow
+
+  This API allows messages to be posted to a specific message queue in the
+  Tx excution flow.  Messages for the Rx execution flow can be posted only
+  to the following queue.
+
+  <ul>
+    <li> WDI
+  </ul>
+
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+
+  \param message - a pointer to a message buffer.  Body memory for this message
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is dispacthed to the appropriate component.  If the consumer
+         of the message needs to keep anything in the body, it needs to copy
+         the contents before returning from the message handler.
+
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
+          refer to a valid Message Queue Id.
+
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *message );
+
+#endif
+
+#endif // if !defined __VOS_MQ_H
diff --git a/CORE/VOSS/inc/vos_nvitem.h b/CORE/VOSS/inc/vos_nvitem.h
new file mode 100644
index 0000000..74b450c
--- /dev/null
+++ b/CORE/VOSS/inc/vos_nvitem.h
@@ -0,0 +1,646 @@
+/*
+ * 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( __VOS_NVITEM_H )
+#define __VOS_NVITEM_H
+
+/**=========================================================================
+
+  \file  vos_nvitem.h
+
+  \brief virtual Operating System Services (vOSS): Non-Volatile storage API
+
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_types.h"
+#include "vos_status.h"
+#include "wlan_nv.h"
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+// NV Items with their parameters are specified below
+// Parameters include: enum label in VNV_TYPE (_name),
+// element count (_cnt), element size (_size),
+// enum of first element in NV module (_label)
+
+/*
+ * The VOS NV Item Table is compliant to AMSS NV service files of:
+ * //source/qcom/qct/wconnect/wlan/private/csw/nv/ @ CL 431102
+ *
+ * VNV_REGULATORY_DOMAIN_TABLE - contains regulatory domain information;
+ * the table is stored as $(REGDOMAIN_COUNT) NV items where each NV item
+ * contains information for one domain; see definition of v_REGDOMAIN_t
+ * for the regulatory domains
+ *
+ * VNV_FIELD_IMAGE - contains various elements such as MAC addresses
+ *
+ * VNV_RATE_TO_POWER_TABLE - table of power for each of 25 PHY rates
+ *
+ * VNV_DEFAULT_LOCATION  - default country code and regulatory domain
+ *
+ * VNV_MAXIMUM_TX_POWER
+ *
+ * VNV_RX_SENSITIVITY - table of sensitivity for each of %(MAC_RATE_COUNT) MAC
+ * rates; see definition of v_MAC_RATE_t for the MAC rates
+ *
+ * VNV_NETWORK_TYPE - either A, B or G type
+ *
+ * VOV_QFUSE - 16 byte QFUSE data
+ */
+#define VNV_ITEM_TABLE \
+ADD_VNV_ITEM( VNV_REGULARTORY_DOMAIN_TABLE, REGDOMAIN_COUNT, 144, \
+      NV_WLAN_REGULATORY_DOMAIN_FCC_I ) \
+ADD_VNV_ITEM( VNV_FIELD_IMAGE, 1, 52, NV_WLAN_FIELD_IMAGE_I ) \
+ADD_VNV_ITEM( VNV_RATE_TO_POWER_TABLE, 2, 66, NV_WLAN_RATE_TO_POWER_LIST_I )\
+ADD_VNV_ITEM( VNV_DEFAULT_LOCATION, 1, 4, NV_WLAN_DEFAULT_LOCATION_INFO_I ) \
+ADD_VNV_ITEM( VNV_TPC_POWER_TABLE, 14, 128, NV_WLAN_TPC_POWER_TABLE_I ) \
+ADD_VNV_ITEM( VNV_TPC_PDADC_OFFSETS, 14, 2, NV_WLAN_TPC_PDADC_OFFSETS_I ) \
+ADD_VNV_ITEM( VNV_MAXIMUM_TX_POWER, 1, 1, NV_WLAN_MAX_TX_POWER_I ) \
+ADD_VNV_ITEM( VNV_RX_SENSITIVITY, 1, MAC_RATE_COUNT, NV_WLAN_RX_SENSITIVITY_I)\
+ADD_VNV_ITEM( VNV_NETWORK_TYPE, 1, 1, NV_WLAN_NETWORK_TYPE_I ) \
+ADD_VNV_ITEM( VNV_CAL_MEMORY, 1, 3460, NV_WLAN_CAL_MEMORY_I ) \
+ADD_VNV_ITEM( VNV_CAL_STATUS, 1, 32, NV_WLAN_CAL_STATUS_I ) \
+ADD_VNV_ITEM( VNV_RSSI_CHANNEL_OFFSETS, 2, 56, NV_WLAN_RSSI_CHANNEL_OFFSETS_I ) \
+ADD_VNV_ITEM( VNV_RF_CAL_VALUES, 1, 48, NV_WLAN_RF_CAL_VALUES_I ) \
+ADD_VNV_ITEM( VNV_ANTENNA_PATH_LOSS, 14, 2, NV_WLAN_ANTENNA_PATH_LOSS_I ) \
+ADD_VNV_ITEM( VNV_PACKET_TYPE_POWER_LIMITS, 42, 2, NV_WLAN_PACKET_TYPE_POWER_LIMITS_I ) \
+ADD_VNV_ITEM( VNV_OFDM_CMD_PWR_OFFSET, 1, 2, NV_WLAN_OFDM_CMD_PWR_OFFSET_I ) \
+ADD_VNV_ITEM( VNV_TX_BB_FILTER_MODE, 1, 4, NV_TX_BB_FILTER_MODE_I ) \
+ADD_VNV_ITEM( VNV_FREQUENCY_FOR_1_3V_SUPPLY, 1, 4, NV_FREQUENCY_FOR_1_3V_SUPPLY_I ) \
+ADD_VNV_ITEM( VNV_TABLE_VIRTUAL_RATE, 1, 4, VNV_TABLE_VIRTUAL_RATE_I ) \
+
+
+#define VOS_COUNTRY_CODE_LEN  2
+#define VOS_MAC_ADDRESS_LEN   6
+#define VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_3P2MH 0   //3.2 Mhz
+#define VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_1P6MH 1   //1.6 Mhz
+
+
+/*! 
+ * The path (from the root of the DPP_FOLDER_PATH\QCOM) to the file containing
+ * the CLPC provisioning data. This is being temporarily put here. This should go
+ * to esp_dpp.h where the WLAN_PROVISION_DATA is present.
+ */
+#define CLPC_PROVISION_DATA L"WLAN_CLPC.PROVISION"
+
+/*--------------------------------------------------------------------------
+  Type declarations
+  ------------------------------------------------------------------------*/
+// enum of RX sensitivity table index
+typedef enum
+{
+   // 11b
+   MAC_RATE_11B_1_MBPS,
+   MAC_RATE_11B_2_MBPS,
+   MAC_RATE_11B_5_5_MBPS,
+   MAC_RATE_11B_11_MBPS,
+
+   // 11g
+   MAC_RATE_11G_6_MBPS,
+   MAC_RATE_11G_9_MBPS,
+   MAC_RATE_11G_12_MBPS,
+   MAC_RATE_11G_18_MBPS,
+   MAC_RATE_11G_24_MBPS,
+   MAC_RATE_11G_36_MBPS,
+   MAC_RATE_11G_48_MBPS,
+   MAC_RATE_11G_54_MBPS,
+
+   // 11n
+   MAC_RATE_11N_MCS_0,
+   MAC_RATE_11N_MCS_1,
+   MAC_RATE_11N_MCS_2,
+   MAC_RATE_11N_MCS_3,
+   MAC_RATE_11N_MCS_4,
+   MAC_RATE_11N_MCS_5,
+   MAC_RATE_11N_MCS_6,
+   MAC_RATE_11N_MCS_7,
+
+   MAC_RATE_COUNT
+
+} v_MAC_RATE_t;
+
+// enum of regulatory doamains in WLAN
+typedef enum
+{
+   REGDOMAIN_FCC,
+   REGDOMAIN_ETSI,
+   REGDOMAIN_JAPAN,
+   REGDOMAIN_WORLD,
+   REGDOMAIN_N_AMER_EXC_FCC,
+   REGDOMAIN_APAC,
+   REGDOMAIN_KOREA,
+   REGDOMAIN_HI_5GHZ,
+   REGDOMAIN_NO_5GHZ,
+   // add new regulatory domain here
+   REGDOMAIN_COUNT
+}
+v_REGDOMAIN_t;
+
+// enum of supported NV items in VOSS
+typedef enum
+{
+#define ADD_VNV_ITEM(_name, _cnt, _size, _label) _name,
+   VNV_ITEM_TABLE
+#undef ADD_VNV_ITEM
+   VNV_TYPE_COUNT
+}
+VNV_TYPE;
+
+// country code type
+typedef v_U8_t v_COUNTRYCODE_t[VOS_COUNTRY_CODE_LEN];
+
+// MAC address type
+typedef v_U8_t v_MAC_ADDRESS_t[VOS_MAC_ADDRESS_LEN];
+
+/*-------------------------------------------------------------------------
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_init() - initialize the NV module
+
+  The \a vos_nv_init() initializes the NV module.  This read the binary
+  file for country code and regulatory domain information.
+
+  \return VOS_STATUS_SUCCESS - module is initialized successfully
+          otherwise  - module is not initialized
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_init(void);
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getRegDomainFromCountryCode() - get the regulatory domain of
+  a country given its country code
+
+  The \a vos_nv_getRegDomainFromCountryCode() returns the regulatory domain of
+  a country given its country code.  This is done from reading a cached
+  copy of the binary file.
+
+  \param pRegDomain  - pointer to regulatory domain
+
+  \param countryCode - country code
+
+  \return VOS_STATUS_SUCCESS - regulatory domain is found for the given country
+          VOS_STATUS_E_FAULT - invalid pointer error
+          VOS_STATUS_E_EMPTY - country code table is empty
+          VOS_STATUS_E_EXISTS - given country code does not exist in table
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getRegDomainFromCountryCode( v_REGDOMAIN_t *pRegDomain,
+      const v_COUNTRYCODE_t countryCode );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getSupportedCountryCode() - get the list of supported
+  country codes
+
+  The \a vos_nv_getSupportedCountryCode() encodes the list of supported
+  country codes with paddings in the provided buffer
+
+  \param pBuffer     - pointer to buffer where supported country codes
+                       and paddings are encoded; this may be set to NULL
+                       if user wishes to query the required buffer size to
+                       get the country code list
+
+  \param pBufferSize - this is the provided buffer size on input;
+                       this is the required or consumed buffer size on output
+
+  \return VOS_STATUS_SUCCESS - country codes are successfully encoded
+          VOS_STATUS_E_NOMEM - country codes are not encoded because either
+                               the buffer is NULL or buffer size is
+                               sufficient
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getSupportedCountryCode( v_BYTE_t *pBuffer, v_SIZE_t *pBufferSize,
+      v_SIZE_t paddingSize );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_setValidity() - set the validity of an NV item.
+
+  The \a vos_nv_setValidity() validates and invalidates an NV item.  The
+  validity information is stored in NV memory.
+  One would get the VOS_STATUS_E_EXISTS error when reading an invalid item.
+  An item becomes valid when one has written to it successfully.
+
+  \param type        - NV item type
+
+  \param itemIsValid - boolean value indicating the item's validity
+
+  \return VOS_STATUS_SUCCESS - validity is set successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_setValidity( VNV_TYPE type, v_BOOL_t itemIsValid );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getValidity() - get the validity of an NV item.
+
+  The \a vos_nv_getValidity() indicates if an NV item is valid.  The
+  validity information is stored in NV memory.
+  One would get the VOS_STATUS_E_EXISTS error when reading an invalid item.
+  An item becomes valid when one has written to it successfully.
+
+  \param type        - NV item type
+
+  \param pItemIsValid- pointer to the boolean value indicating the item's
+                       validity
+
+  \return VOS_STATUS_SUCCESS - validity is determined successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getValidity( VNV_TYPE type, v_BOOL_t *pItemIsValid );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_read() - read a NV item to an output buffer
+
+  The \a vos_nv_read() reads a NV item to an output buffer.  If the item is
+  an array, this function would read the entire array. One would get a
+  VOS_STATUS_E_EXISTS error when reading an invalid item.
+
+  For error conditions of VOS_STATUS_E_EXISTS and VOS_STATUS_E_FAILURE,
+  if a default buffer is provided (with a non-NULL value),
+  the default buffer content is copied to the output buffer.
+
+  \param type  - NV item type
+
+  \param outputBuffer   - output buffer
+
+  \param defaultBuffer  - default buffer
+
+  \param bufferSize  - output buffer size
+
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - defaultBuffer point is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_read( VNV_TYPE type, v_VOID_t *outputBuffer,
+      v_VOID_t *defaultBuffer, v_SIZE_t bufferSize );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readAtIndex() - read an element of a NV array to an output
+  buffer
+
+  The \a vos_nv_readAtIndex() reads an element of a NV item to an output
+  buffer. If the item is not array, this function only works for index of 0.
+  One would get a VOS_STATUS_E_EXISTS error when reading an invalid item.
+
+  For error conditions of VOS_STATUS_E_EXISTS and VOS_STATUS_E_FAILURE,
+  if a default buffer is provided (with a non-NULl value),
+  the default buffer content is copied to the output buffer.
+
+  \param type  - NV item type
+
+  \param index - NV array index
+
+  \param outputBuffer   - output buffer
+
+  \param defaultBuffer  - default buffer
+
+  \param bufferSize  - output buffer size
+
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - defaultBuffer point is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readAtIndex( VNV_TYPE type, v_UINT_t index,
+      v_VOID_t *outputBuffer, v_VOID_t *defaultBuffer, v_SIZE_t bufferSize );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_write() - write to a NV item from an input buffer
+
+  The \a vos_nv_write() writes to a NV item from an input buffer. This would
+  validate the NV item if the write operation is successful.
+
+  \param type - NV item type
+
+  \param inputBuffer - input buffer
+
+  \param inputBufferSize - input buffer size
+
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - outputBuffer pointer is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE   - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_write( VNV_TYPE type, v_VOID_t *inputBuffer,
+       v_SIZE_t inputBufferSize );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_writeAtIndex() - write to an element of a NV array from an
+  input buffer
+
+  The \a vos_nv_writeAtIndex() writes to an element of a NV array from an
+  input buffer.  If the item is not an array, this function only works for
+  an array index of 0.  This would automatically validate the NV item if the
+  write operation is successful.
+
+  \param type - NV item type
+
+  \param index - NV array index
+
+  \param inputBuffer - input buffer
+
+  \param inputBufferSize - input buffer size
+
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - outputBuffer pointer is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE   - unknown error
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_writeAtIndex( VNV_TYPE type, v_UINT_t index,
+      v_VOID_t *inputBuffer, v_SIZE_t inputBufferSize );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getElementCount() - return element count of a NV array
+
+  The \a vos_nv_getElementCount() returns element count of a NV array
+
+  \param type - NV item type
+
+  \return count if type is valid; 0 otherwise
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_INLINE_FN v_SIZE_t vos_nv_getElementCount( VNV_TYPE type )
+{
+   switch (type)
+   {
+#define ADD_VNV_ITEM(_name, _cnt, _size, _label) case (_name): return (_cnt);
+      VNV_ITEM_TABLE
+#undef ADD_VNV_ITEM
+      default:
+         return 0;
+   }
+}
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getElementSize() - return size of a NV element
+
+  The \a vos_nv_getElementSize() returns size of a NV element.
+
+  \param type - NV item type
+
+  \return size if type is valid; 0 otherwise
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_INLINE_FN v_SIZE_t vos_nv_getElementSize( VNV_TYPE type )
+{
+   switch (type)
+   {
+#define ADD_VNV_ITEM(_name, _cnt, _size, _label) case (_name): return (_size);
+      VNV_ITEM_TABLE
+#undef ADD_VNV_ITEM
+      default:
+         return 0;
+   }
+}
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_getItemSize() - return size of a NV item
+
+  The \a vos_nv_getItemSize() returns size of a NV item.
+
+  \param type - NV item type
+
+  \return size of a NV item array if type is valid; 0 otherwise
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_INLINE_FN v_SIZE_t vos_nv_getItemSize( VNV_TYPE type )
+{
+   return vos_nv_getElementCount(type) * vos_nv_getElementSize(type);
+}
+
+// TODO: HAL NV interface should be used to access individual NV items
+// instead of below functions once that is ready
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readTxAntennaCount() - return number of TX antenna
+
+  \param pTxAntennaCount   - antenna count
+
+  \return status of the NV read operation
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readTxAntennaCount( v_U8_t *pTxAntennaCount );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readRxAntennaCount() - return number of RX antenna
+
+  \param pRxAntennaCount   - antenna count
+
+  \return status of the NV read operation
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readRxAntennaCount( v_U8_t *pRxAntennaCount );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readMacAddress() - return the MAC address
+
+  \param pMacAddress - MAC address
+
+  \return status of the NV read operation
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readMacAddress( v_MAC_ADDRESS_t pMacAddress );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readMultiMacAddress() - return the Multiple MAC addresses
+
+  \param pMacAddress - MAC address
+  \param macCount - Count of valid MAC addresses to get from NV field
+
+  \return status of the NV read operation
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readMultiMacAddress( v_U8_t* pMacAddr, v_U8_t  macCount);
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getDefaultRegDomain() - return the default regulatory domain
+  \return default regulatory domain
+  \sa
+  -------------------------------------------------------------------------*/
+v_REGDOMAIN_t vos_nv_getDefaultRegDomain( void );
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getSupportedChannels() - function to return the list of
+          supported channels
+  \param p20MhzChannels - list of 20 Mhz channels
+  \param pNum20MhzChannels - number of 20 Mhz channels
+  \param p40MhzChannels - list of 20 Mhz channels
+  \param pNum40MhzChannels - number of 20 Mhz channels
+  \return status of the NV read operation
+  \Note: 40Mhz not currently supported
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getSupportedChannels( v_U8_t *p20MhzChannels, int *pNum20MhzChannels,
+                                        v_U8_t *p40MhzChannels, int *pNum40MhzChannels);
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_readDefaultCountryTable() - return the default Country table
+  \param table data - a union to return the default country table data in.
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readDefaultCountryTable( uNvTables *tableData );
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getChannelListWithPower() - function to return the list of
+          supported channels with the power limit info too.
+  \param pChannels20MHz - list of 20 Mhz channels
+  \param pNum20MHzChannelsFound - number of 20 Mhz channels
+  \param pChannels40MHz - list of 20 Mhz channels
+  \param pNum40MHzChannelsFound - number of 20 Mhz channels
+  \return status of the NV read operation
+  \Note: 40Mhz not currently supported
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getChannelListWithPower(tChannelListWithPower *pChannels20MHz /*[NUM_LEGIT_RF_CHANNELS] */,
+                                          tANI_U8 *pNum20MHzChannelsFound,
+                                          tChannelListWithPower *pChannels40MHz /*[NUM_CHAN_BOND_CHANNELS] */,
+                                          tANI_U8 *pNum40MHzChannelsFound
+                                          );
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_open() - initialize the NV module
+
+  The \a vos_nv_open() initializes the NV module.  This function read the binary
+  file qcom_nv.bin for macaddress,country code,regulatory domain information and etc.
+
+  \return VOS_STATUS_SUCCESS - module is initialized successfully
+          otherwise  - module is not initialized
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_open(void);
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_close() - uninitialize the NV module
+
+  The \a vos_nv_init() uninitializes the NV module.  This function release the binary
+  file qcom_nv.bin data buffer.
+
+  \return VOS_STATUS_SUCCESS - module is initialized successfully
+          otherwise  - module is not initialized
+  \sa
+
+  -------------------------------------------------------------------------*/
+
+VOS_STATUS vos_nv_close(void);
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getBuffer - 
+  \param pBuffer  - to return the buffer address
+            pNvBitmap - Nv Bit map
+            pSize     - buffer size.
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getNVBuffer(v_VOID_t **pNvBuffer ,v_SIZE_t *pSize);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**------------------------------------------------------------------------
+  \brief vos_nv_setRegDomain - 
+  \param clientCtxt  - Client Context, Not used for PRIMA
+              regId  - Regulatory Domain ID
+  \return status set REG domain operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_setRegDomain(void * clientCtxt, v_REGDOMAIN_t regId);
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getChannelEnabledState - 
+  \param rfChannel  - input channel number to know enabled state
+  \return eNVChannelEnabledType enabled state for channel
+             * enabled
+             * disabled
+             * DFS
+  \sa
+  -------------------------------------------------------------------------*/
+
+eNVChannelEnabledType vos_nv_getChannelEnabledState
+(
+   v_U32_t    rfChannel
+);
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#endif // __VOS_NVITEM_H
diff --git a/CORE/VOSS/inc/vos_pack_align.h b/CORE/VOSS/inc/vos_pack_align.h
new file mode 100644
index 0000000..1cdceb6
--- /dev/null
+++ b/CORE/VOSS/inc/vos_pack_align.h
@@ -0,0 +1,109 @@
+/*
+ * 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( __VOS_PACK_ALIGN_H )
+#define __VOS_PACK_ALIGN_H
+
+/**=========================================================================
+  
+  \file  vos_pack_align.h
+  
+  \brief virtual Operating System Servies (vOS) pack and align primitives
+               
+   Definitions for platform independent means of packing and aligning
+   data structures
+  
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/*
+ 
+  Place the macro VOS_PACK_START above a structure declaration to pack. We 
+  are not going to allow modifying the pack size because pack size cannot be 
+  specified in AMSS and GNU. Place the macro VOS_PACK_END below a structure 
+  declaration to stop the pack. This requirement is necessitated by Windows
+  which need pragma based prolog and epilog.
+
+  Pack-size > 1-byte is not supported since gcc and arm do not support that.
+  
+  Here are some examples
+  
+  1. Pack-size 1-byte foo_t across all platforms  
+  
+  VOS_PACK_START
+  typedef VOS_PACK_PRE struct foo_s { ... } VOS_PACK_POST foo_t; 
+  VOS_PACK_END
+  
+  2. 2-byte alignment for foo_t across all platforms
+  
+  typedef VOS_ALIGN_PRE(2) struct foo_s { ... } VOS_ALIGN_POST(2) foo_t; 
+
+  3. Pack-size 1-byte and 2-byte alignment for foo_t across all platforms
+
+  VOS_PACK_START
+  typedef VOS_PACK_PRE VOS_ALIGN_PRE(2) struct foo_s { ... } VOS_ALIGN_POST(2) VOS_PACK_POST foo_t; 
+  VOS_PACK_END
+  
+*/
+
+#if defined __GNUC__
+
+  #define VOS_PACK_START 
+  #define VOS_PACK_END 
+
+  #define VOS_PACK_PRE 
+  #define VOS_PACK_POST  __attribute__((__packed__))
+
+  #define VOS_ALIGN_PRE(__value)
+  #define VOS_ALIGN_POST(__value)  __attribute__((__aligned__(__value)))
+
+#elif defined __arm
+
+  #define VOS_PACK_START 
+  #define VOS_PACK_END 
+
+  #define VOS_PACK_PRE  __packed
+  #define VOS_PACK_POST
+
+  #define VOS_ALIGN_PRE(__value)  __align(__value)
+  #define VOS_ALIGN_POST(__value)
+
+#elif defined _MSC_VER
+
+  #define VOS_PACK_START  __pragma (pack(push,1))
+  #define VOS_PACK_END  __pragma (pack(pop))
+
+  #define VOS_PACK_PRE 
+  #define VOS_PACK_POST
+
+  #define VOS_ALIGN_PRE(__value)  __declspec(align(__value))
+  #define VOS_ALIGN_POST(__value)
+
+#else
+
+  #error Unsupported compiler!!!
+
+#endif
+
+#endif // __VOSS_PACK_ALIGN_H
diff --git a/CORE/VOSS/inc/vos_packet.h b/CORE/VOSS/inc/vos_packet.h
new file mode 100644
index 0000000..205a0fd
--- /dev/null
+++ b/CORE/VOSS/inc/vos_packet.h
@@ -0,0 +1,1098 @@
+/*
+ * 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( __VOS_PKT_H )
+#define __VOS_PKT_H
+
+/**=========================================================================
+  
+  \file        vos_packet.h
+  
+  \brief       virtual Operating System Services (vOSS) network Packet APIs
+               
+   Network Protocol packet/buffer support interfaces 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+struct vos_pkt_t;
+typedef struct vos_pkt_t vos_pkt_t;
+
+
+/// data vector
+typedef struct
+{         
+   /// address of data
+   v_VOID_t *pData;
+   
+   /// number of bytes at address
+   v_U32_t  numBytes;
+   
+} vos_pkt_data_vector_t;
+
+
+
+/// voss Packet Types
+typedef enum
+{
+   /// voss Packet is used to transmit 802.11 Management frames.
+   VOS_PKT_TYPE_TX_802_11_MGMT,
+   
+   /// voss Packet is used to transmit 802.11 Data frames.
+   VOS_PKT_TYPE_TX_802_11_DATA,
+   
+   /// voss Packet is used to transmit 802.3 Data frames.
+   VOS_PKT_TYPE_TX_802_3_DATA,
+   
+   /// voss Packet contains Received data of an unknown frame type
+   VOS_PKT_TYPE_RX_RAW,
+
+   /// Invalid sentinel value
+   VOS_PKT_TYPE_MAXIMUM
+
+} VOS_PKT_TYPE;
+
+/// user IDs.   These IDs are needed on the vos_pkt_get/set_user_data_ptr()
+/// to identify the user area in the voss Packet.
+typedef enum
+{
+   VOS_PKT_USER_DATA_ID_TL =0,  
+   VOS_PKT_USER_DATA_ID_BAL,  
+   VOS_PKT_USER_DATA_ID_WDA,   
+   VOS_PKT_USER_DATA_ID_HDD,
+   VOS_PKT_USER_DATA_ID_BAP,
+   VOS_PKT_USER_DATA_ID_BSL,
+
+   VOS_PKT_USER_DATA_ID_MAX
+   
+} VOS_PKT_USER_DATA_ID;
+
+/**------------------------------------------------------------------------
+  
+  \brief voss asynchronous get_packet callback function
+
+  This is a callback function invoked when vos_pkt_get_packet() cannot
+  get the requested packet and the caller specified a callback to be 
+  invoked when packets are available. 
+  
+  \param pPacket - the packet obtained by voss for the caller. 
+  
+  \param userData - the userData field given on the vos_pkt_get_packet() 
+         call
+  
+  \return
+    
+  \sa
+  
+  ------------------------------------------------------------------------*/
+typedef VOS_STATUS ( *vos_pkt_get_packet_callback )( vos_pkt_t *pPacket, 
+                                                     v_VOID_t *userData );
+
+/*
+ * include the OS-specific packet abstraction
+ * we include it here since the abstraction probably needs to access the
+ * generic types defined above
+ */
+#include "i_vos_packet.h"
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+  
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_packet() - Get a voss Packets
+
+  Gets a voss Packets from an internally managed packet pool. 
+  
+  \param ppPacket - pointer to location where the voss Packet pointer is 
+                    returned.  If multiple packets are requested, they 
+                    will be chained onto this first packet.  
+                    
+  \param pktType - the packet type to be retreived.  Valid packet types are:
+     <ul>
+       <li> VOS_PKT_TYPE_TX_802_11_MGMT - voss packet is for Transmitting 802.11 
+            Management frames.
+     
+       <li> VOS_PKT_TYPE_RX_RAW - voss Packet contains a buffer for Receiving 
+            raw frames of unknown type.  
+     </ul>
+     
+  \param dataSize - the Data size needed in the voss Packet.
+  
+  \param numPackets - the number of packets requested.  
+                              
+  \param zeroBuffer - parameter that tells the API to zero the data buffer
+                      in this voss Packet.  
+     <ul>                      
+       <li> VOS_TRUE - the API will zero out the entire data buffer.
+                                              
+       <li> VOS_FALSE - the API will not zero out the data buffer.                                       
+     </ul>
+                               
+  \note If enough room for headers to transmit or receive the packet is not 
+        available, this API will fail.
+        
+  \param callback - This callback function, if provided, is invoked in the 
+         case when resources are not available at the time of the call to 
+         get packets.  This callback function is invoked when packets are 
+         available.  
+                    
+  \param userData - This user data is passed back to the caller in the 
+         callback function, if the callback is invoked.
+                        
+  \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
+          requested type.  *ppPacket contains a pointer to the packet.
+          
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This 
+          API only supports getting vos packets for 802_11_MGMT and 
+          RX_RAW packet types.  This status is also returned if the 
+          numPackets or dataSize are invalid.
+          
+          VOS_STATUS_E_RESOURCES - unable to get resources needed to get
+          a vos packet.  If a callback function is specified and this 
+          status is returned from the API, the callback will be called 
+          when resources are available to fulfill the original request.
+          
+          Note that the low resources condition is indicated to the caller
+          by returning VOS_STATUS_E_RESOURCES.  This status is the only 
+          non-success status that indicates to the caller that the callback
+          will be called when resources are available.  All other status
+          indicate failures that are not recoverable and the 'callback' 
+          will not be called.
+
+          VOS_STATUS_E_FAILURE - The API returns this status when unable 
+          to get a packet from the packet pool because the pool
+          is depleted and the caller did not specify a low resource callback.
+          
+          VOS_STATUS_E_ALREADY - This status is returned when the VOS
+          packet pool is in a 'low resource' condition and cannot 
+          accomodate any more calls to retrieve packets from that 
+          pool.   Note this is a FAILURE and the 'low resource' callback
+          will *not* be called.
+          
+          VOS_STATUS_E_FAULT - ppPacket does not specify a valid pointer.          
+    
+  \sa
+  
+  ------------------------------------------------------------------------*/  
+VOS_STATUS vos_pkt_get_packet( vos_pkt_t **ppPacket, VOS_PKT_TYPE pktType, 
+                               v_SIZE_t dataSize, v_SIZE_t numPackets,
+                               v_BOOL_t zeroBuffer,
+                               vos_pkt_get_packet_callback callback,
+                               v_VOID_t *userData );
+                               
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_wrap_data_packets() - Wrap an OS provided data packet in a
+         vos packet.
+
+  Takes as input an OS provided data packet and 'wraps' that packet in a 
+  vos_packet, returning the vos_packet to the caller.  
+  
+  This function is intended to be called from the HDD to wrap Tx data packets
+  from the OS into vos_packets before sending them to TL for transmission.
+    
+  \param ppPacket - pointer to location where the voss Packet pointer is 
+                    returned.  If multiple packets are requested, they 
+                    will be chained onto this first packet.  
+                    
+  \param pktType - the packet type to be retreived.  Valid packet types are:
+     <ul>
+       <li> VOS_PKT_TYPE_802_3_DATA - voss packet is for Transmitting 802.3 
+            data frames.
+     
+       <li> VOS_PKT_TYPE_802_11_DATA - voss Packet is for Transmitting 802.11
+            data frames.  
+     </ul>
+     
+  \param pOSPacket - a pointer to the Transmit packet provided by the OS.  This
+         OS provided packet will be wrapped into a vos_packet_t.  Note this 
+         OS packet pointer can be NULL.  The OS packet pointer can be inserted
+         into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or 
+         VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
+                               
+  \note If enough room for headers to transmit or receive the packet is not 
+        available, this API will fail.
+        
+  \param callback - This callback function, if provided, is invoked in the 
+         case where packets are not available at the time of the call to 
+         return the packets to the caller (a 'low resource' condition).
+         
+         When packets become available, the callback callback function is
+         invoked to return a VOS packet to the caller.  Note that the 
+         OS Packet is *not* inserted into the VOS packet when it is returned
+         to the low resource callback.  It is up to the caller to insert
+         the OS packet into the VOS packet by calling vos_pkt_set_os_packet()
+                    
+  \param userData - This user data is passed back to the caller in the 
+         callback function, if the callback is invoked.
+                        
+  \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
+          requested type.  *ppPacket contains a pointer to the packet.
+          
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This 
+          API only supports getting vos packets for 802_11_MGMT and 
+          RX_RAW packet types.            
+          
+          VOS_STATUS_E_RESOURCES - unable to get resources needed to get
+          a vos packet.  If a callback function is specified and this 
+          status is returned from the API, the callback will be called 
+          when resources are available to fulfill the original request.
+          
+          Note that the low resources condition is indicated to the caller
+          by returning VOS_STATUS_E_RESOURCES.  This status is the only 
+          non-success status that indicates to the caller that the callback
+          will be called when resources are available.  All other status
+          indicate failures that are not recoverable and the 'callback' 
+          will not be called.          
+          
+          VOS_STATUS_E_FAILURE - The API returns this status when unable 
+          to get a packet from the packet pool because the pool
+          is depleted and the caller did not specify a low resource callback.
+          
+          VOS_STATUS_E_ALREADY - This status is returned when the VOS
+          packet pool is in a 'low resource' condition and cannot 
+          accomodate any more calls to retrieve packets from that 
+          pool.   Note this is a FAILURE and the 'low resource' callback
+          will *not* be called.
+          
+          VOS_STATUS_E_FAULT - ppPacket or pOSPacket do not specify valid
+          pointers.          
+    
+  \sa vos_pkt_set_os_packet()
+  
+  ------------------------------------------------------------------------*/  
+VOS_STATUS vos_pkt_wrap_data_packet( vos_pkt_t **ppPacket, VOS_PKT_TYPE pktType, 
+                                     v_VOID_t *pOSPacket,
+                                     vos_pkt_get_packet_callback callback,
+                                     v_VOID_t *userData );
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_pkt_set_os_packet() - set the OS packet in a VOS data packet
+
+  This API inserts an OS packet into a previously retreived VOS packet.
+  This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
+  VOS_PKT_TYPE_802_11_DATA.  
+  
+  There are cases where a user will need to get a VOS data packet without 
+  having the OS packet to insert/wrap into the data packet. This could happen
+  if the user calls vos_pkt_wrap_data_packet() without the OS packet.  
+  
+  Also, when the user hit a 'low resource' situation for data packets, the 
+  low resource callback is going to return a VOS packet without an OS packet
+  attached to it.  The caller who gets the packet through the low resource
+  callback uses this API to insert an OS packet into the VOS packet that 
+  was returned through the low resource callback.
+  
+  \param pPacket - the voss Packet to insert the OS packet into.
+         
+  \param pOSPacket - a pointer to the Transmit packet provided by the OS.  This
+         OS provided packet will be wrapped into a vos_packet_t.  Note this 
+         OS packet pointer can be NULL.  The OS packet pointer can be inserted
+         into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or 
+         VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
+         
+         Caller beware.  If there is a valid OS packet wrapped into this 
+         VOS packet already, this API will blindly overwrite the OS packet
+         with the new one specified on this API call.  If you need to determine
+         or retreive the current OS packet from a VOS packet, call 
+         vos_pkt_get_os_packet() first.
+  
+  \return VOS_STATUS_SUCCESS - the API was able to insert the OS packet into
+          the vos_packet.  
+                    
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This 
+          API only supports getting vos packets of type 
+          VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.            
+          
+          VOS_STATUS_E_FAULT - pPacket does not specify a valid pointer.          
+    
+  \sa vos_pkt_get_os_packet()
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_set_os_packet( vos_pkt_t *pPacket, v_VOID_t *pOSPacket );
+
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_os_packet() - get the OS packet in a VOS data packet
+
+  This API returns the OS packet that is inserted in a VOS packet.
+  This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
+  VOS_PKT_TYPE_802_11_DATA.  
+  
+  \param pPacket - the voss Packet to return the OS packet from.
+         
+  \param ppOSPacket - a pointer to the location where the OS packet pointer 
+         retreived from the VOS packet will be returned.  Note this OS packet
+         pointer can be NULL, meaning there is no OS packet attached to this
+         VOS data packet.
+         
+  \param clearOSPacket - a boolean value that tells the API to clear out the
+         OS packet pointer from the VOS packet.  Setting this to 'true' will
+         essentially remove the OS packet from the VOS packet.  'false' means
+         the OS packet remains chained to the VOS packet.  In either case, 
+         the OS packet pointer is returned to the caller.
+         
+  \return VOS_STATUS_SUCCESS - the API was able to retreive the OS packet 
+          pointer from the VOS packet and return it to the caller in 
+          *ppOsPacket  
+                    
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This 
+          API only supports getting vos packets of type 
+          VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.            
+          
+          VOS_STATUS_E_FAULT - pPacket or ppOsPacket does not specify a valid
+          pointers.
+    
+  \sa vos_pkt_set_os_packet(), vos_pkt_wrap_data_packet(), vos_pkt_return_packet()
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_os_packet( vos_pkt_t *pPacket, v_VOID_t **ppOSPacket, 
+                                  v_BOOL_t clearOSPacket );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_user_data_ptr() - return a pointer to user data area
+                                       of a voss Packet
+
+  This API returns a pointer to a specified user Data area in the voss 
+  Packet.  User data areas are uniqua areas of the voss Packet that can 
+  be used by specific components to store private data.  These areas are 
+  identified by a user "ID" and should only be accessed by the component
+  specified.
+  
+  \param pPacket - the voss Packet to retreive the user data pointer from.
+  
+  \param userID - the identifier for the user data area in the voss Packet
+                  to get.
+                  
+                  User IDs and user data areas in the voss Packet are 
+                  available for:
+                  - Transport Layer (TL)
+                  - Bus Abstraction Layer (BAL)
+                  - SDIO Services Component (SSC)
+                  - Host Device Driver (HDD)
+                  
+  \param ppUserData - pointer to location to return the pointer to the user 
+                      data.
+  
+  \return - Nothing.
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+v_VOID_t vos_pkt_get_user_data_ptr( vos_pkt_t *pPacket, VOS_PKT_USER_DATA_ID userID,
+                                    v_VOID_t **ppUserData );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_set_user_data_ptr() - set the user data pointer of a voss
+                                        Packet
+
+  This API sets a pointer in the specified user Data area in the voss 
+  Packet.  User data areas are uniqua areas of the voss Packet that can 
+  be used by specific components to store private data.  These areas are 
+  identified by a user "ID" and should only be accessed by the component
+  specified.
+  
+  Note:  The size of the user data areas in the voss Packet are fixed.  The
+         size of a single pointer is available in each user area.
+  
+  \param pPacket - the voss Packet to set the user pointer.
+  
+  \param userID - the identifier for the user data area in the voss Packet
+                  to set.
+                  
+                  User IDs and user data areas in the voss Packet are 
+                  available for:
+                  - Transport Layer (TL)
+                  - Bus Abstraction Layer (BAL)
+                  - SDIO Services Component (SSC)
+                  - Host Device Driver (HDD)
+                  
+  \param pUserData - pointer value to set in the user data area of the voss 
+                     packet..
+  
+  \return - Nothing.
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+v_VOID_t vos_pkt_set_user_data_ptr( vos_pkt_t *pPacket, VOS_PKT_USER_DATA_ID userID,
+                                    v_VOID_t *pUserData );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_return_packet() - Return a voss Packet (chain) to vOSS
+
+  This API returns a voss Packet to the internally managed packet pool.  
+  
+  Note:  If there are multiple packets chained to this packet, the entire 
+  packet chain is returned to vOSS.  The caller must unchain the 
+  packets throgh vos_pkt_get_next_packet() and return them individually 
+  if all packets in the packet chain are not to be returned.
+  
+  \param pPacket - the voss Packet(s) to return.  Note all packets chained
+                   to this packet are returned to vOSS.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_return_packet( vos_pkt_t *pPacket );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_chain_packet() - chain a voss Packet to another packet 
+
+  This API chains a voss Packet to another voss Packet, creating a packet
+  chain.  Packets can be chained before or after the current packet in the
+  packet chain.
+  
+  \param pPacket - pointer to a voss packet to chain to 
+  
+  \param pChainPacket - pointer to packet to chain
+  
+  \param chainAfter - boolean to specify to chain packet after or before 
+                      the input packet
+  <ul>                       
+    <li> true - chain packet AFTER pPacket (chain behind)
+    <li> false - chain packet BEFORE pPacket (chain in front)  
+  </ul>
+    
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_chain_packet( vos_pkt_t *pPacket, vos_pkt_t *pChainPacket, 
+                                 v_BOOL_t chainAfter );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_walk_packet_chain() - Walk packet chain and (possibly) 
+                                        unchain packets
+
+  This API will walk the voss Packet and unchain the packet from the chain, 
+  if specified.  The 'next' packet in the packet chain is returned as the 
+  packet chain is traversed. 
+  
+  \param  pPacket - input vos_packet walk 
+  
+  \param ppChainedPacket - pointer to location to return the 'next' voss 
+                           packet pointer in the packet chain.  
+                           NULL means there is was not packet chained
+                           to this packet.
+                           
+  \param unchainPacket - Flag that specifies if the caller wants the packet
+                         to be removed from the packet chain.  This is 
+                         provided to allow the caller to walk the packet chain
+                         with or without breaking the chain.  
+                         
+    <ul>
+      <li> true - when set 'true' the API will return 
+                  the 'next' packet pointer in the voss Packte chain and 
+                  *WILL* unchain the input packet from the packet chain.
+                    
+      <li> NOT false - when set 'false' the API will return 
+                       the 'next' packet pointer in the voss Packet chain but
+                       *WILL NOT* unchain the packet chain.   This option gives
+                       the caller the ability to walk the packet chain without 
+                       modifying it in the process.
+    </ul>
+                    
+  \note Having the packets chained has an implicaiton on how the return
+        packet API (vos_pkt_return_packet() ) operates.                     
+                      
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_walk_packet_chain( vos_pkt_t *pPacket, vos_pkt_t **ppChainedPacket,
+                                      v_BOOL_t unchainPacket );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_data_vector() - Get data vectors from a voss Packet
+
+  This API gets the complete set of Vectors (pointer / length pairs) that 
+  describe all of the data that makes up the voss Packet.
+
+  \param pPacket - pointer to the vOSS Packet to get the pointer/length 
+                   vector from
+                   
+  \param pVector - pointer to the vector array where the vectors are returned.
+  
+  \param pNumVectors - Number of vector's in the vector array (at pVector).  
+                       On successful return, *pNumVectors is updated with the 
+                       number of pointer/length vectors at pVector populated 
+                       with valid vectors.
+  
+  Call with NULL pVector or 0 vectorSize, will return the size of vector 
+  needed (in *pNumVectors)
+  
+  Caller allocates and frees the vector memory.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_data_vector( vos_pkt_t *pPacket, vos_pkt_data_vector_t *pVector, 
+                                    v_SIZE_t *pNumVectors );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_extract_data() - Extract data from the voss Packet.
+
+  This API extracts data from a voss Packet, copying the data into the 
+  supplied output buffer.  Note the data is copied from the vos packet
+  but the data remains in the vos packet and the size is unaffected.
+  
+  \param pPacket - the voss Packet to get the data from.
+  
+  \param pktOffset - the offset from the start of the voss Packet to get the 
+         data.  (i.e. 0 would be the beginning of the voss Packet).
+         
+  \param pOutputBuffer - Pointer to the location where the voss Packet data
+         will be copied.
+  
+  \param pOutputBufferSize - on input, contains the amount of data to extract
+         into the output buffer.  Upon return, contains the amount of data
+         extracted into the output buffer.   
+                             
+         Note:  an input of 0 in *pOutputBufferSize, means to copy *all* 
+         data in the voss Packet into the output buffer.  The caller is 
+         responsible for assuring the output buffer size is big enough
+         since the size of the buffer is not being passed in!
+                             
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_extract_data( vos_pkt_t *pPacket, v_SIZE_t pktOffset, 
+                                 v_VOID_t *pOutputBuffer, v_SIZE_t *pOutputBufferSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_extract_data_chain() - Extract data from a voss Packet chain.
+
+  This API extracts *all* the data from a voss Packet chain, copying the 
+  data into the supplied output buffer.  Note the data is copied from 
+  the vos packet chain but the data remains in the vos packet and the 
+  size of the vos packets are unaffected.
+  
+  \param pPacket - the first voss Packet in the voss packet chain to 
+         extract data.
+           
+  \param pOutputBuffer - Pointer to the location where the voss Packet data
+         will be copied.
+  
+  \param pOutputBufferSize - on input, contains the maximum amount of data 
+         that can be extracted into the output buffer.  Upon return, contains
+         the amount of data extracted from the packet chain.   
+                             
+  \return VOS_STATUS_SUCCESS - the data from the entire packet chain is 
+          extracted and found at *pOutputBuffer.  *pOutputBufferSize bytes
+          were extracted.
+          
+          VOS_STATUS_E_FAULT - pPacket, pOutputBuffer, or pOutputBufferSize
+          is not a valid pointer.
+          
+          VOS_STATUS_E_NOMEM - there is not enough room to extract the data
+          from the entire packet chain. *pOutputBufferSize has been updated 
+          with the size needed to extract the entier packet chain.          
+    
+  \sa vos_pkt_extract_data()
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_extract_data_chain( vos_pkt_t *pPacket, v_VOID_t *pOutputBuffer, 
+                                       v_SIZE_t *pOutputBufferSize );
+
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_peek_data() - peek into voss Packet at given offset 
+
+  This API provides a pointer to a specified offset into a voss Packet, 
+  allowing the caller to peek at a given number of bytes in the voss Packet.  
+  Upon successful return, the caller can access "numBytes" of data at 
+  "pPacketData".  
+  
+  This API will fail if the data length requested to peek at is not in  
+  contiguous memory in the voss Packet.  In this case, the caller should 
+  use vos_pkt_extract_data() to have the data copied into a caller supplied
+  buffer.
+  
+  \param pPacket - the vOSS Packet to peek into
+  
+  \param pktOffset - the offset into the voss Packet data to peek into.
+  
+  \param ppPacketData - pointer to the location where the pointer to the
+                        packet data at pktOffset will be returned.
+                        
+  \param numBytes - the number of bytes the caller wishes to peek at.                          
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_peek_data( vos_pkt_t *pPacket, v_SIZE_t pktOffset,
+                              v_VOID_t **ppPacketData, v_SIZE_t numBytes );
+                        
+                        
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_packet_type() - Get packet type for a voss Packet 
+
+  This API returns the packet Type for a voss Packet. 
+  
+  \param pPacket - the voss Packet to get the packet type from.
+  
+  \param pPacketType - location to return the packet type for the voss Packet
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_type( vos_pkt_t *pPacket, VOS_PKT_TYPE *pPacketType );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_packet_length() - Get packet length for a voss Packet 
+
+  This API returns the total length of the data in a voss Packet. 
+  
+  \param pPacket - the voss Packet to get the packet length from.
+  
+  \param pPacketSize - location to return the total size of the data contained
+                       in the voss Packet.  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_length( vos_pkt_t *pPacket, v_U16_t *pPacketSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_packet_chain_length() - Get length of a vos packet chain 
+
+  This API returns the total length of the data in a voss Packet chain.
+  
+  \param pPacket - the voss Packet at the start of the packet chain.  This API
+         will calculate the length of data in the packet chain stating with 
+         this packet.
+  
+  \param pPacketSize - location to return the total size of the data contained
+                       in the voss Packet.  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_chain_length( vos_pkt_t *pPacketChain, v_SIZE_t *pPacketChainSize );
+
+
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_push_head() - push data on the front a of a voss Packet 
+
+  This API will push data onto the front of a voss Packet.  The data will be 
+  appended in front of any data already contained in the voss Packet.
+  
+  \param pPacket - the voss Packet to modify.
+  
+  \param pData - pointer to the data to push onto the head of the voss Packet.
+  
+  \param dataSize - the size of the data to put onto the head of the voss Packet.  
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/ 
+VOS_STATUS vos_pkt_push_head( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_reserve_head() - Reserve space at the front of a voss Packet 
+
+  This API will reserve space at the front of a voss Packet.  The caller can 
+  then copy data into this reserved space using memcpy() like functions.  This 
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+  
+  Upon successful return, the length of the voss Packet is increased by 
+  dataSize.
+  
+  < put a before / after picture here> 
+  
+  \param pPacket - the voss Packet to modify.
+  
+  \param ppData - pointer to the location where the pointer to the reserved 
+                  space is returned.  Upon successful return, the caller has 
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+  
+  \param dataSize - the size of the data to reserve at the head of the voss 
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize. 
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/ 
+VOS_STATUS vos_pkt_reserve_head( vos_pkt_t *pPacket, v_VOID_t **ppData, 
+                                 v_SIZE_t dataSize );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_reserve_head_fast()- Reserve space at the front of a voss Pkt 
+
+  This API will reserve space at the front of a voss Packet.  The caller can 
+  then copy data into this reserved space using memcpy() like functions.  This 
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+  
+  Upon successful return, the length of the voss Packet is increased by 
+  dataSize.
+ 
+  Same as above API but no memset to 0.
+ 
+  < put a before / after picture here> 
+  
+  \param pPacket - the voss Packet to modify.
+  
+  \param ppData - pointer to the location where the pointer to the reserved 
+                  space is returned.  Upon successful return, the caller has 
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+  
+  \param dataSize - the size of the data to reserve at the head of the voss 
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize. 
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/ 
+VOS_STATUS vos_pkt_reserve_head_fast( vos_pkt_t *pPacket,
+                                 v_VOID_t **ppData,
+                                 v_SIZE_t dataSize );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_pop_head() - Remove data from the front of the voss Packet 
+
+  This API removes data from the front of a voss Packet.  The data is 
+  copied into the output buffer described by pData and pDataSize
+  
+  \param pPacket - the voss Packet to operate on.
+  
+  \param pData - pointer to the data buffer where the data removed from the 
+                 voss Packet is placed.
+                 
+  \param dataSize - The amount of space to remove from the head of the voss
+                    Packet.  The output buffer (at *pData) must contain at
+                    least this amount of space.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_pop_head( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_trim_head() - Skip over bytes at the front of a voss Packet 
+
+  This API moves the pointers at the head of a voss Packet to essentially 
+  skip over data at the front of a voss Packet.  Upon successful return, the
+  length of the voss Packet is reduced by dataSize and the starting pointer 
+  to the voss Packet is adjusted to eliminate the data from the start of the
+  voss Packet.  
+  
+  This API has the opposite effect of \a vos_pkt_reserve_head().
+  
+  \param pPacket - the voss Packet to operate on.
+  
+  \param dataSize - The amount of space to skip at the start of the voss
+                    Packet.
+                    
+                    Note that upon return, the data skipped over is 
+                    inaccessible to the caller.  If the caller needs access
+                    to the head data, use vos_pkt_pop_head() or 
+                    vos_pkt_extract_data() to get a copy of the data.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_trim_head( vos_pkt_t *pPacket, v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_push_tail() - push data on the end a of a voss Packet 
+
+  This API will push data onto the end of a voss Packet.  The data will be 
+  appended to the end of any data already contained in the voss Packet.
+    
+  \param pPacket - the voss Packet to modify.
+  
+  \param pData - pointer to the data to push onto the tail of the voss Packet.
+  
+  \param dataSize - the size of the data to put onto the tail of the voss Packet.  
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/ 
+VOS_STATUS vos_pkt_push_tail( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_reserve_tail() - Reserve space at the end of a voss Packet 
+
+  This API will reserve space at the end of a voss Packet.  The caller can 
+  then copy data into this reserved space using memcpy() like functions.  This 
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+  
+  Upon successful return, the length of the voss Packet is increased by 
+  dataSize.
+  
+  \param pPacket - the voss Packet to modify.
+  
+  \param ppData - pointer to the location where the pointer to the reserved 
+                  space is returned.  Upon successful return, the caller has 
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+  
+  \param dataSize - the size of the data to reserve at the head of the voss 
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize. 
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_reserve_tail( vos_pkt_t *pPacket, v_VOID_t **ppData, 
+                                 v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_pop_tail() - Remove data from the end of the voss Packet 
+
+  This API removes data from the end of a voss Packet.  The data is 
+  copied into the output buffer described by pData and pDataSize
+  
+  \param pPacket - the voss Packet to operate on.
+  
+  \param pData - pointer to the data buffer where the data removed from the 
+                 voss Packet is placed.
+                 
+  \param dataSize - The amount of space to remove from the end of the voss
+                    Packet.  The output buffer (at *pData) must contain at
+                    least this amount of space.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_pop_tail( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
+
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_trim_tail() - Skip over bytes at the end of a voss Packet 
+
+  This API moves the pointers at the head of a voss Packet to essentially 
+  skip over data at the end of a voss Packet.  Upon successful return, the
+  length of the voss Packet is reduced by dataSize and voss Packet is 
+  adjusted to eliminate the data from the end of the voss Packet.  
+  
+  This API has the opposite effect of \a vos_pkt_reserve_tail().
+  
+  \param pPacket - the voss Packet to operate on.
+  
+  \param dataSize - The amount of space to remove at the end of the voss
+                    Packet.
+                    
+                    Note that upon return, the data skipped over is 
+                    inaccessible to the caller.  If the caller needs access
+                    to the tail data, use vos_pkt_pop_tail() or 
+                    vos_pkt_extract_data() to get a copy of the data.
+  
+  \return
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_trim_tail( vos_pkt_t *pPacket, v_SIZE_t dataSize );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_timestamp() - Retrive the timestamp attribute from the
+  specified VOSS packet
+
+  \param pPacket - the voss Packet to operate on. 
+
+  \param pTstamp - the timestamp will be returned here. 
+  
+  \return VOS_STATUS_E_FAULT - invalid parameter(s) specified
+
+          VOS_STATUS_SUCCESS - timestamp retrived successfully
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_timestamp( vos_pkt_t *pPacket, v_TIME_t* pTstamp );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_flatten_rx_pkt() - Transform a platform based RX VOSS
+  packet into a flat buffer based VOSS packet if needed. This is needed in cases 
+  where for reasons of efficiency we want the RX packets to be very platform specific
+  (for e.g. DSM based on AMSS, etc). However platform independent code may rely
+  on making calls on the VOSS packet which can only be supported by the flat buffer
+  based implementation of a RX packet. This API will allocate a new VOSS packet 
+  with flat buffer, extract the data from the input VOSS packet and then release 
+  the input VOSS packet. The new VOSS packet will be returned from this call.
+ 
+  \param ppPacket - the voss Packet to operate on. on input contains
+                    the platform based packet. On output contains the flat
+                    buffer based packet. Any applicable resources
+                    are freed as part of this call.
+  
+  \return VOS_STATUS_E_FAULT - invalid parameter specified
+
+          VOS_STATUS_E_INVAL - packet type not RX_RAW 
+
+          VOS_STATUS_SUCCESS - transform successful
+
+          other VOSS status - other errors encountered
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_flatten_rx_pkt( vos_pkt_t **ppPacket );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_set_rx_length() - Set the length of a received packet 
+
+  This API set the length of the data inside the packet after a DMA has occurred
+  on rx, it will also set the tail pointer to the end of the data.
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param pktLen - The size of the data placed in the Rx packet during DMA.
+
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_set_rx_length( vos_pkt_t *pPacket, v_SIZE_t pktLen );
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_available_buffer_pool() - Get avaliable VOS packet size
+   VOSS Packet pool is limitted resource
+   VOSS Client need to know how many packet pool is still avaliable to control the flow
+   
+  \param  pktType - Packet type want to know free buffer count
+                    VOS_PKT_TYPE_TX_802_11_MGMT, management free buffer count,
+                    VOS_PKT_TYPE_TX_802_11_DATA
+                    VOS_PKT_TYPE_TX_802_3_DATA, TX free buffer count
+                    VOS_PKT_TYPE_RX_RAW, RX free buffer count
+
+          vosFreeBuffer - free frame buffer size
+  
+  \return VOS_STATUS_E_INVAL - invalid input parameter
+
+          VOS_STATUS_SUCCESS - Get size success
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_available_buffer_pool
+(
+   VOS_PKT_TYPE  pktType,
+   v_SIZE_t     *vosFreeBuffer
+);
+
+#endif  // !defined( __VOS_PKT_H )
diff --git a/CORE/VOSS/inc/vos_power.h b/CORE/VOSS/inc/vos_power.h
new file mode 100644
index 0000000..3cb2f2c
--- /dev/null
+++ b/CORE/VOSS/inc/vos_power.h
@@ -0,0 +1,615 @@
+/*
+ * 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 _VOS_POWER_H_
+#define _VOS_POWER_H_
+
+/*!
+  @file
+  vos_power.h
+
+  @brief
+  This is the interface to VOSS power APIs using for power management 
+  of the WLAN Libra module from the MSM PMIC. These implementation of 
+  these APIs is very target dependent, also these APIs should only be
+  used when the WLAN Libra module is powered from the MSM PMIC and not
+  from an external independent power source
+
+*/
+
+/*===========================================================================
+
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved
+
+  Qualcomm Proprietary
+
+  Export of this technology or software is regulated by the U.S. Government.
+  Diversion contrary to U.S. law prohibited.
+
+  All ideas, data and information contained in or disclosed by
+  this document are confidential and proprietary information of
+  QUALCOMM Incorporated and all rights therein are expressly reserved.
+  By accepting this material the recipient agrees that this material
+  and the information contained therein are held in confidence and in
+  trust and will not be used, copied, reproduced in whole or in part,
+  nor its contents revealed in any manner to others without the express
+  written permission of QUALCOMM Incorporated.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                        EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+$Header: $
+
+when       who     what, where, why
+--------   ---     ----------------------------------------------------------
+01/20/09   rg      Initial creation (based on Henri's slides)
+===========================================================================*/
+
+/*===========================================================================
+
+                           INCLUDE FILES
+
+===========================================================================*/
+#include "vos_api.h"
+
+/*===========================================================================
+
+                        DEFINITIONS AND TYPES
+
+===========================================================================*/
+typedef enum
+{
+  VOS_CHIP_RESET_CMD53_FAILURE,              /* Reset Chip due to CMD53 Failure */
+  VOS_CHIP_RESET_FW_EXCEPTION,               /* Reset Chip due to FW Failure */
+  VOS_CHIP_RESET_MUTEX_READ_FAILURE,         /* Reset Chip due to  Mutex Read Failure */
+  VOS_CHIP_RESET_MIF_EXCEPTION,              /* Reset Chip due to  MAC exception e.g. BMU fatal, MIF error */
+  VOS_CHIP_RESET_UNKNOWN_EXCEPTION           /* Reset Chip due to  any other exception */
+}vos_chip_reset_reason_type;
+
+typedef enum
+{
+  VOS_CALL_SYNC,    /* operation is synchronous */
+  VOS_CALL_ASYNC    /* operation is asynchronous */    
+
+} vos_call_status_type;
+
+typedef v_VOID_t (*vos_power_cb_type)
+(
+  v_PVOID_t  user_data,    /* user cookie */ 
+  VOS_STATUS result        /* result of operation:
+                              VOS_STATUS_SUCCESS for success
+                              VOS_STATUS_E_FAILURE for failure  */
+);
+
+/*===========================================================================
+
+                    FUNCTION PROTOTYPES
+
+===========================================================================*/
+
+/**
+  @brief vos_chipPowerUp() - This API will power up the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  The Libra SDIO core will have been initialized if the operation completes
+  successfully
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipPowerUp
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipPowerDown() - This API will power down the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipPowerDown
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipReset() - This API will reset the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  A hard reset will involve a powerDown followed by a PowerUp; a soft reset
+  can potentially be accomplished by writing to some device registers
+
+  The Libra SDIO core will have been initialized if the operation completes
+  successfully
+
+  @param status [out] : whether this operation will complete sync or async
+  @param soft [in] : VOS_TRUE if a soft reset is desired 
+                     VOS_FALSE for a hard reset i.e. powerDown followed by powerUp
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_NOSUPPORT - soft reset asked for but not supported
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipReset
+(
+  vos_call_status_type* status,
+  v_BOOL_t              soft,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  vos_chip_reset_reason_type    reason
+);
+
+/**
+  @brief vos_chipVoteOnPASupply() - This API will power up the PA supply
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnPASupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteOffPASupply() - This API will vote to turn off the 
+  PA supply. Even if we succeed in voting, there is a chance PA supply will not 
+  be turned off. This will be treated the same as a failure.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffPASupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipAssertDeepSleep() - This API will assert the deep 
+  sleep signal to Libra
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipAssertDeepSleep
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipDeAssertDeepSleep() - This API will de-assert the deep sleep
+  signal to Libra
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipDeAssertDeepSleep
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteOnRFSupply() - This API will power up the RF supply
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnRFSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteOffRFSupply() - This API will vote to turn off the 
+  RF supply. Even if we succeed in voting, there is a chance RF supply will not 
+  be turned off as RF rails could be shared with other modules (outside WLAN)
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffRFSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+/**
+  @brief vos_chipVoteOnBBAnalogSupply() - This API will power up the I/P voltage
+  used by Base band Analog.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnBBAnalogSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteOffBBAnalogSupply() - This API will vote off the BB Analog supply.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffBBAnalogSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+/**
+  @brief vos_chipVoteOnXOBuffer() - This API will vote to turn on the XO buffer from
+  PMIC. This API will be used when Libra uses the TCXO from PMIC on the MSM
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnXOBuffer
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteOffXOBuffer() - This API will vote off PMIC XO buffer.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffXOBuffer
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+);
+
+/**
+  @brief vos_chipVoteXOCore() - This API will FORCE vote ON PMIC XO CORE.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+  @param force_enable[in] : user supplied input for turning ON/OFF Xo Core
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteXOCore
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  v_BOOL_t              force_enable
+);
+
+
+/**
+  @brief vos_chipVoteFreqFor1p3VSupply() - This API will vote for frequency for 1.3V RF supply.
+  
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  EVM issue is observed with 1.6Mhz freq for 1.3V supply in wlan standalone case.
+  During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed. 
+  To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+  during exit.
+   
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+  @param freq [in]     :  Frequency for 1.3V Supply for which WLAN driver needs to vote for.
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteFreqFor1p3VSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  v_U32_t               freq
+);
+
+
+#endif /* _VOS_POWER_H_ */
diff --git a/CORE/VOSS/inc/vos_status.h b/CORE/VOSS/inc/vos_status.h
new file mode 100644
index 0000000..4546c0d
--- /dev/null
+++ b/CORE/VOSS/inc/vos_status.h
@@ -0,0 +1,132 @@
+/*
+ * 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( __VOS_STATUS_H )
+#define __VOS_STATUS_H
+
+/**=========================================================================
+  
+  \file  vos_Status.h
+  
+  \brief virtual Operating System Services (vOSS) Status codes
+               
+   Basic status codes/definitions used by vOSS 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+typedef enum
+{
+   /// Request succeeded!
+   VOS_STATUS_SUCCESS,
+   
+   /// Request failed because system resources (other than memory) to 
+   /// fulfill request are not available. 
+   VOS_STATUS_E_RESOURCES,
+  
+   /// Request failed because not enough memory is available to 
+   /// fulfill the request.
+   VOS_STATUS_E_NOMEM,  
+   
+   /// Request could not be fulfilled at this time.  Try again later.
+   VOS_STATUS_E_AGAIN,
+   
+   /// Request failed because there of an invalid request.  This is 
+   /// typically the result of invalid parameters on the request.
+   VOS_STATUS_E_INVAL,
+   
+   /// Request failed because handling the request would cause a 
+   /// system fault.  This error is typically returned when an 
+   /// invalid pointer to memory is detected.
+   VOS_STATUS_E_FAULT,
+
+   /// Request refused becayse a request is already in progress and 
+   /// another cannot be handled currently.
+   VOS_STATUS_E_ALREADY,
+    
+   /// Request failed because the message (type) is bad, invalid, or
+   /// not properly formatted.
+   VOS_STATUS_E_BADMSG,
+
+   /// Request failed because device or resource is busy. 
+   VOS_STATUS_E_BUSY,
+
+   /// Request did not complete because it was canceled.
+   VOS_STATUS_E_CANCELED,
+
+   /// Request did not complete because it was aborted.
+   VOS_STATUS_E_ABORTED,
+   
+   /// Request failed because the request is valid, though not supported
+   /// by the entity processing the request.
+   VOS_STATUS_E_NOSUPPORT,
+   
+   /// Operation is not permitted.
+   VOS_STATUS_E_PERM,
+   
+   /// Request failed because of an empty condition
+   VOS_STATUS_E_EMPTY,
+  
+   /// Existance failure.  Operation could not be completed because
+   /// something exists or does not exist.  
+   VOS_STATUS_E_EXISTS,
+   
+   /// Operation timed out
+   VOS_STATUS_E_TIMEOUT,
+   
+   /// Request failed for some unknown reason.  Note don't use this
+   /// status unless nothing else applies
+   VOS_STATUS_E_FAILURE   
+
+} VOS_STATUS;
+
+/// Macro to determine if a VOS_STATUS type is success.  All callers
+/// wanting to interpret VOS_STATUS should use this macro to check 
+/// for success to protect against the VOS_STATUS definitions 
+/// changing.
+///
+/// Use like this...
+///
+///  if ( VOS_STATUS_SUCCESS( vosStatus ) ) ...
+///
+#define VOS_IS_STATUS_SUCCESS( status ) ( VOS_STATUS_SUCCESS == ( status ) )
+
+
+
+#endif // if !defined __VOS_STATUS_H
diff --git a/CORE/VOSS/inc/vos_threads.h b/CORE/VOSS/inc/vos_threads.h
new file mode 100644
index 0000000..e0173f4
--- /dev/null
+++ b/CORE/VOSS/inc/vos_threads.h
@@ -0,0 +1,110 @@
+/*
+ * 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( __VOS_THREADS_H )
+#define __VOS_THREADS_H
+
+/**=========================================================================
+  
+  \file  vos_threads.h
+  
+  \brief virtual Operating System Services (vOSS) Threading APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_sleep() - sleep
+
+  The \a vos_sleep() function suspends the execution of the current thread
+  until the specified time out interval elapses.
+     
+  \param msInterval - the number of milliseconds to suspend the current thread.
+  A value of 0 may or may not cause the current thread to yield.
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_sleep( v_U32_t msInterval );
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_sleep_us() - sleep
+
+  The \a vos_sleep_us() function suspends the execution of the current thread
+  until the specified time out interval elapses.
+     
+  \param usInterval - the number of microseconds to suspend the current thread.
+  A value of 0 may or may not cause the current thread to yield.
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_sleep_us( v_U32_t usInterval );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_busy_wait() - busy wait
+
+  The \a vos_busy_wait() function places the current thread in busy wait
+  until the specified time out interval elapses. If the interval is greater
+  than 50us on WM, the behaviour is undefined.
+     
+  \param usInterval - the number of microseconds to busy wait. 
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_busy_wait( v_U32_t usInterval );
+
+#endif // __VOS_THREADS_H
diff --git a/CORE/VOSS/inc/vos_timer.h b/CORE/VOSS/inc/vos_timer.h
new file mode 100644
index 0000000..bb9c02c
--- /dev/null
+++ b/CORE/VOSS/inc/vos_timer.h
@@ -0,0 +1,330 @@
+/*
+ * 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( __VOS_TIMER_H )
+#define __VOS_TIMER_H
+
+/**=========================================================================
+  
+  \file  vos_timer.h
+  
+  \brief virtual Operating System Servies (vOS)
+               
+   Definitions for vOSS Timer services
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+#include <vos_lock.h>
+#include <i_vos_timer.h>
+
+#ifdef TIMER_MANAGER
+#include "wlan_hdd_dp_utils.h"
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#define VOS_TIMER_STATE_COOKIE 0x12
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+/// vos Timer callback function prototype (well, actually a prototype for 
+/// a pointer to this callback function)
+typedef v_VOID_t ( *vos_timer_callback_t )( v_PVOID_t userData );
+
+typedef enum
+{
+   /// pure software timer.  No guarantee the apps processor will
+   /// awaken when these timers expire.
+   VOS_TIMER_TYPE_SW,
+   
+   /// These timers can awaken the Apps processor from power collapse
+   /// when these timers expire.
+   /// \todo I really dont like this name :-)
+   VOS_TIMER_TYPE_WAKE_APPS
+
+} VOS_TIMER_TYPE;
+
+typedef enum
+{
+   VOS_TIMER_STATE_UNUSED = VOS_TIMER_STATE_COOKIE,
+   VOS_TIMER_STATE_STOPPED,
+   VOS_TIMER_STATE_STARTING,
+   VOS_TIMER_STATE_RUNNING,
+} VOS_TIMER_STATE;
+
+#ifdef TIMER_MANAGER
+struct vos_timer_s;
+typedef struct timer_node_s
+{
+   hdd_list_node_t pNode;
+   char* fileName;
+   unsigned int lineNum;
+   struct vos_timer_s *vosTimer;
+}timer_node_t;
+#endif
+
+typedef struct vos_timer_s
+{
+#ifdef TIMER_MANAGER
+   timer_node_t *ptimerNode;
+#endif
+
+   vos_timer_platform_t platformInfo;
+   vos_timer_callback_t callback;
+   v_PVOID_t            userData;
+   vos_lock_t           lock;
+   VOS_TIMER_TYPE       type;
+   VOS_TIMER_STATE      state;
+} vos_timer_t;
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+#ifdef TIMER_MANAGER
+void vos_timer_manager_init(void);
+void vos_timer_exit(void);
+#endif
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_timer_getCurrentState() - Get the current state of the timer
+
+  \param pTimer - the timer object
+  
+  \return timer state
+  
+  \sa
+  
+---------------------------------------------------------------------------*/
+VOS_TIMER_STATE vos_timer_getCurrentState( vos_timer_t *pTimer );
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_init() - Initialize a vOSS timer.
+
+  This API initializes a vOS Timer object. 
+  
+  The \a vos_timer_init() initializes a vOS Timer object.  A timer must be 
+  initialized by calling vos_timer_initialize() before it may be used in 
+  any other timer functions. 
+  
+  Attempting to initialize timer that is already initialized results in 
+  a failure. A destroyed timer object can be re-initialized with a call to
+  \a vos_timer_init().  The results of otherwise referencing the object 
+  after it has been destroyed are undefined.  
+  
+  Calls to vOSS timer functions to manipulate the timer such
+  as vos_timer_set() will fail if the timer is not initialized or has
+  been destroyed.  Therefore, don't use the timer after it has been 
+  destroyed until it has been re-initialized.
+  
+  All callback will be executed within the VOS main thread unless it is 
+  initialized from the Tx thread flow, in which case it will be executed
+  within the tx thread flow.
+  
+  \param timer - pointer to the opaque timer object to initialize
+  
+  \param timerType - specifies the type of timer.  We have two different
+                     timer types.
+    <ol>
+      <li> VOS_TIMER_TYPE_SW - Pure software timer. The Apps processor
+           may not be awoken when this timer expires.
+      <li> VOS_TIMER_TYPE_WAKE_APPS - The Apps processor will be awoken
+           from power collapse when this type of timer expires.
+     </ol>                      
+  
+  \param callback - the callback function to be called when the timer
+         expires.
+         
+  \param userData - a user data (or context) that is returned to the 
+         callback function as a parameter when the timer expires.         
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initialize the timer
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the timer
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to initialize the object referenced by timer, a previously 
+          initialized but not yet destroyed timer.
+
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+---------------------------------------------------------------------------*/
+#ifdef TIMER_MANAGER
+#define vos_timer_init(timer, timerType, callback, userdata) \
+      vos_timer_init_debug(timer, timerType, callback, userdata, __FILE__, __LINE__)
+      
+VOS_STATUS vos_timer_init_debug( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData, 
+                           char* fileName, v_U32_t lineNum );      
+#else
+VOS_STATUS vos_timer_init( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData );
+#endif
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_timer_destroy() - Destroy a vOSS Timer object
+
+  The \a vos_timer_destroy() function shall destroy the timer object.
+  After a successful return from \a vos_timer_destroy() the timer 
+  object becomes, in effect, uninitialized.
+   
+  A destroyed timer object can be re-initialized by calling
+  vos_timer_init().  The results of otherwise referencing the object 
+  after it has been destroyed are undefined.  
+  
+  Calls to vOSS timer functions to manipulate the timer, such
+  as vos_timer_set() will fail if the lock is destroyed.  Therefore, 
+  don't use the timer after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param timer - the timer object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by timer while it is still 
+          still referenced.  The timer must be stopped before it can be 
+          destroyed.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_timer_destroy( vos_timer_t *timer );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_start() - Start a vOSS Timer object
+
+  The \a vos_timer_start() function starts a timer to expire after the 
+  specified interval, thus running the timer callback function when 
+  the interval expires.
+   
+  A timer only runs once (a one-shot timer).  To re-start the 
+  timer, vos_timer_start() has to be called after the timer runs 
+  or has been cancelled.
+  
+  \param timer - the timer object to be started
+  
+  \param expirationTime - expiration time for the timer (in milliseconds)
+                          The expiration time cannot be less than 10 ms.
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully started.
+  
+          VOS_STATUS_E_ALREADY - The implementation has detected an attempt 
+          to start a timer while it is already started.  The timer must 
+          be stopped or expire before it can be started again.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_timer_start( vos_timer_t *timer, v_U32_t expirationTime );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_stop() - Stop a vOSS Timer
+
+  The \a vos_timer_stop() function stops a timer that has been started but
+  has not expired, essentially cancelling the 'start' request.
+   
+  After a timer is stopped, it goes back to the state it was in after it
+  was created and can be started again via a call to vos_timer_start().
+  
+  \param timer - the timer object to be stopped
+    
+  \return VOS_STATUS_SUCCESS - timer was successfully stopped.
+  
+          VOS_STATUS_E_EMPTY - The implementation has detected an attempt 
+          to stop a timer that has not been started or has already 
+          expired.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_timer_stop( vos_timer_t *timer );
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_get_system_ticks() - Get the system time in 10ms ticks
+
+  The \a vos_timer_get_system_ticks() function returns the current number
+  of timer ticks in 10msec intervals.  This function is suitable timestamping
+  and calculating time intervals by calculating the difference between two 
+  timestamps.
+    
+  \returns - The current system tick count (in 10msec intervals).  This 
+             function cannot fail.
+  
+  \sa
+  
+  ------------------------------------------------------------------------*/
+v_TIME_t vos_timer_get_system_ticks( v_VOID_t );
+
+
+/*--------------------------------------------------------------------------
+ 
+  \brief vos_timer_get_system_time() - Get the system time in milliseconds
+
+  The \a vos_timer_get_system_time() function returns the number of milliseconds 
+  that have elapsed since the system was started
+    
+  \returns - The current system time in milliseconds.
+  
+  \sa
+  
+  ------------------------------------------------------------------------*/
+v_TIME_t vos_timer_get_system_time( v_VOID_t );
+
+
+
+#endif // #if !defined __VOSS_TIMER_H
diff --git a/CORE/VOSS/inc/vos_trace.h b/CORE/VOSS/inc/vos_trace.h
new file mode 100644
index 0000000..e68bb50
--- /dev/null
+++ b/CORE/VOSS/inc/vos_trace.h
@@ -0,0 +1,135 @@
+/*
+ * 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( __VOS_TRACE_H )
+#define __VOS_TRACE_H
+
+/**=========================================================================
+  
+  \file  vos_trace.h
+  
+  \brief virtual Operating System Servies (vOS)
+               
+   Trace, logging, and debugging definitions and APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include  <vos_types.h>  // For VOS_MODULE_ID...
+#include  <stdarg.h>       // For va_list...
+
+/*-------------------------------------------------------------------------- 
+  Type declarations 
+  ------------------------------------------------------------------------*/
+
+typedef enum 
+{
+   // NONE means NO traces will be logged.  This value is in place for the 
+   // vos_trace_setlevel() to allow the user to turn off all traces.
+   VOS_TRACE_LEVEL_NONE = 0,
+   
+   // the following trace levels are the ones that 'callers' of VOS_TRACE()
+   // can specify in for the VOS_TRACE_LEVEL parameter.  Traces are classified
+   // by severity (FATAL being more serious than INFO for example).   
+   VOS_TRACE_LEVEL_FATAL,
+   VOS_TRACE_LEVEL_ERROR, 
+   VOS_TRACE_LEVEL_WARN,  
+   VOS_TRACE_LEVEL_INFO,
+   VOS_TRACE_LEVEL_INFO_HIGH,
+   VOS_TRACE_LEVEL_INFO_MED,
+   VOS_TRACE_LEVEL_INFO_LOW,
+
+   // ALL means all trace levels will be active.  This value is in place for the 
+   // vos_trace_setlevel() to allow the user to turn ON all traces.
+   VOS_TRACE_LEVEL_ALL, 
+
+   
+   // not a real level.  Used to identify the maximum number of 
+   // VOS_TRACE_LEVELs defined.
+   VOS_TRACE_LEVEL_MAX   
+    
+} VOS_TRACE_LEVEL;
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#define ASSERT_BUFFER_SIZE ( 512 )
+
+// below definition is obsolete and is no longer being used in BMP and WM
+// TODO: remove this once this is not used on Android
+#define VOS_ENABLE_TRACING 
+
+#include  <i_vos_trace.h>   
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_trace_setLevel() - Set the trace level for a particular module
+  
+  This is an external API that allows trace levels to be set for each module.
+  
+  \param level - trace level.   A member of the VOS_TRACE_LEVEL 
+         enumeration indicating the severity of the condition causing the
+         trace message to be issued.   More severe conditions are more 
+         likely to be logged.
+         
+  \return  nothing
+    
+  \sa
+  --------------------------------------------------------------------------*/
+void vos_trace_setLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level );
+
+/**----------------------------------------------------------------------------
+  
+  \brief vos_trace_getLevel() - Get the trace level
+  
+  This is an external API that returns a boolean value to signify if a 
+  particular trace level is set for the specified module.
+  
+  \param level - trace level.   A member of the VOS_TRACE_LEVEL enumeration 
+                 indicating the severity of the condition causing the trace 
+                 message to be issued.
+         
+                 Note that individual trace levels are the only valid values
+                 for this API.  VOS_TRACE_LEVEL_NONE and VOS_TRACE_LEVEL_ALL
+                 are not valid input and will return FALSE
+
+  \return  VOS_FALSE - the specified trace level for the specified module is OFF 
+    
+           VOS_TRUE - the specified trace level for the specified module is ON
+    
+  \sa vos_trace_setLevel()
+  --------------------------------------------------------------------------*/
+v_BOOL_t vos_trace_getLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level );
+
+#endif
diff --git a/CORE/VOSS/inc/vos_types.h b/CORE/VOSS/inc/vos_types.h
new file mode 100644
index 0000000..9937389
--- /dev/null
+++ b/CORE/VOSS/inc/vos_types.h
@@ -0,0 +1,518 @@
+/*
+ * 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( __VOS_TYPES_H )
+#define __VOS_TYPES_H
+
+/**=========================================================================
+  
+  \file  vos_Types.h
+  
+  \brief virtual Operating System Servies (vOS)
+               
+   Basic type definitions 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "i_vos_types.h"
+#include <string.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+// macro to get maximum of two values.
+#define VOS_MAX( _x, _y ) ( ( (_x) > (_y) ) ? (_x) : (_y) )  
+
+// macro to get minimum of two values
+#define VOS_MIN( _x, _y ) ( ( (_x) < (_y) ) ? (_x) : (_y)  )  
+
+// macro to get the ceiling of an integer division operation...
+#define VOS_CEIL_DIV( _a, _b ) ( 0 != (_a) % (_b) ) ? ( (_a) / (_b) + 1 ) : ( (_a) / (_b) ) 
+
+// macro to return the floor of an integer division operation
+#define VOS_FLOOR_DIV( _a, _b ) ( ( (_a) - ( (_a) % (_b) ) ) / (_b) )
+
+#define VOS_SWAP_U16(_x) \
+   ( ( ( (_x) << 8 ) & 0xFF00 ) | ( ( (_x) >> 8 ) & 0x00FF ) )
+
+#define VOS_SWAP_U32(_x) \
+   ( ( ( (_x) << 24 ) & 0xFF000000 ) | ( ( (_x) >> 24 ) & 0x000000FF ) ) | \
+   ( ( ( (_x) << 8 ) & 0x00FF0000 ) | ( ( (_x) >> 8 ) & 0x0000FF00 ) )
+
+// Endian operations for Big Endian and Small Endian modes
+#ifdef ANI_LITTLE_BYTE_ENDIAN
+
+#define vos_cpu_to_be32(_x) VOS_SWAP_U32(_x)
+#define vos_be32_to_cpu(_x) VOS_SWAP_U32(_x)
+#define vos_cpu_to_be16(_x) VOS_SWAP_U16(_x)
+#define vos_be16_to_cpu(_x) VOS_SWAP_U16(_x)
+#define vos_cpu_to_le32(_x) (_x)
+#define vos_le32_to_cpu(_x) (_x)
+#define vos_cpu_to_le16(_x) (_x)
+#define vos_le16_to_cpu(_x) (_x)
+
+#endif
+
+#ifdef ANI_BIG_BYTE_ENDIAN
+
+#define vos_cpu_to_be32(_x) (_x)
+#define vos_be32_to_cpu(_x) (_x)
+#define vos_cpu_to_be16(_x) (_x)
+#define vos_be16_to_cpu(_x) (_x)
+#define vos_cpu_to_le32(_x) VOS_SWAP_U32(_x)
+#define vos_le32_to_cpu(_x) VOS_SWAP_U32(_x)
+#define vos_cpu_to_le16(_x) VOS_SWAP_U16(_x)
+#define vos_le16_to_cpu(_x) VOS_SWAP_U16(_x)
+
+#endif
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+   
+/// Module IDs.  These are generic IDs that identify the various modules
+/// in the software system.
+typedef enum
+{
+   VOS_MODULE_ID_BAP        = 0,
+   VOS_MODULE_ID_TL         = 1,
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   VOS_MODULE_ID_BAL        = 2,
+   VOS_MODULE_ID_SAL        = 3,
+   VOS_MODULE_ID_SSC        = 4,
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   VOS_MODULE_ID_WDI        = 2,
+#endif
+   
+   VOS_MODULE_ID_HDD        = 5,
+   VOS_MODULE_ID_SME        = 6,
+   VOS_MODULE_ID_PE         = 7,
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   VOS_MODULE_ID_HAL        = 8,
+#else
+   VOS_MODULE_ID_WDA        = 8,
+#endif
+
+   VOS_MODULE_ID_SYS        = 9,
+   VOS_MODULE_ID_VOSS       = 10,
+#ifdef WLAN_SOFTAP_FEATURE
+   VOS_MODULE_ID_SAP        = 11,
+   VOS_MODULE_ID_HDD_SOFTAP = 12,
+#endif   
+
+
+
+   // not a real module ID.  This is used to identify the maxiumum
+   // number of VOS_MODULE_IDs and should always be at the END of
+   // this enum.  If IDs are added, they need to go in front of this
+   VOS_MODULE_ID_MAX
+
+} VOS_MODULE_ID;
+
+
+/// Concurrency role.  These are generic IDs that identify the various roles
+/// in the software system.
+typedef enum
+{ /*ON linux maintain 1-1 corespondence with device_mode_t in hdd*/
+    VOS_STA_MODE=0, 
+    VOS_STA_SAP_MODE=1, //to support softAp  mode . This is misleading. It means AP MODE only. 
+                        //The constant name has historical reason
+    VOS_P2P_CLIENT_MODE,
+    VOS_P2P_GO_MODE,
+    VOS_MONITOR_MODE,
+#ifdef ANI_MANF_DIAG
+    VOS_FTM_MODE = 5,
+#endif
+    VOS_MAX_NO_OF_MODE
+
+} tVOS_CON_MODE;
+
+//This is a bit pattern to be set for each mode
+//bit 0 - sta mode
+//bit 1 - ap mode
+//bit 2 - p2p client mode
+//bit 3 - p2p go mode
+typedef enum
+{
+    VOS_STA=1, 
+    VOS_SAP=2,
+    VOS_STA_SAP=3, //to support sta, softAp  mode . This means STA+AP mode
+    VOS_P2P_CLIENT=4,
+    VOS_P2P_GO=8,
+    VOS_MAX_CONCURRENCY_PERSONA=4
+} tVOS_CONCURRENCY_MODE;
+ 
+#if !defined( NULL )
+#ifdef __cplusplus
+#define NULL    0
+#else
+#define NULL    ((void *)0)
+#endif
+#endif
+
+enum
+{
+   VOS_FALSE = 0, 
+   VOS_TRUE  = ( !VOS_FALSE )
+};
+
+/// pointer to void types
+typedef v_VOID_t *v_PVOID_t;
+
+/// "Size" type... 
+typedef v_UINT_t v_SIZE_t;
+
+/// 'Time' type
+typedef v_ULONG_t v_TIME_t;
+
+// typedef for VOSS Context...
+typedef v_VOID_t *v_CONTEXT_t;
+
+
+/// MAC address data type and corresponding macros/functions to 
+/// manipulate MAC addresses...
+/// Macro defining the size of a MAC Address...
+#define VOS_MAC_ADDR_SIZE ( 6 )
+
+typedef struct
+{
+   /// the bytes that make up the macAddress.  
+   v_BYTE_t bytes[ VOS_MAC_ADDR_SIZE ];
+    
+} v_MACADDR_t;
+
+
+/// This macro is used to initialize a vOSS MacAddress to the 
+/// broadcast MacAddress.  It is used like this...
+/// v_MACADDR_t macAddress = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
+#define VOS_MAC_ADDR_BROADCAST_INITIALIZER { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }
+
+/// This macro is used to initialize a vOSS MacAddress to zero
+/// It is used like this...
+/// v_MACADDR_t macAddress = VOS_MAC_ADDR_ZERO_INITIALIZER;
+#define VOS_MAC_ADDR_ZERO_INITIALIZER { { 0, 0, 0, 0, 0, 0 } }
+
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_equal() - compare two vOSS MacAddress
+
+  This function returns a boolean that tells if a two vOSS MacAddress' 
+  are equivalent.
+  
+  \param pMacAddr1 - pointer to one voss MacAddress to compare
+  \param pMacAddr2 - pointer to the other voss MacAddress to compare
+  
+  \return  true - the MacAddress's are equal
+           not true - the MacAddress's are not equal
+  
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_equal( v_MACADDR_t *pMacAddr1, 
+                                             v_MACADDR_t *pMacAddr2 )
+{
+   return ( 0 == memcmp( pMacAddr1, pMacAddr2, VOS_MAC_ADDR_SIZE ) );
+}
+
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_zero() - check for a MacAddress of all zeros. 
+
+  This function returns a boolean that tells if a MacAddress is made up of
+  all zeros.
+  
+  \param pMacAddr - pointer to the v_MACADDR_t to check.
+  
+  \return  true - the MacAddress is all Zeros
+           not true - the MacAddress is not all Zeros.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_zero( v_MACADDR_t *pMacAddr )
+{
+   v_MACADDR_t zeroMacAddr = VOS_MAC_ADDR_ZERO_INITIALIZER;
+   
+   return( vos_is_macaddr_equal( pMacAddr, &zeroMacAddr ) );
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_zero_macaddr() - zero out a MacAddress
+
+  This function zeros out a vOSS MacAddress type.
+  
+  \param pMacAddr - pointer to the v_MACADDR_t to zero.
+  
+  \return  nothing
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_VOID_t vos_zero_macaddr( v_MACADDR_t *pMacAddr )
+{
+   memset( pMacAddr, 0, VOS_MAC_ADDR_SIZE );
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_group() - check for a MacAddress is a 'group' address 
+
+  This function returns a boolean that tells if a the input vOSS MacAddress
+  is a "group" address.  Group addresses have the 'group address bit' turned
+  on in the MacAddress.  Group addresses are made up of Broadcast and 
+  Multicast addresses.
+  
+  \param pMacAddr1 - pointer to the voss MacAddress to check
+  
+  \return  true - the input MacAddress is a Group address
+           not true - the input MacAddress is not a Group address
+  
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_group( v_MACADDR_t *pMacAddr )
+{
+    return( pMacAddr->bytes[ 0 ] & 0x01 );
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_broadcast() - check for a MacAddress is a broadcast address 
+
+  This function returns a boolean that tells if a the input vOSS MacAddress
+  is a "broadcast" address.
+  
+  \param pMacAddr - pointer to the voss MacAddress to check
+  
+  \return  true - the input MacAddress is a broadcast address
+           not true - the input MacAddress is not a broadcast address
+  
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_broadcast( v_MACADDR_t *pMacAddr )
+{
+   v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
+   
+   return( vos_is_macaddr_equal( pMacAddr, &broadcastMacAddr ) );
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_multicast() - check for a MacAddress is a multicast address 
+
+  This function returns a boolean that tells if a the input vOSS MacAddress
+  is a "Multicast" address.
+  
+  \param pMacAddr - pointer to the voss MacAddress to check
+  
+  \return  true - the input MacAddress is a Multicast address
+           not true - the input MacAddress is not a Multicast address
+  
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_multicast( v_MACADDR_t *pMacAddr )
+{
+   return( vos_is_macaddr_group( pMacAddr ) &&
+          !vos_is_macaddr_broadcast( pMacAddr ) );
+}
+
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_is_macaddr_directed() - check for a MacAddress is a directed address 
+
+  This function returns a boolean that tells if a the input vOSS MacAddress
+  is a "directed" address.
+  
+  \param pMacAddr - pointer to the voss MacAddress to check
+  
+  \return  true - the input MacAddress is a directed address
+           not true - the input MacAddress is not a directed address
+  
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_BOOL_t vos_is_macaddr_directed( v_MACADDR_t *pMacAddr )
+{
+    return( !vos_is_macaddr_group( pMacAddr ) );
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_copy_macaddr() - copy a vOSS MacAddress
+
+  This function copies a vOSS MacAddress into another vOSS MacAddress.
+  
+  \param pDst - pointer to the voss MacAddress to copy TO (the destination)
+  \param pSrc - pointer to the voss MacAddress to copy FROM (the source)
+  
+  \return  nothing
+    
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_VOID_t vos_copy_macaddr( v_MACADDR_t *pDst, v_MACADDR_t *pSrc )
+{
+    *pDst = *pSrc;
+}    
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_set_macaddr_broadcast() - set a vOSS MacAddress to the 'broadcast' 
+                                       
+  This function sets a vOSS MacAddress to the 'broadcast' MacAddress. Broadcast
+  MacAddress contains all 0xFF bytes.
+  
+  \param pMacAddr - pointer to the voss MacAddress to set to broadcast
+  
+  \return  nothing
+    
+  \sa
+    
+  --------------------------------------------------------------------------*/
+VOS_INLINE_FN v_VOID_t vos_set_macaddr_broadcast( v_MACADDR_t *pMacAddr )
+{
+   memset( pMacAddr, 0xff, VOS_MAC_ADDR_SIZE );
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_set_U32() - set a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to set.
+  
+  \param value - the value to set in the v_U32_t variable.
+  
+  \return This function returns the value previously in the v_U32_t before
+          the new value is set.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_decrement_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_set_U32( v_U32_t *pTarget, v_U32_t value );
+
+
+// TODO: the below function is a stub to perform atomic set on a BYTE
+// Clearly the function below is not an atomic function
+VOS_INLINE_FN v_U8_t vos_atomic_set_U8( v_U8_t *pVariable, v_U8_t value )
+{
+  if (pVariable == NULL)
+  {
+    return 0;
+  }
+  *pVariable = value;
+  return value;
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_increment_U32() - Increment a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to increment.
+  
+  \return This function returns the value of the variable after the 
+          increment occurs.
+    
+  \sa vos_atomic_decrement_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_increment_U32( v_U32_t *pTarget );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_decrement_U32() - Decrement a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to decrement.
+  
+  \return This function returns the value of the variable after the 
+          decrement occurs.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_decrement_U32( v_U32_t *pTarget );
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_increment_U32_by_value() - Increment a U32 variable atomically
+  by a given value
+  
+  \param pTarget - pointer to the v_U32_t to decrement.
+  \param value   - the value that needs to be added to target
+  
+  \return This function returns the value of the variable after the 
+          decrement occurs.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_increment_U32_by_value( v_U32_t *pTarget, v_U32_t value  );
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_decrement_U32_by_value() - Decrement a U32 variable atomically
+  by a given value
+  
+  \param pTarget - pointer to the v_U32_t to decrement.
+  \param value   - the value that needs to be substracted from target
+  
+  \return This function returns the value of the variable after the 
+          decrement occurs.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_decrement_U32_by_value( v_U32_t *pTarget, v_U32_t value  );
+
+
+v_U32_t vos_get_skip_ssid_check(void); 
+
+v_U32_t vos_get_skip_11e_check(void); 
+
+
+
+#endif // if !defined __VOSS_TYPES_H
diff --git a/CORE/VOSS/inc/vos_utils.h b/CORE/VOSS/inc/vos_utils.h
new file mode 100644
index 0000000..ae10d13
--- /dev/null
+++ b/CORE/VOSS/inc/vos_utils.h
@@ -0,0 +1,158 @@
+/*
+ * 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( __VOS_UTILS_H )
+#define __VOS_UTILS_H
+ 
+/**=========================================================================
+  
+  \file  vos_utils.h
+  
+  \brief virtual Operating System Services (vOSS) utility APIs
+               
+   Various utility functions
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_types.h>
+#include <vos_status.h>
+//#include <Wincrypt.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+#define VOS_DIGEST_SHA1_SIZE    20
+#define VOS_DIGEST_MD5_SIZE     16
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+VOS_STATUS vos_crypto_init( v_U32_t *phCryptProv );
+
+VOS_STATUS vos_crypto_deinit( v_U32_t hCryptProv );
+
+
+
+/**
+ * vos_rand_get_bytes
+
+ * FUNCTION:
+ * Returns cryptographically secure pseudo-random bytes.
+ *
+ *
+ * @param pbBuf - the caller allocated location where the bytes should be copied
+ * @param numBytes the number of bytes that should be generated and
+ * copied
+ * 
+ * @return VOS_STATUS_SUCCSS if the operation succeeds
+*/
+VOS_STATUS vos_rand_get_bytes( v_U32_t handle, v_U8_t *pbBuf, v_U32_t numBytes );
+
+
+/**
+ * vos_sha1_hmac_str
+ *
+ * FUNCTION:
+ * Generate the HMAC-SHA1 of a string given a key.
+ *
+ * LOGIC:
+ * Standard HMAC processing from RFC 2104. The code is provided in the
+ * appendix of the RFC.
+ *
+ * ASSUMPTIONS:
+ * The RFC is correct.
+ *
+ * @param text text to be hashed
+ * @param textLen length of text
+ * @param key key to use for HMAC
+ * @param keyLen length of key
+ * @param digest holds resultant SHA1 HMAC (20B)
+ *
+ * @return VOS_STATUS_SUCCSS if the operation succeeds
+ *
+ */
+VOS_STATUS vos_sha1_hmac_str(v_U32_t cryptHandle, /* Handle */
+           v_U8_t *text, /* pointer to data stream */
+           v_U32_t textLen, /* length of data stream */
+           v_U8_t *key, /* pointer to authentication key */
+           v_U32_t keyLen, /* length of authentication key */
+           v_U8_t digest[VOS_DIGEST_SHA1_SIZE]);/* caller digest to be filled in */
+
+/**
+ * vos_md5_hmac_str
+ *
+ * FUNCTION:
+ * Generate the HMAC-MD5 of a string given a key.
+ *
+ * LOGIC:
+ * Standard HMAC processing from RFC 2104. The code is provided in the
+ * appendix of the RFC.
+ *
+ * ASSUMPTIONS:
+ * The RFC is correct.
+ *
+ * @param text text to be hashed
+ * @param textLen length of text
+ * @param key key to use for HMAC
+ * @param keyLen length of key
+ * @param digest holds resultant MD5 HMAC (16B)
+ *
+ * @return VOS_STATUS_SUCCSS if the operation succeeds
+ *
+ */
+VOS_STATUS vos_md5_hmac_str(v_U32_t cryptHandle, /* Handle */
+           v_U8_t *text, /* pointer to data stream */
+           v_U32_t textLen, /* length of data stream */
+           v_U8_t *key, /* pointer to authentication key */
+           v_U32_t keyLen, /* length of authentication key */
+           v_U8_t digest[VOS_DIGEST_MD5_SIZE]);/* caller digest to be filled in */
+
+
+
+VOS_STATUS vos_encrypt_AES(v_U32_t cryptHandle, /* Handle */
+                           v_U8_t *pText, /* pointer to data stream */
+                           v_U8_t *Encrypted,
+                           v_U8_t *pKey); /* pointer to authentication key */
+
+
+VOS_STATUS vos_decrypt_AES(v_U32_t cryptHandle, /* Handle */
+                           v_U8_t *pText, /* pointer to data stream */
+                           v_U8_t *pDecrypted,
+                           v_U8_t *pKey); /* pointer to authentication key */
+
+#endif // #if !defined __VOSS_UTILS_H
diff --git a/CORE/VOSS/inc/wlan_hdd_misc.h b/CORE/VOSS/inc/wlan_hdd_misc.h
new file mode 100644
index 0000000..f17abbc
--- /dev/null
+++ b/CORE/VOSS/inc/wlan_hdd_misc.h
@@ -0,0 +1,71 @@
+/*
+ * 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 WLAN_HDD_MISC_H
+#define WLAN_HDD_MISC_H
+
+#ifdef MSM_PLATFORM
+#ifdef QC_WLAN_CHIPSET_PRIMA
+#define WLAN_INI_FILE              "wlan/prima/WCNSS_qcom_cfg.ini"
+#define WLAN_CFG_FILE              "wlan/prima/WCNSS_cfg.dat"
+#define WLAN_FW_FILE               ""
+#define WLAN_NV_FILE               "wlan/prima/WCNSS_qcom_wlan_nv.bin"
+#define WLAN_COUNTRY_INFO_FILE     "wlan/prima/WCNSS_wlan_country_info.dat"
+#define WLAN_HO_CFG_FILE           "wlan/prima/WCNSS_wlan_ho_config"
+#else
+#define WLAN_INI_FILE              "wlan/volans/WCN1314_qcom_cfg.ini"
+#define WLAN_CFG_FILE              "wlan/volans/WCN1314_cfg.dat"
+#define WLAN_FW_FILE               "wlan/volans/WCN1314_qcom_fw.bin"
+#define WLAN_NV_FILE               "wlan/volans/WCN1314_qcom_wlan_nv.bin"
+#define WLAN_COUNTRY_INFO_FILE     "wlan/volans/WCN1314_wlan_country_info.dat"
+#define WLAN_HO_CFG_FILE           "wlan/volans/WCN1314_wlan_ho_config"
+#endif // ANI_CHIPSET
+#else
+#define WLAN_INI_FILE              "wlan/qcom_cfg.ini"
+#define WLAN_CFG_FILE              "wlan/cfg.dat"
+#define WLAN_FW_FILE               "wlan/qcom_fw.bin"
+#define WLAN_NV_FILE               "wlan/qcom_wlan_nv.bin"
+#define WLAN_COUNTRY_INFO_FILE     "wlan/wlan_country_info.dat"
+#define WLAN_HO_CFG_FILE           "wlan/wlan_ho_config"
+#endif // MSM_PLATFORM
+
+
+VOS_STATUS hdd_request_firmware(char *pfileName,v_VOID_t *pCtx,v_VOID_t **ppfw_data, v_SIZE_t *pSize);
+
+VOS_STATUS hdd_release_firmware(char *pFileName,v_VOID_t *pCtx);
+
+VOS_STATUS hdd_get_cfg_file_size(v_VOID_t *pCtx, char *pFileName, v_SIZE_t *pBufSize);
+
+VOS_STATUS hdd_read_cfg_file(v_VOID_t *pCtx, char *pFileName, v_VOID_t *pBuffer, v_SIZE_t *pBufSize);
+#if 0
+
+VOS_STATUS hdd_release_firmware(char *pFileName,v_VOID_t *pCtx);
+
+VOS_STATUS hdd_get_cfg_file_size(v_VOID_t *pCtx, char *pFileName, v_SIZE_t *pBufSize);
+
+VOS_STATUS hdd_read_cfg_file(v_VOID_t *pCtx, char *pFileName, v_VOID_t *pBuffer, v_SIZE_t *pBufSize);
+
+#endif
+
+tVOS_CONCURRENCY_MODE hdd_get_concurrency_mode ( void );
+
+#endif /* WLAN_HDD_MISC_H */
+
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
new file mode 100644
index 0000000..4b632d6
--- /dev/null
+++ b/CORE/VOSS/src/vos_api.c
@@ -0,0 +1,2372 @@
+/*
+ * 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  vos_api.c
+
+  \brief Stub file for all virtual Operating System Services (vOSS) APIs
+               
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  03/29/09    kanand     Created module. 
+===========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "aniGlobal.h"
+#include "halTypes.h"
+#include "wlan_qct_sal.h"
+#include "wlan_qct_bal.h"
+#endif
+#include <vos_mq.h>
+#include "vos_sched.h"
+#include <vos_api.h>
+#include "sirTypes.h"
+#include "sirApi.h"
+#include "sirMacProtDef.h"
+#include "sme_Api.h"
+#include "macInitApi.h"
+#include "wlan_qct_sys.h"
+#include "wlan_qct_tl.h"
+#include "wlan_hdd_misc.h"
+#include "i_vos_packet.h"
+#include "vos_nvitem.h"
+#include "wlan_qct_wda.h"
+#include "wlan_hdd_main.h"
+#include <linux/vmalloc.h>
+
+
+#ifdef WLAN_SOFTAP_FEATURE
+#include "sapApi.h"
+#endif
+
+
+
+#ifdef WLAN_BTAMP_FEATURE
+#include "bapApi.h"
+#include "bapInternal.h"
+#include "bap_hdd_main.h"
+#endif //WLAN_BTAMP_FEATURE
+
+
+/*---------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * ------------------------------------------------------------------------*/
+/* Amount of time to wait for WDA to perform an asynchronous activity.
+   This value should be larger than the timeout used by WDI to wait for
+   a response from WCNSS since in the event that WCNSS is not responding,
+   WDI should handle that timeout */
+#define VOS_WDA_TIMEOUT 15000
+
+/* Approximate amount of time to wait for WDA to stop WDI */
+#define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT 
+
+/*---------------------------------------------------------------------------
+ * Data definitions
+ * ------------------------------------------------------------------------*/
+static VosContextType  gVosContext;
+static pVosContextType gpVosContext;
+
+/*---------------------------------------------------------------------------
+ * Forward declaration
+ * ------------------------------------------------------------------------*/
+v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData );
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+v_VOID_t vos_sys_start_complete_cback  ( v_VOID_t *pUserData );
+#endif
+v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper);
+
+v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig, 
+    hdd_config_t * pConfig );
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+VOS_STATUS vos_get_fwbinary( v_VOID_t **ppBinary, v_SIZE_t *pNumBytes );
+#endif
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_preOpen() - PreOpen the vOSS Module  
+    
+  The \a vos_preOpen() function allocates the Vos Context, but do not      
+  initialize all the members. This overal initialization will happen
+  at vos_Open().
+  The reason why we need vos_preOpen() is to get a minimum context 
+  where to store BAL and SAL relative data, which happens before
+  vos_Open() is called.
+  
+  \param  pVosContext: A pointer to where to store the VOS Context 
+ 
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+              
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_Open()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext )
+{
+   if ( pVosContext == NULL)
+      return VOS_STATUS_E_FAILURE;
+
+   /* Allocate the VOS Context */
+   *pVosContext = NULL;
+   gpVosContext = &gVosContext;
+
+   if (NULL == gpVosContext)
+   {
+     /* Critical Error ...Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                 "%s: Failed to allocate VOS Context", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_RESOURCES;
+   }
+
+   vos_mem_zero(gpVosContext, sizeof(VosContextType));
+
+   *pVosContext = gpVosContext;
+
+   return VOS_STATUS_SUCCESS;
+
+} /* vos_preOpen()*/
+
+  
+/*---------------------------------------------------------------------------
+  
+  \brief vos_preClose() - PreClose the vOSS Module  
+    
+  The \a vos_preClose() function frees the Vos Context.
+  
+  \param  pVosContext: A pointer to where the VOS Context was stored 
+ 
+  
+  \return VOS_STATUS_SUCCESS - Always successful
+                  
+          
+  \sa vos_preClose()
+  \sa vos_close()
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext )
+{
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: De-allocating the VOS Context", __func__);
+
+   if (( pVosContext == NULL) || (*pVosContext == NULL)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: vOS Context is Null", __func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if (gpVosContext != *pVosContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Context mismatch", __func__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   *pVosContext = gpVosContext = NULL;
+
+   return VOS_STATUS_SUCCESS;
+
+} /* vos_preClose()*/
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_open() - Open the vOSS Module  
+    
+  The \a vos_open() function opens the vOSS Scheduler
+  Upon successful initialization:
+  
+     - All VOS submodules should have been initialized
+     
+     - The VOS scheduler should have opened
+     
+     - All the WLAN SW components should have been opened. This includes
+       SYS, MAC, SME, WDA and TL.
+      
+  
+  \param  hddContextSize: Size of the HDD context to allocate.
+ 
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the scheduler
+
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_preOpen()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, v_SIZE_t hddContextSize )
+
+{
+   VOS_STATUS vStatus      = VOS_STATUS_SUCCESS;
+   int iter                = 0;
+   tSirRetStatus sirStatus = eSIR_SUCCESS;
+   tMacOpenParameters macOpenParms;
+   WLANTL_ConfigInfoType TLConfig;
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: Opening VOSS", __func__);
+
+   if (NULL == gpVosContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "%s: Trying to open VOSS without a PreOpen", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Initialize the timer module */
+   vos_timer_module_init();
+
+   /* Initialize the probe event */
+   if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                    "%s: Unable to init probeEvent", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS )
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                  "%s: Unable to init wdaCompleteEvent", __func__);
+      VOS_ASSERT(0);
+    
+      goto err_probe_event;
+   }
+
+   /* Saving the HDD context */
+   /* This is saved in hdd_wlan_start_up before calling vos_open
+      gpVosContext->pHDDContext = pHddContext;*/
+ 
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+               "%s: HDD context is saved successfully", __func__);
+   
+#endif
+
+   /* Initialize the free message queue */
+   vStatus = vos_mq_init(&gpVosContext->freeVosMq);
+   if (! VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to initialize VOS free message queue", __func__);
+      VOS_ASSERT(0);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+      goto err_probe_event;
+#else
+      goto err_wda_complete_event;
+#endif
+   }
+
+   for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
+   {
+      (gpVosContext->aMsgWrappers[iter]).pVosMsg = 
+         &(gpVosContext->aMsgBuffers[iter]); 
+      INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode);
+      vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter]));
+   }
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   /* Initialize here the VOS Packet sub module */
+   vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket,
+                              sizeof( vos_pkt_context_t ) );
+
+   if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to open VOS Packet Module", __func__);
+      VOS_ASSERT(0);
+      goto err_msg_queue;
+   }
+#endif   
+
+   /* Now Open the VOS Scheduler */
+   vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched,
+                           sizeof(VosSchedContext));
+
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to open VOS Scheduler", __func__);
+      VOS_ASSERT(0);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+      goto err_packet_close;
+#else
+      goto err_msg_queue;
+#endif
+   }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /*
+   ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen
+   ** The reason that is needed becasue vos_packet_open need to use PAL APIs
+   */
+
+   /*Open the WDA module */
+   vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0);
+   /* UMA is supported in hardware for performing the
+   ** frame translation 802.11 <-> 802.3
+   */
+   macOpenParms.frameTransRequired = 1;
+   macOpenParms.driverType         = eDRIVER_TYPE_PRODUCTION;
+   vStatus = WDA_open( gpVosContext, gpVosContext->pHDDContext, &macOpenParms );
+
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to open WDA module", __func__);
+      VOS_ASSERT(0);
+      goto err_sched_close;
+   }
+
+   /* Initialize here the VOS Packet sub module */
+   vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket,
+                              sizeof( vos_pkt_context_t ) );
+
+   if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to open VOS Packet Module", __func__);
+      VOS_ASSERT(0);
+      goto err_wda_close;
+   }
+#endif
+
+   /* Open the SYS module */
+   vStatus = sysOpen(gpVosContext);
+
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      /* Critical Error ...  Cannot proceed further */
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to open SYS module", __func__);
+      VOS_ASSERT(0);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+      goto err_sched_close;
+#else
+      goto err_packet_close;
+#endif
+   }
+
+
+   /* initialize the NV module */
+   vStatus = vos_nv_open();
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     // NV module cannot be initialized
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to initialize the NV module", __func__);
+     goto err_sys_close;
+   }
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+   /* Probe the MC thread */
+   sysMcThreadProbe(gpVosContext, 
+                    &vos_sys_probe_thread_cback,
+                    gpVosContext);
+
+   if (vos_wait_single_event(&gpVosContext->ProbeEvent, 0)!= VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to probe MC Thread", __func__);
+      VOS_ASSERT(0);
+      goto err_nv_close;
+   }
+
+   /*Now probe the Tx thread */
+   sysTxThreadProbe(gpVosContext, 
+                    &vos_sys_probe_thread_cback,
+                    gpVosContext);
+   
+   if (vos_wait_single_event(&gpVosContext->ProbeEvent, 0)!= VOS_STATUS_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to probe TX Thread", __func__);
+      VOS_ASSERT(0);
+      goto err_nv_close;
+   }
+#endif
+
+   /* If we arrive here, both threads dispacthing messages correctly */
+   
+   /* Now proceed to open the MAC */
+
+   /* UMA is supported in hardware for performing the
+      frame translation 802.11 <-> 802.3 */
+   macOpenParms.frameTransRequired = 1;
+   sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext,
+                         &macOpenParms);
+   
+   if (eSIR_SUCCESS != sirStatus)
+   {
+     /* Critical Error ...  Cannot proceed further */
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to open MAC", __func__);
+     VOS_ASSERT(0);
+     goto err_nv_close;
+   }
+
+   /* Now proceed to open the SME */
+   vStatus = sme_Open(gpVosContext->pMACContext);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     /* Critical Error ...  Cannot proceed further */
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to open SME", __func__);
+     VOS_ASSERT(0);
+     goto err_mac_close;
+   }
+
+   /* Now proceed to open TL. Read TL config first */
+   vos_fetch_tl_cfg_parms ( &TLConfig, 
+       ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini);
+
+   vStatus = WLANTL_Open(gpVosContext, &TLConfig);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+     /* Critical Error ...  Cannot proceed further */
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to open TL", __func__);
+     VOS_ASSERT(0);
+     goto err_sme_close;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS successfully Opened", __func__);
+
+   *pVosContext = gpVosContext;
+
+   return VOS_STATUS_SUCCESS;
+
+
+err_sme_close:
+   sme_Close(gpVosContext->pMACContext);
+
+err_mac_close:
+   macClose(gpVosContext->pMACContext);
+
+err_nv_close:
+   vos_nv_close();
+   
+err_sys_close:   
+   sysClose(gpVosContext);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+err_packet_close:
+   vos_packet_close( gpVosContext );
+
+err_wda_close:
+   WDA_close(gpVosContext);
+#endif
+
+err_sched_close:   
+   vos_sched_close(gpVosContext);
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+err_packet_close:
+   vos_packet_close( gpVosContext );
+#endif
+
+err_msg_queue:
+   vos_mq_deinit(&gpVosContext->freeVosMq);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+err_wda_complete_event:
+   vos_event_destroy( &gpVosContext->wdaCompleteEvent );
+#endif
+
+err_probe_event:
+   vos_event_destroy(&gpVosContext->ProbeEvent);
+
+   return VOS_STATUS_E_FAILURE;
+
+} /* vos_open() */
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*---------------------------------------------------------------------------
+
+  \brief vos_preStart() -
+
+  The \a vos_preStart() function to download CFG.
+  including:
+      - ccmStart
+
+      - WDA: triggers the CFG download
+
+
+  \param  pVosContext: The VOS context
+
+
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the scheduler
+
+
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
+
+  \sa vos_start
+
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
+{
+   VOS_STATUS vStatus          = VOS_STATUS_SUCCESS;
+   pVosContextType pVosContext = (pVosContextType)vosContext;
+   
+   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+             "vos prestart");
+
+   VOS_ASSERT(gpVosContext == pVosContext);
+
+   VOS_ASSERT( NULL != pVosContext->pMACContext);
+
+   VOS_ASSERT( NULL != pVosContext->pWDAContext);
+
+   /* call macPreStart */
+   vStatus = macPreStart(gpVosContext->pMACContext);
+   if ( !VOS_IS_STATUS_SUCCESS(vStatus) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
+             "Failed at macPreStart ");
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* call ccmStart */
+   ccmStart(gpVosContext->pMACContext);
+
+   /* Reset wda wait event */
+   vos_event_reset(&gpVosContext->wdaCompleteEvent);   
+    
+
+   /*call WDA pre start*/
+   vStatus = WDA_preStart(gpVosContext);
+   if (!VOS_IS_STATUS_SUCCESS(vStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
+             "Failed to WDA prestart");
+      macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
+      ccmStop(gpVosContext->pMACContext);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Need to update time out of complete */
+   vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent,
+                                    VOS_WDA_TIMEOUT );
+   if ( vStatus != VOS_STATUS_SUCCESS )
+   {
+      if ( vStatus == VOS_STATUS_E_TIMEOUT )
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s: Timeout occurred before WDA complete\n", __func__);
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: WDA_preStart reporting other error", __func__);
+      }
+      VOS_ASSERT( 0 );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+#endif
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_start() - Start the Libra SW Modules 
+    
+  The \a vos_start() function starts all the components of the Libra SW
+  including:
+      - SAL/BAL, which in turn starts SSC
+      
+      - the MAC (HAL and PE)
+      
+      - SME
+      
+      - TL
+      
+      - SYS: triggers the CFG download
+  
+  
+  \param  pVosContext: The VOS context
+ 
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the scheduler
+
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_preStart()
+  \sa vos_open()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_start( v_CONTEXT_t vosContext )
+{
+  VOS_STATUS vStatus          = VOS_STATUS_SUCCESS;
+  tSirRetStatus sirStatus     = eSIR_SUCCESS;
+  pVosContextType pVosContext = (pVosContextType)vosContext;
+  tHalMacStartParameters halStartParams;
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  v_VOID_t *pFwBinary = NULL;
+  v_SIZE_t  numFwBytes = 0;
+#endif
+
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: Starting Libra SW", __func__);
+
+  /* We support only one instance for now ...*/
+  if (gpVosContext != pVosContext)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: mismatch in context", __FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  if (( pVosContext->pBALContext == NULL) || ( pVosContext->pMACContext == NULL)
+     || ( pVosContext->pTLContext == NULL))
+  {
+     if (pVosContext->pBALContext == NULL)
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: BAL NULL context", __FUNCTION__);
+     else if (pVosContext->pMACContext == NULL)
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: MAC NULL context", __FUNCTION__);
+     else
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: TL NULL context", __FUNCTION__);
+     
+     return VOS_STATUS_E_FAILURE;
+  }
+#else
+  if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL)
+     || ( pVosContext->pTLContext == NULL))
+  {
+     if (pVosContext->pWDAContext == NULL)
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: WDA NULL context", __FUNCTION__);
+     else if (pVosContext->pMACContext == NULL)
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: MAC NULL context", __FUNCTION__);
+     else
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+            "%s: TL NULL context", __FUNCTION__);
+     
+     return VOS_STATUS_E_FAILURE;
+  }
+
+  /* WDA_Start will be called after NV image download because the 
+    NV image data has to be updated at HAL before HAL_Start gets executed*/
+
+  /* Start the NV Image Download */
+
+  vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
+
+  vStatus = WDA_NVDownload_Start(pVosContext);
+
+  if ( vStatus != VOS_STATUS_SUCCESS )
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Failed to start NV Download", __func__);
+     return VOS_STATUS_E_FAILURE;
+  }
+
+  vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
+                                   VOS_WDA_TIMEOUT );
+
+  if ( vStatus != VOS_STATUS_SUCCESS )
+  {
+     if ( vStatus == VOS_STATUS_E_TIMEOUT )
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Timeout occurred before WDA_NVDownload_start complete", __func__);
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: WDA_NVDownload_start reporting other error", __func__);
+     }
+     VOS_ASSERT(0);
+     goto err_wda_stop;   
+  }
+
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: WDA_NVDownload_start correctly started", __func__);
+
+  /* Start the WDA */
+  vStatus = WDA_start(pVosContext);
+  if ( vStatus != VOS_STATUS_SUCCESS )
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Failed to start WDA", __func__);
+     return VOS_STATUS_E_FAILURE;
+  }
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: WDA correctly started", __func__);
+
+#endif
+  /* Start the MAC */
+  vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters));
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /* Attempt to get the firmware binary through VOS.  We need to pass this
+     to the MAC when starting. */
+  vStatus = vos_get_fwbinary(&pFwBinary, &numFwBytes);
+  
+  if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             "%s: Failed to get firmware binary", __func__);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+             "%s: Firmware binary file found", __func__);
+   
+
+  //Begining kernel 2.6.31, memory buffer returned by request_firmware API
+  //cannot be overwritten. So need to copy the firmware into a separate buffer
+  //as HAL needs to modify the endianess of FW binary.
+
+  //Kernel may not have ~40 pages of free buffers always, so
+  //Store the pointer to the buffer provided by kernel for now,
+  //When required copy it to local buffer for translation.
+  //This is done in vos_api.c, during firmware download
+  //This would provide common fix for ftm driver issue aswell, 
+  //which is not creating the copy of firmware image for endian conversion.
+  halStartParams.FW.cbImage = numFwBytes;
+  halStartParams.FW.pImage = pFwBinary;
+
+ //determine the driverType for the mode of operation
+ halStartParams.driverType = eDRIVER_TYPE_PRODUCTION;
+#endif
+  /* Start the MAC */
+  sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams);
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  hdd_release_firmware(WLAN_FW_FILE, pVosContext->pHDDContext);
+
+  halStartParams.FW.pImage = NULL;
+  halStartParams.FW.cbImage = 0;
+#endif 
+  if (eSIR_SUCCESS != sirStatus)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+              "%s: Failed to start MAC", __func__);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    return VOS_STATUS_E_FAILURE;
+#else
+    goto err_wda_stop;
+#endif
+  }
+   
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: MAC correctly started", __func__);
+
+  /* START SME */
+  vStatus = sme_Start(pVosContext->pMACContext);
+
+  if (!VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to start SME", __func__);
+    goto err_mac_stop;
+  }
+
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: SME correctly started", __func__);
+
+  /** START TL */
+  vStatus = WLANTL_Start(pVosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to start TL", __func__);
+    goto err_sme_stop;
+  }
+
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "TL correctly started");
+#ifndef FEATURE_WLAN_INTEGRATED_SOC  
+  /* START SYS. This will trigger the CFG download */
+  sysMcStart(pVosContext, vos_sys_start_complete_cback, pVosContext);
+
+  if (vos_wait_single_event(&gpVosContext->ProbeEvent, 0)!= VOS_STATUS_SUCCESS)
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Failed to start SYS module", __func__);
+     goto err_tl_stop;
+  }
+
+
+   /**
+   EVM issue is observed with 1.6Mhz freq for 1.3V RF supply in wlan standalone case.
+   During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed.
+   To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+   during exit.
+   Since using 3.2Mhz has a side effect on power (extra 200ua), this is left configurable.
+   If customers do their design right, they should not see the EVM issue and in that case they
+   can decide to keep 1.6Mhz by setting an NV.
+   If NV item is not present, use the default 3.2Mhz
+   vos_stop is also invoked if wlan startup seq fails (after vos_start, where 3.2Mhz is voted.)
+   */
+  {
+   sFreqFor1p3VSupply freq;
+   vStatus = vos_nv_read( NV_TABLE_FREQUENCY_FOR_1_3V_SUPPLY, &freq, NULL,
+         sizeof(freq) );
+   if (VOS_STATUS_SUCCESS != vStatus)
+    freq.freqFor1p3VSupply = VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_3P2MH;
+
+    if (vos_chipVoteFreqFor1p3VSupply(NULL, NULL, NULL, freq.freqFor1p3VSupply) != VOS_STATUS_SUCCESS)
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: Failed to set the freq %d for 1.3V Supply",
+                   __func__, freq.freqFor1p3VSupply );
+  }
+
+#endif
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            "%s: VOSS Start is successful!!", __func__);
+
+  return VOS_STATUS_SUCCESS;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+err_tl_stop:
+  WLANTL_Stop(pVosContext);
+#endif
+
+err_sme_stop:
+  sme_Stop(pVosContext->pMACContext, TRUE);
+    
+err_mac_stop:
+  macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET );
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+err_wda_stop:   
+  vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
+  WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL);
+  vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
+                                   VOS_WDA_TIMEOUT );
+  if( vStatus != VOS_STATUS_SUCCESS )
+  {
+     if( vStatus == VOS_STATUS_E_TIMEOUT )
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: Timeout occurred before WDA_stop complete", __func__);
+
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: WDA_stop reporting other error", __func__);
+     }
+     VOS_ASSERT( 0 );
+  }
+#endif
+
+  return VOS_STATUS_E_FAILURE;
+   
+} /* vos_start() */
+
+
+/* vos_stop function */
+VOS_STATUS vos_stop( v_CONTEXT_t vosContext )
+{
+  VOS_STATUS vosStatus;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  /* WDA_Stop is called before the SYS so that the processing of Riva 
+  pending responces will not be handled during uninitialization of WLAN driver */
+  vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
+
+  vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL );
+
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to stop WDA", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
+                                     VOS_WDA_STOP_TIMEOUT );
+   
+  if ( vosStatus != VOS_STATUS_SUCCESS )
+  {
+     if ( vosStatus == VOS_STATUS_E_TIMEOUT )
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Timeout occurred before WDA complete", __func__);
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: WDA_stop reporting other error", __func__ );
+     }
+     /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */
+     vosStatus = WDA_shutdown( vosContext, VOS_TRUE );
+     if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
+     {
+        hdd_set_ssr_required( VOS_TRUE );
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                               "%s: Failed to shutdown WDA", __func__ );
+        VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+     }
+  }
+#endif
+
+  /* SYS STOP will stop SME and MAC */
+  vosStatus = sysStop( vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to stop SYS", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = WLANTL_Stop( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to stop TL", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   /**
+   EVM issue is observed with 1.6Mhz freq for 1.3V supply in wlan standalone case.
+   During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed.
+   To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+   during exit.
+   vos_stop is also invoked if wlan startup seq fails (after vos_start, where 3.2Mhz is voted.)
+   */
+   if (vos_chipVoteFreqFor1p3VSupply(NULL, NULL, NULL, VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_1P6MH) != VOS_STATUS_SUCCESS)
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to set the freq to 1.6Mhz for 1.3V Supply", __func__ );
+#endif
+
+  return VOS_STATUS_SUCCESS;
+}
+
+
+/* vos_close function */
+VOS_STATUS vos_close( v_CONTEXT_t vosContext )
+{
+  VOS_STATUS vosStatus;
+
+#ifdef WLAN_BTAMP_FEATURE
+  vosStatus = WLANBAP_Close(vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close BAP", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif // WLAN_BTAMP_FEATURE
+
+
+  vosStatus = WLANTL_Close(vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close TL", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+   
+  vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close SME", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close MAC", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  ((pVosContextType)vosContext)->pMACContext = NULL;
+
+  vosStatus = vos_nv_close();
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close NV", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+
+  vosStatus = sysClose( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close SYS", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = WDA_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close WDA", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+  
+  /* Let DXE return packets in WDA_close and then free them here */
+  vosStatus = vos_packet_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close VOSS Packet", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = vos_packet_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close VOSS Packet", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif
+
+  vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: failed to destroy wdaCompleteEvent", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif
+
+  vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: failed to destroy ProbeEvent", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  return VOS_STATUS_SUCCESS;
+}
+                  
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_get_context() - get context data area
+  
+  Each module in the system has a context / data area that is allocated
+  and maanged by voss.  This API allows any user to get a pointer to its 
+  allocated context data area from the VOSS global context.  
+
+  \param vosContext - the VOSS Global Context.  
+  
+  \param moduleId - the module ID, who's context data are is being retrived.
+                      
+  \return - pointer to the context data area.
+  
+          - NULL if the context data is not allocated for the module ID
+            specified 
+              
+  --------------------------------------------------------------------------*/
+v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId, 
+                           v_CONTEXT_t pVosContext )
+{
+  v_PVOID_t pModContext = NULL;
+
+  if (pVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: vos context pointer is null", __FUNCTION__);
+    return NULL;
+  }
+
+  if (gpVosContext != pVosContext)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: pVosContext != gpVosContext", __FUNCTION__);
+    return NULL;
+  }
+
+  switch(moduleId)
+  {
+    case VOS_MODULE_ID_TL:  
+    {
+      pModContext = gpVosContext->pTLContext;
+      break;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_BAL:
+    {
+      pModContext = gpVosContext->pBALContext;
+      break;
+    }   
+
+    case VOS_MODULE_ID_SAL:
+    {
+      pModContext = gpVosContext->pSALContext;
+      break;
+    }   
+
+    case VOS_MODULE_ID_SSC:   
+    {
+      pModContext = gpVosContext->pSSCContext;
+      break;
+    }
+#endif
+#ifdef WLAN_BTAMP_FEATURE
+    case VOS_MODULE_ID_BAP:
+    {
+        pModContext = gpVosContext->pBAPContext;
+        break;
+    }    
+#endif //WLAN_BTAMP_FEATURE
+
+#ifdef WLAN_SOFTAP_FEATURE
+    case VOS_MODULE_ID_SAP:
+    {
+      pModContext = gpVosContext->pSAPContext;
+      break;
+    }
+
+    case VOS_MODULE_ID_HDD_SOFTAP:
+    {
+      pModContext = gpVosContext->pHDDSoftAPContext;
+      break;
+    }
+#endif
+
+    case VOS_MODULE_ID_HDD:
+    {
+      pModContext = gpVosContext->pHDDContext;
+      break;
+    }
+
+    case VOS_MODULE_ID_SME:
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_HAL:
+#endif
+    case VOS_MODULE_ID_PE:
+    {
+      /* 
+      ** In all these cases, we just return the MAC Context
+      */
+      pModContext = gpVosContext->pMACContext;
+      break;
+    }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_WDA:
+    {
+      /* For WDA module */
+      pModContext = gpVosContext->pWDAContext;
+      break;
+    }
+#endif
+
+    case VOS_MODULE_ID_VOSS:
+    {
+      /* For SYS this is VOS itself*/
+      pModContext = gpVosContext;
+      break;
+    }
+
+    default:
+    {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
+          "does not have its context maintained by VOSS", __func__, moduleId);
+      VOS_ASSERT(0);
+      return NULL;
+    }
+  }
+
+  if (pModContext == NULL )
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
+          "context is Null", __func__, moduleId);
+  }
+
+  return pModContext;
+
+} /* vos_get_context()*/
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_get_global_context() - get VOSS global Context
+  
+  This API allows any user to get the VOS Global Context pointer from a
+  module context data area.  
+  
+  \param moduleContext - the input module context pointer
+  
+  \param moduleId - the module ID who's context pointer is input in 
+         moduleContext.
+                      
+  \return - pointer to the VOSS global context
+  
+          - NULL if the function is unable to retreive the VOSS context. 
+              
+  --------------------------------------------------------------------------*/
+v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, 
+                                    v_VOID_t *moduleContext )
+{
+  if (gpVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: global voss context is NULL", __FUNCTION__);
+  }
+
+  return gpVosContext;
+
+} /* vos_get_global_context() */
+
+
+v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
+{
+  if (gpVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: global voss context is NULL", __FUNCTION__);
+    return 1;
+  }
+
+   return gpVosContext->isLogpInProgress;
+}
+
+void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
+{
+  if (gpVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: global voss context is NULL", __FUNCTION__);
+    return;
+  }
+
+   gpVosContext->isLogpInProgress = value;
+}
+
+v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
+{
+  if (gpVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: global voss context is NULL", __FUNCTION__);
+    return 0; 
+  }
+
+   return gpVosContext->isLoadUnloadInProgress;
+}
+
+void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
+{
+  if (gpVosContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: global voss context is NULL", __FUNCTION__);
+    return;
+  }
+
+   gpVosContext->isLoadUnloadInProgress = value;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_alloc_context() - allocate a context within the VOSS global Context
+  
+  This API allows any user to allocate a user context area within the 
+  VOS Global Context.  
+  
+  \param pVosContext - pointer to the global Vos context
+  
+  \param moduleId - the module ID who's context area is being allocated.
+  
+  \param ppModuleContext - pointer to location where the pointer to the 
+                           allocated context is returned.  Note this 
+                           output pointer is valid only if the API
+                           returns VOS_STATUS_SUCCESS
+  
+  \param size - the size of the context area to be allocated.
+                      
+  \return - VOS_STATUS_SUCCESS - the context for the module ID has been 
+            allocated successfully.  The pointer to the context area
+            can be found in *ppModuleContext.  
+            \note This function returns VOS_STATUS_SUCCESS if the 
+            module context was already allocated and the size 
+            allocated matches the size on this call.
+
+            VOS_STATUS_E_INVAL - the moduleId is not a valid or does 
+            not identify a module that can have a context allocated.
+
+            VOS_STATUS_E_EXISTS - vos could allocate the requested context 
+            because a context for this module ID already exists and it is
+            a *different* size that specified on this call.
+            
+            VOS_STATUS_E_NOMEM - vos could not allocate memory for the 
+            requested context area.  
+              
+  \sa vos_get_context(), vos_free_context()
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, 
+                              v_VOID_t **ppModuleContext, v_SIZE_t size )
+{
+  v_VOID_t ** pGpModContext = NULL;
+
+  if ( pVosContext == NULL) {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: vos context is null", __FUNCTION__);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: context mismatch or null param passed", __FUNCTION__);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  switch(moduleID)
+  {
+    case VOS_MODULE_ID_TL:  
+    {
+      pGpModContext = &(gpVosContext->pTLContext); 
+      break;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_BAL:
+    {
+      pGpModContext = &(gpVosContext->pBALContext);
+      break;
+    }
+
+    case VOS_MODULE_ID_SAL:
+    {
+      pGpModContext = &(gpVosContext->pSALContext);
+      break;
+    }   
+
+    case VOS_MODULE_ID_SSC:
+    {
+      pGpModContext = &(gpVosContext->pSSCContext); 
+      break;
+    }
+#endif
+#ifdef WLAN_BTAMP_FEATURE
+    case VOS_MODULE_ID_BAP:
+    {
+        pGpModContext = &(gpVosContext->pBAPContext);
+        break;
+    }    
+#endif //WLAN_BTAMP_FEATURE
+
+#ifdef WLAN_SOFTAP_FEATURE
+    case VOS_MODULE_ID_SAP:
+    {
+      pGpModContext = &(gpVosContext->pSAPContext);
+      break;
+    }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_WDA:
+    {
+      pGpModContext = &(gpVosContext->pWDAContext);
+      break;
+    }
+#endif
+    case VOS_MODULE_ID_SME:
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_HAL:
+#endif
+    case VOS_MODULE_ID_PE:
+    case VOS_MODULE_ID_HDD:
+#ifdef WLAN_SOFTAP_FEATURE
+    case VOS_MODULE_ID_HDD_SOFTAP:
+#endif
+    default:
+    {     
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
+          "does not have its context allocated by VOSS", __func__, moduleID);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+    }
+  }
+
+  if ( NULL != *pGpModContext)
+  {
+    /*
+    ** Context has already been allocated!
+    ** Prevent double allocation
+    */
+    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Module ID %i context has already been allocated",
+                __func__, moduleID);
+    return VOS_STATUS_E_EXISTS;
+  }
+  
+  /*
+  ** Dynamically allocate the context for module
+  */
+  
+  *ppModuleContext = kmalloc(size, GFP_KERNEL);
+
+  
+  if ( *ppModuleContext == NULL)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to "
+        "allocate Context for module ID %i", __func__, moduleID);
+    VOS_ASSERT(0);
+    return VOS_STATUS_E_NOMEM;
+  }
+  
+  if (moduleID==VOS_MODULE_ID_TL)
+  {
+     vos_mem_zero(*ppModuleContext, size);
+  }
+
+  *pGpModContext = *ppModuleContext;
+
+  return VOS_STATUS_SUCCESS;
+
+} /* vos_alloc_context() */
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_free_context() - free an allocated a context within the 
+                               VOSS global Context
+  
+  This API allows a user to free the user context area within the 
+  VOS Global Context.  
+  
+  \param pVosContext - pointer to the global Vos context
+  
+  \param moduleId - the module ID who's context area is being free
+  
+  \param pModuleContext - pointer to module context area to be free'd.
+                      
+  \return - VOS_STATUS_SUCCESS - the context for the module ID has been 
+            free'd.  The pointer to the context area is not longer 
+            available.
+            
+            VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not 
+            valid pointers.
+                                 
+            VOS_STATUS_E_INVAL - the moduleId is not a valid or does 
+            not identify a module that can have a context free'd.
+            
+            VOS_STATUS_E_EXISTS - vos could not free the requested 
+            context area because a context for this module ID does not
+            exist in the global vos context.
+              
+  \sa vos_get_context()              
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
+                             v_VOID_t *pModuleContext )
+{
+  v_VOID_t ** pGpModContext = NULL;
+
+  if (( pVosContext == NULL) || ( gpVosContext != pVosContext) ||
+      ( pModuleContext == NULL))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Null params or context mismatch", __func__);
+    return VOS_STATUS_E_FAILURE;
+  }
+  
+
+  switch(moduleID)
+  {
+    case VOS_MODULE_ID_TL:  
+    {
+      pGpModContext = &(gpVosContext->pTLContext); 
+      break;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_BAL:
+    {
+      pGpModContext = &(gpVosContext->pBALContext);
+      break;
+    }   
+
+    case VOS_MODULE_ID_SAL:
+    {
+      pGpModContext = &(gpVosContext->pSALContext);
+      break;
+    }   
+
+    case VOS_MODULE_ID_SSC:
+    {
+      pGpModContext = &(gpVosContext->pSSCContext); 
+      break;
+    }
+#endif
+#ifdef WLAN_BTAMP_FEATURE
+    case VOS_MODULE_ID_BAP:
+    {
+        pGpModContext = &(gpVosContext->pBAPContext);
+        break;
+    }
+#endif //WLAN_BTAMP_FEATURE
+ 
+#ifdef WLAN_SOFTAP_FEATURE
+    case VOS_MODULE_ID_SAP:
+    {
+      pGpModContext = &(gpVosContext->pSAPContext); 
+      break;
+    }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_WDA:
+    {
+      pGpModContext = &(gpVosContext->pWDAContext);
+      break;
+    }
+#endif
+    case VOS_MODULE_ID_HDD:
+    case VOS_MODULE_ID_SME:
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    case VOS_MODULE_ID_HAL:
+#endif
+    case VOS_MODULE_ID_PE:
+#ifdef WLAN_SOFTAP_FEATURE
+    case VOS_MODULE_ID_HDD_SOFTAP:
+#endif
+    default:
+    {     
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
+          "does not have its context allocated by VOSS", __func__, moduleID);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+    }
+  }
+
+  if ( NULL == *pGpModContext)
+  {
+    /*
+    ** Context has not been allocated or freed already!
+    */
+    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
+        "context has not been allocated or freed already", __func__,moduleID);
+    return VOS_STATUS_E_FAILURE;
+  }
+  
+  if (*pGpModContext != pModuleContext)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+        "%s: pGpModContext != pModuleContext", __FUNCTION__);
+    return VOS_STATUS_E_FAILURE;
+  } 
+  
+  if(pModuleContext != NULL)
+      kfree(pModuleContext);
+
+  *pGpModContext = NULL;
+
+  return VOS_STATUS_SUCCESS;
+
+} /* vos_free_context() */
+                                                 
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_mq_post_message() - post a message to a message queue
+
+  This API allows messages to be posted to a specific message queue.  Messages
+  can be posted to the following message queues:
+  
+  <ul>
+    <li> SME
+    <li> PE
+    <li> HAL
+    <li> TL
+  </ul> 
+  
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+         
+  \param message - a pointer to a message buffer.  Memory for this message 
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is posted to the message queue.  If the consumer of the 
+         message needs anything in this message, it needs to copy the contents
+         before returning from the message queue handler.
+  
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+          
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not 
+          refer to a valid Message Queue Id.
+          
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.     
+          
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
+{
+  pVosMqType      pTargetMq   = NULL;
+  pVosMsgWrapper  pMsgWrapper = NULL;
+
+  if ((gpVosContext == NULL) || (pMsg == NULL))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Null params or global vos context is null", __func__);
+    VOS_ASSERT(0);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  switch (msgQueueId)
+  {
+    /// Message Queue ID for messages bound for SME
+    case  VOS_MQ_ID_SME: 
+    {
+       pTargetMq = &(gpVosContext->vosSched.smeMcMq);
+       break;
+    }
+
+    /// Message Queue ID for messages bound for PE
+    case VOS_MQ_ID_PE:  
+    {
+       pTargetMq = &(gpVosContext->vosSched.peMcMq);
+       break;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /// Message Queue ID for messages bound for HAL
+    case VOS_MQ_ID_HAL: 
+    {
+       pTargetMq = &(gpVosContext->vosSched.halMcMq);
+       break;
+    }
+#else
+    /// Message Queue ID for messages bound for WDA
+    case VOS_MQ_ID_WDA: 
+    {
+       pTargetMq = &(gpVosContext->vosSched.wdaMcMq);
+       break;
+    }
+
+    /// Message Queue ID for messages bound for WDI
+    case VOS_MQ_ID_WDI:
+    {
+       pTargetMq = &(gpVosContext->vosSched.wdiMcMq);
+       break;
+    }
+#endif
+
+    /// Message Queue ID for messages bound for TL
+    case VOS_MQ_ID_TL: 
+    {
+       pTargetMq = &(gpVosContext->vosSched.tlMcMq);
+       break;
+    }
+
+    /// Message Queue ID for messages bound for the SYS module
+    case VOS_MQ_ID_SYS:
+    {
+       pTargetMq = &(gpVosContext->vosSched.sysMcMq);
+       break;
+    }
+
+    default:
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              ("%s: Trying to queue msg into unknown MC Msg queue ID %d"),
+              __func__, msgQueueId);
+
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  VOS_ASSERT(NULL !=pTargetMq);
+  if (pTargetMq == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: pTargetMq == NULL", __FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  } 
+
+  /*
+  ** Try and get a free Msg wrapper
+  */
+  pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
+
+  if (NULL == pMsgWrapper)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: VOS Core run out of message wrapper", __func__);
+
+    return VOS_STATUS_E_RESOURCES;
+  }
+  
+  /*
+  ** Copy the message now
+  */
+  vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, 
+                (v_VOID_t*)pMsg, sizeof(vos_msg_t));
+
+  vos_mq_put(pTargetMq, pMsgWrapper);
+
+  set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag);
+  wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue);
+
+  return VOS_STATUS_SUCCESS;
+
+} /* vos_mq_post_message()*/
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
+
+  This API allows messages to be posted to a specific message queue in the 
+  Tx excution flow.  Messages for the Tx execution flow can be posted only 
+  to the following queue.
+  
+  <ul>
+    <li> TL
+    <li> SSC/WDI
+  </ul>
+  
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+         
+  \param message - a pointer to a message buffer.  Body memory for this message 
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is dispacthed to the appropriate component.  If the consumer 
+         of the message needs to keep anything in the body, it needs to copy 
+         the contents before returning from the message handler.
+  
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+          
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not 
+          refer to a valid Message Queue Id.
+          
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.     
+          
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
+{
+  pVosMqType      pTargetMq   = NULL;
+  pVosMsgWrapper  pMsgWrapper = NULL;
+
+  if ((gpVosContext == NULL) || (pMsg == NULL))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Null params or global vos context is null", __func__);
+    VOS_ASSERT(0);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  switch (msgQueueId)
+  {
+    /// Message Queue ID for messages bound for SME
+    case  VOS_MQ_ID_TL: 
+    {
+       pTargetMq = &(gpVosContext->vosSched.tlTxMq);
+       break;
+    }
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+    /// Message Queue ID for messages bound for SSC
+    case VOS_MQ_ID_SSC:  
+    {
+       pTargetMq = &(gpVosContext->vosSched.sscTxMq);
+       break;
+    }
+#else
+    /// Message Queue ID for messages bound for SSC
+    case VOS_MQ_ID_WDI:  
+    {
+       pTargetMq = &(gpVosContext->vosSched.wdiTxMq);
+       break;
+    }
+#endif 
+    
+    /// Message Queue ID for messages bound for the SYS module
+    case VOS_MQ_ID_SYS:
+    {
+       pTargetMq = &(gpVosContext->vosSched.sysTxMq);
+       break;
+    }
+
+    default:
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "Trying to queue msg into unknown Tx Msg queue ID %d",
+               __func__, msgQueueId);
+
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  if (pTargetMq == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: pTargetMq == NULL", __FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  } 
+    
+
+  /*
+  ** Try and get a free Msg wrapper
+  */
+  pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
+
+  if (NULL == pMsgWrapper)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+              "%s: VOS Core run out of message wrapper", __func__);
+
+    return VOS_STATUS_E_RESOURCES;
+  }
+
+  /*
+  ** Copy the message now
+  */
+  vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, 
+                (v_VOID_t*)pMsg, sizeof(vos_msg_t));
+
+  vos_mq_put(pTargetMq, pMsgWrapper);
+
+  set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag);
+  wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue);
+
+  return VOS_STATUS_SUCCESS;
+
+} /* vos_tx_mq_serialize()*/
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**---------------------------------------------------------------------------
+
+  \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow
+
+  This API allows messages to be posted to a specific message queue in the
+  Tx excution flow.  Messages for the Rx execution flow can be posted only
+  to the following queue.
+
+  <ul>
+    <li> TL
+    <li> WDI
+  </ul>
+
+  \param msgQueueId - identifies the message queue upon which the message
+         will be posted.
+
+  \param message - a pointer to a message buffer.  Body memory for this message
+         buffer is allocated by the caller and free'd by the vOSS after the
+         message is dispacthed to the appropriate component.  If the consumer
+         of the message needs to keep anything in the body, it needs to copy
+         the contents before returning from the message handler.
+
+  \return VOS_STATUS_SUCCESS - the message has been successfully posted
+          to the message queue.
+
+          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
+          refer to a valid Message Queue Id.
+
+          VOS_STATUS_E_FAULT  - message is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - the message queue handler has reported
+          an unknown failure.
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
+{
+  pVosMqType      pTargetMq   = NULL;
+  pVosMsgWrapper  pMsgWrapper = NULL;
+  if ((gpVosContext == NULL) || (pMsg == NULL))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Null params or global vos context is null", __func__);
+    VOS_ASSERT(0);
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  switch (msgQueueId)
+  {
+
+    case VOS_MQ_ID_SYS:
+    {
+       pTargetMq = &(gpVosContext->vosSched.sysRxMq);
+       break;
+    }
+
+    /// Message Queue ID for messages bound for WDI
+    case VOS_MQ_ID_WDI:
+    {
+       pTargetMq = &(gpVosContext->vosSched.wdiRxMq);
+       break;
+    }
+
+    default:
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "Trying to queue msg into unknown Rx Msg queue ID %d",
+               __func__, msgQueueId);
+
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  if (pTargetMq == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: pTargetMq == NULL", __FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  }
+
+
+  /*
+  ** Try and get a free Msg wrapper
+  */
+  pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
+
+  if (NULL == pMsgWrapper)
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: VOS Core run out of message wrapper", __func__);
+
+    return VOS_STATUS_E_RESOURCES;
+  }
+
+  /*
+  ** Copy the message now
+  */
+  vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
+                (v_VOID_t*)pMsg, sizeof(vos_msg_t));
+
+  vos_mq_put(pTargetMq, pMsgWrapper);
+
+  set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag);
+  wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue);
+
+  return VOS_STATUS_SUCCESS;
+
+} /* vos_rx_mq_serialize()*/
+
+#endif
+v_VOID_t 
+vos_sys_probe_thread_cback 
+( 
+  v_VOID_t *pUserData 
+)
+{
+  if (gpVosContext != pUserData)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: gpVosContext != pUserData", __FUNCTION__);
+     return;
+  } 
+
+  if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: vos_event_set failed", __FUNCTION__);
+     return;
+  }
+
+} /* vos_sys_probe_thread_cback() */
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+v_VOID_t vos_sys_start_complete_cback
+( 
+  v_VOID_t *pUserData
+)
+{
+
+  if (gpVosContext != pUserData)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: gpVosContext != pUserData", __FUNCTION__);
+     return;
+  } 
+
+  if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: vos_event_set failed", __FUNCTION__);
+     return;
+  }
+
+} /* vos_sys_start_complete_cback() */
+#else
+v_VOID_t vos_WDAComplete_cback
+(
+  v_VOID_t *pUserData
+)
+{
+
+  if (gpVosContext != pUserData)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: gpVosContext != pUserData", __FUNCTION__);
+     return;
+  }
+
+  if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: vos_event_set failed", __FUNCTION__);
+     return;
+  }
+
+} /* vos_WDAComplete_cback() */
+#endif
+
+v_VOID_t vos_core_return_msg
+(
+  v_PVOID_t      pVContext, 
+  pVosMsgWrapper pMsgWrapper
+)
+{
+  pVosContextType pVosContext = (pVosContextType) pVContext;
+  
+  VOS_ASSERT( gpVosContext == pVosContext);
+
+  if (gpVosContext != pVosContext)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: gpVosContext != pVosContext", __FUNCTION__);
+     return;
+  } 
+
+  VOS_ASSERT( NULL !=pMsgWrapper );
+
+  if (pMsgWrapper == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: pMsgWrapper == NULL in function", __FUNCTION__);
+     return;
+  } 
+  
+  /*
+  ** Return the message on the free message queue
+  */
+  INIT_LIST_HEAD(&pMsgWrapper->msgNode);
+  vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper);
+
+} /* vos_core_return_msg() */
+
+
+/**
+  @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the
+  TL config params from the registry
+   
+  @param pAdapter : [inout] pointer to TL config block
+
+  @return 
+  None
+
+*/
+v_VOID_t 
+vos_fetch_tl_cfg_parms 
+( 
+  WLANTL_ConfigInfoType *pTLConfig,
+  hdd_config_t * pConfig
+)
+{
+  if (pTLConfig == NULL)
+  {
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s NULL ptr passed in!", __FUNCTION__);
+   return;
+  }
+
+  pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight;
+  pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight;
+  pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight;
+  pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight;
+  pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt;
+#ifdef WLAN_SOFTAP_FEATURE
+  pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres;
+#endif
+
+}
+
+v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx)
+{
+  return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx);
+}
+
+void vos_abort_mac_scan(void)
+{
+    hdd_context_t *pHddCtx = NULL;
+    v_CONTEXT_t pVosContext        = NULL;
+
+    /* Get the Global VOSS Context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+    if(!pVosContext) {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
+       return;
+    }
+    
+    /* Get the HDD context */
+    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+    if(!pHddCtx) {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
+       return;
+    }
+
+    hdd_abort_mac_scan(pHddCtx);
+    return;
+}
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_shutdown() - shutdown VOS
+
+     - All VOS submodules are closed.
+
+     - All the WLAN SW components should have been opened. This includes
+       SYS, MAC, SME and TL.
+
+
+  \param  vosContext: Global vos context
+
+
+  \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown
+
+          VOS_STATUS_E_FAILURE - Failure to close
+
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext)
+{
+  VOS_STATUS vosStatus;
+
+#ifdef WLAN_BTAMP_FEATURE
+  vosStatus = WLANBAP_Close(vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close BAP", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+#endif // WLAN_BTAMP_FEATURE
+
+  vosStatus = WLANTL_Close(vosContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close TL", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close SME", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close MAC", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  ((pVosContextType)vosContext)->pMACContext = NULL;
+
+  vosStatus = vos_nv_close();
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close NV", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = sysClose( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close SYS", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+ /* Let DXE return packets in WDA_close and then free them here */
+  vosStatus = vos_packet_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close VOSS Packet", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
+
+  vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: failed to destroy wdaCompleteEvent", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: failed to destroy ProbeEvent", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+
+  return VOS_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_wda_shutdown() - VOS interface to wda shutdown
+
+     - WDA/WDI shutdown
+
+  \param  vosContext: Global vos context
+
+
+  \return VOS_STATUS_SUCCESS - Operation successfull
+
+          VOS_STATUS_E_FAILURE - Failure to close
+
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext)
+{
+  VOS_STATUS vosStatus;
+  vosStatus = WDA_shutdown(vosContext, VOS_FALSE);
+
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: failed to shutdown WDA", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+  }
+  return vosStatus;
+}
+/**
+  @brief vos_wlanShutdown() - This API will shutdown WLAN driver
+
+  This function is called when Riva subsystem crashes.  There are two
+  methods (or operations) in WLAN driver to handle Riva crash,
+    1. shutdown: Called when Riva goes down, this will shutdown WLAN
+                 driver without handshaking with Riva.
+    2. re-init:  Next API
+  @param
+       NONE
+  @return
+       VOS_STATUS_SUCCESS   - Operation completed successfully.
+       VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_wlanShutdown(void)
+{
+   VOS_STATUS vstatus;
+   vstatus = vos_watchdog_wlan_shutdown();
+   return vstatus;
+}
+/**
+  @brief vos_wlanReInit() - This API will re-init WLAN driver
+
+  This function is called when Riva subsystem reboots.  There are two
+  methods (or operations) in WLAN driver to handle Riva crash,
+    1. shutdown: Previous API
+    2. re-init:  Called when Riva comes back after the crash. This will
+                 re-initialize WLAN driver. In some cases re-open may be
+                 referred instead of re-init.
+  @param
+       NONE
+  @return
+       VOS_STATUS_SUCCESS   - Operation completed successfully.
+       VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_wlanReInit(void)
+{
+   VOS_STATUS vstatus;
+   vstatus = vos_watchdog_wlan_re_init();
+   return vstatus;
+}
diff --git a/CORE/VOSS/src/vos_diag.c b/CORE/VOSS/src/vos_diag.c
new file mode 100644
index 0000000..3cd2bfb
--- /dev/null
+++ b/CORE/VOSS/src/vos_diag.c
@@ -0,0 +1,249 @@
+/*
+ * 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:         vos_diag.c
+
+  OVERVIEW:     This source file contains definitions for vOS diag APIs
+
+  DEPENDENCIES: 
+ 
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
+============================================================================*/
+
+#include "vos_types.h"
+#include "i_vos_diag_core_log.h"
+#include "i_vos_diag_core_event.h"
+#include "wlan_hdd_main.h"
+#include "wlan_nlink_common.h"
+#include "vos_sched.h"
+#include "wlan_ptt_sock_svc.h"
+
+
+#define PTT_MSG_DIAG_CMDS_TYPE   0x5050
+
+#define DIAG_TYPE_LOGS   1 
+#define DIAG_TYPE_EVENTS 2
+
+#define DIAG_SWAP16(A) ((((tANI_U16)(A) & 0xff00) >> 8) | (((tANI_U16)(A) & 0x00ff) << 8))
+
+
+
+typedef struct event_report_s
+{
+    v_U32_t diag_type;
+    v_U16_t event_id;
+    v_U16_t length;
+} event_report_t;
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_log_set_code() - 
+
+   This function sets the logging code in the given log record. 
+
+  \param  - ptr - Pointer to the log header type.
+              - code - log code.
+  \return - None
+  
+  --------------------------------------------------------------------------*/
+
+void vos_log_set_code (v_VOID_t *ptr, v_U16_t code)
+{
+    if (ptr)
+    {
+        /* All log packets are required to start with 'log_header_type'. */
+        ((log_hdr_type *) ptr)->code = code;
+    }
+
+} 
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_log_set_length() - 
+
+   This function sets the length field in the given log record.
+
+  \param  - ptr - Pointer to the log header type.
+              - length - log length.
+              
+  \return - None
+  
+  --------------------------------------------------------------------------*/
+
+void vos_log_set_length (v_VOID_t *ptr, v_U16_t length)
+{
+    if(ptr)
+    {
+        /* All log packets are required to start with 'log_header_type'. */
+        ((log_hdr_type *) ptr)->len = (v_U16_t) length;
+    }
+} 
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_log_submit() - 
+
+   This function sends the log data to the ptt socket app only if it is registered with the driver.
+
+  \param  - ptr - Pointer to the log header type.
+              
+  \return - None
+  
+  --------------------------------------------------------------------------*/
+
+void vos_log_submit(v_VOID_t *plog_hdr_ptr)
+{
+
+    log_hdr_type *pHdr = (log_hdr_type*) plog_hdr_ptr;
+
+    tAniHdr *wmsg = NULL;
+    v_U8_t *pBuf;
+    hdd_adapter_t *pAdapter;
+    v_CONTEXT_t pVosContext= NULL;
+    v_U16_t data_len;
+    v_U16_t total_len;
+
+
+     /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+     /*Get the Hdd Context */
+    pAdapter = ((VosContextType*)(pVosContext))->pHDDContext;
+
+   /* Send the log data to the ptt app only if it is registered with the wlan driver*/
+    if(pAdapter->ptt_pid) 
+    {
+        data_len = pHdr->len;
+    
+        total_len = sizeof(tAniHdr)+sizeof(v_U32_t)+data_len;
+    
+        pBuf =  (v_U8_t*)vos_mem_malloc(total_len);
+    
+        if(!pBuf)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed\n");
+            return;
+        }
+        
+        vos_mem_zero((v_VOID_t*)pBuf,total_len);
+    
+        wmsg = (tAniHdr*)pBuf;
+        wmsg->type = PTT_MSG_DIAG_CMDS_TYPE;
+        wmsg->length = total_len;
+        wmsg->length = DIAG_SWAP16(wmsg->length);
+        pBuf += sizeof(tAniHdr);
+    
+    
+            /*  Diag Type events or log */
+        *(v_U32_t*)pBuf = DIAG_TYPE_LOGS;
+        pBuf += sizeof(v_U32_t);
+    
+    
+        memcpy(pBuf, pHdr,data_len);
+    
+        if(pAdapter->ptt_pid) 
+        {
+            if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pAdapter->ptt_pid) < 0) {
+        
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n"));
+                return;
+            }
+       
+        }
+        vos_mem_free((v_VOID_t*)wmsg);
+    }
+    return;
+}
+
+/**---------------------------------------------------------------------------
+  
+  \brief vos_event_report_payload() - 
+
+   This function sends the event data to the ptt socket app only if it is registered with the driver.
+
+  \param  - ptr - Pointer to the log header type.
+              
+  \return - None
+  
+  --------------------------------------------------------------------------*/
+
+void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPayload)
+{ 
+
+
+    tAniHdr *wmsg = NULL;
+    v_U8_t *pBuf;
+    hdd_adapter_t *pAdapter;
+    v_CONTEXT_t pVosContext= NULL;
+    event_report_t *pEvent_report;
+    v_U16_t total_len;
+
+     /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+
+     /*Get the Hdd Context */
+    pAdapter = ((VosContextType*)(pVosContext))->pHDDContext;
+
+    
+    /* Send the log data to the ptt app only if it is registered with the wlan driver*/
+    if(pAdapter->ptt_pid) 
+    {
+        total_len = sizeof(tAniHdr)+sizeof(event_report_t)+length;
+        
+        pBuf =  (v_U8_t*)vos_mem_malloc(total_len);
+    
+        if(!pBuf)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed\n");
+            return;
+        }
+        wmsg = (tAniHdr*)pBuf;
+        wmsg->type = PTT_MSG_DIAG_CMDS_TYPE;
+        wmsg->length = total_len;
+        wmsg->length = DIAG_SWAP16(wmsg->length);
+        pBuf += sizeof(tAniHdr);
+    
+        pEvent_report = (event_report_t*)pBuf;
+        pEvent_report->diag_type = DIAG_TYPE_EVENTS;
+        pEvent_report->event_id = event_Id;
+        pEvent_report->length = length;
+    
+        pBuf += sizeof(event_report_t); 
+    
+        memcpy(pBuf, pPayload,length);
+      
+        if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pAdapter->ptt_pid) < 0) {
+    
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n"));
+            return;
+        }
+    
+        vos_mem_free((v_VOID_t*)wmsg);
+    }
+  
+    return;
+    
+}
diff --git a/CORE/VOSS/src/vos_event.c b/CORE/VOSS/src/vos_event.c
new file mode 100644
index 0000000..cb8296d
--- /dev/null
+++ b/CORE/VOSS/src/vos_event.c
@@ -0,0 +1,501 @@
+/*
+ * 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:         vos_event.c
+
+  OVERVIEW:     This source file contains definitions for vOS event APIs
+                The five APIs mentioned in this file are used for
+                initializing, setting, resetting, destroying an event and
+                waiting on an occurance of an event among multiple events.
+
+  DEPENDENCIES:
+
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
+============================================================================*/
+
+/*============================================================================
+  EDIT HISTORY FOR MODULE
+
+============================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_event.h"
+#include "vos_trace.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+   Function Definitions and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------
+
+  \brief vos_event_init() - initializes a vOSS event
+
+  The vos_event_init() function initializes the specified event. Upon
+  successful initialization, the state of the event becomes initialized
+  and not signaled.
+
+  An event must be initialized before it may be used in any other event
+  functions.
+
+  Attempting to initialize an already initialized event results in
+  a failure.
+
+  \param lock - pointer to the opaque event object to initialize
+
+  \return VOS_STATUS_SUCCESS - event was successfully initialized and
+          is ready to be used.
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt
+          to reinitialize the object referenced by event, a previously
+          initialized, but not yet destroyed, event.
+
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - event could not be created due to
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the event
+
+       ***VOS_STATUS_E_NOMEM - insufficient memory exists to initialize
+          the event
+
+  \sa
+
+  ( *** indicates return values do NOT exist yet )
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_init ( vos_event_t* event )
+{
+
+   // Check for null pointer
+   if ( NULL == event )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "NULL event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check for 'already initialized' event
+   if ( LINUX_EVENT_COOKIE == event->cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Initialized event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_BUSY;
+   }
+
+   // initialize new event
+   init_completion(&event->complete);
+   event->cookie = LINUX_EVENT_COOKIE;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_event_set() - sets a vOSS event
+
+  The state of the specified event is set to 'signalled by calling
+  \a vos_event_set().
+
+  Any threads waiting on the event as a result of a vos_event_wait() will
+  be unblocked and available to be scheduled for execution when the event
+  is signaled by a call to \a vos_event_set().
+
+  \param event - the event to set to the signalled state
+
+  \return VOS_STATUS_SUCCESS - the event was successfully signalled.
+
+          VOS_STATUS_E_INVAL - The value specified by event does not refer
+          to an initialized event object.
+
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - event could not be signaled due to
+          unknown reasons
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+
+VOS_STATUS vos_event_set ( vos_event_t* event )
+{
+
+   // Check for null pointer
+   if ( NULL == event )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "NULL event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check if event refers to an initialized object
+   if ( LINUX_EVENT_COOKIE != event->cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Uninitialized event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   complete(&event->complete);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_event_reset() - resets a vOSS event - This function isn't required
+   for Linux. Therefore, it doesn't do much.
+
+  The state of the specified event is set to 'NOT signalled' by calling
+  \a vos_event_reset().  The state of the event remains NOT signalled until an
+  explicit call to vos_event_set().
+
+  This function sets the event to a NOT signalled state even if the event was
+  signalled multiple times before being signaled.
+
+  \param event - the event to set to the NOT signalled state
+
+  \return VOS_STATUS_SUCCESS - the event state was successfully change to
+          NOT signalled.
+
+          VOS_STATUS_E_INVAL - The value specified by event does not refer
+          to an initialized event object.
+
+          VOS_STATUS_E_FAULT  - event is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - event could not be signaled due to
+          unknown reasons
+
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_event_reset ( vos_event_t* event )
+{
+
+   // check for null pointer
+   if ( NULL == event )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "NULL event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check to make sure it is an 'already initialized' event
+   if ( LINUX_EVENT_COOKIE != event->cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Uninitialized event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // (re)initialize event
+   INIT_COMPLETION(event->complete);
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_wait_events() - Waits for the first event(s) to be set.
+
+   This API waits for any event in the input array of events to be
+   set.  The caller is blocked waiting any event in the array to be
+   set or for the timeout to occur.
+
+   If multiple events in the array are set, only one event is identified
+   in the return from this call as satisfying the wait condition.  The
+   caller is responsible for calling \a vos_wait_events() again to find
+   the other events that are set.
+
+  \param events - pointer to an array of events to wait on.
+
+  \param numEvents - Number of events in the events array to wait on.
+
+  \param timeout - Timeout value (in milliseconds).  This function returns
+         if this interval elapses, regardless if any of the events have
+         been set.  An input value of 0 for this timeout parameter means
+         to wait infinitely, meaning a timeout will never occur.
+
+  \param pEventIndex - This is a pointer to the location where the index of
+         the event in the event array that satisfied the wait because
+         the event was set.
+
+  \return VOS_STATUS_SUCCESS - the wait was satisifed by one of the events
+          in the event array being set.  The index into the event arry
+          that satisfied the wait can be found at *pEventIndex.
+
+          VOS_STATUS_E_TIMEOUT - the timeout interval elapsed before any of
+          the events were set.
+
+          VOS_STATUS_E_INVAL - At least one of the values specified in the
+          event array refers to an uninitialized event object.
+
+          VOS_STATUS_E_ABORTED - The event due to which the wait was aborted
+          is identified by the index in *pEventIndex.
+
+          VOS_STATUS_E_EMPTY - the events array is empty.  This condition
+          is detected by numEvents being 0 on input.
+
+          VOS_STATUS_E_FAULT - event or pEventIndex is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to
+          unknown reasons
+
+  \sa
+   --------------------------------------------------------------------------*/
+VOS_STATUS vos_wait_events ( vos_event_t* events,
+                             v_U8_t numEvents, v_U32_t timeout,
+                             v_U8_t *pEventIndex )
+{
+
+   return vos_wait_single_event(events,timeout);
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_event_destroy() - Destroys a vOSS event - This function doesn't do
+   much in Linux. There is no need for the caller to explicitly destroy an event
+   after use.
+
+  The os_event_destroy() function shall destroy the event object
+  referenced by event.  After a successful return from \a vos_event_destroy()
+  the event object becomes, in effect, uninitialized.
+
+  A destroyed event object can be reinitialized using vos_event_init();
+  the results of otherwise referencing the object after it has been destroyed
+  are undefined.  Calls to vOSS event functions to manipulate the lock such
+  as vos_event_set() will fail if the event is destroyed.  Therefore,
+  don't use the event after it has been destroyed until it has
+  been re-initialized.
+
+  \param event - the event object to be destroyed.
+
+  \return VOS_STATUS_SUCCESS - event was successfully destroyed.
+
+          VOS_STATUS_E_INVAL - The value specified by event is invalid.
+
+          VOS_STATUS_E_FAULT - event is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - event could not be signaled due to
+          unknown reasons
+
+       ***VOS_STATUS_E_BUSY - The implementation has detected an attempt
+          to destroy the object referenced by event while it is still being
+          referenced (there are threads waiting on this event)
+  \sa
+
+   ( *** indicates return values do NOT exist yet )
+  -------------------------------------------------------------------------*/
+
+VOS_STATUS vos_event_destroy ( vos_event_t* event )
+{
+   // check for null pointer
+   if ( NULL == event )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "NULL event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check to make sure it is an 'already initialized' event
+   if ( LINUX_EVENT_COOKIE != event->cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Uninitialized event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // make sure nobody is waiting on the event
+   complete_all(&event->complete);
+
+   // destroy the event
+   memset(event, 0, sizeof(vos_event_t));
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_wait_single_event() - Waits for a single event to be set.
+
+   This API waits for the event to be set.
+
+  \param pEvent - pointer to an event to wait on.
+
+  \param timeout - Timeout value (in milliseconds).  This function returns
+         if this interval elapses, regardless if any of the events have
+         been set.  An input value of 0 for this timeout parameter means
+         to wait infinitely, meaning a timeout will never occur.
+
+  \return VOS_STATUS_SUCCESS - the wait was satisifed by the event being
+          set.
+
+          VOS_STATUS_E_TIMEOUT - the timeout interval elapsed before the
+          event was set.
+
+          VOS_STATUS_E_INVAL - The value specified by event is invalid.
+
+          VOS_STATUS_E_FAULT - pEvent is an invalid pointer.
+
+  \sa vos_wait_multiple_events()
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_wait_single_event ( vos_event_t* event, v_U32_t timeout)
+{
+
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check for null pointer
+   if ( NULL == event )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "NULL event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   // check if cookie is same as that of initialized event
+   if ( LINUX_EVENT_COOKIE != event->cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "Uninitialized event passed into %s", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if (timeout)
+   {
+      long ret;
+      ret =
+         wait_for_completion_interruptible_timeout(&event->complete,
+                                                   msecs_to_jiffies(timeout));
+      if ( 0 >= ret )
+      {
+         // 0 means timed out, negative means interrupted
+         return VOS_STATUS_E_TIMEOUT;
+      }
+   }
+   else
+   {
+      int ret;
+      ret = wait_for_completion_interruptible(&event->complete);
+      if ( 0 != ret )
+      {
+         // negative means interrupted
+         return VOS_STATUS_E_TIMEOUT;
+      }
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_wait_multiple_events() - Waits for event(s) to be set.
+   This is a duplicate of vos_wait_events() function. It ends up calling
+   vos_wait_events() with the params passed in.
+
+   This API waits for any event in the input array of events to be
+   set.  The caller is blocked waiting any event in the array to be
+   set or for the timeout to occur.
+
+   If multiple events in the array are set, only one event is identified
+   in the return from this call as satisfying the wait condition.  The
+   caller is responsible for calling \a vos_wait_events() again to find
+   the other events that are set.
+
+  \param pEventList - pointer to an array of event pointers
+
+  \param numEvents - Number of events
+
+  \param timeout - Timeout value (in milliseconds).  This function returns
+         if this interval elapses, regardless if any of the events have
+         been set.  An input value of 0 for this timeout parameter means
+         to wait infinitely, meaning a timeout will never occur.
+
+  \param pEventIndex - This is a pointer to the location where the index of
+         the event in the event array that satisfied the wait because
+         the event was set.
+
+  \return VOS_STATUS_SUCCESS - the wait was satisifed by one of the events
+          in the event array being set.  The index into the event arry
+          that satisfied the wait can be found at *pEventIndex.
+
+          VOS_STATUS_E_TIMEOUT - the timeout interval elapsed before any of
+          the events were set.
+
+          VOS_STATUS_E_INVAL - At least one of the values specified in the
+          event array refers to an uninitialized event object.  The invalid
+          event is identified by the index in *pEventIndex.  Note that only
+          the first uninitialized event is detected when this error is
+          returned.
+
+          VOS_STATUS_E_EMPTY - the events array is empty.  This condition
+          is detected by numEvents being 0 on input.
+
+          VOS_STATUS_E_FAULT - event or pEventIndex is an invalid pointer.
+
+  \sa vos_wait_single_events()
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_wait_multiple_events( vos_event_t **events, v_U8_t numEvents,
+   v_U32_t timeout, v_U8_t *pEventIndex )
+{
+   // NO LONGER SUPPORTED
+   return VOS_STATUS_E_FAILURE;
+}
diff --git a/CORE/VOSS/src/vos_getBin.c b/CORE/VOSS/src/vos_getBin.c
new file mode 100644
index 0000000..a9f3b9c
--- /dev/null
+++ b/CORE/VOSS/src/vos_getBin.c
@@ -0,0 +1,175 @@
+/*
+ * 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.
+ */
+
+/**=============================================================================
+  vos_getBin.c
+  \brief
+  Description...
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+  ==============================================================================*/
+/* $HEADER$ */
+/**-----------------------------------------------------------------------------
+  Include files
+  ----------------------------------------------------------------------------*/
+#include <vos_getBin.h>
+#include <linux/fs.h>       // for softmac direct file i/o
+#include <vos_api.h>
+#include <vos_sched.h>
+#include <wlan_hdd_misc.h>
+#include <wlan_hdd_main.h>
+/**-----------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ----------------------------------------------------------------------------*/
+/**-----------------------------------------------------------------------------
+  Type declarations
+  ----------------------------------------------------------------------------*/
+extern tVOS_CONCURRENCY_MODE hdd_get_concurrency_mode ( void );
+  
+/**-----------------------------------------------------------------------------
+  Function declarations and documenation
+  ----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+  \brief vos_get_binary_blob() - get binary data from platform
+  This API allows components to get binary data from the platform independent
+  of where the data is stored on the device.
+  <ul>
+    <li> Firmware
+    <li> Configuration Data
+  \param binaryId - identifies the binary data to return to the caller.
+         raw binary data and update the *pBufferSize with the exact
+         size of the data that has been retreived.
+         the size of the binary data in *pBufferSize.
+         size of the data buffer available at pBuffer.  Upon success, this
+         retreived and written to the buffer at pBuffer.
+         Input value of 0 is valid and will cause the API to return
+         the size of the binary data in *pBufferSize.
+          retreived and written to the buffer.
+          refer to a valid VOS Binary ID.
+          variable that the API can write to.
+          *pBufferSize is not big enough to contain the binary.
+  \sa
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_get_binary_blob( VOS_BINARY_ID binaryId,
+                                v_VOID_t *pBuffer, v_SIZE_t *pBufferSize )
+{
+  VOS_STATUS VosSts = VOS_STATUS_SUCCESS;
+    char *pFileName;
+
+    v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL);
+
+    // get the correct file name from binary Id
+    switch (binaryId)
+    {
+        case VOS_BINARY_ID_CONFIG:
+           pFileName = WLAN_CFG_FILE;
+           break;
+        case VOS_BINARY_ID_COUNTRY_INFO:
+           pFileName = WLAN_COUNTRY_INFO_FILE;
+           break;
+        case VOS_BINARY_ID_HO_CONFIG:
+           pFileName = WLAN_HO_CFG_FILE;
+           break;
+        default:
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Invalid binaryID");
+           return VosSts;
+    }
+    if(0 == *pBufferSize )
+    {
+       /*  just a file size request.  set the value and return  VOS_STATUS_E_NOMEM*/
+       VosSts = hdd_get_cfg_file_size(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBufferSize);
+
+       if ( !VOS_IS_STATUS_SUCCESS( VosSts ))
+       {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                                    "%s : vos_open failed\n",__func__);
+
+          return VOS_STATUS_E_FAILURE;
+       }
+       VosSts = VOS_STATUS_E_NOMEM;
+    }
+    else
+    {
+       if(NULL != pBuffer) {
+          // read the contents into the buffer
+          VosSts = hdd_read_cfg_file(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBuffer,pBufferSize);
+       }
+       else {
+             VosSts = VOS_STATUS_E_FAILURE;
+       }
+    }       
+    
+    return VosSts;                                  
+}
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+VOS_STATUS vos_get_fwbinary( v_VOID_t **ppBinary, v_SIZE_t *pNumBytes )
+{        
+   v_CONTEXT_t pVosContext;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL);
+
+   if(pVosContext) {
+
+         status = hdd_request_firmware(WLAN_FW_FILE,((VosContextType*)(pVosContext))->pHDDContext,ppBinary,pNumBytes);
+
+   } 
+   return status;      
+}         
+#endif
+
+#ifdef WLAN_SOFTAP_FEATURE
+tVOS_CON_MODE vos_get_conparam( void )
+{
+    tVOS_CON_MODE con_mode; 
+    con_mode = hdd_get_conparam ( );
+    return con_mode;
+}
+#endif
+tVOS_CONCURRENCY_MODE vos_get_concurrency_mode( void )
+{
+    tVOS_CONCURRENCY_MODE con_mode; 
+    con_mode = hdd_get_concurrency_mode ( );
+    return con_mode;
+}
+
+v_BOOL_t vos_concurrent_sessions_running(void)
+{
+    v_U8_t i=0;
+    v_U8_t j=0;
+    hdd_context_t *pHddCtx;
+    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );    
+
+    if (NULL != pVosContext)
+    {
+       pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
+
+       for (i=0;i<VOS_MAX_NO_OF_MODE; i++)
+       {
+          j += pHddCtx->no_of_sessions[i];
+       }
+    }
+
+    return (j>1);
+}
+
diff --git a/CORE/VOSS/src/vos_list.c b/CORE/VOSS/src/vos_list.c
new file mode 100644
index 0000000..6696e79
--- /dev/null
+++ b/CORE/VOSS/src/vos_list.c
@@ -0,0 +1,929 @@
+/*
+ * 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.
+ */
+
+/**=============================================================================
+
+  vos_list.c
+
+  \brief
+
+  Description...
+
+
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
+
+  ==============================================================================**/
+/* $HEADER$ */
+
+/**-----------------------------------------------------------------------------
+  Include files
+  ----------------------------------------------------------------------------*/
+#include <vos_list.h>
+#include <vos_trace.h>
+
+/**-----------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ----------------------------------------------------------------------------*/
+#define VOS_LIST_COOKIE 0xabadfeed
+
+
+/**-----------------------------------------------------------------------------
+  Type declarations
+  ----------------------------------------------------------------------------*/
+
+/**-----------------------------------------------------------------------------
+  Function declarations and documenation
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_list_init( vos_list_t *pList )
+{
+   if ( pList == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie == VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: already initialized list", __FUNCTION__);
+      return VOS_STATUS_E_BUSY;
+   }
+
+   mutex_init(&pList->lock);
+
+   INIT_LIST_HEAD( &pList->anchor );
+
+   pList->count = 0;
+   pList->cookie = VOS_LIST_COOKIE;
+
+   return( VOS_STATUS_SUCCESS );
+}
+
+
+VOS_STATUS vos_list_destroy( vos_list_t *pList )
+{
+   int rc;
+   if (pList == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->count !=0 )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list length not equal to zero", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_BUSY;
+   }
+
+   // clear the cookie. This indicates the list is destroyed.
+   pList->cookie = 0;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+VOS_STATUS vos_list_insert_front( vos_list_t *pList, vos_list_node_t *pNode )
+{
+   int rc;
+
+   if ( ( pList == NULL) || ( pNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   list_add( pNode, &pList->anchor );
+
+   pList->count++;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS vos_list_insert_back( vos_list_t *pList, vos_list_node_t *pNode )
+{
+   int rc;
+
+   if ( ( pList == NULL) || ( pNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   list_add_tail( pNode, &pList->anchor );
+
+   pList->count++;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+VOS_STATUS vos_list_insert_back_size( vos_list_t *pList, vos_list_node_t *pNode, v_SIZE_t *pSize )
+{
+   int rc;
+   if ( ( pList == NULL) || ( pNode == NULL) || (pSize == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   list_add_tail( pNode, &pList->anchor );
+
+   pList->count++;
+   *pSize = pList->count;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+VOS_STATUS vos_list_remove_front( vos_list_t *pList, vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc;
+
+   // the assumption here is that pList is the head of the list (dummy
+   // node) and points to first and last element in circular linked list
+   if ( ( pList == NULL ) || ( ppNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty( &pList->anchor ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   listptr = pList->anchor.next;
+
+   *ppNode = listptr;
+
+   list_del(pList->anchor.next);
+
+   pList->count--;
+   mutex_unlock(&pList->lock);
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+VOS_STATUS vos_list_remove_back( vos_list_t *pList, vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc;
+
+   // the assumption here is that pList is the head of the list (dummy node) and points to first and
+   // last element in circular linked list
+   if ( ( pList == NULL ) || ( ppNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty( &pList->anchor ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   listptr = pList->anchor.prev;
+
+   *ppNode = listptr;
+
+   list_del(pList->anchor.prev);
+
+   pList->count--;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS vos_list_size( vos_list_t *pList, v_SIZE_t *pSize )
+{
+   int rc;
+   if ( ( pList ==NULL) || ( pSize == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: list not initialized", __FUNCTION__);
+       return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   *pSize = pList->count;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_peek_front() - peek at the node at front of a linked list
+
+  The vos_list_peek_front() API will return a pointer to the node at the
+  front of a properly initialized vOS List object.  The node will *not* be
+  removed from the list.
+
+  \param pList - Pointer to list object of the list to be 'peeked'
+
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the front of the list.
+
+  \return VOS_STATUS_SUCCESS - list node at the front of the list was
+          successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be
+          removed.
+
+          VOS_STATUS_E_FAULT  - pList or or ppNode is an invalid pointer.
+
+  \sa vos_list_remove_back()
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_list_peek_front( vos_list_t *pList, vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc;
+
+   if ( ( pList == NULL) || ( ppNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: list not initialized", __FUNCTION__);
+       return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+   listptr = pList->anchor.next;
+   *ppNode = listptr;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_peek_back() - peek at the node at back of a linked list
+
+  The vos_list_peek_back() API will return a pointer to the node at the
+  back of a properly initialized vOS List object.  The node will *not* be
+  removed from the list.
+
+  \param pList - Pointer to list object of the list to be 'peeked'
+
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the back of the list.
+
+  \return VOS_STATUS_SUCCESS - list node at the back of the list was
+          successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be
+          removed.
+
+          VOS_STATUS_E_FAULT  - pList or or ppNode is an invalid pointer.
+
+  \sa vos_list_peek_back(), vos_list_remove_back(), vos_list_peek_front(),
+      vos_list_remove_front()
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_list_peek_back( vos_list_t *pList, vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc;
+
+   if ( ( pList == NULL) || ( ppNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                 "%s: list empty", __FUNCTION__);
+       mutex_unlock(&pList->lock);
+       return VOS_STATUS_E_EMPTY;
+   }
+   listptr = pList->anchor.prev;
+   *ppNode = listptr;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_peek_next() - peek at the node after the specified node
+
+  The vos_list_peek_next() API will return a pointer to the node following the
+  specified node on a properly initialized vOS List object.  The node will
+  *not* be removed from the list.
+
+  \param pList - Pointer to list object of the list to be 'peeked'
+
+  \param pNode - Pointer to the node that is being 'peeked'
+
+  \param ppNode - Pointer to a pointer to the list node that follows the
+         pNode node on the list.
+
+  \return VOS_STATUS_SUCCESS - list node following pNode on the properly
+          initialized list is successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - There is no 'next' node (the input node is
+          at the back of the list).
+
+          VOS_STATUS_E_FAULT  - pList, pNode or ppNode is an invalid pointer.
+
+  \sa vos_list_remove_back()
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_list_peek_next( vos_list_t *pList, vos_list_node_t *pNode,
+                               vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc, found = 0;
+   vos_list_node_t *tmp;
+
+   if ( ( pList == NULL) || ( pNode == NULL) || (ppNode == NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "%s: list empty", __FUNCTION__);
+       mutex_unlock(&pList->lock);
+       return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNode is indeed part of list pList
+   list_for_each(tmp, &pList->anchor)
+   {
+      if (tmp == pNode)
+      {
+         found = 1;
+         break;
+      }
+   }
+   if (found == 0)
+      return VOS_STATUS_E_INVAL;
+
+   listptr = pNode->next;
+   if (listptr == &pList->anchor)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   *ppNode =  listptr;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_peek_prev() - peek at the node before the specified node
+
+  The vos_list_peek_prev() API will return a pointer to the node before the
+  specified node on a properly initialized vOS List object.  The node will
+  *not* be removed from the list.
+
+  \param pList - Pointer to list object of the list to be 'peeked'
+
+  \param pNode - Pointer to the node that is being 'peeked'
+
+  \param ppNode - Pointer to a pointer to the list node before the
+  pNode node on the list.
+
+  \return VOS_STATUS_SUCCESS - list node before pNode on the properly
+          initialized list is successfully returned.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - There is no 'previous' node (the input node is
+          at the front of the list).
+
+          VOS_STATUS_E_FAULT  - pList, pNode or ppNode is an invalid pointer.
+
+  \sa vos_list_remove_back()
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_list_peek_prev( vos_list_t *pList, vos_list_node_t *pNode,
+                               vos_list_node_t **ppNode )
+{
+   struct list_head * listptr;
+   int rc, found = 0;
+   vos_list_node_t *tmp;
+
+   if ( ( pList == NULL) || ( pNode == NULL) || (ppNode == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNode is indeed part of list pList
+   list_for_each(tmp, &pList->anchor)
+   {
+      if (tmp == pNode)
+      {
+         found = 1;
+         break;
+      }
+   }
+   if (found == 0)
+      return VOS_STATUS_E_INVAL;
+
+   listptr = pNode->prev;
+
+   if (listptr == &pList->anchor)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   *ppNode = listptr;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_insert_before() - insert node at front of a specified
+  list node
+
+  The vos_list_insert_before() API will insert a node onto a properly
+  initialized vOS List object in front of the specified list node.
+
+  \param pList - Pointer to list object where the node will be inserted
+
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  in front of.
+
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_FAULT  - pList, pNodeToInsert, or pNode are
+          invalid pointer(s)
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_before( vos_list_t *pList, vos_list_node_t *pNodeToInsert,
+                                   vos_list_node_t *pNode )
+{
+   int rc, found = 0;
+   vos_list_node_t *tmp;
+
+   if ( ( pList == NULL) || ( pNode == NULL) || (pNodeToInsert == NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNode is indeed part of list pList
+   list_for_each(tmp, &pList->anchor)
+   {
+      if (tmp == pNode)
+      {
+         found = 1;
+         break;
+      }
+   }
+   if (found == 0)
+      return VOS_STATUS_E_INVAL;
+
+   list_add(pNodeToInsert, pNode);
+   pList->count++;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_insert_after() - insert node behind a specified list node
+
+  The vos_list_insert_after() API will insert a node onto a properly
+  initialized vOS List object after the specified list node.
+
+  \param pList - Pointer to list object where the node will be inserted
+
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  after.
+
+  \return VOS_STATUS_SUCCESS - list node was successfully inserted onto
+          the front of the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_FAULT  - pList, pNodeToInsert, or pNode are
+          invalid pointer(s)
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_insert_after( vos_list_t *pList, vos_list_node_t *pNodeToInsert,
+                                  vos_list_node_t *pNode )
+{
+   int rc, found = 0;
+   vos_list_node_t *tmp;
+
+   if ( ( pList == NULL) || ( pNode == NULL) || (pNodeToInsert == NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+
+   if ( list_empty(&pList->anchor) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNode is indeed part of list pList
+   list_for_each(tmp, &pList->anchor)
+   {
+      if (tmp == pNode)
+      {
+         found = 1;
+         break;
+      }
+   }
+   if (found == 0)
+      return VOS_STATUS_E_INVAL;
+
+   list_add_tail(pNodeToInsert, pNode);
+   pList->count++;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_list_remove_node() - remove specified node from vOS list list
+
+  The vos_list_remove_node() API will remove a specified node from the
+  properly initialized vOS List object.
+
+  \param pList - Pointer to list object where the node will be removed
+
+  \param ppNode - Pointer to the node to be removed from the list.
+
+  \return VOS_STATUS_SUCCESS - list node was successfully removed from
+          the list.
+
+          VOS_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          VOS_STATUS_E_EMPTY - The specified is empty so nodes cannot be
+          removed.
+
+
+          VOS_STATUS_E_FAULT  - pList or pNodeToRemove is not a valid pointer
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_list_remove_node( vos_list_t *pList, vos_list_node_t *pNodeToRemove )
+{
+   int rc, found = 0;
+   vos_list_node_t *tmp;
+
+   if ( ( pList == NULL ) || ( pNodeToRemove == NULL) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL pointer passed in", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( pList->cookie != VOS_LIST_COOKIE )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list not initialized", __FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   rc = mutex_lock_interruptible(&pList->lock);
+   if (rc)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock list", __FUNCTION__);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   if ( list_empty(&pList->anchor) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: list empty", __FUNCTION__);
+      mutex_unlock(&pList->lock);
+      return VOS_STATUS_E_EMPTY;
+   }
+
+   // verify that pNodeToRemove is indeed part of list pList
+   list_for_each(tmp, &pList->anchor)
+   {
+      if (tmp == pNodeToRemove)
+      {
+         found = 1;
+         break;
+      }
+   }
+   if (found == 0)
+      return VOS_STATUS_E_INVAL;
+
+   list_del(pNodeToRemove);
+   pList->count--;
+   mutex_unlock(&pList->lock);
+
+   return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/VOSS/src/vos_lock.c b/CORE/VOSS/src/vos_lock.c
new file mode 100644
index 0000000..837ef05
--- /dev/null
+++ b/CORE/VOSS/src/vos_lock.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.
+ */
+
+/*============================================================================
+  FILE:         vos_lock.c
+
+  OVERVIEW:     This source file contains definitions for vOS lock APIs
+                The four APIs mentioned in this file are used for 
+                initializing , acquiring, releasing and destroying a lock.
+                the lock are implemented using critical sections
+
+  DEPENDENCIES: 
+ 
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
+============================================================================*/
+
+/*============================================================================
+  EDIT HISTORY FOR MODULE
+
+============================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+
+#include "vos_lock.h"
+#include "vos_memory.h"
+#include "vos_trace.h"
+
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+#define LINUX_LOCK_COOKIE 0x12345678
+enum
+{
+   LOCK_RELEASED = 0x11223344,
+   LOCK_ACQUIRED,
+   LOCK_DESTROYED
+};
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+   Function Definitions and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_init() - initializes a vOSS lock
+  
+  The vos_lock_init() function initializes the specified lock. Upon 
+  successful initialization, the state of the lock becomes initialized 
+  and unlocked.
+
+  A lock must be initialized by calling vos_lock_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized lock results in 
+  a failure.
+ 
+  \param lock - pointer to the opaque lock object to initialize
+  
+  \return VOS_STATUS_SUCCESS - lock was successfully initialized and 
+          is ready to be used.
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the lock
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to reinitialize the object referenced by lock, a previously 
+          initialized, but not yet destroyed, lock.
+
+          VOS_STATUS_E_FAULT  - lock is an invalid pointer.   
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to 
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the lock
+  \sa
+   
+    ( *** return value not considered yet )
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_init ( vos_lock_t *lock )
+{
+
+   //check for invalid pointer
+   if ( lock == NULL)
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: NULL pointer passed in",__FUNCTION__);
+       return VOS_STATUS_E_FAULT; 
+   }
+   // check for 'already initialized' lock
+   if ( LINUX_LOCK_COOKIE == lock->cookie )
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: already initialized lock",__FUNCTION__);
+       return VOS_STATUS_E_BUSY;
+   }
+      
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return VOS_STATUS_E_FAULT; 
+   }
+      
+   // initialize new lock 
+   mutex_init( &lock->m_lock ); 
+   lock->cookie = LINUX_LOCK_COOKIE;
+   lock->state  = LOCK_RELEASED;
+   lock->processID = 0;
+   lock->refcount = 0;
+      
+   return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_acquire() - acquires a lock
+
+  A lock object is acquired by calling \a vos_lock_acquire().  If the lock 
+  is already locked, the calling thread shall block   until the lock becomes 
+  available. This operation shall return with the lock object referenced by 
+  lock in the locked state with the calling thread as its owner. 
+  
+  \param lock - the lock object to acquire
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully acquired by 
+          the calling thread.
+  
+          VOS_STATUS_E_INVAL - The value specified by lock does not refer 
+          to an initialized lock object.
+          
+          VOS_STATUS_E_FAULT  - lock is an invalid pointer. 
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to 
+          unknown reasons
+          
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_acquire ( vos_lock_t* lock )
+{
+      int rc;
+      //Check for invalid pointer
+      if ( lock == NULL )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: NULL pointer passed in",__FUNCTION__);
+         return VOS_STATUS_E_FAULT;
+      }
+      // check if lock refers to an initialized object
+      if ( LINUX_LOCK_COOKIE != lock->cookie )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: uninitialized lock",__FUNCTION__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      if (in_interrupt())
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+         return VOS_STATUS_E_FAULT; 
+      }
+      if ((lock->processID == current->pid) && 
+          (lock->state == LOCK_ACQUIRED))
+      {
+         lock->refcount++;
+#ifdef VOS_NESTED_LOCK_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"%s: %x %d %d", __func__, lock, current->pid, lock->refcount);
+#endif
+         return VOS_STATUS_SUCCESS;
+      }
+      // Acquire a Lock
+      rc = mutex_lock_interruptible( &lock->m_lock ); 
+      if (rc) 
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: unable to lock mutex (rc = %d)", __FUNCTION__, rc);
+         return VOS_STATUS_E_FAILURE;
+      }
+ 
+      
+#ifdef VOS_NESTED_LOCK_DEBUG
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"%s: %x %d", __func__, lock, current->pid);
+#endif
+      if ( LOCK_DESTROYED != lock->state ) 
+      {
+         lock->processID = current->pid;
+         lock->refcount++;
+         lock->state    = LOCK_ACQUIRED;
+         return VOS_STATUS_SUCCESS;
+      }
+      else
+      {
+         // lock is already destroyed
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Lock is already destroyed", __FUNCTION__);
+         mutex_unlock(&lock->m_lock);
+         return VOS_STATUS_E_FAILURE;
+      }
+}
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_release() - releases a lock
+
+  The \a vos_lock_release() function shall release the lock object 
+  referenced by 'lock'.  
+
+  If a thread attempts to release a lock that it unlocked or is not
+  initialized, an error is returned. 
+
+  \param lock - the lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+          VOS_STATUS_E_INVAL - The value specified by lock does not refer 
+          to an initialized lock object.
+                   
+          VOS_STATUS_E_FAULT - The value specified by lock does not refer 
+          to an initialized lock object.
+                   
+          VOS_STATUS_E_PERM - Operation is not permitted.  The calling 
+          thread does not own the lock. 
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to 
+          unknown reasons
+    
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_release ( vos_lock_t *lock )
+{
+      //Check for invalid pointer
+      if ( lock == NULL )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: NULL pointer passed in",__FUNCTION__);
+         return VOS_STATUS_E_FAULT;
+      }
+
+      // check if lock refers to an uninitialized object
+      if ( LINUX_LOCK_COOKIE != lock->cookie )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: uninitialized lock",__FUNCTION__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      if (in_interrupt())
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+         return VOS_STATUS_E_FAULT; 
+      }
+
+      // CurrentThread = GetCurrentThreadId(); 
+      // Check thread ID of caller against thread ID
+      // of the thread which acquire the lock
+      if ( lock->processID != current->pid )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: current task pid does not match original task pid!!",__FUNCTION__);
+#ifdef VOS_NESTED_LOCK_DEBUG
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"%s: Lock held by=%d being released by=%d", __func__, lock->processID, current->pid);
+#endif
+
+         return VOS_STATUS_E_PERM;
+      }
+      if ((lock->processID == current->pid) && 
+          (lock->state == LOCK_ACQUIRED))
+      {
+         if (lock->refcount > 0) lock->refcount--;
+      }
+#ifdef VOS_NESTED_LOCK_DEBUG
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"%s: %x %d %d", __func__, lock, lock->processID, lock->refcount);
+#endif
+      if (lock->refcount) return VOS_STATUS_SUCCESS;
+         
+      lock->processID = 0;
+      lock->refcount = 0;
+      lock->state = LOCK_RELEASED;
+      // Release a Lock   
+      mutex_unlock( &lock->m_lock );
+#ifdef VOS_NESTED_LOCK_DEBUG
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"%s: Freeing lock %x %d %d", lock, lock->processID, lock->refcount);
+#endif
+      return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_lock_destroy() - Destroys a vOSS Lock - probably not required
+  for Linux. It may not be required for the caller to destroy a lock after
+  usage.
+
+  The \a vos_lock_destroy() function shall destroy the lock object 
+  referenced by lock.  After a successful return from \a vos_lock_destroy()
+  the lock object becomes, in effect, uninitialized.
+   
+  A destroyed lock object can be reinitialized using vos_lock_init(); 
+  the results of otherwise referencing the object after it has been destroyed 
+  are undefined.  Calls to vOSS lock functions to manipulate the lock such
+  as vos_lock_acquire() will fail if the lock is destroyed.  Therefore, 
+  don't use the lock after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param lock - the lock object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - lock was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by lock while it is locked 
+          or still referenced. 
+
+          VOS_STATUS_E_INVAL - The value specified by lock is invalid.
+          
+          VOS_STATUS_E_FAULT  - lock is an invalid pointer. 
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to 
+          unknown reasons
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_lock_destroy( vos_lock_t *lock )
+{
+      //Check for invalid pointer
+      if ( NULL == lock )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: NULL pointer passed in", __FUNCTION__);
+         return VOS_STATUS_E_FAULT; 
+      }
+
+      if ( LINUX_LOCK_COOKIE != lock->cookie )
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: uninitialized lock", __FUNCTION__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      if (in_interrupt())
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+         return VOS_STATUS_E_FAULT; 
+      }
+
+      // check if lock is released
+      if (!mutex_trylock(&lock->m_lock))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: lock is not released", __FUNCTION__);
+         return VOS_STATUS_E_BUSY;
+      }
+      lock->cookie = 0;
+      lock->state = LOCK_DESTROYED;
+      lock->processID = 0;
+      lock->refcount = 0;
+
+      mutex_unlock(&lock->m_lock);
+
+         
+      return VOS_STATUS_SUCCESS;
+}
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_init() - initializes a vOSS spin lock
+  
+  The vos_spin_lock_init() function initializes the specified spin lock. Upon 
+  successful initialization, the state of the lock becomes initialized 
+  and unlocked.
+
+  A lock must be initialized by calling vos_spin_lock_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized lock results in 
+  a failure.
+ 
+  \param pLock - pointer to the opaque lock object to initialize
+  
+  \return VOS_STATUS_SUCCESS - spin lock was successfully initialized and 
+          is ready to be used.
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_spin_lock_init(vos_spin_lock_t *pLock)
+{
+   spin_lock_init(pLock);
+   
+   return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_acquire() - acquires a spin lock
+
+  A lock object is acquired by calling \a vos_spin_lock_acquire().  If the lock 
+  is already locked, the calling thread shall spin until the lock becomes 
+  available. This operation shall return with the lock object referenced by 
+  lock in the locked state with the calling thread as its owner. 
+  
+  \param pLock - the lock object to acquire
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully acquired by 
+          the calling thread.
+      
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_acquire(vos_spin_lock_t *pLock)
+{
+   spin_lock(pLock);
+   return VOS_STATUS_SUCCESS;
+}
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_release() - releases a lock
+
+  The \a vos_lock_release() function shall release the spin lock object 
+  referenced by 'lock'.  
+
+  If a thread attempts to release a lock that it unlocked or is not
+  initialized, an error is returned. 
+
+  \param pLock - the lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_release(vos_spin_lock_t *pLock)
+{
+   spin_unlock(pLock);
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_spin_lock_destroy() - releases resource of a lock
+
+  \param pLock - the pointer to a lock to release
+  
+  \return VOS_STATUS_SUCCESS - the lock was successfully released
+  
+  \sa
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_spin_lock_destroy(vos_spin_lock_t *pLock)
+{
+
+   return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/VOSS/src/vos_memory.c b/CORE/VOSS/src/vos_memory.c
new file mode 100644
index 0000000..7080177
--- /dev/null
+++ b/CORE/VOSS/src/vos_memory.c
@@ -0,0 +1,473 @@
+/*
+ * 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 vos_memory.c
+
+  @brief Virtual Operating System Services Memory API
+
+  
+  Copyright (c) 2008 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 
+  --------    ---    --------------------------------------------------------
+     
+===========================================================================*/ 
+
+/*---------------------------------------------------------------------------
+ * Include Files
+ * ------------------------------------------------------------------------*/
+
+#include "vos_memory.h"
+#include "vos_trace.h"
+
+#ifdef MEMORY_DEBUG
+#include "wlan_hdd_dp_utils.h"
+
+hdd_list_t vosMemList;
+
+static v_U8_t WLAN_MEM_HEADER[] =  {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68 };
+static v_U8_t WLAN_MEM_TAIL[]   =  {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87};
+
+struct s_vos_mem_struct
+{
+   hdd_list_node_t pNode;
+   char* fileName;
+   unsigned int lineNum;
+   unsigned int size;
+   v_U8_t header[8];
+};
+#endif
+
+/*---------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * ------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+ * Type Declarations
+ * ------------------------------------------------------------------------*/
+  
+/*---------------------------------------------------------------------------
+ * Data definitions
+ * ------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+ * External Function implementation
+ * ------------------------------------------------------------------------*/
+#ifdef MEMORY_DEBUG
+void vos_mem_init()
+{
+   /* Initalizing the list with maximum size of 60000 */
+   hdd_list_init(&vosMemList, 60000);  
+   return; 
+}
+
+void vos_mem_clean()
+{
+    v_SIZE_t listSize;
+    hdd_list_size(&vosMemList, &listSize);
+
+    if(listSize)
+    {
+       hdd_list_node_t* pNode;
+       VOS_STATUS vosStatus;
+
+       struct s_vos_mem_struct* memStruct;
+ 
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             "%s: List is not Empty. listSize %d ", __FUNCTION__, (int)listSize);
+
+       do
+       {
+          spin_lock(&vosMemList.lock);
+          vosStatus = hdd_list_remove_front(&vosMemList, &pNode);
+          spin_unlock(&vosMemList.lock);
+          if(VOS_STATUS_SUCCESS == vosStatus)
+          {
+             memStruct = (struct s_vos_mem_struct*)pNode;
+             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "Memory Leak@ File %s, @Line %d, size %d", 
+                   memStruct->fileName, (int)memStruct->lineNum, memStruct->size);
+             kfree((v_VOID_t*)memStruct);
+          }
+       }while(vosStatus == VOS_STATUS_SUCCESS);
+    }
+}
+
+void vos_mem_exit()
+{
+    vos_mem_clean();    
+    hdd_list_destroy(&vosMemList);
+}
+
+v_VOID_t * vos_mem_malloc_debug( v_SIZE_t size, char* fileName, v_U32_t lineNum)
+{
+   struct s_vos_mem_struct* memStruct;
+   v_VOID_t* memPtr = NULL;
+   v_SIZE_t new_size;
+
+   if (size > (1024*1024))
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: called with arg > 1024K; passed in %d !!!", __FUNCTION__,size); 
+       return NULL;
+   }
+   if (in_interrupt())
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+               "%s is being called in interrupt context, using GPF_ATOMIC.", __FUNCTION__);
+       return kmalloc(size, GFP_ATOMIC);
+      
+   }
+
+   new_size = size + sizeof(struct s_vos_mem_struct) + 8; 
+
+   memStruct = (struct s_vos_mem_struct*)kmalloc(new_size,GFP_KERNEL);
+
+   if(memStruct != NULL)
+   {
+      VOS_STATUS vosStatus;
+
+      memStruct->fileName = fileName;
+      memStruct->lineNum  = lineNum;
+      memStruct->size     = size;
+
+      vos_mem_copy(&memStruct->header[0], &WLAN_MEM_HEADER[0], sizeof(WLAN_MEM_HEADER));
+      vos_mem_copy( (v_U8_t*)(memStruct + 1) + size, &WLAN_MEM_TAIL[0], sizeof(WLAN_MEM_TAIL));
+
+      spin_lock(&vosMemList.lock);
+      vosStatus = hdd_list_insert_front(&vosMemList, &memStruct->pNode);
+      spin_unlock(&vosMemList.lock);
+      if(VOS_STATUS_SUCCESS != vosStatus)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Unable to insert node into List vosStatus %d\n", __FUNCTION__, vosStatus);
+      }
+
+      memPtr = (v_VOID_t*)(memStruct + 1); 
+   }
+   return memPtr;
+}
+
+v_VOID_t vos_mem_free( v_VOID_t *ptr )
+{
+    if (ptr != NULL)
+    {
+        VOS_STATUS vosStatus;
+        struct s_vos_mem_struct* memStruct = ((struct s_vos_mem_struct*)ptr) - 1;
+
+        spin_lock(&vosMemList.lock);
+        vosStatus = hdd_list_remove_node(&vosMemList, &memStruct->pNode);
+        spin_unlock(&vosMemList.lock);
+
+        if(VOS_STATUS_SUCCESS == vosStatus)
+        {
+            if(0 == vos_mem_compare(memStruct->header, &WLAN_MEM_HEADER[0], sizeof(WLAN_MEM_HEADER)) )
+            {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
+                    "Memory Header is corrupted. MemInfo: Filename %s, LineNum %d", 
+                                memStruct->fileName, (int)memStruct->lineNum);
+            }
+            if(0 == vos_mem_compare( (v_U8_t*)ptr + memStruct->size, &WLAN_MEM_TAIL[0], sizeof(WLAN_MEM_TAIL ) ) )
+            {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
+                    "Memory Trailer is corrupted. MemInfo: Filename %s, LineNum %d", 
+                                memStruct->fileName, (int)memStruct->lineNum);
+            }
+            kfree((v_VOID_t*)memStruct);
+        }
+        else
+        {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                      "%s: Unallocated memory (double free?)", __FUNCTION__);
+            VOS_ASSERT(0);
+        }
+    }
+}
+#else
+v_VOID_t * vos_mem_malloc( v_SIZE_t size )
+{
+   if (size > (1024*1024))
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: called with arg > 1024K; passed in %d !!!", __FUNCTION__,size); 
+       return NULL;
+   }
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return NULL;
+   }
+   return kmalloc(size, GFP_KERNEL);
+}   
+
+v_VOID_t vos_mem_free( v_VOID_t *ptr )
+{
+    if (ptr == NULL)
+      return;
+    kfree(ptr);
+}
+#endif
+
+v_VOID_t vos_mem_set( v_VOID_t *ptr, v_SIZE_t numBytes, v_BYTE_t value )
+{
+   if (ptr == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s called with NULL parameter ptr", __FUNCTION__);
+      return;
+   }
+   memset(ptr, value, numBytes);
+}
+
+v_VOID_t vos_mem_zero( v_VOID_t *ptr, v_SIZE_t numBytes )
+{
+   if (0 == numBytes)
+   {
+      // special case where ptr can be NULL
+      return;
+   }
+
+   if (ptr == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s called with NULL parameter ptr", __FUNCTION__);
+      return;
+   }
+   memset(ptr, 0, numBytes);
+   
+}
+
+
+//This function is to validate one list in SME. We suspect someone corrupt te list. This code need to be removed
+//once the issue is fixed.
+extern int csrCheckValidateLists(void * dest, const void *src, v_SIZE_t num, int idx);
+
+v_VOID_t vos_mem_copy( v_VOID_t *pDst, const v_VOID_t *pSrc, v_SIZE_t numBytes )
+{
+   if (0 == numBytes)
+   {
+      // special case where pDst or pSrc can be NULL
+      return;
+   }
+
+   if ((pDst == NULL) || (pSrc==NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s called with NULL parameter, source:%p destination:%p",
+                __FUNCTION__, pSrc, pDst);
+      VOS_ASSERT(0);
+      return;
+   }
+   //These two check function calls are to see if someone corrupt the list while doing mem copy.
+   csrCheckValidateLists(pDst, pSrc, numBytes, 1);
+   memcpy(pDst, pSrc, numBytes);
+   csrCheckValidateLists(pDst, pSrc, numBytes, 2);
+}
+
+v_VOID_t vos_mem_move( v_VOID_t *pDst, const v_VOID_t *pSrc, v_SIZE_t numBytes )
+{
+   if (0 == numBytes)
+   {
+      // special case where pDst or pSrc can be NULL
+      return;
+   }
+
+   if ((pDst == NULL) || (pSrc==NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s called with NULL parameter, source:%p destination:%p",
+                __FUNCTION__, pSrc, pDst);
+      VOS_ASSERT(0);
+      return;
+   }
+   memmove(pDst, pSrc, numBytes);
+}
+
+v_BOOL_t vos_mem_compare( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes )
+{ 
+   if (0 == numBytes)
+   {
+      // special case where pMemory1 or pMemory2 can be NULL
+      return VOS_TRUE;
+   }
+
+   if ((pMemory1 == NULL) || (pMemory2==NULL))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s called with NULL parameter, p1:%p p2:%p",
+                __FUNCTION__, pMemory1, pMemory2);
+      VOS_ASSERT(0);
+      return VOS_FALSE;
+   }
+   return (memcmp(pMemory1, pMemory2, numBytes)?VOS_FALSE:VOS_TRUE);
+}   
+
+
+v_SINT_t vos_mem_compare2( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes )
+
+{ 
+   return( (v_SINT_t) memcmp( pMemory1, pMemory2, numBytes ) );
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_dma_malloc() - vOSS DMA Memory Allocation
+
+  This function will dynamicallly allocate the specified number of bytes of 
+  memory. This memory will have special attributes making it DMA friendly i.e.
+  it will exist in contiguous, 32-byte aligned uncached memory. A normal 
+  vos_mem_malloc does not yield memory with these attributes. 
+
+  NOTE: the special DMA friendly memory is very scarce and this API must be
+  used sparingly
+
+  On WM, there is nothing special about this memory. SDHC allocates the 
+  DMA friendly buffer and copies the data into it
+  
+  \param size - the number of bytes of memory to allocate.  
+  
+  \return Upon successful allocate, returns a non-NULL pointer to the 
+  allocated memory.  If this function is unable to allocate the amount of 
+  memory specified (for any reason) it returns NULL.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+#ifdef MEMORY_DEBUG
+v_VOID_t * vos_mem_dma_malloc_debug( v_SIZE_t size, char* fileName, v_U32_t lineNum)
+{
+   struct s_vos_mem_struct* memStruct;
+   v_VOID_t* memPtr = NULL;
+   v_SIZE_t new_size;
+
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return NULL;
+   }
+
+   new_size = size + sizeof(struct s_vos_mem_struct) + 8; 
+
+   memStruct = (struct s_vos_mem_struct*)kmalloc(new_size,GFP_KERNEL);
+
+   if(memStruct != NULL)
+   {
+      VOS_STATUS vosStatus;
+
+      memStruct->fileName = fileName;
+      memStruct->lineNum  = lineNum;
+      memStruct->size     = size;
+
+      vos_mem_copy(&memStruct->header[0], &WLAN_MEM_HEADER[0], sizeof(WLAN_MEM_HEADER));
+      vos_mem_copy( (v_U8_t*)(memStruct + 1) + size, &WLAN_MEM_TAIL[0], sizeof(WLAN_MEM_TAIL));
+
+      spin_lock(&vosMemList.lock);
+      vosStatus = hdd_list_insert_front(&vosMemList, &memStruct->pNode);
+      spin_unlock(&vosMemList.lock);
+      if(VOS_STATUS_SUCCESS != vosStatus)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Unable to insert node into List vosStatus %d\n", __FUNCTION__, vosStatus);
+      }
+
+      memPtr = (v_VOID_t*)(memStruct + 1); 
+   }
+
+   return memPtr;
+}
+
+v_VOID_t vos_mem_dma_free( v_VOID_t *ptr )
+{
+    if (ptr != NULL)
+    {
+        VOS_STATUS vosStatus;
+        struct s_vos_mem_struct* memStruct = ((struct s_vos_mem_struct*)ptr) - 1;
+
+        spin_lock(&vosMemList.lock);
+        vosStatus = hdd_list_remove_node(&vosMemList, &memStruct->pNode);
+        spin_unlock(&vosMemList.lock);
+
+        if(VOS_STATUS_SUCCESS == vosStatus)
+        {
+            if(0 == vos_mem_compare(memStruct->header, &WLAN_MEM_HEADER[0], sizeof(WLAN_MEM_HEADER)) )
+            {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
+                    "Memory Header is corrupted. MemInfo: Filename %s, LineNum %d", 
+                                memStruct->fileName, (int)memStruct->lineNum);
+            }
+            if(0 == vos_mem_compare( (v_U8_t*)ptr + memStruct->size, &WLAN_MEM_TAIL[0], sizeof(WLAN_MEM_TAIL ) ) )
+            {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
+                    "Memory Trailer is corrupted. MemInfo: Filename %s, LineNum %d", 
+                                memStruct->fileName, (int)memStruct->lineNum);
+            }
+            kfree((v_VOID_t*)memStruct);
+        }
+    }
+}
+#else
+v_VOID_t* vos_mem_dma_malloc( v_SIZE_t size )
+{
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return NULL;
+   }
+   return kmalloc(size, GFP_KERNEL);
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_mem_dma_free() - vOSS DMA Free Memory
+
+  This function will free special DMA friendly memory pointed to by 'ptr'.
+
+  On WM, there is nothing special about the memory being free'd. SDHC will
+  take care of free'ing the DMA friendly buffer
+  
+  \param ptr - pointer to the starting address of the memory to be 
+               free'd.  
+  
+  \return Nothing
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_dma_free( v_VOID_t *ptr )
+{
+    if (ptr == NULL)
+      return;
+    kfree(ptr);
+}
+#endif
diff --git a/CORE/VOSS/src/vos_mq.c b/CORE/VOSS/src/vos_mq.c
new file mode 100644
index 0000000..c0dc94e
--- /dev/null
+++ b/CORE/VOSS/src/vos_mq.c
@@ -0,0 +1,251 @@
+/*
+ * 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  vos_mq.c
+  
+  \brief virtual Operating System Services (vOSS) message queue APIs
+               
+   Message Queue Definitions and API
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_mq.h>
+#include "vos_sched.h"
+#include <vos_api.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+  
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+  
+/*---------------------------------------------------------------------------
+  
+  \brief vos_mq_init() - Initialize the vOSS Scheduler  
+    
+  The \a vos_mq_init() function initializes the Message queue.
+      
+  \param  pMq - pointer to the message queue
+  
+  \return VOS_STATUS_SUCCESS - Message queue was successfully initialized and 
+          is ready to be used.
+          
+          VOS_STATUS_E_RESOURCES - Invalid parameter passed to the message
+          queue initialize function.
+          
+  \sa vos_mq_init()
+  
+---------------------------------------------------------------------------*/
+__inline VOS_STATUS vos_mq_init(pVosMqType pMq)
+{
+
+  /* Some quick sanity check*/
+  if (pMq == NULL) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: NULL pointer passed",__FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  }
+
+  /* 
+  ** Now initialize the lock
+  */
+  spin_lock_init(&pMq->mqLock);
+
+  /*
+  ** Now initialize the List data structure
+  */
+  INIT_LIST_HEAD(&pMq->mqList);
+
+  return VOS_STATUS_SUCCESS;
+   
+} /* vos_mq_init()*/
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_mq_deinit() - DeInitialize the vOSS Scheduler  
+    
+  The \a vos_mq_init() function de-initializes the Message queue.
+      
+  \param  pMq - pointer to the message queue
+  
+  \return None
+          
+  \sa vos_mq_deinit()
+  
+---------------------------------------------------------------------------*/
+__inline void vos_mq_deinit(pVosMqType pMq)
+{
+  /* 
+  ** Some quick sanity check
+  */
+  if (pMq == NULL) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: NULL pointer passed",__FUNCTION__);
+     return ;
+  }
+
+  /* we don't have to do anything with the embedded list or spinlock */
+
+}/* vos_mq_deinit() */
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_mq_put() - Add a message to the message queue 
+    
+  The \a vos_mq_put() function add a message to the Message queue.
+      
+  \param  pMq - pointer to the message queue
+  
+  \param  pMsgWrapper - Msg Wrapper containing the message
+  
+  \return None
+          
+  \sa vos_mq_put()
+  
+---------------------------------------------------------------------------*/
+__inline void vos_mq_put(pVosMqType pMq, pVosMsgWrapper pMsgWrapper)
+{
+  unsigned long flags;
+
+  /* 
+  ** Some quick sanity check
+  */
+  if ((pMq == NULL) || (pMsgWrapper == NULL)) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: NULL pointer passed",__FUNCTION__);
+     return ;
+  }
+
+  spin_lock_irqsave(&pMq->mqLock, flags);
+
+  list_add_tail(&pMsgWrapper->msgNode, &pMq->mqList);
+
+  spin_unlock_irqrestore(&pMq->mqLock, flags);
+
+} /* vos_mq_put() */
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_mq_get() - Get a message with its wrapper from a message queue 
+    
+  The \a vos_mq_get() function retrieve a message with its wrapper from 
+      the Message queue.
+      
+  \param  pMq - pointer to the message queue
+  
+  \return pointer to the Message Wrapper
+          
+  \sa vos_mq_get()
+  
+---------------------------------------------------------------------------*/
+__inline pVosMsgWrapper vos_mq_get(pVosMqType pMq)
+{
+  pVosMsgWrapper pMsgWrapper = NULL;
+
+  /* 
+  ** Some quick sanity check
+  */
+  struct list_head * listptr;
+  unsigned long flags;
+  
+  if (pMq == NULL) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: NULL pointer passed",__FUNCTION__);
+     return NULL;
+  }
+ 
+  spin_lock_irqsave(&pMq->mqLock, flags);
+
+  if( list_empty(&pMq->mqList) )
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+             "%s: VOS Message Queue is empty",__FUNCTION__);
+  }
+  else
+  {
+    listptr = pMq->mqList.next;
+    pMsgWrapper = (pVosMsgWrapper)list_entry(listptr, VosMsgWrapper, msgNode);
+    list_del(pMq->mqList.next);
+  }
+
+  spin_unlock_irqrestore(&pMq->mqLock, flags);
+
+  return pMsgWrapper;
+
+} /* vos_mq_get() */
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_is_mq_empty() - Return if the MQ is empty
+  
+  The \a vos_is_mq_empty() returns true if the queue is empty
+      
+  \param  pMq - pointer to the message queue
+  
+  \return pointer to the Message Wrapper
+          
+  \sa vos_mq_get()
+  
+---------------------------------------------------------------------------*/
+__inline v_BOOL_t vos_is_mq_empty(pVosMqType pMq)
+{
+  v_BOOL_t  state = VOS_FALSE;
+  unsigned long flags;
+
+  /* 
+  ** Some quick sanity check
+  */
+  if (pMq == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+         "%s: NULL pointer passed",__FUNCTION__);
+     return VOS_STATUS_E_FAILURE;
+  }
+
+  spin_lock_irqsave(&pMq->mqLock, flags);
+  state = list_empty(&pMq->mqList)?VOS_TRUE:VOS_FALSE;
+  spin_unlock_irqrestore(&pMq->mqLock, flags);
+
+  return state;
+
+} /* vos_mq_get() */
+
+
diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c
new file mode 100644
index 0000000..cc5a3cc
--- /dev/null
+++ b/CORE/VOSS/src/vos_nvitem.c
@@ -0,0 +1,1646 @@
+/*
+ * 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:         vos_nvitem.c
+  OVERVIEW:     This source file contains definitions for vOS NV Item APIs
+  DEPENDENCIES: NV, remote API client, WinCE REX
+                Copyright (c) 2008 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
+============================================================================*/
+/*============================================================================
+  EDIT HISTORY FOR MODULE
+============================================================================*/
+// the following is used to disable warning for having too many labels in
+// the 'nv_items_enum_type'
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "vos_types.h"
+#include "aniGlobal.h"
+#include "vos_nvitem.h"
+#include "vos_trace.h"
+#include "vos_api.h"
+#include "wlan_hdd_misc.h"
+#include "vos_sched.h"
+ 
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#define VALIDITY_BITMAP_NV_ID    NV_WLAN_VALIDITY_BITMAP_I
+#define VALIDITY_BITMAP_SIZE     32
+#define MAX_COUNTRY_COUNT        300
+//To be removed when NV support is fully functional
+#define VOS_HARD_CODED_MAC    {0, 0x0a, 0xf5, 4, 5, 6}
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+// this wrapper structure is identical to nv_cmd_type except the
+// data_ptr type is changed void* to avoid exceeding the debug information
+// module size as there are too many elements within nv_items_type union
+
+// structure for code and regulatory domain of a single country
+typedef struct
+{
+   v_U8_t            regDomain;
+   v_COUNTRYCODE_t   countryCode;
+} CountryInfo_t;
+// structure of table to map country code and regulatory domain
+typedef struct
+{
+   v_U16_t           countryCount;
+   CountryInfo_t     countryInfo[MAX_COUNTRY_COUNT];
+} CountryInfoTable_t;
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+// cache of country info table;
+// this is re-initialized from data on binary file
+// loaded on driver initialization if available
+static CountryInfoTable_t countryInfoTable =
+{
+    254,
+    {
+        { REGDOMAIN_FCC, {'U', 'S'}},       // USA - must be the first country code
+        { REGDOMAIN_WORLD, {'A', 'D'}},     //ANDORRA
+        { REGDOMAIN_WORLD,{'A', 'E'}},   //UAE
+        { REGDOMAIN_WORLD, {'A', 'F'}},     //AFGHANISTAN
+        { REGDOMAIN_NO_5GHZ, {'A', 'G'}},     //ANTIGUA AND BARBUDA
+        { REGDOMAIN_NO_5GHZ, {'A', 'I'}},     //ANGUILLA
+        { REGDOMAIN_WORLD, {'A', 'L'}},     //ALBANIA
+        { REGDOMAIN_NO_5GHZ, {'A', 'M'}},     //ARMENIA
+        { REGDOMAIN_WORLD, { 'A', 'N'}},     //NETHERLANDS ANTILLES
+        { REGDOMAIN_NO_5GHZ, { 'A', 'O'}},     //ANGOLA
+        { REGDOMAIN_WORLD, { 'A', 'Q'}},     //ANTARCTICA
+        { REGDOMAIN_HI_5GHZ,{ 'A', 'R'}},   //ARGENTINA
+        { REGDOMAIN_FCC, { 'A', 'S'}},     //AMERICAN SOMOA
+        { REGDOMAIN_ETSI, { 'A', 'T'}},      //AUSTRIA
+        { REGDOMAIN_APAC, { 'A', 'U'}},      //AUSTRALIA
+        { REGDOMAIN_NO_5GHZ, { 'A', 'W'}},     //ARUBA
+        { REGDOMAIN_WORLD, { 'A', 'X'}},     //ALAND ISLANDS
+        { REGDOMAIN_NO_5GHZ, { 'A', 'Z'}},     //AZERBAIJAN
+        { REGDOMAIN_WORLD, { 'B', 'A'}},     //BOSNIA AND HERZEGOVINA
+        { REGDOMAIN_WORLD, { 'B', 'B'}},     //BARBADOS
+        { REGDOMAIN_WORLD, { 'B', 'D'}},     //BANGLADESH
+        { REGDOMAIN_ETSI,  {'B', 'E'}},      //BELGIUM
+        { REGDOMAIN_WORLD, { 'B', 'F'}},     //BURKINA FASO
+        { REGDOMAIN_HI_5GHZ, {'B', 'G'}},      //BULGARIA
+        { REGDOMAIN_WORLD, { 'B', 'H'}},     //BAHRAIN
+        { REGDOMAIN_WORLD, { 'B', 'I'}},     //BURUNDI
+        { REGDOMAIN_WORLD, { 'B', 'J'}},     //BENIN
+        { REGDOMAIN_ETSI, { 'B', 'M'}},     //BERMUDA
+        { REGDOMAIN_WORLD, { 'B', 'N'}},     //BRUNEI DARUSSALAM
+        { REGDOMAIN_WORLD,{ 'B', 'O'}},   //BOLIVIA
+        { REGDOMAIN_WORLD, {'B', 'R'}},       //BRAZIL
+        { REGDOMAIN_WORLD, { 'B', 'S'}},     //BAHAMAS
+        { REGDOMAIN_WORLD, { 'B', 'T'}},     //BHUTAN
+        { REGDOMAIN_WORLD, { 'B', 'V'}},     //BOUVET ISLAND
+        { REGDOMAIN_WORLD, { 'B', 'W'}},     //BOTSWANA
+        { REGDOMAIN_WORLD, { 'B', 'Y'}},     //BELARUS
+        { REGDOMAIN_WORLD, { 'B', 'Z'}},     //BELIZE
+        { REGDOMAIN_FCC, {'C', 'A'}},       //CANADA
+        { REGDOMAIN_WORLD, { 'C', 'C'}},     //COCOS (KEELING) ISLANDS
+        { REGDOMAIN_WORLD, { 'C', 'D'}},     //CONGO, THE DEMOCRATIC REPUBLIC OF THE
+        { REGDOMAIN_WORLD, { 'C', 'F'}},     //CENTRAL AFRICAN REPUBLIC
+        { REGDOMAIN_WORLD, { 'C', 'G'}},     //CONGO
+        { REGDOMAIN_ETSI, {'C', 'H'}},      //SWITZERLAND
+        { REGDOMAIN_WORLD, { 'C', 'I'}},     //COTE D'IVOIRE
+        { REGDOMAIN_WORLD, { 'C', 'K'}},     //COOK ISLANDS
+        { REGDOMAIN_WORLD, {'C', 'L'}},       //CHILE
+        { REGDOMAIN_WORLD, { 'C', 'M'}},     //CAMEROON
+        { REGDOMAIN_HI_5GHZ, {'C', 'N'}},   //CHINA
+        { REGDOMAIN_WORLD, {'C', 'O'}},       //COLOMBIA
+        { REGDOMAIN_WORLD, {'C', 'R'}},       //COSTA RICA
+        { REGDOMAIN_WORLD, { 'C', 'U'}},     //CUBA
+        { REGDOMAIN_WORLD, { 'C', 'V'}},     //CAPE VERDE
+        { REGDOMAIN_WORLD, { 'C', 'X'}},     //CHRISTMAS ISLAND
+        { REGDOMAIN_WORLD, {'C', 'Y'}},      //CYPRUS
+        { REGDOMAIN_HI_5GHZ, {'C', 'Z'}},      //CZECH REPUBLIC
+        { REGDOMAIN_ETSI, {'D', 'E'}},      //GERMANY
+        { REGDOMAIN_WORLD, { 'D', 'J'}},     //DJIBOUTI
+        { REGDOMAIN_ETSI, {'D', 'K'}},      //DENMARK
+        { REGDOMAIN_WORLD, { 'D', 'M'}},     //DOMINICA
+        { REGDOMAIN_NO_5GHZ,{ 'D', 'O'}},   //DOMINICAN REPUBLIC
+        { REGDOMAIN_WORLD, { 'D', 'Z'}},     //ALGERIA
+        { REGDOMAIN_WORLD,{ 'E', 'C'}},   //ECUADOR
+        { REGDOMAIN_HI_5GHZ, {'E', 'E'}},      //ESTONIA
+        { REGDOMAIN_WORLD, { 'E', 'G'}},     //EGYPT
+        { REGDOMAIN_WORLD, { 'E', 'H'}},     //WESTERN SAHARA
+        { REGDOMAIN_WORLD, { 'E', 'R'}},     //ERITREA
+        { REGDOMAIN_ETSI, {'E', 'S'}},      //SPAIN
+        { REGDOMAIN_WORLD, { 'E', 'T'}},     //ETHIOPIA
+        { REGDOMAIN_WORLD, {'F', 'I'}},      //FINLAND
+        { REGDOMAIN_WORLD, { 'F', 'J'}},     //FIJI
+        { REGDOMAIN_WORLD, { 'F', 'K'}},     //FALKLAND ISLANDS (MALVINAS)
+        { REGDOMAIN_WORLD, { 'F', 'M'}},     //MICRONESIA, FEDERATED STATES OF
+        { REGDOMAIN_WORLD, { 'F', 'O'}},     //FAROE ISLANDS
+        { REGDOMAIN_ETSI, {'F', 'R'}},      //FRANCE
+        { REGDOMAIN_WORLD, { 'G', 'A'}},     //GABON
+        { REGDOMAIN_ETSI, {'G', 'B'}},      //UNITED KINGDOM
+        { REGDOMAIN_WORLD, { 'G', 'D'}},     //GRENADA
+        { REGDOMAIN_HI_5GHZ, { 'G', 'E'}},     //GEORGIA
+        { REGDOMAIN_WORLD, { 'G', 'F'}},     //FRENCH GUIANA
+        { REGDOMAIN_ETSI, {'G', 'G'}},      //GUERNSEY
+        { REGDOMAIN_WORLD, { 'G', 'H'}},     //GHANA
+        { REGDOMAIN_WORLD, {'G', 'I'}},      //GIBRALTAR
+        { REGDOMAIN_WORLD, { 'G', 'L'}},     //GREENLAND
+        { REGDOMAIN_WORLD, { 'G', 'M'}},     //GAMBIA
+        { REGDOMAIN_WORLD, { 'G', 'N'}},     //GUINEA
+        { REGDOMAIN_WORLD, { 'G', 'P'}},     //GUADELOUPE
+        { REGDOMAIN_WORLD, { 'G', 'Q'}},     //EQUATORIAL GUINEA
+        { REGDOMAIN_ETSI, {'G', 'R'}},      //GREECE
+        { REGDOMAIN_WORLD, { 'G', 'S'}},     //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
+        { REGDOMAIN_WORLD,{ 'G', 'T'}},   //GUATEMALA
+        { REGDOMAIN_WORLD, { 'G', 'U'}},     //GUAM
+        { REGDOMAIN_WORLD, { 'G', 'W'}},     //GUINEA-BISSAU
+        { REGDOMAIN_WORLD, { 'G', 'Y'}},     //GUYANA
+        { REGDOMAIN_WORLD, {'H', 'K'}},      //HONGKONG
+        { REGDOMAIN_WORLD, { 'H', 'M'}},     //HEARD ISLAND AND MCDONALD ISLANDS
+        { REGDOMAIN_WORLD,{'H', 'N'}},   //HONDURAS
+        { REGDOMAIN_HI_5GHZ, {'H', 'R'}},      //CROATIA
+        { REGDOMAIN_WORLD, { 'H', 'T'}},     //HAITI
+        { REGDOMAIN_HI_5GHZ, {'H', 'U'}},      //HUNGARY
+        { REGDOMAIN_APAC, { 'I', 'D'}},     //INDONESIA
+        { REGDOMAIN_ETSI, {'I', 'E'}},     //IRELAND
+        { REGDOMAIN_WORLD, {'I', 'L'}},        //ISREAL
+        { REGDOMAIN_ETSI, {'I', 'M'}},      //ISLE OF MAN
+        { REGDOMAIN_APAC, {'I', 'N'}},      //INDIA
+        { REGDOMAIN_ETSI, { 'I', 'O'}},     //BRITISH INDIAN OCEAN TERRITORY
+        { REGDOMAIN_WORLD, { 'I', 'Q'}},     //IRAQ
+        { REGDOMAIN_WORLD, { 'I', 'R'}},     //IRAN, ISLAMIC REPUBLIC OF
+        { REGDOMAIN_WORLD, {'I', 'S'}},      //ICELAND
+        { REGDOMAIN_ETSI, {'I', 'T'}},      //ITALY
+        { REGDOMAIN_ETSI, {'J', 'E'}},      //JERSEY
+        { REGDOMAIN_WORLD, { 'J', 'M'}},     //JAMAICA
+        { REGDOMAIN_WORLD, { 'J', 'O'}},     //JORDAN
+        { REGDOMAIN_JAPAN, {'J', 'P'}},     //JAPAN
+        { REGDOMAIN_WORLD, { 'K', 'E'}},     //KENYA
+        { REGDOMAIN_WORLD, { 'K', 'G'}},     //KYRGYZSTAN
+        { REGDOMAIN_WORLD, { 'K', 'H'}},     //CAMBODIA
+        { REGDOMAIN_WORLD, { 'K', 'I'}},     //KIRIBATI
+        { REGDOMAIN_WORLD, { 'K', 'M'}},     //COMOROS
+        { REGDOMAIN_WORLD, { 'K', 'N'}},     //SAINT KITTS AND NEVIS
+        { REGDOMAIN_KOREA, { 'K', 'P'}},     //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
+        { REGDOMAIN_KOREA, {'K', 'R'}},     //KOREA, REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'K', 'W'}},     //KUWAIT
+        { REGDOMAIN_WORLD, { 'K', 'Y'}},     //CAYMAN ISLANDS
+        { REGDOMAIN_WORLD, { 'K', 'Z'}},     //KAZAKHSTAN
+        { REGDOMAIN_WORLD, { 'L', 'A'}},     //LAO PEOPLE'S DEMOCRATIC REPUBLIC
+        { REGDOMAIN_WORLD, { 'L', 'B'}},     //LEBANON
+        { REGDOMAIN_WORLD, { 'L', 'C'}},     //SAINT LUCIA
+        { REGDOMAIN_ETSI, {'L', 'I'}},      //LIECHTENSTEIN
+        { REGDOMAIN_WORLD, { 'L', 'K'}},     //SRI LANKA
+        { REGDOMAIN_WORLD, { 'L', 'R'}},     //LIBERIA
+        { REGDOMAIN_WORLD, { 'L', 'S'}},     //LESOTHO
+        { REGDOMAIN_HI_5GHZ, {'L', 'T'}},      //LITHUANIA
+        { REGDOMAIN_ETSI, {'L', 'U'}},      //LUXEMBOURG
+        { REGDOMAIN_HI_5GHZ, {'L', 'V'}},      //LATVIA
+        { REGDOMAIN_WORLD, { 'L', 'Y'}},     //LIBYAN ARAB JAMAHIRIYA
+        { REGDOMAIN_WORLD, { 'M', 'A'}},     //MOROCCO
+        { REGDOMAIN_ETSI, {'M', 'C'}},      //MONACO
+        { REGDOMAIN_WORLD, { 'M', 'D'}},     //MOLDOVA, REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'M', 'E'}},     //MONTENEGRO
+        { REGDOMAIN_WORLD, { 'M', 'G'}},     //MADAGASCAR
+        { REGDOMAIN_WORLD, { 'M', 'H'}},     //MARSHALL ISLANDS
+        { REGDOMAIN_WORLD, { 'M', 'K'}},     //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'M', 'L'}},     //MALI
+        { REGDOMAIN_WORLD, { 'M', 'M'}},     //MYANMAR
+        { REGDOMAIN_HI_5GHZ, { 'M', 'N'}},     //MONGOLIA
+        { REGDOMAIN_WORLD, { 'M', 'O'}},     //MACAO
+        { REGDOMAIN_WORLD, { 'M', 'P'}},     //NORTHERN MARIANA ISLANDS
+        { REGDOMAIN_WORLD, { 'M', 'Q'}},     //MARTINIQUE
+        { REGDOMAIN_WORLD, { 'M', 'R'}},     //MAURITANIA
+        { REGDOMAIN_WORLD, { 'M', 'S'}},     //MONTSERRAT
+        { REGDOMAIN_WORLD, {'M', 'T'}},      //MALTA
+        { REGDOMAIN_WORLD, { 'M', 'U'}},     //MAURITIUS
+        { REGDOMAIN_WORLD, { 'M', 'V'}},     //MALDIVES
+        { REGDOMAIN_WORLD, { 'M', 'W'}},     //MALAWI
+        { REGDOMAIN_WORLD, {'M', 'X'}},       //MEXICO
+        { REGDOMAIN_HI_5GHZ,{ 'M', 'Y'}},   //MALAYSIA
+        { REGDOMAIN_WORLD, { 'M', 'Z'}},     //MOZAMBIQUE
+        { REGDOMAIN_WORLD, { 'N', 'A'}},     //NAMIBIA
+        { REGDOMAIN_WORLD, { 'N', 'C'}},     //NEW CALEDONIA
+        { REGDOMAIN_WORLD, { 'N', 'E'}},     //NIGER
+        { REGDOMAIN_WORLD, { 'N', 'F'}},     //NORFOLD ISLAND
+        { REGDOMAIN_WORLD, { 'N', 'G'}},     //NIGERIA
+        { REGDOMAIN_WORLD,{ 'N', 'I'}},       //NICARAGUA
+        { REGDOMAIN_ETSI, {'N', 'L'}},      //NETHERLANDS
+        { REGDOMAIN_WORLD, {'N', 'O'}},      //NORWAY
+        { REGDOMAIN_WORLD, { 'N', 'P'}},     //NEPAL
+        { REGDOMAIN_WORLD, { 'N', 'R'}},     //NAURU
+        { REGDOMAIN_WORLD, { 'N', 'U'}},     //NIUE
+        { REGDOMAIN_ETSI, {'N', 'Z'}},      //NEW ZEALAND
+        { REGDOMAIN_WORLD, { 'O', 'M'}},     //OMAN
+        { REGDOMAIN_WORLD, {'P', 'A'}},       //PANAMA
+        { REGDOMAIN_WORLD,{ 'P', 'E'}},   //PERU
+        { REGDOMAIN_WORLD, { 'P', 'F'}},     //FRENCH POLYNESIA
+        { REGDOMAIN_WORLD, { 'P', 'G'}},     //PAPUA NEW GUINEA
+        { REGDOMAIN_WORLD, {'P', 'H'}},      //PHILIPPINES
+        { REGDOMAIN_WORLD, { 'P', 'K'}},     //PAKISTAN
+        { REGDOMAIN_ETSI, {'P', 'L'}},      //POLAND
+        { REGDOMAIN_WORLD, { 'P', 'M'}},     //SAINT PIERRE AND MIQUELON
+        { REGDOMAIN_WORLD, { 'P', 'N'}},     //WORLDPITCAIRN
+        { REGDOMAIN_FCC, {'P', 'R'}},       //PUERTO RICO
+        { REGDOMAIN_WORLD, {'P', 'S'}},        //PALESTINIAN TERRITORY, OCCUPIED
+        { REGDOMAIN_ETSI, {'P', 'T'}},      //PORTUGAL
+        { REGDOMAIN_WORLD, { 'P', 'W'}},     //PALAU
+        { REGDOMAIN_WORLD, { 'P', 'Y'}},     //PARAGUAY
+        { REGDOMAIN_WORLD, { 'Q', 'A'}},     //QATAR
+        { REGDOMAIN_WORLD, { 'R', 'E'}},     //REUNION
+        { REGDOMAIN_HI_5GHZ, {'R', 'O'}},      //ROMANIA
+        { REGDOMAIN_HI_5GHZ, {'R', 'S'}},      //SERBIA
+        { REGDOMAIN_WORLD, {'R', 'U'}},   //RUSSIA
+        { REGDOMAIN_WORLD, { 'R', 'W'}},     //RWANDA
+        { REGDOMAIN_WORLD, {'S', 'A'}},      //SAUDI ARABIA
+        { REGDOMAIN_WORLD, { 'S', 'B'}},     //SOLOMON ISLANDS
+        { REGDOMAIN_ETSI, {'S', 'C'}},      //SEYCHELLES
+        { REGDOMAIN_WORLD, { 'S', 'D'}},     //SUDAN
+        { REGDOMAIN_ETSI, {'S', 'E'}},      //SWEDEN
+        { REGDOMAIN_APAC, {'S', 'G'}},      //SINGAPORE
+        { REGDOMAIN_WORLD, { 'S', 'H'}},     //SAINT HELENA
+        { REGDOMAIN_HI_5GHZ, {'S', 'I'}},      //SLOVENNIA
+        { REGDOMAIN_WORLD, { 'S', 'J'}},     //SVALBARD AND JAN MAYEN
+        { REGDOMAIN_ETSI, {'S', 'K'}},      //SLOVAKIA
+        { REGDOMAIN_WORLD, { 'S', 'L'}},     //SIERRA LEONE
+        { REGDOMAIN_WORLD, { 'S', 'M'}},     //SAN MARINO
+        { REGDOMAIN_WORLD, { 'S', 'N'}},     //SENEGAL
+        { REGDOMAIN_WORLD, { 'S', 'O'}},     //SOMALIA
+        { REGDOMAIN_WORLD, { 'S', 'R'}},     //SURINAME
+        { REGDOMAIN_WORLD, { 'S', 'T'}},     //SAO TOME AND PRINCIPE
+        { REGDOMAIN_WORLD, {'S', 'V'}},       //EL SALVADOR
+        { REGDOMAIN_WORLD, { 'S', 'Y'}},     //SYRIAN ARAB REPUBLIC
+        { REGDOMAIN_WORLD, { 'S', 'Z'}},     //SWAZILAND
+        { REGDOMAIN_WORLD, { 'T', 'C'}},     //TURKS AND CAICOS ISLANDS
+        { REGDOMAIN_WORLD, { 'T', 'D'}},     //CHAD
+        { REGDOMAIN_WORLD, { 'T', 'F'}},     //FRENCH SOUTHERN TERRITORIES
+        { REGDOMAIN_WORLD, { 'T', 'G'}},     //TOGO
+        { REGDOMAIN_WORLD,{ 'T', 'H'}},   //THAILAND
+        { REGDOMAIN_WORLD, { 'T', 'J'}},     //TAJIKISTAN
+        { REGDOMAIN_WORLD, { 'T', 'K'}},     //TOKELAU
+        { REGDOMAIN_WORLD, { 'T', 'L'}},     //TIMOR-LESTE
+        { REGDOMAIN_WORLD, { 'T', 'M'}},     //TURKMENISTAN
+        { REGDOMAIN_WORLD, { 'T', 'N'}},     //TUNISIA
+        { REGDOMAIN_WORLD, { 'T', 'O'}},     //TONGA
+        { REGDOMAIN_WORLD, {'T', 'R'}},      //TURKEY
+        { REGDOMAIN_WORLD, { 'T', 'T'}},     //TRINIDAD AND TOBAGO
+        { REGDOMAIN_WORLD, { 'T', 'V'}},     //TUVALU
+        { REGDOMAIN_HI_5GHZ,{ 'T', 'W'}},   //TAIWAN, PROVINCE OF CHINA
+        { REGDOMAIN_WORLD, { 'T', 'Z'}},     //TANZANIA, UNITED REPUBLIC OF
+        { REGDOMAIN_HI_5GHZ,{ 'U', 'A'}},   //UKRAINE
+        { REGDOMAIN_WORLD, { 'U', 'G'}},     //UGANDA
+        { REGDOMAIN_FCC, {'U', 'M'}},       //UNITED STATES MINOR OUTLYING ISLANDS
+        { REGDOMAIN_WORLD,{ 'U', 'Y'}},   //URUGUAY
+        { REGDOMAIN_HI_5GHZ, { 'U', 'Z'}},     //UZBEKISTAN
+        { REGDOMAIN_ETSI, {'V', 'A'}},      //HOLY SEE (VATICAN CITY STATE)
+        { REGDOMAIN_WORLD, { 'V', 'C'}},     //SAINT VINCENT AND THE GRENADINES
+        { REGDOMAIN_HI_5GHZ,{ 'V', 'E'}},   //VENEZUELA
+        { REGDOMAIN_ETSI, {'V', 'G'}},       //VIRGIN ISLANDS, BRITISH
+        { REGDOMAIN_FCC, {'V', 'I'}},       //VIRGIN ISLANDS, US
+        { REGDOMAIN_WORLD, {'V', 'N'}},      //VIET NAM
+        { REGDOMAIN_WORLD, { 'V', 'U'}},     //VANUATU
+        { REGDOMAIN_WORLD, { 'W', 'F'}},     //WALLIS AND FUTUNA
+        { REGDOMAIN_WORLD, { 'W', 'S'}},     //SOMOA
+        { REGDOMAIN_WORLD, { 'Y', 'E'}},     //YEMEN
+        { REGDOMAIN_WORLD, { 'Y', 'T'}},     //MAYOTTE
+        { REGDOMAIN_WORLD, {'Z', 'A'}},      //SOUTH AFRICA
+        { REGDOMAIN_WORLD, { 'Z', 'M'}},     //ZAMBIA
+        { REGDOMAIN_WORLD, { 'Z', 'W'}},     //ZIMBABWE
+        { REGDOMAIN_KOREA, {'K', '1'}},     //Korea alternate 1
+        { REGDOMAIN_KOREA, {'K', '2'}},     //Korea alternate 2
+        { REGDOMAIN_KOREA, {'K', '3'}},     //Korea alternate 3
+        { REGDOMAIN_KOREA, {'K', '4'}},      //Korea alternate 4
+        { REGDOMAIN_ETSI, {'E', 'U'}},       //Europe (SSGFI)
+        { REGDOMAIN_JAPAN, {'J', '1'}},     //Japan alternate 1
+        { REGDOMAIN_JAPAN, {'J', '2'}},     //Japan alternate 2
+        { REGDOMAIN_JAPAN, {'J', '3'}},     //Japan alternate 3
+        { REGDOMAIN_JAPAN, {'J', '4'}},     //Japan alternate 4
+        { REGDOMAIN_JAPAN, {'J', '5'}}      //Japan alternate 5
+    }
+};
+typedef struct nvEFSTable_s
+{
+   v_U32_t    nvValidityBitmap;
+   sHalNv     halnv;
+} nvEFSTable_t;
+nvEFSTable_t *gnvEFSTable=NULL;
+/* EFS Table  to send the NV structure to HAL*/ 
+static nvEFSTable_t *pnvEFSTable =NULL;
+
+const tRfChannelProps rfChannels[NUM_RF_CHANNELS] =
+{
+    //RF_SUBBAND_2_4_GHZ
+    //freq, chan#, band
+    { 2412, 1  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_1,
+    { 2417, 2  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_2,
+    { 2422, 3  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_3,
+    { 2427, 4  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_4,
+    { 2432, 5  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_5,
+    { 2437, 6  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_6,
+    { 2442, 7  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_7,
+    { 2447, 8  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_8,
+    { 2452, 9  , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_9,
+    { 2457, 10 , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_10,
+    { 2462, 11 , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_11,
+    { 2467, 12 , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_12,
+    { 2472, 13 , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_13,
+    { 2484, 14 , RF_SUBBAND_2_4_GHZ},        //RF_CHAN_14,
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    { 0,    240, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_240,
+    { 0,    244, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_244,
+    { 0,    248, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_248,
+    { 0,    252, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_252,
+    { 0,    208, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_208,
+    { 0,    212, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_212,
+    { 0,    216, RF_SUBBAND_4_9_GHZ},        //RF_CHAN_216,
+    { 5180, 36 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_36,
+    { 5200, 40 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_40,
+    { 5220, 44 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_44,
+    { 5240, 48 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_48,
+    { 5260, 52 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_52,
+    { 5280, 56 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_56,
+    { 5300, 60 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_60,
+    { 5320, 64 , RF_SUBBAND_5_LOW_GHZ},      //RF_CHAN_64,
+    { 5500, 100, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_100,
+    { 5520, 104, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_104,
+    { 5540, 108, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_108,
+    { 5560, 112, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_112,
+    { 5580, 116, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_116,
+    { 5600, 120, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_120,
+    { 5620, 124, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_124,
+    { 5640, 128, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_128,
+    { 5660, 132, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_132,
+    { 5680, 136, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_136,
+    { 5700, 140, RF_SUBBAND_5_MID_GHZ},      //RF_CHAN_140,
+    { 5745, 149, RF_SUBBAND_5_HIGH_GHZ},     //RF_CHAN_149,
+    { 5765, 153, RF_SUBBAND_5_HIGH_GHZ},     //RF_CHAN_153,
+    { 5785, 157, RF_SUBBAND_5_HIGH_GHZ},     //RF_CHAN_157,
+    { 5805, 161, RF_SUBBAND_5_HIGH_GHZ},     //RF_CHAN_161,
+    { 5825, 165, RF_SUBBAND_5_HIGH_GHZ},     //RF_CHAN_165,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_3,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_4,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_5,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_6,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_7,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_8,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_9,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_10,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_11,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_242,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_246,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_250,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_210,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_214,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_38,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_42,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_46,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_50,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_54,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_58,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_62,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_102,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_106,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_110,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_114,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_118,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_122,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_126,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_130,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_134,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_138,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_151,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_155,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_159,
+    { 0   , 0  , NUM_RF_SUBBANDS},           //RF_CHAN_BOND_163,
+#endif
+};
+
+extern const sHalNv nvDefaults;
+
+const sRegulatoryChannel * regChannels = nvDefaults.tables.regDomains[0].channels;
+
+/*----------------------------------------------------------------------------
+   Function Definitions and Documentation
+ * -------------------------------------------------------------------------*/
+VOS_STATUS wlan_write_to_efs (v_U8_t *pData, v_U16_t data_len);
+/**------------------------------------------------------------------------
+  \brief vos_nv_init() - initialize the NV module
+  The \a vos_nv_init() initializes the NV module.  This read the binary
+  file for country code and regulatory domain information.
+  \return VOS_STATUS_SUCCESS - module is initialized successfully
+          otherwise  - module is not initialized
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_init(void)
+{
+   return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS vos_nv_open(void)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    v_CONTEXT_t pVosContext= NULL;
+    v_SIZE_t bufSize;
+    v_BOOL_t itemIsValid = VOS_FALSE;
+    
+    /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+    bufSize = sizeof(nvEFSTable_t);
+    status = hdd_request_firmware(WLAN_NV_FILE,
+                                  ((VosContextType*)(pVosContext))->pHDDContext,
+                                  (v_VOID_t**)&gnvEFSTable, &bufSize);
+
+    if ( (!VOS_IS_STATUS_SUCCESS( status )) || !gnvEFSTable)
+    {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "%s: unable to download NV file %s",
+                   __FUNCTION__, WLAN_NV_FILE);
+         return VOS_STATUS_E_RESOURCES;
+    }
+
+     /* Copying the read nv data to the globa NV EFS table */
+    {
+        /* Allocate memory to global NV table */
+        pnvEFSTable = (nvEFSTable_t *)vos_mem_malloc(sizeof(nvEFSTable_t));
+        if (NULL == pnvEFSTable)
+        {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                      "%s : failed to allocate memory for NV", __FUNCTION__);
+            return VOS_STATUS_E_NOMEM;
+        }
+
+        /*Copying the NV defaults */
+        vos_mem_copy(&(pnvEFSTable->halnv),&nvDefaults,sizeof(sHalNv));
+        pnvEFSTable->nvValidityBitmap = gnvEFSTable->nvValidityBitmap;
+
+        /* Copy the valid fields to the NV Global structure */ 
+        if (vos_nv_getValidity(VNV_FIELD_IMAGE, &itemIsValid) == 
+           VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE) {
+
+                if(vos_nv_read( VNV_FIELD_IMAGE, (v_VOID_t *)&pnvEFSTable->halnv.fields,
+                   NULL, sizeof(sNvFields) ) != VOS_STATUS_SUCCESS)
+                   return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_RATE_TO_POWER_TABLE, &itemIsValid) == 
+             VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_RATE_TO_POWER_TABLE, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.pwrOptimum[0],
+                  NULL, sizeof(tRateGroupPwr) * NUM_RF_SUBBANDS ) != VOS_STATUS_SUCCESS)
+               return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_REGULARTORY_DOMAIN_TABLE, &itemIsValid) == 
+               VOS_STATUS_SUCCESS)
+        {
+    
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_REGULARTORY_DOMAIN_TABLE,
+                (v_VOID_t *)&pnvEFSTable->halnv.tables.regDomains[0],
+                 NULL, sizeof(sRegulatoryDomains) * NUM_REG_DOMAINS ) != VOS_STATUS_SUCCESS)
+                    return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_DEFAULT_LOCATION, &itemIsValid) == 
+            VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_DEFAULT_LOCATION,
+                (v_VOID_t *)&pnvEFSTable->halnv.tables.defaultCountryTable,
+                NULL, sizeof(sDefaultCountry) ) !=  VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+    
+        if (vos_nv_getValidity(VNV_TPC_POWER_TABLE, &itemIsValid) == 
+            VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_TPC_POWER_TABLE, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.plutCharacterized[0],
+                  NULL, sizeof(tTpcPowerTable) * NUM_RF_CHANNELS ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+    
+        if (vos_nv_getValidity(VNV_TPC_PDADC_OFFSETS, &itemIsValid) == 
+            VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_TPC_PDADC_OFFSETS,
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.plutPdadcOffset[0],
+                  NULL, sizeof(tANI_U16) * NUM_RF_CHANNELS ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+        if (vos_nv_getValidity(VNV_RSSI_CHANNEL_OFFSETS, &itemIsValid) == 
+           VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_RSSI_CHANNEL_OFFSETS,
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.rssiChanOffsets[0],
+                  NULL, sizeof(sRssiChannelOffsets) * 2 ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+    
+        if (vos_nv_getValidity(VNV_RF_CAL_VALUES, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_RF_CAL_VALUES, (v_VOID_t *)&pnvEFSTable->halnv
+    .tables.rFCalValues, NULL, sizeof(sRFCalValues) ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_ANTENNA_PATH_LOSS, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_ANTENNA_PATH_LOSS,
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.antennaPathLoss[0], NULL, 
+                sizeof(tANI_S16)*NUM_RF_CHANNELS ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+        if (vos_nv_getValidity(VNV_PACKET_TYPE_POWER_LIMITS, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_PACKET_TYPE_POWER_LIMITS, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.pktTypePwrLimits[0], NULL, 
+                sizeof(tANI_S16)*NUM_802_11_MODES*NUM_RF_CHANNELS ) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_OFDM_CMD_PWR_OFFSET, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+                if(vos_nv_read( VNV_OFDM_CMD_PWR_OFFSET, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.ofdmCmdPwrOffset, NULL, 
+                                sizeof(sOfdmCmdPwrOffset)) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+
+        if (vos_nv_getValidity(VNV_TX_BB_FILTER_MODE, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+               if(vos_nv_read(VNV_TX_BB_FILTER_MODE, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.txbbFilterMode, NULL, 
+                sizeof(sTxBbFilterMode)) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+        if (vos_nv_getValidity(VNV_TABLE_VIRTUAL_RATE, &itemIsValid) == 
+         VOS_STATUS_SUCCESS)
+        {
+            if (itemIsValid == VOS_TRUE)
+            {
+               if(vos_nv_read(VNV_TABLE_VIRTUAL_RATE, 
+                  (v_VOID_t *)&pnvEFSTable->halnv.tables.pwrOptimum_virtualRate, NULL, 
+                sizeof(gnvEFSTable->halnv.tables.pwrOptimum_virtualRate)) != VOS_STATUS_SUCCESS)
+                     return (eHAL_STATUS_FAILURE);
+            }
+        }
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+VOS_STATUS vos_nv_close(void)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    v_CONTEXT_t pVosContext= NULL;
+         /*Get the global context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+    status = hdd_release_firmware(WLAN_NV_FILE, ((VosContextType*)(pVosContext))->pHDDContext);
+    if ( !VOS_IS_STATUS_SUCCESS( status ))
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                         "%s : vos_open failed\n",__func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    vos_mem_free(pnvEFSTable);
+    gnvEFSTable=NULL;
+    return VOS_STATUS_SUCCESS;
+}
+/**------------------------------------------------------------------------
+  \brief vos_nv_getRegDomainFromCountryCode() - get the regulatory domain of
+  a country given its country code
+  The \a vos_nv_getRegDomainFromCountryCode() returns the regulatory domain of
+  a country given its country code.  This is done from reading a cached
+  copy of the binary file.
+  \param pRegDomain  - pointer to regulatory domain
+  \param countryCode - country code
+  \return VOS_STATUS_SUCCESS - regulatory domain is found for the given country
+          VOS_STATUS_E_FAULT - invalid pointer error
+          VOS_STATUS_E_EMPTY - country code table is empty
+          VOS_STATUS_E_EXISTS - given country code does not exist in table
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getRegDomainFromCountryCode( v_REGDOMAIN_t *pRegDomain,
+      const v_COUNTRYCODE_t countryCode )
+{
+   int i;
+   // sanity checks
+   if (NULL == pRegDomain)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            ("Invalid reg domain pointer\r\n") );
+      return VOS_STATUS_E_FAULT;
+   }
+   *pRegDomain = REGDOMAIN_COUNT;
+
+   if (NULL == countryCode)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            ("Country code array is NULL\r\n") );
+      return VOS_STATUS_E_FAULT;
+   }
+   if (0 == countryInfoTable.countryCount)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            ("Reg domain table is empty\r\n") );
+      return VOS_STATUS_E_EMPTY;
+   }
+   // iterate the country info table until end of table or the country code
+   // is found
+   for (i = 0; i < countryInfoTable.countryCount &&
+         REGDOMAIN_COUNT == *pRegDomain; i++)
+   {
+      if (memcmp(countryCode, countryInfoTable.countryInfo[i].countryCode,
+               VOS_COUNTRY_CODE_LEN) == 0)
+      {
+         // country code is found
+         *pRegDomain = countryInfoTable.countryInfo[i].regDomain;
+      }
+   }
+   if (REGDOMAIN_COUNT != *pRegDomain)
+   {
+      return VOS_STATUS_SUCCESS;
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+            ("country code is not found\r\n"));
+      return VOS_STATUS_E_EXISTS;
+   }
+}
+/**------------------------------------------------------------------------
+  \brief vos_nv_getSupportedCountryCode() - get the list of supported
+  country codes
+  The \a vos_nv_getSupportedCountryCode() encodes the list of supported
+  country codes with paddings in the provided buffer
+  \param pBuffer     - pointer to buffer where supported country codes
+                       and paddings are encoded; this may be set to NULL
+                       if user wishes to query the required buffer size to
+                       get the country code list
+  \param pBufferSize - this is the provided buffer size on input;
+                       this is the required or consumed buffer size on output
+  \return VOS_STATUS_SUCCESS - country codes are successfully encoded
+          VOS_STATUS_E_NOMEM - country codes are not encoded because either
+                               the buffer is NULL or buffer size is
+                               sufficient
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getSupportedCountryCode( v_BYTE_t *pBuffer, v_SIZE_t *pBufferSize,
+      v_SIZE_t paddingSize )
+{
+   v_SIZE_t providedBufferSize = *pBufferSize;
+   int i;
+   // pBufferSize now points to the required buffer size
+   *pBufferSize = countryInfoTable.countryCount * (VOS_COUNTRY_CODE_LEN + paddingSize );
+   if ( NULL == pBuffer || providedBufferSize < *pBufferSize )
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            ("Insufficient memory for country code list\r\n"));
+      return VOS_STATUS_E_NOMEM;
+   }
+   for (i = 0; i < countryInfoTable.countryCount; i++)
+   {
+      memcpy( pBuffer, countryInfoTable.countryInfo[i].countryCode, VOS_COUNTRY_CODE_LEN );
+      pBuffer += (VOS_COUNTRY_CODE_LEN + paddingSize );
+   }
+   return VOS_STATUS_SUCCESS;
+}
+/**------------------------------------------------------------------------
+  \brief vos_nv_readTxAntennaCount() - return number of TX antenna
+  \param pTxAntennaCount   - antenna count
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readTxAntennaCount( v_U8_t *pTxAntennaCount )
+{
+   sNvFields fieldImage;
+   VOS_STATUS status;
+   status = vos_nv_read( VNV_FIELD_IMAGE, &fieldImage, NULL,
+         sizeof(fieldImage) );
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      *pTxAntennaCount = fieldImage.numOfTxChains;
+   }
+   return status;
+}
+/**------------------------------------------------------------------------
+  \brief vos_nv_readRxAntennaCount() - return number of RX antenna
+  \param pRxAntennaCount   - antenna count
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readRxAntennaCount( v_U8_t *pRxAntennaCount )
+{
+   sNvFields fieldImage;
+   VOS_STATUS status;
+   status = vos_nv_read( VNV_FIELD_IMAGE, &fieldImage, NULL,
+         sizeof(fieldImage) );
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      *pRxAntennaCount = fieldImage.numOfRxChains;
+   }
+   return status;
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_readMacAddress() - return the MAC address
+  \param pMacAddress - MAC address
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readMacAddress( v_MAC_ADDRESS_t pMacAddress )
+{
+   sNvFields fieldImage;
+   VOS_STATUS status;
+   status = vos_nv_read( VNV_FIELD_IMAGE, &fieldImage, NULL,
+         sizeof(fieldImage) );
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      memcpy( pMacAddress, fieldImage.macAddr, VOS_MAC_ADDRESS_LEN );
+   }
+   else
+   {
+      //This part of the code can be removed when NV is programmed
+      const v_U8_t macAddr[VOS_MAC_ADDRESS_LEN] = VOS_HARD_CODED_MAC;
+      memcpy( pMacAddress, macAddr, VOS_MAC_ADDRESS_LEN );
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+          " fail to get MAC address from NV, hardcoded to %02X-%02X-%02X-%02X-%02X%02X",
+          macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], macAddr[5]);
+      status = VOS_STATUS_SUCCESS;
+   }
+   return status;
+}
+
+/**------------------------------------------------------------------------
+
+  \brief vos_nv_readMultiMacAddress() - return the Multiple MAC addresses
+
+  \param pMacAddress - MAC address
+  \param macCount - Count of valid MAC addresses to get from NV field
+
+  \return status of the NV read operation
+
+  \sa
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readMultiMacAddress( v_U8_t *pMacAddress,
+                                              v_U8_t  macCount )
+{
+   sNvFields   fieldImage;
+   VOS_STATUS  status;
+   v_U8_t      countLoop;
+   v_U8_t     *pNVMacAddress;
+
+   if((0 == macCount) || (VOS_MAX_CONCURRENCY_PERSONA < macCount) ||
+      (NULL == pMacAddress))
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          " Invalid Parameter from NV Client macCount %d, pMacAddress 0x%x",
+          macCount, pMacAddress);
+   }
+
+   status = vos_nv_read( VNV_FIELD_IMAGE, &fieldImage, NULL,
+                         sizeof(fieldImage) );
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      pNVMacAddress = fieldImage.macAddr;
+      for(countLoop = 0; countLoop < macCount; countLoop++)
+      {
+         vos_mem_copy(pMacAddress + (countLoop * VOS_MAC_ADDRESS_LEN),
+                      pNVMacAddress + (countLoop * VOS_MAC_ADDRESS_LEN),
+                      VOS_MAC_ADDRESS_LEN);
+      }
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "vos_nv_readMultiMacAddress Get NV Field Fail");
+   }
+
+   return status;
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_setValidity() - set the validity of an NV item.
+  The \a vos_nv_setValidity() validates and invalidates an NV item.  The
+  validity information is stored in NV memory.
+  One would get the VOS_STATUS_E_EXISTS error when reading an invalid item.
+  An item becomes valid when one has written to it successfully.
+  \param type        - NV item type
+  \param itemIsValid - boolean value indicating the item's validity
+  \return VOS_STATUS_SUCCESS - validity is set successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+  -------------------------------------------------------------------------*/
+#ifndef WLAN_FTM_STUB
+
+VOS_STATUS vos_nv_setValidity( VNV_TYPE type, v_BOOL_t itemIsValid )
+{
+   v_U32_t lastNvValidityBitmap;
+   v_U32_t newNvValidityBitmap;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   // check if the current NV type is valid
+   if (VNV_TYPE_COUNT < type)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            ("vos_nv_setValidity: invalid type=%d\r\n"), type );
+      return VOS_STATUS_E_INVAL;
+   }
+   // read the validity bitmap
+   lastNvValidityBitmap = gnvEFSTable->nvValidityBitmap;
+   // modify the validity bitmap
+   if (itemIsValid)
+   {
+       newNvValidityBitmap = lastNvValidityBitmap | (1 << type);
+              // commit to NV store if bitmap has been modified
+       if (newNvValidityBitmap != lastNvValidityBitmap)
+       {
+           gnvEFSTable->nvValidityBitmap = newNvValidityBitmap;
+       }
+   }
+   else
+   {
+       newNvValidityBitmap = lastNvValidityBitmap & (~(1 << type));
+       if (newNvValidityBitmap != lastNvValidityBitmap)
+       {
+           gnvEFSTable->nvValidityBitmap = newNvValidityBitmap;
+           status = wlan_write_to_efs((v_U8_t*)gnvEFSTable,sizeof(nvEFSTable_t));
+           if (! VOS_IS_STATUS_SUCCESS(status)) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, ("vos_nv_write_to_efs failed!!!\r\n"));
+               status = VOS_STATUS_E_FAULT;
+           }
+       }
+   }
+
+   return status;
+}
+#endif
+/**------------------------------------------------------------------------
+  \brief vos_nv_getValidity() - get the validity of an NV item.
+  The \a vos_nv_getValidity() indicates if an NV item is valid.  The
+  validity information is stored in NV memory.
+  One would get the VOS_STATUS_E_EXISTS error when reading an invalid item.
+  An item becomes valid when one has written to it successfully.
+  \param type        - NV item type
+  \param pItemIsValid- pointer to the boolean value indicating the item's
+                       validity
+  \return VOS_STATUS_SUCCESS - validity is determined successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getValidity( VNV_TYPE type, v_BOOL_t *pItemIsValid )
+{
+   v_U32_t nvValidityBitmap = gnvEFSTable->nvValidityBitmap;
+   // check if the current NV type is valid
+   if (NUM_NV_TABLE_IDS < type)
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            ("vos_nv_getValidity: invalid type=%d\r\n"), type );
+      return VOS_STATUS_E_INVAL;
+   }
+   *pItemIsValid = (v_BOOL_t)((nvValidityBitmap >> type) & 1);
+   return VOS_STATUS_SUCCESS;
+}
+/**------------------------------------------------------------------------
+  \brief vos_nv_read() - read a NV item to an output buffer
+  The \a vos_nv_read() reads a NV item to an output buffer.  If the item is
+  an array, this function would read the entire array. One would get a
+  VOS_STATUS_E_EXISTS error when reading an invalid item.
+  For error conditions of VOS_STATUS_E_EXISTS and VOS_STATUS_E_FAILURE,
+  if a default buffer is provided (with a non-NULL value),
+  the default buffer content is copied to the output buffer.
+  \param type  - NV item type
+  \param outputBuffer   - output buffer
+  \param defaultBuffer  - default buffer
+  \param bufferSize  - output buffer size
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - defaultBuffer point is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE - unknown error
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_read( VNV_TYPE type, v_VOID_t *outputVoidBuffer,
+      v_VOID_t *defaultBuffer, v_SIZE_t bufferSize )
+{
+    VOS_STATUS status             = VOS_STATUS_SUCCESS;
+    v_SIZE_t itemSize;
+    v_BOOL_t itemIsValid = VOS_TRUE;
+
+    // sanity check
+    if (VNV_TYPE_COUNT < type)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("vos_nv_setValidity: invalid type=%d\r\n"), type );
+       return VOS_STATUS_E_INVAL;
+    }
+    if (NULL == outputVoidBuffer)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("Buffer provided is NULL\r\n") );
+       return VOS_STATUS_E_FAULT;
+    }
+    if (0 == bufferSize)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("NV type=%d is invalid\r\n"), type );
+       return VOS_STATUS_E_INVAL;
+    }
+    // check if the NV item has valid data
+    status = vos_nv_getValidity( type, &itemIsValid );
+   if (!itemIsValid)
+   {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+            "NV type=%d does not have valid data\r\n", type );
+       return VOS_STATUS_E_EMPTY;
+   }
+   switch(type)
+   {
+       case VNV_FIELD_IMAGE:
+           itemSize = sizeof(gnvEFSTable->halnv.fields);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.fields,bufferSize);
+           }
+           break;
+       case VNV_RATE_TO_POWER_TABLE:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.pwrOptimum);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.pwrOptimum[0],bufferSize);
+           }
+           break;
+       case VNV_REGULARTORY_DOMAIN_TABLE:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.regDomains);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.regDomains[0],bufferSize);
+           }
+           break;
+       case VNV_DEFAULT_LOCATION:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.defaultCountryTable);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.defaultCountryTable,bufferSize);
+           }
+           break;
+       case VNV_TPC_POWER_TABLE:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.plutCharacterized);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.plutCharacterized[0],bufferSize);
+           }
+           break;
+       case VNV_TPC_PDADC_OFFSETS:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.plutPdadcOffset);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.plutPdadcOffset[0],bufferSize);
+           }
+           break;
+       case VNV_RSSI_CHANNEL_OFFSETS:
+
+           itemSize = sizeof(gnvEFSTable->halnv.tables.rssiChanOffsets);
+
+           if(bufferSize != itemSize) {
+
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.rssiChanOffsets[0],bufferSize);
+           }
+           break;
+       case VNV_RF_CAL_VALUES:
+
+           itemSize = sizeof(gnvEFSTable->halnv.tables.rFCalValues);
+
+           if(bufferSize != itemSize) {
+
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.rFCalValues,bufferSize);
+           }
+           break;
+       case VNV_ANTENNA_PATH_LOSS:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.antennaPathLoss);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.antennaPathLoss[0],bufferSize);
+           }
+           break;
+       case VNV_PACKET_TYPE_POWER_LIMITS:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.pktTypePwrLimits);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.pktTypePwrLimits[0][0],bufferSize);
+           }
+           break;
+       case VNV_OFDM_CMD_PWR_OFFSET:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.ofdmCmdPwrOffset);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.ofdmCmdPwrOffset,bufferSize);
+           }
+           break;
+       case VNV_TX_BB_FILTER_MODE:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.txbbFilterMode);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.txbbFilterMode,bufferSize);
+           }
+           break;
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+       case VNV_FREQUENCY_FOR_1_3V_SUPPLY:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.freqFor1p3VSupply);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.freqFor1p3VSupply,bufferSize);
+           }
+           break;
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+       case VNV_TABLE_VIRTUAL_RATE:
+           itemSize = sizeof(gnvEFSTable->halnv.tables.pwrOptimum_virtualRate);
+           if(bufferSize != itemSize) {
+               VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                 itemSize);
+               status = VOS_STATUS_E_INVAL;
+           }
+           else {
+               memcpy(outputVoidBuffer,&gnvEFSTable->halnv.tables.pwrOptimum_virtualRate,bufferSize);
+           }
+           break;
+
+       default:
+         break;
+   }
+   return status;
+}
+#ifndef WLAN_FTM_STUB
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_write() - write to a NV item from an input buffer
+  The \a vos_nv_write() writes to a NV item from an input buffer. This would
+  validate the NV item if the write operation is successful.
+  \param type - NV item type
+  \param inputBuffer - input buffer
+  \param inputBufferSize - input buffer size
+  \return VOS_STATUS_SUCCESS - NV item is read successfully
+          VOS_STATUS_E_INVAL - one of the parameters is invalid
+          VOS_STATUS_E_FAULT - outputBuffer pointer is NULL
+          VOS_STATUS_E_EXISTS - NV type is unsupported
+          VOS_STATUS_E_FAILURE   - unknown error
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_write( VNV_TYPE type, v_VOID_t *inputVoidBuffer,
+      v_SIZE_t bufferSize )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    v_SIZE_t itemSize;
+        // sanity check
+    if (NUM_NV_TABLE_IDS < type)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("vos_nv_setValidity: invalid type=%d\r\n"), type );
+       return VOS_STATUS_E_INVAL;
+    }
+    if (NULL == inputVoidBuffer)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("Buffer provided is NULL\r\n") );
+       return VOS_STATUS_E_FAULT;
+    }
+    if (0 == bufferSize)
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             ("NV type=%d is invalid\r\n"), type );
+       return VOS_STATUS_E_INVAL;
+    }
+    switch(type)
+    {
+        case VNV_FIELD_IMAGE:
+            itemSize = sizeof(gnvEFSTable->halnv.fields);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.fields,inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_RATE_TO_POWER_TABLE:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.pwrOptimum);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.pwrOptimum[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_REGULARTORY_DOMAIN_TABLE:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.regDomains);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.regDomains[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_DEFAULT_LOCATION:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.defaultCountryTable);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.defaultCountryTable,inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_TPC_POWER_TABLE:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.plutCharacterized);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.plutCharacterized[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_TPC_PDADC_OFFSETS:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.plutPdadcOffset);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.plutPdadcOffset[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+         case VNV_RSSI_CHANNEL_OFFSETS:
+
+            itemSize = sizeof(gnvEFSTable->halnv.tables.rssiChanOffsets);
+
+            if(bufferSize != itemSize) {
+
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.rssiChanOffsets[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+         case VNV_RF_CAL_VALUES:
+
+            itemSize = sizeof(gnvEFSTable->halnv.tables.rFCalValues);
+
+            if(bufferSize != itemSize) {
+
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.rFCalValues,inputVoidBuffer,bufferSize);
+            }
+            break;
+        case VNV_ANTENNA_PATH_LOSS:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.antennaPathLoss);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.antennaPathLoss[0],inputVoidBuffer,bufferSize);
+            }
+            break;
+
+        case VNV_PACKET_TYPE_POWER_LIMITS:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.pktTypePwrLimits);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.pktTypePwrLimits[0][0],inputVoidBuffer,bufferSize);
+            }
+            break;
+
+        case VNV_OFDM_CMD_PWR_OFFSET:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.ofdmCmdPwrOffset);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.ofdmCmdPwrOffset,inputVoidBuffer,bufferSize);
+            }
+            break;
+
+        case VNV_TX_BB_FILTER_MODE:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.txbbFilterMode);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.txbbFilterMode,inputVoidBuffer,bufferSize);
+            }
+            break;
+            
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+        case VNV_FREQUENCY_FOR_1_3V_SUPPLY:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.freqFor1p3VSupply);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.freqFor1p3VSupply,inputVoidBuffer,bufferSize);
+            }
+            break;
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+        case VNV_TABLE_VIRTUAL_RATE:
+            itemSize = sizeof(gnvEFSTable->halnv.tables.pwrOptimum_virtualRate);
+            if(bufferSize != itemSize) {
+                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 ("type = %d buffer size=%d is less than data size=%d\r\n"),type, bufferSize,
+                  itemSize);
+                status = VOS_STATUS_E_INVAL;
+            }
+            else {
+                memcpy(&gnvEFSTable->halnv.tables.pwrOptimum_virtualRate,inputVoidBuffer,bufferSize);
+            }
+            break;
+
+        default:
+          break;
+    }
+   if (VOS_STATUS_SUCCESS == status)
+   {
+      // set NV item to have valid data
+      status = vos_nv_setValidity( type, VOS_TRUE );
+      if (! VOS_IS_STATUS_SUCCESS(status)) {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, ("vos_nv_setValidity failed!!!\r\n"));
+          status = VOS_STATUS_E_FAULT;
+      }
+      status = wlan_write_to_efs((v_U8_t*)gnvEFSTable,sizeof(nvEFSTable_t));
+
+      if (! VOS_IS_STATUS_SUCCESS(status)) {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, ("vos_nv_write_to_efs failed!!!\r\n"));
+          status = VOS_STATUS_E_FAULT;
+      }
+   }
+   return status;
+}
+#endif
+  
+/**------------------------------------------------------------------------
+  \brief vos_nv_getChannelListWithPower() - function to return the list of
+          supported channels with the power limit info too.
+  \param pChannels20MHz - list of 20 Mhz channels
+  \param pNum20MHzChannelsFound - number of 20 Mhz channels
+  \param pChannels40MHz - list of 20 Mhz channels
+  \param pNum40MHzChannelsFound - number of 20 Mhz channels
+  \return status of the NV read operation
+  \Note: 40Mhz not currently supported
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getChannelListWithPower(tChannelListWithPower *channels20MHz /*[NUM_LEGIT_RF_CHANNELS] */,
+                                          tANI_U8 *num20MHzChannelsFound,
+                                          tChannelListWithPower *channels40MHz /*[NUM_CHAN_BOND_CHANNELS] */,
+                                          tANI_U8 *num40MHzChannelsFound
+                                          )
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    int i, count;
+    
+    //TODO: Dont want to use pMac here...can we instead store the curRegDomain in NV
+    // or pass it as a parameter to NV from SME?
+
+    if( channels20MHz && num20MHzChannelsFound )
+    {
+        count = 0;
+        for( i = 0; i <= RF_CHAN_14; i++ )
+        {
+            if( regChannels[i].enabled )
+            {
+                channels20MHz[count].chanId = rfChannels[i].channelNum;
+                channels20MHz[count++].pwr  = regChannels[i].pwrLimit;
+            }
+        }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+        for( i = RF_CHAN_36; i <= RF_CHAN_165; i++ )
+        {
+            if( regChannels[i].enabled )
+            {
+                channels20MHz[count].chanId = rfChannels[i].channelNum;
+                channels20MHz[count++].pwr  = regChannels[i].pwrLimit;
+            }
+        }
+#endif
+        *num20MHzChannelsFound = (tANI_U8)count;
+    }
+    //TODO: 40 MHz
+    return (status);
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getDefaultRegDomain() - return the default regulatory domain
+  \return default regulatory domain
+  \sa
+  -------------------------------------------------------------------------*/
+
+v_REGDOMAIN_t vos_nv_getDefaultRegDomain( void )
+{
+    return countryInfoTable.countryInfo[0].regDomain;
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getSupportedChannels() - function to return the list of
+          supported channels
+  \param p20MhzChannels - list of 20 Mhz channels
+  \param pNum20MhzChannels - number of 20 Mhz channels
+  \param p40MhzChannels - list of 40 Mhz channels
+  \param pNum40MhzChannels - number of 40 Mhz channels
+  \return status of the NV read operation
+  \Note: 40Mhz not currently supported
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getSupportedChannels( v_U8_t *p20MhzChannels, int *pNum20MhzChannels,
+                                        v_U8_t *p40MhzChannels, int *pNum40MhzChannels)
+{
+    VOS_STATUS status = VOS_STATUS_E_INVAL;
+    int i, count = 0;
+
+    if( p20MhzChannels && pNum20MhzChannels )
+    {
+        if( *pNum20MhzChannels >= NUM_RF_CHANNELS )
+        {
+            for( i = 0; i <= RF_CHAN_14; i++ )
+            {
+                p20MhzChannels[count++] = rfChannels[i].channelNum;
+            }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+            for( i = RF_CHAN_36; i <= RF_CHAN_165; i++ )
+            {
+                p20MhzChannels[count++] = rfChannels[i].channelNum;
+            }
+#endif
+            status = VOS_STATUS_SUCCESS;
+        }
+        *pNum20MhzChannels = count;
+    }
+
+    return (status);
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_readDefaultCountryTable() - return the default Country table
+  \param table data - a union to return the default country table data in.
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_readDefaultCountryTable( uNvTables *tableData )
+{
+   
+   VOS_STATUS status;
+
+   status = vos_nv_read( VNV_DEFAULT_LOCATION, tableData, NULL, sizeof(sDefaultCountry) );
+
+   return status;
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getBuffer - 
+  \param pBuffer  - to return the buffer address
+              pSize     - buffer size.
+  \return status of the NV read operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_getNVBuffer(v_VOID_t **pNvBuffer,v_SIZE_t *pSize)
+{
+
+   /* Send the NV structure and size */
+   *pNvBuffer = (v_VOID_t *)(&pnvEFSTable->halnv);
+   *pSize = sizeof(sHalNv);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/**------------------------------------------------------------------------
+  \brief vos_nv_setRegDomain - 
+  \param clientCtxt  - Client Context, Not used for PRIMA
+              regId  - Regulatory Domain ID
+  \return status set REG domain operation
+  \sa
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_nv_setRegDomain(void * clientCtxt, v_REGDOMAIN_t regId)
+{
+   /* Client Context Argumant not used for PRIMA */
+   if(regId >= REGDOMAIN_COUNT)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VOS set reg domain, invalid REG domain ID %d", regId);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   /* Set correct channel information based on REG Domain */
+   regChannels = pnvEFSTable->halnv.tables.regDomains[regId].channels;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**------------------------------------------------------------------------
+  \brief vos_nv_getChannelEnabledState - 
+  \param rfChannel  - input channel enum to know evabled state
+  \return eNVChannelEnabledType enabled state for channel
+             * enabled
+             * disabled
+             * DFS
+  \sa
+  -------------------------------------------------------------------------*/
+eNVChannelEnabledType vos_nv_getChannelEnabledState
+(
+   v_U32_t     rfChannel
+)
+{
+   v_U32_t       channelLoop;
+   eRfChannels   channelEnum = INVALID_RF_CHANNEL;
+
+   for(channelLoop = 0; channelLoop <= RF_CHAN_165; channelLoop++)
+   {
+      if(rfChannels[channelLoop].channelNum == rfChannel)
+      {
+         channelEnum = (eRfChannels)channelLoop;
+         break;
+      }
+   }
+
+   if(INVALID_RF_CHANNEL == channelEnum)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "vos_nv_getChannelEnabledState, invalid cahnnel %d", rfChannel);
+      return NV_CHANNEL_INVALID;
+   }
+
+   return regChannels[channelEnum].enabled;
+}
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
diff --git a/CORE/VOSS/src/vos_packet.c b/CORE/VOSS/src/vos_packet.c
new file mode 100644
index 0000000..304bd51
--- /dev/null
+++ b/CORE/VOSS/src/vos_packet.c
@@ -0,0 +1,2943 @@
+/*
+ * 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        vos_packet.c
+
+  \brief       virtual Operating System Services (vOSS) network Packet APIs
+
+   Network Protocol packet/buffer support interfaces
+
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
+
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_packet.h>
+#include <i_vos_packet.h>
+#include <vos_timer.h>
+#include <vos_trace.h>
+#ifdef WLAN_SOFTAP_FEATURE
+#include <wlan_hdd_main.h>   
+#endif
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  Data definitions
+  ------------------------------------------------------------------------*/
+static vos_pkt_context_t *gpVosPacketContext = NULL;
+
+/*-------------------------------------------------------------------------
+  Function declarations and documentation
+  ------------------------------------------------------------------------*/
+
+static VOS_STATUS vos_pkti_packet_init( struct vos_pkt_t *pPkt,
+                                 VOS_PKT_TYPE pktType )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   // fixed fields
+   pPkt->packetType = pktType;
+   pPkt->magic = VPKT_MAGIC_NUMBER;
+
+   // some packet types need an attached skb
+   switch (pktType)
+   {
+   case VOS_PKT_TYPE_RX_RAW:
+   case VOS_PKT_TYPE_TX_802_11_MGMT:
+      // these need an attached skb.
+      // we preallocate a fixed-size skb and reserve the entire buffer
+      // as headroom since that is what other components expect
+      pPkt->pSkb = alloc_skb(VPKT_SIZE_BUFFER, GFP_ATOMIC);
+      if (likely(pPkt->pSkb))
+      {
+         skb_reserve(pPkt->pSkb, VPKT_SIZE_BUFFER);
+      }
+      else
+      {
+         vosStatus = VOS_STATUS_E_NOMEM;
+      }
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      /* Init PAL Packet */
+      WPAL_PACKET_SET_BD_POINTER(&(pPkt->palPacket), NULL);
+      WPAL_PACKET_SET_BD_PHYS(&(pPkt->palPacket), NULL);
+      WPAL_PACKET_SET_BD_LENGTH(&(pPkt->palPacket), 0);
+      WPAL_PACKET_SET_OS_STRUCT_POINTER(&(pPkt->palPacket), NULL);
+#endif
+
+      break;
+   default:
+      // no attached skb needed
+      break;
+   }
+
+   return vosStatus;
+}
+
+
+
+static VOS_STATUS vos_pkti_list_destroy( struct list_head *pList )
+{
+   struct vos_pkt_t *pVosPacket;
+
+   if (unlikely(NULL == pList))
+   {
+      // something is fishy -- don't even bother trying 
+      // clean up this list since it is apparently hosed
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pList", __LINE__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   list_for_each_entry(pVosPacket, pList, node)
+   {
+
+      // is this really an initialized vos packet?
+      if (unlikely(VPKT_MAGIC_NUMBER != pVosPacket->magic))
+      {
+         // no, so don't try any deinitialization on it, and
+         // since we can't trust the linkages, stop trying
+         // to destroy the list
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: Invalid magic", __LINE__);
+         VOS_ASSERT(0);
+         break;
+      }
+
+      // does this vos packet have an skb attached?
+      if (pVosPacket->pSkb)
+      {
+         // yes, so give it back to the kernel
+         kfree_skb(pVosPacket->pSkb);
+         pVosPacket->pSkb = NULL;
+      }
+
+      // the vos packet itself is a static portion of the vos packet context
+      // so there is no deallocation we have to do with it.  just clear the
+      // magic so we no longer think it is valid
+      pVosPacket->magic = 0;
+
+   }
+
+   // all nodes of the list have been processed so reinitialize the list
+   INIT_LIST_HEAD(pList);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+static void vos_pkti_replenish_raw_pool(void)
+{
+   struct sk_buff * pSkb;
+   struct vos_pkt_t *pVosPacket;
+   v_BOOL_t didOne = VOS_FALSE;
+   vos_pkt_get_packet_callback callback;
+   int rc; 
+
+   // if there are no packets in the replenish pool then we can't do anything
+   if (likely(0 == gpVosPacketContext->rxReplenishListCount))
+   {
+      return;
+   }
+
+   // we only replenish if the Rx Raw pool is empty or the Replenish pool
+   // reaches a high water mark
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
+
+   if (unlikely(0 != rc))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "failed to acquire mutex, line [%d] in %s", __LINE__, __FUNCTION__);
+      return;     
+   }
+
+   if ((gpVosPacketContext->rxReplenishListCount < VPKT_RX_REPLENISH_THRESHOLD)
+       &&
+       (!list_empty(&gpVosPacketContext->rxRawFreeList)))
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+      return;
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+             "VPKT [%d]: Packet replenish activated", __LINE__);
+
+   // try to replenish all of the packets in the replenish pool
+   while (gpVosPacketContext->rxReplenishListCount)
+   {
+      // we preallocate a fixed-size skb and reserve the entire buffer
+      // as headroom since that is what other components expect
+      pSkb = alloc_skb(VPKT_SIZE_BUFFER, GFP_ATOMIC);
+      if (unlikely(NULL == pSkb))
+      {
+         // we have replenished all that we can
+         break;
+      }
+      skb_reserve(pSkb, VPKT_SIZE_BUFFER);
+
+      // remove a vos packet from the replenish pool
+      pVosPacket = list_first_entry(&gpVosPacketContext->rxReplenishList,
+                                    struct vos_pkt_t, node);
+      list_del(&pVosPacket->node);
+      gpVosPacketContext->rxReplenishListCount--;
+
+      // attach the skb to the vos packet
+      pVosPacket->pSkb = pSkb;
+
+      // add it to the Rx Raw Free Pool
+      list_add_tail(&pVosPacket->node, &gpVosPacketContext->rxRawFreeList);
+
+      didOne = VOS_TRUE;
+
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "VPKT [%d]: [%p] Packet replenished",
+                __LINE__, pVosPacket);
+
+   }
+
+   // if we replenished anything and if there is a callback waiting
+   // then invoke the callback
+   if ((VOS_TRUE == didOne) &&
+       (gpVosPacketContext->rxRawLowResourceInfo.callback))
+   {
+      // remove the first record from the free pool
+      pVosPacket = list_first_entry(&gpVosPacketContext->rxRawFreeList,
+                                    struct vos_pkt_t, node);
+      list_del(&pVosPacket->node);
+
+      // clear out the User Data pointers in the voss packet..
+      memset(&pVosPacket->pvUserData, 0, sizeof(pVosPacket->pvUserData));
+
+      // initialize the 'chain' pointer to NULL.
+      pVosPacket->pNext = NULL;
+
+      // timestamp the vos packet.
+      pVosPacket->timestamp = vos_timer_get_system_ticks();
+
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "VPKT [%d]: [%p] Packet replenish callback",
+                __LINE__, pVosPacket);
+
+      callback = gpVosPacketContext->rxRawLowResourceInfo.callback;
+      gpVosPacketContext->rxRawLowResourceInfo.callback = NULL;
+      mutex_unlock(&gpVosPacketContext->mlock);
+      callback(pVosPacket, gpVosPacketContext->rxRawLowResourceInfo.userData);
+   }
+   else
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+   }
+}
+
+
+#if defined( WLAN_DEBUG )
+static char *vos_pkti_packet_type_str(VOS_PKT_TYPE pktType)
+{
+   switch (pktType)
+   {
+   case VOS_PKT_TYPE_TX_802_11_MGMT:
+      return "TX_802_11_MGMT";
+      break;
+   
+   case VOS_PKT_TYPE_TX_802_11_DATA:
+      return  "TX_802_11_DATA";
+      break;
+       
+   case VOS_PKT_TYPE_TX_802_3_DATA:
+      return "TX_802_3_DATA";
+      break;
+   
+   case VOS_PKT_TYPE_RX_RAW:
+      return "RX_RAW";
+      break;
+
+   default:
+      return "UNKNOWN";
+      break;
+   } 
+}
+#endif // defined( WLAN_DEBUG )
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_packet_open() - initialize the vOSS Packet module
+
+  The \a vos_packet_open() function initializes the vOSS Packet
+  module.
+
+  \param  pVosContext - pointer to the global vOSS Context
+
+  \param  pVosPacketContext - pointer to a previously allocated
+          buffer big enough to hold the vos Packet context.
+
+  \param  vosPacketContextSize - the size allocated for the vos
+          packet context.
+
+  \return VOS_STATUS_SUCCESS - vos Packet module was successfully
+          initialized and is ready to be used.
+
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the vos Packet module
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize
+          the vos packet module
+
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the vos open
+          function
+
+          VOS_STATUS_E_FAILURE - Failure to initialize the vos packet
+          module
+
+  \sa vos_packet_close()
+
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_packet_open( v_VOID_t *pVosContext,
+                            vos_pkt_context_t *pVosPacketContext,
+                            v_SIZE_t vosPacketContextSize )
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   unsigned int freePacketIndex;
+   unsigned int idx;
+   struct vos_pkt_t *pPkt;
+   struct list_head *pFreeList;
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "Enter:%s",__FUNCTION__);
+
+   do
+   {
+
+      if (NULL == pVosContext)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: NULL pVosContext", __LINE__);
+         vosStatus = VOS_STATUS_E_INVAL;
+         break;
+      }
+
+      if (NULL == pVosPacketContext)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: NULL pVosPacketContext", __LINE__);
+         vosStatus = VOS_STATUS_E_INVAL;
+         break;
+      }
+
+      if (sizeof(vos_pkt_context_t) != vosPacketContextSize)
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: invalid vosPacketContextSize, %d vs %d",
+                   __LINE__, sizeof(vos_pkt_context_t), vosPacketContextSize);
+         vosStatus = VOS_STATUS_E_INVAL;
+         break;
+      }
+
+      // clear the vos packet context.  in the process this will
+      // initialize the low resource info blocks
+      memset(pVosPacketContext, 0, vosPacketContextSize);
+
+      // save a global pointer to the vos packet context.
+      gpVosPacketContext = pVosPacketContext;
+
+      // save the vos Context pointer in the vos Packet Context.
+      pVosPacketContext->vosContext = pVosContext;
+
+      // initialize the rx Replenish pool (initially empty)
+      INIT_LIST_HEAD(&pVosPacketContext->rxReplenishList);
+      pVosPacketContext->rxReplenishListCount = 0;
+
+      // index into the packet context's vosPktBuffer[] array
+      freePacketIndex = 0;
+
+      // initialize the rxRaw free list pool
+      pFreeList = &pVosPacketContext->rxRawFreeList;
+      INIT_LIST_HEAD(pFreeList);
+
+      // fill the rxRaw free list
+      for (idx = 0; idx < VPKT_NUM_RX_RAW_PACKETS; idx++)
+      {
+         pPkt = &pVosPacketContext->vosPktBuffers[freePacketIndex++];
+         vosStatus = vos_pkti_packet_init(pPkt, VOS_PKT_TYPE_RX_RAW);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+         WPAL_PACKET_SET_METAINFO_POINTER(&(pPkt->palPacket),
+                  (void*)&pVosPacketContext->rxMetaInfo[idx]);
+         WPAL_PACKET_SET_TYPE(&(pPkt->palPacket), 
+                              eWLAN_PAL_PKT_TYPE_RX_RAW);
+#endif
+
+         if (VOS_STATUS_SUCCESS != vosStatus)
+         {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                      "VPKT [%d]: Packet init failure", __LINE__);
+            break;
+         }
+         list_add_tail(&pPkt->node, pFreeList);
+      }
+
+      // exit if any problems so far
+      if (VOS_STATUS_SUCCESS != vosStatus)
+      {
+         break;
+      }
+
+      // initialize the txData free list pool
+      pFreeList = &pVosPacketContext->txDataFreeList;
+      INIT_LIST_HEAD(pFreeList);
+
+      // fill the txData free list
+      for (idx = 0; idx < VPKT_NUM_TX_DATA_PACKETS; idx++)
+      {
+         pPkt = &pVosPacketContext->vosPktBuffers[freePacketIndex++];
+         vosStatus = vos_pkti_packet_init(pPkt, VOS_PKT_TYPE_TX_802_3_DATA);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+         WPAL_PACKET_SET_METAINFO_POINTER(&(pPkt->palPacket),
+               (void*)&pVosPacketContext->txDataMetaInfo[idx]);
+         WPAL_PACKET_SET_TYPE(&(pPkt->palPacket), 
+                              eWLAN_PAL_PKT_TYPE_TX_802_3_DATA);
+#endif
+         if (VOS_STATUS_SUCCESS != vosStatus)
+         {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                      "VPKT [%d]: Packet init failure", __LINE__);
+            break;
+         }
+         list_add_tail(&pPkt->node, pFreeList);
+#ifdef WLAN_SOFTAP_FEATURE
+         pVosPacketContext->uctxDataFreeListCount++;
+#endif
+      }
+
+      // exit if any problems so far
+      if (VOS_STATUS_SUCCESS != vosStatus)
+      {
+         break;
+      }
+
+      // initialize the txMgmt free list pool
+      pFreeList = &pVosPacketContext->txMgmtFreeList;
+      INIT_LIST_HEAD(pFreeList);
+
+      mutex_init(&gpVosPacketContext->mlock);
+      // fill the txMgmt free list
+      for (idx = 0; idx < VPKT_NUM_TX_MGMT_PACKETS; idx++)
+      {
+         pPkt = &pVosPacketContext->vosPktBuffers[freePacketIndex++];
+
+         vosStatus = vos_pkti_packet_init(pPkt, VOS_PKT_TYPE_TX_802_11_MGMT);
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+         WPAL_PACKET_SET_METAINFO_POINTER(&(pPkt->palPacket),
+               (void*)&pVosPacketContext->txMgmtMetaInfo[idx]);
+         WPAL_PACKET_SET_TYPE(&(pPkt->palPacket), 
+                              eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT);
+#endif
+
+         if (VOS_STATUS_SUCCESS != vosStatus)
+         {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                      "VPKT [%d]: Packet init failure", __LINE__);
+            break;
+         }
+         list_add_tail(&pPkt->node, pFreeList);
+      }
+
+      // exit if any problems so far
+      if (VOS_STATUS_SUCCESS != vosStatus)
+      {
+         break;
+      }
+
+   } while (0);
+
+   return vosStatus;
+}
+
+
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_packet_close() - Close the vOSS Packet module
+
+  The \a vos_packet_close() function closes the vOSS Packet module
+  Upon successful close all resources allocated from the OS will be
+  relinquished.
+
+  \param  pVosContext - pointer to the global vOSS Context
+
+  \return VOS_STATUS_SUCCESS - Packet module was successfully closed.
+
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the packet
+          close function
+
+          VOS_STATUS_E_FAILURE - Failure to close the vos Packet module
+
+  \sa vos_packet_open()
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_packet_close( v_PVOID_t pVosContext )
+{
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "Enter:%s",__FUNCTION__);
+
+   if (unlikely(NULL == pVosContext))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pVosContext", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   if (unlikely(gpVosPacketContext->vosContext != pVosContext))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: invalid pVosContext", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   (void) vos_pkti_list_destroy(&gpVosPacketContext->txMgmtFreeList);
+   (void) vos_pkti_list_destroy(&gpVosPacketContext->txDataFreeList);
+   (void) vos_pkti_list_destroy(&gpVosPacketContext->rxRawFreeList);
+   (void) vos_pkti_list_destroy(&gpVosPacketContext->rxReplenishList);
+
+#ifdef WLAN_SOFTAP_FEATURE
+   gpVosPacketContext->uctxDataFreeListCount = 0;
+#endif
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_packet() - Get a voss Packet
+
+  Gets a voss Packet from an internally managed packet pool.
+
+  \param ppPacket - pointer to location where the voss Packet pointer is
+                    returned.  If multiple packets are requested, they
+                    will be chained onto this first packet.
+
+  \param pktType - the packet type to be retreived.  Valid packet types are:
+     <ul>
+       <li> VOS_PKT_TYPE_TX_802_11_MGMT - voss packet is for Transmitting
+            802.11 Management frames.
+
+       <li> VOS_PKT_TYPE_RX_RAW - voss Packet contains a buffer for Receiving
+            raw frames of unknown type.
+     </ul>
+
+  \param dataSize - the Data size needed in the voss Packet.
+
+  \param numPackets - the number of packets requested.
+
+  \param zeroBuffer - parameter that tells the API to zero the data buffer
+                      in this voss Packet.
+     <ul>
+       <li> VOS_TRUE - the API will zero out the entire data buffer.
+
+       <li> VOS_FALSE - the API will not zero out the data buffer.
+     </ul>
+
+  \note If enough room for headers to transmit or receive the packet is not
+        available, this API will fail.
+
+  \param callback - This callback function, if provided, is invoked in the
+         case when resources are not available at the time of the call to
+         get packets.  This callback function is invoked when packets are
+         available.
+
+  \param userData - This user data is passed back to the caller in the
+         callback function, if the callback is invoked.
+
+  \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
+          requested type.  *ppPacket contains a pointer to the packet.
+
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This
+          API only supports getting vos packets for 802_11_MGMT and
+          RX_RAW packet types.  This status is also returned if the
+          numPackets or dataSize are invalid.
+
+          VOS_STATUS_E_RESOURCES - unable to get resources needed to get
+          a vos packet.  If a callback function is specified and this
+          status is returned from the API, the callback will be called
+          when resources are available to fulfill the original request.
+
+          Note that the low resources condition is indicated to the caller
+          by returning VOS_STATUS_E_RESOURCES.  This status is the only
+          non-success status that indicates to the caller that the callback
+          will be called when resources are available.  All other status
+          indicate failures that are not recoverable and the 'callback'
+          will not be called.
+
+          VOS_STATUS_E_FAILURE - The API returns this status when unable
+          to get a packet from the packet pool because the pool
+          is depleted and the caller did not specify a low resource callback.
+
+          VOS_STATUS_E_ALREADY - This status is returned when the VOS
+          packet pool is in a 'low resource' condition and cannot
+          accomodate any more calls to retrieve packets from that
+          pool.   Note this is a FAILURE and the 'low resource' callback
+          will *not* be called.
+
+          VOS_STATUS_E_FAULT - ppPacket does not specify a valid pointer.
+
+  \sa
+
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet( vos_pkt_t **ppPacket,
+                               VOS_PKT_TYPE pktType,
+                               v_SIZE_t dataSize,
+                               v_SIZE_t numPackets,
+                               v_BOOL_t zeroBuffer,
+                               vos_pkt_get_packet_callback callback,
+                               v_VOID_t *userData )
+{
+   struct list_head *pPktFreeList;
+   vos_pkt_low_resource_info *pLowResourceInfo;
+   struct vos_pkt_t *pVosPacket;
+   int rc; 
+   // Validate the return parameter pointer
+   if (unlikely(NULL == ppPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL ppPacket", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // we only support getting 1 packet at this time (as do WM & AMSS)
+   if (unlikely(1 != numPackets))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: invalid numPackets, %d", __LINE__, numPackets);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate the dataSize is within range
+   if (unlikely((0 == dataSize) || (dataSize > VPKT_SIZE_BUFFER)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: invalid dataSize, %d", __LINE__, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // determine which packet pool and low resource block we should use.
+   // this API is only valid for TX MGMT and RX RAW packets
+   // (TX DATA will use vos_pkt_wrap_data_packet())
+   switch (pktType)
+   {
+
+   case VOS_PKT_TYPE_RX_RAW:
+      pPktFreeList = &gpVosPacketContext->rxRawFreeList;
+      pLowResourceInfo = &gpVosPacketContext->rxRawLowResourceInfo;
+
+      // see if we need to replenish the Rx Raw pool
+      vos_pkti_replenish_raw_pool();
+
+      break;
+
+   case VOS_PKT_TYPE_TX_802_11_MGMT:
+      pPktFreeList = &gpVosPacketContext->txMgmtFreeList;
+      pLowResourceInfo = &gpVosPacketContext->txMgmtLowResourceInfo;
+      break;
+
+   default:
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: invalid packet type %d[%s]",
+                __LINE__, pktType, vos_pkti_packet_type_str(pktType));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // is there already a low resource callback registered for this pool?
+   // we only support one callback per pool, so if one is already registered
+   // then we know we are already in a low-resource condition
+   if (unlikely(pLowResourceInfo->callback))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Low resource handler already registered",
+                __LINE__);
+      return VOS_STATUS_E_ALREADY;
+   }
+
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
+   // are there vos packets on the associated free pool?
+   if (unlikely(list_empty(pPktFreeList)))
+   {
+      // allocation failed
+      // did the caller specify a callback?
+      if (unlikely(NULL == callback))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "VPKT [%d]: Low resource condition and no callback provided",
+                   __LINE__);
+         if (likely(0 == rc)) 
+         {
+            mutex_unlock(&gpVosPacketContext->mlock);
+         }
+
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      // save the low resource information so that we can invoke the
+      // callback when a packet becomes available
+      pLowResourceInfo->callback   = callback;
+      pLowResourceInfo->userData   = userData;
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "VPKT [%d]: Low resource condition for packet type %d[%s]",
+                __LINE__, pktType, vos_pkti_packet_type_str(pktType));
+      if (likely(0 == rc)) 
+      {
+         mutex_unlock(&gpVosPacketContext->mlock);
+      }
+      return VOS_STATUS_E_RESOURCES;
+   }
+
+   // remove the first record from the free pool
+   pVosPacket = list_first_entry(pPktFreeList, struct vos_pkt_t, node);
+   list_del(&pVosPacket->node);
+   if (likely(0 == rc)) 
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+   }
+
+   // clear out the User Data pointers in the voss packet..
+   memset(&pVosPacket->pvUserData, 0, sizeof(pVosPacket->pvUserData));
+
+   // initialize the 'chain' pointer to NULL.
+   pVosPacket->pNext = NULL;
+
+   // set the packet type.
+   pVosPacket->packetType = pktType;
+
+   // timestamp the vos packet.
+   pVosPacket->timestamp = vos_timer_get_system_ticks();
+
+   // zero the data buffer if the user asked for it to be cleared.
+   if (unlikely(zeroBuffer))
+   {
+      memset(pVosPacket->pSkb->head,
+             0,
+             skb_end_pointer(pVosPacket->pSkb) - pVosPacket->pSkb->head);
+   }
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+             "VPKT [%d]: [%p] Packet allocated, type %d[%s]",
+             __LINE__, pVosPacket, pktType, vos_pkti_packet_type_str(pktType));
+
+   *ppPacket = pVosPacket;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_wrap_data_packets() - Wrap an OS provided data packet in a
+         vos packet.
+
+  Takes as input an OS provided data packet and 'wraps' that packet in a
+  vos_packet, returning the vos_packet to the caller.
+
+  This function is intended to be called from the HDD to wrap Tx data packets
+  from the OS into vos_packets before sending them to TL for transmission.
+
+  \param ppPacket - pointer to location where the voss Packet pointer is
+                    returned.  If multiple packets are requested, they
+                    will be chained onto this first packet.
+
+  \param pktType - the packet type to be retreived.  Valid packet types are:
+     <ul>
+       <li> VOS_PKT_TYPE_802_3_DATA - voss packet is for Transmitting 802.3
+            data frames.
+
+       <li> VOS_PKT_TYPE_802_11_DATA - voss Packet is for Transmitting 802.11
+            data frames.
+     </ul>
+
+  \param pOSPacket - a pointer to the Transmit packet provided by the OS.  This
+         OS provided packet will be wrapped into a vos_packet_t.  Note this
+         OS packet pointer can be NULL.  The OS packet pointer can be inserted
+         into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or
+         VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
+
+  \note If enough room for headers to transmit or receive the packet is not
+        available, this API will fail.
+
+  \param callback - This callback function, if provided, is invoked in the
+         case where packets are not available at the time of the call to
+         return the packets to the caller (a 'low resource' condition).
+
+         When packets become available, the callback callback function is
+         invoked to return a VOS packet to the caller.  Note that the
+         OS Packet is *not* inserted into the VOS packet when it is returned
+         to the low resource callback.  It is up to the caller to insert
+         the OS packet into the VOS packet by calling vos_pkt_set_os_packet()
+
+  \param userData - This user data is passed back to the caller in the
+         callback function, if the callback is invoked.
+
+  \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
+          requested type.  *ppPacket contains a pointer to the packet.
+
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This
+          API only supports getting vos packets for 802_11_MGMT and
+          RX_RAW packet types.
+
+          VOS_STATUS_E_RESOURCES - unable to get resources needed to get
+          a vos packet.  If a callback function is specified and this
+          status is returned from the API, the callback will be called
+          when resources are available to fulfill the original request.
+
+          Note that the low resources condition is indicated to the caller
+          by returning VOS_STATUS_E_RESOURCES.  This status is the only
+          non-success status that indicates to the caller that the callback
+          will be called when resources are available.  All other status
+          indicate failures that are not recoverable and the 'callback'
+          will not be called.
+
+          VOS_STATUS_E_FAILURE - The API returns this status when unable
+          to get a packet from the packet pool because the pool
+          is depleted and the caller did not specify a low resource callback.
+
+          VOS_STATUS_E_ALREADY - This status is returned when the VOS
+          packet pool is in a 'low resource' condition and cannot
+          accomodate any more calls to retrieve packets from that
+          pool.   Note this is a FAILURE and the 'low resource' callback
+          will *not* be called.
+
+          VOS_STATUS_E_FAULT - ppPacket or pOSPacket do not specify valid
+          pointers.
+
+  \sa vos_pkt_set_os_packet()
+
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_wrap_data_packet( vos_pkt_t **ppPacket,
+                                     VOS_PKT_TYPE pktType,
+                                     v_VOID_t *pOSPacket,
+                                     vos_pkt_get_packet_callback callback,
+                                     v_VOID_t *userData )
+{
+   struct list_head *pPktFreeList;
+   vos_pkt_low_resource_info *pLowResourceInfo;
+   struct vos_pkt_t *pVosPacket;
+
+   // Validate the return parameter pointer
+   if (unlikely(NULL == ppPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL ppPacket", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate the packet type.  Only Tx Data packets can have an OS
+   // packet attached to them (Tx Mgmt and Rx Raw have OS packets
+   // pre-attached to them)
+   if (unlikely(VOS_PKT_TYPE_TX_802_3_DATA != pktType))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: invalid pktType", __LINE__, pktType);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // determine which packet pool and low resource block we should use.
+   pPktFreeList = &gpVosPacketContext->txDataFreeList;
+   pLowResourceInfo = &gpVosPacketContext->txDataLowResourceInfo;
+
+   // is there already a low resource callback registered for this pool?
+   // we only support one callback per pool, so if one is already registered
+   // then we know we are already in a low-resource condition
+   if (unlikely(pLowResourceInfo->callback))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Low resource handler already registered",
+                __LINE__);
+      return VOS_STATUS_E_ALREADY;
+   }
+
+   // are there vos packets on the associated free pool?
+   if (unlikely(list_empty(pPktFreeList)))
+   {
+      // allocation failed
+      // did the caller specify a callback?
+      if (unlikely(NULL == callback))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "VPKT [%d]: Low resource condition and no callback provided",
+                   __LINE__);
+         return VOS_STATUS_E_FAILURE;
+      }
+
+      // save the low resource information so that we can invoke the
+      // callback when a packet becomes available
+      pLowResourceInfo->callback   = callback;
+      pLowResourceInfo->userData   = userData;
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "VPKT [%d]: Low resource condition for pool %s",
+                __LINE__, vos_pkti_packet_type_str(pktType));
+      return VOS_STATUS_E_RESOURCES;
+   }
+
+   // remove the first record from the free pool
+   pVosPacket = list_first_entry(pPktFreeList, struct vos_pkt_t, node);
+   list_del(&pVosPacket->node);
+#ifdef WLAN_SOFTAP_FEATURE
+   gpVosPacketContext->uctxDataFreeListCount --;
+#endif
+
+   // clear out the User Data pointers in the voss packet..
+   memset(&pVosPacket->pvUserData, 0, sizeof(pVosPacket->pvUserData));
+
+   // initialize the 'chain' pointer to NULL.
+   pVosPacket->pNext = NULL;
+
+   // set the packet type.
+   pVosPacket->packetType = pktType;
+
+   // set the skb pointer
+   pVosPacket->pSkb = (struct sk_buff *) pOSPacket;
+
+   // timestamp the vos packet.
+   pVosPacket->timestamp = vos_timer_get_system_ticks();
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+             "VPKT [%d]: [%p] Packet allocated, type %s",
+             __LINE__, pVosPacket, vos_pkti_packet_type_str(pktType));
+
+   *ppPacket = pVosPacket;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_pkt_set_os_packet() - set the OS packet in a VOS data packet
+
+  This API inserts an OS packet into a previously retreived VOS packet.
+  This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
+  VOS_PKT_TYPE_802_11_DATA.
+
+  There are cases where a user will need to get a VOS data packet without
+  having the OS packet to insert/wrap into the data packet. This could happen
+  if the user calls vos_pkt_wrap_data_packet() without the OS packet.
+
+  Also, when the user hit a 'low resource' situation for data packets, the
+  low resource callback is going to return a VOS packet without an OS packet
+  attached to it.  The caller who gets the packet through the low resource
+  callback uses this API to insert an OS packet into the VOS packet that
+  was returned through the low resource callback.
+
+  \param pPacket - the voss Packet to insert the OS packet into.
+
+  \param pOSPacket - a pointer to the Transmit packet provided by the OS.  This
+         OS provided packet will be wrapped into a vos_packet_t.  Note this
+         OS packet pointer can be NULL.  The OS packet pointer can be inserted
+         into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or
+         VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
+
+         Caller beware.  If there is a valid OS packet wrapped into this
+         VOS packet already, this API will blindly overwrite the OS packet
+         with the new one specified on this API call.  If you need to determine
+         or retreive the current OS packet from a VOS packet, call
+         vos_pkt_get_os_packet() first.
+
+  \return VOS_STATUS_SUCCESS - the API was able to insert the OS packet into
+          the vos_packet.
+
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This
+          API only supports getting vos packets of type
+          VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.
+
+          VOS_STATUS_E_FAULT - pPacket does not specify a valid pointer.
+
+  \sa vos_pkt_get_os_packet()
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_set_os_packet( vos_pkt_t *pPacket,
+                                  v_VOID_t *pOSPacket )
+{
+   // Validate the input parameter pointers
+   if (unlikely((NULL == pPacket)||(NULL == pOSPacket)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate the packet type.  Only Tx Data packets can have an OS
+   // packet attached to them (Tx Mgmt and Rx Raw have OS packets
+   // pre-attached to them)
+   if (unlikely(VOS_PKT_TYPE_TX_802_3_DATA != pPacket->packetType))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: invalid packet type %d[%s]",
+                __LINE__, pPacket->packetType,
+                vos_pkti_packet_type_str(pPacket->packetType));
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Is there already a packet attached?  If so, just warn and continue
+   if (unlikely(pPacket->pSkb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "VPKT [%d]: Packet previously attached", __LINE__);
+   }
+
+   // attach
+   pPacket->pSkb = (struct sk_buff *) pOSPacket;
+   
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*---------------------------------------------------------------------------
+
+  \brief vos_pkt_get_os_packet() - get the OS packet in a VOS data packet
+
+  This API returns the OS packet that is inserted in a VOS packet.
+  This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
+  VOS_PKT_TYPE_802_11_DATA.
+
+  \param pPacket - the voss Packet to return the OS packet from.
+
+  \param ppOSPacket - a pointer to the location where the OS packet pointer
+         retreived from the VOS packet will be returned.  Note this OS packet
+         pointer can be NULL, meaning there is no OS packet attached to this
+         VOS data packet.
+
+  \param clearOSPacket - a boolean value that tells the API to clear out the
+         OS packet pointer from the VOS packet.  Setting this to 'true' will
+         essentially remove the OS packet from the VOS packet.  'false' means
+         the OS packet remains chained to the VOS packet.  In either case,
+         the OS packet pointer is returned to the caller.
+
+  \return VOS_STATUS_SUCCESS - the API was able to retreive the OS packet
+          pointer from the VOS packet and return it to the caller in
+          *ppOsPacket
+
+          VOS_STATUS_E_INVAL - pktType is not a valid packet type.  This
+          API only supports getting vos packets of type
+          VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.
+
+          VOS_STATUS_E_FAULT - pPacket or ppOsPacket does not specify a valid
+          pointers.
+
+  \sa vos_pkt_set_os_packet(), vos_pkt_wrap_data_packet(),
+      vos_pkt_return_packet()
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_os_packet( vos_pkt_t *pPacket,
+                                  v_VOID_t **ppOSPacket,
+                                  v_BOOL_t clearOSPacket )
+{
+   // Validate the input and output parameter pointers
+   if (unlikely((NULL == pPacket)||(NULL == ppOSPacket)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get OS packet pointer
+   *ppOSPacket = (v_VOID_t *) pPacket->pSkb;
+
+   // clear it?
+   if (clearOSPacket)
+   {
+      pPacket->pSkb = NULL;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_user_data_ptr() - return a pointer to user data area
+                                       of a voss Packet
+
+  This API returns a pointer to a specified user Data area in the voss
+  Packet.  User data areas are uniqua areas of the voss Packet that can
+  be used by specific components to store private data.  These areas are
+  identified by a user "ID" and should only be accessed by the component
+  specified.
+
+  \param pPacket - the voss Packet to retreive the user data pointer from.
+
+  \param userID - the identifier for the user data area in the voss Packet
+                  to get.
+
+                  User IDs and user data areas in the voss Packet are
+                  available for:
+                  - Transport Layer (TL)
+                  - Bus Abstraction Layer (BAL)
+                  - SDIO Services Component (SSC)
+                  - Host Device Driver (HDD)
+
+  \param ppUserData - pointer to location to return the pointer to the user
+                      data.
+
+  \return - Nothing.
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+v_VOID_t vos_pkt_get_user_data_ptr( vos_pkt_t *pPacket,
+                                    VOS_PKT_USER_DATA_ID userID,
+                                    v_VOID_t **ppUserData )
+{
+   // Validate the input and output parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "VPKT [%d]: NULL pointer", __LINE__);
+       if (ppUserData != NULL)
+       {
+           *ppUserData = NULL;
+       }
+       return;
+   }
+
+   // Validate that this really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      *ppUserData = NULL;
+      return;
+   }
+
+   // Validate userID
+   if (unlikely(userID >= VOS_PKT_USER_DATA_ID_MAX))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Invalid user ID [%d]", __LINE__, userID);
+      *ppUserData = NULL;
+      return;
+   }
+
+   // retreive the user data pointer from the vos Packet and
+   // return it to the caller.
+   *ppUserData = pPacket->pvUserData[userID];
+
+   return;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_set_user_data_ptr() - set the user data pointer of a voss
+                                        Packet
+
+  This API sets a pointer in the specified user Data area in the voss
+  Packet.  User data areas are uniqua areas of the voss Packet that can
+  be used by specific components to store private data.  These areas are
+  identified by a user "ID" and should only be accessed by the component
+  specified.
+
+  Note:  The size of the user data areas in the voss Packet are fixed.  The
+         size of a single pointer is available in each user area.
+
+  \param pPacket - the voss Packet to set the user pointer.
+
+  \param userID - the identifier for the user data area in the voss Packet
+                  to set.
+
+                  User IDs and user data areas in the voss Packet are
+                  available for:
+                  - Transport Layer (TL)
+                  - Bus Abstraction Layer (BAL)
+                  - SDIO Services Component (SSC)
+                  - Host Device Driver (HDD)
+
+  \param pUserData - pointer value to set in the user data area of the voss
+                     packet..
+
+  \return - Nothing.
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+v_VOID_t vos_pkt_set_user_data_ptr( vos_pkt_t *pPacket,
+                                    VOS_PKT_USER_DATA_ID userID,
+                                    v_VOID_t *pUserData )
+{
+   // Validate the input parameter pointer
+   if (unlikely(NULL == pPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return;
+   }
+
+   // Validate userID
+   if (unlikely(userID >= VOS_PKT_USER_DATA_ID_MAX))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Invalid user ID [%d]", __LINE__, userID);
+      return;
+   }
+
+   // retreive the user data pointer from the vos Packet and
+   // return it to the caller.
+   pPacket->pvUserData[userID] = pUserData;
+
+   return;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_return_packet() - Return a voss Packet (chain) to vOSS
+
+  This API returns a voss Packet to the internally managed packet pool.
+
+  Note:  If there are multiple packets chained to this packet, the entire
+  packet chain is returned to vOSS.  The caller must unchain the
+  packets through vos_pkt_get_next_packet() and return them individually
+  if all packets in the packet chain are not to be returned.
+
+  \param pPacket - the voss Packet(s) to return.  Note all packets chained
+                   to this packet are returned to vOSS.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_return_packet( vos_pkt_t *pPacket )
+{
+   vos_pkt_t *pNext;
+   struct list_head *pPktFreeList;
+   vos_pkt_low_resource_info *pLowResourceInfo;
+   vos_pkt_get_packet_callback callback;
+   v_SIZE_t *pCount;
+   int rc; 
+   VOS_PKT_TYPE packetType = VOS_PKT_TYPE_TX_802_3_DATA;
+
+   // Validate the input parameter pointer
+   if (unlikely(NULL == pPacket))
+   {
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // iterate though all packets in the chain
+   while (pPacket)
+   {
+      // unlink this packet from the chain
+      pNext = pPacket->pNext;
+      pPacket->pNext = NULL;
+
+      // Validate that this really an initialized vos packet
+      if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: Invalid magic", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      //If an skb is attached then reset the pointers      
+      if (pPacket->pSkb)
+      {
+         pPacket->pSkb->len = 0;
+         pPacket->pSkb->data = pPacket->pSkb->head;
+         skb_reset_tail_pointer(pPacket->pSkb);
+         skb_reserve(pPacket->pSkb, VPKT_SIZE_BUFFER);
+      }
+
+      pCount = NULL;
+      // determine which packet pool and low resource block we should use.
+      switch (pPacket->packetType)
+      {
+      case VOS_PKT_TYPE_RX_RAW:
+         // if this packet still has an skb attached, we can put it
+         // back in the free pool, otherwise we need to put it in the
+         // replenish pool
+         if (pPacket->pSkb)
+         {
+            pPktFreeList = &gpVosPacketContext->rxRawFreeList;
+            pLowResourceInfo = &gpVosPacketContext->rxRawLowResourceInfo;
+         }
+         else
+         {
+            pPktFreeList = &gpVosPacketContext->rxReplenishList;
+            pLowResourceInfo = NULL;
+            pCount = &gpVosPacketContext->rxReplenishListCount;
+         }
+         packetType = VOS_PKT_TYPE_RX_RAW;
+         break;
+
+      case VOS_PKT_TYPE_TX_802_11_MGMT:
+                
+         pPktFreeList = &gpVosPacketContext->txMgmtFreeList;
+         pLowResourceInfo = &gpVosPacketContext->txMgmtLowResourceInfo;
+         
+         break;
+
+      case VOS_PKT_TYPE_TX_802_3_DATA:
+         pPktFreeList = &gpVosPacketContext->txDataFreeList;
+         pLowResourceInfo = &gpVosPacketContext->txDataLowResourceInfo;
+#ifdef WLAN_SOFTAP_FEATURE
+         gpVosPacketContext->uctxDataFreeListCount ++;
+#endif
+         break;
+
+      default:
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: invalid packet type %d[%s]",
+                   __LINE__, pPacket->packetType,
+                   vos_pkti_packet_type_str(pPacket->packetType));
+
+         return VOS_STATUS_E_INVAL;
+      }
+
+
+      // is there a low resource condition pending for this packet type?
+      if (pLowResourceInfo && pLowResourceInfo->callback)
+      {
+         // [DEBUG]
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,"VPKT [%d]: recycle %p",  __LINE__, pPacket);
+
+         // yes, so rather than placing the packet back in the free pool
+         // we will invoke the low resource callback
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                   "VPKT [%d]: [%p] Packet recycled, type %d[%s]",
+                   __LINE__, pPacket, pPacket->packetType,
+                   vos_pkti_packet_type_str(pPacket->packetType));
+
+         // clear out the User Data pointers in the voss packet..
+         memset(&pPacket->pvUserData, 0, sizeof(pPacket->pvUserData));
+
+         // initialize the 'chain' pointer to NULL.
+         pPacket->pNext = NULL;
+
+         // timestamp the vos packet.
+         pPacket->timestamp = vos_timer_get_system_ticks();
+
+         callback = pLowResourceInfo->callback;
+         pLowResourceInfo->callback = NULL;
+         callback(pPacket, pLowResourceInfo->userData);
+      }
+      else
+      {
+         // this packet does not satisfy a low resource condition
+         // so put it back in the appropriate free pool
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                   "VPKT [%d]: [%p] Packet returned, type %d[%s]",
+                   __LINE__, pPacket, pPacket->packetType,
+                   vos_pkti_packet_type_str(pPacket->packetType));
+         rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
+         list_add_tail(&pPacket->node, pPktFreeList);
+         if (likely(0 == rc)) 
+         {
+            mutex_unlock(&gpVosPacketContext->mlock);
+         }
+         if (pCount)
+         {
+            (*pCount)++;
+         }
+      }
+
+      // move to next packet in the chain
+      pPacket = pNext;
+
+   } // while (pPacket)
+
+   // see if we need to replenish the Rx Raw pool
+   if (VOS_PKT_TYPE_RX_RAW == packetType)
+   {
+      vos_pkti_replenish_raw_pool();   
+   }
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_chain_packet() - chain a voss Packet to another packet
+
+  This API chains a voss Packet to another voss Packet, creating a packet
+  chain.  Packets can be chained before or after the current packet in the
+  packet chain.
+
+  \param pPacket - pointer to a voss packet to chain to
+
+  \param pChainPacket - pointer to packet to chain
+
+  \param chainAfter - boolean to specify to chain packet after or before
+                      the input packet
+  <ul>
+    <li> true - chain packet AFTER pPacket (chain behind)
+    <li> false - chain packet BEFORE pPacket (chain in front)
+  </ul>
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_chain_packet( vos_pkt_t *pPacket,
+                                 vos_pkt_t *pChainPacket,
+                                 v_BOOL_t chainAfter )
+{
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == pChainPacket)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that these are really initialized vos packets
+   if (unlikely((VPKT_MAGIC_NUMBER != pPacket->magic) ||
+                (VPKT_MAGIC_NUMBER != pChainPacket->magic)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // swap pointers if we chain before
+   if (unlikely(VOS_FALSE == chainAfter))
+   {
+      vos_pkt_t *pTmp = pPacket;
+      pPacket = pChainPacket;
+      pChainPacket = pTmp;
+   }
+
+   // find the end of the chain
+   while (pPacket->pNext)
+   {
+      pPacket = pPacket->pNext;
+   }
+
+   // attach
+   pPacket->pNext = pChainPacket;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_walk_packet_chain() - Walk packet chain and (possibly)
+                                        unchain packets
+
+  This API will walk the voss Packet and unchain the packet from the chain,
+  if specified.  The 'next' packet in the packet chain is returned as the
+  packet chain is traversed.
+
+  \param  pPacket - input vos_packet walk
+
+  \param ppChainedPacket - pointer to location to return the 'next' voss
+                           packet pointer in the packet chain.
+                           NULL means there is was not packet chained
+                           to this packet.
+
+  \param unchainPacket - Flag that specifies if the caller wants the packet
+                         to be removed from the packet chain.  This is
+                         provided to allow the caller to walk the packet chain
+                         with or without breaking the chain.
+
+    <ul>
+      <li> true - when set 'true' the API will return
+                  the 'next' packet pointer in the voss Packte chain and
+                  *WILL* unchain the input packet from the packet chain.
+
+      <li> NOT false - when set 'false' the API will return
+                       the 'next' packet pointer in the voss Packet chain but
+                       *WILL NOT* unchain the packet chain.   This option gives
+                       the caller the ability to walk the packet chain without
+                       modifying it in the process.
+    </ul>
+
+  \note Having the packets chained has an implicaiton on how the return
+        packet API (vos_pkt_return_packet() ) operates.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_walk_packet_chain( vos_pkt_t *pPacket,
+                                      vos_pkt_t **ppChainedPacket,
+                                      v_BOOL_t unchainPacket )
+{
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == ppChainedPacket)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get next packet
+   *ppChainedPacket = pPacket->pNext;
+
+   // if asked to unchain, then unchain it
+   if (VOS_FALSE != unchainPacket)
+   {
+      pPacket->pNext = NULL;
+   }
+
+   // if end of the chain, indicate empty to the caller
+   if (*ppChainedPacket)
+   {
+      return VOS_STATUS_SUCCESS;
+   }
+   else
+   {
+      return VOS_STATUS_E_EMPTY;
+   }
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_data_vector() - Get data vectors from a voss Packet
+
+  This API gets the complete set of Vectors (pointer / length pairs) that
+  describe all of the data that makes up the voss Packet.
+
+  \param pPacket - pointer to the vOSS Packet to get the pointer/length
+                   vector from
+
+  \param pVector - pointer to the vector array where the vectors are returned.
+
+  \param pNumVectors - Number of vector's in the vector array (at pVector).
+                       On successful return, *pNumVectors is updated with the
+                       number of pointer/length vectors at pVector populated
+                       with valid vectors.
+
+  Call with NULL pVector or 0 vectorSize, will return the size of vector
+  needed (in *pNumVectors)
+
+  Caller allocates and frees the vector memory.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_data_vector( vos_pkt_t *pPacket,
+                                    vos_pkt_data_vector_t *pVector,
+                                    v_SIZE_t *pNumVectors )
+{
+   // not supported
+
+   VOS_ASSERT(0);
+   return VOS_STATUS_E_FAILURE;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_extract_data() - Extract data from the voss Packet.
+
+  This API extracts data from a voss Packet, copying the data into the
+  supplied output buffer.  Note the data is copied from the vos packet
+  but the data remains in the vos packet and the size is unaffected.
+
+  \param pPacket - the voss Packet to get the data from.
+
+  \param pktOffset - the offset from the start of the voss Packet to get the
+         data.  (i.e. 0 would be the beginning of the voss Packet).
+
+  \param pOutputBuffer - Pointer to the location where the voss Packet data
+         will be copied.
+
+  \param pOutputBufferSize - on input, contains the amount of data to extract
+         into the output buffer.  Upon return, contains the amount of data
+         extracted into the output buffer.
+
+         Note:  an input of 0 in *pOutputBufferSize, means to copy *all*
+         data in the voss Packet into the output buffer.  The caller is
+         responsible for assuring the output buffer size is big enough
+         since the size of the buffer is not being passed in!
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_extract_data( vos_pkt_t *pPacket,
+                                 v_SIZE_t pktOffset,
+                                 v_VOID_t *pOutputBuffer,
+                                 v_SIZE_t *pOutputBufferSize )
+{
+   v_SIZE_t len;
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == pOutputBuffer) ||
+                (NULL == pOutputBufferSize)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get number of bytes requested
+   len = *pOutputBufferSize;
+
+   // if 0 is input in the *pOutputBufferSize, then the user wants us to 
+   // extract *all* the data in the buffer.  Otherwise, the user has 
+   // specified the output buffer size in *pOutputBufferSize.  In the 
+   // case where the output buffer size is specified, let's validate that 
+   // it is big enough.
+   //
+   // \note:  i'm not crazy about this.  we should enforce the output
+   // buffer size on input so this API is not going to cause crashes
+   // because buffers are too small and the caller inputs 0 == don't care
+   // to check the size... !!
+   if (0 == len)
+   {
+      len = skb->len - pktOffset;
+
+      // return # of bytes copied
+      *pOutputBufferSize = len;
+   }
+   else
+   {
+      // make sure we aren't extracting past the end of the packet
+      if (len > (skb->len - pktOffset))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "VPKT [%d]: Request overrun, "
+                   "req offset %d, req size %d, packet size %d",
+                   __LINE__, pktOffset, len, skb->len);
+         return VOS_STATUS_E_INVAL;
+      }
+   }
+
+   // copy the data
+   memcpy(pOutputBuffer, &skb->data[pktOffset], len);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_extract_data_chain() - Extract data from a voss Packet chain.
+
+  This API extracts *all* the data from a voss Packet chain, copying the
+  data into the supplied output buffer.  Note the data is copied from
+  the vos packet chain but the data remains in the vos packet and the
+  size of the vos packets are unaffected.
+
+  \param pPacket - the first voss Packet in the voss packet chain to
+         extract data.
+
+  \param pOutputBuffer - Pointer to the location where the voss Packet data
+         will be copied.
+
+  \param pOutputBufferSize - on input, contains the maximum amount of data
+         that can be extracted into the output buffer.  Upon return, contains
+         the amount of data extracted from the packet chain.
+
+  \return VOS_STATUS_SUCCESS - the data from the entire packet chain is
+          extracted and found at *pOutputBuffer.  *pOutputBufferSize bytes
+          were extracted.
+
+          VOS_STATUS_E_FAULT - pPacket, pOutputBuffer, or pOutputBufferSize
+          is not a valid pointer.
+
+          VOS_STATUS_E_NOMEM - there is not enough room to extract the data
+          from the entire packet chain. *pOutputBufferSize has been updated
+          with the size needed to extract the entier packet chain.
+
+  \sa vos_pkt_extract_data()
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_extract_data_chain( vos_pkt_t *pPacket,
+                                       v_VOID_t *pOutputBuffer,
+                                       v_SIZE_t *pOutputBufferSize )
+{
+   VOS_STATUS vosStatus;
+   v_SIZE_t len;
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == pOutputBuffer) ||
+                (NULL == pOutputBufferSize)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get the length of the entire packet chain.
+   vosStatus = vos_pkt_get_packet_chain_length(pPacket, &len);
+   if (unlikely(VOS_STATUS_SUCCESS != vosStatus))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Unable to get packet chain length", __LINE__);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   // if the output buffer size is too small, return NOMEM and update
+   // the actual size needed in *pOutputBufferSize
+   if (len > *pOutputBufferSize)
+   {
+      *pOutputBufferSize = len;
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   // walk through each packet in the chain, copying the data
+   while (pPacket)
+   {
+      // get pointer to the skb
+      skb = pPacket->pSkb;
+
+      // Validate the skb
+      if (unlikely(NULL == skb))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: NULL skb", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      memcpy(pOutputBuffer, skb->data, skb->len);
+      pOutputBuffer += skb->len;
+
+      pPacket = pPacket->pNext;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_peek_data() - peek into voss Packet at given offset
+
+  This API provides a pointer to a specified offset into a voss Packet,
+  allowing the caller to peek at a given number of bytes in the voss Packet.
+  Upon successful return, the caller can access "numBytes" of data at
+  "pPacketData".
+
+  This API will fail if the data length requested to peek at is not in
+  contiguous memory in the voss Packet.  In this case, the caller should
+  use vos_pkt_extract_data() to have the data copied into a caller supplied
+  buffer.
+
+  \param pPacket - the vOSS Packet to peek into
+
+  \param pktOffset - the offset into the voss Packet data to peek into.
+
+  \param ppPacketData - pointer to the location where the pointer to the
+                        packet data at pktOffset will be returned.
+
+  \param numBytes - the number of bytes the caller wishes to peek at.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_peek_data( vos_pkt_t *pPacket,
+                              v_SIZE_t pktOffset,
+                              v_VOID_t **ppPacketData,
+                              v_SIZE_t numBytes )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == ppPacketData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate numBytes
+   if (unlikely(0 == numBytes))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid numBytes", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // check for overflow
+   if (unlikely((pktOffset + numBytes) > skb->len))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "VPKT [%d]: Packet overflow, offset %d size %d len %d",
+                __LINE__, pktOffset, numBytes, skb->len);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // return pointer to the requested data
+   *ppPacketData = &skb->data[pktOffset];
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_packet_type() - Get packet type for a voss Packet
+
+  This API returns the packet Type for a voss Packet.
+
+  \param pPacket - the voss Packet to get the packet type from.
+
+  \param pPacketType - location to return the packet type for the voss Packet
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_type( vos_pkt_t *pPacket,
+                                    VOS_PKT_TYPE *pPacketType )
+{
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == pPacketType)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // return the requested information
+   *pPacketType = pPacket->packetType;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_packet_length() - Get packet length for a voss Packet
+
+  This API returns the total length of the data in a voss Packet.
+
+  \param pPacket - the voss Packet to get the packet length from.
+
+  \param pPacketSize - location to return the total size of the data contained
+                       in the voss Packet.
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_length( vos_pkt_t *pPacket,
+                                      v_U16_t *pPacketSize )
+{
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == pPacketSize)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate the skb
+   if (unlikely(NULL == pPacket->pSkb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // return the requested information
+   *pPacketSize = pPacket->pSkb->len;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_packet_chain_length() - Get length of a vos packet chain
+
+  This API returns the total length of the data in a voss Packet chain.
+
+  \param pPacket - the voss Packet at the start of the packet chain.  This API
+         will calculate the length of data in the packet chain stating with
+         this packet.
+
+  \param pPacketSize - location to return the total size of the data contained
+                       in the voss Packet.
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_packet_chain_length( vos_pkt_t *pPacketChain,
+                                            v_SIZE_t *pPacketChainSize )
+{
+   v_SIZE_t chainSize = 0;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacketChain) ||
+                (NULL == pPacketChainSize)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // walk through each packet in the chain, adding its length
+   while (pPacketChain)
+   {
+
+      // Validate that this is really an initialized vos packet
+      if (unlikely(VPKT_MAGIC_NUMBER != pPacketChain->magic))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: Invalid magic", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      // Validate the skb
+      if (unlikely(NULL == pPacketChain->pSkb))
+      {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: NULL skb", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      chainSize += pPacketChain->pSkb->len;
+      pPacketChain = pPacketChain->pNext;
+   }
+
+   // return result
+   *pPacketChainSize = chainSize;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_push_head() - push data on the front a of a voss Packet
+
+  This API will push data onto the front of a voss Packet.  The data will be
+  appended in front of any data already contained in the voss Packet.
+
+  \param pPacket - the voss Packet to modify.
+
+  \param pData - pointer to the data to push onto the head of the voss Packet.
+
+  \param dataSize - the size of the data to put onto the head of the voss
+                    Packet.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_push_head( vos_pkt_t *pPacket,
+                              v_VOID_t *pData,
+                              v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == pData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is headroom.  As a performance optimization we
+   // can omit this check later since skb_push() will also perform the
+   // check (except skb_push() will panic the kernel)
+   if (unlikely(skb_headroom(skb) < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Insufficient headroom, "
+                "head[%p], data[%p], req[%d]",
+                __LINE__, skb->head, skb->data, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // actually push the data
+   memcpy(skb_push(skb, dataSize), pData, dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_reserve_head() - Reserve space at the front of a voss Packet
+
+  This API will reserve space at the front of a voss Packet.  The caller can
+  then copy data into this reserved space using memcpy() like functions.  This
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+
+  Upon successful return, the length of the voss Packet is increased by
+  dataSize.
+
+  < put a before / after picture here>
+
+  \param pPacket - the voss Packet to modify.
+
+  \param ppData - pointer to the location where the pointer to the reserved
+                  space is returned.  Upon successful return, the caller has
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+
+  \param dataSize - the size of the data to reserve at the head of the voss
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_reserve_head( vos_pkt_t *pPacket,
+                                 v_VOID_t **ppData,
+                                 v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+   struct sk_buff *newskb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == ppData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is headroom.  As a performance optimization we
+   // can omit this check later since skb_push() will also perform the
+   // check (except skb_push() will panic the kernel)
+   if (unlikely(skb_headroom(skb) < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "VPKT [%d]: Insufficient headroom, "
+                "head[%p], data[%p], req[%d]",
+                __LINE__, skb->head, skb->data, dataSize);
+    
+      if ((newskb = skb_realloc_headroom(skb, dataSize)) == NULL) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: Failed to realloc headroom", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      kfree_skb(skb);
+      skb = newskb;
+
+      // set the skb pointer
+      pPacket->pSkb = newskb;
+   }
+
+   // actually allocate the headroom
+   *ppData = skb_push(skb, dataSize);
+   // Zero out so we dont take the fastpath on Android.
+   memset( (void *)*ppData, 0, dataSize );
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_reserve_head_fast() - Reserve space at the front of a voss Packet
+
+  This API will reserve space at the front of a voss Packet.  The caller can
+  then copy data into this reserved space using memcpy() like functions.  This
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+
+  Upon successful return, the length of the voss Packet is increased by
+  dataSize.
+ 
+  Same as above APi but no memset to 0 at the end.
+ 
+  < put a before / after picture here>
+
+  \param pPacket - the voss Packet to modify.
+
+  \param ppData - pointer to the location where the pointer to the reserved
+                  space is returned.  Upon successful return, the caller has
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+
+  \param dataSize - the size of the data to reserve at the head of the voss
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_reserve_head_fast( vos_pkt_t *pPacket,
+                                 v_VOID_t **ppData,
+                                 v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+   struct sk_buff *newskb;
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is headroom.  As a performance optimization we
+   // can omit this check later since skb_push() will also perform the
+   // check (except skb_push() will panic the kernel)
+   if (unlikely(skb_headroom(skb) < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "VPKT [%d]: Insufficient headroom, "
+                "head[%p], data[%p], req[%d]",
+                __LINE__, skb->head, skb->data, dataSize);
+    
+      if ((newskb = skb_realloc_headroom(skb, dataSize)) == NULL) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                   "VPKT [%d]: Failed to realloc headroom", __LINE__);
+         return VOS_STATUS_E_INVAL;
+      }
+
+      kfree_skb(skb);
+      skb = newskb;
+
+      // set the skb pointer
+      pPacket->pSkb = newskb;
+   }
+
+   // actually allocate the headroom
+   *ppData = skb_push(skb, dataSize);
+   // Zero out so we dont take the fastpath on Android.
+   //memset( (void *)*ppData, 0, dataSize );
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_pop_head() - Remove data from the front of the voss Packet
+
+  This API removes data from the front of a voss Packet.  The data is
+  copied into the output buffer described by pData and pDataSize
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param pData - pointer to the data buffer where the data removed from the
+                 voss Packet is placed.
+
+  \param dataSize - The amount of space to remove from the head of the voss
+                    Packet.  The output buffer (at *pData) must contain at
+                    least this amount of space.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_pop_head( vos_pkt_t *pPacket,
+                             v_VOID_t *pData,
+                             v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == pData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is enough data to pop
+   if (unlikely(skb->len < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: pop exceeds packet size, len[%d], req[%d]",
+                __LINE__, skb->len, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // copy the data
+   memcpy(pData, skb->data, dataSize);
+   skb_pull(skb, dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_trim_head() - Skip over bytes at the front of a voss Packet
+
+  This API moves the pointers at the head of a voss Packet to essentially
+  skip over data at the front of a voss Packet.  Upon successful return, the
+  length of the voss Packet is reduced by dataSize and the starting pointer
+  to the voss Packet is adjusted to eliminate the data from the start of the
+  voss Packet.
+
+  This API has the opposite effect of \a vos_pkt_reserve_head().
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param dataSize - The amount of space to skip at the start of the voss
+                    Packet.
+
+                    Note that upon return, the data skipped over is
+                    inaccessible to the caller.  If the caller needs access
+                    to the head data, use vos_pkt_pop_head() or
+                    vos_pkt_extract_data() to get a copy of the data.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_trim_head( vos_pkt_t *pPacket,
+                              v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is enough data to trim
+   if (unlikely(skb->len < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: trim exceeds packet size, len[%d], req[%d]",
+                __LINE__, skb->len, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // adjust the skb
+   skb_pull(skb, dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_push_tail() - push data on the end a of a voss Packet
+
+  This API will push data onto the end of a voss Packet.  The data will be
+  appended to the end of any data already contained in the voss Packet.
+
+  \param pPacket - the voss Packet to modify.
+
+  \param pData - pointer to the data to push onto the tail of the voss Packet.
+
+  \param dataSize - the size of the data to put onto the tail of the voss Packet.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_push_tail( vos_pkt_t *pPacket,
+                              v_VOID_t *pData,
+                              v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == pData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is tailroom.  As a performance optimization we
+   // can omit this check later since skb_put() will also perform the
+   // check (except skb_put() will panic the kernel)
+   if (unlikely(skb_tailroom(skb) < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Insufficient tailroom, "
+                "tail[%p], end[%p], req[%d]",
+                __LINE__, skb_tail_pointer(skb),
+                skb_end_pointer(skb), dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // actually push the data
+   memcpy(skb_put(skb, dataSize), pData, dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_reserve_tail() - Reserve space at the end of a voss Packet
+
+  This API will reserve space at the end of a voss Packet.  The caller can
+  then copy data into this reserved space using memcpy() like functions.  This
+  allows the caller to reserve space and build headers directly in this
+  reserved space in the voss Packet.
+
+  Upon successful return, the length of the voss Packet is increased by
+  dataSize.
+
+  \param pPacket - the voss Packet to modify.
+
+  \param ppData - pointer to the location where the pointer to the reserved
+                  space is returned.  Upon successful return, the caller has
+                  write / read access to the data space at *ppData for length
+                  dataSize to build headers, etc.
+
+  \param dataSize - the size of the data to reserve at the head of the voss
+                    Packet.  Upon successful return, the length of the voss
+                    Packet is increased by dataSize.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_reserve_tail( vos_pkt_t *pPacket,
+                                 v_VOID_t **ppData,
+                                 v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == ppData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is tailroom.  As a performance optimization we
+   // can omit this check later since skb_put() will also perform the
+   // check (except skb_put() will panic the kernel)
+   if (unlikely(skb_tailroom(skb) < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Insufficient tailroom, "
+                "tail[%p], end[%p], req[%d]",
+                __LINE__, skb_tail_pointer(skb),
+                skb_end_pointer(skb), dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // actually allocate the space
+   *ppData = skb_put(skb, dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_pop_tail() - Remove data from the end of the voss Packet
+
+  This API removes data from the end of a voss Packet.  The data is
+  copied into the output buffer described by pData and pDataSize
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param pData - pointer to the data buffer where the data removed from the
+                 voss Packet is placed.
+
+  \param dataSize - The amount of space to remove from the end of the voss
+                    Packet.  The output buffer (at *pData) must contain at
+                    least this amount of space.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_pop_tail( vos_pkt_t *pPacket,
+                             v_VOID_t *pData,
+                             v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) || (NULL == pData)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is enough data to pop
+   if (unlikely(skb->len < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: pop exceeds packet size, len[%d], req[%d]",
+                __LINE__, skb->len, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // adjust pointers (there isn't a native Linux API for this)
+   skb->tail -= dataSize;
+   skb->len -= dataSize;
+
+   // actually push the data
+   memcpy(pData, skb_tail_pointer(skb), dataSize);
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_trim_tail() - Skip over bytes at the end of a voss Packet
+
+  This API moves the pointers at the head of a voss Packet to essentially
+  skip over data at the end of a voss Packet.  Upon successful return, the
+  length of the voss Packet is reduced by dataSize and voss Packet is
+  adjusted to eliminate the data from the end of the voss Packet.
+
+  This API has the opposite effect of \a vos_pkt_reserve_tail().
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param dataSize - The amount of space to remove at the end of the voss
+                    Packet.
+
+                    Note that upon return, the data skipped over is
+                    inaccessible to the caller.  If the caller needs access
+                    to the tail data, use vos_pkt_pop_tail() or
+                    vos_pkt_extract_data() to get a copy of the data.
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_trim_tail( vos_pkt_t *pPacket,
+                              v_SIZE_t dataSize )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Make sure there is enough data to pop
+   if (unlikely(skb->len < dataSize))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: pop exceeds packet size, len[%d], req[%d]",
+                __LINE__, skb->len, dataSize);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // adjust pointers (there isn't a native Linux API for this)
+   skb->tail -= dataSize;
+   skb->len -= dataSize;
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_get_timestamp() - Retrive the timestamp attribute from the
+  specified VOSS packet
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param pTstamp - the timestamp will be returned here.
+
+  \return VOS_STATUS_E_FAULT - invalid parameter(s) specified
+
+          VOS_STATUS_SUCCESS - timestamp retrived successfully
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_timestamp( vos_pkt_t *pPacket,
+                                  v_TIME_t* pTstamp )
+{
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket) ||
+                (NULL == pTstamp)))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // return the requested information
+   *pTstamp = pPacket->timestamp;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**--------------------------------------------------------------------------
+
+  \brief vos_pkt_flatten_rx_pkt() - Transform a platform based RX VOSS
+  packet into a flat buffer based VOSS packet if needed. This is needed in
+  cases where for reasons of efficiency we want the RX packets to be very
+  platform specific (for e.g. DSM based on AMSS, etc). However platform
+  independent code may rely on making calls on the VOSS packet which can only
+  be supported by the flat buffer based implementation of a RX packet. This API
+  will allocate a new VOSS packet with flat buffer, extract the data from the
+  input VOSS packet and then release the input VOSS packet. The new VOSS packet
+  will be returned from this call.
+
+  \param ppPacket - the voss Packet to operate on. On input contains
+                    the platform based packet. On output contains the flat
+                    buffer based packet. Any applicable resources
+                    are freed as part of this call.
+
+  \return VOS_STATUS_E_FAULT - invalid parameter specified
+
+          VOS_STATUS_E_INVAL - packet type not RX_RAW
+
+          VOS_STATUS_SUCCESS - transform successful
+
+          other VOSS status - other errors encountered
+
+  \sa
+
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_flatten_rx_pkt( vos_pkt_t **ppPacket )
+{
+   // Linux/Android skbs are already flat, no work required
+   return VOS_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_set_rx_length() - Set the length of a received packet 
+
+  This API set the length of the data inside the packet after a DMA has occurred
+  on rx, it will also set the tail pointer to the end of the data.
+
+  \param pPacket - the voss Packet to operate on.
+
+  \param pktLen - The size of the data placed in the Rx packet during DMA.
+
+
+  \return
+
+  \sa
+
+  ---------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_set_rx_length( vos_pkt_t *pPacket,
+                                  v_SIZE_t pktLen )
+{
+   struct sk_buff *skb;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL pointer", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Validate that this is really an initialized vos packet
+   if (unlikely(VPKT_MAGIC_NUMBER != pPacket->magic))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: Invalid magic", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // get pointer to the skb
+   skb = pPacket->pSkb;
+
+   // Validate the skb
+   if (unlikely(NULL == skb))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "VPKT [%d]: NULL skb", __LINE__);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // adjust pointers (there isn't a native Linux API for this)
+   // ?? - is this sufficient? 
+   skb_set_tail_pointer(skb, pktLen);
+   skb->len   = pktLen;
+
+   return VOS_STATUS_SUCCESS; 
+
+}
+/**--------------------------------------------------------------------------
+  
+  \brief vos_pkt_get_available_buffer_pool() - Get avaliable VOS packet size
+   VOSS Packet pool is limitted resource
+   VOSS Client need to know how many packet pool is still avaliable to control
+   the flow
+   
+  \param  pktType - Packet type want to know free buffer count
+                    VOS_PKT_TYPE_TX_802_11_MGMT, management free buffer count,
+                    VOS_PKT_TYPE_TX_802_11_DATA
+                    VOS_PKT_TYPE_TX_802_3_DATA, TX free buffer count
+                    VOS_PKT_TYPE_RX_RAW, RX free buffer count
+
+          vosFreeBuffer - free frame buffer size
+  
+  \return VOS_STATUS_E_INVAL - invalid input parameter
+
+          VOS_STATUS_SUCCESS - Get size success
+    
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+VOS_STATUS vos_pkt_get_available_buffer_pool (VOS_PKT_TYPE  pktType,
+                                              v_SIZE_t     *vosFreeBuffer)
+{
+   struct list_head *pList;
+   struct list_head *pNode;
+   v_SIZE_t count;
+   int rc; 
+   if (NULL == vosFreeBuffer)
+   {
+      return VOS_STATUS_E_INVAL;
+   }
+
+   switch (pktType)
+   {
+   case VOS_PKT_TYPE_TX_802_11_MGMT:
+      pList = &gpVosPacketContext->txMgmtFreeList;
+      break;
+
+   case VOS_PKT_TYPE_TX_802_11_DATA:
+   case VOS_PKT_TYPE_TX_802_3_DATA:
+#ifdef WLAN_SOFTAP_FEATURE
+      if (VOS_STA_SAP_MODE == hdd_get_conparam())
+      {
+         *vosFreeBuffer = gpVosPacketContext->uctxDataFreeListCount;  
+          return VOS_STATUS_SUCCESS;
+      }
+      else
+#endif
+      pList = &gpVosPacketContext->txDataFreeList;
+      break;
+
+   case VOS_PKT_TYPE_RX_RAW:
+      // if the caller is curious how many raw packets are available
+      // then he probably wants as many packets to be available as
+      // possible so replenish the raw pool
+      vos_pkti_replenish_raw_pool();
+      pList = &gpVosPacketContext->rxRawFreeList;
+      break;
+
+   default:
+      return (VOS_STATUS_E_INVAL);
+   }
+
+   count = 0;
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
+   list_for_each(pNode, pList)
+   {
+      count++;
+   }
+   if (likely(0 == rc))
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+   }
+   *vosFreeBuffer = count;
+   return VOS_STATUS_SUCCESS;
+}
+
+
+#ifdef VOS_PACKET_UNIT_TEST
+#include "vos_packet_test.c"
+#endif
diff --git a/CORE/VOSS/src/vos_power.c b/CORE/VOSS/src/vos_power.c
new file mode 100644
index 0000000..f1909e2
--- /dev/null
+++ b/CORE/VOSS/src/vos_power.c
@@ -0,0 +1,1476 @@
+/*
+ * 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
+  vos_power.c
+
+  @brief
+  This is the interface to VOSS power APIs using for power management 
+  of the WLAN Libra module from the MSM PMIC. These implementation of 
+  these APIs is very target dependent, also these APIs should only be
+  used when the WLAN Libra module is powered from the MSM PMIC and not
+  from an external independent power source
+
+*/
+
+/*===========================================================================
+
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved
+
+  Qualcomm Proprietary
+
+  Export of this technology or software is regulated by the U.S. Government.
+  Diversion contrary to U.S. law prohibited.
+
+  All ideas, data and information contained in or disclosed by
+  this document are confidential and proprietary information of
+  QUALCOMM Incorporated and all rights therein are expressly reserved.
+  By accepting this material the recipient agrees that this material
+  and the information contained therein are held in confidence and in
+  trust and will not be used, copied, reproduced in whole or in part,
+  nor its contents revealed in any manner to others without the express
+  written permission of QUALCOMM Incorporated.
+
+===========================================================================*/
+
+/*===========================================================================
+
+                        EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+$Header: $
+
+when       who     what, where, why
+--------   ---     ----------------------------------------------------------
+
+===========================================================================*/
+
+/*===========================================================================
+
+                           INCLUDE FILES
+
+===========================================================================*/
+#include <vos_power.h>
+
+#ifdef ANI_BUS_TYPE_SDIO
+#include <libra_sdioif.h>
+#endif
+
+#ifdef MSM_PLATFORM
+#include <mach/mpp.h>
+#include <mach/vreg.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+
+#ifdef MSM_PLATFORM_7x30
+#include <mach/irqs-7x30.h>
+#include <linux/mfd/pmic8058.h>
+#include <mach/rpc_pmapp.h>
+#include <mach/pmic.h>
+#endif
+
+#ifdef MSM_PLATFORM_8660
+#include <qcomwlan_pwrif.h>
+#endif
+
+#ifdef MSM_PLATFORM_7x27A
+#include <linux/qcomwlan7x27a_pwrif.h>
+#endif
+
+#endif //MSM_PLATFORM
+
+#include <vos_sched.h>
+
+//To work around issues of fail to turn WIFI back on after turning it off
+#define VOS_PWR_WIFI_ON_OFF_HACK
+#ifdef VOS_PWR_WIFI_ON_OFF_HACK
+#define VOS_PWR_SLEEP(ms) msleep(ms)
+#else
+#define VOS_PWR_SLEEP(ms)
+#endif
+
+/*===========================================================================
+
+                        DEFINITIONS AND TYPES
+
+===========================================================================*/
+
+#define CHIP_POWER_ON         1
+#define CHIP_POWER_OFF        0
+
+// SDIO Config Cycle Clock Frequency
+#define WLAN_LOW_SD_CONFIG_CLOCK_FREQ 400000
+
+#ifdef MSM_PLATFORM_7x30
+
+#define PM8058_GPIO_PM_TO_SYS(pm_gpio)  (pm_gpio + NR_GPIO_IRQS)
+
+static const char* id = "WLAN";
+
+struct wlan_pm8058_gpio {
+    int gpio_num;
+    struct pm_gpio gpio_cfg;
+};
+
+
+//PMIC8058 GPIO COnfiguration for MSM7x30 //ON
+static struct wlan_pm8058_gpio wlan_gpios_reset[] = {
+    {PM8058_GPIO_PM_TO_SYS(22),{PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_NO, 2, PM_GPIO_STRENGTH_LOW, PM_GPIO_FUNC_NORMAL, 0}},
+};
+
+//OFF
+static struct wlan_pm8058_gpio wlan_gpios_reset_out[] = {
+    {PM8058_GPIO_PM_TO_SYS(22),{PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, 1, PM_GPIO_PULL_NO, 2, PM_GPIO_STRENGTH_HIGH, PM_GPIO_FUNC_NORMAL, 0}},
+};
+
+
+/* Routine to power on/off Volans chip */
+int vos_chip_power_qrf8600(int on)
+{
+    struct vreg *vreg_wlan = NULL;
+    struct vreg *vreg_gp16 = NULL;
+    struct vreg *vreg_gp15 = NULL;
+    struct vreg *vreg_s2 = NULL;
+    int rc = 0;
+
+VOS_PWR_SLEEP(100);
+    //2.9v PA from LDO13
+    vreg_wlan = vreg_get(NULL, "wlan");
+    if (IS_ERR(vreg_wlan)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg get failed (%ld)\n",
+                             __func__, PTR_ERR(vreg_wlan));
+        return PTR_ERR(vreg_wlan);
+    }
+
+    //1.2V AON from LDO24
+    vreg_gp16 = vreg_get(NULL, "gp16");
+    if (IS_ERR(vreg_gp16))  {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp16 vreg get failed (%ld)\n",
+                             __func__, PTR_ERR(vreg_gp16));
+        return PTR_ERR(vreg_gp16);
+    }
+
+    //1.2V sw from LDO22
+    vreg_gp15 = vreg_get(NULL, "gp15");
+    if (IS_ERR(vreg_gp15))  {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp15 vreg get failed (%ld)\n",
+                             __func__, PTR_ERR(vreg_gp15));
+        return PTR_ERR(vreg_gp15);
+    }
+
+    //1.3V sw from S2
+    vreg_s2 = vreg_get(NULL, "s2");
+    if (IS_ERR(vreg_s2)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg get failed (%ld)\n",
+                             __func__, PTR_ERR(vreg_s2));
+        return PTR_ERR(vreg_s2);
+    }
+
+    if (on) {
+        /* Program GPIO 23 to de-assert (drive 1) external_por_n (default 0x00865a05 */
+        rc = pm8xxx_gpio_config(wlan_gpios_reset[0].gpio_num, &wlan_gpios_reset[0].gpio_cfg);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: pmic gpio %d config failed (%d)\n",
+                            __func__, wlan_gpios_reset[0].gpio_num, rc);
+            return -EIO;
+        }
+        VOS_PWR_SLEEP(300);
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "WLAN put in reset mode \n");
+#if 0
+        rc = pmapp_clock_vote("wlan", PMAPP_CLOCK_ID_A0, PMAPP_CLOCK_VOTE_ON);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Voting TCXO to ON failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+#endif
+        /* Configure TCXO to be slave to WLAN_CLK_PWR_REQ */
+        rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_A0, PMAPP_CLOCK_VOTE_PIN_CTRL);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Configuring TCXO to Pin controllable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "TCXO configured to be slave to WLAN_CLK_PWR-REQ \n");
+        printk(KERN_ERR "TCXO is now slave to clk_pwr_req \n");
+
+        //Wait 10msec
+        msleep(10);
+
+        /* Enable L13 to output 2.9V (default 2.9V) */
+        rc = vreg_set_level(vreg_wlan, 3050);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg set level failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+        rc = vreg_enable(vreg_wlan);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg enable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "2.9V Power Supply Enabled \n");
+        printk(KERN_ERR "3.05V Supply Enabled \n");
+
+        /* Enable L24 to output 1.2V AON(default 1.3V) */
+        rc = vreg_set_level(vreg_gp16, 1200);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp16 vreg set level failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+        rc = vreg_enable(vreg_gp16);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp16 vreg enable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.2V AON Power Supply Enabled \n");
+        printk(KERN_ERR "1.2V AON Supply Enabled \n");
+
+        //Wait 300usec
+        msleep(1);
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.2V AON Power Supply Enabled \n");
+
+        rc = pm8xxx_gpio_config(wlan_gpios_reset_out[0].gpio_num, &wlan_gpios_reset_out[0].gpio_cfg);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: pmic gpio %d config failed (%d)\n",
+                            __func__, wlan_gpios_reset_out[0].gpio_num, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "WLAN is out of reset now \n");
+        printk(KERN_ERR "WLAN is out of reset \n");
+
+        /* Wait 500usec */
+        msleep(1);
+
+        /* TODO: Replace the code to enable 1.2V sw and 1.3V sw once we have the API to set these power supplies Pin controllable */
+
+        /* Enable 1.2 switcheable power supply */
+        rc = vreg_set_level(vreg_gp15, 1200);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp15 vreg set level failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+#ifdef WLAN_FEATURE_VOS_POWER_VOTED_SUPPLY
+        rc = vreg_enable(vreg_gp15);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp15 vreg enable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+#else        
+        /* 1.2v switchable supply is following the clk_pwr_req signal */
+        rc = pmapp_vreg_pincntrl_vote(id, PMAPP_VREG_LDO22, PMAPP_CLOCK_ID_A0, VOS_TRUE);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp15 vreg enable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+        vos_sleep(5);
+#endif
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.2V sw Power Supply is enabled \n");
+        printk(KERN_ERR "1.2V sw is enabled \n");
+
+        /* Enable 1.3 switcheable power supply */
+        rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 1300);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg set level failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+        VOS_PWR_SLEEP(300);
+
+#ifdef WLAN_FEATURE_VOS_POWER_VOTED_SUPPLY
+        rc = vreg_enable(vreg_s2);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg enable failed. .(%d)\n",__func__, rc);
+            return -EIO;
+        }
+        msleep(1);
+#else        
+        /* 1.3v switchable supply is following the clk_pwr_req signal */
+        rc = pmapp_vreg_pincntrl_vote(id, PMAPP_VREG_S2, PMAPP_CLOCK_ID_A0, VOS_TRUE);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg enable failed. (%d)\n",__func__, rc);
+            return -EIO;
+        }
+        vos_sleep(5);
+#endif
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.3V sw Power Supply is enabled \n");
+        printk(KERN_ERR "1.3V sw is enabled \n");
+
+    } else {
+
+        /**
+        Assert the external POR to keep the chip in reset state. When the chip is turned
+        on the next time, it won't be detected by the bus driver until we deassert it.
+        This is to work-around the issue where it fails sometimes when turning WIFI off and on
+        though GUI. The theory is that, even though we vote off 1.2V AON, it may still on because
+        it is shared by other components. When the next time to turn on WIFI, polling is turned on
+        first and when librasdioif.ko is loaded, the card is detected right away before wlan driver loads. 
+        The bus driver may have finished configuration of the device. When WLAN driver loads, 
+        it resets the device that causes issues when the bus driver tries to assess the chip later.
+        This setting draws more power after the driver is unloaded.
+
+        The load sequence is
+        1. Enable polling
+        2. insmod librasdioif.ko (if card detected, stop polling)
+        3. insmod libra.ko (reset the chip)
+        4. stop polling
+        **/
+        /* Program GPIO 23 to de-assert (drive 1) external_por_n to prevent chip detection
+           until it is asserted.
+        */
+        rc = pm8xxx_gpio_config(wlan_gpios_reset[0].gpio_num, &wlan_gpios_reset[0].gpio_cfg);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: pmic gpio %d config failed (%d)\n",
+                            __func__, wlan_gpios_reset[0].gpio_num, rc);
+            return -EIO;
+        }
+
+#ifdef WLAN_FEATURE_VOS_POWER_VOTED_SUPPLY
+        /* TODO: Remove the code to disable 1.2V sw and 1.3V sw once we have the API to set these power supplies Pin controllable */
+        printk(KERN_ERR "power down switchable\n");
+        rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 0);
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg set level failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+        
+        /* 1.3V sw */    
+        rc = vreg_disable(vreg_s2); 
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: s2 vreg disable failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.3V sw is disabled \n");
+
+        /* 1.2V sw */
+        rc = vreg_disable(vreg_gp15); 
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp15 vreg disable failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.2V sw is disabled \n");
+#endif //#ifdef WLAN_FEATURE_VOS_POWER_VOTED_SUPPLY
+
+        /* 1.2V AON */
+        rc = vreg_disable(vreg_gp16); 
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp16 vreg disable failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "1.2V AON is disabled \n");
+
+#ifdef VOLANS_2_0
+        /* Cannot turn off 2.9V due to the PAD issue on Volans */
+
+        /* 2.9V */
+        rc = vreg_disable(vreg_wlan); 
+        if (rc) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg disable failed (%d)\n", __func__, rc);
+            return -EIO;
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "2.9V is disabled \n");
+#endif
+    }
+
+    return rc;
+}
+#endif
+
+#ifdef MSM_PLATFORM_7x27_FFA
+
+#define MPP_4_CHIP_PWD_L 3 //MPP4 is hooked to Deep Sleep Signal 
+
+//Helper routine to power up Libra keypad on the 7x27 FFA
+int vos_chip_power_7x27_keypad( int on )
+{
+   struct vreg *vreg_wlan, *vreg_bt = NULL;
+   int rc = 0;
+
+   vreg_wlan = vreg_get(NULL, "wlan");
+   if (IS_ERR(vreg_wlan)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg get failed (%ld)",
+         __func__, PTR_ERR(vreg_wlan));
+      return PTR_ERR(vreg_wlan);
+   }
+
+   vreg_bt = vreg_get(NULL, "gp6");
+   if (IS_ERR(vreg_bt)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: gp6 vreg get failed (%ld)",
+                __func__, PTR_ERR(vreg_bt));
+      return PTR_ERR(vreg_bt);
+   }
+
+   if(on) {
+
+      /* units of mV, steps of 50 mV */
+      rc = vreg_set_level(vreg_bt, 2600);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: vreg set level failed (%d)",__func__, rc);
+         return -EIO;
+      }
+      rc = vreg_enable(vreg_bt);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: vreg enable failed (%d)",__func__, rc);
+         return -EIO;
+      }
+
+      //Set TCXO to 1.8v.
+      rc = vreg_set_level(vreg_wlan, 1800);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: vreg set level failed (%d)", __func__, rc);
+         return -EIO;
+      }
+
+      rc = vreg_enable(vreg_wlan);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg enable failed (%d)",__func__, rc);
+         return -EIO;
+      }
+
+      msleep(100);
+
+      // Pull MPP4 high to turn on various supply voltages.
+      rc = mpp_config_digital_out(MPP_4_CHIP_PWD_L, 
+         MPP_CFG(MPP_DLOGIC_LVL_MSMP, MPP_DLOGIC_OUT_CTRL_HIGH));
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: MPP_4 pull high failed (%d)",__func__, rc);
+         return -EIO;
+      }
+
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Enabled power supply for WLAN", __func__);
+ 
+      msleep(500);
+   }
+   else 
+   {
+
+       // Pull MPP4 low to place the chip in reset.
+       rc = mpp_config_digital_out(MPP_4_CHIP_PWD_L, 
+          MPP_CFG(MPP_DLOGIC_LVL_MSMP, MPP_DLOGIC_OUT_CTRL_LOW));
+       if (rc) {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: MPP_4 pull low failed (%d)",__func__, rc);
+          return -EIO;
+       }
+
+       msleep(100);
+
+      /* Turn off 2.6V */
+      rc = vreg_disable(vreg_bt);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: vreg disable failed (%d)",__func__, rc);
+         return -EIO;
+      }
+
+      /* Turn off 1.8V */
+      rc = vreg_disable(vreg_wlan);
+      if (rc) {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg disable failed (%d)",__func__, rc);
+         return -EIO;
+      }
+
+      msleep(100);
+
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Disabled power supply for WLAN", __func__);
+   }
+
+   return 0;
+}
+#endif
+
+/*===========================================================================
+
+                    FUNCTION PROTOTYPES
+
+===========================================================================*/
+
+/**
+  @brief vos_chipPowerUp() - This API will power up the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  The Libra SDIO core will have been initialized if the operation completes
+  successfully
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipPowerUp
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+
+#ifdef MSM_PLATFORM_8660
+   if(vos_chip_power_qrf8615(CHIP_POWER_ON))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+#ifdef MSM_PLATFORM_7x30
+   if(vos_chip_power_qrf8600(CHIP_POWER_ON))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+#ifdef MSM_PLATFORM_7x27_FFA
+   if(vos_chip_power_7x27_keypad(CHIP_POWER_ON))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+#ifdef MSM_PLATFORM_7x27A
+   if(chip_power_qrf6285(CHIP_POWER_ON))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipPowerDown() - This API will power down the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipPowerDown
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+
+#ifdef ANI_BUS_TYPE_SDIO
+#ifdef MSM_PLATFORM
+   struct sdio_func *sdio_func_dev = NULL;
+
+   // Get the SDIO func device
+   sdio_func_dev = libra_getsdio_funcdev();
+   if (sdio_func_dev == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Libra WLAN sdio device is NULL \n"
+             "exiting", __func__);
+   }
+   else 
+   {
+      // Set sdio clock to lower config cycle frequency before chip power down.
+      // Setting this low freq, will also internally in msm_sdcc disable power save.
+      // Once the card is power down and powered up and detected
+      // after the config cycles the clock freq will be set back up
+      // to our capability of 50MHz
+      libra_sdio_set_clock(sdio_func_dev, WLAN_LOW_SD_CONFIG_CLOCK_FREQ);
+   }
+#endif
+#endif
+
+#ifdef MSM_PLATFORM_8660
+   if(vos_chip_power_qrf8615(CHIP_POWER_OFF))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+#ifdef MSM_PLATFORM_7x30
+///#ifndef VOS_PWR_WIFI_ON_OFF_HACK
+   if(vos_chip_power_qrf8600(CHIP_POWER_OFF))
+      return VOS_STATUS_E_FAILURE;
+///#endif
+#endif
+
+#ifdef MSM_PLATFORM_7x27_FFA
+   if(vos_chip_power_7x27_keypad(CHIP_POWER_OFF))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+#ifdef MSM_PLATFORM_7x27A
+   if(chip_power_qrf6285(CHIP_POWER_OFF))
+      return VOS_STATUS_E_FAILURE;
+#endif
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipReset() - This API will reset the Libra chip
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  A hard reset will involve a powerDown followed by a PowerUp; a soft reset
+  can potentially be accomplished by writing to some device registers
+
+  The Libra SDIO core will have been initialized if the operation completes
+  successfully
+
+  @param status [out] : whether this operation will complete sync or async
+  @param soft [in] : VOS_TRUE if a soft reset is desired 
+                     VOS_FALSE for a hard reset i.e. powerDown followed by powerUp
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_NOSUPPORT - soft reset asked for but not supported
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipReset
+(
+  vos_call_status_type* status,
+  v_BOOL_t              soft,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  vos_chip_reset_reason_type   reason
+)
+{
+   VOS_STATUS vstatus;
+   vstatus = vos_watchdog_chip_reset(reason);
+   return vstatus;
+}
+
+
+/**
+  @brief vos_chipVoteOnPASupply() - This API will power up the PA supply
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnPASupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**
+  @brief vos_chipVoteOffPASupply() - This API will vote to turn off the 
+  PA supply. Even if we succeed in voting, there is a chance PA supply will not 
+  be turned off. This will be treated the same as a failure.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffPASupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**
+  @brief vos_chipAssertDeepSleep() - This API will assert the deep 
+  sleep signal to Libra
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipAssertDeepSleep
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x27_FFA
+   int rc = mpp_config_digital_out(MPP_4_CHIP_PWD_L, 
+      MPP_CFG(MPP_DLOGIC_LVL_MSMP, MPP_DLOGIC_OUT_CTRL_LOW));
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Failed to pull high MPP_4_CHIP_PWD_L (%d)",
+                __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+#endif
+
+#ifdef MSM_PLATFORM_7x30
+   // Configure GPIO 23 for Deep Sleep
+   int rc = pm8xxx_gpio_config(wlan_gpios_reset_out[0].gpio_num, &wlan_gpios_reset_out[0].gpio_cfg);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: pmic GPIO %d config failed (%d)",
+         __func__, wlan_gpios_reset_out[0].gpio_num, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+#endif //FIXME_VOLANS
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**
+  @brief vos_chipDeAssertDeepSleep() - This API will de-assert the deep sleep
+  signal to Libra
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipDeAssertDeepSleep
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x27_FFA
+   int rc = mpp_config_digital_out(MPP_4_CHIP_PWD_L, 
+      MPP_CFG(MPP_DLOGIC_LVL_MSMP, MPP_DLOGIC_OUT_CTRL_HIGH));
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Failed to pull high MPP_4_CHIP_PWD_L (%d)",
+         __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+
+#endif
+
+#ifdef MSM_PLATFORM_7x30
+   // Configure GPIO 23 for Deep Sleep
+   int rc = pm8xxx_gpio_config(wlan_gpios_reset[2].gpio_num, &wlan_gpios_reset[2].gpio_cfg);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: pmic GPIO %d config failed (%d)",
+                __func__, wlan_gpios_reset[2].gpio_num, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipExitDeepSleepVREGHandler() - This API will initialize the required VREG
+  after exit from deep sleep.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipExitDeepSleepVREGHandler
+(
+   vos_call_status_type* status,
+   vos_power_cb_type     callback,
+   v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x27_FFA
+   struct vreg *vreg_wlan;
+   int rc;
+
+   vreg_wlan = vreg_get(NULL, "wlan");
+   if (IS_ERR(vreg_wlan)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg get failed (%ld)",
+            __func__, PTR_ERR(vreg_wlan));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_set_level(vreg_wlan, 1800);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg set level failed (%d)",
+            __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_enable(vreg_wlan);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg enable failed (%d)",
+            __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   msleep(500);
+
+   rc = vreg_set_level(vreg_wlan, 2600);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: wlan vreg set level failed (%d)",
+            __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   msleep(500);
+
+   *status = VOS_CALL_SYNC;
+
+#endif
+
+#ifdef MSM_PLATFORM_7x30
+   VOS_STATUS vosStatus;
+   vos_call_status_type callType;
+
+   vosStatus = vos_chipVoteOnBBAnalogSupply(&callType, NULL, NULL);
+   VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+   msleep(500);
+
+#endif
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOnRFSupply() - This API will power up the RF supply
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnRFSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x30
+   int rc;
+   struct vreg *vreg_s2 = NULL;
+   struct vreg *vreg_s4 = NULL;
+
+   //1.3v RF;
+   vreg_s2 = vreg_get(NULL, "s2");
+   if (IS_ERR(vreg_s2)) {
+      printk(KERN_ERR "%s: s2 vreg get failed (%ld)\n",
+         __func__, PTR_ERR(vreg_s2));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //2.2v RF
+   vreg_s4 = vreg_get(NULL, "s4");
+   if (IS_ERR(vreg_s4)) {
+      printk(KERN_ERR "%s: s4 vreg get failed (%ld)\n",
+         __func__, PTR_ERR(vreg_s4));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 1300);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: s2 vreg vote "
+          "level failed (%d)",__func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_enable(vreg_s2);
+   if (rc) {
+      printk(KERN_ERR "%s: s2 vreg enable failed (%d)\n", __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S4, 2200);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: s4 vreg vote "
+          "level failed (%d)",__func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_enable(vreg_s4);
+   if (rc) {
+      printk(KERN_ERR "%s: s4 vreg enable failed (%d)\n", __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+
+#endif //MSM_PLATFORM_7x30
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOffRFSupply() - This API will vote to turn off the 
+  RF supply. Even if we succeed in voting, there is a chance RF supply will not 
+  be turned off as RF rails could be shared with other modules (outside WLAN)
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffRFSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x30
+
+   int rc;
+   struct vreg *vreg_s2;
+   struct vreg *vreg_s4;
+
+   //1.3v RF
+   vreg_s2 = vreg_get(NULL, "s2");
+   if (IS_ERR(vreg_s2)) {
+      printk(KERN_ERR "%s: s2 vreg get failed (%ld)\n",
+         __func__, PTR_ERR(vreg_s2));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //2.2v RF
+   vreg_s4 = vreg_get(NULL, "s4");
+   if (IS_ERR(vreg_s4)) {
+      printk(KERN_ERR "%s: s4 vreg get failed (%ld)\n",
+         __func__, PTR_ERR(vreg_s4));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S2, 0);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, "%s: s2 vreg vote "
+          "level failed (%d)",__func__, rc);
+   }
+
+   rc = vreg_disable(vreg_s2);
+   if (rc) {
+      printk(KERN_ERR "%s: s2 vreg disable failed (%d)\n", __func__, rc);
+   }
+
+   rc = pmapp_vreg_level_vote(id, PMAPP_VREG_S4, 0);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, "%s: s4 vreg vote "
+          "level failed (%d)",__func__, rc);
+   }
+
+   rc = vreg_disable(vreg_s4); 
+   if (rc) {
+      printk(KERN_ERR "%s: s4 vreg disable failed (%d)\n", __func__, rc);
+   }
+
+   return VOS_STATUS_SUCCESS;
+
+#endif //MSM_PLATFORM_7x30
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOnBBAnalogSupply() - This API will power up the I/P voltage
+  used by Base band Analog.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnBBAnalogSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x30
+   struct vreg *vreg_wlan2 = NULL;
+   int rc;
+
+   //2.5v Analog from LDO19
+   vreg_wlan2 = vreg_get(NULL, "wlan2");
+   if (IS_ERR(vreg_wlan2)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: wlan2 vreg get "
+          "failed (%ld)", __func__, PTR_ERR(vreg_wlan2));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_set_level(vreg_wlan2, 2500);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: wlan2 vreg set "
+          "level failed (%d)",__func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_enable(vreg_wlan2);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: wlan2 vreg enable "
+          "failed (%d)", __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOffBBAnalogSupply() - This API will vote off the BB Analog supply.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffBBAnalogSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+#ifdef FIXME_VOLANS
+#ifdef MSM_PLATFORM_7x30
+   struct vreg *vreg_wlan2 = NULL;
+   int rc;
+
+   //2.5v Analog from LDO19
+   vreg_wlan2 = vreg_get(NULL, "wlan2");
+   if (IS_ERR(vreg_wlan2)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: wlan2 vreg get "
+          "failed (%ld)", __func__, PTR_ERR(vreg_wlan2));
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   rc = vreg_disable(vreg_wlan2);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: wlan2 vreg disable "
+          "failed (%d)", __func__, rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+#endif //FIXME_VOLANS
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOnXOBuffer() - This API will vote to turn on the XO buffer from
+  PMIC. This API will be used when Libra uses the TCXO from PMIC on the MSM
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately)       
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOnXOBuffer
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteOffXOBuffer() - This API will vote off PMIC XO buffer.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteOffXOBuffer
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data
+)
+{
+   return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_chipVoteXOCore - This API will vote PMIC XO Core.
+
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+  @param force_enable [in] : Force enable XO CORE or not
+
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteXOCore
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  v_BOOL_t              force_enable
+)
+{
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    static v_BOOL_t is_vote_on;
+
+#if defined(MSM_PLATFORM_8660) || defined(MSM_PLATFORM_7x30)
+    int rc;
+#endif
+
+   /* The expectation is the is_vote_on should always have value 1 or 0.  This funcn should
+    * be called alternately with 1 and 0 passed to it.
+    */
+   if ((force_enable && is_vote_on) || (!force_enable && !is_vote_on)) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "Force XO Core %s called when already %s - directly return success %d", 
+         force_enable ? "enable" : "disable", is_vote_on ? "enable" : "disable", 
+         is_vote_on);
+      goto success;
+   }    
+
+#ifdef MSM_PLATFORM_7x30
+   rc = pmic_xo_core_force_enable(force_enable);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: pmic_xo_core_force_enable %s failed (%d)",__func__, 
+         force_enable ? "enable" : "disable",rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+
+#ifdef MSM_PLATFORM_8660
+   rc = qcomwlan_pmic_xo_core_force_enable(force_enable);
+   if (rc) {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+         "%s: pmic_xo_core_force_enable %s failed (%d)",__func__, 
+         force_enable ? "enable" : "disable",rc);
+      return VOS_STATUS_E_FAILURE;
+   }
+#endif
+    is_vote_on=force_enable;
+
+success:
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, "XO CORE ON vote %s successfully!",
+                force_enable ? "enable" : "disable");
+
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/**
+  @brief vos_chipVoteFreqFor1p3VSupply() - This API will vote for frequency for 1.3V RF supply.
+  
+  This operation may be asynchronous. If so, the supplied callback will
+  be invoked when operation is complete with the result. The callback will 
+  be called with the user supplied data. If the operation is known to be 
+  sync, there is no need to supply a callback and user data.
+
+  EVM issue is observed with 1.6Mhz freq for 1.3V supply in wlan standalone case.
+  During concurrent operation (e.g. WLAN and WCDMA) this issue is not observed. 
+  To workaround, wlan will vote for 3.2Mhz during startup and will vote for 1.6Mhz
+  during exit.
+   
+  @param status [out] : whether this operation will complete sync or async
+  @param callback [in] : user supplied callback invoked when operation completes
+  @param user_data [in] : user supplied context callback is called with
+  @param freq [in]     :  Frequency for 1.3V Supply for which WLAN driver needs to vote for.
+  @return 
+  VOS_STATUS_E_INVAL - status is NULL 
+  VOS_STATUS_E_FAULT - the operation needs to complete async and a callback 
+                       and user_data has not been specified (status will be
+                       set to VOS_CALL_ASYNC) 
+  VOS_STATUS_E_ALREADY - operation needs to complete async but another request
+                         is already in progress (status will be set to VOS_CALL_ASYNC)  
+  VOS_STATUS_E_FAILURE - operation failed (status will be set appropriately) could be 
+                         because the voting algorithm decided not to power down PA  
+  VOS_STATUS_SUCCESS - operation completed successfully if status is SYNC (will be set)
+                       OR operation started successfully if status is ASYNC (will be set)
+
+*/
+VOS_STATUS vos_chipVoteFreqFor1p3VSupply
+(
+  vos_call_status_type* status,
+  vos_power_cb_type     callback,
+  v_PVOID_t             user_data,
+  v_U32_t               freq
+)
+{
+
+
+#ifdef MSM_PLATFORM_8660
+    if(freq == VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_3P2MH)
+        {
+            if(qcomwlan_freq_change_1p3v_supply(RPM_VREG_FREQ_3p20))
+                return VOS_STATUS_E_FAILURE;
+        }
+    else
+        {
+            if(qcomwlan_freq_change_1p3v_supply(RPM_VREG_FREQ_1p60))
+                return VOS_STATUS_E_FAILURE;
+        }
+#endif
+
+    return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/VOSS/src/vos_sched.c b/CORE/VOSS/src/vos_sched.c
new file mode 100644
index 0000000..f7f434f
--- /dev/null
+++ b/CORE/VOSS/src/vos_sched.c
@@ -0,0 +1,2065 @@
+/*
+ * 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 vos_sched.c
+  @brief VOS Scheduler Implementation
+
+  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
+  --------    ---    --------------------------------------------------------
+===========================================================================*/
+/*---------------------------------------------------------------------------
+ * Include Files
+ * ------------------------------------------------------------------------*/
+#include <vos_mq.h>
+#include <vos_api.h>
+#include <aniGlobal.h>
+#include <sirTypes.h>
+#include <halTypes.h>
+#include <limApi.h>
+#include <sme_Api.h>
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#include <wlan_qct_ssc.h>
+#endif
+#include <wlan_qct_sys.h>
+#include <wlan_qct_tl.h>
+#include "vos_sched.h"
+#include <wlan_hdd_power.h>
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "wlan_qct_wda.h"
+#include "wlan_qct_pal_msg.h"
+#endif
+#include <linux/spinlock.h>
+#include <linux/kthread.h>
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#include <libra_sdioif.h>
+#include <wlan_sal_misc.h>
+#endif
+/*---------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * ------------------------------------------------------------------------*/
+#define VOS_SCHED_THREAD_HEART_BEAT    INFINITE
+/*---------------------------------------------------------------------------
+ * Type Declarations
+ * ------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+ * Data definitions
+ * ------------------------------------------------------------------------*/
+static pVosSchedContext gpVosSchedContext;
+static pVosWatchdogContext gpVosWatchdogContext=NULL;
+
+/*---------------------------------------------------------------------------
+ * Forward declaration
+ * ------------------------------------------------------------------------*/
+static int VosMCThread(void * Arg);
+static int VosWDThread(void * Arg);
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+/* Integrated SOC will have single BIN for FTM driver and Production Driver
+ * So, anycase this must be compiled
+ * None integrated SOC will compile this part only for FTM Driver */
+static int VosTXThread(void * Arg);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+static int VosRXThread(void* Arg);
+void vos_sched_flush_rx_mqs(pVosSchedContext SchedContext);
+#endif
+#endif
+extern v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper);
+/*---------------------------------------------------------------------------
+ * External Function implementation
+ * ------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  \brief vos_sched_open() - initialize the vOSS Scheduler
+  The \a vos_sched_open() function initializes the vOSS Scheduler
+  Upon successful initialization:
+     - All the message queues are initialized
+     - The Main Controller thread is created and ready to receive and
+       dispatch messages.
+     - The Tx thread is created and ready to receive and dispatch messages
+
+  \param  pVosContext - pointer to the global vOSS Context
+  \param  pVosSchedContext - pointer to a previously allocated buffer big
+          enough to hold a scheduler context.
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the scheduler
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize
+          the scheduler
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
+          function
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
+  \sa vos_sched_open()
+  -------------------------------------------------------------------------*/
+VOS_STATUS
+vos_sched_open
+(
+  v_PVOID_t        pVosContext,
+  pVosSchedContext pSchedContext,
+  v_SIZE_t         SchedCtxSize
+)
+{
+  VOS_STATUS  vStatus = VOS_STATUS_SUCCESS;
+/*-------------------------------------------------------------------------*/
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: Opening the VOSS Scheduler",__func__);
+  // Sanity checks
+  if ((pVosContext == NULL) || (pSchedContext == NULL)) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             "%s: Null params being passed",__func__);
+     return VOS_STATUS_E_FAILURE;
+  }
+  if (sizeof(VosSchedContext) != SchedCtxSize)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: Incorrect VOS Sched Context size passed",__func__);
+     return VOS_STATUS_E_INVAL;
+  }
+  vos_mem_zero(pSchedContext, sizeof(VosSchedContext));
+  pSchedContext->pVContext = pVosContext;
+  vStatus = vos_sched_init_mqs(pSchedContext);
+  if (!VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to initialize VOS Scheduler MQs",__func__);
+     return vStatus;
+  }
+  // Initialize the helper events and event queues
+  init_completion(&pSchedContext->McStartEvent);
+  init_completion(&pSchedContext->TxStartEvent);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  init_completion(&pSchedContext->RxStartEvent);
+#endif
+  init_completion(&pSchedContext->McShutdown);
+  init_completion(&pSchedContext->TxShutdown);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  init_completion(&pSchedContext->RxShutdown);
+#endif
+  init_completion(&pSchedContext->ResumeMcEvent);
+  init_completion(&pSchedContext->ResumeTxEvent);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  init_completion(&pSchedContext->ResumeRxEvent);
+#endif
+
+  spin_lock_init(&pSchedContext->McThreadLock);
+  spin_lock_init(&pSchedContext->TxThreadLock);
+  spin_lock_init(&pSchedContext->RxThreadLock);
+
+  init_waitqueue_head(&pSchedContext->mcWaitQueue);
+  pSchedContext->mcEventFlag = 0;
+  init_waitqueue_head(&pSchedContext->txWaitQueue);
+  pSchedContext->txEventFlag= 0;
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  init_waitqueue_head(&pSchedContext->rxWaitQueue);
+  pSchedContext->rxEventFlag= 0;
+#endif
+  /*
+  ** This initialization is critical as the threads will latter access the
+  ** global contexts normally,
+  **
+  ** I shall put some memory barrier here after the next piece of code but
+  ** I am keeping it simple for now.
+  */
+  gpVosSchedContext = pSchedContext;
+
+  //Create the VOSS Main Controller thread
+  pSchedContext->McThread = kthread_create(VosMCThread, pSchedContext,
+                                           "VosMCThread");
+  if (IS_ERR(pSchedContext->McThread)) 
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Could not Create VOSS Main Thread Controller",__func__);
+     goto MC_THREAD_START_FAILURE;
+  }
+  wake_up_process(pSchedContext->McThread);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: VOSS Main Controller thread Created",__func__);
+
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  pSchedContext->TxThread = kthread_create(VosTXThread, pSchedContext,
+                                           "VosTXThread");
+  if (IS_ERR(pSchedContext->TxThread)) 
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Could not Create VOSS TX Thread",__func__);
+     goto TX_THREAD_START_FAILURE;
+  }
+  wake_up_process(pSchedContext->TxThread);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+             ("VOSS TX thread Created\n"));
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  pSchedContext->RxThread = kthread_create(VosRXThread, pSchedContext,
+                                           "VosRXThread");
+  if (IS_ERR(pSchedContext->RxThread)) 
+  {
+
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Could not Create VOSS RX Thread",__func__);
+     goto RX_THREAD_START_FAILURE;
+
+  }
+  wake_up_process(pSchedContext->RxThread);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+             ("VOSS RX thread Created\n"));
+#endif
+#endif
+
+  /*
+  ** Now make sure all threads have started before we exit.
+  ** Each thread should normally ACK back when it starts.
+  */
+  wait_for_completion_interruptible(&pSchedContext->McStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS MC Thread has started",__func__);
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  wait_for_completion_interruptible(&pSchedContext->TxStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS Tx Thread has started",__func__);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  wait_for_completion_interruptible(&pSchedContext->RxStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS Rx Thread has started",__func__);
+#endif
+
+  /*
+  ** We're good now: Let's get the ball rolling!!!
+  */
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: VOSS Scheduler successfully Opened",__func__);
+ #endif
+  return VOS_STATUS_SUCCESS;
+
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+RX_THREAD_START_FAILURE:
+    //Try and force the Tx thread controller to exit
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->txEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &pSchedContext->txEventFlag);
+    wake_up_interruptible(&pSchedContext->txWaitQueue);
+     //Wait for TX to exit
+    wait_for_completion_interruptible(&pSchedContext->TxShutdown);
+#endif
+
+TX_THREAD_START_FAILURE:
+    //Try and force the Main thread controller to exit
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
+    wake_up_interruptible(&pSchedContext->mcWaitQueue);
+    //Wait for MC to exit
+    wait_for_completion_interruptible(&pSchedContext->McShutdown);
+
+#endif
+MC_THREAD_START_FAILURE:
+  //De-initialize all the message queues
+  vos_sched_deinit_mqs(pSchedContext);
+  return VOS_STATUS_E_RESOURCES;
+
+} /* vos_sched_open() */
+
+VOS_STATUS vos_watchdog_open
+(
+  v_PVOID_t           pVosContext,
+  pVosWatchdogContext pWdContext,
+  v_SIZE_t            wdCtxSize
+)
+{
+/*-------------------------------------------------------------------------*/
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+             "%s: Opening the VOSS Watchdog module",__func__);
+  //Sanity checks
+  if ((pVosContext == NULL) || (pWdContext == NULL)) {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+             "%s: Null params being passed",__func__);
+     return VOS_STATUS_E_FAILURE;
+  }
+  if (sizeof(VosWatchdogContext) != wdCtxSize)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: Incorrect VOS Watchdog Context size passed",__func__);
+     return VOS_STATUS_E_INVAL;
+  }
+  vos_mem_zero(pWdContext, sizeof(VosWatchdogContext));
+  pWdContext->pVContext = pVosContext;
+  gpVosWatchdogContext = pWdContext;
+
+  //Initialize the helper events and event queues
+  init_completion(&pWdContext->WdStartEvent);
+  init_completion(&pWdContext->WdShutdown);
+  init_waitqueue_head(&pWdContext->wdWaitQueue);
+  pWdContext->wdEventFlag = 0;
+
+  // Initialize the lock
+  spin_lock_init(&pWdContext->wdLock);
+
+  //Create the Watchdog thread
+  pWdContext->WdThread = kthread_create(VosWDThread, pWdContext,"VosWDThread");
+  
+  if (IS_ERR(pWdContext->WdThread)) 
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+               "%s: Could not Create Watchdog thread",__func__);
+     return VOS_STATUS_E_RESOURCES;
+  }  
+  else
+  {
+     wake_up_process(pWdContext->WdThread);
+  }
+ /*
+  ** Now make sure thread has started before we exit.
+  ** Each thread should normally ACK back when it starts.
+  */
+  wait_for_completion_interruptible(&pWdContext->WdStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+               "%s: VOSS Watchdog Thread has started",__func__);
+  return VOS_STATUS_SUCCESS;
+} /* vos_watchdog_open() */
+/*---------------------------------------------------------------------------
+  \brief VosMcThread() - The VOSS Main Controller thread
+  The \a VosMcThread() is the VOSS main controller thread:
+  \param  Arg - pointer to the global vOSS Sched Context
+  \return Thread exit code
+  \sa VosMcThread()
+  -------------------------------------------------------------------------*/
+static int
+VosMCThread
+(
+  void * Arg
+)
+{
+  pVosSchedContext pSchedContext = (pVosSchedContext)Arg;
+  pVosMsgWrapper pMsgWrapper     = NULL;
+  tpAniSirGlobal pMacContext     = NULL;
+  tSirRetStatus macStatus        = eSIR_SUCCESS;
+  VOS_STATUS vStatus             = VOS_STATUS_SUCCESS;
+  int retWaitStatus              = 0;
+  v_BOOL_t shutdown              = VOS_FALSE;
+  hdd_context_t *pHddCtx         = NULL;
+  v_CONTEXT_t pVosContext        = NULL;
+
+  if (Arg == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Bad Args passed", __FUNCTION__);
+     return 0;
+  }
+  set_user_nice(current, -2);
+
+  daemonize("MC_Thread");
+  /*
+  ** Ack back to the context from which the main controller thread has been
+  ** created.
+  */
+  complete(&pSchedContext->McStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: MC Thread %d (%s) starting up",__func__, current->pid, current->comm);
+
+  /* Get the Global VOSS Context */
+  pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+  if(!pVosContext) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+     return 0;
+  }
+
+  /* Get the HDD context */
+  pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+  if(!pHddCtx) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+     return 0;
+  }
+
+  while(!shutdown)
+  {
+    // This implements the execution model algorithm
+    retWaitStatus = wait_event_interruptible(pSchedContext->mcWaitQueue,
+       test_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag) || 
+       test_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag));
+
+    if(retWaitStatus == -ERESTARTSYS)
+    {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: wait_event_interruptible returned -ERESTARTSYS", __FUNCTION__);
+      break;
+    }
+    clear_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
+
+    while(1)
+    {
+      // Check if MC needs to shutdown
+      if(test_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: MC thread signaled to shutdown", __func__);
+        shutdown = VOS_TRUE;
+        /* Check for any Suspend Indication */
+        if(test_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag))
+        {
+           clear_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag);
+        
+           /* Unblock anyone waiting on suspend */
+           complete(&pHddCtx->mc_sus_event_var);
+        }
+        break;
+      }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      /*
+      ** Check the WDI queue
+      ** Service it till the entire queue is empty
+      */
+      if (!vos_is_mq_empty(&pSchedContext->wdiMcMq))
+      {
+        wpt_msg *pWdiMsg;
+        /*
+        ** Service the WDI message queue
+        */
+        VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+                  ("Servicing the VOS MC WDI Message queue"));
+
+        pMsgWrapper = vos_mq_get(&pSchedContext->wdiMcMq);
+        VOS_ASSERT(NULL != pMsgWrapper);
+
+        pWdiMsg = (wpt_msg *)pMsgWrapper->pVosMsg->bodyptr;
+        VOS_ASSERT(pWdiMsg->callback);
+
+        pWdiMsg->callback(pWdiMsg);
+
+        /* 
+        ** return message to the Core
+        */
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+
+        continue;
+      }
+
+#endif
+      // Check the SYS queue first
+      if (!vos_is_mq_empty(&pSchedContext->sysMcMq))
+      {
+        // Service the SYS message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS SYS MC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->sysMcMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = sysMcProcessMsg(pSchedContext->pVContext,
+           pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing SYS message",__func__);
+        }
+        //return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      // Check the WDA queue
+      if (!vos_is_mq_empty(&pSchedContext->wdaMcMq))
+      {
+        // Service the WDA message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "%s: Servicing the VOS WDA MC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->wdaMcMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = WDA_McProcessMsg( pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing WDA message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+#else
+
+      // Check the HAL queue
+      if (!vos_is_mq_empty(&pSchedContext->halMcMq))
+      {
+        /* Need some optimization*/
+        pMacContext = vos_get_context(VOS_MODULE_ID_HAL, pSchedContext->pVContext);
+
+        if(pMacContext == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+              "%s: pMacContext is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+
+        // Service the HAL message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "%s: Servicing the VOS HAL MC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->halMcMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+
+        macStatus = halProcessMsg( pMacContext, (tSirMsgQ*)pMsgWrapper->pVosMsg);
+        if (eSIR_SUCCESS != macStatus)
+        {
+           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing HAL message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+#endif
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+      // Check the PE queue
+      if (!vos_is_mq_empty(&pSchedContext->peMcMq))
+      {
+        // Service the PE message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS PE MC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->peMcMq);
+        if (NULL == pMsgWrapper)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+
+        /* Need some optimization*/
+        pMacContext = vos_get_context(VOS_MODULE_ID_PE, pSchedContext->pVContext);
+        if (NULL == pMacContext)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                     "MAC Context not ready yet");
+           vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+           continue;
+        }
+
+        macStatus = peProcessMessages( pMacContext, (tSirMsgQ*)pMsgWrapper->pVosMsg);
+        if (eSIR_SUCCESS != macStatus)
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing PE message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+      /** Check the SME queue **/
+      if (!vos_is_mq_empty(&pSchedContext->smeMcMq))
+      {
+        /* Service the SME message queue */
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS SME MC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->smeMcMq);
+        if (NULL == pMsgWrapper)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+
+        /* Need some optimization*/
+        pMacContext = vos_get_context(VOS_MODULE_ID_SME, pSchedContext->pVContext);
+        if (NULL == pMacContext)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                     "MAC Context not ready yet");
+           vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+           continue;
+        }
+
+        vStatus = sme_ProcessMsg( (tHalHandle)pMacContext, pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing SME message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+      /** Check the TL queue **/
+      if (!vos_is_mq_empty(&pSchedContext->tlMcMq))
+      {
+        // Service the TL message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                  ("Servicing the VOS TL MC Message queue"));
+        pMsgWrapper = vos_mq_get(&pSchedContext->tlMcMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+              "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = WLANTL_McProcessMsg( pSchedContext->pVContext,
+            pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing TL message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+      /* Check for any Suspend Indication */
+      if(test_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag))
+      {
+        clear_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag);
+        spin_lock(&pSchedContext->McThreadLock);
+
+        /* Mc Thread Suspended */
+        complete(&pHddCtx->mc_sus_event_var);
+
+        INIT_COMPLETION(pSchedContext->ResumeMcEvent);
+        spin_unlock(&pSchedContext->McThreadLock);
+
+        /* Wait foe Resume Indication */
+        wait_for_completion_interruptible(&pSchedContext->ResumeMcEvent);
+      }
+#endif /* ANI_MANF_DIAG */
+      break; //All queues are empty now
+    } // while message loop processing
+  } // while TRUE
+  // If we get here the MC thread must exit
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: MC Thread exiting!!!!", __FUNCTION__);
+  complete_and_exit(&pSchedContext->McShutdown, 0);
+} /* VosMCThread() */
+int isWDresetInProgress(void)
+{
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Reset is in Progress...",__func__);
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+   if(gpVosWatchdogContext!=NULL)
+   {
+      return gpVosWatchdogContext->resetInProgress;
+   }
+   else
+   {
+      return 0;
+   }
+#else
+   return 0;
+#endif
+}
+/*---------------------------------------------------------------------------
+  \brief VosWdThread() - The VOSS Watchdog thread
+  The \a VosWdThread() is the Watchdog thread:
+  \param  Arg - pointer to the global vOSS Sched Context
+  \return Thread exit code
+  \sa VosMcThread()
+  -------------------------------------------------------------------------*/
+static int
+VosWDThread
+(
+  void * Arg
+)
+{
+  pVosWatchdogContext pWdContext = (pVosWatchdogContext)Arg;
+  int retWaitStatus              = 0;
+  v_BOOL_t shutdown              = VOS_FALSE;
+  VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+  set_user_nice(current, -3);
+
+  if (Arg == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+        "%s: Bad Args passed", __FUNCTION__);
+     return 0;
+  }
+  daemonize("WD_Thread");
+  /*
+  ** Ack back to the context from which the Watchdog thread has been
+  ** created.
+  */
+  complete(&pWdContext->WdStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: Watchdog Thread %d (%s) starting up",__func__, current->pid, current->comm);
+
+  while(!shutdown)
+  {
+    // This implements the Watchdog execution model algorithm
+    retWaitStatus = wait_event_interruptible(pWdContext->wdWaitQueue,
+       test_bit(WD_POST_EVENT_MASK, &pWdContext->wdEventFlag));
+    if(retWaitStatus == -ERESTARTSYS)
+    {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: wait_event_interruptible returned -ERESTARTSYS", __FUNCTION__);
+      break;
+    }
+    clear_bit(WD_POST_EVENT_MASK, &pWdContext->wdEventFlag);
+    while(1)
+    {
+      // Check if Watchdog needs to shutdown
+      if(test_bit(WD_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Watchdog thread signaled to shutdown", __func__);
+
+        clear_bit(WD_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag);
+        shutdown = VOS_TRUE;
+        break;
+      }
+      /* subsystem restart: shutdown event handler */
+      else if(test_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Watchdog thread signaled to perform WLAN shutdown",__func__);
+        clear_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag);
+
+        //Perform WLAN shutdown
+        if(!pWdContext->resetInProgress)
+        {
+          pWdContext->resetInProgress = true;
+          vosStatus = hdd_wlan_shutdown();
+
+          if (! VOS_IS_STATUS_SUCCESS(vosStatus))
+          {
+             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                     "%s: Failed to shutdown WLAN",__func__);
+             VOS_ASSERT(0);
+             goto err_reset;
+          }
+        }
+      }
+      /* subsystem restart: re-init event handler */
+      else if(test_bit(WD_WLAN_REINIT_EVENT_MASK, &pWdContext->wdEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Watchdog thread signaled to perform WLAN re-init",__func__);
+        clear_bit(WD_WLAN_REINIT_EVENT_MASK, &pWdContext->wdEventFlag);
+
+        //Perform WLAN re-init
+        if(!pWdContext->resetInProgress)
+        {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+          "%s: Trying to do WLAN re-init when it is not shutdown !!",__func__);
+        }
+        vosStatus = hdd_wlan_re_init();
+
+        if (! VOS_IS_STATUS_SUCCESS(vosStatus))
+        {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                  "%s: Failed to re-init WLAN",__func__);
+          VOS_ASSERT(0);
+          goto err_reset;
+        }
+        pWdContext->resetInProgress = false;
+      }
+      else
+      {
+        //Unnecessary wakeup - Should never happen!!
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+        "%s: Watchdog thread woke up unnecessarily",__func__);
+      }
+      break;
+    } // while message loop processing
+  } // while shutdown
+
+  // If we get here the Watchdog thread must exit
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: Watchdog Thread exiting !!!!", __FUNCTION__);
+  complete_and_exit(&pWdContext->WdShutdown, 0);
+
+err_reset:
+    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+      "%s: Watchdog Thread Failed to Reset, Exiting!!!!", __FUNCTION__);
+    return 0;
+
+} /* VosMCThread() */
+
+/*---------------------------------------------------------------------------
+  \brief VosTXThread() - The VOSS Main Tx thread
+  The \a VosTxThread() is the VOSS main controller thread:
+  \param  Arg - pointer to the global vOSS Sched Context
+
+  \return Thread exit code
+  \sa VosTxThread()
+  -------------------------------------------------------------------------*/
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+static int VosTXThread ( void * Arg )
+{
+  pVosSchedContext pSchedContext = (pVosSchedContext)Arg;
+  pVosMsgWrapper   pMsgWrapper   = NULL;
+  VOS_STATUS       vStatus       = VOS_STATUS_SUCCESS;
+  int              retWaitStatus = 0;
+  v_BOOL_t shutdown = VOS_FALSE;
+  hdd_context_t *pHddCtx         = NULL;
+  v_CONTEXT_t pVosContext        = NULL;
+
+  set_user_nice(current, -1);
+
+  if (Arg == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s Bad Args passed", __FUNCTION__);
+     return 0;
+  }
+  daemonize("TX_Thread");
+  /*
+  ** Ack back to the context from which the main controller thread has been
+  ** created.
+  */
+  complete(&pSchedContext->TxStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: TX Thread %d (%s) starting up!",__func__, current->pid, current->comm);
+
+  /* Get the Global VOSS Context */
+  pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+  if(!pVosContext) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+     return 0;
+  }
+
+  /* Get the HDD context */
+  pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+  if(!pHddCtx) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+     return 0;
+  }
+
+
+  while(!shutdown)
+  {
+    // This implements the execution model algorithm
+    retWaitStatus = wait_event_interruptible(pSchedContext->txWaitQueue,
+        test_bit(TX_POST_EVENT_MASK, &pSchedContext->txEventFlag) || 
+        test_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag));
+
+
+    if(retWaitStatus == -ERESTARTSYS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: wait_event_interruptible returned -ERESTARTSYS", __FUNCTION__);
+        break;
+    }
+    clear_bit(TX_POST_EVENT_MASK, &pSchedContext->txEventFlag);
+
+    while(1)
+    {
+      if(test_bit(TX_SHUTDOWN_EVENT_MASK, &pSchedContext->txEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "%s: TX thread signaled to shutdown", __func__);
+        shutdown = VOS_TRUE;
+        /* Check for any Suspend Indication */
+        if(test_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag))
+        {
+           clear_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag);
+        
+           /* Unblock anyone waiting on suspend */
+           complete(&pHddCtx->tx_sus_event_var);
+        }
+        break;
+      }
+      // Check the SYS queue first
+      if (!vos_is_mq_empty(&pSchedContext->sysTxMq))
+      {
+        // Service the SYS message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Servicing the VOS SYS TX Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->sysTxMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = sysTxProcessMsg( pSchedContext->pVContext,
+                                   pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing TX SYS message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+      // Check now the TL queue
+      if (!vos_is_mq_empty(&pSchedContext->tlTxMq))
+      {
+        // Service the TL message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Servicing the VOS TL TX Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->tlTxMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = WLANTL_TxProcessMsg( pSchedContext->pVContext,
+                                       pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing TX TL message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      // Check the WDI queue
+      if (!vos_is_mq_empty(&pSchedContext->wdiTxMq))
+      {
+        wpt_msg *pWdiMsg;
+        VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS TX WDI Message queue",__func__);
+
+        pMsgWrapper = vos_mq_get(&pSchedContext->wdiTxMq);
+        VOS_ASSERT(NULL != pMsgWrapper);
+
+        pWdiMsg = (wpt_msg *)pMsgWrapper->pVosMsg->bodyptr;
+        VOS_ASSERT(pWdiMsg->callback);
+
+        pWdiMsg->callback(pWdiMsg);
+
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+
+        continue;
+      }
+#else
+      // Check the SSC queue
+      if (!vos_is_mq_empty(&pSchedContext->sscTxMq))
+      {
+        // Service the PE message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS TX SSC Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->sscTxMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = WLANSSC_ProcessMsg( pSchedContext->pVContext,
+                                      pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing TX TL message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+
+#endif
+      /* Check for any Suspend Indication */
+      if(test_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag))
+      {
+        clear_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag);
+        spin_lock(&pSchedContext->TxThreadLock);
+
+        /* Tx Thread Suspended */
+        complete(&pHddCtx->tx_sus_event_var);
+
+        INIT_COMPLETION(pSchedContext->ResumeTxEvent);
+        spin_unlock(&pSchedContext->TxThreadLock);
+
+        /* Wait foe Resume Indication */
+        wait_for_completion_interruptible(&pSchedContext->ResumeTxEvent);
+      }
+
+      break; //All queues are empty now
+    } // while message loop processing
+  } // while TRUE
+  // If we get here the TX thread must exit
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: TX Thread exiting!!!!", __FUNCTION__);
+  complete_and_exit(&pSchedContext->TxShutdown, 0);
+} /* VosTxThread() */
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*---------------------------------------------------------------------------
+  \brief VosRXThread() - The VOSS Main Rx thread
+  The \a VosRxThread() is the VOSS Rx controller thread:
+  \param  Arg - pointer to the global vOSS Sched Context
+
+  \return Thread exit code
+  \sa VosRxThread()
+  -------------------------------------------------------------------------*/
+
+static int VosRXThread ( void * Arg )
+{
+  pVosSchedContext pSchedContext = (pVosSchedContext)Arg;
+  pVosMsgWrapper   pMsgWrapper   = NULL;
+  int              retWaitStatus = 0;
+  v_BOOL_t shutdown = VOS_FALSE;
+  hdd_context_t *pHddCtx         = NULL;
+  v_CONTEXT_t pVosContext        = NULL;
+  VOS_STATUS       vStatus       = VOS_STATUS_SUCCESS;
+
+  set_user_nice(current, -1);
+
+  if (Arg == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s Bad Args passed", __FUNCTION__);
+     return 0;
+  }
+  daemonize("RX_Thread");
+  /*
+  ** Ack back to the context from which the main controller thread has been
+  ** created.
+  */
+  complete(&pSchedContext->RxStartEvent);
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: RX Thread %d (%s) starting up!",__func__, current->pid, current->comm);
+
+  /* Get the Global VOSS Context */
+  pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+  if(!pVosContext) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
+     return 0;
+  }
+
+  /* Get the HDD context */
+  pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+  if(!pHddCtx) {
+     hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+     return 0;
+  }
+
+  while(!shutdown)
+  {
+    // This implements the execution model algorithm
+    retWaitStatus = wait_event_interruptible(pSchedContext->rxWaitQueue,
+        test_bit(RX_POST_EVENT_MASK, &pSchedContext->rxEventFlag) || 
+        test_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag));
+
+
+    if(retWaitStatus == -ERESTARTSYS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: wait_event_interruptible returned -ERESTARTSYS", __FUNCTION__);
+        break;
+    }
+    clear_bit(RX_POST_EVENT_MASK, &pSchedContext->rxEventFlag);
+
+    while(1)
+    {
+      if(test_bit(RX_SHUTDOWN_EVENT_MASK, &pSchedContext->rxEventFlag))
+      {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 "%s: RX thread signaled to shutdown", __func__);
+        shutdown = VOS_TRUE;
+        /* Check for any Suspend Indication */
+        if(test_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag))
+        {
+           clear_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag);
+        
+           /* Unblock anyone waiting on suspend */
+           complete(&pHddCtx->rx_sus_event_var);
+        }
+        break;
+      }
+
+
+      // Check the SYS queue first
+      if (!vos_is_mq_empty(&pSchedContext->sysRxMq))
+      {
+        // Service the SYS message queue
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Servicing the VOS SYS RX Message queue",__func__);
+        pMsgWrapper = vos_mq_get(&pSchedContext->sysRxMq);
+        if (pMsgWrapper == NULL)
+        {
+           VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+               "%s: pMsgWrapper is NULL", __FUNCTION__);
+           VOS_ASSERT(0);
+           break;
+        }
+        vStatus = sysRxProcessMsg( pSchedContext->pVContext,
+                                   pMsgWrapper->pVosMsg);
+        if (!VOS_IS_STATUS_SUCCESS(vStatus))
+        {
+          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Issue Processing TX SYS message",__func__);
+        }
+        // return message to the Core
+        vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        continue;
+      }
+
+      // Check the WDI queue
+      if (!vos_is_mq_empty(&pSchedContext->wdiRxMq))
+      {
+        wpt_msg *pWdiMsg;
+        VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+                  "%s: Servicing the VOS RX WDI Message queue",__func__);
+
+        pMsgWrapper = vos_mq_get(&pSchedContext->wdiRxMq);
+        if ((NULL == pMsgWrapper) || (NULL == pMsgWrapper->pVosMsg))
+        {
+          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: wdiRxMq message is NULL", __FUNCTION__);
+          VOS_ASSERT(0);
+          // we won't return this wrapper since it is corrupt
+        }
+        else
+        {
+          pWdiMsg = (wpt_msg *)pMsgWrapper->pVosMsg->bodyptr;
+          if ((NULL == pWdiMsg) || (NULL == pWdiMsg->callback))
+          {
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                      "%s: WDI Msg or callback is NULL", __FUNCTION__);
+            VOS_ASSERT(0);
+          }
+          else
+          {
+            // invoke the message handler
+            pWdiMsg->callback(pWdiMsg);
+          }
+
+          // return message to the Core
+          vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+        }
+        continue;
+      }
+
+      /* Check for any Suspend Indication */
+      if(test_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag))
+      {
+        clear_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag);
+        spin_lock(&pSchedContext->RxThreadLock);
+
+        /* Rx Thread Suspended */
+        complete(&pHddCtx->rx_sus_event_var);
+
+        init_completion(&pSchedContext->ResumeRxEvent);
+        spin_unlock(&pSchedContext->RxThreadLock);
+
+        /* Wait for Resume Indication */
+        wait_for_completion_interruptible(&pSchedContext->ResumeRxEvent);
+      }
+
+      break; //All queues are empty now
+    } // while message loop processing
+  } // while TRUE
+  // If we get here the RX thread must exit
+  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+      "%s: RX Thread exiting!!!!", __FUNCTION__);
+  complete_and_exit(&pSchedContext->RxShutdown, 0);
+} /* VosRxThread() */
+#endif
+
+#endif
+/*---------------------------------------------------------------------------
+  \brief vos_sched_close() - Close the vOSS Scheduler
+  The \a vos_sched_closes() function closes the vOSS Scheduler
+  Upon successful closing:
+     - All the message queues are flushed
+     - The Main Controller thread is closed
+     - The Tx thread is closed
+
+  \param  pVosContext - pointer to the global vOSS Context
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
+          function
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
+  \sa vos_sched_close()
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_sched_close ( v_PVOID_t pVosContext )
+{
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+        "%s: invoked", __FUNCTION__);
+    if (gpVosSchedContext == NULL)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: gpVosSchedContext == NULL\n",__FUNCTION__);
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    // shut down MC Thread
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->mcEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &gpVosSchedContext->mcEventFlag);
+    wake_up_interruptible(&gpVosSchedContext->mcWaitQueue);
+    //Wait for MC to exit
+    wait_for_completion_interruptible(&gpVosSchedContext->McShutdown);
+    gpVosSchedContext->McThread = 0;
+
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+    // shut down TX Thread
+    set_bit(TX_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->txEventFlag);
+    set_bit(TX_POST_EVENT_MASK, &gpVosSchedContext->txEventFlag);
+    wake_up_interruptible(&gpVosSchedContext->txWaitQueue);
+    //Wait for TX to exit
+    wait_for_completion_interruptible(&gpVosSchedContext->TxShutdown);
+    gpVosSchedContext->TxThread = 0;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    // shut down RX Thread
+    set_bit(RX_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->rxEventFlag);
+    set_bit(RX_POST_EVENT_MASK, &gpVosSchedContext->rxEventFlag);
+    wake_up_interruptible(&gpVosSchedContext->rxWaitQueue);
+    //Wait for RX to exit
+    wait_for_completion_interruptible(&gpVosSchedContext->RxShutdown);
+    gpVosSchedContext->RxThread = 0;
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+#endif // !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+
+    //Clean up message queues of TX and MC thread
+    vos_sched_flush_mc_mqs(gpVosSchedContext);
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+    vos_sched_flush_tx_mqs(gpVosSchedContext);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+    vos_sched_flush_rx_mqs(gpVosSchedContext);
+#endif // FEATURE_WLAN_INTEGRATED_SOC
+#endif // !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+
+    //Deinit all the queues
+    vos_sched_deinit_mqs(gpVosSchedContext);
+
+    return VOS_STATUS_SUCCESS;
+} /* vox_sched_close() */
+
+VOS_STATUS vos_watchdog_close ( v_PVOID_t pVosContext )
+{
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+        "%s: vos_watchdog closing now", __FUNCTION__);
+    if (gpVosWatchdogContext == NULL)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+           "%s: gpVosWatchdogContext is NULL\n",__FUNCTION__);
+       return VOS_STATUS_E_FAILURE;
+    }
+    set_bit(WD_SHUTDOWN_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
+    //Wait for Watchdog thread to exit
+    wait_for_completion_interruptible(&gpVosWatchdogContext->WdShutdown);
+    return VOS_STATUS_SUCCESS;
+} /* vos_watchdog_close() */
+
+VOS_STATUS vos_watchdog_chip_reset ( vos_chip_reset_reason_type  reason )
+{
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+    v_CONTEXT_t pVosContext = NULL;
+    hdd_context_t *pHddCtx = NULL;
+    hdd_chip_reset_stats_t *pResetStats;
+    struct sdio_func *sdio_func_dev = NULL;
+    
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+        "%s: vos_watchdog resetting WLAN", __FUNCTION__);
+    if (gpVosWatchdogContext == NULL)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+           "%s: Watchdog not enabled. LOGP ignored.",__FUNCTION__);
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
+    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+
+    hdd_reset_all_adapters(pHddCtx);
+
+    sdio_func_dev = libra_getsdio_funcdev();
+
+    if(sdio_func_dev == NULL)
+    {
+         /* Our card got removed before LOGP. Continue with reset anyways */
+         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: sdio_func_dev is NULL!",__func__);
+         return VOS_STATUS_SUCCESS;
+    }
+
+    sd_claim_host(sdio_func_dev);
+    
+    /* Disable SDIO IRQ since we are in LOGP state */
+    libra_disable_sdio_irq_capability(sdio_func_dev, 1);
+    libra_enable_sdio_irq(sdio_func_dev, 0);
+
+    sd_release_host(sdio_func_dev);
+
+    /* Take the lock here */
+    spin_lock(&gpVosWatchdogContext->wdLock);
+
+    if (gpVosWatchdogContext->resetInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+            "%s: Reset already in Progress. Ignoring signaling Watchdog",
+                                                           __FUNCTION__);
+        /* Release the lock here */
+        spin_unlock(&gpVosWatchdogContext->wdLock);
+        return VOS_STATUS_E_FAILURE;
+    } 
+    else if (pHddCtx->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+            "%s: LOGP already in Progress. Ignoring signaling Watchdog",
+                                                           __FUNCTION__);
+        /* Release the lock here */
+        spin_unlock(&gpVosWatchdogContext->wdLock);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    VOS_ASSERT(0);
+    
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
+    pAdapter = (hdd_adapter_t *)vos_get_context(VOS_MODULE_ID_HDD,pVosContext);
+
+    /* Set the flags so that all future CMD53 and Wext commands get blocked right away */
+    vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+    pHddCtx->isLogpInProgress = TRUE;
+
+    /* Release the lock here */
+    spin_unlock(&gpVosWatchdogContext->wdLock);
+
+    if (pHddCtx->isLoadUnloadInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+            "%s: Load/unload in Progress. Ignoring signaling Watchdog",
+                                                          __FUNCTION__);
+        return VOS_STATUS_E_FAILURE;    
+    }
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    if(VOS_STATUS_SUCCESS != hdd_wlan_reset_initialization())
+    {
+       /* This can fail if card got removed by SDCC during resume */
+       VOS_ASSERT(0);
+    }
+#endif
+
+    /* Update Reset Statistics */
+    pResetStats = &pHddCtx->hddChipResetStats;
+    pResetStats->totalLogpResets++;
+
+    switch (reason)
+    {
+     case VOS_CHIP_RESET_CMD53_FAILURE:
+        pResetStats->totalCMD53Failures++;
+        break;
+     case VOS_CHIP_RESET_FW_EXCEPTION:
+        pResetStats->totalFWHearbeatFailures++;
+        break;
+     case VOS_CHIP_RESET_MUTEX_READ_FAILURE:
+        pResetStats->totalMutexReadFailures++;
+        break;
+     case VOS_CHIP_RESET_MIF_EXCEPTION:
+        pResetStats->totalMIFErrorFailures++;
+        break;
+     default:
+        pResetStats->totalUnknownExceptions++;
+        break;
+    }
+
+    set_bit(WD_CHIP_RESET_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
+#endif
+    return VOS_STATUS_SUCCESS;
+} /* vos_watchdog_chip_reset() */
+
+/*---------------------------------------------------------------------------
+  \brief vos_sched_init_mqs: Initialize the vOSS Scheduler message queues
+  The \a vos_sched_init_mqs() function initializes the vOSS Scheduler
+  message queues.
+  \param  pVosSchedContext - pointer to the Scheduler Context.
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
+          is ready to be used.
+          VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable to initilize the scheduler
+
+  \sa vos_sched_init_mqs()
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_sched_init_mqs ( pVosSchedContext pSchedContext )
+{
+  VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
+  // Now intialize all the message queues
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the WDA MC Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->wdaMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init WDA MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#else
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the HAL MC Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->halMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init HAL MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#endif
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the PE MC Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->peMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init PE MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the SME MC Message queue", __func__);
+  vStatus = vos_mq_init(&pSchedContext->smeMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init SME MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the TL MC Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->tlMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init TL MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#endif
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the SYS MC Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->sysMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init SYS MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the WDI MC Message queue",__func__);
+
+  vStatus = vos_mq_init(&pSchedContext->wdiMcMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init WDI MC Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#endif
+
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the TL Tx Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->tlTxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init TL TX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the SSC Tx Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->sscTxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init SSC TX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#else
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the WDI Tx Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->wdiTxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init WDI TX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the WDI Rx Message queue",__func__);
+
+  vStatus = vos_mq_init(&pSchedContext->wdiRxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init WDI RX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+
+#endif
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: Initializing the SYS Tx Message queue",__func__);
+  vStatus = vos_mq_init(&pSchedContext->sysTxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init SYS TX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+
+  vStatus = vos_mq_init(&pSchedContext->sysRxMq);
+  if (! VOS_IS_STATUS_SUCCESS(vStatus))
+  {
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+            "%s: Failed to init SYS RX Message queue",__func__);
+    VOS_ASSERT(0);
+    return vStatus;
+  }
+#endif
+  return VOS_STATUS_SUCCESS;
+} /* vos_sched_init_mqs() */
+
+/*---------------------------------------------------------------------------
+  \brief vos_sched_deinit_mqs: Deinitialize the vOSS Scheduler message queues
+  The \a vos_sched_init_mqs() function deinitializes the vOSS Scheduler
+  message queues.
+  \param  pVosSchedContext - pointer to the Scheduler Context.
+  \return None
+  \sa vos_sched_deinit_mqs()
+  -------------------------------------------------------------------------*/
+void vos_sched_deinit_mqs ( pVosSchedContext pSchedContext )
+{
+  // Now de-intialize all message queues
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  // MC HAL
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the HAL MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->halMcMq);
+#else
+ // MC WDA
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the WDA MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->wdaMcMq);
+#endif
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  //MC PE
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the PE MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->peMcMq);
+  //MC SME
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the SME MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->smeMcMq);
+  //MC TL
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the TL MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->tlMcMq);
+#endif
+  //MC SYS
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the SYS MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->sysMcMq);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+  // MC WDI
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the WDI MC Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->wdiMcMq);
+#endif
+
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  //Tx TL
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s De-Initializing the TL Tx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->tlTxMq);
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  //Tx SSC
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: DeInitializing the SSC Tx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->sscTxMq);
+
+#else
+  //Tx WDI
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: DeInitializing the WDI Tx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->wdiTxMq);
+
+
+  //Rx WDI
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: DeInitializing the WDI Rx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->wdiRxMq);
+#endif
+
+  //Tx SYS
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: DeInitializing the SYS Tx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->sysTxMq);
+
+  //Rx SYS
+  VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+            "%s: DeInitializing the SYS Rx Message queue",__func__);
+  vos_mq_deinit(&pSchedContext->sysRxMq);
+
+#endif
+} /* vos_sched_deinit_mqs() */
+
+/*-------------------------------------------------------------------------
+ this helper function flushes all the MC message queues
+ -------------------------------------------------------------------------*/
+void vos_sched_flush_mc_mqs ( pVosSchedContext pSchedContext )
+{
+  pVosMsgWrapper pMsgWrapper = NULL;
+  pVosContextType vosCtx;
+
+  /*
+  ** Here each of the MC thread MQ shall be drained and returned to the
+  ** Core. Before returning a wrapper to the Core, the VOS message shall be
+  ** freed  first
+  */
+  VOS_TRACE( VOS_MODULE_ID_VOSS,
+             VOS_TRACE_LEVEL_INFO,
+             ("Flushing the MC Thread message queue\n") );
+
+  if (NULL == pSchedContext)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: pSchedContext is NULL", __FUNCTION__);
+     return;
+  }
+
+  vosCtx = (pVosContextType)(pSchedContext->pVContext);
+  if (NULL == vosCtx)
+  {
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: vosCtx is NULL", __FUNCTION__);
+     return;
+  }
+
+  /* Flush the SYS Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->sysMcMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing MC SYS message type %d ",__func__,
+               pMsgWrapper->pVosMsg->type );
+    sysMcFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /* Flush the HAL Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->halMcMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing MC HAL MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    halFreeMsg(vosCtx->pMACContext, (tSirMsgQ*)pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+#else
+  /* Flush the WDA Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->wdaMcMq) ))
+  {
+    if(pMsgWrapper->pVosMsg != NULL) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                   "%s: Freeing MC WDA MSG message type %d",
+                   __FUNCTION__, pMsgWrapper->pVosMsg->type );
+        if (pMsgWrapper->pVosMsg->bodyptr) {
+            vos_mem_free((v_VOID_t*)pMsgWrapper->pVosMsg->bodyptr);
+        }
+
+        pMsgWrapper->pVosMsg->bodyptr = NULL;
+        pMsgWrapper->pVosMsg->bodyval = 0;
+        pMsgWrapper->pVosMsg->type = 0;
+    }
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+
+  /* Flush the WDI Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->wdiMcMq) ))
+  {
+    if(pMsgWrapper->pVosMsg != NULL)
+    {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                   "%s: Freeing MC WDI MSG message type %d",
+                   __FUNCTION__, pMsgWrapper->pVosMsg->type );
+        if (pMsgWrapper->pVosMsg->bodyptr) {
+            vos_mem_free((v_VOID_t*)pMsgWrapper->pVosMsg->bodyptr);
+        }
+
+        pMsgWrapper->pVosMsg->bodyptr = NULL;
+        pMsgWrapper->pVosMsg->bodyval = 0;
+        pMsgWrapper->pVosMsg->type = 0;
+    }
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+
+#endif
+#if !defined(ANI_MANF_DIAG) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+  /* Flush the PE Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->peMcMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing MC PE MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    peFreeMsg(vosCtx->pMACContext, (tSirMsgQ*)pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+  /* Flush the SME Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->smeMcMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing MC SME MSG message type %d", __func__,
+               pMsgWrapper->pVosMsg->type );
+    sme_FreeMsg(vosCtx->pMACContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+    /* Flush the TL Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->tlMcMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing MC TL message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    WLANTL_McFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+#endif
+} /* vos_sched_flush_mc_mqs() */
+
+/*-------------------------------------------------------------------------
+ This helper function flushes all the TX message queues
+ ------------------------------------------------------------------------*/
+void vos_sched_flush_tx_mqs ( pVosSchedContext pSchedContext )
+{
+  pVosMsgWrapper pMsgWrapper = NULL;
+  /*
+  ** Here each of the TX thread MQ shall be drained and returned to the
+  ** Core. Before returning a wrapper to the Core, the VOS message shall
+  ** be freed first
+  */
+  VOS_TRACE( VOS_MODULE_ID_VOSS,
+             VOS_TRACE_LEVEL_INFO,
+             "%s: Flushing the TX Thread message queue",__func__);
+
+  if (NULL == pSchedContext)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: pSchedContext is NULL", __FUNCTION__);
+     return;
+  }
+
+  /* Flush the SYS Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->sysTxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing TX SYS message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    sysTxFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+  /* Flush the TL Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->tlTxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing TX TL MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    WLANTL_TxFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /* Flush the SSC Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->sscTxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing TX SSC MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    WLANSSC_FreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+#else
+  /* Flush the WDI Mq */
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->wdiTxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing TX WDI MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    sysTxFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+    vos_core_return_msg(pSchedContext->pVContext, pMsgWrapper);
+  }
+ #endif
+} /* vos_sched_flush_tx_mqs() */
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*-------------------------------------------------------------------------
+ This helper function flushes all the RX message queues
+ ------------------------------------------------------------------------*/
+void vos_sched_flush_rx_mqs ( pVosSchedContext pSchedContext )
+{
+  pVosMsgWrapper pMsgWrapper = NULL;
+  /*
+  ** Here each of the RX thread MQ shall be drained and returned to the
+  ** Core. Before returning a wrapper to the Core, the VOS message shall
+  ** be freed first
+  */
+  VOS_TRACE( VOS_MODULE_ID_VOSS,
+             VOS_TRACE_LEVEL_INFO,
+             "%s: Flushing the RX Thread message queue",__func__);
+
+  if (NULL == pSchedContext)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: pSchedContext is NULL", __FUNCTION__);
+     return;
+  }
+
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->wdiRxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing RX WDI MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    sysTxFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+  }
+
+  while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->sysRxMq) ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_VOSS,
+               VOS_TRACE_LEVEL_INFO,
+               "%s: Freeing RX SYS MSG message type %d",__func__,
+               pMsgWrapper->pVosMsg->type );
+    sysTxFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
+  }
+
+}/* vos_sched_flush_rx_mqs() */
+#endif
+
+/*-------------------------------------------------------------------------
+ This helper function helps determine if thread id is of TX thread
+ ------------------------------------------------------------------------*/
+int vos_sched_is_tx_thread(int threadID)
+{
+   // Make sure that Vos Scheduler context has been initialized
+   VOS_ASSERT( NULL != gpVosSchedContext);
+   if (gpVosSchedContext == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s: gpVosSchedContext == NULL",__FUNCTION__);
+      return 0;
+   }
+   return ((gpVosSchedContext->TxThread) && (threadID == gpVosSchedContext->TxThread->pid));
+}
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+/*-------------------------------------------------------------------------
+ This helper function helps determine if thread id is of RX thread
+ ------------------------------------------------------------------------*/
+int vos_sched_is_rx_thread(int threadID)
+{
+   // Make sure that Vos Scheduler context has been initialized
+   VOS_ASSERT( NULL != gpVosSchedContext);
+   if (gpVosSchedContext == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s: gpVosSchedContext == NULL",__FUNCTION__);
+      return 0;
+   }
+   return ((gpVosSchedContext->RxThread) && (threadID == gpVosSchedContext->RxThread->pid));
+}
+#endif
+/*-------------------------------------------------------------------------
+ Helper function to get the scheduler context
+ ------------------------------------------------------------------------*/
+pVosSchedContext get_vos_sched_ctxt(void)
+{
+   //Make sure that Vos Scheduler context has been initialized
+   if (gpVosSchedContext == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: gpVosSchedContext == NULL",__FUNCTION__);
+   }
+   return (gpVosSchedContext);
+}
+/*-------------------------------------------------------------------------
+ Helper function to get the watchdog context
+ ------------------------------------------------------------------------*/
+pVosWatchdogContext get_vos_watchdog_ctxt(void)
+{
+   //Make sure that Vos Scheduler context has been initialized
+   if (gpVosWatchdogContext == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: gpVosWatchdogContext == NULL",__FUNCTION__);
+   }
+   return (gpVosWatchdogContext);
+}
+/**
+  @brief vos_watchdog_wlan_shutdown()
+
+  This function is called to shutdown WLAN driver during SSR.
+  Adapters are disabled, and the watchdog task will be signalled
+  to shutdown WLAN driver.
+
+  @param
+         NONE
+  @return
+         VOS_STATUS_SUCCESS   - Operation completed successfully.
+         VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_watchdog_wlan_shutdown(void)
+{
+    v_CONTEXT_t pVosContext = NULL;
+    hdd_context_t *pHddCtx = NULL;
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+        "%s: WLAN driver is shutting down ", __FUNCTION__);
+    if (NULL == gpVosWatchdogContext)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+           "%s: Watchdog not enabled. LOGP ignored.", __FUNCTION__);
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
+    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+    if (NULL == pHddCtx)
+    {
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+           "%s: Invalid HDD Context", __FUNCTION__);
+       return VOS_STATUS_E_FAILURE;
+    }
+
+    /* Take the lock here */
+    spin_lock(&gpVosWatchdogContext->wdLock);
+
+    /* reuse the existing 'reset in progress' */
+    if (gpVosWatchdogContext->resetInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+            "%s: Shutdown already in Progress. Ignoring signaling Watchdog",
+                                                           __FUNCTION__);
+        /* Release the lock here */
+        spin_unlock(&gpVosWatchdogContext->wdLock);
+        return VOS_STATUS_E_FAILURE;
+    }
+    /* reuse the existing 'logp in progress', eventhough it is not
+     * exactly the same */
+    else if (pHddCtx->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+            "%s: shutdown/re-init already in Progress. Ignoring signaling Watchdog",
+                                                           __FUNCTION__);
+        /* Release the lock here */
+        spin_unlock(&gpVosWatchdogContext->wdLock);
+        return VOS_STATUS_E_FAILURE;
+    } 
+
+    /* Set the flags so that all future CMD53 and Wext commands get blocked right away */
+    vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+    pHddCtx->isLogpInProgress = TRUE;
+
+    /* Release the lock here */
+    spin_unlock(&gpVosWatchdogContext->wdLock);
+
+    if (pHddCtx->isLoadUnloadInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                "%s: Load/unload in Progress. Ignoring signaling Watchdog",
+                __FUNCTION__);
+        return VOS_STATUS_E_FAILURE;
+    }
+    /* Update Riva Reset Statistics */
+    pHddCtx->hddRivaResetStats++;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    if(VOS_STATUS_SUCCESS != hdd_wlan_reset_initialization())
+    {
+       VOS_ASSERT(0);
+    }
+#endif
+
+    set_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/**
+  @brief vos_watchdog_wlan_re_init()
+
+  This function is called to re-initialize WLAN driver, and this is
+  called when Riva SS reboots.
+
+  @param
+         NONE
+  @return
+         VOS_STATUS_SUCCESS   - Operation completed successfully.
+         VOS_STATUS_E_FAILURE - Operation failed.
+
+*/
+VOS_STATUS vos_watchdog_wlan_re_init(void)
+{
+    /* watchdog task is still running, it is not closed in shutdown */
+    set_bit(WD_WLAN_REINIT_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
+
+    return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/VOSS/src/vos_sched.h b/CORE/VOSS/src/vos_sched.h
new file mode 100644
index 0000000..759bb94
--- /dev/null
+++ b/CORE/VOSS/src/vos_sched.h
@@ -0,0 +1,534 @@
+/*
+ * 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( __VOS_SCHED_H )
+#define __VOS_SCHED_H
+
+/**=========================================================================
+  
+  \file  vos_sched.h
+  
+  \brief virtual Operating System Servies (vOSS)
+               
+   Definitions for some of the internal data type that is internally used 
+   by the vOSS scheduler on Windows Mobile.
+   
+   This file defines a vOSS message queue on Win Mobile and give some
+   insights about how the scheduler implements the execution model supported
+   by vOSS.
+    
+  
+   Copyright 2008 (c) 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 
+  --------    ---    --------------------------------------------------------
+  09/15/08    lac    Removed hardcoded #define for VOS_TRACE.
+  06/12/08    hba    Created module. 
+     
+===========================================================================*/ 
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_event.h>
+#include "i_vos_types.h"
+#include "i_vos_packet.h"
+#include <linux/wait.h>
+#include <linux/wakelock.h>
+#include <vos_power.h>
+
+#define TX_POST_EVENT_MASK               0x001
+#define TX_SUSPEND_EVENT_MASK            0x002
+#define MC_POST_EVENT_MASK               0x001
+#define MC_SUSPEND_EVENT_MASK            0x002
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#define RX_POST_EVENT_MASK               0x001
+#define RX_SUSPEND_EVENT_MASK            0x002
+#endif
+#define TX_SHUTDOWN_EVENT_MASK           0x010
+#define MC_SHUTDOWN_EVENT_MASK           0x010
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#define RX_SHUTDOWN_EVENT_MASK           0x010
+#endif
+#define WD_POST_EVENT_MASK               0x001
+#define WD_SHUTDOWN_EVENT_MASK           0x002
+#define WD_CHIP_RESET_EVENT_MASK         0x004
+#define WD_WLAN_SHUTDOWN_EVENT_MASK      0x008
+#define WD_WLAN_REINIT_EVENT_MASK        0x010
+
+ 
+ 
+/*
+** Maximum number of messages in the system
+** These are buffers to account for all current messages 
+** with some accounting of what we think is a 
+** worst-case scenario.  Must be able to handle all
+** incoming frames, as well as overhead for internal
+** messaging
+*/
+#define VOS_CORE_MAX_MESSAGES           (VPKT_NUM_RX_RAW_PACKETS + 32)
+
+
+/*
+** vOSS Message queue definition.
+*/
+typedef struct _VosMqType
+{
+  /* Lock use to synchronize access to this message queue */
+  spinlock_t       mqLock;
+
+  /* List of vOS Messages waiting on this queue */
+  struct list_head  mqList;
+
+} VosMqType, *pVosMqType;
+
+
+/*
+** vOSS Scheduler context
+** The scheduler context contains the following:
+**   ** the messages queues
+**   ** the handle to the tread
+**   ** pointer to the events that gracefully shutdown the MC and Tx threads
+**    
+*/
+typedef struct _VosSchedContext
+{
+  /* Place holder to the VOSS Context */ 
+   v_PVOID_t           pVContext; 
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+  /* HAL Message queue on the Main thread*/
+   VosMqType           halMcMq;
+#else
+  /* WDA Message queue on the Main thread*/
+   VosMqType           wdaMcMq;
+#endif
+
+
+
+   /* PE Message queue on the Main thread*/
+   VosMqType           peMcMq;
+
+   /* SME Message queue on the Main thread*/
+   VosMqType           smeMcMq;
+
+   /* TL Message queue on the Main thread */
+   VosMqType           tlMcMq;
+
+   /* SYS Message queue on the Main thread */
+   VosMqType           sysMcMq;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   /* SSC Message queue on the Tx */
+   VosMqType           sscTxMq;
+#else
+  /* WDI Message queue on the Main thread*/
+   VosMqType           wdiMcMq;
+
+   /* WDI Message queue on the Tx Thread*/
+   VosMqType           wdiTxMq;
+
+   /* WDI Message queue on the Rx Thread*/
+   VosMqType           wdiRxMq;
+#endif
+
+   /* TL Message queue on the Tx thread */
+   VosMqType           tlTxMq;
+
+   /* SYS Message queue on the Tx thread */
+   VosMqType           sysTxMq;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   VosMqType           sysRxMq;
+#endif
+
+   /* Handle of Event for MC thread to signal startup */
+   struct completion   McStartEvent;
+
+   /* Handle of Event for Tx thread to signal startup */
+   struct completion   TxStartEvent;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Handle of Event for Rx thread to signal startup */
+   struct completion   RxStartEvent;
+#endif
+
+   struct task_struct* McThread;
+
+   /* TX Thread handle */
+   
+   struct task_struct*   TxThread;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* RX Thread handle */
+   struct task_struct*   RxThread;
+#endif
+
+
+   /* completion object for MC thread shutdown */
+   struct completion   McShutdown; 
+
+   /* completion object for Tx thread shutdown */
+   struct completion   TxShutdown; 
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* completion object for Rx thread shutdown */
+   struct completion   RxShutdown;
+#endif
+
+   /* Wait queue for MC thread */
+   wait_queue_head_t mcWaitQueue;
+
+   unsigned long     mcEventFlag;
+
+   /* Wait queue for Tx thread */
+   wait_queue_head_t txWaitQueue;
+
+   unsigned long     txEventFlag;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Wait queue for Rx thread */
+   wait_queue_head_t rxWaitQueue;
+
+   unsigned long     rxEventFlag;
+#endif
+   
+   /* Completion object to resume Mc thread */
+   struct completion ResumeMcEvent;
+
+   /* Completion object to resume Tx thread */
+   struct completion ResumeTxEvent;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Completion object to resume Rx thread */
+   struct completion ResumeRxEvent;
+#endif
+
+   /* lock to make sure that McThread and TxThread Suspend/resume mechanism is in sync*/
+   spinlock_t McThreadLock;
+   spinlock_t TxThreadLock;
+   spinlock_t RxThreadLock;
+
+} VosSchedContext, *pVosSchedContext;
+
+/*
+** VOSS watchdog context
+** The watchdog context contains the following:
+** The messages queues and events
+** The handle to the thread
+**    
+*/
+typedef struct _VosWatchdogContext
+{
+
+   /* Place holder to the VOSS Context */ 
+   v_PVOID_t pVContext; 
+
+   /* Handle of Event for Watchdog thread to signal startup */
+   struct completion WdStartEvent;
+
+   /* Watchdog Thread handle */
+  
+   struct task_struct* WdThread;
+
+   /* completion object for Watchdog thread shutdown */
+   struct completion WdShutdown; 
+
+   /* Wait queue for Watchdog thread */
+   wait_queue_head_t wdWaitQueue;
+
+   /* Event flag for events handled by Watchdog */
+   unsigned long wdEventFlag;
+
+   v_BOOL_t resetInProgress;
+
+   vos_chip_reset_reason_type reason;
+
+   /* Lock for preventing multiple reset being triggered simultaneously */
+   spinlock_t wdLock;
+
+} VosWatchdogContext, *pVosWatchdogContext;
+
+/*
+** vOSS Sched Msg Wrapper
+** Wrapper messages so that they can be chained to their respective queue
+** in the scheduler.
+*/
+typedef struct _VosMsgWrapper
+{
+   /* Message node */
+   struct list_head  msgNode;
+
+   /* the Vos message it is associated to */
+   vos_msg_t    *pVosMsg;
+
+} VosMsgWrapper, *pVosMsgWrapper;
+
+
+
+typedef struct _VosContextType
+{                                                  
+   /* Messages buffers */
+   vos_msg_t           aMsgBuffers[VOS_CORE_MAX_MESSAGES];
+
+   VosMsgWrapper       aMsgWrappers[VOS_CORE_MAX_MESSAGES];
+   
+   /* Free Message queue*/
+   VosMqType           freeVosMq;
+
+   /* Scheduler Context */
+   VosSchedContext     vosSched;
+
+   /* Watchdog Context */
+   VosWatchdogContext  vosWatchdog;
+
+   /* HDD Module Context  */
+   v_VOID_t           *pHDDContext;
+
+#ifdef WLAN_SOFTAP_FEATURE
+   /* HDD SoftAP Module Context  */
+   v_VOID_t           *pHDDSoftAPContext;
+#endif
+
+   /* TL Module Context  */
+   v_VOID_t           *pTLContext;
+
+   /* MAC Module Context  */
+   v_VOID_t           *pMACContext;
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC   /* BAL  Context  */
+
+   v_VOID_t           *pBALContext;
+   
+   /* SAL Context */
+   v_VOID_t           *pSALContext;
+
+   /* SSC Context */
+   v_VOID_t           *pSSCContext;
+#endif
+   /* BAP Context */
+   v_VOID_t           *pBAPContext;
+
+#ifdef WLAN_SOFTAP_FEATURE   
+   /* SAP Context */
+   v_VOID_t           *pSAPContext;
+#endif
+   
+   /* VOS Packet Context */
+   vos_pkt_context_t   vosPacket; 
+
+   vos_event_t         ProbeEvent;
+
+   volatile v_U8_t     isLogpInProgress;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   vos_event_t         wdaCompleteEvent;
+
+   /* WDA Context */
+   v_VOID_t            *pWDAContext;
+#endif
+
+   volatile v_U8_t    isLoadUnloadInProgress;
+
+} VosContextType, *pVosContextType;
+
+
+
+/*--------------------------------------------------------------------------- 
+  Function declarations and documenation
+---------------------------------------------------------------------------*/
+ 
+int vos_sched_is_tx_thread(int threadID);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+int vos_sched_is_rx_thread(int threadID);
+#endif
+/*---------------------------------------------------------------------------
+  
+  \brief vos_sched_open() - initialize the vOSS Scheduler  
+    
+  The \a vos_sched_open() function initializes the vOSS Scheduler
+  Upon successful initialization:
+  
+     - All the message queues are initialized
+     
+     - The Main Controller thread is created and ready to receive and
+       dispatch messages.
+     
+     - The Tx thread is created and ready to receive and dispatch messages
+      
+  
+  \param  pVosContext - pointer to the global vOSS Context
+  
+  \param  pVosSchedContext - pointer to a previously allocated buffer big
+          enough to hold a scheduler context.       
+  \
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the scheduler
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the scheduler
+          
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
+          function 
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_sched_open()
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_sched_open( v_PVOID_t pVosContext, 
+                           pVosSchedContext pSchedCxt,
+                           v_SIZE_t SchedCtxSize);
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_watchdog_open() - initialize the vOSS watchdog  
+    
+  The \a vos_watchdog_open() function initializes the vOSS watchdog. Upon successful 
+        initialization, the watchdog thread is created and ready to receive and  process messages.
+     
+   
+  \param  pVosContext - pointer to the global vOSS Context
+  
+  \param  pWdContext - pointer to a previously allocated buffer big
+          enough to hold a watchdog context.       
+
+  \return VOS_STATUS_SUCCESS - Watchdog was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the Watchdog
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the Watchdog
+          
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the Watchdog Open
+          function 
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the Watchdog/   
+
+  \sa vos_watchdog_open()
+  
+  -------------------------------------------------------------------------*/
+
+VOS_STATUS vos_watchdog_open
+
+(
+  v_PVOID_t           pVosContext,
+  pVosWatchdogContext pWdContext,
+  v_SIZE_t            wdCtxSize
+);
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_sched_close() - Close the vOSS Scheduler  
+    
+  The \a vos_sched_closes() function closes the vOSS Scheduler
+  Upon successful closing:
+  
+     - All the message queues are flushed
+     
+     - The Main Controller thread is closed
+     
+     - The Tx thread is closed
+      
+  
+  \param  pVosContext - pointer to the global vOSS Context
+  
+  \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and 
+          is ready to be used.
+          
+          VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open
+          function 
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/   
+          
+  \sa vos_sched_close()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_sched_close( v_PVOID_t pVosContext);
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_watchdog_close() - Close the vOSS Watchdog  
+    
+  The \a vos_watchdog_close() function closes the vOSS Watchdog
+  Upon successful closing:
+  
+     - The Watchdog thread is closed
+     
+      
+  \param  pVosContext - pointer to the global vOSS Context
+  
+  \return VOS_STATUS_SUCCESS - Watchdog was successfully initialized and 
+          is ready to be used.
+          
+          VOS_STATUS_E_INVAL - Invalid parameter passed 
+          
+          VOS_STATUS_E_FAILURE - Failure to initialize the Watchdog/   
+          
+  \sa vos_watchdog_close()
+  
+---------------------------------------------------------------------------*/
+VOS_STATUS vos_watchdog_close ( v_PVOID_t pVosContext );
+
+/* Helper routines provided to other VOS API's */
+VOS_STATUS vos_mq_init(pVosMqType pMq);
+void vos_mq_deinit(pVosMqType pMq);
+void vos_mq_put(pVosMqType pMq, pVosMsgWrapper pMsgWrapper);
+pVosMsgWrapper vos_mq_get(pVosMqType pMq);
+v_BOOL_t vos_is_mq_empty(pVosMqType pMq);
+pVosSchedContext get_vos_sched_ctxt(void);
+pVosWatchdogContext get_vos_watchdog_ctxt(void);
+VOS_STATUS vos_sched_init_mqs   (pVosSchedContext pSchedContext);
+void vos_sched_deinit_mqs (pVosSchedContext pSchedContext);
+void vos_sched_flush_mc_mqs  (pVosSchedContext pSchedContext);
+void vos_sched_flush_tx_mqs  (pVosSchedContext pSchedContext);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+void vos_sched_flush_rx_mqs  (pVosSchedContext pSchedContext);
+#endif
+VOS_STATUS vos_watchdog_chip_reset ( vos_chip_reset_reason_type reason );
+void clearWlanResetReason(void);
+
+void vos_timer_module_init( void );
+VOS_STATUS vos_watchdog_wlan_shutdown(void);
+VOS_STATUS vos_watchdog_wlan_re_init(void);
+
+#endif // #if !defined __VOSS_SCHED_H
diff --git a/CORE/VOSS/src/vos_threads.c b/CORE/VOSS/src/vos_threads.c
new file mode 100644
index 0000000..d51fa49
--- /dev/null
+++ b/CORE/VOSS/src/vos_threads.c
@@ -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.
+ */
+
+/**=========================================================================
+  
+  \file  vos_threads.c
+  
+  \brief virtual Operating System Services (vOSS) Threading APIs
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_threads.h>
+#include <vos_trace.h>
+#include <linux/jiffies.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_sleep() - sleep
+
+  The \a vos_sleep() function suspends the execution of the current thread
+  until the specified time out interval elapses.
+     
+  \param msInterval - the number of milliseconds to suspend the current thread.
+  A value of 0 may or may not cause the current thread to yield.
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_sleep( v_U32_t msInterval )
+{
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return;
+   }
+   msleep_interruptible(msInterval);
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_sleep_us() - sleep
+
+  The \a vos_sleep_us() function suspends the execution of the current thread
+  until the specified time out interval elapses.
+     
+  \param usInterval - the number of microseconds to suspend the current thread.
+  A value of 0 may or may not cause the current thread to yield.
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_sleep_us( v_U32_t usInterval )
+{
+   unsigned long timeout = usecs_to_jiffies(usInterval) + 1;
+   if (in_interrupt())
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __FUNCTION__);
+      return;
+   }
+   while (timeout && !signal_pending(current))
+       timeout = schedule_timeout_interruptible(timeout);
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_busy_wait() - busy wait
+
+  The \a vos_busy_wait() function places the current thread in busy wait
+  until the specified time out interval elapses. If the interval is greater
+  than 50us on WM, the behaviour is undefined.
+     
+  \param usInterval - the number of microseconds to busy wait. 
+  
+  \return Nothing.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+v_VOID_t vos_busy_wait( v_U32_t usInterval )
+{
+    udelay(usInterval);
+}
diff --git a/CORE/VOSS/src/vos_timer.c b/CORE/VOSS/src/vos_timer.c
new file mode 100644
index 0000000..00d4b61
--- /dev/null
+++ b/CORE/VOSS/src/vos_timer.c
@@ -0,0 +1,864 @@
+/*
+ * 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  vos_timer.c
+  
+  \brief virtual Operating System Servies (vOS)
+               
+   Definitions for vOSS Timer services
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_timer.h>
+#include <vos_lock.h>
+#include <vos_api.h>
+#include "wlan_qct_sys.h"
+#include "vos_sched.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#define LINUX_TIMER_COOKIE 0x12341234
+#define LINUX_INVALID_TIMER_COOKIE 0xfeedface
+#define TMR_INVALID_ID ( 0 )
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+static unsigned int        persistentTimerCount = 0;
+static vos_lock_t          persistentTimerCountLock;
+// static sleep_okts_handle   sleepClientHandle;
+
+/*------------------------------------------------------------------------- 
+  Function declarations and documenation
+  ------------------------------------------------------------------------*/
+// TBD: Need to add code for deferred timers implementation
+
+// clean up timer states after it has been deactivated
+// check and try to allow sleep after a timer has been stopped or expired
+static void tryAllowingSleep( VOS_TIMER_TYPE type )
+{
+   if ( VOS_TIMER_TYPE_WAKE_APPS == type )
+   {
+     // vos_lock_acquire( &persistentTimerCountLock );
+      persistentTimerCount--;
+      if ( 0 == persistentTimerCount )
+      {
+         // since the number of persistent timers has decreased from 1 to 0,
+         // the timer should allow sleep
+         //sleep_assert_okts( sleepClientHandle );
+      }
+      //vos_lock_release( &persistentTimerCountLock );
+   }
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief  vos_linux_timer_callback() - internal vos entry point which is 
+          called when the timer interval expires 
+
+  This function in turn calls the vOS client callback and changes the 
+  state of the timer from running (ACTIVE) to expired (INIT). 
+  
+  
+  \param uTimerID - return value of the timeSetEvent() from the 
+      vos_timer_start() API which 
+
+  \param dwUser - this is supplied by the fourth parameter of the timeSetEvent()
+      which is the timer structure being passed as the userData
+
+  \param uMsg - Reserved / Not Used
+
+  \param dw1  - Reserved / Not Used
+
+  \param dw2  - Reserved / Not Used
+  
+  \return  nothing
+  --------------------------------------------------------------------------*/
+
+static void vos_linux_timer_callback ( v_U32_t data ) 
+{
+   vos_timer_t *timer = ( vos_timer_t *)data; 
+   vos_msg_t msg;
+   VOS_STATUS vStatus;
+   unsigned long flags;
+   
+   vos_timer_callback_t callback=NULL;
+   v_PVOID_t userData=NULL;
+   int threadId;
+   VOS_TIMER_TYPE type=VOS_TIMER_TYPE_SW;
+   
+   VOS_ASSERT(timer);
+
+   if (timer == NULL)
+   {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s Null pointer passed in!",__FUNCTION__);
+     return;
+   }
+
+   threadId = timer->platformInfo.threadID;
+   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
+   
+   switch ( timer->state )
+   {
+   case VOS_TIMER_STATE_STARTING:
+      // we are in this state because someone just started the timer, MM timer
+      // got started and expired, but the time content have not bee updated
+      // this is a rare race condition!
+      timer->state = VOS_TIMER_STATE_STOPPED;
+      vStatus = VOS_STATUS_E_ALREADY;
+      break;
+   case VOS_TIMER_STATE_STOPPED:
+      vStatus = VOS_STATUS_E_ALREADY;
+      break;
+   case VOS_TIMER_STATE_UNUSED:
+      vStatus = VOS_STATUS_E_EXISTS;
+      break;
+   case VOS_TIMER_STATE_RUNNING:
+      // need to go to stop state here because the call-back function may restart 
+      // timer (to emulate periodic timer)
+      timer->state = VOS_TIMER_STATE_STOPPED;
+      // copy the relevant timer information to local variables;
+      // once we exist from this critical section, the timer content may be modified
+      // by other tasks
+      callback = timer->callback;
+      userData = timer->userData;
+      threadId = timer->platformInfo.threadID;
+      type = timer->type;
+      vStatus = VOS_STATUS_SUCCESS;
+      break;
+   default:
+      VOS_ASSERT(0);
+      vStatus = VOS_STATUS_E_FAULT;
+      break;
+   }
+   
+   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+   
+   if ( VOS_STATUS_SUCCESS != vStatus )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "TIMER callback called in a wrong state=%d", timer->state);
+      return;
+   }
+
+   tryAllowingSleep( type );
+
+   VOS_ASSERT( callback ); 
+
+   // If timer has expired then call vos_client specific callback 
+   if ( vos_sched_is_tx_thread( threadId ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
+          "TIMER callback: running on TX thread");
+         
+      //Serialize to the Tx thread
+      sysBuildMessageHeader( SYS_MSG_ID_TX_TIMER, &msg );
+      msg.bodyptr  = callback;
+      msg.bodyval  = (v_U32_t)userData; 
+       
+      if(vos_tx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
+         return;
+   }
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   else if ( vos_sched_is_rx_thread( threadId ) )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
+          "TIMER callback: running on RX thread");
+         
+      //Serialize to the Rx thread
+      sysBuildMessageHeader( SYS_MSG_ID_RX_TIMER, &msg );
+      msg.bodyptr  = callback;
+      msg.bodyval  = (v_U32_t)userData; 
+       
+      if(vos_rx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
+         return;
+   }
+#endif
+   else 
+   {
+      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+          "TIMER callback: running on MC thread");
+                    
+      // Serialize to the MC thread
+      sysBuildMessageHeader( SYS_MSG_ID_MC_TIMER, &msg );
+      msg.bodyptr  = callback;
+      msg.bodyval  = (v_U32_t)userData; 
+       
+      if(vos_mq_post_message( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
+        return;
+   }     
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Could not enqueue timer to any queue", __func__);
+   VOS_ASSERT(0);
+}
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_timer_getCurrentState() - Get the current state of the timer
+
+  \param pTimer - the timer object
+  
+  \return timer state
+  
+  \sa
+  
+---------------------------------------------------------------------------*/
+VOS_TIMER_STATE vos_timer_getCurrentState( vos_timer_t *pTimer )
+{
+   if ( NULL == pTimer )
+   {
+      VOS_ASSERT(0);
+      return VOS_TIMER_STATE_UNUSED;
+   }
+
+   switch ( pTimer->state )
+   {
+      case VOS_TIMER_STATE_STOPPED:
+      case VOS_TIMER_STATE_STARTING:
+      case VOS_TIMER_STATE_RUNNING:
+      case VOS_TIMER_STATE_UNUSED:
+         return pTimer->state;
+      default:
+         VOS_ASSERT(0);
+         return VOS_TIMER_STATE_UNUSED;
+   }    
+}
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_timer_module_init() - Initializes a vOSS timer module.
+
+  This API initializes the VOSS timer module.  This needs to be called
+  exactly once prior to using any VOSS timers. 
+
+  \sa
+  
+  --------------------------------------------------------------------------*/
+
+void vos_timer_module_init( void )
+{
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
+         "Initializing the VOSS timer module");
+   vos_lock_init( &persistentTimerCountLock );
+}
+
+#ifdef TIMER_MANAGER
+#include "wlan_hdd_dp_utils.h"
+
+hdd_list_t vosTimerList;
+
+static void vos_timer_clean(void);
+
+void vos_timer_manager_init()
+{
+   /* Initalizing the list with maximum size of 60000 */
+   hdd_list_init(&vosTimerList, 1000);  
+   return;
+}
+
+static void vos_timer_clean()
+{
+    v_SIZE_t listSize;
+    unsigned long flags;
+        
+    hdd_list_size(&vosTimerList, &listSize);
+    
+    if (listSize)
+    {
+       hdd_list_node_t* pNode;
+       VOS_STATUS vosStatus;
+
+       timer_node_t *ptimerNode;
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                 "%s: List is not Empty. listSize %d ",
+                 __FUNCTION__, (int)listSize);
+
+       do
+       {
+          spin_lock_irqsave(&vosTimerList.lock, flags);
+          vosStatus = hdd_list_remove_front(&vosTimerList, &pNode);
+          spin_unlock_irqrestore(&vosTimerList.lock, flags);
+          if (VOS_STATUS_SUCCESS == vosStatus)
+          {
+             ptimerNode = (timer_node_t*)pNode;
+             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                       "Timer Leak@ File %s, @Line %d", 
+                       ptimerNode->fileName, (int)ptimerNode->lineNum);
+
+             vos_mem_free(ptimerNode);
+          }
+       } while (vosStatus == VOS_STATUS_SUCCESS);
+    }
+}
+
+void vos_timer_exit()
+{
+    vos_timer_clean();
+    hdd_list_destroy(&vosTimerList);
+}
+#endif
+  
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_init() - Initialize a vOSS timer.
+
+  This API initializes a vOS Timer object. 
+  
+  The \a vos_timer_init() initializes a vOS Timer object.  A timer must be 
+  initialized by calling vos_timer_initialize() before it may be used in 
+  any other timer functions. 
+  
+  Attempting to initialize timer that is already initialized results in 
+  a failure. A destroyed timer object can be re-initialized with a call to
+  \a vos_timer_init().  The results of otherwise referencing the object 
+  after it has been destroyed are undefined.  
+  
+  Calls to vOSS timer functions to manipulate the timer such
+  as vos_timer_set() will fail if the timer is not initialized or has
+  been destroyed.  Therefore, don't use the timer after it has been 
+  destroyed until it has been re-initialized.
+  
+  All callback will be executed within the VOS main thread unless it is 
+  initialized from the Tx thread flow, in which case it will be executed
+  within the tx thread flow.
+  
+  \param timer - pointer to the opaque timer object to initialize
+  
+  \param timerType - specifies the type of timer.  We have two different
+                     timer types.
+    <ol>
+      <li> VOS_TIMER_TYPE_SW - Pure software timer. The Apps processor
+           may not be awoken when this timer expires.
+      <li> VOS_TIMER_TYPE_WAKE_APPS - The Apps processor will be awoken
+           from power collapse when this type of timer expires.
+     </ol>                      
+  
+  \param callback - the callback function to be called when the timer
+         expires.
+         
+  \param userData - a user data (or context) that is returned to the 
+         callback function as a parameter when the timer expires.         
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully initialized and 
+          is ready to be used.
+  
+          VOS_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initialize the timer
+
+          VOS_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the timer
+
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to initialize the object referenced by timer, a previously 
+          initialized but not yet destroyed timer.
+
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+---------------------------------------------------------------------------*/
+#ifdef TIMER_MANAGER
+VOS_STATUS vos_timer_init_debug( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData, 
+                           char* fileName, v_U32_t lineNum )
+{
+   VOS_STATUS vosStatus;
+    unsigned long flags;
+   // Check for invalid pointer
+   if ((timer == NULL) || (callback == NULL)) 
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Null params being passed",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   timer->ptimerNode = vos_mem_malloc(sizeof(timer_node_t));
+
+   if(timer->ptimerNode == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Not able to allocate memory for timeNode",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+
+   vos_mem_set(timer->ptimerNode, sizeof(timer_node_t), 0);
+
+    timer->ptimerNode->fileName = fileName;
+    timer->ptimerNode->lineNum   = lineNum;
+    timer->ptimerNode->vosTimer = timer;
+
+    spin_lock_irqsave(&vosTimerList.lock, flags);
+    vosStatus = hdd_list_insert_front(&vosTimerList, &timer->ptimerNode->pNode);
+    spin_unlock_irqrestore(&vosTimerList.lock, flags);
+    if(VOS_STATUS_SUCCESS != vosStatus)
+    {
+         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Unable to insert node into List vosStatus %d\n", __FUNCTION__, vosStatus);
+    }
+   
+   // set the various members of the timer structure 
+   // with arguments passed or with default values
+   spin_lock_init(&timer->platformInfo.spinlock);
+   init_timer(&(timer->platformInfo.Timer));
+   timer->platformInfo.Timer.function = vos_linux_timer_callback;
+   timer->platformInfo.Timer.data = (unsigned long)timer;
+   timer->callback = callback;
+   timer->userData = userData;
+   timer->type = timerType;
+   timer->platformInfo.cookie = LINUX_TIMER_COOKIE;
+   timer->platformInfo.threadID = 0;
+   timer->state = VOS_TIMER_STATE_STOPPED;
+   
+   return VOS_STATUS_SUCCESS;
+}
+#else
+VOS_STATUS vos_timer_init( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData )
+{
+   // Check for invalid pointer
+   if ((timer == NULL) || (callback == NULL)) 
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Null params being passed",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+   
+   // set the various members of the timer structure 
+   // with arguments passed or with default values
+   spin_lock_init(&timer->platformInfo.spinlock);
+   init_timer(&(timer->platformInfo.Timer));
+   timer->platformInfo.Timer.function = vos_linux_timer_callback;
+   timer->platformInfo.Timer.data = (unsigned long)timer;
+   timer->callback = callback;
+   timer->userData = userData;
+   timer->type = timerType;
+   timer->platformInfo.cookie = LINUX_TIMER_COOKIE;
+   timer->platformInfo.threadID = 0;
+   timer->state = VOS_TIMER_STATE_STOPPED;
+   
+   return VOS_STATUS_SUCCESS;
+}
+#endif
+
+
+/*---------------------------------------------------------------------------
+  
+  \brief vos_timer_destroy() - Destroy a vOSS Timer object
+
+  The \a vos_timer_destroy() function shall destroy the timer object.
+  After a successful return from \a vos_timer_destroy() the timer 
+  object becomes, in effect, uninitialized.
+   
+  A destroyed timer object can be re-initialized by calling
+  vos_timer_init().  The results of otherwise referencing the object 
+  after it has been destroyed are undefined.  
+  
+  Calls to vOSS timer functions to manipulate the timer, such
+  as vos_timer_set() will fail if the lock is destroyed.  Therefore, 
+  don't use the timer after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param timer - the timer object to be destroyed.
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully destroyed.
+  
+          VOS_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by timer while it is still 
+          still referenced.  The timer must be stopped before it can be 
+          destroyed.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+---------------------------------------------------------------------------*/
+#ifdef TIMER_MANAGER
+VOS_STATUS vos_timer_destroy ( vos_timer_t *timer )
+{
+   VOS_STATUS vStatus=VOS_STATUS_SUCCESS;
+   unsigned long flags;
+   
+   // Check for invalid pointer
+   if ( NULL == timer )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Null timer pointer being passed",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+       
+   // Check if timer refers to an uninitialized object
+   if ( LINUX_TIMER_COOKIE != timer->platformInfo.cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Cannot destroy uninitialized timer",__FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+   
+   spin_lock_irqsave(&vosTimerList.lock, flags);
+   vStatus = hdd_list_remove_node(&vosTimerList, &timer->ptimerNode->pNode);
+   spin_unlock_irqrestore(&vosTimerList.lock, flags);
+   if(vStatus != VOS_STATUS_SUCCESS)
+   {
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+   vos_mem_free(timer->ptimerNode);
+   
+
+   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
+   
+   switch ( timer->state )
+   {
+      case VOS_TIMER_STATE_STARTING:
+         vStatus = VOS_STATUS_E_BUSY;
+         break;
+      case VOS_TIMER_STATE_RUNNING:
+         /* Stop the timer first */
+         del_timer(&(timer->platformInfo.Timer));
+         vStatus = VOS_STATUS_SUCCESS;
+         break;
+      case VOS_TIMER_STATE_STOPPED:
+         vStatus = VOS_STATUS_SUCCESS;
+         break;
+      case VOS_TIMER_STATE_UNUSED:
+         vStatus = VOS_STATUS_E_ALREADY;
+         break;
+      default:
+         vStatus = VOS_STATUS_E_FAULT;
+         break;
+   }
+
+   if ( VOS_STATUS_SUCCESS == vStatus )
+   {
+      timer->platformInfo.cookie = LINUX_INVALID_TIMER_COOKIE;
+      timer->state = VOS_TIMER_STATE_UNUSED;
+      spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+      return vStatus;
+   }
+
+   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Cannot destroy timer in state = %d",__func__, timer->state);
+   VOS_ASSERT(0);
+
+   return vStatus;   
+}
+
+#else
+VOS_STATUS vos_timer_destroy ( vos_timer_t *timer )
+{
+   VOS_STATUS vStatus=VOS_STATUS_SUCCESS;
+   unsigned long flags;
+   
+   // Check for invalid pointer
+   if ( NULL == timer )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Null timer pointer being passed",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+       
+   // Check if timer refers to an uninitialized object
+   if ( LINUX_TIMER_COOKIE != timer->platformInfo.cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Cannot destroy uninitialized timer",__FUNCTION__);
+      return VOS_STATUS_E_INVAL;
+   }
+   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
+   
+   switch ( timer->state )
+   {
+      case VOS_TIMER_STATE_STARTING:
+         vStatus = VOS_STATUS_E_BUSY;
+         break;
+      case VOS_TIMER_STATE_RUNNING:
+         /* Stop the timer first */
+         del_timer(&(timer->platformInfo.Timer));
+         vStatus = VOS_STATUS_SUCCESS;
+         break;
+      case VOS_TIMER_STATE_STOPPED:
+         vStatus = VOS_STATUS_SUCCESS;
+         break;
+      case VOS_TIMER_STATE_UNUSED:
+         vStatus = VOS_STATUS_E_ALREADY;
+         break;
+      default:
+         vStatus = VOS_STATUS_E_FAULT;
+         break;
+   }
+
+   if ( VOS_STATUS_SUCCESS == vStatus )
+   {
+      timer->platformInfo.cookie = LINUX_INVALID_TIMER_COOKIE;
+      timer->state = VOS_TIMER_STATE_UNUSED;
+      spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+      return vStatus;
+   }
+
+   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+             "%s: Cannot destroy timer in state = %d",__func__, timer->state);
+   VOS_ASSERT(0);
+
+   return vStatus;   
+}
+#endif
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_start() - Start a vOSS Timer object
+
+  The \a vos_timer_start() function starts a timer to expire after the 
+  specified interval, thus running the timer callback function when 
+  the interval expires.
+   
+  A timer only runs once (a one-shot timer).  To re-start the 
+  timer, vos_timer_start() has to be called after the timer runs 
+  or has been cancelled.
+  
+  \param timer - the timer object to be started
+  
+  \param expirationTime - expiration time for the timer (in milliseconds)
+  
+  \return VOS_STATUS_SUCCESS - timer was successfully started.
+  
+          VOS_STATUS_E_ALREADY - The implementation has detected an attempt 
+          to start a timer while it is already started.  The timer must 
+          be stopped or expire before it can be started again.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+  -------------------------------------------------------------------------*/
+VOS_STATUS vos_timer_start( vos_timer_t *timer, v_U32_t expirationTime )
+{
+   unsigned long flags;
+     
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, 
+             "Timer Addr inside voss_start : 0x%p ", timer );
+   
+   // Check for invalid pointer
+   if ( NULL == timer )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s Null timer pointer being passed", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+      
+   // Check if timer refers to an uninitialized object
+   if ( LINUX_TIMER_COOKIE != timer->platformInfo.cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Cannot start uninitialized timer",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Check if timer has expiration time less than 10 ms
+   if ( expirationTime < 10 )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "%s: Cannot start a "
+                "timer with expiration less than 10 ms", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+      
+   // make sure the remainer of the logic isn't interrupted
+   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
+
+   // Ensure if the timer can be started
+   if ( VOS_TIMER_STATE_STOPPED != timer->state )
+   {  
+      spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, 
+                "%s: Cannot start timer in state = %d ",__func__, timer->state);
+      return VOS_STATUS_E_ALREADY;
+   }
+      
+   // Start the timer
+   mod_timer( &(timer->platformInfo.Timer),
+              jiffies + msecs_to_jiffies(expirationTime)); 
+
+   timer->state = VOS_TIMER_STATE_RUNNING;
+
+   // Get the thread ID on which the timer is being started
+   timer->platformInfo.threadID  = current->pid;
+
+   if ( VOS_TIMER_TYPE_WAKE_APPS == timer->type )
+   {
+      persistentTimerCount++;
+      if ( 1 == persistentTimerCount )
+      {
+         // Since we now have one persistent timer, we need to disallow sleep
+         // sleep_negate_okts( sleepClientHandle );
+      }
+   }
+
+   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+  
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_stop() - Stop a vOSS Timer
+
+  The \a vos_timer_stop() function stops a timer that has been started but
+  has not expired, essentially cancelling the 'start' request.
+   
+  After a timer is stopped, it goes back to the state it was in after it
+  was created and can be started again via a call to vos_timer_start().
+  
+  \param timer - the timer object to be stopped
+    
+  \return VOS_STATUS_SUCCESS - timer was successfully stopped.
+  
+          VOS_STATUS_E_EMPTY - The implementation has detected an attempt 
+          to stop a timer that has not been started or has already 
+          expired.
+
+          VOS_STATUS_E_INVAL - The value specified by timer is invalid.
+          
+          VOS_STATUS_E_FAULT  - timer is an invalid pointer.     
+  \sa
+  
+  ------------------------------------------------------------------------*/
+VOS_STATUS vos_timer_stop ( vos_timer_t *timer )
+{
+   unsigned long flags;
+
+   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, 
+               "%s: Timer Addr inside voss_stop : 0x%p",__func__,timer );
+
+   // Check for invalid pointer
+   if ( NULL == timer )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+          "%s Null timer pointer being passed", __func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+
+   // Check if timer refers to an uninitialized object
+   if ( LINUX_TIMER_COOKIE != timer->platformInfo.cookie )
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Cannot stop uninitialized timer",__FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_INVAL;
+   }
+      
+   // Ensure the timer state is correct
+   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
+
+   if ( VOS_TIMER_STATE_RUNNING != timer->state )
+   {
+      spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
+                "%s: Cannot stop timer in state = %d",
+                __func__, timer->state);
+      return VOS_STATUS_E_FAULT;
+   }
+   
+   timer->state = VOS_TIMER_STATE_STOPPED;
+
+   del_timer(&(timer->platformInfo.Timer));
+       
+   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
+      
+   tryAllowingSleep( timer->type );
+   
+   return VOS_STATUS_SUCCESS;
+}
+
+
+/*--------------------------------------------------------------------------
+  
+  \brief vos_timer_get_system_ticks() - Get the system time in 10ms ticks
+
+  The \a vos_timer_get_system_ticks() function returns the current number
+  of timer ticks in 10msec intervals.  This function is suitable timestamping
+  and calculating time intervals by calculating the difference between two 
+  timestamps.
+    
+  \returns - The current system tick count (in 10msec intervals).  This 
+             function cannot fail.
+  
+  \sa
+  
+  ------------------------------------------------------------------------*/
+v_TIME_t vos_timer_get_system_ticks( v_VOID_t )
+{
+   return( jiffies_to_msecs(jiffies) / 10 );
+}
+
+
+/*--------------------------------------------------------------------------
+ 
+  \brief vos_timer_get_system_time() - Get the system time in milliseconds
+
+  The \a vos_timer_get_system_time() function returns the number of milliseconds 
+  that have elapsed since the system was started
+    
+  \returns - The current system time in milliseconds.
+  
+  \sa
+  
+  ------------------------------------------------------------------------*/
+v_TIME_t vos_timer_get_system_time( v_VOID_t )
+{
+   struct timeval tv;
+   do_gettimeofday(&tv);
+   return tv.tv_sec*1000 + tv.tv_usec/1000;  
+}
diff --git a/CORE/VOSS/src/vos_trace.c b/CORE/VOSS/src/vos_trace.c
new file mode 100644
index 0000000..d03bd20
--- /dev/null
+++ b/CORE/VOSS/src/vos_trace.c
@@ -0,0 +1,296 @@
+/*
+ * 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  vos_trace.c
+
+  \brief virtual Operating System Servies (vOS)
+
+   Trace, logging, and debugging definitions and APIs
+
+   Copyright 2008,2011 (c) 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
+  --------    ---    --------------------------------------------------------
+  09/16/08    hvm    Adding ability to set multiple trace levels per component
+  09/11/08    lac    Added trace levels per component.  Cleanup from review.
+  08/14/08    vpai   Particular modules and desired level can be selected
+  06/20/08    vpai   Created Module
+===========================================================================*/
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include <vos_trace.h>
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#define VOS_TRACE_BUFFER_SIZE ( 512 )
+
+// macro to map vos trace levels into the bitmask
+#define VOS_TRACE_LEVEL_TO_MODULE_BITMASK( _level ) ( ( 1 << (_level) ) )
+
+typedef struct
+{
+   // Trace level for a module, as a bitmask.  The bits in this mask
+   // are ordered by VOS_TRACE_LEVEL.  For example, each bit represents
+   // one of the bits in VOS_TRACE_LEVEL that may be turned on to have
+   // traces at that level logged, i.e. if VOS_TRACE_LEVEL_ERROR is
+   // == 2, then if bit 2 (low order) is turned ON, then ERROR traces
+   // will be printed to the trace log.
+   //
+   // Note that all bits turned OFF means no traces.
+   v_U16_t moduleTraceLevel;
+
+   // 3 character string name for the module
+   unsigned char moduleNameStr[ 4 ];   // 3 chars plus the NULL
+
+} moduleTraceInfo;
+
+#define VOS_DEFAULT_TRACE_LEVEL \
+   ((1<<VOS_TRACE_LEVEL_FATAL)|(1<<VOS_TRACE_LEVEL_ERROR))
+
+// Array of static data that contains all of the per module trace
+// information.  This includes the trace level for the module and
+// the 3 character 'name' of the module for marking the trace logs.
+moduleTraceInfo gVosTraceInfo[ VOS_MODULE_ID_MAX ] =
+{
+   [VOS_MODULE_ID_BAP]        = { (1<<VOS_TRACE_LEVEL_FATAL), "BAP" },
+   [VOS_MODULE_ID_TL]         = { (1<<VOS_TRACE_LEVEL_FATAL), "TL " },
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   [VOS_MODULE_ID_BAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "BAL" },
+   [VOS_MODULE_ID_SAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SAL" },
+   [VOS_MODULE_ID_SSC]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SSC" },
+#endif
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   [VOS_MODULE_ID_WDI]        = { (1<<VOS_TRACE_LEVEL_FATAL), "WDI"},
+#endif
+   [VOS_MODULE_ID_HDD]        = { (1<<VOS_TRACE_LEVEL_FATAL), "HDD" },
+   [VOS_MODULE_ID_SME]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SME" },
+   [VOS_MODULE_ID_PE]         = { (1<<VOS_TRACE_LEVEL_FATAL), "PE " },
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+   [VOS_MODULE_ID_HAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "HAL" },
+#else
+   [VOS_MODULE_ID_WDA]        = { (1<<VOS_TRACE_LEVEL_FATAL), "WDA" },
+#endif
+   [VOS_MODULE_ID_SYS]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SYS" },
+   [VOS_MODULE_ID_VOSS]       = { VOS_DEFAULT_TRACE_LEVEL, "VOS" },
+#ifdef WLAN_SOFTAP_FEATURE
+   [VOS_MODULE_ID_SAP]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SAP" },
+   [VOS_MODULE_ID_HDD_SOFTAP] = { (1<<VOS_TRACE_LEVEL_FATAL), "HSP" },
+#endif
+};
+
+
+/*-------------------------------------------------------------------------
+  Functions
+  ------------------------------------------------------------------------*/
+void vos_trace_setLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level )
+{
+   // Make sure the caller is passing in a valid LEVEL.
+   if ( level >= VOS_TRACE_LEVEL_MAX )
+   {
+      pr_err("%s: Invalid trace level %d passed in!\n", __FUNCTION__, level);
+      return;
+   }
+
+   // Treat 'none' differently.  NONE means we have to run off all
+   // the bits in the bit mask so none of the traces appear.  Anything other
+   // than 'none' means we need to turn ON a bit in the bitmask.
+   if ( VOS_TRACE_LEVEL_NONE == level )
+   {
+      gVosTraceInfo[ module ].moduleTraceLevel = VOS_TRACE_LEVEL_NONE;
+   }
+   else
+   {
+      // Set the desired bit in the bit mask for the module trace level.
+      gVosTraceInfo[ module ].moduleTraceLevel |= VOS_TRACE_LEVEL_TO_MODULE_BITMASK( level );
+   }
+}
+
+void vos_trace_setValue( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, v_U8_t on)
+{
+   // Make sure the caller is passing in a valid LEVEL.
+   if ( level < 0  || level >= VOS_TRACE_LEVEL_MAX )
+   {
+      pr_err("%s: Invalid trace level %d passed in!\n", __FUNCTION__, level);
+      return;
+   }
+
+   // Make sure the caller is passing in a valid module.
+   if ( module < 0 || module >= VOS_MODULE_ID_MAX )
+   {
+      pr_err("%s: Invalid module id %d passed in!\n", __FUNCTION__, module);
+      return;
+   }
+
+   // Treat 'none' differently.  NONE means we have to turn off all
+   // the bits in the bit mask so none of the traces appear.
+   if ( VOS_TRACE_LEVEL_NONE == level )
+   {
+      gVosTraceInfo[ module ].moduleTraceLevel = VOS_TRACE_LEVEL_NONE;
+   }
+   // Treat 'All' differently.  All means we have to turn on all
+   // the bits in the bit mask so all of the traces appear.
+   else if ( VOS_TRACE_LEVEL_ALL == level )
+   {
+      gVosTraceInfo[ module ].moduleTraceLevel = 0xFFFF;
+   }
+
+   else
+   {
+      if (on)
+         // Set the desired bit in the bit mask for the module trace level.
+         gVosTraceInfo[ module ].moduleTraceLevel |= VOS_TRACE_LEVEL_TO_MODULE_BITMASK( level );
+      else
+         // Clear the desired bit in the bit mask for the module trace level.
+         gVosTraceInfo[ module ].moduleTraceLevel &= ~(VOS_TRACE_LEVEL_TO_MODULE_BITMASK( level ));
+   }
+}
+
+
+v_BOOL_t vos_trace_getLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level )
+{
+   v_BOOL_t traceOn = VOS_FALSE;
+
+   if ( ( VOS_TRACE_LEVEL_NONE == level ) ||
+        ( VOS_TRACE_LEVEL_ALL  == level ) ||
+        ( level >= VOS_TRACE_LEVEL_MAX  )    )
+   {
+      traceOn = VOS_FALSE;
+   }
+   else
+   {
+      traceOn = ( level & gVosTraceInfo[ module ].moduleTraceLevel ) ? VOS_TRUE : VOS_FALSE;
+   }
+
+   return( traceOn );
+}
+
+void vos_snprintf(char *strBuffer, unsigned  int size, char *strFormat, ...)
+{
+    va_list val;
+
+    va_start( val, strFormat );
+    snprintf (strBuffer, size, strFormat, val);
+    va_end( val );
+}
+
+
+
+#ifdef VOS_ENABLE_TRACING
+
+/*----------------------------------------------------------------------------
+
+  \brief vos_trace_msg() - Externally called trace function
+
+  Checks the level of severity and accordingly prints the trace messages
+
+  \param module - module identifier.   A member of the VOS_MODULE_ID
+         enumeration that identifies the module issuing the trace message.
+
+  \param level - trace level.   A member of the VOS_TRACE_LEVEL
+         enumeration indicating the severity of the condition causing the
+         trace message to be issued.   More severe conditions are more
+         likely to be logged.
+
+  \param strFormat - format string.  The message to be logged.  This format
+         string contains printf-like replacement parameters, which follow
+         this parameter in the variable argument list.
+
+  \return  nothing
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+void vos_trace_msg( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, char *strFormat, ... )
+{
+   char strBuffer[VOS_TRACE_BUFFER_SIZE];
+   int n;
+
+   // Print the trace message when the desired level bit is set in the module
+   // tracel level mask.
+   if ( gVosTraceInfo[ module ].moduleTraceLevel & VOS_TRACE_LEVEL_TO_MODULE_BITMASK( level ) )
+   {
+      // the trace level strings in an array.  these are ordered in the same order
+      // as the trace levels are defined in the enum (see VOS_TRACE_LEVEL) so we
+      // can index into this array with the level and get the right string.  The
+      // vos trace levels are...
+      // none, Fata, Error, Warning, Info, InfoHigh, InfoMed, InfoLow
+      static const char * TRACE_LEVEL_STR[] = { "  ", "F ", "E ", "W ", "I ", "IH", "IM", "IL" };
+      va_list val;
+      va_start(val, strFormat);
+
+      // print the prefix string into the string buffer...
+      n = snprintf(strBuffer, VOS_TRACE_BUFFER_SIZE, "[%d:%d:%2s:%3s] ",
+                   smp_processor_id(),
+                   in_interrupt() ? 0 : current->pid,
+                   (char *) TRACE_LEVEL_STR[ level ],
+                   (char *) gVosTraceInfo[ module ].moduleNameStr );
+
+      // print the formatted log message after the prefix string.
+      vsnprintf(strBuffer + n, VOS_TRACE_BUFFER_SIZE - n, strFormat, val );
+      pr_err("%s\n", strBuffer);
+      va_end( val);
+   }
+}
+
+void vos_trace_display(void)
+{
+   VOS_MODULE_ID moduleId;
+
+   pr_err("     1)FATAL  2)ERROR  3)WARN  4)INFO  5)INFO_H  6)INFO_M  7)INFO_L\n");
+   for (moduleId = 0; moduleId < VOS_MODULE_ID_MAX; ++moduleId)
+   {
+      pr_err("%2d)%s    %s        %s       %s       %s        %s         %s         %s\n",
+             (int)moduleId,
+             gVosTraceInfo[moduleId].moduleNameStr,
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_FATAL)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_ERROR)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_WARN)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_INFO)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_INFO_HIGH)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_INFO_MED)) ? "X":" ",
+             (gVosTraceInfo[moduleId].moduleTraceLevel & (1 << VOS_TRACE_LEVEL_INFO_LOW)) ? "X":" "
+         );
+   }
+}
+
+#endif
diff --git a/CORE/VOSS/src/vos_types.c b/CORE/VOSS/src/vos_types.c
new file mode 100644
index 0000000..fe6aa86
--- /dev/null
+++ b/CORE/VOSS/src/vos_types.c
@@ -0,0 +1,186 @@
+/*
+ * 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  vos_Types.c
+  
+  \brief virtual Operating System Servies (vOS)
+               
+   Basic type definitions 
+  
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/* $Header$ */
+
+/*--------------------------------------------------------------------------
+  Include Files
+  ------------------------------------------------------------------------*/
+#include "vos_types.h"
+#include "vos_trace.h"
+
+//#include "wlan_libra_config.h"
+
+/*-------------------------------------------------------------------------- 
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+  Type declarations
+  ------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_set_U32() - set a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to set.
+  
+  \param value - the value to set in the v_U32_t variable.
+  
+  \return This function returns the value previously in the v_U32_t before
+          the new value is set.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_decrement_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_set_U32( v_U32_t *pTarget, v_U32_t value )
+{
+  v_U32_t oldval;
+  unsigned long flags;
+
+  if (pTarget == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "NULL ptr passed into %s",__FUNCTION__);
+     return 0;
+  }
+  local_irq_save(flags);
+  oldval = *pTarget;
+  *pTarget = value;
+  local_irq_restore(flags);
+  //  v_U32_t prev = atomic_read(pTarget);
+  //  atomic_set(pTarget, value);
+  return oldval;
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_increment_U32() - Increment a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to increment.
+  
+  \return This function returns the value of the variable after the 
+          increment occurs.
+    
+  \sa vos_atomic_decrement_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_increment_U32( v_U32_t *pTarget )
+{
+  unsigned long flags;
+  if (pTarget == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "NULL ptr passed into %s",__FUNCTION__);
+     return 0;
+  }
+  local_irq_save(flags);
+  ++*pTarget; 
+  local_irq_restore(flags);
+  return *pTarget;
+  //  return atomic_inc_return(pTarget);
+}
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief vos_atomic_decrement_U32() - Decrement a U32 variable atomically 
+  
+  \param pTarget - pointer to the v_U32_t to decrement.
+  
+  \return This function returns the value of the variable after the 
+          decrement occurs.
+    
+  \sa vos_atomic_increment_U32(), vos_atomic_set_U32()
+  
+  --------------------------------------------------------------------------*/                                                 
+v_U32_t vos_atomic_decrement_U32( v_U32_t *pTarget )
+{ 
+  unsigned long flags;
+  if (pTarget == NULL)
+  {
+     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "NULL ptr passed into %s",__FUNCTION__);
+     return 0;
+  }
+   // return atomic_dec_return(pTarget);
+   local_irq_save(flags);
+   --*pTarget; 
+   local_irq_restore(flags);
+   return (*pTarget);
+}
+
+v_U32_t vos_atomic_increment_U32_by_value( v_U32_t *pTarget, v_U32_t value )
+{
+   unsigned long flags;
+   if (pTarget == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "NULL ptr passed into %s",__FUNCTION__);
+      return 0;
+   }
+   local_irq_save(flags);
+   *pTarget += value ;
+   local_irq_restore(flags);
+   return (*pTarget);
+}    
+
+v_U32_t vos_atomic_decrement_U32_by_value( v_U32_t *pTarget, v_U32_t value )
+{
+   unsigned long flags;
+   if (pTarget == NULL)
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "NULL ptr passed into %s",__FUNCTION__);
+      return 0;
+   }
+   local_irq_save(flags);
+   *pTarget -= value ;
+   local_irq_restore(flags);
+   return (*pTarget);
+
+}
+
+
+v_U32_t vos_get_skip_ssid_check(void)
+{
+/**This is needed by only AMSS for interoperatability **/
+
+    return 1;
+}    
+
+
+v_U32_t vos_get_skip_11e_check(void)
+{
+    /* this is needed only for AMSS for interopratability **/
+    return 1;
+}    
diff --git a/CORE/VOSS/src/vos_utils.c b/CORE/VOSS/src/vos_utils.c
new file mode 100644
index 0000000..d84c937
--- /dev/null
+++ b/CORE/VOSS/src/vos_utils.c
@@ -0,0 +1,711 @@
+/*
+ * 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:         vos_utils.c
+
+  OVERVIEW:     This source file contains definitions for vOS crypto APIs
+                The four APIs mentioned in this file are used for
+                initializing, and de-initializing a crypto context, and
+                obtaining truly random data (for keys), as well as
+                SHA1 HMAC, and AES encrypt and decrypt routines.
+
+                The routines include:
+                vos_crypto_init() - Initializes Crypto module
+                vos_crypto_deinit() - De-initializes Crypto module
+                vos_rand_get_bytes() - Generates random byte
+                vos_sha1_hmac_str() - Generate the HMAC-SHA1 of a string given a key
+                vos_encrypt_AES() - Generate AES Encrypted byte stream
+                vos_decrypt_AES() - Decrypts an AES Encrypted byte stream
+
+  DEPENDENCIES:
+
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
+============================================================================*/
+
+/*============================================================================
+  EDIT HISTORY FOR MODULE
+
+============================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+
+#include "vos_trace.h"
+#include "vos_utils.h"
+#include "vos_memory.h"
+
+#include <linux/err.h>
+#include <linux/random.h>
+#include <linux/crypto.h>
+#include <linux/scatterlist.h>
+#include <linux/completion.h>
+#include <crypto/hash.h>
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+extern struct crypto_ahash *wcnss_wlan_crypto_alloc_ahash(const char *alg_name,
+                                                          unsigned int type,
+                                                          unsigned int mask);
+
+extern int wcnss_wlan_crypto_ahash_digest(struct ahash_request *req);
+extern void wcnss_wlan_crypto_free_ahash(struct crypto_ahash *tfm);
+extern int wcnss_wlan_crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
+                                          unsigned int keylen);
+extern struct crypto_ablkcipher *wcnss_wlan_crypto_alloc_ablkcipher(const char *alg_name,
+                                                                    u32 type, u32 mask);
+extern void wcnss_wlan_ablkcipher_request_free(struct ablkcipher_request *req);
+extern void wcnss_wlan_crypto_free_ablkcipher(struct crypto_ablkcipher *tfm);
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+   Function Definitions and Documentation
+ * -------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_crypto_init() - Initializes Crypto module
+
+  The vos_crypto_init() function initializes Crypto module.
+
+  \param phCryptProv - pointer to the Crypt handle
+
+  \return VOS_STATUS_SUCCESS - Successfully generated random memory.
+
+          VOS_STATUS_E_FAULT  - pbBuf is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable
+  \sa
+
+    ( *** return value not considered yet )
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_crypto_init( v_U32_t *phCryptProv )
+{
+    VOS_STATUS uResult = VOS_STATUS_E_FAILURE;
+
+    // This implementation doesn't require a crypto context
+    *phCryptProv  = (v_U32_t)NULL;
+    uResult = VOS_STATUS_SUCCESS;
+    return ( uResult );
+}
+
+VOS_STATUS vos_crypto_deinit( v_U32_t hCryptProv )
+{
+    VOS_STATUS uResult = VOS_STATUS_E_FAILURE;
+
+    // CryptReleaseContext succeeded
+    uResult = VOS_STATUS_SUCCESS;
+
+    return ( uResult );
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_rand_get_bytes() - Generates random byte
+
+  The vos_rand_get_bytes() function generate random bytes.
+
+  Buffer should be allocated before calling vos_rand_get_bytes().
+
+  Attempting to initialize an already initialized lock results in
+  a failure.
+
+  \param lock - pointer to the opaque lock object to initialize
+
+  \return VOS_STATUS_SUCCESS - Successfully generated random memory.
+
+          VOS_STATUS_E_FAULT  - pbBuf is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable
+  \sa
+
+    ( *** return value not considered yet )
+  --------------------------------------------------------------------------*/
+VOS_STATUS vos_rand_get_bytes( v_U32_t cryptHandle, v_U8_t *pbBuf, v_U32_t numBytes )
+{
+   VOS_STATUS uResult = VOS_STATUS_E_FAILURE;
+   //v_UINT_t uCode;
+//   HCRYPTPROV hCryptProv = (HCRYPTPROV) cryptHandle;
+
+   //check for invalid pointer
+   if ( NULL == pbBuf )
+   {
+      uResult = VOS_STATUS_E_FAULT;
+      return ( uResult );
+   }
+
+//#if 0
+   // get_random_bytes() is a void procedure
+   get_random_bytes( pbBuf, numBytes);
+   // "Random sequence generated."
+   uResult = VOS_STATUS_SUCCESS;
+//#endif
+
+   return ( uResult );
+}
+
+
+/**
+ * vos_sha1_hmac_str
+ *
+ * FUNCTION:
+ * Generate the HMAC-SHA1 of a string given a key.
+ *
+ * LOGIC:
+ * Standard HMAC processing from RFC 2104. The code is provided in the
+ * appendix of the RFC.
+ *
+ * ASSUMPTIONS:
+ * The RFC is correct.
+ *
+ * @param text text to be hashed
+ * @param textLen length of text
+ * @param key key to use for HMAC
+ * @param keyLen length of key
+ * @param digest holds resultant SHA1 HMAC (20B)
+ *
+ * @return VOS_STATUS_SUCCSS if the operation succeeds
+ *
+ */
+
+struct hmac_sha1_result {
+    struct completion completion;
+    int err;
+};
+
+static void hmac_sha1_complete(struct crypto_async_request *req, int err)
+{
+    struct hmac_sha1_result *r = req->data;
+    if (err == -EINPROGRESS)
+        return;
+    r->err = err;
+    complete(&r->completion);
+}
+
+int hmac_sha1(v_U8_t *key, v_U8_t ksize, char *plaintext, v_U8_t psize,
+              v_U8_t *output, v_U8_t outlen)
+{
+    int ret = 0;
+    struct crypto_ahash *tfm;
+    struct scatterlist sg;
+    struct ahash_request *req;
+    struct hmac_sha1_result tresult;
+    void *hash_buff = NULL;
+
+    unsigned char hash_result[64];
+    int i;
+
+    memset(output, 0, outlen);
+
+    init_completion(&tresult.completion);
+
+    tfm = wcnss_wlan_crypto_alloc_ahash("hmac(sha1)", CRYPTO_ALG_TYPE_AHASH,
+                                        CRYPTO_ALG_TYPE_AHASH_MASK);
+    if (IS_ERR(tfm)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_alloc_ahash failed");
+        ret = PTR_ERR(tfm);
+        goto err_tfm;
+    }
+
+    req = ahash_request_alloc(tfm, GFP_KERNEL);
+    if (!req) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "failed to allocate request for hmac(sha1)");
+        ret = -ENOMEM;
+        goto err_req;
+    }
+
+    ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+                               hmac_sha1_complete, &tresult);
+
+    hash_buff = kzalloc(psize, GFP_KERNEL);
+    if (!hash_buff) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "failed to kzalloc hash_buff");
+        ret = -ENOMEM;
+        goto err_hash_buf;
+    }
+
+    memset(hash_result, 0, 64);
+    memcpy(hash_buff, plaintext, psize);
+    sg_init_one(&sg, hash_buff, psize);
+
+    if (ksize) {
+        crypto_ahash_clear_flags(tfm, ~0);
+        ret = wcnss_wlan_crypto_ahash_setkey(tfm, key, ksize);
+
+        if (ret) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_ahash_setkey failed");
+            goto err_setkey;
+        }
+    }
+
+    ahash_request_set_crypt(req, &sg, hash_result, psize);
+    ret = wcnss_wlan_crypto_ahash_digest(req);
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "ret 0x%x");
+
+    switch (ret) {
+    case 0:
+        for (i=0; i< outlen; i++)
+            output[i] = hash_result[i];
+        break;
+    case -EINPROGRESS:
+    case -EBUSY:
+        ret = wait_for_completion_interruptible(&tresult.completion);
+        if (!ret && !tresult.err) {
+            INIT_COMPLETION(tresult.completion);
+            break;
+        } else {
+            VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "wait_for_completion_interruptible failed");
+            if (!ret)
+                ret = tresult.err;
+            goto out;
+        }
+    default:
+        goto out;
+    }
+
+out:
+err_setkey:
+    kfree(hash_buff);
+err_hash_buf:
+    ahash_request_free(req);
+err_req:
+    wcnss_wlan_crypto_free_ahash(tfm);
+err_tfm:
+    return ret;
+}
+
+VOS_STATUS vos_sha1_hmac_str(v_U32_t cryptHandle, /* Handle */
+           v_U8_t *pText, /* pointer to data stream */
+           v_U32_t textLen, /* length of data stream */
+           v_U8_t *pKey, /* pointer to authentication key */
+           v_U32_t keyLen, /* length of authentication key */
+           v_U8_t digest[VOS_DIGEST_SHA1_SIZE])/* caller digest to be filled in */
+{
+    int ret = 0;
+
+    ret = hmac_sha1(
+            pKey,                   //v_U8_t *key,
+            (v_U8_t) keyLen,        //v_U8_t ksize,
+            (char *)pText,          //char *plaintext,
+            (v_U8_t) textLen,       //v_U8_t psize,
+            digest,                 //v_U8_t *output,
+            VOS_DIGEST_SHA1_SIZE    //v_U8_t outlen
+            );
+
+    if (ret != 0) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR,"hmac_sha1() call failed");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/**
+ * vos_md5_hmac_str
+ *
+ * FUNCTION:
+ * Generate the HMAC-MD5 of a string given a key.
+ *
+ * LOGIC:
+ * Standard HMAC processing from RFC 2104. The code is provided in the
+ * appendix of the RFC.
+ *
+ * ASSUMPTIONS:
+ * The RFC is correct.
+ *
+ * @param text text to be hashed
+ * @param textLen length of text
+ * @param key key to use for HMAC
+ * @param keyLen length of key
+ * @param digest holds resultant MD5 HMAC (20B)
+ *
+ * @return VOS_STATUS_SUCCSS if the operation succeeds
+ *
+ */
+struct hmac_md5_result {
+    struct completion completion;
+    int err;
+};
+
+static void hmac_md5_complete(struct crypto_async_request *req, int err)
+{
+    struct hmac_md5_result *r = req->data;
+    if (err == -EINPROGRESS)
+            return;
+    r->err = err;
+    complete(&r->completion);
+}
+
+int hmac_md5(v_U8_t *key, v_U8_t ksize, char *plaintext, v_U8_t psize,
+                v_U8_t *output, v_U8_t outlen)
+{
+    int ret = 0;
+    struct crypto_ahash *tfm;
+    struct scatterlist sg;
+    struct ahash_request *req;
+    struct hmac_md5_result tresult;
+    void *hash_buff = NULL;
+
+    unsigned char hash_result[64];
+    int i;
+
+    memset(output, 0, outlen);
+
+    init_completion(&tresult.completion);
+
+    tfm = wcnss_wlan_crypto_alloc_ahash("hmac(md5)", CRYPTO_ALG_TYPE_AHASH,
+                                        CRYPTO_ALG_TYPE_AHASH_MASK);
+    if (IS_ERR(tfm)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_alloc_ahash failed");
+                ret = PTR_ERR(tfm);
+                goto err_tfm;
+    }
+
+    req = ahash_request_alloc(tfm, GFP_KERNEL);
+    if (!req) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "failed to allocate request for hmac(md5)");
+        ret = -ENOMEM;
+        goto err_req;
+    }
+
+    ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+                                        hmac_md5_complete, &tresult);
+
+    hash_buff = kzalloc(psize, GFP_KERNEL);
+    if (!hash_buff) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "failed to kzalloc hash_buff");
+        ret = -ENOMEM;
+        goto err_hash_buf;
+    }
+
+    memset(hash_result, 0, 64);
+    memcpy(hash_buff, plaintext, psize);
+    sg_init_one(&sg, hash_buff, psize);
+
+    if (ksize) {
+        crypto_ahash_clear_flags(tfm, ~0);
+        ret = wcnss_wlan_crypto_ahash_setkey(tfm, key, ksize);
+
+        if (ret) {
+            VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_ahash_setkey failed");
+            goto err_setkey;
+        }
+    }
+
+    ahash_request_set_crypt(req, &sg, hash_result, psize);
+    ret = wcnss_wlan_crypto_ahash_digest(req);
+
+    VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "ret 0x%x");
+
+    switch (ret) {
+        case 0:
+            for (i=0; i< outlen; i++)
+                    output[i] = hash_result[i];
+            break;
+        case -EINPROGRESS:
+        case -EBUSY:
+             ret = wait_for_completion_interruptible(&tresult.completion);
+             if (!ret && !tresult.err) {
+                  INIT_COMPLETION(tresult.completion);
+                  break;
+             } else {
+                 VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "wait_for_completion_interruptible failed");
+                 if (!ret)
+                     ret = tresult.err;
+                 goto out;
+             }
+        default:
+              goto out;
+        }
+
+out:
+err_setkey:
+        kfree(hash_buff);
+err_hash_buf:
+        ahash_request_free(req);
+err_req:
+        wcnss_wlan_crypto_free_ahash(tfm);
+err_tfm:
+        return ret;
+}
+
+VOS_STATUS vos_md5_hmac_str(v_U32_t cryptHandle, /* Handle */
+           v_U8_t *pText, /* pointer to data stream */
+           v_U32_t textLen, /* length of data stream */
+           v_U8_t *pKey, /* pointer to authentication key */
+           v_U32_t keyLen, /* length of authentication key */
+           v_U8_t digest[VOS_DIGEST_MD5_SIZE])/* caller digest to be filled in */
+{
+    int ret = 0;
+
+    ret = hmac_md5(
+            pKey,                   //v_U8_t *key,
+            (v_U8_t) keyLen,        //v_U8_t ksize,
+            (char *)pText,          //char *plaintext,
+            (v_U8_t) textLen,       //v_U8_t psize,
+            digest,                 //v_U8_t *output,
+            VOS_DIGEST_MD5_SIZE     //v_U8_t outlen
+            );
+
+    if (ret != 0) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR,"hmac_md5() call failed");
+        return VOS_STATUS_E_FAULT;
+    }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+
+struct ecb_aes_result {
+    struct completion completion;
+    int err;
+};
+
+static void ecb_aes_complete(struct crypto_async_request *req, int err)
+{
+    struct ecb_aes_result *r = req->data;
+    if (err == -EINPROGRESS)
+        return;
+    r->err = err;
+    complete(&r->completion);
+}
+
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_encrypt_AES() - Generate AES Encrypted byte stream
+
+  The vos_encrypt_AES() function generates the encrypted byte stream for given text.
+
+  Buffer should be allocated before calling vos_rand_get_bytes().
+
+  Attempting to initialize an already initialized lock results in
+  a failure.
+
+  \param lock - pointer to the opaque lock object to initialize
+
+  \return VOS_STATUS_SUCCESS - Successfully generated random memory.
+
+          VOS_STATUS_E_FAULT  - pbBuf is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable
+  \sa
+
+    ( *** return value not considered yet )
+  --------------------------------------------------------------------------*/
+
+#define IV_SIZE_AES_128 16
+#define KEY_SIZE_AES_128 16
+#define AES_BLOCK_SIZE 16
+
+VOS_STATUS vos_encrypt_AES(v_U32_t cryptHandle, /* Handle */
+                           v_U8_t *pPlainText, /* pointer to data stream */
+                           v_U8_t *pCiphertext,
+                           v_U8_t *pKey) /* pointer to authentication key */
+{
+//    VOS_STATUS uResult = VOS_STATUS_E_FAILURE;
+    struct ecb_aes_result result;
+    struct ablkcipher_request *req;
+    struct crypto_ablkcipher *tfm;
+    int ret = 0;
+    char iv[IV_SIZE_AES_128];
+    struct scatterlist sg_in;
+    struct scatterlist sg_out;
+
+    init_completion(&result.completion);
+
+    tfm =  wcnss_wlan_crypto_alloc_ablkcipher( "cbc(aes)", 0, 0);
+    if (IS_ERR(tfm)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_alloc_ablkcipher failed");
+        ret = PTR_ERR(tfm);
+        goto err_tfm;
+    }
+
+    req = ablkcipher_request_alloc(tfm, GFP_KERNEL);
+    if (!req) {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Failed to allocate request for cbc(aes)");
+        ret = -ENOMEM;
+        goto err_req;
+    }
+
+    ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+                                    ecb_aes_complete, &result);
+
+
+    crypto_ablkcipher_clear_flags(tfm, ~0);
+
+    ret = crypto_ablkcipher_setkey(tfm, pKey, KEY_SIZE_AES_128);
+    if (ret) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_cipher_setkey failed");
+        goto err_setkey;
+    }
+
+    memset(iv, 0, IV_SIZE_AES_128);
+
+    sg_init_one(&sg_in, pPlainText, AES_BLOCK_SIZE);
+
+    sg_init_one(&sg_out, pCiphertext, AES_BLOCK_SIZE);
+
+    ablkcipher_request_set_crypt(req, &sg_in, &sg_out, AES_BLOCK_SIZE, iv);
+
+    crypto_ablkcipher_encrypt(req);
+
+
+
+// -------------------------------------
+err_setkey:
+    wcnss_wlan_ablkcipher_request_free(req);
+err_req:
+    wcnss_wlan_crypto_free_ablkcipher(tfm);
+err_tfm:
+    //return ret;
+    if (ret != 0) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR,"%s() call failed", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+   }
+
+    return VOS_STATUS_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------
+
+  \brief vos_decrypt_AES() - Decrypts an AES Encrypted byte stream
+
+  The vos_decrypt_AES() function decrypts the encrypted byte stream.
+
+  Buffer should be allocated before calling vos_rand_get_bytes().
+
+  Attempting to initialize an already initialized lock results in
+  a failure.
+
+  \param lock - pointer to the opaque lock object to initialize
+
+  \return VOS_STATUS_SUCCESS - Successfully generated random memory.
+
+          VOS_STATUS_E_FAULT  - pbBuf is an invalid pointer.
+
+          VOS_STATUS_E_FAILURE - default return value if it fails due to
+          unknown reasons
+
+       ***VOS_STATUS_E_RESOURCES - System resources (other than memory)
+          are unavailable
+  \sa
+
+    ( *** return value not considered yet )
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS vos_decrypt_AES(v_U32_t cryptHandle, /* Handle */
+                           v_U8_t *pText, /* pointer to data stream */
+                           v_U8_t *pDecrypted,
+                           v_U8_t *pKey) /* pointer to authentication key */
+{
+//    VOS_STATUS uResult = VOS_STATUS_E_FAILURE;
+    struct ecb_aes_result result;
+    struct ablkcipher_request *req;
+    struct crypto_ablkcipher *tfm;
+    int ret = 0;
+    char iv[IV_SIZE_AES_128];
+    struct scatterlist sg_in;
+    struct scatterlist sg_out;
+
+    init_completion(&result.completion);
+
+    tfm =  wcnss_wlan_crypto_alloc_ablkcipher( "cbc(aes)", 0, 0);
+    if (IS_ERR(tfm)) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_alloc_ablkcipher failed");
+        ret = PTR_ERR(tfm);
+        goto err_tfm;
+    }
+
+    req = ablkcipher_request_alloc(tfm, GFP_KERNEL);
+    if (!req) {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Failed to allocate request for cbc(aes)");
+        ret = -ENOMEM;
+        goto err_req;
+    }
+
+    ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+                                    ecb_aes_complete, &result);
+
+
+    crypto_ablkcipher_clear_flags(tfm, ~0);
+
+    ret = crypto_ablkcipher_setkey(tfm, pKey, KEY_SIZE_AES_128);
+    if (ret) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "crypto_cipher_setkey failed");
+        goto err_setkey;
+       }
+
+    memset(iv, 0, IV_SIZE_AES_128);
+
+    sg_init_one(&sg_in, pText, AES_BLOCK_SIZE);
+
+    sg_init_one(&sg_out, pDecrypted, AES_BLOCK_SIZE);
+
+    ablkcipher_request_set_crypt(req, &sg_in, &sg_out, AES_BLOCK_SIZE, iv);
+
+    crypto_ablkcipher_decrypt(req);
+
+
+
+// -------------------------------------
+err_setkey:
+    wcnss_wlan_ablkcipher_request_free(req);
+err_req:
+    wcnss_wlan_crypto_free_ablkcipher(tfm);
+err_tfm:
+    //return ret;
+    if (ret != 0) {
+        VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR,"%s() call failed", __FUNCTION__);
+        return VOS_STATUS_E_FAULT;
+      }
+
+    return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/WDA/inc/legacy/halMsgApi.h b/CORE/WDA/inc/legacy/halMsgApi.h
new file mode 100644
index 0000000..ffeadf3
--- /dev/null
+++ b/CORE/WDA/inc/legacy/halMsgApi.h
@@ -0,0 +1,1333 @@
+/*
+ * 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 _HALMSGAPI_H_
+#define _HALMSGAPI_H_
+
+#include "halTypes.h"
+#include "sirApi.h"
+#include "sirParams.h"
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halPhy.h"
+#include "halPhyApi.h"
+#endif
+
+#define HAL_NUM_BSSID 2
+/* operMode in ADD BSS message */
+#define BSS_OPERATIONAL_MODE_AP     0
+#define BSS_OPERATIONAL_MODE_STA    1
+
+/* STA entry type in add sta message */
+#define STA_ENTRY_SELF              0
+#define STA_ENTRY_OTHER             1
+#define STA_ENTRY_BSSID             2
+#define STA_ENTRY_BCAST             3 //Special station id for transmitting broadcast frames.
+#define STA_ENTRY_PEER              STA_ENTRY_OTHER
+
+#define STA_ENTRY_TRANSMITTER       STA_ENTRY_SELF
+#define STA_ENTRY_RECEIVER          STA_ENTRY_OTHER
+
+#define HAL_STA_INVALID_IDX 0xFF
+#define HAL_BSS_INVALID_IDX 0xFF
+
+#define HAL_BSSPERSONA_INVALID_IDX 0xFF
+
+#define WLAN_BSS_PROTECTION_ON  1
+#define WLAN_BSS_PROTECTION_OFF 0
+
+/* Station index allocation after Broadcast station */
+#define HAL_MAX_NUM_BCAST_STATIONS      1
+#define HAL_MIN_BCAST_STA_INDEX     ((HAL_MAX_NUM_BCAST_STATIONS>0)?0:HAL_STA_INVALID_IDX)
+#define HAL_MAX_BCAST_STA_INDEX     ((HAL_MAX_NUM_BCAST_STATIONS>0)?(HAL_MAX_NUM_BCAST_STATIONS - 1):HAL_STA_INVALID_IDX)
+#define HAL_MIN_STA_INDEX           ((HAL_MAX_BCAST_STA_INDEX!=HAL_STA_INVALID_IDX)?(HAL_MAX_BCAST_STA_INDEX+1):0)
+#define HAL_MAX_STA_INDEX           (HAL_NUM_STA)
+
+/* Compilation flags for enabling disabling selfSta and bcastSta per BSS */
+#define HAL_SELF_STA_PER_BSS        1
+#define HAL_BCAST_STA_PER_BSS       1
+
+//invalid channel id.
+#define HAL_INVALID_CHANNEL_ID 0
+
+/* BSS index used when no BSS is associated with the station. For example,
+ * driver creates only one self station without valid BSS while scanning.
+ * Then this index is used to tell softmac that BSS is not valid.
+ */
+#define BSSIDX_INVALID             254
+
+#define HAL_IS_VALID_BSS_INDEX(pMac, bssIdx)  ((BSSIDX_INVALID != (bssIdx)) && ((bssIdx) < (pMac)->hal.memMap.maxBssids))
+
+// Beacon structure
+typedef __ani_attr_pre_packed struct sAniBeaconStruct
+{
+    tANI_U32        beaconLength;   // Indicates the beacon length
+    tSirMacMgmtHdr  macHdr;         // MAC Header for beacon
+    // Beacon body follows here
+} __ani_attr_packed tAniBeaconStruct, *tpAniBeaconStruct;
+
+// probeRsp template structure
+typedef __ani_attr_pre_packed struct sAniProbeRspStruct
+{
+    tSirMacMgmtHdr  macHdr;         // MAC Header for probeRsp
+    // probeRsp body follows here
+} __ani_attr_packed tAniProbeRspStruct, *tpAniProbeRspStruct;
+
+
+// Per TC parameters
+typedef struct
+{
+    tANI_U8 disableTx;
+    tANI_U8 disableRx;
+    tANI_U8 rxCompBA;              // 1: expect to see frames with compressed BA coming from this peer MAC
+    tANI_U8 rxBApolicy;            // immediate ACK or delayed ACK for frames from this peer MAC
+    tANI_U8 txCompBA;              // 1: using compressed BA to send to this peer MAC
+    tANI_U8 txBApolicy;            // immediate ACK or delayed ACK for frames to this peer MAC
+    tANI_U8 rxUseBA;
+    tANI_U8 txUseBA;
+    tANI_U8 rxBufferSize;
+    tANI_U8 txBufferSize;
+    tANI_U16 txBAWaitTimeout;
+    tANI_U16 rxBAWaitTimeout;
+} tTCParams;
+
+
+typedef enum eRxpMode {
+    eRXP_IDLE_MODE        = 0x0,
+    eRXP_SCAN_MODE        = 0x1,
+    eRXP_PRE_ASSOC_MODE   = 0x2,
+    eRXP_POST_ASSOC_MODE  = 0x4,
+    eRXP_AP_MODE          = 0x8,
+    eRXP_PROMISCUOUS_MODE = 0x10,
+    eRXP_LEARN_MODE       = 0x20,
+    eRXP_POWER_SAVE_MODE  = 0x40,
+    eRXP_IBSS_MODE        = 0x80,
+    eRXP_BTAMP_PREASSOC_MODE    = 0x100,
+    eRXP_BTAMP_POSTASSOC_MODE   = 0x200,
+    eRXP_BTAMP_AP_MODE          = 0x400,
+    eRXP_BTAMP_STA_MODE         = 0x800,
+    eRXP_MULTI_BSS_MODE         = 0x1000
+#ifndef WLAN_FTM_STUB
+    ,eRXP_FTM_MODE         = 0x4000
+#endif
+   ,eRXP_LISTEN_MODE      = 0x8000
+} tRxpMode;
+
+
+typedef struct
+{
+    // First two fields bssid and assocId are used to find staid for sta.
+    // BSSID of STA
+    tSirMacAddr bssId;
+
+    // ASSOC ID, as assigned by PE/LIM. This needs to be assigned
+    // on a per BSS basis
+    tANI_U16 assocId;
+
+    // Field to indicate if this is sta entry for itself STA adding entry for itself
+    // or remote (AP adding STA after successful association.
+    // This may or may not be required in production driver.
+    tANI_U8 staType;       // 0 - Self, 1 other/remote, 2 - bssid
+
+    tANI_U8 shortPreambleSupported;
+
+    // MAC Address of STA
+    tSirMacAddr staMac;
+
+    // Listen interval.
+    tANI_U16 listenInterval;
+
+    // Support for 11e/WMM
+    tANI_U8 wmmEnabled;
+
+    //
+    // U-APSD Flags: 1b per AC
+    // Encoded as follows:
+    // b7 b6 b5 b4 b3 b2 b1 b0
+    // X  X  X  X  BE BK VI VO
+    //
+    tANI_U8 uAPSD;
+
+    // Max SP Length
+    tANI_U8 maxSPLen;
+
+    // 11n HT capable STA
+    tANI_U8 htCapable;
+
+    // 11n Green Field preamble support
+    // 0 - Not supported, 1 - Supported
+    // Add it to RA related fields of sta entry in HAL
+    tANI_U8 greenFieldCapable;
+
+    // TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz
+    tANI_U8 txChannelWidthSet;
+
+    // MIMO Power Save
+    tSirMacHTMIMOPowerSaveState mimoPS;
+
+    // RIFS mode: 0 - NA, 1 - Allowed
+    tANI_U8 rifsMode;
+
+    // L-SIG TXOP Protection mechanism
+    // 0 - No Support, 1 - Supported
+    // SG - there is global field.
+    tANI_U8 lsigTxopProtection;
+
+    // delayed ba support
+    tANI_U8 delBASupport;
+    // delayed ba support... TBD
+
+#ifdef ANI_DVT_DEBUG
+    //These 6 fields are used only by DVT driver to pass selected
+    //rates to Softmac through HAL.
+    tANI_U8 primaryRateIndex, secondaryRateIndex, tertiaryRateIndex;
+    tANI_U8 primaryRateIndex40, secondaryRateIndex40, tertiaryRateIndex40;
+#endif
+
+    // FIXME
+    //Add these fields to message
+    tANI_U8 us32MaxAmpduDuration;                //in units of 32 us.
+    tANI_U8 maxAmpduSize;                        // 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k
+    tANI_U8 maxAmpduDensity;                     // 3 : 0~7 : 2^(11nAMPDUdensity -4)
+    tANI_U8 maxAmsduSize;                        // 1 : 3839 bytes, 0 : 7935 bytes
+
+    // TC parameters
+    tTCParams staTCParams[STACFG_MAX_TC];
+
+    // Compression and Concat parameters for DPU
+    tANI_U16 deCompEnable;
+    tANI_U16 compEnable;
+    tANI_U16 concatSeqRmv;
+    tANI_U16 concatSeqIns;
+
+
+    //11n Parameters
+
+    /**
+      HT STA should set it to 1 if it is enabled in BSS
+      HT STA should set it to 0 if AP does not support it.
+      This indication is sent to HAL and HAL uses this flag
+      to pickup up appropriate 40Mhz rates.
+      */
+    tANI_U8 fDsssCckMode40Mhz;
+
+
+    //short GI support for 40Mhz packets
+    tANI_U8 fShortGI40Mhz;
+
+    //short GI support for 20Mhz packets
+    tANI_U8 fShortGI20Mhz;
+
+
+
+    /*
+     * All the legacy and airgo supported rates.
+     * These rates are the intersection of peer and self capabilities.
+     */
+    tSirSupportedRates supportedRates;
+
+
+
+
+
+    /*
+     * Following parameters are for returning status and station index from HAL to PE
+     * via response message. HAL does not read them.
+     */
+    // The return status of SIR_HAL_ADD_STA_REQ is reported here
+    eHalStatus status;
+    // Station index; valid only when 'status' field value is eHAL_STATUS_SUCCESS
+    tANI_U8 staIdx;
+
+    //BSSID of BSS to which the station is associated.
+    //This should be filled back in by HAL, and sent back to LIM as part of
+    //the response message, so LIM can cache it in the station entry of hash table.
+    //When station is deleted, LIM will make use of this bssIdx to delete
+    //BSS from hal tables and from softmac.
+    tANI_U8 bssIdx;
+
+    /* this requires change in testDbg. I will change it later after coordinating with Diag team.
+       tANI_U8 fFwdTrigerSOSPtoHost; //trigger to start service period
+       tANI_U8 fFwdTrigerEOSPtoHost; //trigger to end service period
+       */
+
+   //HAL should update the existing STA entry, if this flag is set.
+   //PE will set this flag in case of reassoc, where we want to resue the
+   //the old staID and still return success.
+    tANI_U8 updateSta;
+    //A flag to indicate to HAL if the response message is required.
+    tANI_U8 respReqd;
+
+    /* Robust Management Frame (RMF) enabled/disabled */
+    tANI_U8 rmfEnabled;
+
+    /* The unicast encryption type in the association */
+    tANI_U32 encryptType;
+    
+    /*The DPU signatures will be sent eventually to TL to help it determine the 
+      association to which a packet belongs to*/
+    /*Unicast DPU index*/
+    tANI_U8     ucUcastSig;
+
+    /*Broadcast DPU index*/
+    tANI_U8     ucBcastSig;
+
+    tANI_U8     sessionId; //PE session id for PE<->HAL interface 
+    // HAL just sends back what it receives.
+
+#ifdef WLAN_FEATURE_P2P
+    /*if this is a P2P Capable Sta*/
+    tANI_U8     p2pCapableSta;
+#endif
+
+} tAddStaParams, *tpAddStaParams;
+
+
+typedef struct
+{
+    // Station index
+    tANI_U16 staIdx;
+    tANI_U16 templIdx;
+    tANI_U8   rateIdx;
+
+    // The return status of SIR_HAL_UPDATE_STARATEINFO_REQ is reported here
+    eHalStatus status;
+
+    //A flag to indicate to HAL if the response message is required.
+    tANI_U8 respReqd;
+
+} tUpdateTxCmdTemplParams, *tpUpdateTxCmdTemplParams;
+//FIXME: change the structure name
+
+
+
+
+
+
+
+
+typedef struct
+{
+    // index of STA to delete - this should be the same as the index returned
+    // as part of the AddSta
+    tANI_U16 staIdx;
+    tANI_U16 assocId;
+    eHalStatus  status;    // Status of SIR_HAL_DELETE_STA_REQ is reported here
+    tANI_U8 respReqd;
+    tANI_U8     sessionId; // PE session id for PE<->HAL interface 
+    // PE session id now added to all HAL<->PE transacations
+    // HAL sends it back unmodified.
+} tDeleteStaParams, * tpDeleteStaParams;
+
+/*
+ * This is used by PE to configure the key information on a given station.
+ * When the secType is WEP40 or WEP104, the defWEPIdx is used to locate
+ * a preconfigured key from a BSS the station assoicated with; otherwise
+ * a new key descriptor is created based on the key field.
+ */
+typedef struct
+{
+    tANI_U16        staIdx;
+    tAniEdType      encType;        // Encryption/Decryption type
+    tAniWepType     wepType;        // valid only for WEP
+    tANI_U8         defWEPIdx;      // Default WEP key, valid only for static WEP, must between 0 and 3
+#ifdef WLAN_SOFTAP_FEATURE
+    tSirKeys        key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS];            // valid only for non-static WEP encyrptions
+#else
+    tSirKeys        key;
+#endif
+    tANI_U8         singleTidRc;    // 1=Single TID based Replay Count, 0=Per TID based RC
+    /*
+     * Following parameter is for returning status
+     * via response message. HAL does not read them.
+     */
+    eHalStatus  status;    // status of SIR_HAL_SET_STAKEY_REQ is reported here
+    tANI_U8     sessionId; // PE session id for PE<->HAL interface 
+
+    // PE session id now added to all HAL<->PE transacations
+    // HAL sends back response with no modification
+} tSetStaKeyParams, *tpSetStaKeyParams;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_ADD_BSS_REQ
+//
+typedef struct
+{
+    // MAC Address/BSSID
+    tSirMacAddr bssId;
+#ifdef HAL_SELF_STA_PER_BSS
+    // Self Mac Address
+    tSirMacAddr  selfMacAddr;
+#endif
+    // BSS type
+    // FIXME - Is this reqd? Do we want to isolate BSS/IBSS parameters?
+    tSirBssType bssType;
+
+    // AP - 0; STA - 1 ;
+    tANI_U8 operMode;
+
+    // Network type - b/g/a/MixedMode/GreenField/Legacy
+    // TODO - This enum to be updated for HT support
+    // Review FIXME - Why is this needed?
+    tSirNwType nwType;
+
+    tANI_U8 shortSlotTimeSupported;
+    tANI_U8 llaCoexist;
+    tANI_U8 llbCoexist;
+    tANI_U8 llgCoexist;
+    tANI_U8 ht20Coexist;
+    tANI_U8 llnNonGFCoexist;
+    tANI_U8 fLsigTXOPProtectionFullSupport;
+    tANI_U8 fRIFSMode;
+
+    // Beacon Interval
+    tSirMacBeaconInterval beaconInterval;
+
+    // DTIM period
+    tANI_U8 dtimPeriod;
+
+    // CF Param Set
+    // Review FIXME - Does HAL need this?
+    tSirMacCfParamSet cfParamSet;
+
+    // MAC Rate Set
+    // Review FIXME - Does HAL need this?
+    tSirMacRateSet rateSet;
+
+    // 802.11n related HT parameters that are dynamic
+
+    // Enable/Disable HT capabilities
+    tANI_U8 htCapable;
+
+    // Enable/Disable OBSS protection
+    tANI_U8 obssProtEnabled;
+
+    // RMF enabled/disabled
+    tANI_U8 rmfEnabled;
+
+    // HT Operating Mode
+    // Review FIXME - Does HAL need this?
+    tSirMacHTOperatingMode htOperMode;
+
+    // Dual CTS Protection: 0 - Unused, 1 - Used
+    tANI_U8 dualCTSProtection;
+
+    // TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz
+    tANI_U8 txChannelWidthSet;
+
+    // Current Operating Channel
+    tANI_U8 currentOperChannel;
+
+    // Current Extension Channel, if applicable
+    tANI_U8 currentExtChannel;
+
+    // Add a STA entry for "itself" -
+    // On AP  - Add the AP itself in an "STA context"
+    // On STA - Add the AP to which this STA is joining in an "STA context"
+    tAddStaParams staContext;
+
+    /*
+    * Following parameters are for returning status and station index from HAL to PE
+    * via response message. HAL does not read them.
+    */
+    // The return status of SIR_HAL_ADD_BSS_REQ is reported here
+    eHalStatus status;
+    // BSS index allocated by HAL.
+    // valid only when 'status' field is eHAL_STATUS_SUCCESS
+    tANI_U16 bssIdx;
+
+    // Broadcast DPU descriptor index allocated by HAL and used for broadcast/multicast packets.
+    // valid only when 'status' field is eHAL_STATUS_SUCCESS
+    tANI_U8    bcastDpuDescIndx;
+
+    // DPU signature to be used for broadcast/multicast packets
+    // valid only when 'status' field is eHAL_STATUS_SUCCESS
+    tANI_U8    bcastDpuSignature;
+
+    // DPU descriptor index allocated by HAL, used for bcast/mcast management packets
+    tANI_U8    mgmtDpuDescIndx;
+
+    // DPU signature to be used for bcast/mcast management packets
+    tANI_U8    mgmtDpuSignature;
+
+   //HAL should update the existing BSS entry, if this flag is set.
+   //PE will set this flag in case of reassoc, where we want to resue the
+   //the old bssID and still return success.
+    tANI_U8 updateBss;
+
+    // Add BSSID info for rxp filter in IBSS mode
+    tSirMacSSid ssId;
+
+    //HAL will send the response message to LIM only when this flag is set.
+    //LIM will set this flag, whereas DVT will not set this flag.
+    tANI_U8 respReqd;
+    tANI_U8     sessionId; // PE session id for PE<->HAL interface 
+    // PE session id now added to all HAL<->PE transacations
+    // HAL Sends the sessionId unmodified.
+
+#if defined WLAN_FEATURE_VOWIFI
+    tPowerdBm txMgmtPower; //HAL fills in the tx power used for mgmt frames in this field.
+    tPowerdBm maxTxPower;  //max power to be used after applying the power constraint, if any
+#endif
+
+#if defined WLAN_FEATURE_VOWIFI_11R
+    tANI_U8 extSetStaKeyParamValid; //Ext Bss Config Msg if set
+    tSetStaKeyParams extSetStaKeyParam;  //SetStaKeyParams for ext bss msg
+#endif
+
+    tANI_U8   ucMaxProbeRespRetryLimit;  //probe Response Max retries
+    tANI_U8   bHiddenSSIDEn;             //To Enable Hidden ssid.      
+    tANI_U8   bProxyProbeRespEn;         //To Enable Disable FW Proxy Probe Resp
+    tANI_U8   halPersona;         //Persona for the BSS can be STA,AP,GO,CLIENT value same as tVOS_CON_MODE
+
+    //Spectrum Management Capability, 1 - Enabled, 0 - Disabled.
+    tANI_U8 bSpectrumMgtEnabled;
+
+} tAddBssParams, * tpAddBssParams;
+
+typedef struct
+{
+    tANI_U8 bssIdx;
+    // The return status of SIR_HAL_DELETE_BSS_REQ is reported here
+    eHalStatus status;
+    //HAL will send the response message to LIM only when this flag is set.
+    //LIM will set this flag, whereas DVT will not set this flag.
+    tANI_U8 respReqd;
+    tANI_U8     sessionId; // PE session id for PE<->HAL interface 
+                           // HAL sends it back unmodified.
+    tSirMacAddr bssid; // Will be removed for PE-HAL integration
+} tDeleteBssParams, * tpDeleteBssParams;
+
+//
+// UAPSD AC mask: 1b per AC
+// LSB 4 bits for delivery enabled setting. msb 4 bits for trigger enabled settings. 
+// Encoded as follows:
+// b7 b6 b5 b4 b3 b2 b1 b0
+// BE  BK  VI  VO  BE BK VI VO
+
+typedef struct
+{
+    tANI_U8 staIdx;
+    tANI_U8 uapsdACMask; 
+    tANI_U8 maxSpLen;    
+} tUpdateUapsdParams, * tpUpdateUapsdParams;
+
+typedef struct sSirScanEntry
+{
+    tANI_U8 bssIdx[HAL_NUM_BSSID];
+    tANI_U8 activeBSScnt;
+}tSirScanEntry, *ptSirScanEntry;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_INIT_SCAN_REQ
+//
+typedef struct {
+
+    eHalSysMode scanMode;
+
+    tSirMacAddr bssid;
+
+    tANI_U8 notifyBss;
+
+#ifdef WLAN_FEATURE_P2P
+    tANI_U8 useNoA;
+#endif
+
+    // If this flag is set HAL notifies PE when SMAC returns status.
+    tANI_U8 notifyHost;
+
+    tANI_U8 frameLength;
+    tANI_U8 frameType;     // Data NULL or CTS to self
+
+    // Indicates the scan duration (in ms)
+    tANI_U16 scanDuration;
+
+    // For creation of CTS-to-Self and Data-NULL MAC packets
+    tSirMacMgmtHdr macMgmtHdr;
+
+    tSirScanEntry scanEntry;
+
+    // when this flag is set, HAL should check for link traffic prior to scan
+    tSirLinkTrafficCheck    checkLinkTraffic;
+
+    /*
+     * Following parameters are for returning status and station index from HAL to PE
+     * via response message. HAL does not read them.
+     */
+    // The return status of SIR_HAL_INIT_SCAN_REQ is reported here
+    eHalStatus status;
+
+} tInitScanParams, * tpInitScanParams;
+
+#ifdef WLAN_SOFTAP_FEATURE
+typedef enum  eDelStaReasonCode{
+   HAL_DEL_STA_REASON_CODE_KEEP_ALIVE = 0x1,
+   HAL_DEL_STA_REASON_CODE_TIM_BASED  = 0x2,
+   HAL_DEL_STA_REASON_CODE_RA_BASED   = 0x3,
+   HAL_DEL_STA_REASON_CODE_UNKNOWN_A2 = 0x4
+}tDelStaReasonCode;
+#endif
+
+//
+// Msg header is used from tSirMsgQ
+// Msg Type = SIR_LIM_DELETE_STA_CONTEXT_IND
+//
+typedef struct {
+    tANI_U16    assocId;
+    tANI_U16    staId;
+    tSirMacAddr bssId; // TO SUPPORT BT-AMP    
+                       // HAL copies bssid from the sta table.
+#ifdef WLAN_SOFTAP_FEATURE                       
+    tSirMacAddr addr2;        //  
+    tANI_U16    reasonCode;   // To unify the keepalive / unknown A2 / tim-based disa                                                                                                 
+#endif    
+} tDeleteStaContext, * tpDeleteStaContext;
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_START_SCAN_REQ
+// FIXME - Can we just use tSirMsgQ directly, instead of using this structure?
+//
+typedef struct {
+
+    // Indicates the current scan channel
+    tANI_U8 scanChannel;
+
+    /*
+    * Following parameters are for returning status and station index from HAL to PE
+    * via response message. HAL does not read them.
+    */
+    // The return status of SIR_HAL_START_SCAN_REQ is reported here
+    eHalStatus status;
+
+#if defined WLAN_FEATURE_VOWIFI
+    tANI_U32 startTSF[2];
+    tPowerdBm txMgmtPower; //HAL fills in the tx power used for mgmt frames in this field.
+#endif
+} tStartScanParams, * tpStartScanParams;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_END_SCAN_REQ
+// FIXME - Can we just use tSirMsgQ directly, instead of using this structure?
+//
+typedef struct {
+
+    // Indicates the current scan channel
+    tANI_U8 scanChannel;
+
+    /*
+    * Following parameters are for returning status and station index from HAL to PE
+    * via response message. HAL does not read them.
+    */
+    // The return status of SIR_HAL_END_SCAN_REQ is reported here
+    eHalStatus status;
+
+} tEndScanParams, * tpEndScanParams;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_FINISH_SCAN_REQ
+//
+typedef struct {
+
+    // Identifies the operational state of the AP/STA.
+    // In case of the STA, only if the operState is non-zero will the rest of
+    // the parameters that follow be decoded
+    // In case of the AP, all parameters are valid
+    //
+    // 0 - Idle state, 1 - Link Established
+
+    eHalSysMode scanMode;
+
+    tSirMacAddr bssid;
+
+    // Current operating channel
+    tANI_U8 currentOperChannel;
+
+    // If 20/40 MHz is operational, this will indicate the 40 MHz extension
+    // channel in combination with the control channel
+    ePhyChanBondState cbState;
+
+    // For an STA, indicates if a Data NULL frame needs to be sent
+    // to the AP with FrameControl.PwrMgmt bit set to 0
+    tANI_U8 notifyBss;
+
+    tANI_U8 notifyHost;
+
+    tANI_U8 frameLength;
+    tANI_U8 frameType;     // Data NULL or CTS to self
+
+    // For creation of CTS-to-Self and Data-NULL MAC packets
+    tSirMacMgmtHdr macMgmtHdr;
+
+    tSirScanEntry scanEntry;
+
+    /*
+    * Following parameters are for returning status and station index from HAL to PE
+    * via response message. HAL does not read them.
+    */
+    // The return status of SIR_HAL_FINISH_SCAN_REQ is reported here
+    eHalStatus status;
+
+} tFinishScanParams, * tpFinishScanParams;
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#endif
+
+typedef struct sBeaconGenStaInfo {
+    tANI_U16    assocId;
+    tANI_U32    staTxAckCnt;
+}tBeaconGenStaInfo, *tpBeaconGenStaInfo;
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_LIM_BEACON_GEN_IND
+//
+
+typedef struct sBeaconGenParams {
+    // Identifies the BSSID for which it is time to generate a beacon
+    tANI_U8                 bssIdx;
+    tSirMacAddr           bssId;
+#ifdef FIXME_VOLANS
+    tANI_U8                 numOfSta;                /* Number of stations in power save, who have data pending*/
+    tANI_U8                 numOfStaWithoutData; /* Number of stations in power save, who don't have any data pending*/
+    tANI_U8                 fBroadcastTrafficPending ;
+    tANI_U8                 dtimCount;
+#endif
+    tANI_U8                 rsvd[3];                /** Align the Structure to 4 bytes as unalligned access will happen if
+                                                    the staInfo is being Accessed */
+/** NOTE:   tBeaconGenStaInfo     staInfo[xx];  Depending on the Number of STA in PS, Every time
+                            this array is being allocated and piled up at the End*/
+} tBeaconGenParams, * tpBeaconGenParams;
+
+typedef struct {
+    tSirMacAddr bssId;
+    tANI_U8 *beacon;     // Beacon data.
+    tANI_U32 beaconLength; //length of the template.
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U32 timIeOffset; //TIM IE offset from the beginning of the template.
+#ifdef WLAN_FEATURE_P2P    
+    tANI_U16 p2pIeOffset; //P2P IE offset from the begining of the template
+#endif    
+#endif
+} tSendbeaconParams, * tpSendbeaconParams;
+
+#ifdef WLAN_SOFTAP_FEATURE
+typedef struct sSendProbeRespParams {
+    tSirMacAddr bssId;
+    tANI_U8      *pProbeRespTemplate; 
+    tANI_U32     probeRespTemplateLen;
+    tANI_U32     ucProxyProbeReqValidIEBmap[8];
+} tSendProbeRespParams, * tpSendProbeRespParams;
+#endif
+
+/*
+ * This is used by PE to create a set of WEP keys for a given BSS.
+ */
+typedef struct
+{
+    tANI_U8         bssIdx;
+    tAniEdType      encType;
+    tANI_U8         numKeys;
+    tSirKeys        key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS];
+    tANI_U8         singleTidRc;    // 1=Single TID based Replay Count, 0=Per TID based RC
+    /*
+     * Following parameter is for returning status
+     * via response message. HAL does not read them.
+     */
+    eHalStatus  status;     // status of SIR_HAL_SET_BSSKEY_REQ is reported here
+    tANI_U8     sessionId;  // PE session id for PE<->HAL interface 
+                            // HAL sends this unmodified in the response
+} tSetBssKeyParams, *tpSetBssKeyParams;
+
+/*
+ * This is used by PE to Remove the key information on a given station.
+ */
+typedef struct
+{
+    tANI_U16         staIdx;
+    tAniEdType      encType;    // Encryption/Decryption type
+    tANI_U8           keyId;
+    tANI_BOOLEAN    unicast;
+    /*
+     * Following parameter is for returning status
+     * via response message. HAL does not read them.
+     */
+    eHalStatus  status;     // return status of SIR_HAL_REMOVE_STAKEY_REQ 
+    tANI_U8     sessionId;  // PE session id for PE<->HAL interface 
+                            //  HAL Sends back the PE session 
+                            //  id unmodified 
+} tRemoveStaKeyParams, *tpRemoveStaKeyParams;
+
+/*
+ * This is used by PE to remove keys for a given BSS.
+ */
+typedef struct
+{
+    tANI_U8         bssIdx;
+    tAniEdType     encType;
+    tANI_U8         keyId;
+    tANI_U8         wepType;
+    /*
+     * Following parameter is for returning status
+     * via response message. HAL does not read them.
+     */
+    eHalStatus  status;    // return status of SIR_HAL_REMOVE_BSSKEY_REQ 
+    tANI_U8     sessionId; // PE session id for PE<->HAL interface 
+                           //  HAL Sends back the PE session 
+                           //  id unmodified 
+} tRemoveBssKeyParams, *tpRemoveBssKeyParams;
+
+typedef struct
+{
+    // index of STA to get the statistics from
+    tANI_U16 staIdx;
+    tANI_U8 encMode;
+    // The return status of SIR_HAL_DPU_STATS_REQ is reported here
+    eHalStatus status;
+    // The return statistics
+    tANI_U32  sendBlocks;
+    tANI_U32  recvBlocks;
+    tANI_U32  replays;
+    tANI_U8   micErrorCnt;
+    tANI_U32  protExclCnt;
+    tANI_U16  formatErrCnt;
+    tANI_U16  unDecryptableCnt;
+    tANI_U32  decryptErrCnt;
+    tANI_U32  decryptOkCnt;
+
+} tDpuStatsParams, * tpDpuStatsParams;
+
+
+/*
+ * Get the DPU signature based on a given staId
+ */
+typedef struct
+{
+    tANI_U16        staIdx;
+    /*
+     * Following parameter is for returning status
+     * via response message. HAL does not read them.
+     */
+    // The return status of SIR_HAL_SET_BSSKEY_REQ is reported here
+    eHalStatus status;
+    tANI_U8    dpuDescIndx;
+    tANI_U8    dpuSignature;
+} tGetDpuParams, *tpGetDpuParams;
+
+
+
+//HAL MSG: SIR_HAL_UPDATE_BEACON_IND
+typedef struct
+{
+
+    tANI_U8  bssIdx;
+
+    //shortPreamble mode. HAL should update all the STA rates when it
+    //receives this message
+    tANI_U8 fShortPreamble;
+    //short Slot time.
+    tANI_U8 fShortSlotTime;
+    //Beacon Interval
+    tANI_U16 beaconInterval;
+    //Protection related
+    tANI_U8 llaCoexist;
+    tANI_U8 llbCoexist;
+    tANI_U8 llgCoexist;
+    tANI_U8 ht20MhzCoexist;
+    tANI_U8 llnNonGFCoexist;
+    tANI_U8 fLsigTXOPProtectionFullSupport;
+    tANI_U8 fRIFSMode;
+
+    tANI_U16 paramChangeBitmap;
+}tUpdateBeaconParams, *tpUpdateBeaconParams;
+
+
+
+//HAL MSG: SIR_HAL_UPDATE_CF_IND
+typedef struct
+{
+
+    tANI_U8  bssIdx;
+
+    /*
+    * cfpCount indicates how many DTIMs (including the current frame) appear before the next CFP start.
+    * A CFPCount of 0 indicates that the current DTIM marks the start of the CFP.
+    */
+    tANI_U8  cfpCount;
+
+    /* cfpPeriod indicates the number of DTIM intervals between the start of CFPs. */
+    tANI_U8 cfpPeriod;
+
+}tUpdateCFParams, *tpUpdateCFParams;
+
+
+
+//HAL MSG: SIR_HAL_UPDATE_DTIM_IND
+//This message not required, as Softmac is supposed to read these values from the beacon.
+//PE should not look at TIM element
+
+/*
+typedef struct
+{
+    tANI_U8  bssIdx;
+
+
+    //The DTIM Count field indicates how many beacons (including the current frame) appear before the next
+    // DTIM. A DTIM Count of 0 indicates that the current TIM is a DTIM.
+    //
+    tANI_U8 dtimCount;
+
+
+   // The DTIM Period field indicates the number of Beacon intervals between successive DTIMs. If all TIMs are
+   // DTIMs, the DTIM Period field has the value 1. The DTIM Period value 0 is reserved.
+    //
+    tANI_U8 dtimPeriod;
+
+}tUpdateDtimParams, *tpUpdateDtimParams;
+*/
+
+
+//HAL MSG: SIR_HAL_CHNL_SWITCH_REQ
+typedef struct
+{
+    tANI_U8 channelNumber;
+#ifndef WLAN_FEATURE_VOWIFI    
+    tANI_U8 localPowerConstraint;
+#endif /* WLAN_FEATURE_VOWIFI  */
+    tSirMacHTSecondaryChannelOffset secondaryChannelOffset;
+    tANI_U8 peSessionId;
+#if defined WLAN_FEATURE_VOWIFI
+    tPowerdBm txMgmtPower; //HAL fills in the tx power used for mgmt frames in this field.
+    tPowerdBm maxTxPower;
+    tSirMacAddr selfStaMacAddr;
+                        //the request has power constraints, this should be applied only to that session
+#endif
+    /* VO Wifi comment: BSSID is needed to identify which session issued this request. As the 
+       request has power constraints, this should be applied only to that session */
+    /* V IMP: Keep bssId field at the end of this msg. It is used to mantain backward compatbility
+     * by way of ignoring if using new host/old FW or old host/new FW since it is at the end of this struct
+     */
+    tSirMacAddr bssId;
+
+    eHalStatus status;
+
+}tSwitchChannelParams, *tpSwitchChannelParams;
+
+typedef void (*tpSetLinkStateCallback)(tpAniSirGlobal pMac, void *msgParam );
+
+typedef struct sLinkStateParams
+{
+    // SIR_HAL_SET_LINK_STATE
+    tSirMacAddr bssid;
+    tSirMacAddr selfMacAddr;
+    tSirLinkState state;
+    tpSetLinkStateCallback callback;
+    void *callbackArg;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    int ft;
+    void * session;
+#endif
+} tLinkStateParams, * tpLinkStateParams;
+
+
+typedef struct
+{
+  tANI_U16 staIdx;
+  tANI_U16 tspecIdx; //TSPEC handler uniquely identifying a TSPEC for a STA in a BSS
+  tSirMacTspecIE   tspec;
+  eHalStatus       status;
+  tANI_U8          sessionId;          //PE session id for PE<->HAL interface 
+} tAddTsParams, *tpAddTsParams;
+
+typedef struct
+{
+  tANI_U16 staIdx;
+  tANI_U16 tspecIdx; //TSPEC identifier uniquely identifying a TSPEC for a STA in a BSS
+  tSirMacAddr bssId; //TO SUPPORT BT-AMP
+  
+} tDelTsParams, *tpDelTsParams;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+#define HAL_QOS_NUM_TSPEC_MAX 2
+#define HAL_QOS_NUM_AC_MAX 4
+
+typedef struct
+{
+  tANI_U16 staIdx;
+  tANI_U16 tspecIdx; //TSPEC handler uniquely identifying a TSPEC for a STA in a BSS
+  tSirMacTspecIE   tspec[HAL_QOS_NUM_AC_MAX];
+  eHalStatus       status[HAL_QOS_NUM_AC_MAX];
+  tANI_U8          sessionId;          //PE session id for PE<->HAL interface 
+}tAggrAddTsParams, *tpAggrAddTsParams;
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+typedef tSirRetStatus (*tHalMsgCallback)(tpAniSirGlobal pMac, tANI_U32 mesgId, void *mesgParam );
+
+
+typedef struct
+{
+  tANI_U16 bssIdx;
+  tANI_BOOLEAN highPerformance;
+  tSirMacEdcaParamRecord acbe; // best effort
+  tSirMacEdcaParamRecord acbk; // background
+  tSirMacEdcaParamRecord acvi; // video
+  tSirMacEdcaParamRecord acvo; // voice
+} tEdcaParams, *tpEdcaParams;
+
+/*
+* Function Prototypes
+*/
+
+eHalStatus halMsg_setPromiscMode(tpAniSirGlobal pMac);
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_ADDBA_REQ
+//
+typedef struct sAddBAParams
+{
+
+    // Station Index
+    tANI_U16 staIdx;
+
+    // Peer MAC Address
+    tSirMacAddr peerMacAddr;
+
+    // ADDBA Action Frame dialog token
+    // HAL will not interpret this object
+    tANI_U8 baDialogToken;
+
+    // TID for which the BA is being setup
+    // This identifies the TC or TS of interest
+    tANI_U8 baTID;
+
+    // 0 - Delayed BA (Not supported)
+    // 1 - Immediate BA
+    tANI_U8 baPolicy;
+
+    // Indicates the number of buffers for this TID (baTID)
+    // NOTE - This is the requested buffer size. When this
+    // is processed by HAL and subsequently by HDD, it is
+    // possible that HDD may change this buffer size. Any
+    // change in the buffer size should be noted by PE and
+    // advertized appropriately in the ADDBA response
+    tANI_U16 baBufferSize;
+
+    // BA timeout in TU's
+    // 0 means no timeout will occur
+    tANI_U16 baTimeout;
+
+    // b0..b3 - Fragment Number - Always set to 0
+    // b4..b15 - Starting Sequence Number of first MSDU
+    // for which this BA is setup
+    tANI_U16 baSSN;
+
+    // ADDBA direction
+    // 1 - Originator
+    // 0 - Recipient
+    tANI_U8 baDirection;
+
+    //
+    // Following parameters are for returning status from
+    // HAL to PE via response message. HAL does not read them
+    //
+    // The return status of SIR_HAL_ADDBA_REQ is reported
+    // in the SIR_HAL_ADDBA_RSP message
+    eHalStatus status;
+
+    // Indicating to HAL whether a response message is required.
+    tANI_U8 respReqd;
+    tANI_U8    sessionId; // PE session id for PE<->HAL interface 
+                          //  HAL Sends back the PE session 
+                          //  id unmodified 
+
+} tAddBAParams, * tpAddBAParams;
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_DELBA_IND
+//
+typedef struct sDelBAParams
+{
+
+    // Station Index
+    tANI_U16 staIdx;
+
+    // TID for which the BA session is being deleted
+    tANI_U8 baTID;
+
+    // DELBA direction
+    // 1 - Originator
+    // 0 - Recipient
+    tANI_U8 baDirection;
+
+    // FIXME - Do we need a response for this?
+    // Maybe just the IND/REQ will suffice?
+    //
+    // Following parameters are for returning status from
+    // HAL to PE via response message. HAL does not read them
+    //
+    // The return status of SIR_HAL_DELBA_REQ is reported
+    // in the SIR_HAL_DELBA_RSP message
+    //eHalStatus status;
+
+} tDelBAParams, * tpDelBAParams;
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_SET_MIMOPS_REQ
+//
+typedef struct sSet_MIMOPS
+{
+    // Station Index
+    tANI_U16 staIdx;
+
+    // MIMO Power Save State
+    tSirMacHTMIMOPowerSaveState htMIMOPSState;
+    // The return status of SIR_HAL_SET_MIMOPS_REQ is reported
+    // in the SIR_HAL_SET_MIMOPS_RSP message
+    eHalStatus status;
+    tANI_U8     fsendRsp;
+
+} tSetMIMOPS, * tpSetMIMOPS;
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_EXIT_BMPS_REQ
+//
+typedef struct sExitBmpsParams
+{
+    tANI_U8     sendDataNull;
+    eHalStatus  status;
+} tExitBmpsParams, *tpExitBmpsParams;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_ENTER_UAPSD_REQ
+//
+typedef struct sUapsdParams
+{
+    tANI_U8     bkDeliveryEnabled:1;
+    tANI_U8     beDeliveryEnabled:1;
+    tANI_U8     viDeliveryEnabled:1;
+    tANI_U8     voDeliveryEnabled:1;
+    tANI_U8     bkTriggerEnabled:1;
+    tANI_U8     beTriggerEnabled:1;
+    tANI_U8     viTriggerEnabled:1;
+    tANI_U8     voTriggerEnabled:1;
+    eHalStatus  status;
+}tUapsdParams, *tpUapsdParams;
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_LIM_DEL_BA_IND
+//
+typedef struct sBADeleteParams
+{
+
+    // Station Index
+    tANI_U16 staIdx;
+
+    // Peer MAC Address, whose BA session has timed out
+    tSirMacAddr peerMacAddr;
+
+    // TID for which a BA session timeout is being triggered
+    tANI_U8 baTID;
+
+    // DELBA direction
+    // 1 - Originator
+    // 0 - Recipient
+    tANI_U8 baDirection;
+
+    tANI_U32 reasonCode;
+
+    tSirMacAddr  bssId; // TO SUPPORT BT-AMP    
+                        // HAL copies the sta bssid to this.
+} tBADeleteParams, * tpBADeleteParams;
+
+
+// Mesg Type = SIR_LIM_ADD_BA_IND
+typedef struct sBaActivityInd
+{
+    tANI_U16 baCandidateCnt;
+    //baCandidateCnt is followed by BA Candidate List ( tAddBaCandidate)
+
+    tSirMacAddr  bssId; // TO SUPPORT BT-AMP    
+} tBaActivityInd, * tpBaActivityInd;
+
+
+typedef struct tHalIndCB
+{
+
+    tHalMsgCallback pHalIndCB;
+
+}tHalIndCB,*tpHalIndCB;
+
+/** Max number of bytes required for stations bitmap aligned at 4 bytes boundary */
+#define HALMSG_NUMBYTES_STATION_BITMAP(x) (((x / 32) + ((x % 32)?1:0)) * 4)
+
+typedef struct sControlTxParams
+{
+    tANI_BOOLEAN stopTx;
+    /* Master flag to stop or resume all transmission, Once this flag is set,
+     * softmac doesnt look for any other details.
+     */
+    tANI_U8 fCtrlGlobal;
+    /* If this flag is set, staBitmap[] is valid */
+    tANI_U8 ctrlSta;
+    /* If this flag is set, bssBitmap and beaconBitmap is valid */
+    tANI_U8 ctrlBss;
+
+    /* When ctrlBss is set, this bitmap contains bitmap of BSS indices to be
+     * stopped for resumed for transmission.
+     * This is 32 bit bitmap, not array of bytes.
+     */
+    tANI_U32 bssBitmap;
+    /* When ctrlBss is set, this bitmap contains bitmap of BSS indices to be
+     * stopped for resumed for beacon transmission.
+     */
+    tANI_U32 beaconBitmap;
+
+    /**
+     *  Memory for the station bitmap will be allocated later based on
+     *  the number of station supported.
+     */
+} tTxControlParams, * tpTxControlParams;
+
+typedef struct sEnterBmpsParams
+{
+    //TBTT value derived from the last beacon
+    tANI_U8         bssIdx;
+    tANI_U64 tbtt;
+    tANI_U8 dtimCount;
+    //DTIM period given to HAL during association may not be valid,
+    //if association is based on ProbeRsp instead of beacon.
+    tANI_U8 dtimPeriod;
+
+    // For CCX and 11R Roaming
+    tANI_U8  bRssiFilterEnable;
+    tANI_U32 rssiFilterPeriod;
+    tANI_U32 numBeaconPerRssiAverage;
+
+    eHalStatus status;
+    tANI_U8 respReqd;
+}tEnterBmpsParams, *tpEnterBmpsParams;
+
+
+//
+// Mesg header is used from tSirMsgQ
+// Mesg Type = SIR_HAL_SET_MAX_TX_POWER_REQ
+//
+typedef struct sMaxTxPowerParams
+{
+    tSirMacAddr bssId;  // BSSID is needed to identify which session issued this request. As 
+                        //the request has power constraints, this should be applied only to that session
+    tSirMacAddr selfStaMacAddr;
+    //In request,
+    //power == MaxTx power to be used.
+    //In response,
+    //power == tx power used for management frames.
+    tPowerdBm  power;
+}tMaxTxPowerParams, *tpMaxTxPowerParams;
+
+typedef struct sAddStaSelfParams
+{
+   tSirMacAddr selfMacAddr;
+
+   tANI_U32 status;
+}tAddStaSelfParams, *tpAddStaSelfParams;
+
+typedef struct sDelStaSelfParams
+{
+   tSirMacAddr selfMacAddr;
+
+   tANI_U32 status;
+}tDelStaSelfParams, *tpDelStaSelfParams;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct sP2pPsParams
+{
+   tANI_U8   opp_ps;
+   tANI_U32  ctWindow;
+   tANI_U8   count; 
+   tANI_U32  duration;
+   tANI_U32  interval;
+   tANI_U32  single_noa_duration;
+   tANI_U8   psSelection;
+}tP2pPsParams, *tpP2pPsParams;
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+static inline void halGetTxTSFtimer(tpAniSirGlobal pMac, 
+                                                tSirMacTimeStamp *pTime)
+{
+}
+
+extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
+/* Beacon Filtering data structures */
+typedef __ani_attr_pre_packed struct sBeaconFilterMsg
+{
+    tANI_U16    capabilityInfo;
+    tANI_U16    capabilityMask;
+    tANI_U16    beaconInterval;
+    tANI_U16    ieNum;
+} __ani_attr_packed tBeaconFilterMsg, *tpBeaconFilterMsg;
+
+typedef __ani_attr_pre_packed struct sEidByteInfo
+{
+    tANI_U8     offset;
+    tANI_U8     value;
+    tANI_U8     bitMask;
+    tANI_U8     ref;
+} __ani_attr_packed tEidByteInfo, *tpEidByteInfo;
+
+
+/* The above structure would be followed by multiple of below mentioned 
+structure */
+typedef __ani_attr_pre_packed struct sBeaconFilterIe
+{
+    tANI_U8         elementId;
+    tANI_U8         checkIePresence;
+    tEidByteInfo    byte;
+} __ani_attr_packed tBeaconFilterIe, *tpBeaconFilterIe;
+
+typedef __ani_attr_pre_packed struct sRemBeaconFilterMsg  
+{
+    tANI_U8  ucIeCount;
+    tANI_U8  ucRemIeId[1];
+}  __ani_attr_packed tRemBeaconFilterMsg, *tpRemBeaconFilterMsg;
+
+#endif
+#endif /* _HALMSGAPI_H_ */
+
diff --git a/CORE/WDA/inc/legacy/halTypes.h b/CORE/WDA/inc/legacy/halTypes.h
new file mode 100644
index 0000000..ad7a02b
--- /dev/null
+++ b/CORE/WDA/inc/legacy/halTypes.h
@@ -0,0 +1,435 @@
+/*
+ * 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 halTypes.h
+
+    \brief This header captures types that must be shared in common with individual
+            module headers before inclusion into halCommonApi.h.
+
+    $Id$
+
+    Copyright (C) 2006 Airgo Networks, Incorporated
+
+
+   ========================================================================== */
+
+#ifndef HALTYPES_H
+#define HALTYPES_H
+#ifndef WINXP_APPS_BUILD    //TODO: this header dependency does not belong in this file
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "wlan_qct_bal.h"
+
+#ifdef WLAN_HAL_VOLANS
+#include "volansDefs.h"
+#else
+#include "libraDefs.h"
+#endif
+#endif
+
+#endif /* WINXP_APPS_BUILD */
+
+#include "palTypes.h"
+#include "wlan_nv.h"
+
+#define OFFSET_OF(structType,fldName)   (&((structType*)0)->fldName)
+
+/** ------------------------------------------------------------------------- *
+
+    \typedef tHalHandle
+
+    \brief Handle to the HAL.  The HAL handle is returned by the HAL after it
+    is opened (by calling halOpen).
+
+    -------------------------------------------------------------------------- */
+typedef void *tHalHandle;
+
+// define a value for an invalid HAL handle.....
+#define HAL_INVALID_HAL_HANDLE ( NULL )
+
+
+/** ------------------------------------------------------------------------- *
+
+    \enum eHalStatus
+
+    \brief Enumeration of all status codes returned by the higher level
+    HAL interface functions.
+
+    -------------------------------------------------------------------------- */
+typedef enum
+{
+    eHAL_STATUS_SUCCESS,
+
+    // general failure.  This status applies to all failure that are not covered
+    // by more specific return codes.
+    eHAL_STATUS_FAILURE,
+    eHAL_STATUS_FAILED_ALLOC,
+    eHAL_STATUS_RESOURCES,
+
+    // the HAL has not been opened and a HAL function is being attempted.
+    eHAL_STATUS_NOT_OPEN,
+
+    // function failed due to the card being removed...
+    eHAL_STATUS_CARD_NOT_PRESENT,
+
+    //halInterrupt status
+    eHAL_STATUS_INTERRUPT_ENABLED,
+    eHAL_STATUS_INTERRUPT_DISABLED,
+    eHAL_STATUS_NO_INTERRUPTS,
+    eHAL_STATUS_INTERRUPT_PRESENT,
+    eHAL_STATUS_ALL_INTERRUPTS_PROCESSED,
+    eHAL_STATUS_INTERRUPT_NOT_PROCESSED,        //interrupt cleared but no Isr to process
+
+    // a parameter on the PAL function call is not valid.
+    eHAL_STATUS_INVALID_PARAMETER,
+
+    // the PAL has not been initialized...
+    eHAL_STATUS_NOT_INITIALIZED,
+
+    // Error codes for PE-HAL message API
+    eHAL_STATUS_INVALID_STAIDX,
+    eHAL_STATUS_INVALID_BSSIDX,
+    eHAL_STATUS_STA_TABLE_FULL,             // No space to add more STA, sta table full.
+    eHAL_STATUS_BSSID_TABLE_FULL,
+    eHAL_STATUS_DUPLICATE_BSSID,
+    eHAL_STATUS_DUPLICATE_STA,
+    eHAL_STATUS_BSSID_INVALID,
+    eHAL_STATUS_STA_INVALID,
+    eHAL_STATUS_INVALID_KEYID,
+    eHAL_STATUS_INVALID_SIGNATURE,
+
+    //DXE
+    eHAL_STATUS_DXE_FAILED_NO_DESCS,
+    eHAL_STATUS_DXE_CHANNEL_NOT_CONFIG,         // Channel not configured
+    eHAL_STATUS_DXE_CHANNEL_MISUSE,             // Specified operation inconsistent w/ configuration
+    eHAL_STATUS_DXE_VIRTUAL_MEM_ALLOC_ERROR,    //
+    eHAL_STATUS_DXE_SHARED_MEM_ALLOC_ERROR,     //
+    eHAL_STATUS_DXE_INVALID_CHANNEL,
+    eHAL_STATUS_DXE_INVALID_CALLBACK,
+    eHAL_STATUS_DXE_INCONSISTENT_DESC_COUNT,
+    eHAL_STATUS_DXE_XFR_QUEUE_ERROR,
+    eHAL_STATUS_DXE_INVALID_BUFFER,
+    eHAL_STATUS_DXE_INCOMPLETE_PACKET,
+    eHAL_STATUS_DXE_INVALID_PARAMETER,
+    eHAL_STATUS_DXE_CH_ALREADY_CONFIGURED,
+    eHAL_STATUS_DXE_USB_INVALID_EP,
+    eHAL_STATUS_DXE_GEN_ERROR,
+
+
+    // status codes added for the ImageValidate library
+    eHAL_STATUS_E_NULL_VALUE,
+    eHAL_STATUS_E_FILE_NOT_FOUND,
+    eHAL_STATUS_E_FILE_INVALID_CONTENT,
+    eHAL_STATUS_E_MALLOC_FAILED,
+    eHAL_STATUS_E_FILE_READ_FAILED,
+    eHAL_STATUS_E_IMAGE_INVALID,
+    eHAL_STATUS_E_IMAGE_UNSUPPORTED,
+
+    // status code returned by device memory calls when memory is
+    // not aligned correctly.
+    eHAL_STATUS_DEVICE_MEMORY_MISALIGNED,          // memory access is not aligned on a 4 byte boundary
+    eHAL_STATUS_DEVICE_MEMORY_LENGTH_ERROR,        // memory access is not a multiple of 4 bytes
+
+    // Generic status code to indicate network congestion.
+    eHAL_STATUS_NET_CONGESTION,
+
+    // various status codes for Rx packet dropped conditions...  Note the Min and Max
+    // enums that bracked the Rx Packet Dropped status codes.   There is code that
+    // looks at the various packet dropped conditions so make sure these min / max
+    // enums remain accurate.
+    eHAL_STATUS_RX_PACKET_DROPPED,
+    eHAL_STATUS_RX_PACKET_DROPPED_MIN = eHAL_STATUS_RX_PACKET_DROPPED,
+    eHAL_STATUS_RX_PACKET_DROPPED_NULL_DATA,
+    eHAL_STATUS_RX_PACKET_DROPPED_WDS_FRAME,
+    eHAL_STATUS_RX_PACKET_DROPPED_FILTERED,
+    eHAL_STATUS_RX_PACKET_DROPPED_GROUP_FROM_SELF,
+    eHAL_STATUS_RX_PACKET_DROPPED_MAX = eHAL_STATUS_RX_PACKET_DROPPED_GROUP_FROM_SELF,
+
+    // Status indicating that PMU did not power up and hence indicative of the fact that the clocks are not on
+    eHAL_STATUS_PMU_NOT_POWERED_UP,
+
+    // Queuing code for BA message API
+    eHAL_STATUS_BA_ENQUEUED,        // packets have been buffered in Host
+    eHAL_STATUS_BA_INVALID,
+
+    // A-MPDU/BA related Error codes
+    eHAL_STATUS_BA_RX_BUFFERS_FULL,
+    eHAL_STATUS_BA_RX_MAX_SESSIONS_REACHED,
+    eHAL_STATUS_BA_RX_INVALID_SESSION_ID,
+
+    // !!LAC - can we rework the code so these are not needed?
+    eHAL_STATUS_BA_RX_DROP_FRAME,
+    eHAL_STATUS_BA_RX_INDICATE_FRAME,
+    eHAL_STATUS_BA_RX_ENQUEUE_FRAME,
+
+    // PMC return codes.
+    eHAL_STATUS_PMC_PENDING,
+    eHAL_STATUS_PMC_DISABLED,
+    eHAL_STATUS_PMC_NOT_NOW,
+    eHAL_STATUS_PMC_AC_POWER,
+    eHAL_STATUS_PMC_SYS_ERROR,
+    eHAL_STATUS_PMC_CANNOT_ENTER_IMPS,
+    eHAL_STATUS_PMC_ALREADY_IN_IMPS,
+
+    eHAL_STATUS_HEARTBEAT_TMOUT,
+    eHAL_STATUS_NTH_BEACON_DELIVERY,
+
+    //CSR
+    eHAL_STATUS_CSR_WRONG_STATE,
+
+    // DPU
+    eHAL_STATUS_DPU_DESCRIPTOR_TABLE_FULL,
+    eHAL_STATUS_DPU_MICKEY_TABLE_FULL,
+
+    // HAL-FW messages
+    eHAL_STATUS_FW_MSG_FAILURE,                // Error in Hal-FW message interface
+    eHAL_STATUS_FW_MSG_TIMEDOUT,
+    eHAL_STATUS_FW_MSG_INVALID,
+    eHAL_STATUS_FW_SEND_MSG_FAILED,
+    eHAL_STATUS_FW_PS_BUSY,
+
+    eHAL_STATUS_TIMER_START_FAILED,
+    eHAL_STATUS_TIMER_STOP_FAILED,
+
+    eHAL_STATUS_TL_SUSPEND_TIMEOUT,
+
+    eHAL_STATUS_UMA_DESCRIPTOR_TABLE_FULL,
+
+    eHAL_STATUS_SET_CHAN_ALREADY_ON_REQUESTED_CHAN,
+
+    // not a real status.  Just a way to mark the maximum in the enum.
+    eHAL_STATUS_MAX
+
+} eHalStatus;
+
+
+// macro to check for SUCCESS value of the halStatus
+#define HAL_STATUS_SUCCESS( variable ) ( eHAL_STATUS_SUCCESS == ( variable ) )
+
+/// Bit value data structure
+typedef enum sHalBitVal  // For Bit operations
+{
+    eHAL_CLEAR,
+    eHAL_SET
+}tHalBitVal;
+
+// -------------------------------------------------------------
+/// MMH APIs
+enum {
+   eHI_PRI,
+   ePROT,
+   eDBG
+};
+
+/// System role definition on a per BSS
+typedef enum eBssSystemRole
+{
+    eSYSTEM_UNKNOWN_ROLE,
+    eSYSTEM_AP_ROLE,
+    eSYSTEM_STA_IN_IBSS_ROLE,
+    eSYSTEM_STA_ROLE,
+    eSYSTEM_BTAMP_STA_ROLE,
+    eSYSTEM_BTAMP_AP_ROLE,
+
+    eSYSTEM_LAST_ROLE,
+    eSYSTEM_MULTI_BSS_ROLE = eSYSTEM_LAST_ROLE
+} tBssSystemRole;
+
+
+// ---------------------------------------
+// Channel Bonding Sideband configuration
+// ---------------------------------------
+typedef enum sHalCBsidebandType
+{
+    eHAL_SIDEBAND_CENTER=0,
+    eHAL_SIDEBAND_LOWER,
+    eHAL_SIDEBAND_UPPER,
+    eHAL_SIDEBAND_COPY
+}tHalCBsidebandType;
+
+
+/// HAL states
+typedef enum {
+    eHAL_IDLE,
+    eHAL_INIT,
+    eHAL_CFG, //CFG download completed.
+    eHAL_STARTED, //halProcessStartEvent compelted.
+    eHAL_SYS_READY, //Sys_ready msg received from HDD.
+    eHAL_NORMAL, //Sys_ready msg received from HDD and halProcessStartEvent completed.
+} tHAL_STATE;
+
+
+
+
+// Type to define softmac mode (also system mode)
+typedef enum
+{
+    //3- Promisc, 2 - Scan, 1 - Learn  0 - Normal
+    eHAL_SYS_MODE_NORMAL = 0,
+    eHAL_SYS_MODE_LEARN,
+    eHAL_SYS_MODE_SCAN,
+    eHAL_SYS_MODE_PROMISC,
+    eHAL_SYS_MODE_SUSPEND_LINK
+} eHalSysMode;
+
+
+
+
+// HAL frame types.  Used on the TxRx APIs and the
+// corresponding PAL routines.
+typedef enum {
+
+    HAL_TXRX_FRM_RAW,
+    HAL_TXRX_FRM_ETH2,
+    HAL_TXRX_FRM_802_3,
+    HAL_TXRX_FRM_802_11_MGMT,
+    HAL_TXRX_FRM_802_11_CTRL,
+    HAL_TXRX_FRM_802_11_DATA,
+    HAL_TXRX_FRM_IGNORED,   //This frame will be dropped
+    HAL_TXRX_FRM_MAX
+
+} eFrameType;
+
+
+typedef enum
+{
+    ANI_TXDIR_IBSS = 0,
+    ANI_TXDIR_TODS,
+    ANI_TXDIR_FROMDS,
+    ANI_TXDIR_WDS
+
+} eFrameTxDir;
+
+typedef enum
+{
+    eRF_BAND_UNKNOWN = 0,
+    eRF_BAND_2_4_GHZ = 1,
+    eRF_BAND_5_GHZ = 2
+} eRfBandMode;
+
+
+#ifndef __offsetof
+#define __offsetof(type, field) ((tANI_U32)(&((type *)0)->field))
+#endif
+
+#ifndef offsetof
+#define offsetof(type, field) __offsetof(type, field)
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#define HAL_MAX_TXPOWER_INVALID       127
+
+#define MIN_STA_PWR_CAP_DBM         13
+#define MAX_STA_PWR_CAP_DBM         19 
+
+/* Moving the miscellaneous defination required by UMAC are moved here from 
+ * volansdefs.h */
+/* --------------------------------------------------------------------
+ * Support definitions for taurus
+ * --------------------------------------------------------------------
+ */
+
+/*
+ * Volans supports 8 stations in hardware
+ *
+ * Volans without Virtual STA feature can only support 8 stations:
+ *    1 Broadcast STA (hard)
+ *    1 "Self" STA (hard)
+ *    6 Soft AP Stations (hard)
+ *
+ * Volans with Virtual STA feature supports 14 stations:
+ *    1 Broadcast STA (hard)
+ *    1 "Self" STA (hard)
+ *    2 General Purpose Stations to support Virtual STAs (hard)
+ *   10 Soft AP Stations (4 hard/6 virtual)
+ */
+
+#define HAL_INVALID_BSSIDX          HAL_NUM_BSSID+1
+#define HAL_NUM_UMA_DESC_ENTRIES    8
+#define MAX_NUM_OF_BACKOFFS         8
+
+#define IS_VALID_BSSIDX(__x) \
+                        ((__x) < HAL_NUM_BSSID)
+
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+#define HAL_NUM_ASSOC_STA           10
+#define HAL_NUM_STA                 14
+#define HAL_NUM_HW_STA              8
+#define HAL_NUM_GPSTA               2
+#define HAL_NUM_VSTA                HAL_NUM_STA - HAL_NUM_HW_STA
+
+#define QWLANFW_MAX_NUM_VSTA        HAL_NUM_VSTA
+#define QWLANFW_VSTA_INVALID_IDX    HAL_NUM_STA+1
+#define QWLAN_VSTA_MIN_IDX          HAL_NUM_HW_STA
+#define QWLANFW_NUM_GPSTA           HAL_NUM_GPSTA
+
+
+#define IS_VSTA_VALID_IDX(__x) \
+                          ((__x) != QWLANFW_VSTA_INVALID_IDX)
+
+#define IS_VSTA_IDX(__x) \
+                   (((__x) >= QWLAN_VSTA_MIN_IDX) && ((__x) < HAL_NUM_STA))
+
+                 
+// is the STA a General Purpose STA?
+#define IS_GPSTA_IDX(__x) \
+    (((__x) >= (HAL_NUM_HW_STA-HAL_NUM_GPSTA)) && \
+     ((__x) < HAL_NUM_HW_STA))
+
+// is the STA a HW STA (excluding GP STAs)
+#define IS_HWSTA_IDX(__x) \
+    ((__x) < (HAL_NUM_HW_STA-HAL_NUM_GPSTA))
+
+#else
+/*In prima 12 HW stations are supported including BCAST STA(staId 0)
+ and SELF STA(staId 1) so total ASSOC stations which can connect to Prima
+ SoftAP = 12 - 1(Self STa) - 1(Bcast Sta) = 10 Stations. */
+#define HAL_NUM_STA                 12
+#define HAL_NUM_ASSOC_STA           10
+#define HAL_NUM_HW_STA              12
+#endif
+
+/*
+ * From NOVA Mac Arch document
+ *  Encryp. mode    The encryption mode
+ *  000: Encryption functionality is not enabled
+ *  001: Encryption is set to WEP
+ *  010: Encryption is set to WEP 104
+ *  011: Encryption is set to TKIP
+ *  100: Encryption is set to AES
+ *  101 - 111: Reserved for future
+ */
+
+#define HAL_ENC_POLICY_NULL        0
+#define HAL_ENC_POLICY_WEP40       1
+#define HAL_ENC_POLICY_WEP104      2
+#define HAL_ENC_POLICY_TKIP        3
+#define HAL_ENC_POLICY_AES_CCM     4
+
+#define STACFG_MAX_TC   8
+
+#endif
+
+#endif
+
diff --git a/CORE/WDA/inc/legacy/palTypes.h b/CORE/WDA/inc/legacy/palTypes.h
new file mode 100644
index 0000000..31a590c
--- /dev/null
+++ b/CORE/WDA/inc/legacy/palTypes.h
@@ -0,0 +1,284 @@
+/*
+ * 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( PALTYPES_H__ )
+#define PALTYPES_H__
+
+/** ------------------------------------------------------------------------- * 
+    ------------------------------------------------------------------------- *  
+
+  
+    \file palTypes.h
+  
+    \brief Exports and types for the Platform Abstraction Layer typedefs.
+    These are common typedefs that can be used across Platforms (OS/compiler
+    and bus types).  All common code should adhere to these common types.
+  
+    $Id$ 
+  
+    Copyright (C) 2006 Airgo Networks, Incorporated
+  
+    ... description...
+  
+   ========================================================================== */
+#ifndef WINXP_APPS_BUILD
+#include "vos_types.h"
+#include "vos_api.h"
+#endif /* WINXP_APPS_BUILD */
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+#include "halLegacyPalTypes.h"
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#ifndef MK_IMAGE_HDR
+// values to check against for code that is Client/AP specific.  
+// the build will define one of the following: 
+// ANI_PRODUCT_TYPE_CLIENT 
+// ANI_PRODUCT_TYPE_AP
+// ANI_PRODUCT_TYPE_AP_SDK 
+//
+// Validate the Product type being built....
+//
+#if ( defined( ANI_PRODUCT_TYPE_CLIENT ) && ( defined( ANI_PRODUCT_TYPE_AP ) || defined( ANI_PRODUCT_TYPE_AP_SDK ) ) ) 
+#error "more than one ANI_PRODUCT_TYPE_xxx is defined for this build"
+
+#elif ( defined( ANI_PRODUCT_TYPE_AP ) && ( defined( ANI_PRODUCT_TYPE_CLIENT ) || defined( ANI_PRODUCT_TYPE_AP_SDK ) ) ) 
+#error "more than one ANI_PRODUCT_TYPE_xxx is defined for this build"
+
+#elif ( defined( ANI_PRODUCT_TYPE_AP_SDK ) && ( defined( ANI_PRODUCT_TYPE_CLIENT ) || defined( ANI_PRODUCT_TYPE_AP ) ) ) 
+#error "more than one ANI_PRODUCT_TYPE_xxx is defined for this build"
+
+#elif !( defined( ANI_PRODUCT_TYPE_CLIENT ) || defined( ANI_PRODUCT_TYPE_AP ) || defined( ANI_PRODUCT_TYPE_AP_SDK ) )
+#error "NONE of the ANI_PRODUCT_TYPE_xxxx are defined for this build"
+
+#endif
+
+
+//
+// Validate the Bus type being built....
+//
+#if defined(ANI_BUS_TYPE_PCI)
+
+#if defined( ANI_BUS_TYPE_PCIe ) || defined( ANI_BUS_TYPE_USB ) || defined(ANI_BUS_TYPE_SDIO) || defined( ANI_BUS_TYPE_PLATFORM )
+#error "more than one ANI_BUS_TYPE_xxx is defined for this build"
+#endif //
+
+#elif defined( ANI_BUS_TYPE_PCIe )
+
+#if defined( ANI_BUS_TYPE_PCI ) || defined( ANI_BUS_TYPE_USB ) || defined(ANI_BUS_TYPE_SDIO) || defined( ANI_BUS_TYPE_PLATFORM )
+#error "more than one ANI_BUS_TYPE_xxx is defined for this build"
+#endif
+
+#elif defined( ANI_BUS_TYPE_USB )
+
+#if defined( ANI_BUS_TYPE_PCIe ) || defined( ANI_BUS_TYPE_PCI ) || defined(ANI_BUS_TYPE_SDIO) || defined( ANI_BUS_TYPE_PLATFORM )
+#error "more than one ANI_BUS_TYPE_xxx is defined for this build"
+#endif
+
+#elif defined( ANI_BUS_TYPE_SDIO )
+
+#if defined( ANI_BUS_TYPE_PCIe ) || defined( ANI_BUS_TYPE_USB ) || defined(ANI_BUS_TYPE_PCI) || defined( ANI_BUS_TYPE_PLATFORM )
+#error "more than one ANI_BUS_TYPE_xxx is defined for this build"
+#endif
+
+#elif defined( ANI_BUS_TYPE_PLATFORM )
+
+#if defined( ANI_BUS_TYPE_PCIe ) || defined( ANI_BUS_TYPE_USB ) || defined(ANI_BUS_TYPE_PCI) || defined( ANI_BUS_TYPE_SDIO )
+#error "more than one ANI_BUS_TYPE_xxx is defined for this build"
+#endif
+
+#elif !( defined( ANI_BUS_TYPE_PCIe ) || defined( ANI_BUS_TYPE_USB ) || defined(ANI_BUS_TYPE_PCI) || defined(ANI_BUS_TYPE_SDIO) || defined( ANI_BUS_TYPE_PLATFORM ) )
+
+#error "NONE of the ANI_BUS_TYPE_xxx are defined for this build"
+
+#endif
+
+
+//
+// Validate the OS Type being built...
+//
+#if ( defined( ANI_OS_TYPE_WINDOWS ) && defined( ANI_OS_TYPE_LINUX ) && defined(ANI_OS_TYPE_OSX) && defined(ANI_OS_TYPE_AMSS) && \
+      defined( ANI_OS_TYPE_ANDROID ) )
+#error "more than one ANI_OS_TYPE_xxx is defined for this build"
+
+#elif !( defined( ANI_OS_TYPE_WINDOWS ) || defined( ANI_OS_TYPE_LINUX ) || defined(ANI_OS_TYPE_OSX) || defined(ANI_OS_TYPE_AMSS) \
+         || defined (ANI_OS_TYPE_ANDROID) )
+#error "NONE of the ANI_OS_TYPE_xxx are defined for this build"
+
+#endif
+
+
+//
+// Validate the compiler...
+//
+#if ( defined( ANI_COMPILER_TYPE_MSVC ) && defined( ANI_COMPILER_TYPE_GCC ) && defined( ANI_COMPILER_TYPE_RVCT ) ) 
+#error "more than one ANI_COMPILER_TYPE_xxx is defined for this build"
+
+#elif !( defined( ANI_COMPILER_TYPE_MSVC ) || defined( ANI_COMPILER_TYPE_GCC ) || defined( ANI_COMPILER_TYPE_RVCT ) )
+#error "NONE of the ANI_COMPILER_TYPE_xxx are defined for this build"
+
+#endif
+
+
+
+// some differences related to the compiler being used...
+#if defined ( ANI_COMPILER_TYPE_GCC )
+
+#define ANI_INLINE_FUNCTION static __inline__
+
+#elif defined( ANI_COMPILER_TYPE_MSVC )
+
+#define ANI_INLINE_FUNCTION __inline
+
+#elif defined( ANI_COMPILER_TYPE_RVCT )
+
+#define ANI_INLINE_FUNCTION INLINE
+
+#else 
+
+#error "invalid ANI_COMPILER_TYPE definition"
+
+#endif
+#endif
+
+
+
+
+// Common type definitions...
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+typedef unsigned char  tANI_U8;
+typedef   signed char  tANI_S8;
+
+typedef unsigned short tANI_U16;
+typedef   signed short tANI_S16;
+
+typedef unsigned long  tANI_U32;
+typedef   signed long  tANI_S32;
+
+#if defined ANI_OS_TYPE_WINDOWS
+typedef unsigned __int64 tANI_U64;
+#else
+typedef unsigned long long tANI_U64;
+#endif
+
+typedef tANI_U8 tANI_BYTE;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#if defined( ANI_OS_TYPE_WINDOWS )
+#if defined(_WIN64)
+ typedef unsigned __int64 tANI_U32_OR_PTR;
+#else
+ typedef unsigned long tANI_U32_OR_PTR;
+#endif
+#else
+typedef tANI_U32     tANI_U32_OR_PTR;
+#endif
+
+// Buffer address; could be virt or phys; could be 32- or 64-bit depending on compile option
+typedef tANI_U32_OR_PTR    tANI_BUFFER_ADDR;
+// which boolean is the most usefule...or both ?
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+typedef tANI_U8 tANI_BOOLEAN;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+typedef enum tagAniBoolean 
+{
+    eANI_BOOLEAN_FALSE = 0,
+    eANI_BOOLEAN_TRUE,
+    
+    eANI_BOOLEAN_OFF = 0,
+    eANI_BOOLEAN_ON = 1,
+} eAniBoolean;
+
+
+
+//
+// MAC address data type...
+//
+// review the usefulness of this type.  I suspect this type is not
+// real useful unless we provide some 'helper' functions to manage 
+// the MAC addresses.
+//
+#define ANI_MAC_ADDR_SIZE ( 6 )
+typedef tANI_U8 tAniMacAddr[ ANI_MAC_ADDR_SIZE ];
+
+
+
+
+
+/** ------------------------------------------------------------------------- * 
+
+    \typedef tHddHandle
+    
+    \brief Handle to the HDD.  The HDD handle is given to the HAL from 
+    the HDD on halOpen.  The HDD handle is an input to all HDD/PAL function
+    calls and represents an opaque handle to the HDD instance that is tied
+    to the HAL instance, opened through halOpen.  
+    
+    The HDD must be able to derive it's internal instance structure pointer
+    through this handle.  hint hint...
+    
+    -------------------------------------------------------------------------- */
+typedef void *tHddHandle;
+// define a value for an invalid HAL handle.....
+#define HDD_INVALID_HDD_HANDLE ( NULL )
+
+
+// For packet classification routines
+#define PAL_BIT_MASK(offset)         (1 << (offset))
+#define PAL_PKT_FLD_DSCP_OFFSET      0
+#define PAL_PKT_FLD_8021P_OFFSET     1
+
+#define PAL_PKT_FLD_DSCP_MASK     PAL_BIT_MASK(PAL_PKT_FLD_DSCP_OFFSET)
+#define PAL_PKT_FLD_8021P_MASK    PAL_BIT_MASK(PAL_PKT_FLD_8021P_OFFSET)
+
+#if defined( ANI_OS_TYPE_WINDOWS ) || defined (ANI_OS_TYPE_OSX)
+    #define PAL_PKT_FLD_8021P_BIT_OFFSET 0
+#elif defined( ANI_OS_TYPE_LINUX )
+    #define PAL_PKT_FLD_8021P_BIT_OFFSET 5
+#elif defined( ANI_OS_TYPE_AMSS )
+    #define PAL_PKT_FLD_8021P_BIT_OFFSET 0
+#endif
+
+
+/*
+This represent an object for a spin lock and it is platform dependant
+*/
+//User of this variable must initialize it to PAL_INVALID_SPINLOCK_HANDLE in order for validation to work.
+typedef void * tPalSpinLockHandle;
+   
+#define PAL_INVALID_SPINLOCK_HANDLE (NULL)
+
+/*
+ * This represent an object for a semaphore and it is platform dependant
+ */
+typedef void * tPalSemaphoreHandle;
+
+
+#define PAL_TICKS_PER_SECOND        100
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+typedef tANI_U32 tANI_TIMESTAMP;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+#endif
diff --git a/CORE/WDA/inc/legacy/wlan_qct_hal.h b/CORE/WDA/inc/legacy/wlan_qct_hal.h
new file mode 100644
index 0000000..6117279
--- /dev/null
+++ b/CORE/WDA/inc/legacy/wlan_qct_hal.h
@@ -0,0 +1,592 @@
+/*
+ * 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, Inc proprietary. All rights reserved.
+ *
+ * Date            Modified by    Modification Information
+ * --------------------------------------------------------------------
+ */
+#ifndef WLAN_QCT_HAL_H
+#define WLAN_QCT_HAL_H
+#include "vos_status.h"
+#include "halTypes.h"
+#ifndef PALTYPES_H__
+
+
+/// unsigned 8-bit types
+#define tANI_U8        v_U8_t
+ 
+/// unsigned 16-bit types
+#define tANI_U16    v_U16_t    
+
+/// unsigned 32-bit types
+#define tANI_U32    v_U32_t
+ 
+/// signed 8-bit types
+#define    tANI_S8        v_S7_t
+ 
+/// signed 16-bit types
+#define tANI_S16    v_S15_t
+ 
+/// signed 32-bit types
+#define tANI_S32    v_S31_t
+
+#define eHalStatus    VOS_STATUS
+
+#endif
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+#include "halBdDefs.h"
+#endif
+#define QWLAN_HAL_DXE0_MASTERID  5
+
+typedef struct sHalBdGeneric {
+    /* 0x00 */
+    // ENDIAN BEGIN
+    tANI_U32 dpuRF : 8;
+    tANI_U32 dpuSignature:3;     /* Signature on RA's DPU descriptor */
+    tANI_U32 staSignature:3;
+    tANI_U32 reserved : 14;
+    tANI_U32 dpuNE : 1;
+    tANI_U32 dpuNC : 1;
+    tANI_U32 bdt : 2;                        /* BD type */
+    // ENDIAN END
+
+    /* 0x04 */
+    // ENDIAN BEGIN
+    tANI_U32 reserved1:32;                      
+    // ENDIAN END
+
+
+    /* 0x08 */
+    // ENDIAN BEGIN
+    tANI_U32 headPduIdx : 16;                /* Head PDU index */
+    tANI_U32 tailPduIdx : 16;                /* Tail PDU index */
+    // ENDIAN END
+
+    /* 0x0c */
+    // ENDIAN BEGIN
+    tANI_U32 mpduHeaderLength : 8;           /* MPDU header length */
+    tANI_U32 mpduHeaderOffset : 8;           /* MPDU header start offset */
+    tANI_U32 mpduDataOffset : 9;             /* MPDU data start offset */
+    tANI_U32 pduCount : 7;                   /* PDU count */
+    // ENDIAN END
+
+    /* 0x10 */
+    // ENDIAN BEGIN
+    tANI_U32 mpduLength : 16;                /* MPDU length */
+    tANI_U32 reserved3:4;            /* DPU compression feedback */
+    tANI_U32 tid : 4;                        /* Traffic identifier, tid */
+    tANI_U32 rateIndex : 8;
+    // ENDIAN END
+
+    /* 0x14 */
+    // ENDIAN BEGIN
+    tANI_U32 dpuDescIdx : 8;
+    tANI_U32 addr1Index : 8;  //A1 index after RxP binary search
+    tANI_U32 addr2Index : 8;  //A2 index after RxP binary search
+    tANI_U32 addr3Index : 8;  //A3 index after RxP binary search
+    // ENDIAN END
+//}__ani_attr_packed __ani_attr_aligned_4 tHalBdGeneric, *tpHalBdGeneric;
+} tHalBdGeneric, *tpHalBdGeneric;
+
+
+/*
+ * PDU without BD
+ */
+
+typedef struct sHalPdu {
+    tANI_U8 payload[124];
+    tANI_U32 nextPduIdx;                     /* LSB 16 bits */
+//} __ani_attr_packed __ani_attr_aligned_4 tHalPdu, *tpHalPdu;
+} tHalPdu, *tpHalPdu;
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+/* UAPSD parameters passed per AC to HAL from TL */
+typedef struct sUapsdInfo {
+    tANI_U8  staidx;        // STA index
+    tANI_U8  ac;            // Access Category
+    tANI_U8  up;            // User Priority
+    tANI_U32 srvInterval;   // Service Interval
+    tANI_U32 susInterval;   // Suspend Interval
+    tANI_U32 delayInterval; // Delay Interval
+} tUapsdInfo, tpUapsdInfo;
+#endif
+
+#define HAL_TXBD_BDRATE_DEFAULT 0
+#define HAL_TXBD_BDRATE_FIRST   1
+#define HAL_TXBD_BDRATE_SECOND  2
+#define HAL_TXBD_BDRATE_THIRD   3
+
+#define HAL_FRAME_TYPE_MASK     0x30
+#define HAL_FRAME_TYPE_OFFSET   0x4
+#define HAL_FRAME_SUBTYPE_MASK  0x0F
+
+#define HAL_TXBD_BD_SSN_FILL_HOST             0
+#define HAL_TXBD_BD_SSN_FILL_DPU_NON_QOS    1
+#define HAL_TXBD_BD_SSN_FILL_DPU_QOS        2
+
+#define HAL_ACKPOLICY_ACK_REQUIRED        0
+#define HAL_ACKPOLICY_ACK_NOTREQUIRED    1
+
+#define HAL_BDRATE_BCDATA_FRAME            1
+#define HAL_BDRATE_BCMGMT_FRAME            2
+#define HAL_BDRATE_CTRL_FRAME            3
+    
+/* Default values for FillTx BD */
+#define HAL_DEFAULT_UNICAST_ENABLED     1
+#define HAL_RMF_DISABLED                 0
+#define HAL_RMF_ENABLED                 1
+#define HAL_NO_ENCRYPTION_DISABLED        0
+#define HAL_NO_ENCRYPTION_ENABLED         1
+    
+#define WLANHAL_RX_BD_ADDR3_SELF_IDX      0
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+// Should not use tHalTxBd nor tHalRxBd. UMAC doesn't know these HAL structure.
+#define WLANHAL_TX_BD_HEADER_SIZE 40
+#define WLANHAL_RX_BD_HEADER_SIZE 76
+#else
+#define WLANHAL_TX_BD_HEADER_SIZE        sizeof(tHalTxBd)
+#define WLANHAL_RX_BD_HEADER_SIZE        sizeof(tHalRxBd)
+#endif
+
+
+#define WLANHAL_RX_BD_HEADER_OFFSET       0
+
+#define WLANHAL_RX_BD_GET_MPDU_H_OFFSET( _pvBDHeader )   (((tpHalRxBd)_pvBDHeader)->mpduHeaderOffset)
+
+#define WLANHAL_RX_BD_GET_MPDU_D_OFFSET( _pvBDHeader )   (((tpHalRxBd)_pvBDHeader)->mpduDataOffset)
+
+#define WLANHAL_RX_BD_GET_MPDU_LEN( _pvBDHeader )        (((tpHalRxBd)_pvBDHeader)->mpduLength)
+
+#define WLANHAL_RX_BD_GET_MPDU_H_LEN( _pvBDHeader )      (((tpHalRxBd)_pvBDHeader)->mpduHeaderLength)
+
+#define WLANHAL_RX_BD_GET_FT( _pvBDHeader )        (((tpHalRxBd)_pvBDHeader)->ft)
+
+#define WLANHAL_RX_BD_GET_LLC( _pvBDHeader )        (((tpHalRxBd)_pvBDHeader)->llc)
+
+#define WLANHAL_RX_BD_GET_TID( _pvBDHeader )        (((tpHalRxBd)_pvBDHeader)->tid)
+
+#define WLANHAL_RX_BD_GET_ASF( _pvBDHeader )        (((tpHalRxBd)_pvBDHeader)->asf)
+
+#define WLANHAL_RX_BD_GET_AEF( _pvBDHeader )           (((tpHalRxBd)_pvBDHeader)->aef)
+
+#define WLANHAL_RX_BD_GET_LSF( _pvBDHeader )           (((tpHalRxBd)_pvBDHeader)->lsf)
+
+#define WLANHAL_RX_BD_GET_ESF( _pvBDHeader )           (((tpHalRxBd)_pvBDHeader)->esf)
+
+#define WLANHAL_RX_BD_GET_STA_ID( _pvBDHeader )     (((tpHalRxBd)_pvBDHeader)->addr2Index)
+#define WLANHAL_RX_BD_GET_ADDR3_IDX( _pvBDHeader )     (((tpHalRxBd)_pvBDHeader)->addr3Index)
+#define WLANHAL_RX_BD_GET_ADDR1_IDX( _pvBDHeader )     (((tpHalRxBd)_pvBDHeader)->addr1Index)
+
+#define WLANHAL_TX_BD_GET_TID( _pvBDHeader )           (((tpHalTxBd)_pvBDHeader)->tid)
+#define WLANHAL_TX_BD_GET_STA_ID( _pvBDHeader )    (((tpHalTxBd)_pvBDHeader)->staIndex)
+
+#define WLANHAL_RX_BD_GET_DPU_SIG( _pvBDHeader )   (((tpHalRxBd)_pvBDHeader)->dpuSignature)
+
+#ifdef WLAN_SOFTAP_FEATURE
+#define WLANHAL_FC_RX_BD_REPORT_CONTENT_SIZE        2*HAL_NUM_STA*sizeof(tANI_U8)   // size of fcSTATxQLen[HAL_NUM_STA]+fcSTACurTxRate[HAL_NUM_STA]
+#define WLANHAL_FC_TX_BD_HEADER_SIZE                sizeof(tHalFcTxBd)
+#define WLANHAL_RX_BD_GET_FC( _pvBDHeader )                      (((tpHalFcRxBd)_pvBDHeader)->fc)
+#define WLANHAL_RX_BD_GET_RX_TIME_STAMP( _pvBDHeader )           (((tpHalFcRxBd)_pvBDHeader)->mclkRxTimestamp)
+#define WLANHAL_RX_BD_GET_STA_VALID_MASK( _pvBDHeader )          (((tpHalFcRxBd)_pvBDHeader)->fcSTAValidMask)
+#define WLANHAL_RX_BD_GET_STA_PS_STATE( _pvBDHeader )            (((tpHalFcRxBd)_pvBDHeader)->fcSTAPwrSaveStateMask)
+#define WLANHAL_RX_BD_GET_STA_TH_IND( _pvBDHeader )              (((tpHalFcRxBd)_pvBDHeader)->fcSTAThreshIndMask)
+#define WLANHAL_RX_BD_GET_STA_TXQ_STATUS( _pvBDHeader )          (((tpHalFcRxBd)_pvBDHeader)->fcSTATxQStatus)
+#define WLANHAL_RX_BD_GET_STA_TXQ_LEN( _pvBDHeader, staIdx )     (((tpHalFcRxBd)_pvBDHeader)->fcSTATxQLen[staIdx])
+#define WLANHAL_RX_BD_GET_STA_CUR_TX_RATE( _pvBDHeader, staIdx ) (((tpHalFcRxBd)_pvBDHeader)->fcSTACurTxRate[staIdx])
+
+#define WLANHAL_TX_BD_GET_RMF(_pvBDHeader)          (((tpHalRxBd)_pvBDHeader)->rmf)
+
+#define WLANHAL_TX_BD_GET_UB(_pvBDHeader)           (((tpHalRxBd)_pvBDHeader)->ub)
+
+#define WLANHAL_RX_BD_GET_RMF(_pvBDHeader)          (((tpHalRxBd)_pvBDHeader)->rmf)
+
+#define WLANHAL_RX_BD_GET_UB(_pvBDHeader)           (((tpHalRxBd)_pvBDHeader)->ub)
+
+#define WLANHAL_RX_BD_GET_RATEINDEX(_pvBDHeader)    (((tpHalRxBd)_pvBDHeader)->rateIndex)
+
+#define WLANHAL_RX_BD_GET_TIMESTAMP(_pvBDHeader)    (((tpHalRxBd)_pvBDHeader)->mclkRxTimestamp)
+
+#define tHalFcRxBd       halFcRxBd_type             
+#define tpHalFcRxBd      phalFcRxBd_type
+#define tHalFcTxBd       halFcTxBd_type
+#define tpHalFcTxBd      pHalFcTxBd_type              
+#define tHalFcTxParams   tFcTxParams_type
+#define tHalFcRxParams   tFcRxParams_type               
+#define tpHalFcTxParams  pFcTxParams_type               
+#define tpHalFcRxParams  pFcRxParams_type             
+#endif
+
+/*------------ RSSI and SNR Information extraction -------------*/
+#define WLANHAL_RX_BD_GET_RSSI0( _pvBDHeader )  \
+    (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 24) & 0xff)
+#define WLANHAL_RX_BD_GET_RSSI1( _pvBDHeader )  \
+    (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 16) & 0xff)
+#define WLANHAL_RX_BD_GET_RSSI2( _pvBDHeader )  \
+    (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 0) & 0xff)
+#define WLANHAL_RX_BD_GET_RSSI3( _pvBDHeader )  \
+    ((((tpHalRxBd)_pvBDHeader)->phyStats0) & 0xff)
+
+// Get the average of the 4 values.
+#define WLANHAL_GET_RSSI_AVERAGE( _pvBDHeader ) \
+    (((WLANHAL_RX_BD_GET_RSSI0(_pvBDHeader)) + \
+    (WLANHAL_RX_BD_GET_RSSI1(_pvBDHeader)) + \
+    (WLANHAL_RX_BD_GET_RSSI2(_pvBDHeader)) + \
+    (WLANHAL_RX_BD_GET_RSSI3(_pvBDHeader))) / 4)
+
+// Get the SNR value from PHY Stats
+#define WLANHAL_RX_BD_GET_SNR( _pvBDHeader )    \
+    (((((tpHalRxBd)_pvBDHeader)->phyStats1) >> 24) & 0xff)
+/*-----------------------------------------------------------------*/
+#define WLANHAL_RX_BD_GET_DPU_SIG( _pvBDHeader )   (((tpHalRxBd)_pvBDHeader)->dpuSignature)
+
+
+#define WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( _bd, _off )        (((tpHalTxBd)_bd)->mpduDataOffset = _off)
+ 
+#define WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( _bd, _off )    (((tpHalTxBd)_bd)->mpduHeaderOffset = _off)
+
+#define WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( _bd, _len )        (((tpHalTxBd)_bd)->mpduHeaderLength = _len)
+
+#define WLANHAL_TX_BD_SET_MPDU_LEN( _bd, _len )                (((tpHalTxBd)_bd)->mpduLength = _len)
+
+#define WLANHAL_RX_BD_GET_BA_OPCODE(_pvBDHeader)        (((tpHalRxBd)_pvBDHeader)->reorderOpcode)
+
+#define WLANHAL_RX_BD_GET_BA_FI(_pvBDHeader)            (((tpHalRxBd)_pvBDHeader)->reorderFwdIdx)
+
+#define WLANHAL_RX_BD_GET_BA_SI(_pvBDHeader)            (((tpHalRxBd)_pvBDHeader)->reorderSlotIdx)
+
+#define WLANHAL_RX_BD_GET_BA_CSN(_pvBDHeader)           (((tpHalRxBd)_pvBDHeader)->currentPktSeqNo)
+
+#define WLANHAL_RX_BD_GET_BA_ESN(_pvBDHeader)           (((tpHalRxBd)_pvBDHeader)->expectedPktSeqNo)
+
+#define WLANHAL_RX_BD_GET_RXP_FLAGS(_pvBDHeader)            (((tpHalRxBd)_pvBDHeader)->rxpFlags)
+
+#define WLANHAL_RX_BD_GET_TYPE_SUBTYPE(_pvBDHeader)            (((tpHalRxBd)_pvBDHeader)->frameTypeSubtype)
+#define WLANHAL_RX_BD_SET_TYPE_SUBTYPE( _bd, _typeSubtype )        (((tpHalRxBd)_bd)->frameTypeSubtype = _typeSubtype)
+
+#ifdef  WLAN_HAL_VOLANS 
+/*Macros to extract 48-bit replay counter when replay check is done at host in volans*/
+#define WLANHAL_RX_BD_GET_PMICMD_20TO23(_pvBDHeader)      ((((tpHalRxBd)_pvBDHeader)->pmiCmd4to23[4])) 
+#define WLANHAL_RX_BD_GET_UC_BC( _pvBDHeader )            (((tpHalRxBd)_pvBDHeader)->ub)
+#define WLANHAL_RX_BD_GET_PMICMD_24TO25(_pvBDHeader)      ((((tpHalRxBd)_pvBDHeader)->pmiCmd24to25))
+#endif
+
+#define WLANHAL_RX_BD_ASF_SET                1 /*The value of the field when set and pkt is AMSDU*/
+
+#define WLANHAL_RX_BD_FSF_SET               1
+
+#define WLANHAL_RX_BD_LSF_SET               1
+
+#define WLANHAL_RX_BD_AEF_SET               1
+
+ 
+#define WLANHAL_RX_BD_LLC_PRESENT            0 /*The value of the field when LLC is present*/
+
+#define WLANHAL_RX_BD_FT_DONE                  1 /* The value of the field when frame xtl was done*/
+
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC 
+//Check whether a RX frame is unprotected over the air
+#if defined(LIBRA_WAPI_SUPPORT)
+#define WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(_pvBDHeader)  \
+        (((tpHalRxBd)_pvBDHeader)->uef)
+
+#else
+#define WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(_pvBDHeader)  \
+        (DPU_FEEDBACK_WPI_UNPROTECTED == ((tpHalRxBd)_pvBDHeader)->dpuFeedback)
+#endif
+#else
+/*DPU_FEEDBACK_WPI_UNPROTECTED macro defined in volansdefs.h which is not available
+  for UMAC in prima so declared it here */
+#define DPU_FEEDBACK_WPI_UNPROTECTED 0x20   
+#define WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(_pvBDHeader)  \
+        (DPU_FEEDBACK_WPI_UNPROTECTED == ((WDI_RxBdType *)_pvBDHeader)->dpuFeedback)
+#endif
+
+/*==========================================================================
+
+  FUNCTION    WLANHAL_RxBD_GetFrameTypeSubType
+
+  DESCRIPTION 
+    Called by TL to retrieve the type/subtype of the received frame.
+
+  DEPENDENCIES 
+    TL should pass a valid RxBD buffer pointer.
+    
+  PARAMETERS 
+
+    IN
+    pvBDHeader:    Void pointer to the RxBD buffer.
+    usFrmCtrl:the frame ctrl of the 802.11 header 
+   
+  RETURN VALUE
+    A byte which contains both type and subtype info. LSB four bytes (b0 to b3)
+    is subtype and b5-b6 is type info. 
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+
+tANI_U8 WLANHAL_RxBD_GetFrameTypeSubType(v_PVOID_t _pvBDHeader, tANI_U16 usFrmCtrl);
+
+
+#define HAL_TXCOMP_REQUESTED_MASK           0x1  //bit 0 for TxComp intr requested. 
+#define HAL_USE_SELF_STA_REQUESTED_MASK     0x2  //bit 1 for STA overwrite with selfSta Requested.
+#define HAL_TX_NO_ENCRYPTION_MASK           0x4  //bit 2. If set, the frame is not to be encrypted
+#if defined(LIBRA_WAPI_SUPPORT)
+#define HAL_WAPI_STA_MASK            0x8  //bit 3. If set, this frame is for WAPI station
+#endif
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+#define HAL_TRIGGER_ENABLED_AC_MASK         0x10 //bit 4 for data frames belonging to trigger enabled AC
+#endif
+#define HAL_USE_NO_ACK_REQUESTED_MASK       0x20
+
+#define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames
+
+/*==========================================================================
+
+  FUNCTION    WLANHAL_FillTxBd
+
+  DESCRIPTION 
+    Called by PE to register as a client for management frames delivery. 
+
+  DEPENDENCIES 
+    TL must be initialized before this API can be called. 
+    
+  PARAMETERS 
+
+    IN
+    pAdapter:       pointer to the global adapter context;a handle to TL's 
+                    control block can be extracted from its context 
+    vosFrmBuf:     pointer to a vOSS buffer containing the management  
+                    frame to be transmitted
+    usFrmLen:       the length of the frame to be transmitted; information 
+                    is already included in the vOSS buffer
+    wFrmType:       the type of the frame being transmitted
+    tid:            tid used to transmit this frame
+    pfnCompTxFunc:  function pointer to the transmit complete routine
+    voosBDHeader:   pointer to the BD header
+    txFlag:  can have appropriate bit setting as required
+    
+                #define HAL_TXCOMP_REQUESTED_MASK           0x1  //bit 0 for TxComp intr requested. 
+                #define HAL_USE_SELF_STA_REQUESTED_MASK    0x2  //bit 1 for STA overwrite with selfSta Requested.
+                #define HAL_TX_NO_ENCRYPTION_MASK           0x4  //bit 2. If set, the frame is not to be encrypted
+#if defined(FEATURE_WLAN_WAPI)
+                #define HAL_WAPI_STA_MASK            0x8  //bit 3. If set, this frame is for WAPI station
+#endif
+                
+    uTimestamp:     pkt timestamp
+
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WLANHAL_FillTxBd(void *pAdaptor, tANI_U8 typeSubtype, void *pDestMacAddr, void *pAddr2,
+        tANI_U8* ptid, tANI_U8 disableFrmXtl, void *pTxBd, tANI_U8 txFlag, tANI_U32 timeStamp);
+
+#ifdef WLAN_SOFTAP_FEATURE
+VOS_STATUS WLANHAL_FillFcTxBd(void *pVosGCtx, void *pFcParams, void *pFcTxBd);
+/** To swap the report part of FC RxBD */
+void WLANHAL_SwapFcRxBd(tANI_U8 *pBd);
+#endif
+
+/* To swap the data */
+void WLANHAL_Swap32Bytes(tANI_U8* pData, tANI_U32 size);
+
+/** To swap the RxBD */
+void WLANHAL_SwapRxBd(tANI_U8 *pBd);
+void WLANHAL_RxAmsduBdFix(void *pVosGCtx,v_PVOID_t _pvBDHeader);
+
+#ifdef WLAN_PERF
+tANI_U32 WLANHAL_TxBdFastFwd(void *pAdaptor, tANI_U8 *pDestMac, tANI_U8 tid, tANI_U8 unicastDst,  void *pTxBd, tANI_U16);
+#endif
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+VOS_STATUS WLANHAL_EnableUapsdAcParams(void* pVosGCtx, tANI_U8 staIdx, tUapsdInfo *pUapsdInfo);
+VOS_STATUS WLANHAL_DisableUapsdAcParams(void* pVosGCtx, tANI_U8 staIdx, tANI_U8 ac);
+#endif
+
+VOS_STATUS WLANHAL_EnableIdleBdPduInterrupt(void* pVosGCtx, tANI_U8 idleBdPduThreshold);
+
+#ifdef FEATURE_ON_CHIP_REORDERING
+tANI_U8 WLANHAL_IsOnChipReorderingEnabledForTID(void* pVosGCtx, tANI_U8 staIdx, tANI_U8 tid);
+#endif
+
+#ifdef WLAN_SOFTAP_VSTA_FEATURE
+v_BOOL_t WLANHAL_IsHwFrameTxTranslationCapable(v_PVOID_t pVosGCtx, tANI_U8 staIdx);
+#endif
+
+#define tHalRxBd    halRxBd_type
+#define tpHalRxBd    phalRxBd_type
+
+#define tHalTxBd    halTxBd_type
+#define tpHalTxBd    pHalTxBd_type
+
+#ifdef BA_PARAM_STRUCTURE
+#else
+#define BA_PARAM_STRUCTURE
+//
+// HAL --> TL
+// Messages indicating the setup and/or teardown of
+// A-MPDU/BA sessions with a given peer HT MAC entity
+//
+
+//
+// A data structure identifying all of the variables
+// in a typical A-MPDU/BA setup
+//
+typedef struct sBAParams
+{
+
+  // A unique BA Session ID that has been assigned by HAL
+  // for the curent BA Session
+  tANI_U16 baSessionID;
+
+  // TID for which the BA session has been setup
+  tANI_U8 baTID;
+
+  // BA Buffer Size allocated for the current BA session   //Should be deleted. needs TL change. use winSize instead
+  tANI_U8 baBufferSize;
+
+  tANI_U16 SSN;
+  tANI_U8 winSize;
+  tANI_U8 STAID;
+
+} tBAParams, *tpBAParams;
+
+//
+// TL -> HAL
+// tSirMsgQ.type = SIR_HAL_HDD_ADDBA_RSP
+//
+typedef struct sAddBARsp
+{
+  // Message Type
+  tANI_U16 mesgType;
+
+  // Message Length
+  tANI_U16 mesgLen;
+
+  //BA session ID
+  tANI_U16 baSessionID;
+
+  tANI_U16 replyWinSize;
+}tAddBARsp, *tpAddBARsp;
+
+//
+// HAL -> TL
+// tSirMsgQ.type = SIR_HAL_ADDBA_IND
+// tSirMsgQ.reserved = 0
+// tSirMsgQ.body = "allocated" instance of tpAddBAInd
+//
+typedef struct sAddBAInd
+{
+
+  // Message Type
+  tANI_U16 mesgType;
+
+  // Message Length
+  tANI_U16 mesgLen;
+
+  tBAParams baSession;
+
+} tAddBAInd, *tpAddBAInd;
+
+//
+// HAL -> TL
+// tSirMsgQ.type = SIR_HAL_DELBA_IND
+// tSirMsgQ.reserved = 0
+// tSirMsgQ.body = "allocated" instance of tpDelBAInd
+//
+// TL -> HAL
+// tSirMsgQ.type = SIR_HAL_BA_FAIL_IND
+// tSirMsgQ.reserved = 0
+// tSirMsgQ.body = "allocated" instance of tpDelBAInd
+//
+typedef struct sDelBAInd
+{
+  tANI_U8 staIdx;
+
+  tANI_U8 baTID;
+  // Message Type
+  tANI_U16 mesgType;
+
+  // Message Length
+  tANI_U16 mesgLen;
+
+} tDelBAInd, *tpDelBAInd;
+#endif
+
+/*===============================================
+ *
+ *  TL <-> HAL structures 
+ *
+ *===============================================
+ */
+//
+// TL -> HAL 
+// tSirMsgQ.type = SIR_HAL_TL_FLUSH_AC_REQ
+//
+typedef struct sFlushACReq
+{
+    // Message Type
+    tANI_U16 mesgType;
+
+    // Message Length
+    tANI_U16 mesgLen;
+
+    // Station Index. originates from HAL
+    tANI_U8  ucSTAId;
+
+    // TID for which the transmit queue is being flushed 
+    tANI_U8   ucTid;
+
+} tFlushACReq, *tpFlushACReq;
+
+//
+//
+// HAL -> TL 
+// tSirMsgQ.type = SIR_HAL_TL_FLUSH_AC_RSP
+//
+typedef struct sFlushACRsp
+{
+    // Message Type
+    tANI_U16 mesgType;
+
+    // Message Length
+    tANI_U16 mesgLen;
+
+    // Station Index. originates from HAL
+    tANI_U8  ucSTAId;
+
+    // TID for which the transmit queue is being flushed 
+    tANI_U8   ucTid;
+
+    // status of the Flush operation 
+    tANI_U8 status;
+} tFlushACRsp, *tpFlushACRsp;
+
+#endif
+
diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h
new file mode 100644
index 0000000..4a0fa59
--- /dev/null
+++ b/CORE/WDA/inc/wlan_qct_wda.h
@@ -0,0 +1,2025 @@
+/*
+ * 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 WLAN_QCT_WDA_H
+#define WLAN_QCT_WDA_H
+
+/*===========================================================================
+
+               W L A N   DEVICE ADAPTATION   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan adaptation layer for Prima
+  and Volans.
+
+  For Volans this layer is actually a thin layer that maps all WDA messages and
+  functions to equivalent HAL messages and functions. The reason this layer was introduced
+  was to keep the UMAC identical across Prima and Volans. This layer provides the glue 
+  between SME, PE , TL and HAL.
+  
+  Copyright (c) 2008 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
+--------    ---         ----------------------------------------------
+10/05/2011  haparna     Adding support for Keep Alive Feature
+01/27/2011  rnair       Adding WDA support for Volans.
+12/08/2010  seokyoun    Move down HAL interfaces from TL to WDA
+                        for UMAC convergence btween Volans/Libra and Prima
+08/25/2010  adwivedi    WDA Context and exposed API's 
+=========================================================================== */
+
+#include "aniGlobal.h"
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
+#  include "wlan_qct_wdi_ds.h"
+
+#else 
+
+#  include "sirParams.h"
+#  include "limGlobal.h" 
+#  include "halTypes.h"
+#  include "wlan_qct_bal.h"
+#  include "wlan_qct_hal.h" 
+/* This header is for ADD and remove BA session */
+#  include "halCommonApi.h"
+
+#endif
+
+/* Add Include */
+
+typedef enum
+{
+   WDA_INIT_STATE,
+   WDA_START_STATE,
+   WDA_READY_STATE,
+   WDA_PRE_ASSOC_STATE,
+   WDA_BA_UPDATE_TL_STATE,
+   WDA_BA_UPDATE_LIM_STATE,
+   WDA_STOP_STATE,
+   WDA_CLOSE_STATE
+}WDA_state;
+
+typedef enum
+{
+   WDA_PROCESS_SET_LINK_STATE,
+   WDA_IGNORE_SET_LINK_STATE
+}WDA_processSetLinkStateStatus;
+
+typedef enum
+{
+   WDA_DISABLE_BA,
+   WDA_ENABLE_BA
+}WDA_BaEnableFlags;
+
+typedef enum
+{
+   WDA_INVALID_STA_INDEX,
+   WDA_VALID_STA_INDEX
+}WDA_ValidStaIndex;
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+#if !defined( VOS_MQ_ID_WDA )
+#define VOS_MQ_ID_WDA VOS_MQ_ID_HAL
+#endif
+#endif
+/*--------------------------------------------------------------------------
+  Utilities
+ --------------------------------------------------------------------------*/
+
+#define WDA_TLI_CEIL( _a, _b)  (( 0 != (_a)%(_b))? (_a)/(_b) + 1: (_a)/(_b))
+
+/*
+ * Check the version number and find if MCC feature is supported or not
+ */
+#define IS_MCC_SUPPORTED (WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual( 0, 1, 1, 0))
+
+/*--------------------------------------------------------------------------
+  Definitions for Data path APIs
+ --------------------------------------------------------------------------*/
+
+/*As per 802.11 spec */
+#define WDA_TLI_MGMT_FRAME_TYPE       0x00
+#define WDA_TLI_CTRL_FRAME_TYPE       0x10
+#define WDA_TLI_DATA_FRAME_TYPE       0x20
+
+/*802.3 header definitions*/
+#define  WDA_TLI_802_3_HEADER_LEN             14
+/*802.11 header definitions - header len without QOS ctrl field*/
+#define  WDA_TLI_802_11_HEADER_LEN            24
+
+/*Determines the header len based on the disable xtl field*/
+#define WDA_TLI_MAC_HEADER_LEN( _dxtl)                \
+      ( ( 0 == _dxtl )?                               \
+         WDA_TLI_802_3_HEADER_LEN:WDA_TLI_802_11_HEADER_LEN )
+
+/* TX channel enum type:
+      
+   We have five types of TX packets so far and want to block/unblock each 
+   traffic individually according to,  for example, low resouce condition. 
+   Define five TX channels for UMAC here. WDA can map these logical
+   channels to physical DXE channels if needed.
+*/
+typedef enum
+{
+   WDA_TXFLOW_AC_BK = 0,
+   WDA_TXFLOW_AC_BE = 1,
+   WDA_TXFLOW_AC_VI = 2,
+   WDA_TXFLOW_AC_VO = 3,
+   WDA_TXFLOW_MGMT  = 4,
+   WDA_TXFLOW_BAP   = 1, /* BAP is sent as BE */
+   WDA_TXFLOW_FC    = 1, /* FC is sent as BE  */
+   WDA_TXFLOW_MAX
+} WDA_TXFlowEnumType;
+
+#define WDA_TXFLOWMASK  0x1F /* 1~4bit:low priority ch / 5bit: high */
+
+/* ---------------------------------------------------------------------
+   Libra and Volans specifics
+
+   TODO Consider refactoring it and put it into two separate headers, 
+   one for Prima and one for Volans 
+
+   feturized with FEATURE_WLAN_INTEGRATED_SOC for Prima
+ ----------------------------------------------------------------------*/
+
+/* For backward compatability with SDIO. It's BAL header size for SDIO
+   interface. It's nothing for integrated SOC */
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define WDA_DXE_HEADER_SIZE   0
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+#define WDA_DXE_HEADER_SIZE   WLAN_BAL_DXE_HEADER_SIZE
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+/*Libra PDU size*/
+#define WDA_TLI_PDU_RES_SIZE                 124
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/*Minimum resources needed - arbitrary*/
+
+/*DXE + SD*/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define WDA_WLAN_LIBRA_HEADER_LEN              20+8
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+#define WLAN_LIBRA_HEADER_LEN              20+8
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define WDA_TLI_BD_PDU_RESERVE_THRESHOLD    10
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+#define WDA_TLI_BD_PDU_RESERVE_THRESHOLD    150
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_TLI_MIN_RES_MF   1
+#  define WDA_TLI_MIN_RES_BAP  2
+#  define WDA_TLI_MIN_RES_DATA 3
+#else
+#  define WDA_TLI_MIN_RES_MF   13 /*Keeping for MF*/
+#  define WDA_TLI_MIN_RES_BAP  WDA_TLI_MIN_RES_MF  + 13 /*Another for BAP*/
+#  define WDA_TLI_MIN_RES_DATA WDA_TLI_MIN_RES_BAP + 13 /*Min 12 for data*/
+#  define WLANTL_TH_RES_DATA                        254
+#endif
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_NUM_STA 8
+#else
+#  define WDA_NUM_STA HAL_NUM_STA
+#endif
+
+/* For backward compatability with SDIO.
+ 
+   For SDIO interface, calculate the TX frame length and number of PDU
+   to transfter the frame.
+
+   _vosBuff:   IN   VOS pakcet buffer pointer
+   _usPktLen:  OUT  VOS packet length in bytes
+   _uResLen:   OUT  Number of PDU to hold this VOS packet
+   _uTotalPktLen: OUT Totoal packet length including BAL header size
+
+   For integrated SOC, _usPktLen and _uTotalPktLen is VOS pakcet length
+   which does include BD header length. _uResLen is hardcoded 2.
+ */
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
+#ifdef WINDOWS_DT
+#define WDA_TLI_PROCESS_FRAME_LEN( _vosBuff, _usPktLen,              \
+                                            _uResLen, _uTotalPktLen) \
+  do                                                                 \
+  {                                                                  \
+    _usPktLen = wpalPacketGetFragCount((wpt_packet*)_vosBuff) + 1/*BD*/;\
+    _uResLen  = _usPktLen;                                           \
+    _uTotalPktLen = _usPktLen;                                       \
+  }                                                                  \
+  while ( 0 )
+#else /* WINDOWS_DT */
+#define WDA_TLI_PROCESS_FRAME_LEN( _vosBuff, _usPktLen,              \
+                                            _uResLen, _uTotalPktLen) \
+  do                                                                 \
+  {                                                                  \
+    _usPktLen = 2;  /* Need 1 descriptor per a packet + packet*/     \
+    _uResLen  = 2;  /* Assume that we spends two DXE descriptor */   \
+    _uTotalPktLen = _usPktLen;                                       \
+  }                                                                  \
+  while ( 0 )
+#endif /* WINDOWS_DT */
+
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#define WLANTL_PDU_RES_SIZE                 124 /*Libra PDU size*/
+#define WLAN_LIBRA_BD_HEADER_LEN            128 /*The lenght of the tx BD header*/
+
+/*Minimum resources needed - arbitrary*/
+
+/*DXE + SD*/
+#define WLAN_LIBRA_HEADER_LEN              20+8
+
+#define WLANTL_MAX_MSDU                    1538
+
+#define WDA_TLI_PROCESS_FRAME_LEN( _vosBuff, _usPktLen,              \
+                                            _uResLen, _uTotalPktLen) \
+  do                                                                 \
+  {                                                                  \
+    vos_pkt_get_packet_length( _vosBuff, &_usPktLen );               \
+    _uResLen = WDA_TLI_CEIL( (_usPktLen - WLAN_LIBRA_BD_HEADER_LEN), \
+                               WLANTL_PDU_RES_SIZE ) + 1/*The BD*/;  \
+    _uTotalPktLen = _usPktLen + WLAN_BAL_DXE_HEADER_SIZE;            \
+  }                                                                  \
+  while ( 0 )
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+
+/*--------------------------------------------------------------------------
+  Message Definitions
+ --------------------------------------------------------------------------*/
+
+/* TX Tranmit request message. It serializes TX request to TX thread.
+   The message is processed in TL.
+*/
+#define WDA_DS_TX_START_XMIT  WLANTL_TX_START_XMIT
+#define WDA_DS_FINISH_ULA     WLANTL_FINISH_ULA
+
+
+#define WDA_TX_PACKET_FREED      0X0
+
+/* Approximate amount of time to wait for WDA to stop WDI */
+#define WDA_STOP_TIMEOUT (WDI_RESPONSE_TIMEOUT + WDI_SET_POWER_STATE_TIMEOUT + 5)
+/*--------------------------------------------------------------------------
+  Functions
+ --------------------------------------------------------------------------*/
+
+/* For data client */
+typedef VOS_STATUS (*WDA_DS_TxCompleteCallback) ( v_PVOID_t pContext, vos_pkt_t *pFrameDataBuff, VOS_STATUS txStatus );
+typedef VOS_STATUS (*WDA_DS_RxPacketCallback)   ( v_PVOID_t pContext, vos_pkt_t *pFrameDataBuff );
+typedef v_U32_t   (*WDA_DS_TxPacketCallback)   ( v_PVOID_t pContext, 
+                                                  vos_pkt_t **ppFrameDataBuff, 
+                                                  v_U32_t uSize, 
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+                                                  v_U8_t uFlowMask, 
+#endif
+                                                  v_BOOL_t *pbUrgent );
+typedef VOS_STATUS (*WDA_DS_ResourceCB)      ( v_PVOID_t pContext, v_U32_t uCount );
+
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+/* For management client */
+typedef VOS_STATUS (*WDA_DS_TxCompleteCb)( v_PVOID_t     pContext, wpt_packet *pFrame );
+typedef VOS_STATUS (*WDA_DS_RxCompleteCb)( v_PVOID_t pContext, wpt_packet *pFrame );
+typedef VOS_STATUS (*WDA_DS_TxFlowControlCb)( v_PVOID_t pContext, v_U8_t acMask );
+typedef void (*pWDATxRxCompFunc)( v_PVOID_t pContext, void *pData );
+
+//callback function for TX complete
+//parameter 1 - global pMac pointer
+//parameter 2 - txComplete status : 1- success, 0 - failure.
+typedef eHalStatus (*pWDAAckFnTxComp)(tpAniSirGlobal, tANI_U32);
+
+typedef struct
+{
+   tANI_U16 ucValidStaIndex ;
+   /* 
+    * each bit in ucUseBaBitmap represent BA is enabled or not for this tid 
+    * tid0 ..bit0, tid1..bit1 and so on..
+    */
+   tANI_U8    ucUseBaBitmap ;
+   tANI_U8    bssIdx;
+   tANI_U32   framesTxed[STACFG_MAX_TC];
+}tWdaStaInfo, *tpWdaStaInfo ;
+
+/* group all the WDA timers into this structure */
+typedef struct
+{
+   /* BA activity check timer */
+   TX_TIMER baActivityChkTmr ;
+
+   /* Tx Complete Timeout timer */
+   TX_TIMER TxCompleteTimer ;
+}tWdaTimers ;
+
+#define WDA_MAX_STA    (16)
+
+typedef struct
+{
+   v_PVOID_t            pVosContext;             /* global VOSS context*/
+   v_PVOID_t            pWdiContext;             /* WDI context */
+   WDA_state            wdaState ;               /* WDA state tracking */ 
+   v_PVOID_t            wdaMsgParam ;            /* PE parameter tracking */
+   v_PVOID_t            wdaWdiApiMsgParam ;      /* WDI API paramter tracking */
+   v_PVOID_t            wdaWdiCfgApiMsgParam ;   /* WDI API paramter tracking */
+   vos_event_t          wdaWdiEvent;             /* WDI API sync event */
+
+   /* Event to wait for tx completion */
+   vos_event_t          txFrameEvent;
+
+   /* call back function for tx complete*/
+   pWDATxRxCompFunc     pTxCbFunc;
+   /* call back function for tx packet ack */
+   pWDAAckFnTxComp      pAckTxCbFunc;   
+   tANI_U32             frameTransRequired;
+   tSirMacAddr          macBSSID;             /*BSSID of the network */
+   tSirMacAddr          macSTASelf;     /*Self STA MAC*/
+
+   /* TX channel mask for flow control */
+   v_U8_t               uTxFlowMask;
+   /* TL's TX resource callback        */
+   WDA_DS_ResourceCB    pfnTxResourceCB;
+   /* TL's TX complete callback     */
+   WDA_DS_TxCompleteCallback pfnTxCompleteCallback; 
+   
+   tWdaStaInfo          wdaStaInfo[WDA_MAX_STA];
+
+   tANI_U8              wdaMaxSta;
+   tWdaTimers           wdaTimers;
+
+   /* STA, AP, IBSS, MULTI-BSS etc.*/
+   tBssSystemRole       wdaGlobalSystemRole; 
+
+   /* driver mode, PRODUCTION or FTM */
+   tDriverType          driverMode;
+
+#ifdef ANI_MANF_DIAG
+   /* FTM Command Request tracking */
+   v_PVOID_t            wdaFTMCmdReq;
+#endif /* ANI_MANF_DIAG */
+
+   /* Event to wait for suspend data tx*/
+   vos_event_t          suspendDataTxEvent;
+   /* Status frm TL after suspend/resume Tx */
+   tANI_U8    txStatus;
+   /* Flag set to true when TL suspend timesout.*/
+   tANI_U8    txSuspendTimedOut;   
+
+   vos_event_t          waitOnWdiIndicationCallBack;
+
+   /* version information */
+   tSirVersionType      wcnssWlanCompiledVersion;
+   tSirVersionType      wcnssWlanReportedVersion;
+   tSirVersionString    wcnssSoftwareVersionString;
+   tSirVersionString    wcnssHardwareVersionString;
+
+   
+   tSirLinkState        linkState;
+   /* set, when BT AMP session is going on */
+   v_BOOL_t             wdaAmpSessionOn;
+   v_U32_t              VosPacketToFree;
+} tWDA_CbContext ; 
+
+typedef struct
+{
+   v_PVOID_t            pWdaContext;             /* pointer to WDA context*/
+   v_PVOID_t            wdaMsgParam;            /* PE parameter tracking */
+   v_PVOID_t            wdaWdiApiMsgParam;      /* WDI API paramter tracking */
+} tWDA_ReqParams; 
+
+/*
+ * FUNCTION: WDA_open
+ * open WDA context
+ */ 
+
+VOS_STATUS WDA_open(v_PVOID_t pVosContext, v_PVOID_t pOSContext, 
+                                              tMacOpenParameters *pMacParams ) ;
+
+/*
+ * FUNCTION: WDA_preStart
+ * Trigger DAL-AL to start CFG download 
+ */ 
+VOS_STATUS WDA_start(v_PVOID_t pVosContext) ;
+
+VOS_STATUS WDA_NVDownload_Start(v_PVOID_t pVosContext);
+
+/*
+ * FUNCTION: WDA_preStart
+ * Trigger WDA to start CFG download 
+ */ 
+VOS_STATUS WDA_preStart(v_PVOID_t pVosContext) ;
+/*
+ * FUNCTION: WDA_stop
+ * stop WDA
+ */
+VOS_STATUS WDA_stop(v_PVOID_t pVosContext,tANI_U8 reason);
+
+/*
+ * FUNCTION: WDA_close
+ * close WDA context
+ */
+VOS_STATUS WDA_close(v_PVOID_t pVosContext);
+/*
+ * FUNCTION: WDA_shutdown
+ * Shutdown will not close the control transport, added by SSR
+ */
+VOS_STATUS WDA_shutdown(v_PVOID_t pVosContext, wpt_boolean closeTransport);
+
+/*
+ * FUNCTION: WDA_McProcessMsg
+ * DAL-AL message processing entry function 
+ */ 
+
+VOS_STATUS WDA_McProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg ) ;
+
+/* -----------------------------------------------------------------
+ * WDA data path API's
+ * ----------------------------------------------------------------*/
+/*
+ * FUNCTION: WDA_MgmtDSRegister
+ * Send Message back to PE
+ */ 
+
+VOS_STATUS WDA_MgmtDSRegister(tWDA_CbContext *pWDA, 
+                              WDA_DS_TxCompleteCb WDA_TxCompleteCallback,
+                              WDA_DS_RxCompleteCb WDA_RxCompleteCallback,  
+                              WDA_DS_TxFlowControlCb WDA_TxFlowCtrlCallback 
+                             ) ;
+/*
+ * FUNCTION: WDA_MgmtDSTxPacket
+ * Forward TX management frame to WDI
+ */ 
+
+VOS_STATUS WDA_TxPacket(tWDA_CbContext *pWDA, 
+                                    void *pFrmBuf,
+                                    tANI_U16 frmLen,
+                                    eFrameType frmType,
+                                    eFrameTxDir txDir,
+                                    tANI_U8 tid,
+                                    pWDATxRxCompFunc pCompFunc,
+                                    void *pData,
+                                    pWDAAckFnTxComp pAckTxComp, 
+                                    tANI_U8 txFlag);
+
+/*
+ * FUNCTION: WDA_PostMsgApi
+ * API fpr PE to post Message to WDA
+ */
+VOS_STATUS WDA_PostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg) ;
+
+/* ---------------------------------------------------------
+ * FUNCTION:  wdaGetGlobalSystemRole()
+ *
+ * Get the global HAL system role. 
+ * ---------------------------------------------------------
+ */
+tBssSystemRole wdaGetGlobalSystemRole(tpAniSirGlobal pMac);
+
+/* maximum wait time for WDA complete event (correct value has to be derived) 
+ * for now giving the value 1000 ms */
+#define WDA_WDI_COMPLETION_TIME_OUT 30000 /* in ms */
+
+#define WDA_TL_TX_FRAME_TIMEOUT  10000  /* in msec a very high upper limit of 5,000 msec */
+#define WDA_TL_SUSPEND_TIMEOUT   2000  /* in ms unit */
+
+/*Tag used by WDA to mark a timed out frame*/
+#define WDA_TL_TX_MGMT_TIMED_OUT   0xDEAD 
+
+#define WDA_TL_TX_SUSPEND_SUCCESS   0
+#define WDA_TL_TX_SUSPEND_FAILURE   1
+
+// FIXME Temporary value for R33D integaration
+//#define WDA_TL_TX_FRAME_TIMEOUT  20000 /* in msec a very high upper limit */
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+#if !defined( wdaGetGlobalSystemRole )
+#define wdaGetGlobalSystemRole halGetGlobalSystemRole
+#endif
+#endif
+
+/* ---------------------------------------------------------------------------
+ 
+   RX Meta info access for Integrated SOC
+   RX BD header access for NON Integrated SOC
+
+      These MACRO are for RX frames that are on flat buffers
+
+  ---------------------------------------------------------------------------*/
+
+/* WDA_GET_RX_MAC_HEADER *****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MAC_HEADER(pRxMeta)  \
+      (tpSirMacMgmtHdr)( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->mpduHeaderPtr )
+#else
+#  define WDA_GET_RX_MAC_HEADER(bdHd) SIR_MAC_BD_TO_MPDUHEADER(bdHd) 
+#endif
+
+/* WDA_GET_RX_MPDUHEADER3A ****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDUHEADER3A(pRxMeta) \
+   (tpSirMacDataHdr3a)( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->mpduHeaderPtr )
+#else
+#  define WDA_GET_RX_MPDUHEADER3A(bdHd)    SIR_MAC_BD_TO_MPDUHEADER3A(bdHd)
+#endif
+
+/* WDA_GET_RX_MPDU_HEADER_LEN *************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDU_HEADER_LEN(pRxMeta)   \
+                    ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->mpduHeaderLength )
+#else 
+#  define WDA_GET_RX_MPDU_HEADER_LEN(bdHd)   WLANHAL_RX_BD_GET_MPDU_H_LEN(bdHd)
+#endif
+
+/* WDA_GET_RX_MPDU_LEN ********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDU_LEN(pRxMeta)  \
+               ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->mpduLength )
+#else 
+#  define WDA_GET_RX_MPDU_LEN(bdHd) WLANHAL_RX_BD_GET_MPDU_LEN(bdHd)
+#endif
+
+/* WDA_GET_RX_PAYLOAD_LEN ****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_PAYLOAD_LEN(pRxMeta)   \
+       ( WDA_GET_RX_MPDU_LEN(pRxMeta) - WDA_GET_RX_MPDU_HEADER_LEN(pRxMeta) )
+#else
+#  define WDA_GET_RX_PAYLOAD_LEN(bdHd) SIR_MAC_BD_TO_PAYLOAD_LEN(bdHd)
+#endif
+
+/* WDA_GET_RX_MAC_RATE_IDX ***************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MAC_RATE_IDX(pRxMeta)  \
+                          ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->rateIndex )
+#else
+#  define WDA_GET_RX_MAC_RATE_IDX(bdHd)     SIR_MAC_BD_TO_RATE_INDEX(bdHd)
+#endif
+
+/* WDA_GET_RX_MPDU_DATA ******************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDU_DATA(pRxMeta)  \
+                   ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->mpduDataPtr )
+#else
+#  define WDA_GET_RX_MPDU_DATA(bdHd) SIR_MAC_BD_TO_MPDUDATA(bdHd)
+#endif
+
+/* WDA_GET_RX_MPDU_DATA_OFFSET ***********************************************/
+// For Integrated SOC: When UMAC receive the packet. BD is already stripped off.
+//                     Data offset is the MPDU header length
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDU_DATA_OFFSET(pRxMeta)  WDA_GET_RX_MPDU_HEADER_LEN(pRxMeta)
+#else
+#  define WDA_GET_RX_MPDU_DATA_OFFSET(bdHd) \
+                WLANHAL_RX_BD_GET_MPDU_D_OFFSET(bdHd)
+#endif
+
+/* WDA_GET_RX_MPDU_HEADER_OFFSET *********************************************/
+// For Integrated SOC: We UMAC receive the frame, 
+//                     BD is gone and MAC header at offset 0
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_MPDU_HEADER_OFFSET(pRxMeta)   0
+#else
+#  define WDA_GET_RX_MPDU_HEADER_OFFSET(bdHd) WLANHAL_RX_BD_GET_MPDU_H_OFFSET(bdHd)
+#endif
+
+/* WDA_GET_RX_UNKNOWN_UCAST **************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_UNKNOWN_UCAST(pRxMeta)   \
+                     ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->unknownUcastPkt )
+#else
+#  define WDA_GET_RX_UNKNOWN_UCAST(bdHd) SIR_MAC_BD_IS_UNKNOWN_UCAST_FRAME(bdHd)
+#endif
+
+/* WDA_GET_RX_TID ************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_TID(pRxMeta) ( ((WDI_DS_RxMetaInfoType *)(pRxMeta))->tid )
+#else
+#  define WDA_GET_RX_TID(bdHd) WLANHAL_RX_BD_GET_TID(bdHd)
+#endif
+
+/* WDA_GET_RX_STAID **********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_STAID(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->staId)
+#else
+#  define WDA_GET_RX_STAID(bdHd)    WLANHAL_RX_BD_GET_STA_ID(bdHd)
+#endif
+
+/* WDA_GET_RX_ADDR3_IDX ******************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_ADDR3_IDX(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->addr3Idx)
+#else
+#  define WDA_GET_RX_ADDR3_IDX(bdHd)    WLANHAL_RX_BD_GET_ADDR3_IDX(bdHd) 
+#endif
+
+/* WDA_GET_RX_CH *************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_CH(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->rxChannel)
+#else
+#  define WDA_GET_RX_CH(bdHd) SIR_MAC_BD_TO_RX_CHANNEL(bdHd)
+#endif
+
+/* WDA_GET_RX_DPUSIG *********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_DPUSIG(pRxMeta)  (((WDI_DS_RxMetaInfoType*)(pRxMeta))->dpuSig)
+#else
+#  define WDA_GET_RX_DPUSIG(bdHd)     WLANHAL_RX_BD_GET_DPU_SIG(bdHd)
+#endif
+
+/* WDA_IS_RX_BCAST ***********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_IS_RX_BCAST(pRxMeta)   \
+      ( (1 == ((WDI_DS_RxMetaInfoType*)(pRxMeta))->bcast) ? VOS_TRUE : VOS_FALSE )
+#else
+#  define WDA_IS_RX_BCAST(bdHd)   \
+      ( ( 0xFF == WLANHAL_RX_BD_GET_ADDR1_IDX(bdHd)) ? VOS_TRUE : VOS_FALSE )
+#endif
+    
+/* WDA_GET_RX_FT_DONE ********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FT_DONE(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->ft)
+#else
+#  define WDA_GET_RX_FT_DONE(bdHd)    WLANHAL_RX_BD_GET_FT(bdHd)
+#endif
+
+/* WDA_GET_RX_DPU_FEEDBACK **************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_DPU_FEEDBACK(pRxMeta) \
+                      (((WDI_DS_RxMetaInfoType*)(pRxMeta))->dpuFeedback)
+#endif
+
+/* WDA_GET_RX_ASF ************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_ASF(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->amsdu_asf)
+#else
+#  define WDA_GET_RX_ASF(bdHd)     WLANHAL_RX_BD_GET_ASF(bdHd)
+#endif
+
+/* WDA_GET_RX_AEF ************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_AEF(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->amsdu_aef)
+#else
+#  define WDA_GET_RX_AEF(bdHd)    WLANHAL_RX_BD_GET_AEF(bdHd)
+#endif
+
+/* WDA_GET_RX_ESF ************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_ESF(pRxMeta)  (((WDI_DS_RxMetaInfoType*)(pRxMeta))->amsdu_esf)
+#else
+#  define WDA_GET_RX_ESF(bdHd)     WLANHAL_RX_BD_GET_ESF(bdHd)
+#endif
+
+/* WDA_GET_RX_BEACON_SENT ****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_BEACON_SENT(pRxMeta) \
+                     (((WDI_DS_RxMetaInfoType*)(pRxMeta))->bsf)
+#else
+#  define WDA_GET_RX_BEACON_SENT(bdHd) SIR_MAC_BD_TO_IBSS_BCN_SENT(bdHd)
+#endif
+
+/* WDA_GET_RX_TSF_LATER *****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_TSF_LATER(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->rtsf)
+#else
+#  define WDA_GET_RX_TSF_LATER(bdHd) SIR_MAC_BD_TO_IBSS_TSF_LATER(bdHd)
+#endif
+
+/* WDA_GET_RX_TYPE ***********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_TYPE(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->type)
+#else
+#  define WDA_GET_RX_TYPE(bdHd) \
+            ( ( WLANHAL_RX_BD_GET_TYPE_SUBTYPE(bdHd) & 0x30 ) >> 4 ) 
+#endif
+
+/* WDA_GET_RX_SUBTYPE ********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_SUBTYPE(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->subtype)
+#else
+#  define WDA_GET_RX_SUBTYPE(bdHd) ( WLANHAL_RX_BD_GET_TYPE_SUBTYPE(bdHd) & 0x0F )
+#endif
+
+/* WDA_GET_RX_TYPE_SUBTYPE ****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_TYPE_SUBTYPE(pRxMeta)  \
+                 ((WDA_GET_RX_TYPE(pRxMeta)<<4)|WDA_GET_RX_SUBTYPE(pRxMeta))
+#else
+#  define WDA_GET_RX_TYPE_SUBTYPE(bdHd) WLANHAL_RX_BD_GET_TYPE_SUBTYPE(bdHd)
+#endif
+
+/* WDA_GET_RX_REORDER_OPCODE : For MSDU reorder *******************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_REORDER_OPCODE(pRxMeta) \
+           (((WDI_DS_RxMetaInfoType*)(pRxMeta))->ampdu_reorderOpcode)
+#else
+#  define WDA_GET_RX_REORDER_OPCODE(bdHd) WLANHAL_RX_BD_GET_BA_OPCODE(bdHd) 
+#endif
+
+/* WDA_GET_RX_REORDER_SLOT_IDX : For MSDU reorder ****************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_REORDER_SLOT_IDX(pRxMeta) \
+                (((WDI_DS_RxMetaInfoType*)(pRxMeta))->ampdu_reorderSlotIdx)
+#else
+#  define WDA_GET_RX_REORDER_SLOT_IDX(bdHd) WLANHAL_RX_BD_GET_BA_SI(bdHd)
+#endif
+
+/* WDA_GET_RX_REORDER_FWD_IDX : For MSDU reorder *****************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_REORDER_FWD_IDX(pRxMeta)  \
+         (((WDI_DS_RxMetaInfoType*)(pRxMeta))->ampdu_reorderFwdIdx)
+#else
+#  define WDA_GET_RX_REORDER_FWD_IDX(bdHd) WLANHAL_RX_BD_GET_BA_FI(bdHd)
+#endif
+
+/* WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO : Fro MSDU reorder **********************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO(pRxMeta)  \
+         (((WDI_DS_RxMetaInfoType*)(pRxMeta))->currentPktSeqNo)
+#else
+#  define WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO(bdHd) \
+                              WLANHAL_RX_BD_GET_BA_CSN(bdHd) 
+#endif
+
+/* WDA_IS_RX_LLC_PRESENT *****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_IS_RX_LLC_PRESENT(pRxMeta)    \
+      ( (0 == ((WDI_DS_RxMetaInfoType*)(pRxMeta))->llcr) ? VOS_TRUE : VOS_FALSE )
+#else
+#  define WDA_IS_RX_LLC_PRESENT(bdHd)       \
+           ( (0 == (v_U8_t)WLANHAL_RX_BD_GET_LLC(bdHd) ) ? VOS_TRUE : VOS_FALSE )
+#endif
+
+#define WLANWDA_HO_IS_AN_AMPDU                    0x4000
+#define WLANWDA_HO_LAST_MPDU_OF_AMPDU             0x400
+
+/* WDA_IS_RX_AN_AMPDU ********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_IS_RX_AN_AMPDU(pRxMeta)       \
+   ( ((WDI_DS_RxMetaInfoType*)(pRxMeta))->rxpFlags & WLANWDA_HO_IS_AN_AMPDU )
+#else
+#  define WDA_IS_RX_AN_AMPDU(bdHd)   WLAN_HAL_IS_AN_AMPDU(bdHd) 
+#endif
+
+/* WDA_IS_RX_LAST_MPDU *******************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_IS_RX_LAST_MPDU(pRxMeta)      \
+   ( ((WDI_DS_RxMetaInfoType*)(pRxMeta))->rxpFlags & WLANWDA_HO_LAST_MPDU_OF_AMPDU ) 
+#else
+#  define WDA_IS_RX_LAST_MPDU(bdHd)         WLAN_HAL_IS_LAST_MPDU(bdHd)
+#endif
+
+/* WDA_GET_RX_TIMESTAMP *****************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_TIMESTAMP(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->mclkRxTimestamp)
+#else
+#  define WDA_GET_RX_TIMESTAMP(bdHd)    SIR_MAC_BD_RX_TIMESTAMP(bdHd)
+#endif
+
+/* WDA_IS_RX_IN_SCAN *********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_IS_RX_IN_SCAN(pRxMeta)  (((WDI_DS_RxMetaInfoType*)(pRxMeta))->scan)
+#else
+#  define WDA_IS_RX_IN_SCAN(bdHd)     SIR_MAC_BD_TO_SCAN_LEARN(bdHd)
+#endif
+
+/* WDA_GET_RX_RSSI_DB ********************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+// Volans RF
+#  define WDA_RSSI_OFFSET             100
+#  define WDA_GET_RSSI0_DB(rssi0)     (rssi0 - WDA_RSSI_OFFSET)
+#  define WDA_GET_RSSI1_DB(rssi0)     (0 - WDA_RSSI_OFFSET)
+#  define WDA_MAX_OF_TWO(val1, val2)  ( ((val1) > (val2)) ? (val1) : (val2))
+#  define WDA_GET_RSSI_DB(rssi0)  \
+                WDA_MAX_OF_TWO(WDA_GET_RSSI0_DB(rssi0), WDA_GET_RSSI1_DB(rssi0))
+#  define WDA_GET_RX_RSSI_DB(pRxMeta) \
+                       WDA_GET_RSSI_DB((((WDI_DS_RxMetaInfoType*)(pRxMeta))->rssi0))
+#else
+#  define WDA_GET_RX_RSSI_DB(bdHd)     SIR_MAC_BD_TO_RSSI_DB(bdHd)
+#endif
+
+/* WDA_GET_RX_SNR ************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_SNR(pRxMeta)  (((WDI_DS_RxMetaInfoType*)(pRxMeta))->snr)
+#else
+#  define WDA_GET_RX_SNR(bdHd) WLANHAL_RX_BD_GET_SNR(bdHd)
+#endif
+
+/* WDA_IS_RX_FC **************************************************************/
+// Flow control frames
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+/* FIXME WDA should provide the meta info which indicates FC frame 
+          In the meantime, use hardcoded FALSE, since we don't support FC yet */
+#  define WDA_IS_RX_FC(pRxMeta)    (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fc)
+#else
+#  define WDA_IS_RX_FC(bdHd)        WLANHAL_RX_BD_GET_FC(bdHd)
+#endif
+
+/* WDA_GET_RX_FC_VALID_STA_MASK **********************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FC_VALID_STA_MASK(pRxMeta) \
+                       (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcSTAValidMask)
+#else
+#  define WDA_GET_RX_FC_VALID_STA_MASK(bdHd) \
+                       WLANHAL_RX_BD_GET_STA_VALID_MASK(bdHd)
+#endif
+
+/* WDA_GET_RX_FC_PWRSAVE_STA_MASK ********************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FC_PWRSAVE_STA_MASK(pRxMeta) \
+                 (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcSTAPwrSaveStateMask)
+#else
+#  define WDA_GET_RX_FC_PWRSAVE_STA_MASK(bdHd) \
+                                          WLANHAL_RX_BD_GET_STA_PS_STATE(bdHd)
+#endif
+
+/* WDA_GET_RX_FC_STA_THRD_IND_MASK ********************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FC_STA_THRD_IND_MASK(pRxMeta) \
+                     (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcSTAThreshIndMask)
+#else
+#  define WDA_GET_RX_FC_STA_THRD_IND_MASK(bdHd) \
+                                    WLANHAL_RX_BD_GET_STA_TH_IND(bdHd)
+#endif
+
+/* WDA_GET_RX_FC_FORCED_STA_TX_DISABLED_BITMAP ********************************************/
+#  define WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pRxMeta) \
+                     (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcStaTxDisabledBitmap)
+
+/* WDA_GET_RX_FC_STA_TXQ_LEN *************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FC_STA_TXQ_LEN(pRxMeta, staId) \
+                  (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcSTATxQLen[(staId)])
+#else
+#  define WDA_GET_RX_FC_STA_TXQ_LEN(bdHd, staId) \
+                          WLANHAL_RX_BD_GET_STA_TXQ_LEN( _pvBDHeader, staId )
+#endif
+
+/* WDA_GET_RX_FC_STA_CUR_TXRATE **********************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_FC_STA_CUR_TXRATE(pRxMeta, staId) \
+                (((WDI_DS_RxMetaInfoType*)(pRxMeta))->fcSTACurTxRate[(staId)])
+#else
+#  define WDA_GET_RX_FC_STA_CUR_TXRATE(bdHd, staId) \
+                             WLANHAL_RX_BD_GET_STA_CUR_TX_RATE( bdHd, staIdx )
+#endif
+
+/* WDA_GET_RX_REPLAY_COUNT ***************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GET_RX_REPLAY_COUNT(pRxMeta) \
+                            (((WDI_DS_RxMetaInfoType*)(pRxMeta))->replayCount)
+#endif
+
+/* WDA_GETRSSI0 ***************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GETRSSI0(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->rssi0)
+#else
+#  define WDA_GETRSSI0(bdHd) (v_S7_t)(HAL_GET_RSSI0_DB(SIR_MAC_BD_TO_PHY_STATS0(bdHd)))
+#endif
+
+/* WDA_GETRSSI1 ***************************************************************/
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_GETRSSI1(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->rssi1)
+#else
+#  define WDA_GETRSSI1(bdHd) (v_S7_t)(HAL_GET_RSSI1_DB(SIR_MAC_BD_TO_PHY_STATS0(bdHd)))
+#endif
+
+
+
+/* --------------------------------------------------------------------*/
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+uint8 WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision);
+uint8 WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision);
+
+
+VOS_STATUS WDA_GetWcnssWlanCompiledVersion(v_PVOID_t pvosGCtx,
+                                           tSirVersionType *pVersion);
+VOS_STATUS WDA_GetWcnssWlanReportedVersion(v_PVOID_t pvosGCtx,
+                                           tSirVersionType *pVersion);
+VOS_STATUS WDA_GetWcnssSoftwareVersion(v_PVOID_t pvosGCtx,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize);
+VOS_STATUS WDA_GetWcnssHardwareVersion(v_PVOID_t pvosGCtx,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize);
+
+VOS_STATUS WDA_SetUapsdAcParamsReq(v_PVOID_t , v_U8_t , tUapsdInfo *);
+VOS_STATUS WDA_ClearUapsdAcParamsReq(v_PVOID_t , v_U8_t , wpt_uint8 );
+VOS_STATUS WDA_SetRSSIThresholdsReq(tpAniSirGlobal , tSirRSSIThresholds *);
+// Just declare the function extern here and save some time.
+extern tSirRetStatus halMmhForwardMBmsg(void*, tSirMbMsg*);
+tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
+#else
+#  define uMacPostCtrlMsg(hal, msg)  halMmhForwardMBmsg(hal, msg)
+#endif
+
+
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC) || defined(FEATURE_WLAN_INTEGRATED_SOC)
+#define WDA_MAX_TXPOWER_INVALID HAL_MAX_TXPOWER_INVALID
+
+//WDA Messages to HAL messages Mapping
+#if 0
+//Required by SME
+//#define WDA_SIGNAL_BT_EVENT SIR_HAL_SIGNAL_BT_EVENT - this is defined in sirParams.h
+//#define WDA_BTC_SET_CFG SIR_HAL_BTC_SET_CFG
+
+//Required by PE
+#define WDA_HOST_MSG_START SIR_HAL_HOST_MSG_START 
+#define WDA_INITIAL_CAL_FAILED_NTF SIR_HAL_INITIAL_CAL_FAILED_NTF
+#define WDA_SHUTDOWN_REQ SIR_HAL_SHUTDOWN_REQ
+#define WDA_SHUTDOWN_CNF SIR_HAL_SHUTDOWN_CNF
+#define WDA_RADIO_ON_OFF_IND SIR_HAL_RADIO_ON_OFF_IND
+#define WDA_RESET_CNF SIR_HAL_RESET_CNF
+#define WDA_SetRegDomain \
+        eHalStatus halPhySetRegDomain(tHalHandle hHal, eRegDomainId regDomain);
+#endif
+
+#define WDA_APP_SETUP_NTF  SIR_HAL_APP_SETUP_NTF 
+#define WDA_NIC_OPER_NTF   SIR_HAL_NIC_OPER_NTF
+#define WDA_INIT_START_REQ SIR_HAL_INIT_START_REQ
+#define WDA_RESET_REQ      SIR_HAL_RESET_REQ
+#define WDA_HDD_ADDBA_REQ  SIR_HAL_HDD_ADDBA_REQ
+#define WDA_HDD_ADDBA_RSP  SIR_HAL_HDD_ADDBA_RSP
+#define WDA_DELETEBA_IND   SIR_HAL_DELETEBA_IND
+#define WDA_BA_FAIL_IND    SIR_HAL_BA_FAIL_IND
+#define WDA_TL_FLUSH_AC_REQ SIR_TL_HAL_FLUSH_AC_REQ
+#define WDA_TL_FLUSH_AC_RSP SIR_HAL_TL_FLUSH_AC_RSP
+
+#define WDA_MSG_TYPES_BEGIN            SIR_HAL_MSG_TYPES_BEGIN
+#define WDA_ITC_MSG_TYPES_BEGIN        SIR_HAL_ITC_MSG_TYPES_BEGIN
+#define WDA_RADAR_DETECTED_IND         SIR_HAL_RADAR_DETECTED_IND
+#define WDA_WDT_KAM_RSP                SIR_HAL_WDT_KAM_RSP 
+#define WDA_TIMER_TEMP_MEAS_REQ        SIR_HAL_TIMER_TEMP_MEAS_REQ
+#define WDA_TIMER_PERIODIC_STATS_COLLECT_REQ   SIR_HAL_TIMER_PERIODIC_STATS_COLLECT_REQ
+#define WDA_CAL_REQ_NTF                SIR_HAL_CAL_REQ_NTF
+#define WDA_MNT_OPEN_TPC_TEMP_MEAS_REQ SIR_HAL_MNT_OPEN_TPC_TEMP_MEAS_REQ
+#define WDA_CCA_MONITOR_INTERVAL_TO    SIR_HAL_CCA_MONITOR_INTERVAL_TO
+#define WDA_CCA_MONITOR_DURATION_TO    SIR_HAL_CCA_MONITOR_DURATION_TO
+#define WDA_CCA_MONITOR_START          SIR_HAL_CCA_MONITOR_START 
+#define WDA_CCA_MONITOR_STOP           SIR_HAL_CCA_MONITOR_STOP
+#define WDA_CCA_CHANGE_MODE            SIR_HAL_CCA_CHANGE_MODE
+#define WDA_TIMER_WRAP_AROUND_STATS_COLLECT_REQ   SIR_HAL_TIMER_WRAP_AROUND_STATS_COLLECT_REQ
+
+/*
+ * New Taurus related messages
+ */
+#define WDA_ADD_STA_REQ                SIR_HAL_ADD_STA_REQ
+#define WDA_ADD_STA_RSP                SIR_HAL_ADD_STA_RSP
+#define WDA_ADD_STA_SELF_RSP           SIR_HAL_ADD_STA_SELF_RSP
+#define WDA_DEL_STA_SELF_RSP           SIR_HAL_DEL_STA_SELF_RSP
+#define WDA_DELETE_STA_REQ             SIR_HAL_DELETE_STA_REQ 
+#define WDA_DELETE_STA_RSP             SIR_HAL_DELETE_STA_RSP
+#define WDA_ADD_BSS_REQ                SIR_HAL_ADD_BSS_REQ
+#define WDA_ADD_BSS_RSP                SIR_HAL_ADD_BSS_RSP
+#define WDA_DELETE_BSS_REQ             SIR_HAL_DELETE_BSS_REQ
+#define WDA_DELETE_BSS_RSP             SIR_HAL_DELETE_BSS_RSP
+#define WDA_INIT_SCAN_REQ              SIR_HAL_INIT_SCAN_REQ
+#define WDA_INIT_SCAN_RSP              SIR_HAL_INIT_SCAN_RSP
+#define WDA_START_SCAN_REQ             SIR_HAL_START_SCAN_REQ
+#define WDA_START_SCAN_RSP             SIR_HAL_START_SCAN_RSP
+#define WDA_END_SCAN_REQ               SIR_HAL_END_SCAN_REQ
+#define WDA_END_SCAN_RSP               SIR_HAL_END_SCAN_RSP
+#define WDA_FINISH_SCAN_REQ            SIR_HAL_FINISH_SCAN_REQ
+#define WDA_FINISH_SCAN_RSP            SIR_HAL_FINISH_SCAN_RSP
+#define WDA_SEND_BEACON_REQ            SIR_HAL_SEND_BEACON_REQ
+#define WDA_SEND_BEACON_RSP            SIR_HAL_SEND_BEACON_RSP
+
+#define WDA_INIT_CFG_REQ               SIR_HAL_INIT_CFG_REQ
+#define WDA_INIT_CFG_RSP               SIR_HAL_INIT_CFG_RSP
+
+#define WDA_INIT_WM_CFG_REQ            SIR_HAL_INIT_WM_CFG_REQ
+#define WDA_INIT_WM_CFG_RSP            SIR_HAL_INIT_WM_CFG_RSP
+
+#define WDA_SET_BSSKEY_REQ             SIR_HAL_SET_BSSKEY_REQ
+#define WDA_SET_BSSKEY_RSP             SIR_HAL_SET_BSSKEY_RSP
+#define WDA_SET_STAKEY_REQ             SIR_HAL_SET_STAKEY_REQ
+#define WDA_SET_STAKEY_RSP             SIR_HAL_SET_STAKEY_RSP
+#define WDA_DPU_STATS_REQ              SIR_HAL_DPU_STATS_REQ 
+#define WDA_DPU_STATS_RSP              SIR_HAL_DPU_STATS_RSP
+#define WDA_GET_DPUINFO_REQ            SIR_HAL_GET_DPUINFO_REQ
+#define WDA_GET_DPUINFO_RSP            SIR_HAL_GET_DPUINFO_RSP
+
+#define WDA_UPDATE_EDCA_PROFILE_IND    SIR_HAL_UPDATE_EDCA_PROFILE_IND
+
+#define WDA_UPDATE_STARATEINFO_REQ     SIR_HAL_UPDATE_STARATEINFO_REQ
+#define WDA_UPDATE_STARATEINFO_RSP     SIR_HAL_UPDATE_STARATEINFO_RSP
+
+#define WDA_UPDATE_BEACON_IND          SIR_HAL_UPDATE_BEACON_IND
+#define WDA_UPDATE_CF_IND              SIR_HAL_UPDATE_CF_IND
+#define WDA_CHNL_SWITCH_REQ            SIR_HAL_CHNL_SWITCH_REQ
+#define WDA_ADD_TS_REQ                 SIR_HAL_ADD_TS_REQ
+#define WDA_DEL_TS_REQ                 SIR_HAL_DEL_TS_REQ
+#define WDA_SOFTMAC_TXSTAT_REPORT      SIR_HAL_SOFTMAC_TXSTAT_REPORT
+
+#define WDA_MBOX_SENDMSG_COMPLETE_IND  SIR_HAL_MBOX_SENDMSG_COMPLETE_IND
+#define WDA_EXIT_BMPS_REQ              SIR_HAL_EXIT_BMPS_REQ
+#define WDA_EXIT_BMPS_RSP              SIR_HAL_EXIT_BMPS_RSP
+#define WDA_EXIT_BMPS_IND              SIR_HAL_EXIT_BMPS_IND 
+#define WDA_ENTER_BMPS_REQ             SIR_HAL_ENTER_BMPS_REQ
+#define WDA_ENTER_BMPS_RSP             SIR_HAL_ENTER_BMPS_RSP
+#define WDA_BMPS_STATUS_IND            SIR_HAL_BMPS_STATUS_IND
+#define WDA_MISSED_BEACON_IND          SIR_HAL_MISSED_BEACON_IND
+
+#define WDA_CFG_RXP_FILTER_REQ         SIR_HAL_CFG_RXP_FILTER_REQ
+#define WDA_CFG_RXP_FILTER_RSP         SIR_HAL_CFG_RXP_FILTER_RSP
+
+#define WDA_SWITCH_CHANNEL_RSP         SIR_HAL_SWITCH_CHANNEL_RSP
+#define WDA_P2P_NOA_ATTR_IND           SIR_HAL_P2P_NOA_ATTR_IND
+#define WDA_PWR_SAVE_CFG               SIR_HAL_PWR_SAVE_CFG
+
+#define WDA_REGISTER_PE_CALLBACK       SIR_HAL_REGISTER_PE_CALLBACK
+#define WDA_SOFTMAC_MEM_READREQUEST    SIR_HAL_SOFTMAC_MEM_READREQUEST
+#define WDA_SOFTMAC_MEM_WRITEREQUEST   SIR_HAL_SOFTMAC_MEM_WRITEREQUEST
+
+#define WDA_SOFTMAC_MEM_READRESPONSE   SIR_HAL_SOFTMAC_MEM_READRESPONSE
+#define WDA_SOFTMAC_BULKREGWRITE_CONFIRM      SIR_HAL_SOFTMAC_BULKREGWRITE_CONFIRM
+#define WDA_SOFTMAC_BULKREGREAD_RESPONSE      SIR_HAL_SOFTMAC_BULKREGREAD_RESPONSE
+#define WDA_SOFTMAC_HOSTMESG_MSGPROCESSRESULT SIR_HAL_SOFTMAC_HOSTMESG_MSGPROCESSRESULT
+
+#define WDA_ADDBA_REQ                  SIR_HAL_ADDBA_REQ 
+#define WDA_ADDBA_RSP                  SIR_HAL_ADDBA_RSP
+#define WDA_DELBA_IND                  SIR_HAL_DELBA_IND
+#define WDA_DEL_BA_IND                 SIR_HAL_DEL_BA_IND
+#define WDA_MIC_FAILURE_IND            SIR_HAL_MIC_FAILURE_IND
+
+//message from sme to initiate delete block ack session.
+#define WDA_DELBA_REQ                  SIR_HAL_DELBA_REQ
+#define WDA_IBSS_STA_ADD               SIR_HAL_IBSS_STA_ADD
+#define WDA_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND   SIR_HAL_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND
+#define WDA_SET_LINK_STATE             SIR_HAL_SET_LINK_STATE
+#define WDA_SET_LINK_STATE_RSP         SIR_HAL_SET_LINK_STATE_RSP
+#define WDA_ENTER_IMPS_REQ             SIR_HAL_ENTER_IMPS_REQ
+#define WDA_ENTER_IMPS_RSP             SIR_HAL_ENTER_IMPS_RSP
+#define WDA_EXIT_IMPS_RSP              SIR_HAL_EXIT_IMPS_RSP
+#define WDA_EXIT_IMPS_REQ              SIR_HAL_EXIT_IMPS_REQ
+#define WDA_SOFTMAC_HOSTMESG_PS_STATUS_IND  SIR_HAL_SOFTMAC_HOSTMESG_PS_STATUS_IND  
+#define WDA_POSTPONE_ENTER_IMPS_RSP    SIR_HAL_POSTPONE_ENTER_IMPS_RSP
+#define WDA_STA_STAT_REQ               SIR_HAL_STA_STAT_REQ 
+#define WDA_GLOBAL_STAT_REQ            SIR_HAL_GLOBAL_STAT_REQ
+#define WDA_AGGR_STAT_REQ              SIR_HAL_AGGR_STAT_REQ 
+#define WDA_STA_STAT_RSP               SIR_HAL_STA_STAT_RSP
+#define WDA_GLOBAL_STAT_RSP            SIR_HAL_GLOBAL_STAT_RSP
+#define WDA_AGGR_STAT_RSP              SIR_HAL_AGGR_STAT_RSP
+#define WDA_STAT_SUMM_REQ              SIR_HAL_STAT_SUMM_REQ
+#define WDA_STAT_SUMM_RSP              SIR_HAL_STAT_SUMM_RSP
+#define WDA_REMOVE_BSSKEY_REQ          SIR_HAL_REMOVE_BSSKEY_REQ
+#define WDA_REMOVE_BSSKEY_RSP          SIR_HAL_REMOVE_BSSKEY_RSP
+#define WDA_REMOVE_STAKEY_REQ          SIR_HAL_REMOVE_STAKEY_REQ
+#define WDA_REMOVE_STAKEY_RSP          SIR_HAL_REMOVE_STAKEY_RSP
+#define WDA_SET_STA_BCASTKEY_REQ       SIR_HAL_SET_STA_BCASTKEY_REQ 
+#define WDA_SET_STA_BCASTKEY_RSP       SIR_HAL_SET_STA_BCASTKEY_RSP
+#define WDA_REMOVE_STA_BCASTKEY_REQ    SIR_HAL_REMOVE_STA_BCASTKEY_REQ
+#define WDA_REMOVE_STA_BCASTKEY_RSP    SIR_HAL_REMOVE_STA_BCASTKEY_RSP
+#define WDA_ADD_TS_RSP                 SIR_HAL_ADD_TS_RSP
+#define WDA_DPU_MIC_ERROR              SIR_HAL_DPU_MIC_ERROR
+#define WDA_TIMER_BA_ACTIVITY_REQ      SIR_HAL_TIMER_BA_ACTIVITY_REQ
+#define WDA_TIMER_CHIP_MONITOR_TIMEOUT SIR_HAL_TIMER_CHIP_MONITOR_TIMEOUT
+#define WDA_TIMER_TRAFFIC_ACTIVITY_REQ SIR_HAL_TIMER_TRAFFIC_ACTIVITY_REQ
+#define WDA_TIMER_ADC_RSSI_STATS       SIR_HAL_TIMER_ADC_RSSI_STATS
+
+#ifdef FEATURE_WLAN_CCX
+#define WDA_TSM_STATS_REQ              SIR_HAL_TSM_STATS_REQ
+#define WDA_TSM_STATS_RSP              SIR_HAL_TSM_STATS_RSP
+#endif
+#ifdef WLAN_SOFTAP_FEATURE
+#define WDA_UPDATE_PROBE_RSP_IE_BITMAP_IND SIR_HAL_UPDATE_PROBE_RSP_IE_BITMAP_IND
+#define WDA_UPDATE_UAPSD_IND           SIR_HAL_UPDATE_UAPSD_IND
+#endif
+
+#define WDA_SET_MIMOPS_REQ                      SIR_HAL_SET_MIMOPS_REQ 
+#define WDA_SET_MIMOPS_RSP                      SIR_HAL_SET_MIMOPS_RSP
+#define WDA_SYS_READY_IND                       SIR_HAL_SYS_READY_IND
+#define WDA_SET_TX_POWER_REQ                    SIR_HAL_SET_TX_POWER_REQ
+#define WDA_SET_TX_POWER_RSP                    SIR_HAL_SET_TX_POWER_RSP
+#define WDA_GET_TX_POWER_REQ                    SIR_HAL_GET_TX_POWER_REQ
+#define WDA_GET_TX_POWER_RSP                    SIR_HAL_GET_TX_POWER_RSP
+#define WDA_GET_NOISE_REQ                       SIR_HAL_GET_NOISE_REQ 
+#define WDA_GET_NOISE_RSP                       SIR_HAL_GET_NOISE_RSP
+#define WDA_SET_TX_PER_TRACKING_REQ    SIR_HAL_SET_TX_PER_TRACKING_REQ
+
+/* Messages to support transmit_halt and transmit_resume */
+#define WDA_TRANSMISSION_CONTROL_IND            SIR_HAL_TRANSMISSION_CONTROL_IND
+/* Indication from LIM to HAL to Initialize radar interrupt */
+#define WDA_INIT_RADAR_IND                      SIR_HAL_INIT_RADAR_IND
+/* Messages to support transmit_halt and transmit_resume */
+
+
+#define WDA_BEACON_PRE_IND             SIR_HAL_BEACON_PRE_IND
+#define WDA_ENTER_UAPSD_REQ            SIR_HAL_ENTER_UAPSD_REQ
+#define WDA_ENTER_UAPSD_RSP            SIR_HAL_ENTER_UAPSD_RSP
+#define WDA_EXIT_UAPSD_REQ             SIR_HAL_EXIT_UAPSD_REQ 
+#define WDA_EXIT_UAPSD_RSP             SIR_HAL_EXIT_UAPSD_RSP
+#define WDA_LOW_RSSI_IND               SIR_HAL_LOW_RSSI_IND 
+#define WDA_BEACON_FILTER_IND          SIR_HAL_BEACON_FILTER_IND
+/// PE <-> HAL WOWL messages
+#define WDA_WOWL_ADD_BCAST_PTRN        SIR_HAL_WOWL_ADD_BCAST_PTRN
+#define WDA_WOWL_DEL_BCAST_PTRN        SIR_HAL_WOWL_DEL_BCAST_PTRN
+#define WDA_WOWL_ENTER_REQ             SIR_HAL_WOWL_ENTER_REQ
+#define WDA_WOWL_ENTER_RSP             SIR_HAL_WOWL_ENTER_RSP
+#define WDA_WOWL_EXIT_REQ              SIR_HAL_WOWL_EXIT_REQ
+#define WDA_WOWL_EXIT_RSP              SIR_HAL_WOWL_EXIT_RSP
+#define WDA_TX_COMPLETE_IND            SIR_HAL_TX_COMPLETE_IND
+#define WDA_TIMER_RA_COLLECT_AND_ADAPT SIR_HAL_TIMER_RA_COLLECT_AND_ADAPT
+/// PE <-> HAL statistics messages
+#define WDA_GET_STATISTICS_REQ         SIR_HAL_GET_STATISTICS_REQ
+#define WDA_GET_STATISTICS_RSP         SIR_HAL_GET_STATISTICS_RSP
+#define WDA_SET_KEY_DONE               SIR_HAL_SET_KEY_DONE
+
+/// PE <-> HAL BTC messages
+#define WDA_BTC_SET_CFG                SIR_HAL_BTC_SET_CFG
+#define WDA_SIGNAL_BT_EVENT            SIR_HAL_SIGNAL_BT_EVENT
+#define WDA_HANDLE_FW_MBOX_RSP         SIR_HAL_HANDLE_FW_MBOX_RSP
+#define WDA_UPDATE_PROBE_RSP_TEMPLATE_IND     SIR_HAL_UPDATE_PROBE_RSP_TEMPLATE_IND
+#define WDA_SIGNAL_BTAMP_EVENT         SIR_HAL_SIGNAL_BTAMP_EVENT
+
+#ifdef ANI_CHIPSET_VOLANS
+#endif
+
+#define WDA_SET_MAX_TX_POWER_REQ       SIR_HAL_SET_MAX_TX_POWER_REQ
+#define WDA_SET_MAX_TX_POWER_RSP       SIR_HAL_SET_MAX_TX_POWER_RSP
+
+#define WDA_SEND_MSG_COMPLETE          SIR_HAL_SEND_MSG_COMPLETE 
+
+/// PE <-> HAL Host Offload message
+#define WDA_SET_HOST_OFFLOAD           SIR_HAL_SET_HOST_OFFLOAD
+
+/// PE <-> HAL Keep Alive message
+#define WDA_SET_KEEP_ALIVE             SIR_HAL_SET_KEEP_ALIVE
+
+#ifdef WLAN_NS_OFFLOAD
+#define WDA_SET_NS_OFFLOAD             SIR_HAL_SET_NS_OFFLOAD
+#endif //WLAN_NS_OFFLOAD
+#define WDA_ADD_STA_SELF_REQ           SIR_HAL_ADD_STA_SELF_REQ
+#define WDA_DEL_STA_SELF_REQ           SIR_HAL_DEL_STA_SELF_REQ
+
+#ifdef WLAN_FEATURE_P2P
+#define WDA_SET_P2P_GO_NOA_REQ         SIR_HAL_SET_P2P_GO_NOA_REQ
+#endif
+
+#define WDA_TX_COMPLETE_TIMEOUT_IND  WDA_MSG_TYPES_END - 1
+#define WDA_WLAN_SUSPEND_IND           SIR_HAL_WLAN_SUSPEND_IND
+#define WDA_WLAN_RESUME_REQ           SIR_HAL_WLAN_RESUME_REQ
+#define WDA_MSG_TYPES_END    SIR_HAL_MSG_TYPES_END
+
+#define WDA_SUSPEND_ACTIVITY_RSP SIR_HAL_SUSPEND_ACTIVITY_RSP
+
+
+#define WDA_MMH_TXMB_READY_EVT SIR_HAL_MMH_TXMB_READY_EVT     
+#define WDA_MMH_RXMB_DONE_EVT  SIR_HAL_MMH_RXMB_DONE_EVT    
+#define WDA_MMH_MSGQ_NE_EVT    SIR_HAL_MMH_MSGQ_NE_EVT
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+#define WDA_AGGR_QOS_REQ               SIR_HAL_AGGR_QOS_REQ
+#define WDA_AGGR_QOS_RSP               SIR_HAL_AGGR_QOS_RSP
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+/* FTM CMD MSG */
+#define WDA_FTM_CMD_REQ        SIR_PTT_MSG_TYPES_BEGIN
+#define WDA_FTM_CMD_RSP        SIR_PTT_MSG_TYPES_END
+#endif /* ANI_MANF_DIAG */
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*Requests sent to lower driver*/
+#define WDA_SET_PNO_REQ             SIR_HAL_SET_PNO_REQ
+#define WDA_SET_RSSI_FILTER_REQ     SIR_HAL_SET_RSSI_FILTER_REQ
+#define WDA_UPDATE_SCAN_PARAMS_REQ  SIR_HAL_UPDATE_SCAN_PARAMS
+
+/*Indication comming from lower driver*/
+#define WDA_SET_PNO_CHANGED_IND     SIR_HAL_SET_PNO_CHANGED_IND
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_WAKEUP_EVENTS
+#define WDA_WAKE_REASON_IND    SIR_HAL_WAKE_REASON_IND  
+#endif // WLAN_WAKEUP_EVENTS
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+#define WDA_8023_MULTICAST_LIST_REQ                     SIR_HAL_8023_MULTICAST_LIST_REQ
+#define WDA_RECEIVE_FILTER_SET_FILTER_REQ               SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ
+#define WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ    SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ
+#define WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP    SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP
+#define WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ             SIR_HAL_RECEIVE_FILTER_CLEAR_FILTER_REQ   
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#define WDA_SET_POWER_PARAMS_REQ   SIR_HAL_SET_POWER_PARAMS_REQ
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+#define WDA_GTK_OFFLOAD_REQ             SIR_HAL_GTK_OFFLOAD_REQ
+#define WDA_GTK_OFFLOAD_GETINFO_REQ     SIR_HAL_GTK_OFFLOAD_GETINFO_REQ
+#define WDA_GTK_OFFLOAD_GETINFO_RSP     SIR_HAL_GTK_OFFLOAD_GETINFO_RSP
+#endif //WLAN_FEATURE_GTK_OFFLOAD
+
+#define WDA_SET_TM_LEVEL_REQ       SIR_HAL_SET_TM_LEVEL_REQ
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+tSirRetStatus wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
+#endif
+
+#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
+#define VOS_MODULE_ID_WDA VOS_MODULE_ID_HAL
+
+//Required by TL
+
+//WDA Functions to HAL functions Mapping
+//Required by SME and PE
+#define WDA_SetRegDomain halPhySetRegDomain 
+#define wdaPostCtrlMsg halPostMsgApi
+#else
+eHalStatus WDA_SetRegDomain(void * clientCtxt, v_REGDOMAIN_t regId);
+#endif //FEATURE_WLAN_NON_INTEGRATED_SOC
+
+#define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define halTxFrame(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, pData, txFlag) \
+   (eHalStatus)( WDA_TxPacket(\
+         vos_get_context(VOS_MODULE_ID_WDA, vos_get_global_context(VOS_MODULE_ID_WDA, (hHal))),\
+         (pFrmBuf),\
+         (frmLen),\
+         (frmType),\
+         (txDir),\
+         (tid),\
+         (pCompFunc),\
+         (pData),\
+         (NULL), \
+         (txFlag)) )
+
+#define halTxFrameWithTxComplete(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, pData, pCBackFnTxComp, txFlag) \
+   (eHalStatus)( WDA_TxPacket(\
+         vos_get_context(VOS_MODULE_ID_WDA, vos_get_global_context(VOS_MODULE_ID_WDA, (hHal))),\
+         (pFrmBuf),\
+         (frmLen),\
+         (frmType),\
+         (txDir),\
+         (tid),\
+         (pCompFunc),\
+         (pData),\
+         (pCBackFnTxComp), \
+         (txFlag)) )
+#endif
+
+/* -----------------------------------------------------------------
+  WDA data path API's for TL
+ -------------------------------------------------------------------*/
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+v_BOOL_t WDA_IsHwFrameTxTranslationCapable(v_PVOID_t pVosGCtx, 
+                                                      tANI_U8 staIdx);
+#else
+#  define WDA_IsHwFrameTxTranslationCapable(vosGCtx, staId) \
+      WLANHAL_IsHwFrameTxTranslationCapable(vosGCtx, staId)
+#endif
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_EnableUapsdAcParams(vosGCtx, staId, uapsdInfo) \
+         WDA_SetUapsdAcParamsReq(vosGCtx, staId, uapsdInfo)
+#else
+#  define WDA_EnableUapsdAcParams(vosGCtx, staId, uapsdInfo) \
+         WLANHAL_EnableUapsdAcParams(vosGCtx, staId, uapsdInfo)
+#endif
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_DisableUapsdAcParams(vosGCtx, staId, ac) \
+          WDA_ClearUapsdAcParamsReq(vosGCtx, staId, ac)
+#else
+#  define WDA_DisableUapsdAcParams(vosGCtx, staId, ac) \
+         WLANHAL_DisableUapsdAcParams(vosGCtx, staId, ac)
+#endif
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#  define WDA_SetRSSIThresholds(pMac, pThresholds) \
+         WDA_SetRSSIThresholdsReq(pMac, pThresholds)
+#else
+#  define WDA_SetRSSIThresholds(pMac, pThresholds) \
+         halPS_SetRSSIThresholds(pMac, pThresholds)
+#endif
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define WDA_UpdateRssiBmps(pvosGCtx,  staId, rssi) \
+        WLANTL_UpdateRssiBmps (pvosGCtx, staId, rssi)
+#endif
+
+#ifdef WLAN_PERF 
+/*==========================================================================
+  FUNCTION    WDA_TLI_FastHwFwdDataFrame
+
+  DESCRIPTION 
+    For NON integrated SOC, this function is called by TL.
+
+    Fast path function to quickly forward a data frame if HAL determines BD 
+    signature computed here matches the signature inside current VOSS packet. 
+    If there is a match, HAL and TL fills in the swapped packet length into 
+    BD header and DxE header, respectively. Otherwise, packet goes back to 
+    normal (slow) path and a new BD signature would be tagged into BD in this
+    VOSS packet later by the WLANHAL_FillTxBd() function.
+
+  TODO  For integrated SOC, this function does nothing yet. Pima SLM/HAL 
+        should provide the equivelant functionality.
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+        vosDataBuff Ptr to VOSS packet
+        pMetaInfo   For getting frame's TID
+        pStaInfo    For checking STA type
+    
+   OUT
+        pvosStatus  returned status
+        puFastFwdOK Flag to indicate whether frame could be fast forwarded
+   
+  RETURN VALUE
+    No return.   
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void WDA_TLI_FastHwFwdDataFrame
+(
+  v_PVOID_t     pvosGCtx,
+  vos_pkt_t*    vosDataBuff,
+  VOS_STATUS*   pvosStatus,
+  v_U32_t*       puFastFwdOK,
+  WLANTL_MetaInfoType*  pMetaInfo,
+  WLAN_STADescType*  pStaInfo
+);
+#endif /* WLAN_PERF */
+
+/*==========================================================================
+  FUNCTION    WDA_DS_Register
+
+  DESCRIPTION 
+    Register TL client to WDA. This function registers TL RX/TX functions
+    to WDI by calling WDI_DS_Register.
+
+
+    For NON integrated SOC, this function calls WLANBAL_RegTlCbFunctions
+    to register TL's RX/TX functions to BAL
+
+  TODO 
+    For Prima, pfnResourceCB gets called in WDTS_OOResourceNotification.
+    The uCount parameter is AC mask. It should be redefined to use the
+    same resource callback function.
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+        pfnTxCompleteCallback       TX complete callback upon TX completion
+        pfnRxPacketCallback         RX callback
+        pfnResourceCB               gets called when updating TX PDU number
+        uResTheshold                minimum TX PDU size for a packet
+        pCallbackContext            WDI calls callback function with it
+                                    VOS global context pointer
+   OUT
+        uAvailableTxBuf       available TX PDU numbder. 
+                              BAL returns it for NON integrated SOC
+   
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS 
+WDA_DS_Register 
+( 
+  v_PVOID_t                 pvosGCtx, 
+  WDA_DS_TxCompleteCallback pfnTxCompleteCallback,
+  WDA_DS_RxPacketCallback   pfnRxPacketCallback, 
+  WDA_DS_TxPacketCallback   pfnTxPacketCallback,
+  WDA_DS_ResourceCB         pfnResourceCB,
+  v_U32_t                   uResTheshold,
+  v_PVOID_t                 pCallbackContext,
+  v_U32_t                   *uAvailableTxBuf
+);
+
+/*==========================================================================
+  FUNCTION    WDA_DS_StartXmit
+
+  DESCRIPTION 
+    Serialize TX transmit reques to TX thread. 
+
+  TODO This sends TX transmit request to TL. It should send to WDI for
+         abstraction.
+
+    For NON integrated SOC, this function calls WLANBAL_StartXmit
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+   
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WDA_DS_StartXmit
+(
+  v_PVOID_t pvosGCtx
+);
+
+/*==========================================================================
+  FUNCTION    WDA_DS_FinishULA
+
+  DESCRIPTION 
+    Serialize Finish Upper Level Authentication reques to TX thread. 
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        callbackRoutine    routine to be called in TX thread
+        callbackContext    user data for the above routine 
+   
+  RETURN VALUE
+    please see vos_tx_mq_serialize
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WDA_DS_FinishULA
+(
+ void (*callbackRoutine) (void *callbackContext),
+ void  *callbackContext
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_BuildTxPacketInfo
+
+  DESCRIPTION
+    Build TX meta info for integrated SOC.
+    
+    Same function calls HAL for reserve BD header space into VOS packet and
+    HAL function to fill it.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    vosDataBuff      vos data buffer
+    pvDestMacAddr   destination MAC address ponter
+    ucDisableFrmXtl  Is frame xtl disabled?
+    ucQosEnabled     Is QoS enabled?
+    ucWDSEnabled     Is WDS enabled?
+    extraHeadSpace   Extra head bytes. If it's not 0 due to 4 bytes align
+                     of BD header.
+    typeSubtype      typeSubtype from MAC header or TX metainfo/BD
+    pAddr2           address 2
+    uTid             tid
+    txFlag
+    timeStamp
+    ucIsEapol
+    ucUP
+
+   OUT
+    *pusPktLen       Packet length
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_BuildTxPacketInfo
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t*      vosDataBuff,
+  v_MACADDR_t*    pvDestMacAddr,
+  v_U8_t          ucDisableFrmXtl,
+  v_U16_t*        pusPktLen,
+  v_U8_t          ucQosEnabled,
+  v_U8_t          ucWDSEnabled,
+  v_U8_t          extraHeadSpace,
+  v_U8_t          typeSubtype,
+  v_PVOID_t       pAddr2,
+  v_U8_t          uTid,
+  v_U8_t          txFlag,
+  v_U32_t         timeStamp,
+  v_U8_t          ucIsEapol,
+  v_U8_t          ucUP
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_PeekRxPacketInfo
+
+  DESCRIPTION
+    Return RX metainfo pointer for for integrated SOC.
+    
+    Same function will return BD header pointer.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+    pvDestMacAddr    destination MAC address ponter
+    bSwap            Want to swap BD header? For backward compatability
+                     It does nothing for integrated SOC
+   OUT
+    *ppRxHeader      RX metainfo pointer
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_PeekRxPacketInfo
+(
+  vos_pkt_t *vosDataBuff,
+  v_PVOID_t *ppRxHeader,
+  v_BOOL_t  bSwap
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_TrimRxPacketInfo
+
+  DESCRIPTION
+    Trim/Remove RX BD header for NON integrated SOC.
+    It does nothing for integrated SOC.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_TrimRxPacketInfo
+( 
+  vos_pkt_t *vosDataBuff
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetTxResources
+
+  DESCRIPTION
+    It does return hardcoded value for Prima. It should bigger number than 0.
+    Returning 0 will put TL in out-of-resource condition for TX.
+
+    Return current PDU resources from BAL for NON integrated SOC.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+   
+   OUT
+    puResCount        available PDU number for TX
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetTxResources
+( 
+  v_PVOID_t pvosGCtx,
+  v_U32_t*  puResCount
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetRssi
+
+  DESCRIPTION
+    Get RSSI 
+
+  TODO It returns hardcoded value in the meantime since WDA/WDI does nothing
+       support it yet for Prima.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+   OUT
+    puRssi           RSSI
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetRssi
+(
+  v_PVOID_t pvosGCtx,
+  v_S7_t*   puRssi
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_RxAmsduBdFix
+
+  DESCRIPTION
+    For backward compatability with Libra/Volans. Need to call HAL function
+    for HW BD bug fix
+
+    It does nothing for integrated SOC.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    pvBDHeader       BD header pointer
+
+   OUT
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_RxAmsduBdFix
+(
+  v_PVOID_t pvosGCtx,
+  v_PVOID_t pvBDHeader
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetFrameTypeSubType
+
+  DESCRIPTION
+    Get typeSubtype from the packet. The BD header should have this.
+    But some reason, Libra/Volans read it from 802.11 header and save it
+    back to BD header. So for NON integrated SOC, this function does
+    the same.
+
+    For integrated SOC, WDI does the same, not TL. 
+    It does return typeSubtype from RX meta info for integrated SOC.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    vosDataBuff      vos data buffer
+    pRxHeader        RX meta info or BD header pointer
+
+   OUT
+    ucTypeSubtype    typeSubtype
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetFrameTypeSubType
+(
+  v_PVOID_t pvosGCtx,
+  vos_pkt_t *vosDataBuff,
+  v_PVOID_t pRxHeader,
+  v_U8_t    *ucTypeSubtype
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetReplayCounter
+
+  DESCRIPTION
+    Return replay counter from BD header or RX meta info
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pRxHeader        RX meta info or BD header pointer
+
+   OUT
+
+  RETURN VALUE
+    Replay Counter
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_U64_t
+WDA_DS_GetReplayCounter
+(
+  v_PVOID_t pRxHeader
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetReplayCounter
+
+  DESCRIPTION
+    HO support. Set RSSI threshold via HAL function for NON integrated SOC
+
+  TODO
+    Same function should be provided by WDA/WDI for Prima.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pMac             MAC global pointer
+    pThresholds      pointer of threshold structure to set.
+
+   OUT
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_SetRSSIThresholds
+(
+  tpAniSirGlobal      pMac,
+  tpSirRSSIThresholds pThresholds
+);
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+/*==========================================================================
+   FUNCTION    WDA_DS_TxFrames
+
+  DESCRIPTION
+    Pull packets from TL and push them to WDI. It gets invoked upon
+    WDA_DS_TX_START_XMIT.
+
+    This function is equivelant of WLANSSC_Transmit in Libra/Volans.
+
+  TODO
+    This function should be implemented and moved in WDI.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+
+   OUT
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_TxFrames
+( 
+  v_PVOID_t pvosGCtx 
+);
+#endif
+
+/*==========================================================================
+   FUNCTION    WDA_DS_TxFlowControlCallback
+
+  DESCRIPTION
+    Invoked by WDI to control TX flow.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    uFlowMask        TX channel mask for flow control
+                     Defined in WDA_TXFlowEnumType
+
+   OUT
+
+  RETURN VALUE
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_VOID_t
+WDA_DS_TxFlowControlCallback
+(
+ v_PVOID_t pvosGCtx,
+ v_U8_t    uFlowMask
+);
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetTxFlowMask
+
+  DESCRIPTION
+    return TX flow mask control value
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+
+   OUT
+    uFlowMask        TX channel mask for flow control
+                     Defined in WDA_TXFlowEnumType
+
+  RETURN VALUE
+    VOS_STATUS_E_INVAL:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetTxFlowMask
+(
+ v_PVOID_t pvosGCtx,
+ v_U8_t*   puFlowMask
+);
+
+/*==========================================================================
+   FUNCTION    WDA_HALDumpCmdReq
+
+  DESCRIPTION
+    Send Dump commandsto WDI
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pMac             MAC global pointer
+    cmd               Hal dump command
+    arg1              Dump command argument 1
+    arg2              Dump command argument 2
+    arg3              Dump command argument 3
+    arg4              Dump command argument 4
+
+   OUT
+       pBuffer          Dump command Response buffer
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS WDA_HALDumpCmdReq(tpAniSirGlobal   pMac,tANI_U32 cmd, 
+                 tANI_U32   arg1, tANI_U32   arg2, tANI_U32   arg3,
+                 tANI_U32   arg4, tANI_U8   *pBuffer);
+
+/*==========================================================================
+   FUNCTION    WDA_featureCapsExchange
+
+  DESCRIPTION
+    WDA API to invoke capability exchange between host and FW
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pVosContext         VOS context
+
+   OUT
+    NONE
+
+  RETURN VALUE
+    NONE
+    
+  SIDE EFFECTS
+============================================================================*/
+void WDA_featureCapsExchange(v_PVOID_t pVosContext);
+
+/*==========================================================================
+   FUNCTION    WDA_getHostWlanFeatCaps
+
+  DESCRIPTION
+    Wrapper for WDI API, that will return if the feature (enum value).passed
+    to this API is supported or not in Host
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    featEnumValue     enum value for the feature as in placeHolderInCapBitmap in wlan_hal_msg.h.
+
+   OUT
+    NONE
+
+  RETURN VALUE
+    0 - implies feature is NOT Supported
+    any non zero value - implies feature is SUPPORTED
+    
+  SIDE EFFECTS
+============================================================================*/
+tANI_U8 WDA_getHostWlanFeatCaps(tANI_U8 featEnumValue);
+
+/*==========================================================================
+   FUNCTION    WDA_getFwWlanFeatCaps
+
+  DESCRIPTION
+    Wrapper for WDI API, that will return if the feature (enum value).passed
+    to this API is supported or not in FW
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    featEnumValue     enum value for the feature as in placeHolderInCapBitmap in wlan_hal_msg.h.
+
+   OUT
+    NONE
+
+  RETURN VALUE
+    0 - implies feature is NOT Supported
+    any non zero value - implies feature is SUPPORTED
+    
+  SIDE EFFECTS
+============================================================================*/
+tANI_U8 WDA_getFwWlanFeatCaps(tANI_U8 featEnumValue);
+
+#endif
diff --git a/CORE/WDA/inc/wlan_qct_wda_msg.h b/CORE/WDA/inc/wlan_qct_wda_msg.h
new file mode 100644
index 0000000..952c217
--- /dev/null
+++ b/CORE/WDA/inc/wlan_qct_wda_msg.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.
+ */
+
+#ifndef WLAN_QCT_MSG_MAP_H
+#define WLAN_QCT_MSG_MAP_H
+
+/*===========================================================================
+
+               W L A N   DEVICE ADAPTATION   L A Y E R 
+                       MSG MAPPING  
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan adaptation layer 
+  
+      
+  Copyright (c) 2008 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
+--------    ---         ----------------------------------------------
+25/08/2010  adwivedi     MAP WDA messages on Legacy HAL messages
+=========================================================================== */
+
+/* Add Include */
+#include "wlan_qct_pack_align.h"
+
+
+#define      WDA_CONFIG_PARAM_UPDATE_REQ    SIR_CFG_PARAM_UPDATE_IND
+
+#define     ALIGNED_WORD_SIZE       4
+
+/* Config format required by HAL for each CFG item*/
+WPT_PACK_START
+typedef WPT_PACK_PRE struct
+{
+   /* Cfg Id. The Id required by HAL is exported by HAL
+    * in shared header file between UMAC and HAL.*/
+   tANI_U16   type;
+
+   /* Length of the Cfg. This parameter is used to go to next cfg 
+    * in the TLV format.*/
+   tANI_U16   length;
+
+   /* Padding bytes for unaligned address's */
+   tANI_U16    padBytes;
+
+   /* Reserve bytes for making cfgVal to align address */
+   tANI_U16    reserved;
+
+   /* Following the uCfgLen field there should be a 'uCfgLen' bytes
+    * containing the uCfgValue ; tANI_U8 uCfgValue[uCfgLen] */
+}WPT_PACK_POST tHalCfg, *tpHalCfg;
+WPT_PACK_END
+
+/////#define WDA_UT
+#ifdef WDA_UT
+#define      WDA_WDI_EVENT_MSG                0x00FF
+void WDI_processEvent(void *wdiEventData, void *pUserData);
+#endif
+
+#endif
diff --git a/CORE/WDA/src/wlan_nv.c b/CORE/WDA/src/wlan_nv.c
new file mode 100644
index 0000000..a3b453b
--- /dev/null
+++ b/CORE/WDA/src/wlan_nv.c
@@ -0,0 +1,8765 @@
+/*
+ * 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 wlan_nv.c
+
+   \brief Contains collection of table default values to use in
+          case a table is not found in NV
+
+    $Id$
+
+   ========================================================================== */
+
+#ifndef WLAN_NV_C
+#define WLAN_NV_C
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+
+#include "wlan_nv.h"
+
+const sHalNv nvDefaults =
+{
+    {
+        0,                                                              // tANI_U16  productId;
+        0,                                                              // tANI_U8   productBands;
+        1,                                                              // tANI_U8   wlanNvRevId; //0: WCN1312, 1: WCN1314, 2: WCN3660
+        1,                                                              // tANI_U8   numOfTxChains;
+        2,                                                              // tANI_U8   numOfRxChains;
+        { 0x00, 0xDE, 0xAD, 0xBE, 0xEF, 0x00 },                         // tANI_U8   macAddr[NV_FIELD_MAC_ADDR_SIZE];
+        { "\0" }
+    }, //fields
+
+    {
+        // NV_TABLE_RATE_POWER_SETTINGS
+        {
+            // typedef tANI_S8 tPowerdBm;
+            //typedef tPowerdBm tRateGroupPwr[NUM_HAL_PHY_RATES];
+            //tRateGroupPwr       pwrOptimum[NUM_RF_SUBBANDS];
+            {
+                    //802.11b Rates
+                {2150},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {2150},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                    //SLR Rates
+                {2150},    // HAL_PHY_RATE_SLR_0_25_MBPS,
+                {2150},    // HAL_PHY_RATE_SLR_0_5_MBPS,
+
+                    //11A 20MHz Rates
+                {1750},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1750},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                    //MCS Index #0-15 (20MHz)
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1750},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1550}     // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+            },  //    RF_SUBBAND_2_4_GHZ,
+        },
+
+
+        // NV_TABLE_REGULATORY_DOMAINS
+        {
+            // typedef struct
+            // {
+            //     tANI_BOOLEAN enabled;
+            //     tPowerdBm pwrLimit;
+            // }sRegulatoryChannel;
+
+            // typedef struct
+            // {
+            //     sRegulatoryChannel channels[NUM_RF_CHANNELS];
+            //     uAbsPwrPrecision antennaGain[NUM_RF_SUBBANDS];
+            //     uAbsPwrPrecision bRatePowerOffset[NUM_2_4GHZ_CHANNELS];
+            // }sRegulatoryDomains;
+
+            //sRegulatoryDomains  regDomains[NUM_REG_DOMAINS];
+
+
+            {   // REG_DOMAIN_FCC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 23},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 22},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 22},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_FCC end
+
+            {   // REG_DOMAIN_ETSI start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 19},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 19},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_ETSI end
+
+            {   // REG_DOMAIN_JAPAN start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 20},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_TRUE, 18},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_JAPAN end
+
+            {   // REG_DOMAIN_WORLD start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_WORLD end
+
+            {   // REG_DOMAIN_N_AMER_EXC_FCC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 16},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 30},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            },   // REG_DOMAIN_N_AMER_EXC_FCC end
+
+            {   // REG_DOMAIN_APAC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 26},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_APAC end
+
+            {   // REG_DOMAIN_KOREA start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 15},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_KOREA end
+
+            {   // REG_DOMAIN_HI_5GHZ start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 14},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_HI_5GHZ end
+
+            {   // REG_DOMAIN_NO_5GHZ start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_1,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_2,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_3,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_4,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_5,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_6,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_7,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_8,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_9,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_10,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_11,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_12,
+                    {eANI_BOOLEAN_TRUE, 12},           //RF_CHAN_13,
+                    {eANI_BOOLEAN_FALSE, 0},           //RF_CHAN_14,
+
+                }, //sRegulatoryChannel end
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            } // REG_DOMAIN_NO_5GHZ end
+        },
+
+        // NV_TABLE_DEFAULT_COUNTRY
+        {
+            // typedef struct
+            // {
+            //     tANI_U8 regDomain;                                      //from eRegDomainId
+            //     tANI_U8 countryCode[NV_FIELD_COUNTRY_CODE_SIZE];    // string identifier
+            // }sDefaultCountry;
+
+            0,                  // regDomain
+            { 'U', 'S', 'I' }   // countryCode
+        },
+
+        //NV_TABLE_TPC_POWER_TABLE
+        {
+            {
+                {
+                    0  , //0
+                    41 , //1
+                    43 , //2
+                    45 , //3
+                    47 , //4
+                    49 , //5
+                    51 , //6
+                    53 , //7
+                    55 , //8
+                    56 , //9
+                    58 , //10
+                    59 , //11
+                    60 , //12
+                    62 , //13
+                    63 , //14
+                    64 , //15
+                    65 , //16
+                    67 , //17
+                    68 , //18
+                    69 , //19
+                    70 , //20
+                    71 , //21
+                    72 , //22
+                    73 , //23
+                    74 , //24
+                    75 , //25
+                    75 , //26
+                    76 , //27
+                    77 , //28
+                    78 , //29
+                    78 , //30
+                    79 , //31
+                    80 , //32
+                    81 , //33
+                    82 , //34
+                    82 , //35
+                    83 , //36
+                    83 , //37
+                    84 , //38
+                    85 , //39
+                    86 , //40
+                    86 , //41
+                    87 , //42
+                    88 , //43
+                    89 , //44
+                    89 , //45
+                    90 , //46
+                    91 , //47
+                    91 , //48
+                    92 , //49
+                    92 , //50
+                    93 , //51
+                    93 , //52
+                    94 , //53
+                    94 , //54
+                    95 , //55
+                    95 , //56
+                    95 , //57
+                    96 , //58
+                    96 , //59
+                    97 , //60
+                    97 , //61
+                    98 , //62
+                    98 , //63
+                    98 , //64
+                    99 , //65
+                    99 , //66
+                    99 , //67
+                    100, //68
+                    100, //69
+                    100, //70
+                    101, //71
+                    101, //72
+                    102, //73
+                    102, //74
+                    102, //75
+                    102, //76
+                    103, //77
+                    103, //78
+                    103, //79
+                    103, //80
+                    104, //81
+                    104, //82
+                    104, //83
+                    104, //84
+                    105, //85
+                    105, //86
+                    105, //87
+                    105, //88
+                    105, //89
+                    106, //90
+                    106, //91
+                    106, //92
+                    106, //93
+                    106, //94
+                    106, //95
+                    106, //96
+                    106, //97
+                    106, //98
+                    106, //99
+                    106, //100
+                    106, //101
+                    106, //102
+                    106, //103
+                    106, //104
+                    106, //105
+                    107, //106
+                    107, //107
+                    107, //108
+                    107, //109
+                    107, //110
+                    107, //111
+                    107, //112
+                    107, //113
+                    107, //114
+                    107, //115
+                    107, //116
+                    107, //117
+                    107, //118
+                    107, //119
+                    107, //120
+                    107, //121
+                    107, //122
+                    107, //123
+                    107, //124
+                    107, //125
+                    107, //126
+                    107, //127
+                }
+            }, //RF_CHAN_1
+            {
+                {
+                    0  , //0
+                    41 , //1
+                    43 , //2
+                    45 , //3
+                    47 , //4
+                    49 , //5
+                    51 , //6
+                    52 , //7
+                    54 , //8
+                    56 , //9
+                    57 , //10
+                    59 , //11
+                    60 , //12
+                    61 , //13
+                    62 , //14
+                    64 , //15
+                    65 , //16
+                    66 , //17
+                    67 , //18
+                    68 , //19
+                    69 , //20
+                    70 , //21
+                    71 , //22
+                    72 , //23
+                    73 , //24
+                    74 , //25
+                    75 , //26
+                    75 , //27
+                    76 , //28
+                    77 , //29
+                    78 , //30
+                    79 , //31
+                    79 , //32
+                    80 , //33
+                    81 , //34
+                    82 , //35
+                    82 , //36
+                    83 , //37
+                    84 , //38
+                    85 , //39
+                    85 , //40
+                    86 , //41
+                    87 , //42
+                    88 , //43
+                    88 , //44
+                    89 , //45
+                    89 , //46
+                    90 , //47
+                    91 , //48
+                    91 , //49
+                    92 , //50
+                    92 , //51
+                    93 , //52
+                    93 , //53
+                    94 , //54
+                    94 , //55
+                    95 , //56
+                    95 , //57
+                    96 , //58
+                    96 , //59
+                    96 , //60
+                    97 , //61
+                    97 , //62
+                    98 , //63
+                    98 , //64
+                    98 , //65
+                    99 , //66
+                    99 , //67
+                    99 , //68
+                    100, //69
+                    100, //70
+                    101, //71
+                    101, //72
+                    101, //73
+                    101, //74
+                    102, //75
+                    102, //76
+                    102, //77
+                    103, //78
+                    103, //79
+                    103, //80
+                    104, //81
+                    104, //82
+                    104, //83
+                    104, //84
+                    105, //85
+                    105, //86
+                    105, //87
+                    105, //88
+                    105, //89
+                    106, //90
+                    106, //91
+                    106, //92
+                    106, //93
+                    106, //94
+                    106, //95
+                    106, //96
+                    106, //97
+                    106, //98
+                    106, //99
+                    106, //100
+                    106, //101
+                    106, //102
+                    107, //103
+                    107, //104
+                    107, //105
+                    107, //106
+                    107, //107
+                    107, //108
+                    107, //109
+                    107, //110
+                    107, //111
+                    107, //112
+                    107, //113
+                    107, //114
+                    107, //115
+                    107, //116
+                    107, //117
+                    107, //118
+                    107, //119
+                    107, //120
+                    107, //121
+                    107, //122
+                    107, //123
+                    107, //124
+                    107, //125
+                    107, //126
+                    107, //127
+                }
+            }, //RF_CHAN_2
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        52 , //7
+                        54 , //8
+                        55 , //9
+                        57 , //10
+                        58 , //11
+                        60 , //12
+                        61 , //13
+                        62 , //14
+                        64 , //15
+                        65 , //16
+                        66 , //17
+                        67 , //18
+                        68 , //19
+                        69 , //20
+                        70 , //21
+                        71 , //22
+                        72 , //23
+                        73 , //24
+                        74 , //25
+                        75 , //26
+                        75 , //27
+                        76 , //28
+                        77 , //29
+                        78 , //30
+                        78 , //31
+                        79 , //32
+                        80 , //33
+                        81 , //34
+                        82 , //35
+                        82 , //36
+                        83 , //37
+                        84 , //38
+                        84 , //39
+                        85 , //40
+                        86 , //41
+                        87 , //42
+                        87 , //43
+                        88 , //44
+                        89 , //45
+                        89 , //46
+                        90 , //47
+                        90 , //48
+                        91 , //49
+                        91 , //50
+                        92 , //51
+                        93 , //52
+                        93 , //53
+                        94 , //54
+                        94 , //55
+                        94 , //56
+                        95 , //57
+                        95 , //58
+                        96 , //59
+                        96 , //60
+                        97 , //61
+                        97 , //62
+                        97 , //63
+                        98 , //64
+                        98 , //65
+                        99 , //66
+                        99 , //67
+                        99 , //68
+                        100, //69
+                        100, //70
+                        100, //71
+                        101, //72
+                        101, //73
+                        101, //74
+                        102, //75
+                        102, //76
+                        102, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        103, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                    }
+                }, //RF_CHAN_3
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        75 , //26
+                        76 , //27
+                        77 , //28
+                        78 , //29
+                        78 , //30
+                        79 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        82 , //35
+                        83 , //36
+                        84 , //37
+                        84 , //38
+                        85 , //39
+                        86 , //40
+                        87 , //41
+                        87 , //42
+                        88 , //43
+                        88 , //44
+                        89 , //45
+                        90 , //46
+                        90 , //47
+                        91 , //48
+                        91 , //49
+                        92 , //50
+                        92 , //51
+                        93 , //52
+                        93 , //53
+                        94 , //54
+                        94 , //55
+                        95 , //56
+                        95 , //57
+                        95 , //58
+                        96 , //59
+                        96 , //60
+                        97 , //61
+                        97 , //62
+                        98 , //63
+                        98 , //64
+                        98 , //65
+                        99 , //66
+                        99 , //67
+                        99 , //68
+                        100, //69
+                        100, //70
+                        100, //71
+                        101, //72
+                        101, //73
+                        101, //74
+                        102, //75
+                        102, //76
+                        102, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        103, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                    }
+                }, //RF_CHAN_4
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        54 , //8
+                        56 , //9
+                        57 , //10
+                        59 , //11
+                        60 , //12
+                        62 , //13
+                        63 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        69 , //20
+                        71 , //21
+                        72 , //22
+                        72 , //23
+                        73 , //24
+                        74 , //25
+                        75 , //26
+                        76 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        79 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        83 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        89 , //43
+                        89 , //44
+                        90 , //45
+                        91 , //46
+                        91 , //47
+                        92 , //48
+                        92 , //49
+                        93 , //50
+                        93 , //51
+                        94 , //52
+                        94 , //53
+                        95 , //54
+                        95 , //55
+                        96 , //56
+                        96 , //57
+                        96 , //58
+                        97 , //59
+                        97 , //60
+                        98 , //61
+                        98 , //62
+                        98 , //63
+                        99 , //64
+                        99 , //65
+                        100, //66
+                        100, //67
+                        100, //68
+                        101, //69
+                        101, //70
+                        101, //71
+                        102, //72
+                        102, //73
+                        102, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                    }
+                }, //RF_CHAN_5
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        56 , //9
+                        58 , //10
+                        59 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        65 , //16
+                        66 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        83 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        89 , //43
+                        89 , //44
+                        90 , //45
+                        91 , //46
+                        91 , //47
+                        92 , //48
+                        92 , //49
+                        93 , //50
+                        93 , //51
+                        94 , //52
+                        94 , //53
+                        95 , //54
+                        95 , //55
+                        96 , //56
+                        96 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        98 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        101, //70
+                        102, //71
+                        102, //72
+                        102, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                    }
+                }, //RF_CHAN_6
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        56 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        84 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        88 , //43
+                        89 , //44
+                        90 , //45
+                        90 , //46
+                        91 , //47
+                        91 , //48
+                        92 , //49
+                        92 , //50
+                        93 , //51
+                        93 , //52
+                        94 , //53
+                        94 , //54
+                        95 , //55
+                        95 , //56
+                        96 , //57
+                        96 , //58
+                        97 , //59
+                        97 , //60
+                        97 , //61
+                        98 , //62
+                        98 , //63
+                        99 , //64
+                        99 , //65
+                        99 , //66
+                        100, //67
+                        100, //68
+                        100, //69
+                        101, //70
+                        101, //71
+                        101, //72
+                        102, //73
+                        102, //74
+                        102, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        103, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                    }
+                }, //RF_CHAN_7
+                {
+                    {
+                        0  , //0
+                        40 , //1
+                        42 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        52 , //7
+                        54 , //8
+                        56 , //9
+                        58 , //10
+                        59 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        81 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        89 , //42
+                        89 , //43
+                        90 , //44
+                        91 , //45
+                        91 , //46
+                        92 , //47
+                        92 , //48
+                        93 , //49
+                        93 , //50
+                        94 , //51
+                        94 , //52
+                        95 , //53
+                        95 , //54
+                        96 , //55
+                        96 , //56
+                        97 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        99 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        102, //70
+                        102, //71
+                        102, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        104, //76
+                        104, //77
+                        104, //78
+                        104, //79
+                        105, //80
+                        105, //81
+                        105, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        106, //88
+                        106, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                    }
+                }, //RF_CHAN_8
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        58 , //9
+                        59 , //10
+                        60 , //11
+                        62 , //12
+                        63 , //13
+                        64 , //14
+                        66 , //15
+                        67 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        78 , //27
+                        79 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        83 , //33
+                        83 , //34
+                        84 , //35
+                        85 , //36
+                        86 , //37
+                        87 , //38
+                        87 , //39
+                        88 , //40
+                        89 , //41
+                        89 , //42
+                        90 , //43
+                        91 , //44
+                        91 , //45
+                        92 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        95 , //53
+                        96 , //54
+                        96 , //55
+                        97 , //56
+                        97 , //57
+                        98 , //58
+                        98 , //59
+                        98 , //60
+                        99 , //61
+                        99 , //62
+                        100, //63
+                        100, //64
+                        100, //65
+                        101, //66
+                        101, //67
+                        101, //68
+                        102, //69
+                        102, //70
+                        103, //71
+                        103, //72
+                        103, //73
+                        104, //74
+                        104, //75
+                        104, //76
+                        104, //77
+                        105, //78
+                        105, //79
+                        105, //80
+                        105, //81
+                        105, //82
+                        105, //83
+                        106, //84
+                        106, //85
+                        106, //86
+                        106, //87
+                        106, //88
+                        106, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        107, //99
+                        107, //100
+                        107, //101
+                        107, //102
+                        107, //103
+                        107, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                    }
+                }, //RF_CHAN_9
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        47 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        53 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        62 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        67 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        83 , //33
+                        84 , //34
+                        85 , //35
+                        85 , //36
+                        86 , //37
+                        87 , //38
+                        88 , //39
+                        89 , //40
+                        89 , //41
+                        90 , //42
+                        90 , //43
+                        91 , //44
+                        92 , //45
+                        92 , //46
+                        93 , //47
+                        94 , //48
+                        94 , //49
+                        95 , //50
+                        95 , //51
+                        96 , //52
+                        96 , //53
+                        96 , //54
+                        97 , //55
+                        97 , //56
+                        98 , //57
+                        98 , //58
+                        99 , //59
+                        99 , //60
+                        99 , //61
+                        100, //62
+                        100, //63
+                        101, //64
+                        101, //65
+                        102, //66
+                        102, //67
+                        102, //68
+                        103, //69
+                        103, //70
+                        103, //71
+                        104, //72
+                        104, //73
+                        104, //74
+                        105, //75
+                        105, //76
+                        105, //77
+                        105, //78
+                        105, //79
+                        106, //80
+                        106, //81
+                        106, //82
+                        106, //83
+                        106, //84
+                        106, //85
+                        106, //86
+                        106, //87
+                        106, //88
+                        107, //89
+                        107, //90
+                        107, //91
+                        107, //92
+                        107, //93
+                        107, //94
+                        107, //95
+                        107, //96
+                        107, //97
+                        107, //98
+                        107, //99
+                        107, //100
+                        107, //101
+                        107, //102
+                        107, //103
+                        107, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                    }
+                }, //RF_CHAN_10
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        47 , //3
+                        49 , //4
+                        51 , //5
+                        52 , //6
+                        54 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        82 , //33
+                        83 , //34
+                        84 , //35
+                        85 , //36
+                        86 , //37
+                        86 , //38
+                        87 , //39
+                        88 , //40
+                        89 , //41
+                        90 , //42
+                        90 , //43
+                        91 , //44
+                        91 , //45
+                        92 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        96 , //53
+                        96 , //54
+                        97 , //55
+                        97 , //56
+                        97 , //57
+                        98 , //58
+                        98 , //59
+                        99 , //60
+                        99 , //61
+                        100, //62
+                        100, //63
+                        100, //64
+                        101, //65
+                        101, //66
+                        101, //67
+                        102, //68
+                        102, //69
+                        102, //70
+                        103, //71
+                        103, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        104, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                    }
+                }, //RF_CHAN_11
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        57 , //9
+                        59 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        80 , //31
+                        81 , //32
+                        82 , //33
+                        83 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        88 , //42
+                        89 , //43
+                        90 , //44
+                        90 , //45
+                        91 , //46
+                        92 , //47
+                        92 , //48
+                        93 , //49
+                        93 , //50
+                        94 , //51
+                        94 , //52
+                        95 , //53
+                        95 , //54
+                        96 , //55
+                        96 , //56
+                        96 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        99 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        101, //70
+                        102, //71
+                        102, //72
+                        102, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        104, //90
+                        104, //91
+                        104, //92
+                        104, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                    }
+                }, //RF_CHAN_12
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        58 , //9
+                        59 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        80 , //31
+                        81 , //32
+                        82 , //33
+                        83 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        89 , //42
+                        89 , //43
+                        90 , //44
+                        91 , //45
+                        91 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        95 , //53
+                        96 , //54
+                        96 , //55
+                        97 , //56
+                        97 , //57
+                        97 , //58
+                        98 , //59
+                        98 , //60
+                        99 , //61
+                        99 , //62
+                        100, //63
+                        100, //64
+                        100, //65
+                        101, //66
+                        101, //67
+                        101, //68
+                        102, //69
+                        102, //70
+                        102, //71
+                        103, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                    }
+                }, //RF_CHAN_13
+                {
+                    {
+                       0,  //0
+                       40,  //1
+                       43,  //2
+                       45,  //3
+                       47,  //4
+                       49,  //5
+                       50,  //6
+                       52,  //7
+                       54,  //8
+                       56,  //9
+                       57,  //10
+                       58,  //11
+                       59,  //12
+                       60,  //13
+                       62,  //14
+                       63,  //15
+                       64,  //16
+                       65,  //17
+                       66,  //18
+                       67,  //19
+                       68,  //20
+                       69,  //21
+                       70,  //22
+                       71,  //23
+                       72,  //24
+                       73,  //25
+                       74,  //26
+                       74,  //27
+                       75,  //28
+                       76,  //29
+                       77,  //30
+                       78,  //31
+                       78,  //32
+                       79,  //33
+                       80,  //34
+                       81,  //35
+                       82,  //36
+                       83,  //37
+                       83,  //38
+                       84,  //39
+                       85,  //40
+                       85,  //41
+                       86,  //42
+                       87,  //43
+                       87,  //44
+                       88,  //45
+                       89,  //46
+                       89,  //47
+                       90,  //48
+                       90,  //49
+                       91,  //50
+                       91,  //51
+                       92,  //52
+                       92,  //53
+                       93,  //54
+                       93,  //55
+                       94,  //56
+                       94,  //57
+                       95,  //58
+                       95,  //59
+                       96,  //60
+                       96,  //61
+                       96,  //62
+                       97,  //63
+                       97,  //64
+                       97,  //65
+                       98,  //66
+                       98,  //67
+                       98,  //68
+                       98,  //69
+                       99,  //70
+                       99,  //71
+                       99,  //72
+                       99,  //73
+                       99,  //74
+                       99,  //75
+                       99,  //76
+                       99,  //77
+                       99,  //78
+                       99,  //79
+                       100,  //80
+                       100,  //81
+                       100,  //82
+                       100,  //83
+                       100,  //84
+                       100,  //85
+                       100,  //86
+                       100,  //87
+                       100,  //88
+                       100,  //89
+                       100,  //90
+                       100,  //91
+                       100,  //92
+                       100,  //93
+                       100,  //94
+                       100,  //95
+                       100,  //96
+                       100,  //97
+                       100, //98
+                       100, //99
+                       100, //100
+                       100, //101
+                       100, //102
+                       100, //103
+                       100, //104
+                       100, //105
+                       100, //106
+                       100, //107
+                       100, //108
+                       100, //109
+                       100, //110
+                       100, //111
+                       100, //112
+                       100, //113
+                       100, //114
+                       100, //115
+                       100, //116
+                       100, //117
+                       100, //118
+                       100, //119
+                       100, //120
+                       100, //121
+                       100, //122
+                       100, //123
+                       100, //124
+                       100, //125
+                       100, //126
+                       100, //127
+                    }
+                }, //RF_CHAN_14
+        },
+
+        //NV_TABLE_TPC_PDADC_OFFSETS
+        {
+            98,  // RF_CHAN_1
+            101,  // RF_CHAN_2
+            101,  // RF_CHAN_3
+            100,  // RF_CHAN_4
+            98,  // RF_CHAN_5
+            97,  // RF_CHAN_6
+            94,  // RF_CHAN_7
+            94,  // RF_CHAN_8
+            92,  // RF_CHAN_9
+            90,  // RF_CHAN_10
+            94,  // RF_CHAN_11
+            95,  // RF_CHAN_12
+            97,  // RF_CHAN_13
+            104   // RF_CHAN_14
+        },
+#if 0
+        //NV_TABLE_CAL_MEMORY
+        {
+            0x7FFF,      // tANI_U16    process_monitor;
+            0x00,        // tANI_U8     hdet_cal_code;
+            0x00,        // tANI_U8     rxfe_gm_2;
+
+            0x00,        // tANI_U8     tx_bbf_rtune;
+            0x00,        // tANI_U8     pa_rtune_reg;
+            0x00,        // tANI_U8     rt_code;
+            0x00,        // tANI_U8     bias_rtune;
+
+            0x00,        // tANI_U8     bb_bw1;
+            0x00,        // tANI_U8     bb_bw2;
+            { 0x00, 0x00 },        // tANI_U8     reserved[2];
+
+            0x00,        // tANI_U8     bb_bw3;
+            0x00,        // tANI_U8     bb_bw4;
+            0x00,        // tANI_U8     bb_bw5;
+            0x00,        // tANI_U8     bb_bw6;
+
+            0x7FFF,      // tANI_U16    rcMeasured;
+            0x00,        // tANI_U8     tx_bbf_ct;
+            0x00,        // tANI_U8     tx_bbf_ctr;
+
+            0x00,        // tANI_U8     csh_maxgain_reg;
+            0x00,        // tANI_U8     csh_0db_reg;
+            0x00,        // tANI_U8     csh_m3db_reg;
+            0x00,        // tANI_U8     csh_m6db_reg;
+
+            0x00,        // tANI_U8     cff_0db_reg;
+            0x00,        // tANI_U8     cff_m3db_reg;
+            0x00,        // tANI_U8     cff_m6db_reg;
+            0x00,        // tANI_U8     rxfe_gpio_ctl_1;
+
+            0x00,        // tANI_U8     mix_bal_cnt_2;
+            0x00,        // tANI_S8     rxfe_lna_highgain_bias_ctl_delta;
+            0x00,        // tANI_U8     rxfe_lna_load_ctune;
+            0x00,        // tANI_U8     rxfe_lna_ngm_rtune;
+
+            0x00,        // tANI_U8     rx_im2_i_cfg0;
+            0x00,        // tANI_U8     rx_im2_i_cfg1;
+            0x00,        // tANI_U8     rx_im2_q_cfg0;
+            0x00,        // tANI_U8     rx_im2_q_cfg1;
+
+            0x00,        // tANI_U8     pll_vfc_reg3_b0;
+            0x00,        // tANI_U8     pll_vfc_reg3_b1;
+            0x00,        // tANI_U8     pll_vfc_reg3_b2;
+            0x00,        // tANI_U8     pll_vfc_reg3_b3;
+
+            0x7FFF,        // tANI_U16    tempStart;
+            0x7FFF,        // tANI_U16    tempFinish;
+
+            { //txLoCorrections
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // tTxLoCorrections    txLoValues;
+
+            { //sTxIQChannel
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // sTxIQChannel        txIqValues;
+
+            { //sRxIQChannel
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // sRxIQChannel        rxIqValues;
+
+            { // tTpcConfig          clpcData[MAX_TPC_CHANNELS]
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_1
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_2
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_3
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_4
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_5
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_6
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_7
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_8
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_9
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_10
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_11
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_12
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                },  // RF_CHAN_13
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }  // RF_CHAN_14
+            },        // tTpcConfig          clpcData[MAX_TPC_CHANNELS];
+
+            {
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_1: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_2: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_3: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_4: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_5: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_6: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_7: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_8: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_9: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_10: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_11: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_12: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_13: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }  // RF_CHAN_14: pdadc_offset, reserved[2]
+            }        // tTpcParams          clpcParams[MAX_TPC_CHANNELS];
+
+        }, //NV_TABLE_CAL_MEMORY
+
+        //NV_TABLE_CAL_STATUS
+        {
+            0xFF,        // tANI_U8     overall;
+            0xFF,        // tANI_U8     fwInit;
+            0xFF,        // tANI_U8     hdet_dco;
+            0xFF,        // tANI_U8     rtuner;
+            0xFF,        // tANI_U8     ctuner;
+            0xFF,        // tANI_U8     insitu;
+            0xFF,        // tANI_U8     process_monitor;
+            0xFF,        // tANI_U8     pllVcoLinearity;
+            0xFF,        // tANI_U8     txIQ;
+            0xFF,        // tANI_U8     rxIQ;
+            0xFF,        // tANI_U8     rxDco;
+            0xFF,        // tANI_U8     txLo;
+            0xFF,        // tANI_U8     lnaBias;
+            0xFF,        // tANI_U8     lnaBandTuning;
+            0xFF,        // tANI_U8     lnaGainAdjust;
+            0xFF,        // tANI_U8     im2UsingNoisePwr;
+            0xFF,        // tANI_U8     temperature;
+            0xFF,        // tANI_U8     clpc;
+            0xFF,        // tANI_U8     clpc_temp_adjust;
+            0xFF,        // tANI_U8     txDpd;
+            0xFF,        // tANI_U8     channelTune;
+            0xFF,        // tANI_U8     rxGmStageLinearity;
+            0xFF,        // tANI_U8     im2UsingToneGen;
+            {
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00
+            }        // tANI_U8     unused[9];
+        },
+#endif
+        //NV_TABLE_RSSI_CHANNEL_OFFSETS
+        {
+            //PHY_RX_CHAIN_0
+            {
+                //bRssiOffset
+                {300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300},
+
+                //gnRssiOffset
+                {300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300}
+            },
+            //rsvd
+            {
+                //bRssiOffset
+                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+
+                //gnRssiOffset
+                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+            }
+        },
+
+        //NV_TABLE_RF_CAL_VALUES
+        {
+            //typedef struct
+            //{
+            //    tANI_U32 calStatus;  //use eNvCalID
+            //    sCalData calData;
+            //}sRFCalValues;
+
+            0,               //calStatus
+            {
+                0,           //process_monitor;
+                0,           //hdet_cal_code;
+                0,           //rxfe_gm_2;
+
+                0,           //tx_bbf_rtune;
+                0,           //pa_rtune_reg;
+                0,           //rt_code;
+                0,           //bias_rtune;
+
+                0,           //bb_bw1;
+                0,           //bb_bw2;
+                0,           //reserved0;
+                0,           //reserved11;
+
+                0,           //bb_bw3;
+                0,           //bb_bw4;
+                0,           //bb_bw5;
+                0,           //bb_bw6;
+
+                0,           //rcMeasured;
+                0,           //tx_bbf_ct;
+                0,           //tx_bbf_ctr;
+
+                0,           //csh_maxgain_reg;
+                0,           //csh_0db_reg;
+                0,           //csh_m3db_reg;
+                0,           //csh_m6db_reg;
+
+                0,           //cff_0db_reg;
+                0,           //cff_m3db_reg;
+                0,           //cff_m6db_reg;
+                0,           //rxfe_gpio_ctl_1;
+
+                0,           //mix_bal_cnt_2;
+                0,           //rxfe_lna_highgain_bias_ctl_delta;
+                0,           //rxfe_lna_load_ctune;
+                0,           //rxfe_lna_ngm_rtune;
+
+                0,           //rx_im2_spare0;
+                0,           //rx_im2_spare1;
+                0,           //hdet_dco
+
+                0,           //pll_vfc_reg3_b0;
+                0,           //pll_vfc_reg3_b1;
+                0,           //pll_vfc_reg3_b2;
+                0,           //pll_vfc_reg3_b3;
+
+                0,           //tempStart;
+                0,           //roomTemp;
+
+                0,           //ambientCalTemp;
+                0,           //ambientCalTempValid;
+                0            //reserved2;
+            }
+        },
+
+        //NV_TABLE_ANTENNA_PATH_LOSS
+        {
+            280,  // RF_CHAN_1
+            270,  // RF_CHAN_2
+            270,  // RF_CHAN_3
+            270,  // RF_CHAN_4
+            270,  // RF_CHAN_5
+            270,  // RF_CHAN_6
+            280,  // RF_CHAN_7
+            280,  // RF_CHAN_8
+            290,  // RF_CHAN_9
+            300,  // RF_CHAN_10
+            300,  // RF_CHAN_11
+            310,  // RF_CHAN_12
+            310,  // RF_CHAN_13
+            310   // RF_CHAN_14
+        },
+
+        //NV_TABLE_PACKET_TYPE_POWER_LIMITS
+        {
+            {
+                2150,  // RF_CHAN_1
+                2150,  // RF_CHAN_2
+                2150,  // RF_CHAN_3
+                2150,  // RF_CHAN_4
+                2150,  // RF_CHAN_5
+                2150,  // RF_CHAN_6
+                2150,  // RF_CHAN_7
+                2150,  // RF_CHAN_8
+                2150,  // RF_CHAN_9
+                2150,  // RF_CHAN_10
+                2150,  // RF_CHAN_11
+                2150,  // RF_CHAN_12
+                2150,  // RF_CHAN_13
+                2150   // RF_CHAN_14
+            },//MODE_802_11B
+
+            {
+                1850,  // RF_CHAN_1
+                1950,  // RF_CHAN_2
+                1950,  // RF_CHAN_3
+                1950,  // RF_CHAN_4
+                1950,  // RF_CHAN_5
+                1950,  // RF_CHAN_6
+                1950,  // RF_CHAN_7
+                1950,  // RF_CHAN_8
+                1950,  // RF_CHAN_9
+                1950,  // RF_CHAN_10
+                1750,  // RF_CHAN_11
+                1950,  // RF_CHAN_12
+                1950,  // RF_CHAN_13
+                1950   // RF_CHAN_14
+            },//MODE_802_11AG
+
+            {
+                1750,  // RF_CHAN_1
+                1750,  // RF_CHAN_2
+                1750,  // RF_CHAN_3
+                1750,  // RF_CHAN_4
+                1750,  // RF_CHAN_5
+                1750,  // RF_CHAN_6
+                1750,  // RF_CHAN_7
+                1750,  // RF_CHAN_8
+                1750,  // RF_CHAN_9
+                1750,  // RF_CHAN_10
+                1750,  // RF_CHAN_11
+                1750,  // RF_CHAN_12
+                1750,  // RF_CHAN_13
+                1750   // RF_CHAN_14
+            },//MODE_802_11AG
+        },
+
+        //NV_TABLE_OFDM_CMD_PWR_OFFSET
+        {
+            0, 0
+        },
+
+        //NV_TABLE_TX_BB_FILTER_MODE
+        {
+            0
+        }
+
+    } // tables
+};
+
+#else 
+
+#include "palTypes.h"
+#include "wlan_nv.h"
+//#include "wlan_hal_msg.h"
+
+const sHalNv nvDefaults =
+{
+    {
+        0,                                                              // tANI_U16  productId;
+        1,                                                              // tANI_U8   productBands;
+        2,                                                              // tANI_U8   wlanNvRevId; //0: WCN1312, 1: WCN1314, 2: WCN3660
+        1,                                                              // tANI_U8   numOfTxChains;
+        1,                                                              // tANI_U8   numOfRxChains;
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },                         // tANI_U8   macAddr[NV_FIELD_MAC_ADDR_SIZE];
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },                         // tANI_U8   macAddr[NV_FIELD_MAC_ADDR_SIZE];
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },                         // tANI_U8   macAddr[NV_FIELD_MAC_ADDR_SIZE];
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },                         // tANI_U8   macAddr[NV_FIELD_MAC_ADDR_SIZE];
+        { "\0" },
+        0,                                                              // tANI_U8   0 : Internal coupler, 1 : External coupler
+        0                                                               // Reserved Byte to make alignment
+    }, //fields
+
+    {
+        // NV_TABLE_RATE_POWER_SETTINGS
+        {
+            // typedef tANI_S8 tPowerdBm;
+            //typedef tPowerdBm tRateGroupPwr[NUM_HAL_PHY_RATES];
+            //tRateGroupPwr       pwrOptimum[NUM_RF_SUBBANDS];
+            {
+                    //802.11b Rates
+                {1900},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {1900},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                //11A 20MHz Rates
+                {1700},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1700},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1700},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                //DUP 11A 40MHz Rates
+                {1700},    // HAL_PHY_RATE_11A_DUP_6_MBPS,
+                {1700},    // HAL_PHY_RATE_11A_DUP_9_MBPS,
+                {1700},    // HAL_PHY_RATE_11A_DUP_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_DUP_18_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_24_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_36_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_48_MBPS,
+                {1500},    // HAL_PHY_RATE_11A_DUP_54_MBPS,
+
+                //MCS Index #0-7(20/40MHz)
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1300},     // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+
+                //MCS Index #8-15(20/40MHz)
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_CB_13_5_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_CB_27_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_CB_40_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_54_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_CB_81_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_CB_108_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_CB_121_5_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_CB_135_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_15_MBPS,
+                {1700},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_30_MBPS,
+                {1650},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_45_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_60_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_90_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
+                {1350},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                },  //    RF_SUBBAND_2_4_GHZ
+
+                {
+                //802.11b Rates
+                {0},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                //11A 20MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                //DUP 11A 40MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_DUP_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_DUP_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_DUP_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_54_MBPS,
+
+                //MCS Index #0-7(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1350},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+
+                //MCS Index #8-15(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_13_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_27_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_CB_40_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_CB_54_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_CB_81_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_CB_108_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_CB_121_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_CB_135_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_15_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_30_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_45_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_60_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_90_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                },  //    RF_SUBBAND_5_LOW_GHZ
+
+                // 5G Mid
+                {
+                //802.11b Rates
+                {0},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                //11A 20MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                //DUP 11A 40MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_DUP_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_DUP_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_DUP_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_54_MBPS,
+
+                //MCS Index #0-7(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1350},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+
+                //MCS Index #8-15(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_13_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_27_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_CB_40_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_CB_54_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_CB_81_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_CB_108_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_CB_121_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_CB_135_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_15_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_30_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_45_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_60_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_90_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                },  //    //     RF_SUBBAND_5_MID_GHZ
+                // 5G High
+                {
+                //802.11b Rates
+                {0},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                //11A 20MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                //DUP 11A 40MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_DUP_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_DUP_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_DUP_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_54_MBPS,
+
+                //MCS Index #0-7(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1350},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+
+                //MCS Index #8-15(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_13_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_27_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_CB_40_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_CB_54_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_CB_81_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_CB_108_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_CB_121_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_CB_135_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_15_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_30_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_45_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_60_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_90_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                },  //    RF_SUBBAND_5_HIGH_GHZ,
+                // 4.9G
+
+                {
+                //802.11b Rates
+                {0},    // HAL_PHY_RATE_11B_LONG_1_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_LONG_11_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_2_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_5_5_MBPS,
+                {0},    // HAL_PHY_RATE_11B_SHORT_11_MBPS,
+
+                //11A 20MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_12_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_54_MBPS,
+
+                //DUP 11A 40MHz Rates
+                {1600},    // HAL_PHY_RATE_11A_DUP_6_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_9_MBPS,
+                {1600},    // HAL_PHY_RATE_11A_DUP_12_MBPS,
+                {1650},    // HAL_PHY_RATE_11A_DUP_18_MBPS,
+                {1550},    // HAL_PHY_RATE_11A_DUP_24_MBPS,
+                {1450},    // HAL_PHY_RATE_11A_DUP_36_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_48_MBPS,
+                {1400},    // HAL_PHY_RATE_11A_DUP_54_MBPS,
+
+                //MCS Index #0-7(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_6_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_13_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_19_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_26_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_39_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_52_MBPS,
+                {1350},    // HAL_PHY_RATE_MCS_1NSS_58_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_65_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_7_2_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_14_4_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_21_7_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_28_9_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_43_3_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_57_8_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_65_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_72_2_MBPS,
+
+                //MCS Index #8-15(20/40MHz)
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_13_5_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_CB_27_MBPS,
+                {1550},    // HAL_PHY_RATE_MCS_1NSS_CB_40_5_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_CB_54_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_CB_81_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_CB_108_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_CB_121_5_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_CB_135_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_15_MBPS,
+                {1600},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_30_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_45_MBPS,
+                {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_60_MBPS,
+                {1450},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_90_MBPS,
+                {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
+                {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
+                {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                },  //    RF_SUBBAND_4_9_GHZ
+        },
+
+        // NV_TABLE_REGULATORY_DOMAINS
+        {
+            // typedef struct
+            // {
+            //     tANI_BOOLEAN enabled;
+            //     tPowerdBm pwrLimit;
+            // }sRegulatoryChannel;
+
+            // typedef struct
+            // {
+            //     sRegulatoryChannel channels[NUM_RF_CHANNELS];
+            //     uAbsPwrPrecision antennaGain[NUM_RF_SUBBANDS];
+            //     uAbsPwrPrecision bRatePowerOffset[NUM_2_4GHZ_CHANNELS];
+            // }sRegulatoryDomains;
+
+            //sRegulatoryDomains  regDomains[NUM_REG_DOMAINS];
+
+
+            {   // REG_DOMAIN_FCC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 23},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 22},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 22},           //RF_CHAN_11,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_12,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},             //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},             //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},             //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},             //RF_CHAN_48,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_52,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_56,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_60,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DFS, 22},                //RF_CHAN_100,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_104,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_108,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_112,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_128,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_132,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_136,
+                    {NV_CHANNEL_DFS, 24},                //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_ENABLE, 0},             //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_FCC end
+
+            {   // REG_DOMAIN_ETSI start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 19},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 19},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_48,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_52,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_56,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_60,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_100,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_104,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_108,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_112,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_128,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_132,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_136,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_149,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_153,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_157,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_161,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 23},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_ETSI end
+
+            {   // REG_DOMAIN_JAPAN start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 20},           //RF_CHAN_13,
+                    {NV_CHANNEL_ENABLE, 18},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_52,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_56,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_60,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DFS, 22},               //RF_CHAN_100,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_104,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_108,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_112,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_116,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_120,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_124,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_128,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_132,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_136,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_JAPAN end
+
+            {   // REG_DOMAIN_WORLD start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_52,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_56,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_60,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DFS, 22},               //RF_CHAN_100,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_104,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_108,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_112,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_116,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_120,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_124,
+                    {NV_CHANNEL_DFS, 0},                //RF_CHAN_128,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_132,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_136,
+                    {NV_CHANNEL_DFS, 24},               //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_WORLD end
+
+            {   // REG_DOMAIN_N_AMER_EXC_FCC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_11,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_12,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 30},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_52,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_56,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_60,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DISABLE, 22},            //RF_CHAN_100,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_104,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_108,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_112,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_128,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_132,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_136,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            },   // REG_DOMAIN_N_AMER_EXC_FCC end
+
+            {   // REG_DOMAIN_APAC start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 26},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 16},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_52,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_56,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_60,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DISABLE, 22},            //RF_CHAN_100,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_104,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_108,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_112,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_128,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_132,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_136,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_APAC end
+
+            {   // REG_DOMAIN_KOREA start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 15},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_52,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_56,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_60,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DISABLE, 22},            //RF_CHAN_100,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_104,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_108,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_112,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_128,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_132,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_136,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_KOREA end
+
+            {   // REG_DOMAIN_HI_5GHZ start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                    //2.4GHz Band, none CB
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 14},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+
+                    //4.9GHz Band, none CB
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_240,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_244,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_248,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_252,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_208,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_212,
+                    {NV_CHANNEL_DISABLE, 23},            //RF_CHAN_216,
+
+                    //5GHz Low & Mid U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_36,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_40,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_44,
+                    {NV_CHANNEL_ENABLE, 17},            //RF_CHAN_48,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_52,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_56,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_60,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_64,
+
+                    //5GHz Mid Band - ETSI, none CB
+                    {NV_CHANNEL_DISABLE, 22},            //RF_CHAN_100,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_104,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_108,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_112,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_116,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_120,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_124,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_128,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_132,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_136,
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_140,
+
+                    //5GHz High U-NII Band, none CB
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_149,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_153,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_157,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_161,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_165,
+
+                    //2.4GHz Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_3,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_4,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_5,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_6,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_7,
+                    {NV_CHANNEL_ENABLE, 30},            //RF_CHAN_BOND_8,
+                    {NV_CHANNEL_ENABLE, 22},            //RF_CHAN_BOND_9,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_10,
+                    {NV_CHANNEL_ENABLE, 0},            //RF_CHAN_BOND_11,
+
+                    // 4.9GHz Band, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_242,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_246,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_250,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_210,
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_214,
+
+                    //5GHz Low & Mid U-NII Band, channel bonded channels
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_38,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_42,
+                    {NV_CHANNEL_ENABLE, 20},            //RF_CHAN_BOND_46,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_50,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_54,
+                    {NV_CHANNEL_ENABLE, 27},            //RF_CHAN_BOND_58,
+                    {NV_CHANNEL_ENABLE, 25},            //RF_CHAN_BOND_62,
+
+                    //5GHz Mid Band - ETSI, channel bonded channels
+                    {NV_CHANNEL_DISABLE, 24},            //RF_CHAN_BOND_102
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_106
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_110
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_114
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_118
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_122
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_126
+                    {NV_CHANNEL_DISABLE, 0},            //RF_CHAN_BOND_130
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_134
+                    {NV_CHANNEL_DISABLE, 27},            //RF_CHAN_BOND_138
+
+                    //5GHz High U-NII Band,  channel bonded channels
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_151,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_155,
+                    {NV_CHANNEL_DISABLE, 30},            //RF_CHAN_BOND_159,
+                    {NV_CHANNEL_DISABLE, 0},             //RF_CHAN_BOND_163
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            }, // REG_DOMAIN_HI_5GHZ end
+
+            {   // REG_DOMAIN_NO_5GHZ start
+                { //sRegulatoryChannel start
+                    //enabled, pwrLimit
+                                       //2.4GHz Band
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_1,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_2,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_3,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_4,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_5,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_6,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_7,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_8,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_9,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_10,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_11,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_12,
+                    {NV_CHANNEL_ENABLE, 12},           //RF_CHAN_13,
+                    {NV_CHANNEL_DISABLE, 0},           //RF_CHAN_14,
+                }, //sRegulatoryChannel end
+
+                {
+                    { 0 },  // RF_SUBBAND_2_4_GHZ
+                    {0},   // RF_SUBBAND_5_LOW_GHZ
+                    {0},   // RF_SUBBAND_5_MID_GHZ
+                    {0},   // RF_SUBBAND_5_HIGH_GHZ
+                    {0}    // RF_SUBBAND_4_9_GHZ
+                },
+
+                { // bRatePowerOffset start
+                    //2.4GHz Band
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                }, // bRatePowerOffset end
+
+                { // gnRatePowerOffset start
+                    //apply to all 2.4 and 5G channels
+                    { 0 },                       //RF_CHAN_1,
+                    { 0 },                       //RF_CHAN_2,
+                    { 0 },                       //RF_CHAN_3,
+                    { 0 },                       //RF_CHAN_4,
+                    { 0 },                       //RF_CHAN_5,
+                    { 0 },                       //RF_CHAN_6,
+                    { 0 },                       //RF_CHAN_7,
+                    { 0 },                       //RF_CHAN_8,
+                    { 0 },                       //RF_CHAN_9,
+                    { 0 },                       //RF_CHAN_10,
+                    { 0 },                       //RF_CHAN_11,
+                    { 0 },                       //RF_CHAN_12,
+                    { 0 },                       //RF_CHAN_13,
+                    { 0 },                       //RF_CHAN_14,
+                } // gnRatePowerOffset end
+            } // REG_DOMAIN_NO_5GHZ end
+        },
+
+        // NV_TABLE_DEFAULT_COUNTRY
+        {
+            // typedef struct
+            // {
+            //     tANI_U8 regDomain;                                      //from eRegDomainId
+            //     tANI_U8 countryCode[NV_FIELD_COUNTRY_CODE_SIZE];    // string identifier
+            // }sDefaultCountry;
+
+            0,                  // regDomain
+            { 'U', 'S', 'I' }   // countryCode
+        },
+
+        //NV_TABLE_TPC_POWER_TABLE
+        {
+            {
+                {
+                    0  , //0
+                    41 , //1
+                    43 , //2
+                    45 , //3
+                    47 , //4
+                    49 , //5
+                    51 , //6
+                    53 , //7
+                    55 , //8
+                    56 , //9
+                    58 , //10
+                    59 , //11
+                    60 , //12
+                    62 , //13
+                    63 , //14
+                    64 , //15
+                    65 , //16
+                    67 , //17
+                    68 , //18
+                    69 , //19
+                    70 , //20
+                    71 , //21
+                    72 , //22
+                    73 , //23
+                    74 , //24
+                    75 , //25
+                    75 , //26
+                    76 , //27
+                    77 , //28
+                    78 , //29
+                    78 , //30
+                    79 , //31
+                    80 , //32
+                    81 , //33
+                    82 , //34
+                    82 , //35
+                    83 , //36
+                    83 , //37
+                    84 , //38
+                    85 , //39
+                    86 , //40
+                    86 , //41
+                    87 , //42
+                    88 , //43
+                    89 , //44
+                    89 , //45
+                    90 , //46
+                    91 , //47
+                    91 , //48
+                    92 , //49
+                    92 , //50
+                    93 , //51
+                    93 , //52
+                    94 , //53
+                    94 , //54
+                    95 , //55
+                    95 , //56
+                    95 , //57
+                    96 , //58
+                    96 , //59
+                    97 , //60
+                    97 , //61
+                    98 , //62
+                    98 , //63
+                    98 , //64
+                    99 , //65
+                    99 , //66
+                    99 , //67
+                    100, //68
+                    100, //69
+                    100, //70
+                    101, //71
+                    101, //72
+                    102, //73
+                    102, //74
+                    102, //75
+                    102, //76
+                    103, //77
+                    103, //78
+                    103, //79
+                    103, //80
+                    104, //81
+                    104, //82
+                    104, //83
+                    104, //84
+                    105, //85
+                    105, //86
+                    105, //87
+                    105, //88
+                    105, //89
+                    106, //90
+                    106, //91
+                    106, //92
+                    106, //93
+                    106, //94
+                    106, //95
+                    106, //96
+                    106, //97
+                    106, //98
+                    106, //99
+                    106, //100
+                    106, //101
+                    106, //102
+                    106, //103
+                    106, //104
+                    106, //105
+                    107, //106
+                    107, //107
+                    107, //108
+                    107, //109
+                    107, //110
+                    107, //111
+                    107, //112
+                    107, //113
+                    107, //114
+                    107, //115
+                    107, //116
+                    107, //117
+                    107, //118
+                    107, //119
+                    107, //120
+                    107, //121
+                    107, //122
+                    107, //123
+                    107, //124
+                    107, //125
+                    107, //126
+                    107, //127
+                    107,
+                }
+            }, //RF_CHAN_1
+            {
+                {
+                    0  , //0
+                    41 , //1
+                    43 , //2
+                    45 , //3
+                    47 , //4
+                    49 , //5
+                    51 , //6
+                    52 , //7
+                    54 , //8
+                    56 , //9
+                    57 , //10
+                    59 , //11
+                    60 , //12
+                    61 , //13
+                    62 , //14
+                    64 , //15
+                    65 , //16
+                    66 , //17
+                    67 , //18
+                    68 , //19
+                    69 , //20
+                    70 , //21
+                    71 , //22
+                    72 , //23
+                    73 , //24
+                    74 , //25
+                    75 , //26
+                    75 , //27
+                    76 , //28
+                    77 , //29
+                    78 , //30
+                    79 , //31
+                    79 , //32
+                    80 , //33
+                    81 , //34
+                    82 , //35
+                    82 , //36
+                    83 , //37
+                    84 , //38
+                    85 , //39
+                    85 , //40
+                    86 , //41
+                    87 , //42
+                    88 , //43
+                    88 , //44
+                    89 , //45
+                    89 , //46
+                    90 , //47
+                    91 , //48
+                    91 , //49
+                    92 , //50
+                    92 , //51
+                    93 , //52
+                    93 , //53
+                    94 , //54
+                    94 , //55
+                    95 , //56
+                    95 , //57
+                    96 , //58
+                    96 , //59
+                    96 , //60
+                    97 , //61
+                    97 , //62
+                    98 , //63
+                    98 , //64
+                    98 , //65
+                    99 , //66
+                    99 , //67
+                    99 , //68
+                    100, //69
+                    100, //70
+                    101, //71
+                    101, //72
+                    101, //73
+                    101, //74
+                    102, //75
+                    102, //76
+                    102, //77
+                    103, //78
+                    103, //79
+                    103, //80
+                    104, //81
+                    104, //82
+                    104, //83
+                    104, //84
+                    105, //85
+                    105, //86
+                    105, //87
+                    105, //88
+                    105, //89
+                    106, //90
+                    106, //91
+                    106, //92
+                    106, //93
+                    106, //94
+                    106, //95
+                    106, //96
+                    106, //97
+                    106, //98
+                    106, //99
+                    106, //100
+                    106, //101
+                    106, //102
+                    107, //103
+                    107, //104
+                    107, //105
+                    107, //106
+                    107, //107
+                    107, //108
+                    107, //109
+                    107, //110
+                    107, //111
+                    107, //112
+                    107, //113
+                    107, //114
+                    107, //115
+                    107, //116
+                    107, //117
+                    107, //118
+                    107, //119
+                    107, //120
+                    107, //121
+                    107, //122
+                    107, //123
+                    107, //124
+                    107, //125
+                    107, //126
+                    107, //127
+                    107,
+                }
+            }, //RF_CHAN_2
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        52 , //7
+                        54 , //8
+                        55 , //9
+                        57 , //10
+                        58 , //11
+                        60 , //12
+                        61 , //13
+                        62 , //14
+                        64 , //15
+                        65 , //16
+                        66 , //17
+                        67 , //18
+                        68 , //19
+                        69 , //20
+                        70 , //21
+                        71 , //22
+                        72 , //23
+                        73 , //24
+                        74 , //25
+                        75 , //26
+                        75 , //27
+                        76 , //28
+                        77 , //29
+                        78 , //30
+                        78 , //31
+                        79 , //32
+                        80 , //33
+                        81 , //34
+                        82 , //35
+                        82 , //36
+                        83 , //37
+                        84 , //38
+                        84 , //39
+                        85 , //40
+                        86 , //41
+                        87 , //42
+                        87 , //43
+                        88 , //44
+                        89 , //45
+                        89 , //46
+                        90 , //47
+                        90 , //48
+                        91 , //49
+                        91 , //50
+                        92 , //51
+                        93 , //52
+                        93 , //53
+                        94 , //54
+                        94 , //55
+                        94 , //56
+                        95 , //57
+                        95 , //58
+                        96 , //59
+                        96 , //60
+                        97 , //61
+                        97 , //62
+                        97 , //63
+                        98 , //64
+                        98 , //65
+                        99 , //66
+                        99 , //67
+                        99 , //68
+                        100, //69
+                        100, //70
+                        100, //71
+                        101, //72
+                        101, //73
+                        101, //74
+                        102, //75
+                        102, //76
+                        102, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        103, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                        107,
+                    }
+                }, //RF_CHAN_3
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        75 , //26
+                        76 , //27
+                        77 , //28
+                        78 , //29
+                        78 , //30
+                        79 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        82 , //35
+                        83 , //36
+                        84 , //37
+                        84 , //38
+                        85 , //39
+                        86 , //40
+                        87 , //41
+                        87 , //42
+                        88 , //43
+                        88 , //44
+                        89 , //45
+                        90 , //46
+                        90 , //47
+                        91 , //48
+                        91 , //49
+                        92 , //50
+                        92 , //51
+                        93 , //52
+                        93 , //53
+                        94 , //54
+                        94 , //55
+                        95 , //56
+                        95 , //57
+                        95 , //58
+                        96 , //59
+                        96 , //60
+                        97 , //61
+                        97 , //62
+                        98 , //63
+                        98 , //64
+                        98 , //65
+                        99 , //66
+                        99 , //67
+                        99 , //68
+                        100, //69
+                        100, //70
+                        100, //71
+                        101, //72
+                        101, //73
+                        101, //74
+                        102, //75
+                        102, //76
+                        102, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        103, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                        106,
+                    }
+                }, //RF_CHAN_4
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        54 , //8
+                        56 , //9
+                        57 , //10
+                        59 , //11
+                        60 , //12
+                        62 , //13
+                        63 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        69 , //20
+                        71 , //21
+                        72 , //22
+                        72 , //23
+                        73 , //24
+                        74 , //25
+                        75 , //26
+                        76 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        79 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        83 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        89 , //43
+                        89 , //44
+                        90 , //45
+                        91 , //46
+                        91 , //47
+                        92 , //48
+                        92 , //49
+                        93 , //50
+                        93 , //51
+                        94 , //52
+                        94 , //53
+                        95 , //54
+                        95 , //55
+                        96 , //56
+                        96 , //57
+                        96 , //58
+                        97 , //59
+                        97 , //60
+                        98 , //61
+                        98 , //62
+                        98 , //63
+                        99 , //64
+                        99 , //65
+                        100, //66
+                        100, //67
+                        100, //68
+                        101, //69
+                        101, //70
+                        101, //71
+                        102, //72
+                        102, //73
+                        102, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                        106,
+                    }
+                }, //RF_CHAN_5
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        56 , //9
+                        58 , //10
+                        59 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        65 , //16
+                        66 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        83 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        89 , //43
+                        89 , //44
+                        90 , //45
+                        91 , //46
+                        91 , //47
+                        92 , //48
+                        92 , //49
+                        93 , //50
+                        93 , //51
+                        94 , //52
+                        94 , //53
+                        95 , //54
+                        95 , //55
+                        96 , //56
+                        96 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        98 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        101, //70
+                        102, //71
+                        102, //72
+                        102, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                        107,
+                    }
+                }, //RF_CHAN_6
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        53 , //7
+                        55 , //8
+                        56 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        64 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        80 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        84 , //36
+                        84 , //37
+                        85 , //38
+                        86 , //39
+                        87 , //40
+                        87 , //41
+                        88 , //42
+                        88 , //43
+                        89 , //44
+                        90 , //45
+                        90 , //46
+                        91 , //47
+                        91 , //48
+                        92 , //49
+                        92 , //50
+                        93 , //51
+                        93 , //52
+                        94 , //53
+                        94 , //54
+                        95 , //55
+                        95 , //56
+                        96 , //57
+                        96 , //58
+                        97 , //59
+                        97 , //60
+                        97 , //61
+                        98 , //62
+                        98 , //63
+                        99 , //64
+                        99 , //65
+                        99 , //66
+                        100, //67
+                        100, //68
+                        100, //69
+                        101, //70
+                        101, //71
+                        101, //72
+                        102, //73
+                        102, //74
+                        102, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        103, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        105, //86
+                        105, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        106, //105
+                        106, //106
+                        106, //107
+                        106, //108
+                        106, //109
+                        106, //110
+                        106, //111
+                        106, //112
+                        106, //113
+                        106, //114
+                        106, //115
+                        106, //116
+                        106, //117
+                        106, //118
+                        106, //119
+                        106, //120
+                        106, //121
+                        106, //122
+                        106, //123
+                        106, //124
+                        106, //125
+                        106, //126
+                        106, //127
+                        106,
+                    }
+                }, //RF_CHAN_7
+                {
+                    {
+                        0  , //0
+                        40 , //1
+                        42 , //2
+                        45 , //3
+                        47 , //4
+                        49 , //5
+                        51 , //6
+                        52 , //7
+                        54 , //8
+                        56 , //9
+                        58 , //10
+                        59 , //11
+                        61 , //12
+                        62 , //13
+                        63 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        68 , //18
+                        69 , //19
+                        70 , //20
+                        71 , //21
+                        72 , //22
+                        73 , //23
+                        74 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        77 , //28
+                        78 , //29
+                        79 , //30
+                        80 , //31
+                        81 , //32
+                        81 , //33
+                        82 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        89 , //42
+                        89 , //43
+                        90 , //44
+                        91 , //45
+                        91 , //46
+                        92 , //47
+                        92 , //48
+                        93 , //49
+                        93 , //50
+                        94 , //51
+                        94 , //52
+                        95 , //53
+                        95 , //54
+                        96 , //55
+                        96 , //56
+                        97 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        99 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        102, //70
+                        102, //71
+                        102, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        104, //76
+                        104, //77
+                        104, //78
+                        104, //79
+                        105, //80
+                        105, //81
+                        105, //82
+                        105, //83
+                        105, //84
+                        105, //85
+                        105, //86
+                        105, //87
+                        106, //88
+                        106, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        106, //99
+                        106, //100
+                        106, //101
+                        106, //102
+                        106, //103
+                        106, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                        107,
+                    }
+                }, //RF_CHAN_8
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        58 , //9
+                        59 , //10
+                        60 , //11
+                        62 , //12
+                        63 , //13
+                        64 , //14
+                        66 , //15
+                        67 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        78 , //27
+                        79 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        83 , //33
+                        83 , //34
+                        84 , //35
+                        85 , //36
+                        86 , //37
+                        87 , //38
+                        87 , //39
+                        88 , //40
+                        89 , //41
+                        89 , //42
+                        90 , //43
+                        91 , //44
+                        91 , //45
+                        92 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        95 , //53
+                        96 , //54
+                        96 , //55
+                        97 , //56
+                        97 , //57
+                        98 , //58
+                        98 , //59
+                        98 , //60
+                        99 , //61
+                        99 , //62
+                        100, //63
+                        100, //64
+                        100, //65
+                        101, //66
+                        101, //67
+                        101, //68
+                        102, //69
+                        102, //70
+                        103, //71
+                        103, //72
+                        103, //73
+                        104, //74
+                        104, //75
+                        104, //76
+                        104, //77
+                        105, //78
+                        105, //79
+                        105, //80
+                        105, //81
+                        105, //82
+                        105, //83
+                        106, //84
+                        106, //85
+                        106, //86
+                        106, //87
+                        106, //88
+                        106, //89
+                        106, //90
+                        106, //91
+                        106, //92
+                        106, //93
+                        106, //94
+                        106, //95
+                        106, //96
+                        106, //97
+                        106, //98
+                        107, //99
+                        107, //100
+                        107, //101
+                        107, //102
+                        107, //103
+                        107, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                        107,
+                    }
+                }, //RF_CHAN_9
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        43 , //2
+                        47 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        53 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        62 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        67 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        83 , //33
+                        84 , //34
+                        85 , //35
+                        85 , //36
+                        86 , //37
+                        87 , //38
+                        88 , //39
+                        89 , //40
+                        89 , //41
+                        90 , //42
+                        90 , //43
+                        91 , //44
+                        92 , //45
+                        92 , //46
+                        93 , //47
+                        94 , //48
+                        94 , //49
+                        95 , //50
+                        95 , //51
+                        96 , //52
+                        96 , //53
+                        96 , //54
+                        97 , //55
+                        97 , //56
+                        98 , //57
+                        98 , //58
+                        99 , //59
+                        99 , //60
+                        99 , //61
+                        100, //62
+                        100, //63
+                        101, //64
+                        101, //65
+                        102, //66
+                        102, //67
+                        102, //68
+                        103, //69
+                        103, //70
+                        103, //71
+                        104, //72
+                        104, //73
+                        104, //74
+                        105, //75
+                        105, //76
+                        105, //77
+                        105, //78
+                        105, //79
+                        106, //80
+                        106, //81
+                        106, //82
+                        106, //83
+                        106, //84
+                        106, //85
+                        106, //86
+                        106, //87
+                        106, //88
+                        107, //89
+                        107, //90
+                        107, //91
+                        107, //92
+                        107, //93
+                        107, //94
+                        107, //95
+                        107, //96
+                        107, //97
+                        107, //98
+                        107, //99
+                        107, //100
+                        107, //101
+                        107, //102
+                        107, //103
+                        107, //104
+                        107, //105
+                        107, //106
+                        107, //107
+                        107, //108
+                        107, //109
+                        107, //110
+                        107, //111
+                        107, //112
+                        107, //113
+                        107, //114
+                        107, //115
+                        107, //116
+                        107, //117
+                        107, //118
+                        107, //119
+                        107, //120
+                        107, //121
+                        107, //122
+                        107, //123
+                        107, //124
+                        107, //125
+                        107, //126
+                        107, //127
+                        107,
+                    }
+                }, //RF_CHAN_10
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        47 , //3
+                        49 , //4
+                        51 , //5
+                        52 , //6
+                        54 , //7
+                        55 , //8
+                        57 , //9
+                        58 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        81 , //31
+                        82 , //32
+                        82 , //33
+                        83 , //34
+                        84 , //35
+                        85 , //36
+                        86 , //37
+                        86 , //38
+                        87 , //39
+                        88 , //40
+                        89 , //41
+                        90 , //42
+                        90 , //43
+                        91 , //44
+                        91 , //45
+                        92 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        96 , //53
+                        96 , //54
+                        97 , //55
+                        97 , //56
+                        97 , //57
+                        98 , //58
+                        98 , //59
+                        99 , //60
+                        99 , //61
+                        100, //62
+                        100, //63
+                        100, //64
+                        101, //65
+                        101, //66
+                        101, //67
+                        102, //68
+                        102, //69
+                        102, //70
+                        103, //71
+                        103, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        104, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        105, //88
+                        105, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                    }
+                }, //RF_CHAN_11
+                {
+                    {
+                        0  , //0
+                        41 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        57 , //9
+                        59 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        67 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        76 , //25
+                        77 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        80 , //31
+                        81 , //32
+                        82 , //33
+                        83 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        88 , //42
+                        89 , //43
+                        90 , //44
+                        90 , //45
+                        91 , //46
+                        92 , //47
+                        92 , //48
+                        93 , //49
+                        93 , //50
+                        94 , //51
+                        94 , //52
+                        95 , //53
+                        95 , //54
+                        96 , //55
+                        96 , //56
+                        96 , //57
+                        97 , //58
+                        97 , //59
+                        98 , //60
+                        98 , //61
+                        99 , //62
+                        99 , //63
+                        99 , //64
+                        100, //65
+                        100, //66
+                        100, //67
+                        101, //68
+                        101, //69
+                        101, //70
+                        102, //71
+                        102, //72
+                        102, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        103, //78
+                        103, //79
+                        103, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        104, //90
+                        104, //91
+                        104, //92
+                        104, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                        105,
+                    }
+                }, //RF_CHAN_12
+                {
+                    {
+                        0  , //0
+                        42 , //1
+                        44 , //2
+                        46 , //3
+                        48 , //4
+                        50 , //5
+                        52 , //6
+                        54 , //7
+                        56 , //8
+                        58 , //9
+                        59 , //10
+                        60 , //11
+                        61 , //12
+                        63 , //13
+                        64 , //14
+                        65 , //15
+                        66 , //16
+                        68 , //17
+                        69 , //18
+                        70 , //19
+                        71 , //20
+                        72 , //21
+                        73 , //22
+                        74 , //23
+                        75 , //24
+                        75 , //25
+                        76 , //26
+                        77 , //27
+                        78 , //28
+                        79 , //29
+                        80 , //30
+                        80 , //31
+                        81 , //32
+                        82 , //33
+                        83 , //34
+                        83 , //35
+                        84 , //36
+                        85 , //37
+                        86 , //38
+                        86 , //39
+                        87 , //40
+                        88 , //41
+                        89 , //42
+                        89 , //43
+                        90 , //44
+                        91 , //45
+                        91 , //46
+                        92 , //47
+                        93 , //48
+                        93 , //49
+                        94 , //50
+                        94 , //51
+                        95 , //52
+                        95 , //53
+                        96 , //54
+                        96 , //55
+                        97 , //56
+                        97 , //57
+                        97 , //58
+                        98 , //59
+                        98 , //60
+                        99 , //61
+                        99 , //62
+                        100, //63
+                        100, //64
+                        100, //65
+                        101, //66
+                        101, //67
+                        101, //68
+                        102, //69
+                        102, //70
+                        102, //71
+                        103, //72
+                        103, //73
+                        103, //74
+                        103, //75
+                        103, //76
+                        103, //77
+                        104, //78
+                        104, //79
+                        104, //80
+                        104, //81
+                        104, //82
+                        104, //83
+                        104, //84
+                        104, //85
+                        104, //86
+                        104, //87
+                        104, //88
+                        104, //89
+                        105, //90
+                        105, //91
+                        105, //92
+                        105, //93
+                        105, //94
+                        105, //95
+                        105, //96
+                        105, //97
+                        105, //98
+                        105, //99
+                        105, //100
+                        105, //101
+                        105, //102
+                        105, //103
+                        105, //104
+                        105, //105
+                        105, //106
+                        105, //107
+                        105, //108
+                        105, //109
+                        105, //110
+                        105, //111
+                        105, //112
+                        105, //113
+                        105, //114
+                        105, //115
+                        105, //116
+                        105, //117
+                        105, //118
+                        105, //119
+                        105, //120
+                        105, //121
+                        105, //122
+                        105, //123
+                        105, //124
+                        105, //125
+                        105, //126
+                        105, //127
+                        105,
+                    }
+                }, //RF_CHAN_13
+                {
+                    {
+                       0,  //0
+                       40,  //1
+                       43,  //2
+                       45,  //3
+                       47,  //4
+                       49,  //5
+                       50,  //6
+                       52,  //7
+                       54,  //8
+                       56,  //9
+                       57,  //10
+                       58,  //11
+                       59,  //12
+                       60,  //13
+                       62,  //14
+                       63,  //15
+                       64,  //16
+                       65,  //17
+                       66,  //18
+                       67,  //19
+                       68,  //20
+                       69,  //21
+                       70,  //22
+                       71,  //23
+                       72,  //24
+                       73,  //25
+                       74,  //26
+                       74,  //27
+                       75,  //28
+                       76,  //29
+                       77,  //30
+                       78,  //31
+                       78,  //32
+                       79,  //33
+                       80,  //34
+                       81,  //35
+                       82,  //36
+                       83,  //37
+                       83,  //38
+                       84,  //39
+                       85,  //40
+                       85,  //41
+                       86,  //42
+                       87,  //43
+                       87,  //44
+                       88,  //45
+                       89,  //46
+                       89,  //47
+                       90,  //48
+                       90,  //49
+                       91,  //50
+                       91,  //51
+                       92,  //52
+                       92,  //53
+                       93,  //54
+                       93,  //55
+                       94,  //56
+                       94,  //57
+                       95,  //58
+                       95,  //59
+                       96,  //60
+                       96,  //61
+                       96,  //62
+                       97,  //63
+                       97,  //64
+                       97,  //65
+                       98,  //66
+                       98,  //67
+                       98,  //68
+                       98,  //69
+                       99,  //70
+                       99,  //71
+                       99,  //72
+                       99,  //73
+                       99,  //74
+                       99,  //75
+                       99,  //76
+                       99,  //77
+                       99,  //78
+                       99,  //79
+                       100,  //80
+                       100,  //81
+                       100,  //82
+                       100,  //83
+                       100,  //84
+                       100,  //85
+                       100,  //86
+                       100,  //87
+                       100,  //88
+                       100,  //89
+                       100,  //90
+                       100,  //91
+                       100,  //92
+                       100,  //93
+                       100,  //94
+                       100,  //95
+                       100,  //96
+                       100,  //97
+                       100, //98
+                       100, //99
+                       100, //100
+                       100, //101
+                       100, //102
+                       100, //103
+                       100, //104
+                       100, //105
+                       100, //106
+                       100, //107
+                       100, //108
+                       100, //109
+                       100, //110
+                       100, //111
+                       100, //112
+                       100, //113
+                       100, //114
+                       100, //115
+                       100, //116
+                       100, //117
+                       100, //118
+                       100, //119
+                       100, //120
+                       100, //121
+                       100, //122
+                       100, //123
+                       100, //124
+                       100, //125
+                       100, //126
+                       100, //127
+                       100,
+                    }
+                }, //RF_CHAN_14
+        },
+
+        //NV_TABLE_TPC_PDADC_OFFSETS
+        {
+            98,  // RF_CHAN_1
+            101,  // RF_CHAN_2
+            101,  // RF_CHAN_3
+            100,  // RF_CHAN_4
+            98,  // RF_CHAN_5
+            97,  // RF_CHAN_6
+            94,  // RF_CHAN_7
+            94,  // RF_CHAN_8
+            92,  // RF_CHAN_9
+            90,  // RF_CHAN_10
+            94,  // RF_CHAN_11
+            95,  // RF_CHAN_12
+            97,  // RF_CHAN_13
+            104,   // RF_CHAN_14
+            100,   // RF_CHAN_240
+            100,   // RF_CHAN_244
+            100,   // RF_CHAN_248
+            100,   // RF_CHAN_252
+            100,   // RF_CHAN_208
+            100,   // RF_CHAN_212
+            100,   // RF_CHAN_216
+            100,   // RF_CHAN_36
+            100,   // RF_CHAN_40
+            100,   // RF_CHAN_44
+            100,   // RF_CHAN_48
+            100,   // RF_CHAN_52
+            100,   // RF_CHAN_56
+            100,   // RF_CHAN_60
+            100,   // RF_CHAN_64
+            100,   // RF_CHAN_100
+            100,   // RF_CHAN_104
+            100,   // RF_CHAN_108
+            100,   // RF_CHAN_112
+            100,   // RF_CHAN_116
+            100,   // RF_CHAN_120 
+            100,   // RF_CHAN_124
+            100,   // RF_CHAN_128
+            100,   // RF_CHAN_132
+            100,   // RF_CHAN_136
+            100,   // RF_CHAN_140
+            100,   // RF_CHAN_149
+            100,   // RF_CHAN_153
+            100,   // RF_CHAN_157
+            100,   // RF_CHAN_161
+            100,   // RF_CHAN_165
+            //CHANNEL BONDED CHANNELS
+            100,   // RF_CHAN_BOND_3 
+            100,   // RF_CHAN_BOND_4
+            100,   // RF_CHAN_BOND_5
+            100,   // RF_CHAN_BOND_6
+            100,   // RF_CHAN_BOND_7
+            100,   // RF_CHAN_BOND_8
+            100,   // RF_CHAN_BOND_9
+            100,   // RF_CHAN_BOND_10
+            100,   // RF_CHAN_BOND_11
+            100,   // RF_CHAN_BOND_242
+            100,   // RF_CHAN_BOND_246
+            100,   // RF_CHAN_BOND_250
+            100,   // RF_CHAN_BOND_210
+            100,   // RF_CHAN_BOND_214
+            100,   // RF_CHAN_BOND_38
+            100,   // RF_CHAN_BOND_42
+            100,   // RF_CHAN_BOND_46
+            100,   // RF_CHAN_BOND_50 
+            100,   // RF_CHAN_BOND_54
+            100,   // RF_CHAN_BOND_58
+            100,   // RF_CHAN_BOND_62
+            100,   // RF_CHAN_BOND_102
+            100,   // RF_CHAN_BOND_106
+            100,   // RF_CHAN_BOND_110
+            100,   // RF_CHAN_BOND_114 
+            100,   // RF_CHAN_BOND_118 
+            100,   // RF_CHAN_BOND_122
+            100,   // RF_CHAN_BOND_126
+            100,   // RF_CHAN_BOND_130
+            100,   // RF_CHAN_BOND_134
+            100,   // RF_CHAN_BOND_138
+            100,   // RF_CHAN_BOND_151
+            100,   // RF_CHAN_BOND_155
+            100,   // RF_CHAN_BOND_159
+            100,   // RF_CHAN_BOND_163
+        },
+
+        //NV_TABLE_VIRTUAL_RATE
+        // typedef tANI_S16 tPowerdBm;
+        //typedef tPowerdBm tRateGroupPwr[NUM_HAL_PHY_RATES];
+        //tRateGroupPwr       pwrOptimum[NUM_RF_SUBBANDS];
+        {
+            // 2.4G RF Subband
+            {
+                //802.11b Rates
+                {100},    // HAL_PHY_VRATE_11A_54_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_65_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_72_2_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_CB_135_MBPS
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+            },
+            // 5G Low RF Subband
+            {
+                //802.11b Rates
+                {100},    // HAL_PHY_VRATE_11A_54_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_65_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_72_2_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_CB_135_MBPS
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+            },
+            // 5G Middle RF Subband
+            {
+                //802.11b Rates
+                {100},    // HAL_PHY_VRATE_11A_54_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_65_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_72_2_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_CB_135_MBPS
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+            },
+            // 5G High RF Subband
+            {
+                //802.11b Rates
+                {100},    // HAL_PHY_VRATE_11A_54_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_65_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_72_2_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_CB_135_MBPS
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+            },
+            // 4.9G RF Subband
+            {
+                //802.11b Rates
+                {100},    // HAL_PHY_VRATE_11A_54_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_65_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_72_2_MBPS,
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_CB_135_MBPS
+                {100},    // HAL_PHY_VRATE_MCS_1NSS_MM_SG_CB_150_MBPS,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+                {100},    // RESERVED,
+            }
+        },
+
+#if 0 //FIXME_PRIMA
+        //NV_TABLE_CAL_MEMORY
+        {
+            0x7FFF,      // tANI_U16    process_monitor;
+            0x00,        // tANI_U8     hdet_cal_code;
+            0x00,        // tANI_U8     rxfe_gm_2;
+
+            0x00,        // tANI_U8     tx_bbf_rtune;
+            0x00,        // tANI_U8     pa_rtune_reg;
+            0x00,        // tANI_U8     rt_code;
+            0x00,        // tANI_U8     bias_rtune;
+
+            0x00,        // tANI_U8     bb_bw1;
+            0x00,        // tANI_U8     bb_bw2;
+            { 0x00, 0x00 },        // tANI_U8     reserved[2];
+
+            0x00,        // tANI_U8     bb_bw3;
+            0x00,        // tANI_U8     bb_bw4;
+            0x00,        // tANI_U8     bb_bw5;
+            0x00,        // tANI_U8     bb_bw6;
+
+            0x7FFF,      // tANI_U16    rcMeasured;
+            0x00,        // tANI_U8     tx_bbf_ct;
+            0x00,        // tANI_U8     tx_bbf_ctr;
+
+            0x00,        // tANI_U8     csh_maxgain_reg;
+            0x00,        // tANI_U8     csh_0db_reg;
+            0x00,        // tANI_U8     csh_m3db_reg;
+            0x00,        // tANI_U8     csh_m6db_reg;
+
+            0x00,        // tANI_U8     cff_0db_reg;
+            0x00,        // tANI_U8     cff_m3db_reg;
+            0x00,        // tANI_U8     cff_m6db_reg;
+            0x00,        // tANI_U8     rxfe_gpio_ctl_1;
+
+            0x00,        // tANI_U8     mix_bal_cnt_2;
+            0x00,        // tANI_S8     rxfe_lna_highgain_bias_ctl_delta;
+            0x00,        // tANI_U8     rxfe_lna_load_ctune;
+            0x00,        // tANI_U8     rxfe_lna_ngm_rtune;
+
+            0x00,        // tANI_U8     rx_im2_i_cfg0;
+            0x00,        // tANI_U8     rx_im2_i_cfg1;
+            0x00,        // tANI_U8     rx_im2_q_cfg0;
+            0x00,        // tANI_U8     rx_im2_q_cfg1;
+
+            0x00,        // tANI_U8     pll_vfc_reg3_b0;
+            0x00,        // tANI_U8     pll_vfc_reg3_b1;
+            0x00,        // tANI_U8     pll_vfc_reg3_b2;
+            0x00,        // tANI_U8     pll_vfc_reg3_b3;
+
+            0x7FFF,        // tANI_U16    tempStart;
+            0x7FFF,        // tANI_U16    tempFinish;
+
+            { //txLoCorrections
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_0
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_1
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_2
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_3
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_4
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_5
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_6
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_7
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_8
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_9
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_10
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_11
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_12
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_13
+                    { 0x00, 0x00 }, // TX_GAIN_STEP_14
+                    { 0x00, 0x00 }  // TX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // tTxLoCorrections    txLoValues;
+
+            { //sTxIQChannel
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // TX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // TX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // sTxIQChannel        txIqValues;
+
+            { //sRxIQChannel
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_1
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_2
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_3
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_4
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_5
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_6
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_7
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_8
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_9
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_10
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_11
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_12
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }, //RF_CHAN_13
+                {
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_0
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_1
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_2
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_3
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_4
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_5
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_6
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_7
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_8
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_9
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_10
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_11
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_12
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_13
+                    { 0x0000, 0x0000, 0x0000 }, // RX_GAIN_STEP_14
+                    { 0x0000, 0x0000, 0x0000 }  // RX_GAIN_STEP_15
+                }  //RF_CHAN_14
+            },        // sRxIQChannel        rxIqValues;
+
+            { // tTpcConfig          clpcData[MAX_TPC_CHANNELS]
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_1
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_2
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_3
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_4
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_5
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_6
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_7
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_8
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_9
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_10
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_11
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }, // RF_CHAN_12
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                },  // RF_CHAN_13
+                {
+                    {
+                        {
+                            { 0x00, 0x00 }, //CAL_POINT_0
+                            { 0x00, 0x00 }, //CAL_POINT_1
+                            { 0x00, 0x00 }, //CAL_POINT_2
+                            { 0x00, 0x00 }, //CAL_POINT_3
+                            { 0x00, 0x00 }, //CAL_POINT_4
+                            { 0x00, 0x00 }, //CAL_POINT_5
+                            { 0x00, 0x00 }, //CAL_POINT_6
+                            { 0x00, 0x00 }  //CAL_POINT_7
+                        } // PHY_TX_CHAIN_0
+                    } // empirical
+                }  // RF_CHAN_14
+            },        // tTpcConfig          clpcData[MAX_TPC_CHANNELS];
+
+            {
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_1: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_2: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_3: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_4: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_5: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_6: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_7: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_8: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_9: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_10: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_11: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_12: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }, // RF_CHAN_13: pdadc_offset, reserved[2]
+                { 0x0000, { 0x00, 0x00 } }  // RF_CHAN_14: pdadc_offset, reserved[2]
+            }        // tTpcParams          clpcParams[MAX_TPC_CHANNELS];
+
+        }, //NV_TABLE_CAL_MEMORY
+#endif
+        //NV_TABLE_CAL_STATUS
+        {
+            0xFF,        // tANI_U8     overall;
+            0xFF,        // tANI_U8     fwInit;
+            0xFF,        // tANI_U8     hdet_dco;
+            0xFF,        // tANI_U8     rtuner;
+            0xFF,        // tANI_U8     ctuner;
+            0xFF,        // tANI_U8     insitu;
+            0xFF,        // tANI_U8     process_monitor;
+            0xFF,        // tANI_U8     pllVcoLinearity;
+            0xFF,        // tANI_U8     txIQ;
+            0xFF,        // tANI_U8     rxIQ;
+            0xFF,        // tANI_U8     rxDco;
+            0xFF,        // tANI_U8     txLo;
+            0xFF,        // tANI_U8     lnaBias;
+            0xFF,        // tANI_U8     lnaBandTuning;
+            0xFF,        // tANI_U8     lnaGainAdjust;
+            0xFF,        // tANI_U8     im2UsingNoisePwr;
+            0xFF,        // tANI_U8     temperature;
+            0xFF,        // tANI_U8     clpc;
+            0xFF,        // tANI_U8     clpc_temp_adjust;
+            0xFF,        // tANI_U8     txDpd;
+            0xFF,        // tANI_U8     channelTune;
+            0xFF,        // tANI_U8     rxGmStageLinearity;
+            0xFF,        // tANI_U8     im2UsingToneGen;
+            0xFF,        // tANI_U8     rxBbfTuning
+            0xFF,        // tANI_U8     txBbfTuning
+            0xFF,        // tANI_U8     paCTuning
+            {
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00,
+                0x00
+            }        // tANI_U8     unused[9];
+        },
+
+        //NV_TABLE_RSSI_CHANNEL_OFFSETS
+        {
+            //PHY_RX_CHAIN_0
+            {
+                //bRssiOffset
+                {300}, // apply to all channles
+
+                //gnRssiOffset
+                {300}  // apply to all channles
+            },
+            //rsvd
+            {
+                //bRssiOffset
+                {0},   // apply to all channles
+
+                //gnRssiOffset
+                {0}    // apply to all channles
+            }
+        },
+
+        //NV_TABLE_RF_CAL_VALUES
+        {
+            //typedef struct
+            //{
+            //    tANI_U32 calStatus;  //use eNvCalID
+            //    sCalData calData;
+            //}sRFCalValues;
+
+            0,               //calStatus
+            {
+                0,           //process_monitor;
+                0,           //hdet_cal_code;
+                0,           //rxfe_gm_2;
+
+                0,           //tx_bbf_rtune;
+                0,           //pa_rtune_reg;
+                0,           //rt_code;
+                0,           //bias_rtune;
+
+                0,           //bb_bw1;
+                0,           //bb_bw2;
+                0,           //reserved0;
+                0,           //reserved11;
+
+                0,           //bb_bw3;
+                0,           //bb_bw4;
+                0,           //bb_bw5;
+                0,           //bb_bw6;
+
+                0,           //rcMeasured;
+                0,           //tx_bbf_ct;
+                0,           //tx_bbf_ctr;
+
+                0,           //csh_maxgain_reg;
+                0,           //csh_0db_reg;
+                0,           //csh_m3db_reg;
+                0,           //csh_m6db_reg;
+
+                0,           //cff_0db_reg;
+                0,           //cff_m3db_reg;
+                0,           //cff_m6db_reg;
+                0,           //rxfe_gpio_ctl_1;
+
+                0,           //mix_bal_cnt_2;
+                0,           //rxfe_lna_highgain_bias_ctl_delta;
+                0,           //rxfe_lna_load_ctune;
+                0,           //rxfe_lna_ngm_rtune;
+
+                0,           //rx_im2_spare0;
+                0,           //rx_im2_spare1;
+                0,           //hdet_dco
+
+                0,           //pll_vfc_reg3_b0;
+                0,           //pll_vfc_reg3_b1;
+                0,           //pll_vfc_reg3_b2;
+                0,           //pll_vfc_reg3_b3;
+
+                0,           //tempStart;
+                0,           //roomTemp;
+
+                0,           //ambientCalTemp;
+                0,           //ambientCalTempValid;
+                0            //reserved2;
+
+            }
+        },
+
+        //NV_TABLE_ANTENNA_PATH_LOSS
+        {
+            280,  // RF_CHAN_1
+            270,  // RF_CHAN_2
+            270,  // RF_CHAN_3
+            270,  // RF_CHAN_4
+            270,  // RF_CHAN_5
+            270,  // RF_CHAN_6
+            280,  // RF_CHAN_7
+            280,  // RF_CHAN_8
+            290,  // RF_CHAN_9
+            300,  // RF_CHAN_10
+            300,  // RF_CHAN_11
+            310,  // RF_CHAN_12
+            310,  // RF_CHAN_13
+            310,   // RF_CHAN_14
+            280,  // RF_CHAN_240
+            280,  // RF_CHAN_244
+            280,   // RF_CHAN_248
+            280,   // RF_CHAN_252
+            280,   // RF_CHAN_208
+            280,   // RF_CHAN_212
+            280,   // RF_CHAN_216
+            280,   // RF_CHAN_36
+            280,   // RF_CHAN_40
+            280,   // RF_CHAN_44
+            280,   // RF_CHAN_48
+            280,   // RF_CHAN_52
+            280,   // RF_CHAN_56
+            280,   // RF_CHAN_60
+            280,   // RF_CHAN_64
+            280,   // RF_CHAN_100
+            280,   // RF_CHAN_104
+            280,   // RF_CHAN_108
+            280,   // RF_CHAN_112
+            280,   // RF_CHAN_116
+            280,   // RF_CHAN_120 
+            280,   // RF_CHAN_124
+            280,   // RF_CHAN_128
+            280,   // RF_CHAN_132
+            280,   // RF_CHAN_136
+            280,   // RF_CHAN_140
+            280,   // RF_CHAN_149
+            280,   // RF_CHAN_153
+            280,   // RF_CHAN_157
+            280,   // RF_CHAN_161
+            280,   // RF_CHAN_165
+            //CHANNEL BONDED CHANNELS
+            280,   // RF_CHAN_BOND_3 
+            280,   // RF_CHAN_BOND_4
+            280,   // RF_CHAN_BOND_5
+            280,   // RF_CHAN_BOND_6
+            280,   // RF_CHAN_BOND_7
+            280,   // RF_CHAN_BOND_8
+            280,   // RF_CHAN_BOND_9
+            280,   // RF_CHAN_BOND_10
+            280,   // RF_CHAN_BOND_11
+            280,   // RF_CHAN_BOND_242
+            280,   // RF_CHAN_BOND_246
+            280,   // RF_CHAN_BOND_250
+            280,   // RF_CHAN_BOND_210
+            280,   // RF_CHAN_BOND_214
+            280,   // RF_CHAN_BOND_38
+            280,   // RF_CHAN_BOND_42
+            280,   // RF_CHAN_BOND_46
+            280,   // RF_CHAN_BOND_50 
+            280,   // RF_CHAN_BOND_54
+            280,   // RF_CHAN_BOND_58
+            280,   // RF_CHAN_BOND_62
+            280,   // RF_CHAN_BOND_102
+            280,   // RF_CHAN_BOND_106
+            280,   // RF_CHAN_BOND_110
+            280,   // RF_CHAN_BOND_114 
+            280,   // RF_CHAN_BOND_118 
+            280,   // RF_CHAN_BOND_122
+            280,   // RF_CHAN_BOND_126
+            280,   // RF_CHAN_BOND_130
+            280,   // RF_CHAN_BOND_134
+            280,   // RF_CHAN_BOND_138
+            280,   // RF_CHAN_BOND_151
+            280,   // RF_CHAN_BOND_155
+            280,   // RF_CHAN_BOND_159
+            280,   // RF_CHAN_BOND_163
+        },
+
+        //NV_TABLE_PACKET_TYPE_POWER_LIMITS
+        {
+            { 2150 }, // applied to all channels, MODE_802_11B
+            { 1850 }, // applied to all channels,MODE_802_11AG
+            { 1750 }  // applied to all channels,MODE_802_11N 
+        },
+
+        //NV_TABLE_OFDM_CMD_PWR_OFFSET
+        {
+            0, 0
+        },
+
+        //NV_TABLE_TX_BB_FILTER_MODE
+        {
+            0
+        }
+
+    } // tables
+};
+
+#endif 
+#endif
+
+
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
new file mode 100644
index 0000000..b448680
--- /dev/null
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -0,0 +1,12649 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ WDA . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Transport Layer.
+
+  The functions externalized by this module are to be called ONLY by other
+  WLAN modules that properly register with the Transport Layer initially.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2010-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
+----------    ---       -------------------------------------------------
+10/05/2011    haparna     Adding support for Keep Alive Feature
+2010-12-30    smiryala     UMAC convergence changes
+2010-08-19    adwivedi    WLAN DAL AL(WDA) layer for Prima
+===========================================================================*/
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
+#include "vos_mq.h" 
+#include "vos_api.h" 
+#include "vos_packet.h" 
+#include "vos_nvitem.h"
+#include "sirApi.h"
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_wda.h"
+#include "wlan_qct_wda_msg.h"
+#include "wlan_qct_wdi_cfg.h"
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_hal_cfg.h"
+/**********************/
+#include "wniApi.h"
+#include "cfgApi.h"
+#include "limApi.h"
+#include "wlan_qct_tl.h"
+#include "wlan_qct_tli_ba.h"
+#include "limUtils.h"
+#include "btcApi.h"
+#include "vos_sched.h"
+
+#ifdef ANI_MANF_DIAG
+#include "pttMsgApi.h"
+#include "wlan_qct_sys.h"
+#endif /* ANI_MANF_DIAG */
+
+/* Used MACRO's */
+/* Get WDA context from vOSS module */
+#define VOS_GET_WDA_CTXT(a)            vos_get_context(VOS_MODULE_ID_WDA, a)
+#define VOS_GET_MAC_CTXT(a)            vos_get_context(VOS_MODULE_ID_PE, a)
+#define OFFSET_OF(structType,fldName)   (&((structType*)0)->fldName)
+#define WDA_BA_TX_FRM_THRESHOLD (5)
+
+#define  CONVERT_WDI2SIR_STATUS(x) \
+   ((WDI_STATUS_SUCCESS != (x)) ? eSIR_FAILURE : eSIR_SUCCESS)
+
+#define  IS_WDI_STATUS_FAILURE(status) \
+   ((WDI_STATUS_SUCCESS != (status)) && (WDI_STATUS_PENDING != (status)))
+
+#define  CONVERT_WDI2VOS_STATUS(x) \
+   ((IS_WDI_STATUS_FAILURE(x)) ? VOS_STATUS_E_FAILURE  : VOS_STATUS_SUCCESS)
+
+/* macro's for acessing TL API/data structures */
+
+#define WDA_TL_GET_TX_PKTCOUNT(a, b, c, d) WLANTL_GetTxPktCount(a, b, c, d)
+
+#define WDA_GET_BA_TXFLAG(a, b, c)  \
+   (((a)->wdaStaInfo[(b)].ucUseBaBitmap) & (1 << (c)))  
+
+#define WDA_SET_BA_TXFLAG(a, b, c)  \
+   (((a)->wdaStaInfo[(b)].ucUseBaBitmap) |= (1 << (c))) 
+
+#define WDA_CLEAR_BA_TXFLAG(a, b, c)  \
+   (((a)->wdaStaInfo[b].ucUseBaBitmap) &= ~(1 << c))
+
+#define WDA_TL_BA_SESSION_ADD(a, b, c, d, e, f, g) \
+   WLANTL_BaSessionAdd(a, b, c, d, e, f, g)
+
+/* timer related Macros */
+#define WDA_CREATE_TIMER(a, b, c, d, e, f, g) \
+   tx_timer_create(a, b, c, d, e, f, g)
+#define WDA_START_TIMER(a) tx_timer_activate(a)
+#define WDA_STOP_TIMER(a) tx_timer_deactivate(a)
+#define WDA_DESTROY_TIMER(a) tx_timer_delete(a)
+
+#define WDA_WDI_START_TIMEOUT 15000
+
+#define WDA_LAST_POLLED_THRESHOLD(a, curSta, tid) \
+   ((a)->wdaStaInfo[curSta].framesTxed[tid] + WDA_BA_TX_FRM_THRESHOLD)
+
+#define WDA_BA_MAX_WINSIZE   (64)
+
+#define WDA_INVALID_KEY_INDEX  0xFF
+
+#define WDA_NUM_PWR_SAVE_CFG       11
+
+#define WDA_TX_COMPLETE_TIME_OUT_VALUE 1000
+  
+
+#define WDA_MAX_RETRIES_TILL_RING_EMPTY  100   /* MAX 1000msec wait */
+
+#define WDA_WAIT_MSEC_TILL_RING_EMPTY    100    /* 100 msec wait per cycle */
+/* extern declarations */
+extern void vos_WDAComplete_cback(v_PVOID_t pVosContext);
+
+/* forward declarations */
+void WDA_SendMsg(tWDA_CbContext *pWDA, tANI_U16 msgType, 
+                                        void *pBodyptr, tANI_U32 bodyVal) ;
+VOS_STATUS WDA_prepareConfigTLV(v_PVOID_t pVosContext, 
+                                WDI_StartReqParamsType  *wdiStartParams ) ;
+
+VOS_STATUS WDA_wdiCompleteCB(v_PVOID_t pVosContext) ;
+VOS_STATUS WDA_ProcessSetTxPerTrackingReq(tWDA_CbContext *pWDA, tSirTxPerTrackingParam *pTxPerTrackingParams);
+
+extern v_BOOL_t sys_validateStaConfig( void *pImage, unsigned long cbFile,
+                               void **ppStaConfig, v_SIZE_t *pcbStaConfig ) ;
+void processCfgDownloadReq(tpAniSirGlobal pMac, tANI_U16 length, 
+                                                         tANI_U32 *pConfig) ;
+void WDA_UpdateBSSParams(tWDA_CbContext *pWDA, 
+        WDI_ConfigBSSReqInfoType *wdiBssParams, tAddBssParams *wdaBssParams) ;
+void WDA_UpdateSTAParams(tWDA_CbContext *pWDA, 
+        WDI_ConfigStaReqInfoType *wdiStaParams, tAddStaParams *wdaStaParams) ;
+void WDA_lowLevelIndCallback(WDI_LowLevelIndType *wdiLowLevelInd, 
+                                                          void* pUserData ) ;
+static VOS_STATUS wdaCreateTimers(tWDA_CbContext *pWDA) ;
+static VOS_STATUS wdaDestroyTimers(tWDA_CbContext *pWDA);
+void WDA_BaCheckActivity(tWDA_CbContext *pWDA) ;
+void WDA_HALDumpCmdCallback(WDI_HALDumpCmdRspParamsType *wdiRspParams, void* pUserData);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+VOS_STATUS WDA_ProcessAggrAddTSReq(tWDA_CbContext *pWDA, tAggrAddTsParams *pAggrAddTsReqParams);
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+
+void WDA_TimerHandler(v_VOID_t *pWDA, tANI_U32 timerInfo) ;
+void WDA_ProcessTxCompleteTimeOutInd(tWDA_CbContext* pContext) ;
+VOS_STATUS WDA_ResumeDataTx(tWDA_CbContext *pWDA);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+static VOS_STATUS WDA_ProcessSetPrefNetworkReq(tWDA_CbContext *pWDA, tSirPNOScanReq *pPNOScanReqParams);
+static VOS_STATUS WDA_ProcessSetRssiFilterReq(tWDA_CbContext *pWDA, tSirSetRSSIFilterReq* pRssiFilterParams);
+static VOS_STATUS WDA_ProcessUpdateScanParams(tWDA_CbContext *pWDA, tSirUpdateScanParams *pUpdateScanParams);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+static VOS_STATUS WDA_Process8023MulticastListReq (
+                                       tWDA_CbContext *pWDA,
+                                       tSirRcvFltMcAddrList *pRcvFltMcAddrLis
+                                                  );
+static VOS_STATUS WDA_ProcessReceiveFilterSetFilterReq (
+                                   tWDA_CbContext *pWDA,
+                                   tSirRcvPktFilterCfgType *pRcvPktFilterCfg
+                                                       );
+static VOS_STATUS WDA_ProcessPacketFilterMatchCountReq (
+                                   tWDA_CbContext *pWDA,
+                                   tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp
+                                                   );
+static VOS_STATUS WDA_ProcessReceiveFilterClearFilterReq (
+                               tWDA_CbContext *pWDA,
+                               tSirRcvFltPktClearParam *pRcvFltPktClearParam
+                                                         );
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+VOS_STATUS WDA_ProcessSetPowerParamsReq(tWDA_CbContext *pWDA, tSirSetPowerParamsReq *pPowerParams);
+
+static VOS_STATUS WDA_ProcessTxControlInd(tWDA_CbContext *pWDA,
+                                          tpTxControlParams pTxCtrlParam);
+
+VOS_STATUS WDA_GetWepKeysFromCfg( tWDA_CbContext *pWDA, 
+                                                      v_U8_t *pDefaultKeyId,
+                                                      v_U8_t *pNumKeys,
+                                                      WDI_KeysType *pWdiKeys );
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+static VOS_STATUS WDA_ProcessGTKOffloadReq(tWDA_CbContext *pWDA, tpSirGtkOffloadParams pGtkOffloadParams);
+static VOS_STATUS WDA_ProcessGTKOffloadGetInfoReq(tWDA_CbContext *pWDA, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+VOS_STATUS WDA_ProcessSetTmLevelReq(tWDA_CbContext *pWDA,
+                                    tAniSetTmLevelReq *setTmLevelReq);
+/*
+ * FUNCTION: WDA_open
+ * Allocate the WDA context 
+ */ 
+VOS_STATUS WDA_open(v_PVOID_t pVosContext, v_PVOID_t pOSContext,
+                                                tMacOpenParameters *pMacParams )
+{
+   tWDA_CbContext *wdaContext;
+   VOS_STATUS status;
+   WDI_DeviceCapabilityType wdiDevCapability = {0} ;
+
+   /* Allocate WDA context */
+   status = vos_alloc_context(pVosContext, VOS_MODULE_ID_WDA, 
+                           (v_VOID_t **)&wdaContext, sizeof(tWDA_CbContext)) ;
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /*__asm int 3;*/
+   vos_mem_zero(wdaContext,sizeof(tWDA_CbContext));
+   
+   /* Initialize data structures */
+   wdaContext->pVosContext = pVosContext;
+   wdaContext->wdaState = WDA_INIT_STATE;
+   wdaContext->uTxFlowMask = WDA_TXFLOWMASK;
+   
+   /* Initialize WDA-WDI synchronization event */
+   status = vos_event_init(&wdaContext->wdaWdiEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "WDI Sync Event init failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   /* Init Frame transfer event */
+   status = vos_event_init(&wdaContext->txFrameEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "VOS Mgmt Frame Event init failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   status = vos_event_init(&wdaContext->suspendDataTxEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "VOS suspend data tx Event init failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   status = vos_event_init(&wdaContext->waitOnWdiIndicationCallBack);
+   if(!VOS_IS_STATUS_SUCCESS(status)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "VOS wait On Wdi Ind Event init failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   vos_trace_setLevel(VOS_MODULE_ID_WDA,VOS_TRACE_LEVEL_ERROR);
+
+   wdaContext->driverMode = pMacParams->driverType;
+   if(WDI_STATUS_SUCCESS != WDI_Init(pOSContext, &wdaContext->pWdiContext, 
+                                     &wdiDevCapability, pMacParams->driverType))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "WDI Init failed" );
+      status = VOS_STATUS_E_FAILURE;
+   }
+   else 
+   {
+      pMacParams->maxStation = wdiDevCapability.ucMaxSTASupported ;
+      pMacParams->maxBssId =  wdiDevCapability.ucMaxBSSSupported;
+      pMacParams->frameTransRequired = wdiDevCapability.bFrameXtlSupported;
+
+      /* update max STA in WDA used for BA */
+      wdaContext->wdaMaxSta = pMacParams->maxStation;
+      /* store the frameTransRequired flag in wdaContext, to send this to HAL 
+       * in WDA_Start
+       */
+      wdaContext->frameTransRequired = wdiDevCapability.bFrameXtlSupported;
+   }
+
+   return status;
+}
+
+
+/*
+ * FUNCTION: WDA_preStart
+ * Trigger DAL-AL to start CFG download 
+ */ 
+VOS_STATUS WDA_preStart(v_PVOID_t pVosContext)
+{   
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t wdaMsg = {0} ;
+
+   /*
+    * trigger CFG download in WDA by sending WDA_CFG_DNLD message
+    */ 
+   wdaMsg.type = WNI_CFG_DNLD_REQ ; 
+   wdaMsg.bodyptr = NULL;
+   wdaMsg.bodyval = 0;
+
+   /* post the message.. */
+   vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &wdaMsg );
+   if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+   return( vosStatus );
+}
+
+/*
+ * FUNCTION: WDA_wdiStartCallback
+ * Once WDI_Start is finished, WDI start callback will be called by WDI
+ * to indicate completion of WDI_Start.
+ */
+void WDA_wdiStartCallback(WDI_StartRspParamsType *wdiRspParams,
+                                                            void *pVosContext)
+{
+   tWDA_CbContext *wdaContext;
+   VOS_STATUS status;
+
+   if (NULL == pVosContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: Invoked with invalid pVosContext", __FUNCTION__ );
+      return;
+   }
+
+   wdaContext = VOS_GET_WDA_CTXT(pVosContext);
+   if (NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: Invoked with invalid wdaContext", __FUNCTION__ );
+      return;
+   }
+
+   if (WDI_STATUS_SUCCESS != wdiRspParams->wdiStatus)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: WDI_Start() failure reported", __FUNCTION__ );
+   }
+   else
+   {
+      wdaContext->wdaState = WDA_START_STATE;
+   }
+
+   /* extract and save version information from the Start Response */
+   wdaContext->wcnssWlanCompiledVersion.major =
+      wdiRspParams->wlanCompiledVersion.major;
+   wdaContext->wcnssWlanCompiledVersion.minor =
+      wdiRspParams->wlanCompiledVersion.minor;
+   wdaContext->wcnssWlanCompiledVersion.version =
+      wdiRspParams->wlanCompiledVersion.version;
+   wdaContext->wcnssWlanCompiledVersion.revision =
+      wdiRspParams->wlanCompiledVersion.revision;
+   wdaContext->wcnssWlanReportedVersion.major =
+      wdiRspParams->wlanReportedVersion.major;
+   wdaContext->wcnssWlanReportedVersion.minor =
+      wdiRspParams->wlanReportedVersion.minor;
+   wdaContext->wcnssWlanReportedVersion.version =
+      wdiRspParams->wlanReportedVersion.version;
+   wdaContext->wcnssWlanReportedVersion.revision =
+      wdiRspParams->wlanReportedVersion.revision;
+   wpalMemoryCopy(wdaContext->wcnssSoftwareVersionString,
+           wdiRspParams->wcnssSoftwareVersion,
+           sizeof(wdaContext->wcnssSoftwareVersionString));
+   wpalMemoryCopy(wdaContext->wcnssHardwareVersionString,
+           wdiRspParams->wcnssHardwareVersion,
+           sizeof(wdaContext->wcnssHardwareVersionString));
+
+   /* Notify WDA_start that WDI_Start has completed */
+   status = vos_event_set(&wdaContext->wdaWdiEvent);
+   if (WDI_STATUS_SUCCESS != status)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: Unable to unblock WDA_start", __FUNCTION__ );
+   }
+
+   return;
+}
+
+
+/*
+ * FUNCTION: WDA_start
+ * Prepare TLV configuration and call WDI_Start.
+ */
+
+VOS_STATUS WDA_start(v_PVOID_t pVosContext)
+{
+   tWDA_CbContext *wdaContext;
+   VOS_STATUS status;
+   WDI_Status wdiStatus;
+   WDI_StartReqParamsType wdiStartParam;
+
+   if (NULL == pVosContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid pVosContext", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdaContext = VOS_GET_WDA_CTXT(pVosContext);
+   if (NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid wdaContext", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Non-FTM mode, WDA status for START must be INIT
+    * FTM mode, WDA Status for START can be INIT or STOP */
+   if ( (WDA_INIT_STATE != wdaContext->wdaState) &&
+        (WDA_STOP_STATE != wdaContext->wdaState) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked from wrong state %d",
+                 __FUNCTION__, wdaContext->wdaState );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* initialize the wdiStartParam.  Note that we can create this on
+      the stack since we won't exit until WDI_Start() completes or
+      times out */
+   vos_mem_set(&wdiStartParam, sizeof(wdiStartParam), 0);
+
+   wdiStartParam.wdiDriverType = wdaContext->driverMode;
+
+   /* prepare the config TLV for the WDI */
+   status = WDA_prepareConfigTLV(pVosContext, &wdiStartParam);
+   if ( !VOS_IS_STATUS_SUCCESS(status) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Unable to prepare Config TLV", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* note from here onwards if an error occurs we must
+      reclaim the config TLV buffer */
+
+   wdiStartParam.wdiLowLevelIndCB = WDA_lowLevelIndCallback;
+   wdiStartParam.pIndUserData = (v_PVOID_t *)wdaContext;
+   wdiStartParam.wdiReqStatusCB = NULL;
+
+   /* initialize the WDA-WDI synchronization event */
+   vos_event_reset(&wdaContext->wdaWdiEvent);
+
+   /* call WDI start */
+   wdiStatus = WDI_Start(&wdiStartParam,
+                         (WDI_StartRspCb)WDA_wdiStartCallback,
+                         (v_VOID_t *)pVosContext);
+   if ( IS_WDI_STATUS_FAILURE(wdiStatus) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: WDI Start failed", __FUNCTION__ );
+      vos_mem_free(wdiStartParam.pConfigBuffer);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* wait for WDI start to invoke our callback */
+   status = vos_wait_single_event( &wdaContext->wdaWdiEvent,
+                                   WDA_WDI_START_TIMEOUT );
+   if ( !VOS_IS_STATUS_SUCCESS(status) )
+   {
+      if ( VOS_STATUS_E_TIMEOUT == status )
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Timeout occurred during WDI_Start", __FUNCTION__ );
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: Error %d while waiting for WDI_Start",
+                    __FUNCTION__, status);
+      }
+      vos_mem_free(wdiStartParam.pConfigBuffer);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* WDI_Start() has completed so we can resume our work */
+
+   /* we no longer need the config TLV */
+   vos_mem_free(wdiStartParam.pConfigBuffer);
+
+   /* if we are not in the START state then WDI_Start() failed */
+   if (WDA_START_STATE != wdaContext->wdaState)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: WDI_Start() failure detected", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* FTM mode does not need to monitor BA activity */
+   if ( eDRIVER_TYPE_MFG != wdaContext->driverMode )
+   {
+      status = wdaCreateTimers(wdaContext) ;
+   }
+
+   return status;
+}
+
+
+/*
+ * FUNCTION: WDA_prepareConfigTLV
+ * Function to prepare CFG for DAL(WDA)
+ */
+VOS_STATUS WDA_prepareConfigTLV(v_PVOID_t pVosContext, 
+                            WDI_StartReqParamsType  *wdiStartParams )
+{
+   /* get pMac to acess CFG data base */
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pVosContext);
+   tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+   tHalCfg        *tlvStruct = NULL ;
+   tANI_U8        *tlvStructStart = NULL ;
+   tANI_U32       strLength = WNI_CFG_STA_ID_LEN;
+   v_PVOID_t      *configParam;
+   tANI_U32       configParamSize;
+   tANI_U32       *configDataValue;
+   WDI_WlanVersionType wcnssCompiledApiVersion;
+
+   if ((NULL == pMac)||(NULL == wdaContext))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid wdaContext or pMac", __FUNCTION__ );
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   configParamSize = (sizeof(tHalCfg) * QWLAN_HAL_CFG_MAX_PARAMS) + 
+                           WNI_CFG_STA_ID_LEN +
+                           WNI_CFG_EDCA_WME_ACBK_LEN +
+                           WNI_CFG_EDCA_WME_ACBE_LEN +
+                           WNI_CFG_EDCA_WME_ACVI_LEN +
+                           WNI_CFG_EDCA_WME_ACVO_LEN +
+                           + (QWLAN_HAL_CFG_INTEGER_PARAM * sizeof(tANI_U32));
+
+   /* malloc memory for all configs in one shot */ 
+   configParam = vos_mem_malloc(configParamSize);
+   
+   if(NULL == configParam )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:configParam is NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return VOS_STATUS_E_NOMEM;
+   }
+   vos_mem_set(configParam, configParamSize, 0);
+
+   wdiStartParams->pConfigBuffer = configParam;
+
+   tlvStruct = (tHalCfg *)configParam;
+   tlvStructStart = (tANI_U8 *)configParam;
+
+   /* TODO: Remove Later */
+   /* QWLAN_HAL_CFG_STA_ID */
+   tlvStruct->type = QWLAN_HAL_CFG_STA_ID;
+   configDataValue = (tANI_U32*)((tANI_U8 *) tlvStruct + sizeof(tHalCfg));
+   if(wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8*)configDataValue, &strLength) != 
+                                                                eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                   "Failed to get value for WNI_CFG_STA_ID");
+      goto handle_failure;
+   }
+   tlvStruct->length = strLength ;
+   /* calculate the pad bytes to have the CFG in aligned format */
+   tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
+                              (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+               + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes)) ;
+
+   /* QWLAN_HAL_CFG_CURRENT_TX_ANTENNA */
+   tlvStruct->type = QWLAN_HAL_CFG_CURRENT_TX_ANTENNA;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_TX_ANTENNA, configDataValue ) 
+                                                    != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                          "Failed to get value for WNI_CFG_CURRENT_TX_ANTENNA");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_CURRENT_RX_ANTENNA */
+   tlvStruct->type = QWLAN_HAL_CFG_CURRENT_RX_ANTENNA;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_RX_ANTENNA, configDataValue) != 
+                                                                  eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_CURRENT_RX_ANTENNA");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_LOW_GAIN_OVERRIDE */
+   tlvStruct->type = QWLAN_HAL_CFG_LOW_GAIN_OVERRIDE;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_LOW_GAIN_OVERRIDE, configDataValue ) 
+                                                 != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_LOW_GAIN_OVERRIDE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ;
+ 
+   /* QWLAN_HAL_CFG_POWER_STATE_PER_CHAIN */
+   tlvStruct->type = QWLAN_HAL_CFG_POWER_STATE_PER_CHAIN;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_POWER_STATE_PER_CHAIN, 
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_POWER_STATE_PER_CHAIN");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)); 
+
+   /* QWLAN_HAL_CFG_CAL_PERIOD */
+   tlvStruct->type = QWLAN_HAL_CFG_CAL_PERIOD;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_CAL_PERIOD, configDataValue ) 
+                                                  != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_CAL_PERIOD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+
+   /* QWLAN_HAL_CFG_CAL_CONTROL  */
+   tlvStruct->type = QWLAN_HAL_CFG_CAL_CONTROL ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_CAL_CONTROL, configDataValue ) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_CAL_CONTROL");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+
+   /* QWLAN_HAL_CFG_PROXIMITY  */
+   tlvStruct->type = QWLAN_HAL_CFG_PROXIMITY ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_PROXIMITY, configDataValue ) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_PROXIMITY");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_NETWORK_DENSITY  */
+   tlvStruct->type = QWLAN_HAL_CFG_NETWORK_DENSITY ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_NETWORK_DENSITY, configDataValue ) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_NETWORK_DENSITY");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)); 
+
+   /* QWLAN_HAL_CFG_MAX_MEDIUM_TIME  */
+   tlvStruct->type = QWLAN_HAL_CFG_MAX_MEDIUM_TIME ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_MEDIUM_TIME, configDataValue ) != 
+                                                                 eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_MAX_MEDIUM_TIME");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)); 
+
+   /* QWLAN_HAL_CFG_MAX_MPDUS_IN_AMPDU   */
+   tlvStruct->type = QWLAN_HAL_CFG_MAX_MPDUS_IN_AMPDU  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_MPDUS_IN_AMPDU,
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_MAX_MPDUS_IN_AMPDU");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ;
+
+   /* QWLAN_HAL_CFG_RTS_THRESHOLD   */
+   tlvStruct->type = QWLAN_HAL_CFG_RTS_THRESHOLD  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_RTS_THRESHOLD, configDataValue ) != 
+                                                                  eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_RTS_THRESHOLD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+
+   /* QWLAN_HAL_CFG_SHORT_RETRY_LIMIT   */
+   tlvStruct->type = QWLAN_HAL_CFG_SHORT_RETRY_LIMIT  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_RETRY_LIMIT, configDataValue ) != 
+                                                                 eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_SHORT_RETRY_LIMIT");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_LONG_RETRY_LIMIT   */
+   tlvStruct->type = QWLAN_HAL_CFG_LONG_RETRY_LIMIT  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_LONG_RETRY_LIMIT, configDataValue ) != 
+                                                                 eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_LONG_RETRY_LIMIT");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ;
+
+   /* QWLAN_HAL_CFG_FRAGMENTATION_THRESHOLD   */
+   tlvStruct->type = QWLAN_HAL_CFG_FRAGMENTATION_THRESHOLD  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, 
+                                             configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_FRAGMENTATION_THRESHOLD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ;
+
+   /* QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ZERO   */
+   tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ZERO  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DYNAMIC_THRESHOLD_ZERO,
+                                             configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_ZERO");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+ 
+   /* QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ONE   */
+   tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ONE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DYNAMIC_THRESHOLD_ONE, 
+                                             configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_ONE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)); 
+
+   /* QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_TWO   */
+   tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_TWO  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DYNAMIC_THRESHOLD_TWO, 
+                                             configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_TWO");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+ 
+   /* QWLAN_HAL_CFG_FIXED_RATE   */
+   tlvStruct->type = QWLAN_HAL_CFG_FIXED_RATE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_FIXED_RATE, configDataValue) 
+                                                      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_FIXED_RATE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+ 
+   /* QWLAN_HAL_CFG_RETRYRATE_POLICY   */
+   tlvStruct->type = QWLAN_HAL_CFG_RETRYRATE_POLICY  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_RETRYRATE_POLICY, configDataValue ) 
+                                                         != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_RETRYRATE_POLICY");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length));
+ 
+   /* QWLAN_HAL_CFG_RETRYRATE_SECONDARY   */
+   tlvStruct->type = QWLAN_HAL_CFG_RETRYRATE_SECONDARY  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_RETRYRATE_SECONDARY, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_RETRYRATE_SECONDARY");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_RETRYRATE_TERTIARY   */
+   tlvStruct->type = QWLAN_HAL_CFG_RETRYRATE_TERTIARY  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_RETRYRATE_TERTIARY, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_RETRYRATE_TERTIARY");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_FORCE_POLICY_PROTECTION   */
+   tlvStruct->type = QWLAN_HAL_CFG_FORCE_POLICY_PROTECTION  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_FORCE_POLICY_PROTECTION, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_FORCE_POLICY_PROTECTION");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ   */
+   tlvStruct->type = QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_FIXED_RATE_MULTICAST_24GHZ, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "Failed to get value for WNI_CFG_FIXED_RATE_MULTICAST_24GHZ");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ   */
+   tlvStruct->type = QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_FIXED_RATE_MULTICAST_5GHZ, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "Failed to get value for WNI_CFG_FIXED_RATE_MULTICAST_5GHZ");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length); 
+   
+#if 0 /*FIXME_PRIMA : Enable this after the RA is enabled in HAL*/
+   /* QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_24GHZ   */
+   tlvStruct->type = QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_24GHZ  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DEFAULT_RATE_INDEX_24GHZ, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DEFAULT_RATE_INDEX_24GHZ");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length); 
+#endif
+   /* QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_5GHZ   */
+   tlvStruct->type = QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_5GHZ  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DEFAULT_RATE_INDEX_5GHZ, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DEFAULT_RATE_INDEX_5GHZ");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                             + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_MAX_BA_SESSIONS   */
+   tlvStruct->type = QWLAN_HAL_CFG_MAX_BA_SESSIONS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_BA_SESSIONS, configDataValue ) != 
+                                                                eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_MAX_BA_SESSIONS");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                             + sizeof(tHalCfg) + tlvStruct->length);
+ 
+   /* QWLAN_HAL_CFG_PS_DATA_INACTIVITY_TIMEOUT   */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_DATA_INACTIVITY_TIMEOUT  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, 
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failed to get value for WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                             + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_PS_ENABLE_BCN_FILTER   */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_BCN_FILTER  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_PS_ENABLE_BCN_FILTER, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_PS_ENABLE_BCN_FILTER");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                             + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_PS_ENABLE_RSSI_MONITOR   */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_RSSI_MONITOR  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_PS_ENABLE_RSSI_MONITOR, 
+                                              configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_PS_ENABLE_RSSI_MONITOR");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                              + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE   */
+   tlvStruct->type = QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE, 
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "Failed to get value for WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                              + sizeof(tHalCfg) + tlvStruct->length);
+ 
+   /* QWLAN_HAL_CFG_STATS_PERIOD   */
+   tlvStruct->type = QWLAN_HAL_CFG_STATS_PERIOD  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_STATS_PERIOD, configDataValue ) != 
+                                                                eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_STATS_PERIOD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                               + sizeof(tHalCfg) + tlvStruct->length); 
+
+   /* QWLAN_HAL_CFG_CFP_MAX_DURATION   */
+   tlvStruct->type = QWLAN_HAL_CFG_CFP_MAX_DURATION  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, configDataValue ) != 
+                                                                eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_CFP_MAX_DURATION");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_FRAME_TRANS_ENABLED */
+   tlvStruct->type = QWLAN_HAL_CFG_FRAME_TRANS_ENABLED  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   vos_mem_copy(configDataValue, &wdaContext->frameTransRequired, 
+                                               sizeof(tANI_U32));
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_DTIM_PERIOD */
+   tlvStruct->type = QWLAN_HAL_CFG_DTIM_PERIOD  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DTIM_PERIOD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_EDCA_WMM_ACBK */
+   tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACBK  ;
+   strLength = WNI_CFG_EDCA_WME_ACBK_LEN;
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetStr(pMac, WNI_CFG_EDCA_WME_ACBK, (tANI_U8 *)configDataValue,
+                                             &strLength) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_EDCA_WME_ACBK");
+      goto handle_failure;
+   }
+   tlvStruct->length = strLength;
+   /* calculate the pad bytes to have the CFG in aligned format */
+   tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
+                              (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                 + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
+   /* QWLAN_HAL_CFG_EDCA_WMM_ACBE */
+   tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACBE  ;
+   strLength = WNI_CFG_EDCA_WME_ACBE_LEN;
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetStr(pMac, WNI_CFG_EDCA_WME_ACBE, (tANI_U8 *)configDataValue,
+                                             &strLength) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_EDCA_WME_ACBE");
+      goto handle_failure;
+   }
+   tlvStruct->length = strLength;
+   /* calculate the pad bytes to have the CFG in aligned format */
+   tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
+                              (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                 + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
+   /* QWLAN_HAL_CFG_EDCA_WMM_ACVI */
+   tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACVO  ;
+   strLength = WNI_CFG_EDCA_WME_ACVI_LEN;
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetStr(pMac, WNI_CFG_EDCA_WME_ACVO, (tANI_U8 *)configDataValue,
+                                             &strLength) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_EDCA_WME_ACVI");
+      goto handle_failure;
+   }
+   tlvStruct->length = strLength;
+   /* calculate the pad bytes to have the CFG in aligned format */
+   tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
+                              (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                 + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
+   /* QWLAN_HAL_CFG_EDCA_WMM_ACVO */
+   tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACVI  ;
+   strLength = WNI_CFG_EDCA_WME_ACVO_LEN;
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetStr(pMac, WNI_CFG_EDCA_WME_ACVI, (tANI_U8 *)configDataValue,
+                                             &strLength) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_EDCA_WME_ACVO");
+      goto handle_failure;
+   }
+   tlvStruct->length = strLength;
+   /* calculate the pad bytes to have the CFG in aligned format */
+   tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
+                              (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                 + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
+   /* QWLAN_HAL_CFG_BA_THRESHOLD_HIGH */
+   tlvStruct->type = QWLAN_HAL_CFG_BA_THRESHOLD_HIGH  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_BA_THRESHOLD_HIGH, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_BA_THRESHOLD_HIGH");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_MAX_BA_BUFFERS */
+   tlvStruct->type = QWLAN_HAL_CFG_MAX_BA_BUFFERS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_BA_BUFFERS, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_MAX_BA_BUFFERS");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_DYNAMIC_PS_POLL_VALUE */
+   tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_PS_POLL_VALUE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_DYNAMIC_PS_POLL_VALUE, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_DYNAMIC_PS_POLL_VALUE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_TELE_BCN_TRANS_LI */
+   tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_TRANS_LI  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_TRANS_LI, configDataValue) 
+      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TELE_BCN_TRANS_LI");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS */
+   tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS, configDataValue) 
+      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_TELE_BCN_MAX_LI */
+   tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_MAX_LI  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, configDataValue) 
+      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TELE_BCN_MAX_LI");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS */
+   tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS, configDataValue) 
+      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_TELE_BCN_WAKEUP_EN */
+   tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_WAKEUP_EN  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, configDataValue) 
+      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TELE_BCN_WAKEUP_EN");
+      goto handle_failure;
+   }
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* QWLAN_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD */
+   tlvStruct->type = QWLAN_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /*QWLAN_HAL_CFG_TX_PWR_CTRL_ENABLE*/
+   tlvStruct->type = QWLAN_HAL_CFG_TX_PWR_CTRL_ENABLE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_TX_PWR_CTRL_ENABLE, configDataValue) 
+                                                   != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_TX_PWR_CTRL_ENABLE");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ;
+
+   /* QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP   */
+   tlvStruct->type = QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_CLOSE_LOOP, configDataValue) 
+                                                      != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "Failed to get value for WNI_CFG_ENABLE_CLOSE_LOOP");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+   /* QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT   */
+   tlvStruct->type = QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_AP_KEEP_ALIVE_TIMEOUT, 
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failed to get value for WNI_CFG_AP_KEEP_ALIVE_TIMEOUT");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+   /* QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT   */
+   tlvStruct->type = QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   if(wlan_cfgGetInt(pMac, WNI_CFG_GO_KEEP_ALIVE_TIMEOUT, 
+                                            configDataValue ) != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failed to get value for WNI_CFG_GO_KEEP_ALIVE_TIMEOUT");
+      goto handle_failure;
+   }
+
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] strictly speaking, the Coex parameters are not part of the WLAN_CFG_FILE binary, 
+   * but are from the WLAN_INI_FILE file.  However, this is the only parameter download routine
+   * into FW, so the parameters are added here.
+   */
+
+   /* [COEX] QWLAN_HAL_CFG_BTC_EXECUTION_MODE */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_EXECUTION_MODE  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = pMac->btc.btcConfig.btcExecutionMode; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = pMac->btc.btcConfig.btcConsBtSlotsToBlockDuringDhcp; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = pMac->btc.btcConfig.btcA2DPBtSubIntervalsDuringDhcp; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] QWLAN_HAL_CFG_WCNSS_API_VERSION */
+   tlvStruct->type = QWLAN_HAL_CFG_WCNSS_API_VERSION  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   WDI_GetWcnssCompiledApiVersion(&wcnssCompiledApiVersion);
+   *configDataValue = WLAN_HAL_CONSTRUCT_API_VERSION(wcnssCompiledApiVersion.major,
+                                      wcnssCompiledApiVersion.minor,
+                                      wcnssCompiledApiVersion.version,
+                                      wcnssCompiledApiVersion.revision);
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   wdiStartParams->usConfigBufferLen = (tANI_U8 *)tlvStruct - tlvStructStart ;
+
+#ifdef WLAN_DEBUG
+   {
+      int i;
+
+       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                    "****** Dumping CFG TLV ***** ");
+      for (i=0; (i+7) < wdiStartParams->usConfigBufferLen; i+=8)
+      {
+         VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                    "%02x %02x %02x %02x %02x %02x %02x %02x", 
+                    tlvStructStart[i],
+                    tlvStructStart[i+1],
+                    tlvStructStart[i+2],
+                    tlvStructStart[i+3],
+                    tlvStructStart[i+4],
+                    tlvStructStart[i+5],
+                    tlvStructStart[i+6],
+                    tlvStructStart[i+7]);
+      }
+      /* Dump the bytes in the last line*/
+      for (; i < wdiStartParams->usConfigBufferLen; i++)
+      {
+         VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                    "%02x ",tlvStructStart[i]);
+      }
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                    "**************************** ");
+   }
+#endif
+
+   return VOS_STATUS_SUCCESS ;
+
+handle_failure:
+   vos_mem_free(configParam);
+   return VOS_STATUS_E_FAILURE;
+}
+
+/*
+ * FUNCTION: WDA_wdiCompleteCB
+ * call the voss call back function
+ */ 
+void WDA_stopCallback(WDI_Status status, v_PVOID_t *pVosContext)
+{
+   tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
+   if (NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid wdaContext", __FUNCTION__ );
+      return ;
+   }
+
+   /* free the config structure */
+   if(wdaContext->wdaWdiApiMsgParam != NULL)
+   {
+      vos_mem_free(wdaContext->wdaWdiApiMsgParam);
+      wdaContext->wdaWdiApiMsgParam = NULL;
+   }
+
+   if(WDI_STATUS_SUCCESS != status)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "WDI stop callback returned failure" );
+      VOS_ASSERT(0) ;
+   }
+   else
+   {
+      wdaContext->wdaState = WDA_STOP_STATE;
+   }
+
+   /* Indicate VOSS about the start complete */
+   vos_WDAComplete_cback(pVosContext);
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_stop
+ * call WDI_stop
+ */ 
+
+VOS_STATUS WDA_stop(v_PVOID_t pVosContext, tANI_U8 reason)
+{
+   WDI_Status wdiStatus;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_StopReqParamsType *wdiStopReq;
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
+   if (NULL == pWDA)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid pWDA", __FUNCTION__ );
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* FTM mode stay START_STATE */
+   if( (WDA_READY_STATE != pWDA->wdaState) &&
+       (WDA_INIT_STATE != pWDA->wdaState) &&
+       (WDA_START_STATE != pWDA->wdaState) )
+   {
+      VOS_ASSERT(0);
+   }
+
+   wdiStopReq = (WDI_StopReqParamsType *)
+                            vos_mem_malloc(sizeof(WDI_StopReqParamsType));
+   if(NULL == wdiStopReq)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiStopReq->wdiStopReason = reason;
+   wdiStopReq->wdiReqStatusCB = NULL;
+
+   if(NULL != pWDA->wdaWdiApiMsgParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__);
+      VOS_ASSERT(0);
+      vos_mem_free(wdiStopReq);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if ( eDRIVER_TYPE_MFG != pWDA->driverMode )
+   {
+      wdaDestroyTimers(pWDA);
+   }
+   pWDA->wdaWdiApiMsgParam = (v_PVOID_t *)wdiStopReq;
+
+   /* call WDI stop */
+   wdiStatus = WDI_Stop(wdiStopReq,
+                           (WDI_StopRspCb)WDA_stopCallback, pVosContext);
+
+   if (IS_WDI_STATUS_FAILURE(wdiStatus) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "error in WDA Stop" );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_close
+ * call WDI_close and free the WDA context
+ */ 
+VOS_STATUS WDA_close(v_PVOID_t pVosContext)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
+   if (NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid wdaContext", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if((WDA_INIT_STATE != wdaContext->wdaState) && 
+                              (WDA_STOP_STATE != wdaContext->wdaState))
+   {
+      VOS_ASSERT(0);
+   }
+
+   /*call WDI close*/
+   status = WDI_Close();
+   if ( status != WDI_STATUS_SUCCESS )
+   {
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   wdaContext->wdaState = WDA_CLOSE_STATE;
+
+   /* Destroy the events */
+   status = vos_event_destroy(&wdaContext->wdaWdiEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "WDI Sync Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   status = vos_event_destroy(&wdaContext->txFrameEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+   status = vos_event_destroy(&wdaContext->suspendDataTxEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+   status = vos_event_destroy(&wdaContext->waitOnWdiIndicationCallBack);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   /* free WDA context */
+   status = vos_free_context(pVosContext, VOS_MODULE_ID_WDA, wdaContext);
+   if ( !VOS_IS_STATUS_SUCCESS(status) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "error in WDA close " );
+      status = VOS_STATUS_E_FAILURE;
+   }
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual
+ * returns 1 if the compiled version is greater than or equal to the input version
+ */ 
+
+uint8 WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision)
+{    
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
+    tSirVersionType compiledVersion;
+
+    status = WDA_GetWcnssWlanCompiledVersion(vosContext, &compiledVersion);
+
+    if ((compiledVersion.major > major) || ((compiledVersion.major == major)&& (compiledVersion.minor > minor)) ||
+        ((compiledVersion.major == major)&& (compiledVersion.minor == minor) &&(compiledVersion.version > version)) ||
+        ((compiledVersion.major == major)&& (compiledVersion.minor == minor) &&(compiledVersion.version == version) &&
+        (compiledVersion.revision >= revision)))        
+        return 1;
+    else
+        return 0;
+}
+
+/*
+ * FUNCTION: WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual
+ * returns 1 if the compiled version is greater than or equal to the input version
+ */ 
+
+uint8 WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision)
+{    
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
+    tSirVersionType reportedVersion;
+
+    status = WDA_GetWcnssWlanReportedVersion(vosContext, &reportedVersion);
+
+    if ((reportedVersion.major > major) || ((reportedVersion.major == major)&& (reportedVersion.minor > minor)) ||
+        ((reportedVersion.major == major)&& (reportedVersion.minor == minor) &&(reportedVersion.version > version)) ||
+        ((reportedVersion.major == major)&& (reportedVersion.minor == minor) &&(reportedVersion.version == version) &&
+        (reportedVersion.revision >= revision)))        
+        return 1;
+    else
+        return 0;
+}
+
+/*
+ * FUNCTION: WDA_GetWcnssWlanCompiledVersion
+ * Returns the version of the WCNSS WLAN API with which the HOST
+ * device driver was compiled
+ */ 
+VOS_STATUS WDA_GetWcnssWlanCompiledVersion(v_PVOID_t pvosGCtx,
+                                           tSirVersionType *pVersion)
+{
+   tWDA_CbContext *pWDA;
+
+   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "%s: Entered", __FUNCTION__);
+
+   if ((NULL == pvosGCtx) || (NULL == pVersion))
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invoked with invalid parameter", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+   if (NULL == pWDA )
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid WDA context", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   *pVersion = pWDA->wcnssWlanCompiledVersion;
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_GetWcnssWlanReportedVersion
+ * Returns the version of the WCNSS WLAN API with which the WCNSS
+ * device driver was compiled
+ */ 
+VOS_STATUS WDA_GetWcnssWlanReportedVersion(v_PVOID_t pvosGCtx,
+                                           tSirVersionType *pVersion)
+{
+   tWDA_CbContext *pWDA;
+
+   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "%s: Entered", __FUNCTION__);
+
+   if ((NULL == pvosGCtx) || (NULL == pVersion))
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invoked with invalid parameter", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+   if (NULL == pWDA )
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid WDA context", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   *pVersion = pWDA->wcnssWlanReportedVersion;
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_GetWcnssSoftwareVersion
+ * Returns the WCNSS Software version string
+ */ 
+VOS_STATUS WDA_GetWcnssSoftwareVersion(v_PVOID_t pvosGCtx,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize)
+{
+   tWDA_CbContext *pWDA;
+
+   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "%s: Entered", __FUNCTION__);
+
+   if ((NULL == pvosGCtx) || (NULL == pVersion))
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invoked with invalid parameter", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+   if (NULL == pWDA )
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid WDA context", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wpalMemoryCopy(pVersion, pWDA->wcnssSoftwareVersionString, versionBufferSize);
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_GetWcnssHardwareVersion
+ * Returns the WCNSS Hardware version string
+ */ 
+VOS_STATUS WDA_GetWcnssHardwareVersion(v_PVOID_t pvosGCtx,
+                                       tANI_U8 *pVersion,
+                                       tANI_U32 versionBufferSize)
+{
+   tWDA_CbContext *pWDA;
+
+   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "%s: Entered", __FUNCTION__);
+
+   if ((NULL == pvosGCtx) || (NULL == pVersion))
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invoked with invalid parameter", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+   if (NULL == pWDA )
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: Invalid WDA context", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wpalMemoryCopy(pVersion, pWDA->wcnssHardwareVersionString, versionBufferSize);
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_WniCfgDnld
+ * Trigger CFG Download
+ */ 
+VOS_STATUS WDA_WniCfgDnld(tWDA_CbContext *pWDA) 
+{
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+
+   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+
+   v_VOID_t *pFileImage = NULL;
+   v_SIZE_t cbFileImageSize = 0;
+
+   v_VOID_t *pCfgBinary = NULL;
+   v_SIZE_t cbCfgBinarySize = 0;
+   
+   v_BOOL_t bStatus = VOS_FALSE;
+
+   if (NULL == pMac )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid MAC context ", __FUNCTION__ );
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* get the number of bytes in the CFG Binary... */
+   vosStatus = vos_get_binary_blob( VOS_BINARY_ID_CONFIG, NULL, 
+                                                &cbFileImageSize );
+   if ( VOS_STATUS_E_NOMEM != vosStatus )
+   {
+      VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                 "Error obtaining binary size" );
+      goto fail;
+   }
+
+   // malloc a buffer to read in the Configuration binary file.
+   pFileImage = vos_mem_malloc( cbFileImageSize );
+
+   if ( NULL == pFileImage )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Unable to allocate memory for the CFG binary [size= %d bytes]",
+                 cbFileImageSize );
+
+      vosStatus = VOS_STATUS_E_NOMEM;
+      goto fail;
+   }
+   
+   /* Get the entire CFG file image... */
+   vosStatus = vos_get_binary_blob( VOS_BINARY_ID_CONFIG, pFileImage, 
+                                                         &cbFileImageSize );
+   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+         "Error: Cannot retrieve CFG file image from vOSS. [size= %d bytes]",
+                                                             cbFileImageSize );
+      goto fail;
+   }
+   
+   /* 
+    * Validate the binary image.  This function will return a pointer 
+    * and length where the CFG binary is located within the binary image file.
+    */
+   bStatus = sys_validateStaConfig( pFileImage, cbFileImageSize,
+                                   &pCfgBinary, &cbCfgBinarySize );
+   if ( VOS_FALSE == bStatus )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "Error: Cannot find STA CFG in binary image file" );
+      vosStatus = VOS_STATUS_E_FAILURE;
+      goto fail;
+   }
+
+   /*
+    * TODO: call the config download function 
+    * for now calling the existing cfg download API 
+    */
+   processCfgDownloadReq(pMac,cbCfgBinarySize,pCfgBinary);
+
+   if( pFileImage != NULL )
+   {
+      vos_mem_free( pFileImage );
+   }
+   return vosStatus;
+   
+fail:
+   if(pCfgBinary != NULL)
+      vos_mem_free( pFileImage );
+   
+   return vosStatus;
+}
+
+/* -----------------------------------------------------------------
+ * WDI interface 
+ * -----------------------------------------------------------------
+ */
+
+/*
+ * FUNCTION: WDA_suspendDataTxCallback
+ * call back function called from TL after suspend Transmission
+ */ 
+VOS_STATUS WDA_SuspendDataTxCallback( v_PVOID_t      pvosGCtx,
+                                            v_U8_t*        ucSTAId,
+                                            VOS_STATUS     vosStatus)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                      "%s: Entered " ,__FUNCTION__);
+
+   if (NULL == pWDA )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid WDA context ", __FUNCTION__ );
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   if(VOS_IS_STATUS_SUCCESS(vosStatus)) 
+   {
+      pWDA->txStatus = WDA_TL_TX_SUSPEND_SUCCESS;
+   }
+   else
+   {
+      pWDA->txStatus = WDA_TL_TX_SUSPEND_FAILURE;        
+   }
+
+   /* Trigger the event to bring the WDA TL suspend function to come 
+    * out of wait*/
+   vosStatus = vos_event_set(&pWDA->suspendDataTxEvent);
+   if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                      "NEW VOS Event Set failed - status = %d \n", vosStatus);
+   }
+
+   /* If TL suspended had timedout before this callback was called, resume back 
+   * TL.*/
+   if (pWDA->txSuspendTimedOut) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "Late TLSuspendCallback, resuming TL back again\n");
+      WDA_ResumeDataTx(pWDA);
+      pWDA->txSuspendTimedOut = FALSE;
+   }
+
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_suspendDataTx
+ * Update TL to suspend the data Transmission
+ */ 
+VOS_STATUS WDA_SuspendDataTx(tWDA_CbContext *pWDA)
+{
+   VOS_STATUS status = VOS_STATUS_E_FAILURE;
+   tANI_U8 eventIdx = 0;
+   tANI_U8 ucSTAId = 0;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                      "%s: Entered " ,__FUNCTION__);
+
+   pWDA->txStatus = WDA_TL_TX_SUSPEND_FAILURE;
+
+   if (pWDA->txSuspendTimedOut) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+         "TL suspend timedout previously, CB not called yet\n");
+        return status;
+   }
+
+   /* Reset the event to be not signalled */
+   status = vos_event_reset(&pWDA->suspendDataTxEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                            "VOS Event reset failed - status = %d\n",status);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /*Indicate TL to suspend transmission for all Sta Id */
+   ucSTAId = WLAN_ALL_STA;
+   status = WLANTL_SuspendDataTx(pWDA->pVosContext, &ucSTAId,
+                                                WDA_SuspendDataTxCallback);
+   if(status != VOS_STATUS_SUCCESS)
+   {
+      return status;
+   }
+
+   /* Wait for the event to be set by the TL, to get the response of 
+    * suspending the TX queues, this event should be set by the Callback 
+    * function called by TL*/
+   status = vos_wait_events(&pWDA->suspendDataTxEvent, 1, 
+                                   WDA_TL_SUSPEND_TIMEOUT, &eventIdx);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                 "%s: Status %d when waiting for Suspend Data TX Event",
+                 __FUNCTION__, status);
+      /* Set this flag to true when TL suspend times out, so that when TL 
+       * suspend eventually happens and calls the callback, TL can be resumed 
+       * right away by looking at this flag when true.*/
+      pWDA->txSuspendTimedOut = TRUE;
+   }
+   else
+   {
+      pWDA->txSuspendTimedOut = FALSE;
+   }
+
+   if(WDA_TL_TX_SUSPEND_SUCCESS == pWDA->txStatus)
+   {
+      status = VOS_STATUS_SUCCESS;
+   }
+
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_resumeDataTx
+ * Update TL to resume the data Transmission
+ */ 
+VOS_STATUS WDA_ResumeDataTx(tWDA_CbContext *pWDA)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   tANI_U8 ucSTAId = 0;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                      "%s: Entered " ,__FUNCTION__);
+   ucSTAId = WLAN_ALL_STA;
+   status = WLANTL_ResumeDataTx(pWDA->pVosContext, &ucSTAId);
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_InitScanReqCallback
+ * Trigger Init SCAN callback
+ */ 
+void WDA_InitScanReqCallback(WDI_Status wdiStatus, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tInitScanParams *pWDA_ScanParam ;
+   VOS_STATUS      status;      
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pWDA_ScanParam = (tInitScanParams *)pWdaParams->wdaMsgParam;
+
+   if(NULL == pWDA_ScanParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: pWDA_ScanParam received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if(WDI_STATUS_SUCCESS != wdiStatus)
+   {
+      status = WDA_ResumeDataTx(pWDA) ;
+
+      if(VOS_STATUS_SUCCESS != status)
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "%s error in Resume Tx ", __FUNCTION__ );
+      }
+   }
+
+   /* free WDI command buffer */
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+
+   vos_mem_free(pWdaParams) ;
+
+   
+   /* assign status to scan params */
+   pWDA_ScanParam->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
+
+   /* send SCAN RSP message back to PE */
+   WDA_SendMsg(pWDA, WDA_INIT_SCAN_RSP, (void *)pWDA_ScanParam, 0) ;
+
+   return ;
+}
+  
+/*
+ * FUNCTION: WDA_ProcessInitScanReq
+ * Trigger Init SCAN in DAL
+ */ 
+VOS_STATUS  WDA_ProcessInitScanReq(tWDA_CbContext *pWDA, 
+                                   tInitScanParams *initScanParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_InitScanReqParamsType *wdiInitScanParam = 
+                  (WDI_InitScanReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_InitScanReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams;
+   tANI_U8 i = 0;
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiInitScanParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiInitScanParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+   
+   /* Copy init Scan params to WDI structure */
+   wdiInitScanParam->wdiReqInfo.wdiScanMode = initScanParams->scanMode ;
+   vos_mem_copy(wdiInitScanParam->wdiReqInfo.macBSSID, initScanParams->bssid,
+                                             sizeof(tSirMacAddr)) ;
+   wdiInitScanParam->wdiReqInfo.bNotifyBSS = initScanParams->notifyBss ;
+   wdiInitScanParam->wdiReqInfo.ucFrameType = initScanParams->frameType ;
+   wdiInitScanParam->wdiReqInfo.ucFrameLength = initScanParams->frameLength ;
+#ifdef WLAN_FEATURE_P2P
+   wdiInitScanParam->wdiReqInfo.bUseNOA = initScanParams->useNoA;
+   wdiInitScanParam->wdiReqInfo.scanDuration = initScanParams->scanDuration;
+#else
+   wdiInitScanParam->wdiReqInfo.bUseNOA = 0;
+   wdiInitScanParam->wdiReqInfo.scanDuration = 0;
+#endif
+   wdiInitScanParam->wdiReqInfo.wdiScanEntry.activeBSScnt = 
+                                     initScanParams->scanEntry.activeBSScnt ;
+
+   for (i=0; i < initScanParams->scanEntry.activeBSScnt; i++)
+   {
+       wdiInitScanParam->wdiReqInfo.wdiScanEntry.bssIdx[i] = 
+                                        initScanParams->scanEntry.bssIdx[i] ;
+   }
+    
+   /* if Frame length, copy macMgmtHdr or WDI structure */ 
+   if(0 != wdiInitScanParam->wdiReqInfo.ucFrameLength)
+   {
+      vos_mem_copy(&wdiInitScanParam->wdiReqInfo.wdiMACMgmtHdr, 
+                       &initScanParams->macMgmtHdr, sizeof(tSirMacMgmtHdr)) ;
+   } 
+   wdiInitScanParam->wdiReqStatusCB = NULL ;
+
+
+   /* Store Init Req pointer, as this will be used for response */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = initScanParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiInitScanParam;
+
+   /* first try to suspend TX */
+   status = WDA_SuspendDataTx(pWDA) ;
+
+   if(WDI_STATUS_SUCCESS != status)
+   {
+      goto handleWdiFailure;
+   }
+
+   /* call DAL API to pass init scan request to DAL */
+   status = WDI_InitScanReq(wdiInitScanParam, 
+                        WDA_InitScanReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "error in WDA Init Scan, Resume Tx " );
+      status = WDA_ResumeDataTx(pWDA) ;
+
+      VOS_ASSERT(0) ;
+  
+      goto handleWdiFailure;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+handleWdiFailure:
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                      "Failure in WDI Api, free all the memory " );
+   /* free WDI command buffer */
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   /* send Failure to PE */
+   initScanParams->status = eSIR_FAILURE ;
+   WDA_SendMsg(pWDA, WDA_INIT_SCAN_RSP, (void *)initScanParams, 0) ;
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+
+/*
+ * FUNCTION: WDA_StartScanReqCallback
+ * send Start SCAN RSP back to PE
+ */ 
+void WDA_StartScanReqCallback(WDI_StartScanRspParamsType *pScanRsp, 
+                                                    void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tStartScanParams *pWDA_ScanParam;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pWDA_ScanParam = (tStartScanParams *)pWdaParams->wdaMsgParam;
+
+   if(NULL == pWDA_ScanParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: pWDA_ScanParam received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if(NULL == pWdaParams->wdaWdiApiMsgParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: wdaWdiApiMsgParam is NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   
+   /* assign status to scan params */
+   pWDA_ScanParam->status = CONVERT_WDI2SIR_STATUS(pScanRsp->wdiStatus) ;
+
+   /* send SCAN RSP message back to PE */
+   WDA_SendMsg(pWDA, WDA_START_SCAN_RSP, (void *)pWDA_ScanParam, 0) ;
+
+   return ;
+}
+
+
+
+/*
+ * FUNCTION: WDA_ProcessStartScanReq
+ * Trigger start SCAN in WDI
+ */ 
+VOS_STATUS  WDA_ProcessStartScanReq(tWDA_CbContext *pWDA, 
+                                           tStartScanParams *startScanParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   WDI_StartScanReqParamsType *wdiStartScanParams = 
+                            (WDI_StartScanReqParamsType *)vos_mem_malloc(
+                                          sizeof(WDI_StartScanReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiStartScanParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiStartScanParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Copy init Scan params to WDI structure */
+   wdiStartScanParams->ucChannel = startScanParams->scanChannel ;
+   wdiStartScanParams->wdiReqStatusCB = NULL ;
+
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = startScanParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiStartScanParams;
+
+   /* call DAL API to pass init scan request to DAL */
+   status = WDI_StartScanReq(wdiStartScanParams, 
+                              WDA_StartScanReqCallback, pWdaParams) ;
+
+   /* failure returned by WDI API */
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                     "Failure in Start Scan WDI API, free all the memory "
+                     "It should be due to previous abort scan." );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      startScanParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_START_SCAN_RSP, (void *)startScanParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_EndScanReqCallback
+ * END SCAN callback
+ */ 
+void WDA_EndScanReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tEndScanParams *endScanParam;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                             "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   endScanParam = (tEndScanParams *)pWdaParams->wdaMsgParam;
+
+   if(NULL == endScanParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: endScanParam received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   } 
+   
+   /* Free WDI command buffer */
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   /* assign status to scan params */
+   endScanParam->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   /* send response back to PE */
+   WDA_SendMsg(pWDA, WDA_END_SCAN_RSP, (void *)endScanParam, 0) ;
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessEndScanReq
+ * Trigger END SCAN in WDI
+ */ 
+VOS_STATUS  WDA_ProcessEndScanReq(tWDA_CbContext *pWDA, 
+                                           tEndScanParams *endScanParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   WDI_EndScanReqParamsType *wdiEndScanParams =
+                            (WDI_EndScanReqParamsType *)vos_mem_malloc(
+                                          sizeof(WDI_EndScanReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                             "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiEndScanParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiEndScanParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Copy init Scan params to WDI structure */
+   wdiEndScanParams->ucChannel = endScanParams->scanChannel ;
+   wdiEndScanParams->wdiReqStatusCB = NULL ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = endScanParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiEndScanParams;
+
+   /* call DAL API to pass init scan request to DAL */
+   status = WDI_EndScanReq(wdiEndScanParams, 
+                              WDA_EndScanReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                     "Failure in End Scan WDI API, free all the memory "
+                     "It should be due to previous abort scan." );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      endScanParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_END_SCAN_RSP, (void *)endScanParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_FinishScanReqCallback
+ * Trigger Finish SCAN callback
+ */ 
+void WDA_FinishScanReqCallback(WDI_Status wdiStatus, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tFinishScanParams *finishScanParam; 
+   VOS_STATUS      status;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   finishScanParam = (tFinishScanParams *)pWdaParams->wdaMsgParam;
+
+   if(NULL == finishScanParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: finishScanParam is NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   /* 
+    * Now Resume TX, if we reached here means, TX is already suspended, we 
+    * have to resume it unconditionaly
+    */
+   status = WDA_ResumeDataTx(pWDA) ;
+       
+   if(VOS_STATUS_SUCCESS != status)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "%s error in Resume Tx ", __FUNCTION__ );
+   }
+
+   finishScanParam->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
+
+   WDA_SendMsg(pWDA, WDA_FINISH_SCAN_RSP, (void *)finishScanParam, 0) ;
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessFinshScanReq
+ * Trigger Finish SCAN in WDI
+ */ 
+VOS_STATUS  WDA_ProcessFinishScanReq(tWDA_CbContext *pWDA, 
+                                           tFinishScanParams *finishScanParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   WDI_FinishScanReqParamsType *wdiFinishScanParams =
+                            (WDI_FinishScanReqParamsType *)vos_mem_malloc(
+                                        sizeof(WDI_FinishScanReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+   tANI_U8 i = 0;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                             "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiFinishScanParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiFinishScanParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Copy init Scan params to WDI structure */
+   wdiFinishScanParams->wdiReqInfo.wdiScanMode = finishScanParams->scanMode ;
+   vos_mem_copy(wdiFinishScanParams->wdiReqInfo.macBSSID, 
+                              finishScanParams->bssid, sizeof(tSirMacAddr)) ;
+
+   wdiFinishScanParams->wdiReqInfo.bNotifyBSS = finishScanParams->notifyBss ;
+   wdiFinishScanParams->wdiReqInfo.ucFrameType = finishScanParams->frameType ;
+   wdiFinishScanParams->wdiReqInfo.ucFrameLength = 
+                                                finishScanParams->frameLength ;
+   wdiFinishScanParams->wdiReqInfo.ucCurrentOperatingChannel = 
+                                         finishScanParams->currentOperChannel ;
+   wdiFinishScanParams->wdiReqInfo.wdiCBState = finishScanParams->cbState ;
+   wdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt = 
+                                     finishScanParams->scanEntry.activeBSScnt ;
+
+   for (i = 0; i < finishScanParams->scanEntry.activeBSScnt; i++)
+   {
+       wdiFinishScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i] = 
+                                        finishScanParams->scanEntry.bssIdx[i] ;
+   }
+   
+ 
+
+   /* if Frame length, copy macMgmtHdr ro WDI structure */ 
+   if(0 != wdiFinishScanParams->wdiReqInfo.ucFrameLength)
+   {
+      vos_mem_copy(&wdiFinishScanParams->wdiReqInfo.wdiMACMgmtHdr, 
+                                          &finishScanParams->macMgmtHdr, 
+                                                     sizeof(WDI_MacMgmtHdr)) ;
+   } 
+   wdiFinishScanParams->wdiReqStatusCB = NULL ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = finishScanParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiFinishScanParams;
+
+   /* call DAL API to pass init scan request to DAL */
+   status = WDI_FinishScanReq(wdiFinishScanParams, 
+                              WDA_FinishScanReqCallback, pWdaParams) ;
+
+   
+   /* 
+    * WDI API returns failure..
+    */
+   if(IS_WDI_STATUS_FAILURE( status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                     "Failure in Finish Scan WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+
+      finishScanParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_FINISH_SCAN_RSP, (void *)finishScanParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*---------------------------------------------------------------------
+ * ASSOC API's
+ *---------------------------------------------------------------------
+ */
+
+/*
+ * FUNCTION: WDA_JoinReqCallback
+ * Trigger Init SCAN callback
+ */ 
+void WDA_JoinReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tSwitchChannelParams *joinReqParam;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   joinReqParam = (tSwitchChannelParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams) ;
+
+   /* reset macBSSID */
+   vos_mem_set(pWDA->macBSSID, sizeof(pWDA->macBSSID),0 );
+
+   /* reset macSTASelf */
+   vos_mem_set(pWDA->macSTASelf, sizeof(pWDA->macSTASelf),0 );
+
+   joinReqParam->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)joinReqParam , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessJoinReq
+ * Trigger Join REQ in WDI
+ */ 
+
+VOS_STATUS WDA_ProcessJoinReq(tWDA_CbContext *pWDA, 
+                                            tSwitchChannelParams* joinReqParam)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   WDI_JoinReqParamsType *wdiJoinReqParam = 
+                             (WDI_JoinReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_JoinReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiJoinReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiJoinReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* copy the BSSID for pWDA */
+   vos_mem_copy(wdiJoinReqParam->wdiReqInfo.macBSSID, pWDA->macBSSID, 
+                                             sizeof(tSirMacAddr)) ;
+
+   vos_mem_copy(wdiJoinReqParam->wdiReqInfo.macSTASelf, 
+                pWDA->macSTASelf, sizeof(tSirMacAddr)) ;
+
+   wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.ucChannel = 
+                                                 joinReqParam->channelNumber ;
+#ifndef WLAN_FEATURE_VOWIFI
+   wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.ucLocalPowerConstraint = 
+                                          joinReqParam->localPowerConstraint ;
+#endif
+   wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.wdiSecondaryChannelOffset = 
+                                        joinReqParam->secondaryChannelOffset ;
+   wdiJoinReqParam->wdiReqInfo.linkState = pWDA->linkState;
+   
+   wdiJoinReqParam->wdiReqStatusCB = NULL ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = joinReqParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiJoinReqParam;
+
+   status = WDI_JoinReq(wdiJoinReqParam, 
+                               (WDI_JoinRspCb )WDA_JoinReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Join WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      joinReqParam->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)joinReqParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_SwitchChannelReqCallback
+ * send Switch channel RSP back to PE
+ */ 
+void WDA_SwitchChannelReqCallback(
+               WDI_SwitchCHRspParamsType   *wdiSwitchChanRsp, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+   tWDA_CbContext *pWDA; 
+   tSwitchChannelParams *pSwitchChanParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pSwitchChanParams = (tSwitchChannelParams *)pWdaParams->wdaMsgParam;
+   
+#ifdef WLAN_FEATURE_VOWIFI
+   pSwitchChanParams->txMgmtPower  =  wdiSwitchChanRsp->ucTxMgmtPower;
+#endif
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   pSwitchChanParams->status = 
+                          CONVERT_WDI2SIR_STATUS(wdiSwitchChanRsp->wdiStatus) ;
+
+   WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)pSwitchChanParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessChannelSwitchReq
+ * Request to WDI to switch channel REQ params.
+ */ 
+VOS_STATUS WDA_ProcessChannelSwitchReq(tWDA_CbContext *pWDA, 
+                                       tSwitchChannelParams *pSwitchChanParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SwitchChReqParamsType *wdiSwitchChanParam = 
+                         (WDI_SwitchChReqParamsType *)vos_mem_malloc(
+                                         sizeof(WDI_SwitchChReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSwitchChanParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSwitchChanParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiSwitchChanParam->wdiChInfo.ucChannel = pSwitchChanParams->channelNumber;
+#ifndef WLAN_FEATURE_VOWIFI
+   wdiSwitchChanParam->wdiChInfo.ucLocalPowerConstraint = 
+                                       pSwitchChanParams->localPowerConstraint;
+#endif
+   wdiSwitchChanParam->wdiChInfo.wdiSecondaryChannelOffset = 
+                                     pSwitchChanParams->secondaryChannelOffset;
+   wdiSwitchChanParam->wdiReqStatusCB = NULL ;
+
+   /* Store req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pSwitchChanParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiSwitchChanParam;
+
+#ifdef WLAN_FEATURE_VOWIFI
+   wdiSwitchChanParam->wdiChInfo.cMaxTxPower 
+                                     = pSwitchChanParams->maxTxPower;
+   vos_mem_copy(wdiSwitchChanParam->wdiChInfo.macSelfStaMacAddr, 
+                    pSwitchChanParams ->selfStaMacAddr,
+                    sizeof(tSirMacAddr));
+#endif
+   vos_mem_copy(wdiSwitchChanParam->wdiChInfo.macBSSId, 
+                     pSwitchChanParams->bssId,
+                     sizeof(tSirMacAddr));
+
+   status = WDI_SwitchChReq(wdiSwitchChanParam, 
+                     (WDI_SwitchChRspCb)WDA_SwitchChannelReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+       "Failure in process channel switch Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      pSwitchChanParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)pSwitchChanParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ConfigBssReqCallback
+ * config BSS Req Callback, called by WDI
+ */ 
+void WDA_ConfigBssReqCallback(WDI_ConfigBSSRspParamsType *wdiConfigBssRsp  
+                                                          ,void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tAddBssParams *configBssReqParam;
+   tAddStaParams *staConfigBssParam;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   configBssReqParam = (tAddBssParams *)pWdaParams->wdaMsgParam;
+   staConfigBssParam = &configBssReqParam->staContext ;
+
+   configBssReqParam->status = 
+                     CONVERT_WDI2SIR_STATUS(wdiConfigBssRsp->wdiStatus);
+
+   if(WDI_STATUS_SUCCESS == wdiConfigBssRsp->wdiStatus)
+   {
+      vos_mem_copy(configBssReqParam->bssId, wdiConfigBssRsp->macBSSID, 
+                                                    sizeof(tSirMacAddr));
+
+      configBssReqParam->bssIdx = wdiConfigBssRsp->ucBSSIdx;
+      configBssReqParam->bcastDpuSignature = wdiConfigBssRsp->ucBcastSig;
+      configBssReqParam->mgmtDpuSignature = wdiConfigBssRsp->ucUcastSig;
+      
+      if (configBssReqParam->operMode == BSS_OPERATIONAL_MODE_STA) 
+      {
+         if(configBssReqParam->bssType == eSIR_IBSS_MODE) 
+         {
+            pWDA->wdaGlobalSystemRole = eSYSTEM_STA_IN_IBSS_ROLE;
+            staConfigBssParam->staType = STA_ENTRY_BSSID;
+         }
+         else if ((configBssReqParam->bssType == eSIR_BTAMP_STA_MODE) &&
+                 (staConfigBssParam->staType == STA_ENTRY_SELF))
+         {
+            /* This is the 1st add BSS Req for the BTAMP STA */
+            pWDA->wdaGlobalSystemRole = eSYSTEM_BTAMP_STA_ROLE;
+            staConfigBssParam->staType = STA_ENTRY_BSSID;
+         }
+         else if ((configBssReqParam->bssType == eSIR_BTAMP_AP_MODE) &&
+                (staConfigBssParam->staType == STA_ENTRY_PEER))
+         {
+            /* This is the 2nd ADD BSS Request that is sent
+             * on the BTAMP STA side. The Sta type is
+             * set to STA_ENTRY_PEER here.*/
+            pWDA->wdaGlobalSystemRole = eSYSTEM_BTAMP_STA_ROLE;
+        }
+         else if ((configBssReqParam->bssType == eSIR_BTAMP_AP_MODE) &&
+                      (staConfigBssParam->staType == STA_ENTRY_SELF))
+         {
+            /* statype is already set by PE.
+             * Only 1 ADD BSS Req is sent on the BTAMP AP side.*/
+            pWDA->wdaGlobalSystemRole = eSYSTEM_BTAMP_AP_ROLE;
+            staConfigBssParam->staType = STA_ENTRY_BSSID;
+         } 
+         else 
+         {
+            pWDA->wdaGlobalSystemRole = eSYSTEM_STA_ROLE;
+            staConfigBssParam->staType = STA_ENTRY_PEER;
+         }
+      }
+      else if (configBssReqParam->operMode == BSS_OPERATIONAL_MODE_AP) 
+      {
+         pWDA->wdaGlobalSystemRole = eSYSTEM_AP_ROLE;
+         staConfigBssParam->staType = STA_ENTRY_SELF;
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "Invalid operation mode specified");
+         VOS_ASSERT(0);
+      }
+      
+      staConfigBssParam->staIdx = wdiConfigBssRsp->ucSTAIdx;
+
+      staConfigBssParam->bssIdx = wdiConfigBssRsp->ucBSSIdx;
+
+      staConfigBssParam->ucUcastSig = wdiConfigBssRsp->ucUcastSig;
+
+      staConfigBssParam->ucBcastSig = wdiConfigBssRsp->ucBcastSig;
+
+      vos_mem_copy(staConfigBssParam->staMac, wdiConfigBssRsp->macSTA,
+                                                    sizeof(tSirMacAddr));
+      staConfigBssParam->txChannelWidthSet = 
+                               configBssReqParam->txChannelWidthSet;
+
+      if(staConfigBssParam->staType == STA_ENTRY_PEER && 
+                                    staConfigBssParam->htCapable)
+      {
+         pWDA->wdaStaInfo[staConfigBssParam->staIdx].bssIdx = 
+                                                    wdiConfigBssRsp->ucBSSIdx;
+         pWDA->wdaStaInfo[staConfigBssParam->staIdx].ucValidStaIndex = 
+                                                         WDA_VALID_STA_INDEX ;
+      }
+
+      if(WDI_DS_SetStaIdxPerBssIdx(pWDA->pWdiContext,
+                                   wdiConfigBssRsp->ucBSSIdx,
+                                   wdiConfigBssRsp->ucSTAIdx))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: fail to set STA idx associated with BSS index", __FUNCTION__);
+         VOS_ASSERT(0) ;
+      }
+
+      if(WDI_DS_AddSTAMemPool(pWDA->pWdiContext, wdiConfigBssRsp->ucSTAIdx))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: add BSS into mempool fail", __FUNCTION__);
+         VOS_ASSERT(0) ;
+      }
+
+#ifdef WLAN_FEATURE_VOWIFI
+      configBssReqParam->txMgmtPower = wdiConfigBssRsp->ucTxMgmtPower;
+#endif
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   WDA_SendMsg(pWDA, WDA_ADD_BSS_RSP, (void *)configBssReqParam , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateEdcaParamsForAC
+ * Update WDI EDCA params with PE edca params
+ */ 
+void WDA_UpdateEdcaParamsForAC(tWDA_CbContext *pWDA, 
+                         WDI_EdcaParamRecord *wdiEdcaParam, 
+                             tSirMacEdcaParamRecord *macEdcaParam)
+{
+   wdiEdcaParam->wdiACI.aifsn = macEdcaParam->aci.aifsn;
+   wdiEdcaParam->wdiACI.acm= macEdcaParam->aci.acm;
+   wdiEdcaParam->wdiACI.aci = macEdcaParam->aci.aci;
+   wdiEdcaParam->wdiCW.min = macEdcaParam->cw.min;
+   wdiEdcaParam->wdiCW.max = macEdcaParam->cw.max;
+   wdiEdcaParam->usTXOPLimit = macEdcaParam->txoplimit;
+}
+
+/*
+ * FUNCTION: WDA_ProcessConfigBssReq
+ * Configure BSS before starting Assoc with AP
+ */ 
+VOS_STATUS WDA_ProcessConfigBssReq(tWDA_CbContext *pWDA, 
+                                         tAddBssParams* configBssReqParam)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   WDI_ConfigBSSReqParamsType *wdiConfigBssReqParam =
+                             (WDI_ConfigBSSReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_ConfigBSSReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiConfigBssReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiConfigBssReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_set(wdiConfigBssReqParam, sizeof(WDI_ConfigBSSReqParamsType), 0);
+
+   WDA_UpdateBSSParams(pWDA, &wdiConfigBssReqParam->wdiReqInfo, 
+                       configBssReqParam) ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = configBssReqParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiConfigBssReqParam;
+
+   status = WDI_ConfigBSSReq(wdiConfigBssReqParam, 
+                        (WDI_ConfigBSSRspCb )WDA_ConfigBssReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Config BSS WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+
+      configBssReqParam->status = eSIR_FAILURE ;
+
+      WDA_SendMsg(pWDA, WDA_ADD_BSS_RSP, (void *)configBssReqParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+#ifdef ENABLE_HAL_COMBINED_MESSAGES
+/*
+ * FUNCTION: WDA_PostAssocReqCallback
+ * Post ASSOC req callback, send RSP back to PE
+ */ 
+void WDA_PostAssocReqCallback(WDI_PostAssocRspParamsType *wdiPostAssocRsp,  
+                                                          void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+   tPostAssocParams *postAssocReqParam = 
+                             (tPostAssocParams *)pWDA->wdaMsgParam ;
+   /*STA context within the BSS Params*/
+   tAddStaParams *staPostAssocParam = 
+      &postAssocReqParam->addBssParams.staContext ;
+   /*STA Params for self STA*/
+   tAddStaParams *selfStaPostAssocParam = 
+      &postAssocReqParam->addStaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   postAssocReqParam->status = 
+                   CONVERT_WDI2SIR_STATUS(wdiPostAssocRsp->wdiStatus) ;
+
+   if(WDI_STATUS_SUCCESS == wdiPostAssocRsp->wdiStatus)
+   {
+      staPostAssocParam->staIdx = wdiPostAssocRsp->bssParams.ucSTAIdx ;
+      vos_mem_copy(staPostAssocParam->staMac, wdiPostAssocRsp->bssParams.macSTA, 
+                   sizeof(tSirMacAddr)) ;
+      staPostAssocParam->ucUcastSig = wdiPostAssocRsp->bssParams.ucUcastSig ;
+      staPostAssocParam->ucBcastSig = wdiPostAssocRsp->bssParams.ucBcastSig ;
+      staPostAssocParam->bssIdx = wdiPostAssocRsp->bssParams.ucBSSIdx;
+
+      selfStaPostAssocParam->staIdx = wdiPostAssocRsp->staParams.ucSTAIdx;
+   }
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL;
+
+   WDA_SendMsg(pWDA, WDA_POST_ASSOC_RSP, (void *)postAssocReqParam, 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessPostAssocReq
+ * Trigger POST ASSOC processing in WDI
+ */ 
+VOS_STATUS WDA_ProcessPostAssocReq(tWDA_CbContext *pWDA, 
+                                    tPostAssocParams *postAssocReqParam)
+{
+
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   
+   WDI_PostAssocReqParamsType *wdiPostAssocReqParam =
+                           (WDI_PostAssocReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_PostAssocReqParamsType)) ;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+
+   if(NULL == wdiPostAssocReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+
+   /* update BSS params into WDI structure */
+   WDA_UpdateBSSParams(pWDA, &wdiPostAssocReqParam->wdiBSSParams, 
+                       &postAssocReqParam->addBssParams) ;
+   /* update STA params into WDI structure */
+   WDA_UpdateSTAParams(pWDA, &wdiPostAssocReqParam->wdiSTAParams, 
+                       &postAssocReqParam->addStaParams) ;
+   
+   wdiPostAssocReqParam->wdiBSSParams.ucEDCAParamsValid = 
+                           postAssocReqParam->addBssParams.highPerformance;
+   WDA_UpdateEdcaParamsForAC(pWDA, 
+                        &wdiPostAssocReqParam->wdiBSSParams.wdiBEEDCAParams,
+                        &postAssocReqParam->addBssParams.acbe);
+   WDA_UpdateEdcaParamsForAC(pWDA, 
+                        &wdiPostAssocReqParam->wdiBSSParams.wdiBKEDCAParams,
+                        &postAssocReqParam->addBssParams.acbk);
+   WDA_UpdateEdcaParamsForAC(pWDA, 
+                        &wdiPostAssocReqParam->wdiBSSParams.wdiVIEDCAParams,
+                        &postAssocReqParam->addBssParams.acvi);
+   WDA_UpdateEdcaParamsForAC(pWDA, 
+                        &wdiPostAssocReqParam->wdiBSSParams.wdiVOEDCAParams,
+                        &postAssocReqParam->addBssParams.acvo);
+
+   /* Store Init Req pointer, as this will be used for response */
+   pWDA->wdaMsgParam = (void *)postAssocReqParam ;
+
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiPostAssocReqParam ;
+
+   status = WDI_PostAssocReq(wdiPostAssocReqParam, 
+                        (WDI_PostAssocRspCb )WDA_PostAssocReqCallback, pWDA) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Post Assoc WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+
+      postAssocReqParam->status = eSIR_FAILURE ;
+
+      WDA_SendMsg(pWDA, WDA_POST_ASSOC_RSP, (void *)postAssocReqParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+#endif
+
+/*
+ * FUNCTION: WDA_AddStaReqCallback
+ * ADD STA req callback, send RSP back to PE
+ */ 
+void WDA_AddStaReqCallback(WDI_ConfigSTARspParamsType *wdiConfigStaRsp,  
+                                                          void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tAddStaParams *addStaReqParam;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,"%s: pWdaParams is NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   addStaReqParam = (tAddStaParams *)pWdaParams->wdaMsgParam;
+
+   addStaReqParam->status = 
+                   CONVERT_WDI2SIR_STATUS(wdiConfigStaRsp->wdiStatus) ;
+
+   if(WDI_STATUS_SUCCESS == wdiConfigStaRsp->wdiStatus)
+   {
+      addStaReqParam->staIdx = wdiConfigStaRsp->ucSTAIdx;
+      /*TODO: UMAC structure doesn't have these fields*/
+      /*addStaReqParam-> = wdiConfigStaRsp->ucDpuIndex;
+      addStaReqParam-> = wdiConfigStaRsp->ucBcastDpuIndex;
+      addStaReqParam-> = wdiConfigStaRsp->ucBcastMgmtDpuIdx; */
+      addStaReqParam->ucUcastSig = wdiConfigStaRsp->ucUcastSig;
+      addStaReqParam->ucBcastSig = wdiConfigStaRsp->ucBcastSig;
+      /* update staIndex as valid index for BA if STA is HT capable*/
+      if(addStaReqParam->staType == STA_ENTRY_PEER && addStaReqParam->htCapable)
+      {
+         pWDA->wdaStaInfo[addStaReqParam->staIdx].bssIdx = 
+                                                    wdiConfigStaRsp->ucBssIdx;
+         pWDA->wdaStaInfo[addStaReqParam->staIdx].ucValidStaIndex = 
+                                                         WDA_VALID_STA_INDEX ;
+      }
+      if(WDI_DS_AddSTAMemPool(pWDA->pWdiContext, wdiConfigStaRsp->ucSTAIdx))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: add STA into mempool fail", __FUNCTION__);
+         VOS_ASSERT(0) ;
+         return ;
+      }
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams) ;
+
+   WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaReqParam, 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ConfigStaReq
+ * Trigger Config STA processing in WDI
+ */ 
+VOS_STATUS WDA_ProcessAddStaReq(tWDA_CbContext *pWDA, 
+                                    tAddStaParams *addStaReqParam)
+{
+
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   WDI_ConfigSTAReqParamsType *wdiConfigStaReqParam =
+                           (WDI_ConfigSTAReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_ConfigSTAReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiConfigStaReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiConfigStaReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_set(wdiConfigStaReqParam, sizeof(WDI_ConfigSTAReqParamsType), 0);
+
+   /* update STA params into WDI structure */
+   WDA_UpdateSTAParams(pWDA, &wdiConfigStaReqParam->wdiReqInfo, 
+                       addStaReqParam) ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = addStaReqParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiConfigStaReqParam;
+
+   status = WDI_ConfigSTAReq(wdiConfigStaReqParam, 
+                        (WDI_ConfigSTARspCb )WDA_AddStaReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Config STA WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+
+      addStaReqParam->status = eSIR_FAILURE ;
+
+      WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaReqParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_DelBSSReqCallback
+ * Dens DEL BSS RSP back to PE
+ */ 
+void WDA_DelBSSReqCallback(WDI_DelBSSRspParamsType *wdiDelBssRsp, 
+                                                         void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tDeleteBssParams *delBssReqParam;
+   tANI_U8  staIdx,tid;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   delBssReqParam = (tDeleteBssParams *)pWdaParams->wdaMsgParam;
+
+   delBssReqParam->status = CONVERT_WDI2SIR_STATUS(wdiDelBssRsp->wdiStatus) ;
+
+   if(WDI_STATUS_SUCCESS == wdiDelBssRsp->wdiStatus)
+   {
+      vos_mem_copy(delBssReqParam->bssid, wdiDelBssRsp->macBSSID, 
+                                             sizeof(tSirMacAddr)) ;
+   }
+
+   if(WDI_DS_GetStaIdxFromBssIdx(pWDA->pWdiContext, delBssReqParam->bssIdx, &staIdx))
+   {
+     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Get STA index from BSS index Fail", __FUNCTION__);
+     VOS_ASSERT(0) ;
+   }
+
+   if(WDI_DS_DelSTAMemPool(pWDA->pWdiContext, staIdx))
+   {
+     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: DEL STA from MemPool Fail", __FUNCTION__);
+     VOS_ASSERT(0) ;
+   }
+
+   if(WDI_DS_ClearStaIdxPerBssIdx(pWDA->pWdiContext, delBssReqParam->bssIdx, staIdx))
+   {
+     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Clear STA index form table Fail", __FUNCTION__);
+     VOS_ASSERT(0) ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   /* reset the the system role*/
+   pWDA->wdaGlobalSystemRole = eSYSTEM_UNKNOWN_ROLE;
+   
+   /* Reset the BA related information */
+   for(staIdx=0; staIdx < WDA_MAX_STA; staIdx++)
+   {
+      if( pWDA->wdaStaInfo[staIdx].bssIdx == wdiDelBssRsp->ucBssIdx )
+      {
+         pWDA->wdaStaInfo[staIdx].ucValidStaIndex = WDA_INVALID_STA_INDEX;
+         pWDA->wdaStaInfo[staIdx].ucUseBaBitmap = 0;
+         /* Reset framesTxed counters here */
+         for(tid = 0; tid < STACFG_MAX_TC; tid++)
+         {
+            pWDA->wdaStaInfo[staIdx].framesTxed[tid] = 0;
+         }
+      }
+   }
+
+   WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delBssReqParam , 0) ;
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessDelBssReq
+ * Init DEL BSS req with WDI
+ */ 
+VOS_STATUS WDA_ProcessDelBssReq(tWDA_CbContext *pWDA, 
+                                        tDeleteBssParams *delBssParam)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   WDI_DelBSSReqParamsType *wdiDelBssReqParam = 
+                             (WDI_DelBSSReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_DelBSSReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiDelBssReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiDelBssReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiDelBssReqParam->ucBssIdx = delBssParam->bssIdx;
+   wdiDelBssReqParam->wdiReqStatusCB = NULL ;
+   
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = delBssParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiDelBssReqParam;
+
+   status = WDI_DelBSSReq(wdiDelBssReqParam, 
+                        (WDI_DelBSSRspCb )WDA_DelBSSReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Del BSS WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      delBssParam->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delBssParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_DelSTAReqCallback
+ * Dens DEL STA RSP back to PE
+ */ 
+void WDA_DelSTAReqCallback(WDI_DelSTARspParamsType *wdiDelStaRsp, 
+                                                         void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tDeleteStaParams *delStaReqParam;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   delStaReqParam = (tDeleteStaParams *)pWdaParams->wdaMsgParam;
+
+   delStaReqParam->status = CONVERT_WDI2SIR_STATUS(wdiDelStaRsp->wdiStatus) ;
+
+   if(WDI_STATUS_SUCCESS == wdiDelStaRsp->wdiStatus)
+   {
+      if(WDI_DS_DelSTAMemPool(pWDA->pWdiContext, wdiDelStaRsp->ucSTAIdx))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: DEL STA from MemPool Fail", __FUNCTION__);
+         VOS_ASSERT(0) ;
+      }
+      delStaReqParam->staIdx = wdiDelStaRsp->ucSTAIdx ;
+   }
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   /*Reset the BA information corresponding to this STAIdx */
+   pWDA->wdaStaInfo[wdiDelStaRsp->ucSTAIdx].ucValidStaIndex = 
+                                                      WDA_INVALID_STA_INDEX;
+   pWDA->wdaStaInfo[wdiDelStaRsp->ucSTAIdx].ucUseBaBitmap = 0;
+   
+   WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaReqParam , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessDelStaReq
+ * Init DEL STA req with WDI
+ */ 
+VOS_STATUS WDA_ProcessDelStaReq(tWDA_CbContext *pWDA, 
+                                      tDeleteStaParams *delStaParam)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   WDI_DelSTAReqParamsType *wdiDelStaReqParam = 
+                             (WDI_DelSTAReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_DelSTAReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiDelStaReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiDelStaReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiDelStaReqParam->ucSTAIdx = delStaParam->staIdx ;
+   wdiDelStaReqParam->wdiReqStatusCB = NULL ;
+
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = delStaParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiDelStaReqParam;
+
+   status = WDI_DelSTAReq(wdiDelStaReqParam, 
+                        (WDI_DelSTARspCb )WDA_DelSTAReqCallback, pWdaParams) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failure in Del STA WDI API, free all the memory status = %d", 
+                                                                status );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      delStaParam->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+void WDA_ProcessAddStaSelfRsp(WDI_AddSTASelfRspParamsType* pwdiAddSTASelfRsp, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tAddStaSelfParams *pAddStaSelfRsp = NULL; 
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pAddStaSelfRsp = (tAddStaSelfParams*)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams);
+
+   pAddStaSelfRsp->status = CONVERT_WDI2SIR_STATUS(pwdiAddSTASelfRsp->wdiStatus);
+   vos_mem_copy(pAddStaSelfRsp->selfMacAddr, 
+                pwdiAddSTASelfRsp->macSelfSta, 
+                sizeof(pAddStaSelfRsp->selfMacAddr));
+
+   WDA_SendMsg( pWDA, WDA_ADD_STA_SELF_RSP, (void *)pAddStaSelfRsp, 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessAddStaSelfReq
+ * 
+ */ 
+VOS_STATUS WDA_ProcessAddStaSelfReq( tWDA_CbContext *pWDA, tpAddStaSelfParams pAddStaSelfReq)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_AddSTASelfReqParamsType *wdiAddStaSelfReq = 
+      (WDI_AddSTASelfReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_AddSTASelfReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+   if( NULL == wdiAddStaSelfReq )
+   {
+      VOS_ASSERT( 0 );
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: Unable to allocate memory " ,__FUNCTION__);
+      return( VOS_STATUS_E_NOMEM );
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+
+   if( NULL == pWdaParams )
+   {
+      VOS_ASSERT( 0 );
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: Unable to allocate memory " ,__FUNCTION__);
+      vos_mem_free(wdiAddStaSelfReq) ;
+      return( VOS_STATUS_E_NOMEM );
+   }
+
+   wdiAddStaSelfReq->wdiReqStatusCB = NULL;
+
+   vos_mem_copy( wdiAddStaSelfReq->wdiAddSTASelfInfo.selfMacAddr, pAddStaSelfReq->selfMacAddr, 6);
+   /* Store Init Req pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pAddStaSelfReq;
+   pWdaParams->wdaWdiApiMsgParam = wdiAddStaSelfReq; 
+
+   status = WDI_AddSTASelfReq( wdiAddStaSelfReq, WDA_ProcessAddStaSelfRsp, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failure in Add Self Sta Request API, free all the memory status = %d", 
+                                                                status );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      pAddStaSelfReq->status = eSIR_FAILURE ;
+      WDA_SendMsg( pWDA, WDA_ADD_STA_SELF_RSP, (void *)pAddStaSelfReq, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_DelSTASelfRespCallback
+ * 
+ */ 
+void WDA_DelSTASelfRespCallback(WDI_DelSTASelfRspParamsType *
+                                      wdiDelStaSelfRspParams , void* pUserData)
+{
+   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext        *pWDA; 
+   tDelStaSelfParams     *delStaSelfParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if (NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: Invalid pWdaParams pointer", __FUNCTION__);
+      VOS_ASSERT(0);
+      return;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   delStaSelfParams = (tDelStaSelfParams *)pWdaParams->wdaMsgParam;
+
+   delStaSelfParams->status = 
+               CONVERT_WDI2SIR_STATUS(wdiDelStaSelfRspParams->wdiStatus) ;
+   
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+   
+   WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)delStaSelfParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_DelSTASelfReqCallback
+ * 
+ */
+void WDA_DelSTASelfReqCallback(WDI_Status   wdiStatus,
+                                void*        pUserData)
+{
+   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext        *pWDA; 
+   tDelStaSelfParams     *delStaSelfParams;
+   
+   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "<------ %s, wdiStatus: %d pWdaParams: 0x%x",
+              __FUNCTION__, wdiStatus, pWdaParams); 
+
+   if (NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: Invalid pWdaParams pointer", __FUNCTION__);
+      VOS_ASSERT(0);
+      return;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   delStaSelfParams = (tDelStaSelfParams *)pWdaParams->wdaMsgParam;
+
+   delStaSelfParams->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
+
+   if(IS_WDI_STATUS_FAILURE(wdiStatus))
+   {
+         VOS_ASSERT(0);
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+         vos_mem_free(pWdaParams) ;
+         WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)delStaSelfParams , 0) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_DelSTASelfReq
+ * Trigger Config STA processing in WDI
+ */ 
+VOS_STATUS WDA_ProcessDelSTASelfReq(tWDA_CbContext *pWDA, 
+                                    tDelStaSelfParams* pDelStaSelfReqParam)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   tWDA_ReqParams *pWdaParams = NULL; 
+   WDI_DelSTASelfReqParamsType *wdiDelStaSelfReq = 
+                (WDI_DelSTASelfReqParamsType *)vos_mem_malloc(
+                              sizeof(WDI_DelSTASelfReqParamsType)) ;
+
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+   if( NULL == wdiDelStaSelfReq )
+   {
+      VOS_ASSERT( 0 );
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: Unable to allocate memory " ,__FUNCTION__);
+      return( VOS_STATUS_E_NOMEM );
+   }
+   
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if( NULL == pWdaParams )
+   {
+      VOS_ASSERT( 0 );
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "%s: Unable to allocate memory " ,__FUNCTION__);
+      vos_mem_free(wdiDelStaSelfReq) ;
+      return( VOS_STATUS_E_NOMEM );
+   }
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pDelStaSelfReqParam;
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelStaSelfReq;
+
+   vos_mem_copy( wdiDelStaSelfReq->wdiDelStaSelfInfo.selfMacAddr, 
+                 pDelStaSelfReqParam->selfMacAddr, sizeof(tSirMacAddr));
+   
+    wdiDelStaSelfReq->wdiReqStatusCB = WDA_DelSTASelfReqCallback;
+    wdiDelStaSelfReq->pUserData = pWdaParams;
+
+   status = WDI_DelSTASelfReq(wdiDelStaSelfReq, 
+                      (WDI_DelSTASelfRspCb)WDA_DelSTASelfRespCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+              "Failure in Del Sta Self REQ WDI API, free all the memory " );
+      VOS_ASSERT(0);
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      pDelStaSelfReqParam->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)pDelStaSelfReqParam, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+
+
+/*
+ * FUNCTION: WDA_SendMsg
+ * Send Message back to PE
+ */ 
+void WDA_SendMsg(tWDA_CbContext *pWDA, tANI_U16 msgType, 
+                                        void *pBodyptr, tANI_U32 bodyVal)
+{
+   tSirMsgQ msg = {0} ;
+   tANI_U32 status = VOS_STATUS_SUCCESS ;
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+
+   msg.type        = msgType;
+   msg.bodyval     = bodyVal;
+   msg.bodyptr     = pBodyptr;
+
+   status = limPostMsgApi(pMac, &msg);
+
+   if (VOS_STATUS_SUCCESS != status)
+   {
+      if(NULL != pBodyptr)
+      {
+         vos_mem_free(pBodyptr);
+      }
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                      "%s: limPostMsgApi is failed " ,__FUNCTION__);
+      VOS_ASSERT(0) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateBSSParams
+ * Translated WDA/PE BSS info into WDI BSS info..
+ */
+void WDA_UpdateBSSParams(tWDA_CbContext *pWDA, 
+                         WDI_ConfigBSSReqInfoType *wdiBssParams, 
+                         tAddBssParams *wdaBssParams)
+{
+   v_U8_t keyIndex = 0;
+
+   /* copy bssReq Params to WDI structure */
+   vos_mem_copy(wdiBssParams->macBSSID,
+                           wdaBssParams->bssId, sizeof(tSirMacAddr)) ;
+   vos_mem_copy(wdiBssParams->macSelfAddr, wdaBssParams->selfMacAddr,
+                                                   sizeof(tSirMacAddr)) ;
+   wdiBssParams->wdiBSSType = wdaBssParams->bssType ;
+   wdiBssParams->ucOperMode = wdaBssParams->operMode ;
+   wdiBssParams->wdiNWType   = wdaBssParams->nwType ;
+
+   wdiBssParams->ucShortSlotTimeSupported = 
+                                  wdaBssParams->shortSlotTimeSupported ;
+
+   wdiBssParams->ucllaCoexist  = wdaBssParams->llaCoexist ;
+   wdiBssParams->ucllbCoexist  = wdaBssParams->llbCoexist ;
+   wdiBssParams->ucllgCoexist  = wdaBssParams->llgCoexist ;
+   wdiBssParams->ucHT20Coexist = wdaBssParams->ht20Coexist ;
+   wdiBssParams->ucObssProtEnabled = wdaBssParams->obssProtEnabled ;
+
+   wdiBssParams->ucllnNonGFCoexist = wdaBssParams->llnNonGFCoexist ;
+   wdiBssParams->ucTXOPProtectionFullSupport =
+                           wdaBssParams->fLsigTXOPProtectionFullSupport ;
+
+   wdiBssParams->ucRIFSMode = wdaBssParams->fRIFSMode ;
+   wdiBssParams->usBeaconInterval = wdaBssParams->beaconInterval ;
+
+   wdiBssParams->ucDTIMPeriod = wdaBssParams->dtimPeriod ;
+
+   wdiBssParams->ucTXChannelWidthSet = wdaBssParams->txChannelWidthSet ;
+   wdiBssParams->ucCurrentOperChannel = wdaBssParams->currentOperChannel ;
+   wdiBssParams->ucCurrentExtChannel = wdaBssParams->currentExtChannel ;
+   wdiBssParams->bHiddenSSIDEn = wdaBssParams->bHiddenSSIDEn ;
+
+   /* copy SSID into WDI structure */
+   wdiBssParams->wdiSSID.ucLength = wdaBssParams->ssId.length ;
+   vos_mem_copy(wdiBssParams->wdiSSID.sSSID,
+                 wdaBssParams->ssId.ssId, wdaBssParams->ssId.length) ;
+
+   WDA_UpdateSTAParams(pWDA, &wdiBssParams->wdiSTAContext, 
+                       &wdaBssParams->staContext) ;
+
+   wdiBssParams->wdiAction = wdaBssParams->updateBss;
+
+#ifdef WLAN_FEATURE_VOWIFI
+   wdiBssParams->cMaxTxPower = wdaBssParams->maxTxPower;
+#endif
+
+   wdiBssParams->ucPersona = wdaBssParams->halPersona;
+
+   wdiBssParams->bSpectrumMgtEn = wdaBssParams->bSpectrumMgtEnabled;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+   wdiBssParams->bExtSetStaKeyParamValid = wdaBssParams->extSetStaKeyParamValid;
+
+   if(wdiBssParams->bExtSetStaKeyParamValid)
+   {
+      /* copy set STA key params to WDI structure */
+      wdiBssParams->wdiExtSetKeyParam.ucSTAIdx = 
+         wdaBssParams->extSetStaKeyParam.staIdx;
+      wdiBssParams->wdiExtSetKeyParam.wdiEncType = 
+         wdaBssParams->extSetStaKeyParam.encType;
+      wdiBssParams->wdiExtSetKeyParam.wdiWEPType = 
+         wdaBssParams->extSetStaKeyParam.wepType;
+      wdiBssParams->wdiExtSetKeyParam.ucDefWEPIdx = 
+         wdaBssParams->extSetStaKeyParam.defWEPIdx;
+
+      if(wdaBssParams->extSetStaKeyParam.encType != eSIR_ED_NONE)
+      {
+         if( (wdiBssParams->wdiExtSetKeyParam.wdiWEPType == eSIR_WEP_STATIC) && 
+             (WDA_INVALID_KEY_INDEX == wdaBssParams->extSetStaKeyParam.defWEPIdx) &&
+             (eSYSTEM_AP_ROLE != pWDA->wdaGlobalSystemRole))
+         {
+            WDA_GetWepKeysFromCfg( pWDA, 
+                                   &wdiBssParams->wdiExtSetKeyParam.ucDefWEPIdx, 
+                                   &wdiBssParams->wdiExtSetKeyParam.ucNumKeys,
+                                   wdiBssParams->wdiExtSetKeyParam.wdiKey );
+         }
+         else
+         {
+#ifdef WLAN_SOFTAP_FEATURE
+            for( keyIndex=0; keyIndex < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; 
+                                                                  keyIndex++)
+            {
+               wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyId =
+                  wdaBssParams->extSetStaKeyParam.key[keyIndex].keyId;
+               wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].unicast =
+                  wdaBssParams->extSetStaKeyParam.key[keyIndex].unicast;
+               wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyDirection =
+                  wdaBssParams->extSetStaKeyParam.key[keyIndex].keyDirection;
+
+               vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc, 
+                            wdaBssParams->extSetStaKeyParam.key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
+               wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].paeRole =
+                  wdaBssParams->extSetStaKeyParam.key[keyIndex].paeRole;
+               wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyLength =
+                  wdaBssParams->extSetStaKeyParam.key[keyIndex].keyLength;
+               vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].key, 
+                            wdaBssParams->extSetStaKeyParam.key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
+            }
+
+            wdiBssParams->wdiExtSetKeyParam.ucNumKeys = 
+               SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+#else
+            wdiBssParams->wdiExtSetKeyParam.wdiKey[0].keyId =
+               wdaBssParams->extSetStaKeyParam.key.keyId;
+            wdiBssParams->wdiExtSetKeyParam.wdiKey[0].unicast = 
+               wdaBssParams->extSetStaKeyParam.key.unicast;
+            wdiBssParams->wdiExtSetKeyParam.wdiKey[0].keyDirection =
+               wdaBssParams->extSetStaKeyParam.key.keyDirection;
+            vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[0].keyRsc, 
+                         wdaBssParams->extSetStaKeyParam.key.keyRsc, WLAN_MAX_KEY_RSC_LEN);
+            wdiBssParams->wdiExtSetKeyParam.wdiKey[0].paeRole =
+               wdaBssParams->extSetStaKeyParam.key.paeRole;
+            wdiBssParams->wdiExtSetKeyParam.wdiKey[0].keyLength =
+               wdaBssParams->extSetStaKeyParam.key.keyLength;
+            vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[0].key, 
+                         wdaBssParams->extSetStaKeyParam.key[keyIndex].key, 
+                         SIR_MAC_MAX_KEY_LENGTH);
+            wdiBssParams->wdiExtSetKeyParam.ucNumKeys = 1;
+#endif
+         }
+      }
+      wdiBssParams->wdiExtSetKeyParam.ucSingleTidRc = wdaBssParams->extSetStaKeyParam.singleTidRc;
+   }
+   else /* wdaBssParams->bExtSetStaKeyParamValid is not valid */
+   {
+      vos_mem_zero( &wdaBssParams->extSetStaKeyParam, 
+                    sizeof(wdaBssParams->extSetStaKeyParam) );
+   }
+#endif /*WLAN_FEATURE_VOWIFI_11R*/
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateSTAParams
+ * Translated WDA/PE BSS info into WDI BSS info..
+ */
+void WDA_UpdateSTAParams(tWDA_CbContext *pWDA, 
+                               WDI_ConfigStaReqInfoType *wdiStaParams, 
+                                                tAddStaParams *wdaStaParams)
+{
+   tANI_U8 i = 0;
+   /* Update STA params */
+   vos_mem_copy(wdiStaParams->macBSSID, wdaStaParams->bssId, 
+                                            sizeof(tSirMacAddr)) ;
+   wdiStaParams->usAssocId = wdaStaParams->assocId;
+   wdiStaParams->wdiSTAType = wdaStaParams->staType;
+   
+   wdiStaParams->ucShortPreambleSupported = 
+                                        wdaStaParams->shortPreambleSupported;
+   vos_mem_copy(wdiStaParams->macSTA, wdaStaParams->staMac, 
+                                               sizeof(tSirMacAddr)) ;
+   wdiStaParams->usListenInterval = wdaStaParams->listenInterval;
+   
+   wdiStaParams->ucWMMEnabled = wdaStaParams->wmmEnabled;
+   
+   wdiStaParams->ucHTCapable = wdaStaParams->htCapable;
+   wdiStaParams->ucTXChannelWidthSet = wdaStaParams->txChannelWidthSet;
+   wdiStaParams->ucRIFSMode = wdaStaParams->rifsMode;
+   wdiStaParams->ucLSIGTxopProtection = wdaStaParams->lsigTxopProtection;
+   wdiStaParams->ucMaxAmpduSize = wdaStaParams->maxAmpduSize;
+   wdiStaParams->ucMaxAmpduDensity = wdaStaParams->maxAmpduDensity;
+   wdiStaParams->ucMaxAmsduSize = wdaStaParams->maxAmsduSize;
+   
+   wdiStaParams->ucShortGI40Mhz = wdaStaParams->fShortGI40Mhz;
+   wdiStaParams->ucShortGI20Mhz = wdaStaParams->fShortGI20Mhz;
+
+   wdiStaParams->wdiSupportedRates.opRateMode = 
+                                wdaStaParams->supportedRates.opRateMode;
+
+   for(i = 0;i < WDI_NUM_11B_RATES;i++)
+   {
+     wdiStaParams->wdiSupportedRates.llbRates[i] = 
+                               wdaStaParams->supportedRates.llbRates[i];
+   }
+   for(i = 0;i < WDI_NUM_11A_RATES;i++)
+   {
+     wdiStaParams->wdiSupportedRates.llaRates[i] = 
+                               wdaStaParams->supportedRates.llaRates[i];
+   }
+   for(i = 0;i < SIR_NUM_POLARIS_RATES;i++)
+   {
+     wdiStaParams->wdiSupportedRates.aLegacyRates[i] = 
+                               wdaStaParams->supportedRates.aniLegacyRates[i];
+   }
+   wdiStaParams->wdiSupportedRates.uEnhancedRateBitmap = 
+                            wdaStaParams->supportedRates.aniEnhancedRateBitmap;
+   for(i = 0;i <SIR_MAC_MAX_SUPPORTED_MCS_SET;i++)
+   {
+     wdiStaParams->wdiSupportedRates.aSupportedMCSSet[i] = 
+                               wdaStaParams->supportedRates.supportedMCSSet[i];
+   }
+   wdiStaParams->wdiSupportedRates.aRxHighestDataRate = 
+                           wdaStaParams->supportedRates.rxHighestDataRate;
+   
+   wdiStaParams->ucRMFEnabled = wdaStaParams->rmfEnabled;
+   
+   wdiStaParams->wdiAction = wdaStaParams->updateSta; 
+   
+   wdiStaParams->ucAPSD = wdaStaParams->uAPSD;
+   wdiStaParams->ucMaxSPLen = wdaStaParams->maxSPLen;
+   wdiStaParams->ucGreenFieldCapable = wdaStaParams->greenFieldCapable;
+   
+   wdiStaParams->ucDelayedBASupport = wdaStaParams->delBASupport;
+   wdiStaParams->us32MaxAmpduDuratio = wdaStaParams->us32MaxAmpduDuration;
+   wdiStaParams->ucDsssCckMode40Mhz = wdaStaParams->fDsssCckMode40Mhz;
+   wdiStaParams->ucEncryptType = wdaStaParams->encryptType;
+#ifdef WLAN_FEATURE_P2P
+   wdiStaParams->ucP2pCapableSta = wdaStaParams->p2pCapableSta;
+#endif
+   return ;
+}
+
+/*
+ * -------------------------------------------------------------------------
+ * CFG update to WDI
+ * ------------------------------------------------------------------------- 
+ */
+ 
+ /*
+ * FUNCTION: WDA_ConvertWniCfgIdToHALCfgId
+ * Convert the WNI CFG ID to HAL CFG ID
+ */ 
+static inline v_U8_t WDA_ConvertWniCfgIdToHALCfgId(v_U8_t wniCfgId)
+{
+   switch(wniCfgId)
+   {
+      case WNI_CFG_STA_ID:
+         return QWLAN_HAL_CFG_STA_ID;
+      case WNI_CFG_CURRENT_TX_ANTENNA:
+         return QWLAN_HAL_CFG_CURRENT_TX_ANTENNA;
+      case WNI_CFG_CURRENT_RX_ANTENNA:
+         return QWLAN_HAL_CFG_CURRENT_RX_ANTENNA;
+      case WNI_CFG_LOW_GAIN_OVERRIDE:
+         return QWLAN_HAL_CFG_LOW_GAIN_OVERRIDE;
+      case WNI_CFG_POWER_STATE_PER_CHAIN:
+         return QWLAN_HAL_CFG_POWER_STATE_PER_CHAIN;
+      case WNI_CFG_CAL_PERIOD:
+         return QWLAN_HAL_CFG_CAL_PERIOD;
+      case WNI_CFG_CAL_CONTROL:
+         return QWLAN_HAL_CFG_CAL_CONTROL;
+      case WNI_CFG_PROXIMITY:
+         return QWLAN_HAL_CFG_PROXIMITY;
+      case WNI_CFG_NETWORK_DENSITY:
+         return QWLAN_HAL_CFG_NETWORK_DENSITY;
+      case WNI_CFG_MAX_MEDIUM_TIME:
+         return QWLAN_HAL_CFG_MAX_MEDIUM_TIME;
+      case WNI_CFG_MAX_MPDUS_IN_AMPDU:
+         return QWLAN_HAL_CFG_MAX_MPDUS_IN_AMPDU;
+      case WNI_CFG_RTS_THRESHOLD:
+         return QWLAN_HAL_CFG_RTS_THRESHOLD;
+      case WNI_CFG_SHORT_RETRY_LIMIT:
+         return QWLAN_HAL_CFG_SHORT_RETRY_LIMIT;
+      case WNI_CFG_LONG_RETRY_LIMIT:
+         return QWLAN_HAL_CFG_LONG_RETRY_LIMIT;
+      case WNI_CFG_FRAGMENTATION_THRESHOLD:
+         return QWLAN_HAL_CFG_FRAGMENTATION_THRESHOLD;
+      case WNI_CFG_DYNAMIC_THRESHOLD_ZERO:
+         return QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ZERO;
+      case WNI_CFG_DYNAMIC_THRESHOLD_ONE:
+         return QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ONE;
+      case WNI_CFG_DYNAMIC_THRESHOLD_TWO:
+         return QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_TWO;
+      case WNI_CFG_FIXED_RATE:
+         return QWLAN_HAL_CFG_FIXED_RATE;
+      case WNI_CFG_RETRYRATE_POLICY:
+         return QWLAN_HAL_CFG_RETRYRATE_POLICY;
+      case WNI_CFG_RETRYRATE_SECONDARY:
+         return QWLAN_HAL_CFG_RETRYRATE_SECONDARY;
+      case WNI_CFG_RETRYRATE_TERTIARY:
+         return QWLAN_HAL_CFG_RETRYRATE_TERTIARY;
+      case WNI_CFG_FORCE_POLICY_PROTECTION:
+         return QWLAN_HAL_CFG_FORCE_POLICY_PROTECTION;
+      case WNI_CFG_FIXED_RATE_MULTICAST_24GHZ:
+         return QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ;
+      case WNI_CFG_FIXED_RATE_MULTICAST_5GHZ:
+         return QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ;
+      case WNI_CFG_DEFAULT_RATE_INDEX_24GHZ:
+         return QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_24GHZ;
+      case WNI_CFG_DEFAULT_RATE_INDEX_5GHZ:
+         return QWLAN_HAL_CFG_DEFAULT_RATE_INDEX_5GHZ;
+      case WNI_CFG_MAX_BA_SESSIONS:
+         return QWLAN_HAL_CFG_MAX_BA_SESSIONS;
+      case WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT:
+         return QWLAN_HAL_CFG_PS_DATA_INACTIVITY_TIMEOUT;
+      case WNI_CFG_PS_ENABLE_BCN_FILTER:
+         return QWLAN_HAL_CFG_PS_ENABLE_BCN_FILTER;
+      case WNI_CFG_PS_ENABLE_RSSI_MONITOR:
+         return QWLAN_HAL_CFG_PS_ENABLE_RSSI_MONITOR;
+      case WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE:
+         return QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE;
+      case WNI_CFG_STATS_PERIOD:
+         return QWLAN_HAL_CFG_STATS_PERIOD;
+      case WNI_CFG_CFP_MAX_DURATION:
+         return QWLAN_HAL_CFG_CFP_MAX_DURATION;
+#if 0 /*This is not part of CFG*/
+      case WNI_CFG_FRAME_TRANS_ENABLED:
+         return QWLAN_HAL_CFG_FRAME_TRANS_ENABLED;
+#endif
+      case WNI_CFG_DTIM_PERIOD:
+         return QWLAN_HAL_CFG_DTIM_PERIOD;
+      case WNI_CFG_EDCA_WME_ACBK:
+         return QWLAN_HAL_CFG_EDCA_WMM_ACBK;
+      case WNI_CFG_EDCA_WME_ACBE:
+         return QWLAN_HAL_CFG_EDCA_WMM_ACBE;
+      case WNI_CFG_EDCA_WME_ACVI:
+         return QWLAN_HAL_CFG_EDCA_WMM_ACVI;
+      case WNI_CFG_EDCA_WME_ACVO:
+         return QWLAN_HAL_CFG_EDCA_WMM_ACVO;
+#if 0
+      case WNI_CFG_TELE_BCN_WAKEUP_EN:
+         return QWLAN_HAL_CFG_TELE_BCN_WAKEUP_EN;
+      case WNI_CFG_TELE_BCN_TRANS_LI:
+         return QWLAN_HAL_CFG_TELE_BCN_TRANS_LI;
+      case WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS:
+         return QWLAN_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS;
+      case WNI_CFG_TELE_BCN_MAX_LI:
+         return QWLAN_HAL_CFG_TELE_BCN_MAX_LI;
+      case WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS:
+         return QWLAN_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS;
+#endif
+      case WNI_CFG_ENABLE_CLOSE_LOOP:
+         return QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP;
+      default:
+      {
+         VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "There is no HAL CFG Id corresponding to WNI CFG Id: %d\n",
+                       wniCfgId);
+         return VOS_STATUS_E_INVAL;
+      }
+   }
+}
+
+/*
+ * FUNCTION: WDA_UpdateCfgCallback
+ * 
+ */ 
+void WDA_UpdateCfgCallback(WDI_Status   wdiStatus, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+   WDI_UpdateCfgReqParamsType *wdiCfgParam = 
+                  (WDI_UpdateCfgReqParamsType *)pWDA->wdaWdiCfgApiMsgParam ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   /*
+    * currently there is no response message is expected between PE and
+    * WDA, Failure return from WDI is a ASSERT condition
+    */
+   if(WDI_STATUS_SUCCESS != wdiStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: CFG (%d) config failure \n", __FUNCTION__, 
+              ((tHalCfg *)(wdiCfgParam->pConfigBuffer))->type);
+   }
+   
+   vos_mem_free(wdiCfgParam->pConfigBuffer) ;
+   vos_mem_free(pWDA->wdaWdiCfgApiMsgParam) ;
+   pWDA->wdaWdiCfgApiMsgParam = NULL;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateCfg
+ * 
+ */ 
+VOS_STATUS WDA_UpdateCfg(tWDA_CbContext *pWDA, tSirMsgQ *cfgParam)
+{
+   
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   tANI_U32 val =0;
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+   tHalCfg *configData;
+   WDI_UpdateCfgReqParamsType *wdiCfgReqParam = NULL ;
+   tANI_U8        *configDataValue;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if (NULL == pMac )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid MAC context ", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if(WDA_START_STATE != pWDA->wdaState)
+   {
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   if(NULL != pWDA->wdaWdiCfgApiMsgParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiCfgApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   wdiCfgReqParam = (WDI_UpdateCfgReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_UpdateCfgReqParamsType)) ;
+
+   if(NULL == wdiCfgReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiCfgReqParam->pConfigBuffer =  vos_mem_malloc(sizeof(tHalCfg) + 
+                                                            sizeof(tANI_U32)) ;
+
+   if(NULL == wdiCfgReqParam->pConfigBuffer)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                             "%s: VOS MEM Alloc Failure \n", __FUNCTION__);
+      vos_mem_free(wdiCfgReqParam);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   
+   /*convert the WNI CFG Id to HAL CFG Id*/
+   ((tHalCfg *)wdiCfgReqParam->pConfigBuffer)->type =
+                             WDA_ConvertWniCfgIdToHALCfgId(cfgParam->bodyval);
+   
+   /*TODO: revisit this for handling string parameters */
+   if (wlan_cfgGetInt(pMac, (tANI_U16) cfgParam->bodyval, 
+                                                      &val) != eSIR_SUCCESS)
+   {
+       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                              "Failed to cfg get id %d\n", cfgParam->bodyval);
+       vos_mem_free(wdiCfgReqParam->pConfigBuffer);
+       vos_mem_free(wdiCfgReqParam);
+       return eSIR_FAILURE;
+   }
+
+   ((tHalCfg *)wdiCfgReqParam->pConfigBuffer)->length = sizeof(tANI_U32);
+   configData =((tHalCfg *)wdiCfgReqParam->pConfigBuffer) ;
+   configDataValue = ((tANI_U8 *)configData + sizeof(tHalCfg));
+   vos_mem_copy( configDataValue, &val, sizeof(tANI_U32));
+   wdiCfgReqParam->wdiReqStatusCB = NULL ;
+   
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiCfgApiMsgParam = (void *)wdiCfgReqParam ;
+
+#ifdef FEATURE_HAL_SUPPORT_DYNAMIC_UPDATE_CFG
+   status = WDI_UpdateCfgReq(wdiCfgReqParam, 
+                   (WDI_UpdateCfgRspCb )WDA_UpdateCfgCallback, pWDA) ;
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Update CFG WDI API, free all the memory " );
+      vos_mem_free(wdiCfgReqParam->pConfigBuffer) ;
+      vos_mem_free(pWDA->wdaWdiCfgApiMsgParam) ;
+      pWDA->wdaWdiCfgApiMsgParam = NULL;
+      /* Failure is not expected */
+      VOS_ASSERT(0) ;
+   }
+#else
+   vos_mem_free(wdiCfgReqParam->pConfigBuffer) ;
+   vos_mem_free(pWDA->wdaWdiCfgApiMsgParam) ;
+   pWDA->wdaWdiCfgApiMsgParam = NULL;
+#endif
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+
+VOS_STATUS WDA_GetWepKeysFromCfg( tWDA_CbContext *pWDA, 
+                                                      v_U8_t *pDefaultKeyId,
+                                                      v_U8_t *pNumKeys,
+                                                      WDI_KeysType *pWdiKeys )
+{
+   v_U32_t i, j, defKeyId = 0;
+   v_U32_t val = SIR_MAC_KEY_LENGTH;
+   VOS_STATUS status = WDI_STATUS_SUCCESS;
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+
+   if (NULL == pMac )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Invoked with invalid MAC context ", __FUNCTION__ );
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_WEP_DEFAULT_KEYID,
+                                                                    &defKeyId ))
+   {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "Unable to retrieve defaultKeyId from CFG. Defaulting to 0...");
+   }
+   
+  *pDefaultKeyId = (v_U8_t)defKeyId;
+
+   /* Need to extract ALL of the configured WEP Keys */
+   for( i = 0, j = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++ )
+   {
+      val = SIR_MAC_KEY_LENGTH;
+      if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, 
+                                     (v_U16_t) (WNI_CFG_WEP_DEFAULT_KEY_1 + i),
+                                     pWdiKeys[j].key,
+                                     &val ))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                            "WEP Key index [%d] may not configured in CFG\n",i);
+      }
+      else
+      {
+         pWdiKeys[j].keyId = (tANI_U8) i;
+         /* 
+         * Actually, a DC (Don't Care) because
+         * this is determined (and set) by PE/MLME
+         */
+         pWdiKeys[j].unicast = 0;
+         /*
+         *  Another DC (Don't Care)
+         */
+         pWdiKeys[j].keyDirection = eSIR_TX_RX;
+         /* Another DC (Don't Care). Unused for WEP */
+         pWdiKeys[j].paeRole = 0;
+         /* Determined from wlan_cfgGetStr() above.*/
+         pWdiKeys[j].keyLength = (tANI_U16) val;
+
+         j++;
+         *pNumKeys = (tANI_U8) j;
+      }
+   }
+
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_SetBssKeyReqCallback
+ * send SET BSS key RSP back to PE
+ */ 
+void WDA_SetBssKeyReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tSetBssKeyParams *setBssKeyParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   setBssKeyParams = (tSetBssKeyParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+   setBssKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_SET_BSSKEY_RSP, (void *)setBssKeyParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetBssKeyReq
+ * Request to WDI for programming the BSS key( key for 
+ * broadcast/multicast frames Encryption)
+ */ 
+VOS_STATUS WDA_ProcessSetBssKeyReq(tWDA_CbContext *pWDA, 
+                                          tSetBssKeyParams *setBssKeyParams )
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SetBSSKeyReqParamsType *wdiSetBssKeyParam = 
+                  (WDI_SetBSSKeyReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_SetBSSKeyReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   v_U8_t keyIndex;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSetBssKeyParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetBssKeyParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_zero(wdiSetBssKeyParam, sizeof(WDI_SetBSSKeyReqParamsType));
+
+   /* copy set BSS params to WDI structure */
+   wdiSetBssKeyParam->wdiBSSKeyInfo.ucBssIdx = setBssKeyParams->bssIdx;
+   wdiSetBssKeyParam->wdiBSSKeyInfo.wdiEncType = setBssKeyParams->encType;
+   wdiSetBssKeyParam->wdiBSSKeyInfo.ucNumKeys = setBssKeyParams->numKeys;
+
+   if(setBssKeyParams->encType != eSIR_ED_NONE)
+   {
+      if( setBssKeyParams->numKeys == 0 && 
+         (( setBssKeyParams->encType == eSIR_ED_WEP40)|| 
+                                setBssKeyParams->encType == eSIR_ED_WEP104))
+      {
+         tANI_U8 defaultKeyId = 0;
+
+         WDA_GetWepKeysFromCfg( pWDA, &defaultKeyId, 
+            &wdiSetBssKeyParam->wdiBSSKeyInfo.ucNumKeys,
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys );
+      }
+      else
+      {
+         for( keyIndex=0; keyIndex < setBssKeyParams->numKeys; keyIndex++)
+         {
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].keyId =
+                                 setBssKeyParams->key[keyIndex].keyId;
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].unicast =
+                                 setBssKeyParams->key[keyIndex].unicast;
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].keyDirection =
+                                 setBssKeyParams->key[keyIndex].keyDirection;
+            vos_mem_copy(wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc, 
+                  setBssKeyParams->key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].paeRole =
+                                      setBssKeyParams->key[keyIndex].paeRole;
+            wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].keyLength =
+                                      setBssKeyParams->key[keyIndex].keyLength;
+            vos_mem_copy(wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys[keyIndex].key, 
+                                          setBssKeyParams->key[keyIndex].key, 
+                                          SIR_MAC_MAX_KEY_LENGTH);
+         }
+      }
+   }
+
+   wdiSetBssKeyParam->wdiBSSKeyInfo.ucSingleTidRc = 
+                                      setBssKeyParams->singleTidRc;
+   wdiSetBssKeyParam->wdiReqStatusCB = NULL ;
+
+   /* Store set key pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = setBssKeyParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiSetBssKeyParam;
+
+   status = WDI_SetBSSKeyReq(wdiSetBssKeyParam, 
+                           (WDI_SetBSSKeyRspCb)WDA_SetBssKeyReqCallback ,pWdaParams);
+   
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Set BSS Key Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      setBssKeyParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_SET_BSSKEY_RSP, (void *)setBssKeyParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_RemoveBssKeyReqCallback
+ * send SET BSS key RSP back to PE
+ */ 
+void WDA_RemoveBssKeyReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tRemoveBssKeyParams *removeBssKeyParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   removeBssKeyParams = (tRemoveBssKeyParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+   
+   removeBssKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_REMOVE_BSSKEY_RSP, (void *)removeBssKeyParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessRemoveBssKeyReq
+ * Request to WDI to remove the BSS key( key for broadcast/multicast 
+ * frames Encryption)
+ */ 
+VOS_STATUS WDA_ProcessRemoveBssKeyReq(tWDA_CbContext *pWDA, 
+                                       tRemoveBssKeyParams *removeBssKeyParams )
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_RemoveBSSKeyReqParamsType *wdiRemoveBssKeyParam = 
+                  (WDI_RemoveBSSKeyReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_RemoveBSSKeyReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiRemoveBssKeyParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiRemoveBssKeyParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* copy Remove BSS key params to WDI structure*/
+   wdiRemoveBssKeyParam->wdiKeyInfo.ucBssIdx = removeBssKeyParams->bssIdx;
+   wdiRemoveBssKeyParam->wdiKeyInfo.wdiEncType = removeBssKeyParams->encType;
+   wdiRemoveBssKeyParam->wdiKeyInfo.ucKeyId = removeBssKeyParams->keyId;
+   wdiRemoveBssKeyParam->wdiKeyInfo.wdiWEPType = removeBssKeyParams->wepType;
+   wdiRemoveBssKeyParam->wdiReqStatusCB = NULL ;
+
+   /* Store remove key pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = removeBssKeyParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiRemoveBssKeyParam;
+
+   status = WDI_RemoveBSSKeyReq(wdiRemoveBssKeyParam, 
+                     (WDI_RemoveBSSKeyRspCb)WDA_RemoveBssKeyReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Remove BSS Key Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      removeBssKeyParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_REMOVE_BSSKEY_RSP, (void *)removeBssKeyParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_SetBssKeyReqCallback
+ * send SET BSS key RSP back to PE
+ */ 
+void WDA_SetStaKeyReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tSetStaKeyParams *setStaKeyParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR
+                ,"%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   setStaKeyParams = (tSetStaKeyParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   setStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_SET_STAKEY_RSP, (void *)setStaKeyParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetStaKeyReq
+ * Request to WDI for programming the STA key( key for Unicast frames 
+ * Encryption)
+ */
+VOS_STATUS WDA_ProcessSetStaKeyReq(tWDA_CbContext *pWDA, 
+                                          tSetStaKeyParams *setStaKeyParams )
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SetSTAKeyReqParamsType *wdiSetStaKeyParam = 
+                  (WDI_SetSTAKeyReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_SetSTAKeyReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   v_U8_t keyIndex;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSetStaKeyParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetStaKeyParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_set(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType), 0);
+
+   vos_mem_zero(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType));
+
+   /* copy set STA key params to WDI structure */
+   wdiSetStaKeyParam->wdiKeyInfo.ucSTAIdx = setStaKeyParams->staIdx;
+   wdiSetStaKeyParam->wdiKeyInfo.wdiEncType = setStaKeyParams->encType;
+   wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType = setStaKeyParams->wepType;
+   wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = setStaKeyParams->defWEPIdx;
+
+   if(setStaKeyParams->encType != eSIR_ED_NONE)
+   {
+      if( (wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType == eSIR_WEP_STATIC) && 
+                    (WDA_INVALID_KEY_INDEX == setStaKeyParams->defWEPIdx) &&
+                    (eSYSTEM_AP_ROLE != pWDA->wdaGlobalSystemRole))
+      {
+         WDA_GetWepKeysFromCfg( pWDA, 
+            &wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx, 
+            &wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys,
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey );
+      }
+      else
+      {
+#ifdef WLAN_SOFTAP_FEATURE
+         for( keyIndex=0; keyIndex < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; 
+                                                                  keyIndex++)
+         {
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyId =
+                                  setStaKeyParams->key[keyIndex].keyId;
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].unicast =
+                                  setStaKeyParams->key[keyIndex].unicast;
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyDirection =
+                                  setStaKeyParams->key[keyIndex].keyDirection;
+
+            vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
+                  setStaKeyParams->key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].paeRole =
+                                   setStaKeyParams->key[keyIndex].paeRole;
+            wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyLength =
+                                   setStaKeyParams->key[keyIndex].keyLength;
+            vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].key, 
+                  setStaKeyParams->key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
+            /* set default index to index which have key direction as  WDI_TX_DEFAULT */
+            if (WDI_TX_DEFAULT == wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyDirection)
+            {
+                wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = keyIndex;
+            }
+         }
+
+         wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 
+                                          SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+#else
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyId =
+                                                setStaKeyParams->key.keyId;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].unicast = 
+                                                setStaKeyParams->key.unicast;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyDirection =
+                                             setStaKeyParams->key.keyDirection;
+         vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyRsc, 
+                           setStaKeyParams->key.keyRsc, WLAN_MAX_KEY_RSC_LEN);
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].paeRole =
+                                            setStaKeyParams->key.paeRole;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyLength =
+                                             setStaKeyParams->key.keyLength;
+         vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].key, 
+                          setStaKeyParams->key[keyIndex].key, 
+                                              SIR_MAC_MAX_KEY_LENGTH);
+         wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 1;
+#endif
+      }
+   }
+   wdiSetStaKeyParam->wdiKeyInfo.ucSingleTidRc = setStaKeyParams->singleTidRc;
+   wdiSetStaKeyParam->wdiReqStatusCB = NULL ;
+
+   /* Store set key pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = setStaKeyParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiSetStaKeyParam;
+
+   status = WDI_SetSTAKeyReq(wdiSetStaKeyParam, 
+                          (WDI_SetSTAKeyRspCb)WDA_SetStaKeyReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in set STA Key Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      setStaKeyParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_SET_STAKEY_RSP, (void *)setStaKeyParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_SetBcastStaKeyReqCallback
+ * send SET Bcast STA key RSP back to PE
+ */ 
+void WDA_SetBcastStaKeyReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tSetStaKeyParams *setStaKeyParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   setStaKeyParams = (tSetStaKeyParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   setStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_SET_STA_BCASTKEY_RSP, (void *)setStaKeyParams , 0) ;
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessSetBcastStaKeyReq
+ * Request to WDI for programming the Bcast STA key( key for Broadcast frames 
+ * Encryption)
+ */
+VOS_STATUS WDA_ProcessSetBcastStaKeyReq(tWDA_CbContext *pWDA, 
+                                          tSetStaKeyParams *setStaKeyParams )
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SetSTAKeyReqParamsType *wdiSetStaKeyParam = 
+                  (WDI_SetSTAKeyReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_SetSTAKeyReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   v_U8_t keyIndex;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSetStaKeyParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetStaKeyParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_set(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType), 0);
+
+   vos_mem_zero(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType));
+
+   /* copy set STA key params to WDI structure */
+   wdiSetStaKeyParam->wdiKeyInfo.ucSTAIdx = setStaKeyParams->staIdx;
+   wdiSetStaKeyParam->wdiKeyInfo.wdiEncType = setStaKeyParams->encType;
+   wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType = setStaKeyParams->wepType;
+   wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = setStaKeyParams->defWEPIdx;
+
+   if(setStaKeyParams->encType != eSIR_ED_NONE)
+   {
+#ifdef WLAN_SOFTAP_FEATURE
+      for( keyIndex=0; keyIndex < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; 
+                                                               keyIndex++)
+      {
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyId =
+                               setStaKeyParams->key[keyIndex].keyId;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].unicast =
+                               setStaKeyParams->key[keyIndex].unicast;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyDirection =
+                               setStaKeyParams->key[keyIndex].keyDirection;
+
+         vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
+               setStaKeyParams->key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].paeRole =
+                                setStaKeyParams->key[keyIndex].paeRole;
+         wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyLength =
+                                setStaKeyParams->key[keyIndex].keyLength;
+         vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].key, 
+               setStaKeyParams->key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
+      }
+
+      wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 
+                                       SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+#else
+      wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyId =
+                                             setStaKeyParams->key.keyId;
+      wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].unicast = 
+                                             setStaKeyParams->key.unicast;
+      wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyDirection =
+                                          setStaKeyParams->key.keyDirection;
+      vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyRsc, 
+                        setStaKeyParams->key.keyRsc, WLAN_MAX_KEY_RSC_LEN);
+      wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].paeRole =
+                                         setStaKeyParams->key.paeRole;
+      wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].keyLength =
+                                          setStaKeyParams->key.keyLength;
+      vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[0].key, 
+                       setStaKeyParams->key[keyIndex].key, 
+                                           SIR_MAC_MAX_KEY_LENGTH);
+      wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 1;
+#endif
+   }
+   wdiSetStaKeyParam->wdiKeyInfo.ucSingleTidRc = setStaKeyParams->singleTidRc;
+
+   /* Store set key pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = setStaKeyParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiSetStaKeyParam;
+
+   status = WDI_SetSTABcastKeyReq(wdiSetStaKeyParam, 
+                          (WDI_SetSTAKeyRspCb)WDA_SetBcastStaKeyReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+          "Failure in set BCAST STA Key Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      setStaKeyParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_SET_STA_BCASTKEY_RSP, (void *)setStaKeyParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_RemoveStaKeyReqCallback
+ * send SET BSS key RSP back to PE
+ */ 
+void WDA_RemoveStaKeyReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tRemoveStaKeyParams *removeStaKeyParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   removeStaKeyParams = (tRemoveStaKeyParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   removeStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_REMOVE_STAKEY_RSP, (void *)removeStaKeyParams , 0) ;
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessRemoveStaKeyReq
+ * Request to WDI to remove the STA key( key for Unicast frames Encryption)
+ */ 
+VOS_STATUS WDA_ProcessRemoveStaKeyReq(tWDA_CbContext *pWDA, 
+                                    tRemoveStaKeyParams *removeStaKeyParams )
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_RemoveSTAKeyReqParamsType *wdiRemoveStaKeyParam = 
+                  (WDI_RemoveSTAKeyReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_RemoveSTAKeyReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiRemoveStaKeyParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiRemoveStaKeyParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* copy remove STA key params to WDI structure*/
+   wdiRemoveStaKeyParam->wdiKeyInfo.ucSTAIdx = removeStaKeyParams->staIdx;
+   wdiRemoveStaKeyParam->wdiKeyInfo.wdiEncType = removeStaKeyParams->encType;
+   wdiRemoveStaKeyParam->wdiKeyInfo.ucKeyId = removeStaKeyParams->keyId;
+   wdiRemoveStaKeyParam->wdiKeyInfo.ucUnicast = removeStaKeyParams->unicast;
+   wdiRemoveStaKeyParam->wdiReqStatusCB = NULL ;
+
+   /* Store remove key pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = removeStaKeyParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiRemoveStaKeyParam;
+
+   status = WDI_RemoveSTAKeyReq(wdiRemoveStaKeyParam, 
+                     (WDI_RemoveSTAKeyRspCb)WDA_RemoveStaKeyReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "Failure in remove STA Key Req WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      removeStaKeyParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_REMOVE_STAKEY_RSP, (void *)removeStaKeyParams, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_IsHandleSetLinkStateReq
+ * Update the WDA state and return the status to handle this message or not
+ */ 
+
+WDA_processSetLinkStateStatus WDA_IsHandleSetLinkStateReq(
+                                          tWDA_CbContext *pWDA,
+                                          tLinkStateParams *linkStateParams)
+{
+   WDA_processSetLinkStateStatus status = WDA_PROCESS_SET_LINK_STATE;
+
+   switch(linkStateParams->state)
+   {
+      case eSIR_LINK_PREASSOC_STATE:
+      case eSIR_LINK_BTAMP_PREASSOC_STATE:
+        /* 
+         * set the WDA state to PRE ASSOC 
+         * copy the BSSID into pWDA to use it in join request and return, 
+         * No need to handle these messages.
+         */
+         vos_mem_copy(pWDA->macBSSID,linkStateParams->bssid, 
+                                                   sizeof(tSirMacAddr));
+
+         vos_mem_copy(pWDA->macSTASelf,linkStateParams->selfMacAddr, 
+                                                   sizeof(tSirMacAddr));
+         /* UMAC is issuing the setlink state with PREASSOC twice (before set 
+         *channel and after ) so reset the WDA state to ready when the second 
+         * time UMAC issue the link state with PREASSOC 
+         */
+         if(WDA_PRE_ASSOC_STATE == pWDA->wdaState)
+         {
+            /* RESET WDA state back to WDA_READY_STATE */
+            pWDA->wdaState = WDA_READY_STATE;
+         }
+         else
+         {
+            pWDA->wdaState = WDA_PRE_ASSOC_STATE;
+         }
+         //populate linkState info in WDACbCtxt
+         pWDA->linkState = linkStateParams->state;
+         status = WDA_IGNORE_SET_LINK_STATE;
+         break;
+
+      default:
+         if(pWDA->wdaState != WDA_READY_STATE)
+         {
+             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                     "Set link state called when WDA is not in READY STATE " );
+             status = WDA_IGNORE_SET_LINK_STATE;
+         }
+         break;
+   }
+   
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_SetLinkStateCallback
+ * call back function for set link state from WDI
+ */ 
+void WDA_SetLinkStateCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA;
+   tLinkStateParams *linkStateParams;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+
+   linkStateParams = (tLinkStateParams *)pWdaParams->wdaMsgParam ;
+
+   /*
+    * In STA mode start the BA activity check timer after association
+    * and in AP mode start BA activity check timer after BSS start */
+   if( ((linkStateParams->state == eSIR_LINK_POSTASSOC_STATE) &&
+         status == WDI_STATUS_SUCCESS) ||  ((status == WDI_STATUS_SUCCESS) &&
+       (linkStateParams->state == eSIR_LINK_AP_STATE)) )
+   {
+      WDA_START_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
+   }
+
+   WDA_SendMsg(pWDA, WDA_SET_LINK_STATE_RSP, (void *)linkStateParams , 0) ;
+
+   /* 
+    * No respone required for WDA_SET_LINK_STATE so free the request 
+    * param here
+    */
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      }
+      vos_mem_free(pWdaParams);
+   }
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetLinkState
+ * Request to WDI to set the link status.
+ */ 
+VOS_STATUS WDA_ProcessSetLinkState(tWDA_CbContext *pWDA, 
+                                           tLinkStateParams *linkStateParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SetLinkReqParamsType *wdiSetLinkStateParam = 
+                  (WDI_SetLinkReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_SetLinkReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+   tpAniSirGlobal pMac;
+   pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+
+   if(NULL == pMac)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pMac is NULL", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSetLinkStateParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetLinkStateParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   if(WDA_IGNORE_SET_LINK_STATE == 
+                  WDA_IsHandleSetLinkStateReq(pWDA,linkStateParams))
+   {
+      status = WDI_STATUS_E_FAILURE;
+   }
+   else
+   {
+      vos_mem_copy(wdiSetLinkStateParam->wdiLinkInfo.macBSSID, 
+                                  linkStateParams->bssid, sizeof(tSirMacAddr));
+
+      vos_mem_copy(wdiSetLinkStateParam->wdiLinkInfo.macSelfStaMacAddr, 
+                                  linkStateParams->selfMacAddr, sizeof(tSirMacAddr));
+
+      wdiSetLinkStateParam->wdiLinkInfo.wdiLinkState = linkStateParams->state;
+      wdiSetLinkStateParam->wdiReqStatusCB = NULL ;
+
+      pWdaParams->pWdaContext = pWDA;
+      /* Store remove key pointer, as this will be used for response */
+      pWdaParams->wdaMsgParam = (void *)linkStateParams ;
+
+      /* store Params pass it to WDI */
+      pWdaParams->wdaWdiApiMsgParam = (void *)wdiSetLinkStateParam ;
+      /* Stop Timer only other than GO role and concurrent session */
+      if( (linkStateParams->state == eSIR_LINK_IDLE_STATE)
+          && !vos_concurrent_sessions_running() &&
+          (wdaGetGlobalSystemRole(pMac) != eSYSTEM_AP_ROLE) )
+      {
+         WDA_STOP_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
+      }
+
+      status = WDI_SetLinkStateReq(wdiSetLinkStateParam, 
+                        (WDI_SetLinkStateRspCb)WDA_SetLinkStateCallback, pWdaParams);
+
+      if(IS_WDI_STATUS_FAILURE(status))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "Failure in set link state Req WDI API, free all the memory " );
+      }
+   }
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      vos_mem_free(wdiSetLinkStateParam) ;
+      vos_mem_free(linkStateParams);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_GetStatsReqParamsCallback
+ * send the response to PE with Stats received from WDI
+ */ 
+void WDA_GetStatsReqParamsCallback(
+                              WDI_GetStatsRspParamsType *wdiGetStatsRsp,
+                              void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+   tAniGetPEStatsRsp *pGetPEStatsRspParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   pGetPEStatsRspParams = 
+       (tAniGetPEStatsRsp *)vos_mem_malloc(sizeof(tAniGetPEStatsRsp) +
+       (wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType)));
+
+   if(NULL == pGetPEStatsRspParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return;
+   }
+
+   vos_mem_set(pGetPEStatsRspParams, wdiGetStatsRsp->usMsgLen, 0);
+   pGetPEStatsRspParams->msgType = wdiGetStatsRsp->usMsgType;
+   pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp) + 
+                   (wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType));
+   pGetPEStatsRspParams->msgLen  = wdiGetStatsRsp->usMsgLen + sizeof(tANI_U8);
+
+  //Fill the Session Id Properly in PE
+   pGetPEStatsRspParams->sessionId = 0;
+   pGetPEStatsRspParams->rc = 
+                      CONVERT_WDI2VOS_STATUS(wdiGetStatsRsp->wdiStatus);
+   pGetPEStatsRspParams->staId   = wdiGetStatsRsp->ucSTAIdx;
+   pGetPEStatsRspParams->statsMask = wdiGetStatsRsp->uStatsMask;
+
+   vos_mem_copy( pGetPEStatsRspParams + 1,
+                  wdiGetStatsRsp + 1,
+                  wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType));
+
+  /* send response to UMAC*/
+   WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, pGetPEStatsRspParams , 0) ;
+   
+   return;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessGetStatsReq
+ * Request to WDI to get the statistics
+ */ 
+VOS_STATUS WDA_ProcessGetStatsReq(tWDA_CbContext *pWDA,
+                                    tAniGetPEStatsReq *pGetStatsParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_GetStatsReqParamsType wdiGetStatsParam;
+   tAniGetPEStatsRsp *pGetPEStatsRspParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   wdiGetStatsParam.wdiGetStatsParamsInfo.ucSTAIdx = 
+                                          pGetStatsParams->staId;
+   wdiGetStatsParam.wdiGetStatsParamsInfo.uStatsMask = 
+                                          pGetStatsParams->statsMask;
+
+   wdiGetStatsParam.wdiReqStatusCB = NULL ;
+
+   status = WDI_GetStatsReq(&wdiGetStatsParam, 
+       (WDI_GetStatsRspCb)WDA_GetStatsReqParamsCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+          "Failure in Get Stats Req WDI API, free all the memory " );
+      pGetPEStatsRspParams = 
+         (tAniGetPEStatsRsp *)vos_mem_malloc(sizeof(tAniGetPEStatsRsp));
+      if(NULL == pGetPEStatsRspParams) 
+      {
+          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+          VOS_ASSERT(0);
+          return VOS_STATUS_E_NOMEM;
+      }
+
+      pGetPEStatsRspParams->msgType = WDA_GET_STATISTICS_RSP;
+      pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp);
+      pGetPEStatsRspParams->staId = pGetStatsParams->staId;
+      pGetPEStatsRspParams->rc    = eSIR_FAILURE;
+      WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, 
+                                 (void *)pGetPEStatsRspParams, 0) ;
+   }
+
+   /* Free the request message */
+   vos_mem_free(pGetStatsParams);
+   return CONVERT_WDI2VOS_STATUS(status);
+}
+
+/*
+ * FUNCTION: WDA_UpdateEDCAParamCallback
+ * call back function for Update EDCA params from WDI
+ */ 
+void WDA_UpdateEDCAParamCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tEdcaParams *pEdcaParams; 
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pEdcaParams = (tEdcaParams *)pWdaParams->wdaMsgParam ;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+   vos_mem_free(pEdcaParams);
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessUpdateEDCAParamReq
+ * Request to WDI to Update the EDCA params.
+ */ 
+VOS_STATUS WDA_ProcessUpdateEDCAParamReq(tWDA_CbContext *pWDA, 
+                                                   tEdcaParams *pEdcaParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_UpdateEDCAParamsType *wdiEdcaParam = 
+                     (WDI_UpdateEDCAParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_UpdateEDCAParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiEdcaParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiEdcaParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiEdcaParam->wdiEDCAInfo.ucBssIdx = pEdcaParams->bssIdx;
+   wdiEdcaParam->wdiEDCAInfo.ucEDCAParamsValid = pEdcaParams->highPerformance;
+   WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaBEInfo,
+                                                           &pEdcaParams->acbe);
+   WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaBKInfo,
+                                                           &pEdcaParams->acbk);
+   WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaVIInfo,
+                                                           &pEdcaParams->acvi);
+   WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaVOInfo,
+                                                           &pEdcaParams->acvo);
+   wdiEdcaParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store remove key pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pEdcaParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiEdcaParam ;
+
+   status = WDI_UpdateEDCAParams(wdiEdcaParam, 
+               (WDI_UpdateEDCAParamsRspCb)WDA_UpdateEDCAParamCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Update EDCA Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams);
+      vos_mem_free(pEdcaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_AddBAReqCallback
+ * send ADD BA RSP back to PE
+ */ 
+void WDA_AddBAReqCallback(WDI_AddBARspinfoType *pAddBARspParams, 
+                                                            void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA;
+   tAddBAParams *pAddBAReqParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+
+   pAddBAReqParams->status = CONVERT_WDI2SIR_STATUS(pAddBARspParams->wdiStatus) ;
+
+   WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessAddBAReq
+ * Request to WDI to Update the ADDBA REQ params.
+ */ 
+VOS_STATUS WDA_ProcessAddBAReq(tWDA_CbContext *pWDA, VOS_STATUS status,
+           tANI_U16 baSessionID, tANI_U8 staIdx, tAddBAParams *pAddBAReqParams)
+{
+   WDI_AddBAReqParamsType *wdiAddBAReqParam = 
+                     (WDI_AddBAReqParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_AddBAReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiAddBAReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiAddBAReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   do
+   {
+      WDI_AddBAReqinfoType *wdiAddBaInfo = &wdiAddBAReqParam->wdiBAInfoType ;
+
+      wdiAddBaInfo->ucSTAIdx = staIdx ;
+      wdiAddBaInfo->ucBaSessionID = baSessionID ;
+      wdiAddBaInfo->ucWinSize     = WDA_BA_MAX_WINSIZE ;
+
+   } while(0) ;
+   wdiAddBAReqParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddBAReqParam ;
+   pWdaParams->wdaMsgParam = pAddBAReqParams;
+
+   status = WDI_AddBAReq(wdiAddBAReqParam, 
+                                 (WDI_AddBARspCb)WDA_AddBAReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in ADD BA REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams);
+      pAddBAReqParams->status = eSIR_FAILURE;
+      WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+/*
+ * FUNCTION: WDA_AddBASessionReqCallback
+ * send ADD BA SESSION RSP back to PE/(or TL)
+ */ 
+void WDA_AddBASessionReqCallback(
+              WDI_AddBASessionRspParamsType *wdiAddBaSession, void* pUserData)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS ;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tAddBAParams *pAddBAReqParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
+
+   if( NULL == pAddBAReqParams )
+   {
+
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: pAddBAReqParams received NULL " ,__FUNCTION__);
+      VOS_ASSERT( 0 );
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+
+   /* 
+    * if WDA in update TL state, update TL with BA session parama and send
+    * another request to HAL(/WDI) (ADD_BA_REQ)
+    */
+   
+   if((VOS_STATUS_SUCCESS == 
+                       CONVERT_WDI2VOS_STATUS(wdiAddBaSession->wdiStatus)) && 
+                                 (WDA_BA_UPDATE_TL_STATE == pWDA->wdaState))
+   {
+      /* Update TL with BA info received from HAL/WDI */
+      status =  WDA_TL_BA_SESSION_ADD(pWDA->pVosContext,
+                                        wdiAddBaSession->usBaSessionID,
+                                        wdiAddBaSession->ucSTAIdx,
+                                        wdiAddBaSession->ucBaTID,
+                                        wdiAddBaSession->ucBaBufferSize,
+                                        wdiAddBaSession->ucWinSize,
+                                        wdiAddBaSession->usBaSSN );
+
+      WDA_ProcessAddBAReq(pWDA, status, wdiAddBaSession->usBaSessionID, 
+                                      wdiAddBaSession->ucSTAIdx, pAddBAReqParams) ;
+   }
+   else
+   {
+      pAddBAReqParams->status = 
+            CONVERT_WDI2SIR_STATUS(wdiAddBaSession->wdiStatus) ;
+  
+      /* Setting Flag to indicate that Set BA is success */
+      if(WDI_STATUS_SUCCESS == wdiAddBaSession->wdiStatus)
+      {
+         tANI_U16 curSta = wdiAddBaSession->ucSTAIdx;
+         tANI_U8 tid = wdiAddBaSession->ucBaTID;
+         WDA_SET_BA_TXFLAG(pWDA, curSta, tid) ;
+      }
+      pWDA->wdaMsgParam = NULL;
+      WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
+   }
+
+   /*Reset the WDA state to READY */
+   pWDA->wdaState = WDA_READY_STATE;
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessAddBASessionReq
+ * Request to WDI to Update the ADDBA REQ params.
+ */ 
+VOS_STATUS WDA_ProcessAddBASessionReq(tWDA_CbContext *pWDA, 
+                                         tAddBAParams *pAddBAReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_AddBASessionReqParamsType *wdiAddBASessionReqParam = 
+                     (WDI_AddBASessionReqParamsType *)vos_mem_malloc(
+                          sizeof(WDI_AddBASessionReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiAddBASessionReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiAddBASessionReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /*
+    * Populate ADD BA parameters and pass these paarmeters to WDI.
+    * ADD BA SESSION REQ will update HAL with BA params, WDA, will changes
+    * the state to track if these is BA recipient case or BA initiator 
+    * case.
+    */
+   do
+   {
+      WDI_AddBASessionReqinfoType *wdiBAInfoType = 
+                            &wdiAddBASessionReqParam->wdiBASessionInfoType ;
+      /* vos_mem_copy(wdiBAInfoType->macBSSID, 
+                            pAddBAReqParams->bssId, sizeof(tSirMacAddr));*/
+      wdiBAInfoType->ucSTAIdx = pAddBAReqParams->staIdx;
+      vos_mem_copy(wdiBAInfoType->macPeerAddr,
+                       pAddBAReqParams->peerMacAddr, sizeof(tSirMacAddr));
+
+      wdiBAInfoType->ucBaTID = pAddBAReqParams->baTID;
+
+      wdiBAInfoType->ucBaPolicy = pAddBAReqParams->baPolicy;
+      wdiBAInfoType->usBaBufferSize = pAddBAReqParams->baBufferSize;
+      wdiBAInfoType->usBaTimeout = pAddBAReqParams->baTimeout;
+      wdiBAInfoType->usBaSSN = pAddBAReqParams->baSSN;
+      wdiBAInfoType->ucBaDirection = pAddBAReqParams->baDirection;
+
+      /* check the BA direction and update state accordingly */
+      (eBA_RECIPIENT == wdiBAInfoType->ucBaDirection) 
+                                 ? (pWDA->wdaState = WDA_BA_UPDATE_TL_STATE)
+                                 : (pWDA->wdaState = WDA_BA_UPDATE_LIM_STATE);
+ 
+   }while(0) ;
+   wdiAddBASessionReqParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store ADD BA pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pAddBAReqParams ;
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddBASessionReqParam ;
+
+   status = WDI_AddBASessionReq(wdiAddBASessionReqParam, 
+              (WDI_AddBASessionRspCb)WDA_AddBASessionReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+       "Failure in ADD BA Session REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+/*
+ * FUNCTION: WDA_DelBANotifyTL
+ * send DEL BA IND to TL
+ */ 
+void WDA_DelBANotifyTL(tWDA_CbContext *pWDA, 
+                                           tDelBAParams *pDelBAReqParams)
+{
+   tpDelBAInd pDelBAInd = (tpDelBAInd)vos_mem_malloc(sizeof( tDelBAInd ));
+   //tSirMsgQ msg;
+   vos_msg_t vosMsg;
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
+   if(NULL == pDelBAInd) 
+   { 
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0) ; 
+      return; 
+   } 
+
+   pDelBAInd->mesgType = WDA_DELETEBA_IND;
+   pDelBAInd->staIdx = (tANI_U8) pDelBAReqParams->staIdx;
+   pDelBAInd->baTID = (tANI_U8) pDelBAReqParams->baTID;
+   pDelBAInd->mesgLen = sizeof( tDelBAInd );
+
+ 
+   vosMsg.type = WDA_DELETEBA_IND;
+   vosMsg.bodyptr = pDelBAInd;
+   vosStatus = vos_mq_post_message(VOS_MQ_ID_TL, &vosMsg);
+   if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+}
+
+/*
+ * FUNCTION: WDA_DelBAReqCallback
+ * send DEL BA RSP back to PE
+ */ 
+void WDA_DelBAReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tDelBAParams *pDelBAReqParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   pDelBAReqParams = (tDelBAParams *)pWdaParams->wdaMsgParam ;
+
+   /* Notify TL about DEL BA in case of recipinet */
+   if((VOS_STATUS_SUCCESS == CONVERT_WDI2VOS_STATUS(status)) && 
+                             (eBA_RECIPIENT == pDelBAReqParams->baDirection))
+   {
+      WDA_DelBANotifyTL(pWDA, pDelBAReqParams);
+   }
+
+   /* 
+    * No respone required for WDA_DELBA_IND so just free the request 
+    * param here
+    */
+   vos_mem_free(pDelBAReqParams);
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams);
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessDelBAReq
+ * Request to WDI to Update the DELBA REQ params.
+ */ 
+VOS_STATUS WDA_ProcessDelBAReq(tWDA_CbContext *pWDA, 
+                                                tDelBAParams *pDelBAReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_DelBAReqParamsType *wdiDelBAReqParam = 
+                     (WDI_DelBAReqParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_DelBAReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+   tANI_U16 staIdx = 0;
+   tANI_U8 tid = 0;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiDelBAReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiDelBAReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiDelBAReqParam->wdiBAInfo.ucSTAIdx = pDelBAReqParams->staIdx;
+   wdiDelBAReqParam->wdiBAInfo.ucBaTID = pDelBAReqParams->baTID;
+   wdiDelBAReqParam->wdiBAInfo.ucBaDirection = pDelBAReqParams->baDirection;
+   wdiDelBAReqParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store DEL BA pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pDelBAReqParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelBAReqParam ;
+
+   /* if BA exchange over the air is failed, clear this tid in BaBitmap
+    * maintained in WDA, so that WDA can retry for another BA session
+    */
+   staIdx = pDelBAReqParams->staIdx;
+   tid = pDelBAReqParams->baTID;
+   WDA_CLEAR_BA_TXFLAG(pWDA, staIdx, tid);
+
+   status = WDI_DelBAReq(wdiDelBAReqParam, 
+                         (WDI_DelBARspCb)WDA_DelBAReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in DEL BA REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+/*
+ * FUNCTION: WDA_AddTSReqCallback
+ * send ADD TS RSP back to PE
+ */ 
+void WDA_AddTSReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   tAddTsParams *pAddTsReqParams;
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
+   pAddTsReqParams = (tAddTsParams *)pWdaParams->wdaMsgParam ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+   
+   pAddTsReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_ADD_TS_RSP, (void *)pAddTsReqParams , 0) ;
+
+   return ;
+}
+
+
+
+/*
+ * FUNCTION: WDA_ProcessAddTSReq
+ * Request to WDI to Update the ADD TS  REQ params.
+ */ 
+VOS_STATUS WDA_ProcessAddTSReq(tWDA_CbContext *pWDA, 
+                                                tAddTsParams *pAddTsReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_AddTSReqParamsType *wdiAddTSReqParam = 
+                     (WDI_AddTSReqParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_AddTSReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiAddTSReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiAddTSReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiAddTSReqParam->wdiTsInfo.ucSTAIdx = pAddTsReqParams->staIdx;
+   wdiAddTSReqParam->wdiTsInfo.ucTspecIdx = pAddTsReqParams->tspecIdx;
+
+   //TS IE
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.ucType = pAddTsReqParams->tspec.type;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.ucLength = 
+                                                pAddTsReqParams->tspec.length;
+   
+   //TS IE : TS INFO : TRAFFIC
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.ackPolicy =
+                           pAddTsReqParams->tspec.tsinfo.traffic.ackPolicy;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.userPrio =
+                           pAddTsReqParams->tspec.tsinfo.traffic.userPrio;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.psb =
+                           pAddTsReqParams->tspec.tsinfo.traffic.psb;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.aggregation =
+                           pAddTsReqParams->tspec.tsinfo.traffic.aggregation;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.accessPolicy =
+                           pAddTsReqParams->tspec.tsinfo.traffic.accessPolicy;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.direction =
+                           pAddTsReqParams->tspec.tsinfo.traffic.direction;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.tsid =
+                           pAddTsReqParams->tspec.tsinfo.traffic.tsid;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.trafficType =
+                           pAddTsReqParams->tspec.tsinfo.traffic.trafficType;
+   
+   //TS IE : TS INFO : SCHEDULE
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.schedule = 
+                           pAddTsReqParams->tspec.tsinfo.schedule.schedule;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.rsvd = 
+                           pAddTsReqParams->tspec.tsinfo.schedule.rsvd;
+
+   //TS IE
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usNomMsduSz = 
+                           pAddTsReqParams->tspec.nomMsduSz;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usMaxMsduSz = 
+                           pAddTsReqParams->tspec.maxMsduSz;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMinSvcInterval = 
+                           pAddTsReqParams->tspec.minSvcInterval;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMaxSvcInterval = 
+                           pAddTsReqParams->tspec.maxSvcInterval;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uInactInterval = 
+                           pAddTsReqParams->tspec.inactInterval;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uSuspendInterval = 
+                           pAddTsReqParams->tspec.suspendInterval;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uSvcStartTime = 
+                           pAddTsReqParams->tspec.svcStartTime;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMinDataRate = 
+                           pAddTsReqParams->tspec.minDataRate;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMeanDataRate = 
+                           pAddTsReqParams->tspec.meanDataRate;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uPeakDataRate = 
+                           pAddTsReqParams->tspec.peakDataRate;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMaxBurstSz = 
+                           pAddTsReqParams->tspec.maxBurstSz;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uDelayBound = 
+                           pAddTsReqParams->tspec.delayBound;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.uMinPhyRate = 
+                           pAddTsReqParams->tspec.minPhyRate;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usSurplusBw = 
+                           pAddTsReqParams->tspec.surplusBw;
+   wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usMediumTime = 
+                           pAddTsReqParams->tspec.mediumTime;
+
+   /* TODO: tAddTsParams doesn't have the following fields */
+#if 0 
+   wdiAddTSReqParam->wdiTsInfo.ucUapsdFlags = 
+   wdiAddTSReqParam->wdiTsInfo.ucServiceInterval = 
+   wdiAddTSReqParam->wdiTsInfo.ucSuspendInterval = 
+   wdiAddTSReqParam->wdiTsInfo.ucDelayedInterval = 
+#endif
+   wdiAddTSReqParam->wdiReqStatusCB = NULL ;
+   
+   pWdaParams->pWdaContext = pWDA;
+   /* Store ADD TS pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pAddTsReqParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddTSReqParam ;
+
+   status = WDI_AddTSReq(wdiAddTSReqParam, 
+                   (WDI_AddTsRspCb)WDA_AddTSReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in ADD TS REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams);
+      pAddTsReqParams->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_ADD_TS_RSP, (void *)pAddTsReqParams , 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+
+/*
+ * FUNCTION: WDA_DelTSReqCallback
+ * send DEL TS RSP back to PE
+ */ 
+void WDA_DelTSReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams);
+
+   /* 
+    * No respone required for WDA_DEL_TS_REQ so just free the request 
+    * param here
+    */
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessDelTSReq
+ * Request to WDI to Update the DELTS REQ params.
+ */ 
+VOS_STATUS WDA_ProcessDelTSReq(tWDA_CbContext *pWDA, 
+                                                 tDelTsParams *pDelTSReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_DelTSReqParamsType *wdiDelTSReqParam = 
+                     (WDI_DelTSReqParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_DelTSReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiDelTSReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiDelTSReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_copy(wdiDelTSReqParam->wdiDelTSInfo.macBSSID, 
+                                  pDelTSReqParams->bssId, sizeof(tSirMacAddr));
+   wdiDelTSReqParam->wdiDelTSInfo.ucSTAIdx = pDelTSReqParams->staIdx;
+   wdiDelTSReqParam->wdiDelTSInfo.ucTspecIdx = pDelTSReqParams->tspecIdx;
+   wdiDelTSReqParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store DEL TS pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pDelTSReqParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelTSReqParam ;
+
+   status = WDI_DelTSReq(wdiDelTSReqParam, 
+                       (WDI_DelTsRspCb)WDA_DelTSReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in DEL TS REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+/*
+ * FUNCTION: WDA_UpdateBeaconParamsCallback
+ *  Free the memory. No need to send any response to PE in this case
+ */ 
+void WDA_UpdateBeaconParamsCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams);
+   /* 
+    * No respone required for WDA_UPDATE_BEACON_IND so just free the request 
+    * param here
+    */
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessUpdateBeaconParams
+ * Request to WDI to send  the beacon parameters to HAL to update the Hardware
+ */ 
+VOS_STATUS WDA_ProcessUpdateBeaconParams(tWDA_CbContext *pWDA, 
+                                    tUpdateBeaconParams *pUpdateBeaconParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_UpdateBeaconParamsType *wdiUpdateBeaconParams = 
+                     (WDI_UpdateBeaconParamsType *)vos_mem_malloc(
+                                             sizeof(WDI_UpdateBeaconParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiUpdateBeaconParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiUpdateBeaconParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucBssIdx = 
+                           pUpdateBeaconParams->bssIdx;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortPreamble = 
+                           pUpdateBeaconParams->fShortPreamble;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortSlotTime = 
+                           pUpdateBeaconParams->fShortSlotTime;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usBeaconInterval = 
+                           pUpdateBeaconParams->beaconInterval;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllaCoexist = 
+                           pUpdateBeaconParams->llaCoexist;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllbCoexist = 
+                           pUpdateBeaconParams->llbCoexist;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllgCoexist = 
+                           pUpdateBeaconParams->llgCoexist;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucHt20MhzCoexist= 
+                           pUpdateBeaconParams->ht20MhzCoexist;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllnNonGFCoexist =
+                           pUpdateBeaconParams->llnNonGFCoexist;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfLsigTXOPProtectionFullSupport = 
+                           pUpdateBeaconParams->fLsigTXOPProtectionFullSupport;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfRIFSMode =
+                           pUpdateBeaconParams->fRIFSMode;
+   wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usChangeBitmap =
+                           pUpdateBeaconParams->paramChangeBitmap;
+   wdiUpdateBeaconParams->wdiReqStatusCB = NULL ;
+   
+   pWdaParams->pWdaContext = pWDA;
+   /* Store UpdateBeacon Req pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pUpdateBeaconParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiUpdateBeaconParams ;
+
+   status = WDI_UpdateBeaconParamsReq(wdiUpdateBeaconParams, 
+                 (WDI_UpdateBeaconParamsRspCb)WDA_UpdateBeaconParamsCallback,
+                 pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+        "Failure in UPDATE BEACON REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+#ifdef FEATURE_WLAN_CCX
+
+/*
+ * FUNCTION: WDA_TSMStatsReqCallback
+ * send TSM Stats RSP back to PE
+ */ 
+void WDA_TSMStatsReqCallback(WDI_TSMStatsRspParamsType *pwdiTSMStatsRspParams, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA = NULL; 
+   tTSMStats *pTsmRspParams = NULL;
+ 
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ Entering: %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
+   pTsmRspParams = (tTSMStats *)pWdaParams->wdaMsgParam ;
+
+   if( NULL == pTsmRspParams )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: pTsmRspParams received NULL " ,__FUNCTION__);
+      VOS_ASSERT( 0 );
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+   
+   pTsmRspParams->tsmMetrics.UplinkPktQueueDly = pwdiTSMStatsRspParams->UplinkPktQueueDly;
+   vos_mem_copy(pTsmRspParams->tsmMetrics.UplinkPktQueueDlyHist,
+                 pwdiTSMStatsRspParams->UplinkPktQueueDlyHist,
+                 sizeof(pwdiTSMStatsRspParams->UplinkPktQueueDlyHist)/
+                 sizeof(pwdiTSMStatsRspParams->UplinkPktQueueDlyHist[0]));
+   pTsmRspParams->tsmMetrics.UplinkPktTxDly = pwdiTSMStatsRspParams->UplinkPktTxDly;
+   pTsmRspParams->tsmMetrics.UplinkPktLoss = pwdiTSMStatsRspParams->UplinkPktLoss;
+   pTsmRspParams->tsmMetrics.UplinkPktCount = pwdiTSMStatsRspParams->UplinkPktCount;
+   pTsmRspParams->tsmMetrics.RoamingCount = pwdiTSMStatsRspParams->RoamingCount;
+   pTsmRspParams->tsmMetrics.RoamingDly = pwdiTSMStatsRspParams->RoamingDly;
+
+   WDA_SendMsg(pWDA, WDA_TSM_STATS_RSP, (void *)pTsmRspParams , 0) ;
+
+   return ;
+}
+
+
+
+
+/*
+ * FUNCTION: WDA_ProcessTsmStatsReq
+ * Request to WDI to get the TSM Stats params.
+ */ 
+VOS_STATUS WDA_ProcessTsmStatsReq(tWDA_CbContext *pWDA, 
+                                    tTSMStats *pTsmStats)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_TSMStatsReqParamsType *wdiTSMReqParam = NULL;
+   tWDA_ReqParams *pWdaParams = NULL;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> Entering: %s " ,__FUNCTION__);
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or  wdaWdiApiMsgParam is not NULL", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdiTSMReqParam = (WDI_TSMStatsReqParamsType *)vos_mem_malloc(
+                                 sizeof(WDI_TSMStatsReqParamsType));
+   if(NULL == wdiTSMReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiTSMReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiTSMReqParam->wdiTsmStatsParamsInfo.ucTid = pTsmStats->tid;
+   vos_mem_copy(wdiTSMReqParam->wdiTsmStatsParamsInfo.bssid,
+                                           pTsmStats->bssId,
+                                         sizeof(wpt_macAddr));
+   wdiTSMReqParam->wdiReqStatusCB = NULL ;
+   
+   pWdaParams->pWdaContext = pWDA;
+   /* Store TSM Stats pointer, as this will be used for response */
+   pWdaParams->wdaMsgParam = (void *)pTsmStats ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiTSMReqParam ;
+
+   status = WDI_TSMStatsReq(wdiTSMReqParam,
+                           (WDI_TsmRspCb)WDA_TSMStatsReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "Failure in TSM STATS REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams) ;
+   }
+
+  return CONVERT_WDI2VOS_STATUS(status) ;
+} 
+#endif
+/*
+ * FUNCTION: WDA_SendBeaconParamsCallback
+ * No need to send any response to PE in this case
+ */ 
+void WDA_SendBeaconParamsCallback(WDI_Status status, void* pUserData)
+{
+
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSendBeacon
+ * Request to WDI to send the beacon template to HAL to update the TPE memory and 
+ * start beacon trasmission
+ */ 
+VOS_STATUS WDA_ProcessSendBeacon(tWDA_CbContext *pWDA, 
+                                       tSendbeaconParams *pSendbeaconParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SendBeaconParamsType wdiSendBeaconReqParam; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   vos_mem_copy(wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.macBSSID, 
+                              pSendbeaconParams->bssId, sizeof(tSirMacAddr));
+   wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.beaconLength = 
+                              pSendbeaconParams->beaconLength;
+#ifdef WLAN_SOFTAP_FEATURE
+   wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.timIeOffset = 
+                              pSendbeaconParams->timIeOffset;
+#endif
+#ifdef WLAN_FEATURE_P2P
+   wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.usP2PIeOffset = 
+                              pSendbeaconParams->p2pIeOffset;
+#endif
+
+   /* Copy the beacon template to local buffer */
+   vos_mem_copy(wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.beacon, 
+                 pSendbeaconParams->beacon, pSendbeaconParams->beaconLength);
+   wdiSendBeaconReqParam.wdiReqStatusCB = NULL ;
+
+
+   status = WDI_SendBeaconParamsReq(&wdiSendBeaconReqParam, 
+            (WDI_SendBeaconParamsRspCb)WDA_SendBeaconParamsCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+          "Failure in SEND BEACON REQ Params WDI API" );
+   }
+
+   vos_mem_free(pSendbeaconParams);
+   return CONVERT_WDI2VOS_STATUS(status);
+
+}
+
+/*
+ * FUNCTION: WDA_UpdateProbeRspParamsCallback
+ * No need to send any response to PE in this case
+ */ 
+void WDA_UpdateProbeRspParamsCallback(WDI_Status status, void* pUserData)
+{
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessUpdateProbeRspTemplate
+ * Request to WDI to send the probe response template to HAL to update the TPE memory and 
+ * send probe response
+ */ 
+VOS_STATUS WDA_ProcessUpdateProbeRspTemplate(tWDA_CbContext *pWDA, 
+                                 tSendProbeRespParams *pSendProbeRspParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_UpdateProbeRspTemplateParamsType wdiSendProbeRspParam; 
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   /*Copy update probe response parameters*/
+   vos_mem_copy(wdiSendProbeRspParam.wdiProbeRspTemplateInfo.macBSSID, 
+                              pSendProbeRspParams->bssId, sizeof(tSirMacAddr));
+   wdiSendProbeRspParam.wdiProbeRspTemplateInfo.uProbeRespTemplateLen = 
+                              pSendProbeRspParams->probeRespTemplateLen;
+
+   /* Copy the Probe Response template to local buffer */
+   vos_mem_copy(
+           wdiSendProbeRspParam.wdiProbeRspTemplateInfo.pProbeRespTemplate,
+           pSendProbeRspParams->pProbeRespTemplate, 
+           pSendProbeRspParams->probeRespTemplateLen);
+   vos_mem_copy(
+     wdiSendProbeRspParam.wdiProbeRspTemplateInfo.uaProxyProbeReqValidIEBmap,
+     pSendProbeRspParams->ucProxyProbeReqValidIEBmap,
+     WDI_PROBE_REQ_BITMAP_IE_LEN);
+   
+   wdiSendProbeRspParam.wdiReqStatusCB = NULL ;
+   
+
+   status = WDI_UpdateProbeRspTemplateReq(&wdiSendProbeRspParam, 
+     (WDI_UpdateProbeRspTemplateRspCb)WDA_UpdateProbeRspParamsCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+          "Failure in SEND Probe RSP Params WDI API" );
+   }
+
+   vos_mem_free(pSendProbeRspParams);
+   return CONVERT_WDI2VOS_STATUS(status);
+
+}
+
+#if defined(WLAN_FEATURE_VOWIFI) || defined(FEATURE_WLAN_CCX)
+/*
+ * FUNCTION: WDA_SetMaxTxPowerCallBack
+ * send the response to PE with power value received from WDI
+ */ 
+void WDA_SetMaxTxPowerCallBack(WDI_SetMaxTxPowerRspMsg * pwdiSetMaxTxPowerRsp,
+                                             void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA = NULL;
+   tMaxTxPowerParams *pMaxTxPowerParams = NULL; 
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
+   pMaxTxPowerParams = (tMaxTxPowerParams *)pWdaParams->wdaMsgParam ;
+
+   if( NULL == pMaxTxPowerParams )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                          "%s: pMaxTxPowerParams received NULL " ,__FUNCTION__);
+      VOS_ASSERT( 0 );
+      return ;
+   }
+
+  
+  /*need to free memory for the pointers used in the 
+    WDA Process.Set Max Tx Power Req function*/
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+
+   pMaxTxPowerParams->power = pwdiSetMaxTxPowerRsp->ucPower;
+
+  
+  /* send response to UMAC*/
+   WDA_SendMsg(pWDA, WDA_SET_MAX_TX_POWER_RSP, pMaxTxPowerParams , 0) ;
+   
+   return;
+}
+
+/*
+ * FUNCTION: WDA_SetMaxTxPowerCallBack
+ * Request to WDI to send set Max Tx Power Request
+ */ 
+ VOS_STATUS WDA_ProcessSetMaxTxPowerReq(tWDA_CbContext *pWDA,
+                                          tMaxTxPowerParams *MaxTxPowerParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   WDI_SetMaxTxPowerParamsType *wdiSetMaxTxPowerParams = NULL;
+   tWDA_ReqParams *pWdaParams = NULL;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if((NULL != pWDA->wdaMsgParam) ||(NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or  wdaWdiApiMsgParam is not NULL", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdiSetMaxTxPowerParams = (WDI_SetMaxTxPowerParamsType *)vos_mem_malloc(
+                                 sizeof(WDI_SetMaxTxPowerParamsType));
+   if(NULL == wdiSetMaxTxPowerParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      vos_mem_free(wdiSetMaxTxPowerParams);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Copy.Max.Tx.Power Params to WDI structure */
+   vos_mem_copy(wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macBSSId,
+                 MaxTxPowerParams->bssId, 
+                 sizeof(tSirMacAddr));
+
+   vos_mem_copy(wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macSelfStaMacAddr,
+                 MaxTxPowerParams->selfStaMacAddr, 
+                 sizeof(tSirMacAddr));
+
+   wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.ucPower = 
+                                              MaxTxPowerParams->power;
+
+   wdiSetMaxTxPowerParams->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = (void *)MaxTxPowerParams ;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiSetMaxTxPowerParams ;
+
+   status = WDI_SetMaxTxPowerReq(wdiSetMaxTxPowerParams,
+                       (WDA_SetMaxTxPowerRspCb)WDA_SetMaxTxPowerCallBack, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+     "Failure in SET MAX TX Power REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams);
+   }
+   return CONVERT_WDI2VOS_STATUS(status);
+   
+}
+
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+
+/*
+ * FUNCTION: WDA_SetP2PGONOAReqParamsCallback
+ *  Free the memory. No need to send any response to PE in this case
+ */ 
+void WDA_SetP2PGONOAReqParamsCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   vos_mem_free(pWDA->wdaMsgParam) ;
+   pWDA->wdaMsgParam = NULL;
+
+   /* 
+    * No respone required for SIR_HAL_SET_P2P_GO_NOA_REQ 
+    * so just free the request param here
+    */
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessSetP2PGONOAReq
+ * Request to WDI to set the P2P Group Owner Notice of Absence Req 
+ */ 
+VOS_STATUS WDA_ProcessSetP2PGONOAReq(tWDA_CbContext *pWDA,
+                                    tP2pPsParams *pP2pPsConfigParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_SetP2PGONOAReqParamsType *wdiSetP2PGONOAReqParam = 
+                (WDI_SetP2PGONOAReqParamsType *)vos_mem_malloc(
+                                   sizeof(WDI_SetP2PGONOAReqParamsType)) ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiSetP2PGONOAReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.ucOpp_ps = 
+                                    pP2pPsConfigParams->opp_ps;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.uCtWindow = 
+                                    pP2pPsConfigParams->ctWindow;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.ucCount = 
+                                    pP2pPsConfigParams->count;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.uDuration = 
+                                    pP2pPsConfigParams->duration;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.uInterval = 
+                                    pP2pPsConfigParams->interval;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.uSingle_noa_duration = 
+                                    pP2pPsConfigParams->single_noa_duration;
+   wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.ucPsSelection = 
+                                    pP2pPsConfigParams->psSelection;
+
+   if((NULL != pWDA->wdaMsgParam) ||
+                             (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetP2PGONOAReqParam);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdiSetP2PGONOAReqParam->wdiReqStatusCB = NULL ;
+   /* Store msg pointer from PE, as this will be used for response */
+   pWDA->wdaMsgParam = (void *)pP2pPsConfigParams ;
+
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiSetP2PGONOAReqParam ;
+
+   status = WDI_SetP2PGONOAReq(wdiSetP2PGONOAReqParam, 
+       (WDI_SetP2PGONOAReqParamsRspCb)WDA_SetP2PGONOAReqParamsCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+          "Failure in Set P2P GO NOA Req WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWDA->wdaMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status);
+
+
+}
+#endif
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/*
+ * FUNCTION: WDA_AggrAddTSReqCallback
+ * send ADD AGGREGATED TS RSP back to PE
+ */ 
+void WDA_AggrAddTSReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+   tAggrAddTsParams *pAggrAddTsReqParams = 
+                           (tAggrAddTsParams *)pWDA->wdaMsgParam ;
+   int i;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL;
+   
+   for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
+   {
+      pAggrAddTsReqParams->status[i] = CONVERT_WDI2SIR_STATUS(status) ;
+   }
+
+   WDA_SendMsg(pWDA, WDA_AGGR_QOS_RSP, (void *)pAggrAddTsReqParams , 0) ;
+
+   return ;
+}/* WLAN_FEATURE_VOWIFI_11R */
+
+/*
+ * FUNCTION: WDA_ProcessAddTSReq
+ * Request to WDI to send an update with AGGREGATED ADD TS REQ params.
+ */ 
+VOS_STATUS WDA_ProcessAggrAddTSReq(tWDA_CbContext *pWDA, 
+                                    tAggrAddTsParams *pAggrAddTsReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   int i;
+   WDI_AggrAddTSReqParamsType *wdiAggrAddTSReqParam;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   wdiAggrAddTSReqParam = (WDI_AggrAddTSReqParamsType *)vos_mem_malloc(
+                           sizeof(WDI_AggrAddTSReqParamsType)) ;
+   if(NULL == wdiAggrAddTSReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiAggrAddTSReqParam->wdiAggrTsInfo.ucSTAIdx = pAggrAddTsReqParams->staIdx;
+   wdiAggrAddTSReqParam->wdiAggrTsInfo.ucTspecIdx = 
+      pAggrAddTsReqParams->tspecIdx;
+
+   for( i = 0; i < WDI_MAX_NO_AC; i++ )
+   {
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].ucType = pAggrAddTsReqParams->tspec[i].type;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].ucLength = 
+                                                   pAggrAddTsReqParams->tspec[i].length;
+
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.ackPolicy =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.ackPolicy;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.userPrio =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.userPrio;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.psb =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.psb;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.aggregation =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.aggregation;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.accessPolicy =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.accessPolicy;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.direction =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.direction;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.tsid =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.tsid;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.trafficType =
+                              pAggrAddTsReqParams->tspec[i].tsinfo.traffic.trafficType;
+
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.schedule = 
+                              pAggrAddTsReqParams->tspec[i].tsinfo.schedule.schedule;
+
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usNomMsduSz = 
+                              pAggrAddTsReqParams->tspec[i].nomMsduSz;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usMaxMsduSz = 
+                              pAggrAddTsReqParams->tspec[i].maxMsduSz;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMinSvcInterval = 
+                              pAggrAddTsReqParams->tspec[i].minSvcInterval;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMaxSvcInterval = 
+                              pAggrAddTsReqParams->tspec[i].maxSvcInterval;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uInactInterval = 
+                              pAggrAddTsReqParams->tspec[i].inactInterval;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uSuspendInterval = 
+                              pAggrAddTsReqParams->tspec[i].suspendInterval;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uSvcStartTime = 
+                              pAggrAddTsReqParams->tspec[i].svcStartTime;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMinDataRate = 
+                              pAggrAddTsReqParams->tspec[i].minDataRate;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMeanDataRate = 
+                              pAggrAddTsReqParams->tspec[i].meanDataRate;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uPeakDataRate = 
+                              pAggrAddTsReqParams->tspec[i].peakDataRate;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMaxBurstSz = 
+                              pAggrAddTsReqParams->tspec[i].maxBurstSz;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uDelayBound = 
+                              pAggrAddTsReqParams->tspec[i].delayBound;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].uMinPhyRate = 
+                              pAggrAddTsReqParams->tspec[i].minPhyRate;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usSurplusBw = 
+                              pAggrAddTsReqParams->tspec[i].surplusBw;
+      wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usMediumTime = 
+                              pAggrAddTsReqParams->tspec[i].mediumTime;
+   }
+   
+   /* TODO: tAggrAddTsParams doesn't have the following fields */
+#if 0 
+   wdiAggrAddTSReqParam->wdiTsInfo.ucUapsdFlags = 
+   wdiAggrAddTSReqParam->wdiTsInfo.ucServiceInterval = 
+   wdiAggrAddTSReqParam->wdiTsInfo.ucSuspendInterval = 
+   wdiAggrAddTSReqParam->wdiTsInfo.ucDelayedInterval = 
+#endif
+   wdiAggrAddTSReqParam->wdiReqStatusCB = NULL ;
+   
+   /* Store ADD TS pointer, as this will be used for response */
+   pWDA->wdaMsgParam = (void *)pAggrAddTsReqParams ;
+
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiAggrAddTSReqParam ;
+
+   status = WDI_AggrAddTSReq(wdiAggrAddTSReqParam, 
+                             (WDI_AggrAddTsRspCb)WDA_AggrAddTSReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in ADD TS REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWDA->wdaMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+#endif
+
+/*
+ * FUNCTION: WDA_EnterImpsReqCallback
+ * send Enter IMPS RSP back to PE
+ */ 
+void WDA_EnterImpsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessEnterImpsReq
+ * Request to WDI to Enter IMPS power state.
+ */ 
+VOS_STATUS WDA_ProcessEnterImpsReq(tWDA_CbContext *pWDA)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   status = WDI_EnterImpsReq((WDI_EnterImpsRspCb)WDA_EnterImpsReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Enter IMPS REQ WDI API, free all the memory " );
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ExitImpsReqCallback
+ * send Exit IMPS RSP back to PE
+ */ 
+void WDA_ExitImpsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   WDA_SendMsg(pWDA, WDA_EXIT_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessExitImpsReq
+ * Request to WDI to Exit IMPS power state.
+ */ 
+VOS_STATUS WDA_ProcessExitImpsReq(tWDA_CbContext *pWDA)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   status = WDI_ExitImpsReq((WDI_ExitImpsRspCb)WDA_ExitImpsReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Exit IMPS REQ WDI API, free all the memory " );
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_EnterBmpsReqCallback
+ * send Enter BMPS RSP back to PE
+ */ 
+void WDA_EnterBmpsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessEnterBmpsReq
+ * Request to WDI to Enter BMPS power state.
+ */ 
+VOS_STATUS WDA_ProcessEnterBmpsReq(tWDA_CbContext *pWDA,
+                                   tEnterBmpsParams *pEnterBmpsReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   WDI_EnterBmpsReqParamsType *wdiEnterBmpsReqParams;
+   tWDA_ReqParams *pWdaParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if ((NULL == pWDA) || (NULL == pEnterBmpsReqParams))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: invalid param", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdiEnterBmpsReqParams = vos_mem_malloc(sizeof(WDI_EnterBmpsReqParamsType));
+   if (NULL == wdiEnterBmpsReqParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
+   if (NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      vos_mem_free(wdiEnterBmpsReqParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucBssIdx = pEnterBmpsReqParams->bssIdx;
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimCount = pEnterBmpsReqParams->dtimCount;
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimPeriod = pEnterBmpsReqParams->dtimPeriod;
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.uTbtt = pEnterBmpsReqParams->tbtt;
+
+   // For CCX and 11R Roaming
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.rssiFilterPeriod = (wpt_uint32)pEnterBmpsReqParams->rssiFilterPeriod;
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.numBeaconPerRssiAverage = (wpt_uint32)pEnterBmpsReqParams->numBeaconPerRssiAverage;
+   wdiEnterBmpsReqParams->wdiEnterBmpsInfo.bRssiFilterEnable = (wpt_uint8)pEnterBmpsReqParams->bRssiFilterEnable;
+   wdiEnterBmpsReqParams->wdiReqStatusCB = NULL;
+
+   // we are done with the input
+   vos_mem_free(pEnterBmpsReqParams);
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiEnterBmpsReqParams;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = NULL;
+
+   status = WDI_EnterBmpsReq(wdiEnterBmpsReqParams,
+                    (WDI_EnterBmpsRspCb)WDA_EnterBmpsReqCallback, pWdaParams);
+
+   if (IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Enter BMPS REQ WDI API, free all the memory" );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status);
+}
+
+/*
+ * FUNCTION: WDA_ExitBmpsReqCallback
+ * send Exit BMPS RSP back to PE
+ */ 
+void WDA_ExitBmpsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   tExitBmpsParams *pExitBmpsReqParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+   pExitBmpsReqParams = (tExitBmpsParams *)pWdaParams->wdaMsgParam ;
+
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+
+   pExitBmpsReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_EXIT_BMPS_RSP, (void *)pExitBmpsReqParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessExitBmpsReq
+ * Request to WDI to Exit BMPS power state.
+ */ 
+VOS_STATUS WDA_ProcessExitBmpsReq(tWDA_CbContext *pWDA,
+                                   tExitBmpsParams *pExitBmpsReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_ExitBmpsReqParamsType *wdiExitBmpsReqParams = 
+      (WDI_ExitBmpsReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_ExitBmpsReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiExitBmpsReqParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiExitBmpsReqParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiExitBmpsReqParams->wdiExitBmpsInfo.ucSendDataNull = pExitBmpsReqParams->sendDataNull;
+      
+   wdiExitBmpsReqParams->wdiReqStatusCB = NULL;
+      
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiExitBmpsReqParams;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pExitBmpsReqParams;
+
+   status = WDI_ExitBmpsReq(wdiExitBmpsReqParams,
+                             (WDI_ExitBmpsRspCb)WDA_ExitBmpsReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Exit BMPS REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_EnterUapsdReqCallback
+ * send Enter UAPSD RSP back to PE
+ */ 
+void WDA_EnterUapsdReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   tUapsdParams *pEnterUapsdReqParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+
+   pEnterUapsdReqParams = (tUapsdParams *)pWdaParams->wdaMsgParam ;
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   pEnterUapsdReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_ENTER_UAPSD_RSP, (void *)pEnterUapsdReqParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessEnterUapsdReq
+ * Request to WDI to Enter UAPSD power state.
+ */ 
+VOS_STATUS WDA_ProcessEnterUapsdReq(tWDA_CbContext *pWDA,
+                                    tUapsdParams *pEnterUapsdReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_EnterUapsdReqParamsType *wdiEnterUapsdReqParams = 
+      (WDI_EnterUapsdReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_EnterUapsdReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiEnterUapsdReqParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiEnterUapsdReqParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeDeliveryEnabled = 
+      pEnterUapsdReqParams->beDeliveryEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeTriggerEnabled = 
+      pEnterUapsdReqParams->beTriggerEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBkDeliveryEnabled = 
+      pEnterUapsdReqParams->bkDeliveryEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBkTriggerEnabled = 
+      pEnterUapsdReqParams->bkTriggerEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucViDeliveryEnabled = 
+      pEnterUapsdReqParams->viDeliveryEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucViTriggerEnabled = 
+      pEnterUapsdReqParams->viTriggerEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoDeliveryEnabled = 
+      pEnterUapsdReqParams->voDeliveryEnabled;
+   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoTriggerEnabled = 
+      pEnterUapsdReqParams->voTriggerEnabled;
+
+   wdiEnterUapsdReqParams->wdiReqStatusCB = NULL; 
+
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiEnterUapsdReqParams;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pEnterUapsdReqParams;
+
+   status = WDI_EnterUapsdReq(wdiEnterUapsdReqParams,
+                              (WDI_EnterUapsdRspCb)WDA_EnterUapsdReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Enter UAPSD REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ExitUapsdReqCallback
+ * send Exit UAPSD RSP back to PE
+ */ 
+void WDA_ExitUapsdReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   WDA_SendMsg(pWDA, WDA_EXIT_UAPSD_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessExitUapsdReq
+ * Request to WDI to Exit UAPSD power state.
+ */ 
+VOS_STATUS WDA_ProcessExitUapsdReq(tWDA_CbContext *pWDA)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   status = WDI_ExitUapsdReq((WDI_ExitUapsdRspCb)WDA_ExitUapsdReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Exit UAPSD REQ WDI API, free all the memory " );
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+
+/*
+ * FUNCTION: WDA_SetPwrSaveCfgReqCallback
+ * 
+ */ 
+void WDA_SetPwrSaveCfgReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      }
+      if( pWdaParams->wdaMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaMsgParam) ;
+      }
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetPwrSaveCfgReq
+ * Request to WDI to set the power save params at start.
+ */ 
+VOS_STATUS WDA_ProcessSetPwrSaveCfgReq(tWDA_CbContext *pWDA, 
+                                       tSirPowerSaveCfg *pPowerSaveCfg)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   tHalCfg        *tlvStruct = NULL ;
+   tANI_U8        *tlvStructStart = NULL ;
+   v_PVOID_t      *configParam;
+   tANI_U32       configParamSize;
+   tANI_U32       *configDataValue;
+   WDI_UpdateCfgReqParamsType *wdiPowerSaveCfg;
+   tWDA_ReqParams *pWdaParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if ((NULL == pWDA) || (NULL == pPowerSaveCfg))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: invalid param", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wdiPowerSaveCfg = vos_mem_malloc(sizeof(WDI_UpdateCfgReqParamsType));
+   if (NULL == wdiPowerSaveCfg)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiPowerSaveCfg);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   configParamSize = (sizeof(tHalCfg) + (sizeof(tANI_U32))) * WDA_NUM_PWR_SAVE_CFG;
+   configParam = vos_mem_malloc(configParamSize);
+
+   if(NULL == configParam)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: VOS MEM Alloc Failure \n", __FUNCTION__);
+      vos_mem_free(pWdaParams);
+      vos_mem_free(wdiPowerSaveCfg);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_set(configParam, configParamSize, 0);
+   wdiPowerSaveCfg->pConfigBuffer = configParam;
+   tlvStruct = (tHalCfg *)configParam;
+   tlvStructStart = (tANI_U8 *)configParam;
+
+   /* QWLAN_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->broadcastFrameFilter;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_HEART_BEAT_THRESHOLD */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_HEART_BEAT_THRESHOLD;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->HeartBeatCount;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_IGNORE_DTIM */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_IGNORE_DTIM;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->ignoreDtim;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_LISTEN_INTERVAL */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_LISTEN_INTERVAL;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->listenInterval;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_MAX_PS_POLL */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_MAX_PS_POLL;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->maxPsPoll;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_MIN_RSSI_THRESHOLD */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_MIN_RSSI_THRESHOLD;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->minRssiThreshold;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_NTH_BEACON_FILTER */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_NTH_BEACON_FILTER;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->nthBeaconFilter;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->fEnableBeaconEarlyTermination;
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL */
+   tlvStruct->type = QWLAN_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->bcnEarlyTermWakeInterval;
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE */
+   tlvStruct->type = QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->numBeaconPerRssiAverage;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   /* QWLAN_HAL_CFG_PS_RSSI_FILTER_PERIOD */
+   tlvStruct->type = QWLAN_HAL_CFG_PS_RSSI_FILTER_PERIOD;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = (tANI_U32)pPowerSaveCfg->rssiFilterPeriod;
+
+   tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
+   wdiPowerSaveCfg->uConfigBufferLen = (tANI_U8 *)tlvStruct - tlvStructStart ;
+
+   wdiPowerSaveCfg->wdiReqStatusCB = NULL;
+
+   /* store Params pass it to WDI */
+   pWdaParams->wdaMsgParam = configParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiPowerSaveCfg;
+   pWdaParams->pWdaContext = pWDA;
+
+   status = WDI_SetPwrSaveCfgReq(wdiPowerSaveCfg, 
+                                 (WDI_SetPwrSaveCfgCb)WDA_SetPwrSaveCfgReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set Pwr Save CFG REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   vos_mem_free(pPowerSaveCfg);
+
+   return CONVERT_WDI2VOS_STATUS(status);
+}
+
+/*
+ * FUNCTION: WDA_SetUapsdAcParamsReqCallback
+ * 
+ */ 
+void WDA_SetUapsdAcParamsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams);
+
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_SetUapsdAcParamsReq
+ * Request to WDI to set the UAPSD params for an ac (sta mode).
+ */ 
+VOS_STATUS WDA_SetUapsdAcParamsReq(v_PVOID_t pVosContext, v_U8_t staIdx,
+                                                 tUapsdInfo *pUapsdInfo)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   tWDA_CbContext *pWDA = NULL ; 
+   WDI_SetUapsdAcParamsReqParamsType *wdiUapsdParams = 
+      (WDI_SetUapsdAcParamsReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_SetUapsdAcParamsReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiUapsdParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiUapsdParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiUapsdParams->wdiUapsdInfo.ucAc = pUapsdInfo->ac;
+   wdiUapsdParams->wdiUapsdInfo.uDelayInterval = pUapsdInfo->delayInterval;
+   wdiUapsdParams->wdiUapsdInfo.uSrvInterval = pUapsdInfo->srvInterval;
+   wdiUapsdParams->wdiUapsdInfo.ucSTAIdx = pUapsdInfo->staidx;
+   wdiUapsdParams->wdiUapsdInfo.uSusInterval = pUapsdInfo->susInterval;
+   wdiUapsdParams->wdiUapsdInfo.ucUp = pUapsdInfo->up;
+
+   wdiUapsdParams->wdiReqStatusCB = NULL;
+
+   pWDA = vos_get_context( VOS_MODULE_ID_WDA, pVosContext );
+
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pUapsdInfo;
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiUapsdParams;
+
+   status = WDI_SetUapsdAcParamsReq(wdiUapsdParams, 
+              (WDI_SetUapsdAcParamsCb)WDA_SetUapsdAcParamsReqCallback,
+              pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set UAPSD params REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams);
+   }
+
+   if((WDI_STATUS_SUCCESS == status) || (WDI_STATUS_PENDING == status))
+     return VOS_STATUS_SUCCESS;
+   else
+     return VOS_STATUS_E_FAILURE;
+
+
+
+}
+/* 
+ * FUNCTION: WDA_ClearUapsdAcParamsReq 
+ * Currently the WDA API is a NOP. It has been added for symmetry & Also it was
+ * decided that the if the UPASD parameters change, FW would get a exit UAPSD
+ * and again enter the UPASD with the modified params. Hence the disable
+ * function was kept empty.
+ * 
+ */
+VOS_STATUS WDA_ClearUapsdAcParamsReq(v_PVOID_t pVosContext, v_U8_t staIdx, wpt_uint8 ac)
+{
+   /* do nothing */
+   return VOS_STATUS_SUCCESS;
+}
+
+/*
+ * FUNCTION: WDA_UpdateUapsdParamsReqCallback
+ * 
+ */ 
+void WDA_UpdateUapsdParamsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL;
+
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+           "WDA_UpdateUapsdParamsReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateUapsdParamsReq
+ * Request to WDI to update UAPSD params (in softAP mode) for a station.
+ */ 
+VOS_STATUS WDA_UpdateUapsdParamsReq(tWDA_CbContext *pWDA, 
+                                    tUpdateUapsdParams* pUpdateUapsdInfo)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_UpdateUapsdReqParamsType *wdiUpdateUapsdParams = 
+      (WDI_UpdateUapsdReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_UpdateUapsdReqParamsType)) ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiUpdateUapsdParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiUpdateUapsdParams->wdiUpdateUapsdInfo.uMaxSpLen = pUpdateUapsdInfo->maxSpLen;
+   wdiUpdateUapsdParams->wdiUpdateUapsdInfo.ucSTAIdx = pUpdateUapsdInfo->staIdx;
+   wdiUpdateUapsdParams->wdiUpdateUapsdInfo.ucUapsdACMask = pUpdateUapsdInfo->uapsdACMask;
+
+   if((NULL != pWDA->wdaMsgParam) ||
+                  (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      vos_mem_free(wdiUpdateUapsdParams);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Store param pointer as passed in by caller */
+   pWDA->wdaMsgParam = pUpdateUapsdInfo;
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiUpdateUapsdParams;
+
+   status = WDI_UpdateUapsdParamsReq(wdiUpdateUapsdParams, 
+                                     (WDI_UpdateUapsdParamsCb)WDA_UpdateUapsdParamsReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set UAPSD params REQ WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWDA->wdaMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ConfigureRxpFilterCallback
+ * 
+ */ 
+void WDA_ConfigureRxpFilterCallback(WDI_Status   wdiStatus, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(WDI_STATUS_SUCCESS != wdiStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: RXP config filter failure \n", __FUNCTION__ );
+   }
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams->wdaMsgParam);
+   vos_mem_free(pWdaParams);
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessConfigureRxpFilterReq
+ * 
+ */ 
+VOS_STATUS WDA_ProcessConfigureRxpFilterReq(tWDA_CbContext *pWDA, 
+                          tSirWlanSetRxpFilters *pWlanSuspendParam)
+{
+   
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_ConfigureRxpFilterReqParamsType *wdiRxpFilterParams = 
+      (WDI_ConfigureRxpFilterReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_ConfigureRxpFilterReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiRxpFilterParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pWlanSuspendParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiRxpFilterParams);
+      vos_mem_free(pWlanSuspendParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilter = 
+             pWlanSuspendParam->setMcstBcstFilter;
+   wdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilterSetting = 
+             pWlanSuspendParam->configuredMcstBcstFilterSetting;
+   
+   wdiRxpFilterParams->wdiReqStatusCB = NULL;
+
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pWlanSuspendParam;
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiRxpFilterParams;
+
+   status = WDI_ConfigureRxpFilterReq(wdiRxpFilterParams, 
+                      (WDI_ConfigureRxpFilterCb)WDA_ConfigureRxpFilterCallback,
+                      pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in configure RXP filter REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_WdiIndicationCallback
+ * 
+ */ 
+void WDA_WdiIndicationCallback( WDI_Status   wdiStatus,
+                                void*        pUserData)
+{
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+}
+
+/*
+ * FUNCTION: WDA_ProcessWlanSuspendInd
+ * 
+ */ 
+VOS_STATUS WDA_ProcessWlanSuspendInd(tWDA_CbContext *pWDA,
+                              tSirWlanSuspendParam *pWlanSuspendParam)
+{
+   WDI_Status wdiStatus;
+   WDI_SuspendParamsType wdiSuspendParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   wdiSuspendParams.wdiSuspendParams.ucConfiguredMcstBcstFilterSetting =
+                          pWlanSuspendParam->configuredMcstBcstFilterSetting;
+   wdiSuspendParams.wdiReqStatusCB = WDA_WdiIndicationCallback;
+   wdiSuspendParams.pUserData = pWDA;
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "%s: %d" ,__FUNCTION__, pWlanSuspendParam->configuredMcstBcstFilterSetting);
+
+   WDA_STOP_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
+
+   wdiStatus = WDI_HostSuspendInd(&wdiSuspendParams);
+   if(WDI_STATUS_PENDING == wdiStatus)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "Pending received for %s:%d ",__FUNCTION__,__LINE__ );
+
+   }
+   else if( WDI_STATUS_SUCCESS_SYNC != wdiStatus )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in %s:%d ",__FUNCTION__,__LINE__ );
+   }
+
+   vos_mem_free(pWlanSuspendParam);
+   return CONVERT_WDI2VOS_STATUS(wdiStatus) ;
+}
+
+
+
+/*
+ * FUNCTION: WDA_ProcessWlanResumeCallback
+ * 
+ */ 
+void WDA_ProcessWlanResumeCallback(
+                        WDI_SuspendResumeRspParamsType   *resumeRspParams,
+                        void*        pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if(WDI_STATUS_SUCCESS != resumeRspParams->wdiStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Process Wlan Resume failure \n", __FUNCTION__ );
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   vos_mem_free(pWdaParams->wdaMsgParam);
+   vos_mem_free(pWdaParams);
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessWlanResumeReq
+ * 
+ */ 
+VOS_STATUS WDA_ProcessWlanResumeReq(tWDA_CbContext *pWDA,
+                              tSirWlanResumeParam *pWlanResumeParam)
+{
+   WDI_Status wdiStatus;
+   WDI_ResumeParamsType *wdiResumeParams = 
+            (WDI_ResumeParamsType *)vos_mem_malloc(
+                                 sizeof(WDI_ResumeParamsType) ) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiResumeParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiResumeParams);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiResumeParams->wdiResumeParams.ucConfiguredMcstBcstFilterSetting =
+                          pWlanResumeParam->configuredMcstBcstFilterSetting;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "%s: %d" ,__FUNCTION__, pWlanResumeParam->configuredMcstBcstFilterSetting);
+   wdiResumeParams->wdiReqStatusCB = NULL;
+   pWdaParams->wdaMsgParam = pWlanResumeParam;
+   pWdaParams->wdaWdiApiMsgParam = wdiResumeParams;
+   pWdaParams->pWdaContext = pWDA;
+
+   WDA_START_TIMER(&pWDA->wdaTimers.baActivityChkTmr) ;
+
+   wdiStatus = WDI_HostResumeReq(wdiResumeParams, 
+                      (WDI_HostResumeEventRspCb)WDA_ProcessWlanResumeCallback,
+                      pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(wdiStatus))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Host Resume REQ WDI API, free all the memory " );
+      VOS_ASSERT(0);
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(wdiStatus) ;
+}
+
+
+
+/*
+ * FUNCTION: WDA_SetBeaconFilterReqCallback
+ * 
+ */ 
+void WDA_SetBeaconFilterReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+   /* 
+    * No respone required for SetBeaconFilter req so just free the request 
+    * param here
+    */
+
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_SetBeaconFilterReq
+ * Request to WDI to send the beacon filtering related information.
+ */ 
+VOS_STATUS WDA_SetBeaconFilterReq(tWDA_CbContext *pWDA, 
+                                  tBeaconFilterMsg* pBeaconFilterInfo)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS;
+   tANI_U8            *dstPtr, *srcPtr;
+   tANI_U8             filterLength;
+   WDI_BeaconFilterReqParamsType *wdiBeaconFilterInfo = 
+            (WDI_BeaconFilterReqParamsType *)vos_mem_malloc(
+                                 sizeof(WDI_BeaconFilterReqParamsType) ) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiBeaconFilterInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiBeaconFilterInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiBeaconFilterInfo->wdiBeaconFilterInfo.usBeaconInterval = 
+      pBeaconFilterInfo->beaconInterval;
+   wdiBeaconFilterInfo->wdiBeaconFilterInfo.usCapabilityInfo = 
+      pBeaconFilterInfo->capabilityInfo;
+   wdiBeaconFilterInfo->wdiBeaconFilterInfo.usCapabilityMask = 
+      pBeaconFilterInfo->capabilityMask;
+   wdiBeaconFilterInfo->wdiBeaconFilterInfo.usIeNum = pBeaconFilterInfo->ieNum;
+
+   //Fill structure with info contained in the beaconFilterTable
+   dstPtr = (tANI_U8 *)wdiBeaconFilterInfo + sizeof(WDI_BeaconFilterInfoType);
+   srcPtr = (tANI_U8 *)pBeaconFilterInfo + sizeof(tBeaconFilterMsg);
+   filterLength = wdiBeaconFilterInfo->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe);
+   if(WDI_BEACON_FILTER_LEN < filterLength)
+   {
+      filterLength = WDI_BEACON_FILTER_LEN;
+   }
+   vos_mem_copy(dstPtr, srcPtr, filterLength);
+
+   wdiBeaconFilterInfo->wdiReqStatusCB = NULL;
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiBeaconFilterInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pBeaconFilterInfo;
+
+
+   status = WDI_SetBeaconFilterReq(wdiBeaconFilterInfo, 
+                                   (WDI_SetBeaconFilterCb)WDA_SetBeaconFilterReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set Beacon Filter REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_RemBeaconFilterReqCallback
+ * 
+ */ 
+void WDA_RemBeaconFilterReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL;
+   
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_RemBeaconFilterReqCallback invoked " );
+
+   return ;
+}
+
+    // TODO: PE does not have this feature for now implemented,
+    // but the support for removing beacon filter exists between
+    // HAL and FW. This function can be called whenever PE defines
+    // a new message for beacon filter removal
+
+/*
+ * FUNCTION: WDA_RemBeaconFilterReq
+ * Request to WDI to send the removal of beacon filtering related information.
+ */ 
+VOS_STATUS WDA_RemBeaconFilterReq(tWDA_CbContext *pWDA, 
+                                  tRemBeaconFilterMsg* pBeaconFilterInfo)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_RemBeaconFilterReqParamsType *wdiBeaconFilterInfo = 
+      (WDI_RemBeaconFilterReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_RemBeaconFilterReqParamsType) + pBeaconFilterInfo->ucIeCount) ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiBeaconFilterInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucIeCount = 
+      pBeaconFilterInfo->ucIeCount;
+
+   //Fill structure with info contained in the ucRemIeId
+   vos_mem_copy(wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucRemIeId, 
+                pBeaconFilterInfo->ucRemIeId,
+                wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucIeCount);
+   wdiBeaconFilterInfo->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) ||
+                  (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      vos_mem_free(wdiBeaconFilterInfo);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   /* Store param pointer as passed in by caller */
+   pWDA->wdaMsgParam = pBeaconFilterInfo;
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiBeaconFilterInfo;
+
+   status = WDI_RemBeaconFilterReq(wdiBeaconFilterInfo, 
+                                   (WDI_RemBeaconFilterCb)WDA_RemBeaconFilterReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Remove Beacon Filter REQ WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWDA->wdaMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_SetRSSIThresholdsReqCallback
+ * 
+ */ 
+void WDA_SetRSSIThresholdsReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_SetRSSIThresholdsReq
+ * Request to WDI to set the RSSI thresholds (sta mode).
+ */ 
+VOS_STATUS WDA_SetRSSIThresholdsReq(tpAniSirGlobal pMac, tSirRSSIThresholds *pBmpsThresholds)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   tWDA_CbContext *pWDA = NULL ;
+   v_PVOID_t pVosContext = NULL; 
+   WDI_SetRSSIThresholdsReqParamsType *wdiRSSIThresholdsInfo = 
+      (WDI_SetRSSIThresholdsReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_SetRSSIThresholdsReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiRSSIThresholdsInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiRSSIThresholdsInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bReserved10 = pBmpsThresholds->bReserved10;
+
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold1 = pBmpsThresholds->ucRssiThreshold1;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold2 = pBmpsThresholds->ucRssiThreshold2;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold3 = pBmpsThresholds->ucRssiThreshold3;
+
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres1NegNotify = pBmpsThresholds->bRssiThres1NegNotify;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres2NegNotify = pBmpsThresholds->bRssiThres2NegNotify;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres3NegNotify = pBmpsThresholds->bRssiThres3NegNotify;
+
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres1PosNotify = pBmpsThresholds->bRssiThres1PosNotify;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres2PosNotify = pBmpsThresholds->bRssiThres2PosNotify;
+   wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres3PosNotify = pBmpsThresholds->bRssiThres3PosNotify;
+
+   wdiRSSIThresholdsInfo->wdiReqStatusCB = NULL;
+
+   pVosContext = vos_get_global_context(VOS_MODULE_ID_PE, (void *)pMac);
+   pWDA = vos_get_context( VOS_MODULE_ID_WDA, pVosContext );
+
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiRSSIThresholdsInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pBmpsThresholds;
+
+   status = WDI_SetRSSIThresholdsReq(wdiRSSIThresholdsInfo, 
+                                     (WDI_SetRSSIThresholdsCb)WDA_SetRSSIThresholdsReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set RSSI thresholds REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_SetRSSIThresholdsReq*/
+
+/*
+ * FUNCTION: WDA_HostOffloadReqCallback
+ * 
+ */ 
+void WDA_HostOffloadReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams->wdaMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_HostOffloadReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessHostOffloadReq
+ * Request to WDI to set the filter to minimize unnecessary host wakeup due 
+ * to broadcast traffic   (sta mode).
+ */ 
+VOS_STATUS WDA_ProcessHostOffloadReq(tWDA_CbContext *pWDA, 
+                                     tSirHostOffloadReq *pHostOffloadParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_HostOffloadReqParamsType *wdiHostOffloadInfo = 
+      (WDI_HostOffloadReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_HostOffloadReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s: offloadType=%x" ,__FUNCTION__, pHostOffloadParams->offloadType);
+
+   if(NULL == wdiHostOffloadInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiHostOffloadInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiHostOffloadInfo->wdiHostOffloadInfo.ucOffloadType = 
+      pHostOffloadParams->offloadType;
+   wdiHostOffloadInfo->wdiHostOffloadInfo.ucEnableOrDisable = 
+      pHostOffloadParams->enableOrDisable;
+
+   switch (wdiHostOffloadInfo->wdiHostOffloadInfo.ucOffloadType)
+   {
+      case SIR_IPV4_ARP_REPLY_OFFLOAD:
+         vos_mem_copy(wdiHostOffloadInfo->wdiHostOffloadInfo.params.aHostIpv4Addr,
+                   pHostOffloadParams->params.hostIpv4Addr,
+                   4);
+         break;
+      case SIR_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
+         vos_mem_copy(wdiHostOffloadInfo->wdiHostOffloadInfo.params.aHostIpv6Addr,
+                   pHostOffloadParams->params.hostIpv6Addr,
+                   16);
+         break;
+      case SIR_IPV6_NS_OFFLOAD:
+         vos_mem_copy(wdiHostOffloadInfo->wdiHostOffloadInfo.params.aHostIpv6Addr,
+                   pHostOffloadParams->params.hostIpv6Addr,
+                   16);
+
+#ifdef WLAN_NS_OFFLOAD
+         if(pHostOffloadParams->nsOffloadInfo.srcIPv6AddrValid)
+         {
+            vos_mem_copy(wdiHostOffloadInfo->wdiNsOffloadParams.srcIPv6Addr,
+                   pHostOffloadParams->nsOffloadInfo.srcIPv6Addr,
+                   16);
+            wdiHostOffloadInfo->wdiNsOffloadParams.srcIPv6AddrValid = 1;
+         }
+         else
+         {
+            wdiHostOffloadInfo->wdiNsOffloadParams.srcIPv6AddrValid = 0;
+         }
+
+         vos_mem_copy(wdiHostOffloadInfo->wdiNsOffloadParams.selfIPv6Addr,
+                   pHostOffloadParams->nsOffloadInfo.selfIPv6Addr,
+                   16);
+         vos_mem_copy(wdiHostOffloadInfo->wdiNsOffloadParams.selfMacAddr,
+                   pHostOffloadParams->nsOffloadInfo.selfMacAddr,
+                   6);
+
+         //Only two are supported so let's go through them without a loop
+         if(pHostOffloadParams->nsOffloadInfo.targetIPv6AddrValid[0])
+         {
+            vos_mem_copy(wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr1,
+                      pHostOffloadParams->nsOffloadInfo.targetIPv6Addr[0],
+                      16);
+            wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr1Valid = 1;
+         }
+         else
+         {
+            wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr1Valid = 0;
+         }
+
+         if(pHostOffloadParams->nsOffloadInfo.targetIPv6AddrValid[1])
+         {
+            vos_mem_copy(wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr2,
+                      pHostOffloadParams->nsOffloadInfo.targetIPv6Addr[1],
+                      16);
+            wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr2Valid = 1;
+         }
+         else
+         {
+            wdiHostOffloadInfo->wdiNsOffloadParams.targetIPv6Addr2Valid = 0;
+         }
+         break;
+#endif //WLAN_NS_OFFLOAD
+      default:
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "No Handling for Offload Type %x in WDA " 
+                                  , wdiHostOffloadInfo->wdiHostOffloadInfo.ucOffloadType);
+         //WDA_VOS_ASSERT(0) ;
+      }
+   }
+
+   wdiHostOffloadInfo->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) ||
+                  (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiHostOffloadInfo);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiHostOffloadInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pHostOffloadParams;
+
+   status = WDI_HostOffloadReq(wdiHostOffloadInfo, 
+                               (WDI_HostOffloadCb)WDA_HostOffloadReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in host offload REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_HostOffloadReq*/
+
+/*
+ * FUNCTION: WDA_KeepAliveReqCallback
+ * 
+ */ 
+void WDA_KeepAliveReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   vos_mem_free(pWDA->wdaWdiApiMsgParam);
+   vos_mem_free(pWDA->wdaMsgParam);
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL; 
+   
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_KeepAliveReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessKeepAliveReq
+ * Request to WDI to send Keep Alive packets to minimize unnecessary host 
+ * wakeup due to broadcast traffic   (sta mode).
+ */ 
+VOS_STATUS WDA_ProcessKeepAliveReq(tWDA_CbContext *pWDA, 
+                                   tSirKeepAliveReq *pKeepAliveParams)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    WDI_KeepAliveReqParamsType *wdiKeepAliveInfo = 
+      (WDI_KeepAliveReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_KeepAliveReqParamsType)) ;
+
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+    if(NULL == wdiKeepAliveInfo) 
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+        VOS_ASSERT(0);
+        return VOS_STATUS_E_NOMEM;
+    }
+
+    wdiKeepAliveInfo->wdiKeepAliveInfo.ucPacketType = 
+      pKeepAliveParams->packetType;
+    wdiKeepAliveInfo->wdiKeepAliveInfo.ucTimePeriod = 
+      pKeepAliveParams->timePeriod;
+
+    if(pKeepAliveParams->packetType == SIR_KEEP_ALIVE_UNSOLICIT_ARP_RSP)
+    {
+       vos_mem_copy(&wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr,
+                    pKeepAliveParams->hostIpv4Addr,
+                    SIR_IPV4_ADDR_LEN);
+       vos_mem_copy(&wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr,
+                    pKeepAliveParams->destIpv4Addr,
+                    SIR_IPV4_ADDR_LEN);   
+       vos_mem_copy(&wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr,
+                    pKeepAliveParams->destMacAddr,
+                    SIR_MAC_ADDR_LEN);
+    }
+    else if(pKeepAliveParams->packetType == SIR_KEEP_ALIVE_NULL_PKT)
+    {
+        vos_mem_set(&wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr,
+                    SIR_IPV4_ADDR_LEN,
+                    0);
+        vos_mem_set(&wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr,
+                    SIR_IPV4_ADDR_LEN,
+                    0);   
+        vos_mem_set(&wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr,
+                    SIR_MAC_ADDR_LEN,
+                    0);
+    }
+
+    wdiKeepAliveInfo->wdiReqStatusCB = NULL;
+
+    if((NULL != pWDA->wdaMsgParam) ||
+       (NULL != pWDA->wdaWdiApiMsgParam))
+    {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiKeepAliveInfo);
+      return VOS_STATUS_E_FAILURE;
+    }
+
+    /* Store param pointer as passed in by caller */
+    pWDA->wdaMsgParam = pKeepAliveParams;
+    /* store Params pass it to WDI */
+    pWDA->wdaWdiApiMsgParam = (void *)wdiKeepAliveInfo;
+
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,"WDA HIP : %d.%d.%d.%d",
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[0],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[1],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[2],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[3]); 
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,"WDA DIP : %d.%d.%d.%d",
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr[0],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr[1],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr[2],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestIpv4Addr[3]); 
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA DMAC : %d:%d:%d:%d:%d:%d",
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[0],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[1],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[2],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[3],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[4],
+              wdiKeepAliveInfo->wdiKeepAliveInfo.aDestMacAddr[5]); 
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
+              "TimePeriod %d PacketType %d", 
+              wdiKeepAliveInfo->wdiKeepAliveInfo.ucTimePeriod,
+              wdiKeepAliveInfo->wdiKeepAliveInfo.ucPacketType); 
+
+    status = WDI_KeepAliveReq(wdiKeepAliveInfo, 
+                             (WDI_KeepAliveCb)WDA_KeepAliveReqCallback, pWDA);
+
+    if(IS_WDI_STATUS_FAILURE(status))
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                   "Failure in Keep Alive REQ WDI API, free all the memory " );
+        vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+        vos_mem_free(pWDA->wdaMsgParam);
+        pWDA->wdaWdiApiMsgParam = NULL;
+        pWDA->wdaMsgParam = NULL;
+    }
+
+    return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_KeepAliveReq*/
+
+/*
+ * FUNCTION: WDA_WowlAddBcPtrnReqCallback
+ * 
+ */ 
+void WDA_WowlAddBcPtrnReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams->wdaMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessWowlAddBcPtrnReq
+ * Request to WDI to add WOWL Bcast pattern
+ */ 
+VOS_STATUS WDA_ProcessWowlAddBcPtrnReq(tWDA_CbContext *pWDA, 
+                                       tSirWowlAddBcastPtrn *pWowlAddBcPtrnParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_WowlAddBcPtrnReqParamsType *wdiWowlAddBcPtrnInfo = 
+      (WDI_WowlAddBcPtrnReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_WowlAddBcPtrnReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiWowlAddBcPtrnInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiWowlAddBcPtrnInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternId = 
+      pWowlAddBcPtrnParams->ucPatternId;
+   wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternByteOffset = 
+      pWowlAddBcPtrnParams->ucPatternByteOffset;
+   wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMaskSize = 
+      pWowlAddBcPtrnParams->ucPatternMaskSize;
+   wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize = 
+      pWowlAddBcPtrnParams->ucPatternSize;
+
+   if (wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize <= WDI_WOWL_BCAST_PATTERN_MAX_SIZE)
+   {
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPattern,
+                    pWowlAddBcPtrnParams->ucPattern,
+                    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize);
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMask,
+                    pWowlAddBcPtrnParams->ucPatternMask,
+                    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMaskSize);
+   }
+   else
+   {
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPattern,
+                    pWowlAddBcPtrnParams->ucPattern,
+                    WDI_WOWL_BCAST_PATTERN_MAX_SIZE);
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMask,
+                    pWowlAddBcPtrnParams->ucPatternMask,
+                    WDI_WOWL_BCAST_PATTERN_MAX_SIZE);
+
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternExt,
+                    pWowlAddBcPtrnParams->ucPatternExt,
+                    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize - WDI_WOWL_BCAST_PATTERN_MAX_SIZE);
+       vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMaskExt,
+                    pWowlAddBcPtrnParams->ucPatternMaskExt,
+                    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternMaskSize - WDI_WOWL_BCAST_PATTERN_MAX_SIZE);
+   }
+
+   wdiWowlAddBcPtrnInfo->wdiReqStatusCB = NULL;
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiWowlAddBcPtrnInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pWowlAddBcPtrnParams;
+
+   status = WDI_WowlAddBcPtrnReq(wdiWowlAddBcPtrnInfo, 
+                                 (WDI_WowlAddBcPtrnCb)WDA_WowlAddBcPtrnReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Wowl add Bcast ptrn REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_ProcessWowlAddBcPtrnReq*/
+
+/*
+ * FUNCTION: WDA_WowlDelBcPtrnReqCallback
+ * 
+ */ 
+void WDA_WowlDelBcPtrnReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams->wdaMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessWowlDelBcPtrnReq
+ * Request to WDI to delete WOWL Bcast pattern
+ */ 
+VOS_STATUS WDA_ProcessWowlDelBcPtrnReq(tWDA_CbContext *pWDA, 
+                                       tSirWowlDelBcastPtrn *pWowlDelBcPtrnParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_WowlDelBcPtrnReqParamsType *wdiWowlDelBcPtrnInfo = 
+      (WDI_WowlDelBcPtrnReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_WowlDelBcPtrnReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiWowlDelBcPtrnInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiWowlDelBcPtrnInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiWowlDelBcPtrnInfo->wdiWowlDelBcPtrnInfo.ucPatternId = 
+      pWowlDelBcPtrnParams->ucPatternId;
+
+   wdiWowlDelBcPtrnInfo->wdiReqStatusCB = NULL;
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiWowlDelBcPtrnInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pWowlDelBcPtrnParams;
+
+   status = WDI_WowlDelBcPtrnReq(wdiWowlDelBcPtrnInfo, 
+                                 (WDI_WowlDelBcPtrnCb)WDA_WowlDelBcPtrnReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Wowl delete Bcast ptrn REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_ProcessWowlDelBcPtrnReq*/
+
+/*
+ * FUNCTION: WDA_WowlEnterReqCallback
+ * 
+ */ 
+void WDA_WowlEnterReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   tSirHalWowlEnterParams *pWowlEnterParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+   pWowlEnterParams =  (tSirHalWowlEnterParams *)pWdaParams->wdaMsgParam ;
+
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+
+   pWowlEnterParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   WDA_SendMsg(pWDA, WDA_WOWL_ENTER_RSP, (void *)pWowlEnterParams , 0) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessWowlEnterReq
+ * Request to WDI to enter WOWL 
+ */ 
+VOS_STATUS WDA_ProcessWowlEnterReq(tWDA_CbContext *pWDA, 
+                                   tSirHalWowlEnterParams *pWowlEnterParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_WowlEnterReqParamsType *wdiWowlEnterInfo = 
+      (WDI_WowlEnterReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_WowlEnterReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiWowlEnterInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiWowlEnterInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   vos_mem_copy(wdiWowlEnterInfo->wdiWowlEnterInfo.magicPtrn,
+                pWowlEnterParams->magicPtrn,
+                sizeof(tSirMacAddr));
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucMagicPktEnable = 
+      pWowlEnterParams->ucMagicPktEnable;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucPatternFilteringEnable = 
+      pWowlEnterParams->ucPatternFilteringEnable;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucUcastPatternFilteringEnable = 
+      pWowlEnterParams->ucUcastPatternFilteringEnable;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowChnlSwitchRcv = 
+      pWowlEnterParams->ucWowChnlSwitchRcv;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowDeauthRcv = 
+      pWowlEnterParams->ucWowDeauthRcv;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowDisassocRcv = 
+      pWowlEnterParams->ucWowDisassocRcv;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowMaxMissedBeacons = 
+      pWowlEnterParams->ucWowMaxMissedBeacons;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowMaxSleepUsec = 
+      pWowlEnterParams->ucWowMaxSleepUsec;
+
+#ifdef WLAN_WAKEUP_EVENTS
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWoWEAPIDRequestEnable = 
+      pWowlEnterParams->ucWoWEAPIDRequestEnable;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWoWEAPOL4WayEnable =
+      pWowlEnterParams->ucWoWEAPOL4WayEnable;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowNetScanOffloadMatch = 
+      pWowlEnterParams->ucWowNetScanOffloadMatch;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowGTKRekeyError = 
+      pWowlEnterParams->ucWowGTKRekeyError;
+
+   wdiWowlEnterInfo->wdiWowlEnterInfo.ucWoWBSSConnLoss = 
+      pWowlEnterParams->ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+
+   wdiWowlEnterInfo->wdiReqStatusCB = NULL;
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiWowlEnterInfo;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pWowlEnterParams;
+
+   status = WDI_WowlEnterReq(wdiWowlEnterInfo, 
+                             (WDI_WowlEnterReqCb)WDA_WowlEnterReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Wowl enter REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_ProcessWowlEnterReq*/
+
+/*
+ * FUNCTION: WDA_WowlExitReqCallback
+ * 
+ */ 
+void WDA_WowlExitReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   WDA_SendMsg(pWDA, WDA_WOWL_EXIT_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessWowlExitReq
+ * Request to WDI to add WOWL Bcast pattern
+ */ 
+VOS_STATUS WDA_ProcessWowlExitReq(tWDA_CbContext *pWDA)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   status = WDI_WowlExitReq((WDI_WowlExitReqCb)WDA_WowlExitReqCallback, pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Wowl exit REQ WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWDA->wdaMsgParam);
+      pWDA->wdaWdiApiMsgParam = NULL;
+      pWDA->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_ProcessWowlExitReq*/
+
+/*
+ * FUNCTION: WDA_IsHwFrameTxTranslationCapable
+ * Request to WDI to determine whether a given station is capable of 
+ * using HW-based frame translation
+ */ 
+v_BOOL_t WDA_IsHwFrameTxTranslationCapable(v_PVOID_t pVosGCtx, 
+                                                      tANI_U8 staIdx)
+{
+   return WDI_IsHwFrameTxTranslationCapable(staIdx);
+}
+
+/*
+ * FUNCTION: WDA_NvDownloadReqCallback
+ * send NV Download RSP back to PE
+ */ 
+void WDA_NvDownloadReqCallback(WDI_NvDownloadRspInfoType *pNvDownloadRspParams, 
+                                                            void* pUserData)
+{
+
+   tWDA_CbContext *pWDA= ( tWDA_CbContext *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   /*Cleaning */
+   vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+   pWDA->wdaWdiApiMsgParam = NULL;
+   pWDA->wdaMsgParam = NULL;
+
+   vos_WDAComplete_cback(pWDA->pVosContext);
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessNvDownloadReq
+ * Read the NV blob to a buffer and send a request to WDI to download the blob to NV memory.
+ */ 
+VOS_STATUS WDA_NVDownload_Start(v_PVOID_t pVosContext)
+{
+   /* Initialize the local Variables*/
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+   v_VOID_t *pNvBuffer=NULL;
+   v_SIZE_t bufferSize = 0;
+   WDI_Status status = WDI_STATUS_E_FAILURE;
+   WDI_NvDownloadReqParamsType * wdiNvDownloadReqParam =NULL;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pWDA) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA is NULL", __FUNCTION__); 
+      return VOS_STATUS_E_FAILURE;
+   }
+   if(NULL != pWDA->wdaWdiApiMsgParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   /* Get the NV structure base address and size from VOS */
+   vos_nv_getNVBuffer(&pNvBuffer,&bufferSize);
+
+   wdiNvDownloadReqParam = (WDI_NvDownloadReqParamsType *)vos_mem_malloc(
+                                          sizeof(WDI_NvDownloadReqParamsType)) ;
+
+   if(NULL == wdiNvDownloadReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Copy Params to wdiNvDownloadReqParam*/
+   wdiNvDownloadReqParam->wdiBlobInfo.pBlobAddress = pNvBuffer;
+   wdiNvDownloadReqParam->wdiBlobInfo.uBlobSize = bufferSize;
+
+   /* store Params pass it to WDI */
+   pWDA->wdaWdiApiMsgParam = (void *)wdiNvDownloadReqParam ;
+
+   wdiNvDownloadReqParam->wdiReqStatusCB = NULL ;
+
+   status = WDI_NvDownloadReq(wdiNvDownloadReqParam, 
+                    (WDI_NvDownloadRspCb)WDA_NvDownloadReqCallback,(void *)pWDA);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "Failure in NV Download REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
+      pWDA->wdaWdiApiMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+/*
+ * FUNCTION: WDA_FlushAcReqCallback
+ * send Flush AC RSP back to TL
+ */ 
+void WDA_FlushAcReqCallback(WDI_Status status, void* pUserData)
+{
+   vos_msg_t wdaMsg = {0} ;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tFlushACReq *pFlushACReqParams;
+   tFlushACRsp *pFlushACRspParams;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   pFlushACReqParams = (tFlushACReq *)pWdaParams->wdaMsgParam;
+   pFlushACRspParams = vos_mem_malloc(sizeof(tFlushACRsp));
+   if(NULL == pFlushACRspParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return ;
+   }
+   vos_mem_zero(pFlushACRspParams,sizeof(tFlushACRsp));   
+   pFlushACRspParams->mesgLen = sizeof(tFlushACRsp);
+   pFlushACRspParams->mesgType = WDA_TL_FLUSH_AC_RSP;
+   pFlushACRspParams->ucSTAId = pFlushACReqParams->ucSTAId;
+   pFlushACRspParams->ucTid = pFlushACReqParams->ucTid;
+   pFlushACRspParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams);
+
+   wdaMsg.type = WDA_TL_FLUSH_AC_RSP ; 
+   wdaMsg.bodyptr = (void *)pFlushACRspParams;
+   // POST message to TL
+   vos_mq_post_message(VOS_MQ_ID_TL, (vos_msg_t *) &wdaMsg);
+
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessFlushAcReq
+ * Request to WDI to Update the DELBA REQ params.
+ */ 
+VOS_STATUS WDA_ProcessFlushAcReq(tWDA_CbContext *pWDA, 
+                                 tFlushACReq *pFlushAcReqParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_FlushAcReqParamsType *wdiFlushAcReqParam = 
+               (WDI_FlushAcReqParamsType *)vos_mem_malloc(
+                                       sizeof(WDI_FlushAcReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   if(NULL == wdiFlushAcReqParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiFlushAcReqParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   wdiFlushAcReqParam->wdiFlushAcInfo.ucSTAId = pFlushAcReqParams->ucSTAId;
+   wdiFlushAcReqParam->wdiFlushAcInfo.ucTid = pFlushAcReqParams->ucTid;
+   wdiFlushAcReqParam->wdiFlushAcInfo.usMesgLen = pFlushAcReqParams->mesgLen;
+   wdiFlushAcReqParam->wdiFlushAcInfo.usMesgType = pFlushAcReqParams->mesgType;
+
+   /* Store Flush AC pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pFlushAcReqParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiFlushAcReqParam;
+
+   status = WDI_FlushAcReq(wdiFlushAcReqParam, 
+                           (WDI_FlushAcRspCb)WDA_FlushAcReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Flush AC REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      //TODO: respond to TL with failure
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+/*
+ * FUNCTION: WDA_BtAmpEventReqCallback
+ * 
+ */ 
+void WDA_BtAmpEventReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA; 
+   WDI_BtAmpEventParamsType *wdiBtAmpEventParam; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   wdiBtAmpEventParam = (WDI_BtAmpEventParamsType *)pWdaParams->wdaWdiApiMsgParam;
+   if(BTAMP_EVENT_CONNECTION_TERMINATED == 
+      wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType)
+   {
+      pWDA->wdaAmpSessionOn = VOS_FALSE;
+   }
+
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+   /* 
+    * No respone required for WDA_SIGNAL_BTAMP_EVENT so just free the request 
+    * param here
+    */
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessBtAmpEventReq
+ * Request to WDI to Update with BT AMP events.
+ */ 
+VOS_STATUS WDA_ProcessBtAmpEventReq(tWDA_CbContext *pWDA, 
+                                    tSmeBtAmpEvent *pBtAmpEventParams)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_BtAmpEventParamsType *wdiBtAmpEventParam = 
+            (WDI_BtAmpEventParamsType *)vos_mem_malloc(
+                                 sizeof(WDI_BtAmpEventParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiBtAmpEventParam) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiBtAmpEventParam);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType = 
+      pBtAmpEventParams->btAmpEventType;
+
+   wdiBtAmpEventParam->wdiReqStatusCB = NULL;
+
+   /* Store BT AMP event pointer, as this will be used for response */
+   /* store Params pass it to WDI */
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pBtAmpEventParams;
+   pWdaParams->wdaWdiApiMsgParam = wdiBtAmpEventParam;
+
+   status = WDI_BtAmpEventReq(wdiBtAmpEventParam, 
+                              (WDI_BtAmpEventRspCb)WDA_BtAmpEventReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in BT AMP event REQ Params WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   if(BTAMP_EVENT_CONNECTION_START == wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType)
+   {
+      pWDA->wdaAmpSessionOn = VOS_TRUE;
+   }
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}
+
+
+#ifdef ANI_MANF_DIAG
+/*
+ * FUNCTION: WDA_FTMCommandReqCallback
+ * Handle FTM CMD response came from HAL
+ * Route responce to HDD FTM
+ */ 
+void WDA_FTMCommandReqCallback(void *ftmCmdRspData,
+                               void *usrData)
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)usrData ;
+
+   if((NULL == pWDA) || (NULL == ftmCmdRspData))
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s, invalid input 0x%x, 0x%x",__FUNCTION__,  pWDA, ftmCmdRspData);
+      return;
+   }
+
+   /* Release Current FTM Command Request */
+   vos_mem_free(pWDA->wdaFTMCmdReq);
+   pWDA->wdaFTMCmdReq = NULL;
+
+#ifndef WLAN_FTM_STUB
+   /* Post FTM Responce to HDD FTM */
+   wlan_sys_ftm(ftmCmdRspData);
+#endif /* WLAN_FTM_STUB */
+
+   return;
+}
+
+/*
+ * FUNCTION: WDA_ProcessFTMCommand
+ * Send FTM command to WDI
+ */ 
+VOS_STATUS WDA_ProcessFTMCommand(tWDA_CbContext *pWDA, 
+                                 tPttMsgbuffer  *pPTTFtmCmd)
+{
+   WDI_Status             status = WDI_STATUS_SUCCESS;
+   WDI_FTMCommandReqType *ftmCMDReq = NULL;
+
+   ftmCMDReq = (WDI_FTMCommandReqType *)
+                vos_mem_malloc(sizeof(WDI_FTMCommandReqType));
+   if(NULL == ftmCMDReq)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "WDA FTM Command buffer alloc fail");
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   ftmCMDReq->bodyLength     = pPTTFtmCmd->msgBodyLength;
+   ftmCMDReq->FTMCommandBody = (void *)pPTTFtmCmd;
+
+   pWDA->wdaFTMCmdReq        = (void *)ftmCMDReq;
+
+   /* Send command to WDI */
+   status = WDI_FTMCommandReq(ftmCMDReq, WDA_FTMCommandReqCallback, pWDA);
+
+   return status;
+}
+#endif /* ANI_MANF_DIAG */
+
+/*
+ * FUNCTION: WDA_SetTxPerTrackingReqCallback
+ * 
+ */ 
+void WDA_SetTxPerTrackingReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   if(NULL != pWdaParams->wdaMsgParam)
+   {
+      vos_mem_free(pWdaParams->wdaMsgParam);
+   }
+
+   if(NULL != pWdaParams->wdaWdiApiMsgParam)
+   {
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   }
+   
+   vos_mem_free(pWdaParams);
+
+   return ;
+}
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/*
+ * FUNCTION: WDA_HostOffloadReqCallback
+ * 
+ */ 
+void WDA_GTKOffloadReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   VOS_ASSERT(NULL != pWdaParams);
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_GTKOffloadReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessGTKOffloadReq
+ * Request to WDI to set the filter to minimize unnecessary host wakeup due 
+ * to broadcast traffic   (sta mode).
+ */ 
+VOS_STATUS WDA_ProcessGTKOffloadReq(tWDA_CbContext *pWDA, 
+                                    tpSirGtkOffloadParams pGtkOffloadParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_GtkOffloadReqMsg *wdiGtkOffloadReqMsg = 
+      (WDI_GtkOffloadReqMsg *)vos_mem_malloc(
+         sizeof(WDI_GtkOffloadReqMsg)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiGtkOffloadReqMsg) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiGtkOffloadReqMsg);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   //
+   // Fill wdiGtkOffloadInfo from pGtkOffloadParams
+   //
+   wdiGtkOffloadReqMsg->gtkOffloadReqParams.ulFlags = pGtkOffloadParams->ulFlags;
+   // Copy KCK
+   vos_mem_copy(&(wdiGtkOffloadReqMsg->gtkOffloadReqParams.aKCK[0]), &(pGtkOffloadParams->aKCK[0]), 16);
+   // Copy KEK
+   vos_mem_copy(&(wdiGtkOffloadReqMsg->gtkOffloadReqParams.aKEK[0]), &(pGtkOffloadParams->aKEK[0]), 16);
+   // Copy KeyReplayCounter
+   vos_mem_copy(&(wdiGtkOffloadReqMsg->gtkOffloadReqParams.ullKeyReplayCounter), 
+                &(pGtkOffloadParams->ullKeyReplayCounter), sizeof(v_U64_t));
+
+   wdiGtkOffloadReqMsg->wdiReqStatusCB = NULL;
+
+   VOS_ASSERT((NULL == pWDA->wdaMsgParam) && 
+              (NULL == pWDA->wdaWdiApiMsgParam));
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiGtkOffloadReqMsg;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pGtkOffloadParams;
+
+   status = WDI_GTKOffloadReq(wdiGtkOffloadReqMsg, (WDI_GtkOffloadCb)WDA_GTKOffloadReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in WDA_ProcessGTKOffloadReq(), free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_GtkOffloadGetInfoCallback 
+ * 
+ */ 
+void WDA_GtkOffloadGetInfoCallback(WDI_Status status, void * pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoReq;
+   tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp = vos_mem_malloc(sizeof(tpSirGtkOffloadGetInfoRspParams)) ;
+   tANI_U8 i;
+   vos_msg_t vosMsg;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   VOS_ASSERT(NULL != pWdaParams);
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+   pGtkOffloadGetInfoReq = (tpSirGtkOffloadGetInfoRspParams)pWdaParams->wdaMsgParam;
+
+   // Fill pGtkOffloadGetInfoRsp from tSirGtkOffloadGetInfoRspParams
+   vos_mem_zero(pGtkOffloadGetInfoRsp, sizeof(tSirGtkOffloadGetInfoRspParams));
+
+   /* Message Header */
+   pGtkOffloadGetInfoRsp->mesgType = eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP;
+   pGtkOffloadGetInfoRsp->mesgLen = sizeof(tpSirGtkOffloadGetInfoRspParams);
+
+   pGtkOffloadGetInfoRsp->ulStatus            = pGtkOffloadGetInfoReq->ulStatus;
+   pGtkOffloadGetInfoRsp->ullKeyReplayCounter = pGtkOffloadGetInfoReq->ullKeyReplayCounter;
+   pGtkOffloadGetInfoRsp->ulTotalRekeyCount   = pGtkOffloadGetInfoReq->ulTotalRekeyCount;
+   pGtkOffloadGetInfoRsp->ulGTKRekeyCount     = pGtkOffloadGetInfoReq->ulGTKRekeyCount;
+   pGtkOffloadGetInfoRsp->ulIGTKRekeyCount    = pGtkOffloadGetInfoReq->ulIGTKRekeyCount;
+
+   /* VOS message wrapper */
+   vosMsg.type = eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP;
+   vosMsg.bodyptr = (void *)pGtkOffloadGetInfoRsp;
+   vosMsg.bodyval = 0;
+
+   if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+   {
+      /* free the mem and return */
+      vos_mem_free((v_VOID_t *) pGtkOffloadGetInfoRsp);
+   }
+
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+}
+#endif
+
+/*
+ * FUNCTION: WDA_ProcessSetTxPerTrackingReq
+ * Request to WDI to set Tx Per Tracking configurations
+ */ 
+VOS_STATUS WDA_ProcessSetTxPerTrackingReq(tWDA_CbContext *pWDA, tSirTxPerTrackingParam *pTxPerTrackingParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_SetTxPerTrackingReqParamsType *pwdiSetTxPerTrackingReqParams = 
+      (WDI_SetTxPerTrackingReqParamsType *)vos_mem_malloc(
+         sizeof(WDI_SetTxPerTrackingReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiSetTxPerTrackingReqParams) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      vos_mem_free(pTxPerTrackingParams);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      vos_mem_free(pwdiSetTxPerTrackingReqParams);
+      vos_mem_free(pTxPerTrackingParams);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingEnable = 
+      pTxPerTrackingParams->ucTxPerTrackingEnable;
+   pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingPeriod = 
+      pTxPerTrackingParams->ucTxPerTrackingPeriod;
+   pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingRatio = 
+      pTxPerTrackingParams->ucTxPerTrackingRatio;
+   pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.uTxPerTrackingWatermark = 
+      pTxPerTrackingParams->uTxPerTrackingWatermark;
+
+   pwdiSetTxPerTrackingReqParams->wdiReqStatusCB = NULL;
+
+   /* Store param pointer as passed in by caller */
+   /* store Params pass it to WDI 
+      Ideally, the memory allocated here will be free at WDA_SetTxPerTrackingReqCallback */
+   pWdaParams->wdaWdiApiMsgParam = pwdiSetTxPerTrackingReqParams;
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = pTxPerTrackingParams;
+
+   status = WDI_SetTxPerTrackingReq(pwdiSetTxPerTrackingReqParams, 
+                                    (WDI_SetTxPerTrackingRspCb)WDA_SetTxPerTrackingReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set Tx PER REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+
+}/*WDA_ProcessSetTxPerTrackingReq*/
+
+/*
+ * FUNCTION: WDA_HALDumpCmdCallback
+ * Send the VOS complete . 
+ */
+void WDA_HALDumpCmdCallback(WDI_HALDumpCmdRspParamsType *wdiRspParams, 
+                                                            void* pUserData)
+{
+   tANI_U8 *buffer = NULL;
+   tWDA_CbContext *pWDA = NULL;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   pWDA = pWdaParams->pWdaContext;
+   buffer = (tANI_U8 *)pWdaParams->wdaMsgParam;
+
+   if(wdiRspParams->usBufferLen > 0)
+   {
+      /*Copy the Resp data to UMAC supplied buffer*/
+      vos_mem_copy(buffer, wdiRspParams->pBuffer, wdiRspParams->usBufferLen);
+   }
+
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams);
+   
+   /* Indicate VOSS about the start complete */
+   vos_WDAComplete_cback(pWDA->pVosContext);
+
+   return ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessHALDumpCmdReq
+ * Send Dump command to WDI
+ */ 
+VOS_STATUS WDA_HALDumpCmdReq(tpAniSirGlobal   pMac, tANI_U32  cmd, 
+                 tANI_U32   arg1, tANI_U32   arg2, tANI_U32   arg3,
+                 tANI_U32   arg4, tANI_U8   *pBuffer)
+{
+   WDI_Status             status = WDI_STATUS_SUCCESS;
+   WDI_HALDumpCmdReqParamsType *wdiHALDumpCmdReqParam = NULL;
+   WDI_HALDumpCmdReqInfoType *wdiHalDumpCmdInfo = NULL ;
+   tWDA_ReqParams *pWdaParams ;
+   pVosContextType pVosContext = NULL; 
+   VOS_STATUS vStatus;
+
+   pVosContext = (pVosContextType)vos_get_global_context(VOS_MODULE_ID_PE,
+                                                           (void *)pMac);
+   
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   /* Allocate memory WDI request structure*/
+   wdiHALDumpCmdReqParam = (WDI_HALDumpCmdReqParamsType *)
+                vos_mem_malloc(sizeof(WDI_HALDumpCmdReqParamsType));
+   if(NULL == wdiHALDumpCmdReqParam)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "WDA HAL DUMP Command buffer alloc fail");
+      vos_mem_free(pWdaParams);
+      return WDI_STATUS_E_FAILURE;
+   }
+
+   wdiHalDumpCmdInfo = &wdiHALDumpCmdReqParam->wdiHALDumpCmdInfoType;
+
+   /* Extract the arguments */
+   wdiHalDumpCmdInfo->command     = cmd;
+   wdiHalDumpCmdInfo->argument1   = arg1;
+   wdiHalDumpCmdInfo->argument2   = arg2;
+   wdiHalDumpCmdInfo->argument3   = arg3;
+   wdiHalDumpCmdInfo->argument4   = arg4;
+
+   wdiHALDumpCmdReqParam->wdiReqStatusCB = NULL ;
+
+   pWdaParams->pWdaContext = pVosContext->pWDAContext;
+   
+   /*  Response message will be passed through the buffer */
+   pWdaParams->wdaMsgParam = (void *)pBuffer;
+   
+   /* store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)wdiHALDumpCmdReqParam ;
+
+   /* Send command to WDI */
+   status = WDI_HALDumpCmdReq(wdiHALDumpCmdReqParam, WDA_HALDumpCmdCallback, pWdaParams);
+
+   vStatus = vos_wait_single_event( &(pVosContext->wdaCompleteEvent), 1000 );
+
+   if ( vStatus != VOS_STATUS_SUCCESS )
+   {
+      if ( vStatus == VOS_STATUS_E_TIMEOUT )
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Timeout occured before WDA_HALDUMP complete\n",__FUNCTION__);
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: WDA_HALDUMP reporting  other error \n",__FUNCTION__);
+      }
+      VOS_ASSERT(0);
+   }
+   return status;
+}
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/*
+ * FUNCTION: WDA_ProcessGTKOffloadgetInfoReq
+ * Request to WDI to get GTK Offload Information
+ */ 
+VOS_STATUS WDA_ProcessGTKOffloadGetInfoReq(tWDA_CbContext *pWDA, 
+                                           tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_GtkOffloadGetInfoReqMsg *pwdiGtkOffloadGetInfoReqMsg = 
+      (WDI_GtkOffloadGetInfoReqMsg *)vos_mem_malloc(sizeof(WDI_GtkOffloadGetInfoReqMsg));
+   tWDA_ReqParams *pWdaParams ;
+
+   if(NULL == pwdiGtkOffloadGetInfoReqMsg) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiGtkOffloadGetInfoReqMsg);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pwdiGtkOffloadGetInfoReqMsg->wdiReqStatusCB = NULL;
+
+   VOS_ASSERT((NULL == pWDA->wdaMsgParam) && 
+              (NULL == pWDA->wdaWdiApiMsgParam));
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiGtkOffloadGetInfoReqMsg;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pGtkOffloadGetInfoRsp;
+
+   status = WDI_GTKOffloadGetInfoReq(pwdiGtkOffloadGetInfoReqMsg, (WDI_GtkOffloadGetInfoCb)WDA_GtkOffloadGetInfoCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      /* failure returned by WDI API */
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in WDA_ProcessGTKOffloadGetInfoReq(), free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      pGtkOffloadGetInfoRsp->ulStatus = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_GTK_OFFLOAD_GETINFO_RSP, (void *)pGtkOffloadGetInfoRsp, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+/*
+ * -------------------------------------------------------------------------
+ * DATA interface with WDI for Mgmt Frames
+ * ------------------------------------------------------------------------- 
+ */
+
+/*
+ * FUNCTION: WDA_TxComplete
+ * Callback function for the WDA_TxPacket
+ */ 
+VOS_STATUS WDA_TxComplete( v_PVOID_t pVosContext, vos_pkt_t *pData, 
+                                                VOS_STATUS status )
+{
+   
+   tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+   tpAniSirGlobal pMac = (tpAniSirGlobal)VOS_GET_MAC_CTXT((void *)pVosContext) ;
+
+   if(NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA is NULL", 
+                           __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /*check whether the callback is null or not,made null during WDA_TL_TX_FRAME_TIMEOUT timeout*/
+   if( NULL!=wdaContext->pTxCbFunc) 
+   {
+      /*check if packet is freed already*/
+      if(vos_atomic_set_U32(&wdaContext->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED) == (v_U32_t)pData)
+      {
+         wdaContext->pTxCbFunc(pMac, pData); 
+      }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_WARN,
+                           "%s:packet (0x%X) is already freed", 
+                           __FUNCTION__, pData);
+         //Return from here since we reaching here because the packet already timeout
+         return status;
+      }
+
+   }
+
+   /* 
+    * Trigger the event to bring the HAL TL Tx complete function to come 
+    * out of wait 
+    * Let the coe above to complete the packet first. When this event is set,
+    * the thread waiting for the event may run and set Vospacket_freed causing the original
+    * packet not being freed.
+    */
+   status  = vos_event_set(&wdaContext->txFrameEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                      "NEW VOS Event Set failed - status = %d \n", status);
+   }
+
+   return status;
+}
+
+/*
+ * FUNCTION: WDA_TxPacket
+ * Forward TX management frame to WDI
+ */ 
+VOS_STATUS WDA_TxPacket(tWDA_CbContext *pWDA, 
+                           void *pFrmBuf,
+                           tANI_U16 frmLen,
+                           eFrameType frmType,
+                           eFrameTxDir txDir,
+                           tANI_U8 tid,
+                           pWDATxRxCompFunc pCompFunc,
+                           void *pData,
+                           pWDAAckFnTxComp pAckTxComp,
+                           tANI_U8 txFlag)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS ;
+   tpSirMacFrameCtl pFc = (tpSirMacFrameCtl ) pData;
+   tANI_U8 ucTypeSubType = pFc->type <<4 | pFc->subType;
+   tANI_U8 eventIdx = 0;
+   tBssSystemRole systemRole = eSYSTEM_UNKNOWN_ROLE;
+   tpAniSirGlobal pMac;
+
+   if((NULL == pWDA)||(NULL == pFrmBuf)) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA %x or pFrmBuf %x is NULL", 
+                           __FUNCTION__,pWDA,pFrmBuf); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH, 
+               "Tx Mgmt Frame Subtype: %d alloc(%x)\n", pFc->subType, pFrmBuf);
+
+   pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+   if(NULL == pMac)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pMac is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   
+   
+   /* store the call back function in WDA context */
+   pWDA->pTxCbFunc = pCompFunc;
+   /* store the call back for the function of ackTxComplete */
+   if( pAckTxComp )
+   {
+      if( NULL == pWDA->pAckTxCbFunc )
+      {
+         txFlag |= HAL_TXCOMP_REQUESTED_MASK;
+         pWDA->pAckTxCbFunc = pAckTxComp;
+         if( VOS_STATUS_SUCCESS !=
+                 WDA_START_TIMER(&pWDA->wdaTimers.TxCompleteTimer) ) 
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                "Tx Complete Timer Start Failed ");
+            pWDA->pAckTxCbFunc = NULL;
+            pCompFunc(VOS_GET_MAC_CTXT(pWDA->pVosContext), (vos_pkt_t *)pFrmBuf);
+            return VOS_STATUS_E_FAILURE;
+         }
+      }
+      else
+      {
+         /* Already TxComp is active no need to active again */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                       "There is already one request pending for tx complete\n");
+         pCompFunc(pWDA->pVosContext, (vos_pkt_t *)pFrmBuf);
+         return VOS_STATUS_E_FAILURE;
+      }
+   } 
+
+   /* Reset the event to be not signalled */
+   status = vos_event_reset(&pWDA->txFrameEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                            "VOS Event reset failed - status = %d\n",status);
+      pCompFunc(pWDA->pVosContext, (vos_pkt_t *)pFrmBuf);
+      if( pAckTxComp )
+      {
+         pWDA->pAckTxCbFunc = NULL;
+         if( VOS_STATUS_SUCCESS !=
+                           WDA_STOP_TIMER(&pWDA->wdaTimers.TxCompleteTimer))
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                "Tx Complete timeout Timer Stop Failed ");
+         }
+      }
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Get system role, use the self station if in unknown role or STA role */
+   systemRole = wdaGetGlobalSystemRole(pMac);
+
+   if (( eSYSTEM_UNKNOWN_ROLE == systemRole ) || 
+       (( eSYSTEM_STA_ROLE == systemRole )
+#ifdef FEATURE_WLAN_CCX
+      && frmType == HAL_TXRX_FRM_802_11_MGMT
+#endif
+            ))
+   {
+       txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
+   }
+
+   /* Do not divert Disassoc/Deauth frames through self station because a delay of
+    * 300ms is added beofre trigerring DEL STA so let deuath gets delivered at TIM */
+   if ((pFc->type == SIR_MAC_MGMT_FRAME)) 
+   {
+       if ((pFc->subType == SIR_MAC_MGMT_DISASSOC) || 
+               (pFc->subType == SIR_MAC_MGMT_DEAUTH) || 
+               (pFc->subType == SIR_MAC_MGMT_REASSOC_RSP) || 
+               (pFc->subType == SIR_MAC_MGMT_PROBE_REQ)) 
+       {
+           if( (systemRole == eSYSTEM_AP_ROLE) && ( (pFc->subType == SIR_MAC_MGMT_DEAUTH) ||
+                                                    (pFc->subType == SIR_MAC_MGMT_DISASSOC) ) )
+           {
+              /*Do not request self STA for deauth/disassoc let it go through peer STA and
+               *broadcast STA and get delivered at TIM for power save stations*/
+           }
+           else
+           {
+             /*Send Probe request frames on self sta idx*/
+             txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
+           }
+       } 
+       /* Since we donot want probe responses to be retried, send probe responses
+          through the NO_ACK queues */
+       if (pFc->subType == SIR_MAC_MGMT_PROBE_RSP) 
+       {
+           //probe response is sent out using self station and no retries options.
+           txFlag |= (HAL_USE_NO_ACK_REQUESTED_MASK | HAL_USE_SELF_STA_REQUESTED_MASK);
+       }
+       if(VOS_TRUE == pWDA->wdaAmpSessionOn)
+       {
+          txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+       }
+   }
+   
+   vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)pFrmBuf);/*set VosPacket_freed to pFrmBuf*/
+
+   /*Set frame tag to 0 
+     We will use the WDA user data in order to tag a frame as expired*/
+   vos_pkt_set_user_data_ptr( (vos_pkt_t *)pFrmBuf, VOS_PKT_USER_DATA_ID_WDA, 
+                       (v_PVOID_t)0);
+   
+
+   if((status = WLANTL_TxMgmtFrm(pWDA->pVosContext, (vos_pkt_t *)pFrmBuf, 
+                     frmLen, ucTypeSubType, tid, 
+                     WDA_TxComplete, NULL, txFlag)) != VOS_STATUS_SUCCESS) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                       "Sending Mgmt Frame failed - status = %d\n", status);
+      pCompFunc(VOS_GET_MAC_CTXT(pWDA->pVosContext), (vos_pkt_t *)pFrmBuf);
+      vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED);/*reset the VosPacket_freed*/
+      if( pAckTxComp )
+      {
+         pWDA->pAckTxCbFunc = NULL;
+         if( VOS_STATUS_SUCCESS !=
+                           WDA_STOP_TIMER(&pWDA->wdaTimers.TxCompleteTimer))
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                "Tx Complete timeout Timer Stop Failed ");
+         }
+      } 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* 
+    * Wait for the event to be set by the TL, to get the response of TX 
+    * complete, this event should be set by the Callback function called by TL 
+    */
+   status = vos_wait_events(&pWDA->txFrameEvent, 1, WDA_TL_TX_FRAME_TIMEOUT,
+                            &eventIdx);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
+                 "%s: Status %d when waiting for TX Frame Event",
+                 __FUNCTION__, status);
+
+      pWDA->pTxCbFunc = NULL;   /*To stop the limTxComplete being called again  , 
+                                after the packet gets completed(packet freed once)*/
+
+      /* check whether the packet was freed already,so need not free again when 
+      * TL calls the WDA_Txcomplete routine
+      */
+      if(vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED) == (v_U32_t)pFrmBuf) 
+      {
+         pCompFunc(VOS_GET_MAC_CTXT(pWDA->pVosContext), (vos_pkt_t *)pFrmBuf);
+      }
+      if( pAckTxComp )
+      {
+         pWDA->pAckTxCbFunc = NULL;
+         if( VOS_STATUS_SUCCESS !=
+                           WDA_STOP_TIMER(&pWDA->wdaTimers.TxCompleteTimer))
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                "Tx Complete timeout Timer Stop Failed ");
+         }
+      }
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   return status;
+}
+
+
+/*
+ * FUNCTION: WDA_McProcessMsg
+ * Trigger DAL-AL to start CFG download 
+ */ 
+VOS_STATUS WDA_McProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg )
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   tWDA_CbContext *pWDA = NULL ; 
+
+   if(NULL == pMsg) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pMsg is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_LOW,
+                    "=========> %s msgType: %x " ,__FUNCTION__, pMsg->type);
+   
+   pWDA = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA, pVosContext );
+   if(NULL == pWDA )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Process all the WDA messages.. */
+   switch( pMsg->type )
+   {
+      case WNI_CFG_DNLD_REQ:
+      {
+         status = WDA_WniCfgDnld(pWDA);
+
+         /* call WDA complete event if config download success */
+         if( VOS_IS_STATUS_SUCCESS(status) )
+         {
+            vos_WDAComplete_cback(pVosContext);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                     "WDA Config Download failure" );
+         }
+         break ;
+      }
+
+      /* 
+       * Init SCAN request from PE, convert it into DAL format 
+       * and send it to DAL 
+       */ 
+      case WDA_INIT_SCAN_REQ:
+      {
+         WDA_ProcessInitScanReq(pWDA, (tInitScanParams *)pMsg->bodyptr) ;
+         break ;    
+      }
+      /* start SCAN request from PE */
+      case WDA_START_SCAN_REQ:
+      {
+         WDA_ProcessStartScanReq(pWDA, (tStartScanParams *)pMsg->bodyptr) ;
+         break ;    
+      }
+      /* end SCAN request from PE */
+      case WDA_END_SCAN_REQ:
+      {
+         WDA_ProcessEndScanReq(pWDA, (tEndScanParams *)pMsg->bodyptr) ;
+         break ;
+      }
+      /* end SCAN request from PE */
+      case WDA_FINISH_SCAN_REQ:
+      {
+         WDA_ProcessFinishScanReq(pWDA, (tFinishScanParams *)pMsg->bodyptr) ;
+         break ;    
+      }
+      /* join request from PE */
+      case WDA_CHNL_SWITCH_REQ:
+      {
+         if(WDA_PRE_ASSOC_STATE == pWDA->wdaState)
+         {
+            WDA_ProcessJoinReq(pWDA, (tSwitchChannelParams *)pMsg->bodyptr) ;
+         }
+         else
+         {
+            WDA_ProcessChannelSwitchReq(pWDA, 
+                                 (tSwitchChannelParams*)pMsg->bodyptr) ;
+         }
+         break ;
+      }
+      /* ADD BSS request from PE */
+      case WDA_ADD_BSS_REQ:
+      {
+         WDA_ProcessConfigBssReq(pWDA, (tAddBssParams*)pMsg->bodyptr) ;
+         break ;
+      }
+      case WDA_ADD_STA_REQ:
+      {
+         WDA_ProcessAddStaReq(pWDA, (tAddStaParams *)pMsg->bodyptr) ;
+         break ;
+      }
+      case WDA_DELETE_BSS_REQ:
+      {
+         wpt_uint8  staIdx;
+         wpt_uint8  bssIdx = ((tDeleteBssParams *)pMsg->bodyptr)->bssIdx;
+         wpt_uint8  reservedResourceBySta;
+         wpt_uint8  waitLoop = 0;
+
+         if (WDI_DS_GetStaIdxFromBssIdx(pWDA->pWdiContext, bssIdx, &staIdx))
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Get STA index from BSS index Fail", __FUNCTION__);
+            VOS_ASSERT(0) ;
+         }
+         while (1) 
+         {
+             reservedResourceBySta = WDI_DS_GetReservedResCountPerSTA(pWDA->pWdiContext, WDI_DATA_POOL_ID, staIdx);
+             /* Wait till reserved resource by STA must be none */
+             if (reservedResourceBySta == 0)
+             {
+                 VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                            "STA %d BSS %d TX RING empty %d", staIdx, bssIdx );
+                 break;
+
+             }
+             else
+             {
+                 if(waitLoop > WDA_MAX_RETRIES_TILL_RING_EMPTY)
+                 {
+                     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                                "TX Ring could not empty, not normal" );
+                     VOS_ASSERT(0);
+                     break;
+                 }
+                 vos_sleep(WDA_WAIT_MSEC_TILL_RING_EMPTY);
+                 waitLoop++;
+             }
+         }
+         WDA_ProcessDelBssReq(pWDA, (tDeleteBssParams *)pMsg->bodyptr) ;
+         break ;
+      }
+      case WDA_DELETE_STA_REQ:
+      {
+         tDeleteStaParams *delSta = (tDeleteStaParams *)pMsg->bodyptr;
+         wpt_uint8 reservedResourceBySta;
+         wpt_uint8  waitLoop = 0;
+
+         while (1) 
+         {
+             reservedResourceBySta = WDI_DS_GetReservedResCountPerSTA(pWDA->pWdiContext, WDI_DATA_POOL_ID, delSta->staIdx);
+             /* Wait till reserved resource by STA must be none */
+             if (reservedResourceBySta == 0)
+             {
+                 VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                            "STA %d TX RING empty %d", delSta->staIdx );
+                 break;
+             }
+             else
+             {
+                 if(waitLoop > WDA_MAX_RETRIES_TILL_RING_EMPTY)
+                 {
+                     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                                "TX Ring could not empty, not normal" );
+                     VOS_ASSERT(0);
+                     break;
+                 }
+                 vos_sleep(WDA_WAIT_MSEC_TILL_RING_EMPTY);
+                 waitLoop++;
+             }
+         }
+         WDA_ProcessDelStaReq(pWDA, (tDeleteStaParams *)pMsg->bodyptr) ;
+         break ;
+      }
+      case WDA_CONFIG_PARAM_UPDATE_REQ:
+      {
+         WDA_UpdateCfg(pWDA, (tSirMsgQ *)pMsg) ;
+         break ;
+      }
+      case WDA_SET_BSSKEY_REQ:
+      {
+         WDA_ProcessSetBssKeyReq(pWDA, (tSetBssKeyParams *)pMsg->bodyptr);
+         break ;
+      }
+      case WDA_SET_STAKEY_REQ:
+      {
+         WDA_ProcessSetStaKeyReq(pWDA, (tSetStaKeyParams *)pMsg->bodyptr);
+         break ;
+      }
+      case WDA_SET_STA_BCASTKEY_REQ:
+      {
+         WDA_ProcessSetBcastStaKeyReq(pWDA, (tSetStaKeyParams *)pMsg->bodyptr);
+         break ;
+      }
+      case WDA_REMOVE_BSSKEY_REQ:
+      {
+         WDA_ProcessRemoveBssKeyReq(pWDA, 
+                                    (tRemoveBssKeyParams *)pMsg->bodyptr);
+         break ;
+      }
+      case WDA_REMOVE_STAKEY_REQ:
+      {
+         WDA_ProcessRemoveStaKeyReq(pWDA, 
+                                    (tRemoveStaKeyParams *)pMsg->bodyptr);
+         break ;
+      }
+      case WDA_REMOVE_STA_BCASTKEY_REQ:
+      {
+         /* TODO: currently UMAC is not sending this request, Add the code for 
+         handling this request when UMAC supports */
+         break;
+      }
+#ifdef FEATURE_WLAN_CCX
+      case WDA_TSM_STATS_REQ:
+      {
+         WDA_ProcessTsmStatsReq(pWDA, (tTSMStats *)pMsg->bodyptr);
+         break;
+      }
+#endif
+      case WDA_UPDATE_EDCA_PROFILE_IND:
+      {
+         WDA_ProcessUpdateEDCAParamReq(pWDA, (tEdcaParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_ADD_TS_REQ:
+      {
+         WDA_ProcessAddTSReq(pWDA, (tAddTsParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_DEL_TS_REQ:
+      {
+         WDA_ProcessDelTSReq(pWDA, (tDelTsParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_ADDBA_REQ:
+      {
+         WDA_ProcessAddBASessionReq(pWDA, (tAddBAParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_DELBA_IND:
+      {
+         WDA_ProcessDelBAReq(pWDA, (tDelBAParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_SET_LINK_STATE:
+      {
+         WDA_ProcessSetLinkState(pWDA, (tLinkStateParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_GET_STATISTICS_REQ:
+      {
+         WDA_ProcessGetStatsReq(pWDA, (tAniGetPEStatsReq *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_PWR_SAVE_CFG:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessSetPwrSaveCfgReq(pWDA, (tSirPowerSaveCfg *)pMsg->bodyptr);
+         }
+         else
+         {
+            if(NULL != pMsg->bodyptr)
+            {
+               vos_mem_free(pMsg->bodyptr);
+            }
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_PWR_SAVE_CFG req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_ENTER_IMPS_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessEnterImpsReq(pWDA);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_ENTER_IMPS_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_EXIT_IMPS_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessExitImpsReq(pWDA);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_EXIT_IMPS_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_ENTER_BMPS_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessEnterBmpsReq(pWDA, (tEnterBmpsParams *)pMsg->bodyptr);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_ENTER_BMPS_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_EXIT_BMPS_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessExitBmpsReq(pWDA, (tExitBmpsParams *)pMsg->bodyptr);
+         }
+         else
+         {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_EXIT_BMPS_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_ENTER_UAPSD_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessEnterUapsdReq(pWDA, (tUapsdParams *)pMsg->bodyptr);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_ENTER_UAPSD_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_EXIT_UAPSD_REQ:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_ProcessExitUapsdReq(pWDA);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_EXIT_UAPSD_REQ req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+      case WDA_UPDATE_UAPSD_IND:
+      {
+         if(pWDA->wdaState == WDA_READY_STATE)
+         {
+            WDA_UpdateUapsdParamsReq(pWDA, (tUpdateUapsdParams *)pMsg->bodyptr);
+         }
+         else
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                       "WDA_UPDATE_UAPSD_IND req in wrong state %d", pWDA->wdaState );
+         }
+         break;
+      }
+
+      case WDA_REGISTER_PE_CALLBACK :
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
+                           "Handling msg type WDA_REGISTER_PE_CALLBACK " );
+         /*TODO: store the PE callback */
+         /* Do Nothing? MSG Body should be freed at here */
+         if(NULL != pMsg->bodyptr)
+         {
+            vos_mem_free(pMsg->bodyptr);
+         }
+         break;
+      }
+      case WDA_SYS_READY_IND :
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
+                                  "Handling msg type WDA_SYS_READY_IND " );
+         pWDA->wdaState = WDA_READY_STATE;
+         if(NULL != pMsg->bodyptr)
+         {
+            vos_mem_free(pMsg->bodyptr);
+         }
+         break;
+      }
+      case WDA_BEACON_FILTER_IND  :
+      {
+         WDA_SetBeaconFilterReq(pWDA, (tBeaconFilterMsg *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_BTC_SET_CFG:
+      {
+         /*TODO: handle this while dealing with BTC */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
+                                  "Handling msg type WDA_BTC_SET_CFG  " );
+         /* Do Nothing? MSG Body should be freed at here */
+         if(NULL != pMsg->bodyptr)
+         {
+            vos_mem_free(pMsg->bodyptr);
+         }
+         break;
+      }
+      case WDA_SIGNAL_BT_EVENT:
+      {
+         /*TODO: handle this while dealing with BTC */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
+                                  "Handling msg type WDA_SIGNAL_BT_EVENT  " );
+         /* Do Nothing? MSG Body should be freed at here */
+         if(NULL != pMsg->bodyptr)
+         {
+            vos_mem_free(pMsg->bodyptr);
+         }
+         break;
+      }
+      case WDA_CFG_RXP_FILTER_REQ:
+      {
+         WDA_ProcessConfigureRxpFilterReq(pWDA, 
+                             (tSirWlanSetRxpFilters *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_SET_HOST_OFFLOAD:
+      {
+         WDA_ProcessHostOffloadReq(pWDA, (tSirHostOffloadReq *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_SET_KEEP_ALIVE:
+      {
+         WDA_ProcessKeepAliveReq(pWDA, (tSirKeepAliveReq *)pMsg->bodyptr);
+         break;
+      }
+#ifdef WLAN_NS_OFFLOAD
+      case WDA_SET_NS_OFFLOAD:
+      {
+         WDA_ProcessHostOffloadReq(pWDA, (tSirHostOffloadReq *)pMsg->bodyptr);
+         break;
+      }
+#endif //WLAN_NS_OFFLOAD
+      case WDA_ADD_STA_SELF_REQ:
+      {
+         WDA_ProcessAddStaSelfReq(pWDA, (tAddStaSelfParams *)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_DEL_STA_SELF_REQ:
+      {
+         WDA_ProcessDelSTASelfReq(pWDA, (tDelStaSelfParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_WOWL_ADD_BCAST_PTRN:
+      {
+         WDA_ProcessWowlAddBcPtrnReq(pWDA, (tSirWowlAddBcastPtrn *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_WOWL_DEL_BCAST_PTRN:
+      {
+         WDA_ProcessWowlDelBcPtrnReq(pWDA, (tSirWowlDelBcastPtrn *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_WOWL_ENTER_REQ:
+      {
+         WDA_ProcessWowlEnterReq(pWDA, (tSirHalWowlEnterParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_WOWL_EXIT_REQ:
+      {
+         WDA_ProcessWowlExitReq(pWDA);
+         break;
+      }
+      case WDA_TL_FLUSH_AC_REQ:
+      {
+         WDA_ProcessFlushAcReq(pWDA, (tFlushACReq *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_SIGNAL_BTAMP_EVENT:
+      {
+         WDA_ProcessBtAmpEventReq(pWDA, (tSmeBtAmpEvent *)pMsg->bodyptr);
+         break;
+      }
+#ifdef WDA_UT
+      case WDA_WDI_EVENT_MSG:
+      {
+         WDI_processEvent(pMsg->bodyptr,(void *)pMsg->bodyval);
+         break ;
+      }
+#endif
+      case WDA_UPDATE_BEACON_IND:
+      {
+          WDA_ProcessUpdateBeaconParams(pWDA, 
+                                    (tUpdateBeaconParams *)pMsg->bodyptr);
+          break;
+      }
+      case WDA_SEND_BEACON_REQ:
+      {
+          WDA_ProcessSendBeacon(pWDA, (tSendbeaconParams *)pMsg->bodyptr);
+          break;
+      }
+      case WDA_UPDATE_PROBE_RSP_TEMPLATE_IND:
+      {
+          WDA_ProcessUpdateProbeRspTemplate(pWDA, 
+                                      (tSendProbeRespParams *)pMsg->bodyptr);
+          break;
+      }
+#if defined(WLAN_FEATURE_VOWIFI) || defined(FEATURE_WLAN_CCX)
+      case WDA_SET_MAX_TX_POWER_REQ:
+      {
+         WDA_ProcessSetMaxTxPowerReq(pWDA,
+                                       (tMaxTxPowerParams *)pMsg->bodyptr);
+         break;
+      }
+#endif
+#ifdef WLAN_FEATURE_P2P
+      case WDA_SET_P2P_GO_NOA_REQ:
+      {
+         WDA_ProcessSetP2PGONOAReq(pWDA,
+                                    (tP2pPsParams *)pMsg->bodyptr);
+         break;
+      }
+#endif
+      /* timer related messages */
+      case WDA_TIMER_BA_ACTIVITY_REQ:
+      {
+         WDA_BaCheckActivity(pWDA) ;
+         break ;
+      }
+#ifdef WLAN_FEATURE_VOWIFI_11R
+      case WDA_AGGR_QOS_REQ:
+      {
+         WDA_ProcessAggrAddTSReq(pWDA, (tAggrAddTsParams *)pMsg->bodyptr);
+         break;
+      }
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+      case WDA_FTM_CMD_REQ:
+      {
+         WDA_ProcessFTMCommand(pWDA, (tPttMsgbuffer *)pMsg->bodyptr) ;
+         break ;
+      }
+#endif /* ANI_MANF_DIAG */
+
+
+      /* Tx Complete Time out Indication */
+      case WDA_TX_COMPLETE_TIMEOUT_IND:
+      {
+         WDA_ProcessTxCompleteTimeOutInd(pWDA); 
+         break;
+      }         
+      case WDA_WLAN_SUSPEND_IND:
+      {
+         WDA_ProcessWlanSuspendInd(pWDA, 
+                        (tSirWlanSuspendParam *)pMsg->bodyptr) ;
+         break;
+      }
+
+      case WDA_WLAN_RESUME_REQ:
+      {
+         WDA_ProcessWlanResumeReq(pWDA, 
+                        (tSirWlanResumeParam *)pMsg->bodyptr) ;
+         break;
+      }
+      
+      case WDA_UPDATE_CF_IND:
+      {
+         vos_mem_free((v_VOID_t*)pMsg->bodyptr);
+         pMsg->bodyptr = NULL;
+         break;
+      }
+#ifdef FEATURE_WLAN_SCAN_PNO
+      case WDA_SET_PNO_REQ:
+      {
+         WDA_ProcessSetPrefNetworkReq(pWDA, (tSirPNOScanReq *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_UPDATE_SCAN_PARAMS_REQ:
+      {
+         WDA_ProcessUpdateScanParams(pWDA, (tSirUpdateScanParams *)pMsg->bodyptr);
+         break;
+      }
+      case WDA_SET_RSSI_FILTER_REQ:
+      {
+         WDA_ProcessSetRssiFilterReq(pWDA, (tSirSetRSSIFilterReq *)pMsg->bodyptr);
+         break;
+      }
+#endif // FEATURE_WLAN_SCAN_PNO
+
+      case WDA_SET_TX_PER_TRACKING_REQ:
+      {
+         WDA_ProcessSetTxPerTrackingReq(pWDA, (tSirTxPerTrackingParam *)pMsg->bodyptr);
+         break;
+      }
+      
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+      case WDA_8023_MULTICAST_LIST_REQ:
+      {
+         WDA_Process8023MulticastListReq(pWDA, (tSirRcvFltMcAddrList *)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_RECEIVE_FILTER_SET_FILTER_REQ:
+      {
+         WDA_ProcessReceiveFilterSetFilterReq(pWDA, (tSirRcvPktFilterCfgType *)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ:
+      {
+         WDA_ProcessPacketFilterMatchCountReq(pWDA, (tpSirRcvFltPktMatchRsp)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ:
+      {
+         WDA_ProcessReceiveFilterClearFilterReq(pWDA, (tSirRcvFltPktClearParam *)pMsg->bodyptr);
+         break;
+      }
+#endif // WLAN_FEATURE_PACKET_FILTERING
+  
+  
+      case WDA_TRANSMISSION_CONTROL_IND:
+      {
+         WDA_ProcessTxControlInd(pWDA, (tpTxControlParams)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_SET_POWER_PARAMS_REQ:
+      {
+         WDA_ProcessSetPowerParamsReq(pWDA, (tSirSetPowerParamsReq *)pMsg->bodyptr);
+         break;
+      }
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+      case WDA_GTK_OFFLOAD_REQ:
+      {
+         WDA_ProcessGTKOffloadReq(pWDA, (tpSirGtkOffloadParams)pMsg->bodyptr);
+         break;
+      }
+
+      case WDA_GTK_OFFLOAD_GETINFO_REQ:
+      {
+         WDA_ProcessGTKOffloadGetInfoReq(pWDA, (tpSirGtkOffloadGetInfoRspParams)pMsg->bodyptr);
+         break;
+      }
+#endif //WLAN_FEATURE_GTK_OFFLOAD
+
+      case WDA_SET_TM_LEVEL_REQ:
+      {
+         WDA_ProcessSetTmLevelReq(pWDA, (tAniSetTmLevelReq *)pMsg->bodyptr);
+         break;
+      }
+
+      default:
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "No Handling for msg type %x in WDA " 
+                                  ,pMsg->type);
+         /* Do Nothing? MSG Body should be freed at here */
+         if(NULL != pMsg->bodyptr)
+         {
+            vos_mem_free(pMsg->bodyptr);
+         }
+         //WDA_VOS_ASSERT(0) ;
+      }
+   }
+
+   return status ;
+}
+
+
+/*
+ * FUNCTION: WDA_LowLevelIndCallback
+ * IND API callback from WDI, send Ind to PE
+ */ 
+void WDA_lowLevelIndCallback(WDI_LowLevelIndType *wdiLowLevelInd, 
+                                                         void* pUserData )
+{
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData;
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+   tSirRSSINotification rssiNotification;
+#endif
+
+   if(NULL == pWDA)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return ;
+   }
+   
+   switch(wdiLowLevelInd->wdiIndicationType)
+   {
+      case WDI_RSSI_NOTIFICATION_IND:
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                     "Received WDI_HAL_RSSI_NOTIFICATION_IND from WDI ");
+
+#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
+         rssiNotification.bReserved = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bReserved;
+         rssiNotification.bRssiThres1NegCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres1NegCross;
+         rssiNotification.bRssiThres1PosCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres1PosCross;
+         rssiNotification.bRssiThres2NegCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres2NegCross;
+         rssiNotification.bRssiThres2PosCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres2PosCross;
+         rssiNotification.bRssiThres3NegCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres3NegCross;
+         rssiNotification.bRssiThres3PosCross = 
+            wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres3PosCross;
+
+         WLANTL_BMPSRSSIRegionChangedNotification(
+            pWDA->pVosContext,
+            &rssiNotification);
+#endif
+         break ;
+      }
+      case WDI_MISSED_BEACON_IND:
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                     "Received WDI_MISSED_BEACON_IND from WDI ");
+
+         /* send IND to PE */
+         WDA_SendMsg(pWDA, WDA_MISSED_BEACON_IND, NULL, 0) ;
+         break ;
+      }
+      case WDI_UNKNOWN_ADDR2_FRAME_RX_IND:
+      {
+         /* TODO: Decode Ind and send Ind to PE */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                     "Received WDI_UNKNOWN_ADDR2_FRAME_RX_IND from WDI ");
+         break ;
+      }
+       
+      case WDI_MIC_FAILURE_IND:
+      {
+         tpSirSmeMicFailureInd pMicInd =
+           (tpSirSmeMicFailureInd)vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
+
+         if(NULL == pMicInd)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "%s: VOS MEM Alloc Failure", __FUNCTION__);
+            break;
+         }
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                  "Received WDI_MIC_FAILURE_IND from WDI ");
+
+         pMicInd->messageType = eWNI_SME_MIC_FAILURE_IND;
+         pMicInd->length = sizeof(tSirSmeMicFailureInd);
+         vos_mem_copy(pMicInd->bssId,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.bssId,
+             sizeof(tSirMacAddr));
+         vos_mem_copy(pMicInd->info.srcMacAddr,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.macSrcAddr,
+             sizeof(tSirMacAddr));
+         vos_mem_copy(pMicInd->info.taMacAddr,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.macTaAddr,
+             sizeof(tSirMacAddr));
+         vos_mem_copy(pMicInd->info.dstMacAddr,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.macDstAddr,
+             sizeof(tSirMacAddr));
+         vos_mem_copy(pMicInd->info.rxMacAddr,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.macRxAddr,
+             sizeof(tSirMacAddr));
+         pMicInd->info.multicast = 
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.ucMulticast;
+         pMicInd->info.keyId= 
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.keyId;
+         pMicInd->info.IV1= 
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.ucIV1;
+         vos_mem_copy(pMicInd->info.TSC,
+             wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
+
+         WDA_SendMsg(pWDA, SIR_HAL_MIC_FAILURE_IND, 
+                                       (void *)pMicInd , 0) ;
+         break ;
+      }
+      case WDI_FATAL_ERROR_IND:
+      {
+         /* TODO: Decode Ind and send Ind to PE */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                  "Received WDI_FATAL_ERROR_IND from WDI ");
+         break ;
+      }
+      case WDA_BEACON_PRE_IND:
+      {
+         tBeaconGenParams *pBeaconGenParams = 
+            (tBeaconGenParams *)vos_mem_malloc(
+                                             sizeof(tBeaconGenParams)) ;
+         if(NULL == pBeaconGenParams)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "%s: VOS MEM Alloc Failure - pBeaconGenParams", __FUNCTION__);
+            break;
+         }
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                  "Received WDA_BEACON_PRE_IND from WDI ");
+
+         /* TODO: fill the pBeaconGenParams strucutre */
+         WDA_SendMsg(pWDA, SIR_LIM_BEACON_GEN_IND, 
+                                       (void *)pBeaconGenParams , 0) ;
+         break;
+      }
+      case WDI_DEL_STA_IND:
+      {
+
+         tpDeleteStaContext  pDelSTACtx = 
+            (tpDeleteStaContext)vos_mem_malloc(sizeof(tDeleteStaContext));
+         
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                  "Received WDI_DEL_STA_IND from WDI ");
+         if(NULL == pDelSTACtx)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "%s: VOS MEM Alloc Failure", __FUNCTION__);
+            break;
+         }
+         vos_mem_copy(pDelSTACtx->addr2,
+             wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.macADDR2,
+             sizeof(tSirMacAddr));
+
+         vos_mem_copy(pDelSTACtx->bssId,
+             wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.macBSSID,
+             sizeof(tSirMacAddr));
+
+         pDelSTACtx->assocId    = 
+          wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.usAssocId;
+         pDelSTACtx->reasonCode = 
+          wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.wptReasonCode;
+         pDelSTACtx->staId      = 
+          wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.ucSTAIdx;
+
+         WDA_SendMsg(pWDA, SIR_LIM_DELETE_STA_CONTEXT_IND, 
+                                       (void *)pDelSTACtx , 0) ;
+
+         break ;
+      }
+      case WDI_COEX_IND:
+      {
+         tANI_U32 index;
+         vos_msg_t vosMsg;
+         tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)vos_mem_malloc(sizeof(tSirSmeCoexInd));
+         if(NULL == pSmeCoexInd)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                             "%s: VOS MEM Alloc Failure-pSmeCoexInd", __FUNCTION__);
+            break;
+         }
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                  "Received WDI_COEX_IND from WDI ");
+
+         /* Message Header */
+         pSmeCoexInd->mesgType = eWNI_SME_COEX_IND;
+         pSmeCoexInd->mesgLen = sizeof(tSirSmeCoexInd);
+
+         /* Info from WDI Indication */
+         pSmeCoexInd->coexIndType = wdiLowLevelInd->wdiIndicationData.wdiCoexInfo.coexIndType; 
+         for (index = 0; index < SIR_COEX_IND_DATA_SIZE; index++)
+         {
+            pSmeCoexInd->coexIndData[index] = wdiLowLevelInd->wdiIndicationData.wdiCoexInfo.coexIndData[index]; 
+         }
+
+         /* VOS message wrapper */
+         vosMsg.type = eWNI_SME_COEX_IND;
+         vosMsg.bodyptr = (void *)pSmeCoexInd;
+         vosMsg.bodyval = 0;
+
+         /* Send message to SME */
+         if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+         {
+            /* free the mem and return */
+            vos_mem_free((v_VOID_t *)pSmeCoexInd);
+         }
+         else
+         {
+            /* DEBUG */
+            VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                      "[COEX WDA] Coex Ind Type (%x) data (%x %x %x %x)",
+                      pSmeCoexInd->coexIndType, 
+                      pSmeCoexInd->coexIndData[0], 
+                      pSmeCoexInd->coexIndData[1], 
+                      pSmeCoexInd->coexIndData[2], 
+                      pSmeCoexInd->coexIndData[3]); 
+         }
+         break;
+      }
+      case WDI_TX_COMPLETE_IND:
+      {
+         tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+         /* Calling TxCompleteAck Indication from wda context*/
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                        "Complete Indication received from HAL");
+         if( pWDA->pAckTxCbFunc )
+         {
+            if( VOS_STATUS_SUCCESS !=
+                              WDA_STOP_TIMER(&pWDA->wdaTimers.TxCompleteTimer))
+            {  
+               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "Tx Complete timeout Timer Stop Failed ");
+            }  
+            pWDA->pAckTxCbFunc( pMac, wdiLowLevelInd->wdiIndicationData.tx_complete_status);
+            pWDA->pAckTxCbFunc = NULL;
+         }
+         else
+         {
+             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                          "Tx Complete Indication is received after timeout ");
+         }
+         break;
+      }
+#ifdef WLAN_FEATURE_P2P
+      case WDI_P2P_NOA_ATTR_IND :
+      {
+         tSirP2PNoaAttr   *pP2pNoaAttr = 
+            (tSirP2PNoaAttr *)vos_mem_malloc(sizeof(tSirP2PNoaAttr));
+
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                              "Received WDI_P2P_NOA_ATTR_IND from WDI");
+
+         if (NULL == pP2pNoaAttr)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                       "Memory allocation failure, "
+                       "WDI_P2P_NOA_ATTR_IND not forwarded");
+            break;
+         }
+
+         pP2pNoaAttr->index            = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.ucIndex;
+         pP2pNoaAttr->oppPsFlag        = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.ucOppPsFlag;
+         pP2pNoaAttr->ctWin            = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.usCtWin;
+         
+         pP2pNoaAttr->uNoa1IntervalCnt = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.usNoa1IntervalCnt;
+         pP2pNoaAttr->uNoa1Duration    = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Duration;
+         pP2pNoaAttr->uNoa1Interval    = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Interval;
+         pP2pNoaAttr->uNoa1StartTime   = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1StartTime;
+
+         pP2pNoaAttr->uNoa2IntervalCnt = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.usNoa2IntervalCnt;
+         pP2pNoaAttr->uNoa2Duration    = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Duration;
+         pP2pNoaAttr->uNoa2Interval    = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Interval;
+         pP2pNoaAttr->uNoa2StartTime   = 
+                    wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2StartTime;
+
+         WDA_SendMsg(pWDA, SIR_HAL_P2P_NOA_ATTR_IND, 
+                                       (void *)pP2pNoaAttr , 0) ;
+         break;
+      }
+#endif
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+      case WDI_PREF_NETWORK_FOUND_IND:
+      {
+         vos_msg_t vosMsg;
+         tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)vos_mem_malloc(sizeof(tSirPrefNetworkFoundInd));
+
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                              "Received WDI_PREF_NETWORK_FOUND_IND from WDI");
+
+         if (NULL == pPrefNetworkFoundInd)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                       "Memory allocation failure, "
+                       "WDI_PREF_NETWORK_FOUND_IND not forwarded");
+            break;
+         }
+
+         /* Message Header */
+         pPrefNetworkFoundInd->mesgType = eWNI_SME_PREF_NETWORK_FOUND_IND;
+         pPrefNetworkFoundInd->mesgLen = sizeof(*pPrefNetworkFoundInd);
+
+         /* Info from WDI Indication */ 
+         pPrefNetworkFoundInd->ssId.length = 
+            wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength;
+
+         vos_mem_set( pPrefNetworkFoundInd->ssId.ssId, 32, 0);
+
+         vos_mem_copy( pPrefNetworkFoundInd->ssId.ssId, 
+                  wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID, 
+                  pPrefNetworkFoundInd->ssId.length);
+
+         pPrefNetworkFoundInd ->rssi = wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.rssi; 
+
+         /* VOS message wrapper */
+         vosMsg.type = eWNI_SME_PREF_NETWORK_FOUND_IND;
+         vosMsg.bodyptr = (void *) pPrefNetworkFoundInd;
+         vosMsg.bodyval = 0;
+
+         /* Send message to SME */
+         if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+         {
+            /* free the mem and return */
+            vos_mem_free((v_VOID_t *) pPrefNetworkFoundInd);
+         }
+
+         break;
+      }
+#endif // FEATURE_WLAN_SCAN_PNO
+      
+#ifdef WLAN_WAKEUP_EVENTS
+      case WDI_WAKE_REASON_IND:
+      {
+         vos_msg_t vosMsg;
+         tANI_U32 allocSize = sizeof(tSirWakeReasonInd) 
+                                  + (wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen - 1);
+         tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)vos_mem_malloc(allocSize);
+
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                    "[WAKE_REASON WDI] WAKE_REASON_IND Type (0x%x) data (ulReason=0x%x, ulReasonArg=0x%x, ulStoredDataLen=0x%x)",
+                    wdiLowLevelInd->wdiIndicationType,
+                    wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulReason,
+                    wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulReasonArg,
+                    wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen);
+
+         if (NULL == pWakeReasonInd)
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                       "Memory allocation failure, "
+                       "WDI_WAKE_REASON_IND not forwarded");
+            break;
+         }
+
+         vos_mem_zero(pWakeReasonInd, allocSize);
+
+         /* Message Header */
+         pWakeReasonInd->mesgType = eWNI_SME_WAKE_REASON_IND;
+         pWakeReasonInd->mesgLen = allocSize;
+
+         /* Info from WDI Indication */
+         // Fill pWakeReasonInd structure from wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd
+         pWakeReasonInd->ulReason = wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulReason;
+         pWakeReasonInd->ulReasonArg = wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulReasonArg;
+         pWakeReasonInd->ulStoredDataLen = wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen;
+         pWakeReasonInd->ulActualDataLen = wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulActualDataLen;         
+         vos_mem_copy( (void *)&(pWakeReasonInd->aDataStart[0]), 
+                        &(wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.aDataStart[0]), 
+                        wdiLowLevelInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen);
+
+         /* VOS message wrapper */
+         vosMsg.type = eWNI_SME_WAKE_REASON_IND;
+         vosMsg.bodyptr = (void *) pWakeReasonInd;
+         vosMsg.bodyval = 0;
+
+         /* Send message to SME */
+         if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+         {
+            /* free the mem and return */
+            vos_mem_free((v_VOID_t *) pWakeReasonInd);
+         }
+
+         break;
+      }
+#endif // WLAN_WAKEUP_EVENTS
+      
+      case WDI_TX_PER_HIT_IND:
+      {
+         vos_msg_t vosMsg;
+         VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "Get WDI_TX_PER_HIT_IND");
+         /* send IND to PE eWNI_SME_TX_PER_HIT_IND*/
+         /* VOS message wrapper */
+         vosMsg.type = eWNI_SME_TX_PER_HIT_IND;
+         vosMsg.bodyptr = NULL;
+         vosMsg.bodyval = 0;
+
+         /* Send message to SME */
+         if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+         {
+            VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_WARN, "post eWNI_SME_TX_PER_HIT_IND to SME Failed");
+         }
+         break;
+      }
+  
+      default:
+      {
+         /* TODO error */
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "Received UNKNOWN Indication from WDI ");
+      } 
+   }
+   return ;
+}
+
+
+/*
+ * BA related processing in WDA.
+ */
+
+void WDA_TriggerBaReqCallback(WDI_TriggerBARspParamsType *wdiTriggerBaRsp, 
+                                                             void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+   tWDA_CbContext *pWDA;
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(WDI_STATUS_SUCCESS == wdiTriggerBaRsp->wdiStatus)
+   {
+      tANI_U8 i = 0 ;
+      tBaActivityInd *baActivityInd = NULL ;
+      tANI_U8 baCandidateCount = wdiTriggerBaRsp->usBaCandidateCnt ;
+      tANI_U8 allocSize = sizeof(tBaActivityInd) 
+                           + sizeof(tAddBaCandidate) * (baCandidateCount) ;
+      WDI_TriggerBARspCandidateType *wdiBaCandidate = NULL ; 
+      tAddBaCandidate *baCandidate = NULL ;
+
+      baActivityInd =  (tBaActivityInd *)vos_mem_malloc(allocSize) ;
+
+      if(NULL == baActivityInd) 
+      { 
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+         VOS_ASSERT(0) ;
+         return; 
+      }
+
+      vos_mem_copy(baActivityInd->bssId, wdiTriggerBaRsp->macBSSID, 
+                                                    sizeof(tSirMacAddr)) ;
+      baActivityInd->baCandidateCnt = baCandidateCount ;
+       
+      wdiBaCandidate = (WDI_TriggerBARspCandidateType*)(wdiTriggerBaRsp + 1) ;
+      baCandidate = (tAddBaCandidate*)(baActivityInd + 1) ;
+ 
+      for(i = 0 ; i < baCandidateCount ; i++)
+      {
+         tANI_U8 tid = 0 ;
+         wdiBaCandidate = (wdiBaCandidate + i) ;
+         baCandidate = (baCandidate + i) ;
+         vos_mem_copy(baCandidate->staAddr, wdiBaCandidate->macSTA, 
+                                                   sizeof(tSirMacAddr)) ;
+
+         for(tid = 0 ; tid < STACFG_MAX_TC; tid++)
+         {
+             baCandidate->baInfo[tid].fBaEnable = 
+                              wdiBaCandidate->wdiBAInfo[tid].fBaEnable ;
+             baCandidate->baInfo[tid].startingSeqNum = 
+                              wdiBaCandidate->wdiBAInfo[tid].startingSeqNum ;
+         }
+      }
+
+      WDA_SendMsg(pWDA, SIR_LIM_ADD_BA_IND, (void *)baActivityInd , 0) ;
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                            "BA Trigger RSP with Failure received ");
+   }
+
+   return ;
+
+}
+
+/*
+ * BA Activity check timer handler
+ */
+void WDA_BaCheckActivity(tWDA_CbContext *pWDA)
+{
+   tANI_U8 curSta = 0 ;
+   tANI_U8 tid = 0 ;
+   tANI_U8 size = 0 ;
+   tANI_U8 baCandidateCount = 0 ;
+   tANI_U8 newBaCandidate = 0 ;
+   WDI_TriggerBAReqCandidateType baCandidate[WDA_MAX_STA] = {{0}} ;
+   
+   if(NULL == pWDA)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:pWDA is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return ;
+   }
+   if(WDA_MAX_STA < pWDA->wdaMaxSta)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                              "Inconsistent STA entries in WDA");
+      VOS_ASSERT(0) ;
+   }  
+   /* walk through all STA entries and find out TX packet count */ 
+   for(curSta = 0 ; curSta < pWDA->wdaMaxSta ; curSta++)
+   {
+      for(tid = 0 ; tid < STACFG_MAX_TC ; tid++)
+      {
+         tANI_U32 txPktCount = 0 ;
+         tANI_U8 validStaIndex = pWDA->wdaStaInfo[curSta].ucValidStaIndex ;
+
+         if((WDA_VALID_STA_INDEX == validStaIndex) &&
+            (VOS_STATUS_SUCCESS == WDA_TL_GET_TX_PKTCOUNT( pWDA->pVosContext,
+                                                    curSta, tid, &txPktCount)))
+         {
+#if 0
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_LOW,
+             "************* %d:%d, %d ",curSta, txPktCount,
+                                    pWDA->wdaStaInfo[curSta].framesTxed[tid]);
+#endif
+            if(!WDA_GET_BA_TXFLAG(pWDA, curSta, tid) 
+                   && (txPktCount >= WDA_LAST_POLLED_THRESHOLD(pWDA, 
+                                                               curSta, tid)))
+            {
+               /* get prepare for sending message to HAL */
+               //baCandidate[baCandidateCount].staIdx = curSta ;
+               baCandidate[baCandidateCount].ucTidBitmap |= 1 << tid ;
+               newBaCandidate = WDA_ENABLE_BA ;
+            }
+            pWDA->wdaStaInfo[curSta].framesTxed[tid] = txPktCount ;
+         }
+      }
+
+      /* fill the entry for all the sta with given TID's */
+      if(WDA_ENABLE_BA == newBaCandidate)
+      { 
+         /* move to next BA candidate */
+         baCandidate[baCandidateCount].ucSTAIdx = curSta ;
+         size += sizeof(WDI_TriggerBAReqCandidateType) ; 
+         baCandidateCount++ ;
+         newBaCandidate = WDA_DISABLE_BA ;
+      } 
+   }
+
+   /* prepare and send message to hal */
+   if( 0 < baCandidateCount)
+   {
+      WDI_Status status = WDI_STATUS_SUCCESS ;
+      WDI_TriggerBAReqParamsType *wdiTriggerBaReq;
+      tWDA_ReqParams *pWdaParams = 
+               (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+
+      if(NULL == pWdaParams) 
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+         VOS_ASSERT(0) ; 
+         return; 
+      }
+      wdiTriggerBaReq = (WDI_TriggerBAReqParamsType *)
+                    vos_mem_malloc(sizeof(WDI_TriggerBAReqParamsType) + size) ;
+      if(NULL == wdiTriggerBaReq) 
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+         VOS_ASSERT(0) ; 
+         vos_mem_free(pWdaParams);
+         return; 
+      }
+
+      do
+      {
+         WDI_TriggerBAReqinfoType *triggerBaInfo = 
+                                   &wdiTriggerBaReq->wdiTriggerBAInfoType ;
+         triggerBaInfo->usBACandidateCnt = baCandidateCount ;
+         /* TEMP_FIX: Need to see if WDI need check for assoc session for 
+          * for each request */
+         triggerBaInfo->ucSTAIdx = baCandidate[0].ucSTAIdx ;
+         triggerBaInfo->ucBASessionID = 0;
+         vos_mem_copy((wdiTriggerBaReq + 1), baCandidate, size) ;
+      } while(0) ;
+      wdiTriggerBaReq->wdiReqStatusCB = NULL ;
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+      pWdaParams->pWdaContext = pWDA;
+      pWdaParams->wdaWdiApiMsgParam = wdiTriggerBaReq ;
+      pWdaParams->wdaMsgParam = NULL; 
+      status = WDI_TriggerBAReq(wdiTriggerBaReq, 
+                                   WDA_TriggerBaReqCallback, pWdaParams) ;
+      if(IS_WDI_STATUS_FAILURE(status))
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "Failure in Trigger BA REQ Params WDI API, free all the memory " );
+         vos_mem_free(pWdaParams->wdaMsgParam) ;
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+         vos_mem_free(pWdaParams) ;
+      }
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_LOW,
+                              "There is no TID for initiating BA");
+   }
+
+   if( VOS_STATUS_SUCCESS != 
+         WDA_STOP_TIMER(&pWDA->wdaTimers.baActivityChkTmr))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                              "BA Activity Timer Stop Failed ");
+      return ;
+   }
+   if( VOS_STATUS_SUCCESS != 
+      WDA_START_TIMER(&pWDA->wdaTimers.baActivityChkTmr))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                              "BA Activity Timer Start Failed ");
+      return;
+   }
+   return ;
+}
+
+/*
+ * WDA common routine to create timer used by WDA.
+ */
+static VOS_STATUS wdaCreateTimers(tWDA_CbContext *pWDA)
+{
+
+   VOS_STATUS status = VOS_STATUS_SUCCESS ;
+   tANI_U32 val = 0 ;
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+   
+   if(NULL == pMac)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:MAC context is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+   if(wlan_cfgGetInt(pMac, WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT, &val ) 
+                                                    != eSIR_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                        "Failed to get value for WNI_CFG_CURRENT_TX_ANTENNA");
+      return VOS_STATUS_E_FAILURE;
+   }
+   val = SYS_MS_TO_TICKS(val) ;
+ 
+   /* BA activity check timer */
+   status = WDA_CREATE_TIMER(&pWDA->wdaTimers.baActivityChkTmr, 
+                         "BA Activity Check timer", WDA_TimerHandler, 
+                         WDA_TIMER_BA_ACTIVITY_REQ, val, val, TX_NO_ACTIVATE) ;
+   if(status != TX_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "Unable to create BA activity timer");
+      return eSIR_FAILURE ;
+   }
+
+   val = SYS_MS_TO_TICKS( WDA_TX_COMPLETE_TIME_OUT_VALUE ) ; 
+
+   /* Tx Complete Timeout timer */
+   status = WDA_CREATE_TIMER(&pWDA->wdaTimers.TxCompleteTimer,
+                         "Tx Complete Check timer", WDA_TimerHandler,
+                         WDA_TX_COMPLETE_TIMEOUT_IND, val, val, TX_NO_ACTIVATE) ;
+
+   if(status != TX_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "Unable to create Tx Complete Timeout timer");
+      /* Destroy timer of BA activity check timer */
+      status = WDA_DESTROY_TIMER(&pWDA->wdaTimers.baActivityChkTmr); 
+      if(status != TX_SUCCESS)
+      {
+         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "Unable to Destroy BA activity timer");
+         return eSIR_FAILURE ;
+      } 
+      return eSIR_FAILURE ;
+   }
+
+   return eSIR_SUCCESS ;
+}
+
+/*
+ * WDA common routine to destroy timer used by WDA.
+ */
+static VOS_STATUS wdaDestroyTimers(tWDA_CbContext *pWDA)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS ;
+
+   status = WDA_DESTROY_TIMER(&pWDA->wdaTimers.TxCompleteTimer);
+   if(status != TX_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "Unable to Destroy Tx Complete Timeout timer");
+      return eSIR_FAILURE ;
+   }
+
+   status = WDA_DESTROY_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
+   if(status != TX_SUCCESS)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                               "Unable to Destroy BA activity timer");
+      return eSIR_FAILURE ;
+   }
+                           
+   return eSIR_SUCCESS ;
+}
+
+/*
+ * WDA timer handler.
+ */
+void WDA_TimerHandler(v_VOID_t* pContext, tANI_U32 timerInfo)
+{
+   VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+   vos_msg_t wdaMsg = {0} ;
+
+   /*
+    * trigger CFG download in WDA by sending WDA_CFG_DNLD message
+    */ 
+   wdaMsg.type = timerInfo ; 
+   wdaMsg.bodyptr = NULL;
+   wdaMsg.bodyval = 0;
+
+   /* post the message.. */
+   vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &wdaMsg );
+   if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
+   {
+      vosStatus = VOS_STATUS_E_BADMSG;
+   }
+
+}
+
+/*
+ * WDA Tx Complete timeout Indication.
+ */
+void WDA_ProcessTxCompleteTimeOutInd(tWDA_CbContext* pWDA)
+{
+   tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+
+   if( pWDA->pAckTxCbFunc )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                      "TxComplete timer expired\n");
+      pWDA->pAckTxCbFunc( pMac, 0);
+      pWDA->pAckTxCbFunc = NULL;
+   }
+   else
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "There is no request pending for TxComplete and wait timer expired\n");
+   }
+
+}
+
+/*
+ * WDA Set REG Domain to VOS NV
+ */
+eHalStatus WDA_SetRegDomain(void * clientCtxt, v_REGDOMAIN_t regId)
+{
+   if(VOS_STATUS_SUCCESS != vos_nv_setRegDomain(clientCtxt, regId))
+   {
+      return eHAL_STATUS_INVALID_PARAMETER;
+   }
+   return eHAL_STATUS_SUCCESS;
+}
+#endif  /* FEATURE_WLAN_INTEGRATED_SOC */
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*
+ * FUNCTION: WDA_PNOScanReqCallback
+ * 
+ */ 
+void WDA_PNOScanReqCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+    if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      }
+
+      if( pWdaParams->wdaMsgParam != NULL)
+      {
+         vos_mem_free(pWdaParams->wdaMsgParam);
+      }
+
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_UpdateScanParamsCallback
+ * 
+ */ 
+void WDA_UpdateScanParamsCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+    if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      }
+
+      if( pWdaParams->wdaMsgParam != NULL)
+      {
+         vos_mem_free(pWdaParams->wdaMsgParam);
+      }
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_SetPowerParamsCallback
+ * 
+ */ 
+void WDA_SetPowerParamsCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+    if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      }
+
+      if( pWdaParams->wdaMsgParam != NULL)
+      {
+         vos_mem_free(pWdaParams->wdaMsgParam);
+      }
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetPreferredNetworkList
+ * Request to WDI to set Preferred Network List.Offload
+ */ 
+VOS_STATUS WDA_ProcessSetPrefNetworkReq(tWDA_CbContext *pWDA, 
+                                       tSirPNOScanReq *pPNOScanReqParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_PNOScanReqParamsType *pwdiPNOScanReqInfo = 
+      (WDI_PNOScanReqParamsType *)vos_mem_malloc(sizeof(WDI_PNOScanReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+   v_U8_t   i; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiPNOScanReqInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiPNOScanReqInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   //
+   // Fill wdiPNOScanReqInfo->wdiPNOScanInfo from pPNOScanReqParams
+   //
+   pwdiPNOScanReqInfo->wdiPNOScanInfo.bEnable = pPNOScanReqParams->enable;
+   pwdiPNOScanReqInfo->wdiPNOScanInfo.wdiModePNO = pPNOScanReqParams->modePNO;
+
+   pwdiPNOScanReqInfo->wdiPNOScanInfo.ucNetworksCount = 
+      ( pPNOScanReqParams->ucNetworksCount < WDI_PNO_MAX_SUPP_NETWORKS )? 
+        pPNOScanReqParams->ucNetworksCount : WDI_PNO_MAX_SUPP_NETWORKS ;
+
+   for ( i = 0; i < pwdiPNOScanReqInfo->wdiPNOScanInfo.ucNetworksCount ; i++)
+   {
+      vos_mem_copy(&pwdiPNOScanReqInfo->wdiPNOScanInfo.aNetworks[i],
+                   &pPNOScanReqParams->aNetworks[i],
+                   sizeof(pwdiPNOScanReqInfo->wdiPNOScanInfo.aNetworks[i]));
+   }
+
+   /*Scan timer intervals*/
+   vos_mem_copy(&pwdiPNOScanReqInfo->wdiPNOScanInfo.scanTimers,
+                &pPNOScanReqParams->scanTimers,
+                sizeof(pwdiPNOScanReqInfo->wdiPNOScanInfo.scanTimers));
+
+   /*Probe template for 2.4GHz band*/
+   pwdiPNOScanReqInfo->wdiPNOScanInfo.us24GProbeSize = 
+      (pPNOScanReqParams->us24GProbeTemplateLen<WDI_PNO_MAX_PROBE_SIZE)?
+      pPNOScanReqParams->us24GProbeTemplateLen:WDI_PNO_MAX_PROBE_SIZE; 
+
+   vos_mem_copy( &pwdiPNOScanReqInfo->wdiPNOScanInfo.a24GProbeTemplate,
+                pPNOScanReqParams->p24GProbeTemplate,
+                pwdiPNOScanReqInfo->wdiPNOScanInfo.us24GProbeSize);
+
+   /*Probe template for 5GHz band*/
+   pwdiPNOScanReqInfo->wdiPNOScanInfo.us5GProbeSize = 
+      (pPNOScanReqParams->us5GProbeTemplateLen<WDI_PNO_MAX_PROBE_SIZE)?
+      pPNOScanReqParams->us5GProbeTemplateLen:WDI_PNO_MAX_PROBE_SIZE; 
+
+   vos_mem_copy( &pwdiPNOScanReqInfo->wdiPNOScanInfo.a5GProbeTemplate,
+                pPNOScanReqParams->p5GProbeTemplate,
+                pwdiPNOScanReqInfo->wdiPNOScanInfo.us5GProbeSize);
+
+   pwdiPNOScanReqInfo->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiPNOScanReqInfo) ;
+      vos_mem_free(pWdaParams);
+      return VOS_STATUS_E_FAILURE;
+   }
+   
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiPNOScanReqInfo;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pPNOScanReqParams;
+
+   status = WDI_SetPreferredNetworkReq(pwdiPNOScanReqInfo, 
+                           (WDI_PNOScanCb)WDA_PNOScanReqCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set PNO REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      pWdaParams->wdaWdiApiMsgParam = NULL;
+      pWdaParams->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_RssiFilterCallback
+ * 
+ */ 
+void WDA_RssiFilterCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   VOS_ASSERT(NULL != pWdaParams);
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   return ;
+}
+/*
+ * FUNCTION: WDA_ProcessSetPreferredNetworkList
+ * Request to WDI to set Preferred Network List.Offload
+ */ 
+VOS_STATUS WDA_ProcessSetRssiFilterReq(tWDA_CbContext *pWDA, 
+                                        tSirSetRSSIFilterReq* pRssiFilterParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_SetRssiFilterReqParamsType *pwdiSetRssiFilterReqInfo = 
+      (WDI_SetRssiFilterReqParamsType *)vos_mem_malloc(sizeof(WDI_SetRssiFilterReqParamsType)) ;
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiSetRssiFilterReqInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiSetRssiFilterReqInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pwdiSetRssiFilterReqInfo->rssiThreshold = pRssiFilterParams->rssiThreshold;
+   pwdiSetRssiFilterReqInfo->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiSetRssiFilterReqInfo) ;
+      vos_mem_free(pWdaParams);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetRssiFilterReqInfo;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pRssiFilterParams;
+
+   status = WDI_SetRssiFilterReq( pwdiSetRssiFilterReqInfo, 
+                                 (WDI_PNOScanCb)WDA_RssiFilterCallback, 
+                                 pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set RSSI Filter REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      pWdaParams->wdaWdiApiMsgParam = NULL;
+      pWdaParams->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+
+/*
+ * FUNCTION: WDA_ProcessUpdateScanParams
+ * Request to WDI to update Scan Parameters
+ */ 
+VOS_STATUS WDA_ProcessUpdateScanParams(tWDA_CbContext *pWDA, 
+                                       tSirUpdateScanParams *pUpdateScanParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_UpdateScanParamsInfoType *wdiUpdateScanParamsInfoType = 
+      (WDI_UpdateScanParamsInfoType *)vos_mem_malloc(
+         sizeof(WDI_UpdateScanParamsInfoType)) ;
+   tWDA_ReqParams *pWdaParams ;
+   v_U8_t i; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == wdiUpdateScanParamsInfoType) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if ( NULL == pWdaParams )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiUpdateScanParamsInfoType);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   //
+   // Fill wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo from pUpdateScanParams
+   //
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+          "Update Scan Parameters b11dEnabled %d b11dResolved %d "
+          "ucChannelCount %d usPassiveMinChTime %d usPassiveMaxChTime"
+          " %d usActiveMinChTime %d usActiveMaxChTime %d sizeof "
+          "sir struct %d wdi struct %d",
+              pUpdateScanParams->b11dEnabled,
+              pUpdateScanParams->b11dResolved,
+              pUpdateScanParams->ucChannelCount, 
+              pUpdateScanParams->usPassiveMinChTime, 
+              pUpdateScanParams->usPassiveMaxChTime, 
+              pUpdateScanParams->usActiveMinChTime,
+              pUpdateScanParams->usActiveMaxChTime,
+              sizeof(tSirUpdateScanParams),
+              sizeof(wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo) ); 
+
+
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.b11dEnabled  =
+      pUpdateScanParams->b11dEnabled;
+
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.b11dResolved =
+      pUpdateScanParams->b11dResolved;
+
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.cbState = 
+      pUpdateScanParams->ucCBState;
+
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usActiveMaxChTime  =
+      pUpdateScanParams->usActiveMaxChTime; 
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usActiveMinChTime  = 
+      pUpdateScanParams->usActiveMinChTime;
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usPassiveMaxChTime = 
+      pUpdateScanParams->usPassiveMaxChTime;
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usPassiveMinChTime = 
+     pUpdateScanParams->usPassiveMinChTime;
+
+
+   wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.ucChannelCount = 
+      (pUpdateScanParams->ucChannelCount < WDI_PNO_MAX_NETW_CHANNELS)?
+      pUpdateScanParams->ucChannelCount:WDI_PNO_MAX_NETW_CHANNELS;
+
+
+   for ( i = 0; i < 
+         wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.ucChannelCount ; 
+         i++)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             "Update Scan Parameters channel: %d",
+                 pUpdateScanParams->aChannels[i]);
+   
+      wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.aChannels[i] = 
+         pUpdateScanParams->aChannels[i];
+   }
+
+
+   wdiUpdateScanParamsInfoType->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pWdaParams);
+      vos_mem_free(wdiUpdateScanParamsInfoType);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+     /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = wdiUpdateScanParamsInfoType;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pUpdateScanParams;
+
+ 
+
+   status = WDI_UpdateScanParamsReq(wdiUpdateScanParamsInfoType, 
+                    (WDI_UpdateScanParamsCb)WDA_UpdateScanParamsCallback, 
+                    pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Update Scan Params EQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/*
+ * FUNCTION: WDA_8023MulticastListReqCallback
+ * 
+ */ 
+void WDA_8023MulticastListReqCallback(WDI_Status status, void * pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_8023MulticastListReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_Process8023MulticastListReq
+ * Request to WDI to add 8023 Multicast List
+ */ 
+VOS_STATUS WDA_Process8023MulticastListReq (tWDA_CbContext *pWDA, 
+                                       tSirRcvFltMcAddrList *pRcvFltMcAddrList)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_RcvFltPktSetMcListReqParamsType *pwdiFltPktSetMcListReqParamsType = NULL;
+   tWDA_ReqParams *pWdaParams ;
+   tANI_U8         i;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   pwdiFltPktSetMcListReqParamsType = 
+      (WDI_RcvFltPktSetMcListReqParamsType *)vos_mem_malloc(
+                             sizeof(WDI_RcvFltPktSetMcListReqParamsType)
+                                                           ) ;
+   if(NULL == pwdiFltPktSetMcListReqParamsType) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      vos_mem_free(pwdiFltPktSetMcListReqParamsType);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL",
+              __FUNCTION__);
+      vos_mem_free(pwdiFltPktSetMcListReqParamsType);
+      vos_mem_free(pWdaParams);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   //
+   // Fill pwdiFltPktSetMcListReqParamsType from pRcvFltMcAddrList
+   //
+   pwdiFltPktSetMcListReqParamsType->mcAddrList.ulMulticastAddrCnt = 
+                                   pRcvFltMcAddrList->ulMulticastAddrCnt; 
+   for( i = 0; i < pRcvFltMcAddrList->ulMulticastAddrCnt; i++ )
+   {
+      vos_mem_copy(&(pwdiFltPktSetMcListReqParamsType->mcAddrList.multicastAddr[i]),
+                   &(pRcvFltMcAddrList->multicastAddr[i]),
+                   sizeof(tSirMacAddr));
+   }
+
+   pwdiFltPktSetMcListReqParamsType->wdiReqStatusCB = NULL;
+
+  /* WDA_VOS_ASSERT((NULL == pWDA->wdaMsgParam) && 
+                  (NULL == pWDA->wdaWdiApiMsgParam)); */
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiFltPktSetMcListReqParamsType;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pRcvFltMcAddrList;
+
+   status = WDI_8023MulticastListReq(
+                        pwdiFltPktSetMcListReqParamsType, 
+                        (WDI_8023MulticastListCb)WDA_8023MulticastListReqCallback,
+                        pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+        "Failure in WDA_Process8023MulticastListReq(), free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ReceiveFilterSetFilterReqCallback
+ * 
+ */ 
+void WDA_ReceiveFilterSetFilterReqCallback(WDI_Status status, void * pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   /*WDA_VOS_ASSERT(NULL != pWdaParams);*/
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_ReceiveFilterSetFilterReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessReceiveFilterSetFilterReq
+ * Request to WDI to set Receive Filters
+ */ 
+VOS_STATUS WDA_ProcessReceiveFilterSetFilterReq (tWDA_CbContext *pWDA, 
+                                       tSirRcvPktFilterCfgType *pRcvPktFilterCfg)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   v_SIZE_t   allocSize = sizeof(WDI_SetRcvPktFilterReqParamsType) + 
+      ((pRcvPktFilterCfg->numFieldParams - 1) * sizeof(tSirRcvPktFilterFieldParams));
+   WDI_SetRcvPktFilterReqParamsType *pwdiSetRcvPktFilterReqParamsType = 
+      (WDI_SetRcvPktFilterReqParamsType *)vos_mem_malloc(allocSize) ;
+   tWDA_ReqParams *pWdaParams ;
+   tANI_U8         i;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiSetRcvPktFilterReqParamsType) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiSetRcvPktFilterReqParamsType);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterId = pRcvPktFilterCfg->filterId;
+   pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterType = pRcvPktFilterCfg->filterType;   
+   pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams = pRcvPktFilterCfg->numFieldParams;
+   pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.coalesceTime = pRcvPktFilterCfg->coalesceTime;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "FID %d FT %d NParams %d CT %d",
+              pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterId, 
+              pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterType,
+              pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams, 
+              pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.coalesceTime);
+
+   for ( i = 0; i < pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams; i++ )
+   {
+     wpalMemoryCopy(&pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.paramsData[i],
+                    &pRcvPktFilterCfg->paramsData[i],
+                    sizeof(pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.paramsData[i]));
+
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
+                 "Proto %d Comp Flag %d \n",
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].protocolLayer, 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].cmpFlag);
+
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
+                 "Data Offset %d Data Len %d\n",
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataOffset, 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataLength);
+
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
+                 "CData: %d:%d:%d:%d:%d:%d\n",
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[0], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[1], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[2], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[3],
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[4], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].compareData[5]);
+
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
+                 "MData: %d:%d:%d:%d:%d:%d\n",
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[0], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[1], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[2], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[3],
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[4], 
+                 pwdiSetRcvPktFilterReqParamsType->
+                         wdiPktFilterCfg.paramsData[i].dataMask[5]);
+
+   }
+
+   pwdiSetRcvPktFilterReqParamsType->wdiReqStatusCB = NULL;
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetRcvPktFilterReqParamsType;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pRcvPktFilterCfg;
+
+   status = WDI_ReceiveFilterSetFilterReq(pwdiSetRcvPktFilterReqParamsType,
+           (WDI_ReceiveFilterSetFilterCb)WDA_ReceiveFilterSetFilterReqCallback,
+           pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in SetFilter(),free all the memory,status %d ",status);
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      vos_mem_free(pWdaParams);
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_FilterMatchCountReqCallback
+ * 
+ */ 
+void WDA_FilterMatchCountReqCallback(WDI_Status status, void * pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_CbContext *pWDA;
+   tpSirRcvFltPktMatchRsp pRcvFltPktMatchCntReq;
+   tpSirRcvFltPktMatchRsp pRcvFltPktMatchCntRsp = 
+                            vos_mem_malloc(sizeof(tSirRcvFltPktMatchRsp));
+   tANI_U8         i;
+   vos_msg_t vosMsg;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   /*WDA_VOS_ASSERT(NULL != pWdaParams);*/
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+   pRcvFltPktMatchCntReq = (tpSirRcvFltPktMatchRsp)pWdaParams->wdaMsgParam;
+
+   // Fill pRcvFltPktMatchCntRsp from pRcvFltPktMatchCntReq
+   vos_mem_zero(pRcvFltPktMatchCntRsp,sizeof(tSirRcvFltPktMatchRsp));
+
+   /* Message Header */
+   pRcvFltPktMatchCntRsp->mesgType = eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP;
+   pRcvFltPktMatchCntRsp->mesgLen = sizeof(tSirRcvFltPktMatchRsp);
+
+   pRcvFltPktMatchCntRsp->status = pRcvFltPktMatchCntReq->status;
+
+   for (i = 0; i < SIR_MAX_NUM_FILTERS; i++)
+   {   
+      pRcvFltPktMatchCntRsp->filterMatchCnt[i].filterId = pRcvFltPktMatchCntReq->filterMatchCnt[i].filterId;
+      pRcvFltPktMatchCntRsp->filterMatchCnt[i].matchCnt = pRcvFltPktMatchCntReq->filterMatchCnt[i].matchCnt;
+   }
+
+   /* VOS message wrapper */
+   vosMsg.type = eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP;
+   vosMsg.bodyptr = (void *)pRcvFltPktMatchCntRsp;
+   vosMsg.bodyval = 0;
+   if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
+   {
+      /* free the mem and return */
+      vos_mem_free((v_VOID_t *)pRcvFltPktMatchCntRsp);
+   }
+
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessPacketFilterMatchCountReq
+ * Request to WDI to get PC Filter Match Count
+ */ 
+VOS_STATUS WDA_ProcessPacketFilterMatchCountReq (tWDA_CbContext *pWDA, tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_RcvFltPktMatchCntReqParamsType *pwdiRcvFltPktMatchCntReqParamsType = 
+      (WDI_RcvFltPktMatchCntReqParamsType *)vos_mem_malloc(sizeof(WDI_RcvFltPktMatchCntReqParamsType));
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiRcvFltPktMatchCntReqParamsType) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiRcvFltPktMatchCntReqParamsType);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiRcvFltPktMatchCntReqParamsType);
+      vos_mem_free(pWdaParams);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pwdiRcvFltPktMatchCntReqParamsType->wdiReqStatusCB = NULL;
+
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiRcvFltPktMatchCntReqParamsType;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pRcvFltPktMatchRsp;
+
+   status = WDI_FilterMatchCountReq(pwdiRcvFltPktMatchCntReqParamsType, 
+                 (WDI_FilterMatchCountCb)WDA_FilterMatchCountReqCallback,
+                 pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      /* failure returned by WDI API */
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in WDI_FilterMatchCountReq(), free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+      pRcvFltPktMatchRsp->status = eSIR_FAILURE ;
+      WDA_SendMsg(pWDA, WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP, (void *)pRcvFltPktMatchRsp, 0) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_ReceiveFilterSetFilterReqCallback
+ * 
+ */ 
+void WDA_ReceiveFilterClearFilterReqCallback(WDI_Status status, void * pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+/*   WDA_VOS_ASSERT(NULL != pWdaParams); */
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+   
+   vos_mem_free(pWdaParams->wdaMsgParam) ;
+   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+   vos_mem_free(pWdaParams) ;
+
+   //print a msg, nothing else to do
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+              "WDA_ReceiveFilterClearFilterReqCallback invoked " );
+
+   return ;
+}
+
+/*
+ * FUNCTION: WDA_ProcessReceiveFilterClearFilterReq
+ * Request to WDI to clear Receive Filters
+ */
+VOS_STATUS WDA_ProcessReceiveFilterClearFilterReq (tWDA_CbContext *pWDA,
+                                       tSirRcvFltPktClearParam *pRcvFltPktClearParam)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_RcvFltPktClearReqParamsType *pwdiRcvFltPktClearReqParamsType =
+      (WDI_RcvFltPktClearReqParamsType *)vos_mem_malloc(sizeof(WDI_RcvFltPktClearReqParamsType));
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiRcvFltPktClearReqParamsType)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__);
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiRcvFltPktClearReqParamsType);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pwdiRcvFltPktClearReqParamsType->filterClearParam.status = pRcvFltPktClearParam->status;
+   pwdiRcvFltPktClearReqParamsType->filterClearParam.filterId = pRcvFltPktClearParam->filterId;
+
+   pwdiRcvFltPktClearReqParamsType->wdiReqStatusCB = NULL;
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiRcvFltPktClearReqParamsType;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pRcvFltPktClearParam;
+
+   status = WDI_ReceiveFilterClearFilterReq(pwdiRcvFltPktClearReqParamsType,
+       (WDI_ReceiveFilterClearFilterCb)WDA_ReceiveFilterClearFilterReqCallback,
+       pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in WDA_ProcessReceiveFilterClearFilterReq(), free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+
+/*
+ * FUNCTION: WDA_ProcessSetPowerParamsReq
+ * Request to WDI to set power params 
+ */ 
+VOS_STATUS WDA_ProcessSetPowerParamsReq(tWDA_CbContext *pWDA, 
+                                        tSirSetPowerParamsReq *pPowerParams)
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   WDI_SetPowerParamsReqParamsType *pwdiSetPowerParamsReqInfo = 
+      (WDI_SetPowerParamsReqParamsType *)vos_mem_malloc(sizeof(WDI_SetPowerParamsReqParamsType)) ;
+
+   tWDA_ReqParams *pWdaParams ;
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if(NULL == pwdiSetPowerParamsReqInfo) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiSetPowerParamsReqInfo);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uIgnoreDTIM       = 
+      pPowerParams->uIgnoreDTIM;
+
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uDTIMPeriod       = 
+      pPowerParams->uDTIMPeriod;
+
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uListenInterval   = 
+      pPowerParams->uListenInterval;
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uBcastMcastFilter = 
+      pPowerParams->uBcastMcastFilter;
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uEnableBET        = 
+      pPowerParams->uEnableBET;
+   pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uBETInterval      = 
+      pPowerParams->uBETInterval; 
+
+   pwdiSetPowerParamsReqInfo->wdiReqStatusCB = NULL;
+
+   if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+             "%s: wdaMsgParam or wdaWdiApiMsgParam is not NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(pwdiSetPowerParamsReqInfo) ;
+      vos_mem_free(pWdaParams);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* Store Params pass it to WDI */
+   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetPowerParamsReqInfo;
+   pWdaParams->pWdaContext = pWDA;
+   /* Store param pointer as passed in by caller */
+   pWdaParams->wdaMsgParam = pPowerParams;
+
+   status = WDI_SetPowerParamsReq( pwdiSetPowerParamsReqInfo, 
+                                 (WDI_SetPowerParamsCb)WDA_SetPowerParamsCallback, 
+                                 pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Set power params REQ WDI API, free all the memory " );
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      vos_mem_free(pWdaParams->wdaMsgParam);
+      pWdaParams->wdaWdiApiMsgParam = NULL;
+      pWdaParams->wdaMsgParam = NULL;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+/*
+ * FUNCTION: WDA_SetTmLevelRspCallback
+ * Set TM Level response
+ */ 
+void WDA_SetTmLevelRspCallback(WDI_Status status, void* pUserData)
+{
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "<------ %s " ,__FUNCTION__);
+
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __FUNCTION__);
+      VOS_ASSERT(0) ;
+      return ;
+   }
+
+   /* Dose not need to send notification to upper layer
+    * Just free allocated resources */
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      }
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams) ;
+   }
+}
+
+/*
+ * FUNCTION: WDA_ProcessSetTmLevelReq
+ * Set TM Level request
+ */
+VOS_STATUS WDA_ProcessSetTmLevelReq(tWDA_CbContext *pWDA,
+                                             tAniSetTmLevelReq *setTmLevelReq)
+{
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   tWDA_ReqParams *pWdaParams ;
+   WDI_SetTmLevelReqType *wdiSetTmLevelReq = 
+               (WDI_SetTmLevelReqType *)vos_mem_malloc(
+                                       sizeof(WDI_SetTmLevelReqType)) ;
+   if(NULL == wdiSetTmLevelReq) 
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+   if(NULL == pWdaParams)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: VOS MEM Alloc Failure", __FUNCTION__); 
+      VOS_ASSERT(0);
+      vos_mem_free(wdiSetTmLevelReq);
+      return VOS_STATUS_E_NOMEM;
+   }
+
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   wdiSetTmLevelReq->tmMode  = setTmLevelReq->tmMode;
+   wdiSetTmLevelReq->tmLevel = setTmLevelReq->newTmLevel;
+
+   pWdaParams->pWdaContext = pWDA;
+   pWdaParams->wdaMsgParam = setTmLevelReq;
+   pWdaParams->wdaWdiApiMsgParam = wdiSetTmLevelReq;
+
+   status = WDI_SetTmLevelReq(wdiSetTmLevelReq, 
+                           (WDI_SetTmLevelCb)WDA_SetTmLevelRspCallback, pWdaParams);
+
+   if(IS_WDI_STATUS_FAILURE(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "Failure set thernal mitigation level free all the memory " );
+      vos_mem_free(pWdaParams->wdaMsgParam) ;
+      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+      vos_mem_free(pWdaParams) ;
+   }
+
+   return CONVERT_WDI2VOS_STATUS(status) ;
+}
+
+VOS_STATUS WDA_ProcessTxControlInd(tWDA_CbContext *pWDA,
+                                   tpTxControlParams pTxCtrlParam)
+{
+   VOS_STATUS wdaStatus;
+   
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                                          "------> %s " ,__FUNCTION__);
+
+   if( pTxCtrlParam == NULL )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s: Input tpTxControlParams is NULL", __FUNCTION__); 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if( pTxCtrlParam->stopTx == eANI_BOOLEAN_TRUE )
+   {
+      wdaStatus = WDA_SuspendDataTx(pWDA);
+   }
+   else /* pTxCtrlParam->stopTx == eANI_BOOLEAN_FALSE */
+   {
+      wdaStatus = WDA_ResumeDataTx(pWDA);
+   }
+
+   return wdaStatus;
+}
+
+ /*  FUNCTION    WDA_featureCapsExchange
+  *  WDA API to invoke capability exchange between host and FW.
+  */
+void WDA_featureCapsExchange(v_PVOID_t pVosContext)
+{
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+      "%s:enter", __FUNCTION__ );
+   WDI_featureCapsExchangeReq( NULL, pVosContext);
+}
+
+ /*  FUNCTION    WDA_getHostWlanFeatCaps
+  *  Wrapper for WDI API, that will return if the feature (enum value).passed
+  *  to this API is supported or not in Host
+  *  return value
+  *     0 - implies feature is NOT Supported
+  *     any non zero value - implies feature is SUPPORTED
+  */
+tANI_U8 WDA_getHostWlanFeatCaps(tANI_U8 featEnumValue)
+{
+   return WDI_getHostWlanFeatCaps(featEnumValue);
+}
+
+ /*  FUNCTION    WDA_getFwWlanFeatCaps
+  *  Wrapper for WDI API, that will return if the feature (enum value).passed
+  *  to this API is supported or not in FW
+  *  return value
+  *     0 - implies feature is NOT Supported
+  *     any non zero value - implies feature is SUPPORTED
+  */
+tANI_U8 WDA_getFwWlanFeatCaps(tANI_U8 featEnumValue)
+{
+   return WDI_getFwWlanFeatCaps(featEnumValue);
+}
+
+/*
+ * FUNCTION: WDA_shutdown
+ * Shutdown WDA/WDI without handshaking with Riva.
+ * Synchronous function.
+ */
+VOS_STATUS WDA_shutdown(v_PVOID_t pVosContext, wpt_boolean closeTransport)
+{
+   WDI_Status wdiStatus;
+   //tANI_U8    eventIdx = 0;
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
+   if (NULL == pWDA)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "%s: Invoked with invalid pWDA", __FUNCTION__ );
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /* FTM mode stay START_STATE */
+   if( (WDA_READY_STATE != pWDA->wdaState) &&
+         (WDA_INIT_STATE != pWDA->wdaState) &&
+         (WDA_START_STATE != pWDA->wdaState) )
+   {
+      VOS_ASSERT(0);
+   }
+
+   if(NULL != pWDA->wdaWdiApiMsgParam)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+            "%s:wdaWdiApiMsgParam is not NULL", __FUNCTION__);
+      VOS_ASSERT(0);
+      /* the last request was not freed, probably a SSR
+       * initiated by WLAN driver (WDI timeout) */
+      vos_mem_free(pWDA->wdaWdiApiMsgParam);
+   }
+
+   if ( eDRIVER_TYPE_MFG != pWDA->driverMode )
+   {
+      wdaDestroyTimers(pWDA);
+   }
+   pWDA->wdaWdiApiMsgParam = NULL;
+
+   /* call WDI shutdown */
+   wdiStatus = WDI_Shutdown(closeTransport);
+
+   if (IS_WDI_STATUS_FAILURE(wdiStatus) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "error in WDA Stop" );
+      status = VOS_STATUS_E_FAILURE;
+   }
+   /* WDI stop is synchrnous, shutdown is complete when it returns */
+   pWDA->wdaState = WDA_STOP_STATE;
+
+
+   /* shutdown should perform the stop & close actions. */
+   /* Destroy the event */
+   status = vos_event_destroy(&pWDA->txFrameEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+   status = vos_event_destroy(&pWDA->suspendDataTxEvent);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+   status = vos_event_destroy(&pWDA->waitOnWdiIndicationCallBack);
+   if(!VOS_IS_STATUS_SUCCESS(status))
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                  "VOS Event destroy failed - status = %d\n", status);
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   /* free WDA context */
+   status = vos_free_context(pVosContext,VOS_MODULE_ID_WDA,pWDA);
+   if ( !VOS_IS_STATUS_SUCCESS(status) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                                  "error in WDA close " );
+      status = VOS_STATUS_E_FAILURE;
+   }
+
+   return status;
+}
diff --git a/CORE/WDA/src/wlan_qct_wda_debug.c b/CORE/WDA/src/wlan_qct_wda_debug.c
new file mode 100644
index 0000000..13a266e
--- /dev/null
+++ b/CORE/WDA/src/wlan_qct_wda_debug.c
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       wlan_qct_wda_debug.c
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Device Adaptation
+  Layer for debugging APIs.
+
+  The functions externalized by this module are to be called ONLY by other
+  WLAN modules that properly register with the Transport Layer initially.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
+===========================================================================*/
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
+#include "palTypes.h"
+#include "wlan_qct_wda_debug.h"
+
+void wdaLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) {
+    va_list marker;
+    
+    if(loglevel > pMac->utils.gLogDbgLevel[WDA_DEBUG_LOGIDX])
+        return;
+   
+    va_start( marker, pString );     /* Initialize variable arguments. */
+    
+    logDebug(pMac, SIR_WDA_MODULE_ID, loglevel, pString, marker);
+    
+    va_end( marker );              /* Reset variable arguments.      */
+}
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
diff --git a/CORE/WDA/src/wlan_qct_wda_debug.h b/CORE/WDA/src/wlan_qct_wda_debug.h
new file mode 100644
index 0000000..0eb74c9
--- /dev/null
+++ b/CORE/WDA/src/wlan_qct_wda_debug.h
@@ -0,0 +1,78 @@
+/*
+ * 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 __WDA_DEBUG_H__
+#define __WDA_DEBUG_H__
+#if (!defined ANI_OS_TYPE_OSX && !defined (ANI_OS_TYPE_ANDROID))
+#include <stdio.h>
+#endif
+#include <stdarg.h>
+
+#include "utilsApi.h"
+#include "sirDebug.h"
+#include "sirParams.h"
+#define WDA_DEBUG_LOGIDX  ( LOG_INDEX_FOR_MODULE(SIR_WDA_MODULE_ID) )
+
+
+
+#ifdef WLAN_DEBUG
+
+#define WDALOGP(x0)  x0
+#define WDALOGE(x0)  x0
+#define WDALOGW(x0)  x0
+#define WDALOG1(x0)  x0
+
+#ifdef HAL_DEBUG_LOG2
+#define WDALOG2(x0)  x0
+#else
+ #define WDALOG2(x0)
+#endif
+
+#ifdef HAL_DEBUG_LOG3
+#define WDALOG3(x0)  x0
+#else
+ #define WDALOG3(x0)
+#endif
+
+#ifdef HAL_DEBUG_LOG4
+#define WDALOG4(x0)  x0
+#else
+ #define WDALOG4(x0)
+#endif
+
+#define STR(x)  x
+
+#else
+
+#define WDALOGP(x)  x
+#define WDALOGE(x)  {}
+#define WDALOGW(x)  {}
+#define WDALOG1(x)  {}
+#define WDALOG2(x)  {}
+#define WDALOG3(x)  {}
+#define WDALOG4(x)  {}
+#define STR(x)      ""
+#endif
+
+void wdaLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...);
+
+#endif // __WDA_DEBUG_H__
+
diff --git a/CORE/WDA/src/wlan_qct_wda_ds.c b/CORE/WDA/src/wlan_qct_wda_ds.c
new file mode 100644
index 0000000..9d638cd
--- /dev/null
+++ b/CORE/WDA/src/wlan_qct_wda_ds.c
@@ -0,0 +1,1627 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+
+                       W L A N _ Q C T _ WDA _ DS . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of WLAN Data Abtraction APIs
+  for the WLAN Transport Layer.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2010-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
+--------    ---         ----------------------------------------------
+12/08/2010  seokyoun    Created. Move down HAL interfaces from TL to WDA
+                        for UMAC convergence btween Volans/Libra and Prima
+=========================================================================== */
+
+#include "wlan_qct_wda.h"
+#include "wlan_qct_tl.h"
+#include "wlan_qct_tli.h"
+#include "tlDebug.h"
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+#include "wlan_bal_misc.h"
+#endif
+
+#define WDA_DS_DXE_RES_COUNT   WDA_TLI_MIN_RES_DATA + 20
+
+#define VOS_TO_WPAL_PKT(_vos_pkt) ((wpt_packet*)_vos_pkt)
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+#define WDA_HI_FLOW_MASK 0xF0
+#define WDA_LO_FLOW_MASK 0x0F
+
+static v_VOID_t 
+WDA_DS_TxCompleteCB
+(
+ v_PVOID_t pvosGCtx, 
+ v_PVOID_t pFrameDataBuff
+);
+#endif
+
+#if defined( FEATURE_WLAN_NON_INTEGRATED_SOC )
+/*==========================================================================
+   FUNCTION    WDA_DS_PrepareBDHeader
+
+  DESCRIPTION
+    Inline function for preparing BD header before HAL processing.
+
+  DEPENDENCIES
+    Just notify HAL that suspend in TL is complete.
+
+  PARAMETERS
+
+   IN
+    vosDataBuff:      vos data buffer
+    ucDisableFrmXtl:  is frame xtl disabled
+
+   OUT
+    ppvBDHeader:      it will contain the BD header
+    pvDestMacAddr:   it will contain the destination MAC address
+    pvosStatus:       status of the combined processing
+    pusPktLen:        packet len.
+
+  RETURN VALUE
+    No return.
+
+  SIDE EFFECTS
+
+============================================================================*/
+void
+WDA_DS_PrepareBDHeader
+(
+  vos_pkt_t*      vosDataBuff,
+  v_PVOID_t*      ppvBDHeader,
+  v_MACADDR_t*    pvDestMacAddr,
+  v_U8_t          ucDisableFrmXtl,
+  VOS_STATUS*     pvosStatus,
+  v_U16_t*        pusPktLen,
+  v_U8_t          ucQosEnabled,
+  v_U8_t          ucWDSEnabled,
+  v_U8_t          extraHeadSpace
+)
+{
+  v_U8_t      ucHeaderOffset;
+  v_U8_t      ucHeaderLen;
+#ifndef WLAN_SOFTAP_FEATURE
+  v_PVOID_t   pvPeekData;
+#endif
+  v_U8_t      ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl);
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+  /*-------------------------------------------------------------------------
+    Get header pointer from VOSS
+    !!! make sure reserve head zeros out the memory
+   -------------------------------------------------------------------------*/
+  vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
+
+  if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Length of the packet smaller than expected network"
+               " header %d", *pusPktLen ));
+
+    *pvosStatus = VOS_STATUS_E_INVAL;
+    return;
+  }
+
+  vos_pkt_reserve_head( vosDataBuff, ppvBDHeader,
+                        ucBDHeaderLen );
+  if ( NULL == *ppvBDHeader )
+  {
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:VOSS packet corrupted on Attach BD header"));
+    *pvosStatus = VOS_STATUS_E_INVAL;
+    return;
+  }
+
+  /*-----------------------------------------------------------------------
+    Extract MAC address
+   -----------------------------------------------------------------------*/
+#ifdef WLAN_SOFTAP_FEATURE
+  {
+   v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE;
+   *pvosStatus = vos_pkt_extract_data( vosDataBuff,
+                                     ucBDHeaderLen +
+                                     WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
+                                     (v_PVOID_t)pvDestMacAddr,
+                                     &usMacAddrSize );
+  }
+#else
+  *pvosStatus = vos_pkt_peek_data( vosDataBuff,
+                                     ucBDHeaderLen +
+                                     WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
+                                     (v_PVOID_t)&pvPeekData,
+                                     VOS_MAC_ADDR_SIZE );
+
+  /*Fix me*/
+  vos_copy_macaddr(pvDestMacAddr, (v_MACADDR_t*)pvPeekData);
+#endif
+  if ( VOS_STATUS_SUCCESS != *pvosStatus )
+  {
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                "WLAN TL:Failed while attempting to extract MAC Addr %d",
+                *pvosStatus));
+  }
+  else
+  {
+    /*---------------------------------------------------------------------
+        Fill MPDU info fields:
+          - MPDU data start offset
+          - MPDU header start offset
+          - MPDU header length
+          - MPDU length - this is a 16b field - needs swapping
+    --------------------------------------------------------------------*/
+    ucHeaderOffset = ucBDHeaderLen;
+    ucHeaderLen    = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl);
+
+    if ( 0 != ucDisableFrmXtl )
+    {
+      if ( 0 != ucQosEnabled )
+      {
+        ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL;
+      }
+
+      // Similar to Qos we need something for WDS format !
+      if ( ucWDSEnabled != 0 )
+      {
+        // If we have frame translation enabled
+        ucHeaderLen    += WLANTL_802_11_HEADER_ADDR4_LEN;
+      }
+      if ( extraHeadSpace != 0 )
+      {
+        // Decrease the packet length with the extra padding after the header
+        *pusPktLen = *pusPktLen - extraHeadSpace;
+      }
+    }
+
+    WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen);
+    WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset);
+    WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader,
+                                          ucHeaderOffset + ucHeaderLen + extraHeadSpace);
+    WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen);
+
+    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+                "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
+                ucHeaderLen, ucHeaderOffset, 
+                (ucHeaderOffset + ucHeaderLen + extraHeadSpace), 
+                *pusPktLen, extraHeadSpace));
+  }/* if peek MAC success*/
+
+}/* WLANTL_PrepareBDHeader */
+#endif /* FEATURE_WLAN_NON_INTEGRATED_SOC */
+
+#ifdef WLAN_PERF
+/*==========================================================================
+  FUNCTION    WDA_TLI_FastHwFwdDataFrame
+
+  DESCRIPTION 
+    For NON integrated SOC, this function is called by TL.
+
+    Fast path function to quickly forward a data frame if HAL determines BD 
+    signature computed here matches the signature inside current VOSS packet. 
+    If there is a match, HAL and TL fills in the swapped packet length into 
+    BD header and DxE header, respectively. Otherwise, packet goes back to 
+    normal (slow) path and a new BD signature would be tagged into BD in this
+    VOSS packet later by the WLANHAL_FillTxBd() function.
+
+  TODO  For integrated SOC, this function does nothing yet. Pima SLM/HAL 
+        should provide the equivelant functionality.
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+        vosDataBuff Ptr to VOSS packet
+        pMetaInfo   For getting frame's TID
+        pStaInfo    For checking STA type
+    
+   OUT
+        pvosStatus  returned status
+        puFastFwdOK Flag to indicate whether frame could be fast forwarded
+   
+  RETURN VALUE
+    No return.   
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+void WDA_TLI_FastHwFwdDataFrame
+(
+  v_PVOID_t     pvosGCtx,
+  vos_pkt_t*    vosDataBuff,
+  VOS_STATUS*   pvosStatus,
+  v_U32_t*       puFastFwdOK,
+  WLANTL_MetaInfoType*  pMetaInfo,
+  WLAN_STADescType*  pStaInfo
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /* FIXME WDI/WDA should support this function
+     once HAL supports it
+   */
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+   v_PVOID_t   pvPeekData;
+   v_U8_t      ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType); 
+   v_U8_t      ucIsUnicast;
+   WLANBAL_sDXEHeaderType  *pDxEHeader;
+   v_PVOID_t   pvBDHeader;
+   v_PVOID_t   pucBuffPtr;
+   v_U16_t      usPktLen;
+
+   /*-----------------------------------------------------------------------
+    Extract packet length
+   -----------------------------------------------------------------------*/
+
+   vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
+
+   /*-----------------------------------------------------------------------
+    Extract MAC address
+    -----------------------------------------------------------------------*/
+   *pvosStatus = vos_pkt_peek_data( vosDataBuff, 
+                                 WLANTL_MAC_ADDR_ALIGN(0), 
+                                 (v_PVOID_t)&pvPeekData, 
+                                 VOS_MAC_ADDR_SIZE );
+
+   if ( VOS_STATUS_SUCCESS != *pvosStatus ) 
+   {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Failed while attempting to extract MAC Addr %d", 
+                 *pvosStatus));
+      *pvosStatus = VOS_STATUS_E_INVAL;
+      return;
+   }
+
+   /*-----------------------------------------------------------------------
+    Reserve head room for DxE header, BD, and WLAN header
+    -----------------------------------------------------------------------*/
+
+   vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr, 
+                        ucDxEBDWLANHeaderLen );
+   if ( NULL == pucBuffPtr )
+   {
+       TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                    "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff));
+      *pvosStatus = VOS_STATUS_E_INVAL;
+       return;
+   }
+   pDxEHeader = (WLANBAL_sDXEHeaderType  *)pucBuffPtr;
+   pvBDHeader = (v_PVOID_t) &pDxEHeader[1];
+
+   /* UMA Tx acceleration is enabled. 
+    * UMA would help convert frames to 802.11, fill partial BD fields and 
+    * construct LLC header. To further accelerate this kind of frames,
+    * HAL would attempt to reuse the BD descriptor if the BD signature 
+    * matches to the saved BD descriptor.
+    */
+   if(pStaInfo->wSTAType == WLAN_STA_IBSS)
+      ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01);
+   else
+      ucIsUnicast = 1;
+ 
+   *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen );
+    
+   /* Can't be fast forwarded. Trim the VOS head back to original location. */
+   if(! *puFastFwdOK){
+       vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen);
+   }else{
+      /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped
+       */
+      v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen;
+      vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, 
+                       (v_PVOID_t)uPacketSize);
+      pDxEHeader->size  = SWAP_ENDIAN_UINT32(uPacketSize);
+   }
+
+   *pvosStatus = VOS_STATUS_SUCCESS;
+   return;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+#endif /*WLAN_PERF*/
+
+/*==========================================================================
+  FUNCTION    WDA_DS_Register
+
+  DESCRIPTION 
+    Register TL client to WDA. This function registers TL RX/TX functions
+    to WDI by calling WDI_DS_Register.
+
+
+    For NON integrated SOC, this function calls WLANBAL_RegTlCbFunctions
+    to register TL's RX/TX functions to BAL
+
+  TODO 
+    For Prima, pfnResourceCB gets called in WDTS_OOResourceNotification.
+    The uCount parameter is AC mask. It should be redefined to use the
+    same resource callback function.
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+        pfnTxCompleteCallback       TX complete callback upon TX completion
+        pfnRxPacketCallback         RX callback
+        pfnTxPacketCallback         TX callback
+        pfnResourceCB               gets called when updating TX PDU number
+        uResTheshold                minimum TX PDU size for a packet
+        pCallbackContext            WDI calls callback function with it
+                                    VOS global context pointer
+   OUT
+        uAvailableTxBuf       available TX PDU numbder. 
+                              BAL returns it for NON integrated SOC
+   
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS WDA_DS_Register 
+( 
+  v_PVOID_t                 pvosGCtx, 
+  WDA_DS_TxCompleteCallback pfnTxCompleteCallback,
+  WDA_DS_RxPacketCallback   pfnRxPacketCallback, 
+  WDA_DS_TxPacketCallback   pfnTxPacketCallback,
+  WDA_DS_ResourceCB         pfnResourceCB,
+  v_U32_t                   uResTheshold,
+  v_PVOID_t                 pCallbackContext,
+  v_U32_t                   *uAvailableTxBuf
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  tWDA_CbContext      *wdaContext = NULL;
+  WDI_Status          wdiStatus;
+
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN WDA: WDA_DS_Register" );
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( ( NULL == pvosGCtx ) ||
+       ( NULL == pfnTxPacketCallback ) ||
+       ( NULL == pfnTxCompleteCallback ) ||
+       ( NULL == pfnRxPacketCallback ) ||
+       ( NULL == pfnResourceCB) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WLAN WDA:Invalid pointers on WDA_DS_Register" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract WDA context
+   ------------------------------------------------------------------------*/
+  wdaContext = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA, pvosGCtx );
+  if ( NULL == wdaContext )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WLAN WDA:Invalid wda context pointer "
+               "from pvosGCtx on WDA_DS_Register" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Register with WDI as transport layer client
+  ------------------------------------------------------------------------*/
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, "WDA: WDA_DS_Register");
+
+  wdaContext->pfnTxResourceCB       = pfnResourceCB;
+  wdaContext->pfnTxCompleteCallback = pfnTxCompleteCallback;
+
+  wdiStatus = WDI_DS_Register( wdaContext->pWdiContext,
+                               (WDI_DS_TxCompleteCallback)WDA_DS_TxCompleteCB,
+                               (WDI_DS_RxPacketCallback)pfnRxPacketCallback,
+                               WDA_DS_TxFlowControlCallback,
+                               pvosGCtx );
+
+  if ( WDI_STATUS_SUCCESS != wdiStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:TL failed to register with DAL, Err: %d", wdiStatus );
+    return VOS_STATUS_E_FAILURE;
+  }
+   
+  /* TODO Out-of-resource condition if PDU size is less than WLANTL_MIN_RES_MF 
+     Put hardcoded value not to put TL into OOR. Revisit it */
+  *uAvailableTxBuf = WDA_DS_DXE_RES_COUNT; 
+
+  return VOS_STATUS_SUCCESS;
+#else /* FEATURE_WLAN_INTEGRATED_SOC */
+  VOS_STATUS          vosStatus;
+  WLANBAL_TlRegType   tlReg;
+
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "WLAN WDA: WDA_DS_Register" );
+
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( ( NULL == pvosGCtx ) ||
+       ( NULL == pfnTxPacketCallback ) ||
+       ( NULL == pfnTxCompleteCallback ) ||
+       ( NULL == pfnRxPacketCallback ) ||
+       ( NULL == pfnResourceCB ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN WDA:Invalid pointers on WDA_DS_Register" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Register with BAL as transport layer client
+  ------------------------------------------------------------------------*/
+  tlReg.receiveFrameCB = pfnRxPacketCallback;
+  tlReg.getTXFrameCB   = pfnTxPacketCallback;
+  tlReg.txCompleteCB   = pfnTxCompleteCallback;
+  tlReg.txResourceCB   = pfnResourceCB;
+  tlReg.txResourceThreashold = uResTheshold;
+  tlReg.tlUsrData      = pvosGCtx;
+
+  vosStatus = WLANBAL_RegTlCbFunctions( pvosGCtx, &tlReg );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, 
+               "WLAN TL: TL failed to register with BAL, Err: %d", vosStatus );
+    return vosStatus;
+  }
+
+  /*------------------------------------------------------------------------
+    Request resources for tx from bus
+  ------------------------------------------------------------------------*/
+  vosStatus = WLANBAL_GetTxResources( pvosGCtx, uAvailableTxBuf );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:TL failed to get resources from BAL, Err: %d",
+               vosStatus );
+    return vosStatus;
+  }
+
+  return vosStatus;
+#endif
+}
+
+/*==========================================================================
+  FUNCTION    WDA_DS_StartXmit
+
+  DESCRIPTION 
+    Serialize TX transmit reques to TX thread. 
+
+  TODO This sends TX transmit request to TL. It should send to WDI for
+         abstraction.
+
+    For NON integrated SOC, this function calls WLANBAL_StartXmit
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        pvosGCtx    VOS context
+   
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WDA_DS_StartXmit
+(
+  v_PVOID_t pvosGCtx
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  vos_msg_t                    sMessage;
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if ( NULL == pvosGCtx )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN WDA:Invalid pointers on WDA_DS_StartXmit" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /* Serialize our event  */
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "Serializing WDA TX Start Xmit event" );
+
+  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
+
+  sMessage.bodyptr = NULL;
+  sMessage.type    = WDA_DS_TX_START_XMIT;
+
+  return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  return WLANBAL_StartXmit( pvosGCtx );
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+/*==========================================================================
+  FUNCTION    WDA_DS_FinishULA
+
+  DESCRIPTION 
+    Serialize Finish Upper Level Authentication reques to TX thread. 
+
+  DEPENDENCIES 
+     
+  PARAMETERS 
+
+   IN
+        callbackRoutine    routine to be called in TX thread
+        callbackContext    user data for the above routine 
+   
+  RETURN VALUE
+    please see vos_tx_mq_serialize
+
+  SIDE EFFECTS 
+  
+============================================================================*/
+VOS_STATUS
+WDA_DS_FinishULA
+(
+ void (*callbackRoutine) (void *callbackContext),
+ void  *callbackContext
+)
+{
+  vos_msg_t                    sMessage;
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /* Serialize our event  */
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+             "Serializing WDA_DS_FinishULA event" );
+
+  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
+
+  sMessage.bodyval  = (v_U32_t)callbackContext;
+  sMessage.bodyptr  = callbackRoutine;
+  sMessage.type     = WDA_DS_FINISH_ULA;
+
+  return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
+}/*WDA_DS_FinishULA*/
+
+/*==========================================================================
+   FUNCTION    WDA_DS_BuildTxPacketInfo
+
+  DESCRIPTION
+    Build TX meta info for integrated SOC.
+    
+    Same function calls HAL for reserve BD header space into VOS packet and
+    HAL function to fill it.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    vosDataBuff      vos data buffer
+    pvDestMacAddr   destination MAC address ponter
+    ucDisableFrmXtl  Is frame xtl disabled?
+    ucQosEnabled     Is QoS enabled?
+    ucWDSEnabled     Is WDS enabled?
+    extraHeadSpace   Extra head bytes. If it's not 0 due to 4 bytes align
+                     of BD header.
+    typeSubtype      typeSubtype from MAC header or TX metainfo/BD
+    pAddr2           address 2
+    uTid             tid
+    txFlag
+    timeStamp
+    ucIsEapol
+    ucUP
+
+   OUT
+    *pusPktLen       Packet length
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_BuildTxPacketInfo
+(
+  v_PVOID_t       pvosGCtx,
+  vos_pkt_t*      vosDataBuff,
+  v_MACADDR_t*    pvDestMacAddr,
+  v_U8_t          ucDisableFrmXtl,
+  v_U16_t*        pusPktLen,
+  v_U8_t          ucQosEnabled,
+  v_U8_t          ucWDSEnabled,
+  v_U8_t          extraHeadSpace,
+  v_U8_t          typeSubtype,
+  v_PVOID_t       pAddr2,
+  v_U8_t          uTid,
+  v_U8_t          txFlag,
+  v_U32_t         timeStamp,
+  v_U8_t          ucIsEapol,
+  v_U8_t          ucUP
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  VOS_STATUS             vosStatus;
+  WDI_DS_TxMetaInfoType* pTxMetaInfo = NULL;
+  v_SIZE_t               usMacAddrSize;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    Extract TL control block
+   ------------------------------------------------------------------------*/
+  if ( ( NULL == pvosGCtx ) || ( NULL == vosDataBuff ) || ( NULL == pvDestMacAddr ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Invalid parameter sent on WDA_DS_BuildTxPacketInfo" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract TX Meta Info pointer from PAL packet
+   ------------------------------------------------------------------------*/
+  pTxMetaInfo = WDI_DS_ExtractTxMetaData( VOS_TO_WPAL_PKT(vosDataBuff)  );
+  if ( NULL == pTxMetaInfo )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+        "WLAN TL:Invalid RxMetaInfo pointer from PAL packet on WLANTL_RxFrames");
+    VOS_ASSERT( 0 );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /* Zero out memeory */
+  vos_mem_zero( pTxMetaInfo, sizeof( WDI_DS_TxMetaInfoType ) );
+
+  /* Fill the TX Meta info */
+  pTxMetaInfo->txFlags    = txFlag;
+  pTxMetaInfo->qosEnabled = ucQosEnabled;
+  pTxMetaInfo->fenableWDS = ucWDSEnabled;
+  pTxMetaInfo->ac         = ucUP;
+  pTxMetaInfo->fUP        = uTid;
+  pTxMetaInfo->isEapol    = ucIsEapol;
+  pTxMetaInfo->fdisableFrmXlt = ucDisableFrmXtl;
+  pTxMetaInfo->frmType     = ( ( typeSubtype & 0x30 ) >> 4 );
+  pTxMetaInfo->typeSubtype = typeSubtype;
+
+  /* Length = MAC header + payload */
+  vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
+  pTxMetaInfo->fPktlen = *pusPktLen;
+
+  // Dst address
+  usMacAddrSize = VOS_MAC_ADDR_SIZE;
+  vosStatus = vos_pkt_extract_data( vosDataBuff,
+                    WLANTL_MAC_ADDR_ALIGN( ucDisableFrmXtl ),
+                    (v_PVOID_t)pvDestMacAddr,
+                    &usMacAddrSize );
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Failed while attempting to extract MAC Addr %d",
+                vosStatus );
+    VOS_ASSERT( 0 );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  VOS_ASSERT(usMacAddrSize == VOS_MAC_ADDR_SIZE);
+
+  vos_copy_macaddr( (v_MACADDR_t*)pTxMetaInfo->fSTAMACAddress, pvDestMacAddr );
+
+  // ADDR2
+  vos_copy_macaddr( (v_MACADDR_t*)pTxMetaInfo->addr2MACAddress, pAddr2 );
+
+  /* Dump TX meta infro for debugging */
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
+             "WLAN TL: Dump TX meta info: "
+             "txFlags:%d, qosEnabled:%d, ac:%d, "
+             "isEapol:%d, fdisableFrmXlt:%d" "frmType%d",
+             pTxMetaInfo->txFlags, ucQosEnabled, pTxMetaInfo->ac,
+             pTxMetaInfo->isEapol, pTxMetaInfo->fdisableFrmXlt, pTxMetaInfo->frmType );
+
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  VOS_STATUS   vosStatus;
+  v_PVOID_t    pvBDHeader;
+
+  WDA_DS_PrepareBDHeader( vosDataBuff, &pvBDHeader, pvDestMacAddr, ucDisableFrmXtl,
+                  &vosStatus, pusPktLen, ucQosEnabled, ucWDSEnabled, extraHeadSpace );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Failed while attempting to prepare BD %d", vosStatus );
+    return vosStatus;
+  }
+
+  vosStatus = WLANHAL_FillTxBd( pvosGCtx, typeSubtype, pvDestMacAddr, pAddr2,
+                    &uTid, ucDisableFrmXtl, pvBDHeader, txFlag, timeStamp );
+
+  if ( VOS_STATUS_SUCCESS != vosStatus )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL:Failed while attempting to fill BD %d", vosStatus );
+    return vosStatus;
+  }
+
+  return VOS_STATUS_SUCCESS;
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+/*==========================================================================
+   FUNCTION    WDS_DS_TrimRxPacketInfo
+
+  DESCRIPTION
+    Trim/Remove RX BD header for NON integrated SOC.
+    It does nothing for integrated SOC.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_TrimRxPacketInfo
+( 
+  vos_pkt_t *vosDataBuff
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /* Nothing to trim
+   * Do Nothing */
+
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+  v_U16_t  usPktLen;
+  v_U8_t   ucMPDUHOffset;
+  v_U16_t  usMPDUDOffset;
+  v_U16_t  usMPDULen;
+  v_U8_t   ucMPDUHLen = 0;
+  v_U8_t   aucBDHeader[WLANHAL_RX_BD_HEADER_SIZE];
+
+  vos_pkt_pop_head( vosDataBuff, aucBDHeader, WLANHAL_RX_BD_HEADER_SIZE);
+
+  ucMPDUHOffset = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_OFFSET(aucBDHeader);
+  usMPDUDOffset = (v_U16_t)WLANHAL_RX_BD_GET_MPDU_D_OFFSET(aucBDHeader);
+  usMPDULen     = (v_U16_t)WLANHAL_RX_BD_GET_MPDU_LEN(aucBDHeader);
+  ucMPDUHLen    = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_LEN(aucBDHeader);
+  
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+       "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
+       " Tid %d BD %d",
+       ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen,
+       WLANHAL_RX_BD_HEADER_SIZE );
+
+  vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
+
+  if (( ucMPDUHOffset >= WLANHAL_RX_BD_HEADER_SIZE ) &&
+      ( usMPDUDOffset >  ucMPDUHOffset ) &&
+      ( usMPDULen     >= ucMPDUHLen ) &&
+      ( usPktLen >= usMPDULen ))
+  {
+    if((ucMPDUHOffset - WLANHAL_RX_BD_HEADER_SIZE) > 0)
+    {
+      vos_pkt_trim_head( vosDataBuff, ucMPDUHOffset - WLANHAL_RX_BD_HEADER_SIZE);
+    }
+    else
+    {
+      /* Nothing to trim
+       * Do Nothing */
+    }
+    vosStatus = VOS_STATUS_SUCCESS;
+  }
+  else
+  {
+    vosStatus = VOS_STATUS_E_FAILURE;
+  }
+
+  return vosStatus;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+
+/*==========================================================================
+   FUNCTION    WDA_DS_PeekRxPacketInfo
+
+  DESCRIPTION
+    Return RX metainfo pointer for for integrated SOC.
+    
+    Same function will return BD header pointer.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+    pvDestMacAddr   destination MAC address ponter
+    bSwap            Want to swap BD header? For backward compatability
+                     It does nothing for integrated SOC
+   OUT
+    *ppRxHeader      RX metainfo pointer
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_PeekRxPacketInfo
+(
+  vos_pkt_t *vosDataBuff,
+  v_PVOID_t *ppRxHeader,
+  v_BOOL_t  bSwap
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if (  NULL == vosDataBuff )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Invalid parameter sent on WDA_DS_PeekRxPacketInfo" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  *ppRxHeader = WDI_DS_ExtractRxMetaData( (wpt_packet*)vosDataBuff );
+
+  if ( NULL == *ppRxHeader )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Failed to get RX meta data from WDI" );
+     return VOS_STATUS_E_FAILURE;
+  }
+     
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  VOS_STATUS vosStatus;
+
+  vosStatus = vos_pkt_peek_data( vosDataBuff, 0, (v_PVOID_t)ppRxHeader,
+                                   WLANHAL_RX_BD_HEADER_SIZE);
+
+  if ( ( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == (v_PVOID_t)ppRxHeader ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WDA :Cannot extract BD header" );
+    return VOS_STATUS_E_FAILURE;
+  }
+
+  if ( VOS_TRUE == bSwap )
+  {
+    WLANHAL_SwapRxBd( *ppRxHeader );
+  }
+
+  return VOS_STATUS_SUCCESS;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetFrameTypeSubType
+
+  DESCRIPTION
+    Get typeSubtype from the packet. The BD header should have this.
+    But some reason, Libra/Volans read it from 802.11 header and save it
+    back to BD header. So for NON integrated SOC, this function does
+    the same.
+
+    For integrated SOC, WDI does the same, not TL. 
+    It does return typeSubtype from RX meta info for integrated SOC.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    vosDataBuff      vos data buffer
+    pRxHeader        RX meta info or BD header pointer
+
+   OUT
+    ucTypeSubtype    typeSubtype
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetFrameTypeSubType
+(
+  v_PVOID_t pvosGCtx,
+  vos_pkt_t *vosDataBuff,
+  v_PVOID_t pRxHeader,
+  v_U8_t    *ucTypeSubtype
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /*------------------------------------------------------------------------
+    Sanity check
+   ------------------------------------------------------------------------*/
+  if ( NULL == pRxHeader )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Invalid parameter sent on WDA_DS_GetFrameTypeSubType" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  *ucTypeSubtype = ( WDA_GET_RX_TYPE( pRxHeader ) << 4 ) | WDA_GET_RX_SUBTYPE( pRxHeader );
+
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  v_PVOID_t           pvBDHeader = pRxHeader;
+  v_U16_t             usFrmCtrl  = 0; 
+  v_U8_t              ucFrmType;
+  v_SIZE_t            usFrmCtrlSize = sizeof(usFrmCtrl); 
+  VOS_STATUS          vosStatus;
+
+  /*---------------------------------------------------------------------
+    Extract frame control field from 802.11 header if present 
+    (frame translation not done) 
+  ---------------------------------------------------------------------*/
+  vosStatus = vos_pkt_extract_data( vosDataBuff, 
+                       ( 0 == WLANHAL_RX_BD_GET_FT(pvBDHeader) ) ?
+                       WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pvBDHeader):
+                       WLANHAL_RX_BD_HEADER_SIZE,
+                       &usFrmCtrl, &usFrmCtrlSize );
+
+  if (( VOS_STATUS_SUCCESS != vosStatus ) || 
+      ( sizeof(usFrmCtrl) != usFrmCtrlSize ))
+  {
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+               "WLAN TL: Cannot extract Frame Control Field" );
+    return VOS_STATUS_E_FAILURE;
+  }
+
+
+  ucFrmType = (v_U8_t)WLANHAL_RxBD_GetFrameTypeSubType( pvBDHeader, 
+                                                        usFrmCtrl);
+  WLANHAL_RX_BD_SET_TYPE_SUBTYPE(pvBDHeader, ucFrmType);
+
+  *ucTypeSubtype = ucFrmType;
+  
+  return VOS_STATUS_SUCCESS;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+/*==========================================================================
+   FUNCTION    WDA_DS_RxAmsduBdFix
+
+  DESCRIPTION
+    For backward compatability with Libra/Volans. Need to call HAL function
+    for HW BD bug fix
+
+    It does nothing for integrated SOC.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    pvBDHeader       BD header pointer
+
+   OUT
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_RxAmsduBdFix
+(
+  v_PVOID_t pvosGCtx,
+  v_PVOID_t pvBDHeader
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /* Do nothing for Prima */
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  /* AMSDU HW bug fix
+   * After 2nd AMSDU subframe HW could not handle BD correctly
+   * HAL workaround is needed */
+  WLANHAL_RxAmsduBdFix(pvosGCtx, pvBDHeader);
+  return VOS_STATUS_SUCCESS;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetRssi
+
+  DESCRIPTION
+    Get RSSI 
+
+  TODO It returns hardcoded value in the meantime since WDA/WDI does nothing
+       support it yet for Prima.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+
+   OUT
+    puRssi           RSSI
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetRssi
+(
+  v_PVOID_t pvosGCtx,
+  v_S7_t*   puRssi
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+         "WDA:halPS_GetRssi no longer supported. Need replacement");
+
+  *puRssi = -30;
+
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  halPS_GetRssi(vos_get_context(VOS_MODULE_ID_SME, pvosGCtx), puRssi);
+  return VOS_STATUS_SUCCESS;
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetTxResources
+
+  DESCRIPTION
+    It does return hardcoded value. It should bigger number than 0.
+    Returning 0 will put TL in out-of-resource condition for TX.
+
+    Return current PDU resources from BAL for NON integrated SOC.
+    
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    vosDataBuff      vos data buffer
+   
+   OUT
+    puResCount        available PDU number for TX
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetTxResources
+( 
+  v_PVOID_t pvosGCtx,
+  v_U32_t*  puResCount
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  /* Return minimum necessary number of packet(DXE descriptor) for data */
+  /* TODO Need to get this from DXE??? */
+  *puResCount = WDA_TLI_BD_PDU_RESERVE_THRESHOLD + 50;
+  return VOS_STATUS_SUCCESS;
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+  return WLANBAL_GetTxResources( pvosGCtx, puResCount );
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetReplayCounter
+
+  DESCRIPTION
+    Return replay counter from BD header or RX meta info
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pRxHeader        RX meta info or BD header pointer
+
+   OUT
+
+  RETURN VALUE
+    Replay Counter
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_U64_t
+WDA_DS_GetReplayCounter
+(
+  v_PVOID_t pRxHeader
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+  return WDA_GET_RX_REPLAY_COUNT( pRxHeader );
+#else  /* FEATURE_WLAN_INTEGRATED_SOC */
+   v_U8_t *pucRxBDHeader = pRxHeader;
+
+/* 48-bit replay counter is created as follows
+   from RX BD 6 byte PMI command:
+   Addr : AES/TKIP
+   0x38 : pn3/tsc3
+   0x39 : pn2/tsc2
+   0x3a : pn1/tsc1
+   0x3b : pn0/tsc0
+
+   0x3c : pn5/tsc5
+   0x3d : pn4/tsc4 */
+
+#ifdef ANI_BIG_BYTE_ENDIAN
+    v_U64_t ullcurrentReplayCounter = 0;
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    ullcurrentReplayCounter <<= 16;
+    ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
+    return ullcurrentReplayCounter;
+#else
+    v_U64_t ullcurrentReplayCounter = 0;
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF); 
+    ullcurrentReplayCounter <<= 32; 
+    ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    return ullcurrentReplayCounter;
+#endif
+
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+/*==========================================================================
+   FUNCTION    WDA_DS_TxFrames
+
+  DESCRIPTION
+    Pull packets from TL and push them to WDI. It gets invoked upon
+    WDA_DS_TX_START_XMIT.
+
+    This function is equivelant of WLANSSC_Transmit in Libra/Volans.
+
+  TODO
+    This function should be implemented and moved in WDI.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+
+   OUT
+
+  RETURN VALUE
+    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+
+VOS_STATUS
+WDA_DS_TxFrames
+( 
+  v_PVOID_t pvosGCtx 
+)
+{
+  VOS_STATUS vosStatus;
+  vos_pkt_t  *pTxMgmtChain = NULL;
+  vos_pkt_t  *pTxDataChain = NULL;
+  vos_pkt_t  *pTxPacket = NULL;
+  v_BOOL_t   bUrgent;
+  wpt_uint32  ucTxResReq;
+  WDI_Status wdiStatus;
+  tWDA_CbContext *wdaContext = NULL;
+  v_U32_t     uMgmtAvailRes;
+  v_U32_t     uDataAvailRes;
+  WLANTL_TxCompCBType  pfnTxComp = NULL;
+
+  wdaContext = (tWDA_CbContext *)vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx);
+  if ( NULL == wdaContext )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA:Invalid wda context pointer from pvosGCtx on WDA_DS_TxFrames" );
+    return VOS_STATUS_E_FAULT;
+  }
+
+  /*-------------------------------------------------------------------------
+     Need to fetch separatelly for Mgmt and Data frames because TL is not
+     aware of separate resource management at the lower levels 
+  -------------------------------------------------------------------------*/
+  /*Mgmt tx*/
+  uMgmtAvailRes = WDI_GetAvailableResCount(wdaContext->pWdiContext, 
+                                           WDI_MGMT_POOL_ID);
+  
+  ucTxResReq = WLANTL_GetFrames( pvosGCtx, 
+                              &pTxMgmtChain, 
+                               uMgmtAvailRes, 
+                              (wdaContext->uTxFlowMask & WDA_HI_FLOW_MASK),
+                              &bUrgent );
+
+  // We need to initialize vsoStatus in case we don't enter the "while"
+  // loop.  If we don't enter the loop, it means that there are no packets,
+  // available, and that is considered success.  If we enter the loop,
+  // vosStatus will be set appropriately inside the loop
+  vosStatus = VOS_STATUS_SUCCESS;
+      
+  while ( NULL != pTxMgmtChain )
+  {
+    /* Walk the chain and unchain the packet */
+    pTxPacket = pTxMgmtChain;
+    vosStatus = vos_pkt_walk_packet_chain( pTxMgmtChain, &pTxMgmtChain, VOS_TRUE );
+
+    if( (VOS_STATUS_SUCCESS != vosStatus) &&
+        (VOS_STATUS_E_EMPTY != vosStatus) )
+    {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA Walking packet chain returned status : %d", vosStatus );
+      VOS_ASSERT( 0 );
+      vosStatus = VOS_STATUS_E_FAILURE;
+      break;
+    }
+
+    if ( VOS_STATUS_E_EMPTY == vosStatus )
+    {
+       vosStatus = VOS_STATUS_SUCCESS;
+    }
+
+    wdiStatus = WDI_DS_TxPacket( wdaContext->pWdiContext, 
+                                 (wpt_packet*)pTxPacket, 
+                                 0 /* more */ );
+    if ( WDI_STATUS_SUCCESS != wdiStatus )
+    {
+      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                   "WDA : Pushing a packet to WDI failed.");
+      VOS_ASSERT( 0 );
+      //We need to free the packet here
+      vos_pkt_get_user_data_ptr(pTxPacket, VOS_PKT_USER_DATA_ID_TL, (void **)&pfnTxComp);
+      if(pfnTxComp)
+      {
+         pfnTxComp(pvosGCtx, pTxPacket, VOS_STATUS_E_FAILURE);
+      }
+    }
+
+  };
+
+  /*Data tx*/
+  uDataAvailRes = WDI_GetAvailableResCount(wdaContext->pWdiContext, 
+                                           WDI_DATA_POOL_ID);
+
+  ucTxResReq = WLANTL_GetFrames( pvosGCtx, 
+                              &pTxDataChain, 
+                              /*WDA_DS_DXE_RES_COUNT*/ uDataAvailRes, 
+                              (wdaContext->uTxFlowMask & WDA_LO_FLOW_MASK),
+                              &bUrgent );
+
+  // We need to initialize vsoStatus in case we don't enter the "while"
+  // loop.  If we don't enter the loop, it means that there are no packets,
+  // available, and that is considered success.  If we enter the loop,
+  // vosStatus will be set appropriately inside the loop
+  vosStatus = VOS_STATUS_SUCCESS;
+
+  while ( NULL != pTxDataChain )
+  {
+    /* Walk the chain and unchain the packet */
+    pTxPacket = pTxDataChain;
+    vosStatus = vos_pkt_walk_packet_chain( pTxDataChain, &pTxDataChain, VOS_TRUE );
+
+    if( (VOS_STATUS_SUCCESS != vosStatus) &&
+        (VOS_STATUS_E_EMPTY != vosStatus) )
+    {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA Walking packet chain returned status : %d", vosStatus );
+      VOS_ASSERT( 0 );
+      vosStatus = VOS_STATUS_E_FAILURE;
+      break;
+    }
+
+    if ( VOS_STATUS_E_EMPTY == vosStatus )
+    {
+       vosStatus = VOS_STATUS_SUCCESS;
+    }
+
+    wdiStatus = WDI_DS_TxPacket( wdaContext->pWdiContext, 
+                                 (wpt_packet*)pTxPacket, 
+                                 0 /* more */ );
+    if ( WDI_STATUS_SUCCESS != wdiStatus )
+    {
+      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                   "WDA : Pushing a packet to WDI failed.");
+      /* TODO Wd should return this packet to VOSS. Otherwise
+         UMAC is going in low resource condition.
+         Who needs to do it? DXE, WDI? 
+         */
+      VOS_ASSERT( 0 );
+      //We need to free the packet here
+      vos_pkt_get_user_data_ptr(pTxPacket, VOS_PKT_USER_DATA_ID_TL, (void **)&pfnTxComp);
+      if(pfnTxComp)
+      {
+         pfnTxComp(pvosGCtx, pTxPacket, VOS_STATUS_E_FAILURE);
+      }
+    }
+
+  };
+
+  WDI_DS_TxComplete(wdaContext->pWdiContext, ucTxResReq);
+
+  return vosStatus;
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+/*==========================================================================
+   FUNCTION    WDA_DS_TxFlowControlCallback
+
+  DESCRIPTION
+    Invoked by WDI to control TX flow.
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+    uFlowMask        TX channel mask for flow control
+                     Defined in WDA_TXFlowEnumType
+
+   OUT
+
+  RETURN VALUE
+
+  SIDE EFFECTS
+
+============================================================================*/
+v_VOID_t
+WDA_DS_TxFlowControlCallback
+(
+   v_PVOID_t pvosGCtx,
+   v_U8_t    ucFlowMask
+)
+{
+   tWDA_CbContext* wdaContext = NULL;
+    v_U8_t          ucOldFlowMask;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*------------------------------------------------------------------------
+     Sanity check
+    ------------------------------------------------------------------------*/
+   if ( NULL == pvosGCtx )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA: Invalid parameter sent on WDA_DS_TxFlowControlCallback" );
+      return;
+   }
+
+   wdaContext = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA, pvosGCtx );
+   if ( NULL == wdaContext )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA: Invalid context on WDA_DS_TxFlowControlCallback" );
+      return;
+   }
+
+   /* two physical DXE channels
+      1) data packets(all four AC) and BAP for the low priority channel(lower 4 bits) 
+      2) management packets for high priority channel(5th bit)
+   */
+
+
+   /*Save and reset */
+   ucOldFlowMask           = wdaContext->uTxFlowMask; 
+   wdaContext->uTxFlowMask = ucFlowMask;
+
+   /*If the AC is being enabled - resume data xfer 
+    
+    Assume previous value of wdaContext->uTxFlowMask: 
+    
+    DATA\MGM |  ON  | OFF
+    ----------------------
+        ON   | 1F   | 0F *
+    ----------------------
+        OFF  |  10 *| 00 *
+    
+        * - states in which a channel can be enabled
+    
+      ucFlowMask will tell which channel must be enabled
+      to enable a channel a new bit must be turned on =>
+      ucFlowMask > wdaContext->uTxFlowMask when enable happens
+   */
+
+   if ( ucFlowMask > ucOldFlowMask  )
+   {
+     WDA_DS_StartXmit(pvosGCtx);
+   }
+
+}
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+
+/*==========================================================================
+   FUNCTION    WDA_DS_GetTxFlowMask
+
+  DESCRIPTION
+    return TX flow mask control value
+
+  DEPENDENCIES
+
+  PARAMETERS
+
+   IN
+    pvosGCtx         VOS context
+
+   OUT
+    uFlowMask        TX channel mask for flow control
+                     Defined in WDA_TXFlowEnumType
+
+  RETURN VALUE
+    VOS_STATUS_E_INVAL:  pointer is NULL and other errors 
+    VOS_STATUS_SUCCESS:  Everything is good :)
+
+  SIDE EFFECTS
+
+============================================================================*/
+VOS_STATUS
+WDA_DS_GetTxFlowMask
+(
+ v_PVOID_t pvosGCtx,
+ v_U8_t*   puFlowMask
+)
+{
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+   tWDA_CbContext* wdaContext = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*------------------------------------------------------------------------
+     Sanity check
+    ------------------------------------------------------------------------*/
+   if ( ( NULL == pvosGCtx ) || ( NULL == puFlowMask ) )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA: Invalid parameter sent on WDA_DS_GetTxFlowMask" );
+      return VOS_STATUS_E_INVAL;
+   }
+
+   wdaContext = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA, pvosGCtx );
+   if ( NULL == wdaContext )
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 "WDA: Invalid context on WDA_DS_GetTxFlowMask" );
+      return VOS_STATUS_E_INVAL;
+   }
+
+   *puFlowMask = wdaContext->uTxFlowMask;
+
+   return VOS_STATUS_SUCCESS;
+#else
+   *puFlowMask = WDA_TXFLOWMASK;
+   return VOS_STATUS_SUCCESS;
+#endif  /* FEATURE_WLAN_INTEGRATED_SOC */
+}
+
+#if defined( FEATURE_WLAN_INTEGRATED_SOC )
+v_VOID_t 
+WDA_DS_TxCompleteCB
+(
+ v_PVOID_t pvosGCtx, 
+ v_PVOID_t pFrameDataBuff
+)
+{
+  tWDA_CbContext*        wdaContext = NULL;
+  WDI_DS_TxMetaInfoType* pTxMetadata;
+  VOS_STATUS             vosStatus;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check
+    ------------------------------------------------------------------------*/
+
+  if ( ( NULL == pvosGCtx ) || ( NULL == pFrameDataBuff ) )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA: Invalid parameter sent on WDA_DS_TxCompleteCB" );
+    return;
+  }
+
+  wdaContext = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA, pvosGCtx );
+  if ( NULL == wdaContext )
+  {
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+               "WDA: Invalid context on WDA_DS_TxCompleteCB" );
+    return;
+  }
+
+  // extract metadata from PAL packet
+  pTxMetadata = WDI_DS_ExtractTxMetaData( (wpt_packet*)pFrameDataBuff );
+  
+  if ( eWLAN_PAL_STATUS_SUCCESS == pTxMetadata->txCompleteStatus )
+    vosStatus = VOS_STATUS_SUCCESS;
+  else 
+    vosStatus = VOS_STATUS_E_FAILURE;
+
+  wdaContext->pfnTxCompleteCallback( pvosGCtx, pFrameDataBuff, vosStatus );
+}
+#endif  /* FEATURE_WLAN_INTEGRATED_SOC */
diff --git a/CORE/WDA/src/wlan_qct_wda_legacy.c b/CORE/WDA/src/wlan_qct_wda_legacy.c
new file mode 100644
index 0000000..42367d2
--- /dev/null
+++ b/CORE/WDA/src/wlan_qct_wda_legacy.c
@@ -0,0 +1,327 @@
+/*
+ * 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.
+ */
+
+
+/*===========================================================================
+
+                       wlan_qct_wda_legacy.c
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Device Adaptation
+  Layer for the legacy functionalities that were part of the old HAL.
+
+  The functions externalized by this module are to be called ONLY by other
+  WLAN modules that properly register with the Transport Layer initially.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
+===========================================================================*/
+
+/* Standard include files */
+/* Application Specific include files */
+#include "limApi.h"
+#include "pmmApi.h"
+#include "cfgApi.h"
+#include "wlan_qct_wda_debug.h"
+
+/* Locally used Defines */
+
+#define HAL_MMH_MB_MSG_TYPE_MASK    0xFF00
+
+// -------------------------------------------------------------
+/**
+ * wdaPostCtrlMsg
+ *
+ * FUNCTION:
+ *     Posts WDA messages to MC thread
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:pl
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @param pMsg pointer with message
+ * @return Success or Failure
+ */
+
+tSirRetStatus
+wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, (vos_msg_t *) pMsg))
+      return eSIR_FAILURE;
+   else
+      return eSIR_SUCCESS;
+} // halPostMsg()
+
+/**
+ * wdaPostCfgMsg
+ *
+ * FUNCTION:
+ *     Posts MNT messages to gSirMntMsgQ
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @param pMsg A pointer to the msg
+ * @return Success or Failure
+ */
+
+tSirRetStatus
+wdaPostCfgMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+   tSirRetStatus rc = eSIR_SUCCESS;
+
+   do
+   {
+#ifdef ANI_OS_TYPE_RTAI_LINUX
+
+      // Posts message to the queue
+
+      if (tx_queue_send(&pMac->sys.gSirMntMsgQ, pMsg,
+                       TX_NO_WAIT) != TX_SUCCESS)
+      {
+         wdaLog(pMac, LOGP, FL("Queue send Failed! rc (%X)\n"),
+                eSIR_SYS_TX_Q_SEND_FAILED);
+         rc = eSIR_SYS_TX_Q_SEND_FAILED;
+         break;
+      }
+
+#else
+      // For Windows based MAC, instead of posting message to different
+      // queues we will call the handler routines directly
+
+      cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
+      rc = eSIR_SUCCESS;
+#endif
+   } while (0);
+
+   return rc;
+} // halMntPostMsg()
+
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+#if defined(ANI_MANF_DIAG) || defined(ANI_PHY_DEBUG)
+#include "pttModuleApi.h"
+// -------------------------------------------------------------
+/**
+ * halNimPTTPostMsgApi
+ *
+ * FUNCTION:
+ *     Posts NIM messages to gNIM thread
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:pl
+ *
+ *
+ * NOTE:
+ *
+ * @param tpAniSirGlobal MAC parameters structure
+ * @param pMsg pointer with message
+ * @return Success or Failure
+ */
+
+tSirRetStatus
+halNimPTTPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
+{
+   tSirRetStatus rc = eSIR_SUCCESS;
+
+   do
+   {
+#ifdef ANI_OS_TYPE_RTAI_LINUX
+
+      // Posts message to the queue
+      if (tx_queue_send(&pMac->sys.gSirNimRDMsgQ, pMsg,
+                       TX_NO_WAIT) != TX_SUCCESS)
+      {
+         rc = eSIR_FAILURE;
+         wdaLog(pMac, LOGP,
+                FL("Posting a Msg to nimMsgQ failed!\n"));
+         break;
+      }
+#else
+      // For Windows based MAC, instead of posting message to different
+      // queues, we will call the handler routines directly
+      wdaLog(pMac, LOGE, "ERROR: Received PTT message in obsolete code path.\n");
+      wdaLog(pMac, LOGP, "This indicates that the wrong OID is being used - clean registry and previous inf files.\n");
+      /*
+      tPttMsgbuffer *msgPtr = (tPttMsgbuffer *)(pMsg->body);  //for some reason, body is actually being used as if it were a void *
+      pttProcessMsg(pMac, msgPtr);
+      */
+
+      //TODO: the resonse is now packaged in ((tPttMsgbuffer *)&pMsg->body)->msgResponse and needs to be sent back to the application
+
+      rc = eSIR_SUCCESS;
+#endif
+   }
+   while (0);
+
+   return rc;
+} // halNimPTTPostMsgApi()
+
+
+#endif  //ANI_MANF_DIAG
+#endif  //FEATURE_WLAN_INTEGRATED_SOC
+
+// -------------------------------------------------------------
+/**
+ * uMacPostCtrlMsg
+ *
+ * FUNCTION:
+ *     Forwards the completely received message to the respective
+ *    modules for further processing.
+ *
+ * LOGIC:
+ *
+ * ASSUMPTIONS:
+ *    Freeing up of the message buffer is left to the destination module.
+ *
+ * NOTE:
+ *  This function has been moved to the API file because for MAC running
+ *  on Windows host, the host module will call this routine directly to
+ *  send any mailbox messages. Making this function an API makes sure that
+ *  outside world (any module outside MMH) only calls APIs to use MMH
+ *  services and not an internal function.
+ *
+ * @param pMb A pointer to the maibox message
+ * @return NONE
+ */
+
+tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb)
+{
+   tSirMsgQ msg;
+   tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal;
+
+#ifdef ANI_OS_TYPE_RTAI_LINUX
+
+   msg.type = pMb->type;
+   msg.bodyptr = pMb;
+   msg.bodyval = 0;
+   WDALOG3( wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
+        pMb->type, pMb->msgLen));
+#else
+
+   tSirMbMsg* pMbLocal;
+   msg.type = pMb->type;
+   msg.bodyval = 0;
+
+   WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
+        pMb->type, pMb->msgLen));
+
+   // copy the message from host buffer to firmware buffer
+   // this will make sure that firmware allocates, uses and frees
+   // it's own buffers for mailbox message instead of working on
+   // host buffer
+
+   // second parameter, 'wait option', to palAllocateMemory is ignored on Windows
+   if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen))
+   {
+      WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
+      return eSIR_FAILURE;
+   }
+
+   palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen);
+   msg.bodyptr = pMbLocal;
+#endif
+
+   switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
+   {
+   case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
+      wdaPostCtrlMsg(pMac, &msg);
+      break;
+
+   case SIR_LIM_MSG_TYPES_BEGIN:    // Posts a message to the LIM MsgQ
+      limPostMsgApi(pMac, &msg);
+      break;
+
+   case SIR_CFG_MSG_TYPES_BEGIN:    // Posts a message to the CFG MsgQ
+      wdaPostCfgMsg(pMac, &msg);
+      break;
+
+   case SIR_PMM_MSG_TYPES_BEGIN:    // Posts a message to the PMM MsgQ
+      pmmPostMessage(pMac, &msg);
+      break;
+
+#if defined(ANI_MANF_DIAG) || defined(ANI_PHY_DEBUG)
+   case SIR_PTT_MSG_TYPES_BEGIN:
+#ifndef FEATURE_WLAN_INTEGRATED_SOC
+      halNimPTTPostMsgApi(pMac, &msg); // Posts a message to the NIM PTT MsgQ
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+      break;
+
+#endif
+
+   default:
+      WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = "
+             "0x%X\n"),
+             msg.type));
+
+      // Release the memory.
+      if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr)) != eSIR_SUCCESS)
+      {
+         WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
+         return eSIR_FAILURE;
+      }
+      break;
+   }
+
+   return eSIR_SUCCESS;
+
+} // uMacPostCtrlMsg()
+
+
+/* ---------------------------------------------------------
+ * FUNCTION:  wdaGetGlobalSystemRole()
+ *
+ * Get the global HAL system role. 
+ * ---------------------------------------------------------
+ */
+tBssSystemRole wdaGetGlobalSystemRole(tpAniSirGlobal pMac)
+{
+   v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
+   tWDA_CbContext *wdaContext = 
+                       vos_get_context(VOS_MODULE_ID_WDA, pVosContext);
+   if(NULL == wdaContext)
+   {
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                           "%s:WDA context is NULL", __FUNCTION__); 
+      VOS_ASSERT(0);
+      return eSYSTEM_UNKNOWN_ROLE;
+   }
+   WDALOG1( wdaLog(pMac, LOG1, FL(" returning  %d role\n"),
+             wdaContext->wdaGlobalSystemRole));
+   return  wdaContext->wdaGlobalSystemRole;
+}
+
diff --git a/CORE/WDI/CP/inc/wlan_defs.h b/CORE/WDI/CP/inc/wlan_defs.h
new file mode 100644
index 0000000..f5cdb4b
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_defs.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.
+ */
+
+/*===========================================================================
+ *
+ *  @file:     wlan_defs.h
+ *
+ *  @brief:       This file defines the common typedefs
+ *
+ *  @author:   Gagan Jain
+ *
+ *             Copyright (C) 2010, Qualcomm, Inc. 
+ *             All rights reserved.
+ *
+ *=========================================================================*/
+
+#ifndef __WLAN_DEFS_H__
+#define __WLAN_DEFS_H__
+
+/*-------------------------------------------------------------------------
+  Include Files
+-------------------------------------------------------------------------*/
+#include "wlan_qct_pal_type.h" 
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+typedef wpt_uint32   uint32;      /* Unsigned 32 bit value */
+
+typedef wpt_uint16   uint16;      /* Unsigned 16 bit value */
+
+typedef wpt_uint8    uint8;       /* Unsigned 8  bit value */
+
+typedef wpt_int32    int32;       /* Signed 32 bit value */
+
+typedef wpt_int16    int16;       /* Signed 16 bit value */
+
+typedef wpt_int8     int8;        /* Signed 8  bit value */
+
+typedef wpt_int64    int64;       /* Signed 64 bit value */
+
+typedef wpt_uint64   uint64;      /* Unsigned 64 bit value */
+
+typedef wpt_byte     byte;        /* byte type */
+
+typedef wpt_boolean  boolean;     /* Boolean Type */
+
+#endif //__WLAN_DEFS_H__
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
new file mode 100644
index 0000000..9da9d88
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -0,0 +1,8667 @@
+/*
+ * 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 WLAN_QCT_WDI_H
+#define WLAN_QCT_WDI_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan transport layer 
+  module.
+  
+      
+  Copyright (c) 2010-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
+--------    ---    ----------------------------------------------------------
+10/05/11    hap     Adding support for Keep Alive
+08/04/10    lti     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_pal_api.h" 
+#include "wlan_qct_pal_type.h" 
+#include "wlan_qct_pack_align.h" 
+#include "wlan_qct_wdi_cfg.h" 
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+ 
+/* MAC ADDRESS LENGTH - per spec*/
+#define WDI_MAC_ADDR_LEN 6
+
+/* Max number of 11b rates -> 1,2,5.5,11 */
+#define WDI_NUM_11B_RATES                 4  
+
+/* Max number of 11g rates -> 6,9,12,18,24,36,48,54*/
+#define WDI_NUM_11A_RATES                 8  
+
+/* Max number of legacy rates -> 72, 96, 108*/
+#define WDI_NUM_POLARIS_RATES             3  
+
+/* Max supported MCS set*/
+#define WDI_MAC_MAX_SUPPORTED_MCS_SET    16
+
+/*Max number of Access Categories for QoS - per spec */
+#define WDI_MAX_NO_AC                     4
+
+/*Max. size for reserving the Beacon Template */
+#define WDI_BEACON_TEMPLATE_SIZE  0x180
+
+#define WDI_WOWL_BCAST_PATTERN_MAX_SIZE 128
+
+#define WDI_WOWL_BCAST_MAX_NUM_PATTERNS 16
+
+#define WDI_MAX_SSID_SIZE  32
+
+/* The shared memory between WDI and HAL is 4K so maximum data can be transferred
+from WDI to HAL is 4K.This 4K should also include the Message header so sending 4K
+of NV fragment is nt possbile.The next multiple of 1Kb is 3K */
+
+#define FRAGMENT_SIZE 3072
+
+/* Macro to find the total number fragments of the NV Image*/
+#define TOTALFRAGMENTS(x) ((x%FRAGMENT_SIZE)== 0) ? (x/FRAGMENT_SIZE):((x/FRAGMENT_SIZE)+1)
+
+/* Beacon Filter Length*/
+#define WDI_BEACON_FILTER_LEN 70
+
+/* Coex Indication data size - should match WLAN_COEX_IND_DATA_SIZE */
+#define WDI_COEX_IND_DATA_SIZE (4)
+
+#define WDI_CIPHER_SEQ_CTR_SIZE 6
+
+#define WDI_NUM_BSSID   2
+
+/*Version string max length (including NUL) */
+#define WDI_VERSION_LENGTH  64
+
+
+/*WDI Response timeout - how long will WDI wait for a response from the device
+    - it should be large enough to allow any other failure mechanism to kick
+      in before we get to a timeout (ms units)*/
+#define WDI_RESPONSE_TIMEOUT   10000
+
+#define WDI_SET_POWER_STATE_TIMEOUT  10000 /* in msec a very high upper limit */
+
+/*============================================================================
+ *     GENERIC STRUCTURES 
+  
+============================================================================*/
+
+/*---------------------------------------------------------------------------
+ WDI Version Information
+---------------------------------------------------------------------------*/
+typedef struct
+{
+    wpt_uint8                  revision;
+    wpt_uint8                  version;
+    wpt_uint8                  minor;
+    wpt_uint8                  major;
+} WDI_WlanVersionType;
+
+/*---------------------------------------------------------------------------
+ WDI Device Capability
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /*If this flag is true it means that the device can support 802.3/ETH2 to
+    802.11 translation*/
+  wpt_boolean   bFrameXtlSupported; 
+
+  /*Maximum number of BSSes supported by the Device */
+  wpt_uint8     ucMaxBSSSupported;
+
+  /*Maximum number of stations supported by the Device */
+  wpt_uint8     ucMaxSTASupported;
+}WDI_DeviceCapabilityType; 
+
+/*---------------------------------------------------------------------------
+ WDI Channel Offset
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  WDI_SECONDARY_CHANNEL_OFFSET_NONE   = 0,
+  WDI_SECONDARY_CHANNEL_OFFSET_UP     = 1,
+  WDI_SECONDARY_CHANNEL_OFFSET_DOWN   = 3
+}WDI_HTSecondaryChannelOffset;
+
+/*---------------------------------------------------------------------------
+  WDI_MacFrameCtl
+   Frame control field format (2 bytes)
+---------------------------------------------------------------------------*/
+typedef  struct 
+{
+    wpt_uint8 protVer :2;
+    wpt_uint8 type :2;
+    wpt_uint8 subType :4;
+
+    wpt_uint8 toDS :1;
+    wpt_uint8 fromDS :1;
+    wpt_uint8 moreFrag :1;
+    wpt_uint8 retry :1;
+    wpt_uint8 powerMgmt :1;
+    wpt_uint8 moreData :1;
+    wpt_uint8 wep :1;
+    wpt_uint8 order :1;
+
+} WDI_MacFrameCtl;
+
+/*---------------------------------------------------------------------------
+  WDI Sequence control field
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  wpt_uint8 fragNum  : 4;
+  wpt_uint8 seqNumLo : 4;
+  wpt_uint8 seqNumHi : 8;
+} WDI_MacSeqCtl;
+
+/*---------------------------------------------------------------------------
+  Management header format
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    WDI_MacFrameCtl     fc;
+    wpt_uint8           durationLo;
+    wpt_uint8           durationHi;
+    wpt_uint8           da[WDI_MAC_ADDR_LEN];
+    wpt_uint8           sa[WDI_MAC_ADDR_LEN];
+    wpt_macAddr         bssId;
+    WDI_MacSeqCtl       seqControl;
+} WDI_MacMgmtHdr;
+
+/*---------------------------------------------------------------------------
+  NV Blob management sturcture
+  ---------------------------------------------------------------------------*/
+
+typedef struct
+{
+  /* NV image  fragments count */
+  wpt_uint16 usTotalFragment;
+
+  /* NV fragment size */
+  wpt_uint16 usFragmentSize;
+
+  /* current fragment to be sent */
+  wpt_uint16 usCurrentFragment;
+
+} WDI_NvBlobInfoParams;
+
+
+/*---------------------------------------------------------------------------
+  Data path enums memory pool resource
+  ---------------------------------------------------------------------------*/
+
+typedef enum
+{
+  /* managment resource pool ID */
+  WDI_MGMT_POOL_ID = 0,
+  /* Data resource pool ID */
+  WDI_DATA_POOL_ID = 1
+}WDI_ResPoolType;
+
+/*============================================================================
+ *     GENERIC STRUCTURES - END
+ ============================================================================*/
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+  WDI Status 
+---------------------------------------------------------------------------*/
+typedef enum
+{
+   WDI_STATUS_SUCCESS,       /* Operation has completed successfully*/
+   WDI_STATUS_SUCCESS_SYNC,  /* Operation has completed successfully in a
+                                synchronous way - no rsp will be generated*/
+   WDI_STATUS_PENDING,       /* Operation result is pending and will be
+                                provided asynchronously through the Req Status
+                                Callback */
+   WDI_STATUS_E_FAILURE,     /* Operation has ended in a generic failure*/
+   WDI_STATUS_RES_FAILURE,   /* Operation has ended in a resource failure*/
+   WDI_STATUS_MEM_FAILURE,   /* Operation has ended in a memory allocation
+                               failure*/
+   WDI_STATUS_E_NOT_ALLOWED, /* Operation is not allowed in the current state
+                               of the driver*/
+   WDI_STATUS_E_NOT_IMPLEMENT, /* Operation is not yet implemented*/
+
+   WDI_STATUS_DEV_INTERNAL_FAILURE, /*An internal error has occurred in the device*/
+   WDI_STATUS_MAX
+
+}WDI_Status;
+
+
+/*---------------------------------------------------------------------------
+   WDI_ReqStatusCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL to deliver to UMAC the result of posting
+   a previous request for which the return status was PENDING.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from the Control Transport
+    pUserData:  user data  
+ 
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDI_ReqStatusCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+/*---------------------------------------------------------------------------
+  WDI_LowLevelIndEnumType
+    Types of indication that can be posted to UMAC by DAL
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*When RSSI monitoring is enabled of the Lower MAC and a threshold has been
+    passed. */
+  WDI_RSSI_NOTIFICATION_IND,
+
+  /*Link loss in the low MAC */
+  WDI_MISSED_BEACON_IND,
+
+  /*when hardware has signaled an unknown addr2 frames. The indication will
+  contain info from frames to be passed to the UMAC, this may use this info to
+  deauth the STA*/
+  WDI_UNKNOWN_ADDR2_FRAME_RX_IND,
+
+  /*MIC Failure detected by HW*/
+  WDI_MIC_FAILURE_IND,
+
+  /*Fatal Error Ind*/
+  WDI_FATAL_ERROR_IND, 
+
+  /*Delete Station Ind*/
+  WDI_DEL_STA_IND, 
+
+  /*Indication from Coex*/
+  WDI_COEX_IND,
+
+  /* Indication for Tx Complete */
+  WDI_TX_COMPLETE_IND,
+
+  /*.P2P_NOA_Attr_Indication */
+  WDI_P2P_NOA_ATTR_IND,
+
+  /* Preferred Network Found Indication */
+  WDI_PREF_NETWORK_FOUND_IND,
+
+  WDI_WAKE_REASON_IND,
+
+  /* Tx PER Tracking Indication */
+  WDI_TX_PER_HIT_IND,
+  
+  WDI_MAX_IND
+}WDI_LowLevelIndEnumType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_LowRSSIThIndType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Positive crossing of Rssi Thresh1*/
+   wpt_uint32             bRssiThres1PosCross : 1;
+  /*Negative crossing of Rssi Thresh1*/
+   wpt_uint32             bRssiThres1NegCross : 1;
+  /*Positive crossing of Rssi Thresh2*/
+   wpt_uint32             bRssiThres2PosCross : 1;
+  /*Negative crossing of Rssi Thresh2*/
+   wpt_uint32             bRssiThres2NegCross : 1;
+  /*Positive crossing of Rssi Thresh3*/
+   wpt_uint32             bRssiThres3PosCross : 1;
+  /*Negative crossing of Rssi Thresh3*/
+   wpt_uint32             bRssiThres3NegCross : 1;
+
+   wpt_uint32             bReserved           : 26;
+
+}WDI_LowRSSIThIndType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_UnkAddr2FrmRxIndType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Rx Bd data of the unknown received addr2 frame.*/
+  void*  bufRxBd;
+
+  /*Buffer Length*/
+  wpt_uint16  usBufLen; 
+}WDI_UnkAddr2FrmRxIndType;
+
+/*---------------------------------------------------------------------------
+  WDI_DeleteSTAIndType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*ASSOC ID, as assigned by UMAC*/
+   wpt_uint16    usAssocId;
+
+   /*STA Index returned during DAL_PostAssocReq or DAL_ConfigStaReq*/
+   wpt_uint8     ucSTAIdx;
+
+   /*BSSID of STA*/
+   wpt_macAddr   macBSSID; 
+
+    /*MAC ADDR of STA*/
+    wpt_macAddr  macADDR2;          
+                                
+    /* To unify the keepalive / unknown A2 / tim-based disa*/
+    wpt_uint16   wptReasonCode;   
+
+}WDI_DeleteSTAIndType;
+
+/*---------------------------------------------------------------------------
+  WDI_MicFailureIndType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ /*current BSSID*/
+ wpt_macAddr bssId;
+  
+  /*Source mac address*/
+ wpt_macAddr macSrcAddr;
+
+ /*Transmitter mac address*/
+ wpt_macAddr macTaAddr;
+
+ /*Destination mac address*/
+ wpt_macAddr macDstAddr;
+
+ /*Multicast flag*/
+ wpt_uint8   ucMulticast;
+
+ /*First byte of IV*/
+ wpt_uint8   ucIV1;
+
+ /*Key Id*/
+ wpt_uint8   keyId;
+
+ /*Sequence Number*/
+ wpt_uint8   TSC[WDI_CIPHER_SEQ_CTR_SIZE];
+
+ /*receive address */
+ wpt_macAddr   macRxAddr;
+}WDI_MicFailureIndType;
+
+/*---------------------------------------------------------------------------
+  WDI_CoexIndType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  wpt_uint32  coexIndType;
+  wpt_uint32  coexIndData[WDI_COEX_IND_DATA_SIZE];
+} WDI_CoexIndType;
+
+/*---------------------------------------------------------------------------
+  WDI_MacSSid
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint8        ucLength;
+    wpt_uint8        sSSID[WDI_MAX_SSID_SIZE];
+} WDI_MacSSid;
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*---------------------------------------------------------------------------
+  WDI_PrefNetworkFoundInd    
+---------------------------------------------------------------------------*/
+typedef struct
+{  
+  /* Network that was found with the highest RSSI*/
+  WDI_MacSSid ssId;
+  /* Indicates the RSSI */
+  wpt_uint8  rssi;
+} WDI_PrefNetworkFoundInd;
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_P2P
+/*---------------------------------------------------------------------------
+ *WDI_P2pNoaAttrIndType
+ *-------------------------------------------------------------------------*/
+
+typedef struct
+{
+  wpt_uint8       ucIndex ;
+  wpt_uint8       ucOppPsFlag ;
+  wpt_uint16      usCtWin  ;
+
+  wpt_uint16      usNoa1IntervalCnt;
+  wpt_uint16      usRsvd1 ;
+  wpt_uint32      uslNoa1Duration;
+  wpt_uint32      uslNoa1Interval;
+  wpt_uint32      uslNoa1StartTime;
+
+  wpt_uint16      usNoa2IntervalCnt;
+  wpt_uint16      usRsvd2;
+  wpt_uint32      uslNoa2Duration;
+  wpt_uint32      uslNoa2Interval;
+  wpt_uint32      uslNoa2StartTime;
+
+  wpt_uint32      status;
+}WDI_P2pNoaAttrIndType;
+#endif
+
+#ifdef WLAN_WAKEUP_EVENTS
+/*---------------------------------------------------------------------------
+  WDI_WakeReasonIndType    
+---------------------------------------------------------------------------*/
+typedef struct
+{  
+    wpt_uint32      ulReason;        /* see tWakeReasonType */
+    wpt_uint32      ulReasonArg;     /* argument specific to the reason type */
+    wpt_uint32      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 */
+    wpt_uint32      ulActualDataLen; /* actual length of data */
+    wpt_uint8       aDataStart[1];  /* variable length start of data (length == storedDataLen)
+                             see specific wake type */ 
+} WDI_WakeReasonIndType;
+#endif // WLAN_WAKEUP_EVENTS
+
+/*---------------------------------------------------------------------------
+  WDI_LowLevelIndType
+    Inidcation type and information about the indication being carried
+    over
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Inidcation type*/
+  WDI_LowLevelIndEnumType  wdiIndicationType; 
+
+  /*Indication data*/
+  union
+  {
+    /*RSSI Threshold Info for WDI_LOW_RSSI_IND*/
+    WDI_LowRSSIThIndType        wdiLowRSSIInfo; 
+
+    /*Addr2 Frame Info for WDI_UNKNOWN_ADDR2_FRAME_RX_IND*/
+    WDI_UnkAddr2FrmRxIndType    wdiUnkAddr2FrmInfo;
+
+    /*MIC Failure info for WDI_MIC_FAILURE_IND*/
+    WDI_MicFailureIndType       wdiMICFailureInfo; 
+
+    /*Error code for WDI_FATAL_ERROR_IND*/
+    wpt_uint16                  usErrorCode;
+
+    /*Delete STA Indication*/
+    WDI_DeleteSTAIndType        wdiDeleteSTAIndType; 
+    
+    /*Coex Indication*/
+    WDI_CoexIndType             wdiCoexInfo;
+
+    /* Tx Complete Indication */
+    wpt_uint32                  tx_complete_status;
+
+#ifdef WLAN_FEATURE_P2P
+    /* P2P NOA ATTR Indication */
+    WDI_P2pNoaAttrIndType        wdiP2pNoaAttrInfo;
+#endif
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+    WDI_PrefNetworkFoundInd     wdiPrefNetworkFoundInd;
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_WAKEUP_EVENTS
+    WDI_WakeReasonIndType        wdiWakeReasonInd;
+#endif // WLAN_WAKEUP_EVENTS
+  }  wdiIndicationData;
+}WDI_LowLevelIndType;
+
+/*---------------------------------------------------------------------------
+  WDI_LowLevelIndCBType
+
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL to deliver to UMAC certain indications
+   that has either received from the lower device or has generated itself.
+ 
+   PARAMETERS 
+
+    IN
+    pwdiInd:  information about the indication sent over
+    pUserData:  user data provided by UMAC during registration 
+ 
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDI_LowLevelIndCBType)(WDI_LowLevelIndType* pwdiInd,
+                                      void*                pUserData);
+
+/*---------------------------------------------------------------------------
+  WDI_DriverType
+---------------------------------------------------------------------------*/
+typedef enum
+{
+    WDI_DRIVER_TYPE_PRODUCTION  = 0,
+    WDI_DRIVER_TYPE_MFG         = 1,
+    WDI_DRIVER_TYPE_DVT         = 2
+} WDI_DriverType;
+
+/*---------------------------------------------------------------------------
+  WDI_StartReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*This is a TLV formatted buffer containing all config values that can
+   be set through the DAL Interface
+ 
+   The TLV is expected to be formatted like this:
+ 
+   0            7          15              31 .... 
+   | CONFIG ID  |  CFG LEN |   RESERVED    |  CFG BODY  |
+ 
+   Or from a C construct point of VU it would look like this:
+ 
+   typedef struct WPT_PACK_POST
+   {
+       #ifdef  WPT_BIG_ENDIAN
+         wpt_uint32   ucCfgId:8;
+         wpt_uint32   ucCfgLen:8;
+         wpt_uint32   usReserved:16;
+       #else
+         wpt_uint32   usReserved:16;
+         wpt_uint32   ucCfgLen:8;
+         wpt_uint32   ucCfgId:8;
+       #endif
+ 
+       wpt_uint8   ucCfgBody[ucCfgLen];
+   }WDI_ConfigType; 
+ 
+   Multiple such tuplets are to be placed in the config buffer. One for
+   each required configuration item:
+ 
+     | TLV 1 |  TLV2 | ....
+ 
+   The buffer is expected to be a flat area of memory that can be manipulated
+   with standard memory routines.
+ 
+   For more info please check paragraph 2.3.1 Config Structure from the
+   HAL LLD.
+ 
+   For a list of accepted configuration list and IDs please look up
+   wlan_qct_dal_cfg.h
+ 
+  */
+  void*                   pConfigBuffer; 
+
+  /*Length of the config buffer above*/
+  wpt_uint16              usConfigBufferLen;
+
+  /*Production or FTM driver*/
+  WDI_DriverType          wdiDriverType; 
+
+  /*Should device enable frame translation */
+  wpt_uint8               bFrameTransEnabled;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb         wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                   pUserData;
+
+  /*Indication callback given by UMAC to be called by the WLAN DAL when it
+    wishes to send something back independent of a request*/
+  WDI_LowLevelIndCBType   wdiLowLevelIndCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the indication
+    function pointer will be called */
+  void*                   pIndUserData;
+}WDI_StartReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_StartRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status    wdiStatus;
+
+  /*Max number of STA supported by the device*/
+  wpt_uint8     ucMaxStations;
+
+  /*Max number of BSS supported by the device*/
+  wpt_uint8     ucMaxBssids;
+
+  /*Version of the WLAN HAL API with which we were compiled*/
+  WDI_WlanVersionType wlanCompiledVersion;
+
+  /*Version of the WLAN HAL API that was reported*/
+  WDI_WlanVersionType wlanReportedVersion;
+
+  /*WCNSS Software version string*/
+  wpt_uint8 wcnssSoftwareVersion[WDI_VERSION_LENGTH];
+
+  /*WCNSS Hardware version string*/
+  wpt_uint8 wcnssHardwareVersion[WDI_VERSION_LENGTH];
+}WDI_StartRspParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_StopType
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*Device is being stopped due to a reset*/
+  WDI_STOP_TYPE_SYS_RESET,
+
+  /*Device is being stopped due to entering deep sleep*/
+  WDI_STOP_TYPE_SYS_DEEP_SLEEP,
+
+  /*Device is being stopped because the RF needs to shut off
+    (e.g.:Airplane mode)*/
+  WDI_STOP_TYPE_RF_KILL 
+}WDI_StopType;
+
+/*---------------------------------------------------------------------------
+  WDI_StopReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+
+  /*The reason for which the device is being stopped*/
+  WDI_StopType   wdiStopReason;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_StopReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_ScanMode
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  WDI_SCAN_MODE_NORMAL = 0,
+  WDI_SCAN_MODE_LEARN,
+  WDI_SCAN_MODE_SCAN,
+  WDI_SCAN_MODE_PROMISC,
+  WDI_SCAN_MODE_SUSPEND_LINK
+} WDI_ScanMode;
+
+/*---------------------------------------------------------------------------
+  WDI_ScanEntry
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  wpt_uint8 bssIdx[WDI_NUM_BSSID];
+  wpt_uint8 activeBSScnt;
+}WDI_ScanEntry;
+
+/*---------------------------------------------------------------------------
+  WDI_InitScanReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*LEARN - AP Role
+    SCAN - STA Role*/
+  WDI_ScanMode     wdiScanMode;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr      macBSSID;
+
+  /*Whether BSS needs to be notified*/
+  wpt_boolean      bNotifyBSS;
+
+  /*Kind of frame to be used for notifying the BSS (Data Null, QoS Null, or
+  CTS to Self). Must always be a valid frame type.*/
+  wpt_uint8        ucFrameType;
+
+  /*UMAC has the option of passing the MAC frame to be used for notifying
+   the BSS. If non-zero, HAL will use the MAC frame buffer pointed to by
+   macMgmtHdr. If zero, HAL will generate the appropriate MAC frame based on
+   frameType.*/
+  wpt_uint8        ucFrameLength;
+
+  /*Pointer to the MAC frame buffer. Used only if ucFrameLength is non-zero.*/
+  WDI_MacMgmtHdr   wdiMACMgmtHdr;
+
+  /*Entry to hold number of active BSS to send NULL frames before 
+   * initiating SCAN*/
+  WDI_ScanEntry    wdiScanEntry;
+
+  /* Flag to enable/disable Single NOA*/
+  wpt_boolean      bUseNOA;
+
+  /* Indicates the scan duration (in ms) */
+  wpt_uint16       scanDuration;
+
+}WDI_InitScanReqInfoType; 
+
+/*---------------------------------------------------------------------------
+  WDI_InitScanReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*The info associated with the request that needs to be sent over to the
+    device*/
+  WDI_InitScanReqInfoType  wdiReqInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb          wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                    pUserData;
+}WDI_InitScanReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_StartScanReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the channel to scan*/
+  wpt_uint8         ucChannel;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_StartScanReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_StartScanRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the status of the operation */
+  WDI_Status        wdiStatus;
+
+#if defined WLAN_FEATURE_VOWIFI
+  wpt_uint32        aStartTSF[2];
+  wpt_int8          ucTxMgmtPower;
+#endif
+}WDI_StartScanRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_EndScanReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the channel to stop scanning.  Not used really. But retained
+    for symmetry with "start Scan" message. It can also help in error
+    check if needed.*/
+  wpt_uint8         ucChannel;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_EndScanReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_PhyChanBondState
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  WDI_PHY_SINGLE_CHANNEL_CENTERED = 0,            
+  WDI_PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,     
+  WDI_PHY_DOUBLE_CHANNEL_CENTERED = 2,            
+  WDI_PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3     
+} WDI_PhyChanBondState;
+
+/*---------------------------------------------------------------------------
+  WDI_FinishScanReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*LEARN - AP Role
+    SCAN - STA Role*/
+  WDI_ScanMode          wdiScanMode;
+
+  /*Operating channel to tune to.*/
+  wpt_uint8             ucCurrentOperatingChannel;
+
+  /*Channel Bonding state If 20/40 MHz is operational, this will indicate the
+  40 MHz extension channel in combination with the control channel*/
+  WDI_PhyChanBondState  wdiCBState;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr           macBSSID;
+
+  /*Whether BSS needs to be notified*/
+  wpt_boolean           bNotifyBSS;
+
+  /*Kind of frame to be used for notifying the BSS (Data Null, QoS Null, or
+  CTS to Self). Must always be a valid frame type.*/
+  wpt_uint8             ucFrameType;
+
+  /*UMAC has the option of passing the MAC frame to be used for notifying
+   the BSS. If non-zero, HAL will use the MAC frame buffer pointed to by
+   macMgmtHdr. If zero, HAL will generate the appropriate MAC frame based on
+   frameType.*/
+  wpt_uint8             ucFrameLength;
+
+  /*Pointer to the MAC frame buffer. Used only if ucFrameLength is non-zero.*/
+  WDI_MacMgmtHdr        wdiMACMgmtHdr;
+
+  /*Entry to hold number of active BSS to send NULL frames after SCAN*/
+  WDI_ScanEntry    wdiScanEntry;
+
+}WDI_FinishScanReqInfoType; 
+
+/*---------------------------------------------------------------------------
+  WDI_SwitchChReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the channel to switch to.*/
+  wpt_uint8         ucChannel;
+
+  /*Local power constraint*/
+  wpt_uint8         ucLocalPowerConstraint;
+
+  /*Secondary channel offset */
+  WDI_HTSecondaryChannelOffset  wdiSecondaryChannelOffset;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  wpt_int8      cMaxTxPower;
+
+  /*Self STA Mac address*/
+  wpt_macAddr   macSelfStaMacAddr;
+#endif
+  /* VO Wifi comment: BSSID is needed to identify which session issued this request. As the 
+     request has power constraints, this should be applied only to that session */
+  /* V IMP: Keep bssId field at the end of this msg. It is used to mantain backward compatbility
+   * by way of ignoring if using new host/old FW or old host/new FW since it is at the end of this struct
+   */
+  wpt_macAddr   macBSSId;
+
+}WDI_SwitchChReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SwitchChReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Channel Info*/
+  WDI_SwitchChReqInfoType  wdiChInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SwitchChReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_FinishScanReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Info for the Finish Scan request that will be sent down to the device*/
+  WDI_FinishScanReqInfoType  wdiReqInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb            wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                      pUserData;
+}WDI_FinishScanReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_JoinReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the BSSID to which STA is going to associate*/
+  wpt_macAddr   macBSSID; 
+
+  /*Indicates the MAC Address of the current Self STA*/
+  wpt_macAddr   macSTASelf; 
+ 
+  /*Indicates the link State determining the entity Type e.g. BTAMP-STA, STA etc.*/
+  wpt_uint32    linkState;
+  
+  /*Indicates the channel to switch to.*/
+  WDI_SwitchChReqInfoType  wdiChannelInfo; 
+
+}WDI_JoinReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_JoinReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Info for the Join request that will be sent down to the device*/
+  WDI_JoinReqInfoType   wdiReqInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                 pUserData;
+}WDI_JoinReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_BssType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_INFRASTRUCTURE_MODE,
+  WDI_INFRA_AP_MODE,                    //Added for softAP support
+  WDI_IBSS_MODE,
+  WDI_BTAMP_STA_MODE, 
+  WDI_BTAMP_AP_MODE,
+  WDI_BSS_AUTO_MODE,
+}WDI_BssType;
+
+/*---------------------------------------------------------------------------
+  WDI_NwType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_11A_NW_TYPE,
+  WDI_11B_NW_TYPE,
+  WDI_11G_NW_TYPE,
+  WDI_11N_NW_TYPE,
+} WDI_NwType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigAction
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_ADD_BSS,
+  WDI_UPDATE_BSS
+} WDI_ConfigAction;
+
+/*---------------------------------------------------------------------------
+  WDI_HTOperatingMode
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  WDI_HT_OP_MODE_PURE,
+  WDI_HT_OP_MODE_OVERLAP_LEGACY,  
+  WDI_HT_OP_MODE_NO_LEGACY_20MHZ_HT,  
+  WDI_HT_OP_MODE_MIXED
+
+} WDI_HTOperatingMode;
+
+
+/*---------------------------------------------------------------------------
+  WDI_STAEntryType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_STA_ENTRY_SELF,
+  WDI_STA_ENTRY_PEER,
+  WDI_STA_ENTRY_BSSID,
+  WDI_STA_ENTRY_BCAST
+}WDI_STAEntryType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigActionType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_ADD_STA,
+  WDI_UPDATE_STA
+} WDI_ConfigActionType;
+
+/*---------------------------------------------------------------------------- 
+  Each station added has a rate mode which specifies the sta attributes
+  ----------------------------------------------------------------------------*/
+typedef enum 
+{
+    WDI_RESERVED_1 = 0,
+    WDI_RESERVED_2,
+    WDI_RESERVED_3,
+    WDI_11b,
+    WDI_11bg,
+    WDI_11a,
+    WDI_11n,
+} WDI_RateModeType;
+
+/*---------------------------------------------------------------------------
+  WDI_SupportedRatesType
+---------------------------------------------------------------------------*/
+typedef struct  
+{
+    /*
+    * 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.
+    */
+
+    WDI_RateModeType   opRateMode;
+
+    /* 11b, 11a and aniLegacyRates are IE rates which gives rate in unit of 500Kbps */
+    wpt_uint16         llbRates[WDI_NUM_11B_RATES];
+    wpt_uint16         llaRates[WDI_NUM_11A_RATES];
+    wpt_uint16         aLegacyRates[WDI_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.*/
+    wpt_uint32         uEnhancedRateBitmap; //Titan and Taurus Rates
+
+    /*
+    * 0-76 bits used, remaining reserved
+    * bits 0-15 and 32 should be set.
+    */
+    wpt_uint8           aSupportedMCSSet[WDI_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.
+     */
+    wpt_uint16         aRxHighestDataRate;
+
+} WDI_SupportedRates;
+
+/*-------------------------------------------------------------------------- 
+  WDI_HTMIMOPowerSaveState 
+    Spatial Multiplexing(SM) Power Save mode
+ --------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_HT_MIMO_PS_STATIC   = 0,    // Static SM Power Save mode
+  WDI_HT_MIMO_PS_DYNAMIC  = 1,   // Dynamic SM Power Save mode
+  WDI_HT_MIMO_PS_NA       = 2,        // reserved
+  WDI_HT_MIMO_PS_NO_LIMIT = 3,  // SM Power Save disabled
+} WDI_HTMIMOPowerSaveState;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigStaReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BSSID of STA*/
+  wpt_macAddr               macBSSID;
+
+  /*ASSOC ID, as assigned by UMAC*/
+  wpt_uint16                usAssocId;
+
+  /*Used for configuration of different HW modules.*/
+  WDI_STAEntryType          wdiSTAType;
+
+  /*Short Preamble Supported.*/
+  wpt_uint8                 ucShortPreambleSupported;
+
+  /*MAC Address of STA*/
+  wpt_macAddr               macSTA;
+
+  /*Listen interval of the STA*/
+  wpt_uint16                usListenInterval;
+
+  /*Support for 11e/WMM*/
+  wpt_uint8                 ucWMMEnabled;
+
+  /*11n HT capable STA*/
+  wpt_uint8                 ucHTCapable;
+
+  /*TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz*/
+  wpt_uint8                 ucTXChannelWidthSet;
+
+  /*RIFS mode 0 - NA, 1 - Allowed*/
+  wpt_uint8                 ucRIFSMode;
+
+  /*L-SIG TXOP Protection mechanism
+  0 - No Support, 1 - Supported
+      SG - there is global field*/
+  wpt_uint8                 ucLSIGTxopProtection;
+
+  /*Max Ampdu Size supported by STA. Device programming.
+    0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
+  wpt_uint8                 ucMaxAmpduSize;
+
+  /*Max Ampdu density. Used by RA. 3 : 0~7 : 2^(11nAMPDUdensity -4)*/
+  wpt_uint8                 ucMaxAmpduDensity;
+
+  /*Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes*/
+  wpt_uint8                 ucMaxAmsduSize;
+
+  /*Short GI support for 40Mhz packets*/
+  wpt_uint8                 ucShortGI40Mhz;
+
+  /*Short GI support for 20Mhz packets*/
+  wpt_uint8                 ucShortGI20Mhz;
+
+  /*These rates are the intersection of peer and self capabilities.*/
+  WDI_SupportedRates        wdiSupportedRates;
+
+  /*Robust Management Frame (RMF) enabled/disabled*/
+  wpt_uint8                 ucRMFEnabled;
+
+  /* The unicast encryption type in the association */
+  wpt_uint32                ucEncryptType;
+
+  /*HAL should update the existing STA entry, if this flag is set. UMAC 
+   will set this flag in case of RE-ASSOC, where we want to reuse the old
+   STA ID.*/
+  WDI_ConfigActionType      wdiAction;
+
+  /*U-APSD Flags: 1b per AC.  Encoded as follows:
+     b7 b6 b5 b4 b3 b2 b1 b0 =
+     X  X  X  X  BE BK VI VO
+  */
+  wpt_uint8                 ucAPSD;
+
+  /*Max SP Length*/
+  wpt_uint8                 ucMaxSPLen;
+
+  /*11n Green Field preamble support*/
+  wpt_uint8                 ucGreenFieldCapable;
+
+  /*MIMO Power Save mode*/
+  WDI_HTMIMOPowerSaveState  wdiMIMOPS;
+
+  /*Delayed BA Support*/
+  wpt_uint8                 ucDelayedBASupport;
+
+  /*Max AMPDU duration in 32us*/
+  wpt_uint8                 us32MaxAmpduDuratio;
+
+  /*HT STA should set it to 1 if it is enabled in BSS
+   HT STA should set it to 0 if AP does not support it. This indication is
+   sent to HAL and HAL uses this flag to pickup up appropriate 40Mhz rates.
+  */
+  wpt_uint8                 ucDsssCckMode40Mhz;
+
+  wpt_uint8                 ucP2pCapableSta;
+}WDI_ConfigStaReqInfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_RateSet
+ 
+  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 
+---------------------------------------------------------------------------*/
+#define WDI_RATESET_EID_MAX            12
+
+typedef struct 
+{
+    wpt_uint8  ucNumRates;
+    wpt_uint8  aRates[WDI_RATESET_EID_MAX];
+} WDI_RateSet;
+
+/*---------------------------------------------------------------------------
+  WDI_AciAifsnType
+   access category record
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint8  rsvd  : 1;
+    wpt_uint8  aci   : 2;
+    wpt_uint8  acm   : 1;
+    wpt_uint8  aifsn : 4;
+} WDI_AciAifsnType;
+
+/*---------------------------------------------------------------------------
+  WDI_CWType
+   contention window size
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint8  max : 4;
+    wpt_uint8  min : 4;
+} WDI_CWType;
+
+/*---------------------------------------------------------------------------
+  WDI_EdcaParamRecord
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    /*Access Category Record*/
+    WDI_AciAifsnType  wdiACI;
+
+    /*Contention WIndow Size*/
+    WDI_CWType        wdiCW;
+
+    /*TX Oportunity Limit*/
+    wpt_uint16        usTXOPLimit;
+} WDI_EdcaParamRecord;
+
+/*---------------------------------------------------------------------------
+  WDI_EDCAParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BSS Index*/
+  wpt_uint8      ucBSSIdx;
+  
+  /*?*/
+  wpt_boolean    bHighPerformance;
+
+  /*Best Effort*/
+  WDI_EdcaParamRecord wdiACBE; 
+           
+  /*Background*/
+  WDI_EdcaParamRecord wdiACBK; 
+                            
+  /*Video*/
+  WDI_EdcaParamRecord wdiACVI; 
+  
+  /*Voice*/
+  WDI_EdcaParamRecord acvo; // voice
+} WDI_EDCAParamsType;
+
+/* operMode in ADD BSS message */
+#define WDI_BSS_OPERATIONAL_MODE_AP     0
+#define WDI_BSS_OPERATIONAL_MODE_STA    1
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigBSSRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*BSSID of the BSS*/
+  wpt_macAddr  macBSSID; 
+
+  /*BSS Index*/
+  wpt_uint8    ucBSSIdx;
+
+  /*Unicast DPU signature*/
+  wpt_uint8    ucUcastSig;
+
+  /*Broadcast DPU Signature*/
+  wpt_uint8    ucBcastSig;
+
+  /*MAC Address of STA*/ 
+  wpt_macAddr  macSTA;
+
+  /*BSS STA ID*/
+  wpt_uint8    ucSTAIdx;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  /*HAL fills in the tx power used for mgmt frames in this field */
+  wpt_int8    ucTxMgmtPower;
+#endif
+
+}WDI_ConfigBSSRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelBSSReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*BSS Index of the BSS*/
+   wpt_uint8      ucBssIdx;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_DelBSSReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelBSSRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*BSSID of the BSS*/
+  wpt_macAddr  macBSSID; 
+
+  wpt_uint8    ucBssIdx;
+
+}WDI_DelBSSRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigSTARspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status      wdiStatus;
+
+  /*STA Idx allocated by HAL*/
+  wpt_uint8       ucSTAIdx;
+
+  /*MAC Address of STA*/
+  wpt_macAddr     macSTA;
+
+  /* BSSID Index of BSS to which the station is associated */
+  wpt_uint8       ucBssIdx;
+  
+  /* DPU Index  - PTK */
+  wpt_uint8       ucDpuIndex;
+
+  /* Bcast DPU Index  - GTK */  
+  wpt_uint8       ucBcastDpuIndex;
+
+  /* Management DPU Index - IGTK - Why is it called bcastMgmtDpuIdx? */
+  wpt_uint8       ucBcastMgmtDpuIdx;
+
+  /*Unicast DPU signature*/
+  wpt_uint8       ucUcastSig;
+
+  /*Broadcast DPU Signature*/
+  wpt_uint8       ucBcastSig;
+
+  /* IGTK DPU signature*/
+  wpt_uint8       ucMgmtSig;
+
+}WDI_ConfigSTARspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_PostAssocRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*Parameters related to the BSS*/
+  WDI_ConfigBSSRspParamsType bssParams;
+
+  /*Parameters related to the self STA*/
+  WDI_ConfigSTARspParamsType staParams;
+
+}WDI_PostAssocRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelSTAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA Index returned during DAL_PostAssocReq or DAL_ConfigStaReq*/
+  wpt_uint8         ucSTAIdx;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_DelSTAReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelSTARspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*STA Index returned during DAL_PostAssocReq or DAL_ConfigStaReq*/
+  wpt_uint8    ucSTAIdx;
+}WDI_DelSTARspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_EncryptType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+    WDI_ENCR_NONE,
+    WDI_ENCR_WEP40,
+    WDI_ENCR_WEP104,
+    WDI_ENCR_TKIP,
+    WDI_ENCR_CCMP,
+#if defined(FEATURE_WLAN_WAPI)
+    WDI_ENCR_WPI,
+#endif
+    WDI_ENCR_AES_128_CMAC
+} WDI_EncryptType;
+
+/*---------------------------------------------------------------------------
+  WDI_KeyDirectionType
+---------------------------------------------------------------------------*/
+typedef enum
+{
+    WDI_TX_ONLY,
+    WDI_RX_ONLY,
+    WDI_TX_RX,
+#ifdef WLAN_SOFTAP_FEATURE
+    WDI_TX_DEFAULT,
+#endif
+    WDI_DONOT_USE_KEY_DIRECTION
+} WDI_KeyDirectionType;
+
+#define WDI_MAX_ENCR_KEYS 4
+#define WDI_MAX_KEY_LENGTH 32
+#if defined(FEATURE_WLAN_WAPI)
+#define WDI_MAX_KEY_RSC_LEN         16
+#define WDI_WAPI_KEY_RSC_LEN        16
+#else
+#define WDI_MAX_KEY_RSC_LEN         8
+#endif
+
+typedef struct
+{
+    /* Key ID */
+    wpt_uint8                  keyId;
+    /* 0 for multicast */
+    wpt_uint8                  unicast;     
+    /* Key Direction */
+    WDI_KeyDirectionType       keyDirection;
+    /* Usage is unknown */
+    wpt_uint8                  keyRsc[WDI_MAX_KEY_RSC_LEN];   
+    /* =1 for authenticator, =0 for supplicant */
+    wpt_uint8                  paeRole;     
+    wpt_uint16                 keyLength;
+    wpt_uint8                  key[WDI_MAX_KEY_LENGTH];
+
+}WDI_KeysType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetBSSKeyReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*BSS Index of the BSS*/
+  wpt_uint8      ucBssIdx; 
+
+  /*Encryption Type used with peer*/
+  WDI_EncryptType  wdiEncType;
+
+  /*Number of keys*/
+  wpt_uint8        ucNumKeys;
+
+  /*Array of keys.*/
+  WDI_KeysType     aKeys[WDI_MAX_ENCR_KEYS]; 
+
+  /*Control for Replay Count, 1= Single TID based replay count on Tx
+    0 = Per TID based replay count on TX */
+  wpt_uint8        ucSingleTidRc; 
+}WDI_SetBSSKeyReqInfoType; 
+
+/*---------------------------------------------------------------------------
+  WDI_SetBSSKeyReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Key Info */
+  WDI_SetBSSKeyReqInfoType  wdiBSSKeyInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb           wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                      pUserData;
+}WDI_SetBSSKeyReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_WepType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+  WDI_WEP_STATIC,
+  WDI_WEP_DYNAMIC
+
+} WDI_WepType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemoveBSSKeyReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*BSS Index of the BSS*/
+  wpt_uint8      ucBssIdx; 
+
+  /*Encryption Type used with peer*/
+  WDI_EncryptType  wdiEncType;
+
+  /*Key Id*/
+  wpt_uint8    ucKeyId;
+
+  /*STATIC/DYNAMIC. Used in Nullifying in Key Descriptors for Static/Dynamic
+    keys*/
+  WDI_WepType  wdiWEPType;
+}WDI_RemoveBSSKeyReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemoveBSSKeyReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Key Info */
+  WDI_RemoveBSSKeyReqInfoType  wdiKeyInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_RemoveBSSKeyReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetSTAKeyReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*STA Index*/
+  wpt_uint8        ucSTAIdx; 
+
+  /*Encryption Type used with peer*/
+  WDI_EncryptType  wdiEncType;
+
+  /*STATIC/DYNAMIC*/
+  WDI_WepType      wdiWEPType;
+
+  /*Default WEP key, valid only for static WEP, must between 0 and 3.*/
+  wpt_uint8        ucDefWEPIdx;
+
+  /*Number of keys*/
+  wpt_uint8        ucNumKeys;
+
+  /*Array of keys.*/
+  WDI_KeysType     wdiKey[WDI_MAX_ENCR_KEYS]; 
+
+  /*Control for Replay Count, 1= Single TID based replay count on Tx
+    0 = Per TID based replay count on TX */
+  wpt_uint8        ucSingleTidRc; 
+}WDI_SetSTAKeyReqInfoType; 
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigBSSReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Peer BSSID*/
+  wpt_macAddr              macBSSID;
+
+  /*Self MAC Address*/
+  wpt_macAddr              macSelfAddr; 
+
+  /*BSS Type*/
+  WDI_BssType              wdiBSSType;
+
+  /*Operational Mode: AP =0, STA = 1*/
+  wpt_uint8                ucOperMode;
+
+  /*Network Type*/
+  WDI_NwType               wdiNWType;
+
+  /*Used to classify PURE_11G/11G_MIXED to program MTU*/
+  wpt_uint8                ucShortSlotTimeSupported;
+
+  /*Co-exist with 11a STA*/
+  wpt_uint8                ucllaCoexist;
+
+  /*Co-exist with 11b STA*/
+  wpt_uint8                ucllbCoexist;
+
+  /*Co-exist with 11g STA*/
+  wpt_uint8                ucllgCoexist;
+
+  /*Coexistence with 11n STA*/
+  wpt_uint8                ucHT20Coexist;
+
+  /*Non GF coexist flag*/
+  wpt_uint8                ucllnNonGFCoexist;
+
+  /*TXOP protection support*/
+  wpt_uint8                ucTXOPProtectionFullSupport;
+
+  /*RIFS mode*/
+  wpt_uint8                ucRIFSMode;
+
+  /*Beacon Interval in TU*/
+  wpt_uint16               usBeaconInterval;
+
+  /*DTIM period*/
+  wpt_uint8                ucDTIMPeriod;
+
+  /*TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz*/
+  wpt_uint8                ucTXChannelWidthSet;
+
+  /*Operating channel*/
+  wpt_uint8                ucCurrentOperChannel;
+
+  /*Extension channel for channel bonding*/
+  wpt_uint8                ucCurrentExtChannel;
+
+  /*Context of the station being added in HW.*/
+  WDI_ConfigStaReqInfoType wdiSTAContext;
+
+  /*SSID of the BSS*/
+  WDI_MacSSid              wdiSSID;
+
+  /*HAL should update the existing BSS entry, if this flag is set. UMAC will
+    set this flag in case of RE-ASSOC, where we want to reuse the old BSSID*/
+  WDI_ConfigAction         wdiAction;
+
+  /*Basic Rate Set*/
+  WDI_RateSet              wdiRateSet;
+
+  /*Enable/Disable HT capabilities of the BSS*/
+  wpt_uint8                ucHTCapable;
+
+  /* Enable/Disable OBSS protection */
+  wpt_uint8                ucObssProtEnabled;
+
+  /*RMF enabled/disabled*/
+  wpt_uint8                ucRMFEnabled;
+
+  /*Determines the current HT Operating Mode operating mode of the
+    802.11n STA*/
+  WDI_HTOperatingMode      wdiHTOperMod;
+
+  /*Dual CTS Protection: 0 - Unused, 1 - Used*/
+  wpt_uint8                ucDualCTSProtection;
+
+    /* Probe Response Max retries */
+  wpt_uint8   ucMaxProbeRespRetryLimit;
+
+  /* To Enable Hidden ssid */
+  wpt_uint8   bHiddenSSIDEn;
+
+  /* To Enable Disable FW Proxy Probe Resp */
+  wpt_uint8   bProxyProbeRespEn;
+
+ /* Boolean to indicate if EDCA params are valid. UMAC might not have valid 
+    EDCA params or might not desire to apply EDCA params during config BSS. 
+    0 implies Not Valid ; Non-Zero implies valid*/
+  wpt_uint8   ucEDCAParamsValid;
+
+   /*EDCA Parameters for BK*/  
+  WDI_EdcaParamRecord       wdiBKEDCAParams; 
+
+   /*EDCA Parameters for BE*/  
+  WDI_EdcaParamRecord       wdiBEEDCAParams; 
+
+   /*EDCA Parameters for VI*/  
+  WDI_EdcaParamRecord       wdiVIEDCAParams; 
+
+   /*EDCA Parameters for VO*/  
+  WDI_EdcaParamRecord       wdiVOEDCAParams; 
+
+#ifdef WLAN_FEATURE_VOWIFI
+   /*max power to be used after applying the power constraint, if any */
+  wpt_int8                  cMaxTxPower;
+#endif
+
+  /* Persona for the BSS can be STA,AP,GO,CLIENT, same as Connection Mode */  
+  wpt_uint8                 ucPersona;
+
+  /* Spectrum Mangement Indicator */
+  wpt_uint8                 bSpectrumMgtEn;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+  wpt_uint8                 bExtSetStaKeyParamValid;
+  WDI_SetSTAKeyReqInfoType  wdiExtSetKeyParam;
+#endif
+
+}WDI_ConfigBSSReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_PostAssocReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Config STA arguments.*/
+  WDI_ConfigStaReqInfoType  wdiSTAParams; 
+
+   /*Config BSS Arguments*/
+  WDI_ConfigBSSReqInfoType  wdiBSSParams;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb           wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                     pUserData;
+}WDI_PostAssocReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigBSSReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Info for the Join request that will be sent down to the device*/
+  WDI_ConfigBSSReqInfoType   wdiReqInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb            wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                      pUserData;
+}WDI_ConfigBSSReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetSTAKeyReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Key Info*/
+  WDI_SetSTAKeyReqInfoType  wdiKeyInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SetSTAKeyReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemoveSTAKeyReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA Index*/
+  wpt_uint8        ucSTAIdx; 
+
+  /*Encryption Type used with peer*/
+  WDI_EncryptType  wdiEncType;
+
+  /*Key Id*/
+  wpt_uint8        ucKeyId;
+
+  /*Whether to invalidate the Broadcast key or Unicast key. In case of WEP,
+  the same key is used for both broadcast and unicast.*/
+  wpt_uint8        ucUnicast;
+}WDI_RemoveSTAKeyReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemoveSTAKeyReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Key Info */
+  WDI_RemoveSTAKeyReqInfoType  wdiKeyInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_RemoveSTAKeyReqParamsType;
+
+/*---------------------------------------------------------------------------
+                            QOS Parameters
+---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+  WDI_TSInfoTfc
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint16       ackPolicy:2;
+    wpt_uint16       userPrio:3;
+    wpt_uint16       psb:1;
+    wpt_uint16       aggregation : 1;
+    wpt_uint16       accessPolicy : 2;
+    wpt_uint16       direction : 2;
+    wpt_uint16       tsid : 4;
+    wpt_uint16       trafficType : 1;
+} WDI_TSInfoTfc;
+
+/*---------------------------------------------------------------------------
+  WDI_TSInfoSch
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint8        rsvd : 7;
+    wpt_uint8        schedule : 1;
+} WDI_TSInfoSch;
+
+/*---------------------------------------------------------------------------
+  WDI_TSInfoType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    WDI_TSInfoTfc  wdiTraffic;
+    WDI_TSInfoSch  wdiSchedule;
+} WDI_TSInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_TspecIEType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+    wpt_uint8             ucType;
+    wpt_uint8             ucLength;
+    WDI_TSInfoType        wdiTSinfo;
+    wpt_uint16            usNomMsduSz;
+    wpt_uint16            usMaxMsduSz;
+    wpt_uint32            uMinSvcInterval;
+    wpt_uint32            uMaxSvcInterval;
+    wpt_uint32            uInactInterval;
+    wpt_uint32            uSuspendInterval;
+    wpt_uint32            uSvcStartTime;
+    wpt_uint32            uMinDataRate;
+    wpt_uint32            uMeanDataRate;
+    wpt_uint32            uPeakDataRate;
+    wpt_uint32            uMaxBurstSz;
+    wpt_uint32            uDelayBound;
+    wpt_uint32            uMinPhyRate;
+    wpt_uint16            usSurplusBw;
+    wpt_uint16            usMediumTime;
+}WDI_TspecIEType;
+
+/*---------------------------------------------------------------------------
+  WDI_AddTSReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA Index*/
+  wpt_uint8         ucSTAIdx; 
+
+  /*Identifier for TSpec*/
+  wpt_uint16        ucTspecIdx;
+
+  /*Tspec IE negotiated OTA*/
+  WDI_TspecIEType   wdiTspecIE;
+
+  /*UAPSD delivery and trigger enabled flags */
+  wpt_uint8         ucUapsdFlags;
+
+  /*SI for each AC*/
+  wpt_uint8         ucServiceInterval[WDI_MAX_NO_AC];
+
+  /*Suspend Interval for each AC*/
+  wpt_uint8         ucSuspendInterval[WDI_MAX_NO_AC];
+
+  /*DI for each AC*/
+  wpt_uint8         ucDelayedInterval[WDI_MAX_NO_AC];
+
+}WDI_AddTSReqInfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AddTSReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*TSpec Info */
+  WDI_AddTSReqInfoType  wdiTsInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_AddTSReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelTSReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA Index*/
+  wpt_uint8         ucSTAIdx; 
+
+  /*Identifier for TSpec*/
+  wpt_uint16        ucTspecIdx;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr      macBSSID;
+}WDI_DelTSReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelTSReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Del TSpec Info*/
+  WDI_DelTSReqInfoType  wdiDelTSInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_DelTSReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateEDCAInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*BSS Index of the BSS*/
+   wpt_uint8      ucBssIdx;
+
+  /* Boolean to indicate if EDCA params are valid. UMAC might not have valid 
+    EDCA params or might not desire to apply EDCA params during config BSS. 
+    0 implies Not Valid ; Non-Zero implies valid*/
+  wpt_uint8   ucEDCAParamsValid;
+
+  /*EDCA params for BE*/
+  WDI_EdcaParamRecord wdiEdcaBEInfo;
+
+  /*EDCA params for BK*/
+  WDI_EdcaParamRecord wdiEdcaBKInfo;
+
+  /*EDCA params for VI*/
+  WDI_EdcaParamRecord wdiEdcaVIInfo;
+
+  /*EDCA params for VO*/
+  WDI_EdcaParamRecord wdiEdcaVOInfo;
+
+}WDI_UpdateEDCAInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateEDCAParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*EDCA Info */
+  WDI_UpdateEDCAInfoType  wdiEDCAInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_UpdateEDCAParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_AddBASessionReqinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which BA is added..*/
+  wpt_uint8        ucSTAIdx;
+
+  /*The peer mac address*/
+  wpt_macAddr      macPeerAddr;
+
+  /*TID for which BA was negotiated*/
+  wpt_uint8        ucBaTID;
+
+  /*Delayed or imediate */
+  wpt_uint8        ucBaPolicy;
+
+  /*The number of buffers for this TID (baTID)*/
+  wpt_uint16       usBaBufferSize;
+  
+  /*BA timeout in TU's*/
+  wpt_uint16       usBaTimeout;
+  
+  /*b0..b3 - Fragment Number - Always set to 0
+   b4..b15 - Starting Sequence Number of first MSDU for which this BA is setup*/
+  wpt_uint16       usBaSSN;
+  
+  /*Originator/Recipient*/
+  wpt_uint8        ucBaDirection;
+  
+}WDI_AddBASessionReqinfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AddBASessionReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BA Session Info Type*/
+  WDI_AddBASessionReqinfoType  wdiBASessionInfoType; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                 pUserData;
+}WDI_AddBASessionReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_AddBASessionRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+  
+  /* Dialog token */
+  wpt_uint8    ucBaDialogToken;
+  
+  /* TID for which the BA session has been setup */
+  wpt_uint8    ucBaTID;
+  
+  /* BA Buffer Size allocated for the current BA session */
+  wpt_uint8    ucBaBufferSize;
+
+  /* BA session ID */
+  wpt_uint16   usBaSessionID;
+  
+  /* Reordering Window buffer */
+  wpt_uint8    ucWinSize;
+  
+  /*Station Index to id the sta */
+  wpt_uint8    ucSTAIdx;
+  
+  /* Starting Sequence Number */
+  wpt_uint16   usBaSSN;
+
+}WDI_AddBASessionRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_AddBAReqinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which BA is added..*/
+  wpt_uint8        ucSTAIdx;
+
+  /* Session Id */
+  wpt_uint8        ucBaSessionID;
+  
+  /* Reorder Window Size */
+  wpt_uint8        ucWinSize;
+  
+#ifdef FEATURE_ON_CHIP_REORDERING
+  wpt_boolean      bIsReorderingDoneOnChip;
+#endif
+
+}WDI_AddBAReqinfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AddBAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BA Info Type*/
+  WDI_AddBAReqinfoType  wdiBAInfoType; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                 pUserData;
+}WDI_AddBAReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AddBARspinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /* Dialog token */
+  wpt_uint8    ucBaDialogToken;
+
+}WDI_AddBARspinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_TriggerBAReqCandidateType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* STA index */
+  wpt_uint8   ucSTAIdx;
+
+  /* TID bit map for the STA's*/
+  wpt_uint8   ucTidBitmap;
+
+}WDI_TriggerBAReqCandidateType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_TriggerBAReqinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which BA is added..*/
+  wpt_uint8        ucSTAIdx;
+
+  /* Session Id */
+  wpt_uint8        ucBASessionID;
+
+  /* Trigger BA Request candidate count */
+  wpt_uint16       usBACandidateCnt;
+
+  /* WDI_TriggerBAReqCandidateType  followed by this*/
+
+}WDI_TriggerBAReqinfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_TriggerBAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BA Trigger Info Type*/
+  WDI_TriggerBAReqinfoType  wdiTriggerBAInfoType; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                 pUserData;
+}WDI_TriggerBAReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_AddBAInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  wpt_uint16 fBaEnable : 1;
+  wpt_uint16 startingSeqNum: 12;
+  wpt_uint16 reserved : 3;
+}WDI_AddBAInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_TriggerBARspCandidateType
+---------------------------------------------------------------------------*/
+#define STA_MAX_TC 8
+
+typedef struct
+{
+  /* STA index */
+  wpt_macAddr       macSTA;
+
+  /* BA Info */
+  WDI_AddBAInfoType wdiBAInfo[STA_MAX_TC];
+}WDI_TriggerBARspCandidateType;
+
+/*---------------------------------------------------------------------------
+  WDI_TriggerBARspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*BSSID of the BSS*/
+  wpt_macAddr  macBSSID;
+
+  /* Trigger BA response candidate count */
+  wpt_uint16   usBaCandidateCnt;
+
+  /* WDI_TriggerBARspCandidateType  followed by this*/
+
+}WDI_TriggerBARspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelBAReqinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which BA is added..*/
+  wpt_uint8        ucSTAIdx;
+
+  /*TID for which BA was negotiated*/
+  wpt_uint8        ucBaTID;
+
+  /*Originator/Recipient*/
+  wpt_uint8        ucBaDirection;
+  
+}WDI_DelBAReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelBAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BA Info */
+  WDI_DelBAReqinfoType  wdiBAInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_DelBAReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_SwitchCHRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*Status of the response*/
+  WDI_Status    wdiStatus;
+
+  /*Indicates the channel that WLAN is on*/
+  wpt_uint8     ucChannel;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  /*HAL fills in the tx power used for mgmt frames in this field.*/
+  wpt_int8     ucTxMgmtPower;
+#endif
+
+}WDI_SwitchCHRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigSTAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Info for the Join request that will be sent down to the device*/
+  WDI_ConfigStaReqInfoType   wdiReqInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb            wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                      pUserData;
+}WDI_ConfigSTAReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateBeaconParamsInfoType
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+   /*BSS Index of the BSS*/
+   wpt_uint8      ucBssIdx;
+
+    /*shortPreamble mode. HAL should update all the STA rates when it
+    receives this message*/
+    wpt_uint8 ucfShortPreamble;
+    /* short Slot time.*/
+    wpt_uint8 ucfShortSlotTime;
+    /* Beacon Interval */
+    wpt_uint16 usBeaconInterval;
+    /*Protection related */
+    wpt_uint8 ucllaCoexist;
+    wpt_uint8 ucllbCoexist;
+    wpt_uint8 ucllgCoexist;
+    wpt_uint8 ucHt20MhzCoexist;
+    wpt_uint8 ucllnNonGFCoexist;
+    wpt_uint8 ucfLsigTXOPProtectionFullSupport;
+    wpt_uint8 ucfRIFSMode;
+
+    wpt_uint16 usChangeBitmap;
+}WDI_UpdateBeaconParamsInfoType;
+
+
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateBeaconParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Update Beacon Params  Info*/
+  WDI_UpdateBeaconParamsInfoType  wdiUpdateBeaconParamsInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_UpdateBeaconParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SendBeaconParamsInfoType
+---------------------------------------------------------------------------*/
+
+typedef struct {
+
+   /*BSSID of the BSS*/
+   wpt_macAddr  macBSSID;
+
+   /* Beacon data */
+   wpt_uint8    beacon[WDI_BEACON_TEMPLATE_SIZE];     
+
+   /* length of the template */
+   wpt_uint32   beaconLength;
+
+#ifdef WLAN_SOFTAP_FEATURE
+   /* TIM IE offset from the beginning of the template.*/
+   wpt_uint32   timIeOffset; 
+#endif
+
+#ifdef WLAN_FEATURE_P2P
+   /* P2P IE offset from the beginning of the template */
+   wpt_uint16   usP2PIeOffset;
+#endif
+} WDI_SendBeaconParamsInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SendBeaconParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Send Beacon Params  Info*/
+  WDI_SendBeaconParamsInfoType  wdiSendBeaconParamsInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SendBeaconParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_LinkStateType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+    WDI_LINK_IDLE_STATE              = 0,
+    WDI_LINK_PREASSOC_STATE          = 1,
+    WDI_LINK_POSTASSOC_STATE         = 2,
+    WDI_LINK_AP_STATE                = 3,
+    WDI_LINK_IBSS_STATE              = 4,
+
+    // BT-AMP Case
+    WDI_LINK_BTAMP_PREASSOC_STATE    = 5,
+    WDI_LINK_BTAMP_POSTASSOC_STATE   = 6,
+    WDI_LINK_BTAMP_AP_STATE          = 7,
+    WDI_LINK_BTAMP_STA_STATE         = 8,
+    
+    // Reserved for HAL internal use
+    WDI_LINK_LEARN_STATE             = 9,
+    WDI_LINK_SCAN_STATE              = 10,
+    WDI_LINK_FINISH_SCAN_STATE       = 11,
+    WDI_LINK_INIT_CAL_STATE          = 12,
+    WDI_LINK_FINISH_CAL_STATE        = 13,
+#ifdef WLAN_FEATURE_P2P
+    WDI_LINK_LISTEN_STATE            = 14,
+#endif
+    WDI_LINK_MAX                     = 0x7FFFFFFF
+} WDI_LinkStateType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetLinkReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BSSID of the BSS*/
+  wpt_macAddr           macBSSID;
+
+  /*Link state*/
+  WDI_LinkStateType     wdiLinkState;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr           macSelfStaMacAddr;
+}WDI_SetLinkReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetLinkReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Link Info*/
+  WDI_SetLinkReqInfoType  wdiLinkInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SetLinkReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_GetStatsParamsInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which Get Stats are requested..*/
+  wpt_uint8        ucSTAIdx;
+
+  /* categories of stats requested */
+  wpt_uint32       uStatsMask;
+}WDI_GetStatsParamsInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_GetStatsReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Get Stats Params  Info*/
+  WDI_GetStatsParamsInfoType  wdiGetStatsParamsInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_GetStatsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_GetStatsRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*message type is same as the request type*/
+  wpt_uint16       usMsgType;
+
+  /* length of the entire request, includes the pStatsBuf length too*/
+  wpt_uint16       usMsgLen;
+  
+  /*Result of the operation*/
+  WDI_Status       wdiStatus;
+
+  /*Indicates the station for which Get Stats are requested..*/
+  wpt_uint8        ucSTAIdx;
+
+  /* categories of stats requested */
+  wpt_uint32       uStatsMask;
+
+  /* The Stats buffer starts here and can be an aggregate of more than one statistics 
+   * structure depending on statsMask.*/
+}WDI_GetStatsRspParamsType;
+
+#ifdef FEATURE_WLAN_CCX
+/*---------------------------------------------------------------------------
+  WDI_TSMStatsParamsInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the station for which Get Stats are requested..*/
+  wpt_uint8        ucTid;
+
+  wpt_macAddr      bssid;
+}WDI_TSMStatsParamsInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_TSMStatsReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Get TSM Stats Params  Info*/
+  WDI_TSMStatsParamsInfoType  wdiTsmStatsParamsInfo;
+
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+
+}WDI_TSMStatsReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_TSMStatsRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Indicates the status of the operation */
+  WDI_Status      wdiStatus;
+
+  wpt_uint16      UplinkPktQueueDly;
+  wpt_uint16      UplinkPktQueueDlyHist[4];
+  wpt_uint32      UplinkPktTxDly;
+  wpt_uint16      UplinkPktLoss;
+  wpt_uint16      UplinkPktCount;
+  wpt_uint8       RoamingCount;
+  wpt_uint16      RoamingDly;
+}WDI_TSMStatsRspParamsType;
+
+
+#endif
+/*---------------------------------------------------------------------------
+  WDI_UpdateCfgReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*This is a TLV formatted buffer containing all config values that can
+   be set through the DAL Interface
+ 
+   The TLV is expected to be formatted like this:
+ 
+   0            7          15              31 .... 
+   | CONFIG ID  |  CFG LEN |   RESERVED    |  CFG BODY  |
+ 
+   Or from a C construct point of VU it would look like this:
+ 
+   typedef struct WPT_PACK_POST
+   {
+       #ifdef  WPT_BIG_ENDIAN
+         wpt_uint32   ucCfgId:8;
+         wpt_uint32   ucCfgLen:8;
+         wpt_uint32   usReserved:16;
+       #else
+         wpt_uint32   usReserved:16;
+         wpt_uint32   ucCfgLen:8;
+         wpt_uint32   ucCfgId:8;
+       #endif
+ 
+       wpt_uint8   ucCfgBody[ucCfgLen];
+   }WDI_ConfigType; 
+ 
+   Multiple such tuplets are to be placed in the config buffer. One for
+   each required configuration item:
+ 
+     | TLV 1 |  TLV2 | ....
+ 
+   The buffer is expected to be a flat area of memory that can be manipulated
+   with standard memory routines.
+ 
+   For more info please check paragraph 2.3.1 Config Structure from the
+   HAL LLD.
+ 
+   For a list of accepted configuration list and IDs please look up
+   wlan_qct_dal_cfg.h
+  */
+  void*                   pConfigBuffer; 
+
+  /*Length of the config buffer above*/
+  wpt_uint32              uConfigBufferLen;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_UpdateCfgReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateProbeRspTemplateInfoType
+---------------------------------------------------------------------------*/
+//Default Beacon template size
+#define WDI_PROBE_RSP_TEMPLATE_SIZE 0x180
+
+#define WDI_PROBE_REQ_BITMAP_IE_LEN 8
+
+typedef struct
+{
+  /*BSSID for which the Probe Template is to be used*/
+  wpt_macAddr     macBSSID;
+
+  /*Probe response template*/
+  wpt_uint8      *pProbeRespTemplate[WDI_PROBE_RSP_TEMPLATE_SIZE];
+
+  /*Template Len*/
+  wpt_uint32      uProbeRespTemplateLen;
+
+  /*Bitmap for the IEs that are to be handled at SLM level*/
+  wpt_uint32      uaProxyProbeReqValidIEBmap[WDI_PROBE_REQ_BITMAP_IE_LEN];
+
+}WDI_UpdateProbeRspTemplateInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateProbeRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Link Info*/
+  WDI_UpdateProbeRspTemplateInfoType  wdiProbeRspTemplateInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_UpdateProbeRspTemplateParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_NvDownloadReqBlobInfo
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+  /* Blob starting address*/
+  void *pBlobAddress;
+
+  /* Blob size */
+  wpt_uint32 uBlobSize;
+  
+}WDI_NvDownloadReqBlobInfo;
+
+/*---------------------------------------------------------------------------
+ WDI_NvDownloadReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*NV Blob Info*/
+  WDI_NvDownloadReqBlobInfo  wdiBlobInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+   req has returned PENDING as status; it delivers the status of sending
+   the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */
+  void*                 pUserData;
+  
+}WDI_NvDownloadReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_NvDownloadRspInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+}WDI_NvDownloadRspInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetMaxTxPowerInfoType
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+  /*BSSID is needed to identify which session issued this request. As the request has 
+    power constraints, this should be applied only to that session*/
+  wpt_macAddr macBSSId;
+
+
+  wpt_macAddr macSelfStaMacAddr;
+
+  /* In request  power == MaxTxpower to be used.*/
+  wpt_int8  ucPower;
+
+}WDI_SetMaxTxPowerInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetMaxTxPowerParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Link Info*/
+  WDI_SetMaxTxPowerInfoType  wdiMaxTxPowerInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SetMaxTxPowerParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_SetMaxTxPowerRspMsg
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+  /* In response, power==tx power used for management frames*/
+  wpt_int8  ucPower;
+  
+  /*Result of the operation*/
+  WDI_Status wdiStatus;
+ 
+}WDI_SetMaxTxPowerRspMsg;
+
+#ifdef WLAN_FEATURE_P2P
+typedef struct
+{
+  wpt_uint8   ucOpp_ps;
+  wpt_uint32  uCtWindow;
+  wpt_uint8   ucCount; 
+  wpt_uint32  uDuration;
+  wpt_uint32  uInterval;
+  wpt_uint32  uSingle_noa_duration;
+  wpt_uint8   ucPsSelection;
+}WDI_SetP2PGONOAReqInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetP2PGONOAReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*P2P GO NOA Req*/
+  WDI_SetP2PGONOAReqInfoType  wdiP2PGONOAInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_SetP2PGONOAReqParamsType;
+#endif
+
+
+/*---------------------------------------------------------------------------
+  WDI_SetAddSTASelfParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Self Station MAC address*/
+  wpt_macAddr selfMacAddr;
+
+  /*Status of the operation*/
+  wpt_uint32  uStatus;
+}WDI_AddSTASelfInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetAddSTASelfParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /* Add Sta Self Req */
+  WDI_AddSTASelfInfoType  wdiAddSTASelfInfo;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb         wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                   pUserData;
+}WDI_AddSTASelfReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AddSTASelfRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*STA Idx allocated by HAL*/
+  wpt_uint8    ucSTASelfIdx;
+
+  /* DPU Index (IGTK, PTK, GTK all same) */
+  wpt_uint8    dpuIdx;
+
+  /* DPU Signature */
+  wpt_uint8    dpuSignature;
+
+  /*Self STA Mac*/
+  wpt_macAddr  macSelfSta;
+
+}WDI_AddSTASelfRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelSTASelfReqParamsType
+  Del Sta Self info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_macAddr       selfMacAddr;
+
+}WDI_DelSTASelfInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelSTASelfReqParamsType
+  Del Sta Self info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Del Sta Self Info Type */
+   WDI_DelSTASelfInfoType     wdiDelStaSelfInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_DelSTASelfReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_DelSTASelfRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ /*Status of the response*/
+  WDI_Status   wdiStatus; 
+
+  /*STA Index returned during DAL_PostAssocReq or DAL_ConfigStaReq*/
+//  wpt_uint8   ucSTAIdx;
+}WDI_DelSTASelfRspParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_UapsdInfoType
+  UAPSD parameters passed per AC to WDA from UMAC
+---------------------------------------------------------------------------*/
+typedef struct  
+{
+   wpt_uint8  ucSTAIdx;        // STA index
+   wpt_uint8  ucAc;            // Access Category
+   wpt_uint8  ucUp;            // User Priority
+   wpt_uint32 uSrvInterval;   // Service Interval
+   wpt_uint32 uSusInterval;   // Suspend Interval
+   wpt_uint32 uDelayInterval; // Delay Interval
+} WDI_UapsdInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetUapsdAcParamsReqParamsType
+  UAPSD parameters passed per AC to WDI from WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Enter BMPS Info Type, same as tEnterBmpsParams */ 
+   WDI_UapsdInfoType wdiUapsdInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb   wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*             pUserData; 
+}WDI_SetUapsdAcParamsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_EnterBmpsReqinfoType
+  Enter BMPS parameters passed to WDA from UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   //TBTT value derived from the last beacon
+   wpt_uint8         ucBssIdx;
+   wpt_uint64        uTbtt;
+   wpt_uint8         ucDtimCount;
+   //DTIM period given to HAL during association may not be valid,
+   //if association is based on ProbeRsp instead of beacon.
+   wpt_uint8         ucDtimPeriod;
+   /* DXE physical addr to be passed down to RIVA. RIVA HAL will use it to program
+   DXE when DXE wakes up from power save*/
+   unsigned int      dxePhyAddr;
+
+   // For CCX and 11R Roaming
+   wpt_uint32 rssiFilterPeriod;
+   wpt_uint32 numBeaconPerRssiAverage;
+   wpt_uint8  bRssiFilterEnable;
+}WDI_EnterBmpsReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_EnterBmpsReqParamsType
+  Enter BMPS parameters passed to WDI from WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Enter BMPS Info Type, same as tEnterBmpsParams */ 
+   WDI_EnterBmpsReqinfoType wdiEnterBmpsInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb          wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                    pUserData; 
+}WDI_EnterBmpsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ExitBmpsReqinfoType
+  Exit BMPS parameters passed to WDA from UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint8     ucSendDataNull;
+}WDI_ExitBmpsReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_ExitBmpsReqParamsType
+  Exit BMPS parameters passed to WDI from WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Exit BMPS Info Type, same as tExitBmpsParams */ 
+   WDI_ExitBmpsReqinfoType wdiExitBmpsInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb         wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                   pUserData; 
+}WDI_ExitBmpsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_EnterUapsdReqinfoType
+  Enter UAPSD parameters passed to WDA from UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint8     ucBkDeliveryEnabled:1;
+   wpt_uint8     ucBeDeliveryEnabled:1;
+   wpt_uint8     ucViDeliveryEnabled:1;
+   wpt_uint8     ucVoDeliveryEnabled:1;
+   wpt_uint8     ucBkTriggerEnabled:1;
+   wpt_uint8     ucBeTriggerEnabled:1;
+   wpt_uint8     ucViTriggerEnabled:1;
+   wpt_uint8     ucVoTriggerEnabled:1;
+}WDI_EnterUapsdReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_EnterUapsdReqinfoType
+  Enter UAPSD parameters passed to WDI from WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Enter UAPSD Info Type, same as tUapsdParams */ 
+   WDI_EnterUapsdReqinfoType wdiEnterUapsdInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb           wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                     pUserData; 
+}WDI_EnterUapsdReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateUapsdReqinfoType
+  Update UAPSD parameters passed to WDA from UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint8  ucSTAIdx;
+   wpt_uint8  ucUapsdACMask; 
+   wpt_uint32 uMaxSpLen;    
+}WDI_UpdateUapsdReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateUapsdReqParamsType
+  Update UAPSD parameters passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Update UAPSD Info Type, same as tUpdateUapsdParams */ 
+   WDI_UpdateUapsdReqinfoType wdiUpdateUapsdInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_UpdateUapsdReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigureRxpFilterReqParamsType
+  RXP filter parameters passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /* Mode of Mcast and Bcast filters configured */
+  wpt_uint8 ucSetMcstBcstFilterSetting;
+
+  /* Mcast Bcast Filters enable/disable*/
+  wpt_uint8 ucSetMcstBcstFilter;
+}WDI_RxpFilterReqParamsType;
+
+typedef struct 
+{
+  /* Rxp Filter */
+  WDI_RxpFilterReqParamsType wdiRxpFilterParam;
+  
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_ConfigureRxpFilterReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_BeaconFilterInfoType
+  Beacon Filtering data structures passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   wpt_uint16    usCapabilityInfo;
+   wpt_uint16    usCapabilityMask;
+   wpt_uint16    usBeaconInterval;
+   wpt_uint16    usIeNum;
+}WDI_BeaconFilterInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_BeaconFilterReqParamsType
+  Beacon Filtering parameters passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Beacon Filtering Info Type, same as tBeaconFilterMsg */ 
+   WDI_BeaconFilterInfoType wdiBeaconFilterInfo; 
+   /*Beacon Filter(s) follow the "usIeNum" field, hence the array to ease the
+   copy of params from WDA to WDI */ 
+   wpt_uint8 aFilters[WDI_BEACON_FILTER_LEN];
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_BeaconFilterReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemBeaconFilterInfoType
+  Beacon Filtering data structures (to be reomoved) passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   wpt_uint8  ucIeCount;
+   wpt_uint8  ucRemIeId[1];
+}WDI_RemBeaconFilterInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_RemBeaconFilterReqParamsType
+  Beacon Filtering parameters (to be reomoved)passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Beacon Filtering Info Type, same as tBeaconFilterMsg */ 
+   WDI_RemBeaconFilterInfoType wdiBeaconFilterInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_RemBeaconFilterReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_RSSIThresholdsType
+  RSSI thresholds data structures (to be reomoved) passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+    wpt_int8    ucRssiThreshold1     : 8;
+    wpt_int8    ucRssiThreshold2     : 8;
+    wpt_int8    ucRssiThreshold3     : 8;
+    wpt_uint8   bRssiThres1PosNotify : 1;
+    wpt_uint8   bRssiThres1NegNotify : 1;
+    wpt_uint8   bRssiThres2PosNotify : 1;
+    wpt_uint8   bRssiThres2NegNotify : 1;
+    wpt_uint8   bRssiThres3PosNotify : 1;
+    wpt_uint8   bRssiThres3NegNotify : 1;
+    wpt_uint8   bReserved10          : 2;
+} WDI_RSSIThresholdsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetRSSIThresholdsReqParamsType
+  RSSI thresholds parameters (to be reomoved)passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*RSSI thresholds Info Type, same as WDI_RSSIThresholds */ 
+   WDI_RSSIThresholdsType     wdiRSSIThresholdsInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_SetRSSIThresholdsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_HostOffloadReqType
+  host offload info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+#ifdef WLAN_NS_OFFLOAD
+typedef struct
+{
+   wpt_uint8 srcIPv6Addr[16];
+   wpt_uint8 selfIPv6Addr[16];
+   //Only support 2 possible Network Advertisement IPv6 address
+   wpt_uint8 targetIPv6Addr1[16];
+   wpt_uint8 targetIPv6Addr2[16];
+   wpt_uint8 selfMacAddr[6];
+   wpt_uint8 srcIPv6AddrValid : 1;
+   wpt_uint8 targetIPv6Addr1Valid : 1;
+   wpt_uint8 targetIPv6Addr2Valid : 1;
+} WDI_NSOffloadParams;
+#endif //WLAN_NS_OFFLOAD
+
+typedef struct
+{
+   wpt_uint8 ucOffloadType;
+   wpt_uint8 ucEnableOrDisable;
+   union
+   {
+       wpt_uint8 aHostIpv4Addr [4];
+       wpt_uint8 aHostIpv6Addr [16];
+   } params;
+} WDI_HostOffloadReqType;
+
+/*---------------------------------------------------------------------------
+  WDI_HostOffloadReqParamsType
+  host offload info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Host offload Info Type, same as tHalHostOffloadReq */ 
+   WDI_HostOffloadReqType     wdiHostOffloadInfo; 
+#ifdef WLAN_NS_OFFLOAD
+   WDI_NSOffloadParams        wdiNsOffloadParams;
+#endif //WLAN_NS_OFFLOAD
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_HostOffloadReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_KeepAliveReqType
+  Keep Alive info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+    wpt_uint8  ucPacketType;
+    wpt_uint32 ucTimePeriod;
+    wpt_uint8  aHostIpv4Addr[4];
+    wpt_uint8  aDestIpv4Addr[4];
+    wpt_uint8  aDestMacAddr[6];
+} WDI_KeepAliveReqType;
+
+/*---------------------------------------------------------------------------
+  WDI_KeepAliveReqParamsType
+  Keep Alive passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /* Keep Alive Info Type, same as tHalKeepAliveReq */ 
+   WDI_KeepAliveReqType     wdiKeepAliveInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_KeepAliveReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlAddBcPtrnInfoType
+  Wowl add ptrn info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint8  ucPatternId;           // Pattern ID
+   // Pattern byte offset from beginning of the 802.11 packet to start of the
+   // wake-up pattern
+   wpt_uint8  ucPatternByteOffset;   
+   wpt_uint8  ucPatternSize;         // Non-Zero Pattern size
+   wpt_uint8  ucPattern[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern
+   wpt_uint8  ucPatternMaskSize;     // Non-zero pattern mask size
+   wpt_uint8  ucPatternMask[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern mask
+   wpt_uint8  ucPatternExt[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern
+   wpt_uint8  ucPatternMaskExt[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern mask
+} WDI_WowlAddBcPtrnInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlAddBcPtrnReqParamsType
+  Wowl add ptrn info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Wowl add ptrn Info Type, same as tpSirWowlAddBcastPtrn */ 
+   WDI_WowlAddBcPtrnInfoType     wdiWowlAddBcPtrnInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_WowlAddBcPtrnReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlDelBcPtrnInfoType
+  Wowl add ptrn info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /* Pattern ID of the wakeup pattern to be deleted */
+   wpt_uint8  ucPatternId;
+} WDI_WowlDelBcPtrnInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlDelBcPtrnReqParamsType
+  Wowl add ptrn info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Wowl delete ptrn Info Type, same as WDI_WowlDelBcastPtrn */ 
+   WDI_WowlDelBcPtrnInfoType     wdiWowlDelBcPtrnInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_WowlDelBcPtrnReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlEnterInfoType
+  Wowl enter info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /* Enables/disables magic packet filtering */
+   wpt_uint8   ucMagicPktEnable; 
+
+   /* Magic pattern */
+   wpt_macAddr 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 
+   */
+   wpt_uint8   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
+   */
+   wpt_uint8   ucUcastPatternFilteringEnable;                     
+
+   /* This configuration is valid only when magicPktEnable=1. 
+    * It requests hardware to wake up when it receives the 
+    * Channel Switch Action Frame.
+    */
+   wpt_uint8   ucWowChnlSwitchRcv;
+
+   /* This configuration is valid only when magicPktEnable=1. 
+    * It requests hardware to wake up when it receives the 
+    * Deauthentication Frame. 
+    */
+   wpt_uint8   ucWowDeauthRcv;
+
+   /* This configuration is valid only when magicPktEnable=1. 
+    * It requests hardware to wake up when it receives the 
+    * Disassociation Frame. 
+    */
+   wpt_uint8   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). 
+    */
+   wpt_uint8   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.      
+    */
+   wpt_uint8   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.
+     */
+    wpt_uint8   ucWoWEAPIDRequestEnable;
+
+    /* This configuration directs the WoW packet filtering to look for EAPOL-4WAY
+     * requests and use this as a wake source.
+     */
+    wpt_uint8   ucWoWEAPOL4WayEnable;
+
+    /* This configuration allows a host wakeup on an network scan offload match.
+     */
+    wpt_uint8   ucWowNetScanOffloadMatch;
+
+    /* This configuration allows a host wakeup on any GTK rekeying error.
+     */
+    wpt_uint8   ucWowGTKRekeyError;
+
+    /* This configuration allows a host wakeup on BSS connection loss.
+     */
+    wpt_uint8   ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+} WDI_WowlEnterInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_WowlEnterReqParamsType
+  Wowl enter info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Wowl delete ptrn Info Type, same as WDI_SmeWowlEnterParams */ 
+   WDI_WowlEnterInfoType     wdiWowlEnterInfo; 
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_WowlEnterReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigureAppsCpuWakeupStateReqParamsType
+  Apps Cpu Wakeup State parameters passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /*Depicts the state of the Apps CPU */ 
+   wpt_boolean                bIsAppsAwake;
+   /*Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+}WDI_ConfigureAppsCpuWakeupStateReqParamsType;
+/*---------------------------------------------------------------------------
+  WDI_FlushAcReqinfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   // Message Type
+   wpt_uint16 usMesgType;
+
+   // Message Length
+   wpt_uint16 usMesgLen;
+
+   // Station Index. originates from HAL
+   wpt_uint8  ucSTAId;
+
+   // TID for which the transmit queue is being flushed 
+   wpt_uint8  ucTid;
+  
+}WDI_FlushAcReqinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_FlushAcReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*AC Info */
+  WDI_FlushAcReqinfoType  wdiFlushAcInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_FlushAcReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_BtAmpEventinfoType
+      BT-AMP Event Structure
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  wpt_uint8 ucBtAmpEventType;
+
+} WDI_BtAmpEventinfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_BtAmpEventParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*BT AMP event Info */
+  WDI_BtAmpEventinfoType  wdiBtAmpEventInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_BtAmpEventParamsType;
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/*---------------------------------------------------------------------------
+  WDI_AggrAddTSReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*STA Index*/
+  wpt_uint8         ucSTAIdx; 
+
+  /*Identifier for TSpec*/
+  wpt_uint8         ucTspecIdx;
+
+  /*Tspec IE negotiated OTA*/
+  WDI_TspecIEType   wdiTspecIE[WDI_MAX_NO_AC];
+
+  /*UAPSD delivery and trigger enabled flags */
+  wpt_uint8         ucUapsdFlags;
+
+  /*SI for each AC*/
+  wpt_uint8         ucServiceInterval[WDI_MAX_NO_AC];
+
+  /*Suspend Interval for each AC*/
+  wpt_uint8         ucSuspendInterval[WDI_MAX_NO_AC];
+
+  /*DI for each AC*/
+  wpt_uint8         ucDelayedInterval[WDI_MAX_NO_AC];
+
+}WDI_AggrAddTSReqInfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_AggrAddTSReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*TSpec Info */
+  WDI_AggrAddTSReqInfoType  wdiAggrTsInfo; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}WDI_AggrAddTSReqParamsType;
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+/*---------------------------------------------------------------------------
+  WDI_FTMCommandReqType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   /* FTM Command Body length */
+   wpt_uint32   bodyLength;
+   /* Actual FTM Command body */
+   void        *FTMCommandBody;
+}WDI_FTMCommandReqType;
+#endif /* ANI_MANF_DIAG */
+
+/*---------------------------------------------------------------------------
+  WDI_WlanSuspendInfoType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /* Mode of Mcast and Bcast filters configured */
+  wpt_uint8 ucConfiguredMcstBcstFilterSetting;
+}WDI_WlanSuspendInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_SuspendParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  WDI_WlanSuspendInfoType wdiSuspendParams;
+
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+
+}WDI_SuspendParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_WlanResumeInfoType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /* Mode of Mcast and Bcast filters configured */
+  wpt_uint8 ucConfiguredMcstBcstFilterSetting;
+}WDI_WlanResumeInfoType;
+
+/*---------------------------------------------------------------------------
+  WDI_ResumeParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  WDI_WlanResumeInfoType wdiResumeParams;
+
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+
+}WDI_ResumeParamsType;
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/*---------------------------------------------------------------------------
+ * WDI_GTK_OFFLOAD_REQ
+ *--------------------------------------------------------------------------*/
+
+typedef struct
+{
+  wpt_uint32     ulFlags;             /* optional flags */
+  wpt_uint8      aKCK[16];            /* Key confirmation key */ 
+  wpt_uint8      aKEK[16];            /* key encryption key */
+  wpt_uint64     ullKeyReplayCounter; /* replay counter */
+} WDI_GtkOffloadReqParams;
+
+typedef struct
+{
+   WDI_GtkOffloadReqParams gtkOffloadReqParams;
+
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_GtkOffloadReqMsg;
+
+/*---------------------------------------------------------------------------
+ * WDI_GTK_OFFLOAD_RSP
+ *--------------------------------------------------------------------------*/
+typedef struct
+{
+    /* success or failure */
+    wpt_uint32   ulStatus;
+} WDI_GtkOffloadRspParams;
+
+typedef struct
+{
+   WDI_GtkOffloadRspParams gtkOffloadRspParams;
+
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_GtkOffloadRspMsg;
+
+
+/*---------------------------------------------------------------------------
+* WDI_GTK_OFFLOAD_GETINFO_REQ
+*--------------------------------------------------------------------------*/
+
+typedef struct
+{
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_GtkOffloadGetInfoReqMsg;
+
+/*---------------------------------------------------------------------------
+* WDI_GTK_OFFLOAD_GETINFO_RSP
+*--------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint32   ulStatus;             /* success or failure */
+   wpt_uint64   ullKeyReplayCounter;  /* current replay counter value */
+   wpt_uint32   ulTotalRekeyCount;    /* total rekey attempts */
+   wpt_uint32   ulGTKRekeyCount;      /* successful GTK rekeys */
+   wpt_uint32   ulIGTKRekeyCount;     /* successful iGTK rekeys */
+} WDI_GtkOffloadGetInfoRspParams;
+
+typedef struct
+{
+   WDI_GtkOffloadGetInfoRspParams gtkOffloadGetInfoRspParams;
+
+   /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+}  WDI_GtkOffloadGetInfoRspMsg;
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+/*---------------------------------------------------------------------------
+  WDI_SuspendResumeRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Status of the response*/
+  WDI_Status   wdiStatus; 
+}WDI_SuspendResumeRspParamsType;
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+
+/*Max number of channels for a given network supported by PNO*/
+#define WDI_PNO_MAX_NETW_CHANNELS  26
+
+/*The max number of programable networks for PNO*/
+#define WDI_PNO_MAX_SUPP_NETWORKS  16
+
+/*The max number of scan timers programable in Riva*/
+#define WDI_PNO_MAX_SCAN_TIMERS    10
+
+#define WDI_PNO_MAX_PROBE_SIZE    450
+
+
+/*---------------------------------------------------------------------------
+  WDI_AuthType
+---------------------------------------------------------------------------*/
+typedef enum 
+{
+    WDI_AUTH_TYPE_ANY     = 0, 
+
+    WDI_AUTH_TYPE_NONE,   
+    WDI_AUTH_TYPE_OPEN_SYSTEM,
+    WDI_AUTH_TYPE_SHARED_KEY,
+
+    WDI_AUTH_TYPE_WPA,
+    WDI_AUTH_TYPE_WPA_PSK,
+    WDI_AUTH_TYPE_WPA_NONE,
+
+    WDI_AUTH_TYPE_RSN,
+    WDI_AUTH_TYPE_RSN_PSK,
+    WDI_AUTH_TYPE_FT_RSN,
+    WDI_AUTH_TYPE_FT_RSN_PSK,
+    WDI_AUTH_TYPE_WAPI_WAI_CERTIFICATE,
+    WDI_AUTH_TYPE_WAPI_WAI_PSK,
+    WDI_AUTH_TYPE_MAX = 0xFFFFFFFF /*expanding the type to UINT32*/
+
+}WDI_AuthType;
+
+/*---------------------------------------------------------------------------
+  WDI_EdType
+---------------------------------------------------------------------------*/
+typedef enum
+{
+    WDI_ED_ANY        = 0, 
+    WDI_ED_NONE, 
+    WDI_ED_WEP40,
+    WDI_ED_WEP104,
+    WDI_ED_TKIP,
+    WDI_ED_CCMP,
+    WDI_ED_WPI,
+    WDI_ED_AES_128_CMAC,
+    WDI_ED_MAX = 0xFFFFFFFF /*expanding the type to UINT32*/
+} WDI_EdType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_PNOMode
+---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*Network offload is to start immediately*/
+  WDI_PNO_MODE_IMMEDIATE,
+
+  /*Network offload is to start on host suspend*/
+  WDI_PNO_MODE_ON_SUSPEND,
+
+  /*Network offload is to start on host resume*/
+  WDI_PNO_MODE_ON_RESUME,
+  WDI_PNO_MODE_MAX = 0xFFFFFFFF
+} WDI_PNOMode;
+
+/* SSID broadcast  type */
+typedef enum 
+{
+  WDI_BCAST_UNKNOWN      = 0,
+  WDI_BCAST_NORMAL       = 1,
+  WDI_BCAST_HIDDEN       = 2,
+
+  WDI_BCAST_TYPE_MAX     = 0xFFFFFFFF
+} WDI_SSIDBcastType;
+
+/*---------------------------------------------------------------------------
+  WDI_NetworkType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /*The SSID of the preferred network*/
+  WDI_MacSSid  ssId;
+
+  /*The authentication method of the preferred network*/
+  WDI_AuthType wdiAuth; 
+
+  /*The encryption method of the preferred network*/
+  WDI_EdType   wdiEncryption; 
+
+  /*SSID broadcast type, normal, hidden or unknown*/
+  WDI_SSIDBcastType wdiBcastNetworkType;
+
+  /*channel count - 0 for all channels*/
+  wpt_uint8    ucChannelCount;
+
+  /*the actual channels*/
+  wpt_uint8    aChannels[WDI_PNO_MAX_NETW_CHANNELS];
+
+  /*rssi threshold that a network must meet to be considered, 0 - for any*/
+  wpt_uint8    rssiThreshold;
+} WDI_NetworkType; 
+
+
+/*---------------------------------------------------------------------------
+  WDI_ScanTimer
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /*The timer value*/
+  wpt_uint32    uTimerValue; 
+
+  /*The amount of time we should be repeating the interval*/
+  wpt_uint32    uTimerRepeat; 
+} WDI_ScanTimer; 
+
+/*---------------------------------------------------------------------------
+  WDI_ScanTimersType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*The number of value pair intervals present in the array*/
+  wpt_uint8      ucScanTimersCount; 
+
+  /*The time-repeat value pairs*/
+  WDI_ScanTimer  aTimerValues[WDI_PNO_MAX_SCAN_TIMERS]; 
+} WDI_ScanTimersType;
+
+/*---------------------------------------------------------------------------
+  WDI_PNOScanReqType
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /*Enable or disable PNO feature*/
+  wpt_uint8           bEnable;
+
+  /*PNO mode requested*/
+  WDI_PNOMode         wdiModePNO;
+
+  /*Network count*/
+  wpt_uint8           ucNetworksCount; 
+
+  /*The networks to look for*/
+  WDI_NetworkType     aNetworks[WDI_PNO_MAX_SUPP_NETWORKS];
+
+  /*Scan timer intervals*/
+  WDI_ScanTimersType  scanTimers; 
+
+  /*Probe template for 2.4GHz band*/
+  wpt_uint16          us24GProbeSize; 
+  wpt_uint8           a24GProbeTemplate[WDI_PNO_MAX_PROBE_SIZE];
+
+  /*Probe template for 5GHz band*/
+  wpt_uint16          us5GProbeSize; 
+  wpt_uint8           a5GProbeTemplate[WDI_PNO_MAX_PROBE_SIZE];
+} WDI_PNOScanReqType;
+
+/*---------------------------------------------------------------------------
+  WDI_PNOScanReqParamsType
+  PNO info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /* PNO Info Type, same as tPrefNetwListParams */ 
+   WDI_PNOScanReqType        wdiPNOScanInfo; 
+   /* Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /* The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+} WDI_PNOScanReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetRssiFilterReqParamsType
+  PNO info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /* RSSI Threshold */ 
+   wpt_uint8                  rssiThreshold; 
+   /* Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /* The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+} WDI_SetRssiFilterReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateScanParamsInfo
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+  /*Is 11d enabled*/
+  wpt_uint8    b11dEnabled; 
+
+  /*Was UMAc able to find the regulatory domain*/
+  wpt_uint8    b11dResolved;
+
+  /*Number of channel allowed in the regulatory domain*/
+  wpt_uint8    ucChannelCount; 
+
+  /*The actual channels allowed in the regulatory domain*/
+  wpt_uint8    aChannels[WDI_PNO_MAX_NETW_CHANNELS]; 
+
+  /*Passive min channel time*/
+  wpt_uint16   usPassiveMinChTime; 
+
+  /*Passive max channel time*/
+  wpt_uint16   usPassiveMaxChTime; 
+
+  /*Active min channel time*/
+  wpt_uint16   usActiveMinChTime; 
+
+  /*Active max channel time*/
+  wpt_uint16   usActiveMaxChTime; 
+
+  /*channel bonding info*/
+  wpt_uint8    cbState; 
+} WDI_UpdateScanParamsInfo;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateScanParamsInfoType
+  UpdateScanParams info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /* PNO Info Type, same as tUpdateScanParams */ 
+   WDI_UpdateScanParamsInfo   wdiUpdateScanParamsInfo; 
+   /* Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /* The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData; 
+} WDI_UpdateScanParamsInfoType;
+#endif // FEATURE_WLAN_SCAN_PNO
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateScanParamsInfo
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+   /*  Ignore DTIM */
+  wpt_uint32 uIgnoreDTIM;
+
+  /*DTIM Period*/
+  wpt_uint32 uDTIMPeriod;
+
+  /* Listen Interval */
+  wpt_uint32 uListenInterval;
+
+  /* Broadcast Multicas Filter  */
+  wpt_uint32 uBcastMcastFilter;
+
+  /* Beacon Early Termination */
+  wpt_uint32 uEnableBET;
+
+  /* Beacon Early Termination Interval */
+  wpt_uint32 uBETInterval; 
+
+} WDI_SetPowerParamsInfo;
+
+/*---------------------------------------------------------------------------
+  WDI_UpdateScanParamsInfoType
+  UpdateScanParams info passed to WDI form WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+   /* Power params Info Type, same as tSetPowerParamsReq */ 
+   WDI_SetPowerParamsInfo     wdiSetPowerParamsInfo; 
+   /* Request status callback offered by UMAC - it is called if the current req
+   has returned PENDING as status; it delivers the status of sending the message
+   over the BUS */ 
+   WDI_ReqStatusCb            wdiReqStatusCB; 
+   /* The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */ 
+   void*                      pUserData;
+}WDI_SetPowerParamsReqParamsType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetTxPerTrackingConfType
+  Wowl add ptrn info passed to WDA form UMAC
+---------------------------------------------------------------------------*/
+typedef struct
+{
+   wpt_uint8  ucTxPerTrackingEnable;     /* 0: disable, 1:enable */
+   wpt_uint8  ucTxPerTrackingPeriod;        /* Check period, unit is sec. */
+   wpt_uint8  ucTxPerTrackingRatio;      /* (Fail TX packet)/(Total TX packet) ratio, the unit is 10%. */
+   wpt_uint32 uTxPerTrackingWatermark;         /* A watermark of check number, once the tx packet exceed this number, we do the check, default is 5 */
+} WDI_TxPerTrackingParamType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetTxPerTrackingReqParamsType
+  Tx PER Tracking parameters passed to WDI from WDA
+---------------------------------------------------------------------------*/
+typedef struct 
+{ 
+  /* Configurations for Tx PER Tracking */ 
+  WDI_TxPerTrackingParamType     wdiTxPerTrackingParam;
+  /*Request status callback offered by UMAC - it is called if the current req
+    has returned PENDING as status; it delivers the status of sending the message
+    over the BUS */ 
+  WDI_ReqStatusCb            wdiReqStatusCB; 
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */ 
+  void*                      pUserData; 
+}WDI_SetTxPerTrackingReqParamsType;
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/*---------------------------------------------------------------------------
+  Packet Filtering Parameters
+---------------------------------------------------------------------------*/
+
+#define    WDI_IPV4_ADDR_LEN                  4
+#define    WDI_MAC_ADDR_LEN                   6
+#define    WDI_MAX_FILTER_TEST_DATA_LEN       8
+#define    WDI_MAX_NUM_MULTICAST_ADDRESS    240
+#define    WDI_MAX_NUM_FILTERS               20 
+#define    WDI_MAX_NUM_TESTS_PER_FILTER      10 
+
+//
+// Receive Filter Parameters
+//
+typedef enum
+{
+  WDI_RCV_FILTER_TYPE_INVALID,
+  WDI_RCV_FILTER_TYPE_FILTER_PKT,
+  WDI_RCV_FILTER_TYPE_BUFFER_PKT,
+  WDI_RCV_FILTER_TYPE_MAX_ENUM_SIZE
+}WDI_ReceivePacketFilterType;
+
+typedef enum 
+{
+  WDI_FILTER_HDR_TYPE_INVALID,
+  WDI_FILTER_HDR_TYPE_MAC,
+  WDI_FILTER_HDR_TYPE_ARP,
+  WDI_FILTER_HDR_TYPE_IPV4,
+  WDI_FILTER_HDR_TYPE_IPV6,
+  WDI_FILTER_HDR_TYPE_UDP,
+  WDI_FILTER_HDR_TYPE_MAX
+}WDI_RcvPktFltProtocolType;
+
+typedef enum 
+{
+  WDI_FILTER_CMP_TYPE_INVALID,
+  WDI_FILTER_CMP_TYPE_EQUAL,
+  WDI_FILTER_CMP_TYPE_MASK_EQUAL,
+  WDI_FILTER_CMP_TYPE_NOT_EQUAL,
+  WDI_FILTER_CMP_TYPE_MASK_NOT_EQUAL,
+  WDI_FILTER_CMP_TYPE_MAX
+}WDI_RcvPktFltCmpFlagType;
+
+typedef struct
+{
+  WDI_RcvPktFltProtocolType          protocolLayer;
+  WDI_RcvPktFltCmpFlagType           cmpFlag;
+/* Length of the data to compare */
+  wpt_uint16                         dataLength; 
+/* from start of the respective frame header */  
+  wpt_uint8                          dataOffset; 
+  wpt_uint8                          reserved; /* Reserved field */
+/* Data to compare */
+  wpt_uint8                          compareData[WDI_MAX_FILTER_TEST_DATA_LEN];  
+/* Mask to be applied on the received packet data before compare */
+  wpt_uint8                          dataMask[WDI_MAX_FILTER_TEST_DATA_LEN];   
+}WDI_RcvPktFilterFieldParams;
+
+typedef struct
+{
+  wpt_uint8                       filterId; 
+  wpt_uint8                       filterType;
+  wpt_uint32                      numFieldParams;
+  wpt_uint32                      coalesceTime;
+  WDI_RcvPktFilterFieldParams     paramsData[1];
+}WDI_RcvPktFilterCfgType;
+
+typedef struct 
+{
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+    
+  // Variable length packet filter field params
+  WDI_RcvPktFilterCfgType wdiPktFilterCfg;
+} WDI_SetRcvPktFilterReqParamsType;
+
+//
+// Filter Packet Match Count Parameters
+//
+typedef struct
+{
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_RcvFltPktMatchCntReqParamsType;
+
+typedef struct
+{
+  wpt_uint8    filterId;
+  wpt_uint32   matchCnt;
+} WDI_RcvFltPktMatchCnt;
+
+typedef struct
+{
+  /* Success or Failure */
+  wpt_uint32                 status;
+  WDI_RcvFltPktMatchCnt    filterMatchCnt[WDI_MAX_NUM_FILTERS];
+  
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_RcvFltPktMatchRspParams;
+
+typedef struct
+{
+  WDI_RcvFltPktMatchRspParams fltPktMatchRspParams;
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_RcvFltPktMatchCntRspParamsType;
+
+
+//
+// Receive Filter Clear Parameters
+//
+typedef struct
+{
+  wpt_uint32   status;  /* only valid for response message */
+  wpt_uint8    filterId;
+}WDI_RcvFltPktClearParam;
+
+typedef struct
+{
+  WDI_RcvFltPktClearParam     filterClearParam;
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_RcvFltPktClearReqParamsType;
+
+//
+// Multicast Address List Parameters
+//
+typedef struct 
+{
+  wpt_uint32     ulMulticastAddrCnt;
+  wpt_macAddr    multicastAddr[WDI_MAX_NUM_MULTICAST_ADDRESS];
+} WDI_RcvFltMcAddrListType;
+
+typedef struct
+{
+  WDI_RcvFltMcAddrListType         mcAddrList;
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb   wdiReqStatusCB; 
+    
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*             pUserData;
+} WDI_RcvFltPktSetMcListReqParamsType;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+/*---------------------------------------------------------------------------
+  WDI_HALDumpCmdReqInfoType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*command*/
+  wpt_uint32 command;
+
+  /*Arguments*/
+  wpt_uint32 argument1;
+  wpt_uint32 argument2;
+  wpt_uint32 argument3;
+  wpt_uint32 argument4;
+
+}WDI_HALDumpCmdReqInfoType;
+
+/*---------------------------------------------------------------------------
+ WDI_HALDumpCmdReqParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*NV Blob Info*/
+  WDI_HALDumpCmdReqInfoType  wdiHALDumpCmdInfoType; 
+
+  /*Request status callback offered by UMAC - it is called if the current
+   req has returned PENDING as status; it delivers the status of sending
+   the message over the BUS */
+  WDI_ReqStatusCb       wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+   function pointer will be called */
+  void*                 pUserData;
+  
+}WDI_HALDumpCmdReqParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_HALDumpCmdRspParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Result of the operation*/
+  WDI_Status       wdiStatus;
+
+  /* length of the buffer */
+  wpt_uint16       usBufferLen;
+    
+  /* Buffer */
+  wpt_uint8       *pBuffer;
+}WDI_HALDumpCmdRspParamsType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_SetTmLevelReqType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  wpt_uint16       tmMode;
+  wpt_uint16       tmLevel;
+  void*            pUserData;
+}WDI_SetTmLevelReqType;
+
+/*---------------------------------------------------------------------------
+  WDI_SetTmLevelRspType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+  WDI_Status       wdiStatus;
+  void*            pUserData;
+}WDI_SetTmLevelRspType;
+
+/*----------------------------------------------------------------------------
+ *   WDI callback types
+ *--------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Start response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDI_StartRspCb)(WDI_StartRspParamsType*   pwdiRspParams,
+                               void*                     pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Stop response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+ 
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDI_StopRspCb)(WDI_Status   wdiStatus,
+                              void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received an Init Scan response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_InitScanRspCb)(WDI_Status   wdiStatus,
+                                   void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a StartScan response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiParams:  response params received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_StartScanRspCb)(WDI_StartScanRspParamsType*  wdiParams,
+                                    void*                        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a End Scan response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_EndScanRspCb)(WDI_Status   wdiStatus,
+                                  void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Finish Scan response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_FinishScanRspCb)(WDI_Status   wdiStatus,
+                                     void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Join response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+ 
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_JoinRspCb)(WDI_Status   wdiStatus,
+                               void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Config BSS response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiConfigBSSRsp:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ConfigBSSRspCb)(
+                            WDI_ConfigBSSRspParamsType*   pwdiConfigBSSRsp,
+                            void*                        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Del BSS response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiDelBSSRsp:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_DelBSSRspCb)(WDI_DelBSSRspParamsType*  pwdiDelBSSRsp,
+                                 void*                     pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Post Assoc response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_PostAssocRspCb)(
+                               WDI_PostAssocRspParamsType*  pwdiPostAssocRsp,
+                               void*                        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Del STA response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiDelSTARsp:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_DelSTARspCb)(WDI_DelSTARspParamsType*   pwdiDelSTARsp,
+                                 void*                      pUserData);
+
+
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set BSS Key response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetBSSKeyRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Remove BSS Key
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_RemoveBSSKeyRspCb)(WDI_Status   wdiStatus,
+                                       void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set STA Key response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetSTAKeyRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Remove STA Key
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_RemoveSTAKeyRspCb)(WDI_Status   wdiStatus,
+                                       void*        pUserData);
+
+
+#ifdef FEATURE_WLAN_CCX 
+/*---------------------------------------------------------------------------
+   WDI_TsmRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a TSM Stats response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    pTSMStats:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_TsmRspCb)(WDI_TSMStatsRspParamsType *pTSMStats,
+                                void*        pUserData);
+#endif
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Add TS response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_AddTsRspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Del TS response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_DelTsRspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received an Update EDCA Params
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+ 
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateEDCAParamsRspCb)(WDI_Status   wdiStatus,
+                                           void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Add BA response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_AddBASessionRspCb)(
+                            WDI_AddBASessionRspParamsType* wdiAddBASessionRsp,
+                            void*                         pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Del BA response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_DelBARspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Switch Ch response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SwitchChRspCb)(WDI_SwitchCHRspParamsType*  pwdiSwitchChRsp,
+                                   void*                       pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Config STA response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ConfigSTARspCb)(
+                            WDI_ConfigSTARspParamsType*  pwdiConfigSTARsp,
+                            void*                        pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set Link State
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetLinkStateRspCb)( WDI_Status   wdiStatus,
+                                        void*        pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Get Stats response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiRspParams:  response parameters received from HAL
+    pUserData:      user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_GetStatsRspCb)(WDI_GetStatsRspParamsType*  pwdiGetStatsRsp,
+                                   void*                       pUserData);
+
+ 
+/*---------------------------------------------------------------------------
+   WDI_StartRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Update Cfg response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateCfgRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_AddBARspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a ADD BA response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_AddBARspCb)(WDI_AddBARspinfoType*   wdiAddBARsp,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_TriggerBARspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a ADD BA response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_TriggerBARspCb)(WDI_TriggerBARspParamsType*   wdiTriggerBARsp,
+                                    void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_UpdateBeaconParamsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Update Beacon Params response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateBeaconParamsRspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_SendBeaconParamsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Send Beacon Params response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SendBeaconParamsRspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDA_SetMaxTxPowerRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a set max Tx Power response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDA_SetMaxTxPowerRspCb)(WDI_SetMaxTxPowerRspMsg *wdiSetMaxTxPowerRsp,
+                                             void* pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_UpdateProbeRspTemplateRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Probe RSP Template
+   Update  response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateProbeRspTemplateRspCb)(WDI_Status   wdiStatus,
+                                               void*        pUserData);
+
+#ifdef WLAN_FEATURE_P2P
+/*---------------------------------------------------------------------------
+   WDI_SetP2PGONOAReqParamsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a P2P GO NOA Params response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetP2PGONOAReqParamsRspCb)(WDI_Status   wdiStatus,
+                                void*        pUserData);
+#endif
+
+
+/*---------------------------------------------------------------------------
+   WDI_SetPwrSaveCfgCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a set Power Save CFG
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetPwrSaveCfgCb)(WDI_Status   wdiStatus,
+                                     void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_SetUapsdAcParamsCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a set UAPSD params
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetUapsdAcParamsCb)(WDI_Status   wdiStatus,
+                                        void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_EnterImpsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Enter IMPS response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_EnterImpsRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ExitImpsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Exit IMPS response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ExitImpsRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_EnterBmpsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a enter BMPS response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_EnterBmpsRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ExitBmpsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a exit BMPS response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ExitBmpsRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_EnterUapsdRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a enter UAPSD response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_EnterUapsdRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ExitUapsdRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a exit UAPSD response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ExitUapsdRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_UpdateUapsdParamsCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a update UAPSD params
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateUapsdParamsCb)(WDI_Status   wdiStatus,
+                                        void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ConfigureRxpFilterCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a config RXP filter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ConfigureRxpFilterCb)(WDI_Status   wdiStatus,
+                                          void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_SetBeaconFilterCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a set beacon filter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetBeaconFilterCb)(WDI_Status   wdiStatus,
+                                       void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_RemBeaconFilterCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a remove beacon filter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_RemBeaconFilterCb)(WDI_Status   wdiStatus,
+                                       void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_SetRSSIThresholdsCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a set RSSI thresholds
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetRSSIThresholdsCb)(WDI_Status   wdiStatus,
+                                         void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_HostOffloadCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a host offload
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_HostOffloadCb)(WDI_Status   wdiStatus,
+                                   void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_KeepAliveCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Keep Alive
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_KeepAliveCb)(WDI_Status   wdiStatus,
+                                   void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_WowlAddBcPtrnCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Wowl add Bcast ptrn
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_WowlAddBcPtrnCb)(WDI_Status   wdiStatus,
+                                     void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_WowlDelBcPtrnCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Wowl delete Bcast ptrn
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_WowlDelBcPtrnCb)(WDI_Status   wdiStatus,
+                                     void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_WowlEnterReqCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Wowl enter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_WowlEnterReqCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_WowlExitReqCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Wowl exit
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_WowlExitReqCb)(WDI_Status   wdiStatus,
+                                   void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ConfigureAppsCpuWakeupStateCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a config Apps Cpu Wakeup
+   State response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ConfigureAppsCpuWakeupStateCb)(WDI_Status   wdiStatus,
+                                                   void*        pUserData);
+/*---------------------------------------------------------------------------
+   WDI_NvDownloadRspCb
+ 
+   DESCRIPTION
+ 
+   This callback is invoked by DAL when it has received a NV Download response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+   IN
+   wdiStatus:response status received from HAL
+    pUserData:user data  
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_NvDownloadRspCb)(WDI_NvDownloadRspInfoType* wdiNvDownloadRsp,
+                                          void*  pUserData);
+/*---------------------------------------------------------------------------
+   WDI_FlushAcRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Flush AC response from
+   the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+    
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_FlushAcRspCb)(WDI_Status   wdiStatus,
+                                  void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_BtAmpEventRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Bt AMP event response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_BtAmpEventRspCb)(WDI_Status   wdiStatus,
+                                     void*        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_HostResumeEventRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Bt AMP event response
+   from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_HostResumeEventRspCb)(
+                        WDI_SuspendResumeRspParamsType   *resumeRspParams,
+                        void*        pUserData);
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/*---------------------------------------------------------------------------
+   WDI_AggrAddTsRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Aggregated Add TS
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_AggrAddTsRspCb)(WDI_Status   wdiStatus,
+                                    void*        pUserData);
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+/*---------------------------------------------------------------------------
+   WDI_FTMCommandRspCb
+ 
+   DESCRIPTION   
+ 
+   FTM Command response CB
+ 
+   PARAMETERS 
+
+    IN
+    ftmCMDRspdata:  FTM response data from HAL
+    pUserData:  user data  
+    
+  
+  RETURN VALUE 
+    NONE
+---------------------------------------------------------------------------*/
+typedef void (*WDI_FTMCommandRspCb)(void *ftmCMDRspdata,
+                                    void *pUserData);
+#endif /* ANI_MANF_DIAG */
+
+/*---------------------------------------------------------------------------
+   WDI_AddSTASelfParamsRspCb 
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Add Sta Self Params
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiAddSelfSTARsp:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_AddSTASelfParamsRspCb)(
+                    WDI_AddSTASelfRspParamsType* pwdiAddSelfSTARsp,
+                    void*                        pUserData);
+
+
+/*---------------------------------------------------------------------------
+   WDI_DelSTASelfRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a host offload
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_DelSTASelfRspCb)
+(
+WDI_DelSTASelfRspParamsType*     wdiDelStaSelfRspParams,
+void*        pUserData
+);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/*---------------------------------------------------------------------------
+   WDI_PNOScanCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set PNO
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_PNOScanCb)(WDI_Status  wdiStatus,
+                                void*       pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_PNOScanCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set PNO
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_RssiFilterCb)(WDI_Status  wdiStatus,
+                                void*       pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_UpdateScanParamsCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Update Scan Params
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_UpdateScanParamsCb)(WDI_Status  wdiStatus,
+                                        void*       pUserData);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+/*---------------------------------------------------------------------------
+   WDI_SetTxPerTrackingRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Tx PER Tracking
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetTxPerTrackingRspCb)(WDI_Status   wdiStatus,
+                                           void*        pUserData);
+                                     
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/*---------------------------------------------------------------------------
+   WDI_8023MulticastListCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a 8023 Multicast List
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_8023MulticastListCb)(WDI_Status   wdiStatus,
+                                         void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ReceiveFilterSetFilterCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Receive Filter Set Filter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ReceiveFilterSetFilterCb)(WDI_Status   wdiStatus,
+                                              void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_FilterMatchCountCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Do PC Filter Match Count
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_FilterMatchCountCb)(WDI_Status   wdiStatus,
+                                        void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_ReceiveFilterClearFilterCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Receive Filter Clear Filter
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_ReceiveFilterClearFilterCb)(WDI_Status   wdiStatus,
+                                                void*        pUserData);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+/*---------------------------------------------------------------------------
+   WDI_HALDumpCmdRspCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a HAL DUMP Command 
+response from
+   the HAL layer.
+ 
+   PARAMETERS 
+
+    IN
+    wdiHalDumpCmdRsp:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_HALDumpCmdRspCb)(WDI_HALDumpCmdRspParamsType* wdiHalDumpCmdRsp,
+                                                                       void*  pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_SetPowerParamsCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set Power Param
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetPowerParamsCb)(WDI_Status  wdiStatus,
+                                      void*       pUserData);
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/*---------------------------------------------------------------------------
+   WDI_GtkOffloadCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a GTK offload
+   response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_GtkOffloadCb)(WDI_Status   wdiStatus,
+                                  void*        pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_GtkOffloadGetInfoCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a GTK offload
+   information response from the underlying device.
+ 
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_GtkOffloadGetInfoCb)(WDI_Status   wdiStatus,
+                                         void*        pUserData);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+/*---------------------------------------------------------------------------
+   WDI_SetTmLevelCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a Set New TM Level
+   done response from the underlying device.
+
+   PARAMETERS 
+
+    IN
+    wdiStatus:  response status received from HAL
+    pUserData:  user data  
+
+    
+  
+  RETURN VALUE 
+    The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_SetTmLevelCb)(WDI_Status  wdiStatus,
+                                  void*       pUserData);
+
+/*---------------------------------------------------------------------------
+   WDI_featureCapsExchangeCb
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by DAL when it has received a HAL Feature Capbility 
+   Exchange Response the HAL layer. This callback is put to mantain code
+   similarity and is not being used right now.
+ 
+   PARAMETERS 
+
+   IN
+   wdiFeatCapRspParams:  response parameters received from HAL
+   pUserData:  user data     
+  
+   RETURN VALUE 
+   The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void  (*WDI_featureCapsExchangeCb)(void* wdiFeatCapRspParams,
+                                                void*        pUserData);
+
+/*========================================================================
+ *     Function Declarations and Documentation
+ ==========================================================================*/
+
+/*======================================================================== 
+ 
+                             INITIALIZATION APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_Init is used to initialize the DAL.
+ 
+ DAL will allocate all the resources it needs. It will open PAL, it will also
+ open both the data and the control transport which in their turn will open
+ DXE/SMD or any other drivers that they need. 
+ 
+ @param pOSContext: pointer to the OS context provided by the UMAC
+                    will be passed on to PAL on Open
+        ppWDIGlobalCtx: output pointer of Global Context
+        pWdiDevCapability: output pointer of device capability
+
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Init
+( 
+  void*                      pOSContext,
+  void**                     ppWDIGlobalCtx,
+  WDI_DeviceCapabilityType*  pWdiDevCapability,
+  unsigned int               driverType
+);
+
+/**
+ @brief WDI_Start will be called when the upper MAC is ready to
+        commence operation with the WLAN Device. Upon the call
+        of this API the WLAN DAL will pack and send a HAL Start
+        message to the lower RIVA sub-system if the SMD channel
+        has been fully opened and the RIVA subsystem is up.
+
+         If the RIVA sub-system is not yet up and running DAL
+         will queue the request for Open and will wait for the
+         SMD notification before attempting to send down the
+         message to HAL. 
+
+ WDI_Init must have been called.
+
+ @param wdiStartParams: the start parameters as specified by 
+                      the Device Interface
+  
+        wdiStartRspCb: callback for passing back the response of
+        the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Start
+(
+  WDI_StartReqParamsType*  pwdiStartParams,
+  WDI_StartRspCb           wdiStartRspCb,
+  void*                    pUserData
+);
+
+
+/**
+ @brief WDI_Stop will be called when the upper MAC is ready to
+        stop any operation with the WLAN Device. Upon the call
+        of this API the WLAN DAL will pack and send a HAL Stop
+        message to the lower RIVA sub-system if the DAL Core is
+        in started state.
+
+         In state BUSY this request will be queued.
+  
+         Request will not be accepted in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiStopParams: the stop parameters as specified by 
+                      the Device Interface
+  
+        wdiStopRspCb: callback for passing back the response of
+        the stop operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Stop
+(
+  WDI_StopReqParamsType*  pwdiStopParams,
+  WDI_StopRspCb           wdiStopRspCb,
+  void*                   pUserData
+);
+
+/**
+ @brief WDI_Close will be called when the upper MAC no longer 
+        needs to interract with DAL. DAL will free its control
+        block.
+  
+        It is only accepted in state STOPPED.  
+
+ WDI_Stop must have been called.
+
+ @param none
+  
+ @see WDI_Stop
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Close
+(
+  void
+);
+
+
+/**
+ @brief  WDI_Shutdown will be called during 'SSR shutdown' operation.
+         This will do most of the WDI stop & close
+         operations without doing any handshake with Riva
+
+         This will also make sure that the control transport
+         will NOT be closed.
+
+         This request will not be queued.
+
+
+ WDI_Start must have been called.
+
+ @param  closeTransport:  Close control channel if this is set
+
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Shutdown
+(
+ wpt_boolean closeTransport
+);
+
+/*======================================================================== 
+ 
+                             SCAN APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_InitScanReq will be called when the upper MAC wants 
+        the WLAN Device to get ready for a scan procedure. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Init Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiInitScanParams: the init scan parameters as specified
+                      by the Device Interface
+  
+        wdiInitScanRspCb: callback for passing back the response
+        of the init scan operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_InitScanReq
+(
+  WDI_InitScanReqParamsType*  pwdiInitScanParams,
+  WDI_InitScanRspCb           wdiInitScanRspCb,
+  void*                       pUserData
+);
+
+/**
+ @brief WDI_StartScanReq will be called when the upper MAC 
+        wishes to change the Scan channel on the WLAN Device.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_InitScanReq must have been called.
+
+ @param wdiStartScanParams: the start scan parameters as 
+                      specified by the Device Interface
+  
+        wdiStartScanRspCb: callback for passing back the
+        response of the start scan operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_InitScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_StartScanReq
+(
+  WDI_StartScanReqParamsType*  pwdiStartScanParams,
+  WDI_StartScanRspCb           wdiStartScanRspCb,
+  void*                        pUserData
+);
+
+
+/**
+ @brief WDI_EndScanReq will be called when the upper MAC is 
+        wants to end scanning for a particular channel that it
+        had set before by calling Scan Start on the WLAN Device.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL End Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_StartScanReq must have been called.
+
+ @param wdiEndScanParams: the end scan parameters as specified 
+                      by the Device Interface
+  
+        wdiEndScanRspCb: callback for passing back the response
+        of the end scan operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_StartScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EndScanReq
+(
+  WDI_EndScanReqParamsType* pwdiEndScanParams,
+  WDI_EndScanRspCb          wdiEndScanRspCb,
+  void*                     pUserData
+);
+
+
+/**
+ @brief WDI_FinishScanReq will be called when the upper MAC has 
+        completed the scan process on the WLAN Device. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Finish Scan Request request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_InitScanReq must have been called.
+
+ @param wdiFinishScanParams: the finish scan  parameters as 
+                      specified by the Device Interface
+  
+        wdiFinishScanRspCb: callback for passing back the
+        response of the finish scan operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_InitScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FinishScanReq
+(
+  WDI_FinishScanReqParamsType* pwdiFinishScanParams,
+  WDI_FinishScanRspCb          wdiFinishScanRspCb,
+  void*                        pUserData
+);
+
+/*======================================================================== 
+ 
+                          ASSOCIATION APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_JoinReq will be called when the upper MAC is ready 
+        to start an association procedure to a BSS. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Join request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiJoinParams: the join parameters as specified by 
+                      the Device Interface
+  
+        wdiJoinRspCb: callback for passing back the response of
+        the join operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_JoinReq
+(
+  WDI_JoinReqParamsType* pwdiJoinParams,
+  WDI_JoinRspCb          wdiJoinRspCb,
+  void*                  pUserData
+);
+
+/**
+ @brief WDI_ConfigBSSReq will be called when the upper MAC 
+        wishes to configure the newly acquired or in process of
+        being acquired BSS to the HW . Upon the call of this API
+        the WLAN DAL will pack and send a HAL Config BSS request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinReq must have been called.
+
+ @param wdiConfigBSSParams: the config BSS parameters as 
+                      specified by the Device Interface
+  
+        wdiConfigBSSRspCb: callback for passing back the
+        response of the config BSS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigBSSReq
+(
+  WDI_ConfigBSSReqParamsType* pwdiConfigBSSParams,
+  WDI_ConfigBSSRspCb          wdiConfigBSSRspCb,
+  void*                       pUserData
+);
+
+/**
+ @brief WDI_DelBSSReq will be called when the upper MAC is 
+        dissasociating from the BSS and wishes to notify HW.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Del BSS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_ConfigBSSReq or WDI_PostAssocReq must have been called.
+
+ @param wdiDelBSSParams: the del BSS parameters as specified by 
+                      the Device Interface
+  
+        wdiDelBSSRspCb: callback for passing back the response
+        of the del bss operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_ConfigBSSReq, WDI_PostAssocReq 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelBSSReq
+(
+  WDI_DelBSSReqParamsType* pwdiDelBSSParams,
+  WDI_DelBSSRspCb          wdiDelBSSRspCb,
+  void*                    pUserData
+);
+
+/**
+ @brief WDI_PostAssocReq will be called when the upper MAC has 
+        associated to a BSS and wishes to configure HW for
+        associated state. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Post Assoc request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinReq must have been called.
+
+ @param wdiPostAssocReqParams: the assoc parameters as specified
+                      by the Device Interface
+  
+        wdiPostAssocRspCb: callback for passing back the
+        response of the post assoc operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_PostAssocReq
+(
+  WDI_PostAssocReqParamsType* pwdiPostAssocReqParams,
+  WDI_PostAssocRspCb          wdiPostAssocRspCb,
+  void*                       pUserData
+);
+
+/**
+ @brief WDI_DelSTAReq will be called when the upper MAC when an 
+        association with another STA has ended and the station
+        must be deleted from HW. Upon the call of this API the
+        WLAN DAL will pack and send a HAL Del STA request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiDelSTAParams: the Del STA parameters as specified by 
+                      the Device Interface
+  
+        wdiDelSTARspCb: callback for passing back the response
+        of the del STA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelSTAReq
+(
+  WDI_DelSTAReqParamsType* pwdiDelSTAParams,
+  WDI_DelSTARspCb          wdiDelSTARspCb,
+  void*                    pUserData
+);
+
+/*======================================================================== 
+ 
+                             SECURITY APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_SetBSSKeyReq will be called when the upper MAC ito 
+        install a BSS encryption key on the HW. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Start
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiSetBSSKeyParams: the BSS Key set parameters as 
+                      specified by the Device Interface
+  
+        wdiSetBSSKeyRspCb: callback for passing back the
+        response of the set BSS Key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetBSSKeyReq
+(
+  WDI_SetBSSKeyReqParamsType* pwdiSetBSSKeyParams,
+  WDI_SetBSSKeyRspCb          wdiSetBSSKeyRspCb,
+  void*                       pUserData
+);
+
+
+/**
+ @brief WDI_RemoveBSSKeyReq will be called when the upper MAC to
+        uninstall a BSS key from HW. Upon the call of this API
+        the WLAN DAL will pack and send a HAL Remove BSS Key
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetBSSKeyReq must have been called.
+
+ @param wdiRemoveBSSKeyParams: the remove BSS key parameters as 
+                      specified by the Device Interface
+  
+        wdiRemoveBSSKeyRspCb: callback for passing back the
+        response of the remove BSS key operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetBSSKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveBSSKeyReq
+(
+  WDI_RemoveBSSKeyReqParamsType* pwdiRemoveBSSKeyParams,
+  WDI_RemoveBSSKeyRspCb          wdiRemoveBSSKeyRspCb,
+  void*                          pUserData
+);
+
+
+/**
+ @brief WDI_SetSTAKeyReq will be called when the upper MAC is 
+        ready to install a STA(ast) encryption key in HW. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Set STA Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiSetSTAKeyParams: the set STA key parameters as 
+                      specified by the Device Interface
+  
+        wdiSetSTAKeyRspCb: callback for passing back the
+        response of the set STA key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetSTAKeyReq
+(
+  WDI_SetSTAKeyReqParamsType* pwdiSetSTAKeyParams,
+  WDI_SetSTAKeyRspCb          wdiSetSTAKeyRspCb,
+  void*                       pUserData
+);
+
+
+/**
+ @brief WDI_RemoveSTAKeyReq will be called when the upper MAC 
+        wants to unistall a previously set STA key in HW. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Remove STA Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTAKeyReq must have been called.
+
+ @param wdiRemoveSTAKeyParams: the remove STA key parameters as 
+                      specified by the Device Interface
+  
+        wdiRemoveSTAKeyRspCb: callback for passing back the
+        response of the remove STA key operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetSTAKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveSTAKeyReq
+(
+  WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTAKeyParams,
+  WDI_RemoveSTAKeyRspCb          wdiRemoveSTAKeyRspCb,
+  void*                          pUserData
+);
+
+/**
+ @brief WDI_SetSTABcastKeyReq will be called when the upper MAC 
+        wants to install a STA Bcast encryption key on the HW.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiSetSTABcastKeyParams: the BSS Key set parameters as 
+                      specified by the Device Interface
+  
+        wdiSetSTABcastKeyRspCb: callback for passing back the
+        response of the set BSS Key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetSTABcastKeyReq
+(
+  WDI_SetSTAKeyReqParamsType* pwdiSetSTABcastKeyParams,
+  WDI_SetSTAKeyRspCb          wdiSetSTABcastKeyRspCb,
+  void*                       pUserData
+);
+
+
+/**
+ @brief WDI_RemoveSTABcastKeyReq will be called when the upper 
+        MAC to uninstall a STA Bcast key from HW. Upon the call
+        of this API the WLAN DAL will pack and send a HAL Remove
+        STA Bcast Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTABcastKeyReq must have been called.
+
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
+                      parameters as specified by the Device
+                      Interface
+  
+        wdiRemoveSTABcastKeyRspCb: callback for passing back the
+        response of the remove STA Bcast key operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetSTABcastKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveSTABcastKeyReq
+(
+  WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTABcastKeyParams,
+  WDI_RemoveSTAKeyRspCb          wdiRemoveSTABcastKeyRspCb,
+  void*                          pUserData
+);
+
+/**
+ @brief WDI_SetMaxTxPowerReq will be called when the upper 
+        MAC wants to set Max Tx Power to HW. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Remove STA Bcast Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTABcastKeyReq must have been called.
+
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
+                      parameters as specified by the Device
+                      Interface
+  
+        wdiRemoveSTABcastKeyRspCb: callback for passing back the
+        response of the remove STA Bcast key operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetMaxTxPowerReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetMaxTxPowerReq
+(
+  WDI_SetMaxTxPowerParamsType*   pwdiSetMaxTxPowerParams,
+  WDA_SetMaxTxPowerRspCb         wdiReqStatusCb,
+  void*                          pUserData
+);
+
+#ifdef FEATURE_WLAN_CCX
+/**
+ @brief WDI_TSMStatsReq will be called by the upper MAC to fetch 
+        Traffic Stream metrics. 
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ @param wdiAddTsReqParams: the add TS parameters as specified by
+                      the Device Interface
+  
+        wdiAddTsRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_TSMStatsReq
+(
+  WDI_TSMStatsReqParamsType* pwdiTsmStatsReqParams,
+  WDI_TsmRspCb          wdiTsmStatsRspCb,
+  void*                   pUserData
+);
+
+
+#endif
+
+/*======================================================================== 
+ 
+                            QoS and BA APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_AddTSReq will be called when the upper MAC to inform
+        the device of a successful add TSpec negotiation. HW
+        needs to receive the TSpec Info from the UMAC in order
+        to configure properly the QoS data traffic. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Add TS request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddTsReqParams: the add TS parameters as specified by
+                      the Device Interface
+  
+        wdiAddTsRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddTSReq
+(
+  WDI_AddTSReqParamsType* pwdiAddTsReqParams,
+  WDI_AddTsRspCb          wdiAddTsRspCb,
+  void*                   pUserData
+);
+
+
+
+/**
+ @brief WDI_DelTSReq will be called when the upper MAC has ended
+        admission on a specific AC. This is to inform HW that
+        QoS traffic parameters must be rest. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Del TS
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_AddTSReq must have been called.
+
+ @param wdiDelTsReqParams: the del TS parameters as specified by
+                      the Device Interface
+  
+        wdiDelTsRspCb: callback for passing back the response of
+        the del TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddTSReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelTSReq
+(
+  WDI_DelTSReqParamsType* pwdiDelTsReqParams,
+  WDI_DelTsRspCb          wdiDelTsRspCb,
+  void*                   pUserData
+);
+
+
+
+/**
+ @brief WDI_UpdateEDCAParams will be called when the upper MAC 
+        wishes to update the EDCA parameters used by HW for QoS
+        data traffic. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Update EDCA Params request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiUpdateEDCAParams: the start parameters as specified 
+                      by the Device Interface
+  
+        wdiUpdateEDCAParamsRspCb: callback for passing back the
+        response of the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateEDCAParams
+(
+  WDI_UpdateEDCAParamsType*    pwdiUpdateEDCAParams,
+  WDI_UpdateEDCAParamsRspCb    wdiUpdateEDCAParamsRspCb,
+  void*                        pUserData
+);
+
+
+
+/**
+ @brief WDI_AddBASessionReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddBASessionReq
+(
+  WDI_AddBASessionReqParamsType* pwdiAddBASessionReqParams,
+  WDI_AddBASessionRspCb          wdiAddBASessionRspCb,
+  void*                          pUserData
+);
+
+
+/**
+ @brief WDI_DelBAReq will be called when the upper MAC wants to 
+        inform HW that it has deleted a previously created BA
+        session. Upon the call of this API the WLAN DAL will
+        pack and send a HAL Del BA request message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_AddBAReq must have been called.
+
+ @param wdiDelBAReqParams: the del BA parameters as specified by
+                      the Device Interface
+  
+        wdiDelBARspCb: callback for passing back the response of
+        the del BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelBAReq
+(
+  WDI_DelBAReqParamsType* pwdiDelBAReqParams,
+  WDI_DelBARspCb          wdiDelBARspCb,
+  void*                   pUserData
+);
+
+/**
+ @brief WDI_UpdateBeaconParamsReq will be called when the upper MAC wants to 
+        inform HW that there is a change in the beacon parameters
+         Upon the call of this API the WLAN DAL will
+        pack and send a UpdateBeacon Params message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_UpdateBeaconParamsReq must have been called.
+
+ @param WDI_UpdateBeaconParamsType: the Update Beacon parameters as specified by
+                      the Device Interface
+  
+        WDI_UpdateBeaconParamsRspCb: callback for passing back the response of
+        the Update Beacon Params operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+
+WDI_Status 
+WDI_UpdateBeaconParamsReq
+(
+  WDI_UpdateBeaconParamsType *   pwdiUpdateBeaconParams,
+  WDI_UpdateBeaconParamsRspCb    wdiUpdateBeaconParamsRspCb,
+  void*                          pUserData
+);
+
+
+/**
+ @brief WDI_SendBeaconParamsReq will be called when the upper MAC wants to 
+        update the beacon template to be transmitted as BT MAP STA/IBSS/Soft AP
+         Upon the call of this API the WLAN DAL will
+        pack and send the beacon Template  message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SendBeaconParamsReq must have been called.
+
+ @param WDI_SendBeaconParamsType: the Update Beacon parameters as specified by
+                      the Device Interface
+  
+        WDI_SendBeaconParamsRspCb: callback for passing back the response of
+        the Send Beacon Params operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+
+WDI_Status 
+WDI_SendBeaconParamsReq
+(
+  WDI_SendBeaconParamsType*    pwdiSendBeaconParams,
+  WDI_SendBeaconParamsRspCb    wdiSendBeaconParamsRspCb,
+  void*                        pUserData
+);
+
+
+/**
+ @brief WDI_UpdateProbeRspTemplateReq will be called when the 
+        upper MAC wants to update the probe response template to
+        be transmitted as Soft AP
+         Upon the call of this API the WLAN DAL will
+        pack and send the probe rsp template  message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
+                      specified by the Device Interface
+  
+        wdiSendBeaconParamsRspCb: callback for passing back the
+        response of the Send Beacon Params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+
+WDI_Status 
+WDI_UpdateProbeRspTemplateReq
+(
+  WDI_UpdateProbeRspTemplateParamsType*    pwdiUpdateProbeRspParams,
+  WDI_UpdateProbeRspTemplateRspCb          wdiSendBeaconParamsRspCb,
+  void*                                  pUserData
+);
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ @brief WDI_SetP2PGONOAReq will be called when the 
+        upper MAC wants to send Notice of Absence
+         Upon the call of this API the WLAN DAL will
+        pack and send the probe rsp template  message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
+                      specified by the Device Interface
+  
+        wdiSendBeaconParamsRspCb: callback for passing back the
+        response of the Send Beacon Params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetP2PGONOAReq
+(
+  WDI_SetP2PGONOAReqParamsType*    pwdiP2PGONOAReqParams,
+  WDI_SetP2PGONOAReqParamsRspCb    wdiP2PGONOAReqParamsRspCb,
+  void*                            pUserData
+);
+#endif
+
+
+/*======================================================================== 
+ 
+                            Power Save APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_SetPwrSaveCfgReq will be called when the upper MAC 
+        wants to set the power save related configurations of
+        the WLAN Device. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Update CFG request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param pwdiPowerSaveCfg: the power save cfg parameters as 
+                      specified by the Device Interface
+  
+        wdiSetPwrSaveCfgCb: callback for passing back the
+        response of the set power save cfg operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call  
+*/ 
+WDI_Status 
+WDI_SetPwrSaveCfgReq
+(
+  WDI_UpdateCfgReqParamsType*   pwdiPowerSaveCfg,
+  WDI_SetPwrSaveCfgCb     wdiSetPwrSaveCfgCb,
+  void*                   pUserData
+);
+
+/**
+ @brief WDI_EnterImpsReq will be called when the upper MAC to 
+        request the device to get into IMPS power state. Upon
+        the call of this API the WLAN DAL will send a HAL Enter
+        IMPS request message to the lower RIVA sub-system if DAL
+        is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param wdiEnterImpsRspCb: callback for passing back the 
+        response of the Enter IMPS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterImpsReq
+(
+   WDI_EnterImpsRspCb  wdiEnterImpsRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_ExitImpsReq will be called when the upper MAC to 
+        request the device to get out of IMPS power state. Upon
+        the call of this API the WLAN DAL will send a HAL Exit
+        IMPS request message to the lower RIVA sub-system if DAL
+        is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ 
+
+ @param wdiExitImpsRspCb: callback for passing back the response 
+        of the Exit IMPS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitImpsReq
+(
+   WDI_ExitImpsRspCb  wdiExitImpsRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_EnterBmpsReq will be called when the upper MAC to 
+        request the device to get into BMPS power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Enter BMPS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiEnterBmpsReqParams: the Enter BMPS parameters as 
+                      specified by the Device Interface
+  
+        wdiEnterBmpsRspCb: callback for passing back the
+        response of the Enter BMPS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterBmpsReq
+(
+   WDI_EnterBmpsReqParamsType *pwdiEnterBmpsReqParams,
+   WDI_EnterBmpsRspCb  wdiEnterBmpsRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_ExitBmpsReq will be called when the upper MAC to 
+        request the device to get out of BMPS power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Exit BMPS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiExitBmpsReqParams: the Exit BMPS parameters as 
+                      specified by the Device Interface
+  
+        wdiExitBmpsRspCb: callback for passing back the response
+        of the Exit BMPS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitBmpsReq
+(
+   WDI_ExitBmpsReqParamsType *pwdiExitBmpsReqParams,
+   WDI_ExitBmpsRspCb  wdiExitBmpsRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_EnterUapsdReq will be called when the upper MAC to 
+        request the device to get into UAPSD power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Enter UAPSD request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+ WDI_SetUapsdAcParamsReq must have been called.
+  
+ @param pwdiEnterUapsdReqParams: the Enter UAPSD parameters as 
+                      specified by the Device Interface
+  
+        wdiEnterUapsdRspCb: callback for passing back the
+        response of the Enter UAPSD operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq, WDI_SetUapsdAcParamsReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterUapsdReq
+(
+   WDI_EnterUapsdReqParamsType *pwdiEnterUapsdReqParams,
+   WDI_EnterUapsdRspCb  wdiEnterUapsdRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_ExitUapsdReq will be called when the upper MAC to 
+        request the device to get out of UAPSD power state. Upon
+        the call of this API the WLAN DAL will send a HAL Exit
+        UAPSD request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiExitUapsdRspCb: callback for passing back the 
+        response of the Exit UAPSD operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitUapsdReq
+(
+   WDI_ExitUapsdRspCb  wdiExitUapsdRspCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_UpdateUapsdParamsReq will be called when the upper 
+        MAC wants to set the UAPSD related configurations
+        of an associated STA (while acting as an AP) to the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Update UAPSD params request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_ConfigBSSReq must have been called.
+
+ @param pwdiUpdateUapsdReqParams: the UAPSD parameters 
+                      as specified by the Device Interface
+  
+        wdiUpdateUapsdParamsCb: callback for passing back the
+        response of the update UAPSD params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_ConfigBSSReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateUapsdParamsReq
+(
+   WDI_UpdateUapsdReqParamsType *pwdiUpdateUapsdReqParams,
+   WDI_UpdateUapsdParamsCb  wdiUpdateUapsdParamsCb,
+   void*                   pUserData
+);
+
+/**
+ @brief WDI_SetUapsdAcParamsReq will be called when the upper 
+        MAC wants to set the UAPSD related configurations before
+        requesting for enter UAPSD power state to the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Set UAPSD params request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiUapsdInfo: the UAPSD parameters as specified by
+                      the Device Interface
+  
+        wdiSetUapsdAcParamsCb: callback for passing back the
+        response of the set UAPSD params operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetUapsdAcParamsReq
+(
+  WDI_SetUapsdAcParamsReqParamsType*      pwdiPowerSaveCfg,
+  WDI_SetUapsdAcParamsCb  wdiSetUapsdAcParamsCb,
+  void*                   pUserData
+);
+
+/**
+ @brief WDI_ConfigureRxpFilterReq will be called when the upper 
+        MAC wants to set/reset the RXP filters for received pkts
+        (MC, BC etc.). Upon the call of this API the WLAN DAL will pack
+        and send a HAL configure RXP filter request message to
+        the lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiConfigureRxpFilterReqParams: the RXP 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiConfigureRxpFilterCb: callback for passing back the
+        response of the configure RXP filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigureRxpFilterReq
+(
+   WDI_ConfigureRxpFilterReqParamsType *pwdiConfigureRxpFilterReqParams,
+   WDI_ConfigureRxpFilterCb             wdiConfigureRxpFilterCb,
+   void*                                pUserData
+);
+
+/**
+ @brief WDI_SetBeaconFilterReq will be called when the upper MAC
+        wants to set the beacon filters while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a Beacon filter request message to the
+        lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiBeaconFilterCb: callback for passing back the
+        response of the set beacon filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetBeaconFilterReq
+(
+   WDI_BeaconFilterReqParamsType   *pwdiBeaconFilterReqParams,
+   WDI_SetBeaconFilterCb            wdiBeaconFilterCb,
+   void*                            pUserData
+);
+
+/**
+ @brief WDI_RemBeaconFilterReq will be called when the upper MAC
+        wants to remove the beacon filter for perticular IE
+        while in power save. Upon the call of this API the WLAN
+        DAL will pack and send a remove Beacon filter request
+        message to the lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiBeaconFilterCb: callback for passing back the
+        response of the remove beacon filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemBeaconFilterReq
+(
+   WDI_RemBeaconFilterReqParamsType *pwdiBeaconFilterReqParams,
+   WDI_RemBeaconFilterCb             wdiBeaconFilterCb,
+   void*                             pUserData
+);
+
+/**
+ @brief WDI_SetRSSIThresholdsReq will be called when the upper 
+        MAC wants to set the RSSI thresholds related
+        configurations while in power save. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Set RSSI
+        thresholds request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiUapsdInfo: the UAPSD parameters as specified by
+                      the Device Interface
+  
+        wdiSetUapsdAcParamsCb: callback for passing back the
+        response of the set UAPSD params operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetRSSIThresholdsReq
+(
+  WDI_SetRSSIThresholdsReqParamsType*      pwdiRSSIThresholdsParams,
+  WDI_SetRSSIThresholdsCb                  wdiSetRSSIThresholdsCb,
+  void*                                    pUserData
+);
+
+/**
+ @brief WDI_HostOffloadReq will be called when the upper MAC 
+        wants to set the filter to minimize unnecessary host
+        wakeup due to broadcast traffic while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL host offload request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiHostOffloadParams: the host offload as specified 
+                      by the Device Interface
+  
+        wdiHostOffloadCb: callback for passing back the response
+        of the host offload operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_HostOffloadReq
+(
+  WDI_HostOffloadReqParamsType*      pwdiHostOffloadParams,
+  WDI_HostOffloadCb                  wdiHostOffloadCb,
+  void*                              pUserData
+);
+
+/**
+ @brief WDI_KeepAliveReq will be called when the upper MAC 
+        wants to set the filter to send NULL or unsolicited ARP responses 
+        and minimize unnecessary host wakeups due to while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Keep Alive request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiKeepAliveParams: the Keep Alive as specified 
+                      by the Device Interface
+  
+        wdiKeepAliveCb: callback for passing back the response
+        of the Keep Alive operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_KeepAliveReq
+(
+  WDI_KeepAliveReqParamsType*        pwdiKeepAliveParams,
+  WDI_KeepAliveCb                    wdiKeepAliveCb,
+  void*                              pUserData
+);
+
+/**
+ @brief WDI_WowlAddBcPtrnReq will be called when the upper MAC 
+        wants to set the Wowl Bcast ptrn to minimize unnecessary
+        host wakeup due to broadcast traffic while in power
+        save. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Wowl Bcast ptrn request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiWowlAddBcPtrnParams: the Wowl bcast ptrn as 
+                      specified by the Device Interface
+  
+        wdiWowlAddBcPtrnCb: callback for passing back the
+        response of the add Wowl bcast ptrn operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlAddBcPtrnReq
+(
+  WDI_WowlAddBcPtrnReqParamsType*    pwdiWowlAddBcPtrnParams,
+  WDI_WowlAddBcPtrnCb                wdiWowlAddBcPtrnCb,
+  void*                              pUserData
+);
+
+/**
+ @brief WDI_WowlDelBcPtrnReq will be called when the upper MAC 
+        wants to clear the Wowl Bcast ptrn. Upon the call of
+        this API the WLAN DAL will pack and send a HAL delete
+        Wowl Bcast ptrn request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_WowlAddBcPtrnReq must have been called.
+
+ @param pwdiWowlDelBcPtrnParams: the Wowl bcast ptrn as 
+                      specified by the Device Interface
+  
+        wdiWowlDelBcPtrnCb: callback for passing back the
+        response of the del Wowl bcast ptrn operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_WowlAddBcPtrnReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlDelBcPtrnReq
+(
+  WDI_WowlDelBcPtrnReqParamsType*    pwdiWowlDelBcPtrnParams,
+  WDI_WowlDelBcPtrnCb                wdiWowlDelBcPtrnCb,
+  void*                              pUserData
+);
+
+/**
+ @brief WDI_WowlEnterReq will be called when the upper MAC 
+        wants to enter the Wowl state to minimize unnecessary
+        host wakeup while in power save. Upon the call of this
+        API the WLAN DAL will pack and send a HAL Wowl enter
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiWowlEnterReqParams: the Wowl enter info as 
+                      specified by the Device Interface
+  
+        wdiWowlEnterReqCb: callback for passing back the
+        response of the enter Wowl operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlEnterReq
+(
+  WDI_WowlEnterReqParamsType*    pwdiWowlEnterParams,
+  WDI_WowlEnterReqCb             wdiWowlEnterCb,
+  void*                          pUserData
+);
+
+/**
+ @brief WDI_WowlExitReq will be called when the upper MAC 
+        wants to exit the Wowl state. Upon the call of this API
+        the WLAN DAL will pack and send a HAL Wowl exit request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_WowlEnterReq must have been called.
+
+ @param pwdiWowlExitReqParams: the Wowl exit info as 
+                      specified by the Device Interface
+  
+        wdiWowlExitReqCb: callback for passing back the response
+        of the exit Wowl operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_WowlEnterReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlExitReq
+(
+  WDI_WowlExitReqCb              wdiWowlExitCb,
+  void*                          pUserData
+);
+
+/**
+ @brief WDI_ConfigureAppsCpuWakeupStateReq will be called when 
+        the upper MAC wants to dynamically adjusts the listen
+        interval based on the WLAN/MSM activity. Upon the call
+        of this API the WLAN DAL will pack and send a HAL
+        configure Apps Cpu Wakeup State request message to the
+        lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiConfigureAppsCpuWakeupStateReqParams: the 
+                      Apps Cpu Wakeup State as specified by the
+                      Device Interface
+  
+        wdiConfigureAppsCpuWakeupStateCb: callback for passing
+        back the response of the configure Apps Cpu Wakeup State
+        operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigureAppsCpuWakeupStateReq
+(
+   WDI_ConfigureAppsCpuWakeupStateReqParamsType *pwdiConfigureAppsCpuWakeupStateReqParams,
+   WDI_ConfigureAppsCpuWakeupStateCb             wdiConfigureAppsCpuWakeupStateCb,
+   void*                                         pUserData
+);
+/**
+ @brief WDI_FlushAcReq will be called when the upper MAC wants 
+        to to perform a flush operation on a given AC. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Flush AC request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiFlushAcReqParams: the Flush AC parameters as 
+                      specified by the Device Interface
+  
+        wdiFlushAcRspCb: callback for passing back the response
+        of the Flush AC operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+ 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FlushAcReq
+(
+  WDI_FlushAcReqParamsType* pwdiFlushAcReqParams,
+  WDI_FlushAcRspCb          wdiFlushAcRspCb,
+  void*                     pUserData
+);
+
+/**
+ @brief WDI_BtAmpEventReq will be called when the upper MAC 
+        wants to notify the lower mac on a BT AMP event. This is
+        to inform BTC-SLM that some BT AMP event occurred. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL BT AMP event request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param wdiBtAmpEventReqParams: the BT AMP event parameters as 
+                      specified by the Device Interface
+  
+        wdiBtAmpEventRspCb: callback for passing back the
+        response of the BT AMP event operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+ 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_BtAmpEventReq
+(
+  WDI_BtAmpEventParamsType* pwdiBtAmpEventReqParams,
+  WDI_BtAmpEventRspCb       wdiBtAmpEventRspCb,
+  void*                     pUserData
+);
+
+
+/*======================================================================== 
+ 
+                             CONTROL APIs
+ 
+==========================================================================*/
+/**
+ @brief WDI_SwitchChReq will be called when the upper MAC wants 
+        the WLAN HW to change the current channel of operation.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiSwitchChReqParams: the switch ch parameters as 
+                      specified by the Device Interface
+  
+        wdiSwitchChRspCb: callback for passing back the response
+        of the switch ch operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SwitchChReq
+(
+  WDI_SwitchChReqParamsType* pwdiSwitchChReqParams,
+  WDI_SwitchChRspCb          wdiSwitchChRspCb,
+  void*                      pUserData
+);
+
+
+
+/**
+ @brief WDI_ConfigSTAReq will be called when the upper MAC 
+        wishes to add or update a STA in HW. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Start
+        message request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiConfigSTAReqParams: the config STA parameters as 
+                      specified by the Device Interface
+  
+        wdiConfigSTARspCb: callback for passing back the
+        response of the config STA operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigSTAReq
+(
+  WDI_ConfigSTAReqParamsType* pwdiConfigSTAReqParams,
+  WDI_ConfigSTARspCb          wdiConfigSTARspCb,
+  void*                       pUserData
+);
+
+/**
+ @brief WDI_SetLinkStateReq will be called when the upper MAC 
+        wants to change the state of an ongoing link. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Start message request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinReq must have been called.
+
+ @param wdiSetLinkStateReqParams: the set link state parameters 
+                      as specified by the Device Interface
+  
+        wdiSetLinkStateRspCb: callback for passing back the
+        response of the set link state operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinStartReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetLinkStateReq
+(
+  WDI_SetLinkReqParamsType* pwdiSetLinkStateReqParams,
+  WDI_SetLinkStateRspCb     wdiSetLinkStateRspCb,
+  void*                     pUserData
+);
+
+
+/**
+ @brief WDI_GetStatsReq will be called when the upper MAC wants 
+        to get statistics (MIB counters) from the device. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Start request message to the lower RIVA sub-system
+        if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiGetStatsReqParams: the stats parameters to get as 
+                      specified by the Device Interface
+  
+        wdiGetStatsRspCb: callback for passing back the response
+        of the get stats operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GetStatsReq
+(
+  WDI_GetStatsReqParamsType* pwdiGetStatsReqParams,
+  WDI_GetStatsRspCb          wdiGetStatsRspCb,
+  void*                      pUserData
+);
+
+
+/**
+ @brief WDI_UpdateCfgReq will be called when the upper MAC when 
+        it wishes to change the configuration of the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Update CFG request message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiUpdateCfgReqParams: the update cfg parameters as 
+                      specified by the Device Interface
+  
+        wdiUpdateCfgsRspCb: callback for passing back the
+        response of the update cfg operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateCfgReq
+(
+  WDI_UpdateCfgReqParamsType* pwdiUpdateCfgReqParams,
+  WDI_UpdateCfgRspCb          wdiUpdateCfgsRspCb,
+  void*                       pUserData
+);
+
+/**
+ @brief WDI_NvDownloadReq will be called by the UMAC to dowload the NV blob
+ to the NV memory.
+
+    @param wdiNvDownloadReqParams: the NV Download parameters as specified by
+    the Device Interface
+   
+      wdiNvDownloadRspCb: callback for passing back the response of
+      the NV Download operation received from the device
+ 
+       pUserData: user data will be passed back with the
+       callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_NvDownloadReq
+(
+  WDI_NvDownloadReqParamsType* pwdiNvDownloadReqParams,
+  WDI_NvDownloadRspCb      wdiNvDownloadRspCb,
+   void*      pUserData
+);
+/**
+ @brief WDI_AddBAReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddBAReq
+(
+  WDI_AddBAReqParamsType* pwdiAddBAReqParams,
+  WDI_AddBARspCb          wdiAddBARspCb,
+  void*                   pUserData
+);
+
+/**
+ @brief WDI_TriggerBAReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_TriggerBAReq
+(
+  WDI_TriggerBAReqParamsType* pwdiTriggerBAReqParams,
+  WDI_TriggerBARspCb          wdiTriggerBARspCb,
+  void*                       pUserData
+);
+
+
+/**
+ @brief WDI_IsHwFrameTxTranslationCapable checks to see if HW 
+        frame xtl is enabled for a particular STA.
+
+ WDI_PostAssocReq must have been called.
+
+ @param uSTAIdx: STA index 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+wpt_boolean WDI_IsHwFrameTxTranslationCapable
+(
+  wpt_uint8 uSTAIdx
+);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/**
+ @brief WDI_AggrAddTSReq will be called when the upper MAC to inform
+        the device of a successful add TSpec negotiation for 11r. HW
+        needs to receive the TSpec Info from the UMAC in order
+        to configure properly the QoS data traffic. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Aggregated Add TS request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAggrAddTsReqParams: the add TS parameters as specified by
+                               the Device Interface
+  
+        wdiAggrAddTsRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AggrAddTSReq
+(
+  WDI_AggrAddTSReqParamsType* pwdiAddTsReqParams,
+  WDI_AggrAddTsRspCb          wdiAggrAddTsRspCb,
+  void*                   pUserData
+);
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+/**
+ @brief WDI_STATableInit - Initializes the STA tables. 
+        Allocates the necesary memory.
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+
+WDI_Status WDI_StubRunTest
+(
+   wpt_uint8   ucTestNo
+);
+
+#ifdef ANI_MANF_DIAG
+/**
+ @brief WDI_FTMCommandReq -  
+        Route FTMRequest Command to HAL
+ 
+ @param  ftmCommandReq:         FTM request command body 
+ @param  ftmCommandRspCb:       Response CB
+ @param  pUserData:             User data will be included with CB
+
+ @return Result of the function call
+*/
+WDI_Status WDI_FTMCommandReq
+(
+  WDI_FTMCommandReqType *ftmCommandReq,
+  WDI_FTMCommandRspCb    ftmCommandRspCb,
+  void                  *pUserData
+);
+#endif /* ANI_MANF_DIAG */
+
+/**
+ @brief WDI_HostResumeReq will be called 
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiResumeReqParams:  as specified by
+                      the Device Interface
+  
+        wdiResumeReqRspCb: callback for passing back the response of
+        the Resume Req received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_HostResumeReq
+(
+  WDI_ResumeParamsType*            pwdiResumeReqParams,
+  WDI_HostResumeEventRspCb         wdiResumeReqRspCb,
+  void*                            pUserData
+);
+
+/**
+ @brief WDI_GetAvailableResCount - Function to get the available resource
+        for data and managemnt frames. 
+        
+ @param  pContext:         pointer to the WDI context 
+ @param  wdiResPool:       type of resource pool requesting
+ @see
+ @return Result of the function call
+*/
+
+wpt_uint32 WDI_GetAvailableResCount
+(
+  void            *pContext,
+  WDI_ResPoolType wdiResPool
+);
+
+/**
+ @brief WDI_SetAddSTASelfReq will be called when the
+        UMAC wanted to add self STA while opening any new session
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state.
+
+
+ @param pwdiAddSTASelfParams: the add self sta parameters as
+                      specified by the Device Interface
+
+        pUserData: user data will be passed back with the
+        callback
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_AddSTASelfReq
+(
+  WDI_AddSTASelfReqParamsType*    pwdiAddSTASelfReqParams,
+  WDI_AddSTASelfParamsRspCb       wdiAddSTASelfReqParamsRspCb,
+  void*                           pUserData
+);
+
+
+/**
+ @brief WDI_DelSTASelfReq will be called .
+
+ @param WDI_DelSTASelfReqParamsType
+  
+        WDI_DelSTASelfRspCb: callback for passing back the
+        response of the del sta self  operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelSTASelfReq
+(
+  WDI_DelSTASelfReqParamsType*    pwdiDelStaSelfParams,
+  WDI_DelSTASelfRspCb             wdiDelStaSelfRspCb,
+  void*                           pUserData
+);
+
+/**
+ @brief WDI_HostSuspendInd 
+  
+        Suspend Indication from the upper layer will be sent
+        down to HAL
+  
+ @param WDI_SuspendParamsType
+ 
+ @see 
+  
+ @return Status of the request
+*/
+WDI_Status 
+WDI_HostSuspendInd
+(
+  WDI_SuspendParamsType*    pwdiSuspendIndParams
+);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/**
+ @brief WDI_SetPreferredNetworkList
+
+ @param pwdiPNOScanReqParams: the Set PNO as specified 
+                      by the Device Interface
+  
+        wdiPNOScanCb: callback for passing back the response
+        of the Set PNO operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetPreferredNetworkReq
+(
+  WDI_PNOScanReqParamsType* pwdiPNOScanReqParams,
+  WDI_PNOScanCb             wdiPNOScanCb,
+  void*                      pUserData
+);
+
+/**
+ @brief WDI_SetRssiFilterReq
+
+ @param pwdiRssiFilterReqParams: the Set RSSI Filter as 
+                      specified by the Device Interface
+  
+        wdiRssiFilterCb: callback for passing back the response
+        of the Set RSSI Filter operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetRssiFilterReq
+(
+  WDI_SetRssiFilterReqParamsType* pwdiRssiFilterReqParams,
+  WDI_RssiFilterCb                wdiRssiFilterCb,
+  void*                           pUserData
+);
+
+/**
+ @brief WDI_UpdateScanParams
+
+ @param pwdiUpdateScanParamsInfoType: the Update Scan Params as specified 
+                      by the Device Interface
+  
+        wdiUpdateScanParamsCb: callback for passing back the response
+        of the Set PNO operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateScanParamsReq
+(
+  WDI_UpdateScanParamsInfoType* pwdiUpdateScanParamsInfoType,
+  WDI_UpdateScanParamsCb        wdiUpdateScanParamsCb,
+  void*                         pUserData
+);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+/**
+ @brief WDI_SetTxPerTrackingReq will be called when the upper MAC 
+        wants to set the Tx Per Tracking configurations. 
+        Upon the call of this API the WLAN DAL will pack
+        and send a HAL Set Tx Per Tracking request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ @param wdiSetTxPerTrackingConf: the Set Tx PER Tracking configurations as 
+                      specified by the Device Interface
+  
+        wdiSetTxPerTrackingCb: callback for passing back the
+        response of the set Tx PER Tracking configurations operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetTxPerTrackingReq
+(
+  WDI_SetTxPerTrackingReqParamsType*      pwdiSetTxPerTrackingReqParams,
+  WDI_SetTxPerTrackingRspCb               pwdiSetTxPerTrackingRspCb,
+  void*                                   pUserData
+);
+
+/**
+ @brief WDI_SetTmLevelReq
+        If HW Thermal condition changed, driver should react based on new 
+        HW thermal condition.
+
+ @param pwdiSetTmLevelReq: New thermal condition information
+  
+        pwdiSetTmLevelRspCb: callback
+  
+        usrData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetTmLevelReq
+(
+   WDI_SetTmLevelReqType        *pwdiSetTmLevelReq,
+   WDI_SetTmLevelCb              pwdiSetTmLevelRspCb,
+   void                         *usrData  
+);
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/**
+ @brief WDI_8023MulticastListReq
+
+ @param pwdiRcvFltPktSetMcListReqInfo: the Set 8023 Multicast 
+        List as specified by the Device Interface
+  
+        wdi8023MulticastListCallback: callback for passing back
+        the response of the Set 8023 Multicast List operation
+        received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_8023MulticastListReq
+(
+  WDI_RcvFltPktSetMcListReqParamsType*  pwdiRcvFltPktSetMcListReqInfo,
+  WDI_8023MulticastListCb               wdi8023MulticastListCallback,
+  void*                                 pUserData
+);
+
+/**
+ @brief WDI_ReceiveFilterSetFilterReq
+
+ @param pwdiSetRcvPktFilterReqInfo: the Set Receive Filter as 
+        specified by the Device Interface
+  
+        wdiReceiveFilterSetFilterReqCallback: callback for
+        passing back the response of the Set Receive Filter
+        operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ReceiveFilterSetFilterReq
+(
+  WDI_SetRcvPktFilterReqParamsType* pwdiSetRcvPktFilterReqInfo,
+  WDI_ReceiveFilterSetFilterCb      wdiReceiveFilterSetFilterReqCallback,
+  void*                             pUserData
+);
+
+/**
+ @brief WDI_PCFilterMatchCountReq
+
+ @param pwdiRcvFltPktMatchCntReqInfo: get D0 PC Filter Match 
+                                    Count
+  
+        wdiPCFilterMatchCountCallback: callback for passing back
+        the response of the D0 PC Filter Match Count operation
+        received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FilterMatchCountReq
+(
+  WDI_RcvFltPktMatchCntReqParamsType* pwdiRcvFltPktMatchCntReqInfo,
+  WDI_FilterMatchCountCb              wdiFilterMatchCountCallback,
+  void*                               pUserData
+);
+
+/**
+ @brief WDI_ReceiveFilterClearFilterReq
+
+ @param pwdiRcvFltPktClearReqInfo: the Clear Filter as 
+                      specified by the Device Interface
+  
+        wdiReceiveFilterClearFilterCallback: callback for
+        passing back the response of the Clear Filter
+        operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ReceiveFilterClearFilterReq
+(
+  WDI_RcvFltPktClearReqParamsType*  pwdiRcvFltPktClearReqInfo,
+  WDI_ReceiveFilterClearFilterCb    wdiReceiveFilterClearFilterCallback,
+  void*                             pUserData
+);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+/**
+ @brief WDI_HALDumpCmdReq
+        Post HAL DUMP Command Event
+ 
+ @param  halDumpCmdReqParams:   Hal Dump Command Body 
+ @param  halDumpCmdRspCb:         callback for passing back the
+                                                 response 
+ @param  pUserData:       Client Data
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_HALDumpCmdReq(
+  WDI_HALDumpCmdReqParamsType *halDumpCmdReqParams,
+  WDI_HALDumpCmdRspCb    halDumpCmdRspCb,
+  void                  *pUserData
+);
+
+
+/**
+ @brief WDI_SetPowerParamsReq
+
+ @param pwdiPowerParamsReqParams: the Set Power Params as 
+                      specified by the Device Interface
+  
+        wdiPowerParamsCb: callback for passing back the response
+        of the Set Power Params operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetPowerParamsReq
+(
+  WDI_SetPowerParamsReqParamsType* pwdiPowerParamsReqParams,
+  WDI_SetPowerParamsCb             wdiPowerParamsCb,
+  void*                            pUserData
+);
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/**
+ @brief WDI_GTKOffloadReq will be called when the upper MAC 
+        wants to set GTK Rekey Counter while in power save. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL GTK offload request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiGtkOffloadParams: the GTK offload as specified 
+                      by the Device Interface
+  
+        wdiGtkOffloadCb: callback for passing back the response
+        of the GTK offload operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GTKOffloadReq
+(
+  WDI_GtkOffloadReqMsg*      pwdiGtkOffloadReqMsg,
+  WDI_GtkOffloadCb           wdiGtkOffloadCb,
+  void*                      pUserData
+);
+
+/**
+ @brief WDI_GTKOffloadGetInfoReq will be called when the upper 
+          MAC wants to get GTK Rekey Counter while in power save.
+          Upon the call of this API the WLAN DAL will pack and
+          send a HAL GTK offload request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiGtkOffloadGetInfoReqMsg: the GTK Offload 
+                        Information Message as specified by the
+                        Device Interface
+  
+          wdiGtkOffloadGetInfoCb: callback for passing back the
+          response of the GTK offload operation received from the
+          device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GTKOffloadGetInfoReq
+(
+  WDI_GtkOffloadGetInfoReqMsg*  pwdiGtkOffloadGetInfoReqMsg,
+  WDI_GtkOffloadGetInfoCb       wdiGtkOffloadGetInfoCb,
+  void*                          pUserData
+);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+/**
+ @brief WDI_featureCapsExchangeReq
+        Post feature capability bitmap exchange event.
+        Host will send its own capability to FW in this req and 
+        expect FW to send its capability back as a bitmap in Response
+ 
+ @param 
+  
+        wdiFeatCapsExcRspCb: callback called on getting the response.
+        It is kept to mantain similarity between WDI reqs and if needed, can
+        be used in future. Currently, It is set to NULL
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_featureCapsExchangeReq
+(
+  WDI_featureCapsExchangeCb     wdiFeatureCapsExchangeCb,
+  void*                         pUserData
+);
+
+/**
+ @brief WDI_getHostWlanFeatCaps
+        WDI API that returns whether the feature passed to it as enum value in
+        "placeHolderInCapBitmap" is supported by Host or not. It uses WDI global
+        variable storing host capability bitmap to find this. This can be used by
+        other moduels to decide certain things like call different APIs based on
+        whether a particular feature is supported.
+ 
+ @param 
+  
+        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap in wlan_hal_msg.h.
+
+ @see
+ @return 
+        0 - if the feature is NOT supported in host
+        any non-zero value - if the feature is SUPPORTED in host.
+*/
+wpt_uint8 WDI_getHostWlanFeatCaps(wpt_uint8 feat_enum_value);
+
+/**
+ @brief WDI_getFwWlanFeatCaps
+        WDI API that returns whether the feature passed to it as enum value in
+        "placeHolderInCapBitmap" is supported by FW or not. It uses WDI global
+        variable storing host capability bitmap to find this. This can be used by
+        other moduels to decide certain things like call different APIs based on
+        whether a particular feature is supported.
+ 
+ @param 
+  
+        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap
+                                    in wlan_hal_msg.h.
+
+ @see
+ @return 
+        0 - if the feature is NOT supported in FW
+        any non-zero value - if the feature is SUPPORTED in FW.
+*/
+wpt_uint8 WDI_getFwWlanFeatCaps(wpt_uint8 feat_enum_value);
+
+/**
+ @brief WDI_GetWcnssCompiledApiVersion - Function to get wcnss compiled  
+        api version 
+        
+ @param  WDI_WlanVersionType: Wlan version structure 
+ @see
+ @return none
+*/
+
+void WDI_GetWcnssCompiledApiVersion
+(
+  WDI_WlanVersionType     *pWcnssApiVersion
+);
+
+
+
+#ifdef __cplusplus
+ }
+#endif 
+
+
+#endif /* #ifndef WLAN_QCT_WDI_H */
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h b/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
new file mode 100644
index 0000000..8c91bb6
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
@@ -0,0 +1,1108 @@
+/*
+ * 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 WLAN_QCT_WDI_BD_H
+#define WLAN_QCT_WDI_BD_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+              I N T E R N A L     A P I       F O R    T H E
+                B D   H E A D E R   D E F I N I T I O N 
+                
+                   
+DESCRIPTION
+  This file contains the internal BD definition exposed by the DAL Control       
+  Path Core module to be used by the DAL Data Path Core. 
+  
+      
+  Copyright (c) 2010 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
+--------    ---    ----------------------------------------------------------
+08/19/10    lti     Created module.
+
+===========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+
+
+/*=========================================================================         
+     BD STRUCTURE Defines  
+ =========================================================================*/
+/*---------------------------------------------------------------------------         
+  WDI_RxBdType - The format of the RX BD 
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+        /* 0x00 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** (Only used by the DPU)
+        This routing flag indicates the WQ number to which the DPU will push the
+        frame after it finished processing it. */
+        wpt_uint32 dpuRF:8;
+    
+        /** This is DPU sig inserted by RXP. Signature on RA's DPU descriptor */
+        wpt_uint32 dpuSignature:3;
+    
+        /** When set Sta is authenticated. SW needs to set bit
+        addr2_auth_extract_enable in rxp_config2 register. Then RXP will use bit 3
+        in DPU sig to say whether STA is authenticated or not. In this case only
+        lower 2bits of DPU Sig is valid */
+        wpt_uint32 stAuF:1;
+    
+        /** When set address2 is not valid */
+        wpt_uint32 A2HF:1;
+    
+        /** When set it indicates TPE has sent the Beacon frame */
+        wpt_uint32 bsf:1;
+    
+        /** This bit filled by rxp when set indicates if the current tsf is smaller
+        than received tsf */
+        wpt_uint32 rtsf:1;
+    
+        /** These two fields are used by SW to carry the Rx Channel number and SCAN bit in RxBD*/
+        wpt_uint32 rxChannel:4;
+        wpt_uint32 scanLearn:1;
+
+        wpt_uint32 reserved0:1;
+    
+        /** LLC Removed
+        This bit is only used in Libra rsvd for Virgo1.0/Virgo2.0
+        Filled by ADU when it is set LLC is removed from packet */
+        wpt_uint32 llcr:1;
+        
+        wpt_uint32 umaByPass:1;
+    
+        /** This bit is only available in Virgo2.0/libra it is reserved in Virgo1.0
+        Robust Management frame. This bit indicates to DPU that the packet is a
+        robust management frame which requires decryption(this bit is only valid for
+        management unicast encrypted frames)
+        1 - Needs decryption
+        0 - No decryption required */
+        wpt_uint32 rmf:1;
+    
+        /** 
+        This bit is only in Virgo2.0/libra it is reserved in Virgo 1.0
+        This 1-bit field indicates to DPU Unicast/BC/MC packet
+        0 - Unicast packet
+        1 - Broadcast/Multicast packet
+        This bit is only valid when RMF bit is 1 */
+        wpt_uint32 ub:1;
+    
+        /** This is the KEY ID extracted from WEP packets and is used for determine
+        the RX Key Index to use in the DPU Descriptror.
+        This field  is 2bits for virgo 1.0
+        And 3 bits in virgo2.0 and Libra
+        In virgo2.0/libra it is 3bits for the BC/MC packets */
+        wpt_uint32 rxKeyId:3;
+        
+        /**  (Only used by the DPU)    
+        No encryption/decryption
+        0: No action
+        1: DPU will not encrypt/decrypt the frame, and discard any encryption
+        related settings in the PDU descriptor. */
+        wpt_uint32 dpuNE:1;
+    
+        /** 
+        This is only available in libra/virgo2.0  it is reserved for virgo1.0
+        This bit is filled by RXP and modified by ADU
+        This bit indicates to ADU/UMA module that the packet requires 802.11n to
+        802.3 frame translation. Once ADU/UMA is done with translation they
+        overwrite it with 1'b0/1'b1 depending on how the translation resulted
+        When used by ADU 
+        0 - No frame translation required
+        1 - Frame Translation required
+        When used by SW
+        0 - Frame translation not done, MPDU header offset points to 802.11 header..
+        1 - Frame translation done ;  hence MPDU header offset will point to a
+        802.3 header */
+        wpt_uint32 ft:1;
+    
+        /** (Only used by the DPU)
+        BD Type 
+        00: 'Generic BD', as indicted above
+        01: De-fragmentation format 
+        10-11: Reserved for future use. */
+        wpt_uint32 bdt:2;
+        
+#else
+        wpt_uint32 bdt:2;
+        wpt_uint32 ft:1;
+        wpt_uint32 dpuNE:1;
+        wpt_uint32 rxKeyId:3;
+        wpt_uint32 ub:1;
+        wpt_uint32 rmf:1;
+        wpt_uint32 reserved1:1;
+        wpt_uint32 llc:1;
+        wpt_uint32 reserved0:1;
+        wpt_uint32 scanLearn:1;
+        wpt_uint32 rxChannel:4;
+        wpt_uint32 rtsf:1;
+        wpt_uint32 bsf:1;
+        wpt_uint32 A2HF:1;
+        wpt_uint32 stAuF:1;
+        wpt_uint32 dpuSignature:3;
+        wpt_uint32 dpuRF:8;
+#endif
+    
+        /* 0x04 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** This is used for AMSDU this is the PDU index of the PDU which is the
+        one before last PDU; for all non AMSDU frames, this field SHALL be 0.
+        Used in ADU (for AMSDU deaggregation) */
+        wpt_uint32 penultimatePduIdx:16;
+    
+        wpt_uint32 aduFeedback:8;
+    
+        /** DPU feedback */
+        wpt_uint32 dpuFeedback:8;
+        
+#else
+        wpt_uint32 dpuFeedback:8;
+        wpt_uint32 aduFeedback:8;
+        wpt_uint32 penultimatePduIdx:16;
+#endif
+    
+        /* 0x08 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** In case PDUs are linked to the BD, this field indicates the index of
+        the first PDU linked to the BD. When PDU count is zero, this field has an
+        undefined value. */
+        wpt_uint32 headPduIdx:16;
+    
+        /** In case PDUs are linked to the BD, this field indicates the index of
+        the last PDU. When PDU count is zero, this field has an undefined value.*/
+        wpt_uint32 tailPduIdx:16;
+        
+#else
+        wpt_uint32 tailPduIdx:16;
+        wpt_uint32 headPduIdx:16;
+#endif
+    
+        /* 0x0c */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** The length (in number of bytes) of the MPDU header. 
+        Limitation: The MPDU header offset + MPDU header length can never go beyond
+        the end of the first PDU */
+        wpt_uint32 mpduHeaderLength:8;
+    
+        /** The start byte number of the MPDU header. 
+        The byte numbering is done in the BE format. Word 0x0, bits [31:24] has
+        byte index 0. */
+        wpt_uint32 mpduHeaderOffset:8;
+    
+        /** The start byte number of the MPDU data. 
+        The byte numbering is done in the BE format. Word 0x0, bits [31:24] has
+        byte index 0. Note that this offset can point all the way into the first
+        linked PDU.
+        Limitation: MPDU DATA OFFSET can not point into the 2nd linked PDU */
+        wpt_uint32 mpduDataOffset:9;
+    
+        /** The number of PDUs linked to the BD. 
+        This field should always indicate the correct amount. */
+        wpt_uint32 pduCount:7;
+#else
+    
+        wpt_uint32 pduCount:7;
+        wpt_uint32 mpduDataOffset:9;
+        wpt_uint32 mpduHeaderOffset:8;
+        wpt_uint32 mpduHeaderLength:8;
+#endif
+    
+        /* 0x10 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** This is the length (in number of bytes) of the entire MPDU 
+        (header and data). Note that the length does not include FCS field. */
+        wpt_uint32 mpduLength:16;
+    
+        wpt_uint32 reserved3:4;
+    
+        /** Traffic Identifier
+        Indicates the traffic class the frame belongs to. For non QoS frames,
+        this field is set to zero. */
+        wpt_uint32 tid:4;
+        
+        wpt_uint32 reserved4:8;
+#else
+        wpt_uint32 reserved4:8;
+        wpt_uint32 tid:4;
+        wpt_uint32 reserved3:4;
+        wpt_uint32 mpduLength:16;
+#endif
+    
+        /* 0x14 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** (Only used by the DPU)
+        The DPU descriptor index is used to calculate where in memory the DPU can
+        find the DPU descriptor related to this frame. The DPU calculates the
+        address by multiplying this index with the DPU descriptor size and adding
+        the DPU descriptors base address. The DPU descriptor contains information
+        specifying the encryption and compression type and contains references to
+        where encryption keys can be found. */
+        wpt_uint32 dpuDescIdx:8;
+    
+        /** The result from the binary address search on the ADDR1 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr1Index:8;
+    
+        /** The result from the binary address search on the ADDR2 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr2Index:8;
+    
+        /** The result from the binary address search on the ADDR3 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr3Index:8;
+#else
+        wpt_uint32 addr3Index:8;
+        wpt_uint32 addr2Index:8;
+        wpt_uint32 addr1Index:8;
+        wpt_uint32 dpuDescIdx:8;
+#endif
+    
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** Indicates Rate Index of packet received  */
+        wpt_uint32 rateIndex:9;
+    
+        /** An overview of RXP status information related to receiving the frame.*/
+        wpt_uint32 rxpFlags:23; 
+    
+#else
+    
+        wpt_uint32 rxpFlags:23;                     /* RxP flags*/
+        wpt_uint32 rateIndex:9;
+    
+#endif
+        /* 0x1c, 20 */
+        /** The PHY can be programmed to put all the PHY STATS received from the
+        PHY when receiving a frame in the BD.  */
+        wpt_uint32 phyStats0;                      /* PHY status word 0*/
+        wpt_uint32 phyStats1;                      /* PHY status word 1*/
+    
+        /* 0x24 */
+        /** The value of the TSF[31:0] bits at the moment that the RXP start
+        receiving a frame from the PHY RX. */
+        wpt_uint32 mclkRxTimestamp;                /* Rx timestamp, microsecond based*/
+    
+        /* 0x28~0x38 */
+        /** The bits from the PMI command as received from the PHY RX. */
+        wpt_uint32 pmiCmd4to23[5];               /* PMI cmd rcvd from RxP */
+    
+        /* 0x3c */
+        /** The bits from the PMI command as received from the PHY RX. */
+        wpt_uint32 pmiCmd24to25;
+    
+        /* 0x40 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** Gives commands to software upon which host will perform some commands.
+        Please refer to following RPE document for description of all different
+        values for this field. */
+        wpt_uint32 reorderOpcode:4;
+    
+        wpt_uint32 reserved6:12;
+    
+        /** Filled by RPE to Indicate to the host up to which slot the host needs
+        to forward the packets to upper Mac layer. This field mostly used for AMDPU
+        packets */
+        wpt_uint32 reorderFwdIdx:6;
+    
+        /** Filled by RPE which indicates to the host which one of slots in the
+        available 64 slots should the host Queue the packet. This field only
+        applied to AMPDU packets. */
+        wpt_uint32 reorderSlotIdx:6;
+        
+        wpt_uint32 reserved7:4;
+#else
+        wpt_uint32 reserved7:4;
+        wpt_uint32 reorderSlotIdx:6;
+        wpt_uint32 reorderFwdIdx:6;
+        wpt_uint32 reserved6:12;
+        wpt_uint32 reorderOpcode:4;
+#endif
+    
+        /* 0x44 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** reserved8 from a hardware perspective.
+        Used by SW to propogate frame type/subtype information */
+        wpt_uint32 frameTypeSubtype:8;
+    
+        /** Filled RPE gives the current sequence number in bitmap */
+        wpt_uint32 currentPktSeqNo:12;
+    
+        /** Filled by RPE which gives the sequence number of next expected packet
+        in bitmap */
+        wpt_uint32 expectedPktSeqNo:12;
+#else
+        wpt_uint32 expectedPktSeqNo:12;
+        wpt_uint32 currentPktSeqNo:12;
+        wpt_uint32 frameTypeSubtype:8;
+#endif
+    
+        /* 0x48 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** When set it is the AMSDU subframe */
+        wpt_uint32 asf:1;
+    
+        /** When set it is the First subframe of the AMSDU packet */
+        wpt_uint32 esf:1;
+    
+        /** When set it is the last subframe of the AMSDU packet */
+        wpt_uint32 lsf:1;
+    
+        /** When set it indicates an Errored AMSDU packet */
+        wpt_uint32 aef:1;
+        
+        wpt_uint32 reserved9:4;
+    
+        /** It gives the order in which the AMSDU packet is processed
+        Basically this is a number which increments by one for every AMSDU frame
+        received. Mainly for debugging purpose. */
+        wpt_uint32 processOrder:4;
+    
+        /** It is the order of the subframe of AMSDU that is processed by ADU.
+        This is reset to 0 when ADU deaggregates the first subframe from a new
+        AMSDU and increments by 1 for every new subframe deaggregated within the
+        AMSDU, after it reaches 4'hf it stops incrementing. That means host should
+        not rely on this field as index for subframe queuing.  Theoretically there
+        can be way more than 16 subframes in an AMSDU. This is only used for debug
+        purpose, SW should use LSF and FSF bits to determine first and last
+        subframes. */
+        wpt_uint32 sybFrameIdx:4;
+    
+        /** Filled by ADU this is the total AMSDU size */
+        wpt_uint32 totalMsduSize:16;
+#else
+        wpt_uint32 totalMsduSize:16;
+        wpt_uint32 sybFrameIdx:4;
+        wpt_uint32 processOrder:4;
+        wpt_uint32 reserved9:4;
+        wpt_uint32 aef:1;
+        wpt_uint32 lsf:1;
+        wpt_uint32 esf:1;
+        wpt_uint32 asf:1;
+#endif
+
+} WDI_RxBdType;
+
+/*---------------------------------------------------------------------------         
+  WDI_RxFcBdType - The format of the RX special flow control BD 
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+        /* 0x00 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** (Only used by the DPU)
+        This routing flag indicates the WQ number to which the DPU will push the
+        frame after it finished processing it. */
+        wpt_uint32 dpuRF:8;
+    
+        /** This is DPU sig inserted by RXP. Signature on RA's DPU descriptor */
+        wpt_uint32 dpuSignature:3;
+    
+        /** When set Sta is authenticated. SW needs to set bit
+        addr2_auth_extract_enable in rxp_config2 register. Then RXP will use bit 3
+        in DPU sig to say whether STA is authenticated or not. In this case only
+        lower 2bits of DPU Sig is valid */
+        wpt_uint32 stAuF:1;
+    
+        /** When set address2 is not valid */
+        wpt_uint32 A2HF:1;
+    
+        /** When set it indicates TPE has sent the Beacon frame */
+        wpt_uint32 bsf:1;
+    
+        /** This bit filled by rxp when set indicates if the current tsf is smaller
+        than received tsf */
+        wpt_uint32 rtsf:1;
+    
+        /** These two fields are used by SW to carry the Rx Channel number and SCAN bit in RxBD*/
+        wpt_uint32 rxChannel:4;
+        wpt_uint32 scanLearn:1;
+
+        wpt_uint32 reserved0:1;
+    
+        /** LLC Removed
+        This bit is only used in Libra rsvd for Virgo1.0/Virgo2.0
+        Filled by ADU when it is set LLC is removed from packet */
+        wpt_uint32 llcr:1;
+        
+        wpt_uint32 umaByPass:1;
+    
+        /** This bit is only available in Virgo2.0/libra it is reserved in Virgo1.0
+        Robust Management frame. This bit indicates to DPU that the packet is a
+        robust management frame which requires decryption(this bit is only valid for
+        management unicast encrypted frames)
+        1 - Needs decryption
+        0 - No decryption required */
+        wpt_uint32 rmf:1;
+    
+        /** 
+        This bit is only in Virgo2.0/libra it is reserved in Virgo 1.0
+        This 1-bit field indicates to DPU Unicast/BC/MC packet
+        0 - Unicast packet
+        1 - Broadcast/Multicast packet
+        This bit is only valid when RMF bit is 1 */
+        wpt_uint32 ub:1;
+    
+        /** This is the KEY ID extracted from WEP packets and is used for determine
+        the RX Key Index to use in the DPU Descriptror.
+        This field  is 2bits for virgo 1.0
+        And 3 bits in virgo2.0 and Libra
+        In virgo2.0/libra it is 3bits for the BC/MC packets */
+        wpt_uint32 rxKeyId:3;
+        
+        /**  (Only used by the DPU)    
+        No encryption/decryption
+        0: No action
+        1: DPU will not encrypt/decrypt the frame, and discard any encryption
+        related settings in the PDU descriptor. */
+        wpt_uint32 dpuNE:1;
+    
+        /** 
+        This is only available in libra/virgo2.0  it is reserved for virgo1.0
+        This bit is filled by RXP and modified by ADU
+        This bit indicates to ADU/UMA module that the packet requires 802.11n to
+        802.3 frame translation. Once ADU/UMA is done with translation they
+        overwrite it with 1'b0/1'b1 depending on how the translation resulted
+        When used by ADU 
+        0 - No frame translation required
+        1 - Frame Translation required
+        When used by SW
+        0 - Frame translation not done, MPDU header offset points to 802.11 header..
+        1 - Frame translation done ;  hence MPDU header offset will point to a
+        802.3 header */
+        wpt_uint32 ft:1;
+    
+        /** (Only used by the DPU)
+        BD Type 
+        00: 'Generic BD', as indicted above
+        01: De-fragmentation format 
+        10-11: Reserved for future use. */
+        wpt_uint32 bdt:2;
+        
+#else
+        wpt_uint32 bdt:2;
+        wpt_uint32 ft:1;
+        wpt_uint32 dpuNE:1;
+        wpt_uint32 rxKeyId:3;
+        wpt_uint32 ub:1;
+        wpt_uint32 rmf:1;
+        wpt_uint32 reserved1:1;
+        wpt_uint32 llc:1;
+        wpt_uint32 reserved0:1;
+        wpt_uint32 scanLearn:1;
+        wpt_uint32 rxChannel:4;
+        wpt_uint32 rtsf:1;
+        wpt_uint32 bsf:1;
+        wpt_uint32 A2HF:1;
+        wpt_uint32 stAuF:1;
+        wpt_uint32 dpuSignature:3;
+        wpt_uint32 dpuRF:8;
+#endif
+    
+        /* 0x04 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** This is used for AMSDU this is the PDU index of the PDU which is the
+        one before last PDU; for all non AMSDU frames, this field SHALL be 0.
+        Used in ADU (for AMSDU deaggregation) */
+        wpt_uint32 penultimatePduIdx:16;
+    
+        wpt_uint32 aduFeedback:8;
+    
+        /** DPU feedback */
+        wpt_uint32 dpuFeedback:8;
+        
+#else
+        wpt_uint32 dpuFeedback:8;
+        wpt_uint32 aduFeedback:8;
+        wpt_uint32 penultimatePduIdx:16;
+#endif
+    
+        /* 0x08 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** In case PDUs are linked to the BD, this field indicates the index of
+        the first PDU linked to the BD. When PDU count is zero, this field has an
+        undefined value. */
+        wpt_uint32 headPduIdx:16;
+    
+        /** In case PDUs are linked to the BD, this field indicates the index of
+        the last PDU. When PDU count is zero, this field has an undefined value.*/
+        wpt_uint32 tailPduIdx:16;
+        
+#else
+        wpt_uint32 tailPduIdx:16;
+        wpt_uint32 headPduIdx:16;
+#endif
+    
+        /* 0x0c */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** The length (in number of bytes) of the MPDU header. 
+        Limitation: The MPDU header offset + MPDU header length can never go beyond
+        the end of the first PDU */
+        wpt_uint32 mpduHeaderLength:8;
+    
+        /** The start byte number of the MPDU header. 
+        The byte numbering is done in the BE format. Word 0x0, bits [31:24] has
+        byte index 0. */
+        wpt_uint32 mpduHeaderOffset:8;
+    
+        /** The start byte number of the MPDU data. 
+        The byte numbering is done in the BE format. Word 0x0, bits [31:24] has
+        byte index 0. Note that this offset can point all the way into the first
+        linked PDU.
+        Limitation: MPDU DATA OFFSET can not point into the 2nd linked PDU */
+        wpt_uint32 mpduDataOffset:9;
+    
+        /** The number of PDUs linked to the BD. 
+        This field should always indicate the correct amount. */
+        wpt_uint32 pduCount:7;
+#else
+    
+        wpt_uint32 pduCount:7;
+        wpt_uint32 mpduDataOffset:9;
+        wpt_uint32 mpduHeaderOffset:8;
+        wpt_uint32 mpduHeaderLength:8;
+#endif
+    
+        /* 0x10 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** This is the length (in number of bytes) of the entire MPDU 
+        (header and data). Note that the length does not include FCS field. */
+        wpt_uint32 mpduLength:16;
+    
+        wpt_uint32 reserved3:4;
+    
+        /** Traffic Identifier
+        Indicates the traffic class the frame belongs to. For non QoS frames,
+        this field is set to zero. */
+        wpt_uint32 tid:4;
+        
+        wpt_uint32 reserved4:7;
+        wpt_uint32 fc:1;        //if set then its special flow control BD.
+#else
+        wpt_uint32 fc:1;        //if set then its special flow control BD.
+        wpt_uint32 reserved4:7;
+        wpt_uint32 tid:4;
+        wpt_uint32 reserved3:4;
+        wpt_uint32 mpduLength:16;
+#endif
+    
+        /* 0x14 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** (Only used by the DPU)
+        The DPU descriptor index is used to calculate where in memory the DPU can
+        find the DPU descriptor related to this frame. The DPU calculates the
+        address by multiplying this index with the DPU descriptor size and adding
+        the DPU descriptors base address. The DPU descriptor contains information
+        specifying the encryption and compression type and contains references to
+        where encryption keys can be found. */
+        wpt_uint32 dpuDescIdx:8;
+    
+        /** The result from the binary address search on the ADDR1 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr1Index:8;
+    
+        /** The result from the binary address search on the ADDR2 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr2Index:8;
+    
+        /** The result from the binary address search on the ADDR3 of the incoming
+        frame. See chapter: RXP filter for encoding of this field. */
+        wpt_uint32 addr3Index:8;
+#else
+        wpt_uint32 addr3Index:8;
+        wpt_uint32 addr2Index:8;
+        wpt_uint32 addr1Index:8;
+        wpt_uint32 dpuDescIdx:8;
+#endif
+    
+#ifdef WPT_BIG_BYTE_ENDIAN
+    
+        /** Indicates Rate Index of packet received  */
+        wpt_uint32 rateIndex:9;
+    
+        /** An overview of RXP status information related to receiving the frame.*/
+        wpt_uint32 rxpFlags:23; 
+    
+#else
+    
+        wpt_uint32 rxpFlags:23;                     /* RxP flags*/
+        wpt_uint32 rateIndex:9;
+    
+#endif
+        /* 0x1c, 20 */
+        /** The PHY can be programmed to put all the PHY STATS received from the
+        PHY when receiving a frame in the BD.  */
+        wpt_uint32 phyStats0;                      /* PHY status word 0*/
+        wpt_uint32 phyStats1;                      /* PHY status word 1*/
+    
+        /* 0x24 */
+        /** The value of the TSF[31:0] bits at the moment that the RXP start
+        receiving a frame from the PHY RX. */
+        wpt_uint32 mclkRxTimestamp;                /* Rx timestamp, microsecond based*/
+    
+       /* 0x28 - 0x2c*/     
+#ifdef WPT_BIG_BYTE_ENDIAN  
+        /** One bit per STA. Bit X for STA id X, X=0~7. When set, corresponding STA is valid in FW's STA table.*/
+        wpt_uint32 fcSTAValidMask:16;
+        /** One bit per STA. Bit X for STA id X, X=0~7. Valid only when corresponding bit in fcSTAValisMask is set.*/
+        wpt_uint32 fcSTAPwrSaveStateMask:16;
+        /** One bit per STA. Bit X for STA id X, X=0~7. Valid only when corresponding bit in fcSTAValisMask is set. 
+        When set, corresponding fcSTAThreshEnableMask bit in previous flow control request packet frame was enabled 
+        AND the STA TxQ length is lower than configured fcSTAThresh<X> value. */        
+        wpt_uint32 fcSTAThreshIndMask:16;
+        /** Bit 0 unit: 1=BD count(Libra SoftAP project default). 0=packet count. Bit 7-1: Reserved */
+        wpt_uint32 fcSTATxQStatus:16;
+#else
+        wpt_uint32 fcSTATxQStatus:16;
+        wpt_uint32 fcSTAThreshIndMask:16;
+        wpt_uint32 fcSTAPwrSaveStateMask:16;
+        wpt_uint32 fcSTAValidMask:16;
+#endif
+        /* 0x30 */
+#ifdef WPT_BIG_BYTE_ENDIAN 
+        wpt_uint32 fcStaTxDisabledBitmap:16;
+        wpt_uint32 reserved5:16;
+#else   
+        wpt_uint32 reserved5:16;
+        wpt_uint32 fcStaTxDisabledBitmap:16;
+#endif
+        
+        // with HAL_NUM_STA as 12 
+        /* 0x34 to 0x3A*/
+        wpt_uint32  fcSTATxQLen[12];            // one byte per STA. 
+        wpt_uint32  fcSTACurTxRate[12];         // current Tx rate for each sta. 
+
+} WDI_FcRxBdType; //flow control BD
+
+/*---------------------------------------------------------------------------         
+  WDI_TxBdType - The format of the TX BD 
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+        /* 0x00 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** (Only used by the DPU) This routing flag indicates the WQ number to
+        which the DPU will push the frame after it finished processing it. */
+        wpt_uint32 dpuRF:8;
+    
+        /** DPU signature. Filled by Host in Virgo 1.0 but by ADU in Virgo 2.0 */
+        wpt_uint32 dpuSignature:3;
+    
+        wpt_uint32 reserved0:12;
+    
+        /** Only available in Virgo 2.0 and reserved in Virgo 1.0.
+        This bit indicates to DPU that the packet is a robust management frame
+        which requires  encryption(this bit is only valid for certain management
+        frames)
+        1 - Needs encryption
+        0 - No encrytion required
+        It is only set when Privacy bit=1 AND type/subtype=Deauth, Action,
+        Disassoc. Otherwise it should always be 0. */
+        wpt_uint32 rmf:1;
+    
+        /** This bit is only in Virgo2.0/libra it is reserved in Virgo 1.0
+        This 1-bit field indicates to DPU Unicast/BC/MC packet
+        0 - Unicast packet
+        1 - Broadcast/Multicast packet
+        This bit is valid only if RMF bit is set */
+        wpt_uint32 ub:1;
+    
+        wpt_uint32 reserved1:1;
+    
+        /**  This bit is only in Virgo2.0/libra it is reserved in Virgo 1.0
+        This bit indicates TPE has to assert the TX complete interrupt.
+        0 - no interrupt
+        1 - generate interrupt */
+        wpt_uint32 txComplete1:1;
+        wpt_uint32 fwTxComplete0:1;
+        
+        /** (Only used by the DPU)
+        No encryption/decryption
+        0: No action
+        1: DPU will not encrypt/decrypt the frame, and discard any encryption
+        related settings in the PDU descriptor. */
+        wpt_uint32 dpuNE:1;
+    
+        
+        /** This is only available in libra/virgo2.0  it is reserved for virgo1.0
+        This bit indicates to ADU/UMA module that the packet requires 802.11n
+        to 802.3 frame translation. When used by ADU 
+        0 - No frame translation required
+        1 - Frame Translation required */
+        wpt_uint32 ft:1;
+    
+        /** BD Type 
+        00: 'Generic BD', as indicted above
+        01: De-fragmentation format 
+        10-11: Reserved for future use. */
+        wpt_uint32 bdt:2;
+#else
+        wpt_uint32 bdt:2;
+        wpt_uint32 ft:1;
+        wpt_uint32 dpuNE:1;
+        wpt_uint32 fwTxComplete0:1; 
+        wpt_uint32 txComplete1:1;
+        wpt_uint32 reserved1:1;
+        wpt_uint32 ub:1;
+        wpt_uint32 rmf:1;
+        wpt_uint32 reserved0:12;
+        wpt_uint32 dpuSignature:3;
+        wpt_uint32 dpuRF:8;
+#endif
+    
+        /* 0x04 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved2:16; /* MUST BE 0 otherwise triggers BMU error*/
+        wpt_uint32 aduFeedback:8;
+    
+        /* DPU feedback in Tx path.*/
+        wpt_uint32 dpuFeedback:8;
+    
+#else
+        wpt_uint32 dpuFeedback:8;
+        wpt_uint32 aduFeedback:8;
+        wpt_uint32 reserved2:16;
+#endif
+    
+        /* 0x08 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** It is initially filled by DXE then if encryption is on, then DPU will
+        overwrite these fields. In case PDUs are linked to the BD, this field
+        indicates the index of the first PDU linked to the BD. When PDU count is
+        zero, this field has an undefined value. */
+        wpt_uint32 headPduIdx:16;
+    
+        /**  It is initially filled by DXE then if encryption is on, then DPU will
+        overwrite these fields.In case PDUs are linked to the BD, this field
+        indicates the index of the last PDU. When PDU count is zero, this field
+        has an undefined value. */
+        wpt_uint32 tailPduIdx:16;
+#else
+        wpt_uint32 tailPduIdx:16;
+        wpt_uint32 headPduIdx:16;
+#endif
+    
+        /* 0x0c */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** This is filled by Host in Virgo 1.0 but it gets changed by ADU in
+        Virgo2.0/Libra. The length (in number of bytes) of the MPDU header.
+        Limitation: The MPDU header offset + MPDU header length can never go beyond
+        the end of the first PDU */
+        wpt_uint32 mpduHeaderLength:8;
+    
+        /** This is filled by Host in Virgo 1.0 but it gets changed by ADU in
+        Virgo2.0/Libra. The start byte number of the MPDU header. The byte numbering
+        is done in the BE format. Word 0x0, bits [31:24] has byte index 0. */
+        wpt_uint32 mpduHeaderOffset:8;
+    
+        /** This is filled by Host in Virgo 1.0 but it gets changed by ADU in
+        Virgo2.0/Libra. The start byte number of the MPDU data.  The byte numbering
+        is done in the BE format. Word 0x0, bits [31:24] has byte index 0.
+        Note that this offset can point all the way into the first linked PDU. 
+        Limitation: MPDU DATA OFFSET can not point into the 2nd linked PDU */
+        wpt_uint32 mpduDataOffset:9;
+    
+        /** It is initially filled by DXE then if encryption is on, then DPU will
+        overwrite these fields. The number of PDUs linked to the BD. This field
+        should always indicate the correct amount. */
+        wpt_uint32 pduCount:7;
+#else
+        wpt_uint32 pduCount:7;
+        wpt_uint32 mpduDataOffset:9;
+        wpt_uint32 mpduHeaderOffset:8;
+        wpt_uint32 mpduHeaderLength:8;
+#endif
+    
+        /* 0x10 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** This is filled by Host in Virgo 1.0 but it gets changed by ADU in
+        Virgo2.0/LibraMPDU length.This covers MPDU header length + MPDU data length.
+        This does not include FCS. For single frame transmission, PSDU size is
+        mpduLength + 4.*/
+        wpt_uint32 mpduLength:16;
+    
+        wpt_uint32 reserved3:2;
+        /** Sequence number insertion by DPU
+        00: Leave sequence number as is, as filled by host
+        01: DPU to insert non TID based sequence number (If it is not TID based,
+        then how does DPU know what seq to fill? Is this the non-Qos/Mgmt sequence
+        number?
+        10: DPU to insert a sequence number based on TID.
+        11: Reserved */
+        wpt_uint32 bd_ssn:2;
+    
+        /** Traffic Identifier
+        Indicates the traffic class the frame belongs to. For non QoS frames, this
+        field is set to zero. */
+        wpt_uint32 tid:4;
+        
+        wpt_uint32 reserved4:8;
+    
+#else
+        wpt_uint32 reserved4:8;
+        wpt_uint32 tid:4;
+        wpt_uint32 bd_ssn:2;
+        wpt_uint32 reserved3:2;
+        wpt_uint32 mpduLength:16;
+#endif
+    
+        /* 0x14 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        /** (Only used by the DPU)
+        This is filled by Host in Virgo 1.0 but it gets filled by ADU in
+        Virgo2.0/Libra. The DPU descriptor index is used to calculate where in
+        memory the DPU can find the DPU descriptor related to this frame. The DPU
+        calculates the address by multiplying this index with the DPU descriptor
+        size and adding the DPU descriptors base address. The DPU descriptor
+        contains information specifying the encryption and compression type and
+        contains references to where encryption keys can be found. */
+        wpt_uint32 dpuDescIdx:8;
+    
+        /** This is filled by Host in Virgo 1.0 but it gets filled by ADU in
+        Virgo2.0/Libra. The STAid of the RA address */
+        wpt_uint32 staIndex:8;
+    
+        /** A field passed on to TPE which influences the ACK policy to be used for
+        this frame
+        00 - Iack
+        01,10,11 - No Ack */
+        wpt_uint32 ap:2;
+    
+        /** Overwrite option for the transmit rate
+        00: Use rate programmed in the TPE STA descriptor
+        01: Use TPE BD rate 1
+        10: Use TPE BD rate 2
+        11: Delayed Use TPE BD rate 3 */
+        wpt_uint32 bdRate:2;
+    
+        /** 
+        This is filled by Host in Virgo 1.0 but it gets filled by ADU in
+        Virgo2.0/Libra. Queue ID */
+        wpt_uint32 queueId:5;
+    
+        wpt_uint32 reserved5:7;
+#else
+        wpt_uint32 reserved5:7;
+        wpt_uint32 queueId:5;
+        wpt_uint32 bdRate:2;
+        wpt_uint32 ap:2;
+        wpt_uint32 staIndex:8;
+        wpt_uint32 dpuDescIdx:8;
+#endif
+
+        wpt_uint32 txBdSignature;
+
+        /* 0x1C */
+        wpt_uint32 reserved6;
+        /* 0x20 */
+        /* Timestamp filled by DXE. Timestamp for current transfer */
+        wpt_uint32 dxeH2BStartTimestamp;
+    
+        /* 0x24 */
+        /* Timestamp filled by DXE. Timestamp for previous transfer */
+        wpt_uint32 dxeH2BEndTimestamp;
+
+} WDI_TxBdType;
+
+/*---------------------------------------------------------------------------         
+  WDI_RxDeFragBdType - The format of the RX BD Defragmented 
+---------------------------------------------------------------------------*/
+typedef struct 
+{
+        /* 0x00 */
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved1:30;
+        wpt_uint32 bdt:2;
+#else
+        wpt_uint32 bdt:2;
+        wpt_uint32 reserved1:30;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved2:24;
+        wpt_uint32 dpuFeedBack:8;
+#else
+        wpt_uint32 dpuFeedBack:8;
+        wpt_uint32 reserved2:24;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved3:16;
+        wpt_uint32 frag0BdIdx:16;
+#else
+        wpt_uint32 frag0BdIdx:16;
+        wpt_uint32 reserved3:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved4:16;
+        wpt_uint32 frag1BdIdx:16;
+#else
+        wpt_uint32 frag1BdIdx:16;
+        wpt_uint32 reserved4:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 frag2BdIdx:16;
+        wpt_uint32 reserved5:16;
+#else
+        wpt_uint32 frag2BdIdx:16;
+        wpt_uint32 reserved5:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved6:16;
+        wpt_uint32 frag3BdIdx:16;
+#else
+        wpt_uint32 frag3BdIdx:16;
+        wpt_uint32 reserved6:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved7:16;
+        wpt_uint32 frag4BdIdx:16;
+#else
+        wpt_uint32 frag4BdIdx:16;
+        wpt_uint32 reserved7:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved8:16;
+        wpt_uint32 frag5BdIdx:16;
+#else
+        wpt_uint32 frag5BdIdx:16;
+        wpt_uint32 reserved8:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved9:16;
+        wpt_uint32 frag6BdIdx:16;
+#else
+        wpt_uint32 frag6BdIdx:16;
+        wpt_uint32 reserved9:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved10:16;
+        wpt_uint32 frag7BdIdx:16;
+#else
+        wpt_uint32 frag7BdIdx:16;
+        wpt_uint32 reserved10:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved11:16;
+        wpt_uint32 frag8BdIdx:16;
+#else
+        wpt_uint32 frag8BdIdx:16;
+        wpt_uint32 reserved11:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved12:16;
+        wpt_uint32 frag9BdIdx:16;
+#else
+        wpt_uint32 frag9BdIdx:16;
+        wpt_uint32 reserved12:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved13:16;
+        wpt_uint32 frag10BdIdx:16;
+#else
+        wpt_uint32 frag10BdIdx:16;
+        wpt_uint32 reserved13:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved14:16;
+        wpt_uint32 frag11BdIdx:16;
+#else
+        wpt_uint32 frag11BdIdx:16;
+        wpt_uint32 reserved14:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved15:16;
+        wpt_uint32 frag12BdIdx:16;
+#else
+        wpt_uint32 frag12BdIdx:16;
+        wpt_uint32 reserved15:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 reserved16:16;
+        wpt_uint32 frag13BdIdx:16;
+#else
+        wpt_uint32 frag13BdIdx:16;
+        wpt_uint32 reserved16:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 frag14BdIdx:16;
+        wpt_uint32 reserved17:16;
+#else
+        wpt_uint32 frag14BdIdx:16;
+        wpt_uint32 reserved17:16;
+#endif
+
+#ifdef WPT_BIG_BYTE_ENDIAN
+        wpt_uint32 frag15BdIdx:16;
+        wpt_uint32 reserved18:16;
+#else
+        wpt_uint32 frag15BdIdx:16;
+        wpt_uint32 reserved18:16;
+#endif
+
+} WDI_RxDeFragBdType;
+
+#endif /*WLAN_QCT_WDI_BD_H*/
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h b/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
new file mode 100644
index 0000000..252b111
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
@@ -0,0 +1,332 @@
+/*
+ * 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 WLAN_QCT_WDI_CFG_H
+#define WLAN_QCT_WDI_CFG_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+              C O N F I G U R A T I O N   D E F I N E S
+                         E X T E R N A L   A P I                
+                   
+DESCRIPTION
+  This file contains the configuration defines to be used by the UMAC for
+  setting up the config parameters in DAL.
+ 
+  !! The values in here should be an identical match of the HAL defines
+  by the same name !! 
+  
+      
+  Copyright (c) 2010 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
+--------    ---    ----------------------------------------------------------
+08/19/10    lti     Created module.
+
+===========================================================================*/
+
+/*-------------------------------------------------------------------------
+  Preprocessor definitions and constants
+-------------------------------------------------------------------------*/
+#define WDI_MAX_CFG_LENGTH                  0x06
+
+/*-------------------------------------------------------------------------
+  Configuration Parameter IDs
+-------------------------------------------------------------------------*/
+#define WDI_CFG_STA_ID                             0
+#define WDI_CFG_CURRENT_TX_ANTENNA                 1
+#define WDI_CFG_CURRENT_RX_ANTENNA                 2
+#define WDI_CFG_LOW_GAIN_OVERRIDE                  3
+#define WDI_CFG_POWER_STATE_PER_CHAIN              4
+#define WDI_CFG_CAL_PERIOD                         5
+#define WDI_CFG_CAL_CONTROL                        6
+#define WDI_CFG_PROXIMITY                          7
+#define WDI_CFG_NETWORK_DENSITY                    8
+#define WDI_CFG_MAX_MEDIUM_TIME                    9
+#define WDI_CFG_MAX_MPDUS_IN_AMPDU                 10
+#define WDI_CFG_RTS_THRESHOLD                      11
+#define WDI_CFG_SHORT_RETRY_LIMIT                  12
+#define WDI_CFG_LONG_RETRY_LIMIT                   13
+#define WDI_CFG_FRAGMENTATION_THRESHOLD            14
+#define WDI_CFG_DYNAMIC_THRESHOLD_ZERO             15
+#define WDI_CFG_DYNAMIC_THRESHOLD_ONE              16
+#define WDI_CFG_DYNAMIC_THRESHOLD_TWO              17
+#define WDI_CFG_FIXED_RATE                         18
+#define WDI_CFG_RETRYRATE_POLICY                   19
+#define WDI_CFG_RETRYRATE_SECONDARY                20
+#define WDI_CFG_RETRYRATE_TERTIARY                 21
+#define WDI_CFG_FORCE_POLICY_PROTECTION            22
+#define WDI_CFG_FIXED_RATE_MULTICAST_24GHZ         23
+#define WDI_CFG_FIXED_RATE_MULTICAST_5GHZ          24
+#define WDI_CFG_DEFAULT_RATE_INDEX_24GHZ           25
+#define WDI_CFG_DEFAULT_RATE_INDEX_5GHZ            26
+#define WDI_CFG_MAX_BA_SESSIONS                    27
+#define WDI_CFG_PS_DATA_INACTIVITY_TIMEOUT         28
+#define WDI_CFG_PS_ENABLE_BCN_FILTER               29
+#define WDI_CFG_PS_ENABLE_RSSI_MONITOR             30
+#define WDI_CFG_NUM_BEACON_PER_RSSI_AVERAGE        31
+#define WDI_CFG_STATS_PERIOD                       32
+#define WDI_CFG_CFP_MAX_DURATION                   33
+
+/*-------------------------------------------------------------------------
+  Configuration Parameter min, max, defaults
+-------------------------------------------------------------------------*/
+
+/* WDI_CFG_CURRENT_TX_ANTENNA */
+#define WDI_CFG_CURRENT_TX_ANTENNA_STAMIN          1
+#define WDI_CFG_CURRENT_TX_ANTENNA_STAMAX          1
+#define WDI_CFG_CURRENT_TX_ANTENNA_STADEF          1
+
+/* WDI_CFG_CURRENT_RX_ANTENNA */
+#define WDI_CFG_CURRENT_RX_ANTENNA_STAMIN          1
+#define WDI_CFG_CURRENT_RX_ANTENNA_STAMAX          2
+#define WDI_CFG_CURRENT_RX_ANTENNA_STADEF          1
+
+/* WDI_CFG_LOW_GAIN_OVERRIDE */
+#define WDI_CFG_LOW_GAIN_OVERRIDE_STAMIN           0
+#define WDI_CFG_LOW_GAIN_OVERRIDE_STAMAX           1
+#define WDI_CFG_LOW_GAIN_OVERRIDE_STADEF           0
+
+/* WDI_CFG_POWER_STATE_PER_CHAIN */
+#define WDI_CFG_POWER_STATE_PER_CHAIN_STAMIN             0
+#define WDI_CFG_POWER_STATE_PER_CHAIN_STAMAX             65535
+#define WDI_CFG_POWER_STATE_PER_CHAIN_STADEF             785
+#define WDI_CFG_POWER_STATE_PER_CHAIN_OFF                0
+#define WDI_CFG_POWER_STATE_PER_CHAIN_ON                 1
+#define WDI_CFG_POWER_STATE_PER_CHAIN_TX                 2
+#define WDI_CFG_POWER_STATE_PER_CHAIN_RX                 3
+#define WDI_CFG_POWER_STATE_PER_CHAIN_MASK               15
+#define WDI_CFG_POWER_STATE_PER_CHAIN_CHAIN_0_OFFSET     0
+#define WDI_CFG_POWER_STATE_PER_CHAIN_CHAIN_1_OFFSET     4
+#define WDI_CFG_POWER_STATE_PER_CHAIN_CHAIN_2_OFFSET     8
+
+/* WDI_CFG_CAL_PERIOD */
+#define WDI_CFG_CAL_PERIOD_STAMIN                  2
+#define WDI_CFG_CAL_PERIOD_STAMAX                  10
+#define WDI_CFG_CAL_PERIOD_STADEF                  5
+
+/* WDI_CFG_CAL_CONTROL */
+#define WDI_CFG_CAL_CONTROL_STAMIN    0
+#define WDI_CFG_CAL_CONTROL_STAMAX    1
+#define WDI_CFG_CAL_CONTROL_STADEF    0
+
+/* WDI_CFG_PROXIMITY */
+#define WDI_CFG_PROXIMITY_STAMIN    0
+#define WDI_CFG_PROXIMITY_STAMAX    1
+#define WDI_CFG_PROXIMITY_STADEF    0
+#define WDI_CFG_PROXIMITY_OFF       0
+#define WDI_CFG_PROXIMITY_ON        1
+
+/* WDI_CFG_NETWORK_DENSITY */
+#define WDI_CFG_NETWORK_DENSITY_STAMIN    0
+#define WDI_CFG_NETWORK_DENSITY_STAMAX    3
+#define WDI_CFG_NETWORK_DENSITY_STADEF    3
+#define WDI_CFG_NETWORK_DENSITY_LOW       0
+#define WDI_CFG_NETWORK_DENSITY_MEDIUM    1
+#define WDI_CFG_NETWORK_DENSITY_HIGH      2
+#define WDI_CFG_NETWORK_DENSITY_ADAPTIVE  3
+
+/* WDI_CFG_MAX_MEDIUM_TIME */
+#define WDI_CFG_MAX_MEDIUM_TIME_STAMIN    0
+#define WDI_CFG_MAX_MEDIUM_TIME_STAMAX    65535
+#define WDI_CFG_MAX_MEDIUM_TIME_STADEF    1024
+
+/* WDI_CFG_MAX_MPDUS_IN_AMPDU */
+#define WDI_CFG_MAX_MPDUS_IN_AMPDU_STAMIN    0
+#define WDI_CFG_MAX_MPDUS_IN_AMPDU_STAMAX    65535
+#define WDI_CFG_MAX_MPDUS_IN_AMPDU_STADEF    64
+
+/* WDI_CFG_RTS_THRESHOLD */
+#define WDI_CFG_RTS_THRESHOLD_STAMIN               0
+#define WDI_CFG_RTS_THRESHOLD_STAMAX               2347
+#define WDI_CFG_RTS_THRESHOLD_STADEF               2347
+
+/* WDI_CFG_SHORT_RETRY_LIMIT */
+#define WDI_CFG_SHORT_RETRY_LIMIT_STAMIN    0
+#define WDI_CFG_SHORT_RETRY_LIMIT_STAMAX    255
+#define WDI_CFG_SHORT_RETRY_LIMIT_STADEF    6
+
+/* WDI_CFG_LONG_RETRY_LIMIT */
+#define WDI_CFG_LONG_RETRY_LIMIT_STAMIN    0
+#define WDI_CFG_LONG_RETRY_LIMIT_STAMAX    255
+#define WDI_CFG_LONG_RETRY_LIMIT_STADEF    6
+
+/* WDI_CFG_FRAGMENTATION_THRESHOLD */
+#define WDI_CFG_FRAGMENTATION_THRESHOLD_STAMIN    256
+#define WDI_CFG_FRAGMENTATION_THRESHOLD_STAMAX    8000
+#define WDI_CFG_FRAGMENTATION_THRESHOLD_STADEF    8000
+
+/* WDI_CFG_DYNAMIC_THRESHOLD_ZERO */
+#define WDI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN    0
+#define WDI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX    255
+#define WDI_CFG_DYNAMIC_THRESHOLD_ZERO_STADEF    2
+
+/* WDI_CFG_DYNAMIC_THRESHOLD_ONE */
+#define WDI_CFG_DYNAMIC_THRESHOLD_ONE_STAMIN    0
+#define WDI_CFG_DYNAMIC_THRESHOLD_ONE_STAMAX    255
+#define WDI_CFG_DYNAMIC_THRESHOLD_ONE_STADEF    4
+
+/* WDI_CFG_DYNAMIC_THRESHOLD_TWO */
+#define WDI_CFG_DYNAMIC_THRESHOLD_TWO_STAMIN    0
+#define WDI_CFG_DYNAMIC_THRESHOLD_TWO_STAMAX    255
+#define WDI_CFG_DYNAMIC_THRESHOLD_TWO_STADEF    6
+
+/* WDI_CFG_FIXED_RATE */
+#define WDI_CFG_FIXED_RATE_STAMIN                        0
+#define WDI_CFG_FIXED_RATE_STAMAX                        31
+#define WDI_CFG_FIXED_RATE_STADEF                        0
+#define WDI_CFG_FIXED_RATE_AUTO                          0
+#define WDI_CFG_FIXED_RATE_1MBPS                         1
+#define WDI_CFG_FIXED_RATE_2MBPS                         2
+#define WDI_CFG_FIXED_RATE_5_5MBPS                       3
+#define WDI_CFG_FIXED_RATE_11MBPS                        4
+#define WDI_CFG_FIXED_RATE_6MBPS                         5
+#define WDI_CFG_FIXED_RATE_9MBPS                         6
+#define WDI_CFG_FIXED_RATE_12MBPS                        7
+#define WDI_CFG_FIXED_RATE_18MBPS                        8
+#define WDI_CFG_FIXED_RATE_24MBPS                        9
+#define WDI_CFG_FIXED_RATE_36MBPS                        10
+#define WDI_CFG_FIXED_RATE_48MBPS                        11
+#define WDI_CFG_FIXED_RATE_54MBPS                        12
+#define WDI_CFG_FIXED_RATE_6_5MBPS_MCS0_20MHZ_SIMO       13
+#define WDI_CFG_FIXED_RATE_13MBPS_MCS1_20MHZ_SIMO        14
+#define WDI_CFG_FIXED_RATE_19_5MBPS_MCS2_20MHZ_SIMO      15
+#define WDI_CFG_FIXED_RATE_26MBPS_MCS3_20MHZ_SIMO        16
+#define WDI_CFG_FIXED_RATE_39MBPS_MCS4_20MHZ_SIMO        17
+#define WDI_CFG_FIXED_RATE_52MBPS_MCS5_20MHZ_SIMO        18
+#define WDI_CFG_FIXED_RATE_58_5MBPS_MCS6_20MHZ_SIMO      19
+#define WDI_CFG_FIXED_RATE_65MBPS_MCS7_20MHZ_SIMO        20
+#define WDI_CFG_FIXED_RATE_7_2MBPS_MCS0_20MHZ_SIMO_SGI   21
+#define WDI_CFG_FIXED_RATE_14_4MBPS_MCS1_20MHZ_SIMO_SGI  22
+#define WDI_CFG_FIXED_RATE_21_7MBPS_MCS2_20MHZ_SIMO_SGI  23
+#define WDI_CFG_FIXED_RATE_28_9MBPS_MCS3_20MHZ_SIMO_SGI  24
+#define WDI_CFG_FIXED_RATE_43_3MBPS_MCS4_20MHZ_SIMO_SGI  25
+#define WDI_CFG_FIXED_RATE_57_8MBPS_MCS5_20MHZ_SIMO_SGI  26
+#define WDI_CFG_FIXED_RATE_65MBPS_MCS6_20MHZ_SIMO_SGI    27
+#define WDI_CFG_FIXED_RATE_72_2MBPS_MCS7_20MHZ_SIMO_SGI  28
+#define WDI_CFG_FIXED_RATE_0_25MBPS_SLR_20MHZ_SIMO       29
+#define WDI_CFG_FIXED_RATE_0_5MBPS_SLR_20MHZ_SIMO        30
+#define WDI_CFG_FIXED_RATE_68_25MBPS_QC_PROP_20MHZ_SIMO  31
+
+/* WDI_CFG_RETRYRATE_POLICY */
+#define WDI_CFG_RETRYRATE_POLICY_STAMIN         0
+#define WDI_CFG_RETRYRATE_POLICY_STAMAX         255
+#define WDI_CFG_RETRYRATE_POLICY_STADEF         4
+#define WDI_CFG_RETRYRATE_POLICY_MIN_SUPPORTED  0
+#define WDI_CFG_RETRYRATE_POLICY_PRIMARY        1
+#define WDI_CFG_RETRYRATE_POLICY_RESERVED       2
+#define WDI_CFG_RETRYRATE_POLICY_CLOSEST        3
+#define WDI_CFG_RETRYRATE_POLICY_AUTOSELECT     4
+#define WDI_CFG_RETRYRATE_POLICY_MAX            5
+
+/* WDI_CFG_RETRYRATE_SECONDARY */
+#define WDI_CFG_RETRYRATE_SECONDARY_STAMIN    0
+#define WDI_CFG_RETRYRATE_SECONDARY_STAMAX    255
+#define WDI_CFG_RETRYRATE_SECONDARY_STADEF    0
+
+/* WDI_CFG_RETRYRATE_TERTIARY */
+#define WDI_CFG_RETRYRATE_TERTIARY_STAMIN    0
+#define WDI_CFG_RETRYRATE_TERTIARY_STAMAX    255
+#define WDI_CFG_RETRYRATE_TERTIARY_STADEF    0
+
+/* WDI_CFG_FORCE_POLICY_PROTECTION */
+#define WDI_CFG_FORCE_POLICY_PROTECTION_STAMIN     0
+#define WDI_CFG_FORCE_POLICY_PROTECTION_STAMAX     5
+#define WDI_CFG_FORCE_POLICY_PROTECTION_STADEF     5
+#define WDI_CFG_FORCE_POLICY_PROTECTION_DISABLE    0
+#define WDI_CFG_FORCE_POLICY_PROTECTION_CTS        1
+#define WDI_CFG_FORCE_POLICY_PROTECTION_RTS        2
+#define WDI_CFG_FORCE_POLICY_PROTECTION_DUAL_CTS   3
+#define WDI_CFG_FORCE_POLICY_PROTECTION_RTS_ALWAYS 4
+#define WDI_CFG_FORCE_POLICY_PROTECTION_AUTO       5
+
+/* WDI_CFG_FIXED_RATE_MULTICAST_24GHZ */
+#define WDI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMIN    0
+#define WDI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMAX    31
+#define WDI_CFG_FIXED_RATE_MULTICAST_24GHZ_STADEF    1
+
+/* WDI_CFG_FIXED_RATE_MULTICAST_5GHZ */
+#define WDI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMIN    0
+#define WDI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMAX    31
+#define WDI_CFG_FIXED_RATE_MULTICAST_5GHZ_STADEF    5
+
+/* WDI_CFG_DEFAULT_RATE_INDEX_24GHZ */
+#define WDI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMIN    0
+#define WDI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMAX    31
+#define WDI_CFG_DEFAULT_RATE_INDEX_24GHZ_STADEF    1
+
+/* WDI_CFG_DEFAULT_RATE_INDEX_5GHZ */
+#define WDI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMIN    0
+#define WDI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMAX    11
+#define WDI_CFG_DEFAULT_RATE_INDEX_5GHZ_STADEF    5
+
+/* WDI_CFG_MAX_BA_SESSIONS */
+#define WDI_CFG_MAX_BA_SESSIONS_STAMIN    0
+#define WDI_CFG_MAX_BA_SESSIONS_STAMAX    64
+#define WDI_CFG_MAX_BA_SESSIONS_STADEF    16
+
+/* WDI_CFG_PS_DATA_INACTIVITY_TIMEOUT */
+#define WDI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMIN    1
+#define WDI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMAX    255
+#define WDI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STADEF    20
+
+/* WDI_CFG_PS_ENABLE_BCN_FILTER */
+#define WDI_CFG_PS_ENABLE_BCN_FILTER_STAMIN    0
+#define WDI_CFG_PS_ENABLE_BCN_FILTER_STAMAX    1
+#define WDI_CFG_PS_ENABLE_BCN_FILTER_STADEF    1
+
+/* WDI_CFG_PS_ENABLE_RSSI_MONITOR */
+#define WDI_CFG_PS_ENABLE_RSSI_MONITOR_STAMIN    0
+#define WDI_CFG_PS_ENABLE_RSSI_MONITOR_STAMAX    1
+#define WDI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF    1
+
+/* WDI_CFG_NUM_BEACON_PER_RSSI_AVERAGE */
+#define WDI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMIN    1
+#define WDI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX    20
+#define WDI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STADEF    20
+
+/* WDI_CFG_STATS_PERIOD */
+#define WDI_CFG_STATS_PERIOD_STAMIN    1
+#define WDI_CFG_STATS_PERIOD_STAMAX    10
+#define WDI_CFG_STATS_PERIOD_STADEF    10
+
+/* WDI_CFG_CFP_MAX_DURATION */
+#define WDI_CFG_CFP_PERIOD_STAMIN                  0
+#define WDI_CFG_CFP_PERIOD_STAMAX                  255
+#define WDI_CFG_CFP_PERIOD_STADEF                  1
+
+#endif /*WLAN_QCT_WDI_CFG_H*/
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h b/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
new file mode 100644
index 0000000..3e0d851
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
@@ -0,0 +1,497 @@
+/*
+ * 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 WLAN_QCT_WDI_DP_H
+#define WLAN_QCT_WDI_DP_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+              I N T E R N A L     A P I       F O R    T H E
+                                 D A T A   P A T H 
+                
+                   
+DESCRIPTION
+  This file contains the internal API exposed by the DAL Control Path Core 
+  module to be used by the DAL Data Path Core. 
+  
+      
+  Copyright (c) 2010 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
+--------    ---    ----------------------------------------------------------
+08/19/10    lti     Created module.
+
+===========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_wdi_i.h"
+#include "wlan_qct_wdi_bd.h"
+
+/*========================================================================= 
+   BD Macro Defines  
+=========================================================================*/ 
+
+/*--------------------------------------------------------------------------
+  BD Definitions used by the DAL data path 
+--------------------------------------------------------------------------*/
+#define WDI_TXBD_BDRATE_DEFAULT 0
+#define WDI_TXBD_BDRATE_FIRST   1
+#define WDI_TXBD_BDRATE_SECOND  2
+#define WDI_TXBD_BDRATE_THIRD   3
+
+#define WDI_FRAME_TYPE_MASK     0x30
+#define WDI_FRAME_TYPE_OFFSET   0x4
+#define WDI_FRAME_SUBTYPE_MASK  0x0F
+
+#define WDI_TXBD_BD_SSN_FILL_HOST         0
+#define WDI_TXBD_BD_SSN_FILL_DPU_NON_QOS  1
+#define WDI_TXBD_BD_SSN_FILL_DPU_QOS      2
+
+#define WDI_ACKPOLICY_ACK_REQUIRED        0
+#define WDI_ACKPOLICY_ACK_NOTREQUIRED     1
+
+#define WDI_BDRATE_BCDATA_FRAME           1
+#define WDI_BDRATE_BCMGMT_FRAME           2
+#define WDI_BDRATE_CTRL_FRAME             3
+    
+/* Default values for FillTx BD */
+#define WDI_DEFAULT_UNICAST_ENABLED       1
+#define WDI_RMF_DISABLED                  0
+#define WDI_RMF_ENABLED                   1
+#define WDI_NO_ENCRYPTION_DISABLED        0
+#define WDI_NO_ENCRYPTION_ENABLED         1
+    
+#define WDI_RX_BD_ADDR3_SELF_IDX          0
+
+#define WDI_TXCOMP_REQUESTED_MASK           0x1  //bit 0 for TxComp intr requested. 
+#define WDI_USE_SELF_STA_REQUESTED_MASK     0x2  //bit 1 for STA overwrite with selfSta Requested.
+#define WDI_TX_NO_ENCRYPTION_MASK           0x4  //bit 2. If set, the frame is not to be encrypted
+#if defined(LIBRA_WAPI_SUPPORT)
+#define WDI_WAPI_STA_MASK            0x8  //bit 3. If set, this frame is for WAPI station
+#endif
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+#define WDI_TRIGGER_ENABLED_AC_MASK         0x10 //bit 4 for data frames belonging to trigger enabled AC
+#endif
+#define WDI_USE_NO_ACK_REQUESTED_MASK       0x20
+
+#define WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames
+
+
+/*Macro for getting the size of the TX BD*/
+#define WDI_TX_BD_HEADER_SIZE        sizeof(WDI_TxBdType)
+
+/*Macro for getting the size of the RX BD*/
+#define WDI_RX_BD_HEADER_SIZE        sizeof(WDI_RxBdType)
+
+#define WDI_RX_BD_HEADER_OFFSET       0
+
+#define WDI_DPU_FEEDBACK_OFFSET       1
+
+// Frame Type definitions
+
+#define WDI_MAC_MGMT_FRAME    0x0
+#define WDI_MAC_CTRL_FRAME    0x1
+#define WDI_MAC_DATA_FRAME    0x2
+
+// Data frame subtype definitions
+#define WDI_MAC_DATA_DATA                 0
+#define WDI_MAC_DATA_DATA_ACK             1
+#define WDI_MAC_DATA_DATA_POLL            2
+#define WDI_MAC_DATA_DATA_ACK_POLL        3
+#define WDI_MAC_DATA_NULL                 4
+#define WDI_MAC_DATA_NULL_ACK             5
+#define WDI_MAC_DATA_NULL_POLL            6
+#define WDI_MAC_DATA_NULL_ACK_POLL        7
+#define WDI_MAC_DATA_QOS_DATA             8
+#define WDI_MAC_DATA_QOS_DATA_ACK         9
+#define WDI_MAC_DATA_QOS_DATA_POLL        10
+#define WDI_MAC_DATA_QOS_DATA_ACK_POLL    11
+#define WDI_MAC_DATA_QOS_NULL             12
+#define WDI_MAC_DATA_QOS_NULL_ACK         13
+#define WDI_MAC_DATA_QOS_NULL_POLL        14
+#define WDI_MAC_DATA_QOS_NULL_ACK_POLL    15
+
+#define WDI_MAC_FRAME_SUBTYPE_START       0
+#define WDI_MAC_FRAME_SUBTYPE_END         16
+
+#define WDI_MAC_DATA_QOS_MASK             8
+#define WDI_MAC_DATA_NULL_MASK            4
+#define WDI_MAC_DATA_POLL_MASK            2
+#define WDI_MAC_DATA_ACK_MASK             1
+
+// Management frame subtype definitions
+
+#define WDI_MAC_MGMT_ASSOC_REQ    0x0
+#define WDI_MAC_MGMT_ASSOC_RSP    0x1
+#define WDI_MAC_MGMT_REASSOC_REQ  0x2
+#define WDI_MAC_MGMT_REASSOC_RSP  0x3
+#define WDI_MAC_MGMT_PROBE_REQ    0x4
+#define WDI_MAC_MGMT_PROBE_RSP    0x5
+#define WDI_MAC_MGMT_BEACON       0x8
+#define WDI_MAC_MGMT_ATIM         0x9
+#define WDI_MAC_MGMT_DISASSOC     0xA
+#define WDI_MAC_MGMT_AUTH         0xB
+#define WDI_MAC_MGMT_DEAUTH       0xC
+#define WDI_MAC_MGMT_ACTION       0xD
+#define WDI_MAC_MGMT_RESERVED15   0xF
+
+// Action frame categories
+
+#define WDI_MAC_ACTION_SPECTRUM_MGMT    0
+#define WDI_MAC_ACTION_QOS_MGMT         1
+#define WDI_MAC_ACTION_DLP              2
+#define WDI_MAC_ACTION_BLKACK           3
+#define WDI_MAC_ACTION_HT               7
+#define WDI_MAC_ACTION_WME              17
+
+// QoS management action codes
+
+#define WDI_MAC_QOS_ADD_TS_REQ      0
+#define WDI_MAC_QOS_ADD_TS_RSP      1
+#define WDI_MAC_QOS_DEL_TS_REQ      2
+#define WDI_MAC_QOS_SCHEDULE        3
+// and these are proprietary
+#define WDI_MAC_QOS_DEF_BA_REQ      4
+#define WDI_MAC_QOS_DEF_BA_RSP      5
+#define WDI_MAC_QOS_DEL_BA_REQ      6
+#define WDI_MAC_QOS_DEL_BA_RSP      7
+
+#ifdef WLAN_PERF
+/* TxBD signature fields
+ * serial(8): a monotonically increasing serial # whenever there is a Add/Del STA or Add/Del Key event
+ * macHash(16): Hash value of DA
+ * tid(4):    TID
+ * ucast(1):  Unicast or Broadcast data frame
+ */
+#define WDI_TXBD_SIG_SERIAL_OFFSET        0   
+#define WDI_TXBD_SIG_TID_OFFSET           8
+#define WDI_TXBD_SIG_UCAST_DATA_OFFSET    9
+#define WDI_TXBD_SIG_MACADDR_HASH_OFFSET  16
+#define WDI_TXBD_SIG_MGMT_MAGIC           0xbdbdbdbd
+
+#endif
+
+/*--------------------------------------------------------------------------
+   BD header macros - used by the data path to get or set various values
+   inside the packet BD 
+--------------------------------------------------------------------------*/
+#define WDI_RX_BD_GET_MPDU_H_OFFSET( _pvBDHeader )   (((WDI_RxBdType*)_pvBDHeader)->mpduHeaderOffset)
+
+#define WDI_RX_BD_GET_MPDU_D_OFFSET( _pvBDHeader )   (((WDI_RxBdType*)_pvBDHeader)->mpduDataOffset)
+
+#define WDI_RX_BD_GET_MPDU_LEN( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->mpduLength)
+
+#define WDI_RX_BD_GET_MPDU_H_LEN( _pvBDHeader )      (((WDI_RxBdType*)_pvBDHeader)->mpduHeaderLength)
+
+
+#define WDI_RX_BD_GET_FT( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->ft)
+
+#define WDI_RX_BD_GET_DPU_FEEDBACK( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->dpuFeedback)
+
+#define WDI_RX_BD_GET_RX_CHANNEL( _pvBDHeader )         \
+        (( (((WDI_RxBdType*)_pvBDHeader)->reserved0) << 4) | (((WDI_RxBdType*)_pvBDHeader)->rxChannel))
+
+#define WDI_FRAME_TYPE_MASK     0x30
+#define WDI_FRAME_TYPE_OFFSET   0x4
+#define WDI_FRAME_SUBTYPE_MASK  0x0F
+
+#define WDI_RX_BD_GET_SUBTYPE( _pvBDHeader )        ((((WDI_RxBdType*)_pvBDHeader)->frameTypeSubtype) & WDI_FRAME_SUBTYPE_MASK)
+
+#define WDI_RX_BD_GET_TYPE( _pvBDHeader )      ((((WDI_RxBdType*)_pvBDHeader)->frameTypeSubtype) & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
+
+#define WDI_RX_BD_GET_RTSF( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->rtsf)
+
+#define WDI_RX_BD_GET_BSF( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->bsf)
+
+#define WDI_RX_BD_GET_SCAN( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->scanLearn)
+
+#define WDI_RX_BD_GET_DPU_SIG( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->dpuSignature)
+
+#define WDI_RX_BD_GET_NE( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->dpuNE)
+
+#define WDI_RX_BD_GET_LLCR( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->llc)
+
+#define WDI_RX_BD_GET_TIMESTAMP( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->mclkRxTimestamp)
+
+#define WDI_RX_BD_GET_RXPFLAGS( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->rxpFlags)
+
+#define WDI_RX_BD_GET_RATEINDEX( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->rateIndex)
+
+#define WDI_RX_BD_GET_AMSDU_SIZE( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->totalMsduSize)
+
+#define WDI_RX_BD_GET_LLC( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->llc)
+
+#define WDI_RX_BD_GET_TID( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->tid)
+
+#define WDI_RX_BD_GET_ASF( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->asf)
+
+#define WDI_RX_BD_GET_AEF( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->aef)
+
+#define WDI_RX_BD_GET_LSF( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->lsf)
+
+#define WDI_RX_BD_GET_ESF( _pvBDHeader )        (((WDI_RxBdType*)_pvBDHeader)->esf)
+
+#define WDI_RX_BD_GET_STA_ID( _pvBDHeader )     (((WDI_RxBdType*)_pvBDHeader)->addr2Index)
+#define WDI_RX_BD_GET_UB( _pvBDHeader )     (((WDI_RxBdType*)_pvBDHeader)->ub)
+#define WDI_RX_BD_GET_ADDR3_IDX( _pvBDHeader )  (((WDI_RxBdType*)_pvBDHeader)->addr3Index)
+#define WDI_RX_BD_GET_ADDR1_IDX( _pvBDHeader )  (((WDI_RxBdType*)_pvBDHeader)->addr1Index)
+
+#define WDI_TX_BD_GET_TID( _pvBDHeader )   (((WDI_TxBdType*)_pvBDHeader)->tid)
+#define WDI_TX_BD_GET_STA_ID( _pvBDHeader ) (((WDI_TxBdType*)_pvBDHeader)->staIndex)
+
+#define WDI_RX_BD_GET_DPU_SIG( _pvBDHeader )     (((WDI_RxBdType*)_pvBDHeader)->dpuSignature)
+
+//flow control related.
+#define WDI_RX_FC_BD_GET_STA_TX_DISABLED_BITMAP( _pvBDHeader )     (((WDI_FcRxBdType*)_pvBDHeader)->fcStaTxDisabledBitmap)
+#define WDI_RX_FC_BD_GET_FC( _pvBDHeader )     (((WDI_FcRxBdType*)_pvBDHeader)->fc)
+#define WDI_RX_FC_BD_GET_STA_VALID_MASK( _pvBDHeader )     (((WDI_FcRxBdType*)_pvBDHeader)->fcSTAValidMask)
+
+
+/*------------ RSSI and SNR Information extraction -------------*/
+#define WDI_RX_BD_GET_RSSI0( _pvBDHeader )  \
+    (((((WDI_RxBdType*)_pvBDHeader)->phyStats0) >> 24) & 0xff)
+#define WDI_RX_BD_GET_RSSI1( _pvBDHeader )  \
+    (((((WDI_RxBdType*)_pvBDHeader)->phyStats0) >> 16) & 0xff)
+#define WDI_RX_BD_GET_RSSI2( _pvBDHeader )  \
+    (((((WDI_RxBdType*)_pvBDHeader)->phyStats0) >> 0) & 0xff)
+#define WDI_RX_BD_GET_RSSI3( _pvBDHeader )  \
+    ((((WDI_RxBdType*)_pvBDHeader)->phyStats0) & 0xff)
+
+// Get the average of the 4 values.
+#define WDI_GET_RSSI_AVERAGE( _pvBDHeader ) \
+    (((WDI_RX_BD_GET_RSSI0(_pvBDHeader)) + \
+      (WDI_RX_BD_GET_RSSI1(_pvBDHeader)) + \
+      (WDI_RX_BD_GET_RSSI2(_pvBDHeader)) + \
+      (WDI_RX_BD_GET_RSSI3(_pvBDHeader))) / 4)
+
+// Get the SNR value from PHY Stats
+#define WDI_RX_BD_GET_SNR( _pvBDHeader )    \
+    (((((WDI_RxBdType*)_pvBDHeader)->phyStats1) >> 24) & 0xff)
+/*-----------------------------------------------------------------*/
+
+#define WDI_TX_BD_SET_MPDU_DATA_OFFSET( _bd, _off )      (((WDI_TxBdType*)_bd)->mpduDataOffset = _off)
+ 
+#define WDI_TX_BD_SET_MPDU_HEADER_OFFSET( _bd, _off )    (((WDI_TxBdType*)_bd)->mpduHeaderOffset = _off)
+
+#define WDI_TX_BD_SET_MPDU_HEADER_LEN( _bd, _len )       (((WDI_TxBdType*)_bd)->mpduHeaderLength = _len)
+
+#define WDI_TX_BD_SET_MPDU_LEN( _bd, _len )              (((WDI_TxBdType*)_bd)->mpduLength = _len)
+
+#define WDI_RX_BD_GET_BA_OPCODE(_pvBDHeader)        (((WDI_RxBdType*)_pvBDHeader)->reorderOpcode)
+
+#define WDI_RX_BD_GET_BA_FI(_pvBDHeader)            (((WDI_RxBdType*)_pvBDHeader)->reorderFwdIdx)
+
+#define WDI_RX_BD_GET_BA_SI(_pvBDHeader)            (((WDI_RxBdType*)_pvBDHeader)->reorderSlotIdx)
+
+#define WDI_RX_BD_GET_BA_CSN(_pvBDHeader)           (((WDI_RxBdType*)_pvBDHeader)->currentPktSeqNo)
+
+#define WDI_RX_BD_GET_BA_ESN(_pvBDHeader)           (((WDI_RxBdType*)_pvBDHeader)->expectedPktSeqNo)
+
+#define WDI_RX_BD_GET_RXP_FLAGS(_pvBDHeader)        (((WDI_RxBdType*)_pvBDHeader)->rxpFlags)
+
+#define WDI_RX_BD_GET_PMICMD_20TO23(_pvBDHeader)        (((WDI_RxBdType*)_pvBDHeader)->pmiCmd4to23[4])
+
+#define WDI_RX_BD_GET_PMICMD_24TO25(_pvBDHeader)        (((WDI_RxBdType*)_pvBDHeader)->pmiCmd24to25)
+
+#define WDI_RX_BD_ASF_SET               1 /*The value of the field when set and pkt is AMSDU*/
+
+#define WDI_RX_BD_FSF_SET               1
+
+#define WDI_RX_BD_LSF_SET               1
+
+#define WDI_RX_BD_AEF_SET               1
+
+ 
+#define WDI_RX_BD_LLC_PRESENT           0 /*The value of the field when LLC is present*/
+
+#define WDI_RX_BD_FT_DONE                1 /* The value of the field when frame xtl was done*/
+
+/*========================================================================= 
+   API Definition  
+=========================================================================*/ 
+
+
+/**
+ @brief WDI_RxBD_GetFrameTypeSubType - Called by the data path 
+        to retrieve the type/subtype of the received frame.
+  
+ @param       pvBDHeader:    Void pointer to the RxBD buffer.
+    usFrmCtrl:     the frame ctrl of the 802.11 header 
+  
+ @return   A byte which contains both type and subtype info. LSB four bytes 
+ (b0 to b3)is subtype and b5-b6 is type info. 
+*/
+
+wpt_uint8 
+WDI_RxBD_GetFrameTypeSubType
+(
+  void*       _pvBDHeader, 
+  wpt_uint16  usFrmCtrl
+);
+
+
+/**
+ @brief WDI_FillTxBd - Called by the data path to fill the TX BD 
+  
+ @param       pWDICtx:       Context to the WDI
+     ucTypeSubtype: of the frame
+     pDestMacAddr:  destination MAC address
+     pTid:          pointer to the TID (in/out value in case DAL Ctrl causes
+                    a TID downgrade - not done for now)
+     ucDisableFrmXtl: set to 1 if this frame is not to be translated by HW
+     pTxBd:          pointer to the TX BD
+     ucTxFlag:       can have appropriate bit setting as required
+     uTimestamp:     pkt timestamp
+  
+  
+ @return success or not
+*/
+
+WDI_Status
+WDI_FillTxBd
+(
+    WDI_ControlBlockType*  pWDICtx, 
+    wpt_uint8              ucTypeSubtype, 
+    void*                  pDestMacAddr,
+    void*                  pAddr2,
+    wpt_uint8*             pTid, 
+    wpt_uint8              ucDisableFrmXtl, 
+    void*                  pTxBd, 
+    wpt_uint8              ucTxFlag, 
+    wpt_uint32             uTimeStamp,
+    wpt_uint8*             staIndex
+);
+
+/**
+ @brief WDI_SwapRxBd swaps the RX BD.
+
+  
+ @param pBd - pointer to the BD (in/out)
+  
+ @return None
+*/
+void 
+WDI_SwapRxBd
+(
+  wpt_uint8 *pBd
+);
+
+/**
+ @brief WDI_SwapTxBd - Swaps the TX BD
+  
+ @param  pBd - pointer to the BD (in/out)
+  
+ @return   none
+*/
+void 
+WDI_SwapTxBd
+(
+  wpt_uint8 *pBd
+);
+
+/**
+ @brief WDI_RxAmsduBdFix - fix for HW issue for AMSDU 
+
+  
+ @param   pWDICtx:       Context to the WDI
+          pBDHeader - pointer to the BD header
+  
+ @return None
+*/
+void 
+WDI_RxAmsduBdFix
+(
+  WDI_ControlBlockType*  pWDICtx, 
+  void*                  pBDHeader
+);
+
+#ifdef WLAN_PERF
+/**
+ @brief WDI_TxBdFastFwd - evaluates if a frame can be fast 
+        forwarded 
+  
+ @param   pWDICtx: Context to the WDI 
+          pDestMac: Destination MAC
+          ucTid: packet TID pBDHeader
+          ucUnicastDst: is packet unicast
+          pTxBd:       pointer to the BD header
+          usMpduLength: len 
+  
+ @return 1 - if the frame can be fast fwd-ed ; 0 if not 
+*/
+wpt_uint32 
+WDI_TxBdFastFwd
+(
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pDestMac, 
+  wpt_uint8              ucTid, 
+  wpt_uint8              ucUnicastDst,  
+  void*                  pTxBd, 
+  wpt_uint16             usMpduLength);
+#endif /*WLAN_PERF*/
+
+/**
+ @brief WDI_DP_UtilsInit - Intializes the parameters required to 
+        interact with the data path
+  
+ @param       pWDICtx:    pointer to the main WDI Ctrl Block
+  
+ @return   success always
+*/
+WDI_Status 
+WDI_DP_UtilsInit
+(
+  WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief WDI_DP_UtilsExit - Clears the parameters required to
+        interact with the data path
+  
+ @param       pWDICtx:    pointer to the main WDI Ctrl Block
+  
+ @return   success always
+*/
+WDI_Status
+WDI_DP_UtilsExit
+( 
+    WDI_ControlBlockType*  pWDICtx
+);
+
+#endif /*WLAN_QCT_WDI_DP_H*/
+
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
new file mode 100644
index 0000000..264c907
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -0,0 +1,4893 @@
+/*
+ * 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 WLAN_QCT_WDI_I_H
+#define WLAN_QCT_WDI_I_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+              I N T E R N A L     A P I       F O R    T H E
+                                 D A T A   P A T H 
+                
+                   
+DESCRIPTION
+  This file contains the internal API exposed by the DAL Control Path Core 
+  module to be used by the DAL Data Path Core. 
+  
+      
+  Copyright (c) 2010 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
+--------    ---    ----------------------------------------------------------
+10/05/11    hap     Adding support for Keep Alive
+08/19/10    lti     Created module.
+
+===========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_list.h"
+#include "wlan_qct_pal_sync.h"
+#include "wlan_qct_pal_timer.h"
+#include "wlan_qct_wdi_cts.h" 
+#include "wlan_qct_wdi_bd.h" 
+
+#include "wlan_hal_msg.h"
+#include "wlan_status_code.h"
+#include "wlan_qct_dev_defs.h"
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*Assert macro - redefined for WDI so it is more flexible in disabling*/
+#define WDI_ASSERT(_cond) WPAL_ASSERT(_cond)
+
+/*Error codes that can be returned by WDI - the HAL Error codes are not 
+ propagated outside WDI because they are too explicit when refering to RIVA
+ HW errors - they are masked under dev internal failure*/
+#define WDI_ERR_BASIC_OP_FAILURE           0 
+#define WDI_ERR_TRANSPORT_FAILURE          1 
+#define WDI_ERR_INVALID_RSP_FMT            2 
+#define WDI_ERR_RSP_TIMEOUT                3 
+#define WDI_ERR_DEV_INTERNAL_FAILURE       4
+
+/*In prima 12 HW stations are supported including BCAST STA(staId 0)
+ and SELF STA(staId 1) so total ASSOC stations which can connect to Prima
+ SoftAP = 12 - 1(Self STa) - 1(Bcast Sta) = 10 Stations. */
+#define WDI_MAX_SUPPORTED_STAS    12 
+#define WDI_MAX_SUPPORTED_BSS     5 
+
+/* Control transport channel size*/
+#define WDI_CT_CHANNEL_SIZE 4096
+
+/*Invalid BSS index ! TO DO: Must come from the HAL header file*/
+#define WDI_BSS_INVALID_IDX 0xFF
+
+#ifdef ANI_MANF_DIAG
+#define WDI_FTM_MAX_RECEIVE_BUFFER   6500
+#endif /* ANI_MANF_DIAG */
+
+/*---------------------------------------------------------------------------
+  DAL Control Path Main States
+---------------------------------------------------------------------------*/      
+typedef enum
+{
+  /* Transition in this state made upon creation and when a close request is 
+     received*/
+  WDI_INIT_ST = 0,      
+
+  /* Transition happens after a Start response was received from HAL (as a
+  result of a previously sent HAL Request)*/
+  WDI_STARTED_ST,     
+
+  /* Transition happens when a Stop request was received */
+  WDI_STOPPED_ST, 
+
+  /* Transition happens when a request is being sent down to HAL and we are
+    waiting for the response */
+  WDI_BUSY_ST,  
+
+  /* Transition happens when 'SSR' shutdown request is recieved.*/
+  WDI_SHUTDOWN_ST,
+
+  WDI_MAX_ST
+}WDI_MainStateType;
+
+
+/*---------------------------------------------------------------------------
+  DAL Control Path Scan States
+---------------------------------------------------------------------------*/      
+typedef enum
+{
+  /*The flag will be set to this state when init is called. Once the flag has   
+    this value the only two scanning API calls allowed are Scan Start and 
+    Scan Finished*/
+  WDI_SCAN_INITIALIZED_ST = 0, 
+
+  /*The flag will be set to this value once the Start Scan API is called.   
+    When the flag has this value only Scan End API will be allowed. */
+  WDI_SCAN_STARTED_ST     = 1, 
+
+  /*The flag will be set to this value when End Scan API is called. When the   
+    flag is set to this value the only two Scan APIs allowed are Start and 
+    Finish. */
+  WDI_SCAN_ENDED_ST       = 2, 
+
+  /*The flag will be set to this value in the beginning before init is called   
+    and after the Finish API is called. No other scan APIs will be allowed 
+    in this state until Scan Init is called again. */
+  WDI_SCAN_FINISHED_ST    = 3,
+
+  WDI_SCAN_MAX_ST
+}WDI_ScanStateType;
+
+/*--------------------------------------------------------------------------- 
+   WLAN DAL BSS Session Type - used to allow simulatneous association
+   and keep track of each associated session 
+ ---------------------------------------------------------------------------*/
+#define WDI_MAX_BSS_SESSIONS  10
+
+typedef enum
+{
+  /*Init state*/
+  WDI_ASSOC_INIT_ST, 
+
+  /*Joining State*/
+  WDI_ASSOC_JOINING_ST, 
+
+  /*Associated state*/
+  WDI_ASSOC_POST_ST,
+
+  WDI_ASSOC_MAX_ST
+}WDI_AssocStateType;
+
+/*--------------------------------------------------------------------------- 
+   WLAN DAL Supported Request Types
+ ---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*WLAN DAL START Request*/
+  WDI_START_REQ  = 0, 
+
+  /*WLAN DAL STOP Request*/
+  WDI_STOP_REQ   = 1, 
+
+  /*WLAN DAL STOP Request*/
+  WDI_CLOSE_REQ  = 2, 
+
+
+  /*SCAN*/
+  /*WLAN DAL Init Scan Request*/
+  WDI_INIT_SCAN_REQ    = 3, 
+
+  /*WLAN DAL Start Scan Request*/
+  WDI_START_SCAN_REQ   = 4, 
+
+  /*WLAN DAL End Scan Request*/
+  WDI_END_SCAN_REQ     = 5, 
+
+  /*WLAN DAL Finish Scan Request*/
+  WDI_FINISH_SCAN_REQ  = 6, 
+
+
+  /*ASSOCIATION*/
+  /*WLAN DAL Join Request*/
+  WDI_JOIN_REQ          = 7, 
+
+  /*WLAN DAL Config BSS Request*/
+  WDI_CONFIG_BSS_REQ    = 8, 
+
+  /*WLAN DAL Del BSS Request*/
+  WDI_DEL_BSS_REQ       = 9, 
+
+  /*WLAN DAL Post Assoc Request*/
+  WDI_POST_ASSOC_REQ    = 10, 
+
+  /*WLAN DAL Del STA Request*/
+  WDI_DEL_STA_REQ       = 11, 
+
+  /*Security*/
+  /*WLAN DAL Set BSS Key Request*/
+  WDI_SET_BSS_KEY_REQ   = 12,
+  
+  /*WLAN DAL Remove BSS Key Request*/ 
+  WDI_RMV_BSS_KEY_REQ   = 13,
+  
+  /*WLAN DAL Set STA Key Request*/ 
+  WDI_SET_STA_KEY_REQ   = 14,
+  
+  /*WLAN DAL Remove STA Key Request*/ 
+  WDI_RMV_STA_KEY_REQ   = 15, 
+
+  /*QOS and BA*/
+  /*WLAN DAL Add TSpec Request*/
+  WDI_ADD_TS_REQ        = 16,
+  
+  /*WLAN DAL Delete TSpec Request*/ 
+  WDI_DEL_TS_REQ        = 17,
+  
+  /*WLAN DAL Update EDCA Params Request*/ 
+  WDI_UPD_EDCA_PRMS_REQ = 18,
+
+  /*WLAN DAL Add BA Session Request*/
+  WDI_ADD_BA_SESSION_REQ = 19,
+
+  /*WLAN DAL Delete BA Request*/ 
+  WDI_DEL_BA_REQ        = 20,
+
+   /* Miscellaneous Control */
+  /*WLAN DAL Channel Switch Request*/ 
+  WDI_CH_SWITCH_REQ     = 21,
+  
+  /*WLAN DAL Config STA Request*/ 
+  WDI_CONFIG_STA_REQ    = 22, 
+
+  /*WLAN DAL Set Link State Request*/ 
+  WDI_SET_LINK_ST_REQ   = 23,
+  
+  /*WLAN DAL Get Stats Request*/ 
+  WDI_GET_STATS_REQ     = 24, 
+
+ /*WLAN DAL Update Config Request*/ 
+  WDI_UPDATE_CFG_REQ    = 25, 
+
+  /* WDI ADD BA Request */
+  WDI_ADD_BA_REQ        = 26,
+
+  /* WDI Trigger BA Request */
+  WDI_TRIGGER_BA_REQ    = 27,
+
+  /*WLAN DAL Update Beacon Params Request*/ 
+  WDI_UPD_BCON_PRMS_REQ = 28,
+
+  /*WLAN DAL Send Beacon template Request*/ 
+  WDI_SND_BCON_REQ      = 29,
+
+  /*WLAN DAL Send Probe Response Template Request*/ 
+  WDI_UPD_PROBE_RSP_TEMPLATE_REQ = 30,
+
+  /*WLAN DAL Set STA Bcast Key Request*/ 
+  WDI_SET_STA_BCAST_KEY_REQ      = 31,
+  
+  /*WLAN DAL Remove STA Bcast Key Request*/ 
+  WDI_RMV_STA_BCAST_KEY_REQ      = 32, 
+
+  /*WLAN DAL Set Max Tx Power Request*/
+  WDI_SET_MAX_TX_POWER_REQ       = 33,
+  
+  /* WLAN DAL P2P GO Notice Of Absence Request */
+  WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ    = 34,
+
+  /*WLAN DAL Enter IMPS Request*/ 
+  WDI_ENTER_IMPS_REQ    = 35, 
+
+  /*WLAN DAL Exit IMPS Request*/ 
+  WDI_EXIT_IMPS_REQ     = 36, 
+
+  /*WLAN DAL Enter BMPS Request*/ 
+  WDI_ENTER_BMPS_REQ    = 37, 
+
+  /*WLAN DAL Exit BMPS Request*/ 
+  WDI_EXIT_BMPS_REQ     = 38, 
+
+  /*WLAN DAL Enter UAPSD Request*/ 
+  WDI_ENTER_UAPSD_REQ   = 39, 
+
+  /*WLAN DAL Exit UAPSD Request*/ 
+  WDI_EXIT_UAPSD_REQ    = 40, 
+
+  /*WLAN DAL Set UAPSD Param Request*/  
+  WDI_SET_UAPSD_PARAM_REQ = 41, 
+
+  /*WLAN DAL Update UAPSD Param (SoftAP mode) Request*/
+  WDI_UPDATE_UAPSD_PARAM_REQ = 42, 
+
+  /*WLAN DAL Configure RXP filter Request*/
+  WDI_CONFIGURE_RXP_FILTER_REQ = 43, 
+
+  /*WLAN DAL Configure Beacon filter Request*/
+  WDI_SET_BEACON_FILTER_REQ = 44, 
+
+  /*WLAN DAL Remove Beacon filter Request*/
+  WDI_REM_BEACON_FILTER_REQ = 45, 
+
+  /*WLAN DAL Set RSSI thresholds Request*/
+  WDI_SET_RSSI_THRESHOLDS_REQ = 46, 
+
+  /*WLAN DAL host offload Request*/
+  WDI_HOST_OFFLOAD_REQ = 47, 
+
+  /*WLAN DAL add wowl bc ptrn Request*/
+  WDI_WOWL_ADD_BC_PTRN_REQ = 48, 
+
+  /*WLAN DAL delete wowl bc ptrn Request*/
+  WDI_WOWL_DEL_BC_PTRN_REQ = 49, 
+
+  /*WLAN DAL enter wowl Request*/
+  WDI_WOWL_ENTER_REQ = 50, 
+
+  /*WLAN DAL exit wowl Request*/
+  WDI_WOWL_EXIT_REQ = 51, 
+
+  /*WLAN DAL Configure Apps CPU Wakeup state Request*/
+  WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ = 52, 
+
+  /* WLAN  NV Download Request */
+  WDI_NV_DOWNLOAD_REQ   = 53,
+  /*WLAN DAL Flush AC Request*/ 
+  WDI_FLUSH_AC_REQ      = 54, 
+
+  /*WLAN DAL BT AMP event Request*/ 
+  WDI_BTAMP_EVENT_REQ   = 55, 
+  /*WLAN DAL Aggregated Add TSpec Request*/
+  WDI_AGGR_ADD_TS_REQ   = 56,
+
+  WDI_ADD_STA_SELF_REQ       = 57,
+
+  WDI_DEL_STA_SELF_REQ       = 58,
+
+  /* WLAN FTM Command request */
+  WDI_FTM_CMD_REQ            = 59,
+
+  /*WLAN START INNAV MEAS Request*/
+  WDI_START_INNAV_MEAS_REQ   = 60,
+  /* WLAN host resume request */
+  WDI_HOST_RESUME_REQ      = 61,
+  
+  WDI_KEEP_ALIVE_REQ       = 62,  
+
+  /* Set PNO */
+  WDI_SET_PREF_NETWORK_REQ     = 63,
+
+  /*RSSI Filter Request*/
+  WDI_SET_RSSI_FILTER_REQ      = 64,
+
+  /* Update Scan Parameters*/
+  WDI_UPDATE_SCAN_PARAMS_REQ   = 65,
+
+  WDI_SET_TX_PER_TRACKING_REQ = 66,
+
+  WDI_8023_MULTICAST_LIST_REQ                   = 67,
+  WDI_RECEIVE_FILTER_SET_FILTER_REQ             = 68,
+  WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ  = 69,
+  WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ           = 70,
+  
+  /*This is temp fix. Should be removed once 
+   * Host and Riva code is in sync*/
+  WDI_INIT_SCAN_CON_REQ                         = 71, 
+
+  /* WLAN HAL DUMP Command request */
+  WDI_HAL_DUMP_CMD_REQ                          = 72,
+
+  /* WLAN DAL Shutdown Request */
+  WDI_SHUTDOWN_REQ                              = 73,
+
+  /*Set power parameters on the device*/
+  WDI_SET_POWER_PARAMS_REQ                      = 74,
+
+  /* Traffic Stream Metrics statistic request */
+  WDI_TSM_STATS_REQ                             = 75,
+  /* GTK Rekey Offload */
+  WDI_GTK_OFFLOAD_REQ             = 76, 
+  WDI_GTK_OFFLOAD_GETINFO_REQ   = 77, 
+
+  /*Set Thermal Migration level to RIVA*/
+  WDI_SET_TM_LEVEL_REQ                          = 78, 
+
+  /* Send a capability exchange message to HAL */
+  WDI_FEATURE_CAPS_EXCHANGE_REQ                 = 79,
+
+  WDI_MAX_REQ,
+
+  /*Send a suspend Indication down to HAL*/
+  WDI_HOST_SUSPEND_IND          = WDI_MAX_REQ ,
+
+  /*Keep adding the indications to the max request
+    such that we keep them sepparate */
+
+  WDI_MAX_UMAC_IND
+}WDI_RequestEnumType; 
+
+/*--------------------------------------------------------------------------- 
+   WLAN DAL Supported Response Types
+ ---------------------------------------------------------------------------*/
+typedef enum
+{
+  /*WLAN DAL START Response*/
+  WDI_START_RESP  = 0, 
+
+  /*WLAN DAL STOP Response*/
+  WDI_STOP_RESP   = 1, 
+
+  /*WLAN DAL STOP Response*/
+  WDI_CLOSE_RESP  = 2, 
+
+  /*SCAN*/
+  /*WLAN DAL Init Scan Response*/
+  WDI_INIT_SCAN_RESP    = 3, 
+
+  /*WLAN DAL Start Scan Response*/
+  WDI_START_SCAN_RESP   = 4, 
+
+  /*WLAN DAL End Scan Response*/
+  WDI_END_SCAN_RESP     = 5, 
+
+  /*WLAN DAL Finish Scan Response*/
+  WDI_FINISH_SCAN_RESP  = 6, 
+
+
+  /*ASSOCIATION*/
+  /*WLAN DAL Join Response*/
+  WDI_JOIN_RESP          = 7, 
+
+  /*WLAN DAL Config BSS Response*/
+  WDI_CONFIG_BSS_RESP    = 8, 
+
+  /*WLAN DAL Del BSS Response*/
+  WDI_DEL_BSS_RESP       = 9, 
+
+  /*WLAN DAL Post Assoc Response*/
+  WDI_POST_ASSOC_RESP    = 10, 
+
+  /*WLAN DAL Del STA Response*/
+  WDI_DEL_STA_RESP       = 11, 
+
+  /*WLAN DAL Set BSS Key Response*/
+  WDI_SET_BSS_KEY_RESP   = 12,
+  
+  /*WLAN DAL Remove BSS Key Response*/ 
+  WDI_RMV_BSS_KEY_RESP   = 13,
+  
+  /*WLAN DAL Set STA Key Response*/ 
+  WDI_SET_STA_KEY_RESP   = 14,
+  
+  /*WLAN DAL Remove STA Key Response*/ 
+  WDI_RMV_STA_KEY_RESP   = 15, 
+
+  /*WLAN DAL Add TSpec Response*/
+  WDI_ADD_TS_RESP        = 16,
+  
+  /*WLAN DAL Delete TSpec Response*/ 
+  WDI_DEL_TS_RESP        = 17,
+  
+  /*WLAN DAL Update EDCA Params Response*/ 
+  WDI_UPD_EDCA_PRMS_RESP = 18,
+
+  /*WLAN DAL Add BA Session Response*/
+  WDI_ADD_BA_SESSION_RESP = 19,
+
+  /*WLAN DAL Delete BA Response*/ 
+  WDI_DEL_BA_RESP        = 20,
+
+  /*WLAN DAL Channel Switch Response*/ 
+  WDI_CH_SWITCH_RESP     = 21,
+  
+  /*WLAN DAL Config STA Response*/ 
+  WDI_CONFIG_STA_RESP    = 22, 
+
+  /*WLAN DAL Set Link State Response*/ 
+  WDI_SET_LINK_ST_RESP   = 23,
+  
+  /*WLAN DAL Get Stats Response*/ 
+  WDI_GET_STATS_RESP     = 24, 
+
+  /*WLAN DAL Update Config Response*/ 
+  WDI_UPDATE_CFG_RESP    = 25, 
+
+  /* WDI ADD BA Response */
+  WDI_ADD_BA_RESP        = 26,
+
+  /* WDI Trigger BA Response */
+  WDI_TRIGGER_BA_RESP    = 27,
+
+ /*WLAN DAL Update beacon params  Response*/
+  WDI_UPD_BCON_PRMS_RESP = 28,
+  
+ /*WLAN DAL Send beacon template Response*/
+  WDI_SND_BCON_RESP = 29,
+
+  /*WLAN DAL Update Probe Response Template Response*/
+  WDI_UPD_PROBE_RSP_TEMPLATE_RESP = 30,
+
+  /*WLAN DAL Set STA Key Response*/ 
+  WDI_SET_STA_BCAST_KEY_RESP      = 31,
+  
+  /*WLAN DAL Remove STA Key Response*/ 
+  WDI_RMV_STA_BCAST_KEY_RESP      = 32, 
+
+  /*WLAN DAL Set Max Tx Power Response*/
+  WDI_SET_MAX_TX_POWER_RESP       = 33,
+
+  /*WLAN DAL Enter IMPS Response*/ 
+  WDI_ENTER_IMPS_RESP     = 34, 
+
+  /*WLAN DAL Exit IMPS Response*/ 
+  WDI_EXIT_IMPS_RESP      = 35, 
+
+  /*WLAN DAL Enter BMPS Response*/ 
+  WDI_ENTER_BMPS_RESP    = 36, 
+
+  /*WLAN DAL Exit BMPS Response*/ 
+  WDI_EXIT_BMPS_RESP      = 37, 
+
+  /*WLAN DAL Enter UAPSD Response*/ 
+  WDI_ENTER_UAPSD_RESP    = 38, 
+
+  /*WLAN DAL Exit UAPSD Response*/ 
+  WDI_EXIT_UAPSD_RESP     = 39, 
+
+  /*WLAN DAL Set UAPSD Param Response*/  
+  WDI_SET_UAPSD_PARAM_RESP = 40, 
+
+  /*WLAN DAL Update UAPSD Param (SoftAP mode) Response*/
+  WDI_UPDATE_UAPSD_PARAM_RESP = 41, 
+
+  /*WLAN DAL Configure RXP filter Response*/
+  WDI_CONFIGURE_RXP_FILTER_RESP = 42, 
+
+  /*WLAN DAL Set Beacon filter Response*/
+  WDI_SET_BEACON_FILTER_RESP = 43, 
+
+  /*WLAN DAL Remove Beacon filter Response*/
+  WDI_REM_BEACON_FILTER_RESP = 44, 
+
+  /*WLAN DAL Set RSSI thresholds Response*/
+  WDI_SET_RSSI_THRESHOLDS_RESP = 45, 
+
+  /*WLAN DAL Set RSSI thresholds Response*/
+  WDI_HOST_OFFLOAD_RESP = 46, 
+
+  /*WLAN DAL add wowl bc ptrn Response*/
+  WDI_WOWL_ADD_BC_PTRN_RESP = 47, 
+
+  /*WLAN DAL delete wowl bc ptrn Response*/
+  WDI_WOWL_DEL_BC_PTRN_RESP = 48, 
+
+  /*WLAN DAL enter wowl Response*/
+  WDI_WOWL_ENTER_RESP = 49, 
+
+  /*WLAN DAL exit wowl Response*/
+  WDI_WOWL_EXIT_RESP = 50, 
+
+  /*WLAN DAL Configure Apps CPU Wakeup state Response*/
+  WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP = 51,
+  
+  /* WLAN NV Download responce */
+  WDI_NV_DOWNLOAD_RESP = 52,
+
+  /*WLAN DAL Flush AC Response*/ 
+  WDI_FLUSH_AC_RESP      = 53,
+
+  /*WLAN DAL Flush AC Response*/ 
+  WDI_BTAMP_EVENT_RESP   = 54,
+
+  /*WLAN DAL Add Aggregated TSpec Response*/
+  WDI_AGGR_ADD_TS_RESP  = 55,
+
+  /*Add Self STA Response*/
+  WDI_ADD_STA_SELF_RESP = 56,
+  
+  /*Delete Self STA Response*/
+  WDI_DEL_STA_SELF_RESP       = 57,
+
+  /*WLAN START INNAV MEAS Response*/
+  WDI_START_INNAV_MEAS_RESP   = 58,
+
+  /* WLAN host resume request */
+  WDI_HOST_RESUME_RESP        = 59,
+
+  /* WLAN DAL P2P GO Notice Of Absence Response */
+  WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP    = 60,
+
+  /* FTM Response from HAL */
+  WDI_FTM_CMD_RESP                     = 61,
+
+  /*Keep alive response */
+  WDI_KEEP_ALIVE_RESP                  = 62,
+
+  /* Set PNO Response */
+  WDI_SET_PREF_NETWORK_RESP            = 63,
+
+  /* Set RSSI Filter Response */
+  WDI_SET_RSSI_FILTER_RESP             = 64,
+
+  /* Update Scan Parameters Resp */
+  WDI_UPDATE_SCAN_PARAMS_RESP          = 65,
+
+  //Tx PER Tracking
+  WDI_SET_TX_PER_TRACKING_RESP       = 66,
+
+
+  
+  /* Packet Filtering Response */
+  WDI_8023_MULTICAST_LIST_RESP                  = 67,
+
+  WDI_RECEIVE_FILTER_SET_FILTER_RESP            = 68,
+
+  WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP = 69,
+
+  WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP          = 70,
+
+  
+  /* WLAN HAL DUMP Command Response */
+  WDI_HAL_DUMP_CMD_RESP                         = 71,
+
+  /* WLAN Shutdown Response */
+  WDI_SHUTDOWN_RESP                             = 72,
+
+  /*Set power parameters response */
+  WDI_SET_POWER_PARAMS_RESP                     = 73,
+
+  WDI_TSM_STATS_RESP                            = 74,
+  /* GTK Rekey Offload */
+  WDI_GTK_OFFLOAD_RESP                    = 75, 
+  WDI_GTK_OFFLOAD_GETINFO_RESP         = 76, 
+
+  WDI_SET_TM_LEVEL_RESP                         = 77,
+
+  /* FW sends its capability bitmap as a response */
+  WDI_FEATURE_CAPS_EXCHANGE_RESP                = 78,
+
+  /*-------------------------------------------------------------------------
+    Indications
+     !! Keep these last in the enum if possible
+    -------------------------------------------------------------------------*/
+  WDI_HAL_IND_MIN                     , 
+  /*When RSSI monitoring is enabled of the Lower MAC and a threshold has been
+    passed. */
+  WDI_HAL_RSSI_NOTIFICATION_IND       = WDI_HAL_IND_MIN, 
+
+  /*Link loss in the low MAC */
+  WDI_HAL_MISSED_BEACON_IND           = WDI_HAL_IND_MIN + 1,
+
+  /*When hardware has signaled an unknown addr2 frames. The indication will
+  contain info from frames to be passed to the UMAC, this may use this info to
+  deauth the STA*/
+  WDI_HAL_UNKNOWN_ADDR2_FRAME_RX_IND  = WDI_HAL_IND_MIN + 2,
+
+  /*MIC Failure detected by HW*/
+  WDI_HAL_MIC_FAILURE_IND             = WDI_HAL_IND_MIN + 3,
+
+  /*Fatal Error Ind*/
+  WDI_HAL_FATAL_ERROR_IND             = WDI_HAL_IND_MIN + 4, 
+
+  /*Received when the RIVA SW decides to autonomously delete an associate
+    station (e.g. Soft AP TIM based dissassoc) */
+  WDI_HAL_DEL_STA_IND                 = WDI_HAL_IND_MIN + 5,
+
+  /*Coex indication*/
+  WDI_HAL_COEX_IND                    = WDI_HAL_IND_MIN + 6,
+
+  /* Tx Complete Indication */
+  WDI_HAL_TX_COMPLETE_IND             = WDI_HAL_IND_MIN + 7,
+
+  WDI_HAL_P2P_NOA_ATTR_IND            = WDI_HAL_IND_MIN + 8,
+
+  /* Preferred Network Found Indication */
+  WDI_HAL_PREF_NETWORK_FOUND_IND      = WDI_HAL_IND_MIN + 9,
+
+  /* Wakeup Reason Indication */
+  WDI_HAL_WAKE_REASON_IND              = WDI_HAL_IND_MIN + 10,
+
+  /* Tx PER Hit Indication */
+  WDI_HAL_TX_PER_HIT_IND              = WDI_HAL_IND_MIN + 11,
+  
+  WDI_MAX_RESP
+}WDI_ResponseEnumType; 
+
+typedef struct 
+{
+  /*Flag that marks a session as being in use*/
+  wpt_boolean         bInUse; 
+
+  /*Flag that keeps track if a series of assoc requests for this BSS are
+    currently pending in the queue or processed
+    - the flag is set to true when the Join request ends up being queued
+    - and reset to false when the Pending queue is empty */
+  wpt_boolean         bAssocReqQueued;
+
+  /*BSSID of the session*/
+  wpt_macAddr         macBSSID; 
+
+  /*BSS Index associated with this BSSID*/
+  wpt_uint8           ucBSSIdx; 
+
+  /*Associated state of the current BSS*/
+  WDI_AssocStateType  wdiAssocState;
+
+  /*WDI Pending Request Queue*/
+  wpt_list            wptPendingQueue;
+
+  /*DPU Information for this BSS*/
+  wpt_uint8           bcastDpuIndex;
+  wpt_uint8           bcastDpuSignature;
+  wpt_uint8           bcastMgmtDpuIndex;
+  wpt_uint8           bcastMgmtDpuSignature;
+
+  /*RMF enabled/disabled*/
+  wpt_uint8           ucRmfEnabled;
+
+  /*Bcast STA ID associated with this BSS session */
+  wpt_uint8           bcastStaIdx;
+
+  /*The type of the BSS in the session */
+  WDI_BssType         wdiBssType;
+}WDI_BSSSessionType;
+
+/*---------------------------------------------------------------------------
+  WDI_ConfigBSSRspInfoType
+---------------------------------------------------------------------------*/
+typedef WPT_PACK_PRE struct 
+{
+  /*BSS index allocated by HAL*/
+  wpt_uint8    ucBSSIdx;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr  macBSSID; 
+
+  /*Broadcast DPU descriptor index allocated by HAL and used for
+  broadcast/multicast packets.*/
+  wpt_uint8    ucBcastDpuDescIndx;
+
+  /*DPU signature to be used for broadcast/multicast packets*/
+  wpt_uint8    ucBcastDpuSignature;
+  
+  /*DPU descriptor index allocated by HAL, used for bcast/mcast management
+  packets*/
+  wpt_uint8    ucMgmtDpuDescIndx;
+
+  /*DPU signature to be used for bcast/mcast management packets*/
+  wpt_uint8    ucMgmtDpuSignature;
+
+  /*Status of the request received from HAL */
+  eHalStatus   halStatus;
+}WPT_PACK_POST WDI_ConfigBSSRspInfoType;
+
+
+/*---------------------------------------------------------------------------
+  WDI_PostAssocRspInfoType
+---------------------------------------------------------------------------*/
+typedef WPT_PACK_PRE struct
+{
+  /*STA Index allocated by HAL.*/
+  wpt_uint16   usSTAIdx;
+  
+  /*MAC Address of STA*/ 
+  wpt_macAddr  macSTA;
+  
+  /*Unicast DPU signature*/
+  wpt_uint8    ucUcastSig;
+
+  /*Broadcast DPU Signature*/
+  wpt_uint8    ucBcastSig;
+
+  /*BSSID of the BSS*/
+  wpt_macAddr  macBSSID; 
+
+  /*HAL Status */
+  eHalStatus   halStatus;
+}WPT_PACK_POST WDI_PostAssocRspInfoType;
+
+/*--------------------------------------------------------------------------- 
+   WLAN DAL FSM Event Info Type 
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Events can be linked in a list - put a node in front for that, it will be
+   used by wpt to link them*/
+  wpt_list_node          wptListNode; 
+
+  /*Request Received */
+  WDI_RequestEnumType    wdiRequest;
+
+  /*Response Received */
+  WDI_ResponseEnumType   wdiResponse;
+
+  /*Data associated with the request */
+  void*                  pEventData;
+
+  /*Data Size*/
+  wpt_uint32             uEventDataSize;
+
+  /*Callback function for receiving the response to the event*/
+  void*                  pCBfnc;
+
+  /*User data to be sent along with the CB function call*/
+  void*                  pUserData;
+}WDI_EventInfoType; 
+
+/*--------------------------------------------------------------------------- 
+   WLAN DAL Session Index Type
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*Events can be linked in a list - put a node in front for that, it will be
+   used by wpt to link them*/
+  wpt_list_node          wptListNode; 
+
+  /*Session id for the new association to be processed*/
+  wpt_uint8              ucIndex; 
+
+}WDI_NextSessionIdType; 
+
+#define WDI_CONTROL_BLOCK_MAGIC  0x67736887  /* WDIC in little endian */
+/*--------------------------------------------------------------------------- 
+   WLAN DAL Control Block Type 
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+  /*magic number so callbacks can validate their context pointers*/
+  wpt_uint32                  magic;
+
+  /*Ptr to the OS Context received from the UMAC*/
+  void*                       pOSContext;
+
+  /*Ptr to the PAL Context received from PAL*/
+  void*                       pPALContext; 
+
+  /*Ptr to the Datapath Context received from PAL*/
+  void*                       pDPContext; 
+
+  /*Ptr to the Datapath Transport Driver Context received from PAL*/
+  void*                       pDTDriverContext; 
+
+  /*Hanlde to the control transport service*/
+  WCTS_HandleType             wctsHandle;
+
+  /*Flag that keeps track if CT is Opened or not*/
+  wpt_boolean                 bCTOpened;
+
+  /*The global state of the DAL Control Path*/
+  WDI_MainStateType           uGlobalState; 
+
+  /*Flag to keep track of the expected state transition after processing
+    of a response */
+  WDI_MainStateType           ucExpectedStateTransition;
+
+  /*Main Synchronization Object for the WDI CB*/
+  wpt_mutex                   wptMutex;
+
+  /*WDI response timer*/
+  wpt_timer                   wptResponseTimer;
+
+  /*WDI Pending Request Queue*/
+  wpt_list                    wptPendingQueue;
+#if 0
+  /*The state of the DAL during a scanning procedure*/
+  WDI_ScanStateType           uScanState;  
+
+  /*Flag that keeps track if a Scan is currently in progress*/
+  wpt_boolean                 bScanInProgress;
+#endif
+  /*Flag that keeps track if an Association is currently in progress*/
+  wpt_boolean                 bAssociationInProgress; 
+
+  /*Array of simultaneous BSS Sessions*/
+  WDI_BSSSessionType          aBSSSessions[WDI_MAX_BSS_SESSIONS];
+
+  /*WDI Pending Association Session Id Queue - it keeps track of the
+    order in which queued assoc requests came in*/
+  wpt_list                    wptPendingAssocSessionIdQueue;
+
+  /*! TO DO : - group these in a union, only one cached req can exist at a
+      time  */
+
+  /*Cached post assoc request - there can only be one in the system as
+    only one request goes down to hal up until a response is received
+    The values cached are used on response to save a station if needed */
+  WDI_PostAssocReqParamsType  wdiCachedPostAssocReq; 
+
+  /*Cached config sta request - there can only be one in the system as
+    only one request goes down to hal up until a response is received
+    The values cached are used on response to save a station if needed */
+  WDI_ConfigSTAReqParamsType  wdiCachedConfigStaReq; 
+
+  /*Cached config sta request - there can only be one in the system as
+    only one request goes down to hal up until a response is received
+    The values cached are used on response to save a BSS if needed */
+  WDI_ConfigBSSReqParamsType  wdiCachedConfigBssReq; 
+
+  /*Cached set link state request - there can only be one in the system as
+    only one request goes down to hal up until a response is received
+    The values cached are used on response to delete a BSS if needed */
+  WDI_SetLinkReqParamsType     wdiCacheSetLinkStReq; 
+
+  /*Cached add STA self request - there can only be one in the system as
+    only one request goes down to hal up until a response is received
+    The values cached are used on response to save the self STA in the table */
+  WDI_AddSTASelfReqParamsType  wdiCacheAddSTASelfReq;
+
+  /*Current session being handled*/
+  wpt_uint8                   ucCurrentBSSSesIdx;
+
+  /*Pointer to the response CB of the pending request*/
+  void*                       pfncRspCB;
+
+  /*Pointer to the user data to be sent along with the response CB*/
+  void*                       pRspCBUserData; 
+
+  /*The expected response from HAL*/
+  WDI_ResponseEnumType        wdiExpectedResponse;
+
+  /*Request status callback offered by UMAC - it is called if the current
+    req has returned PENDING as status; it delivers the status of sending
+    the message over the BUS */
+  WDI_ReqStatusCb             wdiReqStatusCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the above
+    function pointer will be called */
+  void*                       pReqStatusUserData;
+
+   /*Indication callback given by UMAC to be called by the WLAN DAL when it
+    wishes to send something back independent of a request*/
+  WDI_LowLevelIndCBType       wdiLowLevelIndCB; 
+
+  /*The user data passed in by UMAC, it will be sent back when the indication
+    function pointer will be called */
+  void*                       pIndUserData;
+
+  /*Cached start response parameters*/
+  WDI_StartRspParamsType      wdiCachedStartRspParams;
+  
+  /* Information related to NV Image*/
+  WDI_NvBlobInfoParams        wdiNvBlobInfo;
+
+  /*STA Table Information*/
+  /*Max number of stations allowed by device */
+  wpt_uint8                   ucMaxStations;
+
+  /*Max number of BSSes allowed by device */
+  wpt_uint8                   ucMaxBssids;
+
+  /* Global BSS and STA table -  Memory is allocated when needed.*/
+  void*                       staTable;
+
+#ifndef HAL_SELF_STA_PER_BSS
+  /*Index of the Self STA */
+  wpt_uint8                   ucSelfStaId;
+
+  /* Self STA DPU Index */
+  wpt_uint16                  usSelfStaDpuId;
+
+  /*Self STA Mac*/
+  wpt_macAddr                 macSelfSta;
+#endif
+
+  /*Is frame translation enabled */
+  wpt_uint8                   bFrameTransEnabled;
+
+  /*AMSDU BD Fix Mask - used by the Fixing routine for Data Path */
+  WDI_RxBdType                wdiRxAmsduBdFixMask;
+
+  /*First AMSDU BD - used by the Fixing routine for Data Path */
+  WDI_RxBdType                wdiRxAmsduFirstBdCache;
+
+  /*This must be incremented on sta change */
+  wpt_uint32                  uBdSigSerialNum;
+
+  /* dpu routing flag
+  ! TO DO: - must be set/reset when PS is enabled for UAPSD */  
+  wpt_uint8                   ucDpuRF;    
+  /* Event to wait for when WCTS is told to perform an action */
+  wpt_event                   wctsActionEvent;
+  /* Event to wait for ACK from DXE after the power state is set */
+  wpt_event                   setPowerStateEvent;
+  /* DXE physical addr to be passed down to RIVA. RIVA HAL will use it to program
+  DXE when DXE wakes up from power save*/
+  unsigned int                dxePhyAddr;
+
+  /*NV download request parameters  */
+  WDI_NvDownloadReqParamsType   wdiCachedNvDownloadReq;
+
+  /* Driver Type */
+  tDriverType                 driverMode;  
+
+#ifdef ANI_MANF_DIAG
+  /* Statically allocated FTM Response Buffer */
+  wpt_uint8                   ucFTMCommandRspBuffer[WDI_FTM_MAX_RECEIVE_BUFFER];
+#endif /* ANI_MANF_DIAG */
+
+  /*Driver in BMPS state*/
+  wpt_boolean                 bInBmps;
+
+  /*version of the PNO implementation in RIVA*/
+  wpt_uint8                   wdiPNOVersion;
+}WDI_ControlBlockType; 
+
+
+
+
+/*---------------------------------------------------------------------------
+
+  DESCRIPTION 
+    WLAN DAL Request Processing function definition. 
+    
+  PARAMETERS 
+
+   IN
+   pWDICtx:         pointer to the WLAN DAL context 
+   pEventData:      pointer to the event information structure 
+ 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+---------------------------------------------------------------------------*/
+typedef WDI_Status (*WDI_ReqProcFuncType)( WDI_ControlBlockType*  pWDICtx,
+                                           WDI_EventInfoType*     pEventData);
+
+
+/*---------------------------------------------------------------------------
+
+  DESCRIPTION 
+    WLAN DAL Response Processing function definition. 
+    
+  PARAMETERS 
+
+   IN
+   pWDICtx:         pointer to the WLAN DAL context 
+   pEventData:      pointer to the event information structure 
+ 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+---------------------------------------------------------------------------*/
+typedef WDI_Status (*WDI_RspProcFuncType)( WDI_ControlBlockType*  pWDICtx,
+                                           WDI_EventInfoType*     pEventData);
+
+
+
+
+/*==========================================================================
+              MAIN DAL FSM Definitions and Declarations 
+==========================================================================*/
+
+/*--------------------------------------------------------------------------- 
+   DAL Control Path Main FSM  
+ ---------------------------------------------------------------------------*/
+#define WDI_STATE_TRANSITION(_pctx, _st)   (_pctx->uGlobalState = _st)
+
+
+
+/*---------------------------------------------------------------------------
+  DAL Main Event type
+---------------------------------------------------------------------------*/      
+typedef enum
+{
+  /* Start request received from UMAC */
+  WDI_START_EVENT          = 0,
+
+  /* Stop request received from UMAC */
+  WDI_STOP_EVENT           = 1,
+
+  /* HAL request received from UMAC*/
+  WDI_REQUEST_EVENT        = 2,
+
+  /* HAL Response received from device */
+  WDI_RESPONSE_EVENT       = 3,
+
+  /* Close request received from UMAC */
+  WDI_CLOSE_EVENT          = 4,
+
+  /* Shutdown request received from UMAC */
+  WDI_SHUTDOWN_EVENT       = 5,
+
+  WDI_MAX_EVENT
+
+}WDI_MainEventType;
+
+/*---------------------------------------------------------------------------
+
+  DESCRIPTION 
+    Main DAL state machine function definition. 
+    
+  PARAMETERS 
+
+   IN
+   pWDICtx:         pointer to the WLAN DAL context 
+   pEventData:      pointer to the event information structure 
+ 
+   
+  RETURN VALUE
+    The result code associated with performing the operation  
+
+---------------------------------------------------------------------------*/
+typedef WDI_Status (*WDI_MainFuncType)( WDI_ControlBlockType*  pWDICtx,
+                                        WDI_EventInfoType*     pEventData);
+
+/*---------------------------------------------------------------------------
+  MAIN DAL FSM Entry type
+---------------------------------------------------------------------------*/      
+typedef struct
+{
+  WDI_MainFuncType  pfnMainTbl[WDI_MAX_EVENT];
+} WDI_MainFsmEntryType;
+
+/*Macro to check for valid session id*/
+#define WDI_VALID_SESSION_IDX(_idx)  ( _idx < WDI_MAX_BSS_SESSIONS ) 
+
+/*========================================================================== 
+ 
+                      DAL INTERNAL FUNCTION DECLARATION
+ 
+==========================================================================*/ 
+
+/**
+ @brief Helper routine for retrieving the PAL Context from WDI - 
+        can be used by CTS, DTS, DXE and othe DAL internals 
+ 
+ @param  None
+  
+ @see
+ @return pointer to the context 
+*/
+WPT_INLINE void* WDI_GET_PAL_CTX( void );
+
+/*---------------------------------------------------------------------------
+                    MAIN DAL FSM Function Declarations
+---------------------------------------------------------------------------*/      
+/**
+ @brief WDI_PostMainEvent - Posts an event to the Main FSM
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         wdiEV:           event posted to the main DAL FSM
+         pEventData:      pointer to the event information
+         structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_PostMainEvent
+(
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_MainEventType      wdiEV, 
+  WDI_EventInfoType*     pEventData
+  
+);
+
+/*--------------------------------------------------------------------------
+  INIT State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStart
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Response function for state INIT
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainRspInit
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Close function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+        
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainClose
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/*--------------------------------------------------------------------------
+  STARTED State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for state STARTED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+      
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStartStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Stop function for state STARTED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+         uEventDataSize:  size of the data sent in event
+         pCBfnc:          cb function for event response
+         pUserData:       user data 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Request function for state started
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+        
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainReqStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Response function for all states except INIT
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/*--------------------------------------------------------------------------
+  STOPPED State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Stop function for state STOPPED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopStopped
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+  );
+
+/*--------------------------------------------------------------------------
+  BUSY State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStartBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Stop function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Request function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainReqBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Close function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainCloseBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Shutdown function for INIT & STARTED states
+
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainShutdown
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Main FSM Shutdown function for BUSY state
+
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainShutdownBusy
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/*========================================================================
+          Main DAL Control Path Request Processing API 
+========================================================================*/
+
+/**
+ @brief Process Start Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Stop Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStopReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Close Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCloseReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Shutdown Request function (called when Main FSM
+        allows it)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessShutdownReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Init Scan Request function (called when Main FSM
+        allows it)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessInitScanReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Start Scan Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process End Scan Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEndScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Finish Scan Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFinishScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Join Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessJoinReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Config BSS Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigBSSReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Del BSS Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBSSReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Post Assoc Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPostAssocReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Del STA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set BSS Key Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBssKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove BSS Key Request function (called when Main    
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveBssKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set STA KeyRequest function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove STA Key Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set STA KeyRequest function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaBcastKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove STA Key Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaBcastKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Del TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update EDCA Params Request function (called when
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateEDCAParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBASessionReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Del BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef FEATURE_WLAN_CCX
+/**
+ @brief Process TSM Stats Request function (called when Main FSM
+        allows it)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTSMStatsReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif
+
+/**
+ @brief Process Channel Switch Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessChannelSwitchReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Config STA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigStaReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Set Link State Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetLinkStateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Get Stats Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGetStatsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Cfg Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateCfgReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Trigger BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTriggerBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Beacon Params Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateBeaconParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Beacon template Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSendBeaconParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Beacon Params  Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateProbeRspTemplateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+/**
+ @brief Process NV blob download function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessNvDownloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set Max Tx Power Request function (called when Main    
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_ProcessSetMaxTxPowerReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ @brief Process P2P Notice Of Absence Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2PGONOAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif
+
+/**
+ @brief Process Enter IMPS Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterImpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit IMPS Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitImpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Enter BMPS Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterBmpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit BMPS Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitBmpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Enter UAPSD Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterUapsdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit UAPSD Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitUapsdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set UAPSD params Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetUapsdAcParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process update UAPSD params Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateUapsdParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Configure RXP filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureRxpFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set beacon filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBeaconFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process remove beacon filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemBeaconFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set RSSI thresholds Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRSSIThresholdsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set RSSI thresholds Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostOffloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Keep Alive Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessKeepAliveReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Wowl add bc ptrn Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlAddBcPtrnReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Wowl delete bc ptrn Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlDelBcPtrnReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Wowl enter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlEnterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Wowl exit Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlExitReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Configure Apps Cpu Wakeup State Request function
+        (called when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureAppsCpuWakeupStateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Flush AC Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFlushAcReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Host Resume Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostResumeReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process BT AMP event Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBtAmpEventReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add STA self Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddSTASelfReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Del Sta Self Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTASelfReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set Tx Per Tracking configurations Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPerTrackingReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set Power Params Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPowerParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set Thermal Mitigation level Changed request
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTmLevelReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/*=========================================================================
+                             Indications
+=========================================================================*/
+
+/**
+ @brief Process Suspend Indications function (called when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostSuspendInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/*========================================================================
+          Main DAL Control Path Response Processing API 
+========================================================================*/
+
+
+/**
+ @brief Process Start Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Stop Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStopRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Close Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCloseRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Shutdown Rsp function
+        There is no shutdown response comming from HAL
+        - function just kept for simmetry
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessShutdownRsp
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Init Scan Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessInitScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Start Scan Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process End Scan Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEndScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Finish Scan Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFinishScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Join Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessJoinRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Config BSS Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigBSSRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Del BSS Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBSSRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Post Assoc Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPostAssocRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Del STA Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set BSS Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBssKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove BSS Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveBssKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Set STA Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove STA Key Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Set STA Bcast Key Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaBcastKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Remove STA Bcast Key Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaBcastKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Del TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update EDCA Parameters Rsp function (called when a  
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateEDCAParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBASessionRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Del BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef FEATURE_WLAN_CCX
+/**
+ @brief Process TSM stats Rsp function (called when a response
+        is being received over the bus from HAL)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTsmStatsRsp
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#endif
+
+
+/**
+ @brief Process Channel Switch Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessChannelSwitchRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Config STA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigStaRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Set Link State Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetLinkStateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Get Stats Rsp function (called when a response is   
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGetStatsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Update Cfg Rsp function (called when a response is  
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateCfgRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTriggerBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Beacon Params Rsp function (called when a response is  
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateBeaconParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Send Beacon template Rsp function (called when a response is  
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSendBeaconParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Probe Resp Template Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateProbeRspTemplateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+  /**
+ @brief Process Set Max Tx Power Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetMaxTxPowerRsp
+( 
+  WDI_ControlBlockType*          pWDICtx,
+  WDI_EventInfoType*             pEventData
+);
+
+/**
+ @brief Process Nv download(called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessNvDownloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ @brief Process P2P Group Owner Notice Of Absense Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2PGONOARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif
+
+/**
+ @brief Process Enter IMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterImpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit IMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitImpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Enter BMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterBmpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit BMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitBmpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Enter UAPSD Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterUapsdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Exit UAPSD Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitUapsdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set UAPSD params Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetUapsdAcParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process update UAPSD params Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateUapsdParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Configure RXP filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureRxpFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set beacon filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBeaconFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process remove beacon filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemBeaconFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set RSSI thresholds Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRSSIThresoldsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process host offload Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostOffloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Keep Alive Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessKeepAliveRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process wowl add ptrn Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlAddBcPtrnRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process wowl delete ptrn Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlDelBcPtrnRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process wowl enter Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlEnterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process wowl exit Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlExitRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Configure Apps CPU wakeup State Rsp function 
+        (called when a response is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureAppsCpuWakeupStateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+/**
+ @brief Process Flush AC Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFlushAcRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process BT AMP event Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBtAmpEventRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process ADD SELF STA Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddSTASelfRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+ /**
+ @brief WDI_ProcessDelSTASelfRsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTASelfRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+ /**
+ @brief WDI_ProcessHostResumeRsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostResumeRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process set tx per tracking Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPerTrackingRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Power Params Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPowerParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set TM Level Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTmLevelRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/*==========================================================================
+                        Indications from HAL
+ ==========================================================================*/
+/**
+ @brief Process Low RSSI Indication function (called when an 
+        indication of this kind is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessLowRSSIInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Missed Beacon Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessMissedBeaconInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process Unk Addr Frame Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUnkAddrFrameInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+
+/**
+ @brief Process MIC Failure Indication function (called when an 
+        indication of this kind is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessMicFailureInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Fatal Failure Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFatalErrorInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Delete STA Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTAInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+*@brief Process Coex Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCoexInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+*@brief Process Tx Complete Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTxCompleteInd
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef WLAN_FEATURE_P2P
+/**
+*@brief Process Noa Attr Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2pNoaAttrInd
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif
+
+/**
+*@brief Process Tx Per Hit Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTxPerHitInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/**
+ @brief Process Aggrgated Add TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAggrAddTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Add TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAggrAddTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+/**
+ @brief WDI_ProcessFTMCommandReq
+        Process FTM Command, simply route to HAL
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFTMCommandReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief WDI_ProcessFTMCommandRsp
+        Process FTM Command Response from HAL, simply route to HDD FTM
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFTMCommandRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif /* ANI_MANF_DIAG */
+/**
+ @brief WDI_ProcessHALDumpCmdReq
+        Process Hal Dump Command, simply route to HAL
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHALDumpCmdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief WDI_ProcessHALDumpCmdRsp
+        Process Hal Dump Command Response from HAL, simply route to HDD FTM
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHALDumpCmdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+/*========================================================================
+         Internal Helper Routines 
+========================================================================*/
+
+/**
+ @brief WDI_CleanCB - internal helper routine used to clean the 
+        WDI Main Control Block
+ 
+ @param pWDICtx - pointer to the control block
+
+ @return Result of the function call
+*/
+WPT_INLINE WDI_Status
+WDI_CleanCB
+(
+  WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief Main FSM Close function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WPT_INLINE WDI_Status
+WDI_ProcessRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Get message helper function - it allocates memory for a 
+        message that is to be sent to HAL accross the bus and
+        prefixes it with a send message header 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         wdiReqType:      type of the request being sent
+         uBufferLen:      message buffer len
+         pMsgBuffer:      resulting allocated buffer
+         puDataOffset:    offset in the buffer where the caller
+         can start copying its message data
+         puBufferSize:    the resulting buffer size (offset+buff
+         len)
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_GetMessageBuffer
+( 
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_RequestEnumType    wdiReqType, 
+  wpt_uint16             usBufferLen,
+  wpt_uint8**            pMsgBuffer, 
+  wpt_uint16*            pusDataOffset, 
+  wpt_uint16*            pusBufferSize
+);
+
+/**
+ @brief WDI_DetectedDeviceError - called internally by DAL when 
+        it has detected a failure in the device 
+ 
+ @param  pWDICtx:        pointer to the WLAN DAL context 
+         usErrorCode:    error code detected by WDI or received
+                         from HAL
+  
+ @see
+ @return None 
+*/
+void
+WDI_DetectedDeviceError
+(
+  WDI_ControlBlockType*  pWDICtx,
+  wpt_uint16             usErrorCode
+);
+
+/*=========================================================================
+                   QUEUE SUPPORT UTILITY FUNCTIONS 
+=========================================================================*/
+
+/**
+ @brief    Utility function used by the DAL Core to help queue a 
+           request that cannot be processed right away. 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: - pointer to the evnt info that needs to be
+    queued 
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueuePendingReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief    Utility function used by the DAL Core to clear any 
+           pending requests - all req cb will be called with
+           failure and the queue will be emptied.
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_ClearPendingRequests
+( 
+  WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief    This callback is invoked by the wpt when a timer that 
+           we started on send message has expire - this should
+           never happen - it means device is stuck and cannot
+           reply - trigger catastrophic failure 
+ @param 
+    
+    pUserData: the callback data of the user (ptr to WDI CB)
+    
+ @see 
+ @return None 
+*/
+void 
+WDI_ResponseTimerCB
+(
+  void *pUserData
+);
+
+/*==========================================================================
+                     CONTRL TRANSPORT INTERACTION
+ 
+    Callback function registered with the control transport - for receiving
+    notifications and packets 
+==========================================================================*/
+/**
+ @brief    This callback is invoked by the control transport 
+   when it wishes to send up a notification like the ones
+   mentioned above.
+ 
+ @param
+    
+    wctsHandle:       handle to the control transport service 
+    wctsEvent:        the event being notified
+    wctsNotifyCBData: the callback data of the user 
+    
+ @see  WCTS_OpenTransport
+  
+ @return None 
+*/
+void 
+WDI_NotifyMsgCTSCB
+(
+  WCTS_HandleType        wctsHandle, 
+  WCTS_NotifyEventType   wctsEvent,
+  void*                  wctsNotifyCBData
+);
+
+/**
+ @brief    This callback is invoked by the control transport 
+           when it wishes to send up a packet received over the
+           bus.
+ 
+ @param
+    
+    wctsHandle:  handle to the control transport service 
+    pMsg:        the packet
+    uLen:        the packet length
+    wctsRxMsgCBData: the callback data of the user 
+    
+ @see  WCTS_OpenTransport
+  
+ @return None 
+*/
+void 
+WDI_RXMsgCTSCB 
+(
+  WCTS_HandleType       wctsHandle, 
+  void*                 pMsg,
+  wpt_uint32            uLen,
+  void*                 wctsRxMsgCBData
+);
+
+/**
+ @brief Process response helper function 
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessResponse
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Send message helper function - sends a message over the 
+        bus using the control tranport and saves some info in
+        the CB 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pSendBuffer:     buffer to be sent
+  
+         uSendSize          size of the buffer to be sent
+         pRspCb:            response callback - save in the WDI
+         CB
+         pUserData:         user data associated with the
+         callback
+         wdiExpectedResponse: the code of the response that is
+         expected to be rx-ed for this request
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SendMsg
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
+  wpt_uint32             uSendSize, 
+  void*                  pRspCb, 
+  void*                  pUserData,
+  WDI_ResponseEnumType   wdiExpectedResponse
+);
+
+
+/**
+ @brief Send indication helper function - sends a message over 
+        the bus using the control transport and saves some info
+        in the CB
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pSendBuffer:     buffer to be sent
+         usSendSize: size of the buffer to be sent
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SendIndication
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
+  wpt_uint32             usSendSize
+);
+
+/**
+ @brief    Utility function used by the DAL Core to help dequeue
+           and schedule for execution a pending request 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: - pointer to the evnt info that needs to be
+    queued 
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_DequeuePendingReq
+(
+  WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief    Utility function used by the DAL Core to help queue 
+           an association request that cannot be processed right
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: pointer to the evnt info that needs to be queued
+    macBSSID: bssid
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueueNewAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData,
+  wpt_macAddr            macBSSID
+); 
+
+/**
+ @brief    Utility function used by the DAL Core to help queue 
+           an association request that cannot be processed right
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pSession: - session in which to queue
+    pEventData: pointer to the event info that needs to be
+    queued
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueueAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_BSSSessionType*    pSession,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief    Utility function used by the DAL Core to help dequeue
+           an association request that was pending
+           The request will be queued up in front of the main
+           pending queue for immediate processing
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+  
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_DequeueAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief Helper routine used to init the BSS Sessions in the WDI control block 
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
+ @see
+*/
+void
+WDI_ResetAssocSessions
+( 
+  WDI_ControlBlockType*   pWDICtx
+);
+
+/**
+ @brief Helper routine used to find an empty session in the WDI 
+        CB
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindEmptySession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_BSSSessionType**    ppSession
+);
+
+/**
+ @brief Helper routine used to get the total count of active 
+        sessions
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
+ @see
+ @return Number of sessions in use
+*/
+wpt_uint8
+WDI_GetActiveSessionsCount
+( 
+  WDI_ControlBlockType*   pWDICtx
+);
+
+/**
+ @brief Helper routine used to delete session in the WDI 
+        CB
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
+ @see
+ @return Index of the session in the array 
+*/
+void 
+WDI_DeleteSession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_BSSSessionType*     ppSession
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         macBSSID:  BSSID of the session
+         ppSession: out pointer to the session (if found)
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_macAddr             macBSSID,
+  WDI_BSSSessionType**    ppSession
+);
+
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         usBssIdx:  BSS Index of the session
+         ppSession: out pointer to the session (if found)
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSessionByBSSIdx
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_uint16              usBssIdx,
+  WDI_BSSSessionType**    ppSession
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         usBssIdx:  BSS Index of the session
+         ppSession: out pointer to the session (if found)
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSessionByIdx
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_uint16              usBssIdx,
+  WDI_BSSSessionType**    ppSession
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDPContext:   pointer to the Datapath context 
+  
+ @see
+ @return 
+*/
+WPT_INLINE void 
+WDI_DS_AssignDatapathContext 
+(
+  void *pContext, 
+  void *pDPContext
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+  
+ @see
+ @return pointer to Datapath context
+*/
+WPT_INLINE void * 
+WDI_DS_GetDatapathContext 
+(
+  void *pContext
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDTDriverContext:   pointer to the Transport Driver context 
+  
+ @see
+ @return void
+*/
+WPT_INLINE void  
+WDT_AssignTransportDriverContext 
+(
+  void *pContext, 
+  void *pDTDriverContext
+);
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+  
+ @see
+ @return pointer to datapath context 
+*/
+WPT_INLINE void * 
+WDT_GetTransportDriverContext 
+(
+  void *pContext
+);
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/**
+ @brief Process Set Preferred Network List Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPreferredNetworkReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Set RSSI Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRssiFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Scan Params function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateScanParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Preferred Network Found Indication function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPrefNetworkFoundInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process PNO Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPreferredNetworkRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process RSSI Filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRssiFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Update Scan Params Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateScanParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+/**
+ @brief Process 8023 Multicast List Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Process8023MulticastListReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Receive Filter Set Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterSetFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process D0 PC Filter Match Count Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFilterMatchCountReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Receive Filter Clear Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterClearFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process 8023 Multicast List Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Process8023MulticastListRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Receive Filter Set Filter Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterSetFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process D0 PC Filter Match Count Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFilterMatchCountRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Receive Filter Clear Filter Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterClearFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/**
+ @brief Process set GTK Offload Request function 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process GTK Offload Get Information Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadGetInfoReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process host offload Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGtkOffloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process GTK Offload Get Information Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadGetInfoRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+WDI_Status
+WDI_ProcessWakeReasonInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+#endif // WLAN_WAKEUP_EVENTS
+
+/**
+ @brief Process Host-FW Capability Exchange Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFeatureCapsExchangeReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+/**
+ @brief Process Host-FW Capability Exchange Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFeatureCapsExchangeRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+#endif /*WLAN_QCT_WDI_I_H*/
+
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h b/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
new file mode 100644
index 0000000..f0ea7c5
--- /dev/null
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
@@ -0,0 +1,446 @@
+/*
+ * 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 WLAN_QCT_DAL_STA_H
+#define WLAN_QCT_DAL_STA_H
+
+/*===========================================================================
+
+         W L A N   D E V I C E   A B S T R A C T I O N   L A Y E R 
+              I N T E R N A L     A P I       F O R    T H E
+                       S T A T I O N    M G M T
+                
+                   
+DESCRIPTION
+  This file contains the internal API exposed by the STA Management entity to
+  be used by the DAL Control Path Core . 
+  
+      
+  Copyright (c) 2010 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
+--------    ---    ----------------------------------------------------------
+08/19/10    lti     Created module.
+
+===========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_api.h"
+
+/*----------------------------------------------------------------------------
+     Preprocesor definitions and macros 
+  -------------------------------------------------------------------------*/
+/*Invalid station index */
+#define WDI_STA_INVALID_IDX 0xFF
+
+/*----------------------------------------------------------------------------
+  WDI_AddStaParams
+  -------------------------------------------------------------------------*/
+typedef struct 
+{
+  wpt_uint8    ucSTAIdx; 
+  wpt_uint8    ucWmmEnabled;
+  wpt_uint8    ucHTCapable; 
+
+  /* MAC Address of STA */
+  wpt_macAddr staMacAddr;
+
+  /*MAC Address of the BSS*/
+  wpt_macAddr  macBSSID;
+
+  /* Field to indicate if this is sta entry for itself STA adding entry for itself
+     or remote (AP adding STA after successful association.
+     This may or may not be required in production driver.
+     0 - Self, 1 other/remote, 2 - bssid */
+  wpt_uint8   ucStaType;       
+
+
+  /*DPU Information*/
+  wpt_uint8   dpuIndex;                      // DPU table index
+  wpt_uint8   dpuSig;                        // DPU signature
+  wpt_uint8   bcastDpuIndex;
+  wpt_uint8   bcastDpuSignature;
+  wpt_uint8   bcastMgmtDpuIndex;
+  wpt_uint8   bcastMgmtDpuSignature;
+
+
+  /*RMF enabled/disabled*/
+  wpt_uint8   ucRmfEnabled;
+
+  /* Index into the BSS Session table */
+  wpt_uint8   ucBSSIdx;
+
+}WDI_AddStaParams; 
+
+/*----------------------------------------------------------------------------
+  WDI_StaStruct
+  -------------------------------------------------------------------------*/
+typedef struct
+{
+  wpt_macAddr staAddr;                // Sta Addr
+     
+  wpt_uint8 valid:1;                           // Used/free flag    
+  wpt_uint8 rmfEnabled:1;
+  wpt_uint8 htEnabled:1;
+
+  /* 11e or WMM enabled, flag used for header length*/
+  wpt_uint8 qosEnabled:1;         
+
+  wpt_uint8 bssIdx;                         // BSS Index
+  wpt_uint8 staId;
+
+  wpt_macAddr macBSSID;
+  // Field to indicate if this is sta entry for itself STA adding entry for itself
+  // or remote (AP adding STA after successful association.
+  // This may or may not be required in production driver.
+  // 0 - Self, 1 other/remote, 2 - bssid
+  wpt_uint8   ucStaType;       
+
+
+  /*DPU Information*/
+  wpt_uint8 dpuIndex;                      // DPU table index
+  wpt_uint8 dpuSig;                        // DPU signature
+  wpt_uint8 bcastDpuIndex;
+  wpt_uint8 bcastDpuSignature;
+  wpt_uint8 bcastMgmtDpuIndex;
+  wpt_uint8 bcastMgmtDpuSignature;
+     
+} WDI_StaStruct;
+
+/**
+ @brief WDI_STATableInit - Initializes the STA tables. 
+        Allocates the necesary memory.
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_STATableInit
+(
+   WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief WDI_STATableStart - resets the max and number values of 
+        STAtions
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableStart
+(
+    WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief WDI_STATableStop - clears the sta table
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableStop
+(
+    WDI_ControlBlockType*  pWDICtx
+);
+
+/**
+ @brief WDI_STATableClose - frees the resources used by the STA 
+        table.
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableClose
+(
+  WDI_ControlBlockType*  pWDICtx
+);
+
+
+/**
+ @brief WDI_STATableAddSta - Function to Add Station
+
+ 
+ @param  pWDICtx:     pointer to the WLAN DAL context 
+         pwdiParam:   station parameters  
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableAddSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    WDI_AddStaParams*      pwdiParam
+);
+
+/**
+ @brief WDI_STATableDelSta - Function to Delete a Station
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station to be deleted
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableDelSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8              ucSTAIdx
+);
+
+/**
+ @brief WDI_STATableBSSDelSta - Function to Delete Stations in this BSS
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         bssIdx:        BSS index 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableBSSDelSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8              ucBssIdx
+);
+
+/**
+ @brief WDI_STATableGetStaBSSIDAddr - Gets the BSSID associated 
+        with this station
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station index
+         pmacBSSID:      out BSSID for this STA
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaBSSIDAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr*           pmacBSSID
+);
+/**
+ @brief WDI_STATableGetStaQosEnabled - Gets is qos is enabled 
+        for a sta
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station index
+         qosEnabled:      out qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaQosEnabled
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8*             qosEnabled
+);
+
+/**
+ @brief WDI_STATableSetStaQosEnabled - set qos mode for STA
+
+ 
+ @param  pWDICtx:    pointer to the WLAN DAL context 
+         ucSTAIdx:   station index
+         qosEnabled: qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaQosEnabled
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              qosEnabled
+);
+
+/**
+ @brief WDI_STATableGetStaType - get sta type for STA
+
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucSTAIdx:  station index
+         pStaType:  qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaType
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8*             pStaType
+);
+
+/**
+ @brief WDI_STATableSetStaType - sets sta type for STA
+
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucSTAIdx:  station index
+         staType:   sta type
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaType
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              staType
+);
+
+
+/**
+ @brief WDI_STATableFindStaidByAddr - Given a station mac address, search
+        for the corresponding station index from the Station Table.
+ 
+ @param  pWDICtx:  WDI Context pointer
+         staAddr:  station address
+         pucStaId: output station id 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableFindStaidByAddr
+(
+    WDI_ControlBlockType*  pWDICtx, 
+    wpt_macAddr            staAddr, 
+    wpt_uint8*             pucStaId
+);
+
+/**
+ @brief WDI_STATableGetStaAddr - get station address
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:  station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8**            pStaAddr
+);
+
+/**
+ @brief WDI_STATableSetStaAddr - set station address
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr            staAddr
+);
+
+/**
+ @brief WDI_STATableSetBSSID - set station corresponding BSSID
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetBSSID
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr            macBSSID
+);
+
+/**
+ @brief WDI_STATableSetBSSIdx - set station corresponding BSS index
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         bssIdx:   BSS index 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetBSSIdx
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              ucBSSIdx
+);
+
+#endif /*WLAN_QCT_WDI_STA_H*/
+
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
new file mode 100644
index 0000000..a9a9536
--- /dev/null
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -0,0 +1,24105 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ W D I. C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Device Abstraction     
+  Layer Interface.
+
+  The functions externalized by this module are to be called by any upper     
+  MAC implementation that wishes to use the WLAN Device.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 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
+----------    ---    --------------------------------------------------------
+10/05/11      hap     Adding support for Keep Alive
+2010-08-09    lti     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_wdi.h" 
+#include "wlan_qct_wdi_i.h" 
+#include "wlan_qct_wdi_sta.h" 
+#include "wlan_qct_wdi_dp.h" 
+
+#include "wlan_qct_wdi_cts.h" 
+
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_sync.h"
+#include "wlan_qct_pal_msg.h"
+#include "wlan_qct_pal_trace.h"
+#include "wlan_qct_pal_packet.h"
+
+#include "wlan_qct_wdi_dts.h" 
+
+#include "wlan_hal_msg.h"
+
+#ifdef ANI_MANF_DIAG
+#include "pttMsgApi.h"
+#endif /* ANI_MANF_DIAG */
+
+/*===========================================================================
+   WLAN DAL Control Path Internal Data Definitions and Declarations 
+ ===========================================================================*/
+#define WDI_WCTS_ACTION_TIMEOUT       2000 /* in msec a very high upper limit */
+
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+#define WDI_PNO_VERSION_MASK 0x8000
+#endif
+
+/* host capability bitmap global */
+static tWlanFeatCaps *gpHostWlanFeatCaps = NULL;
+/* FW capability bitmap global */
+static tWlanFeatCaps *gpFwWlanFeatCaps = NULL;
+/* array of features supported. Need to add a new feature
+ * and other two places - wlan_hal_msg.h and halMsg.c (FW file)
+ */
+static placeHolderInCapBitmap supportEnabledFeatures[] =
+   {MCC, P2P};
+
+/*-------------------------------------------------------------------------- 
+   WLAN DAL  State Machine
+ --------------------------------------------------------------------------*/
+WPT_STATIC const WDI_MainFsmEntryType wdiMainFSM[WDI_MAX_ST] = 
+{
+  /*WDI_INIT_ST*/
+  {{
+    WDI_MainStart,              /*WDI_START_EVENT*/
+    NULL,                       /*WDI_STOP_EVENT*/
+    WDI_MainReqBusy,            /*WDI_REQUEST_EVENT*/
+    WDI_MainRspInit,            /*WDI_RESPONSE_EVENT*/
+    WDI_MainClose,              /*WDI_CLOSE_EVENT*/
+    WDI_MainShutdown            /*WDI_SHUTDOWN_EVENT*/
+  }},
+
+  /*WDI_STARTED_ST*/
+  {{
+    WDI_MainStartStarted,       /*WDI_START_EVENT*/
+    WDI_MainStopStarted,        /*WDI_STOP_EVENT*/
+    WDI_MainReqStarted,         /*WDI_REQUEST_EVENT*/
+    WDI_MainRsp,                /*WDI_RESPONSE_EVENT*/
+    NULL,                       /*WDI_CLOSE_EVENT*/
+    WDI_MainShutdown            /*WDI_SHUTDOWN_EVENT*/
+  }},
+
+  /*WDI_STOPPED_ST*/
+  {{
+    WDI_MainStart,              /*WDI_START_EVENT*/
+    WDI_MainStopStopped,        /*WDI_STOP_EVENT*/
+    NULL,                       /*WDI_REQUEST_EVENT*/
+    WDI_MainRsp,                /*WDI_RESPONSE_EVENT*/
+    WDI_MainClose,              /*WDI_CLOSE_EVENT*/
+    NULL                        /*WDI_SHUTDOWN_EVENT*/
+  }},
+
+  /*WDI_BUSY_ST*/
+  {{
+    WDI_MainStartBusy,          /*WDI_START_EVENT*/
+    WDI_MainStopBusy,           /*WDI_STOP_EVENT*/
+    WDI_MainReqBusy,            /*WDI_REQUEST_EVENT*/
+    WDI_MainRsp,                /*WDI_RESPONSE_EVENT*/
+    WDI_MainCloseBusy,          /*WDI_CLOSE_EVENT*/
+    WDI_MainShutdownBusy        /*WDI_SHUTDOWN_EVENT*/
+  }}
+};
+
+/*--------------------------------------------------------------------------- 
+  DAL Request Processing Array  - the functions in this table will only be
+  called when the processing of the specific request is allowed by the
+  Main FSM 
+ ---------------------------------------------------------------------------*/
+WDI_ReqProcFuncType  pfnReqProcTbl[WDI_MAX_UMAC_IND] = 
+{
+  /*INIT*/
+  WDI_ProcessStartReq,      /* WDI_START_REQ  */
+  WDI_ProcessStopReq,       /* WDI_STOP_REQ  */
+  WDI_ProcessCloseReq,      /* WDI_CLOSE_REQ  */
+
+  /*SCAN*/
+  WDI_ProcessInitScanReq,   /* WDI_INIT_SCAN_REQ  */
+  WDI_ProcessStartScanReq,  /* WDI_START_SCAN_REQ  */
+  WDI_ProcessEndScanReq,    /* WDI_END_SCAN_REQ  */
+  WDI_ProcessFinishScanReq, /* WDI_FINISH_SCAN_REQ  */
+
+  /*ASSOCIATION*/
+  WDI_ProcessJoinReq,       /* WDI_JOIN_REQ  */
+  WDI_ProcessConfigBSSReq,  /* WDI_CONFIG_BSS_REQ  */
+  WDI_ProcessDelBSSReq,     /* WDI_DEL_BSS_REQ  */
+  WDI_ProcessPostAssocReq,  /* WDI_POST_ASSOC_REQ  */
+  WDI_ProcessDelSTAReq,     /* WDI_DEL_STA_REQ  */
+
+  /* Security */
+  WDI_ProcessSetBssKeyReq,        /* WDI_SET_BSS_KEY_REQ  */
+  WDI_ProcessRemoveBssKeyReq,     /* WDI_RMV_BSS_KEY_REQ  */
+  WDI_ProcessSetStaKeyReq,        /* WDI_SET_STA_KEY_REQ  */
+  WDI_ProcessRemoveStaKeyReq,     /* WDI_RMV_BSS_KEY_REQ  */
+
+  /* QoS and BA APIs */
+  WDI_ProcessAddTSpecReq,          /* WDI_ADD_TS_REQ  */
+  WDI_ProcessDelTSpecReq,          /* WDI_DEL_TS_REQ  */
+  WDI_ProcessUpdateEDCAParamsReq,  /* WDI_UPD_EDCA_PRMS_REQ  */
+  WDI_ProcessAddBASessionReq,      /* WDI_ADD_BA_SESSION_REQ  */
+  WDI_ProcessDelBAReq,             /* WDI_DEL_BA_REQ  */
+
+  /* Miscellaneous Control APIs */
+  WDI_ProcessChannelSwitchReq,     /* WDI_CH_SWITCH_REQ  */
+  WDI_ProcessConfigStaReq,         /* WDI_CONFIG_STA_REQ  */
+  WDI_ProcessSetLinkStateReq,      /* WDI_SET_LINK_ST_REQ  */
+  WDI_ProcessGetStatsReq,          /* WDI_GET_STATS_REQ  */
+  WDI_ProcessUpdateCfgReq,         /* WDI_UPDATE_CFG_REQ  */
+
+  /*BA APIs*/
+  WDI_ProcessAddBAReq,             /* WDI_ADD_BA_REQ  */
+  WDI_ProcessTriggerBAReq,         /* WDI_TRIGGER_BA_REQ  */
+
+  /*Beacon processing APIs*/
+  WDI_ProcessUpdateBeaconParamsReq, /* WDI_UPD_BCON_PRMS_REQ */
+  WDI_ProcessSendBeaconParamsReq, /* WDI_SND_BCON_REQ */
+
+  WDI_ProcessUpdateProbeRspTemplateReq, /* WDI_UPD_PROBE_RSP_TEMPLATE_REQ */
+  WDI_ProcessSetStaBcastKeyReq,        /* WDI_SET_STA_BCAST_KEY_REQ  */
+  WDI_ProcessRemoveStaBcastKeyReq,     /* WDI_RMV_STA_BCAST_KEY_REQ  */
+  WDI_ProcessSetMaxTxPowerReq,         /*WDI_SET_MAX_TX_POWER_REQ*/
+#ifdef WLAN_FEATURE_P2P
+  WDI_ProcessP2PGONOAReq,              /* WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ */
+#else
+  NULL,
+#endif
+  /* PowerSave APIs */
+  WDI_ProcessEnterImpsReq,         /* WDI_ENTER_IMPS_REQ  */
+  WDI_ProcessExitImpsReq,          /* WDI_EXIT_IMPS_REQ  */
+  WDI_ProcessEnterBmpsReq,         /* WDI_ENTER_BMPS_REQ  */
+  WDI_ProcessExitBmpsReq,          /* WDI_EXIT_BMPS_REQ  */
+  WDI_ProcessEnterUapsdReq,        /* WDI_ENTER_UAPSD_REQ  */
+  WDI_ProcessExitUapsdReq,         /* WDI_EXIT_UAPSD_REQ  */
+  WDI_ProcessSetUapsdAcParamsReq,  /* WDI_SET_UAPSD_PARAM_REQ  */
+  WDI_ProcessUpdateUapsdParamsReq, /* WDI_UPDATE_UAPSD_PARAM_REQ  */
+  WDI_ProcessConfigureRxpFilterReq, /* WDI_CONFIGURE_RXP_FILTER_REQ  */
+  WDI_ProcessSetBeaconFilterReq,   /* WDI_SET_BEACON_FILTER_REQ  */
+  WDI_ProcessRemBeaconFilterReq,   /* WDI_REM_BEACON_FILTER_REQ  */
+  WDI_ProcessSetRSSIThresholdsReq, /* WDI_SET_RSSI_THRESHOLDS_REQ  */
+  WDI_ProcessHostOffloadReq,       /* WDI_HOST_OFFLOAD_REQ  */
+  WDI_ProcessWowlAddBcPtrnReq,     /* WDI_WOWL_ADD_BC_PTRN_REQ  */
+  WDI_ProcessWowlDelBcPtrnReq,     /* WDI_WOWL_DEL_BC_PTRN_REQ  */
+  WDI_ProcessWowlEnterReq,         /* WDI_WOWL_ENTER_REQ  */
+  WDI_ProcessWowlExitReq,          /* WDI_WOWL_EXIT_REQ  */
+  WDI_ProcessConfigureAppsCpuWakeupStateReq, /* WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ  */
+  /*NV Download APIs*/
+  WDI_ProcessNvDownloadReq,      /* WDI_NV_DOWNLOAD_REQ*/
+  WDI_ProcessFlushAcReq,           /* WDI_FLUSH_AC_REQ  */
+  WDI_ProcessBtAmpEventReq,        /* WDI_BTAMP_EVENT_REQ  */
+#ifdef WLAN_FEATURE_VOWIFI_11R
+  WDI_ProcessAggrAddTSpecReq,      /* WDI_AGGR_ADD_TS_REQ */
+#else
+  NULL,
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+  WDI_ProcessAddSTASelfReq,         /* WDI_ADD_STA_SELF_REQ */
+  WDI_ProcessDelSTASelfReq,          /* WDI DEL STA SELF REQ */
+#ifdef ANI_MANF_DIAG
+  WDI_ProcessFTMCommandReq,            /* WDI_FTM_CMD_REQ */
+#else
+  NULL,
+#endif /* ANI_MANF_DIAG */
+  
+  NULL,
+  WDI_ProcessHostResumeReq,            /*WDI_HOST_RESUME_REQ*/
+  
+  WDI_ProcessKeepAliveReq,       /* WDI_KEEP_ALIVE_REQ */    
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+  WDI_ProcessSetPreferredNetworkReq,  /* WDI_SET_PREF_NETWORK_REQ */
+  WDI_ProcessSetRssiFilterReq,        /* WDI_SET_RSSI_FILTER_REQ */
+  WDI_ProcessUpdateScanParamsReq,     /* WDI_UPDATE_SCAN_PARAMS_REQ */
+#else
+  NULL,
+  NULL,
+  NULL,
+#endif /* FEATURE_WLAN_SCAN_PNO */
+
+  WDI_ProcessSetTxPerTrackingReq,     /* WDI_SET_TX_PER_TRACKING_REQ  */
+  
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+  /* WDI_8023_MULTICAST_LIST_REQ */
+  WDI_Process8023MulticastListReq,          
+  /* WDI_RECEIVE_FILTER_SET_FILTER_REQ */
+  WDI_ProcessReceiveFilterSetFilterReq,     
+  /* WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ */
+  WDI_ProcessFilterMatchCountReq,    
+  /* WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ */
+  WDI_ProcessReceiveFilterClearFilterReq,   
+#else
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+#endif // WLAN_FEATURE_PACKET_FILTERING
+  WDI_ProcessInitScanReq,               /* WDI_INIT_SCAN_CON_REQ */ 
+  WDI_ProcessHALDumpCmdReq,             /*WDI_HAL_DUMP_CMD_REQ */
+  WDI_ProcessShutdownReq,               /* WDI_SHUTDOWN_REQ  */
+
+  WDI_ProcessSetPowerParamsReq,         /*WDI_SET_POWER_PARAMS_REQ*/
+#ifdef FEATURE_WLAN_CCX
+  WDI_ProcessTSMStatsReq,          /* WDI_TSM_STATS_REQ */
+#else
+  NULL,
+#endif
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+  WDI_ProcessGTKOffloadReq,          /* WDI_GTK_OFFLOAD_REQ  */
+  WDI_ProcessGTKOffloadGetInfoReq,   /* WDI_GTK_OFFLOAD_GETINFO_REQ  */
+#else
+  NULL,
+  NULL,
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+  WDI_ProcessSetTmLevelReq,             /*WDI_SET_TM_LEVEL_REQ*/
+  WDI_ProcessFeatureCapsExchangeReq,    /* WDI_FEATURE_CAPS_EXCHANGE_REQ */
+  /*-------------------------------------------------------------------------
+    Indications
+  -------------------------------------------------------------------------*/
+  WDI_ProcessHostSuspendInd,            /* WDI_HOST_SUSPEND_IND*/
+};
+
+
+/*--------------------------------------------------------------------------- 
+  DAL Request Processing Array  - the functions in this table will only be
+  called when the processing of the specific request is allowed by the
+  Main FSM 
+ ---------------------------------------------------------------------------*/
+WDI_RspProcFuncType  pfnRspProcTbl[WDI_MAX_RESP] = 
+{
+  /*INIT*/
+  WDI_ProcessStartRsp,            /* WDI_START_RESP  */
+  WDI_ProcessStopRsp,             /* WDI_STOP_RESP  */
+  WDI_ProcessCloseRsp,            /* WDI_CLOSE_RESP  */
+
+  /*SCAN*/
+  WDI_ProcessInitScanRsp,         /* WDI_INIT_SCAN_RESP  */
+  WDI_ProcessStartScanRsp,        /* WDI_START_SCAN_RESP  */
+  WDI_ProcessEndScanRsp,          /* WDI_END_SCAN_RESP  */
+  WDI_ProcessFinishScanRsp,       /* WDI_FINISH_SCAN_RESP  */
+
+  /* ASSOCIATION*/
+  WDI_ProcessJoinRsp,             /* WDI_JOIN_RESP  */
+  WDI_ProcessConfigBSSRsp,        /* WDI_CONFIG_BSS_RESP  */
+  WDI_ProcessDelBSSRsp,           /* WDI_DEL_BSS_RESP  */
+  WDI_ProcessPostAssocRsp,        /* WDI_POST_ASSOC_RESP  */
+  WDI_ProcessDelSTARsp,           /* WDI_DEL_STA_RESP  */
+
+  /* Security */
+  WDI_ProcessSetBssKeyRsp,        /* WDI_SET_BSS_KEY_RESP  */
+  WDI_ProcessRemoveBssKeyRsp,     /* WDI_RMV_BSS_KEY_RESP  */
+  WDI_ProcessSetStaKeyRsp,        /* WDI_SET_STA_KEY_RESP  */
+  WDI_ProcessRemoveStaKeyRsp,     /* WDI_RMV_BSS_KEY_RESP  */
+
+  /* QoS and BA APIs */
+  WDI_ProcessAddTSpecRsp,          /* WDI_ADD_TS_RESP  */
+  WDI_ProcessDelTSpecRsp,          /* WDI_DEL_TS_RESP  */
+  WDI_ProcessUpdateEDCAParamsRsp,  /* WDI_UPD_EDCA_PRMS_RESP  */
+  WDI_ProcessAddBASessionRsp,      /* WDI_ADD_BA_SESSION_RESP  */
+  WDI_ProcessDelBARsp,             /* WDI_DEL_BA_RESP  */
+
+  /* Miscellaneous Control APIs */
+  WDI_ProcessChannelSwitchRsp,     /* WDI_CH_SWITCH_RESP  */
+  WDI_ProcessConfigStaRsp,         /* WDI_CONFIG_STA_RESP  */
+  WDI_ProcessSetLinkStateRsp,      /* WDI_SET_LINK_ST_RESP  */
+  WDI_ProcessGetStatsRsp,          /* WDI_GET_STATS_RESP  */
+  WDI_ProcessUpdateCfgRsp,         /* WDI_UPDATE_CFG_RESP  */
+
+  /* BA APIs*/
+  WDI_ProcessAddBARsp,             /* WDI_ADD_BA_RESP  */
+  WDI_ProcessTriggerBARsp,         /* WDI_TRIGGER_BA_RESP  */
+  
+  /* IBSS APIs*/
+  WDI_ProcessUpdateBeaconParamsRsp, /* WDI_UPD_BCON_PRMS_RSP */
+  WDI_ProcessSendBeaconParamsRsp,   /* WDI_SND_BCON_RSP */
+
+  /*Soft AP APIs*/
+  WDI_ProcessUpdateProbeRspTemplateRsp,/*WDI_UPD_PROBE_RSP_TEMPLATE_RESP */
+  WDI_ProcessSetStaBcastKeyRsp,        /*WDI_SET_STA_BCAST_KEY_RESP */
+  WDI_ProcessRemoveStaBcastKeyRsp,     /*WDI_RMV_STA_BCAST_KEY_RESP */
+  WDI_ProcessSetMaxTxPowerRsp,         /*WDI_SET_MAX_TX_POWER_RESP */
+
+  /* PowerSave APIs */
+  WDI_ProcessEnterImpsRsp,         /* WDI_ENTER_IMPS_RESP  */
+  WDI_ProcessExitImpsRsp,          /* WDI_EXIT_IMPS_RESP  */
+  WDI_ProcessEnterBmpsRsp,         /* WDI_ENTER_BMPS_RESP  */
+  WDI_ProcessExitBmpsRsp,          /* WDI_EXIT_BMPS_RESP  */
+  WDI_ProcessEnterUapsdRsp,        /* WDI_ENTER_UAPSD_RESP  */
+  WDI_ProcessExitUapsdRsp,         /* WDI_EXIT_UAPSD_RESP  */
+  WDI_ProcessSetUapsdAcParamsRsp,  /* WDI_SET_UAPSD_PARAM_RESP  */
+  WDI_ProcessUpdateUapsdParamsRsp, /* WDI_UPDATE_UAPSD_PARAM_RESP  */
+  WDI_ProcessConfigureRxpFilterRsp,/* WDI_CONFIGURE_RXP_FILTER_RESP  */
+  WDI_ProcessSetBeaconFilterRsp,   /* WDI_SET_BEACON_FILTER_RESP  */
+  WDI_ProcessRemBeaconFilterRsp,   /* WDI_REM_BEACON_FILTER_RESP  */
+  WDI_ProcessSetRSSIThresoldsRsp,  /* WDI_SET_RSSI_THRESHOLDS_RESP  */
+  WDI_ProcessHostOffloadRsp,       /* WDI_HOST_OFFLOAD_RESP  */
+  WDI_ProcessWowlAddBcPtrnRsp,     /* WDI_WOWL_ADD_BC_PTRN_RESP  */
+  WDI_ProcessWowlDelBcPtrnRsp,     /* WDI_WOWL_DEL_BC_PTRN_RESP  */
+  WDI_ProcessWowlEnterRsp,         /* WDI_WOWL_ENTER_RESP  */
+  WDI_ProcessWowlExitRsp,          /* WDI_WOWL_EXIT_RESP  */
+  WDI_ProcessConfigureAppsCpuWakeupStateRsp, /* WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP  */
+  
+
+  WDI_ProcessNvDownloadRsp, /* WDI_NV_DOWNLOAD_RESP*/
+
+  WDI_ProcessFlushAcRsp,           /* WDI_FLUSH_AC_RESP  */
+  WDI_ProcessBtAmpEventRsp,        /* WDI_BTAMP_EVENT_RESP  */
+#ifdef WLAN_FEATURE_VOWIFI_11R
+  WDI_ProcessAggrAddTSpecRsp,       /* WDI_AGGR_ADD_TS_RESP  */
+#else
+  NULL,
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+  WDI_ProcessAddSTASelfRsp,          /* WDI_ADD_STA_SELF_RESP */
+  WDI_ProcessDelSTASelfRsp,          /* WDI_DEL_STA_SELF_RESP */
+  NULL,
+  WDI_ProcessHostResumeRsp,        /*WDI_HOST_RESUME_RESP*/
+
+#ifdef WLAN_FEATURE_P2P
+  WDI_ProcessP2PGONOARsp,           /*WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP */
+#else
+  NULL,
+#endif
+
+#ifdef ANI_MANF_DIAG
+  WDI_ProcessFTMCommandRsp,         /* WDI_FTM_CMD_RESP */
+#else
+  NULL,
+#endif /* ANI_MANF_DIAG */
+
+  WDI_ProcessKeepAliveRsp,       /* WDI_KEEP_ALIVE_RESP  */  
+  
+#ifdef FEATURE_WLAN_SCAN_PNO
+  WDI_ProcessSetPreferredNetworkRsp,     /* WDI_SET_PREF_NETWORK_RESP */
+  WDI_ProcessSetRssiFilterRsp,           /* WDI_SET_RSSI_FILTER_RESP */
+  WDI_ProcessUpdateScanParamsRsp,        /* WDI_UPDATE_SCAN_PARAMS_RESP */
+#else
+  NULL,
+  NULL,
+  NULL,
+#endif // FEATURE_WLAN_SCAN_PNO
+
+  WDI_ProcessSetTxPerTrackingRsp,      /* WDI_SET_TX_PER_TRACKING_RESP  */
+  
+  /*---------------------------------------------------------------------
+    Indications
+  ---------------------------------------------------------------------*/
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+  /* WDI_8023_MULTICAST_LIST_RESP */
+  WDI_Process8023MulticastListRsp,          
+  /* WDI_RECEIVE_FILTER_SET_FILTER_RESP */
+  WDI_ProcessReceiveFilterSetFilterRsp,     
+  /* WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP */
+  WDI_ProcessFilterMatchCountRsp,   
+  /* WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP */
+  WDI_ProcessReceiveFilterClearFilterRsp,   
+#else
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+  WDI_ProcessHALDumpCmdRsp,       /* WDI_HAL_DUMP_CMD_RESP */
+  WDI_ProcessShutdownRsp,         /* WDI_SHUTDOWN_RESP */
+  
+  WDI_ProcessSetPowerParamsRsp,         /*WDI_SET_POWER_PARAMS_RESP*/
+#ifdef FEATURE_WLAN_CCX
+  WDI_ProcessTsmStatsRsp,          /* WDI_TSM_STATS_RESP  */
+#else
+  NULL,
+#endif
+  
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+  WDI_ProcessGtkOffloadRsp,           /* WDI_GTK_OFFLOAD_RESP  */
+  WDI_ProcessGTKOffloadGetInfoRsp,    /* WDI_GTK_OFFLOAD_GETINFO_RESP  */
+#else
+  NULL,
+  NULL,
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+  WDI_ProcessSetTmLevelRsp,       /* WDI_SET_TM_LEVEL_RESP */
+  WDI_ProcessFeatureCapsExchangeRsp,     /* WDI_FEATURE_CAPS_EXCHANGE_RESP */  
+
+  /*---------------------------------------------------------------------
+    Indications
+  ---------------------------------------------------------------------*/
+  WDI_ProcessLowRSSIInd,            /* Just threshold crossing not really low WDI_HAL_RSSI_NOTIFICATION_IND  */
+  WDI_ProcessMissedBeaconInd,       /* WDI_HAL_MISSED_BEACON_IND  */
+  WDI_ProcessUnkAddrFrameInd,       /* WDI_HAL_UNKNOWN_ADDR2_FRAME_RX_IND  */
+  WDI_ProcessMicFailureInd,         /* WDI_HAL_MIC_FAILURE_IND  */
+  WDI_ProcessFatalErrorInd,         /* WDI_HAL_FATAL_ERROR_IND  */
+  WDI_ProcessDelSTAInd,             /* WDI_HAL_DEL_STA_IND  */
+
+  WDI_ProcessCoexInd,               /* WDI_HAL_COEX_IND  */
+
+  WDI_ProcessTxCompleteInd,         /* WDI_HAL_TX_COMPLETE_IND  */
+
+#ifdef WLAN_FEATURE_P2P
+  WDI_ProcessP2pNoaAttrInd,         /*WDI_HOST_NOA_ATTR_IND*/
+#else
+  NULL,
+#endif
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+  WDI_ProcessPrefNetworkFoundInd,   /* WDI_HAL_PREF_NETWORK_FOUND_IND */
+#else
+  NULL,
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_WAKEUP_EVENTS
+  WDI_ProcessWakeReasonInd,          /* WDI_WAKE_REASON_IND */
+#else // WLAN_WAKEUP_EVENTS
+  NULL,
+#endif // WLAN_WAKEUP_EVENTS
+
+  WDI_ProcessTxPerHitInd,               /* WDI_HAL_TX_PER_HIT_IND  */
+};
+
+
+/*--------------------------------------------------------------------------- 
+  WLAN DAL Global Control Block
+ ---------------------------------------------------------------------------*/
+WDI_ControlBlockType  gWDICb; 
+static wpt_uint8      gWDIInitialized = eWLAN_PAL_FALSE;
+
+const wpt_uint8 szTransportChName[] = "WLAN_CTRL"; 
+
+/*Helper routine for retrieving the PAL Context from WDI*/
+WPT_INLINE 
+void* WDI_GET_PAL_CTX( void )
+{
+  return gWDICb.pPALContext; 
+}/*WDI_GET_PAL_CTX*/
+
+/*============================================================================ 
+  Helper inline converters
+ ============================================================================*/
+/*Convert WDI driver type into HAL driver type*/
+WPT_STATIC WPT_INLINE WDI_Status
+WDI_HAL_2_WDI_STATUS
+(
+  eHalStatus halStatus
+);
+
+/*Convert WDI request type into HAL request type*/
+WPT_STATIC WPT_INLINE tHalHostMsgType
+WDI_2_HAL_REQ_TYPE
+(
+  WDI_RequestEnumType    wdiReqType
+);
+
+/*Convert WDI response type into HAL response type*/
+WPT_STATIC WPT_INLINE WDI_ResponseEnumType
+HAL_2_WDI_RSP_TYPE
+(
+  tHalHostMsgType halMsg
+);
+
+/*Convert WDI driver type into HAL driver type*/
+WPT_STATIC WPT_INLINE tDriverType
+WDI_2_HAL_DRV_TYPE
+(
+  WDI_DriverType wdiDriverType
+);
+
+/*Convert WDI stop reason into HAL stop reason*/
+WPT_STATIC WPT_INLINE tHalStopType
+WDI_2_HAL_STOP_REASON
+(
+  WDI_StopType wdiStopType
+);
+
+/*Convert WDI scan mode type into HAL scan mode type*/
+WPT_STATIC WPT_INLINE eHalSysMode
+WDI_2_HAL_SCAN_MODE
+(
+  WDI_ScanMode wdiScanMode
+);
+
+/*Convert WDI sec ch offset into HAL sec ch offset type*/
+WPT_STATIC WPT_INLINE tSirMacHTSecondaryChannelOffset
+WDI_2_HAL_SEC_CH_OFFSET
+(
+  WDI_HTSecondaryChannelOffset wdiSecChOffset
+);
+
+/*Convert WDI BSS type into HAL BSS type*/
+WPT_STATIC WPT_INLINE tSirBssType
+WDI_2_HAL_BSS_TYPE
+(
+  WDI_BssType wdiBSSType
+);
+
+/*Convert WDI NW type into HAL NW type*/
+WPT_STATIC WPT_INLINE tSirNwType
+WDI_2_HAL_NW_TYPE
+(
+  WDI_NwType wdiNWType
+);
+
+/*Convert WDI chanel bonding type into HAL cb type*/
+WPT_STATIC WPT_INLINE ePhyChanBondState
+WDI_2_HAL_CB_STATE
+(
+  WDI_PhyChanBondState wdiCbState
+);
+
+/*Convert WDI chanel bonding type into HAL cb type*/
+WPT_STATIC WPT_INLINE tSirMacHTOperatingMode
+WDI_2_HAL_HT_OPER_MODE
+(
+  WDI_HTOperatingMode wdiHTOperMode
+);
+
+/*Convert WDI mimo PS type into HAL mimo PS type*/
+WPT_STATIC WPT_INLINE tSirMacHTMIMOPowerSaveState
+WDI_2_HAL_MIMO_PS
+(
+  WDI_HTMIMOPowerSaveState wdiHTOperMode
+);
+
+/*Convert WDI ENC type into HAL ENC type*/
+WPT_STATIC WPT_INLINE tAniEdType
+WDI_2_HAL_ENC_TYPE
+(
+  WDI_EncryptType wdiEncType
+);
+
+/*Convert WDI WEP type into HAL WEP type*/
+WPT_STATIC WPT_INLINE tAniWepType
+WDI_2_HAL_WEP_TYPE
+(
+  WDI_WepType  wdiWEPType
+);
+
+/*Convert WDI Link State into HAL Link State*/
+WPT_STATIC WPT_INLINE tSirLinkState
+WDI_2_HAL_LINK_STATE
+(
+  WDI_LinkStateType  wdiLinkState
+);
+
+/*Translate a STA Context from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE 
+void
+WDI_CopyWDIStaCtxToHALStaCtx
+( 
+  tConfigStaParams*          phalConfigSta,
+  WDI_ConfigStaReqInfoType*  pwdiConfigSta
+);
+ 
+/*Translate a Rate set info from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE void 
+WDI_CopyWDIRateSetToHALRateSet
+( 
+  tSirMacRateSet* pHalRateSet,
+  WDI_RateSet*    pwdiRateSet
+);
+
+/*Translate an EDCA Parameter Record from WDI into HAL*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIEDCAParamsToHALEDCAParams
+( 
+  tSirMacEdcaParamRecord* phalEdcaParam,
+  WDI_EdcaParamRecord*    pWDIEdcaParam
+);
+
+/*Copy a management frame header from WDI fmt into HAL fmt*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr
+(
+  tSirMacMgmtHdr* pmacMgmtHdr,
+  WDI_MacMgmtHdr* pwdiMacMgmtHdr
+);
+
+/*Copy config bss parameters from WDI fmt into HAL fmt*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIConfigBSSToHALConfigBSS
+(
+  tConfigBssParams*         phalConfigBSS,
+  WDI_ConfigBSSReqInfoType* pwdiConfigBSS
+);
+
+/*Extract the request CB function and user data from a request structure 
+  pointed to by user data */
+WPT_STATIC WPT_INLINE void
+WDI_ExtractRequestCBFromEvent
+(
+  WDI_EventInfoType* pEvent,
+  WDI_ReqStatusCb*   ppfnReqCB, 
+  void**             ppUserData
+);
+
+wpt_uint8
+WDI_FindEmptySession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_BSSSessionType**    ppSession
+);
+
+void
+WDI_AddBcastSTAtoSTATable
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_AddStaParams *     staParams,
+  wpt_uint16             usBcastStaIdx
+);
+
+WDI_Status WDI_SendNvBlobReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+);
+
+void
+WDI_SetPowerStateCb
+(
+   wpt_status status,
+   unsigned int dxePhyAddr,
+   void      *pContext
+);
+
+#define CASE_RETURN_STRING( str )           \
+    case ( ( str ) ): return( #str ); break \
+
+/**
+ @brief WDI_getReqMsgString prints the WDI request message in string.
+  
+ @param wdiReqMsgId: WDI Message request Id 
+  
+ @see 
+ @return Result of the function call
+*/
+static char *WDI_getReqMsgString(wpt_uint16 wdiReqMsgId)
+{
+  switch (wdiReqMsgId)
+  {
+    CASE_RETURN_STRING( WDI_START_REQ );
+    CASE_RETURN_STRING( WDI_STOP_REQ );
+    CASE_RETURN_STRING( WDI_CLOSE_REQ );
+    CASE_RETURN_STRING( WDI_INIT_SCAN_REQ );
+    CASE_RETURN_STRING( WDI_START_SCAN_REQ );
+    CASE_RETURN_STRING( WDI_END_SCAN_REQ );
+    CASE_RETURN_STRING( WDI_FINISH_SCAN_REQ );
+    CASE_RETURN_STRING( WDI_JOIN_REQ );
+    CASE_RETURN_STRING( WDI_CONFIG_BSS_REQ );
+    CASE_RETURN_STRING( WDI_DEL_BSS_REQ );
+    CASE_RETURN_STRING( WDI_POST_ASSOC_REQ );
+    CASE_RETURN_STRING( WDI_DEL_STA_REQ );
+    CASE_RETURN_STRING( WDI_SET_BSS_KEY_REQ );
+    CASE_RETURN_STRING( WDI_RMV_BSS_KEY_REQ );
+    CASE_RETURN_STRING( WDI_SET_STA_KEY_REQ );
+    CASE_RETURN_STRING( WDI_RMV_STA_KEY_REQ );
+    CASE_RETURN_STRING( WDI_ADD_TS_REQ );
+    CASE_RETURN_STRING( WDI_DEL_TS_REQ );
+    CASE_RETURN_STRING( WDI_UPD_EDCA_PRMS_REQ );
+    CASE_RETURN_STRING( WDI_ADD_BA_SESSION_REQ );
+    CASE_RETURN_STRING( WDI_DEL_BA_REQ );
+    CASE_RETURN_STRING( WDI_CH_SWITCH_REQ );
+    CASE_RETURN_STRING( WDI_CONFIG_STA_REQ );
+    CASE_RETURN_STRING( WDI_SET_LINK_ST_REQ );
+    CASE_RETURN_STRING( WDI_GET_STATS_REQ );
+    CASE_RETURN_STRING( WDI_UPDATE_CFG_REQ );
+    CASE_RETURN_STRING( WDI_ADD_BA_REQ );
+    CASE_RETURN_STRING( WDI_TRIGGER_BA_REQ );
+    CASE_RETURN_STRING( WDI_UPD_BCON_PRMS_REQ );
+    CASE_RETURN_STRING( WDI_SND_BCON_REQ );
+    CASE_RETURN_STRING( WDI_UPD_PROBE_RSP_TEMPLATE_REQ );
+    CASE_RETURN_STRING( WDI_SET_STA_BCAST_KEY_REQ );
+    CASE_RETURN_STRING( WDI_RMV_STA_BCAST_KEY_REQ );
+    CASE_RETURN_STRING( WDI_SET_MAX_TX_POWER_REQ );
+    CASE_RETURN_STRING( WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ );
+    CASE_RETURN_STRING( WDI_ENTER_IMPS_REQ );
+    CASE_RETURN_STRING( WDI_EXIT_IMPS_REQ );
+    CASE_RETURN_STRING( WDI_ENTER_BMPS_REQ );
+    CASE_RETURN_STRING( WDI_EXIT_BMPS_REQ );
+    CASE_RETURN_STRING( WDI_ENTER_UAPSD_REQ );
+    CASE_RETURN_STRING( WDI_EXIT_UAPSD_REQ );
+    CASE_RETURN_STRING( WDI_SET_UAPSD_PARAM_REQ );
+    CASE_RETURN_STRING( WDI_UPDATE_UAPSD_PARAM_REQ );
+    CASE_RETURN_STRING( WDI_CONFIGURE_RXP_FILTER_REQ );
+    CASE_RETURN_STRING( WDI_SET_BEACON_FILTER_REQ);
+    CASE_RETURN_STRING( WDI_REM_BEACON_FILTER_REQ );
+    CASE_RETURN_STRING( WDI_SET_RSSI_THRESHOLDS_REQ );
+    CASE_RETURN_STRING( WDI_HOST_OFFLOAD_REQ );
+    CASE_RETURN_STRING( WDI_WOWL_ADD_BC_PTRN_REQ );
+    CASE_RETURN_STRING( WDI_WOWL_DEL_BC_PTRN_REQ );
+    CASE_RETURN_STRING( WDI_WOWL_ENTER_REQ );
+    CASE_RETURN_STRING( WDI_WOWL_EXIT_REQ );
+    CASE_RETURN_STRING( WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ );
+    CASE_RETURN_STRING( WDI_NV_DOWNLOAD_REQ );
+    CASE_RETURN_STRING( WDI_FLUSH_AC_REQ );
+    CASE_RETURN_STRING( WDI_BTAMP_EVENT_REQ );
+    CASE_RETURN_STRING( WDI_AGGR_ADD_TS_REQ );
+    CASE_RETURN_STRING( WDI_ADD_STA_SELF_REQ );
+    CASE_RETURN_STRING( WDI_DEL_STA_SELF_REQ );
+    CASE_RETURN_STRING( WDI_FTM_CMD_REQ );
+    CASE_RETURN_STRING( WDI_START_INNAV_MEAS_REQ );
+    CASE_RETURN_STRING( WDI_HOST_RESUME_REQ );
+    CASE_RETURN_STRING( WDI_KEEP_ALIVE_REQ);
+  #ifdef FEATURE_WLAN_SCAN_PNO
+    CASE_RETURN_STRING( WDI_SET_PREF_NETWORK_REQ );
+    CASE_RETURN_STRING( WDI_SET_RSSI_FILTER_REQ );
+    CASE_RETURN_STRING( WDI_UPDATE_SCAN_PARAMS_REQ );
+  #endif
+    CASE_RETURN_STRING( WDI_SET_TX_PER_TRACKING_REQ );
+    CASE_RETURN_STRING( WDI_8023_MULTICAST_LIST_REQ );
+    CASE_RETURN_STRING( WDI_RECEIVE_FILTER_SET_FILTER_REQ );
+    CASE_RETURN_STRING( WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ );
+    CASE_RETURN_STRING( WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ );
+    CASE_RETURN_STRING( WDI_INIT_SCAN_CON_REQ );
+    CASE_RETURN_STRING( WDI_HAL_DUMP_CMD_REQ );
+    CASE_RETURN_STRING( WDI_SHUTDOWN_REQ );
+    CASE_RETURN_STRING( WDI_SET_POWER_PARAMS_REQ );
+    default:
+        return "Unknown WDI MessageId";
+  }
+}
+
+
+
+/**
+ @brief WDI_getRespMsgString prints the WDI resonse message in string.
+  
+ @param wdiRespMsgId: WDI Message response Id 
+  
+ @see 
+ @return Result of the function call
+*/
+static char *WDI_getRespMsgString(wpt_uint16 wdiRespMsgId)
+{
+  switch (wdiRespMsgId)
+  {
+    CASE_RETURN_STRING( WDI_START_RESP );
+    CASE_RETURN_STRING( WDI_STOP_RESP );
+    CASE_RETURN_STRING( WDI_CLOSE_RESP );
+    CASE_RETURN_STRING( WDI_INIT_SCAN_RESP );
+    CASE_RETURN_STRING( WDI_START_SCAN_RESP );
+    CASE_RETURN_STRING( WDI_END_SCAN_RESP );
+    CASE_RETURN_STRING( WDI_FINISH_SCAN_RESP );
+    CASE_RETURN_STRING( WDI_JOIN_RESP );
+    CASE_RETURN_STRING( WDI_CONFIG_BSS_RESP );
+    CASE_RETURN_STRING( WDI_DEL_BSS_RESP );
+    CASE_RETURN_STRING( WDI_POST_ASSOC_RESP );
+    CASE_RETURN_STRING( WDI_DEL_STA_RESP );
+    CASE_RETURN_STRING( WDI_SET_BSS_KEY_RESP );
+    CASE_RETURN_STRING( WDI_RMV_BSS_KEY_RESP );
+    CASE_RETURN_STRING( WDI_SET_STA_KEY_RESP );
+    CASE_RETURN_STRING( WDI_RMV_STA_KEY_RESP );
+    CASE_RETURN_STRING( WDI_ADD_TS_RESP );
+    CASE_RETURN_STRING( WDI_DEL_TS_RESP );
+    CASE_RETURN_STRING( WDI_UPD_EDCA_PRMS_RESP );
+    CASE_RETURN_STRING( WDI_ADD_BA_SESSION_RESP );
+    CASE_RETURN_STRING( WDI_DEL_BA_RESP );
+    CASE_RETURN_STRING( WDI_CH_SWITCH_RESP );
+    CASE_RETURN_STRING( WDI_CONFIG_STA_RESP );
+    CASE_RETURN_STRING( WDI_SET_LINK_ST_RESP );
+    CASE_RETURN_STRING( WDI_GET_STATS_RESP );
+    CASE_RETURN_STRING( WDI_UPDATE_CFG_RESP );
+    CASE_RETURN_STRING( WDI_ADD_BA_RESP );
+    CASE_RETURN_STRING( WDI_TRIGGER_BA_RESP );
+    CASE_RETURN_STRING( WDI_UPD_BCON_PRMS_RESP );
+    CASE_RETURN_STRING( WDI_SND_BCON_RESP );
+    CASE_RETURN_STRING( WDI_UPD_PROBE_RSP_TEMPLATE_RESP );
+    CASE_RETURN_STRING( WDI_SET_STA_BCAST_KEY_RESP );
+    CASE_RETURN_STRING( WDI_RMV_STA_BCAST_KEY_RESP );
+    CASE_RETURN_STRING( WDI_SET_MAX_TX_POWER_RESP );
+    CASE_RETURN_STRING( WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP );
+    CASE_RETURN_STRING( WDI_ENTER_IMPS_RESP );
+    CASE_RETURN_STRING( WDI_EXIT_IMPS_RESP );
+    CASE_RETURN_STRING( WDI_ENTER_BMPS_RESP );
+    CASE_RETURN_STRING( WDI_EXIT_BMPS_RESP );
+    CASE_RETURN_STRING( WDI_ENTER_UAPSD_RESP );
+    CASE_RETURN_STRING( WDI_EXIT_UAPSD_RESP );
+    CASE_RETURN_STRING( WDI_SET_UAPSD_PARAM_RESP );
+    CASE_RETURN_STRING( WDI_UPDATE_UAPSD_PARAM_RESP );
+    CASE_RETURN_STRING( WDI_CONFIGURE_RXP_FILTER_RESP );
+    CASE_RETURN_STRING( WDI_SET_BEACON_FILTER_RESP);
+    CASE_RETURN_STRING( WDI_REM_BEACON_FILTER_RESP );
+    CASE_RETURN_STRING( WDI_SET_RSSI_THRESHOLDS_RESP );
+    CASE_RETURN_STRING( WDI_HOST_OFFLOAD_RESP );
+    CASE_RETURN_STRING( WDI_WOWL_ADD_BC_PTRN_RESP );
+    CASE_RETURN_STRING( WDI_WOWL_DEL_BC_PTRN_RESP );
+    CASE_RETURN_STRING( WDI_WOWL_ENTER_RESP );
+    CASE_RETURN_STRING( WDI_WOWL_EXIT_RESP );
+    CASE_RETURN_STRING( WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP );
+    CASE_RETURN_STRING( WDI_NV_DOWNLOAD_RESP );
+    CASE_RETURN_STRING( WDI_FLUSH_AC_RESP );
+    CASE_RETURN_STRING( WDI_BTAMP_EVENT_RESP );
+    CASE_RETURN_STRING( WDI_AGGR_ADD_TS_RESP );
+    CASE_RETURN_STRING( WDI_ADD_STA_SELF_RESP );
+    CASE_RETURN_STRING( WDI_DEL_STA_SELF_RESP );
+    CASE_RETURN_STRING( WDI_FTM_CMD_RESP );
+    CASE_RETURN_STRING( WDI_START_INNAV_MEAS_RESP );
+    CASE_RETURN_STRING( WDI_HOST_RESUME_RESP );
+    CASE_RETURN_STRING( WDI_KEEP_ALIVE_RESP);
+  #ifdef FEATURE_WLAN_SCAN_PNO
+    CASE_RETURN_STRING( WDI_SET_PREF_NETWORK_RESP );
+    CASE_RETURN_STRING( WDI_SET_RSSI_FILTER_RESP );
+    CASE_RETURN_STRING( WDI_UPDATE_SCAN_PARAMS_RESP );
+  #endif
+    CASE_RETURN_STRING( WDI_SET_TX_PER_TRACKING_RESP );
+    CASE_RETURN_STRING( WDI_8023_MULTICAST_LIST_RESP );
+    CASE_RETURN_STRING( WDI_RECEIVE_FILTER_SET_FILTER_RESP );
+    CASE_RETURN_STRING( WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP );
+    CASE_RETURN_STRING( WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP );
+    CASE_RETURN_STRING( WDI_HAL_DUMP_CMD_RESP );
+    CASE_RETURN_STRING( WDI_SHUTDOWN_RESP );
+    CASE_RETURN_STRING( WDI_SET_POWER_PARAMS_RESP );
+    default:
+        return "Unknown WDI MessageId";
+  }
+}
+
+/**
+ @brief WDI_getHALStatusMsgString prints the HAL status in string.
+  
+ @param halStatusId: HAL status Id 
+  
+ @see 
+ @return Result of the function call
+*/
+static char *WDI_getHALStatusMsgString(wpt_uint16 halStatusId)
+{
+  switch (halStatusId)
+  {
+    CASE_RETURN_STRING( eHAL_STATUS_SUCCESS );
+    CASE_RETURN_STRING( PAL_STATUS_INVAL );
+    CASE_RETURN_STRING( PAL_STATUS_ALREADY );
+    CASE_RETURN_STRING( PAL_STATUS_EMPTY );
+    CASE_RETURN_STRING( PAL_STATUS_FAILURE );
+    CASE_RETURN_STRING( eHAL_STATUS_FAILURE );
+    CASE_RETURN_STRING( eHAL_STATUS_INVALID_PARAMETER );
+    CASE_RETURN_STRING( eHAL_STATUS_INVALID_STAIDX );
+    CASE_RETURN_STRING( eHAL_STATUS_DPU_DESCRIPTOR_TABLE_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_NO_INTERRUPTS );
+    CASE_RETURN_STRING( eHAL_STATUS_INTERRUPT_PRESENT );
+    CASE_RETURN_STRING( eHAL_STATUS_STA_TABLE_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_DUPLICATE_STA );
+    CASE_RETURN_STRING( eHAL_STATUS_BSSID_INVALID );
+    CASE_RETURN_STRING( eHAL_STATUS_STA_INVALID );
+    CASE_RETURN_STRING( eHAL_STATUS_DUPLICATE_BSSID );
+    CASE_RETURN_STRING( eHAL_STATUS_INVALID_BSSIDX );
+    CASE_RETURN_STRING( eHAL_STATUS_BSSID_TABLE_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_INVALID_SIGNATURE );
+    CASE_RETURN_STRING( eHAL_STATUS_INVALID_KEYID );
+    CASE_RETURN_STRING( eHAL_STATUS_SET_CHAN_ALREADY_ON_REQUESTED_CHAN );
+    CASE_RETURN_STRING( eHAL_STATUS_UMA_DESCRIPTOR_TABLE_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_DPU_MICKEY_TABLE_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_BA_RX_BUFFERS_FULL );
+    CASE_RETURN_STRING( eHAL_STATUS_BA_RX_MAX_SESSIONS_REACHED );
+    CASE_RETURN_STRING( eHAL_STATUS_BA_RX_INVALID_SESSION_ID );
+    CASE_RETURN_STRING( eHAL_STATUS_TIMER_START_FAILED );
+    CASE_RETURN_STRING( eHAL_STATUS_TIMER_STOP_FAILED );
+    CASE_RETURN_STRING( eHAL_STATUS_FAILED_ALLOC );
+    CASE_RETURN_STRING( eHAL_STATUS_NOTIFY_BSS_FAIL );
+    CASE_RETURN_STRING( eHAL_STATUS_DEL_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO );
+    CASE_RETURN_STRING( eHAL_STATUS_ADD_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO );
+    CASE_RETURN_STRING( eHAL_STATUS_FW_SEND_MSG_FAILED );
+    default:
+        return "Unknown HAL status";
+  }
+}
+
+/*======================================================================== 
+ 
+                             INITIALIZATION APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_Init is used to initialize the DAL.
+ 
+ DAL will allocate all the resources it needs. It will open PAL, it will also
+ open both the data and the control transport which in their turn will open
+ DXE/SMD or any other drivers that they need. 
+ 
+ @param pOSContext: pointer to the OS context provided by the UMAC
+                    will be passed on to PAL on Open
+        ppWDIGlobalCtx: output pointer of Global Context
+        pWdiDevCapability: output pointer of device capability
+
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Init
+( 
+  void*                      pOSContext,
+  void**                     ppWDIGlobalCtx,
+  WDI_DeviceCapabilityType*  pWdiDevCapability,
+  unsigned int               driverType
+)
+{
+  wpt_uint8               i;
+  wpt_status              wptStatus; 
+  WDI_Status              wdiStatus;
+  WCTS_TransportCBsType   wctsCBs; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*---------------------------------------------------------------------
+    Sanity check
+  ---------------------------------------------------------------------*/
+  if (( NULL == ppWDIGlobalCtx ) || ( NULL == pWdiDevCapability ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Invalid input parameters in WDI_Init");
+
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*---------------------------------------------------------------------
+    Check to see if the module has already been initialized or not 
+  ---------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE != gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "WDI module already initialized - return");
+
+    return WDI_STATUS_SUCCESS; 
+  }
+
+  /*Module is now initialized - this flag is to ensure the fact that multiple
+   init will not happen on WDI
+   !! - potential race does exist because read and set are not atomic,
+   however an atomic operation would be closely here - reanalyze if necessary*/
+  gWDIInitialized = eWLAN_PAL_TRUE; 
+
+  /*Setup the control block */
+  WDI_CleanCB(&gWDICb);
+  gWDICb.pOSContext = pOSContext; 
+
+  /*Setup the STA Table*/
+  wdiStatus = WDI_STATableInit(&gWDICb);
+  if ( WDI_STATUS_SUCCESS != wdiStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "%s: Failure while initializing STA Table, status %d",
+               __FUNCTION__, wdiStatus);
+    goto fail_STATableInit;
+  }
+
+  /*------------------------------------------------------------------------
+    Open the PAL
+   ------------------------------------------------------------------------*/
+  wptStatus =  wpalOpen(&gWDICb.pPALContext, pOSContext);
+  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "%s: Failed to open PAL, status %d",
+               __FUNCTION__, wptStatus);
+    goto fail_wpalOpen;
+  }
+
+  /*Initialize main synchro mutex - it will be used to ensure integrity of
+   the main WDI Control Block*/
+  wptStatus =  wpalMutexInit(&gWDICb.wptMutex);
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "%s: Failed to init mutex, status %d",
+               __FUNCTION__, wptStatus);
+    goto fail_mutex;
+  }
+
+  /*Initialize the response timer - it will be used to time all messages
+    expected as response from device*/
+  wptStatus = wpalTimerInit( &gWDICb.wptResponseTimer, 
+                             WDI_ResponseTimerCB, 
+                             &gWDICb);
+  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "%s: Failed to init response timer, status %d",
+               __FUNCTION__, wptStatus);
+    goto fail_timer;
+  }
+
+  /* Initialize the  WDI Pending Request Queue*/
+  wptStatus = wpal_list_init(&(gWDICb.wptPendingQueue));
+  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "%s: Failed to init pending request queue, status %d",
+               __FUNCTION__, wptStatus);
+    goto fail_pend_queue;
+  }
+
+  /*Init WDI Pending Assoc Id Queue */
+  wptStatus = wpal_list_init(&(gWDICb.wptPendingAssocSessionIdQueue));
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "%s: Failed to init assoc session queue, status %d",
+               __FUNCTION__, wptStatus);
+    goto fail_assoc_queue;
+  }
+
+  /*Initialize the BSS sessions pending Queue */
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+    wptStatus = wpal_list_init(&(gWDICb.aBSSSessions[i].wptPendingQueue));
+    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+    {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: Failed to init BSS %d pending queue, status %d",
+                 __FUNCTION__, i, wptStatus);
+      goto fail_bss_queue;
+    }
+  }
+
+  /*Indicate the control block is sufficiently initialized for callbacks*/
+  gWDICb.magic = WDI_CONTROL_BLOCK_MAGIC;
+
+  /*------------------------------------------------------------------------
+    Initialize the Data Path Utility Module
+   ------------------------------------------------------------------------*/
+  wdiStatus = WDI_DP_UtilsInit(&gWDICb);
+  if ( WDI_STATUS_SUCCESS != wdiStatus )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "%s: Failed to initialize the DP Util Module, status %d",
+               __FUNCTION__, wdiStatus);
+    goto fail_dp_util_init;
+  }
+
+  /* Init Set power state event */
+  wptStatus = wpalEventInit(&gWDICb.setPowerStateEvent);
+  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus ) 
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                "%s: Failed to initialize power state event, status %d",
+                __FUNCTION__, wptStatus);
+     goto fail_power_event;
+  }
+
+  /* Init WCTS action event */
+  wptStatus = wpalEventInit(&gWDICb.wctsActionEvent);
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus ) 
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                "%s: Failed to initialize WCTS action event, status %d",
+                __FUNCTION__, wptStatus);
+     goto fail_wcts_event;
+  }
+
+  /*------------------------------------------------------------------------
+    Open the Transport Services for Control and Data 
+   ------------------------------------------------------------------------*/
+  wctsCBs.wctsNotifyCB      = WDI_NotifyMsgCTSCB;
+  wctsCBs.wctsNotifyCBData  = &gWDICb;
+  wctsCBs.wctsRxMsgCB       = WDI_RXMsgCTSCB; 
+  wctsCBs.wctsRxMsgCBData   = &gWDICb;
+
+  gWDICb.bCTOpened          = eWLAN_PAL_FALSE; 
+  gWDICb.wctsHandle = WCTS_OpenTransport( szTransportChName ,
+                                          WDI_CT_CHANNEL_SIZE, 
+                                          &wctsCBs ); 
+
+  if ( NULL == gWDICb.wctsHandle )
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                "%s: Failed to open WCTS transport", __FUNCTION__);
+     goto fail_wcts_open;
+  }
+
+  gWDICb.driverMode = (tDriverType)driverType;
+  /* FTM mode not need to open Transport Driver */
+  if(eDRIVER_TYPE_MFG != (tDriverType)driverType)
+  {  
+    /*------------------------------------------------------------------------
+     Open the Data Transport
+     ------------------------------------------------------------------------*/
+    if(eWLAN_PAL_STATUS_SUCCESS != WDTS_openTransport(&gWDICb))
+    {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: Failed to open the DT Transport", __FUNCTION__);
+      goto fail_wdts_open;
+    }
+  }
+
+  /*The WDI is initialized - set state to init */
+  gWDICb.uGlobalState = WDI_INIT_ST; 
+
+  /*Send the context as a ptr to the global WDI Control Block*/
+  *ppWDIGlobalCtx = &gWDICb;
+
+  /*Fill in the device capabilities*/
+  pWdiDevCapability->bFrameXtlSupported = eWLAN_PAL_FALSE; 
+  pWdiDevCapability->ucMaxSTASupported  = gWDICb.ucMaxStations;
+  pWdiDevCapability->ucMaxBSSSupported  = gWDICb.ucMaxBssids;
+  return WDI_STATUS_SUCCESS;
+
+  /* ERROR handlers
+     Undo everything that completed successfully */
+
+ fail_wdts_open:
+  {
+     wpt_status             eventStatus;
+
+     /* Closing WCTS in this scenario is tricky since it has to close
+        the SMD channel and then we get notified asynchronously when
+        the channel has been closed. So we take some of the logic from
+        the "normal" close procedure in WDI_Close()
+     */
+
+     eventStatus = wpalEventReset(&gWDICb.wctsActionEvent);
+     if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus ) 
+     {
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%s: Failed to reset WCTS action event", __FUNCTION__);
+     }
+
+     WCTS_CloseTransport(gWDICb.wctsHandle);
+
+     /* Wait for WCTS to close the control transport.  If we were able
+        to reset the event flag, then we'll wait for the event,
+        otherwise we'll wait for a maximum amount of time required for
+        the channel to be closed */
+     if ( eWLAN_PAL_STATUS_SUCCESS == eventStatus )
+     {
+        eventStatus = wpalEventWait(&gWDICb.wctsActionEvent, 
+                                    WDI_WCTS_ACTION_TIMEOUT);
+        if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
+        {
+           WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                      "%s: Failed to wait on WCTS action event", __FUNCTION__);
+        }
+     }
+     else
+     {
+        wpalSleep(WDI_WCTS_ACTION_TIMEOUT);
+     }
+  }
+ fail_wcts_open:
+  wpalEventDelete(&gWDICb.wctsActionEvent);
+ fail_wcts_event:
+  wpalEventDelete(&gWDICb.setPowerStateEvent);
+ fail_power_event:
+  WDI_DP_UtilsExit(&gWDICb);
+ fail_dp_util_init:
+  gWDICb.magic = 0;
+ fail_bss_queue:
+  /* entries 0 thru i-1 were successfully initialized */
+  while (0 < i)
+  {
+     i--;
+     wpal_list_destroy(&(gWDICb.aBSSSessions[i].wptPendingQueue));
+  }
+  wpal_list_destroy(&(gWDICb.wptPendingAssocSessionIdQueue));
+ fail_assoc_queue:
+  wpal_list_destroy(&(gWDICb.wptPendingQueue));
+ fail_pend_queue:
+  wpalTimerDelete(&gWDICb.wptResponseTimer);
+ fail_timer:
+  wpalMutexDelete(&gWDICb.wptMutex);
+ fail_mutex:
+  wpalClose(gWDICb.pPALContext);
+ fail_wpalOpen:
+  WDI_STATableClose(&gWDICb);
+ fail_STATableInit:
+  gWDIInitialized = eWLAN_PAL_FALSE; 
+
+  return WDI_STATUS_E_FAILURE; 
+
+}/*WDI_Init*/;
+
+/**
+ @brief WDI_Start will be called when the upper MAC is ready to
+        commence operation with the WLAN Device. Upon the call
+        of this API the WLAN DAL will pack and send a HAL Start
+        message to the lower RIVA sub-system if the SMD channel
+        has been fully opened and the RIVA subsystem is up.
+
+         If the RIVA sub-system is not yet up and running DAL
+         will queue the request for Open and will wait for the
+         SMD notification before attempting to send down the
+         message to HAL. 
+
+ WDI_Init must have been called.
+
+ @param wdiStartParams: the start parameters as specified by 
+                      the Device Interface
+  
+        wdiStartRspCb: callback for passing back the response of
+        the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Start
+(
+  WDI_StartReqParamsType*  pwdiStartParams,
+  WDI_StartRspCb           wdiStartRspCb,
+  void*                    pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_START_REQ;
+  wdiEventData.pEventData      = pwdiStartParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStartParams); 
+  wdiEventData.pCBfnc          = wdiStartRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_Start*/
+
+/**
+ @brief WDI_Stop will be called when the upper MAC is ready to
+        stop any operation with the WLAN Device. Upon the call
+        of this API the WLAN DAL will pack and send a HAL Stop
+        message to the lower RIVA sub-system if the DAL Core is
+        in started state.
+
+         In state BUSY this request will be queued.
+  
+         Request will not be accepted in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiStopParams: the stop parameters as specified by 
+                      the Device Interface
+  
+        wdiStopRspCb: callback for passing back the response of
+        the stop operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Stop
+(
+  WDI_StopReqParamsType*  pwdiStopParams,
+  WDI_StopRspCb           wdiStopRspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /* Free the global variables */
+  wpalMemoryFree(gpHostWlanFeatCaps);
+  wpalMemoryFree(gpFwWlanFeatCaps);
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_STOP_REQ;
+  wdiEventData.pEventData      = pwdiStopParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStopParams); 
+  wdiEventData.pCBfnc          = wdiStopRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_STOP_EVENT, &wdiEventData);
+
+}/*WDI_Stop*/
+
+
+
+/**
+ @brief WDI_Close will be called when the upper MAC no longer 
+        needs to interact with DAL. DAL will free its control
+        block.
+  
+        It is only accepted in state STOPPED.  
+
+ WDI_Stop must have been called.
+
+ @param none
+  
+ @see WDI_Stop
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_Close
+(
+  void
+)
+{
+  wpt_uint8              i;
+  WDI_EventInfoType      wdiEventData;
+  wpt_status             wptStatus;
+  wpt_status             eventStatus;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*Reset WCTS action event prior to posting the WDI_CLOSE_REQ
+   (the control transport will be closed by the FSM and we'll want
+   to wait until that completes)*/
+  eventStatus = wpalEventReset(&gWDICb.wctsActionEvent);
+  if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus ) 
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Failed to reset WCTS action event", __FUNCTION__);
+     /* fall through and try to finish closing via the FSM */
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_CLOSE_REQ;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = NULL; 
+  wdiEventData.pUserData       = NULL;
+
+  gWDIInitialized = eWLAN_PAL_FALSE;
+
+  wptStatus = WDI_PostMainEvent(&gWDICb, WDI_CLOSE_EVENT, &wdiEventData);
+
+  /*Wait for WCTS to close the control transport
+    (but only if we were able to reset the event flag*/
+  if ( eWLAN_PAL_STATUS_SUCCESS == eventStatus )
+  {
+     eventStatus = wpalEventWait(&gWDICb.wctsActionEvent, 
+                                 WDI_WCTS_ACTION_TIMEOUT);
+     if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
+     {
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%s: Failed to wait on WCTS action event", __FUNCTION__);
+     }
+  }
+
+  /* Destroy the WCTS action event */
+  wptStatus = wpalEventDelete(&gWDICb.wctsActionEvent);
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Close failed to destroy an event");
+     WDI_ASSERT(0); 
+  }
+
+   /* Destroy the Set Power State event */
+   wptStatus = wpalEventDelete(&gWDICb.setPowerStateEvent);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Close failed to destroy an event");
+
+      WDI_ASSERT(0); 
+   }
+
+  /*------------------------------------------------------------------------
+    Closes the Data Path Utility Module
+   ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_DP_UtilsExit(&gWDICb))
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "WDI Init failed to close the DP Util Module");
+
+    WDI_ASSERT(0); 
+  }
+
+  /*destroy the BSS sessions pending Queue */
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+    wpal_list_destroy(&(gWDICb.aBSSSessions[i].wptPendingQueue));
+  }
+
+  /* destroy the WDI Pending Assoc Id Request Queue*/
+  wpal_list_destroy(&(gWDICb.wptPendingAssocSessionIdQueue));
+
+  /* destroy the WDI Pending Request Queue*/
+  wpal_list_destroy(&(gWDICb.wptPendingQueue));
+  
+  /*destroy the response timer */
+  wptStatus = wpalTimerDelete( &gWDICb.wptResponseTimer);
+
+  /*invalidate the main synchro mutex */
+  wptStatus = wpalMutexDelete(&gWDICb.wptMutex);
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Failed to delete mutex %d", wptStatus);
+     WDI_ASSERT(0);
+  }
+
+  /*Clear control block.  note that this will clear the "magic"
+    which will inhibit all asynchronous callbacks*/
+  WDI_CleanCB(&gWDICb);
+
+  return wptStatus;
+
+}/*WDI_Close*/
+
+/**
+ @brief  WDI_Shutdown will be called during 'SSR shutdown' operation.
+         This will do most of the WDI stop & close
+         operations without doing any handshake with Riva
+
+         This will also make sure that the control transport
+         will NOT be closed.
+
+         This request will not be queued.
+
+
+ WDI_Start must have been called.
+
+ @param  closeTransport:  Close control channel if this is set
+
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Shutdown
+(
+ wpt_boolean closeTransport
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   wpt_status             wptStatus;
+   int                    i = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check
+     ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "WDI API call before module is initialized - Fail request");
+
+      return WDI_STATUS_E_NOT_ALLOWED;
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+     ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SHUTDOWN_REQ;
+   wdiEventData.pEventData      = NULL;
+   wdiEventData.uEventDataSize  = 0;
+
+   /* Shutdown will not be queued, if the state is busy timer will be
+    * stopped & this message will be processed.*/
+   wptStatus = WDI_PostMainEvent(&gWDICb, WDI_SHUTDOWN_EVENT, &wdiEventData);
+   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+            "%s: Failed to process shutdown event", __FUNCTION__);
+   }
+   /* Destroy the Set Power State event */
+   wptStatus = wpalEventDelete(&gWDICb.setPowerStateEvent);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "WDI Close failed to destroy an event");
+
+      WDI_ASSERT(0);
+   }
+   /*------------------------------------------------------------------------
+     Closes the Data Path Utility Module
+     ------------------------------------------------------------------------*/
+   if ( WDI_STATUS_SUCCESS != WDI_DP_UtilsExit(&gWDICb))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "WDI Init failed to close the DP Util Module");
+
+      WDI_ASSERT(0);
+   }
+   if ( closeTransport )
+   {
+      /* Close control transport, called from module unload */
+      WCTS_CloseTransport(gWDICb.wctsHandle);
+   }
+
+   /*destroy the BSS sessions pending Queue */
+   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+   {
+      wpal_list_destroy(&(gWDICb.aBSSSessions[i].wptPendingQueue));
+   }
+
+   /* destroy the WDI Pending Assoc Id Request Queue*/
+   wpal_list_destroy(&(gWDICb.wptPendingAssocSessionIdQueue));
+   /* destroy the WDI Pending Request Queue*/
+   wpal_list_destroy(&(gWDICb.wptPendingQueue));
+   /*destroy the response timer */
+   wptStatus = wpalTimerDelete( &gWDICb.wptResponseTimer);
+
+   /*invalidate the main synchro mutex */
+   wptStatus = wpalMutexDelete(&gWDICb.wptMutex);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "%s: Failed to delete mutex %d",  __FUNCTION__, wptStatus);
+      WDI_ASSERT(0);
+   }
+
+   /*Clear control block.  note that this will clear the "magic"
+     which will inhibit all asynchronous callbacks*/
+   WDI_CleanCB(&gWDICb);
+   return wptStatus;
+
+}/*WDI_Shutdown*/
+
+
+/*======================================================================== 
+ 
+                             SCAN APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_InitScanReq will be called when the upper MAC wants 
+        the WLAN Device to get ready for a scan procedure. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Init Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiInitScanParams: the init scan parameters as specified
+                      by the Device Interface
+  
+        wdiInitScanRspCb: callback for passing back the response
+        of the init scan operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_InitScanReq
+(
+  WDI_InitScanReqParamsType*  pwdiInitScanParams,
+  WDI_InitScanRspCb           wdiInitScanRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_INIT_SCAN_REQ;
+  wdiEventData.pEventData      = pwdiInitScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiInitScanParams); 
+  wdiEventData.pCBfnc          = wdiInitScanRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_InitScanReq*/
+
+/**
+ @brief WDI_StartScanReq will be called when the upper MAC 
+        wishes to change the Scan channel on the WLAN Device.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_InitScanReq must have been called.
+
+ @param wdiStartScanParams: the start scan parameters as 
+                      specified by the Device Interface
+  
+        wdiStartScanRspCb: callback for passing back the
+        response of the start scan operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_InitScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_StartScanReq
+(
+  WDI_StartScanReqParamsType*  pwdiStartScanParams,
+  WDI_StartScanRspCb           wdiStartScanRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_START_SCAN_REQ;
+  wdiEventData.pEventData      = pwdiStartScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStartScanParams); 
+  wdiEventData.pCBfnc          = wdiStartScanRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_StartScanReq*/
+
+
+/**
+ @brief WDI_EndScanReq will be called when the upper MAC is 
+        wants to end scanning for a particular channel that it
+        had set before by calling Scan Start on the WLAN Device.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL End Scan request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_StartScanReq must have been called.
+
+ @param wdiEndScanParams: the end scan parameters as specified 
+                      by the Device Interface
+  
+        wdiEndScanRspCb: callback for passing back the response
+        of the end scan operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_StartScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EndScanReq
+(
+  WDI_EndScanReqParamsType* pwdiEndScanParams,
+  WDI_EndScanRspCb          wdiEndScanRspCb,
+  void*                     pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_END_SCAN_REQ;
+  wdiEventData.pEventData      = pwdiEndScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEndScanParams); 
+  wdiEventData.pCBfnc          = wdiEndScanRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_EndScanReq*/
+
+
+/**
+ @brief WDI_FinishScanReq will be called when the upper MAC has 
+        completed the scan process on the WLAN Device. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Finish Scan Request request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_InitScanReq must have been called.
+
+ @param wdiFinishScanParams: the finish scan  parameters as 
+                      specified by the Device Interface
+  
+        wdiFinishScanRspCb: callback for passing back the
+        response of the finish scan operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_InitScanReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FinishScanReq
+(
+  WDI_FinishScanReqParamsType* pwdiFinishScanParams,
+  WDI_FinishScanRspCb          wdiFinishScanRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_FINISH_SCAN_REQ;
+  wdiEventData.pEventData      = pwdiFinishScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiFinishScanParams); 
+  wdiEventData.pCBfnc          = wdiFinishScanRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_FinishScanReq*/
+
+/*======================================================================== 
+ 
+                          ASSOCIATION APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_JoinReq will be called when the upper MAC is ready 
+        to start an association procedure to a BSS. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Join request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiJoinParams: the join parameters as specified by 
+                      the Device Interface
+  
+        wdiJoinRspCb: callback for passing back the response of
+        the join operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_JoinReq
+(
+  WDI_JoinReqParamsType* pwdiJoinParams,
+  WDI_JoinRspCb          wdiJoinRspCb,
+  void*                  pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_JOIN_REQ;
+  wdiEventData.pEventData      = pwdiJoinParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiJoinParams); 
+  wdiEventData.pCBfnc          = wdiJoinRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_JoinReq*/
+
+/**
+ @brief WDI_ConfigBSSReq will be called when the upper MAC 
+        wishes to configure the newly acquired or in process of
+        being acquired BSS to the HW . Upon the call of this API
+        the WLAN DAL will pack and send a HAL Config BSS request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinReq must have been called.
+
+ @param wdiConfigBSSParams: the config BSS parameters as 
+                      specified by the Device Interface
+  
+        wdiConfigBSSRspCb: callback for passing back the
+        response of the config BSS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigBSSReq
+(
+  WDI_ConfigBSSReqParamsType* pwdiConfigBSSParams,
+  WDI_ConfigBSSRspCb          wdiConfigBSSRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_CONFIG_BSS_REQ;
+  wdiEventData.pEventData      = pwdiConfigBSSParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigBSSParams); 
+  wdiEventData.pCBfnc          = wdiConfigBSSRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_ConfigBSSReq*/
+
+/**
+ @brief WDI_DelBSSReq will be called when the upper MAC is 
+        disassociating from the BSS and wishes to notify HW.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Del BSS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_ConfigBSSReq or WDI_PostAssocReq must have been called.
+
+ @param wdiDelBSSParams: the del BSS parameters as specified by 
+                      the Device Interface
+  
+        wdiDelBSSRspCb: callback for passing back the response
+        of the del bss operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_ConfigBSSReq, WDI_PostAssocReq 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelBSSReq
+(
+  WDI_DelBSSReqParamsType* pwdiDelBSSParams,
+  WDI_DelBSSRspCb          wdiDelBSSRspCb,
+  void*                    pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_DEL_BSS_REQ;
+  wdiEventData.pEventData      = pwdiDelBSSParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBSSParams); 
+  wdiEventData.pCBfnc          = wdiDelBSSRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_DelBSSReq*/
+
+/**
+ @brief WDI_PostAssocReq will be called when the upper MAC has 
+        associated to a BSS and wishes to configure HW for
+        associated state. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Post Assoc request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinReq must have been called.
+
+ @param wdiPostAssocReqParams: the assoc parameters as specified
+                      by the Device Interface
+  
+        wdiPostAssocRspCb: callback for passing back the
+        response of the post assoc operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_PostAssocReq
+(
+  WDI_PostAssocReqParamsType* pwdiPostAssocReqParams,
+  WDI_PostAssocRspCb          wdiPostAssocRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_POST_ASSOC_REQ;
+  wdiEventData.pEventData      = pwdiPostAssocReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiPostAssocReqParams); 
+  wdiEventData.pCBfnc          = wdiPostAssocRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_PostAssocReq*/
+
+/**
+ @brief WDI_DelSTAReq will be called when the upper MAC when an 
+        association with another STA has ended and the station
+        must be deleted from HW. Upon the call of this API the
+        WLAN DAL will pack and send a HAL Del STA request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiDelSTAParams: the Del STA parameters as specified by 
+                      the Device Interface
+  
+        wdiDelSTARspCb: callback for passing back the response
+        of the del STA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelSTAReq
+(
+  WDI_DelSTAReqParamsType* pwdiDelSTAParams,
+  WDI_DelSTARspCb          wdiDelSTARspCb,
+  void*                    pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_DEL_STA_REQ;
+  wdiEventData.pEventData      = pwdiDelSTAParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelSTAParams); 
+  wdiEventData.pCBfnc          = wdiDelSTARspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_DelSTAReq*/
+
+/*======================================================================== 
+ 
+                             SECURITY APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_SetBSSKeyReq will be called when the upper MAC wants to
+        install a BSS encryption key on the HW. Upon the call of this
+        API the WLAN DAL will pack and send a Set BSS Key request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiSetBSSKeyParams: the BSS Key set parameters as 
+                      specified by the Device Interface
+  
+        wdiSetBSSKeyRspCb: callback for passing back the
+        response of the set BSS Key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetBSSKeyReq
+(
+  WDI_SetBSSKeyReqParamsType* pwdiSetBSSKeyParams,
+  WDI_SetBSSKeyRspCb          wdiSetBSSKeyRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_BSS_KEY_REQ;
+  wdiEventData.pEventData      = pwdiSetBSSKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetBSSKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetBSSKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetBSSKeyReq*/
+
+/**
+ @brief WDI_RemoveBSSKeyReq will be called when the upper MAC wants to
+        uninstall a BSS key from HW. Upon the call of this API the
+        WLAN DAL will pack and send a HAL Remove BSS Key request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetBSSKeyReq must have been called.
+
+ @param wdiRemoveBSSKeyParams: the remove BSS key parameters as 
+                      specified by the Device Interface
+  
+        wdiRemoveBSSKeyRspCb: callback for passing back the
+        response of the remove BSS key operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetBSSKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveBSSKeyReq
+(
+  WDI_RemoveBSSKeyReqParamsType* pwdiRemoveBSSKeyParams,
+  WDI_RemoveBSSKeyRspCb          wdiRemoveBSSKeyRspCb,
+  void*                          pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_RMV_BSS_KEY_REQ;
+  wdiEventData.pEventData      = pwdiRemoveBSSKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveBSSKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveBSSKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_RemoveBSSKeyReq*/
+
+
+/**
+ @brief WDI_SetSTAKeyReq will be called when the upper MAC is 
+        ready to install a STA(ast) encryption key in HW. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Set STA Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiSetSTAKeyParams: the set STA key parameters as 
+                      specified by the Device Interface
+  
+        wdiSetSTAKeyRspCb: callback for passing back the
+        response of the set STA key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetSTAKeyReq
+(
+  WDI_SetSTAKeyReqParamsType* pwdiSetSTAKeyParams,
+  WDI_SetSTAKeyRspCb          wdiSetSTAKeyRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_STA_KEY_REQ;
+  wdiEventData.pEventData      = pwdiSetSTAKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTAKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetSTAKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetSTAKeyReq*/
+
+
+/**
+ @brief WDI_RemoveSTAKeyReq will be called when the upper MAC 
+        wants to uninstall a previously set STA key in HW. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Remove STA Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTAKeyReq must have been called.
+
+ @param wdiRemoveSTAKeyParams: the remove STA key parameters as 
+                      specified by the Device Interface
+  
+        wdiRemoveSTAKeyRspCb: callback for passing back the
+        response of the remove STA key operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetSTAKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveSTAKeyReq
+(
+  WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTAKeyParams,
+  WDI_RemoveSTAKeyRspCb          wdiRemoveSTAKeyRspCb,
+  void*                          pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_RMV_STA_KEY_REQ;
+  wdiEventData.pEventData      = pwdiRemoveSTAKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTAKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveSTAKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_RemoveSTAKeyReq*/
+
+
+/**
+ @brief WDI_SetSTABcastKeyReq will be called when the upper MAC 
+        wants to install a STA Bcast encryption key on the HW.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiSetSTABcastKeyParams: the BSS Key set parameters as 
+                      specified by the Device Interface
+  
+        wdiSetSTABcastKeyRspCb: callback for passing back the
+        response of the set BSS Key operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetSTABcastKeyReq
+(
+  WDI_SetSTAKeyReqParamsType* pwdiSetSTABcastKeyParams,
+  WDI_SetSTAKeyRspCb          wdiSetSTABcastKeyRspCb,
+  void*                       pUserData
+)
+
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_STA_BCAST_KEY_REQ;
+  wdiEventData.pEventData      = pwdiSetSTABcastKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTABcastKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetSTABcastKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetSTABcastKeyReq*/
+
+/**
+ @brief WDI_RemoveSTABcastKeyReq will be called when the upper 
+        MAC wants to uninstall a STA Bcast key from HW. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Remove STA Bcast Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTABcastKeyReq must have been called.
+
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
+                      parameters as specified by the Device
+                      Interface
+  
+        wdiRemoveSTABcastKeyRspCb: callback for passing back the
+        response of the remove STA Bcast key operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetSTABcastKeyReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemoveSTABcastKeyReq
+(
+  WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTABcastKeyParams,
+  WDI_RemoveSTAKeyRspCb          wdiRemoveSTABcastKeyRspCb,
+  void*                          pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_RMV_STA_BCAST_KEY_REQ;
+  wdiEventData.pEventData      = pwdiRemoveSTABcastKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTABcastKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveSTABcastKeyRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_RemoveSTABcastKeyReq*/
+
+/**
+ @brief WDI_SetMaxTxPowerReq will be called when the upper 
+        MAC wants to set Max Tx Power to HW. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Remove STA Bcast Key request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_SetSTABcastKeyReq must have been called.
+
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
+                      parameters as specified by the Device
+                      Interface
+  
+        wdiRemoveSTABcastKeyRspCb: callback for passing back the
+        response of the remove STA Bcast key operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_SetMaxTxPowerReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetMaxTxPowerReq
+(
+  WDI_SetMaxTxPowerParamsType*   pwdiSetMaxTxPowerParams,
+  WDA_SetMaxTxPowerRspCb         wdiReqStatusCb,
+  void*                          pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_MAX_TX_POWER_REQ;
+  wdiEventData.pEventData      = pwdiSetMaxTxPowerParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetMaxTxPowerParams); 
+  wdiEventData.pCBfnc          = wdiReqStatusCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+#ifdef FEATURE_WLAN_CCX
+WDI_Status
+WDI_TSMStatsReq
+(
+   WDI_TSMStatsReqParamsType*        pwdiTsmReqParams,
+   WDI_TsmRspCb                 wdiReqStatusCb,
+   void*                        pUserData
+)
+{
+  WDI_EventInfoType wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_TSM_STATS_REQ;
+  wdiEventData.pEventData      = pwdiTsmReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiTsmReqParams); 
+  wdiEventData.pCBfnc          = wdiReqStatusCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}
+#endif
+
+/*======================================================================== 
+ 
+                            QoS and BA APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_AddTSReq will be called when the upper MAC to inform
+        the device of a successful add TSpec negotiation. HW
+        needs to receive the TSpec Info from the UMAC in order
+        to configure properly the QoS data traffic. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Add TS request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddTsReqParams: the add TS parameters as specified by
+                      the Device Interface
+  
+        wdiAddTsRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddTSReq
+(
+  WDI_AddTSReqParamsType* pwdiAddTsReqParams,
+  WDI_AddTsRspCb          wdiAddTsRspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ADD_TS_REQ;
+  wdiEventData.pEventData      = pwdiAddTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddTsReqParams); 
+  wdiEventData.pCBfnc          = wdiAddTsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AddTSReq*/
+
+
+
+/**
+ @brief WDI_DelTSReq will be called when the upper MAC has ended
+        admission on a specific AC. This is to inform HW that
+        QoS traffic parameters must be rest. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Del TS
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_AddTSReq must have been called.
+
+ @param wdiDelTsReqParams: the del TS parameters as specified by
+                      the Device Interface
+  
+        wdiDelTsRspCb: callback for passing back the response of
+        the del TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddTSReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelTSReq
+(
+  WDI_DelTSReqParamsType* pwdiDelTsReqParams,
+  WDI_DelTsRspCb          wdiDelTsRspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_DEL_TS_REQ;
+  wdiEventData.pEventData      = pwdiDelTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelTsReqParams); 
+  wdiEventData.pCBfnc          = wdiDelTsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_DelTSReq*/
+
+
+
+/**
+ @brief WDI_UpdateEDCAParams will be called when the upper MAC 
+        wishes to update the EDCA parameters used by HW for QoS
+        data traffic. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Update EDCA Params request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiUpdateEDCAParams: the start parameters as specified 
+                      by the Device Interface
+  
+        wdiUpdateEDCAParamsRspCb: callback for passing back the
+        response of the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateEDCAParams
+(
+  WDI_UpdateEDCAParamsType*    pwdiUpdateEDCAParams,
+  WDI_UpdateEDCAParamsRspCb    wdiUpdateEDCAParamsRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPD_EDCA_PRMS_REQ;
+  wdiEventData.pEventData      = pwdiUpdateEDCAParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateEDCAParams); 
+  wdiEventData.pCBfnc          = wdiUpdateEDCAParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_UpdateEDCAParams*/
+
+
+/**
+ @brief WDI_AddBASessionReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddBASessionReq
+(
+  WDI_AddBASessionReqParamsType* pwdiAddBASessionReqParams,
+  WDI_AddBASessionRspCb          wdiAddBASessionRspCb,
+  void*                          pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ADD_BA_SESSION_REQ;
+  wdiEventData.pEventData      = pwdiAddBASessionReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBASessionReqParams); 
+  wdiEventData.pCBfnc          = wdiAddBASessionRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AddBASessionReq*/
+
+/**
+ @brief WDI_DelBAReq will be called when the upper MAC wants to 
+        inform HW that it has deleted a previously created BA
+        session. Upon the call of this API the WLAN DAL will
+        pack and send a HAL Del BA request message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_AddBAReq must have been called.
+
+ @param wdiDelBAReqParams: the del BA parameters as specified by
+                      the Device Interface
+  
+        wdiDelBARspCb: callback for passing back the response of
+        the del BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelBAReq
+(
+  WDI_DelBAReqParamsType* pwdiDelBAReqParams,
+  WDI_DelBARspCb          wdiDelBARspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_DEL_BA_REQ;
+  wdiEventData.pEventData      = pwdiDelBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBAReqParams); 
+  wdiEventData.pCBfnc          = wdiDelBARspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_DelBAReq*/
+
+/*======================================================================== 
+ 
+                            Power Save APIs
+ 
+==========================================================================*/
+
+/**
+ @brief WDI_SetPwrSaveCfgReq will be called when the upper MAC 
+        wants to set the power save related configurations of
+        the WLAN Device. Upon the call of this API the WLAN DAL
+        will pack and send a HAL Update CFG request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param pwdiPowerSaveCfg: the power save cfg parameters as 
+                      specified by the Device Interface
+  
+        wdiSetPwrSaveCfgCb: callback for passing back the
+        response of the set power save cfg operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call  
+*/ 
+WDI_Status 
+WDI_SetPwrSaveCfgReq
+(
+  WDI_UpdateCfgReqParamsType*   pwdiPowerSaveCfg,
+  WDI_SetPwrSaveCfgCb     wdiSetPwrSaveCfgCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPDATE_CFG_REQ;
+  wdiEventData.pEventData      = pwdiPowerSaveCfg; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiPowerSaveCfg); 
+  wdiEventData.pCBfnc          = wdiSetPwrSaveCfgCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetPwrSaveCfgReq*/
+
+/**
+ @brief WDI_EnterImpsReq will be called when the upper MAC to 
+        request the device to get into IMPS power state. Upon
+        the call of this API the WLAN DAL will send a HAL Enter
+        IMPS request message to the lower RIVA sub-system if DAL
+        is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param wdiEnterImpsRspCb: callback for passing back the 
+        response of the Enter IMPS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterImpsReq
+(
+   WDI_EnterImpsRspCb  wdiEnterImpsRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ENTER_IMPS_REQ;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiEnterImpsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_EnterImpsReq*/
+
+/**
+ @brief WDI_ExitImpsReq will be called when the upper MAC to 
+        request the device to get out of IMPS power state. Upon
+        the call of this API the WLAN DAL will send a HAL Exit
+        IMPS request message to the lower RIVA sub-system if DAL
+        is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ 
+
+ @param wdiExitImpsRspCb: callback for passing back the response 
+        of the Exit IMPS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitImpsReq
+(
+   WDI_ExitImpsRspCb  wdiExitImpsRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_EXIT_IMPS_REQ;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiExitImpsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_ExitImpsReq*/
+
+/**
+ @brief WDI_EnterBmpsReq will be called when the upper MAC to 
+        request the device to get into BMPS power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Enter BMPS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiEnterBmpsReqParams: the Enter BMPS parameters as 
+                      specified by the Device Interface
+  
+        wdiEnterBmpsRspCb: callback for passing back the
+        response of the Enter BMPS operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterBmpsReq
+(
+   WDI_EnterBmpsReqParamsType *pwdiEnterBmpsReqParams,
+   WDI_EnterBmpsRspCb  wdiEnterBmpsRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ENTER_BMPS_REQ;
+  wdiEventData.pEventData      = pwdiEnterBmpsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterBmpsReqParams); 
+  wdiEventData.pCBfnc          = wdiEnterBmpsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_EnterBmpsReq*/
+
+/**
+ @brief WDI_ExitBmpsReq will be called when the upper MAC to 
+        request the device to get out of BMPS power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Exit BMPS request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiExitBmpsReqParams: the Exit BMPS parameters as 
+                      specified by the Device Interface
+  
+        wdiExitBmpsRspCb: callback for passing back the response
+        of the Exit BMPS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitBmpsReq
+(
+   WDI_ExitBmpsReqParamsType *pwdiExitBmpsReqParams,
+   WDI_ExitBmpsRspCb  wdiExitBmpsRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_EXIT_BMPS_REQ;
+  wdiEventData.pEventData      = pwdiExitBmpsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiExitBmpsReqParams); 
+  wdiEventData.pCBfnc          = wdiExitBmpsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_ExitBmpsReq*/
+
+/**
+ @brief WDI_EnterUapsdReq will be called when the upper MAC to 
+        request the device to get into UAPSD power state. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Enter UAPSD request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+ WDI_SetUapsdAcParamsReq must have been called.
+  
+ @param pwdiEnterUapsdReqParams: the Enter UAPSD parameters as 
+                      specified by the Device Interface
+  
+        wdiEnterUapsdRspCb: callback for passing back the
+        response of the Enter UAPSD operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq, WDI_SetUapsdAcParamsReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_EnterUapsdReq
+(
+   WDI_EnterUapsdReqParamsType *pwdiEnterUapsdReqParams,
+   WDI_EnterUapsdRspCb  wdiEnterUapsdRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ENTER_UAPSD_REQ;
+  wdiEventData.pEventData      = pwdiEnterUapsdReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterUapsdReqParams); 
+  wdiEventData.pCBfnc          = wdiEnterUapsdRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_EnterUapsdReq*/
+
+/**
+ @brief WDI_ExitUapsdReq will be called when the upper MAC to 
+        request the device to get out of UAPSD power state. Upon
+        the call of this API the WLAN DAL will send a HAL Exit
+        UAPSD request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiExitUapsdRspCb: callback for passing back the 
+        response of the Exit UAPSD operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ExitUapsdReq
+(
+   WDI_ExitUapsdRspCb  wdiExitUapsdRspCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_EXIT_UAPSD_REQ;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiExitUapsdRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_ExitUapsdReq*/
+
+/**
+ @brief WDI_UpdateUapsdParamsReq will be called when the upper 
+        MAC wants to set the UAPSD related configurations
+        of an associated STA (while acting as an AP) to the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Update UAPSD params request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_ConfigBSSReq must have been called.
+
+ @param pwdiUpdateUapsdReqParams: the UAPSD parameters 
+                      as specified by the Device Interface
+  
+        wdiUpdateUapsdParamsCb: callback for passing back the
+        response of the update UAPSD params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_ConfigBSSReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateUapsdParamsReq
+(
+   WDI_UpdateUapsdReqParamsType *pwdiUpdateUapsdReqParams,
+   WDI_UpdateUapsdParamsCb  wdiUpdateUapsdParamsCb,
+   void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPDATE_UAPSD_PARAM_REQ;
+  wdiEventData.pEventData      = pwdiUpdateUapsdReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateUapsdReqParams);; 
+  wdiEventData.pCBfnc          = wdiUpdateUapsdParamsCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_UpdateUapsdParamsReq*/
+
+/**
+ @brief WDI_SetUapsdAcParamsReq will be called when the upper 
+        MAC wants to set the UAPSD related configurations before
+        requesting for enter UAPSD power state to the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Set UAPSD params request message to
+        the lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiUapsdInfo: the UAPSD parameters as specified by
+                      the Device Interface
+  
+        wdiSetUapsdAcParamsCb: callback for passing back the
+        response of the set UAPSD params operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetUapsdAcParamsReq
+(
+  WDI_SetUapsdAcParamsReqParamsType*      pwdiUapsdInfo,
+  WDI_SetUapsdAcParamsCb  wdiSetUapsdAcParamsCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_UAPSD_PARAM_REQ;
+  wdiEventData.pEventData      = pwdiUapsdInfo; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUapsdInfo); 
+  wdiEventData.pCBfnc          = wdiSetUapsdAcParamsCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetUapsdAcParamsReq*/
+
+/**
+ @brief WDI_ConfigureRxpFilterReq will be called when the upper 
+        MAC wants to set/reset the RXP filters for received pkts
+        (MC, BC etc.). Upon the call of this API the WLAN DAL will pack
+        and send a HAL configure RXP filter request message to
+        the lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiConfigureRxpFilterReqParams: the RXP 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiConfigureRxpFilterCb: callback for passing back the
+        response of the configure RXP filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigureRxpFilterReq
+(
+   WDI_ConfigureRxpFilterReqParamsType *pwdiConfigureRxpFilterReqParams,
+   WDI_ConfigureRxpFilterCb             wdiConfigureRxpFilterCb,
+   void*                                pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_CONFIGURE_RXP_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiConfigureRxpFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureRxpFilterReqParams); 
+   wdiEventData.pCBfnc          = wdiConfigureRxpFilterCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_ConfigureRxpFilterReq*/
+
+/**
+ @brief WDI_SetBeaconFilterReq will be called when the upper MAC
+        wants to set the beacon filters while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a Beacon filter request message to the
+        lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiBeaconFilterCb: callback for passing back the
+        response of the set beacon filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetBeaconFilterReq
+(
+   WDI_BeaconFilterReqParamsType   *pwdiBeaconFilterReqParams,
+   WDI_SetBeaconFilterCb            wdiBeaconFilterCb,
+   void*                            pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_BEACON_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiBeaconFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);; 
+   wdiEventData.pCBfnc          = wdiBeaconFilterCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_SetBeaconFilterReq*/
+
+/**
+ @brief WDI_RemBeaconFilterReq will be called when the upper MAC
+        wants to remove the beacon filter for particular IE
+        while in power save. Upon the call of this API the WLAN
+        DAL will pack and send a remove Beacon filter request
+        message to the lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
+                      filter as specified by the Device
+                      Interface
+  
+        wdiBeaconFilterCb: callback for passing back the
+        response of the remove beacon filter operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_RemBeaconFilterReq
+(
+   WDI_RemBeaconFilterReqParamsType *pwdiBeaconFilterReqParams,
+   WDI_RemBeaconFilterCb             wdiBeaconFilterCb,
+   void*                             pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_REM_BEACON_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiBeaconFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);; 
+   wdiEventData.pCBfnc          = wdiBeaconFilterCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_RemBeaconFilterReq*/
+
+/**
+ @brief WDI_SetRSSIThresholdsReq will be called when the upper 
+        MAC wants to set the RSSI thresholds related
+        configurations while in power save. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Set RSSI
+        thresholds request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiUapsdInfo: the UAPSD parameters as specified by
+                      the Device Interface
+  
+        wdiSetUapsdAcParamsCb: callback for passing back the
+        response of the set UAPSD params operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetRSSIThresholdsReq
+(
+  WDI_SetRSSIThresholdsReqParamsType*      pwdiRSSIThresholdsParams,
+  WDI_SetRSSIThresholdsCb                  wdiSetRSSIThresholdsCb,
+  void*                                    pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_RSSI_THRESHOLDS_REQ;
+   wdiEventData.pEventData      = pwdiRSSIThresholdsParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRSSIThresholdsParams);; 
+   wdiEventData.pCBfnc          = wdiSetRSSIThresholdsCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/* WDI_SetRSSIThresholdsReq*/
+
+/**
+ @brief WDI_HostOffloadReq will be called when the upper MAC 
+        wants to set the filter to minimize unnecessary host
+        wakeup due to broadcast traffic while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL host offload request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiHostOffloadParams: the host offload as specified 
+                      by the Device Interface
+  
+        wdiHostOffloadCb: callback for passing back the response
+        of the host offload operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_HostOffloadReq
+(
+  WDI_HostOffloadReqParamsType*      pwdiHostOffloadParams,
+  WDI_HostOffloadCb                  wdiHostOffloadCb,
+  void*                              pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_HOST_OFFLOAD_REQ;
+   wdiEventData.pEventData      = pwdiHostOffloadParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiHostOffloadParams);; 
+   wdiEventData.pCBfnc          = wdiHostOffloadCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_HostOffloadReq*/
+
+/**
+ @brief WDI_KeepAliveReq will be called when the upper MAC 
+        wants to set the filter to send NULL or unsolicited ARP responses 
+        and minimize unnecessary host wakeups due to while in power save.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Keep Alive request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiKeepAliveParams: the Keep Alive as specified 
+                      by the Device Interface
+  
+        wdiKeepAliveCb: callback for passing back the response
+        of the Keep Alive operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_KeepAliveReq
+(
+  WDI_KeepAliveReqParamsType*        pwdiKeepAliveParams,
+  WDI_KeepAliveCb                    wdiKeepAliveCb,
+  void*                              pUserData
+)
+{
+    WDI_EventInfoType      wdiEventData;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+    /*------------------------------------------------------------------------
+     Sanity Check 
+    ------------------------------------------------------------------------*/
+    if ( eWLAN_PAL_FALSE == gWDIInitialized )
+    {
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "WDI_KeepAliveReq: WDI API call before module "
+                    "is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+    }
+
+    /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+    ------------------------------------------------------------------------*/
+    wdiEventData.wdiRequest      = WDI_KEEP_ALIVE_REQ;
+    wdiEventData.pEventData      = pwdiKeepAliveParams; 
+    wdiEventData.uEventDataSize  = sizeof(*pwdiKeepAliveParams); 
+    wdiEventData.pCBfnc          = wdiKeepAliveCb; 
+    wdiEventData.pUserData       = pUserData;
+
+    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_KeepAliveReq*/
+
+/**
+ @brief WDI_WowlAddBcPtrnReq will be called when the upper MAC 
+        wants to set the Wowl Bcast ptrn to minimize unnecessary
+        host wakeup due to broadcast traffic while in power
+        save. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Wowl Bcast ptrn request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiWowlAddBcPtrnParams: the Wowl bcast ptrn as 
+                      specified by the Device Interface
+  
+        wdiWowlAddBcPtrnCb: callback for passing back the
+        response of the add Wowl bcast ptrn operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlAddBcPtrnReq
+(
+  WDI_WowlAddBcPtrnReqParamsType*    pwdiWowlAddBcPtrnParams,
+  WDI_WowlAddBcPtrnCb                wdiWowlAddBcPtrnCb,
+  void*                              pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_WOWL_ADD_BC_PTRN_REQ;
+   wdiEventData.pEventData      = pwdiWowlAddBcPtrnParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlAddBcPtrnParams);; 
+   wdiEventData.pCBfnc          = wdiWowlAddBcPtrnCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_WowlAddBcPtrnReq*/
+
+/**
+ @brief WDI_WowlDelBcPtrnReq will be called when the upper MAC 
+        wants to clear the Wowl Bcast ptrn. Upon the call of
+        this API the WLAN DAL will pack and send a HAL delete
+        Wowl Bcast ptrn request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_WowlAddBcPtrnReq must have been called.
+
+ @param pwdiWowlDelBcPtrnParams: the Wowl bcast ptrn as 
+                      specified by the Device Interface
+  
+        wdiWowlDelBcPtrnCb: callback for passing back the
+        response of the del Wowl bcast ptrn operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_WowlAddBcPtrnReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlDelBcPtrnReq
+(
+  WDI_WowlDelBcPtrnReqParamsType*    pwdiWowlDelBcPtrnParams,
+  WDI_WowlDelBcPtrnCb                wdiWowlDelBcPtrnCb,
+  void*                              pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_WOWL_DEL_BC_PTRN_REQ;
+   wdiEventData.pEventData      = pwdiWowlDelBcPtrnParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlDelBcPtrnParams);; 
+   wdiEventData.pCBfnc          = wdiWowlDelBcPtrnCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_WowlDelBcPtrnReq*/
+
+/**
+ @brief WDI_WowlEnterReq will be called when the upper MAC 
+        wants to enter the Wowl state to minimize unnecessary
+        host wakeup while in power save. Upon the call of this
+        API the WLAN DAL will pack and send a HAL Wowl enter
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiWowlEnterReqParams: the Wowl enter info as 
+                      specified by the Device Interface
+  
+        wdiWowlEnterReqCb: callback for passing back the
+        response of the enter Wowl operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlEnterReq
+(
+  WDI_WowlEnterReqParamsType*    pwdiWowlEnterParams,
+  WDI_WowlEnterReqCb             wdiWowlEnterCb,
+  void*                          pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_WOWL_ENTER_REQ;
+   wdiEventData.pEventData      = pwdiWowlEnterParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlEnterParams);; 
+   wdiEventData.pCBfnc          = wdiWowlEnterCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_WowlEnterReq*/
+
+/**
+ @brief WDI_WowlExitReq will be called when the upper MAC 
+        wants to exit the Wowl state. Upon the call of this API
+        the WLAN DAL will pack and send a HAL Wowl exit request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_WowlEnterReq must have been called.
+
+ @param pwdiWowlExitReqParams: the Wowl exit info as 
+                      specified by the Device Interface
+  
+        wdiWowlExitReqCb: callback for passing back the response
+        of the exit Wowl operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_WowlEnterReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_WowlExitReq
+(
+  WDI_WowlExitReqCb              wdiWowlExitCb,
+  void*                          pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_WOWL_EXIT_REQ;
+   wdiEventData.pEventData      = NULL; 
+   wdiEventData.uEventDataSize  = 0; 
+   wdiEventData.pCBfnc          = wdiWowlExitCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_WowlExitReq*/
+
+/**
+ @brief WDI_ConfigureAppsCpuWakeupStateReq will be called when 
+        the upper MAC wants to dynamically adjusts the listen
+        interval based on the WLAN/MSM activity. Upon the call
+        of this API the WLAN DAL will pack and send a HAL
+        configure Apps Cpu Wakeup State request message to the
+        lower RIVA sub-system.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param pwdiConfigureAppsCpuWakeupStateReqParams: the 
+                      Apps Cpu Wakeup State as specified by the
+                      Device Interface
+  
+        wdiConfigureAppsCpuWakeupStateCb: callback for passing
+        back the response of the configure Apps Cpu Wakeup State
+        operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigureAppsCpuWakeupStateReq
+(
+   WDI_ConfigureAppsCpuWakeupStateReqParamsType *pwdiConfigureAppsCpuWakeupStateReqParams,
+   WDI_ConfigureAppsCpuWakeupStateCb             wdiConfigureAppsCpuWakeupStateCb,
+   void*                                         pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ;
+   wdiEventData.pEventData      = pwdiConfigureAppsCpuWakeupStateReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureAppsCpuWakeupStateReqParams); 
+   wdiEventData.pCBfnc          = wdiConfigureAppsCpuWakeupStateCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_ConfigureAppsCpuWakeupStateReq*/
+/**
+ @brief WDI_FlushAcReq will be called when the upper MAC wants 
+        to to perform a flush operation on a given AC. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Flush AC request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_AddBAReq must have been called.
+
+ @param pwdiFlushAcReqParams: the Flush AC parameters as 
+                      specified by the Device Interface
+  
+        wdiFlushAcRspCb: callback for passing back the response
+        of the Flush AC operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FlushAcReq
+(
+  WDI_FlushAcReqParamsType* pwdiFlushAcReqParams,
+  WDI_FlushAcRspCb          wdiFlushAcRspCb,
+  void*                     pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_FLUSH_AC_REQ;
+   wdiEventData.pEventData      = pwdiFlushAcReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiFlushAcReqParams); 
+   wdiEventData.pCBfnc          = wdiFlushAcRspCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_FlushAcReq*/
+
+/**
+ @brief WDI_BtAmpEventReq will be called when the upper MAC 
+        wants to notify the lower mac on a BT AMP event. This is
+        to inform BTC-SLM that some BT AMP event occurred. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL BT AMP event request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+  
+ @param wdiBtAmpEventReqParams: the BT AMP event parameters as 
+                      specified by the Device Interface
+  
+        wdiBtAmpEventRspCb: callback for passing back the
+        response of the BT AMP event operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+ 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_BtAmpEventReq
+(
+  WDI_BtAmpEventParamsType* pwdiBtAmpEventReqParams,
+  WDI_BtAmpEventRspCb       wdiBtAmpEventRspCb,
+  void*                     pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_BTAMP_EVENT_REQ;
+   wdiEventData.pEventData      = pwdiBtAmpEventReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBtAmpEventReqParams); 
+   wdiEventData.pCBfnc          = wdiBtAmpEventRspCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_BtAmpEventReq*/
+
+
+
+/*======================================================================== 
+ 
+                             CONTROL APIs
+ 
+==========================================================================*/
+/**
+ @brief WDI_SwitchChReq will be called when the upper MAC wants 
+        the WLAN HW to change the current channel of operation.
+        Upon the call of this API the WLAN DAL will pack and
+        send a HAL Start request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiSwitchChReqParams: the switch ch parameters as 
+                      specified by the Device Interface
+  
+        wdiSwitchChRspCb: callback for passing back the response
+        of the switch ch operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SwitchChReq
+(
+  WDI_SwitchChReqParamsType* pwdiSwitchChReqParams,
+  WDI_SwitchChRspCb          wdiSwitchChRspCb,
+  void*                      pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_CH_SWITCH_REQ;
+  wdiEventData.pEventData      = pwdiSwitchChReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSwitchChReqParams); 
+  wdiEventData.pCBfnc          = wdiSwitchChRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SwitchChReq*/
+
+
+/**
+ @brief WDI_ConfigSTAReq will be called when the upper MAC 
+        wishes to add or update a STA in HW. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Start
+        message request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiConfigSTAReqParams: the config STA parameters as 
+                      specified by the Device Interface
+  
+        wdiConfigSTARspCb: callback for passing back the
+        response of the config STA operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_ConfigSTAReq
+(
+  WDI_ConfigSTAReqParamsType* pwdiConfigSTAReqParams,
+  WDI_ConfigSTARspCb          wdiConfigSTARspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_CONFIG_STA_REQ;
+  wdiEventData.pEventData      = pwdiConfigSTAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigSTAReqParams); 
+  wdiEventData.pCBfnc          = wdiConfigSTARspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_ConfigSTAReq*/
+
+/**
+ @brief WDI_SetLinkStateReq will be called when the upper MAC 
+        wants to change the state of an ongoing link. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Start message request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_JoinStartReq must have been called.
+
+ @param wdiSetLinkStateReqParams: the set link state parameters 
+                      as specified by the Device Interface
+  
+        wdiSetLinkStateRspCb: callback for passing back the
+        response of the set link state operation received from
+        the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_JoinStartReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetLinkStateReq
+(
+  WDI_SetLinkReqParamsType* pwdiSetLinkStateReqParams,
+  WDI_SetLinkStateRspCb     wdiSetLinkStateRspCb,
+  void*                     pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SET_LINK_ST_REQ;
+  wdiEventData.pEventData      = pwdiSetLinkStateReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetLinkStateReqParams); 
+  wdiEventData.pCBfnc          = wdiSetLinkStateRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetLinkStateReq*/
+
+
+/**
+ @brief WDI_GetStatsReq will be called when the upper MAC wants 
+        to get statistics (MIB counters) from the device. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL Start request message to the lower RIVA sub-system
+        if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiGetStatsReqParams: the stats parameters to get as 
+                      specified by the Device Interface
+  
+        wdiGetStatsRspCb: callback for passing back the response
+        of the get stats operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GetStatsReq
+(
+  WDI_GetStatsReqParamsType* pwdiGetStatsReqParams,
+  WDI_GetStatsRspCb          wdiGetStatsRspCb,
+  void*                      pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_GET_STATS_REQ;
+  wdiEventData.pEventData      = pwdiGetStatsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiGetStatsReqParams); 
+  wdiEventData.pCBfnc          = wdiGetStatsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_GetStatsReq*/
+
+
+/**
+ @brief WDI_UpdateCfgReq will be called when the upper MAC when 
+        it wishes to change the configuration of the WLAN
+        Device. Upon the call of this API the WLAN DAL will pack
+        and send a HAL Update CFG request message to the lower
+        RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_Start must have been called.
+
+ @param wdiUpdateCfgReqParams: the update cfg parameters as 
+                      specified by the Device Interface
+  
+        wdiUpdateCfgsRspCb: callback for passing back the
+        response of the update cfg operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_Start
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateCfgReq
+(
+  WDI_UpdateCfgReqParamsType* pwdiUpdateCfgReqParams,
+  WDI_UpdateCfgRspCb          wdiUpdateCfgsRspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPDATE_CFG_REQ;
+  wdiEventData.pEventData      = pwdiUpdateCfgReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateCfgReqParams); 
+  wdiEventData.pCBfnc          = wdiUpdateCfgsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_UpdateCfgReq*/
+
+
+
+/**
+ @brief WDI_AddBAReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AddBAReq
+(
+  WDI_AddBAReqParamsType* pwdiAddBAReqParams,
+  WDI_AddBARspCb          wdiAddBARspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ADD_BA_REQ;
+  wdiEventData.pEventData      = pwdiAddBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBAReqParams); 
+  wdiEventData.pCBfnc          = wdiAddBARspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AddBAReq*/
+
+
+/**
+ @brief WDI_TriggerBAReq will be called when the upper MAC has setup
+        successfully a BA session and needs to notify the HW for
+        the appropriate settings to take place. Upon the call of
+        this API the WLAN DAL will pack and send a HAL Add BA
+        request message to the lower RIVA sub-system if DAL is
+        in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddBAReqParams: the add BA parameters as specified by
+                      the Device Interface
+  
+        wdiAddBARspCb: callback for passing back the response of
+        the add BA operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_TriggerBAReq
+(
+  WDI_TriggerBAReqParamsType* pwdiTriggerBAReqParams,
+  WDI_TriggerBARspCb          wdiTriggerBARspCb,
+  void*                       pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_TRIGGER_BA_REQ;
+  wdiEventData.pEventData      = pwdiTriggerBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiTriggerBAReqParams); 
+  wdiEventData.pCBfnc          = wdiTriggerBARspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AddBAReq*/
+
+/**
+ @brief WDI_UpdateBeaconParamsReq will be called when the upper MAC 
+        wishes to update any of the Beacon parameters used by HW.
+        Upon the call of this API the WLAN DAL will pack and send a HAL Update Beacon Params request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiUpdateBeaconParams: the Beacon parameters as specified 
+                      by the Device Interface
+  
+        wdiUpdateBeaconParamsRspCb: callback for passing back the
+        response of the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateBeaconParamsReq
+(
+  WDI_UpdateBeaconParamsType*    pwdiUpdateBeaconParams,
+  WDI_UpdateBeaconParamsRspCb    wdiUpdateBeaconParamsRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPD_BCON_PRMS_REQ;
+  wdiEventData.pEventData      = pwdiUpdateBeaconParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateBeaconParams); 
+  wdiEventData.pCBfnc          = wdiUpdateBeaconParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_UpdateBeaconParamsReq*/
+
+/**
+ @brief WDI_SendBeaconParamsReq will be called when the upper MAC 
+        wishes to update  the Beacon template used by HW.
+        Upon the call of this API the WLAN DAL will pack and send a HAL Update Beacon template request
+        message to the lower RIVA sub-system if DAL is in state
+        STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiSendBeaconParams: the Beacon parameters as specified 
+                      by the Device Interface
+  
+        wdiSendBeaconParamsRspCb: callback for passing back the
+        response of the start operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SendBeaconParamsReq
+(
+  WDI_SendBeaconParamsType*    pwdiSendBeaconParams,
+  WDI_SendBeaconParamsRspCb    wdiSendBeaconParamsRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_SND_BCON_REQ;
+  wdiEventData.pEventData      = pwdiSendBeaconParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSendBeaconParams); 
+  wdiEventData.pCBfnc          = wdiSendBeaconParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SendBeaconParamsReq*/
+
+/**
+ @brief WDI_UpdateProbeRspTemplateReq will be called when the 
+        upper MAC wants to update the probe response template to
+        be transmitted as Soft AP
+         Upon the call of this API the WLAN DAL will
+        pack and send the probe rsp template  message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
+                      specified by the Device Interface
+  
+        wdiSendBeaconParamsRspCb: callback for passing back the
+        response of the Send Beacon Params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+
+WDI_Status 
+WDI_UpdateProbeRspTemplateReq
+(
+  WDI_UpdateProbeRspTemplateParamsType*    pwdiUpdateProbeRspParams,
+  WDI_UpdateProbeRspTemplateRspCb          wdiUpdateProbeRspParamsRspCb,
+  void*                                    pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_UPD_PROBE_RSP_TEMPLATE_REQ;
+  wdiEventData.pEventData      = pwdiUpdateProbeRspParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateProbeRspParams); 
+  wdiEventData.pCBfnc          = wdiUpdateProbeRspParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_UpdateProbeRspTemplateReq*/
+
+/**
+ @brief WDI_NvDownloadReq will be called by the UMAC to download the NV blob
+        to the NV memory.
+
+
+ @param wdiNvDownloadReqParams: the NV Download parameters as specified by
+                      the Device Interface
+  
+        wdiNvDownloadRspCb: callback for passing back the response of
+        the NV Download operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_NvDownloadReq
+(
+  WDI_NvDownloadReqParamsType* pwdiNvDownloadReqParams,
+  WDI_NvDownloadRspCb        wdiNvDownloadRspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_NV_DOWNLOAD_REQ;            
+  wdiEventData.pEventData      = (void *)pwdiNvDownloadReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiNvDownloadReqParams); 
+  wdiEventData.pCBfnc          = wdiNvDownloadRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_START_EVENT, &wdiEventData);
+
+}/*WDI_NVDownloadReq*/
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ @brief WDI_SetP2PGONOAReq will be called when the 
+        upper MAC wants to send Notice of Absence
+         Upon the call of this API the WLAN DAL will
+        pack and send the probe rsp template  message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
+                      specified by the Device Interface
+  
+        wdiSendBeaconParamsRspCb: callback for passing back the
+        response of the Send Beacon Params operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_AddBAReq
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetP2PGONOAReq
+(
+  WDI_SetP2PGONOAReqParamsType*    pwdiP2PGONOAReqParams,
+  WDI_SetP2PGONOAReqParamsRspCb    wdiP2PGONOAReqParamsRspCb,
+  void*                            pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ;
+  wdiEventData.pEventData      = pwdiP2PGONOAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiP2PGONOAReqParams); 
+  wdiEventData.pCBfnc          = wdiP2PGONOAReqParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetP2PGONOAReq*/
+#endif
+
+/**
+ @brief WDI_AddSTASelfReq will be called when the 
+        UMAC wanted to add STA self while opening any new session
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiAddSTASelfParams: the add sta self parameters as 
+                      specified by the Device Interface
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see 
+ @return Result of the function call
+*/
+WDI_Status
+WDI_AddSTASelfReq
+(
+  WDI_AddSTASelfReqParamsType* pwdiAddSTASelfReqParams,
+  WDI_AddSTASelfParamsRspCb    wdiAddSTASelfReqParamsRspCb,
+  void*                        pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_ADD_STA_SELF_REQ;
+  wdiEventData.pEventData      = pwdiAddSTASelfReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddSTASelfReqParams); 
+  wdiEventData.pCBfnc          = wdiAddSTASelfReqParamsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AddSTASelfReq*/
+
+
+#ifdef WLAN_FEATURE_VOWIFI_11R 
+/**
+ @brief WDI_AggrAddTSReq will be called when the upper MAC to inform
+        the device of a successful add TSpec negotiation. HW
+        needs to receive the TSpec Info from the UMAC in order
+        to configure properly the QoS data traffic. Upon the
+        call of this API the WLAN DAL will pack and send a HAL
+        Add TS request message to the lower RIVA sub-system if
+        DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param wdiAddTsReqParams: the add TS parameters as specified by
+                      the Device Interface
+  
+        wdiAddTsRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_AggrAddTSReq
+(
+  WDI_AggrAddTSReqParamsType* pwdiAggrAddTsReqParams,
+  WDI_AggrAddTsRspCb          wdiAggrAddTsRspCb,
+  void*                   pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_AGGR_ADD_TS_REQ;
+  wdiEventData.pEventData      = pwdiAggrAddTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAggrAddTsReqParams); 
+  wdiEventData.pCBfnc          = wdiAggrAddTsRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AggrAddTSReq*/
+
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+#ifdef ANI_MANF_DIAG
+/**
+ @brief WDI_FTMCommandReq
+        Post FTM Command Event
+ 
+ @param  ftmCommandReq:   FTM Command Body 
+ @param  ftmCommandRspCb: FTM Response from HAL CB 
+ @param  pUserData:       Client Data
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_FTMCommandReq
+(
+  WDI_FTMCommandReqType *ftmCommandReq,
+  WDI_FTMCommandRspCb    ftmCommandRspCb,
+  void                  *pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest     = WDI_FTM_CMD_REQ;
+  wdiEventData.pEventData     = (void *)ftmCommandReq;
+  wdiEventData.uEventDataSize = ftmCommandReq->bodyLength + sizeof(wpt_uint32);
+  wdiEventData.pCBfnc         = ftmCommandRspCb;
+  wdiEventData.pUserData      = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+#endif /* ANI_MANF_DIAG */ 
+/**
+ @brief WDI_HostResumeReq will be called 
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiResumeReqParams:  as specified by
+                      the Device Interface
+  
+        wdiResumeReqRspCb: callback for passing back the response of
+        the  Resume Req received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see 
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_HostResumeReq
+(
+  WDI_ResumeParamsType*            pwdiResumeReqParams,
+  WDI_HostResumeEventRspCb         wdiResumeReqRspCb,
+  void*                            pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_HOST_RESUME_REQ;
+  wdiEventData.pEventData      = pwdiResumeReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiResumeReqParams); 
+  wdiEventData.pCBfnc          = wdiResumeReqRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_HostResumeReq*/
+
+/**
+ @brief WDI_DelSTASelfReq will be called 
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+
+ @param pwdiDelStaSelfReqParams:  as specified by
+                      the Device Interface
+  
+        wdiDelStaSelfRspCb: callback for passing back the response of
+        the add TS operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_DelSTASelfReq
+(
+  WDI_DelSTASelfReqParamsType*      pwdiDelStaSelfReqParams,
+  WDI_DelSTASelfRspCb               wdiDelStaSelfRspCb,
+  void*                             pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_DEL_STA_SELF_REQ;
+  wdiEventData.pEventData      = pwdiDelStaSelfReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelStaSelfReqParams); 
+  wdiEventData.pCBfnc          = wdiDelStaSelfRspCb; 
+  wdiEventData.pUserData       = pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_AggrAddTSReq*/
+
+/**
+ @brief WDI_SetTxPerTrackingReq will be called when the upper MAC 
+        wants to set the Tx Per Tracking configurations. 
+        Upon the call of this API the WLAN DAL will pack
+        and send a HAL Set Tx Per Tracking request message to the
+        lower RIVA sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ @param pwdiSetTxPerTrackingReqParams: the Set Tx PER Tracking configurations as 
+                      specified by the Device Interface
+  
+        pwdiSetTxPerTrackingRspCb: callback for passing back the
+        response of the set Tx PER Tracking configurations operation received
+        from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetTxPerTrackingReq
+(
+  WDI_SetTxPerTrackingReqParamsType*      pwdiSetTxPerTrackingReqParams,
+  WDI_SetTxPerTrackingRspCb               pwdiSetTxPerTrackingRspCb,
+  void*                                   pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_TX_PER_TRACKING_REQ;
+   wdiEventData.pEventData      = pwdiSetTxPerTrackingReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiSetTxPerTrackingReqParams);
+   wdiEventData.pCBfnc          = pwdiSetTxPerTrackingRspCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_SetTxPerTrackingReq*/
+
+/**
+ @brief WDI_SetTmLevelReq
+        If HW Thermal condition changed, driver should react based on new 
+        HW thermal condition.
+
+ @param pwdiSetTmLevelReq: New thermal condition information
+  
+        pwdiSetTmLevelRspCb: callback
+  
+        usrData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetTmLevelReq
+(
+   WDI_SetTmLevelReqType        *pwdiSetTmLevelReq,
+   WDI_SetTmLevelCb              pwdiSetTmLevelRspCb,
+   void                         *usrData  
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_TM_LEVEL_REQ;
+   wdiEventData.pEventData      = pwdiSetTmLevelReq; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiSetTmLevelReq);
+   wdiEventData.pCBfnc          = pwdiSetTmLevelRspCb; 
+   wdiEventData.pUserData       = usrData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief WDI_HostSuspendInd 
+  
+        Suspend Indication from the upper layer will be sent
+        down to HAL
+  
+ @param WDI_SuspendResumeIndParamsType
+ 
+ @see 
+  
+ @return Status of the request
+*/
+WDI_Status 
+WDI_HostSuspendInd
+(
+  WDI_SuspendParamsType*    pwdiSuspendIndParams
+)
+{
+
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest      = WDI_HOST_SUSPEND_IND;
+  wdiEventData.pEventData      = pwdiSuspendIndParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSuspendIndParams); 
+  wdiEventData.pCBfnc          = NULL; 
+  wdiEventData.pUserData       = NULL;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+
+}/*WDI_HostSuspendInd*/
+
+/**
+ @brief WDI_HALDumpCmdReq
+        Post HAL DUMP Command Event
+ 
+ @param  halDumpCmdReqParams:   Hal Dump Command Body 
+ @param  halDumpCmdRspCb: HAL DUMP Response from HAL CB 
+ @param  pUserData:       Client Data
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_HALDumpCmdReq
+(
+  WDI_HALDumpCmdReqParamsType *halDumpCmdReqParams,
+  WDI_HALDumpCmdRspCb    halDumpCmdRspCb,
+  void                  *pUserData
+)
+{
+  WDI_EventInfoType      wdiEventData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Fill in Event data and post to the Main FSM
+  ------------------------------------------------------------------------*/
+  wdiEventData.wdiRequest     =   WDI_HAL_DUMP_CMD_REQ;
+  wdiEventData.pEventData     =   (void *)halDumpCmdReqParams;
+  wdiEventData.uEventDataSize =   sizeof(WDI_HALDumpCmdReqParamsType);
+  wdiEventData.pCBfnc         =   halDumpCmdRspCb;
+  wdiEventData.pUserData      =   pUserData;
+
+  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/*============================================================================ 
+ 
+            DAL Control Path Main FSM Function Implementation
+ 
+ ============================================================================*/
+
+/**
+ @brief Main FSM Start function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         wdiEV:           event posted to the main DAL FSM
+         pEventData:      pointer to the event information
+         structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_PostMainEvent
+(
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_MainEventType      wdiEV, 
+  WDI_EventInfoType*     pEventData
+  
+)
+{
+  WDI_Status         wdiStatus; 
+  WDI_MainFuncType   pfnWDIMainEvHdlr; 
+  WDI_MainStateType  wdiOldState; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+     Sanity check
+   -------------------------------------------------------------------------*/
+  if (( pWDICtx->uGlobalState >= WDI_MAX_ST ) ||
+      ( wdiEV >= WDI_MAX_EVENT ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid state or event in Post Main Ev function ST: %d EV: %d",
+               pWDICtx->uGlobalState, wdiEV);
+     return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*Access to the global state must be locked */
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*Fetch event handler for state*/
+  pfnWDIMainEvHdlr = wdiMainFSM[pWDICtx->uGlobalState].pfnMainTbl[wdiEV]; 
+
+  wdiOldState = pWDICtx->uGlobalState;
+
+  /*
+  --Incase of WDI event is WDI_RESPONSE_EVENT and this is called when a 
+  response comes from CCPU for the request sent by host: 
+  the WDI global state will be in WDI_BUSY_ST already, so do not set it to BUSY again. 
+  This state will be set to WDI_STARTED_ST in WDI_MainRsp, if it is a expected response.
+  --Incase of WDI event is WDI_RESPONSE_EVENT and it is an indication from the 
+  CCPU:
+  don't change the state */
+  if ( WDI_RESPONSE_EVENT != wdiEV)
+  {
+    /*Transition to BUSY State - the request is now being processed by the FSM,
+     if the request fails we shall transition back to the old state, if not
+     the request will manage its own state transition*/
+    WDI_STATE_TRANSITION( pWDICtx, WDI_BUSY_ST);
+  }
+  /* If the state function associated with the EV is NULL it means that this
+     event is not allowed in this state*/
+  if ( NULL != pfnWDIMainEvHdlr ) 
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Posting event %d in state: %d to the Main FSM", 
+              wdiEV, wdiOldState);
+    wdiStatus = pfnWDIMainEvHdlr( pWDICtx, pEventData); 
+  }
+  else
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Unexpected event %d in state: %d", 
+              wdiEV, wdiOldState);
+    wdiStatus = WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /* If a request handles itself well it will end up in a success or in a
+     pending
+     Success - means that the request was processed and the proper state
+     transition already occurred or will occur when the resp is received
+     - NO other state transition or dequeueing is required
+ 
+     Pending - means the request could not be processed at this moment in time
+     because the FSM was already busy so no state transition or dequeueing
+     is necessary anymore
+ 
+     Success for synchronous case means that the transition may occur and
+     processing of pending requests may continue - so it should go through
+     and restores the state and continue processing queued requests*/
+  if (( WDI_STATUS_SUCCESS != wdiStatus )&&
+      ( WDI_STATUS_PENDING != wdiStatus ))
+  {
+    if ( WDI_RESPONSE_EVENT != wdiEV)
+    {
+      /*The request has failed or could not be processed - transition back to
+        the old state - check to see if anything was queued and try to execute
+        The dequeue logic should post a message to a thread and return - no
+        actual processing can occur */
+      WDI_STATE_TRANSITION( pWDICtx, wdiOldState);
+    }
+    WDI_DequeuePendingReq(pWDICtx);
+        
+  }
+
+  /* we have completed processing the event */
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  return wdiStatus; 
+
+}/*WDI_PostMainEvent*/
+
+
+/*--------------------------------------------------------------------------
+  INIT State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStart
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Start %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*--------------------------------------------------------------------
+     Check if the Control Transport has been opened 
+  ----------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == pWDICtx->bCTOpened )
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Control Transport not yet Open - queueing the request");
+
+     WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
+     WDI_QueuePendingReq( pWDICtx, pEventData); 
+
+     wpalMutexRelease(&pWDICtx->wptMutex);
+     return WDI_STATUS_PENDING;
+  }
+ 
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainStart*/
+
+/**
+ @brief Main FSM Response function for state INIT
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainRspInit
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*------------------------------------------------------------------------
+    Not expecting a response from the device before it is started 
+  ------------------------------------------------------------------------*/
+  WDI_ASSERT(0); 
+
+  /*Return Success*/
+  return WDI_STATUS_E_NOT_ALLOWED;
+}/* WDI_MainRspInit */
+
+/**
+ @brief Main FSM Close function for all states except BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainClose
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Close %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainClose*/
+/*--------------------------------------------------------------------------
+  STARTED State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for state STARTED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStartStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StartRspCb           wdiStartRspCb = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Start %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*--------------------------------------------------------------------
+     Nothing to do transport was already started 
+  ----------------------------------------------------------------------*/
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+    "Received start while transport was already started - nothing to do"); 
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*Transition back to started because the post function transitioned us to
+    busy*/
+  WDI_STATE_TRANSITION( pWDICtx, WDI_STARTED_ST);
+
+  /*Check to see if any request is pending*/
+  WDI_DequeuePendingReq(pWDICtx);
+  
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Tell UMAC Success*/
+  wdiStartRspCb = (WDI_StartRspCb)pEventData->pCBfnc; 
+  
+   /*Notify UMAC*/
+  wdiStartRspCb( &pWDICtx->wdiCachedStartRspParams, pWDICtx->pRspCBUserData);
+
+  /*Return Success*/
+  return WDI_STATUS_SUCCESS;
+
+}/*WDI_MainStartStarted*/
+
+/**
+ @brief Main FSM Stop function for state STARTED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid parameters on Main Start %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*State at this point is BUSY - because we enter this state before posting
+    an event to the FSM in order to prevent potential race conditions*/
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "Processing stop request in FSM");
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainStopStarted*/
+/**
+ @brief Main FSM Request function for state started
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainReqStarted
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Req Started %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*State at this point is BUSY - because we enter this state before posting
+    an event to the FSM in order to prevent potential race conditions*/
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainReqStarted*/
+
+/**
+ @brief Main FSM Response function for all states except INIT
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status  wdiStatus; 
+  wpt_boolean expectedResponse;
+
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Response %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  if ( pEventData->wdiResponse ==  pWDICtx->wdiExpectedResponse )
+  {
+    /* we received an expected response */
+    expectedResponse = eWLAN_PAL_TRUE;
+
+    /*We expect that we will transition to started after this processing*/
+    pWDICtx->ucExpectedStateTransition = WDI_STARTED_ST;
+
+    /* we are no longer expecting a response */
+     pWDICtx->wdiExpectedResponse = WDI_MAX_RESP;
+  }
+  else
+  {
+    /* we received an indication or unexpected response */
+    expectedResponse = eWLAN_PAL_FALSE;
+    /* for indications no need to update state from what it is right
+       now, unless it explicitly does it in the indication handler (say
+       for device failure ind) */
+    pWDICtx->ucExpectedStateTransition = pWDICtx->uGlobalState;
+  }
+
+  /*Process the response and indication */
+  wdiStatus = WDI_ProcessResponse( pWDICtx, pEventData );
+
+  /*Lock the CB as we are about to do a state transition*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*Transition to the expected state after the response processing
+  - this should always be started state with the following exceptions:
+  1. processing of a failed start response
+  2. device failure detected while processing response
+  3. stop response received*/
+  WDI_STATE_TRANSITION( pWDICtx, pWDICtx->ucExpectedStateTransition);
+ 
+  /*Dequeue request that may have been queued while we were waiting for the
+    response */
+  if ( expectedResponse )
+  {
+     WDI_DequeuePendingReq(pWDICtx); 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Return Success - always */
+  return WDI_STATUS_SUCCESS; 
+
+}/*WDI_MainRsp*/
+
+/*--------------------------------------------------------------------------
+  STOPPED State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Stop function for state STOPPED
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopStopped
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid parameters on Main Stop Stopped %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*We should normally not get a STOP request if we are already stopped
+    since we should normally be stopped by the UMAC.  However in some
+    error situations we put ourselves in the stopped state without the
+    UMAC knowing, so when we get a STOP request in this state we still
+    process it since we need to clean up the underlying state */
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "Processing stop request while stopped in FSM");
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainStopStopped*/
+
+/*--------------------------------------------------------------------------
+  BUSY State Functions 
+--------------------------------------------------------------------------*/
+/**
+ @brief Main FSM Start function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStartBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Start in BUSY %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*--------------------------------------------------------------------
+     Check if the Control Transport has been opened 
+  ----------------------------------------------------------------------*/
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+           "WDI Busy state - queue start request");
+
+  /*Queue the start request*/
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
+
+  /*Return Success*/
+  return WDI_STATUS_PENDING;
+}/*WDI_MainStartBusy*/
+
+/**
+ @brief Main FSM Stop function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainStopBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Stop in BUSY %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*--------------------------------------------------------------------
+     Check if the Control Transport has been opened 
+  ----------------------------------------------------------------------*/
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+           "WDI Busy state - queue stop request");
+
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
+  return WDI_STATUS_PENDING;
+  
+}/*WDI_MainStopBusy*/
+
+/**
+ @brief Main FSM Request function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainReqBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Request in BUSY %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*--------------------------------------------------------------------
+     Check if the Control Transport has been opened 
+  ----------------------------------------------------------------------*/
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+           "WDI Busy state - queue request %d because waiting for response %d",
+             pEventData->wdiRequest, pWDICtx->wdiExpectedResponse);
+
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
+  return WDI_STATUS_PENDING;
+  
+}/*WDI_MainReqBusy*/
+/**
+ @brief Main FSM Close function for state BUSY
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainCloseBusy
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check 
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Invalid parameters on Main Close in BUSY %x %x", 
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*--------------------------------------------------------------------
+     Check if the Control Transport has been opened 
+  ----------------------------------------------------------------------*/
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+           "WDI Busy state - queue close request");
+
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
+  return WDI_STATUS_PENDING;
+  
+}/*WDI_MainCloseBusy*/
+
+/**
+ @brief Main FSM Shutdown function for INIT & STARTED states
+
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainShutdown
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid parameters on Main Start %x %x",
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*State at this point is BUSY - because we enter this state before posting
+    an event to the FSM in order to prevent potential race conditions*/
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+            "Processing shutdown request in FSM");
+
+  /*Return Success*/
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainShutdown*/
+
+/**
+ @brief Main FSM Shutdown function for BUSY state
+
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_MainShutdownBusy
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*--------------------------------------------------------------------
+     Sanity Check
+  ----------------------------------------------------------------------*/
+  if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid parameters on Main Start %x %x",
+               pWDICtx, pEventData);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /* If you are waiting for a HAL response at this stage, you are not
+   * going to get it. Riva is already shutdown/crashed.
+   */
+  wpalTimerStop(&gWDICb.wptResponseTimer);
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+            "Processing shutdown request in FSM: Busy state ");
+
+  return WDI_ProcessRequest( pWDICtx, pEventData );
+
+}/*WDI_MainShutdownBusy*/
+
+
+/*======================================================================= 
+ 
+           WLAN DAL Control Path Main Processing Functions
+ 
+*=======================================================================*/
+
+/*========================================================================
+          Main DAL Control Path Request Processing API 
+========================================================================*/
+/**
+ @brief Process Start Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StartReqParamsType* pwdiStartParams    = NULL;
+  WDI_StartRspCb          wdiStartRspCb      = NULL;
+  wpt_uint8*              pSendBuffer        = NULL; 
+  wpt_uint16              usDataOffset       = 0;
+  wpt_uint16              usSendSize         = 0;
+
+  tHalMacStartReqMsg      halStartReq; 
+  wpt_uint16              usLen              = 0; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiStartParams = (WDI_StartReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiStartRspCb   = (WDI_StartRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  usLen = sizeof(halStartReq.startReqParams) + 
+          pwdiStartParams->usConfigBufferLen;
+
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_REQ, 
+                        usLen,
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + usLen )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "Unable to get send buffer in start req %x %x %x",
+                pEventData, pwdiStartParams, wdiStartRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Fill in the message
+  -----------------------------------------------------------------------*/
+  halStartReq.startReqParams.driverType = 
+     WDI_2_HAL_DRV_TYPE(pwdiStartParams->wdiDriverType); 
+
+  halStartReq.startReqParams.uConfigBufferLen = 
+                  pwdiStartParams->usConfigBufferLen; 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStartReq.startReqParams, 
+                  sizeof(halStartReq.startReqParams)); 
+
+  usDataOffset  += sizeof(halStartReq.startReqParams); 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  pwdiStartParams->pConfigBuffer, 
+                  pwdiStartParams->usConfigBufferLen); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiStartParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiStartParams->pUserData; 
+
+  /*Save Low Level Ind CB and associated user data - it will be used further
+    on when an indication is coming from the lower MAC*/
+  pWDICtx->wdiLowLevelIndCB   = pwdiStartParams->wdiLowLevelIndCB;
+  pWDICtx->pIndUserData       = pwdiStartParams->pIndUserData; 
+
+  pWDICtx->bFrameTransEnabled = pwdiStartParams->bFrameTransEnabled; 
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiStartRspCb, pEventData->pUserData, WDI_START_RESP);
+
+  
+}/*WDI_ProcessStartReq*/
+
+/**
+ @brief Process Stop Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStopReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StopReqParamsType* pwdiStopParams      = NULL;
+  WDI_StopRspCb          wdiStopRspCb        = NULL;
+  wpt_uint8*             pSendBuffer         = NULL; 
+  wpt_uint16             usDataOffset        = 0;
+  wpt_uint16             usSendSize          = 0;
+
+  tHalMacStopReqMsg      halStopReq; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiStopParams = (WDI_StopReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiStopRspCb   = (WDI_StopRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_STOP_REQ, 
+                        sizeof(halStopReq.stopReqParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halStopReq.stopReqParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in stop req %x %x %x",
+                pEventData, pwdiStopParams, wdiStopRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Fill in the message
+  -----------------------------------------------------------------------*/
+  halStopReq.stopReqParams.reason = WDI_2_HAL_STOP_REASON(
+                                          pwdiStopParams->wdiStopReason);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStopReq.stopReqParams, 
+                  sizeof(halStopReq.stopReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiStopParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiStopParams->pUserData; 
+
+  /*! TO DO: stop the data services */
+  if ( eDRIVER_TYPE_MFG != pWDICtx->driverMode )
+  {
+     /*Stop the STA Table !UT- check this logic again
+      It is safer to do it here than on the response - because a stop is imminent*/
+     WDI_STATableStop(pWDICtx);
+
+     /* Reset the event to be not signalled */
+     if(WDI_STATUS_SUCCESS != wpalEventReset(&pWDICtx->setPowerStateEvent) )
+     {
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "WDI Init failed to reset power state event");
+
+        WDI_ASSERT(0); 
+        return VOS_STATUS_E_FAILURE;
+     }
+     /* Stop Transport Driver, DXE */
+     WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_DOWN, WDI_SetPowerStateCb);
+     /*
+      * Wait for the event to be set once the ACK comes back from DXE 
+      */
+     if(WDI_STATUS_SUCCESS != wpalEventWait(&pWDICtx->setPowerStateEvent, 
+                                            WDI_SET_POWER_STATE_TIMEOUT))
+     {
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "WDI Init failed to wait on an event");
+
+        WDI_ASSERT(0); 
+        return VOS_STATUS_E_FAILURE;
+      }
+  }
+
+  /*-------------------------------------------------------------------------
+    Send Stop Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiStopRspCb, pEventData->pUserData, WDI_STOP_RESP);
+
+}/*WDI_ProcessStopReq*/
+
+/**
+ @brief Process Close Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCloseReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   wpt_status              wptStatus; 
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*Lock control block for cleanup*/
+   wpalMutexAcquire(&pWDICtx->wptMutex);
+       
+   /*Clear all pending request*/
+   WDI_ClearPendingRequests(pWDICtx);
+
+   /* Close Control transport*/
+   WCTS_CloseTransport(pWDICtx->wctsHandle); 
+
+   /* Close Data transport*/
+   /* FTM mode does not open Data Path */
+   if ( eDRIVER_TYPE_MFG != pWDICtx->driverMode )
+   {
+      WDTS_Close(pWDICtx);
+   }
+
+   /*Close the STA Table !UT- check this logic again*/
+   WDI_STATableClose(pWDICtx);
+
+   /*close the PAL */
+   wptStatus = wpalClose(pWDICtx->pPALContext);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Failed to wpal Close %d", wptStatus);
+     WDI_ASSERT(0);
+   }
+
+   /*Transition back to init state*/
+   WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
+
+   wpalMutexRelease(&pWDICtx->wptMutex);
+
+   /*Make sure the expected state is properly defaulted to Init*/
+   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST; 
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessCloseReq*/
+
+
+/*===========================================================================
+                  SCANING REQUEST PROCESSING API 
+===========================================================================*/
+
+/**
+ @brief Process Init Scan Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessInitScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_InitScanReqParamsType*  pwdiInitScanParams    = NULL;
+  WDI_InitScanRspCb           wdiInitScanRspCb      = NULL;
+  wpt_uint8*                  pSendBuffer           = NULL; 
+  wpt_uint16                  usDataOffset          = 0;
+  wpt_uint16                  usSendSize            = 0;
+  wpt_uint8                   i = 0;
+
+  tHalInitScanReqMsg          halInitScanReqMsg;
+
+  /*This is temporary fix. 
+   * It shold be removed once host and riva changes are in sync*/
+  tHalInitScanConReqMsg       halInitScanConReqMsg;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+    -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiInitScanParams = (WDI_InitScanReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiInitScanRspCb   = (WDI_InitScanRspCb)pEventData->pCBfnc)))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+        "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+#if 0
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Check to see if SCAN is already in progress - if so reject the req
+    We only allow one scan at a time
+    ! TO DO: - revisit this constraint 
+    -----------------------------------------------------------------------*/
+  if ( pWDICtx->bScanInProgress )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+        "Scan is already in progress - subsequent scan is not allowed"
+        " until the first scan completes");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  pWDICtx->bScanInProgress = eWLAN_PAL_TRUE; 
+  pWDICtx->uScanState      = WDI_SCAN_INITIALIZED_ST; 
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+#endif
+
+  if (pwdiInitScanParams->wdiReqInfo.bUseNOA)
+  {
+    /*This is temporary fix. 
+     * It shold be removed once host and riva changes are in sync*/
+    /*-----------------------------------------------------------------------
+      Get message buffer
+      -----------------------------------------------------------------------*/
+    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_CON_REQ, 
+            sizeof(halInitScanConReqMsg.initScanParams),
+            &pSendBuffer, &usDataOffset, &usSendSize))||
+        ( usSendSize < (usDataOffset + sizeof(halInitScanConReqMsg.initScanParams) )))
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+          "Unable to get send buffer in init scan req %x %x %x",
+          pEventData, pwdiInitScanParams, wdiInitScanRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+    }
+
+
+    /*-----------------------------------------------------------------------
+      Fill in the message
+      -----------------------------------------------------------------------*/
+    halInitScanConReqMsg.initScanParams.scanMode = 
+      WDI_2_HAL_SCAN_MODE(pwdiInitScanParams->wdiReqInfo.wdiScanMode);
+
+    wpalMemoryCopy(halInitScanConReqMsg.initScanParams.bssid,
+        pwdiInitScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
+
+    halInitScanConReqMsg.initScanParams.notifyBss = 
+      pwdiInitScanParams->wdiReqInfo.bNotifyBSS;
+    halInitScanConReqMsg.initScanParams.frameType = 
+      pwdiInitScanParams->wdiReqInfo.ucFrameType;
+    halInitScanConReqMsg.initScanParams.frameLength = 
+      pwdiInitScanParams->wdiReqInfo.ucFrameLength;
+
+    WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halInitScanConReqMsg.initScanParams.macMgmtHdr,
+        &pwdiInitScanParams->wdiReqInfo.wdiMACMgmtHdr);
+
+#ifdef WLAN_FEATURE_P2P
+    halInitScanConReqMsg.initScanParams.useNoA = pwdiInitScanParams->wdiReqInfo.bUseNOA;
+    halInitScanConReqMsg.initScanParams.scanDuration = pwdiInitScanParams->wdiReqInfo.scanDuration;
+#endif
+
+    halInitScanConReqMsg.initScanParams.scanEntry.activeBSScnt = 
+      pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt;
+
+    for (i=0; i < pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
+    {
+      halInitScanConReqMsg.initScanParams.scanEntry.bssIdx[i] = 
+        pwdiInitScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i];
+    }
+
+    wpalMemoryCopy( pSendBuffer+usDataOffset, 
+        &halInitScanConReqMsg.initScanParams, 
+        sizeof(halInitScanConReqMsg.initScanParams)); 
+  }
+  else
+  {
+    /*-----------------------------------------------------------------------
+      Get message buffer
+      -----------------------------------------------------------------------*/
+    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_REQ, 
+            sizeof(halInitScanReqMsg.initScanParams),
+            &pSendBuffer, &usDataOffset, &usSendSize))||
+        ( usSendSize < (usDataOffset + sizeof(halInitScanReqMsg.initScanParams) )))
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+          "Unable to get send buffer in init scan req %x %x %x",
+          pEventData, pwdiInitScanParams, wdiInitScanRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+    }
+
+
+    /*-----------------------------------------------------------------------
+      Fill in the message
+      -----------------------------------------------------------------------*/
+    halInitScanReqMsg.initScanParams.scanMode = 
+      WDI_2_HAL_SCAN_MODE(pwdiInitScanParams->wdiReqInfo.wdiScanMode);
+
+    wpalMemoryCopy(halInitScanReqMsg.initScanParams.bssid,
+        pwdiInitScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
+
+    halInitScanReqMsg.initScanParams.notifyBss = 
+      pwdiInitScanParams->wdiReqInfo.bNotifyBSS;
+    halInitScanReqMsg.initScanParams.frameType = 
+      pwdiInitScanParams->wdiReqInfo.ucFrameType;
+    halInitScanReqMsg.initScanParams.frameLength = 
+      pwdiInitScanParams->wdiReqInfo.ucFrameLength;
+
+    WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halInitScanReqMsg.initScanParams.macMgmtHdr,
+        &pwdiInitScanParams->wdiReqInfo.wdiMACMgmtHdr);
+
+    halInitScanReqMsg.initScanParams.scanEntry.activeBSScnt = 
+      pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt;
+
+    for (i=0; i < pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
+    {
+      halInitScanReqMsg.initScanParams.scanEntry.bssIdx[i] = 
+        pwdiInitScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i];
+    }
+
+    wpalMemoryCopy( pSendBuffer+usDataOffset, 
+        &halInitScanReqMsg.initScanParams, 
+        sizeof(halInitScanReqMsg.initScanParams)); 
+  }
+
+  pWDICtx->wdiReqStatusCB     = pwdiInitScanParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiInitScanParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Init Scan Request to HAL 
+    -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+      wdiInitScanRspCb, pEventData->pUserData, WDI_INIT_SCAN_RESP);
+
+}/*WDI_ProcessInitScanReq*/
+
+/**
+ @brief Process Start Scan Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StartScanReqParamsType*  pwdiStartScanParams    = NULL;
+  WDI_StartScanRspCb           wdiStartScanRspCb      = NULL;
+  wpt_uint8*                   pSendBuffer            = NULL; 
+  wpt_uint16                   usDataOffset           = 0;
+  wpt_uint16                   usSendSize             = 0;
+
+  tHalStartScanReqMsg          halStartScanReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiStartScanParams = (WDI_StartScanReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiStartScanRspCb   = (WDI_StartScanRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+#if 0
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Check to see if SCAN is already in progress - start scan is only
+    allowed when a scan is ongoing and the state of the scan procedure
+    is either init or end 
+  -----------------------------------------------------------------------*/
+  if (( !pWDICtx->bScanInProgress ) || 
+      (( WDI_SCAN_INITIALIZED_ST != pWDICtx->uScanState ) &&
+       ( WDI_SCAN_ENDED_ST != pWDICtx->uScanState )))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Scan start not allowed in this state %d %d",
+               pWDICtx->bScanInProgress, pWDICtx->uScanState);
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  pWDICtx->uScanState      = WDI_SCAN_STARTED_ST; 
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+#endif
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_SCAN_REQ, 
+                        sizeof(halStartScanReqMsg.startScanParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halStartScanReqMsg.startScanParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start scan req %x %x %x",
+                pEventData, pwdiStartScanParams, wdiStartScanRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halStartScanReqMsg.startScanParams.scanChannel = 
+                              pwdiStartScanParams->ucChannel;
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStartScanReqMsg.startScanParams, 
+                  sizeof(halStartScanReqMsg.startScanParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiStartScanParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiStartScanParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Scan Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiStartScanRspCb, pEventData->pUserData, WDI_START_SCAN_RESP);
+}/*WDI_ProcessStartScanReq*/
+
+
+/**
+ @brief Process End Scan Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEndScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_EndScanReqParamsType*  pwdiEndScanParams    = NULL;
+  WDI_EndScanRspCb           wdiEndScanRspCb      = NULL;
+  wpt_uint8*                 pSendBuffer          = NULL; 
+  wpt_uint16                 usDataOffset         = 0;
+  wpt_uint16                 usSendSize           = 0;
+
+  tHalEndScanReqMsg          halEndScanReqMsg;           
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiEndScanParams = (WDI_EndScanReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiEndScanRspCb   = (WDI_EndScanRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN 
+  * sometimes  because of this check the scan request is not being 
+  * forwarded to HAL and result in hang*/
+#if 0
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Check to see if SCAN is already in progress - end scan is only
+    allowed when a scan is ongoing and the state of the scan procedure
+    is started
+  -----------------------------------------------------------------------*/
+  if (( !pWDICtx->bScanInProgress ) || 
+      ( WDI_SCAN_STARTED_ST != pWDICtx->uScanState ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "End start not allowed in this state %d %d",
+               pWDICtx->bScanInProgress, pWDICtx->uScanState);
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  pWDICtx->uScanState      = WDI_SCAN_ENDED_ST; 
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+#endif
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_END_SCAN_REQ, 
+                        sizeof(halEndScanReqMsg.endScanParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halEndScanReqMsg.endScanParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start scan req %x %x %x",
+                pEventData, pwdiEndScanParams, wdiEndScanRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halEndScanReqMsg.endScanParams.scanChannel = pwdiEndScanParams->ucChannel;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halEndScanReqMsg.endScanParams, 
+                  sizeof(halEndScanReqMsg.endScanParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiEndScanParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiEndScanParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send End Scan Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiEndScanRspCb, pEventData->pUserData, WDI_END_SCAN_RESP);
+}/*WDI_ProcessEndScanReq*/
+
+
+/**
+ @brief Process Finish Scan Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFinishScanReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_FinishScanReqParamsType*  pwdiFinishScanParams;
+  WDI_FinishScanRspCb           wdiFinishScanRspCb;
+  wpt_uint8*                    pSendBuffer          = NULL; 
+  wpt_uint16                    usDataOffset         = 0;
+  wpt_uint16                    usSendSize           = 0;
+  wpt_uint8                     i                    = 0;
+
+  tHalFinishScanReqMsg          halFinishScanReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiFinishScanParams = (WDI_FinishScanReqParamsType*)pEventData->pEventData;
+  wdiFinishScanRspCb   = (WDI_FinishScanRspCb)pEventData->pCBfnc;
+  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN 
+  * sometimes  because of this check the scan request is not being 
+  * forwarded to HAL and result in hang*/
+#if 0
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+   /*-----------------------------------------------------------------------
+    Check to see if SCAN is already in progress
+    Finish scan gets invoked any scan states. ie. abort scan
+    It should be allowed in any states.
+  -----------------------------------------------------------------------*/
+  if ( !pWDICtx->bScanInProgress )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Finish start not allowed in this state %d",
+               pWDICtx->bScanInProgress );
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*-----------------------------------------------------------------------
+    It is safe to reset the scan flags here because until the response comes
+    back all subsequent requests will be blocked at BUSY state 
+  -----------------------------------------------------------------------*/
+  pWDICtx->uScanState      = WDI_SCAN_FINISHED_ST; 
+  pWDICtx->bScanInProgress = eWLAN_PAL_FALSE; 
+  wpalMutexRelease(&pWDICtx->wptMutex);
+#endif
+
+  if ( pWDICtx->bInBmps )
+  {
+     // notify DTS that we are entering BMPS
+     WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_BMPS, NULL);
+  }
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FINISH_SCAN_REQ, 
+                        sizeof(halFinishScanReqMsg.finishScanParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halFinishScanReqMsg.finishScanParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start scan req %x %x %x",
+                pEventData, pwdiFinishScanParams, wdiFinishScanRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halFinishScanReqMsg.finishScanParams.scanMode = 
+    WDI_2_HAL_SCAN_MODE(pwdiFinishScanParams->wdiReqInfo.wdiScanMode);
+
+  halFinishScanReqMsg.finishScanParams.currentOperChannel = 
+    pwdiFinishScanParams->wdiReqInfo.ucCurrentOperatingChannel;
+
+  halFinishScanReqMsg.finishScanParams.cbState = 
+    WDI_2_HAL_CB_STATE(pwdiFinishScanParams->wdiReqInfo.wdiCBState);
+
+  wpalMemoryCopy(halFinishScanReqMsg.finishScanParams.bssid,
+                 pwdiFinishScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
+
+  halFinishScanReqMsg.finishScanParams.notifyBss   = 
+                              pwdiFinishScanParams->wdiReqInfo.bNotifyBSS ;
+  halFinishScanReqMsg.finishScanParams.frameType   = 
+                              pwdiFinishScanParams->wdiReqInfo.ucFrameType ;
+  halFinishScanReqMsg.finishScanParams.frameLength = 
+                              pwdiFinishScanParams->wdiReqInfo.ucFrameLength ;
+
+  halFinishScanReqMsg.finishScanParams.scanEntry.activeBSScnt = 
+                   pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt ;
+
+  for (i = 0; i < pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
+  {
+    halFinishScanReqMsg.finishScanParams.scanEntry.bssIdx[i] = 
+               pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i] ;
+  }
+
+  WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halFinishScanReqMsg.finishScanParams.macMgmtHdr,
+                              &pwdiFinishScanParams->wdiReqInfo.wdiMACMgmtHdr);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halFinishScanReqMsg.finishScanParams, 
+                  sizeof(halFinishScanReqMsg.finishScanParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiFinishScanParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiFinishScanParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Finish Scan Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiFinishScanRspCb, pEventData->pUserData, WDI_FINISH_SCAN_RESP);
+}/*WDI_ProcessFinishScanReq*/
+
+
+/*==========================================================================
+                    ASSOCIATION REQUEST API 
+==========================================================================*/
+/**
+ @brief Process BSS Join for a given Session 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBSSSessionJoinReq
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_JoinReqParamsType*  pwdiJoinParams,
+  WDI_JoinRspCb           wdiJoinRspCb,
+  void*                   pUserData
+)
+{
+  WDI_BSSSessionType*     pBSSSes             = NULL;
+  wpt_uint8*              pSendBuffer         = NULL; 
+  wpt_uint16              usDataOffset        = 0;
+  wpt_uint16              usSendSize          = 0;
+  wpt_uint8               ucCurrentBSSSesIdx  = 0; 
+
+  tHalJoinReqMsg          halJoinReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*------------------------------------------------------------------------
+    Check to see if we have any session with this BSSID already stored, we
+    should not
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                   pwdiJoinParams->wdiReqInfo.macBSSID, 
+                                  &pBSSSes);  
+
+  if ( NULL != pBSSSes )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association for this BSSID is already in place");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+  /*------------------------------------------------------------------------
+    Fetch an empty session block 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
+  if ( NULL == pBSSSes )
+  {
+
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "DAL has no free sessions - cannot run another join");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_RES_FAILURE; 
+  }
+
+  /*Save BSS Session Info*/
+  pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+  wpalMemoryCopy( pBSSSes->macBSSID, pwdiJoinParams->wdiReqInfo.macBSSID, 
+                  WDI_MAC_ADDR_LEN);
+
+  /*Transition to state Joining*/
+  pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
+  pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
+  
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_JOIN_REQ, 
+                        sizeof(halJoinReqMsg.joinReqParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halJoinReqMsg.joinReqParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in join req %x %x %x",
+                pUserData, pwdiJoinParams, wdiJoinRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halJoinReqMsg.joinReqParams.bssId,
+                 pwdiJoinParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN); 
+
+  wpalMemoryCopy(halJoinReqMsg.joinReqParams.selfStaMacAddr,
+                 pwdiJoinParams->wdiReqInfo.macSTASelf, 
+                 WDI_MAC_ADDR_LEN); 
+
+  halJoinReqMsg.joinReqParams.ucChannel = 
+    pwdiJoinParams->wdiReqInfo.wdiChannelInfo.ucChannel;
+
+  halJoinReqMsg.joinReqParams.linkState = pwdiJoinParams->wdiReqInfo.linkState;
+
+#ifndef WLAN_FEATURE_VOWIFI
+  halJoinReqMsg.joinReqParams.ucLocalPowerConstraint = 
+    pwdiJoinParams->wdiReqInfo.wdiChannelInfo.ucLocalPowerConstraint;
+#endif
+
+  halJoinReqMsg.joinReqParams.secondaryChannelOffset =     
+     WDI_2_HAL_SEC_CH_OFFSET(pwdiJoinParams->wdiReqInfo.wdiChannelInfo.
+                             wdiSecondaryChannelOffset);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halJoinReqMsg.joinReqParams, 
+                  sizeof(halJoinReqMsg.joinReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiJoinParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiJoinParams->pUserData;  
+
+  /*-------------------------------------------------------------------------
+    Send Join Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiJoinRspCb, pUserData, WDI_JOIN_RESP); 
+
+}/*WDI_ProcessBSSSessionJoinReq*/
+
+/**
+ @brief Process Join Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessJoinReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status              wdiStatus          = WDI_STATUS_SUCCESS;
+  WDI_JoinReqParamsType*  pwdiJoinParams     = NULL;
+  WDI_JoinRspCb           wdiJoinRspCb       = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiJoinParams = (WDI_JoinReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiJoinRspCb   = (WDI_JoinRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  if ( eWLAN_PAL_FALSE != pWDICtx->bAssociationInProgress )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Association is currently in progress, queueing new join req");
+
+    /*Association is in progress - queue current one*/
+    wdiStatus = WDI_QueueNewAssocRequest(pWDICtx, pEventData, 
+                             pwdiJoinParams->wdiReqInfo.macBSSID);
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    return wdiStatus; 
+  }
+
+  /*Starting a new association */
+  pWDICtx->bAssociationInProgress = eWLAN_PAL_TRUE;
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Process the Join Request*/
+  return WDI_ProcessBSSSessionJoinReq( pWDICtx, pwdiJoinParams,
+                                       wdiJoinRspCb,pEventData->pUserData);
+
+}/*WDI_ProcessJoinReq*/
+
+
+/**
+ @brief Process Config BSS Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigBSSReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ConfigBSSReqParamsType*  pwdiConfigBSSParams;
+  WDI_ConfigBSSRspCb           wdiConfigBSSRspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint16                   uMsgSize            = 0; 
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+
+  tConfigBssReqMsg             halConfigBssReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiConfigBSSParams = (WDI_ConfigBSSReqParamsType*)pEventData->pEventData;
+  wdiConfigBSSRspCb   = (WDI_ConfigBSSRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                 pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
+                                 &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+#ifdef WLAN_FEATURE_VOWIFI_11R
+      /*------------------------------------------------------------------------
+        Fetch an empty session block 
+      ------------------------------------------------------------------------*/
+      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
+      if ( NULL == pBSSSes )
+      {
+    
+        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "DAL has no free sessions - cannot run another join");
+    
+        wpalMutexRelease(&pWDICtx->wptMutex);
+        return WDI_STATUS_RES_FAILURE; 
+      }
+    
+      /*Save BSS Session Info*/
+      pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
+                      WDI_MAC_ADDR_LEN);
+    
+      /*Transition to state Joining*/
+      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
+      pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
+#else
+    /* If the BSS type is IBSS create the session here as there is no Join 
+     * Request in case of IBSS*/
+    if((pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_IBSS_MODE) ||
+       (pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_INFRA_AP_MODE) ||
+       (pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_BTAMP_AP_MODE) ||
+       (pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_BTAMP_STA_MODE))
+    {
+      /*------------------------------------------------------------------------
+        Fetch an empty session block 
+      ------------------------------------------------------------------------*/
+      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
+      if ( NULL == pBSSSes )
+      {
+    
+        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "DAL has no free sessions - cannot run another join");
+    
+        wpalMutexRelease(&pWDICtx->wptMutex);
+        return WDI_STATUS_RES_FAILURE; 
+      }
+    
+      /*Save BSS Session Info*/
+      pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
+                      WDI_MAC_ADDR_LEN);
+    
+      /*Transition to state Joining*/
+      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
+      pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
+    }
+    else
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Association sequence for this BSS does not yet exist");
+      /* for IBSS testing */
+      wpalMutexRelease(&pWDICtx->wptMutex);
+      return WDI_STATUS_E_NOT_ALLOWED; 
+    }
+#endif
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    return wdiStatus; 
+  }
+
+  /* Cache the request for response processing */
+  wpalMemoryCopy(&pWDICtx->wdiCachedConfigBssReq, 
+                 pwdiConfigBSSParams, 
+                 sizeof(pWDICtx->wdiCachedConfigBssReq));
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  uMsgSize = sizeof(halConfigBssReqMsg.configBssParams); 
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_BSS_REQ, 
+                    uMsgSize, &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + uMsgSize )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in config bss req %x %x %x",
+                pEventData, pwdiConfigBSSParams, wdiConfigBSSRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*Copy the BSS request */
+  WDI_CopyWDIConfigBSSToHALConfigBSS( &halConfigBssReqMsg.configBssParams,
+                                      &pwdiConfigBSSParams->wdiReqInfo);
+
+  /* Need to fill in the STA Index to invalid, since at this point we have not
+     yet received it from HAL */
+  halConfigBssReqMsg.configBssParams.staContext.staIdx = WDI_STA_INVALID_IDX;
+
+  /* Need to fill in the BSS index */
+  halConfigBssReqMsg.configBssParams.staContext.bssIdx = pBSSSes->ucBSSIdx;
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halConfigBssReqMsg.configBssParams, 
+                  sizeof(halConfigBssReqMsg.configBssParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiConfigBSSParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiConfigBSSParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Config BSS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigBSSRspCb, pEventData->pUserData, 
+                       WDI_CONFIG_BSS_RESP);
+
+}/*WDI_ProcessConfigBSSReq*/
+
+
+/**
+ @brief Process Del BSS Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBSSReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelBSSReqParamsType*  pwdiDelBSSParams    = NULL;
+  WDI_DelBSSRspCb           wdiDelBSSRspCb      = NULL;
+  wpt_uint8                 ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*       pBSSSes             = NULL;
+  wpt_uint8*                pSendBuffer         = NULL; 
+  wpt_uint16                usDataOffset        = 0;
+  wpt_uint16                usSendSize          = 0;
+  WDI_Status                wdiStatus           = WDI_STATUS_SUCCESS; 
+
+  tDeleteBssReqMsg          halBssReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiDelBSSParams = (WDI_DelBSSReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiDelBSSRspCb   = (WDI_DelBSSRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                                             pwdiDelBSSParams->ucBssIdx, 
+                                            &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    return wdiStatus; 
+  }
+
+  /*-----------------------------------------------------------------------
+    If we receive a Del BSS request for an association that is already in
+    progress, it indicates that the assoc has failed => we no longer have
+    an association in progress => we must check for pending associations
+    that were queued and start as soon as the Del BSS response is received 
+  -----------------------------------------------------------------------*/
+  if ( ucCurrentBSSSesIdx == pWDICtx->ucCurrentBSSSesIdx )
+  {
+    /*We can switch to false here because even if a subsequent Join comes in
+      it will only be processed when DAL transitions out of BUSY state which
+      happens when the Del BSS request comes */
+     pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+
+     /*Former association is complete - prepare next pending assoc for
+       processing */
+     WDI_DequeueAssocRequest(pWDICtx);
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BSS_REQ, 
+                        sizeof(halBssReqMsg.deleteBssParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halBssReqMsg.deleteBssParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start req %x %x %x",
+                pEventData, pwdiDelBSSParams, wdiDelBSSRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*Fill in the message request structure*/
+
+  /*BSS Index is saved on config BSS response and Post Assoc Response */
+  halBssReqMsg.deleteBssParams.bssIdx = pBSSSes->ucBSSIdx; 
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halBssReqMsg.deleteBssParams, 
+                  sizeof(halBssReqMsg.deleteBssParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiDelBSSParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiDelBSSParams->pUserData; 
+
+ 
+  /*-------------------------------------------------------------------------
+    Send Del BSS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelBSSRspCb, pEventData->pUserData, WDI_DEL_BSS_RESP);
+
+  
+}/*WDI_ProcessDelBSSReq*/
+
+/**
+ @brief Process Post Assoc Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPostAssocReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_PostAssocReqParamsType* pwdiPostAssocParams   = NULL;
+  WDI_PostAssocRspCb          wdiPostAssocRspCb     = NULL;
+  wpt_uint8                   ucCurrentBSSSesIdx    = 0; 
+  WDI_BSSSessionType*         pBSSSes               = NULL;
+  wpt_uint8*                  pSendBuffer           = NULL; 
+  wpt_uint16                  usDataOffset          = 0;
+  wpt_uint16                  usSendSize            = 0;
+  wpt_uint16                  uMsgSize              = 0;
+  wpt_uint16                  uOffset               = 0;
+  WDI_Status                  wdiStatus             = WDI_STATUS_SUCCESS; 
+
+  tPostAssocReqMsg            halPostAssocReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiPostAssocParams = (WDI_PostAssocReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiPostAssocRspCb   = (WDI_PostAssocRspCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                              pwdiPostAssocParams->wdiBSSParams.macBSSID, 
+                              &pBSSSes); 
+
+  if ( NULL == pBSSSes )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist - "
+              "operation not allowed");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    return wdiStatus; 
+  }
+
+  /*-----------------------------------------------------------------------
+    If Post Assoc was not yet received - the current association must
+    be in progress
+    -----------------------------------------------------------------------*/
+  if (( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) || 
+      ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS association no longer in "
+              "progress - not allowed");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Post Assoc Request is only allowed in Joining state 
+  -----------------------------------------------------------------------*/
+  if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Post Assoc not allowed before JOIN - failing request");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  uMsgSize = sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams) +
+             sizeof(halPostAssocReqMsg.postAssocReqParams.configBssParams) ;
+  /*-----------------------------------------------------------------------
+    Fill message for tx over the bus 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_POST_ASSOC_REQ, 
+                        uMsgSize,&pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + uMsgSize )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start req %x %x %x",
+                pEventData, pwdiPostAssocParams, wdiPostAssocRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*Copy the STA parameters */
+  WDI_CopyWDIStaCtxToHALStaCtx(&halPostAssocReqMsg.postAssocReqParams.configStaParams,
+                               &pwdiPostAssocParams->wdiSTAParams );
+
+  /* Need to fill in the self STA Index */
+  if ( WDI_STATUS_SUCCESS != 
+       WDI_STATableFindStaidByAddr(pWDICtx,
+                                   pwdiPostAssocParams->wdiSTAParams.macSTA,
+                                   (wpt_uint8*)&halPostAssocReqMsg.postAssocReqParams.configStaParams.staIdx ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /* Need to fill in the BSS index */
+  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx = 
+     pBSSSes->ucBSSIdx;
+
+  /*Copy the BSS parameters */
+  WDI_CopyWDIConfigBSSToHALConfigBSS( &halPostAssocReqMsg.postAssocReqParams.configBssParams,
+                                      &pwdiPostAssocParams->wdiBSSParams);
+
+  /* Need to fill in the STA index of the peer */
+  if ( WDI_STATUS_SUCCESS != 
+       WDI_STATableFindStaidByAddr(pWDICtx,
+                                   pwdiPostAssocParams->wdiBSSParams.wdiSTAContext.macSTA,
+                                   (wpt_uint8*)&halPostAssocReqMsg.postAssocReqParams.configBssParams.staContext.staIdx)) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /* Need to fill in the BSS index */
+  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx = 
+     pBSSSes->ucBSSIdx;
+
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halPostAssocReqMsg.postAssocReqParams.configStaParams, 
+                  sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams)); 
+
+  uOffset = sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset + uOffset, 
+                  &halPostAssocReqMsg.postAssocReqParams.configBssParams, 
+                  sizeof(halPostAssocReqMsg.postAssocReqParams.configBssParams)); 
+
+ 
+  pWDICtx->wdiReqStatusCB     = pwdiPostAssocParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiPostAssocParams->pUserData; 
+
+ 
+  wpalMemoryCopy( &pWDICtx->wdiCachedPostAssocReq, 
+                  pwdiPostAssocParams,
+                  sizeof(pWDICtx->wdiCachedPostAssocReq));  
+
+  /*-------------------------------------------------------------------------
+    Send Post Assoc Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiPostAssocRspCb, pEventData->pUserData, WDI_POST_ASSOC_RESP);
+
+  
+}/*WDI_ProcessPostAssocReq*/
+
+/**
+ @brief Process Del STA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelSTAReqParamsType*  pwdiDelSTAParams;
+  WDI_DelSTARspCb           wdiDelSTARspCb;
+  wpt_uint8                 ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*       pBSSSes             = NULL;
+  wpt_uint8*                pSendBuffer         = NULL; 
+  wpt_uint16                usDataOffset        = 0;
+  wpt_uint16                usSendSize          = 0;
+  wpt_macAddr               macBSSID; 
+  WDI_Status                wdiStatus           = WDI_STATUS_SUCCESS;
+
+  tDeleteStaReqMsg          halDelStaReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiDelSTAParams = (WDI_DelSTAReqParamsType*)pEventData->pEventData;
+  wdiDelSTARspCb   = (WDI_DelSTARspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                                         pwdiDelSTAParams->ucSTAIdx, 
+                                                         &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_REQ, 
+                        sizeof(halDelStaReqMsg.delStaParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halDelStaReqMsg.delStaParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in start req %x %x %x",
+                pEventData, pwdiDelSTAParams, wdiDelSTARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halDelStaReqMsg.delStaParams.staIdx = pwdiDelSTAParams->ucSTAIdx; 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDelStaReqMsg.delStaParams, 
+                  sizeof(halDelStaReqMsg.delStaParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiDelSTAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiDelSTAParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Del STA Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelSTARspCb, pEventData->pUserData, WDI_DEL_STA_RESP);
+
+}/*WDI_ProcessDelSTAReq*/
+
+
+/*==========================================================================
+                 SECURITY REQUEST PROCESSING API 
+==========================================================================*/
+/**
+ @brief Process Set BSS Key Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBssKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetBSSKeyReqParamsType*  pwdiSetBSSKeyParams;
+  WDI_SetBSSKeyRspCb           wdiSetBSSKeyRspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  tSetBssKeyReqMsg             halSetBssKeyReqMsg  = {{0}};
+  wpt_uint8                    keyIndex            = 0;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiSetBSSKeyParams = (WDI_SetBSSKeyReqParamsType*)pEventData->pEventData;
+  wdiSetBSSKeyRspCb   = (WDI_SetBSSKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucBssIdx, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BSS_KEY_REQ, 
+                        sizeof(halSetBssKeyReqMsg.setBssKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSetBssKeyReqMsg.setBssKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiSetBSSKeyParams, wdiSetBSSKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Copy the Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+
+  halSetBssKeyReqMsg.setBssKeyParams.bssIdx = ucCurrentBSSSesIdx; 
+
+  halSetBssKeyReqMsg.setBssKeyParams.encType = 
+             WDI_2_HAL_ENC_TYPE (pwdiSetBSSKeyParams->wdiBSSKeyInfo.wdiEncType);
+
+  halSetBssKeyReqMsg.setBssKeyParams.numKeys = 
+                                  pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucNumKeys;
+
+  for(keyIndex = 0; keyIndex < pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucNumKeys ;
+                                                                 keyIndex++)
+  {
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyId = 
+                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyId;
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].unicast =
+                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].unicast;
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyDirection =
+                pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyDirection;
+    wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyRsc,
+                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc, 
+                     WDI_MAX_KEY_RSC_LEN);
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].paeRole = 
+                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].paeRole;
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyLength = 
+                   pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyLength;
+    wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].key,
+                         pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key, 
+                        WDI_MAX_KEY_LENGTH);
+   }
+                                                                  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetBssKeyReqMsg.setBssKeyParams, 
+                    sizeof(halSetBssKeyReqMsg.setBssKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetBSSKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetBSSKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Set BSS Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetBSSKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_BSS_KEY_RESP); 
+
+}/*WDI_ProcessSetBssKeyReq*/
+
+/**
+ @brief Process Remove BSS Key Request function (called when Main    
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveBssKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_RemoveBSSKeyReqParamsType*  pwdiRemoveBSSKeyParams;
+  WDI_RemoveBSSKeyRspCb           wdiRemoveBSSKeyRspCb;
+  wpt_uint8                       ucCurrentBSSSesIdx     = 0; 
+  WDI_BSSSessionType*             pBSSSes                = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
+  wpt_uint16                      usDataOffset           = 0;
+  wpt_uint16                      usSendSize             = 0;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
+  tRemoveBssKeyReqMsg             halRemoveBssKeyReqMsg  = {{0}};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiRemoveBSSKeyParams = (WDI_RemoveBSSKeyReqParamsType*)pEventData->pEventData;
+  wdiRemoveBSSKeyRspCb   = (WDI_RemoveBSSKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiRemoveBSSKeyParams->wdiKeyInfo.ucBssIdx, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_BSS_KEY_REQ, 
+                        sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiRemoveBSSKeyParams, wdiRemoveBSSKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  /*-----------------------------------------------------------------------
+    Copy the Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+  halRemoveBssKeyReqMsg.removeBssKeyParams.bssIdx = ucCurrentBSSSesIdx;
+
+  halRemoveBssKeyReqMsg.removeBssKeyParams.encType = 
+      WDI_2_HAL_ENC_TYPE (pwdiRemoveBSSKeyParams->wdiKeyInfo.wdiEncType);
+
+  halRemoveBssKeyReqMsg.removeBssKeyParams.keyId = pwdiRemoveBSSKeyParams->wdiKeyInfo.ucKeyId;
+
+  halRemoveBssKeyReqMsg.removeBssKeyParams.wepType = 
+      WDI_2_HAL_WEP_TYPE(pwdiRemoveBSSKeyParams->wdiKeyInfo.wdiWEPType);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveBssKeyReqMsg.removeBssKeyParams, 
+                    sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiRemoveBSSKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiRemoveBSSKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Remove BSS Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiRemoveBSSKeyRspCb, pEventData->pUserData,
+                       WDI_RMV_BSS_KEY_RESP); 
+}/*WDI_ProcessRemoveBssKeyReq*/
+
+/**
+ @brief Process Set STA KeyRequest function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetSTAKeyReqParamsType*  pwdiSetSTAKeyParams;
+  WDI_SetSTAKeyRspCb           wdiSetSTAKeyRspCb;
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                  macBSSID;
+  wpt_uint8                    ucCurrentBSSSesIdx; 
+  tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
+  wpt_uint8                    keyIndex            = 0;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+   pwdiSetSTAKeyParams = (WDI_SetSTAKeyReqParamsType*)pEventData->pEventData;
+   wdiSetSTAKeyRspCb   = (WDI_SetSTAKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
+                                  &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ, 
+                        sizeof(halSetStaKeyReqMsg.setStaKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSetStaKeyReqMsg.setStaKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiSetSTAKeyParams, wdiSetSTAKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  /*-----------------------------------------------------------------------
+    Copy the STA Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+  halSetStaKeyReqMsg.setStaKeyParams.encType = 
+      WDI_2_HAL_ENC_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiEncType);
+
+  halSetStaKeyReqMsg.setStaKeyParams.wepType = 
+      WDI_2_HAL_WEP_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiWEPType );
+
+  halSetStaKeyReqMsg.setStaKeyParams.staIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx;
+
+  halSetStaKeyReqMsg.setStaKeyParams.defWEPIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucDefWEPIdx;
+
+  halSetStaKeyReqMsg.setStaKeyParams.singleTidRc = pwdiSetSTAKeyParams->wdiKeyInfo.ucSingleTidRc;
+
+#ifdef WLAN_SOFTAP_FEATURE
+  for(keyIndex = 0; keyIndex < pwdiSetSTAKeyParams->wdiKeyInfo.ucNumKeys ;
+                                                                 keyIndex++)
+  {
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId = 
+                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyId;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].unicast =
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
+                pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
+                     WDI_MAX_KEY_RSC_LEN);
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole = 
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength = 
+                   pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key, 
+                        WDI_MAX_KEY_LENGTH);
+   }
+#else
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyId = 
+                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyId;
+  halSetStaKeyReqMsg.setStaKeyParams.key.unicast =
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].unicast;
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyDirection =
+                pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyDirection;
+  wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc, 
+                     WDI_MAX_KEY_RSC_LEN);
+  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole = 
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].paeRole;
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength = 
+                   pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyLength;
+  wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key, 
+                        WDI_MAX_KEY_LENGTH);
+#endif
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetStaKeyReqMsg.setStaKeyParams, 
+                    sizeof(halSetStaKeyReqMsg.setStaKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetSTAKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Set STA Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetSTAKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_STA_KEY_RESP); 
+
+}/*WDI_ProcessSetSTAKeyReq*/
+
+/**
+ @brief Process Remove STA Key Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_RemoveSTAKeyReqParamsType*  pwdiRemoveSTAKeyParams;
+  WDI_RemoveSTAKeyRspCb           wdiRemoveSTAKeyRspCb;
+  WDI_BSSSessionType*             pBSSSes                = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
+  wpt_uint16                      usDataOffset           = 0;
+  wpt_uint16                      usSendSize             = 0;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                     macBSSID;
+  wpt_uint8                       ucCurrentBSSSesIdx;
+  tRemoveStaKeyReqMsg             halRemoveStaKeyReqMsg  = {{0}};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+ if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiRemoveSTAKeyParams = (WDI_RemoveSTAKeyReqParamsType*)pEventData->pEventData;
+  wdiRemoveSTAKeyRspCb   = (WDI_RemoveSTAKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                             pwdiRemoveSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
+                             &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_KEY_REQ, 
+                        sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiRemoveSTAKeyParams, wdiRemoveSTAKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Copy the Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+
+  halRemoveStaKeyReqMsg.removeStaKeyParams.staIdx = 
+      pwdiRemoveSTAKeyParams->wdiKeyInfo.ucSTAIdx;
+
+  halRemoveStaKeyReqMsg.removeStaKeyParams.encType = 
+      WDI_2_HAL_ENC_TYPE (pwdiRemoveSTAKeyParams->wdiKeyInfo.wdiEncType);
+
+  halRemoveStaKeyReqMsg.removeStaKeyParams.keyId = 
+      pwdiRemoveSTAKeyParams->wdiKeyInfo.ucKeyId;
+
+  halRemoveStaKeyReqMsg.removeStaKeyParams.unicast = 
+      pwdiRemoveSTAKeyParams->wdiKeyInfo.ucUnicast;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveStaKeyReqMsg.removeStaKeyParams, 
+                    sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiRemoveSTAKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiRemoveSTAKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Remove STA Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiRemoveSTAKeyRspCb, pEventData->pUserData,
+                       WDI_RMV_STA_KEY_RESP); 
+
+}/*WDI_ProcessRemoveSTAKeyReq*/
+
+/**
+ @brief Process Set STA KeyRequest function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaBcastKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetSTAKeyReqParamsType*  pwdiSetSTAKeyParams;
+  WDI_SetSTAKeyRspCb           wdiSetSTAKeyRspCb;
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                  macBSSID;
+  wpt_uint8                    ucCurrentBSSSesIdx; 
+  tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
+  wpt_uint8                    keyIndex            = 0;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+   pwdiSetSTAKeyParams = (WDI_SetSTAKeyReqParamsType*)pEventData->pEventData;
+   wdiSetSTAKeyRspCb   = (WDI_SetSTAKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
+                                  &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ, 
+                        sizeof(halSetStaKeyReqMsg.setStaKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSetStaKeyReqMsg.setStaKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiSetSTAKeyParams, wdiSetSTAKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  /*-----------------------------------------------------------------------
+    Copy the STA Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+  halSetStaKeyReqMsg.setStaKeyParams.encType = 
+      WDI_2_HAL_ENC_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiEncType);
+
+  halSetStaKeyReqMsg.setStaKeyParams.wepType = 
+      WDI_2_HAL_WEP_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiWEPType );
+
+  halSetStaKeyReqMsg.setStaKeyParams.staIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx;
+
+  halSetStaKeyReqMsg.setStaKeyParams.defWEPIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucDefWEPIdx;
+
+  halSetStaKeyReqMsg.setStaKeyParams.singleTidRc = pwdiSetSTAKeyParams->wdiKeyInfo.ucSingleTidRc;
+
+#ifdef WLAN_SOFTAP_FEATURE
+  for(keyIndex = 0; keyIndex < pwdiSetSTAKeyParams->wdiKeyInfo.ucNumKeys ;
+                                                                 keyIndex++)
+  {
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId = 
+                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyId;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].unicast =
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
+                pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
+                     WDI_MAX_KEY_RSC_LEN);
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole = 
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength = 
+                   pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key, 
+                        WDI_MAX_KEY_LENGTH);
+   }
+#else
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyId = 
+                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyId;
+  halSetStaKeyReqMsg.setStaKeyParams.key.unicast =
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].unicast;
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyDirection =
+                pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyDirection;
+  wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc, 
+                     WDI_MAX_KEY_RSC_LEN);
+  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole = 
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].paeRole;
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength = 
+                   pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyLength;
+  wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key, 
+                        WDI_MAX_KEY_LENGTH);
+#endif
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetStaKeyReqMsg.setStaKeyParams, 
+                    sizeof(halSetStaKeyReqMsg.setStaKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetSTAKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Set STA Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetSTAKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_STA_KEY_RESP); 
+
+}/*WDI_ProcessSetSTABcastKeyReq*/
+
+/**
+ @brief Process Remove STA Key Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaBcastKeyReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_RemoveSTAKeyReqParamsType*  pwdiRemoveSTABcastKeyParams;
+  WDI_RemoveSTAKeyRspCb           wdiRemoveSTAKeyRspCb;
+  WDI_BSSSessionType*             pBSSSes                = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
+  wpt_uint16                      usDataOffset           = 0;
+  wpt_uint16                      usSendSize             = 0;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                     macBSSID;
+  wpt_uint8                       ucCurrentBSSSesIdx;
+  tRemoveStaKeyReqMsg             halRemoveStaBcastKeyReqMsg = {{0}};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+ if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiRemoveSTABcastKeyParams = (WDI_RemoveSTAKeyReqParamsType*)pEventData->pEventData;
+  wdiRemoveSTAKeyRspCb   = (WDI_RemoveSTAKeyRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                             pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucSTAIdx, 
+                             &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_BCAST_KEY_REQ, 
+                        sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiRemoveSTABcastKeyParams, wdiRemoveSTAKeyRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Copy the Key parameters into the HAL message
+  -----------------------------------------------------------------------*/
+
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.staIdx = 
+      pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucSTAIdx;
+
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.encType = 
+      WDI_2_HAL_ENC_TYPE (pwdiRemoveSTABcastKeyParams->wdiKeyInfo.wdiEncType);
+
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.keyId = 
+      pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucKeyId;
+
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.unicast = 
+      pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucUnicast;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveStaBcastKeyReqMsg.removeStaKeyParams, 
+                    sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiRemoveSTABcastKeyParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiRemoveSTABcastKeyParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Remove STA Key Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiRemoveSTAKeyRspCb, pEventData->pUserData,
+                       WDI_RMV_STA_KEY_RESP); 
+
+}/*WDI_ProcessRemoveSTABcastKeyReq*/
+
+/*==========================================================================
+                   QOS and BA PROCESSING REQUEST API 
+==========================================================================*/
+/**
+ @brief Process Add TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddTSReqParamsType*  pwdiAddTSParams;
+  WDI_AddTsRspCb           wdiAddTSRspCb;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*      pBSSSes             = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr              macBSSID;
+  tAddTsParams             halAddTsParams      = {0};
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiAddTSParams = (WDI_AddTSReqParamsType*)pEventData->pEventData;
+  wdiAddTSRspCb   = (WDI_AddTsRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                        pwdiAddTSParams->wdiTsInfo.ucSTAIdx, 
+                                        &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_TS_REQ, 
+                                                    sizeof(halAddTsParams), 
+                                                    &pSendBuffer, &usDataOffset, 
+                                                    &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halAddTsParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiAddTSParams, wdiAddTSRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halAddTsParams.staIdx = pwdiAddTSParams->wdiTsInfo.ucSTAIdx;
+  halAddTsParams.tspecIdx = pwdiAddTSParams->wdiTsInfo.ucTspecIdx;
+
+  //TSPEC IE
+  halAddTsParams.tspec.type = pwdiAddTSParams->wdiTsInfo.wdiTspecIE.ucType;
+  halAddTsParams.tspec.length = pwdiAddTSParams->wdiTsInfo.wdiTspecIE.ucLength;
+  halAddTsParams.tspec.nomMsduSz = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usNomMsduSz;
+  halAddTsParams.tspec.maxMsduSz = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usMaxMsduSz;
+  halAddTsParams.tspec.minSvcInterval = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinSvcInterval;
+  halAddTsParams.tspec.maxSvcInterval = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMaxSvcInterval;
+  halAddTsParams.tspec.inactInterval = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uInactInterval;
+  halAddTsParams.tspec.suspendInterval = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uSuspendInterval;
+  halAddTsParams.tspec.svcStartTime = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uSvcStartTime;
+  halAddTsParams.tspec.minDataRate = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinDataRate;
+  halAddTsParams.tspec.meanDataRate = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMeanDataRate;
+  halAddTsParams.tspec.peakDataRate = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uPeakDataRate;
+  halAddTsParams.tspec.maxBurstSz = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMaxBurstSz;
+  halAddTsParams.tspec.delayBound = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uDelayBound;
+  halAddTsParams.tspec.minPhyRate = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinPhyRate;
+  halAddTsParams.tspec.surplusBw = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usSurplusBw;
+  halAddTsParams.tspec.mediumTime = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usMediumTime;
+
+  //TSPEC IE : TS INFO : TRAFFIC
+  halAddTsParams.tspec.tsinfo.traffic.ackPolicy = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.accessPolicy;
+  halAddTsParams.tspec.tsinfo.traffic.userPrio = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.userPrio;
+  halAddTsParams.tspec.tsinfo.traffic.psb = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.psb;
+  halAddTsParams.tspec.tsinfo.traffic.aggregation = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.aggregation;
+  halAddTsParams.tspec.tsinfo.traffic.direction = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.direction;
+  halAddTsParams.tspec.tsinfo.traffic.tsid = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.tsid;
+  halAddTsParams.tspec.tsinfo.traffic.trafficType = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.trafficType;
+
+  //TSPEC IE : TS INFO : SCHEDULE
+  halAddTsParams.tspec.tsinfo.schedule.rsvd = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.rsvd;
+  halAddTsParams.tspec.tsinfo.schedule.schedule = 
+     pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.schedule;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddTsParams, 
+                  sizeof(halAddTsParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiAddTSParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiAddTSParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Add TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiAddTSRspCb, pEventData->pUserData,
+                       WDI_ADD_TS_RESP); 
+}/*WDI_ProcessAddTSpecReq*/
+
+
+/**
+ @brief Process Del TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelTSReqParamsType*      pwdiDelTSParams;
+  WDI_DelTsRspCb               wdiDelTSRspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiDelTSParams = (WDI_DelTSReqParamsType*)pEventData->pEventData;
+  wdiDelTSRspCb   = (WDI_DelTsRspCb)pEventData->pCBfnc;
+
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiDelTSParams->wdiDelTSInfo.macBSSID, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_TS_REQ, 
+                        sizeof(pwdiDelTSParams->wdiDelTSInfo),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(pwdiDelTSParams->wdiDelTSInfo) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiDelTSParams, wdiDelTSRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiDelTSParams->wdiDelTSInfo, 
+                  sizeof(pwdiDelTSParams->wdiDelTSInfo)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiDelTSParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiDelTSParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Del TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelTSRspCb, pEventData->pUserData, WDI_DEL_TS_RESP); 
+}/*WDI_ProcessDelTSpecReq*/
+
+/**
+ @brief Process Update EDCA Params Request function (called when
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateEDCAParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_UpdateEDCAParamsType*    pwdiUpdateEDCAParams;
+  WDI_UpdateEDCAParamsRspCb    wdiUpdateEDCARspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset         = 0;
+  wpt_uint16                   usSendSize           = 0;
+  WDI_Status                   wdiStatus; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiUpdateEDCAParams = (WDI_UpdateEDCAParamsType*)pEventData->pEventData;
+  wdiUpdateEDCARspCb   = (WDI_UpdateEDCAParamsRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiUpdateEDCAParams->wdiEDCAInfo.ucBssIdx, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_EDCA_PRMS_REQ, 
+                        sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiUpdateEDCAParams, wdiUpdateEDCARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiUpdateEDCAParams->wdiEDCAInfo, 
+                  sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiUpdateEDCAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiUpdateEDCAParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Update EDCA Params Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateEDCARspCb, pEventData->pUserData, 
+                       WDI_UPD_EDCA_PRMS_RESP); 
+}/*WDI_ProcessUpdateEDCAParamsReq*/
+
+/**
+ @brief Process Add BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBASessionReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddBASessionReqParamsType*  pwdiAddBASessionParams;
+  WDI_AddBASessionRspCb           wdiAddBASessionRspCb;
+  wpt_uint8                       ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*             pBSSSes             = NULL;
+  wpt_uint8*                      pSendBuffer         = NULL; 
+  wpt_uint16                      usDataOffset        = 0;
+  wpt_uint16                      usSendSize          = 0;
+  WDI_Status                      wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                     macBSSID;
+
+  tAddBASessionReqMsg             halAddBASessionReq;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiAddBASessionParams = 
+                  (WDI_AddBASessionReqParamsType*)pEventData->pEventData;
+  wdiAddBASessionRspCb = 
+                  (WDI_AddBASessionRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                   pwdiAddBASessionParams->wdiBASessionInfoType.ucSTAIdx, 
+                   &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_ADD_BA_SESSION_REQ, 
+                        sizeof(halAddBASessionReq.addBASessionParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < 
+            (usDataOffset + sizeof(halAddBASessionReq.addBASessionParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in Add BA session req %x %x %x",
+                pEventData, pwdiAddBASessionParams, wdiAddBASessionRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halAddBASessionReq.addBASessionParams.staIdx =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.ucSTAIdx;
+  wpalMemoryCopy(halAddBASessionReq.addBASessionParams.peerMacAddr,
+                  pwdiAddBASessionParams->wdiBASessionInfoType.macPeerAddr,
+                  WDI_MAC_ADDR_LEN);
+  halAddBASessionReq.addBASessionParams.baTID =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.ucBaTID;
+  halAddBASessionReq.addBASessionParams.baPolicy =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.ucBaPolicy;
+  halAddBASessionReq.addBASessionParams.baBufferSize =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.usBaBufferSize;
+  halAddBASessionReq.addBASessionParams.baTimeout =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.usBaTimeout;
+  halAddBASessionReq.addBASessionParams.baSSN =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.usBaSSN;
+  halAddBASessionReq.addBASessionParams.baDirection =
+                  pwdiAddBASessionParams->wdiBASessionInfoType.ucBaDirection;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddBASessionReq.addBASessionParams, 
+                  sizeof(halAddBASessionReq.addBASessionParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiAddBASessionParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiAddBASessionParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiAddBASessionRspCb, pEventData->pUserData, 
+                        WDI_ADD_BA_SESSION_RESP); 
+}/*WDI_ProcessAddBASessionReq*/
+
+/**
+ @brief Process Del BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelBAReqParamsType*      pwdiDelBAParams;
+  WDI_DelBARspCb               wdiDelBARspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr                  macBSSID;
+  tDelBAParams                 halDelBAparam;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiDelBAParams = (WDI_DelBAReqParamsType*)pEventData->pEventData;
+  wdiDelBARspCb   = (WDI_DelBARspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                     pwdiDelBAParams->wdiBAInfo.ucSTAIdx, 
+                                     &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BA_REQ, 
+                        sizeof(halDelBAparam),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halDelBAparam) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer for DEL BA req %x %x %x",
+                pEventData, pwdiDelBAParams, wdiDelBARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halDelBAparam.staIdx = pwdiDelBAParams->wdiBAInfo.ucSTAIdx;
+  halDelBAparam.baTID = pwdiDelBAParams->wdiBAInfo.ucBaTID;
+  halDelBAparam.baDirection = pwdiDelBAParams->wdiBAInfo.ucBaDirection;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDelBAparam, 
+                  sizeof(halDelBAparam)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiDelBAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiDelBAParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelBARspCb, pEventData->pUserData, WDI_DEL_BA_RESP); 
+}/*WDI_ProcessDelBAReq*/
+
+#ifdef FEATURE_WLAN_CCX
+
+WDI_Status
+WDI_ProcessTSMStatsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_TSMStatsReqParamsType*  pwdiTSMParams;
+  WDI_TsmRspCb                wdiTSMRspCb;
+  wpt_uint8                   ucCurrentBSSSesIdx   = 0; 
+  WDI_BSSSessionType*         pBSSSes              = NULL;
+  wpt_uint8*                  pSendBuffer          = NULL; 
+  wpt_uint16                  usDataOffset         = 0;
+  wpt_uint16                  usSendSize           = 0;
+  WDI_Status                  wdiStatus            = WDI_STATUS_SUCCESS; 
+  tTsmStatsParams             halTsmStatsReqParams = {0};
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+       Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiTSMParams = (WDI_TSMStatsReqParamsType*)pEventData->pEventData;
+  wdiTSMRspCb   = (WDI_TsmRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, pwdiTSMParams->wdiTsmStatsParamsInfo.bssid, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_TSM_STATS_REQ, 
+                                                    sizeof(halTsmStatsReqParams), 
+                                                    &pSendBuffer, &usDataOffset,                                                     &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halTsmStatsReqParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiTSMParams, wdiTSMRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halTsmStatsReqParams.tsmTID = pwdiTSMParams->wdiTsmStatsParamsInfo.ucTid;
+  wpalMemoryCopy(halTsmStatsReqParams.bssId,
+                 pwdiTSMParams->wdiTsmStatsParamsInfo.bssid,
+                 WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halTsmStatsReqParams, 
+                  sizeof(halTsmStatsReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiTSMParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiTSMParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send TSM Stats Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiTSMRspCb, pEventData->pUserData,
+                       WDI_TSM_STATS_RESP); 
+}/*WDI_ProcessTSMStatsReq*/
+
+#endif
+
+
+/**
+ @brief Process Flush AC Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFlushAcReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_FlushAcReqParamsType*    pwdiFlushAcParams = NULL;
+   WDI_FlushAcRspCb             wdiFlushAcRspCb;
+   wpt_uint8*                   pSendBuffer         = NULL; 
+   wpt_uint16                   usDataOffset        = 0;
+   wpt_uint16                   usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+       ( NULL == pEventData->pCBfnc ))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   pwdiFlushAcParams = (WDI_FlushAcReqParamsType*)pEventData->pEventData;
+   wdiFlushAcRspCb   = (WDI_FlushAcRspCb)pEventData->pCBfnc;
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FLUSH_AC_REQ, 
+                         sizeof(pwdiFlushAcParams->wdiFlushAcInfo),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pwdiFlushAcParams->wdiFlushAcInfo) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in set bss key req %x %x %x",
+                 pEventData, pwdiFlushAcParams, wdiFlushAcRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiFlushAcParams->wdiFlushAcInfo, 
+                   sizeof(pwdiFlushAcParams->wdiFlushAcInfo)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiFlushAcParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiFlushAcParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Start Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiFlushAcRspCb, pEventData->pUserData, WDI_FLUSH_AC_RESP); 
+}/*WDI_ProcessFlushAcReq*/
+
+/**
+ @brief Process BT AMP event Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBtAmpEventReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_BtAmpEventParamsType*    pwdiBtAmpEventParams = NULL;
+   WDI_BtAmpEventRspCb          wdiBtAmpEventRspCb;
+   wpt_uint8*                   pSendBuffer         = NULL; 
+   wpt_uint16                   usDataOffset        = 0;
+   wpt_uint16                   usSendSize          = 0;
+
+   tBtAmpEventMsg               haltBtAmpEventMsg;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+       ( NULL == pEventData->pCBfnc ))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   pwdiBtAmpEventParams = (WDI_BtAmpEventParamsType*)pEventData->pEventData;
+   wdiBtAmpEventRspCb   = (WDI_BtAmpEventRspCb)pEventData->pCBfnc;
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_BTAMP_EVENT_REQ, 
+                         sizeof(haltBtAmpEventMsg.btAmpEventParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(haltBtAmpEventMsg.btAmpEventParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in BT AMP event req %x %x %x",
+                 pEventData, pwdiBtAmpEventParams, wdiBtAmpEventRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   haltBtAmpEventMsg.btAmpEventParams.btAmpEventType = 
+      pwdiBtAmpEventParams->wdiBtAmpEventInfo.ucBtAmpEventType;
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &haltBtAmpEventMsg.btAmpEventParams, 
+                   sizeof(haltBtAmpEventMsg.btAmpEventParams)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiBtAmpEventParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiBtAmpEventParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Start Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBtAmpEventRspCb, pEventData->pUserData, WDI_BTAMP_EVENT_RESP); 
+}/*WDI_ProcessBtAmpEventReq*/
+
+/**
+ @brief Process Add STA self Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddSTASelfReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddSTASelfReqParamsType*          pwdiAddSTASelfReqParams;
+  WDI_AddSTASelfParamsRspCb             wdiAddSTASelfReqRspCb;
+  wpt_uint8*                            pSendBuffer         = NULL; 
+  wpt_uint16                            usDataOffset        = 0;
+  wpt_uint16                            usSendSize          = 0;
+  tAddStaSelfParams                     halAddSTASelfParams; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiAddSTASelfReqParams = 
+    (WDI_AddSTASelfReqParamsType*)pEventData->pEventData;
+  wdiAddSTASelfReqRspCb = 
+    (WDI_AddSTASelfParamsRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_ADD_STA_SELF_REQ, 
+                        sizeof(tAddStaSelfParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(tAddStaSelfParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in ADD STA SELF REQ %x %x %x",
+     pEventData, pwdiAddSTASelfReqParams, wdiAddSTASelfReqRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /* Cache the request for response processing */
+  wpalMemoryCopy(&pWDICtx->wdiCacheAddSTASelfReq, pwdiAddSTASelfReqParams, 
+                 sizeof(pWDICtx->wdiCacheAddSTASelfReq));
+
+  wpalMemoryCopy(halAddSTASelfParams.selfMacAddr, 
+                   pwdiAddSTASelfReqParams->wdiAddSTASelfInfo.selfMacAddr, 6) ;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halAddSTASelfParams, 
+                                         sizeof(tAddStaSelfParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiAddSTASelfReqParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiAddSTASelfReqParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Update Probe Resp Template Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiAddSTASelfReqRspCb, pEventData->pUserData, 
+                       WDI_ADD_STA_SELF_RESP); 
+}/*WDI_ProcessAddSTASelfReq*/
+
+
+
+/**
+ @brief Process Del Sta Self Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTASelfReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelSTASelfReqParamsType*      pwdiDelStaSelfReqParams;
+  WDI_DelSTASelfRspCb               wdiDelStaSelfRspCb;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  tDelStaSelfParams            halSetDelSelfSTAParams;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiDelStaSelfReqParams = 
+                 (WDI_DelSTASelfReqParamsType*)pEventData->pEventData;
+  wdiDelStaSelfRspCb      = (WDI_DelSTASelfRspCb)pEventData->pCBfnc;
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_SELF_REQ, 
+                         sizeof(pwdiDelStaSelfReqParams->wdiDelStaSelfInfo),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+    ( usSendSize < 
+         (usDataOffset + sizeof(pwdiDelStaSelfReqParams->wdiDelStaSelfInfo) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Del Sta Self req %x %x %x",
+                 pEventData, pwdiDelStaSelfReqParams, wdiDelStaSelfRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halSetDelSelfSTAParams.selfMacAddr, 
+                   pwdiDelStaSelfReqParams->wdiDelStaSelfInfo.selfMacAddr, 6) ;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halSetDelSelfSTAParams, 
+                                         sizeof(tDelStaSelfParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiDelStaSelfReqParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiDelStaSelfReqParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+     Send Start Request to HAL 
+   -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiDelStaSelfRspCb, pEventData->pUserData, 
+                                                     WDI_DEL_STA_SELF_RESP);
+
+}
+
+
+/**
+ @brief Process Host Resume Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostResumeReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ResumeParamsType*          pwdiHostResumeParams = NULL;
+  WDI_HostResumeEventRspCb       wdiHostResumeRspCb;
+  wpt_uint8*                     pSendBuffer         = NULL; 
+  wpt_uint16                     usDataOffset        = 0;
+  wpt_uint16                     usSendSize          = 0;
+  tHalWlanHostResumeReqParam     halResumeReqParams;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+  Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "%s: Invalid parameters ",__FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+  }
+
+   pwdiHostResumeParams = (WDI_ResumeParamsType*)pEventData->pEventData;
+   wdiHostResumeRspCb   = (WDI_HostResumeEventRspCb)pEventData->pCBfnc;
+
+  /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_HOST_RESUME_REQ, sizeof(halResumeReqParams),
+                              &pSendBuffer, &usDataOffset, &usSendSize))||
+        (usSendSize < (usDataOffset + sizeof(halResumeReqParams))))
+  {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Start In Nav Meas req %x %x %x",
+                 pEventData, pwdiHostResumeParams, wdiHostResumeRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+  }
+
+  halResumeReqParams.configuredMcstBcstFilterSetting = 
+     pwdiHostResumeParams->wdiResumeParams.ucConfiguredMcstBcstFilterSetting;
+       
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halResumeReqParams, 
+                  sizeof(halResumeReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiHostResumeParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiHostResumeParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHostResumeRspCb, pEventData->pUserData, 
+                                            WDI_HOST_RESUME_RESP); 
+}/*WDI_ProcessHostResumeReq*/
+
+/**
+ @brief Process set Tx Per Tracking Parameters Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPerTrackingReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetTxPerTrackingReqParamsType* pwdiSetTxPerTrackingReqParams = NULL;
+   WDI_SetTxPerTrackingRspCb          pwdiSetTxPerTrackingRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalTxPerTrackingReqParam     halTxPerTrackingReqParam;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+       ( NULL == pEventData->pCBfnc ))
+   {
+       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters ",__FUNCTION__);
+       WDI_ASSERT(0);
+       return WDI_STATUS_E_FAILURE; 
+   }
+
+   pwdiSetTxPerTrackingReqParams = (WDI_SetTxPerTrackingReqParamsType*)pEventData->pEventData;
+   pwdiSetTxPerTrackingRspCb   = (WDI_SetTxPerTrackingRspCb)pEventData->pCBfnc;
+   
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TX_PER_TRACKING_REQ, 
+                         sizeof(halTxPerTrackingReqParam),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(halTxPerTrackingReqParam) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in set tx per tracking req %x %x %x",
+                  pEventData, pwdiSetTxPerTrackingReqParams, pwdiSetTxPerTrackingRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+   
+   halTxPerTrackingReqParam.ucTxPerTrackingEnable = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingEnable;
+   halTxPerTrackingReqParam.ucTxPerTrackingPeriod = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingPeriod;
+   halTxPerTrackingReqParam.ucTxPerTrackingRatio = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingRatio;
+   halTxPerTrackingReqParam.uTxPerTrackingWatermark = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.uTxPerTrackingWatermark;
+      
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halTxPerTrackingReqParam, 
+                   sizeof(halTxPerTrackingReqParam)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiSetTxPerTrackingReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiSetTxPerTrackingReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        pwdiSetTxPerTrackingRspCb, pEventData->pUserData, WDI_SET_TX_PER_TRACKING_RESP); 
+}/*WDI_ProcessSetTxPerTrackingReq*/
+
+/*=========================================================================
+                             Indications
+=========================================================================*/
+
+/**
+ @brief Process Suspend Indications function (called when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostSuspendInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SuspendParamsType          *pSuspendIndParams;
+  wpt_uint8*                     pSendBuffer         = NULL; 
+  wpt_uint16                     usDataOffset        = 0;
+  wpt_uint16                     usSendSize          = 0;
+  WDI_Status                     wdiStatus;
+  tHalWlanHostSuspendIndParam    halWlanSuspendIndparams;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+     Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
+  {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "%s: Invalid parameters in Suspend ind",__FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+  }
+
+  pSuspendIndParams = (WDI_SuspendParamsType *)pEventData->pEventData;
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_HOST_SUSPEND_IND, 
+                     sizeof(halWlanSuspendIndparams),
+                     &pSendBuffer, &usDataOffset, &usSendSize))||
+        (usSendSize < (usDataOffset + sizeof(halWlanSuspendIndparams))))
+  {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Suspend Ind ");
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+  }
+
+  halWlanSuspendIndparams.configuredMcstBcstFilterSetting =
+       pSuspendIndParams->wdiSuspendParams.ucConfiguredMcstBcstFilterSetting;
+
+  halWlanSuspendIndparams.activeSessionCount = 
+       WDI_GetActiveSessionsCount(pWDICtx);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halWlanSuspendIndparams, 
+                                         sizeof(tHalWlanHostSuspendIndParam)); 
+
+  /*-------------------------------------------------------------------------
+    Send Suspend Request to HAL 
+  -------------------------------------------------------------------------*/
+  pWDICtx->wdiReqStatusCB     = pSuspendIndParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pSuspendIndParams->pUserData; 
+
+  wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize); 
+  return  ( wdiStatus != WDI_STATUS_SUCCESS )?wdiStatus:WDI_STATUS_SUCCESS_SYNC;
+}/*WDI_ProcessHostSuspendInd*/
+
+/*==========================================================================
+                  MISC CONTROL PROCESSING REQUEST API 
+==========================================================================*/
+/**
+ @brief Process Channel Switch Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessChannelSwitchReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SwitchChReqParamsType*   pwdiSwitchChParams;
+  WDI_SwitchChRspCb            wdiSwitchChRspCb;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  tSwitchChannelReqMsg         halSwitchChannelReq = {{0}};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiSwitchChParams = (WDI_SwitchChReqParamsType*)pEventData->pEventData;
+  wdiSwitchChRspCb   = (WDI_SwitchChRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CH_SWITCH_REQ, 
+                        sizeof(halSwitchChannelReq.switchChannelParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSwitchChannelReq.switchChannelParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in channel switch req %x %x %x",
+                pEventData, pwdiSwitchChParams, wdiSwitchChRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halSwitchChannelReq.switchChannelParams.channelNumber = 
+                       pwdiSwitchChParams->wdiChInfo.ucChannel;
+#ifndef WLAN_FEATURE_VOWIFI    
+  halSwitchChannelReq.switchChannelParams.localPowerConstraint = 
+                       pwdiSwitchChParams->wdiChInfo.ucLocalPowerConstraint;
+#endif
+  halSwitchChannelReq.switchChannelParams.secondaryChannelOffset = 
+                       pwdiSwitchChParams->wdiChInfo.wdiSecondaryChannelOffset;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  halSwitchChannelReq.switchChannelParams.maxTxPower
+                            = pwdiSwitchChParams->wdiChInfo.cMaxTxPower; 
+  wpalMemoryCopy(halSwitchChannelReq.switchChannelParams.selfStaMacAddr,
+                  pwdiSwitchChParams->wdiChInfo.macSelfStaMacAddr,
+                  WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(halSwitchChannelReq.switchChannelParams.bssId,
+                  pwdiSwitchChParams->wdiChInfo.macBSSId,
+                  WDI_MAC_ADDR_LEN);
+#endif
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSwitchChannelReq.switchChannelParams, 
+                  sizeof(halSwitchChannelReq.switchChannelParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSwitchChParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSwitchChParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Switch Channel Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSwitchChRspCb, pEventData->pUserData, WDI_CH_SWITCH_RESP); 
+}/*WDI_ProcessChannelSwitchReq*/
+
+/**
+ @brief Process Config STA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigStaReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ConfigSTAReqParamsType*  pwdiConfigSTAParams;
+  WDI_ConfigSTARspCb           wdiConfigSTARspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+
+  tConfigStaReqMsg             halConfigStaReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiConfigSTAParams = (WDI_ConfigSTAReqParamsType*)pEventData->pEventData;
+  wdiConfigSTARspCb   = (WDI_ConfigSTARspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiConfigSTAParams->wdiReqInfo.macBSSID, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_STA_REQ, 
+                        sizeof(halConfigStaReqMsg.configStaParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halConfigStaReqMsg.configStaParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in config sta req %x %x %x",
+                pEventData, pwdiConfigSTAParams, wdiConfigSTARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*Copy the station context*/
+  WDI_CopyWDIStaCtxToHALStaCtx( &halConfigStaReqMsg.configStaParams,
+                                &pwdiConfigSTAParams->wdiReqInfo);
+
+  if(pwdiConfigSTAParams->wdiReqInfo.wdiSTAType == WDI_STA_ENTRY_SELF)
+  {
+    /* Need to fill in the self STA Index */
+    if ( WDI_STATUS_SUCCESS != 
+         WDI_STATableFindStaidByAddr(pWDICtx,
+                                     pwdiConfigSTAParams->wdiReqInfo.macSTA,
+                                     (wpt_uint8*)&halConfigStaReqMsg.configStaParams.staIdx ))
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "This station does not exist in the WDI Station Table %d");
+      wpalMutexRelease(&pWDICtx->wptMutex);
+      return WDI_STATUS_E_FAILURE; 
+    }
+  }
+  else
+  {
+  /* Need to fill in the STA Index to invalid, since at this point we have not
+     yet received it from HAL */
+    halConfigStaReqMsg.configStaParams.staIdx = WDI_STA_INVALID_IDX;
+  }
+
+  /* Need to fill in the BSS index */
+  halConfigStaReqMsg.configStaParams.bssIdx = pBSSSes->ucBSSIdx;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halConfigStaReqMsg.configStaParams, 
+                  sizeof(halConfigStaReqMsg.configStaParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiConfigSTAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiConfigSTAParams->pUserData; 
+
+  wpalMemoryCopy( &pWDICtx->wdiCachedConfigStaReq, 
+                  pwdiConfigSTAParams, 
+                  sizeof(pWDICtx->wdiCachedConfigStaReq));
+
+  /*-------------------------------------------------------------------------
+    Send Config STA Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigSTARspCb, pEventData->pUserData, WDI_CONFIG_STA_RESP); 
+}/*WDI_ProcessConfigStaReq*/
+
+
+/**
+ @brief Process Set Link State Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetLinkStateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetLinkReqParamsType*    pwdiSetLinkParams;
+  WDI_SetLinkStateRspCb        wdiSetLinkRspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  tLinkStateParams             halLinkStateReqMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiSetLinkParams = (WDI_SetLinkReqParamsType*)pEventData->pEventData;
+  wdiSetLinkRspCb   = (WDI_SetLinkStateRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiSetLinkParams->wdiLinkInfo.macBSSID, 
+                          &pBSSSes); 
+
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Set link request received outside association session");
+  }
+  else
+  {
+    /*------------------------------------------------------------------------
+      Check if this BSS is being currently processed or queued,
+      if queued - queue the new request as well 
+    ------------------------------------------------------------------------*/
+    if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Association sequence for this BSS exists but currently queued");
+  
+      wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+      wpalMutexRelease(&pWDICtx->wptMutex);
+      return wdiStatus; 
+    }
+  }
+  /* If the link is set to enter IDLE - the Session allocated for this BSS
+     will be deleted on the Set Link State response coming from HAL
+   - cache the request for response processing */
+  wpalMemoryCopy(&pWDICtx->wdiCacheSetLinkStReq, pwdiSetLinkParams, 
+                 sizeof(pWDICtx->wdiCacheSetLinkStReq));
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_LINK_ST_REQ, 
+                        sizeof(halLinkStateReqMsg),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halLinkStateReqMsg) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiSetLinkParams, wdiSetLinkRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halLinkStateReqMsg.bssid,
+                 pwdiSetLinkParams->wdiLinkInfo.macBSSID, WDI_MAC_ADDR_LEN);
+
+  wpalMemoryCopy(halLinkStateReqMsg.selfMacAddr,
+                 pwdiSetLinkParams->wdiLinkInfo.macSelfStaMacAddr, WDI_MAC_ADDR_LEN);
+
+  halLinkStateReqMsg.state = 
+     WDI_2_HAL_LINK_STATE(pwdiSetLinkParams->wdiLinkInfo.wdiLinkState);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halLinkStateReqMsg, 
+                  sizeof(halLinkStateReqMsg)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetLinkParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetLinkParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Set Link State Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetLinkRspCb, pEventData->pUserData, WDI_SET_LINK_ST_RESP); 
+}/*WDI_ProcessSetLinkStateReq*/
+
+
+/**
+ @brief Process Get Stats Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGetStatsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_GetStatsReqParamsType*   pwdiGetStatsParams;
+  WDI_GetStatsRspCb            wdiGetStatsRspCb;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_macAddr                  macBSSID;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  tHalStatsReqMsg              halStatsReqMsg;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc ) )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiGetStatsParams = (WDI_GetStatsReqParamsType*)pEventData->pEventData;
+  wdiGetStatsRspCb   = (WDI_GetStatsRspCb)pEventData->pCBfnc;
+
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                        pwdiGetStatsParams->wdiGetStatsParamsInfo.ucSTAIdx, 
+                        &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GET_STATS_REQ, 
+                        sizeof(halStatsReqMsg.statsReqParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halStatsReqMsg.statsReqParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiGetStatsParams, wdiGetStatsRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halStatsReqMsg.statsReqParams.staId = 
+                  pwdiGetStatsParams->wdiGetStatsParamsInfo.ucSTAIdx;
+  halStatsReqMsg.statsReqParams.statsMask = 
+                  pwdiGetStatsParams->wdiGetStatsParamsInfo.uStatsMask;
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStatsReqMsg.statsReqParams, 
+                  sizeof(halStatsReqMsg.statsReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiGetStatsParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiGetStatsParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Get STA Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiGetStatsRspCb, pEventData->pUserData, WDI_GET_STATS_RESP); 
+}/*WDI_ProcessGetStatsReq*/
+
+/**
+ @brief Process Update Cfg Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateCfgReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_UpdateCfgReqParamsType*  pwdiUpdateCfgParams = NULL;
+  WDI_UpdateCfgRspCb           wdiUpdateCfgRspCb = NULL;
+
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset         = 0;
+  wpt_uint16                   usSendSize          = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiUpdateCfgParams = (WDI_UpdateCfgReqParamsType*)pEventData->pEventData;
+  wdiUpdateCfgRspCb   = (WDI_UpdateCfgRspCb)pEventData->pCBfnc;
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_CFG_REQ, 
+                        pwdiUpdateCfgParams->uConfigBufferLen + sizeof(wpt_uint32),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset +  pwdiUpdateCfgParams->uConfigBufferLen)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiUpdateCfgParams, wdiUpdateCfgRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiUpdateCfgParams->uConfigBufferLen, 
+                  sizeof(wpt_uint32)); 
+  wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(wpt_uint32), 
+                  pwdiUpdateCfgParams->pConfigBuffer, 
+                  pwdiUpdateCfgParams->uConfigBufferLen); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiUpdateCfgParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiUpdateCfgParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Update Cfg Request to HAL 
+  -------------------------------------------------------------------------*/
+
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateCfgRspCb, pEventData->pUserData, WDI_UPDATE_CFG_RESP); 
+
+}/*WDI_ProcessUpdateCfgReq*/
+
+
+/**
+ @brief Process Add BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddBAReqParamsType*  pwdiAddBAParams;
+  WDI_AddBARspCb           wdiAddBARspCb;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*      pBSSSes             = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr              macBSSID;
+
+  tAddBAReqMsg             halAddBAReq;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiAddBAParams = (WDI_AddBAReqParamsType*)pEventData->pEventData;
+  wdiAddBARspCb   = (WDI_AddBARspCb)pEventData->pCBfnc;
+
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiAddBAParams->wdiBAInfoType.ucSTAIdx, 
+                                  &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_BA_REQ, 
+                        sizeof(halAddBAReq.addBAParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < 
+            (usDataOffset + sizeof(halAddBAReq.addBAParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in Add BA req %x %x %x",
+                pEventData, pwdiAddBAParams, wdiAddBARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halAddBAReq.addBAParams.baSessionID = 
+                             pwdiAddBAParams->wdiBAInfoType.ucBaSessionID;
+  halAddBAReq.addBAParams.winSize = pwdiAddBAParams->wdiBAInfoType.ucWinSize;
+#ifdef FEATURE_ON_CHIP_REORDERING
+  halAddBAReq.addBAParams.isReorderingDoneOnChip = 
+                       pwdiAddBAParams->wdiBAInfoType.bIsReorderingDoneOnChip;
+#endif
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddBAReq.addBAParams, 
+                  sizeof(halAddBAReq.addBAParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiAddBAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiAddBAParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiAddBARspCb, pEventData->pUserData, 
+                        WDI_ADD_BA_RESP); 
+}/*WDI_ProcessAddBAReq*/
+
+
+
+/**
+ @brief Process Trigger BA Request function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTriggerBAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_TriggerBAReqParamsType*  pwdiTriggerBAParams;
+  WDI_TriggerBARspCb           wdiTriggerBARspCb;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*          pBSSSes             = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_uint16                   index;
+  wpt_macAddr                  macBSSID;
+  
+  tTriggerBAReqMsg               halTriggerBAReq;
+  tTriggerBaReqCandidate*        halTriggerBACandidate;
+  WDI_TriggerBAReqCandidateType* wdiTriggerBACandidate;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiTriggerBAParams = (WDI_TriggerBAReqParamsType*)pEventData->pEventData;
+  wdiTriggerBARspCb = (WDI_TriggerBARspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiTriggerBAParams->wdiTriggerBAInfoType.ucSTAIdx, 
+                                  &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                  WDI_TRIGGER_BA_REQ, 
+                  sizeof(halTriggerBAReq.triggerBAParams) +
+                  (sizeof(tTriggerBaReqCandidate) * 
+                  pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt),
+                  &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < 
+            (usDataOffset + sizeof(halTriggerBAReq.triggerBAParams)+
+               (sizeof(tTriggerBaReqCandidate) * 
+               pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in Trigger BA req %x %x %x",
+                pEventData, pwdiTriggerBAParams, wdiTriggerBARspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halTriggerBAReq.triggerBAParams.baSessionID = 
+                  pwdiTriggerBAParams->wdiTriggerBAInfoType.ucBASessionID;
+  halTriggerBAReq.triggerBAParams.baCandidateCnt = 
+                  pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halTriggerBAReq.triggerBAParams, 
+                  sizeof(halTriggerBAReq.triggerBAParams)); 
+
+  wdiTriggerBACandidate = 
+    (WDI_TriggerBAReqCandidateType*)(pwdiTriggerBAParams + 1);
+  halTriggerBACandidate = (tTriggerBaReqCandidate*)(pSendBuffer+usDataOffset+
+                                 sizeof(halTriggerBAReq.triggerBAParams));
+  
+  for(index = 0 ; index < halTriggerBAReq.triggerBAParams.baCandidateCnt ; 
+                                                                     index++)
+  {
+    halTriggerBACandidate->staIdx = wdiTriggerBACandidate->ucSTAIdx;
+    halTriggerBACandidate->tidBitmap = wdiTriggerBACandidate->ucTidBitmap;
+    halTriggerBACandidate++;
+    wdiTriggerBACandidate++;
+  }
+
+  pWDICtx->wdiReqStatusCB     = pwdiTriggerBAParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiTriggerBAParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiTriggerBARspCb, pEventData->pUserData, 
+                        WDI_TRIGGER_BA_RESP); 
+}/*WDI_ProcessTriggerBAReq*/
+
+
+
+/**
+ @brief Process Update Beacon Params  Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateBeaconParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_UpdateBeaconParamsType*  pwdiUpdateBeaconParams;
+  WDI_UpdateBeaconParamsRspCb  wdiUpdateBeaconParamsRspCb;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  tUpdateBeaconParams          halUpdateBeaconParams; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiUpdateBeaconParams = (WDI_UpdateBeaconParamsType*)pEventData->pEventData;
+  wdiUpdateBeaconParamsRspCb = (WDI_UpdateBeaconParamsRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_BCON_PRMS_REQ, 
+                        sizeof(halUpdateBeaconParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halUpdateBeaconParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiUpdateBeaconParams, wdiUpdateBeaconParamsRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*BSS Index of the BSS*/
+  halUpdateBeaconParams.bssIdx =
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucBssIdx;
+  /*shortPreamble mode. HAL should update all the STA rates when it
+    receives this message*/
+  halUpdateBeaconParams.fShortPreamble = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortPreamble;
+  /* short Slot time.*/
+  halUpdateBeaconParams.fShortSlotTime = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortSlotTime;
+  /* Beacon Interval */
+  halUpdateBeaconParams.beaconInterval = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usBeaconInterval;
+
+  /*Protection related */
+  halUpdateBeaconParams.llaCoexist = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllaCoexist;
+  halUpdateBeaconParams.llbCoexist = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllbCoexist;
+  halUpdateBeaconParams.llgCoexist = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllgCoexist;
+  halUpdateBeaconParams.ht20MhzCoexist  = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucHt20MhzCoexist;
+  halUpdateBeaconParams.llnNonGFCoexist = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllnNonGFCoexist;
+  halUpdateBeaconParams.fLsigTXOPProtectionFullSupport = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfLsigTXOPProtectionFullSupport;
+  halUpdateBeaconParams.fRIFSMode =
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfRIFSMode;
+  halUpdateBeaconParams.paramChangeBitmap = 
+    pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usChangeBitmap;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halUpdateBeaconParams, 
+                  sizeof(halUpdateBeaconParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiUpdateBeaconParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiUpdateBeaconParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Del TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateBeaconParamsRspCb, pEventData->pUserData, WDI_UPD_BCON_PRMS_RESP); 
+}/*WDI_ProcessUpdateBeaconParamsReq*/
+
+
+
+/**
+ @brief Process Send Beacon template  Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSendBeaconParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SendBeaconParamsType*    pwdiSendBeaconParams;
+  WDI_SendBeaconParamsRspCb    wdiSendBeaconParamsRspCb;
+  wpt_uint8*                   pSendBuffer         = NULL; 
+  wpt_uint16                   usDataOffset        = 0;
+  wpt_uint16                   usSendSize          = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  tSendBeaconReqMsg            halSendBeaconReq;
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiSendBeaconParams = (WDI_SendBeaconParamsType*)pEventData->pEventData;
+  wdiSendBeaconParamsRspCb   = (WDI_SendBeaconParamsRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SND_BCON_REQ, 
+                        sizeof(halSendBeaconReq.sendBeaconParam),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSendBeaconReq.sendBeaconParam) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in send beacon req %x %x %x",
+                pEventData, pwdiSendBeaconParams, wdiSendBeaconParamsRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halSendBeaconReq.sendBeaconParam.bssId,
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.macBSSID,
+                  WDI_MAC_ADDR_LEN);
+  halSendBeaconReq.sendBeaconParam.beaconLength = 
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beaconLength;
+  wpalMemoryCopy(halSendBeaconReq.sendBeaconParam.beacon,
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beacon,
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beaconLength);
+#ifdef WLAN_SOFTAP_FEATURE
+  halSendBeaconReq.sendBeaconParam.timIeOffset = 
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.timIeOffset;
+#endif
+#ifdef WLAN_FEATURE_P2P
+  halSendBeaconReq.sendBeaconParam.p2pIeOffset = 
+                  pwdiSendBeaconParams->wdiSendBeaconParamsInfo.usP2PIeOffset;
+#endif
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSendBeaconReq.sendBeaconParam, 
+                  sizeof(halSendBeaconReq.sendBeaconParam)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSendBeaconParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSendBeaconParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Del TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSendBeaconParamsRspCb, pEventData->pUserData, WDI_SND_BCON_RESP); 
+}/*WDI_ProcessSendBeaconParamsReq*/
+
+/**
+ @brief Process Update Beacon Params  Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateProbeRspTemplateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_UpdateProbeRspTemplateParamsType*  pwdiUpdateProbeRespTmplParams;
+  WDI_UpdateProbeRspTemplateRspCb        wdiUpdateProbeRespTmplRspCb;
+  wpt_uint8*                             pSendBuffer         = NULL; 
+  wpt_uint16                             usDataOffset        = 0;
+  wpt_uint16                             usSendSize          = 0;
+  tSendProbeRespReqParams                halUpdateProbeRspTmplParams; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiUpdateProbeRespTmplParams = 
+    (WDI_UpdateProbeRspTemplateParamsType*)pEventData->pEventData;
+  wdiUpdateProbeRespTmplRspCb = 
+    (WDI_UpdateProbeRspTemplateRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_PROBE_RSP_TEMPLATE_REQ, 
+                        sizeof(halUpdateProbeRspTmplParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halUpdateProbeRspTmplParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+     pEventData, pwdiUpdateProbeRespTmplParams, wdiUpdateProbeRespTmplRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halUpdateProbeRspTmplParams.bssId,
+                 pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.macBSSID, 
+                 WDI_MAC_ADDR_LEN);
+
+  halUpdateProbeRspTmplParams.probeRespTemplateLen = 
+    pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.uProbeRespTemplateLen;
+
+  wpalMemoryCopy(halUpdateProbeRspTmplParams.pProbeRespTemplate,
+    pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.pProbeRespTemplate,
+                 BEACON_TEMPLATE_SIZE);     
+
+
+  wpalMemoryCopy(halUpdateProbeRspTmplParams.ucProxyProbeReqValidIEBmap,
+           pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.uaProxyProbeReqValidIEBmap,
+                 WDI_PROBE_REQ_BITMAP_IE_LEN);
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halUpdateProbeRspTmplParams, 
+                  sizeof(halUpdateProbeRspTmplParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiUpdateProbeRespTmplParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiUpdateProbeRespTmplParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Update Probe Resp Template Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateProbeRespTmplRspCb, pEventData->pUserData, 
+                       WDI_UPD_PROBE_RSP_TEMPLATE_RESP); 
+}/*WDI_ProcessUpdateProbeRspTemplateReq*/
+
+/**
+ @brief Process NV blob download function (called when Main FSM 
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessNvDownloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  WDI_NvDownloadReqParamsType*  pwdiNvDownloadReqParams = NULL;
+  WDI_NvDownloadRspCb      wdiNvDownloadRspCb = NULL;
+
+  /*-------------------------------------------------------------------------
+     Sanity check       
+   -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiNvDownloadReqParams = 
+                 (WDI_NvDownloadReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiNvDownloadRspCb = 
+                (WDI_NvDownloadRspCb)pEventData->pCBfnc)))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*Intialize the Nv Blob Info */
+  pWDICtx->wdiNvBlobInfo.usTotalFragment = 
+                TOTALFRAGMENTS(pwdiNvDownloadReqParams->wdiBlobInfo.uBlobSize);
+
+  /*cache the wdi nv request message here if the the first fragment
+   * To issue the request to HAL for the next fragment */
+  if( 0 == pWDICtx->wdiNvBlobInfo.usCurrentFragment)
+  {
+    wpalMemoryCopy(&pWDICtx->wdiCachedNvDownloadReq, 
+                 pwdiNvDownloadReqParams, 
+                 sizeof(pWDICtx->wdiCachedNvDownloadReq)); 
+
+    pWDICtx->pfncRspCB = pEventData->pCBfnc;
+    pWDICtx->pRspCBUserData = pEventData->pUserData;
+  }
+
+  return WDI_SendNvBlobReq(pWDICtx,pEventData);
+}
+
+/**
+ @brief Process Set Max Tx Power Request function (called when Main    
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_ProcessSetMaxTxPowerReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetMaxTxPowerParamsType*      pwdiSetMaxTxPowerParams = NULL;
+  WDA_SetMaxTxPowerRspCb            wdiSetMaxTxPowerRspCb;
+  wpt_uint8*                        pSendBuffer         = NULL; 
+  wpt_uint16                        usDataOffset        = 0;
+  wpt_uint16                        usSendSize          = 0;
+  tSetMaxTxPwrReq                   halSetMaxTxPower;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  pwdiSetMaxTxPowerParams = 
+    (WDI_SetMaxTxPowerParamsType*)pEventData->pEventData;
+  wdiSetMaxTxPowerRspCb = 
+    (WDA_SetMaxTxPowerRspCb)pEventData->pCBfnc;
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_MAX_TX_POWER_REQ, 
+                        sizeof(halSetMaxTxPower.setMaxTxPwrParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSetMaxTxPower.setMaxTxPwrParams) 
+)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Unable to get Set Max Tx Power req %x %x %x",
+                pEventData, pwdiSetMaxTxPowerParams, wdiSetMaxTxPowerRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy(halSetMaxTxPower.setMaxTxPwrParams.bssId,
+                  pwdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macBSSId,
+                  WDI_MAC_ADDR_LEN);
+
+  wpalMemoryCopy(halSetMaxTxPower.setMaxTxPwrParams.selfStaMacAddr,
+                  pwdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macSelfStaMacAddr,
+                  WDI_MAC_ADDR_LEN);
+  halSetMaxTxPower.setMaxTxPwrParams.power = 
+                  pwdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.ucPower;
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSetMaxTxPower.setMaxTxPwrParams, 
+                  sizeof(halSetMaxTxPower.setMaxTxPwrParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetMaxTxPowerParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetMaxTxPowerParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Del TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetMaxTxPowerRspCb, pEventData->pUserData, 
+                                                      WDI_SET_MAX_TX_POWER_RESP); 
+  
+}
+
+#ifdef WLAN_FEATURE_P2P
+
+/**
+ @brief Process P2P Notice Of Absence Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2PGONOAReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetP2PGONOAReqParamsType*          pwdiP2PGONOAReqParams;
+  WDI_SetP2PGONOAReqParamsRspCb          wdiP2PGONOAReqRspCb;
+  wpt_uint8*                             pSendBuffer         = NULL; 
+  wpt_uint16                             usDataOffset        = 0;
+  wpt_uint16                             usSendSize          = 0;
+  tSetP2PGONOAParams                     halSetP2PGONOAParams; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiP2PGONOAReqParams = 
+    (WDI_SetP2PGONOAReqParamsType*)pEventData->pEventData;
+  wdiP2PGONOAReqRspCb = 
+    (WDI_SetP2PGONOAReqParamsRspCb)pEventData->pCBfnc;
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ, 
+                        sizeof(halSetP2PGONOAParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halSetP2PGONOAParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set P2P GO NOA REQ %x %x %x",
+     pEventData, pwdiP2PGONOAReqParams, wdiP2PGONOAReqRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halSetP2PGONOAParams.opp_ps = 
+                           pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucOpp_ps;
+  halSetP2PGONOAParams.ctWindow = 
+                           pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uCtWindow;
+  halSetP2PGONOAParams.count = pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucCount;
+  halSetP2PGONOAParams.duration = 
+                           pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uDuration;
+  halSetP2PGONOAParams.interval = 
+                           pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uInterval;
+  halSetP2PGONOAParams.single_noa_duration = 
+                 pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uSingle_noa_duration;
+  halSetP2PGONOAParams.psSelection = 
+                   pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucPsSelection;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSetP2PGONOAParams, 
+                  sizeof(halSetP2PGONOAParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiP2PGONOAReqParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiP2PGONOAReqParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Update Probe Resp Template Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiP2PGONOAReqRspCb, pEventData->pUserData, 
+                       WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP); 
+}/*WDI_ProcessP2PGONOAReq*/
+
+#endif
+
+
+/**
+ @brief    Function to handle the ack from DXE once the power 
+           state is set.
+ @param    None 
+    
+ @see 
+ @return void 
+*/
+void
+WDI_SetPowerStateCb
+(
+   wpt_status status,
+   unsigned int dxePhyAddr,
+   void      *pContext
+)
+{
+   wpt_status              wptStatus;
+   WDI_ControlBlockType *pCB = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+   if(eWLAN_PAL_STATUS_E_FAILURE == status )
+   {
+      //it shouldn't happen, put an error msg
+   }
+   /* 
+    * Trigger the event to bring the Enter BMPS req function to come 
+    * out of wait 
+*/
+   if( NULL != pContext )
+   {
+      pCB = (WDI_ControlBlockType *)pContext; 
+   }
+   else
+   {
+      //put an error msg 
+      pCB = &gWDICb;
+   }
+   pCB->dxePhyAddr = dxePhyAddr;
+   wptStatus  = wpalEventSet(&pCB->setPowerStateEvent);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "Failed to set an event");
+
+      WDI_ASSERT(0); 
+   }
+   return;
+}
+
+
+/**
+ @brief Process Enter IMPS Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterImpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_EnterImpsRspCb       wdiEnterImpsRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (wdiEnterImpsRspCb   = (WDI_EnterImpsRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_IMPS_REQ, 
+                                                     0,
+                                                     &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Enter IMPS req %x %x",
+                 pEventData, wdiEnterImpsRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /* Reset the event to be not signalled */
+   if(WDI_STATUS_SUCCESS != wpalEventReset(&pWDICtx->setPowerStateEvent) )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Init failed to reset an event");
+
+      WDI_ASSERT(0); 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   // notify DTS that we are entering IMPS
+   WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_IMPS, WDI_SetPowerStateCb);
+
+   /*
+    * Wait for the event to be set once the ACK comes back from DXE 
+    */
+   if(WDI_STATUS_SUCCESS != wpalEventWait(&pWDICtx->setPowerStateEvent, 
+                                          WDI_SET_POWER_STATE_TIMEOUT))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Init failed to wait on an event");
+
+      WDI_ASSERT(0); 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterImpsRspCb, pEventData->pUserData, WDI_ENTER_IMPS_RESP); 
+}/*WDI_ProcessEnterImpsReq*/
+
+/**
+ @brief Process Exit IMPS Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitImpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_ExitImpsRspCb        wdiExitImpsRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (wdiExitImpsRspCb   = (WDI_ExitImpsRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_IMPS_REQ, 
+                                                     0,
+                                                     &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Exit IMPS req %x %x",
+                 pEventData, wdiExitImpsRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitImpsRspCb, pEventData->pUserData, WDI_EXIT_IMPS_RESP); 
+}/*WDI_ProcessExitImpsReq*/
+
+/**
+ @brief Process Enter BMPS Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterBmpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_EnterBmpsReqParamsType*  pwdiEnterBmpsReqParams = NULL;
+   WDI_EnterBmpsRspCb           wdiEnterBmpsRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalEnterBmpsReqParams   enterBmpsReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+     Sanity check 
+  -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiEnterBmpsReqParams = (WDI_EnterBmpsReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiEnterBmpsRspCb   = (WDI_EnterBmpsRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_BMPS_REQ, 
+                         sizeof(enterBmpsReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(enterBmpsReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Enter BMPS req %x %x %x",
+                 pEventData, pwdiEnterBmpsReqParams, wdiEnterBmpsRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /* Reset the event to be not signalled */
+   if(WDI_STATUS_SUCCESS != wpalEventReset(&pWDICtx->setPowerStateEvent) )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Init failed to reset an event");
+
+      WDI_ASSERT(0); 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   // notify DTS that we are entering BMPS
+   WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_BMPS, WDI_SetPowerStateCb);
+
+/*
+    * Wait for the event to be set once the ACK comes back from DXE 
+    */
+   if(WDI_STATUS_SUCCESS != wpalEventWait(&pWDICtx->setPowerStateEvent, 
+                                          WDI_SET_POWER_STATE_TIMEOUT))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "WDI Init failed to wait on an event");
+
+      WDI_ASSERT(0); 
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   pWDICtx->bInBmps = eWLAN_PAL_TRUE;
+
+   enterBmpsReq.bssIdx = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucBssIdx;
+   enterBmpsReq.tbtt = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.uTbtt;
+   enterBmpsReq.dtimCount = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimCount;
+   enterBmpsReq.dtimPeriod = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimPeriod;
+
+   // For CCX and 11R Roaming
+   enterBmpsReq.rssiFilterPeriod = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.rssiFilterPeriod;
+   enterBmpsReq.numBeaconPerRssiAverage = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.numBeaconPerRssiAverage;
+   enterBmpsReq.bRssiFilterEnable = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.bRssiFilterEnable;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &enterBmpsReq, 
+                   sizeof(enterBmpsReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiEnterBmpsReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiEnterBmpsReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterBmpsRspCb, pEventData->pUserData, WDI_ENTER_BMPS_RESP); 
+}/*WDI_ProcessEnterBmpsReq*/
+
+/**
+ @brief Process Exit BMPS Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitBmpsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_ExitBmpsReqParamsType*  pwdiExitBmpsReqParams = NULL;
+   WDI_ExitBmpsRspCb           wdiExitBmpsRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalExitBmpsReqParams    exitBmpsReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiExitBmpsReqParams = (WDI_ExitBmpsReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiExitBmpsRspCb   = (WDI_ExitBmpsRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_BMPS_REQ, 
+                         sizeof(exitBmpsReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(exitBmpsReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Exit BMPS req %x %x %x",
+                 pEventData, pwdiExitBmpsReqParams, wdiExitBmpsRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+   exitBmpsReq.sendDataNull = pwdiExitBmpsReqParams->wdiExitBmpsInfo.ucSendDataNull;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &exitBmpsReq, 
+                   sizeof(exitBmpsReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiExitBmpsReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiExitBmpsReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitBmpsRspCb, pEventData->pUserData, WDI_EXIT_BMPS_RESP); 
+}/*WDI_ProcessExitBmpsReq*/
+
+/**
+ @brief Process Enter UAPSD Request function (called when Main 
+        FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterUapsdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_EnterUapsdReqParamsType*  pwdiEnterUapsdReqParams = NULL;
+   WDI_EnterUapsdRspCb           wdiEnterUapsdRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tUapsdReqParams          enterUapsdReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiEnterUapsdReqParams = (WDI_EnterUapsdReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiEnterUapsdRspCb   = (WDI_EnterUapsdRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_UAPSD_REQ, 
+                         sizeof(enterUapsdReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(enterUapsdReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Enter UAPSD req %x %x %x",
+                 pEventData, pwdiEnterUapsdReqParams, wdiEnterUapsdRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   enterUapsdReq.beDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeDeliveryEnabled;
+   enterUapsdReq.beTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeTriggerEnabled;
+   enterUapsdReq.bkDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBkDeliveryEnabled;
+   enterUapsdReq.bkTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBkTriggerEnabled;
+   enterUapsdReq.viDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucViDeliveryEnabled;
+   enterUapsdReq.viTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucViTriggerEnabled;
+   enterUapsdReq.voDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoDeliveryEnabled;
+   enterUapsdReq.voTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoTriggerEnabled;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &enterUapsdReq, 
+                   sizeof(enterUapsdReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiEnterUapsdReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiEnterUapsdReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterUapsdRspCb, pEventData->pUserData, WDI_ENTER_UAPSD_RESP); 
+}/*WDI_ProcessEnterUapsdReq*/
+
+/**
+ @brief Process Exit UAPSD Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitUapsdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_ExitUapsdRspCb       wdiExitUapsdRspCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (wdiExitUapsdRspCb   = (WDI_ExitUapsdRspCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_UAPSD_REQ, 
+                                                     0,
+                                                     &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Exit UAPSD req %x %x",
+                 pEventData, wdiExitUapsdRspCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitUapsdRspCb, pEventData->pUserData, WDI_EXIT_UAPSD_RESP); 
+}/*WDI_ProcessExitUapsdReq*/
+
+/**
+ @brief Process Set UAPSD params Request function (called when 
+        Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetUapsdAcParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SetUapsdAcParamsReqParamsType*  pwdiSetUapsdAcParams = NULL;
+  WDI_SetUapsdAcParamsCb              wdiSetUapsdAcParamsCb = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  tUapsdInfo               uapsdAcParamsReq;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiSetUapsdAcParams = (WDI_SetUapsdAcParamsReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiSetUapsdAcParamsCb   = (WDI_SetUapsdAcParamsCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_UAPSD_PARAM_REQ, 
+                        sizeof(uapsdAcParamsReq),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(uapsdAcParamsReq) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in Set UAPSD params req %x %x %x",
+                pEventData, pwdiSetUapsdAcParams, wdiSetUapsdAcParamsCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  uapsdAcParamsReq.ac = pwdiSetUapsdAcParams->wdiUapsdInfo.ucAc;
+  uapsdAcParamsReq.staidx = pwdiSetUapsdAcParams->wdiUapsdInfo.ucSTAIdx;
+  uapsdAcParamsReq.up = pwdiSetUapsdAcParams->wdiUapsdInfo.ucUp;
+  uapsdAcParamsReq.delayInterval = pwdiSetUapsdAcParams->wdiUapsdInfo.uDelayInterval;
+  uapsdAcParamsReq.srvInterval = pwdiSetUapsdAcParams->wdiUapsdInfo.uSrvInterval;
+  uapsdAcParamsReq.susInterval = pwdiSetUapsdAcParams->wdiUapsdInfo.uSusInterval;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &uapsdAcParamsReq, 
+                  sizeof(uapsdAcParamsReq)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiSetUapsdAcParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiSetUapsdAcParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Get STA Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetUapsdAcParamsCb, pEventData->pUserData, WDI_SET_UAPSD_PARAM_RESP); 
+}/*WDI_ProcessSetUapsdAcParamsReq*/
+
+/**
+ @brief Process update UAPSD params Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateUapsdParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_UpdateUapsdReqParamsType*  pwdiUpdateUapsdReqParams = NULL;
+   WDI_UpdateUapsdParamsCb        wdiUpdateUapsdParamsCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiUpdateUapsdReqParams = (WDI_UpdateUapsdReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiUpdateUapsdParamsCb   = (WDI_UpdateUapsdParamsCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_UAPSD_PARAM_REQ, 
+                         sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Update UAPSD params req %x %x %x",
+                 pEventData, pwdiUpdateUapsdReqParams, wdiUpdateUapsdParamsCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo, 
+                   sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiUpdateUapsdReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiUpdateUapsdReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiUpdateUapsdParamsCb, pEventData->pUserData, WDI_UPDATE_UAPSD_PARAM_RESP); 
+}/*WDI_ProcessUpdateUapsdParamsReq*/
+
+/**
+ @brief Process Configure RXP filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureRxpFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ConfigureRxpFilterReqParamsType*  pwdiRxpFilterParams = NULL;
+  WDI_ConfigureRxpFilterCb              wdiConfigureRxpFilterCb = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  tHalConfigureRxpFilterReqParams     halRxpFilterParams;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == (pwdiRxpFilterParams = (WDI_ConfigureRxpFilterReqParamsType*)pEventData->pEventData)) ||
+      ( NULL == (wdiConfigureRxpFilterCb   = (WDI_ConfigureRxpFilterCb)pEventData->pCBfnc)))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_RXP_FILTER_REQ, 
+                        sizeof(halRxpFilterParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(halRxpFilterParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in Set UAPSD params req %x %x %x",
+                pEventData, pwdiRxpFilterParams, wdiConfigureRxpFilterCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halRxpFilterParams.setMcstBcstFilterSetting = 
+      pwdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilterSetting;
+  halRxpFilterParams.setMcstBcstFilter = 
+      pwdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilter;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halRxpFilterParams, 
+                  sizeof(halRxpFilterParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiRxpFilterParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiRxpFilterParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Get STA Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigureRxpFilterCb, pEventData->pUserData, WDI_CONFIGURE_RXP_FILTER_RESP); 
+}/*WDI_ProcessConfigureRxpFilterReq*/
+
+/**
+ @brief Process set beacon filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBeaconFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_BeaconFilterReqParamsType*  pwdiBeaconFilterParams = NULL;
+   WDI_SetBeaconFilterCb           wdiBeaconFilterCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiBeaconFilterParams = (WDI_BeaconFilterReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiBeaconFilterCb   = (WDI_SetBeaconFilterCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BEACON_FILTER_REQ, 
+                         sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) + pwdiBeaconFilterParams->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Set beacon filter req %x %x %x",
+                 pEventData, pwdiBeaconFilterParams, wdiBeaconFilterCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo, 
+                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo)); 
+   wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo), 
+                   &pwdiBeaconFilterParams->aFilters[0], 
+                   pwdiBeaconFilterParams->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiBeaconFilterParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBeaconFilterCb, pEventData->pUserData, WDI_SET_BEACON_FILTER_RESP); 
+}/*WDI_ProcessSetBeaconFilterReq*/
+
+/**
+ @brief Process remove beacon filter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemBeaconFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_RemBeaconFilterReqParamsType*  pwdiBeaconFilterParams = NULL;
+   WDI_RemBeaconFilterCb              wdiBeaconFilterCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiBeaconFilterParams = (WDI_RemBeaconFilterReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiBeaconFilterCb   = (WDI_RemBeaconFilterCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_REM_BEACON_FILTER_REQ, 
+                         sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in remove beacon filter req %x %x %x",
+                  pEventData, pwdiBeaconFilterParams, wdiBeaconFilterCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo, 
+                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiBeaconFilterParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBeaconFilterCb, pEventData->pUserData, WDI_REM_BEACON_FILTER_RESP); 
+}
+
+/**
+ @brief Process set RSSI thresholds Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRSSIThresholdsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetRSSIThresholdsReqParamsType*  pwdiRSSIThresholdsParams = NULL;
+   WDI_SetRSSIThresholdsCb              wdiRSSIThresholdsCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalRSSIThresholds       rssiThresholdsReq;
+   WDI_Status               ret_status = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiRSSIThresholdsParams = (WDI_SetRSSIThresholdsReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiRSSIThresholdsCb   = (WDI_SetRSSIThresholdsCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_RSSI_THRESHOLDS_REQ, 
+                         sizeof(rssiThresholdsReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(rssiThresholdsReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in remove beacon filter req %x %x %x",
+                  pEventData, pwdiRSSIThresholdsParams, wdiRSSIThresholdsCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   rssiThresholdsReq.bReserved10 = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bReserved10;
+   rssiThresholdsReq.bRssiThres1NegNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres1NegNotify;
+   rssiThresholdsReq.bRssiThres1PosNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres1PosNotify;
+   rssiThresholdsReq.bRssiThres2NegNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres2NegNotify;
+   rssiThresholdsReq.bRssiThres2PosNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres2PosNotify;
+   rssiThresholdsReq.bRssiThres3NegNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres3NegNotify;
+   rssiThresholdsReq.bRssiThres3PosNotify = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres3PosNotify;
+   rssiThresholdsReq.ucRssiThreshold1 = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold1;
+   rssiThresholdsReq.ucRssiThreshold2 = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold2;
+   rssiThresholdsReq.ucRssiThreshold3 = 
+      pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold3;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &rssiThresholdsReq, 
+                   sizeof(rssiThresholdsReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiRSSIThresholdsParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiRSSIThresholdsParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Set threshold req to HAL 
+   -------------------------------------------------------------------------*/
+   if ((ret_status = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiRSSIThresholdsCb, pEventData->pUserData, WDI_SET_RSSI_THRESHOLDS_RESP)) == WDI_STATUS_SUCCESS)
+   {
+      // When we are in idle state WDI_STARTED_ST and we receive indication for threshold
+      // req. Then as a result of processing the threshold cross ind, we trigger
+      // a Set threshold req, then we need to indicate to WDI that it needs to 
+      // go to busy state as a result of the indication as we sent a req in the 
+      // same WDI context.
+      // Hence expected state transition is to busy.
+      pWDICtx->ucExpectedStateTransition =  WDI_BUSY_ST;
+   }
+
+   return ret_status;
+}
+
+/**
+ @brief Process set RSSI thresholds Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostOffloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_HostOffloadReqParamsType*  pwdiHostOffloadParams = NULL;
+   WDI_HostOffloadCb              wdiHostOffloadCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalHostOffloadReq       hostOffloadParams;
+   tHalNSOffloadParams      nsOffloadParams;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiHostOffloadParams = (WDI_HostOffloadReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiHostOffloadCb   = (WDI_HostOffloadCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HOST_OFFLOAD_REQ, 
+                         sizeof(hostOffloadParams)+sizeof(nsOffloadParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(hostOffloadParams) + sizeof(nsOffloadParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in host offload req %x %x %x",
+                  pEventData, pwdiHostOffloadParams, wdiHostOffloadCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   hostOffloadParams.offloadType = pwdiHostOffloadParams->wdiHostOffloadInfo.ucOffloadType;
+   hostOffloadParams.enableOrDisable = pwdiHostOffloadParams->wdiHostOffloadInfo.ucEnableOrDisable;
+   if( HAL_IPV4_ARP_REPLY_OFFLOAD == hostOffloadParams.offloadType )
+   {
+      // ARP Offload
+      wpalMemoryCopy(hostOffloadParams.params.hostIpv4Addr,
+                     pwdiHostOffloadParams->wdiHostOffloadInfo.params.aHostIpv4Addr,
+                     4);
+   }
+   else
+   {
+      // NS Offload
+      wpalMemoryCopy(hostOffloadParams.params.hostIpv6Addr,
+                     pwdiHostOffloadParams->wdiHostOffloadInfo.params.aHostIpv6Addr,
+                     16);
+
+#ifdef WLAN_NS_OFFLOAD
+        // copy pwdiHostOffloadParams->wdiNsOffloadParams into nsOffloadParams
+        wpalMemoryCopy(nsOffloadParams.srcIPv6Addr,
+                        pwdiHostOffloadParams->wdiNsOffloadParams.srcIPv6Addr,
+                        16);
+        wpalMemoryCopy(nsOffloadParams.selfIPv6Addr,
+                        pwdiHostOffloadParams->wdiNsOffloadParams.selfIPv6Addr,
+                        16);
+        wpalMemoryCopy(nsOffloadParams.targetIPv6Addr1,
+                        pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr1,
+                        16);
+        wpalMemoryCopy(nsOffloadParams.targetIPv6Addr2,
+                        pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr2,
+                        16);
+        wpalMemoryCopy(nsOffloadParams.selfMacAddr,
+                        pwdiHostOffloadParams->wdiNsOffloadParams.selfMacAddr,
+                        6);
+        nsOffloadParams.srcIPv6AddrValid = pwdiHostOffloadParams->wdiNsOffloadParams.srcIPv6AddrValid;
+        nsOffloadParams.targetIPv6Addr1Valid = pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr1Valid;
+        nsOffloadParams.targetIPv6Addr2Valid = pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr2Valid;
+#endif // WLAN_NS_OFFLOAD
+   }
+
+   // copy hostOffloadParams into pSendBuffer
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &hostOffloadParams, 
+                   sizeof(hostOffloadParams)); 
+
+#ifdef WLAN_NS_OFFLOAD
+   if( HAL_IPV6_NS_OFFLOAD == hostOffloadParams.offloadType )
+   {
+       // copy nsOffloadParams into pSendBuffer
+       wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(hostOffloadParams), 
+                       &nsOffloadParams, 
+                       sizeof(nsOffloadParams)); 
+   }
+#endif // WLAN_NS_OFFLOAD
+
+   pWDICtx->wdiReqStatusCB     = pwdiHostOffloadParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiHostOffloadParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHostOffloadCb, pEventData->pUserData, WDI_HOST_OFFLOAD_RESP); 
+}/*WDI_ProcessHostOffloadReq*/
+
+/**
+ @brief Process Keep Alive Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessKeepAliveReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_KeepAliveReqParamsType*  pwdiKeepAliveParams = NULL;
+   WDI_KeepAliveCb              wdiKeepAliveCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalKeepAliveReq         keepAliveReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiKeepAliveParams = (WDI_KeepAliveReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiKeepAliveCb   = (WDI_KeepAliveCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Invalid parameters in Keep Alive req");
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_KEEP_ALIVE_REQ, 
+                         sizeof(keepAliveReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(keepAliveReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "Unable to get send buffer in keep alive req %x %x %x",
+                  pEventData, pwdiKeepAliveParams, wdiKeepAliveCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   keepAliveReq.packetType = pwdiKeepAliveParams->wdiKeepAliveInfo.ucPacketType;
+   keepAliveReq.timePeriod = pwdiKeepAliveParams->wdiKeepAliveInfo.ucTimePeriod;
+
+   if(pwdiKeepAliveParams->wdiKeepAliveInfo.ucPacketType == 2)
+   {
+   wpalMemoryCopy(keepAliveReq.hostIpv4Addr,
+                     pwdiKeepAliveParams->wdiKeepAliveInfo.aHostIpv4Addr,
+                     HAL_IPV4_ADDR_LEN);
+   wpalMemoryCopy(keepAliveReq.destIpv4Addr,
+                     pwdiKeepAliveParams->wdiKeepAliveInfo.aDestIpv4Addr,
+                     HAL_IPV4_ADDR_LEN);   
+   wpalMemoryCopy(keepAliveReq.destMacAddr,
+                     pwdiKeepAliveParams->wdiKeepAliveInfo.aDestMacAddr,
+                     HAL_MAC_ADDR_LEN);
+   }
+      
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &keepAliveReq, 
+                   sizeof(keepAliveReq)); 
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+               "Process keep alive req %d",sizeof(keepAliveReq));
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+               "Process keep alive req time period %d",keepAliveReq.timePeriod);
+
+   pWDICtx->wdiReqStatusCB     = pwdiKeepAliveParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiKeepAliveParams->pUserData; 
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+                  "Sending keep alive req to HAL");
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiKeepAliveCb, pEventData->pUserData, WDI_KEEP_ALIVE_RESP); 
+}/*WDI_ProcessKeepAliveReq*/
+
+
+/**
+ @brief Process Wowl add bc ptrn Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlAddBcPtrnReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_WowlAddBcPtrnReqParamsType*  pwdiWowlAddBcPtrnParams = NULL;
+   WDI_WowlAddBcPtrnCb              wdiWowlAddBcPtrnCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalWowlAddBcastPtrn     wowlAddBcPtrnReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiWowlAddBcPtrnParams = (WDI_WowlAddBcPtrnReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiWowlAddBcPtrnCb   = (WDI_WowlAddBcPtrnCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ADD_BC_PTRN_REQ, 
+                         sizeof(wowlAddBcPtrnReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(wowlAddBcPtrnReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Wowl add bc ptrn req %x %x %x",
+                  pEventData, pwdiWowlAddBcPtrnParams, wdiWowlAddBcPtrnCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wowlAddBcPtrnReq.ucPatternId = 
+      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternId;
+   wowlAddBcPtrnReq.ucPatternByteOffset = 
+      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternByteOffset;
+   wowlAddBcPtrnReq.ucPatternMaskSize = 
+      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize;
+   wowlAddBcPtrnReq.ucPatternSize = 
+      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternSize;
+
+   if (pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternSize <= HAL_WOWL_BCAST_PATTERN_MAX_SIZE)
+   {
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPattern,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPattern,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternSize);
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPatternMask,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMask,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize);
+   }
+   else
+   {
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPattern,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPattern,
+                      HAL_WOWL_BCAST_PATTERN_MAX_SIZE);
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPatternMask,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMask,
+                      HAL_WOWL_BCAST_PATTERN_MAX_SIZE);
+
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPattern,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPattern,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize - HAL_WOWL_BCAST_PATTERN_MAX_SIZE);
+       wpalMemoryCopy(wowlAddBcPtrnReq.ucPatternMask,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMask,
+                      pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize - HAL_WOWL_BCAST_PATTERN_MAX_SIZE);
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlAddBcPtrnReq, 
+                   sizeof(wowlAddBcPtrnReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiWowlAddBcPtrnParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiWowlAddBcPtrnParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlAddBcPtrnCb, pEventData->pUserData, WDI_WOWL_ADD_BC_PTRN_RESP); 
+}/*WDI_ProcessWowlAddBcPtrnReq*/
+
+/**
+ @brief Process Wowl delete bc ptrn Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlDelBcPtrnReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_WowlDelBcPtrnReqParamsType*  pwdiWowlDelBcPtrnParams = NULL;
+   WDI_WowlDelBcPtrnCb              wdiWowlDelBcPtrnCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalWowlDelBcastPtrn     wowlDelBcPtrnReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiWowlDelBcPtrnParams = (WDI_WowlDelBcPtrnReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiWowlDelBcPtrnCb   = (WDI_WowlDelBcPtrnCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_DEL_BC_PTRN_REQ, 
+                         sizeof(wowlDelBcPtrnReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(wowlDelBcPtrnReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Wowl del bc ptrn req %x %x %x",
+                  pEventData, pwdiWowlDelBcPtrnParams, wdiWowlDelBcPtrnCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wowlDelBcPtrnReq.ucPatternId = 
+      pwdiWowlDelBcPtrnParams->wdiWowlDelBcPtrnInfo.ucPatternId;
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlDelBcPtrnReq, 
+                   sizeof(wowlDelBcPtrnReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiWowlDelBcPtrnParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiWowlDelBcPtrnParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlDelBcPtrnCb, pEventData->pUserData, WDI_WOWL_DEL_BC_PTRN_RESP); 
+}/*WDI_ProcessWowlDelBcPtrnReq*/
+
+/**
+ @brief Process Wowl enter Request function (called 
+        when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlEnterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_WowlEnterReqParamsType*  pwdiWowlEnterParams = NULL;
+   WDI_WowlEnterReqCb           wdiWowlEnterCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalWowlEnterParams      wowlEnterReq;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiWowlEnterParams = (WDI_WowlEnterReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiWowlEnterCb   = (WDI_WowlEnterReqCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ENTER_REQ, 
+                         sizeof(wowlEnterReq),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(wowlEnterReq) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Wowl enter req %x %x %x",
+                  pEventData, pwdiWowlEnterParams, wdiWowlEnterCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wowlEnterReq.ucMagicPktEnable = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucMagicPktEnable;
+   wowlEnterReq.ucPatternFilteringEnable = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucPatternFilteringEnable;
+   wowlEnterReq.ucUcastPatternFilteringEnable = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucUcastPatternFilteringEnable;
+   wowlEnterReq.ucWowChnlSwitchRcv = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowChnlSwitchRcv;
+   wowlEnterReq.ucWowDeauthRcv = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowDeauthRcv;
+   wowlEnterReq.ucWowDisassocRcv = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowDisassocRcv;
+   wowlEnterReq.ucWowMaxMissedBeacons = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowMaxMissedBeacons;
+   wowlEnterReq.ucWowMaxSleepUsec = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowMaxSleepUsec;
+
+#ifdef WLAN_WAKEUP_EVENTS
+   wowlEnterReq.ucWoWEAPIDRequestEnable = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWEAPIDRequestEnable;
+
+   wowlEnterReq.ucWoWEAPOL4WayEnable =
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWEAPOL4WayEnable;
+
+   wowlEnterReq.ucWowNetScanOffloadMatch = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowNetScanOffloadMatch;
+
+   wowlEnterReq.ucWowGTKRekeyError = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowGTKRekeyError;
+
+   wowlEnterReq.ucWoWBSSConnLoss = 
+      pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWBSSConnLoss;
+#endif // WLAN_WAKEUP_EVENTS
+
+   wpalMemoryCopy(wowlEnterReq.magicPtrn,
+                  pwdiWowlEnterParams->wdiWowlEnterInfo.magicPtrn,
+                  sizeof(tSirMacAddr));
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlEnterReq, 
+                   sizeof(wowlEnterReq)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiWowlEnterParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiWowlEnterParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlEnterCb, pEventData->pUserData, WDI_WOWL_ENTER_RESP); 
+}/*WDI_ProcessWowlEnterReq*/
+
+/**
+ @brief Process Wowl exit Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlExitReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_WowlExitReqCb           wdiWowlExitCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (wdiWowlExitCb   = (WDI_WowlExitReqCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+     ! TO DO : proper conversion into the HAL Message Request Format 
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_EXIT_REQ, 
+                                                     0,
+                                                     &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Wowl Exit req %x %x",
+                 pEventData, wdiWowlExitCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlExitCb, pEventData->pUserData, WDI_WOWL_EXIT_RESP); 
+}/*WDI_ProcessWowlExitReq*/
+
+/**
+ @brief Process Configure Apps Cpu Wakeup State Request function
+        (called when Main FSM allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureAppsCpuWakeupStateReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_ConfigureAppsCpuWakeupStateReqParamsType*  pwdiAppsCpuWakeupStateParams = NULL;
+   WDI_ConfigureAppsCpuWakeupStateCb              wdiConfigureAppsCpuWakeupStateCb = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
+   wpt_uint16               usDataOffset        = 0;
+   wpt_uint16               usSendSize          = 0;
+   tHalConfigureAppsCpuWakeupStateReqParams  halCfgAppsCpuWakeupStateReqParams;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiAppsCpuWakeupStateParams = (WDI_ConfigureAppsCpuWakeupStateReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiConfigureAppsCpuWakeupStateCb   = (WDI_ConfigureAppsCpuWakeupStateCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ, 
+                         sizeof(halCfgAppsCpuWakeupStateReqParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pwdiAppsCpuWakeupStateParams->bIsAppsAwake) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+               "Unable to get send buffer in Apps CPU Wakeup State req %x %x %x",
+                 pEventData, pwdiAppsCpuWakeupStateParams, wdiConfigureAppsCpuWakeupStateCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   halCfgAppsCpuWakeupStateReqParams.isAppsCpuAwake = 
+                           pwdiAppsCpuWakeupStateParams->bIsAppsAwake;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halCfgAppsCpuWakeupStateReqParams, 
+                   sizeof(halCfgAppsCpuWakeupStateReqParams)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiAppsCpuWakeupStateParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiAppsCpuWakeupStateParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiConfigureAppsCpuWakeupStateCb, pEventData->pUserData, 
+                        WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP); 
+}/*WDI_ProcessConfigureAppsCpuWakeupStateReq*/
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/**
+ @brief Process Aggregated Add TSpec Request function (called when Main FSM
+        allows it)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAggrAddTSpecReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AggrAddTSReqParamsType*  pwdiAggrAddTSParams;
+  WDI_AggrAddTsRspCb           wdiAggrAddTSRspCb;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*      pBSSSes             = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
+  wpt_macAddr              macBSSID;
+  tAggrAddTsReq            halAggrAddTsReq;
+  int i;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  wpalMemoryFill( &halAggrAddTsReq, sizeof(tAggrAddTsReq), 0 );
+  pwdiAggrAddTSParams = (WDI_AggrAddTSReqParamsType*)pEventData->pEventData;
+  wdiAggrAddTSRspCb   = (WDI_AggrAddTsRspCb)pEventData->pCBfnc;
+  /*-------------------------------------------------------------------------
+    Check to see if we are in the middle of an association, if so queue, if
+    not it means it is free to process request 
+  -------------------------------------------------------------------------*/
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made and identify WDI session
+  ------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                        pwdiAggrAddTSParams->wdiAggrTsInfo.ucSTAIdx, 
+                                        &macBSSID))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+             "This station does not exist in the WDI Station Table %d");
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+ 
+  /*------------------------------------------------------------------------
+    Check if this BSS is being currently processed or queued,
+    if queued - queue the new request as well 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return wdiStatus; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+  /*-----------------------------------------------------------------------
+    Get message buffer
+    ! TO DO : proper conversion into the HAL Message Request Format 
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_AGGR_ADD_TS_REQ, 
+                        sizeof(tAggrAddTsParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(tAggrAddTsParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in set bss key req %x %x %x",
+                pEventData, pwdiAggrAddTSParams, wdiAggrAddTSRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  halAggrAddTsReq.aggrAddTsParam.staIdx = 
+     pwdiAggrAddTSParams->wdiAggrTsInfo.ucSTAIdx;
+  halAggrAddTsReq.aggrAddTsParam.tspecIdx = 
+     pwdiAggrAddTSParams->wdiAggrTsInfo.ucTspecIdx;
+
+  for( i = 0; i < WLAN_HAL_MAX_AC; i++ )
+  {
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].type = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].ucType;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].length = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].ucLength;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.ackPolicy = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        ackPolicy;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.accessPolicy = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        accessPolicy;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.userPrio = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        userPrio;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.psb = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        psb;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.aggregation = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        aggregation;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.direction = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        direction;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        trafficType;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
+        trafficType;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.rsvd = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.rsvd;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.schedule = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.schedule;
+        
+                  
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].nomMsduSz = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usNomMsduSz;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxMsduSz = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usMaxMsduSz;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minSvcInterval = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinSvcInterval;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxSvcInterval = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMaxSvcInterval;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].inactInterval = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uInactInterval;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].suspendInterval = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uSuspendInterval;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].svcStartTime = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uSvcStartTime;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minDataRate = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinDataRate;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].meanDataRate = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMeanDataRate;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].peakDataRate = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uPeakDataRate;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxBurstSz = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMaxBurstSz;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].delayBound = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uDelayBound;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minPhyRate = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinPhyRate;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].surplusBw = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usSurplusBw;
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].mediumTime = 
+        pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usMediumTime;
+  }
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAggrAddTsReq, 
+                  sizeof(halAggrAddTsReq)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiAggrAddTSParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiAggrAddTSParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Add TS Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiAggrAddTSRspCb, pEventData->pUserData,
+                       WDI_AGGR_ADD_TS_RESP); 
+}/*WDI_ProcessAggrAddTSpecReq*/
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+/**
+ @brief Process Shutdown Request function (called when Main FSM
+        allows it)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessShutdownReq
+(
+ WDI_ControlBlockType*  pWDICtx,
+ WDI_EventInfoType*     pEventData
+ )
+{
+   wpt_status              wptStatus;
+
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+     -------------------------------------------------------------------------*/
+   if ( NULL == pEventData )
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE;
+   }
+
+   wpalMutexAcquire(&pWDICtx->wptMutex);
+
+
+   gWDIInitialized = eWLAN_PAL_FALSE;
+   /*! TO DO: stop the data services */
+   if ( eDRIVER_TYPE_MFG != pWDICtx->driverMode )
+   {
+      /*Stop the STA Table !UT- check this logic again
+        It is safer to do it here than on the response - because a stop is imminent*/
+      WDI_STATableStop(pWDICtx);
+
+      /* Stop Transport Driver, DXE */
+      WDTS_Stop(pWDICtx);
+   }
+
+   /*Clear all pending request*/
+   WDI_ClearPendingRequests(pWDICtx);
+   /* Close Data transport*/
+   /* FTM mode does not open Data Path */
+   if ( eDRIVER_TYPE_MFG != pWDICtx->driverMode )
+   {
+      WDTS_Close(pWDICtx);
+   }
+   /*Close the STA Table !UT- check this logic again*/
+   WDI_STATableClose(pWDICtx);
+   /*close the PAL */
+   wptStatus = wpalClose(pWDICtx->pPALContext);
+   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "Failed to wpal Close %d", wptStatus);
+      WDI_ASSERT(0);
+   }
+
+   /*Transition back to init state*/
+   WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
+
+   wpalMutexRelease(&pWDICtx->wptMutex);
+
+   /*Make sure the expected state is properly defaulted to Init*/
+   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST; 
+
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessShutdownReq*/
+
+/*========================================================================
+          Main DAL Control Path Response Processing API 
+========================================================================*/
+
+/**
+ @brief Process Start Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StartRspParamsType   wdiRspParams;
+  WDI_StartRspCb           wdiStartRspCb = NULL;
+
+  tHalMacStartRspParams*   startRspParams;
+
+#ifndef HAL_SELF_STA_PER_BSS
+  WDI_AddStaParams         wdiAddSTAParam = {0};
+#endif
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  wdiStartRspCb = (WDI_StartRspCb)pWDICtx->pfncRspCB; 
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == wdiStartRspCb ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  if ( sizeof(tHalMacStartRspParams) > pEventData->uEventDataSize )
+  {
+     // not enough data was received
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "Invalid response length in Start Resp Expect %x Rcvd %x",
+                 sizeof(tHalMacStartRspParams), pEventData->uEventDataSize);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Unpack HAL Response Message - the header was already extracted by the
+    main Response Handling procedure 
+  -------------------------------------------------------------------------*/
+  startRspParams = (tHalMacStartRspParams *) pEventData->pEventData;
+
+  wdiRspParams.ucMaxBssids   = startRspParams->ucMaxBssids;
+  wdiRspParams.ucMaxStations = startRspParams->ucMaxStations;
+  wdiRspParams.wlanCompiledVersion.major = WLAN_HAL_VER_MAJOR;
+  wdiRspParams.wlanCompiledVersion.minor = WLAN_HAL_VER_MINOR;
+  wdiRspParams.wlanCompiledVersion.version = WLAN_HAL_VER_VERSION;
+  wdiRspParams.wlanCompiledVersion.revision = WLAN_HAL_VER_REVISION;
+  wdiRspParams.wlanReportedVersion.major =
+                               startRspParams->wcnssWlanVersion.major;
+  wdiRspParams.wlanReportedVersion.minor =
+                               startRspParams->wcnssWlanVersion.minor;
+  wdiRspParams.wlanReportedVersion.version =
+                               startRspParams->wcnssWlanVersion.version;
+  wdiRspParams.wlanReportedVersion.revision =
+                               startRspParams->wcnssWlanVersion.revision;
+  wpalMemoryCopy(wdiRspParams.wcnssSoftwareVersion,
+          startRspParams->wcnssCrmVersionString,
+          sizeof(wdiRspParams.wcnssSoftwareVersion));
+  wpalMemoryCopy(wdiRspParams.wcnssHardwareVersion,
+          startRspParams->wcnssWlanVersionString,
+          sizeof(wdiRspParams.wcnssHardwareVersion));
+  wdiRspParams.wdiStatus     = WDI_HAL_2_WDI_STATUS(startRspParams->status);
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+  if ( WDI_STATUS_SUCCESS == wdiRspParams.wdiStatus  )
+  {
+    pWDICtx->ucExpectedStateTransition =  WDI_STARTED_ST;
+
+    /*Cache the start response for further use*/
+    wpalMemoryCopy( &pWDICtx->wdiCachedStartRspParams ,
+                  &wdiRspParams, 
+                  sizeof(pWDICtx->wdiCachedStartRspParams));
+
+  }
+  else
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Failed to start device with status %s(%d)",
+               WDI_getHALStatusMsgString(startRspParams->status),
+               startRspParams->status);
+
+    /*Set the expected state transition to stopped - because the start has
+      failed*/
+    pWDICtx->ucExpectedStateTransition =  WDI_STOPPED_ST;
+
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+     /*Notify UMAC*/
+    wdiStartRspCb( &wdiRspParams, pWDICtx->pRspCBUserData);
+    
+    WDI_DetectedDeviceError(pWDICtx, wdiRspParams.wdiStatus);
+
+    /*Although the response is an error - it was processed by our function
+    so as far as the caller is concerned this is a succesful reponse processing*/
+    return WDI_STATUS_SUCCESS;
+  }
+  
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  if(eDRIVER_TYPE_MFG == pWDICtx->driverMode)
+  {
+    /* FTM mode does not need to execute below */
+    /* Notify UMAC */
+    wdiStartRspCb( &wdiRspParams, pWDICtx->pRspCBUserData);
+    return WDI_STATUS_SUCCESS;
+  }
+
+  /* START the Data transport */
+  WDTS_startTransport(pWDICtx);
+
+  /*Start the STA Table !- check this logic again*/
+  WDI_STATableStart(pWDICtx);
+
+#ifndef HAL_SELF_STA_PER_BSS
+  /* Store the Self STA Index */
+  pWDICtx->ucSelfStaId = halStartRspMsg.startRspParams.selfStaIdx;
+
+  pWDICtx->usSelfStaDpuId = wdiRspParams.usSelfStaDpuId;
+  wpalMemoryCopy(pWDICtx->macSelfSta, wdiRspParams.macSelfSta,
+                 WDI_MAC_ADDR_LEN);
+
+  /* At this point add the self-STA */
+
+  /*! TO DO: wdiAddSTAParam.bcastMgmtDpuSignature */
+  /* !TO DO: wdiAddSTAParam.bcastDpuSignature */
+  /*! TO DO: wdiAddSTAParam.dpuSig */
+  /*! TO DO: wdiAddSTAParam.ucWmmEnabled */
+  /*! TO DO: wdiAddSTAParam.ucHTCapable */
+  /*! TO DO: wdiAddSTAParam.ucRmfEnabled */
+
+  //all DPU indices are the same for self STA
+  wdiAddSTAParam.bcastDpuIndex = wdiRspParams.usSelfStaDpuId;
+  wdiAddSTAParam.bcastMgmtDpuIndex = wdiRspParams.usSelfStaDpuId;
+  wdiAddSTAParam.dpuIndex = wdiRspParams.usSelfStaDpuId;;
+  wpalMemoryCopy(wdiAddSTAParam.staMacAddr, wdiRspParams.macSelfSta,
+                 WDI_MAC_ADDR_LEN);
+  wdiAddSTAParam.ucStaType = WDI_STA_ENTRY_SELF; /* 0 - self */
+  wdiAddSTAParam.ucSTAIdx = halStartRspMsg.startRspParams.selfStaIdx;
+
+  /* Note: Since we don't get an explicit config STA request for self STA, we
+     add the self STA upon receiving the Start response message. But the
+     self STA entry in the table is deleted when WDI gets an explicit delete STA
+     request */
+  (void)WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
+#endif
+
+  /*Notify UMAC*/
+  wdiStartRspCb( &wdiRspParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessStartRsp*/
+
+
+/**
+ @brief Process Stop Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStopRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status          wdiStatus;
+  WDI_StopRspCb       wdiStopRspCb = NULL;
+
+  tHalMacStopRspMsg   halMacStopRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  wdiStopRspCb = (WDI_StopRspCb)pWDICtx->pfncRspCB; 
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == wdiStopRspCb ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  if ( sizeof(halMacStopRspMsg) < pEventData->uEventDataSize )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Invalid response length in Stop Resp %x %x",
+                pEventData->uEventDataSize);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Unpack HAL Response Message - the header was already extracted by the
+    main Response Handling procedure 
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halMacStopRspMsg.stopRspParams,  
+                  pEventData->pEventData, 
+                  sizeof(halMacStopRspMsg.stopRspParams));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halMacStopRspMsg.stopRspParams.status); 
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*--------------------------------------------------------------------------
+    Check to see if the stop went OK 
+  --------------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != wdiStatus  )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Failed to stop the device with status %s (%d)",
+               WDI_getHALStatusMsgString(halMacStopRspMsg.stopRspParams.status),
+               halMacStopRspMsg.stopRspParams.status);
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_FAILURE; 
+  }
+  
+  pWDICtx->ucExpectedStateTransition = WDI_STOPPED_ST;
+
+  /*Transition now as WDI may get preempted imediately after it sends
+  up the Stop Response and it will not get to process the state transition
+  from Main Rsp function*/
+  WDI_STATE_TRANSITION( pWDICtx, pWDICtx->ucExpectedStateTransition);
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*! TO DO: - STOP the Data transport */
+
+  /*Notify UMAC*/
+  wdiStopRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessStopRsp*/
+
+/**
+ @brief Process Close Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCloseRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*There is no close response comming from HAL - function just kept for
+  simmetry */
+  WDI_ASSERT(0);
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessCloseRsp*/
+
+
+/*============================================================================
+                      SCAN RESPONSE PROCESSING API 
+============================================================================*/
+
+/**
+ @brief Process Init Scan Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessInitScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  WDI_InitScanRspCb     wdiInitScanRspCb;
+  tHalInitScanRspMsg    halInitScanRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiInitScanRspCb = (WDI_InitScanRspCb)pWDICtx->pfncRspCB;
+  if( NULL == wdiInitScanRspCb)
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: call back function is NULL", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Unpack HAL Response Message - the header was already extracted by the
+    main Response Handling procedure 
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halInitScanRspMsg.initScanRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halInitScanRspMsg.initScanRspParams));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halInitScanRspMsg.initScanRspParams.status); 
+
+  if ( pWDICtx->bInBmps )
+  {
+     // notify DTS that we are entering Full power
+     WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
+  }
+
+  /*Notify UMAC*/
+  wdiInitScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessInitScanRsp*/
+
+
+/**
+ @brief Process Start Scan Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStartScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_StartScanRspParamsType   wdiStartScanParams;
+  WDI_StartScanRspCb           wdiStartScanRspCb;
+  
+  tHalStartScanRspMsg          halStartScanRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiStartScanRspCb = (WDI_StartScanRspCb)pWDICtx->pfncRspCB;
+  if( NULL == wdiStartScanRspCb)
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: call back function is NULL", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStartScanRspMsg.startScanRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halStartScanRspMsg.startScanRspParams));
+
+  wdiStartScanParams.wdiStatus   =   WDI_HAL_2_WDI_STATUS(
+                             halStartScanRspMsg.startScanRspParams.status);
+#ifdef WLAN_FEATURE_VOWIFI
+  wdiStartScanParams.ucTxMgmtPower = 
+                             halStartScanRspMsg.startScanRspParams.txMgmtPower;
+  wpalMemoryCopy( wdiStartScanParams.aStartTSF, 
+                  halStartScanRspMsg.startScanRspParams.startTSF,
+                  2);
+#endif 
+
+  if ( eHAL_STATUS_SUCCESS != halStartScanRspMsg.startScanRspParams.status )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Start scan failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStartScanRspMsg.startScanRspParams.status),
+              halStartScanRspMsg.startScanRspParams.status);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiStartScanRspCb( &wdiStartScanParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+
+}/*WDI_ProcessStartScanRsp*/
+
+
+/**
+ @brief Process End Scan Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEndScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  tHalEndScanRspMsg     halEndScanRspMsg;
+  WDI_EndScanRspCb      wdiEndScanRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiEndScanRspCb = (WDI_EndScanRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halEndScanRspMsg.endScanRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halEndScanRspMsg.endScanRspParams));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halEndScanRspMsg.endScanRspParams.status); 
+
+  if ( eHAL_STATUS_SUCCESS != halEndScanRspMsg.endScanRspParams.status )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "End Scan failed with status %s (%d )",
+              WDI_getHALStatusMsgString(halEndScanRspMsg.endScanRspParams.status),
+              halEndScanRspMsg.endScanRspParams.status);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiEndScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessEndScanRsp*/
+
+
+/**
+ @brief Process Finish Scan Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFinishScanRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)  
+{
+  WDI_Status            wdiStatus;
+  WDI_FinishScanRspCb   wdiFinishScanRspCb;
+  
+  tHalFinishScanRspMsg  halFinishScanRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiFinishScanRspCb = (WDI_FinishScanRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( (void *)&halFinishScanRspMsg.finishScanRspParams.status, 
+                  pEventData->pEventData, 
+                  sizeof(halFinishScanRspMsg.finishScanRspParams.status));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halFinishScanRspMsg.finishScanRspParams.status); 
+
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+              "Finish scan response reported status: %d", 
+              halFinishScanRspMsg.finishScanRspParams.status);
+
+  if (( eHAL_STATUS_SUCCESS != halFinishScanRspMsg.finishScanRspParams.status )&&
+      ( eHAL_STATUS_NOTIFY_BSS_FAIL  != halFinishScanRspMsg.finishScanRspParams.status ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Finish Scan failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halFinishScanRspMsg.finishScanRspParams.status),
+              halFinishScanRspMsg.finishScanRspParams.status);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiFinishScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessFinishScanRsp*/
+
+/**
+ @brief Process Join Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessJoinRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status                    wdiStatus;
+  WDI_JoinRspCb                 wdiJoinRspCb;
+  WDI_BSSSessionType*           pBSSSes             = NULL;
+  
+  tHalJoinRspMsg                halJoinRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) ||
+      ( NULL == pWDICtx->pfncRspCB ) ||
+      ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiJoinRspCb = (WDI_JoinRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halJoinRspMsg.joinRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halJoinRspMsg.joinRspParams));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halJoinRspMsg.joinRspParams.status); 
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*-----------------------------------------------------------------------
+    Join response can only be received for an existing assoc that
+    is current and in progress 
+    -----------------------------------------------------------------------*/
+  if (( !WDI_VALID_SESSION_IDX(pWDICtx->ucCurrentBSSSesIdx )) || 
+      ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist or "
+              "association no longer in progress - mysterious HAL response");
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  pBSSSes = &pWDICtx->aBSSSessions[pWDICtx->ucCurrentBSSSesIdx];
+
+  /*-----------------------------------------------------------------------
+    Join Response is only allowed in init state 
+  -----------------------------------------------------------------------*/
+  if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Join only allowed in Joining state - failure state is %d "
+              "strange HAL response", pBSSSes->wdiAssocState);
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+
+  /*-----------------------------------------------------------------------
+    If assoc has failed the current session will be deleted 
+  -----------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != wdiStatus )
+  {
+    /*Association was failed by HAL - remove session*/
+    WDI_DeleteSession(pWDICtx, pBSSSes);
+
+    /*Association no longer in progress  */
+    pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+
+    /*Association no longer in progress - prepare pending assoc for processing*/
+    WDI_DequeueAssocRequest(pWDICtx);
+  
+  }
+  else
+  {
+    /*Transition to state Joining - this may be redundant as we are supposed
+      to be in this state already - but just to be safe*/
+    pBSSSes->wdiAssocState = WDI_ASSOC_JOINING_ST; 
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Notify UMAC*/
+  wdiJoinRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessJoinRsp*/
+
+
+/**
+ @brief Process Config BSS Response function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigBSSRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ConfigBSSRspParamsType    wdiConfigBSSParams;
+  WDI_ConfigBSSRspCb            wdiConfigBSSRspCb;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*           pBSSSes             = NULL;
+
+  tConfigBssRspMsg              halConfigBssRspMsg; 
+  WDI_AddStaParams              wdiBcastAddSTAParam = {0};
+  WDI_AddStaParams              wdiAddSTAParam = {0};
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiConfigBSSRspCb = (WDI_ConfigBSSRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC 
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halConfigBssRspMsg.configBssRspParams, 
+                   pEventData->pEventData, 
+                   sizeof(halConfigBssRspMsg.configBssRspParams));
+
+  wdiConfigBSSParams.wdiStatus = WDI_HAL_2_WDI_STATUS(
+                            halConfigBssRspMsg.configBssRspParams.status);
+  if(WDI_STATUS_SUCCESS == wdiConfigBSSParams.wdiStatus)
+  {
+    wpalMemoryCopy( wdiConfigBSSParams.macBSSID, 
+                    pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.macBSSID,
+                    WDI_MAC_ADDR_LEN);
+  
+    wdiConfigBSSParams.ucBSSIdx = halConfigBssRspMsg.configBssRspParams.bssIdx;
+  
+    wdiConfigBSSParams.ucBcastSig = 
+       halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
+  
+    wdiConfigBSSParams.ucUcastSig = 
+       halConfigBssRspMsg.configBssRspParams.ucastDpuSignature;
+  
+    wdiConfigBSSParams.ucSTAIdx = halConfigBssRspMsg.configBssRspParams.bssStaIdx;
+  
+  #ifdef WLAN_FEATURE_VOWIFI
+    wdiConfigBSSParams.ucTxMgmtPower = 
+                               halConfigBssRspMsg.configBssRspParams.txMgmtPower;
+  #endif
+     wpalMemoryCopy( wdiConfigBSSParams.macSTA,
+                     halConfigBssRspMsg.configBssRspParams.staMac,
+                     WDI_MAC_ADDR_LEN );
+  
+    wpalMutexAcquire(&pWDICtx->wptMutex);
+    /*------------------------------------------------------------------------
+      Find the BSS for which the request is made 
+    ------------------------------------------------------------------------*/
+    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                               wdiConfigBSSParams.macBSSID, 
+                                              &pBSSSes); 
+  
+    /*-----------------------------------------------------------------------
+      Config BSS response can only be received for an existing assoc that
+      is current and in progress 
+      -----------------------------------------------------------------------*/
+    if ( NULL == pBSSSes )
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Association sequence for this BSS does not yet exist "
+                "- mysterious HAL response");
+  
+      WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+      
+      wpalMutexRelease(&pWDICtx->wptMutex);
+      return WDI_STATUS_E_NOT_ALLOWED; 
+    }
+  
+    /*Save data for this BSS*/
+    pBSSSes->wdiBssType = pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiBSSType;
+    pBSSSes->ucBSSIdx = halConfigBssRspMsg.configBssRspParams.bssIdx;
+    pBSSSes->bcastDpuIndex     = 
+      halConfigBssRspMsg.configBssRspParams.bcastDpuDescIndx;
+    pBSSSes->bcastDpuSignature = 
+      halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
+    pBSSSes->bcastMgmtDpuIndex = 
+      halConfigBssRspMsg.configBssRspParams.mgmtDpuDescIndx;
+    pBSSSes->bcastMgmtDpuSignature = 
+      halConfigBssRspMsg.configBssRspParams.mgmtDpuSignature;
+    pBSSSes->ucRmfEnabled      = 
+      pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucRMFEnabled;
+    pBSSSes->bcastStaIdx =
+       halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx;
+  
+    /* !TO DO: Shuould we be updating the RMF Capability of self STA here? */
+  
+    /*-------------------------------------------------------------------------
+        Add Peer STA
+      -------------------------------------------------------------------------*/
+    wdiAddSTAParam.ucSTAIdx = halConfigBssRspMsg.configBssRspParams.bssStaIdx; 
+    wdiAddSTAParam.dpuIndex = halConfigBssRspMsg.configBssRspParams.dpuDescIndx;
+    wdiAddSTAParam.dpuSig   = halConfigBssRspMsg.configBssRspParams.ucastDpuSignature;
+     
+     /*This info can be retrieved from the cached initial request*/
+    wdiAddSTAParam.ucWmmEnabled = 
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.ucWMMEnabled;
+    wdiAddSTAParam.ucHTCapable  = 
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.ucHTCapable; 
+    wdiAddSTAParam.ucStaType    = 
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.wdiSTAType;  
+  
+     /* MAC Address of STA */
+    wpalMemoryCopy(wdiAddSTAParam.staMacAddr, 
+                   halConfigBssRspMsg.configBssRspParams.staMac, 
+                   WDI_MAC_ADDR_LEN);
+  
+    wpalMemoryCopy(wdiAddSTAParam.macBSSID, 
+                   pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.macBSSID , 
+                   WDI_MAC_ADDR_LEN); 
+     
+    /*Add BSS specific parameters*/
+    wdiAddSTAParam.bcastMgmtDpuIndex     = 
+        halConfigBssRspMsg.configBssRspParams.mgmtDpuDescIndx;
+    wdiAddSTAParam.bcastMgmtDpuSignature = 
+        halConfigBssRspMsg.configBssRspParams.mgmtDpuSignature;
+    wdiAddSTAParam.bcastDpuIndex         = 
+        halConfigBssRspMsg.configBssRspParams.bcastDpuDescIndx;
+    wdiAddSTAParam.bcastDpuSignature     = 
+        halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
+    wdiAddSTAParam.ucRmfEnabled          =  
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucRMFEnabled;
+    wdiAddSTAParam.ucBSSIdx = 
+       halConfigBssRspMsg.configBssRspParams.bssIdx;
+  
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                "Add STA to the table index: %d", wdiAddSTAParam.ucSTAIdx );
+  
+    WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
+    /*-------------------------------------------------------------------------
+        Add Broadcast STA only in AP mode
+      -------------------------------------------------------------------------*/
+    if( pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucOperMode == 
+        WDI_BSS_OPERATIONAL_MODE_AP )
+    {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                  "Add BCAST STA to table for index: %d",
+                  halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx );
+  
+       wpalMemoryCopy( &wdiBcastAddSTAParam, &wdiAddSTAParam, 
+                       sizeof(WDI_AddStaParams) );
+  
+       WDI_AddBcastSTAtoSTATable( pWDICtx, &wdiBcastAddSTAParam,
+                                  halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx );
+    }
+    wpalMutexRelease(&pWDICtx->wptMutex);
+  }
+  else
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "Config BSS RSP failed with status : %s(%d)",
+                  WDI_getHALStatusMsgString(
+                  halConfigBssRspMsg.configBssRspParams.status), 
+                  halConfigBssRspMsg.configBssRspParams.status);
+
+    
+    /*Association was failed by HAL - remove session*/
+    WDI_DeleteSession(pWDICtx, pBSSSes);
+
+    /*Association no longer in progress  */
+    pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+
+    /*Association no longer in progress - prepare pending assoc for processing*/
+    WDI_DequeueAssocRequest(pWDICtx);
+
+  }
+
+  /*Notify UMAC*/
+  wdiConfigBSSRspCb( &wdiConfigBSSParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessConfigBSSRsp*/
+
+
+/**
+ @brief Process Del BSS Response function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBSSRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelBSSRspParamsType       wdiDelBSSParams;
+  WDI_DelBSSRspCb               wdiDelBSSRspCb;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
+  WDI_BSSSessionType*           pBSSSes             = NULL;
+
+  tDeleteBssRspMsg              halDelBssRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiDelBSSRspCb = (WDI_DelBSSRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC 
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halDelBssRspMsg.deleteBssRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halDelBssRspMsg.deleteBssRspParams));
+
+
+  wdiDelBSSParams.wdiStatus   =   WDI_HAL_2_WDI_STATUS(
+                                 halDelBssRspMsg.deleteBssRspParams.status); 
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                             halDelBssRspMsg.deleteBssRspParams.bssIdx, 
+                             &pBSSSes); 
+
+  /*-----------------------------------------------------------------------
+    Del BSS response can only be received for an existing assoc that
+    is current and in progress 
+    -----------------------------------------------------------------------*/
+  if ( NULL == pBSSSes )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist or "
+              "association no longer in progress - mysterious HAL response");
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*Extract BSSID for the response to UMAC*/
+  wpalMemoryCopy(wdiDelBSSParams.macBSSID, 
+                 pBSSSes->macBSSID, WDI_MAC_ADDR_LEN);
+
+  wdiDelBSSParams.ucBssIdx = halDelBssRspMsg.deleteBssRspParams.bssIdx;
+
+  /*-----------------------------------------------------------------------
+    The current session will be deleted 
+  -----------------------------------------------------------------------*/
+  WDI_DeleteSession(pWDICtx, pBSSSes);
+
+  /* Delete the BCAST STA entry from the STA table if SAP/GO session is deleted */
+  if(WDI_INFRA_AP_MODE == pBSSSes->wdiBssType)
+  {
+    (void)WDI_STATableDelSta( pWDICtx, pBSSSes->bcastStaIdx );
+  }
+  
+   /* Delete the STA's in this BSS */
+  WDI_STATableBSSDelSta(pWDICtx, halDelBssRspMsg.deleteBssRspParams.bssIdx);
+  
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Notify UMAC*/
+  wdiDelBSSRspCb( &wdiDelBSSParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessDelBSSRsp*/
+
+/**
+ @brief Process Post Assoc Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPostAssocRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_PostAssocRspParamsType    wdiPostAssocParams;
+  WDI_PostAssocRspCb            wdiPostAssocRspCb;
+  wpt_uint8                     ucCurrentBSSSesIdx     = 0; 
+  WDI_BSSSessionType*           pBSSSes                = NULL;
+  tPostAssocRspMsg              halPostAssocRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiPostAssocRspCb = (WDI_PostAssocRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halPostAssocRspMsg.postAssocRspParams, 
+                   pEventData->pEventData, 
+                   sizeof(halPostAssocRspMsg.postAssocRspParams));
+
+  /*Extract the Post Assoc STA Params */
+
+  wdiPostAssocParams.staParams.ucSTAIdx   = 
+    halPostAssocRspMsg.postAssocRspParams.configStaRspParams.staIdx;
+  wdiPostAssocParams.staParams.ucUcastSig = 
+    halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucUcastSig;
+  wdiPostAssocParams.staParams.ucBcastSig = 
+    halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucBcastSig;
+
+ wdiPostAssocParams.wdiStatus = 
+    WDI_HAL_2_WDI_STATUS(halPostAssocRspMsg.postAssocRspParams.configStaRspParams.status); 
+
+ /*Copy the MAC addresses from the cached storage in the WDI CB as they are not
+   included in the response */
+  wpalMemoryCopy( wdiPostAssocParams.staParams.macSTA, 
+                  pWDICtx->wdiCachedPostAssocReq.wdiSTAParams.macSTA, 
+                  WDI_MAC_ADDR_LEN);
+
+  /* Extract Post Assoc BSS Params */
+
+  wpalMemoryCopy( wdiPostAssocParams.bssParams.macBSSID, 
+                  pWDICtx->wdiCachedPostAssocReq.wdiBSSParams.macBSSID, 
+                  WDI_MAC_ADDR_LEN); 
+
+  /*Copy the MAC addresses from the cached storage in the WDI CB as they are not
+   included in the response */
+  wpalMemoryCopy( wdiPostAssocParams.bssParams.macSTA, 
+                  pWDICtx->wdiCachedPostAssocReq.wdiBSSParams.wdiSTAContext
+                  .macSTA, WDI_MAC_ADDR_LEN);
+
+  wdiPostAssocParams.bssParams.ucBcastSig = 
+     halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucBcastSig;
+
+  wdiPostAssocParams.bssParams.ucUcastSig = 
+     halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucUcastSig;
+
+  wdiPostAssocParams.bssParams.ucBSSIdx =
+     halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssIdx;
+
+  wdiPostAssocParams.bssParams.ucSTAIdx = 
+     halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssStaIdx;
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Find the BSS for which the request is made 
+  ------------------------------------------------------------------------*/
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                             wdiPostAssocParams.bssParams.
+                                             macBSSID, &pBSSSes); 
+
+  /*-----------------------------------------------------------------------
+    Post assoc response can only be received for an existing assoc that
+    is current and in progress 
+    -----------------------------------------------------------------------*/
+  if (( NULL == pBSSSes ) ||
+      ( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) || 
+      ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist or "
+              "association no longer in progress - mysterious HAL response");
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Post Assoc Request is only allowed in Joining state 
+  -----------------------------------------------------------------------*/
+  if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Post Assoc not allowed before JOIN - failing request "
+              "strange HAL response");
+
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
+    wpalMutexRelease(&pWDICtx->wptMutex);
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  /*-----------------------------------------------------------------------
+    If assoc has failed the current session will be deleted 
+  -----------------------------------------------------------------------*/
+  if ( WDI_STATUS_SUCCESS != wdiPostAssocParams.wdiStatus )
+  {
+    /*Association was failed by HAL - remove session*/
+    WDI_DeleteSession(pWDICtx, pBSSSes);
+  }
+  else
+  {
+    /*Transition to state POST Assoc*/
+    pBSSSes->wdiAssocState = WDI_ASSOC_POST_ST; 
+
+    /*Save DPU Info*/
+    pBSSSes->bcastMgmtDpuIndex     = 
+      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.mgmtDpuDescIndx;
+    pBSSSes->bcastMgmtDpuSignature = 
+      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.mgmtDpuSignature;
+    pBSSSes->bcastDpuIndex         = 
+      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bcastDpuDescIndx;
+    pBSSSes->bcastDpuSignature     = 
+      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bcastDpuSignature;
+
+    pBSSSes->ucBSSIdx              = 
+      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssIdx;
+  }
+
+  /*Association no longer in progress  */
+  pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+
+  /*Association no longer in progress - prepare pending assoc for processing*/
+  WDI_DequeueAssocRequest(pWDICtx);
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*Notify UMAC*/
+  wdiPostAssocRspCb( &wdiPostAssocParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessPostAssocRsp*/
+
+/**
+ @brief Process Del STA Rsp function (called when a response is 
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelSTARspParamsType   wdiDelSTARsp;
+  WDI_DelSTARspCb           wdiDelSTARspCb;
+  wpt_uint8                 staType;
+  tDeleteStaRspMsg          halDelStaRspMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiDelSTARspCb = (WDI_DelSTARspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halDelStaRspMsg.delStaRspParams,
+                  pEventData->pEventData, 
+                  sizeof(halDelStaRspMsg.delStaRspParams));
+
+  wdiDelSTARsp.ucSTAIdx    = halDelStaRspMsg.delStaRspParams.staId;
+  wdiDelSTARsp.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halDelStaRspMsg.delStaRspParams.status); 
+
+  WDI_STATableGetStaType(pWDICtx, wdiDelSTARsp.ucSTAIdx, &staType);
+
+  /* If the DEL STA request is for self STA do not delete it - Really weird!!What happens in concurrency */
+  if(staType == WDI_STA_ENTRY_SELF)
+  {
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+
+    /* At this point add the self-STA */
+
+    /*! TO DO: wdiAddSTAParam.ucWmmEnabled */
+    /*! TO DO: wdiAddSTAParam.ucHTCapable */
+    /*! TO DO: wdiAddSTAParam.ucRmfEnabled */
+
+#define WDI_DPU_SELF_STA_DEFAULT_IDX 0
+#define WDI_DPU_SELF_STA_DEFAULT_SIG 0
+
+    //all DPU indices are the same for self STA
+    pSTATable[wdiDelSTARsp.ucSTAIdx].dpuIndex = WDI_DPU_SELF_STA_DEFAULT_IDX;
+    pSTATable[wdiDelSTARsp.ucSTAIdx].bcastDpuIndex = WDI_DPU_SELF_STA_DEFAULT_IDX;
+    pSTATable[wdiDelSTARsp.ucSTAIdx].bcastMgmtDpuIndex = WDI_DPU_SELF_STA_DEFAULT_IDX;
+    pSTATable[wdiDelSTARsp.ucSTAIdx].bcastDpuSignature = WDI_DPU_SELF_STA_DEFAULT_SIG;
+    pSTATable[wdiDelSTARsp.ucSTAIdx].bcastMgmtDpuSignature = WDI_DPU_SELF_STA_DEFAULT_SIG;
+    pSTATable[wdiDelSTARsp.ucSTAIdx].dpuSig = WDI_DPU_SELF_STA_DEFAULT_SIG;
+  }
+  else
+  {
+    //Delete the station in the table
+    WDI_STATableDelSta( pWDICtx, wdiDelSTARsp.ucSTAIdx);
+  }
+
+  /*Notify UMAC*/
+  wdiDelSTARspCb( &wdiDelSTARsp, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessDelSTARsp*/
+
+
+/*==========================================================================
+                   Security Response Processing Functions 
+==========================================================================*/
+
+/**
+ @brief Process Set BSS Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBssKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  eHalStatus            halStatus;
+  WDI_SetBSSKeyRspCb    wdiSetBSSKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetBSSKeyRspCb = (WDI_SetBSSKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Set BSS Key failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiSetBSSKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetBssKeyRsp*/
+
+/**
+ @brief Process Remove BSS Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveBssKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status              wdiStatus;
+  eHalStatus              halStatus;
+  WDI_RemoveBSSKeyRspCb   wdiRemoveBSSKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiRemoveBSSKeyRspCb = (WDI_RemoveBSSKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Remove BSS Key failed with status %s (%d )",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiRemoveBSSKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetBssKeyRsp*/
+
+
+/**
+ @brief Process Set STA Key Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  eHalStatus            halStatus;
+  WDI_SetSTAKeyRspCb    wdiSetSTAKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetSTAKeyRspCb = (WDI_SetSTAKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Set STA Key failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiSetSTAKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetSTAKeyRsp*/
+
+/**
+ @brief Process Remove STA Key Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status              wdiStatus;
+  eHalStatus              halStatus;
+  WDI_RemoveSTAKeyRspCb   wdiRemoveSTAKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiRemoveSTAKeyRspCb = (WDI_RemoveSTAKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Remove STA Key failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiRemoveSTAKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessRemoveStaKeyRsp*/
+
+/**
+ @brief Process Set STA Bcast Key Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetStaBcastKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  eHalStatus            halStatus;
+  WDI_SetSTAKeyRspCb    wdiSetSTABcastKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetSTABcastKeyRspCb = (WDI_SetSTAKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Set STA Key failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiSetSTABcastKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetSTABcastKeyRsp*/
+
+/**
+ @brief Process Remove STA Bcast Key Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemoveStaBcastKeyRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status              wdiStatus;
+  eHalStatus              halStatus;
+  WDI_RemoveSTAKeyRspCb   wdiRemoveSTABcastKeyRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiRemoveSTABcastKeyRspCb = (WDI_RemoveSTAKeyRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS != halStatus )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Remove STA Key failed with status %s (%d)",
+              WDI_getHALStatusMsgString(halStatus),
+              halStatus);
+     /* send the status to UMAC, don't return from here*/
+  }
+
+  /*Notify UMAC*/
+  wdiRemoveSTABcastKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessRemoveStaBcastKeyRsp*/
+
+
+/*==========================================================================
+                   QoS and BA Response Processing Functions 
+==========================================================================*/
+
+/**
+ @brief Process Add TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_AddTsRspCb   wdiAddTsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiAddTsRspCb = (WDI_AddTsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiAddTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddTSpecRsp*/
+
+
+/**
+ @brief Process Del TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_DelTsRspCb   wdiDelTsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiDelTsRspCb = (WDI_DelTsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiDelTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessDelTSpecRsp*/
+
+/**
+ @brief Process Update EDCA Parameters Rsp function (called when a  
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateEDCAParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_UpdateEDCAParamsRspCb   wdiUpdateEDCAParamsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiUpdateEDCAParamsRspCb = (WDI_UpdateEDCAParamsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiUpdateEDCAParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUpdateEDCAParamsRsp*/
+
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBASessionRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddBASessionRspCb   wdiAddBASessionRspCb;
+
+  tAddBASessionRspParams        halBASessionRsp;
+  WDI_AddBASessionRspParamsType wdiBASessionRsp;
+
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiAddBASessionRspCb = (WDI_AddBASessionRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halBASessionRsp, 
+                  pEventData->pEventData, 
+                  sizeof(halBASessionRsp));
+
+  wdiBASessionRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halBASessionRsp.status);
+
+  if ( eHAL_STATUS_SUCCESS == wdiBASessionRsp.wdiStatus )
+  {
+    wdiBASessionRsp.ucBaDialogToken = halBASessionRsp.baDialogToken;
+    wdiBASessionRsp.ucBaTID = halBASessionRsp.baTID;
+    wdiBASessionRsp.ucBaBufferSize = halBASessionRsp.baBufferSize;
+    wdiBASessionRsp.usBaSessionID = halBASessionRsp.baSessionID;
+    wdiBASessionRsp.ucWinSize = halBASessionRsp.winSize;
+    wdiBASessionRsp.ucSTAIdx = halBASessionRsp.STAID;
+    wdiBASessionRsp.usBaSSN = halBASessionRsp.SSN;
+  }
+
+  /*Notify UMAC*/
+  wdiAddBASessionRspCb( &wdiBASessionRsp, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddSessionBARsp*/
+
+
+/**
+ @brief Process Del BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_DelBARspCb   wdiDelBARspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiDelBARspCb = (WDI_DelBARspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if ( eHAL_STATUS_SUCCESS == halStatus )
+  {
+    /*! TO DO: I should notify the DAL Data Path that the BA was deleted*/
+  }
+
+  /*Notify UMAC*/
+  wdiDelBARspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessDelBARsp*/
+
+#ifdef FEATURE_WLAN_CCX
+/**
+ @brief Process TSM Stats Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTsmStatsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_TsmRspCb          wdiTsmStatsRspCb;
+  tTsmStatsRspMsg       halTsmStatsRspMsg; 
+  WDI_TSMStatsRspParamsType  wdiTsmStatsRspParams;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiTsmStatsRspCb = (WDI_TsmRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Unpack HAL Response Message - the header was already extracted by the
+    main Response Handling procedure 
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halTsmStatsRspMsg.tsmStatsRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halTsmStatsRspMsg.tsmStatsRspParams));
+
+  wdiTsmStatsRspParams.UplinkPktQueueDly = halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktQueueDly;
+  wpalMemoryCopy( wdiTsmStatsRspParams.UplinkPktQueueDlyHist,
+                  halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktQueueDlyHist,
+                  sizeof(halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktQueueDlyHist)/
+                  sizeof(halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktQueueDlyHist[0]));
+  wdiTsmStatsRspParams.UplinkPktTxDly = halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktTxDly;
+  wdiTsmStatsRspParams.UplinkPktLoss = halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktLoss;
+  wdiTsmStatsRspParams.UplinkPktCount = halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktCount;
+  wdiTsmStatsRspParams.RoamingCount = halTsmStatsRspMsg.tsmStatsRspParams.RoamingCount;
+  wdiTsmStatsRspParams.RoamingDly = halTsmStatsRspMsg.tsmStatsRspParams.RoamingDly;
+  wdiTsmStatsRspParams.wdiStatus   =   WDI_HAL_2_WDI_STATUS(
+                             halTsmStatsRspMsg.tsmStatsRspParams.status);
+
+  /*Notify UMAC*/
+  wdiTsmStatsRspCb( &wdiTsmStatsRspParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessTsmStatsRsp*/
+
+#endif
+
+
+
+/**
+ @brief Process Flush AC Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFlushAcRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_FlushAcRspCb wdiFlushAcRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiFlushAcRspCb = (WDI_FlushAcRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiFlushAcRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessFlushAcRsp*/
+
+/**
+ @brief Process BT AMP event Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBtAmpEventRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status       wdiStatus;
+   eHalStatus       halStatus;
+   WDI_BtAmpEventRspCb wdiBtAmpEventRspCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiBtAmpEventRspCb = (WDI_BtAmpEventRspCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   wpalMemoryCopy( &halStatus, 
+                   pEventData->pEventData, 
+                   sizeof(halStatus));
+
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiBtAmpEventRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessBtAmpEventRsp*/
+
+
+/**
+ @brief Process ADD STA SELF Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddSTASelfRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddSTASelfRspParamsType  wdiAddSTASelfParams;
+  WDI_AddSTASelfParamsRspCb    wdiAddSTASelfReqParamsRspCb;
+  tAddStaSelfRspMsg            halAddStaSelfRsp;
+  WDI_AddStaParams             wdiAddSTAParam = {0};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiAddSTASelfReqParamsRspCb = 
+                         (WDI_AddSTASelfParamsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halAddStaSelfRsp.addStaSelfRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halAddStaSelfRsp.addStaSelfRspParams));
+
+
+  wdiAddSTASelfParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halAddStaSelfRsp.addStaSelfRspParams.status); 
+
+  wdiAddSTASelfParams.ucSTASelfIdx   = 
+    halAddStaSelfRsp.addStaSelfRspParams.selfStaIdx;
+  wdiAddSTASelfParams.dpuIdx = 
+    halAddStaSelfRsp.addStaSelfRspParams.dpuIdx;
+  wdiAddSTASelfParams.dpuSignature = 
+    halAddStaSelfRsp.addStaSelfRspParams.dpuSignature;
+
+  wpalMemoryCopy(wdiAddSTASelfParams.macSelfSta,
+                 pWDICtx->wdiCacheAddSTASelfReq.wdiAddSTASelfInfo.selfMacAddr,
+                 WDI_MAC_ADDR_LEN);
+
+
+#ifdef HAL_SELF_STA_PER_BSS
+
+  /* At this point add the self-STA */
+
+  /*! TO DO: wdiAddSTAParam.ucWmmEnabled */
+  /*! TO DO: wdiAddSTAParam.ucHTCapable */
+  /*! TO DO: wdiAddSTAParam.ucRmfEnabled */
+
+  //all DPU indices are the same for self STA
+
+  /*DPU Information*/
+  wdiAddSTAParam.dpuIndex              = wdiAddSTASelfParams.dpuIdx; 
+  wdiAddSTAParam.dpuSig                = wdiAddSTASelfParams.dpuSignature;
+  wdiAddSTAParam.bcastDpuSignature     = wdiAddSTASelfParams.dpuSignature;
+  wdiAddSTAParam.bcastMgmtDpuSignature = wdiAddSTASelfParams.dpuSignature;
+  wdiAddSTAParam.bcastDpuIndex         = wdiAddSTASelfParams.dpuIdx;
+  wdiAddSTAParam.bcastMgmtDpuIndex     = wdiAddSTASelfParams.dpuIdx;
+
+  wpalMemoryCopy(wdiAddSTAParam.staMacAddr, wdiAddSTASelfParams.macSelfSta,
+                 WDI_MAC_ADDR_LEN);
+
+  wdiAddSTAParam.ucStaType = WDI_STA_ENTRY_SELF; /* 0 - self */
+  wdiAddSTAParam.ucSTAIdx = wdiAddSTASelfParams.ucSTASelfIdx;
+
+  if(halAddStaSelfRsp.addStaSelfRspParams.status 
+     != eHAL_STATUS_ADD_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO)
+  {
+     (void)WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
+  }
+#endif
+
+  /*Notify UMAC*/
+  wdiAddSTASelfReqParamsRspCb( &wdiAddSTASelfParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddSTASelfRsp*/
+
+
+
+/**
+ @brief WDI_ProcessDelSTASelfRsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTASelfRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_DelSTASelfRspParamsType     wdiDelStaSelfRspParams;
+  WDI_DelSTASelfRspCb             wdiDelStaSelfRspCb;
+  tDelStaSelfRspParams            delStaSelfRspParams;
+  wpt_uint8                       ucStaIdx;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+    -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiDelStaSelfRspCb = (WDI_DelSTASelfRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+    -------------------------------------------------------------------------*/
+
+  wpalMemoryCopy( &delStaSelfRspParams, 
+                        (wpt_uint8*)pEventData->pEventData,
+                              sizeof(tDelStaSelfRspParams));
+
+  wdiDelStaSelfRspParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(delStaSelfRspParams.status); 
+
+  /* delStaSelfRspParams.status is not 
+   eHAL_STATUS_DEL_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO*/
+  if( eHAL_STATUS_SUCCESS == delStaSelfRspParams.status )
+  {
+    WDI_Status wdiStatus;
+    wdiStatus = WDI_STATableFindStaidByAddr(pWDICtx, 
+                               delStaSelfRspParams.selfMacAddr,
+                               &ucStaIdx);
+    if(WDI_STATUS_E_FAILURE == wdiStatus)
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Unable to extract the STA Idx ", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+    }
+    WDI_STATableDelSta(pWDICtx, ucStaIdx);
+  }
+
+  /*Notify UMAC*/
+  wdiDelStaSelfRspCb(&wdiDelStaSelfRspParams, (void*) pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS;
+}
+
+
+
+/*===========================================================================
+           Miscellaneous Control Response Processing API 
+===========================================================================*/
+
+/**
+ @brief Process Channel Switch Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessChannelSwitchRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SwitchCHRspParamsType   wdiSwitchChRsp;
+  WDI_SwitchChRspCb           wdiChSwitchRspCb;
+  tSwitchChannelRspParams     halSwitchChannelRsp;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiChSwitchRspCb = (WDI_SwitchChRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halSwitchChannelRsp, 
+                  (wpt_uint8*)pEventData->pEventData,
+                  sizeof(halSwitchChannelRsp));
+
+  wdiSwitchChRsp.wdiStatus   =  
+               WDI_HAL_2_WDI_STATUS(halSwitchChannelRsp.status); 
+  wdiSwitchChRsp.ucChannel = halSwitchChannelRsp.channelNumber;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  wdiSwitchChRsp.ucTxMgmtPower =  halSwitchChannelRsp.txMgmtPower; 
+#endif
+
+  /*Notify UMAC*/
+  wdiChSwitchRspCb( &wdiSwitchChRsp, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessChannelSwitchRsp*/
+
+
+/**
+ @brief Process Config STA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigStaRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_ConfigSTARspParamsType    wdiCfgSTAParams;
+  WDI_ConfigSTARspCb            wdiConfigSTARspCb;
+  WDI_AddStaParams              wdiAddSTAParam;
+
+  WDI_BSSSessionType*           pBSSSes             = NULL;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
+
+  tConfigStaRspMsg              halConfigStaRsp; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiConfigSTARspCb = (WDI_ConfigSTARspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halConfigStaRsp.configStaRspParams, 
+                  pEventData->pEventData, 
+                  sizeof(halConfigStaRsp.configStaRspParams));
+
+
+  wdiCfgSTAParams.ucSTAIdx    = halConfigStaRsp.configStaRspParams.staIdx;
+  wdiCfgSTAParams.ucBssIdx    = halConfigStaRsp.configStaRspParams.bssIdx;
+  wdiCfgSTAParams.ucUcastSig  = halConfigStaRsp.configStaRspParams.ucUcastSig;
+  wdiCfgSTAParams.ucBcastSig  = halConfigStaRsp.configStaRspParams.ucBcastSig;
+  wdiCfgSTAParams.ucMgmtSig   = halConfigStaRsp.configStaRspParams.ucMgmtSig;
+
+   /* MAC Address of STA - take from cache as it does not come back in the
+   response*/
+   wpalMemoryCopy( wdiCfgSTAParams.macSTA,
+          pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA, 
+          WDI_MAC_ADDR_LEN);
+  
+  wdiCfgSTAParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halConfigStaRsp.configStaRspParams.status); 
+
+  wdiCfgSTAParams.ucDpuIndex = halConfigStaRsp.configStaRspParams.dpuIndex;
+  wdiCfgSTAParams.ucBcastDpuIndex = halConfigStaRsp.configStaRspParams.bcastDpuIndex;
+  wdiCfgSTAParams.ucBcastMgmtDpuIdx = halConfigStaRsp.configStaRspParams.bcastMgmtDpuIdx;
+
+  if ( WDI_STATUS_SUCCESS == wdiCfgSTAParams.wdiStatus )
+  {
+    if ( WDI_ADD_STA == pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiAction )
+    {
+      /* ADD STA to table */
+      wdiAddSTAParam.ucSTAIdx = halConfigStaRsp.configStaRspParams.staIdx; 
+      wdiAddSTAParam.dpuSig   = halConfigStaRsp.configStaRspParams.ucUcastSig;
+      wdiAddSTAParam.dpuIndex = halConfigStaRsp.configStaRspParams.dpuIndex;
+       
+      /*This info can be retrieved from the cached initial request*/
+      wdiAddSTAParam.ucWmmEnabled = 
+        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.ucWMMEnabled;
+      wdiAddSTAParam.ucHTCapable  = 
+        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.ucHTCapable; 
+      wdiAddSTAParam.ucStaType    = 
+        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiSTAType;  
+   
+      /* MAC Address of STA */
+      wpalMemoryCopy(wdiAddSTAParam.staMacAddr, 
+                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA, 
+                     WDI_MAC_ADDR_LEN);
+  
+      wpalMemoryCopy(wdiAddSTAParam.macBSSID, 
+                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID , 
+                     WDI_MAC_ADDR_LEN); 
+  
+      ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                    pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID, 
+                    &pBSSSes);  
+
+      if ( NULL == pBSSSes )
+      {
+        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "Association for this BSSID is not in place");
+    
+        WDI_ASSERT(0);
+        return WDI_STATUS_E_NOT_ALLOWED; 
+      }
+
+      /*Add BSS specific parameters*/
+      wdiAddSTAParam.bcastMgmtDpuIndex = 
+         halConfigStaRsp.configStaRspParams.bcastMgmtDpuIdx;
+      wdiAddSTAParam.bcastMgmtDpuSignature = 
+         halConfigStaRsp.configStaRspParams.ucMgmtSig;
+      wdiAddSTAParam.bcastDpuIndex  = 
+         halConfigStaRsp.configStaRspParams.bcastDpuIndex;
+      wdiAddSTAParam.bcastDpuSignature = 
+         halConfigStaRsp.configStaRspParams.ucBcastSig;
+      wdiAddSTAParam.ucRmfEnabled          = pBSSSes->ucRmfEnabled;
+      wdiAddSTAParam.ucBSSIdx              = ucCurrentBSSSesIdx;
+      
+      WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
+    }
+    if( WDI_UPDATE_STA == pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiAction )
+    {
+       WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuIndex = 
+          halConfigStaRsp.configStaRspParams.bcastDpuIndex;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuSignature = 
+          halConfigStaRsp.configStaRspParams.ucBcastSig;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuIndex = 
+          halConfigStaRsp.configStaRspParams.bcastMgmtDpuIdx;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuSignature = 
+          halConfigStaRsp.configStaRspParams.ucMgmtSig;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bssIdx = 
+          halConfigStaRsp.configStaRspParams.bssIdx;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuIndex = 
+          halConfigStaRsp.configStaRspParams.dpuIndex;
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuSig = 
+          halConfigStaRsp.configStaRspParams.ucUcastSig;
+    }
+  }
+
+  /*Notify UMAC*/
+  wdiConfigSTARspCb( &wdiCfgSTAParams, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessConfigStaRsp*/
+
+
+/**
+ @brief Process Set Link State Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetLinkStateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status              wdiStatus;
+  eHalStatus              halStatus;
+  WDI_SetLinkStateRspCb   wdiSetLinkStateRspCb;
+
+  WDI_BSSSessionType*     pBSSSes              = NULL;
+  wpt_uint8               ucCurrentBSSSesIdx   = 0; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetLinkStateRspCb = (WDI_SetLinkStateRspCb)pWDICtx->pfncRspCB;
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  /*If the link is being transitioned to idle - the BSS is to be deleted
+  - this type of ending a session is possible when UMAC has failed an
+  - association session during Join*/
+  if ( WDI_LINK_IDLE_STATE == 
+       pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.wdiLinkState )
+  {
+    /*------------------------------------------------------------------------
+      Find the BSS for which the request is made 
+    ------------------------------------------------------------------------*/
+    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                        pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.macBSSID, 
+                        &pBSSSes); 
+  
+    /*-----------------------------------------------------------------------
+      Del BSS response can only be received for an existing assoc that
+      is current and in progress 
+      -----------------------------------------------------------------------*/
+    if ( NULL == pBSSSes )
+    {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                "Set link response received outside association session");
+    }
+    else
+    {
+      /* For BT AMP roles no need to delete the sessions if assoc fails. There
+      will be del BSS coming after this to stop the beaconing & cleaning up the
+      sessions*/
+      if(( WDI_BTAMP_STA_MODE != pBSSSes->wdiBssType )&&
+         ( WDI_BTAMP_AP_MODE != pBSSSes->wdiBssType ))
+      {
+         /*-----------------------------------------------------------------------
+           The current session will be deleted 
+         -----------------------------------------------------------------------*/
+         WDI_DeleteSession(pWDICtx, pBSSSes);
+
+         /*-----------------------------------------------------------------------
+           Check to see if this association is in progress - if so disable the
+           flag as this has ended
+         -----------------------------------------------------------------------*/
+         if ( ucCurrentBSSSesIdx == pWDICtx->ucCurrentBSSSesIdx )
+         {  
+           /*Association no longer in progress  */
+           pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+           /*Association no longer in progress - prepare pending assoc for processing*/
+           WDI_DequeueAssocRequest(pWDICtx);
+         }
+      }
+    }
+  }
+  /* If the link state has been set to POST ASSOC, reset the "association in
+     progress" flag */
+  if ( WDI_LINK_POSTASSOC_STATE == 
+       pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.wdiLinkState )
+  {
+     pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
+     WDI_DequeueAssocRequest(pWDICtx);
+  }
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiSetLinkStateRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetLinkStateRsp*/
+
+/**
+ @brief Process Get Stats Rsp function (called when a response is   
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGetStatsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_GetStatsRspParamsType   *wdiGetStatsRsp;
+  WDI_GetStatsRspCb           wdiGetStatsRspCb;
+  tHalStatsRspParams*         pHalStatsRspParams;
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  pHalStatsRspParams = (tHalStatsRspParams *)pEventData->pEventData;
+
+  /*allocate the stats response buffer */
+  wdiGetStatsRsp = (WDI_GetStatsRspParamsType *)wpalMemoryAllocate(
+              pHalStatsRspParams->msgLen - sizeof(tHalStatsRspParams)
+              + sizeof(WDI_GetStatsRspParamsType));
+
+  if(NULL == wdiGetStatsRsp)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Failed to allocate memory in Get Stats Response %x %x %x ",
+                 pWDICtx, pEventData, pEventData->pEventData);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiGetStatsRspCb = (WDI_GetStatsRspCb)pWDICtx->pfncRspCB;
+
+  wpalMemoryZero(wdiGetStatsRsp, pHalStatsRspParams->msgLen);
+  wdiGetStatsRsp->usMsgType  = pHalStatsRspParams->msgType;
+  wdiGetStatsRsp->usMsgLen   = pHalStatsRspParams->msgLen;
+  wdiGetStatsRsp->wdiStatus  = WDI_HAL_2_WDI_STATUS(pHalStatsRspParams->status);
+  wdiGetStatsRsp->ucSTAIdx   = pHalStatsRspParams->staId;
+  wdiGetStatsRsp->uStatsMask = pHalStatsRspParams->statsMask;
+
+  /* copy the stats from buffer at the end of the tHalStatsRspParams message */
+  wpalMemoryCopy(wdiGetStatsRsp + 1,
+   (wpt_uint8*)pEventData->pEventData + sizeof(tHalStatsRspParams),
+   pHalStatsRspParams->msgLen - sizeof(tHalStatsRspParams));
+
+  /*Notify UMAC*/
+  wdiGetStatsRspCb( wdiGetStatsRsp, pWDICtx->pRspCBUserData);
+
+  wpalMemoryFree(wdiGetStatsRsp);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessGetStatsRsp*/
+
+
+/**
+ @brief Process Update Cfg Rsp function (called when a response is  
+        being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateCfgRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_UpdateCfgRspCb   wdiUpdateCfgRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiUpdateCfgRspCb = (WDI_UpdateCfgRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiUpdateCfgRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUpdateCfgRsp*/
+
+
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAddBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_AddBARspCb          wdiAddBARspCb;
+
+  tAddBARspParams         halAddBARsp;
+  WDI_AddBARspinfoType    wdiAddBARsp;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiAddBARspCb = (WDI_AddBARspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halAddBARsp, 
+                  pEventData->pEventData, 
+                  sizeof(halAddBARsp));
+
+  wdiAddBARsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halAddBARsp.status);
+
+  if ( eHAL_STATUS_SUCCESS == wdiAddBARsp.wdiStatus )
+  {
+    wdiAddBARsp.ucBaDialogToken = halAddBARsp.baDialogToken;
+  }
+
+  /*Notify UMAC*/
+  wdiAddBARspCb( &wdiAddBARsp, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddSessionBARsp*/
+
+/**
+ @brief Process Add BA Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTriggerBARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_TriggerBARspCb      wdiTriggerBARspCb;
+
+  tTriggerBARspParams*           halTriggerBARsp;
+  tTriggerBaRspCandidate*        halBaCandidate;
+  WDI_TriggerBARspParamsType*    wdiTriggerBARsp;
+  WDI_TriggerBARspCandidateType* wdiTriggerBARspCandidate;
+  wpt_uint16                     index;
+  wpt_uint16                     TidIndex;
+  
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiTriggerBARspCb = (WDI_TriggerBARspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halTriggerBARsp = (tTriggerBARspParams *)pEventData->pEventData;
+
+  wdiTriggerBARsp = wpalMemoryAllocate(sizeof(WDI_TriggerBARspParamsType) + 
+                      halTriggerBARsp->baCandidateCnt * 
+                      sizeof(WDI_TriggerBARspCandidateType));
+  if(NULL == wdiTriggerBARsp)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                "Failed to allocate memory in Trigger BA Response %x %x %x ",
+                 pWDICtx, pEventData, pEventData->pEventData);
+    wpalMemoryFree(halTriggerBARsp);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiTriggerBARsp->wdiStatus = WDI_HAL_2_WDI_STATUS(halTriggerBARsp->status);
+
+  if ( WDI_STATUS_SUCCESS == wdiTriggerBARsp->wdiStatus)
+  {
+    wdiTriggerBARsp->usBaCandidateCnt = halTriggerBARsp->baCandidateCnt;
+    wpalMemoryCopy(wdiTriggerBARsp->macBSSID, 
+                                 halTriggerBARsp->bssId , WDI_MAC_ADDR_LEN);
+
+    wdiTriggerBARspCandidate = (WDI_TriggerBARspCandidateType*)(wdiTriggerBARsp + 1);
+    halBaCandidate = (tTriggerBaRspCandidate*)(halTriggerBARsp + 1);
+
+    for(index = 0; index < wdiTriggerBARsp->usBaCandidateCnt; index++)
+    {
+      wpalMemoryCopy(wdiTriggerBARspCandidate->macSTA, 
+                                  halBaCandidate->staAddr, WDI_MAC_ADDR_LEN);
+      for(TidIndex = 0; TidIndex < STA_MAX_TC; TidIndex++)
+      {
+        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].fBaEnable = 
+                            halBaCandidate->baInfo[TidIndex].fBaEnable;
+        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].startingSeqNum = 
+                            halBaCandidate->baInfo[TidIndex].startingSeqNum;
+      }
+      wdiTriggerBARspCandidate++;
+      halBaCandidate++;
+    }
+  }
+
+  /*Notify UMAC*/
+  wdiTriggerBARspCb( wdiTriggerBARsp, pWDICtx->pRspCBUserData);
+
+  wpalMemoryFree(wdiTriggerBARsp);
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddSessionBARsp*/
+
+/**
+ @brief Process Update Beacon Params Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateBeaconParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_UpdateBeaconParamsRspCb   wdiUpdateBeaconParamsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiUpdateBeaconParamsRspCb = (WDI_UpdateBeaconParamsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiUpdateBeaconParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUpdateBeaconParamsRsp*/
+
+/**
+ @brief Process Send Beacon template Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSendBeaconParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_SendBeaconParamsRspCb   wdiSendBeaconParamsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSendBeaconParamsRspCb = (WDI_SendBeaconParamsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiSendBeaconParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSendBeaconParamsRsp*/
+
+  
+/**
+ @brief Process Update Probe Resp Template Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateProbeRspTemplateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_UpdateProbeRspTemplateRspCb   wdiUpdProbeRspTemplRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiUpdProbeRspTemplRspCb = (WDI_UpdateProbeRspTemplateRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiUpdProbeRspTemplRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUpdateProbeRspTemplateRsp*/
+
+  /**
+ @brief Process Set Max Tx Power Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetMaxTxPowerRsp
+( 
+  WDI_ControlBlockType*          pWDICtx,
+  WDI_EventInfoType*             pEventData
+)
+{
+  tSetMaxTxPwrRspMsg             halTxpowerrsp;
+  
+  WDI_SetMaxTxPowerRspMsg        wdiSetMaxTxPowerRspMsg;
+  
+  WDA_SetMaxTxPowerRspCb         wdiReqStatusCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiReqStatusCb = (WDA_SetMaxTxPowerRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halTxpowerrsp.setMaxTxPwrRspParams, 
+                           pEventData->pEventData, 
+                           sizeof(halTxpowerrsp.setMaxTxPwrRspParams)); 
+
+  if ( eHAL_STATUS_SUCCESS != halTxpowerrsp.setMaxTxPwrRspParams.status )
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Error status returned in Set Max Tx Power Response ");
+     WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetMaxTxPowerRspMsg.wdiStatus = 
+         WDI_HAL_2_WDI_STATUS(halTxpowerrsp.setMaxTxPwrRspParams.status);
+  wdiSetMaxTxPowerRspMsg.ucPower  = halTxpowerrsp.setMaxTxPwrRspParams.power; 
+
+  /*Notify UMAC*/
+  wdiReqStatusCb( &wdiSetMaxTxPowerRspMsg, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}
+
+#ifdef WLAN_FEATURE_P2P
+/**
+ @brief Process P2P Group Owner Notice Of Absense Rsp function (called 
+        when a response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2PGONOARsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status       wdiStatus;
+  eHalStatus       halStatus;
+  WDI_SetP2PGONOAReqParamsRspCb   wdiP2PGONOAReqParamsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiP2PGONOAReqParamsRspCb = (WDI_SetP2PGONOAReqParamsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
+                  sizeof(halStatus));
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiP2PGONOAReqParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessP2PGONOARsp*/
+#endif
+/**
+ @brief Process Enter IMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterImpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_EnterImpsRspCb   wdiEnterImpsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiEnterImpsRspCb = (WDI_EnterImpsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiEnterImpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessEnterImpsRsp*/
+
+/**
+ @brief Process Exit IMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitImpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_ExitImpsRspCb    wdiExitImpsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiExitImpsRspCb = (WDI_ExitImpsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  // notify DTS that we are entering Full power
+  WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
+
+  /*Notify UMAC*/
+  wdiExitImpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessExitImpsRsp*/
+
+/**
+ @brief Process Enter BMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterBmpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_EnterBmpsRspCb   wdiEnterBmpsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiEnterBmpsRspCb = (WDI_EnterBmpsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiEnterBmpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessEnterBmpsRsp*/
+
+/**
+ @brief Process Exit BMPS Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitBmpsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_ExitBmpsRspCb   wdiExitBmpsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiExitBmpsRspCb = (WDI_ExitBmpsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  // notify DTS that we are entering Full power
+  WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
+
+  pWDICtx->bInBmps = eWLAN_PAL_FALSE;
+
+  /*Notify UMAC*/
+  wdiExitBmpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessExitBmpsRsp*/
+
+/**
+ @brief Process Enter UAPSD Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEnterUapsdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_EnterUapsdRspCb   wdiEnterUapsdRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiEnterUapsdRspCb = (WDI_EnterUapsdRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  if(WDI_STATUS_SUCCESS == wdiStatus)
+  {
+   // Set the DPU routing flag to the FW WQ, all the TX frames would be now pushed
+   // from DPU to the FW-WQ (5) in UAPSD. FW would be in data path, monitoring
+   // the traffic to decide when to suspend the trigger frames when there is no traffic
+   // activity on the trigger enabled ACs
+   pWDICtx->ucDpuRF = BMUWQ_FW_DPU_TX;
+
+#ifdef WLAN_PERF
+   // Increment the BD signature to refresh the fast path BD utilization
+   pWDICtx->uBdSigSerialNum++;
+#endif
+  }
+
+  /*Notify UMAC*/
+  wdiEnterUapsdRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessEnterUapsdRsp*/
+
+/**
+ @brief Process Exit UAPSD Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessExitUapsdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_ExitUapsdRspCb   wdiExitUapsdRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiExitUapsdRspCb = (WDI_ExitUapsdRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   // Restore back the DPU routing flag in the TxBD, for DPU to push the TxBDs to BTQM
+   // directly instead of the FW WQ.
+   pWDICtx->ucDpuRF = BMUWQ_BTQM_TX_MGMT;
+
+#ifdef WLAN_PERF
+   // Increment the BD signature to refresh the fast path BD utilization
+   pWDICtx->uBdSigSerialNum++;
+#endif
+
+  /*Notify UMAC*/
+  wdiExitUapsdRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessExitUapsdRsp*/
+
+/**
+ @brief Process set UAPSD params Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetUapsdAcParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_SetUapsdAcParamsCb   wdiSetUapsdAcParamsCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiSetUapsdAcParamsCb = (WDI_SetUapsdAcParamsCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiSetUapsdAcParamsCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetUapsdAcParamsRsp*/
+
+/**
+ @brief Process update UAPSD params Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateUapsdParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_UpdateUapsdParamsCb   wdiUpdateUapsdParamsCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiUpdateUapsdParamsCb = (WDI_UpdateUapsdParamsCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiUpdateUapsdParamsCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUpdateUapsdParamsRsp*/
+
+/**
+ @brief Process Configure RXP filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureRxpFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_ConfigureRxpFilterCb   wdiConfigureRxpFilterCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiConfigureRxpFilterCb = (WDI_ConfigureRxpFilterCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  wdiConfigureRxpFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessConfigureRxpFilterRsp*/
+
+/**
+ @brief Process Set beacon filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBeaconFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_SetBeaconFilterCb   wdiBeaconFilterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiBeaconFilterCb = (WDI_SetBeaconFilterCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiBeaconFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetBeaconFilterRsp*/
+
+/**
+ @brief Process remove beacon filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessRemBeaconFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_RemBeaconFilterCb   wdiBeaconFilterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiBeaconFilterCb = (WDI_RemBeaconFilterCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiBeaconFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessRemBeaconFilterRsp*/
+
+/**
+ @brief Process set RSSI thresholds Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRSSIThresoldsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_SetRSSIThresholdsCb   wdiRSSIThresholdsCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiRSSIThresholdsCb = (WDI_SetRSSIThresholdsCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiRSSIThresholdsCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetRSSIThresoldsRsp*/
+
+/**
+ @brief Process host offload Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostOffloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_HostOffloadCb    wdiHostOffloadCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiHostOffloadCb = (WDI_HostOffloadCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiHostOffloadCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessHostOffloadRsp*/
+
+/**
+ @brief Process keep alive Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessKeepAliveRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_KeepAliveCb      wdiKeepAliveCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Received WDI_ProcessKeepAliveRsp Callback from HAL");
+
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiKeepAliveCb = (WDI_KeepAliveCb)pWDICtx->pfncRspCB; 
+   
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiKeepAliveCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessKeepAliveRsp*/
+
+/**
+ @brief Process wowl add ptrn Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlAddBcPtrnRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_WowlAddBcPtrnCb    wdiWowlAddBcPtrnCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiWowlAddBcPtrnCb = (WDI_WowlAddBcPtrnCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiWowlAddBcPtrnCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessWowlAddBcPtrnRsp*/
+
+/**
+ @brief Process wowl delete ptrn Rsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlDelBcPtrnRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_WowlDelBcPtrnCb    wdiWowlDelBcPtrnCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiWowlDelBcPtrnCb = (WDI_WowlDelBcPtrnCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiWowlDelBcPtrnCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessWowlDelBcPtrnRsp*/
+
+/**
+ @brief Process wowl enter Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlEnterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_WowlEnterReqCb   wdiWowlEnterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiWowlEnterCb = (WDI_WowlEnterReqCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiWowlEnterCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessWowlEnterRsp*/
+
+/**
+ @brief Process wowl exit Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessWowlExitRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_WowlExitReqCb   wdiWowlExitCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiWowlExitCb = (WDI_WowlExitReqCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiWowlExitCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessWowlExitRsp*/
+
+/**
+ @brief Process Configure Apps CPU wakeup State Rsp function 
+        (called when a response is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessConfigureAppsCpuWakeupStateRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_ConfigureAppsCpuWakeupStateCb   wdiConfigureAppsCpuWakeupStateCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiConfigureAppsCpuWakeupStateCb = (WDI_ConfigureAppsCpuWakeupStateCb)pWDICtx->pfncRspCB;
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiConfigureAppsCpuWakeupStateCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessConfigureAppsCpuWakeupStateRsp*/
+
+
+/**
+ @brief Process Nv download(called when a response
+        is being received over the bus from HAL,will check if the responce is )
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessNvDownloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  WDI_NvDownloadRspCb    wdiNvDownloadRspCb;
+  tHalNvImgDownloadRspParams halNvDownloadRsp;
+  WDI_NvDownloadRspInfoType wdiNvDownloadRsp;
+
+  /*-------------------------------------------------------------------------
+   Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+    ( NULL == pEventData->pEventData))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halNvDownloadRsp, 
+                  pEventData->pEventData, 
+                  sizeof(halNvDownloadRsp));
+
+  wdiNvDownloadRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halNvDownloadRsp.status);
+
+  if((wdiNvDownloadRsp.wdiStatus == WDI_STATUS_SUCCESS) &&
+    (pWDICtx->wdiNvBlobInfo.usCurrentFragment != 
+         pWDICtx->wdiNvBlobInfo.usTotalFragment )) 
+  {
+    WDI_NvDownloadReq(&pWDICtx->wdiCachedNvDownloadReq,
+       (WDI_NvDownloadRspCb)pWDICtx->pfncRspCB, pWDICtx->pRspCBUserData); 
+  }
+  else
+  {
+    /*Reset the Nv related global information in WDI context information */
+    pWDICtx->wdiNvBlobInfo.usTotalFragment = 0;
+    pWDICtx->wdiNvBlobInfo.usFragmentSize = 0;
+    pWDICtx->wdiNvBlobInfo.usCurrentFragment = 0;
+    /*call WDA callback function for last fragment */
+    wdiNvDownloadRspCb = (WDI_NvDownloadRspCb)pWDICtx->pfncRspCB;
+    wdiNvDownloadRspCb( &wdiNvDownloadRsp, pWDICtx->pRspCBUserData);
+  }
+
+  return WDI_STATUS_SUCCESS; 
+}
+#ifdef WLAN_FEATURE_VOWIFI_11R
+/**
+ @brief Process Add TSpec Rsp function (called when a response
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessAggrAddTSpecRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status            wdiStatus;
+  tAggrAddTsRspParams   aggrAddTsRsp;
+  WDI_AggrAddTsRspCb    wdiAggrAddTsRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiAggrAddTsRspCb = (WDI_AddTsRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &aggrAddTsRsp, 
+                  pEventData->pEventData, 
+                  sizeof(aggrAddTsRsp));
+
+  /* What is the difference between status0 and status1? */
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(aggrAddTsRsp.status0); 
+
+  /*Notify UMAC*/
+  wdiAggrAddTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessAddTSpecRsp*/
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+
+/**
+ @brief WDI_ProcessHostResumeRsp function (called when a 
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHostResumeRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_SuspendResumeRspParamsType     wdiResumeRspParams;
+  WDI_HostResumeEventRspCb           wdiHostResumeRspCb;
+  tHalHostResumeRspParams            hostResumeRspMsg;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+    -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiHostResumeRspCb = (WDI_HostResumeEventRspCb)pWDICtx->pfncRspCB;
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+    -------------------------------------------------------------------------*/
+
+  wpalMemoryCopy( &hostResumeRspMsg, 
+      (wpt_uint8*)pEventData->pEventData,
+      sizeof(hostResumeRspMsg));
+
+  wdiResumeRspParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(hostResumeRspMsg.status); 
+
+  /*Notify UMAC*/
+  wdiHostResumeRspCb(&wdiResumeRspParams, (void*) pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS;
+}
+
+/**
+ @brief Process Set Tx PER Rsp function (called when a response 
+        is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPerTrackingRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_SetTxPerTrackingRspCb   pwdiSetTxPerTrackingRspCb;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  
+  pwdiSetTxPerTrackingRspCb = (WDI_SetTxPerTrackingRspCb)pWDICtx->pfncRspCB; 
+
+  /*-------------------------------------------------------------------------
+    Extract response and send it to UMAC
+  -------------------------------------------------------------------------*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Notify UMAC*/
+  pwdiSetTxPerTrackingRspCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetTxPerTrackingRsp*/
+
+/*==========================================================================
+                        Indications from HAL
+ ==========================================================================*/
+/**
+ @brief Process Low RSSI Indication function (called when an 
+        indication of this kind is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessLowRSSIInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tHalRSSINotificationIndMsg   halRSSINotificationIndMsg;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( (void *)&halRSSINotificationIndMsg.rssiNotificationParams, 
+                  pEventData->pEventData, 
+                  sizeof(tHalRSSINotification));
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_RSSI_NOTIFICATION_IND; 
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres1PosCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres1PosCross;
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres1NegCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres1NegCross;
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres2PosCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres2PosCross;
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres2NegCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres2NegCross;
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres3PosCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres3PosCross;
+  wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres3NegCross =
+     halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres3NegCross;
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessLowRSSIInd*/
+
+
+/**
+ @brief Process Missed Beacon Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessMissedBeaconInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_LowLevelIndType  wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  /*! TO DO: Parameters need to be unpacked according to HAL struct*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_MISSED_BEACON_IND; 
+  
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessMissedBeaconInd*/
+
+
+/**
+ @brief Process Unk Addr Frame Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUnkAddrFrameInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_LowLevelIndType  wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  /*! TO DO: Parameters need to be unpacked according to HAL struct*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_UNKNOWN_ADDR2_FRAME_RX_IND; 
+  /* ! TO DO - fill in from HAL struct:
+    wdiInd.wdiIndicationData.wdiUnkAddr2FrmInfo*/
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessUnkAddrFrameInd*/
+
+
+/**
+ @brief Process MIC Failure Indication function (called when an 
+        indication of this kind is being received over the bus
+        from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessMicFailureInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tpSirMicFailureInd   pHalMicFailureInd;
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  
+  pHalMicFailureInd = (tpSirMicFailureInd)pEventData->pEventData;
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_MIC_FAILURE_IND; 
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.bssId,
+                 pHalMicFailureInd->bssId, WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macSrcAddr,
+                 pHalMicFailureInd->info.srcMacAddr, WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macTaAddr,
+                 pHalMicFailureInd->info.taMacAddr, WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macDstAddr,
+                 pHalMicFailureInd->info.dstMacAddr, WDI_MAC_ADDR_LEN);
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucMulticast = 
+                 pHalMicFailureInd->info.multicast;
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucIV1 = 
+                 pHalMicFailureInd->info.IV1;
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.keyId= 
+                 pHalMicFailureInd->info.keyId;
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.TSC,
+                 pHalMicFailureInd->info.TSC,WDI_CIPHER_SEQ_CTR_SIZE);
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macRxAddr,
+                 pHalMicFailureInd->info.rxMacAddr, WDI_MAC_ADDR_LEN);
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessMicFailureInd*/
+
+
+/**
+ @brief Process Fatal Failure Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFatalErrorInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_Status           wdiStatus;
+  eHalStatus           halStatus;
+  WDI_LowLevelIndType  wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+
+  /*! TO DO: Parameters need to be unpacked according to HAL struct*/
+  halStatus = *((eHalStatus*)pEventData->pEventData);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Fatal failure received from device %d ", halStatus );
+  
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND; 
+  wdiInd.wdiIndicationData.usErrorCode = WDI_ERR_DEV_INTERNAL_FAILURE; 
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessFatalErrorInd*/
+
+/**
+ @brief Process Delete STA Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessDelSTAInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  tDeleteStaContextParams    halDelSTACtx;
+  WDI_LowLevelIndType        wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+
+  /* Parameters need to be unpacked according to HAL struct*/
+  wpalMemoryCopy( &halDelSTACtx, 
+                  pEventData->pEventData, 
+                  sizeof(halDelSTACtx));
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType             = WDI_DEL_STA_IND; 
+
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiDeleteSTAIndType.macADDR2,
+                 halDelSTACtx.addr2, WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiDeleteSTAIndType.macBSSID,
+                 halDelSTACtx.bssId, WDI_MAC_ADDR_LEN);
+
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.usAssocId = 
+    halDelSTACtx.assocId;
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.ucSTAIdx  = 
+    halDelSTACtx.staId;
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.wptReasonCode = 
+    halDelSTACtx.reasonCode; 
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessDelSTAInd*/
+
+/**
+*@brief Process Coex Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessCoexInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tCoexIndMsg          halCoexIndMsg;
+  wpt_uint32           index;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT( 0 );
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halCoexIndMsg.coexIndParams, 
+                  pEventData->pEventData, 
+                  sizeof(halCoexIndMsg.coexIndParams) );
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_COEX_IND; 
+  wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType = halCoexIndMsg.coexIndParams.coexIndType; 
+  for (index = 0; index < WDI_COEX_IND_DATA_SIZE; index++)
+  {
+    wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[index] = halCoexIndMsg.coexIndParams.coexIndData[index]; 
+  }
+
+  // DEBUG
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+              "[COEX WDI] Coex Ind Type (%x) data (%x %x %x %x)",
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType, 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[0], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[1], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[2], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[3] ); 
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessCoexInd*/
+
+/**
+*@brief Process Tx Complete Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTxCompleteInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tTxComplIndMsg       halTxComplIndMsg;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT( 0 );
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halTxComplIndMsg.txComplParams, 
+                  pEventData->pEventData, 
+                  sizeof(halTxComplIndMsg.txComplParams) );
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_TX_COMPLETE_IND; 
+  wdiInd.wdiIndicationData.tx_complete_status 
+                               = halTxComplIndMsg.txComplParams.status; 
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessTxCompleteInd*/
+
+#ifdef WLAN_FEATURE_P2P
+/**
+*@brief Process Noa Attr Indication function (called when
+        an indication of this kind is being received over the
+        bus from HAL)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessP2pNoaAttrInd
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tNoaAttrIndMsg       halNoaAttrIndMsg;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT( 0 );
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( &halNoaAttrIndMsg.noaAttrIndParams,
+                  pEventData->pEventData,
+                  sizeof(halNoaAttrIndMsg.noaAttrIndParams) );
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_P2P_NOA_ATTR_IND;
+  
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.status
+                          = halNoaAttrIndMsg.noaAttrIndParams.status;
+  
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.ucIndex
+                          = halNoaAttrIndMsg.noaAttrIndParams.index;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.ucOppPsFlag
+                          = halNoaAttrIndMsg.noaAttrIndParams.oppPsFlag;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usCtWin
+                          = halNoaAttrIndMsg.noaAttrIndParams.ctWin;
+  
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usNoa1IntervalCnt
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa1IntervalCnt;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Duration
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa1Duration;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Interval
+                             = halNoaAttrIndMsg.noaAttrIndParams.uNoa1Interval;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1StartTime
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa1StartTime;
+  
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usNoa2IntervalCnt
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa2IntervalCnt;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Duration
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa2Duration;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Interval
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa2Interval;
+  wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2StartTime
+                          = halNoaAttrIndMsg.noaAttrIndParams.uNoa2StartTime;
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+
+  return WDI_STATUS_SUCCESS;
+}/*WDI_ProcessNoaAttrInd*/
+#endif
+
+/**
+ @brief Process Tx PER Hit Indication function (called when 
+        an indication of this kind is being received over the
+        bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTxPerHitInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_TX_PER_HIT_IND; 
+  
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessTxPerHitInd*/
+
+#ifdef ANI_MANF_DIAG
+/**
+ @brief WDI_ProcessFTMCommandReq
+        Process FTM Command, simply route to HAL
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFTMCommandReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_FTMCommandReqType  *ftmCommandReq = NULL;
+  wpt_uint8              *ftmCommandBuffer = NULL;
+  wpt_uint16              dataOffset;
+  wpt_uint16              bufferSize;
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  ftmCommandReq = (WDI_FTMCommandReqType *)pEventData->pEventData;
+
+  /* Get MSG Buffer */
+  WDI_GetMessageBuffer(pWDICtx,
+                       WDI_FTM_CMD_REQ,
+                       ftmCommandReq->bodyLength,
+                       &ftmCommandBuffer,
+                       &dataOffset,
+                       &bufferSize);
+
+  wpalMemoryCopy(ftmCommandBuffer + dataOffset,
+                 ftmCommandReq->FTMCommandBody,
+                 ftmCommandReq->bodyLength);
+
+  /* Send MSG */
+  return WDI_SendMsg(pWDICtx,
+                     ftmCommandBuffer,
+                     bufferSize,
+                     pEventData->pCBfnc,
+                     pEventData->pUserData,
+                     WDI_FTM_CMD_RESP);
+}
+
+/**
+ @brief WDI_ProcessFTMCommandRsp
+        Process FTM Command Response from HAL, simply route to HDD FTM
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFTMCommandRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_FTMCommandRspCb   ftmCMDRspCb;
+  tProcessPttRspParams *ftmCMDRspData = NULL;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  ftmCMDRspCb = (WDI_FTMCommandRspCb)pWDICtx->pfncRspCB;
+
+  ftmCMDRspData = (tProcessPttRspParams *)pEventData->pEventData;
+
+  wpalMemoryCopy((void *)pWDICtx->ucFTMCommandRspBuffer, 
+                 (void *)&ftmCMDRspData->pttMsgBuffer, 
+                 ftmCMDRspData->pttMsgBuffer.msgBodyLength);
+
+  /*Notify UMAC*/
+  ftmCMDRspCb((void *)pWDICtx->ucFTMCommandRspBuffer, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}
+#endif /* ANI_MANF_DIAG */
+/**
+ @brief WDI_ProcessHalDumpCmdReq
+        Process hal dump Command, simply route to HAL
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHALDumpCmdReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_HALDumpCmdReqParamsType*  pwdiHALDumpCmdParams = NULL;
+  WDI_HALDumpCmdRspCb           wdiHALDumpCmdRspCb = NULL;
+  wpt_uint16               usDataOffset        = 0;
+  wpt_uint16               usSendSize          = 0;
+  tHalDumpCmdReqMsg        halDumpCmdReqMsg;
+  wpt_uint8*               pSendBuffer         = NULL; 
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData) ||
+      ( NULL == pEventData->pCBfnc ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  pwdiHALDumpCmdParams = (WDI_HALDumpCmdReqParamsType*)pEventData->pEventData;
+  wdiHALDumpCmdRspCb   = (WDI_HALDumpCmdRspCb)pEventData->pCBfnc;
+
+  /* Copying the HAL DUMP Command Information HAL Structure*/
+  halDumpCmdReqMsg.dumpCmdReqParams.argument1 = 
+                pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.command;
+  halDumpCmdReqMsg.dumpCmdReqParams.argument2 = 
+                pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument1;
+  halDumpCmdReqMsg.dumpCmdReqParams.argument3 = 
+                pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument2;
+  halDumpCmdReqMsg.dumpCmdReqParams.argument4 = 
+                pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument3;
+  halDumpCmdReqMsg.dumpCmdReqParams.argument5 = 
+                pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument4;
+  
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HAL_DUMP_CMD_REQ, 
+                        sizeof(halDumpCmdReqMsg.dumpCmdReqParams),
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < 
+            (usDataOffset + sizeof(halDumpCmdReqMsg.dumpCmdReqParams) )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+              "Unable to get send buffer in HAL Dump Command req %x %x %x",
+                pEventData, pwdiHALDumpCmdParams, wdiHALDumpCmdRspCb);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDumpCmdReqMsg.dumpCmdReqParams, 
+                  sizeof(halDumpCmdReqMsg.dumpCmdReqParams)); 
+
+  pWDICtx->wdiReqStatusCB     = pwdiHALDumpCmdParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiHALDumpCmdParams->pUserData; 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHALDumpCmdRspCb, pEventData->pUserData, 
+                        WDI_HAL_DUMP_CMD_RESP); 
+}
+
+/**
+ @brief WDI_ProcessHalDumpCmdRsp
+        Process hal Dump Command Response from HAL, simply route to HDD 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessHALDumpCmdRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_HALDumpCmdRspCb     wdiHALDumpCmdRspCb;
+  tpHalDumpCmdRspParams   halDumpCmdRspParams;
+  WDI_HALDumpCmdRspParamsType wdiHALDumpCmdRsp;
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  wdiHALDumpCmdRspCb = (WDI_HALDumpCmdRspCb)pWDICtx->pfncRspCB; 
+
+  /*Initialize the WDI Response structure */
+  wdiHALDumpCmdRsp.usBufferLen = 0;
+  wdiHALDumpCmdRsp.pBuffer = NULL;
+
+  halDumpCmdRspParams = (tHalDumpCmdRspParams *)pEventData->pEventData;
+  
+  wdiHALDumpCmdRsp.wdiStatus   = 
+              WDI_HAL_2_WDI_STATUS(halDumpCmdRspParams->status); 
+
+  if (( wdiHALDumpCmdRsp.wdiStatus  ==  WDI_STATUS_SUCCESS) &&
+      (halDumpCmdRspParams->rspLength != 0))
+  {
+      /* Copy the response data */
+      wdiHALDumpCmdRsp.usBufferLen = halDumpCmdRspParams->rspLength;
+      wdiHALDumpCmdRsp.pBuffer = wpalMemoryAllocate(halDumpCmdRspParams->rspLength);
+      wpalMemoryCopy( &halDumpCmdRspParams->rspBuffer, 
+                  wdiHALDumpCmdRsp.pBuffer, 
+                  sizeof(wdiHALDumpCmdRsp.usBufferLen));
+  }
+  
+  /*Notify UMAC*/
+  wdiHALDumpCmdRspCb(&wdiHALDumpCmdRsp, pWDICtx->pRspCBUserData);
+
+  if(wdiHALDumpCmdRsp.pBuffer != NULL)
+  {
+    /* Free the allocated buffer */
+    wpalMemoryFree(wdiHALDumpCmdRsp.pBuffer);
+  }
+  return WDI_STATUS_SUCCESS;
+}
+
+/*==========================================================================
+                     CONTRL TRANSPORT INTERACTION
+ 
+    Callback function registered with the control transport - for receiving
+    notifications and packets 
+==========================================================================*/
+/**
+ @brief    This callback is invoked by the control transport 
+   when it wishes to send up a notification like the ones
+   mentioned above.
+ 
+ @param
+    
+    wctsHandle:       handle to the control transport service 
+    wctsEvent:        the event being notified
+    wctsNotifyCBData: the callback data of the user 
+    
+ @see  WCTS_OpenTransport
+  
+ @return None 
+*/
+void 
+WDI_NotifyMsgCTSCB
+(
+  WCTS_HandleType        wctsHandle, 
+  WCTS_NotifyEventType   wctsEvent,
+  void*                  wctsNotifyCBData
+)
+{
+  WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)wctsNotifyCBData; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if (NULL == pWDICtx )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return; 
+  }
+
+  if (WDI_CONTROL_BLOCK_MAGIC != pWDICtx->magic)
+  {
+    /* callback presumably occurred after close */
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid control block", __FUNCTION__);
+    return; 
+  }
+
+  if ( WCTS_EVENT_OPEN == wctsEvent )
+  {
+    /*Flag must be set atomically as it is checked from incoming request
+      functions*/
+    wpalMutexAcquire(&pWDICtx->wptMutex);
+    pWDICtx->bCTOpened   = eWLAN_PAL_TRUE; 
+
+    /*Nothing to do - so try to dequeue any pending request that may have
+     occurred while we were trying to establish this*/
+    WDI_DequeuePendingReq(pWDICtx);
+    wpalMutexRelease(&pWDICtx->wptMutex);   
+  }
+  else if  ( WCTS_EVENT_CLOSE == wctsEvent ) 
+  {
+    /*Flag must be set atomically as it is checked from incoming request
+      functions*/
+    wpalMutexAcquire(&pWDICtx->wptMutex);
+    pWDICtx->bCTOpened   = eWLAN_PAL_FALSE; 
+
+    /*No other request will be processed from now on - fail all*/
+    WDI_ClearPendingRequests(pWDICtx); 
+    wpalMutexRelease(&pWDICtx->wptMutex);
+
+    /*Notify that the Control Channel is closed */
+    wpalEventSet(&pWDICtx->wctsActionEvent);
+  }
+
+}/*WDI_NotifyMsgCTSCB*/
+
+
+/**
+ @brief    This callback is invoked by the control transport 
+           when it wishes to send up a packet received over the
+           bus.
+ 
+ @param
+    
+    wctsHandle:  handle to the control transport service 
+    pMsg:        the packet
+    uLen:        the packet length
+    wctsRxMsgCBData: the callback data of the user 
+    
+ @see  WCTS_OpenTransport
+  
+ @return None 
+*/
+void 
+WDI_RXMsgCTSCB 
+(
+  WCTS_HandleType       wctsHandle, 
+  void*                 pMsg,
+  wpt_uint32            uLen,
+  void*                 wctsRxMsgCBData
+)
+{
+  tHalMsgHeader          *pHalMsgHeader; 
+  WDI_EventInfoType      wdiEventData; 
+  WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)wctsRxMsgCBData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Sanity check 
+  ------------------------------------------------------------------------*/
+  if ((NULL == pWDICtx ) || ( NULL == pMsg ) || 
+      ( uLen < sizeof(tHalMsgHeader)))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return; 
+  }
+
+  if (WDI_CONTROL_BLOCK_MAGIC != pWDICtx->magic)
+  {
+    /* callback presumably occurred after close */
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid control block", __FUNCTION__);
+    return; 
+  }
+
+  /*The RX Callback is expected to be serialized in the proper control thread 
+    context - so no serialization is necessary here
+    ! - revisit this assumption */
+
+  pHalMsgHeader = (tHalMsgHeader *)pMsg;
+
+  if ( uLen != pHalMsgHeader->msgLen )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Invalid packet received from HAL - catastrophic failure");
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT); 
+    return; 
+  }
+
+  wdiEventData.wdiResponse = HAL_2_WDI_RSP_TYPE( pHalMsgHeader->msgType );
+
+  /*The message itself starts after the header*/
+  wdiEventData.pEventData     = (wpt_uint8*)pMsg + sizeof(tHalMsgHeader);
+  wdiEventData.uEventDataSize = pHalMsgHeader->msgLen - sizeof(tHalMsgHeader);
+  wdiEventData.pCBfnc         = gWDICb.pfncRspCB;
+  wdiEventData.pUserData      = gWDICb.pRspCBUserData;
+
+
+  if ( wdiEventData.wdiResponse ==  pWDICtx->wdiExpectedResponse )
+  {
+    /*Stop the timer as the response was received */
+    /*!UT - check for potential race conditions between stop and response */
+    wpalTimerStop(&pWDICtx->wptResponseTimer);
+  }
+  /* Check if we receive a response message which is not expected */
+  else if ( wdiEventData.wdiResponse < WDI_HAL_IND_MIN )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+               "Received response %s (%d) when expecting %s (%d) - catastrophic failure",
+               WDI_getRespMsgString(wdiEventData.wdiResponse),
+               wdiEventData.wdiResponse, 
+               WDI_getRespMsgString(pWDICtx->wdiExpectedResponse),
+               pWDICtx->wdiExpectedResponse);
+    /* WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT); */
+    return;
+  }
+
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+           "Rx smth from HAL: %d", wdiEventData.wdiResponse);
+
+  /*Post response event to the state machine*/
+  WDI_PostMainEvent(pWDICtx, WDI_RESPONSE_EVENT, &wdiEventData);
+
+}/*WDI_RXMsgCTSCB*/
+
+
+/*========================================================================
+         Internal Helper Routines 
+========================================================================*/
+
+/**
+ @brief WDI_CleanCB - internal helper routine used to clean the 
+        WDI Main Control Block
+ 
+ @param pWDICtx - pointer to the control block
+
+ @return Result of the function call
+*/
+WPT_INLINE WDI_Status
+WDI_CleanCB
+(
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*Clean the WDI Control Block*/
+  wpalMemoryZero( pWDICtx, sizeof(*pWDICtx)); 
+
+  pWDICtx->uGlobalState  = WDI_MAX_ST; 
+  pWDICtx->ucMaxBssids   = WDI_MAX_SUPPORTED_BSS;
+  pWDICtx->ucMaxStations = WDI_MAX_SUPPORTED_STAS;
+
+  WDI_ResetAssocSessions( pWDICtx );
+
+  return WDI_STATUS_SUCCESS;
+}/*WDI_CleanCB*/
+
+
+/**
+ @brief Process request helper function 
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WPT_INLINE WDI_Status
+WDI_ProcessRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*!! Skip sanity check as this is called from the FSM functionss which 
+    already checked these pointers*/
+
+  if (( pEventData->wdiRequest < WDI_MAX_UMAC_IND ) &&
+      ( NULL != pfnReqProcTbl[pEventData->wdiRequest] ))
+  {  
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Calling request processing function for req %s (%d) %x",
+              WDI_getReqMsgString(pEventData->wdiRequest),
+              pEventData->wdiRequest, pfnReqProcTbl[pEventData->wdiRequest]);
+    return pfnReqProcTbl[pEventData->wdiRequest](pWDICtx, pEventData);
+  }
+  else
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Operation %d is not yet implemented ", 
+               pEventData->wdiRequest);
+    return WDI_STATUS_E_NOT_IMPLEMENT;
+  }
+}/*WDI_ProcessRequest*/
+
+
+/**
+ @brief Get message helper function - it allocates memory for a 
+        message that is to be sent to HAL accross the bus and
+        prefixes it with a send message header 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         wdiReqType:      type of the request being sent
+         uBufferLen:      message buffer len
+         pMsgBuffer:      resulting allocated buffer
+         pusDataOffset:    offset in the buffer where the caller
+         can start copying its message data
+         puBufferSize:    the resulting buffer size (offset+buff
+         len)
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_GetMessageBuffer
+( 
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_RequestEnumType    wdiReqType, 
+  wpt_uint16             usBufferLen,
+  wpt_uint8**            pMsgBuffer, 
+  wpt_uint16*            pusDataOffset, 
+  wpt_uint16*            pusBufferSize
+)
+{
+  tHalMsgHeader  halMsgHeader;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /*!! No sanity check here as we trust the called - ! check this assumption 
+    again*/
+
+  /*-------------------------------------------------------------------------
+     Try to allocate message buffer from PAL 
+  -------------------------------------------------------------------------*/
+  *pusBufferSize = sizeof(halMsgHeader) + usBufferLen; 
+  *pMsgBuffer   = (wpt_uint8*)wpalMemoryAllocate(*pusBufferSize);
+  if ( NULL ==  *pMsgBuffer )
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Unable to allocate message buffer for req %s (%d)",
+               WDI_getReqMsgString(wdiReqType),
+               wdiReqType); 
+     WDI_ASSERT(0);
+     return WDI_STATUS_MEM_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+     Fill in the message header
+  -------------------------------------------------------------------------*/
+  halMsgHeader.msgType = WDI_2_HAL_REQ_TYPE(wdiReqType); 
+  halMsgHeader.msgLen  = sizeof(halMsgHeader) + usBufferLen; 
+  *pusDataOffset       = sizeof(halMsgHeader); 
+  wpalMemoryCopy(*pMsgBuffer, &halMsgHeader, sizeof(halMsgHeader)); 
+
+  return WDI_STATUS_SUCCESS; 
+}/*WDI_GetMessageBuffer*/
+
+
+/**
+ @brief Send message helper function - sends a message over the 
+        bus using the control tranport and saves some info in
+        the CB 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pSendBuffer:     buffer to be sent
+  
+         usSendSize          size of the buffer to be sent
+         pRspCb:            response callback - save in the WDI
+         CB
+         pUserData:         user data associated with the
+         callback
+         wdiExpectedResponse: the code of the response that is
+         expected to be rx-ed for this request
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SendMsg
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
+  wpt_uint32             usSendSize, 
+  void*                  pRspCb, 
+  void*                  pUserData,
+  WDI_ResponseEnumType   wdiExpectedResponse
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*------------------------------------------------------------------------
+    Save needed info in the CB 
+  ------------------------------------------------------------------------*/
+  pWDICtx->pRspCBUserData      = pUserData;
+  pWDICtx->pfncRspCB           = pRspCb; 
+  pWDICtx->wdiExpectedResponse = wdiExpectedResponse; 
+
+   /*-----------------------------------------------------------------------
+     Call the CTS to send this message over - free message afterwards
+     - notify transport failure
+     Note: CTS is reponsible for freeing the message buffer.
+   -----------------------------------------------------------------------*/
+   if ( 0 != WCTS_SendMessage( pWDICtx->wctsHandle, (void*)pSendBuffer, usSendSize ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "Failed to send message over the bus - catastrophic failure");
+
+      /*Inform Upper MAC that the request could not go through*/
+      if ( NULL != pWDICtx->wdiReqStatusCB )
+      {
+        pWDICtx->wdiReqStatusCB( WDI_STATUS_E_FAILURE, 
+                                 pWDICtx->pReqStatusUserData ); 
+        //Setting the wdiReqStatusCB and pReqStatusUserData to NULL
+        //just in case the following request fails to set them.
+        pWDICtx->wdiReqStatusCB = NULL;
+        pWDICtx->pReqStatusUserData = NULL;
+      }
+
+      /*Free the buffer to prevent memory leak*/
+      /*wpalMemoryFree( pSendBuffer);
+        WCTS API takes ownership of this pointer and it is therefore in charge
+        of freeing it
+      **/
+      WDI_DetectedDeviceError( pWDICtx, WDI_ERR_TRANSPORT_FAILURE);
+      return WDI_STATUS_E_FAILURE;
+   }
+
+   /*Inform Upper MAC that the request went through*/
+   if ( NULL != pWDICtx->wdiReqStatusCB )
+   {
+     pWDICtx->wdiReqStatusCB( WDI_STATUS_SUCCESS, pWDICtx->pReqStatusUserData); 
+     //Setting the wdiReqStatusCB and pReqStatusUserData to NULL
+     //just in case the following request fails to set them.
+     pWDICtx->wdiReqStatusCB = NULL;
+     pWDICtx->pReqStatusUserData = NULL;
+   }
+
+   /*Start timer for the expected response */
+   wpalTimerStart(&pWDICtx->wptResponseTimer, WDI_RESPONSE_TIMEOUT);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_SendMsg*/
+
+
+
+/**
+ @brief Send indication helper function - sends a message over 
+        the bus using the control transport and saves some info
+        in the CB
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pSendBuffer:     buffer to be sent
+         usSendSize: size of the buffer to be sent
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SendIndication
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
+  wpt_uint32             usSendSize
+)
+{
+   wpt_uint32 uStatus ;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*-----------------------------------------------------------------------
+     Call the CTS to send this message over 
+     Note: CTS is reponsible for freeing the message buffer.
+   -----------------------------------------------------------------------*/
+   uStatus = WCTS_SendMessage( pWDICtx->wctsHandle, 
+                               (void*)pSendBuffer, usSendSize );
+
+   /*Inform Upper MAC about the outcome of the request*/
+   if ( NULL != pWDICtx->wdiReqStatusCB )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                "Send indication status : %d", uStatus);
+
+      pWDICtx->wdiReqStatusCB( (uStatus != 0 ) ? WDI_STATUS_E_FAILURE:
+                                                 WDI_STATUS_SUCCESS, 
+                               pWDICtx->pReqStatusUserData); 
+   }
+
+   /*If sending of the message failed - it is considered catastrophic and
+     indicates an error with the device*/
+   if ( 0 != uStatus)
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                "Failed to send indication over the bus - catastrophic failure"); 
+
+      WDI_DetectedDeviceError( pWDICtx, WDI_ERR_TRANSPORT_FAILURE);
+      return WDI_STATUS_E_FAILURE;
+   }
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_SendIndication*/
+
+
+/**
+ @brief WDI_DetectedDeviceError - called internally by DAL when 
+        it has detected a failure in the device 
+ 
+ @param  pWDICtx:        pointer to the WLAN DAL context 
+         usErrorCode:    error code detected by WDI or received
+                         from HAL
+  
+ @see
+ @return None 
+*/
+void
+WDI_DetectedDeviceError
+(
+  WDI_ControlBlockType*  pWDICtx,
+  wpt_uint16             usErrorCode
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "Device Error detected code: %d - transitioning to stopped state",
+            usErrorCode);
+
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
+  WDI_STATableStop(pWDICtx);
+
+  WDI_ResetAssocSessions(pWDICtx);
+
+  /*Set the expected state transition to stopped - because the device
+  experienced a failure*/
+  pWDICtx->ucExpectedStateTransition =  WDI_STOPPED_ST;
+
+  /*Transition to stopped to fail all incomming requests from this point on*/
+  WDI_STATE_TRANSITION( pWDICtx, WDI_STOPPED_ST); 
+
+  WDI_ClearPendingRequests(pWDICtx); 
+
+  /*TO DO: -  there should be an attempt to reset the device here*/
+
+  wpalMutexRelease(&pWDICtx->wptMutex);
+
+  /*------------------------------------------------------------------------
+    Notify UMAC if a handler is registered
+  ------------------------------------------------------------------------*/
+  if (pWDICtx->wdiLowLevelIndCB)
+  {
+     wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND; 
+     wdiInd.wdiIndicationData.usErrorCode = usErrorCode; 
+
+     pWDICtx->wdiLowLevelIndCB( &wdiInd,  pWDICtx->pIndUserData);
+  }
+}/*WDI_DetectedDeviceError*/
+
+/**
+ @brief    This callback is invoked by the wpt when a timer that 
+           we started on send message has expire - this should
+           never happen - it means device is stuck and cannot
+           reply - trigger catastrophic failure 
+ @param 
+    
+    pUserData: the callback data of the user (ptr to WDI CB)
+    
+ @see 
+ @return None 
+*/
+void 
+WDI_ResponseTimerCB
+(
+  void *pUserData
+)
+{
+  WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)pUserData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if (NULL == pWDICtx )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+    WDI_ASSERT(0);
+    return; 
+  }
+
+  if ( WDI_MAX_RESP != pWDICtx->wdiExpectedResponse )
+  {
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "Timeout occurred while waiting for %s (%d) message from device "
+            " - catastrophic failure", 
+            WDI_getRespMsgString(pWDICtx->wdiExpectedResponse),
+            pWDICtx->wdiExpectedResponse);
+  /* WDI timeout means Riva is not responding or SMD communication to Riva
+   * is not happening. The only possible way to recover from this error
+   * is to initiate SSR from APPS */
+  wpalRivaSubystemRestart();
+  }
+  else
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "Timeout occurred but not waiting for any response %d", 
+                 pWDICtx->wdiExpectedResponse);
+  }
+
+  return; 
+
+}/*WDI_ResponseTimerCB*/
+
+
+/**
+ @brief Process response helper function 
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WPT_INLINE WDI_Status
+WDI_ProcessResponse
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  /* Skip sanity check as this is called from the FSM functions which 
+    already checked these pointers
+    ! - revisit this assumption */
+  if (( pEventData->wdiResponse < WDI_MAX_RESP ) &&
+      ( NULL != pfnRspProcTbl[pEventData->wdiResponse] ))
+  {  
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Calling response processing function for resp %s (%d) %x", 
+              WDI_getRespMsgString(pEventData->wdiResponse),
+              pEventData->wdiResponse, pfnRspProcTbl[pEventData->wdiResponse]);
+    return pfnRspProcTbl[pEventData->wdiResponse](pWDICtx, pEventData);
+  }
+  else
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Operation %d is not yet implemented ", 
+              pEventData->wdiResponse);
+    return WDI_STATUS_E_NOT_IMPLEMENT;
+  }
+}/*WDI_ProcessResponse*/
+
+
+/*=========================================================================
+                   QUEUE SUPPORT UTILITY FUNCTIONS 
+=========================================================================*/
+
+/**
+ @brief    Utility function used by the DAL Core to help queue a 
+           request that cannot be processed right away. 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: - pointer to the evnt info that needs to be
+    queued 
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueuePendingReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  wpt_list_node*      pNode; 
+  WDI_EventInfoType*  pEventDataQueue = wpalMemoryAllocate(sizeof(*pEventData));
+  void*               pEventInfo = NULL; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if ( NULL ==  pEventDataQueue )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Cannot allocate memory for queueing"); 
+    WDI_ASSERT(0);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pEventDataQueue->pCBfnc          = pEventData->pCBfnc;
+  pEventDataQueue->pUserData       = pEventData->pUserData;
+  pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
+  pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
+
+  if( pEventData->uEventDataSize != 0 && pEventData->pEventData != NULL )
+  {
+     pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
+   
+     if ( NULL ==  pEventInfo )
+     {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "Cannot allocate memory for queueing event data info"); 
+       WDI_ASSERT(0);
+       wpalMemoryFree(pEventDataQueue);
+       return WDI_STATUS_MEM_FAILURE;
+     }
+   
+     wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
+
+  }
+  pEventDataQueue->pEventData = pEventInfo;
+
+  /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
+  pNode = (wpt_list_node*)pEventDataQueue; 
+
+  wpal_list_insert_back(&(pWDICtx->wptPendingQueue), pNode); 
+
+  return WDI_STATUS_SUCCESS;
+}/*WDI_QueuePendingReq*/
+
+/**
+ @brief    Callback function for serializing queued message 
+           processing in the control context
+ @param 
+    
+    pMsg - pointer to the message 
+    
+ @see 
+ @return Result of the operation  
+*/
+void 
+WDI_PALCtrlMsgCB
+(
+ wpt_msg *pMsg
+)
+{
+  WDI_EventInfoType*     pEventData = NULL;
+  WDI_ControlBlockType*  pWDICtx    = NULL; 
+  WDI_Status             wdiStatus; 
+  WDI_ReqStatusCb        pfnReqStatusCB; 
+  void*                  pUserData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if (( NULL == pMsg )||
+      ( NULL == (pEventData = (WDI_EventInfoType*)pMsg->ptr)) ||
+      ( NULL == (pWDICtx  = (WDI_ControlBlockType*)pMsg->pContext )))
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Invalid message received on serialize ctrl context API"); 
+    WDI_ASSERT(0);
+    return; 
+  }
+
+  /*Transition back to the state that we had before serialization
+  - serialization transitions us to BUSY to stop any incomming requests
+  ! TO DO L: possible race condition here if a request comes in between the
+   state transition and the post function*/
+
+  WDI_STATE_TRANSITION( pWDICtx, pMsg->val); 
+
+  /*-----------------------------------------------------------------------
+     Check to see what type of event we are serializing
+     - responses are never expected to come through here 
+  -----------------------------------------------------------------------*/
+  switch ( pEventData->wdiRequest )
+  {
+
+  case WDI_STOP_REQ:
+      
+      wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_STOP_EVENT, pEventData);
+      break;
+
+
+  case WDI_NV_DOWNLOAD_REQ:
+      // When WDI State is WDI_STARTED_ST, send WDI request message with event type WDI_REQUEST_EVENT.
+      // In this case, because this request is called from response process, we could call WDI_ProcessRequest() directly.
+      if (pWDICtx->uGlobalState == WDI_STARTED_ST)  
+      {
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: WDI_NV_DOWNLOAD_REQ called in WDI_STARTED_ST - send with WDI_REQUEST_EVENT", __FUNCTION__);
+        wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, pEventData);
+      }
+      else
+      {
+        wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_START_EVENT, pEventData);
+      }
+      
+      break;
+
+  default: 
+    wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, pEventData);
+    break;
+  }/*switch ( pEventData->wdiRequest )*/
+
+  if ( WDI_STATUS_SUCCESS != wdiStatus  )
+  {
+    WDI_ExtractRequestCBFromEvent(pEventData, &pfnReqStatusCB, &pUserData);
+
+    if ( NULL != pfnReqStatusCB )
+    {
+      /*Fail the request*/
+      pfnReqStatusCB( wdiStatus, pUserData);
+    }
+  }
+
+  /* Free data - that was allocated when queueing*/
+  if( pEventData != NULL )
+  {
+     if( pEventData->pEventData != NULL )
+     {
+        wpalMemoryFree(pEventData->pEventData);
+     }
+     wpalMemoryFree(pEventData);
+  }
+
+  if( pMsg != NULL )
+  {
+     wpalMemoryFree(pMsg);
+  }
+  
+}/*WDI_PALCtrlMsgCB*/
+
+/**
+ @brief    Utility function used by the DAL Core to help dequeue
+           and schedule for execution a pending request 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: - pointer to the evnt info that needs to be
+    queued 
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_DequeuePendingReq
+(
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+  wpt_list_node*      pNode      = NULL; 
+  WDI_EventInfoType*  pEventData;
+  wpt_msg*            palMsg; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode); 
+
+  if ( NULL ==  pNode )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "List is empty - return"); 
+    return WDI_STATUS_SUCCESS;
+  }
+
+  /*The node actually points to the 1st element inside the Event Data struct -
+    just cast it back to the struct*/
+  pEventData = (WDI_EventInfoType*)pNode; 
+
+  /*Serialize processing in the control thread
+     !TO DO: - check to see if these are all the messages params that need
+     to be filled in*/
+  palMsg = wpalMemoryAllocate(sizeof(wpt_msg));
+
+  if ( NULL ==  palMsg )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI_DequeuePendingReq: Cannot allocate memory for palMsg."); 
+    WDI_ASSERT(0);
+    return WDI_STATUS_MEM_FAILURE; 
+  }
+  palMsg->pContext = pWDICtx; 
+  palMsg->callback = WDI_PALCtrlMsgCB;
+  palMsg->ptr      = pEventData;
+
+  /*Save the global state as we need it on the other side*/
+  palMsg->val      = pWDICtx->uGlobalState; 
+    
+  /*Transition back to BUSY as we need to handle a queued request*/
+  WDI_STATE_TRANSITION( pWDICtx, WDI_BUSY_ST);
+  
+  wpalPostCtrlMsg(pWDICtx->pPALContext, palMsg);
+
+  return WDI_STATUS_PENDING;
+}/*WDI_DequeuePendingReq*/
+
+
+/**
+ @brief    Utility function used by the DAL Core to help queue 
+           an association request that cannot be processed right
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pEventData: pointer to the evnt info that needs to be queued
+    macBSSID: bssid
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueueNewAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData,
+  wpt_macAddr            macBSSID
+)
+{
+  wpt_uint8 i; 
+  WDI_BSSSessionType*     pSession = NULL; 
+  wpt_list_node*          pNode; 
+  WDI_EventInfoType*      pEventDataQueue;
+  void*                   pEventInfo; 
+  WDI_NextSessionIdType*  pSessionIdElement; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  
+
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
+    ------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+     if ( eWLAN_PAL_FALSE == pWDICtx->aBSSSessions[i].bInUse )
+     {
+       /*Found an empty session*/
+       pSession = &pWDICtx->aBSSSessions[i]; 
+       break; 
+     }
+  }
+
+  if ( i >=  WDI_MAX_BSS_SESSIONS )
+  {
+    /*Cannot find any empty sessions*/
+    return WDI_STATUS_E_FAILURE; 
+  }
+  
+  /*------------------------------------------------------------------------
+    Fill in the BSSID for this session and set the usage flag
+  ------------------------------------------------------------------------*/
+  wpalMemoryCopy(pWDICtx->aBSSSessions[i].macBSSID, macBSSID, WDI_MAC_ADDR_LEN);
+  pWDICtx->aBSSSessions[i].bInUse = eWLAN_PAL_TRUE; 
+
+  /*------------------------------------------------------------------------
+    Allocate memory for this and place it in the queue 
+  ------------------------------------------------------------------------*/
+  pEventDataQueue = (WDI_EventInfoType*)wpalMemoryAllocate(sizeof(WDI_EventInfoType));
+  if ( NULL == pEventDataQueue )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "%s: Cannot allocate memory for queue node", __FUNCTION__);
+    WDI_ASSERT(0);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pSessionIdElement = (WDI_NextSessionIdType*)wpalMemoryAllocate(sizeof(WDI_NextSessionIdType));
+  if ( NULL == pSessionIdElement )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "%s: Cannot allocate memory for session ID", __FUNCTION__);
+    WDI_ASSERT(0);
+    wpalMemoryFree(pEventDataQueue);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
+  if ( NULL == pEventInfo )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "%s: Cannot allocate memory for event data info", __FUNCTION__);
+    WDI_ASSERT(0);
+    wpalMemoryFree(pSessionIdElement);
+    wpalMemoryFree(pEventDataQueue);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pEventDataQueue->pCBfnc          = pEventData->pCBfnc;
+  pEventDataQueue->pUserData       = pEventData->pUserData;
+  pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
+  pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
+
+  wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
+  pEventDataQueue->pEventData = pEventInfo;
+
+  /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
+  pNode = (wpt_list_node*)pEventDataQueue; 
+
+  /*This association is currently being queued*/
+  pSession->bAssocReqQueued = eWLAN_PAL_TRUE; 
+
+  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode); 
+
+  /*We need to maintain a separate list that keeps track of the order in which
+  the new assoc requests are being queued such that we can start processing
+  them in the order that they had arrived*/
+  pSessionIdElement->ucIndex = i; 
+  pNode = (wpt_list_node*)pSessionIdElement; 
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+       "Queueing up new assoc session : %d ", pSessionIdElement->ucIndex);
+  wpal_list_insert_back(&pWDICtx->wptPendingAssocSessionIdQueue, pNode); 
+
+  /*Return pending as this is what the status of the request is since it has
+    been queued*/
+  return WDI_STATUS_PENDING;
+}/*WDI_QueueNewAssocRequest*/
+
+/**
+ @brief    Utility function used by the DAL Core to help queue 
+           an association request that cannot be processed right
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    pSession: - session in which to queue
+    pEventData: pointer to the event info that needs to be
+    queued
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_QueueAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_BSSSessionType*    pSession,
+  WDI_EventInfoType*     pEventData
+)
+{
+  wpt_list_node*      pNode; 
+  WDI_EventInfoType*  pEventDataQueue;
+  void*               pEventInfo; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  
+  /*------------------------------------------------------------------------ 
+      Sanity check
+    ------------------------------------------------------------------------*/
+  if (( NULL == pSession ) || ( NULL == pWDICtx ))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*------------------------------------------------------------------------
+    Allocate memory for this and place it in the queue 
+  ------------------------------------------------------------------------*/
+  pEventDataQueue = (WDI_EventInfoType*)wpalMemoryAllocate(sizeof(WDI_EventInfoType));
+  if ( NULL ==  pEventDataQueue )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "%s: Cannot allocate memory for queueing", __FUNCTION__); 
+    WDI_ASSERT(0);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
+  if ( NULL ==  pEventInfo )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "%s: Cannot allocate memory for queueing event data info",
+               __FUNCTION__);
+    WDI_ASSERT(0);
+    wpalMemoryFree(pEventDataQueue);
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  pEventDataQueue->pCBfnc          = pEventData->pCBfnc;
+  pEventDataQueue->pUserData       = pEventData->pUserData;
+  pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
+  pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
+  pEventDataQueue->pEventData      = pEventInfo;
+
+  wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
+
+  /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
+  pNode = (wpt_list_node*)pEventDataQueue; 
+
+  /*This association is currently being queued*/
+  pSession->bAssocReqQueued = eWLAN_PAL_TRUE; 
+
+  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode); 
+
+  /*The result of this operation is pending because the request has been
+    queued and it will be processed at a later moment in time */
+  return WDI_STATUS_PENDING;
+}/*WDI_QueueAssocRequest*/
+
+/**
+ @brief    Utility function used by the DAL Core to help dequeue
+           an association request that was pending
+           The request will be queued up in front of the main
+           pending queue for imediate processing
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+  
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_DequeueAssocRequest
+(
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+  wpt_list_node*          pNode = NULL; 
+  WDI_NextSessionIdType*  pSessionIdElement; 
+  WDI_BSSSessionType*     pSession;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  
+  /*------------------------------------------------------------------------ 
+      Sanity check
+    ------------------------------------------------------------------------*/
+  if ( NULL == pWDICtx )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*------------------------------------------------------------------------
+    An association has been completed => a new association can occur
+    Check to see if there are any pending associations ->
+    If so , transfer all the pending requests into the busy queue for
+    processing
+    These requests have arrived prior to the requests in the busy queue
+    (bc they needed to be processed in order to be placed in this queue)
+    => they will be placed at the front of the busy queue
+  ------------------------------------------------------------------------*/
+  wpal_list_remove_front(&(pWDICtx->wptPendingAssocSessionIdQueue), &pNode); 
+
+  if ( NULL ==  pNode )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+              "List is empty - return"); 
+    return WDI_STATUS_SUCCESS;
+  }
+
+  /*The node actually points to the 1st element inside the Session Id struct -
+    just cast it back to the struct*/
+  pSessionIdElement = (WDI_NextSessionIdType*)pNode; 
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+       "Dequeueing new assoc session : %d ", pSessionIdElement->ucIndex);
+
+  if ( pSessionIdElement->ucIndex < WDI_MAX_BSS_SESSIONS )
+  {
+      pSession = &pWDICtx->aBSSSessions[pSessionIdElement->ucIndex];
+      
+      /*Transfer all the pending requests in this assoc queue to
+      the front of the main waiting queue for subsequent execution*/      
+      wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode); 
+      while ( NULL !=  pNode )
+      {
+        /*Place it in front of the main pending list*/
+        wpal_list_insert_front( &(pWDICtx->wptPendingQueue), &pNode); 
+        wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode); 
+      }
+  }
+  else
+  {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "Invalid session id queued up for assoc"); 
+     WPAL_ASSERT(0);
+     wpalMemoryFree(pSessionIdElement);
+     return WDI_STATUS_E_FAILURE; 
+  }
+  
+  /*Clean this up as it is no longer needed in order to prevent memory leak*/
+  wpalMemoryFree(pSessionIdElement);
+  return WDI_STATUS_SUCCESS;
+}/*WDI_DequeueAssocRequest*/
+
+/**
+ @brief    Utility function used by the DAL Core to clear any 
+           pending requests - all req cb will be called with
+           failure and the queue will be emptied.
+ @param 
+    
+    pWDICtx: - pointer to the WDI control block
+    
+ @see 
+ @return Result of the operation  
+*/
+WDI_Status
+WDI_ClearPendingRequests
+( 
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+  wpt_list_node*      pNode = NULL; 
+  WDI_EventInfoType*  pEventDataQueue = NULL;
+  WDI_ReqStatusCb     pfnReqStatusCB; 
+  void*               pUserData;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode); 
+
+  /*------------------------------------------------------------------------
+    Go through all the requests and fail them - this will only be called
+    when device is being stopped or an error was detected - either case the
+    pending requests can no longer be sent down to HAL 
+  ------------------------------------------------------------------------*/
+  while( pNode )
+  {
+      /*The node actually points to the 1st element inside the Event Data struct -
+    just cast it back to the struct*/
+    pEventDataQueue = (WDI_EventInfoType*)pNode; 
+  
+    WDI_ExtractRequestCBFromEvent(pEventDataQueue, &pfnReqStatusCB, &pUserData);
+    if ( NULL != pfnReqStatusCB )
+    {
+      /*Fail the request*/
+      pfnReqStatusCB( WDI_STATUS_E_FAILURE, pUserData);
+    }
+    /* Free data - that was allocated when queueing */
+    if ( pEventDataQueue->pEventData != NULL )
+    {
+      wpalMemoryFree(pEventDataQueue->pEventData);
+    }
+    wpalMemoryFree(pEventDataQueue);
+
+    if (wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode) !=  eWLAN_PAL_STATUS_SUCCESS)
+    {
+        break;
+    }
+  } 
+ 
+  return WDI_STATUS_SUCCESS;
+}/*WDI_ClearPendingRequests*/
+
+/**
+ @brief Helper routine used to init the BSS Sessions in the WDI control block 
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
+ @see
+*/
+void
+WDI_ResetAssocSessions
+( 
+  WDI_ControlBlockType*   pWDICtx
+)
+{
+  wpt_uint8 i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    No Sanity check
+  -------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+    wpalMemoryZero( &pWDICtx->aBSSSessions[i], sizeof(WDI_BSSSessionType) ); 
+    pWDICtx->aBSSSessions[i].wdiAssocState = WDI_ASSOC_INIT_ST;
+    pWDICtx->aBSSSessions[i].bcastStaIdx = WDI_STA_INVALID_IDX;
+    pWDICtx->aBSSSessions[i].ucBSSIdx = WDI_BSS_INVALID_IDX;
+  }
+}/*WDI_ResetAssocSessions*/
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         macBSSID:      BSSID of the session
+         pSession:      pointer to the session (if found) 
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_macAddr             macBSSID,
+  WDI_BSSSessionType**    ppSession
+)
+{
+  wpt_uint8 i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if ( NULL == ppSession )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+     return WDI_MAX_BSS_SESSIONS; 
+  }
+
+  *ppSession = NULL; 
+
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
+    ------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+     if ( eWLAN_PAL_TRUE == 
+          wpalMemoryCompare(pWDICtx->aBSSSessions[i].macBSSID, macBSSID, WDI_MAC_ADDR_LEN) )
+     {
+       /*Found the session*/
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
+       return i;
+     }
+  }
+
+  return i; 
+}/*WDI_FindAssocSession*/
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucBSSIdx:  BSS Index of the session
+         ppSession: out pointer to the session (if found)
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSessionByBSSIdx
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_uint16              ucBSSIdx,
+  WDI_BSSSessionType**    ppSession
+)
+{
+  wpt_uint8 i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if ( NULL == ppSession )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+     return WDI_MAX_BSS_SESSIONS; 
+  }
+
+  *ppSession = NULL; 
+
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
+    ------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+     if ( ucBSSIdx == pWDICtx->aBSSSessions[i].ucBSSIdx )
+     {
+       /*Found the session*/
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
+       return i;
+     }
+  }
+
+  return i; 
+}/*WDI_FindAssocSessionByBSSIdx*/
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucBSSIdx:  BSS Index of the session
+         ppSession: out pointer to the session (if found)
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindAssocSessionByIdx
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  wpt_uint16              usIdx,
+  WDI_BSSSessionType**    ppSession
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if ( NULL == ppSession || usIdx >= WDI_MAX_BSS_SESSIONS )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+     return WDI_MAX_BSS_SESSIONS; 
+  }
+
+  /*Found the session*/
+  *ppSession = &pWDICtx->aBSSSessions[usIdx]; 
+
+  return usIdx;
+  
+}/*WDI_FindAssocSessionByBSSIdx*/
+
+/**
+ @brief Helper routine used to find an empty session in the WDI 
+        CB
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
+ @see
+ @return Index of the session in the array 
+*/
+wpt_uint8
+WDI_FindEmptySession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_BSSSessionType**    ppSession
+)
+{
+  wpt_uint8 i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+   /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if ( NULL == ppSession )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+     return WDI_MAX_BSS_SESSIONS; 
+  }
+
+  *ppSession = NULL; 
+
+  /*------------------------------------------------------------------------ 
+      Search for a session that it is not in use 
+    ------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+     if ( ! pWDICtx->aBSSSessions[i].bInUse )
+     {
+       /*Found a session*/
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
+       return i;
+     }
+  }
+
+  return i; 
+}/*WDI_FindEmptySession*/
+
+
+/**
+ @brief Helper routine used to get the total count of active 
+        sessions
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
+ @see
+ @return Number of sessions in use
+*/
+wpt_uint8
+WDI_GetActiveSessionsCount
+( 
+  WDI_ControlBlockType*   pWDICtx
+)
+{
+  wpt_uint8 i, ucCount = 0; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+  
+  /*------------------------------------------------------------------------ 
+      Count all sessions in use
+    ------------------------------------------------------------------------*/
+  for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
+  {
+     if ( pWDICtx->aBSSSessions[i].bInUse )
+     {
+       ucCount++;
+     }
+  }
+
+  return ucCount; 
+}/*WDI_GetActiveSessionsCount*/
+
+/**
+ @brief Helper routine used to delete session in the WDI 
+        CB
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
+ @see
+ @return Index of the session in the array 
+*/
+void 
+WDI_DeleteSession
+( 
+  WDI_ControlBlockType*   pWDICtx,
+  WDI_BSSSessionType*     ppSession
+)
+{
+   /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if ( NULL == ppSession )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+     return ; 
+  }
+
+  /*------------------------------------------------------------------------ 
+      Reset the entries int session 
+    ------------------------------------------------------------------------*/
+  wpal_list_destroy(&ppSession->wptPendingQueue);
+  wpalMemoryZero(ppSession,  sizeof(*ppSession));
+  ppSession->wdiAssocState = WDI_ASSOC_INIT_ST; 
+  ppSession->bInUse        = eWLAN_PAL_FALSE; 
+  ppSession->wdiBssType    = WDI_INFRASTRUCTURE_MODE;
+  wpal_list_init(&ppSession->wptPendingQueue);
+
+}/*WDI_DeleteSession*/
+
+/**
+ @brief    Utility function to add the broadcast STA to the the STA table. 
+ The bcast STA ID is assigned by HAL and must be valid.
+ @param 
+    
+    WDI_AddStaParams: - pointer to the WDI Add STA params
+    usBcastStaIdx: - Broadcast STA index passed by HAL
+    
+ @see 
+ @return void 
+*/
+void
+WDI_AddBcastSTAtoSTATable
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_AddStaParams *     staParams,
+  wpt_uint16             usBcastStaIdx
+)
+{
+  WDI_AddStaParams              wdiAddSTAParam = {0};
+  wpt_macAddr  bcastMacAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+  /*---------------------------------------------------------------------
+    Sanity check
+  ---------------------------------------------------------------------*/
+  if ( NULL == staParams )
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                "%s: Invalid parameters", __FUNCTION__);
+
+    return; 
+  }
+
+  wdiAddSTAParam.bcastDpuIndex = staParams->bcastDpuIndex;
+  wdiAddSTAParam.bcastDpuSignature = staParams->bcastDpuSignature;
+  wdiAddSTAParam.bcastMgmtDpuIndex = staParams->bcastMgmtDpuIndex;
+  wdiAddSTAParam.bcastMgmtDpuSignature = staParams->bcastMgmtDpuSignature;
+  wdiAddSTAParam.dpuIndex = staParams->dpuIndex;
+  wdiAddSTAParam.dpuSig = staParams->dpuSig;
+  wpalMemoryCopy( wdiAddSTAParam.macBSSID, staParams->macBSSID,
+                  WDI_MAC_ADDR_LEN );
+  wpalMemoryCopy( wdiAddSTAParam.staMacAddr, bcastMacAddr, WDI_MAC_ADDR_LEN );
+  wdiAddSTAParam.ucBSSIdx = staParams->ucBSSIdx;
+  wdiAddSTAParam.ucHTCapable = staParams->ucHTCapable;
+  wdiAddSTAParam.ucRmfEnabled = staParams->ucRmfEnabled;
+  wdiAddSTAParam.ucStaType = WDI_STA_ENTRY_BCAST;
+  wdiAddSTAParam.ucWmmEnabled = staParams->ucWmmEnabled;
+  wdiAddSTAParam.ucSTAIdx = usBcastStaIdx;
+    
+  (void)WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
+}
+
+/**
+ @brief NV blob will be divided into fragments of size 4kb and 
+ Sent to HAL 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+ */
+
+WDI_Status WDI_SendNvBlobReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+
+  tHalNvImgDownloadReqMsg    halNvImgDownloadParam;
+  wpt_uint8*                 pSendBuffer   = NULL;
+  wpt_uint16                 usDataOffset  = 0;
+  wpt_uint16                 usSendSize    = 0;
+  wpt_uint16                 usCurrentFragmentSize =0;
+  wpt_uint8*                 pSrcBuffer = NULL;
+  WDI_NvDownloadReqParamsType*  pwdiNvDownloadReqParams =NULL ;
+  WDI_NvDownloadRspCb      wdiNvDownloadRspCb;
+
+  wdiNvDownloadRspCb = (WDI_NvDownloadRspCb)pEventData->pCBfnc;
+  WDI_ASSERT(NULL != wdiNvDownloadRspCb);
+  pwdiNvDownloadReqParams = (WDI_NvDownloadReqParamsType*)pEventData->pEventData;
+
+  /* Sanity Check is done by the caller */ 
+  pSrcBuffer =(wpt_uint8 *) pwdiNvDownloadReqParams->wdiBlobInfo.pBlobAddress;
+
+  /* Update the current  Fragment Number */
+  pWDICtx->wdiNvBlobInfo.usCurrentFragment += 1;
+
+  /*Update the HAL REQ structure */
+  /*HAL maintaining the fragment count as 0,1,2...n where at WDI it is represented as 1,2,3.. n*/
+  halNvImgDownloadParam.nvImageReqParams.fragNumber =
+                                     pWDICtx->wdiNvBlobInfo.usCurrentFragment-1;
+
+  /*    Divide the NV Image to size of 'FRAGMENT_SIZE' fragments and send it to HAL.
+       If the size of the Image is less than 'FRAGMENT_SIZE' then in one iteration total 
+       image will be sent to HAL*/
+
+  if(pWDICtx->wdiNvBlobInfo.usTotalFragment 
+                         == pWDICtx->wdiNvBlobInfo.usCurrentFragment)
+  { 
+    /*     Taking care of boundry condition */
+    if( !(usCurrentFragmentSize = 
+                 pwdiNvDownloadReqParams->wdiBlobInfo.uBlobSize%FRAGMENT_SIZE ))
+      usCurrentFragmentSize = FRAGMENT_SIZE;
+
+    /*Update the HAL REQ structure */
+    halNvImgDownloadParam.nvImageReqParams.isLastFragment = 1;
+    halNvImgDownloadParam.nvImageReqParams.nvImgBufferSize= usCurrentFragmentSize;
+
+  }
+  else
+  { 
+    usCurrentFragmentSize = FRAGMENT_SIZE;
+
+    /*Update the HAL REQ structure */
+    halNvImgDownloadParam.nvImageReqParams.isLastFragment =0;
+    halNvImgDownloadParam.nvImageReqParams.nvImgBufferSize = usCurrentFragmentSize;
+  }
+
+  /*-----------------------------------------------------------------------
+   Get message buffer
+   -----------------------------------------------------------------------*/
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,WDI_NV_DOWNLOAD_REQ,
+         sizeof(halNvImgDownloadParam.nvImageReqParams)+ usCurrentFragmentSize,
+                    &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < 
+           (usDataOffset + sizeof(halNvImgDownloadParam.nvImageReqParams) + usCurrentFragmentSize )))
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+         "Unable to get send buffer in NV Download req %x %x ",
+         pEventData, pwdiNvDownloadReqParams);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  /* Copying the Hal NV download REQ structure */
+  wpalMemoryCopy(pSendBuffer + usDataOffset , 
+    &halNvImgDownloadParam.nvImageReqParams ,sizeof(tHalNvImgDownloadReqParams));
+
+  /* Appending the NV image fragment */
+  wpalMemoryCopy(pSendBuffer + usDataOffset + sizeof(tHalNvImgDownloadReqParams),
+        (void *)(pSrcBuffer + halNvImgDownloadParam.nvImageReqParams.fragNumber * FRAGMENT_SIZE),
+                  usCurrentFragmentSize);
+
+  pWDICtx->wdiReqStatusCB     = pwdiNvDownloadReqParams->wdiReqStatusCB;
+  pWDICtx->pReqStatusUserData = pwdiNvDownloadReqParams->pUserData; 
+
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                           wdiNvDownloadRspCb, pEventData->pUserData, 
+                           WDI_NV_DOWNLOAD_RESP);
+
+}
+/*============================================================================ 
+  Helper inline functions for 
+ ============================================================================*/
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDPContext:   pointer to the Datapath context 
+  
+ @see
+ @return 
+*/
+WPT_INLINE void 
+WDI_DS_AssignDatapathContext (void *pContext, void *pDPContext)
+{
+   WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
+
+   pCB->pDPContext = pDPContext;
+   return;
+}
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+  
+ @see
+ @return pointer to Datapath context
+*/
+WPT_INLINE void * 
+WDI_DS_GetDatapathContext (void *pContext)
+{
+   WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
+   return pCB->pDPContext;
+}
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDTDriverContext:   pointer to the Transport Driver context 
+  
+ @see
+ @return void
+*/
+WPT_INLINE void  
+WDT_AssignTransportDriverContext (void *pContext, void *pDTDriverContext)
+{
+   WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
+
+   pCB->pDTDriverContext = pDTDriverContext;
+   return; 
+}
+
+/**
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+  
+ @see
+ @return pointer to datapath context 
+*/
+WPT_INLINE void * 
+WDT_GetTransportDriverContext (void *pContext)
+{
+   WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
+   return(pCB->pDTDriverContext); 
+}
+
+/*============================================================================ 
+  Helper inline converters
+ ============================================================================*/
+/*Convert WDI driver type into HAL driver type*/
+WPT_STATIC WPT_INLINE WDI_Status
+WDI_HAL_2_WDI_STATUS
+(
+  eHalStatus halStatus
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  halStatus )
+  {
+  case eHAL_STATUS_SUCCESS:
+  case eHAL_STATUS_ADD_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO:
+  case eHAL_STATUS_DEL_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO:
+    return WDI_STATUS_SUCCESS;
+  case eHAL_STATUS_FAILURE:
+    return WDI_STATUS_E_FAILURE;
+  case eHAL_STATUS_FAILED_ALLOC:
+    return WDI_STATUS_MEM_FAILURE;    
+   /*The rest of the HAL error codes must be kept hidden from the UMAC as 
+     they refer to specific internal modules of our device*/
+  default: 
+    return WDI_STATUS_DEV_INTERNAL_FAILURE; 
+  } 
+
+  return WDI_STATUS_E_FAILURE; 
+}/*WDI_HAL_2_WDI_STATUS*/
+
+/*Convert WDI request type into HAL request type*/
+WPT_STATIC WPT_INLINE tHalHostMsgType
+WDI_2_HAL_REQ_TYPE
+(
+  WDI_RequestEnumType    wdiReqType
+)
+{
+   /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiReqType )
+  {    
+  case WDI_START_REQ:
+    return WLAN_HAL_START_REQ; 
+  case WDI_STOP_REQ:
+    return WLAN_HAL_STOP_REQ; 
+  case WDI_INIT_SCAN_REQ:
+    return WLAN_HAL_INIT_SCAN_REQ; 
+  case WDI_START_SCAN_REQ:
+    return WLAN_HAL_START_SCAN_REQ; 
+  case WDI_END_SCAN_REQ:
+    return WLAN_HAL_END_SCAN_REQ; 
+  case WDI_FINISH_SCAN_REQ:
+    return WLAN_HAL_FINISH_SCAN_REQ; 
+  case WDI_JOIN_REQ:
+    return WLAN_HAL_JOIN_REQ; 
+  case WDI_CONFIG_BSS_REQ:
+    return WLAN_HAL_CONFIG_BSS_REQ; 
+  case WDI_DEL_BSS_REQ:
+    return WLAN_HAL_DELETE_BSS_REQ; 
+  case WDI_POST_ASSOC_REQ:
+    return WLAN_HAL_POST_ASSOC_REQ; 
+  case WDI_DEL_STA_REQ:
+    return WLAN_HAL_DELETE_STA_REQ; 
+  case WDI_SET_BSS_KEY_REQ:
+    return WLAN_HAL_SET_BSSKEY_REQ; 
+  case WDI_RMV_BSS_KEY_REQ:
+    return WLAN_HAL_RMV_BSSKEY_REQ; 
+  case WDI_SET_STA_KEY_REQ:
+    return WLAN_HAL_SET_STAKEY_REQ; 
+  case WDI_RMV_STA_KEY_REQ:
+    return WLAN_HAL_RMV_STAKEY_REQ; 
+  case WDI_SET_STA_BCAST_KEY_REQ:
+    return WLAN_HAL_SET_BCASTKEY_REQ; 
+  case WDI_RMV_STA_BCAST_KEY_REQ:
+    //Some conflict in the old code - check this: return WLAN_HAL_RMV_BCASTKEY_REQ; 
+    return WLAN_HAL_RMV_STAKEY_REQ;
+  case WDI_ADD_TS_REQ:
+    return WLAN_HAL_ADD_TS_REQ; 
+  case WDI_DEL_TS_REQ:
+    return WLAN_HAL_DEL_TS_REQ; 
+  case WDI_UPD_EDCA_PRMS_REQ:
+    return WLAN_HAL_UPD_EDCA_PARAMS_REQ; 
+  case WDI_ADD_BA_REQ:
+    return WLAN_HAL_ADD_BA_REQ; 
+  case WDI_DEL_BA_REQ:
+    return WLAN_HAL_DEL_BA_REQ; 
+#ifdef FEATURE_WLAN_CCX
+  case WDI_TSM_STATS_REQ:
+    return WLAN_HAL_TSM_STATS_REQ; 
+#endif
+  case WDI_CH_SWITCH_REQ:
+    return WLAN_HAL_CH_SWITCH_REQ; 
+  case WDI_CONFIG_STA_REQ:
+    return WLAN_HAL_CONFIG_STA_REQ; 
+  case WDI_SET_LINK_ST_REQ:
+    return WLAN_HAL_SET_LINK_ST_REQ; 
+  case WDI_GET_STATS_REQ:
+    return WLAN_HAL_GET_STATS_REQ; 
+  case WDI_UPDATE_CFG_REQ:
+    return WLAN_HAL_UPDATE_CFG_REQ; 
+  case WDI_ADD_BA_SESSION_REQ:
+    return WLAN_HAL_ADD_BA_SESSION_REQ;
+  case WDI_TRIGGER_BA_REQ:
+    return WLAN_HAL_TRIGGER_BA_REQ;
+  case WDI_UPD_BCON_PRMS_REQ:
+    return WLAN_HAL_UPDATE_BEACON_REQ; 
+  case WDI_SND_BCON_REQ:
+    return WLAN_HAL_SEND_BEACON_REQ; 
+  case WDI_UPD_PROBE_RSP_TEMPLATE_REQ:
+    return WLAN_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ;
+   case WDI_SET_MAX_TX_POWER_REQ:
+    return WLAN_HAL_SET_MAX_TX_POWER_REQ;
+#ifdef WLAN_FEATURE_P2P
+  case WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ:
+    return WLAN_HAL_SET_P2P_GONOA_REQ;
+#endif
+  case WDI_ENTER_IMPS_REQ:
+    return WLAN_HAL_ENTER_IMPS_REQ; 
+  case WDI_EXIT_IMPS_REQ:
+    return WLAN_HAL_EXIT_IMPS_REQ; 
+  case WDI_ENTER_BMPS_REQ:
+    return WLAN_HAL_ENTER_BMPS_REQ; 
+  case WDI_EXIT_BMPS_REQ:
+    return WLAN_HAL_EXIT_BMPS_REQ; 
+  case WDI_ENTER_UAPSD_REQ:
+    return WLAN_HAL_ENTER_UAPSD_REQ; 
+  case WDI_EXIT_UAPSD_REQ:
+    return WLAN_HAL_EXIT_UAPSD_REQ; 
+  case WDI_SET_UAPSD_PARAM_REQ:
+    return WLAN_HAL_SET_UAPSD_AC_PARAMS_REQ; 
+  case WDI_UPDATE_UAPSD_PARAM_REQ:
+    return WLAN_HAL_UPDATE_UAPSD_PARAM_REQ; 
+  case WDI_CONFIGURE_RXP_FILTER_REQ:
+    return WLAN_HAL_CONFIGURE_RXP_FILTER_REQ; 
+  case WDI_SET_BEACON_FILTER_REQ:
+    return WLAN_HAL_ADD_BCN_FILTER_REQ; 
+  case WDI_REM_BEACON_FILTER_REQ:
+    return WLAN_HAL_REM_BCN_FILTER_REQ;
+  case WDI_SET_RSSI_THRESHOLDS_REQ:
+    return WLAN_HAL_SET_RSSI_THRESH_REQ;
+  case WDI_HOST_OFFLOAD_REQ:
+    return WLAN_HAL_HOST_OFFLOAD_REQ;
+  case WDI_WOWL_ADD_BC_PTRN_REQ:
+    return WLAN_HAL_ADD_WOWL_BCAST_PTRN;
+  case WDI_WOWL_DEL_BC_PTRN_REQ:
+    return WLAN_HAL_DEL_WOWL_BCAST_PTRN;
+  case WDI_WOWL_ENTER_REQ:
+    return WLAN_HAL_ENTER_WOWL_REQ;
+  case WDI_WOWL_EXIT_REQ:
+    return WLAN_HAL_EXIT_WOWL_REQ;
+  case WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ:
+    return WLAN_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ;
+   case WDI_NV_DOWNLOAD_REQ:
+    return WLAN_HAL_DOWNLOAD_NV_REQ;
+  case WDI_FLUSH_AC_REQ:
+    return WLAN_HAL_TL_HAL_FLUSH_AC_REQ;
+  case WDI_BTAMP_EVENT_REQ:
+    return WLAN_HAL_SIGNAL_BTAMP_EVENT_REQ;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+  case WDI_AGGR_ADD_TS_REQ:
+     return WLAN_HAL_AGGR_ADD_TS_REQ;
+#endif /* WLAN_FEATURE_VOWIFI_11R */
+#ifdef ANI_MANF_DIAG
+  case WDI_FTM_CMD_REQ:
+    return WLAN_HAL_PROCESS_PTT_REQ;
+#endif /* ANI_MANF_DIAG */
+  case WDI_ADD_STA_SELF_REQ:
+    return WLAN_HAL_ADD_STA_SELF_REQ;
+  case WDI_DEL_STA_SELF_REQ:
+    return WLAN_HAL_DEL_STA_SELF_REQ;
+  case WDI_HOST_RESUME_REQ:
+    return WLAN_HAL_HOST_RESUME_REQ;
+  case WDI_HOST_SUSPEND_IND:
+    return WLAN_HAL_HOST_SUSPEND_IND;
+  case WDI_KEEP_ALIVE_REQ:
+    return WLAN_HAL_KEEP_ALIVE_REQ;
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+  case WDI_SET_PREF_NETWORK_REQ:
+    return WLAN_HAL_SET_PREF_NETWORK_REQ;
+  case WDI_SET_RSSI_FILTER_REQ:
+    return WLAN_HAL_SET_RSSI_FILTER_REQ;
+  case WDI_UPDATE_SCAN_PARAMS_REQ:
+    return WLAN_HAL_UPDATE_SCAN_PARAM_REQ;
+#endif // FEATURE_WLAN_SCAN_PNO
+  case WDI_SET_TX_PER_TRACKING_REQ:
+    return WLAN_HAL_SET_TX_PER_TRACKING_REQ;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+  case WDI_8023_MULTICAST_LIST_REQ:
+    return WLAN_HAL_8023_MULTICAST_LIST_REQ;
+  case WDI_RECEIVE_FILTER_SET_FILTER_REQ:
+    return WLAN_HAL_SET_PACKET_FILTER_REQ; 
+  case WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ:
+    return WLAN_HAL_PACKET_FILTER_MATCH_COUNT_REQ;
+  case WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ:
+    return WLAN_HAL_CLEAR_PACKET_FILTER_REQ;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+  case WDI_HAL_DUMP_CMD_REQ:
+    return WLAN_HAL_DUMP_COMMAND_REQ;
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+  case WDI_GTK_OFFLOAD_REQ:
+    return WLAN_HAL_GTK_OFFLOAD_REQ;
+  case WDI_GTK_OFFLOAD_GETINFO_REQ:
+    return WLAN_HAL_GTK_OFFLOAD_GETINFO_REQ;
+#endif /* WLAN_FEATURE_GTK_OFFLOAD */
+
+  case WDI_INIT_SCAN_CON_REQ:
+    return WLAN_HAL_INIT_SCAN_CON_REQ; 
+  case WDI_SET_POWER_PARAMS_REQ:
+    return WLAN_HAL_SET_POWER_PARAMS_REQ; 
+  case WDI_SET_TM_LEVEL_REQ:
+    return WLAN_HAL_SET_THERMAL_MITIGATION_REQ; 
+  case WDI_FEATURE_CAPS_EXCHANGE_REQ:
+    return WLAN_HAL_FEATURE_CAPS_EXCHANGE_REQ;
+  default:
+    return WLAN_HAL_MSG_MAX; 
+  }
+  
+}/*WDI_2_HAL_REQ_TYPE*/
+
+/*Convert WDI response type into HAL response type*/
+WPT_STATIC WPT_INLINE WDI_ResponseEnumType
+HAL_2_WDI_RSP_TYPE
+(
+  tHalHostMsgType halMsg
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  halMsg )
+  {
+  case WLAN_HAL_START_RSP:
+    return WDI_START_RESP;
+  case WLAN_HAL_STOP_RSP:
+    return WDI_STOP_RESP;
+  case WLAN_HAL_INIT_SCAN_RSP:
+    return WDI_INIT_SCAN_RESP;
+  case WLAN_HAL_START_SCAN_RSP:
+    return WDI_START_SCAN_RESP;
+  case WLAN_HAL_END_SCAN_RSP:
+    return WDI_END_SCAN_RESP;
+  case WLAN_HAL_FINISH_SCAN_RSP:
+    return WDI_FINISH_SCAN_RESP;
+  case WLAN_HAL_CONFIG_STA_RSP:
+    return WDI_CONFIG_STA_RESP;
+  case WLAN_HAL_DELETE_STA_RSP:
+    return WDI_DEL_STA_RESP;
+  case WLAN_HAL_CONFIG_BSS_RSP:
+    return WDI_CONFIG_BSS_RESP;
+  case WLAN_HAL_DELETE_BSS_RSP:
+    return WDI_DEL_BSS_RESP;
+  case WLAN_HAL_JOIN_RSP:
+    return WDI_JOIN_RESP;
+  case WLAN_HAL_POST_ASSOC_RSP:
+    return WDI_POST_ASSOC_RESP;
+  case WLAN_HAL_SET_BSSKEY_RSP:
+    return WDI_SET_BSS_KEY_RESP;
+  case WLAN_HAL_SET_STAKEY_RSP:
+    return WDI_SET_STA_KEY_RESP;
+  case WLAN_HAL_RMV_BSSKEY_RSP:
+    return WDI_RMV_BSS_KEY_RESP;
+  case WLAN_HAL_RMV_STAKEY_RSP:
+    return WDI_RMV_STA_KEY_RESP;
+  case WLAN_HAL_SET_BCASTKEY_RSP:
+    return WDI_SET_STA_BCAST_KEY_RESP;
+  //Some conflict in the old code - check this: case WLAN_HAL_RMV_BCASTKEY_RSP:
+  //  return WDI_RMV_STA_BCAST_KEY_RESP;
+  case WLAN_HAL_ADD_TS_RSP:
+    return WDI_ADD_TS_RESP;
+  case WLAN_HAL_DEL_TS_RSP:
+    return WDI_DEL_TS_RESP;
+  case WLAN_HAL_UPD_EDCA_PARAMS_RSP:
+    return WDI_UPD_EDCA_PRMS_RESP;
+  case WLAN_HAL_ADD_BA_RSP:
+    return WDI_ADD_BA_RESP;
+  case WLAN_HAL_DEL_BA_RSP:
+    return WDI_DEL_BA_RESP;
+#ifdef FEATURE_WLAN_CCX
+  case WLAN_HAL_TSM_STATS_RSP:
+    return WDI_TSM_STATS_RESP;
+#endif
+  case WLAN_HAL_CH_SWITCH_RSP:
+    return WDI_CH_SWITCH_RESP;
+  case WLAN_HAL_SET_LINK_ST_RSP:
+    return WDI_SET_LINK_ST_RESP;
+  case WLAN_HAL_GET_STATS_RSP:
+    return WDI_GET_STATS_RESP;
+  case WLAN_HAL_UPDATE_CFG_RSP:
+    return WDI_UPDATE_CFG_RESP;
+  case WLAN_HAL_ADD_BA_SESSION_RSP:
+    return WDI_ADD_BA_SESSION_RESP;
+  case WLAN_HAL_TRIGGER_BA_RSP:
+    return WDI_TRIGGER_BA_RESP;
+  case WLAN_HAL_UPDATE_BEACON_RSP:
+    return WDI_UPD_BCON_PRMS_RESP;
+  case WLAN_HAL_SEND_BEACON_RSP:
+    return WDI_SND_BCON_RESP;
+  case WLAN_HAL_UPDATE_PROBE_RSP_TEMPLATE_RSP:
+    return WDI_UPD_PROBE_RSP_TEMPLATE_RESP;
+  /*Indications*/
+  case WLAN_HAL_RSSI_NOTIFICATION_IND:
+    return WDI_HAL_RSSI_NOTIFICATION_IND;
+  case WLAN_HAL_MISSED_BEACON_IND:
+    return WDI_HAL_MISSED_BEACON_IND;
+  case WLAN_HAL_UNKNOWN_ADDR2_FRAME_RX_IND:
+    return WDI_HAL_UNKNOWN_ADDR2_FRAME_RX_IND;
+  case WLAN_HAL_MIC_FAILURE_IND:
+    return WDI_HAL_MIC_FAILURE_IND;
+  case WLAN_HAL_FATAL_ERROR_IND:
+    return WDI_HAL_FATAL_ERROR_IND;
+  case WLAN_HAL_DELETE_STA_CONTEXT_IND:
+    return WDI_HAL_DEL_STA_IND;
+  case WLAN_HAL_COEX_IND:
+    return WDI_HAL_COEX_IND;
+  case WLAN_HAL_OTA_TX_COMPL_IND:
+    return WDI_HAL_TX_COMPLETE_IND;
+#ifdef WLAN_FEATURE_P2P
+  case WLAN_HAL_P2P_NOA_ATTR_IND:
+    return WDI_HAL_P2P_NOA_ATTR_IND;
+#endif
+  case WLAN_HAL_TX_PER_HIT_IND:
+    return WDI_HAL_TX_PER_HIT_IND;
+  case WLAN_HAL_SET_MAX_TX_POWER_RSP:
+    return WDI_SET_MAX_TX_POWER_RESP;
+#ifdef WLAN_FEATURE_P2P
+  case WLAN_HAL_SET_P2P_GONOA_RSP:
+    return WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP;
+#endif
+  case WLAN_HAL_ENTER_IMPS_RSP:
+    return WDI_ENTER_IMPS_RESP; 
+  case WLAN_HAL_EXIT_IMPS_RSP:
+    return WDI_EXIT_IMPS_RESP; 
+  case WLAN_HAL_ENTER_BMPS_RSP:
+    return WDI_ENTER_BMPS_RESP; 
+  case WLAN_HAL_EXIT_BMPS_RSP:
+    return WDI_EXIT_BMPS_RESP; 
+  case WLAN_HAL_ENTER_UAPSD_RSP:
+    return WDI_ENTER_UAPSD_RESP; 
+  case WLAN_HAL_EXIT_UAPSD_RSP:
+    return WDI_EXIT_UAPSD_RESP; 
+  case WLAN_HAL_SET_UAPSD_AC_PARAMS_RSP:
+    return WDI_SET_UAPSD_PARAM_RESP; 
+  case WLAN_HAL_UPDATE_UAPSD_PARAM_RSP:
+    return WDI_UPDATE_UAPSD_PARAM_RESP; 
+  case WLAN_HAL_CONFIGURE_RXP_FILTER_RSP:
+    return WDI_CONFIGURE_RXP_FILTER_RESP; 
+  case WLAN_HAL_ADD_BCN_FILTER_RSP:
+    return WDI_SET_BEACON_FILTER_RESP;
+  case WLAN_HAL_REM_BCN_FILTER_RSP:
+    return WDI_REM_BEACON_FILTER_RESP;
+  case WLAN_HAL_SET_RSSI_THRESH_RSP:
+    return WDI_SET_RSSI_THRESHOLDS_RESP;
+  case WLAN_HAL_HOST_OFFLOAD_RSP:
+    return WDI_HOST_OFFLOAD_RESP;
+  case WLAN_HAL_ADD_WOWL_BCAST_PTRN_RSP:
+    return WDI_WOWL_ADD_BC_PTRN_RESP;
+  case WLAN_HAL_DEL_WOWL_BCAST_PTRN_RSP:
+    return WDI_WOWL_DEL_BC_PTRN_RESP;
+  case WLAN_HAL_ENTER_WOWL_RSP:
+    return WDI_WOWL_ENTER_RESP;
+  case WLAN_HAL_EXIT_WOWL_RSP:
+    return WDI_WOWL_EXIT_RESP;
+  case WLAN_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_RSP:
+    return WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP;
+  case WLAN_HAL_DOWNLOAD_NV_RSP:
+    return WDI_NV_DOWNLOAD_RESP;
+  case WLAN_HAL_TL_HAL_FLUSH_AC_RSP:
+    return WDI_FLUSH_AC_RESP;
+  case WLAN_HAL_SIGNAL_BTAMP_EVENT_RSP:
+    return WDI_BTAMP_EVENT_RESP;
+#ifdef ANI_MANF_DIAG
+  case WLAN_HAL_PROCESS_PTT_RSP:
+    return  WDI_FTM_CMD_RESP;
+#endif /* ANI_MANF_DIAG */
+  case WLAN_HAL_ADD_STA_SELF_RSP:
+    return WDI_ADD_STA_SELF_RESP;
+case WLAN_HAL_DEL_STA_SELF_RSP:
+    return WDI_DEL_STA_SELF_RESP;
+  case WLAN_HAL_HOST_RESUME_RSP:
+    return WDI_HOST_RESUME_RESP;
+  case WLAN_HAL_KEEP_ALIVE_RSP:
+    return WDI_KEEP_ALIVE_RESP;
+#ifdef FEATURE_WLAN_SCAN_PNO
+  case WLAN_HAL_SET_PREF_NETWORK_RSP:
+    return WDI_SET_PREF_NETWORK_RESP;
+  case WLAN_HAL_SET_RSSI_FILTER_RSP:
+    return WDI_SET_RSSI_FILTER_RESP; 
+  case WLAN_HAL_UPDATE_SCAN_PARAM_RSP:
+    return WDI_UPDATE_SCAN_PARAMS_RESP;
+  case WLAN_HAL_PREF_NETW_FOUND_IND:
+    return WDI_HAL_PREF_NETWORK_FOUND_IND;
+#endif // FEATURE_WLAN_SCAN_PNO
+  case WLAN_HAL_SET_TX_PER_TRACKING_RSP:
+    return WDI_SET_TX_PER_TRACKING_RESP;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+  case WLAN_HAL_8023_MULTICAST_LIST_RSP:
+    return WDI_8023_MULTICAST_LIST_RESP;
+  case WLAN_HAL_SET_PACKET_FILTER_RSP:
+    return WDI_RECEIVE_FILTER_SET_FILTER_RESP;
+  case WLAN_HAL_PACKET_FILTER_MATCH_COUNT_RSP:
+    return WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP;
+  case WLAN_HAL_CLEAR_PACKET_FILTER_RSP:
+    return WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP;
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+  case WLAN_HAL_DUMP_COMMAND_RSP:
+    return WDI_HAL_DUMP_CMD_RESP;
+  case WLAN_HAL_SET_POWER_PARAMS_RSP:
+    return WDI_SET_POWER_PARAMS_RESP;
+#ifdef WLAN_FEATURE_VOWIFI_11R
+  case WLAN_HAL_AGGR_ADD_TS_RSP:
+    return WDI_AGGR_ADD_TS_RESP;
+#endif
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+  case WLAN_HAL_GTK_OFFLOAD_RSP:
+    return WDI_GTK_OFFLOAD_RESP;
+  case WLAN_HAL_GTK_OFFLOAD_GETINFO_RSP:
+    return WDI_GTK_OFFLOAD_GETINFO_RESP;
+#endif /* WLAN_FEATURE_GTK_OFFLOAD */
+#ifdef WLAN_WAKEUP_EVENTS
+  case WLAN_HAL_WAKE_REASON_IND:
+    return WDI_HAL_WAKE_REASON_IND;
+#endif // WLAN_WAKEUP_EVENTS
+
+  case WLAN_HAL_SET_THERMAL_MITIGATION_RSP:
+    return WDI_SET_TM_LEVEL_RESP;
+  case WLAN_HAL_FEATURE_CAPS_EXCHANGE_RSP:
+      return WDI_FEATURE_CAPS_EXCHANGE_RESP;
+  default:
+    return eDRIVER_TYPE_MAX; 
+  }
+
+}/*HAL_2_WDI_RSP_TYPE*/
+
+
+/*Convert WDI driver type into HAL driver type*/
+WPT_STATIC WPT_INLINE tDriverType
+WDI_2_HAL_DRV_TYPE
+(
+  WDI_DriverType wdiDriverType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiDriverType )
+  {
+  case WDI_DRIVER_TYPE_PRODUCTION:
+    return eDRIVER_TYPE_PRODUCTION;
+  case WDI_DRIVER_TYPE_MFG:
+    return eDRIVER_TYPE_MFG;
+  case WDI_DRIVER_TYPE_DVT:
+    return eDRIVER_TYPE_DVT;
+  }
+
+  return eDRIVER_TYPE_MAX; 
+}/*WDI_2_HAL_DRV_TYPE*/
+
+
+/*Convert WDI stop reason into HAL stop reason*/
+WPT_STATIC WPT_INLINE tHalStopType
+WDI_2_HAL_STOP_REASON
+(
+  WDI_StopType wdiDriverType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiDriverType )
+  {
+  case WDI_STOP_TYPE_SYS_RESET:
+    return HAL_STOP_TYPE_SYS_RESET;
+  case WDI_DRIVER_TYPE_MFG:
+    return WDI_STOP_TYPE_SYS_DEEP_SLEEP;
+  case WDI_STOP_TYPE_RF_KILL:
+    return HAL_STOP_TYPE_RF_KILL;
+  }
+
+  return HAL_STOP_TYPE_MAX; 
+}/*WDI_2_HAL_STOP_REASON*/
+
+
+/*Convert WDI scan mode type into HAL scan mode type*/
+WPT_STATIC WPT_INLINE eHalSysMode
+WDI_2_HAL_SCAN_MODE
+(
+  WDI_ScanMode wdiScanMode
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiScanMode )
+  {
+  case WDI_SCAN_MODE_NORMAL:
+    return eHAL_SYS_MODE_NORMAL;
+  case WDI_SCAN_MODE_LEARN:
+    return eHAL_SYS_MODE_LEARN;
+  case WDI_SCAN_MODE_SCAN:
+    return eHAL_SYS_MODE_SCAN;
+  case WDI_SCAN_MODE_PROMISC:
+    return eHAL_SYS_MODE_PROMISC; 
+  case WDI_SCAN_MODE_SUSPEND_LINK:
+    return eHAL_SYS_MODE_SUSPEND_LINK;
+  }
+
+  return eHAL_SYS_MODE_MAX; 
+}/*WDI_2_HAL_SCAN_MODE*/
+
+/*Convert WDI sec ch offset into HAL sec ch offset type*/
+WPT_STATIC WPT_INLINE tSirMacHTSecondaryChannelOffset
+WDI_2_HAL_SEC_CH_OFFSET
+(
+  WDI_HTSecondaryChannelOffset wdiSecChOffset
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiSecChOffset )
+  {
+  case WDI_SECONDARY_CHANNEL_OFFSET_NONE:
+    return eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+  case WDI_SECONDARY_CHANNEL_OFFSET_UP:
+    return eHT_SECONDARY_CHANNEL_OFFSET_UP;
+  case WDI_SECONDARY_CHANNEL_OFFSET_DOWN:
+    return eHT_SECONDARY_CHANNEL_OFFSET_DOWN;
+  }
+
+  return eHT_SECONDARY_CHANNEL_OFFSET_MAX; 
+}/*WDI_2_HAL_SEC_CH_OFFSET*/
+
+/*Convert WDI BSS type into HAL BSS type*/
+WPT_STATIC WPT_INLINE tSirBssType
+WDI_2_HAL_BSS_TYPE
+(
+  WDI_BssType wdiBSSType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiBSSType )
+  {
+  case WDI_INFRASTRUCTURE_MODE:
+    return eSIR_INFRASTRUCTURE_MODE;
+  case WDI_INFRA_AP_MODE:
+    return eSIR_INFRA_AP_MODE;
+  case WDI_IBSS_MODE:
+    return eSIR_IBSS_MODE;
+  case WDI_BTAMP_STA_MODE:
+    return eSIR_BTAMP_STA_MODE;
+  case WDI_BTAMP_AP_MODE:
+    return eSIR_BTAMP_AP_MODE; 
+  case WDI_BSS_AUTO_MODE:
+    return eSIR_AUTO_MODE;
+  }
+
+  return eSIR_DONOT_USE_BSS_TYPE; 
+}/*WDI_2_HAL_BSS_TYPE*/
+
+/*Convert WDI NW type into HAL NW type*/
+WPT_STATIC WPT_INLINE tSirNwType
+WDI_2_HAL_NW_TYPE
+(
+  WDI_NwType wdiNWType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch(  wdiNWType )
+  {
+  case WDI_11A_NW_TYPE:
+    return eSIR_11A_NW_TYPE;
+  case WDI_11B_NW_TYPE:
+    return eSIR_11B_NW_TYPE;
+  case WDI_11G_NW_TYPE:
+    return eSIR_11G_NW_TYPE;
+  case WDI_11N_NW_TYPE:
+    return eSIR_11N_NW_TYPE;
+  }
+
+  return eSIR_DONOT_USE_NW_TYPE; 
+}/*WDI_2_HAL_NW_TYPE*/
+
+/*Convert WDI chanel bonding type into HAL cb type*/
+WPT_STATIC WPT_INLINE ePhyChanBondState
+WDI_2_HAL_CB_STATE
+(
+  WDI_PhyChanBondState wdiCbState
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiCbState )
+  {
+  case WDI_PHY_SINGLE_CHANNEL_CENTERED:
+    return PHY_SINGLE_CHANNEL_CENTERED;
+  case WDI_PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
+    return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+  case WDI_PHY_DOUBLE_CHANNEL_CENTERED:
+    return PHY_DOUBLE_CHANNEL_CENTERED;
+  case WDI_PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
+    return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+  }
+  
+  return PHY_CHANNEL_BONDING_STATE_MAX;
+}/*WDI_2_HAL_CB_STATE*/
+
+/*Convert WDI chanel bonding type into HAL cb type*/
+WPT_STATIC WPT_INLINE tSirMacHTOperatingMode
+WDI_2_HAL_HT_OPER_MODE
+(
+  WDI_HTOperatingMode wdiHTOperMode
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiHTOperMode )
+  {
+  case WDI_HT_OP_MODE_PURE:
+    return eSIR_HT_OP_MODE_PURE;
+  case WDI_HT_OP_MODE_OVERLAP_LEGACY:
+    return eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+  case WDI_HT_OP_MODE_NO_LEGACY_20MHZ_HT:
+    return eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+  case WDI_HT_OP_MODE_MIXED:
+    return eSIR_HT_OP_MODE_MIXED;
+  }
+  
+  return eSIR_HT_OP_MODE_MAX;
+}/*WDI_2_HAL_HT_OPER_MODE*/
+
+/*Convert WDI mimo PS type into HAL mimo PS type*/
+WPT_STATIC WPT_INLINE tSirMacHTMIMOPowerSaveState
+WDI_2_HAL_MIMO_PS
+(
+  WDI_HTMIMOPowerSaveState wdiHTOperMode
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiHTOperMode )
+  {
+  case WDI_HT_MIMO_PS_STATIC:
+    return eSIR_HT_MIMO_PS_STATIC;
+  case WDI_HT_MIMO_PS_DYNAMIC:
+    return eSIR_HT_MIMO_PS_DYNAMIC;
+  case WDI_HT_MIMO_PS_NA:
+    return eSIR_HT_MIMO_PS_NA;
+  case WDI_HT_MIMO_PS_NO_LIMIT:
+    return eSIR_HT_MIMO_PS_NO_LIMIT;
+  }
+  
+  return eSIR_HT_MIMO_PS_MAX;
+}/*WDI_2_HAL_MIMO_PS*/
+
+/*Convert WDI ENC type into HAL ENC type*/
+WPT_STATIC WPT_INLINE tAniEdType
+WDI_2_HAL_ENC_TYPE
+(
+  WDI_EncryptType wdiEncType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiEncType )
+  {
+  case WDI_ENCR_NONE:
+    return eSIR_ED_NONE;
+
+  case WDI_ENCR_WEP40:
+    return eSIR_ED_WEP40;
+
+  case WDI_ENCR_WEP104:
+    return eSIR_ED_WEP104;
+
+  case WDI_ENCR_TKIP:
+    return eSIR_ED_TKIP;
+
+  case WDI_ENCR_CCMP:
+    return eSIR_ED_CCMP;
+
+  case WDI_ENCR_AES_128_CMAC:
+    return eSIR_ED_AES_128_CMAC;
+#if defined(FEATURE_WLAN_WAPI)
+  case WDI_ENCR_WPI:
+    return eSIR_ED_WPI;
+#endif
+  default:
+    return eSIR_ED_NOT_IMPLEMENTED;
+  }
+
+}/*WDI_2_HAL_ENC_TYPE*/
+
+/*Convert WDI WEP type into HAL WEP type*/
+WPT_STATIC WPT_INLINE tAniWepType
+WDI_2_HAL_WEP_TYPE
+(
+  WDI_WepType  wdiWEPType
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiWEPType )
+  {
+  case WDI_WEP_STATIC:
+    return eSIR_WEP_STATIC;
+
+  case WDI_WEP_DYNAMIC:
+    return eSIR_WEP_DYNAMIC;
+  }
+  
+  return eSIR_WEP_MAX;
+}/*WDI_2_HAL_WEP_TYPE*/
+
+WPT_STATIC WPT_INLINE tSirLinkState
+WDI_2_HAL_LINK_STATE
+(
+  WDI_LinkStateType  wdiLinkState
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+  switch ( wdiLinkState )
+  {
+  case WDI_LINK_IDLE_STATE:
+    return eSIR_LINK_IDLE_STATE;
+
+  case WDI_LINK_PREASSOC_STATE:
+    return eSIR_LINK_PREASSOC_STATE;
+
+  case WDI_LINK_POSTASSOC_STATE:
+    return eSIR_LINK_POSTASSOC_STATE;
+
+  case WDI_LINK_AP_STATE:
+    return eSIR_LINK_AP_STATE;
+
+  case WDI_LINK_IBSS_STATE:
+    return eSIR_LINK_IBSS_STATE;
+
+  case WDI_LINK_BTAMP_PREASSOC_STATE:
+    return eSIR_LINK_BTAMP_PREASSOC_STATE;
+
+  case WDI_LINK_BTAMP_POSTASSOC_STATE:
+    return eSIR_LINK_BTAMP_POSTASSOC_STATE;
+
+  case WDI_LINK_BTAMP_AP_STATE:
+    return eSIR_LINK_BTAMP_AP_STATE;
+
+  case WDI_LINK_BTAMP_STA_STATE:
+    return eSIR_LINK_BTAMP_STA_STATE;
+
+  case WDI_LINK_LEARN_STATE:
+    return eSIR_LINK_LEARN_STATE;
+
+  case WDI_LINK_SCAN_STATE:
+    return eSIR_LINK_SCAN_STATE;
+
+  case WDI_LINK_FINISH_SCAN_STATE:
+    return eSIR_LINK_FINISH_SCAN_STATE;
+
+  case WDI_LINK_INIT_CAL_STATE:
+    return eSIR_LINK_INIT_CAL_STATE;
+
+  case WDI_LINK_FINISH_CAL_STATE:
+    return eSIR_LINK_FINISH_CAL_STATE;
+
+#ifdef WLAN_FEATURE_P2P
+  case WDI_LINK_LISTEN_STATE:
+    return eSIR_LINK_LISTEN_STATE;
+#endif
+
+  default:
+    return eSIR_LINK_MAX;
+  }  
+}
+
+/*Translate a STA Context from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE 
+void
+WDI_CopyWDIStaCtxToHALStaCtx
+( 
+  tConfigStaParams*          phalConfigSta,
+  WDI_ConfigStaReqInfoType*  pwdiConfigSta
+)
+{
+   wpt_uint8 i;
+   /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+
+  wpalMemoryCopy(phalConfigSta->bssId, 
+                  pwdiConfigSta->macBSSID, WDI_MAC_ADDR_LEN); 
+  
+  wpalMemoryCopy(phalConfigSta->staMac, 
+                  pwdiConfigSta->macSTA, WDI_MAC_ADDR_LEN); 
+
+  phalConfigSta->assocId                 = pwdiConfigSta->usAssocId;
+  phalConfigSta->staType                 = pwdiConfigSta->wdiSTAType;
+  phalConfigSta->shortPreambleSupported  = pwdiConfigSta->ucShortPreambleSupported;
+  phalConfigSta->listenInterval          = pwdiConfigSta->usListenInterval;
+  phalConfigSta->wmmEnabled              = pwdiConfigSta->ucWMMEnabled;
+  phalConfigSta->htCapable               = pwdiConfigSta->ucHTCapable;
+  phalConfigSta->txChannelWidthSet       = pwdiConfigSta->ucTXChannelWidthSet;
+  phalConfigSta->rifsMode                = pwdiConfigSta->ucRIFSMode;
+  phalConfigSta->lsigTxopProtection      = pwdiConfigSta->ucLSIGTxopProtection;
+  phalConfigSta->maxAmpduSize            = pwdiConfigSta->ucMaxAmpduSize;
+  phalConfigSta->maxAmpduDensity         = pwdiConfigSta->ucMaxAmpduDensity;
+  phalConfigSta->maxAmsduSize            = pwdiConfigSta->ucMaxAmsduSize;
+  phalConfigSta->fShortGI40Mhz           = pwdiConfigSta->ucShortGI40Mhz;
+  phalConfigSta->fShortGI20Mhz           = pwdiConfigSta->ucShortGI20Mhz;
+  phalConfigSta->rmfEnabled              = pwdiConfigSta->ucRMFEnabled;
+  phalConfigSta->action                  = pwdiConfigSta->wdiAction;
+  phalConfigSta->uAPSD                   = pwdiConfigSta->ucAPSD;
+  phalConfigSta->maxSPLen                = pwdiConfigSta->ucMaxSPLen;
+  phalConfigSta->greenFieldCapable       = pwdiConfigSta->ucGreenFieldCapable;
+  phalConfigSta->delayedBASupport        = pwdiConfigSta->ucDelayedBASupport;
+  phalConfigSta->us32MaxAmpduDuration    = pwdiConfigSta->us32MaxAmpduDuratio;
+  phalConfigSta->fDsssCckMode40Mhz       = pwdiConfigSta->ucDsssCckMode40Mhz;
+  phalConfigSta->encryptType             = pwdiConfigSta->ucEncryptType;
+  
+  phalConfigSta->mimoPS = WDI_2_HAL_MIMO_PS(pwdiConfigSta->wdiMIMOPS);
+
+  phalConfigSta->supportedRates.opRateMode = 
+                          pwdiConfigSta->wdiSupportedRates.opRateMode;
+  for(i = 0; i < SIR_NUM_11B_RATES; i ++)
+  {
+     phalConfigSta->supportedRates.llbRates[i] = 
+                          pwdiConfigSta->wdiSupportedRates.llbRates[i];
+  }
+  for(i = 0; i < SIR_NUM_11A_RATES; i ++)
+  {
+     phalConfigSta->supportedRates.llaRates[i] = 
+                          pwdiConfigSta->wdiSupportedRates.llaRates[i];
+  }
+  for(i = 0; i < SIR_NUM_POLARIS_RATES; i ++)
+  {
+     phalConfigSta->supportedRates.aniLegacyRates[i] =
+                          pwdiConfigSta->wdiSupportedRates.aLegacyRates[i];
+  }
+  phalConfigSta->supportedRates.aniEnhancedRateBitmap = 
+                          pwdiConfigSta->wdiSupportedRates.uEnhancedRateBitmap;
+  for(i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i ++)
+  {
+     phalConfigSta->supportedRates.supportedMCSSet[i] = 
+                          pwdiConfigSta->wdiSupportedRates.aSupportedMCSSet[i];
+  }
+  phalConfigSta->supportedRates.rxHighestDataRate =
+                          pwdiConfigSta->wdiSupportedRates.aRxHighestDataRate;
+
+#ifdef WLAN_FEATURE_P2P
+  phalConfigSta->p2pCapableSta = pwdiConfigSta->ucP2pCapableSta ;
+#endif
+
+}/*WDI_CopyWDIStaCtxToHALStaCtx*/;
+ 
+/*Translate a Rate set info from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE void 
+WDI_CopyWDIRateSetToHALRateSet
+( 
+  tSirMacRateSet* pHalRateSet,
+  WDI_RateSet*    pwdiRateSet
+)
+{
+  wpt_uint8 i; 
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  pHalRateSet->numRates = ( pwdiRateSet->ucNumRates <= SIR_MAC_RATESET_EID_MAX )?
+                            pwdiRateSet->ucNumRates:SIR_MAC_RATESET_EID_MAX;
+
+  for ( i = 0; i < pHalRateSet->numRates; i++ )
+  {
+    pHalRateSet->rate[i] = pwdiRateSet->aRates[i];
+  }
+  
+}/*WDI_CopyWDIRateSetToHALRateSet*/
+
+
+/*Translate an EDCA Parameter Record from WDI into HAL*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIEDCAParamsToHALEDCAParams
+( 
+  tSirMacEdcaParamRecord* phalEdcaParam,
+  WDI_EdcaParamRecord*    pWDIEdcaParam
+)
+{
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
+    the chances of getting inlined*/
+
+  phalEdcaParam->aci.rsvd   = pWDIEdcaParam->wdiACI.rsvd;
+  phalEdcaParam->aci.aci    = pWDIEdcaParam->wdiACI.aci;
+  phalEdcaParam->aci.acm    = pWDIEdcaParam->wdiACI.acm;
+  phalEdcaParam->aci.aifsn  = pWDIEdcaParam->wdiACI.aifsn;
+
+  phalEdcaParam->cw.max     = pWDIEdcaParam->wdiCW.max;
+  phalEdcaParam->cw.min     = pWDIEdcaParam->wdiCW.min;
+  phalEdcaParam->txoplimit  = pWDIEdcaParam->usTXOPLimit;
+}/*WDI_CopyWDIEDCAParamsToHALEDCAParams*/
+
+
+/*Copy a management frame header from WDI fmt into HAL fmt*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr
+(
+  tSirMacMgmtHdr* pmacMgmtHdr,
+  WDI_MacMgmtHdr* pwdiMacMgmtHdr
+)
+{
+  pmacMgmtHdr->fc.protVer    =  pwdiMacMgmtHdr->fc.protVer;
+  pmacMgmtHdr->fc.type       =  pwdiMacMgmtHdr->fc.type;
+  pmacMgmtHdr->fc.subType    =  pwdiMacMgmtHdr->fc.subType;
+  pmacMgmtHdr->fc.toDS       =  pwdiMacMgmtHdr->fc.toDS;
+  pmacMgmtHdr->fc.fromDS     =  pwdiMacMgmtHdr->fc.fromDS;
+  pmacMgmtHdr->fc.moreFrag   =  pwdiMacMgmtHdr->fc.moreFrag;
+  pmacMgmtHdr->fc.retry      =  pwdiMacMgmtHdr->fc.retry;
+  pmacMgmtHdr->fc.powerMgmt  =  pwdiMacMgmtHdr->fc.powerMgmt;
+  pmacMgmtHdr->fc.moreData   =  pwdiMacMgmtHdr->fc.moreData;
+  pmacMgmtHdr->fc.wep        =  pwdiMacMgmtHdr->fc.wep;
+  pmacMgmtHdr->fc.order      =  pwdiMacMgmtHdr->fc.order;
+
+  pmacMgmtHdr->durationLo =  pwdiMacMgmtHdr->durationLo;
+  pmacMgmtHdr->durationHi =  pwdiMacMgmtHdr->durationHi;
+
+  wpalMemoryCopy(pmacMgmtHdr->da, 
+                 pwdiMacMgmtHdr->da, 6);
+  wpalMemoryCopy(pmacMgmtHdr->sa, 
+                 pwdiMacMgmtHdr->sa, 6);
+  wpalMemoryCopy(pmacMgmtHdr->bssId, 
+                 pwdiMacMgmtHdr->bssId, 6);
+
+  pmacMgmtHdr->seqControl.fragNum  =  pwdiMacMgmtHdr->seqControl.fragNum;
+  pmacMgmtHdr->seqControl.seqNumLo =  pwdiMacMgmtHdr->seqControl.seqNumLo;
+  pmacMgmtHdr->seqControl.seqNumHi =  pwdiMacMgmtHdr->seqControl.seqNumHi;
+
+}/*WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr*/
+
+
+/*Copy config bss parameters from WDI fmt into HAL fmt*/
+WPT_STATIC WPT_INLINE void
+WDI_CopyWDIConfigBSSToHALConfigBSS
+(
+  tConfigBssParams*         phalConfigBSS,
+  WDI_ConfigBSSReqInfoType* pwdiConfigBSS
+)
+{
+
+  wpt_uint8 keyIndex = 0;
+  wpalMemoryCopy( phalConfigBSS->bssId,
+                  pwdiConfigBSS->macBSSID,
+                  WDI_MAC_ADDR_LEN);
+
+#ifdef HAL_SELF_STA_PER_BSS
+  wpalMemoryCopy( phalConfigBSS->selfMacAddr,
+                  pwdiConfigBSS->macSelfAddr,
+                  WDI_MAC_ADDR_LEN);
+#endif
+
+  phalConfigBSS->bssType  = WDI_2_HAL_BSS_TYPE(pwdiConfigBSS->wdiBSSType);
+
+  phalConfigBSS->operMode = pwdiConfigBSS->ucOperMode;
+  phalConfigBSS->nwType   = WDI_2_HAL_NW_TYPE(pwdiConfigBSS->wdiNWType);
+
+  phalConfigBSS->shortSlotTimeSupported = 
+     pwdiConfigBSS->ucShortSlotTimeSupported;
+  phalConfigBSS->llaCoexist         = pwdiConfigBSS->ucllaCoexist;
+  phalConfigBSS->llbCoexist         = pwdiConfigBSS->ucllbCoexist;
+  phalConfigBSS->llgCoexist         = pwdiConfigBSS->ucllgCoexist;
+  phalConfigBSS->ht20Coexist        = pwdiConfigBSS->ucHT20Coexist;
+  phalConfigBSS->llnNonGFCoexist    = pwdiConfigBSS->ucllnNonGFCoexist;
+  phalConfigBSS->fLsigTXOPProtectionFullSupport = 
+    pwdiConfigBSS->ucTXOPProtectionFullSupport;
+  phalConfigBSS->fRIFSMode          = pwdiConfigBSS->ucRIFSMode;
+  phalConfigBSS->beaconInterval     = pwdiConfigBSS->usBeaconInterval;
+  phalConfigBSS->dtimPeriod         = pwdiConfigBSS->ucDTIMPeriod;
+  phalConfigBSS->txChannelWidthSet  = pwdiConfigBSS->ucTXChannelWidthSet;
+  phalConfigBSS->currentOperChannel = pwdiConfigBSS->ucCurrentOperChannel;
+  phalConfigBSS->currentExtChannel  = pwdiConfigBSS->ucCurrentExtChannel;
+  phalConfigBSS->action             = pwdiConfigBSS->wdiAction;
+  phalConfigBSS->htCapable          = pwdiConfigBSS->ucHTCapable;
+  phalConfigBSS->obssProtEnabled    = pwdiConfigBSS->ucObssProtEnabled;
+  phalConfigBSS->rmfEnabled         = pwdiConfigBSS->ucRMFEnabled;
+
+  phalConfigBSS->htOperMode = 
+    WDI_2_HAL_HT_OPER_MODE(pwdiConfigBSS->wdiHTOperMod); 
+
+  phalConfigBSS->dualCTSProtection        = pwdiConfigBSS->ucDualCTSProtection;
+  phalConfigBSS->ucMaxProbeRespRetryLimit = pwdiConfigBSS->ucMaxProbeRespRetryLimit;
+  phalConfigBSS->bHiddenSSIDEn            = pwdiConfigBSS->bHiddenSSIDEn;
+  phalConfigBSS->bProxyProbeRespEn        = pwdiConfigBSS->bProxyProbeRespEn;
+
+#ifdef WLAN_FEATURE_VOWIFI
+  phalConfigBSS->maxTxPower               = pwdiConfigBSS->cMaxTxPower;
+#endif
+
+  /*! Used 32 as magic number because that is how the ssid is declared inside the
+   hal header - hal needs a macro for it */
+  phalConfigBSS->ssId.length = 
+    (pwdiConfigBSS->wdiSSID.ucLength <= 32)?
+    pwdiConfigBSS->wdiSSID.ucLength : 32;
+  wpalMemoryCopy(phalConfigBSS->ssId.ssId,
+                 pwdiConfigBSS->wdiSSID.sSSID, 
+                 phalConfigBSS->ssId.length); 
+
+  WDI_CopyWDIStaCtxToHALStaCtx( &phalConfigBSS->staContext,
+                                &pwdiConfigBSS->wdiSTAContext);
+  
+  WDI_CopyWDIRateSetToHALRateSet( &phalConfigBSS->rateSet,
+                                  &pwdiConfigBSS->wdiRateSet);
+
+  phalConfigBSS->edcaParamsValid = pwdiConfigBSS->ucEDCAParamsValid;
+
+  if(phalConfigBSS->edcaParamsValid)
+  {
+     WDI_CopyWDIEDCAParamsToHALEDCAParams( &phalConfigBSS->acbe,
+                                        &pwdiConfigBSS->wdiBEEDCAParams);
+     WDI_CopyWDIEDCAParamsToHALEDCAParams( &phalConfigBSS->acbk,
+                                           &pwdiConfigBSS->wdiBKEDCAParams);
+     WDI_CopyWDIEDCAParamsToHALEDCAParams( &phalConfigBSS->acvi,
+                                           &pwdiConfigBSS->wdiVIEDCAParams);
+     WDI_CopyWDIEDCAParamsToHALEDCAParams( &phalConfigBSS->acvo,
+                                           &pwdiConfigBSS->wdiVOEDCAParams);
+  }
+
+  phalConfigBSS->halPersona = pwdiConfigBSS->ucPersona; 
+
+  phalConfigBSS->bSpectrumMgtEnable = pwdiConfigBSS->bSpectrumMgtEn;
+
+#ifdef WLAN_FEATURE_VOWIFI_11R
+
+  phalConfigBSS->extSetStaKeyParamValid = 
+     pwdiConfigBSS->bExtSetStaKeyParamValid;
+  
+  if( phalConfigBSS->extSetStaKeyParamValid )
+  {
+     /*-----------------------------------------------------------------------
+       Copy the STA Key parameters into the HAL message
+     -----------------------------------------------------------------------*/
+     phalConfigBSS->extSetStaKeyParam.encType = 
+        WDI_2_HAL_ENC_TYPE (pwdiConfigBSS->wdiExtSetKeyParam.wdiEncType);
+
+     phalConfigBSS->extSetStaKeyParam.wepType = 
+        WDI_2_HAL_WEP_TYPE (pwdiConfigBSS->wdiExtSetKeyParam.wdiWEPType );
+
+     phalConfigBSS->extSetStaKeyParam.staIdx = pwdiConfigBSS->wdiExtSetKeyParam.ucSTAIdx;
+
+     phalConfigBSS->extSetStaKeyParam.defWEPIdx = pwdiConfigBSS->wdiExtSetKeyParam.ucDefWEPIdx;
+
+     phalConfigBSS->extSetStaKeyParam.singleTidRc = pwdiConfigBSS->wdiExtSetKeyParam.ucSingleTidRc;
+
+#ifdef WLAN_SOFTAP_FEATURE
+     for(keyIndex = 0; keyIndex < pwdiConfigBSS->wdiExtSetKeyParam.ucNumKeys ;
+          keyIndex++)
+     {
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyId = 
+           pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyId;
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].unicast =
+           pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].unicast;
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyDirection =
+           pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyDirection;
+        wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyRsc,
+                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc, 
+                       WDI_MAX_KEY_RSC_LEN);
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].paeRole = 
+           pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].paeRole;
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyLength = 
+           pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyLength;
+        wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key[keyIndex].key,
+                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].key, 
+                       WDI_MAX_KEY_LENGTH);
+     }
+#else
+     phalConfigBSS->extSetStaKeyParam.key.keyId = 
+        pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyId;
+     phalConfigBSS->extSetStaKeyParam.key.unicast =
+        pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].unicast;
+     phalConfigBSS->extSetStaKeyParam.key.keyDirection =
+        pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyDirection;
+     wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key.keyRsc,
+                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyRsc, 
+                    WDI_MAX_KEY_RSC_LEN);
+     phalConfigBSS->extSetStaKeyParam.key.paeRole = 
+        pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].paeRole;
+     phalConfigBSS->extSetStaKeyParam.key.keyLength = 
+        pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyLength;
+     wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key.key,
+                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].key, 
+                    WDI_MAX_KEY_LENGTH);
+#endif
+  }
+  else/* phalConfigBSS->extSetStaKeyParamValid is not set */
+  {
+     wpalMemoryZero( &phalConfigBSS->extSetStaKeyParam, 
+                     sizeof(phalConfigBSS->extSetStaKeyParam) );
+  }
+
+#endif /*WLAN_FEATURE_VOWIFI_11R*/
+
+}/*WDI_CopyWDIConfigBSSToHALConfigBSS*/
+
+
+/*Extract the request CB function and user data from a request structure 
+  pointed to by user data */
+WPT_STATIC WPT_INLINE void
+WDI_ExtractRequestCBFromEvent
+(
+  WDI_EventInfoType* pEvent,
+  WDI_ReqStatusCb*   ppfnReqCB, 
+  void**             ppUserData
+)
+{
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  switch ( pEvent->wdiRequest )
+  {
+  case WDI_START_REQ:
+    *ppfnReqCB   =  ((WDI_StartReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_StartReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_STOP_REQ:
+    *ppfnReqCB   =  ((WDI_StopReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_StopReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_INIT_SCAN_REQ:
+    *ppfnReqCB   =  ((WDI_InitScanReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_InitScanReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_START_SCAN_REQ:
+    *ppfnReqCB   =  ((WDI_StartScanReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_StartScanReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_END_SCAN_REQ:
+    *ppfnReqCB   =  ((WDI_EndScanReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_EndScanReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_FINISH_SCAN_REQ:
+    *ppfnReqCB   =  ((WDI_FinishScanReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_FinishScanReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_JOIN_REQ:
+    *ppfnReqCB   =  ((WDI_JoinReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_JoinReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_CONFIG_BSS_REQ:
+    *ppfnReqCB   =  ((WDI_ConfigBSSReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_ConfigBSSReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_DEL_BSS_REQ:
+    *ppfnReqCB   =  ((WDI_DelBSSReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_DelBSSReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_POST_ASSOC_REQ:
+    *ppfnReqCB   =  ((WDI_PostAssocReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_PostAssocReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_DEL_STA_REQ:
+    *ppfnReqCB   =  ((WDI_DelSTAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_DelSTAReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_DEL_STA_SELF_REQ:
+    *ppfnReqCB   =  ((WDI_DelSTASelfReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_DelSTASelfReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+
+  case WDI_SET_BSS_KEY_REQ:
+    *ppfnReqCB   =  ((WDI_SetBSSKeyReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SetBSSKeyReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_RMV_BSS_KEY_REQ:
+    *ppfnReqCB   =  ((WDI_RemoveBSSKeyReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_RemoveBSSKeyReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_SET_STA_KEY_REQ:
+    *ppfnReqCB   =  ((WDI_SetSTAKeyReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SetSTAKeyReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_RMV_STA_KEY_REQ:
+    *ppfnReqCB   =  ((WDI_RemoveSTAKeyReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_RemoveSTAKeyReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_ADD_TS_REQ:
+    *ppfnReqCB   =  ((WDI_AddTSReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_AddTSReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_DEL_TS_REQ:
+    *ppfnReqCB   =  ((WDI_DelTSReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_DelTSReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_UPD_EDCA_PRMS_REQ:
+    *ppfnReqCB   =  ((WDI_UpdateEDCAParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_UpdateEDCAParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_ADD_BA_SESSION_REQ:
+    *ppfnReqCB   =  ((WDI_AddBASessionReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_AddBASessionReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_DEL_BA_REQ:
+    *ppfnReqCB   =  ((WDI_DelBAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_DelBAReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+#ifdef FEATURE_WLAN_CCX
+   case WDI_TSM_STATS_REQ:
+    *ppfnReqCB   =  ((WDI_TSMStatsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_TSMStatsReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+#endif
+  case WDI_CH_SWITCH_REQ:
+    *ppfnReqCB   =  ((WDI_SwitchChReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SwitchChReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_CONFIG_STA_REQ:
+    *ppfnReqCB   =  ((WDI_ConfigSTAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_ConfigSTAReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_SET_LINK_ST_REQ:
+    *ppfnReqCB   =  ((WDI_SetLinkReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SetLinkReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_GET_STATS_REQ:
+    *ppfnReqCB   =  ((WDI_GetStatsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_GetStatsReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_UPDATE_CFG_REQ:
+    *ppfnReqCB   =  ((WDI_UpdateCfgReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_UpdateCfgReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_ADD_BA_REQ:
+    *ppfnReqCB   =  ((WDI_AddBAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_AddBAReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_TRIGGER_BA_REQ:
+    *ppfnReqCB   =  ((WDI_TriggerBAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_TriggerBAReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case  WDI_UPD_BCON_PRMS_REQ:
+    *ppfnReqCB   =  ((WDI_UpdateBeaconParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_UpdateBeaconParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_SND_BCON_REQ:
+    *ppfnReqCB   =  ((WDI_SendBeaconParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SendBeaconParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_ENTER_BMPS_REQ:
+    *ppfnReqCB   =  ((WDI_EnterBmpsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_EnterBmpsReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_EXIT_BMPS_REQ:
+    *ppfnReqCB   =  ((WDI_ExitBmpsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_ExitBmpsReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_ENTER_UAPSD_REQ:
+    *ppfnReqCB   =  ((WDI_EnterUapsdReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_EnterUapsdReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_UPDATE_UAPSD_PARAM_REQ:
+    *ppfnReqCB   =  ((WDI_UpdateUapsdReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_UpdateUapsdReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_CONFIGURE_RXP_FILTER_REQ:
+    *ppfnReqCB   =  ((WDI_ConfigureRxpFilterReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_ConfigureRxpFilterReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_SET_BEACON_FILTER_REQ:
+    *ppfnReqCB   =  ((WDI_BeaconFilterReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_BeaconFilterReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_REM_BEACON_FILTER_REQ:
+    *ppfnReqCB   =  ((WDI_RemBeaconFilterReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_RemBeaconFilterReqParamsType*)pEvent->pEventData)->pUserData;
+     break; 
+  case  WDI_SET_RSSI_THRESHOLDS_REQ:
+    *ppfnReqCB   =  ((WDI_SetRSSIThresholdsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SetRSSIThresholdsReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_HOST_OFFLOAD_REQ:
+    *ppfnReqCB   =  ((WDI_HostOffloadReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_HostOffloadReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_WOWL_ADD_BC_PTRN_REQ:
+    *ppfnReqCB   =  ((WDI_WowlAddBcPtrnReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_WowlAddBcPtrnReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_WOWL_DEL_BC_PTRN_REQ:
+    *ppfnReqCB   =  ((WDI_WowlDelBcPtrnReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_WowlDelBcPtrnReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_WOWL_ENTER_REQ:
+    *ppfnReqCB   =  ((WDI_WowlEnterReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_WowlEnterReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case  WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ:
+    *ppfnReqCB   =  ((WDI_ConfigureAppsCpuWakeupStateReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_ConfigureAppsCpuWakeupStateReqParamsType*)pEvent->pEventData)->pUserData;
+     break;
+  case WDI_FLUSH_AC_REQ:
+    *ppfnReqCB   =  ((WDI_FlushAcReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_FlushAcReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_BTAMP_EVENT_REQ:
+    *ppfnReqCB   =  ((WDI_BtAmpEventParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_BtAmpEventParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_KEEP_ALIVE_REQ:
+    *ppfnReqCB   =  ((WDI_KeepAliveReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_KeepAliveReqParamsType*)pEvent->pEventData)->pUserData;
+    break;
+  case WDI_SET_TX_PER_TRACKING_REQ:
+    *ppfnReqCB   =  ((WDI_SetTxPerTrackingReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_SetTxPerTrackingReqParamsType*)pEvent->pEventData)->pUserData;
+  default:
+    *ppfnReqCB   =  NULL;
+    *ppUserData  =  NULL;
+      break; 
+  }
+}/*WDI_ExtractRequestCBFromEvent*/
+
+
+/**
+ @brief WDI_IsHwFrameTxTranslationCapable checks to see if HW 
+        frame xtl is enabled for a particular STA.
+
+ WDI_PostAssocReq must have been called.
+
+ @param uSTAIdx: STA index 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+wpt_boolean 
+WDI_IsHwFrameTxTranslationCapable
+(
+  wpt_uint8 uSTAIdx
+)
+{
+  /*!! FIX ME - this must eventually be per station - for now just feedback 
+    uma value*/
+  /*------------------------------------------------------------------------
+    Sanity Check 
+  ------------------------------------------------------------------------*/
+  if ( eWLAN_PAL_FALSE == gWDIInitialized )
+  {
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "WDI API call before module is initialized - Fail request");
+
+    return WDI_STATUS_E_NOT_ALLOWED; 
+  }
+
+  
+  return gWDICb.bFrameTransEnabled;
+}/*WDI_IsHwFrameTxTranslationCapable*/
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+/**
+ @brief WDI_SetPreferredNetworkList
+
+ @param pwdiPNOScanReqParams: the Set PNO as specified 
+                      by the Device Interface
+  
+        wdiPNOScanCb: callback for passing back the response
+        of the Set PNO operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetPreferredNetworkReq
+(
+  WDI_PNOScanReqParamsType* pwdiPNOScanReqParams,
+  WDI_PNOScanCb             wdiPNOScanCb,
+  void*                      pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData = {{0}};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_PREF_NETWORK_REQ;
+   wdiEventData.pEventData      = pwdiPNOScanReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiPNOScanReqParams);
+   wdiEventData.pCBfnc          = wdiPNOScanCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+
+/**
+ @brief WDI_SetRssiFilterReq
+
+ @param pwdiRssiFilterReqParams: the Set RSSI Filter as 
+                      specified by the Device Interface
+  
+        wdiRssiFilterCb: callback for passing back the response
+        of the Set RSSI Filter operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetRssiFilterReq
+(
+  WDI_SetRssiFilterReqParamsType* pwdiRssiFilterReqParams,
+  WDI_RssiFilterCb                wdiRssiFilterCb,
+  void*                           pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData = {{0}};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_RSSI_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiRssiFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRssiFilterReqParams);
+   wdiEventData.pCBfnc          = wdiRssiFilterCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_SetRssiFilterReq*/
+
+/**
+ @brief WDI_UpdateScanParamsReq
+
+ @param pwdiUpdateScanParamsInfoType: the Update Scan Params as specified 
+                      by the Device Interface
+  
+        wdiUpdateScanParamsCb: callback for passing back the response
+        of the Set PNO operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_UpdateScanParamsReq
+(
+  WDI_UpdateScanParamsInfoType* pwdiUpdateScanParamsInfoType,
+  WDI_UpdateScanParamsCb        wdiUpdateScanParamsCb,
+  void*                         pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData = {{0}};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_UPDATE_SCAN_PARAMS_REQ;
+   wdiEventData.pEventData      = pwdiUpdateScanParamsInfoType; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateScanParamsInfoType);
+   wdiEventData.pCBfnc          = wdiUpdateScanParamsCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief Helper function to pack Set Preferred Network List 
+        Request parameters
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pwdiPNOScanReqParams:      pointer to the info received
+         from upper layers
+         ppSendBuffer, pSize - out pointers of the packed buffer
+         and its size 
+  
+ @return Result of the function call
+*/
+
+WDI_Status
+WDI_PackPreferredNetworkList
+(
+  WDI_ControlBlockType*      pWDICtx,
+  WDI_PNOScanReqParamsType*  pwdiPNOScanReqParams,
+  wpt_uint8**                ppSendBuffer,
+  wpt_uint16*                pSize
+)
+{
+   wpt_uint8*                 pSendBuffer           = NULL; 
+   wpt_uint16                 usDataOffset          = 0;
+   wpt_uint16                 usSendSize            = 0;
+   tPrefNetwListParams        pPrefNetwListParams = {0};
+   wpt_uint8 i;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
+                         sizeof(pPrefNetwListParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pPrefNetwListParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Set PNO req %x ",
+                   pwdiPNOScanReqParams);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Fill prefNetwListParams from pwdiPNOScanReqParams->wdiPNOScanInfo
+   -------------------------------------------------------------------------*/
+   pPrefNetwListParams.enable  = 
+     pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable;
+   pPrefNetwListParams.modePNO = 
+     pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO;
+
+   pPrefNetwListParams.ucNetworksCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount < 
+      WLAN_HAL_PNO_MAX_SUPP_NETWORKS)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount : 
+      WLAN_HAL_PNO_MAX_SUPP_NETWORKS;
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d", 
+               pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount);
+
+   for ( i = 0; i < pPrefNetwListParams.ucNetworksCount; i++ )
+   {
+     /*SSID of the BSS*/
+     pPrefNetwListParams.aNetworks[i].ssId.length
+        = pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.ucLength;
+
+     wpalMemoryCopy( pPrefNetwListParams.aNetworks[i].ssId.ssId,
+          pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.sSSID,
+          pPrefNetwListParams.aNetworks[i].ssId.length);
+
+     /*Authentication type for the network*/
+     pPrefNetwListParams.aNetworks[i].authentication = 
+       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth; 
+
+     /*Encryption type for the network*/
+     pPrefNetwListParams.aNetworks[i].encryption = 
+       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption; 
+
+     /*Indicate the channel on which the Network can be found 
+       0 - if all channels */
+     pPrefNetwListParams.aNetworks[i].ucChannelCount = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount;
+
+     wpalMemoryCopy(pPrefNetwListParams.aNetworks[i].aChannels,
+                    pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].aChannels,
+                    pPrefNetwListParams.aNetworks[i].ucChannelCount);
+
+     /*Indicates the RSSI threshold for the network to be considered*/
+     pPrefNetwListParams.aNetworks[i].rssiThreshold =
+       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].rssiThreshold;
+
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI SET PNO: SSID %d %s", 
+               pPrefNetwListParams.aNetworks[i].ssId.length,
+               pPrefNetwListParams.aNetworks[i].ssId.ssId);
+   }
+
+   pPrefNetwListParams.scanTimers.ucScanTimersCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount < 
+      WLAN_HAL_PNO_MAX_SCAN_TIMERS)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount :
+      WLAN_HAL_PNO_MAX_SCAN_TIMERS;
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d", 
+               pPrefNetwListParams.scanTimers.ucScanTimersCount,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize);
+
+   for ( i = 0; i < pPrefNetwListParams.scanTimers.ucScanTimersCount; i++   )
+   {
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerValue  = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerValue;
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerRepeat = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerRepeat;
+   }
+
+   /*Copy the probe template*/
+   pPrefNetwListParams.us24GProbeSize = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize<
+     WLAN_HAL_PNO_MAX_PROBE_SIZE)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize:
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
+
+   wpalMemoryCopy(pPrefNetwListParams.a24GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate, 
+                  pPrefNetwListParams.us24GProbeSize); 
+
+   pPrefNetwListParams.us5GProbeSize = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize <
+     WLAN_HAL_PNO_MAX_PROBE_SIZE)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize:
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
+
+   wpalMemoryCopy(pPrefNetwListParams.a5GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate, 
+                  pPrefNetwListParams.us5GProbeSize); 
+
+   /*Pack the buffer*/
+   wpalMemoryCopy( pSendBuffer+usDataOffset, &pPrefNetwListParams, 
+                   sizeof(pPrefNetwListParams)); 
+
+   /*Set the output values*/
+   *ppSendBuffer = pSendBuffer;
+   *pSize        = usSendSize; 
+
+   return WDI_STATUS_SUCCESS;
+}/*WDI_PackPreferredNetworkList*/
+
+/**
+ @brief Helper function to pack Set Preferred Network List 
+        Request parameters
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pwdiPNOScanReqParams:      pointer to the info received
+         from upper layers
+         ppSendBuffer, pSize - out pointers of the packed buffer
+         and its size 
+  
+ @return Result of the function call
+*/
+
+WDI_Status
+WDI_PackPreferredNetworkListNew
+(
+  WDI_ControlBlockType*      pWDICtx,
+  WDI_PNOScanReqParamsType*  pwdiPNOScanReqParams,
+  wpt_uint8**                ppSendBuffer,
+  wpt_uint16*                pSize
+)
+{
+   wpt_uint8*                 pSendBuffer           = NULL; 
+   wpt_uint16                 usDataOffset          = 0;
+   wpt_uint16                 usSendSize            = 0;
+   tPrefNetwListParamsNew     pPrefNetwListParams;
+   wpt_uint8 i;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
+                         sizeof(pPrefNetwListParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(pPrefNetwListParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Set PNO req %x  ",
+                   pwdiPNOScanReqParams);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Fill prefNetwListParams from pwdiPNOScanReqParams->wdiPNOScanInfo
+   -------------------------------------------------------------------------*/
+   pPrefNetwListParams.enable  = 
+     pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable;
+   pPrefNetwListParams.modePNO = 
+     pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO;
+
+   pPrefNetwListParams.ucNetworksCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount < 
+      WLAN_HAL_PNO_MAX_SUPP_NETWORKS)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount : 
+      WLAN_HAL_PNO_MAX_SUPP_NETWORKS;
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d", 
+               pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount);
+
+   for ( i = 0; i < pPrefNetwListParams.ucNetworksCount; i++ )
+   {
+     /*SSID of the BSS*/
+     pPrefNetwListParams.aNetworks[i].ssId.length
+        = pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.ucLength;
+
+     wpalMemoryCopy( pPrefNetwListParams.aNetworks[i].ssId.ssId,
+          pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.sSSID,
+          pPrefNetwListParams.aNetworks[i].ssId.length);
+
+     /*Authentication type for the network*/
+     pPrefNetwListParams.aNetworks[i].authentication = 
+       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth; 
+
+     /*Encryption type for the network*/
+     pPrefNetwListParams.aNetworks[i].encryption = 
+       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption; 
+
+     /*SSID bcast type for the network*/
+     pPrefNetwListParams.aNetworks[i].bcastNetworkType = 
+       (tSSIDBcastType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiBcastNetworkType; 
+
+     /*Indicate the channel on which the Network can be found 
+       0 - if all channels */
+     pPrefNetwListParams.aNetworks[i].ucChannelCount = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount;
+
+     wpalMemoryCopy(pPrefNetwListParams.aNetworks[i].aChannels,
+                    pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].aChannels,
+                    pPrefNetwListParams.aNetworks[i].ucChannelCount);
+
+     /*Indicates the RSSI threshold for the network to be considered*/
+     pPrefNetwListParams.aNetworks[i].rssiThreshold =
+       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].rssiThreshold;
+
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "WDI SET PNO: SSID %d %s", 
+               pPrefNetwListParams.aNetworks[i].ssId.length,
+               pPrefNetwListParams.aNetworks[i].ssId.ssId);
+   }
+
+   pPrefNetwListParams.scanTimers.ucScanTimersCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount < 
+      WLAN_HAL_PNO_MAX_SCAN_TIMERS)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount :
+      WLAN_HAL_PNO_MAX_SCAN_TIMERS;
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d", 
+               pPrefNetwListParams.scanTimers.ucScanTimersCount,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize,
+               pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize);
+
+   for ( i = 0; i < pPrefNetwListParams.scanTimers.ucScanTimersCount; i++   )
+   {
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerValue  = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerValue;
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerRepeat = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerRepeat;
+   }
+
+   /*Copy the probe template*/
+   pPrefNetwListParams.us24GProbeSize = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize<
+     WLAN_HAL_PNO_MAX_PROBE_SIZE)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize:
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
+
+   wpalMemoryCopy(pPrefNetwListParams.a24GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate, 
+                  pPrefNetwListParams.us24GProbeSize); 
+
+   pPrefNetwListParams.us5GProbeSize = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize <
+     WLAN_HAL_PNO_MAX_PROBE_SIZE)?
+     pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize:
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
+
+   wpalMemoryCopy(pPrefNetwListParams.a5GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate, 
+                  pPrefNetwListParams.us5GProbeSize); 
+
+   /*Pack the buffer*/
+   wpalMemoryCopy( pSendBuffer+usDataOffset, &pPrefNetwListParams, 
+                   sizeof(pPrefNetwListParams)); 
+
+   /*Set the output values*/
+   *ppSendBuffer = pSendBuffer;
+   *pSize        = usSendSize; 
+
+   return WDI_STATUS_SUCCESS;
+}/*WDI_PackPreferredNetworkListNew*/
+
+/**
+ @brief Process Set Preferred Network List Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPreferredNetworkReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_PNOScanReqParamsType*  pwdiPNOScanReqParams  = NULL;
+   WDI_PNOScanCb              wdiPNOScanCb          = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
+   wpt_uint16                 usSendSize            = 0;
+   WDI_Status                 wdiStatus; 
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiPNOScanReqParams = (WDI_PNOScanReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiPNOScanCb   = (WDI_PNOScanCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Pack the PNO request structure based on version
+   -------------------------------------------------------------------------*/
+   if ( pWDICtx->wdiPNOVersion > 0 )
+   {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                  "%s: PNO new version %d ", __FUNCTION__, 
+                  pWDICtx->wdiPNOVersion);
+
+     wdiStatus = WDI_PackPreferredNetworkListNew( pWDICtx, pwdiPNOScanReqParams,
+                                      &pSendBuffer, &usSendSize);
+   }
+   else
+   {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                  "%s: PNO old version %d ", __FUNCTION__, 
+                  pWDICtx->wdiPNOVersion);
+
+     wdiStatus = WDI_PackPreferredNetworkList( pWDICtx, pwdiPNOScanReqParams,
+                                      &pSendBuffer, &usSendSize);
+   }
+
+   if (( WDI_STATUS_SUCCESS != wdiStatus )||
+       ( NULL == pSendBuffer )||( 0 == usSendSize ))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: failed to pack request parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return wdiStatus; 
+   }
+
+   pWDICtx->wdiReqStatusCB     = pwdiPNOScanReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiPNOScanReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+               wdiPNOScanCb, pEventData->pUserData, WDI_SET_PREF_NETWORK_RESP); 
+}
+
+/**
+ @brief Process Set RSSI Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRssiFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetRssiFilterReqParamsType* pwdiRssiFilterReqParams = NULL;
+   WDI_RssiFilterCb                wdiRssiFilterCb         = NULL;
+   wpt_uint8*                      pSendBuffer             = NULL; 
+   wpt_uint16                      usDataOffset            = 0;
+   wpt_uint16                      usSendSize              = 0;
+   wpt_uint8                       ucRssiThreshold;
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiRssiFilterReqParams = (WDI_SetRssiFilterReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiRssiFilterCb   = (WDI_RssiFilterCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
+                         sizeof(ucRssiThreshold),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(ucRssiThreshold) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Set PNO req %x %x %x",
+                  pEventData, pwdiRssiFilterReqParams, wdiRssiFilterCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   ucRssiThreshold = pwdiRssiFilterReqParams->rssiThreshold;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &ucRssiThreshold, 
+                   sizeof(ucRssiThreshold)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiRssiFilterReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiRssiFilterReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiRssiFilterCb, pEventData->pUserData, WDI_SET_RSSI_FILTER_RESP); 
+}
+
+
+/**
+ @brief Process Update Scan Params function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateScanParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_UpdateScanParamsInfoType* pwdiUpdateScanParams  = NULL;
+   WDI_UpdateScanParamsCb        wdiUpdateScanParamsCb = NULL;
+   wpt_uint8*                    pSendBuffer           = NULL; 
+   wpt_uint16                    usDataOffset          = 0;
+   wpt_uint16                    usSendSize            = 0;
+   tUpdateScanParams             updateScanParams = {0};
+
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiUpdateScanParams = (WDI_UpdateScanParamsInfoType*)pEventData->pEventData)) ||
+       ( NULL == (wdiUpdateScanParamsCb   = (WDI_UpdateScanParamsCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+               "Begin WDI Update Scan Parameters");
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_SCAN_PARAMS_REQ, 
+                         sizeof(updateScanParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(updateScanParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Update Scan Params req %x %x %x",
+                  pEventData, pwdiUpdateScanParams, wdiUpdateScanParamsCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   //
+   // Fill updateScanParams from pwdiUpdateScanParams->wdiUpdateScanParamsInfo
+   //
+
+   updateScanParams.b11dEnabled    = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.b11dEnabled;
+   updateScanParams.b11dResolved   = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.b11dResolved;
+   updateScanParams.ucChannelCount = 
+     (pwdiUpdateScanParams->wdiUpdateScanParamsInfo.ucChannelCount <
+     WLAN_HAL_PNO_MAX_NETW_CHANNELS)?
+     pwdiUpdateScanParams->wdiUpdateScanParamsInfo.ucChannelCount :
+     WLAN_HAL_PNO_MAX_NETW_CHANNELS;
+
+   wpalMemoryCopy( updateScanParams.aChannels, 
+                   pwdiUpdateScanParams->wdiUpdateScanParamsInfo.aChannels,
+                   updateScanParams.ucChannelCount);
+
+   updateScanParams.usActiveMinChTime  = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.usActiveMinChTime;
+   updateScanParams.usActiveMaxChTime  = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.usActiveMaxChTime;
+   updateScanParams.usPassiveMinChTime = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.usPassiveMinChTime;
+   updateScanParams.usPassiveMaxChTime = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.usPassiveMaxChTime;
+   updateScanParams.cbState            = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.cbState;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &updateScanParams, 
+                   sizeof(updateScanParams)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiUpdateScanParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiUpdateScanParams->pUserData; 
+
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+               "End Update Scan Parameters");
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiUpdateScanParamsCb, pEventData->pUserData, WDI_UPDATE_SCAN_PARAMS_RESP); 
+}
+
+/**
+ @brief Process Preferred Network Found Indication function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessPrefNetworkFoundInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType  wdiInd;
+  tPrefNetwFoundInd    prefNetwFoundInd = {{0}};
+
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT( 0 );
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  wpalMemoryCopy( (void *)&prefNetwFoundInd.prefNetwFoundParams, 
+                  pEventData->pEventData, 
+                  sizeof(tPrefNetwFoundParams));
+
+  /*Fill in the indication parameters*/
+  wdiInd.wdiIndicationType = WDI_PREF_NETWORK_FOUND_IND; 
+
+  wpalMemoryZero(wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID,32);
+
+  wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength = 
+     (prefNetwFoundInd.prefNetwFoundParams.ssId.length < 31 )?
+      prefNetwFoundInd.prefNetwFoundParams.ssId.length : 31; 
+
+  wpalMemoryCopy( wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID, 
+                  prefNetwFoundInd.prefNetwFoundParams.ssId.ssId, 
+                  wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength);
+
+  wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.rssi =
+     prefNetwFoundInd.prefNetwFoundParams.rssi;
+
+  // DEBUG
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "[PNO WDI] PREF_NETWORK_FOUND_IND Type (%x) data (SSID=%s, RSSI=%d)",
+              wdiInd.wdiIndicationType,
+              wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID,
+              wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.rssi );
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+  
+  return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief Process PNO Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPreferredNetworkRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_PNOScanCb       wdiPNOScanCb   = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+
+   wdiPNOScanCb = (WDI_PNOScanCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiPNOScanCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetPreferredNetworkRsp*/
+
+/**
+ @brief Process RSSI Filter Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetRssiFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_RssiFilterCb     wdiRssiFilterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiRssiFilterCb = (WDI_RssiFilterCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiRssiFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetRssiFilterRsp*/
+
+/**
+ @brief Process Update Scan Params Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessUpdateScanParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status             wdiStatus;
+   tUpdateScanParamsResp  halUpdScanParams; 
+   WDI_UpdateScanParamsCb wdiUpdateScanParamsCb   = NULL;
+   wpt_uint32             uStatus; 
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                  "Process UPD scan params ptr : %x", __FUNCTION__);
+
+  wdiUpdateScanParamsCb = (WDI_UpdateScanParamsCb)pWDICtx->pfncRspCB; 
+
+  /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+  wpalMemoryCopy( (void *)&halUpdScanParams.status, 
+                  pEventData->pEventData, 
+                  sizeof(halUpdScanParams.status));
+
+  uStatus  = halUpdScanParams.status;
+
+  /*Extract PNO version - 1st bit of the status */
+  pWDICtx->wdiPNOVersion = (uStatus & WDI_PNO_VERSION_MASK)? 1:0; 
+
+  /*Remove version bit*/
+  uStatus = uStatus & ( ~(WDI_PNO_VERSION_MASK)); 
+
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(uStatus); 
+
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+              "UPD Scan Parameters rsp with status: %d", 
+              halUpdScanParams.status);
+
+  /*Notify UMAC*/
+  wdiUpdateScanParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS; 
+}
+#endif // FEATURE_WLAN_SCAN_PNO
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+WDI_Status 
+WDI_8023MulticastListReq
+(
+  WDI_RcvFltPktSetMcListReqParamsType*  pwdiRcvFltPktSetMcListReqInfo,
+  WDI_8023MulticastListCb               wdi8023MulticastListCallback,
+  void*                                 pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s", __FUNCTION__);
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_8023_MULTICAST_LIST_REQ;
+   wdiEventData.pEventData      = pwdiRcvFltPktSetMcListReqInfo; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktSetMcListReqInfo);
+   wdiEventData.pCBfnc          = wdi8023MulticastListCallback; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+WDI_Status 
+WDI_ReceiveFilterSetFilterReq
+(
+  WDI_SetRcvPktFilterReqParamsType* pwdiSetRcvPktFilterReqInfo,
+  WDI_ReceiveFilterSetFilterCb      wdiReceiveFilterSetFilterCallback,
+  void*                             pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_RECEIVE_FILTER_SET_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiSetRcvPktFilterReqInfo; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiSetRcvPktFilterReqInfo) + 
+                                  (pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams 
+                                  * sizeof(WDI_RcvPktFilterFieldParams) - 1);
+   wdiEventData.pCBfnc          = wdiReceiveFilterSetFilterCallback; 
+   wdiEventData.pUserData       = pUserData;
+
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+WDI_Status 
+WDI_FilterMatchCountReq
+(
+  WDI_RcvFltPktMatchCntReqParamsType* pwdiRcvFltPktMatchCntReqInfo,
+  WDI_FilterMatchCountCb              wdiFilterMatchCountCallback,
+  void*                               pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ;
+   wdiEventData.pEventData      = pwdiRcvFltPktMatchCntReqInfo; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktMatchCntReqInfo);
+   wdiEventData.pCBfnc          = wdiFilterMatchCountCallback; 
+   wdiEventData.pUserData       = pUserData;
+
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+WDI_Status 
+WDI_ReceiveFilterClearFilterReq
+(
+  WDI_RcvFltPktClearReqParamsType*  pwdiRcvFltPktClearReqInfo,
+  WDI_ReceiveFilterClearFilterCb    wdiReceiveFilterClearFilterCallback,
+  void*                             pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ;
+   wdiEventData.pEventData      = pwdiRcvFltPktClearReqInfo; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktClearReqInfo);
+   wdiEventData.pCBfnc          = wdiReceiveFilterClearFilterCallback; 
+   wdiEventData.pUserData       = pUserData;
+
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief Process 8023 Multicast List Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Process8023MulticastListReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_RcvFltPktSetMcListReqParamsType* pwdiFltPktSetMcListReqParamsType  = NULL;
+   WDI_8023MulticastListCb    wdi8023MulticastListCb = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
+   wpt_uint16                 usDataOffset          = 0;
+   wpt_uint16                 usSendSize            = 0;
+   tHalRcvFltMcAddrListType   rcvFltMcAddrListType;
+   wpt_uint8                  i;
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiFltPktSetMcListReqParamsType = 
+       (WDI_RcvFltPktSetMcListReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdi8023MulticastListCb = 
+       (WDI_8023MulticastListCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_8023_MULTICAST_LIST_REQ, 
+                         sizeof(tHalRcvFltMcAddrListType),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(tHalRcvFltMcAddrListType))))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in "
+                  "WDI_Process8023MulticastListReq() %x %x %x",
+                  pEventData, pwdiFltPktSetMcListReqParamsType,
+                  wdi8023MulticastListCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   rcvFltMcAddrListType.cMulticastAddr = 
+       pwdiFltPktSetMcListReqParamsType->mcAddrList.ulMulticastAddrCnt; 
+   for( i = 0; i < rcvFltMcAddrListType.cMulticastAddr; i++ )
+   {
+      wpalMemoryCopy(rcvFltMcAddrListType.multicastAddr[i],
+                 pwdiFltPktSetMcListReqParamsType->mcAddrList.multicastAddr[i],
+                 sizeof(tSirMacAddr));
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &rcvFltMcAddrListType, 
+                   sizeof(rcvFltMcAddrListType)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiFltPktSetMcListReqParamsType->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiFltPktSetMcListReqParamsType->pUserData; 
+
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdi8023MulticastListCb, pEventData->pUserData,
+                        WDI_8023_MULTICAST_LIST_RESP); 
+}
+
+/**
+ @brief Process Receive Filter Set Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterSetFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetRcvPktFilterReqParamsType* pwdiSetRcvPktFilterReqInfo  = NULL;
+   WDI_ReceiveFilterSetFilterCb      wdiReceiveFilterSetFilterCb = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
+   wpt_uint16                 usDataOffset          = 0;
+   wpt_uint16                 usSendSize            = 0;
+   wpt_uint32                 usRcvPktFilterCfgSize;
+   tHalRcvPktFilterCfgType    *pRcvPktFilterCfg;
+   wpt_uint8                  i;
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiSetRcvPktFilterReqInfo = 
+       (WDI_SetRcvPktFilterReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiReceiveFilterSetFilterCb = 
+       (WDI_ReceiveFilterSetFilterCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   usRcvPktFilterCfgSize = sizeof(tHalRcvPktFilterCfgType) + 
+       ((pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams - 1)
+        * sizeof(tHalRcvPktFilterParams));
+
+  pRcvPktFilterCfg = (tHalRcvPktFilterCfgType *)wpalMemoryAllocate(
+                                              usRcvPktFilterCfgSize);
+
+  if(NULL == pRcvPktFilterCfg)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+            "%s: Failed to allocate memory for "
+            "tHalRcvPktFilterCfgType: %x %x %x ",
+            __FUNCTION__, pWDICtx, pEventData, pEventData->pEventData);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryZero(pRcvPktFilterCfg, usRcvPktFilterCfgSize);
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RECEIVE_FILTER_SET_FILTER_REQ, 
+                         usRcvPktFilterCfgSize,
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + usRcvPktFilterCfgSize)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in "
+                  "WDI_ProcessReceiveFilterSetFilterReq() %x %x %x",
+                  pEventData, pwdiSetRcvPktFilterReqInfo,
+                  wdiReceiveFilterSetFilterCb);
+      WDI_ASSERT(0);
+      wpalMemoryFree(pRcvPktFilterCfg);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "UsData Off %d UsSend %d cfg %d",usDataOffset, 
+              usSendSize,usRcvPktFilterCfgSize);
+
+   pRcvPktFilterCfg->filterId = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.filterId;
+   pRcvPktFilterCfg->filterType = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.filterType;   
+   pRcvPktFilterCfg->numParams = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams;
+   pRcvPktFilterCfg->coleasceTime = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.coalesceTime;
+
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Out: FID %d FT %d",pRcvPktFilterCfg->filterId, 
+              pRcvPktFilterCfg->filterType);
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "NParams %d CT %d",pRcvPktFilterCfg->numParams, 
+              pRcvPktFilterCfg->coleasceTime);
+
+   for ( i = 0; i < pRcvPktFilterCfg->numParams; i++ )
+   {
+       pRcvPktFilterCfg->paramsData[i].protocolLayer = 
+           pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].protocolLayer;
+       pRcvPktFilterCfg->paramsData[i].cmpFlag = 
+           pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].cmpFlag;
+       pRcvPktFilterCfg->paramsData[i].dataOffset = 
+           pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataOffset;
+        pRcvPktFilterCfg->paramsData[i].dataLength = 
+            pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataLength;
+
+       wpalMemoryCopy(&pRcvPktFilterCfg->paramsData[i].compareData,
+                    &pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].compareData,
+                    8);
+       wpalMemoryCopy(&pRcvPktFilterCfg->paramsData[i].dataMask,
+                    &pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataMask,
+                    8);
+
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+           "Out:Proto %d Comp Flag %d \n",
+           pRcvPktFilterCfg->paramsData[i].protocolLayer, 
+           pRcvPktFilterCfg->paramsData[i].cmpFlag);
+
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+           "Data Offset %d Data Len %d\n",
+           pRcvPktFilterCfg->paramsData[i].dataOffset, 
+           pRcvPktFilterCfg->paramsData[i].dataLength);
+
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+           "CData: %d:%d:%d:%d:%d:%d\n",
+           pRcvPktFilterCfg->paramsData[i].compareData[0], 
+           pRcvPktFilterCfg->paramsData[i].compareData[1], 
+           pRcvPktFilterCfg->paramsData[i].compareData[2], 
+           pRcvPktFilterCfg->paramsData[i].compareData[3],
+           pRcvPktFilterCfg->paramsData[i].compareData[4], 
+           pRcvPktFilterCfg->paramsData[i].compareData[5]);
+
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+           "MData: %d:%d:%d:%d:%d:%d\n",
+           pRcvPktFilterCfg->paramsData[i].dataMask[0], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[1], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[2], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[3],
+           pRcvPktFilterCfg->paramsData[i].dataMask[4], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[5]);
+   }
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   pRcvPktFilterCfg, 
+                   usRcvPktFilterCfgSize); 
+
+
+   pWDICtx->wdiReqStatusCB     = pwdiSetRcvPktFilterReqInfo->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiSetRcvPktFilterReqInfo->pUserData; 
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+   wpalMemoryFree(pRcvPktFilterCfg);
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiReceiveFilterSetFilterCb, pEventData->pUserData,
+                        WDI_RECEIVE_FILTER_SET_FILTER_RESP); 
+}
+
+/**
+ @brief Process Packet Filter Match Count Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFilterMatchCountReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_RcvFltPktMatchCntReqParamsType*    pwdiRcvFltPktMatchCntReqParamsType =
+                                                                         NULL;
+   WDI_FilterMatchCountCb                 wdiFilterMatchCountCb              =
+                                                                         NULL;
+   wpt_uint8*                             pSendBuffer           = NULL; 
+   wpt_uint16                             usDataOffset          = 0;
+   wpt_uint16                             usSendSize            = 0;
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiRcvFltPktMatchCntReqParamsType = 
+       (WDI_RcvFltPktMatchCntReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiFilterMatchCountCb = 
+       (WDI_FilterMatchCountCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ, 
+                         0,
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < usDataOffset))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in "
+                  "WDI_ProcessFilterMatchCountReq() %x %x %x",
+                  pEventData, pwdiRcvFltPktMatchCntReqParamsType,
+                  wdiFilterMatchCountCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   //
+   // Don't need to fill send buffer other than header
+   //
+   pWDICtx->wdiReqStatusCB     = pwdiRcvFltPktMatchCntReqParamsType->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiRcvFltPktMatchCntReqParamsType->pUserData; 
+
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiFilterMatchCountCb, 
+                        pEventData->pUserData, 
+                        WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP); 
+}
+
+/**
+ @brief Process Receive Filter Clear Filter Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterClearFilterReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{ 
+   WDI_RcvFltPktClearReqParamsType* pwdiRcvFltPktClearReqParamsType = NULL;
+   WDI_ReceiveFilterClearFilterCb   wdiRcvFltPktClearFilterCb       = NULL;
+   wpt_uint8*                       pSendBuffer           = NULL; 
+   wpt_uint16                       usDataOffset          = 0;
+   wpt_uint16                       usSendSize            = 0;
+   tHalRcvFltPktClearParam          rcvFltPktClearParam;
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiRcvFltPktClearReqParamsType =
+       (WDI_RcvFltPktClearReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiRcvFltPktClearFilterCb = 
+       (WDI_ReceiveFilterClearFilterCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+                         WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ, 
+                         sizeof(tHalRcvFltPktClearParam),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(tHalRcvFltPktClearParam))))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in "
+                  "WDI_ProcessReceiveFilterClearFilterReq() %x %x %x",
+                  pEventData, pwdiRcvFltPktClearReqParamsType,
+                  wdiRcvFltPktClearFilterCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+
+   rcvFltPktClearParam.status = pwdiRcvFltPktClearReqParamsType->
+                                                    filterClearParam.status; 
+   rcvFltPktClearParam.filterId = pwdiRcvFltPktClearReqParamsType->
+                                                    filterClearParam.filterId; 
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &rcvFltPktClearParam, 
+                   sizeof(rcvFltPktClearParam)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiRcvFltPktClearReqParamsType->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiRcvFltPktClearReqParamsType->pUserData; 
+
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiRcvFltPktClearFilterCb, pEventData->pUserData,
+                        WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP); 
+}
+
+/**
+ @brief Process 8023 Multicast List Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_Process8023MulticastListRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_8023MulticastListCb wdi8023MulticastListCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdi8023MulticastListCb = (WDI_8023MulticastListCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdi8023MulticastListCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief Process Set Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterSetFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_ReceiveFilterSetFilterCb wdiReceiveFilterSetFilterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+          "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiReceiveFilterSetFilterCb = (WDI_ReceiveFilterSetFilterCb)pWDICtx->
+                                                                   pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiReceiveFilterSetFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief Process Packet Filter Match Count Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFilterMatchCountRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+
+   WDI_FilterMatchCountCb   wdiFilterMatchCountCb;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiFilterMatchCountCb = (WDI_FilterMatchCountCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiFilterMatchCountCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief Process Receive Filter Clear Filter Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessReceiveFilterClearFilterRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_ReceiveFilterClearFilterCb wdiReceiveFilterClearFilterCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+             "%s",__FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiReceiveFilterClearFilterCb = (WDI_ReceiveFilterClearFilterCb)pWDICtx->
+                                                                 pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiReceiveFilterClearFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+#endif // WLAN_FEATURE_PACKET_FILTERING
+
+/**
+ @brief Process Shutdown Rsp function
+        There is no shutdown response comming from HAL
+        - function just kept for simmetry
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure 
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessShutdownRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  /*There is no shutdown response comming from HAL - function just kept for
+  simmetry */
+  WDI_ASSERT(0);
+  return WDI_STATUS_SUCCESS;
+}/*WDI_ProcessShutdownRsp*/
+
+/**
+ @brief WDI_SetPowerParamsReq
+
+ @param pwdiPowerParamsReqParams: the Set Power Params as 
+                      specified by the Device Interface
+  
+        wdiPowerParamsCb: callback for passing back the response
+        of the Set Power Params operation received from the
+        device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_SetPowerParamsReq
+(
+  WDI_SetPowerParamsReqParamsType* pwdiPowerParamsReqParams,
+  WDI_SetPowerParamsCb             wdiPowerParamsCb,
+  void*                            pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_SET_POWER_PARAMS_REQ;
+   wdiEventData.pEventData      = pwdiPowerParamsReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiPowerParamsReqParams);
+   wdiEventData.pCBfnc          = wdiPowerParamsCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}/*WDI_SetPowerParamsReq*/
+
+/**
+ @brief Process Set Power Params Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPowerParamsReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetPowerParamsReqParamsType* pwdiPowerParamsReqParams = NULL;
+   WDI_SetPowerParamsCb             wdiPowerParamsCb         = NULL;
+   wpt_uint8*                       pSendBuffer              = NULL; 
+   wpt_uint16                       usDataOffset             = 0;
+   wpt_uint16                       usSendSize               = 0;
+   tSetPowerParamsType              powerParams;
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiPowerParamsReqParams = (WDI_SetPowerParamsReqParamsType*)pEventData->pEventData)) ||
+       ( NULL == (wdiPowerParamsCb   = (WDI_SetPowerParamsCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_POWER_PARAMS_REQ, 
+                         sizeof(powerParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(powerParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Set PNO req %x %x %x",
+                  pEventData, pwdiPowerParamsReqParams, wdiPowerParamsCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+  /*  Ignore DTIM */
+  powerParams.uIgnoreDTIM = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uIgnoreDTIM;
+
+  /*DTIM Period*/
+  powerParams.uDTIMPeriod = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uDTIMPeriod;
+
+  /* Listen Interval */
+  powerParams.uListenInterval= 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uListenInterval;
+
+  /* Broadcast Multicas Filter  */
+  powerParams.uBcastMcastFilter = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uBcastMcastFilter;
+
+  /* Beacon Early Termination */
+  powerParams.uEnableBET = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uEnableBET;
+
+  /* Beacon Early Termination Interval */
+  powerParams.uBETInterval = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uBETInterval; 
+    
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &powerParams, 
+                   sizeof(powerParams)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiPowerParamsReqParams->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiPowerParamsReqParams->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiPowerParamsCb, pEventData->pUserData, WDI_SET_POWER_PARAMS_RESP); 
+}
+
+/**
+ @brief Process Power Params Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetPowerParamsRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_SetPowerParamsCb             wdiPowerParamsCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiPowerParamsCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiPowerParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetPowerParamsRsp*/
+
+#ifdef WLAN_FEATURE_GTK_OFFLOAD
+/**
+ @brief WDI_GTKOffloadReq will be called when the upper MAC 
+        wants to set GTK Rekey Counter while in power save. Upon
+        the call of this API the WLAN DAL will pack and send a
+        HAL GTK offload request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiGtkOffloadParams: the GTK offload as specified 
+                      by the Device Interface
+  
+        wdiGtkOffloadCb: callback for passing back the response
+        of the GTK offload operation received from the device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GTKOffloadReq
+(
+  WDI_GtkOffloadReqMsg*      pwdiGtkOffloadReqMsg,
+  WDI_GtkOffloadCb           wdiGtkOffloadCb,
+  void*                      pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData = {0};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_GTK_OFFLOAD_REQ;
+   wdiEventData.pEventData      = pwdiGtkOffloadReqMsg; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiGtkOffloadReqMsg);; 
+   wdiEventData.pCBfnc          = wdiGtkOffloadCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+
+/**
+ @brief WDI_GTKOffloadGetInfoReq will be called when the upper 
+          MAC wants to get GTK Rekey Counter while in power save.
+          Upon the call of this API the WLAN DAL will pack and
+          send a HAL GTK offload request message to the lower RIVA
+        sub-system if DAL is in state STARTED.
+
+        In state BUSY this request will be queued. Request won't
+        be allowed in any other state. 
+
+ WDI_PostAssocReq must have been called.
+
+ @param pwdiGtkOffloadGetInfoReqMsg: the GTK Offload 
+                        Information Message as specified by the
+                        Device Interface
+  
+          wdiGtkOffloadGetInfoCb: callback for passing back the
+          response of the GTK offload operation received from the
+          device
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see WDI_PostAssocReq
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_GTKOffloadGetInfoReq
+(
+  WDI_GtkOffloadGetInfoReqMsg*  pwdiGtkOffloadGetInfoReqMsg,
+  WDI_GtkOffloadGetInfoCb       wdiGtkOffloadGetInfoCb,
+  void*                          pUserData
+)
+{
+   WDI_EventInfoType      wdiEventData = {0};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+
+     return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /*------------------------------------------------------------------------
+     Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   wdiEventData.wdiRequest      = WDI_GTK_OFFLOAD_GETINFO_REQ;
+   wdiEventData.pEventData      = pwdiGtkOffloadGetInfoReqMsg; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiGtkOffloadGetInfoReqMsg);
+   wdiEventData.pCBfnc          = wdiGtkOffloadGetInfoCb; 
+   wdiEventData.pUserData       = pUserData;
+
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+
+/**
+ @brief Process set GTK Offload Request function 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_GtkOffloadReqMsg*    pwdiGtkOffloadReqMsg = NULL;
+   WDI_GtkOffloadCb         wdiGtkOffloadCb      = NULL;
+   wpt_uint8*               pSendBuffer          = NULL; 
+   wpt_uint16               usDataOffset         = 0;
+   wpt_uint16               usSendSize           = 0;
+   tHalGtkOffloadReqParams  gtkOffloadReqParams = {0};
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiGtkOffloadReqMsg = (WDI_GtkOffloadReqMsg*)pEventData->pEventData)) ||
+       ( NULL == (wdiGtkOffloadCb   = (WDI_GtkOffloadCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_REQ, 
+                         sizeof(gtkOffloadReqParams),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(gtkOffloadReqParams) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in GTK offload req %x %x %x",
+                  pEventData, pwdiGtkOffloadReqMsg, wdiGtkOffloadCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   //
+   // Fill gtkOffloadReqParams from pwdiGtkOffloadReqMsg->gtkOffloadReqParams
+   //
+   gtkOffloadReqParams.ulFlags = pwdiGtkOffloadReqMsg->gtkOffloadReqParams.ulFlags;
+   // Copy KCK
+   wpalMemoryCopy(&(gtkOffloadReqParams.aKCK[0]), &(pwdiGtkOffloadReqMsg->gtkOffloadReqParams.aKCK[0]), 16);
+   // Copy KEK
+   wpalMemoryCopy(&(gtkOffloadReqParams.aKEK[0]), &(pwdiGtkOffloadReqMsg->gtkOffloadReqParams.aKEK[0]), 16);
+   // Copy KeyReplayCounter
+   wpalMemoryCopy(&(gtkOffloadReqParams.ullKeyReplayCounter), &(pwdiGtkOffloadReqMsg->gtkOffloadReqParams.ullKeyReplayCounter), sizeof(v_U64_t));
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &gtkOffloadReqParams, 
+                   sizeof(gtkOffloadReqParams)); 
+
+   pWDICtx->wdiReqStatusCB     = pwdiGtkOffloadReqMsg->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiGtkOffloadReqMsg->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiGtkOffloadCb, pEventData->pUserData, WDI_GTK_OFFLOAD_RESP); 
+}
+
+
+/**
+ @brief Process GTK Offload Get Information Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadGetInfoReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_GtkOffloadGetInfoReqMsg*     pwdiGtkOffloadGetInfoReqMsg = NULL;
+   WDI_GtkOffloadGetInfoCb          wdiGtkOffloadGetInfoCb      = NULL;
+   wpt_uint8*                       pSendBuffer           = NULL; 
+   wpt_uint16                       usDataOffset          = 0;
+   wpt_uint16                       usSendSize            = 0;
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiGtkOffloadGetInfoReqMsg = (WDI_GtkOffloadGetInfoReqMsg*)pEventData->pEventData)) ||
+       ( NULL == (wdiGtkOffloadGetInfoCb = (WDI_GtkOffloadGetInfoCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_GETINFO_REQ, 
+                         0,
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < usDataOffset))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in WDI_ProcessGTKOffloadGetInfoReq() %x %x %x",
+                  pEventData, pwdiGtkOffloadGetInfoReqMsg, wdiGtkOffloadGetInfoCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   //
+   // Don't need to fill send buffer other than header
+   //
+
+   pWDICtx->wdiReqStatusCB     = pwdiGtkOffloadGetInfoReqMsg->wdiReqStatusCB;
+   pWDICtx->pReqStatusUserData = pwdiGtkOffloadGetInfoReqMsg->pUserData; 
+
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiGtkOffloadGetInfoCb, pEventData->pUserData, WDI_GTK_OFFLOAD_GETINFO_RESP); 
+}
+
+/**
+ @brief Process host offload Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGtkOffloadRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_GtkOffloadCb    wdiGtkOffloadCb   = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   wdiGtkOffloadCb = (WDI_GtkOffloadCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiGtkOffloadCb( wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief Process GTK Offload Get Information Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessGTKOffloadGetInfoRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+
+   WDI_GtkOffloadGetInfoCb   wdiGtkOffloadGetInfoCb = NULL;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   wdiGtkOffloadGetInfoCb = (WDI_GtkOffloadGetInfoCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   //wdiUpdateScanParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
+   //wdiReceiveFilterClearFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
+   wdiGtkOffloadGetInfoCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}
+#endif // WLAN_FEATURE_GTK_OFFLOAD
+
+#ifdef WLAN_WAKEUP_EVENTS
+WDI_Status
+WDI_ProcessWakeReasonInd
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_LowLevelIndType *pWdiInd;
+  tpWakeReasonParams pWakeReasonParams;
+  wpt_uint32 allocSize = 0;
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "+%s", __FUNCTION__);
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData ))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT( 0 );
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-------------------------------------------------------------------------
+    Extract indication and send it to UMAC
+  -------------------------------------------------------------------------*/
+  pWakeReasonParams = (tpWakeReasonParams)(pEventData->pEventData);
+  
+  allocSize = sizeof(WDI_LowLevelIndType) + (pWakeReasonParams->ulStoredDataLen - 1);
+
+  //Allocate memory for WDI_WakeReasonIndType structure
+  pWdiInd = wpalMemoryAllocate(allocSize) ;
+
+  if(NULL == pWdiInd)
+  {
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+            "%s: Failed to allocate memory for WDI_WakeReasonIndType: %x %x %x ",
+                __FUNCTION__, pWDICtx, pEventData, pEventData->pEventData);
+    WDI_ASSERT(0);
+    return WDI_STATUS_E_FAILURE; 
+  }
+
+  wpalMemoryZero(pWdiInd, allocSize);
+
+  /* Fill in the indication parameters*/
+  // Fill wdiInd.wdiIndicationData.wakeReasonInd structure from wakeReasonInd.wakeReasonParams
+  pWdiInd->wdiIndicationType = WDI_WAKE_REASON_IND; 
+  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulReason = pWakeReasonParams->ulReason;
+  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulReasonArg = pWakeReasonParams->ulReasonArg;
+  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen = pWakeReasonParams->ulStoredDataLen;
+  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulActualDataLen = pWakeReasonParams->ulActualDataLen;    
+  wpalMemoryCopy( (void *)&(pWdiInd->wdiIndicationData.wdiWakeReasonInd.aDataStart[0]), 
+                  &(pWakeReasonParams->aDataStart[0]), 
+                  pWakeReasonParams->ulStoredDataLen);
+
+  /*Notify UMAC*/
+  pWDICtx->wdiLowLevelIndCB( pWdiInd, pWDICtx->pIndUserData );
+  
+  //Free memory allocated for WDI_WakeReasonIndType structure
+  wpalMemoryFree(pWdiInd);
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "-%s", __FUNCTION__);
+
+  return WDI_STATUS_SUCCESS; 
+}
+#endif // WLAN_WAKEUP_EVENTS
+
+void WDI_GetWcnssCompiledApiVersion
+(
+  WDI_WlanVersionType     *pWcnssApiVersion
+)
+{
+    pWcnssApiVersion->major    = WLAN_HAL_VER_MAJOR;
+    pWcnssApiVersion->minor    = WLAN_HAL_VER_MINOR;
+    pWcnssApiVersion->version  = WLAN_HAL_VER_VERSION;
+    pWcnssApiVersion->revision = WLAN_HAL_VER_REVISION;
+}
+
+/**
+ @brief Process Set TM Level Rsp function (called when a
+        response is being received over the bus from HAL)
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTmLevelRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_Status           wdiStatus;
+   eHalStatus           halStatus;
+   WDI_SetTmLevelCb     wdiSetTmLevelCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   wdiSetTmLevelCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB; 
+
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+   halStatus = *((eHalStatus*)pEventData->pEventData);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
+
+   /*Notify UMAC*/
+   wdiSetTmLevelCb(wdiStatus, pWDICtx->pRspCBUserData);
+
+   return WDI_STATUS_SUCCESS; 
+}/*WDI_ProcessSetTmLevelRsp*/
+
+/**
+ @brief Process Set Thermal Mitigation level Changed request
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTmLevelReq
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_SetTmLevelReqType           *pwdiSetTmLevelReq = NULL;
+   WDI_SetTmLevelCb                 wdiSetTmLevelCb   = NULL;
+   wpt_uint8*                       pSendBuffer       = NULL; 
+   wpt_uint16                       usDataOffset      = 0;
+   wpt_uint16                       usSendSize        = 0;
+   tSetThermalMitgationType         halTmMsg;
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pEventData ) ||
+       ( NULL == (pwdiSetTmLevelReq = (WDI_SetTmLevelReqType*)pEventData->pEventData)) ||
+       ( NULL == (wdiSetTmLevelCb   = (WDI_SetTmLevelCb)pEventData->pCBfnc)))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /*-----------------------------------------------------------------------
+     Get message buffer
+   -----------------------------------------------------------------------*/
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TM_LEVEL_REQ, 
+                         sizeof(halTmMsg),
+                         &pSendBuffer, &usDataOffset, &usSendSize))||
+       ( usSendSize < (usDataOffset + sizeof(halTmMsg) )))
+   {
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "Unable to get send buffer in Set PNO req %x %x %x",
+                  pEventData, pwdiSetTmLevelReq, wdiSetTmLevelCb);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   halTmMsg.thermalMitMode = pwdiSetTmLevelReq->tmMode;
+   halTmMsg.thermalMitLevel = pwdiSetTmLevelReq->tmLevel;
+
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halTmMsg, 
+                   sizeof(halTmMsg)); 
+
+   pWDICtx->pReqStatusUserData = pwdiSetTmLevelReq->pUserData; 
+   pWDICtx->pfncRspCB = NULL;
+   /*-------------------------------------------------------------------------
+     Send Get STA Request to HAL 
+   -------------------------------------------------------------------------*/
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiSetTmLevelCb, pEventData->pUserData, WDI_SET_TM_LEVEL_RESP); 
+}
+
+/* Fill the value from the global features enabled array to the global capabilities
+ * bitmap struct 
+ */
+static void 
+FillAllFeatureCaps(tWlanFeatCaps *fCaps, placeHolderInCapBitmap *enabledFeat, wpt_int8 len)
+{
+   wpt_int8 i;
+   for (i=0; i<len; i++)
+   {
+      setFeatCaps(fCaps, enabledFeat[i]);
+   }
+}
+
+/**
+ @brief WDI_featureCapsExchangeReq
+        Post feature capability bitmap exchange event.
+        Host will send its own capability to FW in this req and 
+        expect FW to send its capability back as a bitmap in Response
+ 
+ @param 
+  
+        wdiFeatureCapsExchangeCb: callback called on getting the response.
+        It is kept to mantain similarity between WDI reqs and if needed, can
+        be used in future. Currently, It is set to NULL
+  
+        pUserData: user data will be passed back with the
+        callback 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_featureCapsExchangeReq
+(
+  WDI_featureCapsExchangeCb     wdiFeatureCapsExchangeCb,
+  void*                         pUserData
+)
+{
+   WDI_EventInfoType   wdiEventData;
+   wpt_int32           fCapsStructSize;
+   
+   /*------------------------------------------------------------------------
+     Sanity Check 
+   ------------------------------------------------------------------------*/
+   if ( eWLAN_PAL_FALSE == gWDIInitialized )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WDI API call before module is initialized - Fail request");
+   
+      return WDI_STATUS_E_NOT_ALLOWED; 
+   }
+
+   /* Allocate memory separately for global variable carrying FW caps */
+   fCapsStructSize = sizeof(tWlanFeatCaps);
+   gpHostWlanFeatCaps = wpalMemoryAllocate(fCapsStructSize);
+   if ( NULL ==  gpHostWlanFeatCaps )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Cannot allocate memory for host capability info\n"); 
+      WDI_ASSERT(0);
+      return WDI_STATUS_MEM_FAILURE;
+   }
+
+   wpalMemoryZero(gpHostWlanFeatCaps, fCapsStructSize);
+   
+   /*------------------------------------------------------------------------
+   Fill in Event data and post to the Main FSM
+   ------------------------------------------------------------------------*/
+   FillAllFeatureCaps(gpHostWlanFeatCaps, supportEnabledFeatures,
+      (sizeof(supportEnabledFeatures)/sizeof(supportEnabledFeatures[0])));
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+      "bit 0 - %x %x %x %x - bit 128\n",
+      gpHostWlanFeatCaps->featCaps[0],
+      gpHostWlanFeatCaps->featCaps[1],
+      gpHostWlanFeatCaps->featCaps[2],
+      gpHostWlanFeatCaps->featCaps[3]
+   );
+   
+   wdiEventData.wdiRequest      = WDI_FEATURE_CAPS_EXCHANGE_REQ;
+   wdiEventData.pEventData      = gpHostWlanFeatCaps; 
+   wdiEventData.uEventDataSize  = fCapsStructSize; 
+   wdiEventData.pCBfnc          = wdiFeatureCapsExchangeCb; 
+   wdiEventData.pUserData       = pUserData;
+   
+   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief Process Host-FW Capability Exchange Request function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFeatureCapsExchangeReq
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  wpt_uint8*              pSendBuffer        = NULL; 
+  wpt_uint16              usDataOffset       = 0;
+  wpt_uint16              usSendSize         = 0;
+  wpt_uint16              usLen              = 0; 
+
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+         "%s", __FUNCTION__);
+
+  /*-------------------------------------------------------------------------
+    Sanity check 
+  -------------------------------------------------------------------------*/
+  /* Call back function is NULL since not required for cap exchange req */
+  if (( NULL == pEventData ) ||
+      ( NULL == (tWlanFeatCaps *)pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: Invalid parameters", __FUNCTION__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  /*-----------------------------------------------------------------------
+    Get message buffer
+  -----------------------------------------------------------------------*/
+  usLen = sizeof(tWlanFeatCaps);
+
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+                        WDI_FEATURE_CAPS_EXCHANGE_REQ, 
+                        usLen,
+                        &pSendBuffer, &usDataOffset, &usSendSize))||
+      ( usSendSize < (usDataOffset + usLen )))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
+              "Unable to get send buffer in feat caps exchange req %x %x",
+                pEventData, (tWlanFeatCaps *)pEventData->pEventData);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE; 
+  }
+
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+       "bit 0 - %x %x %x %x - bit 128\n",
+      ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[0],
+      ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[1],
+      ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[2],
+      ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[3]
+    );
+
+  /* Copy host caps after the offset in the send buffer */  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  (tWlanFeatCaps *)pEventData->pEventData, 
+                  usLen); 
+
+  /*-------------------------------------------------------------------------
+    Send Start Request to HAL 
+  -------------------------------------------------------------------------*/
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       (WDI_StartRspCb)pEventData->pCBfnc,
+                       pEventData->pUserData, WDI_FEATURE_CAPS_EXCHANGE_RESP);
+  
+}/*WDI_ProcessFeatureCapsExchangeReq*/
+
+/**
+ @brief Process Host-FW Capability Exchange Response function
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessFeatureCapsExchangeRsp
+( 
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+   WDI_featureCapsExchangeCb    wdiFeatureCapsExchangeCb;   
+   wpt_int32                   fCapsStructSize;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+          "%s", __FUNCTION__);
+
+   /*-------------------------------------------------------------------------
+     Sanity check 
+   -------------------------------------------------------------------------*/
+   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+       ( NULL == pEventData->pEventData ))
+   {
+      /* It will go here when riva is old (doesn't understand this msg) and host is new */
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%s: Invalid parameters", __FUNCTION__);
+      WDI_ASSERT(0);
+      return WDI_STATUS_E_FAILURE; 
+   }
+
+   /* Allocate memory separately for global variable carrying FW caps */
+   fCapsStructSize = sizeof(tWlanFeatCaps);
+   gpFwWlanFeatCaps = wpalMemoryAllocate(fCapsStructSize);   
+   if ( NULL ==  gpFwWlanFeatCaps )
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "Cannot allocate memory for host capability info\n"); 
+      WDI_ASSERT(0);
+      return WDI_STATUS_MEM_FAILURE;
+   }
+
+   /*-------------------------------------------------------------------------
+     Unpack HAL Response Message - the header was already extracted by the
+     main Response Handling procedure 
+   -------------------------------------------------------------------------*/   
+   /*-------------------------------------------------------------------------
+     Extract response and send it to UMAC
+   -------------------------------------------------------------------------*/
+
+   wpalMemoryCopy(gpFwWlanFeatCaps,(tWlanFeatCaps *) pEventData -> pEventData,
+                    fCapsStructSize);
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+      "bit 0 - %x %x %x %x - bit 128\n",
+      gpFwWlanFeatCaps->featCaps[0],
+      gpFwWlanFeatCaps->featCaps[1],
+      gpFwWlanFeatCaps->featCaps[2],
+      gpFwWlanFeatCaps->featCaps[3]
+     );
+   
+   wdiFeatureCapsExchangeCb = (WDI_featureCapsExchangeCb) pWDICtx -> pfncRspCB; 
+
+   /*Notify UMAC - there is no callback right now but can be used in future if reqd */
+   if (wdiFeatureCapsExchangeCb != NULL)
+      wdiFeatureCapsExchangeCb(NULL, NULL);
+
+   return WDI_STATUS_SUCCESS; 
+}
+
+/**
+ @brief WDI_getHostWlanFeatCaps
+        WDI API that returns whether the feature passed to it as enum value in
+        "placeHolderInCapBitmap" is supported by Host or not. It uses WDI global
+        variable storing host capability bitmap to find this. This can be used by
+        other moduels to decide certain things like call different APIs based on
+        whether a particular feature is supported.
+ 
+ @param 
+  
+        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap in wlan_hal_msg.h.
+
+ @see
+ @return 
+        0 - if the feature is NOT supported in host
+        any non-zero value - if the feature is SUPPORTED in host.
+*/
+wpt_uint8 WDI_getHostWlanFeatCaps(wpt_uint8 feat_enum_value)
+{
+   wpt_uint8 featSupported = 0;
+   if (gpHostWlanFeatCaps != NULL)
+   {
+      getFeatCaps(gpHostWlanFeatCaps, feat_enum_value, featSupported);
+   }
+   else
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+        "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature\n", feat_enum_value);
+   }
+   return featSupported;
+}
+
+/**
+ @brief WDI_getFwWlanFeatCaps
+        WDI API that returns whether the feature passed to it as enum value in
+        "placeHolderInCapBitmap" is supported by FW or not. It uses WDI global
+        variable storing host capability bitmap to find this. This can be used by
+        other moduels to decide certain things like call different APIs based on
+        whether a particular feature is supported.
+ 
+ @param 
+  
+        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap
+                                    in wlan_hal_msg.h.
+
+ @see
+ @return 
+        0 - if the feature is NOT supported in FW
+        any non-zero value - if the feature is SUPPORTED in FW.
+*/
+wpt_uint8 WDI_getFwWlanFeatCaps(wpt_uint8 feat_enum_value)
+{
+    wpt_uint8 featSupported = 0;
+    if (gpFwWlanFeatCaps != NULL)
+    {
+      getFeatCaps(gpFwWlanFeatCaps, feat_enum_value, featSupported);
+    }
+    else
+    {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+         "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature\n", feat_enum_value);
+    }
+    return featSupported;
+}
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi_dp.c b/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
new file mode 100644
index 0000000..5a38e15
--- /dev/null
+++ b/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
@@ -0,0 +1,972 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ W D I _ D P. C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Device Abstraction     
+  Layer Internal Utility routines to be used by the Data Path.
+
+  The functions externalized by this module are to be only by the WDI data
+  path.
+ 
+  The module leveraged as much as functionality as was possible from the HAL
+  in Libra/Volans.
+ 
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2010 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
+----------    ---    --------------------------------------------------------
+2010-08-19    lti     Created module
+
+===========================================================================*/
+
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_wdi_i.h"
+#include "wlan_qct_wdi_sta.h"
+#include "wlan_qct_wdi_dp.h"
+#include "wlan_qct_wdi_bd.h"
+#include "wlan_qct_pal_trace.h"
+
+#include "wlan_qct_dev_defs.h"
+
+extern uint8 WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision);
+extern uint8 WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision);
+
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------- 
+   TID->QueueID mapping
+ --------------------------------------------------------------------------*/
+static wpt_uint8 btqmQosTid2QidMapping[] = 
+{ 
+    BTQM_QID0, 
+    BTQM_QID1, 
+    BTQM_QID2, 
+    BTQM_QID3, 
+    BTQM_QID4, 
+    BTQM_QID5, 
+    BTQM_QID6, 
+    BTQM_QID7 
+};
+/*===========================================================================
+                       Helper Internal API 
+ ===========================================================================*/
+
+/**
+ @brief WDI_DP_UtilsInit - Intializes the parameters required to 
+        interact with the data path
+  
+ @param       pWDICtx:    pointer to the main WDI Ctrl Block
+  
+ @return   success always
+*/
+WDI_Status 
+WDI_DP_UtilsInit
+(
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+  WDI_RxBdType*  pAmsduRxBdFixMask; 
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+    // WQ to be used for filling the TxBD
+  pWDICtx->ucDpuRF = BMUWQ_BTQM_TX_MGMT; 
+#endif //FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+
+#ifdef WLAN_PERF
+  pWDICtx->uBdSigSerialNum = 0;
+#endif
+
+  pAmsduRxBdFixMask = &pWDICtx->wdiRxAmsduBdFixMask;
+
+  wpalMemoryFill(pAmsduRxBdFixMask,sizeof(WDI_RxBdType), 0xff);
+
+  pAmsduRxBdFixMask->penultimatePduIdx = 0;
+  pAmsduRxBdFixMask->headPduIdx        = 0;
+  pAmsduRxBdFixMask->tailPduIdx        = 0;
+  pAmsduRxBdFixMask->mpduHeaderLength  = 0;
+  pAmsduRxBdFixMask->mpduHeaderOffset  = 0;
+  pAmsduRxBdFixMask->mpduDataOffset    = 0;
+  pAmsduRxBdFixMask->pduCount          = 0;
+  pAmsduRxBdFixMask->mpduLength        = 0;
+  pAmsduRxBdFixMask->asf               = 0;
+  pAmsduRxBdFixMask->esf               = 0;
+  pAmsduRxBdFixMask->lsf               = 0;
+  pAmsduRxBdFixMask->processOrder      = 0;
+  pAmsduRxBdFixMask->sybFrameIdx       = 0;
+  pAmsduRxBdFixMask->totalMsduSize     = 0;
+  pAmsduRxBdFixMask->aduFeedback       = 0;
+
+  return WDI_STATUS_SUCCESS;
+}/*WDI_DP_UtilsInit*/
+
+
+/**
+ @brief WDI_DP_UtilsExit - Clears the parameters required to
+        interact with the data path
+  
+ @param       pWDICtx:    pointer to the main WDI Ctrl Block
+  
+ @return   success always
+*/
+WDI_Status
+WDI_DP_UtilsExit
+( 
+    WDI_ControlBlockType*  pWDICtx
+)
+{
+   return WDI_STATUS_SUCCESS;
+}/*WDI_DP_UtilsExit*/
+
+/**
+ @brief WDI_SwapBytes - Swap Bytes of a given buffer
+  
+ @param  pBd:    buffer to be swapped 
+         nbSwap: number of bytes to swap
+  
+ @return   none
+*/
+WPT_STATIC WPT_INLINE void 
+WDI_SwapBytes
+(
+    wpt_uint8 *pBd, 
+    wpt_uint32 nbSwap
+)
+{
+  wpt_uint32 *pU32;
+  wpt_uint32 nU32;
+  wpt_uint32 wc;
+
+  nU32 = (((nbSwap) + 3)>>2);
+
+  pU32 = (wpt_uint32 *)pBd;
+  for ( wc = 0; wc < nU32; wc++ )
+  {
+    pU32[ wc ] = WPAL_BE32_TO_CPU( pU32[ wc ] );
+  }
+}/*WDI_SwapBytes*/
+
+/**
+ @brief WDI_BmuGetQidForQOSTid - returns the BMU QID for a given 
+        TID
+ 
+ @param  ucTid:  TID
+         pQid:   out QID
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_BmuGetQidForQOSTid
+(
+    wpt_uint8   ucTid, 
+    wpt_uint8*  pQid
+)
+{
+    if (ucTid > BTQM_QUEUE_TX_TID_7 )
+        return WDI_STATUS_E_FAILURE;
+        
+    *pQid = btqmQosTid2QidMapping[ucTid];
+    return WDI_STATUS_SUCCESS;
+}/*WDI_BmuGetQidForQOSTid*/
+
+#ifdef WLAN_PERF
+
+/**
+ @brief WDI_ComputeTxBdSignature - computes the BD signature
+  
+ @param   pWDICtx:       pointer to the global WDI context;
+ 
+    pDestMacAddr:   destination MAC address
+    
+    ucTid:            TID of the frame
+
+    ucDisableFrmXtl:  Unicast destination
+  
+ @return   the signature
+*/
+static wpt_uint32 
+WDI_ComputeTxBdSignature
+(  
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8*             pDestMac, 
+    wpt_uint8              ucTid, 
+    wpt_uint8              ucUnicastDst
+)
+{
+    wpt_uint16 *pMacU16 = (wpt_uint16 *) pDestMac;
+
+    return ((pMacU16[0] ^ pMacU16[1] ^ pMacU16[2])<< WDI_TXBD_SIG_MACADDR_HASH_OFFSET |
+        pWDICtx->uBdSigSerialNum << WDI_TXBD_SIG_SERIAL_OFFSET | 
+        ucTid << WDI_TXBD_SIG_TID_OFFSET |
+        ucUnicastDst << WDI_TXBD_SIG_UCAST_DATA_OFFSET);
+}/*WDI_ComputeTxBdSignature*/
+
+
+/**
+ @brief WDI_TxBdFastFwd - evaluates if a frame can be fast 
+        forwarded 
+  
+ @param   pWDICtx: Context to the WDI 
+          pDestMac: Destination MAC
+          ucTid: packet TID pBDHeader
+          ucUnicastDst: is packet unicast
+          pTxBd:       pointer to the BD header
+          usMpduLength: len 
+  
+ @return 1 - if the frame can be fast fwd-ed ; 0 if not 
+*/
+wpt_uint32 
+WDI_TxBdFastFwd
+(
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8*             pDestMac, 
+    wpt_uint8              ucTid, 
+    wpt_uint8              ucUnicastDst, 
+    void*                  pTxBd, 
+    wpt_uint16             usMpduLength 
+ )
+{
+    WDI_TxBdType*     pBd      = (WDI_TxBdType*) pTxBd;
+    wpt_uint32        uRetval  = 0;
+#ifdef WPT_LITTLE_BYTE_ENDIAN
+    wpt_uint16        usSwapped; 
+    wpt_uint16*       pU16     = (wpt_uint16 *) pTxBd;
+#endif
+
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+    if( pBd->txBdSignature ==  
+        WDI_ComputeTxBdSignature(pWDICtx, pDestMac, ucTid, ucUnicastDst))
+    {
+
+#ifdef WPT_LITTLE_BYTE_ENDIAN
+       /* When swap to BE format, mpduLength field is at 8th WORD location(16th byte) */
+       usSwapped = wpt_cpu_to_be16(usMpduLength); 
+       pU16[8]   = usSwapped;
+#else
+        /* Remove the #error when ported to a real BIG ENDIAN machine */
+       // #error "Is host byte order really BIG endian?"
+       /* When host is already in BE format, no swapping needed.*/
+       pBd->mpduLength = usMpduLength;
+#endif
+       uRetval = 1;
+    }
+    return uRetval ;
+}/*WDI_TxBdFastFwd*/
+
+#endif /*WLAN_PERF*/
+
+/*===========================================================================
+                             External API 
+ ===========================================================================*/
+
+/**
+ @brief   WLANHAL_FillTxBd - Called by TL to fill in TxBD. 
+
+    Following are the highlights of the function
+
+    1. All unicast data packets are sent by data rate decided by TPE.
+    (i.e BD rates are disabled).
+ 
+    2. All u/mcast management packets would go in Broadcast
+    Management Rates
+ 
+    3. dpuNE would be disabled for all data packets
+ 
+    4. dpuNE would be enabled for all management packets
+    excluding packets when RMF is enabled
+ 
+    5. QID8 at self STA is for broadcast data which uses no ACK
+    policy.
+ 
+    6. QID9 at self STA, we use it for unicast mgmt and set ACK
+    policy to normal ACK.
+ 
+    7. QID10 at self STA, we use it for b/mcast mgmt and set ACK
+    policy to NO ACK.
+ 
+    WDI DP Utilities modules must be initiatilized before this
+    API can be called.
+ 
+   @param
+
+    IN
+    pWDICtx:       pointer to the global WDI context;
+ 
+    ucTypeSubtype:    802.11 [5:4] ucType [3:0] subtype
+
+    pDestMacAddr:   destination MAC address
+    
+    pTid:           ptr to TID of the frame
+
+    ucDisableFrmXtl:  When set, disables UMA HW frame
+                    translation and WDI needs to fill in all BD
+                    fields. When not set, UMA performs BD
+                    filling and frame translation
+
+    pTxBd:          ptr to the TxBD
+
+    ucTxFlag:    different option setting for TX.
+
+    uTimeStamp:      Timestamp when the frame was received from HDD. (usec)
+   
+   @return
+    The result code associated with performing the operation  
+ 
+*/
+
+WDI_Status
+WDI_FillTxBd
+(
+    WDI_ControlBlockType*  pWDICtx, 
+    wpt_uint8              ucTypeSubtype, 
+    void*                  pDestMacAddr,
+    void*                  pAddr2,
+    wpt_uint8*             pTid, 
+    wpt_uint8              ucDisableFrmXtl, 
+    void*                  pTxBd, 
+    wpt_uint8              ucTxFlag, 
+    wpt_uint32             uTimeStamp,
+    wpt_uint8*             staIndex
+)
+{
+    wpt_uint8              ucTid        = *pTid; 
+    WDI_TxBdType*          pBd          = (WDI_TxBdType*) pTxBd;
+    WDI_Status             wdiStatus    = WDI_STATUS_SUCCESS;
+    wpt_uint8              ucUnicastDst = 0;
+    wpt_uint8              ucType       = 0;
+    wpt_uint8              ucSubType    = 0;
+    wpt_uint8              ucIsRMF      = 0;
+    WDI_BSSSessionType*    pBSSSes;
+    wpt_uint8              ucSTAType   = 0;
+#ifdef WLAN_PERF
+    wpt_uint32      uTxBdSignature = pBd->txBdSignature;
+#endif
+    tANI_U8                 useStaRateForBcastFrames = 0;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    /*------------------------------------------------------------------------
+       Get type and subtype of the frame first 
+    ------------------------------------------------------------------------*/
+    ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
+    ucSubType = (ucTypeSubtype & WDI_FRAME_SUBTYPE_MASK);
+
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, 
+               "Type: %d/%d, MAC S: %08x. MAC D: %08x., Tid=%d, frmXlat=%d, pTxBD=%08x ucTxFlag 0x%X\n", 
+                ucType, ucSubType, 
+                *((wpt_uint32 *) pAddr2), 
+               *((wpt_uint32 *) pDestMacAddr), 
+                ucTid, 
+               !ucDisableFrmXtl, pTxBd, ucTxFlag );
+
+
+    //logic to determine the version match between host and riva to find out when to enable using STA rate for bcast frames.
+    //determine if Riva vsersion and host version both are greater than or equal to 0.0.2 (major, minor, version). if yes then use STA rate 
+    // instead of BD rate for BC/MC frames. Otherwise use old code to use BD rate instead.
+    {    
+        if (WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual(0, 0, 2, 0) &&
+            WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual(0, 0, 2, 0))
+            useStaRateForBcastFrames = 1;
+    }
+
+
+    /*-----------------------------------------------------------------------
+    * Set common fields in TxBD
+     *     bdt: always HWBD_TYPE_GENERIC
+           dpuRF: This is not used in Gen6 since all WQs are explicitly
+           programmed to each HW module
+     *     ucTid: from caller, ignored if frame is MGMT frame
+     *     fwTxComplete0: always set to 0
+     *     txComplete1: If TxComp inrs  is requested, enable TxComplete interrupt
+     *     dpuFeedback/aduFeedback/reserved2: Always set to 0
+           ap: ACK policy to be placed in Qos ctrl field. Ignored by HW if non
+           Qos ucType frames.
+           u/b: If Addr1 of this frame in its 802.11 form is unicast, set to 0.
+           Otherwise set to 1.
+           dpuNE: always set to 0. DPU also uses the privacy bit in 802.11 hdr
+           for encryption decision
+     -----------------------------------------------------------------------*/
+    pBd->bdt   = HWBD_TYPE_GENERIC; 
+
+#ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+    // Route all trigger enabled frames to FW WQ, for FW to suspend trigger frame generation 
+    // when no traffic is exists on trigger enabled ACs
+    if(ucTxFlag & WDI_TRIGGER_ENABLED_AC_MASK) {
+        pBd->dpuRF = pWDICtx->ucDpuRF; 
+    } else 
+#endif //FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
+    {
+        pBd->dpuRF = BMUWQ_BTQM_TX_MGMT; 
+    }
+
+
+    pBd->tid           = ucTid; 
+    // Clear the reserved field as this field is used for defining special 
+    // flow control BD.
+    pBd->reserved4 = 0;
+    pBd->fwTxComplete0 = 0;
+
+    /* This bit is for host to register TxComplete Interrupt */
+    pBd->txComplete1   = (ucTxFlag & WDI_TXCOMP_REQUESTED_MASK) ? 1 : 0; 
+
+    pBd->ap    = WDI_ACKPOLICY_ACK_REQUIRED; 
+    pBd->dpuNE = WDI_NO_ENCRYPTION_DISABLED;  
+
+    ucUnicastDst = !(((wpt_uint8 *)pDestMacAddr)[0] & 0x01);    
+    *((wpt_uint32 *)pBd + WDI_DPU_FEEDBACK_OFFSET) = 0;
+
+    if(!ucUnicastDst)
+    {
+      pBd->ap    = WDI_ACKPOLICY_ACK_NOTREQUIRED; 
+    }
+
+    if (ucType == WDI_MAC_DATA_FRAME)
+    {
+
+        /* Set common fields for data frames (regardless FT enable/disable)
+         *     bd_ssn: Let DPU auto generate seq # if QosData frame. All other
+               frames DPU generates seq using nonQos counter.
+               For QosNull, don't occupy one Qos seq # to avoid a potential 
+               hole seen in reorder buffer when BA is enabled.
+ 
+         *     bd_rate:HW default or broadcast data rate
+         *     rmf:    RMF doesn't apply for data frames. Always set to 0
+         *     u/b: If Addr1 of this frame in its 802.11 form is unicast,
+               set to 0. Otherwise set to 1.
+         * Sanity: Force disable HW frame translation if incoming frame is
+           NULL data frame
+         */
+
+        if ((ucSubType & WDI_MAC_DATA_QOS_DATA)&&
+            (ucSubType != WDI_MAC_DATA_QOS_NULL))
+        {
+            pBd->bd_ssn = WDI_TXBD_BD_SSN_FILL_DPU_QOS;
+        }
+        else
+        {
+            pBd->bd_ssn = WDI_TXBD_BD_SSN_FILL_DPU_NON_QOS;
+        }
+
+        /* Unicast/Mcast decision:
+         *  In Infra STA role, all frames to AP are unicast frames.
+         *  For IBSS, then check the actual DA MAC address 
+            This implementation doesn't support multi BSS and AP case.
+            if(eSYSTEM_STA_IN_IBSS_ROLE == systemRole) 
+            ucUnicastDst = !(((wpt_uint8 *)pDestMacAddr)[0] & 0x01);
+               else
+            ucUnicastDst = WDI_DEFAULT_UNICAST_ENABLED;
+ 
+            The above is  original HAL code - however to make implementation
+            more elastic and supportive of concurrency scenarios we shall just
+            assume that bcast bit of MAC adddress cannot be set if addr is not
+            bcast: (!! may want to revisit this during testing) 
+         */
+
+        //Broadcast frames buffering don't work well if BD rate is used in AP mode.
+        //always use STA rate for data frames.
+        //never use BD rate for BC/MC frames in AP mode.
+
+
+        if (useStaRateForBcastFrames)
+        {
+            pBd->bdRate = WDI_TXBD_BDRATE_DEFAULT;
+        }
+        else
+        {
+            pBd->bdRate = (ucUnicastDst)? WDI_TXBD_BDRATE_DEFAULT : WDI_BDRATE_BCDATA_FRAME;
+        }
+        pBd->rmf    = WDI_RMF_DISABLED;     
+
+        /* sanity: Might already be set by caller, but enforce it here again */
+        if( WDI_MAC_DATA_NULL == (ucSubType & ~WDI_MAC_DATA_QOS_DATA))
+        {
+            ucDisableFrmXtl = 1;
+            if (ucTxFlag & WDI_TXCOMP_REQUESTED_MASK) 
+            {
+                /*Send to FW to transmit NULL frames.*/
+                pBd->dpuRF = BMUWQ_FW_TRANSMIT; 
+            }
+            else
+            {
+#ifdef LIBRA_WAPI_SUPPORT
+                if (ucTxFlag & WDI_WAPI_STA_MASK)
+                {
+                    pBd->dpuRF = BMUWQ_WAPI_DPU_TX;
+                    /*set NE bit to 1 for the null/qos null frames*/
+                    pBd->dpuNE = WDI_NO_ENCRYPTION_ENABLED;
+                }
+#endif
+            }
+         }
+#if defined(WLAN_PERF) || defined(FEATURE_WLAN_WAPI) || defined(LIBRA_WAPI_SUPPORT)
+        //For not-NULL data frames
+        else
+        {
+#if defined(FEATURE_WLAN_WAPI)
+            //If caller doesn't want this frame to be encrypted, for example, WAI packets
+            if( (ucTxFlag & WDI_TX_NO_ENCRYPTION_MASK) )
+            {
+                pBd->dpuNE = WDI_NO_ENCRYPTION_ENABLED;
+            }
+#endif //defined(FEATURE_WLAN_WAPI)
+#ifdef LIBRA_WAPI_SUPPORT
+            if (ucTxFlag & WDI_WAPI_STA_MASK)
+            {
+                pBd->dpuRF = BMUWQ_WAPI_DPU_TX;
+            }
+#endif //LIBRA_WAPI_SUPPORT
+#if defined(WLAN_PERF)
+    uTxBdSignature = WDI_ComputeTxBdSignature(pWDICtx, pDestMacAddr, ucTid, ucUnicastDst);
+#endif //defined(WLAN_PERF)
+        }
+#endif        
+    }
+    else if (ucType == WDI_MAC_MGMT_FRAME)
+    {
+
+        /*--------------------------------------------------------------------
+         *  Set common fields for mgmt frames
+         *     bd_ssn: Always let DPU auto generate seq # from the nonQos
+               sequence number counter.
+         *     bd_rate:unicast mgmt frames will go at lower rate (multicast rate).
+         *                  multicast mgmt frames will go at the STA rate as in AP mode
+         *                  buffering has an issue at HW if BD rate is used.
+         *     rmf:    NOT SET here. would be set later after STA id lookup is done.
+         * Sanity: Force HW frame translation OFF for mgmt frames.
+         --------------------------------------------------------------------*/
+         /* apply to both ucast/mcast mgmt frames */
+         if (useStaRateForBcastFrames)
+         {
+             pBd->bdRate = (ucUnicastDst)? WDI_BDRATE_BCMGMT_FRAME : WDI_TXBD_BDRATE_DEFAULT; 
+         }
+         else
+         {
+             pBd->bdRate = WDI_BDRATE_BCMGMT_FRAME;
+         }
+
+         if ( ucTxFlag & WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME) 
+         {
+           pBd->bdRate = WDI_BDRATE_CTRL_FRAME;
+         }
+
+         pBd->bd_ssn = WDI_TXBD_BD_SSN_FILL_DPU_NON_QOS;
+         if((ucSubType == WDI_MAC_MGMT_ACTION) || (ucSubType == WDI_MAC_MGMT_DEAUTH) || 
+            (ucSubType == WDI_MAC_MGMT_DISASSOC))
+            ucIsRMF = 1;
+         ucDisableFrmXtl = 1;
+    } 
+    else 
+    {   // Control Packet
+        /* We should never get a control packet, asserting here since something
+        is wrong */
+        WDI_ASSERT(0);
+    }
+
+    pBd->ub = !ucUnicastDst;
+
+    /* Fast path: Leverage UMA for BD filling/frame translation.
+     * Must be a data frame to request for FT.
+     * When HW frame translation is enabled, UMA fills in the following fields:
+     *   DPU Sig 
+     *   DPU descriptor index
+     *   Updates MPDU header offset, data offset, MPDU length after translation
+     *   STA id
+     *   BTQM Queue ID
+     */
+
+    pBd->ft = pWDICtx->bFrameTransEnabled & !ucDisableFrmXtl;
+
+    if( !pBd->ft)
+    {
+        /* - Slow path: Frame translation is disabled. Need to set the
+        following fields:
+         *    STA id
+         *    DPU Sig 
+         *    DPU descriptor index
+         *    BTQM Queue ID
+         * - For mgmt frames, also update rmf bits
+         */
+    
+        WDI_StaStruct*  pSta = (WDI_StaStruct*) pWDICtx->staTable;
+        wpt_uint8       ucStaId;
+
+        /* Disable frame translation*/
+        pBd->ft = 0;
+#ifdef WLAN_PERF
+        /* Mark the BD could not be reused */
+        uTxBdSignature = WDI_TXBD_SIG_MGMT_MAGIC; 
+#endif
+        if(ucTxFlag & WDI_USE_SELF_STA_REQUESTED_MASK)
+        {
+#ifdef HAL_SELF_STA_PER_BSS
+            // Get the (self) station index from ADDR2, which should be the self MAC addr
+           wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
+                                              *(wpt_macAddr*)pAddr2, &ucStaId );
+           if (WDI_STATUS_SUCCESS != wdiStatus) 
+           {
+                WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR, "WDI_STATableFindStaidByAddr failed");
+                return WDI_STATUS_E_FAILURE;
+           }
+#else
+            ucStaId = pWDICtx->ucSelfStaId;
+#endif
+        }
+        else
+        {
+            /*
+               _____________________________________________________________________________________________
+               |    |       |                 Data                  ||                Mgmt                   |
+               |____|_______|_______________________________________||_______________________________________|
+               |    | Mode  | DestAddr          | Addr2 (selfMac)   || DestAddr          | Addr2 (selfMac)   |
+               |____|_______|___________________|___________________||___________________|___________________|
+               |    |       |                   |                   ||                   |                   |
+               |    | STA   | DestAddr->staIdx  | When DestAddr     || DestAddr->staIdx  | -                 |
+               |    |       |                   | lookup fails,     ||                   |                   |
+               |    |       |                   | Addr2->staIdx     ||                   |                   |
+               |U/C | IBSS  | DestAddr->staIdx  |        -          || DestAddr->staIdx  | -                 |
+               |    | SoftAP| DestAddr->staIdx  |        -          || DestAddr->staIdx  | When DestAddr     |
+               |    |       |                   |                   ||                   | lookup fails,     |
+               |    |       |                   |                   ||                   | Addr2->StaIdx     |
+               |    | Idle  |     N/A           |        N/A        ||         -         | Addr2->StaIdx     |
+               |____|_______|___________________|___________________||___________________|___________________|
+               |    |       |                   |                   ||                   |                   |
+               |    | STA   |     N/A           |        N/A        ||         -         | Addr2->staIdx->   |
+               |    |       |                   |                   ||                   | bssIdx->bcasStaIdx|
+               |B/C | IBSS  |     -             | Addr2->staIdx->   ||         -         | Addr2->staIdx->   |
+               |    |       |                   | bssIdx->bcasStaIdx||                   | bssIdx->bcasStaIdx|
+               |    | SoftAP|     -             | Addr2->staIdx->   ||         -         | Addr2->staIdx->   |
+               |    |       |                   | bssIdx->bcasStaIdx||                   | bssIdx->bcasStaIdx|
+               |    | Idle  |     N/A           |        N/A        ||         -         | Addr2->staIdx->   |
+               |    |       |                   |                   ||                   | bssIdx->bcasStaIdx|
+               |____|_______|___________________|___________________||___________________|___________________|*/
+            // Get the station index based on the above table
+           if( ucUnicastDst ) 
+           {
+             wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
+                                        *(wpt_macAddr*)pDestMacAddr, &ucStaId ); 
+               // Only case this look would fail would be in STA mode, in AP & IBSS mode 
+               // this look should pass. In STA mode the unicast data frame could be 
+               // transmitted to a DestAddr for which there might not be an entry in 
+               // HAL STA table and the lookup would fail. In such cases use the Addr2 
+               // (self MAC address) to get the selfStaIdx.
+
+
+              if (WDI_STATUS_SUCCESS != wdiStatus) 
+              {
+                // Get the station index for ADDR2, which should be the self MAC addr
+                wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
+                                       *(wpt_macAddr*)pAddr2, &ucStaId ); 
+                if (WDI_STATUS_SUCCESS != wdiStatus)
+                {
+                  return WDI_STATUS_E_FAILURE;
+                }
+              }
+            } 
+            else
+            {
+              // For bcast frames use the bcast station index
+              wpt_uint8 bssSessIdx;
+
+              // Get the station index for ADDR2, which should be the self MAC addr
+              wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
+                                              *(wpt_macAddr*)pAddr2, &ucStaId ); 
+              if (WDI_STATUS_SUCCESS != wdiStatus)
+              {
+                return WDI_STATUS_E_FAILURE;
+              }
+
+              // Get the Bss Index related to the staId
+              bssSessIdx = pSta[ucStaId].bssIdx;
+
+              // Get the broadcast station index for this bss
+              (void) WDI_FindAssocSessionByBSSIdx( pWDICtx, bssSessIdx, 
+                                                   &pBSSSes ); 
+              if (NULL == pBSSSes)
+              {
+                // session not found ?!?
+                return WDI_STATUS_E_FAILURE;
+              }
+              ucStaId = pBSSSes->bcastStaIdx;
+           }
+         }    
+
+        pBd->staIndex = ucStaId;
+        
+        *staIndex = ucStaId;
+
+        pSta += ucStaId;  // Go to the curresponding station's station table
+
+        if(ucType == WDI_MAC_MGMT_FRAME)
+        {
+            if (ucUnicastDst) 
+            {
+                /* If no ack is requested use the bcast queue */
+                if (ucTxFlag & WDI_USE_NO_ACK_REQUESTED_MASK) 
+                {
+                    pBd->queueId = BTQM_QUEUE_SELF_STA_BCAST_MGMT;
+                }
+                else
+                {
+                    /* Assigning Queue Id configured to Ack */ 
+                    pBd->queueId = BTQM_QUEUE_SELF_STA_UCAST_MGMT;
+                }
+            } 
+            else 
+            {
+                /* Assigning to Queue Id configured to No Ack */ 
+                pBd->queueId = BTQM_QUEUE_SELF_STA_BCAST_MGMT;
+            }
+
+            if(ucIsRMF && pSta->rmfEnabled)
+            {
+                pBd->rmf = 1;
+                if(!ucUnicastDst)
+                    pBd->dpuDescIdx = pSta->bcastMgmtDpuIndex; /* IGTK */
+                else
+                    pBd->dpuDescIdx = pSta->dpuIndex; /* PTK */
+            }
+            else
+            {
+                pBd->dpuNE = WDI_NO_ENCRYPTION_ENABLED;  
+                pBd->rmf = 0;
+                pBd->dpuDescIdx = pSta->dpuIndex; /* PTK for both u/mcast mgmt frames */
+            }
+        }
+        else
+        {
+            /* data frames */
+            /* TID->QID is one-to-one mapping, the same way as followed in H/W */
+            wpt_uint8 queueId = 0;
+
+   
+            WDI_STATableGetStaType(pWDICtx, ucStaId, &ucSTAType);
+            if(!ucUnicastDst)
+                pBd->queueId = BTQM_QID0;
+#ifndef HAL_SELF_STA_PER_BSS
+            else if( ucUnicastDst && (ucStaId == pWDICtx->ucSelfStaId))
+                pBd->queueId = BTQM_QUEUE_SELF_STA_UCAST_DATA;
+#else
+            else if( ucUnicastDst && (ucSTAType == WDI_STA_ENTRY_SELF))
+                pBd->queueId = BTQM_QUEUE_SELF_STA_UCAST_DATA;
+#endif
+            else if (pSta->qosEnabled) 
+            {
+                WDI_BmuGetQidForQOSTid( ucTid, &queueId); 
+                pBd->queueId = (wpt_uint32) queueId;
+            }
+            else
+                pBd->queueId = BTQM_QUEUE_TX_nQOS;
+
+            if(ucUnicastDst)
+            {
+                pBd->dpuDescIdx = pSta->dpuIndex; /*unicast data frames: PTK*/
+            }
+            else
+            {
+                pBd->dpuDescIdx = pSta->bcastDpuIndex; /* mcast data frames: GTK*/
+            }
+        }
+
+        pBd->dpuSignature = pSta->dpuSig;
+
+        /* ! Re-analize this assumption
+        - original code from HAL is below - however WDI does not have access to a
+        DPU index table - so it just stores the signature that it receives from HAL upon
+        post assoc 
+        if(eHAL_STATUS_SUCCESS == halDpu_GetSignature(pMac, pSta->dpuIndex, &ucDpuSig))
+            pBd->dpuSignature = ucDpuSig;
+        else{   
+            WPAL_TRACE( WPT_WDI_CONTROL_MODULE, WPT_MSG_LEVEL_HIGH, "halDpu_GetSignature() failed for dpuId = %d\n", pBd->dpuDescIdx));
+            return VOS_STATUS_E_FAILURE;
+        } */
+
+    } 
+    
+    /*------------------------------------------------------------------------
+       Over SDIO bus, SIF won't swap data bytes to/from data FIFO. 
+       In order for MAC modules to recognize BD in Riva's default endian
+       format (Big endian)
+     * All BD fields need to be swaped here
+     ------------------------------------------------------------------------*/
+    WDI_SwapTxBd((wpt_uint8 *)pBd); 
+
+#ifdef WLAN_PERF
+    /* Save the BD signature. This field won't be swapped and remains in host
+       byte order */
+    pBd->txBdSignature = uTxBdSignature ;
+#endif        
+    
+    return wdiStatus;
+}/*WDI_FillTxBd*/
+
+
+/**
+ @brief WDI_RxBD_GetFrameTypeSubType - Called by the data path 
+        to retrieve the type/subtype of the received frame.
+  
+ @param       pvBDHeader:    Void pointer to the RxBD buffer.
+    usFrmCtrl:     the frame ctrl of the 802.11 header 
+  
+ @return   A byte which contains both type and subtype info. LSB four bytes 
+ (b0 to b3)is subtype and b5-b6 is type info. 
+*/
+
+wpt_uint8 
+WDI_RxBD_GetFrameTypeSubType
+(
+    void* _pvBDHeader, 
+    wpt_uint16 usFrmCtrl
+)
+{
+    WDI_RxBdType*    pRxBd = (WDI_RxBdType*) _pvBDHeader;
+    wpt_uint8        typeSubType;
+    WDI_MacFrameCtl  wdiFrmCtl; 
+    
+    if (pRxBd->ft != WDI_RX_BD_FT_DONE)
+    {
+        if (pRxBd->asf)
+        {
+            typeSubType = (WDI_MAC_DATA_FRAME << WDI_FRAME_TYPE_OFFSET) |
+                                                       WDI_MAC_DATA_QOS_DATA;
+        } else {
+           wpalMemoryCopy(&wdiFrmCtl, &usFrmCtrl, sizeof(wdiFrmCtl)); 
+           typeSubType = (wdiFrmCtl.type << WDI_FRAME_TYPE_OFFSET) |
+                                                       wdiFrmCtl.subType;
+        }
+    }
+    else
+    {
+        wpalMemoryCopy(&wdiFrmCtl, &usFrmCtrl, sizeof(wdiFrmCtl)); 
+        typeSubType = (wdiFrmCtl.type << WDI_FRAME_TYPE_OFFSET) |
+                        wdiFrmCtl.subType;
+    }
+    
+    return typeSubType;
+}/*WDI_RxBD_GetFrameTypeSubType*/
+
+/**
+ @brief WDI_SwapRxBd swaps the RX BD.
+
+  
+ @param pBd - pointer to the BD (in/out)
+  
+ @return None
+*/
+void 
+WDI_SwapRxBd(wpt_uint8 *pBd)
+{
+#ifndef WDI_BIG_BYTE_ENDIAN
+    WDI_SwapBytes(pBd , WDI_RX_BD_HEADER_SIZE);
+#endif
+}/*WDI_SwapRxBd*/
+
+
+/**
+ @brief WDI_SwapTxBd - Swaps the TX BD
+  
+ @param  pBd - pointer to the BD (in/out)
+  
+ @return   none
+*/
+void 
+WDI_SwapTxBd(wpt_uint8 *pBd)
+{
+#ifndef WDI_BIG_BYTE_ENDIAN
+    WDI_SwapBytes(pBd , WDI_TX_BD_HEADER_SIZE);
+#endif
+}/*WDI_SwapTxBd*/
+
+/*! TO DO:  - check if we still need this for RIVA*/
+/**
+ @brief WDI_RxAmsduBdFix - fix for HW issue for AMSDU 
+
+  
+ @param   pWDICtx:       Context to the WDI
+          pBDHeader - pointer to the BD header
+  
+ @return None
+*/
+void 
+WDI_RxAmsduBdFix
+(
+    WDI_ControlBlockType*  pWDICtx,
+    void*                 _pvBDHeader
+)
+{
+    WDI_RxBdType*          pRxBd   = (WDI_RxBdType*) _pvBDHeader;
+    wpt_uint32 *pModBd, *pMaskBd, *pFirstBd, i;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+    if (pRxBd->asf)
+    {
+        if (pRxBd->sybFrameIdx == 0)
+        {
+            //copy the BD of first AMSDU
+            pWDICtx->wdiRxAmsduFirstBdCache = *pRxBd;
+        }
+        else
+        {
+            pModBd   = (wpt_uint32*)pRxBd;
+            pMaskBd  = (wpt_uint32*)&pWDICtx->wdiRxAmsduBdFixMask;
+            pFirstBd = (wpt_uint32*)&pWDICtx->wdiRxAmsduFirstBdCache;
+
+            for (i = 0; i < sizeof(WDI_RxBdType)/sizeof(wpt_uint32 *); i++)
+            {
+                //modified BD = zero out non AMSDU related fields in this BD |
+                //              non AMSDU related fields from the first BD.
+                pModBd[i] = (pModBd[i] & ~pMaskBd[i]) |
+                            (pFirstBd[i] & pMaskBd[i]);
+            }
+        }
+    }
+    return;
+}/*WDI_RxAmsduBdFix*/
+
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi_sta.c b/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
new file mode 100644
index 0000000..ef53efe
--- /dev/null
+++ b/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
@@ -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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ W D I _ S T A . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Device Abstraction     
+  Layer Station Table Management Entity.
+
+  The functions externalized by this module are internal APIs for DAL Core
+  and can only be called by it. 
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2008 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
+----------    ---    --------------------------------------------------------
+2010-08-09    lti     Created module
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_wdi.h" 
+#include "wlan_qct_wdi_i.h" 
+#include "wlan_qct_wdi_sta.h" 
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_trace.h"
+
+
+/*----------------------------------------------------------------------------
+ * Function definition
+ * -------------------------------------------------------------------------*/
+/**
+ @brief WDI_STATableInit - Initializes the STA tables. 
+        Allocates the necesary memory.
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_STATableInit
+(
+   WDI_ControlBlockType*  pWDICtx
+)
+{
+    wpt_uint8  ucMaxStations;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/    
+
+    ucMaxStations     = (wpt_uint8) pWDICtx->ucMaxStations;
+    
+    /*----------------------------------------------------------------------
+       Allocate the memory for sta table
+    ------------------------------------------------------------------------*/
+    pWDICtx->staTable = wpalMemoryAllocate(ucMaxStations * sizeof(WDI_StaStruct));
+
+    if (NULL == pWDICtx->staTable)
+    {
+            
+        WDI_STATableClose(pWDICtx);
+
+        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "Error allocating memory on WDI_STATableInit"); 
+        return WDI_STATUS_E_FAILURE;
+    }
+    
+    wpalMemoryZero( pWDICtx->staTable, ucMaxStations * sizeof( WDI_StaStruct ));
+
+#ifndef HAL_SELF_STA_PER_BSS
+    // Initialize the Self STAID to an invalid value
+    pWDICtx->ucSelfStaId = WDI_STA_INVALID_IDX;
+#endif
+
+    return WDI_STATUS_SUCCESS;
+}/*WDI_STATableInit*/
+
+/**
+ @brief WDI_STATableStart - resets the max and number values of 
+        STAtions
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableStart
+(
+    WDI_ControlBlockType*  pWDICtx
+)
+{
+    wpt_uint8 ucMaxStations;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+    
+    ucMaxStations     = (wpt_uint8) pWDICtx->ucMaxStations;
+ 
+    return WDI_STATUS_SUCCESS;
+}/*WDI_STATableStart*/
+
+/**
+ @brief WDI_STATableStop - clears the sta table
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableStop
+(
+    WDI_ControlBlockType*  pWDICtx
+)
+{
+    wpt_uint8 ucMaxStations;
+    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+#ifndef HAL_SELF_STA_PER_BSS
+    /* Clean up the Self STAID */
+    pWDICtx->ucSelfStaId = WDI_STA_INVALID_IDX;
+#endif
+
+    ucMaxStations     = pWDICtx->ucMaxStations;
+    
+    wpalMemoryZero( (void *) pWDICtx->staTable,
+            ucMaxStations * sizeof( WDI_StaStruct ));
+
+    return WDI_STATUS_SUCCESS;
+}/*WDI_STATableStop*/
+
+/**
+ @brief WDI_STATableClose - frees the resources used by the STA 
+        table.
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableClose
+(
+  WDI_ControlBlockType*  pWDICtx
+)
+{
+    WDI_Status status = WDI_STATUS_SUCCESS;
+        
+    // Free memory
+    if (pWDICtx->staTable != NULL)
+        wpalMemoryFree( pWDICtx->staTable);
+
+    pWDICtx->staTable = NULL;
+    return status;
+}/*WDI_STATableClose*/
+
+
+/**
+ @brief WDI_STATableAddSta - Function to Add Station
+
+ 
+ @param  pWDICtx:     pointer to the WLAN DAL context 
+         pwdiParam:   station parameters  
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableAddSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    WDI_AddStaParams*      pwdiParam
+)
+{
+    wpt_uint8        ucSTAIdx  = 0;
+    WDI_StaStruct*   pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    /*- - - -  - - - - - - - - - - - -  - - - - - - - - - - - -  - - - - - */
+
+    /*-----------------------------------------------------------------------
+      Sanity check
+      - station ids are allocated by the HAL located on RIVA SS - they must
+      always be valid 
+    -----------------------------------------------------------------------*/
+    if (( pwdiParam->ucSTAIdx  == WDI_STA_INVALID_IDX) ||
+        ( pwdiParam->ucSTAIdx >= pWDICtx->ucMaxStations ))
+    {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Station id sent by HAL is invalid - not OK"); 
+      WDI_ASSERT(0); 
+      return WDI_STATUS_E_FAILURE; 
+    }
+    
+    ucSTAIdx =  pwdiParam->ucSTAIdx;
+
+    /*Since we are not the allocator of STA Ids but HAL is - just set flag to
+      valid*/
+    pSTATable[ucSTAIdx].valid = 1;     
+    
+    
+    // Save the STA type - this is used for lookup
+    WDI_STATableSetStaType(pWDICtx, ucSTAIdx, pwdiParam->ucStaType);
+    WDI_STATableSetStaQosEnabled(pWDICtx, ucSTAIdx, 
+          (wpt_uint8)(pwdiParam->ucWmmEnabled | pwdiParam->ucHTCapable) );
+
+#ifdef WLAN_PERF
+    pWDICtx->uBdSigSerialNum ++;
+#endif
+    
+    wpalMemoryCopy(pSTATable[ucSTAIdx].macBSSID, 
+                   pwdiParam->macBSSID, WDI_MAC_ADDR_LEN);
+
+    /*------------------------------------------------------------------------
+      Set DPU Related Information 
+    ------------------------------------------------------------------------*/
+    pSTATable[ucSTAIdx].dpuIndex              = pwdiParam->dpuIndex; 
+    pSTATable[ucSTAIdx].dpuSig                = pwdiParam->dpuSig; 
+
+    pSTATable[ucSTAIdx].bcastDpuIndex         = pwdiParam->bcastDpuIndex; 
+    pSTATable[ucSTAIdx].bcastDpuSignature     = pwdiParam->bcastDpuSignature; 
+
+    pSTATable[ucSTAIdx].bcastMgmtDpuIndex     = pwdiParam->bcastMgmtDpuIndex; 
+    pSTATable[ucSTAIdx].bcastMgmtDpuSignature = pwdiParam->bcastMgmtDpuSignature; 
+
+    /*Robust Mgmt Frame enabled */
+    pSTATable[ucSTAIdx].rmfEnabled            = pwdiParam->ucRmfEnabled;
+
+    pSTATable[ucSTAIdx].bssIdx                = pwdiParam->ucBSSIdx;
+
+    /* Now update the STA entry with the new MAC address */
+    if(WDI_STATUS_SUCCESS != WDI_STATableSetStaAddr( pWDICtx, 
+                                                     ucSTAIdx, 
+                                                     pwdiParam->staMacAddr))
+    {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "Failed to update station entry - internal failure");
+       WDI_ASSERT(0);
+       return WDI_STATUS_E_FAILURE; 
+    }
+
+    /* Now update the STA entry with the new BSSID address */
+    if(WDI_STATUS_SUCCESS != WDI_STATableSetBSSID( pWDICtx, 
+                                                     ucSTAIdx, 
+                                                     pwdiParam->macBSSID))
+    {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "Failed to update station entry - internal failure");
+       WDI_ASSERT(0);
+       return WDI_STATUS_E_FAILURE; 
+    }
+
+    return WDI_STATUS_SUCCESS;
+}/*WDI_AddSta*/
+
+/**
+ @brief WDI_STATableDelSta - Function to Delete a Station
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station to be deleted
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableDelSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8              ucSTAIdx
+)
+{
+    WDI_StaStruct*   pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    /*- - - -  - - - - - - - - - - - -  - - - - - - - - - - - -  - - - - - */
+
+    /*-----------------------------------------------------------------------
+      Sanity check
+      - station ids are allocated by the HAL located on RIVA SS - they must
+      always be valid 
+    -----------------------------------------------------------------------*/
+    if(( ucSTAIdx  == WDI_STA_INVALID_IDX )||
+        ( ucSTAIdx >= pWDICtx->ucMaxStations ))
+    {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "STA Id invalid on Del STA - internal failure");
+       WDI_ASSERT(0);
+       return WDI_STATUS_E_FAILURE; 
+    }
+    
+    wpalMemoryZero(&pSTATable[ucSTAIdx], sizeof(pSTATable[ucSTAIdx])); 
+    pSTATable->valid = 0; 
+    return WDI_STATUS_SUCCESS;
+}/*WDI_STATableDelSta*/
+
+/**
+ @brief WDI_STATableBSSDelSta - Function to Delete Stations in this BSS
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucBSSIdx:        BSS index 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableBSSDelSta
+(
+    WDI_ControlBlockType*  pWDICtx,
+    wpt_uint8              ucBSSIdx
+)
+{
+    WDI_StaStruct*   pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    wpt_uint8        ucSTAIdx;
+    /*- - - -  - - - - - - - - - - - -  - - - - - - - - - - - -  - - - - - */
+
+    for (ucSTAIdx = 0; (ucSTAIdx < pWDICtx->ucMaxStations); ucSTAIdx++)
+    {
+        if( (pSTATable[ucSTAIdx].ucStaType == WDI_STA_ENTRY_PEER) && 
+                                 (pSTATable[ucSTAIdx].bssIdx == ucBSSIdx))
+        {
+            WDI_STATableDelSta(pWDICtx, ucSTAIdx);
+        }
+    }
+
+    return WDI_STATUS_SUCCESS;
+}/*WDI_STATableBSSDelSta*/
+
+
+/**
+ @brief WDI_STATableGetStaBSSIDAddr - Gets the BSSID associated 
+        with this station
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station index
+         pmacBSSID:      out BSSID for this STA
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaBSSIDAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr*           pmacBSSID
+)
+{
+  WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+  {
+     wpalMemoryCopy(*pmacBSSID, pSTATable[ucSTAIdx].macBSSID, WDI_MAC_ADDR_LEN);
+     return WDI_STATUS_SUCCESS;
+  }
+  else
+     return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableGetStaQosEnabled*/
+
+
+/**
+ @brief WDI_STATableGetStaQosEnabled - Gets is qos is enabled 
+        for a sta
+
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         ucSTAIdx:        station index
+         qosEnabled:      out qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaQosEnabled
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8*             qosEnabled
+)
+{
+  WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+  if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid) && qosEnabled)
+  {
+     *qosEnabled = pSTATable[ucSTAIdx].qosEnabled;
+     return WDI_STATUS_SUCCESS;
+  }
+  else
+     return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableGetStaQosEnabled*/
+
+/**
+ @brief WDI_STATableSetStaQosEnabled - set qos mode for STA
+
+ 
+ @param  pWDICtx:    pointer to the WLAN DAL context 
+         ucSTAIdx:   station index
+         qosEnabled: qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaQosEnabled
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              qosEnabled
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        pSTATable[ucSTAIdx].qosEnabled = qosEnabled;
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableSetStaQosEnabled*/
+
+/**
+ @brief WDI_STATableGetStaType - get sta type for STA
+
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucSTAIdx:  station index
+         pStaType:  qos enabled
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaType
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8*             pStaType
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        *pStaType = pSTATable[ucSTAIdx].ucStaType;
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableGetStaType*/
+
+/**
+ @brief WDI_STATableSetStaType - sets sta type for STA
+
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+         ucSTAIdx:  station index
+         staType:   sta type
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaType
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              staType
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        pSTATable[ucSTAIdx].ucStaType = staType;
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableSetStaType*/
+
+
+/**
+ @brief WDI_CompareMacAddr - compare the MAC address
+
+ 
+ @param  addr1: address 1 
+         addr2: address 2  
+  
+ @see
+ @return Result of the function call
+*/
+WPT_STATIC WPT_INLINE wpt_uint8
+WDI_CompareMacAddr
+(
+  wpt_uint8 addr1[], 
+  wpt_uint8 addr2[]
+)
+{
+#if defined( _X86_ )
+    wpt_uint32 align = (0x3 & ((wpt_uint32) addr1 | (wpt_uint32) addr2 ));
+
+    if( align ==0){
+        return ((*((wpt_uint16 *) &(addr1[4])) == *((wpt_uint16 *) &(addr2[4])))&&
+                (*((wpt_uint32 *) addr1) == *((wpt_uint32 *) addr2)));
+    }else if(align == 2){
+        return ((*((wpt_uint16 *) &addr1[4]) == *((wpt_uint16 *) &addr2[4])) &&
+            (*((wpt_uint16 *) &addr1[2]) == *((wpt_uint16 *) &addr2[2])) &&
+            (*((wpt_uint16 *) &addr1[0]) == *((wpt_uint16 *) &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
+}/*WDI_CompareMacAddr*/
+
+
+/**
+ @brief WDI_STATableFindStaidByAddr - Given a station mac address, search
+        for the corresponding station index from the Station Table.
+ 
+ @param  pWDICtx:  WDI Context pointer
+         staAddr:  station address
+         pucStaId: output station id 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_STATableFindStaidByAddr
+(
+    WDI_ControlBlockType*  pWDICtx, 
+    wpt_macAddr            staAddr, 
+    wpt_uint8*             pucStaId
+)
+{
+    WDI_Status wdiStatus = WDI_STATUS_E_FAILURE;
+    wpt_uint8 i;
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+
+    for (i=0; i < pWDICtx->ucMaxStations; i++, pSTATable++)
+    {
+        if ( (pSTATable->valid == 1) && (WDI_CompareMacAddr(pSTATable->staAddr, staAddr)) )
+        {
+            *pucStaId = i;
+            wdiStatus = WDI_STATUS_SUCCESS;
+            break;
+        }
+    }
+    return wdiStatus;
+}/*WDI_STATableFindStaidByAddr*/
+
+/**
+ @brief WDI_STATableGetStaAddr - get station address
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:  station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableGetStaAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8**            pStaAddr
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        *pStaAddr = pSTATable[ucSTAIdx].staAddr;
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableGetStaAddr*/
+
+/**
+ @brief WDI_STATableSetStaAddr - set station address
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetStaAddr
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr            staAddr
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        wpalMemoryCopy (pSTATable[ucSTAIdx].staAddr, staAddr, 6);
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableSetStaAddr*/
+
+/**
+ @brief WDI_STATableSetBSSID - set station corresponding BSSID
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         pStaAddr: output station address 
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetBSSID
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_macAddr            macBSSID
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        wpalMemoryCopy (pSTATable[ucSTAIdx].macBSSID, macBSSID, 6);
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableSetBSSID*/
+
+/**
+ @brief WDI_STATableSetBSSIdx - set station corresponding BSS index
+ 
+ @param  pWDICtx:  WDI Context pointer
+         ucSTAIdx:   station index
+         ucBSSIdx:   BSS index
+  
+ @see
+ @return Result of the function call
+*/
+WDI_Status 
+WDI_STATableSetBSSIdx
+(
+    WDI_ControlBlockType*  pWDICtx,  
+    wpt_uint8              ucSTAIdx, 
+    wpt_uint8              ucBSSIdx
+)
+{
+    WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
+    if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
+    {
+        pSTATable[ucSTAIdx].bssIdx = ucBSSIdx;
+        return WDI_STATUS_SUCCESS;
+    }
+    else
+        return WDI_STATUS_E_FAILURE;
+}/*WDI_STATableSetBSSIdx*/
+
diff --git a/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h b/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
new file mode 100644
index 0000000..2a3bd0c
--- /dev/null
+++ b/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
@@ -0,0 +1,311 @@
+/*
+ * 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_QCT_WTI_DS_H )
+#define __WLAN_QCT_WTI_DS_H
+
+/**=========================================================================
+ *     
+ *       \file  wlan_qct_wdi_ds.h
+ *          
+ *       \brief define Dataservice API 
+ *                               
+ * WLAN Device Abstraction layer External API for Dataservice
+ * DESCRIPTION
+ *  This file contains the external API exposed by the 
+ *   wlan device abstarction layer module.
+ *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
+ */
+
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_wdi.h"
+   
+
+typedef struct 
+{
+   wpt_uint32 txFlags;
+   wpt_uint8 ac;
+   wpt_uint8 isEapol:1; //0 - not eapol 1 - eapol
+   wpt_uint8 isWai:1;   //WAPI 0 - not WAI 1 WAI 
+   wpt_uint8 fdisableFrmXlt:1;   //0 - Let ADU do FT. 1 - bypass ADU FT
+   wpt_uint8 qosEnabled:1; //0 - non-Qos 1 - Qos
+   wpt_uint8 fenableWDS:1; //0 - not WDS 1 WDS
+   wpt_uint8 reserved1:3;
+   wpt_uint8 typeSubtype;
+   wpt_uint8 fUP;
+   wpt_uint8 fSTAMACAddress[6];
+   wpt_uint8 addr2MACAddress[6];
+   wpt_uint8 frmType;
+   wpt_uint8 fStaType;
+   wpt_uint8 fProtectedFrame;
+   wpt_uint16 fPktlen;
+   wpt_status txCompleteStatus;
+} WDI_DS_TxMetaInfoType;
+
+
+typedef enum
+{
+  WDI_DS_OPCODE_INVALID         = 0,
+  WDI_DS_OPCODE_QCUR_FWDBUF     = 1,
+  WDI_DS_OPCODE_FWDBUF_FWDCUR   = 2,
+  WDI_DS_OPCODE_QCUR            = 3,
+  WDI_DS_OPCODE_FWDBUF_QUEUECUR = 4,
+  WDI_DS_OPCODE_FWDBUF_DROPCUR  = 5,
+  WDI_DS_OPCODE_FWDALL_DROPCUR  = 6,
+  WDI_DS_OPCODE_FWDALL_QCUR     = 7,
+  WDI_DS_OPCODE_TEARDOWN        = 8,
+  WDI_DS_OPCODE_DROPCUR         = 9,
+  WDI_DS_OPCODE_MAX
+}WDI_DS_BAOpCodeEnumType;
+
+typedef struct 
+{
+   wpt_uint8 staId;
+   wpt_uint8 addr3Idx;
+   wpt_uint8 rxChannel;
+   wpt_uint8 type:2;
+   wpt_uint8 subtype:4;
+   wpt_uint8 reserved0:2;
+
+   wpt_uint16 rtsf:1;  //For beacon only. 1 ~V Riva TSF is bigger(later) than the one received
+   wpt_uint16 bsf:1;   //1 Riva sends the last beacon, 0 not.
+   wpt_uint16 unknownUcastPkt:1;   //1 ~V unicast frame received with unknown A2
+   wpt_uint16 scan:1;   //1 frame received in scan state. 0 not.
+   wpt_uint16 dpuSig:3;   //DPU signature
+   wpt_uint16 ft:1;   //0~Wframe translation is not done. 1~Wdone
+   wpt_uint16 ne:1;   //1 ~V frame is not encrypted OTA. This is for WAPI~Rs WAI packet.
+   wpt_uint16 llcr:1;   // Has the LLC been stripped by H/W
+   wpt_uint16 bcast:1;   //0 ~V unicast frame 1 ~V broadcast/multicast frame
+   wpt_uint16 tid:4;
+   wpt_uint16 reserved1:1;
+   wpt_uint8 dpuFeedback;
+   wpt_int8 snr;
+
+   wpt_uint32 currentPktSeqNo:12;  /*current sequence number */
+   wpt_uint32 ampdu_reorderOpcode:4;
+   wpt_uint32 ampdu_reorderSlotIdx:6;
+   wpt_uint32 ampdu_reorderFwdIdx:6;
+   wpt_uint32 reserved3:4;
+
+   wpt_uint16 amsdu_size;
+   wpt_uint32 amsdu_asf:1;
+   wpt_uint32 amsdu_esf:1;
+   wpt_uint32 amsdu_lsf:1;
+   wpt_uint32 amsdu_aef:1;
+   wpt_uint32 reserved2:4;
+
+   wpt_uint8 *mpduHeaderPtr;
+   wpt_uint8 *mpduDataPtr;
+   wpt_uint32  mpduLength;
+   wpt_uint32  mpduHeaderLength;
+
+   wpt_uint32  rateIndex;
+   wpt_uint32  rxpFlags;
+   wpt_uint32  mclkRxTimestamp;
+
+   //Flow control frames
+   wpt_uint8  fc;
+   wpt_uint32 fcSTATxQStatus:16;
+   wpt_uint32 fcSTAThreshIndMask:16;
+   wpt_uint32 fcSTAPwrSaveStateMask:16;
+   wpt_uint32 fcSTAValidMask:16;
+
+   wpt_uint16 fcStaTxDisabledBitmap;
+   wpt_uint8 fcSTATxQLen[12]; // one byte per STA. 
+   wpt_uint8 fcSTACurTxRate[12]; // current Tx rate for each sta.
+
+   wpt_uint64 replayCount;
+
+   wpt_uint32 rssi0;
+   wpt_uint32 rssi1;
+} WDI_DS_RxMetaInfoType;
+
+typedef struct sPktMetaInfo
+{
+   union
+   {
+      WDI_DS_TxMetaInfoType txMetaInfo;
+      WDI_DS_RxMetaInfoType rxMetaInfo;
+   } u;
+} WDI_DS_MetaInfoType;
+
+WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
+{
+  WDI_DS_RxMetaInfoType * pRxMetadata =
+    &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.rxMetaInfo;
+  return pRxMetadata;
+}
+
+
+WPT_STATIC WPT_INLINE WDI_DS_TxMetaInfoType* WDI_DS_ExtractTxMetaData (wpt_packet *pFrame)
+{
+        WDI_DS_TxMetaInfoType * pTxMetadata =
+                &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.txMetaInfo;
+        return pTxMetadata;
+}
+
+
+typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
+typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
+typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
+
+
+
+/* DAL registration function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along 
+ *  with the callback.
+ *  pfnTxCompleteCallback:Callback function that is to be invoked to return 
+ *  packets which have been transmitted.
+ *  pfnRxPacketCallback:Callback function that is to be invoked to deliver 
+ *  packets which have been received
+ *  pfnTxFlowControlCallback:Callback function that is to be invoked to 
+ *  indicate/clear congestion. 
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+WDI_Status WDI_DS_Register( void *pContext, 
+  WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
+  WDI_DS_RxPacketCallback pfnRxPacketCallback, 
+  WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
+  void *pCallbackContext);
+
+
+
+/* DAL Transmit function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  pFrame:Refernce to PAL frame.
+ *  more: Does the invokee have more than one packet pending?
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxPacket(void *pContext,
+  wpt_packet *pFrame,
+  wpt_boolean more);
+  
+  
+/* DAL Transmit Complete function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  ucTxResReq:TX resource number required by TL
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq);
+
+/* DAL Suspend Transmit function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxSuspend(void *pContext);
+
+
+/* DAL Resume Transmit function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxResume(void *pContext);
+
+/* DAL Get Reserved resource by STA 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  wdiResPool: MemPool, MGMT ot DATA
+ *  staId: STA ID
+ * Return Value: Number of reserved resouce count
+ *
+ */
+wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,
+                                                        WDI_ResPoolType wdiResPool,
+                                                        wpt_uint8 staId);
+
+/* DAL ADD STA into memPool
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  staId: STA ID
+ * Return Value: SUCCESS or FAIL
+ *
+ */
+WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex);
+
+/* DAL Remove STA from memPool
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  staId: STA ID
+ * Return Value: SUCCESS or FAIL
+ *
+ */
+WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex);
+
+/* DAL Set STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
+
+/* DAL Get STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx);
+
+/* DAL Clear STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
+
+#endif
diff --git a/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h b/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
new file mode 100644
index 0000000..482c224
--- /dev/null
+++ b/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
@@ -0,0 +1,246 @@
+/*
+ * 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_QCT_WDI_DS_I_H )
+#define __WLAN_QCT_WDI_DS_I_H
+
+/**=========================================================================
+ *
+ *       \file  wlan_qct_wdi_ds_i.h
+ *
+ *       \brief define Dataservice API
+ *
+ * WLAN Device Abstraction layer External API for Dataservice
+ * DESCRIPTION
+ *   This file contains the external API exposed by the
+ *   wlan device abstarction layer module.
+ *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
+ */
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_qct_dxe.h"
+
+
+#define WDI_DS_MAX_CHUNK_SIZE 128
+#define WDI_802_11_MAX_HEADER_LEN 40
+
+
+/*The number of resources (BD headers) available for the HI priority DXE
+  channel
+  DXE will use 1 descriptor for the BD header and 1 for the data =>
+  This is true for LA but not EA. EA sends down 3~4 MDL chain per a packet.
+  Now we set it the same with free DXE decriptor number*/
+#define WDI_DS_HI_PRI_RES_NUM  (WLANDXE_HI_PRI_RES_NUM)
+
+/*The number of resources (BD headers) available for the Low priority DXE
+  channel - see above
+*/
+#define WDI_DS_LO_PRI_RES_NUM  (WLANDXE_LO_PRI_RES_NUM)
+
+/*The number of BD headers available in the system for Tx must match the number
+  of DXE descriptors available for actual transmission, otherwise we have to
+  manage two diffrent level of resource pools*/
+
+#define WDI_MAC_ADDR_SIZE ( 6 )
+/*802.3 header definitions*/
+#define  WDI_802_3_HEADER_LEN             14
+/* Offset of DA field in a 802.3 header*/
+#define  WDI_802_3_HEADER_DA_OFFSET        0
+/*802.11 header definitions - header len without QOS ctrl field*/
+#define  WDI_802_11_HEADER_LEN            24
+/*802.11 header length + QOS ctrl field*/
+#define  WDI_MPDU_HEADER_LEN              26
+/*802.11 header definitions*/
+#define  WDI_802_11_MAX_HEADER_LEN        40
+/*802.11 header definitions - qos ctrl field len*/
+#define  WDI_802_11_HEADER_QOS_CTL         2
+/*802.11 ADDR4 MAC addr field len */
+#define  WDI_802_11_HEADER_ADDR4_LEN       WDI_MAC_ADDR_SIZE
+
+
+
+
+
+typedef enum
+{
+   DTI_TRACE_LEVEL_FATAL,
+   DTI_TRACE_LEVEL_ERROR,
+   DTI_TRACE_LEVEL_WARN,
+   DTI_TRACE_LEVEL_INFO
+
+} DTI_TRACE_LEVEL;
+
+WPT_STATIC WPT_INLINE void DTI_TRACE ( DTI_TRACE_LEVEL level, ...) { };
+
+/* !!! MAX NUM STA is not identified yet, 16 is correct value,
+   but need to get from correct common def
+   This should be identified ASAP */
+#define WDI_DS_MAX_STA_ID 16
+
+/* !!! MAX NUM SUPPORTED BSS is not identified yet, 2 is correct value,
+    but need to get from correct common def
+   This should be identified ASAP */
+#define WDI_DS_MAX_SUPPORTED_BSS   2
+
+#define WDI_DS_INDEX_INVALID       0xFF
+
+/* Mem Pool resorce count per STA data type */
+typedef struct {
+  wpt_uint8    validIdx;
+  wpt_uint8    STAIndex;
+  wpt_uint32   numChunkReservedBySTA;
+  /* Mutex, is not needed for counter operation
+     since all TX Data frame operations will happen only TX thread
+     All of the TX data frame operations are serialized, no pre-emption will happen
+     This is just for place holder */
+  wpt_mutex    resourceCountLock;
+} WDI_DS_BdMemPoolSTAType;
+
+typedef struct {
+  void *pVirtBaseAddress;
+  void *pPhysBaseAddress;
+  wpt_uint32 poolSize;
+  wpt_uint32 numChunks;
+  wpt_uint32 chunkSize;
+  wpt_uint32* AllocationBitmap;
+  WDI_DS_BdMemPoolSTAType numChunkSTA[WDI_DS_MAX_STA_ID + 1];
+} WDI_DS_BdMemPoolType;
+
+/* STA index associated with BSS index data type */
+typedef struct
+{
+   wpt_uint8   isUsed;
+   wpt_uint8   bssIdx;
+   wpt_uint8   staIdx;
+} WDI_DS_staIdxPerBssIdxType;
+
+WDI_Status WDI_DS_MemPoolCreate(WDI_DS_BdMemPoolType *memPool, wpt_uint8 chunkSize, wpt_uint8 numChunks);
+void *WDI_DS_MemPoolAlloc(WDI_DS_BdMemPoolType *memPool, void **pPhysAddress, WDI_ResPoolType wdiResPool);
+void  WDI_DS_MemPoolFree(WDI_DS_BdMemPoolType *memPool, void *pVirtAddress, void *pPhysAddress);
+void WDI_DS_MemPoolDestroy(WDI_DS_BdMemPoolType *memPool);
+
+typedef struct
+{
+  void                            *pcontext;
+  void                            *pCallbackContext;
+  wpt_uint8                        suspend;
+  WDI_DS_BdMemPoolType             mgmtMemPool;
+  WDI_DS_BdMemPoolType             dataMemPool;
+  WDI_DS_RxPacketCallback          receiveFrameCB;
+  WDI_DS_TxCompleteCallback        txCompleteCB;
+  WDI_DS_TxFlowControlCallback     txResourceCB;
+  WDI_DS_staIdxPerBssIdxType       staIdxPerBssIdxTable[WDI_DS_MAX_SUPPORTED_BSS];
+} WDI_DS_ClientDataType;
+
+WPT_STATIC WPT_INLINE void WDI_GetBDPointers(wpt_packet *pFrame, void **pVirt, void **pPhys)
+{
+  *pVirt = WPAL_PACKET_GET_BD_POINTER(pFrame);
+  *pPhys = WPAL_PACKET_GET_BD_PHYS(pFrame);
+}
+
+
+WPT_STATIC WPT_INLINE void WDI_SetBDPointers(wpt_packet *pFrame, void *pVirt, void *pPhys)
+{
+  WPAL_PACKET_SET_BD_POINTER(pFrame, pVirt);
+  WPAL_PACKET_SET_BD_PHYS(pFrame, pPhys);
+}
+
+
+void
+WDI_DS_PrepareBDHeader (
+  wpt_packet*     palPacket,
+  wpt_uint8      ucDisableHWFrmXtl,
+  wpt_uint8       alignment
+);
+
+/**
+ @brief Returns the available number of resources (BD headers)
+        available for TX
+
+ @param  pMemPool:         pointer to the BD memory pool
+
+ @see
+ @return Result of the function call
+*/
+wpt_uint32 WDI_DS_GetAvailableResCount(WDI_DS_BdMemPoolType *pMemPool);
+
+/**
+ @brief WDI_DS_GetreservedResCountPerSTA
+        Returns the Reserved number of resources (BD headers)
+        available for TX
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+
+ @see
+ @return Result of the function call
+*/
+wpt_uint32 WDI_DS_MemPoolGetRsvdResCountPerSTA(WDI_DS_BdMemPoolType *pMemPool, wpt_uint8  staId);
+
+/**
+ @brief WDI_DS_MemPoolAddSTA
+        Add NEW STA into mempool
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_DS_MemPoolAddSTA(WDI_DS_BdMemPoolType *memPool, wpt_uint8 staIndex);
+
+/**
+ @brief WDI_DS_MemPoolAddSTA
+        Remove STA from mempool
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_DS_MemPoolDelSTA(WDI_DS_BdMemPoolType *memPool, wpt_uint8 staIndex);
+
+/**
+ @brief Increase reserved TX resource count by specific STA
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+ @see
+ @return Result of the function call
+*/
+void WDI_DS_MemPoolIncreaseReserveCount(WDI_DS_BdMemPoolType *memPool, wpt_uint8  staId);
+
+/**
+ @brief Decrease reserved TX resource count by specific STA
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+ @see
+ @return Result of the function call
+*/
+void WDI_DS_MemPoolDecreaseReserveCount(WDI_DS_BdMemPoolType *memPool, wpt_uint8  staId);
+#endif
diff --git a/CORE/WDI/DP/src/wlan_qct_wdi_bd.c b/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
new file mode 100644
index 0000000..b21d305
--- /dev/null
+++ b/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
@@ -0,0 +1,385 @@
+/*
+ * 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  wlan_qct_dti_bd.c
+ *
+ *       \brief Datapath utilities file.
+ *
+ * WLAN Device Abstraction layer External API for Dataservice
+ * DESCRIPTION
+ *  This file contains the external API implemntation exposed by the
+ *   wlan device abstarction layer module.
+ *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
+ */
+
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_qct_wdi_ds_i.h"
+#include "wlan_qct_wdi_dts.h"
+#include "wlan_qct_wdi_dp.h"
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_packet.h"
+
+
+
+/*==========================================================================
+ *
+ FUNCTION    WDI_DS_PrepareBDHeader
+
+ DESCRIPTION
+ function for preparing BD header before HAL processing.
+
+ PARAMETERS
+
+ IN
+palPacket:     PAL packet pointer
+
+
+RETURN VALUE
+No return.
+
+SIDE EFFECTS
+
+============================================================================*/
+void
+WDI_DS_PrepareBDHeader (wpt_packet* palPacket,
+                        wpt_uint8 ucDisableHWFrmXtl, wpt_uint8 alignment)
+{
+  void*          pvBDHeader;
+  wpt_uint8      ucHeaderOffset;
+  wpt_uint8      ucHeaderLen;
+  wpt_uint8      ucQosEnabled;
+  wpt_uint8      ucWDSEnabled;
+  wpt_uint32     ucMpduLen;
+  wpt_uint32     ucPktLen;
+  WDI_DS_TxMetaInfoType     *pTxMetadata;
+
+
+  /* Extract reuqired information from Metadata */
+  pvBDHeader = WPAL_PACKET_GET_BD_POINTER(palPacket);
+  pTxMetadata = WDI_DS_ExtractTxMetaData(palPacket);
+  ucQosEnabled = pTxMetadata->qosEnabled;
+  ucWDSEnabled = pTxMetadata->fenableWDS;
+
+  WPAL_PACKET_SET_BD_LENGTH(palPacket, WDI_TX_BD_HEADER_SIZE);
+
+  /*---------------------------------------------------------------------
+    Fill MPDU info fields:
+    - MPDU data start offset
+    - MPDU header start offset
+    - MPDU header length
+    - MPDU length - this is a 16b field - needs swapping
+    --------------------------------------------------------------------*/
+
+  if ( ucDisableHWFrmXtl ) {
+    ucHeaderOffset = WDI_TX_BD_HEADER_SIZE;
+    ucHeaderLen = WDI_802_11_HEADER_LEN;
+    if ( 0 != ucQosEnabled ) {
+      ucHeaderLen += WDI_802_11_HEADER_QOS_CTL;
+    }
+    if ( 0 != ucWDSEnabled) {
+      ucHeaderLen    += WDI_802_11_HEADER_ADDR4_LEN;
+    }
+  } else {
+    ucHeaderOffset = WDI_TX_BD_HEADER_SIZE+WDI_802_11_MAX_HEADER_LEN;
+    ucHeaderLen = WDI_802_3_HEADER_LEN;
+  }
+
+  WDI_TX_BD_SET_MPDU_HEADER_LEN( pvBDHeader, ucHeaderLen);
+  WDI_TX_BD_SET_MPDU_HEADER_OFFSET( pvBDHeader, ucHeaderOffset);
+  WDI_TX_BD_SET_MPDU_DATA_OFFSET( pvBDHeader,
+      ucHeaderOffset + ucHeaderLen + alignment);
+
+  // pkt length from PAL API. Need to change in case of HW FT used
+  ucPktLen  = wpalPacketGetLength( palPacket ); // This includes BD length
+  /** This is the length (in number of bytes) of the entire MPDU
+      (header and data). Note that the length INCLUDES FCS field. */
+  ucMpduLen = ucPktLen - WPAL_PACKET_GET_BD_LENGTH( palPacket );
+  WDI_TX_BD_SET_MPDU_LEN( pvBDHeader, ucMpduLen );
+
+  DTI_TRACE(  DTI_TRACE_LEVEL_INFO,
+      "WLAN DTI: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
+      ucHeaderLen, ucHeaderOffset,
+      (ucHeaderOffset + ucHeaderLen + alignment),
+      pTxMetadata->fPktlen, alignment);
+
+}/* WDI_DS_PrepareBDHeader */
+
+/*==========================================================================
+ *
+ FUNCTIONS    WDI_DS_MemPoolXXX
+
+ DESCRIPTION
+  APIs for managing the BD header memory pool
+ PARAMETERS
+
+ IN
+WDI_DS_BdMemPoolType:     Memory pool pointer
+
+
+
+============================================================================*/
+
+/*
+ * Create a memory pool which is DMA capabale
+ */
+WDI_Status WDI_DS_MemPoolCreate(WDI_DS_BdMemPoolType *memPool, wpt_uint8 chunkSize,
+                                                                  wpt_uint8 numChunks)
+{
+  wpt_uint8 staLoop;
+
+  //Allocate all the max size and align them to a double word boundary. The first 8 bytes are control bytes.
+  memPool->numChunks = 0;
+  memPool->chunkSize = chunkSize + 16 - (chunkSize%8);
+  memPool->pVirtBaseAddress = wpalDmaMemoryAllocate((numChunks * memPool->chunkSize),
+          &(memPool->pPhysBaseAddress));
+
+  if( memPool->pVirtBaseAddress == 0)
+    return WDI_STATUS_E_FAILURE;
+
+  memPool->AllocationBitmap = (wpt_uint32*)wpalMemoryAllocate( (numChunks/32 + 1) * sizeof(wpt_uint32));
+  if( NULL == memPool->AllocationBitmap)
+     return WDI_STATUS_E_FAILURE;
+  wpalMemoryZero(memPool->AllocationBitmap, (numChunks/32+1)*sizeof(wpt_uint32));
+
+  //Initialize resource infor per STA
+  for(staLoop = 0; staLoop < WDI_DS_MAX_STA_ID; staLoop++)
+  {
+    memPool->numChunkSTA[staLoop].STAIndex = 0xFF;
+    memPool->numChunkSTA[staLoop].numChunkReservedBySTA = 0;
+    memPool->numChunkSTA[staLoop].validIdx = 0;
+  }
+
+  return WDI_STATUS_SUCCESS;
+}
+
+/*
+ * Destroy the memory pool
+ */
+void WDI_DS_MemPoolDestroy(WDI_DS_BdMemPoolType *memPool)
+{
+  //Allocate all the max size.
+  wpalDmaMemoryFree(memPool->pVirtBaseAddress);
+  wpalMemoryFree(memPool->AllocationBitmap);
+  wpalMemoryZero(memPool, sizeof(*memPool));
+}
+/*
+ * Allocate chunk memory
+ */
+WPT_STATIC WPT_INLINE int find_leading_zero_and_setbit(wpt_uint32 *bitmap, wpt_uint32 maxNumPool)
+{
+  wpt_uint32 i,j, word;
+
+  for(i=0; i < (maxNumPool/32 + 1); i++){
+    j = 0;
+    word = bitmap[i];
+    for(j=0; j< 32; j++){
+      if((word & 1) == 0) {
+        bitmap[i] |= (1 << j);
+        return((i<<5) + j);
+      }
+      word >>= 1;
+    }
+  }
+  return -1;
+}
+
+void *WDI_DS_MemPoolAlloc(WDI_DS_BdMemPoolType *memPool, void **pPhysAddress,
+                               WDI_ResPoolType wdiResPool)
+{
+  wpt_uint32 index;
+  void *pVirtAddress;
+  wpt_uint32 maxNumPool;
+  switch(wdiResPool)
+  {
+    case WDI_MGMT_POOL_ID:
+      maxNumPool = WDI_DS_HI_PRI_RES_NUM;
+      break;
+    case WDI_DATA_POOL_ID:
+       maxNumPool = WDI_DS_LO_PRI_RES_NUM;
+      break;
+    default:
+      return NULL;
+  }
+
+  if(maxNumPool == memPool->numChunks)
+  {
+     return NULL;
+  }
+  //Find the leading 0 in the allocation bitmap
+
+  if((index = find_leading_zero_and_setbit(memPool->AllocationBitmap, maxNumPool)) == -1)
+  {
+     //DbgBreakPoint();
+     DTI_TRACE(  DTI_TRACE_LEVEL_INFO, "WDI_DS_MemPoolAlloc: index:%d(NULL), numChunks:%d",
+                  index, memPool->numChunks );
+     return NULL;
+  }
+  memPool->numChunks++;
+  // The first 8 bytes are reserved for internal use for control bits and hash.
+  pVirtAddress  = (wpt_uint8 *)memPool->pVirtBaseAddress + (memPool->chunkSize * index) + 8;
+  *pPhysAddress = (wpt_uint8 *)memPool->pPhysBaseAddress + (memPool->chunkSize * index) + 8;
+
+  DTI_TRACE(  DTI_TRACE_LEVEL_INFO, "WDI_DS_MemPoolAlloc: index:%d, numChunks:%d", index, memPool->numChunks );
+
+  return pVirtAddress;
+
+}
+
+/*
+ * Free chunk memory
+ */
+void  WDI_DS_MemPoolFree(WDI_DS_BdMemPoolType *memPool, void *pVirtAddress, void *pPhysAddress)
+{
+  wpt_uint32 index =
+    ((wpt_uint8 *)pVirtAddress - (wpt_uint8 *)memPool->pVirtBaseAddress - 8)/memPool->chunkSize;
+  wpt_uint32 word = memPool->AllocationBitmap[index/32];
+  word &= ~(1<<(index%32));
+  memPool->AllocationBitmap[index/32] = word;
+  memPool->numChunks--;
+
+  //DbgPrint( "WDI_DS_MemPoolFree: index:%d, numChunks:%d", index, memPool->numChunks );
+}
+
+
+/**
+ @brief Returns the available number of resources (BD headers)
+        available for TX
+
+ @param  pMemPool:         pointer to the BD memory pool
+
+ @see
+ @return Result of the function call
+*/
+wpt_uint32 WDI_DS_GetAvailableResCount(WDI_DS_BdMemPoolType *pMemPool)
+{
+  return pMemPool->numChunks;
+}
+
+/**
+ @brief WDI_DS_MemPoolAddSTA
+        Add NEW STA into mempool
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_DS_MemPoolAddSTA(WDI_DS_BdMemPoolType *memPool, wpt_uint8 staIndex)
+{
+  if(memPool->numChunkSTA[staIndex].STAIndex != 0xFF)
+  {
+    /* Already using this slot? Do nothing */
+    return WDI_STATUS_SUCCESS;
+  }
+
+  memPool->numChunkSTA[staIndex].STAIndex = staIndex;
+  memPool->numChunkSTA[staIndex].numChunkReservedBySTA = 0;
+  memPool->numChunkSTA[staIndex].validIdx = 1;
+  return WDI_STATUS_SUCCESS;
+}
+
+/**
+ @brief WDI_DS_MemPoolAddSTA
+        Remove STA from mempool
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_DS_MemPoolDelSTA(WDI_DS_BdMemPoolType *memPool, wpt_uint8 staIndex)
+{
+  if(memPool->numChunkSTA[staIndex].STAIndex == 0xFF)
+  {
+    /* Empty this slot? error, bad argument */
+      return WDI_STATUS_E_FAILURE;
+  }
+
+  memPool->numChunkSTA[staIndex].STAIndex = 0xFF;
+  memPool->numChunkSTA[staIndex].numChunkReservedBySTA = 0;
+  memPool->numChunkSTA[staIndex].validIdx = 0;
+  return WDI_STATUS_SUCCESS;
+}
+
+/**
+ @brief Returns the reserved number of resources (BD headers) per STA
+        available for TX
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+ @see
+ @return Result of the function call
+*/
+wpt_uint32 WDI_DS_MemPoolGetRsvdResCountPerSTA(WDI_DS_BdMemPoolType *pMemPool, wpt_uint8  staId)
+{
+  return pMemPool->numChunkSTA[staId].numChunkReservedBySTA;
+}
+
+/**
+ @brief Increase reserved TX resource count by specific STA
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+ @see
+ @return Result of the function call
+*/
+void WDI_DS_MemPoolIncreaseReserveCount(WDI_DS_BdMemPoolType *memPool, wpt_uint8  staId)
+{
+
+  if((memPool->numChunkSTA[staId].validIdx) && (staId < WDI_DS_MAX_STA_ID))
+  {
+    memPool->numChunkSTA[staId].numChunkReservedBySTA++;
+  }
+  return;
+}
+
+/**
+ @brief Decrease reserved TX resource count by specific STA
+
+ @param  pMemPool:         pointer to the BD memory pool
+ @param  staId             STA ID
+ @see
+ @return Result of the function call
+*/
+void WDI_DS_MemPoolDecreaseReserveCount(WDI_DS_BdMemPoolType *memPool, wpt_uint8  staId)
+{
+  if(0 == memPool->numChunkSTA[staId].numChunkReservedBySTA)
+  {
+    DTI_TRACE( DTI_TRACE_LEVEL_ERROR,
+               "SAT %d reserved resource count cannot be smaller than 0", staId );
+    return;
+  }
+
+  if((memPool->numChunkSTA[staId].validIdx) && (staId < WDI_DS_MAX_STA_ID))
+  {
+    memPool->numChunkSTA[staId].numChunkReservedBySTA--;
+  }
+  return;
+}
diff --git a/CORE/WDI/DP/src/wlan_qct_wdi_ds.c b/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
new file mode 100644
index 0000000..d472c7e
--- /dev/null
+++ b/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
@@ -0,0 +1,469 @@
+/*
+ * 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  wlan_qct_wdi_ds.c
+ *          
+ *       \brief define Dataservice API 
+ *                               
+ * WLAN Device Abstraction layer External API for Dataservice
+ * DESCRIPTION
+ *  This file contains the external API implemntation exposed by the 
+ *   wlan device abstarction layer module.
+ *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
+ */
+
+
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_wdi_i.h"
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_qct_wdi_ds_i.h"
+#include "wlan_qct_wdi_dts.h"
+#include "wlan_qct_wdi_dp.h"
+#include "wlan_qct_wdi_sta.h"
+
+
+
+
+/* DAL registration function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along 
+ *  with the callback.
+ *  pfnTxCompleteCallback:Callback function that is to be invoked to return 
+ *  packets which have been transmitted.
+ *  pfnRxPacketCallback:Callback function that is to be invoked to deliver 
+ *  packets which have been received
+ *  pfnTxFlowControlCallback:Callback function that is to be invoked to 
+ *  indicate/clear congestion. 
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+WDI_Status WDI_DS_Register( void *pContext,
+  WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
+  WDI_DS_RxPacketCallback pfnRxPacketCallback,
+  WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
+  void *pCallbackContext)
+{
+  WDI_DS_ClientDataType *pClientData;
+  wpt_uint8              bssLoop;
+
+  // Do Sanity checks
+  if (NULL == pContext ||
+      NULL == pCallbackContext ||
+      NULL == pfnTxCompleteCallback ||
+      NULL == pfnRxPacketCallback ||
+      NULL == pfnTxFlowControlCallback) {
+    return WDI_STATUS_E_FAILURE;
+  }
+
+  pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
+  if (NULL == pClientData)
+  {
+    return WDI_STATUS_MEM_FAILURE;
+  }
+
+  // Store callbacks in client structure
+  pClientData->pcontext = pContext;
+  pClientData->receiveFrameCB = pfnRxPacketCallback;
+  pClientData->txCompleteCB = pfnTxCompleteCallback;
+  pClientData->txResourceCB = pfnTxFlowControlCallback;
+  pClientData->pCallbackContext = pCallbackContext;
+
+  for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
+  {
+    pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0;
+    pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID;
+    pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID;
+  }
+  return WDI_STATUS_SUCCESS;
+}
+
+
+
+/* DAL Transmit function.
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  pFrame:Refernce to PAL frame.
+ *  more: Does the invokee have more than one packet pending?
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxPacket(void *pContext,
+  wpt_packet *pFrame,
+  wpt_boolean more)
+{
+  WDI_DS_ClientDataType *pClientData;
+  wpt_uint8      ucSwFrameTXXlation;
+  wpt_uint8      ucUP;
+  wpt_uint8      ucTypeSubtype;
+  wpt_uint8      alignment;
+  wpt_uint8      ucTxFlag;
+  wpt_uint8*     pSTAMACAddress;
+  wpt_uint8*     pAddr2MACAddress;
+  WDI_DS_TxMetaInfoType     *pTxMetadata;
+  void *physBDHeader, *pvBDHeader;
+  wpt_uint8      ucType;
+  WDI_DS_BdMemPoolType *pMemPool;
+  wpt_uint8      ucBdPoolType;
+  wpt_uint8      staId;
+
+  // Do Sanity checks
+  if (NULL == pContext)
+  {
+    return WDI_STATUS_E_FAILURE;
+  }
+
+  pClientData = (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+  if (NULL == pClientData || pClientData->suspend)
+  {
+    return WDI_STATUS_E_FAILURE;
+  }
+
+  // extract metadata from PAL packet
+  pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame);
+  ucSwFrameTXXlation = pTxMetadata->fdisableFrmXlt;
+  ucTypeSubtype = pTxMetadata->typeSubtype;
+  ucUP = pTxMetadata->fUP;
+  ucTxFlag = pTxMetadata->txFlags;
+  pSTAMACAddress = &(pTxMetadata->fSTAMACAddress[0]);
+  pAddr2MACAddress = &(pTxMetadata->addr2MACAddress[0]);
+
+  /*------------------------------------------------------------------------
+     Get type and subtype of the frame first 
+  ------------------------------------------------------------------------*/
+  ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
+  switch(ucType)
+  {
+    case WDI_MAC_DATA_FRAME:
+       pMemPool = &(pClientData->dataMemPool);
+       ucBdPoolType = WDI_DATA_POOL_ID;
+    break;
+    case WDI_MAC_MGMT_FRAME:
+       pMemPool = &(pClientData->mgmtMemPool);
+       ucBdPoolType = WDI_MGMT_POOL_ID;
+    break;
+    default:
+      return WDI_STATUS_E_FAILURE;;
+  }
+
+  // Allocate BD header from pool
+  pvBDHeader = WDI_DS_MemPoolAlloc(pMemPool, &physBDHeader, ucBdPoolType);
+  if(NULL == pvBDHeader)
+    return WDI_STATUS_E_FAILURE;
+
+  WDI_SetBDPointers(pFrame, pvBDHeader, physBDHeader);
+
+  alignment = 0;
+  WDI_DS_PrepareBDHeader(pFrame, ucSwFrameTXXlation, alignment);
+
+  if(WDI_STATUS_SUCCESS != 
+      WDI_FillTxBd( pContext, ucTypeSubtype, pSTAMACAddress, pAddr2MACAddress, 
+        &ucUP, 1, pvBDHeader, ucTxFlag /* No ACK */, 0, &staId)){
+    WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader);
+    return WDI_STATUS_E_FAILURE;
+  }
+  // Send packet to transport layer.
+  if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_TxPacket(pContext, pFrame)){
+    WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader);
+    return WDI_STATUS_E_FAILURE;
+  }  
+
+  /* resource count only for data packet */
+  if(WDI_MAC_DATA_FRAME == ucType)
+  {
+    WDI_DS_MemPoolIncreaseReserveCount(pMemPool, staId);
+  }
+  return WDI_STATUS_SUCCESS;  
+}
+ 
+ 
+/* DAL Transmit Complete function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  ucTxResReq:TX resource number required by TL
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq)
+{
+  // Do Sanity checks
+  if(NULL == pContext)
+    return WDI_STATUS_E_FAILURE;
+  
+  // Send notification to transport layer.
+  if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_CompleteTx(pContext, ucTxResReq))
+  {
+    return WDI_STATUS_E_FAILURE;
+  }  
+
+  return WDI_STATUS_SUCCESS;  
+} 
+
+/* DAL Suspend Transmit function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxSuspend(void *pContext)
+{
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+  pClientData->suspend = 1;
+
+  return WDI_STATUS_SUCCESS;  
+
+}
+
+
+/* DAL Resume Transmit function. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+
+
+WDI_Status WDI_DS_TxResume(void *pContext)
+{
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+
+  pClientData->suspend = 0;
+
+  return WDI_STATUS_SUCCESS;  
+}
+
+/* DAL Get Available Resource Count. 
+ * This is the number of free descririptor in DXE
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  wdiResPool: - identifier of resource pool
+ * Return Value: number of resources available
+ *               This is the number of free descririptor in DXE
+ *
+ */
+
+wpt_uint32 WDI_GetAvailableResCount(void *pContext,WDI_ResPoolType wdiResPool)
+{
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+
+  switch(wdiResPool)
+  {
+    case WDI_MGMT_POOL_ID:
+      return (WDI_DS_HI_PRI_RES_NUM - 2*WDI_DS_GetAvailableResCount(&pClientData->mgmtMemPool));
+    case WDI_DATA_POOL_ID:
+      return WDTS_GetFreeTxDataResNumber(pContext);
+    default:
+      return 0;
+  }
+}
+
+/* DAL Get resrved Resource Count per STA. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  wdiResPool: - identifier of resource pool
+ *  staId: STA ID
+ * Return Value: number of resources reserved per STA
+ *
+ */
+wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,WDI_ResPoolType wdiResPool, wpt_uint8 staId)
+{
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+  switch(wdiResPool)
+  {
+    case WDI_MGMT_POOL_ID:
+      return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->mgmtMemPool, staId);
+    case WDI_DATA_POOL_ID:
+      return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->dataMemPool, staId);
+    default:
+      return 0;
+  }
+}
+
+/* DAL STA info add into memPool. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  staId: STA ID
+ * Return Value: number of resources reserved per STA
+ *
+ */
+WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex)
+{
+  WDI_Status status = WDI_STATUS_SUCCESS;
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+
+  status = WDI_DS_MemPoolAddSTA(&pClientData->mgmtMemPool, staIndex);
+  if(WDI_STATUS_SUCCESS != status)
+  {
+    /* Add STA into MGMT memPool Fail */
+    return status;
+  }
+
+  status = WDI_DS_MemPoolAddSTA(&pClientData->dataMemPool, staIndex);
+  if(WDI_STATUS_SUCCESS != status)
+  {
+    /* Add STA into DATA memPool Fail */
+    return status;
+  }
+
+  return WDI_STATUS_SUCCESS; 
+}
+
+/* DAL STA info del from memPool. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  staId: STA ID
+ * Return Value: number of resources reserved per STA
+ *
+ */
+WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex)
+{
+  WDI_Status status = WDI_STATUS_SUCCESS;
+  WDI_DS_ClientDataType *pClientData =  
+    (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
+
+  status = WDI_DS_MemPoolDelSTA(&pClientData->mgmtMemPool, staIndex);
+  if(WDI_STATUS_SUCCESS != status)
+  {
+    /* Del STA from MGMT memPool Fail */
+    return status;
+  }
+  status = WDI_DS_MemPoolDelSTA(&pClientData->dataMemPool, staIndex);
+  if(WDI_STATUS_SUCCESS != status)
+  {
+    /* Del STA from DATA memPool Fail */
+    return status;
+  }
+  return WDI_STATUS_SUCCESS; 
+}
+
+/* DAL Set STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx)
+{
+  WDI_DS_ClientDataType *pClientData;
+  wpt_uint8              bssLoop;
+
+  pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
+  for (bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
+  {
+    if ((pClientData->staIdxPerBssIdxTable[bssLoop].isUsed) &&
+        (bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) &&
+        (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx))
+    {
+      return WDI_STATUS_SUCCESS;
+    }
+
+    if (0 == pClientData->staIdxPerBssIdxTable[bssLoop].isUsed)
+    {
+      pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = bssIdx;
+      pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = staIdx;
+      pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 1;
+      return WDI_STATUS_SUCCESS;
+    }
+  }
+
+  /* Could not find empty slot */
+  return WDI_STATUS_E_FAILURE;
+}
+
+/* DAL Get STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx)
+{
+  WDI_DS_ClientDataType *pClientData;
+  wpt_uint8              bssLoop;
+
+  pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
+  for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
+  {
+    if(bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx)
+    {
+      /* Found BSS index from slot */
+      *staIdx = pClientData->staIdxPerBssIdxTable[bssLoop].staIdx;
+      return WDI_STATUS_SUCCESS;
+    }
+  }
+
+  /* Could not find associated STA index with BSS index */
+  return WDI_STATUS_E_FAILURE;
+}
+
+/* DAL Clear STA index associated with BSS index. 
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along with the callback.
+ *  bssIdx: BSS index
+ *  staId: STA index associated with BSS index
+ * Return Status: Found empty slot
+ *
+ */
+WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx)
+{
+  WDI_DS_ClientDataType *pClientData;
+  wpt_uint8              bssLoop;
+
+  pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
+  for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
+  {
+    if((bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) &&
+       (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx))
+    {
+      pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID;
+      pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID;
+      pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0;
+      return WDI_STATUS_SUCCESS;
+    }
+  }
+
+  /* Could not find associated STA index with BSS index */
+  return WDI_STATUS_E_FAILURE;
+}
diff --git a/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h b/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
new file mode 100644
index 0000000..6401340
--- /dev/null
+++ b/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
@@ -0,0 +1,238 @@
+/*
+ * 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 WLAN_QCT_WDI_CTS_H
+#define WLAN_QCT_WDI_CTS_H
+
+/*===========================================================================
+
+         W L A N   C O N T R O L    T R A N S P O R T   S E R V I C E  
+                       E X T E R N A L  A P I
+                
+                   
+DESCRIPTION
+  This file contains the external API exposed by the wlan control transport
+  service module.
+  
+      
+  Copyright (c) 2008 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
+--------    ---    ----------------------------------------------------------
+08/04/10    mss     Created module.
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_pal_type.h" 
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+ #ifdef __cplusplus
+ extern "C" {
+ #endif 
+
+/*----------------------------------------------------------------------------
+ *  Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/* Control Transport Service Handle Type*/
+typedef void*  WCTS_HandleType;
+
+/*--------------------------------------------------------------------------- 
+   WCTS_NotifyEventType
+ ---------------------------------------------------------------------------*/
+typedef enum
+{
+   WCTS_EVENT_OPEN,
+   WCTS_EVENT_CLOSE,
+   WCTS_EVENT_MAX
+} WCTS_NotifyEventType;
+
+/*----------------------------------------------------------------------------
+ *   WDI callback types
+ *--------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+   WCTS_NotifyCBType
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by the control transport when it wishes to send
+   up a notification like the ones mentioned above.
+ 
+   PARAMETERS 
+
+    IN
+    wctsHandle:       handle to the control transport service 
+    wctsEvent:        the event being notified
+    wctsNotifyCBData: the callback data of the user 
+    
+  
+  RETURN VALUE 
+    None
+---------------------------------------------------------------------------*/
+typedef void (*WCTS_NotifyCBType) (WCTS_HandleType        wctsHandle, 
+                                   WCTS_NotifyEventType   wctsEvent,
+                                   void*                  wctsNotifyCBData);
+
+/*---------------------------------------------------------------------------
+   WCTS_RxMsgCBType
+ 
+   DESCRIPTION   
+ 
+   This callback is invoked by the control transport when it wishes to send
+   up a packet received over the bus. Upon return of Rx callback, the ownership
+   of the message belongs to the CT and this one is free to deallocate any
+   buffer that was used to get this message. If WDI wishes to maintain the
+   information beyond the lifetime of the call, it must make a copy of it.
+ 
+   PARAMETERS 
+
+    IN
+    wctsHandle:  handle to the control transport service 
+    pMsg:        the packet
+    uLen:        the packet length
+    wctsRxMsgCBData: the callback data of the user 
+    
+  
+  RETURN VALUE 
+    None
+---------------------------------------------------------------------------*/
+typedef void (*WCTS_RxMsgCBType) (WCTS_HandleType       wctsHandle, 
+                                  void*                 pMsg,
+                                  wpt_uint32            uLen,
+                                  void*                 wctsRxMsgCBData);
+
+/*--------------------------------------------------------------------------- 
+   WCTS Transport Callbacks holder type
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+     WCTS_NotifyCBType      wctsNotifyCB;
+     void*                  wctsNotifyCBData;
+     WCTS_RxMsgCBType       wctsRxMsgCB;
+     void*                  wctsRxMsgCBData;
+} WCTS_TransportCBsType;
+
+/*========================================================================
+ *     Function Declarations and Documentation
+ ==========================================================================*/
+/**
+ @brief     This function is used by the DAL Core to initialize the Control
+            Transport for processing. It must be called prior to calling any
+            other APIs of the Control Transport. 
+
+
+ @param szName:   unique name for the channel that is to be opened 
+         uSize:   size of the channel that must be opened (should fit the
+                  largest size of  packet that the Dal Core wishes to send)
+         wctsCBs:  a list of callbacks that the CT needs to use to send
+                  notification and messages back to DAL 
+ 
+ @see 
+ @return  A handle that must be used for further communication with the CTS. 
+         This is an opaque structure for the caller and it will be used in
+         all communications to and from the CTS. 
+
+*/
+WCTS_HandleType  
+WCTS_OpenTransport 
+( 
+  const wpt_uint8*         szName,
+  wpt_uint32               uSize,  
+  WCTS_TransportCBsType*   wctsCBs
+);
+
+/**
+ @brief    This function is used by the DAL Core to to close the
+           Control Transport when its services are no longer
+           needed. Full close notification will be receive
+           asynchronously on the notification callback
+           registered on Open
+
+
+ @param wctsHandlehandle:  received upon open
+ 
+ @see 
+ @return   0 for success
+*/
+wpt_uint32
+WCTS_CloseTransport 
+(
+  WCTS_HandleType      wctsHandle
+);
+
+/**
+ @brief    This function is used by the DAL Core to to send a 
+           message over to  the WLAN sub-system.
+ 
+           Once a buffer has been passed into the Send Message
+ API, CT takes full ownership of it and it is responsible for 
+ freeing the associated resources. (This prevents a memcpy in 
+ case of a deffered write) 
+
+ The messages transported through the CT on both RX and TX are 
+ flat memory buffers that can be accessed and manipulated 
+ through standard memory functions. 
+
+ @param wctsHandlehandle:  received upon open
+        pMsg:  the message to be sent
+        uLen: the length of the message
+
+ @see 
+ @return   0 for success
+*/
+wpt_uint32
+WCTS_SendMessage 
+(
+  WCTS_HandleType      wctsHandle,
+  void*                pMsg,
+  wpt_uint32           uLen
+);
+
+#endif /* #ifndef WLAN_QCT_WDI_CTS_H */
diff --git a/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c b/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
new file mode 100644
index 0000000..2fbf63a
--- /dev/null
+++ b/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
@@ -0,0 +1,987 @@
+/*
+ * 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.
+ */
+
+/*===========================================================================
+
+                       W L A N _ Q C T _ C T S . C
+
+  OVERVIEW:
+
+  This software unit holds the implementation of the WLAN Control Transport
+  Service Layer.
+
+  The functions externalized by this module are to be called by the DAL Core
+  that wishes to use a platform agnostic API to communicate with the WLAN SS.
+
+  DEPENDENCIES:
+
+  Are listed for each API below.
+
+
+  Copyright (c) 2010-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-02-28    jtj    Linux/Android implementation which utilizes SMD
+  2010-08-09    mss    Created module
+
+===========================================================================*/
+
+
+
+/*===========================================================================
+
+                          INCLUDE FILES FOR MODULE
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include "wlan_qct_wdi_cts.h"
+#include "wlan_qct_pal_msg.h"
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_trace.h"
+#include "wlan_qct_os_list.h"
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_wdi_i.h"
+#ifdef CONFIG_ANDROID
+#include <mach/msm_smd.h>
+#include <linux/delay.h>
+#else
+#include "msm_smd.h"
+#endif
+
+/* Global context for CTS handle, it is required to keep this 
+ * transport open during SSR shutdown */
+static WCTS_HandleType gwctsHandle;
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+/* Magic value to validate a WCTS CB (value is little endian ASCII: WCTS */
+#define WCTS_CB_MAGIC     0x53544357
+
+/* time to wait for SMD channel to open (in msecs) */
+#define WCTS_SMD_OPEN_TIMEOUT 5000
+
+/* time to wait for SMD channel to close (in msecs) */
+#define WCTS_SMD_CLOSE_TIMEOUT 5000
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+   WCTS_StateType
+ ---------------------------------------------------------------------------*/
+typedef enum
+{
+   WCTS_STATE_CLOSED,       /* Closed */
+   WCTS_STATE_OPEN_PENDING, /* Waiting for the OPEN event from SMD */
+   WCTS_STATE_OPEN,         /* Open event received from SMD */
+   WCTS_STATE_DEFERRED,     /* Write pending, SMD chennel is full */
+   WCTS_STATE_REM_CLOSED,   /* Remote end closed the SMD channel */
+   WCTS_STATE_MAX
+} WCTS_StateType;
+
+/*---------------------------------------------------------------------------
+   Control Transport Control Block Type
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+   WCTS_NotifyCBType      wctsNotifyCB;
+   void*                  wctsNotifyCBData;
+   WCTS_RxMsgCBType       wctsRxMsgCB;
+   void*                  wctsRxMsgCBData;
+   WCTS_StateType         wctsState;
+   smd_channel_t*         wctsChannel;
+   wpt_list               wctsPendingQueue;
+   wpt_uint32             wctsMagic;
+   wpt_msg                wctsOpenMsg;
+   wpt_msg                wctsDataMsg;
+   wpt_event              wctsEvent;
+} WCTS_ControlBlockType;
+
+/*---------------------------------------------------------------------------
+   WDI CTS Buffer Type
+ ---------------------------------------------------------------------------*/
+typedef struct
+{
+   /*Node for linking pending buffers into a linked list */
+   wpt_list_node          node;
+
+   /*Buffer associated with the request */
+   void*                  pBuffer;
+
+   /*Buffer Size*/
+   int                    bufferSize;
+
+} WCTS_BufferType;
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+#ifdef FEATURE_R33D
+/* R33D will not close SMD port
+ * If receive close request from WDI, just pretend as port closed,
+ * Store control block info static memory, and reuse next open */
+static WCTS_ControlBlockType  *ctsCB;
+
+/* If port open once, not try to actual open next time */
+static int                     port_open = 0;
+#endif /* FEATURE_R33D */
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+
+
+/**
+ @brief    Callback function for serializing WCTS Open
+           processing in the control context
+ @param
+
+    pMsg - pointer to the message
+
+ @see
+ @return void
+*/
+static void
+WCTS_PALOpenCallback
+(
+   wpt_msg *pMsg
+)
+{
+   WCTS_ControlBlockType*        pWCTSCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /* extract our context from the message */
+   pWCTSCb = pMsg->pContext;
+
+   /*--------------------------------------------------------------------
+     Sanity check
+     --------------------------------------------------------------------*/
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_PALOpenCallback: Invalid parameters received.");
+      return;
+   }
+
+   if (WCTS_STATE_OPEN_PENDING != pWCTSCb->wctsState) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_PALOpenCallback: Invoke from invalid state %d.",
+                 pWCTSCb->wctsState);
+      return;
+   }
+
+   /* notified registered client that the channel is open */
+   pWCTSCb->wctsState = WCTS_STATE_OPEN;
+   pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
+                        WCTS_EVENT_OPEN,
+                        pWCTSCb->wctsNotifyCBData);
+
+   /* signal event for WCTS_OpenTransport to proceed */
+   wpalEventSet(&pWCTSCb->wctsEvent);
+
+}/*WCTS_PALOpenCallback*/
+
+
+
+/**
+ @brief    Callback function for serializing WCTS Read
+           processing in the control context
+
+ @param    pWCTSCb  WCTS Control Block
+
+ @see
+ @return void
+*/
+static void
+WCTS_PALReadCallback
+(
+   WCTS_ControlBlockType*  pWCTSCb
+)
+{
+   void* buffer;
+   int packet_size;
+   int available;
+   int bytes_read;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*--------------------------------------------------------------------
+     Sanity check
+     --------------------------------------------------------------------*/
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_PALReadCallback: Invalid parameter received.");
+      return;
+   }
+
+   /* iterate until no more packets are available */
+   while (1) {
+      /* check the length of the next packet */
+      packet_size = smd_cur_packet_size(pWCTSCb->wctsChannel);
+      if (0 == packet_size) {
+         /* No more data to be read */
+         return;
+      }
+
+      /* Check how much of the data is available */
+      available = smd_read_avail(pWCTSCb->wctsChannel);
+      if (available < packet_size) {
+         /* Entire packet not yet ready to be read --
+            There will be another notification when it is ready */
+         return;
+      }
+
+      buffer = wpalMemoryAllocate(packet_size);
+      if (NULL ==  buffer) {
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "WCTS_PALReadCallback: Memory allocation failure");
+         WPAL_ASSERT(0);
+         return;
+      }
+
+      bytes_read = smd_read(pWCTSCb->wctsChannel,
+                            buffer,
+                            packet_size);
+
+      if (bytes_read != packet_size) {
+         /*Some problem, do not forward it to WDI.*/
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "WCTS_PALReadCallback: Failed to read data from SMD");
+         wpalMemoryFree(buffer);
+         WPAL_ASSERT(0);
+         return;
+      }
+
+      /* forward the message to the registered handler */
+      pWCTSCb->wctsRxMsgCB((WCTS_HandleType)pWCTSCb,
+                           buffer,
+                           packet_size,
+                           pWCTSCb->wctsRxMsgCBData);
+
+      /* Free the allocated buffer*/
+      wpalMemoryFree(buffer);
+   }
+
+} /*WCTS_PALReadCallback*/
+
+
+
+/**
+ @brief    Callback function for serializing WCTS Write
+           processing in the control context
+
+ @param    pWCTSCb  WCTS Control Block
+
+ @see
+ @return void
+*/
+static void
+WCTS_PALWriteCallback
+(
+   WCTS_ControlBlockType*  pWCTSCb
+)
+{
+   wpt_list_node*      pNode;
+   WCTS_BufferType*    pBufferQueue;
+   void*               pBuffer;
+   int                 len;
+   int                 available;
+   int                 written;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*--------------------------------------------------------------------
+     Sanity check
+     --------------------------------------------------------------------*/
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_PALWriteCallback: Invalid parameter received.");
+      return;
+   }
+
+   /* if we are not deferred, then there are no pending packets */
+   if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) {
+      return;
+   }
+
+   /* Keep sending deferred messages as long as there is room in
+      the channel.  Note that we initially peek at the head of the
+      list to access the parameters for the next message; we don't
+      actually remove the next message from the deferred list until
+      we know the channel can handle it */
+   while (eWLAN_PAL_STATUS_SUCCESS ==
+          wpal_list_peek_front(&pWCTSCb->wctsPendingQueue, &pNode)) {
+      pBufferQueue = container_of(pNode, WCTS_BufferType, node);
+      pBuffer = pBufferQueue->pBuffer;
+      len = pBufferQueue->bufferSize;
+
+      available = smd_write_avail(pWCTSCb->wctsChannel);
+      if (available < len) {
+         /* channel has no room for the next packet so we are done */
+         return;
+      }
+
+      /* there is room for the next message, so we can now remove
+         it from the deferred message queue and send it */
+      wpal_list_remove_front(&pWCTSCb->wctsPendingQueue, &pNode);
+
+      /* note that pNode will be the same as when we peeked, so
+         there is no need to update pBuffer or len */
+
+      written = smd_write(pWCTSCb->wctsChannel, pBuffer, len);
+      if (written != len) {
+         /* Something went wrong */
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "WCTS_PALWriteCallback: channel write failure");
+
+         /* we were unable to send the message that was at the head
+            of the deferred list.  there is nothing else we can do
+            other than drop it, so we will just fall through to the
+            "success" processing.
+            hopefully the client can recover from this since there is
+            nothing else we can do here */
+      }
+
+      /* whether we had success or failure, reclaim all memory */
+      wpalMemoryFree(pBuffer);
+      wpalMemoryFree(pBufferQueue);
+
+      /* we'll continue to iterate until the channel is full or all
+         of the deferred messages have been sent */
+   }
+
+   /* if we've exited the loop, then we have drained the deferred queue.
+      set the state to indicate we are no longer deferred, and turn off
+      the remote read interrupt */
+   pWCTSCb->wctsState = WCTS_STATE_OPEN;
+   smd_disable_read_intr(pWCTSCb->wctsChannel);
+
+} /*WCTS_PALWriteCallback*/
+
+
+
+/**
+ @brief    Callback function for serializing SMD DATA Event
+           processing in the control context
+ @param
+
+    pMsg - pointer to the message
+
+ @see
+ @return void
+*/
+static void
+WCTS_PALDataCallback
+(
+   wpt_msg *pMsg
+)
+{
+   WCTS_ControlBlockType*        pWCTSCb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /* extract our context from the message */
+   pWCTSCb = pMsg->pContext;
+
+   /* process any incoming messages */
+   WCTS_PALReadCallback(pWCTSCb);
+
+   /* send any deferred messages */
+   WCTS_PALWriteCallback(pWCTSCb);
+
+} /*WCTS_PALDataCallback*/
+
+/**
+ @brief    This helper function is used to clean up the pending 
+           messages in the transport queue
+
+ @param wctsHandlehandle:  transport handle
+
+ @see
+ @return   0 for success
+*/
+static wpt_uint32
+WCTS_ClearPendingQueue
+(
+   WCTS_HandleType      wctsHandle
+)
+{
+   WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) wctsHandle;
+   wpt_list_node*      pNode = NULL;
+   WCTS_BufferType*    pBufferQueue = NULL;
+   void*               pBuffer = NULL;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_ClearPendingQueue: Invalid parameters received.");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /*Free the buffers in the pending queue.*/
+   while (eWLAN_PAL_STATUS_SUCCESS ==
+          wpal_list_remove_front(&pWCTSCb->wctsPendingQueue, &pNode)) {
+      pBufferQueue = container_of(pNode, WCTS_BufferType, node);
+      pBuffer = pBufferQueue->pBuffer;
+      wpalMemoryFree(pBuffer);
+      wpalMemoryFree(pBufferQueue);
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+
+}/*WCTS_ClearPendingQueue*/
+
+
+/**
+ * Notification callback when SMD needs to communicate asynchronously with
+ * the client.
+ *
+ * This callback function may be called from interrupt context; clients must
+ * not block or call any functions that block.
+ *
+ * @param[in] data   The user-supplied data provided to smd_named_open_on_edge()
+ * @param[in] event  The event that occurred
+ *
+ * @return void
+ */
+
+static void
+WCTS_NotifyCallback
+(
+   void            *data,
+   unsigned        event
+)
+{
+   wpt_msg                       *palMsg;
+   WCTS_ControlBlockType*        pWCTSCb = (WCTS_ControlBlockType*) data;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*--------------------------------------------------------------------
+     Sanity check
+     --------------------------------------------------------------------*/
+   if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Received unexpected SMD event %u",
+                 __FUNCTION__, event);
+
+      /* TODO_PRIMA what error recovery options do we have? */
+      return;
+   }
+
+   /* Serialize processing in the control thread */
+   switch (event) {
+   case SMD_EVENT_OPEN:
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_OPEN from SMD", __FUNCTION__);
+      /* If the prev state was 'remote closed' then it is a Riva 'restart',
+       * subsystem restart re-init
+       */
+      if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState)
+      {
+           WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_OPEN in WCTS_STATE_REM_CLOSED state",
+                 __FUNCTION__);
+           /* call subsystem restart re-init function */
+           wpalDriverReInit();
+           return;
+      }
+      palMsg = &pWCTSCb->wctsOpenMsg;
+      break;
+
+   case SMD_EVENT_DATA:
+      if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState)
+      {
+           WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: received SMD data when the state is remote closed ",
+                 __FUNCTION__);
+           /* we should not be getting any data now */
+           return;
+      }
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_DATA from SMD", __FUNCTION__);
+      palMsg = &pWCTSCb->wctsDataMsg;
+      break;
+
+   case SMD_EVENT_CLOSE:
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_CLOSE from SMD", __FUNCTION__);
+      /* SMD channel was closed from the remote side,
+       * this would happen only when Riva crashed and SMD is
+       * closing the channel on behalf of Riva */
+      pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED;
+      WCTS_ClearPendingQueue (pWCTSCb);
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_CLOSE WLAN driver going down now",
+                 __FUNCTION__);
+      /* subsystem restart: shutdown */
+      wpalDriverShutdown();
+      return;
+
+   case SMD_EVENT_STATUS:
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_STATUS from SMD", __FUNCTION__);
+      return;
+
+   case SMD_EVENT_REOPEN_READY:
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "%s: received SMD_EVENT_REOPEN_READY from SMD", __FUNCTION__);
+
+      /* unlike other events which occur when our kernel threads are
+         running, this one is received when the threads are closed and
+         the rmmod thread is waiting.  so just unblock that thread */
+      wpalEventSet(&pWCTSCb->wctsEvent);
+      return;
+
+   default:
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Unexpected event %u received from SMD",
+                 __FUNCTION__, event);
+
+      return;
+   }
+
+   /* serialize this event */
+   wpalPostCtrlMsg(WDI_GET_PAL_CTX(), palMsg);
+
+} /*WCTS_NotifyCallback*/
+
+
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+ * -------------------------------------------------------------------------*/
+
+
+/**
+ @brief     This function is used by the DAL Core to initialize the Control
+            Transport for processing. It must be called prior to calling any
+            other APIs of the Control Transport.
+
+
+ @param szName:   unique name for the channel that is to be opened
+         uSize:   size of the channel that must be opened (should fit the
+                  largest size of  packet that the Dal Core wishes to send)
+         wctsCBs:  a list of callbacks that the CT needs to use to send
+                  notification and messages back to DAL
+
+ @see
+ @return  A handle that must be used for further communication with the CTS.
+         This is an opaque structure for the caller and it will be used in
+         all communications to and from the CTS.
+
+*/
+WCTS_HandleType
+WCTS_OpenTransport
+(
+   const wpt_uint8*         szName,
+   wpt_uint32               uSize,
+   WCTS_TransportCBsType*   wctsCBs
+)
+{
+   WCTS_ControlBlockType*    pWCTSCb;
+   wpt_status                status;
+   int                       smdstatus;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
+   /*---------------------------------------------------------------------
+     Sanity check
+     ---------------------------------------------------------------------*/
+   if ((NULL == wctsCBs) || (NULL == szName) ||
+       (NULL == wctsCBs->wctsNotifyCB) || (NULL == wctsCBs->wctsRxMsgCB)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_OpenTransport: Invalid parameters received.");
+
+      return NULL;
+   }
+
+   /* This open is coming after a SSR, we don't need to reopen SMD,
+    * the SMD port was never closed during SSR*/
+   if (gwctsHandle) {
+       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+               "WCTS_OpenTransport port is already open\n");
+
+       pWCTSCb = gwctsHandle;
+       if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) {
+           WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                   "WCTS_OpenTransport: Invalid magic.");
+           return NULL;
+       }   
+       pWCTSCb->wctsState = WCTS_STATE_OPEN;
+
+       pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
+               WCTS_EVENT_OPEN,
+               pWCTSCb->wctsNotifyCBData);
+
+       /* we initially don't want read interrupts
+         (we only want them if we get into deferred write mode) */
+       smd_disable_read_intr(pWCTSCb->wctsChannel);
+
+       return (WCTS_HandleType)pWCTSCb;
+   }
+
+#ifdef FEATURE_R33D
+   if(port_open)
+   {
+      /* Port open before, not need to open again */
+      /* notified registered client that the channel is open */
+      ctsCB->wctsState = WCTS_STATE_OPEN;
+      ctsCB->wctsNotifyCB((WCTS_HandleType)ctsCB,
+                           WCTS_EVENT_OPEN,
+                           ctsCB->wctsNotifyCBData);
+      return (WCTS_HandleType)ctsCB;
+   }
+#endif /* FEATURE_R33D */
+
+   /* allocate a ControlBlock to hold all context */
+   pWCTSCb = wpalMemoryAllocate(sizeof(*pWCTSCb));
+   if (NULL == pWCTSCb) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_OpenTransport: Memory allocation failure.");
+      return NULL;
+   }
+
+   /* make sure the control block is initialized.  in particular we need
+      to make sure the embedded event and list structures are initialized
+      to prevent "magic number" tests from being run against uninitialized
+      values */
+   wpalMemoryZero(pWCTSCb, sizeof(*pWCTSCb));
+
+#ifdef FEATURE_R33D
+   smd_init(0);
+   port_open = 1;
+   ctsCB = pWCTSCb;
+#endif /* FEATURE_R33D */
+
+   /*Initialise the event*/
+   wpalEventInit(&pWCTSCb->wctsEvent);
+
+   /* save the user-supplied information */
+   pWCTSCb->wctsNotifyCB       = wctsCBs->wctsNotifyCB;
+   pWCTSCb->wctsNotifyCBData   = wctsCBs->wctsNotifyCBData;
+   pWCTSCb->wctsRxMsgCB        = wctsCBs->wctsRxMsgCB;
+   pWCTSCb->wctsRxMsgCBData    = wctsCBs->wctsRxMsgCBData;
+
+   /* initialize the remaining fields */
+   wpal_list_init(&pWCTSCb->wctsPendingQueue);
+   pWCTSCb->wctsMagic   = WCTS_CB_MAGIC;
+   pWCTSCb->wctsState   = WCTS_STATE_OPEN_PENDING;
+   pWCTSCb->wctsChannel = NULL;
+
+   /* since SMD will callback in interrupt context, we will used
+    * canned messages to serialize the SMD events into a thread
+    * context
+    */
+   pWCTSCb->wctsOpenMsg.callback = WCTS_PALOpenCallback;
+   pWCTSCb->wctsOpenMsg.pContext = pWCTSCb;
+
+   pWCTSCb->wctsDataMsg.callback = WCTS_PALDataCallback;
+   pWCTSCb->wctsDataMsg.pContext = pWCTSCb;
+
+   /*---------------------------------------------------------------------
+     Open the SMD channel
+     ---------------------------------------------------------------------*/
+
+   wpalEventReset(&pWCTSCb->wctsEvent);
+   smdstatus = smd_named_open_on_edge(szName,
+                                      SMD_APPS_WCNSS,
+                                      &pWCTSCb->wctsChannel,
+                                      pWCTSCb,
+                                      WCTS_NotifyCallback);
+   if (0 != smdstatus) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: smd_named_open_on_edge failed with status %d",
+                 __FUNCTION__, smdstatus);
+      goto fail;
+   }
+
+   /* wait for the channel to be fully opened before we proceed */
+   status = wpalEventWait(&pWCTSCb->wctsEvent, WCTS_SMD_OPEN_TIMEOUT);
+   if (eWLAN_PAL_STATUS_SUCCESS != status) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: failed to receive SMD_EVENT_OPEN",
+                 __FUNCTION__);
+      /* since we opened one end of the channel, close it */
+      smdstatus = smd_close(pWCTSCb->wctsChannel);
+      if (0 != smdstatus) {
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "%s: smd_close failed with status %d",
+                    __FUNCTION__, smdstatus);
+      }
+      goto fail;
+   }
+
+   /* we initially don't want read interrupts
+      (we only want them if we get into deferred write mode) */
+   smd_disable_read_intr(pWCTSCb->wctsChannel);
+
+   /* we have successfully opened the SMD channel */
+   gwctsHandle = pWCTSCb;
+   return (WCTS_HandleType)pWCTSCb;
+
+ fail:
+   /* we were unable to open the SMD channel */
+   pWCTSCb->wctsMagic = 0;
+   wpalMemoryFree(pWCTSCb);
+   return NULL;
+
+}/*WCTS_OpenTransport*/
+
+
+
+/**
+ @brief    This function is used by the DAL Core to close the
+           Control Transport when its services are no longer
+           needed. Full close notification will be receive
+           asynchronously on the notification callback
+           registered on Open
+
+
+ @param wctsHandlehandle:  received upon open
+
+ @see
+ @return   0 for success
+*/
+wpt_uint32
+WCTS_CloseTransport
+(
+   WCTS_HandleType      wctsHandle
+)
+{
+   WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) wctsHandle;
+   wpt_list_node*      pNode = NULL;
+   WCTS_BufferType*    pBufferQueue = NULL;
+   void*               pBuffer = NULL;
+   wpt_status          status;
+   int                 smdstatus;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_CloseTransport: Invalid parameters received.");
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+#ifdef FEATURE_R33D
+   /* Not actually close port, just pretend */
+   /* notified registered client that the channel is closed */
+   pWCTSCb->wctsState = WCTS_STATE_CLOSED;
+   pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
+                         WCTS_EVENT_CLOSE,
+                         pWCTSCb->wctsNotifyCBData);
+
+   printk(KERN_ERR "R33D Not need to close");
+   return eWLAN_PAL_STATUS_SUCCESS;
+#endif /* FEATURE_R33D */
+
+   /*Free the buffers in the pending queue.*/
+   while (eWLAN_PAL_STATUS_SUCCESS ==
+          wpal_list_remove_front(&pWCTSCb->wctsPendingQueue, &pNode)) {
+      pBufferQueue = container_of(pNode, WCTS_BufferType, node);
+      pBuffer = pBufferQueue->pBuffer;
+      wpalMemoryFree(pBuffer);
+      wpalMemoryFree(pBufferQueue);
+   }
+
+   /* Reset the state */
+   pWCTSCb->wctsState = WCTS_STATE_CLOSED;
+
+   wpalEventReset(&pWCTSCb->wctsEvent);
+   smdstatus = smd_close(pWCTSCb->wctsChannel);
+   if (0 != smdstatus) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: smd_close failed with status %d",
+                 __FUNCTION__, smdstatus);
+      /* SMD did not successfully close the channel, therefore we
+         won't receive an asynchronous close notification so don't
+         bother to wait for an event that won't come */
+
+   } else {
+      /* close command was sent -- wait for the callback to complete */
+      status = wpalEventWait(&pWCTSCb->wctsEvent, WCTS_SMD_CLOSE_TIMEOUT);
+      if (eWLAN_PAL_STATUS_SUCCESS != status) {
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "%s: failed to receive SMD_EVENT_REOPEN_READY",
+                    __FUNCTION__);
+      }
+
+      /* During the close sequence we deregistered from SMD.  As part
+         of deregistration SMD will call back into our driver with an
+         event to let us know the channel is closed.  We need to
+         insert a brief delay to allow that thread of execution to
+         exit our module.  Otherwise our module may be unloaded while
+         there is still code running within the address space, and
+         that code will crash when the memory is unmapped  */
+      msleep(50);
+   }
+
+   /* channel has (hopefully) been closed */
+   pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
+                         WCTS_EVENT_CLOSE,
+                         pWCTSCb->wctsNotifyCBData);
+
+   /* release the resource */
+   pWCTSCb->wctsMagic = 0;
+   wpalMemoryFree(pWCTSCb);
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+
+}/*WCTS_CloseTransport*/
+
+
+
+/**
+ @brief    This function is used by the DAL Core to to send a
+           message over to the WLAN sub-system.
+
+           Once a buffer has been passed into the Send Message
+ API, CT takes full ownership of it and it is responsible for
+ freeing the associated resources. (This prevents a memcpy in
+ case of a deferred write)
+
+ The messages transported through the CT on both RX and TX are
+ flat memory buffers that can be accessed and manipulated
+ through standard memory functions.
+
+ @param wctsHandlehandle:  received upon open
+        pMsg:  the message to be sent
+        uLen: the length of the message
+
+ @see
+ @return   0 for success
+*/
+wpt_uint32
+WCTS_SendMessage
+(
+   WCTS_HandleType      wctsHandle,
+   void*                pMsg,
+   wpt_uint32           uLen
+)
+{
+   WCTS_ControlBlockType*    pWCTSCb = (WCTS_ControlBlockType*) wctsHandle;
+   WCTS_BufferType*          pBufferQueue;
+   int                       len;
+   int                       written = 0;
+   int                       available;
+
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /*--------------------------------------------------------------------
+     Sanity check
+     --------------------------------------------------------------------*/
+   if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) ||
+       (NULL == pMsg) || (0 == uLen) || (0x7fffffff < uLen)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_SendMessage: Invalid parameters received.");
+      WPAL_ASSERT(0);
+      if (NULL != pMsg) {
+         wpalMemoryFree(pMsg);
+      }
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /* the SMD API uses int instead of uint, so change types here */
+   len = (int)uLen;
+
+   if (WCTS_STATE_OPEN == pWCTSCb->wctsState) {
+      available = smd_write_avail(pWCTSCb->wctsChannel);
+      if (available >= len) {
+         written = smd_write(pWCTSCb->wctsChannel, pMsg, len);
+      }
+   } else if (WCTS_STATE_DEFERRED == pWCTSCb->wctsState) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+                 "WCTS_SendMessage: FIFO space not available, the packets will be queued");
+   } else {
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_SendMessage: Channel in illegal state [%d].",
+                 pWCTSCb->wctsState);
+      /* force following logic to reclaim the buffer */
+      written = -1;
+   }
+
+   if (-1 == written) {
+      /*Something wrong*/
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "WCTS_SendMessage: Failed to send message over the bus.");
+      wpalMemoryFree(pMsg);
+      WPAL_ASSERT(0);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   } else if (written == len) {
+      /* Message sent! No deferred state, free the buffer*/
+      wpalMemoryFree(pMsg);
+   } else {
+      /* This much data cannot be written at this time,
+         queue the rest of the data for later*/
+      pBufferQueue = wpalMemoryAllocate(sizeof(WCTS_BufferType));
+      if (NULL == pBufferQueue) {
+         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "WCTS_SendMessage: Cannot allocate memory for queuing the buffer");
+         wpalMemoryFree(pMsg);
+         WPAL_ASSERT(0);
+         return eWLAN_PAL_STATUS_E_NOMEM;
+      }
+
+      pBufferQueue->bufferSize = len;
+      pBufferQueue->pBuffer = pMsg;
+      wpal_list_insert_back(&pWCTSCb->wctsPendingQueue, &pBufferQueue->node);
+
+      /* if we are not already in the deferred state, then transition
+         to that state.  when we do so, we enable the remote read
+         interrupt so that we'll be notified when messages are read
+         from the remote end */
+      if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) {
+
+         /* Mark the state as deferred.
+            Later: We may need to protect wctsState by locks*/
+         pWCTSCb->wctsState = WCTS_STATE_DEFERRED;
+
+         smd_enable_read_intr(pWCTSCb->wctsChannel);
+      }
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+
+}/*WCTS_SendMessage*/
diff --git a/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h b/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
new file mode 100644
index 0000000..c459fa4
--- /dev/null
+++ b/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
@@ -0,0 +1,209 @@
+/*
+ * 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 __WLAN_QCT_DTS_H
+#define __WLAN_QCT_DTS_H
+/**=========================================================================
+ *     
+ *       \file  wlan_qct_wdi_dts.h
+ *          
+ *       \brief define Datas Trnasport Service API 
+ *                               
+ * WLAN Device Abstraction layer interface for Transport drivers (SDIO/DXE)
+ * DESCRIPTION
+ * This file contains the API exposed by the 
+ * wlan device abstarction layer module for abstracting DXE/SDIO.
+ *
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
+ *
+ * Example usage for DXE.
+ * ----------------------
+ * On Platform init
+ *         DAL  will then invoke WDTS_open
+ *
+ * On DAL init
+ *     DAL will invike WDTS_start
+ *
+ * On transmit:
+ *         DAL will invoke WDTS_TxPacket API
+ * 
+ * On transmit complete:
+ *         DXE will serialize into TX thread
+ *         In TX thread it will invoke
+ *
+ * On receive:
+ *        DXE will serialize into RX thread
+ *        In TX thread it will invoke WDTS_RXPacket API 
+ *
+ * On DXE ring full:
+ *        DXE will serialize into TX thread
+ *        In TX thread it will invoke WDTS_OOResourceNotification API 
+ */
+
+typedef enum
+{
+   WDTS_CHANNEL_TX_LOW_PRI,
+   WDTS_CHANNEL_TX_HIGH_PRI,
+   WDTS_CHANNEL_RX_LOW_PRI,
+   WDTS_CHANNEL_RX_HIGH_PRI,
+   WDTS_CHANNEL_MAX
+}  WDTS_ChannelType;
+
+typedef enum
+{
+   WDTS_POWER_STATE_FULL,
+   WDTS_POWER_STATE_IMPS,
+   WDTS_POWER_STATE_BMPS,
+   WDTS_POWER_STATE_DOWN,
+   WDTS_POWER_STATE_MAX
+} WDTS_PowerStateType;
+
+
+typedef wpt_status (*WDTS_TxCompleteCbType)(void *pContext, wpt_packet *pFrame, wpt_status status);
+typedef wpt_status (*WDTS_RxFrameReadyCbType) (void *pContext, wpt_packet *pFrame, WDTS_ChannelType channel);
+typedef wpt_status (*WDTS_LowResourceCbType)(void *pContext, WDTS_ChannelType channel, wpt_boolean on);
+typedef void  (*WDTS_SetPSCbType)(wpt_status  status, unsigned int dxePhyAddr);
+/* DTS Set power state ACK callback. 
+ * This callback function should be invoked by the DTS to notify WDI that set
+ * power state request is complete.
+ * Parameters:
+ * status: status of the set operation
+ * pUserData:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: None.
+ *
+ */
+typedef void  (*WDTS_SetPowerStateCbType)(wpt_status   status,
+                                          unsigned int dxePhyAddr,
+                                          void*        pUserData);
+
+typedef struct {
+  void * (*open)(void);
+  wpt_status (*start) (void *pContext);
+  wpt_status (*register_client)(void *pContext, WDTS_RxFrameReadyCbType, 
+      WDTS_TxCompleteCbType, WDTS_LowResourceCbType, void *clientData);
+  wpt_status (*xmit) (void *pContext, wpt_packet *packet, WDTS_ChannelType channel);
+  wpt_status (*txComplete) (void *pContext, wpt_uint32 ucTxResReq);
+  wpt_status (*setPowerState) (void *pContext, WDTS_PowerStateType   powerState, 
+                               WDTS_SetPSCbType cBack);
+  wpt_status (*stop) (void *pContext);
+  wpt_status (*close) (void *pContext);
+  wpt_uint32 (*getFreeTxDataResNumber) (void *pContext);
+} WDTS_TransportDriverTrype;
+
+typedef struct {
+   WDTS_SetPowerStateCbType cback;
+   void*        pUserData;
+} WDTS_SetPowerStateCbInfoType;
+
+/* DTS open  function. 
+ * On open the transport device should initialize itself.
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along 
+ *  with the callback.
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ 
+ */
+wpt_status WDTS_openTransport( void *pContext);
+
+
+
+
+/* DTS start  function. 
+ * On start the transport device should start running.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along 
+ * with the callback.
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_startTransport( void *pContext);
+
+
+
+
+/* DTS Tx packet function. 
+ * This function should be invoked by the DAL Dataservice to schedule transmit frame through DXE/SDIO.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * pFrame:Refernce to PAL frame.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_TxPacket(void *pContext, wpt_packet *pFrame);
+
+/* DTS Tx Complete function. 
+ * This function should be invoked by the DAL Dataservice to notify tx completion to DXE/SDIO.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * ucTxResReq:TX resource number required by TL
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_CompleteTx(void *pContext, wpt_uint32 ucTxResReq);
+
+/* DTS Set power state function. 
+ * This function should be invoked by the DAL to notify the WLAN device power state.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * powerState:Power state of the WLAN device.
+ * Return Value: SUCCESS  Set successfully in DXE control blk.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_SetPowerState(void *pContext, WDTS_PowerStateType powerState,
+                              WDTS_SetPowerStateCbType cback);
+
+/* DTS Stop function. 
+ * Stop Transport driver, ie DXE, SDIO
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_Stop(void *pContext);
+
+/* DTS Close function. 
+ * Close Transport driver, ie DXE, SDIO
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_Close(void *pContext);
+
+/* Get free TX data descriptor number from DXE
+ * Parameters:
+ * pContext: Cookie that should be passed back to the caller along with the callback.
+ * Return Value: number of free descriptors for TX data channel
+ *
+ */
+wpt_uint32 WDTS_GetFreeTxDataResNumber(void *pContext);
+
+#endif
diff --git a/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
new file mode 100644
index 0000000..3ca56fb
--- /dev/null
+++ b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
@@ -0,0 +1,618 @@
+/*
+ * 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  wlan_qct_wdi_dts.c
+ *          
+ *       \brief  Data Transport Service API 
+ *                               
+ * WLAN Device Abstraction layer External API for Dataservice
+ * DESCRIPTION
+ *  This file contains the external API implemntation exposed by the 
+ *   wlan device abstarction layer module.
+ *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
+ */
+
+
+#include "wlan_qct_wdi.h"
+#include "wlan_qct_dxe.h"
+#include "wlan_qct_wdi_ds.h"
+#include "wlan_qct_wdi_ds_i.h"
+#include "wlan_qct_wdi_dts.h"
+#include "wlan_qct_wdi_dp.h"
+#include "wlan_qct_wdi_sta.h"
+
+static WDTS_TransportDriverTrype gTransportDriver = {
+  WLANDXE_Open, 
+  WLANDXE_Start, 
+  WLANDXE_ClientRegistration, 
+  WLANDXE_TxFrame,
+  WLANDXE_CompleteTX,
+  WLANDXE_SetPowerState,
+  WLANDXE_Stop,
+  WLANDXE_Close,
+  WLANDXE_GetFreeTxDataResNumber
+};
+
+static WDTS_SetPowerStateCbInfoType gSetPowerStateCbInfo;
+
+/* DTS Tx packet complete function. 
+ * This function should be invoked by the transport device to indicate 
+ * transmit complete for a frame.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller 
+ * pFrame:Refernce to PAL frame.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_TxPacketComplete(void *pContext, wpt_packet *pFrame, wpt_status status)
+{
+  WDI_DS_ClientDataType *pClientData = (WDI_DS_ClientDataType*)(pContext);
+  WDI_DS_TxMetaInfoType     *pTxMetadata;
+  void *pvBDHeader, *physBDHeader;
+  wpt_uint8 staIndex;
+
+  // Do Sanity checks
+  if(NULL == pContext || NULL == pFrame){
+    return eWLAN_PAL_STATUS_E_FAILURE;
+  }
+
+
+  // extract metadata from PAL packet
+  pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame);
+  pTxMetadata->txCompleteStatus = status;
+
+  // Free BD header from pool
+  WDI_GetBDPointers(pFrame, &pvBDHeader,  &physBDHeader);
+  switch(pTxMetadata->frmType) 
+  {
+    case WDI_MAC_DATA_FRAME:
+      /* SWAP BD header to get STA index for completed frame */
+      WDI_SwapTxBd(pvBDHeader);
+      staIndex = (wpt_uint8)WDI_TX_BD_GET_STA_ID(pvBDHeader);
+      WDI_DS_MemPoolFree(&(pClientData->dataMemPool), pvBDHeader, physBDHeader);
+      WDI_DS_MemPoolDecreaseReserveCount(&(pClientData->dataMemPool), staIndex);
+      break;
+    case WDI_MAC_MGMT_FRAME:
+      WDI_DS_MemPoolFree(&(pClientData->mgmtMemPool), pvBDHeader, physBDHeader);
+      break;
+  }
+  WDI_SetBDPointers(pFrame, 0, 0);
+
+  // Invoke Tx complete callback
+  pClientData->txCompleteCB(pClientData->pCallbackContext, pFrame);  
+  return eWLAN_PAL_STATUS_SUCCESS;
+
+}
+
+
+/*===============================================================================
+  FUNCTION      WLANTL_GetReplayCounterFromRxBD
+     
+  DESCRIPTION   This function extracts 48-bit replay packet number from RX BD 
+ 
+  DEPENDENCIES  Validity of replay check must be done before the function 
+                is called
+                          
+  PARAMETERS    pucRxHeader pointer to RX BD header
+                                       
+  RETRUN        v_U64_t    Packet number extarcted from RX BD
+
+  SIDE EFFECTS   none
+ ===============================================================================*/
+v_U64_t
+WDTS_GetReplayCounterFromRxBD
+(
+   v_U8_t *pucRxBDHeader
+)
+{
+  v_U64_t ullcurrentReplayCounter = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* 48-bit replay counter is created as follows
+   from RX BD 6 byte PMI command:
+   Addr : AES/TKIP
+   0x38 : pn3/tsc3
+   0x39 : pn2/tsc2
+   0x3a : pn1/tsc1
+   0x3b : pn0/tsc0
+
+   0x3c : pn5/tsc5
+   0x3d : pn4/tsc4 */
+  
+#ifdef ANI_BIG_BYTE_ENDIAN
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = WDI_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    ullcurrentReplayCounter <<= 16;
+    ullcurrentReplayCounter |= (( WDI_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
+    return ullcurrentReplayCounter;
+#else
+    /* Getting 48-bit replay counter from the RX BD */
+    ullcurrentReplayCounter = (WDI_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF); 
+    ullcurrentReplayCounter <<= 32; 
+    ullcurrentReplayCounter |= WDI_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); 
+    return ullcurrentReplayCounter;
+#endif
+}
+
+
+/* DTS Rx packet function. 
+ * This function should be invoked by the transport device to indicate 
+ * reception of a frame.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller 
+ * pFrame:Refernce to PAL frame.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_RxPacket (void *pContext, wpt_packet *pFrame, WDTS_ChannelType channel)
+{
+  WDI_DS_ClientDataType *pClientData = 
+    (WDI_DS_ClientDataType*)(pContext);
+  wpt_boolean       bASF, bFSF, bLSF, bAEF;
+  wpt_uint8                   ucMPDUHOffset, ucMPDUHLen, ucTid;
+  wpt_uint8                   *pBDHeader;
+  wpt_uint16                  usMPDUDOffset, usMPDULen;
+  WDI_DS_RxMetaInfoType     *pRxMetadata;
+  wpt_uint8                  isFcBd = 0;
+
+  tpSirMacFrameCtl  pMacFrameCtl;
+  // Do Sanity checks
+  if(NULL == pContext || NULL == pFrame){
+    return eWLAN_PAL_STATUS_E_FAILURE;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract BD header and check if valid
+    ------------------------------------------------------------------------*/
+  pBDHeader = (wpt_uint8*)wpalPacketGetRawBuf(pFrame);
+  if(NULL == pBDHeader)
+  {
+    DTI_TRACE( DTI_TRACE_LEVEL_ERROR,
+       "WLAN TL:BD header received NULL - dropping packet");
+    wpalPacketFree(pFrame);
+    return eWLAN_PAL_STATUS_E_FAILURE;
+  }
+  WDI_SwapRxBd(pBDHeader);
+
+  ucMPDUHOffset = (wpt_uint8)WDI_RX_BD_GET_MPDU_H_OFFSET(pBDHeader);
+  usMPDUDOffset = (wpt_uint16)WDI_RX_BD_GET_MPDU_D_OFFSET(pBDHeader);
+  usMPDULen     = (wpt_uint16)WDI_RX_BD_GET_MPDU_LEN(pBDHeader);
+  ucMPDUHLen    = (wpt_uint8)WDI_RX_BD_GET_MPDU_H_LEN(pBDHeader);
+  ucTid         = (wpt_uint8)WDI_RX_BD_GET_TID(pBDHeader);
+
+  /*------------------------------------------------------------------------
+    Gather AMSDU information 
+    ------------------------------------------------------------------------*/
+  bASF = WDI_RX_BD_GET_ASF(pBDHeader);
+  bAEF = WDI_RX_BD_GET_AEF(pBDHeader);
+  bFSF = WDI_RX_BD_GET_ESF(pBDHeader);
+  bLSF = WDI_RX_BD_GET_LSF(pBDHeader);
+  isFcBd = WDI_RX_FC_BD_GET_FC(pBDHeader);
+
+  DTI_TRACE( DTI_TRACE_LEVEL_INFO,
+      "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
+      " Tid %d BD %d",
+      ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
+      WDI_RX_BD_HEADER_SIZE);
+
+  if(!isFcBd)
+  {
+      if(usMPDUDOffset <= ucMPDUHOffset || usMPDULen < ucMPDUHLen) {
+        DTI_TRACE( DTI_TRACE_LEVEL_ERROR,
+            "WLAN TL:BD header corrupted - dropping packet");
+        /* Drop packet ???? */ 
+        wpalPacketFree(pFrame);
+        return eWLAN_PAL_STATUS_SUCCESS;
+      }
+
+      if((ucMPDUHOffset < WDI_RX_BD_HEADER_SIZE) &&  (!(bASF && !bFSF))){
+        /* AMSDU case, ucMPDUHOffset = 0  it should be hancdled seperatly */
+        /* Drop packet ???? */ 
+        wpalPacketFree(pFrame);
+        return eWLAN_PAL_STATUS_SUCCESS;
+      }
+
+      /* AMSDU frame, but not first sub-frame
+       * No MPDU header, MPDU header offset is 0
+       * Total frame size is actual frame size + MPDU data offset */
+      if((ucMPDUHOffset < WDI_RX_BD_HEADER_SIZE) && (bASF && !bFSF)){
+        ucMPDUHOffset = usMPDUDOffset;
+      }
+
+      if(VPKT_SIZE_BUFFER < (usMPDULen+ucMPDUHOffset)){
+        DTI_TRACE( DTI_TRACE_LEVEL_FATAL,
+                   "Invalid Frame size, might memory corrupted");
+        wpalPacketFree(pFrame);
+        return eWLAN_PAL_STATUS_SUCCESS;
+      }
+      wpalPacketSetRxLength(pFrame, usMPDULen+ucMPDUHOffset);
+      wpalPacketRawTrimHead(pFrame, ucMPDUHOffset);
+
+     
+
+      pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
+
+      pRxMetadata->fc = isFcBd;
+      pRxMetadata->staId = WDI_RX_BD_GET_STA_ID(pBDHeader);
+      pRxMetadata->addr3Idx = WDI_RX_BD_GET_ADDR3_IDX(pBDHeader);
+      pRxMetadata->rxChannel = WDI_RX_BD_GET_RX_CHANNEL(pBDHeader);
+      pRxMetadata->rtsf = WDI_RX_BD_GET_RTSF(pBDHeader);
+      pRxMetadata->bsf = WDI_RX_BD_GET_BSF(pBDHeader);
+      pRxMetadata->scan = WDI_RX_BD_GET_SCAN(pBDHeader);
+      pRxMetadata->dpuSig = WDI_RX_BD_GET_DPU_SIG(pBDHeader);
+      pRxMetadata->ft = WDI_RX_BD_GET_FT(pBDHeader);
+      pRxMetadata->ne = WDI_RX_BD_GET_NE(pBDHeader);
+      pRxMetadata->llcr = WDI_RX_BD_GET_LLCR(pBDHeader);
+      pRxMetadata->bcast = WDI_RX_BD_GET_UB(pBDHeader);
+      pRxMetadata->tid = ucTid;
+      pRxMetadata->dpuFeedback = WDI_RX_BD_GET_DPU_FEEDBACK(pBDHeader);
+      pRxMetadata->rateIndex = WDI_RX_BD_GET_RATEINDEX(pBDHeader);
+      pRxMetadata->rxpFlags = WDI_RX_BD_GET_RXPFLAGS(pBDHeader);
+      pRxMetadata->mclkRxTimestamp = WDI_RX_BD_GET_TIMESTAMP(pBDHeader);
+
+      /* typeSubtype in BD doesn't look like correct. Fill from frame ctrl
+         TL does it for Volans but TL does not know BD for Prima. WDI should do it */
+      if ( 0 == WDI_RX_BD_GET_FT(pBDHeader) ) {
+        if ( bASF ) {
+          pRxMetadata->subtype = WDI_MAC_DATA_QOS_DATA;
+          pRxMetadata->type    = WDI_MAC_DATA_FRAME;
+        } else {
+          pMacFrameCtl = (tpSirMacFrameCtl)(((wpt_uint8*)pBDHeader) + ucMPDUHOffset);
+          pRxMetadata->subtype = pMacFrameCtl->subType;
+          pRxMetadata->type    = pMacFrameCtl->type;
+        }
+      } else {
+        pMacFrameCtl = (tpSirMacFrameCtl)(((wpt_uint8*)pBDHeader) + WDI_RX_BD_HEADER_SIZE);
+        pRxMetadata->subtype = pMacFrameCtl->subType;
+        pRxMetadata->type    = pMacFrameCtl->type;
+      }
+
+      pRxMetadata->mpduHeaderPtr = pBDHeader + ucMPDUHOffset;
+      pRxMetadata->mpduDataPtr = pBDHeader + usMPDUDOffset;
+      pRxMetadata->mpduLength = usMPDULen;
+      pRxMetadata->mpduHeaderLength = ucMPDUHLen;
+
+      /*------------------------------------------------------------------------
+        Gather AMPDU information 
+        ------------------------------------------------------------------------*/
+      pRxMetadata->ampdu_reorderOpcode  = (wpt_uint8)WDI_RX_BD_GET_BA_OPCODE(pBDHeader);
+      pRxMetadata->ampdu_reorderSlotIdx = (wpt_uint8)WDI_RX_BD_GET_BA_SI(pBDHeader);
+      pRxMetadata->ampdu_reorderFwdIdx  = (wpt_uint8)WDI_RX_BD_GET_BA_FI(pBDHeader);
+      pRxMetadata->currentPktSeqNo       = (wpt_uint8)WDI_RX_BD_GET_BA_CSN(pBDHeader);
+
+
+      /*------------------------------------------------------------------------
+        Gather AMSDU information 
+        ------------------------------------------------------------------------*/
+      pRxMetadata->amsdu_asf  =  bASF;
+      pRxMetadata->amsdu_aef  =  bAEF;
+      pRxMetadata->amsdu_esf  =  bFSF;
+      pRxMetadata->amsdu_lsf  =  bLSF;
+      pRxMetadata->amsdu_size =  WDI_RX_BD_GET_AMSDU_SIZE(pBDHeader);
+
+      pRxMetadata->rssi0 = WDI_RX_BD_GET_RSSI0(pBDHeader);
+      pRxMetadata->rssi1 = WDI_RX_BD_GET_RSSI1(pBDHeader);
+
+
+        /* Missing: 
+      wpt_uint32 fcSTATxQStatus:8;
+      wpt_uint32 fcSTAThreshIndMask:8;
+      wpt_uint32 fcSTAPwrSaveStateMask:8;
+      wpt_uint32 fcSTAValidMask:8;
+
+      wpt_uint8 fcSTATxQLen[8]; // one byte per STA. 
+      wpt_uint8 fcSTACurTxRate[8]; // current Tx rate for each sta.   
+      unknownUcastPkt 
+      */
+
+      pRxMetadata->replayCount = WDTS_GetReplayCounterFromRxBD(pBDHeader);
+      pRxMetadata->snr = WDI_RX_BD_GET_SNR(pBDHeader); 
+
+      /* 
+       * PAL BD pointer information needs to be populated 
+       */ 
+      WPAL_PACKET_SET_BD_POINTER(pFrame, pBDHeader);
+      WPAL_PACKET_SET_BD_LENGTH(pFrame, sizeof(WDI_RxBdType));
+
+      // Invoke Rx complete callback
+      pClientData->receiveFrameCB(pClientData->pCallbackContext, pFrame);  
+  }
+  else
+  {
+      wpalPacketSetRxLength(pFrame, usMPDULen+ucMPDUHOffset);
+      wpalPacketRawTrimHead(pFrame, ucMPDUHOffset);
+
+      pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
+      //flow control related
+      pRxMetadata->fc = isFcBd;
+      pRxMetadata->fcStaTxDisabledBitmap = WDI_RX_FC_BD_GET_STA_TX_DISABLED_BITMAP(pBDHeader);
+      pRxMetadata->fcSTAValidMask = WDI_RX_FC_BD_GET_STA_VALID_MASK(pBDHeader);
+      // Invoke Rx complete callback
+      pClientData->receiveFrameCB(pClientData->pCallbackContext, pFrame);  
+  }
+  return eWLAN_PAL_STATUS_SUCCESS;
+
+}
+
+
+
+/* DTS Out of Resource packet function. 
+ * This function should be invoked by the transport device to indicate 
+ * the device is out of resources.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller 
+ * priority: indicates which channel is out of resource.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ */
+wpt_status WDTS_OOResourceNotification(void *pContext, WDTS_ChannelType channel, wpt_boolean on)
+{
+  WDI_DS_ClientDataType *pClientData =
+    (WDI_DS_ClientDataType *) pContext;
+  static wpt_uint8 ac_mask = 0x1f;
+
+  // Do Sanity checks
+  if(NULL == pContext){
+    return eWLAN_PAL_STATUS_E_FAILURE;
+  }
+  
+  if(on){
+    ac_mask |=  channel == WDTS_CHANNEL_TX_LOW_PRI?  0x0f : 0x10;
+  } else {
+    ac_mask &=  channel == WDTS_CHANNEL_TX_LOW_PRI?  0x10 : 0x0f;
+  }
+
+
+  // Invoke OOR callback
+  pClientData->txResourceCB(pClientData->pCallbackContext, ac_mask); 
+  return eWLAN_PAL_STATUS_SUCCESS;
+
+}
+
+/* DTS open  function. 
+ * On open the transport device should initialize itself.
+ * Parameters:
+ *  pContext:Cookie that should be passed back to the caller along 
+ *  with the callback.
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_openTransport( void *pContext)
+{
+  void *pDTDriverContext; 
+  WDI_DS_ClientDataType *pClientData;
+  WDI_Status sWdiStatus = WDI_STATUS_SUCCESS;
+
+  pClientData = (WDI_DS_ClientDataType*) wpalMemoryAllocate(sizeof(WDI_DS_ClientDataType));
+  if (!pClientData){
+    return eWLAN_PAL_STATUS_E_NOMEM;
+  }
+
+  pClientData->suspend = 0;
+  WDI_DS_AssignDatapathContext(pContext, (void*)pClientData);
+
+  pDTDriverContext = gTransportDriver.open(); 
+  if( NULL == pDTDriverContext )
+  {
+     DTI_TRACE( DTI_TRACE_LEVEL_ERROR, " %s fail from transport open", __FUNCTION__);
+     return eWLAN_PAL_STATUS_E_FAILURE;
+  }
+  WDT_AssignTransportDriverContext(pContext, pDTDriverContext);
+  gTransportDriver.register_client(pDTDriverContext, WDTS_RxPacket, WDTS_TxPacketComplete, 
+    WDTS_OOResourceNotification, (void*)pClientData);
+
+  /* Create a memory pool for Mgmt BDheaders.*/
+  sWdiStatus = WDI_DS_MemPoolCreate(&pClientData->mgmtMemPool, WDI_DS_MAX_CHUNK_SIZE, 
+                                                     WDI_DS_HI_PRI_RES_NUM);
+  if (WDI_STATUS_SUCCESS != sWdiStatus){
+    return eWLAN_PAL_STATUS_E_NOMEM;
+  }
+
+  /* Create a memory pool for Data BDheaders.*/
+  sWdiStatus = WDI_DS_MemPoolCreate(&pClientData->dataMemPool, WDI_DS_MAX_CHUNK_SIZE, 
+                                                      WDI_DS_LO_PRI_RES_NUM);
+  if (WDI_STATUS_SUCCESS != sWdiStatus){
+    return eWLAN_PAL_STATUS_E_NOMEM;
+  }
+
+  return eWLAN_PAL_STATUS_SUCCESS;
+
+}
+
+
+
+/* DTS start  function. 
+ * On start the transport device should start running.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along 
+ * with the callback.
+ *
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_startTransport( void *pContext)
+{
+  void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+  gTransportDriver.start(pDTDriverContext); 
+  return eWLAN_PAL_STATUS_SUCCESS;
+
+}
+
+
+/* DTS Tx packet function. 
+ * This function should be invoked by the DAL Dataservice to schedule transmit frame through DXE/SDIO.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * pFrame:Refernce to PAL frame.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_TxPacket(void *pContext, wpt_packet *pFrame)
+{
+  void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+  WDI_DS_TxMetaInfoType     *pTxMetadata;
+  WDTS_ChannelType channel = WDTS_CHANNEL_TX_LOW_PRI;
+  wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+  // extract metadata from PAL packet
+  pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame);
+
+  // assign MDPU to correct channel??
+  channel =  (pTxMetadata->frmType & WDI_MAC_DATA_FRAME)? 
+      WDTS_CHANNEL_TX_LOW_PRI : WDTS_CHANNEL_TX_HIGH_PRI;
+  
+  // Send packet to  Transport Driver. 
+  status =  gTransportDriver.xmit(pDTDriverContext, pFrame, channel);
+  return status;
+}
+
+/* DTS Tx Complete function. 
+ * This function should be invoked by the DAL Dataservice to notify tx completion to DXE/SDIO.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * ucTxResReq:TX resource number required by TL
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_CompleteTx(void *pContext, wpt_uint32 ucTxResReq)
+{
+  void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+  
+  // Notify completion to  Transport Driver. 
+  return gTransportDriver.txComplete(pDTDriverContext, ucTxResReq);
+}
+
+/* DXE Set power state ACK callback. 
+ * This callback function should be invoked by the DXE to notify WDI that set
+ * power state request is complete.
+ * Parameters:
+ * status: status of the set operation
+ * Return Value: None.
+ *
+ */
+void  WDTS_SetPowerStateCb(wpt_status   status, unsigned int dxePhyAddr)
+{
+   //print a msg
+   if(NULL != gSetPowerStateCbInfo.cback) 
+   {
+      gSetPowerStateCbInfo.cback(status, dxePhyAddr, gSetPowerStateCbInfo.pUserData);
+   }
+}
+
+
+/* DTS Set power state function. 
+ * This function should be invoked by the DAL to notify the WLAN device power state.
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * powerState:Power state of the WLAN device.
+ * Return Value: SUCCESS  Set successfully in DXE control blk.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_SetPowerState(void *pContext, WDTS_PowerStateType  powerState,
+                              WDTS_SetPowerStateCbType cback)
+{
+   void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+   if( cback )
+   {
+      //save the cback & cookie
+      gSetPowerStateCbInfo.pUserData = pContext;
+      gSetPowerStateCbInfo.cback = cback;
+      status = gTransportDriver.setPowerState(pDTDriverContext, powerState,
+                                            WDTS_SetPowerStateCb);
+   }
+   else
+   {
+      status = gTransportDriver.setPowerState(pDTDriverContext, powerState,
+                                               NULL);
+   }
+
+   return status;
+}
+
+/* DTS Stop function. 
+ * Stop Transport driver, ie DXE, SDIO
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_Stop(void *pContext)
+{
+  void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+  wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+  status =  gTransportDriver.stop(pDTDriverContext);
+
+  return status;
+}
+
+/* DTS Stop function. 
+ * Stop Transport driver, ie DXE, SDIO
+ * Parameters:
+ * pContext:Cookie that should be passed back to the caller along with the callback.
+ * Return Value: SUCCESS  Completed successfully.
+ *     FAILURE_XXX  Request was rejected due XXX Reason.
+ *
+ */
+wpt_status WDTS_Close(void *pContext)
+{
+  void *pDTDriverContext = WDT_GetTransportDriverContext(pContext);
+  WDI_DS_ClientDataType *pClientData = WDI_DS_GetDatapathContext(pContext);
+  wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+  /*Destroy the mem pool for mgmt BD headers*/
+  WDI_DS_MemPoolDestroy(&pClientData->mgmtMemPool);
+  
+  /*Destroy the mem pool for mgmt BD headers*/
+  WDI_DS_MemPoolDestroy(&pClientData->dataMemPool);
+  
+  status =  gTransportDriver.close(pDTDriverContext);
+
+  wpalMemoryFree(pClientData);
+
+  return status;
+}
+
+/* Get free TX data descriptor number from DXE
+ * Parameters:
+ * pContext: Cookie that should be passed back to the caller along with the callback.
+ * Return Value: number of free descriptors for TX data channel
+ *
+ */
+wpt_uint32 WDTS_GetFreeTxDataResNumber(void *pContext)
+{
+  return 
+     gTransportDriver.getFreeTxDataResNumber(WDT_GetTransportDriverContext(pContext));
+}
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_list.h b/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
new file mode 100644
index 0000000..56161ef
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
@@ -0,0 +1,447 @@
+/*
+ * 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_QCT_OS_LIST_H )
+#define __WLAN_QCT_OS_LIST_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_list.h
+  
+  \brief define linked list PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform dependent. It is with VOSS support.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+//Include vos_list.h here. For non-VOSS PAL, it needs to provide its own definition.
+#include "vos_list.h"
+
+typedef vos_list_t wpt_list;
+typedef vos_list_node_t wpt_list_node;
+
+#define WPAL_LIST_STATUS_BASIC_CHECK(status) ( VOS_IS_STATUS_SUCCESS(status) ? \
+            eWLAN_PAL_STATUS_SUCCESS : eWLAN_PAL_STATUS_E_FAILURE )
+
+#define WPAL_LIST_IS_VOS_STATUS_BUSY(status) (VOS_STATUS_E_BUSY == (status))
+#define WPAL_LIST_STATUS_BUSY_CHECK(status) ( VOS_IS_STATUS_SUCCESS(status) ? \
+            eWLAN_PAL_STATUS_SUCCESS : (WPAL_LIST_IS_VOS_STATUS_BUSY(status) ? \
+            eWLAN_PAL_STATUS_E_BUSY : eWLAN_PAL_STATUS_E_FAILURE) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_init() - initialize a wpt_list Linked List  
+    
+  The \a wpal_list_init() function initializes the specified linked list
+  'object'.  Upon successful initialization, the state of the list 
+  becomes initialized and available for use through the other wpt_list_xxx
+  APIs.
+
+  A list must be initialized by calling wpal_list_init() before it 
+  may be used in any other lock functions. 
+  
+  Attempting to initialize an already initialized list results in 
+  a failure.
+ 
+  \param pList - pointer to the opaque list object to initialize
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list was successfully initialized and 
+          is ready to be used.
+  
+          eWLAN_PAL_STATUS_E_RESOURCES - System resources (other than memory) 
+          are unavailable to initilize the list
+
+          eWLAN_PAL_STATUS_E_NOMEM - insufficient memory exists to initialize 
+          the list
+
+          eWLAN_PAL_STATUS_E_BUSY - The implementation has detected an attempt 
+          to reinitialize the object referenced by list, a previously 
+          initialized, but not yet destroyed, list.
+
+          eWLAN_PAL_STATUS_E_FAULT  - pList is an invalid pointer.     
+          
+  \sa 
+  
+  --------------------------------------------------------------------------*/
+#define wpal_list_init(pList) \
+         WPAL_LIST_STATUS_BASIC_CHECK( vos_list_init( (vos_list_t *)(pList) ) )
+
+
+/**-------------------------------------------------------------------------
+  
+  \brief wpal_list_destroy() - Destroy a wpt_list List
+
+  The \a wpal_list_destroy() function shall destroy the list object 
+  referenced by pList.  After a successful return from \a wpal_list_destroy()
+  the list object becomes, in effect, uninitialized.
+   
+  A destroyed lock object can be reinitialized using wpal_list_init(); 
+  the results of otherwise referencing the object after it has been destroyed 
+  are undefined.  Calls to wpt_list functions to manipulate the list such
+  will fail if the list or has not been initialized or is destroyed.  
+  Therefore, don't use the list after it has been destroyed until it has 
+  been re-initialized.
+  
+  \param pLlist - pointer to the list object to be destroyed.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list was successfully destroyed.
+  
+          eWLAN_PAL_STATUS_E_BUSY - The implementation has detected an attempt 
+          to destroy the object referenced by pList that is still has
+          nodes.  The list must be empty before it can be destroyed. 
+
+          eWLAN_PAL_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+          
+          eWLAN_PAL_STATUS_E_FAULT  - pList is an invalid pointer.     
+  \sa
+  
+  ----------------------------------------------------------------------------*/
+#define wpal_list_destroy(pList) \
+    WPAL_LIST_STATUS_BUSY_CHECK( vos_list_destroy( (vos_list_t *)(pList) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_insert_front() - insert node at front of a linked list 
+
+  The wpal_list_insert_front() API will insert a node at the front of
+  a properly initialized wpt_list object. 
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNode - Pointer to the list node to be inserted into the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+//wpt_status wpal_list_insert_front( wpt_list *pList, wpt_list_node *pNode );
+#define wpal_list_insert_front(pList, pNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_insert_front( (vos_list_t *)(pList), (vos_list_node_t *)(pNode) ) )
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_insert_back() - insert node at back of a linked list 
+
+  The wpal_list_insert_back() API will insert a node at the back of
+  a properly initialized wpt_list object. 
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNode - Pointer to the list node to be inserted into the list.
+  
+  \return eWLAN_PAL__STATUS_SUCCESS - list node was successfully inserted onto 
+          the back of the list.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+//wpt_status wpal_list_insert_back( wpt_list *pList, wpt_list_node *pNode );
+#define wpal_list_insert_back(pList, pNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_insert_back( (vos_list_t *)(pList), (vos_list_node_t *)(pNode) ) )
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_remove_front() - remove node at front of a linked list 
+
+  The wpal_list_remove_front() API will remove a node at the front of
+  a properly initialized wpt_ist object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to a pointer to the list node to be removed 
+  from the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully removed from 
+          the front of the list.
+
+          eWLAN_PAL_STATUS_E_INVAL - The value specified by pList is not a valid,
+          initialized list object.
+
+          eWLAN_PAL_STATUS_E_EMPTY - The specified is empty so nodes cannot be 
+          removed.
+         
+          eWLAN_PAL_STATUS_E_FAULT  - pList is an invalid pointer or ppNode is an
+          invalid pointer.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/
+//wpt_status wpal_list_remove_front( wpt_list *pList, wpt_list_node **ppNode );
+#define wpal_list_remove_front(pList, ppNode) \
+    (wpt_status)vos_list_remove_front( (vos_list_t *)(pList), (vos_list_node_t **)(ppNode) )
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_remove_back() - remove node at back of a linked list 
+
+  The wpal_list_remove_back() API will remove a node at the back of
+  a properly initialized wpt_list object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to a pointer to the list node to be removed 
+  from the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully removed from 
+          the back of the list.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_remove_back( wpt_list *pList, wpt_list_node **ppNode );
+#define wpal_list_remove_back(pList, ppNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_remove_back( (vos_list_t *)(pList), (vos_list_node_t **)(ppNode) ) )
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief wpal_list_size() - return the size of of a linked list 
+
+  The wpal_list_size() API will return the number of nodes on the 
+  given wpt_list object. 
+  
+  \param pList - Pointer to list object where the node will be counted
+  
+  \param pSize - Pointer to a size variable, where the size of the 
+                 list will be returned.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list size of the properly initialized 
+          wpt_list object has been returned.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_size( wpt_list *pList, wpt_uint32 *pSize );
+#define wpal_list_size(pList, pSize) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_size( (vos_list_t *)(pList), (v_SIZE_t *)(pSize) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_peek_front() - peek at the node at front of a linked list 
+
+  The wpal_list_peek_front() API will return a pointer to the node at the 
+  front of a properly initialized wpt_list object.  The node will *not* be
+  removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the front of the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node at the front of the list was 
+          successfully returned.
+
+          eWLAN_PAL_STATUS_E_Failure.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_peek_front( wpt_list *pList, wpt_list_node **ppNode );
+#define wpal_list_peek_front(pList, ppNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_peek_front( (vos_list_t *)(pList), (vos_list_node_t **)(ppNode) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_peek_back() - peek at the node at back of a linked list 
+
+  The wpal_list_peek_back() API will return a pointer to the node at the 
+  back of a properly initialized wpt_list object.  The node will *not* be
+  removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param ppNode - Pointer to a pointer to the list node that exists at
+  the back of the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node at the back of the list was 
+          successfully returned.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_peek_back( wpal_list *pList, wpt_list_node **ppNode );
+#define wpal_list_peek_back(pList, ppNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_peek_back( (vos_list_t *)(pList), (vos_list_node_t **)(ppNode) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_peek_next() - peek at the node after the specified node 
+
+  The wpal_list_peek_next() API will return a pointer to the node following the
+  specified node on a properly initialized wpt_list object.  The node will 
+  *not* be removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param pNode - Pointer to the node that is being 'peeked'
+  
+  \param ppNode - Pointer to a pointer to the list node that follows the
+  pNode node on the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node following pNode on the properly 
+          initialized list is successfully returned.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_peek_next( wpt_list *pList, wpt_list_node *pNode, 
+//                               wpt_list_node **ppNode );
+#define wpal_list_peek_next(pList, pNode, ppNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_peek_next( (vos_list_t *)(pList), (vos_list_node_t *)(pNode), (vos_list_node_t **)(ppNode) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_peek_prev() - peek at the node before the specified node 
+
+  The wpal_list_peek_prev() API will return a pointer to the node before the
+  specified node on a properly initialized wpt_list object.  The node will 
+  *not* be removed from the list.
+  
+  \param pList - Pointer to list object of the list to be 'peeked' 
+  
+  \param pNode - Pointer to the node that is being 'peeked'
+  
+  \param ppNode - Pointer to a pointer to the list node before the
+  pNode node on the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node before pNode on the properly 
+          initialized list is successfully returned.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa 
+  
+  --------------------------------------------------------------------------*/                                 
+//wpt_status wpal_list_peek_prev( wpt_list *pList, wpt_list_node *pNode, 
+//                               wpt_list_node **ppNode );
+#define wpal_list_peek_prev(pList, pNode, ppNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_peek_prev( (vos_list_t *)(pList), (vos_list_node_t *)(pNode), (vos_list_node_t **)(ppNode) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_insert_before() - insert node at front of a specified
+  list node 
+
+  The wpal_list_insert_before() API will insert a node onto a properly 
+  initialized wpt_list object in front of the specified list node.
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+  
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  in front of.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          eWLAN_PAL_STATUS_FAILURE - Failure.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/
+//wpt_status wpal_list_insert_before( wpt_list *pList, 
+//                                    wpt_list_node *pNodeToInsert, 
+//                                    wpt_list_node *pNode );
+#define wpal_list_insert_before(pList, pNodeToInsert, pNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_insert_before( (vos_list_t *)(pList), \
+                  (vos_list_node_t *)(pNodeToInsert), (vos_list_node_t *)(pNode) ) )
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_insert_after() - insert node behind a specified list node 
+
+  The wpal_list_insert_after() API will insert a node onto a properly 
+  initialized wpt_list object after the specified list node.
+  
+  \param pList - Pointer to list object where the node will be inserted
+  
+  \param pNodeToInsert - Pointer to the list node to be inserted into the list.
+  
+  \param pNode - Pointer to the list node where pNodeToInsert will be inserted
+  after.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully inserted onto 
+          the front of the list.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/                                   
+//wpt_status wpal_list_insert_after( wpt_list *pList, 
+//                                   wpt_list_node *pNodeToInsert, 
+//                                   wpt_list_node *pNode );         
+#define wpal_list_insert_after(pList, pNodeToInsert, pNode) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_insert_after((vos_list_t *)(pList), \
+         (vos_list_node_t *)(pNodeToInsert), (vos_list_node_t *)(pNode) )
+
+
+/**---------------------------------------------------------------------------
+  
+  \brief wpal_list_remove_node() - remove specified node from wpt_list list 
+
+  The wpal_list_remove_node() API will remove a specified node from the 
+  properly initialized wpt_list object. 
+  
+  \param pList - Pointer to list object where the node will be removed
+  
+  \param ppNode - Pointer to the node to be removed from the list.
+  
+  \return eWLAN_PAL_STATUS_SUCCESS - list node was successfully removed from 
+          the list.
+
+          eWLAN_PAL_STATUS_E_FAILURE - Failure.
+    
+  \sa
+  
+  --------------------------------------------------------------------------*/  
+//wpt_status wpal_list_remove_node( wpt_list *pList, wpt_list_node *pNodeToRemove );
+#define wpal_list_remove_node(pList, pNodeToRemove) \
+    WPAL_LIST_STATUS_BASIC_CHECK( vos_list_remove_node( (vos_list_t *)(pList), \
+            (vos_list_node_t *)(pNodeToRemove) ) )
+
+
+#endif // __WLAN_QCT_OS_LIST_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_status.h b/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
new file mode 100644
index 0000000..5d544fb
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_status.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.
+ */
+
+#if !defined( __WLAN_QCT_OS_STATUS_H )
+#define __WLAN_QCT_OS_STATUS_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_os_status.h
+  
+  \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform dependent(Windows XP). 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "vos_status.h"
+
+/**
+ * \brief Macros to derive PAL STATUS from the VOS STATUS
+ */
+
+#define WPAL_IS_VOS_STATUS_E_RESOURCES(status) ( VOS_STATUS_E_RESOURCES == (status)) 
+#define WPAL_IS_VOS_STATUS_E_NOMEM(status) ( VOS_STATUS_E_NOMEM == (status)) 
+#define WPAL_IS_VOS_STATUS_E_INVAL(status) ( VOS_STATUS_E_INVAL == (status)) 
+#define WPAL_IS_VOS_STATUS_E_FAULT(status) ( VOS_STATUS_E_FAULT == (status)) 
+#define WPAL_IS_VOS_STATUS_E_BUSY(status) ( VOS_STATUS_E_BUSY == (status)) 
+#define WPAL_IS_VOS_STATUS_E_CANCELED(status) ( VOS_STATUS_E_CANCELED == (status)) 
+#define WPAL_IS_VOS_STATUS_E_ABORTED(status) ( VOS_STATUS_E_ABORTED == (status)) 
+#define WPAL_IS_VOS_STATUS_E_NOSUPPORT(status) ( VOS_STATUS_E_NOSUPPORT == (status)) 
+#define WPAL_IS_VOS_STATUS_E_EMPTY(status) ( VOS_STATUS_E_EMPTY == (status)) 
+#define WPAL_IS_VOS_STATUS_E_EXISTS(status) ( VOS_STATUS_E_EXISTS == (status)) 
+#define WPAL_IS_VOS_STATUS_E_TIMEOUT(status) ( VOS_STATUS_E_TIMEOUT == (status)) 
+
+
+#define WPAL_STATUS_E_TIMEOUT_CHECK(status) ( WPAL_IS_VOS_STATUS_E_TIMEOUT(status)? eWLAN_PAL_STATUS_E_TIMEOUT : eWLAN_PAL_STATUS_E_FAILURE )
+
+#define WPAL_STATUS_E_EXISTS_CHECK(status) ( WPAL_IS_VOS_STATUS_E_EXISTS(status)? eWLAN_PAL_STATUS_E_EXISTS : WPAL_STATUS_E_TIMEOUT_CHECK(status) )
+
+#define WPAL_STATUS_E_EMPTY_CHECK(status) ( WPAL_IS_VOS_STATUS_E_EMPTY(status)? eWLAN_PAL_STATUS_E_EMPTY : WPAL_STATUS_E_EXISTS_CHECK(status) )
+
+#define WPAL_STATUS_E_NOSUPPORT_CHECK(status) ( WPAL_IS_VOS_STATUS_E_NOSUPPORT(status)? eWLAN_PAL_STATUS_E_NOSUPPORT : WPAL_STATUS_E_EMPTY_CHECK(status) )
+
+#define WPAL_STATUS_E_ABORTED_CHECK(status) ( WPAL_IS_VOS_STATUS_E_ABORTED(status)? eWLAN_PAL_STATUS_E_ABORTED : WPAL_STATUS_E_NOSUPPORT_CHECK(status) )
+
+#define WPAL_STATUS_E_CANCELED_CHECK(status) ( WPAL_IS_VOS_STATUS_E_CANCELED(status)? eWLAN_PAL_STATUS_E_CANCELED : WPAL_STATUS_E_ABORTED_CHECK(status) )
+
+#define WPAL_STATUS_E_BUSY_CHECK(status) ( WPAL_IS_VOS_STATUS_E_BUSY(status)? eWLAN_PAL_STATUS_E_BUSY : WPAL_STATUS_E_CANCELED_CHECK(status) )
+
+#define WPAL_STATUS_E_FAULT_CHECK(status) ( WPAL_IS_VOS_STATUS_E_FAULT(status)? eWLAN_PAL_STATUS_E_FAULT : WPAL_STATUS_E_BUSY_CHECK(status) )
+
+#define WPAL_STATUS_E_INVAL_CHECK(status) ( WPAL_IS_VOS_STATUS_E_INVAL(status)? eWLAN_PAL_STATUS_E_INVAL : WPAL_STATUS_E_FAULT_CHECK(status) )
+
+#define WPAL_STATUS_E_NOMEM_CHECK(status) ( WPAL_IS_VOS_STATUS_E_NOMEM(status)? eWLAN_PAL_STATUS_E_NOMEM : WPAL_STATUS_E_INVAL_CHECK(status) )
+
+#define WPAL_STATUS_E_RESOURCES_CHECK(status) ( WPAL_IS_VOS_STATUS_E_RESOURCES(status)? eWLAN_PAL_STATUS_E_RESOURCES : WPAL_STATUS_E_NOMEM_CHECK(status) )
+
+#define WPAL_VOS_TO_WPAL_STATUS(status) ( VOS_IS_STATUS_SUCCESS(status)? eWLAN_PAL_STATUS_SUCCESS : WPAL_STATUS_E_RESOURCES_CHECK(status) )
+
+#endif // __WLAN_QCT_OS_STATUS_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h b/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
new file mode 100644
index 0000000..f7bb44e
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_sync.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.
+ */
+
+#if !defined( __WLAN_QCT_OS_SYNC_H )
+#define __WLAN_QCT_OS_SYNC_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_os_sync.h
+  
+  \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform dependent(LA). 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "vos_event.h"
+#include "vos_lock.h"
+
+/*Reuse the vos lock and vos event*/
+typedef vos_lock_t  wpt_mutex;
+typedef vos_event_t wpt_event;
+
+
+#endif // __WLAN_QCT_OS_SYNC_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h b/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
new file mode 100644
index 0000000..80ede5a
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_timer.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.
+ */
+
+#if !defined( __WLAN_QCT_OS_TIMER_H )
+#define __WLAN_QCT_OS_TIMER_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_os_timer.h
+  
+  \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform dependent (Linux Android).
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "vos_timer.h"
+
+typedef struct
+{
+   vos_timer_t timerObj;
+} wpt_os_timer;
+
+
+#endif // __WLAN_QCT_OS_TIMER_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h b/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h
new file mode 100644
index 0000000..839e2bb
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h
@@ -0,0 +1,97 @@
+/*
+ * 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_QCT_OS_TRACE_H )
+#define __WLAN_QCT_OS_TRACE_H
+
+
+#ifdef WLAN_DEBUG
+
+/**----------------------------------------------------------------------------
+  
+ \brief WPAL_TRACE() / wpalTrace() - Trace / logging API
+   
+ Users wishing to add tracing information to their code should use 
+ WPAL_TRACE.  WPAL_TRACE() will compile into a call to wpalTrace() when
+ tracing is enabled.
+  
+ \param module - module identifier.   A member of the wpt_moduleid
+                 enumeration that identifies the module issuing the trace message.
+         
+ \param level - trace level.   A member of the wpt_tracelevel 
+                enumeration indicating the severity of the condition causing the
+                trace message to be issued.   More severe conditions are more 
+                likely to be logged.
+         
+   \param strFormat - format string.  The message to be logged.  This format
+                      string contains printf-like replacement parameters, which follow
+                      this parameter in the variable argument list.                    
+  
+   \return  nothing
+    
+  --------------------------------------------------------------------------*/
+void wpalTrace( wpt_moduleid module, wpt_tracelevel level, char *strFormat, ... );
+
+/**----------------------------------------------------------------------------
+  
+ \brief WPAL_DUMP() / wpalDump() - Trace / logging API
+   
+ Users wishing to add tracing memory dumps to their code should use 
+ WPAL_DUMP.  WPAL_DUMP() will compile into a call to wpalDump() when
+ tracing is enabled.
+  
+ \param module - module identifier.   A member of the wpt_moduleid
+                 enumeration that identifies the module performing the dump
+         
+ \param level - trace level.   A member of the wpt_tracelevel 
+                enumeration indicating the severity of the condition causing the
+                memory to be dumped.   More severe conditions are more 
+                likely to be logged.
+         
+ \param pMemory - memory.  A pointer to the memory to be dumped
+
+ \param length - length.  How many bytes of memory to be dumped
+  
+   \return  nothing
+    
+  --------------------------------------------------------------------------*/
+void wpalDump( wpt_moduleid module, wpt_tracelevel level,
+               wpt_uint8 *memory, wpt_uint32 length);
+
+#define WPAL_TRACE wpalTrace
+#define WPAL_DUMP wpalDump
+
+#define WPAL_ASSERT( _condition )                          \
+if ( ! ( _condition ) )                                   \
+{                                                         \
+   printk(KERN_CRIT "VOS ASSERT in %s Line %d\n", __FUNCTION__, __LINE__); \
+   WARN_ON(1); \
+}
+
+#else //WLAN_DEBUG
+
+#define WPAL_TRACE
+#define WPAL_DUMP
+#define WPAL_ASSERT
+
+#endif //WLAN_DEBUG
+
+#endif // __WLAN_QCT_OS_TRACE_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_os_type.h b/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
new file mode 100644
index 0000000..24a8e1c
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
@@ -0,0 +1,64 @@
+/*
+ * 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_QCT_OS_TYPE_H )
+#define __WLAN_QCT_OS_TYPE_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_type.h
+  
+  \brief define basi types PAL exports. wpt = (Wlan Pal Type)
+               
+   Definitions for platform dependent. This is for Linux/Android
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+
+typedef unsigned long wpt_uint32;
+
+typedef signed long wpt_int32;
+
+typedef unsigned short wpt_uint16;
+
+typedef signed short wpt_int16;
+
+typedef unsigned char wpt_uint8;
+
+typedef wpt_uint8 wpt_byte;
+
+typedef signed char wpt_int8;
+
+typedef wpt_uint8 wpt_boolean; 
+
+typedef unsigned long long wpt_uint64;
+
+typedef long long wpt_int64;
+
+#define WPT_INLINE __inline__
+#define WPT_STATIC static
+
+
+#endif // __WLAN_QCT_OS_TYPE_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h b/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
new file mode 100644
index 0000000..7b1a350
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
@@ -0,0 +1,109 @@
+/*
+ * 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_QCT_PACK_ALIGN_H )
+#define __WLAN_QCT_PACK_ALIGN_H
+
+/**=========================================================================
+  
+  \file  wlan_pack_align.h
+  
+  \brief pack and align primitives
+               
+   Definitions for platform independent means of packing and aligning
+   data structures
+  
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+/*
+ 
+  Place the macro WPT_PACK_START above a structure declaration to pack. We 
+  are not going to allow modifying the pack size because pack size cannot be 
+  specified in AMSS and GNU. Place the macro WPT_PACK_END below a structure 
+  declaration to stop the pack. This requirement is necessitated by Windows
+  which need pragma based prolog and epilog.
+
+  Pack-size > 1-byte is not supported since gcc and arm do not support that.
+  
+  Here are some examples
+  
+  1. Pack-size 1-byte foo_t across all platforms  
+  
+  WPT_PACK_START
+  typedef WPT_PACK_PRE struct foo_s { ... } WPT_PACK_POST foo_t; 
+  WPT_PACK_END
+  
+  2. 2-byte alignment for foo_t across all platforms
+  
+  typedef WPT_ALIGN_PRE(2) struct foo_s { ... } WPT_ALIGN_POST(2) foo_t; 
+
+  3. Pack-size 1-byte and 2-byte alignment for foo_t across all platforms
+
+  WPT_PACK_START
+  typedef WPT_PACK_PRE WPT_ALIGN_PRE(2) struct foo_s { ... } WPT_ALIGN_POST(2) WPT_PACK_POST foo_t; 
+  WPT_PACK_END
+  
+*/
+
+#if defined __GNUC__
+
+   #define WPT_PACK_START 
+   #define WPT_PACK_END 
+
+   #define WPT_PACK_PRE 
+   #define WPT_PACK_POST  __attribute__((__packed__))
+
+   #define WPT_ALIGN_PRE(__value)
+   #define WPT_ALIGN_POST(__value)  __attribute__((__aligned__(__value)))
+
+#elif defined __arm
+
+   #define WPT_PACK_START 
+   #define WPT_PACK_END 
+
+   #define WPT_PACK_PRE  __packed
+   #define WPT_PACK_POST
+
+   #define WPT_ALIGN_PRE(__value)  __align(__value)
+   #define WPT_ALIGN_POST(__value)
+
+#elif defined _MSC_VER
+
+   #define WPT_PACK_START  __pragma (pack(push,1))
+   #define WPT_PACK_END  __pragma (pack(pop))
+
+   #define WPT_PACK_PRE 
+   #define WPT_PACK_POST
+
+   #define WPT_ALIGN_PRE(__value)  __declspec(align(__value))
+   #define WPT_ALIGN_POST(__value)
+
+#else
+
+   #error Unsupported compiler!!!
+
+#endif
+
+#endif // __WLAN_QCT_PACK_ALIGN_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
new file mode 100644
index 0000000..d71cba8
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
@@ -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.
+ */
+
+#if !defined( __WLAN_QCT_PAL_API_H )
+#define __WLAN_QCT_PAL_API_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_api.h
+  
+  \brief define general APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform independent
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+
+#ifdef MEMORY_DEBUG
+#include "vos_memory.h"
+#endif /* MEMORY_DEBUG */
+
+/*********************************MACRO**********************/
+
+// macro to get maximum of two values.
+#define WPAL_MAX( _x, _y ) ( ( (_x) > (_y) ) ? (_x) : (_y) )  
+
+// macro to get minimum of two values
+#define WPAL_MIN( _x, _y ) ( ( (_x) < (_y) ) ? (_x) : (_y)  )  
+
+// macro to get the ceiling of an integer division operation...
+#define WPAL_CEIL_DIV( _a, _b ) ( 0 != (_a) % (_b) ) ? ( (_a) / (_b) + 1 ) : ( (_a) / (_b) ) 
+
+// macro to return the floor of an integer division operation
+#define WPAL_FLOOR_DIV( _a, _b ) ( ( (_a) - ( (_a) % (_b) ) ) / (_b) )
+
+#define WPAL_SWAP_U16(_x) \
+   ( ( ( (_x) << 8 ) & 0xFF00 ) | ( ( (_x) >> 8 ) & 0x00FF ) )
+
+#define WPAL_SWAP_U32(_x) \
+   ( ( ( (_x) << 24 ) & 0xFF000000 ) | ( ( (_x) >> 24 ) & 0x000000FF ) ) | \
+   ( ( ( (_x) << 8 ) & 0x00FF0000 ) | ( ( (_x) >> 8 ) & 0x0000FF00 ) )
+
+// Endian operations for Big Endian and Small Endian modes
+#ifndef ANI_BIG_BYTE_ENDIAN
+
+//This portion is for little-endian cpu
+#define WPAL_CPU_TO_BE32(_x) WPAL_SWAP_U32(_x)
+#define WPAL_BE32_TO_CPU(_x) WPAL_SWAP_U32(_x)
+#define WPAL_CPU_TO_BE16(_x) WPAL_SWAP_U16(_x)
+#define WPAL_BE16_TO_CPU(_x) WPAL_SWAP_U16(_x)
+#define WPAL_CPU_TO_LE32(_x) (_x)
+#define WPAL_LE32_TO_CPU(_x) (_x)
+#define WPAL_CPU_TO_LE16(_x) (_x)
+#define WPAL_LE16_TO_CPU(_x) (_x)
+
+#else //#ifndef ANI_BIG_BYTE_ENDIAN
+
+//This portion is for big-endian cpu
+#define WPAL_CPU_TO_BE32(_x) (_x)
+#define WPAL_BE32_TO_CPU(_x) (_x)
+#define WPAL_CPU_TO_BE16(_x) (_x)
+#define WPAL_BE16_TO_CPU(_x) (_x)
+#define WPAL_CPU_TO_LE32(_x) WPAL_SWAP_U32(_x)
+#define WPAL_LE32_TO_CPU(_x) WPAL_SWAP_U32(_x)
+#define WPAL_CPU_TO_LE16(_x) WPAL_SWAP_U16(_x)
+#define WPAL_LE16_TO_CPU(_x) WPAL_SWAP_U16(_x)
+
+#endif //#ifndef ANI_BIG_BYTE_ENDIAN
+
+
+/*********************************Generic API*******************************/
+/*---------------------------------------------------------------------------
+    wpalOpen -  Initialize PAL
+    Param: 
+       ppPalContext – pointer to a caller allocated pointer. It is opaque to caller.
+                      Caller save the returned pointer for future use when calling
+                      PAL APIs. If this is NULL, it means that PAL doesn't need it.
+       pOSContext - Pointer to a context that is OS specific. This is NULL is a 
+                     particular PAL doesn't use it for that OS.
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - success. Otherwise fail.
+---------------------------------------------------------------------------*/
+wpt_status wpalOpen(void **ppPalContext, void *pOSContext);
+
+/*---------------------------------------------------------------------------
+    wpalClose - Release PAL
+    Param: 
+       pPalContext – pointer returned from wpalOpen.
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - success. Otherwise fail.
+---------------------------------------------------------------------------*/
+wpt_status wpalClose(void *pPalContext);
+
+
+/*********************************Memory API********************************/
+#ifdef MEMORY_DEBUG
+/* For Memory Debugging, Hook up PAL memory API to VOS memory API */
+#define wpalMemoryAllocate vos_mem_malloc
+#define wpalMemoryFree     vos_mem_free
+#else
+
+/*---------------------------------------------------------------------------
+    wpalMemoryAllocate -  Allocate memory
+    Param: 
+       size – number of bytes to allocate
+    Return:
+       A pointer to the allocated memory. 
+       NULL – fail to allocate memory
+---------------------------------------------------------------------------*/
+void *wpalMemoryAllocate(wpt_uint32 size);
+
+/*---------------------------------------------------------------------------
+    wpalMemoryFree -  Free allocated memory
+    Param: 
+       pv – pointer to buffer to be freed
+    Return:
+       None
+---------------------------------------------------------------------------*/
+void wpalMemoryFree(void *pv);
+#endif /* MEMORY_DEBUG */
+
+/*---------------------------------------------------------------------------
+    wpalMemoryCopy -  copy memory
+    Param: 
+       dest – address which data is copied to
+       src – address which data is copied from
+       size – number of bytes to copy
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS
+       eWLAN_PAL_STATUS_INVALID_PARAM
+---------------------------------------------------------------------------*/
+wpt_status wpalMemoryCopy(void * dest, void * src, wpt_uint32 size);
+
+
+/*---------------------------------------------------------------------------
+    wpalMemoryCompare -  compare memory
+    Param: 
+       buf1 – address of buffer1
+       buf2 – address of buffer2
+       size – number of bytes to compare
+    Return:
+       eWLAN_PAL_TRUE – if two buffers have same content
+       eWLAN_PAL_FALSE – not match
+---------------------------------------------------------------------------*/
+wpt_boolean wpalMemoryCompare(void * buf1, void * buf2, wpt_uint32 size);
+
+/*---------------------------------------------------------------------------
+    wpalMemoryZero -  Zero memory
+    Param: 
+       buf – address of buffer to be zero
+       size – number of bytes to zero
+    Return:
+       None
+---------------------------------------------------------------------------*/
+void wpalMemoryZero(void *buf, wpt_uint32 size);
+
+
+/*---------------------------------------------------------------------------
+    wpalMemoryFill -  Fill memory with one pattern
+    Param: 
+       buf – address of buffer to be zero
+       size – number of bytes to zero
+       bFill - one byte of data to fill in (size) bytes from the start of the buffer
+    Return:
+       None
+---------------------------------------------------------------------------*/
+void wpalMemoryFill(void *buf, wpt_uint32 size, wpt_byte bFill);
+
+
+/*---------------------------------------------------------------------------
+    wpalDmaMemoryAllocate -  Allocate memory ready for DMA. Aligned at 4-byte
+    Param: 
+       pPalContext - PAL context pointer
+       size – number of bytes to allocate
+       ppPhysicalAddr – Physical address of the buffer if allocation succeeds
+    Return:
+       A pointer to the allocated memory (virtual address). 
+       NULL – fail to allocate memory
+-----------------------------------------------------------------------------*/
+void *wpalDmaMemoryAllocate(wpt_uint32 size, void **ppPhysicalAddr);
+
+/*---------------------------------------------------------------------------
+    wpalDmaMemoryFree -  Free memory ready for DMA
+    Param: 
+       pPalContext - PAL context pointer
+       pv – address for the buffer to be freed
+    Return:
+       None
+---------------------------------------------------------------------------*/
+void wpalDmaMemoryFree(void *pv);
+
+
+
+/*---------------------------------------------------------------------------
+    wpalDbgReadRegister -  Read register from the WiFi BB chip
+    Param: 
+       regAddr - register address
+       pregValue - return value from register if success
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDbgReadRegister(wpt_uint32 regAddr, wpt_uint32 *pregValue);
+
+/*---------------------------------------------------------------------------
+    wpalDbgWriteRegister -  Write a value to the register in the WiFi BB chip
+    Param: 
+       regAddr - register address
+       regValue - value to be written
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDbgWriteRegister(wpt_uint32 regAddr, wpt_uint32 regValue);
+
+/*---------------------------------------------------------------------------
+    wpalDbgReadMemory -  Read memory from WiFi BB chip space
+    Param: 
+       memAddr - address of memory
+       buf - output 
+       len - length to be read
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDbgReadMemory(wpt_uint32 memAddr, wpt_uint8 *buf, wpt_uint32 len);
+
+/*---------------------------------------------------------------------------
+    wpalDbgWriteMemory -  Write a value to the memory in the WiFi BB chip space
+    Param: 
+       memAddr - memory address
+       buf - vlaue to be written
+       len - length of buf
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDbgWriteMemory(wpt_uint32 memAddr, wpt_uint8 *buf, wpt_uint32 len);
+
+/*---------------------------------------------------------------------------
+    wpalDriverShutdown -  Shutdown WLAN driver
+
+    This API is requied by SSR, call in to 'VOS shutdown' to shutdown WLAN 
+    driver when Riva crashes.
+
+    Param: 
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDriverShutdown(void);
+
+/*---------------------------------------------------------------------------
+    wpalDriverShutdown -  Re-init WLAN driver
+
+    This API is requied by SSR, call in to 'VOS re-init' to re-init WLAN
+    driver.
+
+    Param: 
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDriverReInit(void);
+
+/*---------------------------------------------------------------------------
+    wpalRivaSubystemRestart -  Initiate Riva SSR
+
+    This API is called by WLAN driver to initiate Riva SSR
+
+    Param:
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalRivaSubystemRestart(void);
+
+#endif // __WLAN_QCT_PAL_API_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
new file mode 100644
index 0000000..c7e395e
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
@@ -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.
+ */
+
+#ifndef WLAN_QCT_PAL_DEVICE_H
+#define WLAN_QCT_PAL_DEVICE_H
+/* ====================================================================================================================
+
+   @file   wlan_qct_pal_device.h
+
+   @brief
+    This file contains the external API exposed by WLAN PAL Device specific functionalities
+    Copyright (c) 2011 Qualcomm Incorporated. All Rights Reserved
+    Qualcomm Confidential and Properietary
+
+ * ==================================================================================================================*/
+
+/* ====================================================================================================================
+                  EDIT HISTORY FOR FILE
+
+   This section contains comments describing changes made to the module.
+   Notice that changes are listed in reverse chronological order
+
+   When             Who                 What, Where, Why
+   ---------        --------            -------------------------------------------------------------------------------
+   FEB/07/11        sch                 Create module
+ * ==================================================================================================================*/
+
+/* ====================================================================================================================
+                  INCLUDE FILES FOR MODULES
+ * ==================================================================================================================*/
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_pal_trace.h"
+
+/* ====================================================================================================================
+                  PREPROCESSORS AND DEFINITIONS
+ * ==================================================================================================================*/
+#define     DXE_INTERRUPT_TX_COMPLE      0x02
+#define     DXE_INTERRUPT_RX_READY       0x04
+#define     WPAL_ISR_CLIENT_MAX          0x08
+
+#define     WPAL_SMSM_WLAN_TX_ENABLE          0x00000400
+#define     WPAL_SMSM_WLAN_TX_RINGS_EMPTY     0x00000200
+
+/* ====================================================================================================================
+  @  Function Name 
+      wpalIsrType
+
+  @  Description 
+      DXE ISR functio prototype
+      DXE should register ISR function into platform
+
+  @  Parameters
+      pVoid                       pDXEContext : DXE module control block
+
+  @  Return
+      NONE
+ * ==================================================================================================================*/
+typedef void (* wpalIsrType)(void *usrCtxt);
+
+/* ====================================================================================================================
+                  GLOBAL FUNCTIONS
+ * ==================================================================================================================*/
+/* ====================================================================================================================
+   @ Function Name
+
+   @ Description
+
+   @ Arguments
+
+   @ Return value
+
+   @ Note
+
+ * ==================================================================================================================*/
+wpt_status wpalDeviceInit
+(
+   void                 *deviceCB
+);
+
+/* ====================================================================================================================
+   @ Function Name
+
+   @ Description
+
+   @ Arguments
+
+   @ Return value
+
+   @ Note
+
+ * ==================================================================================================================*/
+wpt_status wpalDeviceClose
+(
+   void                 *deviceC
+);
+
+/* ==========================================================================
+                  CLIENT SERVICE EXPOSE FUNCTIONS GENERIC
+ * =========================================================================*/
+/**
+  @brief wpalRegisterInterrupt provides a mechansim for client
+         to register support for a given interrupt
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can register to support one of these.  It is expected that the core
+  DXE implementation will invoke this API twice, once for each interrupt.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+  @param  callbackFunction: ISR function pointer
+  @param  usrCtxt:          User context passed back whenever the
+                            callbackFunction is invoked
+
+  @return SUCCESS if the registration was successful
+*/
+wpt_status wpalRegisterInterrupt
+(
+   wpt_uint32                           intType,
+   wpalIsrType                          callbackFunction,
+   void                                *usrCtxt
+);
+
+/**
+  @brief wpalUnRegisterInterrupt provides a mechansim for client
+         to un-register for a given interrupt
+
+  When DXE stop, remove registered information from PAL
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return NONE
+*/
+
+void wpalUnRegisterInterrupt
+(
+   wpt_uint32      intType
+);
+
+/**
+  @brief wpalEnableInterrupt provides a mechansim for a client
+         to request that a given interrupt be enabled
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can request that the platform-specific adaptation layer allows a
+  given interrupt to occur.  The expectation is that if a given
+  interrupt is not enabled, if the interrupt occurs then the APPS CPU
+  will not be interrupted.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return SUCCESS if the interrupt was enabled
+*/
+wpt_status wpalEnableInterrupt
+(
+   wpt_uint32                          intType
+);
+
+/**
+  @brief wpalDisableInterrupt provides a mechansim for a client
+         to request that a given interrupt be disabled
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can request that the platform-specific adaptation layer not allow a
+  given interrupt to occur.  The expectation is that if a given
+  interrupt is not enabled, if the interrupt occurs then the APPS CPU
+  will not be interrupted.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return SUCCESS if the interrupt was disabled
+*/
+wpt_status wpalDisableInterrupt
+(
+   wpt_uint32                           intType
+);
+
+/**
+  @brief wpalWriteRegister provides a mechansim for a client
+         to write data into a hardware data register
+
+  @param  address:  Physical memory address of the register
+  @param  data:     Data value to be written
+
+  @return SUCCESS if the data was successfully written
+*/
+wpt_status wpalReadRegister
+(
+   wpt_uint32                           address,
+   wpt_uint32                          *data
+);
+
+/**
+  @brief wpalReadRegister provides a mechansim for a client
+         to read data from a hardware data register
+
+  @param  address:  Physical memory address of the register
+  @param  data:     Return location for value that is read
+
+  @return SUCCESS if the data was successfully read
+*/
+wpt_status wpalWriteRegister
+(
+   wpt_uint32                           address,
+   wpt_uint32                           data
+);
+
+/**
+  @brief wpalReadDeviceMemory provides a mechansim for a client
+         to read data from the hardware address space
+
+  @param  address:  Start address of physical memory to be read
+  @param  d_buffer: Virtual destination address to which the
+                    data will be written
+  @param  len:      Number of bytes of data to be read
+
+  @return SUCCESS if the data was successfully read
+*/
+wpt_status wpalReadDeviceMemory
+(
+   wpt_uint32                            address,
+   wpt_uint8                            *DestBuffer,
+   wpt_uint32                            len
+);
+
+/**
+  @brief wpalWriteDeviceMemory provides a mechansim for a client
+         to write data into the hardware address space
+
+  @param  address:  Start address of physical memory to be written
+  @param  s_buffer: Virtual source address from which the data will
+                    be read
+  @param  len:      Number of bytes of data to be written
+
+  @return SUCCESS if the data was successfully written
+*/
+wpt_status wpalWriteDeviceMemory
+(
+   wpt_uint32                            address,
+   wpt_uint8                            *srcBuffer,
+   wpt_uint32                            len
+);
+
+/**
+  @brief wpalNotifySmsm provides a mechansim for a client to 
+         notify SMSM to start DXE engine and/or condition of Tx
+         ring buffer
+
+  @param  clrSt:   bit(s) to be cleared on the MASK 
+  @param  setSt:   bit(s) to be set on the MASK
+
+  @return SUCCESS if the operation is successful
+*/
+wpt_status wpalNotifySmsm
+(
+   wpt_uint32                            clrSt,
+   wpt_uint32                            setSt
+);
+
+/**
+  @brief wpalActivateRxInterrupt activates wpalRxIsr
+
+  @param  NONE
+
+  @return NONE
+*/
+void wpalActivateRxInterrupt(void);
+
+/**
+  @brief wpalInactivateRxInterrupt inactivates wpalRxIsr
+
+  @param  NONE
+
+  @return NONE
+*/
+void wpalInactivateRxInterrupt(void);
+
+#endif /* WLAN_QCT_PAL_DEVICE_H*/
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
new file mode 100644
index 0000000..fff0aa1
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_list.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.
+ */
+
+#if !defined( __WLAN_QCT_PAL_LIST_H )
+#define __WLAN_QCT_PAL_LIST_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_list.h
+  
+  \brief define linked list PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform independent. 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_os_list.h"
+
+
+#endif // __WLAN_QCT_PAL_LIST_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
new file mode 100644
index 0000000..34f1cce
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
@@ -0,0 +1,89 @@
+/*
+ * 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_QCT_PAL_MSG_H )
+#define __WLAN_QCT_PAL_MSG_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_msg.h
+  
+  \brief define general message APIs PAL exports to support legacy UMAC. 
+   wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform dependent. Only work with legacy UMAC.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+
+typedef struct swpt_msg wpt_msg;
+
+typedef void (*wpal_msg_callback)(wpt_msg *pMsg);
+
+struct swpt_msg
+{
+   wpt_uint16 type;
+   wpt_uint16 reserved;
+   void *ptr;
+   wpt_uint32 val;
+   wpal_msg_callback callback;
+   void *pContext;
+}; 
+
+
+/*---------------------------------------------------------------------------
+   wpalPostCtrlMsg – Post a message to control context so it can 
+                           be processed in that context.
+   Param: 
+      pPalContext – A PAL context
+      pMsg – a pointer to called allocated object; Caller retain the ownership 
+             after this API returns.
+---------------------------------------------------------------------------*/
+wpt_status wpalPostCtrlMsg(void *pPalContext, wpt_msg *pMsg);
+
+
+/*---------------------------------------------------------------------------
+   wpalPostTxMsg – Post a message to TX context so it can be processed in that context.
+   Param: 
+      pPalContext – A PAL context
+      pMsg – a pointer to called allocated object; Caller retain the ownership 
+             after this API returns.
+---------------------------------------------------------------------------*/
+wpt_status wpalPostTxMsg(void *pPalContext, wpt_msg *pMsg);
+
+/*---------------------------------------------------------------------------
+   wpalPostRxMsg – Post a message to RX context so it can be processed in that context.
+   Param: 
+      pPalContext – A PAL context
+      pMsg – a pointer to called allocated object; Caller retain the ownership 
+             after this API returns.
+---------------------------------------------------------------------------*/
+wpt_status wpalPostRxMsg(void *pPalContext, wpt_msg *pMsg);
+
+
+
+#endif // __WLAN_QCT_PAL_API_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
new file mode 100644
index 0000000..2c23501
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
@@ -0,0 +1,308 @@
+/*
+ * 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_QCT_PAL_PACKET_H )
+#define __WLAN_QCT_PAL_PACKET_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_packet.h
+  
+  \brief define PAL packet. wpt = (Wlan Pal Type)
+               
+   Definitions for platform independent.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+
+// The size of the data buffer in vos/pal packets
+// Explanation:
+// MTU size  = 1500 bytes
+// Max number of BD/PDUs required to hold payload of 1500 =
+//   12 PDUs (124 bytes each) + 1 BD (12 bytes for payload) =
+//   13 BD/PDUs = 13 x 128 = 1664 bytes
+//
+// In case of A-MSDU with each MSDU having payload of 1500 bytes:
+//   1st MSDU = requires 13 BD/PDUs as per the above equation.
+//   2nd MSDU = HW inserts an extra BD to hold the information of the 2nd
+//   MSDU and the payload portion of this BD is unused which means to cover
+//   1500 bytes we require 13 PDUs.
+//   So 13 PDUs + 1 BD = 14 BD/PDUs = 1792 bytes.
+//
+// HOWEVER
+// In case of A-MSDU with errors, the ADU will push to the host up to
+// 2346 bytes.  If that is the 2nd or later MSDU the worst case is:
+//   1 Prepended BD/PDU
+//   1 BD/PDU containing the 1st 4 bytes of the delimiter
+//   1 BD/PDU containing the last 10 bytes of the delimiter
+//     plus the first 114 of the payload
+//   18 BD/PDUs containing the remaining 2232 bytes of the payload
+//     2346 - 114 = 2232; 2232 / 124 = 18
+//   So 21 BD/PDUs are required
+#define VPKT_SIZE_BUFFER  (21 * 128)
+
+typedef enum
+{
+   ///Packet is used to transmit 802.11 Management frames.
+   eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT,
+   ///Packet is used to transmit 802.11 Data frames.
+   eWLAN_PAL_PKT_TYPE_TX_802_11_DATA,
+   ///Packet is used to transmit 802.3 Data frames.
+   eWLAN_PAL_PKT_TYPE_TX_802_3_DATA,
+   ///Packet contains Received data of an unknown frame type
+   eWLAN_PAL_PKT_TYPE_RX_RAW
+} wpt_packet_type;
+
+
+typedef struct swpt_packet
+{
+   /*
+   Pointer to a buffer for BD for TX packets
+   For RX packets. The pBD MUST set to NULL.
+   PAL packet shall set the pointer point to the start of the flat buffer
+   where the BD starts.
+   */
+   void *pBD;
+   //Physical address for pBD for DMA-able devices
+   void *pBDPhys; 
+   //OS dependent strucutre used only by OS specific code.
+   void *pOSStruct;  
+   void *pktMetaInfo;
+   wpt_packet_type pktType;
+   //The number of bytes pBD uses. It MUST be set to 0 for RX packets
+   wpt_uint16 BDLength;
+
+   //Internal data for PAL packet implementation usage only
+   void *pInternalData; 
+} wpt_packet;
+
+typedef struct swpt_iterator
+{
+   void *pNext;  
+   void *pCur;
+   void *pContext;
+} wpt_iterator;
+
+
+//pPkt is a pointer to wpt_packet
+#define WPAL_PACKET_SET_BD_POINTER(pPkt, pBd)   ( (pPkt)->pBD = (pBd) )
+#define WPAL_PACKET_GET_BD_POINTER(pPkt)  ( (pPkt)->pBD )
+//Access the physical address of BD
+#define WPAL_PACKET_SET_BD_PHYS(pPkt, pBdPhys)   ( (pPkt)->pBDPhys = (pBdPhys) )
+#define WPAL_PACKET_GET_BD_PHYS(pPkt)  ( (pPkt)->pBDPhys )
+#define WPAL_PACKET_SET_BD_LENGTH(pPkt, len)   ( (pPkt)->BDLength = (len) )
+#define WPAL_PACKET_GET_BD_LENGTH(pPkt)  ( (pPkt)->BDLength )
+#define WPAL_PACKET_SET_METAINFO_POINTER(pPkt, p) ( (pPkt)->pktMetaInfo = (p) )
+#define WPAL_PACKET_GET_METAINFO_POINTER(pPkt) ( (pPkt)->pktMetaInfo )
+#define WPAL_PACKET_SET_TYPE(pPkt, type)  ( (pPkt)->pktType = (type) )
+#define WPAL_PACKET_GET_TYPE(pPkt)  ( (pPkt)->pktType )
+#define WPAL_PACKET_SET_OS_STRUCT_POINTER(pPkt, pStruct)   ( (pPkt)->pOSStruct = (pStruct) )
+#define WPAL_PACKET_GET_OS_STRUCT_POINTER(pPkt)  ( (pPkt)->pOSStruct )
+#define WPAL_PACKET_IS_FLAT_BUF(pktType) ( (eWLAN_PAL_PKT_TYPE_RX_RAW == (pktType)) || \
+                                           (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == (pktType)) )
+
+/* RX RAW packet alloc fail due to out of resource CB function type */
+typedef void ( *wpalPacketLowPacketCB )( wpt_packet *pPacket, void *usrData );
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketInit – Initialize all wpt_packet related objects. Allocate memory for wpt_packet. 
+    Allocate memory for TX management frames and RX frames.
+    For our legacy UMAC, it is not needed because vos_packet contains wpt_packet.
+    Param: 
+        pPalContext – A context PAL uses??
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS -- success
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketInit(void *pPalContext);
+
+/*---------------------------------------------------------------------------
+    wpalPacketClose – Free all allocated resource by wpalPacketInit.
+    For our legacy UMAC, it is not needed because vos_packet contains pal_packet.
+    Param: 
+        pPalContext – A context PAL uses??
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS -- success
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketClose(void *pPalContext);
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketAlloc – Allocate a wpt_packet from PAL.
+    Param: 
+        pPalContext – A context PAL uses??
+        pktType – specify the type of wpt_packet to allocate
+        nPktSize - specify the maximum size of the packet buffer.
+    Return:
+        A pointer to the wpt_packet. NULL means fail.
+---------------------------------------------------------------------------*/
+wpt_packet * wpalPacketAlloc(wpt_packet_type pktType, wpt_uint32 nPktSize,
+                             wpalPacketLowPacketCB rxLowCB, void *usrdata);
+
+/*---------------------------------------------------------------------------
+    wpalPacketFree – Free a wpt_packet chain for one particular type.
+    Packet type is carried in wpt_packet structure.
+    Param: 
+        pPalContext – A context PAL uses??
+        pPkt - pointer to a packet to be freed.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketFree(wpt_packet *pPkt);
+
+/*---------------------------------------------------------------------------
+    wpalPacketGetLength – Get number of bytes in a wpt_packet.
+    Param: 
+        pPalContext – PAL context returned from PAL open
+        pPkt - pointer to a packet to be freed.
+    Return:
+        Length of the data include layer-2 headers. For example, if the frame is 802.3, 
+        the length includes the ethernet header.
+---------------------------------------------------------------------------*/
+wpt_uint32 wpalPacketGetLength(wpt_packet *pPkt);
+
+/*---------------------------------------------------------------------------
+    wpalPacketRawTrimHead – Move the starting offset and reduce packet length.
+          The function can only be used with raw packets,
+          whose buffer is one piece and allocated by WLAN driver. 
+    Param: 
+        pPkt - pointer to a wpt_packet.
+        size – number of bytes to take off the head.
+    Return:
+        eWPAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketRawTrimHead(wpt_packet *pPkt, wpt_uint32 size);
+
+/*---------------------------------------------------------------------------
+    wpalPacketRawTrimTail – reduce the length of the packet. The function can 
+          only be used with raw packets, whose buffer is one piece and 
+          allocated by WLAN driver. This also reduce the length of the packet.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+        size – number of bytes to take of the packet length
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Otherwise fail.
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketRawTrimTail(wpt_packet *pPkt, wpt_uint32 size);
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketGetRawBuf – Return the starting buffer's virtual address for the RAW flat buffer
+    It is inline in hope of faster implementation for certain platform.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+    Return:
+        NULL - fail.
+        Otherwise the address of the starting of the buffer
+---------------------------------------------------------------------------*/
+extern WPT_INLINE wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt);
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketSetRxLength – Set the valid data length on a RX packet. This function must 
+    be called once per RX packet per receiving. It indicates the available data length from
+    the start of the buffer.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+    Return:
+        NULL - fail.
+        Otherwise the address of the starting of the buffer
+---------------------------------------------------------------------------*/
+extern WPT_INLINE wpt_status wpalPacketSetRxLength(wpt_packet *pPkt, wpt_uint32 len);
+
+
+/*---------------------------------------------------------------------------
+    wpalIteratorInit – Initialize an interator by updating pCur to first item.
+    Param: 
+        pIter – pointer to a caller allocated wpt_iterator
+        pPacket – pointer to a wpt_packet
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalIteratorInit(wpt_iterator *pIter, wpt_packet *pPacket);
+
+/*---------------------------------------------------------------------------
+    wpalIteratorNext – Get the address for the next item
+    Param: 
+        pIter – pointer to a caller allocated wpt_iterator
+        pPacket – pointer to a wpt_packet
+        ppAddr – Caller allocated pointer to return the address of the item. For DMA-able devices, this is the physical address of the item.
+        pLen – To return the number of bytes in the item.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalIteratorNext(wpt_iterator *pIter, wpt_packet *pPacket, void **ppAddr, wpt_uint32 *pLen);
+
+
+/*---------------------------------------------------------------------------
+    wpalLockPacketForTransfer – Packet must be locked before transfer can begin,
+    the lock will ensure that the DMA engine has access to the data packet
+    in a cache coherent manner
+ 
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalLockPacketForTransfer( wpt_packet *pPacket);
+
+/*---------------------------------------------------------------------------
+    wpalUnlockPacket – Once the transfer has been completed the packet should
+                       be unlocked so that normal operation may resume
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalUnlockPacket( wpt_packet *pPacket);
+
+/*---------------------------------------------------------------------------
+    wpalPacketGetFragCount – Get count of memory chains (fragments)
+                       in a packet
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        memory fragment count in a packet
+---------------------------------------------------------------------------*/
+wpt_int32 wpalPacketGetFragCount(wpt_packet *pPkt);
+
+/*---------------------------------------------------------------------------
+    wpalIsPacketLocked –  Check whether the Packet is locked for DMA.
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS
+        eWLAN_PAL_STATUS_E_FAILURE
+        eWLAN_PAL_STATUS_E_INVAL
+---------------------------------------------------------------------------*/
+wpt_status wpalIsPacketLocked( wpt_packet *pPacket);
+
+#endif // __WLAN_QCT_PAL_PACKET_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
new file mode 100644
index 0000000..9cf532a
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
@@ -0,0 +1,92 @@
+/*
+ * 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_QCT_PAL_STATUS_H )
+#define __WLAN_QCT_PAL_STATUS_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_status.h
+  
+  \brief define status PAL exports. wpt = (Wlan Pal Type)
+               
+   Definitions for platform independent. 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+typedef enum
+{
+   /// Request succeeded!
+   eWLAN_PAL_STATUS_SUCCESS,
+   
+   /// Request failed because system resources (other than memory) to 
+   /// fulfill request are not available. 
+   eWLAN_PAL_STATUS_E_RESOURCES,
+  
+   /// Request failed because not enough memory is available to 
+   /// fulfill the request.
+   eWLAN_PAL_STATUS_E_NOMEM,  
+      
+   /// Request failed because there of an invalid request.  This is 
+   /// typically the result of invalid parameters on the request.
+   eWLAN_PAL_STATUS_E_INVAL,
+   
+   /// Request failed because handling the request would cause a 
+   /// system fault.  This error is typically returned when an 
+   /// invalid pointer to memory is detected.
+   eWLAN_PAL_STATUS_E_FAULT,
+
+   /// Request failed because device or resource is busy. 
+   eWLAN_PAL_STATUS_E_BUSY,
+
+   /// Request did not complete because it was canceled.
+   eWLAN_PAL_STATUS_E_CANCELED,
+
+   /// Request did not complete because it was aborted.
+   eWLAN_PAL_STATUS_E_ABORTED,
+   
+   /// Request failed because the request is valid, though not supported
+   /// by the entity processing the request.
+   eWLAN_PAL_STATUS_E_NOSUPPORT,
+   
+   /// Request failed because of an empty condition
+   eWLAN_PAL_STATUS_E_EMPTY,
+  
+   /// Existance failure.  Operation could not be completed because
+   /// something exists or does not exist.  
+   eWLAN_PAL_STATUS_E_EXISTS,
+   
+   /// Operation timed out
+   eWLAN_PAL_STATUS_E_TIMEOUT,
+   
+   /// Request failed for some unknown reason.  Note don't use this
+   /// status unless nothing else applies
+   eWLAN_PAL_STATUS_E_FAILURE,
+} wpt_status;
+
+
+#define WLAN_PAL_IS_STATUS_SUCCESS(status) ( eWLAN_PAL_STATUS_SUCCESS == (status) )
+
+#endif // __WLAN_QCT_PAL_STATUS_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
new file mode 100644
index 0000000..14158ba
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.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.
+ */
+
+#if !defined( __WLAN_QCT_PAL_SYNC_H )
+#define __WLAN_QCT_PAL_SYNC_H
+
+/**=========================================================================
+  
+  \file  wlan_pal_sync.h
+  
+  \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform independent. 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_os_sync.h"
+
+
+#define WLAN_PAL_WAIT_INFINITE    0xFFFFFFFF
+
+/*---------------------------------------------------------------------------
+    wpalMutexInit – initialize a mutex object
+    Param:
+        pMutex – a pointer to caller allocated object of wpt_mutex
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexInit(wpt_mutex *pMutex);
+
+/*---------------------------------------------------------------------------
+    wpalMutexDelete – invalidate a mutex object
+    Param:
+        pMutex – a pointer to caller allocated object of wpt_mutex
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexDelete(wpt_mutex *pMutex);
+
+/*---------------------------------------------------------------------------
+    wpalMutexAcquire – acquire a mutex object. It is blocked until the object is acquired.
+    Param:
+        pMutex – a pointer to caller allocated object of wpt_mutex
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexAcquire(wpt_mutex *pMutex);
+
+/*---------------------------------------------------------------------------
+    wpalMutexRelease – Release a held mutex object
+    Param:
+        pMutex – a pointer to caller allocated object of wpt_mutex
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexRelease(wpt_mutex *pMutex);
+
+/*---------------------------------------------------------------------------
+    wpalEventInit – initialize an event object
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventInit(wpt_event *pEvent);
+
+/*---------------------------------------------------------------------------
+    wpalEventDelete – invalidate an event object
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventDelete(wpt_event *pEvent);
+
+/*---------------------------------------------------------------------------
+    wpalEventWait – Wait on an event object
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+        timeout – timerout value at unit of milli-seconds. 0xffffffff means infinite wait
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventWait(wpt_event *pEvent, wpt_uint32 timeout);
+
+/*---------------------------------------------------------------------------
+    wpalEventSet – Set an event object to signaled state
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventSet(wpt_event *pEvent);
+
+/*---------------------------------------------------------------------------
+    wpalEventReset – Set an event object to non-signaled state
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventReset(wpt_event *pEvent);
+
+
+#endif // __WLAN_QCT_PAL_SYNC_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
new file mode 100644
index 0000000..7bdcff7
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
@@ -0,0 +1,104 @@
+/*
+ * 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_QCT_PAL_TIMER_H )
+#define __WLAN_QCT_PAL_TIMER_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_timer.h
+  
+  \brief define synchronization objects PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform independent.
+  
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+#include "wlan_qct_os_timer.h"
+
+
+typedef void (*wpal_timer_callback)(void *pUserData);
+
+typedef struct
+{
+   wpt_os_timer timer;
+   wpal_timer_callback callback;
+   void *pUserData;
+} wpt_timer;
+
+
+/*---------------------------------------------------------------------------
+    wpalTimerInit - initialize a wpt_timer object
+    Param:
+        pTimer - a pointer to caller allocated wpt_timer object
+        callback - A callback function
+        pUserData - A pointer to data pass as parameter of the callback function.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerInit(wpt_timer * pTimer, wpal_timer_callback callback, void *pUserData);
+
+/*---------------------------------------------------------------------------
+    wpalTimerDelete - invalidate a wpt_timer object
+    Param:
+        pTimer - a pointer to caller allocated wpt_timer object
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerDelete(wpt_timer * pTimer);
+
+/*---------------------------------------------------------------------------
+    wpalTimerStart - start a wpt_timer object with a timeout value
+    Param:
+        pTimer - a pointer to caller allocated wpt_timer object
+        timeout - timeout value of the timer. In unit of milli-seconds.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout);
+
+/*---------------------------------------------------------------------------
+    wpalTimerStop - stop a wpt_timer object. Stop doesn’t guarantee the timer handler is not called if it is already timeout.
+    Param:
+        pTimer - a pointer to caller allocated wpt_timer object
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerStop(wpt_timer * pTimer);
+
+/*---------------------------------------------------------------------------
+    wpalSleep - sleep for a specified interval
+    Param:
+        timeout - amount of time to sleep. In unit of milli-seconds.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalSleep(wpt_uint32 timeout);
+
+
+
+#endif // __WLAN_QCT_PAL_TIMER_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
new file mode 100644
index 0000000..612e704
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
@@ -0,0 +1,132 @@
+/*
+ * 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_QCT_PAL_TRACE_H )
+#define __WLAN_QCT_PAL_TRACE_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_api.h
+  
+  \brief define general APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform independent
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_type.h"
+#include "wlan_qct_pal_status.h"
+
+typedef enum
+{
+   // NONE means NO traces will be logged.  This value is in place for the 
+   // vos_trace_setlevel() to allow the user to turn off all traces.
+   eWLAN_PAL_TRACE_LEVEL_NONE = 0,
+   
+   // the following trace levels are the ones that 'callers' of VOS_TRACE()
+   // can specify in for the VOS_TRACE_LEVEL parameter.  Traces are classified
+   // by severity (FATAL being more serious than INFO for example).   
+   eWLAN_PAL_TRACE_LEVEL_FATAL,
+   eWLAN_PAL_TRACE_LEVEL_ERROR, 
+   eWLAN_PAL_TRACE_LEVEL_WARN,  
+   eWLAN_PAL_TRACE_LEVEL_INFO,
+   eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
+   eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+   eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+   
+   // ALL means all trace levels will be active.  This value is in place for the 
+   // vos_trace_setlevel() to allow the user to turn ON all traces.
+   eWLAN_PAL_TRACE_LEVEL_ALL, 
+   
+   // not a real level.  Used to identify the maximum number of 
+   // VOS_TRACE_LEVELs defined.
+   eWLAN_PAL_TRACE_LEVEL_COUNT
+} wpt_tracelevel;
+
+#include "wlan_qct_os_trace.h"
+
+/*----------------------------------------------------------------------------
+  
+  \brief wpalTraceSetLevel() - Set the trace level for a particular module
+  
+  This is an external API that allows trace levels to be set for each module.
+  
+  \param module - id of the module whos trace level is being modified
+  \param level - trace level.   A member of the wpt_tracelevel 
+         enumeration indicating the severity of the condition causing the
+         trace message to be issued.   More severe conditions are more 
+         likely to be logged.
+  \param on - boolean to indicate if tracing at the given level should be
+         enabled or disabled.
+         
+  \return  nothing
+    
+  \sa
+  --------------------------------------------------------------------------*/
+void wpalTraceSetLevel( wpt_moduleid module, wpt_tracelevel level,
+                        wpt_boolean on );
+
+/**----------------------------------------------------------------------------
+  
+  \brief wpalTraceCheckLevel() 
+  
+  This is an external API that returns a boolean value to signify if a 
+  particular trace level is set for the specified module.
+  
+  \param level - trace level.   A member of the wpt_tracelevel enumeration 
+                 indicating the severity of the condition causing the trace 
+                 message to be issued.
+         
+                 Note that individual trace levels are the only valid values
+                 for this API.  eWLAN_PAL_TRACE_LEVEL_NONE and eWLAN_PAL_TRACE_LEVEL_ALL
+                 are not valid input and will return FALSE
+
+  \return  eWLAN_PAL_FALSE - the specified trace level for the specified module is OFF 
+    
+           eWLAN_PAL_TRUE - the specified trace level for the specified module is ON
+    
+  \sa 
+  --------------------------------------------------------------------------*/
+wpt_boolean wpalTraceCheckLevel( wpt_moduleid module, wpt_tracelevel level );
+
+
+/*----------------------------------------------------------------------------
+  
+  \brief wpalTraceDisplay() - Display current state of trace level for
+                              all modules
+  
+  This is an external API that allows trace levels to be displayed to
+  an end user
+  
+  \param none
+
+  \return  nothing
+    
+  \sa
+  --------------------------------------------------------------------------*/
+void wpalTraceDisplay(void);
+
+
+#endif // __WLAN_QCT_PAL_TRACE_H
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
new file mode 100644
index 0000000..e8affb4
--- /dev/null
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
@@ -0,0 +1,125 @@
+/*
+ * 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_QCT_PAL_TYPE_H )
+#define __WLAN_QCT_PAL_TYPE_H
+
+/**=========================================================================
+  
+  \file  wlan_qct_pal_type.h
+  
+  \brief define basic types PAL exports. wpt = (Wlan Pal Type)
+               
+   Definitions for platform independent. 
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+#include "wlan_qct_os_type.h"
+
+typedef wpt_uint8 wpt_macAddr[6];
+
+enum
+{
+   eWLAN_PAL_FALSE = 0,
+   eWLAN_PAL_TRUE = 1,
+};
+
+typedef enum
+{
+   eWLAN_MODULE_DAL,
+   eWLAN_MODULE_DAL_CTRL,
+   eWLAN_MODULE_DAL_DATA,
+   eWLAN_MODULE_PAL,
+   
+   //Always the last one
+   eWLAN_MODULE_COUNT
+} wpt_moduleid;
+
+
+typedef struct
+{
+   //BIT order is most likely little endian. 
+   //This structure is for netowkr-order byte array (or big-endian byte order)
+#ifndef WLAN_PAL_BIG_ENDIAN_BIT
+   wpt_byte protVer :2;
+   wpt_byte type :2;
+   wpt_byte subType :4;
+
+   wpt_byte toDS :1;
+   wpt_byte fromDS :1;
+   wpt_byte moreFrag :1;
+   wpt_byte retry :1;
+   wpt_byte powerMgmt :1;
+   wpt_byte moreData :1;
+   wpt_byte wep :1;
+   wpt_byte order :1;
+
+#else
+
+   wpt_byte subType :4;
+   wpt_byte type :2;
+   wpt_byte protVer :2;
+
+   wpt_byte order :1;
+   wpt_byte wep :1;
+   wpt_byte moreData :1;
+   wpt_byte powerMgmt :1;
+   wpt_byte retry :1;
+   wpt_byte moreFrag :1;
+   wpt_byte fromDS :1;
+   wpt_byte toDS :1;
+
+#endif
+
+} wpt_FrameCtrl;
+
+typedef struct
+{
+   /* Frame control field */
+   wpt_FrameCtrl frameCtrl;
+   /* Duration ID */
+   wpt_uint16 usDurationId;
+   /* Address 1 field  */
+   wpt_macAddr vA1;
+   /* Address 2 field */
+   wpt_macAddr vA2;
+   /* Address 3 field */
+   wpt_macAddr vA3;
+   /* Sequence control field */
+   wpt_uint16 sSeqCtrl;
+   /* Optional A4 address */
+   wpt_macAddr optvA4;
+   /* Optional QOS control field */
+   wpt_uint16  usQosCtrl;
+}wpt_80211Header;
+
+typedef struct
+{
+   wpt_macAddr dest;
+   wpt_macAddr sec;
+   wpt_uint16 lenOrType;
+} wpt_8023Header;
+
+
+#endif // __WLAN_QCT_PAL_TYPE_H
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_api.c b/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
new file mode 100644
index 0000000..c973b73
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
@@ -0,0 +1,378 @@
+/*
+ * 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  wlan_qct_pal_api.c
+  
+  \brief Implementation general APIs PAL exports.
+   wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform Windows.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_trace.h"
+#include "wlan_qct_pal_device.h"
+#include "vos_trace.h"
+#ifndef MEMORY_DEBUG
+#include "vos_memory.h"
+#endif /* MEMORY_DEBUG */
+#include "vos_api.h"
+
+#include "dma-mapping.h"
+#include <mach/subsystem_restart.h>
+
+typedef struct sPalStruct
+{
+   /*?must check the data type*/
+   void* devHandle;
+} tPalContext;
+
+#define WPAL_GET_NDIS_HANDLE(p)  ( ((tPalContext *)(p))->devHandle )
+
+tPalContext gContext;
+
+//This structure need to be 4-byte aligned. No packing.
+typedef struct
+{
+   wpt_uint32 length;
+   //The offset from beginning of the buffer where it is allocated
+   wpt_uint32 offset;   
+   wpt_uint32 phyAddr;
+} tPalDmaMemInfo;
+
+/*===========================================================================
+
+                            FUNCTIONS
+
+===========================================================================*/
+
+/**
+ * @brief Initialize PAL
+ *        In case of QNP, this does nothing.
+ * @param ppPalContext pointer to a caller allocated pointer. It 
+ *                     is opaque to caller.
+ *                    Caller save the returned pointer for future use when
+ *                    calling PAL APIs.
+ * @param pOSContext Pointer to a context that is OS specific. This is NULL is a 
+                     particular PAL doesn't use it for that OS.
+ * 
+ * @return wpt_status eWLAN_PAL_STATUS_SUCCESS - success. Otherwise fail.
+ */
+wpt_status wpalOpen(void **ppPalContext, void *pOSContext)
+{
+   wpt_status status;
+
+   gContext.devHandle = pOSContext;
+
+   status = wpalDeviceInit(pOSContext);
+   if (!WLAN_PAL_IS_STATUS_SUCCESS(status))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: wpalDeviceInit failed with status %u",
+                 __FUNCTION__, status);
+   }
+
+   return status;
+}
+
+/**
+ * @brief wpalClose - Release PAL
+ *                    In case of QNP, this does nothing.
+ * @param pPalContext pointer returned from wpalOpen.
+ * 
+ * @return wpt_status eWLAN_PAL_STATUS_SUCCESS - success. Otherwise fail.
+ */
+wpt_status wpalClose(void *pPalContext)
+{
+   wpalDeviceClose(gContext.devHandle);
+   gContext.devHandle = NULL;
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+#ifndef MEMORY_DEBUG
+/**
+ * @brief wpalMemoryAllocate -  Allocate memory
+ * @param size number of bytes to allocate
+ * 
+ * @return void* A pointer to the allocated memory.
+ * NULL - fail to allocate memory 
+ */
+void *wpalMemoryAllocate(wpt_uint32 size)
+{
+   return vos_mem_malloc( size );
+}
+
+/**
+ * @brief wpalMemoryFree -  Free allocated memory
+ * @param pv pointer to buffer to be freed
+ */
+void wpalMemoryFree(void *pv)
+{
+   vos_mem_free( pv );
+}
+#endif /* MEMORY_DEBUG */
+/**
+ * @brief wpalMemoryCopy -  copy memory
+ * @param dest address which data is copied to
+ * @param src address which data is copied from
+ * @param size number of bytes to copy
+ * 
+ * @return wpt_status
+ *         eWLAN_PAL_STATUS_SUCCESS
+ *         eWLAN_PAL_STATUS_INVALID_PARAM
+ */
+wpt_status wpalMemoryCopy(void * dest, void * src, wpt_uint32 size)
+{
+   vos_mem_copy( dest, src, size );
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+ * @brief wpalMemoryCompare -  compare memory
+ * @param buf1 address of buffer1
+ * @param buf2 address of buffer2
+ * @param size number of bytes to compare
+ * 
+ * @return wpt_boolean
+ *        eWLAN_PAL_TRUE - if two buffers have same content
+ *        eWLAN_PAL_FALSE - not match
+ */
+wpt_boolean wpalMemoryCompare(void * buf1, void * buf2, wpt_uint32 size)
+{
+   return (wpt_boolean)vos_mem_compare( buf1, buf2, size );
+}
+
+
+/*---------------------------------------------------------------------------
+    wpalMemoryZero -  Zero memory
+    Param: 
+       buf - address of buffer to be zero
+       size - number of bytes to zero
+    Return:
+       None
+---------------------------------------------------------------------------*/
+void wpalMemoryZero(void *buf, wpt_uint32 size)
+{
+   vos_mem_zero( buf, size );
+}
+
+/**
+ * @brief wpalMemoryFill -  Fill memory with one pattern
+ * @param buf address of buffer to be filled
+ * @param size number of bytes to fill
+ * @param bFill one byte of data to fill in (size) bytes from the start of the 
+ * buffer
+ */
+void wpalMemoryFill(void *buf, wpt_uint32 size, wpt_byte bFill)
+{
+   vos_mem_set( buf, size, bFill );
+}
+
+/**
+ * @brief wpalDmaMemoryAllocate -  Allocate memory ready for DMA. Aligned at 4-byte
+ * @param size number of bytes to allocate
+ * @param ppPhysicalAddr Physical address of the buffer if allocation succeeds
+ * 
+ * @return void* A pointer to the allocated memory (virtual address). 
+ *               NULL - fail to allocate memory
+ */
+void *wpalDmaMemoryAllocate(wpt_uint32 size, void **ppPhysicalAddr)
+{
+   void *pv = NULL;
+   dma_addr_t PhyAddr;
+   wpt_uint32 uAllocLen = size + sizeof(tPalDmaMemInfo);
+   
+   pv = dma_alloc_coherent(NULL, uAllocLen, &PhyAddr, GFP_KERNEL);
+   if ( NULL == pv ) 
+   {
+     WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 "%s Unable to allocate DMA buffer\n", __FUNCTION__);
+     return NULL;
+   }
+
+   
+   ((tPalDmaMemInfo *)pv)->length  = uAllocLen;
+   ((tPalDmaMemInfo *)pv)->phyAddr = PhyAddr;
+   ((tPalDmaMemInfo *)pv)->offset  = sizeof(tPalDmaMemInfo);
+   pv                              = (wpt_byte *)pv + sizeof(tPalDmaMemInfo);
+   *ppPhysicalAddr                 = (void*)PhyAddr + sizeof(tPalDmaMemInfo);
+
+
+   return (pv);
+}/*wpalDmaMemoryAllocate*/
+
+
+/**
+ * @brief wpalDmaMemoryFree -  Free memory ready for DMA
+ * @param pv address for the buffer to be freed
+ */
+void wpalDmaMemoryFree(void *pv)
+{
+   tPalDmaMemInfo *pMemInfo = (tPalDmaMemInfo *)(((wpt_byte *)pv) -
+                                      sizeof(tPalDmaMemInfo));
+    if(pv)
+    { 
+        pv = (wpt_byte *)pv - pMemInfo->offset;
+        dma_free_coherent(NULL, pMemInfo->length, pv, pMemInfo->phyAddr);
+    }
+
+}/*wpalDmaMemoryFree*/
+
+/**
+ * @brief wpalDbgReadRegister -  Read register from the WiFi BB 
+              chip
+ * @param regAddr - register address
+ * @param  pregValue - return value from register if success
+ * @return
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+ */
+wpt_status wpalDbgReadRegister(wpt_uint32 regAddr, wpt_uint32 *pregValue)
+{
+   if (NULL == pregValue)
+   {
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   return wpalReadRegister(regAddr, pregValue);
+}
+
+/** 
+ * @brief wpalDbgWriteRegister -  Write a value to the register
+ *  in the WiFi BB chip Param:
+ * @param regAddr - register address
+ * @param regValue - value to be written
+ * @return
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+*/
+wpt_status wpalDbgWriteRegister(wpt_uint32 regAddr, wpt_uint32 regValue)
+{
+   return wpalWriteRegister(regAddr, regValue);
+}
+
+/** 
+ * @brief 
+     wpalDbgReadMemory -  Read memory from WiFi BB chip space
+ * @param memAddr - address of memory 
+ * @param buf - output 
+ * @param len - length to be read
+ * @return
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+*/
+wpt_status wpalDbgReadMemory(wpt_uint32 memAddr, wpt_uint8 *buf, wpt_uint32 len)
+{
+   return wpalReadDeviceMemory(memAddr, buf, len);
+}
+
+/** 
+ * @brief 
+    wpalDbgWriteMemory -  Write a value to the memory in the WiFi BB chip space
+ * @param memAddr - memory address 
+ * @param buf - vlaue to be written
+ * @param len - length of buf
+ * @return
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+*/
+wpt_status wpalDbgWriteMemory(wpt_uint32 memAddr, wpt_uint8 *buf, wpt_uint32 len)
+{
+   return wpalWriteDeviceMemory(memAddr, buf, len);
+}
+
+/*---------------------------------------------------------------------------
+    wpalDriverShutdown -  Shutdown WLAN driver
+
+    This API is requied by SSR, call in to 'VOS shutdown' to shutdown WLAN 
+    driver when Riva crashes.
+
+    Param: 
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDriverShutdown(void)
+{
+    VOS_STATUS vosStatus;
+    vosStatus = vos_wlanShutdown();
+
+    if (VOS_STATUS_SUCCESS == vosStatus) {
+        return eWLAN_PAL_STATUS_SUCCESS; 
+    }
+    return eWLAN_PAL_STATUS_E_FAILURE; 
+}
+
+/*---------------------------------------------------------------------------
+    wpalDriverShutdown -  Re-init WLAN driver
+
+    This API is requied by SSR, call in to 'VOS re-init' to re-init WLAN
+    driver.
+
+    Param: 
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalDriverReInit(void)
+{
+    VOS_STATUS vosStatus;
+
+    vosStatus = vos_wlanReInit();
+    if (VOS_STATUS_SUCCESS == vosStatus) {
+        return eWLAN_PAL_STATUS_SUCCESS; 
+    }
+    return eWLAN_PAL_STATUS_E_FAILURE; 
+}
+
+/*---------------------------------------------------------------------------
+    wpalRivaSubystemRestart -  Initiate Riva SSR
+
+    This API is called by WLAN driver to initiate Riva SSR
+
+    Param:
+       None
+    Return:
+       eWLAN_PAL_STATUS_SUCCESS - when everything is OK
+---------------------------------------------------------------------------*/
+wpt_status wpalRivaSubystemRestart(void)
+{
+    /* call SSR only if driver is not in load/unload process.
+     * A WDI timeout during load/unload cannot be fixed thru
+     * SSR */
+    if (vos_is_load_unload_in_progress(VOS_MODULE_ID_WDI, NULL))
+    {
+         WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                 "%s: loading/unloading in progress,"
+                 " SSR will be done at the end of unload", __FUNCTION__);
+         return eWLAN_PAL_STATUS_E_FAILURE;
+    }
+    if (0 == subsystem_restart("riva")) 
+    {
+        return eWLAN_PAL_STATUS_SUCCESS;
+    }
+    return eWLAN_PAL_STATUS_E_FAILURE;
+}
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_device.c b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
new file mode 100644
index 0000000..f37200d
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
@@ -0,0 +1,757 @@
+/*
+ * 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  wlan_qct_pal_device.c
+  
+  @brief 
+               
+  This file implements the device specific HW access interface
+  required by the WLAN Platform Abstraction Layer (WPAL)
+
+  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-03-01  jtj  Initial version for Linux/Android with Wcnss
+
+===========================================================================*/
+
+/*----------------------------------------------------------------------------
+ * Include Files
+ * -------------------------------------------------------------------------*/
+#include <linux/irqreturn.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <mach/msm_smsm.h>
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_device.h"
+#include "wlan_hdd_main.h"
+#include "linux/wcnss_wlan.h"
+
+/*----------------------------------------------------------------------------
+ * Preprocessor Definitions and Constants
+ * -------------------------------------------------------------------------*/
+
+// address in the 8960 physical memory map
+#define WCNSS_BASE_ADDRESS 0x03000000
+
+/*----------------------------------------------------------------------------
+ * Type Declarations
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Global Data Definitions
+ * -------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ * Static Variable Definitions
+ * -------------------------------------------------------------------------*/
+
+static struct wcnss_env {
+   struct resource *wcnss_memory;
+   void __iomem    *mmio;
+   int              tx_irq;
+   wpalIsrType      tx_isr;
+   void            *tx_context;
+   int              rx_irq;
+   wpalIsrType      rx_isr;
+   void            *rx_context;
+   int              rx_registered;
+   int              tx_registered;
+} *gpEnv = NULL;
+
+/*----------------------------------------------------------------------------
+ * Static Function Declarations and Definitions
+ * -------------------------------------------------------------------------*/
+
+/**
+  @brief wpalTxIsr is the interrupt service routine which handles
+         the DXE TX Complete interrupt
+  
+  wpalTxIsr is registered with the Operating System to handle the
+  DXE TX Complete interrupt during system initialization.  When a DXE
+  TX Complete interrupt occurs, it is dispatched to the handler which
+  had previously been registered via wpalRegisterInterrupt.
+  
+  @param  irq:    Enumeration of the interrupt that occurred
+  @param  dev_id: User-supplied data passed back via the ISR
+
+  @see    wpalRegisterInterrupt
+
+  @return IRQ_HANDLED since it is a dedicated interrupt
+*/
+static irqreturn_t wpalTxIsr
+(
+   int irq,
+   void *dev_id
+)
+{
+   if ((NULL != gpEnv) && (NULL != gpEnv->tx_isr)) {
+      gpEnv->tx_isr(gpEnv->tx_context);
+   }
+   return IRQ_HANDLED;
+}
+
+
+/**
+  @brief wpalRxIsr is the interrupt service routine which handles
+         the DXE RX Available interrupt
+  
+  wpalRxIsr is registered with the Operating System to handle the
+  DXE RX Available interrupt during system initalization.  When a DXE
+  RX Available interrupt occurs, it is dispatched to the handler which
+  had previously been registered via wpalRegisterInterrupt.
+  
+  @param  irq:    Enumeration of the interrupt that occurred
+  @param  dev_id: User-supplied data passed back via the ISR
+
+  @see    wpalRegisterInterrupt
+
+  @return IRQ_HANDLED since it is a dedicated interrupt
+*/
+static irqreturn_t wpalRxIsr
+(
+   int irq,
+   void *dev_id
+)
+{
+   if ((NULL != gpEnv) && (NULL != gpEnv->rx_isr)) {
+      gpEnv->rx_isr(gpEnv->rx_context);
+   }
+   return IRQ_HANDLED;
+}
+
+/*----------------------------------------------------------------------------
+ * Externalized Function Definitions
+ * -------------------------------------------------------------------------*/
+
+
+/**
+  @brief wpalRegisterInterrupt provides a mechansim for client
+         to register support for a given interrupt
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can register to support one of these.  It is expected that the core
+  DXE implementation will invoke this API twice, once for each interrupt.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+  @param  callbackFunction: ISR function pointer
+  @param  usrCtxt:          User context passed back whenever the
+                            callbackFunction is invoked
+
+  @return SUCCESS if the registration was successful
+*/
+
+wpt_status wpalRegisterInterrupt
+(
+   wpt_uint32      intType,
+   wpalIsrType     callbackFunction,
+   void            *usrCtxt
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if (NULL == callbackFunction) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked with NULL callback",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   switch (intType) {
+
+   case DXE_INTERRUPT_TX_COMPLE:
+      if (NULL != gpEnv->tx_isr) {
+         /* TX complete handler already registered */
+         WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: TX interrupt handler already registered",
+                 __FUNCTION__);
+         /* fall though and accept the new values */
+      }
+      gpEnv->tx_isr = callbackFunction;
+      gpEnv->tx_context = usrCtxt;
+      break;
+
+   case DXE_INTERRUPT_RX_READY:
+      if (NULL != gpEnv->rx_isr) {
+         /* RX complete handler already registered */
+         WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: RX interrupt handler already registered",
+                 __FUNCTION__);
+         /* fall though and accept the new values */
+      }
+      gpEnv->rx_isr = callbackFunction;
+      gpEnv->rx_context = usrCtxt;
+      break;
+
+   default:
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Unknown interrupt type [%u]",
+                 __FUNCTION__, intType);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalUnRegisterInterrupt provides a mechansim for client
+         to un-register for a given interrupt
+
+  When DXE stop, remove registered information from PAL
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return NONE
+*/
+
+void wpalUnRegisterInterrupt
+(
+   wpt_uint32      intType
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return;
+   }
+
+   switch (intType) {
+
+   case DXE_INTERRUPT_TX_COMPLE:
+      disable_irq_nosync(gpEnv->tx_irq);
+      if (gpEnv->tx_registered)
+      {
+         free_irq(gpEnv->tx_irq, gpEnv);
+         gpEnv->tx_registered = 0;
+      }
+      gpEnv->tx_isr = NULL;
+      gpEnv->tx_context = NULL;
+      break;
+
+   case DXE_INTERRUPT_RX_READY:
+      disable_irq_nosync(gpEnv->rx_irq);
+      if (gpEnv->rx_registered)
+      {
+         free_irq(gpEnv->rx_irq, gpEnv);
+         gpEnv->rx_registered = 0;
+      }
+      gpEnv->rx_isr = NULL;
+      gpEnv->rx_context = NULL;
+      break;
+
+   default:
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Unknown interrupt type [%u]",
+                 __FUNCTION__, intType);
+      return;
+   }
+
+   return;
+}
+
+/**
+  @brief wpalEnableInterrupt provides a mechansim for a client
+         to request that a given interrupt be enabled
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can request that the platform-specific adaptation layer allows a
+  given interrupt to occur.  The expectation is that if a given
+  interrupt is not enabled, if the interrupt occurs then the APPS CPU
+  will not be interrupted.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return SUCCESS if the interrupt was enabled
+*/
+wpt_status wpalEnableInterrupt
+(
+   wpt_uint32    intType
+)
+{
+   int ret;
+   
+   switch (intType) 
+   {
+   case DXE_INTERRUPT_RX_READY:
+      if (!gpEnv->rx_registered) 
+      {
+         gpEnv->rx_registered = 1;
+         ret = request_irq(gpEnv->rx_irq, wpalRxIsr, IRQF_TRIGGER_HIGH,
+                     "wcnss_wlan", gpEnv);
+         if (ret) {
+            WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                       "%s: RX IRQ request failure",
+                       __FUNCTION__);
+           break;
+         }
+      
+        
+         ret = enable_irq_wake(gpEnv->rx_irq);
+         if (ret) {
+            WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                       "%s: enable_irq_wake failed for RX IRQ",
+                       __FUNCTION__);
+            /* not fatal -- keep on going */
+         }
+      }
+      else
+      {
+         enable_irq(gpEnv->rx_irq);
+      }
+      break;
+   case DXE_INTERRUPT_TX_COMPLE:
+      if (!gpEnv->tx_registered) 
+      {
+         gpEnv->tx_registered = 1;
+         ret = request_irq(gpEnv->tx_irq, wpalTxIsr, IRQF_TRIGGER_HIGH,
+                           "wcnss_wlan", gpEnv);
+         if (ret) {
+            WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                       "%s: TX IRQ request failure",
+                       __FUNCTION__);
+            break;
+         }
+   
+   
+         ret = enable_irq_wake(gpEnv->tx_irq);
+         if (ret) {
+            WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                       "%s: enable_irq_wake failed for TX IRQ",
+                       __FUNCTION__);
+            /* not fatal -- keep on going */
+         }
+      }
+      else
+      {
+         enable_irq(gpEnv->tx_irq);
+      }
+      break;
+   default:
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "%s: unknown interrupt: %d",
+                    __FUNCTION__, (int)intType);
+      break;
+   }
+   /* on the integrated platform there is no platform-specific
+      interrupt control */
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalDisableInterrupt provides a mechansim for a client
+         to request that a given interrupt be disabled
+
+  The DXE interface supports two interrupts, TX Complete and RX
+  Available.  This interface provides the mechanism whereby a client
+  can request that the platform-specific adaptation layer not allow a
+  given interrupt to occur.  The expectation is that if a given
+  interrupt is not enabled, if the interrupt occurs then the APPS CPU
+  will not be interrupted.
+  
+  @param  intType:          Enumeration of the interrupt type (TX or RX)
+
+  @return SUCCESS if the interrupt was disabled
+*/
+wpt_status wpalDisableInterrupt
+(
+   wpt_uint32    intType
+)
+{
+   switch (intType) 
+   {
+   case DXE_INTERRUPT_RX_READY:
+      disable_irq_nosync(gpEnv->rx_irq);
+      break;
+   case DXE_INTERRUPT_TX_COMPLE:
+      disable_irq_nosync(gpEnv->tx_irq);
+      break;
+   default:
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "%s: unknown interrupt: %d",
+                    __FUNCTION__, (int)intType);
+      break;
+   }
+
+   /* on the integrated platform there is no platform-specific
+      interrupt control */
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalWriteRegister provides a mechansim for a client
+         to write data into a hardware data register
+
+  @param  address:  Physical memory address of the register
+  @param  data:     Data value to be written
+
+  @return SUCCESS if the data was successfully written
+*/
+wpt_status wpalWriteRegister
+(
+   wpt_uint32   address,
+   wpt_uint32   data
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if ((address < gpEnv->wcnss_memory->start) ||
+       (address > gpEnv->wcnss_memory->end)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Register address 0x%0x out of range 0x%0x - 0x%0x",
+                 __FUNCTION__, address,
+                 gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if (0 != (address & 0x3)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Register address 0x%0x is not word aligned",
+                 __FUNCTION__, address);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   wmb();
+   writel_relaxed(data, gpEnv->mmio + (address - WCNSS_BASE_ADDRESS));
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalReadRegister provides a mechansim for a client
+         to read data from a hardware data register
+
+  @param  address:  Physical memory address of the register
+  @param  data:     Return location for value that is read
+
+  @return SUCCESS if the data was successfully read
+*/
+wpt_status wpalReadRegister
+(
+   wpt_uint32   address,
+   wpt_uint32  *data
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if ((address < gpEnv->wcnss_memory->start) ||
+       (address > gpEnv->wcnss_memory->end)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Register address 0x%0x out of range 0x%0x - 0x%0x",
+                 __FUNCTION__, address,
+                 gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if (0 != (address & 0x3)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Register address 0x%0x is not word aligned",
+                 __FUNCTION__, address);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   *data = readl_relaxed(gpEnv->mmio + (address - WCNSS_BASE_ADDRESS));
+   rmb();
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalWriteDeviceMemory provides a mechansim for a client
+         to write data into the hardware address space
+
+  @param  address:  Start address of physical memory to be written
+  @param  s_buffer: Virtual source address from which the data will
+                    be read
+  @param  len:      Number of bytes of data to be written
+
+  @return SUCCESS if the data was successfully written
+*/
+wpt_status wpalWriteDeviceMemory
+(
+  wpt_uint32 address,
+  wpt_uint8* s_buffer,
+  wpt_uint32 len
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if ((address < gpEnv->wcnss_memory->start) ||
+       ((address + len) > gpEnv->wcnss_memory->end)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Memory address 0x%0x len %d out of range 0x%0x - 0x%0x",
+                 __FUNCTION__, address, len,
+                 gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   memcpy(gpEnv->mmio + (address - WCNSS_BASE_ADDRESS), s_buffer, len);
+   wmb();
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalReadDeviceMemory provides a mechansim for a client
+         to read data from the hardware address space
+
+  @param  address:  Start address of physical memory to be read
+  @param  d_buffer: Virtual destination address to which the
+                    data will be written
+  @param  len:      Number of bytes of data to be read
+
+  @return SUCCESS if the data was successfully read
+*/
+wpt_status wpalReadDeviceMemory
+(
+  wpt_uint32 address,
+  wpt_uint8* d_buffer,
+  wpt_uint32 len
+)
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if ((address < gpEnv->wcnss_memory->start) ||
+       ((address + len) > gpEnv->wcnss_memory->end)) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: Memory address 0x%0x len %d out of range 0x%0x - 0x%0x",
+                 __FUNCTION__, address, len,
+                 gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   memcpy(d_buffer, gpEnv->mmio + (address - WCNSS_BASE_ADDRESS), len);
+   rmb();
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalDeviceInit provides a mechanism to initialize the DXE
+         platform adaptation
+
+  @param  deviceCB:  Implementation-specific device control block
+
+  @see    wpalDeviceClose
+
+  @return SUCCESS if the DXE abstraction was opened
+*/
+wpt_status wpalDeviceInit
+(
+   void * deviceCB
+)
+{
+   hdd_context_t *pHddCtx = (hdd_context_t *)deviceCB;
+   struct device *wcnss_device = pHddCtx->parent_dev;
+   struct resource *wcnss_memory;
+   int tx_irq;
+   int rx_irq;
+
+   if (NULL != gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked  after subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if (NULL == wcnss_device) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invalid device",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   wcnss_memory = wcnss_wlan_get_memory_map(wcnss_device);
+   if (NULL == wcnss_memory) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: WCNSS memory map unavailable",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   tx_irq = wcnss_wlan_get_dxe_tx_irq(wcnss_device);
+   if (0 > tx_irq) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: WCNSS TX IRQ unavailable",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   rx_irq = wcnss_wlan_get_dxe_rx_irq(wcnss_device);
+   if (0 > rx_irq) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: WCNSS RX IRQ unavailable",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   gpEnv = wpalMemoryAllocate(sizeof(*gpEnv));
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: memory allocation failure",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_NOMEM;
+   }
+
+   memset(gpEnv, 0, sizeof(*gpEnv));
+
+   gpEnv->wcnss_memory = wcnss_memory;
+   gpEnv->tx_irq = tx_irq;
+   gpEnv->rx_irq = rx_irq;
+
+   /* note the we don't invoke request_mem_region().
+      the memory described by wcnss_memory encompases the entire
+      register space (including BT and FM) and we do not want
+      exclusive access to that memory */
+
+   gpEnv->mmio = ioremap(wcnss_memory->start, resource_size(wcnss_memory));
+   if (NULL == gpEnv->mmio) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: memory remap failure",
+                 __FUNCTION__);
+      goto err_ioremap;
+   }
+
+   gpEnv->tx_registered = 0;
+   gpEnv->rx_registered = 0;
+
+   /* successfully allocated environment, memory and IRQs */
+   return eWLAN_PAL_STATUS_SUCCESS;
+
+ err_ioremap:
+   wpalMemoryFree(gpEnv);
+   gpEnv = NULL;
+
+   return eWLAN_PAL_STATUS_E_FAILURE;
+
+}
+
+
+/**
+  @brief wpalDeviceClose provides a mechanism to deinitialize the DXE
+         platform adaptation
+
+  @param  deviceCB:  Implementation-specific device control block
+
+  @see    wpalDeviceOpen
+
+  @return SUCCESS if the DXE abstraction was closed
+*/
+wpt_status wpalDeviceClose
+(
+   void * deviceCB
+ )
+{
+   if (NULL == gpEnv) {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: invoked before subsystem initialized",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if (gpEnv->rx_registered)
+   {
+      free_irq(gpEnv->rx_irq, gpEnv);
+   }
+   if (gpEnv->tx_registered)
+   {
+      free_irq(gpEnv->tx_irq, gpEnv);
+   }
+   iounmap(gpEnv->mmio);
+   wpalMemoryFree(gpEnv);
+   gpEnv = NULL;
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/**
+  @brief wpalNotifySmsm provides a mechansim for a client to 
+         notify SMSM to start DXE engine and/or condition of Tx
+         ring buffer
+
+  @param  clrSt:   bit(s) to be cleared on the MASK 
+  @param  setSt:   bit(s) to be set on the MASK
+
+  @return SUCCESS if the operation is successful
+*/
+wpt_status wpalNotifySmsm
+(
+   wpt_uint32                            clrSt,
+   wpt_uint32                            setSt
+)
+{
+   int rc;
+   rc = smsm_change_state(SMSM_APPS_STATE, clrSt, setSt);
+   if(0 != rc) 
+   {
+      WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: smsm_change_state failed",
+                 __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c b/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
new file mode 100644
index 0000000..64d168f
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
@@ -0,0 +1,153 @@
+/*
+ * 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  wlan_qct_pal_msg.c
+  
+  \brief Implementation message APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform with legacy UMAC support.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_msg.h"
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_trace.h"
+#include "vos_mq.h"
+
+
+
+/*---------------------------------------------------------------------------
+     wpalPostCtrlMsg - Post a message to control context so it can be processed in that context.
+    Param: 
+        pPalContext - A PAL context
+        pMsg - a pointer to called allocated opaque object;
+---------------------------------------------------------------------------*/
+wpt_status wpalPostCtrlMsg(void *pPalContext, wpt_msg *pMsg)
+{
+   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
+   vos_msg_t msg;
+
+   if (NULL == pMsg)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: NULL message pointer", __FUNCTION__);
+      WPAL_ASSERT(0);
+      return status;
+   }
+
+   msg.type = 0;  //This field is not used because VOSS doesn't check it.
+   msg.reserved = 0;
+   msg.bodyval = 0;
+   msg.bodyptr = pMsg;
+   if(VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MQ_ID_WDI, &msg)))
+   {
+      status = eWLAN_PAL_STATUS_SUCCESS;
+   }
+   else
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
+                  __FUNCTION__, pMsg->type);
+   }
+
+   return status;
+}
+
+
+
+/*---------------------------------------------------------------------------
+     wpalPostTxMsg - Post a message to TX context so it can be processed in that context.
+    Param: 
+        pPalContext - A PAL context PAL
+        pMsg - a pointer to called allocated opaque object;
+---------------------------------------------------------------------------*/
+wpt_status wpalPostTxMsg(void *pPalContext, wpt_msg *pMsg)
+{
+   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
+   vos_msg_t msg;
+
+   if (NULL == pMsg)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: NULL message pointer", __FUNCTION__);
+      WPAL_ASSERT(0);
+      return status;
+   }
+
+   msg.type = 0; //This field is not used because VOSS doesn't check it.
+   msg.reserved = 0;
+   msg.bodyval = 0;
+   msg.bodyptr = pMsg;
+   if(VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize(VOS_MQ_ID_WDI, &msg)))
+   {
+      status = eWLAN_PAL_STATUS_SUCCESS;
+   }
+   else
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
+                  __FUNCTION__, pMsg->type);
+   }
+
+   return status;
+}
+
+
+/*---------------------------------------------------------------------------
+     wpalPostRxMsg - Post a message to RX context so it can be processed in that context.
+    Param: 
+        pPalContext - A PAL context
+        pMsg - a pointer to called allocated opaque object;
+---------------------------------------------------------------------------*/
+wpt_status wpalPostRxMsg(void *pPalContext, wpt_msg *pMsg)
+{
+   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
+   vos_msg_t msg;
+
+   if (NULL == pMsg)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                 "%s: NULL message pointer", __FUNCTION__);
+      WPAL_ASSERT(0);
+      return status;
+   }
+
+   msg.type = 0; //This field is not used because VOSS doesn't check it.
+   msg.reserved = 0;
+   msg.bodyval = 0;
+   msg.bodyptr = pMsg;
+   if(VOS_IS_STATUS_SUCCESS(vos_rx_mq_serialize(VOS_MQ_ID_WDI, &msg)))
+   {
+      status = eWLAN_PAL_STATUS_SUCCESS;
+   }
+   else
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
+                  __FUNCTION__, pMsg->type);
+   }
+
+   return status;
+}
+
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c b/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
new file mode 100644
index 0000000..5391b91
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
@@ -0,0 +1,772 @@
+/*
+ * 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  wlan_qct_pal_packet.c
+  
+  \brief Implementation for PAL packet. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform with VOSS packet support and LA.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_packet.h"
+#include "wlan_qct_pal_api.h"
+#include "wlan_qct_pal_trace.h"
+#include "vos_packet.h"
+#include "vos_trace.h"
+#include "vos_list.h"
+
+#include <linux/skbuff.h>
+#include "dma-mapping.h"
+
+/*Per spec definition*/
+#define WPAL_ETHERNET_PAKCET_HEADER_SIZE     14
+
+/*Per spec definition - not including QOS field*/
+#define WPAL_802_11_PACKET_HEADER_SIZE    24 
+
+/*p is a pointer to wpt_packet*/
+#define WPAL_TO_VOS_PKT(p) ((vos_pkt_t *)(p))
+
+
+typedef struct
+{
+  void*      pPhyAddr;
+  wpt_uint32 uLen;
+}wpt_iterator_info;
+
+/* Storage for DXE CB function pointer */
+static wpalPacketLowPacketCB wpalPacketAvailableCB = NULL;
+
+/*
+   wpalPacketInit is no-op for VOSS-support wpt_packet
+*/
+wpt_status wpalPacketInit(void *pPalContext)
+{
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+
+/*
+   wpalPacketClose is no-op for VOSS-support wpt_packet
+*/
+wpt_status wpalPacketClose(void *pPalContext)
+{
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    wpalPacketRXLowResourceCB – RX RAW packer CB function
+    Param: 
+        pPacket – Available RX packet
+        userData - PAL Client Context, DXE
+    Return:
+        Status
+---------------------------------------------------------------------------*/
+VOS_STATUS wpalPacketRXLowResourceCB(vos_pkt_t *pPacket, v_VOID_t *userData)
+{
+   VOS_STATUS   vosStatus = VOS_STATUS_E_FAILURE;
+   void*        pData     = NULL;
+
+   if (NULL == pPacket)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                  "Get new RX PAL packet fail");
+      return VOS_STATUS_E_FAILURE;
+   }
+   vosStatus = vos_pkt_reserve_head_fast( pPacket, &pData,
+                                          VPKT_SIZE_BUFFER );
+   if(VOS_STATUS_SUCCESS != vosStatus)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                  "Prepare RX packet for DXE fail");
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   if((NULL == wpalPacketAvailableCB) || (NULL == userData))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                  "Invalid ARG for new RX packet");
+      return VOS_STATUS_E_FAILURE;
+   }
+
+   wpalPacketAvailableCB( (wpt_packet *)pPacket, userData );
+   return VOS_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    wpalPacketAlloc – Allocate a wpt_packet from PAL.
+    Param: 
+        pktType – specify the type of wpt_packet to allocate
+        nPktSize - packet size
+    Return:
+        A pointer to the wpt_packet. NULL means fail.
+---------------------------------------------------------------------------*/
+wpt_packet * wpalPacketAlloc(wpt_packet_type pktType, wpt_uint32 nPktSize,
+                             wpalPacketLowPacketCB rxLowCB, void *usrData)
+{
+   VOS_STATUS   vosStatus = VOS_STATUS_E_FAILURE;
+   wpt_packet*  pPkt      = NULL;
+   vos_pkt_t*   pVosPkt   = NULL;
+   void*        pData     = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+   /* Initialize DXE CB function pointer storage */
+   wpalPacketAvailableCB = NULL;
+   switch (pktType)
+   {
+   case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT:
+      vosStatus = vos_pkt_get_packet(&pVosPkt, VOS_PKT_TYPE_TX_802_11_MGMT,
+                                       nPktSize, 1, VOS_FALSE, 
+                                       NULL, NULL /*no callback*/);
+      break;
+
+   case eWLAN_PAL_PKT_TYPE_RX_RAW:
+      vosStatus = vos_pkt_get_packet(&pVosPkt, VOS_PKT_TYPE_RX_RAW,
+                                       nPktSize, 1, VOS_FALSE, 
+                                       wpalPacketRXLowResourceCB, usrData);
+
+#ifndef FEATURE_R33D
+      /* Reserve the entire raw rx buffer for DXE */
+      if( vosStatus == VOS_STATUS_SUCCESS )
+      {
+        vosStatus =  vos_pkt_reserve_head_fast( pVosPkt, &pData, nPktSize ); 
+      }
+      else
+      {
+        wpalPacketAvailableCB = rxLowCB;
+        WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "Failed to allocate packet : %d ", (int)vosStatus);
+      }
+#endif /* FEATURE_R33D */
+      break;
+
+   default:
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                  " try to allocate unsupported packet type (%d)\n", pktType);
+      break;
+   }
+
+   if(VOS_IS_STATUS_SUCCESS(vosStatus))
+   {
+      pPkt = (wpt_packet *)pVosPkt;
+   }
+
+
+   return pPkt;
+}/*wpalPacketAlloc*/
+
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketFree – Free a wpt_packet chain for one particular type.
+    For our legacy UMAC, it is not needed because vos_packet contains pal_packet.
+    Param: 
+        pPkt – pointer to a wpt_packet
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketFree(wpt_packet *pPkt)
+{
+   VOS_STATUS vosStatus;
+
+   if(NULL != pPkt->pInternalData)
+   {
+      wpalMemoryFree(pPkt->pInternalData);
+   }
+   vosStatus = vos_pkt_return_packet(WPAL_TO_VOS_PKT(pPkt));
+
+   //With VOSS support, we can cast between wpt_status and VOS_STATUS
+   return (wpt_status)vosStatus;
+}/*wpalPacketFree*/
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketGetLength – Get number of bytes in a wpt_packet. It include the 
+    bytes in a BD if it exist.
+    Param: 
+        pPkt - pointer to a packet to be freed.
+    Return:
+        Length of the data include layer-2 headers. For example, if the frame
+        is 802.3, the length includes the ethernet header.
+---------------------------------------------------------------------------*/
+wpt_uint32 wpalPacketGetLength(wpt_packet *pPkt)
+{
+   v_U16_t len = 0, pktLen = 0;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPkt))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL packet pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+
+   if( WPAL_PACKET_GET_BD_POINTER(pPkt) )
+   {
+      len = WPAL_PACKET_GET_BD_LENGTH(pPkt);
+   }
+   if( VOS_IS_STATUS_SUCCESS(vos_pkt_get_packet_length(WPAL_TO_VOS_PKT(pPkt), &pktLen)) )
+   {
+      len += pktLen;
+   }
+   else
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  failed\n",
+         __FUNCTION__);
+   }
+
+   return ((wpt_uint32)len);
+}/*wpalPacketGetLength*/
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketRawTrimHead – Move the starting offset and return the head pointer
+          before the moving. The function can only be used with raw packets,
+          whose buffer is one piece and allocated by WLAN driver. This also
+          reduce the length of the packet.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+        size – number of bytes to take off the head.
+    Return:
+        A pointer to the original buffer head before the trimming.
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketRawTrimHead(wpt_packet *pPkt, wpt_uint32 size)
+{
+   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPkt))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL packet pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   VOS_ASSERT( (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) ||
+               (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) );
+
+   if( !VOS_IS_STATUS_SUCCESS(vos_pkt_trim_head(WPAL_TO_VOS_PKT(pPkt), (v_SIZE_t)size)) )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  Invalid trim(%d)\n",
+         __FUNCTION__, size);
+      status = eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   return status;
+}/*wpalPacketRawTrimHead*/
+
+/*---------------------------------------------------------------------------
+    wpalPacketRawTrimTail – reduce the length of the packet.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+        size – number of bytes to take of the packet length
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Otherwise fail.
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketRawTrimTail(wpt_packet *pPkt, wpt_uint32 size)
+{
+   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPkt))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL packet pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   VOS_ASSERT( (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) ||
+               (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) );
+   if( !VOS_IS_STATUS_SUCCESS(vos_pkt_trim_tail(WPAL_TO_VOS_PKT(pPkt), (v_SIZE_t)size)) )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  Invalid trim(%d)\n",
+         __FUNCTION__, size);
+      status = eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   return status;
+}/*wpalPacketRawTrimTail*/
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketGetRawBuf – Return the starting buffer virtual address for the RAW flat buffer
+    It is inline in hope of faster implementation for certain platform. For Winxp, it 
+    will be slow.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+    Return:
+        NULL - fail.
+        Otherwise the address of the starting of the buffer
+---------------------------------------------------------------------------*/
+wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt)
+{
+   wpt_uint8 *pRet = NULL;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPkt))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL packet pointer", __FUNCTION__);
+      return NULL;
+   }
+
+   //Since it is a flat buffer, all we need is to get one byte of offset 0
+   if( (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) ||
+       (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) )
+   {
+      vos_pkt_peek_data(WPAL_TO_VOS_PKT(pPkt), 0, (v_VOID_t**)&pRet, 1);
+      WPAL_ASSERT(NULL != pRet);
+   }            
+
+   return pRet;
+}/*wpalPacketGetRawBuf*/
+
+
+/*---------------------------------------------------------------------------
+    wpalPacketSetRxLength – Set the valid data length on a RX packet. This function must 
+    be called once per RX packet per receiving. It indicates the available data length from
+    the start of the buffer.
+    Param: 
+        pPkt - pointer to a wpt_packet.
+    Return:
+        NULL - fail.
+        Otherwise the address of the starting of the buffer
+---------------------------------------------------------------------------*/
+wpt_status wpalPacketSetRxLength(wpt_packet *pPkt, wpt_uint32 len)
+{
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPkt))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL packet pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /*Only allowed for RX Raw packets */
+   if( (eWLAN_PAL_PKT_TYPE_RX_RAW != WPAL_PACKET_GET_TYPE(pPkt)))
+   {
+     WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                "%s  Invalid packet type(%d)\n",  __FUNCTION__, 
+                WPAL_PACKET_GET_TYPE(pPkt));
+     return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if(VOS_IS_STATUS_SUCCESS(vos_pkt_set_rx_length(WPAL_TO_VOS_PKT(pPkt), len)))
+   {
+      return eWLAN_PAL_STATUS_SUCCESS;
+   }
+   else
+   {
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+}/*wpalPacketSetRxLength*/
+
+/*
+  Set of helper functions that will prepare packet for DMA transfer,
+  based on the type of transfer : - to and from the device
+  - following these calls the packet will be locked for DMA only,
+  CPU will not be able to modify it => the packet must be explicitly returned to
+  the CPU once the DMA transfer is complete
+*/
+WPT_STATIC WPT_INLINE void* itGetOSPktAddrForDevice( wpt_packet *pPacket )
+{
+   struct sk_buff *skb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+   if ( VOS_STATUS_SUCCESS != 
+        vos_pkt_get_os_packet(WPAL_TO_VOS_PKT(pPacket), (void**)&skb, VOS_FALSE ))
+   {
+     return NULL;
+   }
+   else
+   {
+     /*Map skb data into dma-able memory 
+       (changes will be commited from cache) */
+     return (void*)dma_map_single( NULL, skb->data, skb->len, DMA_TO_DEVICE );
+   }
+}/*itGetOSPktAddrForDevice*/
+
+WPT_STATIC WPT_INLINE void* itGetOSPktAddrFromDevice( wpt_packet *pPacket )
+{
+
+   struct sk_buff *skb;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+   if ( VOS_STATUS_SUCCESS != 
+        vos_pkt_get_os_packet(WPAL_TO_VOS_PKT(pPacket), (void**)&skb, VOS_FALSE ))
+   {
+     return NULL;
+   }
+   else
+   {
+     /*Map skb data into dma-able memory 
+       (changes will be commited from cache) */
+     return (void*)dma_map_single( NULL, skb->data, skb->len, DMA_FROM_DEVICE );
+   }
+}/*itGetOSPktAddrFromDevice*/
+
+/*
+  Set of helper functions that will return a DMA-ed packet to the CPU,
+  based on the type of transfer : - to and from the device
+*/
+WPT_STATIC WPT_INLINE void itReturnOSPktAddrForDevice( wpt_packet *pPacket,  void* addr, wpt_uint32 size )
+{
+ 
+   dma_unmap_single( NULL, (dma_addr_t)addr, size, DMA_TO_DEVICE );
+}
+
+WPT_STATIC WPT_INLINE void itReturnOSPktAddrFromDevice( wpt_packet *pPacket, void* addr, wpt_uint32 size  )
+{
+
+   dma_unmap_single( NULL, (dma_addr_t)addr, size, DMA_FROM_DEVICE ); 
+}
+
+
+/*---------------------------------------------------------------------------
+    wpalIteratorInit – Initialize an interator by updating pCur to first item.
+    Param: 
+        pIter – pointer to a caller allocated wpt_iterator
+        pPacket – pointer to a wpt_packet
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalIteratorInit(wpt_iterator *pIter, wpt_packet *pPacket)
+{
+   wpt_status         status     = eWLAN_PAL_STATUS_SUCCESS;
+   wpt_iterator_info* pCurInfo   = NULL;
+   wpt_iterator_info* pNextInfo  = NULL;
+   wpt_iterator_info* pPktInfo   = NULL;
+
+   // Validate the parameter pointers
+   if (unlikely((NULL == pPacket)||(NULL==pIter)))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL input pointers %x %x", __FUNCTION__, pPacket, pIter);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   pPktInfo = (wpt_iterator_info*)pPacket->pInternalData;
+   if (unlikely(NULL == pPktInfo))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : Invalid Packet Info", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   // if there is NO BD on this frame, then initialize the next pointer to
+   // point the first fragment.
+   if ( NULL == WPAL_PACKET_GET_BD_PHYS(pPacket) )
+   {
+     pCurInfo   = pPktInfo;
+     pNextInfo           = NULL;
+   }
+   else
+   {
+     /*Allocate memory for the current info*/
+     pCurInfo = wpalMemoryAllocate( sizeof(wpt_iterator_info) );
+
+     // Validate the memory allocation
+     if (unlikely(NULL == pCurInfo))
+     {
+        WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "%s : Failed to allocate memory ", __FUNCTION__);
+        return eWLAN_PAL_STATUS_E_INVAL;
+     }
+
+     pCurInfo->pPhyAddr = WPAL_PACKET_GET_BD_PHYS(pPacket);
+     pCurInfo->uLen     = WPAL_PACKET_GET_BD_LENGTH(pPacket);
+
+     pNextInfo           = pPktInfo;
+   }      
+
+   pIter->pCur     = (void*)pCurInfo; 
+   pIter->pNext    = (void*)pNextInfo;
+   pIter->pContext = NULL;
+
+   return status;
+}/*wpalIteratorInit*/
+
+/*---------------------------------------------------------------------------
+    wpalIteratorNext – Get the address for the next item
+    Param: 
+        pIter – pointer to a caller allocated wpt_iterator
+        pPacket – pointer to a wpt_packet
+        ppAddr – Caller allocated pointer to return the address of the item.
+        For DMA-able devices, this is the physical address of the item.
+        pLen – To return the number of bytes in the item.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalIteratorNext(wpt_iterator *pIter, wpt_packet *pPacket, void **ppAddr, wpt_uint32 *pLen)
+{
+   wpt_iterator_info* pCurInfo  = NULL;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+   
+   /*-------------------------------------------------------------------------
+     Sanity check
+   -------------------------------------------------------------------------*/
+   if (unlikely(( NULL == pIter )||( NULL == pPacket ) || 
+      ( NULL == ppAddr ) || ( NULL == pLen )))
+   {
+     WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                "%s  Invalid input parameters \n",  __FUNCTION__ );
+     return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   pCurInfo = (wpt_iterator_info*)pIter->pCur; 
+   /*-------------------------------------------------------------------------
+     If current pointer is NULL - there is no data in the packet - return
+   -------------------------------------------------------------------------*/
+   if( pIter->pCur == NULL )
+   {
+      *ppAddr = NULL; 
+      *pLen   = 0;
+      return eWLAN_PAL_STATUS_SUCCESS;
+   }
+
+   /*Address and length are kept in the current field*/
+   *ppAddr = pCurInfo->pPhyAddr; 
+   *pLen   = pCurInfo->uLen;
+    
+   if( NULL == pIter->pNext )
+   {
+     /*Save the iterator for cleanup*/
+     pPacket->pInternalData = pIter->pCur; 
+     pIter->pCur            = NULL; 
+   }
+   else
+   {
+     /*Release the memory saved for storing the BD information*/
+     wpalMemoryFree(pCurInfo); 
+  
+     /*For LA - the packet is represented by maximum 2 fields of data 
+       - BD and actual data from sk buff */
+     pIter->pCur     = pIter->pNext;
+     pIter->pNext    = NULL;
+   }
+   
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    wpalLockPacketForTransfer – Map the data buffer from dma so that the
+                         data is commited from cache and the cpu relinquishes
+                         ownership of the buffer
+ 
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalLockPacketForTransfer( wpt_packet *pPacket)
+{
+   void*              pPhyData   = NULL;
+   wpt_iterator_info* pInfo      = NULL;
+   v_U16_t            uLenData   = 0;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL input pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   switch(WPAL_PACKET_GET_TYPE(pPacket))
+   {
+      /* For management frames, BD is allocated by WDI, header is in raw buffer,
+         rest of the frame is also in raw buffer */
+   case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT:
+      {
+         /*TX Packets need to be DMA-ed to the device, perform DMA mapping 
+           accordingly */
+         pPhyData = (void*)itGetOSPktAddrForDevice( pPacket );   
+      }
+      break;
+         /* Data packets - BD (allocated by WDI), header (in VOSS header),
+            rest of the packet (DSM items) */
+   case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA:
+   case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA:
+      {
+         /*TX Packets need to be DMA-ed to the device, perform DMA mapping 
+           accordingly */
+         pPhyData = (void*)itGetOSPktAddrForDevice( pPacket );
+      }
+      break;
+
+      /* For Raw RX, BD + header + rest of the packet is all contained in the raw
+         buffer */
+   case eWLAN_PAL_PKT_TYPE_RX_RAW:
+      {
+         /*RX Packets need to be DMA-ed from the device, perform DMA mapping 
+           accordingly */
+         pPhyData = (void*)itGetOSPktAddrFromDevice( pPacket );
+      }
+      break;
+
+   default:
+      {
+         WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                    " WLAN_PAL: %s: Invalid packet type %d!",  __FUNCTION__, 
+                    WPAL_PACKET_GET_TYPE(pPacket) ); 
+         WPAL_ASSERT(0); 
+         return eWLAN_PAL_STATUS_E_FAILURE;
+      }
+   }
+
+   /*Get packet length*/
+   vos_pkt_get_packet_length(WPAL_TO_VOS_PKT(pPacket),&uLenData);
+
+    /*Allocate memory for the current info*/
+   pInfo = wpalMemoryAllocate( sizeof(wpt_iterator_info) );
+
+   // Validate the memory allocation
+   if (unlikely(NULL == pInfo))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : Failed to allocate memory ", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   pInfo->pPhyAddr = pPhyData;
+   pInfo->uLen     = uLenData;
+
+   pPacket->pInternalData = pInfo;
+   return eWLAN_PAL_STATUS_SUCCESS;
+}/*wpalLockPacketForTransfer*/
+
+/*---------------------------------------------------------------------------
+    wpalUnlockPacket – Unmap the data buffer from dma so that cpu can regain
+                          ownership on it
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success
+---------------------------------------------------------------------------*/
+wpt_status wpalUnlockPacket( wpt_packet *pPacket)
+{
+
+   wpt_iterator_info* pInfo;
+
+   // Validate the parameter pointers
+   if (unlikely(NULL == pPacket))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL input pointer pPacket", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   pInfo  = (wpt_iterator_info*)pPacket->pInternalData;
+
+   // Validate pInfo
+   if (unlikely(NULL == pInfo))
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                "%s : NULL input pointer pInfo", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   switch(WPAL_PACKET_GET_TYPE(pPacket))
+   {
+      /* For management frames, BD is allocated by WDI, header is in raw buffer,
+         rest of the frame is also in raw buffer */
+   case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT:
+      {
+         /*TX Packets need to be DMA-ed to the device, perform DMA mapping 
+           accordingly */
+        itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen);   
+      }
+      break;
+         /* Data packets - BD (allocated by WDI), header (in VOSS header),
+            rest of the packet (DSM items) */
+   case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA:
+   case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA:
+      {
+         /*TX Packets need to be DMA-ed to the device, perform DMA mapping 
+           accordingly */
+         itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen);   
+      }
+      break;
+
+      /* For Raw RX, BD + header + rest of the packet is all contained in the raw
+         buffer */
+   case eWLAN_PAL_PKT_TYPE_RX_RAW:
+      {
+         /*RX Packets need to be DMA-ed from the device, perform DMA mapping 
+           accordingly */
+         itReturnOSPktAddrFromDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen);   
+      }
+      break;
+
+   default:
+      {
+         WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                    " WLAN_PAL: %s: Invalid packet type %d!",  __FUNCTION__, 
+                    WPAL_PACKET_GET_TYPE(pPacket) ); 
+         WPAL_ASSERT(0); 
+         return eWLAN_PAL_STATUS_E_FAILURE;
+      }
+   }
+
+  wpalMemoryFree(pInfo);
+  pPacket->pInternalData = NULL;
+  return eWLAN_PAL_STATUS_SUCCESS;
+}/*wpalUnlockPacket*/
+
+/*---------------------------------------------------------------------------
+    wpalIsPacketLocked –  Check whether the Packet is locked for DMA.
+    Param: 
+        pPacket – pointer to a wpt_packet
+ 
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS
+        eWLAN_PAL_STATUS_E_FAILURE
+        eWLAN_PAL_STATUS_E_INVAL
+---------------------------------------------------------------------------*/
+wpt_status wpalIsPacketLocked( wpt_packet *pPacket)
+{
+
+   wpt_iterator_info* pInfo;
+
+   /* Validate the parameter pointers */
+   if (NULL == pPacket)
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s : NULL input pointer", __FUNCTION__);
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   /* Validate pInternalData */
+   pInfo  = (wpt_iterator_info*)pPacket->pInternalData;
+   return (NULL == pInfo)? eWLAN_PAL_STATUS_E_FAILURE : 
+                    eWLAN_PAL_STATUS_SUCCESS;
+}/*wpalIsPacketLocked*/
+
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c b/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
new file mode 100644
index 0000000..28f86f1
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
@@ -0,0 +1,245 @@
+/*
+ * 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  wlan_qct_pal_sync.c
+  
+  \brief Implementation trace/logging APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform Windows and with legacy UMAC.
+  
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_sync.h"
+#include "wlan_qct_pal_trace.h"
+
+#include "wlan_qct_os_status.h"
+
+/**
+wpalMutexInit()
+
+@brief
+  This function initializes a mutex object
+
+@param pMutex: a pointer to caller allocated object of wpt_mutex
+
+@return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+
+*/
+wpt_status wpalMutexInit(wpt_mutex *pMutex)
+{
+    /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_lock_init( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " mutex init fail\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief Invalidate a mutex object
+
+    \param pMutex - a pointer to caller allocated object of wpt_mutex
+
+    \return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexDelete(wpt_mutex *pMutex)
+{
+    /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_lock_destroy( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " mutex delete fail\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief Acquire a mutex object. It is blocked until the object is acquired.
+
+    \param pMutex - a pointer to caller allocated object of wpt_mutex
+
+    \return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexAcquire(wpt_mutex *pMutex)
+{
+    /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_lock_acquire( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " mutex acquire fail\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief Release a held mutex object
+
+    \param pMutex - a pointer to caller allocated object of wpt_mutex
+
+    \return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalMutexRelease(wpt_mutex *pMutex)
+{
+    /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_lock_release( (vos_lock_t*)pMutex ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " mutex release\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief Initialize an event object
+
+    \param pEvent – a pointer to caller allocated object of wpt_event
+
+    \return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+------------------------------------------------------------------------*/
+wpt_status wpalEventInit(wpt_event *pEvent)
+{
+   /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_event_init( (vos_event_t*)pEvent ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " create event fail\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief Invalidate an event object
+
+    \param pEvent – a pointer to caller allocated object of wpt_event
+
+    \return eWLAN_PAL_STATUS_SUCCESS if success. Fail otherwise.
+------------------------------------------------------------------------*/
+
+wpt_status wpalEventDelete(wpt_event *pEvent)
+{
+   /* Not doing sanity checks since VOS does them anyways */
+
+   if( vos_event_destroy( (vos_event_t*)pEvent ) != VOS_STATUS_SUCCESS )
+   {
+      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
+                 " delete event fail\n");
+      return eWLAN_PAL_STATUS_E_FAILURE;
+   }
+
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
+
+/*---------------------------------------------------------------------------
+    @brief wpalEventWait – Wait on an event object
+
+    \param
+        pEvent – a pointer to caller allocated object of wpt_event
+        timeout - timeout value at unit of milli-seconds. 
+                  0xffffffff means infinite wait
+
+     \return eWLAN_PAL_STATUS_SUCCESS - the wait was satisifed by one of the events
+             in the event array being set.  The index into the event arry 
+             that satisfied the wait can be found at *pEventIndex.
+                                  
+             eWLAN_PALSTATUS_E_TIMEOUT - the timeout interval elapsed before any of 
+             the events were set.
+                                    
+             eWLAN_PAL_STATUS_E_INVAL - At least one of the values specified in
+             the event array refers to an uninitialized event object.  The
+             invalid event is identified by the index in *pEventIndex.  Note
+             that only the first uninitialized event is detected when this error
+             is returned.
+             
+             eWLAN_PAL_STATUS_E_EMPTY - the events array is empty.  This condition
+             is detected by numEvents being 0 on input.
+              
+             eWLAN_PAL_STATUS_E_FAULT - event or pEventIndex is an invalid pointer.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventWait(wpt_event *pEvent, wpt_uint32 timeout)
+{
+   /* Not doing sanity checks since VOS does them anyways */
+
+   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
+   VOS_STATUS  vos_status = VOS_STATUS_E_FAILURE;
+
+   /* In VOS timeout = 0 corresponds to infinite wait */
+   timeout = ( timeout == WLAN_PAL_WAIT_INFINITE ? 0 : timeout );
+
+   vos_status = vos_wait_single_event( (vos_event_t*)pEvent, timeout );
+
+   status = WPAL_VOS_TO_WPAL_STATUS( vos_status );
+
+   return status;
+}
+
+/*---------------------------------------------------------------------------
+    wpalEventSet – Set an event object to signaled state
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventSet(wpt_event *pEvent)
+{
+   /* Not doing sanity checks since VOS does them anyways */
+
+   return ( WPAL_VOS_TO_WPAL_STATUS(vos_event_set( (vos_event_t*)pEvent )) );
+}
+
+/*---------------------------------------------------------------------------
+    wpalEventReset – Set an event object to non-signaled state
+    Param:
+        pEvent – a pointer to caller allocated object of wpt_event
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalEventReset(wpt_event *pEvent)
+{
+   /* Not doing sanity checks since VOS does them anyways */
+
+   return ( WPAL_VOS_TO_WPAL_STATUS(vos_event_reset( (vos_event_t*)pEvent )) );
+}
+
+
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c b/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
new file mode 100644
index 0000000..78eecf6
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
@@ -0,0 +1,180 @@
+/*
+ * 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  wlan_qct_pal_timer.c
+  
+  \brief Implementation trace/logging APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for platform Windows.
+  
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_timer.h"
+#include "wlan_qct_pal_trace.h"
+#include "wlan_qct_os_status.h"
+#include "vos_threads.h"
+
+/*---------------------------------------------------------------------------
+ \brief wpalTimerCback - VOS timer callback function
+
+ \param pUserdata - A cookie to data passed back in the callback function
+---------------------------------------------------------------------------*/
+static void wpalTimerCback( void * userData )
+{
+   wpt_timer *pTimer = (wpt_timer *)userData;
+
+   if(NULL != pTimer->callback)
+   {
+      pTimer->callback(pTimer->pUserData);
+   }
+   else
+   {
+      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_WARN, " %s pTimer(%d) callback after deleted \n",
+         __FUNCTION__, (wpt_uint32)pTimer );
+   }
+}/*wpalTimerCback*/
+
+/*---------------------------------------------------------------------------
+ \brief wpalTimerInit - initialize a wpt_timer object
+
+ \param pTimer - a pointer to caller allocated wpt_timer object
+ \param callback - A callback function
+ \param pUserData - A cookie to data passed back in the callback function
+
+ \return wpt_status eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerInit(wpt_timer * pTimer, wpal_timer_callback callback, void *pUserData)
+{
+   /* Sanity Checks */
+   if( pTimer == NULL || callback == NULL )
+   {
+      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d) callback(%d)\n",
+         __FUNCTION__, (wpt_uint32)pTimer, (wpt_uint32)callback );
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   if ( vos_timer_init( &pTimer->timer.timerObj, VOS_TIMER_TYPE_SW, 
+                        wpalTimerCback, (void*)pTimer ) == VOS_STATUS_SUCCESS )
+   {
+      pTimer->callback = callback;
+      pTimer->pUserData = pUserData;
+      return eWLAN_PAL_STATUS_SUCCESS;
+   }
+
+   return eWLAN_PAL_STATUS_E_FAILURE;
+}/*wpalTimerInit*/
+
+
+/*---------------------------------------------------------------------------
+    \brief wpalTimerDelete - invalidate a wpt_timer object
+
+    \param pTimer a pointer to caller allocated wpt_timer object
+
+    \return eWLAN_PAL_STATUS_SUCCESS ?? success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerDelete(wpt_timer *pTimer)
+{
+   wpt_status status;
+
+   /* Sanity Checks */
+   if( pTimer == NULL )
+   {
+      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
+         __FUNCTION__, (wpt_uint32)pTimer );
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+
+   status = WPAL_VOS_TO_WPAL_STATUS( vos_timer_destroy(&pTimer->timer.timerObj));
+
+   if( status == eWLAN_PAL_STATUS_SUCCESS )
+   {
+      pTimer->callback = NULL;
+      pTimer->pUserData = NULL;
+   }
+
+   return status;
+}/*wpalTimerDelete*/
+
+
+/*---------------------------------------------------------------------------
+    wpalTimerStart - start a wpt_timer object with a timeout value
+
+    \param pTimer - a pointer to caller allocated wpt_timer object
+    \param timeout - timeout value of the timer. In unit of milli-seconds
+
+    \return
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout)
+{
+   /* Sanity Checks */
+   if( pTimer == NULL )
+   {
+      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
+         __FUNCTION__, (wpt_uint32)pTimer );
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+   return ( WPAL_VOS_TO_WPAL_STATUS( vos_timer_start( &pTimer->timer.timerObj,
+                                                     timeout ) ) );
+}/*wpalTimerStart*/
+
+
+/*---------------------------------------------------------------------------
+    \brief wpalTimerStop - stop a wpt_timer object. Stop doesn't guarantee the
+            timer handler is not called if it is already timeout.
+
+    \param pTimer - a pointer to caller allocated wpt_timer object
+
+    \return
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalTimerStop(wpt_timer * pTimer)
+{
+   /* Sanity Checks */
+   if( pTimer == NULL )
+   {
+      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
+         __FUNCTION__, (wpt_uint32)pTimer );
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
+   return (WPAL_VOS_TO_WPAL_STATUS( vos_timer_stop( &pTimer->timer.timerObj )));
+}/*wpalTimerStop*/
+
+/*---------------------------------------------------------------------------
+    wpalSleep - sleep for a specified interval
+    Param:
+        timeout - amount of time to sleep. In unit of milli-seconds.
+    Return:
+        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
+---------------------------------------------------------------------------*/
+wpt_status wpalSleep(wpt_uint32 timeout)
+{
+   vos_sleep( timeout );
+   return eWLAN_PAL_STATUS_SUCCESS;
+}
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c b/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
new file mode 100644
index 0000000..eba3942
--- /dev/null
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
@@ -0,0 +1,338 @@
+/*
+ * 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  wlan_qct_pal_trace.c
+  
+  \brief Implementation trace/logging APIs PAL exports. wpt = (Wlan Pal Type) wpal = (Wlan PAL)
+               
+   Definitions for Linux/Android platform
+  
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
+  
+  ========================================================================*/
+
+#include "wlan_qct_pal_trace.h"
+#include "i_vos_types.h"
+
+#ifdef WLAN_DEBUG
+
+
+/*--------------------------------------------------------------------------
+  Preprocessor definitions and constants
+  ------------------------------------------------------------------------*/
+
+#define WPAL_TRACE_BUFFER_SIZE ( 512 )
+
+// macro to map wpal trace levels into the bitmask
+#define WPAL_TRACE_LEVEL_TO_MODULE_BITMASK( _level ) ( ( 1 << (_level) ) )
+
+typedef struct
+{
+   // Trace level for a module, as a bitmask.  The bits in this mask
+   // are ordered by wpt_tracelevel.  For example, each bit represents
+   // one of the bits in wpt_tracelevel that may be turned on to have
+   // traces at that level logged, i.e. if eWLAN_PAL_TRACE_LEVEL_ERROR is
+   // == 2, then if bit 2 (low order) is turned ON, then ERROR traces
+   // will be printed to the trace log.
+   //
+   // Note that all bits turned OFF means no traces.
+   wpt_uint16 moduleTraceLevel;
+
+   // 3 character string name for the module
+   wpt_uint8 moduleNameStr[ 4 ];   // 3 chars plus the NULL
+
+} moduleTraceInfo;
+
+
+// Array of static data that contains all of the per module trace
+// information.  This includes the trace level for the module and
+// the 3 character 'name' of the module for marking the trace logs.
+moduleTraceInfo gTraceInfo[ eWLAN_MODULE_COUNT ] =
+{
+   { (1<<eWLAN_PAL_TRACE_LEVEL_FATAL)|(1<<eWLAN_PAL_TRACE_LEVEL_ERROR), "DAL" }, 
+   { (1<<eWLAN_PAL_TRACE_LEVEL_FATAL)|(1<<eWLAN_PAL_TRACE_LEVEL_ERROR), "CTL" },
+   { (1<<eWLAN_PAL_TRACE_LEVEL_FATAL)|(1<<eWLAN_PAL_TRACE_LEVEL_ERROR), "DAT" }, 
+   { (1<<eWLAN_PAL_TRACE_LEVEL_FATAL)|(1<<eWLAN_PAL_TRACE_LEVEL_ERROR), "PAL" }, 
+};
+
+
+// the trace level strings in an array.  these are ordered in the same order
+// as the trace levels are defined in the enum (see wpt_tracelevel) so we
+// can index into this array with the level and get the right string.  The
+// trace levels are...
+// none, Fatal, Error, Warning, Info, InfoHigh, InfoMed, InfoLow
+static const char * TRACE_LEVEL_STR[] = {
+   "  ", "F ", "E ", "W ", "I ", "IH", "IM", "IL" };
+
+
+/*-------------------------------------------------------------------------
+  Functions
+  ------------------------------------------------------------------------*/
+static void wpalOutput(wpt_tracelevel level, char *strBuffer)
+{
+   switch(level)
+   {
+   default:
+      printk(KERN_CRIT "%s: Unknown trace level passed in!\n", __FUNCTION__); 
+      // fall thru and use FATAL
+
+   case eWLAN_PAL_TRACE_LEVEL_FATAL:
+      printk(KERN_CRIT "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_ERROR:
+      printk(KERN_ERR "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_WARN:
+      printk(KERN_WARNING "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_INFO:
+      printk(KERN_INFO "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_INFO_HIGH:
+      printk(KERN_NOTICE "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_INFO_MED:
+      printk(KERN_NOTICE "%s\n", strBuffer);
+      break;
+
+   case eWLAN_PAL_TRACE_LEVEL_INFO_LOW:
+      printk(KERN_INFO "%s\n", strBuffer);
+      break;
+   }
+}
+
+void wpalTraceSetLevel( wpt_moduleid module, wpt_tracelevel level,
+                        wpt_boolean on )
+{
+   // Make sure the caller is passing in a valid LEVEL and MODULE.
+   if ( (eWLAN_PAL_TRACE_LEVEL_COUNT <= level) ||
+        (eWLAN_MODULE_COUNT <= module) )
+   {
+      return;
+   }
+
+   if ( eWLAN_PAL_TRACE_LEVEL_NONE == level )
+   {
+      // Treat 'none' differently.  NONE means we have to turn off all
+      // the bits in the bit mask so none of the traces appear.
+      gTraceInfo[ module ].moduleTraceLevel = 0;
+   }
+   else if ( eWLAN_PAL_TRACE_LEVEL_ALL == level )
+   {
+      // Treat 'all' differently.  ALL means we have to turn on all
+      // the bits in the bit mask so all of the traces appear.
+      gTraceInfo[ module ].moduleTraceLevel = 0xFFFF;
+   }
+   else
+   {
+      // We are turning a particular trace level on or off
+      if (on)
+      {
+         // Set the desired bit in the bit mask for the module trace level.
+         gTraceInfo[ module ].moduleTraceLevel |=
+            WPAL_TRACE_LEVEL_TO_MODULE_BITMASK( level );
+      }
+      else
+      {
+         // Clear the desired bit in the bit mask for the module trace level.
+         gTraceInfo[ module ].moduleTraceLevel &=
+            ~(WPAL_TRACE_LEVEL_TO_MODULE_BITMASK( level ));
+      }
+   }
+}
+
+wpt_boolean wpalTraceCheckLevel( wpt_moduleid module, wpt_tracelevel level )
+{
+   wpt_boolean traceOn = eWLAN_PAL_FALSE;
+
+   if ( ( eWLAN_PAL_TRACE_LEVEL_NONE == level ) ||
+        ( level >= eWLAN_PAL_TRACE_LEVEL_COUNT ))
+   {
+      traceOn = eWLAN_PAL_FALSE;
+   }
+   else
+   {
+      traceOn = ( level & gTraceInfo[ module ].moduleTraceLevel ) ? eWLAN_PAL_TRUE : eWLAN_PAL_FALSE;
+   }
+
+   return( traceOn );
+}
+
+void wpalTraceDisplay(void)
+{
+   wpt_moduleid moduleId;
+
+   printk(KERN_CRIT
+          "     1)FATAL  2)ERROR  3)WARN  4)INFO  "
+          "5)INFO_H  6)INFO_M  7)INFO_L\n"); 
+   for (moduleId = 0; moduleId < eWLAN_MODULE_COUNT; ++moduleId)
+   {
+      printk(KERN_CRIT
+             "%2d)%s    %s        %s       %s       "
+             "%s        %s         %s         %s\n",
+             (int)moduleId,
+             gTraceInfo[moduleId].moduleNameStr,
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_FATAL)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_ERROR)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_WARN)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_INFO)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_INFO_HIGH)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_INFO_MED)) ? "X":" ",
+             (gTraceInfo[moduleId].moduleTraceLevel &
+              (1 << eWLAN_PAL_TRACE_LEVEL_INFO_LOW)) ? "X":" "
+         );
+   }
+
+}
+
+/*----------------------------------------------------------------------------
+
+  \brief wpalTrace() - Externally called trace function
+
+  Checks the level of severity and accordingly prints the trace messages
+
+  \param module - module identifier.   A member of the wpt_moduleid
+         enumeration that identifies the module issuing the trace message.
+
+  \param level - trace level.   A member of the wpt_tracelevel
+         enumeration indicating the severity of the condition causing the
+         trace message to be issued.   More severe conditions are more
+         likely to be logged.
+
+  \param strFormat - format string.  The message to be logged.  This format
+         string contains printf-like replacement parameters, which follow
+         this parameter in the variable argument list.
+
+  \return  nothing
+
+  \sa
+
+  --------------------------------------------------------------------------*/
+void wpalTrace( wpt_moduleid module, wpt_tracelevel level, char *strFormat, ... )
+{
+   wpt_uint8 strBuffer[ WPAL_TRACE_BUFFER_SIZE ];
+   int n;
+
+   // Print the trace message when the desired level bit is set in the module
+   // tracel level mask.
+   if ( gTraceInfo[ module ].moduleTraceLevel & WPAL_TRACE_LEVEL_TO_MODULE_BITMASK( level ) )
+   {
+      va_list val;
+      va_start(val, strFormat);
+
+      // print the prefix string into the string buffer...
+      n = snprintf(strBuffer, WPAL_TRACE_BUFFER_SIZE, "[%d:%d:%2s:%3s] ",
+                   smp_processor_id(),
+                   in_interrupt() ? 0 : current->pid,
+                   (char *) TRACE_LEVEL_STR[ level ],
+                   (char *) gTraceInfo[ module ].moduleNameStr);
+
+
+      // print the formatted log message after the prefix string.
+      // note we reserve space for the terminating NUL
+      vsnprintf(strBuffer + n, WPAL_TRACE_BUFFER_SIZE - n - 1, strFormat, val);
+      wpalOutput(level, strBuffer);
+      va_end(val);
+   }
+}
+
+/**----------------------------------------------------------------------------
+  
+ \brief WPAL_DUMP() / wpalDump() - Trace / logging API
+   
+ Users wishing to add tracing memory dumps to their code should use 
+ WPAL_DUMP.  WPAL_DUMP() will compile into a call to wpalDump() when
+ tracing is enabled.
+  
+ \param module - module identifier.   A member of the wpt_moduleid
+                 enumeration that identifies the module performing the dump
+         
+ \param level - trace level.   A member of the wpt_tracelevel 
+                enumeration indicating the severity of the condition causing the
+                memory to be dumped.   More severe conditions are more 
+                likely to be logged.
+         
+ \param pMemory - memory.  A pointer to the memory to be dumped
+
+ \param length - length.  How many bytes of memory to be dumped
+  
+   \return  nothing
+    
+  --------------------------------------------------------------------------*/
+// how many bytes do we output per line
+#define BYTES_PER_LINE 16
+
+// each byte takes 2 characters plus a space, plus need room for NUL
+#define CHARS_PER_LINE ((BYTES_PER_LINE * 3) + 1)
+
+void wpalDump( wpt_moduleid module, wpt_tracelevel level,
+               wpt_uint8 *pMemory, wpt_uint32 length)
+{
+   char strBuffer[CHARS_PER_LINE];
+   int n, num, offset;
+
+   // Dump the memory when the desired level bit is set in the module
+   // tracel level mask.
+   if ( gTraceInfo[ module ].moduleTraceLevel & WPAL_TRACE_LEVEL_TO_MODULE_BITMASK( level ) )
+   {
+      num = 0;
+      offset = 0;
+      while (length > 0)
+      {
+         n = snprintf(strBuffer + offset, CHARS_PER_LINE - offset - 1,
+                      "%02X ", *pMemory);
+         offset += n;
+         num++;
+         length--;
+         pMemory++;
+         if (BYTES_PER_LINE == num)
+         {
+            wpalOutput(level, strBuffer);
+            num = 0;
+            offset = 0;
+         }
+      }
+
+      if (offset > 0)
+      {
+         // partial line remains
+         wpalOutput(level, strBuffer);
+      }
+   }
+}
+#endif //WLAN_DEBUG